@sheetxl/grid-react 0.3.2 → 0.3.4

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license @sheetxl/grid-react - Grid - Advanced data grid component for React - v0.3.2
2
+ * @license @sheetxl/grid-react - Grid - Advanced data grid component for React - v0.3.4
3
3
  *
4
4
  * (C) 2025-present SheetXL Inc. & Michael T. Ford
5
5
  * License: The license can be found at https://www.sheetxl.com/license.
@@ -14,7 +14,7 @@ import { unstable_batchedUpdates as y, createPortal as v } from "react-dom";
14
14
  import b from "tiny-invariant";
15
15
  const S = "up", E = "down", _ = "left", I = "right", C = "tl", M = "t", T = "l", k = "c", R = "text/html", P = "text/plain", O = "image/png", L = Object.freeze({ left: 0, top: 0 }), D = Object.freeze({ left: 0, top: 0, bottom: 0, right: 0 }), z = Object.freeze({ x: 0, y: 0, width: 0, height: 0 });
16
16
  Object.freeze(Object.defineProperty({ __proto__: null, EmptyBounds: z, EmptyRect: D, EmptyTopLeft: L }, Symbol.toStringTag, { value: "Module" }));
17
- const A = "column", $ = "row", B = Object.freeze({ colIndex: 0, rowIndex: 0 }), F = Object.freeze({ colStart: 0, rowStart: 0, colEnd: 0, rowEnd: 0 }), j = (e5, t2) => e5.colStart === t2.colStart ? e5.rowStart - t2.rowStart : e5.colStart - t2.colStart, V = (e5, t2) => e5.rowStart === t2.rowStart ? e5.colStart - t2.colStart : e5.rowStart - t2.rowStart, W = (e5, t2) => e5.rowEnd === t2.rowEnd ? t2.colEnd - e5.colEnd : t2.rowEnd - e5.rowEnd, H = (e5, t2) => e5.colEnd === t2.colEnd ? t2.rowEnd - e5.rowEnd : t2.colEnd - e5.colEnd, N = (e5, t2) => e5.colIndex === t2.colIndex ? e5.rowIndex - t2.rowIndex : e5.colIndex - t2.colIndex, U = (e5, t2) => e5.rowIndex === t2.rowIndex ? e5.colIndex - t2.colIndex : e5.rowIndex - t2.rowIndex, q = (e5 = $, t2 = false) => t2 ? e5 !== A ? W : H : e5 !== A ? V : j, K = (e5, t2) => e5 === t2 || !(!e5 || !t2) && e5.rowIndex === t2.rowIndex && e5.colIndex === t2.colIndex, Y = (e5, t2) => e5 === t2 || !(!e5 || !t2) && e5.rowStart === t2.rowStart && e5.rowEnd === t2.rowEnd && e5.colStart === t2.colStart && e5.colEnd === t2.colEnd, X = (e5, t2) => !(!e5 || !t2 || e5.colStart > t2.colEnd || t2.colStart > e5.colEnd || e5.rowStart > t2.rowEnd || t2.rowStart > e5.rowEnd), G = (e5, t2) => {
17
+ const A = "column", $ = "row", B = Object.freeze({ colIndex: 0, rowIndex: 0 }), F = Object.freeze({ colStart: 0, rowStart: 0, colEnd: 0, rowEnd: 0 }), j = (e5, t2) => e5.colStart === t2.colStart ? e5.rowStart - t2.rowStart : e5.colStart - t2.colStart, V = (e5, t2) => e5.rowStart === t2.rowStart ? e5.colStart - t2.colStart : e5.rowStart - t2.rowStart, W = (e5, t2) => e5.rowEnd === t2.rowEnd ? t2.colEnd - e5.colEnd : t2.rowEnd - e5.rowEnd, H = (e5, t2) => e5.colEnd === t2.colEnd ? t2.rowEnd - e5.rowEnd : t2.colEnd - e5.colEnd, N = (e5, t2) => e5.colIndex === t2.colIndex ? e5.rowIndex - t2.rowIndex : e5.colIndex - t2.colIndex, U = (e5, t2) => e5.rowIndex === t2.rowIndex ? e5.colIndex - t2.colIndex : e5.rowIndex - t2.rowIndex, K = (e5 = $, t2 = false) => t2 ? e5 !== A ? W : H : e5 !== A ? V : j, q = (e5, t2) => e5 === t2 || !(!e5 || !t2) && e5.rowIndex === t2.rowIndex && e5.colIndex === t2.colIndex, Y = (e5, t2) => e5 === t2 || !(!e5 || !t2) && e5.rowStart === t2.rowStart && e5.rowEnd === t2.rowEnd && e5.colStart === t2.colStart && e5.colEnd === t2.colEnd, X = (e5, t2) => !(!e5 || !t2 || e5.colStart > t2.colEnd || t2.colStart > e5.colEnd || e5.rowStart > t2.rowEnd || t2.rowStart > e5.rowEnd), G = (e5, t2) => {
18
18
  if (e5 === t2) return true;
19
19
  if (!e5 || !t2) return false;
20
20
  if (e5.length !== t2.length) return false;
@@ -43,7 +43,7 @@ function te(e5, t2 = 2, n2, o2 = $, r2) {
43
43
  if (t2 <= 0 || e5.length <= 1) return i2;
44
44
  let l2 = o2 === A, s2 = 0, c2 = false;
45
45
  do {
46
- const e6 = i2.sort(q(l2 ? $ : A));
46
+ const e6 = i2.sort(K(l2 ? $ : A));
47
47
  i2 = [], i2.push(e6[0]);
48
48
  const t3 = e6.length;
49
49
  let a2 = 0, d2 = e6[0], u2 = d2.colStart, h2 = d2.rowStart, f2 = d2.colEnd, p2 = d2.rowEnd;
@@ -86,7 +86,7 @@ const ne = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCell: B,
86
86
  const h2 = t2 ? s2 : c2, f2 = t2 ? c2 : s2;
87
87
  o2 = { colStart: h2, rowStart: f2, colEnd: h2, rowEnd: f2 }, u2 && (o2.value = a2), i2 = s2, l2 = c2, r2 = a2;
88
88
  }, done: (e6) => (o2 && (n2.push(o2), o2 = null), e6 ? te(n2, 3, true === e6 ? ee : e6, t2 ? A : $, Q) : n2) };
89
- }, createRangeComparator: q, defaultRange: (e5, t2, n2) => e5 ? n2 ? (n2.colStart = e5.colStart ?? t2.colStart, n2.rowStart = e5.rowStart ?? t2.rowStart, n2.colEnd = e5.colEnd ?? t2.colEnd, n2.rowEnd = e5.rowEnd ?? t2.rowEnd, n2) : { colStart: e5.colStart ?? t2.colStart, rowStart: e5.rowStart ?? t2.rowStart, colEnd: e5.colEnd ?? t2.colEnd, rowEnd: e5.rowEnd ?? t2.rowEnd } : t2, extendRangeToIntersectingRanges: J, extendRangeToUnionRanges: (e5, t2) => {
89
+ }, createRangeComparator: K, defaultRange: (e5, t2, n2) => e5 ? n2 ? (n2.colStart = e5.colStart ?? t2.colStart, n2.rowStart = e5.rowStart ?? t2.rowStart, n2.colEnd = e5.colEnd ?? t2.colEnd, n2.rowEnd = e5.rowEnd ?? t2.rowEnd, n2) : { colStart: e5.colStart ?? t2.colStart, rowStart: e5.rowStart ?? t2.rowStart, colEnd: e5.colEnd ?? t2.colEnd, rowEnd: e5.rowEnd ?? t2.rowEnd } : t2, extendRangeToIntersectingRanges: J, extendRangeToUnionRanges: (e5, t2) => {
90
90
  if (!t2 || 0 === t2.length) return e5;
91
91
  let n2 = e5, o2 = null;
92
92
  for (; !Y(n2, o2); ) o2 = n2, n2 = J(o2, t2);
@@ -103,7 +103,7 @@ const ne = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCell: B,
103
103
  const o2 = Math.max(e5.colStart, t2.colStart), r2 = Math.max(e5.rowStart, t2.rowStart), i2 = Math.min(e5.colEnd, t2.colEnd), l2 = Math.min(e5.rowEnd, t2.rowEnd);
104
104
  let s2 = n2;
105
105
  return s2 ? (s2.colStart = o2, s2.rowStart = r2, s2.colEnd = i2, s2.rowEnd = l2) : s2 = { colStart: o2, rowStart: r2, colEnd: i2, rowEnd: l2 }, s2;
106
- }, isCellWithinRange: (e5, t2) => !(!e5 || !t2 || e5.rowIndex < t2.rowStart || e5.rowIndex > t2.rowEnd || e5.colIndex < t2.colStart || e5.colIndex > t2.colEnd), isEqualCells: K, isEqualRanges: Y, isEqualRangesArrays: G, isEqualSelectionCoords: (e5, t2) => e5 === t2 || !(!e5 || !t2) && e5.rangeIndex === t2.rangeIndex && !!K(e5.cell, t2.cell) && G(e5.ranges, t2.ranges), isRangeWithinRange: (e5, t2) => !(e5.rowStart < t2.rowStart || e5.rowEnd > t2.rowEnd || e5.colStart < t2.colStart || e5.colEnd > t2.colEnd), isRangesIntersect: X, isSingleCell: (e5) => !!e5 && e5.rowEnd === e5.rowStart && e5.colStart === e5.colEnd, isValidRange: (e5) => !(!e5 || "number" != typeof e5.colStart || e5.colStart < 0 || "number" != typeof e5.colEnd || e5.colEnd < e5.colStart || "number" != typeof e5.rowStart || e5.rowStart < 0 || "number" != typeof e5.rowEnd || e5.rowEnd < e5.rowStart), mergeRangedValues: te, rowFirstCellComparator: U, rowFirstRangeComparator: V, sanitizeRange: (e5) => e5 ? { colStart: e5.colIndex ?? e5.colStart ?? 0, rowStart: e5.rowIndex ?? e5.rowStart ?? 0, colEnd: e5.colIndex ?? e5.colEnd ?? 0, rowEnd: e5.rowIndex ?? e5.rowEnd ?? 0 } : null, translateRange: (e5, t2 = -e5.rowStart, n2 = -e5.colStart, o2) => o2 ? (o2.colStart = e5.colStart + n2, o2.rowStart = e5.rowStart + t2, o2.colEnd = e5.colEnd + n2, o2.rowEnd = e5.rowEnd + t2, o2) : { colStart: e5.colStart + n2, rowStart: e5.rowStart + t2, colEnd: e5.colEnd + n2, rowEnd: e5.rowEnd + t2 }, unionRanges: Z, unionRangesArrays: (e5, t2, n2) => {
106
+ }, isCellWithinRange: (e5, t2) => !(!e5 || !t2 || e5.rowIndex < t2.rowStart || e5.rowIndex > t2.rowEnd || e5.colIndex < t2.colStart || e5.colIndex > t2.colEnd), isEqualCells: q, isEqualRanges: Y, isEqualRangesArrays: G, isEqualSelectionCoords: (e5, t2) => e5 === t2 || !(!e5 || !t2) && e5.rangeIndex === t2.rangeIndex && !!q(e5.cell, t2.cell) && G(e5.ranges, t2.ranges), isRangeWithinRange: (e5, t2) => !(e5.rowStart < t2.rowStart || e5.rowEnd > t2.rowEnd || e5.colStart < t2.colStart || e5.colEnd > t2.colEnd), isRangesIntersect: X, isSingleCell: (e5) => !!e5 && e5.rowEnd === e5.rowStart && e5.colStart === e5.colEnd, isValidRange: (e5) => !(!e5 || "number" != typeof e5.colStart || e5.colStart < 0 || "number" != typeof e5.colEnd || e5.colEnd < e5.colStart || "number" != typeof e5.rowStart || e5.rowStart < 0 || "number" != typeof e5.rowEnd || e5.rowEnd < e5.rowStart), mergeRangedValues: te, rowFirstCellComparator: U, rowFirstRangeComparator: V, sanitizeRange: (e5) => e5 ? { colStart: e5.colIndex ?? e5.colStart ?? 0, rowStart: e5.rowIndex ?? e5.rowStart ?? 0, colEnd: e5.colIndex ?? e5.colEnd ?? 0, rowEnd: e5.rowIndex ?? e5.rowEnd ?? 0 } : null, translateRange: (e5, t2 = -e5.rowStart, n2 = -e5.colStart, o2) => o2 ? (o2.colStart = e5.colStart + n2, o2.rowStart = e5.rowStart + t2, o2.colEnd = e5.colEnd + n2, o2.rowEnd = e5.rowEnd + t2, o2) : { colStart: e5.colStart + n2, rowStart: e5.rowStart + t2, colEnd: e5.colEnd + n2, rowEnd: e5.rowEnd + t2 }, unionRanges: Z, unionRangesArrays: (e5, t2, n2) => {
107
107
  if (!e5 || 0 === e5.length) return null;
108
108
  if (1 === e5.length && !t2) return e5[0];
109
109
  let o2 = e5[0];
@@ -613,7 +613,7 @@ const We = async (e5, t2 = R) => new Promise(async (n2, o2) => {
613
613
  console.warn("Can't parse html from clipboard.");
614
614
  }
615
615
  return o2;
616
- }, Ne = "clipboard-uuid", Ue = "web text/uuid", qe = (e5) => `<div style="display:none" ${Ne}="${e5}"/>`, Ke = (e5, t2) => {
616
+ }, Ne = "clipboard-uuid", Ue = "web text/uuid", Ke = (e5) => `<div style="display:none" ${Ne}="${e5}"/>`, qe = (e5, t2) => {
617
617
  let n2 = null;
618
618
  try {
619
619
  const o2 = new DOMParser().parseFromString(t2, R);
@@ -691,13 +691,13 @@ class Xe {
691
691
  t2._state = { uuid: o2, ref: e5.ref, items: n2 }, t2.dispatchEvent(new Event("clipboardwrite")), t2.dispatchEvent(new Event("clipboardchange"));
692
692
  };
693
693
  await je("clipboard-write", async () => {
694
- await Fe(), o2 && 0 === r2.length && (r2.push(new ClipboardItem({ [Ue]: new Blob([o2], { type: Ue }) })), r2.push(new ClipboardItem({ [R]: new Blob([qe(o2)], { type: R }) })));
694
+ await Fe(), o2 && 0 === r2.length && (r2.push(new ClipboardItem({ [Ue]: new Blob([o2], { type: Ue }) })), r2.push(new ClipboardItem({ [R]: new Blob([Ke(o2)], { type: R }) })));
695
695
  for (let e6 = 0; e6 < Math.min(1, r2.length); e6++) {
696
696
  const t3 = r2[e6];
697
697
  let i3 = t3.types.indexOf(R), l2 = null;
698
698
  if (-1 !== i3) {
699
699
  const e7 = await t3.getType(R);
700
- l2 = await ke(e7), l2 && (l2 = Ke(o2, l2));
700
+ l2 = await ke(e7), l2 && (l2 = qe(o2, l2));
701
701
  }
702
702
  if (!l2 && t3.types.includes(P)) {
703
703
  const e7 = await t3.getType(P);
@@ -710,7 +710,7 @@ class Xe {
710
710
  const e7 = await t3.getType(O), n3 = Te(await e7.arrayBuffer());
711
711
  l2 = `<div ${Ne}="${o2}"><img src="${Re + n3}"/></div>`;
712
712
  }
713
- !l2 && o2 && (l2 = qe(o2));
713
+ !l2 && o2 && (l2 = Ke(o2));
714
714
  const s2 = new Blob([l2 ?? ""], { type: R }), c2 = {};
715
715
  for (let e7 = 0; e7 < t3.types.length; e7++) {
716
716
  const n3 = t3.types[e7];
@@ -861,25 +861,25 @@ const Ot = r(a((n2, o2) => {
861
861
  const e5 = H2.current;
862
862
  H2.current = null, r2 !== e5 && (M2.current[A2] = r2);
863
863
  }, [r2, A2]);
864
- const U2 = l(null), q2 = l(null), K2 = i(() => {
865
- U2.current && (clearTimeout(U2.current), U2.current = null, q2.current = null);
864
+ const U2 = l(null), K2 = l(null), q2 = i(() => {
865
+ U2.current && (clearTimeout(U2.current), U2.current = null, K2.current = null);
866
866
  }, []), Y2 = i((e5, t2, n3, o3 = b2) => {
867
- q2.current = e5, U2.current = setTimeout(() => {
868
- const t3 = n3 ? V2(q2.current || e5) : W2(q2.current || e5);
869
- t3 !== q2.current ? Y2(t3, false, n3, S2) : K2();
867
+ K2.current = e5, U2.current = setTimeout(() => {
868
+ const t3 = n3 ? V2(K2.current || e5) : W2(K2.current || e5);
869
+ t3 !== K2.current ? Y2(t3, false, n3, S2) : q2();
870
870
  }, t2 ? 0 : o3);
871
- }, [V2, W2, K2]);
872
- s(() => () => K2(), [K2]);
871
+ }, [V2, W2, q2]);
872
+ s(() => () => q2(), [q2]);
873
873
  const X2 = r2, G2 = d(() => {
874
874
  if (!y2) return null;
875
- const e5 = { orientation: p2, disabled: Math.floor(X2) <= 0 || 0 === Math.floor(B2 - $2), onMouseUp: K2, onMouseLeave: K2, onMouseDown: () => Y2(X2, true, true) };
875
+ const e5 = { orientation: p2, disabled: Math.floor(X2) <= 0 || 0 === Math.floor(B2 - $2), onMouseUp: q2, onMouseLeave: q2, onMouseDown: () => Y2(X2, true, true) };
876
876
  return E2?.(e5);
877
877
  }, [y2, p2, X2, F2, B2, $2]), Z2 = d(() => {
878
878
  if (!y2) return null;
879
- const e5 = { orientation: p2, disabled: Math.floor(B2 - $2) <= Math.ceil(X2), onMouseUp: K2, onMouseLeave: K2, onMouseDown: () => Y2(X2, true, false) };
879
+ const e5 = { orientation: p2, disabled: Math.floor(B2 - $2) <= Math.ceil(X2), onMouseUp: q2, onMouseLeave: q2, onMouseDown: () => Y2(X2, true, false) };
880
880
  return _2?.(e5);
881
881
  }, [y2, p2, X2, F2, B2, $2]);
882
- return t("div", { ref: o2, style: { display: "flex", flex: "1", flexDirection: D2 ? "column" : "row", padding: "0", ...u2 }, className: g("_sheetxl-scrollbar_18qzf_11", f2), ...I2, children: [G2, e("div", { className: "pseudo-scrollbar", style: { flex: "1 1 100%", display: "flex", boxSizing: "content-box", flexDirection: D2 ? "column" : "row", justifyContent: "center", alignItems: "center" }, ref: T2, children: e("div", { tabIndex: -1, style: { flex: "1 1 100%", overflowY: D2 ? "scroll" : "hidden", overflowX: D2 ? "hidden" : "scroll", position: "relative", willChange: "transform" }, onScroll: N2, ref: M2, children: e("div", { ref: P2, style: { position: "absolute", height: D2 ? c2 - a2 + (R2 ?? 0) : 1, width: D2 ? 1 : c2 - a2 + (k2 ?? 0) }, className: "scrollbar-viewport" }) }) }), Z2] });
882
+ return t("div", { ref: o2, style: { display: "flex", flex: "1", flexDirection: D2 ? "column" : "row", padding: "0", ...u2 }, className: g("_sheetxl-scrollbar_eblx4_6", f2), ...I2, children: [G2, e("div", { className: "pseudo-scrollbar", style: { flex: "1 1 100%", display: "flex", boxSizing: "content-box", flexDirection: D2 ? "column" : "row", justifyContent: "center", alignItems: "center" }, ref: T2, children: e("div", { tabIndex: -1, style: { flex: "1 1 100%", overflowY: D2 ? "scroll" : "hidden", overflowX: D2 ? "hidden" : "scroll", position: "relative", willChange: "transform" }, onScroll: N2, ref: M2, children: e("div", { ref: P2, style: { position: "absolute", height: D2 ? c2 - a2 + (R2 ?? 0) : 1, width: D2 ? 1 : c2 - a2 + (k2 ?? 0) }, className: "scrollbar-viewport" }) }) }), Z2] });
883
883
  }));
884
884
  Ot.displayName = "Scrollbar";
885
885
  let Lt = Date.now, Dt = {}, zt = 1;
@@ -1058,8 +1058,8 @@ const Ut = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCssProper
1058
1058
  n2 = true, e5.stopPropagation();
1059
1059
  }, isPropagationStopped: () => n2, persist: () => {
1060
1060
  }, timeStamp: e5.timeStamp, type: e5.type };
1061
- }, detectIt: Nt, focusableNodeNames: Wt, toPrettyKeyCode: (e5) => "BracketLeft" === e5 ? "[" : "BracketRight" === e5 ? "]" : Me.camelToPrettyCase(e5) }, Symbol.toStringTag, { value: "Module" })), qt = [];
1062
- function Kt(e5, t2, n2 = qt) {
1061
+ }, detectIt: Nt, focusableNodeNames: Wt, toPrettyKeyCode: (e5) => "BracketLeft" === e5 ? "[" : "BracketRight" === e5 ? "]" : Me.camelToPrettyCase(e5) }, Symbol.toStringTag, { value: "Module" })), Kt = [];
1062
+ function qt(e5, t2, n2 = Kt) {
1063
1063
  const o2 = l(null);
1064
1064
  return c(e5, () => {
1065
1065
  if (!o2.current) return;
@@ -1074,7 +1074,7 @@ function Kt(e5, t2, n2 = qt) {
1074
1074
  }, n2), o2;
1075
1075
  }
1076
1076
  const Yt = (t2) => e(Ot, { ...t2 }), Xt = ({ width: t2, height: n2 }) => e("div", { className: "corner", style: { minWidth: `${t2}px`, width: `${t2}px`, minHeight: `${n2}px`, height: `${n2}px` } }), Gt = r(a((o2, r2) => {
1077
- const { children: c2, viewport: a2, onScrollViewport: u2, showHorizontalScrollbar: h2 = true, showVerticalScrollbar: f2 = true, createScrollCorner: p2 = Xt, createHorizontalScrollbar: g2 = Yt, createVerticalScrollbar: m2 = Yt, style: x2, touchElement: y2, disableTouch: v2, ...b2 } = o2, S2 = Tt(u2, [u2]), E2 = Kt(r2, () => ({ isScrollPane: () => true }), []), _2 = l(null);
1077
+ const { children: c2, viewport: a2, onScrollViewport: u2, showHorizontalScrollbar: h2 = true, showVerticalScrollbar: f2 = true, createScrollCorner: p2 = Xt, createHorizontalScrollbar: g2 = Yt, createVerticalScrollbar: m2 = Yt, style: x2, touchElement: y2, disableTouch: v2, ...b2 } = o2, S2 = Tt(u2, [u2]), E2 = qt(r2, () => ({ isScrollPane: () => true }), []), _2 = l(null);
1078
1078
  s(() => {
1079
1079
  _2.current && (_2.current.__scrollTop === a2?.top && _2.current.__scrollLeft !== !a2?.left || _2.current?.scrollTo(a2?.left, a2?.top, false));
1080
1080
  }, [a2?.left, a2?.top, y2]);
@@ -1125,7 +1125,7 @@ function Qt() {
1125
1125
  const e6 = document.fullscreenElement;
1126
1126
  if (!e6) return;
1127
1127
  let t2 = e6.querySelector(".fullscreen-portal-root");
1128
- t2 || (t2 = document.createElement("div"), t2.className = "fullscreen-portal-root _fullscreen-portal-root_5qk7s_7", e6.appendChild(t2));
1128
+ t2 || (t2 = document.createElement("div"), t2.className = "fullscreen-portal-root _fullscreen-portal-root_1mjsr_4", e6.appendChild(t2));
1129
1129
  }
1130
1130
  return Jt++, e5(), document.addEventListener("fullscreenchange", e5), () => {
1131
1131
  document.removeEventListener("fullscreenchange", e5), Jt--, Jt <= 0 && (document.querySelectorAll(".fullscreen-portal-root").forEach((e6) => {
@@ -1281,32 +1281,32 @@ r(a((n2, r2) => {
1281
1281
  s(() => {
1282
1282
  B2(un(f2, null === u2));
1283
1283
  }, [f2, u2]);
1284
- const [F2, { width: j2, height: V2 }] = w(), [W2, { width: H2, height: N2 }] = w(), U2 = "row" === a2 ? H2 : N2, q2 = "row" === a2 ? j2 : V2, K2 = d(() => ((e5, t2, n3, o2) => {
1284
+ const [F2, { width: j2, height: V2 }] = w(), [W2, { width: H2, height: N2 }] = w(), U2 = "row" === a2 ? H2 : N2, K2 = "row" === a2 ? j2 : V2, q2 = d(() => ((e5, t2, n3, o2) => {
1285
1285
  const r3 = [null, null], i3 = [null, null];
1286
1286
  if (e5 || (e5 = { percent: null === o2.fixedPaneOffset ? 50 : null, pixels: null === o2.fixedPaneOffset ? null : 0 }), 0 === t2) return null != e5?.pixels ? 1 !== o2.fixedPaneOffset ? (r3[0] = e5?.pixels, i3[1] = 100) : (r3[1] = e5?.pixels - n3, i3[0] = 100) : null != e5?.percent && (1 !== o2.fixedPaneOffset ? (i3[0] = e5?.percent, i3[1] = 100 - e5?.percent) : (i3[1] = e5?.percent, i3[0] = 100 - e5?.percent)), { percents: i3, pixels: r3, minBefore: dn(o2.minBefore, true), maxBefore: dn(o2.maxBefore, true), minAfter: dn(o2.minAfter), maxAfter: dn(o2.maxAfter) };
1287
1287
  let l2 = an(e5, t2, 1 !== o2.fixedPaneOffset), s2 = t2 - n3, c3 = an(o2.minBefore, s2, true) ?? 0, a3 = an(o2.maxBefore, s2, true) ?? s2, d2 = 0, u3 = 0, h2 = 0, f3 = s2;
1288
1288
  d2 = (an(o2.maxAfter, t2, false) ?? n3) - n3, u3 = an(o2.minAfter, t2, false) ?? t2, h2 = Math.max(c3, d2), f3 = Math.min(a3, u3), l2 = Math.max(h2, Math.min(l2, f3)), u3 = Math.min(s2 - l2, an(o2.maxAfter, s2 - l2, true) ?? s2), d2 = Math.min(s2 - l2, an(o2.minAfter, s2 - l2, true) ?? s2), r3[0] = l2, r3[1] = s2 - r3[0];
1289
1289
  const p3 = Math.max(0, Math.min(100, l2 / s2 * 100));
1290
1290
  return i3[0] = p3, i3[1] = 100 - i3[0], { percents: i3, pixels: r3, minBefore: `${c3}px`, minAfter: `${d2}px`, maxBefore: `${r3[0]}px`, maxAfter: `${r3[1]}px` };
1291
- })($2, q2, U2, z2), [z2, $2, q2, U2, a2]), [Y2, X2] = h(false), G2 = Tt(C2, [C2]), Z2 = Tt(M2, [M2]), J2 = Tt(T2, [T2]), Q2 = l(null), ee2 = l(null), te2 = l(null), { style: ne2, className: oe2, ...re2 } = R2, ie2 = { minWidth: 0, minHeight: 0, maxWidth: "100%", maxHeight: "100%", display: "flex", overflow: "hidden", ...ne2 }, { className: le2, style: se2, ...ce2 } = P2, { className: ae2, style: de2, ...ue2 } = O2, he2 = { flex: "1 1 100%", width: "100%", ..._2, flexDirection: a2, display: "flex" }, { className: fe2, style: pe2, onPointerDown: ge2, ...we2 } = k2, me2 = Tt((e5) => {
1291
+ })($2, K2, U2, z2), [z2, $2, K2, U2, a2]), [Y2, X2] = h(false), G2 = Tt(C2, [C2]), Z2 = Tt(M2, [M2]), J2 = Tt(T2, [T2]), Q2 = l(null), ee2 = l(null), te2 = l(null), { style: ne2, className: oe2, ...re2 } = R2, ie2 = { minWidth: 0, minHeight: 0, maxWidth: "100%", maxHeight: "100%", display: "flex", overflow: "hidden", ...ne2 }, { className: le2, style: se2, ...ce2 } = P2, { className: ae2, style: de2, ...ue2 } = O2, he2 = { flex: "1 1 100%", width: "100%", ..._2, flexDirection: a2, display: "flex" }, { className: fe2, style: pe2, onPointerDown: ge2, ...we2 } = k2, me2 = Tt((e5) => {
1292
1292
  const t2 = un(e5, null === u2);
1293
1293
  B2(t2);
1294
1294
  }, [u2]), xe2 = Tt((e5) => {
1295
1295
  if (I2 || !Y2) return;
1296
1296
  const t2 = be2.current?.getBoundingClientRect();
1297
1297
  let n3 = 0;
1298
- n3 = "row" === a2 ? (e5.clientX ?? e5.touches?.[0]?.clientX) - t2.x : (e5.clientY ?? e5.touches?.[0]?.clientY) - t2.y, n3 = Math.max(0, Math.min(q2, n3)), 1 === z2.fixedPaneOffset && (n3 = q2 - n3), f2 && $2.pixels === n3 || B2({ pixels: n3, percent: null }), Z2?.(n3), e5.stopPropagation(), e5.preventDefault();
1299
- }, [z2, a2, I2, Y2, $2, q2]), ye2 = Tt((e5) => {
1298
+ n3 = "row" === a2 ? (e5.clientX ?? e5.touches?.[0]?.clientX) - t2.x : (e5.clientY ?? e5.touches?.[0]?.clientY) - t2.y, n3 = Math.max(0, Math.min(K2, n3)), 1 === z2.fixedPaneOffset && (n3 = K2 - n3), f2 && $2.pixels === n3 || B2({ pixels: n3, percent: null }), Z2?.(n3), e5.stopPropagation(), e5.preventDefault();
1299
+ }, [z2, a2, I2, Y2, $2, K2]), ye2 = Tt((e5) => {
1300
1300
  if (document.removeEventListener("pointermove", xe2), document.removeEventListener("touchmove", xe2), document.removeEventListener("pointerup", ye2), Y2 && (X2(false), $2)) {
1301
1301
  if (J2($2.pixels), !un(f2, null === u2) || $2.pixels !== f2) {
1302
1302
  const e6 = { ...$2 };
1303
- null === e6.percent && (e6.percent = e6.pixels / q2 * 100), A2(e6);
1303
+ null === e6.percent && (e6.percent = e6.pixels / K2 * 100), A2(e6);
1304
1304
  }
1305
1305
  e5.stopPropagation(), e5.preventDefault();
1306
1306
  }
1307
- }, [$2, Y2, f2, u2, q2]), ve2 = Tt((e5) => {
1307
+ }, [$2, Y2, f2, u2, K2]), ve2 = Tt((e5) => {
1308
1308
  ge2?.(e5), e5.defaultPrevented || I2 || Y2 || (X2(true), G2(), document.addEventListener("pointermove", xe2, { passive: false }), document.addEventListener("touchmove", xe2, { passive: false }), document.addEventListener("pointerup", ye2, { passive: false }));
1309
- }, [ge2]), be2 = Kt(r2, () => ({ setPosition: me2, isSplitPane: () => true }), []), Se2 = d(() => D2 ? L2?.({ key: "resizer", ref: m([W2, ee2]), className: g("resizer", fe2), onPointerDownCapture: ve2, style: { cursor: I2 ? void 0 : "row" === a2 ? "ew-resize" : "ns-resize", minWidth: "row" === a2 ? "2px" : void 0, minHeight: "row" !== a2 ? "2px" : void 0, boxSizing: "border-box", pointerEvents: "all", zIndex: 1, ...pe2 }, splitDirection: a2, disabled: I2, ...we2 }) : null, [D2, fe2, we2, a2, pe2, I2]), Ee2 = "row" === a2 ? "Width" : "Height", _e2 = { ...ie2, ...se2, flex: 0 === z2.fixedPaneOffset && null !== K2?.pixels[0] ? `0 0 ${Math.round(K2?.pixels[0])}px` : `1 1 ${Math.round(K2?.percents[0] ?? 100)}%`, [`min${Ee2}`]: K2?.minBefore, [`max${Ee2}`]: c2 ? K2?.maxBefore : "100%" }, Ie2 = { ...ie2, ...de2, flex: 1 === z2.fixedPaneOffset && null !== K2?.pixels[1] ? `0 0 ${Math.round(K2?.pixels[1])}px` : `1 1 ${Math.round(K2?.percents[1] ?? 100)}%`, [`min${Ee2}`]: K2?.minAfter, [`max${Ee2}`]: i2 ? K2?.maxAfter : "100%" }, Ce2 = d(() => i2 ? e("div", { ref: Q2, className: g("before", oe2, le2), style: _e2, ...re2, ...ce2, children: i2 }, "before") : null, [i2, R2, P2, z2, K2]), Me2 = d(() => c2 ? e("div", { ref: te2, className: g("after", oe2, ae2), style: Ie2, ...re2, ...ue2, children: c2 }, "after") : null, [c2, R2, O2, z2, K2]);
1309
+ }, [ge2]), be2 = qt(r2, () => ({ setPosition: me2, isSplitPane: () => true }), []), Se2 = d(() => D2 ? L2?.({ key: "resizer", ref: m([W2, ee2]), className: g("resizer", fe2), onPointerDownCapture: ve2, style: { cursor: I2 ? void 0 : "row" === a2 ? "ew-resize" : "ns-resize", minWidth: "row" === a2 ? "2px" : void 0, minHeight: "row" !== a2 ? "2px" : void 0, boxSizing: "border-box", pointerEvents: "all", zIndex: 1, ...pe2 }, splitDirection: a2, disabled: I2, ...we2 }) : null, [D2, fe2, we2, a2, pe2, I2]), Ee2 = "row" === a2 ? "Width" : "Height", _e2 = { ...ie2, ...se2, flex: 0 === z2.fixedPaneOffset && null !== q2?.pixels[0] ? `0 0 ${Math.round(q2?.pixels[0])}px` : `1 1 ${Math.round(q2?.percents[0] ?? 100)}%`, [`min${Ee2}`]: q2?.minBefore, [`max${Ee2}`]: c2 ? q2?.maxBefore : "100%" }, Ie2 = { ...ie2, ...de2, flex: 1 === z2.fixedPaneOffset && null !== q2?.pixels[1] ? `0 0 ${Math.round(q2?.pixels[1])}px` : `1 1 ${Math.round(q2?.percents[1] ?? 100)}%`, [`min${Ee2}`]: q2?.minAfter, [`max${Ee2}`]: i2 ? q2?.maxAfter : "100%" }, Ce2 = d(() => i2 ? e("div", { ref: Q2, className: g("before", oe2, le2), style: _e2, ...re2, ...ce2, children: i2 }, "before") : null, [i2, R2, P2, z2, q2]), Me2 = d(() => c2 ? e("div", { ref: te2, className: g("after", oe2, ae2), style: Ie2, ...re2, ...ue2, children: c2 }, "after") : null, [c2, R2, O2, z2, q2]);
1310
1310
  return t("div", { ref: m([F2, be2]), className: g("splitPane", "row" === a2 ? "vertical" : "horizontal", { dragging: Y2 }, E2), style: he2, children: [Ce2, Se2, Me2] });
1311
1311
  }));
1312
1312
  const fn = ({ initValue: e5, useHookBody: t2, applyStateChange: n2 }) => {
@@ -1585,38 +1585,38 @@ const kn = () => "sheetxl-ui-" + Mn++, Rn = o["useId".toString()], Pn = null !=
1585
1585
  return { x: u2.x ?? 0, y: u2.y ?? 0, height: Math.min(p2 - u2.y, u2.height) + 1, width: Math.min(f3 - u2.x, u2.width) + 1 };
1586
1586
  }, [E2]), k2 = Tt(o2, [o2]), R2 = i(() => {
1587
1587
  n2?.getStage()?.focus();
1588
- }, [n2]), P2 = Tt((e5) => {
1589
- c2?.(e5), W2(), I2(true);
1590
- }, [c2]), O2 = Tt((e5) => {
1588
+ }, [n2]), P2 = l(null), O2 = Tt((e5) => {
1589
+ c2?.(e5), H2(), I2(true), P2.current = null;
1590
+ }, [c2]), L2 = Tt((e5) => {
1591
1591
  a2?.(e5.coords);
1592
- }, [a2]), L2 = Tt((e5) => {
1593
- e5.isSubmitted || e5.isCancelled || (A2.current.isEditorClosed = true, R2(), e5.isCancelled = true, f2?.(e5.coords), W2());
1594
- }, [f2]), D2 = Tt((e5) => {
1592
+ }, [a2]), D2 = Tt((e5) => {
1593
+ e5.isSubmitted || e5.isCancelled || ($2.current.isEditorClosed = true, R2(), e5.isCancelled = true, f2?.(e5.coords), H2());
1594
+ }, [f2]), z2 = Tt((e5) => {
1595
1595
  if (e5.isSubmitted || e5.isCancelled) return false;
1596
1596
  try {
1597
- return e5.isEditorClosing = true, e5.isSubmitted = true, e5.isEditorSubmitted || (e5.isEditorSubmitted = true, e5.editorRefs[0]?.submitEdit?.()), e5.coords, d2?.(e5.coords), e5.isEditorClosed = true, R2(), W2(), true;
1597
+ return P2.current = e5.coords, e5.isEditorClosing = true, e5.isSubmitted = true, e5.isEditorSubmitted || (e5.isEditorSubmitted = true, e5.editorRefs[0]?.submitEdit?.()), e5.coords, d2?.(e5.coords), e5.isEditorClosed = true, R2(), H2(), true;
1598
1598
  } catch (t3) {
1599
1599
  throw e5.isEditorClosing = false, e5.isSubmitted = false, t3;
1600
1600
  }
1601
- }, [d2]), z2 = Tt((e5) => {
1602
- I2(false), g2?.(e5.coords), W2();
1603
- }, [g2]), A2 = l(null), $2 = l(null), B2 = l(null), F2 = l([]), [j2, V2] = p((e5) => e5 + 1, 0), W2 = i((e5) => {
1604
- e5 && F2.current.push(e5), V2();
1605
- }, []), H2 = Tt((e5) => {
1601
+ }, [d2]), A2 = Tt((e5) => {
1602
+ I2(false), g2?.(e5.coords), H2();
1603
+ }, [g2]), $2 = l(null), B2 = l(null), F2 = l(null), j2 = l([]), [V2, W2] = p((e5) => e5 + 1, 0), H2 = i((e5) => {
1604
+ e5 && j2.current.push(e5), W2();
1605
+ }, []), N2 = Tt((e5) => {
1606
1606
  if (e5.defaultPrevented || e5.isSynthetic) return;
1607
1607
  if (!n2) return;
1608
1608
  const t3 = n2?.getCellCoordsFromClient(e5.clientX, e5.clientY);
1609
1609
  if (!t3) return;
1610
- W2({ eventType: "pointer", event: e5, coords: t3 });
1611
- }, [n2]), N2 = Tt((e5) => {
1612
- const t3 = e5.nativeEvent;
1613
- H2(t3);
1610
+ H2({ eventType: "pointer", event: e5, coords: t3 });
1614
1611
  }, [n2]), U2 = Tt((e5) => {
1612
+ const t3 = e5.nativeEvent;
1613
+ N2(t3);
1614
+ }, [n2]), K2 = Tt((e5) => {
1615
1615
  if (e5.defaultPrevented || e5.isSynthetic) return;
1616
1616
  if (!n2?.getStage()) return;
1617
- const t3 = $2.current;
1617
+ const t3 = B2.current;
1618
1618
  w2(e5, t3) && (e5.stopPropagation(), e5.preventDefault()), e5.key;
1619
- W2({ eventType: "keyboard", event: e5, coords: t3 });
1619
+ H2({ eventType: "keyboard", event: e5, coords: t3 });
1620
1620
  }, [n2]);
1621
1621
  u(() => {
1622
1622
  const e5 = (e6, t4) => {
@@ -1624,20 +1624,20 @@ const kn = () => "sheetxl-ui-" + Mn++, Rn = o["useId".toString()], Pn = null !=
1624
1624
  if (!o4) return null;
1625
1625
  const r3 = o4;
1626
1626
  if (!k2(o4)) return null;
1627
- P2?.(o4);
1627
+ O2?.(o4);
1628
1628
  const i2 = Me.uuidV4();
1629
- t4 = Object.freeze({ autoFocus: true, ...t4 }), B2.current = o4;
1629
+ t4 = Object.freeze({ autoFocus: true, ...t4 }), F2.current = o4;
1630
1630
  const l2 = { coords: r3, startEvent: t4, uuid: i2, isMounted: false, isStarted: false, isSubmitted: false, isEditorSubmitted: false, isEditorClosing: false, isEditorClosed: false, isCancelled: false, events: [], editorRefsDispatchEditorEvent: [], editorRefs: [], onMount: (e7) => {
1631
- l2.isMounted || (l2.isMounted = true, W2());
1631
+ l2.isMounted || (l2.isMounted = true, H2());
1632
1632
  }, onUnmount: (e7) => {
1633
1633
  if (0 === l2.editorRefs.length) {
1634
1634
  const e8 = () => {
1635
- l2.isMounted = false, W2();
1635
+ l2.isMounted = false, H2();
1636
1636
  };
1637
1637
  if (document.activeElement !== document.body) e8();
1638
1638
  else {
1639
1639
  const t5 = (e9) => {
1640
- e9.defaultPrevented || e9.target !== document.body || U2(e9);
1640
+ e9.defaultPrevented || e9.target !== document.body || K2(e9);
1641
1641
  };
1642
1642
  window.addEventListener("keydown", t5, true), n2.getStage()?.addEventListener("focusin", () => {
1643
1643
  window.removeEventListener("keydown", t5), e8();
@@ -1647,102 +1647,103 @@ const kn = () => "sheetxl-ui-" + Mn++, Rn = o["useId".toString()], Pn = null !=
1647
1647
  } };
1648
1648
  return l2;
1649
1649
  };
1650
- if (F2.current.length <= 0 && !A2.current) return;
1651
- const t3 = F2.current[0];
1650
+ if (j2.current.length <= 0 && !$2.current) return;
1651
+ const t3 = j2.current[0];
1652
1652
  Bn(t3), ((e6) => {
1653
1653
  const t4 = [], n3 = e6?.length ?? 0;
1654
1654
  for (let o4 = 0; o4 < n3; o4++) {
1655
1655
  const n4 = e6[o4];
1656
1656
  t4.push(Bn(n4));
1657
1657
  }
1658
- })(F2.current), A2.current, A2.current;
1659
- let o3 = A2.current;
1660
- if (A2.current) {
1661
- if (A2.current.isDone) A2.current = null;
1662
- else if (A2.current.isSubmitted || A2.current.isCancelled) {
1663
- if (A2.current.isMounted) return;
1664
- A2.current.isDone || (z2(A2.current), A2.current.isDone = true);
1658
+ })(j2.current), $2.current, $2.current;
1659
+ let o3 = $2.current;
1660
+ if ($2.current) {
1661
+ if ($2.current.isDone) $2.current = null;
1662
+ else if ($2.current.isSubmitted || $2.current.isCancelled) {
1663
+ if ($2.current.isMounted) return;
1664
+ $2.current.isDone || (A2($2.current), $2.current.isDone = true);
1665
1665
  }
1666
1666
  }
1667
1667
  if (t3) {
1668
1668
  if ("start" === t3.eventType) {
1669
- const n3 = t3, o4 = n3.startEvent?.cell ?? $2.current;
1670
- A2.current && ne.isEqualCells(A2.current.coords, o4) || (A2.current = e5(o4, n3.startEvent));
1669
+ const n3 = t3, o4 = n3.startEvent?.cell ?? B2.current;
1670
+ $2.current && ne.isEqualCells($2.current.coords, o4) || ($2.current = e5(o4, n3.startEvent));
1671
1671
  } else if ("keyboard" === t3.eventType) {
1672
1672
  const n3 = t3.event;
1673
- if (A2.current) {
1674
- n3.key, A2.current.events, A2.current.events.push(t3);
1675
- for (let e6 = 0; e6 < A2.current.editorRefsDispatchEditorEvent.length; e6++) A2.current.editorRefsDispatchEditorEvent[e6](t3);
1673
+ if ($2.current) {
1674
+ n3.key, $2.current.events, $2.current.events.push(t3);
1675
+ for (let e6 = 0; e6 < $2.current.editorRefsDispatchEditorEvent.length; e6++) $2.current.editorRefsDispatchEditorEvent[e6](t3);
1676
1676
  } else {
1677
1677
  if (w2(n3, t3.coords)) {
1678
1678
  let n4;
1679
- const o4 = e5(n4?.cell ?? $2.current, n4);
1680
- o4 && o4.events.push(t3), A2.current = o4;
1679
+ const o4 = e5(n4?.cell ?? B2.current, n4);
1680
+ o4 && o4.events.push(t3), $2.current = o4;
1681
1681
  }
1682
1682
  }
1683
1683
  } else if ("pointer" === t3.eventType) {
1684
1684
  const n3 = t3.event;
1685
- if (A2.current) {
1686
- A2.current.events.push(t3);
1687
- for (let e6 = 0; e6 < A2.current.editorRefsDispatchEditorEvent.length; e6++) A2.current.editorRefsDispatchEditorEvent[e6](t3);
1685
+ if ($2.current) {
1686
+ $2.current.events.push(t3);
1687
+ for (let e6 = 0; e6 < $2.current.editorRefsDispatchEditorEvent.length; e6++) $2.current.editorRefsDispatchEditorEvent[e6](t3);
1688
1688
  } else {
1689
- const o4 = t3?.coords ?? $2.current, r3 = m2(n3, o4);
1689
+ const o4 = t3?.coords ?? B2.current, r3 = m2(n3, o4);
1690
1690
  if (r3) {
1691
1691
  let n4;
1692
1692
  "boolean" != typeof n4 && (n4 = r3);
1693
1693
  const i2 = e5(o4, n4);
1694
- i2 && i2.events.push(t3), A2.current = i2;
1694
+ i2 && i2.events.push(t3), $2.current = i2;
1695
1695
  }
1696
1696
  }
1697
1697
  } else if ("submit" === t3.eventType) {
1698
- if (A2.current && !A2.current.isSubmitted && !A2.current.isCancelled) {
1699
- if (!A2.current.isMounted) return;
1700
- D2(A2.current);
1698
+ if ($2.current && !$2.current.isSubmitted && !$2.current.isCancelled) {
1699
+ if (!$2.current.isMounted) return;
1700
+ z2($2.current);
1701
1701
  }
1702
1702
  } else if ("cancel" === t3.eventType) {
1703
- if (A2.current && !A2.current.isSubmitted && !A2.current.isCancelled) {
1704
- if (!A2.current.isMounted) return;
1705
- L2(A2.current);
1703
+ if ($2.current && !$2.current.isSubmitted && !$2.current.isCancelled) {
1704
+ if (!$2.current.isMounted) return;
1705
+ D2($2.current);
1706
1706
  }
1707
1707
  } else if ("coordsChange" === t3.eventType) {
1708
1708
  const e6 = t3;
1709
- if ($2.current = e6.activeCoords, A2.current, A2.current && !A2.current.isSubmitted && !A2.current.isCancelled) {
1710
- if (!A2.current.isMounted) return;
1709
+ if (B2.current = e6.activeCoords, $2.current, $2.current && !$2.current.isSubmitted && !$2.current.isCancelled) {
1710
+ if (!$2.current.isMounted) return;
1711
1711
  try {
1712
- D2(A2.current);
1712
+ z2($2.current);
1713
1713
  } catch (e7) {
1714
1714
  }
1715
1715
  }
1716
1716
  }
1717
1717
  }
1718
- F2.current.length > 0 && (F2.current.shift(), W2()), 0 === F2.current.length && (!A2.current || A2.current.isEditorClosing || A2.current.isEditorClosed ? !A2.current && o3 && R2() : A2.current.isMounted && !A2.current.isStarted && (A2.current.isStarted = true, A2.current.startEvent.autoFocus && ("string" == typeof A2.current.startEvent.autoFocus ? A2.current.editorRefs[0]?.autoFocus(A2.current.startEvent.autoFocus) : A2.current.editorRefs[0]?.autoFocus()), O2?.(A2.current), requestAnimationFrame(() => {
1719
- n2 && A2.current?.coords && n2.scrollCellCoordsIntoView(A2.current.coords);
1718
+ j2.current.length > 0 && (j2.current.shift(), H2()), 0 === j2.current.length && (!$2.current || $2.current.isEditorClosing || $2.current.isEditorClosed ? !$2.current && o3 && R2() : $2.current.isMounted && !$2.current.isStarted && ($2.current.isStarted = true, $2.current.startEvent.autoFocus && ("string" == typeof $2.current.startEvent.autoFocus ? $2.current.editorRefs[0]?.autoFocus($2.current.startEvent.autoFocus) : $2.current.editorRefs[0]?.autoFocus()), L2?.($2.current), requestAnimationFrame(() => {
1719
+ n2 && $2.current?.coords && n2.scrollCellCoordsIntoView($2.current.coords);
1720
1720
  })));
1721
- }, [j2]), s(() => {
1722
- B2.current = S2;
1723
- const e5 = A2.current?.coords;
1721
+ }, [V2]), s(() => {
1722
+ if (P2.current && ne.isEqualCells(P2.current, S2)) return;
1723
+ F2.current = S2;
1724
+ const e5 = $2.current?.coords;
1724
1725
  if (!ne.isEqualCells(e5, S2)) {
1725
- A2.current && (A2.current.isEditorClosing = true);
1726
- W2({ eventType: "coordsChange", activeCoords: S2 });
1726
+ $2.current && ($2.current.isEditorClosing = true);
1727
+ H2({ eventType: "coordsChange", activeCoords: S2 });
1727
1728
  }
1728
1729
  }, [S2]);
1729
1730
  const q2 = i((e5) => {
1730
- U2(e5.nativeEvent);
1731
- }, []), { width: K2 = 0, height: Y2 = 0 } = C2 ?? { width: 0, height: 0 }, X2 = Tt(r2, [r2]);
1731
+ K2(e5.nativeEvent);
1732
+ }, []), { width: Y2 = 0, height: X2 = 0 } = C2 ?? { width: 0, height: 0 }, G2 = Tt(r2, [r2]);
1732
1733
  return { overlay: Tt((t3) => {
1733
- if (!A2.current || A2.current.isEditorClosed) return A2.current, null;
1734
- A2.current.coords;
1735
- let n3 = T2(t3, A2.current.coords, K2, Y2, b2, E2), o3 = true;
1736
- n3 && 0 !== n3.width && 0 !== n3.height || (n3 = { x: 0, y: 0, width: K2, height: K2 }, o3 = false);
1734
+ if (!$2.current || $2.current.isEditorClosed) return $2.current, null;
1735
+ $2.current.coords;
1736
+ let n3 = T2(t3, $2.current.coords, Y2, X2, b2, E2), o3 = true;
1737
+ n3 && 0 !== n3.width && 0 !== n3.height || (n3 = { x: 0, y: 0, width: Y2, height: Y2 }, o3 = false);
1737
1738
  const r3 = t3.getZoom(), i2 = { containerBounds: { x: 0, y: 0, width: n3.width / r3, height: n3.height / r3 }, setNaturalDimensions: M2, zoom: r3 };
1738
- return e(Wn, { session: A2.current, refLatestCoords: B2, handleSubmitEdit: D2, handleCancelEdit: L2, cellBounds: n3, borderStrokeWidth: v2, borderStrokeFill: y2, isInBounds: o3, getCellEditor: X2, propsEditor: i2, alignment: E2, ...x2 }, "editor:" + A2.current.uuid);
1739
- }, [r2, b2, j2, K2, Y2, E2, v2, y2]), startEdit: i((e5) => {
1740
- W2({ eventType: "start", startEvent: e5 });
1739
+ return e(Wn, { session: $2.current, refLatestCoords: F2, handleSubmitEdit: z2, handleCancelEdit: D2, cellBounds: n3, borderStrokeWidth: v2, borderStrokeFill: y2, isInBounds: o3, getCellEditor: G2, propsEditor: i2, alignment: E2, ...x2 }, "editor:" + $2.current.uuid);
1740
+ }, [r2, b2, V2, Y2, X2, E2, v2, y2]), startEdit: i((e5) => {
1741
+ H2({ eventType: "start", startEvent: e5 });
1741
1742
  }, []), submitEdit: i(() => {
1742
- W2({ eventType: "submit" });
1743
+ H2({ eventType: "submit" });
1743
1744
  }, []), cancelEdit: i(() => {
1744
- W2({ eventType: "cancel" });
1745
- }, []), onKeyboardEvent: q2, onPointerEvent: N2, onKeyboardEventNative: U2, onPointerEventNative: H2, isEditing: _2 };
1745
+ H2({ eventType: "cancel" });
1746
+ }, []), onKeyboardEvent: q2, onPointerEvent: U2, onKeyboardEventNative: K2, onPointerEventNative: N2, isEditing: _2 };
1746
1747
  }, Nn = ({ gridRef: e5, gridMainRef: t2, orientation: n2 = $, headerCount: o2, selectionPolicy: r2 = "multiple", newSelectionMode: s2 = "clear", alwaysScrollToActiveCoords: c2 = true, onDragStart: a2, onDragEnd: u2, pointerDownInterceptor: h2, pointerMoveInterceptor: f2, onPointerUp: p2, newSelection: g2, modifySelection: w2, appendSelection: m2, clearSelections: x2 }) => {
1747
1748
  const y2 = o2 ?? ((n2 === $ ? e5.current?.rowCount : e5.current?.columnCount) || 0), v2 = l(null), b2 = l(null), S2 = l(false), E2 = l(null), _2 = i((e6) => n2 === A ? { rowIndex: 0, colIndex: e6.colIndex } : { rowIndex: e6.rowIndex, colIndex: 0 }, [n2]), I2 = i((e6) => n2 === A ? { rowIndex: t2.current ? t2.current.rowCount - 1 : 0, colIndex: e6.colIndex } : { rowIndex: e6.rowIndex, colIndex: t2.current ? t2.current.columnCount - 1 : 0 }, [n2]), C2 = (e6) => {
1748
1749
  b2.current = I2(e6), w2(b2.current, v2.current);
@@ -1792,7 +1793,7 @@ const kn = () => "sheetxl-ui-" + Mn++, Rn = o["useId".toString()], Pn = null !=
1792
1793
  if (0 === t3) return o2;
1793
1794
  r2 ? o2 += t3 : o2 -= t3;
1794
1795
  }
1795
- }, qn = (e5, t2, n2) => {
1796
+ }, Kn = (e5, t2, n2) => {
1796
1797
  const o2 = [];
1797
1798
  let r2 = t2;
1798
1799
  for (; r2 <= n2; ) {
@@ -1800,7 +1801,7 @@ const kn = () => "sheetxl-ui-" + Mn++, Rn = o["useId".toString()], Pn = null !=
1800
1801
  0 === t3 ? (o2.push(r2), r2++) : r2 += t3;
1801
1802
  }
1802
1803
  return o2;
1803
- }, Kn = (e5, t2, n2, o2, r2, i2) => {
1804
+ }, qn = (e5, t2, n2, o2, r2, i2) => {
1804
1805
  if (!t2) return i2;
1805
1806
  let { rowIndex: l2, colIndex: s2 } = e5;
1806
1807
  switch (o2) {
@@ -1867,7 +1868,7 @@ const kn = () => "sheetxl-ui-" + Mn++, Rn = o["useId".toString()], Pn = null !=
1867
1868
  o2 === E ? l2 = { rowIndex: s2 + 1, colIndex: c2 } : o2 === S ? l2 = { rowIndex: s2 - 1, colIndex: c2 } : o2 === I ? l2 = { rowIndex: s2, colIndex: c2 + 1 } : o2 === _ && (l2 = { rowIndex: s2, colIndex: c2 - 1 });
1868
1869
  const a2 = t2(e5), d2 = t2(l2);
1869
1870
  var u2, h2;
1870
- return (h2 = d2, !(u2 = a2) && !h2 || !u2 && h2 || u2 && !h2 ? Kn : Yn)(e5, t2, n2, o2, false, i2) ?? i2;
1871
+ return (h2 = d2, !(u2 = a2) && !h2 || !u2 && h2 || u2 && !h2 ? qn : Yn)(e5, t2, n2, o2, false, i2) ?? i2;
1871
1872
  }, Gn = (e5, t2) => `${e5}:${t2}`, Zn = (e5, t2, n2, o2, r2, i2) => {
1872
1873
  if (n2 - t2 >= r2 - o2) return o2;
1873
1874
  let l2 = o2;
@@ -2097,8 +2098,8 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2097
2098
  }, xo = (e5, t2, n2) => {
2098
2099
  const o2 = e5.getVisibleRangeCoords(), r2 = e5.getScrollOrientation();
2099
2100
  !r2.horizontal && (t2.colIndex > o2.colEnd || t2.colIndex < o2.colStart) && (t2 = { ...t2, colIndex: t2.colIndex > o2.colEnd ? o2.colEnd + 1 : o2.colEnd - 1 }, e5 = n2.current.getViewFromLocation(k)), !r2.vertical && (t2.rowIndex > o2.rowEnd || t2.rowIndex < o2.rowStart) && (t2 = { ...t2, rowIndex: t2.rowIndex > o2.rowEnd ? o2.rowEnd + 1 : o2.rowEnd - 1 }, e5 = n2.current.getViewFromLocation(k)), e5.scrollCellCoordsIntoView(t2);
2100
- }, yo = () => false, vo = ({ gridRef: t2, commands: n2, layout: o2, selection: r2, onSelectionChange: c2, onSelectionDragStart: a2, onSelectionDragEnd: p2, selectionPolicy: g2 = "multiple", newSelectionMode: w2 = "clear", allowDeselectSelection: m2 = true, onFillPreview: x2, onFillCancel: y2, onFillDone: v2, onFill: b2, disableFillDrag: R2 = !b2, fillHandleBorderColor: P2 = "white", hiddenRowsAt: O2, hiddenColumnsAt: L2, isContentfulCell: D2, contentfulCellFinder: z2 = Xn, getDataCoords: A2, alwaysScrollToActiveCoords: $2 = false, selectionBounds: B2, pointerDownInterceptor: F2, pointerMoveInterceptor: j2, mergedRanges: V2, canSelectionSpanMergedCells: W2 = yo, onMoveDragStart: H2, onMoveDragUpdate: N2, onMoveDragEnd: U2, onMoveDragDone: q2, selectionRenderer: K2 = co, disableMoveDrag: Y2 = !U2, getCellCoordsAsRangeCoords: X2 = ne.cellToRange, moveDragHitSize: G2 = 6, moveDragOutlineSize: Z2 = 4, selectionBackgroundColor: J2 = "rgba(16, 124, 65, 0.1)", selectionBorderColor: Q2 = "rgb(33, 115, 70)", selectionRemoveBorderColor: ee2 = "rgb(255, 0, 0)", selectionRemoveBackgroundColor: te2 = "rgba(250, 10, 10, 0.1)", disableTouchSelection: oe2 = false, touchSelectHandleProps: re2 }) => {
2101
- const ie2 = i(() => ({ top: B2?.top ?? 0, left: B2?.left ?? 0, bottom: t2.current?.rowCount - 1 || 0, right: t2.current?.columnCount - 1 || 0 }), []), le2 = Tt(b2, [b2]), se2 = Tt(x2, [x2]), ce2 = Tt(y2, [y2]), ae2 = Tt(v2, [v2]), de2 = Tt(D2, [D2]), ue2 = Tt(K2, [K2]), he2 = Tt((e5, t3 = false) => to(e5, t3, o2.getRowOffset, t3 ? ie2().bottom : ie2().top), [o2?.getRowOffset]), fe2 = Tt(O2 ?? he2, [O2]), pe2 = Tt((e5, t3 = false) => to(e5, t3, o2.getColOffset, t3 ? ie2().right : ie2().left), [o2?.getColOffset]), ge2 = Tt(L2 ?? pe2, [L2]), [we2, me2] = h(() => mo(r2)), xe2 = d(() => mo(we2), [we2]), ye2 = l(xe2), ve2 = l(true);
2101
+ }, yo = () => false, vo = ({ gridRef: t2, commands: n2, layout: o2, selection: r2, onSelectionChange: c2, onSelectionDragStart: a2, onSelectionDragEnd: p2, selectionPolicy: g2 = "multiple", newSelectionMode: w2 = "clear", allowDeselectSelection: m2 = true, onFillPreview: x2, onFillCancel: y2, onFillDone: v2, onFill: b2, disableFillDrag: R2 = !b2, fillHandleBorderColor: P2 = "white", hiddenRowsAt: O2, hiddenColumnsAt: L2, isContentfulCell: D2, contentfulCellFinder: z2 = Xn, getDataCoords: A2, alwaysScrollToActiveCoords: $2 = false, selectionBounds: B2, pointerDownInterceptor: F2, pointerMoveInterceptor: j2, mergedRanges: V2, canSelectionSpanMergedCells: W2 = yo, onMoveDragStart: H2, onMoveDragUpdate: N2, onMoveDragEnd: U2, onMoveDragDone: K2, selectionRenderer: q2 = co, disableMoveDrag: Y2 = !U2, getCellCoordsAsRangeCoords: X2 = ne.cellToRange, moveDragHitSize: G2 = 6, moveDragOutlineSize: Z2 = 4, selectionBackgroundColor: J2 = "rgba(16, 124, 65, 0.1)", selectionBorderColor: Q2 = "rgb(33, 115, 70)", selectionRemoveBorderColor: ee2 = "rgb(255, 0, 0)", selectionRemoveBackgroundColor: te2 = "rgba(250, 10, 10, 0.1)", disableTouchSelection: oe2 = false, touchSelectHandleProps: re2 }) => {
2102
+ const ie2 = i(() => ({ top: B2?.top ?? 0, left: B2?.left ?? 0, bottom: t2.current?.rowCount - 1 || 0, right: t2.current?.columnCount - 1 || 0 }), []), le2 = Tt(b2, [b2]), se2 = Tt(x2, [x2]), ce2 = Tt(y2, [y2]), ae2 = Tt(v2, [v2]), de2 = Tt(D2, [D2]), ue2 = Tt(q2, [q2]), he2 = Tt((e5, t3 = false) => to(e5, t3, o2.getRowOffset, t3 ? ie2().bottom : ie2().top), [o2?.getRowOffset]), fe2 = Tt(O2 ?? he2, [O2]), pe2 = Tt((e5, t3 = false) => to(e5, t3, o2.getColOffset, t3 ? ie2().right : ie2().left), [o2?.getColOffset]), ge2 = Tt(L2 ?? pe2, [L2]), [we2, me2] = h(() => mo(r2)), xe2 = d(() => mo(we2), [we2]), ye2 = l(xe2), ve2 = l(true);
2102
2103
  u(Me.throttle(() => {
2103
2104
  me2((e5) => {
2104
2105
  ve2.current = true;
@@ -2178,13 +2179,13 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2178
2179
  });
2179
2180
  }, []), Ue2 = () => {
2180
2181
  be2(wo);
2181
- }, qe2 = "touch" === Ut.detectIt().primaryInput, Ke2 = l(null), Ye2 = l(null), Xe2 = l(null), Ge2 = d(() => ({ onPointerDown: (e5) => {
2182
+ }, Ke2 = "touch" === Ut.detectIt().primaryInput, qe2 = l(null), Ye2 = l(null), Xe2 = l(null), Ge2 = d(() => ({ onPointerDown: (e5) => {
2182
2183
  if (!t2 || !t2.current) return false;
2183
2184
  const n3 = e5.nativeEvent, o3 = t2.current.getViewFromClient(n3.clientX, n3.clientY);
2184
2185
  if ("touch" === n3.pointerType || "touchstart" === n3.type) return Ye2.current = { topLeft: o3.getScrollTopLeft(), point: { x: n3.clientX, y: n3.clientY } }, true;
2185
2186
  const r3 = o3.getCellCoordsFromClient(e5.nativeEvent.clientX, e5.nativeEvent.clientY);
2186
2187
  if (!r3) return false;
2187
- Ke2.current = { anchor: o3.getAnchor(), coords: r3 }, Ae2.current = null;
2188
+ qe2.current = { anchor: o3.getAnchor(), coords: r3 }, Ae2.current = null;
2188
2189
  const i2 = e5.nativeEvent.which === Ct;
2189
2190
  if (i2) {
2190
2191
  if (-1 !== ne.indexOfCoords(r3, xe2.ranges)) return false;
@@ -2210,10 +2211,10 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2210
2211
  }, onPointerMoveOrWait: Me.throttle((e5, n3) => {
2211
2212
  if (!t2?.current) return;
2212
2213
  if ("touch" === e5.pointerType || "touchmove" === e5.type) return;
2213
- if (!Ke2.current) return;
2214
- const o3 = Ke2.current.anchor;
2214
+ if (!qe2.current) return;
2215
+ const o3 = qe2.current.anchor;
2215
2216
  let r3 = t2.current.getViewFromLocation(o3), i2 = r3.getCellCoordsFromClient(e5.clientX, e5.clientY);
2216
- if (!ne.isEqualCells(i2, Ke2.current?.coords) && (Ke2.current = { anchor: o3, coords: i2 }, i2 && false !== j2?.(e5, i2, ye2.current))) {
2217
+ if (!ne.isEqualCells(i2, qe2.current?.coords) && (qe2.current = { anchor: o3, coords: i2 }, i2 && false !== j2?.(e5, i2, ye2.current))) {
2217
2218
  if (Pe2.current) {
2218
2219
  const e6 = { rowStart: Math.min(i2.rowIndex, Pe2.current.rowIndex), colStart: Math.min(i2.colIndex, Pe2.current.colIndex), rowEnd: Math.max(i2.rowIndex, Pe2.current.rowIndex), colEnd: Math.max(i2.colIndex, Pe2.current.colIndex) }, t3 = { rowIndex: e6.rowStart, colIndex: e6.colStart }, n4 = { rowIndex: e6.rowEnd, colIndex: e6.colEnd };
2219
2220
  if (Fe2(t3) || Fe2(n4)) return;
@@ -2223,7 +2224,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2223
2224
  Xe2.current = n3, xo(r3, i2, t2);
2224
2225
  }
2225
2226
  }, 60), onPointerUp: (e5) => {
2226
- if (Ke2.current = null, "touch" === e5.pointerType || "touchend" === e5.type) {
2227
+ if (qe2.current = null, "touch" === e5.pointerType || "touchend" === e5.type) {
2227
2228
  if (Ye2.current) {
2228
2229
  const e6 = t2.current.getViewFromClient(Ye2.current.point.x, Ye2.current.point.y), n4 = e6.getScrollTopLeft();
2229
2230
  if (n4.left === Ye2.current.topLeft.left && n4.top === Ye2.current.topLeft.top) {
@@ -2231,7 +2232,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2231
2232
  He2(t3);
2232
2233
  }
2233
2234
  }
2234
- return Ye2.current = null, void (Ke2.current = null);
2235
+ return Ye2.current = null, void (qe2.current = null);
2235
2236
  }
2236
2237
  try {
2237
2238
  p2?.(ye2.current, e5);
@@ -2262,7 +2263,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2262
2263
  e5.stopPropagation(), e5.preventDefault(), e5.nativeEvent.stopImmediatePropagation();
2263
2264
  const d2 = o3 ?? t2.current.getViewFromClient(e5.nativeEvent.clientX, e5.nativeEvent.clientY), u2 = r3 ?? d2.getCellCoordsFromClient(e5.nativeEvent.clientX, e5.nativeEvent.clientY);
2264
2265
  if (!u2) return false;
2265
- Ke2.current = { anchor: d2.getAnchor(), coords: u2 }, Ae2.current = null;
2266
+ qe2.current = { anchor: d2.getAnchor(), coords: u2 }, Ae2.current = null;
2266
2267
  const h2 = e5.nativeEvent.which === Ct;
2267
2268
  if (h2) {
2268
2269
  if (-1 !== ne.indexOfCoords(u2, xe2.ranges)) return false;
@@ -2287,10 +2288,10 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2287
2288
  l2 && Be2(u2), b3 && 0 === xe2.ranges.length || He2(u2);
2288
2289
  }, onSelectionPointerMoveOrWait: (e5, n3, o3, r3, i2, l2 = xe2.cell, s2 = true, c3 = false) => {
2289
2290
  if (!t2?.current) return;
2290
- if (e5.stopPropagation(), e5.preventDefault(), e5.stopImmediatePropagation(), !Ke2.current) return;
2291
- const a3 = Ke2.current.anchor;
2291
+ if (e5.stopPropagation(), e5.preventDefault(), e5.stopImmediatePropagation(), !qe2.current) return;
2292
+ const a3 = qe2.current.anchor;
2292
2293
  let d2 = r3 ?? t2.current.getViewFromLocation(a3), u2 = i2 ?? d2.getCellCoordsFromClient(e5.clientX, e5.clientY);
2293
- if (!ne.isEqualCells(u2, Ke2.current?.coords) && (Ke2.current = { anchor: a3, coords: u2 }, u2 && false !== j2?.(e5, u2, ye2.current))) {
2294
+ if (!ne.isEqualCells(u2, qe2.current?.coords) && (qe2.current = { anchor: a3, coords: u2 }, u2 && false !== j2?.(e5, u2, ye2.current))) {
2294
2295
  if (Pe2.current) {
2295
2296
  const e6 = { rowStart: Math.min(u2.rowIndex, Pe2.current.rowIndex), colStart: Math.min(u2.colIndex, Pe2.current.colIndex), rowEnd: Math.max(u2.rowIndex, Pe2.current.rowIndex), colEnd: Math.max(u2.colIndex, Pe2.current.colIndex) }, t3 = { rowIndex: e6.rowStart, colIndex: e6.colStart }, n4 = { rowIndex: e6.rowEnd, colIndex: e6.colEnd };
2296
2297
  if (Fe2(t3) || Fe2(n4)) return;
@@ -2300,7 +2301,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2300
2301
  s2 && xo(d2, u2, t2);
2301
2302
  }
2302
2303
  }, onPointerUp: (e5) => {
2303
- Ke2.current = null, e5.stopPropagation(), e5.preventDefault(), e5.stopImmediatePropagation();
2304
+ qe2.current = null, e5.stopPropagation(), e5.preventDefault(), e5.stopImmediatePropagation();
2304
2305
  try {
2305
2306
  p2?.(ye2.current, e5);
2306
2307
  } catch (e6) {
@@ -2532,9 +2533,9 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2532
2533
  Qe2(E, false, true);
2533
2534
  }, []), Nt2 = i(() => {
2534
2535
  Qe2(E, true, true);
2535
- }, []), qt2 = i(() => {
2536
+ }, []), Kt2 = i(() => {
2536
2537
  be2((e5) => e5.slice(0, -1));
2537
- }, []), Kt2 = d(() => {
2538
+ }, []), qt2 = d(() => {
2538
2539
  const e5 = ie2();
2539
2540
  return ((e6, t3, n3, o3, r3) => {
2540
2541
  for (let i2 = 0; i2 < e6.length; i2++) {
@@ -2641,7 +2642,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2641
2642
  };
2642
2643
  if (!nn2.current) return void o3();
2643
2644
  const r3 = nn2.current.range, i2 = en2;
2644
- U2?.(r3, e5, n3), Promise.resolve(r3 && i2 && q2?.(r3, i2, e5, n3)).finally(() => {
2645
+ U2?.(r3, e5, n3), Promise.resolve(r3 && i2 && K2?.(r3, i2, e5, n3)).finally(() => {
2645
2646
  o3();
2646
2647
  });
2647
2648
  } }), [en2]), rn2 = hn(on2), ln2 = d(() => ({ onPointerDown: rn2 }), [rn2]), sn2 = l(null), cn2 = d(() => {
@@ -2719,7 +2720,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2719
2720
  let h2 = null;
2720
2721
  !R2 && o3 && !en2 && (h2 = f(uo, { ...o3, corner: r3, size: 7.5, borderStroke: `${P2} solid`, style: { borderRadius: 1 }, background: Q2, ...Qt2, key: "fillHandle" }));
2721
2722
  const p3 = [...i2];
2722
- if (d2 && p3.push(d2), u2 && p3.push(u2), h2 && p3.push(h2), !oe2 && qe2 && 1 === c3?.ranges.length && c3.ranges[c3.ranges.length - 1]) {
2723
+ if (d2 && p3.push(d2), u2 && p3.push(u2), h2 && p3.push(h2), !oe2 && Ke2 && 1 === c3?.ranges.length && c3.ranges[c3.ranges.length - 1]) {
2723
2724
  const o4 = c3.ranges[c3.ranges.length - 1], r4 = o4.rowStart === ie2().top && o4.rowEnd === ie2().bottom, i3 = o4.colStart === ie2().left && o4.colEnd === ie2().right, l3 = { view: n3, range: o4, borderStroke: `${Q2} solid`, background: P2, selectionTouchPointerHandler: Je2, ...re2, onTouchSelectStart: (e5) => De2(e5), onTouchSelectEnd: () => De2(null), currentTouchAnchor: Le2 };
2724
2725
  p3.push(e(ho, { anchor: i3 ? "b" : r4 ? "r" : "br", scrollableElement: t2.current, ...l3 }, "touch-select-handle-after")), p3.push(e(ho, { anchor: i3 ? "t" : r4 ? "l" : "tl", scrollableElement: t2.current, ...l3 }, "touch-select-handle-before"));
2725
2726
  }
@@ -2736,11 +2737,11 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2736
2737
  }, []);
2737
2738
  return d(() => {
2738
2739
  n2?.addCommands(dn2, true);
2739
- }, [n2]), { selection: cn2, setSelectionCell: Yt2, setSelectionRanges: be2, overlay: an2, cursor: Ee2, onPointerDown: Ze2, clearLastSelection: qt2, newSelection: He2, modifySelection: We2, appendSelection: Ne2, clearSelections: Ue2, isEntire: Kt2, navigate: Qe2, navigateSelection: et2 };
2740
- }, bo = { "sheetxl-grid": "_sheetxl-grid_11irg_13" }, So = Object.freeze({ top: 0, left: 0 }), Eo = Object.freeze({ bottom: -4, right: -4 }), _o = Object.freeze({ horizontal: true, vertical: true }), Io = [C, M, T, k], Co = 150, Mo = 3e3, To = {}, ko = r(a((o2, r2) => {
2741
- const { width: c2, height: a2, rowCount: w2 = 1, columnCount: m2 = 1, defaultRowHeight: x2, defaultColumnWidth: y2, getRowHeight: v2, getColumnWidth: R2, layout: P2, onViewportScroll: O2, onImmediateScroll: L2, showGridLines: D2 = true, gridLineColor: z2 = "rgb(224, 224, 224)", gridLineRowsProps: A2, gridLineColumnsProps: $2, clipCells: B2 = true, cursor: F2, freezeLeft: j2 = 0, freezeTop: V2 = 0, freezeLeftProps: W2, freezeTopProps: H2, cellRenderer: N2, onViewportChange: U2, onFirstRender: q2, overlayRenderer: K2, overlayProps: Y2, overlays: X2, overlaysProps: G2, allowOverlaysOverflow: Z2 = false, stageProps: J2, stageWrapper: Q2 = null, hiddenRowsAt: ee2, hiddenColumnsAt: te2, hiddenCellAt: oe2, getVisibleCells: re2, zoom: ie2 = 1, enableMouseWheel: le2 = true, onWheelScroll: se2, getCellCoordsAsRangeCoords: ce2 = ne.cellToRange, scrollPoint: ae2 = So, style: de2 = {}, ...ue2 } = o2;
2740
+ }, [n2]), { selection: cn2, setSelectionCell: Yt2, setSelectionRanges: be2, overlay: an2, cursor: Ee2, onPointerDown: Ze2, clearLastSelection: Kt2, newSelection: He2, modifySelection: We2, appendSelection: Ne2, clearSelections: Ue2, isEntire: qt2, navigate: Qe2, navigateSelection: et2 };
2741
+ }, bo = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, So = Object.freeze({ top: 0, left: 0 }), Eo = Object.freeze({ bottom: -4, right: -4 }), _o = Object.freeze({ horizontal: true, vertical: true }), Io = [C, M, T, k], Co = 150, Mo = 3e3, To = {}, ko = r(a((o2, r2) => {
2742
+ const { width: c2, height: a2, rowCount: w2 = 1, columnCount: m2 = 1, defaultRowHeight: x2, defaultColumnWidth: y2, getRowHeight: v2, getColumnWidth: R2, layout: P2, onViewportScroll: O2, onImmediateScroll: L2, showGridLines: D2 = true, gridLineColor: z2 = "rgb(224, 224, 224)", gridLineRowsProps: A2, gridLineColumnsProps: $2, clipCells: B2 = true, cursor: F2, freezeLeft: j2 = 0, freezeTop: V2 = 0, freezeLeftProps: W2, freezeTopProps: H2, cellRenderer: N2, onViewportChange: U2, onFirstRender: K2, overlayRenderer: q2, overlayProps: Y2, overlays: X2, overlaysProps: G2, allowOverlaysOverflow: Z2 = false, stageProps: J2, stageWrapper: Q2 = null, hiddenRowsAt: ee2, hiddenColumnsAt: te2, hiddenCellAt: oe2, getVisibleCells: re2, zoom: ie2 = 1, enableMouseWheel: le2 = true, onWheelScroll: se2, getCellCoordsAsRangeCoords: ce2 = ne.cellToRange, scrollPoint: ae2 = So, style: de2 = {}, ...ue2 } = o2;
2742
2743
  b(N2, "No cellRenderer specified. This is probably not what you wanted"), b(!o2?.children, "Grid does not support children elements");
2743
- const he2 = Tt(L2, [L2]), fe2 = Tt(U2, [U2]), pe2 = Tt(O2, [O2]), ge2 = Tt(se2, [se2]), we2 = Tt(q2, [q2]), me2 = l(null), xe2 = l(null), ye2 = l(null), [ve2, be2] = p((e5) => e5 + 1, 0), [Se2, Ee2] = h({ left: ae2?.left ?? 0, top: ae2?.top ?? 0, horizontalScrollDirection: null, verticalScrollDirection: null }), _e2 = l(null), Ie2 = l(Se2), { top: Ce2, left: Te2, verticalScrollDirection: ke2, horizontalScrollDirection: Re2 } = Se2, Pe2 = l(false), Oe2 = An({ rowCount: w2, columnCount: m2, defaultRowHeight: x2, defaultColumnWidth: y2, getRowHeight: v2, getColumnWidth: R2 }), Le2 = l(null), De2 = d(() => {
2744
+ const he2 = Tt(L2, [L2]), fe2 = Tt(U2, [U2]), pe2 = Tt(O2, [O2]), ge2 = Tt(se2, [se2]), we2 = Tt(K2, [K2]), me2 = l(null), xe2 = l(null), ye2 = l(null), [ve2, be2] = p((e5) => e5 + 1, 0), [Se2, Ee2] = h({ left: ae2?.left ?? 0, top: ae2?.top ?? 0, horizontalScrollDirection: null, verticalScrollDirection: null }), _e2 = l(null), Ie2 = l(Se2), { top: Ce2, left: Te2, verticalScrollDirection: ke2, horizontalScrollDirection: Re2 } = Se2, Pe2 = l(false), Oe2 = An({ rowCount: w2, columnCount: m2, defaultRowHeight: x2, defaultColumnWidth: y2, getRowHeight: v2, getColumnWidth: R2 }), Le2 = l(null), De2 = d(() => {
2744
2745
  const e5 = P2 || Oe2;
2745
2746
  return Le2.current = null, { getColOffset: (t2) => e5.getColOffset(t2) * ie2, getColIndex: (t2) => e5.getColIndex(t2 / ie2), getRowOffset: (t2) => e5.getRowOffset(t2) * ie2, getRowIndex: (t2) => e5.getRowIndex(t2 / ie2) };
2746
2747
  }, [Oe2, P2, ie2]), ze2 = (e5, t2, n2) => {
@@ -2762,12 +2763,12 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2762
2763
  if (t2 > 0) {
2763
2764
  const l3 = ze2(De2, { top: n2 + De2.getRowOffset(0) }), s3 = De2.getRowIndex(o3), c4 = De2.getRowIndex(r3 - 1);
2764
2765
  let a4;
2765
- e5[1] = { minIndex: s3, maxIndex: c4, minCoord: 0, maxCoord: t2 - 1, minBounds: 0, maxBounds: i2, visibleIndices: () => a4 || (a4 = Object.freeze(qn($e2, s3, c4)), a4), layout: l3, maxVirtualBounds: r3, scrollOffset: n2, freezeOffset: n2 };
2766
+ e5[1] = { minIndex: s3, maxIndex: c4, minCoord: 0, maxCoord: t2 - 1, minBounds: 0, maxBounds: i2, visibleIndices: () => a4 || (a4 = Object.freeze(Kn($e2, s3, c4)), a4), layout: l3, maxVirtualBounds: r3, scrollOffset: n2, freezeOffset: n2 };
2766
2767
  }
2767
2768
  const l2 = Math.max(0, Ve2 - i2), s2 = ze2(De2, { top: Ce2 + i2 }), c3 = s2.getRowIndex(0), a3 = s2.getRowIndex(l2);
2768
2769
  let d2;
2769
- return e5[0] = { minIndex: c3, maxIndex: a3, minCoord: t2, maxCoord: w2 - 1, minBounds: i2, maxBounds: l2, visibleIndices: () => d2 || (d2 = Object.freeze(qn($e2, c3, a3)), d2), layout: s2, maxVirtualBounds: De2.getRowOffset(w2), scrollOffset: Ce2, freezeOffset: (t2 > 0 ? De2.getRowOffset(t2) : 0) - n2 }, e5;
2770
- }, [De2.getRowIndex, De2.getRowOffset, $e2, Ve2, w2, V2, Ce2, ie2]), qe2 = d(() => {
2770
+ return e5[0] = { minIndex: c3, maxIndex: a3, minCoord: t2, maxCoord: w2 - 1, minBounds: i2, maxBounds: l2, visibleIndices: () => d2 || (d2 = Object.freeze(Kn($e2, c3, a3)), d2), layout: s2, maxVirtualBounds: De2.getRowOffset(w2), scrollOffset: Ce2, freezeOffset: (t2 > 0 ? De2.getRowOffset(t2) : 0) - n2 }, e5;
2771
+ }, [De2.getRowIndex, De2.getRowOffset, $e2, Ve2, w2, V2, Ce2, ie2]), Ke2 = d(() => {
2771
2772
  const e5 = [];
2772
2773
  let t2 = 0, n2 = 0;
2773
2774
  "number" == typeof j2 ? t2 = j2 : (t2 = j2.index ?? 0, n2 = (j2.scrollOffset ?? 0) * ie2);
@@ -2775,19 +2776,19 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2775
2776
  if (t2 > 0) {
2776
2777
  const l3 = ze2(De2, { left: n2 + De2.getColOffset(0) }), s3 = De2.getColIndex(o3), c4 = De2.getColIndex(r3 - 1);
2777
2778
  let a4;
2778
- e5[1] = { minIndex: s3, maxIndex: c4, minCoord: 0, maxCoord: t2 - 1, minBounds: 0, maxBounds: i2, visibleIndices: () => a4 || (a4 = Object.freeze(qn(Fe2, s3, c4)), a4), layout: l3, maxVirtualBounds: r3, scrollOffset: n2, freezeOffset: n2 };
2779
+ e5[1] = { minIndex: s3, maxIndex: c4, minCoord: 0, maxCoord: t2 - 1, minBounds: 0, maxBounds: i2, visibleIndices: () => a4 || (a4 = Object.freeze(Kn(Fe2, s3, c4)), a4), layout: l3, maxVirtualBounds: r3, scrollOffset: n2, freezeOffset: n2 };
2779
2780
  }
2780
2781
  const l2 = Math.max(0, je2 - i2), s2 = ze2(De2, { left: Te2 + i2 }), c3 = s2.getColIndex(0), a3 = s2.getColIndex(l2);
2781
2782
  let d2;
2782
- return e5[0] = { minIndex: c3, maxIndex: a3, minCoord: t2, maxCoord: m2 - 1, minBounds: i2, maxBounds: l2, visibleIndices: () => d2 || (d2 = Object.freeze(qn(Fe2, c3, a3)), d2), layout: s2, maxVirtualBounds: De2.getColOffset(m2), scrollOffset: Te2, freezeOffset: (t2 > 0 ? De2.getColOffset(t2) : 0) - n2 }, e5;
2783
- }, [De2.getColIndex, De2.getColOffset, Fe2, je2, m2, j2, Te2, ie2]), Ke2 = l({}), Ye2 = l([]), Xe2 = d(() => {
2783
+ return e5[0] = { minIndex: c3, maxIndex: a3, minCoord: t2, maxCoord: m2 - 1, minBounds: i2, maxBounds: l2, visibleIndices: () => d2 || (d2 = Object.freeze(Kn(Fe2, c3, a3)), d2), layout: s2, maxVirtualBounds: De2.getColOffset(m2), scrollOffset: Te2, freezeOffset: (t2 > 0 ? De2.getColOffset(t2) : 0) - n2 }, e5;
2784
+ }, [De2.getColIndex, De2.getColOffset, Fe2, je2, m2, j2, Te2, ie2]), qe2 = l({}), Ye2 = l([]), Xe2 = d(() => {
2784
2785
  let e5 = {};
2785
2786
  const t2 = (t3, n3, o3, r3, i2) => {
2786
2787
  const l2 = { vertical: r3?.vertical || false, horizontal: r3?.horizontal || false };
2787
- if (t3 >= qe2.length || n3 >= Ue2.length) return null;
2788
- const s2 = { rowStart: Ue2[n3].minIndex, colStart: qe2[t3].minIndex, rowEnd: Ue2[n3].maxIndex, colEnd: qe2[t3].maxIndex };
2788
+ if (t3 >= Ke2.length || n3 >= Ue2.length) return null;
2789
+ const s2 = { rowStart: Ue2[n3].minIndex, colStart: Ke2[t3].minIndex, rowEnd: Ue2[n3].maxIndex, colEnd: Ke2[t3].maxIndex };
2789
2790
  if (s2.rowStart > s2.rowEnd || s2.colStart > s2.colEnd) return null;
2790
- const c3 = { getColIndex: (e6) => qe2[t3].layout.getColIndex(e6), getColOffset: (e6) => qe2[t3].layout.getColOffset(e6), getRowIndex: (e6) => Ue2[n3].layout.getRowIndex(e6), getRowOffset: (e6) => Ue2[n3].layout.getRowOffset(e6) }, a3 = Object.freeze({ left: i2?.left ?? 0, top: i2?.top ?? 0, right: i2?.right ?? 0, bottom: i2?.bottom ?? 0 }), d2 = Object.freeze({ x: qe2[t3].minBounds, y: Ue2[n3].minBounds, width: qe2[t3].maxBounds, height: Ue2[n3].maxBounds }), u2 = (e6, t4) => oo(c3, e6 ?? s2, t4), h2 = { width: qe2[t3].maxVirtualBounds, height: Ue2[n3].maxVirtualBounds }, f2 = { left: qe2[t3].scrollOffset, top: Ue2[n3].scrollOffset }, p2 = { left: qe2[t3].freezeOffset, top: Ue2[n3].freezeOffset }, g2 = { width: je2, height: Ve2 };
2791
+ const c3 = { getColIndex: (e6) => Ke2[t3].layout.getColIndex(e6), getColOffset: (e6) => Ke2[t3].layout.getColOffset(e6), getRowIndex: (e6) => Ue2[n3].layout.getRowIndex(e6), getRowOffset: (e6) => Ue2[n3].layout.getRowOffset(e6) }, a3 = Object.freeze({ left: i2?.left ?? 0, top: i2?.top ?? 0, right: i2?.right ?? 0, bottom: i2?.bottom ?? 0 }), d2 = Object.freeze({ x: Ke2[t3].minBounds, y: Ue2[n3].minBounds, width: Ke2[t3].maxBounds, height: Ue2[n3].maxBounds }), u2 = (e6, t4) => oo(c3, e6 ?? s2, t4), h2 = { width: Ke2[t3].maxVirtualBounds, height: Ue2[n3].maxVirtualBounds }, f2 = { left: Ke2[t3].scrollOffset, top: Ue2[n3].scrollOffset }, p2 = { left: Ke2[t3].freezeOffset, top: Ue2[n3].freezeOffset }, g2 = { width: je2, height: Ve2 };
2791
2792
  let w3 = null, m3 = null;
2792
2793
  const x3 = (p2.top + (r3.vertical ? f2.top : 0)) / ie2, y3 = (p2.left + (r3.horizontal ? f2.left : 0)) / ie2;
2793
2794
  return { getStage: () => me2.current ?? null, getVisibleRangeCoords: () => s2, toClipBounds: (e6, t4) => {
@@ -2800,7 +2801,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2800
2801
  }, toViewBounds: (e6) => 0 === y3 && 0 === x3 && 1 === ie2 ? e6 : { x: (e6.x - y3) * ie2, y: (e6.y - x3) * ie2, width: e6.width * ie2, height: e6.height * ie2 }, toAbsoluteBounds: (e6) => 0 === y3 && 0 === x3 && 1 === ie2 ? e6 : { x: e6.x / ie2 + y3, y: e6.y / ie2 + x3, width: e6.width / ie2, height: e6.height / ie2 }, getRelativePointFromClient: (e6, t4) => {
2801
2802
  const n4 = tt2(e6, t4);
2802
2803
  return { x: n4.x - d2.x, y: n4.y - d2.y };
2803
- }, getLayout: () => c3, getCellCoordsAsRangeCoords: ce2, getVisibleColumns: () => qe2[t3].visibleIndices(), getVisibleRows: () => Ue2[n3].visibleIndices(), getVisibleColumnOffsets: () => (w3 || (w3 = no(qe2[t3].layout, true, qe2[t3].visibleIndices(), s2.colStart, s2.colEnd)), w3), getVisibleRowOffsets: () => (m3 || (m3 = no(Ue2[n3].layout, false, Ue2[n3].visibleIndices(), s2.rowStart, s2.rowEnd)), m3), getTotalRangeCoords: () => ({ colStart: qe2[t3].minCoord, colEnd: qe2[t3].maxCoord, rowStart: Ue2[n3].minCoord, rowEnd: Ue2[n3].maxCoord }), getRangeCoordsBounds: u2, scrollCellCoordsIntoView: (e6, t4) => ut2(e6, t4, o3), getCellCoordsFromClient: (e6, t4, n4 = false) => {
2804
+ }, getLayout: () => c3, getCellCoordsAsRangeCoords: ce2, getVisibleColumns: () => Ke2[t3].visibleIndices(), getVisibleRows: () => Ue2[n3].visibleIndices(), getVisibleColumnOffsets: () => (w3 || (w3 = no(Ke2[t3].layout, true, Ke2[t3].visibleIndices(), s2.colStart, s2.colEnd)), w3), getVisibleRowOffsets: () => (m3 || (m3 = no(Ue2[n3].layout, false, Ue2[n3].visibleIndices(), s2.rowStart, s2.rowEnd)), m3), getTotalRangeCoords: () => ({ colStart: Ke2[t3].minCoord, colEnd: Ke2[t3].maxCoord, rowStart: Ue2[n3].minCoord, rowEnd: Ue2[n3].maxCoord }), getRangeCoordsBounds: u2, scrollCellCoordsIntoView: (e6, t4) => ut2(e6, t4, o3), getCellCoordsFromClient: (e6, t4, n4 = false) => {
2804
2805
  const o4 = tt2(e6, t4);
2805
2806
  if (!o4) return null;
2806
2807
  const r4 = c3.getColIndex(o4.x - d2.x), i3 = { rowIndex: c3.getRowIndex(o4.y - d2.y), colIndex: r4 };
@@ -2810,8 +2811,8 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2810
2811
  }, getZoom: () => ie2, getAnchor: () => o3, getBounds: () => d2, getInsets: () => a3, getTotalSize: () => h2, getViewportSize: () => g2, getScrollTopLeft: () => f2, getFreezeTopLeft: () => p2, getScrollOrientation: () => l2, allViews: () => e5 };
2811
2812
  };
2812
2813
  let n2 = e5[k] = t2(0, 0, k, _o, Eo);
2813
- return n2 && (e5[k] = n2), n2 = t2(0, 1, M, { horizontal: true }), n2 && (e5[M] = n2), n2 = t2(1, 0, T, { vertical: true }), n2 && (e5[T] = n2), n2 = t2(1, 1, C, {}), n2 && (e5[C] = n2), Ke2.current = null, e5 = Object.freeze(e5);
2814
- }, [Ue2, qe2, ce2]), Ge2 = Object.keys(Xe2), Ze2 = qe2[0]?.maxVirtualBounds ?? 0, Je2 = Ue2[0]?.maxVirtualBounds ?? 0, Qe2 = d(() => ({ left: qe2[1] ? qe2[1].layout.getColOffset(qe2[1].maxIndex + 1) : 0, top: Ue2[1] ? Ue2[1].layout.getRowOffset(Ue2[1].maxIndex + 1) : 0 }), [Xe2]);
2814
+ return n2 && (e5[k] = n2), n2 = t2(0, 1, M, { horizontal: true }), n2 && (e5[M] = n2), n2 = t2(1, 0, T, { vertical: true }), n2 && (e5[T] = n2), n2 = t2(1, 1, C, {}), n2 && (e5[C] = n2), qe2.current = null, e5 = Object.freeze(e5);
2815
+ }, [Ue2, Ke2, ce2]), Ge2 = Object.keys(Xe2), Ze2 = Ke2[0]?.maxVirtualBounds ?? 0, Je2 = Ue2[0]?.maxVirtualBounds ?? 0, Qe2 = d(() => ({ left: Ke2[1] ? Ke2[1].layout.getColOffset(Ke2[1].maxIndex + 1) : 0, top: Ue2[1] ? Ue2[1].layout.getRowOffset(Ue2[1].maxIndex + 1) : 0 }), [Xe2]);
2815
2816
  s(() => {
2816
2817
  if (Ye2.current.length > 0) {
2817
2818
  for (let e5 = 0; e5 < Ye2.current.length; e5++) Ye2.current[e5]();
@@ -2848,7 +2849,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2848
2849
  return Ie2.current = t2, t2;
2849
2850
  });
2850
2851
  }, []), ct2 = Tt((e5) => {
2851
- const t2 = e5?.left ?? e5?.[0], n2 = e5?.top ?? e5?.[1], o3 = void 0 !== t2 ? Math.min(Ze2 - je2, Math.max(qe2?.[1]?.scrollOffset ?? 0, t2)) : Ie2.current.left, r3 = void 0 !== n2 ? Math.min(Je2 - Ve2, Math.max(Ue2?.[1]?.scrollOffset ?? 0, n2)) : Ie2.current.top;
2852
+ const t2 = e5?.left ?? e5?.[0], n2 = e5?.top ?? e5?.[1], o3 = void 0 !== t2 ? Math.min(Ze2 - je2, Math.max(Ke2?.[1]?.scrollOffset ?? 0, t2)) : Ie2.current.left, r3 = void 0 !== n2 ? Math.min(Je2 - Ve2, Math.max(Ue2?.[1]?.scrollOffset ?? 0, n2)) : Ie2.current.top;
2852
2853
  if (Ie2.current.left === o3 && Ie2.current.top === r3) return;
2853
2854
  let i2 = null, l2 = null;
2854
2855
  Ie2.current.left > o3 ? i2 = _ : Ie2.current.left < o3 && (i2 = I), Ie2.current.top > r3 ? l2 = S : Ie2.current.top < r3 && (l2 = E), Me.throttle(() => {
@@ -2857,7 +2858,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2857
2858
  return Ie2.current = t3, t3;
2858
2859
  });
2859
2860
  }, 17)(), _e2.current?.top === r3 && _e2.current?.left === o3 || (_e2.current = { left: o3, top: r3 }, he2({ left: o3, top: r3 }), fe2({ left: o3, top: r3, width: je2, height: Ve2, totalWidth: Ze2, totalHeight: Je2 })), lt2();
2860
- }, [Ze2, Je2, Ue2, qe2]);
2861
+ }, [Ze2, Je2, Ue2, Ke2]);
2861
2862
  s(() => {
2862
2863
  _e2.current || ct2({ left: Te2, top: Ce2 });
2863
2864
  }, [Ze2, je2, Je2, Ve2]), u(() => {
@@ -2907,22 +2908,22 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2907
2908
  ye2.current = null, at2(c3 ? { left: l2 } : { top: s2 });
2908
2909
  });
2909
2910
  }, [Ze2, je2, Je2, Ve2, ge2]), ft2 = i((e5 = null) => {
2910
- Le2.current = null, Ke2.current = null, be2();
2911
+ Le2.current = null, qe2.current = null, be2();
2911
2912
  }, []);
2912
2913
  u(() => {
2913
2914
  ft2();
2914
2915
  }, [N2]);
2915
- const pt2 = Kt(r2, () => ({ stage: me2.current, focus: We2, contains: He2, invalidate: ft2, scrollTo: ct2, scrollBy: at2, scrollCellCoordsIntoView: ut2, getScrollPosition: Ne2, getDimensions: et2, getViewport: rt2, handleWheel: ht2, rowCount: w2, columnCount: m2, getLayout: () => De2, getRelativePointFromClient: tt2, getViewFromClient: ot2, getViewFromCellCoords: dt2, getViewFromLocation: nt2, onViewChangeOnce: (e5) => {
2916
+ const pt2 = qt(r2, () => ({ stage: me2.current, focus: We2, contains: He2, invalidate: ft2, scrollTo: ct2, scrollBy: at2, scrollCellCoordsIntoView: ut2, getScrollPosition: Ne2, getDimensions: et2, getViewport: rt2, handleWheel: ht2, rowCount: w2, columnCount: m2, getLayout: () => De2, getRelativePointFromClient: tt2, getViewFromClient: ot2, getViewFromCellCoords: dt2, getViewFromLocation: nt2, onViewChangeOnce: (e5) => {
2916
2917
  Ye2.current.push(e5);
2917
2918
  } }), [w2, m2, Xe2]);
2918
2919
  s(() => (le2 && pt2.current?.addEventListener("wheel", ht2, { passive: false }), Pe2.current = true, _e2.current = null, () => {
2919
2920
  pt2.current?.removeEventListener("wheel", ht2);
2920
2921
  }), [le2]);
2921
2922
  const gt2 = l([]), wt2 = (t2, n2) => {
2922
- if (!t2 || !K2) return;
2923
+ if (!t2 || !q2) return;
2923
2924
  gt2.current = [];
2924
2925
  n2.push(((t3, o3) => {
2925
- const r3 = `view:${t3.getAnchor()}:overlay:${n2.length}`, i2 = K2?.({ key: r3, view: t3 }, (e5) => gt2.current[o3] = e5);
2926
+ const r3 = `view:${t3.getAnchor()}:overlay:${n2.length}`, i2 = q2?.({ key: r3, view: t3 }, (e5) => gt2.current[o3] = e5);
2926
2927
  if (!i2) return null;
2927
2928
  const l2 = t3.getBounds();
2928
2929
  return e("div", { style: { position: "absolute", left: "0px", top: "0px", width: `${l2.width}px`, height: `${l2.height}px`, overflow: "hidden" }, children: i2 }, `overlay-${t3.getAnchor()}-${o3}`);
@@ -2934,7 +2935,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2934
2935
  wt2(Xe2[o3], r3), e5[o3] = { overlays: r3 };
2935
2936
  }
2936
2937
  return e5;
2937
- }, [ve2, K2, w2, m2, Ue2, qe2]), xt2 = (t2, n2, o3, r3, i2, l2, s2) => {
2938
+ }, [ve2, q2, w2, m2, Ue2, Ke2]), xt2 = (t2, n2, o3, r3, i2, l2, s2) => {
2938
2939
  if (!t2) return;
2939
2940
  const c3 = t2.getVisibleColumns(), a3 = t2.getVisibleRows();
2940
2941
  if (0 === c3.length || 0 === a3.length) return;
@@ -3002,7 +3003,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
3002
3003
  xt2(Xe2[i2], c3, l2, s2, /* @__PURE__ */ new Set(), e5, t2), n2[i2] = { cells: c3, rangesH: l2, rangesV: s2 };
3003
3004
  }
3004
3005
  return Le2.current = t2, n2;
3005
- }, [ve2, w2, m2, Ue2, qe2, D2, de2, B2, oe2, re2, ce2]), vt2 = (t2, n2, o3, r3, i2) => {
3006
+ }, [ve2, w2, m2, Ue2, Ke2, D2, de2, B2, oe2, re2, ce2]), vt2 = (t2, n2, o3, r3, i2) => {
3006
3007
  if (t2) if (n2) {
3007
3008
  const e5 = `view:${t2.getAnchor()}:hl:`, n3 = t2.getVisibleRows();
3008
3009
  if (!n3 || 0 === n3.length) return;
@@ -3064,7 +3065,7 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
3064
3065
  n2[r3] = e("svg", { width: `${c3}`, height: `${a3}`, viewBox: `0 0 ${c3} ${a3}`, preserveAspectRatio: "none", shapeRendering: "crispEdges", style: { position: "absolute" }, children: l2 });
3065
3066
  }
3066
3067
  return n2;
3067
- }, St2 = d(() => true === D2 || true === D2?.horizontal ? bt2(true) : null, [ve2, D2, Ue2, V2, j2, z2, A2, w2, m2, je2, Ze2, yt2]), Et2 = d(() => true === D2 || true === D2?.vertical ? bt2(false) : null, [ve2, D2, qe2, V2, j2, z2, $2, w2, m2, Ve2, Je2, yt2]), _t2 = d(() => 0 === Qe2.left ? null : e(lo, { linePoints: [0, 0, 0, Ve2 + 1], bounds: { x: Qe2.left, y: 0, width: 1, height: Ve2 + 1 }, ...W2 }), [ve2, Qe2.left, Ve2, W2]), It2 = d(() => 0 === Qe2.top ? null : e(lo, { linePoints: [0, 0, je2 + 1, 0], bounds: { x: 0, y: Qe2.top, width: je2 + 1, height: 1 }, ...H2 }), [ve2, Qe2.top, je2, H2]), Ct2 = d(() => {
3068
+ }, St2 = d(() => true === D2 || true === D2?.horizontal ? bt2(true) : null, [ve2, D2, Ue2, V2, j2, z2, A2, w2, m2, je2, Ze2, yt2]), Et2 = d(() => true === D2 || true === D2?.vertical ? bt2(false) : null, [ve2, D2, Ke2, V2, j2, z2, $2, w2, m2, Ve2, Je2, yt2]), _t2 = d(() => 0 === Qe2.left ? null : e(lo, { linePoints: [0, 0, 0, Ve2 + 1], bounds: { x: Qe2.left, y: 0, width: 1, height: Ve2 + 1 }, ...W2 }), [ve2, Qe2.left, Ve2, W2]), It2 = d(() => 0 === Qe2.top ? null : e(lo, { linePoints: [0, 0, je2 + 1, 0], bounds: { x: 0, y: Qe2.top, width: je2 + 1, height: 1 }, ...H2 }), [ve2, Qe2.top, je2, H2]), Ct2 = d(() => {
3068
3069
  const o3 = [], r3 = (e5) => {
3069
3070
  if (!e5 || !Xe2[e5]) return;
3070
3071
  const n2 = Xe2[e5].getBounds();
@@ -3087,12 +3088,12 @@ const fo = -10, po = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
3087
3088
  if (!r3) return;
3088
3089
  const i3 = r3.getBounds(), l3 = r3.getInsets(), s3 = r3.getAnchor();
3089
3090
  return t("div", { className: g("view", `view-${s3}`, bo.view), style: { position: "absolute", pointerEvents: "none", left: i3.x - l3.left, top: i3.y - l3.top, width: i3.width - (l3.left + l3.right), height: i3.height - (l3.top + l3.bottom), clipPath: Z2 ? "inset(-2px)" : "inset(0px)" }, children: [e5(n3, o4, r3, X2), mt2?.[s3].overlays] }, `view:${s3}`);
3090
- }, o3 = Ke2.current, i2 = {}, l2 = [], s2 = Object.keys(Xe2);
3091
+ }, o3 = qe2.current, i2 = {}, l2 = [], s2 = Object.keys(Xe2);
3091
3092
  for (let e6 = 0; e6 < s2.length; e6++) {
3092
3093
  const t2 = s2[e6], r3 = o3?.[t2], c3 = i2[t2] = /* @__PURE__ */ new Map();
3093
3094
  l2.push(n2(r3, c3, Xe2[t2]));
3094
3095
  }
3095
- return Ke2.current = i2, l2;
3096
+ return qe2.current = i2, l2;
3096
3097
  }, [ve2, Xe2, Z2, X2]), kt2 = d(() => {
3097
3098
  const { style: t2, ...n2 } = J2 ?? {};
3098
3099
  return e("div", { style: { width: je2, height: Ve2, ...t2 }, className: "sheetxl-stage", tabIndex: 0, ref: me2, ...n2, ...ue2, children: Q2 ? Q2(Ct2) : Ct2 });
@@ -3194,20 +3195,20 @@ const jo = (e5 = void 0) => Object.freeze({ clean: e5, dirty: void 0, editMode:
3194
3195
  let j2 = 2;
3195
3196
  const V2 = 96 * A2 / 72, W2 = 1.2 * V2;
3196
3197
  "right" === O2 && (j2 += 1);
3197
- const H2 = d(() => new Fo().naturalDimensions(F2, { maxWidth: "wrap" === D2 ? T2 - j2 : void 0, lineHeight: `${W2}px`, paintableText: { fontStyle: B2, wrap: D2, letterSpacing: -0.25 } }), [F2, D2, j2, V2, z2, $2, B2, m2, T2]), N2 = i(() => H2.maxLineHeight ? H2.maxLineHeight + "px" : "1.2", [H2]), [U2, q2] = h(N2);
3198
+ const H2 = d(() => new Fo().naturalDimensions(F2, { maxWidth: "wrap" === D2 ? T2 - j2 : void 0, lineHeight: `${W2}px`, paintableText: { fontStyle: B2, wrap: D2, letterSpacing: -0.25 } }), [F2, D2, j2, V2, z2, $2, B2, m2, T2]), N2 = i(() => H2.maxLineHeight ? H2.maxLineHeight + "px" : "1.2", [H2]), [U2, K2] = h(N2);
3198
3199
  u(() => {
3199
- q2(N2());
3200
+ K2(N2());
3200
3201
  }, [w2, H2]), u(() => {
3201
3202
  m2?.({ width: "wrap" === D2 ? void 0 : H2.width + j2, height: H2.height });
3202
3203
  }, [H2, m2]);
3203
- const K2 = Tt(a2, [a2]), Y2 = Tt((e5) => {
3204
+ const q2 = Tt(a2, [a2]), Y2 = Tt((e5) => {
3204
3205
  if (k2.dirty === e5) return;
3205
3206
  const t3 = { ...k2 };
3206
- t3.dirty = e5, M2.current, R2(t3), K2?.(t3);
3207
+ t3.dirty = e5, M2.current, R2(t3), q2?.(t3);
3207
3208
  }, [k2]), X2 = Tt((e5) => {
3208
3209
  if (k2.editMode === e5) return;
3209
3210
  const t3 = { ...k2 };
3210
- t3.editMode = e5, R2(t3), K2?.(t3);
3211
+ t3.editMode = e5, R2(t3), q2?.(t3);
3211
3212
  }, [k2]), G2 = Tt(() => {
3212
3213
  try {
3213
3214
  return f2?.(k2), g2?.(), true;
@@ -3220,7 +3221,7 @@ const jo = (e5 = void 0) => Object.freeze({ clean: e5, dirty: void 0, editMode:
3220
3221
  if (!M2.current) return;
3221
3222
  if (e5.isDefaultPrevented(), !(e5.isTrusted || e5.nativeEvent.ctrlKey || e5.nativeEvent.metaKey || e5.nativeEvent.altKey || e5.nativeEvent.isComposing) && -1 !== $n.indexOf(e5.nativeEvent.key)) {
3222
3223
  const t4 = { ...k2 };
3223
- return t4.dirty = "Backspace" === e5.nativeEvent.key ? "" : (t4.dirty ?? "") + e5.key, R2(t4), K2?.(t4), void e5.preventDefault();
3224
+ return t4.dirty = "Backspace" === e5.nativeEvent.key ? "" : (t4.dirty ?? "") + e5.key, R2(t4), q2?.(t4), void e5.preventDefault();
3224
3225
  }
3225
3226
  const t3 = e5.nativeEvent.shiftKey;
3226
3227
  if (e5.which === vt) return e5.preventDefault(), void Z2();
@@ -3247,7 +3248,7 @@ const jo = (e5 = void 0) => Object.freeze({ clean: e5, dirty: void 0, editMode:
3247
3248
  s(() => {
3248
3249
  ee2(false);
3249
3250
  }, []);
3250
- const te2 = Kt(n2, () => ({ startEdit(e5) {
3251
+ const te2 = qt(n2, () => ({ startEdit(e5) {
3251
3252
  let t3 = e5?.initialSelection;
3252
3253
  if (!t3) {
3253
3254
  const e6 = M2.current.value.length ?? 0;
@@ -3255,7 +3256,7 @@ const jo = (e5 = void 0) => Object.freeze({ clean: e5, dirty: void 0, editMode:
3255
3256
  }
3256
3257
  M2.current?.setSelectionRange(t3.start, t3.end, t3.direction);
3257
3258
  const n3 = { ...o2, editMode: e5?.editMode ?? false };
3258
- void 0 !== e5?.text && (n3.dirty = e5.text), n3.editMode === o2.editMode && n3.dirty === o2.dirty || (R2(n3), K2?.(n3));
3259
+ void 0 !== e5?.text && (n3.dirty = e5.text), n3.editMode === o2.editMode && n3.dirty === o2.dirty || (R2(n3), q2?.(n3));
3259
3260
  }, submitEdit: () => G2(), cancelEdit() {
3260
3261
  Z2();
3261
3262
  }, autoFocus() {