@gridsheet/react-core 3.0.0-rc.6 → 3.0.0-rc.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { jsxs as O, jsx as w, Fragment as Xe } from "react/jsx-runtime";
2
- import Ys, { createContext as hr, useRef as ae, useContext as ye, useLayoutEffect as is, useState as ie, useEffect as j, useMemo as pt, useCallback as _, memo as ws, createRef as fr, useReducer as ko } from "react";
2
+ import _s, { createContext as hr, useRef as de, useContext as ye, useLayoutEffect as is, useState as ie, useEffect as K, useMemo as pt, useCallback as Y, memo as ws, createRef as fr, useReducer as ko } from "react";
3
3
  import Ie from "dayjs";
4
4
  import { createPortal as tn } from "react-dom";
5
5
  import Ao from "dayjs/plugin/utc.js";
6
6
  import To from "dayjs/plugin/timezone.js";
7
- const Io = 20, ke = 24, Ae = 90, Ln = 500, zn = 1e3, _s = 24, $s = 50, Xn = 5, Hn = 5, Bn = 5, Un = 10, gr = 1e3, Os = 86400, No = "YYYY-MM-DDTHH:mm:ss.SSSZ", Mo = {
7
+ const Io = 20, ke = 24, Ae = 90, Ln = 500, zn = 1e3, Ys = 24, $s = 50, Xn = 5, Hn = 5, Bn = 5, Un = 10, gr = 1e3, Os = 86400, No = "YYYY-MM-DDTHH:mm:ss.SSSZ", Mo = {
8
8
  startY: -1,
9
9
  startX: -1,
10
10
  endY: -1,
@@ -26,7 +26,7 @@ const Io = 20, ke = 24, Ae = 90, Ln = 500, zn = 1e3, _s = 24, $s = 50, Xn = 5, H
26
26
  for (let i = o.next(); Mt.size > e; i = o.next())
27
27
  Mt.delete(i.value);
28
28
  return r;
29
- }, Yo = (s, e = gr) => {
29
+ }, _o = (s, e = gr) => {
30
30
  const t = Ft.get(s);
31
31
  if (t != null)
32
32
  return t;
@@ -49,9 +49,9 @@ const Io = 20, ke = 24, Ae = 90, Ln = 500, zn = 1e3, _s = 24, $s = 50, Xn = 5, H
49
49
  const e = Do(s + 1);
50
50
  return s < 0 ? `$${e}` : e;
51
51
  }, zt = (s, e = !1) => {
52
- const t = Yo(s.toUpperCase());
52
+ const t = _o(s.toUpperCase());
53
53
  return e ? -t : t;
54
- }, Ee = (s) => s === 0 ? "" : s < 0 ? `$${s}` : String(s), _o = (s, e = !1) => (typeof s == "string" && (s = parseInt(s, 10)), e ? -s : s), G = ({ y: s, x: e, absX: t, absY: n }) => {
54
+ }, Ee = (s) => s === 0 ? "" : s < 0 ? `$${s}` : String(s), Yo = (s, e = !1) => (typeof s == "string" && (s = parseInt(s, 10)), e ? -s : s), G = ({ y: s, x: e, absX: t, absY: n }) => {
55
55
  if (e === -1 && s === -1)
56
56
  return "?";
57
57
  const r = e === void 0 ? "" : e === 0 ? "0" : `${t ? "$" : ""}${xe(e)}`, o = s === void 0 ? "" : s === 0 ? "0" : `${n ? "$" : ""}${Ee(s)}`;
@@ -61,7 +61,7 @@ const Io = 20, ke = 24, Ae = 90, Ln = 500, zn = 1e3, _s = 24, $s = 50, Xn = 5, H
61
61
  if (e == null)
62
62
  return { y: -1, x: -1 };
63
63
  const [, t, n, r, o] = e.slice(), [i, a] = [t != null, r != null];
64
- return n === "" && o === "" ? { y: -1, x: -1, absX: !1, absY: !1 } : { y: _o(o) || 0, x: zt(n) || 0, absX: i, absY: a };
64
+ return n === "" && o === "" ? { y: -1, x: -1, absX: !1, absY: !1 } : { y: Yo(o) || 0, x: zt(n) || 0, absX: i, absY: a };
65
65
  }, sn = (s, e, t) => {
66
66
  const n = s.match(/([A-Z]*)([0-9]*)/);
67
67
  if (n == null)
@@ -101,7 +101,7 @@ const Io = 20, ke = 24, Ae = 90, Ln = 500, zn = 1e3, _s = 24, $s = 50, Xn = 5, H
101
101
  }, zo = (s) => s.endY === -1 || s.endX === -1 ? { rows: 0, cols: 0 } : {
102
102
  rows: Math.abs(s.startY - s.endY),
103
103
  cols: Math.abs(s.startX - s.endX)
104
- }, de = (s) => s.endY === -1 || s.endX === -1 ? { rows: 1, cols: 1 } : {
104
+ }, le = (s) => s.endY === -1 || s.endX === -1 ? { rows: 1, cols: 1 } : {
105
105
  rows: 1 + Math.abs(s.startY - s.endY),
106
106
  cols: 1 + Math.abs(s.startX - s.endX)
107
107
  }, ls = (s) => ({
@@ -110,7 +110,7 @@ const Io = 20, ke = 24, Ae = 90, Ln = 500, zn = 1e3, _s = 24, $s = 50, Xn = 5, H
110
110
  }), zs = (s) => ({
111
111
  rows: 1 + Math.abs(s.top - s.bottom),
112
112
  cols: 1 + Math.abs(s.left - s.right)
113
- }), _t = ({ base: s = 0, matrix: e }) => {
113
+ }), Yt = ({ base: s = 0, matrix: e }) => {
114
114
  const t = e.length;
115
115
  return t === 0 ? { rows: 0, cols: 0 } : { rows: s + t, cols: s + e[0].length };
116
116
  }, Zn = (s, e, t = 1) => Array.from({ length: (e - s - 1) / t + 1 }, (n, r) => s + r * t), td = (s, e) => {
@@ -295,7 +295,7 @@ const Io = 20, ke = 24, Ae = 90, Ln = 500, zn = 1e3, _s = 24, $s = 50, Xn = 5, H
295
295
  return !0;
296
296
  }
297
297
  return !1;
298
- }, Ye = (s, e) => {
298
+ }, _e = (s, e) => {
299
299
  const { searchQuery: t, searchCaseSensitive: n, searchRegex: r, searchRange: o } = e;
300
300
  let { choosing: i } = e;
301
301
  if (!t)
@@ -444,7 +444,7 @@ const Io = 20, ke = 24, Ae = 90, Ln = 500, zn = 1e3, _s = 24, $s = 50, Xn = 5, H
444
444
  debugOperations: qo,
445
445
  hasOperation: L
446
446
  }, Symbol.toStringTag, { value: "Module" })), nt = 864e5;
