@sheetxl/sdk 0.8.0-beta.16 → 0.8.0-beta.18

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.
Files changed (110) hide show
  1. package/browser/esm/{B6BdiHigbUdbZp3J.mjs → -P0fym6eh9hn9row.mjs} +2 -2
  2. package/browser/esm/{DlVnybrgwZWxWN3_.mjs → -nOfWMHdlTb9ShjF.mjs} +9 -9
  3. package/browser/esm/{CMChv-fCFh68VQQt.mjs → 0Mw5Ew_7tAiWgc5J.mjs} +14 -14
  4. package/browser/esm/{JV9Szh5qTssjxJoE.mjs → 1ktaHvjuYL6stU4C.mjs} +1 -1
  5. package/browser/esm/{HV0FkJ6k3Ils318J.mjs → B3ifnlsuky2L9HmB.mjs} +33 -33
  6. package/browser/esm/{BtNuoQIrrHw_jnbJ.mjs → B67q5ZrwyKvm3d6W.mjs} +3 -3
  7. package/browser/esm/{KpuD1kEcWB7cT0VM.mjs → BQSd_URWugiyNoNj.mjs} +2 -2
  8. package/browser/esm/{ad9PX897hYE4Srkc.mjs → BWHHWC6H2JgG11Kq.mjs} +2 -2
  9. package/browser/esm/{BlMYYQZP-QM-iBHz.mjs → BYbb2weYQCb_7KI3.mjs} +21 -21
  10. package/browser/esm/{WLlpmgLN5OVLoLrC.mjs → B_hrmyuWaH5VIFpV.mjs} +2 -2
  11. package/browser/esm/{d_t-7d5BD1AdHg3u.mjs → Bql31KGUYo0SCMwZ.mjs} +392 -392
  12. package/browser/esm/{D807piM0VSokWz-L.mjs → BtVpErObXYKJCwHG.mjs} +1 -1
  13. package/browser/esm/{BWY1qiidTUBVPJoD.mjs → By7_c19Kv2YQaDVF.mjs} +475 -475
  14. package/browser/esm/{Zp5-cTJ0Llb6EfGi.mjs → C6M_XM08QtHuaInQ.mjs} +3 -3
  15. package/browser/esm/{BxYuRTSF9ykc-Tpz.mjs → CBHwju4PYiv85_jD.mjs} +2 -2
  16. package/browser/esm/{D-iHJ3q4nwOLcn1D.mjs → CJhYhZtsey3OnWKd.mjs} +1 -1
  17. package/browser/esm/{Dx9Fya60meMpuHqm.mjs → CQlxAbhdxgfu0ERF.mjs} +1 -1
  18. package/browser/esm/{C3JOjQwdG9kAig7i.mjs → CVXOtvee4oFImGyR.mjs} +504 -504
  19. package/browser/esm/{9YWdxmSjzLN4j_ts.mjs → CXQLYHAhE5MLKxZ4.mjs} +37 -37
  20. package/browser/esm/{CUu3zeHqcwMRYiov.mjs → CZiJYw94Yt7xslXS.mjs} +1 -1
  21. package/browser/esm/{BxFzcCYhvo9NXFjC.mjs → ChRUNekYurtOtrP1.mjs} +113 -113
  22. package/browser/esm/{dwGdnbV-CykjNrlm.mjs → CnobgPLHEsTPTFY5.mjs} +1 -1
  23. package/browser/esm/{WR146UAqrsUsL39e.mjs → CxNnMvwtOf76r7yY.mjs} +1 -1
  24. package/browser/esm/{U4FL-QeC0bRUhTEo.mjs → CzmmdfrOYDUGx-Yh.mjs} +1 -1
  25. package/browser/esm/{4MbBwfmW2hDXk9_w.mjs → D2P43UD6TGSXErhr.mjs} +2 -2
  26. package/browser/esm/{Bf80epSsm_RyAOb9.mjs → DH8NuKmZAC9EaqwP.mjs} +18 -18
  27. package/browser/esm/{WcHfawW2lkTHtWUd.mjs → DJuiV0Y8olnwuqB-.mjs} +21 -21
  28. package/browser/esm/{DcB52JPBPmkc3l1m.mjs → DKFaQ2QOyUPCk0sD.mjs} +3 -3
  29. package/browser/esm/{CRbQATfI0yZxe1kX.mjs → DLR8g1DkooIBl8S1.mjs} +2 -2
  30. package/browser/esm/{BF_QwkZ_hs2rFoTT.mjs → DNAXbbB8DGE2xeHy.mjs} +2 -2
  31. package/browser/esm/{BMo2_9Ul36IwRm3S.mjs → DQTUUXcERWI4l0to.mjs} +2 -2
  32. package/browser/esm/{C2PvZwqK-uvsugVS.mjs → DpFowFtk9AeU-89B.mjs} +1 -1
  33. package/browser/esm/{r-o0UCm7KtluNmyK.mjs → DyRVg5YJn7voOO6z.mjs} +2 -2
  34. package/browser/esm/{DW3oQ39IF0bsc_lm.mjs → Pn5Jc-47dk16sYQ4.mjs} +1 -1
  35. package/browser/esm/{BfoE6Dn_GQCIkQD3.mjs → _WWjW2f-YW-AVqAL.mjs} +1 -1
  36. package/browser/esm/{CkZoDPUCK5jMUaeJ.mjs → _lh_Rr5SwLthmbmu.mjs} +7924 -5938
  37. package/browser/esm/index.mjs +367 -366
  38. package/browser/esm/{DvVhatd0J1ch3OCO.mjs → mecFApGwMvcIzlpd.mjs} +36 -36
  39. package/browser/esm/{BqT-ASHP0NVSUUnY.mjs → n4LOSiYtWTzqQa4w.mjs} +661 -661
  40. package/{node/esm/CgdNA3B_GFG_yJiN.mjs → browser/esm/tJB0V8fKbukOYt9U.mjs} +2 -2
  41. package/browser/esm/{C5x0EzqElYGTiTQc.mjs → yRhetuEQfV7moa4B.mjs} +1 -1
  42. package/browser/esm/{e69NcYnKMLnAmqyA.mjs → ybFoQ6IijUJnBeCF.mjs} +1 -1
  43. package/node/esm/{BywIhvYkWk2o7MSW.mjs → 0313aQKBU4DE3v2j.mjs} +1 -1
  44. package/node/esm/{C884edhUf9yMqpPp.mjs → 3gjEEXV2aSt7cKeD.mjs} +1 -1
  45. package/node/esm/{BfPBiAgVmWhuFgFP.mjs → 3smtwEJ0ASF0tKBY.mjs} +2 -2
  46. package/node/esm/{_RIAmJI98l6bIFfZ.mjs → 4k3KKByrUw2Wr2TX.mjs} +1 -1
  47. package/node/esm/{Bknw7zWZhl2-w1pi.mjs → 90jp-mCVEr43zZTj.mjs} +2 -2
  48. package/node/esm/{DfWc3nW_Z_qqc_Wf.mjs → BAEmzj0gb8Cbgz7p.mjs} +3293 -3293
  49. package/node/esm/{CERNLhFrAwtu_p-q.mjs → BBC5dL9bXzOrQDGY.mjs} +1 -1
  50. package/node/esm/{CDHY-0OyQ9348Brb.mjs → BV0cJ_YP_0qzJuPt.mjs} +180 -180
  51. package/node/esm/{DvtyKKzOnoOM80NB.mjs → BcxcYoF_4GFL7Zkl.mjs} +15 -15
  52. package/node/esm/{DOt3t-13tsnM7Fj6.mjs → BesaVk0x7UyfLDk2.mjs} +1 -1
  53. package/node/esm/{Dhv9JymnXqcF54oo.mjs → C-LmDC9oNcbENOK1.mjs} +1 -1
  54. package/node/esm/{BvIPsPiHhMclZ1kH.mjs → CDkUQn5AwYGomlsT.mjs} +36 -36
  55. package/node/esm/{BH8J6vKSO5zI_TWo.mjs → CE4I5qfVmUBf7mED.mjs} +1 -1
  56. package/node/esm/{C_fYuynP2a_70WdL.mjs → CO0UDgbkHGwyTfev.mjs} +1 -1
  57. package/node/esm/{DgnwKbUEyQN5_gWT.mjs → CTWihjVB5uFX7U4j.mjs} +2 -2
  58. package/node/esm/{Cxak8i2NidZ4Uv6v.mjs → CUNaLYCntlclipWu.mjs} +497 -497
  59. package/node/esm/{RTwm9ge1KoPdlBNt.mjs → CY9JqXFJTt5pGhC3.mjs} +1 -1
  60. package/node/esm/{DELfV5HQZo1mInBd.mjs → C_Sqy290v4uzyi1E.mjs} +3 -3
  61. package/node/esm/{BLmdKnkLwkb3wWe6.mjs → Cf-cK3yPe9bjK6o2.mjs} +561 -561
  62. package/node/esm/{CVPieTgKCwkL21nD.mjs → CpvUwhAeDmdEpdR-.mjs} +10662 -8680
  63. package/{browser/esm/C_jLGkFemj55_BP3.mjs → node/esm/Crhg3srH-O5sJERh.mjs} +2 -2
  64. package/node/esm/{CJDV8P3hI8lu--3Z.mjs → Cx2U91jhiTDz600y.mjs} +116 -116
  65. package/node/esm/{BZSxu_ZqX8-Uczzn.mjs → CyWWKan_uk4dHZ6P.mjs} +1 -1
  66. package/node/esm/{CLtUMJfKsy4SevWE.mjs → D48MjKzkj37XsVm1.mjs} +2 -2
  67. package/node/esm/{kaiXmn0AA5WDsLPo.mjs → D7c0zfLVoG7EEln5.mjs} +43 -43
  68. package/node/esm/{A3PEHO1HJvkHfb5n.mjs → D8J4JmOPwG_Yr2GD.mjs} +1 -1
  69. package/node/esm/{By2TFKOjA1HekZap.mjs → D91qb21TrJX98Rw8.mjs} +3 -3
  70. package/node/esm/{D88A3UpCyGRjcX3U.mjs → D9D2NyyKbWXpTj5I.mjs} +2 -2
  71. package/node/esm/{mTIhoz1gEcaEm7s1.mjs → DBF7pIpitcmhi65H.mjs} +2 -2
  72. package/node/esm/{KDGrIa9R5XzWfjM2.mjs → DLPVrV723TSxkXqL.mjs} +1 -1
  73. package/node/esm/{Cs3ibv6YHCDwLRlk.mjs → DWsnb-a-9dfRn5jJ.mjs} +24 -24
  74. package/node/esm/{B4WUGzJBkQu7BXRm.mjs → Dj1pybJRqeZiP1Z6.mjs} +1 -1
  75. package/node/esm/{DBIUe2BC9xU7qMHR.mjs → DtNJOImWtsXVrQps.mjs} +2 -2
  76. package/node/esm/{5OfKfTRX2_y2NwpU.mjs → DxROQlX1KHLb9tHS.mjs} +1 -1
  77. package/node/esm/{446KYBjJQa8g-8Gg.mjs → dp4LxzOEkfTbVX_1.mjs} +21 -21
  78. package/node/esm/{C3zyhnMwQ2hRQBz7.mjs → ee_DgHTffiVTOiU2.mjs} +21 -21
  79. package/node/esm/{CFkX_Cn6avQqQiVC.mjs → fMFapG4AGMQKX8c5.mjs} +33 -33
  80. package/node/esm/index.mjs +545 -544
  81. package/node/esm/{CKwiipdPJGzAiPjg.mjs → jmElgIMAkpc2Ab1m.mjs} +1 -1
  82. package/node/esm/{bIGdvfpnijWeCac6.mjs → yVJ2lEYZob1gwiRZ.mjs} +14 -14
  83. package/package.json +6 -6
  84. package/resources/locales/de/model.msg.json +15 -0
  85. package/resources/locales/en/model.msg.json +15 -0
  86. package/types/scripting-api.json +11445 -11299
  87. package/types/scripting-enums.json +22 -1
  88. package/types/scripting.d.ts +623 -0
  89. package/types/src/address/index.d.ts +2 -0
  90. package/types/src/anomalies/_Anomalies.d.ts +34 -0
  91. package/types/src/anomalies/_CompletenessChecks.d.ts +32 -0
  92. package/types/src/cell/ICell.d.ts +36 -1
  93. package/types/src/cellRange/ICellRange.d.ts +106 -0
  94. package/types/src/index.d.ts +1 -0
  95. package/types/src/license/runtime.browser.d.ts +3 -1
  96. package/types/src/sheet/IWorksheet.d.ts +17 -0
  97. package/types/src/sheet/SheetCell.d.ts +3 -0
  98. package/types/src/sheet/SheetRange.d.ts +6 -0
  99. package/types/src/sheet/Worksheet.d.ts +103 -1
  100. package/types/src/sheet/_ListenerAnchor.d.ts +14 -0
  101. package/types/src/sheet/_SheetStateTypes.d.ts +13 -0
  102. package/types/src/sparkline/ISparklineGroup.d.ts +338 -0
  103. package/types/src/sparkline/ISparklineGroupCollection.d.ts +68 -0
  104. package/types/src/sparkline/SparklineGroup.d.ts +271 -0
  105. package/types/src/sparkline/SparklineGroupCollection.d.ts +25 -0
  106. package/types/src/sparkline/SparklineRanges.d.ts +195 -0
  107. package/types/src/sparkline/index.d.ts +4 -0
  108. package/types/src/sparkline/layout/SparklineLayout.d.ts +71 -0
  109. package/types/src/sparkline/layout/_layoutSparkline.d.ts +42 -0
  110. package/types/src/sparkline/layout/index.d.ts +2 -0
@@ -1,16 +1,16 @@
1
1
  /**
2
- * @license @sheetxl/sdk - SDK - A high-performance, embeddable spreadsheet engine. - v0.8.0-beta.16
2
+ * @license @sheetxl/sdk - SDK - A high-performance, embeddable spreadsheet engine. - v0.8.0-beta.18
3
3
  *
4
4
  * (C) 2026-present SheetXL Inc. & Michael T. Ford
5
5
  * License: SheetXL EULA — https://www.sheetxl.com/eula
6
6
  */
7
- import { n as e, u as t } from "./D807piM0VSokWz-L.mjs";
8
- import { $ as n, $a as r, $i as i, Ba as a, Ca as o, Ct as s, Di as c, Ea as l, Fa as u, G as d, Ga as f, Gi as p, H as m, Ha as h, Ia as g, J as _, Ja as v, Ji as y, Jr as b, K as x, Ka as S, Ki as C, Kr as w, Kt as T, La as E, Ma as D, Mt as O, N as k, Na as A, Nt as j, P as ee, Pa as M, Pr as N, Q as te, Qa as P, Qi as ne, Qn as re, Ra as ie, Rt as ae, St as oe, U as se, Ua as ce, V as le, Va as ue, W as de, Wa as fe, Wi as pe, X as me, Xa as F, Xi as he, Y as ge, Ya as _e, Z as ve, Za as ye, _i as be, _t as I, aa as xe, ao as Se, ar as Ce, at as we, bi as Te, bt as Ee, c as De, ca as Oe, ci as L, cr as R, ct as ke, d as Ae, dr as je, dt as Me, ea as Ne, ei as Pe, eo as Fe, et as Ie, fi as Le, fr as Re, ft as ze, g as Be, gt as Ve, h as He, ht as Ue, it as We, jt as z, l as Ge, la as Ke, li as qe, lr as Je, lt as Ye, m as Xe, mi as Ze, mt as Qe, n as $e, na as et, no as tt, nt, o as rt, oa as it, or as at, ot, pa as st, pi as B, pt as ct, q as lt, qa as ut, rt as dt, sa as ft, sr as pt, st as mt, t as ht, ta as gt, to as _t, tt as vt, u as V, ui as yt, ur as bt, ut as xt, vi as St, vt as Ct, wa as wt, xt as Tt, yi as Et, yt as Dt, za as Ot, zr as kt } from "./CkZoDPUCK5jMUaeJ.mjs";
9
- import { Mt as At, Nt as jt, Ot as Mt, Tt as Nt, kt as Pt, mt as Ft, zt as It } from "./CMChv-fCFh68VQQt.mjs";
10
- import { A as Lt, O as Rt, S as zt, _ as Bt, a as Vt, b as Ht, g as Ut, j as Wt, k as Gt, t as Kt } from "./BWY1qiidTUBVPJoD.mjs";
11
- import { n as qt } from "./9YWdxmSjzLN4j_ts.mjs";
12
- import { _ as Jt, a as Yt, c as Xt, d as Zt, f as Qt, g as $t, h as H, i as en, l as tn, m as nn, n as rn, o as an, p as on, s as sn, t as cn, u as ln } from "./WcHfawW2lkTHtWUd.mjs";
13
- import { a as un, i as dn, l as fn, n as pn, r as mn, s as hn } from "./4MbBwfmW2hDXk9_w.mjs";
7
+ import { n as e, u as t } from "./BtVpErObXYKJCwHG.mjs";
8
+ import { $ as n, $a as r, $i as i, $n as a, Ba as o, Br as s, Ct as c, Da as l, Fa as u, Fr as d, G as f, Ga as p, Gi as m, H as h, Ha as g, Ia as _, J as v, Ja as y, K as b, Ka as x, Ki as S, La as C, Mt as w, N as T, Na as E, Nt as D, Oi as O, P as k, Pa as A, Q as ee, Qa as te, Ra as ne, Rt as j, St as M, Ta as re, U as ie, Ua as ae, V as oe, Va as se, W as ce, Wa as le, X as ue, Xa as de, Y as fe, Ya as N, Yi as pe, Yr as me, Z as he, Za as P, Zi as ge, _t as _e, at as ve, bi as ye, bt as be, c as xe, ca as F, cr as Se, ct as I, d as Ce, di as we, dr as Te, dt as Ee, ea as De, eo as L, et as R, fr as Oe, ft as ke, g as Ae, gt as je, h as Me, hi as Ne, ht as Pe, it as Fe, jt as z, l as Ie, la as Le, li as Re, lr as ze, lt as Be, m as Ve, ma as He, mi as B, mt as Ue, n as We, na as Ge, no as Ke, nt as qe, o as Je, oa as Ye, oo as Xe, or as Ze, ot as Qe, pi as $e, pr as et, pt as tt, q as nt, qa as rt, qi as it, qr as at, qt as ot, ra as st, ro as ct, rt as lt, sa as ut, sr as dt, st as ft, t as pt, ta as mt, ti as ht, to as gt, tt as _t, u as V, ua as vt, ui as yt, ur as bt, ut as xt, vi as St, vt as Ct, wa as wt, xi as Tt, xt as Et, yi as Dt, yt as Ot, za as kt } from "./_lh_Rr5SwLthmbmu.mjs";
9
+ import { Mt as At, Nt as jt, Ot as Mt, Tt as Nt, kt as Pt, mt as Ft, zt as It } from "./0Mw5Ew_7tAiWgc5J.mjs";
10
+ import { A as Lt, O as Rt, S as zt, _ as Bt, a as Vt, b as Ht, g as Ut, j as Wt, k as Gt, t as Kt } from "./By7_c19Kv2YQaDVF.mjs";
11
+ import { n as qt } from "./CXQLYHAhE5MLKxZ4.mjs";
12
+ import { _ as Jt, a as Yt, c as Xt, d as Zt, f as Qt, g as $t, h as H, i as en, l as tn, m as nn, n as rn, o as an, p as on, s as sn, t as cn, u as ln } from "./DJuiV0Y8olnwuqB-.mjs";
13
+ import { a as un, i as dn, l as fn, n as pn, r as mn, s as hn } from "./D2P43UD6TGSXErhr.mjs";
14
14
  import { FormulaContext as gn, FormulaError as U, IRange as W, ScalarType as _n, WildCard as vn, isLazyValue as yn } from "@sheetxl/primitives";
15
15
  import { CommonUtils as G, CoordUtils as K, OutOfBoundsError as bn, RangeAxis as xn, hashText as Sn, keyedRandom as Cn, messageKey as wn } from "@sheetxl/utils";
