@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,17 +1,17 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode("._sheetxl-grid_11irg_13{position:relative;box-sizing:border-box;user-select:none}._sheetxl-grid_11irg_13 *{box-sizing:border-box!important}._sheetxl-grid_11irg_13 *:focus{outline:none}._sheetxl-grid_11irg_13 .cell-container{position:absolute;overflow:visible;white-space:pre}._sheetxl-grid_11irg_13 .cell-container>*{inset:0;position:absolute}._sheetxl-grid_11irg_13 .sheetxl-stage{contain:strict}._sheetxl-grid_11irg_13 .sheetxl-stage>*{contain:strict}")),document.head.appendChild(e)}}catch(i){console.error("vite-plugin-css-injected-by-js",i)}})();
2
- import { jsx as Y, jsxs as Ht, Fragment as wn } from "react/jsx-runtime";
3
- import Sn, { memo as Dt, useCallback as O, useRef as J, useEffect as st, useImperativeHandle as Ur, forwardRef as Ut, useMemo as Ee, useLayoutEffect as nn, useState as Je, version as qr, createElement as Jo, useReducer as Qo } from "react";
1
+ (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode("._sheetxl-grid_h9wwa_7{position:relative;box-sizing:border-box;user-select:none}._sheetxl-grid_h9wwa_7 *{box-sizing:border-box!important}._sheetxl-grid_h9wwa_7 *:focus{outline:none}._sheetxl-grid_h9wwa_7 .cell-container{position:absolute;overflow:visible;white-space:pre}._sheetxl-grid_h9wwa_7 .cell-container>*{inset:0;position:absolute}._sheetxl-grid_h9wwa_7 .sheetxl-stage{contain:strict}._sheetxl-grid_h9wwa_7 .sheetxl-stage>*{contain:strict}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
+ import { jsx as q, jsxs as Ht, Fragment as wn } from "react/jsx-runtime";
3
+ import Sn, { memo as At, useCallback as D, useRef as Z, useEffect as st, useImperativeHandle as Ur, forwardRef as Ut, useMemo as _e, useLayoutEffect as tn, useState as Ze, version as Kr, createElement as Jo, useReducer as Qo } from "react";
4
4
  import { createRoot as Oi } from "react-dom/client";
5
- import { unstable_batchedUpdates as Li, createPortal as Kr } from "react-dom";
5
+ import { unstable_batchedUpdates as Li, createPortal as qr } from "react-dom";
6
6
  /**
7
- * @license @sheetxl/grid-react - Grid - Advanced data grid component for React - v0.3.2
7
+ * @license @sheetxl/grid-react - Grid - Advanced data grid component for React - v0.3.4
8
8
  *
9
9
  * (C) 2025-present SheetXL Inc. & Michael T. Ford
10
10
  * License: The license can be found at https://www.sheetxl.com/license.
11
11
  */
12
- const it = "up", lt = "down", ot = "left", Ke = "right", uo = "tl", Hn = "t", Nn = "l", Xt = "c", Bt = "text/html", fn = "text/plain", Mo = "image/png", Di = Object.freeze({ left: 0, top: 0 }), zi = Object.freeze({ left: 0, top: 0, bottom: 0, right: 0 }), Ai = Object.freeze({ x: 0, y: 0, width: 0, height: 0 });
12
+ const it = "up", lt = "down", ot = "left", Ke = "right", uo = "tl", Hn = "t", Nn = "l", Xt = "c", Ft = "text/html", fn = "text/plain", Mo = "image/png", Di = Object.freeze({ left: 0, top: 0 }), zi = Object.freeze({ left: 0, top: 0, bottom: 0, right: 0 }), Ai = Object.freeze({ x: 0, y: 0, width: 0, height: 0 });
13
13
  Object.freeze(Object.defineProperty({ __proto__: null, EmptyBounds: Ai, EmptyRect: zi, EmptyTopLeft: Di }, Symbol.toStringTag, { value: "Module" }));
14
- const Nt = "column", cn = "row", $i = Object.freeze({ colIndex: 0, rowIndex: 0 }), Bi = Object.freeze({ colStart: 0, rowStart: 0, colEnd: 0, rowEnd: 0 }), Yr = (e, t) => e.colStart === t.colStart ? e.rowStart - t.rowStart : e.colStart - t.colStart, Xr = (e, t) => e.rowStart === t.rowStart ? e.colStart - t.colStart : e.rowStart - t.rowStart, Fi = (e, t) => e.rowEnd === t.rowEnd ? t.colEnd - e.colEnd : t.rowEnd - e.rowEnd, ji = (e, t) => e.colEnd === t.colEnd ? t.rowEnd - e.rowEnd : t.colEnd - e.colEnd, or = (e, t) => e.colIndex === t.colIndex ? e.rowIndex - t.rowIndex : e.colIndex - t.colIndex, rr = (e, t) => e.rowIndex === t.rowIndex ? e.colIndex - t.colIndex : e.rowIndex - t.rowIndex, Gr = (e = cn, t = !1) => t ? e !== Nt ? Fi : ji : e !== Nt ? Xr : Yr, ir = (e, t) => e === t || !(!e || !t) && e.rowIndex === t.rowIndex && e.colIndex === t.colIndex, jo = (e, t) => e === t || !(!e || !t) && e.rowStart === t.rowStart && e.rowEnd === t.rowEnd && e.colStart === t.colStart && e.colEnd === t.colEnd, Vo = (e, t) => !(!e || !t || e.colStart > t.colEnd || t.colStart > e.colEnd || e.rowStart > t.rowEnd || t.rowStart > e.rowEnd), lr = (e, t) => {
14
+ const Nt = "column", an = "row", $i = Object.freeze({ colIndex: 0, rowIndex: 0 }), Bi = Object.freeze({ colStart: 0, rowStart: 0, colEnd: 0, rowEnd: 0 }), Yr = (e, t) => e.colStart === t.colStart ? e.rowStart - t.rowStart : e.colStart - t.colStart, Xr = (e, t) => e.rowStart === t.rowStart ? e.colStart - t.colStart : e.rowStart - t.rowStart, Fi = (e, t) => e.rowEnd === t.rowEnd ? t.colEnd - e.colEnd : t.rowEnd - e.rowEnd, ji = (e, t) => e.colEnd === t.colEnd ? t.rowEnd - e.rowEnd : t.colEnd - e.colEnd, or = (e, t) => e.colIndex === t.colIndex ? e.rowIndex - t.rowIndex : e.colIndex - t.colIndex, rr = (e, t) => e.rowIndex === t.rowIndex ? e.colIndex - t.colIndex : e.rowIndex - t.rowIndex, Gr = (e = an, t = !1) => t ? e !== Nt ? Fi : ji : e !== Nt ? Xr : Yr, ir = (e, t) => e === t || !(!e || !t) && e.rowIndex === t.rowIndex && e.colIndex === t.colIndex, jo = (e, t) => e === t || !(!e || !t) && e.rowStart === t.rowStart && e.rowEnd === t.rowEnd && e.colStart === t.colStart && e.colEnd === t.colEnd, Vo = (e, t) => !(!e || !t || e.colStart > t.colEnd || t.colStart > e.colEnd || e.rowStart > t.rowEnd || t.rowStart > e.rowEnd), lr = (e, t) => {
15
15
  if (e === t) return !0;
16
16
  if (!e || !t || e.length !== t.length) return !1;
17
17
  for (let n = 0; n < e.length; n++) if (!jo(e[n], t[n])) return !1;
@@ -34,54 +34,54 @@ const Nt = "column", cn = "row", $i = Object.freeze({ colIndex: 0, rowIndex: 0 }
34
34
  }, Vi = [null, null], Wi = (e, t, n) => {
35
35
  if (e[0].value === e[1].value) return t;
36
36
  };
37
- function cr(e, t = 2, n, o = cn, r) {
37
+ function cr(e, t = 2, n, o = an, r) {
38
38
  let i = [...e];
39
39
  if (t <= 0 || e.length <= 1) return i;
40
40
  let l = o === Nt, s = 0, a = !1;
41
41
  do {
42
- const d = i.sort(Gr(l ? cn : Nt));
42
+ const d = i.sort(Gr(l ? an : Nt));
43
43
  i = [], i.push(d[0]);
44
44
  const g = d.length;
45
- let m = 0, f = d[0], x = f.colStart, E = f.rowStart, I = f.colEnd, M = f.rowEnd;
45
+ let m = 0, f = d[0], x = f.colStart, _ = f.rowStart, I = f.colEnd, R = f.rowEnd;
46
46
  for (let ae = 1; ae < g; ae++) {
47
- const R = d[ae];
48
- let _ = !1;
49
- if (_ = l ? f && E === R.rowStart && M === R.rowEnd && I + 1 === R.colStart : f && x === R.colStart && I === R.colEnd && M + 1 === R.rowStart, _) {
50
- let L = { colStart: x, rowStart: E, colEnd: l ? R.colEnd : I, rowEnd: l ? M : R.rowEnd };
51
- if (f.value !== void 0 && (L.value = f.value), n) {
47
+ const P = d[ae];
48
+ let C = !1;
49
+ if (C = l ? f && _ === P.rowStart && R === P.rowEnd && I + 1 === P.colStart : f && x === P.colStart && I === P.colEnd && R + 1 === P.rowStart, C) {
50
+ let z = { colStart: x, rowStart: _, colEnd: l ? P.colEnd : I, rowEnd: l ? R : P.rowEnd };
51
+ if (f.value !== void 0 && (z.value = f.value), n) {
52
52
  const le = r ?? [null, null];
53
- le[0] = f, le[1] = R, L = n(le, L, o);
53
+ le[0] = f, le[1] = P, z = n(le, z, o);
54
54
  }
55
- if (L) {
56
- i[m] = L, a = !0, f = L, x = f.colStart, E = f.rowStart, I = f.colEnd, M = f.rowEnd;
55
+ if (z) {
56
+ i[m] = z, a = !0, f = z, x = f.colStart, _ = f.rowStart, I = f.colEnd, R = f.rowEnd;
57
57
  continue;
58
58
  }
59
59
  }
60
- i[++m] = R, f = R, x = f.colStart, E = f.rowStart, I = f.colEnd, M = f.rowEnd;
60
+ i[++m] = P, f = P, x = f.colStart, _ = f.rowStart, I = f.colEnd, R = f.rowEnd;
61
61
  }
62
62
  s++, l = !l, s === 1 && (a = !0);
63
63
  } while (s < t && a && i.length > 1);
64
64
  return i;
65
65
  }
66
- const Z = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCell: $i, EmptyRange: Bi, cellToRange: (e, t) => {
66
+ const G = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCell: $i, EmptyRange: Bi, cellToRange: (e, t) => {
67
67
  if (!e) return null;
68
68
  let n = t;
69
69
  return n || (n = { ...e }, delete n.colIndex, delete n.rowIndex), n.colStart = e.colIndex ?? 0, n.rowStart = e.rowIndex ?? 0, n.colEnd = e.colIndex ?? 0, n.rowEnd = e.rowIndex ?? 0, n;
70
- }, columnFirstCellComparator: or, columnFirstRangeComparator: Yr, createCellComparator: (e = cn, t = !1) => t ? e !== Nt ? (n, o) => n.rowIndex === o.rowIndex ? o.colIndex - n.colIndex : o.rowIndex - n.rowIndex : (n, o) => n.colIndex === o.colIndex ? o.rowIndex - n.rowIndex : o.colIndex - n.colIndex : e !== Nt ? rr : or, createConflatingRanges: (e, t = !1) => {
70
+ }, columnFirstCellComparator: or, columnFirstRangeComparator: Yr, createCellComparator: (e = an, t = !1) => t ? e !== Nt ? (n, o) => n.rowIndex === o.rowIndex ? o.colIndex - n.colIndex : o.rowIndex - n.rowIndex : (n, o) => n.colIndex === o.colIndex ? o.rowIndex - n.rowIndex : o.colIndex - n.colIndex : e !== Nt ? rr : or, createConflatingRanges: (e, t = !1) => {
71
71
  const n = [];
72
72
  let o, r, i = Number.MIN_SAFE_INTEGER, l = Number.MIN_SAFE_INTEGER;
73
73
  return { append: (s, a, d) => {
74
74
  let g = !0;
75
75
  const m = d !== void 0;
76
76
  if (m) {
77
- const E = e ? e(r, d, t) : r === d ? d : void 0;
78
- E === void 0 ? g = !1 : d = E;
77
+ const _ = e ? e(r, d, t) : r === d ? d : void 0;
78
+ _ === void 0 ? g = !1 : d = _;
79
79
  }
80
80
  if (g && a === l + 1 && s === i) return t ? o.rowEnd = a : o.colEnd = a, l = a, void (r = d);
81
81
  o && n.push(o);
82
82
  const f = t ? s : a, x = t ? a : s;
83
83
  o = { colStart: f, rowStart: x, colEnd: f, rowEnd: x }, m && (o.value = d), i = s, l = a, r = d;
84
- }, done: (s) => (o && (n.push(o), o = null), s ? cr(n, 3, s === !0 ? Wi : s, t ? Nt : cn, Vi) : n) };
84
+ }, done: (s) => (o && (n.push(o), o = null), s ? cr(n, 3, s === !0 ? Wi : s, t ? Nt : an, Vi) : n) };
85
85
  }, createRangeComparator: Gr, defaultRange: (e, t, n) => e ? n ? (n.colStart = e.colStart ?? t.colStart, n.rowStart = e.rowStart ?? t.rowStart, n.colEnd = e.colEnd ?? t.colEnd, n.rowEnd = e.rowEnd ?? t.rowEnd, n) : { colStart: e.colStart ?? t.colStart, rowStart: e.rowStart ?? t.rowStart, colEnd: e.colEnd ?? t.colEnd, rowEnd: e.rowEnd ?? t.rowEnd } : t, extendRangeToIntersectingRanges: sr, extendRangeToUnionRanges: (e, t) => {
86
86
  if (!t || t.length === 0) return e;
87
87
  let n = e, o = null;
@@ -158,7 +158,7 @@ _n.all = function(e, t) {
158
158
  return _n(n, o, t);
159
159
  }, {});
160
160
  };
161
- const qi = Object.freeze([]), Ki = Object.freeze({}), ur = (e) => e, so = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) {
161
+ const Ki = Object.freeze([]), qi = Object.freeze({}), ur = (e) => e, so = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) {
162
162
  let t = 16 * Math.random() | 0;
163
163
  return (e === "x" ? t : 3 & t | 8).toString(16);
164
164
  }), Zr = (e, t) => e === t || !(!Array.isArray(e) || !Array.isArray(t) || e.length !== t.length) && e.every((n, o) => n === t[o]), Fn = (e) => typeof e == "object" && !Array.isArray(e) && e !== null, Jr = (e) => typeof e != "object" || Array.isArray(e) || e === null ? e : (Object.keys(e).forEach(function(t) {
@@ -174,15 +174,15 @@ const qi = Object.freeze([]), Ki = Object.freeze({}), ur = (e) => e, so = () =>
174
174
  Qr(e[l], t?.[l], n) === null && (r = !0, delete e[l]);
175
175
  }
176
176
  return r && Object.keys(e).length === 0 ? null : void 0;
177
- }, hr = typeof performance == "object" && typeof performance.now == "function" ? () => performance.now() : () => Date.now(), fr = (e) => e == null, pr = (e, t) => !(t.left > e.right || t.right < e.left || t.top > e.bottom || t.bottom < e.top), gr = !(typeof window > "u" || !window.document || !window.document.createElement), Ft = { Windows: "windows", MacOS: "macos", IOS: "ios", Linux: "linux", Android: "android", Safari: "safari", Firefox: "firefox", Node: "node", Unknown: "unknown" }, Un = () => {
178
- if (ei()) return Ft.Node;
177
+ }, hr = typeof performance == "object" && typeof performance.now == "function" ? () => performance.now() : () => Date.now(), fr = (e) => e == null, pr = (e, t) => !(t.left > e.right || t.right < e.left || t.top > e.bottom || t.bottom < e.top), gr = !(typeof window > "u" || !window.document || !window.document.createElement), jt = { Windows: "windows", MacOS: "macos", IOS: "ios", Linux: "linux", Android: "android", Safari: "safari", Firefox: "firefox", Node: "node", Unknown: "unknown" }, Un = () => {
178
+ if (ei()) return jt.Node;
179
179
  const e = globalThis.navigator !== void 0 && globalThis.navigator.userAgent ? globalThis.navigator.userAgent.toLowerCase() : "";
180
- return e ? /(win32|win64|windows|wince)/i.test(e) ? Ft.Windows : /(macintosh|macintel|macppc|mac68k|macos)/i.test(e) ? Ft.MacOS : /(iphone|ipad|ipod)/i.test(e) ? Ft.IOS : /android/.test(e) ? Ft.Android : /linux/.test(e) ? Ft.Linux : /^((?!chrome|android|).)*safari/i.test(e) ? Ft.Safari : /^((?!chrome|android|Seamonkey).)*firefox/i.test(e) ? Ft.Firefox : Ft.Unknown : Ft.Unknown;
180
+ return e ? /(win32|win64|windows|wince)/i.test(e) ? jt.Windows : /(macintosh|macintel|macppc|mac68k|macos)/i.test(e) ? jt.MacOS : /(iphone|ipad|ipod)/i.test(e) ? jt.IOS : /android/.test(e) ? jt.Android : /linux/.test(e) ? jt.Linux : /^((?!chrome|android|).)*safari/i.test(e) ? jt.Safari : /^((?!chrome|android|Seamonkey).)*firefox/i.test(e) ? jt.Firefox : jt.Unknown : jt.Unknown;
181
181
  };
182
182
  function ei() {
183
183
  return typeof process < "u" && process.release?.name === "node" || (typeof process < "u" && process.browser, !1);
184
184
  }
185
- const wr = (e, t = !1) => (document.hasFocus() || t) && (e === document.activeElement || e?.contains(document.activeElement)), Ct = Object.freeze(Object.defineProperty({ __proto__: null, EmptyArray: qi, EmptyObject: Ki, OSType: Ft, arrayMove: function(e, t, n) {
185
+ const wr = (e, t = !1) => (document.hasFocus() || t) && (e === document.activeElement || e?.contains(document.activeElement)), Ct = Object.freeze(Object.defineProperty({ __proto__: null, EmptyArray: Ki, EmptyObject: qi, OSType: jt, arrayMove: function(e, t, n) {
186
186
  const o = e.slice();
187
187
  return o.splice(n < 0 ? o.length + n : n, 0, o.splice(t, 1)[0]), o;
188
188
  }, asNumber: (e) => {
@@ -530,12 +530,12 @@ Please use Chrome or Edge if external copy and paste is required.`, ko = `You do
530
530
  All copy and paste operations will be limited to the browser tab.`, ri = { Safari: `The Safari browser does not support advanced copy and paste.
531
531
  Copy and paste will be limited to within the browser tab.
532
532
 
533
- Please use Chrome or Edge if external copy and paste is required.`, Perms: ko, PermsWrite: Un() === Ft.Safari ? yr : ko, PermsRead: Un() === Ft.Safari ? yr : ko }, Po = async () => new Promise((e) => {
533
+ Please use Chrome or Edge if external copy and paste is required.`, Perms: ko, PermsWrite: Un() === jt.Safari ? yr : ko, PermsRead: Un() === jt.Safari ? yr : ko }, Po = async () => new Promise((e) => {
534
534
  document.hasFocus() ? e() : globalThis.addEventListener?.("focus", () => {
535
535
  e();
536
536
  }, { once: !0 }), document.activeElement.focus?.();
537
537
  }), Oo = async (e, t, n) => {
538
- if (Un() === Ft.Safari) return await n(new Error(ri.Safari));
538
+ if (Un() === jt.Safari) return await n(new Error(ri.Safari));
539
539
  try {
540
540
  const o = async (l) => {
541
541
  try {
@@ -552,7 +552,7 @@ Please use Chrome or Edge if external copy and paste is required.`, Perms: ko, P
552
552
  }
553
553
  }, ii = async (e) => {
554
554
  try {
555
- return await e.read({ unsanitized: [Bt] });
555
+ return await e.read({ unsanitized: [Ft] });
556
556
  } catch {
557
557
  }
558
558
  return await e.read();
@@ -582,7 +582,7 @@ if (!globalThis.ClipboardItem) {
582
582
  }
583
583
  globalThis.ClipboardItem = t;
584
584
  }
585
- const Ho = async (e, t = Bt) => new Promise(async (n, o) => {
585
+ const Ho = async (e, t = Ft) => new Promise(async (n, o) => {
586
586
  try {
587
587
  const r = await (async (i, l) => {
588
588
  if (!i) return null;
@@ -602,21 +602,21 @@ const Ho = async (e, t = Bt) => new Promise(async (n, o) => {
602
602
  } catch (r) {
603
603
  o(r);
604
604
  }
605
- }), br = async (e, t = Bt) => {
605
+ }), br = async (e, t = Ft) => {
606
606
  const n = await Ho(e, t);
607
607
  if (!n) return null;
608
608
  let o = null;
609
609
  try {
610
- o = new DOMParser().parseFromString(n, Bt);
610
+ o = new DOMParser().parseFromString(n, Ft);
611
611
  } catch {
612
612
  console.warn("Can't parse html from clipboard.");
613
613
  }
614
614
  return o;
615
- }, qn = "clipboard-uuid", Tn = "web text/uuid", Sr = (e) => `<div style="display:none" ${qn}="${e}"/>`, Xi = (e, t) => {
615
+ }, Kn = "clipboard-uuid", Tn = "web text/uuid", Sr = (e) => `<div style="display:none" ${Kn}="${e}"/>`, Xi = (e, t) => {
616
616
  let n = null;
617
617
  try {
618
- const o = new DOMParser().parseFromString(t, Bt);
619
- o.body.firstElementChild.setAttribute(qn, e), n = o.getElementsByTagName("body")[0].innerHTML;
618
+ const o = new DOMParser().parseFromString(t, Ft);
619
+ o.body.firstElementChild.setAttribute(Kn, e), n = o.getElementsByTagName("body")[0].innerHTML;
620
620
  } catch (o) {
621
621
  console.warn("Can't embed uuid.", o);
622
622
  }
@@ -624,7 +624,7 @@ const Ho = async (e, t = Bt) => new Promise(async (n, o) => {
624
624
  }, Er = (e, t) => {
625
625
  if (!t || !e) return !1;
626
626
  try {
627
- const n = t.querySelectorAll(`[${qn}="${e}"]`);
627
+ const n = t.querySelectorAll(`[${Kn}="${e}"]`);
628
628
  if (n && n.length === 1) return !0;
629
629
  if (t.querySelector("parsererror")) throw new Error("We are unable to parse node");
630
630
  return !1;
@@ -647,10 +647,10 @@ let ho = class {
647
647
  await Po();
648
648
  const e = await Ho(this._nativeClipboard, Tn);
649
649
  if (!this._state || e && e === this._state.uuid) return !0;
650
- const t = await br(this._nativeClipboard, Bt);
650
+ const t = await br(this._nativeClipboard, Ft);
651
651
  return !this._state || (Er(this._state.uuid, t) || this.clear(), !0);
652
652
  }, async (e) => {
653
- e?.message === "denied" || e.message?.includes("Document is not focused") || Un() === Ft.Safari || console.warn("Unable to detect clipboard changes: ", e);
653
+ e?.message === "denied" || e.message?.includes("Document is not focused") || Un() === jt.Safari || console.warn("Unable to detect clipboard changes: ", e);
654
654
  });
655
655
  }
656
656
  _init() {
@@ -670,7 +670,7 @@ let ho = class {
670
670
  if (await Po(), this._state?.uuid) {
671
671
  const t = await Ho(this._nativeClipboard, Tn);
672
672
  if (t && t === e._state.uuid) return !0;
673
- const n = await br(this._nativeClipboard, Bt);
673
+ const n = await br(this._nativeClipboard, Ft);
674
674
  if (Er(e._state?.uuid, n)) return !0;
675
675
  }
676
676
  return e._state = { items: await ii(this._nativeClipboard), uuid: null, ref: null }, this.dispatchEvent(new Event("clipboardread")), !0;
@@ -689,32 +689,32 @@ let ho = class {
689
689
  t._state = { uuid: o, ref: e.ref, items: n }, t.dispatchEvent(new Event("clipboardwrite")), t.dispatchEvent(new Event("clipboardchange"));
690
690
  };
691
691
  await Oo("clipboard-write", async () => {
692
- await Po(), o && r.length === 0 && (r.push(new ClipboardItem({ [Tn]: new Blob([o], { type: Tn }) })), r.push(new ClipboardItem({ [Bt]: new Blob([Sr(o)], { type: Bt }) })));
692
+ await Po(), o && r.length === 0 && (r.push(new ClipboardItem({ [Tn]: new Blob([o], { type: Tn }) })), r.push(new ClipboardItem({ [Ft]: new Blob([Sr(o)], { type: Ft }) })));
693
693
  for (let l = 0; l < Math.min(1, r.length); l++) {
694
694
  const s = r[l];
695
- let a = s.types.indexOf(Bt), d = null;
695
+ let a = s.types.indexOf(Ft), d = null;
696
696
  if (a !== -1) {
697
- const f = await s.getType(Bt);
697
+ const f = await s.getType(Ft);
698
698
  d = await Wo(f), d && (d = Xi(o, d));
699
699
  }
700
700
  if (!d && s.types.includes(fn)) {
701
701
  const f = await s.getType(fn);
702
702
  if (f) {
703
703
  let x = null;
704
- typeof f == "string" ? (console.warn("text as string", f), x = f) : x = await Wo(f), x && (d = `<div ${qn}="${o}">${x}</div>`);
704
+ typeof f == "string" ? (console.warn("text as string", f), x = f) : x = await Wo(f), x && (d = `<div ${Kn}="${o}">${x}</div>`);
705
705
  }
706
706
  }
707
707
  if (!d && s.types.includes(Mo)) {
708
708
  const f = await s.getType(Mo), x = ti(await f.arrayBuffer());
709
- d = `<div ${qn}="${o}"><img src="${ni + x}"/></div>`;
709
+ d = `<div ${Kn}="${o}"><img src="${ni + x}"/></div>`;
710
710
  }
711
711
  !d && o && (d = Sr(o));
712
- const g = new Blob([d ?? ""], { type: Bt }), m = {};
712
+ const g = new Blob([d ?? ""], { type: Ft }), m = {};
713
713
  for (let f = 0; f < s.types.length; f++) {
714
714
  const x = s.types[f];
715
715
  m[x] = f === a ? g : s.getType(x);
716
716
  }
717
- d && a === -1 && (m[Bt] = g), o && (m[Tn] = new Blob([o], { type: Tn })), n.push(new ClipboardItem(m));
717
+ d && a === -1 && (m[Ft] = g), o && (m[Tn] = new Blob([o], { type: Tn })), n.push(new ClipboardItem(m));
718
718
  }
719
719
  try {
720
720
  n && n.length !== 0 ? await this._nativeClipboard.write(n) : await (async (l) => {
@@ -740,7 +740,7 @@ let ho = class {
740
740
  }
741
741
  try {
742
742
  const r = await e.toHtml?.() ?? null;
743
- r && (n[Bt] = new Blob([r], { type: Bt }));
743
+ r && (n[Ft] = new Blob([r], { type: Ft }));
744
744
  } catch (r) {
745
745
  t = r, console.warn("export to html", r);
746
746
  }
@@ -810,13 +810,13 @@ var Lo;
810
810
  try {
811
811
  if (typeof document < "u") {
812
812
  var e = document.createElement("style");
813
- e.appendChild(document.createTextNode("._sheetxl-scrollbar_18qzf_11 ::-webkit-scrollbar-button{background:transparent}._fullscreen-portal-root_5qk7s_7{pointer-events:none;position:absolute;inset:0;width:100%;height:100%;z-index:1200}._fullscreen-portal-root_5qk7s_7>*{pointer-events:auto}")), document.head.appendChild(e);
813
+ e.appendChild(document.createTextNode("._sheetxl-scrollbar_eblx4_6 ::-webkit-scrollbar-button{background:transparent}._fullscreen-portal-root_1mjsr_4{pointer-events:none;position:absolute;inset:0;width:100%;height:100%;z-index:1200}._fullscreen-portal-root_1mjsr_4>*{pointer-events:auto}")), document.head.appendChild(e);
814
814
  }
815
815
  } catch (t) {
816
816
  console.error("vite-plugin-css-injected-by-js", t);
817
817
  }
818
818
  }();
819
- const Wn = { Left: "left", Right: "right", Center: "center" }, It = "shift", yn = "alt", Lt = "ctrl", Gi = 9, Zi = 13, Ji = 27, Qi = 37, el = 38, tl = 39, nl = 40, ol = 113, _r = 3, mn = { Horizontal: "horizontal", Vertical: "vertical" };
819
+ const Wn = { Left: "left", Right: "right", Center: "center" }, It = "shift", yn = "alt", zt = "ctrl", Gi = 9, Zi = 13, Ji = 27, Qi = 37, el = 38, tl = 39, nl = 40, ol = 113, _r = 3, mn = { Horizontal: "horizontal", Vertical: "vertical" };
820
820
  function li(e) {
821
821
  var t, n, o = "";
822
822
  if (typeof e == "string" || typeof e == "number") o += e;
@@ -831,13 +831,13 @@ function Rn() {
831
831
  return o;
832
832
  }
833
833
  var rl = function() {
834
- }, si = typeof window < "u", il = si ? nn : st, Ir = { x: 0, y: 0, width: 0, height: 0, top: 0, left: 0, bottom: 0, right: 0 };
834
+ }, si = typeof window < "u", il = si ? tn : st, Ir = { x: 0, y: 0, width: 0, height: 0, top: 0, left: 0, bottom: 0, right: 0 };
835
835
  const In = si && window.ResizeObserver !== void 0 ? function() {
836
- var e = Je(null), t = e[0], n = e[1], o = Je(Ir), r = o[0], i = o[1], l = Ee(function() {
836
+ var e = Ze(null), t = e[0], n = e[1], o = Ze(Ir), r = o[0], i = o[1], l = _e(function() {
837
837
  return new window.ResizeObserver(function(s) {
838
838
  if (s[0]) {
839
- var a = s[0].contentRect, d = a.x, g = a.y, m = a.width, f = a.height, x = a.top, E = a.left, I = a.bottom, M = a.right;
840
- i({ x: d, y: g, width: m, height: f, top: x, left: E, bottom: I, right: M });
839
+ var a = s[0].contentRect, d = a.x, g = a.y, m = a.width, f = a.height, x = a.top, _ = a.left, I = a.bottom, R = a.right;
840
+ i({ x: d, y: g, width: m, height: f, top: x, left: _, bottom: I, right: R });
841
841
  }
842
842
  });
843
843
  }, []);
@@ -848,17 +848,17 @@ const In = si && window.ResizeObserver !== void 0 ? function() {
848
848
  }, [t]), [n, r];
849
849
  } : function() {
850
850
  return [rl, Ir];
851
- }, T = (e, t) => {
852
- const n = O((...i) => e?.(...i), t), o = J(null);
851
+ }, k = (e, t) => {
852
+ const n = D((...i) => e?.(...i), t), o = Z(null);
853
853
  o.current = n;
854
- const r = O((...i) => o.current?.(...i), []);
854
+ const r = D((...i) => o.current?.(...i), []);
855
855
  if (o.current) return r;
856
856
  }, ll = (e) => {
857
857
  const { style: t, orientation: n = mn.Vertical, ...o } = e, r = n === mn.Vertical;
858
- return Y("div", { style: { paddingBottom: "0px", paddingRight: "0px", paddingLeft: r ? "0px" : "3px", paddingTop: r ? "3px" : "0px", display: "flex", alignItems: "center", justifyContent: "center", ...t }, ...o, children: Y("button", { style: { padding: "0", display: "flex", alignItems: "center", justifyContent: "center", border: "none" }, className: `scrollbar-button ${r ? "vertical" : "horizontal"} single-button start`, children: Y("svg", { width: "9", height: "9", viewBox: "0 0 6 6", style: { opacity: "inherit" }, children: Y("path", { d: r ? "m 3.7274761,0.68060577 1.11969,1.93863003 1.12075,1.93912 c 0.0895,0.155 0.12152,0.33658 0.0904,0.51283 -0.0311,0.17625 -0.12336,0.33591 -0.26054,0.45091 -0.13715,0.11495 -0.31044,0.17793 -0.4894,0.17781 H 0.83095614 c -0.20186,0 -0.39542,-0.0802 -0.53814,-0.2229 -0.14272,-0.14272 -0.22291,-0.33629 -0.22291,-0.53814 -3e-4,-0.13308 0.0347,-0.26385 0.10147,-0.379 l 1.11872996,-1.94066 1.11921,-1.93864003 c 0.13594,-0.23541 0.38717,-0.38047 0.65905,-0.38047 0.27188,0 0.52311,0.14506 0.65905,0.38047 z" : "m 0.75051,2.3424298 1.93863,-1.11969 1.93912,-1.12075 c 0.155,-0.0895 0.33658,-0.12152 0.51283,-0.0904 0.17625,0.0311 0.33591,0.12336 0.45091,0.26054 0.11495,0.13715 0.17793,0.31044 0.17781,0.4894 v 4.47742 c 0,0.20186 -0.0802,0.39542 -0.2229,0.53814 -0.14272,0.14272 -0.33629,0.22291 -0.53814,0.22291 -0.13308,3e-4 -0.26385,-0.0347 -0.379,-0.10147 L 2.68911,4.7797998 0.75047,3.6605898 C 0.51506,3.5246498 0.37,3.2734198 0.37,3.0015398 c 0,-0.27188 0.14506,-0.52311 0.38047,-0.65905 z" }) }) }) });
858
+ return q("div", { style: { paddingBottom: "0px", paddingRight: "0px", paddingLeft: r ? "0px" : "3px", paddingTop: r ? "3px" : "0px", display: "flex", alignItems: "center", justifyContent: "center", ...t }, ...o, children: q("button", { style: { padding: "0", display: "flex", alignItems: "center", justifyContent: "center", border: "none" }, className: `scrollbar-button ${r ? "vertical" : "horizontal"} single-button start`, children: q("svg", { width: "9", height: "9", viewBox: "0 0 6 6", style: { opacity: "inherit" }, children: q("path", { d: r ? "m 3.7274761,0.68060577 1.11969,1.93863003 1.12075,1.93912 c 0.0895,0.155 0.12152,0.33658 0.0904,0.51283 -0.0311,0.17625 -0.12336,0.33591 -0.26054,0.45091 -0.13715,0.11495 -0.31044,0.17793 -0.4894,0.17781 H 0.83095614 c -0.20186,0 -0.39542,-0.0802 -0.53814,-0.2229 -0.14272,-0.14272 -0.22291,-0.33629 -0.22291,-0.53814 -3e-4,-0.13308 0.0347,-0.26385 0.10147,-0.379 l 1.11872996,-1.94066 1.11921,-1.93864003 c 0.13594,-0.23541 0.38717,-0.38047 0.65905,-0.38047 0.27188,0 0.52311,0.14506 0.65905,0.38047 z" : "m 0.75051,2.3424298 1.93863,-1.11969 1.93912,-1.12075 c 0.155,-0.0895 0.33658,-0.12152 0.51283,-0.0904 0.17625,0.0311 0.33591,0.12336 0.45091,0.26054 0.11495,0.13715 0.17793,0.31044 0.17781,0.4894 v 4.47742 c 0,0.20186 -0.0802,0.39542 -0.2229,0.53814 -0.14272,0.14272 -0.33629,0.22291 -0.53814,0.22291 -0.13308,3e-4 -0.26385,-0.0347 -0.379,-0.10147 L 2.68911,4.7797998 0.75047,3.6605898 C 0.51506,3.5246498 0.37,3.2734198 0.37,3.0015398 c 0,-0.27188 0.14506,-0.52311 0.38047,-0.65905 z" }) }) }) });
859
859
  }, sl = (e) => {
860
860
  const { style: t, orientation: n = mn.Vertical, ...o } = e, r = n === mn.Vertical;
861
- return Y("div", { style: { paddingLeft: "0px", paddingTop: "0px", paddingRight: r ? "0px" : "3px", paddingBottom: r ? "3px" : "0px", display: "flex", alignItems: "center", justifyContent: "center", ...t }, ...o, children: Y("button", { style: { padding: "0", display: "flex", alignItems: "center", justifyContent: "center", border: "none" }, className: `scrollbar-button ${r ? "vertical" : "horizontal"} single-button end`, children: Y("svg", { width: "9", height: "9", viewBox: "0 0 6 6", style: { opacity: "inherit" }, children: Y("path", { d: r ? "M 2.412334,5.319396 1.292644,3.3807659 0.17189405,1.4416459 c -0.0895,-0.155 -0.12152,-0.33658 -0.0904,-0.51282998 0.0311,-0.17625 0.12336,-0.33591 0.26054,-0.45091 0.13715,-0.11495 0.31044,-0.17793 0.4894,-0.17781 H 5.308854 c 0.20186,0 0.39542,0.0802 0.53814,0.2229 0.14272,0.14272 0.22291,0.33629 0.22291,0.53813998 3e-4,0.13308 -0.0347,0.26385 -0.10147,0.379 l -1.11873,1.94066 -1.11921,1.9386401 c -0.13594,0.23541 -0.38717,0.38047 -0.65905,0.38047 -0.27188,0 -0.52311,-0.14506 -0.65905,-0.38047 z" : "m 5.3893002,3.6575719 -1.9386301,1.11969 -1.93912,1.12075 c -0.155,0.0895 -0.33658,0.12152 -0.51282997,0.0904 -0.17625,-0.0311 -0.33591,-0.12336 -0.45091,-0.26054 -0.11495,-0.13715 -0.17793,-0.31044 -0.17781,-0.4894 V 0.76105195 c 0,-0.20186 0.0802,-0.39542 0.2229,-0.53814 C 0.73562013,0.08019195 0.92919013,1.9467784e-6 1.1310401,1.9467784e-6 1.2641201,-2.9805322e-4 1.3948901,0.03470195 1.5100401,0.10147195 l 1.94066,1.11872995 1.9386401,1.11921 c 0.23541,0.13594 0.38047,0.38717 0.38047,0.65905 0,0.27188 -0.14506,0.52311 -0.38047,0.65905 z" }) }) }) });
861
+ return q("div", { style: { paddingLeft: "0px", paddingTop: "0px", paddingRight: r ? "0px" : "3px", paddingBottom: r ? "3px" : "0px", display: "flex", alignItems: "center", justifyContent: "center", ...t }, ...o, children: q("button", { style: { padding: "0", display: "flex", alignItems: "center", justifyContent: "center", border: "none" }, className: `scrollbar-button ${r ? "vertical" : "horizontal"} single-button end`, children: q("svg", { width: "9", height: "9", viewBox: "0 0 6 6", style: { opacity: "inherit" }, children: q("path", { d: r ? "M 2.412334,5.319396 1.292644,3.3807659 0.17189405,1.4416459 c -0.0895,-0.155 -0.12152,-0.33658 -0.0904,-0.51282998 0.0311,-0.17625 0.12336,-0.33591 0.26054,-0.45091 0.13715,-0.11495 0.31044,-0.17793 0.4894,-0.17781 H 5.308854 c 0.20186,0 0.39542,0.0802 0.53814,0.2229 0.14272,0.14272 0.22291,0.33629 0.22291,0.53813998 3e-4,0.13308 -0.0347,0.26385 -0.10147,0.379 l -1.11873,1.94066 -1.11921,1.9386401 c -0.13594,0.23541 -0.38717,0.38047 -0.65905,0.38047 -0.27188,0 -0.52311,-0.14506 -0.65905,-0.38047 z" : "m 5.3893002,3.6575719 -1.9386301,1.11969 -1.93912,1.12075 c -0.155,0.0895 -0.33658,0.12152 -0.51282997,0.0904 -0.17625,-0.0311 -0.33591,-0.12336 -0.45091,-0.26054 -0.11495,-0.13715 -0.17793,-0.31044 -0.17781,-0.4894 V 0.76105195 c 0,-0.20186 0.0802,-0.39542 0.2229,-0.53814 C 0.73562013,0.08019195 0.92919013,1.9467784e-6 1.1310401,1.9467784e-6 1.2641201,-2.9805322e-4 1.3948901,0.03470195 1.5100401,0.10147195 l 1.94066,1.11872995 1.9386401,1.11921 c 0.23541,0.13594 0.38047,0.38717 0.38047,0.65905 0,0.27188 -0.14506,0.52311 -0.38047,0.65905 z" }) }) }) });
862
862
  }, No = (e, t, n, o, r = 0) => {
863
863
  for (let i = 0; i < n.length; i++) {
864
864
  const l = n[i].getBoundingClientRect();
@@ -870,47 +870,47 @@ const In = si && window.ResizeObserver !== void 0 ? function() {
870
870
  return r;
871
871
  };
872
872
  Object.freeze(Object.defineProperty({ __proto__: null, getScrollTo: No }, Symbol.toStringTag, { value: "Module" }));
873
- const er = Dt(Ut((e, t) => {
874
- const { offset: n = 0, totalSize: o = 0, viewportSize: r = 0, style: i, className: l, orientation: s = mn.Vertical, onScrollOffset: a, onScroll: d, showCustomScrollButtons: g = !1, scrollButtonIncrement: m = 200, scrollButtonInitialRepeatDelay: f = 260, scrollButtonAdditionalRepeatDelay: x = 120, createScrollStartButton: E = ll, createScrollEndButton: I = sl, ...M } = e, ae = T(d, [d]), R = J(null), [_, { width: L, height: le }] = In(), [$, { width: oe, height: be }] = In(), U = s === mn.Vertical, H = U ? "top" : "left", X = U ? "scrollTop" : "scrollLeft", k = U ? le : L, u = U ? be : oe, [C, ee] = Je(null);
873
+ const er = At(Ut((e, t) => {
874
+ const { offset: n = 0, totalSize: o = 0, viewportSize: r = 0, style: i, className: l, orientation: s = mn.Vertical, onScrollOffset: a, onScroll: d, showCustomScrollButtons: g = !1, scrollButtonIncrement: m = 200, scrollButtonInitialRepeatDelay: f = 260, scrollButtonAdditionalRepeatDelay: x = 120, createScrollStartButton: _ = ll, createScrollEndButton: I = sl, ...R } = e, ae = k(d, [d]), P = Z(null), [C, { width: z, height: le }] = In(), [B, { width: oe, height: ve }] = In(), N = s === mn.Vertical, H = N ? "top" : "left", X = N ? "scrollTop" : "scrollLeft", T = N ? le : z, S = N ? ve : oe, [h, J] = Ze(null);
875
875
  st(() => {
876
- C !== null && R.current && R.current.scrollTo({ behavior: "smooth", [H]: C });
877
- }, [C, U]);
878
- const W = O((S, ue = !1) => {
879
- if (!R.current) return 0;
880
- const K = R.current.querySelector(".scrollbar-viewport"), pe = K.getBoundingClientRect(), te = K.children, Re = ue ? 0 : No(S, pe[H], te, !0, Math.max(0, S - m));
881
- return ee(Re), Math.max(0, Re);
882
- }, []), A = O((S, ue = !1) => {
883
- if (!R.current) return 0;
884
- const K = R.current.querySelector(".scrollbar-viewport"), pe = K.getBoundingClientRect(), te = K.children, Re = Math.ceil(u - k), at = ue ? Re : No(S, pe[H], te, !1, Math.max(0, S + m));
885
- return ee(at), Math.min(Re, at);
886
- }, [u, k]), q = J(null), N = O((S) => {
887
- q.current = n;
888
- const ue = S.target[X];
889
- a(ue, r, o), ae?.(S);
876
+ h !== null && P.current && P.current.scrollTo({ behavior: "smooth", [H]: h });
877
+ }, [h, N]);
878
+ const K = D((Ye, $ = !1) => {
879
+ if (!P.current) return 0;
880
+ const E = P.current.querySelector(".scrollbar-viewport"), Me = E.getBoundingClientRect(), ue = E.children, me = $ ? 0 : No(Ye, Me[H], ue, !0, Math.max(0, Ye - m));
881
+ return J(me), Math.max(0, me);
882
+ }, []), L = D((Ye, $ = !1) => {
883
+ if (!P.current) return 0;
884
+ const E = P.current.querySelector(".scrollbar-viewport"), Me = E.getBoundingClientRect(), ue = E.children, me = Math.ceil(S - T), Ve = $ ? me : No(Ye, Me[H], ue, !1, Math.max(0, Ye + m));
885
+ return J(Ve), Math.min(me, Ve);
886
+ }, [S, T]), U = Z(null), ee = D((Ye) => {
887
+ U.current = n;
888
+ const $ = Ye.target[X];
889
+ a($, r, o), ae?.(Ye);
890
890
  }, [a, r, o, n]);
891
891
  st(() => {
892
- const S = q.current;
893
- q.current = null, n !== S && (R.current[X] = n);
892
+ const Ye = U.current;
893
+ U.current = null, n !== Ye && (P.current[X] = n);
894
894
  }, [n, X]);
895
- const xe = J(null), G = J(null), He = O(() => {
896
- xe.current && (clearTimeout(xe.current), xe.current = null, G.current = null);
897
- }, []), Ue = O((S, ue, K, pe = f) => {
898
- G.current = S, xe.current = setTimeout(() => {
899
- const te = K ? W(G.current || S) : A(G.current || S);
900
- te !== G.current ? Ue(te, !1, K, x) : He();
901
- }, ue ? 0 : pe);
902
- }, [W, A, He]);
895
+ const te = Z(null), Y = Z(null), He = D(() => {
896
+ te.current && (clearTimeout(te.current), te.current = null, Y.current = null);
897
+ }, []), je = D((Ye, $, E, Me = f) => {
898
+ Y.current = Ye, te.current = setTimeout(() => {
899
+ const ue = E ? K(Y.current || Ye) : L(Y.current || Ye);
900
+ ue !== Y.current ? je(ue, !1, E, x) : He();
901
+ }, $ ? 0 : Me);
902
+ }, [K, L, He]);
903
903
  st(() => () => He(), [He]);
904
- const We = n, ht = Ee(() => {
904
+ const Ne = n, at = _e(() => {
905
905
  if (!g) return null;
906
- const S = { orientation: s, disabled: Math.floor(We) <= 0 || Math.floor(u - k) === 0, onMouseUp: He, onMouseLeave: He, onMouseDown: () => Ue(We, !0, !0) };
907
- return E?.(S);
908
- }, [g, s, We, C, u, k]), _e = Ee(() => {
906
+ const Ye = { orientation: s, disabled: Math.floor(Ne) <= 0 || Math.floor(S - T) === 0, onMouseUp: He, onMouseLeave: He, onMouseDown: () => je(Ne, !0, !0) };
907
+ return _?.(Ye);
908
+ }, [g, s, Ne, h, S, T]), Se = _e(() => {
909
909
  if (!g) return null;
910
- const S = { orientation: s, disabled: Math.floor(u - k) <= Math.ceil(We), onMouseUp: He, onMouseLeave: He, onMouseDown: () => Ue(We, !0, !1) };
911
- return I?.(S);
912
- }, [g, s, We, C, u, k]);
913
- return Ht("div", { ref: t, style: { display: "flex", flex: "1", flexDirection: U ? "column" : "row", padding: "0", ...i }, className: Rn("_sheetxl-scrollbar_18qzf_11", l), ...M, children: [ht, Y("div", { className: "pseudo-scrollbar", style: { flex: "1 1 100%", display: "flex", boxSizing: "content-box", flexDirection: U ? "column" : "row", justifyContent: "center", alignItems: "center" }, ref: _, children: Y("div", { tabIndex: -1, style: { flex: "1 1 100%", overflowY: U ? "scroll" : "hidden", overflowX: U ? "hidden" : "scroll", position: "relative", willChange: "transform" }, onScroll: N, ref: R, children: Y("div", { ref: $, style: { position: "absolute", height: U ? o - r + (le ?? 0) : 1, width: U ? 1 : o - r + (L ?? 0) }, className: "scrollbar-viewport" }) }) }), _e] });
910
+ const Ye = { orientation: s, disabled: Math.floor(S - T) <= Math.ceil(Ne), onMouseUp: He, onMouseLeave: He, onMouseDown: () => je(Ne, !0, !1) };
911
+ return I?.(Ye);
912
+ }, [g, s, Ne, h, S, T]);
913
+ return Ht("div", { ref: t, style: { display: "flex", flex: "1", flexDirection: N ? "column" : "row", padding: "0", ...i }, className: Rn("_sheetxl-scrollbar_eblx4_6", l), ...R, children: [at, q("div", { className: "pseudo-scrollbar", style: { flex: "1 1 100%", display: "flex", boxSizing: "content-box", flexDirection: N ? "column" : "row", justifyContent: "center", alignItems: "center" }, ref: C, children: q("div", { tabIndex: -1, style: { flex: "1 1 100%", overflowY: N ? "scroll" : "hidden", overflowX: N ? "hidden" : "scroll", position: "relative", willChange: "transform" }, onScroll: ee, ref: P, children: q("div", { ref: B, style: { position: "absolute", height: N ? o - r + (le ?? 0) : 1, width: N ? 1 : o - r + (z ?? 0) }, className: "scrollbar-viewport" }) }) }), Se] });
914
914
  }));
915
915
  er.displayName = "Scrollbar";
916
916
  let Cr = Date.now, gn = {}, cl = 1;
@@ -929,11 +929,11 @@ const jn = (e) => {
929
929
  if (!gn[d] || t && !t(d)) return gn[d] = null, void n(60 - a / ((x - i) / 1e3), d, !1);
930
930
  if (f) {
931
931
  const I = Math.round((x - l) / 16.666666666666668) - 1;
932
- for (let M = 0; M < Math.min(I, 4); M++) g(!0), a++;
932
+ for (let R = 0; R < Math.min(I, 4); R++) g(!0), a++;
933
933
  }
934
934
  o && (s = (x - i) / o, s > 1 && (s = 1));
935
- const E = r ? r(s) : s;
936
- e(E, x, f) !== !1 && s !== 1 || !f ? f && (l = x, requestAnimationFrame(g)) : (gn[d] = null, n(60 - a / ((x - i) / 1e3), d, s === 1 || o === void 0));
935
+ const _ = r ? r(s) : s;
936
+ e(_, x, f) !== !1 && s !== 1 || !f ? f && (l = x, requestAnimationFrame(g)) : (gn[d] = null, n(60 - a / ((x - i) / 1e3), d, s === 1 || o === void 0));
937
937
  };
938
938
  return gn[d] = !0, requestAnimationFrame(g), d;
939
939
  };
@@ -1004,8 +1004,8 @@ ci.prototype = { __isSingleTouch: !1, __isTracking: !1, __didDecelerationComplet
1004
1004
  }
1005
1005
  if (this.__enableScrollX) {
1006
1006
  a -= l * this.options.speedMultiplier;
1007
- var E = this.__maxScrollLeft;
1008
- (a > E || a < 0) && (this.options.bouncing ? a += l / 2 * this.options.speedMultiplier : a = a > E ? E : 0);
1007
+ var _ = this.__maxScrollLeft;
1008
+ (a > _ || a < 0) && (this.options.bouncing ? a += l / 2 * this.options.speedMultiplier : a = a > _ ? _ : 0);
1009
1009
  }
1010
1010
  if (this.__enableScrollY) {
1011
1011
  d -= s * this.options.speedMultiplier;
@@ -1014,8 +1014,8 @@ ci.prototype = { __isSingleTouch: !1, __isTracking: !1, __didDecelerationComplet
1014
1014
  }
1015
1015
  i.length > 60 && i.splice(0, 30), i.push(a, d, t), this.__publish(a, d, g);
1016
1016
  } else {
1017
- var M = this.options.locking ? 3 : 0, ae = Math.abs(o - this.__initialTouchLeft), R = Math.abs(r - this.__initialTouchTop);
1018
- this.__enableScrollX = this.options.scrollingX && ae >= M, this.__enableScrollY = this.options.scrollingY && R >= M, i.push(this.__scrollLeft, this.__scrollTop, t), this.__isDragging = (this.__enableScrollX || this.__enableScrollY) && (ae >= 5 || R >= 5), this.__isDragging && (this.__interruptedAnimation = !1);
1017
+ var R = this.options.locking ? 3 : 0, ae = Math.abs(o - this.__initialTouchLeft), P = Math.abs(r - this.__initialTouchTop);
1018
+ this.__enableScrollX = this.options.scrollingX && ae >= R, this.__enableScrollY = this.options.scrollingY && P >= R, i.push(this.__scrollLeft, this.__scrollTop, t), this.__isDragging = (this.__enableScrollX || this.__enableScrollY) && (ae >= 5 || P >= 5), this.__isDragging && (this.__interruptedAnimation = !1);
1019
1019
  }
1020
1020
  this.__lastTouchLeft = o, this.__lastTouchTop = r, this.__lastTouchMove = t, this.__lastScale = n;
1021
1021
  }
@@ -1037,12 +1037,12 @@ ci.prototype = { __isSingleTouch: !1, __isTracking: !1, __didDecelerationComplet
1037
1037
  var r = this.__isAnimating;
1038
1038
  if (r && (jn(r), this.__isAnimating = !1), o && this.options.animating) {
1039
1039
  this.__scheduledLeft = e, this.__scheduledTop = t, this.__scheduledZoom = n;
1040
- var i = this.__scrollLeft, l = this.__scrollTop, s = this.__zoomLevel, a = e - i, d = t - l, g = n - s, m = function(E, I, M) {
1041
- M && (this.__scrollLeft = i + a * E, this.__scrollTop = l + d * E, this.__zoomLevel = s + g * E, this.__callback && this.__callback(this.__scrollLeft, this.__scrollTop, this.__zoomLevel));
1042
- }.bind(this), f = function(E) {
1043
- return this.__isAnimating === E;
1044
- }.bind(this), x = function(E, I, M) {
1045
- I === this.__isAnimating && (this.__isAnimating = !1), (this.__didDecelerationComplete || M) && this.options.scrollingComplete(), this.options.zooming && (this.__computeScrollMax(), this.__zoomComplete && (this.__zoomComplete(), this.__zoomComplete = null));
1040
+ var i = this.__scrollLeft, l = this.__scrollTop, s = this.__zoomLevel, a = e - i, d = t - l, g = n - s, m = function(_, I, R) {
1041
+ R && (this.__scrollLeft = i + a * _, this.__scrollTop = l + d * _, this.__zoomLevel = s + g * _, this.__callback && this.__callback(this.__scrollLeft, this.__scrollTop, this.__zoomLevel));
1042
+ }.bind(this), f = function(_) {
1043
+ return this.__isAnimating === _;
1044
+ }.bind(this), x = function(_, I, R) {
1045
+ I === this.__isAnimating && (this.__isAnimating = !1), (this.__didDecelerationComplete || R) && this.options.scrollingComplete(), this.options.zooming && (this.__computeScrollMax(), this.__zoomComplete && (this.__zoomComplete(), this.__zoomComplete = null));
1046
1046
  }.bind(this);
1047
1047
  this.__isAnimating = Mr(m, f, x, this.options.animationDuration, r ? dl : ul);
1048
1048
  } else this.__scheduledLeft = this.__scrollLeft = e, this.__scheduledTop = this.__scrollTop = t, this.__scheduledZoom = this.__zoomLevel = n, this.__callback && this.__callback(e, t, n), this.options.zooming && (this.__computeScrollMax(), this.__zoomComplete && (this.__zoomComplete(), this.__zoomComplete = null));
@@ -1084,10 +1084,10 @@ var Gt = typeof window < "u" ? window : { screen: {}, navigator: {} }, Ln = (Gt.
1084
1084
  Gt.addEventListener && Gt.addEventListener("p", Tr, hl), Gt.removeEventListener && Gt.removeEventListener("p", Tr, !1);
1085
1085
  var fl = ai, pl = "PointerEvent" in Gt, tr = "ontouchstart" in Gt, di = tr || "TouchEvent" in Gt && Ln("(any-pointer: coarse)").matches, Rr = (Gt.navigator.maxTouchPoints || 0) > 0 || di, ui = Gt.navigator.userAgent || "", gl = Ln("(pointer: coarse)").matches && /iPad|Macintosh/.test(ui) && Math.min(Gt.screen.width || 0, Gt.screen.height || 0) >= 768, hi = (Ln("(pointer: coarse)").matches || !Ln("(pointer: fine)").matches && tr) && !/Windows.*Firefox/.test(ui), wl = Ln("(any-pointer: fine)").matches || Ln("(any-hover: hover)").matches || gl || !tr, Uo = !Rr || !wl && hi ? Rr ? "touchOnly" : "mouseOnly" : "hybrid", ml = Uo === "mouseOnly" ? "mouse" : Uo === "touchOnly" || hi ? "touch" : "mouse";
1086
1086
  const xl = Object.freeze(Object.defineProperty({ __proto__: null, deviceType: Uo, primaryInput: ml, supportsPassiveEvents: fl, supportsPointerEvents: pl, supportsTouchEvents: di }, Symbol.toStringTag, { value: "Module" })), vl = /* @__PURE__ */ new Set(["INPUT", "TEXTAREA", "SELECT"]), fi = {};
1087
- function qo() {
1087
+ function Ko() {
1088
1088
  return xl;
1089
1089
  }
1090
- const me = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCssProperties: fi, boundPixel: function(e, t = !1, n = 0) {
1090
+ const we = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCssProperties: fi, boundPixel: function(e, t = !1, n = 0) {
1091
1091
  return e;
1092
1092
  }, createSyntheticEvent: (e) => {
1093
1093
  let t = !1, n = !1;
@@ -1097,9 +1097,9 @@ const me = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCssProper
1097
1097
  n = !0, e.stopPropagation();
1098
1098
  }, isPropagationStopped: () => n, persist: () => {
1099
1099
  }, timeStamp: e.timeStamp, type: e.type };
1100
- }, detectIt: qo, focusableNodeNames: vl, toPrettyKeyCode: (e) => e === "BracketLeft" ? "[" : e === "BracketRight" ? "]" : Ct.camelToPrettyCase(e) }, Symbol.toStringTag, { value: "Module" })), yl = [];
1100
+ }, detectIt: Ko, focusableNodeNames: vl, toPrettyKeyCode: (e) => e === "BracketLeft" ? "[" : e === "BracketRight" ? "]" : Ct.camelToPrettyCase(e) }, Symbol.toStringTag, { value: "Module" })), yl = [];
1101
1101
  function wo(e, t, n = yl) {
1102
- const o = J(null);
1102
+ const o = Z(null);
1103
1103
  return Ur(e, () => {
1104
1104
  if (!o.current) return;
1105
1105
  const r = o.current, i = t?.();
@@ -1112,45 +1112,45 @@ function wo(e, t, n = yl) {
1112
1112
  return r;
1113
1113
  }, n), o;
1114
1114
  }
1115
- const kr = (e) => Y(er, { ...e }), bl = ({ width: e, height: t }) => Y("div", { className: "corner", style: { minWidth: `${e}px`, width: `${e}px`, minHeight: `${t}px`, height: `${t}px` } }), pi = Dt(Ut((e, t) => {
1116
- const { children: n, viewport: o, onScrollViewport: r, showHorizontalScrollbar: i = !0, showVerticalScrollbar: l = !0, createScrollCorner: s = bl, createHorizontalScrollbar: a = kr, createVerticalScrollbar: d = kr, style: g, touchElement: m, disableTouch: f, ...x } = e, E = T(r, [r]), I = wo(t, () => ({ isScrollPane: () => !0 }), []), M = J(null);
1115
+ const kr = (e) => q(er, { ...e }), bl = ({ width: e, height: t }) => q("div", { className: "corner", style: { minWidth: `${e}px`, width: `${e}px`, minHeight: `${t}px`, height: `${t}px` } }), pi = At(Ut((e, t) => {
1116
+ const { children: n, viewport: o, onScrollViewport: r, showHorizontalScrollbar: i = !0, showVerticalScrollbar: l = !0, createScrollCorner: s = bl, createHorizontalScrollbar: a = kr, createVerticalScrollbar: d = kr, style: g, touchElement: m, disableTouch: f, ...x } = e, _ = k(r, [r]), I = wo(t, () => ({ isScrollPane: () => !0 }), []), R = Z(null);
1117
1117
  st(() => {
1118
- M.current && (M.current.__scrollTop === o?.top && M.current.__scrollLeft !== !o?.left || M.current?.scrollTo(o?.left, o?.top, !1));
1118
+ R.current && (R.current.__scrollTop === o?.top && R.current.__scrollLeft !== !o?.left || R.current?.scrollTo(o?.left, o?.top, !1));
1119
1119
  }, [o?.left, o?.top, m]);
1120
- const ae = O((k, u) => {
1121
- E?.({ left: k, top: u });
1122
- }, []), R = O((k) => {
1123
- M.current?.doTouchStart(k.touches, k.timeStamp);
1124
- }, []), _ = O((k) => {
1125
- k.preventDefault(), M.current?.doTouchMove(k.touches, k.timeStamp);
1126
- }, []), L = O((k) => {
1127
- M.current?.doTouchEnd(k.timeStamp);
1128
- }, []), le = O(({ containerWidth: k, containerHeight: u, totalWidth: C, totalHeight: ee }) => {
1129
- M.current.setDimensions(k, u, C, ee);
1120
+ const ae = D((T, S) => {
1121
+ _?.({ left: T, top: S });
1122
+ }, []), P = D((T) => {
1123
+ R.current?.doTouchStart(T.touches, T.timeStamp);
1124
+ }, []), C = D((T) => {
1125
+ T.preventDefault(), R.current?.doTouchMove(T.touches, T.timeStamp);
1126
+ }, []), z = D((T) => {
1127
+ R.current?.doTouchEnd(T.timeStamp);
1128
+ }, []), le = D(({ containerWidth: T, containerHeight: S, totalWidth: h, totalHeight: J }) => {
1129
+ R.current.setDimensions(T, S, h, J);
1130
1130
  }, []);
1131
1131
  st(() => {
1132
- const k = m ?? I.current;
1133
- if (!f && qo().supportsTouchEvents && k && o) {
1134
- if (!M.current) {
1135
- const u = { scrollingX: !0, scrollingY: !0, decelerationRate: 0.95, penetrationAcceleration: 0.08 };
1136
- M.current = new ci(ae, u);
1132
+ const T = m ?? I.current;
1133
+ if (!f && Ko().supportsTouchEvents && T && o) {
1134
+ if (!R.current) {
1135
+ const S = { scrollingX: !0, scrollingY: !0, decelerationRate: 0.95, penetrationAcceleration: 0.08 };
1136
+ R.current = new ci(ae, S);
1137
1137
  }
1138
- qo().supportsTouchEvents && (k.addEventListener("touchstart", R), k.addEventListener("touchend", L), k.addEventListener("touchmove", _)), le({ containerWidth: o?.width, containerHeight: o?.height, totalWidth: o?.totalWidth, totalHeight: o?.totalHeight });
1138
+ Ko().supportsTouchEvents && (T.addEventListener("touchstart", P), T.addEventListener("touchend", z), T.addEventListener("touchmove", C)), le({ containerWidth: o?.width, containerHeight: o?.height, totalWidth: o?.totalWidth, totalHeight: o?.totalHeight });
1139
1139
  }
1140
1140
  return () => {
1141
- k?.removeEventListener("touchstart", R), k?.removeEventListener("touchend", L), k?.removeEventListener("touchmove", _);
1141
+ T?.removeEventListener("touchstart", P), T?.removeEventListener("touchend", z), T?.removeEventListener("touchmove", C);
1142
1142
  };
1143
1143
  }, [o?.width, o?.height, o?.totalWidth, o?.totalHeight, f, m]);
1144
- const [$, { width: oe }] = In(), [be, { height: U }] = In(), H = Ee(() => {
1145
- const k = d({ orientation: mn.Vertical, offset: o?.top, viewportSize: o?.height, totalSize: o?.totalHeight, onScrollOffset: (u) => {
1146
- E?.({ top: u });
1144
+ const [B, { width: oe }] = In(), [ve, { height: N }] = In(), H = _e(() => {
1145
+ const T = d({ orientation: mn.Vertical, offset: o?.top, viewportSize: o?.height, totalSize: o?.totalHeight, onScrollOffset: (S) => {
1146
+ _?.({ top: S });
1147
1147
  } });
1148
- return Y("div", { style: { display: "flex", flex: "0" }, ref: $, children: k });
1149
- }, [d, o?.top, o?.height, o?.totalHeight]), X = Ee(() => {
1150
- const k = a({ orientation: mn.Horizontal, offset: o?.left, viewportSize: o?.width, totalSize: o?.totalWidth, onScrollOffset: (u) => E?.({ left: u }) });
1151
- return Ht("div", { style: { display: "flex", flex: "none", flexDirection: "row", alignItems: "stretch", justifyContent: "center" }, children: [Y("div", { style: { display: "flex", flex: "1 1 100%", flexDirection: "column", width: `calc(100% - ${oe}px)` }, children: Y("div", { ref: be, className: "sizer", children: k }) }), l ? s({ width: oe, height: U }) : Y(wn, {})] });
1152
- }, [a, o?.left, o?.width, o?.totalWidth, l, s, oe, U]);
1153
- return Y("div", { style: { position: "relative", display: "flex", minWidth: l ? `${oe}px` : void 0, minHeight: i ? `${U}px` : void 0, ...g }, ...x, ref: I, children: Ht("div", { style: { position: "relative", width: "100%", flex: "1 1 100%", display: "flex", flexDirection: "column", boxSizing: "border-box" }, children: [Ht("div", { style: { display: "flex", flex: "1 1 100%", overflow: "hidden" }, children: [Y("div", { style: { display: "flex", flex: "1 1 100%", overflow: "hidden" }, children: n }), l ? H : Y(wn, {})] }), i ? X : Y(wn, {})] }) });
1148
+ return q("div", { style: { display: "flex", flex: "0" }, ref: B, children: T });
1149
+ }, [d, o?.top, o?.height, o?.totalHeight]), X = _e(() => {
1150
+ const T = a({ orientation: mn.Horizontal, offset: o?.left, viewportSize: o?.width, totalSize: o?.totalWidth, onScrollOffset: (S) => _?.({ left: S }) });
1151
+ return Ht("div", { style: { display: "flex", flex: "none", flexDirection: "row", alignItems: "stretch", justifyContent: "center" }, children: [q("div", { style: { display: "flex", flex: "1 1 100%", flexDirection: "column", width: `calc(100% - ${oe}px)` }, children: q("div", { ref: ve, className: "sizer", children: T }) }), l ? s({ width: oe, height: N }) : q(wn, {})] });
1152
+ }, [a, o?.left, o?.width, o?.totalWidth, l, s, oe, N]);
1153
+ return q("div", { style: { position: "relative", display: "flex", minWidth: l ? `${oe}px` : void 0, minHeight: i ? `${N}px` : void 0, ...g }, ...x, ref: I, children: Ht("div", { style: { position: "relative", width: "100%", flex: "1 1 100%", display: "flex", flexDirection: "column", boxSizing: "border-box" }, children: [Ht("div", { style: { display: "flex", flex: "1 1 100%", overflow: "hidden" }, children: [q("div", { style: { display: "flex", flex: "1 1 100%", overflow: "hidden" }, children: n }), l ? H : q(wn, {})] }), i ? X : q(wn, {})] }) });
1154
1154
  }));
1155
1155
  pi.displayName = "ScrollPane";
1156
1156
  const Sl = () => {
@@ -1164,7 +1164,7 @@ function gi() {
1164
1164
  const t = document.fullscreenElement;
1165
1165
  if (!t) return;
1166
1166
  let n = t.querySelector(".fullscreen-portal-root");
1167
- n || (n = document.createElement("div"), n.className = "fullscreen-portal-root _fullscreen-portal-root_5qk7s_7", t.appendChild(n));
1167
+ n || (n = document.createElement("div"), n.className = "fullscreen-portal-root _fullscreen-portal-root_1mjsr_4", t.appendChild(n));
1168
1168
  }
1169
1169
  return no++, e(), document.addEventListener("fullscreenchange", e), () => {
1170
1170
  document.removeEventListener("fullscreenchange", e), no--, no <= 0 && (document.querySelectorAll(".fullscreen-portal-root").forEach((t) => {
@@ -1173,34 +1173,34 @@ function gi() {
1173
1173
  };
1174
1174
  }, []), { getPortalContainer: Sl };
1175
1175
  }
1176
- const El = 100, _l = 100, Il = 1e6, Cl = 100, Ml = 50, Tl = Dt(Ut((e, t) => {
1177
- const { offset: n = 0, viewportSize: o = 0, totalSize: r = 0, minSize: i = 0, endGap: l = El, endScrollIncrement: s = _l, style: a = fi, onMouseDown: d, onScrollOffset: g, onScroll: m, scaleLimit: f = Il, scaleFactor: x = Cl, precisionFactor: E = Ml, ...I } = e;
1176
+ const El = 100, _l = 100, Il = 1e6, Cl = 100, Ml = 50, Tl = At(Ut((e, t) => {
1177
+ const { offset: n = 0, viewportSize: o = 0, totalSize: r = 0, minSize: i = 0, endGap: l = El, endScrollIncrement: s = _l, style: a = fi, onMouseDown: d, onScrollOffset: g, onScroll: m, scaleLimit: f = Il, scaleFactor: x = Cl, precisionFactor: _ = Ml, ...I } = e;
1178
1178
  m && console.warn("onScroll not supported for VirtualScrollbar. Use onScrollOffset instead");
1179
- const M = T(d, [d]), ae = () => ({ offset: n, totalSize: f === 0 ? r : Math.min(r ?? 0, Math.max(i ?? 0, (n ?? 0) + (o ?? 0)) + (l ?? 0)) }), [R, _] = Je(ae), L = f !== 0 && R.totalSize > f ? x : 1, le = L / E, $ = Math.ceil(R.totalSize / L), oe = Math.ceil(R.offset / L), be = Math.ceil(o / L), U = O((W) => {
1180
- }, []), [H, X] = Je(!1), k = J(null);
1181
- nn(() => {
1179
+ const R = k(d, [d]), ae = () => ({ offset: n, totalSize: f === 0 ? r : Math.min(r ?? 0, Math.max(i ?? 0, (n ?? 0) + (o ?? 0)) + (l ?? 0)) }), [P, C] = Ze(ae), z = f !== 0 && P.totalSize > f ? x : 1, le = z / _, B = Math.ceil(P.totalSize / z), oe = Math.ceil(P.offset / z), ve = Math.ceil(o / z), N = D((K) => {
1180
+ }, []), [H, X] = Ze(!1), T = Z(null);
1181
+ tn(() => {
1182
1182
  if (!H) {
1183
- k.current = { propTotalSize: r, propViewportSize: o, propOffset: n };
1184
- const W = ae();
1185
- _(W);
1183
+ T.current = { propTotalSize: r, propViewportSize: o, propOffset: n };
1184
+ const K = ae();
1185
+ C(K);
1186
1186
  }
1187
1187
  }, [r, o, n, H, i, l, s]);
1188
- const u = T((W, A, q) => {
1189
- const N = k.current;
1190
- k.current = null, N && N.propTotalSize === r && N.propViewportSize === o && N.propOffset === n || (Math.abs(W - oe) < le && (W = oe), g?.(W * L, oe, be));
1191
- }, [g, L, le, oe, be]), C = O((W) => {
1192
- document.removeEventListener("mousemove", U), document.removeEventListener("mouseup", C), X(!1);
1193
- }, []), ee = O((W) => {
1194
- M?.(W), X(!0), document.addEventListener("mousemove", U, { passive: !0 }), document.addEventListener("mouseup", C, { passive: !0 });
1195
- }, [U, C]);
1196
- return Y(er, { ref: t, style: { ...a }, ...I, offset: oe, totalSize: $, viewportSize: be, onMouseDown: ee, onScrollOffset: u });
1188
+ const S = k((K, L, U) => {
1189
+ const ee = T.current;
1190
+ T.current = null, ee && ee.propTotalSize === r && ee.propViewportSize === o && ee.propOffset === n || (Math.abs(K - oe) < le && (K = oe), g?.(K * z, oe, ve));
1191
+ }, [g, z, le, oe, ve]), h = D((K) => {
1192
+ document.removeEventListener("mousemove", N), document.removeEventListener("mouseup", h), X(!1);
1193
+ }, []), J = D((K) => {
1194
+ R?.(K), X(!0), document.addEventListener("mousemove", N, { passive: !0 }), document.addEventListener("mouseup", h, { passive: !0 });
1195
+ }, [N, h]);
1196
+ return q(er, { ref: t, style: { ...a }, ...I, offset: oe, totalSize: B, viewportSize: ve, onMouseDown: J, onScrollOffset: S });
1197
1197
  }));
1198
1198
  function Do(e, t) {
1199
1199
  if (typeof e == "function") return e(t);
1200
1200
  e && (e.current = t);
1201
1201
  }
1202
1202
  Tl.displayName = "VirtualScrollbar";
1203
- var fo = parseInt(qr.split(".")[0], 10) >= 19 ? function(e) {
1203
+ var fo = parseInt(Kr.split(".")[0], 10) >= 19 ? function(e) {
1204
1204
  return (t) => {
1205
1205
  const n = [];
1206
1206
  for (const o of e) {
@@ -1216,8 +1216,8 @@ var fo = parseInt(qr.split(".")[0], 10) >= 19 ? function(e) {
1216
1216
  for (const n of e) Do(n, t);
1217
1217
  };
1218
1218
  };
1219
- Dt(Ut((e, t) => {
1220
- const { refFocusStart: n, ...o } = e, r = J(null), i = O(() => {
1219
+ At(Ut((e, t) => {
1220
+ const { refFocusStart: n, ...o } = e, r = Z(null), i = D(() => {
1221
1221
  if (n) return void n?.current?.focus();
1222
1222
  const l = r.current.parentElement.children;
1223
1223
  let s = [];
@@ -1231,62 +1231,62 @@ Dt(Ut((e, t) => {
1231
1231
  return a.tabindex - d.tabindex;
1232
1232
  }), s[0].child.focus());
1233
1233
  }, [n]);
1234
- return Y("div", { tabIndex: 0, ref: fo([r, t]), onFocus: i, ...o });
1235
- })), Dt(Ut((e, t) => {
1236
- const { className: n, style: o, children: r, radius: i = 4, strokeWidth: l = 1, strokeColor: s = "grey", ...a } = e, [d, { width: g, height: m }] = In(), f = J(null), x = (ae, R = 0) => {
1237
- const _ = ae / 2, L = m - _ + R;
1238
- return function(le, $, oe = !1) {
1239
- if ($ === 0) return le;
1240
- function be(C, ee, W) {
1241
- let A = ee.x - C.x, q = ee.y - C.y, N = Math.sqrt(A * A + q * q);
1242
- return U(C, ee, Math.min(1, W / N));
1234
+ return q("div", { tabIndex: 0, ref: fo([r, t]), onFocus: i, ...o });
1235
+ })), At(Ut((e, t) => {
1236
+ const { className: n, style: o, children: r, radius: i = 4, strokeWidth: l = 1, strokeColor: s = "grey", ...a } = e, [d, { width: g, height: m }] = In(), f = Z(null), x = (ae, P = 0) => {
1237
+ const C = ae / 2, z = m - C + P;
1238
+ return function(le, B, oe = !1) {
1239
+ if (B === 0) return le;
1240
+ function ve(h, J, K) {
1241
+ let L = J.x - h.x, U = J.y - h.y, ee = Math.sqrt(L * L + U * U);
1242
+ return N(h, J, Math.min(1, K / ee));
1243
1243
  }
1244
- function U(C, ee, W) {
1245
- return { x: C.x + (ee.x - C.x) * W, y: C.y + (ee.y - C.y) * W };
1244
+ function N(h, J, K) {
1245
+ return { x: h.x + (J.x - h.x) * K, y: h.y + (J.y - h.y) * K };
1246
1246
  }
1247
- function H(C, ee) {
1248
- C.length > 2 && (C[C.length - 2] = ee.x, C[C.length - 1] = ee.y);
1247
+ function H(h, J) {
1248
+ h.length > 2 && (h[h.length - 2] = J.x, h[h.length - 1] = J.y);
1249
1249
  }
1250
- function X(C) {
1251
- return { x: parseFloat(C[C.length - 2]), y: parseFloat(C[C.length - 1]) };
1250
+ function X(h) {
1251
+ return { x: parseFloat(h[h.length - 2]), y: parseFloat(h[h.length - 1]) };
1252
1252
  }
1253
- let k = le.split(/[,\s]/).reduce(function(C, ee) {
1254
- let W = ee.match("([a-zA-Z])(.+)");
1255
- return W ? (C.push(W[1]), C.push(W[2])) : C.push(ee), C;
1256
- }, []).reduce(function(C, ee) {
1257
- return parseFloat(ee) == ee && C.length ? C[C.length - 1].push(ee) : C.push([ee]), C;
1258
- }, []), u = [];
1259
- if (k.length > 1) {
1260
- let C = X(k[0]), ee = null;
1261
- k[k.length - 1][0] === "Z" && k[0].length > 2 && (ee = ["L", C.x, C.y], k[k.length - 1] = ee), u.push(k[0]);
1262
- for (let W = 1; W < k.length; W++) {
1263
- let A = u[u.length - 1], q = k[W], N = q === ee ? k[1] : k[W + 1];
1264
- if (N && A && A.length > 2 && q[0] === "L" && N.length > 2 && N[0] === "L") {
1265
- let xe, G, He = X(A), Ue = X(q), We = X(N);
1266
- oe ? (xe = U(Ue, A.origPoint || He, $), G = U(Ue, N.origPoint || We, $)) : (xe = be(Ue, He, $), G = be(Ue, We, $)), H(q, xe), q.origPoint = Ue, u.push(q);
1267
- let ht = U(xe, Ue, 0.5), _e = U(Ue, G, 0.5), S = ["C", ht.x, ht.y, _e.x, _e.y, G.x, G.y];
1268
- S.origPoint = Ue, u.push(S);
1269
- } else u.push(q);
1253
+ let T = le.split(/[,\s]/).reduce(function(h, J) {
1254
+ let K = J.match("([a-zA-Z])(.+)");
1255
+ return K ? (h.push(K[1]), h.push(K[2])) : h.push(J), h;
1256
+ }, []).reduce(function(h, J) {
1257
+ return parseFloat(J) == J && h.length ? h[h.length - 1].push(J) : h.push([J]), h;
1258
+ }, []), S = [];
1259
+ if (T.length > 1) {
1260
+ let h = X(T[0]), J = null;
1261
+ T[T.length - 1][0] === "Z" && T[0].length > 2 && (J = ["L", h.x, h.y], T[T.length - 1] = J), S.push(T[0]);
1262
+ for (let K = 1; K < T.length; K++) {
1263
+ let L = S[S.length - 1], U = T[K], ee = U === J ? T[1] : T[K + 1];
1264
+ if (ee && L && L.length > 2 && U[0] === "L" && ee.length > 2 && ee[0] === "L") {
1265
+ let te, Y, He = X(L), je = X(U), Ne = X(ee);
1266
+ oe ? (te = N(je, L.origPoint || He, B), Y = N(je, ee.origPoint || Ne, B)) : (te = ve(je, He, B), Y = ve(je, Ne, B)), H(U, te), U.origPoint = je, S.push(U);
1267
+ let at = N(te, je, 0.5), Se = N(je, Y, 0.5), Ye = ["C", at.x, at.y, Se.x, Se.y, Y.x, Y.y];
1268
+ Ye.origPoint = je, S.push(Ye);
1269
+ } else S.push(U);
1270
1270
  }
1271
- if (ee) {
1272
- let W = X(u[u.length - 1]);
1273
- u.push(["Z"]), H(u[0], W);
1271
+ if (J) {
1272
+ let K = X(S[S.length - 1]);
1273
+ S.push(["Z"]), H(S[0], K);
1274
1274
  }
1275
- } else u = k;
1276
- return u.reduce(function(C, ee) {
1277
- return C + ee.join(" ") + " ";
1275
+ } else S = T;
1276
+ return S.reduce(function(h, J) {
1277
+ return h + J.join(" ") + " ";
1278
1278
  }, "");
1279
- }(`M 0 ${_} L ${i - 0.5} ${_} L ${i - 0.5} ${L} L ${2 * i} ${L} L ${g - 2 * i} ${L} M ${g - 2 * i} ${L} L ${g - i} ${L} L ${g - i} ${_} L ${g} ${_}`, i);
1280
- }, E = Ee(() => x(l), [g, m, i, l]), I = Ee(() => {
1279
+ }(`M 0 ${C} L ${i - 0.5} ${C} L ${i - 0.5} ${z} L ${2 * i} ${z} L ${g - 2 * i} ${z} M ${g - 2 * i} ${z} L ${g - i} ${z} L ${g - i} ${C} L ${g} ${C}`, i);
1280
+ }, _ = _e(() => x(l), [g, m, i, l]), I = _e(() => {
1281
1281
  if (i === 0) return;
1282
1282
  const ae = i / 2;
1283
1283
  return x(i) + `L ${g} 0 L 0 0 L 0 ${ae}`;
1284
- }, [E, i, l]), M = Ee(() => ({ style: { clipPath: `path('${I}')` } }), [I]);
1285
- return Ht("div", { className: n, style: { display: "flex", flexDirection: "row", ...o }, ...a, ref: fo([f, d, t]), children: [Sn.isValidElement(r) ? Sn.cloneElement(r, M) : Y(wn, {}), Y("svg", { style: { position: "absolute", top: 0, left: 0, pointerEvents: "none" }, width: g, height: m, viewBox: `0 0 ${g} ${m}`, children: Y("path", { d: E, stroke: s, fill: "none", vectorEffect: "non-scaling-stroke", strokeWidth: l }) })] });
1284
+ }, [_, i, l]), R = _e(() => ({ style: { clipPath: `path('${I}')` } }), [I]);
1285
+ return Ht("div", { className: n, style: { display: "flex", flexDirection: "row", ...o }, ...a, ref: fo([f, d, t]), children: [Sn.isValidElement(r) ? Sn.cloneElement(r, R) : q(wn, {}), q("svg", { style: { position: "absolute", top: 0, left: 0, pointerEvents: "none" }, width: g, height: m, viewBox: `0 0 ${g} ${m}`, children: q("path", { d: _, stroke: s, fill: "none", vectorEffect: "non-scaling-stroke", strokeWidth: l }) })] });
1286
1286
  }));
1287
1287
  const Rl = {}, kl = (e) => {
1288
1288
  const { onPointerDown: t, style: n, splitDirection: o, paddingBefore: r = 0, paddingAfter: i = 0, disabled: l, key: s, hitAreaProps: a = Rl, ...d } = e, g = o === "row", { style: m, className: f, ...x } = a;
1289
- return Y("div", { style: { ...n, position: "relative" }, ...d, children: Y("div", { className: Rn("hit-box", f), style: { left: (g ? -r : 0) + "px", width: `calc(100% + ${g ? r + i : 0}px)`, top: (g ? 0 : -r) + "px", height: `calc(100% + ${g ? 0 : r + i}px)`, position: "absolute", ...m }, onPointerDown: l ? void 0 : t, ...x }) }, s);
1289
+ return q("div", { style: { ...n, position: "relative" }, ...d, children: q("div", { className: Rn("hit-box", f), style: { left: (g ? -r : 0) + "px", width: `calc(100% + ${g ? r + i : 0}px)`, top: (g ? 0 : -r) + "px", height: `calc(100% + ${g ? 0 : r + i}px)`, position: "absolute", ...m }, onPointerDown: l ? void 0 : t, ...x }) }, s);
1290
1290
  }, oo = {}, bn = (e, t, n = !0) => e === null ? null : e.pixels !== null ? n ? e.pixels : t - e.pixels : (n ? e.percent : 100 - e.percent) / 100 * t, ro = (e, t = !0) => e?.percent ? `${t ? e.percent : 100 - e.percent}%` : e?.pixels ? `${e.pixels}px` : void 0, pn = (e, t) => {
1291
1291
  if (e == null) return null;
1292
1292
  const n = { percent: null, pixels: null };
@@ -1295,119 +1295,119 @@ const Rl = {}, kl = (e) => {
1295
1295
  };
1296
1296
  function On(e) {
1297
1297
  if (!e) throw new Error("must have a PointerHandlerOptions");
1298
- const { onPointerDown: t, onPointerUp: n, onPointerMoveOrWait: o, processTouch: r = !1, consumeTouch: i = !0 } = e, l = T(t, [t]), s = T(n, [n]), a = T(o, [o]), d = J(!1), g = e?.timerInitial ?? 230, m = e?.timerContinuous ?? g / 2, f = J(null), x = J(null), E = J(null), I = J(null), M = O(() => {
1298
+ const { onPointerDown: t, onPointerUp: n, onPointerMoveOrWait: o, processTouch: r = !1, consumeTouch: i = !0 } = e, l = k(t, [t]), s = k(n, [n]), a = k(o, [o]), d = Z(!1), g = e?.timerInitial ?? 230, m = e?.timerContinuous ?? g / 2, f = Z(null), x = Z(null), _ = Z(null), I = Z(null), R = D(() => {
1299
1299
  I.current && (clearTimeout(I.current), I.current = null);
1300
- }, []), ae = O((H) => {
1300
+ }, []), ae = D((H) => {
1301
1301
  I.current = setTimeout(() => {
1302
1302
  window.requestAnimationFrame(() => {
1303
- d.current !== !1 && a?.(x.current, E.current, f.current);
1303
+ d.current !== !1 && a?.(x.current, _.current, f.current);
1304
1304
  }), ae(m);
1305
1305
  }, H ?? g);
1306
1306
  }, []);
1307
- st(() => () => M(), []);
1308
- const R = r ? "pointer" : "mouse", _ = O((H) => {
1307
+ st(() => () => R(), []);
1308
+ const P = r ? "pointer" : "mouse", C = D((H) => {
1309
1309
  H.stopPropagation(), H.stopImmediatePropagation(), H.preventDefault();
1310
- }, []), L = T((H) => {
1311
- document.removeEventListener(`${R}move`, oe), document.removeEventListener(`${R}up`, L), document.removeEventListener("keydown", be), document.removeEventListener("keyup", U), document.removeEventListener("touchstart", _, { capture: !0 }), document.removeEventListener("touchmove", _, { capture: !0 }), window.removeEventListener("blur", le), M(), window.requestAnimationFrame(() => {
1312
- d.current !== !1 && (d.current = !1, s?.(H, E.current, f.current), E.current = null);
1310
+ }, []), z = k((H) => {
1311
+ document.removeEventListener(`${P}move`, oe), document.removeEventListener(`${P}up`, z), document.removeEventListener("keydown", ve), document.removeEventListener("keyup", N), document.removeEventListener("touchstart", C, { capture: !0 }), document.removeEventListener("touchmove", C, { capture: !0 }), window.removeEventListener("blur", le), R(), window.requestAnimationFrame(() => {
1312
+ d.current !== !1 && (d.current = !1, s?.(H, _.current, f.current), _.current = null);
1313
1313
  });
1314
- }, []), le = O(() => {
1315
- d.current !== !1 && (d.current = !1, L(x.current));
1316
- }, []), $ = T(() => {
1317
- M(), ae(m), window.requestAnimationFrame(() => {
1318
- d.current !== !1 && a?.(x.current, E.current, f.current);
1314
+ }, []), le = D(() => {
1315
+ d.current !== !1 && (d.current = !1, z(x.current));
1316
+ }, []), B = k(() => {
1317
+ R(), ae(m), window.requestAnimationFrame(() => {
1318
+ d.current !== !1 && a?.(x.current, _.current, f.current);
1319
1319
  });
1320
- }, [m]), oe = T((H) => {
1321
- x.current = H, $();
1322
- }, []), be = T((H) => {
1323
- E.current = { ctrlKey: H.ctrlKey, shiftKey: H.shiftKey, altKey: H.altKey, metaKey: H.metaKey }, $();
1324
- }, []), U = T((H) => {
1325
- E.current = { ctrlKey: H.ctrlKey, shiftKey: H.shiftKey, altKey: H.altKey, metaKey: H.metaKey }, $();
1320
+ }, [m]), oe = k((H) => {
1321
+ x.current = H, B();
1322
+ }, []), ve = k((H) => {
1323
+ _.current = { ctrlKey: H.ctrlKey, shiftKey: H.shiftKey, altKey: H.altKey, metaKey: H.metaKey }, B();
1324
+ }, []), N = k((H) => {
1325
+ _.current = { ctrlKey: H.ctrlKey, shiftKey: H.shiftKey, altKey: H.altKey, metaKey: H.metaKey }, B();
1326
1326
  }, [m]);
1327
- return T((H) => {
1328
- H.isDefaultPrevented() || (E.current = { ctrlKey: H.ctrlKey, shiftKey: H.shiftKey, altKey: H.altKey, metaKey: H.metaKey }, l(H, E.current) !== !1 && (f.current = H, x.current = H.nativeEvent, document.addEventListener(`${R}up`, L, { passive: !1 }), document.addEventListener(`${R}move`, oe, { passive: !1 }), document.addEventListener("keydown", be, { passive: !1 }), document.addEventListener("keyup", U, { passive: !1 }), window.addEventListener("blur", le, { passive: !0 }), r && i && (document.addEventListener("touchstart", _, { passive: !1, capture: !0 }), document.addEventListener("touchmove", _, { passive: !1, capture: !0 })), d.current = !0, ae(g)));
1327
+ return k((H) => {
1328
+ H.isDefaultPrevented() || (_.current = { ctrlKey: H.ctrlKey, shiftKey: H.shiftKey, altKey: H.altKey, metaKey: H.metaKey }, l(H, _.current) !== !1 && (f.current = H, x.current = H.nativeEvent, document.addEventListener(`${P}up`, z, { passive: !1 }), document.addEventListener(`${P}move`, oe, { passive: !1 }), document.addEventListener("keydown", ve, { passive: !1 }), document.addEventListener("keyup", N, { passive: !1 }), window.addEventListener("blur", le, { passive: !0 }), r && i && (document.addEventListener("touchstart", C, { passive: !1, capture: !0 }), document.addEventListener("touchmove", C, { passive: !1, capture: !0 })), d.current = !0, ae(g)));
1329
1329
  }, [g, r]);
1330
1330
  }
1331
- Dt(Ut((e, t) => {
1332
- const { elementBefore: n, elementAfter: o, splitDirection: r = "row", fixedPane: i = null, position: l, onPositionChange: s, minBefore: a, maxBefore: d, minAfter: g, maxAfter: m, children: f, className: x, style: E, disabled: I = !1, onDragStart: M, onDragResize: ae, onDragFinish: R, resizerProps: _ = oo, paneProps: L = oo, paneBeforeProps: le = oo, paneAfterProps: $ = oo, createResizer: oe = kl } = e;
1331
+ At(Ut((e, t) => {
1332
+ const { elementBefore: n, elementAfter: o, splitDirection: r = "row", fixedPane: i = null, position: l, onPositionChange: s, minBefore: a, maxBefore: d, minAfter: g, maxAfter: m, children: f, className: x, style: _, disabled: I = !1, onDragStart: R, onDragResize: ae, onDragFinish: P, resizerProps: C = oo, paneProps: z = oo, paneBeforeProps: le = oo, paneAfterProps: B = oo, createResizer: oe = kl } = e;
1333
1333
  if (f) throw new Error("Use elementBefore and elementAfter instead of children.");
1334
- const be = Ee(() => Sn.isValidElement(o) && Sn.isValidElement(n), [o, n]), U = Ee(() => {
1334
+ const ve = _e(() => Sn.isValidElement(o) && Sn.isValidElement(n), [o, n]), N = _e(() => {
1335
1335
  let Q = null;
1336
1336
  i && (i === "before" ? Q = 0 : i === "after" && (Q = 1));
1337
1337
  const et = Q === null;
1338
1338
  return { fixedPaneOffset: Q, isPercent: et, minBefore: pn(a, et), maxBefore: pn(d, et), minAfter: pn(g, et), maxAfter: pn(m, et) };
1339
- }, [a, d, g, m]), H = T(s, [s]), [X, k] = Je(() => pn(l, i === null));
1339
+ }, [a, d, g, m]), H = k(s, [s]), [X, T] = Ze(() => pn(l, i === null));
1340
1340
  st(() => {
1341
- k(pn(l, i === null));
1341
+ T(pn(l, i === null));
1342
1342
  }, [l, i]);
1343
- const [u, { width: C, height: ee }] = In(), [W, { width: A, height: q }] = In(), N = r === "row" ? A : q, xe = r === "row" ? C : ee, G = Ee(() => ((Q, et, qe, dt) => {
1344
- const Ie = [null, null], Le = [null, null];
1345
- if (Q || (Q = { percent: dt.fixedPaneOffset === null ? 50 : null, pixels: dt.fixedPaneOffset === null ? null : 0 }), et === 0) return Q?.pixels != null ? dt.fixedPaneOffset !== 1 ? (Ie[0] = Q?.pixels, Le[1] = 100) : (Ie[1] = Q?.pixels - qe, Le[0] = 100) : Q?.percent != null && (dt.fixedPaneOffset !== 1 ? (Le[0] = Q?.percent, Le[1] = 100 - Q?.percent) : (Le[1] = Q?.percent, Le[0] = 100 - Q?.percent)), { percents: Le, pixels: Ie, minBefore: ro(dt.minBefore, !0), maxBefore: ro(dt.maxBefore, !0), minAfter: ro(dt.minAfter), maxAfter: ro(dt.maxAfter) };
1346
- let rt = bn(Q, et, dt.fixedPaneOffset !== 1), tt = et - qe, Ae = bn(dt.minBefore, tt, !0) ?? 0, rn = bn(dt.maxBefore, tt, !0) ?? tt, Mt = 0, nt = 0, Tt = 0, kt = tt;
1347
- Mt = (bn(dt.maxAfter, et, !1) ?? qe) - qe, nt = bn(dt.minAfter, et, !1) ?? et, Tt = Math.max(Ae, Mt), kt = Math.min(rn, nt), rt = Math.max(Tt, Math.min(rt, kt)), nt = Math.min(tt - rt, bn(dt.maxAfter, tt - rt, !0) ?? tt), Mt = Math.min(tt - rt, bn(dt.minAfter, tt - rt, !0) ?? tt), Ie[0] = rt, Ie[1] = tt - Ie[0];
1343
+ const [S, { width: h, height: J }] = In(), [K, { width: L, height: U }] = In(), ee = r === "row" ? L : U, te = r === "row" ? h : J, Y = _e(() => ((Q, et, Ue, ht) => {
1344
+ const Ie = [null, null], Oe = [null, null];
1345
+ if (Q || (Q = { percent: ht.fixedPaneOffset === null ? 50 : null, pixels: ht.fixedPaneOffset === null ? null : 0 }), et === 0) return Q?.pixels != null ? ht.fixedPaneOffset !== 1 ? (Ie[0] = Q?.pixels, Oe[1] = 100) : (Ie[1] = Q?.pixels - Ue, Oe[0] = 100) : Q?.percent != null && (ht.fixedPaneOffset !== 1 ? (Oe[0] = Q?.percent, Oe[1] = 100 - Q?.percent) : (Oe[1] = Q?.percent, Oe[0] = 100 - Q?.percent)), { percents: Oe, pixels: Ie, minBefore: ro(ht.minBefore, !0), maxBefore: ro(ht.maxBefore, !0), minAfter: ro(ht.minAfter), maxAfter: ro(ht.maxAfter) };
1346
+ let rt = bn(Q, et, ht.fixedPaneOffset !== 1), tt = et - Ue, ze = bn(ht.minBefore, tt, !0) ?? 0, rn = bn(ht.maxBefore, tt, !0) ?? tt, Tt = 0, nt = 0, Rt = 0, Ot = tt;
1347
+ Tt = (bn(ht.maxAfter, et, !1) ?? Ue) - Ue, nt = bn(ht.minAfter, et, !1) ?? et, Rt = Math.max(ze, Tt), Ot = Math.min(rn, nt), rt = Math.max(Rt, Math.min(rt, Ot)), nt = Math.min(tt - rt, bn(ht.maxAfter, tt - rt, !0) ?? tt), Tt = Math.min(tt - rt, bn(ht.minAfter, tt - rt, !0) ?? tt), Ie[0] = rt, Ie[1] = tt - Ie[0];
1348
1348
  const hn = Math.max(0, Math.min(100, rt / tt * 100));
1349
- return Le[0] = hn, Le[1] = 100 - Le[0], { percents: Le, pixels: Ie, minBefore: `${Ae}px`, minAfter: `${Mt}px`, maxBefore: `${Ie[0]}px`, maxAfter: `${Ie[1]}px` };
1350
- })(X, xe, N, U), [U, X, xe, N, r]), [He, Ue] = Je(!1), We = T(M, [M]), ht = T(ae, [ae]), _e = T(R, [R]), S = J(null), ue = J(null), K = J(null), { style: pe, className: te, ...Re } = L, at = { minWidth: 0, minHeight: 0, maxWidth: "100%", maxHeight: "100%", display: "flex", overflow: "hidden", ...pe }, { className: pt, style: zt, ...gt } = le, { className: Zt, style: Be, ...z } = $, ke = { flex: "1 1 100%", width: "100%", ...E, flexDirection: r, display: "flex" }, { className: Qe, style: Xe, onPointerDown: wt, ...an } = _, Jt = T((Q) => {
1349
+ return Oe[0] = hn, Oe[1] = 100 - Oe[0], { percents: Oe, pixels: Ie, minBefore: `${ze}px`, minAfter: `${Tt}px`, maxBefore: `${Ie[0]}px`, maxAfter: `${Ie[1]}px` };
1350
+ })(X, te, ee, N), [N, X, te, ee, r]), [He, je] = Ze(!1), Ne = k(R, [R]), at = k(ae, [ae]), Se = k(P, [P]), Ye = Z(null), $ = Z(null), E = Z(null), { style: Me, className: ue, ...me } = z, Ve = { minWidth: 0, minHeight: 0, maxWidth: "100%", maxHeight: "100%", display: "flex", overflow: "hidden", ...Me }, { className: dt, style: kt, ...ut } = le, { className: Zt, style: St, ...M } = B, ye = { flex: "1 1 100%", width: "100%", ..._, flexDirection: r, display: "flex" }, { className: Je, style: mt, onPointerDown: Qe, ...cn } = C, on = k((Q) => {
1351
1351
  const et = pn(Q, i === null);
1352
- k(et);
1353
- }, [i]), jt = T((Q) => {
1352
+ T(et);
1353
+ }, [i]), Mt = k((Q) => {
1354
1354
  if (I || !He) return;
1355
- const et = ze.current?.getBoundingClientRect();
1356
- let qe = 0;
1357
- qe = r === "row" ? (Q.clientX ?? Q.touches?.[0]?.clientX) - et.x : (Q.clientY ?? Q.touches?.[0]?.clientY) - et.y, qe = Math.max(0, Math.min(xe, qe)), U.fixedPaneOffset === 1 && (qe = xe - qe), l && X.pixels === qe || k({ pixels: qe, percent: null }), ht?.(qe), Q.stopPropagation(), Q.preventDefault();
1358
- }, [U, r, I, He, X, xe]), dn = T((Q) => {
1359
- if (document.removeEventListener("pointermove", jt), document.removeEventListener("touchmove", jt), document.removeEventListener("pointerup", dn), He && (Ue(!1), X)) {
1360
- if (_e(X.pixels), !pn(l, i === null) || X.pixels !== l) {
1355
+ const et = De.current?.getBoundingClientRect();
1356
+ let Ue = 0;
1357
+ Ue = r === "row" ? (Q.clientX ?? Q.touches?.[0]?.clientX) - et.x : (Q.clientY ?? Q.touches?.[0]?.clientY) - et.y, Ue = Math.max(0, Math.min(te, Ue)), N.fixedPaneOffset === 1 && (Ue = te - Ue), l && X.pixels === Ue || T({ pixels: Ue, percent: null }), at?.(Ue), Q.stopPropagation(), Q.preventDefault();
1358
+ }, [N, r, I, He, X, te]), dn = k((Q) => {
1359
+ if (document.removeEventListener("pointermove", Mt), document.removeEventListener("touchmove", Mt), document.removeEventListener("pointerup", dn), He && (je(!1), X)) {
1360
+ if (Se(X.pixels), !pn(l, i === null) || X.pixels !== l) {
1361
1361
  const et = { ...X };
1362
- et.percent === null && (et.percent = et.pixels / xe * 100), H(et);
1362
+ et.percent === null && (et.percent = et.pixels / te * 100), H(et);
1363
1363
  }
1364
1364
  Q.stopPropagation(), Q.preventDefault();
1365
1365
  }
1366
- }, [X, He, l, i, xe]), on = T((Q) => {
1367
- wt?.(Q), Q.defaultPrevented || I || He || (Ue(!0), We(), document.addEventListener("pointermove", jt, { passive: !1 }), document.addEventListener("touchmove", jt, { passive: !1 }), document.addEventListener("pointerup", dn, { passive: !1 }));
1368
- }, [wt]), ze = wo(t, () => ({ setPosition: Jt, isSplitPane: () => !0 }), []), qt = Ee(() => be ? oe?.({ key: "resizer", ref: fo([W, ue]), className: Rn("resizer", Qe), onPointerDownCapture: on, style: { cursor: I ? void 0 : r === "row" ? "ew-resize" : "ns-resize", minWidth: r === "row" ? "2px" : void 0, minHeight: r !== "row" ? "2px" : void 0, boxSizing: "border-box", pointerEvents: "all", zIndex: 1, ...Xe }, splitDirection: r, disabled: I, ...an }) : null, [be, Qe, an, r, Xe, I]), vt = r === "row" ? "Width" : "Height", Vt = { ...at, ...zt, flex: U.fixedPaneOffset === 0 && G?.pixels[0] !== null ? `0 0 ${Math.round(G?.pixels[0])}px` : `1 1 ${Math.round(G?.percents[0] ?? 100)}%`, [`min${vt}`]: G?.minBefore, [`max${vt}`]: o ? G?.maxBefore : "100%" }, Cn = { ...at, ...Be, flex: U.fixedPaneOffset === 1 && G?.pixels[1] !== null ? `0 0 ${Math.round(G?.pixels[1])}px` : `1 1 ${Math.round(G?.percents[1] ?? 100)}%`, [`min${vt}`]: G?.minAfter, [`max${vt}`]: n ? G?.maxAfter : "100%" }, un = Ee(() => n ? Y("div", { ref: S, className: Rn("before", te, pt), style: Vt, ...Re, ...gt, children: n }, "before") : null, [n, L, le, U, G]), Ne = Ee(() => o ? Y("div", { ref: K, className: Rn("after", te, Zt), style: Cn, ...Re, ...z, children: o }, "after") : null, [o, L, $, U, G]);
1369
- return Ht("div", { ref: fo([u, ze]), className: Rn("splitPane", r === "row" ? "vertical" : "horizontal", { dragging: He }, x), style: ke, children: [un, qt, Ne] });
1366
+ }, [X, He, l, i, te]), nn = k((Q) => {
1367
+ Qe?.(Q), Q.defaultPrevented || I || He || (je(!0), Ne(), document.addEventListener("pointermove", Mt, { passive: !1 }), document.addEventListener("touchmove", Mt, { passive: !1 }), document.addEventListener("pointerup", dn, { passive: !1 }));
1368
+ }, [Qe]), De = wo(t, () => ({ setPosition: on, isSplitPane: () => !0 }), []), Kt = _e(() => ve ? oe?.({ key: "resizer", ref: fo([K, $]), className: Rn("resizer", Je), onPointerDownCapture: nn, style: { cursor: I ? void 0 : r === "row" ? "ew-resize" : "ns-resize", minWidth: r === "row" ? "2px" : void 0, minHeight: r !== "row" ? "2px" : void 0, boxSizing: "border-box", pointerEvents: "all", zIndex: 1, ...mt }, splitDirection: r, disabled: I, ...cn }) : null, [ve, Je, cn, r, mt, I]), xt = r === "row" ? "Width" : "Height", Vt = { ...Ve, ...kt, flex: N.fixedPaneOffset === 0 && Y?.pixels[0] !== null ? `0 0 ${Math.round(Y?.pixels[0])}px` : `1 1 ${Math.round(Y?.percents[0] ?? 100)}%`, [`min${xt}`]: Y?.minBefore, [`max${xt}`]: o ? Y?.maxBefore : "100%" }, Cn = { ...Ve, ...St, flex: N.fixedPaneOffset === 1 && Y?.pixels[1] !== null ? `0 0 ${Math.round(Y?.pixels[1])}px` : `1 1 ${Math.round(Y?.percents[1] ?? 100)}%`, [`min${xt}`]: Y?.minAfter, [`max${xt}`]: n ? Y?.maxAfter : "100%" }, un = _e(() => n ? q("div", { ref: Ye, className: Rn("before", ue, dt), style: Vt, ...me, ...ut, children: n }, "before") : null, [n, z, le, N, Y]), We = _e(() => o ? q("div", { ref: E, className: Rn("after", ue, Zt), style: Cn, ...me, ...M, children: o }, "after") : null, [o, z, B, N, Y]);
1369
+ return Ht("div", { ref: fo([S, De]), className: Rn("splitPane", r === "row" ? "vertical" : "horizontal", { dragging: He }, x), style: ye, children: [un, Kt, We] });
1370
1370
  }));
1371
1371
  const Pl = ({ initValue: e, useHookBody: t, applyStateChange: n }) => {
1372
- const o = J(e);
1372
+ const o = Z(e);
1373
1373
  if (typeof t != "function") throw new Error("function expected as hook body parameter. got " + typeof t);
1374
1374
  const r = t();
1375
- return nn(() => {
1375
+ return tn(() => {
1376
1376
  o.current !== r && (o.current = r, n(r));
1377
1377
  }, [n, r]), null;
1378
- }, Ko = (e) => {
1378
+ }, qo = (e) => {
1379
1379
  console && console.warn && console.warn(e);
1380
1380
  }, zo = typeof self == "object" && self.self === self && self || typeof global == "object" && global.global === global && global || void 0;
1381
1381
  let Ol = 1, Yo = !1, wi = !1;
1382
1382
  const co = [], kn = [], po = () => {
1383
1383
  kn.forEach((e) => e());
1384
1384
  }, Ll = ({ automaticContainerInternalUseOnly: e }) => {
1385
- const [t, n] = Je([]), o = J([]);
1385
+ const [t, n] = Ze([]), o = Z([]);
1386
1386
  return o.current = t, e || Yo !== !1 || (wi = !0), st(() => {
1387
1387
  let r = !0;
1388
1388
  function i() {
1389
- if (r) return kn[0] !== i ? (e || Yo !== !0 || Ko("SingletonHooksContainer is mounted after some singleton hook has been used.Your SingletonHooksContainer will not be used in favor of internal one."), void n((l) => [])) : void n([...co]);
1389
+ if (r) return kn[0] !== i ? (e || Yo !== !0 || qo("SingletonHooksContainer is mounted after some singleton hook has been used.Your SingletonHooksContainer will not be used in favor of internal one."), void n((l) => [])) : void n([...co]);
1390
1390
  }
1391
1391
  return kn.push(i), po(), () => {
1392
- r = !1, o.current?.length > 0 && Ko("SingletonHooksContainer is unmounted, but it has active singleton hooks. They will be reevaluated once SingletonHooksContainer is mounted again"), kn.splice(kn.indexOf(i), 1), po();
1392
+ r = !1, o.current?.length > 0 && qo("SingletonHooksContainer is unmounted, but it has active singleton hooks. They will be reevaluated once SingletonHooksContainer is mounted again"), kn.splice(kn.indexOf(i), 1), po();
1393
1393
  };
1394
- }, [e]), Y(wn, { children: t.map(({ hook: r, key: i }) => Jo(Pl, { ...r, key: i })) });
1394
+ }, [e]), q(wn, { children: t.map(({ hook: r, key: i }) => Jo(Pl, { ...r, key: i })) });
1395
1395
  }, mi = (e, t, n = {}) => {
1396
1396
  let o, r, i = !1, l = !1, s = [], { unmountIfNoConsumers: a = !1 } = n;
1397
1397
  const d = (m) => {
1398
1398
  r = m, Li(() => s.forEach((f) => f(m)));
1399
1399
  }, g = () => (l || (r = typeof e == "function" ? e() : e, l = !0), r);
1400
1400
  return () => {
1401
- const [m, f] = Je(g);
1401
+ const [m, f] = Ze(g);
1402
1402
  return st(() => (i || (i = !0, o = ((x) => {
1403
- const E = Ol++;
1404
- return co.push({ hook: x, key: E }), kn.length === 0 && wi === !1 && (Yo = !0, ((I) => {
1403
+ const _ = Ol++;
1404
+ return co.push({ hook: x, key: _ }), kn.length === 0 && wi === !1 && (Yo = !0, ((I) => {
1405
1405
  if (zo.document && zo.document.createElement) {
1406
- const M = zo.document.createElement("div");
1407
- Oi(M).render(Y(I, { automaticContainerInternalUseOnly: !0 }));
1408
- } else Ko("Can not mount SingletonHooksContainer on server side. Did you manage to run useEffect on server? Please mount SingletonHooksContainer into your components tree manually.");
1406
+ const R = zo.document.createElement("div");
1407
+ Oi(R).render(q(I, { automaticContainerInternalUseOnly: !0 }));
1408
+ } else qo("Can not mount SingletonHooksContainer on server side. Did you manage to run useEffect on server? Please mount SingletonHooksContainer into your components tree manually.");
1409
1409
  })(Ll)), po(), () => {
1410
- co.splice(co.findIndex((I) => I.key === E), 1), po();
1410
+ co.splice(co.findIndex((I) => I.key === _), 1), po();
1411
1411
  };
1412
1412
  })({ initValue: e, useHookBody: t, applyStateChange: d })), s.push(f), r !== m && f(r), () => {
1413
1413
  s.splice(s.indexOf(f), 1), s.length === 0 && a && (o(), i = !1);
@@ -1415,7 +1415,7 @@ const co = [], kn = [], po = () => {
1415
1415
  };
1416
1416
  };
1417
1417
  mi(null, () => {
1418
- const [e, t] = Je(null);
1418
+ const [e, t] = Ze(null);
1419
1419
  return e;
1420
1420
  });
1421
1421
  class Dl {
@@ -1529,16 +1529,16 @@ class Dl {
1529
1529
  }), n;
1530
1530
  }
1531
1531
  }
1532
- class Se extends Dl {
1532
+ class Ee extends Dl {
1533
1533
  }
1534
1534
  Ct.getOS() === Ct.OSType.MacOS || (Ct.getOS(), Ct.OSType.IOS), Ct.getOS() === Ct.OSType.MacOS || (Ct.getOS(), Ct.OSType.IOS), mi({ setClipboard: (e) => {
1535
1535
  throw new Error("This is only available via the useClipboard.");
1536
1536
  }, getClipboard: () => ho.Global, refNativeCopy: { current: null }, refNativeLastKey: { current: null } }, () => {
1537
- const [e, t] = Je(ho.Global);
1538
- return { setClipboard: (n) => t(n), getClipboard: () => e, refNativeCopy: J(null), refNativeLastKey: J(null) };
1537
+ const [e, t] = Ze(ho.Global);
1538
+ return { setClipboard: (n) => t(n), getClipboard: () => e, refNativeCopy: Z(null), refNativeLastKey: Z(null) };
1539
1539
  });
1540
1540
  let Ao = !1, zl = 0;
1541
- var Al = typeof document < "u" ? nn : st;
1541
+ var Al = typeof document < "u" ? tn : st;
1542
1542
  const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
1543
1543
  const [e, t] = Sn.useState(() => Ao ? Pr() : void 0);
1544
1544
  return Al(() => {
@@ -1580,10 +1580,10 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
1580
1580
  for (; r < n && Pn({ itemType: e, itemSize: t, index: r, instanceProps: o, scale: l }).offset < i; ) r += s, s *= 2;
1581
1581
  return xi({ itemType: e, itemSize: t, instanceProps: o, high: Math.min(r, n - 1), low: Math.floor(r / 2), offset: i, scale: l });
1582
1582
  }, Fl = (e) => {
1583
- const { rowCount: t, columnCount: n, defaultRowHeight: o, getRowHeight: r, defaultColumnWidth: i, getColumnWidth: l } = e || {}, s = J({ columnMetadataMap: {}, rowMetadataMap: {}, lastMeasuredColumnIndex: -1, lastMeasuredRowIndex: -1, recalcColumnIndices: [], recalcRowIndices: [] }), a = T((_) => Or({ itemType: "row", itemCount: t, itemSize: r ?? (() => o ?? 20), instanceProps: s.current, offset: _ }), [t, r, o]), d = T((_) => _ === -1 ? 0 : Pn({ itemType: "row", index: _, itemSize: r ?? (() => o ?? 20), instanceProps: s.current }).offset, [r, o]), g = T((_) => Pn({ itemType: "row", index: _, itemSize: r ?? (() => o ?? 20), instanceProps: s.current }).size, [r, o]), m = T((_) => Or({ itemType: "column", itemCount: n, itemSize: l ?? (() => i ?? 75), instanceProps: s.current, offset: _ }), [n, l, i]), f = T((_) => _ === -1 ? 0 : Pn({ itemType: "column", index: _, itemSize: l ?? (() => i ?? 75), instanceProps: s.current }).offset, [l, i]), x = T((_) => Pn({ itemType: "column", index: _, itemSize: l ?? (() => i ?? 75), instanceProps: s.current }).size, [l, i]), [E, I] = Qo((_) => _ + 1, 0), M = () => ({ getRowOffset: d, getColOffset: f, getRowIndex: a, getColIndex: m }), [ae, R] = Je(() => e ? M() : null);
1583
+ const { rowCount: t, columnCount: n, defaultRowHeight: o, getRowHeight: r, defaultColumnWidth: i, getColumnWidth: l } = e || {}, s = Z({ columnMetadataMap: {}, rowMetadataMap: {}, lastMeasuredColumnIndex: -1, lastMeasuredRowIndex: -1, recalcColumnIndices: [], recalcRowIndices: [] }), a = k((C) => Or({ itemType: "row", itemCount: t, itemSize: r ?? (() => o ?? 20), instanceProps: s.current, offset: C }), [t, r, o]), d = k((C) => C === -1 ? 0 : Pn({ itemType: "row", index: C, itemSize: r ?? (() => o ?? 20), instanceProps: s.current }).offset, [r, o]), g = k((C) => Pn({ itemType: "row", index: C, itemSize: r ?? (() => o ?? 20), instanceProps: s.current }).size, [r, o]), m = k((C) => Or({ itemType: "column", itemCount: n, itemSize: l ?? (() => i ?? 75), instanceProps: s.current, offset: C }), [n, l, i]), f = k((C) => C === -1 ? 0 : Pn({ itemType: "column", index: C, itemSize: l ?? (() => i ?? 75), instanceProps: s.current }).offset, [l, i]), x = k((C) => Pn({ itemType: "column", index: C, itemSize: l ?? (() => i ?? 75), instanceProps: s.current }).size, [l, i]), [_, I] = Qo((C) => C + 1, 0), R = () => ({ getRowOffset: d, getColOffset: f, getRowIndex: a, getColIndex: m }), [ae, P] = Ze(() => e ? R() : null);
1584
1584
  return st(() => {
1585
- R(e ? M() : null);
1586
- }, [E, t, n, i, o, g, x]), ae;
1585
+ P(e ? R() : null);
1586
+ }, [_, t, n, i, o, g, x]), ae;
1587
1587
  }, vi = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ~`!@#$%^&*()-_=+[{]};:'\",<.>/?|\\", Lr = (e) => {
1588
1588
  if (!e) return null;
1589
1589
  if (e.eventType === "start") return { type: e.eventType };
@@ -1597,240 +1597,241 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
1597
1597
  }
1598
1598
  return { type: e.eventType ?? "unknown" };
1599
1599
  }, jl = (e) => !0, Vl = (e) => !!e && !(e.ctrlKey || e.metaKey || e.altKey || e.isComposing) && (!(e.shiftKey || e.key !== "F2" && e.key !== " " && e.key !== "Backspace") || (!e.shiftKey || e.key !== " ") && vi.indexOf(e.key) !== -1), Wl = (e) => !!e && e.type === "dblclick" && { editMode: !0 }, Hl = (e) => {
1600
- const { session: t, refLatestCoords: n, handleSubmitEdit: o, handleCancelEdit: r, cellBounds: i, isInBounds: l, getCellEditor: s, propsEditor: a, borderStrokeFill: d = "rgb(33, 115, 70)", borderStrokeWidth: g = 2, alignment: m = Wn.Left, style: f, ...x } = e, E = J(null), I = J(null), [M, ae] = Je(!1), R = t.coords, _ = O(async (X) => {
1601
- if (E.current?.getBoundingClientRect()) {
1600
+ const { session: t, refLatestCoords: n, handleSubmitEdit: o, handleCancelEdit: r, cellBounds: i, isInBounds: l, getCellEditor: s, propsEditor: a, borderStrokeFill: d = "rgb(33, 115, 70)", borderStrokeWidth: g = 2, alignment: m = Wn.Left, style: f, ...x } = e, _ = Z(null), I = Z(null), [R, ae] = Ze(!1), P = t.coords, C = D(async (X) => {
1601
+ if (_.current?.getBoundingClientRect()) {
1602
1602
  if (X.eventType === "keyboard") {
1603
- const u = X.event, C = new KeyboardEvent(u.type, { bubbles: !0, cancelable: !0, view: window, key: u.key, code: u.code, location: u.location, repeat: u.repeat, isComposing: u.isComposing, charCode: u.charCode, keyCode: u.keyCode, which: u.which, ctrlKey: u.ctrlKey, shiftKey: u.shiftKey, altKey: u.altKey, metaKey: u.metaKey });
1604
- C.isSynthetic = !0, C.key, I.current?.dispatchEvent(C);
1603
+ const S = X.event, h = new KeyboardEvent(S.type, { bubbles: !0, cancelable: !0, view: window, key: S.key, code: S.code, location: S.location, repeat: S.repeat, isComposing: S.isComposing, charCode: S.charCode, keyCode: S.keyCode, which: S.which, ctrlKey: S.ctrlKey, shiftKey: S.shiftKey, altKey: S.altKey, metaKey: S.metaKey });
1604
+ h.isSynthetic = !0, h.key, I.current?.dispatchEvent(h);
1605
1605
  } else X.eventType === "pointer" || console.warn("unsupported event type", X);
1606
- await new Promise((u) => requestAnimationFrame(u));
1606
+ await new Promise((S) => requestAnimationFrame(S));
1607
1607
  }
1608
1608
  }, []);
1609
1609
  st(() => {
1610
1610
  const X = I.current;
1611
1611
  return ae(!0), I.current.startEdit?.(t.startEvent), (async () => {
1612
- t.editorRefs.push(X), t.editorRefsDispatchEditorEvent.push(_);
1613
- const k = [...t.events];
1614
- for (let u = 0; u < k.length; u++) await _(k[u]);
1612
+ t.editorRefs.push(X), t.editorRefsDispatchEditorEvent.push(C);
1613
+ const T = [...t.events];
1614
+ for (let S = 0; S < T.length; S++) await C(T[S]);
1615
1615
  t.onMount(X);
1616
1616
  })(), () => {
1617
- const k = t.editorRefs.indexOf(X);
1618
- k !== -1 && t.editorRefs.splice(k, 1), t.onUnmount(X);
1617
+ const T = t.editorRefs.indexOf(X);
1618
+ T !== -1 && t.editorRefs.splice(T, 1), t.onUnmount(X);
1619
1619
  };
1620
1620
  }, []);
1621
- const L = O(() => o(t), []), le = O(() => {
1621
+ const z = D(() => o(t), []), le = D(() => {
1622
1622
  r(t);
1623
- }, []), $ = n.current && Z.isEqualCells(n.current, R), oe = l && $ && M, be = s({ autoFocus: !!t.startEvent?.autoFocus, ...a, onSubmitEdit: L, onCancelEdit: le, ref: I }, R), U = i.x + me.boundPixel(-g / 2), H = me.boundPixel(i.width + g / 2, !0);
1624
- return Y("div", { tabIndex: 0, ref: E, style: { background: void 0, ...f, opacity: oe ? f?.opacity ?? 1 : 0, pointerEvents: "auto", position: "absolute", boxSizing: "border-box", top: `${i.y + me.boundPixel(-g / 2)}px`, height: me.boundPixel(i.height + g / 2, !0), left: `${U}px`, width: H }, ...x, children: Y("div", { className: "editor-container", style: { position: "absolute", boxSizing: "border-box", left: `${me.boundPixel(1)}px`, top: `${me.boundPixel(1)}px`, width: me.boundPixel(i.width - 2, !0), height: me.boundPixel(i.height - 2, !0), outline: `${g}px ${d} solid`, boxShadow: "rgba(60,64,67,.35) 2px 2px 6px 3px", maxHeight: "100%", overflow: "hidden", display: "flex" }, children: be }) });
1623
+ }, []), B = n.current && G.isEqualCells(n.current, P), oe = l && B && R, ve = s({ autoFocus: !!t.startEvent?.autoFocus, ...a, onSubmitEdit: z, onCancelEdit: le, ref: I }, P), N = i.x + we.boundPixel(-g / 2), H = we.boundPixel(i.width + g / 2, !0);
1624
+ return q("div", { tabIndex: 0, ref: _, style: { background: void 0, ...f, opacity: oe ? f?.opacity ?? 1 : 0, pointerEvents: "auto", position: "absolute", boxSizing: "border-box", top: `${i.y + we.boundPixel(-g / 2)}px`, height: we.boundPixel(i.height + g / 2, !0), left: `${N}px`, width: H }, ...x, children: q("div", { className: "editor-container", style: { position: "absolute", boxSizing: "border-box", left: `${we.boundPixel(1)}px`, top: `${we.boundPixel(1)}px`, width: we.boundPixel(i.width - 2, !0), height: we.boundPixel(i.height - 2, !0), outline: `${g}px ${d} solid`, boxShadow: "rgba(60,64,67,.35) 2px 2px 6px 3px", maxHeight: "100%", overflow: "hidden", display: "flex" }, children: ve }) });
1625
1625
  }, gs = (e) => {
1626
- const { view: t, canEdit: n = jl, getCellEditor: o, onBeforeStartEdit: r, onStartEdit: i, onSubmitEdit: l, onCancelEdit: s, onDoneEdit: a, isEditorStartKeyEvent: d = Vl, isEditorStartPointerEvent: g = Wl, containerProps: m, borderStrokeFill: f, borderStrokeWidth: x = 2, getRangeCoords: E = null, activeCoords: I, alignment: M = Wn.Left } = e, [ae, R] = Je(!1), [_, L] = Je(void 0), le = T((S, ue, K, pe, te, Re) => {
1627
- if (!ue) return null;
1628
- const at = te?.(ue, S), pt = S.getRangeCoordsBounds(at), zt = S.toClipBounds(pt), gt = pt, Zt = S.getZoom();
1629
- if (!zt) return null;
1630
- K && (K *= Zt), pe && (pe *= Zt);
1631
- let Be = gt, z = !1;
1632
- if (K !== void 0) {
1633
- let Xe = { ...at }, wt = 0;
1634
- for (; !z && Be.width <= K && wt < 20; ) {
1635
- wt++, wt > 19 && console.warn("max width reached");
1636
- const an = S.getTotalRangeCoords(), Jt = S.getLayout();
1637
- Re === Wn.Left ? Xe.colEnd + 1 < an.colEnd ? Xe.colEnd = Jt.getColIndex(Be.x + K) : z = !0 : Re === Wn.Right ? Xe.colStart - 1 >= 0 ? Xe.colStart = Jt.getColIndex(Be.x - (K - Be.width)) : z = !0 : Re === Wn.Center && Xe.colEnd + 1 < an.colEnd && Xe.colStart - 1 >= 0 ? (Xe.colStart = Jt.getColIndex(Be.x - (K - Be.width) / 2), Xe.colEnd = Jt.getColIndex(Be.x + Be.width + (K - Be.width) / 2)) : z = !0, z || (Be = S.getRangeCoordsBounds(Xe));
1626
+ const { view: t, canEdit: n = jl, getCellEditor: o, onBeforeStartEdit: r, onStartEdit: i, onSubmitEdit: l, onCancelEdit: s, onDoneEdit: a, isEditorStartKeyEvent: d = Vl, isEditorStartPointerEvent: g = Wl, containerProps: m, borderStrokeFill: f, borderStrokeWidth: x = 2, getRangeCoords: _ = null, activeCoords: I, alignment: R = Wn.Left } = e, [ae, P] = Ze(!1), [C, z] = Ze(void 0), le = k(($, E, Me, ue, me, Ve) => {
1627
+ if (!E) return null;
1628
+ const dt = me?.(E, $), kt = $.getRangeCoordsBounds(dt), ut = $.toClipBounds(kt), Zt = kt, St = $.getZoom();
1629
+ if (!ut) return null;
1630
+ Me && (Me *= St), ue && (ue *= St);
1631
+ let M = Zt, ye = !1;
1632
+ if (Me !== void 0) {
1633
+ let Qe = { ...dt }, cn = 0;
1634
+ for (; !ye && M.width <= Me && cn < 20; ) {
1635
+ cn++, cn > 19 && console.warn("max width reached");
1636
+ const on = $.getTotalRangeCoords(), Mt = $.getLayout();
1637
+ Ve === Wn.Left ? Qe.colEnd + 1 < on.colEnd ? Qe.colEnd = Mt.getColIndex(M.x + Me) : ye = !0 : Ve === Wn.Right ? Qe.colStart - 1 >= 0 ? Qe.colStart = Mt.getColIndex(M.x - (Me - M.width)) : ye = !0 : Ve === Wn.Center && Qe.colEnd + 1 < on.colEnd && Qe.colStart - 1 >= 0 ? (Qe.colStart = Mt.getColIndex(M.x - (Me - M.width) / 2), Qe.colEnd = Mt.getColIndex(M.x + M.width + (Me - M.width) / 2)) : ye = !0, ye || (M = $.getRangeCoordsBounds(Qe));
1638
1638
  }
1639
1639
  }
1640
- Be.height = gt.height, pe !== void 0 && (Be.height = Math.max(pe + 1, gt.height));
1641
- const { width: ke, height: Qe } = S.getViewportSize();
1642
- return { x: Be.x ?? 0, y: Be.y ?? 0, height: Math.min(Qe - Be.y, Be.height) + 1, width: Math.min(ke - Be.x, Be.width) + 1 };
1643
- }, [M]), $ = T(n, [n]), oe = O(() => {
1640
+ M.height = Zt.height, ue !== void 0 && (M.height = Math.max(ue + 1, Zt.height));
1641
+ const { width: Je, height: mt } = $.getViewportSize();
1642
+ return { x: M.x ?? 0, y: M.y ?? 0, height: Math.min(mt - M.y, M.height) + 1, width: Math.min(Je - M.x, M.width) + 1 };
1643
+ }, [R]), B = k(n, [n]), oe = D(() => {
1644
1644
  t?.getStage()?.focus();
1645
- }, [t]), be = T((S) => {
1646
- r?.(S), N(), R(!0);
1647
- }, [r]), U = T((S) => {
1648
- i?.(S.coords);
1649
- }, [i]), H = T((S) => {
1650
- S.isSubmitted || S.isCancelled || (u.current.isEditorClosed = !0, oe(), S.isCancelled = !0, s?.(S.coords), N());
1651
- }, [s]), X = T((S) => {
1652
- if (S.isSubmitted || S.isCancelled) return !1;
1645
+ }, [t]), ve = Z(null), N = k(($) => {
1646
+ r?.($), te(), P(!0), ve.current = null;
1647
+ }, [r]), H = k(($) => {
1648
+ i?.($.coords);
1649
+ }, [i]), X = k(($) => {
1650
+ $.isSubmitted || $.isCancelled || (h.current.isEditorClosed = !0, oe(), $.isCancelled = !0, s?.($.coords), te());
1651
+ }, [s]), T = k(($) => {
1652
+ if ($.isSubmitted || $.isCancelled) return !1;
1653
1653
  try {
1654
- return S.isEditorClosing = !0, S.isSubmitted = !0, S.isEditorSubmitted || (S.isEditorSubmitted = !0, S.editorRefs[0]?.submitEdit?.()), S.coords, l?.(S.coords), S.isEditorClosed = !0, oe(), N(), !0;
1655
- } catch (ue) {
1656
- throw S.isEditorClosing = !1, S.isSubmitted = !1, ue;
1657
- }
1658
- }, [l]), k = T((S) => {
1659
- R(!1), a?.(S.coords), N();
1660
- }, [a]), u = J(null), C = J(null), ee = J(null), W = J([]), [A, q] = Qo((S) => S + 1, 0), N = O((S) => {
1661
- S && W.current.push(S), q();
1662
- }, []), xe = T((S) => {
1663
- if (S.defaultPrevented || S.isSynthetic || !t) return;
1664
- const ue = t?.getCellCoordsFromClient(S.clientX, S.clientY);
1665
- ue && N({ eventType: "pointer", event: S, coords: ue });
1666
- }, [t]), G = T((S) => {
1667
- const ue = S.nativeEvent;
1668
- xe(ue);
1669
- }, [t]), He = T((S) => {
1670
- if (S.defaultPrevented || S.isSynthetic || !t?.getStage()) return;
1671
- const ue = C.current;
1672
- d(S, ue) && (S.stopPropagation(), S.preventDefault()), S.key, N({ eventType: "keyboard", event: S, coords: ue });
1654
+ return ve.current = $.coords, $.isEditorClosing = !0, $.isSubmitted = !0, $.isEditorSubmitted || ($.isEditorSubmitted = !0, $.editorRefs[0]?.submitEdit?.()), $.coords, l?.($.coords), $.isEditorClosed = !0, oe(), te(), !0;
1655
+ } catch (E) {
1656
+ throw $.isEditorClosing = !1, $.isSubmitted = !1, E;
1657
+ }
1658
+ }, [l]), S = k(($) => {
1659
+ P(!1), a?.($.coords), te();
1660
+ }, [a]), h = Z(null), J = Z(null), K = Z(null), L = Z([]), [U, ee] = Qo(($) => $ + 1, 0), te = D(($) => {
1661
+ $ && L.current.push($), ee();
1662
+ }, []), Y = k(($) => {
1663
+ if ($.defaultPrevented || $.isSynthetic || !t) return;
1664
+ const E = t?.getCellCoordsFromClient($.clientX, $.clientY);
1665
+ E && te({ eventType: "pointer", event: $, coords: E });
1666
+ }, [t]), He = k(($) => {
1667
+ const E = $.nativeEvent;
1668
+ Y(E);
1669
+ }, [t]), je = k(($) => {
1670
+ if ($.defaultPrevented || $.isSynthetic || !t?.getStage()) return;
1671
+ const E = J.current;
1672
+ d($, E) && ($.stopPropagation(), $.preventDefault()), $.key, te({ eventType: "keyboard", event: $, coords: E });
1673
1673
  }, [t]);
1674
- nn(() => {
1675
- const S = (pe, te) => {
1676
- const Re = te?.cell ?? pe;
1677
- if (!Re) return null;
1678
- const at = Re;
1679
- if (!$(Re)) return null;
1680
- be?.(Re);
1681
- const pt = Ct.uuidV4();
1682
- te = Object.freeze({ autoFocus: !0, ...te }), ee.current = Re;
1683
- const zt = { coords: at, startEvent: te, uuid: pt, isMounted: !1, isStarted: !1, isSubmitted: !1, isEditorSubmitted: !1, isEditorClosing: !1, isEditorClosed: !1, isCancelled: !1, events: [], editorRefsDispatchEditorEvent: [], editorRefs: [], onMount: (gt) => {
1684
- zt.isMounted || (zt.isMounted = !0, N());
1685
- }, onUnmount: (gt) => {
1686
- if (zt.editorRefs.length === 0) {
1687
- const Zt = () => {
1688
- zt.isMounted = !1, N();
1674
+ tn(() => {
1675
+ const $ = (ue, me) => {
1676
+ const Ve = me?.cell ?? ue;
1677
+ if (!Ve) return null;
1678
+ const dt = Ve;
1679
+ if (!B(Ve)) return null;
1680
+ N?.(Ve);
1681
+ const kt = Ct.uuidV4();
1682
+ me = Object.freeze({ autoFocus: !0, ...me }), K.current = Ve;
1683
+ const ut = { coords: dt, startEvent: me, uuid: kt, isMounted: !1, isStarted: !1, isSubmitted: !1, isEditorSubmitted: !1, isEditorClosing: !1, isEditorClosed: !1, isCancelled: !1, events: [], editorRefsDispatchEditorEvent: [], editorRefs: [], onMount: (Zt) => {
1684
+ ut.isMounted || (ut.isMounted = !0, te());
1685
+ }, onUnmount: (Zt) => {
1686
+ if (ut.editorRefs.length === 0) {
1687
+ const St = () => {
1688
+ ut.isMounted = !1, te();
1689
1689
  };
1690
- if (document.activeElement !== document.body) Zt();
1690
+ if (document.activeElement !== document.body) St();
1691
1691
  else {
1692
- const Be = (z) => {
1693
- z.defaultPrevented || z.target !== document.body || He(z);
1692
+ const M = (ye) => {
1693
+ ye.defaultPrevented || ye.target !== document.body || je(ye);
1694
1694
  };
1695
- window.addEventListener("keydown", Be, !0), t.getStage()?.addEventListener("focusin", () => {
1696
- window.removeEventListener("keydown", Be), Zt();
1695
+ window.addEventListener("keydown", M, !0), t.getStage()?.addEventListener("focusin", () => {
1696
+ window.removeEventListener("keydown", M), St();
1697
1697
  }, { once: !0 }), oe();
1698
1698
  }
1699
1699
  }
1700
1700
  } };
1701
- return zt;
1701
+ return ut;
1702
1702
  };
1703
- if (W.current.length <= 0 && !u.current) return;
1704
- const ue = W.current[0];
1705
- Lr(ue), ((pe) => {
1706
- const te = [], Re = pe?.length ?? 0;
1707
- for (let at = 0; at < Re; at++) {
1708
- const pt = pe[at];
1709
- te.push(Lr(pt));
1703
+ if (L.current.length <= 0 && !h.current) return;
1704
+ const E = L.current[0];
1705
+ Lr(E), ((ue) => {
1706
+ const me = [], Ve = ue?.length ?? 0;
1707
+ for (let dt = 0; dt < Ve; dt++) {
1708
+ const kt = ue[dt];
1709
+ me.push(Lr(kt));
1710
1710
  }
1711
- })(W.current), u.current, u.current;
1712
- let K = u.current;
1713
- if (u.current) {
1714
- if (u.current.isDone) u.current = null;
1715
- else if (u.current.isSubmitted || u.current.isCancelled) {
1716
- if (u.current.isMounted) return;
1717
- u.current.isDone || (k(u.current), u.current.isDone = !0);
1711
+ })(L.current), h.current, h.current;
1712
+ let Me = h.current;
1713
+ if (h.current) {
1714
+ if (h.current.isDone) h.current = null;
1715
+ else if (h.current.isSubmitted || h.current.isCancelled) {
1716
+ if (h.current.isMounted) return;
1717
+ h.current.isDone || (S(h.current), h.current.isDone = !0);
1718
1718
  }
1719
1719
  }
1720
- if (ue) {
1721
- if (ue.eventType === "start") {
1722
- const pe = ue, te = pe.startEvent?.cell ?? C.current;
1723
- u.current && Z.isEqualCells(u.current.coords, te) || (u.current = S(te, pe.startEvent));
1724
- } else if (ue.eventType === "keyboard") {
1725
- const pe = ue.event;
1726
- if (u.current) {
1727
- pe.key, u.current.events, u.current.events.push(ue);
1728
- for (let te = 0; te < u.current.editorRefsDispatchEditorEvent.length; te++) u.current.editorRefsDispatchEditorEvent[te](ue);
1729
- } else if (d(pe, ue.coords)) {
1730
- let te;
1731
- const Re = S(te?.cell ?? C.current, te);
1732
- Re && Re.events.push(ue), u.current = Re;
1720
+ if (E) {
1721
+ if (E.eventType === "start") {
1722
+ const ue = E, me = ue.startEvent?.cell ?? J.current;
1723
+ h.current && G.isEqualCells(h.current.coords, me) || (h.current = $(me, ue.startEvent));
1724
+ } else if (E.eventType === "keyboard") {
1725
+ const ue = E.event;
1726
+ if (h.current) {
1727
+ ue.key, h.current.events, h.current.events.push(E);
1728
+ for (let me = 0; me < h.current.editorRefsDispatchEditorEvent.length; me++) h.current.editorRefsDispatchEditorEvent[me](E);
1729
+ } else if (d(ue, E.coords)) {
1730
+ let me;
1731
+ const Ve = $(me?.cell ?? J.current, me);
1732
+ Ve && Ve.events.push(E), h.current = Ve;
1733
1733
  }
1734
- } else if (ue.eventType === "pointer") {
1735
- const pe = ue.event;
1736
- if (u.current) {
1737
- u.current.events.push(ue);
1738
- for (let te = 0; te < u.current.editorRefsDispatchEditorEvent.length; te++) u.current.editorRefsDispatchEditorEvent[te](ue);
1734
+ } else if (E.eventType === "pointer") {
1735
+ const ue = E.event;
1736
+ if (h.current) {
1737
+ h.current.events.push(E);
1738
+ for (let me = 0; me < h.current.editorRefsDispatchEditorEvent.length; me++) h.current.editorRefsDispatchEditorEvent[me](E);
1739
1739
  } else {
1740
- const te = ue?.coords ?? C.current, Re = g(pe, te);
1741
- if (Re) {
1742
- let at;
1743
- typeof at != "boolean" && (at = Re);
1744
- const pt = S(te, at);
1745
- pt && pt.events.push(ue), u.current = pt;
1740
+ const me = E?.coords ?? J.current, Ve = g(ue, me);
1741
+ if (Ve) {
1742
+ let dt;
1743
+ typeof dt != "boolean" && (dt = Ve);
1744
+ const kt = $(me, dt);
1745
+ kt && kt.events.push(E), h.current = kt;
1746
1746
  }
1747
1747
  }
1748
- } else if (ue.eventType === "submit") {
1749
- if (u.current && !u.current.isSubmitted && !u.current.isCancelled) {
1750
- if (!u.current.isMounted) return;
1751
- X(u.current);
1748
+ } else if (E.eventType === "submit") {
1749
+ if (h.current && !h.current.isSubmitted && !h.current.isCancelled) {
1750
+ if (!h.current.isMounted) return;
1751
+ T(h.current);
1752
1752
  }
1753
- } else if (ue.eventType === "cancel") {
1754
- if (u.current && !u.current.isSubmitted && !u.current.isCancelled) {
1755
- if (!u.current.isMounted) return;
1756
- H(u.current);
1753
+ } else if (E.eventType === "cancel") {
1754
+ if (h.current && !h.current.isSubmitted && !h.current.isCancelled) {
1755
+ if (!h.current.isMounted) return;
1756
+ X(h.current);
1757
1757
  }
1758
- } else if (ue.eventType === "coordsChange") {
1759
- const pe = ue;
1760
- if (C.current = pe.activeCoords, u.current, u.current && !u.current.isSubmitted && !u.current.isCancelled) {
1761
- if (!u.current.isMounted) return;
1758
+ } else if (E.eventType === "coordsChange") {
1759
+ const ue = E;
1760
+ if (J.current = ue.activeCoords, h.current, h.current && !h.current.isSubmitted && !h.current.isCancelled) {
1761
+ if (!h.current.isMounted) return;
1762
1762
  try {
1763
- X(u.current);
1763
+ T(h.current);
1764
1764
  } catch {
1765
1765
  }
1766
1766
  }
1767
1767
  }
1768
1768
  }
1769
- W.current.length > 0 && (W.current.shift(), N()), W.current.length === 0 && (!u.current || u.current.isEditorClosing || u.current.isEditorClosed ? !u.current && K && oe() : u.current.isMounted && !u.current.isStarted && (u.current.isStarted = !0, u.current.startEvent.autoFocus && (typeof u.current.startEvent.autoFocus == "string" ? u.current.editorRefs[0]?.autoFocus(u.current.startEvent.autoFocus) : u.current.editorRefs[0]?.autoFocus()), U?.(u.current), requestAnimationFrame(() => {
1770
- t && u.current?.coords && t.scrollCellCoordsIntoView(u.current.coords);
1769
+ L.current.length > 0 && (L.current.shift(), te()), L.current.length === 0 && (!h.current || h.current.isEditorClosing || h.current.isEditorClosed ? !h.current && Me && oe() : h.current.isMounted && !h.current.isStarted && (h.current.isStarted = !0, h.current.startEvent.autoFocus && (typeof h.current.startEvent.autoFocus == "string" ? h.current.editorRefs[0]?.autoFocus(h.current.startEvent.autoFocus) : h.current.editorRefs[0]?.autoFocus()), H?.(h.current), requestAnimationFrame(() => {
1770
+ t && h.current?.coords && t.scrollCellCoordsIntoView(h.current.coords);
1771
1771
  })));
1772
- }, [A]), st(() => {
1773
- ee.current = I;
1774
- const S = u.current?.coords;
1775
- Z.isEqualCells(S, I) || (u.current && (u.current.isEditorClosing = !0), N({ eventType: "coordsChange", activeCoords: I }));
1772
+ }, [U]), st(() => {
1773
+ if (ve.current && G.isEqualCells(ve.current, I)) return;
1774
+ K.current = I;
1775
+ const $ = h.current?.coords;
1776
+ G.isEqualCells($, I) || (h.current && (h.current.isEditorClosing = !0), te({ eventType: "coordsChange", activeCoords: I }));
1776
1777
  }, [I]);
1777
- const Ue = O((S) => {
1778
- He(S.nativeEvent);
1779
- }, []), { width: We = 0, height: ht = 0 } = _ ?? { width: 0, height: 0 }, _e = T(o, [o]);
1780
- return { overlay: T((S) => {
1781
- if (!u.current || u.current.isEditorClosed) return u.current, null;
1782
- u.current.coords;
1783
- let ue = le(S, u.current.coords, We, ht, E, M), K = !0;
1784
- ue && ue.width !== 0 && ue.height !== 0 || (ue = { x: 0, y: 0, width: We, height: We }, K = !1);
1785
- const pe = S.getZoom(), te = { containerBounds: { x: 0, y: 0, width: ue.width / pe, height: ue.height / pe }, setNaturalDimensions: L, zoom: pe };
1786
- return Y(Hl, { session: u.current, refLatestCoords: ee, handleSubmitEdit: X, handleCancelEdit: H, cellBounds: ue, borderStrokeWidth: x, borderStrokeFill: f, isInBounds: K, getCellEditor: _e, propsEditor: te, alignment: M, ...m }, "editor:" + u.current.uuid);
1787
- }, [o, E, A, We, ht, M, x, f]), startEdit: O((S) => {
1788
- N({ eventType: "start", startEvent: S });
1789
- }, []), submitEdit: O(() => {
1790
- N({ eventType: "submit" });
1791
- }, []), cancelEdit: O(() => {
1792
- N({ eventType: "cancel" });
1793
- }, []), onKeyboardEvent: Ue, onPointerEvent: G, onKeyboardEventNative: He, onPointerEventNative: xe, isEditing: ae };
1794
- }, ws = ({ gridRef: e, gridMainRef: t, orientation: n = cn, headerCount: o, selectionPolicy: r = "multiple", newSelectionMode: i = "clear", alwaysScrollToActiveCoords: l = !0, onDragStart: s, onDragEnd: a, pointerDownInterceptor: d, pointerMoveInterceptor: g, onPointerUp: m, newSelection: f, modifySelection: x, appendSelection: E, clearSelections: I }) => {
1795
- const M = o ?? ((n === cn ? e.current?.rowCount : e.current?.columnCount) || 0), ae = J(null), R = J(null), _ = J(!1), L = J(null), le = O((u) => n === Nt ? { rowIndex: 0, colIndex: u.colIndex } : { rowIndex: u.rowIndex, colIndex: 0 }, [n]), $ = O((u) => n === Nt ? { rowIndex: t.current ? t.current.rowCount - 1 : 0, colIndex: u.colIndex } : { rowIndex: u.rowIndex, colIndex: t.current ? t.current.columnCount - 1 : 0 }, [n]), oe = (u) => {
1796
- R.current = $(u), x(R.current, ae.current);
1797
- }, be = O((u, C) => {
1778
+ const Ne = D(($) => {
1779
+ je($.nativeEvent);
1780
+ }, []), { width: at = 0, height: Se = 0 } = C ?? { width: 0, height: 0 }, Ye = k(o, [o]);
1781
+ return { overlay: k(($) => {
1782
+ if (!h.current || h.current.isEditorClosed) return h.current, null;
1783
+ h.current.coords;
1784
+ let E = le($, h.current.coords, at, Se, _, R), Me = !0;
1785
+ E && E.width !== 0 && E.height !== 0 || (E = { x: 0, y: 0, width: at, height: at }, Me = !1);
1786
+ const ue = $.getZoom(), me = { containerBounds: { x: 0, y: 0, width: E.width / ue, height: E.height / ue }, setNaturalDimensions: z, zoom: ue };
1787
+ return q(Hl, { session: h.current, refLatestCoords: K, handleSubmitEdit: T, handleCancelEdit: X, cellBounds: E, borderStrokeWidth: x, borderStrokeFill: f, isInBounds: Me, getCellEditor: Ye, propsEditor: me, alignment: R, ...m }, "editor:" + h.current.uuid);
1788
+ }, [o, _, U, at, Se, R, x, f]), startEdit: D(($) => {
1789
+ te({ eventType: "start", startEvent: $ });
1790
+ }, []), submitEdit: D(() => {
1791
+ te({ eventType: "submit" });
1792
+ }, []), cancelEdit: D(() => {
1793
+ te({ eventType: "cancel" });
1794
+ }, []), onKeyboardEvent: Ne, onPointerEvent: He, onKeyboardEventNative: je, onPointerEventNative: Y, isEditing: ae };
1795
+ }, ws = ({ gridRef: e, gridMainRef: t, orientation: n = an, headerCount: o, selectionPolicy: r = "multiple", newSelectionMode: i = "clear", alwaysScrollToActiveCoords: l = !0, onDragStart: s, onDragEnd: a, pointerDownInterceptor: d, pointerMoveInterceptor: g, onPointerUp: m, newSelection: f, modifySelection: x, appendSelection: _, clearSelections: I }) => {
1796
+ const R = o ?? ((n === an ? e.current?.rowCount : e.current?.columnCount) || 0), ae = Z(null), P = Z(null), C = Z(!1), z = Z(null), le = D((S) => n === Nt ? { rowIndex: 0, colIndex: S.colIndex } : { rowIndex: S.rowIndex, colIndex: 0 }, [n]), B = D((S) => n === Nt ? { rowIndex: t.current ? t.current.rowCount - 1 : 0, colIndex: S.colIndex } : { rowIndex: S.rowIndex, colIndex: t.current ? t.current.columnCount - 1 : 0 }, [n]), oe = (S) => {
1797
+ P.current = B(S), x(P.current, ae.current);
1798
+ }, ve = D((S, h) => {
1798
1799
  if (!e.current) return;
1799
- const ee = e.current.getViewFromClient(u, C)?.getCellCoordsFromClient(u, C);
1800
- return ee ? (n === Nt ? ee.rowIndex = t.current.getViewport().rowStart : ee.colIndex = t.current.getViewport().colStart, ee) : void 0;
1801
- }, []), U = O((u, C = !1) => {
1802
- let ee = u;
1803
- return C || (ee = { ...u }, n === cn ? delete ee.colIndex : delete ee.rowIndex), t.current?.scrollCellCoordsIntoView(ee);
1804
- }, [n]), H = T(a, [a]), X = T(s, [s]), k = Ee(() => ({ onPointerDown: (u) => {
1805
- if (!e || !e.current || u.nativeEvent.defaultPrevented) return;
1806
- const C = be(u.nativeEvent.clientX, u.nativeEvent.clientY);
1807
- if (!C) return;
1808
- u.nativeEvent.which;
1809
- const ee = u.nativeEvent.shiftKey, W = u.nativeEvent.ctrlKey || u.nativeEvent.metaKey;
1810
- if (d?.(u, C) === !1) return;
1811
- X?.(), _.current = !0;
1812
- const A = t.current?.getViewFromClient(u.nativeEvent.clientX, u.nativeEvent.clientY), q = ((N, xe) => n === Nt ? { ...N, rowIndex: xe.rowStart } : { ...N, colIndex: xe.colStart })(C, A.getVisibleRangeCoords());
1813
- if (ee) oe(C);
1800
+ const J = e.current.getViewFromClient(S, h)?.getCellCoordsFromClient(S, h);
1801
+ return J ? (n === Nt ? J.rowIndex = t.current.getViewport().rowStart : J.colIndex = t.current.getViewport().colStart, J) : void 0;
1802
+ }, []), N = D((S, h = !1) => {
1803
+ let J = S;
1804
+ return h || (J = { ...S }, n === an ? delete J.colIndex : delete J.rowIndex), t.current?.scrollCellCoordsIntoView(J);
1805
+ }, [n]), H = k(a, [a]), X = k(s, [s]), T = _e(() => ({ onPointerDown: (S) => {
1806
+ if (!e || !e.current || S.nativeEvent.defaultPrevented) return;
1807
+ const h = ve(S.nativeEvent.clientX, S.nativeEvent.clientY);
1808
+ if (!h) return;
1809
+ S.nativeEvent.which;
1810
+ const J = S.nativeEvent.shiftKey, K = S.nativeEvent.ctrlKey || S.nativeEvent.metaKey;
1811
+ if (d?.(S, h) === !1) return;
1812
+ X?.(), C.current = !0;
1813
+ const L = t.current?.getViewFromClient(S.nativeEvent.clientX, S.nativeEvent.clientY), U = ((ee, te) => n === Nt ? { ...ee, rowIndex: te.rowStart } : { ...ee, colIndex: te.colStart })(h, L.getVisibleRangeCoords());
1814
+ if (J) oe(h);
1814
1815
  else {
1815
- if (W) return ((N, xe = N, G) => {
1816
- ae.current = le(N), R.current = $(xe), E(ae.current, R.current, G);
1817
- })(C, C, q), void (l && U(q, !0));
1818
- ((N, xe = N, G) => {
1819
- ae.current = le(N), R.current = $(xe), f(ae.current, R.current, G);
1820
- })(C, C, q), oe(C), l && U(q, !0);
1821
- }
1822
- }, onPointerMoveOrWait: Ct.throttle((u) => {
1823
- if (!_.current || !e?.current) return;
1824
- const C = be(u.clientX, u.clientY);
1825
- if (C && g?.(u, C) !== !1) {
1826
- if (Z.isEqualCells(L.current, C)) return I();
1827
- oe(C), U(C);
1828
- }
1829
- }, 60), onPointerUp: (u) => {
1830
- _.current = !1, H?.(), m?.(u);
1831
- }, processTouch: !0, consumeTouch: !0 }), [r, l, M, i, I, d, m]);
1832
- return { onPointerDown: T(On(k), []), getCellCoordsFromClient: be };
1833
- }, Ye = (e, t, n) => {
1816
+ if (K) return ((ee, te = ee, Y) => {
1817
+ ae.current = le(ee), P.current = B(te), _(ae.current, P.current, Y);
1818
+ })(h, h, U), void (l && N(U, !0));
1819
+ ((ee, te = ee, Y) => {
1820
+ ae.current = le(ee), P.current = B(te), f(ae.current, P.current, Y);
1821
+ })(h, h, U), oe(h), l && N(U, !0);
1822
+ }
1823
+ }, onPointerMoveOrWait: Ct.throttle((S) => {
1824
+ if (!C.current || !e?.current) return;
1825
+ const h = ve(S.clientX, S.clientY);
1826
+ if (h && g?.(S, h) !== !1) {
1827
+ if (G.isEqualCells(z.current, h)) return I();
1828
+ oe(h), N(h);
1829
+ }
1830
+ }, 60), onPointerUp: (S) => {
1831
+ C.current = !1, H?.(), m?.(S);
1832
+ }, processTouch: !0, consumeTouch: !0 }), [r, l, R, i, I, d, m]);
1833
+ return { onPointerDown: k(On(T), []), getCellCoordsFromClient: ve };
1834
+ }, qe = (e, t, n) => {
1834
1835
  if (!e) return t;
1835
1836
  let o = t;
1836
1837
  const r = n === Ke || n === lt;
@@ -1852,27 +1853,27 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
1852
1853
  let { rowIndex: l, colIndex: s } = e;
1853
1854
  switch (o) {
1854
1855
  case lt: {
1855
- l = Ye(n, Math.min(l + 1, i), o);
1856
+ l = qe(n, Math.min(l + 1, i), o);
1856
1857
  let a = t({ rowIndex: l, colIndex: s });
1857
- for (; !a && l < i; ) l = Ye(n, Math.min(++l, i), o), a = t({ rowIndex: l, colIndex: s });
1858
+ for (; !a && l < i; ) l = qe(n, Math.min(++l, i), o), a = t({ rowIndex: l, colIndex: s });
1858
1859
  return l;
1859
1860
  }
1860
1861
  case it: {
1861
- l = Ye(n, Math.max(l - 1, i), o);
1862
+ l = qe(n, Math.max(l - 1, i), o);
1862
1863
  let a = t({ rowIndex: l, colIndex: s });
1863
- for (; !a && l > i; ) l = Ye(n, Math.max(--l, i), o), a = t({ rowIndex: l, colIndex: s });
1864
+ for (; !a && l > i; ) l = qe(n, Math.max(--l, i), o), a = t({ rowIndex: l, colIndex: s });
1864
1865
  return l;
1865
1866
  }
1866
1867
  case Ke: {
1867
- s = Ye(n, Math.min(s + 1, i), o);
1868
+ s = qe(n, Math.min(s + 1, i), o);
1868
1869
  let a = t({ rowIndex: l, colIndex: s });
1869
- for (; !a && s < i; ) s = Ye(n, Math.min(++s, i), o), a = t({ rowIndex: l, colIndex: s });
1870
+ for (; !a && s < i; ) s = qe(n, Math.min(++s, i), o), a = t({ rowIndex: l, colIndex: s });
1870
1871
  return s;
1871
1872
  }
1872
1873
  case ot: {
1873
- s = Ye(n, Math.max(s - 1, i), o);
1874
+ s = qe(n, Math.max(s - 1, i), o);
1874
1875
  let a = t({ rowIndex: l, colIndex: s });
1875
- for (; !a && s > i; ) s = Ye(n, Math.max(--s, i), o), a = t({ rowIndex: l, colIndex: s });
1876
+ for (; !a && s > i; ) s = qe(n, Math.max(--s, i), o), a = t({ rowIndex: l, colIndex: s });
1876
1877
  return s;
1877
1878
  }
1878
1879
  default:
@@ -1882,33 +1883,33 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
1882
1883
  let { rowIndex: l, colIndex: s } = e;
1883
1884
  switch (o) {
1884
1885
  case lt: {
1885
- l = Ye(n, Math.min(l + 1, i), o);
1886
+ l = qe(n, Math.min(l + 1, i), o);
1886
1887
  let a = t?.({ rowIndex: l, colIndex: s });
1887
- for (; a && l < i; ) l = Ye(n, Math.min(++l, i), o), a = t?.({ rowIndex: l, colIndex: s });
1888
+ for (; a && l < i; ) l = qe(n, Math.min(++l, i), o), a = t?.({ rowIndex: l, colIndex: s });
1888
1889
  return t?.({ rowIndex: l, colIndex: s }) ? l : l - 1;
1889
1890
  }
1890
1891
  case it: {
1891
- l = Ye(n, Math.max(l - 1, i), o);
1892
+ l = qe(n, Math.max(l - 1, i), o);
1892
1893
  let a = t?.({ rowIndex: l, colIndex: s });
1893
- for (; a && l > i; ) l = Ye(n, Math.max(--l, i), o), a = t?.({ rowIndex: l, colIndex: s });
1894
+ for (; a && l > i; ) l = qe(n, Math.max(--l, i), o), a = t?.({ rowIndex: l, colIndex: s });
1894
1895
  return t?.({ rowIndex: l, colIndex: s }) ? l : l + 1;
1895
1896
  }
1896
1897
  case Ke: {
1897
- s = Ye(n, Math.min(s + 1, i), o);
1898
+ s = qe(n, Math.min(s + 1, i), o);
1898
1899
  let a = t?.({ rowIndex: l, colIndex: s });
1899
- for (; a && s < i; ) s = Ye(n, Math.min(++s, i), o), a = t?.({ rowIndex: l, colIndex: s });
1900
+ for (; a && s < i; ) s = qe(n, Math.min(++s, i), o), a = t?.({ rowIndex: l, colIndex: s });
1900
1901
  return t?.({ rowIndex: l, colIndex: s }) ? s : s - 1;
1901
1902
  }
1902
1903
  case ot: {
1903
- s = Ye(n, Math.max(s - 1, i), o);
1904
+ s = qe(n, Math.max(s - 1, i), o);
1904
1905
  let a = t?.({ rowIndex: l, colIndex: s });
1905
- for (; a && s > i; ) s = Ye(n, Math.max(--s, i), o), a = t?.({ rowIndex: l, colIndex: s });
1906
+ for (; a && s > i; ) s = qe(n, Math.max(--s, i), o), a = t?.({ rowIndex: l, colIndex: s });
1906
1907
  return t?.({ rowIndex: l, colIndex: s }) ? s : s + 1;
1907
1908
  }
1908
1909
  default:
1909
1910
  return null;
1910
1911
  }
1911
- }, ql = (e, t, n, o, r, i) => {
1912
+ }, Kl = (e, t, n, o, r, i) => {
1912
1913
  if (!t) return i;
1913
1914
  let l, { rowIndex: s, colIndex: a } = e;
1914
1915
  o === lt ? l = { rowIndex: s + 1, colIndex: a } : o === it ? l = { rowIndex: s - 1, colIndex: a } : o === Ke ? l = { rowIndex: s, colIndex: a + 1 } : o === ot && (l = { rowIndex: s, colIndex: a - 1 });
@@ -1920,22 +1921,22 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
1920
1921
  let l = o;
1921
1922
  return e === "nearest" && (o - t > 0 ? e = "start" : n - r > 0 && (e = "end")), e === "start" ? l = t : e === "end" ? l = n - (r - o) : e === "center" && (l = t + (n - t) / 2 - (r - o) / 2), Math.max(0, Math.min(l, i - (r - o)));
1922
1923
  }, Ar = (e, t, n, o) => (console.log("todo: implement convertToVisibleRanges"), e), Xo = (e, t = Ke, n, o, r, i = null) => {
1923
- if (i && Z.isEqualSelectionCoords(i, e)) return e;
1924
+ if (i && G.isEqualSelectionCoords(i, e)) return e;
1924
1925
  const l = e.ranges[e.rangeIndex];
1925
- if (!Z.isRangesIntersect({ rowStart: e.cell.rowIndex, colStart: e.cell.colIndex, rowEnd: e.cell.rowIndex, colEnd: e.cell.colIndex }, l)) return e;
1926
+ if (!G.isRangesIntersect({ rowStart: e.cell.rowIndex, colStart: e.cell.colIndex, rowEnd: e.cell.rowIndex, colEnd: e.cell.colIndex }, l)) return e;
1926
1927
  let s = { ...e.cell }, a = e.rangeIndex;
1927
1928
  switch (t) {
1928
1929
  case Ke:
1929
- s.colIndex = Ye(r, s.colIndex + 1, t);
1930
+ s.colIndex = qe(r, s.colIndex + 1, t);
1930
1931
  break;
1931
1932
  case ot:
1932
- s.colIndex = Ye(r, s.colIndex - 1, t);
1933
+ s.colIndex = qe(r, s.colIndex - 1, t);
1933
1934
  break;
1934
1935
  case lt:
1935
- s.rowIndex = Ye(o, s.rowIndex + 1, t);
1936
+ s.rowIndex = qe(o, s.rowIndex + 1, t);
1936
1937
  break;
1937
1938
  case it:
1938
- s.rowIndex = Ye(o, s.rowIndex - 1, t);
1939
+ s.rowIndex = qe(o, s.rowIndex - 1, t);
1939
1940
  }
1940
1941
  const d = (f) => {
1941
1942
  if (f) {
@@ -1956,25 +1957,25 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
1956
1957
  let f = s.rowIndex, x = s.colIndex;
1957
1958
  switch (t) {
1958
1959
  case Ke:
1959
- x > l.colEnd && (f = Ye(o, f + 1, t), x = l.colStart, f > l.rowEnd && (f = l.rowStart));
1960
+ x > l.colEnd && (f = qe(o, f + 1, t), x = l.colStart, f > l.rowEnd && (f = l.rowStart));
1960
1961
  break;
1961
1962
  case ot:
1962
- x < l.colStart && (f = Ye(o, f - 1, t), x = l.colEnd, f < l.rowStart && (f = l.rowEnd));
1963
+ x < l.colStart && (f = qe(o, f - 1, t), x = l.colEnd, f < l.rowStart && (f = l.rowEnd));
1963
1964
  break;
1964
1965
  case lt:
1965
- f > l.rowEnd && (x = Ye(r, x + 1, t), f = l.rowStart, x > l.colEnd && (x = l.colStart));
1966
+ f > l.rowEnd && (x = qe(r, x + 1, t), f = l.rowStart, x > l.colEnd && (x = l.colStart));
1966
1967
  break;
1967
1968
  case it:
1968
- f < l.rowStart && (x = Ye(r, x - 1, t), f = l.rowEnd, x < l.colStart && (x = l.colEnd));
1969
+ f < l.rowStart && (x = qe(r, x - 1, t), f = l.rowEnd, x < l.colStart && (x = l.colEnd));
1969
1970
  }
1970
1971
  s = { rowIndex: f, colIndex: x };
1971
1972
  }
1972
1973
  let g = n(s);
1973
- if (!Z.isRangeWithinRange(g, l)) {
1974
- const f = Z.intersectRanges(g, l);
1974
+ if (!G.isRangeWithinRange(g, l)) {
1975
+ const f = G.intersectRanges(g, l);
1975
1976
  f && (g = f);
1976
1977
  }
1977
- let m = { rowStart: Ye(o, g.rowStart, lt), colStart: Ye(r, g.colStart, Ke), rowEnd: Ye(o, g.rowEnd, it), colEnd: Ye(r, g.colEnd, ot) };
1978
+ let m = { rowStart: qe(o, g.rowStart, lt), colStart: qe(r, g.colStart, Ke), rowEnd: qe(o, g.rowEnd, it), colEnd: qe(r, g.colEnd, ot) };
1978
1979
  if (m.rowStart !== s.rowIndex || m.colStart !== s.colIndex) {
1979
1980
  switch (t) {
1980
1981
  case Ke:
@@ -2017,36 +2018,36 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
2017
2018
  }, Fr = (e, t, n) => {
2018
2019
  const o = e.getColOffset(t.colStart) + (n?.left ?? 0), r = e.getRowOffset(t.rowStart) + (n?.top ?? 0);
2019
2020
  return { x: o, y: r, width: e.getColOffset(t.colEnd + 1) + (n?.right ?? 0) - (n?.left ?? 0) - o, height: e.getRowOffset(t.rowEnd + 1) + (n?.bottom ?? 0) - (n?.top ?? 0) - r };
2020
- }, Kl = (e, t, n) => !!n && !(e < n.x || e > n.x + n.width) && !(t < n.y || t > n.y + n.height), $o = (e, t = !0) => `M ${me.boundPixel(e.left)} ${me.boundPixel(e.top)} L ${me.boundPixel(e.right, !0)} ${me.boundPixel(e.top)} L ${me.boundPixel(e.right, !0)} ${me.boundPixel(e.bottom, !0)} L ${me.boundPixel(e.left)} ${me.boundPixel(e.bottom, !0)} L ${me.boundPixel(e.left)} ${me.boundPixel(e.top)} ${t ? "Z" : ""}`, jr = (e) => {
2021
+ }, ql = (e, t, n) => !!n && !(e < n.x || e > n.x + n.width) && !(t < n.y || t > n.y + n.height), $o = (e, t = !0) => `M ${we.boundPixel(e.left)} ${we.boundPixel(e.top)} L ${we.boundPixel(e.right, !0)} ${we.boundPixel(e.top)} L ${we.boundPixel(e.right, !0)} ${we.boundPixel(e.bottom, !0)} L ${we.boundPixel(e.left)} ${we.boundPixel(e.bottom, !0)} L ${we.boundPixel(e.left)} ${we.boundPixel(e.top)} ${t ? "Z" : ""}`, jr = (e) => {
2021
2022
  const { linePoints: t, bounds: n, pathProps: o, style: r, ...i } = e;
2022
- return Y("svg", { width: `${me.boundPixel(n.width, !0)}`, height: `${me.boundPixel(n.height, !0)}`, viewBox: `0 0 ${me.boundPixel(n.width, !0)} ${me.boundPixel(n.height, !0)}`, style: { position: "absolute", left: `${me.boundPixel(n.x)}px`, top: `${me.boundPixel(n.y)}px`, width: `${me.boundPixel(n.width, !0)}px`, height: `${me.boundPixel(n.height, !0)}px`, pointerEvents: "none", transitionTimingFunction: "linear", transitionDelay: "0", transitionProperty: "left, top, width, height", willChange: "left, top, width, height, stroke-dashoffset", ...r }, ...i, children: Y("path", { d: `M ${me.boundPixel(t[0])} ${me.boundPixel(t[1])} L ${me.boundPixel(t[2])} ${me.boundPixel(t[3])}`, fill: "none", vectorEffect: "non-scaling-stroke", stroke: "black", ...o }) });
2023
+ return q("svg", { width: `${we.boundPixel(n.width, !0)}`, height: `${we.boundPixel(n.height, !0)}`, viewBox: `0 0 ${we.boundPixel(n.width, !0)} ${we.boundPixel(n.height, !0)}`, style: { position: "absolute", left: `${we.boundPixel(n.x)}px`, top: `${we.boundPixel(n.y)}px`, width: `${we.boundPixel(n.width, !0)}px`, height: `${we.boundPixel(n.height, !0)}px`, pointerEvents: "none", transitionTimingFunction: "linear", transitionDelay: "0", transitionProperty: "left, top, width, height", willChange: "left, top, width, height, stroke-dashoffset", ...r }, ...i, children: q("path", { d: `M ${we.boundPixel(t[0])} ${we.boundPixel(t[1])} L ${we.boundPixel(t[2])} ${we.boundPixel(t[3])}`, fill: "none", vectorEffect: "non-scaling-stroke", stroke: "black", ...o }) });
2023
2024
  }, Yl = (e) => {
2024
- const { x: t = 0, y: n = 0, width: o = 0, height: r = 0, fill: i, stroke: l, strokeWidth: s = 0, strokeDasharray: a, strokeDashoffset: d, clipPath: g, pathBounds: m, pathProps: f, style: x, ...E } = e, I = n, M = t, ae = o, R = r;
2025
- let _ = null;
2025
+ const { x: t = 0, y: n = 0, width: o = 0, height: r = 0, fill: i, stroke: l, strokeWidth: s = 0, strokeDasharray: a, strokeDashoffset: d, clipPath: g, pathBounds: m, pathProps: f, style: x, ..._ } = e, I = n, R = t, ae = o, P = r;
2026
+ let C = null;
2026
2027
  if (i) {
2027
- let L = $o({ top: 0, left: 0, bottom: R, right: ae });
2028
- m && (L = L + " " + $o({ top: m.y - I, left: m.x - M, bottom: m.height + m.y - I, right: m.width + m.x - M })), _ = [Y("path", { d: L, fill: i, stroke: "none", fillRule: "evenodd" }, "fill")];
2028
+ let z = $o({ top: 0, left: 0, bottom: P, right: ae });
2029
+ m && (z = z + " " + $o({ top: m.y - I, left: m.x - R, bottom: m.height + m.y - I, right: m.width + m.x - R })), C = [q("path", { d: z, fill: i, stroke: "none", fillRule: "evenodd" }, "fill")];
2029
2030
  }
2030
- return Ht("svg", { width: `${me.boundPixel(o, !0)}`, height: `${me.boundPixel(r, !0)}`, viewBox: `0 0 ${me.boundPixel(o, !0)} ${me.boundPixel(r, !0)}`, preserveAspectRatio: "none", style: { position: "absolute", left: `${me.boundPixel(t)}px`, top: `${me.boundPixel(n)}px`, pointerEvents: "none", transitionDuration: "0ms", transitionTimingFunction: "linear", transitionDelay: "0", transitionProperty: "left, top, width, height", willChange: "left, top, width, height, stroke-dashoffset", boxShadow: "rgb(60 64 67 / 5%) 0px 1px 4px 2px, rgb(255 255 255 / 15%) 0px 0px 2px 1px", overflow: "visible", ...x }, ...E, children: [_, Y("path", { d: $o({ top: 0, left: 0, right: ae, bottom: R }), fill: "none", strokeDasharray: a, strokeDashoffset: d, stroke: l, vectorEffect: "non-scaling-stroke", strokeWidth: s, ...f })] });
2031
+ return Ht("svg", { width: `${we.boundPixel(o, !0)}`, height: `${we.boundPixel(r, !0)}`, viewBox: `0 0 ${we.boundPixel(o, !0)} ${we.boundPixel(r, !0)}`, preserveAspectRatio: "none", style: { position: "absolute", left: `${we.boundPixel(t)}px`, top: `${we.boundPixel(n)}px`, pointerEvents: "none", transitionDuration: "0ms", transitionTimingFunction: "linear", transitionDelay: "0", transitionProperty: "left, top, width, height", willChange: "left, top, width, height, stroke-dashoffset", boxShadow: "rgb(60 64 67 / 5%) 0px 1px 4px 2px, rgb(255 255 255 / 15%) 0px 0px 2px 1px", overflow: "visible", ...x }, ..._, children: [C, q("path", { d: $o({ top: 0, left: 0, right: ae, bottom: P }), fill: "none", strokeDasharray: a, strokeDashoffset: d, stroke: l, vectorEffect: "non-scaling-stroke", strokeWidth: s, ...f })] });
2031
2032
  }, Xl = (e) => {
2032
2033
  const { key: t, ...n } = e;
2033
- return Y(yi, { ...n }, t);
2034
- }, yi = Dt((e) => {
2035
- const { stroke: t, fill: n, x: o = 0, y: r = 0, width: i = 0, height: l = 0, style: s, isAnimatedStroke: a, animatedStrokeProps: d, range: g, cell: m, ...f } = e, x = a || !!d, E = { name: "walking-offset", dashGap: 2, speed: 50, dashLength: 8, ...d };
2036
- let I = E.dashGap + E.dashLength;
2037
- const M = E.speed * I, ae = $l().replaceAll(":", ""), R = `${E.name}-${ae}`;
2038
- let _;
2034
+ return q(yi, { ...n }, t);
2035
+ }, yi = At((e) => {
2036
+ const { stroke: t, fill: n, x: o = 0, y: r = 0, width: i = 0, height: l = 0, style: s, isAnimatedStroke: a, animatedStrokeProps: d, range: g, cell: m, ...f } = e, x = a || !!d, _ = { name: "walking-offset", dashGap: 2, speed: 50, dashLength: 8, ...d };
2037
+ let I = _.dashGap + _.dashLength;
2038
+ const R = _.speed * I, ae = $l().replaceAll(":", ""), P = `${_.name}-${ae}`;
2039
+ let C;
2039
2040
  return st(() => {
2040
2041
  if (!x) return;
2041
- const L = `@keyframes ${R} {
2042
+ const z = `@keyframes ${P} {
2042
2043
  to {
2043
2044
  stroke-dashoffset: 0px;
2044
2045
  }
2045
2046
  }`, le = document.createElement("style");
2046
- return le.appendChild(document.createTextNode(L)), document.head.appendChild(le), le.sheet.insertRule(L, 0), () => {
2047
+ return le.appendChild(document.createTextNode(z)), document.head.appendChild(le), le.sheet.insertRule(z, 0), () => {
2047
2048
  document.head.removeChild(le);
2048
2049
  };
2049
- }, [x]), x && (_ = { strokeDasharray: `${E.dashLength}px ${E.dashGap}px`, strokeDashoffset: `${I}px`, animation: `${R} ${M}ms linear infinite`, willChange: "stroke-dashoffset" }), Y(Yl, { x: o, y: r, width: i, height: l, stroke: t, fill: n, shapeRendering: "crispEdges", style: { ..._, ...s }, ...f });
2050
+ }, [x]), x && (C = { strokeDasharray: `${_.dashLength}px ${_.dashGap}px`, strokeDashoffset: `${I}px`, animation: `${P} ${R}ms linear infinite`, willChange: "stroke-dashoffset" }), q(Yl, { x: o, y: r, width: i, height: l, stroke: t, fill: n, shapeRendering: "crispEdges", style: { ...C, ...s }, ...f });
2050
2051
  });
2051
2052
  function bi(e) {
2052
2053
  var t, n, o = "";
@@ -2062,10 +2063,10 @@ function En() {
2062
2063
  return o;
2063
2064
  }
2064
2065
  yi.displayName = "Selection";
2065
- const Si = Dt(Ut((e, t) => {
2066
+ const Si = At(Ut((e, t) => {
2066
2067
  const { x: n = 0, y: o = 0, borderWidth: r = 1, size: i = 6, borderStroke: l, corner: s, style: a, className: d, background: g, ...m } = e;
2067
2068
  if (n === 0 || o === 0) return null;
2068
- let f = !0, x = !0, E = !0, I = !0;
2069
+ let f = !0, x = !0, _ = !0, I = !0;
2069
2070
  switch (s) {
2070
2071
  case "tl":
2071
2072
  f = !1, x = !1;
@@ -2074,22 +2075,22 @@ const Si = Dt(Ut((e, t) => {
2074
2075
  f = !1, I = !1;
2075
2076
  break;
2076
2077
  case "br":
2077
- E = !1, I = !1;
2078
+ _ = !1, I = !1;
2078
2079
  break;
2079
2080
  case "tr":
2080
- x = !1, E = !1;
2081
+ x = !1, _ = !1;
2081
2082
  }
2082
- return Y("div", { className: En("fill-handle", d), style: { position: "absolute", left: n - (i + (f ? r : 0)) / 2, top: o - (i + (x ? r : 0)) / 2, width: i, height: i, borderLeft: f ? `${r}px ${l}` : void 0, borderTop: x ? `${r}px ${l}` : void 0, borderRight: E ? `${r}px ${l}` : void 0, borderBottom: I ? `${r}px ${l}` : void 0, background: g, cursor: "crosshair", pointerEvents: "all", transitionDuration: "0ms", transitionTimingFunction: "linear", transitionDelay: "0", transitionProperty: "left, top", willChange: "left, top", ...a }, tabIndex: -1, ...m });
2083
+ return q("div", { className: En("fill-handle", d), style: { position: "absolute", left: n - (i + (f ? r : 0)) / 2, top: o - (i + (x ? r : 0)) / 2, width: i, height: i, borderLeft: f ? `${r}px ${l}` : void 0, borderTop: x ? `${r}px ${l}` : void 0, borderRight: _ ? `${r}px ${l}` : void 0, borderBottom: I ? `${r}px ${l}` : void 0, background: g, cursor: "crosshair", pointerEvents: "all", transitionDuration: "0ms", transitionTimingFunction: "linear", transitionDelay: "0", transitionProperty: "left, top", willChange: "left, top", ...a }, tabIndex: -1, ...m });
2083
2084
  }));
2084
2085
  Si.displayName = "FillHandle";
2085
2086
  var Gl = function() {
2086
- }, Ei = typeof window < "u", Zl = Ei ? nn : st, Vr = { x: 0, y: 0, width: 0, height: 0, top: 0, left: 0, bottom: 0, right: 0 };
2087
+ }, Ei = typeof window < "u", Zl = Ei ? tn : st, Vr = { x: 0, y: 0, width: 0, height: 0, top: 0, left: 0, bottom: 0, right: 0 };
2087
2088
  const _i = Ei && window.ResizeObserver !== void 0 ? function() {
2088
- var e = Je(null), t = e[0], n = e[1], o = Je(Vr), r = o[0], i = o[1], l = Ee(function() {
2089
+ var e = Ze(null), t = e[0], n = e[1], o = Ze(Vr), r = o[0], i = o[1], l = _e(function() {
2089
2090
  return new window.ResizeObserver(function(s) {
2090
2091
  if (s[0]) {
2091
- var a = s[0].contentRect, d = a.x, g = a.y, m = a.width, f = a.height, x = a.top, E = a.left, I = a.bottom, M = a.right;
2092
- i({ x: d, y: g, width: m, height: f, top: x, left: E, bottom: I, right: M });
2092
+ var a = s[0].contentRect, d = a.x, g = a.y, m = a.width, f = a.height, x = a.top, _ = a.left, I = a.bottom, R = a.right;
2093
+ i({ x: d, y: g, width: m, height: f, top: x, left: _, bottom: I, right: R });
2093
2094
  }
2094
2095
  });
2095
2096
  }, []);
@@ -2105,7 +2106,7 @@ function Bo(e, t) {
2105
2106
  if (typeof e == "function") return e(t);
2106
2107
  e && (e.current = t);
2107
2108
  }
2108
- var Jl = parseInt(qr.split(".")[0], 10) >= 19 ? function(e) {
2109
+ var Jl = parseInt(Kr.split(".")[0], 10) >= 19 ? function(e) {
2109
2110
  return (t) => {
2110
2111
  const n = [];
2111
2112
  for (const o of e) {
@@ -2121,315 +2122,315 @@ var Jl = parseInt(qr.split(".")[0], 10) >= 19 ? function(e) {
2121
2122
  for (const n of e) Bo(n, t);
2122
2123
  };
2123
2124
  };
2124
- const Go = Dt(Ut((e, t) => {
2125
- const { range: n, view: o, anchor: r, borderStroke: i = "rgb(33, 115, 70)", background: l = "white", borderWidth: s = 1.5, size: a = 22, style: d, className: g, selectionTouchPointerHandler: m, onTouchSelectStart: f, onTouchSelectEnd: x, currentTouchAnchor: E, scrollableElement: I, scrollableRoot: M = document.body, ...ae } = e, R = T(f, [f]), _ = T(x, [x]), { bounds: L, coordsPivot: le, key: $ } = Ee(() => {
2125
+ const Go = At(Ut((e, t) => {
2126
+ const { range: n, view: o, anchor: r, borderStroke: i = "rgb(33, 115, 70)", background: l = "white", borderWidth: s = 1.5, size: a = 22, style: d, className: g, selectionTouchPointerHandler: m, onTouchSelectStart: f, onTouchSelectEnd: x, currentTouchAnchor: _, scrollableElement: I, scrollableRoot: R = document.body, ...ae } = e, P = k(f, [f]), C = k(x, [x]), { bounds: z, coordsPivot: le, key: B } = _e(() => {
2126
2127
  if (!n || !o) return null;
2127
- let W = null, A = null;
2128
+ let K = null, L = null;
2128
2129
  switch (r) {
2129
2130
  case "tl":
2130
- W = { colIndex: n.colEnd, rowIndex: n.rowEnd }, A = { colIndex: n.colStart, rowIndex: n.rowStart };
2131
+ K = { colIndex: n.colEnd, rowIndex: n.rowEnd }, L = { colIndex: n.colStart, rowIndex: n.rowStart };
2131
2132
  break;
2132
2133
  case "br":
2133
- W = { colIndex: n.colStart, rowIndex: n.rowStart }, A = { colIndex: n.colEnd, rowIndex: n.rowEnd };
2134
+ K = { colIndex: n.colStart, rowIndex: n.rowStart }, L = { colIndex: n.colEnd, rowIndex: n.rowEnd };
2134
2135
  break;
2135
2136
  case "t":
2136
2137
  case "l":
2137
- W = { colIndex: n.colEnd, rowIndex: n.rowEnd };
2138
+ K = { colIndex: n.colEnd, rowIndex: n.rowEnd };
2138
2139
  break;
2139
2140
  case "b":
2140
- W = { colIndex: n.colStart, rowIndex: n.rowStart };
2141
+ K = { colIndex: n.colStart, rowIndex: n.rowStart };
2141
2142
  break;
2142
2143
  case "r":
2143
- W = { colIndex: n.colStart, rowIndex: n.rowEnd };
2144
+ K = { colIndex: n.colStart, rowIndex: n.rowEnd };
2144
2145
  }
2145
- let q = o.getRangeCoordsBounds(A ? { rowStart: A.rowIndex, colStart: A.colIndex, rowEnd: A.rowIndex, colEnd: A.colIndex } : n);
2146
- const N = o.getBounds(), xe = o.getViewportSize(), G = N.x, He = N.y, Ue = xe.width, We = xe.height;
2146
+ let U = o.getRangeCoordsBounds(L ? { rowStart: L.rowIndex, colStart: L.colIndex, rowEnd: L.rowIndex, colEnd: L.colIndex } : n);
2147
+ const ee = o.getBounds(), te = o.getViewportSize(), Y = ee.x, He = ee.y, je = te.width, Ne = te.height;
2147
2148
  switch (r) {
2148
2149
  case "tl":
2149
2150
  break;
2150
2151
  case "br":
2151
- q.x = q.x + q.width, q.y = q.y + q.height;
2152
+ U.x = U.x + U.width, U.y = U.y + U.height;
2152
2153
  break;
2153
2154
  case "t":
2154
- q.x = Ue / 2 - G;
2155
+ U.x = je / 2 - Y;
2155
2156
  break;
2156
2157
  case "b":
2157
- q.x = Ue / 2 - G, q.y = q.y + q.height;
2158
+ U.x = je / 2 - Y, U.y = U.y + U.height;
2158
2159
  break;
2159
2160
  case "l":
2160
- q.y = We / 2 - He;
2161
+ U.y = Ne / 2 - He;
2161
2162
  break;
2162
2163
  case "r":
2163
- q.x = q.x + q.width, q.y = We / 2 - He;
2164
- }
2165
- const ht = o.toClipBounds(q, 0);
2166
- return !ht || ht.width <= 0 || ht.height <= 0 || q.x < 0 || q.y < 0 || q.x > Ue || q.y > We ? { bounds: null, coordsAnchor: null, coordsPivot: null, key: null } : { bounds: q, coordsAnchor: null, coordsPivot: W, key: "touchSelect-" + o.getAnchor() + "-" + r };
2167
- }, [n, o, r]), oe = J(null), be = On(Ee(() => {
2168
- const W = (A) => r === "t" || r === "b" ? { ...A, colIndex: void 0 } : r === "l" || r === "r" ? { ...A, rowIndex: void 0 } : A;
2169
- return { processTouch: !0, consumeTouch: !0, onPointerDown: (A, q) => {
2170
- const N = W(o.getCellCoordsFromClient(A.clientX, A.clientY));
2171
- return oe.current = { coordsPivot: le }, R?.(r), m.onSelectionPointerDown(A, q, o, N, le, !1, !0);
2172
- }, onPointerMoveOrWait: (A, q, N) => {
2173
- const xe = W(o.getCellCoordsFromClient(A.clientX, A.clientY));
2174
- return m.onSelectionPointerMoveOrWait(A, q, N, o, xe, oe.current?.coordsPivot, !0, !0);
2175
- }, onPointerUp: (A, q, N) => (oe.current = null, _?.(r), m.onPointerUp(A, q, N)) };
2176
- }, [m, n, o, r])), [U, { y: H, x: X }] = _i(), k = J(null), { getPortalContainer: u } = gi(), [C, ee] = Je(null);
2164
+ U.x = U.x + U.width, U.y = Ne / 2 - He;
2165
+ }
2166
+ const at = o.toClipBounds(U, 0);
2167
+ return !at || at.width <= 0 || at.height <= 0 || U.x < 0 || U.y < 0 || U.x > je || U.y > Ne ? { bounds: null, coordsAnchor: null, coordsPivot: null, key: null } : { bounds: U, coordsAnchor: null, coordsPivot: K, key: "touchSelect-" + o.getAnchor() + "-" + r };
2168
+ }, [n, o, r]), oe = Z(null), ve = On(_e(() => {
2169
+ const K = (L) => r === "t" || r === "b" ? { ...L, colIndex: void 0 } : r === "l" || r === "r" ? { ...L, rowIndex: void 0 } : L;
2170
+ return { processTouch: !0, consumeTouch: !0, onPointerDown: (L, U) => {
2171
+ const ee = K(o.getCellCoordsFromClient(L.clientX, L.clientY));
2172
+ return oe.current = { coordsPivot: le }, P?.(r), m.onSelectionPointerDown(L, U, o, ee, le, !1, !0);
2173
+ }, onPointerMoveOrWait: (L, U, ee) => {
2174
+ const te = K(o.getCellCoordsFromClient(L.clientX, L.clientY));
2175
+ return m.onSelectionPointerMoveOrWait(L, U, ee, o, te, oe.current?.coordsPivot, !0, !0);
2176
+ }, onPointerUp: (L, U, ee) => (oe.current = null, C?.(r), m.onPointerUp(L, U, ee)) };
2177
+ }, [m, n, o, r])), [N, { y: H, x: X }] = _i(), T = Z(null), { getPortalContainer: S } = gi(), [h, J] = Ze(null);
2177
2178
  return st(() => {
2178
- const W = k.current?.getBoundingClientRect();
2179
- if (!W || !L) return void ee(null);
2180
- let A = 0, q = 0, N = I;
2181
- for (; N; ) A += N.scrollLeft, q += N.scrollTop, N = M && N === M.parentElement ? null : N.parentElement;
2182
- ee(Kr(Y("div", { className: En("touch-select-handle", g), ref: t, style: { position: "absolute", left: A + (W?.x ?? 0) - (a + s) / 2, top: q + (W?.y ?? 0) - (a + s) / 2, width: a, height: a, borderWidth: `${s}px`, border: i, borderRadius: "50%", background: l, boxShadow: `0 0 0 1.5px ${l}`, cursor: "grab", pointerEvents: "all", opacity: E ? 0 : 1, transitionDuration: "160ms", transitionProperty: "opacity", ...d }, tabIndex: -1, onPointerDown: be, ...ae }), M ?? u(), $));
2183
- }, [H, X, L?.x, L?.y, L?.width, L?.height, g, E, l, a, s, i, I]), L ? Ht(wn, { children: [Y("div", { ref: Jl([U, k]), style: { position: "absolute", left: L.x, top: L.y, opacity: 0 } }), C] }) : null;
2179
+ const K = T.current?.getBoundingClientRect();
2180
+ if (!K || !z) return void J(null);
2181
+ let L = 0, U = 0, ee = I;
2182
+ for (; ee; ) L += ee.scrollLeft, U += ee.scrollTop, ee = R && ee === R.parentElement ? null : ee.parentElement;
2183
+ J(qr(q("div", { className: En("touch-select-handle", g), ref: t, style: { position: "absolute", left: L + (K?.x ?? 0) - (a + s) / 2, top: U + (K?.y ?? 0) - (a + s) / 2, width: a, height: a, borderWidth: `${s}px`, border: i, borderRadius: "50%", background: l, boxShadow: `0 0 0 1.5px ${l}`, cursor: "grab", pointerEvents: "all", opacity: _ ? 0 : 1, transitionDuration: "160ms", transitionProperty: "opacity", ...d }, tabIndex: -1, onPointerDown: ve, ...ae }), R ?? S(), B));
2184
+ }, [H, X, z?.x, z?.y, z?.width, z?.height, g, _, l, a, s, i, I]), z ? Ht(wn, { children: [q("div", { ref: Jl([N, T]), style: { position: "absolute", left: z.x, top: z.y, opacity: 0 } }), h] }) : null;
2184
2185
  }));
2185
2186
  Go.displayName = "TouchSelectHandle";
2186
- const tn = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd: 0 }), Ii = Object.freeze({ colIndex: 0, rowIndex: 0 }), Zo = Object.freeze([]), Yt = (e) => {
2187
+ const en = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd: 0 }), Ii = Object.freeze({ colIndex: 0, rowIndex: 0 }), Zo = Object.freeze([]), Yt = (e) => {
2187
2188
  if (e && e.cell && e.ranges && e.rangeIndex > -1 && e.rangeIndex <= e.ranges.length) return e;
2188
2189
  const t = { cell: null, ranges: e?.ranges ?? Zo };
2189
- return t.rangeIndex = e?.rangeIndex ?? t.ranges.length - 1, t.cell = e?.cell, !t.cell && t.ranges.length > 0 && (t.cell = { rowIndex: t.ranges[t.rangeIndex].rowStart, colIndex: t.ranges[t.rangeIndex].colStart }), t.cell || (t.cell = Ii), Z.isEqualSelectionCoords(t, e) ? e : t;
2190
+ return t.rangeIndex = e?.rangeIndex ?? t.ranges.length - 1, t.cell = e?.cell, !t.cell && t.ranges.length > 0 && (t.cell = { rowIndex: t.ranges[t.rangeIndex].rowStart, colIndex: t.ranges[t.rangeIndex].colStart }), t.cell || (t.cell = Ii), G.isEqualSelectionCoords(t, e) ? e : t;
2190
2191
  }, lo = (e, t, n) => {
2191
2192
  const o = e.getVisibleRangeCoords(), r = e.getScrollOrientation();
2192
2193
  !r.horizontal && (t.colIndex > o.colEnd || t.colIndex < o.colStart) && (t = { ...t, colIndex: t.colIndex > o.colEnd ? o.colEnd + 1 : o.colEnd - 1 }, e = n.current.getViewFromLocation(Xt)), !r.vertical && (t.rowIndex > o.rowEnd || t.rowIndex < o.rowStart) && (t = { ...t, rowIndex: t.rowIndex > o.rowEnd ? o.rowEnd + 1 : o.rowEnd - 1 }, e = n.current.getViewFromLocation(Xt)), e.scrollCellCoordsIntoView(t);
2193
- }, es = () => !1, ms = ({ gridRef: e, commands: t, layout: n, selection: o, onSelectionChange: r, onSelectionDragStart: i, onSelectionDragEnd: l, selectionPolicy: s = "multiple", newSelectionMode: a = "clear", allowDeselectSelection: d = !0, onFillPreview: g, onFillCancel: m, onFillDone: f, onFill: x, disableFillDrag: E = !x, fillHandleBorderColor: I = "white", hiddenRowsAt: M, hiddenColumnsAt: ae, isContentfulCell: R, contentfulCellFinder: _ = ql, getDataCoords: L, alwaysScrollToActiveCoords: le = !1, selectionBounds: $, pointerDownInterceptor: oe, pointerMoveInterceptor: be, mergedRanges: U, canSelectionSpanMergedCells: H = es, onMoveDragStart: X, onMoveDragUpdate: k, onMoveDragEnd: u, onMoveDragDone: C, selectionRenderer: ee = Xl, disableMoveDrag: W = !u, getCellCoordsAsRangeCoords: A = Z.cellToRange, moveDragHitSize: q = 6, moveDragOutlineSize: N = 4, selectionBackgroundColor: xe = "rgba(16, 124, 65, 0.1)", selectionBorderColor: G = "rgb(33, 115, 70)", selectionRemoveBorderColor: He = "rgb(255, 0, 0)", selectionRemoveBackgroundColor: Ue = "rgba(250, 10, 10, 0.1)", disableTouchSelection: We = !1, touchSelectHandleProps: ht }) => {
2194
- const _e = O(() => ({ top: $?.top ?? 0, left: $?.left ?? 0, bottom: e.current?.rowCount - 1 || 0, right: e.current?.columnCount - 1 || 0 }), []), S = T(x, [x]), ue = T(g, [g]), K = T(m, [m]), pe = T(f, [f]), te = T(R, [R]), Re = T(ee, [ee]), at = T((c, h = !1) => go(c, h, n.getRowOffset, h ? _e().bottom : _e().top), [n?.getRowOffset]), pt = T(M ?? at, [M]), zt = T((c, h = !1) => go(c, h, n.getColOffset, h ? _e().right : _e().left), [n?.getColOffset]), gt = T(ae ?? zt, [ae]), [Zt, Be] = Je(() => Yt(o)), z = Ee(() => Yt(Zt), [Zt]), ke = J(z), Qe = J(!0);
2195
- nn(Ct.throttle(() => {
2196
- Be((c) => {
2197
- Qe.current = !0;
2198
- const h = Yt(o);
2199
- return Z.isEqualSelectionCoords(h, c) ? c : h;
2194
+ }, es = () => !1, ms = ({ gridRef: e, commands: t, layout: n, selection: o, onSelectionChange: r, onSelectionDragStart: i, onSelectionDragEnd: l, selectionPolicy: s = "multiple", newSelectionMode: a = "clear", allowDeselectSelection: d = !0, onFillPreview: g, onFillCancel: m, onFillDone: f, onFill: x, disableFillDrag: _ = !x, fillHandleBorderColor: I = "white", hiddenRowsAt: R, hiddenColumnsAt: ae, isContentfulCell: P, contentfulCellFinder: C = Kl, getDataCoords: z, alwaysScrollToActiveCoords: le = !1, selectionBounds: B, pointerDownInterceptor: oe, pointerMoveInterceptor: ve, mergedRanges: N, canSelectionSpanMergedCells: H = es, onMoveDragStart: X, onMoveDragUpdate: T, onMoveDragEnd: S, onMoveDragDone: h, selectionRenderer: J = Xl, disableMoveDrag: K = !S, getCellCoordsAsRangeCoords: L = G.cellToRange, moveDragHitSize: U = 6, moveDragOutlineSize: ee = 4, selectionBackgroundColor: te = "rgba(16, 124, 65, 0.1)", selectionBorderColor: Y = "rgb(33, 115, 70)", selectionRemoveBorderColor: He = "rgb(255, 0, 0)", selectionRemoveBackgroundColor: je = "rgba(250, 10, 10, 0.1)", disableTouchSelection: Ne = !1, touchSelectHandleProps: at }) => {
2195
+ const Se = D(() => ({ top: B?.top ?? 0, left: B?.left ?? 0, bottom: e.current?.rowCount - 1 || 0, right: e.current?.columnCount - 1 || 0 }), []), Ye = k(x, [x]), $ = k(g, [g]), E = k(m, [m]), Me = k(f, [f]), ue = k(P, [P]), me = k(J, [J]), Ve = k((c, u = !1) => go(c, u, n.getRowOffset, u ? Se().bottom : Se().top), [n?.getRowOffset]), dt = k(R ?? Ve, [R]), kt = k((c, u = !1) => go(c, u, n.getColOffset, u ? Se().right : Se().left), [n?.getColOffset]), ut = k(ae ?? kt, [ae]), [Zt, St] = Ze(() => Yt(o)), M = _e(() => Yt(Zt), [Zt]), ye = Z(M), Je = Z(!0);
2196
+ tn(Ct.throttle(() => {
2197
+ St((c) => {
2198
+ Je.current = !0;
2199
+ const u = Yt(o);
2200
+ return G.isEqualSelectionCoords(u, c) ? c : u;
2200
2201
  });
2201
- }, 0), [o]), nn(() => {
2202
- ke.current = z;
2203
- }, [z]), st(() => {
2204
- Qe.current || !r || Z.isEqualSelectionCoords(o, z) || r(z);
2205
- }, [z]);
2206
- const Xe = O((c) => {
2207
- Be((h) => {
2208
- Qe.current = !1, h = Yt(h);
2209
- let w = typeof c == "function" ? c(h.ranges) : c ?? Zo;
2210
- if (Z.isEqualRangesArrays(w, h.ranges)) return h;
2211
- let p = Math.max(w.length ? 0 : -1, Math.min(h.rangeIndex, w.length - 1)), y = h.cell;
2212
- p === -1 || Z.isCellWithinRange(y, w[p]) || (y = { rowIndex: w[p].rowStart, colIndex: w[p].colStart }), w.length === 1 && Z.isSingleCell(w[0]) && Z.isCellWithinRange(y, w[0]) && (w = [], p = -1);
2213
- const V = { cell: y, ranges: w, rangeIndex: p };
2214
- return Z.isEqualSelectionCoords(V, h) ? h : V;
2202
+ }, 0), [o]), tn(() => {
2203
+ ye.current = M;
2204
+ }, [M]), st(() => {
2205
+ Je.current || !r || G.isEqualSelectionCoords(o, M) || r(M);
2206
+ }, [M]);
2207
+ const mt = D((c) => {
2208
+ St((u) => {
2209
+ Je.current = !1, u = Yt(u);
2210
+ let w = typeof c == "function" ? c(u.ranges) : c ?? Zo;
2211
+ if (G.isEqualRangesArrays(w, u.ranges)) return u;
2212
+ let p = Math.max(w.length ? 0 : -1, Math.min(u.rangeIndex, w.length - 1)), y = u.cell;
2213
+ p === -1 || G.isCellWithinRange(y, w[p]) || (y = { rowIndex: w[p].rowStart, colIndex: w[p].colStart }), w.length === 1 && G.isSingleCell(w[0]) && G.isCellWithinRange(y, w[0]) && (w = [], p = -1);
2214
+ const W = { cell: y, ranges: w, rangeIndex: p };
2215
+ return G.isEqualSelectionCoords(W, u) ? u : W;
2215
2216
  });
2216
- }, []), wt = T((c) => {
2217
- Be((h) => {
2218
- Qe.current = !1, h = Yt(h);
2219
- const w = c ?? Ii, p = A(w);
2220
- if (!Z.isSingleCell(p) && h.ranges.length === 0) return { ranges: [p], rangeIndex: 0, cell: w };
2221
- if (Z.isEqualCells(w, h.cell)) return h;
2222
- let y = h.ranges, V = h.rangeIndex;
2223
- h.ranges.length === 1 && (Z.isSingleCell(h.ranges[0]) && Z.isCellWithinRange(w, h.ranges[0]) || !Z.isCellWithinRange(w, h.ranges[0])) && (y = [], V = -1);
2224
- const b = { ranges: y, rangeIndex: V, cell: w };
2225
- return Z.isEqualSelectionCoords(b, h) ? h : b;
2217
+ }, []), Qe = k((c) => {
2218
+ St((u) => {
2219
+ Je.current = !1, u = Yt(u);
2220
+ const w = c ?? Ii, p = L(w);
2221
+ if (!G.isSingleCell(p) && u.ranges.length === 0) return { ranges: [p], rangeIndex: 0, cell: w };
2222
+ if (G.isEqualCells(w, u.cell)) return u;
2223
+ let y = u.ranges, W = u.rangeIndex;
2224
+ u.ranges.length === 1 && (G.isSingleCell(u.ranges[0]) && G.isCellWithinRange(w, u.ranges[0]) || !G.isCellWithinRange(w, u.ranges[0])) && (y = [], W = -1);
2225
+ const b = { ranges: y, rangeIndex: W, cell: w };
2226
+ return G.isEqualSelectionCoords(b, u) ? u : b;
2226
2227
  });
2227
- }, [A]), [an, Jt] = Je(null), [jt, dn] = Je(null), on = J(null), [ze, qt] = Je(null), vt = J(null), Vt = J(null), [Cn, un] = Je(null), Ne = J(null), Q = J(null), et = J(U);
2228
+ }, [L]), [cn, on] = Ze(null), [Mt, dn] = Ze(null), nn = Z(null), [De, Kt] = Ze(null), xt = Z(null), Vt = Z(null), [Cn, un] = Ze(null), We = Z(null), Q = Z(null), et = Z(N);
2228
2229
  st(() => {
2229
- et.current = U;
2230
- }, [U]);
2231
- const qe = T((c, h = { inline: "nearest", block: "nearest" }) => {
2230
+ et.current = N;
2231
+ }, [N]);
2232
+ const Ue = k((c, u = { inline: "nearest", block: "nearest" }) => {
2232
2233
  let { rowIndex: w, colIndex: p } = c;
2233
- w === void 0 && z?.cell && (w = z.cell.rowIndex), p === void 0 && z?.cell && (p = z.cell.colIndex), w !== void 0 && p !== void 0 && e.current?.scrollCellCoordsIntoView({ rowIndex: w, colIndex: p }, h);
2234
- }, [z]), dt = O((c) => {
2235
- const h = _e();
2236
- return c.rowIndex < h.top || c.colIndex < h.left || c.colIndex > h.right || c.rowIndex > h.bottom;
2237
- }, []), Ie = T((c, h) => {
2234
+ w === void 0 && M?.cell && (w = M.cell.rowIndex), p === void 0 && M?.cell && (p = M.cell.colIndex), w !== void 0 && p !== void 0 && e.current?.scrollCellCoordsIntoView({ rowIndex: w, colIndex: p }, u);
2235
+ }, [M]), ht = D((c) => {
2236
+ const u = Se();
2237
+ return c.rowIndex < u.top || c.colIndex < u.left || c.colIndex > u.right || c.rowIndex > u.bottom;
2238
+ }, []), Ie = k((c, u) => {
2238
2239
  if (!e?.current) return null;
2239
- const w = { rowStart: Math.min(c.rowIndex, h.rowIndex), colStart: Math.min(c.colIndex, h.colIndex), rowEnd: Math.max(c.rowIndex, h.rowIndex), colEnd: Math.max(c.colIndex, h.colIndex) };
2240
+ const w = { rowStart: Math.min(c.rowIndex, u.rowIndex), colStart: Math.min(c.colIndex, u.colIndex), rowEnd: Math.max(c.rowIndex, u.rowIndex), colEnd: Math.max(c.colIndex, u.colIndex) };
2240
2241
  if (H?.(w)) return w;
2241
- const y = A(c), V = A(h), b = { rowStart: Math.min(y.rowStart, V.rowStart), colStart: Math.min(y.colStart, V.colStart), rowEnd: Math.max(y.rowEnd, V.rowEnd), colEnd: Math.max(y.colEnd, V.colEnd) };
2242
+ const y = L(c), W = L(u), b = { rowStart: Math.min(y.rowStart, W.rowStart), colStart: Math.min(y.colStart, W.colStart), rowEnd: Math.max(y.rowEnd, W.rowEnd), colEnd: Math.max(y.colEnd, W.colEnd) };
2242
2243
  let he;
2243
- return typeof et.current == "function" ? he = et.current(b) : U && (he = U), he ? Z.extendRangeToUnionRanges(b, he) : b;
2244
- }, [H, A]), Le = T((c, h, w) => {
2245
- const p = c.ranges.length > 0 ? c.ranges[c.rangeIndex] : { rowStart: c.cell.rowIndex, colStart: c.cell.colIndex, rowEnd: c.cell.rowIndex, colEnd: c.cell.colIndex }, y = { rowStart: Math.min(h.rowIndex ?? p.rowStart, w.rowIndex ?? p.rowStart), colStart: Math.min(h.colIndex ?? p.colStart, w.colIndex ?? p.colStart), rowEnd: Math.max(h.rowIndex ?? p.rowEnd, w.rowIndex ?? p.rowEnd), colEnd: Math.max(h.colIndex ?? p.colEnd, w.colIndex ?? p.colEnd) }, V = { rowIndex: y.rowStart, colIndex: y.colStart }, b = { rowIndex: y.rowEnd, colIndex: y.colEnd };
2246
- if (!(dt(V) || dt(b)))
2247
- return Ie(V, b);
2248
- }, [Ie]), rt = T((c, h, w) => {
2249
- if (s === "single" || !ke.current) return;
2250
- const p = Le(ke.current, c, h ?? ke.current.cell);
2244
+ return typeof et.current == "function" ? he = et.current(b) : N && (he = N), he ? G.extendRangeToUnionRanges(b, he) : b;
2245
+ }, [H, L]), Oe = k((c, u, w) => {
2246
+ const p = c.ranges.length > 0 ? c.ranges[c.rangeIndex] : { rowStart: c.cell.rowIndex, colStart: c.cell.colIndex, rowEnd: c.cell.rowIndex, colEnd: c.cell.colIndex }, y = { rowStart: Math.min(u.rowIndex ?? p.rowStart, w.rowIndex ?? p.rowStart), colStart: Math.min(u.colIndex ?? p.colStart, w.colIndex ?? p.colStart), rowEnd: Math.max(u.rowIndex ?? p.rowEnd, w.rowIndex ?? p.rowEnd), colEnd: Math.max(u.colIndex ?? p.colEnd, w.colIndex ?? p.colEnd) }, W = { rowIndex: y.rowStart, colIndex: y.colStart }, b = { rowIndex: y.rowEnd, colIndex: y.colEnd };
2247
+ if (!(ht(W) || ht(b)))
2248
+ return Ie(W, b);
2249
+ }, [Ie]), rt = k((c, u, w) => {
2250
+ if (s === "single" || !ye.current) return;
2251
+ const p = Oe(ye.current, c, u ?? ye.current.cell);
2251
2252
  if (!p) return;
2252
- const y = ke.current.rangeIndex;
2253
- Xe((V) => V.length ? V.map((b, he) => y === he ? p : b) : [p]), w && p && wt({ colIndex: p.colStart, rowIndex: p.rowStart });
2254
- }, []), tt = O((c, h, w) => {
2255
- if (!ke.current) return;
2256
- c = { ...ke.current?.cell, ...c }, h = h ?? c;
2257
- const p = Le(ke.current, c, h);
2253
+ const y = ye.current.rangeIndex;
2254
+ mt((W) => W.length ? W.map((b, he) => y === he ? p : b) : [p]), w && p && Qe({ colIndex: p.colStart, rowIndex: p.rowStart });
2255
+ }, []), tt = D((c, u, w) => {
2256
+ if (!ye.current) return;
2257
+ c = { ...ye.current?.cell, ...c }, u = u ?? c;
2258
+ const p = Oe(ye.current, c, u);
2258
2259
  if (!p) return;
2259
- const y = { rowIndex: p.rowStart, colIndex: p.colStart }, V = { ...y, ...w };
2260
- a === "clear" ? (Ne.current = V, rn()) : a === "modify" ? rt(y) : Ae(y), wt(V);
2261
- }, []), Ae = O((c, h = c, w) => {
2262
- s !== "multiple" || !c || dt(c) || dt(h) || Be((p) => {
2263
- Qe.current = !1, p = Yt(p);
2264
- const y = Ie(c, h);
2260
+ const y = { rowIndex: p.rowStart, colIndex: p.colStart }, W = { ...y, ...w };
2261
+ a === "clear" ? (We.current = W, rn()) : a === "modify" ? rt(y) : ze(y), Qe(W);
2262
+ }, []), ze = D((c, u = c, w) => {
2263
+ s !== "multiple" || !c || ht(c) || ht(u) || St((p) => {
2264
+ Je.current = !1, p = Yt(p);
2265
+ const y = Ie(c, u);
2265
2266
  if (!y) return p;
2266
- let V = p.ranges.length > 0 ? [...p.ranges] : [Ie(p.cell, p.cell)];
2267
- V.push(y);
2268
- const b = { ranges: V, cell: { rowIndex: y.rowStart, colIndex: y.colStart, ...w }, rangeIndex: V.length - 1 };
2269
- return Z.isEqualSelectionCoords(b, p) ? p : b;
2267
+ let W = p.ranges.length > 0 ? [...p.ranges] : [Ie(p.cell, p.cell)];
2268
+ W.push(y);
2269
+ const b = { ranges: W, cell: { rowIndex: y.rowStart, colIndex: y.colStart, ...w }, rangeIndex: W.length - 1 };
2270
+ return G.isEqualSelectionCoords(b, p) ? p : b;
2270
2271
  });
2271
2272
  }, []), rn = () => {
2272
- Xe(Zo);
2273
- }, Mt = me.detectIt().primaryInput === "touch", nt = J(null), Tt = J(null), kt = J(null), hn = Ee(() => ({ onPointerDown: (c) => {
2273
+ mt(Zo);
2274
+ }, Tt = we.detectIt().primaryInput === "touch", nt = Z(null), Rt = Z(null), Ot = Z(null), hn = _e(() => ({ onPointerDown: (c) => {
2274
2275
  if (!e || !e.current) return !1;
2275
- const h = c.nativeEvent, w = e.current.getViewFromClient(h.clientX, h.clientY);
2276
- if (h.pointerType === "touch" || h.type === "touchstart") return Tt.current = { topLeft: w.getScrollTopLeft(), point: { x: h.clientX, y: h.clientY } }, !0;
2276
+ const u = c.nativeEvent, w = e.current.getViewFromClient(u.clientX, u.clientY);
2277
+ if (u.pointerType === "touch" || u.type === "touchstart") return Rt.current = { topLeft: w.getScrollTopLeft(), point: { x: u.clientX, y: u.clientY } }, !0;
2277
2278
  const p = w.getCellCoordsFromClient(c.nativeEvent.clientX, c.nativeEvent.clientY);
2278
2279
  if (!p) return !1;
2279
2280
  nt.current = { anchor: w.getAnchor(), coords: p }, Q.current = null;
2280
2281
  const y = c.nativeEvent.which === _r;
2281
- if (y && Z.indexOfCoords(p, z.ranges) !== -1)
2282
+ if (y && G.indexOfCoords(p, M.ranges) !== -1)
2282
2283
  return !1;
2283
- const V = c.nativeEvent.shiftKey, b = c.nativeEvent.ctrlKey || c.nativeEvent.metaKey, he = b, ne = d, re = z.ranges.length > 0, we = b && ne;
2284
- if (oe?.(c, p, z) === !1) return !1;
2285
- i?.(ke.current, c.nativeEvent);
2286
- const De = !y && s !== "single";
2287
- if (V) return rt(p), De;
2288
- const de = Z.isEqualCells(p, z.cell);
2284
+ const W = c.nativeEvent.shiftKey, b = c.nativeEvent.ctrlKey || c.nativeEvent.metaKey, he = b, ne = d, re = M.ranges.length > 0, ge = b && ne;
2285
+ if (oe?.(c, p, M) === !1) return !1;
2286
+ i?.(ye.current, c.nativeEvent);
2287
+ const Le = !y && s !== "single";
2288
+ if (W) return rt(p), Le;
2289
+ const de = G.isEqualCells(p, M.cell);
2289
2290
  if (he) {
2290
- if (de && (!we || !re)) return De;
2291
- if (b && Z.indexOfCoords(p, z.ranges) !== -1 && ne) {
2292
- vt.current = p;
2291
+ if (de && (!ge || !re)) return Le;
2292
+ if (b && G.indexOfCoords(p, M.ranges) !== -1 && ne) {
2293
+ xt.current = p;
2293
2294
  const ie = Ie(p, p);
2294
- return Vt.current = ie, qt(ie), De;
2295
+ return Vt.current = ie, Kt(ie), Le;
2295
2296
  }
2296
- return Ae(p), De;
2297
+ return ze(p), Le;
2297
2298
  }
2298
- le && qe(p), de && z.ranges.length === 0 || tt(p);
2299
- }, onPointerMoveOrWait: Ct.throttle((c, h) => {
2299
+ le && Ue(p), de && M.ranges.length === 0 || tt(p);
2300
+ }, onPointerMoveOrWait: Ct.throttle((c, u) => {
2300
2301
  if (!e?.current || c.pointerType === "touch" || c.type === "touchmove" || !nt.current) return;
2301
2302
  const w = nt.current.anchor;
2302
2303
  let p = e.current.getViewFromLocation(w), y = p.getCellCoordsFromClient(c.clientX, c.clientY);
2303
- if (!Z.isEqualCells(y, nt.current?.coords) && (nt.current = { anchor: w, coords: y }, y && be?.(c, y, ke.current) !== !1)) {
2304
- if (vt.current) {
2305
- const V = { rowStart: Math.min(y.rowIndex, vt.current.rowIndex), colStart: Math.min(y.colIndex, vt.current.colIndex), rowEnd: Math.max(y.rowIndex, vt.current.rowIndex), colEnd: Math.max(y.colIndex, vt.current.colIndex) }, b = { rowIndex: V.rowStart, colIndex: V.colStart }, he = { rowIndex: V.rowEnd, colIndex: V.colEnd };
2306
- if (dt(b) || dt(he)) return;
2304
+ if (!G.isEqualCells(y, nt.current?.coords) && (nt.current = { anchor: w, coords: y }, y && ve?.(c, y, ye.current) !== !1)) {
2305
+ if (xt.current) {
2306
+ const W = { rowStart: Math.min(y.rowIndex, xt.current.rowIndex), colStart: Math.min(y.colIndex, xt.current.colIndex), rowEnd: Math.max(y.rowIndex, xt.current.rowIndex), colEnd: Math.max(y.colIndex, xt.current.colIndex) }, b = { rowIndex: W.rowStart, colIndex: W.colStart }, he = { rowIndex: W.rowEnd, colIndex: W.colEnd };
2307
+ if (ht(b) || ht(he)) return;
2307
2308
  const ne = Ie(b, he);
2308
- Vt.current = ne, qt(ne);
2309
+ Vt.current = ne, Kt(ne);
2309
2310
  } else rt(y);
2310
- kt.current = h, lo(p, y, e);
2311
+ Ot.current = u, lo(p, y, e);
2311
2312
  }
2312
2313
  }, 60), onPointerUp: (c) => {
2313
2314
  if (nt.current = null, c.pointerType === "touch" || c.type === "touchend") {
2314
- if (Tt.current) {
2315
- const w = e.current.getViewFromClient(Tt.current.point.x, Tt.current.point.y), p = w.getScrollTopLeft();
2316
- if (p.left === Tt.current.topLeft.left && p.top === Tt.current.topLeft.top) {
2317
- const y = w.getCellCoordsFromClient(Tt.current.point.x, Tt.current.point.y);
2315
+ if (Rt.current) {
2316
+ const w = e.current.getViewFromClient(Rt.current.point.x, Rt.current.point.y), p = w.getScrollTopLeft();
2317
+ if (p.left === Rt.current.topLeft.left && p.top === Rt.current.topLeft.top) {
2318
+ const y = w.getCellCoordsFromClient(Rt.current.point.x, Rt.current.point.y);
2318
2319
  tt(y);
2319
2320
  }
2320
2321
  }
2321
- return Tt.current = null, void (nt.current = null);
2322
+ return Rt.current = null, void (nt.current = null);
2322
2323
  }
2323
2324
  try {
2324
- l?.(ke.current, c);
2325
+ l?.(ye.current, c);
2325
2326
  } catch (w) {
2326
2327
  console.warn(w);
2327
2328
  }
2328
- if (!vt.current) return;
2329
- const h = Vt.current;
2330
- vt.current = null, Vt.current = null, qt(null), Be((w) => {
2331
- if (Qe.current = !1, (w = Yt(w)).ranges.length === 0) return w;
2332
- let p = [], y = -1, V = w.cell;
2329
+ if (!xt.current) return;
2330
+ const u = Vt.current;
2331
+ xt.current = null, Vt.current = null, Kt(null), St((w) => {
2332
+ if (Je.current = !1, (w = Yt(w)).ranges.length === 0) return w;
2333
+ let p = [], y = -1, W = w.cell;
2333
2334
  for (let he = 0; he < w.ranges.length; he++) {
2334
2335
  const ne = w.ranges[he];
2335
- if (Z.isRangesIntersect(ne, h)) {
2336
- const re = Ct.subtractRect({ top: ne.rowStart, left: ne.colStart, bottom: ne.rowEnd + 1, right: ne.colEnd + 1 }, { top: h.rowStart, left: h.colStart, bottom: h.rowEnd + 1, right: h.colEnd + 1 });
2337
- for (let we = 0; we < re.length; we++) {
2338
- const De = { rowStart: re[we].top, colStart: re[we].left, rowEnd: re[we].bottom - 1, colEnd: re[we].right - 1 };
2339
- p.push(De), Z.isCellWithinRange(w.cell, De) && (y = p.length - 1);
2336
+ if (G.isRangesIntersect(ne, u)) {
2337
+ const re = Ct.subtractRect({ top: ne.rowStart, left: ne.colStart, bottom: ne.rowEnd + 1, right: ne.colEnd + 1 }, { top: u.rowStart, left: u.colStart, bottom: u.rowEnd + 1, right: u.colEnd + 1 });
2338
+ for (let ge = 0; ge < re.length; ge++) {
2339
+ const Le = { rowStart: re[ge].top, colStart: re[ge].left, rowEnd: re[ge].bottom - 1, colEnd: re[ge].right - 1 };
2340
+ p.push(Le), G.isCellWithinRange(w.cell, Le) && (y = p.length - 1);
2340
2341
  }
2341
2342
  } else p.push(ne);
2342
- p.length > 0 && y === -1 && Z.isCellWithinRange(w.cell, ne) && (y = p.length - 1, V = { rowIndex: p[p.length - 1].rowStart, colIndex: p[p.length - 1].colStart });
2343
+ p.length > 0 && y === -1 && G.isCellWithinRange(w.cell, ne) && (y = p.length - 1, W = { rowIndex: p[p.length - 1].rowStart, colIndex: p[p.length - 1].colStart });
2343
2344
  }
2344
- const b = { cell: V, rangeIndex: y, ranges: p };
2345
- return Z.isEqualSelectionCoords(b, w) ? w : b;
2345
+ const b = { cell: W, rangeIndex: y, ranges: p };
2346
+ return G.isEqualSelectionCoords(b, w) ? w : b;
2346
2347
  });
2347
- }, processTouch: !0, consumeTouch: !1 }), [z, s, d, le, a]), mo = T(On(hn), []), xo = Ee(() => ({ onSelectionPointerDown: (c, h, w, p, y = z.cell, V = le, b = c.nativeEvent.shiftKey, he = !1) => {
2348
+ }, processTouch: !0, consumeTouch: !1 }), [M, s, d, le, a]), mo = k(On(hn), []), xo = _e(() => ({ onSelectionPointerDown: (c, u, w, p, y = M.cell, W = le, b = c.nativeEvent.shiftKey, he = !1) => {
2348
2349
  if (!e || !e.current) return !1;
2349
2350
  c.stopPropagation(), c.preventDefault(), c.nativeEvent.stopImmediatePropagation();
2350
2351
  const ne = w ?? e.current.getViewFromClient(c.nativeEvent.clientX, c.nativeEvent.clientY), re = p ?? ne.getCellCoordsFromClient(c.nativeEvent.clientX, c.nativeEvent.clientY);
2351
2352
  if (!re) return !1;
2352
2353
  nt.current = { anchor: ne.getAnchor(), coords: re }, Q.current = null;
2353
- const we = c.nativeEvent.which === _r;
2354
- if (we && Z.indexOfCoords(re, z.ranges) !== -1)
2354
+ const ge = c.nativeEvent.which === _r;
2355
+ if (ge && G.indexOfCoords(re, M.ranges) !== -1)
2355
2356
  return !1;
2356
- const De = c.nativeEvent.ctrlKey || c.nativeEvent.metaKey, de = De, ie = d, _t = z.ranges.length > 0, B = De && ie;
2357
- if (oe?.(c, re, z) === !1) return !1;
2358
- i?.(ke.current, c.nativeEvent);
2359
- const Pe = !we && s !== "single";
2360
- if (b) return rt(re, y, he), Pe;
2361
- const Rt = Z.isEqualCells(re, y);
2357
+ const Le = c.nativeEvent.ctrlKey || c.nativeEvent.metaKey, de = Le, ie = d, _t = M.ranges.length > 0, F = Le && ie;
2358
+ if (oe?.(c, re, M) === !1) return !1;
2359
+ i?.(ye.current, c.nativeEvent);
2360
+ const ke = !ge && s !== "single";
2361
+ if (b) return rt(re, y, he), ke;
2362
+ const Pt = G.isEqualCells(re, y);
2362
2363
  if (de) {
2363
- if (Rt && (!B || !_t)) return Pe;
2364
- if (B && Z.indexOfCoords(re, z.ranges) !== -1 && ie) {
2365
- vt.current = re;
2366
- const Te = Ie(re, re);
2367
- return Vt.current = Te, qt(Te), Pe;
2364
+ if (Pt && (!F || !_t)) return ke;
2365
+ if (F && G.indexOfCoords(re, M.ranges) !== -1 && ie) {
2366
+ xt.current = re;
2367
+ const Re = Ie(re, re);
2368
+ return Vt.current = Re, Kt(Re), ke;
2368
2369
  }
2369
- return Ae(re), Pe;
2370
+ return ze(re), ke;
2370
2371
  }
2371
- V && qe(re), Rt && z.ranges.length === 0 || tt(re);
2372
- }, onSelectionPointerMoveOrWait: (c, h, w, p, y, V = z.cell, b = !0, he = !1) => {
2372
+ W && Ue(re), Pt && M.ranges.length === 0 || tt(re);
2373
+ }, onSelectionPointerMoveOrWait: (c, u, w, p, y, W = M.cell, b = !0, he = !1) => {
2373
2374
  if (!e?.current || (c.stopPropagation(), c.preventDefault(), c.stopImmediatePropagation(), !nt.current)) return;
2374
2375
  const ne = nt.current.anchor;
2375
- let re = p ?? e.current.getViewFromLocation(ne), we = y ?? re.getCellCoordsFromClient(c.clientX, c.clientY);
2376
- if (!Z.isEqualCells(we, nt.current?.coords) && (nt.current = { anchor: ne, coords: we }, we && be?.(c, we, ke.current) !== !1)) {
2377
- if (vt.current) {
2378
- const De = { rowStart: Math.min(we.rowIndex, vt.current.rowIndex), colStart: Math.min(we.colIndex, vt.current.colIndex), rowEnd: Math.max(we.rowIndex, vt.current.rowIndex), colEnd: Math.max(we.colIndex, vt.current.colIndex) }, de = { rowIndex: De.rowStart, colIndex: De.colStart }, ie = { rowIndex: De.rowEnd, colIndex: De.colEnd };
2379
- if (dt(de) || dt(ie)) return;
2376
+ let re = p ?? e.current.getViewFromLocation(ne), ge = y ?? re.getCellCoordsFromClient(c.clientX, c.clientY);
2377
+ if (!G.isEqualCells(ge, nt.current?.coords) && (nt.current = { anchor: ne, coords: ge }, ge && ve?.(c, ge, ye.current) !== !1)) {
2378
+ if (xt.current) {
2379
+ const Le = { rowStart: Math.min(ge.rowIndex, xt.current.rowIndex), colStart: Math.min(ge.colIndex, xt.current.colIndex), rowEnd: Math.max(ge.rowIndex, xt.current.rowIndex), colEnd: Math.max(ge.colIndex, xt.current.colIndex) }, de = { rowIndex: Le.rowStart, colIndex: Le.colStart }, ie = { rowIndex: Le.rowEnd, colIndex: Le.colEnd };
2380
+ if (ht(de) || ht(ie)) return;
2380
2381
  const _t = Ie(de, ie);
2381
- Vt.current = _t, qt(_t);
2382
- } else rt(we, V, he);
2383
- b && lo(re, we, e);
2382
+ Vt.current = _t, Kt(_t);
2383
+ } else rt(ge, W, he);
2384
+ b && lo(re, ge, e);
2384
2385
  }
2385
2386
  }, onPointerUp: (c) => {
2386
2387
  nt.current = null, c.stopPropagation(), c.preventDefault(), c.stopImmediatePropagation();
2387
2388
  try {
2388
- l?.(ke.current, c);
2389
+ l?.(ye.current, c);
2389
2390
  } catch (w) {
2390
2391
  console.warn(w);
2391
2392
  }
2392
- if (!vt.current) return;
2393
- const h = Vt.current;
2394
- vt.current = null, Vt.current = null, qt(null), Be((w) => {
2395
- if (Qe.current = !1, (w = Yt(w)).ranges.length === 0) return w;
2396
- let p = [], y = -1, V = w.cell;
2393
+ if (!xt.current) return;
2394
+ const u = Vt.current;
2395
+ xt.current = null, Vt.current = null, Kt(null), St((w) => {
2396
+ if (Je.current = !1, (w = Yt(w)).ranges.length === 0) return w;
2397
+ let p = [], y = -1, W = w.cell;
2397
2398
  for (let he = 0; he < w.ranges.length; he++) {
2398
2399
  const ne = w.ranges[he];
2399
- if (Z.isRangesIntersect(ne, h)) {
2400
- const re = Ct.subtractRect({ top: ne.rowStart, left: ne.colStart, bottom: ne.rowEnd + 1, right: ne.colEnd + 1 }, { top: h.rowStart, left: h.colStart, bottom: h.rowEnd + 1, right: h.colEnd + 1 });
2401
- for (let we = 0; we < re.length; we++) {
2402
- const De = { rowStart: re[we].top, colStart: re[we].left, rowEnd: re[we].bottom - 1, colEnd: re[we].right - 1 };
2403
- p.push(De), Z.isCellWithinRange(w.cell, De) && (y = p.length - 1);
2400
+ if (G.isRangesIntersect(ne, u)) {
2401
+ const re = Ct.subtractRect({ top: ne.rowStart, left: ne.colStart, bottom: ne.rowEnd + 1, right: ne.colEnd + 1 }, { top: u.rowStart, left: u.colStart, bottom: u.rowEnd + 1, right: u.colEnd + 1 });
2402
+ for (let ge = 0; ge < re.length; ge++) {
2403
+ const Le = { rowStart: re[ge].top, colStart: re[ge].left, rowEnd: re[ge].bottom - 1, colEnd: re[ge].right - 1 };
2404
+ p.push(Le), G.isCellWithinRange(w.cell, Le) && (y = p.length - 1);
2404
2405
  }
2405
2406
  } else p.push(ne);
2406
- p.length > 0 && y === -1 && Z.isCellWithinRange(w.cell, ne) && (y = p.length - 1, V = { rowIndex: p[p.length - 1].rowStart, colIndex: p[p.length - 1].colStart });
2407
+ p.length > 0 && y === -1 && G.isCellWithinRange(w.cell, ne) && (y = p.length - 1, W = { rowIndex: p[p.length - 1].rowStart, colIndex: p[p.length - 1].colStart });
2407
2408
  }
2408
- const b = { cell: V, rangeIndex: y, ranges: p };
2409
- return Z.isEqualSelectionCoords(b, w) ? w : b;
2409
+ const b = { cell: W, rangeIndex: y, ranges: p };
2410
+ return G.isEqualSelectionCoords(b, w) ? w : b;
2410
2411
  });
2411
- } }), [z, s, d, le, a]), ft = T((c, h = !1, w = !1, p = 0) => {
2412
- if (!e.current || !z.cell) return;
2413
- let y = z.cell, V = z.cell;
2414
- if (h && z.ranges.length > 0) {
2415
- const B = z.ranges[z.rangeIndex], Pe = z.cell;
2412
+ } }), [M, s, d, le, a]), pt = k((c, u = !1, w = !1, p = 0) => {
2413
+ if (!e.current || !M.cell) return;
2414
+ let y = M.cell, W = M.cell;
2415
+ if (u && M.ranges.length > 0) {
2416
+ const F = M.ranges[M.rangeIndex], ke = M.cell;
2416
2417
  switch (c) {
2417
2418
  case it:
2418
- V = { rowIndex: Pe.rowIndex === B.rowStart ? B.rowEnd : B.rowStart, colIndex: B.colEnd }, y = { rowIndex: Pe.rowIndex === B.rowStart ? B.rowStart : B.rowEnd, colIndex: B.colStart };
2419
+ W = { rowIndex: ke.rowIndex === F.rowStart ? F.rowEnd : F.rowStart, colIndex: F.colEnd }, y = { rowIndex: ke.rowIndex === F.rowStart ? F.rowStart : F.rowEnd, colIndex: F.colStart };
2419
2420
  break;
2420
2421
  case lt:
2421
- V = { rowIndex: Pe.rowIndex === B.rowEnd ? B.rowStart : B.rowEnd, colIndex: B.colEnd }, y = { rowIndex: Pe.rowIndex === B.rowEnd ? B.rowEnd : B.rowStart, colIndex: B.colStart };
2422
+ W = { rowIndex: ke.rowIndex === F.rowEnd ? F.rowStart : F.rowEnd, colIndex: F.colEnd }, y = { rowIndex: ke.rowIndex === F.rowEnd ? F.rowEnd : F.rowStart, colIndex: F.colStart };
2422
2423
  break;
2423
2424
  case ot:
2424
- V = { rowIndex: B.rowEnd, colIndex: Pe.colIndex === B.colStart ? B.colEnd : B.colStart }, y = { rowIndex: B.rowStart, colIndex: Pe.colIndex === B.colStart ? B.colStart : B.colEnd };
2425
+ W = { rowIndex: F.rowEnd, colIndex: ke.colIndex === F.colStart ? F.colEnd : F.colStart }, y = { rowIndex: F.rowStart, colIndex: ke.colIndex === F.colStart ? F.colStart : F.colEnd };
2425
2426
  break;
2426
2427
  case Ke:
2427
- V = { rowIndex: B.rowEnd, colIndex: Pe.colIndex === B.colEnd ? B.colStart : B.colEnd }, y = { rowIndex: B.rowStart, colIndex: Pe.colIndex === B.colEnd ? B.colEnd : B.colStart };
2428
+ W = { rowIndex: F.rowEnd, colIndex: ke.colIndex === F.colEnd ? F.colStart : F.colEnd }, y = { rowIndex: F.rowStart, colIndex: ke.colIndex === F.colEnd ? F.colEnd : F.colStart };
2428
2429
  }
2429
2430
  }
2430
- const b = A(V);
2431
+ const b = L(W);
2431
2432
  let { rowStart: he, colStart: ne } = b;
2432
- const re = _e();
2433
+ const re = Se();
2433
2434
  if (Q.current) switch (c) {
2434
2435
  case it:
2435
2436
  case lt:
@@ -2442,805 +2443,805 @@ const tn = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2442
2443
  if (!p) {
2443
2444
  switch (c) {
2444
2445
  case it:
2445
- he = Ye(pt, Math.max(b.rowStart - 1, re.top), c);
2446
+ he = qe(dt, Math.max(b.rowStart - 1, re.top), c);
2446
2447
  break;
2447
2448
  case lt:
2448
- he = Ye(pt, Math.min(b.rowEnd + 1, re.bottom), c);
2449
+ he = qe(dt, Math.min(b.rowEnd + 1, re.bottom), c);
2449
2450
  break;
2450
2451
  case ot:
2451
- ne = Ye(gt, Math.max(b.colStart - 1, re.left), c);
2452
+ ne = qe(ut, Math.max(b.colStart - 1, re.left), c);
2452
2453
  break;
2453
2454
  case Ke:
2454
- ne = Ye(gt, Math.min(b.colEnd + 1, re.right), c);
2455
+ ne = qe(ut, Math.min(b.colEnd + 1, re.right), c);
2455
2456
  }
2456
2457
  if (w) switch (c) {
2457
2458
  case it:
2458
- he = _({ ...V, colIndex: z.cell.colIndex }, te, pt, c, !1, Math.max(re.top, pt(re.top, !1)));
2459
+ he = C({ ...W, colIndex: M.cell.colIndex }, ue, dt, c, !1, Math.max(re.top, dt(re.top, !1)));
2459
2460
  break;
2460
2461
  case lt:
2461
- he = _({ ...V, colIndex: z.cell.colIndex }, te, pt, c, !1, Math.min(re.bottom, re.bottom - pt(re.bottom, !0)));
2462
+ he = C({ ...W, colIndex: M.cell.colIndex }, ue, dt, c, !1, Math.min(re.bottom, re.bottom - dt(re.bottom, !0)));
2462
2463
  break;
2463
2464
  case ot:
2464
- ne = _({ ...V, rowIndex: z.cell.rowIndex }, te, gt, c, !1, Math.max(re.left, gt(re.left, !1)));
2465
+ ne = C({ ...W, rowIndex: M.cell.rowIndex }, ue, ut, c, !1, Math.max(re.left, ut(re.left, !1)));
2465
2466
  break;
2466
2467
  case Ke:
2467
- ne = _({ ...V, rowIndex: z.cell.rowIndex }, te, gt, c, !1, Math.min(re.right, re.right - gt(re.right, !0)));
2468
+ ne = C({ ...W, rowIndex: M.cell.rowIndex }, ue, ut, c, !1, Math.min(re.right, re.right - ut(re.right, !0)));
2468
2469
  }
2469
2470
  }
2470
- let we = null;
2471
+ let ge = null;
2471
2472
  if (p) {
2472
- let B = 0;
2473
+ let F = 0;
2473
2474
  switch (c) {
2474
2475
  case it:
2475
- B = n.getRowOffset(he + 1), he = Math.max(re.top, n.getRowIndex(B - p)), we = { top: n.getRowOffset(he + 1) - (B - e.current.getScrollPosition().top) };
2476
+ F = n.getRowOffset(he + 1), he = Math.max(re.top, n.getRowIndex(F - p)), ge = { top: n.getRowOffset(he + 1) - (F - e.current.getScrollPosition().top) };
2476
2477
  break;
2477
2478
  case lt:
2478
- B = n.getRowOffset(he), he = Math.min(re.bottom, n.getRowIndex(B + p)), we = { top: n.getRowOffset(he) - (B - e.current.getScrollPosition().top) };
2479
+ F = n.getRowOffset(he), he = Math.min(re.bottom, n.getRowIndex(F + p)), ge = { top: n.getRowOffset(he) - (F - e.current.getScrollPosition().top) };
2479
2480
  break;
2480
2481
  case ot:
2481
- B = n.getColOffset(ne + 1), ne = Math.max(re.left, n.getColIndex(B - p)), we = { left: n.getColOffset(ne + 1) - (B - e.current.getScrollPosition().left) };
2482
+ F = n.getColOffset(ne + 1), ne = Math.max(re.left, n.getColIndex(F - p)), ge = { left: n.getColOffset(ne + 1) - (F - e.current.getScrollPosition().left) };
2482
2483
  break;
2483
2484
  case Ke:
2484
- B = n.getColOffset(ne), ne = Math.min(re.right, n.getColIndex(B + p)), we = { left: n.getColOffset(ne) - (B - e.current.getScrollPosition().left) };
2485
+ F = n.getColOffset(ne), ne = Math.min(re.right, n.getColIndex(F + p)), ge = { left: n.getColOffset(ne) - (F - e.current.getScrollPosition().left) };
2485
2486
  }
2486
2487
  }
2487
- const De = { rowIndex: he, colIndex: ne }, de = A(De), ie = { rowIndex: de.rowStart, colIndex: de.colStart };
2488
- h || (Q.current = De);
2489
- const _t = Z.isEqualCells(Ne.current, ie) && Z.isEqualCells(Ne.current, y);
2490
- if (h && !_t ? rt(ie, y) : tt(ie), we) e.current.scrollTo(we);
2488
+ const Le = { rowIndex: he, colIndex: ne }, de = L(Le), ie = { rowIndex: de.rowStart, colIndex: de.colStart };
2489
+ u || (Q.current = Le);
2490
+ const _t = G.isEqualCells(We.current, ie) && G.isEqualCells(We.current, y);
2491
+ if (u && !_t ? rt(ie, y) : tt(ie), ge) e.current.scrollTo(ge);
2491
2492
  else {
2492
- if (h && Ne.current) {
2493
- const B = _e();
2494
- if (c === Ke && Ne.current.colIndex === B.left || c === ot && Ne.current.colIndex === B.right || c === it && Ne.current.rowIndex === B.bottom || c === lt && Ne.current.rowIndex === B.top) return;
2493
+ if (u && We.current) {
2494
+ const F = Se();
2495
+ if (c === Ke && We.current.colIndex === F.left || c === ot && We.current.colIndex === F.right || c === it && We.current.rowIndex === F.bottom || c === lt && We.current.rowIndex === F.top) return;
2495
2496
  }
2496
- c === ot || c === Ke ? qe({ colIndex: De.colIndex }) : c !== it && c !== lt || qe({ rowIndex: De.rowIndex });
2497
+ c === ot || c === Ke ? Ue({ colIndex: Le.colIndex }) : c !== it && c !== lt || Ue({ rowIndex: Le.rowIndex });
2497
2498
  }
2498
- }, [z, A]), ln = T((c) => {
2499
+ }, [M, L]), ln = k((c) => {
2499
2500
  if (!e.current) return;
2500
- if (z.ranges.length === 0) return void ft(c);
2501
- const h = A(z.cell);
2502
- if (Z.isEqualRangesArrays([h], z.ranges)) return void ft(c);
2503
- const w = Xo(z, c, A, pt, gt);
2504
- Be((p) => {
2505
- Qe.current = !1, p = Yt(p);
2501
+ if (M.ranges.length === 0) return void pt(c);
2502
+ const u = L(M.cell);
2503
+ if (G.isEqualRangesArrays([u], M.ranges)) return void pt(c);
2504
+ const w = Xo(M, c, L, dt, ut);
2505
+ St((p) => {
2506
+ Je.current = !1, p = Yt(p);
2506
2507
  const y = { ...p, cell: w.cell, rangeIndex: w.rangeIndex };
2507
- return Z.isEqualSelectionCoords(y, p) ? p : y;
2508
- }), w.cell && qe(w.cell);
2509
- }, [z, A]), vo = O(() => {
2510
- const c = _e();
2508
+ return G.isEqualSelectionCoords(y, p) ? p : y;
2509
+ }), w.cell && Ue(w.cell);
2510
+ }, [M, L]), vo = D(() => {
2511
+ const c = Se();
2511
2512
  rt({ rowIndex: c.top }, { rowIndex: c.bottom });
2512
- }, []), yo = O(() => {
2513
- const c = _e();
2513
+ }, []), yo = D(() => {
2514
+ const c = Se();
2514
2515
  rt({ colIndex: c.left }, { colIndex: c.right });
2515
- }, []), xn = T(() => {
2516
- z.cell && e?.current && qe(z.cell);
2517
- }, [z.cell]), Kn = O((c = !1) => {
2518
- const h = { rowIndex: _e().top };
2519
- c ? rt(h) : tt(h), qe(h);
2520
- }, []), Yn = O((c = !1) => {
2521
- const h = { rowIndex: _e().bottom };
2522
- c ? rt(h) : tt(h), qe(h);
2523
- }, []), Dn = O((c = !1) => {
2524
- const h = { colIndex: _e().left };
2525
- c ? rt(h) : tt(h), qe(h);
2526
- }, []), Mn = O((c = !1) => {
2527
- const h = _e(), w = { rowIndex: h.top, colIndex: h.left };
2528
- c ? rt(w) : tt(w), qe(w);
2529
- }, []), zn = O((c = !1) => {
2530
- const h = _e(), w = { colIndex: L?.()?.colEnd ?? h.right };
2531
- c ? rt(w) : tt(w), qe(w);
2532
- }, [L]), vn = O((c = !1) => {
2533
- const h = _e(), w = { rowIndex: L?.()?.rowEnd ?? h.bottom, colIndex: L?.()?.colEnd ?? h.right };
2534
- c ? rt(w) : tt(w), qe(w);
2535
- }, [L]), An = T((c) => {
2536
- if (!e.current || z.ranges.length <= 1) return;
2537
- const h = c === ot || c === it;
2538
- let w = z.rangeIndex + (h ? -1 : 1);
2539
- w < 0 ? w = z.ranges.length - 1 : w > z.ranges.length - 1 && (w = 0);
2540
- const p = z.ranges[w], y = Xo({ cell: { rowIndex: p.rowEnd, colIndex: p.colEnd }, rangeIndex: 0, ranges: [p] }, Ke, A, pt, gt);
2541
- Be((V) => {
2542
- Qe.current = !1, V = Yt(V);
2543
- const b = { ...V, cell: y.cell, rangeIndex: w };
2544
- return Z.isEqualSelectionCoords(b, V) ? V : b;
2545
- }), y.cell && qe(y.cell);
2546
- }, [z, A]), bo = T(() => {
2547
- const c = Ar(z);
2548
- Be((h) => {
2549
- Qe.current = !1, h = Yt(h);
2550
- const w = { ...h, visibleSelection: c };
2551
- return Z.isEqualSelectionCoords(w, h) ? h : w;
2552
- }), c.cell && qe(c.cell);
2553
- }, [z, A]), So = T(() => {
2554
- if (!e.current || z.ranges.length === 0) return;
2555
- const c = z.cell, h = z.ranges[z.rangeIndex], w = Ar({ cell: c, rangeIndex: 0, ranges: [h] }), p = w.ranges[w.rangeIndex];
2516
+ }, []), xn = k(() => {
2517
+ M.cell && e?.current && Ue(M.cell);
2518
+ }, [M.cell]), qn = D((c = !1) => {
2519
+ const u = { rowIndex: Se().top };
2520
+ c ? rt(u) : tt(u), Ue(u);
2521
+ }, []), Yn = D((c = !1) => {
2522
+ const u = { rowIndex: Se().bottom };
2523
+ c ? rt(u) : tt(u), Ue(u);
2524
+ }, []), Dn = D((c = !1) => {
2525
+ const u = { colIndex: Se().left };
2526
+ c ? rt(u) : tt(u), Ue(u);
2527
+ }, []), Mn = D((c = !1) => {
2528
+ const u = Se(), w = { rowIndex: u.top, colIndex: u.left };
2529
+ c ? rt(w) : tt(w), Ue(w);
2530
+ }, []), zn = D((c = !1) => {
2531
+ const u = Se(), w = { colIndex: z?.()?.colEnd ?? u.right };
2532
+ c ? rt(w) : tt(w), Ue(w);
2533
+ }, [z]), vn = D((c = !1) => {
2534
+ const u = Se(), w = { rowIndex: z?.()?.rowEnd ?? u.bottom, colIndex: z?.()?.colEnd ?? u.right };
2535
+ c ? rt(w) : tt(w), Ue(w);
2536
+ }, [z]), An = k((c) => {
2537
+ if (!e.current || M.ranges.length <= 1) return;
2538
+ const u = c === ot || c === it;
2539
+ let w = M.rangeIndex + (u ? -1 : 1);
2540
+ w < 0 ? w = M.ranges.length - 1 : w > M.ranges.length - 1 && (w = 0);
2541
+ const p = M.ranges[w], y = Xo({ cell: { rowIndex: p.rowEnd, colIndex: p.colEnd }, rangeIndex: 0, ranges: [p] }, Ke, L, dt, ut);
2542
+ St((W) => {
2543
+ Je.current = !1, W = Yt(W);
2544
+ const b = { ...W, cell: y.cell, rangeIndex: w };
2545
+ return G.isEqualSelectionCoords(b, W) ? W : b;
2546
+ }), y.cell && Ue(y.cell);
2547
+ }, [M, L]), bo = k(() => {
2548
+ const c = Ar(M);
2549
+ St((u) => {
2550
+ Je.current = !1, u = Yt(u);
2551
+ const w = { ...u, visibleSelection: c };
2552
+ return G.isEqualSelectionCoords(w, u) ? u : w;
2553
+ }), c.cell && Ue(c.cell);
2554
+ }, [M, L]), So = k(() => {
2555
+ if (!e.current || M.ranges.length === 0) return;
2556
+ const c = M.cell, u = M.ranges[M.rangeIndex], w = Ar({ cell: c, rangeIndex: 0, ranges: [u] }), p = w.ranges[w.rangeIndex];
2556
2557
  let y;
2557
- y = p.rowStart === c.rowIndex && p.colStart === c.colIndex ? { rowIndex: p.rowStart, colIndex: p.colEnd } : p.rowStart === c.rowIndex && p.colEnd === c.colIndex ? { rowIndex: p.rowEnd, colIndex: p.colStart } : p.rowEnd === c.rowIndex && p.colStart === c.colIndex ? { rowIndex: p.rowEnd, colIndex: p.colEnd } : { rowIndex: p.rowStart, colIndex: p.colStart }, Be((V) => {
2558
- V = Yt(V);
2559
- const b = { ...V, cell: y };
2560
- return Z.isEqualSelectionCoords(b, V) ? V : b;
2561
- }), y && qe(y);
2562
- }, [z, A]), Xn = O((c = !1) => {
2563
- ft(lt, c, !1, e.current.getDimensions().containerHeight);
2564
- }, []), Qt = O((c = !1) => {
2565
- ft(it, c, !1, e.current.getDimensions().containerHeight);
2566
- }, []), Gn = O((c = !1) => {
2567
- ft(Ke, c, !1, e.current.getDimensions().containerWidth);
2568
- }, []), $n = O((c = !1) => {
2569
- ft(ot, c, !1, e.current.getDimensions().containerWidth);
2570
- }, []), Zn = O(() => {
2558
+ y = p.rowStart === c.rowIndex && p.colStart === c.colIndex ? { rowIndex: p.rowStart, colIndex: p.colEnd } : p.rowStart === c.rowIndex && p.colEnd === c.colIndex ? { rowIndex: p.rowEnd, colIndex: p.colStart } : p.rowEnd === c.rowIndex && p.colStart === c.colIndex ? { rowIndex: p.rowEnd, colIndex: p.colEnd } : { rowIndex: p.rowStart, colIndex: p.colStart }, St((W) => {
2559
+ W = Yt(W);
2560
+ const b = { ...W, cell: y };
2561
+ return G.isEqualSelectionCoords(b, W) ? W : b;
2562
+ }), y && Ue(y);
2563
+ }, [M, L]), Xn = D((c = !1) => {
2564
+ pt(lt, c, !1, e.current.getDimensions().containerHeight);
2565
+ }, []), Jt = D((c = !1) => {
2566
+ pt(it, c, !1, e.current.getDimensions().containerHeight);
2567
+ }, []), Gn = D((c = !1) => {
2568
+ pt(Ke, c, !1, e.current.getDimensions().containerWidth);
2569
+ }, []), $n = D((c = !1) => {
2570
+ pt(ot, c, !1, e.current.getDimensions().containerWidth);
2571
+ }, []), Zn = D(() => {
2571
2572
  ln(ot);
2572
- }, []), Jn = O(() => {
2573
+ }, []), Jn = D(() => {
2573
2574
  ln(Ke);
2574
- }, []), Eo = O(() => {
2575
+ }, []), Eo = D(() => {
2575
2576
  ln(it);
2576
- }, []), _o = O(() => {
2577
+ }, []), _o = D(() => {
2577
2578
  ln(lt);
2578
- }, []), Bn = O(() => {
2579
+ }, []), Bn = D(() => {
2579
2580
  An(ot);
2580
- }, []), Io = O(() => {
2581
+ }, []), Io = D(() => {
2581
2582
  An(Ke);
2582
- }, []), Co = O(() => {
2583
+ }, []), Co = D(() => {
2583
2584
  So();
2584
- }, []), Qn = O(() => {
2585
- ft(ot, !1, !1);
2586
- }, []), v = O(() => {
2587
- ft(ot, !0, !1);
2588
- }, []), P = O(() => {
2589
- ft(ot, !1, !0);
2590
- }, []), D = O(() => {
2591
- ft(ot, !0, !0);
2592
- }, []), F = O(() => {
2593
- ft(Ke, !1, !1);
2594
- }, []), j = O(() => {
2595
- ft(Ke, !0, !1);
2596
- }, []), fe = O(() => {
2597
- ft(Ke, !1, !0);
2598
- }, []), se = O(() => {
2599
- ft(Ke, !0, !0);
2600
- }, []), ve = O(() => {
2601
- ft(it, !1, !1);
2602
- }, []), ye = O(() => {
2603
- ft(it, !0, !1);
2604
- }, []), ce = O(() => {
2605
- ft(it, !1, !0);
2606
- }, []), Ve = O(() => {
2607
- ft(it, !0, !0);
2608
- }, []), ut = O(() => {
2609
- ft(lt, !1, !1);
2610
- }, []), Fe = O(() => {
2611
- ft(lt, !0, !1);
2612
- }, []), je = O(() => {
2613
- ft(lt, !1, !0);
2614
- }, []), mt = O(() => {
2615
- ft(lt, !0, !0);
2616
- }, []), Ge = O(() => {
2617
- Xe((c) => c.slice(0, -1));
2618
- }, []), Pt = Ee(() => {
2619
- const c = _e();
2620
- return ((h, w, p, y, V) => {
2621
- for (let b = 0; b < h.length; b++) {
2622
- const he = h[b];
2623
- if (he.rowStart === w && he.colStart === p && he.rowEnd === y && he.colEnd === V) return !0;
2585
+ }, []), Qn = D(() => {
2586
+ pt(ot, !1, !1);
2587
+ }, []), v = D(() => {
2588
+ pt(ot, !0, !1);
2589
+ }, []), O = D(() => {
2590
+ pt(ot, !1, !0);
2591
+ }, []), A = D(() => {
2592
+ pt(ot, !0, !0);
2593
+ }, []), j = D(() => {
2594
+ pt(Ke, !1, !1);
2595
+ }, []), V = D(() => {
2596
+ pt(Ke, !0, !1);
2597
+ }, []), fe = D(() => {
2598
+ pt(Ke, !1, !0);
2599
+ }, []), se = D(() => {
2600
+ pt(Ke, !0, !0);
2601
+ }, []), xe = D(() => {
2602
+ pt(it, !1, !1);
2603
+ }, []), be = D(() => {
2604
+ pt(it, !0, !1);
2605
+ }, []), ce = D(() => {
2606
+ pt(it, !1, !0);
2607
+ }, []), Fe = D(() => {
2608
+ pt(it, !0, !0);
2609
+ }, []), ft = D(() => {
2610
+ pt(lt, !1, !1);
2611
+ }, []), $e = D(() => {
2612
+ pt(lt, !0, !1);
2613
+ }, []), Be = D(() => {
2614
+ pt(lt, !1, !0);
2615
+ }, []), gt = D(() => {
2616
+ pt(lt, !0, !0);
2617
+ }, []), Xe = D(() => {
2618
+ mt((c) => c.slice(0, -1));
2619
+ }, []), Lt = _e(() => {
2620
+ const c = Se();
2621
+ return ((u, w, p, y, W) => {
2622
+ for (let b = 0; b < u.length; b++) {
2623
+ const he = u[b];
2624
+ if (he.rowStart === w && he.colStart === p && he.rowEnd === y && he.colEnd === W) return !0;
2624
2625
  }
2625
2626
  return !1;
2626
- })(z.ranges, c.top, c.left, c.bottom, c.right);
2627
- }, [$, z.ranges]), yt = O((c, h = !0) => {
2628
- Ne.current = c, wt(c), h && c && e?.current && qe(c);
2629
- }, []), ge = T((c = !0) => {
2630
- const h = on.current;
2631
- if (!ke.current?.cell) return;
2632
- const w = ke.current?.ranges, p = ke.current?.cell;
2633
- if (!p || !h || !h) return;
2627
+ })(M.ranges, c.top, c.left, c.bottom, c.right);
2628
+ }, [B, M.ranges]), vt = D((c, u = !0) => {
2629
+ We.current = c, Qe(c), u && c && e?.current && Ue(c);
2630
+ }, []), pe = k((c = !0) => {
2631
+ const u = nn.current;
2632
+ if (!ye.current?.cell) return;
2633
+ const w = ye.current?.ranges, p = ye.current?.cell;
2634
+ if (!p || !u || !u) return;
2634
2635
  let y = null;
2635
- if (y = w.length > 0 ? w[w.length - 1] : A(p), y.colEnd >= y.colStart && y.rowEnd >= y.rowStart) {
2636
- const V = $r(y, h);
2637
- let b = c ? S : ue;
2636
+ if (y = w.length > 0 ? w[w.length - 1] : L(p), y.colEnd >= y.colStart && y.rowEnd >= y.rowStart) {
2637
+ const W = $r(y, u);
2638
+ let b = c ? Ye : $;
2638
2639
  try {
2639
- b?.(y, h, V.direction);
2640
+ b?.(y, u, W.direction);
2640
2641
  } catch (he) {
2641
2642
  console.warn(he);
2642
2643
  } finally {
2643
- c && pe?.();
2644
+ c && Me?.();
2644
2645
  }
2645
2646
  }
2646
- }, [A]), xt = J(null), At = On(Ee(() => ({ onPointerDown: (c, h) => {
2647
- if (kt.current = h, !e || !e.current) return !1;
2647
+ }, [L]), wt = Z(null), $t = On(_e(() => ({ onPointerDown: (c, u) => {
2648
+ if (Ot.current = u, !e || !e.current) return !1;
2648
2649
  const w = e.current.getViewFromClient(c.nativeEvent.clientX, c.nativeEvent.clientY), p = w?.getCellCoordsFromClient(c.nativeEvent.clientX, c.nativeEvent.clientY);
2649
- p && (c.stopPropagation(), Jt("crosshair"), xt.current = { anchor: w.getAnchor(), coords: p });
2650
- }, onPointerMoveOrWait: (c, h) => {
2651
- if (E || !e?.current || !ke.current || !xt.current) return;
2652
- const w = xt.current.anchor;
2650
+ p && (c.stopPropagation(), on("crosshair"), wt.current = { anchor: w.getAnchor(), coords: p });
2651
+ }, onPointerMoveOrWait: (c, u) => {
2652
+ if (_ || !e?.current || !ye.current || !wt.current) return;
2653
+ const w = wt.current.anchor;
2653
2654
  let p = e.current.getViewFromLocation(w), y = p.getCellCoordsFromClient(c.clientX, c.clientY);
2654
2655
  if (!y) return;
2655
- xt.current = { anchor: w, coords: y };
2656
- const V = ke.current.ranges;
2657
- let b = Ie(ke.current.cell, y);
2656
+ wt.current = { anchor: w, coords: y };
2657
+ const W = ye.current.ranges;
2658
+ let b = Ie(ye.current.cell, y);
2658
2659
  if (!b) return;
2659
- const he = V.length > 0, ne = he ? V[V.length - 1] : A(ke.current.cell);
2660
+ const he = W.length > 0, ne = he ? W[W.length - 1] : L(ye.current.cell);
2660
2661
  if (!b) return;
2661
- const re = b.rowStart < ne.rowStart ? it : b.rowEnd > ne.rowEnd ? lt : b.colEnd > ne.colEnd ? Ke : ot, we = _e();
2662
- re === ot && (b = { ...ne, colStart: Math.max(we.left, b.colStart) }), re === it && (b = { ...ne, rowStart: Math.max(we.top, b.rowStart) }), re === Ke && (b = { ...ne, colEnd: Math.min(we.right, b.colEnd) }), re === lt && (b = { ...ne, rowEnd: Math.min(we.bottom, b.rowEnd) });
2663
- const De = $r(ne, b);
2662
+ const re = b.rowStart < ne.rowStart ? it : b.rowEnd > ne.rowEnd ? lt : b.colEnd > ne.colEnd ? Ke : ot, ge = Se();
2663
+ re === ot && (b = { ...ne, colStart: Math.max(ge.left, b.colStart) }), re === it && (b = { ...ne, rowStart: Math.max(ge.top, b.rowStart) }), re === Ke && (b = { ...ne, colEnd: Math.min(ge.right, b.colEnd) }), re === lt && (b = { ...ne, rowEnd: Math.min(ge.bottom, b.rowEnd) });
2664
+ const Le = $r(ne, b);
2664
2665
  if (!H?.(ne)) {
2665
2666
  let de;
2666
- typeof et.current == "function" ? de = et.current(ne) : U && (de = U), b = ((ie, _t, B, Pe, Rt, Te) => {
2667
- const Me = { ..._t };
2668
- if (B.length === 0) return Me;
2669
- if (Rt === ot) {
2670
- const St = ie.colEnd + 1 - ie.colStart;
2671
- Me.colStart = ie.colStart - Math.ceil(Te / St) * St, Me.colStart < Pe.left && (Me.colStart = Me.colStart + Math.ceil((Pe.left - Me.colStart) / St) * St);
2672
- } else if (Rt === Ke) {
2673
- const St = ie.colEnd + 1 - ie.colStart;
2674
- Me.colEnd = ie.colEnd + Math.ceil(Te / St) * St, Me.colEnd > Pe.right && (Me.colEnd = Me.colEnd - Math.ceil((Pe.right - Me.colEnd) / St) * St);
2675
- } else if (Rt === it) {
2676
- const St = ie.rowEnd + 1 - ie.rowStart;
2677
- Me.rowStart = ie.rowStart - Math.ceil(Te / St) * St, Me.rowStart < Pe.top && (Me.rowStart = Me.rowStart + Math.ceil((Pe.top - Me.rowStart) / St) * St);
2678
- } else if (Rt === lt) {
2679
- const St = ie.rowEnd + 1 - ie.rowStart;
2680
- Me.rowEnd = ie.rowEnd + Math.ceil(Te / St) * St, Me.rowEnd > Pe.bottom && (Me.rowEnd = Me.rowEnd - Math.ceil((Pe.bottom - Me.rowEnd) / St) * St);
2667
+ typeof et.current == "function" ? de = et.current(ne) : N && (de = N), b = ((ie, _t, F, ke, Pt, Re) => {
2668
+ const Te = { ..._t };
2669
+ if (F.length === 0) return Te;
2670
+ if (Pt === ot) {
2671
+ const bt = ie.colEnd + 1 - ie.colStart;
2672
+ Te.colStart = ie.colStart - Math.ceil(Re / bt) * bt, Te.colStart < ke.left && (Te.colStart = Te.colStart + Math.ceil((ke.left - Te.colStart) / bt) * bt);
2673
+ } else if (Pt === Ke) {
2674
+ const bt = ie.colEnd + 1 - ie.colStart;
2675
+ Te.colEnd = ie.colEnd + Math.ceil(Re / bt) * bt, Te.colEnd > ke.right && (Te.colEnd = Te.colEnd - Math.ceil((ke.right - Te.colEnd) / bt) * bt);
2676
+ } else if (Pt === it) {
2677
+ const bt = ie.rowEnd + 1 - ie.rowStart;
2678
+ Te.rowStart = ie.rowStart - Math.ceil(Re / bt) * bt, Te.rowStart < ke.top && (Te.rowStart = Te.rowStart + Math.ceil((ke.top - Te.rowStart) / bt) * bt);
2679
+ } else if (Pt === lt) {
2680
+ const bt = ie.rowEnd + 1 - ie.rowStart;
2681
+ Te.rowEnd = ie.rowEnd + Math.ceil(Re / bt) * bt, Te.rowEnd > ke.bottom && (Te.rowEnd = Te.rowEnd - Math.ceil((ke.bottom - Te.rowEnd) / bt) * bt);
2681
2682
  }
2682
- return Me;
2683
- })(ne, b, de, we, De.direction, De.amount);
2683
+ return Te;
2684
+ })(ne, b, de, ge, Le.direction, Le.amount);
2684
2685
  }
2685
- if (he && Z.isRangeWithinRange(b, ne) && (b = null), !Z.isEqualRanges(b, on.current)) {
2686
- if (dn(b), on.current = b, !b) {
2686
+ if (he && G.isRangeWithinRange(b, ne) && (b = null), !G.isEqualRanges(b, nn.current)) {
2687
+ if (dn(b), nn.current = b, !b) {
2687
2688
  try {
2688
- K?.();
2689
+ E?.();
2689
2690
  } catch {
2690
2691
  }
2691
- return void pe?.();
2692
+ return void Me?.();
2692
2693
  }
2693
- ge(!1);
2694
+ pe(!1);
2694
2695
  }
2695
- kt.current = h, lo(p, y, e);
2696
- }, onPointerUp: (c, h) => {
2697
- kt.current = h, Promise.resolve(ge(!0)).finally(() => {
2698
- pe?.(), dn(null), on.current = null, xt.current = null, Jt(null), e.current?.focus();
2696
+ Ot.current = u, lo(p, y, e);
2697
+ }, onPointerUp: (c, u) => {
2698
+ Ot.current = u, Promise.resolve(pe(!0)).finally(() => {
2699
+ Me?.(), dn(null), nn.current = null, wt.current = null, on(null), e.current?.focus();
2699
2700
  });
2700
- } }), [A])), Wt = Ee(() => ({ onPointerDown: At }), [At]), [Ce, Ze] = Je(null), $e = J(null), ct = Ee(() => ({ onPointerDown: (c, h) => {
2701
- if (kt.current = h, !e || !e.current) return !1;
2701
+ } }), [L])), Wt = _e(() => ({ onPointerDown: $t }), [$t]), [Ce, Ge] = Ze(null), Ae = Z(null), ct = _e(() => ({ onPointerDown: (c, u) => {
2702
+ if (Ot.current = u, !e || !e.current) return !1;
2702
2703
  const w = e.current.getViewFromClient(c.nativeEvent.clientX, c.nativeEvent.clientY), p = w?.getCellCoordsFromClient(c.nativeEvent.clientX, c.nativeEvent.clientY);
2703
2704
  if (!p) return;
2704
- if (oe?.(c, p, z) === !1) return !1;
2705
- c.stopPropagation(), Jt("default");
2706
- const y = w.getRelativePointFromClient(0, 0), V = ke.current?.ranges[ke.current?.ranges.length - 1] ?? Z.cellToRange(ke.current?.cell), b = w.toClipBounds(w.getRangeCoordsBounds(V)), he = { x: 0, y: 0 };
2707
- b.x - y.x > c.nativeEvent.clientX ? he.x = c.nativeEvent.clientX - (b.x - y.x) : c.nativeEvent.clientX >= b.x - y.x + b.width && (he.x = Math.max(0, c.nativeEvent.clientX - (b.x - y.x + b.width)) + 1), b.y - y.y > c.nativeEvent.clientY ? he.y = c.nativeEvent.clientY - (b.y - y.y) : c.nativeEvent.clientY >= b.y - y.y + b.height && (he.y = Math.max(0, c.nativeEvent.clientY - (b.y - y.y + b.height)) + 1), X?.(V, c.nativeEvent, h), $e.current = { range: V, anchor: w.getAnchor(), cell: p, isMoving: !1, extrusion: he };
2708
- }, onPointerMoveOrWait: (c, h, w) => {
2709
- if (W || !e?.current || !ke.current || !$e.current) return;
2705
+ if (oe?.(c, p, M) === !1) return !1;
2706
+ c.stopPropagation(), on("default");
2707
+ const y = w.getRelativePointFromClient(0, 0), W = ye.current?.ranges[ye.current?.ranges.length - 1] ?? G.cellToRange(ye.current?.cell), b = w.toClipBounds(w.getRangeCoordsBounds(W)), he = { x: 0, y: 0 };
2708
+ b.x - y.x > c.nativeEvent.clientX ? he.x = c.nativeEvent.clientX - (b.x - y.x) : c.nativeEvent.clientX >= b.x - y.x + b.width && (he.x = Math.max(0, c.nativeEvent.clientX - (b.x - y.x + b.width)) + 1), b.y - y.y > c.nativeEvent.clientY ? he.y = c.nativeEvent.clientY - (b.y - y.y) : c.nativeEvent.clientY >= b.y - y.y + b.height && (he.y = Math.max(0, c.nativeEvent.clientY - (b.y - y.y + b.height)) + 1), X?.(W, c.nativeEvent, u), Ae.current = { range: W, anchor: w.getAnchor(), cell: p, isMoving: !1, extrusion: he };
2709
+ }, onPointerMoveOrWait: (c, u, w) => {
2710
+ if (K || !e?.current || !ye.current || !Ae.current) return;
2710
2711
  const p = c.clientX - w.clientX, y = c.clientY - w.clientY;
2711
- if ($e.current.isMoving = $e.current.isMoving || Math.abs(p) > Math.max(1, 2) || Math.abs(y) > Math.max(1, 2) || performance.now() - w.timeStamp > 500, !$e.current.isMoving) return;
2712
- const V = $e.current.anchor, b = $e.current.extrusion;
2713
- let he = e.current.getViewFromLocation(V), ne = he.getCellCoordsFromClient(c.clientX - b.x, c.clientY - b.y, !0);
2712
+ if (Ae.current.isMoving = Ae.current.isMoving || Math.abs(p) > Math.max(1, 2) || Math.abs(y) > Math.max(1, 2) || performance.now() - w.timeStamp > 500, !Ae.current.isMoving) return;
2713
+ const W = Ae.current.anchor, b = Ae.current.extrusion;
2714
+ let he = e.current.getViewFromLocation(W), ne = he.getCellCoordsFromClient(c.clientX - b.x, c.clientY - b.y, !0);
2714
2715
  if (!ne) return;
2715
- const re = $e.current.cell, we = $e.current.range, De = _e(), de = we.colEnd - we.colStart + 1, ie = Math.min(Math.max(0, re.colIndex - we.colStart), de - 1), _t = Math.min(De.right - de + 1, Math.max(De.left, ne.colIndex - ie)), B = we.rowEnd - we.rowStart + 1, Pe = Math.min(Math.max(0, re.rowIndex - we.rowStart), B - 1), Rt = Math.min(De.bottom - B + 1, Math.max(De.top, ne.rowIndex - Pe)), Te = { colStart: _t, colEnd: _t + de - 1, rowStart: Rt, rowEnd: Rt + B - 1 };
2716
- Z.isEqualRanges(Ce, Te) && !((Me) => !Me || !kt.current || kt.current.ctrlKey !== Me.ctrlKey || kt.current.shiftKey !== Me.shiftKey || kt.current.altKey !== Me.altKey || kt.current.metaKey !== Me.metaKey)(c) || (Ze(Te), k?.(Te, c, h)), kt.current = h, lo(he, ne, e);
2717
- }, onPointerUp: (c, h) => {
2718
- kt.current = h;
2716
+ const re = Ae.current.cell, ge = Ae.current.range, Le = Se(), de = ge.colEnd - ge.colStart + 1, ie = Math.min(Math.max(0, re.colIndex - ge.colStart), de - 1), _t = Math.min(Le.right - de + 1, Math.max(Le.left, ne.colIndex - ie)), F = ge.rowEnd - ge.rowStart + 1, ke = Math.min(Math.max(0, re.rowIndex - ge.rowStart), F - 1), Pt = Math.min(Le.bottom - F + 1, Math.max(Le.top, ne.rowIndex - ke)), Re = { colStart: _t, colEnd: _t + de - 1, rowStart: Pt, rowEnd: Pt + F - 1 };
2717
+ G.isEqualRanges(Ce, Re) && !((Te) => !Te || !Ot.current || Ot.current.ctrlKey !== Te.ctrlKey || Ot.current.shiftKey !== Te.shiftKey || Ot.current.altKey !== Te.altKey || Ot.current.metaKey !== Te.metaKey)(c) || (Ge(Re), T?.(Re, c, u)), Ot.current = u, lo(he, ne, e);
2718
+ }, onPointerUp: (c, u) => {
2719
+ Ot.current = u;
2719
2720
  const w = () => {
2720
- Ze(null), $e.current = null, Jt(null), e.current?.focus();
2721
+ Ge(null), Ae.current = null, on(null), e.current?.focus();
2721
2722
  };
2722
- if (!$e.current) return void w();
2723
- const p = $e.current.range, y = Ce;
2724
- u?.(p, c, h), Promise.resolve(p && y && C?.(p, y, c, h)).finally(() => {
2723
+ if (!Ae.current) return void w();
2724
+ const p = Ae.current.range, y = Ce;
2725
+ S?.(p, c, u), Promise.resolve(p && y && h?.(p, y, c, u)).finally(() => {
2725
2726
  w();
2726
2727
  });
2727
- } }), [Ce]), Oe = On(ct), Et = Ee(() => ({ onPointerDown: Oe }), [Oe]), bt = J(null), $t = Ee(() => {
2728
- const c = Z.isEqualSelectionCoords(z, bt.current) ? bt.current : z;
2729
- return bt.current = c, c;
2730
- }, [z]), Kt = O((c) => {
2731
- let h = null, w = "br";
2732
- const p = [], y = { stroke: I, fill: xe, strokeWidth: 0.5 }, V = (de, ie, _t) => {
2733
- const B = c.toClipBounds(c.getRangeCoordsBounds(de), tn);
2734
- if (!B) return;
2735
- B.x = B.width > 0 ? B.x : B.x - y.strokeWidth / 2, B.y = B.height > 0 ? B.y : B.y - y.strokeWidth / 2, B.width = Math.max(B.width, y.strokeWidth), B.height = Math.max(B.height, y.strokeWidth);
2736
- const Pe = { key: `selection-fill-${ie}`, range: de, ...B, ...y };
2728
+ } }), [Ce]), Pe = On(ct), Et = _e(() => ({ onPointerDown: Pe }), [Pe]), yt = Z(null), Bt = _e(() => {
2729
+ const c = G.isEqualSelectionCoords(M, yt.current) ? yt.current : M;
2730
+ return yt.current = c, c;
2731
+ }, [M]), qt = D((c) => {
2732
+ let u = null, w = "br";
2733
+ const p = [], y = { stroke: I, fill: te, strokeWidth: 0.5 }, W = (de, ie, _t) => {
2734
+ const F = c.toClipBounds(c.getRangeCoordsBounds(de), en);
2735
+ if (!F) return;
2736
+ F.x = F.width > 0 ? F.x : F.x - y.strokeWidth / 2, F.y = F.height > 0 ? F.y : F.y - y.strokeWidth / 2, F.width = Math.max(F.width, y.strokeWidth), F.height = Math.max(F.height, y.strokeWidth);
2737
+ const ke = { key: `selection-fill-${ie}`, range: de, ...F, ...y };
2737
2738
  if (_t) {
2738
- const Rt = c.getCellCoordsAsRangeCoords(_t);
2739
- Pe.cell = _t, Pe.pathBounds = c.toClipBounds(c.getRangeCoordsBounds(Rt), tn), Pe.pathBounds && (Pe.pathBounds.width <= 0 || Pe.pathBounds.height <= 0) && (delete Pe.pathBounds, delete Pe.cell);
2739
+ const Pt = c.getCellCoordsAsRangeCoords(_t);
2740
+ ke.cell = _t, ke.pathBounds = c.toClipBounds(c.getRangeCoordsBounds(Pt), en), ke.pathBounds && (ke.pathBounds.width <= 0 || ke.pathBounds.height <= 0) && (delete ke.pathBounds, delete ke.cell);
2740
2741
  }
2741
- return Re(Pe);
2742
+ return me(ke);
2742
2743
  };
2743
- let b = z ? Yt(z) : null;
2744
+ let b = M ? Yt(M) : null;
2744
2745
  const he = b?.cell ? c.getCellCoordsAsRangeCoords(b?.cell) : Ql;
2745
2746
  !b || b.ranges && b.ranges.length !== 0 || (b = { ranges: [he], rangeIndex: 0, cell: b.cell });
2746
2747
  for (let de = 0; b && de < b.ranges.length; de++) {
2747
- const ie = b.ranges[de], _t = V(ie, de, de === b.rangeIndex ? b.cell : null);
2748
+ const ie = b.ranges[de], _t = W(ie, de, de === b.rangeIndex ? b.cell : null);
2748
2749
  _t && p.push(_t);
2749
- const B = 2, Pe = 0.5, Rt = c.toClipBounds(c.getRangeCoordsBounds(ie, { top: 0, left: 0, right: 0, bottom: 0 }), tn);
2750
- if (Rt) {
2751
- const Te = (b.ranges.length, 4);
2752
- p.push(Re({ range: ie, key: `selection-inside-edge-${de}`, x: Rt.x - 1, y: Rt.y - 1, width: Math.max(Rt.width + 1, 0), height: Math.max(Rt.height + 1, 0), style: { overflow: "hidden" }, stroke: I, strokeWidth: Te }));
2750
+ const F = 2, ke = 0.5, Pt = c.toClipBounds(c.getRangeCoordsBounds(ie, { top: 0, left: 0, right: 0, bottom: 0 }), en);
2751
+ if (Pt) {
2752
+ const Re = (b.ranges.length, 4);
2753
+ p.push(me({ range: ie, key: `selection-inside-edge-${de}`, x: Pt.x - 1, y: Pt.y - 1, width: Math.max(Pt.width + 1, 0), height: Math.max(Pt.height + 1, 0), style: { overflow: "hidden" }, stroke: I, strokeWidth: Re }));
2753
2754
  }
2754
2755
  if (b.ranges.length === 1) {
2755
- const Te = c.toClipBounds(c.getRangeCoordsBounds(ie), tn);
2756
- if (Te) {
2757
- W || p.push(Re({ range: ie, key: `move-selection-hit-box-${de}`, x: Te.width > 1 ? Te.x : Te.x - (q / 2 + 1), y: Te.height > 1 ? Te.y : Te.y - (q / 2 + 1), width: Math.max(Te.width + 2, 1), height: Math.max(Te.height + 2, 1), stroke: "transparent", style: { boxShadow: "none" }, pathProps: { cursor: Ce ? void 0 : "move", pointerEvents: "stroke" }, strokeWidth: q, ...Et }));
2758
- const Me = B;
2759
- p.push(Re({ range: ie, key: `selection-single-${de}`, x: Te.x - Me / 2, y: Te.y - Me / 2, width: Math.max(Te.width + Me / 2, 1), height: Math.max(Te.height + Me / 2, 1), stroke: G, strokeWidth: Me }));
2756
+ const Re = c.toClipBounds(c.getRangeCoordsBounds(ie), en);
2757
+ if (Re) {
2758
+ K || p.push(me({ range: ie, key: `move-selection-hit-box-${de}`, x: Re.width > 1 ? Re.x : Re.x - (U / 2 + 1), y: Re.height > 1 ? Re.y : Re.y - (U / 2 + 1), width: Math.max(Re.width + 2, 1), height: Math.max(Re.height + 2, 1), stroke: "transparent", style: { boxShadow: "none" }, pathProps: { cursor: Ce ? void 0 : "move", pointerEvents: "stroke" }, strokeWidth: U, ...Et }));
2759
+ const Te = F;
2760
+ p.push(me({ range: ie, key: `selection-single-${de}`, x: Re.x - Te / 2, y: Re.y - Te / 2, width: Math.max(Re.width + Te / 2, 1), height: Math.max(Re.height + Te / 2, 1), stroke: Y, strokeWidth: Te }));
2760
2761
  }
2761
2762
  } else {
2762
- const Te = c.toClipBounds(c.getRangeCoordsBounds(ie, { top: -1, left: -1, right: -2, bottom: -2 }), tn);
2763
- Te && p.push(Re({ range: ie, key: `selection-multi-${de}`, x: Te.width > 1 ? Te.x : Te.x - Pe / 2, y: Te.height > 1 ? Te.y : Te.y - Pe / 2, width: Math.max(Te.width, Pe) + 1, height: Math.max(Te.height, Pe) + 1, stroke: G, style: { overflow: "hidden" }, strokeWidth: 2 }));
2763
+ const Re = c.toClipBounds(c.getRangeCoordsBounds(ie, { top: -1, left: -1, right: -2, bottom: -2 }), en);
2764
+ Re && p.push(me({ range: ie, key: `selection-multi-${de}`, x: Re.width > 1 ? Re.x : Re.x - ke / 2, y: Re.height > 1 ? Re.y : Re.y - ke / 2, width: Math.max(Re.width, ke) + 1, height: Math.max(Re.height, ke) + 1, stroke: Y, style: { overflow: "hidden" }, strokeWidth: 2 }));
2764
2765
  }
2765
2766
  if (b.ranges.length > 1 && de === b.rangeIndex) {
2766
- const Te = c.getCellCoordsAsRangeCoords(b.cell), Me = c.toClipBounds(c.getRangeCoordsBounds(Te, { top: 1, left: 1, right: -1, bottom: -1 }), tn);
2767
- Me && p.push(Re({ range: ie, key: `selection-anchor-${de}`, x: Me.x, y: Me.y, width: Math.max(Me.width, Pe), height: Math.max(Me.height, Pe), stroke: G, style: { overflow: "hidden" }, strokeWidth: 2 }));
2767
+ const Re = c.getCellCoordsAsRangeCoords(b.cell), Te = c.toClipBounds(c.getRangeCoordsBounds(Re, { top: 1, left: 1, right: -1, bottom: -1 }), en);
2768
+ Te && p.push(me({ range: ie, key: `selection-anchor-${de}`, x: Te.x, y: Te.y, width: Math.max(Te.width, ke), height: Math.max(Te.height, ke), stroke: Y, style: { overflow: "hidden" }, strokeWidth: 2 }));
2768
2769
  }
2769
2770
  if (de === b.ranges.length - 1) {
2770
- h = null, w = null;
2771
- const Te = ie.rowStart === _e().top && ie.rowEnd === _e().bottom, Me = ie.colStart === _e().left && ie.colEnd === _e().right, St = c.getRangeCoordsBounds(ie);
2772
- let en = null;
2773
- if (Te || Me) {
2774
- if (en = c.toClipBounds(St, tn), Object.keys(c.allViews()).length > 1) {
2771
+ u = null, w = null;
2772
+ const Re = ie.rowStart === Se().top && ie.rowEnd === Se().bottom, Te = ie.colStart === Se().left && ie.colEnd === Se().right, bt = c.getRangeCoordsBounds(ie);
2773
+ let Qt = null;
2774
+ if (Re || Te) {
2775
+ if (Qt = c.toClipBounds(bt, en), Object.keys(c.allViews()).length > 1) {
2775
2776
  const eo = c.getVisibleRangeCoords(), nr = c.allViews()[uo], ki = c.allViews()[Hn], Pi = c.allViews()[Nn], to = c.getAnchor();
2776
- (Me && (to === Hn && nr || to === Xt && Pi || !Z.isCellWithinRange({ colIndex: ie.colStart, rowIndex: ie.rowEnd }, eo) && !Z.isCellWithinRange({ colIndex: ie.colStart, rowIndex: ie.rowEnd + 1 }, eo)) || Te && (to === Nn && nr || to === Xt && ki || !Z.isCellWithinRange({ colIndex: ie.colEnd, rowIndex: ie.rowStart }, eo) && !Z.isCellWithinRange({ colIndex: ie.colEnd + 1, rowIndex: ie.rowStart }, eo))) && (en = null);
2777
+ (Te && (to === Hn && nr || to === Xt && Pi || !G.isCellWithinRange({ colIndex: ie.colStart, rowIndex: ie.rowEnd }, eo) && !G.isCellWithinRange({ colIndex: ie.colStart, rowIndex: ie.rowEnd + 1 }, eo)) || Re && (to === Nn && nr || to === Xt && ki || !G.isCellWithinRange({ colIndex: ie.colEnd, rowIndex: ie.rowStart }, eo) && !G.isCellWithinRange({ colIndex: ie.colEnd + 1, rowIndex: ie.rowStart }, eo))) && (Qt = null);
2777
2778
  }
2778
- } else en = c.toClipBounds(St, tn);
2779
- if (!en || en.width === 0 || en.height === 0) continue;
2780
- h = { x: en.x + en.width + 1, y: en.y + en.height + 1 }, en.width === 0 || en.height === 0 || ie.rowStart === _e().top && ie.colStart === _e().left && ie.rowEnd === _e().bottom && ie.colEnd === _e().right || (Te ? (h.y = B, w = "tr") : Me && (h.x = B, w = "bl"));
2779
+ } else Qt = c.toClipBounds(bt, en);
2780
+ if (!Qt || Qt.width === 0 || Qt.height === 0) continue;
2781
+ u = { x: Qt.x + Qt.width + 1, y: Qt.y + Qt.height + 1 }, Qt.width === 0 || Qt.height === 0 || ie.rowStart === Se().top && ie.colStart === Se().left && ie.rowEnd === Se().bottom && ie.colEnd === Se().right || (Re ? (u.y = F, w = "tr") : Te && (u.x = F, w = "bl"));
2781
2782
  }
2782
2783
  }
2783
2784
  let ne = null;
2784
- if (ze) {
2785
- const de = c.toClipBounds(c.getRangeCoordsBounds(ze, { top: 0, left: 0, right: 0, bottom: 0 }), tn);
2786
- de && (ne = Re({ ...y, range: ze, key: "remove-selection", x: de.x, y: de.y, width: de.width, height: de.height, strokeWidth: 2, stroke: He, fill: Ue }));
2785
+ if (De) {
2786
+ const de = c.toClipBounds(c.getRangeCoordsBounds(De, { top: 0, left: 0, right: 0, bottom: 0 }), en);
2787
+ de && (ne = me({ ...y, range: De, key: "remove-selection", x: de.x, y: de.y, width: de.width, height: de.height, strokeWidth: 2, stroke: He, fill: je }));
2787
2788
  }
2788
2789
  let re = null;
2789
- if (jt) {
2790
- const de = c.toClipBounds(c.getRangeCoordsBounds(jt, { top: 0, left: 0, right: 0, bottom: 0 }), tn);
2791
- de && (re = Re({ range: jt, key: "selection-fill-outline", x: de.x - 2 / 2, y: de.y - 2 / 2, width: de.width + 2 / 2, height: de.height + 2 / 2, strokeWidth: 2, stroke: G, strokeDasharray: "3 2" }));
2790
+ if (Mt) {
2791
+ const de = c.toClipBounds(c.getRangeCoordsBounds(Mt, { top: 0, left: 0, right: 0, bottom: 0 }), en);
2792
+ de && (re = me({ range: Mt, key: "selection-fill-outline", x: de.x - 2 / 2, y: de.y - 2 / 2, width: de.width + 2 / 2, height: de.height + 2 / 2, strokeWidth: 2, stroke: Y, strokeDasharray: "3 2" }));
2792
2793
  }
2793
- let we = null;
2794
- !E && h && !Ce && (we = Jo(Si, { ...h, corner: w, size: 7.5, borderStroke: `${I} solid`, style: { borderRadius: 1 }, background: G, ...Wt, key: "fillHandle" }));
2795
- const De = [...p];
2796
- if (ne && De.push(ne), re && De.push(re), we && De.push(we), !We && Mt && b?.ranges.length === 1 && b.ranges[b.ranges.length - 1]) {
2797
- const de = b.ranges[b.ranges.length - 1], ie = de.rowStart === _e().top && de.rowEnd === _e().bottom, _t = de.colStart === _e().left && de.colEnd === _e().right, B = { view: c, range: de, borderStroke: `${G} solid`, background: I, selectionTouchPointerHandler: xo, ...ht, onTouchSelectStart: (Pe) => un(Pe), onTouchSelectEnd: () => un(null), currentTouchAnchor: Cn };
2798
- De.push(Y(Go, { anchor: _t ? "b" : ie ? "r" : "br", scrollableElement: e.current, ...B }, "touch-select-handle-after")), De.push(Y(Go, { anchor: _t ? "t" : ie ? "l" : "tl", scrollableElement: e.current, ...B }, "touch-select-handle-before"));
2794
+ let ge = null;
2795
+ !_ && u && !Ce && (ge = Jo(Si, { ...u, corner: w, size: 7.5, borderStroke: `${I} solid`, style: { borderRadius: 1 }, background: Y, ...Wt, key: "fillHandle" }));
2796
+ const Le = [...p];
2797
+ if (ne && Le.push(ne), re && Le.push(re), ge && Le.push(ge), !Ne && Tt && b?.ranges.length === 1 && b.ranges[b.ranges.length - 1]) {
2798
+ const de = b.ranges[b.ranges.length - 1], ie = de.rowStart === Se().top && de.rowEnd === Se().bottom, _t = de.colStart === Se().left && de.colEnd === Se().right, F = { view: c, range: de, borderStroke: `${Y} solid`, background: I, selectionTouchPointerHandler: xo, ...at, onTouchSelectStart: (ke) => un(ke), onTouchSelectEnd: () => un(null), currentTouchAnchor: Cn };
2799
+ Le.push(q(Go, { anchor: _t ? "b" : ie ? "r" : "br", scrollableElement: e.current, ...F }, "touch-select-handle-after")), Le.push(q(Go, { anchor: _t ? "t" : ie ? "l" : "tl", scrollableElement: e.current, ...F }, "touch-select-handle-before"));
2799
2800
  }
2800
2801
  if (Ce) {
2801
- const de = c.toClipBounds(c.getRangeCoordsBounds(Ce, { top: 1, left: 1, right: 1, bottom: 1 }), tn);
2802
- de && De.push(Re({ range: Ce, key: "selection-move-outline", x: de.x - N / 2, y: de.y - N / 2, width: Math.max(de.width + N / 2, 1), height: Math.max(de.height + N / 2, 1), stroke: G, style: { boxShadow: "none", transitionDuration: "70ms", transitionTimingFunction: "ease-in", transitionProperty: "left, top, width, height", willChange: "left, top, width, height" }, strokeWidth: N }));
2802
+ const de = c.toClipBounds(c.getRangeCoordsBounds(Ce, { top: 1, left: 1, right: 1, bottom: 1 }), en);
2803
+ de && Le.push(me({ range: Ce, key: "selection-move-outline", x: de.x - ee / 2, y: de.y - ee / 2, width: Math.max(de.width + ee / 2, 1), height: Math.max(de.height + ee / 2, 1), stroke: Y, style: { boxShadow: "none", transitionDuration: "70ms", transitionTimingFunction: "ease-in", transitionProperty: "left, top, width, height", willChange: "left, top, width, height" }, strokeWidth: ee }));
2803
2804
  }
2804
- return Y("div", { children: De }, "selection");
2805
- }, [$t, ze, E, jt, W, Ce, _e, I, G, xe, He, Ue, We, ht, Cn]), Ot = Ee(() => {
2805
+ return q("div", { children: Le }, "selection");
2806
+ }, [Bt, De, _, Mt, K, Ce, Se, I, Y, te, He, je, Ne, at, Cn]), Dt = _e(() => {
2806
2807
  const c = () => e.current;
2807
- return [new Se("moveToPageDown", c, { label: "Page Down", description: "Shift viewport down one page.", shortcut: [{ key: "PageDown" }] }, () => Xn(!1)), new Se("selectToPageDown", c, { label: "Select To Page Down", description: "Shift viewport and select down one page.", shortcut: [{ key: "PageDown", modifiers: [It] }] }, () => Xn(!0)), new Se("moveToPageRight", c, { label: "Page Right", description: "Shift viewport right one page.", shortcut: [{ key: "PageDown", modifiers: [yn] }] }, () => Gn(!1)), new Se("selectToPageRight", c, { label: "Page Right", description: "Shift viewport right one page.", shortcut: [{ key: "PageDown", modifiers: [yn, It] }] }, () => Gn(!0)), new Se("moveToPageUp", c, { label: "Page Up", description: "Shift viewport up one page.", shortcut: [{ key: "PageUp" }] }, () => Qt(!1)), new Se("selectToPageUp", c, { label: "Page Up", description: "Shift viewport up one page.", shortcut: [{ key: "PageUp", modifiers: [It] }] }, () => Qt(!0)), new Se("moveToPageLeft", c, { label: "Page Left", description: "Shift viewport left one page.", shortcut: [{ key: "PageUp", modifiers: [yn] }] }, () => $n(!1)), new Se("selectToPageLeft", c, { label: "Page Left", description: "Shift viewport left one page.", shortcut: [{ key: "PageUp", modifiers: [yn, It] }] }, () => $n(!0)), new Se("selectColumn", c, { label: "Select Column", description: "Select the columns for the selected cells.", shortcut: { key: "Space", modifiers: [Lt] } }, vo), new Se("selectRow", c, { label: "Select Row", description: "Select the rows for the selected cells.", shortcut: { key: "Space", modifiers: [It] } }, yo), new Se("selectToColumnStart", c, { label: "Select To Column Start", description: "Select the columns to the beginning of the sheet." }, () => Kn(!0)), new Se("selectToColumnEnd", c, { label: "Select To Column End", description: "Select the columns to the end of the sheet." }, () => Yn(!0)), new Se("moveToRowStart", c, { label: "Move to Row Home", description: "Move to the beginning of the row.", shortcut: [{ key: "Home" }] }, () => Dn(!1)), new Se("selectToRowStart", c, { label: "Select to Row Home", description: "Select to the beginning of the row.", shortcut: [{ key: "Home", modifiers: [It] }] }, () => Dn(!0)), new Se("moveToSheetStart", c, { label: "Move to Sheet Home", description: "Move to the beginning of the sheet.", shortcut: [{ key: "Home", modifiers: [Lt] }] }, () => Mn(!1)), new Se("selectToSheetStart", c, { label: "Select to Sheet Home", description: "Select to the beginning of the sheet.", shortcut: [{ key: "Home", modifiers: [Lt, It] }] }, () => Mn(!0)), new Se("moveToRowEnd", c, { label: "Move to Row End", description: "Move to the end of the row.", shortcut: [{ key: "End" }] }, () => zn(!1)), new Se("selectToRowEnd", c, { label: "Select to Row End", description: "Select to the end of the row.", shortcut: [{ key: "End", modifiers: [It] }] }, () => zn(!0)), new Se("moveToSheetEnd", c, { label: "Move to Sheet End", description: "Move to the end of the sheet.", shortcut: [{ key: "End", modifiers: [Lt] }] }, () => vn(!1)), new Se("selectToSheetEnd", c, { label: "Select to Sheet End", description: "Select to the end of the sheet.", shortcut: [{ key: "End", modifiers: [Lt, It] }] }, () => vn(!0)), new Se("scrollToActiveCoords", c, { label: "Scroll to Active Cell", description: "Scroll to the Active Cell.", shortcut: { key: "Backspace", modifiers: [Lt] } }, xn), new Se("scrollToActiveCoordsClearSelection", c, { label: "Scroll to Active Cell", description: "Scroll to the Active Cell and clear selection.", shortcut: { key: "Backspace", modifiers: [It] } }, () => {
2808
- rn(), yt(z.cell, !0);
2809
- }), new Se("traverseSelectionRight", c, { label: "Traverse Right", description: "Traverse the selection moving rightward.", shortcut: { key: "Tab" } }, Jn), new Se("traverseSelectionLeft", c, { label: "Traverse Left", description: "Traverse the selection moving leftward.", shortcut: { key: "Tab", modifiers: [It] } }, Zn), new Se("traverseSelectionDown", c, { label: "Traverse Down", description: "Traverse the selection moving downward.", shortcut: [{ key: "Enter" }, { key: "NumpadEnter" }] }, _o), new Se("traverseSelectionUp", c, { label: "Traverse Up", description: "Traverse the selection moving upward.", shortcut: [{ key: "Enter", modifiers: [It] }, { key: "NumpadEnter", modifiers: [It] }] }, Eo), new Se("moveLeft", c, { label: "Move Left", description: "Move active cell to the left.", shortcut: [{ key: "ArrowLeft" }] }, Qn), new Se("selectLeft", c, { label: "Select Left", description: "Extend selection left.", shortcut: [{ key: "ArrowLeft", modifiers: [It] }] }, v), new Se("moveContentfulLeft", c, { label: "Move Left Contentful", description: "Move left to the next cell with content.", shortcut: [{ key: "ArrowLeft", modifiers: [Lt] }] }, P), new Se("selectContentfulLeft", c, { label: "Select Left Contentful", description: "Extend selection left to the next cell with content.", shortcut: [{ key: "ArrowLeft", modifiers: [Lt, It] }] }, D), new Se("moveRight", c, { label: "Move Right", description: "Move active cell to the right.", shortcut: [{ key: "ArrowRight" }] }, F), new Se("selectRight", c, { label: "Select Right", description: "Extend selection right.", shortcut: [{ key: "ArrowRight", modifiers: [It] }] }, j), new Se("moveContentfulRight", c, { label: "Move Right Contentful", description: "Move right to the next cell with content.", shortcut: [{ key: "ArrowRight", modifiers: [Lt] }] }, fe), new Se("selectContentfulRight", c, { label: "Select Right Contentful", description: "Extend selection right to the next cell with content.", shortcut: [{ key: "ArrowRight", modifiers: [Lt, It] }] }, se), new Se("moveUp", c, { label: "Move Up", description: "Move active cell to the up.", shortcut: [{ key: "ArrowUp" }] }, ve), new Se("selectUp", c, { label: "Select Up", description: "Extend selection up.", shortcut: [{ key: "ArrowUp", modifiers: [It] }] }, ye), new Se("moveContentfulUp", c, { label: "Move Up Contentful", description: "Move up to the next cell with content.", shortcut: [{ key: "ArrowUp", modifiers: [Lt] }] }, ce), new Se("selectContentfulUp", c, { label: "Select Up Contentful", description: "Extend selection up to the next cell with content.", shortcut: [{ key: "ArrowUp", modifiers: [Lt, It] }] }, Ve), new Se("moveDown", c, { label: "Move Down", description: "Move active cell to the down.", shortcut: [{ key: "ArrowDown" }] }, ut), new Se("selectDown", c, { label: "Select Down", description: "Extend selection down.", shortcut: [{ key: "ArrowDown", modifiers: [It] }] }, Fe), new Se("moveContentfulDown", c, { label: "Move Down Contentful", description: "Move down to the next cell with content.", shortcut: [{ key: "ArrowDown", modifiers: [Lt] }] }, je), new Se("selectContentfulDown", c, { label: "Select Down Contentful", description: "Extend selection down to the next cell with content.", shortcut: [{ key: "ArrowDown", modifiers: [Lt, It] }] }, mt), new Se("selectVisible", c, { label: "Select Visible", description: "Select visible cells only.", shortcut: { key: ";", modifiers: [yn] } }, bo), new Se("traverseSelectionPreviousRange", c, { label: "Traverse Previous Range", description: "Traverse the selection to the previous range.", shortcut: { key: "ArrowLeft", modifiers: [Lt, yn] } }, Bn), new Se("traverseSelectionNextRange", c, { label: "Traverse Next Range", description: "Traverse the selection to the next range.", shortcut: { key: "ArrowRight", modifiers: [Lt, yn] } }, Io), new Se("traverseSelectionCorners", c, { label: "Traverse Corners", description: "Traverse the selection through the corners of the selected range.", shortcut: { key: ".", modifiers: [Lt] } }, Co)];
2808
+ return [new Ee("moveToPageDown", c, { label: "Page Down", description: "Shift viewport down one page.", shortcut: [{ key: "PageDown" }] }, () => Xn(!1)), new Ee("selectToPageDown", c, { label: "Select To Page Down", description: "Shift viewport and select down one page.", shortcut: [{ key: "PageDown", modifiers: [It] }] }, () => Xn(!0)), new Ee("moveToPageRight", c, { label: "Page Right", description: "Shift viewport right one page.", shortcut: [{ key: "PageDown", modifiers: [yn] }] }, () => Gn(!1)), new Ee("selectToPageRight", c, { label: "Page Right", description: "Shift viewport right one page.", shortcut: [{ key: "PageDown", modifiers: [yn, It] }] }, () => Gn(!0)), new Ee("moveToPageUp", c, { label: "Page Up", description: "Shift viewport up one page.", shortcut: [{ key: "PageUp" }] }, () => Jt(!1)), new Ee("selectToPageUp", c, { label: "Page Up", description: "Shift viewport up one page.", shortcut: [{ key: "PageUp", modifiers: [It] }] }, () => Jt(!0)), new Ee("moveToPageLeft", c, { label: "Page Left", description: "Shift viewport left one page.", shortcut: [{ key: "PageUp", modifiers: [yn] }] }, () => $n(!1)), new Ee("selectToPageLeft", c, { label: "Page Left", description: "Shift viewport left one page.", shortcut: [{ key: "PageUp", modifiers: [yn, It] }] }, () => $n(!0)), new Ee("selectColumn", c, { label: "Select Column", description: "Select the columns for the selected cells.", shortcut: { key: "Space", modifiers: [zt] } }, vo), new Ee("selectRow", c, { label: "Select Row", description: "Select the rows for the selected cells.", shortcut: { key: "Space", modifiers: [It] } }, yo), new Ee("selectToColumnStart", c, { label: "Select To Column Start", description: "Select the columns to the beginning of the sheet." }, () => qn(!0)), new Ee("selectToColumnEnd", c, { label: "Select To Column End", description: "Select the columns to the end of the sheet." }, () => Yn(!0)), new Ee("moveToRowStart", c, { label: "Move to Row Home", description: "Move to the beginning of the row.", shortcut: [{ key: "Home" }] }, () => Dn(!1)), new Ee("selectToRowStart", c, { label: "Select to Row Home", description: "Select to the beginning of the row.", shortcut: [{ key: "Home", modifiers: [It] }] }, () => Dn(!0)), new Ee("moveToSheetStart", c, { label: "Move to Sheet Home", description: "Move to the beginning of the sheet.", shortcut: [{ key: "Home", modifiers: [zt] }] }, () => Mn(!1)), new Ee("selectToSheetStart", c, { label: "Select to Sheet Home", description: "Select to the beginning of the sheet.", shortcut: [{ key: "Home", modifiers: [zt, It] }] }, () => Mn(!0)), new Ee("moveToRowEnd", c, { label: "Move to Row End", description: "Move to the end of the row.", shortcut: [{ key: "End" }] }, () => zn(!1)), new Ee("selectToRowEnd", c, { label: "Select to Row End", description: "Select to the end of the row.", shortcut: [{ key: "End", modifiers: [It] }] }, () => zn(!0)), new Ee("moveToSheetEnd", c, { label: "Move to Sheet End", description: "Move to the end of the sheet.", shortcut: [{ key: "End", modifiers: [zt] }] }, () => vn(!1)), new Ee("selectToSheetEnd", c, { label: "Select to Sheet End", description: "Select to the end of the sheet.", shortcut: [{ key: "End", modifiers: [zt, It] }] }, () => vn(!0)), new Ee("scrollToActiveCoords", c, { label: "Scroll to Active Cell", description: "Scroll to the Active Cell.", shortcut: { key: "Backspace", modifiers: [zt] } }, xn), new Ee("scrollToActiveCoordsClearSelection", c, { label: "Scroll to Active Cell", description: "Scroll to the Active Cell and clear selection.", shortcut: { key: "Backspace", modifiers: [It] } }, () => {
2809
+ rn(), vt(M.cell, !0);
2810
+ }), new Ee("traverseSelectionRight", c, { label: "Traverse Right", description: "Traverse the selection moving rightward.", shortcut: { key: "Tab" } }, Jn), new Ee("traverseSelectionLeft", c, { label: "Traverse Left", description: "Traverse the selection moving leftward.", shortcut: { key: "Tab", modifiers: [It] } }, Zn), new Ee("traverseSelectionDown", c, { label: "Traverse Down", description: "Traverse the selection moving downward.", shortcut: [{ key: "Enter" }, { key: "NumpadEnter" }] }, _o), new Ee("traverseSelectionUp", c, { label: "Traverse Up", description: "Traverse the selection moving upward.", shortcut: [{ key: "Enter", modifiers: [It] }, { key: "NumpadEnter", modifiers: [It] }] }, Eo), new Ee("moveLeft", c, { label: "Move Left", description: "Move active cell to the left.", shortcut: [{ key: "ArrowLeft" }] }, Qn), new Ee("selectLeft", c, { label: "Select Left", description: "Extend selection left.", shortcut: [{ key: "ArrowLeft", modifiers: [It] }] }, v), new Ee("moveContentfulLeft", c, { label: "Move Left Contentful", description: "Move left to the next cell with content.", shortcut: [{ key: "ArrowLeft", modifiers: [zt] }] }, O), new Ee("selectContentfulLeft", c, { label: "Select Left Contentful", description: "Extend selection left to the next cell with content.", shortcut: [{ key: "ArrowLeft", modifiers: [zt, It] }] }, A), new Ee("moveRight", c, { label: "Move Right", description: "Move active cell to the right.", shortcut: [{ key: "ArrowRight" }] }, j), new Ee("selectRight", c, { label: "Select Right", description: "Extend selection right.", shortcut: [{ key: "ArrowRight", modifiers: [It] }] }, V), new Ee("moveContentfulRight", c, { label: "Move Right Contentful", description: "Move right to the next cell with content.", shortcut: [{ key: "ArrowRight", modifiers: [zt] }] }, fe), new Ee("selectContentfulRight", c, { label: "Select Right Contentful", description: "Extend selection right to the next cell with content.", shortcut: [{ key: "ArrowRight", modifiers: [zt, It] }] }, se), new Ee("moveUp", c, { label: "Move Up", description: "Move active cell to the up.", shortcut: [{ key: "ArrowUp" }] }, xe), new Ee("selectUp", c, { label: "Select Up", description: "Extend selection up.", shortcut: [{ key: "ArrowUp", modifiers: [It] }] }, be), new Ee("moveContentfulUp", c, { label: "Move Up Contentful", description: "Move up to the next cell with content.", shortcut: [{ key: "ArrowUp", modifiers: [zt] }] }, ce), new Ee("selectContentfulUp", c, { label: "Select Up Contentful", description: "Extend selection up to the next cell with content.", shortcut: [{ key: "ArrowUp", modifiers: [zt, It] }] }, Fe), new Ee("moveDown", c, { label: "Move Down", description: "Move active cell to the down.", shortcut: [{ key: "ArrowDown" }] }, ft), new Ee("selectDown", c, { label: "Select Down", description: "Extend selection down.", shortcut: [{ key: "ArrowDown", modifiers: [It] }] }, $e), new Ee("moveContentfulDown", c, { label: "Move Down Contentful", description: "Move down to the next cell with content.", shortcut: [{ key: "ArrowDown", modifiers: [zt] }] }, Be), new Ee("selectContentfulDown", c, { label: "Select Down Contentful", description: "Extend selection down to the next cell with content.", shortcut: [{ key: "ArrowDown", modifiers: [zt, It] }] }, gt), new Ee("selectVisible", c, { label: "Select Visible", description: "Select visible cells only.", shortcut: { key: ";", modifiers: [yn] } }, bo), new Ee("traverseSelectionPreviousRange", c, { label: "Traverse Previous Range", description: "Traverse the selection to the previous range.", shortcut: { key: "ArrowLeft", modifiers: [zt, yn] } }, Bn), new Ee("traverseSelectionNextRange", c, { label: "Traverse Next Range", description: "Traverse the selection to the next range.", shortcut: { key: "ArrowRight", modifiers: [zt, yn] } }, Io), new Ee("traverseSelectionCorners", c, { label: "Traverse Corners", description: "Traverse the selection through the corners of the selected range.", shortcut: { key: ".", modifiers: [zt] } }, Co)];
2810
2811
  }, []);
2811
- return Ee(() => {
2812
- t?.addCommands(Ot, !0);
2813
- }, [t]), { selection: $t, setSelectionCell: yt, setSelectionRanges: Xe, overlay: Kt, cursor: an, onPointerDown: mo, clearLastSelection: Ge, newSelection: tt, modifySelection: rt, appendSelection: Ae, clearSelections: rn, isEntire: Pt, navigate: ft, navigateSelection: ln };
2812
+ return _e(() => {
2813
+ t?.addCommands(Dt, !0);
2814
+ }, [t]), { selection: Bt, setSelectionCell: vt, setSelectionRanges: mt, overlay: qt, cursor: cn, onPointerDown: mo, clearLastSelection: Xe, newSelection: tt, modifySelection: rt, appendSelection: ze, clearSelections: rn, isEntire: Lt, navigate: pt, navigateSelection: ln };
2814
2815
  };
2815
2816
  function ao(e, t) {
2816
2817
  if (!e) throw new Error("Invariant failed");
2817
2818
  }
2818
- const Wr = { "sheetxl-grid": "_sheetxl-grid_11irg_13" }, ts = Object.freeze({ top: 0, left: 0 }), ns = Object.freeze({ bottom: -4, right: -4 }), os = Object.freeze({ horizontal: !0, vertical: !0 }), Hr = [uo, Hn, Nn, Xt], xs = 150, sn = 3e3, Fo = {}, Ci = Dt(Ut((e, t) => {
2819
- const { width: n, height: o, rowCount: r = 1, columnCount: i = 1, defaultRowHeight: l, defaultColumnWidth: s, getRowHeight: a, getColumnWidth: d, layout: g, onViewportScroll: m, onImmediateScroll: f, showGridLines: x = !0, gridLineColor: E = "rgb(224, 224, 224)", gridLineRowsProps: I, gridLineColumnsProps: M, clipCells: ae = !0, cursor: R, freezeLeft: _ = 0, freezeTop: L = 0, freezeLeftProps: le, freezeTopProps: $, cellRenderer: oe, onViewportChange: be, onFirstRender: U, overlayRenderer: H, overlayProps: X, overlays: k, overlaysProps: u, allowOverlaysOverflow: C = !1, stageProps: ee, stageWrapper: W = null, hiddenRowsAt: A, hiddenColumnsAt: q, hiddenCellAt: N, getVisibleCells: xe, zoom: G = 1, enableMouseWheel: He = !0, onWheelScroll: Ue, getCellCoordsAsRangeCoords: We = Z.cellToRange, scrollPoint: ht = ts, style: _e = {}, ...S } = e;
2819
+ const Wr = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, ts = Object.freeze({ top: 0, left: 0 }), ns = Object.freeze({ bottom: -4, right: -4 }), os = Object.freeze({ horizontal: !0, vertical: !0 }), Hr = [uo, Hn, Nn, Xt], xs = 150, sn = 3e3, Fo = {}, Ci = At(Ut((e, t) => {
2820
+ const { width: n, height: o, rowCount: r = 1, columnCount: i = 1, defaultRowHeight: l, defaultColumnWidth: s, getRowHeight: a, getColumnWidth: d, layout: g, onViewportScroll: m, onImmediateScroll: f, showGridLines: x = !0, gridLineColor: _ = "rgb(224, 224, 224)", gridLineRowsProps: I, gridLineColumnsProps: R, clipCells: ae = !0, cursor: P, freezeLeft: C = 0, freezeTop: z = 0, freezeLeftProps: le, freezeTopProps: B, cellRenderer: oe, onViewportChange: ve, onFirstRender: N, overlayRenderer: H, overlayProps: X, overlays: T, overlaysProps: S, allowOverlaysOverflow: h = !1, stageProps: J, stageWrapper: K = null, hiddenRowsAt: L, hiddenColumnsAt: U, hiddenCellAt: ee, getVisibleCells: te, zoom: Y = 1, enableMouseWheel: He = !0, onWheelScroll: je, getCellCoordsAsRangeCoords: Ne = G.cellToRange, scrollPoint: at = ts, style: Se = {}, ...Ye } = e;
2820
2821
  ao(oe), ao(!e?.children);
2821
- const ue = T(f, [f]), K = T(be, [be]), pe = T(m, [m]), te = T(Ue, [Ue]), Re = T(U, [U]), at = J(null), pt = J(null), zt = J(null), [gt, Zt] = Qo((v) => v + 1, 0), [Be, z] = Je({ left: ht?.left ?? 0, top: ht?.top ?? 0, horizontalScrollDirection: null, verticalScrollDirection: null }), ke = J(null), Qe = J(Be), { top: Xe, left: wt, verticalScrollDirection: an, horizontalScrollDirection: Jt } = Be, jt = J(!1), dn = Fl({ rowCount: r, columnCount: i, defaultRowHeight: l, defaultColumnWidth: s, getRowHeight: a, getColumnWidth: d }), on = J(null), ze = Ee(() => {
2822
+ const $ = k(f, [f]), E = k(ve, [ve]), Me = k(m, [m]), ue = k(je, [je]), me = k(N, [N]), Ve = Z(null), dt = Z(null), kt = Z(null), [ut, Zt] = Qo((v) => v + 1, 0), [St, M] = Ze({ left: at?.left ?? 0, top: at?.top ?? 0, horizontalScrollDirection: null, verticalScrollDirection: null }), ye = Z(null), Je = Z(St), { top: mt, left: Qe, verticalScrollDirection: cn, horizontalScrollDirection: on } = St, Mt = Z(!1), dn = Fl({ rowCount: r, columnCount: i, defaultRowHeight: l, defaultColumnWidth: s, getRowHeight: a, getColumnWidth: d }), nn = Z(null), De = _e(() => {
2822
2823
  const v = g || dn;
2823
- return on.current = null, { getColOffset: (P) => v.getColOffset(P) * G, getColIndex: (P) => v.getColIndex(P / G), getRowOffset: (P) => v.getRowOffset(P) * G, getRowIndex: (P) => v.getRowIndex(P / G) };
2824
- }, [dn, g, G]), qt = (v, P, D) => {
2825
- const F = (P?.left ?? 0) + 0, j = (P?.top ?? 0) + 0;
2826
- return { getColOffset: (fe) => v.getColOffset(fe) - F, getColIndex: (fe) => v.getColIndex(fe + F), getRowOffset: (fe) => v.getRowOffset(fe) - j, getRowIndex: (fe) => v.getRowIndex(fe + j) };
2827
- }, vt = O((v, P = !1) => go(v, P, ze.getRowOffset, P ? 0 : r), [r, ze?.getRowOffset]), Vt = T(A ?? vt, [A]), Cn = O((v, P = !1) => go(v, P, ze.getColOffset, P ? i : 0), [i, ze?.getColOffset]), un = T(q ?? Cn, [q]), Ne = Ee(() => Math.min(n ?? 800, ze.getColOffset(i)), [ze.getColOffset, i, n]), Q = Ee(() => Math.min(o ?? 600, ze.getRowOffset(r)), [ze.getRowOffset, r, o]), et = O((v) => {
2824
+ return nn.current = null, { getColOffset: (O) => v.getColOffset(O) * Y, getColIndex: (O) => v.getColIndex(O / Y), getRowOffset: (O) => v.getRowOffset(O) * Y, getRowIndex: (O) => v.getRowIndex(O / Y) };
2825
+ }, [dn, g, Y]), Kt = (v, O, A) => {
2826
+ const j = (O?.left ?? 0) + 0, V = (O?.top ?? 0) + 0;
2827
+ return { getColOffset: (fe) => v.getColOffset(fe) - j, getColIndex: (fe) => v.getColIndex(fe + j), getRowOffset: (fe) => v.getRowOffset(fe) - V, getRowIndex: (fe) => v.getRowIndex(fe + V) };
2828
+ }, xt = D((v, O = !1) => go(v, O, De.getRowOffset, O ? 0 : r), [r, De?.getRowOffset]), Vt = k(L ?? xt, [L]), Cn = D((v, O = !1) => go(v, O, De.getColOffset, O ? i : 0), [i, De?.getColOffset]), un = k(U ?? Cn, [U]), We = _e(() => Math.min(n ?? 800, De.getColOffset(i)), [De.getColOffset, i, n]), Q = _e(() => Math.min(o ?? 600, De.getRowOffset(r)), [De.getRowOffset, r, o]), et = D((v) => {
2828
2829
  Ct.canUseDOM && setTimeout(() => {
2829
- at.current?.focus({ preventScroll: !0, ...v });
2830
+ Ve.current?.focus({ preventScroll: !0, ...v });
2830
2831
  }, 0);
2831
- }, []), qe = O((v) => at.current?.contains(v) || pt.current?.contains(v), []);
2832
+ }, []), Ue = D((v) => Ve.current?.contains(v) || dt.current?.contains(v), []);
2832
2833
  st(() => {
2833
- jt.current && (ke.current && ke.current.left !== Qe.current?.left && ke.current.top !== Qe.current?.top || (ke.current = null, pe?.({ left: wt, top: Xe })));
2834
- }, [wt, Xe]);
2835
- const dt = T(() => ({ top: Xe, left: wt }), [Xe, wt]), Ie = Ee(() => {
2834
+ Mt.current && (ye.current && ye.current.left !== Je.current?.left && ye.current.top !== Je.current?.top || (ye.current = null, Me?.({ left: Qe, top: mt })));
2835
+ }, [Qe, mt]);
2836
+ const ht = k(() => ({ top: mt, left: Qe }), [mt, Qe]), Ie = _e(() => {
2836
2837
  const v = [];
2837
- let P = 0, D = 0;
2838
- typeof L == "number" ? P = L : (P = L.index ?? 0, D = (L.scrollOffset ?? 0) * G);
2839
- const F = D, j = ze.getRowOffset(P), fe = j - F;
2840
- if (P > 0) {
2841
- const ut = qt(ze, { top: D + ze.getRowOffset(0) }), Fe = ze.getRowIndex(F), je = ze.getRowIndex(j - 1);
2842
- let mt;
2843
- v[1] = { minIndex: Fe, maxIndex: je, minCoord: 0, maxCoord: P - 1, minBounds: 0, maxBounds: fe, visibleIndices: () => mt || (mt = Object.freeze(io(Vt, Fe, je)), mt), layout: ut, maxVirtualBounds: j, scrollOffset: D, freezeOffset: D };
2844
- }
2845
- const se = Math.max(0, Q - fe), ve = qt(ze, { top: Xe + fe }), ye = ve.getRowIndex(0), ce = ve.getRowIndex(se);
2846
- let Ve;
2847
- return v[0] = { minIndex: ye, maxIndex: ce, minCoord: P, maxCoord: r - 1, minBounds: fe, maxBounds: se, visibleIndices: () => Ve || (Ve = Object.freeze(io(Vt, ye, ce)), Ve), layout: ve, maxVirtualBounds: ze.getRowOffset(r), scrollOffset: Xe, freezeOffset: (P > 0 ? ze.getRowOffset(P) : 0) - D }, v;
2848
- }, [ze.getRowIndex, ze.getRowOffset, Vt, Q, r, L, Xe, G]), Le = Ee(() => {
2838
+ let O = 0, A = 0;
2839
+ typeof z == "number" ? O = z : (O = z.index ?? 0, A = (z.scrollOffset ?? 0) * Y);
2840
+ const j = A, V = De.getRowOffset(O), fe = V - j;
2841
+ if (O > 0) {
2842
+ const ft = Kt(De, { top: A + De.getRowOffset(0) }), $e = De.getRowIndex(j), Be = De.getRowIndex(V - 1);
2843
+ let gt;
2844
+ v[1] = { minIndex: $e, maxIndex: Be, minCoord: 0, maxCoord: O - 1, minBounds: 0, maxBounds: fe, visibleIndices: () => gt || (gt = Object.freeze(io(Vt, $e, Be)), gt), layout: ft, maxVirtualBounds: V, scrollOffset: A, freezeOffset: A };
2845
+ }
2846
+ const se = Math.max(0, Q - fe), xe = Kt(De, { top: mt + fe }), be = xe.getRowIndex(0), ce = xe.getRowIndex(se);
2847
+ let Fe;
2848
+ return v[0] = { minIndex: be, maxIndex: ce, minCoord: O, maxCoord: r - 1, minBounds: fe, maxBounds: se, visibleIndices: () => Fe || (Fe = Object.freeze(io(Vt, be, ce)), Fe), layout: xe, maxVirtualBounds: De.getRowOffset(r), scrollOffset: mt, freezeOffset: (O > 0 ? De.getRowOffset(O) : 0) - A }, v;
2849
+ }, [De.getRowIndex, De.getRowOffset, Vt, Q, r, z, mt, Y]), Oe = _e(() => {
2849
2850
  const v = [];
2850
- let P = 0, D = 0;
2851
- typeof _ == "number" ? P = _ : (P = _.index ?? 0, D = (_.scrollOffset ?? 0) * G);
2852
- const F = D, j = ze.getColOffset(P), fe = j - F;
2853
- if (P > 0) {
2854
- const ut = qt(ze, { left: D + ze.getColOffset(0) }), Fe = ze.getColIndex(F), je = ze.getColIndex(j - 1);
2855
- let mt;
2856
- v[1] = { minIndex: Fe, maxIndex: je, minCoord: 0, maxCoord: P - 1, minBounds: 0, maxBounds: fe, visibleIndices: () => mt || (mt = Object.freeze(io(un, Fe, je)), mt), layout: ut, maxVirtualBounds: j, scrollOffset: D, freezeOffset: D };
2857
- }
2858
- const se = Math.max(0, Ne - fe), ve = qt(ze, { left: wt + fe }), ye = ve.getColIndex(0), ce = ve.getColIndex(se);
2859
- let Ve;
2860
- return v[0] = { minIndex: ye, maxIndex: ce, minCoord: P, maxCoord: i - 1, minBounds: fe, maxBounds: se, visibleIndices: () => Ve || (Ve = Object.freeze(io(un, ye, ce)), Ve), layout: ve, maxVirtualBounds: ze.getColOffset(i), scrollOffset: wt, freezeOffset: (P > 0 ? ze.getColOffset(P) : 0) - D }, v;
2861
- }, [ze.getColIndex, ze.getColOffset, un, Ne, i, _, wt, G]), rt = J({}), tt = J([]), Ae = Ee(() => {
2851
+ let O = 0, A = 0;
2852
+ typeof C == "number" ? O = C : (O = C.index ?? 0, A = (C.scrollOffset ?? 0) * Y);
2853
+ const j = A, V = De.getColOffset(O), fe = V - j;
2854
+ if (O > 0) {
2855
+ const ft = Kt(De, { left: A + De.getColOffset(0) }), $e = De.getColIndex(j), Be = De.getColIndex(V - 1);
2856
+ let gt;
2857
+ v[1] = { minIndex: $e, maxIndex: Be, minCoord: 0, maxCoord: O - 1, minBounds: 0, maxBounds: fe, visibleIndices: () => gt || (gt = Object.freeze(io(un, $e, Be)), gt), layout: ft, maxVirtualBounds: V, scrollOffset: A, freezeOffset: A };
2858
+ }
2859
+ const se = Math.max(0, We - fe), xe = Kt(De, { left: Qe + fe }), be = xe.getColIndex(0), ce = xe.getColIndex(se);
2860
+ let Fe;
2861
+ return v[0] = { minIndex: be, maxIndex: ce, minCoord: O, maxCoord: i - 1, minBounds: fe, maxBounds: se, visibleIndices: () => Fe || (Fe = Object.freeze(io(un, be, ce)), Fe), layout: xe, maxVirtualBounds: De.getColOffset(i), scrollOffset: Qe, freezeOffset: (O > 0 ? De.getColOffset(O) : 0) - A }, v;
2862
+ }, [De.getColIndex, De.getColOffset, un, We, i, C, Qe, Y]), rt = Z({}), tt = Z([]), ze = _e(() => {
2862
2863
  let v = {};
2863
- const P = (F, j, fe, se, ve) => {
2864
- const ye = { vertical: se?.vertical || !1, horizontal: se?.horizontal || !1 };
2865
- if (F >= Le.length || j >= Ie.length) return null;
2866
- const ce = { rowStart: Ie[j].minIndex, colStart: Le[F].minIndex, rowEnd: Ie[j].maxIndex, colEnd: Le[F].maxIndex };
2864
+ const O = (j, V, fe, se, xe) => {
2865
+ const be = { vertical: se?.vertical || !1, horizontal: se?.horizontal || !1 };
2866
+ if (j >= Oe.length || V >= Ie.length) return null;
2867
+ const ce = { rowStart: Ie[V].minIndex, colStart: Oe[j].minIndex, rowEnd: Ie[V].maxIndex, colEnd: Oe[j].maxIndex };
2867
2868
  if (ce.rowStart > ce.rowEnd || ce.colStart > ce.colEnd) return null;
2868
- const Ve = { getColIndex: (Ce) => Le[F].layout.getColIndex(Ce), getColOffset: (Ce) => Le[F].layout.getColOffset(Ce), getRowIndex: (Ce) => Ie[j].layout.getRowIndex(Ce), getRowOffset: (Ce) => Ie[j].layout.getRowOffset(Ce) }, ut = Object.freeze({ left: ve?.left ?? 0, top: ve?.top ?? 0, right: ve?.right ?? 0, bottom: ve?.bottom ?? 0 }), Fe = Object.freeze({ x: Le[F].minBounds, y: Ie[j].minBounds, width: Le[F].maxBounds, height: Ie[j].maxBounds }), je = (Ce, Ze) => Fr(Ve, Ce ?? ce, Ze), mt = { width: Le[F].maxVirtualBounds, height: Ie[j].maxVirtualBounds }, Ge = { left: Le[F].scrollOffset, top: Ie[j].scrollOffset }, Pt = { left: Le[F].freezeOffset, top: Ie[j].freezeOffset }, yt = { width: Ne, height: Q };
2869
- let ge = null, xt = null;
2870
- const At = (Pt.top + (se.vertical ? Ge.top : 0)) / G, Wt = (Pt.left + (se.horizontal ? Ge.left : 0)) / G;
2871
- return { getStage: () => at.current ?? null, getVisibleRangeCoords: () => ce, toClipBounds: (Ce, Ze) => {
2872
- let $e, ct = 0;
2873
- return Ze === void 0 || typeof Ze == "number" ? ($e = je(ce), ct = Ze) : $e = Ze, ((Oe, Et, bt = 0) => {
2874
- if (Oe.x > Et.width || Oe.y > Et.height) return null;
2875
- const $t = { left: Oe.x, top: Oe.y, bottom: Oe.height + Oe.y, right: Oe.width + Oe.x }, Kt = { left: Et.x + bt, top: Et.y + bt, bottom: Et.height - 2 * bt + Et.y, right: Et.width - 2 * bt + Et.x }, Ot = { left: Math.max($t.left, Kt.left), top: Math.max($t.top, Kt.top), bottom: Math.min($t.bottom, Kt.bottom), right: Math.min($t.right, Kt.right) }, c = { x: Ot.left, y: Ot.top, width: Ot.right - Ot.left, height: Ot.bottom - Ot.top };
2869
+ const Fe = { getColIndex: (Ce) => Oe[j].layout.getColIndex(Ce), getColOffset: (Ce) => Oe[j].layout.getColOffset(Ce), getRowIndex: (Ce) => Ie[V].layout.getRowIndex(Ce), getRowOffset: (Ce) => Ie[V].layout.getRowOffset(Ce) }, ft = Object.freeze({ left: xe?.left ?? 0, top: xe?.top ?? 0, right: xe?.right ?? 0, bottom: xe?.bottom ?? 0 }), $e = Object.freeze({ x: Oe[j].minBounds, y: Ie[V].minBounds, width: Oe[j].maxBounds, height: Ie[V].maxBounds }), Be = (Ce, Ge) => Fr(Fe, Ce ?? ce, Ge), gt = { width: Oe[j].maxVirtualBounds, height: Ie[V].maxVirtualBounds }, Xe = { left: Oe[j].scrollOffset, top: Ie[V].scrollOffset }, Lt = { left: Oe[j].freezeOffset, top: Ie[V].freezeOffset }, vt = { width: We, height: Q };
2870
+ let pe = null, wt = null;
2871
+ const $t = (Lt.top + (se.vertical ? Xe.top : 0)) / Y, Wt = (Lt.left + (se.horizontal ? Xe.left : 0)) / Y;
2872
+ return { getStage: () => Ve.current ?? null, getVisibleRangeCoords: () => ce, toClipBounds: (Ce, Ge) => {
2873
+ let Ae, ct = 0;
2874
+ return Ge === void 0 || typeof Ge == "number" ? (Ae = Be(ce), ct = Ge) : Ae = Ge, ((Pe, Et, yt = 0) => {
2875
+ if (Pe.x > Et.width || Pe.y > Et.height) return null;
2876
+ const Bt = { left: Pe.x, top: Pe.y, bottom: Pe.height + Pe.y, right: Pe.width + Pe.x }, qt = { left: Et.x + yt, top: Et.y + yt, bottom: Et.height - 2 * yt + Et.y, right: Et.width - 2 * yt + Et.x }, Dt = { left: Math.max(Bt.left, qt.left), top: Math.max(Bt.top, qt.top), bottom: Math.min(Bt.bottom, qt.bottom), right: Math.min(Bt.right, qt.right) }, c = { x: Dt.left, y: Dt.top, width: Dt.right - Dt.left, height: Dt.bottom - Dt.top };
2876
2877
  return c.height < 0 || c.width < 0 ? null : c;
2877
- })(Ce ?? { x: 0, y: 0, width: Fe.width, height: Fe.height }, $e, ct);
2878
- }, toViewBounds: (Ce) => Wt === 0 && At === 0 && G === 1 ? Ce : { x: (Ce.x - Wt) * G, y: (Ce.y - At) * G, width: Ce.width * G, height: Ce.height * G }, toAbsoluteBounds: (Ce) => Wt === 0 && At === 0 && G === 1 ? Ce : { x: Ce.x / G + Wt, y: Ce.y / G + At, width: Ce.width / G, height: Ce.height / G }, getRelativePointFromClient: (Ce, Ze) => {
2879
- const $e = hn(Ce, Ze);
2880
- return { x: $e.x - Fe.x, y: $e.y - Fe.y };
2881
- }, getLayout: () => Ve, getCellCoordsAsRangeCoords: We, getVisibleColumns: () => Le[F].visibleIndices(), getVisibleRows: () => Ie[j].visibleIndices(), getVisibleColumnOffsets: () => (ge || (ge = Br(Le[F].layout, !0, Le[F].visibleIndices(), ce.colStart, ce.colEnd)), ge), getVisibleRowOffsets: () => (xt || (xt = Br(Ie[j].layout, !1, Ie[j].visibleIndices(), ce.rowStart, ce.rowEnd)), xt), getTotalRangeCoords: () => ({ colStart: Le[F].minCoord, colEnd: Le[F].maxCoord, rowStart: Ie[j].minCoord, rowEnd: Ie[j].maxCoord }), getRangeCoordsBounds: je, scrollCellCoordsIntoView: (Ce, Ze) => Dn(Ce, Ze, fe), getCellCoordsFromClient: (Ce, Ze, $e = !1) => {
2882
- const ct = hn(Ce, Ze);
2878
+ })(Ce ?? { x: 0, y: 0, width: $e.width, height: $e.height }, Ae, ct);
2879
+ }, toViewBounds: (Ce) => Wt === 0 && $t === 0 && Y === 1 ? Ce : { x: (Ce.x - Wt) * Y, y: (Ce.y - $t) * Y, width: Ce.width * Y, height: Ce.height * Y }, toAbsoluteBounds: (Ce) => Wt === 0 && $t === 0 && Y === 1 ? Ce : { x: Ce.x / Y + Wt, y: Ce.y / Y + $t, width: Ce.width / Y, height: Ce.height / Y }, getRelativePointFromClient: (Ce, Ge) => {
2880
+ const Ae = hn(Ce, Ge);
2881
+ return { x: Ae.x - $e.x, y: Ae.y - $e.y };
2882
+ }, getLayout: () => Fe, getCellCoordsAsRangeCoords: Ne, getVisibleColumns: () => Oe[j].visibleIndices(), getVisibleRows: () => Ie[V].visibleIndices(), getVisibleColumnOffsets: () => (pe || (pe = Br(Oe[j].layout, !0, Oe[j].visibleIndices(), ce.colStart, ce.colEnd)), pe), getVisibleRowOffsets: () => (wt || (wt = Br(Ie[V].layout, !1, Ie[V].visibleIndices(), ce.rowStart, ce.rowEnd)), wt), getTotalRangeCoords: () => ({ colStart: Oe[j].minCoord, colEnd: Oe[j].maxCoord, rowStart: Ie[V].minCoord, rowEnd: Ie[V].maxCoord }), getRangeCoordsBounds: Be, scrollCellCoordsIntoView: (Ce, Ge) => Dn(Ce, Ge, fe), getCellCoordsFromClient: (Ce, Ge, Ae = !1) => {
2883
+ const ct = hn(Ce, Ge);
2883
2884
  if (!ct) return null;
2884
- const Oe = Ve.getColIndex(ct.x - Fe.x), Et = { rowIndex: Ve.getRowIndex(ct.y - Fe.y), colIndex: Oe };
2885
- if ($e) return Et;
2886
- const bt = We(Et);
2887
- return { rowIndex: bt.rowStart, colIndex: bt.colStart };
2888
- }, getZoom: () => G, getAnchor: () => fe, getBounds: () => Fe, getInsets: () => ut, getTotalSize: () => mt, getViewportSize: () => yt, getScrollTopLeft: () => Ge, getFreezeTopLeft: () => Pt, getScrollOrientation: () => ye, allViews: () => v };
2885
+ const Pe = Fe.getColIndex(ct.x - $e.x), Et = { rowIndex: Fe.getRowIndex(ct.y - $e.y), colIndex: Pe };
2886
+ if (Ae) return Et;
2887
+ const yt = Ne(Et);
2888
+ return { rowIndex: yt.rowStart, colIndex: yt.colStart };
2889
+ }, getZoom: () => Y, getAnchor: () => fe, getBounds: () => $e, getInsets: () => ft, getTotalSize: () => gt, getViewportSize: () => vt, getScrollTopLeft: () => Xe, getFreezeTopLeft: () => Lt, getScrollOrientation: () => be, allViews: () => v };
2889
2890
  };
2890
- let D = v[Xt] = P(0, 0, Xt, os, ns);
2891
- return D && (v[Xt] = D), D = P(0, 1, Hn, { horizontal: !0 }), D && (v[Hn] = D), D = P(1, 0, Nn, { vertical: !0 }), D && (v[Nn] = D), D = P(1, 1, uo, {}), D && (v[uo] = D), rt.current = null, v = Object.freeze(v);
2892
- }, [Ie, Le, We]), rn = Object.keys(Ae), Mt = Le[0]?.maxVirtualBounds ?? 0, nt = Ie[0]?.maxVirtualBounds ?? 0, Tt = Ee(() => ({ left: Le[1] ? Le[1].layout.getColOffset(Le[1].maxIndex + 1) : 0, top: Ie[1] ? Ie[1].layout.getRowOffset(Ie[1].maxIndex + 1) : 0 }), [Ae]);
2891
+ let A = v[Xt] = O(0, 0, Xt, os, ns);
2892
+ return A && (v[Xt] = A), A = O(0, 1, Hn, { horizontal: !0 }), A && (v[Hn] = A), A = O(1, 0, Nn, { vertical: !0 }), A && (v[Nn] = A), A = O(1, 1, uo, {}), A && (v[uo] = A), rt.current = null, v = Object.freeze(v);
2893
+ }, [Ie, Oe, Ne]), rn = Object.keys(ze), Tt = Oe[0]?.maxVirtualBounds ?? 0, nt = Ie[0]?.maxVirtualBounds ?? 0, Rt = _e(() => ({ left: Oe[1] ? Oe[1].layout.getColOffset(Oe[1].maxIndex + 1) : 0, top: Ie[1] ? Ie[1].layout.getRowOffset(Ie[1].maxIndex + 1) : 0 }), [ze]);
2893
2894
  st(() => {
2894
2895
  if (tt.current.length > 0) {
2895
2896
  for (let v = 0; v < tt.current.length; v++) tt.current[v]();
2896
2897
  tt.current = [];
2897
2898
  }
2898
- }, [Ae]);
2899
- const kt = T(() => ({ containerWidth: Ne, containerHeight: Q, totalWidth: Mt, totalHeight: nt }), [Ne, Q, ze]);
2899
+ }, [ze]);
2900
+ const Ot = k(() => ({ containerWidth: We, containerHeight: Q, totalWidth: Tt, totalHeight: nt }), [We, Q, De]);
2900
2901
  st(() => {
2901
- !ke.current && jt.current && K({ top: Xe, left: wt, width: Ne, height: Q, totalWidth: Mt, totalHeight: nt });
2902
- }, [Xe, wt, Mt, nt]), st(() => {
2903
- jt.current && K({ top: Xe, left: wt, width: Ne, height: Q, totalWidth: Mt, totalHeight: nt });
2904
- }, [Ne, Q]);
2905
- const hn = O((v, P) => {
2906
- ao(typeof v == "number" && typeof P == "number");
2907
- const D = at.current?.getBoundingClientRect();
2908
- return D ? { x: v - D.x, y: P - D.y } : { x: v, y: P };
2909
- }, []), mo = T((v) => Ae[v] || null, [Ae]), xo = T((v, P) => {
2910
- if (Object.keys(Ae).length === 1) return Ae[Xt];
2911
- const D = hn(v, P);
2912
- if (!D) return null;
2913
- const { x: F, y: j } = D;
2902
+ !ye.current && Mt.current && E({ top: mt, left: Qe, width: We, height: Q, totalWidth: Tt, totalHeight: nt });
2903
+ }, [mt, Qe, Tt, nt]), st(() => {
2904
+ Mt.current && E({ top: mt, left: Qe, width: We, height: Q, totalWidth: Tt, totalHeight: nt });
2905
+ }, [We, Q]);
2906
+ const hn = D((v, O) => {
2907
+ ao(typeof v == "number" && typeof O == "number");
2908
+ const A = Ve.current?.getBoundingClientRect();
2909
+ return A ? { x: v - A.x, y: O - A.y } : { x: v, y: O };
2910
+ }, []), mo = k((v) => ze[v] || null, [ze]), xo = k((v, O) => {
2911
+ if (Object.keys(ze).length === 1) return ze[Xt];
2912
+ const A = hn(v, O);
2913
+ if (!A) return null;
2914
+ const { x: j, y: V } = A;
2914
2915
  let fe = null;
2915
2916
  const se = Hr;
2916
- for (let ve = 0; !fe && ve < se.length; ve++) {
2917
- const ye = Ae[se[ve]];
2918
- ye && Kl(F, j, ye.getBounds()) && (fe = ye);
2917
+ for (let xe = 0; !fe && xe < se.length; xe++) {
2918
+ const be = ze[se[xe]];
2919
+ be && ql(j, V, be.getBounds()) && (fe = be);
2919
2920
  }
2920
- return fe || (fe = Ae[Xt]), fe;
2921
- }, [Ae, We]), ft = T(() => Ae[Xt].getVisibleRangeCoords(), [Ae[Xt]]), ln = J(null), vo = O(() => {
2921
+ return fe || (fe = ze[Xt]), fe;
2922
+ }, [ze, Ne]), pt = k(() => ze[Xt].getVisibleRangeCoords(), [ze[Xt]]), ln = Z(null), vo = D(() => {
2922
2923
  ln.current !== null && Ct.cancelTimeout(ln.current), ln.current = Ct.requestTimeout(yo, 150);
2923
- }, []), yo = O(() => {
2924
- ln.current = null, z((v) => {
2925
- const P = { ...v, verticalScrollDirection: null, horizontalScrollDirection: null };
2926
- return Qe.current = P, P;
2924
+ }, []), yo = D(() => {
2925
+ ln.current = null, M((v) => {
2926
+ const O = { ...v, verticalScrollDirection: null, horizontalScrollDirection: null };
2927
+ return Je.current = O, O;
2927
2928
  });
2928
- }, []), xn = T((v) => {
2929
- const P = v?.left ?? v?.[0], D = v?.top ?? v?.[1], F = P !== void 0 ? Math.min(Mt - Ne, Math.max(Le?.[1]?.scrollOffset ?? 0, P)) : Qe.current.left, j = D !== void 0 ? Math.min(nt - Q, Math.max(Ie?.[1]?.scrollOffset ?? 0, D)) : Qe.current.top;
2930
- if (Qe.current.left === F && Qe.current.top === j) return;
2929
+ }, []), xn = k((v) => {
2930
+ const O = v?.left ?? v?.[0], A = v?.top ?? v?.[1], j = O !== void 0 ? Math.min(Tt - We, Math.max(Oe?.[1]?.scrollOffset ?? 0, O)) : Je.current.left, V = A !== void 0 ? Math.min(nt - Q, Math.max(Ie?.[1]?.scrollOffset ?? 0, A)) : Je.current.top;
2931
+ if (Je.current.left === j && Je.current.top === V) return;
2931
2932
  let fe = null, se = null;
2932
- Qe.current.left > F ? fe = ot : Qe.current.left < F && (fe = Ke), Qe.current.top > j ? se = it : Qe.current.top < j && (se = lt), Ct.throttle(() => {
2933
- z((ve) => {
2934
- const ye = { ...ve, left: F, top: j, horizontalScrollDirection: fe, verticalScrollDirection: se };
2935
- return Qe.current = ye, ye;
2933
+ Je.current.left > j ? fe = ot : Je.current.left < j && (fe = Ke), Je.current.top > V ? se = it : Je.current.top < V && (se = lt), Ct.throttle(() => {
2934
+ M((xe) => {
2935
+ const be = { ...xe, left: j, top: V, horizontalScrollDirection: fe, verticalScrollDirection: se };
2936
+ return Je.current = be, be;
2936
2937
  });
2937
- }, 17)(), ke.current?.top === j && ke.current?.left === F || (ke.current = { left: F, top: j }, ue({ left: F, top: j }), K({ left: F, top: j, width: Ne, height: Q, totalWidth: Mt, totalHeight: nt })), vo();
2938
- }, [Mt, nt, Ie, Le]);
2938
+ }, 17)(), ye.current?.top === V && ye.current?.left === j || (ye.current = { left: j, top: V }, $({ left: j, top: V }), E({ left: j, top: V, width: We, height: Q, totalWidth: Tt, totalHeight: nt })), vo();
2939
+ }, [Tt, nt, Ie, Oe]);
2939
2940
  st(() => {
2940
- ke.current || xn({ left: wt, top: Xe });
2941
- }, [Mt, Ne, nt, Q]), nn(() => {
2942
- ke.current = { left: ht?.left, top: ht?.top }, xn(ke.current);
2943
- }, [ht?.left, ht?.top]);
2944
- const Kn = T((v) => {
2945
- const P = v?.left ?? v?.[0], D = v?.top ?? v?.[1], F = v?.behavior ?? "auto", j = { left: Qe.current.left + (P ?? 0), top: Qe.current.top + (D ?? 0) };
2946
- F && (j.behavior = F), xn(j);
2947
- }, [Mt, Ne, nt, Q]), Yn = O((v) => {
2948
- let P = null;
2949
- if (Object.keys(Ae).length > 1) {
2950
- const D = Hr;
2951
- for (let F = 0; !P && F < D.length; F++) {
2952
- const j = Ae[D[F]];
2953
- j && Z.isCellWithinRange(v, j.getVisibleRangeCoords()) && (P = j);
2941
+ ye.current || xn({ left: Qe, top: mt });
2942
+ }, [Tt, We, nt, Q]), tn(() => {
2943
+ ye.current = { left: at?.left, top: at?.top }, xn(ye.current);
2944
+ }, [at?.left, at?.top]);
2945
+ const qn = k((v) => {
2946
+ const O = v?.left ?? v?.[0], A = v?.top ?? v?.[1], j = v?.behavior ?? "auto", V = { left: Je.current.left + (O ?? 0), top: Je.current.top + (A ?? 0) };
2947
+ j && (V.behavior = j), xn(V);
2948
+ }, [Tt, We, nt, Q]), Yn = D((v) => {
2949
+ let O = null;
2950
+ if (Object.keys(ze).length > 1) {
2951
+ const A = Hr;
2952
+ for (let j = 0; !O && j < A.length; j++) {
2953
+ const V = ze[A[j]];
2954
+ V && G.isCellWithinRange(v, V.getVisibleRangeCoords()) && (O = V);
2954
2955
  }
2955
2956
  }
2956
- return P || (P = Ae[Xt]), P;
2957
- }, [Ae]), Dn = T((v, P = { inline: "nearest", block: "nearest" }, D = null) => {
2958
- const F = { rowIndex: 0, colIndex: 0, ...v };
2959
- let j = null;
2960
- if (D !== null) {
2961
- if (j = Ae[D], j === null) return new Promise((yt, ge) => {
2962
- ge("Invalid view");
2957
+ return O || (O = ze[Xt]), O;
2958
+ }, [ze]), Dn = k((v, O = { inline: "nearest", block: "nearest" }, A = null) => {
2959
+ const j = { rowIndex: 0, colIndex: 0, ...v };
2960
+ let V = null;
2961
+ if (A !== null) {
2962
+ if (V = ze[A], V === null) return new Promise((vt, pe) => {
2963
+ pe("Invalid view");
2963
2964
  });
2964
- } else j = Yn(F);
2965
- const fe = We(F), se = j.getLayout(), ve = se.getColOffset(fe.colStart), ye = se.getRowOffset(fe.rowStart), ce = se.getColOffset(fe.colEnd + 1), Ve = se.getRowOffset(fe.rowEnd + 1), ut = j.getBounds(), Fe = j.getTotalSize(), je = j.getScrollTopLeft(), mt = ((yt, ge, xt = !0) => (xt = xt === !0 ? { block: "start", inline: "end" } : xt === !1 ? { block: "end", inline: "end" } : { block: "end", inline: "end", ...xt }, { left: zr(xt.inline, yt.x, yt.x + yt.width, ge.left, ge.left + ge.width, ge.totalWidth), top: zr(xt.block, yt.y, yt.y + yt.height, ge.top, ge.top + ge.height, ge.totalHeight) }))({ x: ve + je.left, y: ye + je.top, width: ce - ve, height: Ve - ye }, { left: je.left, top: je.top, width: ut.width, height: ut.height, totalWidth: Fe.width, totalHeight: Fe.height }, P), Ge = { ...mt };
2966
- Ge.left > wt ? Ge.left += 20 : Ge.left < wt && (Ge.left -= 0), Ge.top > Xe ? Ge.top += 20 : Ge.top < Xe && (Ge.top -= 0);
2967
- const Pt = j.getScrollOrientation();
2968
- return Pt.horizontal && v.colIndex !== void 0 || delete Ge.left, Pt.vertical && v.rowIndex !== void 0 || delete Ge.top, new Promise((yt, ge) => {
2965
+ } else V = Yn(j);
2966
+ const fe = Ne(j), se = V.getLayout(), xe = se.getColOffset(fe.colStart), be = se.getRowOffset(fe.rowStart), ce = se.getColOffset(fe.colEnd + 1), Fe = se.getRowOffset(fe.rowEnd + 1), ft = V.getBounds(), $e = V.getTotalSize(), Be = V.getScrollTopLeft(), gt = ((vt, pe, wt = !0) => (wt = wt === !0 ? { block: "start", inline: "end" } : wt === !1 ? { block: "end", inline: "end" } : { block: "end", inline: "end", ...wt }, { left: zr(wt.inline, vt.x, vt.x + vt.width, pe.left, pe.left + pe.width, pe.totalWidth), top: zr(wt.block, vt.y, vt.y + vt.height, pe.top, pe.top + pe.height, pe.totalHeight) }))({ x: xe + Be.left, y: be + Be.top, width: ce - xe, height: Fe - be }, { left: Be.left, top: Be.top, width: ft.width, height: ft.height, totalWidth: $e.width, totalHeight: $e.height }, O), Xe = { ...gt };
2967
+ Xe.left > Qe ? Xe.left += 20 : Xe.left < Qe && (Xe.left -= 0), Xe.top > mt ? Xe.top += 20 : Xe.top < mt && (Xe.top -= 0);
2968
+ const Lt = V.getScrollOrientation();
2969
+ return Lt.horizontal && v.colIndex !== void 0 || delete Xe.left, Lt.vertical && v.rowIndex !== void 0 || delete Xe.top, new Promise((vt, pe) => {
2969
2970
  try {
2970
- xn(Ge), yt(Ge);
2971
- } catch (xt) {
2972
- ge(xt);
2971
+ xn(Xe), vt(Xe);
2972
+ } catch (wt) {
2973
+ pe(wt);
2973
2974
  }
2974
2975
  });
2975
- }, [Mt, nt, Ae, We]), Mn = T((v) => {
2976
- const P = v.shiftKey;
2976
+ }, [Tt, nt, ze, Ne]), Mn = k((v) => {
2977
+ const O = v.shiftKey;
2977
2978
  v.preventDefault();
2978
- const { deltaX: D, deltaY: F, deltaMode: j } = v;
2979
- if (zt.current || te?.(v) === !1) return;
2980
- let se = P ? F : D, ve = F;
2981
- const ye = P || Math.abs(se) > Math.abs(ve);
2982
- j === 1 && (ve *= 0), zt.current = window.requestAnimationFrame(() => {
2983
- zt.current = null, Kn(ye ? { left: se } : { top: ve });
2979
+ const { deltaX: A, deltaY: j, deltaMode: V } = v;
2980
+ if (kt.current || ue?.(v) === !1) return;
2981
+ let se = O ? j : A, xe = j;
2982
+ const be = O || Math.abs(se) > Math.abs(xe);
2983
+ V === 1 && (xe *= 0), kt.current = window.requestAnimationFrame(() => {
2984
+ kt.current = null, qn(be ? { left: se } : { top: xe });
2984
2985
  });
2985
- }, [Mt, Ne, nt, Q, te]), zn = O((v = null) => {
2986
- on.current = null, rt.current = null, Zt();
2986
+ }, [Tt, We, nt, Q, ue]), zn = D((v = null) => {
2987
+ nn.current = null, rt.current = null, Zt();
2987
2988
  }, []);
2988
- nn(() => {
2989
+ tn(() => {
2989
2990
  zn();
2990
2991
  }, [oe]);
2991
- const vn = wo(t, () => ({ stage: at.current, focus: et, contains: qe, invalidate: zn, scrollTo: xn, scrollBy: Kn, scrollCellCoordsIntoView: Dn, getScrollPosition: dt, getDimensions: kt, getViewport: ft, handleWheel: Mn, rowCount: r, columnCount: i, getLayout: () => ze, getRelativePointFromClient: hn, getViewFromClient: xo, getViewFromCellCoords: Yn, getViewFromLocation: mo, onViewChangeOnce: (v) => {
2992
+ const vn = wo(t, () => ({ stage: Ve.current, focus: et, contains: Ue, invalidate: zn, scrollTo: xn, scrollBy: qn, scrollCellCoordsIntoView: Dn, getScrollPosition: ht, getDimensions: Ot, getViewport: pt, handleWheel: Mn, rowCount: r, columnCount: i, getLayout: () => De, getRelativePointFromClient: hn, getViewFromClient: xo, getViewFromCellCoords: Yn, getViewFromLocation: mo, onViewChangeOnce: (v) => {
2992
2993
  tt.current.push(v);
2993
- } }), [r, i, Ae]);
2994
- st(() => (He && vn.current?.addEventListener("wheel", Mn, { passive: !1 }), jt.current = !0, ke.current = null, () => {
2994
+ } }), [r, i, ze]);
2995
+ st(() => (He && vn.current?.addEventListener("wheel", Mn, { passive: !1 }), Mt.current = !0, ye.current = null, () => {
2995
2996
  vn.current?.removeEventListener("wheel", Mn);
2996
2997
  }), [He]);
2997
- const An = J([]), bo = (v, P) => {
2998
- !v || !H || (An.current = [], P.push(((D, F) => {
2999
- const j = `view:${D.getAnchor()}:overlay:${P.length}`, fe = H?.({ key: j, view: D }, (ve) => An.current[F] = ve);
2998
+ const An = Z([]), bo = (v, O) => {
2999
+ !v || !H || (An.current = [], O.push(((A, j) => {
3000
+ const V = `view:${A.getAnchor()}:overlay:${O.length}`, fe = H?.({ key: V, view: A }, (xe) => An.current[j] = xe);
3000
3001
  if (!fe) return null;
3001
- const se = D.getBounds();
3002
- return Y("div", { style: { position: "absolute", left: "0px", top: "0px", width: `${se.width}px`, height: `${se.height}px`, overflow: "hidden" }, children: fe }, `overlay-${D.getAnchor()}-${F}`);
3002
+ const se = A.getBounds();
3003
+ return q("div", { style: { position: "absolute", left: "0px", top: "0px", width: `${se.width}px`, height: `${se.height}px`, overflow: "hidden" }, children: fe }, `overlay-${A.getAnchor()}-${j}`);
3003
3004
  })(v, 0)));
3004
- }, So = Ee(() => {
3005
- const v = {}, P = Object.keys(Ae);
3006
- for (let D = 0; D < P.length; D++) {
3007
- const F = P[D], j = [];
3008
- bo(Ae[F], j), v[F] = { overlays: j };
3005
+ }, So = _e(() => {
3006
+ const v = {}, O = Object.keys(ze);
3007
+ for (let A = 0; A < O.length; A++) {
3008
+ const j = O[A], V = [];
3009
+ bo(ze[j], V), v[j] = { overlays: V };
3009
3010
  }
3010
3011
  return v;
3011
- }, [gt, H, r, i, Ie, Le]), Xn = (v, P, D, F, j, fe, se) => {
3012
+ }, [ut, H, r, i, Ie, Oe]), Xn = (v, O, A, j, V, fe, se) => {
3012
3013
  if (!v) return;
3013
- const ve = v.getVisibleColumns(), ye = v.getVisibleRows();
3014
- if (ve.length === 0 || ye.length === 0) return;
3014
+ const xe = v.getVisibleColumns(), be = v.getVisibleRows();
3015
+ if (xe.length === 0 || be.length === 0) return;
3015
3016
  let ce = null;
3016
- if (xe) ce = xe(v);
3017
+ if (te) ce = te(v);
3017
3018
  else {
3018
3019
  ce = [];
3019
- for (let Ze = 0; Ze < ye.length; Ze++) for (let $e = 0; $e < ve.length; $e++) {
3020
- const ct = { rowIndex: ye[Ze], colIndex: ve[$e] };
3021
- if (N?.(ct)) continue;
3022
- const Oe = { coords: ct, range: We(ct) };
3023
- ce.push(Oe);
3020
+ for (let Ge = 0; Ge < be.length; Ge++) for (let Ae = 0; Ae < xe.length; Ae++) {
3021
+ const ct = { rowIndex: be[Ge], colIndex: xe[Ae] };
3022
+ if (ee?.(ct)) continue;
3023
+ const Pe = { coords: ct, range: Ne(ct) };
3024
+ ce.push(Pe);
3024
3025
  }
3025
3026
  }
3026
- const Ve = v.getVisibleColumnOffsets(), ut = v.getVisibleRowOffsets(), Fe = v.getScrollTopLeft(), je = v.getFreezeTopLeft(), mt = Fe.left + je.left, Ge = Fe.top + je.top, Pt = Math.trunc(mt / sn), yt = Math.trunc(Ge / sn), ge = {}, xt = (Ze, $e, ct, Oe, Et) => {
3027
- const bt = `view:${Ze.getAnchor()}:cell:${Dr($e.rowIndex, $e.colIndex)}`, $t = Oe.x, Kt = Oe.y, Ot = Math.trunc((mt + $t) / sn) - Pt, c = Math.trunc((Ge + Kt) / sn) - yt;
3028
- ge[c] || (ge[c] = {});
3029
- let h = ge[c][Ot];
3030
- h || (h = ge[c][Ot] = []);
3031
- let w = fe?.get(bt);
3027
+ const Fe = v.getVisibleColumnOffsets(), ft = v.getVisibleRowOffsets(), $e = v.getScrollTopLeft(), Be = v.getFreezeTopLeft(), gt = $e.left + Be.left, Xe = $e.top + Be.top, Lt = Math.trunc(gt / sn), vt = Math.trunc(Xe / sn), pe = {}, wt = (Ge, Ae, ct, Pe, Et) => {
3028
+ const yt = `view:${Ge.getAnchor()}:cell:${Dr(Ae.rowIndex, Ae.colIndex)}`, Bt = Pe.x, qt = Pe.y, Dt = Math.trunc((gt + Bt) / sn) - Lt, c = Math.trunc((Xe + qt) / sn) - vt;
3029
+ pe[c] || (pe[c] = {});
3030
+ let u = pe[c][Dt];
3031
+ u || (u = pe[c][Dt] = []);
3032
+ let w = fe?.get(yt);
3032
3033
  if (!w) {
3033
- const p = (mt + $t) % sn, y = (Ge + Kt) % sn;
3034
- w = oe({ key: bt, coords: $e, bounds: Oe, zoom: G, range: ct, view: Ze, value: Et, style: { left: me.boundPixel(p), top: me.boundPixel(y), width: me.boundPixel(Oe.width, !0), height: me.boundPixel(Oe.height, !0) } });
3034
+ const p = (gt + Bt) % sn, y = (Xe + qt) % sn;
3035
+ w = oe({ key: yt, coords: Ae, bounds: Pe, zoom: Y, range: ct, view: Ge, value: Et, style: { left: we.boundPixel(p), top: we.boundPixel(y), width: we.boundPixel(Pe.width, !0), height: we.boundPixel(Pe.height, !0) } });
3035
3036
  }
3036
- se?.set(bt, w), h.push(w);
3037
+ se?.set(yt, w), u.push(w);
3037
3038
  };
3038
- for (let Ze = 0; ce && Ze < ce.length; Ze++) {
3039
- const $e = ce[Ze], ct = $e?.coords ?? $e;
3039
+ for (let Ge = 0; ce && Ge < ce.length; Ge++) {
3040
+ const Ae = ce[Ge], ct = Ae?.coords ?? Ae;
3040
3041
  if (!ct) continue;
3041
- const Oe = $e?.range ?? { rowStart: ct.rowIndex, colStart: ct.colIndex, rowEnd: ct.rowIndex, colEnd: ct.colIndex }, Et = v.getVisibleRangeCoords();
3042
- if (!Z.isRangesIntersect(Oe, Et) && !Z.isRangeWithinRange(Oe, Et)) continue;
3043
- const bt = Oe && !Z.isSingleCell(Oe);
3044
- if (!bt && N?.(ct)) continue;
3045
- const $t = ct.rowIndex, Kt = ct.colIndex, Ot = ut[$t], c = Ve[Kt];
3046
- let h = null;
3047
- Ot && c && (h = { x: c.offset, y: Ot.offset, width: c.size, height: Ot.size });
3048
- const w = Dr(Oe.rowStart, Oe.colStart);
3049
- if (bt) {
3050
- if (j.has(w)) continue;
3051
- j.add(w), Oe.rowEnd - Oe.rowStart > 0 && D.push(Oe), Oe.colEnd - Oe.colStart > 0 && F.push(Oe);
3042
+ const Pe = Ae?.range ?? { rowStart: ct.rowIndex, colStart: ct.colIndex, rowEnd: ct.rowIndex, colEnd: ct.colIndex }, Et = v.getVisibleRangeCoords();
3043
+ if (!G.isRangesIntersect(Pe, Et) && !G.isRangeWithinRange(Pe, Et)) continue;
3044
+ const yt = Pe && !G.isSingleCell(Pe);
3045
+ if (!yt && ee?.(ct)) continue;
3046
+ const Bt = ct.rowIndex, qt = ct.colIndex, Dt = ft[Bt], c = Fe[qt];
3047
+ let u = null;
3048
+ Dt && c && (u = { x: c.offset, y: Dt.offset, width: c.size, height: Dt.size });
3049
+ const w = Dr(Pe.rowStart, Pe.colStart);
3050
+ if (yt) {
3051
+ if (V.has(w)) continue;
3052
+ V.add(w), Pe.rowEnd - Pe.rowStart > 0 && A.push(Pe), Pe.colEnd - Pe.colStart > 0 && j.push(Pe);
3052
3053
  }
3053
- if (bt && (h = Fr(v.getLayout(), Oe)), !h) {
3054
+ if (yt && (u = Fr(v.getLayout(), Pe)), !u) {
3054
3055
  console.warn("no bounds for cell", w);
3055
3056
  continue;
3056
3057
  }
3057
- const p = $e?.value;
3058
- xt(v, ct, Oe, h, p);
3059
- }
3060
- const At = mt % sn, Wt = Ge % sn, Ce = Object.keys(ge);
3061
- for (let Ze = 0; Ze < Ce.length; Ze++) {
3062
- const $e = ge[Ce[Ze]];
3063
- if (!$e) continue;
3064
- const ct = Object.keys($e);
3065
- for (let Oe = 0; Oe < ct.length; Oe++) {
3066
- const Et = $e[ct[Oe]];
3058
+ const p = Ae?.value;
3059
+ wt(v, ct, Pe, u, p);
3060
+ }
3061
+ const $t = gt % sn, Wt = Xe % sn, Ce = Object.keys(pe);
3062
+ for (let Ge = 0; Ge < Ce.length; Ge++) {
3063
+ const Ae = pe[Ce[Ge]];
3064
+ if (!Ae) continue;
3065
+ const ct = Object.keys(Ae);
3066
+ for (let Pe = 0; Pe < ct.length; Pe++) {
3067
+ const Et = Ae[ct[Pe]];
3067
3068
  if (!Et) continue;
3068
- const bt = parseInt(Ce[Ze]), $t = parseInt(ct[Oe]), Kt = bt + yt, Ot = $t + Pt, c = `view:${v.getAnchor()}:segment:${Ot}:${Kt}`;
3069
- P.push(Y("div", { className: "cell-container", style: { transform: `translate(${me.boundPixel($t * sn - At, !0)}px, ${me.boundPixel(bt * sn - Wt, !0)}px)`, willChange: "transform" }, children: Et }, c));
3069
+ const yt = parseInt(Ce[Ge]), Bt = parseInt(ct[Pe]), qt = yt + vt, Dt = Bt + Lt, c = `view:${v.getAnchor()}:segment:${Dt}:${qt}`;
3070
+ O.push(q("div", { className: "cell-container", style: { transform: `translate(${we.boundPixel(Bt * sn - $t, !0)}px, ${we.boundPixel(yt * sn - Wt, !0)}px)`, willChange: "transform" }, children: Et }, c));
3070
3071
  }
3071
3072
  }
3072
- }, Qt = Ee(() => {
3073
- const v = on.current, P = /* @__PURE__ */ new Map(), D = {}, F = Object.keys(Ae);
3074
- for (let j = 0; j < F.length; j++) {
3075
- const fe = F[j], se = [], ve = [], ye = [];
3076
- Xn(Ae[fe], ye, se, ve, /* @__PURE__ */ new Set(), v, P), D[fe] = { cells: ye, rangesH: se, rangesV: ve };
3073
+ }, Jt = _e(() => {
3074
+ const v = nn.current, O = /* @__PURE__ */ new Map(), A = {}, j = Object.keys(ze);
3075
+ for (let V = 0; V < j.length; V++) {
3076
+ const fe = j[V], se = [], xe = [], be = [];
3077
+ Xn(ze[fe], be, se, xe, /* @__PURE__ */ new Set(), v, O), A[fe] = { cells: be, rangesH: se, rangesV: xe };
3077
3078
  }
3078
- return on.current = P, D;
3079
- }, [gt, r, i, Ie, Le, x, _e, ae, N, xe, We]), Gn = (v, P, D, F, j) => {
3080
- if (v) if (P) {
3079
+ return nn.current = O, A;
3080
+ }, [ut, r, i, Ie, Oe, x, Se, ae, ee, te, Ne]), Gn = (v, O, A, j, V) => {
3081
+ if (v) if (O) {
3081
3082
  const fe = `view:${v.getAnchor()}:hl:`, se = v.getVisibleRows();
3082
3083
  if (!se || se.length === 0) return;
3083
- const ve = 0, ye = v.getBounds().width;
3084
+ const xe = 0, be = v.getBounds().width;
3084
3085
  let ce = [];
3085
- const Ve = j.sort(Z.rowFirstRangeComparator), ut = v.getVisibleRangeCoords();
3086
- for (let Fe = 0; Fe < se.length && se[Fe] <= ut.rowEnd; Fe++) {
3087
- const je = se[Fe];
3088
- if (je < ut.rowStart) continue;
3089
- let mt = !1;
3090
- for (; Ve.length > 0 && Ve[0].rowStart <= je; ) {
3091
- const ge = Ve.shift();
3092
- ge.rowEnd > je && (ce.push(ge), mt = !0);
3086
+ const Fe = V.sort(G.rowFirstRangeComparator), ft = v.getVisibleRangeCoords();
3087
+ for (let $e = 0; $e < se.length && se[$e] <= ft.rowEnd; $e++) {
3088
+ const Be = se[$e];
3089
+ if (Be < ft.rowStart) continue;
3090
+ let gt = !1;
3091
+ for (; Fe.length > 0 && Fe[0].rowStart <= Be; ) {
3092
+ const pe = Fe.shift();
3093
+ pe.rowEnd > Be && (ce.push(pe), gt = !0);
3093
3094
  }
3094
- mt && (ce = ce.sort(Z.columnFirstRangeComparator));
3095
- const Ge = v.getLayout(), Pt = Ge.getRowOffset(je + 1);
3096
- let yt = ve;
3097
- for (let ge = 0; ge < ce.length + 1; ge++) {
3098
- let xt = yt, At = ye;
3099
- const Wt = ce[ge];
3100
- ge < ce.length && (At = Math.min(ye, Ge.getColOffset(Wt.colStart)), yt = Math.min(ye, Ge.getColOffset(Wt.colEnd + 1))), F.push(Jo("path", { d: `M ${me.boundPixel(xt)} ${me.boundPixel(Pt, !1, D)} L ${me.boundPixel(At)} ${me.boundPixel(Pt, !1, D)}`, stroke: E, strokeWidth: 1, vectorEffect: "non-scaling-stroke", ...I, key: fe + je + ":" + ge }));
3095
+ gt && (ce = ce.sort(G.columnFirstRangeComparator));
3096
+ const Xe = v.getLayout(), Lt = Xe.getRowOffset(Be + 1);
3097
+ let vt = xe;
3098
+ for (let pe = 0; pe < ce.length + 1; pe++) {
3099
+ let wt = vt, $t = be;
3100
+ const Wt = ce[pe];
3101
+ pe < ce.length && ($t = Math.min(be, Xe.getColOffset(Wt.colStart)), vt = Math.min(be, Xe.getColOffset(Wt.colEnd + 1))), j.push(Jo("path", { d: `M ${we.boundPixel(wt)} ${we.boundPixel(Lt, !1, A)} L ${we.boundPixel($t)} ${we.boundPixel(Lt, !1, A)}`, stroke: _, strokeWidth: 1, vectorEffect: "non-scaling-stroke", ...I, key: fe + Be + ":" + pe }));
3101
3102
  }
3102
- for (let ge = ce.length - 1; ge >= 0; ge--) ce[ge].rowEnd <= se[Fe + 1] && ce.splice(ge, 1);
3103
+ for (let pe = ce.length - 1; pe >= 0; pe--) ce[pe].rowEnd <= se[$e + 1] && ce.splice(pe, 1);
3103
3104
  }
3104
3105
  } else {
3105
3106
  const fe = `view:${v.getAnchor()}:vl:`, se = v.getVisibleColumns();
3106
3107
  if (!se || se.length === 0) return;
3107
- const ve = 0, ye = v.getBounds().height;
3108
+ const xe = 0, be = v.getBounds().height;
3108
3109
  let ce = [];
3109
- const Ve = j.sort(Z.columnFirstRangeComparator), ut = v.getVisibleRangeCoords();
3110
- for (let Fe = 0; Fe < se.length && se[Fe] <= ut.colEnd; Fe++) {
3111
- const je = se[Fe];
3112
- if (je < ut.colStart) continue;
3113
- let mt = !1;
3114
- for (; Ve.length > 0 && Ve[0].colStart <= je; ) {
3115
- const ge = Ve.shift();
3116
- ge.colEnd > je && (ce.push(ge), mt = !0);
3110
+ const Fe = V.sort(G.columnFirstRangeComparator), ft = v.getVisibleRangeCoords();
3111
+ for (let $e = 0; $e < se.length && se[$e] <= ft.colEnd; $e++) {
3112
+ const Be = se[$e];
3113
+ if (Be < ft.colStart) continue;
3114
+ let gt = !1;
3115
+ for (; Fe.length > 0 && Fe[0].colStart <= Be; ) {
3116
+ const pe = Fe.shift();
3117
+ pe.colEnd > Be && (ce.push(pe), gt = !0);
3117
3118
  }
3118
- mt && (ce = ce.sort(Z.rowFirstRangeComparator));
3119
- const Ge = v.getLayout(), Pt = Ge.getColOffset(je + 1);
3120
- let yt = ve;
3121
- for (let ge = 0; ge < ce.length + 1; ge++) {
3122
- let xt = yt, At = ye;
3123
- const Wt = ce[ge];
3124
- ge < ce.length && (At = Math.min(ye, Ge.getRowOffset(Wt.rowStart)), yt = Math.min(ye, Ge.getRowOffset(Wt.rowEnd + 1)));
3125
- let Ce = E;
3126
- F.push(Y("path", { d: `M ${me.boundPixel(Pt, !1, D)} ${me.boundPixel(xt)} L ${me.boundPixel(Pt, !1, D)} ${me.boundPixel(At)}`, stroke: Ce, strokeWidth: 1, vectorEffect: "non-scaling-stroke", ...M }, fe + je + ":" + ge));
3119
+ gt && (ce = ce.sort(G.rowFirstRangeComparator));
3120
+ const Xe = v.getLayout(), Lt = Xe.getColOffset(Be + 1);
3121
+ let vt = xe;
3122
+ for (let pe = 0; pe < ce.length + 1; pe++) {
3123
+ let wt = vt, $t = be;
3124
+ const Wt = ce[pe];
3125
+ pe < ce.length && ($t = Math.min(be, Xe.getRowOffset(Wt.rowStart)), vt = Math.min(be, Xe.getRowOffset(Wt.rowEnd + 1)));
3126
+ let Ce = _;
3127
+ j.push(q("path", { d: `M ${we.boundPixel(Lt, !1, A)} ${we.boundPixel(wt)} L ${we.boundPixel(Lt, !1, A)} ${we.boundPixel($t)}`, stroke: Ce, strokeWidth: 1, vectorEffect: "non-scaling-stroke", ...R }, fe + Be + ":" + pe));
3127
3128
  }
3128
- for (let ge = ce.length - 1; ge >= 0; ge--) ce[ge].colEnd <= se[Fe + 1] && ce.splice(ge, 1);
3129
+ for (let pe = ce.length - 1; pe >= 0; pe--) ce[pe].colEnd <= se[$e + 1] && ce.splice(pe, 1);
3129
3130
  }
3130
3131
  }
3131
3132
  }, $n = (v) => {
3132
- if (!Qt) return;
3133
- const P = {};
3134
- for (let D = 0; D < rn.length; D++) {
3135
- const F = rn[D], j = Ae[F], fe = [];
3136
- Gn(j, v, 0, fe, v ? Qt[F].rangesH : Qt[F].rangesV);
3137
- const se = j.getRangeCoordsBounds(), ve = Math.ceil(se.width), ye = Math.ceil(se.height);
3138
- P[F] = Y("svg", { width: `${ve}`, height: `${ye}`, viewBox: `0 0 ${ve} ${ye}`, preserveAspectRatio: "none", shapeRendering: "crispEdges", style: { position: "absolute" }, children: fe });
3139
- }
3140
- return P;
3141
- }, Zn = Ee(() => x === !0 || x?.horizontal === !0 ? $n(!0) : null, [gt, x, Ie, L, _, E, I, r, i, Ne, Mt, Qt]), Jn = Ee(() => x === !0 || x?.vertical === !0 ? $n(!1) : null, [gt, x, Le, L, _, E, M, r, i, Q, nt, Qt]), Eo = Ee(() => Tt.left === 0 ? null : Y(jr, { linePoints: [0, 0, 0, Q + 1], bounds: { x: Tt.left, y: 0, width: 1, height: Q + 1 }, ...le }), [gt, Tt.left, Q, le]), _o = Ee(() => Tt.top === 0 ? null : Y(jr, { linePoints: [0, 0, Ne + 1, 0], bounds: { x: 0, y: Tt.top, width: Ne + 1, height: 1 }, ...$ }), [gt, Tt.top, Ne, $]), Bn = Ee(() => {
3142
- const v = [], P = (D) => {
3143
- if (!D || !Ae[D]) return;
3144
- const F = Ae[D].getBounds();
3145
- return Ht("div", { style: { position: "absolute", pointerEvents: "none", left: F.x, top: F.y, width: F.width, height: F.height, clip: `rect(0, ${F.width + 1}px, ${F.height + 1}px, 0)` }, className: `view view-${D}`, children: [Zn?.[D], Jn?.[D], Qt?.[D].cells] }, `view:${D}`);
3133
+ if (!Jt) return;
3134
+ const O = {};
3135
+ for (let A = 0; A < rn.length; A++) {
3136
+ const j = rn[A], V = ze[j], fe = [];
3137
+ Gn(V, v, 0, fe, v ? Jt[j].rangesH : Jt[j].rangesV);
3138
+ const se = V.getRangeCoordsBounds(), xe = Math.ceil(se.width), be = Math.ceil(se.height);
3139
+ O[j] = q("svg", { width: `${xe}`, height: `${be}`, viewBox: `0 0 ${xe} ${be}`, preserveAspectRatio: "none", shapeRendering: "crispEdges", style: { position: "absolute" }, children: fe });
3140
+ }
3141
+ return O;
3142
+ }, Zn = _e(() => x === !0 || x?.horizontal === !0 ? $n(!0) : null, [ut, x, Ie, z, C, _, I, r, i, We, Tt, Jt]), Jn = _e(() => x === !0 || x?.vertical === !0 ? $n(!1) : null, [ut, x, Oe, z, C, _, R, r, i, Q, nt, Jt]), Eo = _e(() => Rt.left === 0 ? null : q(jr, { linePoints: [0, 0, 0, Q + 1], bounds: { x: Rt.left, y: 0, width: 1, height: Q + 1 }, ...le }), [ut, Rt.left, Q, le]), _o = _e(() => Rt.top === 0 ? null : q(jr, { linePoints: [0, 0, We + 1, 0], bounds: { x: 0, y: Rt.top, width: We + 1, height: 1 }, ...B }), [ut, Rt.top, We, B]), Bn = _e(() => {
3143
+ const v = [], O = (A) => {
3144
+ if (!A || !ze[A]) return;
3145
+ const j = ze[A].getBounds();
3146
+ return Ht("div", { style: { position: "absolute", pointerEvents: "none", left: j.x, top: j.y, width: j.width, height: j.height, clip: `rect(0, ${j.width + 1}px, ${j.height + 1}px, 0)` }, className: `view view-${A}`, children: [Zn?.[A], Jn?.[A], Jt?.[A].cells] }, `view:${A}`);
3146
3147
  };
3147
- for (let D = 0; D < rn.length; D++) v.push(P(rn[D]));
3148
- return Y(wn, { children: v });
3149
- }, [Ae, Zn, Jn, Qt]), Io = Ee(() => {
3148
+ for (let A = 0; A < rn.length; A++) v.push(O(rn[A]));
3149
+ return q(wn, { children: v });
3150
+ }, [ze, Zn, Jn, Jt]), Io = _e(() => {
3150
3151
  if (!t) return;
3151
- const v = (se, ve, ye, ce) => {
3152
+ const v = (se, xe, be, ce) => {
3152
3153
  if (!ce || ce.length === 0) return;
3153
- const Ve = [];
3154
- for (let ut = 0; ut < ce.length; ut++) {
3155
- const Fe = ce[ut];
3156
- let je = se?.get(Fe);
3157
- je !== Fo && (je = Fe(ye) ?? Fo), ve.set(Fe, je), je && je !== Fo && Ve.push(je);
3154
+ const Fe = [];
3155
+ for (let ft = 0; ft < ce.length; ft++) {
3156
+ const $e = ce[ft];
3157
+ let Be = se?.get($e);
3158
+ Be !== Fo && (Be = $e(be) ?? Fo), xe.set($e, Be), Be && Be !== Fo && Fe.push(Be);
3158
3159
  }
3159
- return Ve;
3160
- }, P = (se, ve, ye) => {
3161
- if (!ye) return;
3162
- const ce = ye.getBounds(), Ve = ye.getInsets(), ut = ye.getAnchor();
3163
- return Ht("div", { className: En("view", `view-${ut}`, Wr.view), style: { position: "absolute", pointerEvents: "none", left: ce.x - Ve.left, top: ce.y - Ve.top, width: ce.width - (Ve.left + Ve.right), height: ce.height - (Ve.top + Ve.bottom), clipPath: C ? "inset(-2px)" : "inset(0px)" }, children: [v(se, ve, ye, k), So?.[ut].overlays] }, `view:${ut}`);
3164
- }, D = rt.current, F = {}, j = [], fe = Object.keys(Ae);
3160
+ return Fe;
3161
+ }, O = (se, xe, be) => {
3162
+ if (!be) return;
3163
+ const ce = be.getBounds(), Fe = be.getInsets(), ft = be.getAnchor();
3164
+ return Ht("div", { className: En("view", `view-${ft}`, Wr.view), style: { position: "absolute", pointerEvents: "none", left: ce.x - Fe.left, top: ce.y - Fe.top, width: ce.width - (Fe.left + Fe.right), height: ce.height - (Fe.top + Fe.bottom), clipPath: h ? "inset(-2px)" : "inset(0px)" }, children: [v(se, xe, be, T), So?.[ft].overlays] }, `view:${ft}`);
3165
+ }, A = rt.current, j = {}, V = [], fe = Object.keys(ze);
3165
3166
  for (let se = 0; se < fe.length; se++) {
3166
- const ve = fe[se], ye = D?.[ve], ce = F[ve] = /* @__PURE__ */ new Map();
3167
- j.push(P(ye, ce, Ae[ve]));
3168
- }
3169
- return rt.current = F, j;
3170
- }, [gt, Ae, C, k]), Co = Ee(() => {
3171
- const { style: v, ...P } = ee ?? {};
3172
- return Y("div", { style: { width: Ne, height: Q, ...v }, className: "sheetxl-stage", tabIndex: 0, ref: at, ...P, ...S, children: W ? W(Bn) : Bn });
3173
- }, [Ne, Q, Bn, ee, W]), Qn = J(!1);
3167
+ const xe = fe[se], be = A?.[xe], ce = j[xe] = /* @__PURE__ */ new Map();
3168
+ V.push(O(be, ce, ze[xe]));
3169
+ }
3170
+ return rt.current = j, V;
3171
+ }, [ut, ze, h, T]), Co = _e(() => {
3172
+ const { style: v, ...O } = J ?? {};
3173
+ return q("div", { style: { width: We, height: Q, ...v }, className: "sheetxl-stage", tabIndex: 0, ref: Ve, ...O, ...Ye, children: K ? K(Bn) : Bn });
3174
+ }, [We, Q, Bn, J, K]), Qn = Z(!1);
3174
3175
  return st(() => {
3175
- !Qn.current && Qt && (Qn.current = !0, Re?.(vn.current));
3176
- }, [Qt]), Ht("div", { className: En("sheetxl-grid", Wr["sheetxl-grid"]), style: { overflow: "visible", cursor: R, maxWidth: Ne, maxHeight: Q, width: Ne, height: Q, ..._e }, ref: vn, children: [Co, Ht("div", { className: En("sheetxl-overlays"), ref: pt, ...u, children: [Io, Eo, _o] })] });
3176
+ !Qn.current && Jt && (Qn.current = !0, me?.(vn.current));
3177
+ }, [Jt]), Ht("div", { className: En("sheetxl-grid", Wr["sheetxl-grid"]), style: { overflow: "visible", cursor: P, maxWidth: We, maxHeight: Q, width: We, height: Q, ...Se }, ref: vn, children: [Co, Ht("div", { className: En("sheetxl-overlays"), ref: dt, ...S, children: [Io, Eo, _o] })] });
3177
3178
  }));
3178
3179
  Ci.displayName = "BaseGrid";
3179
- const Mi = Dt(Ut((e, t) => {
3180
+ const Mi = At(Ut((e, t) => {
3180
3181
  const { width: n, height: o, style: r = {}, className: i, ...l } = e, [s, { width: a, height: d }] = _i();
3181
- return Y("div", { className: i, style: { ...r }, children: Y("div", { style: { position: "relative", top: "0px", left: "0px", width: "100%", height: "100%", maxWidth: "100%", maxHeight: "100%", boxSizing: "content-box" }, ref: s, children: Y(Ci, { ref: t, width: n ?? a, height: o ?? d, ...l }) }) });
3182
+ return q("div", { className: i, style: { ...r }, children: q("div", { style: { position: "relative", top: "0px", left: "0px", width: "100%", height: "100%", maxWidth: "100%", maxHeight: "100%", boxSizing: "content-box" }, ref: s, children: q(Ci, { ref: t, width: n ?? a, height: o ?? d, ...l }) }) });
3182
3183
  }));
3183
3184
  Mi.displayName = "Grid";
3184
- const rs = Dt(Ut((e, t) => {
3185
- const { showVerticalScrollbar: n, showHorizontalScrollbar: o, createHorizontalScrollbar: r, createVerticalScrollbar: i, createScrollCorner: l, viewport: s, onScrollViewport: a, style: d = {}, className: g, onScroll: m, ...f } = e, [x, E] = Je(null), I = J(null), M = J(null);
3186
- ao(!s), Ur(t, () => M.current && I.current ? Object.assign(M.current, I.current) : null);
3187
- const ae = O((R) => {
3188
- M.current?.scrollTo(R), a?.(R);
3185
+ const rs = At(Ut((e, t) => {
3186
+ const { showVerticalScrollbar: n, showHorizontalScrollbar: o, createHorizontalScrollbar: r, createVerticalScrollbar: i, createScrollCorner: l, viewport: s, onScrollViewport: a, style: d = {}, className: g, onScroll: m, ...f } = e, [x, _] = Ze(null), I = Z(null), R = Z(null);
3187
+ ao(!s), Ur(t, () => R.current && I.current ? Object.assign(R.current, I.current) : null);
3188
+ const ae = D((P) => {
3189
+ R.current?.scrollTo(P), a?.(P);
3189
3190
  }, []);
3190
- return Y(pi, { className: g, style: d, ref: I, showVerticalScrollbar: n, showHorizontalScrollbar: o, createHorizontalScrollbar: r, createVerticalScrollbar: i, createScrollCorner: l, viewport: x, onScrollViewport: ae, children: Y(Mi, { style: { width: "100%", height: "100%" }, ...f, onViewportChange: (R) => E(R), ref: M }) });
3191
+ return q(pi, { className: g, style: d, ref: I, showVerticalScrollbar: n, showHorizontalScrollbar: o, createHorizontalScrollbar: r, createVerticalScrollbar: i, createScrollCorner: l, viewport: x, onScrollViewport: ae, children: q(Mi, { style: { width: "100%", height: "100%" }, ...f, onViewportChange: (P) => _(P), ref: R }) });
3191
3192
  }));
3192
3193
  rs.displayName = "ScrollableGrid";
3193
- const Nr = () => !1, is = Dt((e) => {
3194
- const { index: t, value: n, zoom: o, zoomScale: r = 100, headerText: i = (k) => `${k}`, headerStyle: l, headerStyleSelect: s = l, headerStyleSelectAll: a = s, headerStyleHover: d = a, verticalPadding: g = 0, horizontalPadding: m = 0, isSelected: f = Nr, isSelectedAll: x = Nr, coords: E, bounds: I, range: M, orientation: ae, view: R, style: _, ...L } = e, le = r / 100, $ = J(null), [oe, be] = Je(!1), U = f?.(t) || !1, H = x?.(t) ? a : U ? s : l;
3194
+ const Nr = () => !1, is = At((e) => {
3195
+ const { index: t, value: n, zoom: o, zoomScale: r = 100, headerText: i = (T) => `${T}`, headerStyle: l, headerStyleSelect: s = l, headerStyleSelectAll: a = s, headerStyleHover: d = a, verticalPadding: g = 0, horizontalPadding: m = 0, isSelected: f = Nr, isSelectedAll: x = Nr, coords: _, bounds: I, range: R, orientation: ae, view: P, style: C, ...z } = e, le = r / 100, B = Z(null), [oe, ve] = Ze(!1), N = f?.(t) || !1, H = x?.(t) ? a : N ? s : l;
3195
3196
  let X = H;
3196
3197
  if (oe) {
3197
- let k = d;
3198
- typeof d == "function" && (k = d(H)), X = Ct.mergeContentful(H, k);
3198
+ let T = d;
3199
+ typeof d == "function" && (T = d(H)), X = Ct.mergeContentful(H, T);
3199
3200
  }
3200
- return Y("div", { ref: $, style: { background: X.fill, color: X.text?.fill, fontFamily: X.text?.fontFamily ?? l.text?.fontFamily, fontSize: 96 * (X.text?.fontSize ?? 11) / 72 * le, fontStyle: X.text?.fontStyle, fontWeight: X.text?.fontWeight, lineHeight: 1.2, display: "flex", justifyContent: "center", alignItems: "end", pointerEvents: "auto", paddingBottom: `${le}px`, ..._, left: _.left - (ae === Nt ? 1 : 0), top: _.top - (ae === cn ? 1 : 0), width: _.width + 1, height: _.height + 1, overflow: "hidden" }, ...L, onMouseMove: (k) => {
3201
- me.detectIt().primaryInput !== "touch" && k.buttons === 0 && be(!0);
3202
- }, onMouseOut: (k) => {
3203
- be(!1);
3201
+ return q("div", { ref: B, style: { background: X.fill, color: X.text?.fill, fontFamily: X.text?.fontFamily ?? l.text?.fontFamily, fontSize: 96 * (X.text?.fontSize ?? 11) / 72 * le, fontStyle: X.text?.fontStyle, fontWeight: X.text?.fontWeight, lineHeight: 1.2, display: "flex", justifyContent: "center", alignItems: "end", pointerEvents: "auto", paddingBottom: `${le}px`, ...C, left: C.left - (ae === Nt ? 1 : 0), top: C.top - (ae === an ? 1 : 0), width: C.width + 1, height: C.height + 1, overflow: "hidden" }, ...z, onMouseMove: (T) => {
3202
+ we.detectIt().primaryInput !== "touch" && T.buttons === 0 && ve(!0);
3203
+ }, onMouseOut: (T) => {
3204
+ ve(!1);
3204
3205
  }, children: i(t) });
3205
3206
  });
3206
3207
  is.displayName = "HeaderRenderer";
3207
- const Ti = "ew-resize", Ri = "ns-resize", ls = Dt(Ut((e, t) => {
3208
- const { orientation: n, view: o, index: r, className: i, style: l, disabled: s = !1, disabledResize: a = !1, isNextHidden: d, isHidden: g, isSelected: m, isSelectedAll: f, showTouchDivider: x, headerStyle: E, headerStyleSelect: I, headerStyleSelectAll: M, headerStyleHover: ae, bounds: R, onPointerDown: _, onAutoFit: L, ...le } = e, $ = n === Nt;
3209
- let oe = E;
3210
- m && I && (oe = I), f && M && (oe = M);
3211
- const be = me.detectIt().primaryInput === "touch";
3212
- let U = $ ? 14 : 8, H = U / 2, X = 0;
3213
- d && (X = -2), g && (X = 2), g && (U = U / 2 + X, H = 2 * X);
3214
- let k = oe.dividerStrokeFill ?? oe.strokeFill;
3215
- return !(m || f) && X === 0 && (k = `linear-gradient(${$ ? 180 : 90}deg, ${oe.fill}, ${k} 55%, ${k} 100%)`), Ht("div", { className: En("header-divider", { disabled: s }, i, `index-${r}`), ref: t, onPointerDown: be ? void 0 : _, onDoubleClick: be ? void 0 : () => L?.(), style: { top: ($ ? 0 : -U / 2 + (X - 1)) + "px", left: ($ ? -U / 2 + (X - 1) : 0) + "px", width: $ ? U : "calc(100% + 1px)", height: $ ? "calc(100% + 1px)" : U, position: "absolute", overflow: "visible", pointerEvents: "all", cursor: s || a || be ? void 0 : $ ? Ti : Ri, ...l }, ...le, children: [Y("div", { style: { position: "relative", top: `${$ ? 0 : H}px`, left: `${$ ? H : 0}px`, width: $ ? 1 : "100%", height: $ ? "100%" : 1, background: k }, onDoubleClick: () => L?.() }), x && be ? Y("div", { style: { position: "absolute", cursor: "grab", zIndex: 1, borderRadius: "4px", right: $ ? "-6px" : "2px", bottom: $ ? "2px" : "-9px", height: "24px", width: $ ? "24px" : "18px", maxHeight: $ ? "calc(100% - 4px)" : void 0, maxWidth: $ ? void 0 : "calc(100% - 4px)", background: oe.fill, border: `${M.edgeStrokeFill} solid 1px`, boxShadow: `0.5px 0.5px 0px 0px ${E.text.fill}`, display: "flex", alignItems: "center", justifyContent: "center" }, onPointerDown: _, children: Y("div", { style: { width: "6.4px", height: "12px", backgroundImage: `url("data:image/svg+xml,%3Csvg width='6.4' height='12' viewBox='0 0 9.6 16' version='1.1' fill='${encodeURIComponent(I.text.fill)}' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3E%3Cpath d='M 9.60008,14.40009 C 9.60008,15.28374 8.88368,16 8.00003,16 7.11639,16 6.40012,15.28374 6.40012,14.40009 c 0,-0.88365 0.71627,-1.60005 1.59991,-1.60005 0.88365,0 1.60005,0.7164 1.60005,1.60005 m 0,-6.40012 c 0,0.88364 -0.7164,1.60004 -1.60005,1.60004 -0.88364,0 -1.59991,-0.7164 -1.59991,-1.60004 0,-0.88365 0.71627,-1.60005 1.59991,-1.60005 0.88365,0 1.60005,0.7164 1.60005,1.60005 m 0,-6.40006 c 0,0.88365 -0.7164,1.60005 -1.60005,1.60005 -0.88364,0 -1.59991,-0.7164 -1.59991,-1.60005 C 6.40012,0.71626 7.11639,0 8.00003,0 8.88368,0 9.60008,0.71626 9.60008,1.59991 M 3.19996,14.40009 C 3.19996,15.28374 2.48369,16 1.60005,16 0.7164,16 0,15.28374 0,14.40009 c 0,-0.88365 0.7164,-1.60005 1.60005,-1.60005 0.88364,0 1.59991,0.7164 1.59991,1.60005 m 0,-6.40012 c 0,0.88364 -0.71627,1.60004 -1.59991,1.60004 C 0.7164,9.60001 0,8.88361 0,7.99997 0,7.11632 0.7164,6.39992 1.60005,6.39992 c 0.88364,0 1.59991,0.7164 1.59991,1.60005 m 0,-6.40006 c 0,0.88365 -0.71627,1.60005 -1.59991,1.60005 C 0.7164,3.19996 0,2.48356 0,1.59991 0,0.71626 0.7164,0 1.60005,0 2.48369,0 3.19996,0.71626 3.19996,1.59991' /%3E%3C/svg%3E%0A")`, backgroundRepeat: "no-repeat", backgroundPosition: "center", transform: $ ? void 0 : "rotate(90deg)" } }) }) : null] });
3216
- })), ss = (e, t) => Y(ls, { ...e, ref: t }), vs = Dt(Ut((e, t) => {
3217
- const { orientation: n, view: o, index: r, disabled: i = !1, disabledResize: l = !1, resizeThreshold: s = 1, dividerRenderer: a = ss, onDividerMouseDown: d, onDividerResizeStart: g, onDividerResize: m, onDividerResizeEnd: f, onDividerMouseUp: x, onDividerAutoFit: E, onPointerDown: I, ...M } = e, ae = T(I, [I]), R = T(E, [E]), _ = n === Nt;
3218
- let L = _ ? o.getVisibleColumns() : o.getVisibleRows(), le = null;
3219
- L.length > 0 && (_ ? le = o.getRangeCoordsBounds({ rowStart: 0, rowEnd: 0, colStart: L[0], colEnd: L[L.length - 1] }) : o.getRangeCoordsBounds({ rowStart: L[0], rowEnd: L[L.length - 1], colStart: 0, colEnd: 0 }), le = o.toClipBounds(le, tn));
3220
- const $ = J(null), [oe, be] = Je(null), U = (A, q) => _ ? A.clientX - q.clientX : A.clientY - q.clientY, H = o.getLayout(), X = _ ? H.getColOffset(r + 1) : H.getRowOffset(r + 1), k = On({ processTouch: !0, onPointerDown: (A) => {
3221
- if (ae?.(A), !i && !l) {
3222
- const q = _ ? H.getColOffset(r) : H.getRowOffset(r), N = X - q;
3223
- $.current = { isResizing: !1, startSize: N, index: r, view: o, orientation: n, onDividerMouseDown: d, onDividerResizeStart: g, onDividerResize: m, onDividerResizeEnd: f, onDividerMouseUp: x }, be($.current), d?.(r, N);
3224
- }
3225
- A.stopPropagation(), A.preventDefault();
3226
- }, onPointerUp: (A, q, N) => {
3227
- if (!$.current) return;
3228
- $.current.isResizing && $.current.onDividerResizeEnd?.($.current.index, Math.max(0, $.current.startSize + U(A, N)), $.current.startSize);
3229
- const xe = $.current;
3230
- $.current = null, be($.current), xe.onDividerMouseUp?.(xe.index);
3231
- }, onPointerMoveOrWait: (A, q, N) => {
3232
- if (!$.current) return;
3233
- const xe = U(A, N);
3234
- $.current.isResizing ? $.current.onDividerResize?.($.current.index, Math.max(0, $.current.startSize + xe), $.current.startSize) : Math.abs(xe) > Math.max(1, s) && ($.current = { ...$.current, isResizing: !0 }, be($.current), $.current.onDividerResizeStart?.($.current.index, Math.max(0, $.current.startSize + xe))), A.stopPropagation(), A.preventDefault();
3235
- } }), u = T(() => {
3236
- R?.(r);
3208
+ const Ti = "ew-resize", Ri = "ns-resize", ls = At(Ut((e, t) => {
3209
+ const { orientation: n, view: o, index: r, className: i, style: l, disabled: s = !1, disabledResize: a = !1, isNextHidden: d, isHidden: g, isSelected: m, isSelectedAll: f, showTouchDivider: x, headerStyle: _, headerStyleSelect: I, headerStyleSelectAll: R, headerStyleHover: ae, bounds: P, onPointerDown: C, onAutoFit: z, ...le } = e, B = n === Nt;
3210
+ let oe = _;
3211
+ m && I && (oe = I), f && R && (oe = R);
3212
+ const ve = we.detectIt().primaryInput === "touch";
3213
+ let N = B ? 14 : 8, H = N / 2, X = 0;
3214
+ d && (X = -2), g && (X = 2), g && (N = N / 2 + X, H = 2 * X);
3215
+ let T = oe.dividerStrokeFill ?? oe.strokeFill;
3216
+ return !(m || f) && X === 0 && (T = `linear-gradient(${B ? 180 : 90}deg, ${oe.fill}, ${T} 55%, ${T} 100%)`), Ht("div", { className: En("header-divider", { disabled: s }, i, `index-${r}`), ref: t, onPointerDown: ve ? void 0 : C, onDoubleClick: ve ? void 0 : () => z?.(), style: { top: (B ? 0 : -N / 2 + (X - 1)) + "px", left: (B ? -N / 2 + (X - 1) : 0) + "px", width: B ? N : "calc(100% + 1px)", height: B ? "calc(100% + 1px)" : N, position: "absolute", overflow: "visible", pointerEvents: "all", cursor: s || a || ve ? void 0 : B ? Ti : Ri, ...l }, ...le, children: [q("div", { style: { position: "relative", top: `${B ? 0 : H}px`, left: `${B ? H : 0}px`, width: B ? 1 : "100%", height: B ? "100%" : 1, background: T }, onDoubleClick: () => z?.() }), x && ve ? q("div", { style: { position: "absolute", cursor: "grab", zIndex: 1, borderRadius: "4px", right: B ? "-6px" : "2px", bottom: B ? "2px" : "-9px", height: "24px", width: B ? "24px" : "18px", maxHeight: B ? "calc(100% - 4px)" : void 0, maxWidth: B ? void 0 : "calc(100% - 4px)", background: oe.fill, border: `${R.edgeStrokeFill} solid 1px`, boxShadow: `0.5px 0.5px 0px 0px ${_.text.fill}`, display: "flex", alignItems: "center", justifyContent: "center" }, onPointerDown: C, children: q("div", { style: { width: "6.4px", height: "12px", backgroundImage: `url("data:image/svg+xml,%3Csvg width='6.4' height='12' viewBox='0 0 9.6 16' version='1.1' fill='${encodeURIComponent(I.text.fill)}' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3E%3Cpath d='M 9.60008,14.40009 C 9.60008,15.28374 8.88368,16 8.00003,16 7.11639,16 6.40012,15.28374 6.40012,14.40009 c 0,-0.88365 0.71627,-1.60005 1.59991,-1.60005 0.88365,0 1.60005,0.7164 1.60005,1.60005 m 0,-6.40012 c 0,0.88364 -0.7164,1.60004 -1.60005,1.60004 -0.88364,0 -1.59991,-0.7164 -1.59991,-1.60004 0,-0.88365 0.71627,-1.60005 1.59991,-1.60005 0.88365,0 1.60005,0.7164 1.60005,1.60005 m 0,-6.40006 c 0,0.88365 -0.7164,1.60005 -1.60005,1.60005 -0.88364,0 -1.59991,-0.7164 -1.59991,-1.60005 C 6.40012,0.71626 7.11639,0 8.00003,0 8.88368,0 9.60008,0.71626 9.60008,1.59991 M 3.19996,14.40009 C 3.19996,15.28374 2.48369,16 1.60005,16 0.7164,16 0,15.28374 0,14.40009 c 0,-0.88365 0.7164,-1.60005 1.60005,-1.60005 0.88364,0 1.59991,0.7164 1.59991,1.60005 m 0,-6.40012 c 0,0.88364 -0.71627,1.60004 -1.59991,1.60004 C 0.7164,9.60001 0,8.88361 0,7.99997 0,7.11632 0.7164,6.39992 1.60005,6.39992 c 0.88364,0 1.59991,0.7164 1.59991,1.60005 m 0,-6.40006 c 0,0.88365 -0.71627,1.60005 -1.59991,1.60005 C 0.7164,3.19996 0,2.48356 0,1.59991 0,0.71626 0.7164,0 1.60005,0 2.48369,0 3.19996,0.71626 3.19996,1.59991' /%3E%3C/svg%3E%0A")`, backgroundRepeat: "no-repeat", backgroundPosition: "center", transform: B ? void 0 : "rotate(90deg)" } }) }) : null] });
3217
+ })), ss = (e, t) => q(ls, { ...e, ref: t }), vs = At(Ut((e, t) => {
3218
+ const { orientation: n, view: o, index: r, disabled: i = !1, disabledResize: l = !1, resizeThreshold: s = 1, dividerRenderer: a = ss, onDividerMouseDown: d, onDividerResizeStart: g, onDividerResize: m, onDividerResizeEnd: f, onDividerMouseUp: x, onDividerAutoFit: _, onPointerDown: I, ...R } = e, ae = k(I, [I]), P = k(_, [_]), C = n === Nt;
3219
+ let z = C ? o.getVisibleColumns() : o.getVisibleRows(), le = null;
3220
+ z.length > 0 && (C ? le = o.getRangeCoordsBounds({ rowStart: 0, rowEnd: 0, colStart: z[0], colEnd: z[z.length - 1] }) : o.getRangeCoordsBounds({ rowStart: z[0], rowEnd: z[z.length - 1], colStart: 0, colEnd: 0 }), le = o.toClipBounds(le, en));
3221
+ const B = Z(null), [oe, ve] = Ze(null), N = (L, U) => C ? L.clientX - U.clientX : L.clientY - U.clientY, H = o.getLayout(), X = C ? H.getColOffset(r + 1) : H.getRowOffset(r + 1), T = On({ processTouch: !0, onPointerDown: (L) => {
3222
+ if (ae?.(L), !i && !l) {
3223
+ const U = C ? H.getColOffset(r) : H.getRowOffset(r), ee = X - U;
3224
+ B.current = { isResizing: !1, startSize: ee, index: r, view: o, orientation: n, onDividerMouseDown: d, onDividerResizeStart: g, onDividerResize: m, onDividerResizeEnd: f, onDividerMouseUp: x }, ve(B.current), d?.(r, ee);
3225
+ }
3226
+ L.stopPropagation(), L.preventDefault();
3227
+ }, onPointerUp: (L, U, ee) => {
3228
+ if (!B.current) return;
3229
+ B.current.isResizing && B.current.onDividerResizeEnd?.(B.current.index, Math.max(0, B.current.startSize + N(L, ee)), B.current.startSize);
3230
+ const te = B.current;
3231
+ B.current = null, ve(B.current), te.onDividerMouseUp?.(te.index);
3232
+ }, onPointerMoveOrWait: (L, U, ee) => {
3233
+ if (!B.current) return;
3234
+ const te = N(L, ee);
3235
+ B.current.isResizing ? B.current.onDividerResize?.(B.current.index, Math.max(0, B.current.startSize + te), B.current.startSize) : Math.abs(te) > Math.max(1, s) && (B.current = { ...B.current, isResizing: !0 }, ve(B.current), B.current.onDividerResizeStart?.(B.current.index, Math.max(0, B.current.startSize + te))), L.stopPropagation(), L.preventDefault();
3236
+ } }), S = k(() => {
3237
+ P?.(r);
3237
3238
  }, [r]);
3238
3239
  if (!le) return;
3239
- const C = a({ bounds: le, orientation: n, view: o, index: r, disabled: i, disabledResize: l, onAutoFit: u, onPointerDown: k, ...M }, t);
3240
- if (!C) return;
3241
- const { getPortalContainer: ee } = gi();
3242
- let W = null;
3243
- return oe && oe.isResizing && oe.index === r && (W = Kr(Y("div", { style: { position: "absolute", cursor: _ ? Ti : Ri, left: 0, top: 0, width: "100%", height: "100%" } }), ee(), "divider:" + r)), Ht(wn, { children: [W, Y("div", { className: En("header-divider-anchor"), style: { position: "absolute", pointerEvents: "auto", top: `${_ ? le.y : X}px`, left: `${_ ? X : le.x}px`, width: (_ ? 0 : le.width - 1) + "px", height: (_ ? le.height - 1 : 0) + "px", display: "flex" }, tabIndex: -1, children: C })] });
3240
+ const h = a({ bounds: le, orientation: n, view: o, index: r, disabled: i, disabledResize: l, onAutoFit: S, onPointerDown: T, ...R }, t);
3241
+ if (!h) return;
3242
+ const { getPortalContainer: J } = gi();
3243
+ let K = null;
3244
+ return oe && oe.isResizing && oe.index === r && (K = qr(q("div", { style: { position: "absolute", cursor: C ? Ti : Ri, left: 0, top: 0, width: "100%", height: "100%" } }), J(), "divider:" + r)), Ht(wn, { children: [K, q("div", { className: En("header-divider-anchor"), style: { position: "absolute", pointerEvents: "auto", top: `${C ? le.y : X}px`, left: `${C ? X : le.x}px`, width: (C ? 0 : le.width - 1) + "px", height: (C ? le.height - 1 : 0) + "px", display: "flex" }, tabIndex: -1, children: h })] });
3244
3245
  }));
3245
3246
  class cs {
3246
3247
  naturalDimensions(t, n = {}) {
@@ -3260,92 +3261,92 @@ class cs {
3260
3261
  return i.remove(), { width: s.width, height: s.height, maxLineHeight: 1.2 * (n.paintableText?.fontSize || 1056 / 72) };
3261
3262
  }
3262
3263
  }
3263
- const as = (e = void 0) => Object.freeze({ clean: e, dirty: void 0, editMode: !1 }), ds = as(), ys = Dt(Ut((e, t) => {
3264
- const { editState: n = ds, defaultTextStyle: o, onStartEdit: r, onChangeEdit: i, onSubmitEdit: l, onCancelEdit: s, onDoneEdit: a, containerBounds: d, setNaturalDimensions: g, onNavigate: m, textProperties: f, style: x, autoFocus: E, ...I } = e, M = J(null), { width: ae = 0 } = d ?? {}, [R, _] = Je(() => n);
3264
+ const as = (e = void 0) => Object.freeze({ clean: e, dirty: void 0, editMode: !1 }), ds = as(), ys = At(Ut((e, t) => {
3265
+ const { editState: n = ds, defaultTextStyle: o, onStartEdit: r, onChangeEdit: i, onSubmitEdit: l, onCancelEdit: s, onDoneEdit: a, containerBounds: d, setNaturalDimensions: g, onNavigate: m, textProperties: f, style: x, autoFocus: _, ...I } = e, R = Z(null), { width: ae = 0 } = d ?? {}, [P, C] = Ze(() => n);
3265
3266
  st(() => {
3266
- _(n);
3267
+ C(n);
3267
3268
  }, [n]);
3268
- const L = f?.align || "left", le = f?.vAlign || "middle", $ = f?.fill || "#040404", oe = f?.wrap || "wrap", be = f?.fontFamily || "Calibri", U = f?.fontSize || 11, H = f?.fontWeight || 400, X = f?.fontStyle || "normal", k = R.dirty ?? R.clean ?? "";
3269
- let u = 2;
3270
- const C = 96 * U / 72, ee = 1.2 * C;
3271
- le === "right" && (u += 1);
3272
- const W = Ee(() => new cs().naturalDimensions(k, { maxWidth: oe === "wrap" ? ae - u : void 0, lineHeight: `${ee}px`, paintableText: { fontStyle: X, wrap: oe, letterSpacing: -0.25 } }), [k, oe, u, C, be, H, X, g, ae]), A = O(() => W.maxLineHeight ? W.maxLineHeight + "px" : "1.2", [W]), [q, N] = Je(A);
3273
- nn(() => {
3274
- N(A());
3275
- }, [d, W]), nn(() => {
3276
- g?.({ width: oe === "wrap" ? void 0 : W.width + u, height: W.height });
3277
- }, [W, g]);
3278
- const xe = T(i, [i]), G = T((K) => {
3279
- if (R.dirty === K) return;
3280
- const pe = { ...R };
3281
- pe.dirty = K, M.current, _(pe), xe?.(pe);
3282
- }, [R]), He = T((K) => {
3283
- if (R.editMode === K) return;
3284
- const pe = { ...R };
3285
- pe.editMode = K, _(pe), xe?.(pe);
3286
- }, [R]), Ue = T(() => {
3269
+ const z = f?.align || "left", le = f?.vAlign || "middle", B = f?.fill || "#040404", oe = f?.wrap || "wrap", ve = f?.fontFamily || "Calibri", N = f?.fontSize || 11, H = f?.fontWeight || 400, X = f?.fontStyle || "normal", T = P.dirty ?? P.clean ?? "";
3270
+ let S = 2;
3271
+ const h = 96 * N / 72, J = 1.2 * h;
3272
+ le === "right" && (S += 1);
3273
+ const K = _e(() => new cs().naturalDimensions(T, { maxWidth: oe === "wrap" ? ae - S : void 0, lineHeight: `${J}px`, paintableText: { fontStyle: X, wrap: oe, letterSpacing: -0.25 } }), [T, oe, S, h, ve, H, X, g, ae]), L = D(() => K.maxLineHeight ? K.maxLineHeight + "px" : "1.2", [K]), [U, ee] = Ze(L);
3274
+ tn(() => {
3275
+ ee(L());
3276
+ }, [d, K]), tn(() => {
3277
+ g?.({ width: oe === "wrap" ? void 0 : K.width + S, height: K.height });
3278
+ }, [K, g]);
3279
+ const te = k(i, [i]), Y = k((E) => {
3280
+ if (P.dirty === E) return;
3281
+ const Me = { ...P };
3282
+ Me.dirty = E, R.current, C(Me), te?.(Me);
3283
+ }, [P]), He = k((E) => {
3284
+ if (P.editMode === E) return;
3285
+ const Me = { ...P };
3286
+ Me.editMode = E, C(Me), te?.(Me);
3287
+ }, [P]), je = k(() => {
3287
3288
  try {
3288
- return l?.(R), a?.(), !0;
3289
+ return l?.(P), a?.(), !0;
3289
3290
  } catch {
3290
3291
  return !1;
3291
3292
  }
3292
- }, [l, R]), We = T(() => {
3293
- _(n), s?.(), a?.();
3294
- }, [s, n]), ht = T((K) => {
3295
- if (!M.current) return;
3296
- if (K.isDefaultPrevented(), !(K.isTrusted || K.nativeEvent.ctrlKey || K.nativeEvent.metaKey || K.nativeEvent.altKey || K.nativeEvent.isComposing) && vi.indexOf(K.nativeEvent.key) !== -1) {
3297
- const te = { ...R };
3298
- return te.dirty = K.nativeEvent.key === "Backspace" ? "" : (te.dirty ?? "") + K.key, _(te), xe?.(te), void K.preventDefault();
3299
- }
3300
- const pe = K.nativeEvent.shiftKey;
3301
- if (K.which === Ji) return K.preventDefault(), void We();
3302
- if (K.which === ol) return He(!0), void K.preventDefault();
3303
- if (K.which === Zi && (K.preventDefault(), Ue() && m?.(pe ? it : lt)), K.which === Gi) return K.preventDefault(), void (Ue() && m?.(pe ? ot : Ke));
3304
- if (!R.editMode) {
3305
- let te = null;
3306
- switch (K.which) {
3293
+ }, [l, P]), Ne = k(() => {
3294
+ C(n), s?.(), a?.();
3295
+ }, [s, n]), at = k((E) => {
3296
+ if (!R.current) return;
3297
+ if (E.isDefaultPrevented(), !(E.isTrusted || E.nativeEvent.ctrlKey || E.nativeEvent.metaKey || E.nativeEvent.altKey || E.nativeEvent.isComposing) && vi.indexOf(E.nativeEvent.key) !== -1) {
3298
+ const ue = { ...P };
3299
+ return ue.dirty = E.nativeEvent.key === "Backspace" ? "" : (ue.dirty ?? "") + E.key, C(ue), te?.(ue), void E.preventDefault();
3300
+ }
3301
+ const Me = E.nativeEvent.shiftKey;
3302
+ if (E.which === Ji) return E.preventDefault(), void Ne();
3303
+ if (E.which === ol) return He(!0), void E.preventDefault();
3304
+ if (E.which === Zi && (E.preventDefault(), je() && m?.(Me ? it : lt)), E.which === Gi) return E.preventDefault(), void (je() && m?.(Me ? ot : Ke));
3305
+ if (!P.editMode) {
3306
+ let ue = null;
3307
+ switch (E.which) {
3307
3308
  case Qi:
3308
- te = ot;
3309
+ ue = ot;
3309
3310
  break;
3310
3311
  case tl:
3311
- te = Ke;
3312
+ ue = Ke;
3312
3313
  break;
3313
3314
  case el:
3314
- te = it;
3315
+ ue = it;
3315
3316
  break;
3316
3317
  case nl:
3317
- te = lt;
3318
+ ue = lt;
3318
3319
  }
3319
- if (te) return void Ue();
3320
+ if (ue) return void je();
3320
3321
  }
3321
- }, [R, m]), [_e, S] = Je(!E);
3322
+ }, [P, m]), [Se, Ye] = Ze(!_);
3322
3323
  st(() => {
3323
- S(!1);
3324
+ Ye(!1);
3324
3325
  }, []);
3325
- const ue = wo(t, () => ({ startEdit(K) {
3326
- let pe = K?.initialSelection;
3327
- if (!pe) {
3328
- const Re = M.current.value.length ?? 0;
3329
- pe = { start: Re, end: Re, direction: "forward" };
3330
- }
3331
- M.current?.setSelectionRange(pe.start, pe.end, pe.direction);
3332
- const te = { ...n, editMode: K?.editMode ?? !1 };
3333
- K?.text !== void 0 && (te.dirty = K.text), te.editMode === n.editMode && te.dirty === n.dirty || (_(te), xe?.(te));
3334
- }, submitEdit: () => Ue(), cancelEdit() {
3335
- We();
3326
+ const $ = wo(t, () => ({ startEdit(E) {
3327
+ let Me = E?.initialSelection;
3328
+ if (!Me) {
3329
+ const me = R.current.value.length ?? 0;
3330
+ Me = { start: me, end: me, direction: "forward" };
3331
+ }
3332
+ R.current?.setSelectionRange(Me.start, Me.end, Me.direction);
3333
+ const ue = { ...n, editMode: E?.editMode ?? !1 };
3334
+ E?.text !== void 0 && (ue.dirty = E.text), ue.editMode === n.editMode && ue.dirty === n.dirty || (C(ue), te?.(ue));
3335
+ }, submitEdit: () => je(), cancelEdit() {
3336
+ Ne();
3336
3337
  }, autoFocus() {
3337
- M.current?.focus();
3338
- }, getLineHeight: () => W?.maxLineHeight ?? ee, dispatchEvent: (K) => M.current.dispatchEvent(K) }), [n, r]);
3339
- return Y("div", { ref: ue, ...I, style: { background: "transparent", display: "flex", flexGrow: 1, alignSelf: "center", height: W.height, maxWidth: "100%", maxHeight: "100%", ...x }, children: Y("textarea", { spellCheck: "false", ref: M, value: k, autoFocus: !1, disabled: _e, name: "cell-editor", autoComplete: "off", autoCapitalize: "off", style: { flex: "1 1 100%", position: "relative", fontSize: `${C}px`, fontFamily: `${be}`, fontWeight: `${H}`, fontStyle: `${X}`, padding: "0px", marginRight: L === "right" ? "3px" : "0px", marginLeft: L === "left" ? "2px" : "0px", lineHeight: q, height: W.height, textRendering: "geometricPrecision", letterSpacing: "-0.25px", boxSizing: "border-box", borderWidth: 0, outline: "none", resize: "none", overflow: "hidden", verticalAlign: "baseline", textAlign: L, background: "transparent", color: $, marginBottom: "0px", userSelect: "text", maxHeight: "100%", whiteSpace: oe === "wrap" ? "break-spaces" : "pre", wordWrap: "break-word" }, onChange: (K) => {
3340
- G(K.target.value);
3341
- }, onDoubleClick: (K) => {
3342
- K.isTrusted;
3343
- }, onMouseDown: (K) => {
3338
+ R.current?.focus();
3339
+ }, getLineHeight: () => K?.maxLineHeight ?? J, dispatchEvent: (E) => R.current.dispatchEvent(E) }), [n, r]);
3340
+ return q("div", { ref: $, ...I, style: { background: "transparent", display: "flex", flexGrow: 1, alignSelf: "center", height: K.height, maxWidth: "100%", maxHeight: "100%", ...x }, children: q("textarea", { spellCheck: "false", ref: R, value: T, autoFocus: !1, disabled: Se, name: "cell-editor", autoComplete: "off", autoCapitalize: "off", style: { flex: "1 1 100%", position: "relative", fontSize: `${h}px`, fontFamily: `${ve}`, fontWeight: `${H}`, fontStyle: `${X}`, padding: "0px", marginRight: z === "right" ? "3px" : "0px", marginLeft: z === "left" ? "2px" : "0px", lineHeight: U, height: K.height, textRendering: "geometricPrecision", letterSpacing: "-0.25px", boxSizing: "border-box", borderWidth: 0, outline: "none", resize: "none", overflow: "hidden", verticalAlign: "baseline", textAlign: z, background: "transparent", color: B, marginBottom: "0px", userSelect: "text", maxHeight: "100%", whiteSpace: oe === "wrap" ? "break-spaces" : "pre", wordWrap: "break-word" }, onChange: (E) => {
3341
+ Y(E.target.value);
3342
+ }, onDoubleClick: (E) => {
3343
+ E.isTrusted;
3344
+ }, onMouseDown: (E) => {
3344
3345
  He(!0);
3345
- }, onKeyDown: ht }) });
3346
- })), bs = Dt((e) => {
3346
+ }, onKeyDown: at }) });
3347
+ })), bs = At((e) => {
3347
3348
  const { value: t, view: n, bounds: o, range: r, zoom: i, children: l, style: s, ...a } = e;
3348
- return Y("div", { style: { padding: "2px 4px", fontFamily: "Calibri", letterSpacing: -0.25, lineHeight: 1.2, fontSize: s?.fontSize || 1056 / 72, ...s }, ...a, children: t });
3349
+ return q("div", { style: { padding: "2px 4px", fontFamily: "Calibri", letterSpacing: -0.25, lineHeight: 1.2, fontSize: s?.fontSize || 1056 / 72, ...s }, ...a, children: t });
3349
3350
  });
3350
3351
  export {
3351
3352
  Ci as BaseGrid,
@@ -3357,7 +3358,7 @@ export {
3357
3358
  vs as HeaderDivider,
3358
3359
  is as HeaderRenderer,
3359
3360
  xs as RESET_SCROLL_EVENTS_DEBOUNCE_INTERVAL,
3360
- tn as SELECTION_CLIP_INSETS,
3361
+ en as SELECTION_CLIP_INSETS,
3361
3362
  vi as STANDARD_KEY_CHARS,
3362
3363
  jr as SVGLine,
3363
3364
  Yl as SVGRect,