@gridsheet/react-core 3.0.6 → 3.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
- import { calcSideStyle as qn, clampPopup as en, clampLeft as Gn, zoneToArea as ge, focus as O, Lexer as Ge, getFunctionHelps as Pt, expandInput as Qn, y2r as be, x2c as pe, resetInput as Jn, handleFormulaQuoteAutoClose as tn, areaToZone as Qe, insertTextAtCursor as nn, operations as X, isRefInsertable as sn, COLOR_PALETTE as Ie, DEFAULT_WIDTH as vt, DEFAULT_HEIGHT as bt, between as Ae, makeSequence as Xt, p2a as Ee, MIN_HEIGHT as Ht, MIN_WIDTH as Ot, zoneShape as ne, getLabel as wt, FormulaError as es, Pending as ts, insertRef as De, areaToRange as rn, calcBelowPosition as ns, hAlignTransform as ss, among as rs, getAreaInTabular as Lt, isFocus as os, Autofill as is, getCellRectPositions as Fe, a2p as Rt, virtualize as Bt, stripAddressAbsolute as ls, stripSheetName as as, preventSafariBounce as cs, smartScroll as us, isZoneNotSelected as ds, Sheet as gs, embedStyle as fs, getMaxSizesFromCells as on, HEADER_HEIGHT as hs, DEFAULT_ROW_KEY as ms, SHEET_HEIGHT as Kt, HEADER_WIDTH as ps, DEFAULT_COL_KEY as ys, SHEET_WIDTH as Zt } from "@gridsheet/core";
2
- import { BaseFunction as Yr, BaseFunctionAsync as $r, DEFAULT_HISTORY_LIMIT as Pr, FormulaError as Xr, FormulaParser as Hr, Lexer as Or, Pending as Lr, PercentagePolicyMixin as Br, Policy as Kr, RangeEntity as Zr, RefEntity as Ur, Registry as zr, Sheet as Wr, Spilling as _r, ThousandSeparatorPolicyMixin as jr, Time as Vr, ValueEntity as qr, a2p as Gr, aa2oa as Qr, addressesToAreas as Jr, addressesToCols as eo, addressesToRows as to, areaToRange as no, areaToZone as so, buildInitialCells as ro, buildInitialCellsFromOrigin as oo, c2x as io, ch as lo, check as ao, conditionArg as co, createBook as uo, createBooleanMask as go, createRegistry as fo, eachMatrix as ho, ensureBoolean as mo, ensureDate as po, ensureNumber as yo, ensureString as vo, matrixShape as bo, oa2aa as wo, operations as Ro, p2a as Co, r2y as So, rh as No, stripMatrix as Eo, toCellCols as xo, toCellMatrix as ko, toCellObject as To, toCellRows as Ao, toValueCols as Mo, toValueMatrix as Do, toValueObject as Io, toValueRows as Fo, x2c as Yo, y2r as $o, zoneToArea as Po } from "@gridsheet/core";
1
+ import { calcSideStyle as qn, clampPopup as en, clampLeft as Gn, zoneToArea as he, focus as O, Lexer as Ge, getFunctionHelps as Pt, expandInput as Qn, y2r as be, x2c as pe, resetInput as Jn, handleFormulaQuoteAutoClose as tn, areaToZone as Qe, insertTextAtCursor as nn, operations as X, isRefInsertable as sn, COLOR_PALETTE as Ie, DEFAULT_WIDTH as vt, DEFAULT_HEIGHT as bt, between as Ae, makeSequence as Xt, p2a as xe, MIN_HEIGHT as Ht, MIN_WIDTH as Ot, zoneShape as se, getLabel as wt, FormulaError as es, Pending as ts, insertRef as De, areaToRange as rn, calcBelowPosition as ns, hAlignTransform as ss, among as rs, getAreaInTabular as Lt, isFocus as os, Autofill as is, getCellRectPositions as Fe, a2p as Rt, virtualize as Bt, stripAddressAbsolute as ls, stripSheetName as as, preventSafariBounce as cs, smartScroll as us, isZoneNotSelected as ds, Sheet as gs, embedStyle as hs, getMaxSizesFromCells as on, HEADER_HEIGHT as fs, DEFAULT_ROW_KEY as ms, SHEET_HEIGHT as Kt, HEADER_WIDTH as ps, DEFAULT_COL_KEY as ys, SHEET_WIDTH as Wt } from "@gridsheet/core";
2
+ import { BaseFunction as Yr, BaseFunctionAsync as $r, DEFAULT_HISTORY_LIMIT as Pr, FormulaError as Xr, FormulaParser as Hr, Lexer as Or, Pending as Lr, PercentagePolicyMixin as Br, Policy as Kr, RangeEntity as Wr, RefEntity as Zr, Registry as Ur, Sheet as zr, Spilling as _r, ThousandSeparatorPolicyMixin as jr, Time as Vr, ValueEntity as qr, a2p as Gr, aa2oa as Qr, addressesToAreas as Jr, addressesToCols as eo, addressesToRows as to, areaToRange as no, areaToZone as so, buildInitialCells as ro, buildInitialCellsFromOrigin as oo, c2x as io, ch as lo, check as ao, conditionArg as co, createBook as uo, createBooleanMask as go, createRegistry as ho, eachMatrix as fo, ensureBoolean as mo, ensureDate as po, ensureNumber as yo, ensureString as vo, matrixShape as bo, oa2aa as wo, operations as Ro, p2a as Co, r2y as So, rh as No, stripMatrix as xo, toCellCols as Eo, toCellMatrix as ko, toCellObject as To, toCellRows as Ao, toValueCols as Mo, toValueMatrix as Do, toValueObject as Io, toValueRows as Fo, x2c as Yo, y2r as $o, zoneToArea as Po } from "@gridsheet/core";
3
3
  import { jsxs as Y, jsx as a, Fragment as Re } from "react/jsx-runtime";
4
- import at, { createContext as ln, useRef as se, useContext as le, useLayoutEffect as ct, useState as J, useMemo as $e, useCallback as k, memo as nt, useEffect as Z, createRef as an, useReducer as vs } from "react";
5
- import { u as bs, s as ue, w as Ue, a as ee, b as ze, r as ut, c as cn, d as un, e as Pe, f as dn, g as gn, h as we, i as je, j as ws, k as Ut, l as dt, p as gt, m as Je, n as Ne, o as ft, q as ht, t as Ye, v as Ct, x as fn, y as hn, z as mn, A as pn, B as yn, C as vn, D as We, E as et, F as mt, G as st, H as Rs, I as Xe, J as me, K as ke, L as bn, M as Ze, N as zt, O as wn, P as Wt, Q as _t, R as Cs, S as Ss, T as jt, U as Ns, V as Es, W as xs } from "./hooks-CcD8I6FA.mjs";
6
- import { X as Ho } from "./hooks-CcD8I6FA.mjs";
4
+ import at, { createContext as ln, useRef as re, useContext as le, useLayoutEffect as ct, useState as ee, useMemo as $e, useCallback as k, memo as nt, useEffect as K, createRef as an, useReducer as vs } from "react";
5
+ import { u as bs, s as de, w as Ze, a as te, b as Ue, r as ut, c as cn, d as un, e as Pe, f as dn, g as gn, h as we, i as je, j as ws, k as Zt, l as dt, p as gt, m as Je, n as Ne, o as ht, q as ft, t as Ye, v as Ct, x as hn, y as fn, z as mn, A as pn, B as yn, C as vn, D as ze, E as et, F as mt, G as st, H as Rs, I as Xe, J as me, K as ke, L as bn, M as We, N as Ut, O as wn, P as zt, Q as _t, R as Cs, S as Ss, T as jt, U as Ns, V as xs, W as Es } from "./hooks-CvkA2lFB.mjs";
6
+ import { X as Ho } from "./hooks-CvkA2lFB.mjs";
7
7
  import { createPortal as St } from "react-dom";
