@sheetxl/grid-react 0.7.18 → 0.7.20

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,11 +1,11 @@
1
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
2
  import { jsx as Ce, jsxs as Qt, Fragment as _n } from "react/jsx-runtime";
3
- import { useCallbackRef as P, HorizontalAlignment as mn, KeyCodes as Ot, ReactUtils as X, MouseButtonCodes as jn, useSynchronizedPointerHandler as un, useId as To, useAnimatedMeasure as Do, useFullscreenPortal as fo, SimpleCommand as ie, KeyModifiers as ce, useImperativeElement as go, ScrollPane as Oo } from "@sheetxl/utils-react";
3
+ import { useCallbackRef as k, HorizontalAlignment as mn, KeyCodes as Ot, ReactUtils as X, MouseButtonCodes as jn, useSynchronizedPointerHandler as un, useId as To, useAnimatedMeasure as Do, useFullscreenPortal as fo, SimpleCommand as ie, KeyModifiers as ce, useImperativeElement as go, ScrollPane as Oo } from "@sheetxl/utils-react";
4
4
  import { useRef as se, useReducer as Zn, useState as gt, useEffect as It, useCallback as V, useLayoutEffect as en, useMemo as Ae, memo as Kt, forwardRef as tn, version as zo, createElement as wo, useImperativeHandle as Lo } from "react";
5
5
  import { CoordUtils as F, CommonUtils as Nt, RangeOrientation as Ht, Direction as g, AnchorLocation as Qe } from "@sheetxl/utils";
6
6
  import { createPortal as xo } from "react-dom";