447
- class V {
447
+ class j {
448
448
  constructor(e, t = "HH:mm:ss") {
449
449
  this.__gsType = "Time", this.days = e, this.format = t;
450
450
  }
@@ -477,29 +477,29 @@ class V {
477
477
  }
478
478
  static create(e = 0, t = 0, n = 0, r = 0) {
479
479
  const o = e * 36e5 + t * 6e4 + n * 1e3 + r;
480
- return new V(o / nt);
480
+ return new j(o / nt);
481
481
  }
482
482
  static fromDate(e) {
483
483
  const t = e.getHours() * 36e5 + e.getMinutes() * 6e4 + e.getSeconds() * 1e3 + e.getMilliseconds();
484
- return new V(t / nt);
484
+ return new j(t / nt);
485
485
  }
486
486
  static fromDates(e, t) {
487
- return new V((e.getTime() - t.getTime()) / nt);
487
+ return new j((e.getTime() - t.getTime()) / nt);
488
488
  }
489
489
  static fromObject(e) {
490
- return new V(e.days, e.format);
490
+ return new j(e.days, e.format);
491
491
  }
492
492
  static is(e) {
493
- return e instanceof V || (e == null ? void 0 : e.__gsType) === "Time";
493
+ return e instanceof j || (e == null ? void 0 : e.__gsType) === "Time";
494
494
  }
495
495
  static ensure(e) {
496
- return e instanceof V ? e : (e == null ? void 0 : e.__gsType) === "Time" ? V.fromObject(e) : V.create();
496
+ return e instanceof j ? e : (e == null ? void 0 : e.__gsType) === "Time" ? j.fromObject(e) : j.create();
497
497
  }
498
498
  static parse(e, t, n = !1) {
499
499
  if (t != null) {
500
500
  const r = Go(t), o = e.match(r);
501
501
  if (o != null && o.groups)
502
- return V.create(
502
+ return j.create(
503
503
  Number(o.groups.HH || o.groups.H || 0),
504
504
  Number(o.groups.mm || o.groups.m || 0),
505
505
  Number(o.groups.ss || o.groups.s || 0),
@@ -511,21 +511,21 @@ class V {
511
511
  const r = e.match(/^([+-]?)(\d+):(\d{2})$/);
512
512
  if (r) {
513
513
  const [, o, i, a] = r, l = o === "-" ? -1 : 1;
514
- return V.create(l * Number(i), l * Number(a));
514
+ return j.create(l * Number(i), l * Number(a));
515
515
  }
516
516
  }
517
517
  {
518
518
  const r = e.match(/^([+-]?)(\d+):(\d{2}):(\d{2})$/);
519
519
  if (r) {
520
520
  const [, o, i, a, l] = r, c = o === "-" ? -1 : 1;
521
- return V.create(c * Number(i), c * Number(a), c * Number(l));
521
+ return j.create(c * Number(i), c * Number(a), c * Number(l));
522
522
  }
523
523
  }
524
524
  {
525
525
  const r = e.match(/^([+-]?)(\d+):(\d{2}):(\d{2})\.(\d+)$/);
526
526
  if (r) {
527
527
  const [, o, i, a, l, c] = r, u = o === "-" ? -1 : 1;
528
- return V.create(u * Number(i), u * Number(a), u * Number(l), u * Number(c));
528
+ return j.create(u * Number(i), u * Number(a), u * Number(l), u * Number(c));
529
529
  }
530
530
  }
531
531
  }
@@ -739,7 +739,7 @@ const Ar = new RegExp("(.+?)(\\d+)$"), ot = (s) => {
739
739
  };
740
740
  class ds {
741
741
  constructor(e) {
742
- this.time = V.create(), this.numericDelta = 0, this.equidistant = !0, this.first = e, this.nexts = [], this.kind = this.discriminate(e);
742
+ this.time = j.create(), this.numericDelta = 0, this.equidistant = !0, this.first = e, this.nexts = [], this.kind = this.discriminate(e);
743
743
  }
744
744
  discriminate(e) {
745
745
  const t = e instanceof Date ? "date" : typeof e;
@@ -755,7 +755,7 @@ class ds {
755
755
  if (this.nexts.length === 0)
756
756
  switch (t) {
757
757
  case "date": {
758
- this.time = V.fromDates(e, this.first);
758
+ this.time = j.fromDates(e, this.first);
759
759
  break;
760
760
  }
761
761
  case "number": {
@@ -818,11 +818,22 @@ function Qo(s) {
818
818
  return t;
819
819
  }
820
820
  const je = { startY: -1, startX: -1, endY: -1, endX: -1 }, Tr = {}, Jo = (s, e) => {
821
+ var a, l;
821
822
  const t = Tr[e.type];
822
823
  if (t == null)
823
824
  return s;
824
- const { callback: n, ...r } = t.reduce(s, e.value);
825
- return n == null || n(r), { ...s, ...r };
825
+ const n = (a = s.sheetReactive.current) == null ? void 0 : a.registry;
826
+ if ((l = n == null ? void 0 : n._strictModeCache) != null && l.has(e)) {
827
+ const c = n._strictModeCache.get(e);
828
+ return n._strictModeCache.delete(e), c;
829
+ }
830
+ const { callback: r, ...o } = t.reduce(s, e.value);
831
+ r == null || r(o);
832
+ const i = { ...s, ...o };
833
+ return n && (n._strictModeCache || (n._strictModeCache = /* @__PURE__ */ new Map()), n._strictModeCache.set(e, i), queueMicrotask(() => {
834
+ var c;
835
+ (c = n._strictModeCache) == null || c.delete(e);
836
+ })), i;
826
837
  }, xs = class xs {
827
838
  constructor() {
828
839
  this.actionId = 1;
@@ -847,7 +858,7 @@ class ei extends z {
847
858
  const n = t, { sheetReactive: r } = e;
848
859
  return r.current == null ? e : {
849
860
  ...e,
850
- ...Ye(r.current, { ...e, searchQuery: n }),
861
+ ..._e(r.current, { ...e, searchQuery: n }),
851
862
  searchQuery: n
852
863
  };
853
864
  }
@@ -858,7 +869,7 @@ class ti extends z {
858
869
  const n = t, { sheetReactive: r } = e;
859
870
  return r.current == null ? e : {
860
871
  ...e,
861
- ...Ye(r.current, { ...e, searchCaseSensitive: n }),
872
+ ..._e(r.current, { ...e, searchCaseSensitive: n }),
862
873
  searchCaseSensitive: n
863
874
  };
864
875
  }
@@ -869,7 +880,7 @@ class ni extends z {
869
880
  const n = t, { sheetReactive: r } = e;
870
881
  return r.current == null ? e : {
871
882
  ...e,
872
- ...Ye(r.current, { ...e, searchRegex: n }),
883
+ ..._e(r.current, { ...e, searchRegex: n }),
873
884
  searchRegex: n
874
885
  };
875
886
  }
@@ -880,7 +891,7 @@ class oi extends z {
880
891
  const n = t, { sheetReactive: r } = e;
881
892
  return r.current == null ? e : {
882
893
  ...e,
883
- ...Ye(r.current, { ...e, searchRange: n }),
894
+ ..._e(r.current, { ...e, searchRange: n }),
884
895
  searchRange: n
885
896
  };
886
897
  }
@@ -910,7 +921,7 @@ class ci extends z {
910
921
  return {
911
922
  ...e,
912
923
  sheetReactive: { current: r },
913
- ...Ye(r, e),
924
+ ..._e(r, e),
914
925
  ...Rs(e, r),
915
926
  selectingZone: o,
916
927
  leftHeaderSelecting: !1,
@@ -961,7 +972,7 @@ class fi extends z {
961
972
  return {
962
973
  ...e,
963
974
  sheetReactive: { current: t },
964
- ...Ye(t, e),
975
+ ..._e(t, e),
965
976
  ...Rs(e, t)
966
977
  };
967
978
  }
@@ -1066,7 +1077,7 @@ class Ri extends z {
1066
1077
  });
1067
1078
  return {
1068
1079
  ...e,
1069
- ...Ye(R, e),
1080
+ ..._e(R, e),
1070
1081
  sheetReactive: { current: R },
1071
1082
  selectingZone: C,
1072
1083
  inputting: R.getSerializedValue({ point: n, resolution: "RAW" }),
@@ -1080,7 +1091,7 @@ class Ri extends z {
1080
1091
  }
1081
1092
  let m, { y: b, x: S } = n;
1082
1093
  if (h.top === -1) {
1083
- const { rows: v, cols: k } = _t({ matrix: g, base: -1 });
1094
+ const { rows: v, cols: k } = Yt({ matrix: g, base: -1 });
1084
1095
  f = {
1085
1096
  top: b,
1086
1097
  left: S,
@@ -1138,7 +1149,7 @@ class Ri extends z {
1138
1149
  sheetReactive: { current: m },
1139
1150
  selectingZone: A,
1140
1151
  inputting: m.getSerializedValue({ point: n, resolution: "RAW" }),
1141
- ...Ye(m, e),
1152
+ ..._e(m, e),
1142
1153
  callback: ({ sheetReactive: v }) => {
1143
1154
  a.transmit({
1144
1155
  copyingZone: je
@@ -1288,7 +1299,7 @@ class Ii extends z {
1288
1299
  });
1289
1300
  return {
1290
1301
  ...e,
1291
- ...Ye(c, e),
1302
+ ..._e(c, e),
1292
1303
  sheetReactive: { current: c },
1293
1304
  callback: ({ sheetReactive: u }) => {
1294
1305
  l.registry.transmit({
@@ -1334,7 +1345,7 @@ class Ni extends z {
1334
1345
  })
1335
1346
  }), {
1336
1347
  ...e,
1337
- ...Ye(i, e),
1348
+ ..._e(i, e),
1338
1349
  sheetReactive: { current: i }
1339
1350
  });
1340
1351
  }
@@ -1351,7 +1362,7 @@ class Mi extends z {
1351
1362
  if (o.dstSheetId !== r.id) {
1352
1363
  const { dispatch: a, store: l } = r.registry.contextsBySheetId[o.dstSheetId];
1353
1364
  return a(
1354
- _e({
1365
+ Ye({
1355
1366
  ...l,
1356
1367
  ...o.undoReflection,
1357
1368
  sheetReactive: { current: l.sheetReactive.current }
@@ -1362,7 +1373,7 @@ class Mi extends z {
1362
1373
  ...e,
1363
1374
  ...Rs(e, r),
1364
1375
  ...o.undoReflection,
1365
- ...Ye(r, e),
1376
+ ..._e(r, e),
1366
1377
  sheetReactive: { current: r },
1367
1378
  callback: (a) => {
1368
1379
  i == null || i(a), Xt(e.flashRef.current);
@@ -1382,7 +1393,7 @@ class Fi extends z {
1382
1393
  if (o.dstSheetId !== r.id) {
1383
1394
  const { dispatch: l, store: c } = r.registry.contextsBySheetId[o.dstSheetId];
1384
1395
  return l(
1385
- _e({
1396
+ Ye({
1386
1397
  ...c,
1387
1398
  ...o.redoReflection,
1388
1399
  sheetReactive: { current: c.sheetReactive.current }
@@ -1393,7 +1404,7 @@ class Fi extends z {
1393
1404
  ...e,
1394
1405
  ...Rs(e, r),
1395
1406
  ...o.redoReflection,
1396
- ...Ye(r, e),
1407
+ ..._e(r, e),
1397
1408
  sheetReactive: { current: r },
1398
1409
  callback: (l) => {
1399
1410
  a == null || a(l), Xt(e.flashRef.current);
@@ -1454,7 +1465,7 @@ class Di extends z {
1454
1465
  }
1455
1466
  }
1456
1467
  const $t = new Di().bind();
1457
- class Yi extends z {
1468
+ class _i extends z {
1458
1469
  reduce(e, t) {
1459
1470
  var y, x, E, F;
1460
1471
  const { numRows: n, numCols: r } = t;
@@ -1494,8 +1505,8 @@ class Yi extends z {
1494
1505
  };
1495
1506
  }
1496
1507
  }
1497
- const fs = new Yi().bind();
1498
- class _i extends z {
1508
+ const fs = new _i().bind();
1509
+ class Yi extends z {
1499
1510
  reduce(e, t) {
1500
1511
  return {
1501
1512
  ...e,
@@ -1503,7 +1514,7 @@ class _i extends z {
1503
1514
  };
1504
1515
  }
1505
1516
  }
1506
- const ge = new _i().bind();
1517
+ const ge = new Yi().bind();
1507
1518
  class $i extends z {
1508
1519
  reduce(e, t) {
1509
1520
  const { numRows: n, y: r, operator: o } = t, { sheetReactive: i, selectingZone: a, choosing: l } = e, c = i.current;
@@ -1753,7 +1764,7 @@ class Vi extends z {
1753
1764
  };
1754
1765
  }
1755
1766
  }
1756
- const _e = new Vi().bind(), cd = {
1767
+ const Ye = new Vi().bind(), cd = {
1757
1768
  blur: bi,
1758
1769
  copy: dn,
1759
1770
  cut: un,
@@ -1798,7 +1809,7 @@ const _e = new Vi().bind(), cd = {
1798
1809
  top: n,
1799
1810
  left: r
1800
1811
  }) => {
1801
- const o = ae(null), i = ae(null), { store: a } = ye(be), l = !a.editorHovering;
1812
+ const o = de(null), i = de(null), { store: a } = ye(be), l = !a.editorHovering;
1802
1813
  return is(() => {
1803
1814
  const c = i.current;
1804
1815
  c && qi(c);
@@ -1815,7 +1826,7 @@ const _e = new Vi().bind(), cd = {
1815
1826
  },
1816
1827
  children: [
1817
1828
  s.category && s.isFunction && /* @__PURE__ */ w("span", { className: `gs-fn-guide-category gs-fn-guide-category-${s.category}`, children: s.category }),
1818
- s.tooltip && /* @__PURE__ */ w("div", { className: "gs-fn-guide1-tooltip", children: typeof s.tooltip == "function" ? Ys.createElement(s.tooltip, { value: s.value }) : s.tooltip }),
1829
+ s.tooltip && /* @__PURE__ */ w("div", { className: "gs-fn-guide1-tooltip", children: typeof s.tooltip == "function" ? _s.createElement(s.tooltip, { value: s.value }) : s.tooltip }),
1819
1830
  s.isFunction && /* @__PURE__ */ O(Xe, { children: [
1820
1831
  /* @__PURE__ */ w("div", { className: "gs-fn-guide1-example", children: s.example }),
1821
1832
  s.description && /* @__PURE__ */ w("div", { className: "gs-fn-guide1-desc", style: { whiteSpace: "pre-line" }, children: s.description }),
@@ -1855,7 +1866,7 @@ const _e = new Vi().bind(), cd = {
1855
1866
  g = h === d + p;
1856
1867
  } else
1857
1868
  g = !1;
1858
- return /* @__PURE__ */ O(Ys.Fragment, { children: [
1869
+ return /* @__PURE__ */ O(_s.Fragment, { children: [
1859
1870
  h > 0 ? ", " : "",
1860
1871
  /* @__PURE__ */ O("span", { className: g ? "gs-active-arg" : "", children: [
1861
1872
  f.optional ? "[" : "",
@@ -1898,7 +1909,7 @@ const _e = new Vi().bind(), cd = {
1898
1909
  selected: n,
1899
1910
  onOptionMouseDown: r
1900
1911
  }) => {
1901
- const o = ae(null), [i, a] = ie(t);
1912
+ const o = de(null), [i, a] = ie(t);
1902
1913
  return is(() => {
1903
1914
  if (!o.current)
1904
1915
  return;
@@ -1919,7 +1930,7 @@ const _e = new Vi().bind(), cd = {
1919
1930
  },
1920
1931
  c
1921
1932
  )) });
1922
- }, X = (s) => {
1933
+ }, H = (s) => {
1923
1934
  s == null || s.focus({ preventScroll: !0 });
1924
1935
  }, Qi = () => typeof navigator < "u" && /^((?!chrome|android).)*safari/i.test(navigator.userAgent), Ji = (s) => {
1925
1936
  if (!Qi())
@@ -1961,7 +1972,7 @@ const _e = new Vi().bind(), cd = {
1961
1972
  "text/html": p
1962
1973
  })
1963
1974
  ]);
1964
- } else u != null && (u.value = f, X(u), u.select(), document.execCommand("copy"), u.value = "", u.blur());
1975
+ } else u != null && (u.value = f, H(u), u.select(), document.execCommand("copy"), u.value = "", u.blur());
1965
1976
  return c;
1966
1977
  }, ea = (s, {
1967
1978
  getter: e = (i, a) => {
@@ -2018,12 +2029,12 @@ const _e = new Vi().bind(), cd = {
2018
2029
  r.pop();
2019
2030
  return `<table>${r.map((o) => o.html).join("")}</table>`;
2020
2031
  };
2021
- class U {
2032
+ class Z {
2022
2033
  constructor(e, t, n) {
2023
2034
  this.__gsType = "FormulaError", this.code = e, this.message = t, this.error = n;
2024
2035
  }
2025
2036
  static is(e) {
2026
- return e instanceof U || (e == null ? void 0 : e.__gsType) === "FormulaError";
2037
+ return e instanceof Z || (e == null ? void 0 : e.__gsType) === "FormulaError";
2027
2038
  }
2028
2039
  toString() {
2029
2040
  return this.code;
@@ -2045,15 +2056,15 @@ class wn extends dt {
2045
2056
  }
2046
2057
  class sa extends dt {
2047
2058
  evaluate() {
2048
- throw new U("#REF!", "Reference does not exist.");
2059
+ throw new Z("#REF!", "Reference does not exist.");
2049
2060
  }
2050
2061
  }
2051
2062
  class na extends dt {
2052
2063
  evaluate() {
2053
- throw new U("#NAME?", `Invalid ref: ${this.value}`);
2064
+ throw new Z("#NAME?", `Invalid ref: ${this.value}`);
2054
2065
  }
2055
2066
  }
2056
- class Yr extends dt {
2067
+ class _r extends dt {
2057
2068
  constructor(e) {
2058
2069
  super(e);
2059
2070
  }
@@ -2063,9 +2074,9 @@ class Yr extends dt {
2063
2074
  evaluate({ sheet: e }) {
2064
2075
  const t = yt(this.value, { sheet: e, dependency: "" });
2065
2076
  if (t.sheet == null)
2066
- throw new U("#REF!", `Unknown sheet: ${t.sheetName}`);
2077
+ throw new Z("#REF!", `Unknown sheet: ${t.sheetName}`);
2067
2078
  if (t.addresses.length === 0)
2068
- throw new U("#REF!", `Invalid address: ${this.value}`);
2079
+ throw new Z("#REF!", `Invalid address: ${this.value}`);
2069
2080
  const { y: n, x: r } = oe(t.addresses[0]);
2070
2081
  return t.sheet.trim({ top: n, left: r, bottom: n, right: r });
2071
2082
  }
@@ -2082,16 +2093,16 @@ class Yr extends dt {
2082
2093
  return d == null ? this.value : (this.ids = [d], `#${r.sheet.id}!${pr(d, l, c)}`);
2083
2094
  }
2084
2095
  }
2085
- class _r extends dt {
2096
+ class Yr extends dt {
2086
2097
  stringify() {
2087
2098
  return this.value.toUpperCase();
2088
2099
  }
2089
2100
  evaluate({ sheet: e }) {
2090
2101
  const t = yt(this.value, { sheet: e, dependency: "" });
2091
2102
  if (t.sheet == null)
2092
- throw new U("#REF!", `Unknown sheet: ${t.sheetName}`);
2103
+ throw new Z("#REF!", `Unknown sheet: ${t.sheetName}`);
2093
2104
  if (t.addresses.length === 0)
2094
- throw new U("#REF!", `Invalid address: ${this.value}`);
2105
+ throw new Z("#REF!", `Invalid address: ${this.value}`);
2095
2106
  const n = t.sheet.rangeToArea(t.addresses.join(":"));
2096
2107
  return t.sheet.trim(n);
2097
2108
  }
@@ -2125,7 +2136,7 @@ class js extends dt {
2125
2136
  evaluate({ sheet: e }) {
2126
2137
  const t = this.parse(e);
2127
2138
  if (t.id === "?")
2128
- throw new U("#REF!", "Reference does not exist");
2139
+ throw new Z("#REF!", "Reference does not exist");
2129
2140
  const { y: n, x: r } = t.sheet.getPointById(t.id), [o, i] = [Math.abs(n), Math.abs(r)];
2130
2141
  return t.sheet.trim({
2131
2142
  top: o,
@@ -2160,7 +2171,7 @@ class Ks extends dt {
2160
2171
  for (let d = 0; d < n.length; d++) {
2161
2172
  const f = n[d];
2162
2173
  if (f === "?")
2163
- throw new U("#REF!", "Reference does not exist");
2174
+ throw new Z("#REF!", "Reference does not exist");
2164
2175
  const h = t.sheet.getPointById(f);
2165
2176
  r.push(h);
2166
2177
  }
@@ -2183,7 +2194,7 @@ class os {
2183
2194
  evaluate({ sheet: e }) {
2184
2195
  const t = this.name.toLowerCase(), n = e.getFunctionByName(t);
2185
2196
  if (n == null)
2186
- throw new U("#NAME?", `Unknown function: ${t}`);
2197
+ throw new Z("#NAME?", `Unknown function: ${t}`);
2187
2198
  return new n({ args: this.args, sheet: e, at: this.at }).call();
2188
2199
  }
2189
2200
  }
@@ -2204,7 +2215,7 @@ const ra = new wn(0), oa = {
2204
2215
  "-": "uminus"
2205
2216
  }, $r = /* @__PURE__ */ new Set([" ", `
2206
2217
  `, "\r", " ", "\f"]), aa = /* @__PURE__ */ new Set([...$r, "+", "-", "/", "*", "^", "&", "=", "<", ">", ")", ",", "%"]);
2207
- class ne {
2218
+ class re {
2208
2219
  constructor(e, t, n = 0, r, o = !0) {
2209
2220
  this.type = e, this.entity = t, this.precedence = n, this.at = r, this.closed = o;
2210
2221
  }
@@ -2229,9 +2240,9 @@ class ne {
2229
2240
  case "ID_RANGE":
2230
2241
  return new Ks(this.entity);
2231
2242
  case "REF":
2232
- return new Yr(this.entity);
2233
- case "RANGE":
2234
2243
  return new _r(this.entity);
2244
+ case "RANGE":
2245
+ return new Yr(this.entity);
2235
2246
  case "INFIX_OPERATOR": {
2236
2247
  const e = oa[this.entity];
2237
2248
  return new os(e, this.precedence, void 0, this.at);
@@ -2249,7 +2260,7 @@ class ne {
2249
2260
  }
2250
2261
  }
2251
2262
  }
2252
- const ca = (s) => $r.has(s), la = { true: !0, false: !1 }, Jn = new ne("OPEN", "("), da = new ne("CLOSE", ")"), ua = new ne("COMMA", ","), Te = "INFIX_OPERATOR", ha = "PREFIX_OPERATOR", fa = "POSTFIX_OPERATOR";
2263
+ const ca = (s) => $r.has(s), la = { true: !0, false: !1 }, Jn = new re("OPEN", "("), da = new re("CLOSE", ")"), ua = new re("COMMA", ","), Te = "INFIX_OPERATOR", ha = "PREFIX_OPERATOR", fa = "POSTFIX_OPERATOR";
2253
2264
  class We {
2254
2265
  constructor(e, t) {
2255
2266
  this.tokens = [], this.foreign = !1, this.identifiedFormula = "", this.dependencyIds = [], this.formula = e, this.index = 0, this.tokens = [], this.at = t == null ? void 0 : t.at;
@@ -2303,12 +2314,12 @@ class We {
2303
2314
  break;
2304
2315
  }
2305
2316
  case "REF": {
2306
- const o = new Yr(r.entity);
2317
+ const o = new _r(r.entity);
2307
2318
  t.push(o.identify(e)), n.push(...o.ids);
2308
2319
  break;
2309
2320
  }
2310
2321
  case "RANGE": {
2311
- const o = new _r(r.entity);
2322
+ const o = new Yr(r.entity);
2312
2323
  t.push(o.identify(e)), n.push(...o.ids);
2313
2324
  break;
2314
2325
  }
@@ -2349,49 +2360,49 @@ class We {
2349
2360
  this.tokens.push(ua);
2350
2361
  continue;
2351
2362
  case "+":
2352
- this.tokens.push(new ne(Te, "+", 3, this.at));
2363
+ this.tokens.push(new re(Te, "+", 3, this.at));
2353
2364
  continue;
2354
2365
  case "-": {
2355
2366
  const i = (t = this.getToken(-1)) == null ? void 0 : t.type, a = (n = this.getToken(-2)) == null ? void 0 : n.type;
2356
- i === Te || i === "SPACE" && a === Te ? this.tokens.push(new ne(ha, "-", 6, this.at)) : this.tokens.push(new ne(Te, "-", 3, this.at));
2367
+ i === Te || i === "SPACE" && a === Te ? this.tokens.push(new re(ha, "-", 6, this.at)) : this.tokens.push(new re(Te, "-", 3, this.at));
2357
2368
  continue;
2358
2369
  }
2359
2370
  case "/":
2360
- this.tokens.push(new ne(Te, "/", 4, this.at));
2371
+ this.tokens.push(new re(Te, "/", 4, this.at));
2361
2372
  continue;
2362
2373
  case "*":
2363
- this.tokens.push(new ne(Te, "*", 4, this.at));
2374
+ this.tokens.push(new re(Te, "*", 4, this.at));
2364
2375
  continue;
2365
2376
  case "^":
2366
- this.tokens.push(new ne(Te, "^", 5, this.at));
2377
+ this.tokens.push(new re(Te, "^", 5, this.at));
2367
2378
  continue;
2368
2379
  case "&":
2369
- this.tokens.push(new ne(Te, "&", 4, this.at));
2380
+ this.tokens.push(new re(Te, "&", 4, this.at));
2370
2381
  continue;
2371
2382
  case "=":
2372
- this.tokens.push(new ne(Te, "=", 1, this.at));
2383
+ this.tokens.push(new re(Te, "=", 1, this.at));
2373
2384
  continue;
2374
2385
  case ">":
2375
2386
  if (this.get() === "=") {
2376
- this.next(), this.tokens.push(new ne(Te, ">=", 2, this.at));
2387
+ this.next(), this.tokens.push(new re(Te, ">=", 2, this.at));
2377
2388
  continue;
2378
2389
  }
2379
- this.tokens.push(new ne(Te, ">", 2, this.at));
2390
+ this.tokens.push(new re(Te, ">", 2, this.at));
2380
2391
  continue;
2381
2392
  case "<":
2382
2393
  if (this.get() === "=") {
2383
- this.next(), this.tokens.push(new ne(Te, "<=", 2, this.at));
2394
+ this.next(), this.tokens.push(new re(Te, "<=", 2, this.at));
2384
2395
  continue;
2385
2396
  }
2386
2397
  if (this.get() === ">") {
2387
- this.next(), this.tokens.push(new ne(Te, "<>", 1, this.at));
2398
+ this.next(), this.tokens.push(new re(Te, "<>", 1, this.at));
2388
2399
  continue;
2389
2400
  }
2390
- this.tokens.push(new ne(Te, "<", 2, this.at));
2401
+ this.tokens.push(new re(Te, "<", 2, this.at));
2391
2402
  continue;
2392
2403
  case '"': {
2393
2404
  const { buf: i, closed: a } = this.getString('"');
2394
- this.tokens.push(new ne("VALUE", i, 0, this.at, a));
2405
+ this.tokens.push(new re("VALUE", i, 0, this.at, a));
2395
2406
  continue;
2396
2407
  }
2397
2408
  case "'": {
@@ -2404,7 +2415,7 @@ class We {
2404
2415
  break;
2405
2416
  }
2406
2417
  case "%": {
2407
- this.tokens.push(new ne(fa, "%", 4, this.at));
2418
+ this.tokens.push(new re(fa, "%", 4, this.at));
2408
2419
  continue;
2409
2420
  }
2410
2421
  }
@@ -2412,17 +2423,17 @@ class We {
2412
2423
  for (; ; ) {
2413
2424
  const i = this.get();
2414
2425
  if (i === "(") {
2415
- this.tokens.push(new ne("FUNCTION", o, 0, this.at), Jn), this.next();
2426
+ this.tokens.push(new re("FUNCTION", o, 0, this.at), Jn), this.next();
2416
2427
  break;
2417
2428
  }
2418
2429
  if (i == null || aa.has(i)) {
2419
2430
  if (o.length === 0)
2420
2431
  break;
2421
2432
  if (o.match(/^[+-]?(\d*[.])?\d+$/))
2422
- this.tokens.push(new ne("VALUE", parseFloat(o), 0, this.at));
2433
+ this.tokens.push(new re("VALUE", parseFloat(o), 0, this.at));
2423
2434
  else {
2424
2435
  const a = la[o.toLowerCase()];
2425
- a != null ? this.tokens.push(new ne("VALUE", a, 0, this.at)) : o.startsWith("#") ? o.indexOf("#REF!") !== -1 ? this.tokens.push(new ne("UNREFERENCED", o, 0, this.at)) : o.indexOf(":") !== -1 ? this.tokens.push(new ne("ID_RANGE", ga(o, e), 0, this.at)) : this.tokens.push(new ne("ID", o, 0, this.at)) : o.indexOf(":") !== -1 ? this.tokens.push(new ne("RANGE", o, 0, this.at)) : o.includes(".") && /[a-zA-Z]/.test(o) || isNaN(o[o.length - 1]) ? this.tokens.push(new ne("INVALID_REF", o, 0, this.at)) : this.tokens.push(new ne("REF", o, 0, this.at));
2436
+ a != null ? this.tokens.push(new re("VALUE", a, 0, this.at)) : o.startsWith("#") ? o.indexOf("#REF!") !== -1 ? this.tokens.push(new re("UNREFERENCED", o, 0, this.at)) : o.indexOf(":") !== -1 ? this.tokens.push(new re("ID_RANGE", ga(o, e), 0, this.at)) : this.tokens.push(new re("ID", o, 0, this.at)) : o.indexOf(":") !== -1 ? this.tokens.push(new re("RANGE", o, 0, this.at)) : o.includes(".") && /[a-zA-Z]/.test(o) || isNaN(o[o.length - 1]) ? this.tokens.push(new re("INVALID_REF", o, 0, this.at)) : this.tokens.push(new re("REF", o, 0, this.at));
2426
2437
  }
2427
2438
  break;
2428
2439
  }
@@ -2434,7 +2445,7 @@ class We {
2434
2445
  let e = "";
2435
2446
  for (; this.isWhiteSpace(); )
2436
2447
  e += this.formula[this.index++];
2437
- e !== "" && this.tokens.push(new ne("SPACE", e, 0, this.at));
2448
+ e !== "" && this.tokens.push(new re("SPACE", e, 0, this.at));
2438
2449
  }
2439
2450
  getString(e = '"') {
2440
2451
  let t = "";
@@ -2491,7 +2502,7 @@ class Or {
2491
2502
  if (o.type !== "SPACE") {
2492
2503
  if (o.type === "COMMA") {
2493
2504
  if (!e)
2494
- throw new U("#ERROR!", "Invalid comma");
2505
+ throw new Z("#ERROR!", "Invalid comma");
2495
2506
  return r(!0);
2496
2507
  } else if (o.type === "VALUE" || o.type === "ID" || o.type === "ID_RANGE" || o.type === "REF" || o.type === "RANGE" || o.type === "UNREFERENCED" || o.type === "INVALID_REF") {
2497
2508
  const i = o.convert();
@@ -2499,7 +2510,7 @@ class Or {
2499
2510
  } else if (o.type === "POSTFIX_OPERATOR" && o.entity === "%") {
2500
2511
  const i = t.pop();
2501
2512
  if (!i)
2502
- throw new U("#ERROR!", "Missing expression before %");
2513
+ throw new Z("#ERROR!", "Missing expression before %");
2503
2514
  const a = new os("divide", 4, [i, new wn(100)]);
2504
2515
  t.push(a);
2505
2516
  } else if (o.type === "FUNCTION") {
@@ -2516,7 +2527,7 @@ class Or {
2516
2527
  t.push(i);
2517
2528
  } else if (o.type === "CLOSE") {
2518
2529
  if (this.depth-- === 0)
2519
- throw new U("#ERROR!", "Unexpected end paren");
2530
+ throw new Z("#ERROR!", "Unexpected end paren");
2520
2531
  return r();
2521
2532
  } else if (o.type === "INFIX_OPERATOR") {
2522
2533
  const i = o.convert();
@@ -2525,7 +2536,7 @@ class Or {
2525
2536
  if (i.name === "minus" || i.name === "add")
2526
2537
  a = ra;
2527
2538
  else
2528
- throw new U("#ERROR!", "Missing left expression");
2539
+ throw new Z("#ERROR!", "Missing left expression");
2529
2540
  if (n == null)
2530
2541
  i.args.push(a), t.unshift(i);
2531
2542
  else if (i.precedence > n.precedence)
@@ -2712,7 +2723,7 @@ const yt = (s, { sheet: e, operation: t, dependency: n }) => {
2712
2723
  return i;
2713
2724
  }, bt = (s, e) => {
2714
2725
  var n;
2715
- X(s), !((n = document.execCommand) != null && n.call(document, "insertText", !1, e)) && s.setRangeText(e, s.selectionStart, s.selectionEnd, "end");
2726
+ H(s), !((n = document.execCommand) != null && n.call(document, "insertText", !1, e)) && s.setRangeText(e, s.selectionStart, s.selectionEnd, "end");
2716
2727
  }, et = ({ input: s, ref: e, dryRun: t = !1 }) => {
2717
2728
  var a;
2718
2729
  if (!((a = s == null ? void 0 : s.value) != null && a.startsWith("=")) || s.selectionStart === 0)
@@ -2838,7 +2849,7 @@ class wa {
2838
2849
  onKeyUp: d,
2839
2850
  onInit: f
2840
2851
  } = {}) {
2841
- this.sheetHead = 0, this.cellHead = 0, this.data = {}, this.systems = {}, this.sheetIdsByName = {}, this.contextsBySheetId = {}, this.choosingSheetId = 0, this.choosingAddress = "", this.editingSheetId = 0, this.editingAddress = "", this.paletteBySheetName = {}, this.lastFocused = null, this.solvedCaches = /* @__PURE__ */ new Map(), this.lastSpilledTargetIds = /* @__PURE__ */ new Set(), this.asyncPending = /* @__PURE__ */ new Map(), this.copyingSheetId = 0, this.copyingZone = Mo, this.cutting = !1, this.histories = [], this.historyIndex = -1, this.historyLimit = Io, this.ready = !1, this.functions = {}, this.policies = {}, this.transmit = (h) => {
2852
+ this.sheetHead = 0, this.cellHead = 0, this.data = {}, this.systems = {}, this.sheetIdsByName = {}, this.contextsBySheetId = {}, this.choosingSheetId = 0, this.choosingAddress = "", this.editingSheetId = 0, this.editingAddress = "", this.paletteBySheetName = {}, this.lastFocused = null, this.solvedCaches = /* @__PURE__ */ new Map(), this.lastSpilledTargetIds = /* @__PURE__ */ new Set(), this.asyncPending = /* @__PURE__ */ new Map(), this.copyingSheetId = 0, this.copyingZone = Mo, this.cutting = !1, this.histories = [], this.historyIndex = -1, this.historyLimit = Io, this._componentSheetIds = /* @__PURE__ */ new Map(), this.ready = !1, this.functions = {}, this.policies = {}, this.transmit = (h) => {
2842
2853
  }, e != null && (this.historyLimit = e), this.functions = {
2843
2854
  ...Kr,
2844
2855
  ...t
@@ -2870,7 +2881,7 @@ const Br = (s = {}) => new wa(s), Ra = (s = {}) => ({ registry: Br(s) }), Sa = (
2870
2881
  const [e, t] = ie(() => Ra(s)), { registry: n } = e;
2871
2882
  return n.transmit = (r) => {
2872
2883
  Object.assign(n, r), n.ready && requestAnimationFrame(() => t({ registry: n }));
2873
- }, j(() => {
2884
+ }, K(() => {
2874
2885
  Object.assign(n, s);
2875
2886
  }, [s]), e;
2876
2887
  };
@@ -2996,12 +3007,12 @@ class Rn {
2996
3007
  case "object":
2997
3008
  if (t instanceof Date)
2998
3009
  i = this.renderDate({ ...e, value: t, cell: n });
2999
- else if (V.is(t))
3000
- i = this.renderTime({ value: V.ensure(t), cell: n, sheet: r, point: o });
3010
+ else if (j.is(t))
3011
+ i = this.renderTime({ value: j.ensure(t), cell: n, sheet: r, point: o });
3001
3012
  else if (Array.isArray(t))
3002
3013
  i = this.renderArray({ ...e, value: t, cell: n });
3003
3014
  else {
3004
- if (U.is(t))
3015
+ if (Z.is(t))
3005
3016
  throw t;
3006
3017
  Ge(t) ? i = this.renderSheet({ ...e, value: t, cell: n }) : i = this.renderObject({ ...e, value: t, cell: n });
3007
3018
  }
@@ -3074,11 +3085,11 @@ class Rn {
3074
3085
  case "object":
3075
3086
  if (t instanceof Date)
3076
3087
  return this.toScalarDate({ value: t, cell: n, sheet: r, point: o });
3077
- if (V.is(t))
3078
- return this.toScalarTime({ value: V.ensure(t), cell: n, sheet: r, point: o });
3088
+ if (j.is(t))
3089
+ return this.toScalarTime({ value: j.ensure(t), cell: n, sheet: r, point: o });
3079
3090
  if (Array.isArray(t))
3080
3091
  return this.toScalarArray({ value: t, cell: n, sheet: r, point: o });
3081
- if (U.is(t))
3092
+ if (Z.is(t))
3082
3093
  throw t;
3083
3094
  return;
3084
3095
  default:
@@ -3110,7 +3121,7 @@ class Rn {
3110
3121
  }
3111
3122
  // --- SERIALIZE ---
3112
3123
  serialize({ value: e, cell: t, sheet: n, point: r }) {
3113
- return e === void 0 && (e = t == null ? void 0 : t.value), we.is(e) ? "" : e instanceof Date ? this.serializeDate({ value: e, cell: t, sheet: n, point: r }) : V.is(e) ? this.serializeTime({ value: V.ensure(e), cell: t, sheet: n, point: r }) : e == null ? this.serializeNull({ cell: t, sheet: n, point: r }) : Array.isArray(e) ? this.serializeArray({ value: e, cell: t, sheet: n, point: r }) : e instanceof U ? this.serializeFormulaError({ value: e, cell: t, sheet: n, point: r }) : e instanceof Error ? this.serializeError({ value: e, cell: t, sheet: n, point: r }) : e.toString();
3124
+ return e === void 0 && (e = t == null ? void 0 : t.value), we.is(e) ? "" : e instanceof Date ? this.serializeDate({ value: e, cell: t, sheet: n, point: r }) : j.is(e) ? this.serializeTime({ value: j.ensure(e), cell: t, sheet: n, point: r }) : e == null ? this.serializeNull({ cell: t, sheet: n, point: r }) : Array.isArray(e) ? this.serializeArray({ value: e, cell: t, sheet: n, point: r }) : e instanceof Z ? this.serializeFormulaError({ value: e, cell: t, sheet: n, point: r }) : e instanceof Error ? this.serializeError({ value: e, cell: t, sheet: n, point: r }) : e.toString();
3114
3125
  }
3115
3126
  serializeString({ value: e }) {
3116
3127
  return e;
@@ -3154,7 +3165,7 @@ class Rn {
3154
3165
  }
3155
3166
  }
3156
3167
  deserializeRaw(e, t) {
3157
- return V.is(e) && (e = V.ensure(e)), { ...t, value: e };
3168
+ return j.is(e) && (e = j.ensure(e)), { ...t, value: e };
3158
3169
  }
3159
3170
  deserialize(e, t) {
3160
3171
  if (e[0] === "'")
@@ -3176,7 +3187,7 @@ class Rn {
3176
3187
  return e.match(/^-?[\d.]+$/) != null && e.match(/\.$/) == null && (e.match(/\./g) || []).length <= 1 ? { value: parseFloat(e) } : { value: void 0 };
3177
3188
  }
3178
3189
  deserializeTime(e, t) {
3179
- return e.length < 3 || isNaN(e[e.length - 1]) ? { value: void 0 } : { value: V.parse(e) };
3190
+ return e.length < 3 || isNaN(e[e.length - 1]) ? { value: void 0 } : { value: j.parse(e) };
3180
3191
  }
3181
3192
  deserializeDate(e, t) {
3182
3193
  return { value: Zr(e) };
@@ -3195,7 +3206,7 @@ class Rn {
3195
3206
  }
3196
3207
  const Dt = "default", Ta = new Rn({ priority: 0 }), Be = (s) => s == null ? "" : String(s);
3197
3208
  function Et(s) {
3198
- return typeof s == "number" ? "number" : s instanceof Date ? "date" : V.is(s) ? "time" : typeof s == "boolean" ? "boolean" : "string";
3209
+ return typeof s == "number" ? "number" : s instanceof Date ? "date" : j.is(s) ? "time" : typeof s == "boolean" ? "boolean" : "string";
3199
3210
  }
3200
3211
  function kt(s, e) {
3201
3212
  switch (e) {
@@ -3210,7 +3221,7 @@ function kt(s, e) {
3210
3221
  return t ? { ok: !0, num: t.getTime() } : { ok: !1, num: NaN };
3211
3222
  }
3212
3223
  case "time": {
3213
- const t = V.parse(s);
3224
+ const t = j.parse(s);
3214
3225
  return t ? { ok: !0, num: t.toMilliseconds() } : { ok: !1, num: NaN };
3215
3226
  }
3216
3227
  case "boolean": {
@@ -3228,7 +3239,7 @@ function At(s, e) {
3228
3239
  case "date":
3229
3240
  return s.getTime();
3230
3241
  case "time":
3231
- return V.ensure(s).toMilliseconds();
3242
+ return j.ensure(s).toMilliseconds();
3232
3243
  case "boolean":
3233
3244
  return s ? 1 : 0;
3234
3245
  default:
@@ -3275,13 +3286,13 @@ const Ia = (s, e) => {
3275
3286
  return Be(e) < s.value[0];
3276
3287
  const n = At(e, t), r = kt(s.value[0], t);
3277
3288
  return r.ok && n < r.num;
3278
- }, Ya = (s, e) => {
3289
+ }, _a = (s, e) => {
3279
3290
  const t = Et(e);
3280
3291
  if (t === "string")
3281
3292
  return Be(e) <= s.value[0];
3282
3293
  const n = At(e, t), r = kt(s.value[0], t);
3283
3294
  return r.ok && n <= r.num;
3284
- }, _a = (s, e) => e == null || Be(e) === "", $a = (s, e) => e != null && Be(e) !== "", Oa = (s, e) => {
3295
+ }, Ya = (s, e) => e == null || Be(e) === "", $a = (s, e) => e != null && Be(e) !== "", Oa = (s, e) => {
3285
3296
  const t = Be(e).toLowerCase();
3286
3297
  return s.value.some((n) => t.includes(n.toLowerCase()));
3287
3298
  }, Pa = (s, e) => {
@@ -3293,8 +3304,8 @@ const Ia = (s, e) => {
3293
3304
  gt: Ma,
3294
3305
  gte: Fa,
3295
3306
  lt: Da,
3296
- lte: Ya,
3297
- blank: _a,
3307
+ lte: _a,
3308
+ blank: Ya,
3298
3309
  nonblank: $a,
3299
3310
  includes: Oa,
3300
3311
  excludes: Pa
@@ -3373,7 +3384,7 @@ class Ne {
3373
3384
  }
3374
3385
  get headerHeight() {
3375
3386
  var e;
3376
- return ((e = this.getCell({ y: 0, x: 0 }, { resolution: "SYSTEM" })) == null ? void 0 : e.height) || _s;
3387
+ return ((e = this.getCell({ y: 0, x: 0 }, { resolution: "SYSTEM" })) == null ? void 0 : e.height) || Ys;
3377
3388
  }
3378
3389
  setHeaderHeight(e, t = !0) {
3379
3390
  return this.update({
@@ -3655,7 +3666,7 @@ class Ne {
3655
3666
  var a, l;
3656
3667
  if (this.status > 1)
3657
3668
  return;
3658
- e[0] == null && (e[0] = { width: $s, height: _s });
3669
+ e[0] == null && (e[0] = { width: $s, height: Ys });
3659
3670
  const t = rn(e), n = Date.now();
3660
3671
  this.area = {
3661
3672
  top: 1,
@@ -3876,7 +3887,7 @@ class Ne {
3876
3887
  for (let h = l; h <= u; h++) {
3877
3888
  const g = this.getId({ y: f, x: h });
3878
3889
  if (t === g)
3879
- throw new U("#REF!", "References are circulating.");
3890
+ throw new Z("#REF!", "References are circulating.");
3880
3891
  const p = this.getCell({ y: f, x: h }, { resolution: n, raise: r }) ?? {};
3881
3892
  if (o(p)) {
3882
3893
  let m = p.value;
@@ -3995,12 +4006,12 @@ class Ne {
3995
4006
  let N;
3996
4007
  if (x) {
3997
4008
  if (!(e === n && b.has(E))) {
3998
- const H = n.getId({ y: M, x: R });
3999
- H != null && (N = H);
4009
+ const X = n.getId({ y: M, x: R });
4010
+ X != null && (N = X);
4000
4011
  }
4001
4012
  } else {
4002
- const H = e.getId({ y: k, x: C });
4003
- H != null && (N = H);
4013
+ const X = e.getId({ y: k, x: C });
4014
+ X != null && (N = X);
4004
4015
  }
4005
4016
  const D = e.getCell({ y: k, x: C }, { resolution: "SYSTEM" }), $ = x ? n.getCell({ y: M, x: R }, { resolution: "SYSTEM" }) : void 0;
4006
4017
  A.push({
@@ -4082,20 +4093,20 @@ class Ne {
4082
4093
  }, this.registry.systems[A] = { id: A, sheetId: e.id, changedTime: Date.now() }, c.push({ y: k.y, x: k.x, id: A });
4083
4094
  }
4084
4095
  if (C != null && T != null && S != null) {
4085
- const x = m || Dt, E = p || Dt, F = t.policies[x] ?? t.defaultPolicy, N = e.policies[E] ?? e.defaultPolicy, D = N.priority > F.priority, H = (D ? N : F).select({
4096
+ const x = m || Dt, E = p || Dt, F = t.policies[x] ?? t.defaultPolicy, N = e.policies[E] ?? e.defaultPolicy, D = N.priority > F.priority, X = (D ? N : F).select({
4086
4097
  sheet: t,
4087
4098
  point: T,
4088
4099
  next: R,
4089
4100
  current: y,
4090
4101
  operation: Bt
4091
4102
  });
4092
- if (H && (i[M] = R ?? {}, l[M] = {
4103
+ if (X && (i[M] = R ?? {}, l[M] = {
4093
4104
  ...R,
4094
- ...H,
4105
+ ...X,
4095
4106
  policy: D ? p : m
4096
4107
  }), R != null) {
4097
- const Z = this.registry.systems[M];
4098
- Z && (Z.changedTime = Date.now());
4108
+ const W = this.registry.systems[M];
4109
+ W && (W.changedTime = Date.now());
4099
4110
  }
4100
4111
  u.push({ y: T.y, x: T.x, id: M });
4101
4112
  }
@@ -4139,22 +4150,22 @@ class Ne {
4139
4150
  continue;
4140
4151
  const F = u + x % M, N = l ? 0 : R - y, D = l ? 0 : E - F, $ = {
4141
4152
  ...e.getCell({ y, x: F }, { resolution: "SYSTEM" })
4142
- }, H = { y: R, x: E }, Z = this.getCell(H, { resolution: "SYSTEM" }), ce = this.getPolicy(H), he = { y, x: F }, B = e.getPolicy(he), K = e.getCell(he, { resolution: "SYSTEM" }), W = B.priority > ce.priority;
4143
- $.policy = W ? K == null ? void 0 : K.policy : Z == null ? void 0 : Z.policy;
4144
- const se = this.getId(H);
4153
+ }, X = { y: R, x: E }, W = this.getCell(X, { resolution: "SYSTEM" }), ae = this.getPolicy(X), he = { y, x: F }, B = e.getPolicy(he), V = e.getCell(he, { resolution: "SYSTEM" }), U = B.priority > ae.priority;
4154
+ $.policy = U ? V == null ? void 0 : V.policy : W == null ? void 0 : W.policy;
4155
+ const se = this.getId(X);
4145
4156
  this.clearDependencies(se);
4146
- const q = ($ == null ? void 0 : $.formulaEnabled) ?? !0 ? this.processFormula($ == null ? void 0 : $.value, {
4157
+ const Q = ($ == null ? void 0 : $.formulaEnabled) ?? !0 ? this.processFormula($ == null ? void 0 : $.value, {
4147
4158
  dependency: se,
4148
4159
  slideY: N,
4149
4160
  slideX: D
4150
- }) : $ == null ? void 0 : $.value, Q = this.getId(H), P = this.registry.systems[Q];
4161
+ }) : $ == null ? void 0 : $.value, q = this.getId(X), P = this.registry.systems[q];
4151
4162
  P != null && (P.changedTime = S);
4152
- const re = G(H);
4163
+ const ne = G(X);
4153
4164
  if (r) {
4154
- const I = this.getCell(H, { resolution: "SYSTEM" });
4165
+ const I = this.getCell(X, { resolution: "SYSTEM" });
4155
4166
  $.style = I == null ? void 0 : I.style, $.justifyContent = I == null ? void 0 : I.justifyContent, $.alignItems = I == null ? void 0 : I.alignItems;
4156
4167
  }
4157
- b[re] = { ...$, value: q };
4168
+ b[ne] = { ...$, value: Q };
4158
4169
  }
4159
4170
  }
4160
4171
  return this.update({
@@ -4599,13 +4610,13 @@ class Ne {
4599
4610
  break;
4600
4611
  case "INSERT_ROWS": {
4601
4612
  e.diffBefore && n._applyDiff(e.diffBefore, !1);
4602
- const { rows: r } = _t({ matrix: e.idMatrix });
4613
+ const { rows: r } = Yt({ matrix: e.idMatrix });
4603
4614
  n.idMatrix.splice(e.y, r), n.area.bottom -= r;
4604
4615
  break;
4605
4616
  }
4606
4617
  case "INSERT_COLS": {
4607
4618
  e.diffBefore && n._applyDiff(e.diffBefore, !1);
4608
- const { cols: r } = _t({ matrix: e.idMatrix });
4619
+ const { cols: r } = Yt({ matrix: e.idMatrix });
4609
4620
  n.idMatrix.forEach((o) => {
4610
4621
  o.splice(e.x, r);
4611
4622
  }), n.area.right -= r;
@@ -4662,13 +4673,13 @@ class Ne {
4662
4673
  break;
4663
4674
  case "INSERT_ROWS": {
4664
4675
  e.diffAfter && n._applyDiff(e.diffAfter, !1);
4665
- const { rows: r } = _t({ matrix: e.idMatrix });
4676
+ const { rows: r } = Yt({ matrix: e.idMatrix });
4666
4677
  n.idMatrix.splice(e.y, 0, ...e.idMatrix), n.area.bottom += r;
4667
4678
  break;
4668
4679
  }
4669
4680
  case "INSERT_COLS": {
4670
4681
  e.diffAfter && n._applyDiff(e.diffAfter, !1);
4671
- const { cols: r } = _t({ matrix: e.idMatrix });
4682
+ const { cols: r } = Yt({ matrix: e.idMatrix });
4672
4683
  n.idMatrix.map((o, i) => {
4673
4684
  o.splice(e.x, 0, ...e.idMatrix[i]);
4674
4685
  }), n.area.right += r;
@@ -4792,12 +4803,12 @@ class Ne {
4792
4803
  }
4793
4804
  const h = this.registry.data[d];
4794
4805
  if ((h == null ? void 0 : h.value) != null && h.value !== "")
4795
- throw new U(
4806
+ throw new Z(
4796
4807
  "#REF!",
4797
4808
  `Array result was not expanded because it would overwrite data in ${f}.`
4798
4809
  );
4799
4810
  if (this.registry.solvedCaches.has(d))
4800
- throw new U(
4811
+ throw new Z(
4801
4812
  "#REF!",
4802
4813
  `Array result was not expanded because ${f} is already occupied by another formula.`
4803
4814
  );
@@ -4882,10 +4893,10 @@ const Gs = ({ value: s, sheet: e, point: t, raise: n = !0, resolution: r = "RESO
4882
4893
  const u = n.left + c, d = { y: a, x: u }, [f, h] = s.getSolvedCache(d);
4883
4894
  try {
4884
4895
  if (Vt.is(h))
4885
- throw new U("#REF!", "References are circulating.", new Error(l));
4896
+ throw new Z("#REF!", "References are circulating.", new Error(l));
4886
4897
  if (we.is(h))
4887
4898
  return h;
4888
- if (U.is(h))
4899
+ if (Z.is(h))
4889
4900
  throw h;
4890
4901
  if (h != null)
4891
4902
  return h;
@@ -4939,7 +4950,7 @@ const Gs = ({ value: s, sheet: e, point: t, raise: n = !0, resolution: r = "RESO
4939
4950
  const d = r.data[e];
4940
4951
  d != null && bs(d, t, { value: u, expireTime: c.expireTime });
4941
4952
  }).catch((u) => {
4942
- U.is(u) || (u = new U("#ASYNC!", (u == null ? void 0 : u.message) ?? String(u), u instanceof Error ? u : void 0));
4953
+ Z.is(u) || (u = new Z("#ASYNC!", (u == null ? void 0 : u.message) ?? String(u), u instanceof Error ? u : void 0));
4943
4954
  const d = r.data[e];
4944
4955
  d != null && bs(d, t, { value: u, expireTime: c.expireTime });
4945
4956
  }).finally(() => {
@@ -4953,7 +4964,7 @@ const Gs = ({ value: s, sheet: e, point: t, raise: n = !0, resolution: r = "RESO
4953
4964
  const d = i.data[t];
4954
4965
  d != null && bs(d, n, { value: u, expireTime: a });
4955
4966
  }).catch((u) => {
4956
- U.is(u) || (u = new U("#ASYNC!", (u == null ? void 0 : u.message) ?? String(u), u instanceof Error ? u : void 0));
4967
+ Z.is(u) || (u = new Z("#ASYNC!", (u == null ? void 0 : u.message) ?? String(u), u instanceof Error ? u : void 0));
4957
4968
  const d = i.data[t];
4958
4969
  d != null && bs(d, n, { value: u, expireTime: a });
4959
4970
  }).finally(() => {
@@ -4968,7 +4979,7 @@ const Gs = ({ value: s, sheet: e, point: t, raise: n = !0, resolution: r = "RESO
4968
4979
  return !0;
4969
4980
  if (s == null)
4970
4981
  return e;
4971
- if (U.is(s) || s instanceof Error) {
4982
+ if (Z.is(s) || s instanceof Error) {
4972
4983
  if (t)
4973
4984
  return !0;
4974
4985
  throw s;
@@ -4994,7 +5005,7 @@ const Gs = ({ value: s, sheet: e, point: t, raise: n = !0, resolution: r = "RESO
4994
5005
  return !0;
4995
5006
  break;
4996
5007
  case "time":
4997
- if (V.is(s))
5008
+ if (j.is(s))
4998
5009
  return !0;
4999
5010
  break;
5000
5011
  case "matrix":
@@ -5077,16 +5088,16 @@ const Gs = ({ value: s, sheet: e, point: t, raise: n = !0, resolution: r = "RESO
5077
5088
  const t = [...e], n = this.defs;
5078
5089
  if (n.length === 0) {
5079
5090
  if (e.length !== 0)
5080
- throw new U("#N/A", "Too many arguments: expected 0, got " + e.length + ".");
5091
+ throw new Z("#N/A", "Too many arguments: expected 0, got " + e.length + ".");
5081
5092
  return t;
5082
5093
  }
5083
5094
  let r = 0, o = !1;
5084
5095
  for (const a of n)
5085
5096
  a.variadic && (o = !0), a.optional || r++;
5086
5097
  if (e.length < r)
5087
- throw new U("#N/A", `Too few arguments: expected at least ${r}, got ${e.length}.`);
5098
+ throw new Z("#N/A", `Too few arguments: expected at least ${r}, got ${e.length}.`);
5088
5099
  if (!o && e.length > n.length)
5089
- throw new U("#N/A", `Too many arguments: expected at most ${n.length}, got ${e.length}.`);
5100
+ throw new Z("#N/A", `Too many arguments: expected at most ${n.length}, got ${e.length}.`);
5090
5101
  const i = sr(n, e.length);
5091
5102
  for (let a = 0; a < e.length; a++) {
5092
5103
  const l = n[i[a]];
@@ -5099,7 +5110,7 @@ const Gs = ({ value: s, sheet: e, point: t, raise: n = !0, resolution: r = "RESO
5099
5110
  continue;
5100
5111
  } else ut(c) && (l.takesMatrix || (c = ja(c, this.at)));
5101
5112
  if (!Va(c, l))
5102
- throw new U(
5113
+ throw new Z(
5103
5114
  "#VALUE!",
5104
5115
  `Argument "${l.name}" (position ${a + 1}) expected ${l.acceptedTypes.join(" | ")}, got ${typeof c}.`
5105
5116
  );
@@ -5239,7 +5250,7 @@ const vn = (s, e) => {
5239
5250
  }
5240
5251
  if (s instanceof Date)
5241
5252
  return s.getTime();
5242
- if (V.is(s))
5253
+ if (j.is(s))
5243
5254
  return s.days;
5244
5255
  if (typeof s == "string" && s.endsWith("%")) {
5245
5256
  const o = parseFloat(s.slice(0, -1));
@@ -5250,7 +5261,7 @@ const vn = (s, e) => {
5250
5261
  if (isNaN(r)) {
5251
5262
  if (n)
5252
5263
  return t ?? 0;
5253
- throw new U("#VALUE!", `${s} cannot be converted to a number`);
5264
+ throw new Z("#VALUE!", `${s} cannot be converted to a number`);
5254
5265
  }
5255
5266
  return r;
5256
5267
  }, He = (s) => {
@@ -5287,7 +5298,7 @@ const vn = (s, e) => {
5287
5298
  if (r == null) {
5288
5299
  if (n)
5289
5300
  return !1;
5290
- throw new U("#VALUE!", `text '${s}' cannot be converted to a boolean`);
5301
+ throw new Z("#VALUE!", `text '${s}' cannot be converted to a boolean`);
5291
5302
  }
5292
5303
  return r;
5293
5304
  }
@@ -5359,10 +5370,10 @@ class Ja extends te {
5359
5370
  main(e, t) {
5360
5371
  if (typeof e == "number" && typeof t == "number")
5361
5372
  return e + t;
5362
- if (e instanceof Date && V.is(t))
5363
- return V.ensure(t).add(e);
5364
- if (V.is(e) && t instanceof Date)
5365
- return V.ensure(e).add(t);
5373
+ if (e instanceof Date && j.is(t))
5374
+ return j.ensure(t).add(e);
5375
+ if (j.is(e) && t instanceof Date)
5376
+ return j.ensure(e).add(t);
5366
5377
  if (e instanceof Date && typeof t == "number")
5367
5378
  return Ie(e).add(t * Os, "second").toDate();
5368
5379
  if (typeof e == "number" && t instanceof Date)
@@ -5370,7 +5381,7 @@ class Ja extends te {
5370
5381
  try {
5371
5382
  return me(e, { alternative: 0 }) + me(t, { alternative: 0 });
5372
5383
  } catch {
5373
- throw new U("#VALUE!", "Mismatched types for augend or addend.");
5384
+ throw new Z("#VALUE!", "Mismatched types for augend or addend.");
5374
5385
  }
5375
5386
  }
5376
5387
  }
@@ -5391,17 +5402,17 @@ class tc extends te {
5391
5402
  if (typeof e == "number" && typeof t == "number")
5392
5403
  return e - t;
5393
5404
  if (e instanceof Date && t instanceof Date)
5394
- return V.fromDates(e, t);
5395
- if (e instanceof Date && V.is(t))
5396
- return V.ensure(t).sub(e);
5397
- if (V.is(e) && t instanceof Date)
5398
- return V.ensure(e).sub(t);
5405
+ return j.fromDates(e, t);
5406
+ if (e instanceof Date && j.is(t))
5407
+ return j.ensure(t).sub(e);
5408
+ if (j.is(e) && t instanceof Date)
5409
+ return j.ensure(e).sub(t);
5399
5410
  if (e instanceof Date && typeof t == "number")
5400
5411
  return Ie(e).subtract(t * Os, "second").toDate();
5401
5412
  try {
5402
5413
  return me(e, { alternative: 0 }) - me(t, { alternative: 0 });
5403
5414
  } catch {
5404
- throw new U("#VALUE!", "Mismatched types for minuend or subtrahend.");
5415
+ throw new Z("#VALUE!", "Mismatched types for minuend or subtrahend.");
5405
5416
  }
5406
5417
  }
5407
5418
  }
@@ -5438,7 +5449,7 @@ class oc extends te {
5438
5449
  validate(e) {
5439
5450
  const t = super.validate(e).map((n) => me(n));
5440
5451
  if (t[1] === 0)
5441
- throw new U("#DIV/0!", "The second argument must be non-zero.");
5452
+ throw new Z("#DIV/0!", "The second argument must be non-zero.");
5442
5453
  return t;
5443
5454
  }
5444
5455
  main(e, t) {
@@ -5657,7 +5668,7 @@ class Mc extends te {
5657
5668
  ], this.category = "logical", this.broadcastDisabled = !0;
5658
5669
  }
5659
5670
  main(e, t) {
5660
- return U.is(e) || e instanceof Error ? t : e;
5671
+ return Z.is(e) || e instanceof Error ? t : e;
5661
5672
  }
5662
5673
  }
5663
5674
  const Fc = `Returns the inverse of the Boolean; if TRUE, NOT returns FALSE.
@@ -5676,10 +5687,10 @@ class Dc extends te {
5676
5687
  return !es(e);
5677
5688
  }
5678
5689
  }
5679
- const Yc = "Returns the count of a series of numbers or cells.";
5680
- class _c extends te {
5690
+ const _c = "Returns the count of a series of numbers or cells.";
5691
+ class Yc extends te {
5681
5692
  constructor() {
5682
- super(...arguments), this.example = "COUNT(A2:A100,B2:B100,4,26)", this.description = Yc, this.defs = [
5693
+ super(...arguments), this.example = "COUNT(A2:A100,B2:B100,4,26)", this.description = _c, this.defs = [
5683
5694
  {
5684
5695
  name: "value",
5685
5696
  description: "Numbers or ranges to count.",
@@ -5778,7 +5789,7 @@ class Hc extends te {
5778
5789
  t += o, n++;
5779
5790
  }
5780
5791
  }), n === 0)
5781
- throw new U("#DIV/0!", "Evaluation of function AVERAGE caused a divide by zero error.");
5792
+ throw new Z("#DIV/0!", "Evaluation of function AVERAGE caused a divide by zero error.");
5782
5793
  return t / n;
5783
5794
  }
5784
5795
  }
@@ -5915,7 +5926,7 @@ const Kr = {
5915
5926
  max: Uc,
5916
5927
  min: Wc,
5917
5928
  average: Hc,
5918
- count: _c,
5929
+ count: Yc,
5919
5930
  counta: zc,
5920
5931
  // Text
5921
5932
  len: jc,
@@ -6015,7 +6026,7 @@ const Kr = {
6015
6026
  pt(() => {
6016
6027
  r >= i.length && o(0);
6017
6028
  }, [i.length, r]);
6018
- const u = _(
6029
+ const u = Y(
6019
6030
  (h) => {
6020
6031
  if (!h)
6021
6032
  return { value: s, selectionStart: e };
@@ -6026,10 +6037,10 @@ const Kr = {
6026
6037
  return { value: String(h.value), selectionStart: String(h.value).length };
6027
6038
  },
6028
6039
  [s, e, a]
6029
- ), d = _(
6040
+ ), d = Y(
6030
6041
  (h) => i.length > 1 ? (o((g) => g <= 0 ? i.length - 1 : g - 1), h.preventDefault(), !0) : !1,
6031
6042
  [i.length]
6032
- ), f = _(
6043
+ ), f = Y(
6033
6044
  (h) => i.length > 1 ? (o((g) => g >= i.length - 1 ? 0 : g + 1), h.preventDefault(), !0) : !1,
6034
6045
  [i.length]
6035
6046
  );
@@ -6046,12 +6057,12 @@ const Kr = {
6046
6057
  };
6047
6058
  }, Jc = () => {
6048
6059
  const [s, e] = ie(!1);
6049
- return j(() => {
6060
+ return K(() => {
6050
6061
  e(!0);
6051
6062
  }, []), s && typeof window < "u" ? { window, document } : { window: null, document: null };
6052
6063
  }, Gr = (s, e = 100) => {
6053
- const t = ae(s), n = ae();
6054
- return j(() => {
6064
+ const t = de(s), n = de();
6065
+ return K(() => {
6055
6066
  t.current = s;
6056
6067
  }, [s]), (...r) => {
6057
6068
  window.clearTimeout(n.current), n.current = window.setTimeout(() => {
@@ -6239,10 +6250,10 @@ const Jr = (s, e = " ") => {
6239
6250
  var Re;
6240
6251
  if (!a || !P || typeof document > "u" || S.current !== document.activeElement)
6241
6252
  return null;
6242
- const Y = (Re = S.current) == null ? void 0 : Re.getBoundingClientRect();
6243
- if (!Y)
6253
+ const _ = (Re = S.current) == null ? void 0 : Re.getBoundingClientRect();
6254
+ if (!_)
6244
6255
  return null;
6245
- const { bottom: ee, left: fe } = Y;
6256
+ const { bottom: ee, left: fe } = _;
6246
6257
  return tn(
6247
6258
  /* @__PURE__ */ O(Xe, { children: [
6248
6259
  he && N.length === 0 && (!d || d.endY === -1 && d.endX === -1) && /* @__PURE__ */ w(
@@ -6267,15 +6278,15 @@ const Jr = (s, e = " ") => {
6267
6278
  ] }),
6268
6279
  document.body
6269
6280
  );
6270
- }, x = R == null ? void 0 : R.getPolicy(c), E = (x == null ? void 0 : x.getSelectOptions()) ?? [], F = _((Y) => {
6271
- i(Y.currentTarget.selectionStart);
6281
+ }, x = R == null ? void 0 : R.getPolicy(c), E = (x == null ? void 0 : x.getSelectOptions()) ?? [], F = Y((_) => {
6282
+ i(_.currentTarget.selectionStart);
6272
6283
  }, []), {
6273
6284
  filteredOptions: N,
6274
6285
  selected: D,
6275
6286
  setSelected: $,
6276
- replaceWithOption: H,
6277
- handleArrowUp: Z,
6278
- handleArrowDown: ce,
6287
+ replaceWithOption: X,
6288
+ handleArrowUp: W,
6289
+ handleArrowDown: ae,
6279
6290
  activeFunctionHelp: he,
6280
6291
  activeArgIndex: B
6281
6292
  } = qr({
@@ -6284,34 +6295,34 @@ const Jr = (s, e = " ") => {
6284
6295
  optionsAll: E,
6285
6296
  functions: R == null ? void 0 : R.registry.functions
6286
6297
  });
6287
- j(() => {
6288
- X(S == null ? void 0 : S.current);
6289
- }, [S]), j(() => {
6298
+ K(() => {
6299
+ H(S == null ? void 0 : S.current);
6300
+ }, [S]), K(() => {
6290
6301
  R && R.registry.lastFocused != null && R.registry.lastFocused === S.current && R.registry.lastFocused === A.current && t(Se(""));
6291
- }, [R == null ? void 0 : R.registry.lastFocused, R, S, A, t]), j(() => {
6302
+ }, [R == null ? void 0 : R.registry.lastFocused, R, S, A, t]), K(() => {
6292
6303
  R && (R.registry.editingSheetId = T, R.registry.editingAddress = h);
6293
- }, [h, R, T]), j(() => {
6304
+ }, [h, R, T]), K(() => {
6294
6305
  ya(S.current);
6295
6306
  }, [u, h, S]);
6296
- const { y: K, x: W } = c, se = `${Ee(K)}`, Q = `${xe(W)}${se}`, P = h === Q, re = R == null ? void 0 : R.getCell({ y: K, x: W }, { resolution: "RAW" }), I = R ? R.getSerializedValue({ point: c, cell: re, resolution: "RAW" }) : "", [J, ve] = ie(I), le = _(
6297
- (Y) => {
6298
- J !== Y && t(Ct({ value: Y })), ve(Y);
6307
+ const { y: V, x: U } = c, se = `${Ee(V)}`, q = `${xe(U)}${se}`, P = h === q, ne = R == null ? void 0 : R.getCell({ y: V, x: U }, { resolution: "RAW" }), I = R ? R.getSerializedValue({ point: c, cell: ne, resolution: "RAW" }) : "", [J, ve] = ie(I), ce = Y(
6308
+ (_) => {
6309
+ J !== _ && t(Ct({ value: _ })), ve(_);
6299
6310
  },
6300
6311
  [J, t]
6301
- ), Le = _(
6302
- (Y) => {
6312
+ ), Le = Y(
6313
+ (_) => {
6303
6314
  if (!R)
6304
6315
  return;
6305
- const ee = N[Y];
6316
+ const ee = N[_];
6306
6317
  if (ee) {
6307
6318
  if (ee.isFunction) {
6308
- const { value: fe, selectionStart: Re } = H(ee);
6319
+ const { value: fe, selectionStart: Re } = X(ee);
6309
6320
  t(ge(fe)), setTimeout(() => {
6310
- S.current && (X(S.current), S.current.setSelectionRange(Re, Re));
6321
+ S.current && (H(S.current), S.current.setSelectionRange(Re, Re));
6311
6322
  }, 0);
6312
6323
  } else {
6313
6324
  const fe = R.update({
6314
- diff: { [Q]: { value: ee.value } },
6325
+ diff: { [q]: { value: ee.value } },
6315
6326
  partial: !0
6316
6327
  });
6317
6328
  t(lt(fe.clone())), t(Se("")), t(ge(""));
@@ -6319,33 +6330,33 @@ const Jr = (s, e = " ") => {
6319
6330
  $(0);
6320
6331
  }
6321
6332
  },
6322
- [N, R, Q, u, le, t, S]
6333
+ [N, R, q, u, ce, t, S]
6323
6334
  );
6324
- j(() => {
6335
+ K(() => {
6325
6336
  R && (ve(I), t(ge(I)), ba(S.current, R, c));
6326
6337
  }, [c, I, t, S, R]);
6327
6338
  const { y: Ve, x: ts, height: Fn, width: Dn } = f, yo = I.split(`
6328
- `).length, [Yn, _n] = ie(!1), bo = _(
6329
- (Y) => {
6339
+ `).length, [_n, Yn] = ie(!1), bo = Y(
6340
+ (_) => {
6330
6341
  var Re, Tt, st, It, Nt, Pn;
6331
- if (!R || Yn)
6342
+ if (!R || _n)
6332
6343
  return;
6333
- Y.key === "Meta" || Y.key === "Control" || (_n(!0), requestAnimationFrame(() => {
6334
- _n(!1);
6344
+ _.key === "Meta" || _.key === "Control" || (Yn(!0), requestAnimationFrame(() => {
6345
+ Yn(!1);
6335
6346
  }));
6336
- const ee = Y.currentTarget;
6337
- if (Hr(Y, u))
6347
+ const ee = _.currentTarget;
6348
+ if (Hr(_, u))
6338
6349
  return t(ge(ee.value)), !1;
6339
- const fe = Y.shiftKey;
6340
- switch (Y.key) {
6350
+ const fe = _.shiftKey;
6351
+ switch (_.key) {
6341
6352
  case "Tab":
6342
- if (Y.preventDefault(), P)
6353
+ if (_.preventDefault(), P)
6343
6354
  if (N.length) {
6344
6355
  const ze = (Re = N[D]) == null ? void 0 : Re.isFunction;
6345
6356
  if (Le(D), ze)
6346
6357
  return !1;
6347
6358
  } else
6348
- le(ee.value), t(Se("")), t(ge(""));
6359
+ ce(ee.value), t(Se("")), t(ge(""));
6349
6360
  return t(
6350
6361
  fs({
6351
6362
  numRows: R.numRows,
@@ -6359,18 +6370,18 @@ const Jr = (s, e = " ") => {
6359
6370
  if (N.length) {
6360
6371
  const ze = (Tt = N[D]) == null ? void 0 : Tt.isFunction;
6361
6372
  if (Le(D), ze)
6362
- return Y.preventDefault(), !1;
6373
+ return _.preventDefault(), !1;
6363
6374
  } else {
6364
- if (Y.altKey)
6375
+ if (_.altKey)
6365
6376
  return bt(ee, `
6366
- `), t(ge(ee.value)), Y.preventDefault(), !1;
6367
- if (Y.nativeEvent.isComposing)
6377
+ `), t(ge(ee.value)), _.preventDefault(), !1;
6378
+ if (_.nativeEvent.isComposing)
6368
6379
  return !1;
6369
- le(ee.value), t(Se("")), t(ge(""));
6380
+ ce(ee.value), t(Se("")), t(ge(""));
6370
6381
  }
6371
6382
  else if (k && d.endY === -1) {
6372
6383
  const ze = document.createEvent("MouseEvents");
6373
- return ze.initEvent("dblclick", !0, !0), ee.dispatchEvent(ze), Y.preventDefault(), !1;
6384
+ return ze.initEvent("dblclick", !0, !0), ee.dispatchEvent(ze), _.preventDefault(), !1;
6374
6385
  }
6375
6386
  return t(
6376
6387
  fs({
@@ -6379,14 +6390,14 @@ const Jr = (s, e = " ") => {
6379
6390
  deltaY: fe ? -1 : 1,
6380
6391
  deltaX: 0
6381
6392
  })
6382
- ), Y.preventDefault(), !1;
6393
+ ), _.preventDefault(), !1;
6383
6394
  case "Backspace":
6384
6395
  if (!P)
6385
- return ((st = R.getSystem({ y: K, x: W })) == null ? void 0 : st.spilledFrom) != null ? (Y.preventDefault(), !1) : (t(Ws(null)), t(ge("")), !1);
6396
+ return ((st = R.getSystem({ y: V, x: U })) == null ? void 0 : st.spilledFrom) != null ? (_.preventDefault(), !1) : (t(Ws(null)), t(ge("")), !1);
6386
6397
  break;
6387
6398
  case "Delete":
6388
6399
  if (!P)
6389
- return ((It = R.getSystem({ y: K, x: W })) == null ? void 0 : It.spilledFrom) != null ? (Y.preventDefault(), !1) : (t(Ws(null)), t(ge("")), !1);
6400
+ return ((It = R.getSystem({ y: V, x: U })) == null ? void 0 : It.spilledFrom) != null ? (_.preventDefault(), !1) : (t(Ws(null)), t(ge("")), !1);
6390
6401
  break;
6391
6402
  case "Shift":
6392
6403
  return r(!0), !1;
@@ -6423,7 +6434,7 @@ const Jr = (s, e = " ") => {
6423
6434
  deltaX: 0
6424
6435
  })
6425
6436
  ), !1;
6426
- if (Z(Y))
6437
+ if (W(_))
6427
6438
  return !0;
6428
6439
  break;
6429
6440
  case "ArrowRight":
@@ -6449,12 +6460,12 @@ const Jr = (s, e = " ") => {
6449
6460
  deltaX: 0
6450
6461
  })
6451
6462
  ), !1;
6452
- if (ce(Y))
6463
+ if (ae(_))
6453
6464
  return !0;
6454
6465
  break;
6455
6466
  case "a":
6456
- if ((Y.ctrlKey || Y.metaKey) && !P)
6457
- return Y.preventDefault(), t(
6467
+ if ((_.ctrlKey || _.metaKey) && !P)
6468
+ return _.preventDefault(), t(
6458
6469
  Pe({
6459
6470
  startY: 1,
6460
6471
  startX: 1,
@@ -6464,28 +6475,28 @@ const Jr = (s, e = " ") => {
6464
6475
  ), !1;
6465
6476
  break;
6466
6477
  case "c":
6467
- if (Y.ctrlKey || Y.metaKey) {
6478
+ if (_.ctrlKey || _.metaKey) {
6468
6479
  if (!P) {
6469
- Y.preventDefault();
6480
+ _.preventDefault();
6470
6481
  const ze = ms(e);
6471
- return t(dn($e(ze))), X(ee), !1;
6482
+ return t(dn($e(ze))), H(ee), !1;
6472
6483
  }
6473
6484
  return !0;
6474
6485
  }
6475
6486
  break;
6476
6487
  case "f":
6477
- if ((Y.ctrlKey || Y.metaKey) && !P)
6478
- return Y.preventDefault(), typeof b > "u" && t(mt("")), t(Nr(!1)), requestAnimationFrame(() => X(v.current)), !1;
6488
+ if ((_.ctrlKey || _.metaKey) && !P)
6489
+ return _.preventDefault(), typeof b > "u" && t(mt("")), t(Nr(!1)), requestAnimationFrame(() => H(v.current)), !1;
6479
6490
  break;
6480
6491
  case "r":
6481
6492
  // R
6482
6493
  case "y":
6483
- if ((Y.ctrlKey || Y.metaKey) && !P)
6484
- return Y.preventDefault(), t(hs(null)), requestAnimationFrame(() => t(ge(""))), !1;
6494
+ if ((_.ctrlKey || _.metaKey) && !P)
6495
+ return _.preventDefault(), t(hs(null)), requestAnimationFrame(() => t(ge(""))), !1;
6485
6496
  break;
6486
6497
  case "s":
6487
- if ((Y.ctrlKey || Y.metaKey) && !P)
6488
- return Y.preventDefault(), (Pn = (Nt = R.registry).onSave) == null || Pn.call(Nt, {
6498
+ if ((_.ctrlKey || _.metaKey) && !P)
6499
+ return _.preventDefault(), (Pn = (Nt = R.registry).onSave) == null || Pn.call(Nt, {
6489
6500
  sheet: R,
6490
6501
  points: {
6491
6502
  pointing: c,
@@ -6501,28 +6512,28 @@ const Jr = (s, e = " ") => {
6501
6512
  }), !1;
6502
6513
  break;
6503
6514
  case "v":
6504
- if (Y.ctrlKey || Y.metaKey)
6505
- return Y.stopPropagation(), !1;
6515
+ if (_.ctrlKey || _.metaKey)
6516
+ return _.stopPropagation(), !1;
6506
6517
  break;
6507
6518
  case "x":
6508
- if ((Y.ctrlKey || Y.metaKey) && !P) {
6509
- Y.preventDefault();
6519
+ if ((_.ctrlKey || _.metaKey) && !P) {
6520
+ _.preventDefault();
6510
6521
  const ze = ms(e);
6511
- return t(un($e(ze))), X(ee), !1;
6522
+ return t(un($e(ze))), H(ee), !1;
6512
6523
  }
6513
6524
  break;
6514
6525
  case "z":
6515
- if ((Y.ctrlKey || Y.metaKey) && !P)
6516
- return Y.preventDefault(), Y.shiftKey ? t(hs(null)) : t(hn(null)), !1;
6526
+ if ((_.ctrlKey || _.metaKey) && !P)
6527
+ return _.preventDefault(), _.shiftKey ? t(hs(null)) : t(hn(null)), !1;
6517
6528
  break;
6518
6529
  case ";":
6519
- (Y.ctrlKey || Y.metaKey) && (P || (Y.preventDefault(), le((/* @__PURE__ */ new Date()).toDateString())));
6530
+ (_.ctrlKey || _.metaKey) && (P || (_.preventDefault(), ce((/* @__PURE__ */ new Date()).toDateString())));
6520
6531
  break;
6521
6532
  }
6522
- return Y.ctrlKey || Y.metaKey ? !1 : L(re == null ? void 0 : re.prevention, Oe) ? (console.warn("This cell is protected from writing."), !1) : (t(Se(Q)), P || t(ge("")), $(0), !1);
6533
+ return _.ctrlKey || _.metaKey ? !1 : L(ne == null ? void 0 : ne.prevention, Oe) ? (console.warn("This cell is protected from writing."), !1) : (t(Se(q)), P || t(ge("")), $(0), !1);
6523
6534
  },
6524
6535
  [
6525
- Yn,
6536
+ _n,
6526
6537
  P,
6527
6538
  N,
6528
6539
  D,
@@ -6532,65 +6543,65 @@ const Jr = (s, e = " ") => {
6532
6543
  R,
6533
6544
  c,
6534
6545
  e,
6535
- re,
6536
- Q,
6537
- le,
6546
+ ne,
6547
+ q,
6548
+ ce,
6538
6549
  b,
6539
6550
  u
6540
6551
  ]
6541
- ), xo = _(
6542
- (Y) => {
6543
- l(!0), R && (R.registry.lastFocused = Y.currentTarget);
6552
+ ), xo = Y(
6553
+ (_) => {
6554
+ l(!0), R && (R.registry.lastFocused = _.currentTarget);
6544
6555
  },
6545
6556
  [R]
6546
- ), wo = _(
6547
- (Y) => {
6548
- if (L(re == null ? void 0 : re.prevention, Oe)) {
6557
+ ), wo = Y(
6558
+ (_) => {
6559
+ if (L(ne == null ? void 0 : ne.prevention, Oe)) {
6549
6560
  console.warn("This cell is protected from writing.");
6550
6561
  return;
6551
6562
  }
6552
- const ee = Y.currentTarget;
6553
- P || (t(ge(I)), t(Se(Q)), requestAnimationFrame(() => {
6563
+ const ee = _.currentTarget;
6564
+ P || (t(ge(I)), t(Se(q)), requestAnimationFrame(() => {
6554
6565
  ee.style.width = `${ee.scrollWidth}px`, ee.style.height = `${ee.scrollHeight}px`;
6555
6566
  const fe = new String(I).length;
6556
6567
  ee.setSelectionRange(fe, fe);
6557
6568
  }));
6558
6569
  },
6559
- [re, P, I, Q]
6560
- ), Ro = _(
6561
- (Y) => {
6562
- if (l(!1), Xr(Y.currentTarget))
6570
+ [ne, P, I, q]
6571
+ ), Ro = Y(
6572
+ (_) => {
6573
+ if (l(!1), Xr(_.currentTarget))
6563
6574
  return !0;
6564
- P && le(Y.currentTarget.value), t(Se(""));
6575
+ P && ce(_.currentTarget.value), t(Se(""));
6565
6576
  },
6566
- [P, le, t]
6567
- ), So = _(
6568
- (Y) => {
6569
- L(re == null ? void 0 : re.prevention, Oe) || (t(ge(Y.currentTarget.value)), $(0));
6577
+ [P, ce, t]
6578
+ ), So = Y(
6579
+ (_) => {
6580
+ L(ne == null ? void 0 : ne.prevention, Oe) || (t(ge(_.currentTarget.value)), $(0));
6570
6581
  },
6571
- [re]
6572
- ), vo = _(
6573
- (Y) => {
6582
+ [ne]
6583
+ ), vo = Y(
6584
+ (_) => {
6574
6585
  var Re, Tt, st, It;
6575
6586
  if (P)
6576
6587
  return !0;
6577
- const ee = n, fe = (Tt = (Re = Y.clipboardData) == null ? void 0 : Re.getData) == null ? void 0 : Tt.call(Re, "text/html");
6588
+ const ee = n, fe = (Tt = (Re = _.clipboardData) == null ? void 0 : Re.getData) == null ? void 0 : Tt.call(Re, "text/html");
6578
6589
  if (fe)
6579
6590
  t(us({ matrix: Qr(fe), onlyValue: ee }));
6580
6591
  else {
6581
- const Nt = (It = (st = Y.clipboardData) == null ? void 0 : st.getData) == null ? void 0 : It.call(st, "text/plain");
6592
+ const Nt = (It = (st = _.clipboardData) == null ? void 0 : st.getData) == null ? void 0 : It.call(st, "text/plain");
6582
6593
  Nt ? t(us({ matrix: Jr(Nt), onlyValue: ee })) : console.warn("No clipboard data found.");
6583
6594
  }
6584
- return Y.preventDefault(), Y.stopPropagation(), !1;
6595
+ return _.preventDefault(), _.stopPropagation(), !1;
6585
6596
  },
6586
6597
  [P, n]
6587
- ), Co = _(
6588
- (Y) => {
6598
+ ), Co = Y(
6599
+ (_) => {
6589
6600
  var fe, Re;
6590
6601
  r(!1);
6591
6602
  const ee = pe(e.selectingZone);
6592
6603
  (Re = R == null ? void 0 : (fe = R.registry).onKeyUp) == null || Re.call(fe, {
6593
- e: Y,
6604
+ e: _,
6594
6605
  points: {
6595
6606
  pointing: c,
6596
6607
  selectingFrom: { y: ee.top, x: ee.left },
@@ -6599,8 +6610,8 @@ const Jr = (s, e = " ") => {
6599
6610
  });
6600
6611
  },
6601
6612
  [e.selectingZone, c, R]
6602
- ), Eo = _(
6603
- (Y, ee) => (Le(ee), Y.preventDefault(), Y.stopPropagation(), !1),
6613
+ ), Eo = Y(
6614
+ (_, ee) => (Le(ee), _.preventDefault(), _.stopPropagation(), !1),
6604
6615
  [Le]
6605
6616
  );
6606
6617
  return R ? /* @__PURE__ */ O(
@@ -6611,7 +6622,7 @@ const Jr = (s, e = " ") => {
6611
6622
  "data-mode": s,
6612
6623
  "data-sheet-id": T,
6613
6624
  children: [
6614
- /* @__PURE__ */ w("div", { className: `gs-cell-label ${P ? " gs-hidden" : ""}`, children: Q }),
6625
+ /* @__PURE__ */ w("div", { className: `gs-cell-label ${P ? " gs-hidden" : ""}`, children: q }),
6615
6626
  /* @__PURE__ */ O("div", { className: "gs-editor-inner", style: { width: Dn }, children: [
6616
6627
  /* @__PURE__ */ w(
6617
6628
  "pre",
@@ -6622,7 +6633,7 @@ const Jr = (s, e = " ") => {
6622
6633
  height: ($n = S.current) == null ? void 0 : $n.scrollHeight,
6623
6634
  width: (((On = S.current) == null ? void 0 : On.scrollWidth) ?? 0) - 4
6624
6635
  },
6625
- children: (re == null ? void 0 : re.formulaEnabled) ?? !0 ? eo(u) : u
6636
+ children: (ne == null ? void 0 : ne.formulaEnabled) ?? !0 ? eo(u) : u
6626
6637
  }
6627
6638
  ),
6628
6639
  /* @__PURE__ */ w(
@@ -6673,7 +6684,7 @@ const Jr = (s, e = " ") => {
6673
6684
  "=",
6674
6685
  e.tokens.map((o, i) => {
6675
6686
  if (o.type === "SPACE")
6676
- return /* @__PURE__ */ w(Ys.Fragment, { children: o.stringify() }, `${r}-SPACE-${i}`);
6687
+ return /* @__PURE__ */ w(_s.Fragment, { children: o.stringify() }, `${r}-SPACE-${i}`);
6677
6688
  const a = `${r}-${o.type}-${o.stringify()}-${i}`;
6678
6689
  if (o.type === "REF" || o.type === "RANGE") {
6679
6690
  const l = o.stringify(), c = n[l];
@@ -6739,9 +6750,9 @@ const sl = ({
6739
6750
  mode: i
6740
6751
  }) => {
6741
6752
  const { store: a, dispatch: l } = ye(be), { sheetReactive: c } = a, u = c.current;
6742
- j(() => {
6753
+ K(() => {
6743
6754
  u && s && s !== u.name && (u.name = s, u.registry.sheetIdsByName[s] = u.id, delete u.registry.sheetIdsByName[u.prevName], u.prevName = s);
6744
- }, [s]), j(() => {
6755
+ }, [s]), K(() => {
6745
6756
  if (!u)
6746
6757
  return;
6747
6758
  const { registry: h } = u;
@@ -6753,21 +6764,21 @@ const sl = ({
6753
6764
  }), r && (r.current = {
6754
6765
  store: a,
6755
6766
  apply: (g) => {
6756
- l(_e(g));
6767
+ l(Ye(g));
6757
6768
  },
6758
6769
  dispatch: l
6759
6770
  });
6760
- }, [a, u, n, r]), j(() => {
6761
- e && l(_e({ sheetHeight: e }));
6762
- }, [e, l]), j(() => {
6763
- t && l(_e({ sheetWidth: t }));
6764
- }, [t]), j(() => {
6765
- typeof o < "u" && l(_e({ editingOnEnter: o }));
6766
- }, [o]), j(() => {
6767
- i && l(_e({ mode: i }));
6771
+ }, [a, u, n, r]), K(() => {
6772
+ e && l(Ye({ sheetHeight: e }));
6773
+ }, [e, l]), K(() => {
6774
+ t && l(Ye({ sheetWidth: t }));
6775
+ }, [t]), K(() => {
6776
+ typeof o < "u" && l(Ye({ editingOnEnter: o }));
6777
+ }, [o]), K(() => {
6778
+ i && l(Ye({ mode: i }));
6768
6779
  }, [i]);
6769
6780
  const [d, f] = so();
6770
- return j(() => {
6781
+ return K(() => {
6771
6782
  d && (f.setStore(a), f.setApply(() => l));
6772
6783
  }, [a, d, f]), /* @__PURE__ */ w(Xe, {});
6773
6784
  }, nl = () => {
@@ -6792,14 +6803,14 @@ const sl = ({
6792
6803
  const y = pe(a), { top: x, left: E, bottom: F, right: N } = y, D = {};
6793
6804
  if (g !== -1) {
6794
6805
  let $ = [g];
6795
- i && Je({ start: E, end: N }, g) && ($ = Zn(E, N + 1)), $.forEach((H) => {
6796
- D[G({ y: 0, x: H })] = { width: M };
6806
+ i && Je({ start: E, end: N }, g) && ($ = Zn(E, N + 1)), $.forEach((X) => {
6807
+ D[G({ y: 0, x: X })] = { width: M };
6797
6808
  });
6798
6809
  }
6799
6810
  if (d !== -1) {
6800
6811
  let $ = [d];
6801
- o && Je({ start: x, end: F }, d) && ($ = Zn(x, F + 1)), $.forEach((H) => {
6802
- D[G({ y: H, x: 0 })] = { height: T };
6812
+ o && Je({ start: x, end: F }, d) && ($ = Zn(x, F + 1)), $.forEach((X) => {
6813
+ D[G({ y: X, x: 0 })] = { height: T };
6803
6814
  });
6804
6815
  }
6805
6816
  u.update({
@@ -6808,10 +6819,10 @@ const sl = ({
6808
6819
  operator: "USER",
6809
6820
  undoReflection: { selectingZone: a, sheetId: u.id }
6810
6821
  }), e(
6811
- _e({
6822
+ Ye({
6812
6823
  sheetReactive: { current: u }
6813
6824
  })
6814
- ), e(Xs([-1, -1, -1])), e(Hs([-1, -1, -1])), X(l.current);
6825
+ ), e(Xs([-1, -1, -1])), e(Hs([-1, -1, -1])), H(l.current);
6815
6826
  },
6816
6827
  onMouseMove: (y) => {
6817
6828
  if (d !== -1) {
@@ -6838,7 +6849,7 @@ const sl = ({
6838
6849
  );
6839
6850
  }, rl = () => {
6840
6851
  const { store: s } = ye(be), { choosing: e, selectingZone: t, sheetReactive: n } = s, r = n.current;
6841
- return j(() => {
6852
+ return K(() => {
6842
6853
  r != null && r.isInitialized && r.currentVersion > 0 && r.registry.onChange && r.registry.onChange({
6843
6854
  sheet: r,
6844
6855
  points: {
@@ -6847,7 +6858,7 @@ const sl = ({
6847
6858
  selectingTo: { y: t.endY, x: t.endX }
6848
6859
  }
6849
6860
  });
6850
- }, [n]), j(() => {
6861
+ }, [n]), K(() => {
6851
6862
  r && r.registry.onSelect && r.registry.onSelect({
6852
6863
  sheet: r,
6853
6864
  points: {
@@ -6859,10 +6870,10 @@ const sl = ({
6859
6870
  }, [e, t]), null;
6860
6871
  }, no = async ({ store: s, dispatch: e }) => {
6861
6872
  const { editorRef: t } = s, n = ms(s);
6862
- e(dn($e(n))), X(t.current);
6873
+ e(dn($e(n))), H(t.current);
6863
6874
  }, ro = async ({ store: s, dispatch: e }) => {
6864
6875
  const { editorRef: t } = s, n = ms(s);
6865
- e(un($e(n))), X(t.current);
6876
+ e(un($e(n))), H(t.current);
6866
6877
  }, oo = async ({ store: s, dispatch: e }, t = !1) => {
6867
6878
  const { editorRef: n } = s, r = await navigator.clipboard.read();
6868
6879
  let o = [];
@@ -6882,56 +6893,56 @@ const sl = ({
6882
6893
  }
6883
6894
  }
6884
6895
  }
6885
- e(us({ matrix: o, onlyValue: t })), X(n.current);
6896
+ e(us({ matrix: o, onlyValue: t })), H(n.current);
6886
6897
  }, io = async ({ store: s, dispatch: e }) => {
6887
6898
  const { editorRef: t } = s;
6888
- e(hn(null)), X(t.current);
6899
+ e(hn(null)), H(t.current);
6889
6900
  }, ao = async ({ store: s, dispatch: e }) => {
6890
6901
  const { editorRef: t } = s;
6891
- e(hs(null)), X(t.current);
6902
+ e(hs(null)), H(t.current);
6892
6903
  }, ol = async ({ store: s, dispatch: e }) => {
6893
- const { selectingZone: t, editorRef: n } = s, { top: r } = pe(t), o = de(t).rows;
6894
- e(fn({ numRows: o, y: r, operator: "USER" })), X(n.current);
6904
+ const { selectingZone: t, editorRef: n } = s, { top: r } = pe(t), o = le(t).rows;
6905
+ e(fn({ numRows: o, y: r, operator: "USER" })), H(n.current);
6895
6906
  }, il = async ({ store: s, dispatch: e }) => {
6896
- const { selectingZone: t, editorRef: n } = s, { bottom: r } = pe(t), o = de(t).rows;
6897
- e(gn({ numRows: o, y: r, operator: "USER" })), X(n.current);
6907
+ const { selectingZone: t, editorRef: n } = s, { bottom: r } = pe(t), o = le(t).rows;
6908
+ e(gn({ numRows: o, y: r, operator: "USER" })), H(n.current);
6898
6909
  }, al = async ({ store: s, dispatch: e }) => {
6899
- const { selectingZone: t, editorRef: n } = s, { left: r } = pe(t), o = de(t).cols;
6900
- e(pn({ numCols: o, x: r, operator: "USER" })), X(n.current);
6910
+ const { selectingZone: t, editorRef: n } = s, { left: r } = pe(t), o = le(t).cols;
6911
+ e(pn({ numCols: o, x: r, operator: "USER" })), H(n.current);
6901
6912
  }, cl = async ({ store: s, dispatch: e }) => {
6902
- const { selectingZone: t, editorRef: n } = s, { right: r } = pe(t), o = de(t).cols;
6903
- e(mn({ numCols: o, x: r, operator: "USER" })), X(n.current);
6913
+ const { selectingZone: t, editorRef: n } = s, { right: r } = pe(t), o = le(t).cols;
6914
+ e(mn({ numCols: o, x: r, operator: "USER" })), H(n.current);
6904
6915
  }, ll = async ({ store: s, dispatch: e }) => {
6905
- const { selectingZone: t, editorRef: n } = s, { top: r } = pe(t), o = de(t).rows;
6906
- e(yn({ numRows: o, y: r, operator: "USER" })), X(n.current);
6916
+ const { selectingZone: t, editorRef: n } = s, { top: r } = pe(t), o = le(t).rows;
6917
+ e(yn({ numRows: o, y: r, operator: "USER" })), H(n.current);
6907
6918
  }, dl = async ({ store: s, dispatch: e }) => {
6908
- const { selectingZone: t, editorRef: n } = s, { left: r } = pe(t), o = de(t).cols;
6909
- e(bn({ numCols: o, x: r, operator: "USER" })), X(n.current);
6919
+ const { selectingZone: t, editorRef: n } = s, { left: r } = pe(t), o = le(t).cols;
6920
+ e(bn({ numCols: o, x: r, operator: "USER" })), H(n.current);
6910
6921
  }, co = async ({ store: s, dispatch: e }, t) => {
6911
6922
  const n = s.sheetReactive.current;
6912
- n && (n.hasPendingCells() || n.registry.asyncPending.size > 0) && await n.waitForPending(), e(ks({ x: t, direction: "asc" })), X(s.editorRef.current);
6923
+ n && (n.hasPendingCells() || n.registry.asyncPending.size > 0) && await n.waitForPending(), e(ks({ x: t, direction: "asc" })), H(s.editorRef.current);
6913
6924
  }, lo = async ({ store: s, dispatch: e }, t) => {
6914
6925
  const n = s.sheetReactive.current;
6915
- n && (n.hasPendingCells() || n.registry.asyncPending.size > 0) && await n.waitForPending(), e(ks({ x: t, direction: "desc" })), X(s.editorRef.current);
6926
+ n && (n.hasPendingCells() || n.registry.asyncPending.size > 0) && await n.waitForPending(), e(ks({ x: t, direction: "desc" })), H(s.editorRef.current);
6916
6927
  }, uo = async ({ store: s, dispatch: e }, t, n) => {
6917
6928
  const r = s.sheetReactive.current;
6918
- r && (r.hasPendingCells() || r.registry.asyncPending.size > 0) && await r.waitForPending(), e(at({ x: t, filter: n })), X(s.editorRef.current);
6929
+ r && (r.hasPendingCells() || r.registry.asyncPending.size > 0) && await r.waitForPending(), e(at({ x: t, filter: n })), H(s.editorRef.current);
6919
6930
  }, Js = async ({ store: s, dispatch: e }, t) => {
6920
- e(at({ x: t })), X(s.editorRef.current);
6931
+ e(at({ x: t })), H(s.editorRef.current);
6921
6932
  }, ho = ({ store: s, dispatch: e }, t) => {
6922
6933
  const n = s.sheetReactive.current;
6923
6934
  if (!n)
6924
6935
  return;
6925
6936
  const r = G({ y: t, x: 0 }), o = n.getCell({ y: t, x: 0 }, { resolution: "SYSTEM" }), i = !(o != null && o.sortFixed) || void 0;
6926
- n.update({ diff: { [r]: { sortFixed: i } }, partial: !0 }), e(lt(n)), X(s.editorRef.current);
6937
+ n.update({ diff: { [r]: { sortFixed: i } }, partial: !0 }), e(lt(n)), H(s.editorRef.current);
6927
6938
  }, fo = ({ store: s, dispatch: e }, t) => {
6928
6939
  const n = s.sheetReactive.current;
6929
6940
  if (!n)
6930
6941
  return;
6931
6942
  const r = G({ y: t, x: 0 }), o = n.getCell({ y: t, x: 0 }, { resolution: "SYSTEM" }), i = !(o != null && o.filterFixed) || void 0;
6932
- n.update({ diff: { [r]: { filterFixed: i } }, partial: !0 }), e(lt(n)), X(s.editorRef.current);
6943
+ n.update({ diff: { [r]: { filterFixed: i } }, partial: !0 }), e(lt(n)), H(s.editorRef.current);
6933
6944
  }, go = async ({ store: s, dispatch: e }) => {
6934
- typeof s.searchQuery > "u" && e(mt("")), e(Nr(!1)), requestAnimationFrame(() => X(s.searchInputRef.current));
6945
+ typeof s.searchQuery > "u" && e(mt("")), e(Nr(!1)), requestAnimationFrame(() => H(s.searchInputRef.current));
6935
6946
  }, Sd = {
6936
6947
  copy: no,
6937
6948
  cut: ro,
@@ -6986,80 +6997,80 @@ const sl = ({
6986
6997
  {
6987
6998
  id: "insert-rows-above",
6988
6999
  label: (s) => {
6989
- const e = de(s.selectingZone).rows;
7000
+ const e = le(s.selectingZone).rows;
6990
7001
  return `Insert ${e} row${e > 1 ? "s" : ""} above`;
6991
7002
  },
6992
7003
  visible: (s) => s.leftHeaderSelecting,
6993
7004
  disabled: (s) => {
6994
- const e = de(s.selectingZone).rows, t = s.sheet, n = t.getCell({ y: s.choosing.y, x: 0 }, { resolution: "SYSTEM" });
7005
+ const e = le(s.selectingZone).rows, t = s.sheet, n = t.getCell({ y: s.choosing.y, x: 0 }, { resolution: "SYSTEM" });
6995
7006
  return t.maxNumRows !== -1 && t.numRows + e > t.maxNumRows || L(n == null ? void 0 : n.prevention, jt);
6996
7007
  },
6997
- onClick: (s) => s.insertRowsAbove(s.choosing.y, de(s.selectingZone).rows)
7008
+ onClick: (s) => s.insertRowsAbove(s.choosing.y, le(s.selectingZone).rows)
6998
7009
  },
6999
7010
  {
7000
7011
  id: "insert-rows-below",
7001
7012
  label: (s) => {
7002
- const e = de(s.selectingZone).rows;
7013
+ const e = le(s.selectingZone).rows;
7003
7014
  return `Insert ${e} row${e > 1 ? "s" : ""} below`;
7004
7015
  },
7005
7016
  visible: (s) => s.leftHeaderSelecting,
7006
7017
  disabled: (s) => {
7007
- const e = de(s.selectingZone).rows, t = s.sheet, n = t.getCell({ y: s.choosing.y, x: 0 }, { resolution: "SYSTEM" });
7018
+ const e = le(s.selectingZone).rows, t = s.sheet, n = t.getCell({ y: s.choosing.y, x: 0 }, { resolution: "SYSTEM" });
7008
7019
  return t.maxNumRows !== -1 && t.numRows + e > t.maxNumRows || L(n == null ? void 0 : n.prevention, Kt);
7009
7020
  },
7010
- onClick: (s) => s.insertRowsBelow(s.choosing.y, de(s.selectingZone).rows)
7021
+ onClick: (s) => s.insertRowsBelow(s.choosing.y, le(s.selectingZone).rows)
7011
7022
  },
7012
7023
  {
7013
7024
  id: "insert-cols-left",
7014
7025
  label: (s) => {
7015
- const e = de(s.selectingZone).cols;
7026
+ const e = le(s.selectingZone).cols;
7016
7027
  return `Insert ${e} column${e > 1 ? "s" : ""} left`;
7017
7028
  },
7018
7029
  visible: (s) => s.topHeaderSelecting,
7019
7030
  disabled: (s) => {
7020
- const e = de(s.selectingZone).cols, t = s.sheet, n = t.getCell({ y: 0, x: s.choosing.x }, { resolution: "SYSTEM" });
7031
+ const e = le(s.selectingZone).cols, t = s.sheet, n = t.getCell({ y: 0, x: s.choosing.x }, { resolution: "SYSTEM" });
7021
7032
  return t.maxNumCols !== -1 && t.numCols + e > t.maxNumCols || L(n == null ? void 0 : n.prevention, qt);
7022
7033
  },
7023
- onClick: (s) => s.insertColsLeft(s.choosing.x, de(s.selectingZone).cols)
7034
+ onClick: (s) => s.insertColsLeft(s.choosing.x, le(s.selectingZone).cols)
7024
7035
  },
7025
7036
  {
7026
7037
  id: "insert-cols-right",
7027
7038
  label: (s) => {
7028
- const e = de(s.selectingZone).cols;
7039
+ const e = le(s.selectingZone).cols;
7029
7040
  return `Insert ${e} column${e > 1 ? "s" : ""} right`;
7030
7041
  },
7031
7042
  visible: (s) => s.topHeaderSelecting,
7032
7043
  disabled: (s) => {
7033
- const e = de(s.selectingZone).cols, t = s.sheet, n = t.getCell({ y: 0, x: s.choosing.x }, { resolution: "SYSTEM" });
7044
+ const e = le(s.selectingZone).cols, t = s.sheet, n = t.getCell({ y: 0, x: s.choosing.x }, { resolution: "SYSTEM" });
7034
7045
  return t.maxNumCols !== -1 && t.numCols + e > t.maxNumCols || L(n == null ? void 0 : n.prevention, Gt);
7035
7046
  },
7036
- onClick: (s) => s.insertColsRight(s.choosing.x, de(s.selectingZone).cols)
7047
+ onClick: (s) => s.insertColsRight(s.choosing.x, le(s.selectingZone).cols)
7037
7048
  },
7038
7049
  {
7039
7050
  id: "remove-rows",
7040
7051
  label: (s) => {
7041
- const e = de(s.selectingZone).rows;
7052
+ const e = le(s.selectingZone).rows;
7042
7053
  return `Remove ${e} row${e > 1 ? "s" : ""}`;
7043
7054
  },
7044
7055
  visible: (s) => s.leftHeaderSelecting,
7045
7056
  disabled: (s) => {
7046
- const e = de(s.selectingZone).rows, t = s.sheet, n = t.getCell({ y: s.choosing.y, x: 0 }, { resolution: "SYSTEM" });
7057
+ const e = le(s.selectingZone).rows, t = s.sheet, n = t.getCell({ y: s.choosing.y, x: 0 }, { resolution: "SYSTEM" });
7047
7058
  return t.minNumRows !== -1 && t.numRows - e < t.minNumRows || L(n == null ? void 0 : n.prevention, Rt);
7048
7059
  },
7049
- onClick: (s) => s.removeRows(s.choosing.y, de(s.selectingZone).rows)
7060
+ onClick: (s) => s.removeRows(s.choosing.y, le(s.selectingZone).rows)
7050
7061
  },
7051
7062
  {
7052
7063
  id: "remove-cols",
7053
7064
  label: (s) => {
7054
- const e = de(s.selectingZone).cols;
7065
+ const e = le(s.selectingZone).cols;
7055
7066
  return `Remove ${e} column${e > 1 ? "s" : ""}`;
7056
7067
  },
7057
7068
  visible: (s) => s.topHeaderSelecting,
7058
7069
  disabled: (s) => {
7059
- const e = de(s.selectingZone).cols, t = s.sheet, n = t.getCell({ y: 0, x: s.choosing.x }, { resolution: "SYSTEM" });
7070
+ const e = le(s.selectingZone).cols, t = s.sheet, n = t.getCell({ y: 0, x: s.choosing.x }, { resolution: "SYSTEM" });
7060
7071
  return t.minNumCols !== -1 && t.numCols - e < t.minNumCols || L(n == null ? void 0 : n.prevention, St);
7061
7072
  },
7062
- onClick: (s) => s.removeCols(s.choosing.x, de(s.selectingZone).cols)
7073
+ onClick: (s) => s.removeCols(s.choosing.x, le(s.selectingZone).cols)
7063
7074
  },
7064
7075
  { type: "divider" },
7065
7076
  {
@@ -7305,7 +7316,7 @@ function kn(s, e, t) {
7305
7316
  selectingZone: s.selectingZone,
7306
7317
  choosing: s.choosing
7307
7318
  }
7308
- }), e(_e({ sheetReactive: { current: r } }));
7319
+ }), e(Ye({ sheetReactive: { current: r } }));
7309
7320
  },
7310
7321
  close: t
7311
7322
  };
@@ -7351,7 +7362,7 @@ const Tn = ({
7351
7362
  }
7352
7363
  );
7353
7364
  }, In = () => /* @__PURE__ */ w("li", { className: "gs-menu-divider" }), pl = () => {
7354
- const { store: s, dispatch: e } = ye(be), { contextMenuPosition: t, contextMenu: n } = s, { y: r, x: o } = t, i = ae(null);
7365
+ const { store: s, dispatch: e } = ye(be), { contextMenuPosition: t, contextMenu: n } = s, { y: r, x: o } = t, i = de(null);
7355
7366
  if (is(() => {
7356
7367
  i.current && Fr(i.current);
7357
7368
  }), r === -1)
@@ -7396,25 +7407,25 @@ const Tn = ({
7396
7407
  includes: "Includes",
7397
7408
  excludes: "Excludes"
7398
7409
  }, cr = ["blank", "nonblank"], ns = { method: "eq", value: [""] }, ml = ({ x: s, close: e, onWaiting: t }) => {
7399
- const { store: n, dispatch: r } = ye(be), { sheetReactive: o } = n, i = o.current, [a, l] = ie([{ ...ns }]), [c, u] = ie("or"), [d, f] = ie(null), h = _(
7410
+ const { store: n, dispatch: r } = ye(be), { sheetReactive: o } = n, i = o.current, [a, l] = ie([{ ...ns }]), [c, u] = ie("or"), [d, f] = ie(null), h = Y(
7400
7411
  (C) => {
7401
7412
  C && C.focus();
7402
7413
  },
7403
7414
  // eslint-disable-next-line react-hooks/exhaustive-deps
7404
7415
  [s]
7405
7416
  );
7406
- j(() => {
7417
+ K(() => {
7407
7418
  if (i) {
7408
7419
  const C = i.getCell({ y: 0, x: s }, { resolution: "SYSTEM" }), R = C == null ? void 0 : C.filter;
7409
7420
  R && R.conditions.length > 0 ? (l(R.conditions.map((y) => ({ ...y, value: [...y.value] }))), u(R.mode || "or")) : (l([{ ...ns, value: [""] }]), u("or"));
7410
7421
  }
7411
7422
  }, [s, i]);
7412
- const g = _(() => {
7423
+ const g = Y(() => {
7413
7424
  f(null), t == null || t(null), e();
7414
7425
  }, [e, t]);
7415
- j(() => {
7426
+ K(() => {
7416
7427
  d && (t == null || t("Filtering…", g));
7417
- }, [d]), j(() => {
7428
+ }, [d]), K(() => {
7418
7429
  if (!d)
7419
7430
  return;
7420
7431
  let C = !1;
@@ -7428,21 +7439,21 @@ const Tn = ({
7428
7439
  C = !0;
7429
7440
  };
7430
7441
  }, [d]);
7431
- const p = _((C, R) => {
7442
+ const p = Y((C, R) => {
7432
7443
  l((y) => {
7433
7444
  const x = [...y];
7434
7445
  return x[C] = { ...x[C], ...R }, x;
7435
7446
  });
7436
- }, []), m = _(() => {
7447
+ }, []), m = Y(() => {
7437
7448
  l((C) => [...C, { ...ns, value: [""] }]);
7438
- }, []), b = _((C) => {
7449
+ }, []), b = Y((C) => {
7439
7450
  l((R) => R.length <= 1 ? [{ ...ns, value: [""] }] : R.filter((y, x) => x !== C));
7440
- }, []), S = _(() => {
7451
+ }, []), S = Y(() => {
7441
7452
  const C = a.filter((R) => cr.includes(R.method) ? !0 : R.value.some((y) => y.trim() !== ""));
7442
7453
  f({ x: s, conditions: C, mode: c });
7443
- }, [s, a, c]), A = _(() => {
7454
+ }, [s, a, c]), A = Y(() => {
7444
7455
  f(null), r(at({ x: s })), e();
7445
- }, [r, s, e]), v = _(() => {
7456
+ }, [r, s, e]), v = Y(() => {
7446
7457
  f(null), r(at({})), e();
7447
7458
  }, [r, e]);
7448
7459
  if (!i)
@@ -7531,12 +7542,12 @@ const Tn = ({
7531
7542
  };
7532
7543
  An("col-filter", ml);
7533
7544
  const yl = ({ x: s, close: e, onWaiting: t }) => {
7534
- const { store: n, dispatch: r } = ye(be), { sheetReactive: o } = n, i = o.current, [a, l] = ie(null), c = _(() => {
7545
+ const { store: n, dispatch: r } = ye(be), { sheetReactive: o } = n, i = o.current, [a, l] = ie(null), c = Y(() => {
7535
7546
  l(null), t == null || t(null), e();
7536
7547
  }, [e, t]);
7537
- if (j(() => {
7548
+ if (K(() => {
7538
7549
  a && (t == null || t("Sorting…", c));
7539
- }, [a]), j(() => {
7550
+ }, [a]), K(() => {
7540
7551
  if (!a)
7541
7552
  return;
7542
7553
  let f = !1;
@@ -7584,14 +7595,14 @@ const Nn = (s, e, t, n) => {
7584
7595
  const r = s.getPolicy(t);
7585
7596
  return (t.x === 0 ? r.renderRowHeaderLabel(n) : r.renderColHeaderLabel(n)) ?? null;
7586
7597
  }, bl = ({ x: s, close: e }) => {
7587
- const { store: t, dispatch: n } = ye(be), { sheetReactive: r } = t, o = r.current, i = ae(null), [a, l] = ie("");
7588
- j(() => {
7598
+ const { store: t, dispatch: n } = ye(be), { sheetReactive: r } = t, o = r.current, i = de(null), [a, l] = ie("");
7599
+ K(() => {
7589
7600
  if (o) {
7590
7601
  const h = o.getCell({ y: 0, x: s }, { resolution: "SYSTEM" });
7591
7602
  l((h == null ? void 0 : h.label) ?? "");
7592
7603
  }
7593
7604
  }, [s, o]);
7594
- const c = _(() => {
7605
+ const c = Y(() => {
7595
7606
  if (!o)
7596
7607
  return;
7597
7608
  const h = G({ y: 0, x: s });
@@ -7609,7 +7620,7 @@ const Nn = (s, e, t, n) => {
7609
7620
  selectingZone: t.selectingZone,
7610
7621
  choosing: t.choosing
7611
7622
  }
7612
- }), n(_e({ sheetReactive: { current: o } })), e();
7623
+ }), n(Ye({ sheetReactive: { current: o } })), e();
7613
7624
  }, [n, s, a, e, o, t.selectingZone, t.choosing]);
7614
7625
  if (!o)
7615
7626
  return null;
@@ -7636,9 +7647,9 @@ const Nn = (s, e, t, n) => {
7636
7647
  };
7637
7648
  An("col-label", bl);
7638
7649
  const xl = () => {
7639
- const { store: s, dispatch: e } = ye(be), { columnMenuState: t, editorRef: n, colMenu: r } = s, o = s.sheetReactive.current, i = t == null ? void 0 : t.x, a = t == null ? void 0 : t.position, [l, c] = ie(null), u = _(() => {
7640
- e(gs(null)), X(n.current);
7641
- }, [e, n]), d = _(
7650
+ const { store: s, dispatch: e } = ye(be), { columnMenuState: t, editorRef: n, colMenu: r } = s, o = s.sheetReactive.current, i = t == null ? void 0 : t.x, a = t == null ? void 0 : t.position, [l, c] = ie(null), u = Y(() => {
7651
+ e(gs(null)), H(n.current);
7652
+ }, [e, n]), d = Y(
7642
7653
  (h, g) => {
7643
7654
  c(h ? { message: h, cancel: g ?? u } : null);
7644
7655
  },
@@ -7729,7 +7740,7 @@ function wl(s, e, t, n, r) {
7729
7740
  }
7730
7741
  const Rl = () => {
7731
7742
  const { store: s, dispatch: e } = ye(be), { rowMenuState: t, sheetReactive: n, editorRef: r, rowMenu: o } = s, i = n.current, a = t == null ? void 0 : t.y, l = t == null ? void 0 : t.position, c = () => {
7732
- e(Vs(null)), X(r.current);
7743
+ e(Vs(null)), H(r.current);
7733
7744
  };
7734
7745
  if (!t || !i || a == null || !l)
7735
7746
  return null;
@@ -7753,7 +7764,7 @@ const Rl = () => {
7753
7764
  }, Ce = (s) => {
7754
7765
  s.type.startsWith("touch") || s.preventDefault();
7755
7766
  }, Sl = ws(({ y: s, x: e }) => {
7756
- const t = Ee(s), r = `${xe(e)}${t}`, { store: o, dispatch: i } = ye(be), a = ae(!0), l = ae(null), [c, u] = ie(null), {
7767
+ const t = Ee(s), r = `${xe(e)}${t}`, { store: o, dispatch: i } = ye(be), a = de(!0), l = de(null), [c, u] = ie(null), {
7757
7768
  sheetReactive: d,
7758
7769
  editingAddress: f,
7759
7770
  choosing: h,
@@ -7763,7 +7774,7 @@ const Rl = () => {
7763
7774
  editorRef: b,
7764
7775
  autofillDraggingTo: S,
7765
7776
  contextMenu: A
7766
- } = o, v = d.current, k = Ss(o), M = v == null ? void 0 : v.registry.lastFocused, T = pe(g), C = f === r, R = h.y === s && h.x === e, y = _(() => {
7777
+ } = o, v = d.current, k = Ss(o), M = v == null ? void 0 : v.registry.lastFocused, T = pe(g), C = f === r, R = h.y === s && h.x === e, y = Y(() => {
7767
7778
  var J;
7768
7779
  const I = (J = l.current) == null ? void 0 : J.getBoundingClientRect();
7769
7780
  if (I == null)
@@ -7777,21 +7788,21 @@ const Rl = () => {
7777
7788
  })
7778
7789
  );
7779
7790
  }, [i]);
7780
- j(() => {
7791
+ K(() => {
7781
7792
  if (R && !a.current) {
7782
7793
  y();
7783
7794
  return;
7784
7795
  }
7785
7796
  a.current = !1;
7786
7797
  }, [R, C, y]);
7787
- const x = v == null ? void 0 : v.getCell({ y: s, x: e }, { resolution: "SYSTEM" }), E = _(
7798
+ const x = v == null ? void 0 : v.getCell({ y: s, x: e }, { resolution: "SYSTEM" }), E = Y(
7788
7799
  (I) => {
7789
7800
  i(Ct({ value: I }));
7790
7801
  },
7791
7802
  [i]
7792
- ), F = _(
7803
+ ), F = Y(
7793
7804
  (I) => {
7794
- i(_e({ sheetReactive: { current: I.__raw__ } }));
7805
+ i(Ye({ sheetReactive: { current: I.__raw__ } }));
7795
7806
  },
7796
7807
  [i]
7797
7808
  );
@@ -7799,29 +7810,29 @@ const Rl = () => {
7799
7810
  try {
7800
7811
  v && (D = v.render({ sheet: v, point: { y: s, x: e }, apply: F, value: void 0 }));
7801
7812
  } catch (I) {
7802
- U.is(I) ? (N = I.message, D = I.code) : (N = I.message, D = "#UNKNOWN");
7813
+ Z.is(I) ? (N = I.message, D = I.code) : (N = I.message, D = "#UNKNOWN");
7803
7814
  }
7804
- const [, $] = (v == null ? void 0 : v.getSolvedCache({ y: s, x: e })) ?? [void 0, void 0], H = we.is($), Z = b.current, ce = !!(v != null && v.registry.editingAddress || f), he = _(
7815
+ const [, $] = (v == null ? void 0 : v.getSolvedCache({ y: s, x: e })) ?? [void 0, void 0], X = we.is($), W = b.current, ae = !!(v != null && v.registry.editingAddress || f), he = Y(
7805
7816
  (I) => {
7806
- if (I.stopPropagation(), Ce(I), !v || !wt(I) || !Z)
7817
+ if (I.stopPropagation(), Ce(I), !v || !wt(I) || !W)
7807
7818
  return !1;
7808
7819
  if (I.type.startsWith("touch"))
7809
- return ce && Z && Z.blur(), i(ct({ y: s, x: e })), i(Pe({ startY: s, startX: e, endY: s, endX: e })), !0;
7820
+ return ae && W && W.blur(), i(ct({ y: s, x: e })), i(Pe({ startY: s, startX: e, endY: s, endX: e })), !0;
7810
7821
  I.shiftKey ? i(De({ y: s, x: e })) : i(Pe({ startY: s, startX: e, endY: -1, endX: -1 })), i(qe(!0));
7811
7822
  const J = `${v.sheetPrefix(!k)}${r}`;
7812
- return ce && et({ input: M || null, ref: J }) || (v.registry.lastFocused = Z, X(Z), i(Se("")), S) ? !1 : (ce && E(Z.value), I.shiftKey || i(ct({ y: s, x: e })), !0);
7823
+ return ae && et({ input: M || null, ref: J }) || (v.registry.lastFocused = W, H(W), i(Se("")), S) ? !1 : (ae && E(W.value), I.shiftKey || i(ct({ y: s, x: e })), !0);
7813
7824
  },
7814
- [ce, Z, r, k, M, S, E, v]
7815
- ), B = _(
7825
+ [ae, W, r, k, M, S, E, v]
7826
+ ), B = Y(
7816
7827
  (I) => {
7817
7828
  if (I.stopPropagation(), !I.type.startsWith("touch")) {
7818
7829
  if (Ce(I), i(qe(!1)), S)
7819
- return i(Ir(S)), X(Z), !1;
7820
- ce && i(De({ y: -1, x: -1 }));
7830
+ return i(Ir(S)), H(W), !1;
7831
+ ae && i(De({ y: -1, x: -1 }));
7821
7832
  }
7822
7833
  },
7823
- [S, ce, Z]
7824
- ), K = _(
7834
+ [S, ae, W]
7835
+ ), V = Y(
7825
7836
  (I) => {
7826
7837
  if (!wt(I) || I.type.startsWith("touch") || !v)
7827
7838
  return !1;
@@ -7831,9 +7842,9 @@ const Rl = () => {
7831
7842
  return i(De({ y: s, x: v.numCols })), !1;
7832
7843
  if (m)
7833
7844
  return i(De({ y: v.numRows, x: e })), !1;
7834
- if (ce && !Xr(M || null))
7845
+ if (ae && !Xr(M || null))
7835
7846
  return !1;
7836
- if (i(De({ y: s, x: e })), ce) {
7847
+ if (i(De({ y: s, x: e })), ae) {
7837
7848
  const J = pe({ ...g, endY: s, endX: e }), ve = `${v.sheetPrefix(!k)}${mr(J)}`;
7838
7849
  et({ input: M || null, ref: ve });
7839
7850
  }
@@ -7844,45 +7855,45 @@ const Rl = () => {
7844
7855
  p,
7845
7856
  m,
7846
7857
  v,
7847
- ce,
7858
+ ae,
7848
7859
  M,
7849
7860
  g,
7850
7861
  k
7851
7862
  ]
7852
- ), W = _(
7863
+ ), U = Y(
7853
7864
  (I) => {
7854
7865
  i(Ut({ x: e, y: s })), i(qe(!0)), I.stopPropagation();
7855
7866
  },
7856
7867
  [i, e, s]
7857
- ), se = _(() => {
7868
+ ), se = Y(() => {
7858
7869
  var J;
7859
7870
  const I = (J = l.current) == null ? void 0 : J.getBoundingClientRect();
7860
7871
  I && u(ji(I));
7861
- }, []), q = _(() => {
7872
+ }, []), Q = Y(() => {
7862
7873
  u(null);
7863
- }, []), Q = _(
7874
+ }, []), q = Y(
7864
7875
  (I) => A.length > 0 ? (I.stopPropagation(), Ce(I), i(Jt({ y: I.clientY, x: I.clientX })), !1) : !0,
7865
7876
  [A.length]
7866
- ), P = _(
7877
+ ), P = Y(
7867
7878
  (I) => {
7868
7879
  I.stopPropagation(), Ce(I), Se(r);
7869
7880
  const J = document.createEvent("MouseEvents");
7870
- return J.initEvent("dblclick", !0, !0), Z == null || Z.dispatchEvent(J), !1;
7881
+ return J.initEvent("dblclick", !0, !0), W == null || W.dispatchEvent(J), !1;
7871
7882
  },
7872
- [r, Z]
7873
- ), re = pt(() => !C && R && T.bottom === -1 || T.bottom === s && T.right === e ? "gs-autofill-drag" : "gs-autofill-drag gs-hidden", [C, R, T]);
7874
- return v ? Z ? /* @__PURE__ */ w(
7883
+ [r, W]
7884
+ ), ne = pt(() => !C && R && T.bottom === -1 || T.bottom === s && T.right === e ? "gs-autofill-drag" : "gs-autofill-drag gs-hidden", [C, R, T]);
7885
+ return v ? W ? /* @__PURE__ */ w(
7875
7886
  "td",
7876
7887
  {
7877
7888
  ref: l,
7878
7889
  "data-x": e,
7879
7890
  "data-y": s,
7880
7891
  "data-address": r,
7881
- className: `gs-cell ${Lo(T, { y: s, x: e }) ? "gs-selecting" : ""} ${R ? "gs-choosing" : ""} ${C ? "gs-editing" : ""} ${H ? "gs-pending" : ""}`,
7892
+ className: `gs-cell ${Lo(T, { y: s, x: e }) ? "gs-selecting" : ""} ${R ? "gs-choosing" : ""} ${C ? "gs-editing" : ""} ${X ? "gs-pending" : ""}`,
7882
7893
  style: {
7883
7894
  ...x == null ? void 0 : x.style
7884
7895
  },
7885
- onContextMenu: Q,
7896
+ onContextMenu: q,
7886
7897
  onDoubleClick: P,
7887
7898
  children: /* @__PURE__ */ O(
7888
7899
  "div",
@@ -7890,7 +7901,7 @@ const Rl = () => {
7890
7901
  className: "gs-cell-inner-wrap",
7891
7902
  onMouseDown: he,
7892
7903
  onTouchStart: he,
7893
- onMouseEnter: K,
7904
+ onMouseEnter: V,
7894
7905
  onMouseUp: B,
7895
7906
  children: [
7896
7907
  /* @__PURE__ */ O(
@@ -7908,7 +7919,7 @@ const Rl = () => {
7908
7919
  {
7909
7920
  className: "gs-formula-error-triangle",
7910
7921
  onMouseEnter: se,
7911
- onMouseLeave: q
7922
+ onMouseLeave: Q
7912
7923
  }
7913
7924
  ),
7914
7925
  /* @__PURE__ */ w("div", { className: "gs-cell-rendered", children: D })
@@ -7927,7 +7938,7 @@ const Rl = () => {
7927
7938
  children: N
7928
7939
  }
7929
7940
  ),
7930
- /* @__PURE__ */ w("div", { className: re, onMouseDown: W })
7941
+ /* @__PURE__ */ w("div", { className: ne, onMouseDown: U })
7931
7942
  ]
7932
7943
  }
7933
7944
  )
@@ -7938,9 +7949,9 @@ const Rl = () => {
7938
7949
  /* @__PURE__ */ w("div", { className: "gs-autofill-drag" })
7939
7950
  ] }) }, e) : null;
7940
7951
  }), vl = 0.4, Cl = 200;
7941
- let lr = (/* @__PURE__ */ new Date()).getTime(), Yt = 0;
7952
+ let lr = (/* @__PURE__ */ new Date()).getTime(), _t = 0;
7942
7953
  function Qe({ style: s, horizontal: e = 0, vertical: t = 0, className: n = "" }) {
7943
- const r = ae(null), { store: o, dispatch: i } = ye(be), {
7954
+ const r = de(null), { store: o, dispatch: i } = ye(be), {
7944
7955
  tabularRef: a,
7945
7956
  autofillDraggingTo: l,
7946
7957
  dragging: c,
@@ -7951,40 +7962,40 @@ function Qe({ style: s, horizontal: e = 0, vertical: t = 0, className: n = "" })
7951
7962
  editingAddress: g
7952
7963
  } = o, p = f.current;
7953
7964
  let m = !1;
7954
- const b = Ss(o), S = !!(p != null && p.registry.editingAddress || g), A = _(
7965
+ const b = Ss(o), S = !!(p != null && p.registry.editingAddress || g), A = Y(
7955
7966
  (y) => {
7956
7967
  if (!p)
7957
7968
  return { x: -1, y: -1 };
7958
7969
  if (e == 0 && t == 0) {
7959
- const N = a.current.getBoundingClientRect(), { left: D, top: $, right: H, bottom: Z } = N;
7960
- e = y.pageX > H ? 1 : y.pageX < D ? -1 : 0, e === 0 && (t = y.pageY > Z ? 1 : y.pageY < $ ? -1 : 0);
7970
+ const N = a.current.getBoundingClientRect(), { left: D, top: $, right: X, bottom: W } = N;
7971
+ e = y.pageX > X ? 1 : y.pageX < D ? -1 : 0, e === 0 && (t = y.pageY > W ? 1 : y.pageY < $ ? -1 : 0);
7961
7972
  }
7962
7973
  const x = Kn(a.current);
7963
7974
  let { endX: E, endY: F } = u;
7964
7975
  return e ? E = e > 0 ? x.right : x.left : t && (F = t > 0 ? x.bottom : x.top), { x: E, y: F };
7965
7976
  },
7966
7977
  [p, e, t, u]
7967
- ), v = _(
7978
+ ), v = Y(
7968
7979
  (y) => {
7969
7980
  if (!m || a.current === null || !p)
7970
7981
  return;
7971
7982
  const x = (/* @__PURE__ */ new Date()).getTime();
7972
- x - lr > 1e3 && (Yt = 0), lr = x, a.current.scrollBy({
7973
- left: Yt * e,
7974
- top: Yt * t
7975
- }), X(d.current);
7983
+ x - lr > 1e3 && (_t = 0), lr = x, a.current.scrollBy({
7984
+ left: _t * e,
7985
+ top: _t * t
7986
+ }), H(d.current);
7976
7987
  const { x: E, y: F } = A(y);
7977
7988
  if (l) {
7978
7989
  const { y: N, x: D } = l;
7979
7990
  i(Ut({ y: F === -1 ? N : F, x: E === -1 ? D : E }));
7980
7991
  } else {
7981
7992
  if (S) {
7982
- const N = pe({ ...u, endY: F, endX: E }), D = p.sheetPrefix(!b), $ = mr(N), H = `${D}${$}`;
7983
- et({ input: d.current, ref: H });
7993
+ const N = pe({ ...u, endY: F, endX: E }), D = p.sheetPrefix(!b), $ = mr(N), X = `${D}${$}`;
7994
+ et({ input: d.current, ref: X });
7984
7995
  }
7985
7996
  i(De({ y: F, x: E }));
7986
7997
  }
7987
- Yt = Math.min(Yt + vl, Cl), r.current = requestAnimationFrame(() => v(y));
7998
+ _t = Math.min(_t + vl, Cl), r.current = requestAnimationFrame(() => v(y));
7988
7999
  },
7989
8000
  [
7990
8001
  m,
@@ -7997,7 +8008,7 @@ function Qe({ style: s, horizontal: e = 0, vertical: t = 0, className: n = "" })
7997
8008
  b,
7998
8009
  A
7999
8010
  ]
8000
- ), k = _(
8011
+ ), k = Y(
8001
8012
  (y) => {
8002
8013
  if (y.preventDefault(), y.stopPropagation(), !m) {
8003
8014
  if (m = !0, e === 0 || t === 0) {
@@ -8008,9 +8019,9 @@ function Qe({ style: s, horizontal: e = 0, vertical: t = 0, className: n = "" })
8008
8019
  }
8009
8020
  },
8010
8021
  [m, e, t, v]
8011
- ), M = _(() => {
8012
- r.current !== null && (cancelAnimationFrame(r.current), r.current = null), m = !1, xa(h.current) || X(d.current);
8013
- }, []), T = _(
8022
+ ), M = Y(() => {
8023
+ r.current !== null && (cancelAnimationFrame(r.current), r.current = null), m = !1, xa(h.current) || H(d.current);
8024
+ }, []), T = Y(
8014
8025
  (y) => {
8015
8026
  y.preventDefault(), y.stopPropagation();
8016
8027
  const x = Kn(a.current);
@@ -8019,20 +8030,20 @@ function Qe({ style: s, horizontal: e = 0, vertical: t = 0, className: n = "" })
8019
8030
  const { x: E, y: F } = A(y);
8020
8031
  if (l) {
8021
8032
  const { y: N, x: D } = l;
8022
- i(Ir({ y: F === -1 ? N : F, x: E === -1 ? D : E })), X(d.current);
8033
+ i(Ir({ y: F === -1 ? N : F, x: E === -1 ? D : E })), H(d.current);
8023
8034
  } else
8024
8035
  S && i(De({ y: -1, x: -1 }));
8025
8036
  },
8026
8037
  [l, S, A]
8027
- ), C = _(
8038
+ ), C = Y(
8028
8039
  (y) => {
8029
8040
  M(), i(qe(!1)), requestAnimationFrame(() => T(y));
8030
8041
  },
8031
8042
  [M, T]
8032
- ), R = _(() => {
8043
+ ), R = Y(() => {
8033
8044
  M();
8034
8045
  }, [M]);
8035
- return j(() => M, [M]), !d.current || !c && !l ? /* @__PURE__ */ w("div", { className: `gs-scroll-handle gs-hidden ${n}` }) : /* @__PURE__ */ w(
8046
+ return K(() => M, [M]), !d.current || !c && !l ? /* @__PURE__ */ w("div", { className: `gs-scroll-handle gs-hidden ${n}` }) : /* @__PURE__ */ w(
8036
8047
  "div",
8037
8048
  {
8038
8049
  style: s,
@@ -8057,14 +8068,14 @@ const El = ws(({ x: s }) => {
8057
8068
  dragging: d,
8058
8069
  contextMenu: f,
8059
8070
  columnMenuState: h
8060
- } = t, g = r.current, p = g == null ? void 0 : g.getCell({ y: 0, x: s }, { resolution: "SYSTEM" }), m = (p == null ? void 0 : p.width) || Ae, b = !!(p != null && p.filter && p.filter.conditions.length > 0), S = Ss(t), A = g == null ? void 0 : g.registry.lastFocused, v = !!(g != null && g.registry.editingAddress || o), k = _(
8071
+ } = t, g = r.current, p = g == null ? void 0 : g.getCell({ y: 0, x: s }, { resolution: "SYSTEM" }), m = (p == null ? void 0 : p.width) || Ae, b = !!(p != null && p.filter && p.filter.conditions.length > 0), S = Ss(t), A = g == null ? void 0 : g.registry.lastFocused, v = !!(g != null && g.registry.editingAddress || o), k = Y(
8061
8072
  (y) => {
8062
8073
  n(Ct({ value: y, point: i }));
8063
8074
  },
8064
8075
  [i]
8065
- ), M = _((y) => {
8076
+ ), M = Y((y) => {
8066
8077
  n(Hs([s, y.clientX, y.clientX])), y.stopPropagation(), Ce(y);
8067
- }, []), T = _(
8078
+ }, []), T = Y(
8068
8079
  (y) => {
8069
8080
  if (y.stopPropagation(), Ce(y), !wt(y) || !g || d)
8070
8081
  return !1;
@@ -8080,7 +8091,7 @@ const El = ws(({ x: s }) => {
8080
8091
  range: { start: E, end: s },
8081
8092
  numRows: g.numRows
8082
8093
  })
8083
- ), v && k((A == null ? void 0 : A.value) ?? ""), n(Se("")), n(qe(!0)), X(c.current), !u;
8094
+ ), v && k((A == null ? void 0 : A.value) ?? ""), n(Se("")), n(qe(!0)), H(c.current), !u;
8084
8095
  },
8085
8096
  [
8086
8097
  d,
@@ -8093,10 +8104,10 @@ const El = ws(({ x: s }) => {
8093
8104
  u,
8094
8105
  c
8095
8106
  ]
8096
- ), C = _(
8107
+ ), C = Y(
8097
8108
  (y) => {
8098
8109
  if (y.stopPropagation(), !y.type.startsWith("touch") && (Ce(y), n(qe(!1)), u))
8099
- return X(c.current), !1;
8110
+ return H(c.current), !1;
8100
8111
  },
8101
8112
  [u]
8102
8113
  ), R = Gr((y) => {
@@ -8198,14 +8209,14 @@ const El = ws(({ x: s }) => {
8198
8209
  dragging: d,
8199
8210
  contextMenu: f,
8200
8211
  rowMenuState: h
8201
- } = t, g = c.current, p = g == null ? void 0 : g.getCell({ y: s, x: 0 }, { resolution: "SYSTEM" }), m = (p == null ? void 0 : p.height) || ke, b = Ss(t), S = g == null ? void 0 : g.registry.lastFocused, A = !!(g != null && g.registry.editingAddress || o), v = _(
8212
+ } = t, g = c.current, p = g == null ? void 0 : g.getCell({ y: s, x: 0 }, { resolution: "SYSTEM" }), m = (p == null ? void 0 : p.height) || ke, b = Ss(t), S = g == null ? void 0 : g.registry.lastFocused, A = !!(g != null && g.registry.editingAddress || o), v = Y(
8202
8213
  (y) => {
8203
8214
  n(Ct({ value: y, point: r }));
8204
8215
  },
8205
8216
  [r]
8206
- ), k = _((y) => {
8217
+ ), k = Y((y) => {
8207
8218
  n(Xs([s, y.clientY, y.clientY])), y.stopPropagation(), Ce(y);
8208
- }, []), M = _(
8219
+ }, []), M = Y(
8209
8220
  (y) => {
8210
8221
  if (y.stopPropagation(), Ce(y), !wt(y) || !g || d)
8211
8222
  return !1;
@@ -8221,7 +8232,7 @@ const El = ws(({ x: s }) => {
8221
8232
  range: { start: E, end: s },
8222
8233
  numCols: g.numCols
8223
8234
  })
8224
- ), A && v((S == null ? void 0 : S.value) ?? ""), n(Se("")), n(qe(!0)), X(l.current), !u;
8235
+ ), A && v((S == null ? void 0 : S.value) ?? ""), n(Se("")), n(qe(!0)), H(l.current), !u;
8225
8236
  },
8226
8237
  [
8227
8238
  d,
@@ -8234,10 +8245,10 @@ const El = ws(({ x: s }) => {
8234
8245
  u,
8235
8246
  l
8236
8247
  ]
8237
- ), T = _(
8248
+ ), T = Y(
8238
8249
  (y) => {
8239
8250
  if (y.stopPropagation(), !y.type.startsWith("touch") && (Ce(y), n(qe(!1)), u))
8240
- return X(l.current), !1;
8251
+ return H(l.current), !1;
8241
8252
  },
8242
8253
  [u]
8243
8254
  ), C = Gr((y) => {
@@ -8254,7 +8265,7 @@ const El = ws(({ x: s }) => {
8254
8265
  n(De(x === 1 ? { y: s, x: g.numCols } : { y: s, x: 1 }));
8255
8266
  }
8256
8267
  return !1;
8257
- }, 100), R = _(
8268
+ }, 100), R = Y(
8258
8269
  (y) => f.length > 0 ? (y.stopPropagation(), Ce(y), n(Jt({ y: y.clientY, x: y.clientX })), !1) : !0,
8259
8270
  [f.length]
8260
8271
  );
@@ -8330,7 +8341,7 @@ const El = ws(({ x: s }) => {
8330
8341
  return;
8331
8342
  const p = it(e, { y: d, x: f }), m = it(e, { y: h, x: g }), b = p.left - n, S = p.top - t, A = m.right - n, v = m.bottom - t;
8332
8343
  A < 0 || b > r || v < 0 || S > o || en(s, b, S, A - b, v - S, a, l, c, u);
8333
- }, Yl = ({ refs: s = {} }) => {
8344
+ }, _l = ({ refs: s = {} }) => {
8334
8345
  const { store: e } = ye(be), {
8335
8346
  sheetReactive: t,
8336
8347
  tabularRef: n,
@@ -8343,9 +8354,9 @@ const El = ws(({ x: s }) => {
8343
8354
  leftHeaderSelecting: u,
8344
8355
  mode: d,
8345
8356
  dragging: f
8346
- } = e, h = t.current, g = ae(null), p = ae(0), m = ae(e);
8357
+ } = e, h = t.current, g = de(null), p = de(0), m = de(e);
8347
8358
  m.current = e;
8348
- const b = _(() => {
8359
+ const b = Y(() => {
8349
8360
  if (!h || !n.current || !g.current)
8350
8361
  return;
8351
8362
  const v = g.current, k = v.getContext("2d");
@@ -8361,63 +8372,63 @@ const El = ws(({ x: s }) => {
8361
8372
  rs(k, h, x, E, C, R, B.wholeArea, Dl, 1, [5, 5]);
8362
8373
  }
8363
8374
  {
8364
- const { y: B, x: K } = r;
8365
- if (B !== -1 && K !== -1) {
8366
- const W = it(h, { y: B, x: K }), se = W.left - E, q = W.top - x;
8367
- en(k, se, q, W.width, W.height, Ds, 2, []);
8375
+ const { y: B, x: V } = r;
8376
+ if (B !== -1 && V !== -1) {
8377
+ const U = it(h, { y: B, x: V }), se = U.left - E, Q = U.top - x;
8378
+ en(k, se, Q, U.width, U.height, Ds, 2, []);
8368
8379
  }
8369
8380
  }
8370
- const { copyingSheetId: $, copyingZone: H, cutting: Z } = y;
8381
+ const { copyingSheetId: $, copyingZone: X, cutting: W } = y;
8371
8382
  if (h.id === $) {
8372
- const B = pe(H);
8373
- rs(k, h, x, E, C, R, B, Z ? Nl : Il, 2.5, Z ? [4, 4] : [6, 4]);
8383
+ const B = pe(X);
8384
+ rs(k, h, x, E, C, R, B, W ? Nl : Il, 2.5, W ? [4, 4] : [6, 4]);
8374
8385
  }
8375
- Object.entries(s).forEach(([B, K]) => {
8376
- const W = gt[K % gt.length];
8386
+ Object.entries(s).forEach(([B, V]) => {
8387
+ const U = gt[V % gt.length];
8377
8388
  try {
8378
8389
  const se = h.rangeToArea(B);
8379
- rs(k, h, x, E, C, R, se, W, 2, [5, 5]);
8390
+ rs(k, h, x, E, C, R, se, U, 2, [5, 5]);
8380
8391
  } catch {
8381
8392
  }
8382
- }), i.forEach((B, K) => {
8383
- const { y: W, x: se } = oe(B), q = it(h, { y: W, x: se }), Q = q.left - E, P = q.top - x;
8384
- if (Q + q.width < 0 || Q > C || P + q.height < 0 || P > R)
8393
+ }), i.forEach((B, V) => {
8394
+ const { y: U, x: se } = oe(B), Q = it(h, { y: U, x: se }), q = Q.left - E, P = Q.top - x;
8395
+ if (q + Q.width < 0 || q > C || P + Q.height < 0 || P > R)
8385
8396
  return;
8386
- const re = K === a;
8397
+ const ne = V === a;
8387
8398
  en(
8388
8399
  k,
8389
- Q,
8400
+ q,
8390
8401
  P,
8391
- q.width,
8392
- q.height,
8393
- re ? Fl : "transparent",
8394
- re ? 2 : 0,
8402
+ Q.width,
8403
+ Q.height,
8404
+ ne ? Fl : "transparent",
8405
+ ne ? 2 : 0,
8395
8406
  [],
8396
8407
  Ml
8397
8408
  );
8398
8409
  }), k.restore();
8399
- const ce = h.numCols, he = h.numRows;
8400
- for (let B = 1; B <= ce; B++) {
8401
- let K = null, W = null;
8402
- if (Je({ start: o.startX, end: o.endX }, B) && (K = "rgba(80, 180, 255, 1)", W = c ? "rgba(128, 128, 128, 0.25)" : "rgba(0, 119, 255, 0.05)"), r.x === B && (K = Ds, W = c ? "rgba(128, 128, 128, 0.45)" : "rgba(0, 119, 255, 0.15)"), !K)
8410
+ const ae = h.numCols, he = h.numRows;
8411
+ for (let B = 1; B <= ae; B++) {
8412
+ let V = null, U = null;
8413
+ if (Je({ start: o.startX, end: o.endX }, B) && (V = "rgba(80, 180, 255, 1)", U = c ? "rgba(128, 128, 128, 0.25)" : "rgba(0, 119, 255, 0.05)"), r.x === B && (V = Ds, U = c ? "rgba(128, 128, 128, 0.45)" : "rgba(0, 119, 255, 0.15)"), !V)
8403
8414
  continue;
8404
- const se = it(h, { y: 1, x: B }), q = se.left - E;
8405
- if (q + se.width < F || q > C)
8415
+ const se = it(h, { y: 1, x: B }), Q = se.left - E;
8416
+ if (Q + se.width < F || Q > C)
8406
8417
  continue;
8407
- const Q = Math.max(q, F), P = Math.min(q + se.width, C) - Q;
8408
- P > 0 && (W && dr(k, Q, 0, P, N, W), k.strokeStyle = K, k.lineWidth = 2, k.beginPath(), k.moveTo(Q, N + 1), k.lineTo(Q + P, N + 1), k.stroke());
8418
+ const q = Math.max(Q, F), P = Math.min(Q + se.width, C) - q;
8419
+ P > 0 && (U && dr(k, q, 0, P, N, U), k.strokeStyle = V, k.lineWidth = 2, k.beginPath(), k.moveTo(q, N + 1), k.lineTo(q + P, N + 1), k.stroke());
8409
8420
  }
8410
8421
  for (let B = 1; B <= he; B++) {
8411
8422
  if (h.isRowFiltered(B))
8412
8423
  continue;
8413
- let K = null, W = null;
8414
- if (Je({ start: o.startY, end: o.endY }, B) && (K = "rgba(80, 180, 255, 1)", W = u ? "rgba(128, 128, 128, 0.25)" : "rgba(0, 119, 255, 0.05)"), r.y === B && (K = Ds, W = u ? "rgba(128, 128, 128, 0.45)" : "rgba(0, 119, 255, 0.15)"), !K)
8424
+ let V = null, U = null;
8425
+ if (Je({ start: o.startY, end: o.endY }, B) && (V = "rgba(80, 180, 255, 1)", U = u ? "rgba(128, 128, 128, 0.25)" : "rgba(0, 119, 255, 0.05)"), r.y === B && (V = Ds, U = u ? "rgba(128, 128, 128, 0.45)" : "rgba(0, 119, 255, 0.15)"), !V)
8415
8426
  continue;
8416
- const se = it(h, { y: B, x: 1 }), q = se.top - x;
8417
- if (q + se.height < N || q > R)
8427
+ const se = it(h, { y: B, x: 1 }), Q = se.top - x;
8428
+ if (Q + se.height < N || Q > R)
8418
8429
  continue;
8419
- const Q = Math.max(q, N), P = Math.min(q + se.height, R) - Q;
8420
- P > 0 && (W && dr(k, 0, Q, F, P, W), k.strokeStyle = K, k.lineWidth = 2, k.beginPath(), k.moveTo(F + 1, Q), k.lineTo(F + 1, Q + P), k.stroke());
8430
+ const q = Math.max(Q, N), P = Math.min(Q + se.height, R) - q;
8431
+ P > 0 && (U && dr(k, 0, q, F, P, U), k.strokeStyle = V, k.lineWidth = 2, k.beginPath(), k.moveTo(F + 1, q), k.lineTo(F + 1, q + P), k.stroke());
8421
8432
  }
8422
8433
  }, [
8423
8434
  h,
@@ -8432,12 +8443,12 @@ const El = ws(({ x: s }) => {
8432
8443
  d,
8433
8444
  f,
8434
8445
  s
8435
- ]), S = _(() => {
8446
+ ]), S = Y(() => {
8436
8447
  cancelAnimationFrame(p.current), p.current = requestAnimationFrame(b);
8437
- }, [b]), A = _(() => {
8448
+ }, [b]), A = Y(() => {
8438
8449
  b();
8439
8450
  }, [b]);
8440
- return j(() => (S(), () => cancelAnimationFrame(p.current)), [S]), j(() => {
8451
+ return K(() => (S(), () => cancelAnimationFrame(p.current)), [S]), K(() => {
8441
8452
  const v = n.current;
8442
8453
  if (v)
8443
8454
  return v.addEventListener("scroll", A), () => {
@@ -8469,7 +8480,7 @@ const El = ws(({ x: s }) => {
8469
8480
  )
8470
8481
  }
8471
8482
  );
8472
- }, _l = () => {
8483
+ }, Yl = () => {
8473
8484
  var M, T, C, R, y, x, E, F, N;
8474
8485
  const [s, e] = ie({}), { store: t, dispatch: n } = ye(be), {
8475
8486
  sheetReactive: r,
@@ -8483,14 +8494,14 @@ const El = ws(({ x: s }) => {
8483
8494
  leftHeaderSelecting: f,
8484
8495
  topHeaderSelecting: h,
8485
8496
  contextMenu: g
8486
- } = t, p = r.current, [m, b] = ie(null), S = _((D) => {
8497
+ } = t, p = r.current, [m, b] = ie(null), S = Y((D) => {
8487
8498
  D.preventDefault(), D.stopPropagation();
8488
- }, []), A = _(
8499
+ }, []), A = Y(
8489
8500
  (D) => {
8490
8501
  p && b(jn(p, D.currentTarget));
8491
8502
  },
8492
8503
  [r]
8493
- ), v = _(() => {
8504
+ ), v = Y(() => {
8494
8505
  p && (n(ct({ y: -1, x: -1 })), requestAnimationFrame(() => {
8495
8506
  n(ct({ y: 1, x: 1 })), n(
8496
8507
  Pe({
@@ -8502,33 +8513,33 @@ const El = ws(({ x: s }) => {
8502
8513
  );
8503
8514
  }));
8504
8515
  }, [r]);
8505
- j(() => {
8516
+ K(() => {
8506
8517
  if (!p)
8507
8518
  return;
8508
8519
  if (!(i && d.startsWith("="))) {
8509
8520
  e({}), p.registry.paletteBySheetName = {};
8510
8521
  return;
8511
8522
  }
8512
- const $ = {}, H = {}, Z = new We(d.substring(1));
8513
- Z.tokenize();
8514
- let ce = 0;
8515
- for (const he of Z.tokens)
8523
+ const $ = {}, X = {}, W = new We(d.substring(1));
8524
+ W.tokenize();
8525
+ let ae = 0;
8526
+ for (const he of W.tokens)
8516
8527
  if (he.type === "REF" || he.type === "RANGE") {
8517
- const B = $o(he.stringify()), K = B.indexOf("!");
8518
- if (K !== -1) {
8519
- const W = B.substring(0, K), se = B.substring(K + 1), q = pa(W), Q = se.toUpperCase();
8520
- H[q] == null && (H[q] = {}), H[q][Q] == null && (H[q][Q] = ce++);
8528
+ const B = $o(he.stringify()), V = B.indexOf("!");
8529
+ if (V !== -1) {
8530
+ const U = B.substring(0, V), se = B.substring(V + 1), Q = pa(U), q = se.toUpperCase();
8531
+ X[Q] == null && (X[Q] = {}), X[Q][q] == null && (X[Q][q] = ae++);
8521
8532
  } else {
8522
- const W = B.toUpperCase();
8523
- $[W] == null && ($[W] = ce++);
8533
+ const U = B.toUpperCase();
8534
+ $[U] == null && ($[U] = ae++);
8524
8535
  }
8525
8536
  }
8526
- e($), p.registry.paletteBySheetName = H;
8527
- }, [t.inputting, t.editingAddress, r]), j(() => {
8537
+ e($), p.registry.paletteBySheetName = X;
8538
+ }, [t.inputting, t.editingAddress, r]), K(() => {
8528
8539
  p && (p.registry.choosingAddress = G(o), p.registry.choosingSheetId = p.id);
8529
- }, [o]), j(() => {
8540
+ }, [o]), K(() => {
8530
8541
  p && b(jn(p, a.current));
8531
- }, [a.current, r, (M = l.current) == null ? void 0 : M.clientHeight, (T = l.current) == null ? void 0 : T.clientWidth]), j(() => {
8542
+ }, [a.current, r, (M = l.current) == null ? void 0 : M.clientHeight, (T = l.current) == null ? void 0 : T.clientWidth]), K(() => {
8532
8543
  const D = a.current;
8533
8544
  if (D)
8534
8545
  return Ji(D);
@@ -8557,7 +8568,7 @@ const El = ws(({ x: s }) => {
8557
8568
  height: p.totalHeight + 1
8558
8569
  },
8559
8570
  children: [
8560
- /* @__PURE__ */ w(Yl, { refs: k }),
8571
+ /* @__PURE__ */ w(_l, { refs: k }),
8561
8572
  /* @__PURE__ */ O("table", { className: "gs-table", children: [
8562
8573
  /* @__PURE__ */ w("thead", { className: "gs-thead", style: { height: p.headerHeight }, children: /* @__PURE__ */ O("tr", { className: "gs-row", children: [
8563
8574
  /* @__PURE__ */ w(
@@ -8587,8 +8598,8 @@ const El = ws(({ x: s }) => {
8587
8598
  },
8588
8599
  onMouseUp: (D) => {
8589
8600
  D.stopPropagation();
8590
- const $ = D.currentTarget, H = Number($.dataset.pressX ?? D.clientX), Z = Number($.dataset.pressY ?? D.clientY);
8591
- if (Math.abs(D.clientX - H) > 4 || Math.abs(D.clientY - Z) > 4)
8601
+ const $ = D.currentTarget, X = Number($.dataset.pressX ?? D.clientX), W = Number($.dataset.pressY ?? D.clientY);
8602
+ if (Math.abs(D.clientX - X) > 4 || Math.abs(D.clientY - W) > 4)
8592
8603
  return;
8593
8604
  const he = $.getBoundingClientRect();
8594
8605
  n(Jt({ y: he.bottom, x: he.left }));
@@ -8632,7 +8643,7 @@ const El = ws(({ x: s }) => {
8632
8643
  return /* @__PURE__ */ O("tr", { className: `gs-row ${D % 2 === 0 ? "gs-row-even" : "gs-row-odd"}`, children: [
8633
8644
  /* @__PURE__ */ w(kl, { y: D }),
8634
8645
  /* @__PURE__ */ w("td", { className: "gs-adjuster gs-adjuster-horizontal gs-adjuster-horizontal-left" }),
8635
- ($ = m == null ? void 0 : m.xs) == null ? void 0 : $.map((H) => /* @__PURE__ */ w(Sl, { y: D, x: H }, H)),
8646
+ ($ = m == null ? void 0 : m.xs) == null ? void 0 : $.map((X) => /* @__PURE__ */ w(Sl, { y: D, x: X }, X)),
8636
8647
  /* @__PURE__ */ w("td", { className: "gs-adjuster gs-adjuster-horizontal gs-adjuster-horizontal-right" })
8637
8648
  ] }, D);
8638
8649
  }) })
@@ -8648,7 +8659,7 @@ const El = ws(({ x: s }) => {
8648
8659
  const e = document.createElement("style");
8649
8660
  document.head.appendChild(e), e.setAttribute("class", "gs-styling"), e.setAttribute("data-modified-at", `${ur}`), e.innerText = $l;
8650
8661
  }, Pl = ({ ready: s }) => {
8651
- var P, re;
8662
+ var P, ne;
8652
8663
  const { store: e, dispatch: t } = ye(be), [n, r] = ie(""), [o, i] = ie(0), [a, l] = ie(!1), {
8653
8664
  choosing: c,
8654
8665
  selectingZone: u,
@@ -8658,21 +8669,21 @@ const El = ws(({ x: s }) => {
8658
8669
  inputting: g,
8659
8670
  editingAddress: p,
8660
8671
  dragging: m
8661
- } = e, b = h.current, S = ae(null), A = c.x === -1 ? "" : G(c), v = b == null ? void 0 : b.getCell(c, { resolution: "SYSTEM" }), k = (P = b == null ? void 0 : b.getSystem(c)) == null ? void 0 : P.spilledFrom, M = k ? oe(k) : void 0, T = M != null ? G(M) : void 0;
8662
- j(() => {
8672
+ } = e, b = h.current, S = de(null), A = c.x === -1 ? "" : G(c), v = b == null ? void 0 : b.getCell(c, { resolution: "SYSTEM" }), k = (P = b == null ? void 0 : b.getSystem(c)) == null ? void 0 : P.spilledFrom, M = k ? oe(k) : void 0, T = M != null ? G(M) : void 0;
8673
+ K(() => {
8663
8674
  var J;
8664
8675
  if (!b)
8665
8676
  return;
8666
8677
  let I = ((J = b.getCell(c, { resolution: "SYSTEM" })) == null ? void 0 : J.value) ?? "";
8667
8678
  I = b.getSerializedValue({ point: c, cell: { ...v, value: I }, resolution: "RAW" }), f.current.value = I, r(I);
8668
8679
  }, [A, b]);
8669
- const C = _(
8680
+ const C = Y(
8670
8681
  (I) => {
8671
- n !== I && t(Ct({ value: I })), t(Se("")), X(d.current);
8682
+ n !== I && t(Ct({ value: I })), t(Se("")), H(d.current);
8672
8683
  },
8673
8684
  [n]
8674
8685
  );
8675
- j(() => {
8686
+ K(() => {
8676
8687
  const I = new ResizeObserver((J) => {
8677
8688
  J.forEach(B);
8678
8689
  });
@@ -8687,25 +8698,25 @@ const El = ws(({ x: s }) => {
8687
8698
  handleArrowUp: N,
8688
8699
  handleArrowDown: D,
8689
8700
  activeFunctionHelp: $,
8690
- activeArgIndex: H
8701
+ activeArgIndex: X
8691
8702
  } = qr({
8692
8703
  inputting: g,
8693
8704
  selectionStart: o,
8694
8705
  optionsAll: y,
8695
8706
  functions: b == null ? void 0 : b.registry.functions
8696
- }), Z = f.current, ce = _((I) => {
8707
+ }), W = f.current, ae = Y((I) => {
8697
8708
  t(ge(I.currentTarget.value));
8698
- }, []), he = _((I) => {
8709
+ }, []), he = Y((I) => {
8699
8710
  i(I.currentTarget.selectionStart);
8700
- }, []), B = _(() => {
8711
+ }, []), B = Y(() => {
8701
8712
  !S.current || !f.current || (S.current.style.height = `${f.current.clientHeight}px`, S.current.scrollLeft = f.current.scrollLeft, S.current.scrollTop = f.current.scrollTop);
8702
- }, []), K = _(
8713
+ }, []), V = Y(
8703
8714
  (I) => {
8704
- !Z || !b || (l(!0), t(Se(A)), b.registry.lastFocused = I.currentTarget);
8715
+ !W || !b || (l(!0), t(Se(A)), b.registry.lastFocused = I.currentTarget);
8705
8716
  },
8706
- [Z, A, b]
8717
+ [W, A, b]
8707
8718
  );
8708
- _(
8719
+ Y(
8709
8720
  (I) => {
8710
8721
  if (l(!1), I.currentTarget.value.startsWith("="))
8711
8722
  return !0;
@@ -8713,7 +8724,7 @@ const El = ws(({ x: s }) => {
8713
8724
  },
8714
8725
  [p, C]
8715
8726
  );
8716
- const W = _(
8727
+ const U = Y(
8717
8728
  (I) => {
8718
8729
  if (I.ctrlKey || !b)
8719
8730
  return !0;
@@ -8723,14 +8734,14 @@ const El = ws(({ x: s }) => {
8723
8734
  switch (I.key) {
8724
8735
  case "Tab":
8725
8736
  if (I.preventDefault(), x.length) {
8726
- const le = x[E];
8727
- if (le == null ? void 0 : le.isFunction) {
8728
- const { value: Ve, selectionStart: ts } = F(le);
8737
+ const ce = x[E];
8738
+ if (ce == null ? void 0 : ce.isFunction) {
8739
+ const { value: Ve, selectionStart: ts } = F(ce);
8729
8740
  return t(ge(Ve)), setTimeout(() => {
8730
- f.current && (X(f.current), f.current.setSelectionRange(ts, ts));
8741
+ f.current && (H(f.current), f.current.setSelectionRange(ts, ts));
8731
8742
  }, 0), !1;
8732
8743
  } else {
8733
- const Ve = b.update({ diff: { [A]: { value: le.value } }, partial: !0 });
8744
+ const Ve = b.update({ diff: { [A]: { value: ce.value } }, partial: !0 });
8734
8745
  t(lt(Ve.clone())), t(Se("")), t(ge(""));
8735
8746
  }
8736
8747
  }
@@ -8745,11 +8756,11 @@ const El = ws(({ x: s }) => {
8745
8756
  break;
8746
8757
  case "Enter": {
8747
8758
  if (x.length) {
8748
- const le = x[E];
8749
- if (le != null && le.isFunction) {
8750
- const { value: Le, selectionStart: Ve } = F(le);
8759
+ const ce = x[E];
8760
+ if (ce != null && ce.isFunction) {
8761
+ const { value: Le, selectionStart: Ve } = F(ce);
8751
8762
  return t(ge(Le)), setTimeout(() => {
8752
- f.current && (X(f.current), f.current.setSelectionRange(Ve, Ve));
8763
+ f.current && (H(f.current), f.current.setSelectionRange(Ve, Ve));
8753
8764
  }, 0), I.preventDefault(), !1;
8754
8765
  }
8755
8766
  }
@@ -8768,7 +8779,7 @@ const El = ws(({ x: s }) => {
8768
8779
  break;
8769
8780
  }
8770
8781
  case "Escape": {
8771
- J.value = n, t(ge(n)), t(Se("")), I.preventDefault(), X(d.current);
8782
+ J.value = n, t(ge(n)), t(Se("")), I.preventDefault(), H(d.current);
8772
8783
  break;
8773
8784
  }
8774
8785
  case "a":
@@ -8800,30 +8811,30 @@ const El = ws(({ x: s }) => {
8800
8811
  D,
8801
8812
  g
8802
8813
  ]
8803
- ), se = _(
8814
+ ), se = Y(
8804
8815
  (I, J) => {
8805
8816
  I.preventDefault(), I.stopPropagation();
8806
8817
  const ve = x[J];
8807
8818
  if (ve.isFunction) {
8808
- const { value: le, selectionStart: Le } = F(ve);
8809
- C(le), t(ge(le)), setTimeout(() => {
8810
- f.current && (X(f.current), f.current.setSelectionRange(Le, Le));
8819
+ const { value: ce, selectionStart: Le } = F(ve);
8820
+ C(ce), t(ge(ce)), setTimeout(() => {
8821
+ f.current && (H(f.current), f.current.setSelectionRange(Le, Le));
8811
8822
  }, 0);
8812
8823
  }
8813
8824
  },
8814
8825
  [x, F, C, t]
8815
- ), q = s ? {} : { visibility: "hidden" };
8826
+ ), Q = s ? {} : { visibility: "hidden" };
8816
8827
  if (!b)
8817
- return /* @__PURE__ */ O("label", { className: "gs-formula-bar gs-hidden", style: q, children: [
8828
+ return /* @__PURE__ */ O("label", { className: "gs-formula-bar gs-hidden", style: Q, children: [
8818
8829
  /* @__PURE__ */ w("div", { className: "gs-selecting-address" }),
8819
8830
  /* @__PURE__ */ w("div", { className: "gs-fx", children: "Fx" }),
8820
8831
  /* @__PURE__ */ w("div", { className: "gs-formula-bar-editor-inner", children: /* @__PURE__ */ w("textarea", {}) })
8821
8832
  ] });
8822
- const Q = () => {
8823
- var le;
8833
+ const q = () => {
8834
+ var ce;
8824
8835
  if (!a || typeof document > "u" || f.current !== document.activeElement)
8825
8836
  return null;
8826
- const I = (le = f.current) == null ? void 0 : le.getBoundingClientRect();
8837
+ const I = (ce = f.current) == null ? void 0 : ce.getBoundingClientRect();
8827
8838
  if (!I)
8828
8839
  return null;
8829
8840
  const J = I.bottom, ve = I.left;
@@ -8833,7 +8844,7 @@ const El = ws(({ x: s }) => {
8833
8844
  xn,
8834
8845
  {
8835
8846
  activeFunctionGuide: $,
8836
- activeArgIndex: H,
8847
+ activeArgIndex: X,
8837
8848
  top: J,
8838
8849
  left: ve
8839
8850
  }
@@ -8858,7 +8869,7 @@ const El = ws(({ x: s }) => {
8858
8869
  className: "gs-formula-bar",
8859
8870
  "data-sheet-id": e.sheetId,
8860
8871
  "data-spill": T != null ? "true" : void 0,
8861
- style: q,
8872
+ style: Q,
8862
8873
  children: [
8863
8874
  /* @__PURE__ */ w(Qe, { style: { position: "absolute", left: 0, top: 0, zIndex: 2 }, vertical: -1 }),
8864
8875
  /* @__PURE__ */ w("div", { className: "gs-selecting-address", children: T ?? A }),
@@ -8870,7 +8881,7 @@ const El = ws(({ x: s }) => {
8870
8881
  className: "gs-editor-hl",
8871
8882
  ref: S,
8872
8883
  style: {
8873
- height: (re = f.current) == null ? void 0 : re.clientHeight,
8884
+ height: (ne = f.current) == null ? void 0 : ne.clientHeight,
8874
8885
  width: "100%"
8875
8886
  },
8876
8887
  children: (v == null ? void 0 : v.formulaEnabled) ?? !0 ? eo(g) : g
@@ -8887,13 +8898,13 @@ const El = ws(({ x: s }) => {
8887
8898
  ref: f,
8888
8899
  value: g,
8889
8900
  readOnly: T != null,
8890
- onInput: ce,
8891
- onFocus: K,
8901
+ onInput: ae,
8902
+ onFocus: V,
8892
8903
  onSelect: he,
8893
8904
  onPaste: (I) => {
8894
8905
  I.stopPropagation();
8895
8906
  },
8896
- onKeyDown: W,
8907
+ onKeyDown: U,
8897
8908
  onKeyUp: B,
8898
8909
  onScroll: B,
8899
8910
  onMouseEnter: (I) => {
@@ -8904,7 +8915,7 @@ const El = ws(({ x: s }) => {
8904
8915
  }
8905
8916
  }
8906
8917
  ),
8907
- Q()
8918
+ q()
8908
8919
  ] })
8909
8920
  ]
8910
8921
  }
@@ -8948,31 +8959,31 @@ const El = ws(({ x: s }) => {
8948
8959
  matchingCells: f,
8949
8960
  sheetReactive: h
8950
8961
  } = s, g = h.current, p = f[d];
8951
- j(() => {
8962
+ K(() => {
8952
8963
  if (!p || !g)
8953
8964
  return;
8954
8965
  const x = oe(p);
8955
8966
  typeof x > "u" || on(g, o.current, x);
8956
8967
  }, [i, d, a, l, g, o]);
8957
- const m = _((x) => {
8968
+ const m = Y((x) => {
8958
8969
  const E = x.currentTarget.previousSibling;
8959
- (E == null ? void 0 : E.nodeName) === "INPUT" && X(E);
8960
- }, []), b = _(() => {
8970
+ (E == null ? void 0 : E.nodeName) === "INPUT" && H(E);
8971
+ }, []), b = Y(() => {
8961
8972
  e(Zs(1));
8962
- }, []), S = _((x) => {
8973
+ }, []), S = Y((x) => {
8963
8974
  e(mt(x.currentTarget.value));
8964
- }, []), A = _(
8975
+ }, []), A = Y(
8965
8976
  (x) => {
8966
8977
  if (x.key === "Escape") {
8967
8978
  const E = n == null ? void 0 : n.current;
8968
- E && X(E), e(mt(void 0));
8979
+ E && H(E), e(mt(void 0));
8969
8980
  }
8970
8981
  return x.key === "f" && (x.ctrlKey || x.metaKey) ? (x.preventDefault(), !1) : x.key === "Enter" ? (e(Zs(x.shiftKey ? -1 : 1)), x.preventDefault(), !1) : !0;
8971
8982
  },
8972
8983
  [n]
8973
- ), v = _(() => {
8984
+ ), v = Y(() => {
8974
8985
  e(si(!a));
8975
- }, [a]), k = _(() => {
8986
+ }, [a]), k = Y(() => {
8976
8987
  e(ri(!l));
8977
8988
  }, [l]), M = pt(() => {
8978
8989
  if (!u || Wo(u))
@@ -8984,7 +8995,7 @@ const El = ws(({ x: s }) => {
8984
8995
  return "";
8985
8996
  const { startY: x, startX: E, endY: F, endX: N } = u, D = `${xe(Math.min(E, N))}${Ee(Math.min(x, F))}`, $ = `${xe(Math.max(E, N))}${Ee(Math.max(x, F))}`;
8986
8997
  return `${D}:${$}`;
8987
- }, [u, M]), C = _(() => {
8998
+ }, [u, M]), C = Y(() => {
8988
8999
  if (c)
8989
9000
  e(Qn(void 0));
8990
9001
  else if (u && M) {
@@ -9003,8 +9014,8 @@ const El = ws(({ x: s }) => {
9003
9014
  return "";
9004
9015
  const { startY: x, startX: E, endY: F, endX: N } = c, D = `${xe(E)}${Ee(x)}`, $ = `${xe(N)}${Ee(F)}`;
9005
9016
  return `${D}:${$}`;
9006
- }, [c]), y = _(() => {
9007
- e(mt(void 0)), X(n.current);
9017
+ }, [c]), y = Y(() => {
9018
+ e(mt(void 0)), H(n.current);
9008
9019
  }, [n]);
9009
9020
  return typeof i > "u" || t.current === null ? null : /* @__PURE__ */ O("label", { className: `gs-search-bar ${f.length > 0 ? "gs-search-found" : ""}`, children: [
9010
9021
  /* @__PURE__ */ O("div", { className: "gs-search-progress", onClick: m, children: [
@@ -9068,7 +9079,7 @@ const El = ws(({ x: s }) => {
9068
9079
  ] }),
9069
9080
  /* @__PURE__ */ w("a", { className: "gs-search-close", onClick: y, children: /* @__PURE__ */ w(zl, { style: { verticalAlign: "middle" } }) })
9070
9081
  ] });
9071
- }, vd = () => fr(), Hl = () => ae(null), Cd = () => fr(), Bl = () => ae(null);
9082
+ }, vd = () => fr(), Hl = () => de(null), Cd = () => fr(), Bl = () => de(null);
9072
9083
  function Ed({
9073
9084
  initialCells: s,
9074
9085
  sheetName: e = "",
@@ -9079,20 +9090,18 @@ function Ed({
9079
9090
  style: i,
9080
9091
  book: a
9081
9092
  }) {
9082
- var ce, he, B, K;
9083
- const { sheetResize: l, showFormulaBar: c = !0, mode: u = "light" } = r, d = ae(null), f = ae(null), h = ae(null), g = ae(null), p = ae(null), m = ae(null), b = ae(null), S = Hl(), A = t ?? S, v = Bl(), k = n ?? v, M = Sa({}), T = a ?? M, { registry: C } = T, R = ae(null);
9084
- R.current === null && (R.current = ++C.sheetHead);
9085
- const y = R.current, x = ae(null), [E] = ie(() => {
9086
- var I;
9087
- e || (e = `Sheet${y}`, console.debug("GridSheet: sheetName is not provided, using default name:", e));
9088
- const { limits: W, contextMenu: se, rowMenu: q, colMenu: Q } = r, P = new Ne({
9089
- limits: W,
9093
+ var W, ae, he, B;
9094
+ const { sheetResize: l, showFormulaBar: c = !0, mode: u = "light" } = r, d = de(null), f = de(null), h = de(null), g = de(null), p = de(null), m = de(null), b = de(null), S = Hl(), A = t ?? S, v = Bl(), k = n ?? v, M = Sa({}), T = a ?? M, { registry: C } = T, [R] = ie(() => e ? (C._componentSheetIds.has(e) || C._componentSheetIds.set(e, ++C.sheetHead), C._componentSheetIds.get(e)) : ++C.sheetHead), y = de(null), [x] = ie(() => {
9095
+ var ne;
9096
+ e || (e = `Sheet${R}`, console.debug("GridSheet: sheetName is not provided, using default name:", e));
9097
+ const { limits: V, contextMenu: U, rowMenu: se, colMenu: Q } = r, q = new Ne({
9098
+ limits: V,
9090
9099
  name: e,
9091
9100
  registry: C
9092
9101
  });
9093
- return P.id = y, C.sheetIdsByName[e] = y, P.initialize(s), (I = C.onInit) == null || I.call(C, { sheet: P }), P.setTotalSize(), x.current = P, {
9094
- sheetId: y,
9095
- sheetReactive: x,
9102
+ return q.id = R, C.sheetIdsByName[e] = R, q.initialize(s), (ne = C.onInit) == null || ne.call(C, { sheet: q }), q.setTotalSize(), y.current = q, {
9103
+ sheetId: R,
9104
+ sheetReactive: y,
9096
9105
  rootRef: d,
9097
9106
  flashRef: f,
9098
9107
  mainRef: h,
@@ -9118,8 +9127,8 @@ function Ed({
9118
9127
  searchRegex: !1,
9119
9128
  editingOnEnter: !0,
9120
9129
  contextMenuPosition: { y: -1, x: -1 },
9121
- contextMenu: se ?? ul,
9122
- rowMenu: q ?? hl,
9130
+ contextMenu: U ?? ul,
9131
+ rowMenu: se ?? hl,
9123
9132
  colMenu: Q ?? fl,
9124
9133
  resizingPositionY: [-1, -1, -1],
9125
9134
  resizingPositionX: [-1, -1, -1],
@@ -9128,40 +9137,40 @@ function Ed({
9128
9137
  editorHovering: !0,
9129
9138
  mode: "light"
9130
9139
  };
9131
- }), [F, N] = ko(
9140
+ }), [E, F] = ko(
9132
9141
  Jo,
9133
- E,
9134
- () => E
9142
+ x,
9143
+ () => x
9135
9144
  );
9136
- j(() => {
9145
+ K(() => {
9137
9146
  Ol();
9138
9147
  }, []);
9139
- const [D, $] = ie((r == null ? void 0 : r.sheetHeight) || Ul(s)), [H, Z] = ie((r == null ? void 0 : r.sheetWidth) || Zl(s));
9140
- return j(() => {
9141
- const W = window.setInterval(() => {
9142
- var se, q;
9143
- $(((se = h.current) == null ? void 0 : se.clientHeight) || 0), Z(((q = h.current) == null ? void 0 : q.clientWidth) || 0);
9148
+ const [N, D] = ie((r == null ? void 0 : r.sheetHeight) || Ul(s)), [$, X] = ie((r == null ? void 0 : r.sheetWidth) || Zl(s));
9149
+ return K(() => {
9150
+ const V = window.setInterval(() => {
9151
+ var U, se;
9152
+ D(((U = h.current) == null ? void 0 : U.clientHeight) || 0), X(((se = h.current) == null ? void 0 : se.clientWidth) || 0);
9144
9153
  }, 1e3);
9145
- return () => window.clearInterval(W);
9146
- }, []), j(() => {
9147
- r.sheetHeight && $(r.sheetHeight);
9148
- }, [r.sheetHeight]), j(() => {
9149
- r.sheetWidth && Z(r.sheetWidth);
9150
- }, [r.sheetWidth]), /* @__PURE__ */ w(be.Provider, { value: { store: F, dispatch: N }, children: /* @__PURE__ */ O(
9154
+ return () => window.clearInterval(V);
9155
+ }, []), K(() => {
9156
+ r.sheetHeight && D(r.sheetHeight);
9157
+ }, [r.sheetHeight]), K(() => {
9158
+ r.sheetWidth && X(r.sheetWidth);
9159
+ }, [r.sheetWidth]), /* @__PURE__ */ w(be.Provider, { value: { store: E, dispatch: F }, children: /* @__PURE__ */ O(
9151
9160
  "div",
9152
9161
  {
9153
9162
  className: `gs-root1 ${C.ready ? "gs-initialized" : ""}`,
9154
9163
  ref: d,
9155
9164
  "data-sheet-name": e,
9156
9165
  "data-mode": u,
9157
- "data-rows": ((ce = F.sheetReactive.current) == null ? void 0 : ce.numRows) ?? 0,
9158
- "data-cols": ((he = F.sheetReactive.current) == null ? void 0 : he.numCols) ?? 0,
9166
+ "data-rows": ((W = E.sheetReactive.current) == null ? void 0 : W.numRows) ?? 0,
9167
+ "data-cols": ((ae = E.sheetReactive.current) == null ? void 0 : ae.numCols) ?? 0,
9159
9168
  children: [
9160
9169
  /* @__PURE__ */ w("div", { className: "gs-flash-overlay", ref: f }),
9161
9170
  /* @__PURE__ */ w(Qe, { style: { position: "fixed", top: 0, left: 0 } }),
9162
9171
  /* @__PURE__ */ w(Qe, { style: { position: "absolute", zIndex: 4, right: 0, top: 0, width: 5 }, horizontal: 1 }),
9163
9172
  /* @__PURE__ */ w(Qe, { style: { position: "absolute", zIndex: 4, left: 0, bottom: 0, height: 5 }, vertical: 1 }),
9164
- typeof F.searchQuery > "u" ? c && /* @__PURE__ */ w(Pl, { ready: C.ready }) : /* @__PURE__ */ w(Xl, {}),
9173
+ typeof E.searchQuery > "u" ? c && /* @__PURE__ */ w(Pl, { ready: C.ready }) : /* @__PURE__ */ w(Xl, {}),
9165
9174
  /* @__PURE__ */ O(
9166
9175
  "div",
9167
9176
  {
@@ -9169,16 +9178,16 @@ function Ed({
9169
9178
  ref: h,
9170
9179
  style: {
9171
9180
  //width: '100%',
9172
- maxWidth: (((B = F.sheetReactive.current) == null ? void 0 : B.totalWidth) || 0) + 2,
9173
- maxHeight: (((K = F.sheetReactive.current) == null ? void 0 : K.fullHeight) || 0) + 2,
9181
+ maxWidth: (((he = E.sheetReactive.current) == null ? void 0 : he.totalWidth) || 0) + 2,
9182
+ maxHeight: (((B = E.sheetReactive.current) == null ? void 0 : B.fullHeight) || 0) + 2,
9174
9183
  overflow: "auto",
9175
9184
  resize: l,
9176
9185
  ...i
9177
9186
  },
9178
9187
  children: [
9179
9188
  /* @__PURE__ */ w(tl, { mode: u }),
9180
- /* @__PURE__ */ w(_l, {}),
9181
- /* @__PURE__ */ w(sl, { ...r, sheetHeight: D, sheetWidth: H, sheetName: e, sheetRef: A, storeRef: k }),
9189
+ /* @__PURE__ */ w(Yl, {}),
9190
+ /* @__PURE__ */ w(sl, { ...r, sheetHeight: N, sheetWidth: $, sheetName: e, sheetRef: A, storeRef: k }),
9182
9191
  /* @__PURE__ */ w(pl, {}),
9183
9192
  /* @__PURE__ */ w(xl, {}),
9184
9193
  /* @__PURE__ */ w(Rl, {}),
@@ -9194,7 +9203,7 @@ function Ed({
9194
9203
  const Ul = (s) => {
9195
9204
  var n, r, o, i, a;
9196
9205
  const e = rn(s);
9197
- let t = ((n = s[0]) == null ? void 0 : n.height) ?? _s;
9206
+ let t = ((n = s[0]) == null ? void 0 : n.height) ?? Ys;
9198
9207
  for (let l = 1; l <= e.numRows; l++) {
9199
9208
  const c = Ee(l), u = ((r = s == null ? void 0 : s[c]) == null ? void 0 : r.height) || ((o = s == null ? void 0 : s["0" + c]) == null ? void 0 : o.height) || ((i = s == null ? void 0 : s[cs]) == null ? void 0 : i.height) || ((a = s == null ? void 0 : s.default) == null ? void 0 : a.height) || ke;
9200
9209
  if (t + u > Ln)
@@ -9243,7 +9252,7 @@ export {
9243
9252
  bd as BaseFunctionAsync,
9244
9253
  Ad as CheckboxPolicyMixin,
9245
9254
  Io as DEFAULT_HISTORY_LIMIT,
9246
- U as FormulaError,
9255
+ Z as FormulaError,
9247
9256
  ld as FormulaParser,
9248
9257
  Ed as GridSheet,
9249
9258
  We as Lexer,
@@ -9252,13 +9261,13 @@ export {
9252
9261
  we as Pending,
9253
9262
  Rd as PluginBase,
9254
9263
  Rn as Policy,
9255
- _r as RangeEntity,
9256
- Yr as RefEntity,
9264
+ Yr as RangeEntity,
9265
+ _r as RefEntity,
9257
9266
  wa as Registry,
9258
9267
  Ne as Sheet,
9259
9268
  Me as Spilling,
9260
9269
  kd as ThousandSeparatorPolicyMixin,
9261
- V as Time,
9270
+ j as Time,
9262
9271
  wn as ValueEntity,
9263
9272
  oe as a2p,
9264
9273
  sd as aa2oa,
@@ -9287,11 +9296,11 @@ export {
9287
9296
  me as ensureNumber,
9288
9297
  He as ensureString,
9289
9298
  Td as makeBorder,
9290
- _t as matrixShape,
9299
+ Yt as matrixShape,
9291
9300
  td as oa2aa,
9292
9301
  ad as operations,
9293
9302
  G as p2a,
9294
- _o as r2y,
9303
+ Yo as r2y,
9295
9304
  An as registerMenuComponent,
9296
9305
  Jl as rh,
9297
9306
  ea as sheet2csv,