8
8
  const ae = ln(
9
9
  {}
@@ -14,7 +14,7 @@ const ae = ln(
14
14
  top: s,
15
15
  left: o
16
16
  }) => {
17
- const i = se(null), l = se(null), { store: f } = le(ae), h = !f.editorHovering;
17
+ const i = re(null), l = re(null), { store: h } = le(ae), f = !h.editorHovering;
18
18
  return ct(() => {
19
19
  const c = l.current;
20
20
  c && qn(c);
@@ -55,7 +55,7 @@ const ae = ln(
55
55
  "div",
56
56
  {
57
57
  ref: i,
58
- className: `gs-fn-guide2 ${h ? "gs-fn-guide2-hidden" : ""}`,
58
+ className: `gs-fn-guide2 ${f ? "gs-fn-guide2-hidden" : ""}`,
59
59
  style: s !== void 0 && o !== void 0 ? { top: s + 4, left: o } : void 0,
60
60
  children: [
61
61
  n.category && /* @__PURE__ */ a("span", { className: `gs-fn-guide-category gs-fn-guide-category-${n.category}`, children: n.category }),
@@ -114,23 +114,23 @@ const ae = ln(
114
114
  selected: s,
115
115
  onOptionMouseDown: o
116
116
  }) => {
117
- const i = se(null), [l, f] = J(t);
117
+ const i = re(null), [l, h] = ee(t);
118
118
  return ct(() => {
119
119
  if (!i.current)
120
120
  return;
121
- const h = i.current.getBoundingClientRect().width;
122
- f(Gn(t, h));
123
- }, [t, e]), e.length === 0 ? null : /* @__PURE__ */ a("ul", { ref: i, className: "gs-editor-options", style: { top: n, left: l }, children: e.map((h, c) => /* @__PURE__ */ Y(
121
+ const f = i.current.getBoundingClientRect().width;
122
+ h(Gn(t, f));
123
+ }, [t, e]), e.length === 0 ? null : /* @__PURE__ */ a("ul", { ref: i, className: "gs-editor-options", style: { top: n, left: l }, children: e.map((f, c) => /* @__PURE__ */ Y(
124
124
  "li",
125
125
  {
126
126
  className: `gs-editor-option ${s === c ? " gs-editor-option-selected" : ""}`,
127
127
  onMouseDown: (d) => o(d, c),
128
128
  children: [
129
129
  /* @__PURE__ */ Y("div", { className: "gs-editor-option-content", children: [
130
- /* @__PURE__ */ a("span", { children: h.label ?? h.value }),
130
+ /* @__PURE__ */ a("span", { children: f.label ?? f.value }),
131
131
  s === c && /* @__PURE__ */ a("span", { className: "gs-editor-option-tab", children: "⇥ Tab" })
132
132
  ] }),
133
- (h.isFunction || h.tooltip) && s === c && /* @__PURE__ */ a(Nt, { option: h })
133
+ (f.isFunction || f.tooltip) && s === c && /* @__PURE__ */ a(Nt, { option: f })
134
134
  ]
135
135
  },
136
136
  c
@@ -139,9 +139,9 @@ const ae = ln(
139
139
  const { selectingZone: n, choosing: t, editorRef: s, sheetReactive: o } = e, i = o.current;
140
140
  if (!i)
141
141
  return { top: 0, left: 0, bottom: 0, right: 0 };
142
- const { y: l, x: f } = t;
143
- let c = ge(n);
144
- c.left === -1 && (c = { top: l, left: f, bottom: l, right: f });
142
+ const { y: l, x: h } = t;
143
+ let c = he(n);
144
+ c.left === -1 && (c = { top: l, left: h, bottom: l, right: h });
145
145
  const d = s.current, b = i.trim(c), y = ks(b, {
146
146
  getter: (m, p) => m.getPolicy(p).serializeForClipboard({ point: p, sheet: m })
147
147
  }), g = Ts(b, {
@@ -158,9 +158,9 @@ const ae = ln(
158
158
  } else d != null && (d.value = y, O(d), d.select(), document.execCommand("copy"), d.value = "", d.blur());
159
159
  return c;
160
160
  }, ks = (e, {
161
- getter: n = (l, f) => {
162
- var h;
163
- return String(((h = l.getCell(f)) == null ? void 0 : h.value) ?? "");
161
+ getter: n = (l, h) => {
162
+ var f;
163
+ return String(((f = l.getCell(h)) == null ? void 0 : f.value) ?? "");
164
164
  },
165
165
  filteredRowsIncluded: t = !1,
166
166
  trailingEmptyRowsOmitted: s = !1,
@@ -169,22 +169,22 @@ const ae = ln(
169
169
  `
170
170
  } = {}) => {
171
171
  const l = [];
172
- for (let f = e.top; f <= e.bottom; f++) {
173
- if (e.isRowFiltered(f) && !t)
172
+ for (let h = e.top; h <= e.bottom; h++) {
173
+ if (e.isRowFiltered(h) && !t)
174
174
  continue;
175
- const h = [];
175
+ const f = [];
176
176
  let c = !0;
177
177
  for (let d = e.left; d <= e.right; d++) {
178
- const y = n(e, { y: f, x: d });
178
+ const y = n(e, { y: h, x: d });
179
179
  y !== "" && (c = !1), y.indexOf(`
180
- `) !== -1 ? h.push(`"${y.replace(/"/g, '""')}"`) : h.push(y);
180
+ `) !== -1 ? f.push(`"${y.replace(/"/g, '""')}"`) : f.push(y);
181
181
  }
182
- l.push({ isEmpty: c, line: h.join(o) });
182
+ l.push({ isEmpty: c, line: f.join(o) });
183
183
  }
184
184
  if (s)
185
185
  for (; l.length > 0 && l[l.length - 1].isEmpty; )
186
186
  l.pop();
187
- return l.map((f) => f.line).join(i);
187
+ return l.map((h) => h.line).join(i);
188
188
  }, Ts = (e, {
189
189
  getter: n = (o, i) => {
190
190
  var l;
@@ -198,44 +198,44 @@ const ae = ln(
198
198
  if (e.isRowFiltered(i) && !t)
199
199
  continue;
200
200
  const l = [];
201
- let f = !0;
202
- for (let h = e.left; h <= e.right; h++) {
203
- const d = n(e, { y: i, x: h });
204
- d !== "" && (f = !1);
201
+ let h = !0;
202
+ for (let f = e.left; f <= e.right; f++) {
203
+ const d = n(e, { y: i, x: f });
204
+ d !== "" && (h = !1);
205
205
  const b = d.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&apos;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
206
206
  l.push(`<td>${b}</td>`);
207
207
  }
208
- o.push({ isEmpty: f, html: `<tr>${l.join("")}</tr>` });
208
+ o.push({ isEmpty: h, html: `<tr>${l.join("")}</tr>` });
209
209
  }
210
210
  if (s)
211
211
  for (; o.length > 0 && o[o.length - 1].isEmpty; )
212
212
  o.pop();
213
213
  return `<table>${o.map((i) => i.html).join("")}</table>`;
214
214
  }, Cn = ({ inputting: e, selectionStart: n, optionsAll: t, functions: s }) => {
215
- const [o, i] = J(0), { filteredOptions: l, matchParams: f, activeFunctionHelp: h, activeArgIndex: c } = $e(() => {
216
- var C, D;
215
+ const [o, i] = ee(0), { filteredOptions: l, matchParams: h, activeFunctionHelp: f, activeArgIndex: c } = $e(() => {
216
+ var C, I;
217
217
  const g = e.startsWith("=");
218
218
  let m = null, p = 0;
219
- const A = e.slice(0, n), x = e.slice(n);
220
- if (g && A.length > 1)
219
+ const M = e.slice(0, n), E = e.slice(n);
220
+ if (g && M.length > 1)
221
221
  try {
222
- const r = A.slice(1), u = new Ge(r);
222
+ const r = M.slice(1), u = new Ge(r);
223
223
  u.tokenize();
224
224
  const v = [];
225
225
  for (let N = 0; N < u.tokens.length; N++) {
226
- const I = u.tokens[N];
227
- if (I.type === "FUNCTION") {
226
+ const A = u.tokens[N];
227
+ if (A.type === "FUNCTION") {
228
228
  const R = u.tokens[N + 1];
229
- (R == null ? void 0 : R.type) === "OPEN" ? (v.push({ name: I.entity, argIndex: 0, hasWaitComma: !1 }), N++) : u.tokens.length - 1;
230
- } else I.type === "COMMA" ? v.length > 0 && (v[v.length - 1].argIndex++, v[v.length - 1].hasWaitComma = !0) : I.type === "CLOSE" ? v.length > 0 && v.pop() : I.type !== "SPACE" && v.length > 0 && (v[v.length - 1].hasWaitComma = !1);
229
+ (R == null ? void 0 : R.type) === "OPEN" ? (v.push({ name: A.entity, argIndex: 0, hasWaitComma: !1 }), N++) : u.tokens.length - 1;
230
+ } else A.type === "COMMA" ? v.length > 0 && (v[v.length - 1].argIndex++, v[v.length - 1].hasWaitComma = !0) : A.type === "CLOSE" ? v.length > 0 && v.pop() : A.type !== "SPACE" && v.length > 0 && (v[v.length - 1].hasWaitComma = !1);
231
231
  }
232
232
  if (v.length > 0) {
233
- const N = v[v.length - 1], I = Pt(s);
234
- p = N.argIndex, m = I.find((R) => R.name === N.name.toUpperCase()) || null;
233
+ const N = v[v.length - 1], A = Pt(s);
234
+ p = N.argIndex, m = A.find((R) => R.name === N.name.toUpperCase()) || null;
235
235
  }
236
236
  } catch {
237
237
  }
238
- const F = ((C = A.match(/[a-zA-Z0-9_.]+$/)) == null ? void 0 : C[0]) || "", T = ((D = x.match(/^[a-zA-Z0-9_.]+/)) == null ? void 0 : D[0]) || "", S = g ? (F + T).toLowerCase() : e.toLocaleLowerCase(), M = g && x.slice(T.length).trimStart().startsWith("(");
238
+ const F = ((C = M.match(/[a-zA-Z0-9_.]+$/)) == null ? void 0 : C[0]) || "", T = ((I = E.match(/^[a-zA-Z0-9_.]+/)) == null ? void 0 : I[0]) || "", S = g ? (F + T).toLowerCase() : e.toLocaleLowerCase(), D = g && E.slice(T.length).trimStart().startsWith("(");
239
239
  let $ = [], P = !1;
240
240
  if (g)
241
241
  try {
@@ -252,10 +252,10 @@ const ae = ln(
252
252
  }
253
253
  } catch {
254
254
  }
255
- return g && !P ? S.length > 0 && !M && ($ = Pt(s).map((r) => {
256
- const u = r.name.toLowerCase(), v = u.startsWith(S), N = v ? 0 : -1, I = r.defs.length === 0;
255
+ return g && !P ? S.length > 0 && !D && ($ = Pt(s).map((r) => {
256
+ const u = r.name.toLowerCase(), v = u.startsWith(S), N = v ? 0 : -1, A = r.defs.length === 0;
257
257
  return {
258
- option: { ...r, value: r.name + (I ? "()" : "("), isFunction: !0, label: r.name },
258
+ option: { ...r, value: r.name + (A ? "()" : "("), isFunction: !0, label: r.name },
259
259
  index: N,
260
260
  startsWith: v,
261
261
  keywordCount: 1,
@@ -265,9 +265,9 @@ const ae = ln(
265
265
  const u = r.keywords ?? [String(r.value)];
266
266
  let v = { index: -1, startsWith: !1, keyword: "" };
267
267
  for (const N of u) {
268
- const I = N.toLowerCase(), R = I.indexOf(S);
268
+ const A = N.toLowerCase(), R = A.indexOf(S);
269
269
  if (R !== -1) {
270
- const H = I.startsWith(S);
270
+ const H = A.startsWith(S);
271
271
  (v.index === -1 || R < v.index || R === v.index && H && !v.startsWith) && (v = { index: R, startsWith: H, keyword: N });
272
272
  }
273
273
  }
@@ -295,13 +295,13 @@ const ae = ln(
295
295
  (g) => {
296
296
  if (!g)
297
297
  return { value: e, selectionStart: n };
298
- if (f.isFormula) {
299
- const m = e.slice(0, n - f.matchLengthBefore), p = e.slice(n + f.matchLengthAfter);
298
+ if (h.isFormula) {
299
+ const m = e.slice(0, n - h.matchLengthBefore), p = e.slice(n + h.matchLengthAfter);
300
300
  return { value: m + g.value + p, selectionStart: m.length + g.value.length };
301
301
  } else
302
302
  return { value: String(g.value), selectionStart: String(g.value).length };
303
303
  },
304
- [e, n, f]
304
+ [e, n, h]
305
305
  ), b = k(
306
306
  (g) => l.length > 1 ? (i((m) => m <= 0 ? l.length - 1 : m - 1), g.preventDefault(), !0) : !1,
307
307
  [l.length]
@@ -316,8 +316,8 @@ const ae = ln(
316
316
  replaceWithOption: d,
317
317
  handleArrowUp: b,
318
318
  handleArrowDown: y,
319
- isFormula: f.isFormula,
320
- activeFunctionHelp: h,
319
+ isFormula: h.isFormula,
320
+ activeFunctionHelp: f,
321
321
  activeArgIndex: c
322
322
  };
323
323
  }, rt = ({ children: e, style: n, className: t = "", ...s }) => {
@@ -327,9 +327,9 @@ const ae = ln(
327
327
  o.body
328
328
  );
329
329
  }, Sn = (e, n = !1) => {
330
- const s = new DOMParser().parseFromString(e, "text/html"), o = [], i = (h) => {
330
+ const s = new DOMParser().parseFromString(e, "text/html"), o = [], i = (f) => {
331
331
  var b, y;
332
- const c = /* @__PURE__ */ new Set(), d = h.querySelectorAll("tr,caption");
332
+ const c = /* @__PURE__ */ new Set(), d = f.querySelectorAll("tr,caption");
333
333
  for (let g = 0; g < d.length; g++) {
334
334
  const m = d[g];
335
335
  if (m.tagName === "CAPTION") {
@@ -337,36 +337,36 @@ const ae = ln(
337
337
  F && o.push([{ value: F }]);
338
338
  continue;
339
339
  }
340
- const p = Array.from(m.querySelectorAll("td, th")), A = [];
341
- let x = 0;
340
+ const p = Array.from(m.querySelectorAll("td, th")), M = [];
341
+ let E = 0;
342
342
  for (const F of p) {
343
343
  const T = ((y = F.textContent) == null ? void 0 : y.trim()) ?? "", S = n ? void 0 : (() => {
344
344
  const P = Vt(F.firstElementChild);
345
345
  return { ...Vt(F), ...P };
346
346
  })();
347
- for (; c.has(`${g}-${++x}`); )
348
- A.push({ value: "", style: S, skip: !0 });
349
- A.push({ value: T, style: S });
350
- const M = parseInt(F.getAttribute("rowspan") ?? "1", 10), $ = parseInt(F.getAttribute("colspan") ?? "1", 10);
351
- for (let P = 0; P < M; P++)
347
+ for (; c.has(`${g}-${++E}`); )
348
+ M.push({ value: "", style: S, skip: !0 });
349
+ M.push({ value: T, style: S });
350
+ const D = parseInt(F.getAttribute("rowspan") ?? "1", 10), $ = parseInt(F.getAttribute("colspan") ?? "1", 10);
351
+ for (let P = 0; P < D; P++)
352
352
  for (let C = 0; C < $; C++)
353
- c.add(`${g + P}-${x + C}`);
353
+ c.add(`${g + P}-${E + C}`);
354
354
  }
355
- o.push(A);
355
+ o.push(M);
356
356
  }
357
- }, l = (h, c = []) => {
358
- if (h.nodeType === Node.ELEMENT_NODE) {
359
- const d = h, b = d.tagName;
357
+ }, l = (f, c = []) => {
358
+ if (f.nodeType === Node.ELEMENT_NODE) {
359
+ const d = f, b = d.tagName;
360
360
  b === "TABLE" ? (c.length > 0 && (o.push(c.slice()), c.length = 0), i(d)) : b === "BR" ? (o.push(c.slice()), c.length = 0) : As.has(b) ? (c.length > 0 && (o.push(c.slice()), c.length = 0), d.childNodes.forEach((y) => l(y, c)), c.length > 0 && (o.push(c.slice()), c.length = 0)) : d.childNodes.forEach((y) => l(y, c));
361
- } else if (h.nodeType === Node.TEXT_NODE) {
362
- const b = (h.textContent ?? "").split(/\r?\n/);
361
+ } else if (f.nodeType === Node.TEXT_NODE) {
362
+ const b = (f.textContent ?? "").split(/\r?\n/);
363
363
  for (const y of b) {
364
364
  const g = y.trim();
365
365
  g && c.push({ value: g });
366
366
  }
367
367
  }
368
- }, f = [];
369
- return s.body.childNodes.forEach((h) => l(h, f)), f.length > 0 && o.push(f), o;
368
+ }, h = [];
369
+ return s.body.childNodes.forEach((f) => l(f, h)), h.length > 0 && o.push(h), o;
370
370
  };
371
371
  function Vt(e) {
372
372
  if (!e)
@@ -376,7 +376,7 @@ function Vt(e) {
376
376
  let [o, i] = s.split(":");
377
377
  if (!o || !i || (o = o.trim(), o === "height" || o === "width"))
378
378
  return;
379
- const l = o.trim().replace(/-([a-z])/g, (h, c) => c.toUpperCase());
379
+ const l = o.trim().replace(/-([a-z])/g, (f, c) => c.toUpperCase());
380
380
  if (l === "float" || l === "display" || l.startsWith("padding"))
381
381
  return;
382
382
  if (l === "border") {
@@ -415,8 +415,8 @@ function Vt(e) {
415
415
  });
416
416
  return;
417
417
  }
418
- const f = i.trim();
419
- t[l] = f;
418
+ const h = i.trim();
419
+ t[l] = h;
420
420
  }), t;
421
421
  }
422
422
  const Nn = (e, n = " ") => {
@@ -424,25 +424,25 @@ const Nn = (e, n = " ") => {
424
424
  const t = [[]];
425
425
  let s = t[0], o = !1, i = "";
426
426
  for (let l = 0; l < e.length; l++) {
427
- const f = e[l];
428
- if (f === `
427
+ const h = e[l];
428
+ if (h === `
429
429
  ` && !o) {
430
430
  s.push({ value: ot(i) }), i = "", s = [], t.push(s);
431
431
  continue;
432
432
  }
433
- if (f === n) {
433
+ if (h === n) {
434
434
  s.push({ value: ot(i) }), i = "";
435
435
  continue;
436
436
  }
437
- if (f === '"' && !o && i === "") {
437
+ if (h === '"' && !o && i === "") {
438
438
  o = !0;
439
439
  continue;
440
440
  }
441
- if (f === '"' && o) {
441
+ if (h === '"' && o) {
442
442
  o = !1;
443
443
  continue;
444
444
  }
445
- i += f;
445
+ i += h;
446
446
  }
447
447
  return i && s.push({ value: ot(i) }), t;
448
448
  }, ot = (e) => e.replace(/\x00/g, '"'), As = /* @__PURE__ */ new Set([
@@ -480,39 +480,39 @@ const Nn = (e, n = " ") => {
480
480
  "UL"
481
481
  ]), Ms = ({ mode: e }) => {
482
482
  var Ft, Yt;
483
- const { store: n, dispatch: t } = le(ae), [s, o] = J(!1), [i, l] = J(0), [f, h] = J(!1), c = se(!1), {
483
+ const { store: n, dispatch: t } = le(ae), [s, o] = ee(!1), [i, l] = ee(0), [h, f] = ee(!1), c = re(!1), {
484
484
  choosing: d,
485
485
  inputting: b,
486
486
  selectingZone: y,
487
487
  editorRect: g,
488
488
  editingAddress: m,
489
489
  entering: p,
490
- matchingCells: A,
491
- matchingCellIndex: x,
490
+ matchingCells: M,
491
+ matchingCellIndex: E,
492
492
  searchQuery: F,
493
493
  editorRef: T,
494
494
  largeEditorRef: S,
495
- searchInputRef: M,
495
+ searchInputRef: D,
496
496
  editingOnEnter: $,
497
497
  sheetReactive: P,
498
498
  sheetId: C,
499
- dragging: D
499
+ dragging: I
500
500
  } = n, r = P.current, u = () => {
501
- var de;
502
- if (!f || !L || typeof document > "u" || T.current !== document.activeElement)
501
+ var ge;
502
+ if (!h || !L || typeof document > "u" || T.current !== document.activeElement)
503
503
  return null;
504
- const E = (de = T.current) == null ? void 0 : de.getBoundingClientRect();
505
- if (!E)
504
+ const x = (ge = T.current) == null ? void 0 : ge.getBoundingClientRect();
505
+ if (!x)
506
506
  return null;
507
- const { bottom: q, left: ie } = E;
507
+ const { bottom: V, left: ie } = x;
508
508
  return St(
509
509
  /* @__PURE__ */ Y(Re, { children: [
510
510
  B && R.length === 0 && (!y || y.endY === -1 && y.endX === -1) && /* @__PURE__ */ a(
511
511
  Nt,
512
512
  {
513
513
  activeFunctionGuide: B,
514
- activeArgIndex: z,
515
- top: q,
514
+ activeArgIndex: U,
515
+ top: V,
516
516
  left: ie
517
517
  }
518
518
  ),
@@ -520,7 +520,7 @@ const Nn = (e, n = " ") => {
520
520
  Rn,
521
521
  {
522
522
  filteredOptions: R,
523
- top: q,
523
+ top: V,
524
524
  left: ie,
525
525
  selected: H,
526
526
  onOptionMouseDown: Vn
@@ -529,85 +529,85 @@ const Nn = (e, n = " ") => {
529
529
  ] }),
530
530
  document.body
531
531
  );
532
- }, v = r == null ? void 0 : r.getPolicy(d), N = (v == null ? void 0 : v.getSelectOptions()) ?? [], I = k((E) => {
533
- l(E.currentTarget.selectionStart);
532
+ }, v = r == null ? void 0 : r.getPolicy(d), N = (v == null ? void 0 : v.getSelectOptions()) ?? [], A = k((x) => {
533
+ l(x.currentTarget.selectionStart);
534
534
  }, []), {
535
535
  filteredOptions: R,
536
536
  selected: H,
537
- setSelected: G,
537
+ setSelected: q,
538
538
  replaceWithOption: _,
539
- handleArrowUp: re,
539
+ handleArrowUp: oe,
540
540
  handleArrowDown: ce,
541
541
  activeFunctionHelp: B,
542
- activeArgIndex: z
542
+ activeArgIndex: U
543
543
  } = Cn({
544
544
  inputting: b,
545
545
  selectionStart: i,
546
546
  optionsAll: N,
547
547
  functions: r == null ? void 0 : r.registry.functions
548
548
  });
549
- Z(() => {
549
+ K(() => {
550
550
  O(T == null ? void 0 : T.current);
551
- }, [T]), Z(() => {
552
- r && r.registry.lastFocused != null && r.registry.lastFocused === T.current && r.registry.lastFocused === S.current && t(ue(""));
553
- }, [r == null ? void 0 : r.registry.lastFocused, r, T, S, t]), Z(() => {
551
+ }, [T]), K(() => {
552
+ r && r.registry.lastFocused != null && r.registry.lastFocused === T.current && r.registry.lastFocused === S.current && t(de(""));
553
+ }, [r == null ? void 0 : r.registry.lastFocused, r, T, S, t]), K(() => {
554
554
  r && (r.registry.editingSheetId = C, r.registry.editingAddress = m);
555
- }, [m, r, C]), Z(() => {
555
+ }, [m, r, C]), K(() => {
556
556
  Qn(T.current);
557
557
  }, [b, m, T]);
558
- const { y: U, x: K } = d, W = `${be(U)}`, j = `${pe(K)}${W}`, L = m === j, oe = r == null ? void 0 : r.getCell({ y: U, x: K }, { resolution: "RAW" }), w = r ? r.getSerializedValue({ point: d, cell: oe, resolution: "RAW" }) : "", [V, fe] = J(w), te = k(
559
- (E) => {
560
- V !== E && t(Ue({ value: E })), fe(E);
558
+ const { y: W, x: J } = d, j = `${be(W)}`, G = `${pe(J)}${j}`, L = m === G, Q = r == null ? void 0 : r.getCell({ y: W, x: J }, { resolution: "RAW" }), w = r ? r.getSerializedValue({ point: d, cell: Q, resolution: "RAW" }) : "", [z, ue] = ee(w), ne = k(
559
+ (x) => {
560
+ z !== x && t(Ze({ value: x })), ue(x);
561
561
  },
562
- [V, t]
562
+ [z, t]
563
563
  ), ye = k(
564
- (E) => {
564
+ (x) => {
565
565
  if (!r)
566
566
  return;
567
- const q = R[E];
568
- if (q) {
569
- if (q.isFunction) {
570
- const { value: ie, selectionStart: de } = _(q);
571
- t(ee(ie)), setTimeout(() => {
572
- T.current && (O(T.current), T.current.setSelectionRange(de, de));
567
+ const V = R[x];
568
+ if (V) {
569
+ if (V.isFunction) {
570
+ const { value: ie, selectionStart: ge } = _(V);
571
+ t(te(ie)), setTimeout(() => {
572
+ T.current && (O(T.current), T.current.setSelectionRange(ge, ge));
573
573
  }, 0);
574
574
  } else {
575
575
  const ie = r.update({
576
- diff: { [j]: { value: q.value } },
576
+ diff: { [G]: { value: V.value } },
577
577
  partial: !0
578
578
  });
579
- t(ze(ie.clone())), t(ue("")), t(ee(""));
579
+ t(Ue(ie.clone())), t(de("")), t(te(""));
580
580
  }
581
- G(0);
581
+ q(0);
582
582
  }
583
583
  },
584
- [R, r, j, b, te, t, T]
584
+ [R, r, G, b, ne, t, T]
585
585
  );
586
- Z(() => {
587
- r && (fe(w), t(ee(w)), Jn(T.current, r, d));
586
+ K(() => {
587
+ r && (ue(w), t(te(w)), Jn(T.current, r, d));
588
588
  }, [d, w, t, T, r]);
589
- const { y: xe, x: _e, height: At, width: Mt } = g, Bn = w.split(`
590
- `).length, [Dt, It] = J(!1), Kn = k(
591
- (E) => {
592
- var de, Oe, Me, Le, Be, $t;
593
- if (!r || E.nativeEvent.isComposing || c.current || Dt)
589
+ const { y: Ee, x: _e, height: At, width: Mt } = g, Bn = w.split(`
590
+ `).length, [Dt, It] = ee(!1), Kn = k(
591
+ (x) => {
592
+ var ge, Oe, Me, Le, Be, $t;
593
+ if (!r || x.nativeEvent.isComposing || c.current || Dt)
594
594
  return;
595
- E.key === "Meta" || E.key === "Control" || (It(!0), requestAnimationFrame(() => {
595
+ x.key === "Meta" || x.key === "Control" || (It(!0), requestAnimationFrame(() => {
596
596
  It(!1);
597
597
  }));
598
- const q = E.currentTarget;
599
- if (tn(E, b))
600
- return t(ee(q.value)), !1;
601
- const ie = E.shiftKey;
602
- switch (E.key) {
598
+ const V = x.currentTarget;
599
+ if (tn(x, b))
600
+ return t(te(V.value)), !1;
601
+ const ie = x.shiftKey;
602
+ switch (x.key) {
603
603
  case "Tab":
604
- if (E.preventDefault(), L)
604
+ if (x.preventDefault(), L)
605
605
  if (R.length) {
606
- const ve = (de = R[H]) == null ? void 0 : de.isFunction;
606
+ const ve = (ge = R[H]) == null ? void 0 : ge.isFunction;
607
607
  if (ye(H), ve)
608
608
  return !1;
609
609
  } else
610
- te(q.value), t(ue("")), t(ee(""));
610
+ ne(V.value), t(de("")), t(te(""));
611
611
  return t(
612
612
  dt({
613
613
  numRows: r.numRows,
@@ -615,24 +615,24 @@ const Nn = (e, n = " ") => {
615
615
  deltaY: 0,
616
616
  deltaX: ie ? -1 : 1
617
617
  })
618
- ), t(ue("")), !1;
618
+ ), t(de("")), !1;
619
619
  case "Enter":
620
620
  if (L)
621
621
  if (R.length) {
622
622
  const ve = (Oe = R[H]) == null ? void 0 : Oe.isFunction;
623
623
  if (ye(H), ve)
624
- return E.preventDefault(), !1;
624
+ return x.preventDefault(), !1;
625
625
  } else {
626
- if (E.altKey)
627
- return nn(q, `
628
- `), t(ee(q.value)), E.preventDefault(), !1;
629
- if (E.nativeEvent.isComposing)
626
+ if (x.altKey)
627
+ return nn(V, `
628
+ `), t(te(V.value)), x.preventDefault(), !1;
629
+ if (x.nativeEvent.isComposing)
630
630
  return !1;
631
- te(q.value), t(ue("")), t(ee(""));
631
+ ne(V.value), t(de("")), t(te(""));
632
632
  }
633
633
  else if ($ && y.endY === -1) {
634
634
  const ve = document.createEvent("MouseEvents");
635
- return ve.initEvent("dblclick", !0, !0), q.dispatchEvent(ve), E.preventDefault(), !1;
635
+ return ve.initEvent("dblclick", !0, !0), V.dispatchEvent(ve), x.preventDefault(), !1;
636
636
  }
637
637
  return t(
638
638
  dt({
@@ -641,14 +641,14 @@ const Nn = (e, n = " ") => {
641
641
  deltaY: ie ? -1 : 1,
642
642
  deltaX: 0
643
643
  })
644
- ), E.preventDefault(), !1;
644
+ ), x.preventDefault(), !1;
645
645
  case "Backspace":
646
646
  if (!L)
647
- return ((Me = r.getSystem({ y: U, x: K })) == null ? void 0 : Me.spilledFrom) != null ? (E.preventDefault(), !1) : (t(Ut(null)), t(ee("")), !1);
647
+ return ((Me = r.getSystem({ y: W, x: J })) == null ? void 0 : Me.spilledFrom) != null ? (x.preventDefault(), !1) : (t(Zt(null)), t(te("")), !1);
648
648
  break;
649
649
  case "Delete":
650
650
  if (!L)
651
- return ((Le = r.getSystem({ y: U, x: K })) == null ? void 0 : Le.spilledFrom) != null ? (E.preventDefault(), !1) : (t(Ut(null)), t(ee("")), !1);
651
+ return ((Le = r.getSystem({ y: W, x: J })) == null ? void 0 : Le.spilledFrom) != null ? (x.preventDefault(), !1) : (t(Zt(null)), t(te("")), !1);
652
652
  break;
653
653
  case "Shift":
654
654
  return o(!0), !1;
@@ -661,7 +661,7 @@ const Nn = (e, n = " ") => {
661
661
  case "NumLock":
662
662
  return !1;
663
663
  case "Escape":
664
- return t(ws(null)), t(Pe(void 0)), t(ee(V)), !1;
664
+ return t(ws(null)), t(Pe(void 0)), t(te(z)), !1;
665
665
  case "ArrowLeft":
666
666
  if (!L)
667
667
  return t(
@@ -685,7 +685,7 @@ const Nn = (e, n = " ") => {
685
685
  deltaX: 0
686
686
  })
687
687
  ), !1;
688
- if (re(E))
688
+ if (oe(x))
689
689
  return !0;
690
690
  break;
691
691
  case "ArrowRight":
@@ -711,12 +711,12 @@ const Nn = (e, n = " ") => {
711
711
  deltaX: 0
712
712
  })
713
713
  ), !1;
714
- if (ce(E))
714
+ if (ce(x))
715
715
  return !0;
716
716
  break;
717
717
  case "a":
718
- if ((E.ctrlKey || E.metaKey) && !L)
719
- return E.preventDefault(), t(
718
+ if ((x.ctrlKey || x.metaKey) && !L)
719
+ return x.preventDefault(), t(
720
720
  we({
721
721
  startY: 1,
722
722
  startX: 1,
@@ -726,28 +726,28 @@ const Nn = (e, n = " ") => {
726
726
  ), !1;
727
727
  break;
728
728
  case "c":
729
- if (E.ctrlKey || E.metaKey) {
729
+ if (x.ctrlKey || x.metaKey) {
730
730
  if (!L) {
731
- E.preventDefault();
731
+ x.preventDefault();
732
732
  const ve = tt(n);
733
- return t(gn(Qe(ve))), O(q), !1;
733
+ return t(gn(Qe(ve))), O(V), !1;
734
734
  }
735
735
  return !0;
736
736
  }
737
737
  break;
738
738
  case "f":
739
- if ((E.ctrlKey || E.metaKey) && !L)
740
- return E.preventDefault(), typeof F > "u" && t(Pe("")), t(dn(!1)), requestAnimationFrame(() => O(M.current)), !1;
739
+ if ((x.ctrlKey || x.metaKey) && !L)
740
+ return x.preventDefault(), typeof F > "u" && t(Pe("")), t(dn(!1)), requestAnimationFrame(() => O(D.current)), !1;
741
741
  break;
742
742
  case "r":
743
743
  // R
744
744
  case "y":
745
- if ((E.ctrlKey || E.metaKey) && !L)
746
- return E.preventDefault(), t(ut(null)), requestAnimationFrame(() => t(ee(""))), !1;
745
+ if ((x.ctrlKey || x.metaKey) && !L)
746
+ return x.preventDefault(), t(ut(null)), requestAnimationFrame(() => t(te(""))), !1;
747
747
  break;
748
748
  case "s":
749
- if ((E.ctrlKey || E.metaKey) && !L)
750
- return E.preventDefault(), ($t = (Be = r.registry).onSave) == null || $t.call(Be, {
749
+ if ((x.ctrlKey || x.metaKey) && !L)
750
+ return x.preventDefault(), ($t = (Be = r.registry).onSave) == null || $t.call(Be, {
751
751
  sheet: r,
752
752
  points: {
753
753
  pointing: d,
@@ -763,25 +763,25 @@ const Nn = (e, n = " ") => {
763
763
  }), !1;
764
764
  break;
765
765
  case "v":
766
- if (E.ctrlKey || E.metaKey)
767
- return E.stopPropagation(), !1;
766
+ if (x.ctrlKey || x.metaKey)
767
+ return x.stopPropagation(), !1;
768
768
  break;
769
769
  case "x":
770
- if ((E.ctrlKey || E.metaKey) && !L) {
771
- E.preventDefault();
770
+ if ((x.ctrlKey || x.metaKey) && !L) {
771
+ x.preventDefault();
772
772
  const ve = tt(n);
773
- return t(un(Qe(ve))), O(q), !1;
773
+ return t(un(Qe(ve))), O(V), !1;
774
774
  }
775
775
  break;
776
776
  case "z":
777
- if ((E.ctrlKey || E.metaKey) && !L)
778
- return E.preventDefault(), E.shiftKey ? t(ut(null)) : t(cn(null)), !1;
777
+ if ((x.ctrlKey || x.metaKey) && !L)
778
+ return x.preventDefault(), x.shiftKey ? t(ut(null)) : t(cn(null)), !1;
779
779
  break;
780
780
  case ";":
781
- (E.ctrlKey || E.metaKey) && (L || (E.preventDefault(), te((/* @__PURE__ */ new Date()).toDateString())));
781
+ (x.ctrlKey || x.metaKey) && (L || (x.preventDefault(), ne((/* @__PURE__ */ new Date()).toDateString())));
782
782
  break;
783
783
  }
784
- return E.ctrlKey || E.metaKey ? !1 : X.hasOperation(oe == null ? void 0 : oe.prevention, X.Write) ? (console.warn("This cell is protected from writing."), !1) : (t(ue(j)), L || t(ee("")), G(0), !1);
784
+ return x.ctrlKey || x.metaKey ? !1 : X.hasOperation(Q == null ? void 0 : Q.prevention, X.Write) ? (console.warn("This cell is protected from writing."), !1) : (t(de(G)), L || t(te("")), q(0), !1);
785
785
  },
786
786
  [
787
787
  Dt,
@@ -790,90 +790,90 @@ const Nn = (e, n = " ") => {
790
790
  H,
791
791
  $,
792
792
  y,
793
- V,
793
+ z,
794
794
  r,
795
795
  d,
796
796
  n,
797
- oe,
798
- j,
799
- te,
797
+ Q,
798
+ G,
799
+ ne,
800
800
  F,
801
801
  b
802
802
  ]
803
- ), Zn = k(
804
- (E) => {
805
- h(!0), r && (r.registry.lastFocused = E.currentTarget);
803
+ ), Wn = k(
804
+ (x) => {
805
+ f(!0), r && (r.registry.lastFocused = x.currentTarget);
806
806
  },
807
807
  [r]
808
- ), Un = k(
809
- (E) => {
810
- if (X.hasOperation(oe == null ? void 0 : oe.prevention, X.Write)) {
808
+ ), Zn = k(
809
+ (x) => {
810
+ if (X.hasOperation(Q == null ? void 0 : Q.prevention, X.Write)) {
811
811
  console.warn("This cell is protected from writing.");
812
812
  return;
813
813
  }
814
- const q = E.currentTarget;
815
- L || (t(ee(w)), t(ue(j)), requestAnimationFrame(() => {
816
- q.style.width = `${q.scrollWidth}px`, q.style.height = `${q.scrollHeight}px`;
814
+ const V = x.currentTarget;
815
+ L || (t(te(w)), t(de(G)), requestAnimationFrame(() => {
816
+ V.style.width = `${V.scrollWidth}px`, V.style.height = `${V.scrollHeight}px`;
817
817
  const ie = new String(w).length;
818
- q.setSelectionRange(ie, ie);
818
+ V.setSelectionRange(ie, ie);
819
819
  }));
820
820
  },
821
- [oe, L, w, j]
822
- ), zn = k(
823
- (E) => {
824
- if (h(!1), sn(E.currentTarget))
821
+ [Q, L, w, G]
822
+ ), Un = k(
823
+ (x) => {
824
+ if (f(!1), sn(x.currentTarget))
825
825
  return !0;
826
- L && te(E.currentTarget.value), t(ue(""));
826
+ L && ne(x.currentTarget.value), t(de(""));
827
827
  },
828
- [L, te, t]
829
- ), Wn = k(
830
- (E) => {
831
- X.hasOperation(oe == null ? void 0 : oe.prevention, X.Write) || (t(ee(E.currentTarget.value)), l(E.currentTarget.selectionStart), G(0));
828
+ [L, ne, t]
829
+ ), zn = k(
830
+ (x) => {
831
+ X.hasOperation(Q == null ? void 0 : Q.prevention, X.Write) || (t(te(x.currentTarget.value)), l(x.currentTarget.selectionStart), q(0));
832
832
  },
833
- [oe]
833
+ [Q]
834
834
  ), _n = k(
835
- (E) => {
836
- var de, Oe, Me, Le;
835
+ (x) => {
836
+ var ge, Oe, Me, Le;
837
837
  if (L)
838
838
  return !0;
839
- const q = s, ie = (Oe = (de = E.clipboardData) == null ? void 0 : de.getData) == null ? void 0 : Oe.call(de, "text/html");
839
+ const V = s, ie = (Oe = (ge = x.clipboardData) == null ? void 0 : ge.getData) == null ? void 0 : Oe.call(ge, "text/html");
840
840
  if (ie)
841
- t(gt({ matrix: Sn(ie), onlyValue: q }));
841
+ t(gt({ matrix: Sn(ie), onlyValue: V }));
842
842
  else {
843
- const Be = (Le = (Me = E.clipboardData) == null ? void 0 : Me.getData) == null ? void 0 : Le.call(Me, "text/plain");
844
- Be ? t(gt({ matrix: Nn(Be), onlyValue: q })) : console.warn("No clipboard data found.");
843
+ const Be = (Le = (Me = x.clipboardData) == null ? void 0 : Me.getData) == null ? void 0 : Le.call(Me, "text/plain");
844
+ Be ? t(gt({ matrix: Nn(Be), onlyValue: V })) : console.warn("No clipboard data found.");
845
845
  }
846
- return E.preventDefault(), E.stopPropagation(), !1;
846
+ return x.preventDefault(), x.stopPropagation(), !1;
847
847
  },
848
848
  [L, s]
849
849
  ), jn = k(
850
- (E) => {
851
- var ie, de;
850
+ (x) => {
851
+ var ie, ge;
852
852
  o(!1);
853
- const q = ge(n.selectingZone);
854
- (de = r == null ? void 0 : (ie = r.registry).onKeyUp) == null || de.call(ie, {
855
- e: E,
853
+ const V = he(n.selectingZone);
854
+ (ge = r == null ? void 0 : (ie = r.registry).onKeyUp) == null || ge.call(ie, {
855
+ e: x,
856
856
  points: {
857
857
  pointing: d,
858
- selectingFrom: { y: q.top, x: q.left },
859
- selectingTo: { y: q.bottom, x: q.right }
858
+ selectingFrom: { y: V.top, x: V.left },
859
+ selectingTo: { y: V.bottom, x: V.right }
860
860
  }
861
861
  });
862
862
  },
863
863
  [n.selectingZone, d, r]
864
864
  ), Vn = k(
865
- (E, q) => (ye(q), E.preventDefault(), E.stopPropagation(), !1),
865
+ (x, V) => (ye(V), x.preventDefault(), x.stopPropagation(), !1),
866
866
  [ye]
867
867
  );
868
868
  return r ? /* @__PURE__ */ Y(
869
869
  rt,
870
870
  {
871
871
  className: `gs-editor ${L ? "gs-editing" : ""}`,
872
- style: L ? { top: xe, left: _e, height: At } : {},
872
+ style: L ? { top: Ee, left: _e, height: At } : {},
873
873
  "data-mode": e,
874
874
  "data-sheet-id": C,
875
875
  children: [
876
- /* @__PURE__ */ a("div", { className: `gs-cell-label ${L ? " gs-hidden" : ""}`, children: j }),
876
+ /* @__PURE__ */ a("div", { className: `gs-cell-label ${L ? " gs-hidden" : ""}`, children: G }),
877
877
  /* @__PURE__ */ Y("div", { className: "gs-editor-inner", style: { width: Mt }, children: [
878
878
  /* @__PURE__ */ a(
879
879
  "pre",
@@ -884,7 +884,7 @@ const Nn = (e, n = " ") => {
884
884
  height: (Ft = T.current) == null ? void 0 : Ft.scrollHeight,
885
885
  width: (((Yt = T.current) == null ? void 0 : Yt.scrollWidth) ?? 0) - 4
886
886
  },
887
- children: (oe == null ? void 0 : oe.formulaEnabled) ?? !0 ? En(b) : b
887
+ children: (Q == null ? void 0 : Q.formulaEnabled) ?? !0 ? xn(b) : b
888
888
  }
889
889
  ),
890
890
  /* @__PURE__ */ a(
@@ -898,21 +898,21 @@ const Nn = (e, n = " ") => {
898
898
  draggable: !1,
899
899
  ref: T,
900
900
  rows: Bn,
901
- onFocus: Zn,
901
+ onFocus: Wn,
902
902
  style: { minWidth: Mt, minHeight: At },
903
- onDoubleClick: Un,
904
- onBlur: zn,
903
+ onDoubleClick: Zn,
904
+ onBlur: Un,
905
905
  value: b,
906
- onChange: Wn,
907
- onSelect: I,
906
+ onChange: zn,
907
+ onSelect: A,
908
908
  onPaste: _n,
909
909
  onKeyDown: Kn,
910
910
  onKeyUp: jn,
911
911
  onCompositionStart: () => {
912
- c.current = !0, L || (t(ue(j)), t(ee("")));
912
+ c.current = !0, L || (t(de(G)), t(te("")));
913
913
  },
914
- onCompositionEnd: (E) => {
915
- c.current = !1, t(ee(E.currentTarget.value));
914
+ onCompositionEnd: (x) => {
915
+ c.current = !1, t(te(x.currentTarget.value));
916
916
  },
917
917
  onMouseEnter: () => {
918
918
  t(Je(!0));
@@ -930,7 +930,7 @@ const Nn = (e, n = " ") => {
930
930
  }, it = nt(
931
931
  ({ token: e, tokenKey: n, color: t, className: s }) => /* @__PURE__ */ a("span", { style: t ? { color: t } : void 0, className: s, children: e.stringify() }, n),
932
932
  (e, n) => e.tokenKey === n.tokenKey && e.color === n.color && e.className === n.className && e.token.stringify() === n.token.stringify()
933
- ), En = (e) => {
933
+ ), xn = (e) => {
934
934
  if (e[0] !== "=")
935
935
  return /* @__PURE__ */ a(Re, { children: e });
936
936
  const n = new Ge(e.substring(1));
@@ -942,45 +942,45 @@ const Nn = (e, n = " ") => {
942
942
  n.tokens.map((i, l) => {
943
943
  if (i.type === "SPACE")
944
944
  return /* @__PURE__ */ a(at.Fragment, { children: i.stringify() }, `${o}-SPACE-${l}`);
945
- const f = `${o}-${i.type}-${i.stringify()}-${l}`;
945
+ const h = `${o}-${i.type}-${i.stringify()}-${l}`;
946
946
  if (i.type === "REF" || i.type === "RANGE") {
947
- const h = i.stringify(), c = s[h];
947
+ const f = i.stringify(), c = s[f];
948
948
  if (c !== void 0)
949
949
  return /* @__PURE__ */ a(
950
950
  it,
951
951
  {
952
952
  token: i,
953
- tokenKey: f,
953
+ tokenKey: h,
954
954
  color: Ie[c % Ie.length]
955
955
  },
956
- f
956
+ h
957
957
  );
958
958
  const d = Ie[t % Ie.length];
959
- return s[h] = t++, /* @__PURE__ */ a(
959
+ return s[f] = t++, /* @__PURE__ */ a(
960
960
  it,
961
961
  {
962
962
  token: i,
963
- tokenKey: f,
963
+ tokenKey: h,
964
964
  color: d,
965
965
  className: `gs-token-type-${i.type}`
966
966
  },
967
- f
967
+ h
968
968
  );
969
969
  }
970
970
  return /* @__PURE__ */ a(
971
971
  it,
972
972
  {
973
973
  token: i,
974
- tokenKey: f,
974
+ tokenKey: h,
975
975
  className: `gs-token-type-${i.type} gs-token-entity-type-${typeof i.entity}`
976
976
  },
977
- f
977
+ h
978
978
  );
979
979
  })
980
980
  ] });
981
- }, xn = ln({});
981
+ }, En = ln({});
982
982
  function Nr() {
983
- const [e, n] = J(void 0), [t, s] = J();
983
+ const [e, n] = ee(void 0), [t, s] = ee();
984
984
  return {
985
985
  provided: !0,
986
986
  store: e,
@@ -990,12 +990,12 @@ function Nr() {
990
990
  };
991
991
  }
992
992
  function kn() {
993
- const e = le(xn);
993
+ const e = le(En);
994
994
  return (e == null ? void 0 : e.provided) == null ? [!1, e] : [!0, e];
995
995
  }
996
- function Er({ children: e, context: n }) {
996
+ function xr({ children: e, context: n }) {
997
997
  const [t] = kn();
998
- return t ? /* @__PURE__ */ a(Re, { children: e }) : /* @__PURE__ */ a(xn.Provider, { value: n, children: e });
998
+ return t ? /* @__PURE__ */ a(Re, { children: e }) : /* @__PURE__ */ a(En.Provider, { value: n, children: e });
999
999
  }
1000
1000
  const Ds = ({
1001
1001
  sheetName: e,
@@ -1006,38 +1006,38 @@ const Ds = ({
1006
1006
  editingOnEnter: i,
1007
1007
  mode: l
1008
1008
  }) => {
1009
- const { store: f, dispatch: h } = le(ae), { sheetReactive: c } = f, d = c.current;
1010
- Z(() => {
1009
+ const { store: h, dispatch: f } = le(ae), { sheetReactive: c } = h, d = c.current;
1010
+ K(() => {
1011
1011
  d && e && e !== d.name && (d.name = e, d.registry.sheetIdsByName[e] = d.id, delete d.registry.sheetIdsByName[d.prevName], d.prevName = e);
1012
- }, [e]), Z(() => {
1012
+ }, [e]), K(() => {
1013
1013
  if (!d)
1014
1014
  return;
1015
1015
  const { registry: g } = d;
1016
- requestAnimationFrame(() => g.boot()), g.contextsBySheetId[d.id] = { store: f, dispatch: h }, g.transmit(), s && (s.current = {
1016
+ requestAnimationFrame(() => g.boot()), g.contextsBySheetId[d.id] = { store: h, dispatch: f }, g.transmit(), s && (s.current = {
1017
1017
  sheet: d,
1018
1018
  apply: (m) => {
1019
- h(ze(m));
1019
+ f(Ue(m));
1020
1020
  }
1021
1021
  }), o && (o.current = {
1022
- store: f,
1022
+ store: h,
1023
1023
  apply: (m) => {
1024
- h(Ne(m));
1024
+ f(Ne(m));
1025
1025
  },
1026
- dispatch: h
1026
+ dispatch: f
1027
1027
  });
1028
- }, [f, d, s, o]), Z(() => {
1029
- n && h(Ne({ sheetHeight: n }));
1030
- }, [n, h]), Z(() => {
1031
- t && h(Ne({ sheetWidth: t }));
1032
- }, [t]), Z(() => {
1033
- typeof i < "u" && h(Ne({ editingOnEnter: i }));
1034
- }, [i]), Z(() => {
1035
- l && h(Ne({ mode: l }));
1028
+ }, [h, d, s, o]), K(() => {
1029
+ n && f(Ne({ sheetHeight: n }));
1030
+ }, [n, f]), K(() => {
1031
+ t && f(Ne({ sheetWidth: t }));
1032
+ }, [t]), K(() => {
1033
+ typeof i < "u" && f(Ne({ editingOnEnter: i }));
1034
+ }, [i]), K(() => {
1035
+ l && f(Ne({ mode: l }));
1036
1036
  }, [l]);
1037
1037
  const [b, y] = kn();
1038
- return Z(() => {
1039
- b && (y.setStore(f), y.setApply(() => h));
1040
- }, [f, b, y]), /* @__PURE__ */ a(Re, {});
1038
+ return K(() => {
1039
+ b && (y.setStore(h), y.setApply(() => f));
1040
+ }, [h, b, y]), /* @__PURE__ */ a(Re, {});
1041
1041
  }, Is = () => {
1042
1042
  const { store: e, dispatch: n } = le(ae), {
1043
1043
  resizingPositionY: t,
@@ -1045,55 +1045,55 @@ const Ds = ({
1045
1045
  sheetReactive: o,
1046
1046
  leftHeaderSelecting: i,
1047
1047
  topHeaderSelecting: l,
1048
- selectingZone: f,
1049
- editorRef: h,
1048
+ selectingZone: h,
1049
+ editorRef: f,
1050
1050
  mainRef: c
1051
- } = e, d = o.current, [b, y, g] = t, [m, p, A] = s;
1052
- if (c.current == null || h.current == null || !d)
1051
+ } = e, d = o.current, [b, y, g] = t, [m, p, M] = s;
1052
+ if (c.current == null || f.current == null || !d)
1053
1053
  return /* @__PURE__ */ a("div", { className: "gs-resizing gs-hidden" });
1054
- const x = d.getCell({ y: b === -1 ? 0 : b, x: m === -1 ? 0 : m }, { resolution: "SYSTEM" }), { y: F, x: T } = c.current.getBoundingClientRect(), S = (x == null ? void 0 : x.width) || vt, M = (x == null ? void 0 : x.height) || bt, $ = S + (A - p), P = M + (g - y);
1054
+ const E = d.getCell({ y: b === -1 ? 0 : b, x: m === -1 ? 0 : m }, { resolution: "SYSTEM" }), { y: F, x: T } = c.current.getBoundingClientRect(), S = (E == null ? void 0 : E.width) || vt, D = (E == null ? void 0 : E.height) || bt, $ = S + (M - p), P = D + (g - y);
1055
1055
  return /* @__PURE__ */ Y(
1056
1056
  "div",
1057
1057
  {
1058
1058
  className: `gs-resizing ${b === -1 && m === -1 ? "gs-hidden" : ""}`,
1059
1059
  onMouseUp: () => {
1060
- const r = ge(f), { top: u, left: v, bottom: N, right: I } = r, R = {};
1060
+ const r = he(h), { top: u, left: v, bottom: N, right: A } = r, R = {};
1061
1061
  if (m !== -1) {
1062
1062
  let H = [m];
1063
- l && Ae({ start: v, end: I }, m) && (H = Xt(v, I + 1)), H.forEach((G) => {
1064
- R[Ee({ y: 0, x: G })] = { width: $ };
1063
+ l && Ae({ start: v, end: A }, m) && (H = Xt(v, A + 1)), H.forEach((q) => {
1064
+ R[xe({ y: 0, x: q })] = { width: $ };
1065
1065
  });
1066
1066
  }
1067
1067
  if (b !== -1) {
1068
1068
  let H = [b];
1069
- i && Ae({ start: u, end: N }, b) && (H = Xt(u, N + 1)), H.forEach((G) => {
1070
- R[Ee({ y: G, x: 0 })] = { height: P };
1069
+ i && Ae({ start: u, end: N }, b) && (H = Xt(u, N + 1)), H.forEach((q) => {
1070
+ R[xe({ y: q, x: 0 })] = { height: P };
1071
1071
  });
1072
1072
  }
1073
1073
  d.update({
1074
1074
  diff: R,
1075
1075
  partial: !0,
1076
1076
  operator: "USER",
1077
- undoReflection: { selectingZone: f, sheetId: d.id }
1077
+ undoReflection: { selectingZone: h, sheetId: d.id }
1078
1078
  }), n(
1079
1079
  Ne({
1080
1080
  sheetReactive: { current: d }
1081
1081
  })
1082
- ), n(ft([-1, -1, -1])), n(ht([-1, -1, -1])), O(h.current);
1082
+ ), n(ht([-1, -1, -1])), n(ft([-1, -1, -1])), O(f.current);
1083
1083
  },
1084
1084
  onMouseMove: (r) => {
1085
1085
  if (b !== -1) {
1086
1086
  let u = r.clientY;
1087
- const v = M + (u - y);
1088
- v < Ht && (u += Ht - v), n(ft([b, y, u]));
1087
+ const v = D + (u - y);
1088
+ v < Ht && (u += Ht - v), n(ht([b, y, u]));
1089
1089
  } else if (m !== -1) {
1090
1090
  let u = r.clientX;
1091
1091
  const v = S + (u - p);
1092
- v < Ot && (u += Ot - v), n(ht([m, p, u]));
1092
+ v < Ot && (u += Ot - v), n(ft([m, p, u]));
1093
1093
  }
1094
1094
  },
1095
1095
  children: [
1096
- /* @__PURE__ */ a("div", { className: `gs-line-vertical ${m === -1 ? "gs-hidden" : ""}`, children: /* @__PURE__ */ a("div", { className: "gs-line", style: { width: 1, height: "100%", left: A - T }, children: /* @__PURE__ */ Y("span", { style: { left: "-50%" }, children: [
1096
+ /* @__PURE__ */ a("div", { className: `gs-line-vertical ${m === -1 ? "gs-hidden" : ""}`, children: /* @__PURE__ */ a("div", { className: "gs-line", style: { width: 1, height: "100%", left: M - T }, children: /* @__PURE__ */ Y("span", { style: { left: "-50%" }, children: [
1097
1097
  $,
1098
1098
  "px"
1099
1099
  ] }) }) }),
@@ -1106,7 +1106,7 @@ const Ds = ({
1106
1106
  );
1107
1107
  }, Fs = () => {
1108
1108
  const { store: e } = le(ae), { choosing: n, selectingZone: t, sheetReactive: s } = e, o = s.current;
1109
- return Z(() => {
1109
+ return K(() => {
1110
1110
  o != null && o.isInitialized && o.currentVersion > 0 && o.registry.onChange && o.registry.onChange({
1111
1111
  sheet: o,
1112
1112
  points: {
@@ -1115,7 +1115,7 @@ const Ds = ({
1115
1115
  selectingTo: { y: t.endY, x: t.endX }
1116
1116
  }
1117
1117
  });
1118
- }, [s]), Z(() => {
1118
+ }, [s]), K(() => {
1119
1119
  o && o.registry.onSelect && o.registry.onSelect({
1120
1120
  sheet: o,
1121
1121
  points: {
@@ -1135,15 +1135,15 @@ const Ds = ({
1135
1135
  const { editorRef: s } = e, o = await navigator.clipboard.read();
1136
1136
  let i = [];
1137
1137
  for (let l = 0; l < o.length; l++) {
1138
- const f = o[l];
1139
- if (f.types.indexOf("text/html") !== -1) {
1140
- const c = await (await f.getType("text/html")).text();
1138
+ const h = o[l];
1139
+ if (h.types.indexOf("text/html") !== -1) {
1140
+ const c = await (await h.getType("text/html")).text();
1141
1141
  if (c) {
1142
1142
  i = Sn(c, t);
1143
1143
  break;
1144
1144
  }
1145
- } else if (f.types.indexOf("text/plain") !== -1) {
1146
- const c = await (await f.getType("text/plain")).text();
1145
+ } else if (h.types.indexOf("text/plain") !== -1) {
1146
+ const c = await (await h.getType("text/plain")).text();
1147
1147
  if (c) {
1148
1148
  i = Nn(c);
1149
1149
  break;
@@ -1158,23 +1158,23 @@ const Ds = ({
1158
1158
  const { editorRef: t } = e;
1159
1159
  n(ut(null)), O(t.current);
1160
1160
  }, Ys = async ({ store: e, dispatch: n }) => {
1161
- const { selectingZone: t, editorRef: s } = e, { top: o } = ge(t), i = ne(t).rows;
1161
+ const { selectingZone: t, editorRef: s } = e, { top: o } = he(t), i = se(t).rows;
1162
1162
  n(vn({ numRows: i, y: o, operator: "USER" })), O(s.current);
1163
1163
  }, $s = async ({ store: e, dispatch: n }) => {
1164
- const { selectingZone: t, editorRef: s } = e, { bottom: o } = ge(t), i = ne(t).rows;
1164
+ const { selectingZone: t, editorRef: s } = e, { bottom: o } = he(t), i = se(t).rows;
1165
1165
  n(yn({ numRows: i, y: o, operator: "USER" })), O(s.current);
1166
1166
  }, Ps = async ({ store: e, dispatch: n }) => {
1167
- const { selectingZone: t, editorRef: s } = e, { left: o } = ge(t), i = ne(t).cols;
1167
+ const { selectingZone: t, editorRef: s } = e, { left: o } = he(t), i = se(t).cols;
1168
1168
  n(pn({ numCols: i, x: o, operator: "USER" })), O(s.current);
1169
1169
  }, Xs = async ({ store: e, dispatch: n }) => {
1170
- const { selectingZone: t, editorRef: s } = e, { right: o } = ge(t), i = ne(t).cols;
1170
+ const { selectingZone: t, editorRef: s } = e, { right: o } = he(t), i = se(t).cols;
1171
1171
  n(mn({ numCols: i, x: o, operator: "USER" })), O(s.current);
1172
1172
  }, Hs = async ({ store: e, dispatch: n }) => {
1173
- const { selectingZone: t, editorRef: s } = e, { top: o } = ge(t), i = ne(t).rows;
1174
- n(hn({ numRows: i, y: o, operator: "USER" })), O(s.current);
1173
+ const { selectingZone: t, editorRef: s } = e, { top: o } = he(t), i = se(t).rows;
1174
+ n(fn({ numRows: i, y: o, operator: "USER" })), O(s.current);
1175
1175
  }, Os = async ({ store: e, dispatch: n }) => {
1176
- const { selectingZone: t, editorRef: s } = e, { left: o } = ge(t), i = ne(t).cols;
1177
- n(fn({ numCols: i, x: o, operator: "USER" })), O(s.current);
1176
+ const { selectingZone: t, editorRef: s } = e, { left: o } = he(t), i = se(t).cols;
1177
+ n(hn({ numCols: i, x: o, operator: "USER" })), O(s.current);
1178
1178
  }, Fn = async ({ store: e, dispatch: n }, t) => {
1179
1179
  const s = e.sheetReactive.current;
1180
1180
  s && (s.hasPendingCells() || s.registry.asyncPending.size > 0) && await s.waitForPending(), n(Ct({ x: t, direction: "asc" })), O(e.editorRef.current);
@@ -1190,17 +1190,17 @@ const Ds = ({
1190
1190
  const s = e.sheetReactive.current;
1191
1191
  if (!s)
1192
1192
  return;
1193
- const o = Ee({ y: t, x: 0 }), i = s.getCell({ y: t, x: 0 }, { resolution: "SYSTEM" }), l = !(i != null && i.sortFixed) || void 0;
1194
- s.update({ diff: { [o]: { sortFixed: l } }, partial: !0 }), n(ze(s)), O(e.editorRef.current);
1193
+ const o = xe({ y: t, x: 0 }), i = s.getCell({ y: t, x: 0 }, { resolution: "SYSTEM" }), l = !(i != null && i.sortFixed) || void 0;
1194
+ s.update({ diff: { [o]: { sortFixed: l } }, partial: !0 }), n(Ue(s)), O(e.editorRef.current);
1195
1195
  }, Xn = ({ store: e, dispatch: n }, t) => {
1196
1196
  const s = e.sheetReactive.current;
1197
1197
  if (!s)
1198
1198
  return;
1199
- const o = Ee({ y: t, x: 0 }), i = s.getCell({ y: t, x: 0 }, { resolution: "SYSTEM" }), l = !(i != null && i.filterFixed) || void 0;
1200
- s.update({ diff: { [o]: { filterFixed: l } }, partial: !0 }), n(ze(s)), O(e.editorRef.current);
1199
+ const o = xe({ y: t, x: 0 }), i = s.getCell({ y: t, x: 0 }, { resolution: "SYSTEM" }), l = !(i != null && i.filterFixed) || void 0;
1200
+ s.update({ diff: { [o]: { filterFixed: l } }, partial: !0 }), n(Ue(s)), O(e.editorRef.current);
1201
1201
  }, Hn = async ({ store: e, dispatch: n }) => {
1202
1202
  typeof e.searchQuery > "u" && n(Pe("")), n(dn(!1)), requestAnimationFrame(() => O(e.searchInputRef.current));
1203
- }, xr = {
1203
+ }, Er = {
1204
1204
  copy: Tn,
1205
1205
  cut: An,
1206
1206
  paste: Mn,
@@ -1254,80 +1254,80 @@ const Ds = ({
1254
1254
  {
1255
1255
  id: "insert-rows-above",
1256
1256
  label: (e) => {
1257
- const n = ne(e.selectingZone).rows;
1257
+ const n = se(e.selectingZone).rows;
1258
1258
  return `Insert ${n} row${n > 1 ? "s" : ""} above`;
1259
1259
  },
1260
1260
  visible: (e) => e.leftHeaderSelecting,
1261
1261
  disabled: (e) => {
1262
- const n = ne(e.selectingZone).rows, t = e.sheet, s = t.getCell({ y: e.choosing.y, x: 0 }, { resolution: "SYSTEM" });
1262
+ const n = se(e.selectingZone).rows, t = e.sheet, s = t.getCell({ y: e.choosing.y, x: 0 }, { resolution: "SYSTEM" });
1263
1263
  return t.maxNumRows !== -1 && t.numRows + n > t.maxNumRows || X.hasOperation(s == null ? void 0 : s.prevention, X.InsertRowsAbove);
1264
1264
  },
1265
- onClick: (e) => e.insertRowsAbove(e.choosing.y, ne(e.selectingZone).rows)
1265
+ onClick: (e) => e.insertRowsAbove(e.choosing.y, se(e.selectingZone).rows)
1266
1266
  },
1267
1267
  {
1268
1268
  id: "insert-rows-below",
1269
1269
  label: (e) => {
1270
- const n = ne(e.selectingZone).rows;
1270
+ const n = se(e.selectingZone).rows;
1271
1271
  return `Insert ${n} row${n > 1 ? "s" : ""} below`;
1272
1272
  },
1273
1273
  visible: (e) => e.leftHeaderSelecting,
1274
1274
  disabled: (e) => {
1275
- const n = ne(e.selectingZone).rows, t = e.sheet, s = t.getCell({ y: e.choosing.y, x: 0 }, { resolution: "SYSTEM" });
1275
+ const n = se(e.selectingZone).rows, t = e.sheet, s = t.getCell({ y: e.choosing.y, x: 0 }, { resolution: "SYSTEM" });
1276
1276
  return t.maxNumRows !== -1 && t.numRows + n > t.maxNumRows || X.hasOperation(s == null ? void 0 : s.prevention, X.InsertRowsBelow);
1277
1277
  },
1278
- onClick: (e) => e.insertRowsBelow(e.choosing.y, ne(e.selectingZone).rows)
1278
+ onClick: (e) => e.insertRowsBelow(e.choosing.y, se(e.selectingZone).rows)
1279
1279
  },
1280
1280
  {
1281
1281
  id: "insert-cols-left",
1282
1282
  label: (e) => {
1283
- const n = ne(e.selectingZone).cols;
1283
+ const n = se(e.selectingZone).cols;
1284
1284
  return `Insert ${n} column${n > 1 ? "s" : ""} left`;
1285
1285
  },
1286
1286
  visible: (e) => e.topHeaderSelecting,
1287
1287
  disabled: (e) => {
1288
- const n = ne(e.selectingZone).cols, t = e.sheet, s = t.getCell({ y: 0, x: e.choosing.x }, { resolution: "SYSTEM" });
1288
+ const n = se(e.selectingZone).cols, t = e.sheet, s = t.getCell({ y: 0, x: e.choosing.x }, { resolution: "SYSTEM" });
1289
1289
  return t.maxNumCols !== -1 && t.numCols + n > t.maxNumCols || X.hasOperation(s == null ? void 0 : s.prevention, X.InsertColsLeft);
1290
1290
  },
1291
- onClick: (e) => e.insertColsLeft(e.choosing.x, ne(e.selectingZone).cols)
1291
+ onClick: (e) => e.insertColsLeft(e.choosing.x, se(e.selectingZone).cols)
1292
1292
  },
1293
1293
  {
1294
1294
  id: "insert-cols-right",
1295
1295
  label: (e) => {
1296
- const n = ne(e.selectingZone).cols;
1296
+ const n = se(e.selectingZone).cols;
1297
1297
  return `Insert ${n} column${n > 1 ? "s" : ""} right`;
1298
1298
  },
1299
1299
  visible: (e) => e.topHeaderSelecting,
1300
1300
  disabled: (e) => {
1301
- const n = ne(e.selectingZone).cols, t = e.sheet, s = t.getCell({ y: 0, x: e.choosing.x }, { resolution: "SYSTEM" });
1301
+ const n = se(e.selectingZone).cols, t = e.sheet, s = t.getCell({ y: 0, x: e.choosing.x }, { resolution: "SYSTEM" });
1302
1302
  return t.maxNumCols !== -1 && t.numCols + n > t.maxNumCols || X.hasOperation(s == null ? void 0 : s.prevention, X.InsertColsRight);
1303
1303
  },
1304
- onClick: (e) => e.insertColsRight(e.choosing.x, ne(e.selectingZone).cols)
1304
+ onClick: (e) => e.insertColsRight(e.choosing.x, se(e.selectingZone).cols)
1305
1305
  },
1306
1306
  {
1307
1307
  id: "remove-rows",
1308
1308
  label: (e) => {
1309
- const n = ne(e.selectingZone).rows;
1309
+ const n = se(e.selectingZone).rows;
1310
1310
  return `Remove ${n} row${n > 1 ? "s" : ""}`;
1311
1311
  },
1312
1312
  visible: (e) => e.leftHeaderSelecting,
1313
1313
  disabled: (e) => {
1314
- const n = ne(e.selectingZone).rows, t = e.sheet, s = t.getCell({ y: e.choosing.y, x: 0 }, { resolution: "SYSTEM" });
1314
+ const n = se(e.selectingZone).rows, t = e.sheet, s = t.getCell({ y: e.choosing.y, x: 0 }, { resolution: "SYSTEM" });
1315
1315
  return t.minNumRows !== -1 && t.numRows - n < t.minNumRows || X.hasOperation(s == null ? void 0 : s.prevention, X.RemoveRows);
1316
1316
  },
1317
- onClick: (e) => e.removeRows(e.choosing.y, ne(e.selectingZone).rows)
1317
+ onClick: (e) => e.removeRows(e.choosing.y, se(e.selectingZone).rows)
1318
1318
  },
1319
1319
  {
1320
1320
  id: "remove-cols",
1321
1321
  label: (e) => {
1322
- const n = ne(e.selectingZone).cols;
1322
+ const n = se(e.selectingZone).cols;
1323
1323
  return `Remove ${n} column${n > 1 ? "s" : ""}`;
1324
1324
  },
1325
1325
  visible: (e) => e.topHeaderSelecting,
1326
1326
  disabled: (e) => {
1327
- const n = ne(e.selectingZone).cols, t = e.sheet, s = t.getCell({ y: 0, x: e.choosing.x }, { resolution: "SYSTEM" });
1327
+ const n = se(e.selectingZone).cols, t = e.sheet, s = t.getCell({ y: 0, x: e.choosing.x }, { resolution: "SYSTEM" });
1328
1328
  return t.minNumCols !== -1 && t.numCols - n < t.minNumCols || X.hasOperation(s == null ? void 0 : s.prevention, X.RemoveCols);
1329
1329
  },
1330
- onClick: (e) => e.removeCols(e.choosing.x, ne(e.selectingZone).cols)
1330
+ onClick: (e) => e.removeCols(e.choosing.x, se(e.selectingZone).cols)
1331
1331
  },
1332
1332
  { type: "divider" },
1333
1333
  {
@@ -1515,7 +1515,7 @@ const Ds = ({
1515
1515
  { type: "divider" },
1516
1516
  { type: "component", componentId: "col-label" }
1517
1517
  ];
1518
- function Et(e, n, t) {
1518
+ function xt(e, n, t) {
1519
1519
  const s = { store: e, dispatch: n }, o = e.sheetReactive.current;
1520
1520
  return {
1521
1521
  sheet: o,
@@ -1535,7 +1535,7 @@ function Et(e, n, t) {
1535
1535
  n(yn({ numRows: l, y: i, operator: "USER" }));
1536
1536
  },
1537
1537
  removeRows: (i, l) => {
1538
- n(hn({ numRows: l, y: i, operator: "USER" }));
1538
+ n(fn({ numRows: l, y: i, operator: "USER" }));
1539
1539
  },
1540
1540
  insertColsLeft: (i, l) => {
1541
1541
  n(pn({ numCols: l, x: i, operator: "USER" }));
@@ -1544,7 +1544,7 @@ function Et(e, n, t) {
1544
1544
  n(mn({ numCols: l, x: i, operator: "USER" }));
1545
1545
  },
1546
1546
  removeCols: (i, l) => {
1547
- n(fn({ numCols: l, x: i, operator: "USER" }));
1547
+ n(hn({ numCols: l, x: i, operator: "USER" }));
1548
1548
  },
1549
1549
  sortRows: async (i, l) => {
1550
1550
  l === "asc" ? await Fn(s, i) : await Yn(s, i);
@@ -1559,9 +1559,9 @@ function Et(e, n, t) {
1559
1559
  updateColLabel: (i, l) => {
1560
1560
  if (!o)
1561
1561
  return;
1562
- const f = Ee({ y: 0, x: i });
1562
+ const h = xe({ y: 0, x: i });
1563
1563
  o.update({
1564
- diff: { [f]: { label: l || void 0 } },
1564
+ diff: { [h]: { label: l || void 0 } },
1565
1565
  partial: !0,
1566
1566
  undoReflection: {
1567
1567
  sheetId: o.id,
@@ -1579,10 +1579,10 @@ function Et(e, n, t) {
1579
1579
  };
1580
1580
  }
1581
1581
  const On = /* @__PURE__ */ new Map();
1582
- function xt(e, n) {
1582
+ function Et(e, n) {
1583
1583
  On.set(e, n);
1584
1584
  }
1585
- function Zs(e) {
1585
+ function Ws(e) {
1586
1586
  return On.get(e);
1587
1587
  }
1588
1588
  const kt = ({
@@ -1594,7 +1594,7 @@ const kt = ({
1594
1594
  onClick: i,
1595
1595
  className: l
1596
1596
  }) => {
1597
- const f = s !== void 0;
1597
+ const h = s !== void 0;
1598
1598
  return /* @__PURE__ */ Y(
1599
1599
  "li",
1600
1600
  {
@@ -1602,13 +1602,13 @@ const kt = ({
1602
1602
  "data-testid": o,
1603
1603
  onClick: t ? void 0 : i,
1604
1604
  children: [
1605
- /* @__PURE__ */ Y("div", { className: `gs-menu-name${f ? " gs-row-fixed-toggle" : ""}`, children: [
1606
- f && /* @__PURE__ */ a("span", { className: `gs-row-fixed-check${s ? " gs-row-fixed-active" : ""}`, children: "✓" }),
1605
+ /* @__PURE__ */ Y("div", { className: `gs-menu-name${h ? " gs-row-fixed-toggle" : ""}`, children: [
1606
+ h && /* @__PURE__ */ a("span", { className: `gs-row-fixed-check${s ? " gs-row-fixed-active" : ""}`, children: "✓" }),
1607
1607
  e
1608
1608
  ] }),
1609
- n != null && n.length > 0 && /* @__PURE__ */ a("div", { className: "gs-menu-shortcut", children: n.map((h, c) => /* @__PURE__ */ Y("span", { children: [
1609
+ n != null && n.length > 0 && /* @__PURE__ */ a("div", { className: "gs-menu-shortcut", children: n.map((f, c) => /* @__PURE__ */ Y("span", { children: [
1610
1610
  c > 0 && /* @__PURE__ */ a("span", { className: "gs-menu-shortcut-sep", children: ", " }),
1611
- /* @__PURE__ */ a("span", { className: "gs-menu-shortcut-badge", children: h.split("+").map(
1611
+ /* @__PURE__ */ a("span", { className: "gs-menu-shortcut-badge", children: f.split("+").map(
1612
1612
  (d, b, y) => b < y.length - 1 ? /* @__PURE__ */ Y("span", { children: [
1613
1613
  d,
1614
1614
  "+"
@@ -1618,25 +1618,25 @@ const kt = ({
1618
1618
  ]
1619
1619
  }
1620
1620
  );
1621
- }, Tt = () => /* @__PURE__ */ a("li", { className: "gs-menu-divider" }), Us = () => {
1622
- const { store: e, dispatch: n } = le(ae), { contextMenuPosition: t, contextMenu: s } = e, { y: o, x: i } = t, l = se(null);
1623
- if (Z(() => {
1621
+ }, Tt = () => /* @__PURE__ */ a("li", { className: "gs-menu-divider" }), Zs = () => {
1622
+ const { store: e, dispatch: n } = le(ae), { contextMenuPosition: t, contextMenu: s } = e, { y: o, x: i } = t, l = re(null);
1623
+ if (K(() => {
1624
1624
  l.current && en(l.current);
1625
1625
  }), o === -1)
1626
1626
  return null;
1627
- const f = () => n(We({ y: -1, x: -1 })), h = Et(e, n, f);
1627
+ const h = () => n(ze({ y: -1, x: -1 })), f = xt(e, n, h);
1628
1628
  return /* @__PURE__ */ a(
1629
1629
  rt,
1630
1630
  {
1631
1631
  className: "gs-menu-modal gs-context-menu-modal",
1632
- onClick: (c) => (c.preventDefault(), f(), !1),
1632
+ onClick: (c) => (c.preventDefault(), h(), !1),
1633
1633
  children: /* @__PURE__ */ a("div", { ref: l, className: "gs-context-menu", style: { top: o, left: i }, children: /* @__PURE__ */ a("ul", { className: "gs-menu-items", children: s.map((c, d) => {
1634
- var A, x;
1634
+ var M, E;
1635
1635
  if (c.type === "divider")
1636
- return c.visible && !c.visible(h) ? null : /* @__PURE__ */ a(Tt, {}, d);
1637
- if (c.type === "component" || !(!c.visible || c.visible(h)))
1636
+ return c.visible && !c.visible(f) ? null : /* @__PURE__ */ a(Tt, {}, d);
1637
+ if (c.type === "component" || !(!c.visible || c.visible(f)))
1638
1638
  return null;
1639
- const y = ((A = c.disabled) == null ? void 0 : A.call(c, h)) ?? !1, g = typeof c.label == "function" ? c.label(h) : c.label, m = typeof c.shortcuts == "function" ? c.shortcuts(h) : c.shortcuts, p = (x = c.checked) == null ? void 0 : x.call(c, h);
1639
+ const y = ((M = c.disabled) == null ? void 0 : M.call(c, f)) ?? !1, g = typeof c.label == "function" ? c.label(f) : c.label, m = typeof c.shortcuts == "function" ? c.shortcuts(f) : c.shortcuts, p = (E = c.checked) == null ? void 0 : E.call(c, f);
1640
1640
  return /* @__PURE__ */ a(
1641
1641
  kt,
1642
1642
  {
@@ -1645,7 +1645,7 @@ const kt = ({
1645
1645
  disabled: y,
1646
1646
  checked: p,
1647
1647
  testId: c.id ? `${c.id}-item` : void 0,
1648
- onClick: () => c.onClick(h)
1648
+ onClick: () => c.onClick(f)
1649
1649
  },
1650
1650
  d
1651
1651
  );
@@ -1663,64 +1663,64 @@ const kt = ({
1663
1663
  nonblank: "Nonblank",
1664
1664
  includes: "Includes",
1665
1665
  excludes: "Excludes"
1666
- }, Gt = ["blank", "nonblank"], Ve = { method: "eq", value: [""] }, zs = ({ x: e, close: n, onWaiting: t }) => {
1667
- const { store: s, dispatch: o } = le(ae), { sheetReactive: i } = s, l = i.current, [f, h] = J([{ ...Ve }]), [c, d] = J("or"), [b, y] = J(null), g = k(
1666
+ }, Gt = ["blank", "nonblank"], Ve = { method: "eq", value: [""] }, Us = ({ x: e, close: n, onWaiting: t }) => {
1667
+ const { store: s, dispatch: o } = le(ae), { sheetReactive: i } = s, l = i.current, [h, f] = ee([{ ...Ve }]), [c, d] = ee("or"), [b, y] = ee(null), g = k(
1668
1668
  (C) => {
1669
1669
  C && C.focus();
1670
1670
  },
1671
1671
  // eslint-disable-next-line react-hooks/exhaustive-deps
1672
1672
  [e]
1673
1673
  );
1674
- Z(() => {
1674
+ K(() => {
1675
1675
  if (l) {
1676
- const C = l.getCell({ y: 0, x: e }, { resolution: "SYSTEM" }), D = C == null ? void 0 : C.filter;
1677
- D && D.conditions.length > 0 ? (h(D.conditions.map((r) => ({ ...r, value: [...r.value] }))), d(D.mode || "or")) : (h([{ ...Ve, value: [""] }]), d("or"));
1676
+ const C = l.getCell({ y: 0, x: e }, { resolution: "SYSTEM" }), I = C == null ? void 0 : C.filter;
1677
+ I && I.conditions.length > 0 ? (f(I.conditions.map((r) => ({ ...r, value: [...r.value] }))), d(I.mode || "or")) : (f([{ ...Ve, value: [""] }]), d("or"));
1678
1678
  }
1679
1679
  }, [e, l]);
1680
1680
  const m = k(() => {
1681
1681
  y(null), t == null || t(null), n();
1682
1682
  }, [n, t]);
1683
- Z(() => {
1683
+ K(() => {
1684
1684
  b && (t == null || t("Filtering…", m));
1685
- }, [b]), Z(() => {
1685
+ }, [b]), K(() => {
1686
1686
  if (!b)
1687
1687
  return;
1688
1688
  let C = !1;
1689
- const D = () => {
1689
+ const I = () => {
1690
1690
  if (C || !i.current)
1691
1691
  return;
1692
- const { x: v, conditions: N, mode: I } = b;
1693
- N.length > 0 ? o(Ye({ x: v, filter: { mode: I, conditions: N } })) : o(Ye({ x: v })), t == null || t(null), y(null), n();
1692
+ const { x: v, conditions: N, mode: A } = b;
1693
+ N.length > 0 ? o(Ye({ x: v, filter: { mode: A, conditions: N } })) : o(Ye({ x: v })), t == null || t(null), y(null), n();
1694
1694
  }, r = i.current;
1695
- return r && (r.hasPendingCells() || r.registry.asyncPending.size > 0) ? r.waitForPending().then(D) : D(), () => {
1695
+ return r && (r.hasPendingCells() || r.registry.asyncPending.size > 0) ? r.waitForPending().then(I) : I(), () => {
1696
1696
  C = !0;
1697
1697
  };
1698
1698
  }, [b]);
1699
- const p = k((C, D) => {
1700
- h((r) => {
1699
+ const p = k((C, I) => {
1700
+ f((r) => {
1701
1701
  const u = [...r];
1702
- return u[C] = { ...u[C], ...D }, u;
1702
+ return u[C] = { ...u[C], ...I }, u;
1703
1703
  });
1704
- }, []), A = k(() => {
1705
- h((C) => [...C, { ...Ve, value: [""] }]);
1706
- }, []), x = k((C) => {
1707
- h((D) => D.length <= 1 ? [{ ...Ve, value: [""] }] : D.filter((r, u) => u !== C));
1704
+ }, []), M = k(() => {
1705
+ f((C) => [...C, { ...Ve, value: [""] }]);
1706
+ }, []), E = k((C) => {
1707
+ f((I) => I.length <= 1 ? [{ ...Ve, value: [""] }] : I.filter((r, u) => u !== C));
1708
1708
  }, []), F = k(() => {
1709
- const C = f.filter((D) => Gt.includes(D.method) ? !0 : D.value.some((r) => r.trim() !== ""));
1709
+ const C = h.filter((I) => Gt.includes(I.method) ? !0 : I.value.some((r) => r.trim() !== ""));
1710
1710
  y({ x: e, conditions: C, mode: c });
1711
- }, [e, f, c]), T = k(() => {
1711
+ }, [e, h, c]), T = k(() => {
1712
1712
  y(null), o(Ye({ x: e })), n();
1713
1713
  }, [o, e, n]), S = k(() => {
1714
1714
  y(null), o(Ye({})), n();
1715
1715
  }, [o, n]);
1716
1716
  if (!l)
1717
1717
  return null;
1718
- const M = l.getCell({ y: 0, x: e }, { resolution: "SYSTEM" }), $ = X.hasOperation(M == null ? void 0 : M.prevention, X.Filter), P = l.hasActiveFilters();
1718
+ const D = l.getCell({ y: 0, x: e }, { resolution: "SYSTEM" }), $ = X.hasOperation(D == null ? void 0 : D.prevention, X.Filter), P = l.hasActiveFilters();
1719
1719
  return /* @__PURE__ */ a("li", { className: `gs-column-menu-filter${$ ? " gs-disabled" : ""}`, children: /* @__PURE__ */ Y(Re, { children: [
1720
1720
  /* @__PURE__ */ Y("div", { className: "gs-filter-header", children: [
1721
1721
  /* @__PURE__ */ a("div", { className: "gs-menu-name", children: "Filter:" }),
1722
- /* @__PURE__ */ a("button", { className: "gs-filter-add-btn", onClick: A, disabled: $, children: "+ ADD" }),
1723
- /* @__PURE__ */ Y("div", { className: `gs-filter-mode-toggle${f.length <= 1 ? " gs-disabled" : ""}`, children: [
1722
+ /* @__PURE__ */ a("button", { className: "gs-filter-add-btn", onClick: M, disabled: $, children: "+ ADD" }),
1723
+ /* @__PURE__ */ Y("div", { className: `gs-filter-mode-toggle${h.length <= 1 ? " gs-disabled" : ""}`, children: [
1724
1724
  /* @__PURE__ */ Y("label", { className: c === "and" ? "gs-active" : "", children: [
1725
1725
  /* @__PURE__ */ a(
1726
1726
  "input",
@@ -1729,7 +1729,7 @@ const kt = ({
1729
1729
  name: "gs-filter-mode",
1730
1730
  checked: c === "and",
1731
1731
  onChange: () => d("and"),
1732
- disabled: $ || f.length <= 1
1732
+ disabled: $ || h.length <= 1
1733
1733
  }
1734
1734
  ),
1735
1735
  "AND"
@@ -1742,36 +1742,36 @@ const kt = ({
1742
1742
  name: "gs-filter-mode",
1743
1743
  checked: c === "or",
1744
1744
  onChange: () => d("or"),
1745
- disabled: $ || f.length <= 1
1745
+ disabled: $ || h.length <= 1
1746
1746
  }
1747
1747
  ),
1748
1748
  "OR"
1749
1749
  ] })
1750
1750
  ] })
1751
1751
  ] }),
1752
- /* @__PURE__ */ a("div", { className: "gs-filter-conditions", children: f.map((C, D) => /* @__PURE__ */ Y("div", { className: "gs-filter-condition-row", children: [
1752
+ /* @__PURE__ */ a("div", { className: "gs-filter-conditions", children: h.map((C, I) => /* @__PURE__ */ Y("div", { className: "gs-filter-condition-row", children: [
1753
1753
  /* @__PURE__ */ a(
1754
1754
  "select",
1755
1755
  {
1756
1756
  className: "gs-filter-method-select",
1757
1757
  value: C.method,
1758
1758
  disabled: $,
1759
- tabIndex: D * 2 + 1,
1760
- onChange: (r) => p(D, { method: r.target.value }),
1759
+ tabIndex: I * 2 + 1,
1760
+ onChange: (r) => p(I, { method: r.target.value }),
1761
1761
  children: Object.keys(qt).map((r) => /* @__PURE__ */ a("option", { value: r, children: qt[r] }, r))
1762
1762
  }
1763
1763
  ),
1764
1764
  !Gt.includes(C.method) && /* @__PURE__ */ a(
1765
1765
  "input",
1766
1766
  {
1767
- ref: D === 0 ? g : void 0,
1767
+ ref: I === 0 ? g : void 0,
1768
1768
  className: "gs-filter-value-input",
1769
1769
  type: "text",
1770
1770
  placeholder: "Value",
1771
1771
  value: C.value[0] || "",
1772
1772
  disabled: $,
1773
- tabIndex: D * 2 + 2,
1774
- onChange: (r) => p(D, { value: [r.target.value] }),
1773
+ tabIndex: I * 2 + 2,
1774
+ onChange: (r) => p(I, { value: [r.target.value] }),
1775
1775
  onKeyDown: (r) => {
1776
1776
  r.nativeEvent.isComposing || (r.key === "Enter" && F(), r.key === "Escape" && n());
1777
1777
  }
@@ -1781,40 +1781,40 @@ const kt = ({
1781
1781
  "button",
1782
1782
  {
1783
1783
  className: "gs-filter-remove-btn",
1784
- onClick: () => x(D),
1784
+ onClick: () => E(I),
1785
1785
  disabled: $,
1786
1786
  title: "Remove condition",
1787
1787
  children: "✕"
1788
1788
  }
1789
1789
  )
1790
- ] }, D)) }),
1790
+ ] }, I)) }),
1791
1791
  /* @__PURE__ */ Y("div", { className: "gs-filter-actions", children: [
1792
1792
  P && /* @__PURE__ */ a("button", { className: "gs-filter-reset-all-btn", onClick: S, children: "RESET ALL" }),
1793
1793
  /* @__PURE__ */ Y("div", { className: "gs-filter-actions-right", children: [
1794
- (M == null ? void 0 : M.filter) && /* @__PURE__ */ a("button", { className: "gs-filter-reset-btn", onClick: T, children: "RESET" }),
1794
+ (D == null ? void 0 : D.filter) && /* @__PURE__ */ a("button", { className: "gs-filter-reset-btn", onClick: T, children: "RESET" }),
1795
1795
  /* @__PURE__ */ a("button", { className: "gs-filter-apply-btn", onClick: F, disabled: $, children: "APPLY" })
1796
1796
  ] })
1797
1797
  ] })
1798
1798
  ] }) });
1799
1799
  };
1800
- xt("col-filter", zs);
1801
- const Ws = ({ x: e, close: n, onWaiting: t }) => {
1802
- const { store: s, dispatch: o } = le(ae), { sheetReactive: i } = s, l = i.current, [f, h] = J(null), c = k(() => {
1803
- h(null), t == null || t(null), n();
1800
+ Et("col-filter", Us);
1801
+ const zs = ({ x: e, close: n, onWaiting: t }) => {
1802
+ const { store: s, dispatch: o } = le(ae), { sheetReactive: i } = s, l = i.current, [h, f] = ee(null), c = k(() => {
1803
+ f(null), t == null || t(null), n();
1804
1804
  }, [n, t]);
1805
- if (Z(() => {
1806
- f && (t == null || t("Sorting…", c));
1807
- }, [f]), Z(() => {
1808
- if (!f)
1805
+ if (K(() => {
1806
+ h && (t == null || t("Sorting…", c));
1807
+ }, [h]), K(() => {
1808
+ if (!h)
1809
1809
  return;
1810
1810
  let y = !1;
1811
1811
  const g = () => {
1812
- y || !i.current || (o(Ct({ x: f.x, direction: f.direction })), t == null || t(null), h(null), n());
1812
+ y || !i.current || (o(Ct({ x: h.x, direction: h.direction })), t == null || t(null), f(null), n());
1813
1813
  }, m = i.current;
1814
1814
  return m && (m.hasPendingCells() || m.registry.asyncPending.size > 0) ? m.waitForPending().then(g) : g(), () => {
1815
1815
  y = !0;
1816
1816
  };
1817
- }, [f]), !l)
1817
+ }, [h]), !l)
1818
1818
  return null;
1819
1819
  const d = l.getCell({ y: 0, x: e }, { resolution: "SYSTEM" }), b = X.hasOperation(d == null ? void 0 : d.prevention, X.Sort);
1820
1820
  return /* @__PURE__ */ Y("li", { className: `gs-menu-item gs-column-menu-sort${b ? " gs-disabled" : ""}`, children: [
@@ -1825,7 +1825,7 @@ const Ws = ({ x: e, close: n, onWaiting: t }) => {
1825
1825
  {
1826
1826
  className: "gs-sort-btn gs-sort-btn-asc",
1827
1827
  onClick: (y) => {
1828
- y.stopPropagation(), b || h({ x: e, direction: "asc" });
1828
+ y.stopPropagation(), b || f({ x: e, direction: "asc" });
1829
1829
  },
1830
1830
  disabled: b,
1831
1831
  children: "↓ A to Z"
@@ -1836,7 +1836,7 @@ const Ws = ({ x: e, close: n, onWaiting: t }) => {
1836
1836
  {
1837
1837
  className: "gs-sort-btn gs-sort-btn-desc",
1838
1838
  onClick: (y) => {
1839
- y.stopPropagation(), b || h({ x: e, direction: "desc" });
1839
+ y.stopPropagation(), b || f({ x: e, direction: "desc" });
1840
1840
  },
1841
1841
  disabled: b,
1842
1842
  children: "↑ Z to A"
@@ -1845,21 +1845,21 @@ const Ws = ({ x: e, close: n, onWaiting: t }) => {
1845
1845
  ] })
1846
1846
  ] });
1847
1847
  };
1848
- xt("col-sort", Ws);
1848
+ Et("col-sort", zs);
1849
1849
  const _s = ({ x: e, close: n }) => {
1850
- const { store: t, dispatch: s } = le(ae), { sheetReactive: o } = t, i = o.current, l = se(null), [f, h] = J("");
1851
- Z(() => {
1850
+ const { store: t, dispatch: s } = le(ae), { sheetReactive: o } = t, i = o.current, l = re(null), [h, f] = ee("");
1851
+ K(() => {
1852
1852
  if (i) {
1853
1853
  const g = i.getCell({ y: 0, x: e }, { resolution: "SYSTEM" });
1854
- h((g == null ? void 0 : g.label) ?? "");
1854
+ f((g == null ? void 0 : g.label) ?? "");
1855
1855
  }
1856
1856
  }, [e, i]);
1857
1857
  const c = k(() => {
1858
1858
  if (!i)
1859
1859
  return;
1860
- const g = Ee({ y: 0, x: e });
1860
+ const g = xe({ y: 0, x: e });
1861
1861
  i.update({
1862
- diff: { [g]: { label: f || void 0 } },
1862
+ diff: { [g]: { label: h || void 0 } },
1863
1863
  partial: !0,
1864
1864
  ignoreFields: [],
1865
1865
  undoReflection: {
@@ -1873,7 +1873,7 @@ const _s = ({ x: e, close: n }) => {
1873
1873
  choosing: t.choosing
1874
1874
  }
1875
1875
  }), s(Ne({ sheetReactive: { current: i } })), n();
1876
- }, [s, e, f, n, i, t.selectingZone, t.choosing]);
1876
+ }, [s, e, h, n, i, t.selectingZone, t.choosing]);
1877
1877
  if (!i)
1878
1878
  return null;
1879
1879
  const d = i.getCell({ y: 0, x: e }, { resolution: "SYSTEM" }), b = X.hasOperation(d == null ? void 0 : d.prevention, X.SetLabel), y = wt(i, d == null ? void 0 : d.label, { y: 0, x: e }, e) ?? pe(e);
@@ -1886,9 +1886,9 @@ const _s = ({ x: e, close: n }) => {
1886
1886
  className: "gs-label-input",
1887
1887
  type: "text",
1888
1888
  placeholder: y,
1889
- value: f,
1889
+ value: h,
1890
1890
  disabled: b,
1891
- onChange: (g) => h(g.target.value),
1891
+ onChange: (g) => f(g.target.value),
1892
1892
  onKeyDown: (g) => {
1893
1893
  g.nativeEvent.isComposing || (g.key === "Enter" && c(), g.key === "Escape" && n());
1894
1894
  }
@@ -1897,9 +1897,9 @@ const _s = ({ x: e, close: n }) => {
1897
1897
  /* @__PURE__ */ a("button", { className: "gs-label-apply-btn", onClick: c, disabled: b, children: "UPDATE" })
1898
1898
  ] }) });
1899
1899
  };
1900
- xt("col-label", _s);
1900
+ Et("col-label", _s);
1901
1901
  const js = () => {
1902
- const { store: e, dispatch: n } = le(ae), { columnMenuState: t, editorRef: s, colMenu: o } = e, i = e.sheetReactive.current, l = t == null ? void 0 : t.x, f = t == null ? void 0 : t.position, [h, c] = J(null), d = k(() => {
1902
+ const { store: e, dispatch: n } = le(ae), { columnMenuState: t, editorRef: s, colMenu: o } = e, i = e.sheetReactive.current, l = t == null ? void 0 : t.x, h = t == null ? void 0 : t.position, [f, c] = ee(null), d = k(() => {
1903
1903
  n(et(null)), O(s.current);
1904
1904
  }, [n, s]), b = k(
1905
1905
  (g, m) => {
@@ -1907,40 +1907,40 @@ const js = () => {
1907
1907
  },
1908
1908
  [d]
1909
1909
  );
1910
- if (!t || !i || l == null || !f)
1910
+ if (!t || !i || l == null || !h)
1911
1911
  return null;
1912
- const y = Et(e, n, d);
1912
+ const y = xt(e, n, d);
1913
1913
  return /* @__PURE__ */ Y(
1914
1914
  rt,
1915
1915
  {
1916
1916
  className: "gs-menu-modal gs-column-menu-modal",
1917
- onClick: (g) => (g.preventDefault(), h || d(), !1),
1917
+ onClick: (g) => (g.preventDefault(), f || d(), !1),
1918
1918
  children: [
1919
1919
  /* @__PURE__ */ a(
1920
1920
  "div",
1921
1921
  {
1922
1922
  className: "gs-column-menu",
1923
- style: { top: f.y, left: f.x, display: h ? "none" : void 0 },
1923
+ style: { top: h.y, left: h.x, display: f ? "none" : void 0 },
1924
1924
  onClick: (g) => g.stopPropagation(),
1925
1925
  children: /* @__PURE__ */ a("ul", { className: "gs-menu-items", children: o.map((g, m) => {
1926
1926
  var T;
1927
1927
  if (g.type === "component") {
1928
1928
  if (!(!g.visible || g.visible(y, l)))
1929
1929
  return null;
1930
- const M = Zs(g.componentId);
1931
- return M ? /* @__PURE__ */ a(M, { x: l, close: d, onWaiting: b }, m) : null;
1930
+ const D = Ws(g.componentId);
1931
+ return D ? /* @__PURE__ */ a(D, { x: l, close: d, onWaiting: b }, m) : null;
1932
1932
  }
1933
1933
  if (g.type === "divider")
1934
1934
  return g.visible && !g.visible(y) ? null : /* @__PURE__ */ a(Tt, {}, m);
1935
1935
  if (!(!g.visible || g.visible(y, l)))
1936
1936
  return null;
1937
- const A = ((T = g.disabled) == null ? void 0 : T.call(g, y, l)) ?? !1, x = typeof g.label == "function" ? g.label(y, l) : g.label, F = typeof g.shortcuts == "function" ? g.shortcuts(y, l) : g.shortcuts;
1937
+ const M = ((T = g.disabled) == null ? void 0 : T.call(g, y, l)) ?? !1, E = typeof g.label == "function" ? g.label(y, l) : g.label, F = typeof g.shortcuts == "function" ? g.shortcuts(y, l) : g.shortcuts;
1938
1938
  return /* @__PURE__ */ a(
1939
1939
  kt,
1940
1940
  {
1941
- label: x,
1941
+ label: E,
1942
1942
  shortcuts: F,
1943
- disabled: A,
1943
+ disabled: M,
1944
1944
  testId: g.id ? `${g.id}-item` : void 0,
1945
1945
  onClick: () => {
1946
1946
  g.onClick(y, l), n(et(null));
@@ -1951,16 +1951,16 @@ const js = () => {
1951
1951
  }) })
1952
1952
  }
1953
1953
  ),
1954
- h && /* @__PURE__ */ Y(
1954
+ f && /* @__PURE__ */ Y(
1955
1955
  "div",
1956
1956
  {
1957
1957
  className: "gs-column-menu gs-column-menu-waiting",
1958
- style: { top: f.y, left: f.x },
1958
+ style: { top: h.y, left: h.x },
1959
1959
  onClick: (g) => g.stopPropagation(),
1960
1960
  children: [
1961
- /* @__PURE__ */ a("div", { className: "gs-waiting-message", children: h.message }),
1961
+ /* @__PURE__ */ a("div", { className: "gs-waiting-message", children: f.message }),
1962
1962
  /* @__PURE__ */ a("div", { className: "gs-waiting-spinner" }),
1963
- /* @__PURE__ */ a("button", { className: "gs-waiting-cancel-btn", onClick: h.cancel, children: "CANCEL" })
1963
+ /* @__PURE__ */ a("button", { className: "gs-waiting-cancel-btn", onClick: f.cancel, children: "CANCEL" })
1964
1964
  ]
1965
1965
  }
1966
1966
  )
@@ -1974,12 +1974,12 @@ function Vs(e, n, t, s, o) {
1974
1974
  return /* @__PURE__ */ a(Tt, {}, s);
1975
1975
  if (e.type === "component" || !(!e.visible || e.visible(n, t)))
1976
1976
  return null;
1977
- const l = ((d = e.disabled) == null ? void 0 : d.call(e, n, t)) ?? !1, f = typeof e.label == "function" ? e.label(n, t) : e.label, h = typeof e.shortcuts == "function" ? e.shortcuts(n, t) : e.shortcuts, c = e.checked != null ? e.checked(n, t) : void 0;
1977
+ const l = ((d = e.disabled) == null ? void 0 : d.call(e, n, t)) ?? !1, h = typeof e.label == "function" ? e.label(n, t) : e.label, f = typeof e.shortcuts == "function" ? e.shortcuts(n, t) : e.shortcuts, c = e.checked != null ? e.checked(n, t) : void 0;
1978
1978
  return /* @__PURE__ */ a(
1979
1979
  kt,
1980
1980
  {
1981
- label: f,
1982
- shortcuts: h,
1981
+ label: h,
1982
+ shortcuts: f,
1983
1983
  disabled: l,
1984
1984
  checked: c,
1985
1985
  testId: e.id ? `${e.id}-item` : void 0,
@@ -1991,18 +1991,18 @@ function Vs(e, n, t, s, o) {
1991
1991
  );
1992
1992
  }
1993
1993
  const qs = () => {
1994
- const { store: e, dispatch: n } = le(ae), { rowMenuState: t, sheetReactive: s, editorRef: o, rowMenu: i } = e, l = s.current, f = t == null ? void 0 : t.y, h = t == null ? void 0 : t.position, c = () => {
1994
+ const { store: e, dispatch: n } = le(ae), { rowMenuState: t, sheetReactive: s, editorRef: o, rowMenu: i } = e, l = s.current, h = t == null ? void 0 : t.y, f = t == null ? void 0 : t.position, c = () => {
1995
1995
  n(mt(null)), O(o.current);
1996
1996
  };
1997
- if (!t || !l || f == null || !h)
1997
+ if (!t || !l || h == null || !f)
1998
1998
  return null;
1999
- const d = Et(e, n, c);
1999
+ const d = xt(e, n, c);
2000
2000
  return /* @__PURE__ */ a(
2001
2001
  rt,
2002
2002
  {
2003
2003
  className: "gs-menu-modal gs-row-menu-modal",
2004
2004
  onClick: (b) => (b.preventDefault(), c(), !1),
2005
- children: /* @__PURE__ */ a("div", { className: "gs-row-menu", style: { top: h.y, left: h.x }, onClick: (b) => b.stopPropagation(), children: /* @__PURE__ */ a("ul", { className: "gs-menu-items", children: i.map((b, y) => Vs(b, d, f, y, c)) }) })
2005
+ children: /* @__PURE__ */ a("div", { className: "gs-row-menu", style: { top: f.y, left: f.x }, onClick: (b) => b.stopPropagation(), children: /* @__PURE__ */ a("ul", { className: "gs-menu-items", children: i.map((b, y) => Vs(b, d, h, y, c)) }) })
2006
2006
  }
2007
2007
  );
2008
2008
  }, He = (e) => {
@@ -2013,23 +2013,23 @@ const qs = () => {
2013
2013
  return !!(n.buttons & 1) && n.button === 0;
2014
2014
  }
2015
2015
  return !1;
2016
- }, he = (e) => {
2016
+ }, fe = (e) => {
2017
2017
  e.type.startsWith("touch") || e.preventDefault();
2018
2018
  }, Gs = nt(({ y: e, x: n }) => {
2019
- var oe;
2020
- const t = be(e), o = `${pe(n)}${t}`, { store: i, dispatch: l } = le(ae), f = se(!0), h = se(null), [c, d] = J(null), {
2019
+ var Q;
2020
+ const t = be(e), o = `${pe(n)}${t}`, { store: i, dispatch: l } = le(ae), h = re(!0), f = re(null), [c, d] = ee(null), {
2021
2021
  sheetReactive: b,
2022
2022
  editingAddress: y,
2023
2023
  choosing: g,
2024
2024
  selectingZone: m,
2025
2025
  leftHeaderSelecting: p,
2026
- topHeaderSelecting: A,
2027
- editorRef: x,
2026
+ topHeaderSelecting: M,
2027
+ editorRef: E,
2028
2028
  autofillDraggingTo: F,
2029
2029
  contextMenu: T
2030
- } = i, S = b.current, M = st(i), $ = S == null ? void 0 : S.registry.lastFocused, P = ge(m), C = y === o, D = g.y === e && g.x === n, r = k(() => {
2031
- var V;
2032
- const w = (V = h.current) == null ? void 0 : V.getBoundingClientRect();
2030
+ } = i, S = b.current, D = st(i), $ = S == null ? void 0 : S.registry.lastFocused, P = he(m), C = y === o, I = g.y === e && g.x === n, r = k(() => {
2031
+ var z;
2032
+ const w = (z = f.current) == null ? void 0 : z.getBoundingClientRect();
2033
2033
  if (w == null)
2034
2034
  return null;
2035
2035
  l(
@@ -2041,16 +2041,16 @@ const qs = () => {
2041
2041
  })
2042
2042
  );
2043
2043
  }, [l]);
2044
- Z(() => {
2045
- if (D && !f.current) {
2044
+ K(() => {
2045
+ if (I && !h.current) {
2046
2046
  r();
2047
2047
  return;
2048
2048
  }
2049
- f.current = !1;
2050
- }, [D, C, r]);
2049
+ h.current = !1;
2050
+ }, [I, C, r]);
2051
2051
  const u = S == null ? void 0 : S.getCell({ y: e, x: n }, { resolution: "SYSTEM" }), v = k(
2052
2052
  (w) => {
2053
- l(Ue({ value: w }));
2053
+ l(Ze({ value: w }));
2054
2054
  },
2055
2055
  [l]
2056
2056
  ), N = k(
@@ -2059,102 +2059,102 @@ const qs = () => {
2059
2059
  },
2060
2060
  [l]
2061
2061
  );
2062
- let I = "", R;
2062
+ let A = "", R;
2063
2063
  try {
2064
2064
  S && (R = S.render({ sheet: S, point: { y: e, x: n }, apply: N, value: void 0 }));
2065
2065
  } catch (w) {
2066
- es.is(w) ? (I = w.message, R = w.code) : (I = w.message, R = "#UNKNOWN");
2066
+ es.is(w) ? (A = w.message, R = w.code) : (A = w.message, R = "#UNKNOWN");
2067
2067
  }
2068
- const [, H] = (S == null ? void 0 : S.getSolvedCache({ y: e, x: n })) ?? [void 0, void 0], G = ts.is(H), _ = x.current, re = !!(S != null && S.registry.editingAddress || y), ce = k(
2068
+ const [, H] = (S == null ? void 0 : S.getSolvedCache({ y: e, x: n })) ?? [void 0, void 0], q = ts.is(H), _ = E.current, oe = !!(S != null && S.registry.editingAddress || y), ce = k(
2069
2069
  (w) => {
2070
- if (w.stopPropagation(), he(w), !S || !He(w) || !_)
2070
+ if (w.stopPropagation(), fe(w), !S || !He(w) || !_)
2071
2071
  return !1;
2072
2072
  if (w.type.startsWith("touch"))
2073
- return re && _ && _.blur(), l(Xe({ y: e, x: n })), l(we({ startY: e, startX: n, endY: e, endX: n })), !0;
2073
+ return oe && _ && _.blur(), l(Xe({ y: e, x: n })), l(we({ startY: e, startX: n, endY: e, endX: n })), !0;
2074
2074
  w.shiftKey ? l(me({ y: e, x: n })) : l(we({ startY: e, startX: n, endY: -1, endX: -1 })), l(ke(!0));
2075
- const V = `${S.sheetPrefix(!M)}${o}`;
2076
- return re && De({ input: $ || null, ref: V }) || (S.registry.lastFocused = _, O(_), l(ue("")), F) ? !1 : (re && v(_.value), w.shiftKey || l(Xe({ y: e, x: n })), !0);
2075
+ const z = `${S.sheetPrefix(!D)}${o}`;
2076
+ return oe && De({ input: $ || null, ref: z }) || (S.registry.lastFocused = _, O(_), l(de("")), F) ? !1 : (oe && v(_.value), w.shiftKey || l(Xe({ y: e, x: n })), !0);
2077
2077
  },
2078
- [re, _, o, M, $, F, v, S]
2078
+ [oe, _, o, D, $, F, v, S]
2079
2079
  ), B = k(
2080
2080
  (w) => {
2081
2081
  if (w.stopPropagation(), !w.type.startsWith("touch")) {
2082
- if (he(w), l(ke(!1)), F)
2082
+ if (fe(w), l(ke(!1)), F)
2083
2083
  return l(bn(F)), O(_), !1;
2084
- re && l(me({ y: -1, x: -1 }));
2084
+ oe && l(me({ y: -1, x: -1 }));
2085
2085
  }
2086
2086
  },
2087
- [F, re, _]
2088
- ), z = k(
2087
+ [F, oe, _]
2088
+ ), U = k(
2089
2089
  (w) => {
2090
2090
  if (!He(w) || w.type.startsWith("touch") || !S)
2091
2091
  return !1;
2092
- if (he(w), w.stopPropagation(), F)
2093
- return l(Ze({ x: n, y: e })), !1;
2092
+ if (fe(w), w.stopPropagation(), F)
2093
+ return l(We({ x: n, y: e })), !1;
2094
2094
  if (p)
2095
2095
  return l(me({ y: e, x: S.numCols })), !1;
2096
- if (A)
2096
+ if (M)
2097
2097
  return l(me({ y: S.numRows, x: n })), !1;
2098
- if (re && !sn($ || null))
2098
+ if (oe && !sn($ || null))
2099
2099
  return !1;
2100
- if (l(me({ y: e, x: n })), re) {
2101
- const V = ge({ ...m, endY: e, endX: n }), fe = `${S.sheetPrefix(!M)}${rn(V)}`;
2102
- De({ input: $ || null, ref: fe });
2100
+ if (l(me({ y: e, x: n })), oe) {
2101
+ const z = he({ ...m, endY: e, endX: n }), ue = `${S.sheetPrefix(!D)}${rn(z)}`;
2102
+ De({ input: $ || null, ref: ue });
2103
2103
  }
2104
2104
  return !0;
2105
2105
  },
2106
2106
  [
2107
2107
  F,
2108
2108
  p,
2109
- A,
2109
+ M,
2110
2110
  S,
2111
- re,
2111
+ oe,
2112
2112
  $,
2113
2113
  m,
2114
- M
2114
+ D
2115
2115
  ]
2116
- ), U = k(
2116
+ ), W = k(
2117
2117
  (w) => {
2118
- l(Ze({ x: n, y: e })), l(ke(!0)), w.stopPropagation();
2118
+ l(We({ x: n, y: e })), l(ke(!0)), w.stopPropagation();
2119
2119
  },
2120
2120
  [l, n, e]
2121
- ), K = k(() => {
2122
- var V;
2123
- const w = (V = h.current) == null ? void 0 : V.getBoundingClientRect();
2121
+ ), J = k(() => {
2122
+ var z;
2123
+ const w = (z = f.current) == null ? void 0 : z.getBoundingClientRect();
2124
2124
  w && d(ns(w));
2125
- }, []), W = k(() => {
2125
+ }, []), j = k(() => {
2126
2126
  d(null);
2127
- }, []), Q = k(
2128
- (w) => T.length > 0 ? (w.stopPropagation(), he(w), l(We({ y: w.clientY, x: w.clientX })), !1) : !0,
2127
+ }, []), Z = k(
2128
+ (w) => T.length > 0 ? (w.stopPropagation(), fe(w), l(ze({ y: w.clientY, x: w.clientX })), !1) : !0,
2129
2129
  [T.length]
2130
- ), j = k(
2130
+ ), G = k(
2131
2131
  (w) => {
2132
- w.stopPropagation(), he(w), ue(o);
2133
- const V = document.createEvent("MouseEvents");
2134
- return V.initEvent("dblclick", !0, !0), _ == null || _.dispatchEvent(V), !1;
2132
+ w.stopPropagation(), fe(w), de(o);
2133
+ const z = document.createEvent("MouseEvents");
2134
+ return z.initEvent("dblclick", !0, !0), _ == null || _.dispatchEvent(z), !1;
2135
2135
  },
2136
2136
  [o, _]
2137
- ), L = $e(() => !C && D && P.bottom === -1 || P.bottom === e && P.right === n ? "gs-autofill-drag" : "gs-autofill-drag gs-hidden", [C, D, P]);
2137
+ ), L = $e(() => !C && I && P.bottom === -1 || P.bottom === e && P.right === n ? "gs-autofill-drag" : "gs-autofill-drag gs-hidden", [C, I, P]);
2138
2138
  return S ? _ ? /* @__PURE__ */ a(
2139
2139
  "td",
2140
2140
  {
2141
- ref: h,
2141
+ ref: f,
2142
2142
  "data-x": n,
2143
2143
  "data-y": e,
2144
2144
  "data-address": o,
2145
- className: `gs-cell ${rs(P, { y: e, x: n }) ? "gs-selecting" : ""} ${D ? "gs-choosing" : ""} ${C ? "gs-editing" : ""} ${G ? "gs-pending" : ""}`,
2145
+ className: `gs-cell ${rs(P, { y: e, x: n }) ? "gs-selecting" : ""} ${I ? "gs-choosing" : ""} ${C ? "gs-editing" : ""} ${q ? "gs-pending" : ""}`,
2146
2146
  style: {
2147
2147
  ...u == null ? void 0 : u.style
2148
2148
  },
2149
- onContextMenu: Q,
2150
- onDoubleClick: j,
2149
+ onContextMenu: Z,
2150
+ onDoubleClick: G,
2151
2151
  children: /* @__PURE__ */ Y(
2152
2152
  "div",
2153
2153
  {
2154
2154
  className: "gs-cell-inner-wrap",
2155
2155
  onMouseDown: ce,
2156
2156
  onTouchStart: ce,
2157
- onMouseEnter: z,
2157
+ onMouseEnter: U,
2158
2158
  onMouseUp: B,
2159
2159
  children: [
2160
2160
  /* @__PURE__ */ Y(
@@ -2163,16 +2163,16 @@ const qs = () => {
2163
2163
  className: "gs-cell-inner",
2164
2164
  style: {
2165
2165
  ...u == null ? void 0 : u.style,
2166
- textAlign: ((oe = u == null ? void 0 : u.style) == null ? void 0 : oe.textAlign) || (u == null ? void 0 : u.justifyContent) || "left",
2166
+ textAlign: ((Q = u == null ? void 0 : u.style) == null ? void 0 : Q.textAlign) || (u == null ? void 0 : u.justifyContent) || "left",
2167
2167
  alignItems: (u == null ? void 0 : u.alignItems) || "start"
2168
2168
  },
2169
2169
  children: [
2170
- I && /* @__PURE__ */ a(
2170
+ A && /* @__PURE__ */ a(
2171
2171
  "div",
2172
2172
  {
2173
2173
  className: "gs-formula-error-triangle",
2174
- onMouseEnter: K,
2175
- onMouseLeave: W
2174
+ onMouseEnter: J,
2175
+ onMouseLeave: j
2176
2176
  }
2177
2177
  ),
2178
2178
  /* @__PURE__ */ a(
@@ -2190,7 +2190,7 @@ const qs = () => {
2190
2190
  ]
2191
2191
  }
2192
2192
  ),
2193
- I && c && /* @__PURE__ */ a(
2193
+ A && c && /* @__PURE__ */ a(
2194
2194
  "div",
2195
2195
  {
2196
2196
  className: "gs-formula-error-tooltip",
@@ -2199,10 +2199,10 @@ const qs = () => {
2199
2199
  left: c.x,
2200
2200
  transform: ss(c.hAlign)
2201
2201
  },
2202
- children: I
2202
+ children: A
2203
2203
  }
2204
2204
  ),
2205
- /* @__PURE__ */ a("div", { className: L, onMouseDown: U })
2205
+ /* @__PURE__ */ a("div", { className: L, onMouseDown: W })
2206
2206
  ]
2207
2207
  }
2208
2208
  )
@@ -2215,9 +2215,9 @@ const qs = () => {
2215
2215
  }), Qs = 0.4, Js = 200;
2216
2216
  let Qt = (/* @__PURE__ */ new Date()).getTime(), Ke = 0;
2217
2217
  function Te({ style: e, horizontal: n = 0, vertical: t = 0, className: s = "" }) {
2218
- const o = se(null), { store: i, dispatch: l } = le(ae), {
2219
- tabularRef: f,
2220
- autofillDraggingTo: h,
2218
+ const o = re(null), { store: i, dispatch: l } = le(ae), {
2219
+ tabularRef: h,
2220
+ autofillDraggingTo: f,
2221
2221
  dragging: c,
2222
2222
  selectingZone: d,
2223
2223
  editorRef: b,
@@ -2225,89 +2225,89 @@ function Te({ style: e, horizontal: n = 0, vertical: t = 0, className: s = "" })
2225
2225
  searchInputRef: g,
2226
2226
  editingAddress: m
2227
2227
  } = i, p = y.current;
2228
- let A = !1;
2229
- const x = st(i), F = !!(p != null && p.registry.editingAddress || m), T = k(
2228
+ let M = !1;
2229
+ const E = st(i), F = !!(p != null && p.registry.editingAddress || m), T = k(
2230
2230
  (r) => {
2231
2231
  if (!p)
2232
2232
  return { x: -1, y: -1 };
2233
2233
  if (n == 0 && t == 0) {
2234
- const I = f.current.getBoundingClientRect(), { left: R, top: H, right: G, bottom: _ } = I;
2235
- n = r.pageX > G ? 1 : r.pageX < R ? -1 : 0, n === 0 && (t = r.pageY > _ ? 1 : r.pageY < H ? -1 : 0);
2234
+ const A = h.current.getBoundingClientRect(), { left: R, top: H, right: q, bottom: _ } = A;
2235
+ n = r.pageX > q ? 1 : r.pageX < R ? -1 : 0, n === 0 && (t = r.pageY > _ ? 1 : r.pageY < H ? -1 : 0);
2236
2236
  }
2237
- const u = Lt(f.current);
2237
+ const u = Lt(h.current);
2238
2238
  let { endX: v, endY: N } = d;
2239
2239
  return n ? v = n > 0 ? u.right : u.left : t && (N = t > 0 ? u.bottom : u.top), { x: v, y: N };
2240
2240
  },
2241
2241
  [p, n, t, d]
2242
2242
  ), S = k(
2243
2243
  (r) => {
2244
- if (!A || f.current === null || !p)
2244
+ if (!M || h.current === null || !p)
2245
2245
  return;
2246
2246
  const u = (/* @__PURE__ */ new Date()).getTime();
2247
- u - Qt > 1e3 && (Ke = 0), Qt = u, f.current.scrollBy({
2247
+ u - Qt > 1e3 && (Ke = 0), Qt = u, h.current.scrollBy({
2248
2248
  left: Ke * n,
2249
2249
  top: Ke * t
2250
2250
  }), O(b.current);
2251
2251
  const { x: v, y: N } = T(r);
2252
- if (h) {
2253
- const { y: I, x: R } = h;
2254
- l(Ze({ y: N === -1 ? I : N, x: v === -1 ? R : v }));
2252
+ if (f) {
2253
+ const { y: A, x: R } = f;
2254
+ l(We({ y: N === -1 ? A : N, x: v === -1 ? R : v }));
2255
2255
  } else {
2256
2256
  if (F) {
2257
- const I = ge({ ...d, endY: N, endX: v }), R = p.sheetPrefix(!x), H = rn(I), G = `${R}${H}`;
2258
- De({ input: b.current, ref: G });
2257
+ const A = he({ ...d, endY: N, endX: v }), R = p.sheetPrefix(!E), H = rn(A), q = `${R}${H}`;
2258
+ De({ input: b.current, ref: q });
2259
2259
  }
2260
2260
  l(me({ y: N, x: v }));
2261
2261
  }
2262
2262
  Ke = Math.min(Ke + Qs, Js), o.current = requestAnimationFrame(() => S(r));
2263
2263
  },
2264
2264
  [
2265
- A,
2265
+ M,
2266
2266
  p,
2267
2267
  n,
2268
2268
  t,
2269
- h,
2269
+ f,
2270
2270
  F,
2271
2271
  d,
2272
- x,
2272
+ E,
2273
2273
  T
2274
2274
  ]
2275
- ), M = k(
2275
+ ), D = k(
2276
2276
  (r) => {
2277
- if (r.preventDefault(), r.stopPropagation(), !A) {
2278
- if (A = !0, n === 0 || t === 0) {
2279
- const u = f.current.getBoundingClientRect(), { left: v, top: N, right: I, bottom: R } = u;
2280
- n || (n = r.pageX > I ? 1 : r.pageX < v ? -1 : 0), n === 0 && (t || (t = r.pageY > R ? 1 : r.pageY < N ? -1 : 0));
2277
+ if (r.preventDefault(), r.stopPropagation(), !M) {
2278
+ if (M = !0, n === 0 || t === 0) {
2279
+ const u = h.current.getBoundingClientRect(), { left: v, top: N, right: A, bottom: R } = u;
2280
+ n || (n = r.pageX > A ? 1 : r.pageX < v ? -1 : 0), n === 0 && (t || (t = r.pageY > R ? 1 : r.pageY < N ? -1 : 0));
2281
2281
  }
2282
2282
  o.current = requestAnimationFrame(() => S(r));
2283
2283
  }
2284
2284
  },
2285
- [A, n, t, S]
2285
+ [M, n, t, S]
2286
2286
  ), $ = k(() => {
2287
- o.current !== null && (cancelAnimationFrame(o.current), o.current = null), A = !1, os(g.current) || O(b.current);
2287
+ o.current !== null && (cancelAnimationFrame(o.current), o.current = null), M = !1, os(g.current) || O(b.current);
2288
2288
  }, []), P = k(
2289
2289
  (r) => {
2290
2290
  r.preventDefault(), r.stopPropagation();
2291
- const u = Lt(f.current);
2291
+ const u = Lt(h.current);
2292
2292
  if (u.bottom === -1 || u.right === -1)
2293
2293
  return;
2294
2294
  const { x: v, y: N } = T(r);
2295
- if (h) {
2296
- const { y: I, x: R } = h;
2297
- l(bn({ y: N === -1 ? I : N, x: v === -1 ? R : v })), O(b.current);
2295
+ if (f) {
2296
+ const { y: A, x: R } = f;
2297
+ l(bn({ y: N === -1 ? A : N, x: v === -1 ? R : v })), O(b.current);
2298
2298
  } else
2299
2299
  F && l(me({ y: -1, x: -1 }));
2300
2300
  },
2301
- [h, F, T]
2301
+ [f, F, T]
2302
2302
  ), C = k(
2303
2303
  (r) => {
2304
2304
  $(), l(ke(!1)), requestAnimationFrame(() => P(r));
2305
2305
  },
2306
2306
  [$, P]
2307
- ), D = k(() => {
2307
+ ), I = k(() => {
2308
2308
  $();
2309
2309
  }, [$]);
2310
- return Z(() => $, [$]), !b.current || !c && !h ? /* @__PURE__ */ a("div", { className: `gs-scroll-handle gs-hidden ${s}` }) : /* @__PURE__ */ a(
2310
+ return K(() => $, [$]), !b.current || !c && !f ? /* @__PURE__ */ a("div", { className: `gs-scroll-handle gs-hidden ${s}` }) : /* @__PURE__ */ a(
2311
2311
  "div",
2312
2312
  {
2313
2313
  style: e,
@@ -2315,8 +2315,8 @@ function Te({ style: e, horizontal: n = 0, vertical: t = 0, className: s = "" })
2315
2315
  onMouseUp: (r) => {
2316
2316
  C(r);
2317
2317
  },
2318
- onMouseEnter: M,
2319
- onMouseLeave: D
2318
+ onMouseEnter: D,
2319
+ onMouseLeave: I
2320
2320
  }
2321
2321
  );
2322
2322
  }
@@ -2325,23 +2325,23 @@ const er = nt(({ x: e }) => {
2325
2325
  sheetReactive: o,
2326
2326
  editingAddress: i,
2327
2327
  choosing: l,
2328
- selectingZone: f,
2329
- topHeaderSelecting: h,
2328
+ selectingZone: h,
2329
+ topHeaderSelecting: f,
2330
2330
  editorRef: c,
2331
2331
  autofillDraggingTo: d,
2332
2332
  dragging: b,
2333
2333
  contextMenu: y,
2334
2334
  columnMenuState: g
2335
- } = t, m = o.current, p = m == null ? void 0 : m.getCell({ y: 0, x: e }, { resolution: "SYSTEM" }), A = (p == null ? void 0 : p.width) || vt, x = !!(p != null && p.filter && p.filter.conditions.length > 0), F = st(t), T = m == null ? void 0 : m.registry.lastFocused, S = !!(m != null && m.registry.editingAddress || i), M = k(
2335
+ } = t, m = o.current, p = m == null ? void 0 : m.getCell({ y: 0, x: e }, { resolution: "SYSTEM" }), M = (p == null ? void 0 : p.width) || vt, E = !!(p != null && p.filter && p.filter.conditions.length > 0), F = st(t), T = m == null ? void 0 : m.registry.lastFocused, S = !!(m != null && m.registry.editingAddress || i), D = k(
2336
2336
  (r) => {
2337
- s(Ue({ value: r, point: l }));
2337
+ s(Ze({ value: r, point: l }));
2338
2338
  },
2339
2339
  [l]
2340
2340
  ), $ = k((r) => {
2341
- s(ht([e, r.clientX, r.clientX])), r.stopPropagation(), he(r);
2341
+ s(ft([e, r.clientX, r.clientX])), r.stopPropagation(), fe(r);
2342
2342
  }, []), P = k(
2343
2343
  (r) => {
2344
- if (r.stopPropagation(), he(r), !He(r) || !m || b)
2344
+ if (r.stopPropagation(), fe(r), !He(r) || !m || b)
2345
2345
  return !1;
2346
2346
  if (r.type.startsWith("touch"))
2347
2347
  return S && c.current && c.current.blur(), s(Xe({ y: 1, x: e })), s(we({ startY: 1, startX: e, endY: m.numRows, endX: e })), !0;
@@ -2349,13 +2349,13 @@ const er = nt(({ x: e }) => {
2349
2349
  const u = `${m.sheetPrefix(!F)}${n}:${n}`;
2350
2350
  if (S && De({ input: T || null, ref: u }))
2351
2351
  return s(we({ startY: m.numRows, startX: e, endY: 0, endX: e })), !1;
2352
- let v = r.shiftKey ? f.startX : e;
2352
+ let v = r.shiftKey ? h.startX : e;
2353
2353
  return v === -1 && (v = l.x), s(
2354
- zt({
2354
+ Ut({
2355
2355
  range: { start: v, end: e },
2356
2356
  numRows: m.numRows
2357
2357
  })
2358
- ), S && M((T == null ? void 0 : T.value) ?? ""), s(ue("")), s(ke(!0)), O(c.current), !d;
2358
+ ), S && D((T == null ? void 0 : T.value) ?? ""), s(de("")), s(ke(!0)), O(c.current), !d;
2359
2359
  },
2360
2360
  [
2361
2361
  b,
@@ -2363,28 +2363,28 @@ const er = nt(({ x: e }) => {
2363
2363
  F,
2364
2364
  n,
2365
2365
  T,
2366
- f,
2366
+ h,
2367
2367
  l,
2368
2368
  d,
2369
2369
  c
2370
2370
  ]
2371
2371
  ), C = k(
2372
2372
  (r) => {
2373
- if (r.stopPropagation(), !r.type.startsWith("touch") && (he(r), s(ke(!1)), d))
2373
+ if (r.stopPropagation(), !r.type.startsWith("touch") && (fe(r), s(ke(!1)), d))
2374
2374
  return O(c.current), !1;
2375
2375
  },
2376
2376
  [d]
2377
- ), D = wn((r) => {
2377
+ ), I = wn((r) => {
2378
2378
  if (!He(r) || !m || r.type.startsWith("touch"))
2379
2379
  return !1;
2380
- if (he(r), r.stopPropagation(), d)
2381
- return s(Ze({ y: 1, x: e })), !1;
2380
+ if (fe(r), r.stopPropagation(), d)
2381
+ return s(We({ y: 1, x: e })), !1;
2382
2382
  if (S) {
2383
- const u = ge({ ...f, endY: 1, endX: e }), [v, N] = [pe(u.left), pe(u.right)], I = `${m.sheetPrefix(!F)}${v}:${N}`;
2384
- De({ input: T || null, ref: I });
2383
+ const u = he({ ...h, endY: 1, endX: e }), [v, N] = [pe(u.left), pe(u.right)], A = `${m.sheetPrefix(!F)}${v}:${N}`;
2384
+ De({ input: T || null, ref: A });
2385
2385
  }
2386
2386
  if (d == null) {
2387
- const { startY: u } = f;
2387
+ const { startY: u } = h;
2388
2388
  s(u === 1 ? me({ y: m.numRows, x: e }) : me({ y: 1, x: e }));
2389
2389
  }
2390
2390
  return !1;
@@ -2393,16 +2393,16 @@ const er = nt(({ x: e }) => {
2393
2393
  "th",
2394
2394
  {
2395
2395
  "data-x": e,
2396
- className: `gs-th gs-th-top ${l.x === e ? "gs-choosing" : ""} ${Ae({ start: f.startX, end: f.endX }, e) ? h ? "gs-th-selecting" : "gs-selecting" : ""}`,
2397
- style: { ...p == null ? void 0 : p.style, width: A, minWidth: A, maxWidth: A },
2398
- onContextMenu: (r) => y.length > 0 ? (r.stopPropagation(), he(r), s(We({ y: r.clientY, x: r.clientX })), !1) : !0,
2396
+ className: `gs-th gs-th-top ${l.x === e ? "gs-choosing" : ""} ${Ae({ start: h.startX, end: h.endX }, e) ? f ? "gs-th-selecting" : "gs-selecting" : ""}`,
2397
+ style: { ...p == null ? void 0 : p.style, width: M, minWidth: M, maxWidth: M },
2398
+ onContextMenu: (r) => y.length > 0 ? (r.stopPropagation(), fe(r), s(ze({ y: r.clientY, x: r.clientX })), !1) : !0,
2399
2399
  children: /* @__PURE__ */ a(
2400
2400
  "div",
2401
2401
  {
2402
2402
  className: "gs-th-inner-wrap",
2403
2403
  onMouseDown: P,
2404
2404
  onTouchStart: P,
2405
- onMouseEnter: D,
2405
+ onMouseEnter: I,
2406
2406
  onMouseUp: C,
2407
2407
  children: /* @__PURE__ */ Y("div", { className: "gs-th-inner", style: { height: m.headerHeight, position: "relative" }, children: [
2408
2408
  /* @__PURE__ */ a(
@@ -2410,7 +2410,7 @@ const er = nt(({ x: e }) => {
2410
2410
  {
2411
2411
  style: {
2412
2412
  position: "absolute",
2413
- zIndex: h ? -1 : 1
2413
+ zIndex: f ? -1 : 1
2414
2414
  },
2415
2415
  vertical: -1
2416
2416
  }
@@ -2425,7 +2425,7 @@ const er = nt(({ x: e }) => {
2425
2425
  !X.hasOperation(p == null ? void 0 : p.prevention, X.ColumnMenu) && /* @__PURE__ */ a(
2426
2426
  "button",
2427
2427
  {
2428
- className: `gs-menu-btn gs-column-menu-btn ${x ? "gs-filtered" : ""} ${(g == null ? void 0 : g.x) === e ? "gs-active" : ""}`,
2428
+ className: `gs-menu-btn gs-column-menu-btn ${E ? "gs-filtered" : ""} ${(g == null ? void 0 : g.x) === e ? "gs-active" : ""}`,
2429
2429
  onMouseDown: (r) => {
2430
2430
  r.stopPropagation(), r.preventDefault(), r.currentTarget.dataset.pressX = String(r.clientX), r.currentTarget.dataset.pressY = String(r.clientY);
2431
2431
  },
@@ -2435,7 +2435,7 @@ const er = nt(({ x: e }) => {
2435
2435
  if (Math.abs(r.clientX - v) > 4 || Math.abs(r.clientY - N) > 4)
2436
2436
  return;
2437
2437
  const R = u.getBoundingClientRect();
2438
- (g == null ? void 0 : g.x) === e ? s(et(null)) : (Ae({ start: f.startX, end: f.endX }, e) && f.startY === 1 && f.endY === m.numRows || s(zt({ range: { start: e, end: e }, numRows: m.numRows })), s(et({ x: e, position: { y: R.bottom, x: R.left } })));
2438
+ (g == null ? void 0 : g.x) === e ? s(et(null)) : (Ae({ start: h.startX, end: h.endX }, e) && h.startY === 1 && h.endY === m.numRows || s(Ut({ range: { start: e, end: e }, numRows: m.numRows })), s(et({ x: e, position: { y: R.bottom, x: R.left } })));
2439
2439
  },
2440
2440
  children: "⋮"
2441
2441
  }
@@ -2465,80 +2465,80 @@ const er = nt(({ x: e }) => {
2465
2465
  choosing: o,
2466
2466
  editingAddress: i,
2467
2467
  selectingZone: l,
2468
- leftHeaderSelecting: f,
2469
- editorRef: h,
2468
+ leftHeaderSelecting: h,
2469
+ editorRef: f,
2470
2470
  sheetReactive: c,
2471
2471
  autofillDraggingTo: d,
2472
2472
  dragging: b,
2473
2473
  contextMenu: y,
2474
2474
  rowMenuState: g
2475
- } = t, m = c.current, p = m == null ? void 0 : m.getCell({ y: e, x: 0 }, { resolution: "SYSTEM" }), A = (p == null ? void 0 : p.height) || bt, x = st(t), F = m == null ? void 0 : m.registry.lastFocused, T = !!(m != null && m.registry.editingAddress || i), S = k(
2475
+ } = t, m = c.current, p = m == null ? void 0 : m.getCell({ y: e, x: 0 }, { resolution: "SYSTEM" }), M = (p == null ? void 0 : p.height) || bt, E = st(t), F = m == null ? void 0 : m.registry.lastFocused, T = !!(m != null && m.registry.editingAddress || i), S = k(
2476
2476
  (r) => {
2477
- s(Ue({ value: r, point: o }));
2477
+ s(Ze({ value: r, point: o }));
2478
2478
  },
2479
2479
  [o]
2480
- ), M = k((r) => {
2481
- s(ft([e, r.clientY, r.clientY])), r.stopPropagation(), he(r);
2480
+ ), D = k((r) => {
2481
+ s(ht([e, r.clientY, r.clientY])), r.stopPropagation(), fe(r);
2482
2482
  }, []), $ = k(
2483
2483
  (r) => {
2484
- if (r.stopPropagation(), he(r), !He(r) || !m || b)
2484
+ if (r.stopPropagation(), fe(r), !He(r) || !m || b)
2485
2485
  return !1;
2486
2486
  if (r.type.startsWith("touch"))
2487
- return T && h.current && h.current.blur(), s(Xe({ y: e, x: 1 })), s(we({ startY: e, startX: 1, endY: e, endX: m.numCols })), !0;
2487
+ return T && f.current && f.current.blur(), s(Xe({ y: e, x: 1 })), s(we({ startY: e, startX: 1, endY: e, endX: m.numCols })), !0;
2488
2488
  s(we({ startY: e, startX: 1, endY: e, endX: -1 }));
2489
- const u = `${m.sheetPrefix(!x)}${n}:${n}`;
2489
+ const u = `${m.sheetPrefix(!E)}${n}:${n}`;
2490
2490
  if (T && De({ input: F || null, ref: u }))
2491
2491
  return s(we({ startY: e, startX: m.numCols, endY: e, endX: 0 })), !1;
2492
2492
  let v = r.shiftKey ? l.startY : e;
2493
2493
  return v === -1 && (v = o.y), s(
2494
- Wt({
2494
+ zt({
2495
2495
  range: { start: v, end: e },
2496
2496
  numCols: m.numCols
2497
2497
  })
2498
- ), T && S((F == null ? void 0 : F.value) ?? ""), s(ue("")), s(ke(!0)), O(h.current), !d;
2498
+ ), T && S((F == null ? void 0 : F.value) ?? ""), s(de("")), s(ke(!0)), O(f.current), !d;
2499
2499
  },
2500
2500
  [
2501
2501
  b,
2502
2502
  T,
2503
- x,
2503
+ E,
2504
2504
  n,
2505
2505
  F,
2506
2506
  l,
2507
2507
  o,
2508
2508
  d,
2509
- h
2509
+ f
2510
2510
  ]
2511
2511
  ), P = k(
2512
2512
  (r) => {
2513
- if (r.stopPropagation(), !r.type.startsWith("touch") && (he(r), s(ke(!1)), d))
2514
- return O(h.current), !1;
2513
+ if (r.stopPropagation(), !r.type.startsWith("touch") && (fe(r), s(ke(!1)), d))
2514
+ return O(f.current), !1;
2515
2515
  },
2516
2516
  [d]
2517
2517
  ), C = wn((r) => {
2518
2518
  if (!He(r) || !m || r.type.startsWith("touch"))
2519
2519
  return !1;
2520
- if (he(r), r.stopPropagation(), d)
2521
- return s(Ze({ y: e, x: 1 })), !1;
2520
+ if (fe(r), r.stopPropagation(), d)
2521
+ return s(We({ y: e, x: 1 })), !1;
2522
2522
  if (T) {
2523
- const u = ge({ ...l, endY: e, endX: 1 }), [v, N] = [be(u.top), be(u.bottom)], I = `${m.sheetPrefix(!x)}${v}:${N}`;
2524
- De({ input: F || null, ref: I });
2523
+ const u = he({ ...l, endY: e, endX: 1 }), [v, N] = [be(u.top), be(u.bottom)], A = `${m.sheetPrefix(!E)}${v}:${N}`;
2524
+ De({ input: F || null, ref: A });
2525
2525
  }
2526
2526
  if (d == null) {
2527
2527
  const { startX: u } = l;
2528
2528
  s(u === 1 ? me({ y: e, x: m.numCols }) : me({ y: e, x: 1 }));
2529
2529
  }
2530
2530
  return !1;
2531
- }, 100), D = k(
2532
- (r) => y.length > 0 ? (r.stopPropagation(), he(r), s(We({ y: r.clientY, x: r.clientX })), !1) : !0,
2531
+ }, 100), I = k(
2532
+ (r) => y.length > 0 ? (r.stopPropagation(), fe(r), s(ze({ y: r.clientY, x: r.clientX })), !1) : !0,
2533
2533
  [y.length]
2534
2534
  );
2535
2535
  return m ? /* @__PURE__ */ a(
2536
2536
  "th",
2537
2537
  {
2538
2538
  "data-y": e,
2539
- className: `gs-th gs-th-left ${o.y === e ? "gs-choosing" : ""} ${Ae({ start: l.startY, end: l.endY }, e) ? f ? "gs-th-selecting" : "gs-selecting" : ""} ${p != null && p.filterFixed ? "gs-filter-fixed" : ""} ${p != null && p.sortFixed ? "gs-sort-fixed" : ""}`,
2540
- style: { ...p == null ? void 0 : p.style, height: A },
2541
- onContextMenu: D,
2539
+ className: `gs-th gs-th-left ${o.y === e ? "gs-choosing" : ""} ${Ae({ start: l.startY, end: l.endY }, e) ? h ? "gs-th-selecting" : "gs-selecting" : ""} ${p != null && p.filterFixed ? "gs-filter-fixed" : ""} ${p != null && p.sortFixed ? "gs-sort-fixed" : ""}`,
2540
+ style: { ...p == null ? void 0 : p.style, height: M },
2541
+ onContextMenu: I,
2542
2542
  children: /* @__PURE__ */ a(
2543
2543
  "div",
2544
2544
  {
@@ -2553,7 +2553,7 @@ const er = nt(({ x: e }) => {
2553
2553
  {
2554
2554
  style: {
2555
2555
  position: "absolute",
2556
- zIndex: f ? -1 : 1
2556
+ zIndex: h ? -1 : 1
2557
2557
  },
2558
2558
  horizontal: -1
2559
2559
  }
@@ -2572,7 +2572,7 @@ const er = nt(({ x: e }) => {
2572
2572
  if (Math.abs(r.clientX - v) > 4 || Math.abs(r.clientY - N) > 4)
2573
2573
  return;
2574
2574
  const R = u.getBoundingClientRect();
2575
- (g == null ? void 0 : g.y) === e ? s(mt(null)) : (Ae({ start: l.startY, end: l.endY }, e) && l.startX === 1 && l.endX === m.numCols || s(Wt({ range: { start: e, end: e }, numCols: m.numCols })), s(mt({ y: e, position: { y: R.bottom, x: R.right } })));
2575
+ (g == null ? void 0 : g.y) === e ? s(mt(null)) : (Ae({ start: l.startY, end: l.endY }, e) && l.startX === 1 && l.endX === m.numCols || s(zt({ range: { start: e, end: e }, numCols: m.numCols })), s(mt({ y: e, position: { y: R.bottom, x: R.right } })));
2576
2576
  },
2577
2577
  children: "⋮"
2578
2578
  }
@@ -2585,7 +2585,7 @@ const er = nt(({ x: e }) => {
2585
2585
  ${X.hasOperation(p == null ? void 0 : p.prevention, X.Resize) ? "gs-protected" : ""}
2586
2586
  ${b ? "gs-hidden" : ""}`,
2587
2587
  style: { width: m.headerWidth },
2588
- onMouseDown: M
2588
+ onMouseDown: D
2589
2589
  }
2590
2590
  )
2591
2591
  ] })
@@ -2595,14 +2595,14 @@ const er = nt(({ x: e }) => {
2595
2595
  ) : null;
2596
2596
  }), lt = "rgba(0, 119, 255, 1)", nr = "rgba(0, 119, 255, 0.6)", sr = "rgba(0, 128, 255, 0.2)", rr = "#0077ff", or = "#0077ff", ir = "rgba(0, 200, 100, 0.2)", lr = "#00aa78", ar = "#0077aa", Jt = (e, n, t, s, o, i) => {
2597
2597
  e.fillStyle = i, e.fillRect(n, t, s, o);
2598
- }, yt = (e, n, t, s, o, i, l = 2, f = [], h) => {
2599
- h && (e.fillStyle = h, e.fillRect(n, t, s, o)), e.strokeStyle = i, e.lineWidth = l, e.setLineDash(f), e.strokeRect(n + l / 2, t + l / 2, s - l, o - l), e.setLineDash([]);
2600
- }, qe = (e, n, t, s, o, i, l, f, h = 2, c = [], d) => {
2598
+ }, yt = (e, n, t, s, o, i, l = 2, h = [], f) => {
2599
+ f && (e.fillStyle = f, e.fillRect(n, t, s, o)), e.strokeStyle = i, e.lineWidth = l, e.setLineDash(h), e.strokeRect(n + l / 2, t + l / 2, s - l, o - l), e.setLineDash([]);
2600
+ }, qe = (e, n, t, s, o, i, l, h, f = 2, c = [], d) => {
2601
2601
  const { top: b, left: y, bottom: g, right: m } = l;
2602
2602
  if (b === -1 || y === -1 || g === -1 || m === -1)
2603
2603
  return;
2604
- const p = Fe(n, { y: b, x: y }), A = Fe(n, { y: g, x: m }), x = p.left - s, F = p.top - t, T = A.right - s, S = A.bottom - t;
2605
- T < 0 || x > o || S < 0 || F > i || yt(e, x, F, T - x, S - F, f, h, c, d);
2604
+ const p = Fe(n, { y: b, x: y }), M = Fe(n, { y: g, x: m }), E = p.left - s, F = p.top - t, T = M.right - s, S = M.bottom - t;
2605
+ T < 0 || E > o || S < 0 || F > i || yt(e, E, F, T - E, S - F, h, f, c, d);
2606
2606
  }, cr = ({ refs: e = {} }) => {
2607
2607
  const { store: n } = le(ae), {
2608
2608
  sheetReactive: t,
@@ -2610,116 +2610,120 @@ const er = nt(({ x: e }) => {
2610
2610
  choosing: o,
2611
2611
  selectingZone: i,
2612
2612
  matchingCells: l,
2613
- matchingCellIndex: f,
2614
- autofillDraggingTo: h,
2613
+ matchingCellIndex: h,
2614
+ autofillDraggingTo: f,
2615
2615
  topHeaderSelecting: c,
2616
2616
  leftHeaderSelecting: d,
2617
2617
  mode: b,
2618
2618
  dragging: y
2619
- } = n, g = t.current, m = se(null), p = se(0), A = se(n);
2620
- A.current = n;
2621
- const x = k(() => {
2619
+ } = n, g = t.current, m = re(null), p = re(0), M = re(n);
2620
+ M.current = n;
2621
+ const E = k(() => {
2622
2622
  if (!g || !s.current || !m.current)
2623
2623
  return;
2624
- const S = m.current, M = S.getContext("2d");
2625
- if (!M)
2624
+ const S = m.current, D = S.getContext("2d");
2625
+ if (!D)
2626
2626
  return;
2627
- const $ = s.current, P = window.devicePixelRatio || 1, C = $.clientWidth, D = $.clientHeight;
2628
- (S.width !== C * P || S.height !== D * P) && (S.style.width = `${C}px`, S.style.height = `${D}px`, S.width = C * P, S.height = D * P), M.setTransform(P, 0, 0, P, 0, 0), M.clearRect(0, 0, C, D);
2629
- const { registry: r } = g, u = $.scrollTop, v = $.scrollLeft, N = g.headerWidth, I = g.headerHeight;
2630
- M.save(), M.beginPath(), M.rect(N, I, C - N, D - I), M.clip();
2631
- const R = ge(i);
2632
- if (qe(M, g, u, v, C, D, R, nr, 1, [], sr), h) {
2633
- const B = new is(A.current, h);
2634
- qe(M, g, u, v, C, D, B.wholeArea, ar, 1, [5, 5]);
2627
+ const $ = s.current, P = window.devicePixelRatio || 1, C = $.clientWidth, I = $.clientHeight;
2628
+ (S.width !== C * P || S.height !== I * P) && (S.style.width = `${C}px`, S.style.height = `${I}px`, S.width = C * P, S.height = I * P), D.setTransform(P, 0, 0, P, 0, 0), D.clearRect(0, 0, C, I);
2629
+ const { registry: r } = g, u = $.scrollTop, v = $.scrollLeft, N = g.headerWidth, A = g.headerHeight;
2630
+ D.save(), D.beginPath(), D.rect(N, A, C - N, I - A), D.clip();
2631
+ const R = he(i);
2632
+ if (qe(D, g, u, v, C, I, R, nr, 1, [], sr), f) {
2633
+ const B = new is(M.current, f);
2634
+ qe(D, g, u, v, C, I, B.wholeArea, ar, 1, [5, 5]);
2635
2635
  }
2636
2636
  {
2637
- const { y: B, x: z } = o;
2638
- if (B !== -1 && z !== -1) {
2639
- const U = Fe(g, { y: B, x: z }), K = U.left - v, W = U.top - u;
2640
- yt(M, K, W, U.width, U.height, lt, 2, []);
2637
+ const { y: B, x: U } = o;
2638
+ if (B !== -1 && U !== -1) {
2639
+ const W = Fe(g, { y: B, x: U }), J = W.left - v, j = W.top - u;
2640
+ yt(D, J, j, W.width, W.height, lt, 2, []);
2641
2641
  }
2642
2642
  }
2643
- const { copyingSheetId: H, copyingZone: G, cutting: _ } = r;
2643
+ const { copyingSheetId: H, copyingZone: q, cutting: _ } = r;
2644
2644
  if (g.id === H) {
2645
- const B = ge(G);
2646
- qe(M, g, u, v, C, D, B, _ ? or : rr, 2.5, _ ? [4, 4] : [6, 4]);
2645
+ const B = he(q);
2646
+ qe(D, g, u, v, C, I, B, _ ? or : rr, 2.5, _ ? [4, 4] : [6, 4]);
2647
2647
  }
2648
- Object.entries(e).forEach(([B, z]) => {
2649
- const U = Ie[z % Ie.length];
2648
+ Object.entries(e).forEach(([B, U]) => {
2649
+ const W = Ie[U % Ie.length];
2650
2650
  try {
2651
- const K = g.rangeToArea(B);
2652
- qe(M, g, u, v, C, D, K, U, 2, [5, 5]);
2651
+ const J = g.rangeToArea(B);
2652
+ qe(D, g, u, v, C, I, J, W, 2, [5, 5]);
2653
2653
  } catch {
2654
2654
  }
2655
- }), l.forEach((B, z) => {
2656
- const { y: U, x: K } = Rt(B), W = Fe(g, { y: U, x: K }), Q = W.left - v, j = W.top - u;
2657
- if (Q + W.width < 0 || Q > C || j + W.height < 0 || j > D)
2655
+ }), l.forEach((B, U) => {
2656
+ const { y: W, x: J } = Rt(B), j = Fe(g, { y: W, x: J }), Z = j.left - v, G = j.top - u;
2657
+ if (Z + j.width < 0 || Z > C || G + j.height < 0 || G > I)
2658
2658
  return;
2659
- const L = z === f;
2659
+ const L = U === h;
2660
2660
  yt(
2661
- M,
2662
- Q,
2663
- j,
2664
- W.width,
2665
- W.height,
2661
+ D,
2662
+ Z,
2663
+ G,
2664
+ j.width,
2665
+ j.height,
2666
2666
  L ? lr : "transparent",
2667
2667
  L ? 2 : 0,
2668
2668
  [],
2669
2669
  ir
2670
2670
  );
2671
- }), M.restore();
2672
- const re = g.numCols, ce = g.numRows;
2673
- for (let B = 1; B <= re; B++) {
2674
- let z = null, U = null;
2675
- if (Ae({ start: i.startX, end: i.endX }, B) && (z = "rgba(80, 180, 255, 1)", U = c ? "rgba(128, 128, 128, 0.25)" : "rgba(0, 119, 255, 0.05)"), o.x === B && (z = lt, U = c ? "rgba(128, 128, 128, 0.45)" : "rgba(0, 119, 255, 0.15)"), !z)
2671
+ }), D.restore();
2672
+ const oe = g.numCols, ce = g.numRows;
2673
+ for (let B = 1; B <= oe; B++) {
2674
+ let U = null, W = null;
2675
+ if (Ae({ start: i.startX, end: i.endX }, B) && (U = "rgba(80, 180, 255, 1)", W = c ? "rgba(128, 128, 128, 0.25)" : "rgba(0, 119, 255, 0.05)"), o.x === B && (U = lt, W = c ? "rgba(128, 128, 128, 0.45)" : "rgba(0, 119, 255, 0.15)"), !U)
2676
2676
  continue;
2677
- const K = Fe(g, { y: 1, x: B }), W = K.left - v;
2678
- if (W + K.width < N || W > C)
2677
+ const J = Fe(g, { y: 1, x: B }), j = J.left - v;
2678
+ if (j + J.width < N || j > C)
2679
2679
  continue;
2680
- const Q = Math.max(W, N), j = Math.min(W + K.width, C) - Q;
2681
- j > 0 && (U && Jt(M, Q, 0, j, I, U), M.strokeStyle = z, M.lineWidth = 2, M.beginPath(), M.moveTo(Q, I + 1), M.lineTo(Q + j, I + 1), M.stroke());
2680
+ const Z = Math.max(j, N), G = Math.min(j + J.width, C) - Z;
2681
+ G > 0 && (W && Jt(D, Z, 0, G, A, W), D.strokeStyle = U, D.lineWidth = 2, D.beginPath(), D.moveTo(Z, A + 1), D.lineTo(Z + G, A + 1), D.stroke());
2682
2682
  }
2683
2683
  for (let B = 1; B <= ce; B++) {
2684
2684
  if (g.isRowFiltered(B))
2685
2685
  continue;
2686
- let z = null, U = null;
2687
- if (Ae({ start: i.startY, end: i.endY }, B) && (z = "rgba(80, 180, 255, 1)", U = d ? "rgba(128, 128, 128, 0.25)" : "rgba(0, 119, 255, 0.05)"), o.y === B && (z = lt, U = d ? "rgba(128, 128, 128, 0.45)" : "rgba(0, 119, 255, 0.15)"), !z)
2686
+ let U = null, W = null;
2687
+ if (Ae({ start: i.startY, end: i.endY }, B) && (U = "rgba(80, 180, 255, 1)", W = d ? "rgba(128, 128, 128, 0.25)" : "rgba(0, 119, 255, 0.05)"), o.y === B && (U = lt, W = d ? "rgba(128, 128, 128, 0.45)" : "rgba(0, 119, 255, 0.15)"), !U)
2688
2688
  continue;
2689
- const K = Fe(g, { y: B, x: 1 }), W = K.top - u;
2690
- if (W + K.height < I || W > D)
2689
+ const J = Fe(g, { y: B, x: 1 }), j = J.top - u;
2690
+ if (j + J.height < A || j > I)
2691
2691
  continue;
2692
- const Q = Math.max(W, I), j = Math.min(W + K.height, D) - Q;
2693
- j > 0 && (U && Jt(M, 0, Q, N, j, U), M.strokeStyle = z, M.lineWidth = 2, M.beginPath(), M.moveTo(N + 1, Q), M.lineTo(N + 1, Q + j), M.stroke());
2692
+ const Z = Math.max(j, A), G = Math.min(j + J.height, I) - Z;
2693
+ G > 0 && (W && Jt(D, 0, Z, N, G, W), D.strokeStyle = U, D.lineWidth = 2, D.beginPath(), D.moveTo(N + 1, Z), D.lineTo(N + 1, Z + G), D.stroke());
2694
2694
  }
2695
2695
  }, [
2696
2696
  g,
2697
+ // The Sheet instance is mutated in place, so its identity stays stable across structural
2698
+ // changes (insert/remove rows & cols, resize, sort, filter). Depend on its monotonic version
2699
+ // so the overlay redraws when the grid layout shifts; otherwise the old box stays misaligned.
2700
+ g == null ? void 0 : g.currentVersion,
2697
2701
  s,
2698
2702
  o,
2699
2703
  i,
2700
2704
  l,
2701
- f,
2702
2705
  h,
2706
+ f,
2703
2707
  c,
2704
2708
  d,
2705
2709
  b,
2706
2710
  y,
2707
2711
  e
2708
2712
  ]), F = k(() => {
2709
- cancelAnimationFrame(p.current), p.current = requestAnimationFrame(x);
2710
- }, [x]), T = k(() => {
2711
- x();
2712
- }, [x]);
2713
- return Z(() => (F(), () => cancelAnimationFrame(p.current)), [F]), Z(() => {
2713
+ cancelAnimationFrame(p.current), p.current = requestAnimationFrame(E);
2714
+ }, [E]), T = k(() => {
2715
+ E();
2716
+ }, [E]);
2717
+ return K(() => (F(), () => cancelAnimationFrame(p.current)), [F]), K(() => {
2714
2718
  const S = s.current;
2715
2719
  if (!S)
2716
2720
  return;
2717
2721
  S.addEventListener("scroll", T);
2718
- const M = new ResizeObserver(() => x());
2719
- return M.observe(S), () => {
2720
- S.removeEventListener("scroll", T), M.disconnect();
2722
+ const D = new ResizeObserver(() => E());
2723
+ return D.observe(S), () => {
2724
+ S.removeEventListener("scroll", T), D.disconnect();
2721
2725
  };
2722
- }, [s, T, x]), /* @__PURE__ */ a(
2726
+ }, [s, T, E]), /* @__PURE__ */ a(
2723
2727
  "div",
2724
2728
  {
2725
2729
  style: {
@@ -2746,24 +2750,24 @@ const er = nt(({ x: e }) => {
2746
2750
  }
2747
2751
  );
2748
2752
  }, ur = () => {
2749
- var $, P, C, D, r, u, v, N, I;
2750
- const [e, n] = J({}), { store: t, dispatch: s } = le(ae), {
2753
+ var $, P, C, I, r, u, v, N, A;
2754
+ const [e, n] = ee({}), { store: t, dispatch: s } = le(ae), {
2751
2755
  sheetReactive: o,
2752
2756
  choosing: i,
2753
2757
  editingAddress: l,
2754
- tabularRef: f,
2755
- mainRef: h,
2758
+ tabularRef: h,
2759
+ mainRef: f,
2756
2760
  sheetWidth: c,
2757
2761
  sheetHeight: d,
2758
2762
  inputting: b,
2759
2763
  leftHeaderSelecting: y,
2760
2764
  topHeaderSelecting: g,
2761
2765
  contextMenu: m
2762
- } = t, p = o.current, [A, x] = J(null), F = k((R) => {
2766
+ } = t, p = o.current, [M, E] = ee(null), F = k((R) => {
2763
2767
  R.preventDefault(), R.stopPropagation();
2764
2768
  }, []), T = k(
2765
2769
  (R) => {
2766
- p && x(Bt(p, R.currentTarget));
2770
+ p && E(Bt(p, R.currentTarget));
2767
2771
  },
2768
2772
  [o]
2769
2773
  ), S = k(() => {
@@ -2778,45 +2782,45 @@ const er = nt(({ x: e }) => {
2778
2782
  );
2779
2783
  }));
2780
2784
  }, [o]);
2781
- Z(() => {
2785
+ K(() => {
2782
2786
  if (!p)
2783
2787
  return;
2784
2788
  if (!(l && b.startsWith("="))) {
2785
2789
  n({}), p.registry.paletteBySheetName = {};
2786
2790
  return;
2787
2791
  }
2788
- const H = {}, G = {}, _ = new Ge(b.substring(1));
2792
+ const H = {}, q = {}, _ = new Ge(b.substring(1));
2789
2793
  _.tokenize();
2790
- let re = 0;
2794
+ let oe = 0;
2791
2795
  for (const ce of _.tokens)
2792
2796
  if (ce.type === "REF" || ce.type === "RANGE") {
2793
- const B = ls(ce.stringify()), z = B.indexOf("!");
2794
- if (z !== -1) {
2795
- const U = B.substring(0, z), K = B.substring(z + 1), W = as(U), Q = K.toUpperCase();
2796
- G[W] == null && (G[W] = {}), G[W][Q] == null && (G[W][Q] = re++);
2797
+ const B = ls(ce.stringify()), U = B.indexOf("!");
2798
+ if (U !== -1) {
2799
+ const W = B.substring(0, U), J = B.substring(U + 1), j = as(W), Z = J.toUpperCase();
2800
+ q[j] == null && (q[j] = {}), q[j][Z] == null && (q[j][Z] = oe++);
2797
2801
  } else {
2798
- const U = B.toUpperCase();
2799
- H[U] == null && (H[U] = re++);
2802
+ const W = B.toUpperCase();
2803
+ H[W] == null && (H[W] = oe++);
2800
2804
  }
2801
2805
  }
2802
- n(H), p.registry.paletteBySheetName = G;
2803
- }, [t.inputting, t.editingAddress, o]), Z(() => {
2804
- p && (p.registry.choosingAddress = Ee(i), p.registry.choosingSheetId = p.id);
2805
- }, [i]), Z(() => {
2806
- p && x(Bt(p, f.current));
2806
+ n(H), p.registry.paletteBySheetName = q;
2807
+ }, [t.inputting, t.editingAddress, o]), K(() => {
2808
+ p && (p.registry.choosingAddress = xe(i), p.registry.choosingSheetId = p.id);
2809
+ }, [i]), K(() => {
2810
+ p && E(Bt(p, h.current));
2807
2811
  }, [
2808
- f.current,
2812
+ h.current,
2809
2813
  o,
2810
- ($ = h.current) == null ? void 0 : $.clientHeight,
2811
- (P = h.current) == null ? void 0 : P.clientWidth,
2814
+ ($ = f.current) == null ? void 0 : $.clientHeight,
2815
+ (P = f.current) == null ? void 0 : P.clientWidth,
2812
2816
  d,
2813
2817
  c
2814
- ]), Z(() => {
2815
- const R = f.current;
2818
+ ]), K(() => {
2819
+ const R = h.current;
2816
2820
  if (R)
2817
2821
  return cs(R);
2818
2822
  }, [o]);
2819
- const M = {
2823
+ const D = {
2820
2824
  ...e,
2821
2825
  ...p ? p.registry.paletteBySheetName[p.name] : {}
2822
2826
  };
@@ -2828,7 +2832,7 @@ const er = nt(({ x: e }) => {
2828
2832
  width: c === -1 ? void 0 : Math.min(c, p.totalWidth),
2829
2833
  height: d === -1 ? void 0 : Math.min(d, p.totalHeight)
2830
2834
  },
2831
- ref: f,
2835
+ ref: h,
2832
2836
  onMouseMove: F,
2833
2837
  onScroll: T,
2834
2838
  children: /* @__PURE__ */ Y(
@@ -2841,7 +2845,7 @@ const er = nt(({ x: e }) => {
2841
2845
  overflow: "clip"
2842
2846
  },
2843
2847
  children: [
2844
- /* @__PURE__ */ a(cr, { refs: M }),
2848
+ /* @__PURE__ */ a(cr, { refs: D }),
2845
2849
  /* @__PURE__ */ Y("table", { className: "gs-table", children: [
2846
2850
  /* @__PURE__ */ a("thead", { className: "gs-thead", style: { height: p.headerHeight }, children: /* @__PURE__ */ Y("tr", { className: "gs-row", children: [
2847
2851
  /* @__PURE__ */ a(
@@ -2870,11 +2874,11 @@ const er = nt(({ x: e }) => {
2870
2874
  },
2871
2875
  onMouseUp: (R) => {
2872
2876
  R.stopPropagation();
2873
- const H = R.currentTarget, G = Number(H.dataset.pressX ?? R.clientX), _ = Number(H.dataset.pressY ?? R.clientY);
2874
- if (Math.abs(R.clientX - G) > 4 || Math.abs(R.clientY - _) > 4)
2877
+ const H = R.currentTarget, q = Number(H.dataset.pressX ?? R.clientX), _ = Number(H.dataset.pressY ?? R.clientY);
2878
+ if (Math.abs(R.clientX - q) > 4 || Math.abs(R.clientY - _) > 4)
2875
2879
  return;
2876
2880
  const ce = H.getBoundingClientRect();
2877
- s(We({ y: ce.bottom, x: ce.left }));
2881
+ s(ze({ y: ce.bottom, x: ce.left }));
2878
2882
  },
2879
2883
  children: "⋮"
2880
2884
  }
@@ -2886,15 +2890,15 @@ const er = nt(({ x: e }) => {
2886
2890
  "th",
2887
2891
  {
2888
2892
  className: "gs-adjuster gs-adjuster-horizontal gs-adjuster-horizontal-left",
2889
- style: { width: ((C = A == null ? void 0 : A.adjuster) == null ? void 0 : C.left) ?? 1 }
2893
+ style: { width: ((C = M == null ? void 0 : M.adjuster) == null ? void 0 : C.left) ?? 1 }
2890
2894
  }
2891
2895
  ),
2892
- (r = (D = A == null ? void 0 : A.xs) == null ? void 0 : D.map) == null ? void 0 : r.call(D, (R) => /* @__PURE__ */ a(er, { x: R }, R)),
2896
+ (r = (I = M == null ? void 0 : M.xs) == null ? void 0 : I.map) == null ? void 0 : r.call(I, (R) => /* @__PURE__ */ a(er, { x: R }, R)),
2893
2897
  /* @__PURE__ */ a(
2894
2898
  "th",
2895
2899
  {
2896
2900
  className: "gs-adjuster gs-adjuster-horizontal gs-adjuster-horizontal-right",
2897
- style: { width: (u = A == null ? void 0 : A.adjuster) == null ? void 0 : u.right }
2901
+ style: { width: (u = M == null ? void 0 : M.adjuster) == null ? void 0 : u.right }
2898
2902
  }
2899
2903
  )
2900
2904
  ] }) }),
@@ -2903,19 +2907,19 @@ const er = nt(({ x: e }) => {
2903
2907
  "th",
2904
2908
  {
2905
2909
  className: "gs-adjuster gs-adjuster-horizontal gs-adjuster-vertical",
2906
- style: { height: ((v = A == null ? void 0 : A.adjuster) == null ? void 0 : v.top) ?? 1 }
2910
+ style: { height: ((v = M == null ? void 0 : M.adjuster) == null ? void 0 : v.top) ?? 1 }
2907
2911
  }
2908
2912
  ),
2909
2913
  /* @__PURE__ */ a("td", { className: "gs-adjuster gs-adjuster-vertical" }),
2910
- (N = A == null ? void 0 : A.xs) == null ? void 0 : N.map((R) => /* @__PURE__ */ a("td", { className: "gs-adjuster gs-adjuster-vertical" }, R)),
2914
+ (N = M == null ? void 0 : M.xs) == null ? void 0 : N.map((R) => /* @__PURE__ */ a("td", { className: "gs-adjuster gs-adjuster-vertical" }, R)),
2911
2915
  /* @__PURE__ */ a("th", { className: "gs-adjuster gs-adjuster-horizontal gs-adjuster-vertical" })
2912
2916
  ] }) }),
2913
- /* @__PURE__ */ a("tbody", { className: "gs-sheet-body-data", children: (I = A == null ? void 0 : A.ys) == null ? void 0 : I.map((R) => {
2917
+ /* @__PURE__ */ a("tbody", { className: "gs-sheet-body-data", children: (A = M == null ? void 0 : M.ys) == null ? void 0 : A.map((R) => {
2914
2918
  var H;
2915
2919
  return /* @__PURE__ */ Y("tr", { className: `gs-row ${R % 2 === 0 ? "gs-row-even" : "gs-row-odd"}`, children: [
2916
2920
  /* @__PURE__ */ a(tr, { y: R }),
2917
2921
  /* @__PURE__ */ a("td", { className: "gs-adjuster gs-adjuster-horizontal gs-adjuster-horizontal-left" }),
2918
- (H = A == null ? void 0 : A.xs) == null ? void 0 : H.map((G) => /* @__PURE__ */ a(Gs, { y: R, x: G }, G)),
2922
+ (H = M == null ? void 0 : M.xs) == null ? void 0 : H.map((q) => /* @__PURE__ */ a(Gs, { y: R, x: q }, q)),
2919
2923
  /* @__PURE__ */ a("td", { className: "gs-adjuster gs-adjuster-horizontal gs-adjuster-horizontal-right" })
2920
2924
  ] }, R);
2921
2925
  }) })
@@ -2926,8 +2930,8 @@ const er = nt(({ x: e }) => {
2926
2930
  }
2927
2931
  ) });
2928
2932
  }, dr = ({ ready: e }) => {
2929
- var L, oe;
2930
- const { store: n, dispatch: t } = le(ae), [s, o] = J(""), [i, l] = J(0), [f, h] = J(!1), {
2933
+ var L, Q;
2934
+ const { store: n, dispatch: t } = le(ae), [s, o] = ee(""), [i, l] = ee(0), [h, f] = ee(!1), {
2931
2935
  choosing: c,
2932
2936
  selectingZone: d,
2933
2937
  editorRef: b,
@@ -2935,88 +2939,88 @@ const er = nt(({ x: e }) => {
2935
2939
  sheetReactive: g,
2936
2940
  inputting: m,
2937
2941
  editingAddress: p,
2938
- dragging: A
2939
- } = n, x = g.current, F = se(null), T = c.x === -1 ? "" : Ee(c), S = x == null ? void 0 : x.getCell(c, { resolution: "SYSTEM" }), M = (L = x == null ? void 0 : x.getSystem(c)) == null ? void 0 : L.spilledFrom, $ = M ? Rt(M) : void 0, P = $ != null ? Ee($) : void 0;
2940
- Z(() => {
2941
- var V;
2942
- if (!x)
2942
+ dragging: M
2943
+ } = n, E = g.current, F = re(null), T = c.x === -1 ? "" : xe(c), S = E == null ? void 0 : E.getCell(c, { resolution: "SYSTEM" }), D = (L = E == null ? void 0 : E.getSystem(c)) == null ? void 0 : L.spilledFrom, $ = D ? Rt(D) : void 0, P = $ != null ? xe($) : void 0;
2944
+ K(() => {
2945
+ var z;
2946
+ if (!E)
2943
2947
  return;
2944
- let w = ((V = x.getCell(c, { resolution: "SYSTEM" })) == null ? void 0 : V.value) ?? "";
2945
- w = x.getSerializedValue({ point: c, cell: { ...S, value: w }, resolution: "RAW" }), y.current.value = w, o(w);
2946
- }, [T, x]);
2948
+ let w = ((z = E.getCell(c, { resolution: "SYSTEM" })) == null ? void 0 : z.value) ?? "";
2949
+ w = E.getSerializedValue({ point: c, cell: { ...S, value: w }, resolution: "RAW" }), y.current.value = w, o(w);
2950
+ }, [T, E]);
2947
2951
  const C = k(
2948
2952
  (w) => {
2949
- s !== w && t(Ue({ value: w })), t(ue("")), O(b.current);
2953
+ s !== w && t(Ze({ value: w })), t(de("")), O(b.current);
2950
2954
  },
2951
2955
  [s]
2952
2956
  );
2953
- Z(() => {
2954
- const w = new ResizeObserver((V) => {
2955
- V.forEach(z);
2957
+ K(() => {
2958
+ const w = new ResizeObserver((z) => {
2959
+ z.forEach(U);
2956
2960
  });
2957
2961
  return y.current && w.observe(y.current), () => {
2958
2962
  w.disconnect();
2959
2963
  };
2960
2964
  }, []);
2961
- const D = x == null ? void 0 : x.getPolicy(c), r = (D == null ? void 0 : D.getSelectOptions()) || [], {
2965
+ const I = E == null ? void 0 : E.getPolicy(c), r = (I == null ? void 0 : I.getSelectOptions()) || [], {
2962
2966
  filteredOptions: u,
2963
2967
  selected: v,
2964
2968
  replaceWithOption: N,
2965
- handleArrowUp: I,
2969
+ handleArrowUp: A,
2966
2970
  handleArrowDown: R,
2967
2971
  activeFunctionHelp: H,
2968
- activeArgIndex: G
2972
+ activeArgIndex: q
2969
2973
  } = Cn({
2970
2974
  inputting: m,
2971
2975
  selectionStart: i,
2972
2976
  optionsAll: r,
2973
- functions: x == null ? void 0 : x.registry.functions
2974
- }), _ = se(!1), re = y.current, ce = k((w) => {
2975
- t(ee(w.currentTarget.value)), l(w.currentTarget.selectionStart);
2977
+ functions: E == null ? void 0 : E.registry.functions
2978
+ }), _ = re(!1), oe = y.current, ce = k((w) => {
2979
+ t(te(w.currentTarget.value)), l(w.currentTarget.selectionStart);
2976
2980
  }, []), B = k((w) => {
2977
2981
  l(w.currentTarget.selectionStart);
2978
- }, []), z = k(() => {
2982
+ }, []), U = k(() => {
2979
2983
  !F.current || !y.current || (F.current.style.height = `${y.current.clientHeight}px`, F.current.scrollLeft = y.current.scrollLeft, F.current.scrollTop = y.current.scrollTop);
2980
- }, []), U = k(
2984
+ }, []), W = k(
2981
2985
  (w) => {
2982
- !re || !x || (h(!0), t(ue(T)), x.registry.lastFocused = w.currentTarget);
2986
+ !oe || !E || (f(!0), t(de(T)), E.registry.lastFocused = w.currentTarget);
2983
2987
  },
2984
- [re, T, x]
2988
+ [oe, T, E]
2985
2989
  );
2986
2990
  k(
2987
2991
  (w) => {
2988
- if (h(!1), w.currentTarget.value.startsWith("="))
2992
+ if (f(!1), w.currentTarget.value.startsWith("="))
2989
2993
  return !0;
2990
2994
  p && C(w.currentTarget.value);
2991
2995
  },
2992
2996
  [p, C]
2993
2997
  );
2994
- const K = k(
2998
+ const J = k(
2995
2999
  (w) => {
2996
3000
  if (w.nativeEvent.isComposing || _.current)
2997
3001
  return;
2998
- if (w.ctrlKey || !x)
3002
+ if (w.ctrlKey || !E)
2999
3003
  return !0;
3000
- const V = w.currentTarget;
3004
+ const z = w.currentTarget;
3001
3005
  if (tn(w, m))
3002
- return t(ee(V.value)), !1;
3006
+ return t(te(z.value)), !1;
3003
3007
  switch (w.key) {
3004
3008
  case "Tab":
3005
3009
  if (w.preventDefault(), u.length) {
3006
- const te = u[v];
3007
- if (te == null ? void 0 : te.isFunction) {
3008
- const { value: xe, selectionStart: _e } = N(te);
3009
- return t(ee(xe)), setTimeout(() => {
3010
+ const ne = u[v];
3011
+ if (ne == null ? void 0 : ne.isFunction) {
3012
+ const { value: Ee, selectionStart: _e } = N(ne);
3013
+ return t(te(Ee)), setTimeout(() => {
3010
3014
  y.current && (O(y.current), y.current.setSelectionRange(_e, _e));
3011
3015
  }, 0), !1;
3012
3016
  } else {
3013
- const xe = x.update({ diff: { [T]: { value: te.value } }, partial: !0 });
3014
- t(ze(xe.clone())), t(ue("")), t(ee(""));
3017
+ const Ee = E.update({ diff: { [T]: { value: ne.value } }, partial: !0 });
3018
+ t(Ue(Ee.clone())), t(de("")), t(te(""));
3015
3019
  }
3016
3020
  }
3017
3021
  break;
3018
3022
  case "ArrowUp":
3019
- if (I(w))
3023
+ if (A(w))
3020
3024
  return !0;
3021
3025
  break;
3022
3026
  case "ArrowDown":
@@ -3025,22 +3029,22 @@ const er = nt(({ x: e }) => {
3025
3029
  break;
3026
3030
  case "Enter": {
3027
3031
  if (u.length) {
3028
- const te = u[v];
3029
- if (te != null && te.isFunction) {
3030
- const { value: ye, selectionStart: xe } = N(te);
3031
- return t(ee(ye)), setTimeout(() => {
3032
- y.current && (O(y.current), y.current.setSelectionRange(xe, xe));
3032
+ const ne = u[v];
3033
+ if (ne != null && ne.isFunction) {
3034
+ const { value: ye, selectionStart: Ee } = N(ne);
3035
+ return t(te(ye)), setTimeout(() => {
3036
+ y.current && (O(y.current), y.current.setSelectionRange(Ee, Ee));
3033
3037
  }, 0), w.preventDefault(), !1;
3034
3038
  }
3035
3039
  }
3036
3040
  if (w.altKey)
3037
- nn(V, `
3041
+ nn(z, `
3038
3042
  `);
3039
3043
  else
3040
- return C(V.value), t(ee("")), t(
3044
+ return C(z.value), t(te("")), t(
3041
3045
  dt({
3042
- numRows: x.numRows,
3043
- numCols: x.numCols,
3046
+ numRows: E.numRows,
3047
+ numCols: E.numCols,
3044
3048
  deltaY: 1,
3045
3049
  deltaX: 0
3046
3050
  })
@@ -3048,7 +3052,7 @@ const er = nt(({ x: e }) => {
3048
3052
  break;
3049
3053
  }
3050
3054
  case "Escape": {
3051
- V.value = s, t(ee(s)), t(ue("")), w.preventDefault(), O(b.current);
3055
+ z.value = s, t(te(s)), t(de("")), w.preventDefault(), O(b.current);
3052
3056
  break;
3053
3057
  }
3054
3058
  case "a":
@@ -3063,69 +3067,69 @@ const er = nt(({ x: e }) => {
3063
3067
  return !0;
3064
3068
  break;
3065
3069
  }
3066
- const fe = x.getCell(c, { resolution: "SYSTEM" });
3067
- return X.hasOperation(fe == null ? void 0 : fe.prevention, X.Write) && (console.warn("This cell is protected from writing."), w.preventDefault()), z(), !1;
3070
+ const ue = E.getCell(c, { resolution: "SYSTEM" });
3071
+ return X.hasOperation(ue == null ? void 0 : ue.prevention, X.Write) && (console.warn("This cell is protected from writing."), w.preventDefault()), U(), !1;
3068
3072
  },
3069
3073
  [
3070
- x,
3074
+ E,
3071
3075
  c,
3072
3076
  T,
3073
3077
  s,
3074
3078
  C,
3075
- z,
3079
+ U,
3076
3080
  u,
3077
3081
  v,
3078
3082
  N,
3079
- I,
3083
+ A,
3080
3084
  R,
3081
3085
  m
3082
3086
  ]
3083
- ), W = k(
3084
- (w, V) => {
3087
+ ), j = k(
3088
+ (w, z) => {
3085
3089
  w.preventDefault(), w.stopPropagation();
3086
- const fe = u[V];
3087
- if (fe.isFunction) {
3088
- const { value: te, selectionStart: ye } = N(fe);
3089
- C(te), t(ee(te)), setTimeout(() => {
3090
+ const ue = u[z];
3091
+ if (ue.isFunction) {
3092
+ const { value: ne, selectionStart: ye } = N(ue);
3093
+ C(ne), t(te(ne)), setTimeout(() => {
3090
3094
  y.current && (O(y.current), y.current.setSelectionRange(ye, ye));
3091
3095
  }, 0);
3092
3096
  }
3093
3097
  },
3094
3098
  [u, N, C, t]
3095
- ), Q = e ? {} : { visibility: "hidden" };
3096
- if (!x)
3097
- return /* @__PURE__ */ Y("label", { className: "gs-formula-bar gs-hidden", style: Q, children: [
3099
+ ), Z = e ? {} : { visibility: "hidden" };
3100
+ if (!E)
3101
+ return /* @__PURE__ */ Y("label", { className: "gs-formula-bar gs-hidden", style: Z, children: [
3098
3102
  /* @__PURE__ */ a("div", { className: "gs-selecting-address" }),
3099
3103
  /* @__PURE__ */ a("div", { className: "gs-fx", children: "Fx" }),
3100
3104
  /* @__PURE__ */ a("div", { className: "gs-formula-bar-editor-inner", children: /* @__PURE__ */ a("textarea", {}) })
3101
3105
  ] });
3102
- const j = () => {
3103
- var te;
3104
- if (!f || typeof document > "u" || y.current !== document.activeElement)
3106
+ const G = () => {
3107
+ var ne;
3108
+ if (!h || typeof document > "u" || y.current !== document.activeElement)
3105
3109
  return null;
3106
- const w = (te = y.current) == null ? void 0 : te.getBoundingClientRect();
3110
+ const w = (ne = y.current) == null ? void 0 : ne.getBoundingClientRect();
3107
3111
  if (!w)
3108
3112
  return null;
3109
- const V = w.bottom, fe = w.left;
3113
+ const z = w.bottom, ue = w.left;
3110
3114
  return St(
3111
3115
  /* @__PURE__ */ Y(Re, { children: [
3112
3116
  H && u.length === 0 && (!d || d.endY === -1 && d.endX === -1) && /* @__PURE__ */ a(
3113
3117
  Nt,
3114
3118
  {
3115
3119
  activeFunctionGuide: H,
3116
- activeArgIndex: G,
3117
- top: V,
3118
- left: fe
3120
+ activeArgIndex: q,
3121
+ top: z,
3122
+ left: ue
3119
3123
  }
3120
3124
  ),
3121
3125
  u.length > 0 && c.x !== -1 && /* @__PURE__ */ a(
3122
3126
  Rn,
3123
3127
  {
3124
3128
  filteredOptions: u,
3125
- top: V,
3126
- left: fe,
3129
+ top: z,
3130
+ left: ue,
3127
3131
  selected: v,
3128
- onOptionMouseDown: W
3132
+ onOptionMouseDown: j
3129
3133
  }
3130
3134
  )
3131
3135
  ] }),
@@ -3138,7 +3142,7 @@ const er = nt(({ x: e }) => {
3138
3142
  className: "gs-formula-bar",
3139
3143
  "data-sheet-id": n.sheetId,
3140
3144
  "data-spill": P != null ? "true" : void 0,
3141
- style: Q,
3145
+ style: Z,
3142
3146
  children: [
3143
3147
  /* @__PURE__ */ a(Te, { style: { position: "absolute", left: 0, top: 0, zIndex: 2 }, vertical: -1 }),
3144
3148
  /* @__PURE__ */ a("div", { className: "gs-selecting-address", children: P ?? T }),
@@ -3150,10 +3154,10 @@ const er = nt(({ x: e }) => {
3150
3154
  className: "gs-editor-hl",
3151
3155
  ref: F,
3152
3156
  style: {
3153
- height: (oe = y.current) == null ? void 0 : oe.clientHeight,
3157
+ height: (Q = y.current) == null ? void 0 : Q.clientHeight,
3154
3158
  width: "100%"
3155
3159
  },
3156
- children: (S == null ? void 0 : S.formulaEnabled) ?? !0 ? En(m) : m
3160
+ children: (S == null ? void 0 : S.formulaEnabled) ?? !0 ? xn(m) : m
3157
3161
  }
3158
3162
  ),
3159
3163
  /* @__PURE__ */ a(
@@ -3168,20 +3172,20 @@ const er = nt(({ x: e }) => {
3168
3172
  value: m,
3169
3173
  readOnly: P != null,
3170
3174
  onInput: ce,
3171
- onFocus: U,
3175
+ onFocus: W,
3172
3176
  onSelect: B,
3173
3177
  onPaste: (w) => {
3174
3178
  w.stopPropagation();
3175
3179
  },
3176
- onKeyDown: K,
3177
- onKeyUp: z,
3180
+ onKeyDown: J,
3181
+ onKeyUp: U,
3178
3182
  onCompositionStart: () => {
3179
3183
  _.current = !0;
3180
3184
  },
3181
3185
  onCompositionEnd: (w) => {
3182
- _.current = !1, t(ee(w.currentTarget.value));
3186
+ _.current = !1, t(te(w.currentTarget.value));
3183
3187
  },
3184
- onScroll: z,
3188
+ onScroll: U,
3185
3189
  onMouseEnter: (w) => {
3186
3190
  t(Je(!0));
3187
3191
  },
@@ -3190,7 +3194,7 @@ const er = nt(({ x: e }) => {
3190
3194
  }
3191
3195
  }
3192
3196
  ),
3193
- j()
3197
+ G()
3194
3198
  ] })
3195
3199
  ]
3196
3200
  }
@@ -3215,35 +3219,35 @@ const er = nt(({ x: e }) => {
3215
3219
  /* @__PURE__ */ a("path", { stroke: "none", d: "M0 0h24v24H0z", fill: n }),
3216
3220
  /* @__PURE__ */ a("path", { d: "M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0", fill: n }),
3217
3221
  /* @__PURE__ */ a("path", { d: "M21 21l-6 -6", fill: n })
3218
- ] }), fr = ({ style: e, color: n = "none", size: t = 24 }) => /* @__PURE__ */ Y(Ln, { style: e, size: t, children: [
3222
+ ] }), hr = ({ style: e, color: n = "none", size: t = 24 }) => /* @__PURE__ */ Y(Ln, { style: e, size: t, children: [
3219
3223
  /* @__PURE__ */ a("path", { stroke: "none", d: "M0 0h24v24H0z", fill: n }),
3220
3224
  /* @__PURE__ */ a("path", { d: "M18 6l-12 12", fill: n }),
3221
3225
  /* @__PURE__ */ a("path", { d: "M6 6l12 12", fill: n })
3222
- ] }), hr = () => {
3226
+ ] }), fr = () => {
3223
3227
  const { store: e, dispatch: n } = le(ae), {
3224
3228
  rootRef: t,
3225
3229
  editorRef: s,
3226
3230
  searchInputRef: o,
3227
3231
  tabularRef: i,
3228
3232
  searchQuery: l,
3229
- searchCaseSensitive: f,
3230
- searchRegex: h,
3233
+ searchCaseSensitive: h,
3234
+ searchRegex: f,
3231
3235
  searchRange: c,
3232
3236
  selectingZone: d,
3233
3237
  matchingCellIndex: b,
3234
3238
  matchingCells: y,
3235
3239
  sheetReactive: g
3236
3240
  } = e, m = g.current, p = y[b];
3237
- Z(() => {
3241
+ K(() => {
3238
3242
  if (!p || !m)
3239
3243
  return;
3240
3244
  const u = Rt(p);
3241
3245
  typeof u > "u" || us(m, i.current, u);
3242
- }, [l, b, f, h, m, i]);
3243
- const A = k((u) => {
3246
+ }, [l, b, h, f, m, i]);
3247
+ const M = k((u) => {
3244
3248
  const v = u.currentTarget.previousSibling;
3245
3249
  (v == null ? void 0 : v.nodeName) === "INPUT" && O(v);
3246
- }, []), x = k(() => {
3250
+ }, []), E = k(() => {
3247
3251
  n(_t(1));
3248
3252
  }, []), F = k((u) => {
3249
3253
  n(Pe(u.currentTarget.value));
@@ -3257,48 +3261,48 @@ const er = nt(({ x: e }) => {
3257
3261
  },
3258
3262
  [s]
3259
3263
  ), S = k(() => {
3260
- n(Cs(!f));
3261
- }, [f]), M = k(() => {
3262
- n(Ss(!h));
3263
- }, [h]), $ = $e(() => {
3264
+ n(Cs(!h));
3265
+ }, [h]), D = k(() => {
3266
+ n(Ss(!f));
3267
+ }, [f]), $ = $e(() => {
3264
3268
  if (!d || ds(d))
3265
3269
  return !1;
3266
- const { startY: u, startX: v, endY: N, endX: I } = d;
3267
- return !(u === N && v === I);
3270
+ const { startY: u, startX: v, endY: N, endX: A } = d;
3271
+ return !(u === N && v === A);
3268
3272
  }, [d]), P = $e(() => {
3269
3273
  if (!d || !$)
3270
3274
  return "";
3271
- const { startY: u, startX: v, endY: N, endX: I } = d, R = `${pe(Math.min(v, I))}${be(Math.min(u, N))}`, H = `${pe(Math.max(v, I))}${be(Math.max(u, N))}`;
3275
+ const { startY: u, startX: v, endY: N, endX: A } = d, R = `${pe(Math.min(v, A))}${be(Math.min(u, N))}`, H = `${pe(Math.max(v, A))}${be(Math.max(u, N))}`;
3272
3276
  return `${R}:${H}`;
3273
3277
  }, [d, $]), C = k(() => {
3274
3278
  if (c)
3275
3279
  n(jt(void 0));
3276
3280
  else if (d && $) {
3277
- const { startY: u, startX: v, endY: N, endX: I } = d;
3281
+ const { startY: u, startX: v, endY: N, endX: A } = d;
3278
3282
  n(
3279
3283
  jt({
3280
3284
  startY: Math.min(u, N),
3281
- startX: Math.min(v, I),
3285
+ startX: Math.min(v, A),
3282
3286
  endY: Math.max(u, N),
3283
- endX: Math.max(v, I)
3287
+ endX: Math.max(v, A)
3284
3288
  })
3285
3289
  );
3286
3290
  }
3287
- }, [c, d, $]), D = $e(() => {
3291
+ }, [c, d, $]), I = $e(() => {
3288
3292
  if (!c)
3289
3293
  return "";
3290
- const { startY: u, startX: v, endY: N, endX: I } = c, R = `${pe(v)}${be(u)}`, H = `${pe(I)}${be(N)}`;
3294
+ const { startY: u, startX: v, endY: N, endX: A } = c, R = `${pe(v)}${be(u)}`, H = `${pe(A)}${be(N)}`;
3291
3295
  return `${R}:${H}`;
3292
3296
  }, [c]), r = k(() => {
3293
3297
  n(Pe(void 0)), O(s.current);
3294
3298
  }, [s]);
3295
3299
  return typeof l > "u" || t.current === null ? null : /* @__PURE__ */ Y("label", { className: `gs-search-bar ${y.length > 0 ? "gs-search-found" : ""}`, children: [
3296
- /* @__PURE__ */ Y("div", { className: "gs-search-progress", onClick: A, children: [
3300
+ /* @__PURE__ */ Y("div", { className: "gs-search-progress", onClick: M, children: [
3297
3301
  y.length === 0 ? 0 : b + 1,
3298
3302
  " / ",
3299
3303
  y.length
3300
3304
  ] }),
3301
- /* @__PURE__ */ a("div", { className: "gs-search-bar-icon", onClick: x, children: /* @__PURE__ */ a(gr, { style: { verticalAlign: "middle", marginLeft: "5px" } }) }),
3305
+ /* @__PURE__ */ a("div", { className: "gs-search-bar-icon", onClick: E, children: /* @__PURE__ */ a(gr, { style: { verticalAlign: "middle", marginLeft: "5px" } }) }),
3302
3306
  /* @__PURE__ */ Y("div", { className: "gs-search-input-wrapper", children: [
3303
3307
  /* @__PURE__ */ Y("div", { className: "gs-search-input-ghost", children: [
3304
3308
  /* @__PURE__ */ a("span", { className: "gs-search-ghost-text", children: l }),
@@ -3322,10 +3326,10 @@ const er = nt(({ x: e }) => {
3322
3326
  {
3323
3327
  className: "gs-search-button-on",
3324
3328
  onClick: C,
3325
- title: `Search range: ${D}`,
3329
+ title: `Search range: ${I}`,
3326
3330
  children: [
3327
3331
  "in ",
3328
- D
3332
+ I
3329
3333
  ]
3330
3334
  }
3331
3335
  ) }),
@@ -3336,7 +3340,7 @@ const er = nt(({ x: e }) => {
3336
3340
  /* @__PURE__ */ a("div", { className: "gs-search-button gs-search-casesensitive", children: /* @__PURE__ */ a(
3337
3341
  "span",
3338
3342
  {
3339
- className: `${f ? "gs-search-button-on" : ""}`,
3343
+ className: `${h ? "gs-search-button-on" : ""}`,
3340
3344
  onClick: S,
3341
3345
  title: "Case sensitive",
3342
3346
  children: "Aa"
@@ -3345,16 +3349,16 @@ const er = nt(({ x: e }) => {
3345
3349
  /* @__PURE__ */ a("div", { className: "gs-search-button gs-search-regex", children: /* @__PURE__ */ a(
3346
3350
  "span",
3347
3351
  {
3348
- className: `${h ? "gs-search-button-on" : ""}`,
3349
- onClick: M,
3352
+ className: `${f ? "gs-search-button-on" : ""}`,
3353
+ onClick: D,
3350
3354
  title: "Regular expression",
3351
3355
  children: ".*"
3352
3356
  }
3353
3357
  ) })
3354
3358
  ] }),
3355
- /* @__PURE__ */ a("a", { className: "gs-search-close", onClick: r, children: /* @__PURE__ */ a(fr, { style: { verticalAlign: "middle" } }) })
3359
+ /* @__PURE__ */ a("a", { className: "gs-search-close", onClick: r, children: /* @__PURE__ */ a(hr, { style: { verticalAlign: "middle" } }) })
3356
3360
  ] });
3357
- }, kr = () => an(), mr = () => se(null), Tr = () => an(), pr = () => se(null);
3361
+ }, kr = () => an(), mr = () => re(null), Tr = () => an(), pr = () => re(null);
3358
3362
  function Ar({
3359
3363
  initialCells: e,
3360
3364
  sheetName: n = "",
@@ -3363,27 +3367,27 @@ function Ar({
3363
3367
  options: o = {},
3364
3368
  className: i,
3365
3369
  style: l,
3366
- book: f
3370
+ book: h
3367
3371
  }) {
3368
- var B, z, U;
3369
- const { sheetResize: h, showFormulaBar: c = !0, mode: d = "light" } = o, b = se(null), y = se(null), g = se(null), m = se(null), p = se(null), A = se(null), x = se(null), F = mr(), T = t ?? F, S = pr(), M = s ?? S, $ = Ns({}), P = f ?? $, { registry: C } = P, [D] = J(() => n ? (C._componentSheetIds.has(n) || C._componentSheetIds.set(n, ++C.sheetHead), C._componentSheetIds.get(n)) : ++C.sheetHead), r = se(null), [u] = J(() => {
3370
- var w;
3371
- n || (n = `Sheet${D}`, console.debug("GridSheet: sheetName is not provided, using default name:", n));
3372
- const { limits: K, contextMenu: W, rowMenu: Q, colMenu: j } = o, L = new gs({
3373
- limits: K,
3372
+ var W, J, j;
3373
+ const { sheetResize: f, showFormulaBar: c = !0, mode: d = "light" } = o, b = re(null), y = re(null), g = re(null), m = re(null), p = re(null), M = re(null), E = re(null), F = mr(), T = t ?? F, S = pr(), D = s ?? S, $ = Ns({}), P = h ?? $, { registry: C } = P, [I] = ee(() => n ? (C._componentSheetIds.has(n) || C._componentSheetIds.set(n, ++C.sheetHead), C._componentSheetIds.get(n)) : ++C.sheetHead), r = re(null), [u] = ee(() => {
3374
+ var ue;
3375
+ n || (n = `Sheet${I}`, console.debug("GridSheet: sheetName is not provided, using default name:", n));
3376
+ const { limits: Z, contextMenu: G, rowMenu: L, colMenu: Q } = o, w = new gs({
3377
+ limits: Z,
3374
3378
  name: n,
3375
3379
  registry: C
3376
3380
  });
3377
- return L.id = D, C.sheetIdsByName[n] = D, L.initialize(e), (w = C.onInit) == null || w.call(C, { sheet: L }), L.setTotalSize(), r.current = L, {
3378
- sheetId: D,
3381
+ return w.id = I, C.sheetIdsByName[n] = I, w.initialize(e), (ue = C.onInit) == null || ue.call(C, { sheet: w }), w.setTotalSize(), r.current = w, {
3382
+ sheetId: I,
3379
3383
  sheetReactive: r,
3380
3384
  rootRef: b,
3381
3385
  flashRef: y,
3382
3386
  mainRef: g,
3383
3387
  searchInputRef: m,
3384
3388
  editorRef: p,
3385
- largeEditorRef: A,
3386
- tabularRef: x,
3389
+ largeEditorRef: M,
3390
+ tabularRef: E,
3387
3391
  choosing: { y: 1, x: 1 },
3388
3392
  inputting: "",
3389
3393
  selectingZone: { startY: 1, startX: 1, endY: -1, endX: -1 },
@@ -3402,9 +3406,9 @@ function Ar({
3402
3406
  searchRegex: !1,
3403
3407
  editingOnEnter: !0,
3404
3408
  contextMenuPosition: { y: -1, x: -1 },
3405
- contextMenu: W ?? Ls,
3406
- rowMenu: Q ?? Bs,
3407
- colMenu: j ?? Ks,
3409
+ contextMenu: G ?? Ls,
3410
+ rowMenu: L ?? Bs,
3411
+ colMenu: Q ?? Ks,
3408
3412
  resizingPositionY: [-1, -1, -1],
3409
3413
  resizingPositionX: [-1, -1, -1],
3410
3414
  columnMenuState: null,
@@ -3413,86 +3417,99 @@ function Ar({
3413
3417
  mode: "light"
3414
3418
  };
3415
3419
  }), [v, N] = vs(
3416
- Es,
3420
+ xs,
3417
3421
  u,
3418
3422
  () => u
3419
3423
  );
3420
- Z(() => {
3421
- fs();
3424
+ K(() => {
3425
+ hs();
3422
3426
  }, []);
3423
- const [I, R] = J((o == null ? void 0 : o.sheetHeight) || yr(e)), [H, G] = J((o == null ? void 0 : o.sheetWidth) || vr(e));
3424
- Z(() => {
3425
- const K = g.current;
3426
- if (!K)
3427
+ const A = typeof o.sheetWidth == "string", R = typeof o.sheetHeight == "string", [H, q] = ee(
3428
+ typeof (o == null ? void 0 : o.sheetHeight) == "number" ? o.sheetHeight : yr(e)
3429
+ ), [_, oe] = ee(
3430
+ typeof (o == null ? void 0 : o.sheetWidth) == "number" ? o.sheetWidth : vr(e)
3431
+ );
3432
+ K(() => {
3433
+ const Z = g.current;
3434
+ if (!Z)
3427
3435
  return;
3428
- let W = !0;
3429
- const Q = new ResizeObserver(() => {
3430
- if (W) {
3431
- W = !1;
3436
+ let G = !0;
3437
+ const L = new ResizeObserver(() => {
3438
+ if (G && (G = !1, !A && !R))
3432
3439
  return;
3433
- }
3434
- const j = b.current;
3435
- R(j ? Math.min(K.clientHeight, j.clientHeight) : K.clientHeight), G(j ? Math.min(K.clientWidth, j.clientWidth) : K.clientWidth);
3440
+ const Q = b.current;
3441
+ q(Q ? Math.min(Z.clientHeight, Q.clientHeight) : Z.clientHeight), oe(Q ? Math.min(Z.clientWidth, Q.clientWidth) : Z.clientWidth);
3436
3442
  });
3437
- return Q.observe(K), () => Q.disconnect();
3438
- }, []), Z(() => {
3439
- o.sheetHeight && R(o.sheetHeight);
3440
- }, [o.sheetHeight]), Z(() => {
3441
- o.sheetWidth && G(o.sheetWidth);
3443
+ return L.observe(Z), () => L.disconnect();
3444
+ }, [A, R]), K(() => {
3445
+ typeof o.sheetHeight == "number" && q(o.sheetHeight);
3446
+ }, [o.sheetHeight]), K(() => {
3447
+ typeof o.sheetWidth == "number" && oe(o.sheetWidth);
3442
3448
  }, [o.sheetWidth]);
3443
- const [_, re] = J(!1);
3444
- Z(() => {
3445
- _ && re(!1);
3449
+ const [ce, B] = ee(!1);
3450
+ K(() => {
3451
+ ce && B(!1);
3446
3452
  });
3447
- const ce = k(
3448
- (K) => {
3449
- if (!xs(K.type)) {
3450
- N(K);
3453
+ const U = k(
3454
+ (Z) => {
3455
+ if (!Es(Z.type)) {
3456
+ N(Z);
3451
3457
  return;
3452
3458
  }
3453
- re(!0), requestAnimationFrame(() => {
3454
- N(K);
3459
+ B(!0), requestAnimationFrame(() => {
3460
+ N(Z);
3455
3461
  });
3456
3462
  },
3457
3463
  [N]
3458
3464
  );
3459
- return /* @__PURE__ */ a(ae.Provider, { value: { store: v, dispatch: ce }, children: /* @__PURE__ */ Y(
3465
+ return /* @__PURE__ */ a(ae.Provider, { value: { store: v, dispatch: U }, children: /* @__PURE__ */ Y(
3460
3466
  "div",
3461
3467
  {
3462
3468
  className: `gs-root1 ${C.ready ? "gs-initialized" : ""}`,
3463
3469
  ref: b,
3464
3470
  "data-sheet-name": n,
3465
3471
  "data-mode": d,
3466
- "data-rows": ((B = v.sheetReactive.current) == null ? void 0 : B.numRows) ?? 0,
3467
- "data-cols": ((z = v.sheetReactive.current) == null ? void 0 : z.numCols) ?? 0,
3472
+ "data-rows": ((W = v.sheetReactive.current) == null ? void 0 : W.numRows) ?? 0,
3473
+ "data-cols": ((J = v.sheetReactive.current) == null ? void 0 : J.numCols) ?? 0,
3474
+ style: A || R ? {
3475
+ // inline-flex (when width isn't filled) keeps the prior shrink-to-content width.
3476
+ display: A ? "flex" : "inline-flex",
3477
+ flexDirection: "column",
3478
+ ...A ? { width: o.sheetWidth } : null,
3479
+ ...R ? { height: o.sheetHeight } : null
3480
+ } : void 0,
3468
3481
  children: [
3469
3482
  /* @__PURE__ */ a("div", { className: "gs-flash-overlay", ref: y }),
3470
3483
  /* @__PURE__ */ a(Te, { style: { position: "fixed", top: 0, left: 0 } }),
3471
3484
  /* @__PURE__ */ a(Te, { style: { position: "absolute", zIndex: 4, right: 0, top: 0, width: 5 }, horizontal: 1 }),
3472
3485
  /* @__PURE__ */ a(Te, { style: { position: "absolute", zIndex: 4, left: 0, bottom: 0, height: 5 }, vertical: 1 }),
3473
- typeof v.searchQuery > "u" ? c && /* @__PURE__ */ a(dr, { ready: C.ready }) : /* @__PURE__ */ a(hr, {}),
3486
+ typeof v.searchQuery > "u" ? c && /* @__PURE__ */ a(dr, { ready: C.ready }) : /* @__PURE__ */ a(fr, {}),
3474
3487
  /* @__PURE__ */ Y(
3475
3488
  "div",
3476
3489
  {
3477
3490
  className: `gs-main ${i || ""}`,
3478
3491
  ref: g,
3479
3492
  style: {
3480
- //width: '100%',
3493
+ ...A ? { width: "100%" } : null,
3481
3494
  maxWidth: "100%",
3482
- maxHeight: g.current ? window.innerHeight - g.current.getBoundingClientRect().top : (((U = v.sheetReactive.current) == null ? void 0 : U.fullHeight) || 0) + 2,
3483
- resize: h,
3495
+ // In fill-height mode the parent's height is the limit (flex:1 fills the remaining
3496
+ // space below the formula bar); otherwise cap at the viewport bottom as before.
3497
+ ...R ? { flex: 1, minHeight: 0, maxHeight: "100%" } : {
3498
+ maxHeight: g.current ? window.innerHeight - g.current.getBoundingClientRect().top : (((j = v.sheetReactive.current) == null ? void 0 : j.fullHeight) || 0) + 2
3499
+ },
3500
+ resize: f,
3484
3501
  ...l
3485
3502
  },
3486
3503
  children: [
3487
3504
  /* @__PURE__ */ a(Ms, { mode: d }),
3488
3505
  /* @__PURE__ */ a(ur, {}),
3489
- /* @__PURE__ */ a(Ds, { ...o, sheetHeight: I, sheetWidth: H, sheetName: n, sheetRef: T, storeRef: M }),
3490
- /* @__PURE__ */ a(Us, {}),
3506
+ /* @__PURE__ */ a(Ds, { ...o, sheetHeight: H, sheetWidth: _, sheetName: n, sheetRef: T, storeRef: D }),
3507
+ /* @__PURE__ */ a(Zs, {}),
3491
3508
  /* @__PURE__ */ a(js, {}),
3492
3509
  /* @__PURE__ */ a(qs, {}),
3493
3510
  /* @__PURE__ */ a(Is, {}),
3494
3511
  /* @__PURE__ */ a(Fs, {}),
3495
- _ && /* @__PURE__ */ a("div", { className: "gs-loading-overlay", children: /* @__PURE__ */ a("div", { className: "gs-loading-spinner" }) })
3512
+ ce && /* @__PURE__ */ a("div", { className: "gs-loading-overlay", children: /* @__PURE__ */ a("div", { className: "gs-loading-spinner" }) })
3496
3513
  ]
3497
3514
  }
3498
3515
  )
@@ -3501,24 +3518,24 @@ function Ar({
3501
3518
  ) });
3502
3519
  }
3503
3520
  const yr = (e) => {
3504
- var s, o, i, l, f;
3521
+ var s, o, i, l, h;
3505
3522
  const n = on(e);
3506
- let t = ((s = e[0]) == null ? void 0 : s.height) ?? hs;
3507
- for (let h = 1; h <= n.numRows; h++) {
3508
- const c = be(h), d = ((o = e == null ? void 0 : e[c]) == null ? void 0 : o.height) || ((i = e == null ? void 0 : e["0" + c]) == null ? void 0 : i.height) || ((l = e == null ? void 0 : e[ms]) == null ? void 0 : l.height) || ((f = e == null ? void 0 : e.default) == null ? void 0 : f.height) || bt;
3523
+ let t = ((s = e[0]) == null ? void 0 : s.height) ?? fs;
3524
+ for (let f = 1; f <= n.numRows; f++) {
3525
+ const c = be(f), d = ((o = e == null ? void 0 : e[c]) == null ? void 0 : o.height) || ((i = e == null ? void 0 : e["0" + c]) == null ? void 0 : i.height) || ((l = e == null ? void 0 : e[ms]) == null ? void 0 : l.height) || ((h = e == null ? void 0 : e.default) == null ? void 0 : h.height) || bt;
3509
3526
  if (t + d > Kt)
3510
3527
  return Kt;
3511
3528
  t += d;
3512
3529
  }
3513
3530
  return t + 3;
3514
3531
  }, vr = (e) => {
3515
- var s, o, i, l, f;
3532
+ var s, o, i, l, h;
3516
3533
  const n = on(e);
3517
3534
  let t = ((s = e[0]) == null ? void 0 : s.width) ?? ps;
3518
- for (let h = 1; h <= n.numCols; h++) {
3519
- const c = pe(h), d = ((o = e == null ? void 0 : e[c]) == null ? void 0 : o.width) || ((i = e == null ? void 0 : e[c + "0"]) == null ? void 0 : i.width) || ((l = e == null ? void 0 : e[ys]) == null ? void 0 : l.width) || ((f = e == null ? void 0 : e.default) == null ? void 0 : f.width) || vt;
3520
- if (t + d > Zt)
3521
- return Zt;
3535
+ for (let f = 1; f <= n.numCols; f++) {
3536
+ const c = pe(f), d = ((o = e == null ? void 0 : e[c]) == null ? void 0 : o.width) || ((i = e == null ? void 0 : e[c + "0"]) == null ? void 0 : i.width) || ((l = e == null ? void 0 : e[ys]) == null ? void 0 : l.width) || ((h = e == null ? void 0 : e.default) == null ? void 0 : h.width) || vt;
3537
+ if (t + d > Wt)
3538
+ return Wt;
3522
3539
  t += d;
3523
3540
  }
3524
3541
  return t + 3;
@@ -3553,12 +3570,12 @@ export {
3553
3570
  kt as MenuItem,
3554
3571
  Lr as Pending,
3555
3572
  Br as PercentagePolicyMixin,
3556
- Er as PluginBase,
3573
+ xr as PluginBase,
3557
3574
  Kr as Policy,
3558
- Zr as RangeEntity,
3559
- Ur as RefEntity,
3560
- zr as Registry,
3561
- Wr as Sheet,
3575
+ Wr as RangeEntity,
3576
+ Zr as RefEntity,
3577
+ Ur as Registry,
3578
+ zr as Sheet,
3562
3579
  _r as Spilling,
3563
3580
  jr as ThousandSeparatorPolicyMixin,
3564
3581
  Vr as Time,
@@ -3568,7 +3585,7 @@ export {
3568
3585
  Jr as addressesToAreas,
3569
3586
  eo as addressesToCols,
3570
3587
  to as addressesToRows,
3571
- xr as applyers,
3588
+ Er as applyers,
3572
3589
  no as areaToRange,
3573
3590
  so as areaToZone,
3574
3591
  ro as buildInitialCells,
@@ -3580,13 +3597,13 @@ export {
3580
3597
  co as conditionArg,
3581
3598
  uo as createBook,
3582
3599
  go as createBooleanMask,
3583
- fo as createRegistry,
3600
+ ho as createRegistry,
3584
3601
  kr as createSheetRef,
3585
3602
  Tr as createStoreRef,
3586
3603
  Ks as defaultColMenuDescriptors,
3587
3604
  Ls as defaultContextMenuDescriptors,
3588
3605
  Bs as defaultRowMenuDescriptors,
3589
- ho as eachMatrix,
3606
+ fo as eachMatrix,
3590
3607
  mo as ensureBoolean,
3591
3608
  po as ensureDate,
3592
3609
  yo as ensureNumber,
@@ -3597,11 +3614,11 @@ export {
3597
3614
  Ro as operations,
3598
3615
  Co as p2a,
3599
3616
  So as r2y,
3600
- xt as registerMenuComponent,
3617
+ Et as registerMenuComponent,
3601
3618
  No as rh,
3602
3619
  ks as sheet2csv,
3603
- Eo as stripMatrix,
3604
- xo as toCellCols,
3620
+ xo as stripMatrix,
3621
+ Eo as toCellCols,
3605
3622
  ko as toCellMatrix,
3606
3623
  To as toCellObject,
3607
3624
  Ao as toCellRows,
@@ -3609,7 +3626,7 @@ export {
3609
3626
  Do as toValueMatrix,
3610
3627
  Io as toValueObject,
3611
3628
  Fo as toValueRows,
3612
- ze as updateSheet,
3629
+ Ue as updateSheet,
3613
3630
  Ns as useBook,
3614
3631
  Nr as useInitialPluginContext,
3615
3632
  kn as usePluginContext,