7
7
  /**
8
- * @license @sheetxl/grid-react - Grid React - Advanced grid component for React - v0.7.18
8
+ * @license @sheetxl/grid-react - Grid React - Advanced grid component for React - v0.7.20
9
9
  *
10
10
  * (C) 2025-present SheetXL Inc. & Michael T. Ford
11
11
  * License: The license can be found at https://www.sheetxl.com/license.
@@ -44,10 +44,10 @@ const dn = ({ itemType: t, index: n, itemSize: o, instanceProps: r, scale: c = 1
44
44
  for (; c < o && dn({ itemType: t, itemSize: n, index: c, instanceProps: r, scale: i }).offset < d; ) c += l, l *= 2;
45
45
  return po({ itemType: t, itemSize: n, instanceProps: r, high: Math.min(c, o - 1), low: Math.floor(c / 2), offset: d, scale: i });
46
46
  }, Bo = (t) => {
47
- const { rowCount: n, columnCount: o, defaultRowHeight: r, getRowHeight: c, defaultColumnWidth: d, getColumnWidth: i } = t || {}, l = se({ columnMetadataMap: {}, rowMetadataMap: {}, lastMeasuredColumnIndex: -1, lastMeasuredRowIndex: -1, recalcColumnIndices: [], recalcRowIndices: [] }), w = P((T) => Qn({ itemType: "row", itemCount: n, itemSize: c ?? (() => r ?? 20), instanceProps: l.current, offset: T }), [n, c, r]), L = P((T) => T === -1 ? 0 : dn({ itemType: "row", index: T, itemSize: c ?? (() => r ?? 20), instanceProps: l.current }).offset, [c, r]), O = P((T) => dn({ itemType: "row", index: T, itemSize: c ?? (() => r ?? 20), instanceProps: l.current }).size, [c, r]), R = P((T) => Qn({ itemType: "column", itemCount: o, itemSize: i ?? (() => d ?? 75), instanceProps: l.current, offset: T }), [o, i, d]), M = P((T) => T === -1 ? 0 : dn({ itemType: "column", index: T, itemSize: i ?? (() => d ?? 75), instanceProps: l.current }).offset, [i, d]), A = P((T) => dn({ itemType: "column", index: T, itemSize: i ?? (() => d ?? 75), instanceProps: l.current }).size, [i, d]), [le, J] = Zn((T) => T + 1, 0), te = () => ({ getRowOffset: L, getColOffset: M, getRowIndex: w, getColIndex: R }), [ze, Q] = gt(() => t ? te() : null);
47
+ const { rowCount: n, columnCount: o, defaultRowHeight: r, getRowHeight: c, defaultColumnWidth: d, getColumnWidth: i } = t || {}, l = se({ columnMetadataMap: {}, rowMetadataMap: {}, lastMeasuredColumnIndex: -1, lastMeasuredRowIndex: -1, recalcColumnIndices: [], recalcRowIndices: [] }), w = k((P) => Qn({ itemType: "row", itemCount: n, itemSize: c ?? (() => r ?? 20), instanceProps: l.current, offset: P }), [n, c, r]), L = k((P) => P === -1 ? 0 : dn({ itemType: "row", index: P, itemSize: c ?? (() => r ?? 20), instanceProps: l.current }).offset, [c, r]), O = k((P) => dn({ itemType: "row", index: P, itemSize: c ?? (() => r ?? 20), instanceProps: l.current }).size, [c, r]), R = k((P) => Qn({ itemType: "column", itemCount: o, itemSize: i ?? (() => d ?? 75), instanceProps: l.current, offset: P }), [o, i, d]), T = k((P) => P === -1 ? 0 : dn({ itemType: "column", index: P, itemSize: i ?? (() => d ?? 75), instanceProps: l.current }).offset, [i, d]), A = k((P) => dn({ itemType: "column", index: P, itemSize: i ?? (() => d ?? 75), instanceProps: l.current }).size, [i, d]), [ne, Q] = Zn((P) => P + 1, 0), _ = () => ({ getRowOffset: L, getColOffset: T, getRowIndex: w, getColIndex: R }), [ze, ee] = gt(() => t ? _() : null);
48
48
  return It(() => {
49
- Q(t ? te() : null);
50
- }, [le, n, o, d, r, O, A]), ze;
49
+ ee(t ? _() : null);
50
+ }, [ne, n, o, d, r, O, A]), ze;
51
51
  }, mo = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ~`!@#$%^&*()-_=+[{]};:'\",<.>/?|\\", eo = (t) => {
52
52
  if (!t) return null;
53
53
  if (t.eventType === "start") return { type: t.eventType };
@@ -61,83 +61,83 @@ const dn = ({ itemType: t, index: n, itemSize: o, instanceProps: r, scale: c = 1
61
61
  }
62
62
  return { type: t.eventType ?? "unknown" };
63
63
  }, Ao = (t) => !0, Fo = (t) => !!t && !(t.ctrlKey || t.metaKey || t.altKey || t.isComposing) && (!(t.shiftKey || t.key !== "F2" && t.key !== " " && t.key !== "Backspace") || (!t.shiftKey || t.key !== " ") && mo.indexOf(t.key) !== -1), Vo = (t) => !!t && t.type === "dblclick" && { editMode: !0 }, Wo = (t) => {
64
- const { session: n, refLatestCoords: o, handleSubmitEdit: r, handleCancelEdit: c, cellBounds: d, isInBounds: i, getCellEditor: l, propsEditor: w, borderStrokeFill: L = "rgb(33, 115, 70)", borderStrokeWidth: O = 2, alignment: R = mn.Left, style: M, ...A } = t, le = se(null), J = se(null), [te, ze] = gt(!1), Q = n.coords, T = V(async (ue) => {
65
- if (le.current?.getBoundingClientRect()) {
64
+ const { session: n, refLatestCoords: o, handleSubmitEdit: r, handleCancelEdit: c, cellBounds: d, isInBounds: i, getCellEditor: l, propsEditor: w, borderStrokeFill: L = "rgb(33, 115, 70)", borderStrokeWidth: O = 2, alignment: R = mn.Left, style: T, ...A } = t, ne = se(null), Q = se(null), [_, ze] = gt(!1), ee = n.coords, P = V(async (ue) => {
65
+ if (ne.current?.getBoundingClientRect()) {
66
66
  if (ue.eventType === "keyboard") {
67
67
  const $ = ue.event, p = new KeyboardEvent($.type, { bubbles: !0, cancelable: !0, view: window, key: $.key, code: $.code, location: $.location, repeat: $.repeat, isComposing: $.isComposing, charCode: $.charCode, keyCode: $.keyCode, which: $.which, ctrlKey: $.ctrlKey, shiftKey: $.shiftKey, altKey: $.altKey, metaKey: $.metaKey });
68
- p.isSynthetic = !0, p.key, J.current?.dispatchEvent(p);
68
+ p.isSynthetic = !0, p.key, Q.current?.dispatchEvent(p);
69
69
  } else ue.eventType === "pointer" || console.warn("unsupported event type", ue);
70
70
  await new Promise(($) => requestAnimationFrame($));
71
71
  }
72
72
  }, []);
73
73
  It(() => {
74
- const ue = J.current;
75
- return ze(!0), J.current.startEdit?.(n.startEvent), (async () => {
76
- n.editorRefs.push(ue), n.editorRefsDispatchEditorEvent.push(T);
74
+ const ue = Q.current;
75
+ return ze(!0), Q.current.startEdit?.(n.startEvent), (async () => {
76
+ n.editorRefs.push(ue), n.editorRefsDispatchEditorEvent.push(P);
77
77
  const ye = [...n.events];
78
- for (let $ = 0; $ < ye.length; $++) await T(ye[$]);
78
+ for (let $ = 0; $ < ye.length; $++) await P(ye[$]);
79
79
  n.onMount(ue);
80
80
  })(), () => {
81
81
  const ye = n.editorRefs.indexOf(ue);
82
82
  ye !== -1 && n.editorRefs.splice(ye, 1), n.onUnmount(ue);
83
83
  };
84
84
  }, []);
85
- const _ = V(() => r(n), []), ve = V(() => {
85
+ const Z = V(() => r(n), []), ve = V(() => {
86
86
  c(n);
87
- }, []), W = o.current && F.isEqualCells(o.current, Q), me = i && W && te, Ve = l({ autoFocus: !!n.startEvent?.autoFocus, ...w, onSubmitEdit: _, onCancelEdit: ve, ref: J }, Q), ke = d.x + X.boundPixel(-O / 2), We = X.boundPixel(d.width + O / 2, !0);
88
- return Ce("div", { tabIndex: 0, ref: le, style: { background: void 0, ...M, opacity: me ? M?.opacity ?? 1 : 0, pointerEvents: "auto", position: "absolute", boxSizing: "border-box", top: `${d.y + X.boundPixel(-O / 2)}px`, height: X.boundPixel(d.height + O / 2, !0), left: `${ke}px`, width: We }, ...A, children: Ce("div", { className: "editor-container", style: { position: "absolute", boxSizing: "border-box", left: `${X.boundPixel(1)}px`, top: `${X.boundPixel(1)}px`, width: X.boundPixel(d.width - 2, !0), height: X.boundPixel(d.height - 2, !0), outline: `${O}px ${L} solid`, boxShadow: "rgba(60,64,67,.35) 2px 2px 6px 3px", maxHeight: "100%", overflow: "hidden", display: "flex" }, children: Ve }) });
87
+ }, []), W = o.current && F.isEqualCells(o.current, ee), me = i && W && _, Ve = l({ autoFocus: !!n.startEvent?.autoFocus, ...w, onSubmitEdit: Z, onCancelEdit: ve, ref: Q }, ee), ke = d.x + X.boundPixel(-O / 2), We = X.boundPixel(d.width + O / 2, !0);
88
+ return Ce("div", { tabIndex: 0, ref: ne, style: { background: void 0, ...T, opacity: me ? T?.opacity ?? 1 : 0, pointerEvents: "auto", position: "absolute", boxSizing: "border-box", top: `${d.y + X.boundPixel(-O / 2)}px`, height: X.boundPixel(d.height + O / 2, !0), left: `${ke}px`, width: We }, ...A, children: Ce("div", { className: "editor-container", style: { position: "absolute", boxSizing: "border-box", left: `${X.boundPixel(1)}px`, top: `${X.boundPixel(1)}px`, width: X.boundPixel(d.width - 2, !0), height: X.boundPixel(d.height - 2, !0), outline: `${O}px ${L} solid`, boxShadow: "rgba(60,64,67,.35) 2px 2px 6px 3px", maxHeight: "100%", overflow: "hidden", display: "flex" }, children: Ve }) });
89
89
  }, xr = (t) => {
90
- const { view: n, canEdit: o = Ao, getCellEditor: r, onBeforeStartEdit: c, onStartEdit: d, onSubmitEdit: i, onCancelEdit: l, onDoneEdit: w, isEditorStartKeyEvent: L = Fo, isEditorStartPointerEvent: O = Vo, containerProps: R, borderStrokeFill: M, borderStrokeWidth: A = 2, getRangeCoords: le = null, activeCoords: J, alignment: te = mn.Left } = t, [ze, Q] = gt(!1), [T, _] = gt(void 0), ve = P((k, b, Re, ne, we, Ue) => {
90
+ const { view: n, canEdit: o = Ao, getCellEditor: r, onBeforeStartEdit: c, onStartEdit: d, onSubmitEdit: i, onCancelEdit: l, onDoneEdit: w, isEditorStartKeyEvent: L = Fo, isEditorStartPointerEvent: O = Vo, containerProps: R, borderStrokeFill: T, borderStrokeWidth: A = 2, getRangeCoords: ne = null, activeCoords: Q, alignment: _ = mn.Left } = t, [ze, ee] = gt(!1), [P, Z] = gt(void 0), ve = k((M, b, Re, oe, we, Ue) => {
91
91
  if (!b) return null;
92
- const lt = we?.(b, k), Mt = k.getRangeCoordsBounds(lt), it = k.toClipBounds(Mt), qt = Mt, xt = k.getZoom();
92
+ const lt = we?.(b, M), Mt = M.getRangeCoordsBounds(lt), it = M.toClipBounds(Mt), qt = Mt, xt = M.getZoom();
93
93
  if (!it) return null;
94
- Re && (Re *= xt), ne && (ne *= xt);
95
- let v = qt, oe = !1;
94
+ Re && (Re *= xt), oe && (oe *= xt);
95
+ let v = qt, re = !1;
96
96
  if (Re !== void 0) {
97
97
  let Je = { ...lt }, ln = 0;
98
- for (; !oe && v.width <= Re && ln < 20; ) {
98
+ for (; !re && v.width <= Re && ln < 20; ) {
99
99
  ln++, ln > 19 && console.warn("max width reached");
100
- const _t = k.getTotalRangeCoords(), Tt = k.getLayout();
101
- Ue === mn.Left ? Je.colEnd + 1 < _t.colEnd ? Je.colEnd = Tt.getColIndex(v.x + Re) : oe = !0 : Ue === mn.Right ? Je.colStart - 1 >= 0 ? Je.colStart = Tt.getColIndex(v.x - (Re - v.width)) : oe = !0 : Ue === mn.Center && Je.colEnd + 1 < _t.colEnd && Je.colStart - 1 >= 0 ? (Je.colStart = Tt.getColIndex(v.x - (Re - v.width) / 2), Je.colEnd = Tt.getColIndex(v.x + v.width + (Re - v.width) / 2)) : oe = !0, oe || (v = k.getRangeCoordsBounds(Je));
100
+ const _t = M.getTotalRangeCoords(), Tt = M.getLayout();
101
+ Ue === mn.Left ? Je.colEnd + 1 < _t.colEnd ? Je.colEnd = Tt.getColIndex(v.x + Re) : re = !0 : Ue === mn.Right ? Je.colStart - 1 >= 0 ? Je.colStart = Tt.getColIndex(v.x - (Re - v.width)) : re = !0 : Ue === mn.Center && Je.colEnd + 1 < _t.colEnd && Je.colStart - 1 >= 0 ? (Je.colStart = Tt.getColIndex(v.x - (Re - v.width) / 2), Je.colEnd = Tt.getColIndex(v.x + v.width + (Re - v.width) / 2)) : re = !0, re || (v = M.getRangeCoordsBounds(Je));
102
102
  }
103
103
  }
104
- v.height = qt.height, ne !== void 0 && (v.height = Math.max(ne + 1, qt.height));
105
- const { width: He, height: ht } = k.getViewportSize();
104
+ v.height = qt.height, oe !== void 0 && (v.height = Math.max(oe + 1, qt.height));
105
+ const { width: He, height: ht } = M.getViewportSize();
106
106
  return { x: v.x ?? 0, y: v.y ?? 0, height: Math.min(ht - v.y, v.height) + 1, width: Math.min(He - v.x, v.width) + 1 };
107
- }, [te]), W = P(o, [o]), me = V(() => {
107
+ }, [_]), W = k(o, [o]), me = V(() => {
108
108
  n?.getStage()?.focus();
109
- }, [n]), Ve = se(null), ke = P((k) => {
110
- c?.(k), D(), Q(!0), Ve.current = null;
111
- }, [c]), We = P((k) => {
112
- d?.(k.coords);
113
- }, [d]), ue = P((k) => {
114
- k.isSubmitted || k.isCancelled || (p.current.isEditorClosed = !0, me(), k.isCancelled = !0, l?.(k.coords), D());
115
- }, [l]), ye = P((k) => {
116
- if (k.isSubmitted || k.isCancelled) return !1;
109
+ }, [n]), Ve = se(null), ke = k((M) => {
110
+ c?.(M), D(), ee(!0), Ve.current = null;
111
+ }, [c]), We = k((M) => {
112
+ d?.(M.coords);
113
+ }, [d]), ue = k((M) => {
114
+ M.isSubmitted || M.isCancelled || (p.current.isEditorClosed = !0, me(), M.isCancelled = !0, l?.(M.coords), D());
115
+ }, [l]), ye = k((M) => {
116
+ if (M.isSubmitted || M.isCancelled) return !1;
117
117
  try {
118
- return Ve.current = k.coords, k.isEditorClosing = !0, k.isSubmitted = !0, k.isEditorSubmitted || (k.isEditorSubmitted = !0, k.editorRefs[0]?.submitEdit?.()), k.coords, i?.(k.coords), k.isEditorClosed = !0, me(), D(), !0;
118
+ return Ve.current = M.coords, M.isEditorClosing = !0, M.isSubmitted = !0, M.isEditorSubmitted || (M.isEditorSubmitted = !0, M.editorRefs[0]?.submitEdit?.()), M.coords, i?.(M.coords), M.isEditorClosed = !0, me(), D(), !0;
119
119
  } catch (b) {
120
- throw k.isEditorClosing = !1, k.isSubmitted = !1, b;
120
+ throw M.isEditorClosing = !1, M.isSubmitted = !1, b;
121
121
  }
122
- }, [i]), $ = P((k) => {
123
- Q(!1), w?.(k.coords), D();
124
- }, [w]), p = se(null), Ne = se(null), Xe = se(null), Z = se([]), [be, Y] = Zn((k) => k + 1, 0), D = V((k) => {
125
- k && Z.current.push(k), Y();
126
- }, []), q = P((k) => {
127
- if (k.defaultPrevented || k.isSynthetic || !n) return;
128
- const b = n?.getCellCoordsFromClient(k.clientX, k.clientY);
129
- b && D({ eventType: "pointer", event: k, coords: b });
130
- }, [n]), Pt = P((k) => {
131
- const b = k.nativeEvent;
122
+ }, [i]), $ = k((M) => {
123
+ ee(!1), w?.(M.coords), D();
124
+ }, [w]), p = se(null), Ne = se(null), Xe = se(null), J = se([]), [be, Y] = Zn((M) => M + 1, 0), D = V((M) => {
125
+ M && J.current.push(M), Y();
126
+ }, []), q = k((M) => {
127
+ if (M.defaultPrevented || M.isSynthetic || !n) return;
128
+ const b = n?.getCellCoordsFromClient(M.clientX, M.clientY);
129
+ b && D({ eventType: "pointer", event: M, coords: b });
130
+ }, [n]), Pt = k((M) => {
131
+ const b = M.nativeEvent;
132
132
  q(b);
133
- }, [n]), Et = P((k) => {
134
- if (k.defaultPrevented || k.isSynthetic || !n?.getStage()) return;
133
+ }, [n]), Et = k((M) => {
134
+ if (M.defaultPrevented || M.isSynthetic || !n?.getStage()) return;
135
135
  const b = Ne.current;
136
- L(k, b) && (k.stopPropagation(), k.preventDefault()), k.key, D({ eventType: "keyboard", event: k, coords: b });
136
+ L(M, b) && (M.stopPropagation(), M.preventDefault()), M.key, D({ eventType: "keyboard", event: M, coords: b });
137
137
  }, [n]);
138
138
  en(() => {
139
- const k = (ne, we) => {
140
- const Ue = we?.cell ?? ne;
139
+ const M = (oe, we) => {
140
+ const Ue = we?.cell ?? oe;
141
141
  if (!Ue) return null;
142
142
  const lt = Ue;
143
143
  if (!W(Ue)) return null;
@@ -153,8 +153,8 @@ const dn = ({ itemType: t, index: n, itemSize: o, instanceProps: r, scale: c = 1
153
153
  };
154
154
  if (document.activeElement !== document.body) xt();
155
155
  else {
156
- const v = (oe) => {
157
- oe.defaultPrevented || oe.target !== document.body || Et(oe);
156
+ const v = (re) => {
157
+ re.defaultPrevented || re.target !== document.body || Et(re);
158
158
  };
159
159
  window.addEventListener("keydown", v, !0), n.getStage()?.addEventListener("focusin", () => {
160
160
  window.removeEventListener("keydown", v), xt();
@@ -164,15 +164,15 @@ const dn = ({ itemType: t, index: n, itemSize: o, instanceProps: r, scale: c = 1
164
164
  } };
165
165
  return it;
166
166
  };
167
- if (Z.current.length <= 0 && !p.current) return;
168
- const b = Z.current[0];
169
- eo(b), ((ne) => {
170
- const we = [], Ue = ne?.length ?? 0;
167
+ if (J.current.length <= 0 && !p.current) return;
168
+ const b = J.current[0];
169
+ eo(b), ((oe) => {
170
+ const we = [], Ue = oe?.length ?? 0;
171
171
  for (let lt = 0; lt < Ue; lt++) {
172
- const Mt = ne[lt];
172
+ const Mt = oe[lt];
173
173
  we.push(eo(Mt));
174
174
  }
175
- })(Z.current), p.current, p.current;
175
+ })(J.current), p.current, p.current;
176
176
  let Re = p.current;
177
177
  if (p.current) {
178
178
  if (p.current.isDone) p.current = null;
@@ -183,13 +183,13 @@ const dn = ({ itemType: t, index: n, itemSize: o, instanceProps: r, scale: c = 1
183
183
  }
184
184
  if (b) {
185
185
  if (b.eventType === "start") {
186
- const ne = b, we = ne.startEvent?.cell ?? Ne.current;
187
- p.current && F.isEqualCells(p.current.coords, we) || (p.current = k(we, ne.startEvent));
186
+ const oe = b, we = oe.startEvent?.cell ?? Ne.current;
187
+ p.current && F.isEqualCells(p.current.coords, we) || (p.current = M(we, oe.startEvent));
188
188
  } else if (b.eventType === "keyboard") {
189
- const ne = b.event;
189
+ const oe = b.event;
190
190
  if (p.current) {
191
191
  let we = !1;
192
- switch (ne.which) {
192
+ switch (oe.which) {
193
193
  case Ot.Left:
194
194
  case Ot.Right:
195
195
  case Ot.Up:
@@ -202,22 +202,22 @@ const dn = ({ itemType: t, index: n, itemSize: o, instanceProps: r, scale: c = 1
202
202
  p.current.events.push(b);
203
203
  for (let Ue = 0; Ue < p.current.editorRefsDispatchEditorEvent.length; Ue++) p.current.editorRefsDispatchEditorEvent[Ue](b);
204
204
  }
205
- } else if (L(ne, b.coords)) {
205
+ } else if (L(oe, b.coords)) {
206
206
  let we;
207
- const Ue = k(we?.cell ?? Ne.current, we);
207
+ const Ue = M(we?.cell ?? Ne.current, we);
208
208
  Ue && Ue.events.push(b), p.current = Ue;
209
209
  }
210
210
  } else if (b.eventType === "pointer") {
211
- const ne = b.event;
211
+ const oe = b.event;
212
212
  if (p.current) {
213
213
  p.current.events.push(b);
214
214
  for (let we = 0; we < p.current.editorRefsDispatchEditorEvent.length; we++) p.current.editorRefsDispatchEditorEvent[we](b);
215
215
  } else {
216
- const we = b?.coords ?? Ne.current, Ue = O(ne, we);
216
+ const we = b?.coords ?? Ne.current, Ue = O(oe, we);
217
217
  if (Ue) {
218
218
  let lt;
219
219
  typeof lt != "boolean" && (lt = Ue);
220
- const Mt = k(we, lt);
220
+ const Mt = M(we, lt);
221
221
  Mt && Mt.events.push(b), p.current = Mt;
222
222
  }
223
223
  }
@@ -232,8 +232,8 @@ const dn = ({ itemType: t, index: n, itemSize: o, instanceProps: r, scale: c = 1
232
232
  ue(p.current);
233
233
  }
234
234
  } else if (b.eventType === "coordsChange") {
235
- const ne = b;
236
- if (Ne.current = ne.activeCoords, p.current, p.current && !p.current.isSubmitted && !p.current.isCancelled) {
235
+ const oe = b;
236
+ if (Ne.current = oe.activeCoords, p.current, p.current && !p.current.isSubmitted && !p.current.isCancelled) {
237
237
  if (!p.current.isMounted) return;
238
238
  try {
239
239
  ye(p.current);
@@ -242,34 +242,34 @@ const dn = ({ itemType: t, index: n, itemSize: o, instanceProps: r, scale: c = 1
242
242
  }
243
243
  }
244
244
  }
245
- Z.current.length > 0 && (Z.current.shift(), D()), Z.current.length === 0 && (!p.current || p.current.isEditorClosing || p.current.isEditorClosed ? !p.current && Re && me() : p.current.isMounted && !p.current.isStarted && (p.current.isStarted = !0, p.current.startEvent.autoFocus && (typeof p.current.startEvent.autoFocus == "string" ? p.current.editorRefs[0]?.autoFocus(p.current.startEvent.autoFocus) : p.current.editorRefs[0]?.autoFocus()), We?.(p.current), requestAnimationFrame(() => {
245
+ J.current.length > 0 && (J.current.shift(), D()), J.current.length === 0 && (!p.current || p.current.isEditorClosing || p.current.isEditorClosed ? !p.current && Re && me() : p.current.isMounted && !p.current.isStarted && (p.current.isStarted = !0, p.current.startEvent.autoFocus && (typeof p.current.startEvent.autoFocus == "string" ? p.current.editorRefs[0]?.autoFocus(p.current.startEvent.autoFocus) : p.current.editorRefs[0]?.autoFocus()), We?.(p.current), requestAnimationFrame(() => {
246
246
  n && p.current?.coords && n.scrollCellCoordsIntoView(p.current.coords);
247
247
  })));
248
248
  }, [be]), It(() => {
249
- Xe.current = J;
250
- const k = p.current?.coords;
251
- F.isEqualCells(k, J) || (p.current && (p.current.isEditorClosing = !0), D({ eventType: "coordsChange", activeCoords: J }));
252
- }, [J]);
253
- const wt = V((k) => {
254
- Et(k.nativeEvent);
255
- }, []), { width: ut = 0, height: he = 0 } = T ?? { width: 0, height: 0 }, Wt = P(r, [r]);
256
- return { overlay: P((k) => {
249
+ Xe.current = Q;
250
+ const M = p.current?.coords;
251
+ F.isEqualCells(M, Q) || (p.current && (p.current.isEditorClosing = !0), D({ eventType: "coordsChange", activeCoords: Q }));
252
+ }, [Q]);
253
+ const wt = V((M) => {
254
+ Et(M.nativeEvent);
255
+ }, []), { width: ut = 0, height: he = 0 } = P ?? { width: 0, height: 0 }, Wt = k(r, [r]);
256
+ return { overlay: k((M) => {
257
257
  if (!p.current || p.current.isEditorClosed) return p.current, null;
258
258
  p.current.coords;
259
- let b = ve(k, p.current.coords, ut, he, le, te), Re = !0;
259
+ let b = ve(M, p.current.coords, ut, he, ne, _), Re = !0;
260
260
  b && b.width !== 0 && b.height !== 0 || (b = { x: 0, y: 0, width: ut, height: ut }, Re = !1);
261
- const ne = k.getZoom(), we = { containerBounds: { x: 0, y: 0, width: b.width / ne, height: b.height / ne }, setNaturalSize: _, zoom: ne };
262
- return Ce(Wo, { session: p.current, refLatestCoords: Xe, handleSubmitEdit: ye, handleCancelEdit: ue, cellBounds: b, borderStrokeWidth: A, borderStrokeFill: M, isInBounds: Re, getCellEditor: Wt, propsEditor: we, alignment: te, ...R }, "editor:" + p.current.uuid);
263
- }, [r, le, be, ut, he, te, A, M]), startEdit: V((k) => {
264
- D({ eventType: "start", startEvent: k });
261
+ const oe = M.getZoom(), we = { containerBounds: { x: 0, y: 0, width: b.width / oe, height: b.height / oe }, setNaturalSize: Z, zoom: oe };
262
+ return Ce(Wo, { session: p.current, refLatestCoords: Xe, handleSubmitEdit: ye, handleCancelEdit: ue, cellBounds: b, borderStrokeWidth: A, borderStrokeFill: T, isInBounds: Re, getCellEditor: Wt, propsEditor: we, alignment: _, ...R }, "editor:" + p.current.uuid);
263
+ }, [r, ne, be, ut, he, _, A, T]), startEdit: V((M) => {
264
+ D({ eventType: "start", startEvent: M });
265
265
  }, []), submitEdit: V(() => {
266
266
  D({ eventType: "submit" });
267
267
  }, []), cancelEdit: V(() => {
268
268
  D({ eventType: "cancel" });
269
269
  }, []), onKeyboardEvent: wt, onPointerEvent: Pt, onKeyboardEventNative: Et, onPointerEventNative: q, isEditing: ze };
270
- }, Uo = Object.freeze({ once: !0 }), pr = ({ gridRef: t, gridMainRef: n, orientation: o = Ht.Row, headerCount: r, selectionPolicy: c = "multiple", newSelectionMode: d = "clear", alwaysScrollToActiveCoords: i = !0, onDragStart: l, onDragEnd: w, pointerDownInterceptor: L, pointerMoveInterceptor: O, onPointerUp: R, newSelection: M, modifySelection: A, appendSelection: le, clearSelections: J }) => {
271
- const te = r ?? ((o === Ht.Row ? t.current?.rowCount : t.current?.columnCount) || 0), ze = se(null), Q = se(null), T = se(!1), _ = se(null), ve = V(($) => o === Ht.Column ? { rowIndex: 0, colIndex: $.colIndex } : { rowIndex: $.rowIndex, colIndex: 0 }, [o]), W = V(($) => o === Ht.Column ? { rowIndex: n.current ? n.current.rowCount - 1 : 0, colIndex: $.colIndex } : { rowIndex: $.rowIndex, colIndex: n.current ? n.current.columnCount - 1 : 0 }, [o]), me = ($) => {
272
- Q.current = W($), A(Q.current, ze.current);
270
+ }, Uo = Object.freeze({ once: !0 }), pr = ({ gridRef: t, gridMainRef: n, orientation: o = Ht.Row, headerCount: r, selectionPolicy: c = "multiple", newSelectionMode: d = "clear", alwaysScrollToActiveCoords: i = !0, onDragStart: l, onDragEnd: w, pointerDownInterceptor: L, pointerMoveInterceptor: O, onPointerUp: R, newSelection: T, modifySelection: A, appendSelection: ne, clearSelections: Q }) => {
271
+ const _ = r ?? ((o === Ht.Row ? t.current?.rowCount : t.current?.columnCount) || 0), ze = se(null), ee = se(null), P = se(!1), Z = se(null), ve = V(($) => o === Ht.Column ? { rowIndex: 0, colIndex: $.colIndex } : { rowIndex: $.rowIndex, colIndex: 0 }, [o]), W = V(($) => o === Ht.Column ? { rowIndex: n.current ? n.current.rowCount - 1 : 0, colIndex: $.colIndex } : { rowIndex: $.rowIndex, colIndex: n.current ? n.current.columnCount - 1 : 0 }, [o]), me = ($) => {
272
+ ee.current = W($), A(ee.current, ze.current);
273
273
  }, Ve = V(($, p) => {
274
274
  if (!t.current) return;
275
275
  const Ne = t.current.getViewFromClient($, p)?.getCellCoordsFromClient($, p);
@@ -277,35 +277,35 @@ const dn = ({ itemType: t, index: n, itemSize: o, instanceProps: r, scale: c = 1
277
277
  }, []), ke = V(($, p = !1) => {
278
278
  let Ne = $;
279
279
  return p || (Ne = { ...$ }, o === Ht.Row ? delete Ne.colIndex : delete Ne.rowIndex), n.current?.scrollCellCoordsIntoView(Ne);
280
- }, [o]), We = P(w, [w]), ue = P(l, [l]), ye = Ae(() => ({ onPointerDown: ($) => {
280
+ }, [o]), We = k(w, [w]), ue = k(l, [l]), ye = Ae(() => ({ onPointerDown: ($) => {
281
281
  if (!t || !t.current || $.nativeEvent.defaultPrevented) return;
282
282
  const p = Ve($.nativeEvent.clientX, $.nativeEvent.clientY);
283
283
  if (!p) return;
284
284
  $.nativeEvent.which, jn.Right;
285
285
  const Ne = $.nativeEvent.shiftKey, Xe = $.nativeEvent.ctrlKey || $.nativeEvent.metaKey;
286
286
  if (L?.($, p) === !1) return;
287
- ue?.(), T.current = !0;
288
- const Z = n.current?.getViewFromClient($.nativeEvent.clientX, $.nativeEvent.clientY), be = ((Y, D) => o === Ht.Column ? { ...Y, rowIndex: D.rowStart } : { ...Y, colIndex: D.colStart })(p, Z.getVisibleRangeCoords());
287
+ ue?.(), P.current = !0;
288
+ const J = n.current?.getViewFromClient($.nativeEvent.clientX, $.nativeEvent.clientY), be = ((Y, D) => o === Ht.Column ? { ...Y, rowIndex: D.rowStart } : { ...Y, colIndex: D.colStart })(p, J.getVisibleRangeCoords());
289
289
  if (Ne) me(p);
290
290
  else {
291
291
  if (Xe) return ((Y, D = Y, q) => {
292
- ze.current = ve(Y), Q.current = W(D), le(ze.current, Q.current, q);
292
+ ze.current = ve(Y), ee.current = W(D), ne(ze.current, ee.current, q);
293
293
  })(p, p, be), void (i && ke(be, !0));
294
294
  ((Y, D = Y, q) => {
295
- ze.current = ve(Y), Q.current = W(D), M(ze.current, Q.current, q);
295
+ ze.current = ve(Y), ee.current = W(D), T(ze.current, ee.current, q);
296
296
  })(p, p, be), me(p), i && ke(be, !0);
297
297
  }
298
298
  }, onPointerMoveOrWait: Nt.throttle(($) => {
299
- if (!T.current || !t?.current) return;
299
+ if (!P.current || !t?.current) return;
300
300
  const p = Ve($.clientX, $.clientY);
301
301
  if (p && O?.($, p) !== !1) {
302
- if (F.isEqualCells(_.current, p)) return J();
302
+ if (F.isEqualCells(Z.current, p)) return Q();
303
303
  me(p), ke(p);
304
304
  }
305
305
  }, 60), onPointerUp: ($) => {
306
- T.current = !1, We?.(), R?.($);
307
- }, processTouch: !0, consumeTouch: !0 }), [c, i, te, d, J, L, R]);
308
- return { onPointerDown: P(un(ye), []), getCellCoordsFromClient: Ve };
306
+ P.current = !1, We?.(), R?.($);
307
+ }, processTouch: !0, consumeTouch: !0 }), [c, i, _, d, Q, L, R]);
308
+ return { onPointerDown: k(un(ye), []), getCellCoordsFromClient: Ve };
309
309
  }, Fe = (t, n, o) => {
310
310
  if (!t) return n;
311
311
  let r = n;
@@ -389,8 +389,8 @@ const dn = ({ itemType: t, index: n, itemSize: o, instanceProps: r, scale: c = 1
389
389
  let i, { rowIndex: l, colIndex: w } = t;
390
390
  r === g.Down ? i = { rowIndex: l + 1, colIndex: w } : r === g.Up ? i = { rowIndex: l - 1, colIndex: w } : r === g.Right ? i = { rowIndex: l, colIndex: w + 1 } : r === g.Left && (i = { rowIndex: l, colIndex: w - 1 });
391
391
  const L = n(t), O = n(i);
392
- var R, M;
393
- return (M = O, !(R = L) && !M || !R && M || R && !M ? Ho : No)(t, n, o, r, !1, d) ?? d;
392
+ var R, T;
393
+ return (T = O, !(R = L) && !T || !R && T || R && !T ? Ho : No)(t, n, o, r, !1, d) ?? d;
394
394
  }, to = (t, n) => `${t}:${n}`, no = (t, n, o, r, c, d) => {
395
395
  if (o - n >= c - r) return r;
396
396
  let i = r;
@@ -413,8 +413,8 @@ const dn = ({ itemType: t, index: n, itemSize: o, instanceProps: r, scale: c = 1
413
413
  case g.Up:
414
414
  l.rowIndex = Fe(r, l.rowIndex - 1, n);
415
415
  }
416
- const L = (M) => {
417
- if (M) {
416
+ const L = (T) => {
417
+ if (T) {
418
418
  w = t.rangeIndex >= t.ranges.length - 1 ? 0 : t.rangeIndex + 1;
419
419
  const A = t.ranges[w];
420
420
  l = { colIndex: A.colStart, rowIndex: A.rowStart };
@@ -429,26 +429,26 @@ const dn = ({ itemType: t, index: n, itemSize: o, instanceProps: r, scale: c = 1
429
429
  else if (n === g.Down && l.colIndex === i.colEnd && l.rowIndex > i.rowEnd) L(!0);
430
430
  else if (n === g.Up && l.colIndex === i.colStart && l.rowIndex < i.rowStart) L(!1);
431
431
  else {
432
- let M = l.rowIndex, A = l.colIndex;
432
+ let T = l.rowIndex, A = l.colIndex;
433
433
  switch (n) {
434
434
  case g.Right:
435
- A > i.colEnd && (M = Fe(r, M + 1, n), A = i.colStart, M > i.rowEnd && (M = i.rowStart));
435
+ A > i.colEnd && (T = Fe(r, T + 1, n), A = i.colStart, T > i.rowEnd && (T = i.rowStart));
436
436
  break;
437
437
  case g.Left:
438
- A < i.colStart && (M = Fe(r, M - 1, n), A = i.colEnd, M < i.rowStart && (M = i.rowEnd));
438
+ A < i.colStart && (T = Fe(r, T - 1, n), A = i.colEnd, T < i.rowStart && (T = i.rowEnd));
439
439
  break;
440
440
  case g.Down:
441
- M > i.rowEnd && (A = Fe(c, A + 1, n), M = i.rowStart, A > i.colEnd && (A = i.colStart));
441
+ T > i.rowEnd && (A = Fe(c, A + 1, n), T = i.rowStart, A > i.colEnd && (A = i.colStart));
442
442
  break;
443
443
  case g.Up:
444
- M < i.rowStart && (A = Fe(c, A - 1, n), M = i.rowEnd, A < i.colStart && (A = i.colEnd));
444
+ T < i.rowStart && (A = Fe(c, A - 1, n), T = i.rowEnd, A < i.colStart && (A = i.colEnd));
445
445
  }
446
- l = { rowIndex: M, colIndex: A };
446
+ l = { rowIndex: T, colIndex: A };
447
447
  }
448
448
  let O = o(l);
449
449
  if (!F.isRangeWithinRange(O, i)) {
450
- const M = F.intersectRanges(O, i);
451
- M && (O = M);
450
+ const T = F.intersectRanges(O, i);
451
+ T && (O = T);
452
452
  }
453
453
  let R = { rowStart: Fe(r, O.rowStart, g.Down), colStart: Fe(c, O.colStart, g.Right), rowEnd: Fe(r, O.rowEnd, g.Up), colEnd: Fe(c, O.colEnd, g.Left) };
454
454
  if (R.rowStart !== l.rowIndex || R.colStart !== l.colIndex) {
@@ -487,8 +487,8 @@ const dn = ({ itemType: t, index: n, itemSize: o, instanceProps: r, scale: c = 1
487
487
  for (let L = 0; L < w && o[L] <= c; L++) {
488
488
  const O = o[L];
489
489
  if (O < r) continue;
490
- const R = i === O ? l : n ? t.getColOffset(O) : t.getRowOffset(O), M = n ? t.getColOffset(O + 1) : t.getRowOffset(O + 1);
491
- i = O + 1, l = M, d[O] = Object.freeze({ offset: R, size: M - R, spanIndex: L });
490
+ const R = i === O ? l : n ? t.getColOffset(O) : t.getRowOffset(O), T = n ? t.getColOffset(O + 1) : t.getRowOffset(O + 1);
491
+ i = O + 1, l = T, d[O] = Object.freeze({ offset: R, size: T - R, spanIndex: L });
492
492
  }
493
493
  return Object.freeze(d);
494
494
  }, io = (t, n, o) => {
@@ -504,32 +504,32 @@ const dn = ({ itemType: t, index: n, itemSize: o, instanceProps: r, scale: c = 1
504
504
  const { linePoints: n, bounds: o, pathProps: r, style: c, ...d } = t;
505
505
  return Ce("svg", { width: `${X.boundPixel(o.width, !0)}`, height: `${X.boundPixel(o.height, !0)}`, viewBox: `0 0 ${X.boundPixel(o.width, !0)} ${X.boundPixel(o.height, !0)}`, style: { position: "absolute", left: `${X.boundPixel(o.x)}px`, top: `${X.boundPixel(o.y)}px`, width: `${X.boundPixel(o.width, !0)}px`, height: `${X.boundPixel(o.height, !0)}px`, pointerEvents: "none", transitionTimingFunction: "linear", transitionDelay: "0", transitionProperty: "left, top, width, height", willChange: "left, top, width, height, stroke-dashoffset", ...c }, ...d, children: Ce("path", { d: `M ${X.boundPixel(n[0])} ${X.boundPixel(n[1])} L ${X.boundPixel(n[2])} ${X.boundPixel(n[3])}`, fill: "none", vectorEffect: "non-scaling-stroke", stroke: "black", ...r }) });
506
506
  }, jo = (t) => {
507
- const { x: n = 0, y: o = 0, width: r = 0, height: c = 0, fill: d, stroke: i, strokeWidth: l = 0, strokeDasharray: w, strokeDashoffset: L, clipPath: O, pathBounds: R, pathProps: M, style: A, ...le } = t, J = o, te = n, ze = r, Q = c;
508
- let T = null;
507
+ const { x: n = 0, y: o = 0, width: r = 0, height: c = 0, fill: d, stroke: i, strokeWidth: l = 0, strokeDasharray: w, strokeDashoffset: L, clipPath: O, pathBounds: R, pathProps: T, style: A, ...ne } = t, Q = o, _ = n, ze = r, ee = c;
508
+ let P = null;
509
509
  if (d) {
510
- let _ = Nn({ top: 0, left: 0, bottom: Q, right: ze });
511
- R && (_ = _ + " " + Nn({ top: R.y - J, left: R.x - te, bottom: R.height + R.y - J, right: R.width + R.x - te })), T = [Ce("path", { d: _, fill: d, stroke: "none", fillRule: "evenodd" }, "fill")];
510
+ let Z = Nn({ top: 0, left: 0, bottom: ee, right: ze });
511
+ R && (Z = Z + " " + Nn({ top: R.y - Q, left: R.x - _, bottom: R.height + R.y - Q, right: R.width + R.x - _ })), P = [Ce("path", { d: Z, fill: d, stroke: "none", fillRule: "evenodd" }, "fill")];
512
512
  }
513
- return Qt("svg", { width: `${X.boundPixel(r, !0)}`, height: `${X.boundPixel(c, !0)}`, viewBox: `0 0 ${X.boundPixel(r, !0)} ${X.boundPixel(c, !0)}`, preserveAspectRatio: "none", style: { position: "absolute", left: `${X.boundPixel(n)}px`, top: `${X.boundPixel(o)}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", ...A }, ...le, children: [T, Ce("path", { d: Nn({ top: 0, left: 0, right: ze, bottom: Q }), fill: "none", strokeDasharray: w, strokeDashoffset: L, stroke: i, vectorEffect: "non-scaling-stroke", strokeWidth: l, ...M })] });
513
+ return Qt("svg", { width: `${X.boundPixel(r, !0)}`, height: `${X.boundPixel(c, !0)}`, viewBox: `0 0 ${X.boundPixel(r, !0)} ${X.boundPixel(c, !0)}`, preserveAspectRatio: "none", style: { position: "absolute", left: `${X.boundPixel(n)}px`, top: `${X.boundPixel(o)}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", ...A }, ...ne, children: [P, Ce("path", { d: Nn({ top: 0, left: 0, right: ze, bottom: ee }), fill: "none", strokeDasharray: w, strokeDashoffset: L, stroke: i, vectorEffect: "non-scaling-stroke", strokeWidth: l, ...T })] });
514
514
  }, Yo = (t) => {
515
515
  const { key: n, ...o } = t;
516
516
  return Ce(vo, { ...o }, n);
517
517
  }, vo = Kt((t) => {
518
- const { stroke: n, fill: o, x: r = 0, y: c = 0, width: d = 0, height: i = 0, style: l, isAnimatedStroke: w, animatedStrokeProps: L, range: O, cell: R, ...M } = t, A = w || !!L, le = { name: "walking-offset", dashGap: 2, speed: 50, dashLength: 8, ...L };
519
- let J = le.dashGap + le.dashLength;
520
- const te = le.speed * J, ze = To().replaceAll(":", ""), Q = `${le.name}-${ze}`;
521
- let T;
518
+ const { stroke: n, fill: o, x: r = 0, y: c = 0, width: d = 0, height: i = 0, style: l, isAnimatedStroke: w, animatedStrokeProps: L, range: O, cell: R, ...T } = t, A = w || !!L, ne = { name: "walking-offset", dashGap: 2, speed: 50, dashLength: 8, ...L };
519
+ let Q = ne.dashGap + ne.dashLength;
520
+ const _ = ne.speed * Q, ze = To().replaceAll(":", ""), ee = `${ne.name}-${ze}`;
521
+ let P;
522
522
  return It(() => {
523
523
  if (!A) return;
524
- const _ = `@keyframes ${Q} {
524
+ const Z = `@keyframes ${ee} {
525
525
  to {
526
526
  stroke-dashoffset: 0px;
527
527
  }
528
528
  }`, ve = document.createElement("style");
529
- return ve.appendChild(document.createTextNode(_)), document.head.appendChild(ve), ve.sheet.insertRule(_, 0), () => {
529
+ return ve.appendChild(document.createTextNode(Z)), document.head.appendChild(ve), ve.sheet.insertRule(Z, 0), () => {
530
530
  document.head.removeChild(ve);
531
531
  };
532
- }, [A]), A && (T = { strokeDasharray: `${le.dashLength}px ${le.dashGap}px`, strokeDashoffset: `${J}px`, animation: `${Q} ${te}ms linear infinite`, willChange: "stroke-dashoffset" }), Ce(jo, { x: r, y: c, width: d, height: i, stroke: n, fill: o, shapeRendering: "crispEdges", style: { ...T, ...l }, ...M });
532
+ }, [A]), A && (P = { strokeDasharray: `${ne.dashLength}px ${ne.dashGap}px`, strokeDashoffset: `${Q}px`, animation: `${ee} ${_}ms linear infinite`, willChange: "stroke-dashoffset" }), Ce(jo, { x: r, y: c, width: d, height: i, stroke: n, fill: o, shapeRendering: "crispEdges", style: { ...P, ...l }, ...T });
533
533
  });
534
534
  function So(t) {
535
535
  var n, o, r = "";
@@ -546,23 +546,23 @@ function rn() {
546
546
  }
547
547
  vo.displayName = "Selection";
548
548
  const yo = Kt(tn((t, n) => {
549
- const { x: o = 0, y: r = 0, borderWidth: c = 1, size: d = 6, borderStroke: i, corner: l, style: w, className: L, background: O, ...R } = t;
549
+ const { x: o = 0, y: r = 0, borderWidth: c = 1, size: d = 6, borderStroke: i, corner: l, style: w, className: L, background: O, ref: R, ...T } = t;
550
550
  if (o === 0 || r === 0) return null;
551
- let M = !0, A = !0, le = !0, J = !0;
551
+ let A = !0, ne = !0, Q = !0, _ = !0;
552
552
  switch (l) {
553
553
  case "tl":
554
- M = !1, A = !1;
554
+ A = !1, ne = !1;
555
555
  break;
556
556
  case "bl":
557
- M = !1, J = !1;
557
+ A = !1, _ = !1;
558
558
  break;
559
559
  case "br":
560
- le = !1, J = !1;
560
+ Q = !1, _ = !1;
561
561
  break;
562
562
  case "tr":
563
- A = !1, le = !1;
563
+ ne = !1, Q = !1;
564
564
  }
565
- return Ce("div", { className: rn("fill-handle", L), style: { position: "absolute", left: o - (d + (M ? c : 0)) / 2, top: r - (d + (A ? c : 0)) / 2, width: d, height: d, borderLeft: M ? `${c}px ${i}` : void 0, borderTop: A ? `${c}px ${i}` : void 0, borderRight: le ? `${c}px ${i}` : void 0, borderBottom: J ? `${c}px ${i}` : void 0, background: O, cursor: "crosshair", pointerEvents: "all", transitionDuration: "0ms", transitionTimingFunction: "linear", transitionDelay: "0", transitionProperty: "left, top", willChange: "left, top", ...w }, tabIndex: -1, ...R });
565
+ return Ce("div", { className: rn("fill-handle", L), style: { position: "absolute", left: o - (d + (A ? c : 0)) / 2, top: r - (d + (ne ? c : 0)) / 2, width: d, height: d, borderLeft: A ? `${c}px ${i}` : void 0, borderTop: ne ? `${c}px ${i}` : void 0, borderRight: Q ? `${c}px ${i}` : void 0, borderBottom: _ ? `${c}px ${i}` : void 0, background: O, cursor: "crosshair", pointerEvents: "all", transitionDuration: "0ms", transitionTimingFunction: "linear", transitionDelay: "0", transitionProperty: "left, top", willChange: "left, top", ...w }, tabIndex: -1, ...T });
566
566
  }));
567
567
  function Kn(t, n) {
568
568
  if (typeof t == "function") return t(n);
@@ -586,9 +586,9 @@ var Xo = parseInt(zo.split(".")[0], 10) >= 19 ? function(t) {
586
586
  };
587
587
  };
588
588
  const Go = X.detectIt().supportsTouchEvents, Xn = Kt(tn((t, n) => {
589
- const { range: o, view: r, anchor: c, borderStroke: d = "var(--sxl-app-color-primary, rgb(33, 115, 70))", background: i = "var(--sxl-app-color-background, white)", borderWidth: l = 3, size: w = 22, style: L, className: O, selectionTouchPointerHandler: R, onTouchSelectStart: M, onTouchSelectEnd: A, currentTouchAnchor: le, scrollableElement: J, scrollableRoot: te, ...ze } = t;
589
+ const { range: o, view: r, anchor: c, borderStroke: d = "var(--sxl-app-color-primary, rgb(33, 115, 70))", background: i = "var(--sxl-app-color-background, white)", borderWidth: l = 3, size: w = 22, style: L, className: O, selectionTouchPointerHandler: R, onTouchSelectStart: T, onTouchSelectEnd: A, currentTouchAnchor: ne, scrollableElement: Q, scrollableRoot: _, ...ze } = t;
590
590
  if (!Go) return null;
591
- const Q = P(M, [M]), T = P(A, [A]), { bounds: _, coordsPivot: ve, key: W } = Ae(() => {
591
+ const ee = k(T, [T]), P = k(A, [A]), { bounds: Z, coordsPivot: ve, key: W } = Ae(() => {
592
592
  if (!o || !r) return null;
593
593
  let be = null, Y = null;
594
594
  switch (c) {
@@ -634,19 +634,19 @@ const Go = X.detectIt().supportsTouchEvents, Xn = Kt(tn((t, n) => {
634
634
  const be = (Y) => c === "t" || c === "b" ? { ...Y, colIndex: void 0 } : c === "l" || c === "r" ? { ...Y, rowIndex: void 0 } : Y;
635
635
  return { processTouch: !0, consumeTouch: !0, onPointerDown: (Y, D) => {
636
636
  const q = be(r.getCellCoordsFromClient(Y.clientX, Y.clientY));
637
- return me.current = { coordsPivot: ve }, Q?.(c), R.onSelectionPointerDown(Y, D, r, q, ve, !1, !0);
637
+ return me.current = { coordsPivot: ve }, ee?.(c), R.onSelectionPointerDown(Y, D, r, q, ve, !1, !0);
638
638
  }, onPointerMoveOrWait: (Y, D, q) => {
639
639
  const Pt = be(r.getCellCoordsFromClient(Y.clientX, Y.clientY));
640
640
  return R.onSelectionPointerMoveOrWait(Y, D, q, r, Pt, me.current?.coordsPivot, !0, !0);
641
- }, onPointerUp: (Y, D, q) => (me.current = null, T?.(c), R.onPointerUp(Y, D, q)) };
642
- }, [R, o, r, c]), ke = un(Ve), [We, { y: ue, x: ye }] = Do(), $ = se(null), { getPortalContainer: p, isFullscreen: Ne } = fo(), [Xe, Z] = gt(null);
641
+ }, onPointerUp: (Y, D, q) => (me.current = null, P?.(c), R.onPointerUp(Y, D, q)) };
642
+ }, [R, o, r, c]), ke = un(Ve), [We, { y: ue, x: ye }] = Do(), $ = se(null), { getPortalContainer: p, isFullscreen: Ne } = fo(), [Xe, J] = gt(null);
643
643
  return It(() => {
644
644
  const be = $.current?.getBoundingClientRect();
645
- if (!be || !_) return void Z(null);
646
- let Y = 0, D = 0, q = J;
647
- for (; q; ) Y += q.scrollLeft, D += q.scrollTop, q = te && q === te.parentElement ? null : q.parentElement;
648
- Z(xo(Ce("div", { className: rn("touch-select-handle", O), ref: n, style: { position: "absolute", left: Y + (be?.x ?? 0) - (w + l) / 2, top: D + (be?.y ?? 0) - (w + l) / 2, width: w, height: w, borderWidth: `${l}px`, border: d, borderRadius: "50%", background: i, boxShadow: `0 0 0 1.5px ${i}`, cursor: "grab", pointerEvents: "all", opacity: le ? 0 : 1, transitionDuration: "160ms", transitionProperty: "opacity", ...L }, tabIndex: -1, onPointerDown: ke, ...ze }), te ?? p(), W));
649
- }, [ue, ye, _?.x, _?.y, _?.width, _?.height, O, le, i, w, l, d, J, Ne]), _ ? Qt(_n, { children: [Ce("div", { ref: Xo([We, $]), style: { position: "absolute", left: _.x, top: _.y, opacity: 0 } }), Xe] }) : null;
645
+ if (!be || !Z) return void J(null);
646
+ let Y = 0, D = 0, q = Q;
647
+ for (; q; ) Y += q.scrollLeft, D += q.scrollTop, q = _ && q === _.parentElement ? null : q.parentElement;
648
+ J(xo(Ce("div", { className: rn("touch-select-handle", O), ref: n, style: { position: "absolute", left: Y + (be?.x ?? 0) - (w + l) / 2, top: D + (be?.y ?? 0) - (w + l) / 2, width: w, height: w, borderWidth: `${l}px`, border: d, borderRadius: "50%", background: i, boxShadow: `0 0 0 1.5px ${i}`, cursor: "grab", pointerEvents: "all", opacity: ne ? 0 : 1, transitionDuration: "160ms", transitionProperty: "opacity", ...L }, tabIndex: -1, onPointerDown: ke, ...ze }), _ ?? p(), W));
649
+ }, [ue, ye, Z?.x, Z?.y, Z?.width, Z?.height, O, ne, i, w, l, d, Q, Ne]), Z ? Qt(_n, { children: [Ce("div", { ref: Xo([We, $]), style: { position: "absolute", left: Z.x, top: Z.y, opacity: 0 } }), Xe] }) : null;
650
650
  }));
651
651
  Xn.displayName = "TouchSelectHandle";
652
652
  const Vt = -10, _o = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd: 0 }), bo = Object.freeze({ colIndex: 0, rowIndex: 0 }), Gn = Object.freeze([]), $t = (t) => {
@@ -656,8 +656,8 @@ const Vt = -10, _o = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
656
656
  }, Tn = (t, n, o) => {
657
657
  const r = t.getVisibleRangeCoords(), c = t.getScrollOrientation();
658
658
  !c.horizontal && (n.colIndex > r.colEnd || n.colIndex < r.colStart) && (n = { ...n, colIndex: n.colIndex > r.colEnd ? r.colEnd + 1 : r.colEnd - 1 }, t = o.current.getViewFromLocation(Qe.Center)), !c.vertical && (n.rowIndex > r.rowEnd || n.rowIndex < r.rowStart) && (n = { ...n, rowIndex: n.rowIndex > r.rowEnd ? r.rowEnd + 1 : r.rowEnd - 1 }, t = o.current.getViewFromLocation(Qe.Center)), t.scrollCellCoordsIntoView(n);
659
- }, Zo = () => !1, mr = ({ gridRef: t, commands: n, layout: o, selection: r, onSelectionChange: c, onSelectionDragStart: d, onSelectionDragEnd: i, selectionPolicy: l = "multiple", newSelectionMode: w = "clear", allowDeselectSelection: L = !0, onFillPreview: O, onFillCancel: R, onFillDone: M, onFill: A, disableFillDrag: le = !A, fillHandleBorderColor: J = "white", hiddenRowsAt: te, hiddenColumnsAt: ze, isContentfulCell: Q, contentfulCellFinder: T = Ko, getDataCoords: _, alwaysScrollToActiveCoords: ve = !1, selectionBounds: W, pointerDownInterceptor: me, pointerMoveInterceptor: Ve, mergedRanges: ke, canSelectionSpanMergedCells: We = Zo, onMoveDragStart: ue, onMoveDragUpdate: ye, onMoveDragEnd: $, onMoveDragDone: p, selectionRenderer: Ne = Yo, disableMoveDrag: Xe = !$, getCellCoordsAsRangeCoords: Z = F.cellToRange, moveDragHitSize: be = 6, moveDragOutlineSize: Y = 4, selectionBackgroundColor: D = "rgba(16, 124, 65, 0.1)", selectionBorderColor: q = "rgb(33, 115, 70)", selectionRemoveBorderColor: Pt = "rgb(255, 0, 0)", selectionRemoveBackgroundColor: Et = "rgba(250, 10, 10, 0.1)", disableTouchSelection: wt = !1, touchSelectHandleProps: ut }) => {
660
- const he = V(() => ({ top: W?.top ?? 0, left: W?.left ?? 0, bottom: t.current?.rowCount - 1 || 0, right: t.current?.columnCount - 1 || 0 }), []), Wt = P(A, [A]), k = P(O, [O]), b = P(R, [R]), Re = P(M, [M]), ne = P(Q, [Q]), we = P(Ne, [Ne]), Ue = P((e, s = !1) => On(e, s, o.getRowOffset, s ? he().bottom : he().top), [o?.getRowOffset]), lt = P(te ?? Ue, [te]), Mt = P((e, s = !1) => On(e, s, o.getColOffset, s ? he().right : he().left), [o?.getColOffset]), it = P(ze ?? Mt, [ze]), [qt, xt] = gt(() => $t(r)), v = Ae(() => $t(qt), [qt]), oe = se(v), He = se(!0);
659
+ }, Zo = () => !1, mr = ({ gridRef: t, commands: n, layout: o, selection: r, onSelectionChange: c, onSelectionDragStart: d, onSelectionDragEnd: i, selectionPolicy: l = "multiple", newSelectionMode: w = "clear", allowDeselectSelection: L = !0, onFillPreview: O, onFillCancel: R, onFillDone: T, onFill: A, disableFillDrag: ne = !A, fillHandleBorderColor: Q = "white", hiddenRowsAt: _, hiddenColumnsAt: ze, isContentfulCell: ee, contentfulCellFinder: P = Ko, getDataCoords: Z, alwaysScrollToActiveCoords: ve = !1, selectionBounds: W, pointerDownInterceptor: me, pointerMoveInterceptor: Ve, mergedRanges: ke, canSelectionSpanMergedCells: We = Zo, onMoveDragStart: ue, onMoveDragUpdate: ye, onMoveDragEnd: $, onMoveDragDone: p, selectionRenderer: Ne = Yo, disableMoveDrag: Xe = !$, getCellCoordsAsRangeCoords: J = F.cellToRange, moveDragHitSize: be = 6, moveDragOutlineSize: Y = 4, selectionBackgroundColor: D = "rgba(16, 124, 65, 0.1)", selectionBorderColor: q = "rgb(33, 115, 70)", selectionRemoveBorderColor: Pt = "rgb(255, 0, 0)", selectionRemoveBackgroundColor: Et = "rgba(250, 10, 10, 0.1)", disableTouchSelection: wt = !1, touchSelectHandleProps: ut }) => {
660
+ const he = V(() => ({ top: W?.top ?? 0, left: W?.left ?? 0, bottom: t.current?.rowCount - 1 || 0, right: t.current?.columnCount - 1 || 0 }), []), Wt = k(A, [A]), M = k(O, [O]), b = k(R, [R]), Re = k(T, [T]), oe = k(ee, [ee]), we = k(Ne, [Ne]), Ue = k((e, s = !1) => On(e, s, o.getRowOffset, s ? he().bottom : he().top), [o?.getRowOffset]), lt = k(_ ?? Ue, [_]), Mt = k((e, s = !1) => On(e, s, o.getColOffset, s ? he().right : he().left), [o?.getColOffset]), it = k(ze ?? Mt, [ze]), [qt, xt] = gt(() => $t(r)), v = Ae(() => $t(qt), [qt]), re = se(v), He = se(!0);
661
661
  en(Nt.throttle(() => {
662
662
  xt((e) => {
663
663
  He.current = !0;
@@ -665,7 +665,7 @@ const Vt = -10, _o = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
665
665
  return F.isEqualSelectionCoords(s, e) ? e : s;
666
666
  });
667
667
  }, 0), [r]), en(() => {
668
- oe.current = v;
668
+ re.current = v;
669
669
  }, [v]), It(() => {
670
670
  He.current || !c || F.isEqualSelectionCoords(r, v) || c(v);
671
671
  }, [v]);
@@ -679,10 +679,10 @@ const Vt = -10, _o = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
679
679
  const E = { cell: f, ranges: u, rangeIndex: a };
680
680
  return F.isEqualSelectionCoords(E, s) ? s : E;
681
681
  });
682
- }, []), Je = P((e) => {
682
+ }, []), Je = k((e) => {
683
683
  xt((s) => {
684
684
  He.current = !1, s = $t(s);
685
- const u = e ?? bo, a = Z(u);
685
+ const u = e ?? bo, a = J(u);
686
686
  if (!F.isSingleCell(a) && s.ranges.length === 0) return { ranges: [a], rangeIndex: 0, cell: u };
687
687
  if (F.isEqualCells(u, s.cell)) return s;
688
688
  let f = s.ranges, E = s.rangeIndex;
@@ -690,37 +690,37 @@ const Vt = -10, _o = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
690
690
  const x = { ranges: f, rangeIndex: E, cell: u };
691
691
  return F.isEqualSelectionCoords(x, s) ? s : x;
692
692
  });
693
- }, [Z]), [ln, _t] = gt(null), [Tt, hn] = gt(null), Gt = se(null), [Pe, Ut] = gt(null), vt = se(null), Bt = se(null), [vn, cn] = gt(null), Ge = se(null), Ke = se(null), nn = se(ke);
693
+ }, [J]), [ln, _t] = gt(null), [Tt, hn] = gt(null), Gt = se(null), [Pe, Ut] = gt(null), vt = se(null), Bt = se(null), [vn, cn] = gt(null), Ge = se(null), Ke = se(null), nn = se(ke);
694
694
  It(() => {
695
695
  nn.current = ke;
696
696
  }, [ke]);
697
- const St = P((e, s = { inline: "nearest", block: "nearest" }) => {
697
+ const St = k((e, s = { inline: "nearest", block: "nearest" }) => {
698
698
  let { rowIndex: u, colIndex: a } = e;
699
699
  u === void 0 && v?.cell && (u = v.cell.rowIndex), a === void 0 && v?.cell && (a = v.cell.colIndex), u !== void 0 && a !== void 0 && t.current?.scrollCellCoordsIntoView({ rowIndex: u, colIndex: a }, s);
700
700
  }, [v]), jt = V((e) => {
701
701
  const s = he();
702
702
  return e.rowIndex < s.top || e.colIndex < s.left || e.colIndex > s.right || e.rowIndex > s.bottom;
703
- }, []), Me = P((e, s) => {
703
+ }, []), Me = k((e, s) => {
704
704
  if (!t?.current) return null;
705
705
  const u = { rowStart: Math.min(e.rowIndex, s.rowIndex), colStart: Math.min(e.colIndex, s.colIndex), rowEnd: Math.max(e.rowIndex, s.rowIndex), colEnd: Math.max(e.colIndex, s.colIndex) };
706
706
  if (We?.(u)) return u;
707
- const f = Z(e), E = Z(s), x = { rowStart: Math.min(f.rowStart, E.rowStart), colStart: Math.min(f.colStart, E.colStart), rowEnd: Math.max(f.rowEnd, E.rowEnd), colEnd: Math.max(f.colEnd, E.colEnd) };
707
+ const f = J(e), E = J(s), x = { rowStart: Math.min(f.rowStart, E.rowStart), colStart: Math.min(f.colStart, E.colStart), rowEnd: Math.max(f.rowEnd, E.rowEnd), colEnd: Math.max(f.colEnd, E.colEnd) };
708
708
  let j;
709
709
  return typeof nn.current == "function" ? j = nn.current(x) : ke && (j = ke), j ? F.extendRangeToUnionRanges(x, j) : x;
710
- }, [We, Z]), _e = P((e, s, u) => {
710
+ }, [We, J]), _e = k((e, s, u) => {
711
711
  const a = e.ranges.length > 0 ? e.ranges[e.rangeIndex] : { rowStart: e.cell.rowIndex, colStart: e.cell.colIndex, rowEnd: e.cell.rowIndex, colEnd: e.cell.colIndex }, f = { rowStart: Math.min(s.rowIndex ?? a.rowStart, u.rowIndex ?? a.rowStart), colStart: Math.min(s.colIndex ?? a.colStart, u.colIndex ?? a.colStart), rowEnd: Math.max(s.rowIndex ?? a.rowEnd, u.rowIndex ?? a.rowEnd), colEnd: Math.max(s.colIndex ?? a.colEnd, u.colIndex ?? a.colEnd) }, E = { rowIndex: f.rowStart, colIndex: f.colStart }, x = { rowIndex: f.rowEnd, colIndex: f.colEnd };
712
712
  if (!(jt(E) || jt(x)))
713
713
  return Me(E, x);
714
- }, [Me]), ft = P((e, s, u) => {
715
- if (l === "single" || !oe.current) return;
716
- const a = _e(oe.current, e, s ?? oe.current.cell);
714
+ }, [Me]), ft = k((e, s, u) => {
715
+ if (l === "single" || !re.current) return;
716
+ const a = _e(re.current, e, s ?? re.current.cell);
717
717
  if (!a) return;
718
- const f = oe.current.rangeIndex;
718
+ const f = re.current.rangeIndex;
719
719
  ht((E) => E.length ? E.map((x, j) => f === j ? a : x) : [a]), u && a && Je({ colIndex: a.colStart, rowIndex: a.rowStart });
720
720
  }, []), Rt = V((e, s, u) => {
721
- if (!oe.current) return;
722
- e = { ...oe.current?.cell, ...e }, s = s ?? e;
723
- const a = _e(oe.current, e, s);
721
+ if (!re.current) return;
722
+ e = { ...re.current?.cell, ...e }, s = s ?? e;
723
+ const a = _e(re.current, e, s);
724
724
  if (!a) return;
725
725
  const f = { rowIndex: a.rowStart, colIndex: a.colStart }, E = { ...f, ...u };
726
726
  w === "clear" ? (Ge.current = E, Zt()) : w === "modify" ? ft(f) : Ie(f), Je(E);
@@ -748,7 +748,7 @@ const Vt = -10, _o = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
748
748
  return !1;
749
749
  const E = e.nativeEvent.shiftKey, x = e.nativeEvent.ctrlKey || e.nativeEvent.metaKey, j = x, B = L, H = v.ranges.length > 0, G = x && B;
750
750
  if (me?.(e, a, v) === !1) return !1;
751
- d?.(oe.current, e);
751
+ d?.(re.current, e);
752
752
  const Se = !f && l !== "single";
753
753
  if (E) return ft(a), Se;
754
754
  const K = F.isEqualCells(a, v.cell);
@@ -766,7 +766,7 @@ const Vt = -10, _o = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
766
766
  if (!t?.current || e.pointerType === "touch" || e.type === "touchmove" || !ot.current) return;
767
767
  const u = ot.current.anchor;
768
768
  let a = t.current.getViewFromLocation(u), f = a.getCellCoordsFromClient(e.clientX, e.clientY);
769
- if (!F.isEqualCells(f, ot.current?.coords) && (ot.current = { anchor: u, coords: f }, f && Ve?.(e, f, oe.current) !== !1)) {
769
+ if (!F.isEqualCells(f, ot.current?.coords) && (ot.current = { anchor: u, coords: f }, f && Ve?.(e, f, re.current) !== !1)) {
770
770
  if (vt.current) {
771
771
  const E = { rowStart: Math.min(f.rowIndex, vt.current.rowIndex), colStart: Math.min(f.colIndex, vt.current.colIndex), rowEnd: Math.max(f.rowIndex, vt.current.rowIndex), colEnd: Math.max(f.colIndex, vt.current.colIndex) }, x = { rowIndex: E.rowStart, colIndex: E.colStart }, j = { rowIndex: E.rowEnd, colIndex: E.colEnd };
772
772
  if (jt(x) || jt(j)) return;
@@ -787,7 +787,7 @@ const Vt = -10, _o = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
787
787
  return kt.current = null, void (ot.current = null);
788
788
  }
789
789
  try {
790
- i?.(oe.current, e);
790
+ i?.(re.current, e);
791
791
  } catch (u) {
792
792
  console.warn(u);
793
793
  }
@@ -810,7 +810,7 @@ const Vt = -10, _o = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
810
810
  const x = { cell: E, rangeIndex: f, ranges: a };
811
811
  return F.isEqualSelectionCoords(x, u) ? u : x;
812
812
  });
813
- }, processTouch: !0, consumeTouch: !1 }), [v, l, L, ve, w]), zn = P(un(sn), []), Ln = Ae(() => ({ onSelectionPointerDown: (e, s, u, a, f = v.cell, E = ve, x = e.nativeEvent.shiftKey, j = !1) => {
813
+ }, processTouch: !0, consumeTouch: !1 }), [v, l, L, ve, w]), zn = k(un(sn), []), Ln = Ae(() => ({ onSelectionPointerDown: (e, s, u, a, f = v.cell, E = ve, x = e.nativeEvent.shiftKey, j = !1) => {
814
814
  if (!t || !t.current) return !1;
815
815
  e.stopPropagation(), e.preventDefault(), e.nativeEvent.stopImmediatePropagation();
816
816
  const B = u ?? t.current.getViewFromClient(e.nativeEvent.clientX, e.nativeEvent.clientY), H = a ?? B.getCellCoordsFromClient(e.nativeEvent.clientX, e.nativeEvent.clientY);
@@ -821,7 +821,7 @@ const Vt = -10, _o = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
821
821
  return !1;
822
822
  const Se = e.nativeEvent.ctrlKey || e.nativeEvent.metaKey, K = Se, N = L, dt = v.ranges.length > 0, I = Se && N;
823
823
  if (me?.(e, H, v) === !1) return !1;
824
- d?.(oe.current, e);
824
+ d?.(re.current, e);
825
825
  const pe = !G && l !== "single";
826
826
  if (x) return ft(H, f, j), pe;
827
827
  const Ct = F.isEqualCells(H, f);
@@ -839,7 +839,7 @@ const Vt = -10, _o = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
839
839
  if (!t?.current || (e.stopPropagation(), e.preventDefault(), e.nativeEvent.stopImmediatePropagation(), !ot.current)) return;
840
840
  const B = ot.current.anchor;
841
841
  let H = a ?? t.current.getViewFromLocation(B), G = f ?? H.getCellCoordsFromClient(e.clientX, e.clientY);
842
- if (!F.isEqualCells(G, ot.current?.coords) && (ot.current = { anchor: B, coords: G }, G && Ve?.(e, G, oe.current) !== !1)) {
842
+ if (!F.isEqualCells(G, ot.current?.coords) && (ot.current = { anchor: B, coords: G }, G && Ve?.(e, G, re.current) !== !1)) {
843
843
  if (vt.current) {
844
844
  const Se = { rowStart: Math.min(G.rowIndex, vt.current.rowIndex), colStart: Math.min(G.colIndex, vt.current.colIndex), rowEnd: Math.max(G.rowIndex, vt.current.rowIndex), colEnd: Math.max(G.colIndex, vt.current.colIndex) }, K = { rowIndex: Se.rowStart, colIndex: Se.colStart }, N = { rowIndex: Se.rowEnd, colIndex: Se.colEnd };
845
845
  if (jt(K) || jt(N)) return;
@@ -851,7 +851,7 @@ const Vt = -10, _o = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
851
851
  }, onPointerUp: (e) => {
852
852
  ot.current = null, e.stopPropagation(), e.preventDefault(), e.nativeEvent.stopImmediatePropagation();
853
853
  try {
854
- i?.(oe.current, e);
854
+ i?.(re.current, e);
855
855
  } catch (u) {
856
856
  console.warn(u);
857
857
  }
@@ -874,7 +874,7 @@ const Vt = -10, _o = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
874
874
  const x = { cell: E, rangeIndex: f, ranges: a };
875
875
  return F.isEqualSelectionCoords(x, u) ? u : x;
876
876
  });
877
- } }), [v, l, L, ve, w]), rt = P((e, s = !1, u = !1, a = 0) => {
877
+ } }), [v, l, L, ve, w]), rt = k((e, s = !1, u = !1, a = 0) => {
878
878
  if (!t.current || !v.cell) return;
879
879
  let f = v.cell, E = v.cell;
880
880
  if (s && v.ranges.length > 0) {
@@ -893,7 +893,7 @@ const Vt = -10, _o = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
893
893
  E = { rowIndex: I.rowEnd, colIndex: pe.colIndex === I.colEnd ? I.colStart : I.colEnd }, f = { rowIndex: I.rowStart, colIndex: pe.colIndex === I.colEnd ? I.colEnd : I.colStart };
894
894
  }
895
895
  }
896
- const x = Z(E);
896
+ const x = J(E);
897
897
  let { rowStart: j, colStart: B } = x;
898
898
  const H = he();
899
899
  if (Ke.current) switch (e) {
@@ -921,16 +921,16 @@ const Vt = -10, _o = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
921
921
  }
922
922
  if (u) switch (e) {
923
923
  case g.Up:
924
- j = T({ ...E, colIndex: v.cell.colIndex }, ne, lt, e, !1, Math.max(H.top, lt(H.top, !1)));
924
+ j = P({ ...E, colIndex: v.cell.colIndex }, oe, lt, e, !1, Math.max(H.top, lt(H.top, !1)));
925
925
  break;
926
926
  case g.Down:
927
- j = T({ ...E, colIndex: v.cell.colIndex }, ne, lt, e, !1, Math.min(H.bottom, H.bottom - lt(H.bottom, !0)));
927
+ j = P({ ...E, colIndex: v.cell.colIndex }, oe, lt, e, !1, Math.min(H.bottom, H.bottom - lt(H.bottom, !0)));
928
928
  break;
929
929
  case g.Left:
930
- B = T({ ...E, rowIndex: v.cell.rowIndex }, ne, it, e, !1, Math.max(H.left, it(H.left, !1)));
930
+ B = P({ ...E, rowIndex: v.cell.rowIndex }, oe, it, e, !1, Math.max(H.left, it(H.left, !1)));
931
931
  break;
932
932
  case g.Right:
933
- B = T({ ...E, rowIndex: v.cell.rowIndex }, ne, it, e, !1, Math.min(H.right, H.right - it(H.right, !0)));
933
+ B = P({ ...E, rowIndex: v.cell.rowIndex }, oe, it, e, !1, Math.min(H.right, H.right - it(H.right, !0)));
934
934
  }
935
935
  }
936
936
  let G = null;
@@ -950,7 +950,7 @@ const Vt = -10, _o = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
950
950
  I = o.getColOffset(B), B = Math.min(H.right, o.getColIndex(I + a)), G = { left: o.getColOffset(B) - (I - t.current.getScrollPosition().left) };
951
951
  }
952
952
  }
953
- const Se = { rowIndex: j, colIndex: B }, K = Z(Se), N = { rowIndex: K.rowStart, colIndex: K.colStart };
953
+ const Se = { rowIndex: j, colIndex: B }, K = J(Se), N = { rowIndex: K.rowStart, colIndex: K.colStart };
954
954
  s || (Ke.current = Se);
955
955
  const dt = F.isEqualCells(Ge.current, N) && F.isEqualCells(Ge.current, f);
956
956
  if (s && !dt ? ft(N, f) : Rt(N), G) t.current.scrollTo(G);
@@ -961,24 +961,24 @@ const Vt = -10, _o = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
961
961
  }
962
962
  e === g.Left || e === g.Right ? St({ colIndex: Se.colIndex }) : e !== g.Up && e !== g.Down || St({ rowIndex: Se.rowIndex });
963
963
  }
964
- }, [v, Z]), Yt = P((e) => {
964
+ }, [v, J]), Yt = k((e) => {
965
965
  if (!t.current) return;
966
966
  if (v.ranges.length === 0) return void rt(e);
967
- const s = Z(v.cell);
967
+ const s = J(v.cell);
968
968
  if (F.isEqualRangesArrays([s], v.ranges)) return void rt(e);
969
- const u = Yn(v, e, Z, lt, it);
969
+ const u = Yn(v, e, J, lt, it);
970
970
  xt((a) => {
971
971
  He.current = !1, a = $t(a);
972
972
  const f = { ...a, cell: u.cell, rangeIndex: u.rangeIndex };
973
973
  return F.isEqualSelectionCoords(f, a) ? a : f;
974
974
  }), u.cell && St(u.cell);
975
- }, [v, Z]), $n = V(() => {
975
+ }, [v, J]), $n = V(() => {
976
976
  const e = he();
977
977
  ft({ rowIndex: e.top }, { rowIndex: e.bottom });
978
978
  }, []), Bn = V(() => {
979
979
  const e = he();
980
980
  ft({ colIndex: e.left }, { colIndex: e.right });
981
- }, []), Jt = P(() => {
981
+ }, []), Jt = k(() => {
982
982
  v.cell && t?.current && St(v.cell);
983
983
  }, [v.cell]), Sn = V((e = !1) => {
984
984
  const s = { rowIndex: he().top };
@@ -993,30 +993,30 @@ const Vt = -10, _o = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
993
993
  const s = he(), u = { rowIndex: s.top, colIndex: s.left };
994
994
  e ? ft(u) : Rt(u), St(u);
995
995
  }, []), gn = V((e = !1) => {
996
- const s = he(), u = { colIndex: _?.()?.colEnd ?? s.right };
996
+ const s = he(), u = { colIndex: Z?.()?.colEnd ?? s.right };
997
997
  e ? ft(u) : Rt(u), St(u);
998
- }, [_]), on = V((e = !1) => {
999
- const s = he(), u = { rowIndex: _?.()?.rowEnd ?? s.bottom, colIndex: _?.()?.colEnd ?? s.right };
998
+ }, [Z]), on = V((e = !1) => {
999
+ const s = he(), u = { rowIndex: Z?.()?.rowEnd ?? s.bottom, colIndex: Z?.()?.colEnd ?? s.right };
1000
1000
  e ? ft(u) : Rt(u), St(u);
1001
- }, [_]), wn = P((e) => {
1001
+ }, [Z]), wn = k((e) => {
1002
1002
  if (!t.current || v.ranges.length <= 1) return;
1003
1003
  const s = e === g.Left || e === g.Up;
1004
1004
  let u = v.rangeIndex + (s ? -1 : 1);
1005
1005
  u < 0 ? u = v.ranges.length - 1 : u > v.ranges.length - 1 && (u = 0);
1006
- const a = v.ranges[u], f = Yn({ cell: { rowIndex: a.rowEnd, colIndex: a.colEnd }, rangeIndex: 0, ranges: [a] }, g.Right, Z, lt, it);
1006
+ const a = v.ranges[u], f = Yn({ cell: { rowIndex: a.rowEnd, colIndex: a.colEnd }, rangeIndex: 0, ranges: [a] }, g.Right, J, lt, it);
1007
1007
  xt((E) => {
1008
1008
  He.current = !1, E = $t(E);
1009
1009
  const x = { ...E, cell: f.cell, rangeIndex: u };
1010
1010
  return F.isEqualSelectionCoords(x, E) ? E : x;
1011
1011
  }), f.cell && St(f.cell);
1012
- }, [v, Z]), An = P(() => {
1012
+ }, [v, J]), An = k(() => {
1013
1013
  const e = oo(v);
1014
1014
  xt((s) => {
1015
1015
  He.current = !1, s = $t(s);
1016
1016
  const u = { ...s, visibleSelection: e };
1017
1017
  return F.isEqualSelectionCoords(u, s) ? s : u;
1018
1018
  }), e.cell && St(e.cell);
1019
- }, [v, Z]), Fn = P(() => {
1019
+ }, [v, J]), Fn = k(() => {
1020
1020
  if (!t.current || v.ranges.length === 0) return;
1021
1021
  const e = v.cell, s = v.ranges[v.rangeIndex], u = oo({ cell: e, rangeIndex: 0, ranges: [s] }), a = u.ranges[u.rangeIndex];
1022
1022
  let f;
@@ -1025,7 +1025,7 @@ const Vt = -10, _o = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1025
1025
  const x = { ...E, cell: f };
1026
1026
  return F.isEqualSelectionCoords(x, E) ? E : x;
1027
1027
  }), f && St(f);
1028
- }, [v, Z]), bn = V((e = !1) => {
1028
+ }, [v, J]), bn = V((e = !1) => {
1029
1029
  rt(g.Down, e, !1, t.current.getDimensions().containerHeight);
1030
1030
  }, []), At = V((e = !1) => {
1031
1031
  rt(g.Up, e, !1, t.current.getDimensions().containerHeight);
@@ -1063,7 +1063,7 @@ const Vt = -10, _o = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1063
1063
  rt(g.Right, !1, !0);
1064
1064
  }, []), xe = V(() => {
1065
1065
  rt(g.Right, !0, !0);
1066
- }, []), re = V(() => {
1066
+ }, []), le = V(() => {
1067
1067
  rt(g.Up, !1, !1);
1068
1068
  }, []), fe = V(() => {
1069
1069
  rt(g.Up, !0, !1);
@@ -1093,15 +1093,15 @@ const Vt = -10, _o = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1093
1093
  })(v.ranges, e.top, e.left, e.bottom, e.right);
1094
1094
  }, [W, v.ranges]), et = V((e, s = !0) => {
1095
1095
  Ge.current = e, Je(e), s && e && t?.current && St(e);
1096
- }, []), Be = P((e = !0) => {
1096
+ }, []), Be = k((e = !0) => {
1097
1097
  const s = Gt.current;
1098
- if (!oe.current?.cell) return;
1099
- const u = oe.current?.ranges, a = oe.current?.cell;
1098
+ if (!re.current?.cell) return;
1099
+ const u = re.current?.ranges, a = re.current?.cell;
1100
1100
  if (!a || !s || !s) return;
1101
1101
  let f = null;
1102
- if (f = u.length > 0 ? u[u.length - 1] : Z(a), f.colEnd >= f.colStart && f.rowEnd >= f.rowStart) {
1102
+ if (f = u.length > 0 ? u[u.length - 1] : J(a), f.colEnd >= f.colStart && f.rowEnd >= f.rowStart) {
1103
1103
  const E = ro(f, s);
1104
- let x = e ? Wt : k;
1104
+ let x = e ? Wt : M;
1105
1105
  try {
1106
1106
  x?.(f, s, E.direction);
1107
1107
  } catch (j) {
@@ -1110,20 +1110,20 @@ const Vt = -10, _o = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1110
1110
  e && Re?.();
1111
1111
  }
1112
1112
  }
1113
- }, [Z]), tt = se(null), yt = Ae(() => ({ onPointerDown: (e, s) => {
1113
+ }, [J]), tt = se(null), yt = Ae(() => ({ onPointerDown: (e, s) => {
1114
1114
  if (Dt.current = s, !t || !t.current) return !1;
1115
1115
  const u = t.current.getViewFromClient(e.nativeEvent.clientX, e.nativeEvent.clientY), a = u?.getCellCoordsFromClient(e.nativeEvent.clientX, e.nativeEvent.clientY);
1116
1116
  a && (e.stopPropagation(), _t("crosshair"), tt.current = { anchor: u.getAnchor(), coords: a });
1117
1117
  }, onPointerMoveOrWait: (e, s) => {
1118
- if (le || !t?.current || !oe.current || !tt.current) return;
1118
+ if (ne || !t?.current || !re.current || !tt.current) return;
1119
1119
  const u = tt.current.anchor;
1120
1120
  let a = t.current.getViewFromLocation(u), f = a.getCellCoordsFromClient(e.clientX, e.clientY);
1121
1121
  if (!f) return;
1122
1122
  tt.current = { anchor: u, coords: f };
1123
- const E = oe.current.ranges;
1124
- let x = Me(oe.current.cell, f);
1123
+ const E = re.current.ranges;
1124
+ let x = Me(re.current.cell, f);
1125
1125
  if (!x) return;
1126
- const j = E.length > 0, B = j ? E[E.length - 1] : Z(oe.current.cell);
1126
+ const j = E.length > 0, B = j ? E[E.length - 1] : J(re.current.cell);
1127
1127
  if (!x) return;
1128
1128
  const H = x.rowStart < B.rowStart ? g.Up : x.rowEnd > B.rowEnd ? g.Down : x.colEnd > B.colEnd ? g.Right : g.Left, G = he();
1129
1129
  H === g.Left && (x = { ...B, colStart: Math.max(G.left, x.colStart) }), H === g.Up && (x = { ...B, rowStart: Math.max(G.top, x.rowStart) }), H === g.Right && (x = { ...B, colEnd: Math.min(G.right, x.colEnd) }), H === g.Down && (x = { ...B, rowEnd: Math.min(G.bottom, x.rowEnd) });
@@ -1164,16 +1164,16 @@ const Vt = -10, _o = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1164
1164
  Dt.current = s, Promise.resolve(Be(!0)).finally(() => {
1165
1165
  Re?.(), hn(null), Gt.current = null, tt.current = null, _t(null), t.current?.focus();
1166
1166
  });
1167
- } }), [Z]), je = un(yt), ee = Ae(() => ({ onPointerDown: je }), [je]), [Ye, pt] = gt(null), De = se(null), nt = Ae(() => ({ onPointerDown: (e, s) => {
1167
+ } }), [J]), je = un(yt), te = Ae(() => ({ onPointerDown: je }), [je]), [Ye, pt] = gt(null), De = se(null), nt = Ae(() => ({ onPointerDown: (e, s) => {
1168
1168
  if (Dt.current = s, !t || !t.current) return !1;
1169
1169
  const u = t.current.getViewFromClient(e.nativeEvent.clientX, e.nativeEvent.clientY), a = u?.getCellCoordsFromClient(e.nativeEvent.clientX, e.nativeEvent.clientY);
1170
1170
  if (!a) return;
1171
1171
  if (me?.(e, a, v) === !1) return !1;
1172
1172
  e.stopPropagation(), _t("default");
1173
- const f = u.getRelativePointFromClient(0, 0), E = oe.current?.ranges[oe.current?.ranges.length - 1] ?? F.cellToRange(oe.current?.cell), x = u.toClipBounds(u.getRangeCoordsBounds(E)), j = { x: 0, y: 0 };
1173
+ const f = u.getRelativePointFromClient(0, 0), E = re.current?.ranges[re.current?.ranges.length - 1] ?? F.cellToRange(re.current?.cell), x = u.toClipBounds(u.getRangeCoordsBounds(E)), j = { x: 0, y: 0 };
1174
1174
  x.x - f.x > e.nativeEvent.clientX ? j.x = e.nativeEvent.clientX - (x.x - f.x) : e.nativeEvent.clientX >= x.x - f.x + x.width && (j.x = Math.max(0, e.nativeEvent.clientX - (x.x - f.x + x.width)) + 1), x.y - f.y > e.nativeEvent.clientY ? j.y = e.nativeEvent.clientY - (x.y - f.y) : e.nativeEvent.clientY >= x.y - f.y + x.height && (j.y = Math.max(0, e.nativeEvent.clientY - (x.y - f.y + x.height)) + 1), ue?.(E, e, s), De.current = { range: E, anchor: u.getAnchor(), cell: a, isMoving: !1, extrusion: j };
1175
1175
  }, onPointerMoveOrWait: (e, s, u) => {
1176
- if (Xe || !t?.current || !oe.current || !De.current) return;
1176
+ if (Xe || !t?.current || !re.current || !De.current) return;
1177
1177
  const a = e.clientX - u.clientX, f = e.clientY - u.clientY;
1178
1178
  if (De.current.isMoving = De.current.isMoving || Math.abs(a) > Math.max(1, 2) || Math.abs(f) > Math.max(1, 2) || performance.now() - u.timeStamp > 500, !De.current.isMoving) return;
1179
1179
  const E = De.current.anchor, x = De.current.extrusion;
@@ -1196,7 +1196,7 @@ const Vt = -10, _o = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1196
1196
  return mt.current = e, e;
1197
1197
  }, [v]), bt = V((e) => {
1198
1198
  let s = null, u = "br";
1199
- const a = [], f = { stroke: J, fill: D, strokeWidth: 0.5 }, E = (K, N, dt) => {
1199
+ const a = [], f = { stroke: Q, fill: D, strokeWidth: 0.5 }, E = (K, N, dt) => {
1200
1200
  const I = e.toClipBounds(e.getRangeCoordsBounds(K), Vt);
1201
1201
  if (!I) return;
1202
1202
  I.x = I.width > 0 ? I.x : I.x - f.strokeWidth / 2, I.y = I.height > 0 ? I.y : I.y - f.strokeWidth / 2, I.width = Math.max(I.width, f.strokeWidth), I.height = Math.max(I.height, f.strokeWidth);
@@ -1216,7 +1216,7 @@ const Vt = -10, _o = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1216
1216
  const I = 2, pe = 0.5, Ct = e.toClipBounds(e.getRangeCoordsBounds(N, { top: 0, left: 0, right: 0, bottom: 0 }), Vt);
1217
1217
  if (Ct) {
1218
1218
  const ge = (x.ranges.length, 4);
1219
- a.push(we({ range: N, key: `selection-inside-edge-${K}`, x: Ct.x - 1, y: Ct.y - 1, width: Math.max(Ct.width + 1, 0), height: Math.max(Ct.height + 1, 0), style: { overflow: "hidden" }, stroke: J, strokeWidth: ge }));
1219
+ a.push(we({ range: N, key: `selection-inside-edge-${K}`, x: Ct.x - 1, y: Ct.y - 1, width: Math.max(Ct.width + 1, 0), height: Math.max(Ct.height + 1, 0), style: { overflow: "hidden" }, stroke: Q, strokeWidth: ge }));
1220
1220
  }
1221
1221
  if (x.ranges.length === 1) {
1222
1222
  const ge = e.toClipBounds(e.getRangeCoordsBounds(N), Vt);
@@ -1258,10 +1258,10 @@ const Vt = -10, _o = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1258
1258
  K && (H = we({ range: Tt, key: "selection-fill-outline", x: K.x - 2 / 2, y: K.y - 2 / 2, width: K.width + 2 / 2, height: K.height + 2 / 2, strokeWidth: 2, stroke: q, strokeDasharray: "3 2" }));
1259
1259
  }
1260
1260
  let G = null;
1261
- !le && s && !Ye && (G = wo(yo, { ...s, corner: u, size: 7.5, borderStroke: `${J} solid`, style: { borderRadius: 1 }, background: q, ...ee, key: "fillHandle" }));
1261
+ !ne && s && !Ye && (G = wo(yo, { ...s, corner: u, size: 7.5, borderStroke: `${Q} solid`, style: { borderRadius: 1 }, background: q, ...te, key: "fillHandle" }));
1262
1262
  const Se = [...a];
1263
1263
  if (B && Se.push(B), H && Se.push(H), G && Se.push(G), !wt && zt && x?.ranges.length === 1 && x.ranges[x.ranges.length - 1]) {
1264
- const K = x.ranges[x.ranges.length - 1], N = K.rowStart === he().top && K.rowEnd === he().bottom, dt = K.colStart === he().left && K.colEnd === he().right, I = { view: e, range: K, borderStroke: `${q} solid 3px`, background: J, selectionTouchPointerHandler: Ln, ...ut, onTouchSelectStart: (pe) => cn(pe), onTouchSelectEnd: () => cn(null), currentTouchAnchor: vn };
1264
+ const K = x.ranges[x.ranges.length - 1], N = K.rowStart === he().top && K.rowEnd === he().bottom, dt = K.colStart === he().left && K.colEnd === he().right, I = { view: e, range: K, borderStroke: `${q} solid 3px`, background: Q, selectionTouchPointerHandler: Ln, ...ut, onTouchSelectStart: (pe) => cn(pe), onTouchSelectEnd: () => cn(null), currentTouchAnchor: vn };
1265
1265
  Se.push(Ce(Xn, { anchor: dt ? "b" : N ? "r" : "br", scrollableElement: t.current, ...I }, "touch-select-handle-after")), Se.push(Ce(Xn, { anchor: dt ? "t" : N ? "l" : "tl", scrollableElement: t.current, ...I }, "touch-select-handle-before"));
1266
1266
  }
1267
1267
  if (Ye) {
@@ -1269,11 +1269,11 @@ const Vt = -10, _o = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1269
1269
  K && Se.push(we({ range: Ye, key: "selection-move-outline", x: K.x - Y / 2, y: K.y - Y / 2, width: Math.max(K.width + Y / 2, 1), height: Math.max(K.height + Y / 2, 1), stroke: q, style: { boxShadow: "none", transitionDuration: "70ms", transitionTimingFunction: "ease-in", transitionProperty: "left, top, width, height", willChange: "left, top, width, height" }, strokeWidth: Y }));
1270
1270
  }
1271
1271
  return Ce("div", { children: Se }, "selection");
1272
- }, [st, Pe, le, Tt, Xe, Ye, he, J, q, D, Pt, Et, wt, ut, vn]), Lt = Ae(() => {
1272
+ }, [st, Pe, ne, Tt, Xe, Ye, he, Q, q, D, Pt, Et, wt, ut, vn]), Lt = Ae(() => {
1273
1273
  const e = () => t.current;
1274
1274
  return [new ie("moveToPageDown", e, { label: "Page Down", description: "Shift viewport down one page.", shortcut: [{ key: "PageDown" }] }, () => bn(!1)), new ie("selectToPageDown", e, { label: "Select To Page Down", description: "Shift viewport and select down one page.", shortcut: [{ key: "PageDown", modifiers: [ce.Shift] }] }, () => bn(!0)), new ie("moveToPageRight", e, { label: "Page Right", description: "Shift viewport right one page.", shortcut: [{ key: "PageDown", modifiers: [ce.Alt] }] }, () => Cn(!1)), new ie("selectToPageRight", e, { label: "Page Right", description: "Shift viewport right one page.", shortcut: [{ key: "PageDown", modifiers: [ce.Alt, ce.Shift] }] }, () => Cn(!0)), new ie("moveToPageUp", e, { label: "Page Up", description: "Shift viewport up one page.", shortcut: [{ key: "PageUp" }] }, () => At(!1)), new ie("selectToPageUp", e, { label: "Page Up", description: "Shift viewport up one page.", shortcut: [{ key: "PageUp", modifiers: [ce.Shift] }] }, () => At(!0)), new ie("moveToPageLeft", e, { label: "Page Left", description: "Shift viewport left one page.", shortcut: [{ key: "PageUp", modifiers: [ce.Alt] }] }, () => xn(!1)), new ie("selectToPageLeft", e, { label: "Page Left", description: "Shift viewport left one page.", shortcut: [{ key: "PageUp", modifiers: [ce.Alt, ce.Shift] }] }, () => xn(!0)), new ie("selectColumn", e, { label: "Select Column", description: "Select the columns for the selected cells.", shortcut: { key: "Space", modifiers: [ce.Ctrl] } }, $n), new ie("selectRow", e, { label: "Select Row", description: "Select the rows for the selected cells.", shortcut: { key: "Space", modifiers: [ce.Shift] } }, Bn), new ie("selectToColumnStart", e, { label: "Select To Column Start", description: "Select the columns to the beginning of the sheet." }, () => Sn(!0)), new ie("selectToColumnEnd", e, { label: "Select To Column End", description: "Select the columns to the end of the sheet." }, () => yn(!0)), new ie("moveToRowStart", e, { label: "Move to Row Home", description: "Move to the beginning of the row.", shortcut: [{ key: "Home" }] }, () => fn(!1)), new ie("selectToRowStart", e, { label: "Select to Row Home", description: "Select to the beginning of the row.", shortcut: [{ key: "Home", modifiers: [ce.Shift] }] }, () => fn(!0)), new ie("moveToSheetStart", e, { label: "Move to Sheet Home", description: "Move to the beginning of the sheet.", shortcut: [{ key: "Home", modifiers: [ce.Ctrl] }] }, () => an(!1)), new ie("selectToSheetStart", e, { label: "Select to Sheet Home", description: "Select to the beginning of the sheet.", shortcut: [{ key: "Home", modifiers: [ce.Ctrl, ce.Shift] }] }, () => an(!0)), new ie("moveToRowEnd", e, { label: "Move to Row End", description: "Move to the end of the row.", shortcut: [{ key: "End" }] }, () => gn(!1)), new ie("selectToRowEnd", e, { label: "Select to Row End", description: "Select to the end of the row.", shortcut: [{ key: "End", modifiers: [ce.Shift] }] }, () => gn(!0)), new ie("moveToSheetEnd", e, { label: "Move to Sheet End", description: "Move to the end of the sheet.", shortcut: [{ key: "End", modifiers: [ce.Ctrl] }] }, () => on(!1)), new ie("selectToSheetEnd", e, { label: "Select to Sheet End", description: "Select to the end of the sheet.", shortcut: [{ key: "End", modifiers: [ce.Ctrl, ce.Shift] }] }, () => on(!0)), new ie("scrollToActiveCoords", e, { label: "Scroll to Active Cell", description: "Scroll to the Active Cell.", shortcut: { key: "Backspace", modifiers: [ce.Ctrl] } }, Jt), new ie("scrollToActiveCoordsClearSelection", e, { label: "Scroll to Active Cell", description: "Scroll to the Active Cell and clear selection.", shortcut: { key: "Backspace", modifiers: [ce.Shift] } }, () => {
1275
1275
  Zt(), et(v.cell, !0);
1276
- }), new ie("traverseSelectionRight", e, { label: "Traverse Right", description: "Traverse the selection moving rightward.", shortcut: { key: "Tab" } }, En), new ie("traverseSelectionLeft", e, { label: "Traverse Left", description: "Traverse the selection moving leftward.", shortcut: { key: "Tab", modifiers: [ce.Shift] } }, In), new ie("traverseSelectionDown", e, { label: "Traverse Down", description: "Traverse the selection moving downward.", shortcut: [{ key: "Enter" }, { key: "NumpadEnter" }] }, Wn), new ie("traverseSelectionUp", e, { label: "Traverse Up", description: "Traverse the selection moving upward.", shortcut: [{ key: "Enter", modifiers: [ce.Shift] }, { key: "NumpadEnter", modifiers: [ce.Shift] }] }, Vn), new ie("moveLeft", e, { label: "Move Left", description: "Move active cell to the left.", shortcut: [{ key: "ArrowLeft" }] }, Rn), new ie("selectLeft", e, { label: "Select Left", description: "Extend selection left.", shortcut: [{ key: "ArrowLeft", modifiers: [ce.Shift] }] }, h), new ie("moveContentfulLeft", e, { label: "Move Left Contentful", description: "Move left to the next cell with content.", shortcut: [{ key: "ArrowLeft", modifiers: [ce.Ctrl] }] }, m), new ie("selectContentfulLeft", e, { label: "Select Left Contentful", description: "Extend selection left to the next cell with content.", shortcut: [{ key: "ArrowLeft", modifiers: [ce.Ctrl, ce.Shift] }] }, C), new ie("moveRight", e, { label: "Move Right", description: "Move active cell to the right.", shortcut: [{ key: "ArrowRight" }] }, S), new ie("selectRight", e, { label: "Select Right", description: "Extend selection right.", shortcut: [{ key: "ArrowRight", modifiers: [ce.Shift] }] }, y), new ie("moveContentfulRight", e, { label: "Move Right Contentful", description: "Move right to the next cell with content.", shortcut: [{ key: "ArrowRight", modifiers: [ce.Ctrl] }] }, z), new ie("selectContentfulRight", e, { label: "Select Right Contentful", description: "Extend selection right to the next cell with content.", shortcut: [{ key: "ArrowRight", modifiers: [ce.Ctrl, ce.Shift] }] }, xe), new ie("moveUp", e, { label: "Move Up", description: "Move active cell to the up.", shortcut: [{ key: "ArrowUp" }] }, re), new ie("selectUp", e, { label: "Select Up", description: "Extend selection up.", shortcut: [{ key: "ArrowUp", modifiers: [ce.Shift] }] }, fe), new ie("moveContentfulUp", e, { label: "Move Up Contentful", description: "Move up to the next cell with content.", shortcut: [{ key: "ArrowUp", modifiers: [ce.Ctrl] }] }, U), new ie("selectContentfulUp", e, { label: "Select Up Contentful", description: "Extend selection up to the next cell with content.", shortcut: [{ key: "ArrowUp", modifiers: [ce.Ctrl, ce.Shift] }] }, Ee), new ie("moveDown", e, { label: "Move Down", description: "Move active cell to the down.", shortcut: [{ key: "ArrowDown" }] }, qe), new ie("selectDown", e, { label: "Select Down", description: "Extend selection down.", shortcut: [{ key: "ArrowDown", modifiers: [ce.Shift] }] }, $e), new ie("moveContentfulDown", e, { label: "Move Down Contentful", description: "Move down to the next cell with content.", shortcut: [{ key: "ArrowDown", modifiers: [ce.Ctrl] }] }, Ze), new ie("selectContentfulDown", e, { label: "Select Down Contentful", description: "Extend selection down to the next cell with content.", shortcut: [{ key: "ArrowDown", modifiers: [ce.Ctrl, ce.Shift] }] }, Te), new ie("selectVisible", e, { label: "Select Visible", description: "Select visible cells only.", shortcut: { key: ";", modifiers: [ce.Alt] } }, An), new ie("traverseSelectionPreviousRange", e, { label: "Traverse Previous Range", description: "Traverse the selection to the previous range.", shortcut: { key: "ArrowLeft", modifiers: [ce.Ctrl, ce.Alt] } }, pn), new ie("traverseSelectionNextRange", e, { label: "Traverse Next Range", description: "Traverse the selection to the next range.", shortcut: { key: "ArrowRight", modifiers: [ce.Ctrl, ce.Alt] } }, Un), new ie("traverseSelectionCorners", e, { label: "Traverse Corners", description: "Traverse the selection through the corners of the selected range.", shortcut: { key: ".", modifiers: [ce.Ctrl] } }, Hn)];
1276
+ }), new ie("traverseSelectionRight", e, { label: "Traverse Right", description: "Traverse the selection moving rightward.", shortcut: { key: "Tab" } }, En), new ie("traverseSelectionLeft", e, { label: "Traverse Left", description: "Traverse the selection moving leftward.", shortcut: { key: "Tab", modifiers: [ce.Shift] } }, In), new ie("traverseSelectionDown", e, { label: "Traverse Down", description: "Traverse the selection moving downward.", shortcut: [{ key: "Enter" }, { key: "NumpadEnter" }] }, Wn), new ie("traverseSelectionUp", e, { label: "Traverse Up", description: "Traverse the selection moving upward.", shortcut: [{ key: "Enter", modifiers: [ce.Shift] }, { key: "NumpadEnter", modifiers: [ce.Shift] }] }, Vn), new ie("moveLeft", e, { label: "Move Left", description: "Move active cell to the left.", shortcut: [{ key: "ArrowLeft" }] }, Rn), new ie("selectLeft", e, { label: "Select Left", description: "Extend selection left.", shortcut: [{ key: "ArrowLeft", modifiers: [ce.Shift] }] }, h), new ie("moveContentfulLeft", e, { label: "Move Left Contentful", description: "Move left to the next cell with content.", shortcut: [{ key: "ArrowLeft", modifiers: [ce.Ctrl] }] }, m), new ie("selectContentfulLeft", e, { label: "Select Left Contentful", description: "Extend selection left to the next cell with content.", shortcut: [{ key: "ArrowLeft", modifiers: [ce.Ctrl, ce.Shift] }] }, C), new ie("moveRight", e, { label: "Move Right", description: "Move active cell to the right.", shortcut: [{ key: "ArrowRight" }] }, S), new ie("selectRight", e, { label: "Select Right", description: "Extend selection right.", shortcut: [{ key: "ArrowRight", modifiers: [ce.Shift] }] }, y), new ie("moveContentfulRight", e, { label: "Move Right Contentful", description: "Move right to the next cell with content.", shortcut: [{ key: "ArrowRight", modifiers: [ce.Ctrl] }] }, z), new ie("selectContentfulRight", e, { label: "Select Right Contentful", description: "Extend selection right to the next cell with content.", shortcut: [{ key: "ArrowRight", modifiers: [ce.Ctrl, ce.Shift] }] }, xe), new ie("moveUp", e, { label: "Move Up", description: "Move active cell to the up.", shortcut: [{ key: "ArrowUp" }] }, le), new ie("selectUp", e, { label: "Select Up", description: "Extend selection up.", shortcut: [{ key: "ArrowUp", modifiers: [ce.Shift] }] }, fe), new ie("moveContentfulUp", e, { label: "Move Up Contentful", description: "Move up to the next cell with content.", shortcut: [{ key: "ArrowUp", modifiers: [ce.Ctrl] }] }, U), new ie("selectContentfulUp", e, { label: "Select Up Contentful", description: "Extend selection up to the next cell with content.", shortcut: [{ key: "ArrowUp", modifiers: [ce.Ctrl, ce.Shift] }] }, Ee), new ie("moveDown", e, { label: "Move Down", description: "Move active cell to the down.", shortcut: [{ key: "ArrowDown" }] }, qe), new ie("selectDown", e, { label: "Select Down", description: "Extend selection down.", shortcut: [{ key: "ArrowDown", modifiers: [ce.Shift] }] }, $e), new ie("moveContentfulDown", e, { label: "Move Down Contentful", description: "Move down to the next cell with content.", shortcut: [{ key: "ArrowDown", modifiers: [ce.Ctrl] }] }, Ze), new ie("selectContentfulDown", e, { label: "Select Down Contentful", description: "Extend selection down to the next cell with content.", shortcut: [{ key: "ArrowDown", modifiers: [ce.Ctrl, ce.Shift] }] }, Te), new ie("selectVisible", e, { label: "Select Visible", description: "Select visible cells only.", shortcut: { key: ";", modifiers: [ce.Alt] } }, An), new ie("traverseSelectionPreviousRange", e, { label: "Traverse Previous Range", description: "Traverse the selection to the previous range.", shortcut: { key: "ArrowLeft", modifiers: [ce.Ctrl, ce.Alt] } }, pn), new ie("traverseSelectionNextRange", e, { label: "Traverse Next Range", description: "Traverse the selection to the next range.", shortcut: { key: "ArrowRight", modifiers: [ce.Ctrl, ce.Alt] } }, Un), new ie("traverseSelectionCorners", e, { label: "Traverse Corners", description: "Traverse the selection through the corners of the selected range.", shortcut: { key: ".", modifiers: [ce.Ctrl] } }, Hn)];
1277
1277
  }, []);
1278
1278
  return Ae(() => {
1279
1279
  n?.addCommands(Lt, !0);
@@ -1283,70 +1283,70 @@ function Dn(t, n) {
1283
1283
  if (!t) throw new Error("Invariant failed");
1284
1284
  }
1285
1285
  const so = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, Jo = Object.freeze({ top: 0, left: 0 }), Qo = Object.freeze({ bottom: -4, right: -4 }), er = Object.freeze({ horizontal: !0, vertical: !0 }), ao = [Qe.TopLeft, Qe.Top, Qe.Left, Qe.Center], vr = 150, Xt = 3e3, qn = {}, Co = Kt(tn((t, n) => {
1286
- const { width: o, height: r, rowCount: c = 1, columnCount: d = 1, defaultRowHeight: i, defaultColumnWidth: l, getRowHeight: w, getColumnWidth: L, layout: O, onViewportScroll: R, onImmediateScroll: M, showGridLines: A = !0, gridLineColor: le = "rgb(224, 224, 224)", gridLineRowsProps: J, gridLineColumnsProps: te, clipCells: ze = !0, cursor: Q, freezeLeft: T = 0, freezeTop: _ = 0, freezeLeftProps: ve, freezeTopProps: W, cellRenderer: me, onViewportChange: Ve, onFirstRender: ke, overlayRenderer: We, overlayProps: ue, overlays: ye, overlaysProps: $, allowOverlaysOverflow: p = !1, stageProps: Ne, stageWrapper: Xe = null, hiddenRowsAt: Z, hiddenColumnsAt: be, hiddenCellAt: Y, getVisibleCells: D, zoom: q = 1, enableMouseWheel: Pt = !0, onWheelScroll: Et, getCellCoordsAsRangeCoords: wt = F.cellToRange, scrollPoint: ut = Jo, style: he = {}, ...Wt } = t;
1286
+ const { width: o, height: r, rowCount: c = 1, columnCount: d = 1, defaultRowHeight: i, defaultColumnWidth: l, getRowHeight: w, getColumnWidth: L, layout: O, onViewportScroll: R, onImmediateScroll: T, showGridLines: A = !0, gridLineColor: ne = "rgb(224, 224, 224)", gridLineRowsProps: Q, gridLineColumnsProps: _, clipCells: ze = !0, cursor: ee, freezeLeft: P = 0, freezeTop: Z = 0, freezeLeftProps: ve, freezeTopProps: W, cellRenderer: me, onViewportChange: Ve, onFirstRender: ke, overlayRenderer: We, overlayProps: ue, overlays: ye, overlaysProps: $, allowOverlaysOverflow: p = !1, stageProps: Ne, stageWrapper: Xe = null, hiddenRowsAt: J, hiddenColumnsAt: be, hiddenCellAt: Y, getVisibleCells: D, zoom: q = 1, enableMouseWheel: Pt = !0, onWheelScroll: Et, getCellCoordsAsRangeCoords: wt = F.cellToRange, scrollPoint: ut = Jo, style: he = {}, ...Wt } = t;
1287
1287
  Dn(me), Dn(!t?.children);
1288
- const k = P(M, [M]), b = P(Ve, [Ve]), Re = P(R, [R]), ne = P(Et, [Et]), we = P(ke, [ke]), Ue = se(null), lt = se(null), Mt = se(null), [it, qt] = Zn((h) => h + 1, 0), [xt, v] = gt({ left: ut?.left ?? 0, top: ut?.top ?? 0, horizontalScrollDirection: null, verticalScrollDirection: null }), oe = se(null), He = se(xt), { top: ht, left: Je, verticalScrollDirection: ln, horizontalScrollDirection: _t } = xt, Tt = se(!1), hn = Bo({ rowCount: c, columnCount: d, defaultRowHeight: i, defaultColumnWidth: l, getRowHeight: w, getColumnWidth: L }), Gt = se(null), Pe = Ae(() => {
1288
+ const M = k(T, [T]), b = k(Ve, [Ve]), Re = k(R, [R]), oe = k(Et, [Et]), we = k(ke, [ke]), Ue = se(null), lt = se(null), Mt = se(null), [it, qt] = Zn((h) => h + 1, 0), [xt, v] = gt({ left: ut?.left ?? 0, top: ut?.top ?? 0, horizontalScrollDirection: null, verticalScrollDirection: null }), re = se(null), He = se(xt), { top: ht, left: Je, verticalScrollDirection: ln, horizontalScrollDirection: _t } = xt, Tt = se(!1), hn = Bo({ rowCount: c, columnCount: d, defaultRowHeight: i, defaultColumnWidth: l, getRowHeight: w, getColumnWidth: L }), Gt = se(null), Pe = Ae(() => {
1289
1289
  const h = O || hn;
1290
1290
  return Gt.current = null, { getColOffset: (m) => h.getColOffset(m) * q, getColIndex: (m) => h.getColIndex(m / q), getRowOffset: (m) => h.getRowOffset(m) * q, getRowIndex: (m) => h.getRowIndex(m / q) };
1291
1291
  }, [hn, O, q]), Ut = (h, m, C) => {
1292
1292
  const S = (m?.left ?? 0) + 0, y = (m?.top ?? 0) + 0;
1293
1293
  return { getColOffset: (z) => h.getColOffset(z) - S, getColIndex: (z) => h.getColIndex(z + S), getRowOffset: (z) => h.getRowOffset(z) - y, getRowIndex: (z) => h.getRowIndex(z + y) };
1294
- }, vt = P((h, m = !1) => On(h, m, Pe.getRowOffset, m ? 0 : c), [c, Pe?.getRowOffset]), Bt = P(Z ?? vt, [Z]), vn = P((h, m = !1) => On(h, m, Pe.getColOffset, m ? d : 0), [d, Pe?.getColOffset]), cn = P(be ?? vn, [be]), Ge = Ae(() => Math.min(o ?? 800, Pe.getColOffset(d)), [Pe.getColOffset, d, o]), Ke = Ae(() => Math.min(r ?? 600, Pe.getRowOffset(c)), [Pe.getRowOffset, c, r]), nn = V((h) => {
1294
+ }, vt = k((h, m = !1) => On(h, m, Pe.getRowOffset, m ? 0 : c), [c, Pe?.getRowOffset]), Bt = k(J ?? vt, [J]), vn = k((h, m = !1) => On(h, m, Pe.getColOffset, m ? d : 0), [d, Pe?.getColOffset]), cn = k(be ?? vn, [be]), Ge = Ae(() => Math.min(o ?? 800, Pe.getColOffset(d)), [Pe.getColOffset, d, o]), Ke = Ae(() => Math.min(r ?? 600, Pe.getRowOffset(c)), [Pe.getRowOffset, c, r]), nn = V((h) => {
1295
1295
  Nt.canUseDOM && setTimeout(() => {
1296
1296
  Ue.current?.focus({ preventScroll: !0, ...h });
1297
1297
  }, 0);
1298
1298
  }, []), St = V((h) => Ue.current?.contains(h) || lt.current?.contains(h), []);
1299
1299
  It(() => {
1300
- Tt.current && (oe.current && oe.current.left !== He.current?.left && oe.current.top !== He.current?.top || (oe.current = null, Re?.({ left: Je, top: ht })));
1300
+ Tt.current && (re.current && re.current.left !== He.current?.left && re.current.top !== He.current?.top || (re.current = null, Re?.({ left: Je, top: ht })));
1301
1301
  }, [Je, ht]);
1302
- const jt = P(() => ({ top: ht, left: Je }), [ht, Je]), Me = Ae(() => {
1302
+ const jt = k(() => ({ top: ht, left: Je }), [ht, Je]), Me = Ae(() => {
1303
1303
  const h = [];
1304
1304
  let m = 0, C = 0;
1305
- typeof _ == "number" ? m = _ : (m = _.index ?? 0, C = (_.scrollOffset ?? 0) * q);
1305
+ typeof Z == "number" ? m = Z : (m = Z.index ?? 0, C = (Z.scrollOffset ?? 0) * q);
1306
1306
  const S = C, y = Pe.getRowOffset(m), z = y - S;
1307
1307
  if (m > 0) {
1308
1308
  const qe = Ut(Pe, { top: C + Pe.getRowOffset(0) }), $e = Pe.getRowIndex(S), Ze = Pe.getRowIndex(y - 1);
1309
1309
  let Te;
1310
1310
  h[1] = { minIndex: $e, maxIndex: Ze, minCoord: 0, maxCoord: m - 1, minBounds: 0, maxBounds: z, visibleIndices: () => Te || (Te = Object.freeze(Pn(Bt, $e, Ze)), Te), layout: qe, maxVirtualBounds: y, scrollOffset: C, freezeOffset: C };
1311
1311
  }
1312
- const xe = Math.max(0, Ke - z), re = Ut(Pe, { top: ht + z }), fe = re.getRowIndex(0), U = re.getRowIndex(xe);
1312
+ const xe = Math.max(0, Ke - z), le = Ut(Pe, { top: ht + z }), fe = le.getRowIndex(0), U = le.getRowIndex(xe);
1313
1313
  let Ee;
1314
- return h[0] = { minIndex: fe, maxIndex: U, minCoord: m, maxCoord: c - 1, minBounds: z, maxBounds: xe, visibleIndices: () => Ee || (Ee = Object.freeze(Pn(Bt, fe, U)), Ee), layout: re, maxVirtualBounds: Pe.getRowOffset(c), scrollOffset: ht, freezeOffset: (m > 0 ? Pe.getRowOffset(m) : 0) - C }, h;
1315
- }, [Pe.getRowIndex, Pe.getRowOffset, Bt, Ke, c, _, ht, q]), _e = Ae(() => {
1314
+ return h[0] = { minIndex: fe, maxIndex: U, minCoord: m, maxCoord: c - 1, minBounds: z, maxBounds: xe, visibleIndices: () => Ee || (Ee = Object.freeze(Pn(Bt, fe, U)), Ee), layout: le, maxVirtualBounds: Pe.getRowOffset(c), scrollOffset: ht, freezeOffset: (m > 0 ? Pe.getRowOffset(m) : 0) - C }, h;
1315
+ }, [Pe.getRowIndex, Pe.getRowOffset, Bt, Ke, c, Z, ht, q]), _e = Ae(() => {
1316
1316
  const h = [];
1317
1317
  let m = 0, C = 0;
1318
- typeof T == "number" ? m = T : (m = T.index ?? 0, C = (T.scrollOffset ?? 0) * q);
1318
+ typeof P == "number" ? m = P : (m = P.index ?? 0, C = (P.scrollOffset ?? 0) * q);
1319
1319
  const S = C, y = Pe.getColOffset(m), z = y - S;
1320
1320
  if (m > 0) {
1321
1321
  const qe = Ut(Pe, { left: C + Pe.getColOffset(0) }), $e = Pe.getColIndex(S), Ze = Pe.getColIndex(y - 1);
1322
1322
  let Te;
1323
1323
  h[1] = { minIndex: $e, maxIndex: Ze, minCoord: 0, maxCoord: m - 1, minBounds: 0, maxBounds: z, visibleIndices: () => Te || (Te = Object.freeze(Pn(cn, $e, Ze)), Te), layout: qe, maxVirtualBounds: y, scrollOffset: C, freezeOffset: C };
1324
1324
  }
1325
- const xe = Math.max(0, Ge - z), re = Ut(Pe, { left: Je + z }), fe = re.getColIndex(0), U = re.getColIndex(xe);
1325
+ const xe = Math.max(0, Ge - z), le = Ut(Pe, { left: Je + z }), fe = le.getColIndex(0), U = le.getColIndex(xe);
1326
1326
  let Ee;
1327
- return h[0] = { minIndex: fe, maxIndex: U, minCoord: m, maxCoord: d - 1, minBounds: z, maxBounds: xe, visibleIndices: () => Ee || (Ee = Object.freeze(Pn(cn, fe, U)), Ee), layout: re, maxVirtualBounds: Pe.getColOffset(d), scrollOffset: Je, freezeOffset: (m > 0 ? Pe.getColOffset(m) : 0) - C }, h;
1328
- }, [Pe.getColIndex, Pe.getColOffset, cn, Ge, d, T, Je, q]), ft = se({}), Rt = se([]), Ie = Ae(() => {
1327
+ return h[0] = { minIndex: fe, maxIndex: U, minCoord: m, maxCoord: d - 1, minBounds: z, maxBounds: xe, visibleIndices: () => Ee || (Ee = Object.freeze(Pn(cn, fe, U)), Ee), layout: le, maxVirtualBounds: Pe.getColOffset(d), scrollOffset: Je, freezeOffset: (m > 0 ? Pe.getColOffset(m) : 0) - C }, h;
1328
+ }, [Pe.getColIndex, Pe.getColOffset, cn, Ge, d, P, Je, q]), ft = se({}), Rt = se([]), Ie = Ae(() => {
1329
1329
  let h = {};
1330
- const m = (S, y, z, xe, re) => {
1330
+ const m = (S, y, z, xe, le) => {
1331
1331
  const fe = { vertical: xe?.vertical || !1, horizontal: xe?.horizontal || !1 };
1332
1332
  if (S >= _e.length || y >= Me.length) return null;
1333
1333
  const U = { rowStart: Me[y].minIndex, colStart: _e[S].minIndex, rowEnd: Me[y].maxIndex, colEnd: _e[S].maxIndex };
1334
1334
  if (U.rowStart > U.rowEnd || U.colStart > U.colEnd) return null;
1335
- const Ee = { getColIndex: (ee) => _e[S].layout.getColIndex(ee), getColOffset: (ee) => _e[S].layout.getColOffset(ee), getRowIndex: (ee) => Me[y].layout.getRowIndex(ee), getRowOffset: (ee) => Me[y].layout.getRowOffset(ee) }, qe = Object.freeze({ left: re?.left ?? 0, top: re?.top ?? 0, right: re?.right ?? 0, bottom: re?.bottom ?? 0 }), $e = Object.freeze({ x: _e[S].minBounds, y: Me[y].minBounds, width: _e[S].maxBounds, height: Me[y].maxBounds }), Ze = (ee, Ye) => io(Ee, ee ?? U, Ye), Te = { width: _e[S].maxVirtualBounds, height: Me[y].maxVirtualBounds }, ae = { left: _e[S].scrollOffset, top: Me[y].scrollOffset }, ct = { left: _e[S].freezeOffset, top: Me[y].freezeOffset }, et = { width: Ge, height: Ke };
1335
+ const Ee = { getColIndex: (te) => _e[S].layout.getColIndex(te), getColOffset: (te) => _e[S].layout.getColOffset(te), getRowIndex: (te) => Me[y].layout.getRowIndex(te), getRowOffset: (te) => Me[y].layout.getRowOffset(te) }, qe = Object.freeze({ left: le?.left ?? 0, top: le?.top ?? 0, right: le?.right ?? 0, bottom: le?.bottom ?? 0 }), $e = Object.freeze({ x: _e[S].minBounds, y: Me[y].minBounds, width: _e[S].maxBounds, height: Me[y].maxBounds }), Ze = (te, Ye) => io(Ee, te ?? U, Ye), Te = { width: _e[S].maxVirtualBounds, height: Me[y].maxVirtualBounds }, ae = { left: _e[S].scrollOffset, top: Me[y].scrollOffset }, ct = { left: _e[S].freezeOffset, top: Me[y].freezeOffset }, et = { width: Ge, height: Ke };
1336
1336
  let Be = null, tt = null;
1337
1337
  const yt = (ct.top + (xe.vertical ? ae.top : 0)) / q, je = (ct.left + (xe.horizontal ? ae.left : 0)) / q;
1338
- return { getStage: () => Ue.current ?? null, getVisibleRangeCoords: () => U, toClipBounds: (ee, Ye) => {
1338
+ return { getStage: () => Ue.current ?? null, getVisibleRangeCoords: () => U, toClipBounds: (te, Ye) => {
1339
1339
  let pt, De = 0;
1340
1340
  return Ye === void 0 || typeof Ye == "number" ? (pt = Ze(U), De = Ye) : pt = Ye, ((nt, Le, Oe = 0) => {
1341
1341
  if (nt.x > Le.width || nt.y > Le.height) return null;
1342
1342
  const mt = { left: nt.x, top: nt.y, bottom: nt.height + nt.y, right: nt.width + nt.x }, st = { left: Le.x + Oe, top: Le.y + Oe, bottom: Le.height - 2 * Oe + Le.y, right: Le.width - 2 * Oe + Le.x }, bt = { left: Math.max(mt.left, st.left), top: Math.max(mt.top, st.top), bottom: Math.min(mt.bottom, st.bottom), right: Math.min(mt.right, st.right) }, Lt = { x: bt.left, y: bt.top, width: bt.right - bt.left, height: bt.bottom - bt.top };
1343
1343
  return Lt.height < 0 || Lt.width < 0 ? null : Lt;
1344
- })(ee ?? { x: 0, y: 0, width: $e.width, height: $e.height }, pt, De);
1345
- }, toViewBounds: (ee) => je === 0 && yt === 0 && q === 1 ? ee : { x: (ee.x - je) * q, y: (ee.y - yt) * q, width: ee.width * q, height: ee.height * q }, toAbsoluteBounds: (ee) => je === 0 && yt === 0 && q === 1 ? ee : { x: ee.x / q + je, y: ee.y / q + yt, width: ee.width / q, height: ee.height / q }, getRelativePointFromClient: (ee, Ye) => {
1346
- const pt = sn(ee, Ye);
1344
+ })(te ?? { x: 0, y: 0, width: $e.width, height: $e.height }, pt, De);
1345
+ }, toViewBounds: (te) => je === 0 && yt === 0 && q === 1 ? te : { x: (te.x - je) * q, y: (te.y - yt) * q, width: te.width * q, height: te.height * q }, toAbsoluteBounds: (te) => je === 0 && yt === 0 && q === 1 ? te : { x: te.x / q + je, y: te.y / q + yt, width: te.width / q, height: te.height / q }, getRelativePointFromClient: (te, Ye) => {
1346
+ const pt = sn(te, Ye);
1347
1347
  return { x: pt.x - $e.x, y: pt.y - $e.y };
1348
- }, getLayout: () => Ee, getCellCoordsAsRangeCoords: wt, getVisibleColumns: () => _e[S].visibleIndices(), getVisibleRows: () => Me[y].visibleIndices(), getVisibleColumnOffsets: () => (Be || (Be = lo(_e[S].layout, !0, _e[S].visibleIndices(), U.colStart, U.colEnd)), Be), getVisibleRowOffsets: () => (tt || (tt = lo(Me[y].layout, !1, Me[y].visibleIndices(), U.rowStart, U.rowEnd)), tt), getTotalRangeCoords: () => ({ colStart: _e[S].minCoord, colEnd: _e[S].maxCoord, rowStart: Me[y].minCoord, rowEnd: Me[y].maxCoord }), getRangeCoordsBounds: Ze, scrollCellCoordsIntoView: (ee, Ye) => fn(ee, Ye, z), getCellCoordsFromClient: (ee, Ye, pt = !1) => {
1349
- const De = sn(ee, Ye);
1348
+ }, getLayout: () => Ee, getCellCoordsAsRangeCoords: wt, getVisibleColumns: () => _e[S].visibleIndices(), getVisibleRows: () => Me[y].visibleIndices(), getVisibleColumnOffsets: () => (Be || (Be = lo(_e[S].layout, !0, _e[S].visibleIndices(), U.colStart, U.colEnd)), Be), getVisibleRowOffsets: () => (tt || (tt = lo(Me[y].layout, !1, Me[y].visibleIndices(), U.rowStart, U.rowEnd)), tt), getTotalRangeCoords: () => ({ colStart: _e[S].minCoord, colEnd: _e[S].maxCoord, rowStart: Me[y].minCoord, rowEnd: Me[y].maxCoord }), getRangeCoordsBounds: Ze, scrollCellCoordsIntoView: (te, Ye) => fn(te, Ye, z), getCellCoordsFromClient: (te, Ye, pt = !1) => {
1349
+ const De = sn(te, Ye);
1350
1350
  if (!De) return null;
1351
1351
  const nt = Ee.getColIndex(De.x - $e.x), Le = { rowIndex: Ee.getRowIndex(De.y - $e.y), colIndex: nt };
1352
1352
  if (pt) return Le;
@@ -1363,9 +1363,9 @@ const so = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, Jo = Object.freeze({ top
1363
1363
  Rt.current = [];
1364
1364
  }
1365
1365
  }, [Ie]);
1366
- const Dt = P(() => ({ containerWidth: Ge, containerHeight: Ke, totalWidth: zt, totalHeight: ot }), [Ge, Ke, Pe]);
1366
+ const Dt = k(() => ({ containerWidth: Ge, containerHeight: Ke, totalWidth: zt, totalHeight: ot }), [Ge, Ke, Pe]);
1367
1367
  It(() => {
1368
- !oe.current && Tt.current && b({ top: ht, left: Je, width: Ge, height: Ke, totalWidth: zt, totalHeight: ot });
1368
+ !re.current && Tt.current && b({ top: ht, left: Je, width: Ge, height: Ke, totalWidth: zt, totalHeight: ot });
1369
1369
  }, [ht, Je, zt, ot]), It(() => {
1370
1370
  Tt.current && b({ top: ht, left: Je, width: Ge, height: Ke, totalWidth: zt, totalHeight: ot });
1371
1371
  }, [Ge, Ke]);
@@ -1373,26 +1373,26 @@ const so = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, Jo = Object.freeze({ top
1373
1373
  Dn(typeof h == "number" && typeof m == "number");
1374
1374
  const C = Ue.current?.getBoundingClientRect();
1375
1375
  return C ? { x: h - C.x, y: m - C.y } : { x: h, y: m };
1376
- }, []), zn = P((h) => Ie[h] || null, [Ie]), Ln = P((h, m) => {
1376
+ }, []), zn = k((h) => Ie[h] || null, [Ie]), Ln = k((h, m) => {
1377
1377
  if (Object.keys(Ie).length === 1) return Ie[Qe.Center];
1378
1378
  const C = sn(h, m);
1379
1379
  if (!C) return null;
1380
1380
  const { x: S, y } = C;
1381
1381
  let z = null;
1382
- const xe = ao, re = xe.length;
1383
- for (let fe = 0; !z && fe < re; fe++) {
1382
+ const xe = ao, le = xe.length;
1383
+ for (let fe = 0; !z && fe < le; fe++) {
1384
1384
  const U = Ie[xe[fe]];
1385
1385
  U && qo(S, y, U.getBounds()) && (z = U);
1386
1386
  }
1387
1387
  return z || (z = Ie[Qe.Center]), z;
1388
- }, [Ie, wt]), rt = P(() => Ie[Qe.Center].getVisibleRangeCoords(), [Ie[Qe.Center]]), Yt = se(null), $n = V(() => {
1388
+ }, [Ie, wt]), rt = k(() => Ie[Qe.Center].getVisibleRangeCoords(), [Ie[Qe.Center]]), Yt = se(null), $n = V(() => {
1389
1389
  Yt.current !== null && Nt.cancelTimeout(Yt.current), Yt.current = Nt.requestTimeout(Bn, 150);
1390
1390
  }, []), Bn = V(() => {
1391
1391
  Yt.current = null, v((h) => {
1392
1392
  const m = { ...h, verticalScrollDirection: null, horizontalScrollDirection: null };
1393
1393
  return He.current = m, m;
1394
1394
  });
1395
- }, []), Jt = P((h) => {
1395
+ }, []), Jt = k((h) => {
1396
1396
  const m = h?.left ?? h?.[0], C = h?.top ?? h?.[1];
1397
1397
  let S = He.current.left;
1398
1398
  m !== void 0 && m !== S && (m > S ? (S = Math.max(_e?.[1]?.scrollOffset ?? 0, m), S = Math.min(zt - Ge, S)) : S = Math.max(_e?.[1]?.scrollOffset ?? 0, m));
@@ -1400,21 +1400,21 @@ const so = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, Jo = Object.freeze({ top
1400
1400
  if (C !== void 0 && C !== y && (C > y ? (y = Math.max(Me?.[1]?.scrollOffset ?? 0, C), y = Math.min(ot - Ke, y)) : y = Math.max(Me?.[1]?.scrollOffset ?? 0, C)), He.current.left === S && He.current.top === y) return;
1401
1401
  let z = null, xe = null;
1402
1402
  He.current.left > S ? z = g.Left : He.current.left < S && (z = g.Right), He.current.top > y ? xe = g.Up : He.current.top < y && (xe = g.Down), Nt.throttle(() => {
1403
- v((re) => {
1404
- const fe = { ...re, left: S, top: y, horizontalScrollDirection: z, verticalScrollDirection: xe };
1403
+ v((le) => {
1404
+ const fe = { ...le, left: S, top: y, horizontalScrollDirection: z, verticalScrollDirection: xe };
1405
1405
  return He.current = fe, fe;
1406
1406
  });
1407
- }, 17)(), oe.current?.top === y && oe.current?.left === S || (oe.current = { left: S, top: y }, k({ left: S, top: y }), b({ left: S, top: y, width: Ge, height: Ke, totalWidth: zt, totalHeight: ot })), $n();
1407
+ }, 17)(), re.current?.top === y && re.current?.left === S || (re.current = { left: S, top: y }, M({ left: S, top: y }), b({ left: S, top: y, width: Ge, height: Ke, totalWidth: zt, totalHeight: ot })), $n();
1408
1408
  }, [zt, ot, Me, _e]);
1409
1409
  It(() => {
1410
- oe.current || Jt({ left: Je, top: ht });
1410
+ re.current || Jt({ left: Je, top: ht });
1411
1411
  }, [Ge, Ke]), It(() => {
1412
1412
  let h, m, C = !1;
1413
1413
  He.current.left > zt && (h = 0, C = !0), He.current.top > ot && (m = 0, C = !0), C && Jt({ left: h, top: m });
1414
1414
  }, [zt, ot]), en(() => {
1415
- oe.current = { left: ut?.left, top: ut?.top }, Jt(oe.current);
1415
+ re.current = { left: ut?.left, top: ut?.top }, Jt(re.current);
1416
1416
  }, [ut?.left, ut?.top]);
1417
- const Sn = P((h) => {
1417
+ const Sn = k((h) => {
1418
1418
  let m = h?.left ?? h?.[0], C = h?.top ?? h?.[1];
1419
1419
  if (m === void 0 && C === void 0) return;
1420
1420
  const S = h?.behavior ?? "auto";
@@ -1429,7 +1429,7 @@ const so = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, Jo = Object.freeze({ top
1429
1429
  }
1430
1430
  }
1431
1431
  return m || (m = Ie[Qe.Center]), m;
1432
- }, [Ie]), fn = P((h, m = { inline: "nearest", block: "nearest" }, C = null) => {
1432
+ }, [Ie]), fn = k((h, m = { inline: "nearest", block: "nearest" }, C = null) => {
1433
1433
  const S = { rowIndex: 0, colIndex: 0, ...h };
1434
1434
  let y = null;
1435
1435
  if (C !== null) {
@@ -1437,11 +1437,11 @@ const so = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, Jo = Object.freeze({ top
1437
1437
  Be("Invalid view");
1438
1438
  });
1439
1439
  } else y = yn(S);
1440
- const z = wt(S), xe = y.getLayout(), re = xe.getColOffset(z.colStart), fe = xe.getRowOffset(z.rowStart), U = xe.getColOffset(z.colEnd + 1), Ee = xe.getRowOffset(z.rowEnd + 1), qe = y.getBounds(), $e = y.getTotalSize(), Ze = y.getScrollTopLeft(), Te = ((et, Be, tt = !0) => {
1440
+ const z = wt(S), xe = y.getLayout(), le = xe.getColOffset(z.colStart), fe = xe.getRowOffset(z.rowStart), U = xe.getColOffset(z.colEnd + 1), Ee = xe.getRowOffset(z.rowEnd + 1), qe = y.getBounds(), $e = y.getTotalSize(), Ze = y.getScrollTopLeft(), Te = ((et, Be, tt = !0) => {
1441
1441
  tt = tt === !0 ? { block: "start", inline: "end" } : tt === !1 ? { block: "end", inline: "end" } : { block: "end", inline: "end", ...tt };
1442
1442
  const yt = no(tt.inline, et.x, et.x + et.width, Be.left, Be.left + Be.width, Be.totalWidth), je = no(tt.block, et.y, et.y + et.height, Be.top, Be.top + Be.height, Be.totalHeight);
1443
1443
  if (yt !== void 0 || je !== void 0) return { left: yt, top: je };
1444
- })({ x: re + Ze.left, y: fe + Ze.top, width: U - re, height: Ee - fe }, { left: Ze.left, top: Ze.top, width: qe.width, height: qe.height, totalWidth: $e.width, totalHeight: $e.height }, m);
1444
+ })({ x: le + Ze.left, y: fe + Ze.top, width: U - le, height: Ee - fe }, { left: Ze.left, top: Ze.top, width: qe.width, height: qe.height, totalWidth: $e.width, totalHeight: $e.height }, m);
1445
1445
  if (!Te) return Promise.resolve({ ...Ze });
1446
1446
  const ae = { ...Te };
1447
1447
  ae.left > Je ? ae.left += 20 : ae.left < Je && (ae.left -= 0), ae.top > ht ? ae.top += 20 : ae.top < ht && (ae.top -= 0);
@@ -1453,17 +1453,17 @@ const so = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, Jo = Object.freeze({ top
1453
1453
  Be(tt);
1454
1454
  }
1455
1455
  });
1456
- }, [zt, ot, Ie, wt]), an = P((h) => {
1456
+ }, [zt, ot, Ie, wt]), an = k((h) => {
1457
1457
  const m = h.shiftKey;
1458
1458
  h.preventDefault();
1459
1459
  const { deltaX: C, deltaY: S, deltaMode: y } = h;
1460
- if (Mt.current || ne?.(h) === !1) return;
1461
- let xe = m ? S : C, re = S;
1462
- const fe = m || Math.abs(xe) > Math.abs(re);
1463
- y === 1 && (re *= 0), Mt.current = window.requestAnimationFrame(() => {
1464
- Mt.current = null, Sn(fe ? { left: xe } : { top: re });
1460
+ if (Mt.current || oe?.(h) === !1) return;
1461
+ let xe = m ? S : C, le = S;
1462
+ const fe = m || Math.abs(xe) > Math.abs(le);
1463
+ y === 1 && (le *= 0), Mt.current = window.requestAnimationFrame(() => {
1464
+ Mt.current = null, Sn(fe ? { left: xe } : { top: le });
1465
1465
  });
1466
- }, [ne]), gn = V((h = null) => {
1466
+ }, [oe]), gn = V((h = null) => {
1467
1467
  Gt.current = null, ft.current = null, qt();
1468
1468
  }, []);
1469
1469
  en(() => {
@@ -1472,12 +1472,12 @@ const so = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, Jo = Object.freeze({ top
1472
1472
  const on = go(n, () => ({ stage: Ue.current, focus: nn, contains: St, invalidate: gn, scrollTo: Jt, scrollBy: Sn, scrollCellCoordsIntoView: fn, getScrollPosition: jt, getDimensions: Dt, getViewport: rt, handleWheel: an, rowCount: c, columnCount: d, getLayout: () => Pe, getRelativePointFromClient: sn, getViewFromClient: Ln, getViewFromCellCoords: yn, getViewFromLocation: zn, onViewChangeOnce: (h) => {
1473
1473
  Rt.current.push(h);
1474
1474
  } }), [c, d, Ie]);
1475
- It(() => (Pt && on.current?.addEventListener("wheel", an, { passive: !1 }), Tt.current = !0, oe.current = null, () => {
1475
+ It(() => (Pt && on.current?.addEventListener("wheel", an, { passive: !1 }), Tt.current = !0, re.current = null, () => {
1476
1476
  on.current?.removeEventListener("wheel", an);
1477
1477
  }), [Pt]);
1478
1478
  const wn = se([]), An = (h, m) => {
1479
1479
  !h || !We || (wn.current = [], m.push(((C, S) => {
1480
- const y = `view:${C.getAnchor()}:overlay:${m.length}`, z = We?.({ key: y, view: C }, (re) => wn.current[S] = re);
1480
+ const y = `view:${C.getAnchor()}:overlay:${m.length}`, z = We?.({ key: y, view: C }, (le) => wn.current[S] = le);
1481
1481
  if (!z) return null;
1482
1482
  const xe = C.getBounds();
1483
1483
  return Ce("div", { style: { position: "absolute", left: "0px", top: "0px", width: `${xe.width}px`, height: `${xe.height}px`, overflow: "hidden" }, children: z }, `overlay-${C.getAnchor()}-${S}`);
@@ -1491,17 +1491,17 @@ const so = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, Jo = Object.freeze({ top
1491
1491
  return h;
1492
1492
  }, [it, We, c, d, Me, _e]), bn = (h, m, C, S, y, z, xe) => {
1493
1493
  if (!h) return;
1494
- const re = h.getVisibleColumns(), fe = h.getVisibleRows();
1495
- if (re.length === 0 || fe.length === 0) return;
1494
+ const le = h.getVisibleColumns(), fe = h.getVisibleRows();
1495
+ if (le.length === 0 || fe.length === 0) return;
1496
1496
  let U = null;
1497
1497
  if (D) U = D(h);
1498
1498
  else {
1499
1499
  U = [];
1500
- const De = fe.length, nt = re.length;
1500
+ const De = fe.length, nt = le.length;
1501
1501
  for (let Le = 0; Le < De; Le++) {
1502
1502
  const Oe = fe[Le];
1503
1503
  for (let mt = 0; mt < nt; mt++) {
1504
- const st = { rowIndex: Oe, colIndex: re[mt] };
1504
+ const st = { rowIndex: Oe, colIndex: le[mt] };
1505
1505
  if (Y?.(st)) continue;
1506
1506
  const bt = { coords: st, range: wt(st) };
1507
1507
  U.push(bt);
@@ -1542,7 +1542,7 @@ const so = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, Jo = Object.freeze({ top
1542
1542
  const f = nt?.value;
1543
1543
  tt(h, Le, Oe, u, f);
1544
1544
  }
1545
- const je = Te % Xt, ee = ae % Xt, Ye = Object.keys(Be), pt = Ye.length;
1545
+ const je = Te % Xt, te = ae % Xt, Ye = Object.keys(Be), pt = Ye.length;
1546
1546
  for (let De = 0; De < pt; De++) {
1547
1547
  const nt = Ye[De], Le = Be[nt];
1548
1548
  if (!Le) continue;
@@ -1551,19 +1551,19 @@ const so = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, Jo = Object.freeze({ top
1551
1551
  const bt = Oe[st], Lt = Le[bt];
1552
1552
  if (!Lt) continue;
1553
1553
  const e = parseInt(nt), s = parseInt(bt), u = e + et, a = s + ct, f = `view:${h.getAnchor()}:segment:${a}:${u}`;
1554
- m.push(Ce("div", { className: "cell-container", style: { transform: `translate(${X.boundPixel(s * Xt - je, !0)}px, ${X.boundPixel(e * Xt - ee, !0)}px)`, willChange: "transform" }, children: Lt }, f));
1554
+ m.push(Ce("div", { className: "cell-container", style: { transform: `translate(${X.boundPixel(s * Xt - je, !0)}px, ${X.boundPixel(e * Xt - te, !0)}px)`, willChange: "transform" }, children: Lt }, f));
1555
1555
  }
1556
1556
  }
1557
1557
  }, At = Ae(() => {
1558
1558
  const h = Gt.current, m = /* @__PURE__ */ new Map(), C = {}, S = Object.keys(Ie), y = S.length;