16
16
  var Tn = class e {
@@ -20,7 +20,7 @@ var Tn = class e {
20
20
  _materialize() {
21
21
  let e = this._grid;
22
22
  if (!e) {
23
- e = new u({
23
+ e = new _({
24
24
  axis: this._axis,
25
25
  maxCoords: this._maxCoords
26
26
  });
@@ -76,17 +76,17 @@ var Tn = class e {
76
76
  if (t) return t.entries(e);
77
77
  if (e?.processRowSkip || e?.processColumnSkip) return this._materialize().entries(e);
78
78
  let n = this._value;
79
- if (n == null) return r;
80
- let i = e?.bounds;
81
- if (i && ((i.colStart ?? 0) > 0 || (i.rowStart ?? 0) > 0 || (i.colEnd ?? 0) < 0 || (i.rowEnd ?? 0) < 0)) return r;
82
- let o = e?.axis ? e.axis === xn.Column : this._axis === xn.Column, s = e ? a(e.reuseResult) : void 0, c = this, l = !1, u = null;
79
+ if (n == null) return L;
80
+ let r = e?.bounds;
81
+ if (r && ((r.colStart ?? 0) > 0 || (r.rowStart ?? 0) > 0 || (r.colEnd ?? 0) < 0 || (r.rowEnd ?? 0) < 0)) return L;
82
+ let i = e?.axis ? e.axis === xn.Column : this._axis === xn.Column, a = e ? se(e.reuseResult) : void 0, o = this, s = !1, c = null;
83
83
  return {
84
- next: (t) => u ? u.next(t) : t ? (u = c._materialize().entries(e), u.next(t)) : l ? Fe : (l = !0, ie(0, 0, n, o, s)),
84
+ next: (t) => c ? c.next(t) : t ? (c = o._materialize().entries(e), c.next(t)) : s ? gt : (s = !0, kt(0, 0, n, i, a)),
85
85
  [Symbol.iterator]() {
86
86
  return this;
87
87
  },
88
- return: (e) => Fe,
89
- throw: (e) => Fe
88
+ return: (e) => gt,
89
+ throw: (e) => gt
90
90
  };
91
91
  }
92
92
  keys(e) {
@@ -238,7 +238,7 @@ var Tn = class e {
238
238
  _getOrCreate2D(e) {
239
239
  if (!e) throw Error(On);
240
240
  let t = this._mapScopeTo2Ds.get(e);
241
- return t || (t = new v(this._options2D), this._mapScopeTo2Ds.set(e, t), this._last2DKey = e, this._last2DMap = t), t;
241
+ return t || (t = new N(this._options2D), this._mapScopeTo2Ds.set(e, t), this._last2DKey = e, this._last2DMap = t), t;
242
242
  }
243
243
  _cleanupEmpty2D(e, t) {
244
244
  t?.isEmpty() && (this._mapScopeTo2Ds.delete(e), this._last2DKey === e && (this._last2DKey = void 0, this._last2DMap = void 0));
@@ -257,7 +257,7 @@ var Tn = class e {
257
257
  return n.isLambdaCallable = !0, n.checkArity = (n) => n >= t && n <= e.length, n.paramCount = e.length, n;
258
258
  }
259
259
  _function() {
260
- return this._asFunction ??= R(this);
260
+ return this._asFunction ??= ze(this);
261
261
  }
262
262
  execute(...e) {
263
263
  return this._function().execute(...e);
@@ -295,7 +295,7 @@ var Tn = class e {
295
295
  try {
296
296
  return e.execute(...t);
297
297
  } catch (e) {
298
- if (Re(e)) throw e;
298
+ if (et(e)) throw e;
299
299
  return U.isError(e) ? e : new U.Value(e?.message, { cause: e });
300
300
  }
301
301
  };
@@ -336,17 +336,17 @@ var Tn = class e {
336
336
  let a = i === "display", o = this._compiled;
337
337
  if (o.error && !o.ast) return o.error.input;
338
338
  let s = r === void 0 ? o.getTokens() : Ut(o.ast, r);
339
- s = ct(s, o.symbols, !a, a, a ? {
339
+ s = tt(s, o.symbols, !a, a, a ? {
340
340
  scope: this._gridId,
341
341
  rowIndex: e,
342
342
  colIndex: t
343
343
  } : null);
344
- let c = a ? this._displayLocale() : qe;
345
- return n ? Ve(s, this._getEntireCoords?.(), c) : Qe(s, this._getEntireCoords?.(), e, t, c);
344
+ let c = a ? this._displayLocale() : yt;
345
+ return n ? je(s, this._getEntireCoords?.(), c) : Ue(s, this._getEntireCoords?.(), e, t, c);
346
346
  }
347
347
  _displayLocale() {
348
348
  let e = this._context.getRuntime().getLocaleProfile();
349
- return yt(Le(e.decimal));
349
+ return we($e(e.decimal));
350
350
  }
351
351
  getRecord() {
352
352
  let e = this._record;
@@ -399,7 +399,7 @@ var Tn = class e {
399
399
  }
400
400
  getTokensAt(e, t, n) {
401
401
  let r = this._compiled, i = n === void 0 ? r.getTokens() : Ut(r.ast, n);
402
- return i = ct(i, r.symbols, !1, !0), Ue(i, e, t);
402
+ return i = tt(i, r.symbols, !1, !0), Pe(i, e, t);
403
403
  }
404
404
  getError() {
405
405
  return this._compiled.error ?? null;
@@ -453,7 +453,7 @@ var Tn = class e {
453
453
  let n = this._compiled.getTokens(), r = t._compiled.getTokens();
454
454
  if (n.length !== r.length) return !1;
455
455
  let i = this._context.getEntireCoords();
456
- return Ve(n, i) === Ve(r, i);
456
+ return je(n, i) === je(r, i);
457
457
  }
458
458
  getReferences(e, t) {
459
459
  let n = this._compiled, r = n.referenceIndices, i = r.length;
@@ -492,7 +492,7 @@ var Tn = class e {
492
492
  }
493
493
  getReferencesAt(e, t) {
494
494
  let n = this.getReferences(e, t);
495
- return n.length === 0 ? G.EmptyArray : ze(n, e, t);
495
+ return n.length === 0 ? G.EmptyArray : ke(n, e, t);
496
496
  }
497
497
  getFormatReferences() {
498
498
  let e = this._formatReferences;
@@ -519,44 +519,44 @@ var Tn = class e {
519
519
  if (a.length === 0) return null;
520
520
  let o = i.referencesExecute;
521
521
  t < 0 && (t = a.length + t);
522
- let s = a[t];
523
- if (s === void 0) throw Error(`Invalid reference index: ${t}`);
524
- let c = o[s], l = c.node, u = l.inputs ?? G.EmptyArray, d = c.op === B.Named, f = u.length === 2, p, m, h = !1;
525
- n && U.isError(n) && (n = null), n && "nameId" in n && !d && (n = null);
526
- let g = n && "nameId" in n ? null : n, _ = !!g && g.colIndex !== void 0;
527
- if (g) {
528
- if (_) {
529
- let e = g;
530
- p = {
522
+ let c = a[t];
523
+ if (c === void 0) throw Error(`Invalid reference index: ${t}`);
524
+ let l = o[c], u = l.node, f = u.inputs ?? G.EmptyArray, p = l.op === B.Named, m = f.length === 2, h, g, _ = !1;
525
+ n && U.isError(n) && (n = null), n && "nameId" in n && !p && (n = null);
526
+ let v = n && "nameId" in n ? null : n, y = !!v && v.colIndex !== void 0;
527
+ if (v) {
528
+ if (y) {
529
+ let e = v;
530
+ h = {
531
531
  colIndex: e.colIndex,
532
532
  rowIndex: e.rowIndex,
533
533
  $colIndex: e.$colIndex ?? !1,
534
534
  $rowIndex: e.$rowIndex ?? !1
535
- }, e.scope && (p.scope = e.scope), h = !1;
535
+ }, e.scope && (h.scope = e.scope), _ = !1;
536
536
  } else {
537
- let e = g;
538
- p = {
537
+ let e = v;
538
+ h = {
539
539
  colIndex: e.colStart,
540
540
  rowIndex: e.rowStart,
541
541
  $colIndex: e.$colStart ?? !1,
542
542
  $rowIndex: e.$rowStart ?? !1
543
- }, e.scope && (p.scope = e.scope), h = f || !K.isSingleCell(e), h && (m = {
543
+ }, e.scope && (h.scope = e.scope), _ = m || !K.isSingleCell(e), _ && (g = {
544
544
  colIndex: e.colEnd,
545
545
  rowIndex: e.rowEnd,
546
546
  $colIndex: e.$colEnd ?? !1,
547
547
  $rowIndex: e.$rowEnd ?? !1
548
- }, e.colEnd === 2 ** 53 - 1 && (m.colIndex = -(2 ** 53 - 1)), e.rowEnd === 2 ** 53 - 1 && (m.rowIndex = -(2 ** 53 - 1)));
548
+ }, e.colEnd === 2 ** 53 - 1 && (g.colIndex = -(2 ** 53 - 1)), e.rowEnd === 2 ** 53 - 1 && (g.rowIndex = -(2 ** 53 - 1)));
549
549
  }
550
550
  }
551
- let v = _ && f, y = -1, x = -1, S = -1, C = -1;
552
- if (f) y = u[0].evalIndex, x = u[1].evalIndex;
553
- else if (l.type === "cell") y = l.evalIndex;
554
- else if (c.op === B.TableReference) S = l.evalIndex;
551
+ let b = y && m, x = -1, S = -1, C = -1, w = -1;
552
+ if (m) x = f[0].evalIndex, S = f[1].evalIndex;
553
+ else if (u.type === "cell") x = u.evalIndex;
554
+ else if (l.op === B.TableReference) C = u.evalIndex;
555
555
  else {
556
- if (!d) throw Error(`Invalidate reference index: ${t}`);
557
- C = l.evalIndex;
556
+ if (!p) throw Error(`Invalidate reference index: ${t}`);
557
+ w = u.evalIndex;
558
558
  }
559
- let w = (...e) => {
559
+ let T = (...e) => {
560
560
  if (r?.scopeDeleted) return null;
561
561
  let t = this._compiled.symbols;
562
562
  for (let n = 0; n < e.length; n++) {
@@ -564,12 +564,12 @@ var Tn = class e {
564
564
  if (r) return t && !t.resolve(z.Sheet, r) ? null : r;
565
565
  }
566
566
  return null;
567
- }, T = l, E = this._compiled.ast, D = L(E, (e) => {
567
+ }, E = u, D = this._compiled.ast, O = Re(D, (e) => {
568
568
  if (!e || !e.isReference) return;
569
- if (v && e === T) return N(p);
569
+ if (b && e === E) return d(h);
570
570
  let t = e.type;
571
- if (C !== -1 && e.evalIndex === C && t === B.Named) {
572
- if (!n) return b();
571
+ if (w !== -1 && e.evalIndex === w && t === B.Named) {
572
+ if (!n) return me();
573
573
  if (n && "nameId" in n) {
574
574
  let t = n, r = this._compiled.symbols?.bind(z.NamedFormula, t.nameId) ?? t.nameId, i = { ...e };
575
575
  return i.value = {
@@ -578,31 +578,31 @@ var Tn = class e {
578
578
  nameId: r
579
579
  }, i;
580
580
  }
581
- return h ? kt(":", N(p), N(m), !0) : N(p);
581
+ return _ ? s(":", d(h), d(g), !0) : d(h);
582
582
  }
583
- if (S !== -1 && e.evalIndex === S && t === B.TableReference) return n ? h ? kt(":", N(p), N(m), !0) : N(p) : b();
583
+ if (C !== -1 && e.evalIndex === C && t === B.TableReference) return n ? _ ? s(":", d(h), d(g), !0) : d(h) : me();
584
584
  if (!n && zt.includes(e.value)) {
585
- let t = e.inputs ?? G.EmptyArray, n = t[0], r = t[1], i = n.evalIndex === y, a = r.evalIndex === x;
585
+ let t = e.inputs ?? G.EmptyArray, n = t[0], r = t[1], i = n.evalIndex === x, a = r.evalIndex === S;
586
586
  if (i || a) {
587
- let t = b(void 0, void 0, w(n, r));
587
+ let t = me(void 0, void 0, T(n, r));
588
588
  return t.evalIndex = e.evalIndex, t;
589
589
  }
590
590
  }
591
591
  if (t !== "cell" && t !== "error") return;
592
- let r = e.evalIndex, i, a = r === y;
593
- if ((a || r === x) && !v) {
592
+ let r = e.evalIndex, i, a = r === x;
593
+ if ((a || r === S) && !b) {
594
594
  if (n) {
595
- if (f === h) {
596
- let t = a ? p : m;
595
+ if (m === _) {
596
+ let t = a ? h : g;
597
597
  i = { ...e }, i.value = t, i.image = null;
598
- } else i = kt(":", N(p), N(m), !0);
599
- } else i = b(void 0, void 0, w(e)), i.evalIndex = e.evalIndex;
598
+ } else i = s(":", d(h), d(g), !0);
599
+ } else i = me(void 0, void 0, T(e)), i.evalIndex = e.evalIndex;
600
600
  return i;
601
601
  }
602
602
  });
603
- if (D === E) return this;
604
- let O = Vt(i.runtime, i.symbols, D, !1, i.error, i.getFunction);
605
- return new e(O, this._context, this._calcScope, this._gridId, this._getEntireCoords, this._resolvers);
603
+ if (O === D) return this;
604
+ let k = Vt(i.runtime, i.symbols, O, !1, i.error, i.getFunction);
605
+ return new e(k, this._context, this._calcScope, this._gridId, this._getEntireCoords, this._resolvers);
606
606
  }
607
607
  reanchorReferences(t, n) {
608
608
  let r = this._compiled, i = this._gridId, a = this._compiled.symbols.bind(z.Sheet, t), o = r.transform((e, t) => {
@@ -663,70 +663,70 @@ var Tn = class e {
663
663
  let i = this._resolvers?.getStructureReferenceCoords;
664
664
  return i ? i(e, t, n, this._gridId) : U.BuiltIn.Name;
665
665
  }
666
- resolvedPrecedentsAt(e, t, n = !1, r, i) {
667
- let a = this._compiled, o = a.referencesRoot, s = o.length;
668
- if (s === 0) return G.EmptyArray;
669
- let c = a.referencesRelative, l = a.referencesAbsolute, u = c.length;
670
- for (let n = 0; n < u; n++) In(c[n], e, t, l[n]);
671
- let d = a.referencesExecute, f = d.length, p = [];
672
- for (let n = 0; n < f; n++) {
673
- let r = d[n], i = r.op;
674
- if (!i) {
675
- let e = l[r.value];
676
- p[r.index] = e;
666
+ resolvedPrecedentsAt(e, t, n = !1, r, a) {
667
+ let o = this._compiled, s = o.referencesRoot, c = s.length;
668
+ if (c === 0) return G.EmptyArray;
669
+ let l = o.referencesRelative, u = o.referencesAbsolute, d = l.length;
670
+ for (let n = 0; n < d; n++) In(l[n], e, t, u[n]);
671
+ let f = o.referencesExecute, p = f.length, m = [];
672
+ for (let n = 0; n < p; n++) {
673
+ let r = f[n], a = r.op;
674
+ if (!a) {
675
+ let e = u[r.value];
676
+ m[r.index] = e;
677
677
  continue;
678
678
  }
679
- if (i === B.Named) {
680
- p[r.index] = this._resolveNamedPrecedents(r.node.value, e, t);
679
+ if (a === B.Named) {
680
+ m[r.index] = this._resolveNamedPrecedents(r.node.value, e, t);
681
681
  continue;
682
682
  }
683
- if (i === B.Error) {
684
- p[r.index] = Pe(r.node.value);
683
+ if (a === B.Error) {
684
+ m[r.index] = ht(r.node.value);
685
685
  continue;
686
686
  }
687
- if (i === B.TableReference) {
687
+ if (a === B.TableReference) {
688
688
  let n = r.node.value, i;
689
- n && (i = this._resolveStructuredRef(n, e, t)), i ||= U.BuiltIn.Ref, p[r.index] = i;
689
+ n && (i = this._resolveStructuredRef(n, e, t)), i ||= U.BuiltIn.Ref, m[r.index] = i;
690
690
  continue;
691
691
  }
692
- if (i === "@" || i === "#") {
693
- let e = p[r.inputs[0]];
694
- p[r.index] = e === void 0 ? U.BuiltIn.Value : e;
692
+ if (a === "@" || a === "#") {
693
+ let e = m[r.inputs[0]];
694
+ m[r.index] = e === void 0 ? U.BuiltIn.Value : e;
695
695
  continue;
696
696
  }
697
- let a = r.inputs;
698
- if (!a) continue;
699
- let o = p[a[0]];
700
- if (o === void 0) {
701
- p[r.index] = U.BuiltIn.Value;
697
+ let o = r.inputs;
698
+ if (!o) continue;
699
+ let s = m[o[0]];
700
+ if (s === void 0) {
701
+ m[r.index] = U.BuiltIn.Value;
702
702
  continue;
703
703
  }
704
- if (U.isError(o)) {
705
- p[r.index] = o;
704
+ if (U.isError(s)) {
705
+ m[r.index] = s;
706
706
  continue;
707
707
  }
708
- let s, c = p[a[1]];
709
- if (c !== void 0) {
710
- if (U.isError(c)) p[r.index] = c;
708
+ let c, l = m[o[1]];
709
+ if (l !== void 0) {
710
+ if (U.isError(l)) m[r.index] = l;
711
711
  else {
712
- if (i === " ") {
713
- let e = o.scope ? c.scope ? null : o.scope : c.scope;
714
- s = e && this._gridId && e !== this._gridId ? U.BuiltIn.Value : ne(o, c);
715
- } else if (i === ":" || i === ".:." || i === ":." || i === ".:") s = Ke(o, c);
716
- else if (i === ",") {
717
- let e = a.length;
712
+ if (a === " ") {
713
+ let e = s.scope ? l.scope ? null : s.scope : l.scope;
714
+ c = e && this._gridId && e !== this._gridId ? U.BuiltIn.Value : i(s, l);
715
+ } else if (a === ":" || a === ".:." || a === ":." || a === ".:") c = vt(s, l);
716
+ else if (a === ",") {
717
+ let e = o.length;
718
718
  for (let t = 0; t < e; t++) {
719
- let e = p[a[t]];
720
- e === void 0 || Array.isArray(e) || U.isError(e) || (s = s ? Ke(s, e) : e);
719
+ let e = m[o[t]];
720
+ e === void 0 || Array.isArray(e) || U.isError(e) || (c = c ? vt(c, e) : e);
721
721
  }
722
722
  }
723
- p[r.index] = s ?? U.BuiltIn.Null;
723
+ m[r.index] = c ?? U.BuiltIn.Null;
724
724
  }
725
- } else p[r.index] = U.BuiltIn.Value;
725
+ } else m[r.index] = U.BuiltIn.Value;
726
726
  }
727
- let m = [], h = 0;
728
- for (let e = 0; e < s; e++) h = Ln(o[e], d, p, m, h, r, i);
729
- return m;
727
+ let h = [], g = 0;
728
+ for (let e = 0; e < c; e++) g = Ln(s[e], f, m, h, g, r, a);
729
+ return h;
730
730
  }
731
731
  getPrecedentTemplate() {
732
732
  let e = this._precedentTemplate;
@@ -741,7 +741,7 @@ var Tn = class e {
741
741
  }
742
742
  let a = t.op, d, f = null;
743
743
  if (a) {
744
- if (a === B.Error) d = Pe(t.node.value);
744
+ if (a === B.Error) d = ht(t.node.value);
745
745
  else if (a === ":" || a === ".:." || a === ":." || a === ".:") {
746
746
  let e = t.inputs;
747
747
  if (e && e.length === 2) {
@@ -769,7 +769,7 @@ var Tn = class e {
769
769
  let i = this._context, a = this._compiled;
770
770
  if (n !== void 0) {
771
771
  let r;
772
- if (L(a.ast, (e) => {
772
+ if (Re(a.ast, (e) => {
773
773
  e.evalIndex === n && (r = e);
774
774
  }), !r) throw Error(`Invalid evalIndex: ${n}`);
775
775
  if (a.bindings.length > 0 && !a.error) {
@@ -793,7 +793,7 @@ var Tn = class e {
793
793
  let n = r.node.value;
794
794
  o[r.node.evalIndex] = this._evaluateNamed(n, e, t);
795
795
  }
796
- } else if (a === B.Error) o[s.evalIndex] = Pe(r.node.value);
796
+ } else if (a === B.Error) o[s.evalIndex] = ht(r.node.value);
797
797
  else if (a === B.TableReference) {
798
798
  let n = r.node.value, a;
799
799
  a = n ? this._resolveStructuredRef(n, e, t) : U.BuiltIn.Ref, U.isError(a) || a?.colStart === void 0 ? o[s.evalIndex] = a ?? U.BuiltIn.Ref : o[s.evalIndex] = i.getReference(a);
@@ -808,9 +808,9 @@ var Tn = class e {
808
808
  wrapImplicit(t, n, r) {
809
809
  let i = this._compiled, a = i.ast;
810
810
  if (!a || !a.isReference || a.type === "cell" || a.type === B.Error || a.value === "@" || !r) return this;
811
- let o = C(n) + et(t);
811
+ let o = it(n) + st(t);
812
812
  if (r.has(o)) return this;
813
- let s = w("@", a, !0), c = Vt(i.runtime, i.symbols, s, !1, i.error, i.getFunction);
813
+ let s = at("@", a, !0), c = Vt(i.runtime, i.symbols, s, !1, i.error, i.getFunction);
814
814
  return new e(c, this._context, this._calcScope, this._gridId, this._getEntireCoords, this._resolvers);
815
815
  }
816
816
  _executeNode(e, t, n, r, i = null) {
@@ -820,24 +820,24 @@ var Tn = class e {
820
820
  let n = e.value, r = t[o[0].evalIndex], i = t[o[1].evalIndex];
821
821
  if (!0 === e.firstCell && !e.isReference && this._demandsFirstCell() && (r = Fn(r), i = Fn(i)), (n === "+" || n === "-") && (r = Pn(a, r), typeof r == "number" && (i = Pn(a, i), typeof i == "number"))) {
822
822
  let t = n === "+" ? r + i : r - i;
823
- return He(!0 === e.snapsCancellation ? Me(t, r) : t, null);
823
+ return Me(!0 === e.snapsCancellation ? Ee(t, r) : t, null);
824
824
  }
825
825
  if (!e.isReference) {
826
826
  if (r && U.isError(r)) return r;
827
827
  if (i && U.isError(i)) return i;
828
828
  }
829
829
  let s = e.fn ??= !0 === e.snapsCancellation ? Wt[e.value] : Rt[e.value];
830
- return l = s ? s(a, r, i) : U.BuiltIn.Value, l = He(l, null), l;
830
+ return l = s ? s(a, r, i) : U.BuiltIn.Value, l = Me(l, null), l;
831
831
  }
832
832
  case B.Function: {
833
833
  let a = e.binder;
834
834
  if (a !== void 0) return a.kind === "let" ? t[o[s - 1].evalIndex] : this._createLambdaValue(e, t, i, n, r);
835
835
  if (!0 === e.hasLazyArgs) {
836
- let a = Je.enter();
836
+ let a = bt.enter();
837
837
  try {
838
- this._fillLazyArgs(o, s, t, i, n, r, a), !0 === e.passOmitted && Bn(o, s), l = this._callFunction(e, zn, s), l instanceof Je && (l = l._force());
838
+ this._fillLazyArgs(o, s, t, i, n, r, a), !0 === e.passOmitted && Bn(o, s), l = this._callFunction(e, zn, s), l instanceof bt && (l = l._force());
839
839
  } finally {
840
- Je.leave(a);
840
+ bt.leave(a);
841
841
  }
842
842
  } else {
843
843
  for (let e = 0; e < s; e++) zn[e] = t[o[e].evalIndex];
@@ -860,7 +860,7 @@ var Tn = class e {
860
860
  if (typeof n == "object" && n && Ct(n.scope)) return U.BuiltIn.Name;
861
861
  }
862
862
  let e = !1;
863
- for (let n = 0; n < s; n++) if (Xe(t[o[n].evalIndex])) {
863
+ for (let n = 0; n < s; n++) if (Ve(t[o[n].evalIndex])) {
864
864
  e = !0;
865
865
  break;
866
866
  }
@@ -868,7 +868,7 @@ var Tn = class e {
868
868
  let e = [];
869
869
  for (let n = 0; n < s; n++) {
870
870
  let r = t[o[n].evalIndex];
871
- Xe(r) ? e.push(...r) : e.push(r);
871
+ Ve(r) ? e.push(...r) : e.push(r);
872
872
  }
873
873
  let n = V(e.length);
874
874
  for (let t = 0; t < e.length; t++) n[t] = e[t];
@@ -909,7 +909,7 @@ var Tn = class e {
909
909
  let t = e[r];
910
910
  if (!0 === t?.lazyArg) continue;
911
911
  let i = n[t.evalIndex];
912
- !c && (!0 === i?.isIRange ? i.size > 1 : Xe(i)) && (c = !0);
912
+ !c && (!0 === i?.isIRange ? i.size > 1 : Ve(i)) && (c = !0);
913
913
  }
914
914
  if (c) {
915
915
  s = [];
@@ -920,7 +920,7 @@ var Tn = class e {
920
920
  }
921
921
  for (let c = 0; c < t; c++) {
922
922
  let t = e[c];
923
- zn[c] = !0 === t?.lazyArg ? s ? s[c] : Je.deferred(o, c, this, t, n, r, i, a) : n[t.evalIndex];
923
+ zn[c] = !0 === t?.lazyArg ? s ? s[c] : bt.deferred(o, c, this, t, n, r, i, a) : n[t.evalIndex];
924
924
  }
925
925
  }
926
926
  _createLambdaValue(e, t, n, r, i) {
@@ -966,7 +966,7 @@ var Tn = class e {
966
966
  i.set(n[e].slot, r === void 0 ? jn : r);
967
967
  }
968
968
  let a = this._evaluateBody(e, i);
969
- return He(a, this._context);
969
+ return Me(a, this._context);
970
970
  }
971
971
  _evaluateBody(e, t) {
972
972
  let n = this._calcScope;
@@ -990,7 +990,7 @@ var Tn = class e {
990
990
  return this._runList(a, t, r, i, n), t[e.evalIndex];
991
991
  } catch (e) {
992
992
  if (U.isError(e)) return e;
993
- if (Re(e)) throw e;
993
+ if (et(e)) throw e;
994
994
  return e instanceof RangeError ? U.BuiltIn.Num : new U.Value(e?.message, { cause: e });
995
995
  }
996
996
  }
@@ -1003,7 +1003,7 @@ var Tn = class e {
1003
1003
  }
1004
1004
  _listWithin(e) {
1005
1005
  let t;
1006
- L(this._compiled.ast, (n, r, i) => {
1006
+ Re(this._compiled.ast, (n, r, i) => {
1007
1007
  if (n === e) {
1008
1008
  for (let e = i.length - 1; e >= 0; e--) if (i[e].deferred !== void 0) {
1009
1009
  t = i[e];
@@ -1012,7 +1012,7 @@ var Tn = class e {
1012
1012
  }
1013
1013
  });
1014
1014
  let n = /* @__PURE__ */ new Set();
1015
- L(e, (e) => {
1015
+ Re(e, (e) => {
1016
1016
  n.add(e);
1017
1017
  });
1018
1018
  let r = t?.deferred?.filter((e) => n.has(e)) ?? [];
@@ -1049,7 +1049,7 @@ var Tn = class e {
1049
1049
  try {
1050
1050
  r = e.execute();
1051
1051
  } catch (e) {
1052
- if (Re(e)) throw e;
1052
+ if (et(e)) throw e;
1053
1053
  r = Hn(e);
1054
1054
  }
1055
1055
  a.argsValues = null, a.argsLength = 0;
@@ -1079,7 +1079,7 @@ var Tn = class e {
1079
1079
  r = e.execute(...i);
1080
1080
  }
1081
1081
  } catch (e) {
1082
- if (Re(e)) throw e;
1082
+ if (et(e)) throw e;
1083
1083
  r = Hn(e);
1084
1084
  }
1085
1085
  let o = this._calcScope;
@@ -1091,7 +1091,7 @@ var Tn = class e {
1091
1091
  }
1092
1092
  finalizeValue(e) {
1093
1093
  let t = this._context;
1094
- if (bt(e) || yn(e)) return U.BuiltIn.Calc;
1094
+ if (Te(e) || yn(e)) return U.BuiltIn.Calc;
1095
1095
  if (e && e.colStart !== void 0) try {
1096
1096
  if (e.scope) {
1097
1097
  let n = t.getReference(e);
@@ -1099,12 +1099,12 @@ var Tn = class e {
1099
1099
  }
1100
1100
  e = t.getValueAt(e.rowStart, e.colStart, e.scope);
1101
1101
  } catch (e) {
1102
- if (Re(e)) throw e;
1102
+ if (et(e)) throw e;
1103
1103
  return U.isError(e) ? e : new U.Value(e?.message, { cause: e });
1104
1104
  }
1105
1105
  if (Array.isArray(e) && e.isSheetSpan) return U.BuiltIn.Ref;
1106
1106
  if (Array.isArray(e)) {
1107
- if (Xe(e)) {
1107
+ if (Ve(e)) {
1108
1108
  let t = V(e.length);
1109
1109
  for (let n = 0; n < e.length; n++) t[n] = this.finalizeValue(e[n]);
1110
1110
  return t;
@@ -1117,7 +1117,7 @@ var Tn = class e {
1117
1117
  }
1118
1118
  }
1119
1119
  var n;
1120
- return e?.isIRange ? e.size <= 1 ? (e = e.size === 0 ? null : e.getValueAt(0, 0, Rn), (e = He(e, t)) === null && (e = 0)) : (n = e, Mn.has(n) || (e = e.fillEmpty(0))) : (e = He(e, t)) === null && (e = 0), e;
1120
+ return e?.isIRange ? e.size <= 1 ? (e = e.size === 0 ? null : e.getValueAt(0, 0, Rn), (e = Me(e, t)) === null && (e = 0)) : (n = e, Mn.has(n) || (e = e.fillEmpty(0))) : (e = Me(e, t)) === null && (e = 0), e;
1121
1121
  }
1122
1122
  finalizeValueForCell(e) {
1123
1123
  let t = this.finalizeValue(e);
@@ -1127,7 +1127,7 @@ var Tn = class e {
1127
1127
  let e = this._compiled;
1128
1128
  if (e.error) return e.error.toString();
1129
1129
  let t = this._calcScope;
1130
- return t?.node ? this.getTextAt(t.node.rowIndex, t.node.colIndex) : Ve(e.getTokens(), null);
1130
+ return t?.node ? this.getTextAt(t.node.rowIndex, t.node.colIndex) : je(e.getTokens(), null);
1131
1131
  }
1132
1132
  get [Symbol.toStringTag]() {
1133
1133
  return "[FormulaBlock]";
@@ -1173,11 +1173,11 @@ var Ln = (e, t, n, r, i, a, o) => {
1173
1173
  }, Vn = (e) => {
1174
1174
  let t = { ...e };
1175
1175
  return delete t.inLazy, delete t.lazyArg, delete t.hasLazyArgs, delete t.deferred, e.inputs && (t.inputs = e.inputs.map((e) => e && Vn(e))), t;
1176
- }, Hn = (e) => U.isError(e) ? e : e instanceof RangeError ? U.BuiltIn.Num : new U.Value(e?.message, { cause: e }), Un = Ge(4096), Wn = 0, Gn = () => Un, Kn = (e, t) => {
1176
+ }, Hn = (e) => U.isError(e) ? e : e instanceof RangeError ? U.BuiltIn.Num : new U.Value(e?.message, { cause: e }), Un = Ie(4096), Wn = 0, Gn = () => Un, Kn = (e, t) => {
1177
1177
  if (t === 0) return void (e.inputsAt = -1);
1178
1178
  let n = Wn, r = n + t;
1179
1179
  if (r > Un.length) {
1180
- let e = Ge(Math.max(r, 2 * Un.length));
1180
+ let e = Ie(Math.max(r, 2 * Un.length));
1181
1181
  for (let t = 0; t < n; t++) e[t] = Un[t];
1182
1182
  Un = e;
1183
1183
  }
@@ -1765,7 +1765,7 @@ var ti = {
1765
1765
  return i === void 0 && (i = this._newNode(e, t, this.gridId, null), r.setValueAt(e, t, i)), i;
1766
1766
  }
1767
1767
  _newSparseStore() {
1768
- let e = new u({ axis: W.Axis.Column }), t = this._anchor;
1768
+ let e = new _({ axis: W.Axis.Column }), t = this._anchor;
1769
1769
  return t !== null && e.setValueAt(t.rowIndex, t.colIndex, t), this._nodes = e, e;
1770
1770
  }
1771
1771
  _mintDense() {
@@ -1825,7 +1825,7 @@ var ti = {
1825
1825
  let i = this._nodes ?? this._newSparseStore(), a = this.ref, o = Math.max(e, a.rowStart), s = Math.min(t, a.rowEnd), c = Math.max(n, a.colStart), l = Math.min(r, a.colEnd);
1826
1826
  if (o > s || c > l) return;
1827
1827
  let u = this.gridId, d = null;
1828
- for (let e = c; e <= l; e++) for (let t = o; t <= s; t++) i.getValueAt(t, e) === void 0 && (d === null && (d = new _e.Builder()), d.pushAt(e, t, this._newNode(t, e, u, null)));
1828
+ for (let e = c; e <= l; e++) for (let t = o; t <= s; t++) i.getValueAt(t, e) === void 0 && (d === null && (d = new de.Builder()), d.pushAt(e, t, this._newNode(t, e, u, null)));
1829
1829
  if (d !== null) {
1830
1830
  let e = d.build();
1831
1831
  e && i.setValues(e.tuples);
@@ -1867,7 +1867,7 @@ var ti = {
1867
1867
  continue;
1868
1868
  }
1869
1869
  In(s, e, t, ti), In(l, e, t, oi);
1870
- let u = Ke(ti, oi, c);
1870
+ let u = vt(ti, oi, c);
1871
1871
  i[n] = u ?? U.BuiltIn.Null;
1872
1872
  }
1873
1873
  return this._scratchRow = e, this._scratchCol = t, i;
@@ -2097,7 +2097,7 @@ var ti = {
2097
2097
  if (c !== null && o.originRow === 0 && o.originCol === 0 && s.rowStart === n && s.colStart === r && s.rowEnd === t.rowEnd && s.colEnd === t.colEnd) return e._nodes = null, this._nodes = c, void this.forEachNode((e) => {
2098
2098
  this._adoptNode(e, e.rowIndex, e.colIndex, null);
2099
2099
  });
2100
- let l = s.rowStart + o.originRow, u = s.colStart + o.originCol, d = n - l, f = r - u, p = new _e.Builder();
2100
+ let l = s.rowStart + o.originRow, u = s.colStart + o.originCol, d = n - l, f = r - u, p = new de.Builder();
2101
2101
  e.forEachNodeIn(l, l + i - 1, u, u + a - 1, (e) => {
2102
2102
  let t = e.rowIndex + d, n = e.colIndex + f;
2103
2103
  this._adoptNode(e, t, n, null), p.pushAt(n, t, e);
@@ -2116,7 +2116,7 @@ var ti = {
2116
2116
  }
2117
2117
  if (s.length === 0) return;
2118
2118
  s.sort(ii);
2119
- let c = new _e.Builder();
2119
+ let c = new de.Builder();
2120
2120
  for (let e = 0; e < s.length; e++) {
2121
2121
  let t = s[e];
2122
2122
  e > 0 && s[e - 1].rowIndex === t.rowIndex && s[e - 1].colIndex === t.colIndex || c.pushAt(t.colIndex, t.rowIndex, t);
@@ -2126,7 +2126,7 @@ var ti = {
2126
2126
  }
2127
2127
  toJSON(e = !1, t = this.ref) {
2128
2128
  let n = t;
2129
- return [i(n), this.formula.getTextAt(n.rowStart, n.colStart, e)];
2129
+ return [De(n), this.formula.getTextAt(n.rowStart, n.colStart, e)];
2130
2130
  }
2131
2131
  getCoords() {
2132
2132
  return this.ref;
@@ -2510,12 +2510,12 @@ var ti = {
2510
2510
  let i = this._container.getGrid(this._calcScope.gridId)?.getEntireCoords(), a = i && e > i.rowEnd + 1 ? {
2511
2511
  ...i,
2512
2512
  rowEnd: e - 1
2513
- } : i, o = new u({
2513
+ } : i, o = new _({
2514
2514
  axis: this._axis,
2515
2515
  maxCoords: a
2516
2516
  });
2517
2517
  for (let e = 0; e < r; e++) o.setValueAt(t[e], 0, n[e]);
2518
- return new $e(this._runtime, o, {
2518
+ return new We(this._runtime, o, {
2519
2519
  colStart: 0,
2520
2520
  rowStart: 0,
2521
2521
  colEnd: 0,
@@ -2548,21 +2548,21 @@ var ti = {
2548
2548
  return this._calcScope.node ? this._container.evaluateWhatIf(e) : null;
2549
2549
  }
2550
2550
  async _initialize(e) {
2551
- let n = await Se.assertUsable("calcs", 0), r = this._container, i = r.getRuntime();
2552
- this._runtime = new tt("Calculation Runtime", {
2551
+ let n = await Xe.assertUsable("calcs", 0), r = this._container, i = r.getRuntime();
2552
+ this._runtime = new ct("Calculation Runtime", {
2553
2553
  isDate1904: () => i.isDate1904(),
2554
2554
  isR1C1: () => i.isR1C1(),
2555
2555
  getNow: () => r.getNow(),
2556
2556
  getRandom: () => i.getRandom(),
2557
2557
  getLocale: () => i.getLocale()
2558
- }, n), this._calcScope = r.getScope(), this._coerceToNumber = De(this._runtime, _n.Number, rt);
2559
- let { initializeFunctions: a } = await import("./DlVnybrgwZWxWN3_.mjs"), o = this, s = Object.freeze(a(() => o, this._functionProviders)), c = new re({
2558
+ }, n), this._calcScope = r.getScope(), this._coerceToNumber = xe(this._runtime, _n.Number, Je);
2559
+ let { initializeFunctions: o } = await import("./-nOfWMHdlTb9ShjF.mjs"), s = this, c = Object.freeze(o(() => s, this._functionProviders)), l = new a({
2560
2560
  transactions: e ?? new t({ transient: !0 }),
2561
2561
  context: this,
2562
- readonlyFunctions: s,
2563
- createScopedContext: (e) => o._createScoped(e)
2562
+ readonlyFunctions: c,
2563
+ createScopedContext: (e) => s._createScoped(e)
2564
2564
  });
2565
- return this._functions = c, { functions: c };
2565
+ return this._functions = l, { functions: l };
2566
2566
  }
2567
2567
  _createScoped(t) {
2568
2568
  let n = this._container, r = n.getSymbols().bind(z.Sheet, t);
@@ -2607,7 +2607,7 @@ var ti = {
2607
2607
  }, e;
2608
2608
  }
2609
2609
  getFunction(e) {
2610
- let t = I(e);
2610
+ let t = _e(e);
2611
2611
  if (t !== void 0) {
2612
2612
  let e = this._functions.getByName(t);
2613
2613
  if (e && !e.isLambda()) return e;
@@ -2645,15 +2645,15 @@ var ti = {
2645
2645
  defer(e, t) {
2646
2646
  if (typeof e != "function") throw new U.Value("defer needs an executor function");
2647
2647
  let n = this._container.getDeferred?.();
2648
- if (n) return pt(n.defer(e, t, Ce(), at())), n.previous;
2649
- pt(null);
2648
+ if (n) return Se(n.defer(e, t, Ze(), dt())), n.previous;
2649
+ Se(null);
2650
2650
  }
2651
2651
  formatResults(e) {
2652
2652
  let t = this._calcScope.node;
2653
2653
  t && (t.numFmt = e);
2654
2654
  }
2655
2655
  filterHidden(e, t) {
2656
- if (!(e?.isIReferenceRange && e instanceof ht)) return e;
2656
+ if (!(e?.isIReferenceRange && e instanceof pt)) return e;
2657
2657
  let n = e.getCoords(), r = this._gridIdOf(n), i = r ? this._container.getGrid(r) : null;
2658
2658
  if (!i || t?.onlyWhileFiltered && !i.isFiltered()) return e;
2659
2659
  let a = t?.axes, o = a === W.AxisSelection.Column ? null : i.getHiddenSkip(W.Axis.Row, n.rowStart, n.rowEnd), s = a === W.AxisSelection.Column || a === W.AxisSelection.Both ? i.getHiddenSkip(W.Axis.Column, n.colStart, n.colEnd) : null;
@@ -2763,17 +2763,17 @@ var ti = {
2763
2763
  return Cn(this._passSeed, this._gridKey, e.rowIndex, e.colIndex, t);
2764
2764
  }
2765
2765
  compare(e, t, n) {
2766
- return wt.compare(e, t, this.getRuntime().getLocaleProfile(), n);
2766
+ return re.compare(e, t, this.getRuntime().getLocaleProfile(), n);
2767
2767
  }
2768
2768
  _fromTuples(e, t = null, n = !1, r = !1) {
2769
2769
  if (!e) return null;
2770
- let i = ue(e.bounds, !0), a = this._container.getGrid(this._calcScope.gridId)?.getEntireCoords(), o = new u({
2770
+ let i = g(e.bounds, !0), a = this._container.getGrid(this._calcScope.gridId)?.getEntireCoords(), o = new _({
2771
2771
  axis: this._axis,
2772
2772
  maxCoords: a
2773
2773
  });
2774
2774
  o.setValues(e.tuples);
2775
2775
  let s = t ? { type: t } : void 0;
2776
- return new $e(this._runtime, o, i, s, n, r);
2776
+ return new We(this._runtime, o, i, s, n, r);
2777
2777
  }
2778
2778
  getValueAt(e, t, n = null, r) {
2779
2779
  let i = this._container, a = this._calcScope, o, s;
@@ -2796,7 +2796,7 @@ var ti = {
2796
2796
  }
2797
2797
  break;
2798
2798
  }
2799
- return s === void 0 && (this._onRead?.(o, e, t, e, t), s = i.getGridValues(o)?.getValueAt(e, t) ?? null, i.getDeferred?.()?.hasHolders() && (s = Te(s))), r && r.type, s;
2799
+ return s === void 0 && (this._onRead?.(o, e, t, e, t), s = i.getGridValues(o)?.getValueAt(e, t) ?? null, i.getDeferred?.()?.hasHolders() && (s = Tt(s))), r && r.type, s;
2800
2800
  }
2801
2801
  getSpillAt(e, t, n) {
2802
2802
  let r = this._container, i = this._calcScope, a;
@@ -2830,11 +2830,11 @@ var ti = {
2830
2830
  ...r,
2831
2831
  rowEnd: Math.max(r.rowEnd, e - 1),
2832
2832
  colEnd: Math.max(r.colEnd, t - 1)
2833
- } : r, a = new u({
2833
+ } : r, a = new _({
2834
2834
  axis: this._axis,
2835
2835
  maxCoords: i
2836
- }), o = new $e(this._runtime, a, null, void 0, !1);
2837
- return e > 0 && t > 0 && (typeof n == "function" ? (o = o.resize(e, t), o = o.map(n, Ti)) : Array.isArray(n) ? (o = o.replace(n), o = o.resize(e, t)) : o = n == null ? o.resize(e, t) : new $e(this._runtime, a, {
2836
+ }), o = new We(this._runtime, a, null, void 0, !1);
2837
+ return e > 0 && t > 0 && (typeof n == "function" ? (o = o.resize(e, t), o = o.map(n, Ti)) : Array.isArray(n) ? (o = o.replace(n), o = o.resize(e, t)) : o = n == null ? o.resize(e, t) : new We(this._runtime, a, {
2838
2838
  colStart: 0,
2839
2839
  rowStart: 0,
2840
2840
  colEnd: t - 1,
@@ -2862,7 +2862,7 @@ var ti = {
2862
2862
  let r, i = Array.isArray(e);
2863
2863
  if (n ??= i, !i && e !== void 0) {
2864
2864
  let r = this._container.getGrid(this._calcScope.gridId)?.getEntireCoords();
2865
- return new $e(this._runtime, new Tn(e, {
2865
+ return new We(this._runtime, new Tn(e, {
2866
2866
  axis: this._axis,
2867
2867
  maxCoords: r
2868
2868
  }), {
@@ -2877,13 +2877,13 @@ var ti = {
2877
2877
  if (e[0]?.isIRange) throw U.BuiltIn.Value;
2878
2878
  r = [e];
2879
2879
  }
2880
- let a = this._axis, o = a === W.Axis.Column, s = this._fromTuples(g(r, o, Ot(0, 0, void 0, void 0, o), !0), t, n, !i);
2881
- if (s) return s;
2882
- let c = this._container.getGrid(this._calcScope.gridId)?.getEntireCoords(), l = new u({
2880
+ let a = this._axis, s = a === W.Axis.Column, c = this._fromTuples(C(r, s, o(0, 0, void 0, void 0, s), !0), t, n, !i);
2881
+ if (c) return c;
2882
+ let l = this._container.getGrid(this._calcScope.gridId)?.getEntireCoords(), u = new _({
2883
2883
  axis: a,
2884
- maxCoords: c
2884
+ maxCoords: l
2885
2885
  }), d = t ? { type: t } : void 0;
2886
- return new $e(this._runtime, l, K.EmptyRange, d, n);
2886
+ return new We(this._runtime, u, K.EmptyRange, d, n);
2887
2887
  }
2888
2888
  getRow() {
2889
2889
  let e = this._calcScope;
@@ -2912,7 +2912,7 @@ var ti = {
2912
2912
  if (typeof e == "string") {
2913
2913
  let r = s?.(), i;
2914
2914
  try {
2915
- let n = Ne(e, r, xe, () => {
2915
+ let n = mt(e, r, Ye, () => {
2916
2916
  throw U.BuiltIn.Ref;
2917
2917
  }, t);
2918
2918
  if (n.length > 1) throw U.BuiltIn.Ref;
@@ -2965,7 +2965,7 @@ var ti = {
2965
2965
  scope: c
2966
2966
  };
2967
2967
  if (r.isGridless?.(c)) {
2968
- let e = new u({ axis: this._axis });
2968
+ let e = new _({ axis: this._axis });
2969
2969
  return this._toReference(e, t, void 0, c, !1, null);
2970
2970
  }
2971
2971
  e = t;
@@ -2975,15 +2975,15 @@ var ti = {
2975
2975
  s = a?.getEntireCoords.bind(a);
2976
2976
  }
2977
2977
  }
2978
- let l = r.getGridValues(i), d, f = n.node, p = -1;
2979
- if (f && (p = xi(Jt(f), e)), p !== -1) {
2980
- let t = qn(f, p);
2981
- if (t != null && t.isIReferenceRange) d = t;
2982
- else if (t === void 0 || l.isPendingOverlay) d = this._toReference(l, e, s, i, !1, vi(l, a));
2978
+ let l = r.getGridValues(i), u, d = n.node, f = -1;
2979
+ if (d && (f = xi(Jt(d), e)), f !== -1) {
2980
+ let t = qn(d, f);
2981
+ if (t != null && t.isIReferenceRange) u = t;
2982
+ else if (t === void 0 || l.isPendingOverlay) u = this._toReference(l, e, s, i, !1, vi(l, a));
2983
2983
  else {
2984
2984
  let n = t;
2985
2985
  n !== null && n.isIRange && (n = n.getValueAt(0, 0));
2986
- let r = new u({
2986
+ let r = new _({
2987
2987
  axis: this._axis,
2988
2988
  maxCoords: s?.()
2989
2989
  });
@@ -2991,16 +2991,16 @@ var ti = {
2991
2991
  let t = this._axis === W.Axis.Column, i = t ? e.colStart : e.rowStart, a = t ? e.rowStart : e.colStart;
2992
2992
  r.setValues([[i, [[a, [n]]]]]);
2993
2993
  }
2994
- d = this._toReference(r, e, s, i, !1, null);
2994
+ u = this._toReference(r, e, s, i, !1, null);
2995
2995
  }
2996
2996
  } else {
2997
2997
  let t = e.scope ? e : {
2998
2998
  ...e,
2999
2999
  scope: i
3000
3000
  };
3001
- r.addDynamicPrecedent(f, t, pi), d = this._toReference(l, e, s, i, !0, vi(l, a));
3001
+ r.addDynamicPrecedent(d, t, pi), u = this._toReference(l, e, s, i, !0, vi(l, a));
3002
3002
  }
3003
- return d;
3003
+ return u;
3004
3004
  }
3005
3005
  _expandSheetSpan(e) {
3006
3006
  if (typeof e != "object" || !e || !0 === e.isIRange) return null;
@@ -3026,7 +3026,7 @@ var ti = {
3026
3026
  let o = this._onRead ?? (i ? this._dynamicRead : null);
3027
3027
  o && (e = new gi(e, r, o));
3028
3028
  try {
3029
- let i = new ht(this._runtime, e, t, void 0, n, this._container.resolveScope);
3029
+ let i = new pt(this._runtime, e, t, void 0, n, this._container.resolveScope);
3030
3030
  return i._setCoordsReadHook(this._positionRead), a !== null && i._setErrorIndex(o === null ? a : { hasErrorIn: (e) => (o(r, e.rowStart, e.colStart, e.rowEnd, e.colEnd), a.hasErrorIn(e)) }), i;
3031
3031
  } catch (e) {
3032
3032
  throw e instanceof bn ? U.BuiltIn.Ref : e;
@@ -3035,7 +3035,7 @@ var ti = {
3035
3035
  getAddress(e, t = !1) {
3036
3036
  e ||= (this._calcScope.positionRead = !0, wi.rowIndex = this._calcScope.rowIndex, wi.colIndex = this._calcScope.colIndex, wi.scope = null, wi);
3037
3037
  let n = this.getEntireCoords().scope;
3038
- return e.colIndex === void 0 ? he(e, n, t) : y(e, n, t);
3038
+ return e.colIndex === void 0 ? ge(e, n, t) : pe(e, n, t);
3039
3039
  }
3040
3040
  parseAsSerialDate(e, t) {
3041
3041
  if (e === void 0) return;
@@ -3071,7 +3071,7 @@ var ti = {
3071
3071
  return Er.create(e, t, this._createSparseColumn, n);
3072
3072
  }
3073
3073
  getPivotAt(e) {
3074
- if (!(e instanceof ht)) return null;
3074
+ if (!(e instanceof pt)) return null;
3075
3075
  let t = e.getCoords(), n = this._gridIdOf(t), r = (n ? this._container.getGrid(n) : null)?.getPivots();
3076
3076
  if (!r) return null;
3077
3077
  for (let e = 0; e < r.length; e++) {
@@ -3085,16 +3085,16 @@ var ti = {
3085
3085
  return null;
3086
3086
  }
3087
3087
  parseAsLiteral(e) {
3088
- return D(e) ?? A(e);
3088
+ return E(e) ?? A(e);
3089
3089
  }
3090
3090
  toText(e) {
3091
- return Be(e, this._runtime);
3091
+ return Ae(e, this._runtime);
3092
3092
  }
3093
3093
  getRuntime() {
3094
3094
  return this._runtime;
3095
3095
  }
3096
3096
  createRichData(e, t) {
3097
- return st.fromJSON({
3097
+ return He.fromJSON({
3098
3098
  type: e,
3099
3099
  data: t
3100
3100
  }, this._container.getRichDataContext?.());
@@ -3220,7 +3220,7 @@ function ki(e, t, n) {
3220
3220
  colEnd: c[1]
3221
3221
  };
3222
3222
  }
3223
- var Ai = class extends ke {
3223
+ var Ai = class extends I {
3224
3224
  constructor(e) {
3225
3225
  let t = (e = { ...e }).container;
3226
3226
  super({
@@ -3228,15 +3228,15 @@ var Ai = class extends ke {
3228
3228
  send: (e, n, r) => t.sendRequest(e, n, r),
3229
3229
  calculation: e.calculation
3230
3230
  }), this._touchedOthers = null, this._iterationId = 0, this._resized = null, this._hiddenRows = null, this._hiddenColumns = null, this._filtered = !1, this._pivots = null, this._demanded = [], this._isProcessingJSON = !1, this._snapshots = null, this._options = e, this._context = e.context, this._container = e.container;
3231
- let n = { ...Ae }, r = e.getEntireCoords ?? (() => n);
3231
+ let n = { ...Ce }, r = e.getEntireCoords ?? (() => n);
3232
3232
  if (this._getEntireCoords = r, this._unanchored = !0 === e.unanchored, this._shadowOf = e.shadowOf ?? null, this._arrayFirstCell = !0 === e.arrayFirstCell, this._paged = !0 === e.paged, !this._context || !this._container) throw Error("Invalid Options");
3233
3233
  let i = e?.onCalculated;
3234
3234
  this._onCalculated = i ? (e) => {
3235
- i(Ye(dt.results(e, "onCalculated"), this._container.getImager(this._gridId)));
3236
- } : () => {}, this._values = new u({
3235
+ i(Be(lt.results(e, "onCalculated"), this._container.getImager(this._gridId)));
3236
+ } : () => {}, this._values = new _({
3237
3237
  axis: W.Axis.Column,
3238
3238
  createRun: nn
3239
- }), this._iterationId = 0, this._contentfulSpatial = new v({ updateEntryOptions: {
3239
+ }), this._iterationId = 0, this._contentfulSpatial = new N({ updateEntryOptions: {
3240
3240
  isSplitOnExpand: !0,
3241
3241
  isMergeOnShift: !0
3242
3242
  } });
@@ -3244,7 +3244,7 @@ var Ai = class extends ke {
3244
3244
  isSplitOnExpand: !0,
3245
3245
  isMergeOnShift: !1
3246
3246
  } };
3247
- this._spillSpatial = new v(a), this._errorSpatial = new v(a), this._calcStatusSpatial = new v(a), this._circularSpatial = new v(a), this._notifyValues = new v(), this._notifyBlank = null, this._notifySpillsInsert = [], this._notifySpillsRemove = [], this._notifyFormats = new v(), this._notifyCalcStatus = new v(), this._notifyCircular = new v(), this._touchedFormulas = [], this._container.registerGrid(this), this._publishMaps();
3247
+ this._spillSpatial = new N(a), this._errorSpatial = new N(a), this._calcStatusSpatial = new N(a), this._circularSpatial = new N(a), this._notifyValues = new N(), this._notifyBlank = null, this._notifySpillsInsert = [], this._notifySpillsRemove = [], this._notifyFormats = new N(), this._notifyCalcStatus = new N(), this._notifyCircular = new N(), this._touchedFormulas = [], this._container.registerGrid(this), this._publishMaps();
3248
3248
  }
3249
3249
  _land(e, t) {
3250
3250
  return this._container.landRequest(e, () => (e !== void 0 && this._versionMaps(e), t()));
@@ -3369,7 +3369,7 @@ var Ai = class extends ke {
3369
3369
  cycleId: this._container.getCycleId(),
3370
3370
  commitId: e.commitId
3371
3371
  };
3372
- let r = T(e.destination, e.coords, e.fitDestination, e.transpose);
3372
+ let r = ot(e.destination, e.coords, e.fitDestination, e.transpose);
3373
3373
  return r.scope = this._gridId, this._land(t, () => {
3374
3374
  e.isCut ? this._moveTo(n, e.coords, r) : this._copyTo(n, e.coords, r);
3375
3375
  let t = this._mutationResults(e.commitId);
@@ -3495,8 +3495,8 @@ var Ai = class extends ke {
3495
3495
  let t = this, r = this.getId(), i = { ...e };
3496
3496
  i.range = { ...i.range }, i.range.scope = r, delete i.onShift;
3497
3497
  let a = t._values, o = i.range, s = i.direction, c = s === W.Direction.Left || s === W.Direction.Right, l = s === W.Direction.Down || s === W.Direction.Right, u = l ? 1 : -1, d = t._spillSpatial, f = t._contentfulSpatial;
3498
- de(d, o, c, l);
3499
- let p = [], m = this._container.getPrecedents().search(o), h = ge(o, d, a, f, void 0, !1, !1, void 0, (e, t, n, i) => {
3498
+ ce(d, o, c, l);
3499
+ let p = [], m = this._container.getPrecedents().search(o), h = fe(o, d, a, f, void 0, !1, !1, void 0, (e, t, n, i) => {
3500
3500
  p.push({
3501
3501
  colStart: e,
3502
3502
  rowStart: t,
@@ -3514,7 +3514,7 @@ var Ai = class extends ke {
3514
3514
  colEnd: c && u === 1 ? y.colEnd : o.colEnd,
3515
3515
  rowEnd: c || u !== 1 ? o.rowEnd : y.rowEnd,
3516
3516
  scope: r
3517
- }, x = l ? Ie(v, b) : n(v, o);
3517
+ }, x = l ? R(v, b) : n(v, o);
3518
3518
  x && (Yi(_, v, x.formulas.inserts, x.formulas.removes), t._touchFormulas(x.formulas.removes), t._touchFormulas(x.formulas.inserts));
3519
3519
  let S = c ? o.colEnd - o.colStart + 1 : o.rowEnd - o.rowStart + 1, C = S * u, w = {
3520
3520
  colStart: o.colStart,
@@ -3522,7 +3522,7 @@ var Ai = class extends ke {
3522
3522
  colEnd: c ? y.colEnd : o.colEnd,
3523
3523
  rowEnd: c ? o.rowEnd : y.rowEnd,
3524
3524
  scope: r
3525
- }, T, E = te(() => v, () => {
3525
+ }, T, E = ee(() => v, () => {
3526
3526
  let e = g.getDynamics();
3527
3527
  return T = new Map(e), T;
3528
3528
  }, w, {
@@ -3533,7 +3533,7 @@ var Ai = class extends ke {
3533
3533
  E && (Yi(_, v, E.formulas.inserts, E.formulas.removes), t._touchFormulas(E.formulas.removes), t._touchFormulas(E.formulas.inserts)), i.onUpdates = (e, t) => {
3534
3534
  D = e, O = t;
3535
3535
  }, _.shift(i), (D || O) && (Zi(v, D, O), t._touchFormulas(O), t._touchFormulas(D)), g.setFormulas(_), g.setPrecedents(v), T && g.setDynamics(T), g.bumpCalcEpochs(!0), h?.(l, c ? 0 : C, c ? C : 0);
3536
- let k = c ? o.colStart : o.rowStart, A = c ? o.colEnd : o.rowEnd, j = (e, t = e.ref) => {
3536
+ let k = c ? o.colStart : o.rowStart, A = c ? o.colEnd : o.rowEnd, te = (e, t = e.ref) => {
3537
3537
  let n = e.gridId;
3538
3538
  n && g.getGrid(n) && (e.unanchored ? g.invalidateNamed(n) : ((e, t) => {
3539
3539
  let n = c ? e.colStart : e.rowStart, i = c ? e.colEnd : e.rowEnd;
@@ -3558,14 +3558,14 @@ var Ai = class extends ke {
3558
3558
  };
3559
3559
  for (let e = 0; e < m.length; e++) {
3560
3560
  let t = m[e].value, n = t.formulaEntry.value, r = t.index < 0 || n.unanchored ? n.ref : ki(n, t.index, o);
3561
- r !== null && j(n, r);
3561
+ r !== null && te(n, r);
3562
3562
  }
3563
- let ee = E?.dynamicDependents;
3564
- for (let e = 0; e < (ee?.length ?? 0); e++) j(ee[e].value);
3565
- let M = E?.formulas.inserts;
3566
- for (let e = 0; e < (M?.length ?? 0); e++) {
3567
- let t = M[e];
3568
- t.scope !== r && j(t.value);
3563
+ let ne = E?.dynamicDependents;
3564
+ for (let e = 0; e < (ne?.length ?? 0); e++) te(ne[e].value);
3565
+ let j = E?.formulas.inserts;
3566
+ for (let e = 0; e < (j?.length ?? 0); e++) {
3567
+ let t = j[e];
3568
+ t.scope !== r && te(t.value);
3569
3569
  }
3570
3570
  for (let e = 0; e < (D?.length ?? 0); e++) {
3571
3571
  let t = D[e];
@@ -3612,9 +3612,9 @@ var Ai = class extends ke {
3612
3612
  let i = a[r], l = i.value, u = l.getReferencedSymbolIds(), d = l;
3613
3613
  for (let r = 0; r < u.length; r++) {
3614
3614
  let i = u[r];
3615
- if (!Ee(i)) continue;
3615
+ if (!be(i)) continue;
3616
3616
  let a = o.get(i);
3617
- a === void 0 && (a = Dt(i, e, t, n) ?? null, o.set(i, a)), a !== null && (d = d.replaceScopeIds(i, a));
3617
+ a === void 0 && (a = Ot(i, e, t, n) ?? null, o.set(i, a)), a !== null && (d = d.replaceScopeIds(i, a));
3618
3618
  }
3619
3619
  d !== l && (s.push(i), c.push({
3620
3620
  ...i,
@@ -3727,7 +3727,7 @@ var Ai = class extends ke {
3727
3727
  o || (o = /* @__PURE__ */ new Map(), ji.set(r, o));
3728
3728
  let s = o.get(t);
3729
3729
  if (!s) {
3730
- let e = _t(r);
3730
+ let e = Ke(r);
3731
3731
  s = t === 0 ? e : (n, r) => e(n + t, r) - t, o.set(t, s);
3732
3732
  }
3733
3733
  return s;
@@ -3758,7 +3758,7 @@ var Ai = class extends ke {
3758
3758
  columns: t.anchor.column - n.colStart
3759
3759
  }, s = {
3760
3760
  ...n,
3761
- value: new ot(n, o, "pivot", a)
3761
+ value: new Qe(n, o, "pivot", a)
3762
3762
  };
3763
3763
  i.insert(s), this._notifySpillsInsert.push(s);
3764
3764
  }
@@ -3882,7 +3882,7 @@ var Ai = class extends ke {
3882
3882
  }
3883
3883
  this._pushWithSpills(c, y);
3884
3884
  }
3885
- return c = S(c, 2, xn.Row), c.sort(K.rowFirstRangeComparator), c;
3885
+ return c = rt(c, 2, xn.Row), c.sort(K.rowFirstRangeComparator), c;
3886
3886
  }
3887
3887
  _pushWithSpills(e, t) {
3888
3888
  e.push(t);
@@ -3936,7 +3936,7 @@ var Ai = class extends ke {
3936
3936
  for (let e = 0; e < f.length; e++) {
3937
3937
  let t = f[e];
3938
3938
  if (t?.colStart === void 0) continue;
3939
- let n = t.scope, r = u(n), i = it(t, c.rowStart + x, c.colStart + S), a = it(t, c.rowStart + C, c.colStart + w), s = {
3939
+ let n = t.scope, r = u(n), i = ut(t, c.rowStart + x, c.colStart + S), a = ut(t, c.rowStart + C, c.colStart + w), s = {
3940
3940
  colStart: Math.max(Math.min(i.colStart, a.colStart), r.colStart),
3941
3941
  rowStart: Math.max(Math.min(i.rowStart, a.rowStart), r.rowStart),
3942
3942
  colEnd: Math.min(Math.max(i.colEnd, a.colEnd), r.colEnd),
@@ -3947,7 +3947,7 @@ var Ai = class extends ke {
3947
3947
  }
3948
3948
  d.push(...T);
3949
3949
  }
3950
- return d = S(d, 2, xn.Row), d.sort(K.rowFirstRangeComparator), d;
3950
+ return d = rt(d, 2, xn.Row), d.sort(K.rowFirstRangeComparator), d;
3951
3951
  }
3952
3952
  _directAcrossGrids(e, t) {
3953
3953
  let n = this._gridId, r = e.scope, i = r && r !== n ? this._container.getGrid(r) ?? null : this;
@@ -3968,11 +3968,11 @@ var Ai = class extends ke {
3968
3968
  return o;
3969
3969
  }
3970
3970
  getDependentsAt(e) {
3971
- let t = fe(e, (e) => this._directAcrossGrids(e, !0));
3971
+ let t = p(e, (e) => this._directAcrossGrids(e, !0));
3972
3972
  return t.sort(K.rowFirstRangeComparator), t;
3973
3973
  }
3974
3974
  getPrecedentsAt(e) {
3975
- let t = fe(e, (e) => this._directAcrossGrids(e, !1));
3975
+ let t = p(e, (e) => this._directAcrossGrids(e, !1));
3976
3976
  return t.sort(K.rowFirstRangeComparator), t;
3977
3977
  }
3978
3978
  _graphNeighborsNow(e, t, n) {
@@ -4083,15 +4083,15 @@ var Ai = class extends ke {
4083
4083
  if (i === "scalar") {
4084
4084
  let i = e.evaluateAt(t, n, r);
4085
4085
  if (i && i.colStart !== void 0) i = e.finalizeValue(i);
4086
- else if (Xe(i)) return e.finalizeValue(i);
4087
- let a = He(i, this._context);
4086
+ else if (Ve(i)) return e.finalizeValue(i);
4087
+ let a = Me(i, this._context);
4088
4088
  return a === null ? 0 : a;
4089
4089
  }
4090
4090
  return tn(e.finalizeValue(e.evaluateAt(t, n, r)));
4091
4091
  }
4092
4092
  _setReferenceNow(e, t, n, r) {
4093
4093
  let i = this._formulaAt(e, t), a = r;
4094
- r && r.colStart !== void 0 ? a = Oe(a, e, t) : r && r.colIndex !== void 0 && (a = ft(a, e, t));
4094
+ r && r.colStart !== void 0 ? a = Le(a, e, t) : r && r.colIndex !== void 0 && (a = F(a, e, t));
4095
4095
  let o = i.value.formula.setReferenceAt(n, a).getTextAt(e, t);
4096
4096
  return this._land(void 0, () => {
4097
4097
  o ? this._setInputsNow(null, [{
@@ -4112,7 +4112,7 @@ var Ai = class extends ke {
4112
4112
  _setReferenceModeNow(e, t, n, r, i) {
4113
4113
  let a = this.getReferencesAt(e, t)[n];
4114
4114
  if (!a || "nameId" in a) throw Error(`Reference at index ${n} is not a cell reference and cannot have its style changed.`);
4115
- return this._setReferenceNow(e, t, n, O(a, r, i));
4115
+ return this._setReferenceNow(e, t, n, w(a, r, i));
4116
4116
  }
4117
4117
  _isVolatileNow(e, t) {
4118
4118
  let n = this._formulaAt(e, t);
@@ -4145,7 +4145,7 @@ var Ai = class extends ke {
4145
4145
  rowStart: f,
4146
4146
  colEnd: i,
4147
4147
  rowEnd: m,
4148
- value: new ot(h, 0, t.value.getKind())
4148
+ value: new Qe(h, 0, t.value.getKind())
4149
4149
  });
4150
4150
  }
4151
4151
  return {
@@ -4173,21 +4173,21 @@ var Ai = class extends ke {
4173
4173
  if (!o || o.isEmpty()) return;
4174
4174
  let s = this.getEntireCoords(), c = s.colStart, l = s.rowStart, u = s.colEnd, d = s.rowEnd, f = a.createCopiedEntries(t, n), p = f.inserts, m = p.length;
4175
4175
  if (m === 0 && (f.removes?.length ?? 0) === 0) return;
4176
- let g = 0, _ = e.spillSpatial, v = [];
4177
- for (; g < m;) {
4178
- let e = p[g];
4176
+ let h = 0, g = e.spillSpatial, _ = [];
4177
+ for (; h < m;) {
4178
+ let e = p[h];
4179
4179
  e.scope = i;
4180
4180
  let n = e.value, r = n.ref, a = r.colStart, o = r.rowStart, s = r.colEnd, f = r.rowEnd;
4181
- this._createCopySpillEntries(_, t, r, v, null);
4182
- let y = n.formula.getReferences(o, a), b = y.length;
4181
+ this._createCopySpillEntries(g, t, r, _, null);
4182
+ let v = n.formula.getReferences(o, a), b = v.length;
4183
4183
  for (let t = 0; t < b; t++) {
4184
- let i = y[t];
4184
+ let i = v[t];
4185
4185
  if (!i || "nameId" in i || "tableId" in i) continue;
4186
- let g = i, _ = g.colStart, v = g.rowStart, b = g.colEnd, x = g.rowEnd, S = g.$colStart ? _ : _ + a, C = g.$rowStart ? v : v + o, w = g.$colEnd ? b : b + s, T = g.$rowEnd ? x : x + f;
4187
- if (_ === -(2 ** 53 - 1) && (S = c, w = u), v === -(2 ** 53 - 1) && (C = l, T = d), S < c || w > u || C < l || T > d) {
4188
- let i = c - S, g = l - C, _ = u - w, v = d - T;
4189
- Vi.colStart = Math.max(a, a + i), Vi.rowStart = Math.max(o, o + g), Vi.colEnd = Math.min(s, s + _), Vi.rowEnd = Math.min(f, f + v);
4190
- let b = ut(e, Vi, h);
4186
+ let h = i, g = h.colStart, _ = h.rowStart, b = h.colEnd, x = h.rowEnd, S = h.$colStart ? g : g + a, C = h.$rowStart ? _ : _ + o, w = h.$colEnd ? b : b + s, T = h.$rowEnd ? x : x + f;
4187
+ if (g === -(2 ** 53 - 1) && (S = c, w = u), _ === -(2 ** 53 - 1) && (C = l, T = d), S < c || w > u || C < l || T > d) {
4188
+ let i = c - S, h = l - C, g = u - w, _ = d - T;
4189
+ Vi.colStart = Math.max(a, a + i), Vi.rowStart = Math.max(o, o + h), Vi.colEnd = Math.min(s, s + g), Vi.rowEnd = Math.min(f, f + _);
4190
+ let b = y(e, Vi, ae);
4191
4191
  if (b) {
4192
4192
  let t = b.length;
4193
4193
  e = b[t - 1], n = e.value, r = n.ref, a = r.colStart, o = r.rowStart, s = r.colEnd, f = r.rowEnd;
@@ -4195,13 +4195,13 @@ var Ai = class extends ke {
4195
4195
  let t = b[e];
4196
4196
  p.push(t), m++;
4197
4197
  }
4198
- } else n = n.setReferenceAt(t, null), e.value = n, y = n.formula.getReferences(o, a);
4198
+ } else n = n.setReferenceAt(t, null), e.value = n, v = n.formula.getReferences(o, a);
4199
4199
  }
4200
4200
  }
4201
- p[g++] = e;
4201
+ p[h++] = e;
4202
4202
  }
4203
- let y = this._container, b = y.getFormulas().clone(), x = y.getPrecedents().clone();
4204
- y.setFormulas(b), y.setPrecedents(x), i !== r && this._reanchorFormulas(p, void 0, i), Yi(b, x, p, f.removes), this._touchFormulas(f.removes), this._touchFormulas(p), v && this._spillSpatial._updateNodes(v, []), y.markDirty([{
4203
+ let v = this._container, b = v.getFormulas().clone(), x = v.getPrecedents().clone();
4204
+ v.setFormulas(b), v.setPrecedents(x), i !== r && this._reanchorFormulas(p, void 0, i), Yi(b, x, p, f.removes), this._touchFormulas(f.removes), this._touchFormulas(p), _ && this._spillSpatial._updateNodes(_, []), v.markDirty([{
4205
4205
  ...n,
4206
4206
  scope: i
4207
4207
  }]);
@@ -4211,7 +4211,7 @@ var Ai = class extends ke {
4211
4211
  this._removeNow(n);
4212
4212
  let o = this._container, s = o.getPrecedents().clone(), c = o.getFormulas().clone();
4213
4213
  o.setPrecedents(s), o.setFormulas(c);
4214
- let l = vt(s, t, n);
4214
+ let l = _t(s, t, n);
4215
4215
  l && (Yi(c, s, l.formulas.inserts, l.formulas.removes), this._touchFormulas(l.formulas.removes), this._touchFormulas(l.formulas.inserts));
4216
4216
  let u = { cutFrom: t }, d = a.createCopiedEntries(t, n, u).inserts, f = d.length, p = this._gridId;
4217
4217
  if (p !== i) {
@@ -4256,7 +4256,7 @@ var Ai = class extends ke {
4256
4256
  }
4257
4257
  let m;
4258
4258
  Yi(c, s, d), this._touchFormulas(d);
4259
- let h = me(s, () => {
4259
+ let h = ue(s, () => {
4260
4260
  let e = o.getDynamics();
4261
4261
  return m = new Map(e), m;
4262
4262
  }, t, n);
@@ -4278,15 +4278,15 @@ var Ai = class extends ke {
4278
4278
  e.values.copyTo(g, {
4279
4279
  colIndex: n.colStart,
4280
4280
  rowIndex: n.rowStart
4281
- }, t), x(this._errorSpatial, g, n);
4281
+ }, t), b(this._errorSpatial, g, n);
4282
4282
  let _ = e.spillSpatial, v = [], y = [];
4283
4283
  for (let e = 0; e < f; e++) {
4284
4284
  let n = d[e];
4285
4285
  this._createCopySpillEntries(_, t, n, v, y);
4286
4286
  }
4287
- let b = [];
4288
- v.length > 0 && (this._spillSpatial._updateNodes(v, []), r._spillSpatial._updateNodes([], y), se(o.getCycleId(), y, G.EmptyArray, r._contentfulSpatial, r._spillSpatial, r._values, (e, t, n, r) => {
4289
- b.push({
4287
+ let x = [];
4288
+ v.length > 0 && (this._spillSpatial._updateNodes(v, []), r._spillSpatial._updateNodes([], y), ie(o.getCycleId(), y, G.EmptyArray, r._contentfulSpatial, r._spillSpatial, r._values, (e, t, n, r) => {
4289
+ x.push({
4290
4290
  colStart: e,
4291
4291
  rowStart: t,
4292
4292
  colEnd: n,
@@ -4303,20 +4303,20 @@ var Ai = class extends ke {
4303
4303
  }]);
4304
4304
  }
4305
4305
  _notifyCalculated(e, t, n) {
4306
- let r, i = !1;
4307
- i || (typeof t == "boolean" ? i = t : t && (r = t, i = r.full ?? !1));
4308
- let a = this._notifyValues, o = a.all(), s = this._notifyCalcStatus.all([]);
4309
- s.length > 0 && this._notifyCalcStatus.clear();
4310
- let c = this._notifyCircular.all([]), l, u;
4311
- c.length > 0 && this._notifyCircular.clear(), i ? l = this._spillSpatial.all() : (l = this._notifySpillsInsert, u = this._notifySpillsRemove), this._notifySpillsInsert = [], this._notifySpillsRemove = [];
4312
- let d = this._notifyFormats.all();
4313
- d.length > 0 && this._notifyFormats.clear();
4314
- let f = {}, p = null, m = o.length;
4315
- if (m > 0) {
4316
- a.clear();
4317
- let e = o, t = null;
4318
- for (let e = 0; e < m; e++) {
4319
- let n = o[e], r = n.colStart, i = n.colEnd;
4306
+ let i, a = !1;
4307
+ a || (typeof t == "boolean" ? a = t : t && (i = t, a = i.full ?? !1));
4308
+ let o = this._notifyValues, s = o.all(), c = this._notifyCalcStatus.all([]);
4309
+ c.length > 0 && this._notifyCalcStatus.clear();
4310
+ let l = this._notifyCircular.all([]), u, d;
4311
+ l.length > 0 && this._notifyCircular.clear(), a ? u = this._spillSpatial.all() : (u = this._notifySpillsInsert, d = this._notifySpillsRemove), this._notifySpillsInsert = [], this._notifySpillsRemove = [];
4312
+ let f = this._notifyFormats.all();
4313
+ f.length > 0 && this._notifyFormats.clear();
4314
+ let p = {}, m = null, h = s.length;
4315
+ if (h > 0) {
4316
+ o.clear();
4317
+ let e = s, t = null;
4318
+ for (let e = 0; e < h; e++) {
4319
+ let n = s[e], r = n.colStart, i = n.colEnd;
4320
4320
  if (r !== i) {
4321
4321
  t ||= [];
4322
4322
  for (let e = r + 1; e <= i; e++) t.push({
@@ -4328,56 +4328,56 @@ var Ai = class extends ke {
4328
4328
  n.colEnd = r;
4329
4329
  }
4330
4330
  }
4331
- t && (e = o.concat(t)), e.sort(K.columnFirstRangeComparator);
4332
- let n = new _e.Builder((e, t) => new P.ArrayList(e.slice(0, t))), r, i = !0 === this._container.getDeferred?.()?.hasHolders(), s = this._values, c = s.getAxis() === W.Axis.Column, l = e.length;
4333
- for (let t = 0; t < l; t++) {
4334
- let a = e[t];
4335
- p = K.unionRanges(p, a, Fi);
4336
- let o = s.getRuns({ bounds: a }), l = o.next(), u = a.colStart, d = a.rowStart, f = a.colEnd, m = a.rowEnd, h = c ? d : u, g = c ? f : m, _ = c ? m : f, v = c ? u : d, y = h;
4337
- for (; !l.done;) {
4338
- let e = l.value, t = e[0];
4339
- for (; v < t;) r ||= [], r.push({
4340
- colStart: c ? v : y,
4341
- rowStart: c ? y : v,
4342
- colEnd: c ? v : _,
4343
- rowEnd: c ? _ : v
4331
+ t && (e = s.concat(t)), e.sort(K.columnFirstRangeComparator);
4332
+ let n = new de.Builder((e, t) => new r.ArrayList(e.slice(0, t))), i, a = !0 === this._container.getDeferred?.()?.hasHolders(), c = this._values, l = c.getAxis() === W.Axis.Column, u = e.length;
4333
+ for (let t = 0; t < u; t++) {
4334
+ let r = e[t];
4335
+ m = K.unionRanges(m, r, Fi);
4336
+ let o = c.getRuns({ bounds: r }), s = o.next(), u = r.colStart, d = r.rowStart, f = r.colEnd, p = r.rowEnd, h = l ? d : u, g = l ? f : p, _ = l ? p : f, v = l ? u : d, y = h;
4337
+ for (; !s.done;) {
4338
+ let e = s.value, t = e[0];
4339
+ for (; v < t;) i ||= [], i.push({
4340
+ colStart: l ? v : y,
4341
+ rowStart: l ? y : v,
4342
+ colEnd: l ? v : _,
4343
+ rowEnd: l ? _ : v
4344
4344
  }), v++, y = h;
4345
- let a = e[1], s = e[2], u = Math.max(a, h), d = Math.min(a + s.length - 1, _);
4346
- n.pushMultipleAt(t, u, i ? Qi(s) : s), y < u && (r ||= [], r.push({
4347
- colStart: c ? t : y,
4348
- rowStart: c ? y : t,
4349
- colEnd: c ? t : u - 1,
4350
- rowEnd: c ? u - 1 : t
4351
- })), y = d + 1, d >= _ ? (v = t + 1, y = h) : v = t, l = o.next();
4345
+ let r = e[1], c = e[2], u = Math.max(r, h), d = Math.min(r + c.length - 1, _);
4346
+ n.pushMultipleAt(t, u, a ? Qi(c) : c), y < u && (i ||= [], i.push({
4347
+ colStart: l ? t : y,
4348
+ rowStart: l ? y : t,
4349
+ colEnd: l ? t : u - 1,
4350
+ rowEnd: l ? u - 1 : t
4351
+ })), y = d + 1, d >= _ ? (v = t + 1, y = h) : v = t, s = o.next();
4352
4352
  }
4353
- for (; v <= g;) y <= _ && (r ||= [], r.push({
4354
- colStart: c ? v : y,
4355
- rowStart: c ? y : v,
4356
- colEnd: c ? v : _,
4357
- rowEnd: c ? _ : v
4353
+ for (; v <= g;) y <= _ && (i ||= [], i.push({
4354
+ colStart: l ? v : y,
4355
+ rowStart: l ? y : v,
4356
+ colEnd: l ? v : _,
4357
+ rowEnd: l ? _ : v
4358
4358
  })), v++, y = h;
4359
4359
  }
4360
- let u = n.build();
4361
- u && (f.valueInserts = u), r && (f.valueRemoves = r);
4360
+ let d = n.build();
4361
+ d && (p.valueInserts = d), i && (p.valueRemoves = i);
4362
4362
  }
4363
- if (s.length > 0) {
4364
- let e = this._calcStatusSpatial, t, n = s.length;
4363
+ if (c.length > 0) {
4364
+ let e = this._calcStatusSpatial, t, n = c.length;
4365
4365
  for (let r = 0; r < n; r++) {
4366
- let n = s[r];
4366
+ let n = c[r];
4367
4367
  e.insertNonOverlapping(n, { onIntersect: (e, n) => (t ||= [], t.push({
4368
4368
  colStart: n.colStart,
4369
4369
  rowStart: n.rowStart,
4370
4370
  colEnd: n.colEnd,
4371
4371
  rowEnd: n.rowEnd,
4372
4372
  value: n.value
4373
- }), p = K.unionRanges(p, n), !1 === n.value && (n.value = null), n) });
4373
+ }), m = K.unionRanges(m, n), !1 === n.value && (n.value = null), n) });
4374
4374
  }
4375
- t && t.length > 0 && (f.calcStatusUpdates = t, p = K.unionRangesArrays(t, p ?? void 0, Fi));
4375
+ t && t.length > 0 && (p.calcStatusUpdates = t, m = K.unionRangesArrays(t, m ?? void 0, Fi));
4376
4376
  }
4377
- if (c.length > 0) {
4378
- let e = this._circularSpatial, t, n = c.length;
4377
+ if (l.length > 0) {
4378
+ let e = this._circularSpatial, t, n = l.length;
4379
4379
  for (let r = 0; r < n; r++) {
4380
- let n = c[r];
4380
+ let n = l[r];
4381
4381
  e.insertNonOverlapping(n, { onIntersect: (e, n) => {
4382
4382
  t ||= [];
4383
4383
  let r = !1 === n.value;
@@ -4387,41 +4387,41 @@ var Ai = class extends ke {
4387
4387
  colEnd: n.colEnd,
4388
4388
  rowEnd: n.rowEnd,
4389
4389
  value: r ? null : n.value
4390
- }), p = K.unionRanges(p, n), r && (n.value = null), n;
4390
+ }), m = K.unionRanges(m, n), r && (n.value = null), n;
4391
4391
  } });
4392
4392
  }
4393
- t && t.length > 0 && (f.circularUpdates = t, p = K.unionRangesArrays(t, p ?? void 0, Fi));
4393
+ t && t.length > 0 && (p.circularUpdates = t, m = K.unionRangesArrays(t, m ?? void 0, Fi));
4394
4394
  }
4395
- let h, g, v = u ? u.length : 0;
4396
- if (v > 0) {
4397
- h = [];
4398
- for (let e = 0; e < v; e++) {
4399
- let t = u[e], n = t.value?.getBlockedCoords() ?? t;
4400
- h.push({
4395
+ let g, _, y = d ? d.length : 0;
4396
+ if (y > 0) {
4397
+ g = [];
4398
+ for (let e = 0; e < y; e++) {
4399
+ let t = d[e], n = t.value?.getBlockedCoords() ?? t;
4400
+ g.push({
4401
4401
  colStart: n.colStart,
4402
4402
  rowStart: n.rowStart,
4403
4403
  colEnd: n.colEnd,
4404
4404
  rowEnd: n.rowEnd
4405
4405
  });
4406
4406
  }
4407
- h && (f.spillRemoves = h, p = K.unionRangesArrays(h, p ?? void 0, Fi));
4407
+ g && (p.spillRemoves = g, m = K.unionRangesArrays(g, m ?? void 0, Fi));
4408
4408
  }
4409
- let y = l.length;
4410
- if (y > 0) {
4409
+ let b = u.length;
4410
+ if (b > 0) {
4411
4411
  let t = this._spillSpatial, n;
4412
- for (let r = y - 1; r >= 0; r--) {
4413
- let a = l[r], o = a.value;
4414
- if (!i && o.getCycleId() !== e) continue;
4415
- let s = t.search(a), c = s.length;
4412
+ for (let r = b - 1; r >= 0; r--) {
4413
+ let i = u[r], o = i.value;
4414
+ if (!a && o.getCycleId() !== e) continue;
4415
+ let s = t.search(i), c = s.length;
4416
4416
  for (let t = 0; t < c; t++) {
4417
4417
  let r = s[t];
4418
- if (_(a.rowStart, a.colStart, r) && (i || r.value.getCycleId() === e)) {
4419
- g || (g = [], n = /* @__PURE__ */ new Set());
4420
- let e = C(r.colStart) + et(r.rowStart);
4418
+ if (v(i.rowStart, i.colStart, r) && (a || r.value.getCycleId() === e)) {
4419
+ _ || (_ = [], n = /* @__PURE__ */ new Set());
4420
+ let e = it(r.colStart) + st(r.rowStart);
4421
4421
  if (n.has(e)) continue;
4422
4422
  n.add(e);
4423
- let t = r.value.getBlockedCoords() ?? a;
4424
- g.push({
4423
+ let t = r.value.getBlockedCoords() ?? i;
4424
+ _.push({
4425
4425
  colStart: t.colStart,
4426
4426
  rowStart: t.rowStart,
4427
4427
  colEnd: t.colEnd,
@@ -4431,40 +4431,40 @@ var Ai = class extends ke {
4431
4431
  }
4432
4432
  }
4433
4433
  }
4434
- g && (f.spillInserts = g, p = K.unionRangesArrays(g, p ?? void 0, Fi));
4434
+ _ && (p.spillInserts = _, m = K.unionRangesArrays(_, m ?? void 0, Fi));
4435
4435
  }
4436
- d.length > 0 && (f.formatInserts = d, p = K.unionRangesArrays(d, p ?? void 0, Fi)), this._takeFormulaResults(f, i), f.formulaRemoves && (p = K.unionRangesArrays(f.formulaRemoves, p ?? void 0, Fi));
4437
- let b = this._notifyBlank;
4438
- b !== null && (p = K.unionRanges(p, b, Fi), this._notifyBlank = null), p && (f.bounds = {
4439
- colStart: p.colStart,
4440
- rowStart: p.rowStart,
4441
- colEnd: p.colEnd,
4442
- rowEnd: p.rowEnd
4443
- }), f.cycleId = Object.keys(f).length === 0 ? e - 1 : e, i && (f.isFull = !0);
4444
- let x = n === void 0 ? this._container.getCalculatedCommitId() : n;
4445
- return x !== null && (f.commitId = x), this._holdsBody() && (f.blankRegion = this._blankRegion()), this._onCalculated(f), Promise.resolve(f);
4436
+ f.length > 0 && (p.formatInserts = f, m = K.unionRangesArrays(f, m ?? void 0, Fi)), this._takeFormulaResults(p, a), p.formulaRemoves && (m = K.unionRangesArrays(p.formulaRemoves, m ?? void 0, Fi));
4437
+ let x = this._notifyBlank;
4438
+ x !== null && (m = K.unionRanges(m, x, Fi), this._notifyBlank = null), m && (p.bounds = {
4439
+ colStart: m.colStart,
4440
+ rowStart: m.rowStart,
4441
+ colEnd: m.colEnd,
4442
+ rowEnd: m.rowEnd
4443
+ }), p.cycleId = Object.keys(p).length === 0 ? e - 1 : e, a && (p.isFull = !0);
4444
+ let S = n === void 0 ? this._container.getCalculatedCommitId() : n;
4445
+ return S !== null && (p.commitId = S), this._holdsBody() && (p.blankRegion = this._blankRegion()), this._onCalculated(p), Promise.resolve(p);
4446
4446
  }
4447
4447
  _setInputsNow(e, t, n, r) {
4448
- let i = this._gridId, a = this._container, o = this._context, s = a.getFormulas(), c = s.getSpatialAt(i), l = !!c && !c.isEmpty(), u = t ? t.length : 0, f = this._values, p = f.getAxis() !== W.Axis.Row, m = this._spillSpatial, h = this._errorSpatial, g = this._notifyCalcStatus.size(), _ = this._contentfulSpatial, v = [], y, b, x, S = l ? [] : null;
4448
+ let i = this._gridId, a = this._container, o = this._context, s = a.getFormulas(), c = s.getSpatialAt(i), l = !!c && !c.isEmpty(), u = t ? t.length : 0, d = this._values, p = d.getAxis() !== W.Axis.Row, m = this._spillSpatial, h = this._errorSpatial, _ = this._notifyCalcStatus.size(), v = this._contentfulSpatial, y = [], b, x, S, C = l ? [] : null;
4449
4449
  if (e && e.tuples) {
4450
- y = e.tuples;
4450
+ b = e.tuples;
4451
4451
  let t = e.bounds;
4452
- if (t ? (b = ue(t, p), b.scope = i) : b = {
4452
+ if (t ? (x = g(t, p), x.scope = i) : x = {
4453
4453
  colStart: -(2 ** 53 - 1),
4454
4454
  rowStart: -(2 ** 53 - 1),
4455
4455
  colEnd: 2 ** 53 - 1,
4456
4456
  rowEnd: 2 ** 53 - 1,
4457
4457
  scope: i
4458
- }, S) {
4459
- l && v.push(b);
4458
+ }, C) {
4459
+ l && y.push(x);
4460
4460
  let e = {
4461
4461
  majorStart: 0,
4462
4462
  minorStart: 0,
4463
4463
  majorEnd: 0,
4464
4464
  minorEnd: 0
4465
- }, t = y.length;
4465
+ }, t = b.length;
4466
4466
  for (let n = 0; n < t; n++) {
4467
- let t = y[n], r = t[0];
4467
+ let t = b[n], r = t[0];
4468
4468
  e.majorStart = r, e.majorEnd = r;
4469
4469
  let a = t[1], o = a.length;
4470
4470
  for (let t = 0; t < o; t++) {
@@ -4472,39 +4472,39 @@ var Ai = class extends ke {
4472
4472
  e.minorStart = n[0];
4473
4473
  let r = n[1];
4474
4474
  e.minorEnd = e.minorStart + r.length - 1;
4475
- let o = ue(e, p);
4476
- o.scope = i, S && s.search(o).length > 0 && S.push(o);
4475
+ let o = g(e, p);
4476
+ o.scope = i, C && s.search(o).length > 0 && C.push(o);
4477
4477
  }
4478
4478
  }
4479
4479
  }
4480
- x = we(e.tuples, p, i);
4480
+ S = ve(e.tuples, p, i);
4481
4481
  }
4482
- let C = (e, t) => {
4482
+ let w = (e, t) => {
4483
4483
  e && this._notifySpillsInsert.push(e), t && this._notifySpillsRemove.push(t);
4484
4484
  };
4485
- if (n || y) {
4485
+ if (n || b) {
4486
4486
  let e;
4487
- n && (e = ge(n, m, f, _, C, !1, !0, this._notifyValues, (e, t, n, r) => {
4488
- v.push({
4487
+ n && (e = fe(n, m, d, v, w, !1, !0, this._notifyValues, (e, t, n, r) => {
4488
+ y.push({
4489
4489
  colStart: e,
4490
4490
  rowStart: t,
4491
4491
  colEnd: n,
4492
4492
  rowEnd: r,
4493
4493
  scope: i
4494
4494
  });
4495
- })), se(-1, n ? [n] : G.EmptyArray, x, _, m, f, (e, t, n, r) => {
4496
- v.push({
4495
+ })), ie(-1, n ? [n] : G.EmptyArray, S, v, m, d, (e, t, n, r) => {
4496
+ y.push({
4497
4497
  colStart: e,
4498
4498
  rowStart: t,
4499
4499
  colEnd: n,
4500
4500
  rowEnd: r,
4501
4501
  scope: i
4502
4502
  });
4503
- }, this._notifyValues, C, this._notifyCalcStatus, h, p, !1, this._circularSpatial, this._calcStatusSpatial), n && (f.delete(n), d(h, n)), e?.(), y && (f.setValues(y), lt(h, y, p));
4503
+ }, this._notifyValues, w, this._notifyCalcStatus, h, p, !1, this._circularSpatial, this._calcStatusSpatial), n && (d.delete(n), f(h, n)), e?.(), b && (d.setValues(b), nt(h, b, p));
4504
4504
  }
4505
- let w = a.getScope(), T, E, D, O, k, A = (e, t) => {
4505
+ let T = a.getScope(), E, D, O, k, A, ee = (e, t) => {
4506
4506
  let n = e.rowStart, s = e.colStart;
4507
- w && (w.rowIndex = n, w.colIndex = s);
4507
+ T && (T.rowIndex = n, T.colIndex = s);
4508
4508
  let c = a.createFormulaBlock(i, o, t, n, s), l = new fi(e, i, c, a, this._unanchored), u = r?.arrayFixed;
4509
4509
  u && u.colStart === s && u.rowStart === n && (H(l.getAnchorNode()).fixedRef = {
4510
4510
  colStart: u.colStart,
@@ -4517,54 +4517,54 @@ var Ai = class extends ke {
4517
4517
  scope: i,
4518
4518
  value: l
4519
4519
  };
4520
- T ||= [], T.push(d);
4521
- }, j = (e) => {
4520
+ E ||= [], E.push(d);
4521
+ }, te = (e) => {
4522
4522
  let t = {
4523
4523
  ...e,
4524
4524
  scope: i,
4525
4525
  value: null
4526
4526
  };
4527
- D.insertNonOverlapping(t, {
4527
+ O.insertNonOverlapping(t, {
4528
4528
  noMerge: !0,
4529
4529
  onUpdates(e, t, n) {
4530
- E ||= [];
4530
+ D ||= [];
4531
4531
  for (let e = 0; e < t.length; e++) {
4532
4532
  let n = t[e];
4533
- if (E.push(n), k) for (let e = k.length - 1; e >= 0; e--) k[e].value === n.value && k.splice(e, 1);
4533
+ if (D.push(n), A) for (let e = A.length - 1; e >= 0; e--) A[e].value === n.value && A.splice(e, 1);
4534
4534
  }
4535
4535
  let r = e ? e.length : 0;
4536
4536
  for (let t = 0; t < r; t++) {
4537
4537
  let n = e[t];
4538
- n.value !== null && (k ||= [], k.push(n));
4538
+ n.value !== null && (A ||= [], A.push(n));
4539
4539
  }
4540
4540
  }
4541
4541
  });
4542
- }, ee = S ? S.length : 0, M;
4542
+ }, ne = C ? C.length : 0, j;
4543
4543
  if (u > 0) {
4544
- M = V(u);
4544
+ j = V(u);
4545
4545
  for (let e = 0; e < u; e++) {
4546
4546
  let n = t[e], r = n.value, i = K.sanitizeRange(n);
4547
- M[e] = i, r !== null && A(i, r);
4547
+ j[e] = i, r !== null && ee(i, r);
4548
4548
  }
4549
4549
  }
4550
- let N = r?.cloneKey ?? null;
4551
- (ee > 0 || u > 0) && (D = a.getFormulas().clone(N));
4552
- for (let e = 0; e < ee; e++) j(S[e]);
4553
- for (let e = 0; e < u; e++) j(M[e]);
4554
- let te = E ? E.length : 0;
4555
- if (te > 0) {
4550
+ let M = r?.cloneKey ?? null;
4551
+ (ne > 0 || u > 0) && (O = a.getFormulas().clone(M));
4552
+ for (let e = 0; e < ne; e++) te(C[e]);
4553
+ for (let e = 0; e < u; e++) te(j[e]);
4554
+ let re = D ? D.length : 0;
4555
+ if (re > 0) {
4556
4556
  let e = a.getDynamics(), t = null;
4557
- for (let n = 0; n < te; n++) {
4558
- let r = E[n].value, i = e.get(r);
4559
- i && (O ||= a.getPrecedents().clone(N), O.removeAll(i, Gi), t ||= new Map(e), t.delete(r));
4557
+ for (let n = 0; n < re; n++) {
4558
+ let r = D[n].value, i = e.get(r);
4559
+ i && (k ||= a.getPrecedents().clone(M), k.removeAll(i, Gi), t ||= new Map(e), t.delete(r));
4560
4560
  }
4561
4561
  t && a.setDynamics(t);
4562
4562
  }
4563
- let P = [];
4564
- if (T || E) {
4565
- O ||= a.getPrecedents().clone(N), Yi(D, O, T, E), k && Zi(O, k, null);
4566
- let e = T ? this._joinInserted(D, O, T, (e) => {
4567
- v.push({
4563
+ let ae = [];
4564
+ if (E || D) {
4565
+ k ||= a.getPrecedents().clone(M), Yi(O, k, E, D), A && Zi(k, A, null);
4566
+ let e = E ? this._joinInserted(O, k, E, (e) => {
4567
+ y.push({
4568
4568
  colStart: e.colStart,
4569
4569
  rowStart: e.rowStart,
4570
4570
  colEnd: e.colEnd,
@@ -4572,8 +4572,8 @@ var Ai = class extends ke {
4572
4572
  scope: i
4573
4573
  });
4574
4574
  }) : null;
4575
- this._touchFormulas(E), this._touchFormulas(T), this._touchFormulas(k), this._touchFormulas(e);
4576
- let t = k ? function(e, ...t) {
4575
+ this._touchFormulas(D), this._touchFormulas(E), this._touchFormulas(A), this._touchFormulas(e);
4576
+ let t = A ? function(e, ...t) {
4577
4577
  let n = [];
4578
4578
  if (!e) return n;
4579
4579
  for (let r = 0; r < e.length; r++) {
@@ -4590,20 +4590,20 @@ var Ai = class extends ke {
4590
4590
  }
4591
4591
  }
4592
4592
  return n;
4593
- }(E, S, M) : E;
4594
- se(-1, t, T, _, m, f, (e, t, n, r) => {
4595
- v.push({
4593
+ }(D, C, j) : D;
4594
+ ie(-1, t, E, v, m, d, (e, t, n, r) => {
4595
+ y.push({
4596
4596
  colStart: e,
4597
4597
  rowStart: t,
4598
4598
  colEnd: n,
4599
4599
  rowEnd: r,
4600
4600
  scope: i
4601
4601
  });
4602
- }, this._notifyValues, C, this._notifyCalcStatus, h, p, !0, this._circularSpatial, this._calcStatusSpatial);
4602
+ }, this._notifyValues, w, this._notifyCalcStatus, h, p, !0, this._circularSpatial, this._calcStatusSpatial);
4603
4603
  }
4604
- if (O && a.setPrecedents(O), D && (T || E || k) && a.setFormulas(D), T) for (let e = 0; e < T.length; e++) {
4605
- let t = T[e];
4606
- P.push({
4604
+ if (k && a.setPrecedents(k), O && (E || D || A) && a.setFormulas(O), E) for (let e = 0; e < E.length; e++) {
4605
+ let t = E[e];
4606
+ ae.push({
4607
4607
  colStart: t.colStart,
4608
4608
  rowStart: t.rowStart,
4609
4609
  colEnd: t.colEnd,
@@ -4611,9 +4611,9 @@ var Ai = class extends ke {
4611
4611
  scope: i
4612
4612
  });
4613
4613
  }
4614
- if (E) for (let e = 0; e < E.length; e++) {
4615
- let t = E[e];
4616
- P.push({
4614
+ if (D) for (let e = 0; e < D.length; e++) {
4615
+ let t = D[e];
4616
+ ae.push({
4617
4617
  colStart: t.colStart,
4618
4618
  rowStart: t.rowStart,
4619
4619
  colEnd: t.colEnd,
@@ -4621,7 +4621,7 @@ var Ai = class extends ke {
4621
4621
  scope: i
4622
4622
  });
4623
4623
  }
4624
- return this._notifyCalcStatus.size() !== g && (a.getDeferred?.()?.noteRepaint(i), a.requestCalculateGrid(i)), v.length > 0 && a.markDirty(v), P;
4624
+ return this._notifyCalcStatus.size() !== _ && (a.getDeferred?.()?.noteRepaint(i), a.requestCalculateGrid(i)), y.length > 0 && a.markDirty(y), ae;
4625
4625
  }
4626
4626
  _rederivePrecedentsNow(e) {
4627
4627
  let t = this._container, n = t.getPrecedents().clone();
@@ -4646,15 +4646,15 @@ var Ai = class extends ke {
4646
4646
  let t = l(e);
4647
4647
  for (let n = 0; n < t.length; n++) if (t[n].value === e.value) return !0;
4648
4648
  return !1;
4649
- }, d = !1, p = (e) => {
4649
+ }, d = !1, f = (e) => {
4650
4650
  let n = e.value, r = a.get(n);
4651
4651
  r && (t.removeAll(r, Gi), a === o && (a = new Map(a)), a.delete(n), d = !0), !d && !s.isEmpty() && s.search(e).length > 0 && (d = !0);
4652
- }, m = null;
4652
+ }, p = null;
4653
4653
  for (let i = 0; i < n.length; i++) {
4654
4654
  let a = n[i];
4655
4655
  if (!c(a) || !u(a)) continue;
4656
4656
  d = !1;
4657
- let o = f(l, a, (e, t, n, r) => {
4657
+ let o = x(l, a, (e, t, n, r) => {
4658
4658
  if (!c(e) || !c(t)) return;
4659
4659
  let i = {
4660
4660
  colStart: n.colStart,
@@ -4664,12 +4664,12 @@ var Ai = class extends ke {
4664
4664
  };
4665
4665
  return e.value.getMerged(t.value, i, r);
4666
4666
  }, (n, r) => {
4667
- for (let e = 0; e < n.length; e++) p(n[e]);
4667
+ for (let e = 0; e < n.length; e++) f(n[e]);
4668
4668
  Zi(t, null, n), e.removeAll(n, Gi), e.load([r]), Zi(t, [r], null);
4669
4669
  });
4670
- o !== a && ((m ??= []).push(o), d && r(o));
4670
+ o !== a && ((p ??= []).push(o), d && r(o));
4671
4671
  }
4672
- return a !== o && i.setDynamics(a), m;
4672
+ return a !== o && i.setDynamics(a), p;
4673
4673
  }
4674
4674
  _clearAll() {
4675
4675
  this._contentfulSpatial.clear(), this._values.clear(), this._spillSpatial.clear(), this._errorSpatial.clear(), this._calcStatusSpatial.clear(), this._circularSpatial.clear(), this._notifyValues.clear(), this._notifyBlank = null, this._notifySpillsInsert = [], this._notifySpillsRemove = [], this._notifyFormats.clear(), this._notifyCalcStatus.clear(), this._touchedFormulas = [];
@@ -4704,8 +4704,8 @@ var Ai = class extends ke {
4704
4704
  let t = e.data;
4705
4705
  this._values.setValues(t);
4706
4706
  let n = this._values.getAxis() === W.Axis.Column;
4707
- lt(this._errorSpatial, t, n);
4708
- let r = we(t, n, this._gridId);
4707
+ nt(this._errorSpatial, t, n);
4708
+ let r = ve(t, n, this._gridId);
4709
4709
  this._contentfulSpatial.load(r);
4710
4710
  }
4711
4711
  let t = this._gridId, n = this._container, r = n.getPrecedents(), i = n.getFormulas(), a = {
@@ -4717,29 +4717,29 @@ var Ai = class extends ke {
4717
4717
  if (l) {
4718
4718
  let e = l.length;
4719
4719
  for (let t = 0; t < e; t++) {
4720
- let e = l[t], n = e[0], r = p(n, a).split(":")[0];
4720
+ let e = l[t], n = e[0], r = S(n, a).split(":")[0];
4721
4721
  u.add(r);
4722
- let i = gt(e, a);
4722
+ let i = Ge(e, a);
4723
4723
  i && d.add(`${i.rowStart},${i.colStart}`);
4724
4724
  }
4725
4725
  }
4726
- let f = o.length, m = Array(f), h = [], g = n.getRuntime(), _ = this._context, v = n.getScope();
4726
+ let f = o.length, p = Array(f), h = [], g = n.getRuntime(), _ = this._context, v = n.getScope();
4727
4727
  v.colIndex = 0, v.rowIndex = 0, v.gridId = t;
4728
4728
  let y = n.isLegacyIntersect();
4729
4729
  for (let e = 0; e < f; e++) {
4730
- let r = gt(o[e], a);
4730
+ let r = Ge(o[e], a);
4731
4731
  r.scope = t;
4732
4732
  let i = r.value, s = r.rowStart, c = r.colStart;
4733
4733
  v.colIndex = c, v.rowIndex = s;
4734
- let l = y && !(d.size > 0 && d.has(`${s},${c}`)), f = n.createFormulaBlock(t, _, i, s, c, void 0, l), p = f.resolvedPrecedentsAt(s, c, !0, Ii, Li), g = p.length;
4734
+ let l = y && !(d.size > 0 && d.has(`${s},${c}`)), f = n.createFormulaBlock(t, _, i, s, c, void 0, l), m = f.resolvedPrecedentsAt(s, c, !0, Ii, Li), g = m.length;
4735
4735
  g === 1 && (f = f.wrapImplicit(s, c, u));
4736
4736
  let b = new fi(r, t, f, n, this._unanchored);
4737
- b.fromLoad = !0, r.value = b, m[e] = r;
4737
+ b.fromLoad = !0, r.value = b, p[e] = r;
4738
4738
  let x = r.rowEnd, S = r.colEnd - c, C = x - s, w = [], T = f.getReferences(s, c);
4739
4739
  for (let e = 0; e < g; e++) {
4740
- let n = p[e];
4740
+ let n = m[e];
4741
4741
  if (U.isError(n)) continue;
4742
- let i = ve(T[e], Li[e], Ii[e]), a = i.$absColEnd, o = i.$absRowEnd, s = {
4742
+ let i = he(T[e], Li[e], Ii[e]), a = i.$absColEnd, o = i.$absRowEnd, s = {
4743
4743
  colStart: n.colStart,
4744
4744
  rowStart: n.rowStart,
4745
4745
  colEnd: n.colEnd + (a ? 0 : S),
@@ -4759,10 +4759,10 @@ var Ai = class extends ke {
4759
4759
  w.push(n), h.push(s);
4760
4760
  }
4761
4761
  }
4762
- if (i.load(m), r.load(h), n.bumpCalcEpochs(!0), s.formulaInserts = this._formulaRecords(m), l) {
4762
+ if (i.load(p), r.load(h), n.bumpCalcEpochs(!0), s.formulaInserts = this._formulaRecords(p), l) {
4763
4763
  let e = [], o = [], c = /* @__PURE__ */ new Map(), u = this._values, d = l.length;
4764
4764
  for (let n = 0; n < d; n++) {
4765
- let r = gt(l[n], a), s = r.value ?? "dynamic", d = s === "error", f = r.colStart, p = r.rowStart;
4765
+ let r = Ge(l[n], a), s = r.value ?? "dynamic", d = s === "error", f = r.colStart, p = r.rowStart;
4766
4766
  Ri.colStart = f, Ri.rowStart = p, Ri.colEnd = f, Ri.rowEnd = p, Ri.scope = t;
4767
4767
  let m = i.search(Ri);
4768
4768
  if (m.length !== 1) continue;
@@ -4772,13 +4772,13 @@ var Ai = class extends ke {
4772
4772
  colEnd: v,
4773
4773
  rowEnd: y
4774
4774
  };
4775
- s === "fixed" && (H(_).fixedRef = b, h.densify()), _.cachedValue = d ? U.BuiltIn.Spill : new $e(g, u, b);
4775
+ s === "fixed" && (H(_).fixedRef = b, h.densify()), _.cachedValue = d ? U.BuiltIn.Spill : new We(g, u, b);
4776
4776
  let x = {
4777
4777
  colStart: f,
4778
4778
  rowStart: p,
4779
4779
  colEnd: v,
4780
4780
  rowEnd: y,
4781
- value: new ot(b, 0, s)
4781
+ value: new Qe(b, 0, s)
4782
4782
  };
4783
4783
  o.push(x), e.push({
4784
4784
  colStart: f,
@@ -4786,7 +4786,7 @@ var Ai = class extends ke {
4786
4786
  colEnd: v,
4787
4787
  rowEnd: y,
4788
4788
  value: s
4789
- }), le(c, _, b, mi);
4789
+ }), oe(c, _, b, mi);
4790
4790
  }
4791
4791
  if (this._spillSpatial.load(o), c.size > 0) {
4792
4792
  r.load(Array.from(c.values()).flat()), n.bumpCalcEpochs(!1);
@@ -4796,23 +4796,23 @@ var Ai = class extends ke {
4796
4796
  }
4797
4797
  e.length > 0 && (s.spillInserts = e);
4798
4798
  }
4799
- let b = !1, x = e.volatile, S = x ? x.length : 0;
4800
- if (S > 0) {
4799
+ let b = !1, x = e.volatile, C = x ? x.length : 0;
4800
+ if (C > 0) {
4801
4801
  let e = n.getVolatiles(), t = (t) => {
4802
4802
  e.add(t), t.state |= $n, t.block.calcOnLoad = !0;
4803
- }, r = Array(S);
4804
- for (let e = 0; e < S; e++) {
4805
- let n = x[e], o = pe(n, a);
4803
+ }, r = Array(C);
4804
+ for (let e = 0; e < C; e++) {
4805
+ let n = x[e], o = m(n, a);
4806
4806
  r[e] = { ...o };
4807
4807
  let s = i.search(o), c = s.length;
4808
4808
  for (let e = 0; e < c; e++) {
4809
4809
  let n = s[e];
4810
- nt(n, o, t);
4810
+ qe(n, o, t);
4811
4811
  }
4812
4812
  }
4813
4813
  this._markDirtyRegionsNow(r), b = !0;
4814
4814
  }
4815
- let C = this._contentfulSpatial, w = !C.isEmpty(), T = null, E = {
4815
+ let w = this._contentfulSpatial, T = !w.isEmpty(), E = null, D = {
4816
4816
  rowStart: 0,
4817
4817
  colStart: 0,
4818
4818
  rowEnd: 0,
@@ -4820,29 +4820,29 @@ var Ai = class extends ke {
4820
4820
  scope: t
4821
4821
  };
4822
4822
  for (let e = 0; e < f; e++) {
4823
- let t = m[e];
4823
+ let t = p[e];
4824
4824
  if (!t) continue;
4825
4825
  let n = (t.rowEnd - t.rowStart + 1) * (t.colEnd - t.colStart + 1), r = 0;
4826
- if (w) {
4827
- E.rowStart = t.rowStart, E.colStart = t.colStart, E.rowEnd = t.rowEnd, E.colEnd = t.colEnd;
4828
- let e = C.search(E);
4826
+ if (T) {
4827
+ D.rowStart = t.rowStart, D.colStart = t.colStart, D.rowEnd = t.rowEnd, D.colEnd = t.colEnd;
4828
+ let e = w.search(D);
4829
4829
  for (let n = 0; n < e.length; n++) {
4830
4830
  let i = e[n];
4831
4831
  r += (Math.min(i.rowEnd, t.rowEnd) - Math.max(i.rowStart, t.rowStart) + 1) * (Math.min(i.colEnd, t.colEnd) - Math.max(i.colStart, t.colStart) + 1);
4832
4832
  }
4833
4833
  }
4834
4834
  let i = r < n && !this._isSavedSpill(t);
4835
- i && (t.value.uncalculated = !0), (i || t.value?.getError()) && (T ??= []).push({
4835
+ i && (t.value.uncalculated = !0), (i || t.value?.getError()) && (E ??= []).push({
4836
4836
  rowStart: t.rowStart,
4837
4837
  colStart: t.colStart,
4838
4838
  rowEnd: t.rowEnd,
4839
4839
  colEnd: t.colEnd
4840
4840
  });
4841
4841
  }
4842
- if (T && (this._markDirtyRegionsNow(T), b = !0), c && f > 0) {
4842
+ if (E && (this._markDirtyRegionsNow(E), b = !0), c && f > 0) {
4843
4843
  let e = Array(f);
4844
4844
  for (let t = 0; t < f; t++) {
4845
- let n = m[t];
4845
+ let n = p[t];
4846
4846
  e[t] = {
4847
4847
  rowStart: n.rowStart,
4848
4848
  colStart: n.colStart,
@@ -4882,42 +4882,42 @@ var Ai = class extends ke {
4882
4882
  }
4883
4883
  _toJSONNow(e) {
4884
4884
  let t = this._container.getFormulas().getSpatialAt(this._gridId)?.all(), n = t ? t.length : 0;
4885
- n > 0 && (t = ce(t, xn.Column, 2, Ki), t.sort(K.rowFirstRangeComparator)), n = t ? t.length : 0;
4886
- let r = this._hiddenRows, a = this._hiddenColumns, o = this._filtered;
4887
- if (n === 0 && !r && !a && !o) return null;
4888
- let s = {};
4889
- r && (s.hiddenRows = r), a && (s.hiddenColumns = a), o && (s.filtered = !0);
4890
- let c = this._spillSpatial.all().filter((e) => e.value.getKind() !== "pivot"), l = c.length;
4891
- if (l > 1 && c.sort(K.rowFirstRangeComparator), n > 0) {
4885
+ n > 0 && (t = le(t, xn.Column, 2, Ki), t.sort(K.rowFirstRangeComparator)), n = t ? t.length : 0;
4886
+ let r = this._hiddenRows, i = this._hiddenColumns, a = this._filtered;
4887
+ if (n === 0 && !r && !i && !a) return null;
4888
+ let o = {};
4889
+ r && (o.hiddenRows = r), i && (o.hiddenColumns = i), a && (o.filtered = !0);
4890
+ let s = this._spillSpatial.all().filter((e) => e.value.getKind() !== "pivot"), c = s.length;
4891
+ if (c > 1 && s.sort(K.rowFirstRangeComparator), n > 0) {
4892
4892
  let e = Array(n);
4893
4893
  for (let r = 0; r < n; r++) {
4894
4894
  let n = t[r];
4895
4895
  e[r] = n.value.toJSON(!1, n);
4896
4896
  }
4897
- s.formulas = e;
4897
+ o.formulas = e;
4898
4898
  }
4899
- if (l > 0) {
4900
- let e = this.getEntireCoords(), t = Array(l);
4901
- for (let n = 0; n < l; n++) {
4902
- let r = c[n], a = i(r, e);
4903
- t[n] = [a, r.value.getKind()];
4899
+ if (c > 0) {
4900
+ let e = this.getEntireCoords(), t = Array(c);
4901
+ for (let n = 0; n < c; n++) {
4902
+ let r = s[n], i = De(r, e);
4903
+ t[n] = [i, r.value.getKind()];
4904
4904
  }
4905
- s.formulaArray = t;
4905
+ o.formulaArray = t;
4906
4906
  }
4907
- let u = this._container.getVolatiles(), d = this._gridId, f = null;
4908
- if (u.size > 0) {
4909
- let e = u.values(), t = e.next(), n = this._values.getAxis() === W.Axis.Column, r = E(!0);
4907
+ let l = this._container.getVolatiles(), u = this._gridId, d = null;
4908
+ if (l.size > 0) {
4909
+ let e = l.values(), t = e.next(), n = this._values.getAxis() === W.Axis.Column, r = ne(!0);
4910
4910
  for (; !t.done;) {
4911
4911
  let i = t.value;
4912
- if (t = e.next(), i.gridId !== d || i.ext !== null && i.ext.shownGroup !== 0) continue;
4912
+ if (t = e.next(), i.gridId !== u || i.ext !== null && i.ext.shownGroup !== 0) continue;
4913
4913
  let a = i.colIndex, o = i.rowIndex, s = n ? a : o, c = n ? o : a;
4914
4914
  r.append(s, c);
4915
4915
  }
4916
- f = r.done(!0);
4916
+ d = r.done(!0);
4917
4917
  }
4918
- let p = this._circularSpatial, m = this._calcStatusSpatial, h = c.filter((e) => e.value.getError());
4919
- if (!p.isEmpty() || !m.isEmpty() || h.length > 0) {
4920
- let e = f ? f.slice() : [], t = (t) => {
4918
+ let f = this._circularSpatial, p = this._calcStatusSpatial, m = s.filter((e) => e.value.getError());
4919
+ if (!f.isEmpty() || !p.isEmpty() || m.length > 0) {
4920
+ let e = d ? d.slice() : [], t = (t) => {
4921
4921
  for (let n = 0; n < t.length; n++) {
4922
4922
  let r = t[n];
4923
4923
  e.push({
@@ -4928,20 +4928,20 @@ var Ai = class extends ke {
4928
4928
  });
4929
4929
  }
4930
4930
  };
4931
- p.isEmpty() || t(p.all());
4932
- let n = m.isEmpty() ? [] : m.all().filter((e) => e.value === j.CalcStatus.Working);
4933
- n.length > 0 && t(n), h.length > 0 && t(h), f = ce(e, xn.Column, 2);
4934
- }
4935
- let g = f ? f.length : 0;
4936
- if (g > 0) {
4937
- let e = Array(g);
4938
- for (let t = 0; t < g; t++) {
4939
- let n = f[t], r = i(n, this.getEntireCoords());
4931
+ f.isEmpty() || t(f.all());
4932
+ let n = p.isEmpty() ? [] : p.all().filter((e) => e.value === D.CalcStatus.Working);
4933
+ n.length > 0 && t(n), m.length > 0 && t(m), d = le(e, xn.Column, 2);
4934
+ }
4935
+ let h = d ? d.length : 0;
4936
+ if (h > 0) {
4937
+ let e = Array(h);
4938
+ for (let t = 0; t < h; t++) {
4939
+ let n = d[t], r = De(n, this.getEntireCoords());
4940
4940
  e[t] = r;
4941
4941
  }
4942
- s.volatile = e;
4942
+ o.volatile = e;
4943
4943
  }
4944
- return s;
4944
+ return o;
4945
4945
  }
4946
4946
  }, ji = /* @__PURE__ */ new WeakMap(), Mi = (e, t) => {
4947
4947
  let n = e?.length ?? 0;
@@ -5049,25 +5049,25 @@ function Zi(e, t, n) {
5049
5049
  let a = [];
5050
5050
  for (let e = 0; e < i; e++) {
5051
5051
  let n = t[e], r = [], i = a.length;
5052
- m(n, a, r), a.length > i && (n.value.registeredPrecedents = a.slice(i));
5052
+ h(n, a, r), a.length > i && (n.value.registeredPrecedents = a.slice(i));
5053
5053
  }
5054
5054
  e.load(a);
5055
5055
  }
5056
5056
  Wi.fill(null, 0, 10);
5057
5057
  var Qi = (e) => {
5058
5058
  let t = !1;
5059
- if (ye.forEachLeaf(e, (e, n, r, i) => {
5060
- if (t || e instanceof M) return;
5059
+ if (te.forEachLeaf(e, (e, n, r, i) => {
5060
+ if (t || e instanceof u) return;
5061
5061
  let a = n + i - r;
5062
5062
  !0 === e.isIRepeatingList && (a = Math.min(a, n + e.getPeriod() - 1));
5063
- for (let r = n; !t && r <= a; r++) t = St(e.at(r));
5063
+ for (let r = n; !t && r <= a; r++) t = Dt(e.at(r));
5064
5064
  }), !t) return e;
5065
- let n = e.length, r = Array(n);
5066
- for (let t = 0; t < n; t++) r[t] = Te(e.at(t));
5067
- return new P.ArrayList(r);
5065
+ let n = e.length, i = Array(n);
5066
+ for (let t = 0; t < n; t++) i[t] = Tt(e.at(t));
5067
+ return new r.ArrayList(i);
5068
5068
  }, $i = (e, t, n) => {
5069
5069
  let r = n?.fetchedFrom;
5070
- if (!e) return new c({
5070
+ if (!e) return new O({
5071
5071
  source: { buffer: t },
5072
5072
  fetchedFrom: r
5073
5073
  });
@@ -5108,13 +5108,13 @@ var Qi = (e) => {
5108
5108
  }
5109
5109
  }
5110
5110
  _moved() {
5111
- Et(), this._onMoved?.(this);
5111
+ ye(), this._onMoved?.(this);
5112
5112
  }
5113
5113
  _final() {
5114
5114
  let e = this._onFinal;
5115
5115
  this._onFinal = null, e?.(this);
5116
5116
  }
5117
- }, aa = (e) => e, oa = (e, t) => st.fromJSON({
5117
+ }, aa = (e) => e, oa = (e, t) => He.fromJSON({
5118
5118
  type: e,
5119
5119
  data: t
5120
5120
  }), sa = (e, t) => globalThis.fetch(e, t), ca = () => {
@@ -5229,7 +5229,7 @@ var Qi = (e) => {
5229
5229
  }, e);
5230
5230
  }
5231
5231
  newHolder(e, t) {
5232
- return this._holders = !0, new be(e, t.calls, t.direct);
5232
+ return this._holders = !0, new St(e, t.calls, t.direct);
5233
5233
  }
5234
5234
  defer(e, t, n = null, r = !1) {
5235
5235
  let i = this._scope, a = i.deferOrdinal++;
@@ -5305,7 +5305,7 @@ var Qi = (e) => {
5305
5305
  let t = this._scope, n = t.node;
5306
5306
  if (!n || !this._holders || !t.gridId) return;
5307
5307
  let r = this._heldAt(t.gridId, t.rowIndex, t.colIndex);
5308
- return r === null && St(n.cachedValue) && (r = n.cachedValue), r === null ? void 0 : r.calls[e];
5308
+ return r === null && Dt(n.cachedValue) && (r = n.cachedValue), r === null ? void 0 : r.calls[e];
5309
5309
  }
5310
5310
  }, fa = (e, t) => {
5311
5311
  for (let n of e) n.isOpen() && n.reject(t);
@@ -5394,7 +5394,7 @@ var Qi = (e) => {
5394
5394
  }
5395
5395
  _grow() {
5396
5396
  let e = this._keys, t = this._values, n = this._order, r = this.size, i = Math.max(64, 2 * (this._mask + 1));
5397
- this._keys = new Float64Array(i).fill(-1), this._values = Ge(i), this._order = new Int32Array(i), this._mask = i - 1;
5397
+ this._keys = new Float64Array(i).fill(-1), this._values = Ie(i), this._order = new Int32Array(i), this._mask = i - 1;
5398
5398
  for (let i = 0; i < r; i++) {
5399
5399
  let r = e[n[i]], a = Math.floor(r / ga), o = this._slotOf(a, r - a * ga, r);
5400
5400
  this._keys[o] = r, this._values[o] = t[n[i]], this._order[i] = o;
@@ -5781,7 +5781,7 @@ var xa = {
5781
5781
  getValues(e) {
5782
5782
  let t = this.getRuns(e ? { bounds: e } : void 0), n = t.next();
5783
5783
  if (n.done) return null;
5784
- let r = new _e.Builder();
5784
+ let r = new de.Builder();
5785
5785
  for (; !n.done;) r.pushMultipleAt(n.value[0], n.value[1], n.value[2]), n = t.next();
5786
5786
  return r.build();
5787
5787
  }
@@ -6113,16 +6113,16 @@ var Pa = class {
6113
6113
  dynamicByBlock: _,
6114
6114
  lastUpdates: new Map(v)
6115
6115
  };
6116
- let D = /* @__PURE__ */ new Map();
6116
+ let E = /* @__PURE__ */ new Map();
6117
6117
  this._addDynamicPrecedent = (e, t, n) => {
6118
- e?.block && (f.getScope().perCellRead = !0, n === pi && (e.state |= $n), le(D, e, t, n));
6118
+ e?.block && (f.getScope().perCellRead = !0, n === pi && (e.state |= $n), oe(E, e, t, n));
6119
6119
  };
6120
- let O = /* @__PURE__ */ new Map(), k = (e, t) => {
6120
+ let D = /* @__PURE__ */ new Map(), O = (e, t) => {
6121
6121
  (function(e, t, n, r) {
6122
6122
  if (t === 0) return;
6123
6123
  let i, a, o, s = Va, c = [], l = /* @__PURE__ */ new Set(), u = () => {
6124
6124
  let e = i.build();
6125
- e && e.tuples && (o.values.setValues(e.tuples), lt(o.errorSpatial, e.tuples, r));
6125
+ e && e.tuples && (o.values.setValues(e.tuples), nt(o.errorSpatial, e.tuples, r));
6126
6126
  let t = a.done(!0);
6127
6127
  for (let e = 0; e < t.length; e++) {
6128
6128
  let n = t[e];
@@ -6148,7 +6148,7 @@ var Pa = class {
6148
6148
  e.length = t, e.sort(r ? Wa : Ka);
6149
6149
  for (let d = 0; d < t; d++) {
6150
6150
  let t = e[d], f = t.colIndex, p = t.rowIndex, m = t.gridId;
6151
- m || console.log("nodeGridId is null", t), m !== s && (s !== Va && u(), i = new _e.Builder(Fa), a = E(r), s = m, o = n(m));
6151
+ m || console.log("nodeGridId is null", t), m !== s && (s !== Va && u(), i = new de.Builder(Fa), a = ne(r), s = m, o = n(m));
6152
6152
  let h = r ? f : p, g = r ? p : f, _ = t.cachedValue;
6153
6153
  _?.isIRange || (i.pushAt(h, g, _), a.append(h, g));
6154
6154
  let v = t.block, y = t.numFmt;
@@ -6169,7 +6169,7 @@ var Pa = class {
6169
6169
  }
6170
6170
  });
6171
6171
  }
6172
- } else y !== null && (o.formatsConflating || (o.formatsConflating = E(r)), o.formatsConflating.append(h, g, y));
6172
+ } else y !== null && (o.formatsConflating || (o.formatsConflating = ne(r)), o.formatsConflating.append(h, g, y));
6173
6173
  }
6174
6174
  u();
6175
6175
  })(e, t, p, !0);
@@ -6177,22 +6177,22 @@ var Pa = class {
6177
6177
  let t = e[n];
6178
6178
  t.state = t.state & ~q | pr;
6179
6179
  }
6180
- for (let [e, t] of v) O.set(e, t);
6180
+ for (let [e, t] of v) D.set(e, t);
6181
6181
  v.clear();
6182
- }, A = r, j = ss;
6183
- j.length = 0;
6184
- let ee = 0, M = !1;
6182
+ }, k = r, A = ss;
6183
+ A.length = 0;
6184
+ let ee = 0, te = !1;
6185
6185
  do {
6186
- ++S, x(), this.doMarkAndPlan(e, S, C, j);
6187
- let t = this.doEvaluate(e, p, k, A, j);
6188
- M = t !== void 0, M && (A = !1, ++S, C.length = 0, this.doCollectDirtyCalcs(e, S, t.all(), C, l, h, y), ee > 200 && (++S, x(), this.doMarkAndPlan(e, S, C, j, !0), this.doEvaluate(e, p, k, !1, j), this._hasCycle() || console.error("Too many iterations, possible cycle or leak"), M = !1)), ee++;
6189
- } while (M);
6186
+ ++S, x(), this.doMarkAndPlan(e, S, C, A);
6187
+ let t = this.doEvaluate(e, p, O, k, A);
6188
+ te = t !== void 0, te && (k = !1, ++S, C.length = 0, this.doCollectDirtyCalcs(e, S, t.all(), C, l, h, y), ee > 200 && (++S, x(), this.doMarkAndPlan(e, S, C, A, !0), this.doEvaluate(e, p, O, !1, A), this._hasCycle() || console.error("Too many iterations, possible cycle or leak"), te = !1)), ee++;
6189
+ } while (te);
6190
6190
  for (let e of b) {
6191
- if (D.has(e)) continue;
6191
+ if (E.has(e)) continue;
6192
6192
  let t = _.get(e);
6193
6193
  t && (h.removeAll(t, Gi), _ === g && (_ = new Map(_)), _.delete(e));
6194
6194
  }
6195
- if (D.size > 0) {
6195
+ if (E.size > 0) {
6196
6196
  if (function(e, t, n) {
6197
6197
  for (let t of n) if (!e.has(t)) return !1;
6198
6198
  for (let [n, r] of e) {
@@ -6211,22 +6211,22 @@ var Pa = class {
6211
6211
  }
6212
6212
  }
6213
6213
  return !0;
6214
- }(D, g, b)) h = m, _ = g, D.clear();
6214
+ }(E, g, b)) h = m, _ = g, E.clear();
6215
6215
  else {
6216
6216
  h === m && (h = h.clone()), _ === g && (_ = new Map(_));
6217
- for (let e of D.keys()) {
6217
+ for (let e of E.keys()) {
6218
6218
  let t = _.get(e);
6219
6219
  t && h.removeAll(t, Gi);
6220
6220
  }
6221
- h.load(Array.from(D.values()).flat());
6222
- for (let [e, t] of D) _.set(e, t);
6223
- D.clear();
6221
+ h.load(Array.from(E.values()).flat());
6222
+ for (let [e, t] of E) _.set(e, t);
6223
+ E.clear();
6224
6224
  }
6225
6225
  }
6226
6226
  return this._gridUpdates = null, this._addDynamicPrecedent = null, this._context._setDynamicReadHook(null), this._passActive = !1, f.getDeferred?.()?.flush(), {
6227
6227
  precedentSpatial: h,
6228
6228
  dynamicByBlock: _,
6229
- lastUpdates: O,
6229
+ lastUpdates: D,
6230
6230
  skippedTables: this._takeSkippedTables()
6231
6231
  };
6232
6232
  }
@@ -6239,7 +6239,7 @@ var Pa = class {
6239
6239
  if (r?.isIRange && r.size > 1) {
6240
6240
  if (t.uncalculated) return;
6241
6241
  let i = e.rowIndex, a = e.colIndex;
6242
- return new $e(this._container.getRuntime(), n.getValues().clone(), {
6242
+ return new We(this._container.getRuntime(), n.getValues().clone(), {
6243
6243
  rowStart: i,
6244
6244
  colStart: a,
6245
6245
  rowEnd: i + r.getRowCount() - 1,
@@ -6432,7 +6432,7 @@ var Pa = class {
6432
6432
  let t = r.deferCount;
6433
6433
  i = n.finalizeValueForCell(n.evaluateAt(e.rowIndex, e.colIndex)), r.deferCount !== t && (i = this._takeDeferred(e, i));
6434
6434
  } catch (t) {
6435
- if (!(t instanceof je)) throw t;
6435
+ if (!(t instanceof Oe)) throw t;
6436
6436
  i = e.cachedValue ?? null;
6437
6437
  }
6438
6438
  return this._fitCell(t, i);
@@ -6464,15 +6464,15 @@ var Pa = class {
6464
6464
  if (i.blankCycleId === a && i.blankMarkId === o) return;
6465
6465
  let s = this._container.getScope(), c = s.perCellRead, l = !(r || c || t && t.isIRange), u = !1;
6466
6466
  if (l && s.positionRead && (u = !this._isPositionFree(e, t), l = !u), !l) return u && !c && this._container.getGrid(e.gridId)?.isPaged() ? void this._pageBlank(i, n) : void this._fallbackBlank(i, c || u);
6467
- let f = i.blankShared, p = i.blankValue;
6467
+ let d = i.blankShared, p = i.blankValue;
6468
6468
  i.blankValue = t, i.blankCycleId = a, i.blankMarkId = o;
6469
6469
  let m = i.getTouchedCached().blank, h = e.gridId, g = n.values, _ = n.errorSpatial, v = this._container.getGrid(h);
6470
6470
  if (v !== null && v.getShadowOf() !== null) return void La(m, n, h);
6471
6471
  let y = g.getAxis() === W.Axis.Column, b = y ? W.Axis.Column : W.Axis.Row, x = oo, S = so;
6472
6472
  for (let e = 0; e < m.length; e++) {
6473
- let n = m[e], r = y ? n.colStart : n.rowStart, i = y ? n.colEnd : n.rowEnd, a = y ? n.rowStart : n.colStart, o = y ? n.rowEnd - n.rowStart + 1 : n.colEnd - n.colStart + 1, s = new F([t], o), c = Array(i - r + 1);
6473
+ let n = m[e], r = y ? n.colStart : n.rowStart, i = y ? n.colEnd : n.rowEnd, a = y ? n.rowStart : n.colStart, o = y ? n.rowEnd - n.rowStart + 1 : n.colEnd - n.colStart + 1, s = new P([t], o), c = Array(i - r + 1);
6474
6474
  for (let e = r; e <= i; e++) c[e - r] = [e, [[a, s]]];
6475
- g.setValues(c), d(_, n), lt(_, c, y);
6475
+ g.setValues(c), f(_, n), nt(_, c, y);
6476
6476
  let l = {
6477
6477
  colStart: n.colStart,
6478
6478
  rowStart: n.rowStart,
@@ -6482,10 +6482,10 @@ var Pa = class {
6482
6482
  };
6483
6483
  x.push({
6484
6484
  ...l,
6485
- value: new We(l, b)
6485
+ value: new Fe(l, b)
6486
6486
  }), S.push(l);
6487
6487
  }
6488
- n.contentfulSpatial.insertAllNonOverlapping(x), n.notifyValues.insertAllNonOverlapping(S), x.length = 0, S.length = 0, i.setBlankShared(m), this._dirtyBlankReaders(h, m, p === t ? f : null);
6488
+ n.contentfulSpatial.insertAllNonOverlapping(x), n.notifyValues.insertAllNonOverlapping(S), x.length = 0, S.length = 0, i.setBlankShared(m), this._dirtyBlankReaders(h, m, p === t ? d : null);
6489
6489
  }
6490
6490
  _dirtyBlankReaders(e, t, n) {
6491
6491
  if (n !== null && Qr(t, n)) return;
@@ -6494,7 +6494,7 @@ var Pa = class {
6494
6494
  for (let e = 0; e < t.length; e++) n === null ? i.push(t[e]) : $r(t[e], n, i);
6495
6495
  for (let t = 0; t < i.length; t++) {
6496
6496
  let n = i[t];
6497
- a.colStart = n.colStart, a.rowStart = n.rowStart, a.colEnd = n.colEnd, a.rowEnd = n.rowEnd, r.search(a).length !== 0 && (this._fallbackDirty ??= new v()).insertNonOverlapping({
6497
+ a.colStart = n.colStart, a.rowStart = n.rowStart, a.colEnd = n.colEnd, a.rowEnd = n.rowEnd, r.search(a).length !== 0 && (this._fallbackDirty ??= new N()).insertNonOverlapping({
6498
6498
  colStart: n.colStart,
6499
6499
  rowStart: n.rowStart,
6500
6500
  colEnd: n.colEnd,
@@ -6511,7 +6511,7 @@ var Pa = class {
6511
6511
  Ra(e, n.blank, t);
6512
6512
  let r = e.getDemandedBlank();
6513
6513
  if (r.length === 0) return;
6514
- let i = this._fallbackDirty ??= new v(), a = e.gridId, o = co;
6514
+ let i = this._fallbackDirty ??= new N(), a = e.gridId, o = co;
6515
6515
  for (let e = 0; e < r.length; e++) {
6516
6516
  let t = r[e];
6517
6517
  o.push({
@@ -6530,7 +6530,7 @@ var Pa = class {
6530
6530
  if (n === null) return;
6531
6531
  let r = n.blank;
6532
6532
  if (r.length === 0) return;
6533
- let i = this._fallbackDirty ??= new v(), a = e.gridId, o = co;
6533
+ let i = this._fallbackDirty ??= new N(), a = e.gridId, o = co;
6534
6534
  for (let e = 0; e < r.length; e++) {
6535
6535
  let t = r[e];
6536
6536
  o.push({
@@ -6821,7 +6821,7 @@ var Pa = class {
6821
6821
  let t = this._cycleOf(s), n = o === X;
6822
6822
  (n ? t.members : t.downstream).add(e), c = t.getEntry(n);
6823
6823
  }
6824
- a.shownGroup = s, e.state = e.state & ~tr | o << 2, t.circularConflating ||= E(i), t.circularConflating.append(n, r, c);
6824
+ a.shownGroup = s, e.state = e.state & ~tr | o << 2, t.circularConflating ||= ne(i), t.circularConflating.append(n, r, c);
6825
6825
  }
6826
6826
  _cycleOf(e) {
6827
6827
  let t = this._cycles.get(e);
@@ -6907,8 +6907,8 @@ var Pa = class {
6907
6907
  sn(r, n, t, O, k, A);
6908
6908
  }
6909
6909
  }
6910
- let j = qa();
6911
- if (g.discoveryMs += j - _, v && g.fastEligible++, y !== null) {
6910
+ let ee = qa();
6911
+ if (g.discoveryMs += ee - _, v && g.fastEligible++, y !== null) {
6912
6912
  let n = y.plan, r = y.planLength === b;
6913
6913
  for (let i = 0; r && i < b; i++) {
6914
6914
  let a = n[i];
@@ -6943,7 +6943,7 @@ var Pa = class {
6943
6943
  })(go, b, s, this._lastStampedLength), r.length = b;
6944
6944
  let e = b, t = this._lastStampedOrderedLength;
6945
6945
  for (; e > 0 && s[e - 1].orderIndex >= t;) e--;
6946
- return e < b && this._flagDemandAppendix(s, e, b), this._rememberPlan(a, o, s, b, m, e), g.fastHits++, g.kahnMs += qa() - j, e === b;
6946
+ return e < b && this._flagDemandAppendix(s, e, b), this._rememberPlan(a, o, s, b, m, e), g.fastHits++, g.kahnMs += qa() - ee, e === b;
6947
6947
  }
6948
6948
  if (f === "on" && !i && A.size > 0 && x === 0 && b >= Uo && this._cycles.size === 0 && function(e, t, n, r) {
6949
6949
  let i = /* @__PURE__ */ new Map(), a = null;
@@ -7006,27 +7006,27 @@ var Pa = class {
7006
7006
  for (let e = 0; e < i.length; e++) --i[e].waitingOn === 0 && o.push(i[e]);
7007
7007
  }
7008
7008
  return o.length === i.size;
7009
- }(go, b, d, s)) return r.length = b, this._stampPlan(s, b, b, p), this._rememberPlan(a, o, s, b, m), g.blockOrdered++, g.kahnMs += qa() - j, !0;
7010
- let ee = (e) => {
7009
+ }(go, b, d, s)) return r.length = b, this._stampPlan(s, b, b, p), this._rememberPlan(a, o, s, b, m), g.blockOrdered++, g.kahnMs += qa() - ee, !0;
7010
+ let te = (e) => {
7011
7011
  g.planAssertFailures++, console.error("CalcExecutor: order-stamp fast path would invert a static edge at", e.gridId, e.rowIndex, e.colIndex), v = !1;
7012
- }, M = (n) => {
7013
- n.cycleId === e && n.markId === t ? (Bo++, v && n.orderIndex >= zo.orderIndex && ee(zo)) : this._iterate || (n.state & tr) === 0 || (this._taintGroup = n.ext.shownGroup, this._taintDownstream(zo));
7014
- }, N = null, te = (n) => {
7012
+ }, ne = (n) => {
7013
+ n.cycleId === e && n.markId === t ? (Bo++, v && n.orderIndex >= zo.orderIndex && te(zo)) : this._iterate || (n.state & tr) === 0 || (this._taintGroup = n.ext.shownGroup, this._taintDownstream(zo));
7014
+ }, j = null, M = (n) => {
7015
7015
  n.cycleId === e && n.markId === t ? (Yo++, n.orderIndex > Xo && (Xo = n.orderIndex)) : Zo !== null || this._iterate || (n.state & tr) === 0 || (Zo = n.ext.shownGroup);
7016
- }, P = (e, t, n, r, i) => {
7017
- N === null && (N = /* @__PURE__ */ new Map());
7018
- let a = N.get(e);
7016
+ }, re = (e, t, n, r, i) => {
7017
+ j === null && (j = /* @__PURE__ */ new Map());
7018
+ let a = j.get(e);
7019
7019
  a === void 0 && (a = {
7020
7020
  rects: [],
7021
7021
  next: 0
7022
- }, N.set(e, a));
7022
+ }, j.set(e, a));
7023
7023
  let o = a.rects;
7024
7024
  for (let e = 0; e < o.length; e++) {
7025
7025
  let a = o[e];
7026
7026
  if (a.rowFrom === t && a.rowTo === n && a.colFrom === r && a.colTo === i) return a;
7027
7027
  }
7028
7028
  let s;
7029
- return Yo = 0, Xo = -1, Zo = null, e.forEachNodeIn(t, n, r, i, te), o.length < Ho ? (s = {
7029
+ return Yo = 0, Xo = -1, Zo = null, e.forEachNodeIn(t, n, r, i, M), o.length < Ho ? (s = {
7030
7030
  rowFrom: t,
7031
7031
  rowTo: n,
7032
7032
  colFrom: r,
@@ -7060,9 +7060,9 @@ var Pa = class {
7060
7060
  for (let e = 0; e < m; e++) {
7061
7061
  let n = u[e], r = n.colStart, l = n.rowStart, d = n.colEnd, f = n.rowEnd, p = Math.max(r, a), m = Math.max(l, o), h = Math.min(d, s), g = Math.min(f, c);
7062
7062
  if ((g - m + 1) * (h - p + 1) >= Vo) {
7063
- let e = P(n.value, m, g, p, h);
7064
- i += e.count, v && e.maxOrder >= t.orderIndex && ee(t), e.shownGroup !== null && (this._taintGroup = e.shownGroup, this._taintDownstream(t));
7065
- } else zo = t, Bo = i, n.value.forEachNodeIn(m, g, p, h, M), i = Bo;
7063
+ let e = re(n.value, m, g, p, h);
7064
+ i += e.count, v && e.maxOrder >= t.orderIndex && te(t), e.shownGroup !== null && (this._taintGroup = e.shownGroup, this._taintDownstream(t));
7065
+ } else zo = t, Bo = i, n.value.forEachNodeIn(m, g, p, h, ne), i = Bo;
7066
7066
  }
7067
7067
  }
7068
7068
  t.inDegree = i, x === 0 && t.inDegree === 0 && (yo[C++] = t);
@@ -7083,9 +7083,9 @@ var Pa = class {
7083
7083
  }
7084
7084
  }
7085
7085
  g.formulaCacheHits += w, g.formulaCacheMisses += T;
7086
- let ne = qa();
7087
- g.inDegreeMs += ne - j;
7088
- let re = (n) => {
7086
+ let ie = qa();
7087
+ g.inDegreeMs += ie - ee;
7088
+ let ae = (n) => {
7089
7089
  n.cycleId === e && n.markId === t && (n.inDegree--, n.inDegree === 0 && (yo[C++] = n));
7090
7090
  };
7091
7091
  for (; S < C;) {
@@ -7094,17 +7094,17 @@ var Pa = class {
7094
7094
  let t = e.colIndex, n = e.rowIndex, r = e.ext;
7095
7095
  if (r !== null) {
7096
7096
  let e = r.spillDependents, i = e.length;
7097
- for (let a = 0; a < i; a++) on(e[a], n, t, r.spillRowStart, r.spillColStart, r.spillRowEnd, r.spillColEnd, re);
7097
+ for (let a = 0; a < i; a++) on(e[a], n, t, r.spillRowStart, r.spillColStart, r.spillRowEnd, r.spillColEnd, ae);
7098
7098
  }
7099
7099
  let i;
7100
7100
  i = e.dependents;
7101
7101
  let a = i.length;
7102
7102
  if (a !== 0) for (let e = 0; e < a; e++) {
7103
7103
  let r = i[e];
7104
- Qt(r, n, t, re);
7104
+ Qt(r, n, t, ae);
7105
7105
  }
7106
7106
  }
7107
- if (g.kahnMs += qa() - ne, i || c < b) {
7107
+ if (g.kahnMs += qa() - ie, i || c < b) {
7108
7108
  if (v) {
7109
7109
  let e = this._lastStampedOrderedLength;
7110
7110
  for (let t = 0; t < b; t++) {
@@ -7175,150 +7175,150 @@ var Pa = class {
7175
7175
  d.length = r, l.planLength = r, l.epoch = i, l.cycleFree = f, l.cycleEpoch = this._cycleEpoch, l.demandStart = a;
7176
7176
  }
7177
7177
  doEvaluate(e, t, n, r, i) {
7178
- let a = qa(), o = this._container, s = this._context, c = o.getScope(), l = s.getRuntime(), u = o.getDeferred?.() ?? null, f = i.values, p = i.length;
7178
+ let a = qa(), o = this._container, s = this._context, c = o.getScope(), l = s.getRuntime(), u = o.getDeferred?.() ?? null, d = i.values, p = i.length;
7179
7179
  es = this._passCycleId, ts = this._passMarkId;
7180
- let m = ho, h, g, _, y, b, x, S, C, w, T, D, O, k, A = 0, ee = /* @__PURE__ */ new Map();
7181
- this._overlays = ee;
7182
- let M = (e) => this._overlayFor(e), N = (e) => {
7183
- D = o.getGrid(e), T = D.getEntireCoords.bind(D), g = t(e), _ = g.gridId, k = M(e), y = g.values, O = g.errorSpatial, b = g.contentfulSpatial, x = g.spillSpatial, S = g.notifyValues, C = g.notifySpillsInsert, w = g.notifySpillsRemove, g.notifyFormats, g.notifyCalcStatus, c.gridId = _;
7184
- }, te = W.Axis.Column, P = te === W.Axis.Column, ne = () => {
7185
- if (A > 0) {
7186
- n(m, A), A = 0;
7187
- for (let e of ee.values()) e.reset();
7180
+ let m = ho, h, g, _, v, y, b, x, S, C, w, T, E, O, k = 0, A = /* @__PURE__ */ new Map();
7181
+ this._overlays = A;
7182
+ let ee = (e) => this._overlayFor(e), te = (e) => {
7183
+ T = o.getGrid(e), w = T.getEntireCoords.bind(T), g = t(e), _ = g.gridId, O = ee(e), v = g.values, E = g.errorSpatial, y = g.contentfulSpatial, b = g.spillSpatial, x = g.notifyValues, S = g.notifySpillsInsert, C = g.notifySpillsRemove, g.notifyFormats, g.notifyCalcStatus, c.gridId = _;
7184
+ }, j = W.Axis.Column, M = j === W.Axis.Column, re = () => {
7185
+ if (k > 0) {
7186
+ n(m, k), k = 0;
7187
+ for (let e of A.values()) e.reset();
7188
7188
  _ !== void 0 && (g = t(_));
7189
7189
  }
7190
7190
  };
7191
- this._flush = ne;
7192
- let re = this._exceptTables;
7193
- if (re) for (let e = 0; e < p; e++) {
7194
- let t = f[e];
7191
+ this._flush = re;
7192
+ let ie = this._exceptTables;
7193
+ if (ie) for (let e = 0; e < p; e++) {
7194
+ let t = d[e];
7195
7195
  t.block.hasDataTable() && (t.state = t.state & ~q | pr, this._skippedTables.add(t));
7196
7196
  }
7197
- let ie = 0;
7198
- for (; ie < p;) try {
7199
- for (; ie < p; ie++) {
7200
- let n = f[ie], i = n.colIndex, a = n.rowIndex;
7197
+ let ae = 0;
7198
+ for (; ae < p;) try {
7199
+ for (; ae < p; ae++) {
7200
+ let n = d[ae], i = n.colIndex, a = n.rowIndex;
7201
7201
  if ((n.state & Xn) !== 0 && e === n.cycleId) {
7202
7202
  n.state &= ~Xn;
7203
7203
  continue;
7204
7204
  }
7205
- if (re && n.block.hasDataTable()) continue;
7205
+ if (ie && n.block.hasDataTable()) continue;
7206
7206
  let s = n.gridId;
7207
- s !== _ && N(s);
7208
- let p = n.block, ee = p.representative === n && p.isBlankAware(e), ae = n.cachedValue, oe, se, ce = !1;
7209
- typeof ae == "object" && ae && (ae.isIRange ? oe = ae : U.isError(ae, U.Code.Spill) && (se = ae, ce = !0));
7210
- let le = (n.state & Qn) !== 0;
7211
- le && (n.state & q) !== pr && (ne(), this.doDemandEvaluate(e, t, this._demandBatch, ne), c.gridId = s);
7212
- let ue = le ? null : Jt(n), de = n.inputsAt;
7213
- if (ue && de >= 0) {
7214
- let e = Gn(), t = ue.length;
7207
+ s !== _ && te(s);
7208
+ let p = n.block, A = p.representative === n && p.isBlankAware(e), oe = n.cachedValue, se, ce, le = !1;
7209
+ typeof oe == "object" && oe && (oe.isIRange ? se = oe : U.isError(oe, U.Code.Spill) && (ce = oe, le = !0));
7210
+ let ue = (n.state & Qn) !== 0;
7211
+ ue && (n.state & q) !== pr && (re(), this.doDemandEvaluate(e, t, this._demandBatch, re), c.gridId = s);
7212
+ let de = ue ? null : Jt(n), fe = n.inputsAt;
7213
+ if (de && fe >= 0) {
7214
+ let e = Gn(), t = de.length;
7215
7215
  for (let n = 0; n < t; n++) {
7216
- let t = ue[n];
7216
+ let t = de[n];
7217
7217
  if (U.isError(t)) {
7218
- e[de + n] = t;
7218
+ e[fe + n] = t;
7219
7219
  continue;
7220
7220
  }
7221
7221
  let r = t.colStart, i = t.rowStart, a = t.colEnd, s = t.rowEnd;
7222
7222
  if (s !== i || r !== a) {
7223
- let c = t.scope, u = y, d = T, f = k, p = D;
7224
- c && c !== _ && (p = o.getGrid(c), p && (u = p.getValues(), f = M(c), d = p.getEntireCoords.bind(p)));
7223
+ let c = t.scope, u = v, d = w, f = O, p = T;
7224
+ c && c !== _ && (p = o.getGrid(c), p && (u = p.getValues(), f = ee(c), d = p.getEntireCoords.bind(p)));
7225
7225
  let m = p;
7226
7226
  f.intersects(i, r, s, a) && (u = f, m = f);
7227
- let h = new ht(l, u, { ...t }, null, d, o.resolveScope);
7228
- h._setErrorIndex(m), e[de + n] = h;
7227
+ let h = new pt(l, u, { ...t }, null, d, o.resolveScope);
7228
+ h._setErrorIndex(m), e[fe + n] = h;
7229
7229
  }
7230
7230
  }
7231
7231
  }
7232
- ue && u !== null && u.getOpenCount() !== 0 && (n.state & ar) === 0 && is(ue, _, o) && (n.state |= ar);
7233
- let fe = P ? i : a, pe = P ? a : i;
7232
+ de && u !== null && u.getOpenCount() !== 0 && (n.state & ar) === 0 && is(de, _, o) && (n.state |= ar);
7233
+ let pe = M ? i : a, me = M ? a : i;
7234
7234
  c.node = n, c.colIndex = i, c.rowIndex = a, c.drawIndex = 0;
7235
- let me = p.formula, F, he = null, ge = !1, _e = (n.state & Zn) === 0 ? 0 : (n.state & lr) === 0 ? j.CalcStatus.Waiting : j.CalcStatus.Working, ve = _e, ye = r ? 0 : _e, be = n.ext;
7236
- if (le && !this._iterate && (n.state & J) !== hr) be !== null && (be.demandValue = void 0), F = po(n), ve = 0;
7235
+ let he = p.formula, P, ge = null, _e = !1, ve = (n.state & Zn) === 0 ? 0 : (n.state & lr) === 0 ? D.CalcStatus.Waiting : D.CalcStatus.Working, ye = ve, be = r ? 0 : ve, xe = n.ext;
7236
+ if (ue && !this._iterate && (n.state & J) !== hr) xe !== null && (xe.demandValue = void 0), P = po(n), ye = 0;
7237
7237
  else {
7238
- if (le) {
7239
- let e = be === null ? void 0 : be.demandValue;
7240
- be !== null && (be.demandValue = void 0), F = e === void 0 ? 0 : e;
7238
+ if (ue) {
7239
+ let e = xe === null ? void 0 : xe.demandValue;
7240
+ xe !== null && (xe.demandValue = void 0), P = e === void 0 ? 0 : e;
7241
7241
  } else {
7242
7242
  if (n.state = n.state & ~q | fr, c.perCellRead = !1, c.positionRead = !1, (n.state & sr) !== 0) {
7243
7243
  n.state &= ~sr;
7244
- let e = this._settlePass ? Ba(y, x, a, i) : null;
7244
+ let e = this._settlePass ? Ba(v, b, a, i) : null;
7245
7245
  if (e !== null && e.direct) {
7246
- ge = !0, n.state &= ~(or | cr);
7247
- let t = Te(e);
7248
- t?.isIRange ? (F = me.finalizeValueForCell(t), he = e) : F = e;
7246
+ _e = !0, n.state &= ~(or | cr);
7247
+ let t = Tt(e);
7248
+ t?.isIRange ? (P = he.finalizeValueForCell(t), ge = e) : P = e;
7249
7249
  }
7250
7250
  }
7251
- if (!ge) {
7251
+ if (!_e) {
7252
7252
  this._planStats.evaluated++, n.state &= ~($n | or | cr);
7253
7253
  let e = c.deferCount;
7254
- F = me.evaluateAt(a, i), F = me.finalizeValueForCell(F), (c.perCellRead || c.positionRead) && (n.block.positionRead = !0), c.deferCount !== e && (F = this._takeDeferred(n, F), he = this._spillHolder, this._spillHolder = null);
7254
+ P = he.evaluateAt(a, i), P = he.finalizeValueForCell(P), (c.perCellRead || c.positionRead) && (n.block.positionRead = !0), c.deferCount !== e && (P = this._takeDeferred(n, P), ge = this._spillHolder, this._spillHolder = null);
7255
7255
  }
7256
7256
  }
7257
- ve = (n.state & cr) === 0 ? (n.state & (ar | or)) === 0 ? 0 : j.CalcStatus.Waiting : j.CalcStatus.Working, ve !== 0 && (n.state |= or);
7257
+ ye = (n.state & cr) === 0 ? (n.state & (ar | or)) === 0 ? 0 : D.CalcStatus.Waiting : D.CalcStatus.Working, ye !== 0 && (n.state |= or);
7258
7258
  }
7259
- let I;
7260
- (n.state & q) !== pr && (n.state = n.state & ~q | mr), ve !== ye && (ve === 0 ? n.state &= ~(Zn | lr) : ve === j.CalcStatus.Working ? n.state |= Zn | lr : n.state = (n.state | Zn) & ~lr, g.calcStatusConflating || (g.calcStatusConflating = E(P)), g.calcStatusConflating.append(fe, pe, ve !== 0 && ve)), le && k.takeDemand(a, i);
7261
- let xe = n.ext, Se = xe === null ? null : xe.fixedRef;
7262
- if (oe || se || Se) {
7259
+ let F;
7260
+ (n.state & q) !== pr && (n.state = n.state & ~q | mr), ye !== be && (ye === 0 ? n.state &= ~(Zn | lr) : ye === D.CalcStatus.Working ? n.state |= Zn | lr : n.state = (n.state | Zn) & ~lr, g.calcStatusConflating || (g.calcStatusConflating = ne(M)), g.calcStatusConflating.append(pe, me, ye !== 0 && ye)), ue && O.takeDemand(a, i);
7261
+ let Se = n.ext, I = Se === null ? null : Se.fixedRef;
7262
+ if (se || ce || I) {
7263
7263
  mo.colStart = i, mo.rowStart = a, mo.colEnd = i, mo.rowEnd = a;
7264
- let e = x.search(mo);
7265
- for (let t = 0; !I && t < e.length; t++) {
7264
+ let e = b.search(mo);
7265
+ for (let t = 0; !F && t < e.length; t++) {
7266
7266
  let n = e[t];
7267
- n.value.isAnchor(a, i) && n.value.getKind() !== "pivot" && (I = n);
7267
+ n.value.isAnchor(a, i) && n.value.getKind() !== "pivot" && (F = n);
7268
7268
  }
7269
- if (I && (x.remove(I, Gi), !I || !I.value.getError())) {
7269
+ if (F && (b.remove(F, Gi), !F || !F.value.getError())) {
7270
7270
  let e = {
7271
- ...K.sanitizeRange(I),
7272
- scope: I.scope,
7271
+ ...K.sanitizeRange(F),
7272
+ scope: F.scope,
7273
7273
  value: null
7274
7274
  };
7275
- b.insertNonOverlapping(e), y.delete(e), d(O, e);
7275
+ y.insertNonOverlapping(e), v.delete(e), f(E, e);
7276
7276
  }
7277
7277
  }
7278
- F = this._fitCell(p, F);
7279
- let Ce = 1, we = 1, Ee = F, De = typeof F == "object" && !!F, Oe = De && Ee.isIRange, L, R = De && U.isError(F, U.Code.Spill);
7280
- if (Se) {
7281
- Ce = Se.colEnd - Se.colStart + 1, we = Se.rowEnd - Se.rowStart + 1;
7278
+ P = this._fitCell(p, P);
7279
+ let Ce = 1, we = 1, Te = P, Ee = typeof P == "object" && !!P, De = Ee && Te.isIRange, L, R = Ee && U.isError(P, U.Code.Spill);
7280
+ if (I) {
7281
+ Ce = I.colEnd - I.colStart + 1, we = I.rowEnd - I.rowStart + 1;
7282
7282
  let t = {
7283
- colStart: Se.colStart,
7284
- rowStart: Se.rowStart,
7285
- colEnd: Se.colEnd,
7286
- rowEnd: Se.rowEnd,
7283
+ colStart: I.colStart,
7284
+ rowStart: I.rowStart,
7285
+ colEnd: I.colEnd,
7286
+ rowEnd: I.rowEnd,
7287
7287
  scope: s
7288
- }, r = Xt(F, t, P)?.tuples;
7289
- y.delete(t), r && y.setValues(r), d(O, t), lt(O, r, P), L = {
7288
+ }, r = Xt(P, t, M)?.tuples;
7289
+ v.delete(t), r && v.setValues(r), f(E, t), nt(E, r, M), L = {
7290
7290
  ...t,
7291
- value: new ot(t, e, "fixed", null, he)
7292
- }, x.insert(L), o.addDynamicPrecedent(n, t, mi), b.insertNonOverlapping({
7291
+ value: new Qe(t, e, "fixed", null, ge)
7292
+ }, b.insert(L), o.addDynamicPrecedent(n, t, mi), y.insertNonOverlapping({
7293
7293
  ...t,
7294
- value: new We(t, te)
7294
+ value: new Fe(t, j)
7295
7295
  });
7296
- } else if (Oe && Ee.size > 1) {
7297
- Ce = Ee.getColumnCount(), we = Ee.getRowCount();
7296
+ } else if (De && Te.size > 1) {
7297
+ Ce = Te.getColumnCount(), we = Te.getRowCount();
7298
7298
  let t = Lo(n), r = t === null ? a : a - t.rows, c = t === null ? i : i - t.columns, l = {
7299
7299
  colStart: c,
7300
7300
  rowStart: r,
7301
7301
  colEnd: c + Ce - 1,
7302
7302
  rowEnd: r + we - 1,
7303
7303
  scope: s
7304
- }, u = T(), f = !K.isRangeWithinRange(l, u);
7305
- if (f && (l.colEnd = Math.min(l.colEnd, u.colEnd), l.rowEnd = Math.min(l.rowEnd, u.rowEnd)), R = f, !R) {
7306
- let e = b.search(l);
7304
+ }, u = w(), d = !K.isRangeWithinRange(l, u);
7305
+ if (d && (l.colEnd = Math.min(l.colEnd, u.colEnd), l.rowEnd = Math.min(l.rowEnd, u.rowEnd)), R = d, !R) {
7306
+ let e = y.search(l);
7307
7307
  if (R = e.length > 1, !R && e.length === 1) {
7308
7308
  let t = e[0], n = K.intersectRanges(l, t, $a);
7309
7309
  !n || n.rowEnd === n.rowStart && n.colStart === n.colEnd && n.colStart === i && n.rowStart === a || (R = !0);
7310
7310
  }
7311
7311
  }
7312
7312
  let p, m;
7313
- if (R) F = U.BuiltIn.Spill, Ce = 1, we = 1, p = [[fe, [[pe, [F]]]]], y.setValues(p), lt(O, p, P), m = {
7313
+ if (R) P = U.BuiltIn.Spill, Ce = 1, we = 1, p = [[pe, [[me, [P]]]]], v.setValues(p), nt(E, p, M), m = {
7314
7314
  colStart: i,
7315
7315
  rowStart: a,
7316
7316
  colEnd: i,
7317
7317
  rowEnd: a
7318
7318
  };
7319
7319
  else {
7320
- let e = ln(Ee, P ? c : r, P ? r : c);
7321
- e && (p = e.tuples), y.delete(l), p && y.setValues(p), d(O, l), lt(O, p, P), m = l;
7320
+ let e = ln(Te, M ? c : r, M ? r : c);
7321
+ e && (p = e.tuples), v.delete(l), p && v.setValues(p), f(E, l), nt(E, p, M), m = l;
7322
7322
  }
7323
7323
  let h = R ? {
7324
7324
  colStart: i,
@@ -7329,45 +7329,45 @@ var Pa = class {
7329
7329
  } : l;
7330
7330
  L = {
7331
7331
  ...h,
7332
- value: new ot(h, e, R ? "error" : "dynamic", R || t === null ? null : t, he, R ? l : null)
7333
- }, x.insert(L), o.addDynamicPrecedent(n, l, mi), b.insertNonOverlapping({
7332
+ value: new Qe(h, e, R ? "error" : "dynamic", R || t === null ? null : t, ge, R ? l : null)
7333
+ }, b.insert(L), o.addDynamicPrecedent(n, l, mi), y.insertNonOverlapping({
7334
7334
  ...m,
7335
- value: new We(m, te)
7335
+ value: new Fe(m, j)
7336
7336
  });
7337
7337
  }
7338
- !ee || p.blankCycleId === e && p.blankMarkId === this._passMarkId || this._finalizeRepresentative(n, F, g, ve !== 0 || le || !0 === Oe || R || Se !== null || ge);
7339
- let ke = !1;
7340
- if ((I || L || R || se) && (ke = K.isEqualRanges(I, L), I && w.push(I), L && C.push(L)), L || I) {
7341
- let e = I ?? L, t = L ?? I, r = {
7338
+ !A || p.blankCycleId === e && p.blankMarkId === this._passMarkId || this._finalizeRepresentative(n, P, g, ye !== 0 || ue || !0 === De || R || I !== null || _e);
7339
+ let Oe = !1;
7340
+ if ((F || L || R || ce) && (Oe = K.isEqualRanges(F, L), F && C.push(F), L && S.push(L)), L || F) {
7341
+ let e = F ?? L, t = L ?? F, r = {
7342
7342
  colStart: Math.min(i, e.colStart, t.colStart),
7343
7343
  rowStart: Math.min(a, e.rowStart, t.rowStart),
7344
7344
  colEnd: Math.max(i, e.colEnd, t.colEnd),
7345
7345
  rowEnd: Math.max(a, e.rowEnd, t.rowEnd),
7346
7346
  scope: s
7347
7347
  };
7348
- S.insertNonOverlapping(r), ke && R === ce || (this._invalidatePlans(), o.getPrecedents().search(r).length > 0 && (n.state |= Xn, h ||= new v(), h.insertNonOverlapping(r)));
7348
+ x.insertNonOverlapping(r), Oe && R === le || (this._invalidatePlans(), o.getPrecedents().search(r).length > 0 && (n.state |= Xn, h ||= new N(), h.insertNonOverlapping(r)));
7349
7349
  }
7350
- n.cachedValue = F, m[A++] = n;
7351
- let Ae = u !== null && u.hasHolders() ? Te(F) : F;
7352
- Oe || Se || k.push(a, i, Ae), A >= (k.observed ? Ha : Ua) && ne(), ((n.state & J) !== hr || n.ext !== null && n.ext.shownGroup !== 0) && this._trackCircular(n, g, fe, pe, P);
7353
- let je = n.dependents, Me = je.length;
7354
- if (Me > 0) {
7350
+ n.cachedValue = P, m[k++] = n;
7351
+ let ke = u !== null && u.hasHolders() ? Tt(P) : P;
7352
+ De || I || O.push(a, i, ke), k >= (O.observed ? Ha : Ua) && re(), ((n.state & J) !== hr || n.ext !== null && n.ext.shownGroup !== 0) && this._trackCircular(n, g, pe, me, M);
7353
+ let Ae = n.dependents, je = Ae.length;
7354
+ if (je > 0) {
7355
7355
  let e = (n.state & Zn) !== 0, t = !this._iterate && (n.state & J) !== hr;
7356
7356
  t && (this._taintGroup = n.ext.cycleGroup);
7357
- for (let n = 0; n < Me; n++) {
7358
- let r = je[n];
7357
+ for (let n = 0; n < je; n++) {
7358
+ let r = Ae[n];
7359
7359
  t && Qt(r, a, i, this._taintDownstream);
7360
7360
  let o = r.value.index;
7361
- o < 0 || (Zt(r) && (Qo = o, $o = Ae, Qt(r, a, i, ns)), e && Qt(r, a, i, rs));
7361
+ o < 0 || (Zt(r) && (Qo = o, $o = ke, Qt(r, a, i, ns)), e && Qt(r, a, i, rs));
7362
7362
  }
7363
7363
  }
7364
7364
  }
7365
7365
  } catch (n) {
7366
- let r = f[ie];
7366
+ let r = d[ae];
7367
7367
  if (n instanceof an || n instanceof en && this._iterate) {
7368
7368
  let i = ao;
7369
7369
  if (i.length = 0, n instanceof an) for (let e = 0; e < n.count; e++) i.push(n.nodes[e]);
7370
- i.push(r), ne(), r.state &= ~q, this.doDemandEvaluate(e, t, i, ne);
7370
+ i.push(r), re(), r.state &= ~q, this.doDemandEvaluate(e, t, i, re);
7371
7371
  } else {
7372
7372
  if (!(n instanceof en || n instanceof Yt)) throw n;
7373
7373
  {
@@ -7379,17 +7379,17 @@ var Pa = class {
7379
7379
  }
7380
7380
  c.gridId = r.gridId;
7381
7381
  }
7382
- c.node = null, c.colIndex = 2 ** 53 - 1, c.rowIndex = 2 ** 53 - 1, ne();
7383
- for (let e of ee.values()) e.commitDemand();
7382
+ c.node = null, c.colIndex = 2 ** 53 - 1, c.rowIndex = 2 ** 53 - 1, re();
7383
+ for (let e of A.values()) e.commitDemand();
7384
7384
  this._flush = null, this._overlays = null;
7385
- let ae = this._fallbackDirty;
7386
- return ae !== null && (this._fallbackDirty = null, h ? h.insertAllNonOverlapping(ae.all()) : h = ae), (() => {
7385
+ let oe = this._fallbackDirty;
7386
+ return oe !== null && (this._fallbackDirty = null, h ? h.insertAllNonOverlapping(oe.all()) : h = oe), (() => {
7387
7387
  let e = Un, t = Wn;
7388
7388
  for (let n = 0; n < t; n++) e[n] = void 0;
7389
7389
  Wn = 0;
7390
7390
  })(), this._planStats.evaluateMs += qa() - a, h;
7391
7391
  }
7392
- }, Fa = (e, t) => new P.ArrayList(e.slice(0, t));
7392
+ }, Fa = (e, t) => new r.ArrayList(e.slice(0, t));
7393
7393
  function Ia(e, t, n, r, i, a) {
7394
7394
  let o = t.rowStart + n, s = t.rowStart + r, c = t.colStart + i, l = t.colStart + a;
7395
7395
  for (let t = 0; t < e.length; t++) {
@@ -7402,7 +7402,7 @@ function La(e, t, n) {
7402
7402
  let r = t.values, i = t.errorSpatial, a = oo, o = so;
7403
7403
  for (let s = 0; s < e.length; s++) {
7404
7404
  let c = e[s];
7405
- r.delete(c), d(i, c);
7405
+ r.delete(c), f(i, c);
7406
7406
  let l = {
7407
7407
  colStart: c.colStart,
7408
7408
  rowStart: c.rowStart,
@@ -7431,7 +7431,7 @@ function za(e, t, n) {
7431
7431
  }
7432
7432
  var Ba = (e, t, n, r) => {
7433
7433
  let i = e.getValueAt(n, r);
7434
- return St(i) ? i : mt(t, n, r);
7434
+ return Dt(i) ? i : ft(t, n, r);
7435
7435
  }, Va = Symbol("unsetGridId"), Ha = 1024, Ua = 65536;
7436
7436
  function Wa(e, t) {
7437
7437
  return e.scope === t.scope ? e.colIndex === t.colIndex ? e.rowIndex - t.rowIndex : e.colIndex - t.colIndex : e.scope === null ? -1 : t.scope === null ? 1 : e.scope.localeCompare(t.scope);
@@ -7507,7 +7507,7 @@ var $a = {
7507
7507
  }, fo = (e) => {
7508
7508
  let t = e.ext;
7509
7509
  return t === null ? 0 : (e.state & J) === hr ? t.shownGroup : t.cycleGroup;
7510
- }, po = (e) => Te(e.cachedValue) ?? 0, mo = {
7510
+ }, po = (e) => Tt(e.cachedValue) ?? 0, mo = {
7511
7511
  rowStart: 0,
7512
7512
  colStart: 0,
7513
7513
  rowEnd: 0,
@@ -7567,37 +7567,37 @@ var os = {
7567
7567
  this._namesByKey = /* @__PURE__ */ new Map(), this._namesById = /* @__PURE__ */ new Map(), this._hostsById = /* @__PURE__ */ new Map(), this._loadedData = /* @__PURE__ */ new Map(), this._options = e;
7568
7568
  }
7569
7569
  sync(e = !1) {
7570
- let { books: t, getGrid: n, unregisterGrid: r } = this._options, i = this._options.holdsGrids?.() ?? !0, a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set(), l = t.getItems();
7570
+ let { books: t, getGrid: n, unregisterGrid: r } = this._options, i = this._options.holdsGrids?.() ?? !0, a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), l = t.getItems();
7571
7571
  for (let t = 0; t < l.length; t++) {
7572
- let s = l[t], u = s.getId(), d = s.getSheetNames();
7572
+ let c = l[t], u = c.getId(), d = c.getSheetNames();
7573
7573
  for (let e = 0; e < d.length; e++) {
7574
- let t = Tt(u, e);
7575
- a.add(t), i && (n(t) ? this._loadedData.get(t) !== (s.getSheetData(e)?.data ?? null) && (r(t), this._registerSheet(s, e, t), c.add(u)) : (this._registerSheet(s, e, t), c.add(u)));
7574
+ let t = Et(u, e);
7575
+ a.add(t), i && (n(t) ? this._loadedData.get(t) !== (c.getSheetData(e)?.data ?? null) && (r(t), this._registerSheet(c, e, t), s.add(u)) : (this._registerSheet(c, e, t), s.add(u)));
7576
7576
  }
7577
- let f = s.getDefinedNames();
7577
+ let f = c.getDefinedNames();
7578
7578
  for (let t = 0; t < f.length; t++) {
7579
7579
  let n = f[t];
7580
7580
  if (!n.name) continue;
7581
- let r = n.sheetIndex, i = Tt(u, r !== void 0 && r >= 0 && r < d.length ? r : -1), a = ls(i, n.name);
7581
+ let r = n.sheetIndex, i = Et(u, r !== void 0 && r >= 0 && r < d.length ? r : -1), a = ls(i, n.name);
7582
7582
  o.add(a);
7583
7583
  let l = this._namesByKey.get(a);
7584
7584
  if (l) {
7585
7585
  if (l.refersTo !== (n.refersTo ?? "")) {
7586
7586
  l.refersTo = n.refersTo ?? "";
7587
7587
  let e = this._hostsById.get(l.getId());
7588
- e && this._queueBody(l.getId(), e, s, i, l.refersTo, !1), c.add(u);
7588
+ e && this._queueBody(l.getId(), e, c, i, l.refersTo, !1), s.add(u);
7589
7589
  }
7590
- } else this._registerName(s, i, n, e), c.add(u);
7590
+ } else this._registerName(c, i, n, e), s.add(u);
7591
7591
  }
7592
7592
  }
7593
- for (let e of this._registeredSheetGrids()) a.has(e) || (r(e), this._loadedData.delete(e), c.add(s(e).bookId));
7593
+ for (let e of this._registeredSheetGrids()) a.has(e) || (r(e), this._loadedData.delete(e), s.add(c(e).bookId));
7594
7594
  for (let [e, t] of this._namesByKey) {
7595
7595
  if (o.has(e)) continue;
7596
7596
  this._namesByKey.delete(e), this._namesById.delete(t.getId());
7597
7597
  let n = this._hostsById.get(t.getId());
7598
- this._hostsById.delete(t.getId()), n?.setPlaceholder(U.BuiltIn.Name.toString()), c.add(s(t.getScope()).bookId);
7598
+ this._hostsById.delete(t.getId()), n?.setPlaceholder(U.BuiltIn.Name.toString()), s.add(c(t.getScope()).bookId);
7599
7599
  }
7600
- return c;
7600
+ return s;
7601
7601
  }
7602
7602
  getNameByScope(e, t) {
7603
7603
  return this._namesByKey.get(ls(t, e)) ?? null;
@@ -7608,7 +7608,7 @@ var os = {
7608
7608
  _registeredSheetGrids() {
7609
7609
  let e = [];
7610
7610
  for (let t of this._options.gridIds()) {
7611
- let n = s(t);
7611
+ let n = c(t);
7612
7612
  n && n.sheetIndex >= 0 && e.push(t);
7613
7613
  }
7614
7614
  return e;
@@ -7624,7 +7624,7 @@ var os = {
7624
7624
  for (let e = 0; e < i.length; e++) {
7625
7625
  let [n, a] = i[e], o = a.length;
7626
7626
  for (let e = 0; e < o; e++) {
7627
- let i = ae.fromJSONValue(a.at(e));
7627
+ let i = j.fromJSONValue(a.at(e));
7628
7628
  i != null && t.push({
7629
7629
  col: n + e,
7630
7630
  row: r,
@@ -7635,7 +7635,7 @@ var os = {
7635
7635
  }
7636
7636
  if (t.length === 0) return null;
7637
7637
  t.sort((e, t) => e.col - t.col || e.row - t.row);
7638
- let n = new _e.Builder();
7638
+ let n = new de.Builder();
7639
7639
  for (let e = 0; e < t.length; e++) n.pushAt(t[e].col, t[e].row, t[e].value);
7640
7640
  return n.build()?.tuples ?? null;
7641
7641
  }(i);
@@ -7653,16 +7653,16 @@ var os = {
7653
7653
  this._hostsById.set(o, c), this._queueBody(o, c, e, t, s.refersTo, r);
7654
7654
  }
7655
7655
  _queueBody(e, t, n, r, i, a) {
7656
- let { queue: o, recompileNamed: c } = this._options, l = i.trim();
7656
+ let { queue: o, recompileNamed: s } = this._options, l = i.trim();
7657
7657
  l.startsWith("=") && (l = l.substring(1)), l ||= U.BuiltIn.Ref.toString();
7658
- let u = s(r), d = u.sheetIndex >= 0 ? u.sheetIndex : n.getSheetNames().length > 0 ? 0 : -1, f = Tt(u.bookId, d);
7658
+ let u = c(r), d = u.sheetIndex >= 0 ? u.sheetIndex : n.getSheetNames().length > 0 ? 0 : -1, f = Et(u.bookId, d);
7659
7659
  o(async () => {
7660
7660
  this._hostsById.get(e) === t && t.setBody({
7661
7661
  coords: us,
7662
7662
  expression: l,
7663
7663
  authoredAt: ds,
7664
7664
  scopeGridId: f
7665
- }) && (a || c(e));
7665
+ }) && (a || s(e));
7666
7666
  });
7667
7667
  }
7668
7668
  }, ls = (e, t) => e + "::" + t.toLowerCase(), us = Object.freeze({
@@ -7691,7 +7691,7 @@ var os = {
7691
7691
  deferOrdinal: 0,
7692
7692
  deferRoot: !1,
7693
7693
  deferServed: null
7694
- }, this._cycleId = 0, this._staticEpoch = 1, this._precedentEpoch = 1, this._epochSeenFormulas = null, this._epochSeenPrecedents = null, this._epochSeenDynamics = null, this._volatiles = /* @__PURE__ */ new Set(), this._calculatedCommitId = null, this._calculatedEngineId = null, this._holdsGrids = !1, this._engineIds = /* @__PURE__ */ new Map(), this._landingOf = /* @__PURE__ */ new Map(), this._mirroredId = null, this._lastRevert = null, this._symbolIndex = null, this._symbolIndexOf = null, this._sheetsDerived = null, this._tablesDerived = null, this._namesDerived = null, this._collecting = null, this._recompileNamedPending = null, this._recompileLoadedPending = null, this._invalidateNamedPending = null, this.resolveScope = (e) => this._symbols.resolve(z.Sheet, e)?.toString(), this._heldCloneKey = null, this._callbacks = e.callbacks, this._runtime = e.runtime, this._richData = e.richData ?? o.DetachedContext, this._symbols = e.symbols, this._resolvers = e.resolvers, this._getSheetIndex = e.getSheetIndex ?? null, this._legacyIntersect = !0 === e.legacyIntersect, this._gridOptions = e.gridOptions ?? {}, this._calculation = e.calculation;
7694
+ }, this._cycleId = 0, this._staticEpoch = 1, this._precedentEpoch = 1, this._epochSeenFormulas = null, this._epochSeenPrecedents = null, this._epochSeenDynamics = null, this._volatiles = /* @__PURE__ */ new Set(), this._calculatedCommitId = null, this._calculatedEngineId = null, this._holdsGrids = !1, this._engineIds = /* @__PURE__ */ new Map(), this._landingOf = /* @__PURE__ */ new Map(), this._mirroredId = null, this._lastRevert = null, this._symbolIndex = null, this._symbolIndexOf = null, this._sheetsDerived = null, this._tablesDerived = null, this._namesDerived = null, this._collecting = null, this._recompileNamedPending = null, this._recompileLoadedPending = null, this._invalidateNamedPending = null, this.resolveScope = (e) => this._symbols.resolve(z.Sheet, e)?.toString(), this._heldCloneKey = null, this._callbacks = e.callbacks, this._runtime = e.runtime, this._richData = e.richData ?? wt.DetachedContext, this._symbols = e.symbols, this._resolvers = e.resolvers, this._getSheetIndex = e.getSheetIndex ?? null, this._legacyIntersect = !0 === e.legacyIntersect, this._gridOptions = e.gridOptions ?? {}, this._calculation = e.calculation;
7695
7695
  let n = e.replica;
7696
7696
  this._updateState({
7697
7697
  gridsAll: /* @__PURE__ */ new Map(),
@@ -7711,7 +7711,7 @@ var os = {
7711
7711
  dynamicByBlock: /* @__PURE__ */ new Map(),
7712
7712
  dirtySpatial: new En()
7713
7713
  }), e.modelCommitId && this.mirror(e.modelCommitId), this._context = new yi(this, W.Axis.Column, e.functions), this._deferred = new da(this._calcScope, (e, t, n) => this._holderAt(e, t, n), () => this._runtime.getRandom(), () => this._settle(), void 0, (e, t) => this._normalizeResult(e, t), {
7714
- createRichData: (e, t) => st.fromJSON({
7714
+ createRichData: (e, t) => He.fromJSON({
7715
7715
  type: e,
7716
7716
  data: t
7717
7717
  }, this._richData),
@@ -7799,7 +7799,7 @@ var os = {
7799
7799
  let r = this.getGrid(e);
7800
7800
  if (!r) return null;
7801
7801
  let i = r.getValues().getValueAt(t, n);
7802
- return St(i) ? i : mt(r.getSpills(), t, n);
7802
+ return Dt(i) ? i : ft(r.getSpills(), t, n);
7803
7803
  }
7804
7804
  _settleNow() {
7805
7805
  let e = this._deferred, t = e.takeMoved();
@@ -7811,21 +7811,21 @@ var os = {
7811
7811
  r = new ms(!i || i.getValues().getAxis() === W.Axis.Column), e.set(t, r);
7812
7812
  }
7813
7813
  return r;
7814
- }, c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Set(), u = [], f = (e) => {
7814
+ }, c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Set(), u = [], d = (e) => {
7815
7815
  l.add(e), s(a, e.gridId).add(e.rowIndex, e.colIndex);
7816
7816
  };
7817
7817
  for (let e = 0; e < t.length; e++) {
7818
- let d = t[e], p = d.owner;
7818
+ let f = t[e], p = f.owner;
7819
7819
  if (p === null || !i.isLiveNode(p)) continue;
7820
7820
  let m = p.gridId, h = n.gridsAll.get(m);
7821
7821
  if (!h) continue;
7822
- let g = p.rowIndex, _ = p.colIndex, v = h.getValues().getValueAt(g, _), y = St(v), b = y ? v : mt(h.getSpills(), g, _);
7823
- if (b === null || b.calls.indexOf(d) < 0) continue;
7822
+ let g = p.rowIndex, _ = p.colIndex, v = h.getValues().getValueAt(g, _), y = Dt(v), b = y ? v : ft(h.getSpills(), g, _);
7823
+ if (b === null || b.calls.indexOf(f) < 0) continue;
7824
7824
  if (!b.direct) {
7825
7825
  l.add(p), s(a, m).add(g, _);
7826
7826
  continue;
7827
7827
  }
7828
- if (!y || d.latest?.isIRange) {
7828
+ if (!y || f.latest?.isIRange) {
7829
7829
  u.push(p);
7830
7830
  continue;
7831
7831
  }
@@ -7835,7 +7835,7 @@ var os = {
7835
7835
  runs: s(/* @__PURE__ */ new Map(), m),
7836
7836
  errors: /* @__PURE__ */ new Map()
7837
7837
  }), x.runs.add(g, _);
7838
- let S = d.latest;
7838
+ let S = f.latest;
7839
7839
  if (U.isError(S)) {
7840
7840
  let e = S.getLabel(), t = {
7841
7841
  colStart: _,
@@ -7855,7 +7855,7 @@ var os = {
7855
7855
  ...e.ref,
7856
7856
  scope: e.gridId
7857
7857
  });
7858
- } else Qt(t, g, _, f);
7858
+ } else Qt(t, g, _, d);
7859
7859
  }
7860
7860
  }
7861
7861
  for (let [t, n] of c) {
@@ -7870,7 +7870,7 @@ var os = {
7870
7870
  }), a[e] = {
7871
7871
  ...t,
7872
7872
  value: !1
7873
- }, d(r.errorSpatial, t);
7873
+ }, f(r.errorSpatial, t);
7874
7874
  }
7875
7875
  r.notifyCalcStatus.load(a);
7876
7876
  for (let [e, t] of n.errors) r.errorSpatial.load(gs(t).map((t) => ({
@@ -7894,10 +7894,10 @@ var os = {
7894
7894
  p.length > 0 && e.addSettleDirty(p), this._callbacks.calculate(void 0, void 0, !0);
7895
7895
  }
7896
7896
  createFormulaBlock(e, t, n, r, i, a, o) {
7897
- let c = this._callbacks.getCompiler(a);
7898
- if (!c) throw Error("The calculation engine has not started; nothing can compile yet.");
7899
- let l = s(e)?.bookId ?? null, u = l ? null : s(this._externalBindings.getNameById(e)?.getScope() ?? "")?.bookId ?? null;
7900
- return new Nn(c.compile(t.getRuntime(), r, i, n, this._symbols, (e) => t.getFunction(e), l ?? u ? Tt(l ?? u, -1) : this.getSheetName(e), o, l ? { book: l } : void 0), t, this._calcScope, e, () => this.getGrid(e)?.getEntireCoords() ?? null, this._resolvers);
7897
+ let s = this._callbacks.getCompiler(a);
7898
+ if (!s) throw Error("The calculation engine has not started; nothing can compile yet.");
7899
+ let l = c(e)?.bookId ?? null, u = l ? null : c(this._externalBindings.getNameById(e)?.getScope() ?? "")?.bookId ?? null;
7900
+ return new Nn(s.compile(t.getRuntime(), r, i, n, this._symbols, (e) => t.getFunction(e), l ?? u ? Et(l ?? u, -1) : this.getSheetName(e), o, l ? { book: l } : void 0), t, this._calcScope, e, () => this.getGrid(e)?.getEntireCoords() ?? null, this._resolvers);
7901
7901
  }
7902
7902
  getSymbols() {
7903
7903
  return this._symbols;
@@ -7914,15 +7914,15 @@ var os = {
7914
7914
  return this._sheetsCache().ids;
7915
7915
  }
7916
7916
  getSheetSpanIds(e) {
7917
- let t = Ee(e);
7917
+ let t = be(e);
7918
7918
  if (t) {
7919
7919
  let e = this.getSheetIds(), n = e.indexOf(t[0]), r = e.indexOf(t[1]);
7920
7920
  return n === -1 || r === -1 ? null : e.slice(Math.min(n, r), Math.max(n, r) + 1);
7921
7921
  }
7922
- let n = s(e);
7922
+ let n = c(e);
7923
7923
  if (!n || n.sheetEnd === n.sheetIndex) return null;
7924
7924
  let r = [];
7925
- for (let e = n.sheetIndex; e <= n.sheetEnd; e++) r.push(Tt(n.bookId, e));
7925
+ for (let e = n.sheetIndex; e <= n.sheetEnd; e++) r.push(Et(n.bookId, e));
7926
7926
  return r;
7927
7927
  }
7928
7928
  getFormulas() {
@@ -8030,7 +8030,7 @@ var os = {
8030
8030
  return this.isClosed() ? null : this._gridsAll().get(e) ?? null;
8031
8031
  }
8032
8032
  markDirty(e) {
8033
- let t = this._getState(), n = t.dirtySpatial.clone(this._heldCloneKey), r = t.precedentSpatial, i = t.formulaSpatial, a = !1, o = ce(e, W.Axis.Column, 2);
8033
+ let t = this._getState(), n = t.dirtySpatial.clone(this._heldCloneKey), r = t.precedentSpatial, i = t.formulaSpatial, a = !1, o = le(e, W.Axis.Column, 2);
8034
8034
  for (let e = 0; e < o.length; e++) {
8035
8035
  let t = o[e];
8036
8036
  (r?.has(t) || i?.has(t)) && (a = !0, n.insertNonOverlapping(t));
@@ -8229,7 +8229,7 @@ var os = {
8229
8229
  }), t;
8230
8230
  }
8231
8231
  createEngineGrid(e) {
8232
- let t = e.id, n = e.sizeOf, r = e.entireCoords, i = n === void 0 ? r ? () => r : void 0 : () => this.getGrid(n)?.getEntireCoords() ?? Ae, a = this._callbacks;
8232
+ let t = e.id, n = e.sizeOf, r = e.entireCoords, i = n === void 0 ? r ? () => r : void 0 : () => this.getGrid(n)?.getEntireCoords() ?? Ce, a = this._callbacks;
8233
8233
  return this.createBackendGrid({
8234
8234
  uuid: t,
8235
8235
  shadowOf: e.shadowOf,
@@ -8362,7 +8362,7 @@ var os = {
8362
8362
  return o;
8363
8363
  }
8364
8364
  followRestore(e, t) {
8365
- return t === Ze.Status.Off || t === Ze.Status.Error ? (this.retarget(e), !1) : t === Ze.Status.Running ? this.holdsModelCommit(e) ? (this.restoreTo(e), !1) : (this.retarget(e), !0) : (this.restoreTo(e) !== null || this.holdsModelCommit(e) || this.retarget(e), !1);
8365
+ return t === Ne.Status.Off || t === Ne.Status.Error ? (this.retarget(e), !1) : t === Ne.Status.Running ? this.holdsModelCommit(e) ? (this.restoreTo(e), !1) : (this.retarget(e), !0) : (this.restoreTo(e) !== null || this.holdsModelCommit(e) || this.retarget(e), !1);
8366
8366
  }
8367
8367
  rebuild(e) {
8368
8368
  this.drop(), this.setReplica(e), this.open();
@@ -8392,13 +8392,13 @@ var os = {
8392
8392
  if (u.deferCount !== s) {
8393
8393
  let e = this._deferred, t = e.endEvaluation();
8394
8394
  o.cachedValue = t.calls.length > 0 ? e.newHolder(c, t) : void 0, e.flush();
8395
- } else St(o.cachedValue) && (o.cachedValue = void 0);
8395
+ } else Dt(o.cachedValue) && (o.cachedValue = void 0);
8396
8396
  let d = tn(e.finalizeValue(c));
8397
8397
  return d === null && (d = 0), !i || d?.isIRange || Array.isArray(d) ? d : a.createRange(1, 1, d);
8398
8398
  },
8399
8399
  getCalls: () => {
8400
8400
  let e = f.getAnchorNode().cachedValue;
8401
- return St(e) ? e.calls : G.EmptyArray;
8401
+ return Dt(e) ? e.calls : G.EmptyArray;
8402
8402
  }
8403
8403
  };
8404
8404
  }
@@ -8414,7 +8414,7 @@ var os = {
8414
8414
  let t = /* @__PURE__ */ new Map(), n = e.all3D();
8415
8415
  for (let e = 0; e < n.length; e++) {
8416
8416
  let r = n[e].value;
8417
- if (r.gridId == null || oe(r.gridId) || this._externalBindings.getNameById(r.gridId)) continue;
8417
+ if (r.gridId == null || M(r.gridId) || this._externalBindings.getNameById(r.gridId)) continue;
8418
8418
  let i = r.getReferencedSymbolIds();
8419
8419
  if (i.length === 0) continue;
8420
8420
  let a = r.ref, o = {
@@ -8473,10 +8473,10 @@ var os = {
8473
8473
  t ? t.push(o[e]) : a.set(f, [o[e]]);
8474
8474
  continue;
8475
8475
  }
8476
- let p = f != null && !n.isDefinedName(f) && !oe(f) && !this._externalBindings.getNameById(f);
8476
+ let p = f != null && !n.isDefinedName(f) && !M(f) && !this._externalBindings.getNameById(f);
8477
8477
  if (d && p) for (let e = 0; e < i.length; e++) {
8478
8478
  let [t, n] = i[e];
8479
- c.includes(t) && (d = d.replaceTableReferences(t, (e) => k(e, n) ? b() : null));
8479
+ c.includes(t) && (d = d.replaceTableReferences(t, (e) => T(e, n) ? me() : null));
8480
8480
  }
8481
8481
  let m = d && d !== s.formula ? d.getTextAt(u.rowStart, u.colStart) : s.getTextAt(u.rowStart, u.colStart);
8482
8482
  this._writeBlockText(s, m);
@@ -8497,7 +8497,7 @@ var os = {
8497
8497
  let t = o[e].value;
8498
8498
  if (t.index < 0) continue;
8499
8499
  let n = t.formulaEntry.value, r = n.gridId;
8500
- if (r == null || oe(r) || this._externalBindings.getNameById(r)) continue;
8500
+ if (r == null || M(r) || this._externalBindings.getNameById(r)) continue;
8501
8501
  let i = (s ??= /* @__PURE__ */ new Map()).get(n);
8502
8502
  i ? i.includes(t.index) || i.push(t.index) : s.set(n, [t.index]);
8503
8503
  }
@@ -8561,10 +8561,10 @@ var os = {
8561
8561
  }
8562
8562
  }
8563
8563
  rewriteTableReferences(e, t) {
8564
- let n = (e) => t ? ee(e, t) : b(), r = this._callbacks, i = this._getState().formulaSpatial.all3D();
8564
+ let n = (e) => t ? k(e, t) : me(), r = this._callbacks, i = this._getState().formulaSpatial.all3D();
8565
8565
  for (let t = 0; t < i.length; t++) {
8566
8566
  let a = i[t].value, o = a.gridId;
8567
- if (o == null || !a.getReferencedSymbolIds().includes(e) || r.isDefinedName(o) || oe(o) || this._externalBindings.getNameById(o)) continue;
8567
+ if (o == null || !a.getReferencedSymbolIds().includes(e) || r.isDefinedName(o) || M(o) || this._externalBindings.getNameById(o)) continue;
8568
8568
  let s = a.formula, c = s?.replaceTableReferences(e, n);
8569
8569
  if (!c || c === s) continue;
8570
8570
  let l = a.ref;
@@ -8938,7 +8938,7 @@ var os = {
8938
8938
  scope: void 0
8939
8939
  }, ms = class {
8940
8940
  constructor(e) {
8941
- this._unordered = null, this._lastMajor = -1, this._lastMinor = -1, this._isColumn = e, this._conflating = E(e);
8941
+ this._unordered = null, this._lastMajor = -1, this._lastMinor = -1, this._isColumn = e, this._conflating = ne(e);
8942
8942
  }
8943
8943
  add(e, t) {
8944
8944
  let n = this._unordered;
@@ -8967,7 +8967,7 @@ var os = {
8967
8967
  colEnd: e.colEnd,
8968
8968
  rowEnd: e.rowEnd
8969
8969
  }), gs = (e) => {
8970
- let t = ce(e, W.Axis.Column, 2), n = Array(t.length);
8970
+ let t = le(e, W.Axis.Column, 2), n = Array(t.length);
8971
8971
  for (let e = 0; e < t.length; e++) {
8972
8972
  let r = t[e];
8973
8973
  n[e] = {