var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
var _a;
import { s as __toESM, t as __commonJSMin } from "./chunk-BNovOVIE.js";
import { t as require_react } from "./react-DA-nE2FX.js";
function panic(f = "This should not happen") {
  throw Error(f);
}
function assert(f, V = "Assertion failed") {
  if (!f) return panic(V);
}
function assertNever(f, V) {
  return panic(V ?? "Hell froze over");
}
function maybe(f, V) {
  try {
    return f();
  } catch {
    return V;
  }
}
var has$2 = Object.prototype.hasOwnProperty;
function deepEqual(f, V) {
  let H, U;
  if (f === V) return true;
  if (f && V && (H = f.constructor) === V.constructor) {
    if (H === Date) return f.getTime() === V.getTime();
    if (H === RegExp) return f.toString() === V.toString();
    if (H === Array) {
      if ((U = f.length) === V.length) for (; U-- && deepEqual(f[U], V[U]); ) ;
      return U === -1;
    }
    if (!H || typeof f == "object") {
      for (H in U = 0, f) if (has$2.call(f, H) && ++U && !has$2.call(V, H) || !(H in V) || !deepEqual(f[H], V[H])) return false;
      return Object.keys(V).length === U;
    }
  }
  return f !== f && V !== V;
}
var require__baseHas = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = Object.prototype.hasOwnProperty;
  function U(f2, V2) {
    return f2 != null && H.call(f2, V2);
  }
  V.exports = U;
})), require_isArray = /* @__PURE__ */ __commonJSMin(((f, V) => {
  V.exports = Array.isArray;
})), require__freeGlobal = /* @__PURE__ */ __commonJSMin(((f, V) => {
  V.exports = typeof global == "object" && global && global.Object === Object && global;
})), require__root = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = require__freeGlobal(), U = typeof self == "object" && self && self.Object === Object && self;
  V.exports = H || U || Function("return this")();
})), require__Symbol = /* @__PURE__ */ __commonJSMin(((f, V) => {
  V.exports = require__root().Symbol;
})), require__getRawTag = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = require__Symbol(), U = Object.prototype, W = U.hasOwnProperty, G = U.toString, K = H ? H.toStringTag : void 0;
  function q(f2) {
    var V2 = W.call(f2, K), H2 = f2[K];
    try {
      f2[K] = void 0;
      var U2 = true;
    } catch {
    }
    var q2 = G.call(f2);
    return U2 && (V2 ? f2[K] = H2 : delete f2[K]), q2;
  }
  V.exports = q;
})), require__objectToString = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = Object.prototype.toString;
  function U(f2) {
    return H.call(f2);
  }
  V.exports = U;
})), require__baseGetTag = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = require__Symbol(), U = require__getRawTag(), W = require__objectToString(), G = "[object Null]", K = "[object Undefined]", q = H ? H.toStringTag : void 0;
  function J(f2) {
    return f2 == null ? f2 === void 0 ? K : G : q && q in Object(f2) ? U(f2) : W(f2);
  }
  V.exports = J;
})), require_isObjectLike = /* @__PURE__ */ __commonJSMin(((f, V) => {
  function H(f2) {
    return typeof f2 == "object" && !!f2;
  }
  V.exports = H;
})), require_isSymbol = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = require__baseGetTag(), U = require_isObjectLike(), W = "[object Symbol]";
  function G(f2) {
    return typeof f2 == "symbol" || U(f2) && H(f2) == W;
  }
  V.exports = G;
})), require__isKey = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = require_isArray(), U = require_isSymbol(), W = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, G = /^\w*$/;
  function K(f2, V2) {
    if (H(f2)) return false;
    var K2 = typeof f2;
    return K2 == "number" || K2 == "symbol" || K2 == "boolean" || f2 == null || U(f2) ? true : G.test(f2) || !W.test(f2) || V2 != null && f2 in Object(V2);
  }
  V.exports = K;
})), require_isObject = /* @__PURE__ */ __commonJSMin(((f, V) => {
  function H(f2) {
    var V2 = typeof f2;
    return f2 != null && (V2 == "object" || V2 == "function");
  }
  V.exports = H;
})), require_isFunction = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = require__baseGetTag(), U = require_isObject(), W = "[object AsyncFunction]", G = "[object Function]", K = "[object GeneratorFunction]", q = "[object Proxy]";
  function J(f2) {
    if (!U(f2)) return false;
    var V2 = H(f2);
    return V2 == G || V2 == K || V2 == W || V2 == q;
  }
  V.exports = J;
})), require__coreJsData = /* @__PURE__ */ __commonJSMin(((f, V) => {
  V.exports = require__root()["__core-js_shared__"];
})), require__isMasked = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = require__coreJsData(), U = (function() {
    var f2 = /[^.]+$/.exec(H && H.keys && H.keys.IE_PROTO || "");
    return f2 ? "Symbol(src)_1." + f2 : "";
  })();
  function W(f2) {
    return !!U && U in f2;
  }
  V.exports = W;
})), require__toSource = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = Function.prototype.toString;
  function U(f2) {
    if (f2 != null) {
      try {
        return H.call(f2);
      } catch {
      }
      try {
        return f2 + "";
      } catch {
      }
    }
    return "";
  }
  V.exports = U;
})), require__baseIsNative = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = require_isFunction(), U = require__isMasked(), W = require_isObject(), G = require__toSource(), K = /[\\^$.*+?()[\]{}|]/g, q = /^\[object .+?Constructor\]$/, J = Function.prototype, Y = Object.prototype, X = J.toString, Z = Y.hasOwnProperty, Q = RegExp("^" + X.call(Z).replace(K, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
  function $(f2) {
    return !W(f2) || U(f2) ? false : (H(f2) ? Q : q).test(G(f2));
  }
  V.exports = $;
})), require__getValue = /* @__PURE__ */ __commonJSMin(((f, V) => {
  function H(f2, V2) {
    return f2 == null ? void 0 : f2[V2];
  }
  V.exports = H;
})), require__getNative = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = require__baseIsNative(), U = require__getValue();
  function W(f2, V2) {
    var W2 = U(f2, V2);
    return H(W2) ? W2 : void 0;
  }
  V.exports = W;
})), require__nativeCreate = /* @__PURE__ */ __commonJSMin(((f, V) => {
  V.exports = require__getNative()(Object, "create");
})), require__hashClear = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = require__nativeCreate();
  function U() {
    this.__data__ = H ? H(null) : {}, this.size = 0;
  }
  V.exports = U;
})), require__hashDelete = /* @__PURE__ */ __commonJSMin(((f, V) => {
  function H(f2) {
    var V2 = this.has(f2) && delete this.__data__[f2];
    return this.size -= V2 ? 1 : 0, V2;
  }
  V.exports = H;
})), require__hashGet = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = require__nativeCreate(), U = "__lodash_hash_undefined__", W = Object.prototype.hasOwnProperty;
  function G(f2) {
    var V2 = this.__data__;
    if (H) {
      var G2 = V2[f2];
      return G2 === U ? void 0 : G2;
    }
    return W.call(V2, f2) ? V2[f2] : void 0;
  }
  V.exports = G;
})), require__hashHas = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = require__nativeCreate(), U = Object.prototype.hasOwnProperty;
  function W(f2) {
    var V2 = this.__data__;
    return H ? V2[f2] !== void 0 : U.call(V2, f2);
  }
  V.exports = W;
})), require__hashSet = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = require__nativeCreate(), U = "__lodash_hash_undefined__";
  function W(f2, V2) {
    var W2 = this.__data__;
    return this.size += this.has(f2) ? 0 : 1, W2[f2] = H && V2 === void 0 ? U : V2, this;
  }
  V.exports = W;
})), require__Hash = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = require__hashClear(), U = require__hashDelete(), W = require__hashGet(), G = require__hashHas(), K = require__hashSet();
  function q(f2) {
    var V2 = -1, H2 = f2 == null ? 0 : f2.length;
    for (this.clear(); ++V2 < H2; ) {
      var U2 = f2[V2];
      this.set(U2[0], U2[1]);
    }
  }
  q.prototype.clear = H, q.prototype.delete = U, q.prototype.get = W, q.prototype.has = G, q.prototype.set = K, V.exports = q;
})), require__listCacheClear = /* @__PURE__ */ __commonJSMin(((f, V) => {
  function H() {
    this.__data__ = [], this.size = 0;
  }
  V.exports = H;
})), require_eq = /* @__PURE__ */ __commonJSMin(((f, V) => {
  function H(f2, V2) {
    return f2 === V2 || f2 !== f2 && V2 !== V2;
  }
  V.exports = H;
})), require__assocIndexOf = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = require_eq();
  function U(f2, V2) {
    for (var U2 = f2.length; U2--; ) if (H(f2[U2][0], V2)) return U2;
    return -1;
  }
  V.exports = U;
})), require__listCacheDelete = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = require__assocIndexOf(), U = Array.prototype.splice;
  function W(f2) {
    var V2 = this.__data__, W2 = H(V2, f2);
    return W2 < 0 ? false : (W2 == V2.length - 1 ? V2.pop() : U.call(V2, W2, 1), --this.size, true);
  }
  V.exports = W;
})), require__listCacheGet = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = require__assocIndexOf();
  function U(f2) {
    var V2 = this.__data__, U2 = H(V2, f2);
    return U2 < 0 ? void 0 : V2[U2][1];
  }
  V.exports = U;
})), require__listCacheHas = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = require__assocIndexOf();
  function U(f2) {
    return H(this.__data__, f2) > -1;
  }
  V.exports = U;
})), require__listCacheSet = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = require__assocIndexOf();
  function U(f2, V2) {
    var U2 = this.__data__, W = H(U2, f2);
    return W < 0 ? (++this.size, U2.push([f2, V2])) : U2[W][1] = V2, this;
  }
  V.exports = U;
})), require__ListCache = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = require__listCacheClear(), U = require__listCacheDelete(), W = require__listCacheGet(), G = require__listCacheHas(), K = require__listCacheSet();
  function q(f2) {
    var V2 = -1, H2 = f2 == null ? 0 : f2.length;
    for (this.clear(); ++V2 < H2; ) {
      var U2 = f2[V2];
      this.set(U2[0], U2[1]);
    }
  }
  q.prototype.clear = H, q.prototype.delete = U, q.prototype.get = W, q.prototype.has = G, q.prototype.set = K, V.exports = q;
})), require__Map = /* @__PURE__ */ __commonJSMin(((f, V) => {
  V.exports = require__getNative()(require__root(), "Map");
})), require__mapCacheClear = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = require__Hash(), U = require__ListCache(), W = require__Map();
  function G() {
    this.size = 0, this.__data__ = {
      hash: new H(),
      map: new (W || U)(),
      string: new H()
    };
  }
  V.exports = G;
})), require__isKeyable = /* @__PURE__ */ __commonJSMin(((f, V) => {
  function H(f2) {
    var V2 = typeof f2;
    return V2 == "string" || V2 == "number" || V2 == "symbol" || V2 == "boolean" ? f2 !== "__proto__" : f2 === null;
  }
  V.exports = H;
})), require__getMapData = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = require__isKeyable();
  function U(f2, V2) {
    var U2 = f2.__data__;
    return H(V2) ? U2[typeof V2 == "string" ? "string" : "hash"] : U2.map;
  }
  V.exports = U;
})), require__mapCacheDelete = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = require__getMapData();
  function U(f2) {
    var V2 = H(this, f2).delete(f2);
    return this.size -= V2 ? 1 : 0, V2;
  }
  V.exports = U;
})), require__mapCacheGet = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = require__getMapData();
  function U(f2) {
    return H(this, f2).get(f2);
  }
  V.exports = U;
})), require__mapCacheHas = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = require__getMapData();
  function U(f2) {
    return H(this, f2).has(f2);
  }
  V.exports = U;
})), require__mapCacheSet = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = require__getMapData();
  function U(f2, V2) {
    var U2 = H(this, f2), W = U2.size;
    return U2.set(f2, V2), this.size += U2.size == W ? 0 : 1, this;
  }
  V.exports = U;
})), require__MapCache = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = require__mapCacheClear(), U = require__mapCacheDelete(), W = require__mapCacheGet(), G = require__mapCacheHas(), K = require__mapCacheSet();
  function q(f2) {
    var V2 = -1, H2 = f2 == null ? 0 : f2.length;
    for (this.clear(); ++V2 < H2; ) {
      var U2 = f2[V2];
      this.set(U2[0], U2[1]);
    }
  }
  q.prototype.clear = H, q.prototype.delete = U, q.prototype.get = W, q.prototype.has = G, q.prototype.set = K, V.exports = q;
})), require_memoize = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = require__MapCache(), U = "Expected a function";
  function W(f2, V2) {
    if (typeof f2 != "function" || V2 != null && typeof V2 != "function") throw TypeError(U);
    var G = function() {
      var H2 = arguments, U2 = V2 ? V2.apply(this, H2) : H2[0], W2 = G.cache;
      if (W2.has(U2)) return W2.get(U2);
      var K = f2.apply(this, H2);
      return G.cache = W2.set(U2, K) || W2, K;
    };
    return G.cache = new (W.Cache || H)(), G;
  }
  W.Cache = H, V.exports = W;
})), require__memoizeCapped = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = require_memoize(), U = 500;
  function W(f2) {
    var V2 = H(f2, function(f3) {
      return W2.size === U && W2.clear(), f3;
    }), W2 = V2.cache;
    return V2;
  }
  V.exports = W;
})), require__stringToPath = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = require__memoizeCapped(), U = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, W = /\\(\\)?/g;
  V.exports = H(function(f2) {
    var V2 = [];
    return f2.charCodeAt(0) === 46 && V2.push(""), f2.replace(U, function(f3, H2, U2, G) {
      V2.push(U2 ? G.replace(W, "$1") : H2 || f3);
    }), V2;
  });
})), require__arrayMap = /* @__PURE__ */ __commonJSMin(((f, V) => {
  function H(f2, V2) {
    for (var H2 = -1, U = f2 == null ? 0 : f2.length, W = Array(U); ++H2 < U; ) W[H2] = V2(f2[H2], H2, f2);
    return W;
  }
  V.exports = H;
})), require__baseToString = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = require__Symbol(), U = require__arrayMap(), W = require_isArray(), G = require_isSymbol(), K = Infinity, q = H ? H.prototype : void 0, J = q ? q.toString : void 0;
  function Y(f2) {
    if (typeof f2 == "string") return f2;
    if (W(f2)) return U(f2, Y) + "";
    if (G(f2)) return J ? J.call(f2) : "";
    var V2 = f2 + "";
    return V2 == "0" && 1 / f2 == -K ? "-0" : V2;
  }
  V.exports = Y;
})), require_toString = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = require__baseToString();
  function U(f2) {
    return f2 == null ? "" : H(f2);
  }
  V.exports = U;
})), require__castPath = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = require_isArray(), U = require__isKey(), W = require__stringToPath(), G = require_toString();
  function K(f2, V2) {
    return H(f2) ? f2 : U(f2, V2) ? [f2] : W(G(f2));
  }
  V.exports = K;
})), require__baseIsArguments = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = require__baseGetTag(), U = require_isObjectLike(), W = "[object Arguments]";
  function G(f2) {
    return U(f2) && H(f2) == W;
  }
  V.exports = G;
})), require_isArguments = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = require__baseIsArguments(), U = require_isObjectLike(), W = Object.prototype, G = W.hasOwnProperty, K = W.propertyIsEnumerable;
  V.exports = H(/* @__PURE__ */ (function() {
    return arguments;
  })()) ? H : function(f2) {
    return U(f2) && G.call(f2, "callee") && !K.call(f2, "callee");
  };
})), require__isIndex = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = 9007199254740991, U = /^(?:0|[1-9]\d*)$/;
  function W(f2, V2) {
    var W2 = typeof f2;
    return V2 ?? (V2 = H), !!V2 && (W2 == "number" || W2 != "symbol" && U.test(f2)) && f2 > -1 && f2 % 1 == 0 && f2 < V2;
  }
  V.exports = W;
})), require_isLength = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = 9007199254740991;
  function U(f2) {
    return typeof f2 == "number" && f2 > -1 && f2 % 1 == 0 && f2 <= H;
  }
  V.exports = U;
})), require__toKey = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = require_isSymbol(), U = Infinity;
  function W(f2) {
    if (typeof f2 == "string" || H(f2)) return f2;
    var V2 = f2 + "";
    return V2 == "0" && 1 / f2 == -U ? "-0" : V2;
  }
  V.exports = W;
})), require__hasPath = /* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = require__castPath(), U = require_isArguments(), W = require_isArray(), G = require__isIndex(), K = require_isLength(), q = require__toKey();
  function J(f2, V2, J2) {
    V2 = H(V2, f2);
    for (var Y = -1, X = V2.length, Z = false; ++Y < X; ) {
      var Q = q(V2[Y]);
      if (!(Z = f2 != null && J2(f2, Q))) break;
      f2 = f2[Q];
    }
    return Z || ++Y != X ? Z : (X = f2 == null ? 0 : f2.length, !!X && K(X) && G(Q, X) && (W(f2) || U(f2)));
  }
  V.exports = J;
})), import_has = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((f, V) => {
  var H = require__baseHas(), U = require__hasPath();
  function W(f2, V2) {
    return f2 != null && U(f2, V2, H);
  }
  V.exports = W;
})))(), 1);
const BooleanEmpty = null, BooleanIndeterminate = void 0;
var GridCellKind;
(function(f) {
  f.Uri = "uri", f.Text = "text", f.Image = "image", f.RowID = "row-id", f.Number = "number", f.Bubble = "bubble", f.Boolean = "boolean", f.Loading = "loading", f.Markdown = "markdown", f.Drilldown = "drilldown", f.Protected = "protected", f.Custom = "custom";
})(GridCellKind || (GridCellKind = {}));
var GridColumnIcon;
(function(f) {
  f.HeaderRowID = "headerRowID", f.HeaderCode = "headerCode", f.HeaderNumber = "headerNumber", f.HeaderString = "headerString", f.HeaderBoolean = "headerBoolean", f.HeaderAudioUri = "headerAudioUri", f.HeaderVideoUri = "headerVideoUri", f.HeaderEmoji = "headerEmoji", f.HeaderImage = "headerImage", f.HeaderUri = "headerUri", f.HeaderPhone = "headerPhone", f.HeaderMarkdown = "headerMarkdown", f.HeaderDate = "headerDate", f.HeaderTime = "headerTime", f.HeaderEmail = "headerEmail", f.HeaderReference = "headerReference", f.HeaderIfThenElse = "headerIfThenElse", f.HeaderSingleValue = "headerSingleValue", f.HeaderLookup = "headerLookup", f.HeaderTextTemplate = "headerTextTemplate", f.HeaderMath = "headerMath", f.HeaderRollup = "headerRollup", f.HeaderJoinStrings = "headerJoinStrings", f.HeaderSplitString = "headerSplitString", f.HeaderGeoDistance = "headerGeoDistance", f.HeaderArray = "headerArray", f.RowOwnerOverlay = "rowOwnerOverlay", f.ProtectedColumnOverlay = "protectedColumnOverlay";
})(GridColumnIcon || (GridColumnIcon = {}));
var GridColumnMenuIcon;
(function(f) {
  f.Triangle = "triangle", f.Dots = "dots";
})(GridColumnMenuIcon || (GridColumnMenuIcon = {}));
function isSizedGridColumn(f) {
  return "width" in f && typeof f.width == "number";
}
async function resolveCellsThunk(f) {
  return typeof f == "object" ? f : await f();
}
function isEditableGridCell(f) {
  return !(f.kind === GridCellKind.Loading || f.kind === GridCellKind.Bubble || f.kind === GridCellKind.RowID || f.kind === GridCellKind.Protected || f.kind === GridCellKind.Drilldown);
}
function isInnerOnlyCell(f) {
  return f.kind === InnerGridCellKind.Marker || f.kind === InnerGridCellKind.NewRow;
}
function isReadWriteCell(f) {
  if (!isEditableGridCell(f) || f.kind === GridCellKind.Image) return false;
  if (f.kind === GridCellKind.Text || f.kind === GridCellKind.Number || f.kind === GridCellKind.Markdown || f.kind === GridCellKind.Uri || f.kind === GridCellKind.Custom || f.kind === GridCellKind.Boolean) return f.readonly !== true;
  assertNever(f, "A cell was passed with an invalid kind");
}
function isObjectEditorCallbackResult(f) {
  return (0, import_has.default)(f, "editor");
}
function booleanCellIsEditable(f) {
  return !(f.readonly ?? false);
}
var InnerGridCellKind;
(function(f) {
  f.NewRow = "new-row", f.Marker = "marker";
})(InnerGridCellKind || (InnerGridCellKind = {}));
function mergeRanges(f) {
  if (f.length === 0) return [];
  let V = [...f], H = [];
  V.sort(function(f2, V2) {
    return f2[0] - V2[0];
  }), H.push([...V[0]]);
  for (let f2 of V.slice(1)) {
    let V2 = H[H.length - 1];
    V2[1] < f2[0] ? H.push([...f2]) : V2[1] < f2[1] && (V2[1] = f2[1]);
  }
  return H;
}
var emptyCompactSelection, CompactSelection = (_a = class {
  constructor(f) {
    __publicField(this, "items");
    this.items = f;
  }
  offset(V) {
    return V === 0 ? this : new _a(this.items.map((f) => [f[0] + V, f[1] + V]));
  }
  add(V) {
    let H = typeof V == "number" ? [V, V + 1] : V;
    return new _a(mergeRanges([...this.items, H]));
  }
  remove(V) {
    let H = [...this.items], U = typeof V == "number" ? V : V[0], W = typeof V == "number" ? V + 1 : V[1];
    for (let [f, V2] of H.entries()) {
      let [G, K] = V2;
      if (G <= W && U <= K) {
        let V3 = [];
        G < U && V3.push([G, U]), W < K && V3.push([W, K]), H.splice(f, 1, ...V3);
      }
    }
    return new _a(H);
  }
  first() {
    if (this.items.length !== 0) return this.items[0][0];
  }
  last() {
    if (this.items.length !== 0) return this.items.slice(-1)[0][1] - 1;
  }
  hasIndex(f) {
    for (let V = 0; V < this.items.length; V++) {
      let [H, U] = this.items[V];
      if (f >= H && f < U) return true;
    }
    return false;
  }
  hasAll(f) {
    for (let V = f[0]; V < f[1]; V++) if (!this.hasIndex(V)) return false;
    return true;
  }
  some(f) {
    for (let V of this) if (f(V)) return true;
    return false;
  }
  equals(f) {
    if (f === this) return true;
    if (f.items.length !== this.items.length) return false;
    for (let V = 0; V < this.items.length; V++) {
      let H = f.items[V], U = this.items[V];
      if (H[0] !== U[0] || H[1] !== U[1]) return false;
    }
    return true;
  }
  toArray() {
    let f = [];
    for (let [V, H] of this.items) for (let U = V; U < H; U++) f.push(U);
    return f;
  }
  get length() {
    let f = 0;
    for (let [V, H] of this.items) f += H - V;
    return f;
  }
  *[Symbol.iterator]() {
    for (let [f, V] of this.items) for (let H = f; H < V; H++) yield H;
  }
}, __publicField(_a, "empty", () => emptyCompactSelection ?? (emptyCompactSelection = new _a([]))), __publicField(_a, "fromSingleSelection", (V) => _a.empty().add(V)), _a), cache = {}, div = null;
function createDiv() {
  let f = document.createElement("div");
  return f.style.opacity = "0", f.style.pointerEvents = "none", f.style.position = "fixed", document.body.append(f), f;
}
function parseToRgba(f) {
  let V = f.toLowerCase().trim();
  if (cache[V] !== void 0) return cache[V];
  div || (div = createDiv()), div.style.color = "#000", div.style.color = V;
  let H = getComputedStyle(div).color;
  div.style.color = "#fff", div.style.color = V;
  let U = getComputedStyle(div).color;
  if (U !== H) return [
    0,
    0,
    0,
    1
  ];
  let W = U.replace(/[^\d.,]/g, "").split(",").map(Number.parseFloat);
  return W.length < 4 && W.push(1), W = W.map((f2) => Number.isNaN(f2) ? 0 : f2), cache[V] = W, W;
}
function withAlpha(f, V) {
  let [H, U, W] = parseToRgba(f);
  return `rgba(${H}, ${U}, ${W}, ${V})`;
}
var blendResultCache = /* @__PURE__ */ new Map();
function blendCache(f, V) {
  let H = `${f}-${V}`, U = blendResultCache.get(H);
  if (U !== void 0) return U;
  let W = blend(f, V);
  return blendResultCache.set(H, W), W;
}
function blend(f, V) {
  if (V === void 0) return f;
  let [H, U, W, G] = parseToRgba(f);
  if (G === 1) return f;
  let [K, q, J, Y] = parseToRgba(V), X = G + Y * (1 - G);
  return `rgba(${(G * H + Y * K * (1 - G)) / X}, ${(G * U + Y * q * (1 - G)) / X}, ${(G * W + Y * J * (1 - G)) / X}, ${X})`;
}
var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
function makeCSSStyle(f) {
  return {
    "--gdg-accent-color": f.accentColor,
    "--gdg-accent-fg": f.accentFg,
    "--gdg-accent-light": f.accentLight,
    "--gdg-text-dark": f.textDark,
    "--gdg-text-medium": f.textMedium,
    "--gdg-text-light": f.textLight,
    "--gdg-text-bubble": f.textBubble,
    "--gdg-bg-icon-header": f.bgIconHeader,
    "--gdg-fg-icon-header": f.fgIconHeader,
    "--gdg-text-header": f.textHeader,
    "--gdg-text-group-header": f.textGroupHeader ?? f.textHeader,
    "--gdg-text-header-selected": f.textHeaderSelected,
    "--gdg-bg-cell": f.bgCell,
    "--gdg-bg-cell-medium": f.bgCellMedium,
    "--gdg-bg-header": f.bgHeader,
    "--gdg-bg-header-has-focus": f.bgHeaderHasFocus,
    "--gdg-bg-header-hovered": f.bgHeaderHovered,
    "--gdg-bg-bubble": f.bgBubble,
    "--gdg-bg-bubble-selected": f.bgBubbleSelected,
    "--gdg-bg-search-result": f.bgSearchResult,
    "--gdg-border-color": f.borderColor,
    "--gdg-horizontal-border-color": f.horizontalBorderColor ?? f.borderColor,
    "--gdg-drilldown-border": f.drilldownBorder,
    "--gdg-link-color": f.linkColor,
    "--gdg-cell-horizontal-padding": `${f.cellHorizontalPadding}px`,
    "--gdg-cell-vertical-padding": `${f.cellVerticalPadding}px`,
    "--gdg-header-font-style": f.headerFontStyle,
    "--gdg-base-font-style": f.baseFontStyle,
    "--gdg-marker-font-style": f.markerFontStyle,
    "--gdg-font-family": f.fontFamily,
    "--gdg-editor-font-size": f.editorFontSize,
    ...f.resizeIndicatorColor === void 0 ? {} : { "--gdg-resize-indicator-color": f.resizeIndicatorColor },
    ...f.headerBottomBorderColor === void 0 ? {} : { "--gdg-header-bottom-border-color": f.headerBottomBorderColor },
    ...f.roundingRadius === void 0 ? {} : { "--gdg-rounding-radius": `${f.roundingRadius}px` }
  };
}
var dataEditorBaseTheme = {
  accentColor: "#4F5DFF",
  accentFg: "#FFFFFF",
  accentLight: "rgba(62, 116, 253, 0.1)",
  textDark: "#313139",
  textMedium: "#737383",
  textLight: "#B2B2C0",
  textBubble: "#313139",
  bgIconHeader: "#737383",
  fgIconHeader: "#FFFFFF",
  textHeader: "#313139",
  textGroupHeader: "#313139BB",
  textHeaderSelected: "#FFFFFF",
  bgCell: "#FFFFFF",
  bgCellMedium: "#FAFAFB",
  bgHeader: "#F7F7F8",
  bgHeaderHasFocus: "#E9E9EB",
  bgHeaderHovered: "#EFEFF1",
  bgBubble: "#EDEDF3",
  bgBubbleSelected: "#FFFFFF",
  bgSearchResult: "#fff9e3",
  borderColor: "rgba(115, 116, 131, 0.16)",
  drilldownBorder: "rgba(0, 0, 0, 0)",
  linkColor: "#353fb5",
  cellHorizontalPadding: 8,
  cellVerticalPadding: 3,
  headerIconSize: 18,
  headerFontStyle: "600 13px",
  baseFontStyle: "13px",
  markerFontStyle: "9px",
  fontFamily: "Inter, Roboto, -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Ubuntu, noto, arial, sans-serif",
  editorFontSize: "13px",
  lineHeight: 1.4
};
function getDataEditorTheme() {
  return dataEditorBaseTheme;
}
const ThemeContext = import_react.createContext(dataEditorBaseTheme);
function mergeAndRealizeTheme(f, ...V) {
  let H = { ...f };
  for (let f2 of V) if (f2 !== void 0) for (let V2 in f2) f2.hasOwnProperty(V2) && (V2 === "bgCell" ? H[V2] = blend(f2[V2], H[V2]) : H[V2] = f2[V2]);
  return (H.headerFontFull === void 0 || f.fontFamily !== H.fontFamily || f.headerFontStyle !== H.headerFontStyle) && (H.headerFontFull = `${H.headerFontStyle} ${H.fontFamily}`), (H.baseFontFull === void 0 || f.fontFamily !== H.fontFamily || f.baseFontStyle !== H.baseFontStyle) && (H.baseFontFull = `${H.baseFontStyle} ${H.fontFamily}`), (H.markerFontFull === void 0 || f.fontFamily !== H.fontFamily || f.markerFontStyle !== H.markerFontStyle) && (H.markerFontFull = `${H.markerFontStyle} ${H.fontFamily}`), H;
}
var ClickOutsideContainer = class extends import_react.PureComponent {
  constructor() {
    super(...arguments);
    __publicField(this, "wrapperRef", import_react.createRef());
    __publicField(this, "clickOutside", (f) => {
      if (!(this.props.isOutsideClick && !this.props.isOutsideClick(f)) && this.wrapperRef.current !== null && !this.wrapperRef.current.contains(f.target)) {
        let V = f.target;
        for (; V !== null; ) {
          if (V.classList.contains("click-outside-ignore")) return;
          V = V.parentElement;
        }
        this.props.onClickOutside();
      }
    });
  }
  componentDidMount() {
    let f = this.props.customEventTarget ?? document;
    f.addEventListener("touchend", this.clickOutside, true), f.addEventListener("mousedown", this.clickOutside, true), f.addEventListener("contextmenu", this.clickOutside, true);
  }
  componentWillUnmount() {
    let f = this.props.customEventTarget ?? document;
    f.removeEventListener("touchend", this.clickOutside, true), f.removeEventListener("mousedown", this.clickOutside, true), f.removeEventListener("contextmenu", this.clickOutside, true);
  }
  render() {
    let { onClickOutside: f, isOutsideClick: V, customEventTarget: H, ...U } = this.props;
    return import_react.createElement("div", {
      ...U,
      ref: this.wrapperRef
    }, this.props.children);
  }
};
export {
  require__Map as A,
  require__baseGetTag as B,
  require__hasPath as C,
  require_isArguments as D,
  require__isIndex as E,
  require_isFunction as F,
  assert as G,
  require__root as H,
  require_isObject as I,
  maybe as J,
  assertNever as K,
  require__isKey as L,
  require_eq as M,
  require__getNative as N,
  require__castPath as O,
  require__toSource as P,
  require_isSymbol as R,
  resolveCellsThunk as S,
  require_isLength as T,
  require__freeGlobal as U,
  require__Symbol as V,
  require_isArray as W,
  isEditableGridCell as _,
  mergeAndRealizeTheme as a,
  isReadWriteCell as b,
  withAlpha as c,
  CompactSelection as d,
  GridCellKind as f,
  booleanCellIsEditable as g,
  InnerGridCellKind as h,
  makeCSSStyle as i,
  require__ListCache as j,
  require__MapCache as k,
  BooleanEmpty as l,
  GridColumnMenuIcon as m,
  ThemeContext as n,
  blend as o,
  GridColumnIcon as p,
  deepEqual as q,
  getDataEditorTheme as r,
  blendCache as s,
  ClickOutsideContainer as t,
  BooleanIndeterminate as u,
  isInnerOnlyCell as v,
  require__toKey as w,
  isSizedGridColumn as x,
  isObjectEditorCallbackResult as y,
  require_isObjectLike as z
};