1559
1559
  for (let z = 0; z < y; z++) {
1560
- const xe = S[z], re = [], fe = [], U = [];
1561
- bn(Ie[xe], U, re, fe, /* @__PURE__ */ new Set(), h, m), C[xe] = { cells: U, rangesH: re, rangesV: fe };
1560
+ const xe = S[z], le = [], fe = [], U = [];
1561
+ bn(Ie[xe], U, le, fe, /* @__PURE__ */ new Set(), h, m), C[xe] = { cells: U, rangesH: le, rangesV: fe };
1562
1562
  }
1563
1563
  return Gt.current = m, C;
1564
- }, [it, c, d, Me, _e, A, he, ze, Y, D, be, Z, wt]), Cn = (h, m, C, S, y) => {
1564
+ }, [it, c, d, Me, _e, A, he, ze, Y, D, be, J, wt]), Cn = (h, m, C, S, y) => {
1565
1565
  if (!h) return;
1566
- const z = h.getLayout(), xe = window.devicePixelRatio || 1, re = String(1 / xe);
1566
+ const z = h.getLayout(), xe = window.devicePixelRatio || 1, le = String(1 / xe);
1567
1567
  if (m) {
1568
1568
  const fe = `view:${h.getAnchor()}:hl:`, U = h.getVisibleRows();
1569
1569
  if ((U ? U.length : 0) === 0) return;
@@ -1582,9 +1582,9 @@ const so = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, Jo = Object.freeze({ top
1582
1582
  let tt = $e;
1583
1583
  const yt = Te.length;
1584
1584
  for (let je = 0; je < yt + 1; je++) {
1585
- let ee = tt, Ye = Ze;
1585
+ let te = tt, Ye = Ze;
1586
1586
  const pt = Te[je];
1587
- je < yt && (Ye = Math.min(Ze, z.getColOffset(pt.colStart)), tt = Math.min(Ze, z.getColOffset(pt.colEnd + 1))), S.push(wo("path", { d: `M ${X.boundPixel(ee)} ${X.boundPixel(Be, !1, C)} L ${X.boundPixel(Ye)} ${X.boundPixel(Be, !1, C)}`, stroke: le, strokeWidth: re, vectorEffect: "non-scaling-stroke", ...J, key: fe + ct + ":" + je }));
1587
+ je < yt && (Ye = Math.min(Ze, z.getColOffset(pt.colStart)), tt = Math.min(Ze, z.getColOffset(pt.colEnd + 1))), S.push(wo("path", { d: `M ${X.boundPixel(te)} ${X.boundPixel(Be, !1, C)} L ${X.boundPixel(Ye)} ${X.boundPixel(Be, !1, C)}`, stroke: ne, strokeWidth: le, vectorEffect: "non-scaling-stroke", ...Q, key: fe + ct + ":" + je }));
1588
1588
  }
1589
1589
  for (let je = yt - 1; je >= 0; je--) Te[je].rowEnd <= U[ae + 1] && Te.splice(je, 1);
1590
1590
  }
@@ -1598,19 +1598,19 @@ const so = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, Jo = Object.freeze({ top
1598
1598
  if (et < $e.colStart) continue;
1599
1599
  let Be = !1;
1600
1600
  for (; qe.length > 0 && qe[0].colStart <= et; ) {
1601
- const ee = qe.shift();
1602
- ee.colEnd > et && (ae.push(ee), Be = !0);
1601
+ const te = qe.shift();
1602
+ te.colEnd > et && (ae.push(te), Be = !0);
1603
1603
  }
1604
1604
  Be && (ae = ae.sort(F.rowFirstRangeComparator));
1605
1605
  const tt = z.getColOffset(et + 1);
1606
1606
  let yt = Ze;
1607
1607
  const je = ae.length;
1608
- for (let ee = 0; ee < je + 1; ee++) {
1608
+ for (let te = 0; te < je + 1; te++) {
1609
1609
  let Ye = yt, pt = Te;
1610
- const De = ae[ee];
1611
- ee < je && (pt = Math.min(Te, z.getRowOffset(De.rowStart)), yt = Math.min(Te, z.getRowOffset(De.rowEnd + 1))), S.push(Ce("path", { d: `M ${X.boundPixel(tt, !1, C)} ${X.boundPixel(Ye)} L ${X.boundPixel(tt, !1, C)} ${X.boundPixel(pt)}`, stroke: le, strokeWidth: re, vectorEffect: "non-scaling-stroke", ...te }, fe + et + ":" + ee));
1610
+ const De = ae[te];
1611
+ te < je && (pt = Math.min(Te, z.getRowOffset(De.rowStart)), yt = Math.min(Te, z.getRowOffset(De.rowEnd + 1))), S.push(Ce("path", { d: `M ${X.boundPixel(tt, !1, C)} ${X.boundPixel(Ye)} L ${X.boundPixel(tt, !1, C)} ${X.boundPixel(pt)}`, stroke: ne, strokeWidth: le, vectorEffect: "non-scaling-stroke", ..._ }, fe + et + ":" + te));
1612
1612
  }
1613
- for (let ee = je - 1; ee >= 0; ee--) ae[ee].colEnd <= U[ct + 1] && ae.splice(ee, 1);
1613
+ for (let te = je - 1; te >= 0; te--) ae[te].colEnd <= U[ct + 1] && ae.splice(te, 1);
1614
1614
  }
1615
1615
  }
1616
1616
  }, xn = (h) => {
@@ -1619,11 +1619,11 @@ const so = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, Jo = Object.freeze({ top
1619
1619
  for (let S = 0; S < C; S++) {
1620
1620
  const y = Zt[S], z = Ie[y], xe = [];
1621
1621
  Cn(z, h, 0, xe, h ? At[y].rangesH : At[y].rangesV);
1622
- const re = z.getRangeCoordsBounds(), fe = Math.ceil(re.width), U = Math.ceil(re.height);
1622
+ const le = z.getRangeCoordsBounds(), fe = Math.ceil(le.width), U = Math.ceil(le.height);
1623
1623
  m[y] = Ce("svg", { width: `${fe}`, height: `${U}`, viewBox: `0 0 ${fe} ${U}`, preserveAspectRatio: "none", shapeRendering: "crispEdges", style: { position: "absolute" }, children: xe });
1624
1624
  }
1625
1625
  return m;
1626
- }, In = Ae(() => A === !0 || A?.horizontal === !0 ? xn(!0) : null, [it, A, Me, _, T, le, J, c, d, Ge, zt, Ie, At]), En = Ae(() => A === !0 || A?.vertical === !0 ? xn(!1) : null, [it, A, _e, _, T, le, te, c, d, Ke, ot, Ie, At]), Vn = Ae(() => kt.left === 0 ? null : Ce(co, { linePoints: [0, 0, 0, Ke + 1], bounds: { x: kt.left, y: 0, width: 1, height: Ke + 1 }, ...ve }), [it, kt.left, Ke, ve]), Wn = Ae(() => kt.top === 0 ? null : Ce(co, { linePoints: [0, 0, Ge + 1, 0], bounds: { x: 0, y: kt.top, width: Ge + 1, height: 1 }, ...W }), [it, kt.top, Ge, W]), pn = Ae(() => {
1626
+ }, In = Ae(() => A === !0 || A?.horizontal === !0 ? xn(!0) : null, [it, A, Me, Z, P, ne, Q, c, d, Ge, zt, Ie, At]), En = Ae(() => A === !0 || A?.vertical === !0 ? xn(!1) : null, [it, A, _e, Z, P, ne, _, c, d, Ke, ot, Ie, At]), Vn = Ae(() => kt.left === 0 ? null : Ce(co, { linePoints: [0, 0, 0, Ke + 1], bounds: { x: kt.left, y: 0, width: 1, height: Ke + 1 }, ...ve }), [it, kt.left, Ke, ve]), Wn = Ae(() => kt.top === 0 ? null : Ce(co, { linePoints: [0, 0, Ge + 1, 0], bounds: { x: 0, y: kt.top, width: Ge + 1, height: 1 }, ...W }), [it, kt.top, Ge, W]), pn = Ae(() => {
1627
1627
  const h = [], m = (S) => {
1628
1628
  if (!S || !Ie[S]) return;
1629
1629
  const y = Ie[S].getBounds();
@@ -1633,22 +1633,22 @@ const so = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, Jo = Object.freeze({ top
1633
1633
  return Ce(_n, { children: h });
1634
1634
  }, [Ie, In, En, At]), Un = Ae(() => {
1635
1635
  if (!n) return;
1636
- const h = (re, fe, U, Ee) => {
1636
+ const h = (le, fe, U, Ee) => {
1637
1637
  if (!Ee || Ee.length === 0) return;
1638
1638
  const qe = [], $e = Ee.length;
1639
1639
  for (let Ze = 0; Ze < $e; Ze++) {
1640
1640
  const Te = Ee[Ze];
1641
- let ae = re?.get(Te);
1641
+ let ae = le?.get(Te);
1642
1642
  ae !== qn && (ae = Te(U) ?? qn), fe.set(Te, ae), ae && ae !== qn && qe.push(ae);
1643
1643
  }
1644
1644
  return qe;
1645
- }, m = (re, fe, U) => {
1645
+ }, m = (le, fe, U) => {
1646
1646
  if (!U) return;
1647
1647
  const Ee = U.getBounds(), qe = U.getInsets(), $e = U.getAnchor();
1648
- return Qt("div", { className: rn("view", `view-${$e}`, so.view), style: { position: "absolute", pointerEvents: "none", left: Ee.x - qe.left, top: Ee.y - qe.top, width: Ee.width - (qe.left + qe.right), height: Ee.height - (qe.top + qe.bottom), clipPath: p ? "inset(-2px)" : "inset(0px)" }, children: [h(re, fe, U, ye), Fn?.[$e].overlays] }, `view:${$e}`);
1648
+ return Qt("div", { className: rn("view", `view-${$e}`, so.view), style: { position: "absolute", pointerEvents: "none", left: Ee.x - qe.left, top: Ee.y - qe.top, width: Ee.width - (qe.left + qe.right), height: Ee.height - (qe.top + qe.bottom), clipPath: p ? "inset(-2px)" : "inset(0px)" }, children: [h(le, fe, U, ye), Fn?.[$e].overlays] }, `view:${$e}`);
1649
1649
  }, C = ft.current, S = {}, y = [], z = Object.keys(Ie), xe = z.length;
1650
- for (let re = 0; re < xe; re++) {
1651
- const fe = z[re], U = C?.[fe], Ee = S[fe] = /* @__PURE__ */ new Map();
1650
+ for (let le = 0; le < xe; le++) {
1651
+ const fe = z[le], U = C?.[fe], Ee = S[fe] = /* @__PURE__ */ new Map();
1652
1652
  y.push(m(U, Ee, Ie[fe]));
1653
1653
  }
1654
1654
  return ft.current = S, y;
@@ -1658,7 +1658,7 @@ const so = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, Jo = Object.freeze({ top
1658
1658
  }, [Ge, Ke, pn, Ne, Xe]), Rn = se(!1);
1659
1659
  return It(() => {
1660
1660
  !Rn.current && At && (Rn.current = !0, we?.(on.current));
1661
- }, [At]), Qt("div", { className: rn("sheetxl-grid", so["sheetxl-grid"]), style: { overflow: "visible", cursor: Q, maxWidth: Ge, maxHeight: Ke, width: Ge, height: Ke, ...he }, ref: on, children: [Hn, Qt("div", { className: rn("sheetxl-overlays"), ref: lt, ...$, children: [Un, Vn, Wn] })] });
1661
+ }, [At]), Qt("div", { className: rn("sheetxl-grid", so["sheetxl-grid"]), style: { overflow: "visible", cursor: ee, maxWidth: Ge, maxHeight: Ke, width: Ge, height: Ke, ...he }, ref: on, children: [Hn, Qt("div", { className: rn("sheetxl-overlays"), ref: lt, ...$, children: [Un, Vn, Wn] })] });
1662
1662
  }));
1663
1663
  Co.displayName = "BaseGrid";
1664
1664
  var tr = function() {
@@ -1667,8 +1667,8 @@ const or = Io && window.ResizeObserver !== void 0 ? function() {
1667
1667
  var t = gt(null), n = t[0], o = t[1], r = gt(uo), c = r[0], d = r[1], i = Ae(function() {
1668
1668
  return new window.ResizeObserver(function(l) {
1669
1669
  if (l[0]) {
1670
- var w = l[0].contentRect, L = w.x, O = w.y, R = w.width, M = w.height, A = w.top, le = w.left, J = w.bottom, te = w.right;
1671
- d({ x: L, y: O, width: R, height: M, top: A, left: le, bottom: J, right: te });
1670
+ var w = l[0].contentRect, L = w.x, O = w.y, R = w.width, T = w.height, A = w.top, ne = w.left, Q = w.bottom, _ = w.right;
1671
+ d({ x: L, y: O, width: R, height: T, top: A, left: ne, bottom: Q, right: _ });
1672
1672
  }
1673
1673
  });
1674
1674
  }, []);
@@ -1685,22 +1685,22 @@ const or = Io && window.ResizeObserver !== void 0 ? function() {
1685
1685
  }));
1686
1686
  Eo.displayName = "Grid";
1687
1687
  const rr = Kt(tn((t, n) => {
1688
- const { showVerticalScrollbar: o, showHorizontalScrollbar: r, createHorizontalScrollbar: c, createVerticalScrollbar: d, createScrollCorner: i, viewport: l, onScrollViewport: w, style: L = {}, className: O, onScroll: R, ...M } = t, [A, le] = gt(null), J = se(null), te = se(null);
1689
- Dn(!l), Lo(n, () => te.current && J.current ? Object.assign(te.current, J.current) : null);
1690
- const ze = V((Q) => {
1691
- te.current?.scrollTo(Q), w?.(Q);
1688
+ const { showVerticalScrollbar: o, showHorizontalScrollbar: r, createHorizontalScrollbar: c, createVerticalScrollbar: d, createScrollCorner: i, viewport: l, onScrollViewport: w, style: L = {}, className: O, onScroll: R, ...T } = t, [A, ne] = gt(null), Q = se(null), _ = se(null);
1689
+ Dn(!l), Lo(n, () => _.current && Q.current ? Object.assign(_.current, Q.current) : null);
1690
+ const ze = V((ee) => {
1691
+ _.current?.scrollTo(ee), w?.(ee);
1692
1692
  }, []);
1693
- return Ce(Oo, { className: O, style: L, ref: J, showVerticalScrollbar: o, showHorizontalScrollbar: r, createHorizontalScrollbar: c, createVerticalScrollbar: d, createScrollCorner: i, viewport: A, onScrollViewport: ze, children: Ce(Eo, { style: { width: "100%", height: "100%" }, ...M, onViewportChange: (Q) => le(Q), ref: te }) });
1693
+ return Ce(Oo, { className: O, style: L, ref: Q, showVerticalScrollbar: o, showHorizontalScrollbar: r, createHorizontalScrollbar: c, createVerticalScrollbar: d, createScrollCorner: i, viewport: A, onScrollViewport: ze, children: Ce(Eo, { style: { width: "100%", height: "100%" }, ...T, onViewportChange: (ee) => ne(ee), ref: _ }) });
1694
1694
  }));
1695
1695
  rr.displayName = "ScrollableGrid";
1696
1696
  const ho = () => !1, lr = Kt((t) => {
1697
- const { index: n, value: o, zoom: r, zoomScale: c = 100, headerText: d = (ye) => `${ye}`, headerStyle: i, headerStyleSelect: l = i, headerStyleSelectAll: w = l, headerStyleHover: L = w, verticalPadding: O = 0, horizontalPadding: R = 0, isSelected: M = ho, isSelectedAll: A = ho, coords: le, bounds: J, range: te, orientation: ze, view: Q, style: T, ..._ } = t, ve = c / 100, W = se(null), [me, Ve] = gt(!1), ke = M?.(n) || !1, We = A?.(n) ? w : ke ? l : i;
1697
+ const { index: n, value: o, zoom: r, zoomScale: c = 100, headerText: d = (ye) => `${ye}`, headerStyle: i, headerStyleSelect: l = i, headerStyleSelectAll: w = l, headerStyleHover: L = w, verticalPadding: O = 0, horizontalPadding: R = 0, isSelected: T = ho, isSelectedAll: A = ho, coords: ne, bounds: Q, range: _, orientation: ze, view: ee, style: P, ...Z } = t, ve = c / 100, W = se(null), [me, Ve] = gt(!1), ke = T?.(n) || !1, We = A?.(n) ? w : ke ? l : i;
1698
1698
  let ue = We;
1699
1699
  if (me) {
1700
1700
  let ye = L;
1701
1701
  typeof L == "function" && (ye = L(We)), ue = Nt.mergeContentful(We, ye);
1702
1702
  }
1703
- return Ce("div", { ref: W, style: { background: ue.fill, color: ue.text?.fill, fontFamily: ue.text?.fontFamily ?? i.text?.fontFamily, fontSize: 96 * (ue.text?.fontSize ?? 11) / 72 * ve, fontStyle: ue.text?.fontStyle, fontWeight: ue.text?.fontWeight, lineHeight: 1.2, display: "flex", justifyContent: "center", alignItems: "end", pointerEvents: "auto", paddingBottom: `${ve}px`, ...T, left: T.left - (ze === Ht.Column ? 1 : 0), top: T.top - (ze === Ht.Row ? 1 : 0), width: T.width + 1, height: T.height + 1, overflow: "hidden" }, ..._, onMouseMove: (ye) => {
1703
+ return Ce("div", { ref: W, style: { background: ue.fill, color: ue.text?.fill, fontFamily: ue.text?.fontFamily ?? i.text?.fontFamily, fontSize: 96 * (ue.text?.fontSize ?? 11) / 72 * ve, fontStyle: ue.text?.fontStyle, fontWeight: ue.text?.fontWeight, lineHeight: 1.2, display: "flex", justifyContent: "center", alignItems: "end", pointerEvents: "auto", paddingBottom: `${ve}px`, ...P, left: P.left - (ze === Ht.Column ? 1 : 0), top: P.top - (ze === Ht.Row ? 1 : 0), width: P.width + 1, height: P.height + 1, overflow: "hidden" }, ...Z, onMouseMove: (ye) => {
1704
1704
  X.detectIt().primaryInput !== "touch" && ye.buttons === 0 && Ve(!0);
1705
1705
  }, onMouseOut: (ye) => {
1706
1706
  Ve(!1);
@@ -1708,42 +1708,42 @@ const ho = () => !1, lr = Kt((t) => {
1708
1708
  });
1709
1709
  lr.displayName = "HeaderRenderer";
1710
1710
  const Ro = "ew-resize", Mo = "ns-resize", ir = Kt(tn((t, n) => {
1711
- const { orientation: o, view: r, index: c, className: d, style: i, disabled: l = !1, disabledResize: w = !1, isNextHidden: L, isHidden: O, isSelected: R, isSelectedAll: M, showTouchDivider: A, headerStyle: le, headerStyleSelect: J, headerStyleSelectAll: te, headerStyleHover: ze, bounds: Q, onPointerDown: T, onAutoFit: _, ...ve } = t, W = o === Ht.Column;
1712
- let me = le;
1713
- R && J && (me = J), M && te && (me = te);
1711
+ const { orientation: o, view: r, index: c, className: d, style: i, disabled: l = !1, disabledResize: w = !1, isNextHidden: L, isHidden: O, isSelected: R, isSelectedAll: T, showTouchDivider: A, headerStyle: ne, headerStyleSelect: Q, headerStyleSelectAll: _, headerStyleHover: ze, bounds: ee, onPointerDown: P, onAutoFit: Z, ...ve } = t, W = o === Ht.Column;
1712
+ let me = ne;
1713
+ R && Q && (me = Q), T && _ && (me = _);
1714
1714
  const Ve = X.detectIt().primaryInput === "touch";
1715
1715
  let ke = W ? 14 : 8, We = ke / 2, ue = 0;
1716
1716
  L && (ue = -2), O && (ue = 2), O && (ke = ke / 2 + ue, We = 2 * ue);
1717
1717
  let ye = me.dividerStrokeFill ?? me.strokeFill;
1718
- return !(R || M) && ue === 0 && (ye = `linear-gradient(${W ? 180 : 90}deg, ${me.fill}, ${ye} 55%, ${ye} 100%)`), Qt("div", { className: rn("header-divider", { disabled: l }, d, `index-${c}`), ref: n, onPointerDown: Ve ? void 0 : T, onDoubleClick: Ve ? void 0 : () => _?.(), style: { top: (W ? 0 : -ke / 2 + (ue - 1)) + "px", left: (W ? -ke / 2 + (ue - 1) : 0) + "px", width: W ? ke : "calc(100% + 1px)", height: W ? "calc(100% + 1px)" : ke, position: "absolute", overflow: "visible", pointerEvents: "all", cursor: l || w || Ve ? void 0 : W ? Ro : Mo, ...i }, ...ve, children: [Ce("div", { style: { position: "relative", top: `${W ? 0 : We}px`, left: `${W ? We : 0}px`, width: W ? 1 : "100%", height: W ? "100%" : 1, background: ye }, onDoubleClick: () => _?.() }), A && Ve ? Ce("div", { style: { position: "absolute", cursor: "grab", zIndex: 1, borderRadius: "4px", right: W ? "-6px" : "2px", bottom: W ? "2px" : "-9px", height: "24px", width: W ? "24px" : "18px", maxHeight: W ? "calc(100% - 4px)" : void 0, maxWidth: W ? void 0 : "calc(100% - 4px)", background: me.fill, border: `${te.edgeStrokeFill} solid 1px`, boxShadow: `0.5px 0.5px 0px 0px ${le.text.fill}`, display: "flex", alignItems: "center", justifyContent: "center" }, onPointerDown: T, children: Ce("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(J.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: W ? void 0 : "rotate(90deg)" } }) }) : null] });
1718
+ return !(R || T) && ue === 0 && (ye = `linear-gradient(${W ? 180 : 90}deg, ${me.fill}, ${ye} 55%, ${ye} 100%)`), Qt("div", { className: rn("header-divider", { disabled: l }, d, `index-${c}`), ref: n, onPointerDown: Ve ? void 0 : P, onDoubleClick: Ve ? void 0 : () => Z?.(), style: { top: (W ? 0 : -ke / 2 + (ue - 1)) + "px", left: (W ? -ke / 2 + (ue - 1) : 0) + "px", width: W ? ke : "calc(100% + 1px)", height: W ? "calc(100% + 1px)" : ke, position: "absolute", overflow: "visible", pointerEvents: "all", cursor: l || w || Ve ? void 0 : W ? Ro : Mo, ...i }, ...ve, children: [Ce("div", { style: { position: "relative", top: `${W ? 0 : We}px`, left: `${W ? We : 0}px`, width: W ? 1 : "100%", height: W ? "100%" : 1, background: ye }, onDoubleClick: () => Z?.() }), A && Ve ? Ce("div", { style: { position: "absolute", cursor: "grab", zIndex: 1, borderRadius: "4px", right: W ? "-6px" : "2px", bottom: W ? "2px" : "-9px", height: "24px", width: W ? "24px" : "18px", maxHeight: W ? "calc(100% - 4px)" : void 0, maxWidth: W ? void 0 : "calc(100% - 4px)", background: me.fill, border: `${_.edgeStrokeFill} solid 1px`, boxShadow: `0.5px 0.5px 0px 0px ${ne.text.fill}`, display: "flex", alignItems: "center", justifyContent: "center" }, onPointerDown: P, children: Ce("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(Q.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: W ? void 0 : "rotate(90deg)" } }) }) : null] });
1719
1719
  })), cr = (t, n) => Ce(ir, { ...t, ref: n }), Sr = Kt(tn((t, n) => {
1720
- const { orientation: o, view: r, index: c, disabled: d = !1, disabledResize: i = !1, resizeThreshold: l = 1, dividerRenderer: w = cr, onDividerMouseDown: L, onDividerResizeStart: O, onDividerResize: R, onDividerResizeEnd: M, onDividerMouseUp: A, onDividerAutoFit: le, onPointerDown: J, ...te } = t, ze = P(J, [J]), Q = P(le, [le]), T = o === Ht.Column;
1721
- let _ = T ? r.getVisibleColumns() : r.getVisibleRows(), ve = null;
1722
- _.length > 0 && (T ? ve = r.getRangeCoordsBounds({ rowStart: 0, rowEnd: 0, colStart: _[0], colEnd: _[_.length - 1] }) : r.getRangeCoordsBounds({ rowStart: _[0], rowEnd: _[_.length - 1], colStart: 0, colEnd: 0 }), ve = r.toClipBounds(ve, Vt));
1723
- const W = se(null), [me, Ve] = gt(null), ke = (Z, be) => T ? Z.clientX - be.clientX : Z.clientY - be.clientY, We = r.getLayout(), ue = T ? We.getColOffset(c + 1) : We.getRowOffset(c + 1), ye = un({ processTouch: !0, onPointerDown: (Z) => {
1724
- if (ze?.(Z), !d && !i) {
1725
- const be = T ? We.getColOffset(c) : We.getRowOffset(c), Y = ue - be;
1726
- W.current = { isResizing: !1, startSize: Y, index: c, view: r, orientation: o, onDividerMouseDown: L, onDividerResizeStart: O, onDividerResize: R, onDividerResizeEnd: M, onDividerMouseUp: A }, Ve(W.current), L?.(c, Y);
1720
+ const { orientation: o, view: r, index: c, disabled: d = !1, disabledResize: i = !1, resizeThreshold: l = 1, dividerRenderer: w = cr, onDividerMouseDown: L, onDividerResizeStart: O, onDividerResize: R, onDividerResizeEnd: T, onDividerMouseUp: A, onDividerAutoFit: ne, onPointerDown: Q, ..._ } = t, ze = k(Q, [Q]), ee = k(ne, [ne]), P = o === Ht.Column;
1721
+ let Z = P ? r.getVisibleColumns() : r.getVisibleRows(), ve = null;
1722
+ Z.length > 0 && (P ? ve = r.getRangeCoordsBounds({ rowStart: 0, rowEnd: 0, colStart: Z[0], colEnd: Z[Z.length - 1] }) : r.getRangeCoordsBounds({ rowStart: Z[0], rowEnd: Z[Z.length - 1], colStart: 0, colEnd: 0 }), ve = r.toClipBounds(ve, Vt));
1723
+ const W = se(null), [me, Ve] = gt(null), ke = (J, be) => P ? J.clientX - be.clientX : J.clientY - be.clientY, We = r.getLayout(), ue = P ? We.getColOffset(c + 1) : We.getRowOffset(c + 1), ye = un({ processTouch: !0, onPointerDown: (J) => {
1724
+ if (ze?.(J), !d && !i) {
1725
+ const be = P ? We.getColOffset(c) : We.getRowOffset(c), Y = ue - be;
1726
+ W.current = { isResizing: !1, startSize: Y, index: c, view: r, orientation: o, onDividerMouseDown: L, onDividerResizeStart: O, onDividerResize: R, onDividerResizeEnd: T, onDividerMouseUp: A }, Ve(W.current), L?.(c, Y);
1727
1727
  }
1728
- Z.stopPropagation(), Z.preventDefault();
1729
- }, onPointerUp: (Z, be, Y) => {
1728
+ J.stopPropagation(), J.preventDefault();
1729
+ }, onPointerUp: (J, be, Y) => {
1730
1730
  if (!W.current) return;
1731
- W.current.isResizing && W.current.onDividerResizeEnd?.(W.current.index, Math.max(0, W.current.startSize + ke(Z, Y)), W.current.startSize);
1731
+ W.current.isResizing && W.current.onDividerResizeEnd?.(W.current.index, Math.max(0, W.current.startSize + ke(J, Y)), W.current.startSize);
1732
1732
  const D = W.current;
1733
1733
  W.current = null, Ve(W.current), D.onDividerMouseUp?.(D.index);
1734
- }, onPointerMoveOrWait: (Z, be, Y) => {
1734
+ }, onPointerMoveOrWait: (J, be, Y) => {
1735
1735
  if (!W.current) return;
1736
- const D = ke(Z, Y);
1737
- W.current.isResizing ? W.current.onDividerResize?.(W.current.index, Math.max(0, W.current.startSize + D), W.current.startSize) : Math.abs(D) > Math.max(1, l) && (W.current = { ...W.current, isResizing: !0 }, Ve(W.current), W.current.onDividerResizeStart?.(W.current.index, Math.max(0, W.current.startSize + D))), Z.stopPropagation(), Z.preventDefault();
1738
- } }), $ = P(() => {
1739
- Q?.(c);
1736
+ const D = ke(J, Y);
1737
+ W.current.isResizing ? W.current.onDividerResize?.(W.current.index, Math.max(0, W.current.startSize + D), W.current.startSize) : Math.abs(D) > Math.max(1, l) && (W.current = { ...W.current, isResizing: !0 }, Ve(W.current), W.current.onDividerResizeStart?.(W.current.index, Math.max(0, W.current.startSize + D))), J.stopPropagation(), J.preventDefault();
1738
+ } }), $ = k(() => {
1739
+ ee?.(c);
1740
1740
  }, [c]);
1741
1741
  if (!ve) return;
1742
- const p = w({ bounds: ve, orientation: o, view: r, index: c, disabled: d, disabledResize: i, onAutoFit: $, onPointerDown: ye, ...te }, n);
1742
+ const p = w({ bounds: ve, orientation: o, view: r, index: c, disabled: d, disabledResize: i, onAutoFit: $, onPointerDown: ye, ..._ }, n);
1743
1743
  if (!p) return;
1744
1744
  const { getPortalContainer: Ne } = fo();
1745
1745
  let Xe = null;
1746
- return me && me.isResizing && me.index === c && (Xe = xo(Ce("div", { style: { position: "absolute", cursor: T ? Ro : Mo, left: 0, top: 0, width: "100%", height: "100%" } }), Ne(), "divider:" + c)), Qt(_n, { children: [Xe, Ce("div", { className: rn("header-divider-anchor"), style: { position: "absolute", pointerEvents: "auto", top: `${T ? ve.y : ue}px`, left: `${T ? ue : ve.x}px`, width: (T ? 0 : ve.width - 1) + "px", height: (T ? ve.height - 1 : 0) + "px", display: "flex" }, tabIndex: -1, children: p })] });
1746
+ return me && me.isResizing && me.index === c && (Xe = xo(Ce("div", { style: { position: "absolute", cursor: P ? Ro : Mo, left: 0, top: 0, width: "100%", height: "100%" } }), Ne(), "divider:" + c)), Qt(_n, { children: [Xe, Ce("div", { className: rn("header-divider-anchor"), style: { position: "absolute", pointerEvents: "auto", top: `${P ? ve.y : ue}px`, left: `${P ? ue : ve.x}px`, width: (P ? 0 : ve.width - 1) + "px", height: (P ? ve.height - 1 : 0) + "px", display: "flex" }, tabIndex: -1, children: p })] });
1747
1747
  }));
1748
1748
  class sr {
1749
1749
  naturalDimensions(n, o = {}) {
@@ -1764,82 +1764,82 @@ class sr {
1764
1764
  }
1765
1765
  }
1766
1766
  const ar = (t = void 0) => Object.freeze({ clean: t, dirty: void 0, editMode: !1 }), dr = ar(), yr = Kt(tn((t, n) => {
1767
- const { editState: o = dr, defaultTextStyle: r, onStartEdit: c, onChangeEdit: d, onSubmitEdit: i, onCancelEdit: l, onDoneEdit: w, containerBounds: L, setNaturalSize: O, onNavigate: R, textProperties: M, style: A, autoFocus: le, ...J } = t, te = se(null), { width: ze = 0 } = L ?? {}, [Q, T] = gt(() => o);
1767
+ const { editState: o = dr, defaultTextStyle: r, onStartEdit: c, onChangeEdit: d, onSubmitEdit: i, onCancelEdit: l, onDoneEdit: w, containerBounds: L, setNaturalSize: O, onNavigate: R, textProperties: T, style: A, autoFocus: ne, ...Q } = t, _ = se(null), { width: ze = 0 } = L ?? {}, [ee, P] = gt(() => o);
1768
1768
  It(() => {
1769
- T(o);
1769
+ P(o);
1770
1770
  }, [o]);
1771
- const _ = M?.align || "left", ve = M?.vAlign || "middle", W = M?.fill || "#040404", me = M?.wrap || "wrap", Ve = M?.fontFamily || "Calibri", ke = M?.fontSize || 11, We = M?.fontWeight || 400, ue = M?.fontStyle || "normal", ye = Q.dirty ?? Q.clean ?? "";
1771
+ const Z = T?.align || "left", ve = T?.vAlign || "middle", W = T?.fill || "#040404", me = T?.wrap || "wrap", Ve = T?.fontFamily || "Calibri", ke = T?.fontSize || 11, We = T?.fontWeight || 400, ue = T?.fontStyle || "normal", ye = ee.dirty ?? ee.clean ?? "";
1772
1772
  let $ = 2;
1773
1773
  const p = 96 * ke / 72, Ne = 1.2 * p;
1774
1774
  ve === "right" && ($ += 1);
1775
- const Xe = Ae(() => new sr().naturalDimensions(ye, { maxWidth: me === "wrap" ? ze - $ : void 0, lineHeight: `${Ne}px`, paintableText: { fontStyle: ue, wrap: me, letterSpacing: -0.25 } }), [ye, me, $, p, Ve, We, ue, O, ze]), Z = V(() => Xe.maxLineHeight ? Xe.maxLineHeight + "px" : "1.2", [Xe]), [be, Y] = gt(Z);
1775
+ const Xe = Ae(() => new sr().naturalDimensions(ye, { maxWidth: me === "wrap" ? ze - $ : void 0, lineHeight: `${Ne}px`, paintableText: { fontStyle: ue, wrap: me, letterSpacing: -0.25 } }), [ye, me, $, p, Ve, We, ue, O, ze]), J = V(() => Xe.maxLineHeight ? Xe.maxLineHeight + "px" : "1.2", [Xe]), [be, Y] = gt(J);
1776
1776
  en(() => {
1777
- Y(Z());
1777
+ Y(J());
1778
1778
  }, [L, Xe]), en(() => {
1779
1779
  O?.({ width: me === "wrap" ? void 0 : Xe.width + $, height: Xe.height });
1780
1780
  }, [Xe, O]);
1781
- const D = P(d, [d]), q = P((b) => {
1782
- if (Q.dirty === b) return;
1783
- const Re = { ...Q };
1784
- Re.dirty = b, te.current, T(Re), D?.(Re);
1785
- }, [Q]), Pt = P((b) => {
1786
- if (Q.editMode === b) return;
1787
- const Re = { ...Q };
1788
- Re.editMode = b, T(Re), D?.(Re);
1789
- }, [Q]), Et = P(() => {
1781
+ const D = k(d, [d]), q = k((b) => {
1782
+ if (ee.dirty === b) return;
1783
+ const Re = { ...ee };
1784
+ Re.dirty = b, _.current, P(Re), D?.(Re);
1785
+ }, [ee]), Pt = k((b) => {
1786
+ if (ee.editMode === b) return;
1787
+ const Re = { ...ee };
1788
+ Re.editMode = b, P(Re), D?.(Re);
1789
+ }, [ee]), Et = k(() => {
1790
1790
  try {
1791
- return i?.(Q), w?.(), !0;
1791
+ return i?.(ee), w?.(), !0;
1792
1792
  } catch {
1793
1793
  return !1;
1794
1794
  }
1795
- }, [i, Q]), wt = P(() => {
1796
- T(o), l?.(), w?.();
1797
- }, [l, o]), ut = P((b) => {
1798
- if (!te.current) return;
1795
+ }, [i, ee]), wt = k(() => {
1796
+ P(o), l?.(), w?.();
1797
+ }, [l, o]), ut = k((b) => {
1798
+ if (!_.current) return;
1799
1799
  if (b.isDefaultPrevented(), !(b.isTrusted || b.nativeEvent.ctrlKey || b.nativeEvent.metaKey || b.nativeEvent.altKey || b.nativeEvent.isComposing) && mo.indexOf(b.nativeEvent.key) !== -1) {
1800
- const ne = { ...Q };
1801
- return ne.dirty = b.nativeEvent.key === "Backspace" ? "" : (ne.dirty ?? "") + b.key, T(ne), D?.(ne), void b.preventDefault();
1800
+ const oe = { ...ee };
1801
+ return oe.dirty = b.nativeEvent.key === "Backspace" ? "" : (oe.dirty ?? "") + b.key, P(oe), D?.(oe), void b.preventDefault();
1802
1802
  }
1803
1803
  const Re = b.nativeEvent.shiftKey;
1804
1804
  if (b.which === Ot.Escape) return b.preventDefault(), void wt();
1805
1805
  if (b.which === Ot.F2) return Pt(!0), void b.preventDefault();
1806
1806
  if (b.which === Ot.Enter && (b.preventDefault(), Et() && R?.(Re ? g.Up : g.Down)), b.which === Ot.Tab) return b.preventDefault(), void (Et() && R?.(Re ? g.Left : g.Right));
1807
- if (!Q.editMode) {
1808
- let ne = null;
1807
+ if (!ee.editMode) {
1808
+ let oe = null;
1809
1809
  switch (b.which) {
1810
1810
  case Ot.Left:
1811
- ne = g.Left;
1811
+ oe = g.Left;
1812
1812
  break;
1813
1813
  case Ot.Right:
1814
- ne = g.Right;
1814
+ oe = g.Right;
1815
1815
  break;
1816
1816
  case Ot.Up:
1817
- ne = g.Up;
1817
+ oe = g.Up;
1818
1818
  break;
1819
1819
  case Ot.Down:
1820
- ne = g.Down;
1820
+ oe = g.Down;
1821
1821
  }
1822
- if (ne) return void Et();
1822
+ if (oe) return void Et();
1823
1823
  }
1824
- }, [Q, R]), [he, Wt] = gt(!le);
1824
+ }, [ee, R]), [he, Wt] = gt(!ne);
1825
1825
  It(() => {
1826
1826
  Wt(!1);
1827
1827
  }, []);
1828
- const k = go(n, () => ({ startEdit(b) {
1828
+ const M = go(n, () => ({ startEdit(b) {
1829
1829
  let Re = b?.initialSelection;
1830
1830
  if (!Re) {
1831
- const we = te.current.value.length ?? 0;
1831
+ const we = _.current.value.length ?? 0;
1832
1832
  Re = { start: we, end: we, direction: "forward" };
1833
1833
  }
1834
- te.current?.setSelectionRange(Re.start, Re.end, Re.direction);
1835
- const ne = { ...o, editMode: b?.editMode ?? !1 };
1836
- b?.text !== void 0 && (ne.dirty = b.text), ne.editMode === o.editMode && ne.dirty === o.dirty || (T(ne), D?.(ne));
1834
+ _.current?.setSelectionRange(Re.start, Re.end, Re.direction);
1835
+ const oe = { ...o, editMode: b?.editMode ?? !1 };
1836
+ b?.text !== void 0 && (oe.dirty = b.text), oe.editMode === o.editMode && oe.dirty === o.dirty || (P(oe), D?.(oe));
1837
1837
  }, submitEdit: () => Et(), cancelEdit() {
1838
1838
  wt();
1839
1839
  }, autoFocus() {
1840
- te.current?.focus();
1841
- }, getLineHeight: () => Xe?.maxLineHeight ?? Ne, dispatchEvent: (b) => te.current.dispatchEvent(b) }), [o, c]);
1842
- return Ce("div", { ref: k, ...J, style: { background: "transparent", display: "flex", flexGrow: 1, alignSelf: "center", height: Xe.height, maxWidth: "100%", maxHeight: "100%", ...A }, children: Ce("textarea", { spellCheck: "false", ref: te, value: ye, autoFocus: !1, disabled: he, name: "cell-editor", autoComplete: "off", autoCapitalize: "off", style: { flex: "1 1 100%", position: "relative", fontSize: `${p}px`, fontFamily: `${Ve}`, fontWeight: `${We}`, fontStyle: `${ue}`, padding: "0px", marginRight: _ === "right" ? "3px" : "0px", marginLeft: _ === "left" ? "2px" : "0px", lineHeight: be, height: Xe.height, textRendering: "geometricPrecision", letterSpacing: "-0.25px", boxSizing: "border-box", borderWidth: 0, outline: "none", resize: "none", overflow: "hidden", verticalAlign: "baseline", textAlign: _, background: "transparent", color: W, marginBottom: "0px", userSelect: "text", maxHeight: "100%", whiteSpace: me === "wrap" ? "break-spaces" : "pre", wordWrap: "break-word" }, onChange: (b) => {
1840
+ _.current?.focus();
1841
+ }, getLineHeight: () => Xe?.maxLineHeight ?? Ne, dispatchEvent: (b) => _.current.dispatchEvent(b) }), [o, c]);
1842
+ return Ce("div", { ref: M, ...Q, style: { background: "transparent", display: "flex", flexGrow: 1, alignSelf: "center", height: Xe.height, maxWidth: "100%", maxHeight: "100%", ...A }, children: Ce("textarea", { spellCheck: "false", ref: _, value: ye, autoFocus: !1, disabled: he, name: "cell-editor", autoComplete: "off", autoCapitalize: "off", style: { flex: "1 1 100%", position: "relative", fontSize: `${p}px`, fontFamily: `${Ve}`, fontWeight: `${We}`, fontStyle: `${ue}`, padding: "0px", marginRight: Z === "right" ? "3px" : "0px", marginLeft: Z === "left" ? "2px" : "0px", lineHeight: be, height: Xe.height, textRendering: "geometricPrecision", letterSpacing: "-0.25px", boxSizing: "border-box", borderWidth: 0, outline: "none", resize: "none", overflow: "hidden", verticalAlign: "baseline", textAlign: Z, background: "transparent", color: W, marginBottom: "0px", userSelect: "text", maxHeight: "100%", whiteSpace: me === "wrap" ? "break-spaces" : "pre", wordWrap: "break-word" }, onChange: (b) => {
1843
1843
  q(b.target.value);
1844
1844
  }, onDoubleClick: (b) => {
1845
1845
  b.isTrusted;