@sheetxl/grid-react 0.4.22 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license @sheetxl/grid-react - Grid React - Advanced grid component for React - v0.4.22
2
+ * @license @sheetxl/grid-react - Grid React - Advanced grid component for React - v0.5.1
3
3
  *
4
4
  * (C) 2025-present SheetXL Inc. & Michael T. Ford
5
5
  * License: The license can be found at https://www.sheetxl.com/license.
@@ -34,18 +34,18 @@ const B = ({ itemType: e2, index: t2, itemSize: n2, instanceProps: o2, scale: r2
34
34
  let i2, c2;
35
35
  "column" === e2 ? (i2 = o2.columnMetadataMap, c2 = o2.lastMeasuredColumnIndex) : (i2 = o2.rowMetadataMap, c2 = o2.lastMeasuredRowIndex);
36
36
  let s2 = 0;
37
- return s2 = (c2 > 0 ? i2[c2].offset : 0) >= r2 ? W({ itemType: e2, itemSize: t2, instanceProps: o2, high: c2, low: 0, offset: r2, scale: l2 }) : A({ itemType: e2, itemSize: t2, itemCount: n2, instanceProps: o2, index: Math.max(0, c2), offset: r2, scale: l2 }), s2 = Math.min(s2, n2), s2;
38
- }, W = ({ itemType: e2, itemSize: t2, instanceProps: n2, high: o2, low: r2, offset: l2, scale: i2 }) => {
37
+ return s2 = (c2 > 0 ? i2[c2].offset : 0) >= r2 ? A({ itemType: e2, itemSize: t2, instanceProps: o2, high: c2, low: 0, offset: r2, scale: l2 }) : W({ itemType: e2, itemSize: t2, itemCount: n2, instanceProps: o2, index: Math.max(0, c2), offset: r2, scale: l2 }), s2 = Math.min(s2, n2), s2;
38
+ }, A = ({ itemType: e2, itemSize: t2, instanceProps: n2, high: o2, low: r2, offset: l2, scale: i2 }) => {
39
39
  for (; r2 <= o2; ) {
40
40
  const c2 = r2 + Math.floor((o2 - r2) / 2), s2 = B({ itemType: e2, itemSize: t2, index: c2, instanceProps: n2, scale: i2 }).offset;
41
41
  if (s2 === l2) return c2;
42
42
  s2 < l2 ? r2 = c2 + 1 : s2 > l2 && (o2 = c2 - 1);
43
43
  }
44
44
  return r2 > 0 ? r2 - 1 : 0;
45
- }, A = ({ itemType: e2, itemSize: t2, itemCount: n2, instanceProps: o2, index: r2, offset: l2, scale: i2 }) => {
45
+ }, W = ({ itemType: e2, itemSize: t2, itemCount: n2, instanceProps: o2, index: r2, offset: l2, scale: i2 }) => {
46
46
  let c2 = 1;
47
47
  for (; r2 < n2 && B({ itemType: e2, itemSize: t2, index: r2, instanceProps: o2, scale: i2 }).offset < l2; ) r2 += c2, c2 *= 2;
48
- return W({ itemType: e2, itemSize: t2, instanceProps: o2, high: Math.min(r2, n2 - 1), low: Math.floor(r2 / 2), offset: l2, scale: i2 });
48
+ return A({ itemType: e2, itemSize: t2, instanceProps: o2, high: Math.min(r2, n2 - 1), low: Math.floor(r2 / 2), offset: l2, scale: i2 });
49
49
  }, V = (e2) => {
50
50
  const { rowCount: t2, columnCount: n2, defaultRowHeight: r2, getRowHeight: l2, defaultColumnWidth: i2, getColumnWidth: c2 } = e2 || {}, s2 = w({ columnMetadataMap: {}, rowMetadataMap: {}, lastMeasuredColumnIndex: -1, lastMeasuredRowIndex: -1, recalcColumnIndices: [], recalcRowIndices: [] }), a2 = o((e3) => F({ itemType: "row", itemCount: t2, itemSize: l2 ?? (() => r2 ?? 20), instanceProps: s2.current, offset: e3 }), [t2, l2, r2]), d2 = o((e3) => -1 === e3 ? 0 : B({ itemType: "row", index: e3, itemSize: l2 ?? (() => r2 ?? 20), instanceProps: s2.current }).offset, [l2, r2]), u2 = o((e3) => B({ itemType: "row", index: e3, itemSize: l2 ?? (() => r2 ?? 20), instanceProps: s2.current }).size, [l2, r2]), h2 = o((e3) => F({ itemType: "column", itemCount: n2, itemSize: c2 ?? (() => i2 ?? 75), instanceProps: s2.current, offset: e3 }), [n2, c2, i2]), g2 = o((e3) => -1 === e3 ? 0 : B({ itemType: "column", index: e3, itemSize: c2 ?? (() => i2 ?? 75), instanceProps: s2.current }).offset, [c2, i2]), f2 = o((e3) => B({ itemType: "column", index: e3, itemSize: c2 ?? (() => i2 ?? 75), instanceProps: s2.current }).size, [c2, i2]), [v2, S2] = x((e3) => e3 + 1, 0), y2 = () => ({ getRowOffset: d2, getColOffset: g2, getRowIndex: a2, getColIndex: h2 }), [b2, C2] = p(() => e2 ? y2() : null);
51
51
  return m(() => {
@@ -113,9 +113,9 @@ const B = ({ itemType: e2, index: t2, itemSize: n2, instanceProps: o2, scale: r2
113
113
  n2?.getStage()?.focus();
114
114
  }, [n2]), B2 = w(null), F2 = o((e2) => {
115
115
  s2?.(e2), Q2(), D2(true), B2.current = null;
116
- }, [s2]), W2 = o((e2) => {
116
+ }, [s2]), A2 = o((e2) => {
117
117
  a2?.(e2.coords);
118
- }, [a2]), A2 = o((e2) => {
118
+ }, [a2]), W2 = o((e2) => {
119
119
  e2.isSubmitted || e2.isCancelled || (X2.current.isEditorClosed = true, $2(), e2.isCancelled = true, u2?.(e2.coords), Q2());
120
120
  }, [u2]), V2 = o((e2) => {
121
121
  if (e2.isSubmitted || e2.isCancelled) return false;
@@ -240,7 +240,7 @@ const B = ({ itemType: e2, index: t2, itemSize: n2, instanceProps: o2, scale: r2
240
240
  } else if ("cancel" === t3.eventType) {
241
241
  if (X2.current && !X2.current.isSubmitted && !X2.current.isCancelled) {
242
242
  if (!X2.current.isMounted) return;
243
- A2(X2.current);
243
+ W2(X2.current);
244
244
  }
245
245
  } else if ("coordsChange" === t3.eventType) {
246
246
  const e3 = t3;
@@ -253,7 +253,7 @@ const B = ({ itemType: e2, index: t2, itemSize: n2, instanceProps: o2, scale: r2
253
253
  }
254
254
  }
255
255
  }
256
- Z2.current.length > 0 && (Z2.current.shift(), Q2()), 0 === Z2.current.length && (!X2.current || X2.current.isEditorClosing || X2.current.isEditorClosed ? !X2.current && o2 && $2() : X2.current.isMounted && !X2.current.isStarted && (X2.current.isStarted = true, X2.current.startEvent.autoFocus && ("string" == typeof X2.current.startEvent.autoFocus ? X2.current.editorRefs[0]?.autoFocus(X2.current.startEvent.autoFocus) : X2.current.editorRefs[0]?.autoFocus()), W2?.(X2.current), requestAnimationFrame(() => {
256
+ Z2.current.length > 0 && (Z2.current.shift(), Q2()), 0 === Z2.current.length && (!X2.current || X2.current.isEditorClosing || X2.current.isEditorClosed ? !X2.current && o2 && $2() : X2.current.isMounted && !X2.current.isStarted && (X2.current.isStarted = true, X2.current.startEvent.autoFocus && ("string" == typeof X2.current.startEvent.autoFocus ? X2.current.editorRefs[0]?.autoFocus(X2.current.startEvent.autoFocus) : X2.current.editorRefs[0]?.autoFocus()), A2?.(X2.current), requestAnimationFrame(() => {
257
257
  n2 && X2.current?.coords && n2.scrollCellCoordsIntoView(X2.current.coords);
258
258
  })));
259
259
  }, [_2]), m(() => {
@@ -273,7 +273,7 @@ const B = ({ itemType: e2, index: t2, itemSize: n2, instanceProps: o2, scale: r2
273
273
  let n3 = z2(t3, X2.current.coords, re2, le2, I2, R2), o2 = true;
274
274
  n3 && 0 !== n3.width && 0 !== n3.height || (n3 = { x: 0, y: 0, width: re2, height: re2 }, o2 = false);
275
275
  const r2 = t3.getZoom(), l2 = { containerBounds: { x: 0, y: 0, width: n3.width / r2, height: n3.height / r2 }, setNaturalDimensions: O2, zoom: r2 };
276
- return e(j, { session: X2.current, refLatestCoords: G2, handleSubmitEdit: V2, handleCancelEdit: A2, cellBounds: n3, borderStrokeWidth: C2, borderStrokeFill: b2, isInBounds: o2, getCellEditor: ie2, propsEditor: l2, alignment: R2, ...y2 }, "editor:" + X2.current.uuid);
276
+ return e(j, { session: X2.current, refLatestCoords: G2, handleSubmitEdit: V2, handleCancelEdit: W2, cellBounds: n3, borderStrokeWidth: C2, borderStrokeFill: b2, isInBounds: o2, getCellEditor: ie2, propsEditor: l2, alignment: R2, ...y2 }, "editor:" + X2.current.uuid);
277
277
  }, [c2, I2, _2, re2, le2, R2, C2, b2]), startEdit: v((e2) => {
278
278
  Q2({ eventType: "start", startEvent: e2 });
279
279
  }, []), submitEdit: v(() => {
@@ -281,7 +281,39 @@ const B = ({ itemType: e2, index: t2, itemSize: n2, instanceProps: o2, scale: r2
281
281
  }, []), cancelEdit: v(() => {
282
282
  Q2({ eventType: "cancel" });
283
283
  }, []), onKeyboardEvent: oe2, onPointerEvent: te2, onKeyboardEventNative: ne2, onPointerEventNative: ee2, isEditing: M2 };
284
- }, Y = ({ gridRef: e2, gridMainRef: t2, orientation: n2 = D.Row, headerCount: r2, selectionPolicy: l2 = "multiple", newSelectionMode: i2 = "clear", alwaysScrollToActiveCoords: a2 = true, onDragStart: d2, onDragEnd: u2, pointerDownInterceptor: h2, pointerMoveInterceptor: g2, onPointerUp: f2, newSelection: x2, modifySelection: p2, appendSelection: m2, clearSelections: S2 }) => {
284
+ }, Y = 3, G = 0.1, Z = 50, _ = (e2) => ({ x: e2.x, y: e2.y, width: e2.width, height: e2.height, top: e2.top, left: e2.left, right: e2.right, bottom: e2.bottom });
285
+ function J(e2 = {}) {
286
+ const { threshold: t2 = G, stillnessThreshold: n2 = Y, maxHierarchyDepth: o2 = Z } = e2, [r2, l2] = z(), i2 = w(null), [c2, s2] = x((e3) => e3 + 1, 0), a2 = w(void 0), d2 = w({ x: 0, y: 0, width: 0, height: 0, top: 0, left: 0, right: 0, bottom: 0 }), u2 = v((e3) => {
287
+ i2.current = e3, "function" == typeof r2 && r2(e3);
288
+ }, [r2]), [h2, g2] = p(l2);
289
+ return m(() => {
290
+ l2 && !h2 && g2(l2);
291
+ }, [l2, h2]), m(() => {
292
+ const e3 = i2.current;
293
+ if (!e3) return;
294
+ let r3 = false, l3 = 0;
295
+ const c3 = () => {
296
+ if (!e3) return;
297
+ const o3 = e3.getBoundingClientRect(), i3 = d2.current;
298
+ Math.abs(o3.x - i3.x) > t2 || Math.abs(o3.y - i3.y) > t2 || Math.abs(o3.width - i3.width) > t2 || Math.abs(o3.height - i3.height) > t2 ? (r3 || (r3 = true, g2(_(o3)), s2()), l3 = 0) : l3++, r3 && l3 >= n2 && (r3 = false, g2(_(o3)), s2()), d2.current = _(o3), a2.current = requestAnimationFrame(c3);
299
+ };
300
+ a2.current = requestAnimationFrame(c3);
301
+ const u3 = (e4) => {
302
+ r3 = true, s2();
303
+ }, h3 = (e4) => {
304
+ r3 = false, l3 = n2, s2();
305
+ };
306
+ let f2 = e3;
307
+ const w2 = [];
308
+ for (; f2 && f2 !== document.documentElement && (f2.addEventListener("animationstart", u3, true), f2.addEventListener("animationend", h3, true), f2.addEventListener("transitionstart", u3, true), f2.addEventListener("transitionend", h3, true), w2.push(f2), f2 = f2.parentElement, !(w2.length > o2)); ) ;
309
+ return () => {
310
+ a2.current && cancelAnimationFrame(a2.current), w2.forEach((e4) => {
311
+ e4.removeEventListener("animationstart", u3, true), e4.removeEventListener("animationend", h3, true), e4.removeEventListener("transitionstart", u3, true), e4.removeEventListener("transitionend", h3, true);
312
+ });
313
+ };
314
+ }, [c2, l2, t2, n2, o2]), [u2, h2];
315
+ }
316
+ const Q = ({ gridRef: e2, gridMainRef: t2, orientation: n2 = D.Row, headerCount: r2, selectionPolicy: l2 = "multiple", newSelectionMode: i2 = "clear", alwaysScrollToActiveCoords: a2 = true, onDragStart: d2, onDragEnd: u2, pointerDownInterceptor: h2, pointerMoveInterceptor: g2, onPointerUp: f2, newSelection: x2, modifySelection: p2, appendSelection: m2, clearSelections: S2 }) => {
285
317
  const b2 = r2 ?? ((n2 === D.Row ? e2.current?.rowCount : e2.current?.columnCount) || 0), C2 = w(null), I2 = w(null), E2 = w(false), R2 = w(null), M2 = v((e3) => n2 === D.Column ? { rowIndex: 0, colIndex: e3.colIndex } : { rowIndex: e3.rowIndex, colIndex: 0 }, [n2]), T2 = v((e3) => n2 === D.Column ? { rowIndex: t2.current ? t2.current.rowCount - 1 : 0, colIndex: e3.colIndex } : { rowIndex: e3.rowIndex, colIndex: t2.current ? t2.current.columnCount - 1 : 0 }, [n2]), O2 = (e3) => {
286
318
  I2.current = T2(e3), p2(I2.current, C2.current);
287
319
  }, z2 = v((o2, r3) => {
@@ -321,7 +353,7 @@ const B = ({ itemType: e2, index: t2, itemSize: n2, instanceProps: o2, scale: r2
321
353
  E2.current = false, $2?.(), f2?.(e3);
322
354
  }, processTouch: true, consumeTouch: true }), [l2, a2, b2, i2, S2, h2, f2]);
323
355
  return { onPointerDown: o(s(F2), []), getCellCoordsFromClient: z2 };
324
- }, G = (e2, t2, n2) => {
356
+ }, ee = (e2, t2, n2) => {
325
357
  if (!e2) return t2;
326
358
  let o2 = t2;
327
359
  const r2 = n2 === T.Right || n2 === T.Down;
@@ -330,7 +362,7 @@ const B = ({ itemType: e2, index: t2, itemSize: n2, instanceProps: o2, scale: r2
330
362
  if (0 === t3) return o2;
331
363
  r2 ? o2 += t3 : o2 -= t3;
332
364
  }
333
- }, Z = (e2, t2, n2) => {
365
+ }, te = (e2, t2, n2) => {
334
366
  const o2 = [];
335
367
  let r2 = t2;
336
368
  for (; r2 <= n2; ) {
@@ -338,75 +370,75 @@ const B = ({ itemType: e2, index: t2, itemSize: n2, instanceProps: o2, scale: r2
338
370
  0 === t3 ? (o2.push(r2), r2++) : r2 += t3;
339
371
  }
340
372
  return o2;
341
- }, _ = (e2, t2, n2, o2, r2, l2) => {
373
+ }, ne = (e2, t2, n2, o2, r2, l2) => {
342
374
  if (!t2) return l2;
343
375
  let { rowIndex: i2, colIndex: c2 } = e2;
344
376
  switch (o2) {
345
377
  case T.Down: {
346
- i2 = G(n2, Math.min(i2 + 1, l2), o2);
378
+ i2 = ee(n2, Math.min(i2 + 1, l2), o2);
347
379
  let e3 = t2({ rowIndex: i2, colIndex: c2 });
348
- for (; !e3 && i2 < l2; ) i2 = G(n2, Math.min(++i2, l2), o2), e3 = t2({ rowIndex: i2, colIndex: c2 });
380
+ for (; !e3 && i2 < l2; ) i2 = ee(n2, Math.min(++i2, l2), o2), e3 = t2({ rowIndex: i2, colIndex: c2 });
349
381
  return i2;
350
382
  }
351
383
  case T.Up: {
352
- i2 = G(n2, Math.max(i2 - 1, l2), o2);
384
+ i2 = ee(n2, Math.max(i2 - 1, l2), o2);
353
385
  let e3 = t2({ rowIndex: i2, colIndex: c2 });
354
- for (; !e3 && i2 > l2; ) i2 = G(n2, Math.max(--i2, l2), o2), e3 = t2({ rowIndex: i2, colIndex: c2 });
386
+ for (; !e3 && i2 > l2; ) i2 = ee(n2, Math.max(--i2, l2), o2), e3 = t2({ rowIndex: i2, colIndex: c2 });
355
387
  return i2;
356
388
  }
357
389
  case T.Right: {
358
- c2 = G(n2, Math.min(c2 + 1, l2), o2);
390
+ c2 = ee(n2, Math.min(c2 + 1, l2), o2);
359
391
  let e3 = t2({ rowIndex: i2, colIndex: c2 });
360
- for (; !e3 && c2 < l2; ) c2 = G(n2, Math.min(++c2, l2), o2), e3 = t2({ rowIndex: i2, colIndex: c2 });
392
+ for (; !e3 && c2 < l2; ) c2 = ee(n2, Math.min(++c2, l2), o2), e3 = t2({ rowIndex: i2, colIndex: c2 });
361
393
  return c2;
362
394
  }
363
395
  case T.Left: {
364
- c2 = G(n2, Math.max(c2 - 1, l2), o2);
396
+ c2 = ee(n2, Math.max(c2 - 1, l2), o2);
365
397
  let e3 = t2({ rowIndex: i2, colIndex: c2 });
366
- for (; !e3 && c2 > l2; ) c2 = G(n2, Math.max(--c2, l2), o2), e3 = t2({ rowIndex: i2, colIndex: c2 });
398
+ for (; !e3 && c2 > l2; ) c2 = ee(n2, Math.max(--c2, l2), o2), e3 = t2({ rowIndex: i2, colIndex: c2 });
367
399
  return c2;
368
400
  }
369
401
  default:
370
402
  return l2;
371
403
  }
372
- }, J = (e2, t2 = () => true, n2, o2, r2, l2) => {
404
+ }, oe = (e2, t2 = () => true, n2, o2, r2, l2) => {
373
405
  let { rowIndex: i2, colIndex: c2 } = e2;
374
406
  switch (o2) {
375
407
  case T.Down: {
376
- i2 = G(n2, Math.min(i2 + 1, l2), o2);
408
+ i2 = ee(n2, Math.min(i2 + 1, l2), o2);
377
409
  let e3 = t2?.({ rowIndex: i2, colIndex: c2 });
378
- for (; e3 && i2 < l2; ) i2 = G(n2, Math.min(++i2, l2), o2), e3 = t2?.({ rowIndex: i2, colIndex: c2 });
410
+ for (; e3 && i2 < l2; ) i2 = ee(n2, Math.min(++i2, l2), o2), e3 = t2?.({ rowIndex: i2, colIndex: c2 });
379
411
  return t2?.({ rowIndex: i2, colIndex: c2 }) ? i2 : i2 - 1;
380
412
  }
381
413
  case T.Up: {
382
- i2 = G(n2, Math.max(i2 - 1, l2), o2);
414
+ i2 = ee(n2, Math.max(i2 - 1, l2), o2);
383
415
  let e3 = t2?.({ rowIndex: i2, colIndex: c2 });
384
- for (; e3 && i2 > l2; ) i2 = G(n2, Math.max(--i2, l2), o2), e3 = t2?.({ rowIndex: i2, colIndex: c2 });
416
+ for (; e3 && i2 > l2; ) i2 = ee(n2, Math.max(--i2, l2), o2), e3 = t2?.({ rowIndex: i2, colIndex: c2 });
385
417
  return t2?.({ rowIndex: i2, colIndex: c2 }) ? i2 : i2 + 1;
386
418
  }
387
419
  case T.Right: {
388
- c2 = G(n2, Math.min(c2 + 1, l2), o2);
420
+ c2 = ee(n2, Math.min(c2 + 1, l2), o2);
389
421
  let e3 = t2?.({ rowIndex: i2, colIndex: c2 });
390
- for (; e3 && c2 < l2; ) c2 = G(n2, Math.min(++c2, l2), o2), e3 = t2?.({ rowIndex: i2, colIndex: c2 });
422
+ for (; e3 && c2 < l2; ) c2 = ee(n2, Math.min(++c2, l2), o2), e3 = t2?.({ rowIndex: i2, colIndex: c2 });
391
423
  return t2?.({ rowIndex: i2, colIndex: c2 }) ? c2 : c2 - 1;
392
424
  }
393
425
  case T.Left: {
394
- c2 = G(n2, Math.max(c2 - 1, l2), o2);
426
+ c2 = ee(n2, Math.max(c2 - 1, l2), o2);
395
427
  let e3 = t2?.({ rowIndex: i2, colIndex: c2 });
396
- for (; e3 && c2 > l2; ) c2 = G(n2, Math.max(--c2, l2), o2), e3 = t2?.({ rowIndex: i2, colIndex: c2 });
428
+ for (; e3 && c2 > l2; ) c2 = ee(n2, Math.max(--c2, l2), o2), e3 = t2?.({ rowIndex: i2, colIndex: c2 });
397
429
  return t2?.({ rowIndex: i2, colIndex: c2 }) ? c2 : c2 + 1;
398
430
  }
399
431
  default:
400
432
  return null;
401
433
  }
402
- }, Q = (e2, t2, n2, o2, r2, l2) => {
434
+ }, re = (e2, t2, n2, o2, r2, l2) => {
403
435
  if (!t2) return l2;
404
436
  let i2, { rowIndex: c2, colIndex: s2 } = e2;
405
437
  o2 === T.Down ? i2 = { rowIndex: c2 + 1, colIndex: s2 } : o2 === T.Up ? i2 = { rowIndex: c2 - 1, colIndex: s2 } : o2 === T.Right ? i2 = { rowIndex: c2, colIndex: s2 + 1 } : o2 === T.Left && (i2 = { rowIndex: c2, colIndex: s2 - 1 });
406
438
  const a2 = t2(e2), d2 = t2(i2);
407
439
  var u2, h2;
408
- return (h2 = d2, !(u2 = a2) && !h2 || !u2 && h2 || u2 && !h2 ? _ : J)(e2, t2, n2, o2, false, l2) ?? l2;
409
- }, ee = (e2, t2) => `${e2}:${t2}`, te = (e2, t2, n2, o2, r2, l2) => {
440
+ return (h2 = d2, !(u2 = a2) && !h2 || !u2 && h2 || u2 && !h2 ? ne : oe)(e2, t2, n2, o2, false, l2) ?? l2;
441
+ }, le = (e2, t2) => `${e2}:${t2}`, ie = (e2, t2, n2, o2, r2, l2) => {
410
442
  if (n2 - t2 >= r2 - o2) return o2;
411
443
  let i2 = o2;
412
444
  if ("nearest" === e2 && (o2 - t2 > 0 ? e2 = "start" : n2 - r2 > 0 && (e2 = "end")), "start" === e2) i2 = t2;
@@ -415,23 +447,23 @@ const B = ({ itemType: e2, index: t2, itemSize: n2, instanceProps: o2, scale: r2
415
447
  i2 = t2 + (n2 - t2) / 2 - (r2 - o2) / 2;
416
448
  }
417
449
  return Math.max(0, Math.min(i2, l2 - (r2 - o2)));
418
- }, ne = (e2, t2, n2, o2) => (console.log("todo: implement convertToVisibleRanges"), e2), oe = (e2, t2 = T.Right, n2, o2, r2, l2 = null) => {
450
+ }, ce = (e2, t2, n2, o2) => (console.log("todo: implement convertToVisibleRanges"), e2), se = (e2, t2 = T.Right, n2, o2, r2, l2 = null) => {
419
451
  if (l2 && k.isEqualSelectionCoords(l2, e2)) return e2;
420
452
  const i2 = e2.ranges[e2.rangeIndex];
421
453
  if (!k.isRangesIntersect({ rowStart: e2.cell.rowIndex, colStart: e2.cell.colIndex, rowEnd: e2.cell.rowIndex, colEnd: e2.cell.colIndex }, i2)) return e2;
422
454
  let c2 = { ...e2.cell }, s2 = e2.rangeIndex;
423
455
  switch (t2) {
424
456
  case T.Right:
425
- c2.colIndex = G(r2, c2.colIndex + 1, t2);
457
+ c2.colIndex = ee(r2, c2.colIndex + 1, t2);
426
458
  break;
427
459
  case T.Left:
428
- c2.colIndex = G(r2, c2.colIndex - 1, t2);
460
+ c2.colIndex = ee(r2, c2.colIndex - 1, t2);
429
461
  break;
430
462
  case T.Down:
431
- c2.rowIndex = G(o2, c2.rowIndex + 1, t2);
463
+ c2.rowIndex = ee(o2, c2.rowIndex + 1, t2);
432
464
  break;
433
465
  case T.Up:
434
- c2.rowIndex = G(o2, c2.rowIndex - 1, t2);
466
+ c2.rowIndex = ee(o2, c2.rowIndex - 1, t2);
435
467
  }
436
468
  const a2 = (t3) => {
437
469
  if (t3) {
@@ -452,16 +484,16 @@ const B = ({ itemType: e2, index: t2, itemSize: n2, instanceProps: o2, scale: r2
452
484
  let e3 = c2.rowIndex, n3 = c2.colIndex;
453
485
  switch (t2) {
454
486
  case T.Right:
455
- n3 > i2.colEnd && (e3 = G(o2, e3 + 1, t2), n3 = i2.colStart, e3 > i2.rowEnd && (e3 = i2.rowStart));
487
+ n3 > i2.colEnd && (e3 = ee(o2, e3 + 1, t2), n3 = i2.colStart, e3 > i2.rowEnd && (e3 = i2.rowStart));
456
488
  break;
457
489
  case T.Left:
458
- n3 < i2.colStart && (e3 = G(o2, e3 - 1, t2), n3 = i2.colEnd, e3 < i2.rowStart && (e3 = i2.rowEnd));
490
+ n3 < i2.colStart && (e3 = ee(o2, e3 - 1, t2), n3 = i2.colEnd, e3 < i2.rowStart && (e3 = i2.rowEnd));
459
491
  break;
460
492
  case T.Down:
461
- e3 > i2.rowEnd && (n3 = G(r2, n3 + 1, t2), e3 = i2.rowStart, n3 > i2.colEnd && (n3 = i2.colStart));
493
+ e3 > i2.rowEnd && (n3 = ee(r2, n3 + 1, t2), e3 = i2.rowStart, n3 > i2.colEnd && (n3 = i2.colStart));
462
494
  break;
463
495
  case T.Up:
464
- e3 < i2.rowStart && (n3 = G(r2, n3 - 1, t2), e3 = i2.rowEnd, n3 < i2.colStart && (n3 = i2.colEnd));
496
+ e3 < i2.rowStart && (n3 = ee(r2, n3 - 1, t2), e3 = i2.rowEnd, n3 < i2.colStart && (n3 = i2.colEnd));
465
497
  }
466
498
  c2 = { rowIndex: e3, colIndex: n3 };
467
499
  }
@@ -470,7 +502,7 @@ const B = ({ itemType: e2, index: t2, itemSize: n2, instanceProps: o2, scale: r2
470
502
  const e3 = k.intersectRanges(d2, i2);
471
503
  e3 && (d2 = e3);
472
504
  }
473
- let u2 = { rowStart: G(o2, d2.rowStart, T.Down), colStart: G(r2, d2.colStart, T.Right), rowEnd: G(o2, d2.rowEnd, T.Up), colEnd: G(r2, d2.colEnd, T.Left) };
505
+ let u2 = { rowStart: ee(o2, d2.rowStart, T.Down), colStart: ee(r2, d2.colStart, T.Right), rowEnd: ee(o2, d2.rowEnd, T.Up), colEnd: ee(r2, d2.colEnd, T.Left) };
474
506
  if (u2.rowStart !== c2.rowIndex || u2.colStart !== c2.colIndex) {
475
507
  switch (t2) {
476
508
  case T.Right:
@@ -485,13 +517,13 @@ const B = ({ itemType: e2, index: t2, itemSize: n2, instanceProps: o2, scale: r2
485
517
  case T.Up:
486
518
  e2.ranges[s2].rowStart === u2.rowStart && e2.ranges[s2].rowEnd === u2.rowEnd && (c2.colIndex = u2.colStart), c2.colIndex === u2.colStart ? c2.rowIndex = u2.rowStart + 1 : c2.rowIndex = u2.rowStart;
487
519
  }
488
- return oe({ cell: c2, ranges: e2.ranges, rangeIndex: s2 }, t2, n2, o2, r2, l2 ?? e2);
520
+ return se({ cell: c2, ranges: e2.ranges, rangeIndex: s2 }, t2, n2, o2, r2, l2 ?? e2);
489
521
  }
490
522
  return { ranges: e2.ranges, cell: c2, rangeIndex: s2 };
491
- }, re = (e2, t2) => {
523
+ }, ae = (e2, t2) => {
492
524
  let n2, o2 = 0, r2 = 0;
493
525
  return t2.colStart < e2.colStart ? (n2 = T.Left, o2 = e2.colStart - t2.colStart, r2 = t2.colStart) : t2.colEnd > e2.colEnd ? (n2 = T.Right, o2 = t2.colEnd - e2.colEnd, r2 = t2.colEnd) : t2.rowStart < e2.rowStart ? (n2 = T.Up, o2 = e2.rowStart - t2.rowStart, r2 = t2.rowStart) : t2.rowEnd > e2.rowEnd && (n2 = T.Down, o2 = t2.rowEnd - e2.rowEnd, r2 = t2.rowEnd), { direction: n2, amount: o2, index: r2 };
494
- }, le = (e2, t2 = false, n2, o2) => {
526
+ }, de = (e2, t2 = false, n2, o2) => {
495
527
  if (!n2) return 0;
496
528
  const r2 = !t2, l2 = r2 ? 1 : -1;
497
529
  let i2 = n2(r2 ? e2 : e2 + 1), c2 = n2(r2 ? e2 + 1 : e2), s2 = e2 + (r2 ? 2 : -1), a2 = 0;
@@ -500,7 +532,7 @@ const B = ({ itemType: e2, index: t2, itemSize: n2, instanceProps: o2, scale: r2
500
532
  i2 = c2, c2 = n2(s2), s2 += l2, a2++;
501
533
  }
502
534
  return a2;
503
- }, ie = (e2, t2, n2, o2, r2) => {
535
+ }, ue = (e2, t2, n2, o2, r2) => {
504
536
  const l2 = {};
505
537
  let i2 = null, c2 = null;
506
538
  for (let s2 = 0; s2 <= n2.length && n2[s2] <= r2; s2++) {
@@ -510,24 +542,24 @@ const B = ({ itemType: e2, index: t2, itemSize: n2, instanceProps: o2, scale: r2
510
542
  i2 = r3 + 1, c2 = d2, l2[r3] = Object.freeze({ offset: a2, size: d2 - a2, spanIndex: s2 });
511
543
  }
512
544
  return Object.freeze(l2);
513
- }, ce = (e2, t2, n2) => {
545
+ }, he = (e2, t2, n2) => {
514
546
  const o2 = e2.getColOffset(t2.colStart) + (n2?.left ?? 0), r2 = e2.getRowOffset(t2.rowStart) + (n2?.top ?? 0);
515
547
  return { x: o2, y: r2, width: e2.getColOffset(t2.colEnd + 1) + (n2?.right ?? 0) - (n2?.left ?? 0) - o2, height: e2.getRowOffset(t2.rowEnd + 1) + (n2?.bottom ?? 0) - (n2?.top ?? 0) - r2 };
516
- }, se = (e2, t2, n2) => !!n2 && (!(e2 < n2.x || e2 > n2.x + n2.width) && !(t2 < n2.y || t2 > n2.y + n2.height)), ae = (e2, t2 = true) => `M ${i.boundPixel(e2.left)} ${i.boundPixel(e2.top)} L ${i.boundPixel(e2.right, true)} ${i.boundPixel(e2.top)} L ${i.boundPixel(e2.right, true)} ${i.boundPixel(e2.bottom, true)} L ${i.boundPixel(e2.left)} ${i.boundPixel(e2.bottom, true)} L ${i.boundPixel(e2.left)} ${i.boundPixel(e2.top)} ${t2 ? "Z" : ""}`, de = (t2) => {
548
+ }, ge = (e2, t2, n2) => !!n2 && (!(e2 < n2.x || e2 > n2.x + n2.width) && !(t2 < n2.y || t2 > n2.y + n2.height)), fe = (e2, t2 = true) => `M ${i.boundPixel(e2.left)} ${i.boundPixel(e2.top)} L ${i.boundPixel(e2.right, true)} ${i.boundPixel(e2.top)} L ${i.boundPixel(e2.right, true)} ${i.boundPixel(e2.bottom, true)} L ${i.boundPixel(e2.left)} ${i.boundPixel(e2.bottom, true)} L ${i.boundPixel(e2.left)} ${i.boundPixel(e2.top)} ${t2 ? "Z" : ""}`, we = (t2) => {
517
549
  const { linePoints: n2, bounds: o2, pathProps: r2, style: l2, ...c2 } = t2;
518
550
  return e("svg", { width: `${i.boundPixel(o2.width, true)}`, height: `${i.boundPixel(o2.height, true)}`, viewBox: `0 0 ${i.boundPixel(o2.width, true)} ${i.boundPixel(o2.height, true)}`, style: { position: "absolute", left: `${i.boundPixel(o2.x)}px`, top: `${i.boundPixel(o2.y)}px`, width: `${i.boundPixel(o2.width, true)}px`, height: `${i.boundPixel(o2.height, true)}px`, pointerEvents: "none", transitionTimingFunction: "linear", transitionDelay: "0", transitionProperty: "left, top, width, height", willChange: "left, top, width, height, stroke-dashoffset", ...l2 }, ...c2, children: e("path", { d: `M ${i.boundPixel(n2[0])} ${i.boundPixel(n2[1])} L ${i.boundPixel(n2[2])} ${i.boundPixel(n2[3])}`, fill: "none", vectorEffect: "non-scaling-stroke", stroke: "black", ...r2 }) });
519
- }, ue = (n2) => {
551
+ }, xe = (n2) => {
520
552
  const { x: o2 = 0, y: r2 = 0, width: l2 = 0, height: c2 = 0, fill: s2, stroke: a2, strokeWidth: d2 = 0, strokeDasharray: u2, strokeDashoffset: h2, clipPath: g2, pathBounds: f2, pathProps: w2, style: x2, ...p2 } = n2, m2 = r2, v2 = o2, S2 = l2, y2 = c2;
521
553
  let b2 = null;
522
554
  if (s2) {
523
- let t2 = ae({ top: 0, left: 0, bottom: y2, right: S2 });
524
- f2 && (t2 = t2 + " " + ae({ top: f2.y - m2, left: f2.x - v2, bottom: f2.height + f2.y - m2, right: f2.width + f2.x - v2 })), b2 = [e("path", { d: t2, fill: s2, stroke: "none", fillRule: "evenodd" }, "fill")];
555
+ let t2 = fe({ top: 0, left: 0, bottom: y2, right: S2 });
556
+ f2 && (t2 = t2 + " " + fe({ top: f2.y - m2, left: f2.x - v2, bottom: f2.height + f2.y - m2, right: f2.width + f2.x - v2 })), b2 = [e("path", { d: t2, fill: s2, stroke: "none", fillRule: "evenodd" }, "fill")];
525
557
  }
526
- return t("svg", { width: `${i.boundPixel(l2, true)}`, height: `${i.boundPixel(c2, true)}`, viewBox: `0 0 ${i.boundPixel(l2, true)} ${i.boundPixel(c2, true)}`, preserveAspectRatio: "none", style: { position: "absolute", left: `${i.boundPixel(o2)}px`, top: `${i.boundPixel(r2)}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", ...x2 }, ...p2, children: [b2, e("path", { d: ae({ top: 0, left: 0, right: S2, bottom: y2 }), fill: "none", strokeDasharray: u2, strokeDashoffset: h2, stroke: a2, vectorEffect: "non-scaling-stroke", strokeWidth: d2, ...w2 })] });
527
- }, he = (t2) => {
558
+ return t("svg", { width: `${i.boundPixel(l2, true)}`, height: `${i.boundPixel(c2, true)}`, viewBox: `0 0 ${i.boundPixel(l2, true)} ${i.boundPixel(c2, true)}`, preserveAspectRatio: "none", style: { position: "absolute", left: `${i.boundPixel(o2)}px`, top: `${i.boundPixel(r2)}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", ...x2 }, ...p2, children: [b2, e("path", { d: fe({ top: 0, left: 0, right: S2, bottom: y2 }), fill: "none", strokeDasharray: u2, strokeDashoffset: h2, stroke: a2, vectorEffect: "non-scaling-stroke", strokeWidth: d2, ...w2 })] });
559
+ }, pe = (t2) => {
528
560
  const { key: n2, ...o2 } = t2;
529
- return e(ge, { ...o2 }, n2);
530
- }, ge = b((t2) => {
561
+ return e(me, { ...o2 }, n2);
562
+ }, me = b((t2) => {
531
563
  const { stroke: n2, fill: o2, x: r2 = 0, y: l2 = 0, width: i2 = 0, height: c2 = 0, style: s2, isAnimatedStroke: d2, animatedStrokeProps: u2, range: h2, cell: g2, ...f2 } = t2, w2 = d2 || !!u2, x2 = { name: "walking-offset", dashGap: 2, speed: 50, dashLength: 8, ...u2 };
532
564
  let p2 = x2.dashGap + x2.dashLength;
533
565
  const v2 = x2.speed * p2, S2 = a().replaceAll(":", ""), y2 = `${x2.name}-${S2}`;
@@ -543,10 +575,10 @@ const B = ({ itemType: e2, index: t2, itemSize: n2, instanceProps: o2, scale: r2
543
575
  return t3.sheet.insertRule(e2, 0), () => {
544
576
  document.head.removeChild(t3);
545
577
  };
546
- }, [w2]), w2 && (b2 = { strokeDasharray: `${x2.dashLength}px ${x2.dashGap}px`, strokeDashoffset: `${p2}px`, animation: `${y2} ${v2}ms linear infinite`, willChange: "stroke-dashoffset" }), e(ue, { x: r2, y: l2, width: i2, height: c2, stroke: n2, fill: o2, shapeRendering: "crispEdges", style: { ...b2, ...s2 }, ...f2 });
578
+ }, [w2]), w2 && (b2 = { strokeDasharray: `${x2.dashLength}px ${x2.dashGap}px`, strokeDashoffset: `${p2}px`, animation: `${y2} ${v2}ms linear infinite`, willChange: "stroke-dashoffset" }), e(xe, { x: r2, y: l2, width: i2, height: c2, stroke: n2, fill: o2, shapeRendering: "crispEdges", style: { ...b2, ...s2 }, ...f2 });
547
579
  });
548
- ge.displayName = "Selection";
549
- const fe = b(C((t2, n2) => {
580
+ me.displayName = "Selection";
581
+ const ve = b(C((t2, n2) => {
550
582
  const { x: o2 = 0, y: r2 = 0, borderWidth: l2 = 1, size: i2 = 6, borderStroke: c2, corner: s2, style: a2, className: d2, background: u2, ...h2 } = t2;
551
583
  if (0 === o2 || 0 === r2) return null;
552
584
  let g2 = true, f2 = true, w2 = true, x2 = true;
@@ -565,9 +597,11 @@ const fe = b(C((t2, n2) => {
565
597
  }
566
598
  return e("div", { className: M("fill-handle", d2), style: { position: "absolute", left: o2 - (i2 + (g2 ? l2 : 0)) / 2, top: r2 - (i2 + (f2 ? l2 : 0)) / 2, width: i2, height: i2, borderLeft: g2 ? `${l2}px ${c2}` : void 0, borderTop: f2 ? `${l2}px ${c2}` : void 0, borderRight: w2 ? `${l2}px ${c2}` : void 0, borderBottom: x2 ? `${l2}px ${c2}` : void 0, background: u2, cursor: "crosshair", pointerEvents: "all", transitionDuration: "0ms", transitionTimingFunction: "linear", transitionDelay: "0", transitionProperty: "left, top", willChange: "left, top", ...a2 }, tabIndex: -1, ...h2 });
567
599
  }));
568
- fe.displayName = "FillHandle";
569
- const we = b(C((r2, l2) => {
570
- const { range: i2, view: c2, anchor: a2, borderStroke: u2 = "rgb(33, 115, 70)", background: h2 = "white", borderWidth: g2 = 1.5, size: f2 = 22, style: x2, className: v2, selectionTouchPointerHandler: S2, onTouchSelectStart: b2, onTouchSelectEnd: C2, currentTouchAnchor: I2, scrollableElement: E2, scrollableRoot: R2 = document.body, ...k2 } = r2, P2 = o(b2, [b2]), D2 = o(C2, [C2]), { bounds: T2, coordsPivot: O2, key: B2 } = y(() => {
600
+ ve.displayName = "FillHandle";
601
+ const Se = i.detectIt().supportsTouchEvents, ye = b(C((r2, l2) => {
602
+ const { range: i2, view: c2, anchor: a2, borderStroke: u2 = "rgb(33, 115, 70)", background: h2 = "white", borderWidth: g2 = 1.5, size: f2 = 22, style: x2, className: v2, selectionTouchPointerHandler: S2, onTouchSelectStart: b2, onTouchSelectEnd: C2, currentTouchAnchor: I2, scrollableElement: E2, scrollableRoot: R2, ...k2 } = r2;
603
+ if (!Se) return null;
604
+ const P2 = o(b2, [b2]), D2 = o(C2, [C2]), { bounds: T2, coordsPivot: O2, key: z2 } = y(() => {
571
605
  if (!i2 || !c2) return null;
572
606
  let e2 = null, t2 = null;
573
607
  switch (a2) {
@@ -609,38 +643,38 @@ const we = b(C((r2, l2) => {
609
643
  }
610
644
  const h3 = c2.toClipBounds(n2, 0);
611
645
  return !h3 || h3.width <= 0 || h3.height <= 0 || n2.x < 0 || n2.y < 0 || n2.x > d2 || n2.y > u3 ? { bounds: null, coordsAnchor: null, coordsPivot: null, key: null } : { bounds: n2, coordsAnchor: null, coordsPivot: e2, key: "touchSelect-" + c2.getAnchor() + "-" + a2 };
612
- }, [i2, c2, a2]), F2 = w(null), W2 = y(() => {
646
+ }, [i2, c2, a2]), B2 = w(null), F2 = y(() => {
613
647
  const e2 = (e3) => "t" === a2 || "b" === a2 ? { ...e3, colIndex: void 0 } : "l" === a2 || "r" === a2 ? { ...e3, rowIndex: void 0 } : e3;
614
648
  return { processTouch: true, consumeTouch: true, onPointerDown: (t2, n2) => {
615
649
  const o2 = e2(c2.getCellCoordsFromClient(t2.clientX, t2.clientY));
616
- return F2.current = { coordsPivot: O2 }, P2?.(a2), S2.onSelectionPointerDown(t2, n2, c2, o2, O2, false, true);
650
+ return B2.current = { coordsPivot: O2 }, P2?.(a2), S2.onSelectionPointerDown(t2, n2, c2, o2, O2, false, true);
617
651
  }, onPointerMoveOrWait: (t2, n2, o2) => {
618
652
  const r3 = e2(c2.getCellCoordsFromClient(t2.clientX, t2.clientY));
619
- return S2.onSelectionPointerMoveOrWait(t2, n2, o2, c2, r3, F2.current?.coordsPivot, true, true);
620
- }, onPointerUp: (e3, t2, n2) => (F2.current = null, D2?.(a2), S2.onPointerUp(e3, t2, n2)) };
621
- }, [S2, i2, c2, a2]), A2 = s(W2), [V2, { y: U2, x: H2 }] = z(), K2 = w(null), { getPortalContainer: N2 } = d(), [q2, j2] = p(null);
653
+ return S2.onSelectionPointerMoveOrWait(t2, n2, o2, c2, r3, B2.current?.coordsPivot, true, true);
654
+ }, onPointerUp: (e3, t2, n2) => (B2.current = null, D2?.(a2), S2.onPointerUp(e3, t2, n2)) };
655
+ }, [S2, i2, c2, a2]), A2 = s(F2), [W2, { y: V2, x: U2 }] = J(), H2 = w(null), { getPortalContainer: K2, isFullscreen: N2 } = d(), [q2, j2] = p(null);
622
656
  return m(() => {
623
- const t2 = K2.current?.getBoundingClientRect();
657
+ const t2 = H2.current?.getBoundingClientRect();
624
658
  if (!t2 || !T2) return void j2(null);
625
659
  let n2 = 0, o2 = 0, r3 = E2;
626
660
  for (; r3; ) n2 += r3.scrollLeft, o2 += r3.scrollTop, r3 = R2 && r3 === R2.parentElement ? null : r3.parentElement;
627
- j2(L(e("div", { className: M("touch-select-handle", v2), ref: l2, style: { position: "absolute", left: n2 + (t2?.x ?? 0) - (f2 + g2) / 2, top: o2 + (t2?.y ?? 0) - (f2 + g2) / 2, width: f2, height: f2, borderWidth: `${g2}px`, border: u2, borderRadius: "50%", background: h2, boxShadow: `0 0 0 1.5px ${h2}`, cursor: "grab", pointerEvents: "all", opacity: I2 ? 0 : 1, transitionDuration: "160ms", transitionProperty: "opacity", ...x2 }, tabIndex: -1, onPointerDown: A2, ...k2 }), R2 ?? N2(), B2));
628
- }, [U2, H2, T2?.x, T2?.y, T2?.width, T2?.height, v2, I2, h2, f2, g2, u2, E2]), T2 ? t(n, { children: [e("div", { ref: $([V2, K2]), style: { position: "absolute", left: T2.x, top: T2.y, opacity: 0 } }), q2] }) : null;
661
+ j2(L(e("div", { className: M("touch-select-handle", v2), ref: l2, style: { position: "absolute", left: n2 + (t2?.x ?? 0) - (f2 + g2) / 2, top: o2 + (t2?.y ?? 0) - (f2 + g2) / 2, width: f2, height: f2, borderWidth: `${g2}px`, border: u2, borderRadius: "50%", background: h2, boxShadow: `0 0 0 1.5px ${h2}`, cursor: "grab", pointerEvents: "all", opacity: I2 ? 0 : 1, transitionDuration: "160ms", transitionProperty: "opacity", ...x2 }, tabIndex: -1, onPointerDown: A2, ...k2 }), R2 ?? K2(), z2));
662
+ }, [V2, U2, T2?.x, T2?.y, T2?.width, T2?.height, v2, I2, h2, f2, g2, u2, E2, N2]), T2 ? t(n, { children: [e("div", { ref: $([W2, H2]), style: { position: "absolute", left: T2.x, top: T2.y, opacity: 0 } }), q2] }) : null;
629
663
  }));
630
- we.displayName = "TouchSelectHandle";
631
- const xe = -10, pe = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd: 0 }), me = Object.freeze({ colIndex: 0, rowIndex: 0 }), ve = Object.freeze([]), Se = (e2) => {
664
+ ye.displayName = "TouchSelectHandle";
665
+ const be = -10, Ce = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd: 0 }), Ie = Object.freeze({ colIndex: 0, rowIndex: 0 }), Ee = Object.freeze([]), Re = (e2) => {
632
666
  if (e2 && e2.cell && e2.ranges && e2.rangeIndex > -1 && e2.rangeIndex <= e2.ranges.length) return e2;
633
- const t2 = { cell: null, ranges: e2?.ranges ?? ve };
634
- return t2.rangeIndex = e2?.rangeIndex ?? t2.ranges.length - 1, t2.cell = e2?.cell, !t2.cell && t2.ranges.length > 0 && (t2.cell = { rowIndex: t2.ranges[t2.rangeIndex].rowStart, colIndex: t2.ranges[t2.rangeIndex].colStart }), t2.cell || (t2.cell = me), k.isEqualSelectionCoords(t2, e2) ? e2 : t2;
635
- }, ye = (e2, t2, n2) => {
667
+ const t2 = { cell: null, ranges: e2?.ranges ?? Ee };
668
+ return t2.rangeIndex = e2?.rangeIndex ?? t2.ranges.length - 1, t2.cell = e2?.cell, !t2.cell && t2.ranges.length > 0 && (t2.cell = { rowIndex: t2.ranges[t2.rangeIndex].rowStart, colIndex: t2.ranges[t2.rangeIndex].colStart }), t2.cell || (t2.cell = Ie), k.isEqualSelectionCoords(t2, e2) ? e2 : t2;
669
+ }, Me = (e2, t2, n2) => {
636
670
  const o2 = e2.getVisibleRangeCoords(), r2 = e2.getScrollOrientation();
637
671
  !r2.horizontal && (t2.colIndex > o2.colEnd || t2.colIndex < o2.colStart) && (t2 = { ...t2, colIndex: t2.colIndex > o2.colEnd ? o2.colEnd + 1 : o2.colEnd - 1 }, e2 = n2.current.getViewFromLocation(O.Center)), !r2.vertical && (t2.rowIndex > o2.rowEnd || t2.rowIndex < o2.rowStart) && (t2 = { ...t2, rowIndex: t2.rowIndex > o2.rowEnd ? o2.rowEnd + 1 : o2.rowEnd - 1 }, e2 = n2.current.getViewFromLocation(O.Center)), e2.scrollCellCoordsIntoView(t2);
638
- }, be = () => false, Ce = ({ gridRef: t2, commands: n2, layout: r2, selection: l2, onSelectionChange: a2, onSelectionDragStart: d2, onSelectionDragEnd: g2, selectionPolicy: f2 = "multiple", newSelectionMode: x2 = "clear", allowDeselectSelection: b2 = true, onFillPreview: C2, onFillCancel: E2, onFillDone: R2, onFill: M2, disableFillDrag: D2 = !M2, fillHandleBorderColor: z2 = "white", hiddenRowsAt: L2, hiddenColumnsAt: $2, isContentfulCell: B2, contentfulCellFinder: F2 = Q, getDataCoords: W2, alwaysScrollToActiveCoords: A2 = false, selectionBounds: V2, pointerDownInterceptor: U2, pointerMoveInterceptor: H2, mergedRanges: K2, canSelectionSpanMergedCells: N2 = be, onMoveDragStart: q2, onMoveDragUpdate: j2, onMoveDragEnd: X2, onMoveDragDone: Y2, selectionRenderer: Z2 = he, disableMoveDrag: _2 = !X2, getCellCoordsAsRangeCoords: J2 = k.cellToRange, moveDragHitSize: ee2 = 6, moveDragOutlineSize: te2 = 4, selectionBackgroundColor: ie2 = "rgba(16, 124, 65, 0.1)", selectionBorderColor: ce2 = "rgb(33, 115, 70)", selectionRemoveBorderColor: se2 = "rgb(255, 0, 0)", selectionRemoveBackgroundColor: ae2 = "rgba(250, 10, 10, 0.1)", disableTouchSelection: de2 = false, touchSelectHandleProps: ue2 }) => {
639
- const ge2 = v(() => ({ top: V2?.top ?? 0, left: V2?.left ?? 0, bottom: t2.current?.rowCount - 1 || 0, right: t2.current?.columnCount - 1 || 0 }), []), Ce2 = o(M2, [M2]), Ie2 = o(C2, [C2]), Ee2 = o(E2, [E2]), Re2 = o(R2, [R2]), Me2 = o(B2, [B2]), ke2 = o(Z2, [Z2]), Pe2 = o((e2, t3 = false) => le(e2, t3, r2.getRowOffset, t3 ? ge2().bottom : ge2().top), [r2?.getRowOffset]), De2 = o(L2 ?? Pe2, [L2]), Te2 = o((e2, t3 = false) => le(e2, t3, r2.getColOffset, t3 ? ge2().right : ge2().left), [r2?.getColOffset]), Oe2 = o($2 ?? Te2, [$2]), [ze2, Le2] = p(() => Se(l2)), $e2 = y(() => Se(ze2), [ze2]), Be2 = w($e2), Fe2 = w(true);
672
+ }, ke = () => false, Pe = ({ gridRef: t2, commands: n2, layout: r2, selection: l2, onSelectionChange: a2, onSelectionDragStart: d2, onSelectionDragEnd: g2, selectionPolicy: f2 = "multiple", newSelectionMode: x2 = "clear", allowDeselectSelection: b2 = true, onFillPreview: C2, onFillCancel: E2, onFillDone: R2, onFill: M2, disableFillDrag: D2 = !M2, fillHandleBorderColor: z2 = "white", hiddenRowsAt: L2, hiddenColumnsAt: $2, isContentfulCell: B2, contentfulCellFinder: F2 = re, getDataCoords: A2, alwaysScrollToActiveCoords: W2 = false, selectionBounds: V2, pointerDownInterceptor: U2, pointerMoveInterceptor: H2, mergedRanges: K2, canSelectionSpanMergedCells: N2 = ke, onMoveDragStart: q2, onMoveDragUpdate: j2, onMoveDragEnd: X2, onMoveDragDone: Y2, selectionRenderer: G2 = pe, disableMoveDrag: Z2 = !X2, getCellCoordsAsRangeCoords: _2 = k.cellToRange, moveDragHitSize: J2 = 6, moveDragOutlineSize: Q2 = 4, selectionBackgroundColor: te2 = "rgba(16, 124, 65, 0.1)", selectionBorderColor: ne2 = "rgb(33, 115, 70)", selectionRemoveBorderColor: oe2 = "rgb(255, 0, 0)", selectionRemoveBackgroundColor: le2 = "rgba(250, 10, 10, 0.1)", disableTouchSelection: ie2 = false, touchSelectHandleProps: ue2 }) => {
673
+ const he2 = v(() => ({ top: V2?.top ?? 0, left: V2?.left ?? 0, bottom: t2.current?.rowCount - 1 || 0, right: t2.current?.columnCount - 1 || 0 }), []), ge2 = o(M2, [M2]), fe2 = o(C2, [C2]), we2 = o(E2, [E2]), xe2 = o(R2, [R2]), me2 = o(B2, [B2]), Se2 = o(G2, [G2]), Pe2 = o((e2, t3 = false) => de(e2, t3, r2.getRowOffset, t3 ? he2().bottom : he2().top), [r2?.getRowOffset]), De2 = o(L2 ?? Pe2, [L2]), Te2 = o((e2, t3 = false) => de(e2, t3, r2.getColOffset, t3 ? he2().right : he2().left), [r2?.getColOffset]), Oe2 = o($2 ?? Te2, [$2]), [ze2, Le2] = p(() => Re(l2)), $e2 = y(() => Re(ze2), [ze2]), Be2 = w($e2), Fe2 = w(true);
640
674
  S(P.throttle(() => {
641
675
  Le2((e2) => {
642
676
  Fe2.current = true;
643
- const t3 = Se(l2);
677
+ const t3 = Re(l2);
644
678
  return k.isEqualSelectionCoords(t3, e2) ? e2 : t3;
645
679
  });
646
680
  }, 0), [l2]), S(() => {
@@ -648,20 +682,20 @@ const xe = -10, pe = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
648
682
  }, [$e2]), m(() => {
649
683
  Fe2.current || !a2 || k.isEqualSelectionCoords(l2, $e2) || a2($e2);
650
684
  }, [$e2]);
651
- const We2 = v((e2) => {
685
+ const Ae2 = v((e2) => {
652
686
  Le2((t3) => {
653
- Fe2.current = false, t3 = Se(t3);
654
- let n3 = "function" == typeof e2 ? e2(t3.ranges) : e2 ?? ve;
687
+ Fe2.current = false, t3 = Re(t3);
688
+ let n3 = "function" == typeof e2 ? e2(t3.ranges) : e2 ?? Ee;
655
689
  if (k.isEqualRangesArrays(n3, t3.ranges)) return t3;
656
690
  let o2 = Math.max(n3.length ? 0 : -1, Math.min(t3.rangeIndex, n3.length - 1)), r3 = t3.cell;
657
691
  -1 === o2 || k.isCellWithinRange(r3, n3[o2]) || (r3 = { rowIndex: n3[o2].rowStart, colIndex: n3[o2].colStart }), 1 === n3.length && k.isSingleCell(n3[0]) && k.isCellWithinRange(r3, n3[0]) && (n3 = [], o2 = -1);
658
692
  const l3 = { cell: r3, ranges: n3, rangeIndex: o2 };
659
693
  return k.isEqualSelectionCoords(l3, t3) ? t3 : l3;
660
694
  });
661
- }, []), Ae2 = o((e2) => {
695
+ }, []), We2 = o((e2) => {
662
696
  Le2((t3) => {
663
- Fe2.current = false, t3 = Se(t3);
664
- const n3 = e2 ?? me, o2 = J2(n3);
697
+ Fe2.current = false, t3 = Re(t3);
698
+ const n3 = e2 ?? Ie, o2 = _2(n3);
665
699
  if (!k.isSingleCell(o2) && 0 === t3.ranges.length) return { ranges: [o2], rangeIndex: 0, cell: n3 };
666
700
  if (k.isEqualCells(n3, t3.cell)) return t3;
667
701
  let r3 = t3.ranges, l3 = t3.rangeIndex;
@@ -669,7 +703,7 @@ const xe = -10, pe = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
669
703
  const i2 = { ranges: r3, rangeIndex: l3, cell: n3 };
670
704
  return k.isEqualSelectionCoords(i2, t3) ? t3 : i2;
671
705
  });
672
- }, [J2]), [Ve2, Ue2] = p(null), [He2, Ke2] = p(null), Ne2 = w(null), [qe2, je2] = p(null), Xe = w(null), Ye = w(null), [Ge, Ze] = p(null), _e = w(null), Je = w(null), Qe = w(K2);
706
+ }, [_2]), [Ve2, Ue2] = p(null), [He2, Ke2] = p(null), Ne2 = w(null), [qe2, je2] = p(null), Xe2 = w(null), Ye2 = w(null), [Ge2, Ze2] = p(null), _e2 = w(null), Je2 = w(null), Qe = w(K2);
673
707
  m(() => {
674
708
  Qe.current = K2;
675
709
  }, [K2]);
@@ -677,16 +711,16 @@ const xe = -10, pe = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
677
711
  let { rowIndex: o2, colIndex: r3 } = e2;
678
712
  void 0 === o2 && $e2?.cell && (o2 = $e2.cell.rowIndex), void 0 === r3 && $e2?.cell && (r3 = $e2.cell.colIndex), void 0 !== o2 && void 0 !== r3 && t2.current?.scrollCellCoordsIntoView({ rowIndex: o2, colIndex: r3 }, n3);
679
713
  }, [$e2]), tt = v((e2) => {
680
- const t3 = ge2();
714
+ const t3 = he2();
681
715
  return e2.rowIndex < t3.top || e2.colIndex < t3.left || e2.colIndex > t3.right || e2.rowIndex > t3.bottom;
682
716
  }, []), nt = o((e2, n3) => {
683
717
  if (!t2?.current) return null;
684
718
  const o2 = { rowStart: Math.min(e2.rowIndex, n3.rowIndex), colStart: Math.min(e2.colIndex, n3.colIndex), rowEnd: Math.max(e2.rowIndex, n3.rowIndex), colEnd: Math.max(e2.colIndex, n3.colIndex) }, r3 = N2?.(o2);
685
719
  if (r3) return o2;
686
- const l3 = J2(e2), i2 = J2(n3), c2 = { rowStart: Math.min(l3.rowStart, i2.rowStart), colStart: Math.min(l3.colStart, i2.colStart), rowEnd: Math.max(l3.rowEnd, i2.rowEnd), colEnd: Math.max(l3.colEnd, i2.colEnd) };
720
+ const l3 = _2(e2), i2 = _2(n3), c2 = { rowStart: Math.min(l3.rowStart, i2.rowStart), colStart: Math.min(l3.colStart, i2.colStart), rowEnd: Math.max(l3.rowEnd, i2.rowEnd), colEnd: Math.max(l3.colEnd, i2.colEnd) };
687
721
  let s2;
688
722
  return "function" == typeof Qe.current ? s2 = Qe.current(c2) : K2 && (s2 = K2), s2 ? k.extendRangeToUnionRanges(c2, s2) : c2;
689
- }, [N2, J2]), ot = o((e2, t3, n3) => {
723
+ }, [N2, _2]), ot = o((e2, t3, n3) => {
690
724
  const o2 = e2.ranges.length > 0 ? e2.ranges[e2.rangeIndex] : { rowStart: e2.cell.rowIndex, colStart: e2.cell.colIndex, rowEnd: e2.cell.rowIndex, colEnd: e2.cell.colIndex }, r3 = { rowStart: Math.min(t3.rowIndex ?? o2.rowStart, n3.rowIndex ?? o2.rowStart), colStart: Math.min(t3.colIndex ?? o2.colStart, n3.colIndex ?? o2.colStart), rowEnd: Math.max(t3.rowIndex ?? o2.rowEnd, n3.rowIndex ?? o2.rowEnd), colEnd: Math.max(t3.colIndex ?? o2.colEnd, n3.colIndex ?? o2.colEnd) }, l3 = { rowIndex: r3.rowStart, colIndex: r3.colStart }, i2 = { rowIndex: r3.rowEnd, colIndex: r3.colEnd };
691
725
  if (tt(l3) || tt(i2)) return;
692
726
  return nt(l3, i2);
@@ -696,17 +730,17 @@ const xe = -10, pe = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
696
730
  const o2 = ot(Be2.current, e2, t3 ?? Be2.current.cell);
697
731
  if (!o2) return;
698
732
  const r3 = Be2.current.rangeIndex;
699
- We2((e3) => e3.length ? e3.map((e4, t4) => r3 === t4 ? o2 : e4) : [o2]), n3 && o2 && Ae2({ colIndex: o2.colStart, rowIndex: o2.rowStart });
733
+ Ae2((e3) => e3.length ? e3.map((e4, t4) => r3 === t4 ? o2 : e4) : [o2]), n3 && o2 && We2({ colIndex: o2.colStart, rowIndex: o2.rowStart });
700
734
  }, []), lt = v((e2, t3, n3) => {
701
735
  if (!Be2.current) return;
702
736
  e2 = { ...Be2.current?.cell, ...e2 }, t3 = t3 ?? e2;
703
737
  const o2 = ot(Be2.current, e2, t3);
704
738
  if (!o2) return;
705
739
  const r3 = { rowIndex: o2.rowStart, colIndex: o2.colStart }, l3 = { ...r3, ...n3 };
706
- "clear" === x2 ? (_e.current = l3, ct()) : "modify" === x2 ? rt(r3) : it(r3), Ae2(l3);
740
+ "clear" === x2 ? (_e2.current = l3, ct()) : "modify" === x2 ? rt(r3) : it(r3), We2(l3);
707
741
  }, []), it = v((e2, t3 = e2, n3) => {
708
742
  "multiple" !== f2 || !e2 || tt(e2) || tt(t3) || Le2((o2) => {
709
- Fe2.current = false, o2 = Se(o2);
743
+ Fe2.current = false, o2 = Re(o2);
710
744
  const r3 = nt(e2, t3);
711
745
  if (!r3) return o2;
712
746
  let l3 = o2.ranges.length > 0 ? [...o2.ranges] : [nt(o2.cell, o2.cell)];
@@ -715,14 +749,14 @@ const xe = -10, pe = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
715
749
  return k.isEqualSelectionCoords(i2, o2) ? o2 : i2;
716
750
  });
717
751
  }, []), ct = () => {
718
- We2(ve);
752
+ Ae2(Ee);
719
753
  }, st = "touch" === i.detectIt().primaryInput, at = w(null), dt = w(null), ut = w(null), ht = y(() => ({ onPointerDown: (e2) => {
720
754
  if (!t2 || !t2.current) return false;
721
755
  const n3 = e2.nativeEvent, o2 = t2.current.getViewFromClient(n3.clientX, n3.clientY);
722
756
  if ("touch" === n3.pointerType || "touchstart" === n3.type) return dt.current = { topLeft: o2.getScrollTopLeft(), point: { x: n3.clientX, y: n3.clientY } }, true;
723
757
  const r3 = o2.getCellCoordsFromClient(e2.nativeEvent.clientX, e2.nativeEvent.clientY);
724
758
  if (!r3) return false;
725
- at.current = { anchor: o2.getAnchor(), coords: r3 }, Je.current = null;
759
+ at.current = { anchor: o2.getAnchor(), coords: r3 }, Je2.current = null;
726
760
  const l3 = e2.nativeEvent.which === c.Right;
727
761
  if (l3) {
728
762
  if (-1 !== k.indexOfCoords(r3, $e2.ranges)) return false;
@@ -737,14 +771,14 @@ const xe = -10, pe = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
737
771
  if (x3 && (!g3 || !h2)) return w2;
738
772
  if (s2) {
739
773
  if (-1 !== k.indexOfCoords(r3, $e2.ranges) && u2) {
740
- Xe.current = r3;
774
+ Xe2.current = r3;
741
775
  const e3 = nt(r3, r3);
742
- return Ye.current = e3, je2(e3), w2;
776
+ return Ye2.current = e3, je2(e3), w2;
743
777
  }
744
778
  }
745
779
  return it(r3), w2;
746
780
  }
747
- A2 && et(r3), x3 && 0 === $e2.ranges.length || lt(r3);
781
+ W2 && et(r3), x3 && 0 === $e2.ranges.length || lt(r3);
748
782
  }, onPointerMoveOrWait: P.throttle((e2, n3) => {
749
783
  if (!t2?.current) return;
750
784
  if ("touch" === e2.pointerType || "touchmove" === e2.type) return;
@@ -752,13 +786,13 @@ const xe = -10, pe = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
752
786
  const o2 = at.current.anchor;
753
787
  let r3 = t2.current.getViewFromLocation(o2), l3 = r3.getCellCoordsFromClient(e2.clientX, e2.clientY);
754
788
  if (!k.isEqualCells(l3, at.current?.coords) && (at.current = { anchor: o2, coords: l3 }, l3 && false !== H2?.(e2, l3, Be2.current))) {
755
- if (Xe.current) {
756
- const e3 = { rowStart: Math.min(l3.rowIndex, Xe.current.rowIndex), colStart: Math.min(l3.colIndex, Xe.current.colIndex), rowEnd: Math.max(l3.rowIndex, Xe.current.rowIndex), colEnd: Math.max(l3.colIndex, Xe.current.colIndex) }, t3 = { rowIndex: e3.rowStart, colIndex: e3.colStart }, n4 = { rowIndex: e3.rowEnd, colIndex: e3.colEnd };
789
+ if (Xe2.current) {
790
+ const e3 = { rowStart: Math.min(l3.rowIndex, Xe2.current.rowIndex), colStart: Math.min(l3.colIndex, Xe2.current.colIndex), rowEnd: Math.max(l3.rowIndex, Xe2.current.rowIndex), colEnd: Math.max(l3.colIndex, Xe2.current.colIndex) }, t3 = { rowIndex: e3.rowStart, colIndex: e3.colStart }, n4 = { rowIndex: e3.rowEnd, colIndex: e3.colEnd };
757
791
  if (tt(t3) || tt(n4)) return;
758
792
  const o3 = nt(t3, n4);
759
- Ye.current = o3, je2(o3);
793
+ Ye2.current = o3, je2(o3);
760
794
  } else rt(l3);
761
- ut.current = n3, ye(r3, l3, t2);
795
+ ut.current = n3, Me(r3, l3, t2);
762
796
  }
763
797
  }, 60), onPointerUp: (e2) => {
764
798
  if (at.current = null, "touch" === e2.pointerType || "touchend" === e2.type) {
@@ -776,10 +810,10 @@ const xe = -10, pe = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
776
810
  } catch (e3) {
777
811
  console.warn(e3);
778
812
  }
779
- if (!Xe.current) return;
780
- const n3 = Ye.current;
781
- Xe.current = null, Ye.current = null, je2(null), Le2((e3) => {
782
- if (Fe2.current = false, 0 === (e3 = Se(e3)).ranges.length) return e3;
813
+ if (!Xe2.current) return;
814
+ const n3 = Ye2.current;
815
+ Xe2.current = null, Ye2.current = null, je2(null), Le2((e3) => {
816
+ if (Fe2.current = false, 0 === (e3 = Re(e3)).ranges.length) return e3;
783
817
  let t3 = [], o2 = -1, r3 = e3.cell;
784
818
  for (let l4 = 0; l4 < e3.ranges.length; l4++) {
785
819
  const i2 = e3.ranges[l4];
@@ -795,12 +829,12 @@ const xe = -10, pe = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
795
829
  const l3 = { cell: r3, rangeIndex: o2, ranges: t3 };
796
830
  return k.isEqualSelectionCoords(l3, e3) ? e3 : l3;
797
831
  });
798
- }, processTouch: true, consumeTouch: false }), [$e2, f2, b2, A2, x2]), gt = o(s(ht), []), ft = y(() => ({ onSelectionPointerDown: (e2, n3, o2, r3, l3 = $e2.cell, i2 = A2, s2 = e2.nativeEvent.shiftKey, a3 = false) => {
832
+ }, processTouch: true, consumeTouch: false }), [$e2, f2, b2, W2, x2]), gt = o(s(ht), []), ft = y(() => ({ onSelectionPointerDown: (e2, n3, o2, r3, l3 = $e2.cell, i2 = W2, s2 = e2.nativeEvent.shiftKey, a3 = false) => {
799
833
  if (!t2 || !t2.current) return false;
800
834
  e2.stopPropagation(), e2.preventDefault(), e2.nativeEvent.stopImmediatePropagation();
801
835
  const u2 = o2 ?? t2.current.getViewFromClient(e2.nativeEvent.clientX, e2.nativeEvent.clientY), h2 = r3 ?? u2.getCellCoordsFromClient(e2.nativeEvent.clientX, e2.nativeEvent.clientY);
802
836
  if (!h2) return false;
803
- at.current = { anchor: u2.getAnchor(), coords: h2 }, Je.current = null;
837
+ at.current = { anchor: u2.getAnchor(), coords: h2 }, Je2.current = null;
804
838
  const g3 = e2.nativeEvent.which === c.Right;
805
839
  if (g3) {
806
840
  if (-1 !== k.indexOfCoords(h2, $e2.ranges)) return false;
@@ -815,9 +849,9 @@ const xe = -10, pe = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
815
849
  if (y2 && (!v2 || !m2)) return S2;
816
850
  if (v2) {
817
851
  if (-1 !== k.indexOfCoords(h2, $e2.ranges) && p2) {
818
- Xe.current = h2;
852
+ Xe2.current = h2;
819
853
  const e3 = nt(h2, h2);
820
- return Ye.current = e3, je2(e3), S2;
854
+ return Ye2.current = e3, je2(e3), S2;
821
855
  }
822
856
  }
823
857
  return it(h2), S2;
@@ -829,13 +863,13 @@ const xe = -10, pe = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
829
863
  const a3 = at.current.anchor;
830
864
  let d3 = r3 ?? t2.current.getViewFromLocation(a3), u2 = l3 ?? d3.getCellCoordsFromClient(e2.clientX, e2.clientY);
831
865
  if (!k.isEqualCells(u2, at.current?.coords) && (at.current = { anchor: a3, coords: u2 }, u2 && false !== H2?.(e2, u2, Be2.current))) {
832
- if (Xe.current) {
833
- const e3 = { rowStart: Math.min(u2.rowIndex, Xe.current.rowIndex), colStart: Math.min(u2.colIndex, Xe.current.colIndex), rowEnd: Math.max(u2.rowIndex, Xe.current.rowIndex), colEnd: Math.max(u2.colIndex, Xe.current.colIndex) }, t3 = { rowIndex: e3.rowStart, colIndex: e3.colStart }, n4 = { rowIndex: e3.rowEnd, colIndex: e3.colEnd };
866
+ if (Xe2.current) {
867
+ const e3 = { rowStart: Math.min(u2.rowIndex, Xe2.current.rowIndex), colStart: Math.min(u2.colIndex, Xe2.current.colIndex), rowEnd: Math.max(u2.rowIndex, Xe2.current.rowIndex), colEnd: Math.max(u2.colIndex, Xe2.current.colIndex) }, t3 = { rowIndex: e3.rowStart, colIndex: e3.colStart }, n4 = { rowIndex: e3.rowEnd, colIndex: e3.colEnd };
834
868
  if (tt(t3) || tt(n4)) return;
835
869
  const o3 = nt(t3, n4);
836
- Ye.current = o3, je2(o3);
870
+ Ye2.current = o3, je2(o3);
837
871
  } else rt(u2, i2, s2);
838
- c2 && ye(d3, u2, t2);
872
+ c2 && Me(d3, u2, t2);
839
873
  }
840
874
  }, onPointerUp: (e2) => {
841
875
  at.current = null, e2.stopPropagation(), e2.preventDefault(), e2.stopImmediatePropagation();
@@ -844,10 +878,10 @@ const xe = -10, pe = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
844
878
  } catch (e3) {
845
879
  console.warn(e3);
846
880
  }
847
- if (!Xe.current) return;
848
- const t3 = Ye.current;
849
- Xe.current = null, Ye.current = null, je2(null), Le2((e3) => {
850
- if (Fe2.current = false, 0 === (e3 = Se(e3)).ranges.length) return e3;
881
+ if (!Xe2.current) return;
882
+ const t3 = Ye2.current;
883
+ Xe2.current = null, Ye2.current = null, je2(null), Le2((e3) => {
884
+ if (Fe2.current = false, 0 === (e3 = Re(e3)).ranges.length) return e3;
851
885
  let n3 = [], o2 = -1, r3 = e3.cell;
852
886
  for (let l4 = 0; l4 < e3.ranges.length; l4++) {
853
887
  const i2 = e3.ranges[l4];
@@ -863,7 +897,7 @@ const xe = -10, pe = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
863
897
  const l3 = { cell: r3, rangeIndex: o2, ranges: n3 };
864
898
  return k.isEqualSelectionCoords(l3, e3) ? e3 : l3;
865
899
  });
866
- } }), [$e2, f2, b2, A2, x2]), wt = o((e2, n3 = false, o2 = false, l3 = 0) => {
900
+ } }), [$e2, f2, b2, W2, x2]), wt = o((e2, n3 = false, o2 = false, l3 = 0) => {
867
901
  if (!t2.current || !$e2.cell) return;
868
902
  let i2 = $e2.cell, c2 = $e2.cell;
869
903
  if (n3 && $e2.ranges.length > 0) {
@@ -882,44 +916,44 @@ const xe = -10, pe = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
882
916
  c2 = { rowIndex: t3.rowEnd, colIndex: n4.colIndex === t3.colEnd ? t3.colStart : t3.colEnd }, i2 = { rowIndex: t3.rowStart, colIndex: n4.colIndex === t3.colEnd ? t3.colEnd : t3.colStart };
883
917
  }
884
918
  }
885
- const s2 = J2(c2);
919
+ const s2 = _2(c2);
886
920
  let { rowStart: a3, colStart: d3 } = s2;
887
- const u2 = ge2();
888
- if (Je.current) switch (e2) {
921
+ const u2 = he2();
922
+ if (Je2.current) switch (e2) {
889
923
  case T.Up:
890
924
  case T.Down:
891
- Je.current.colIndex >= s2.colStart && Je.current.colIndex <= s2.colEnd && (d3 = Je.current.colIndex);
925
+ Je2.current.colIndex >= s2.colStart && Je2.current.colIndex <= s2.colEnd && (d3 = Je2.current.colIndex);
892
926
  break;
893
927
  case T.Left:
894
928
  case T.Right:
895
- Je.current.rowIndex >= s2.rowStart && Je.current.rowIndex <= s2.rowEnd && (a3 = Je.current.rowIndex);
929
+ Je2.current.rowIndex >= s2.rowStart && Je2.current.rowIndex <= s2.rowEnd && (a3 = Je2.current.rowIndex);
896
930
  }
897
931
  if (!l3) {
898
932
  switch (e2) {
899
933
  case T.Up:
900
- a3 = G(De2, Math.max(s2.rowStart - 1, u2.top), e2);
934
+ a3 = ee(De2, Math.max(s2.rowStart - 1, u2.top), e2);
901
935
  break;
902
936
  case T.Down:
903
- a3 = G(De2, Math.min(s2.rowEnd + 1, u2.bottom), e2);
937
+ a3 = ee(De2, Math.min(s2.rowEnd + 1, u2.bottom), e2);
904
938
  break;
905
939
  case T.Left:
906
- d3 = G(Oe2, Math.max(s2.colStart - 1, u2.left), e2);
940
+ d3 = ee(Oe2, Math.max(s2.colStart - 1, u2.left), e2);
907
941
  break;
908
942
  case T.Right:
909
- d3 = G(Oe2, Math.min(s2.colEnd + 1, u2.right), e2);
943
+ d3 = ee(Oe2, Math.min(s2.colEnd + 1, u2.right), e2);
910
944
  }
911
945
  if (o2) switch (e2) {
912
946
  case T.Up:
913
- a3 = F2({ ...c2, colIndex: $e2.cell.colIndex }, Me2, De2, e2, false, Math.max(u2.top, De2(u2.top, false)));
947
+ a3 = F2({ ...c2, colIndex: $e2.cell.colIndex }, me2, De2, e2, false, Math.max(u2.top, De2(u2.top, false)));
914
948
  break;
915
949
  case T.Down:
916
- a3 = F2({ ...c2, colIndex: $e2.cell.colIndex }, Me2, De2, e2, false, Math.min(u2.bottom, u2.bottom - De2(u2.bottom, true)));
950
+ a3 = F2({ ...c2, colIndex: $e2.cell.colIndex }, me2, De2, e2, false, Math.min(u2.bottom, u2.bottom - De2(u2.bottom, true)));
917
951
  break;
918
952
  case T.Left:
919
- d3 = F2({ ...c2, rowIndex: $e2.cell.rowIndex }, Me2, Oe2, e2, false, Math.max(u2.left, Oe2(u2.left, false)));
953
+ d3 = F2({ ...c2, rowIndex: $e2.cell.rowIndex }, me2, Oe2, e2, false, Math.max(u2.left, Oe2(u2.left, false)));
920
954
  break;
921
955
  case T.Right:
922
- d3 = F2({ ...c2, rowIndex: $e2.cell.rowIndex }, Me2, Oe2, e2, false, Math.min(u2.right, u2.right - Oe2(u2.right, true)));
956
+ d3 = F2({ ...c2, rowIndex: $e2.cell.rowIndex }, me2, Oe2, e2, false, Math.min(u2.right, u2.right - Oe2(u2.right, true)));
923
957
  }
924
958
  }
925
959
  let h2 = null;
@@ -939,84 +973,84 @@ const xe = -10, pe = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
939
973
  n4 = r2.getColOffset(d3), d3 = Math.min(u2.right, r2.getColIndex(n4 + l3)), h2 = { left: r2.getColOffset(d3) - (n4 - t2.current.getScrollPosition().left) };
940
974
  }
941
975
  }
942
- const g3 = { rowIndex: a3, colIndex: d3 }, f3 = J2(g3), w2 = { rowIndex: f3.rowStart, colIndex: f3.colStart };
943
- n3 || (Je.current = g3);
944
- const x3 = k.isEqualCells(_e.current, w2) && k.isEqualCells(_e.current, i2);
976
+ const g3 = { rowIndex: a3, colIndex: d3 }, f3 = _2(g3), w2 = { rowIndex: f3.rowStart, colIndex: f3.colStart };
977
+ n3 || (Je2.current = g3);
978
+ const x3 = k.isEqualCells(_e2.current, w2) && k.isEqualCells(_e2.current, i2);
945
979
  if (n3 && !x3 ? rt(w2, i2) : lt(w2), h2) t2.current.scrollTo(h2);
946
980
  else {
947
- if (n3 && _e.current) {
948
- const t3 = ge2();
949
- if (e2 === T.Right && _e.current.colIndex === t3.left || e2 === T.Left && _e.current.colIndex === t3.right || e2 === T.Up && _e.current.rowIndex === t3.bottom || e2 === T.Down && _e.current.rowIndex === t3.top) return;
981
+ if (n3 && _e2.current) {
982
+ const t3 = he2();
983
+ if (e2 === T.Right && _e2.current.colIndex === t3.left || e2 === T.Left && _e2.current.colIndex === t3.right || e2 === T.Up && _e2.current.rowIndex === t3.bottom || e2 === T.Down && _e2.current.rowIndex === t3.top) return;
950
984
  }
951
985
  e2 === T.Left || e2 === T.Right ? et({ colIndex: g3.colIndex }) : e2 !== T.Up && e2 !== T.Down || et({ rowIndex: g3.rowIndex });
952
986
  }
953
- }, [$e2, J2]), xt = o((e2) => {
987
+ }, [$e2, _2]), xt = o((e2) => {
954
988
  if (!t2.current) return;
955
989
  if (0 === $e2.ranges.length) return void wt(e2);
956
- const n3 = J2($e2.cell);
990
+ const n3 = _2($e2.cell);
957
991
  if (k.isEqualRangesArrays([n3], $e2.ranges)) return void wt(e2);
958
- const o2 = oe($e2, e2, J2, De2, Oe2);
992
+ const o2 = se($e2, e2, _2, De2, Oe2);
959
993
  Le2((e3) => {
960
- Fe2.current = false, e3 = Se(e3);
994
+ Fe2.current = false, e3 = Re(e3);
961
995
  const t3 = { ...e3, cell: o2.cell, rangeIndex: o2.rangeIndex };
962
996
  return k.isEqualSelectionCoords(t3, e3) ? e3 : t3;
963
997
  }), o2.cell && et(o2.cell);
964
- }, [$e2, J2]), pt = v(() => {
965
- const e2 = ge2();
998
+ }, [$e2, _2]), pt = v(() => {
999
+ const e2 = he2();
966
1000
  rt({ rowIndex: e2.top }, { rowIndex: e2.bottom });
967
1001
  }, []), mt = v(() => {
968
- const e2 = ge2();
1002
+ const e2 = he2();
969
1003
  rt({ colIndex: e2.left }, { colIndex: e2.right });
970
1004
  }, []), vt = o(() => {
971
1005
  $e2.cell && t2?.current && et($e2.cell);
972
1006
  }, [$e2.cell]), St = v((e2 = false) => {
973
- const t3 = { rowIndex: ge2().top };
1007
+ const t3 = { rowIndex: he2().top };
974
1008
  e2 ? rt(t3) : lt(t3), et(t3);
975
1009
  }, []), yt = v((e2 = false) => {
976
- const t3 = { rowIndex: ge2().bottom };
1010
+ const t3 = { rowIndex: he2().bottom };
977
1011
  e2 ? rt(t3) : lt(t3), et(t3);
978
1012
  }, []), bt = v((e2 = false) => {
979
- const t3 = { colIndex: ge2().left };
1013
+ const t3 = { colIndex: he2().left };
980
1014
  e2 ? rt(t3) : lt(t3), et(t3);
981
1015
  }, []), Ct = v((e2 = false) => {
982
- const t3 = ge2(), n3 = { rowIndex: t3.top, colIndex: t3.left };
1016
+ const t3 = he2(), n3 = { rowIndex: t3.top, colIndex: t3.left };
983
1017
  e2 ? rt(n3) : lt(n3), et(n3);
984
1018
  }, []), It = v((e2 = false) => {
985
- const t3 = ge2(), n3 = { colIndex: W2?.()?.colEnd ?? t3.right };
1019
+ const t3 = he2(), n3 = { colIndex: A2?.()?.colEnd ?? t3.right };
986
1020
  e2 ? rt(n3) : lt(n3), et(n3);
987
- }, [W2]), Et = v((e2 = false) => {
988
- const t3 = ge2(), n3 = { rowIndex: W2?.()?.rowEnd ?? t3.bottom, colIndex: W2?.()?.colEnd ?? t3.right };
1021
+ }, [A2]), Et = v((e2 = false) => {
1022
+ const t3 = he2(), n3 = { rowIndex: A2?.()?.rowEnd ?? t3.bottom, colIndex: A2?.()?.colEnd ?? t3.right };
989
1023
  e2 ? rt(n3) : lt(n3), et(n3);
990
- }, [W2]), Rt = o((e2) => {
1024
+ }, [A2]), Rt = o((e2) => {
991
1025
  if (!t2.current) return;
992
1026
  if ($e2.ranges.length <= 1) return;
993
1027
  const n3 = e2 === T.Left || e2 === T.Up;
994
1028
  let o2 = $e2.rangeIndex + (n3 ? -1 : 1);
995
1029
  o2 < 0 ? o2 = $e2.ranges.length - 1 : o2 > $e2.ranges.length - 1 && (o2 = 0);
996
- const r3 = $e2.ranges[o2], l3 = oe({ cell: { rowIndex: r3.rowEnd, colIndex: r3.colEnd }, rangeIndex: 0, ranges: [r3] }, T.Right, J2, De2, Oe2);
1030
+ const r3 = $e2.ranges[o2], l3 = se({ cell: { rowIndex: r3.rowEnd, colIndex: r3.colEnd }, rangeIndex: 0, ranges: [r3] }, T.Right, _2, De2, Oe2);
997
1031
  Le2((e3) => {
998
- Fe2.current = false, e3 = Se(e3);
1032
+ Fe2.current = false, e3 = Re(e3);
999
1033
  const t3 = { ...e3, cell: l3.cell, rangeIndex: o2 };
1000
1034
  return k.isEqualSelectionCoords(t3, e3) ? e3 : t3;
1001
1035
  }), l3.cell && et(l3.cell);
1002
- }, [$e2, J2]), Mt = o(() => {
1003
- const e2 = ne($e2);
1036
+ }, [$e2, _2]), Mt = o(() => {
1037
+ const e2 = ce($e2);
1004
1038
  Le2((t3) => {
1005
- Fe2.current = false, t3 = Se(t3);
1039
+ Fe2.current = false, t3 = Re(t3);
1006
1040
  const n3 = { ...t3, visibleSelection: e2 };
1007
1041
  return k.isEqualSelectionCoords(n3, t3) ? t3 : n3;
1008
1042
  }), e2.cell && et(e2.cell);
1009
- }, [$e2, J2]), kt = o(() => {
1043
+ }, [$e2, _2]), kt = o(() => {
1010
1044
  if (!t2.current) return;
1011
1045
  if (0 === $e2.ranges.length) return;
1012
- const e2 = $e2.cell, n3 = $e2.ranges[$e2.rangeIndex], o2 = ne({ cell: e2, rangeIndex: 0, ranges: [n3] }), r3 = o2.ranges[o2.rangeIndex];
1046
+ const e2 = $e2.cell, n3 = $e2.ranges[$e2.rangeIndex], o2 = ce({ cell: e2, rangeIndex: 0, ranges: [n3] }), r3 = o2.ranges[o2.rangeIndex];
1013
1047
  let l3;
1014
1048
  l3 = r3.rowStart === e2.rowIndex && r3.colStart === e2.colIndex ? { rowIndex: r3.rowStart, colIndex: r3.colEnd } : r3.rowStart === e2.rowIndex && r3.colEnd === e2.colIndex ? { rowIndex: r3.rowEnd, colIndex: r3.colStart } : r3.rowEnd === e2.rowIndex && r3.colStart === e2.colIndex ? { rowIndex: r3.rowEnd, colIndex: r3.colEnd } : { rowIndex: r3.rowStart, colIndex: r3.colStart }, Le2((e3) => {
1015
- e3 = Se(e3);
1049
+ e3 = Re(e3);
1016
1050
  const t3 = { ...e3, cell: l3 };
1017
1051
  return k.isEqualSelectionCoords(t3, e3) ? e3 : t3;
1018
1052
  }), l3 && et(l3);
1019
- }, [$e2, J2]), Pt = v((e2 = false) => {
1053
+ }, [$e2, _2]), Pt = v((e2 = false) => {
1020
1054
  wt(T.Down, e2, false, t2.current.getDimensions().containerHeight);
1021
1055
  }, []), Dt = v((e2 = false) => {
1022
1056
  wt(T.Up, e2, false, t2.current.getDimensions().containerHeight);
@@ -1034,9 +1068,9 @@ const xe = -10, pe = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1034
1068
  xt(T.Down);
1035
1069
  }, []), Ft = v(() => {
1036
1070
  Rt(T.Left);
1037
- }, []), Wt = v(() => {
1038
- Rt(T.Right);
1039
1071
  }, []), At = v(() => {
1072
+ Rt(T.Right);
1073
+ }, []), Wt = v(() => {
1040
1074
  kt();
1041
1075
  }, []), Vt = v(() => {
1042
1076
  wt(T.Left, false, false);
@@ -1071,9 +1105,9 @@ const xe = -10, pe = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1071
1105
  }, []), tn = v(() => {
1072
1106
  wt(T.Down, true, true);
1073
1107
  }, []), nn = v(() => {
1074
- We2((e2) => e2.slice(0, -1));
1108
+ Ae2((e2) => e2.slice(0, -1));
1075
1109
  }, []), on = y(() => {
1076
- const e2 = ge2();
1110
+ const e2 = he2();
1077
1111
  return ((e3, t3, n3, o2, r3) => {
1078
1112
  for (let l3 = 0; l3 < e3.length; l3++) {
1079
1113
  const i2 = e3[l3];
@@ -1082,7 +1116,7 @@ const xe = -10, pe = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1082
1116
  return false;
1083
1117
  })($e2.ranges, e2.top, e2.left, e2.bottom, e2.right);
1084
1118
  }, [V2, $e2.ranges]), rn = v((e2, n3 = true) => {
1085
- _e.current = e2, Ae2(e2), n3 && e2 && t2?.current && et(e2);
1119
+ _e2.current = e2, We2(e2), n3 && e2 && t2?.current && et(e2);
1086
1120
  }, []), ln = o((e2 = true) => {
1087
1121
  const t3 = Ne2.current;
1088
1122
  if (!Be2.current?.cell) return;
@@ -1090,18 +1124,18 @@ const xe = -10, pe = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1090
1124
  if (!o2 || !t3) return;
1091
1125
  if (!t3) return;
1092
1126
  let r3 = null;
1093
- if (r3 = n3.length > 0 ? n3[n3.length - 1] : J2(o2), r3.colEnd >= r3.colStart && r3.rowEnd >= r3.rowStart) {
1094
- const n4 = re(r3, t3);
1095
- let o3 = e2 ? Ce2 : Ie2;
1127
+ if (r3 = n3.length > 0 ? n3[n3.length - 1] : _2(o2), r3.colEnd >= r3.colStart && r3.rowEnd >= r3.rowStart) {
1128
+ const n4 = ae(r3, t3);
1129
+ let o3 = e2 ? ge2 : fe2;
1096
1130
  try {
1097
1131
  o3?.(r3, t3, n4.direction);
1098
1132
  } catch (e3) {
1099
1133
  console.warn(e3);
1100
1134
  } finally {
1101
- e2 && Re2?.();
1135
+ e2 && xe2?.();
1102
1136
  }
1103
1137
  }
1104
- }, [J2]), cn = w(null), sn = y(() => ({ onPointerDown: (e2, n3) => {
1138
+ }, [_2]), cn = w(null), sn = y(() => ({ onPointerDown: (e2, n3) => {
1105
1139
  if (ut.current = n3, !t2 || !t2.current) return false;
1106
1140
  const o2 = t2.current.getViewFromClient(e2.nativeEvent.clientX, e2.nativeEvent.clientY), r3 = o2?.getCellCoordsFromClient(e2.nativeEvent.clientX, e2.nativeEvent.clientY);
1107
1141
  r3 && (e2.stopPropagation(), Ue2("crosshair"), cn.current = { anchor: o2.getAnchor(), coords: r3 });
@@ -1114,11 +1148,11 @@ const xe = -10, pe = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1114
1148
  const i2 = Be2.current.ranges;
1115
1149
  let c2 = nt(Be2.current.cell, l3);
1116
1150
  if (!c2) return;
1117
- const s2 = i2.length > 0, a3 = s2 ? i2[i2.length - 1] : J2(Be2.current.cell);
1151
+ const s2 = i2.length > 0, a3 = s2 ? i2[i2.length - 1] : _2(Be2.current.cell);
1118
1152
  if (!c2) return;
1119
- const d3 = c2.rowStart < a3.rowStart ? T.Up : c2.rowEnd > a3.rowEnd ? T.Down : c2.colEnd > a3.colEnd ? T.Right : T.Left, u2 = ge2();
1153
+ const d3 = c2.rowStart < a3.rowStart ? T.Up : c2.rowEnd > a3.rowEnd ? T.Down : c2.colEnd > a3.colEnd ? T.Right : T.Left, u2 = he2();
1120
1154
  d3 === T.Left && (c2 = { ...a3, colStart: Math.max(u2.left, c2.colStart) }), d3 === T.Up && (c2 = { ...a3, rowStart: Math.max(u2.top, c2.rowStart) }), d3 === T.Right && (c2 = { ...a3, colEnd: Math.min(u2.right, c2.colEnd) }), d3 === T.Down && (c2 = { ...a3, rowEnd: Math.min(u2.bottom, c2.rowEnd) });
1121
- const h2 = re(a3, c2);
1155
+ const h2 = ae(a3, c2);
1122
1156
  if (!N2?.(a3)) {
1123
1157
  let e3;
1124
1158
  "function" == typeof Qe.current ? e3 = Qe.current(a3) : K2 && (e3 = K2), c2 = ((e4, t3, n4, o3, r4, l4) => {
@@ -1143,19 +1177,19 @@ const xe = -10, pe = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1143
1177
  if (s2 && k.isRangeWithinRange(c2, a3) && (c2 = null), !k.isEqualRanges(c2, Ne2.current)) {
1144
1178
  if (Ke2(c2), Ne2.current = c2, !c2) {
1145
1179
  try {
1146
- Ee2?.();
1180
+ we2?.();
1147
1181
  } catch (e3) {
1148
1182
  }
1149
- return void Re2?.();
1183
+ return void xe2?.();
1150
1184
  }
1151
1185
  ln(false);
1152
1186
  }
1153
- ut.current = n3, ye(r3, l3, t2);
1187
+ ut.current = n3, Me(r3, l3, t2);
1154
1188
  }, onPointerUp: (e2, n3) => {
1155
1189
  ut.current = n3, Promise.resolve(ln(true)).finally(() => {
1156
- Re2?.(), Ke2(null), Ne2.current = null, cn.current = null, Ue2(null), t2.current?.focus();
1190
+ xe2?.(), Ke2(null), Ne2.current = null, cn.current = null, Ue2(null), t2.current?.focus();
1157
1191
  });
1158
- } }), [J2]), an = s(sn), dn = y(() => ({ onPointerDown: an }), [an]), [un, hn] = p(null), gn = w(null), fn = y(() => ({ onPointerDown: (e2, n3) => {
1192
+ } }), [_2]), an = s(sn), dn = y(() => ({ onPointerDown: an }), [an]), [un, hn] = p(null), gn = w(null), fn = y(() => ({ onPointerDown: (e2, n3) => {
1159
1193
  if (ut.current = n3, !t2 || !t2.current) return false;
1160
1194
  const o2 = t2.current.getViewFromClient(e2.nativeEvent.clientX, e2.nativeEvent.clientY), r3 = o2?.getCellCoordsFromClient(e2.nativeEvent.clientX, e2.nativeEvent.clientY);
1161
1195
  if (!r3) return;
@@ -1164,14 +1198,14 @@ const xe = -10, pe = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1164
1198
  const l3 = o2.getRelativePointFromClient(0, 0), i2 = Be2.current?.ranges[Be2.current?.ranges.length - 1] ?? k.cellToRange(Be2.current?.cell), c2 = o2.toClipBounds(o2.getRangeCoordsBounds(i2)), s2 = { x: 0, y: 0 };
1165
1199
  c2.x - l3.x > e2.nativeEvent.clientX ? s2.x = e2.nativeEvent.clientX - (c2.x - l3.x) : e2.nativeEvent.clientX >= c2.x - l3.x + c2.width && (s2.x = Math.max(0, e2.nativeEvent.clientX - (c2.x - l3.x + c2.width)) + 1), c2.y - l3.y > e2.nativeEvent.clientY ? s2.y = e2.nativeEvent.clientY - (c2.y - l3.y) : e2.nativeEvent.clientY >= c2.y - l3.y + c2.height && (s2.y = Math.max(0, e2.nativeEvent.clientY - (c2.y - l3.y + c2.height)) + 1), q2?.(i2, e2.nativeEvent, n3), gn.current = { range: i2, anchor: o2.getAnchor(), cell: r3, isMoving: false, extrusion: s2 };
1166
1200
  }, onPointerMoveOrWait: (e2, n3, o2) => {
1167
- if (_2 || !t2?.current || !Be2.current || !gn.current) return;
1201
+ if (Z2 || !t2?.current || !Be2.current || !gn.current) return;
1168
1202
  const r3 = e2.clientX - o2.clientX, l3 = e2.clientY - o2.clientY;
1169
1203
  if (gn.current.isMoving = gn.current.isMoving || Math.abs(r3) > Math.max(1, 2) || Math.abs(l3) > Math.max(1, 2) || performance.now() - o2.timeStamp > 500, !gn.current.isMoving) return;
1170
1204
  const i2 = gn.current.anchor, c2 = gn.current.extrusion;
1171
1205
  let s2 = t2.current.getViewFromLocation(i2), a3 = s2.getCellCoordsFromClient(e2.clientX - c2.x, e2.clientY - c2.y, true);
1172
1206
  if (!a3) return;
1173
- const d3 = gn.current.cell, u2 = gn.current.range, h2 = ge2(), g3 = u2.colEnd - u2.colStart + 1, f3 = Math.min(Math.max(0, d3.colIndex - u2.colStart), g3 - 1), w2 = Math.min(h2.right - g3 + 1, Math.max(h2.left, a3.colIndex - f3)), x3 = u2.rowEnd - u2.rowStart + 1, p2 = Math.min(Math.max(0, d3.rowIndex - u2.rowStart), x3 - 1), m2 = Math.min(h2.bottom - x3 + 1, Math.max(h2.top, a3.rowIndex - p2)), v2 = { colStart: w2, colEnd: w2 + g3 - 1, rowStart: m2, rowEnd: m2 + x3 - 1 };
1174
- k.isEqualRanges(un, v2) && !((e3) => !e3 || !ut.current || ut.current.ctrlKey !== e3.ctrlKey || ut.current.shiftKey !== e3.shiftKey || ut.current.altKey !== e3.altKey || ut.current.metaKey !== e3.metaKey)(e2) || (hn(v2), j2?.(v2, e2, n3)), ut.current = n3, ye(s2, a3, t2);
1207
+ const d3 = gn.current.cell, u2 = gn.current.range, h2 = he2(), g3 = u2.colEnd - u2.colStart + 1, f3 = Math.min(Math.max(0, d3.colIndex - u2.colStart), g3 - 1), w2 = Math.min(h2.right - g3 + 1, Math.max(h2.left, a3.colIndex - f3)), x3 = u2.rowEnd - u2.rowStart + 1, p2 = Math.min(Math.max(0, d3.rowIndex - u2.rowStart), x3 - 1), m2 = Math.min(h2.bottom - x3 + 1, Math.max(h2.top, a3.rowIndex - p2)), v2 = { colStart: w2, colEnd: w2 + g3 - 1, rowStart: m2, rowEnd: m2 + x3 - 1 };
1208
+ k.isEqualRanges(un, v2) && !((e3) => !e3 || !ut.current || ut.current.ctrlKey !== e3.ctrlKey || ut.current.shiftKey !== e3.shiftKey || ut.current.altKey !== e3.altKey || ut.current.metaKey !== e3.metaKey)(e2) || (hn(v2), j2?.(v2, e2, n3)), ut.current = n3, Me(s2, a3, t2);
1175
1209
  }, onPointerUp: (e2, n3) => {
1176
1210
  ut.current = n3;
1177
1211
  const o2 = () => {
@@ -1187,184 +1221,184 @@ const xe = -10, pe = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1187
1221
  return pn.current = e2, e2;
1188
1222
  }, [$e2]), vn = v((n3) => {
1189
1223
  let o2 = null, r3 = "br";
1190
- const l3 = [], i2 = { stroke: z2, fill: ie2, strokeWidth: 0.5 }, c2 = (e2, t3, o3) => {
1191
- const r4 = n3.toClipBounds(n3.getRangeCoordsBounds(e2), xe);
1224
+ const l3 = [], i2 = { stroke: z2, fill: te2, strokeWidth: 0.5 }, c2 = (e2, t3, o3) => {
1225
+ const r4 = n3.toClipBounds(n3.getRangeCoordsBounds(e2), be);
1192
1226
  if (!r4) return;
1193
1227
  r4.x = r4.width > 0 ? r4.x : r4.x - i2.strokeWidth / 2, r4.y = r4.height > 0 ? r4.y : r4.y - i2.strokeWidth / 2, r4.width = Math.max(r4.width, i2.strokeWidth), r4.height = Math.max(r4.height, i2.strokeWidth);
1194
1228
  const l4 = { key: `selection-fill-${t3}`, range: e2, ...r4, ...i2 };
1195
1229
  if (o3) {
1196
1230
  const e3 = n3.getCellCoordsAsRangeCoords(o3);
1197
- l4.cell = o3, l4.pathBounds = n3.toClipBounds(n3.getRangeCoordsBounds(e3), xe), l4.pathBounds && (l4.pathBounds.width <= 0 || l4.pathBounds.height <= 0) && (delete l4.pathBounds, delete l4.cell);
1231
+ l4.cell = o3, l4.pathBounds = n3.toClipBounds(n3.getRangeCoordsBounds(e3), be), l4.pathBounds && (l4.pathBounds.width <= 0 || l4.pathBounds.height <= 0) && (delete l4.pathBounds, delete l4.cell);
1198
1232
  }
1199
- return ke2(l4);
1233
+ return Se2(l4);
1200
1234
  };
1201
- let s2 = $e2 ? Se($e2) : null;
1202
- const a3 = s2?.cell ? n3.getCellCoordsAsRangeCoords(s2?.cell) : pe;
1235
+ let s2 = $e2 ? Re($e2) : null;
1236
+ const a3 = s2?.cell ? n3.getCellCoordsAsRangeCoords(s2?.cell) : Ce;
1203
1237
  !s2 || s2.ranges && 0 !== s2.ranges.length || (s2 = { ranges: [a3], rangeIndex: 0, cell: s2.cell });
1204
1238
  for (let e2 = 0; s2 && e2 < s2.ranges.length; e2++) {
1205
1239
  const t3 = s2.ranges[e2], i3 = c2(t3, e2, e2 === s2.rangeIndex ? s2.cell : null);
1206
1240
  i3 && l3.push(i3);
1207
- const a4 = 2, d4 = 0.5, u3 = n3.toClipBounds(n3.getRangeCoordsBounds(t3, { top: 0, left: 0, right: 0, bottom: 0 }), xe);
1241
+ const a4 = 2, d4 = 0.5, u3 = n3.toClipBounds(n3.getRangeCoordsBounds(t3, { top: 0, left: 0, right: 0, bottom: 0 }), be);
1208
1242
  if (u3) {
1209
1243
  const n4 = (s2.ranges.length, 4);
1210
- l3.push(ke2({ range: t3, key: `selection-inside-edge-${e2}`, x: u3.x - 1, y: u3.y - 1, width: Math.max(u3.width + 1, 0), height: Math.max(u3.height + 1, 0), style: { overflow: "hidden" }, stroke: z2, strokeWidth: n4 }));
1244
+ l3.push(Se2({ range: t3, key: `selection-inside-edge-${e2}`, x: u3.x - 1, y: u3.y - 1, width: Math.max(u3.width + 1, 0), height: Math.max(u3.height + 1, 0), style: { overflow: "hidden" }, stroke: z2, strokeWidth: n4 }));
1211
1245
  }
1212
1246
  if (1 === s2.ranges.length) {
1213
- const o3 = n3.toClipBounds(n3.getRangeCoordsBounds(t3), xe);
1247
+ const o3 = n3.toClipBounds(n3.getRangeCoordsBounds(t3), be);
1214
1248
  if (o3) {
1215
- _2 || l3.push(ke2({ range: t3, key: `move-selection-hit-box-${e2}`, x: o3.width > 1 ? o3.x : o3.x - (ee2 / 2 + 1), y: o3.height > 1 ? o3.y : o3.y - (ee2 / 2 + 1), width: Math.max(o3.width + 2, 1), height: Math.max(o3.height + 2, 1), stroke: "transparent", style: { boxShadow: "none" }, pathProps: { cursor: un ? void 0 : "move", pointerEvents: "stroke" }, strokeWidth: ee2, ...xn }));
1249
+ Z2 || l3.push(Se2({ range: t3, key: `move-selection-hit-box-${e2}`, x: o3.width > 1 ? o3.x : o3.x - (J2 / 2 + 1), y: o3.height > 1 ? o3.y : o3.y - (J2 / 2 + 1), width: Math.max(o3.width + 2, 1), height: Math.max(o3.height + 2, 1), stroke: "transparent", style: { boxShadow: "none" }, pathProps: { cursor: un ? void 0 : "move", pointerEvents: "stroke" }, strokeWidth: J2, ...xn }));
1216
1250
  const n4 = a4;
1217
- l3.push(ke2({ range: t3, key: `selection-single-${e2}`, x: o3.x - n4 / 2, y: o3.y - n4 / 2, width: Math.max(o3.width + n4 / 2, 1), height: Math.max(o3.height + n4 / 2, 1), stroke: ce2, strokeWidth: n4 }));
1251
+ l3.push(Se2({ range: t3, key: `selection-single-${e2}`, x: o3.x - n4 / 2, y: o3.y - n4 / 2, width: Math.max(o3.width + n4 / 2, 1), height: Math.max(o3.height + n4 / 2, 1), stroke: ne2, strokeWidth: n4 }));
1218
1252
  }
1219
1253
  } else {
1220
- const o3 = n3.toClipBounds(n3.getRangeCoordsBounds(t3, { top: -1, left: -1, right: -2, bottom: -2 }), xe);
1221
- o3 && l3.push(ke2({ range: t3, key: `selection-multi-${e2}`, x: o3.width > 1 ? o3.x : o3.x - d4 / 2, y: o3.height > 1 ? o3.y : o3.y - d4 / 2, width: Math.max(o3.width, d4) + 1, height: Math.max(o3.height, d4) + 1, stroke: ce2, style: { overflow: "hidden" }, strokeWidth: 2 }));
1254
+ const o3 = n3.toClipBounds(n3.getRangeCoordsBounds(t3, { top: -1, left: -1, right: -2, bottom: -2 }), be);
1255
+ o3 && l3.push(Se2({ range: t3, key: `selection-multi-${e2}`, x: o3.width > 1 ? o3.x : o3.x - d4 / 2, y: o3.height > 1 ? o3.y : o3.y - d4 / 2, width: Math.max(o3.width, d4) + 1, height: Math.max(o3.height, d4) + 1, stroke: ne2, style: { overflow: "hidden" }, strokeWidth: 2 }));
1222
1256
  }
1223
1257
  if (s2.ranges.length > 1 && e2 === s2.rangeIndex) {
1224
- const o3 = n3.getCellCoordsAsRangeCoords(s2.cell), r4 = n3.toClipBounds(n3.getRangeCoordsBounds(o3, { top: 1, left: 1, right: -1, bottom: -1 }), xe);
1225
- r4 && l3.push(ke2({ range: t3, key: `selection-anchor-${e2}`, x: r4.x, y: r4.y, width: Math.max(r4.width, d4), height: Math.max(r4.height, d4), stroke: ce2, style: { overflow: "hidden" }, strokeWidth: 2 }));
1258
+ const o3 = n3.getCellCoordsAsRangeCoords(s2.cell), r4 = n3.toClipBounds(n3.getRangeCoordsBounds(o3, { top: 1, left: 1, right: -1, bottom: -1 }), be);
1259
+ r4 && l3.push(Se2({ range: t3, key: `selection-anchor-${e2}`, x: r4.x, y: r4.y, width: Math.max(r4.width, d4), height: Math.max(r4.height, d4), stroke: ne2, style: { overflow: "hidden" }, strokeWidth: 2 }));
1226
1260
  }
1227
1261
  if (e2 === s2.ranges.length - 1) {
1228
1262
  o2 = null, r3 = null;
1229
- const e3 = t3.rowStart === ge2().top && t3.rowEnd === ge2().bottom, l4 = t3.colStart === ge2().left && t3.colEnd === ge2().right, i4 = n3.getRangeCoordsBounds(t3);
1263
+ const e3 = t3.rowStart === he2().top && t3.rowEnd === he2().bottom, l4 = t3.colStart === he2().left && t3.colEnd === he2().right, i4 = n3.getRangeCoordsBounds(t3);
1230
1264
  let c3 = null;
1231
1265
  if (e3 || l4) {
1232
- if (c3 = n3.toClipBounds(i4, xe), Object.keys(n3.allViews()).length > 1) {
1266
+ if (c3 = n3.toClipBounds(i4, be), Object.keys(n3.allViews()).length > 1) {
1233
1267
  const o3 = n3.getVisibleRangeCoords(), r4 = n3.allViews()[O.TopLeft], i5 = n3.allViews()[O.Top], s3 = n3.allViews()[O.Left], a5 = n3.getAnchor();
1234
1268
  (l4 && (a5 === O.Top && r4 || a5 === O.Center && s3 || !k.isCellWithinRange({ colIndex: t3.colStart, rowIndex: t3.rowEnd }, o3) && !k.isCellWithinRange({ colIndex: t3.colStart, rowIndex: t3.rowEnd + 1 }, o3)) || e3 && (a5 === O.Left && r4 || a5 === O.Center && i5 || !k.isCellWithinRange({ colIndex: t3.colEnd, rowIndex: t3.rowStart }, o3) && !k.isCellWithinRange({ colIndex: t3.colEnd + 1, rowIndex: t3.rowStart }, o3))) && (c3 = null);
1235
1269
  }
1236
- } else c3 = n3.toClipBounds(i4, xe);
1270
+ } else c3 = n3.toClipBounds(i4, be);
1237
1271
  if (!c3 || 0 === c3.width || 0 === c3.height) continue;
1238
- o2 = { x: c3.x + c3.width + 1, y: c3.y + c3.height + 1 }, 0 === c3.width || 0 === c3.height || t3.rowStart === ge2().top && t3.colStart === ge2().left && t3.rowEnd === ge2().bottom && t3.colEnd === ge2().right || (e3 ? (o2.y = a4, r3 = "tr") : l4 && (o2.x = a4, r3 = "bl"));
1272
+ o2 = { x: c3.x + c3.width + 1, y: c3.y + c3.height + 1 }, 0 === c3.width || 0 === c3.height || t3.rowStart === he2().top && t3.colStart === he2().left && t3.rowEnd === he2().bottom && t3.colEnd === he2().right || (e3 ? (o2.y = a4, r3 = "tr") : l4 && (o2.x = a4, r3 = "bl"));
1239
1273
  }
1240
1274
  }
1241
1275
  let d3 = null;
1242
1276
  if (qe2) {
1243
- const e2 = n3.toClipBounds(n3.getRangeCoordsBounds(qe2, { top: 0, left: 0, right: 0, bottom: 0 }), xe);
1277
+ const e2 = n3.toClipBounds(n3.getRangeCoordsBounds(qe2, { top: 0, left: 0, right: 0, bottom: 0 }), be);
1244
1278
  if (e2) {
1245
1279
  const t3 = 2;
1246
- d3 = ke2({ ...i2, range: qe2, key: "remove-selection", x: e2.x, y: e2.y, width: e2.width, height: e2.height, strokeWidth: t3, stroke: se2, fill: ae2 });
1280
+ d3 = Se2({ ...i2, range: qe2, key: "remove-selection", x: e2.x, y: e2.y, width: e2.width, height: e2.height, strokeWidth: t3, stroke: oe2, fill: le2 });
1247
1281
  }
1248
1282
  }
1249
1283
  let u2 = null;
1250
1284
  if (He2) {
1251
- const e2 = n3.toClipBounds(n3.getRangeCoordsBounds(He2, { top: 0, left: 0, right: 0, bottom: 0 }), xe);
1285
+ const e2 = n3.toClipBounds(n3.getRangeCoordsBounds(He2, { top: 0, left: 0, right: 0, bottom: 0 }), be);
1252
1286
  if (e2) {
1253
1287
  const t3 = 2;
1254
- u2 = ke2({ range: He2, key: "selection-fill-outline", x: e2.x - t3 / 2, y: e2.y - t3 / 2, width: e2.width + t3 / 2, height: e2.height + t3 / 2, strokeWidth: t3, stroke: ce2, strokeDasharray: "3 2" });
1288
+ u2 = Se2({ range: He2, key: "selection-fill-outline", x: e2.x - t3 / 2, y: e2.y - t3 / 2, width: e2.width + t3 / 2, height: e2.height + t3 / 2, strokeWidth: t3, stroke: ne2, strokeDasharray: "3 2" });
1255
1289
  }
1256
1290
  }
1257
1291
  let h2 = null;
1258
- !D2 && o2 && !un && (h2 = I(fe, { ...o2, corner: r3, size: 7.5, borderStroke: `${z2} solid`, style: { borderRadius: 1 }, background: ce2, ...dn, key: "fillHandle" }));
1292
+ !D2 && o2 && !un && (h2 = I(ve, { ...o2, corner: r3, size: 7.5, borderStroke: `${z2} solid`, style: { borderRadius: 1 }, background: ne2, ...dn, key: "fillHandle" }));
1259
1293
  const g3 = [...l3];
1260
- if (d3 && g3.push(d3), u2 && g3.push(u2), h2 && g3.push(h2), !de2 && st && 1 === s2?.ranges.length && s2.ranges[s2.ranges.length - 1]) {
1261
- const o3 = s2.ranges[s2.ranges.length - 1], r4 = o3.rowStart === ge2().top && o3.rowEnd === ge2().bottom, l4 = o3.colStart === ge2().left && o3.colEnd === ge2().right, i3 = { view: n3, range: o3, borderStroke: `${ce2} solid`, background: z2, selectionTouchPointerHandler: ft, ...ue2, onTouchSelectStart: (e2) => Ze(e2), onTouchSelectEnd: () => Ze(null), currentTouchAnchor: Ge };
1262
- g3.push(e(we, { anchor: l4 ? "b" : r4 ? "r" : "br", scrollableElement: t2.current, ...i3 }, "touch-select-handle-after")), g3.push(e(we, { anchor: l4 ? "t" : r4 ? "l" : "tl", scrollableElement: t2.current, ...i3 }, "touch-select-handle-before"));
1294
+ if (d3 && g3.push(d3), u2 && g3.push(u2), h2 && g3.push(h2), !ie2 && st && 1 === s2?.ranges.length && s2.ranges[s2.ranges.length - 1]) {
1295
+ const o3 = s2.ranges[s2.ranges.length - 1], r4 = o3.rowStart === he2().top && o3.rowEnd === he2().bottom, l4 = o3.colStart === he2().left && o3.colEnd === he2().right, i3 = { view: n3, range: o3, borderStroke: `${ne2} solid`, background: z2, selectionTouchPointerHandler: ft, ...ue2, onTouchSelectStart: (e2) => Ze2(e2), onTouchSelectEnd: () => Ze2(null), currentTouchAnchor: Ge2 };
1296
+ g3.push(e(ye, { anchor: l4 ? "b" : r4 ? "r" : "br", scrollableElement: t2.current, ...i3 }, "touch-select-handle-after")), g3.push(e(ye, { anchor: l4 ? "t" : r4 ? "l" : "tl", scrollableElement: t2.current, ...i3 }, "touch-select-handle-before"));
1263
1297
  }
1264
1298
  if (un) {
1265
- const e2 = n3.toClipBounds(n3.getRangeCoordsBounds(un, { top: 1, left: 1, right: 1, bottom: 1 }), xe);
1266
- e2 && g3.push(ke2({ range: un, key: "selection-move-outline", x: e2.x - te2 / 2, y: e2.y - te2 / 2, width: Math.max(e2.width + te2 / 2, 1), height: Math.max(e2.height + te2 / 2, 1), stroke: ce2, style: { boxShadow: "none", transitionDuration: "70ms", transitionTimingFunction: "ease-in", transitionProperty: "left, top, width, height", willChange: "left, top, width, height" }, strokeWidth: te2 }));
1299
+ const e2 = n3.toClipBounds(n3.getRangeCoordsBounds(un, { top: 1, left: 1, right: 1, bottom: 1 }), be);
1300
+ e2 && g3.push(Se2({ range: un, key: "selection-move-outline", x: e2.x - Q2 / 2, y: e2.y - Q2 / 2, width: Math.max(e2.width + Q2 / 2, 1), height: Math.max(e2.height + Q2 / 2, 1), stroke: ne2, style: { boxShadow: "none", transitionDuration: "70ms", transitionTimingFunction: "ease-in", transitionProperty: "left, top, width, height", willChange: "left, top, width, height" }, strokeWidth: Q2 }));
1267
1301
  }
1268
1302
  return e("div", { children: g3 }, "selection");
1269
- }, [mn, qe2, D2, He2, _2, un, ge2, z2, ce2, ie2, se2, ae2, de2, ue2, Ge]), Sn = y(() => {
1303
+ }, [mn, qe2, D2, He2, Z2, un, he2, z2, ne2, te2, oe2, le2, ie2, ue2, Ge2]), Sn = y(() => {
1270
1304
  const e2 = () => t2.current;
1271
1305
  return [new u("moveToPageDown", e2, { label: "Page Down", description: "Shift viewport down one page.", shortcut: [{ key: "PageDown" }] }, () => Pt(false)), new u("selectToPageDown", e2, { label: "Select To Page Down", description: "Shift viewport and select down one page.", shortcut: [{ key: "PageDown", modifiers: [h.Shift] }] }, () => Pt(true)), new u("moveToPageRight", e2, { label: "Page Right", description: "Shift viewport right one page.", shortcut: [{ key: "PageDown", modifiers: [h.Alt] }] }, () => Tt(false)), new u("selectToPageRight", e2, { label: "Page Right", description: "Shift viewport right one page.", shortcut: [{ key: "PageDown", modifiers: [h.Alt, h.Shift] }] }, () => Tt(true)), new u("moveToPageUp", e2, { label: "Page Up", description: "Shift viewport up one page.", shortcut: [{ key: "PageUp" }] }, () => Dt(false)), new u("selectToPageUp", e2, { label: "Page Up", description: "Shift viewport up one page.", shortcut: [{ key: "PageUp", modifiers: [h.Shift] }] }, () => Dt(true)), new u("moveToPageLeft", e2, { label: "Page Left", description: "Shift viewport left one page.", shortcut: [{ key: "PageUp", modifiers: [h.Alt] }] }, () => Ot(false)), new u("selectToPageLeft", e2, { label: "Page Left", description: "Shift viewport left one page.", shortcut: [{ key: "PageUp", modifiers: [h.Alt, h.Shift] }] }, () => Ot(true)), new u("selectColumn", e2, { label: "Select Column", description: "Select the columns for the selected cells.", shortcut: { key: "Space", modifiers: [h.Ctrl] } }, pt), new u("selectRow", e2, { label: "Select Row", description: "Select the rows for the selected cells.", shortcut: { key: "Space", modifiers: [h.Shift] } }, mt), new u("selectToColumnStart", e2, { label: "Select To Column Start", description: "Select the columns to the beginning of the sheet." }, () => St(true)), new u("selectToColumnEnd", e2, { label: "Select To Column End", description: "Select the columns to the end of the sheet." }, () => yt(true)), new u("moveToRowStart", e2, { label: "Move to Row Home", description: "Move to the beginning of the row.", shortcut: [{ key: "Home" }] }, () => bt(false)), new u("selectToRowStart", e2, { label: "Select to Row Home", description: "Select to the beginning of the row.", shortcut: [{ key: "Home", modifiers: [h.Shift] }] }, () => bt(true)), new u("moveToSheetStart", e2, { label: "Move to Sheet Home", description: "Move to the beginning of the sheet.", shortcut: [{ key: "Home", modifiers: [h.Ctrl] }] }, () => Ct(false)), new u("selectToSheetStart", e2, { label: "Select to Sheet Home", description: "Select to the beginning of the sheet.", shortcut: [{ key: "Home", modifiers: [h.Ctrl, h.Shift] }] }, () => Ct(true)), new u("moveToRowEnd", e2, { label: "Move to Row End", description: "Move to the end of the row.", shortcut: [{ key: "End" }] }, () => It(false)), new u("selectToRowEnd", e2, { label: "Select to Row End", description: "Select to the end of the row.", shortcut: [{ key: "End", modifiers: [h.Shift] }] }, () => It(true)), new u("moveToSheetEnd", e2, { label: "Move to Sheet End", description: "Move to the end of the sheet.", shortcut: [{ key: "End", modifiers: [h.Ctrl] }] }, () => Et(false)), new u("selectToSheetEnd", e2, { label: "Select to Sheet End", description: "Select to the end of the sheet.", shortcut: [{ key: "End", modifiers: [h.Ctrl, h.Shift] }] }, () => Et(true)), new u("scrollToActiveCoords", e2, { label: "Scroll to Active Cell", description: "Scroll to the Active Cell.", shortcut: { key: "Backspace", modifiers: [h.Ctrl] } }, vt), new u("scrollToActiveCoordsClearSelection", e2, { label: "Scroll to Active Cell", description: "Scroll to the Active Cell and clear selection.", shortcut: { key: "Backspace", modifiers: [h.Shift] } }, () => {
1272
1306
  ct(), rn($e2.cell, true);
1273
- }), new u("traverseSelectionRight", e2, { label: "Traverse Right", description: "Traverse the selection moving rightward.", shortcut: { key: "Tab" } }, Lt), new u("traverseSelectionLeft", e2, { label: "Traverse Left", description: "Traverse the selection moving leftward.", shortcut: { key: "Tab", modifiers: [h.Shift] } }, zt), new u("traverseSelectionDown", e2, { label: "Traverse Down", description: "Traverse the selection moving downward.", shortcut: [{ key: "Enter" }, { key: "NumpadEnter" }] }, Bt), new u("traverseSelectionUp", e2, { label: "Traverse Up", description: "Traverse the selection moving upward.", shortcut: [{ key: "Enter", modifiers: [h.Shift] }, { key: "NumpadEnter", modifiers: [h.Shift] }] }, $t), new u("moveLeft", e2, { label: "Move Left", description: "Move active cell to the left.", shortcut: [{ key: "ArrowLeft" }] }, Vt), new u("selectLeft", e2, { label: "Select Left", description: "Extend selection left.", shortcut: [{ key: "ArrowLeft", modifiers: [h.Shift] }] }, Ut), new u("moveContentfulLeft", e2, { label: "Move Left Contentful", description: "Move left to the next cell with content.", shortcut: [{ key: "ArrowLeft", modifiers: [h.Ctrl] }] }, Ht), new u("selectContentfulLeft", e2, { label: "Select Left Contentful", description: "Extend selection left to the next cell with content.", shortcut: [{ key: "ArrowLeft", modifiers: [h.Ctrl, h.Shift] }] }, Kt), new u("moveRight", e2, { label: "Move Right", description: "Move active cell to the right.", shortcut: [{ key: "ArrowRight" }] }, Nt), new u("selectRight", e2, { label: "Select Right", description: "Extend selection right.", shortcut: [{ key: "ArrowRight", modifiers: [h.Shift] }] }, qt), new u("moveContentfulRight", e2, { label: "Move Right Contentful", description: "Move right to the next cell with content.", shortcut: [{ key: "ArrowRight", modifiers: [h.Ctrl] }] }, jt), new u("selectContentfulRight", e2, { label: "Select Right Contentful", description: "Extend selection right to the next cell with content.", shortcut: [{ key: "ArrowRight", modifiers: [h.Ctrl, h.Shift] }] }, Xt), new u("moveUp", e2, { label: "Move Up", description: "Move active cell to the up.", shortcut: [{ key: "ArrowUp" }] }, Yt), new u("selectUp", e2, { label: "Select Up", description: "Extend selection up.", shortcut: [{ key: "ArrowUp", modifiers: [h.Shift] }] }, Gt), new u("moveContentfulUp", e2, { label: "Move Up Contentful", description: "Move up to the next cell with content.", shortcut: [{ key: "ArrowUp", modifiers: [h.Ctrl] }] }, Zt), new u("selectContentfulUp", e2, { label: "Select Up Contentful", description: "Extend selection up to the next cell with content.", shortcut: [{ key: "ArrowUp", modifiers: [h.Ctrl, h.Shift] }] }, _t), new u("moveDown", e2, { label: "Move Down", description: "Move active cell to the down.", shortcut: [{ key: "ArrowDown" }] }, Jt), new u("selectDown", e2, { label: "Select Down", description: "Extend selection down.", shortcut: [{ key: "ArrowDown", modifiers: [h.Shift] }] }, Qt), new u("moveContentfulDown", e2, { label: "Move Down Contentful", description: "Move down to the next cell with content.", shortcut: [{ key: "ArrowDown", modifiers: [h.Ctrl] }] }, en), new u("selectContentfulDown", e2, { label: "Select Down Contentful", description: "Extend selection down to the next cell with content.", shortcut: [{ key: "ArrowDown", modifiers: [h.Ctrl, h.Shift] }] }, tn), new u("selectVisible", e2, { label: "Select Visible", description: "Select visible cells only.", shortcut: { key: ";", modifiers: [h.Alt] } }, Mt), new u("traverseSelectionPreviousRange", e2, { label: "Traverse Previous Range", description: "Traverse the selection to the previous range.", shortcut: { key: "ArrowLeft", modifiers: [h.Ctrl, h.Alt] } }, Ft), new u("traverseSelectionNextRange", e2, { label: "Traverse Next Range", description: "Traverse the selection to the next range.", shortcut: { key: "ArrowRight", modifiers: [h.Ctrl, h.Alt] } }, Wt), new u("traverseSelectionCorners", e2, { label: "Traverse Corners", description: "Traverse the selection through the corners of the selected range.", shortcut: { key: ".", modifiers: [h.Ctrl] } }, At)];
1307
+ }), new u("traverseSelectionRight", e2, { label: "Traverse Right", description: "Traverse the selection moving rightward.", shortcut: { key: "Tab" } }, Lt), new u("traverseSelectionLeft", e2, { label: "Traverse Left", description: "Traverse the selection moving leftward.", shortcut: { key: "Tab", modifiers: [h.Shift] } }, zt), new u("traverseSelectionDown", e2, { label: "Traverse Down", description: "Traverse the selection moving downward.", shortcut: [{ key: "Enter" }, { key: "NumpadEnter" }] }, Bt), new u("traverseSelectionUp", e2, { label: "Traverse Up", description: "Traverse the selection moving upward.", shortcut: [{ key: "Enter", modifiers: [h.Shift] }, { key: "NumpadEnter", modifiers: [h.Shift] }] }, $t), new u("moveLeft", e2, { label: "Move Left", description: "Move active cell to the left.", shortcut: [{ key: "ArrowLeft" }] }, Vt), new u("selectLeft", e2, { label: "Select Left", description: "Extend selection left.", shortcut: [{ key: "ArrowLeft", modifiers: [h.Shift] }] }, Ut), new u("moveContentfulLeft", e2, { label: "Move Left Contentful", description: "Move left to the next cell with content.", shortcut: [{ key: "ArrowLeft", modifiers: [h.Ctrl] }] }, Ht), new u("selectContentfulLeft", e2, { label: "Select Left Contentful", description: "Extend selection left to the next cell with content.", shortcut: [{ key: "ArrowLeft", modifiers: [h.Ctrl, h.Shift] }] }, Kt), new u("moveRight", e2, { label: "Move Right", description: "Move active cell to the right.", shortcut: [{ key: "ArrowRight" }] }, Nt), new u("selectRight", e2, { label: "Select Right", description: "Extend selection right.", shortcut: [{ key: "ArrowRight", modifiers: [h.Shift] }] }, qt), new u("moveContentfulRight", e2, { label: "Move Right Contentful", description: "Move right to the next cell with content.", shortcut: [{ key: "ArrowRight", modifiers: [h.Ctrl] }] }, jt), new u("selectContentfulRight", e2, { label: "Select Right Contentful", description: "Extend selection right to the next cell with content.", shortcut: [{ key: "ArrowRight", modifiers: [h.Ctrl, h.Shift] }] }, Xt), new u("moveUp", e2, { label: "Move Up", description: "Move active cell to the up.", shortcut: [{ key: "ArrowUp" }] }, Yt), new u("selectUp", e2, { label: "Select Up", description: "Extend selection up.", shortcut: [{ key: "ArrowUp", modifiers: [h.Shift] }] }, Gt), new u("moveContentfulUp", e2, { label: "Move Up Contentful", description: "Move up to the next cell with content.", shortcut: [{ key: "ArrowUp", modifiers: [h.Ctrl] }] }, Zt), new u("selectContentfulUp", e2, { label: "Select Up Contentful", description: "Extend selection up to the next cell with content.", shortcut: [{ key: "ArrowUp", modifiers: [h.Ctrl, h.Shift] }] }, _t), new u("moveDown", e2, { label: "Move Down", description: "Move active cell to the down.", shortcut: [{ key: "ArrowDown" }] }, Jt), new u("selectDown", e2, { label: "Select Down", description: "Extend selection down.", shortcut: [{ key: "ArrowDown", modifiers: [h.Shift] }] }, Qt), new u("moveContentfulDown", e2, { label: "Move Down Contentful", description: "Move down to the next cell with content.", shortcut: [{ key: "ArrowDown", modifiers: [h.Ctrl] }] }, en), new u("selectContentfulDown", e2, { label: "Select Down Contentful", description: "Extend selection down to the next cell with content.", shortcut: [{ key: "ArrowDown", modifiers: [h.Ctrl, h.Shift] }] }, tn), new u("selectVisible", e2, { label: "Select Visible", description: "Select visible cells only.", shortcut: { key: ";", modifiers: [h.Alt] } }, Mt), new u("traverseSelectionPreviousRange", e2, { label: "Traverse Previous Range", description: "Traverse the selection to the previous range.", shortcut: { key: "ArrowLeft", modifiers: [h.Ctrl, h.Alt] } }, Ft), new u("traverseSelectionNextRange", e2, { label: "Traverse Next Range", description: "Traverse the selection to the next range.", shortcut: { key: "ArrowRight", modifiers: [h.Ctrl, h.Alt] } }, At), new u("traverseSelectionCorners", e2, { label: "Traverse Corners", description: "Traverse the selection through the corners of the selected range.", shortcut: { key: ".", modifiers: [h.Ctrl] } }, Wt)];
1274
1308
  }, []);
1275
1309
  return y(() => {
1276
1310
  n2?.addCommands(Sn, true);
1277
- }, [n2]), { selection: mn, setSelectionCell: rn, setSelectionRanges: We2, overlay: vn, cursor: Ve2, onPointerDown: gt, clearLastSelection: nn, newSelection: lt, modifySelection: rt, appendSelection: it, clearSelections: ct, isEntire: on, navigate: wt, navigateSelection: xt };
1278
- }, Ie = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, Ee = Object.freeze({ top: 0, left: 0 }), Re = Object.freeze({ bottom: -4, right: -4 }), Me = Object.freeze({ horizontal: true, vertical: true }), ke = [O.TopLeft, O.Top, O.Left, O.Center], Pe = 150, De = 3e3, Te = {}, Oe = b(C((r2, l2) => {
1279
- const { width: c2, height: s2, rowCount: a2 = 1, columnCount: d2 = 1, defaultRowHeight: u2, defaultColumnWidth: h2, getRowHeight: f2, getColumnWidth: b2, layout: C2, onViewportScroll: E2, onImmediateScroll: D2, showGridLines: z2 = true, gridLineColor: L2 = "rgb(224, 224, 224)", gridLineRowsProps: $2, gridLineColumnsProps: B2, clipCells: F2 = true, cursor: W2, freezeLeft: A2 = 0, freezeTop: U2 = 0, freezeLeftProps: H2, freezeTopProps: K2, cellRenderer: N2, onViewportChange: q2, onFirstRender: j2, overlayRenderer: X2, overlayProps: Y2, overlays: G2, overlaysProps: _2, allowOverlaysOverflow: J2 = false, stageProps: Q2, stageWrapper: ne2 = null, hiddenRowsAt: oe2, hiddenColumnsAt: re2, hiddenCellAt: ae2, getVisibleCells: ue2, zoom: he2 = 1, enableMouseWheel: ge2 = true, onWheelScroll: fe2, getCellCoordsAsRangeCoords: we2 = k.cellToRange, scrollPoint: xe2 = Ee, style: pe2 = {}, ...me2 } = r2;
1311
+ }, [n2]), { selection: mn, setSelectionCell: rn, setSelectionRanges: Ae2, overlay: vn, cursor: Ve2, onPointerDown: gt, clearLastSelection: nn, newSelection: lt, modifySelection: rt, appendSelection: it, clearSelections: ct, isEntire: on, navigate: wt, navigateSelection: xt };
1312
+ }, De = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, Te = Object.freeze({ top: 0, left: 0 }), Oe = Object.freeze({ bottom: -4, right: -4 }), ze = Object.freeze({ horizontal: true, vertical: true }), Le = [O.TopLeft, O.Top, O.Left, O.Center], $e = 150, Be = 3e3, Fe = {}, Ae = b(C((r2, l2) => {
1313
+ const { width: c2, height: s2, rowCount: a2 = 1, columnCount: d2 = 1, defaultRowHeight: u2, defaultColumnWidth: h2, getRowHeight: f2, getColumnWidth: b2, layout: C2, onViewportScroll: E2, onImmediateScroll: D2, showGridLines: z2 = true, gridLineColor: L2 = "rgb(224, 224, 224)", gridLineRowsProps: $2, gridLineColumnsProps: B2, clipCells: F2 = true, cursor: A2, freezeLeft: W2 = 0, freezeTop: U2 = 0, freezeLeftProps: H2, freezeTopProps: K2, cellRenderer: N2, onViewportChange: q2, onFirstRender: j2, overlayRenderer: X2, overlayProps: Y2, overlays: G2, overlaysProps: Z2, allowOverlaysOverflow: _2 = false, stageProps: J2, stageWrapper: Q2 = null, hiddenRowsAt: ee2, hiddenColumnsAt: ne2, hiddenCellAt: oe2, getVisibleCells: re2, zoom: ce2 = 1, enableMouseWheel: se2 = true, onWheelScroll: ae2, getCellCoordsAsRangeCoords: fe2 = k.cellToRange, scrollPoint: xe2 = Te, style: pe2 = {}, ...me2 } = r2;
1280
1314
  R(N2, "No cellRenderer specified. This is probably not what you wanted"), R(!r2?.children, "Grid does not support children elements");
1281
- const ve2 = o(D2, [D2]), Se2 = o(q2, [q2]), ye2 = o(E2, [E2]), be2 = o(fe2, [fe2]), Ce2 = o(j2, [j2]), Pe2 = w(null), Oe2 = w(null), ze2 = w(null), [Le2, $e2] = x((e2) => e2 + 1, 0), [Be2, Fe2] = p({ left: xe2?.left ?? 0, top: xe2?.top ?? 0, horizontalScrollDirection: null, verticalScrollDirection: null }), We2 = w(null), Ae2 = w(Be2), { top: Ve2, left: Ue2, verticalScrollDirection: He2, horizontalScrollDirection: Ke2 } = Be2, Ne2 = w(false), qe2 = V({ rowCount: a2, columnCount: d2, defaultRowHeight: u2, defaultColumnWidth: h2, getRowHeight: f2, getColumnWidth: b2 }), je2 = w(null), Xe = y(() => {
1315
+ const ve2 = o(D2, [D2]), Se2 = o(q2, [q2]), ye2 = o(E2, [E2]), be2 = o(ae2, [ae2]), Ce2 = o(j2, [j2]), Ie2 = w(null), Ee2 = w(null), Re2 = w(null), [Me2, ke2] = x((e2) => e2 + 1, 0), [Pe2, $e2] = p({ left: xe2?.left ?? 0, top: xe2?.top ?? 0, horizontalScrollDirection: null, verticalScrollDirection: null }), Ae2 = w(null), We2 = w(Pe2), { top: Ve2, left: Ue2, verticalScrollDirection: He2, horizontalScrollDirection: Ke2 } = Pe2, Ne2 = w(false), qe2 = V({ rowCount: a2, columnCount: d2, defaultRowHeight: u2, defaultColumnWidth: h2, getRowHeight: f2, getColumnWidth: b2 }), je2 = w(null), Xe2 = y(() => {
1282
1316
  const e2 = C2 || qe2;
1283
- return je2.current = null, { getColOffset: (t2) => e2.getColOffset(t2) * he2, getColIndex: (t2) => e2.getColIndex(t2 / he2), getRowOffset: (t2) => e2.getRowOffset(t2) * he2, getRowIndex: (t2) => e2.getRowIndex(t2 / he2) };
1284
- }, [qe2, C2, he2]), Ye = (e2, t2, n2) => {
1317
+ return je2.current = null, { getColOffset: (t2) => e2.getColOffset(t2) * ce2, getColIndex: (t2) => e2.getColIndex(t2 / ce2), getRowOffset: (t2) => e2.getRowOffset(t2) * ce2, getRowIndex: (t2) => e2.getRowIndex(t2 / ce2) };
1318
+ }, [qe2, C2, ce2]), Ye2 = (e2, t2, n2) => {
1285
1319
  const o2 = (t2?.left ?? 0) + 0, r3 = (t2?.top ?? 0) + 0;
1286
1320
  return { getColOffset: (t3) => e2.getColOffset(t3) - o2, getColIndex: (t3) => e2.getColIndex(t3 + o2), getRowOffset: (t3) => e2.getRowOffset(t3) - r3, getRowIndex: (t3) => e2.getRowIndex(t3 + r3) };
1287
- }, Ge = v((e2, t2 = false) => le(e2, t2, Xe.getRowOffset, t2 ? 0 : a2), [a2, Xe?.getRowOffset]), Ze = o(oe2 ?? Ge, [oe2]), _e = v((e2, t2 = false) => le(e2, t2, Xe.getColOffset, t2 ? d2 : 0), [d2, Xe?.getColOffset]), Je = o(re2 ?? _e, [re2]), Qe = y(() => Math.min(c2 ?? 800, Xe.getColOffset(d2)), [Xe.getColOffset, d2, c2]), et = y(() => Math.min(s2 ?? 600, Xe.getRowOffset(a2)), [Xe.getRowOffset, a2, s2]), tt = v((e2) => {
1321
+ }, Ge2 = v((e2, t2 = false) => de(e2, t2, Xe2.getRowOffset, t2 ? 0 : a2), [a2, Xe2?.getRowOffset]), Ze2 = o(ee2 ?? Ge2, [ee2]), _e2 = v((e2, t2 = false) => de(e2, t2, Xe2.getColOffset, t2 ? d2 : 0), [d2, Xe2?.getColOffset]), Je2 = o(ne2 ?? _e2, [ne2]), Qe = y(() => Math.min(c2 ?? 800, Xe2.getColOffset(d2)), [Xe2.getColOffset, d2, c2]), et = y(() => Math.min(s2 ?? 600, Xe2.getRowOffset(a2)), [Xe2.getRowOffset, a2, s2]), tt = v((e2) => {
1288
1322
  P.canUseDOM && setTimeout(() => {
1289
- Pe2.current?.focus({ preventScroll: true, ...e2 });
1323
+ Ie2.current?.focus({ preventScroll: true, ...e2 });
1290
1324
  }, 0);
1291
- }, []), nt = v((e2) => Pe2.current?.contains(e2) || Oe2.current?.contains(e2), []);
1325
+ }, []), nt = v((e2) => Ie2.current?.contains(e2) || Ee2.current?.contains(e2), []);
1292
1326
  m(() => {
1293
- Ne2.current && (We2.current && We2.current.left !== Ae2.current?.left && We2.current.top !== Ae2.current?.top || (We2.current = null, ye2?.({ left: Ue2, top: Ve2 })));
1327
+ Ne2.current && (Ae2.current && Ae2.current.left !== We2.current?.left && Ae2.current.top !== We2.current?.top || (Ae2.current = null, ye2?.({ left: Ue2, top: Ve2 })));
1294
1328
  }, [Ue2, Ve2]);
1295
1329
  const ot = o(() => ({ top: Ve2, left: Ue2 }), [Ve2, Ue2]), rt = y(() => {
1296
1330
  const e2 = [];
1297
1331
  let t2 = 0, n2 = 0;
1298
- "number" == typeof U2 ? t2 = U2 : (t2 = U2.index ?? 0, n2 = (U2.scrollOffset ?? 0) * he2);
1299
- const o2 = n2, r3 = Xe.getRowOffset(t2), l3 = r3 - o2;
1332
+ "number" == typeof U2 ? t2 = U2 : (t2 = U2.index ?? 0, n2 = (U2.scrollOffset ?? 0) * ce2);
1333
+ const o2 = n2, r3 = Xe2.getRowOffset(t2), l3 = r3 - o2;
1300
1334
  if (t2 > 0) {
1301
- const i3 = Ye(Xe, { top: n2 + Xe.getRowOffset(0) }), c4 = Xe.getRowIndex(o2), s4 = Xe.getRowIndex(r3 - 1);
1335
+ const i3 = Ye2(Xe2, { top: n2 + Xe2.getRowOffset(0) }), c4 = Xe2.getRowIndex(o2), s4 = Xe2.getRowIndex(r3 - 1);
1302
1336
  let a3;
1303
- e2[1] = { minIndex: c4, maxIndex: s4, minCoord: 0, maxCoord: t2 - 1, minBounds: 0, maxBounds: l3, visibleIndices: () => a3 || (a3 = Object.freeze(Z(Ze, c4, s4)), a3), layout: i3, maxVirtualBounds: r3, scrollOffset: n2, freezeOffset: n2 };
1337
+ e2[1] = { minIndex: c4, maxIndex: s4, minCoord: 0, maxCoord: t2 - 1, minBounds: 0, maxBounds: l3, visibleIndices: () => a3 || (a3 = Object.freeze(te(Ze2, c4, s4)), a3), layout: i3, maxVirtualBounds: r3, scrollOffset: n2, freezeOffset: n2 };
1304
1338
  }
1305
- const i2 = Math.max(0, et - l3), c3 = Ye(Xe, { top: Ve2 + l3 }), s3 = c3.getRowIndex(0), d3 = c3.getRowIndex(i2);
1339
+ const i2 = Math.max(0, et - l3), c3 = Ye2(Xe2, { top: Ve2 + l3 }), s3 = c3.getRowIndex(0), d3 = c3.getRowIndex(i2);
1306
1340
  let u3;
1307
- return e2[0] = { minIndex: s3, maxIndex: d3, minCoord: t2, maxCoord: a2 - 1, minBounds: l3, maxBounds: i2, visibleIndices: () => u3 || (u3 = Object.freeze(Z(Ze, s3, d3)), u3), layout: c3, maxVirtualBounds: Xe.getRowOffset(a2), scrollOffset: Ve2, freezeOffset: (t2 > 0 ? Xe.getRowOffset(t2) : 0) - n2 }, e2;
1308
- }, [Xe.getRowIndex, Xe.getRowOffset, Ze, et, a2, U2, Ve2, he2]), lt = y(() => {
1341
+ return e2[0] = { minIndex: s3, maxIndex: d3, minCoord: t2, maxCoord: a2 - 1, minBounds: l3, maxBounds: i2, visibleIndices: () => u3 || (u3 = Object.freeze(te(Ze2, s3, d3)), u3), layout: c3, maxVirtualBounds: Xe2.getRowOffset(a2), scrollOffset: Ve2, freezeOffset: (t2 > 0 ? Xe2.getRowOffset(t2) : 0) - n2 }, e2;
1342
+ }, [Xe2.getRowIndex, Xe2.getRowOffset, Ze2, et, a2, U2, Ve2, ce2]), lt = y(() => {
1309
1343
  const e2 = [];
1310
1344
  let t2 = 0, n2 = 0;
1311
- "number" == typeof A2 ? t2 = A2 : (t2 = A2.index ?? 0, n2 = (A2.scrollOffset ?? 0) * he2);
1312
- const o2 = n2, r3 = Xe.getColOffset(t2), l3 = r3 - o2;
1345
+ "number" == typeof W2 ? t2 = W2 : (t2 = W2.index ?? 0, n2 = (W2.scrollOffset ?? 0) * ce2);
1346
+ const o2 = n2, r3 = Xe2.getColOffset(t2), l3 = r3 - o2;
1313
1347
  if (t2 > 0) {
1314
- const i3 = Ye(Xe, { left: n2 + Xe.getColOffset(0) }), c4 = Xe.getColIndex(o2), s4 = Xe.getColIndex(r3 - 1);
1348
+ const i3 = Ye2(Xe2, { left: n2 + Xe2.getColOffset(0) }), c4 = Xe2.getColIndex(o2), s4 = Xe2.getColIndex(r3 - 1);
1315
1349
  let a4;
1316
- e2[1] = { minIndex: c4, maxIndex: s4, minCoord: 0, maxCoord: t2 - 1, minBounds: 0, maxBounds: l3, visibleIndices: () => a4 || (a4 = Object.freeze(Z(Je, c4, s4)), a4), layout: i3, maxVirtualBounds: r3, scrollOffset: n2, freezeOffset: n2 };
1350
+ e2[1] = { minIndex: c4, maxIndex: s4, minCoord: 0, maxCoord: t2 - 1, minBounds: 0, maxBounds: l3, visibleIndices: () => a4 || (a4 = Object.freeze(te(Je2, c4, s4)), a4), layout: i3, maxVirtualBounds: r3, scrollOffset: n2, freezeOffset: n2 };
1317
1351
  }
1318
- const i2 = Math.max(0, Qe - l3), c3 = Ye(Xe, { left: Ue2 + l3 }), s3 = c3.getColIndex(0), a3 = c3.getColIndex(i2);
1352
+ const i2 = Math.max(0, Qe - l3), c3 = Ye2(Xe2, { left: Ue2 + l3 }), s3 = c3.getColIndex(0), a3 = c3.getColIndex(i2);
1319
1353
  let u3;
1320
- return e2[0] = { minIndex: s3, maxIndex: a3, minCoord: t2, maxCoord: d2 - 1, minBounds: l3, maxBounds: i2, visibleIndices: () => u3 || (u3 = Object.freeze(Z(Je, s3, a3)), u3), layout: c3, maxVirtualBounds: Xe.getColOffset(d2), scrollOffset: Ue2, freezeOffset: (t2 > 0 ? Xe.getColOffset(t2) : 0) - n2 }, e2;
1321
- }, [Xe.getColIndex, Xe.getColOffset, Je, Qe, d2, A2, Ue2, he2]), it = w({}), ct = w([]), st = y(() => {
1354
+ return e2[0] = { minIndex: s3, maxIndex: a3, minCoord: t2, maxCoord: d2 - 1, minBounds: l3, maxBounds: i2, visibleIndices: () => u3 || (u3 = Object.freeze(te(Je2, s3, a3)), u3), layout: c3, maxVirtualBounds: Xe2.getColOffset(d2), scrollOffset: Ue2, freezeOffset: (t2 > 0 ? Xe2.getColOffset(t2) : 0) - n2 }, e2;
1355
+ }, [Xe2.getColIndex, Xe2.getColOffset, Je2, Qe, d2, W2, Ue2, ce2]), it = w({}), ct = w([]), st = y(() => {
1322
1356
  let e2 = {};
1323
1357
  const t2 = (t3, n3, o2, r3, l3) => {
1324
1358
  const i2 = { vertical: r3?.vertical || false, horizontal: r3?.horizontal || false };
1325
1359
  if (t3 >= lt.length || n3 >= rt.length) return null;
1326
1360
  const c3 = { rowStart: rt[n3].minIndex, colStart: lt[t3].minIndex, rowEnd: rt[n3].maxIndex, colEnd: lt[t3].maxIndex };
1327
1361
  if (c3.rowStart > c3.rowEnd || c3.colStart > c3.colEnd) return null;
1328
- const s3 = { getColIndex: (e3) => lt[t3].layout.getColIndex(e3), getColOffset: (e3) => lt[t3].layout.getColOffset(e3), getRowIndex: (e3) => rt[n3].layout.getRowIndex(e3), getRowOffset: (e3) => rt[n3].layout.getRowOffset(e3) }, a3 = Object.freeze({ left: l3?.left ?? 0, top: l3?.top ?? 0, right: l3?.right ?? 0, bottom: l3?.bottom ?? 0 }), d3 = Object.freeze({ x: lt[t3].minBounds, y: rt[n3].minBounds, width: lt[t3].maxBounds, height: rt[n3].maxBounds }), u3 = (e3, t4) => ce(s3, e3 ?? c3, t4), h3 = { width: lt[t3].maxVirtualBounds, height: rt[n3].maxVirtualBounds }, g2 = { left: lt[t3].scrollOffset, top: rt[n3].scrollOffset }, f3 = { left: lt[t3].freezeOffset, top: rt[n3].freezeOffset }, w2 = { width: Qe, height: et };
1362
+ const s3 = { getColIndex: (e3) => lt[t3].layout.getColIndex(e3), getColOffset: (e3) => lt[t3].layout.getColOffset(e3), getRowIndex: (e3) => rt[n3].layout.getRowIndex(e3), getRowOffset: (e3) => rt[n3].layout.getRowOffset(e3) }, a3 = Object.freeze({ left: l3?.left ?? 0, top: l3?.top ?? 0, right: l3?.right ?? 0, bottom: l3?.bottom ?? 0 }), d3 = Object.freeze({ x: lt[t3].minBounds, y: rt[n3].minBounds, width: lt[t3].maxBounds, height: rt[n3].maxBounds }), u3 = (e3, t4) => he(s3, e3 ?? c3, t4), h3 = { width: lt[t3].maxVirtualBounds, height: rt[n3].maxVirtualBounds }, g2 = { left: lt[t3].scrollOffset, top: rt[n3].scrollOffset }, f3 = { left: lt[t3].freezeOffset, top: rt[n3].freezeOffset }, w2 = { width: Qe, height: et };
1329
1363
  let x2 = null, p2 = null;
1330
- const m2 = (f3.top + (r3.vertical ? g2.top : 0)) / he2, v2 = (f3.left + (r3.horizontal ? g2.left : 0)) / he2;
1331
- return { getStage: () => Pe2.current ?? null, getVisibleRangeCoords: () => c3, toClipBounds: (e3, t4) => {
1364
+ const m2 = (f3.top + (r3.vertical ? g2.top : 0)) / ce2, v2 = (f3.left + (r3.horizontal ? g2.left : 0)) / ce2;
1365
+ return { getStage: () => Ie2.current ?? null, getVisibleRangeCoords: () => c3, toClipBounds: (e3, t4) => {
1332
1366
  let n4, o3 = 0;
1333
1367
  return void 0 === t4 || "number" == typeof t4 ? (n4 = u3(c3), o3 = t4) : n4 = t4, ((e4, t5, n5 = 0) => {
1334
1368
  if (e4.x > t5.width || e4.y > t5.height) return null;
1335
1369
  const o4 = { left: e4.x, top: e4.y, bottom: e4.height + e4.y, right: e4.width + e4.x }, r4 = { left: t5.x + n5, top: t5.y + n5, bottom: t5.height - 2 * n5 + t5.y, right: t5.width - 2 * n5 + t5.x }, l4 = { left: Math.max(o4.left, r4.left), top: Math.max(o4.top, r4.top), bottom: Math.min(o4.bottom, r4.bottom), right: Math.min(o4.right, r4.right) }, i3 = { x: l4.left, y: l4.top, width: l4.right - l4.left, height: l4.bottom - l4.top };
1336
1370
  return i3.height < 0 || i3.width < 0 ? null : i3;
1337
1371
  })(e3 ?? { x: 0, y: 0, width: d3.width, height: d3.height }, n4, o3);
1338
- }, toViewBounds: (e3) => 0 === v2 && 0 === m2 && 1 === he2 ? e3 : { x: (e3.x - v2) * he2, y: (e3.y - m2) * he2, width: e3.width * he2, height: e3.height * he2 }, toAbsoluteBounds: (e3) => 0 === v2 && 0 === m2 && 1 === he2 ? e3 : { x: e3.x / he2 + v2, y: e3.y / he2 + m2, width: e3.width / he2, height: e3.height / he2 }, getRelativePointFromClient: (e3, t4) => {
1372
+ }, toViewBounds: (e3) => 0 === v2 && 0 === m2 && 1 === ce2 ? e3 : { x: (e3.x - v2) * ce2, y: (e3.y - m2) * ce2, width: e3.width * ce2, height: e3.height * ce2 }, toAbsoluteBounds: (e3) => 0 === v2 && 0 === m2 && 1 === ce2 ? e3 : { x: e3.x / ce2 + v2, y: e3.y / ce2 + m2, width: e3.width / ce2, height: e3.height / ce2 }, getRelativePointFromClient: (e3, t4) => {
1339
1373
  const n4 = ft(e3, t4);
1340
1374
  return { x: n4.x - d3.x, y: n4.y - d3.y };
1341
- }, getLayout: () => s3, getCellCoordsAsRangeCoords: we2, getVisibleColumns: () => lt[t3].visibleIndices(), getVisibleRows: () => rt[n3].visibleIndices(), getVisibleColumnOffsets: () => (x2 || (x2 = ie(lt[t3].layout, true, lt[t3].visibleIndices(), c3.colStart, c3.colEnd)), x2), getVisibleRowOffsets: () => (p2 || (p2 = ie(rt[n3].layout, false, rt[n3].visibleIndices(), c3.rowStart, c3.rowEnd)), p2), getTotalRangeCoords: () => ({ colStart: lt[t3].minCoord, colEnd: lt[t3].maxCoord, rowStart: rt[n3].minCoord, rowEnd: rt[n3].maxCoord }), getRangeCoordsBounds: u3, scrollCellCoordsIntoView: (e3, t4) => It(e3, t4, o2), getCellCoordsFromClient: (e3, t4, n4 = false) => {
1375
+ }, getLayout: () => s3, getCellCoordsAsRangeCoords: fe2, getVisibleColumns: () => lt[t3].visibleIndices(), getVisibleRows: () => rt[n3].visibleIndices(), getVisibleColumnOffsets: () => (x2 || (x2 = ue(lt[t3].layout, true, lt[t3].visibleIndices(), c3.colStart, c3.colEnd)), x2), getVisibleRowOffsets: () => (p2 || (p2 = ue(rt[n3].layout, false, rt[n3].visibleIndices(), c3.rowStart, c3.rowEnd)), p2), getTotalRangeCoords: () => ({ colStart: lt[t3].minCoord, colEnd: lt[t3].maxCoord, rowStart: rt[n3].minCoord, rowEnd: rt[n3].maxCoord }), getRangeCoordsBounds: u3, scrollCellCoordsIntoView: (e3, t4) => It(e3, t4, o2), getCellCoordsFromClient: (e3, t4, n4 = false) => {
1342
1376
  const o3 = ft(e3, t4);
1343
1377
  if (!o3) return null;
1344
1378
  const r4 = s3.getColIndex(o3.x - d3.x), l4 = { rowIndex: s3.getRowIndex(o3.y - d3.y), colIndex: r4 };
1345
1379
  if (n4) return l4;
1346
- const i3 = we2(l4);
1380
+ const i3 = fe2(l4);
1347
1381
  return { rowIndex: i3.rowStart, colIndex: i3.colStart };
1348
- }, getZoom: () => he2, getAnchor: () => o2, getBounds: () => d3, getInsets: () => a3, getTotalSize: () => h3, getViewportSize: () => w2, getScrollTopLeft: () => g2, getFreezeTopLeft: () => f3, getScrollOrientation: () => i2, allViews: () => e2 };
1382
+ }, getZoom: () => ce2, getAnchor: () => o2, getBounds: () => d3, getInsets: () => a3, getTotalSize: () => h3, getViewportSize: () => w2, getScrollTopLeft: () => g2, getFreezeTopLeft: () => f3, getScrollOrientation: () => i2, allViews: () => e2 };
1349
1383
  };
1350
- let n2 = e2[O.Center] = t2(0, 0, O.Center, Me, Re);
1384
+ let n2 = e2[O.Center] = t2(0, 0, O.Center, ze, Oe);
1351
1385
  return n2 && (e2[O.Center] = n2), n2 = t2(0, 1, O.Top, { horizontal: true }), n2 && (e2[O.Top] = n2), n2 = t2(1, 0, O.Left, { vertical: true }), n2 && (e2[O.Left] = n2), n2 = t2(1, 1, O.TopLeft, {}), n2 && (e2[O.TopLeft] = n2), it.current = null, e2 = Object.freeze(e2);
1352
- }, [rt, lt, we2]), at = Object.keys(st), dt = lt[0]?.maxVirtualBounds ?? 0, ut = rt[0]?.maxVirtualBounds ?? 0, ht = y(() => ({ left: lt[1] ? lt[1].layout.getColOffset(lt[1].maxIndex + 1) : 0, top: rt[1] ? rt[1].layout.getRowOffset(rt[1].maxIndex + 1) : 0 }), [st]);
1386
+ }, [rt, lt, fe2]), at = Object.keys(st), dt = lt[0]?.maxVirtualBounds ?? 0, ut = rt[0]?.maxVirtualBounds ?? 0, ht = y(() => ({ left: lt[1] ? lt[1].layout.getColOffset(lt[1].maxIndex + 1) : 0, top: rt[1] ? rt[1].layout.getRowOffset(rt[1].maxIndex + 1) : 0 }), [st]);
1353
1387
  m(() => {
1354
1388
  if (ct.current.length > 0) {
1355
1389
  for (let e2 = 0; e2 < ct.current.length; e2++) ct.current[e2]();
1356
1390
  ct.current = [];
1357
1391
  }
1358
1392
  }, [st]);
1359
- const gt = o(() => ({ containerWidth: Qe, containerHeight: et, totalWidth: dt, totalHeight: ut }), [Qe, et, Xe]);
1393
+ const gt = o(() => ({ containerWidth: Qe, containerHeight: et, totalWidth: dt, totalHeight: ut }), [Qe, et, Xe2]);
1360
1394
  m(() => {
1361
- !We2.current && Ne2.current && Se2({ top: Ve2, left: Ue2, width: Qe, height: et, totalWidth: dt, totalHeight: ut });
1395
+ !Ae2.current && Ne2.current && Se2({ top: Ve2, left: Ue2, width: Qe, height: et, totalWidth: dt, totalHeight: ut });
1362
1396
  }, [Ve2, Ue2, dt, ut]), m(() => {
1363
1397
  Ne2.current && Se2({ top: Ve2, left: Ue2, width: Qe, height: et, totalWidth: dt, totalHeight: ut });
1364
1398
  }, [Qe, et]);
1365
1399
  const ft = v((e2, t2) => {
1366
1400
  R("number" == typeof e2 && "number" == typeof t2, "Top and left should be a number.");
1367
- const n2 = Pe2.current?.getBoundingClientRect();
1401
+ const n2 = Ie2.current?.getBoundingClientRect();
1368
1402
  return n2 ? { x: e2 - n2.x, y: t2 - n2.y } : { x: e2, y: t2 };
1369
1403
  }, []), wt = o((e2) => st[e2] || null, [st]), xt = o((e2, t2) => {
1370
1404
  if (1 === Object.keys(st).length) return st[O.Center];
@@ -1372,45 +1406,45 @@ const xe = -10, pe = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1372
1406
  if (!n2) return null;
1373
1407
  const { x: o2, y: r3 } = n2;
1374
1408
  let l3 = null;
1375
- const i2 = ke;
1376
- for (let e3 = 0; !l3 && e3 < i2.length; e3++) {
1409
+ const i2 = Le, c3 = i2.length;
1410
+ for (let e3 = 0; !l3 && e3 < c3; e3++) {
1377
1411
  const t3 = st[i2[e3]];
1378
- t3 && se(o2, r3, t3.getBounds()) && (l3 = t3);
1412
+ t3 && ge(o2, r3, t3.getBounds()) && (l3 = t3);
1379
1413
  }
1380
1414
  return l3 || (l3 = st[O.Center]), l3;
1381
- }, [st, we2]), pt = o(() => st[O.Center].getVisibleRangeCoords(), [st[O.Center]]), mt = w(null), vt = v(() => {
1415
+ }, [st, fe2]), pt = o(() => st[O.Center].getVisibleRangeCoords(), [st[O.Center]]), mt = w(null), vt = v(() => {
1382
1416
  null !== mt.current && P.cancelTimeout(mt.current), mt.current = P.requestTimeout(St, 150);
1383
1417
  }, []), St = v(() => {
1384
- mt.current = null, Fe2((e2) => {
1418
+ mt.current = null, $e2((e2) => {
1385
1419
  const t2 = { ...e2, verticalScrollDirection: null, horizontalScrollDirection: null };
1386
- return Ae2.current = t2, t2;
1420
+ return We2.current = t2, t2;
1387
1421
  });
1388
1422
  }, []), yt = o((e2) => {
1389
- const t2 = e2?.left ?? e2?.[0], n2 = e2?.top ?? e2?.[1], o2 = void 0 !== t2 ? Math.min(dt - Qe, Math.max(lt?.[1]?.scrollOffset ?? 0, t2)) : Ae2.current.left, r3 = void 0 !== n2 ? Math.min(ut - et, Math.max(rt?.[1]?.scrollOffset ?? 0, n2)) : Ae2.current.top;
1390
- if (Ae2.current.left === o2 && Ae2.current.top === r3) return;
1423
+ const t2 = e2?.left ?? e2?.[0], n2 = e2?.top ?? e2?.[1], o2 = void 0 !== t2 ? Math.min(dt - Qe, Math.max(lt?.[1]?.scrollOffset ?? 0, t2)) : We2.current.left, r3 = void 0 !== n2 ? Math.min(ut - et, Math.max(rt?.[1]?.scrollOffset ?? 0, n2)) : We2.current.top;
1424
+ if (We2.current.left === o2 && We2.current.top === r3) return;
1391
1425
  let l3 = null, i2 = null;
1392
- Ae2.current.left > o2 ? l3 = T.Left : Ae2.current.left < o2 && (l3 = T.Right), Ae2.current.top > r3 ? i2 = T.Up : Ae2.current.top < r3 && (i2 = T.Down), P.throttle(() => {
1393
- Fe2((e3) => {
1426
+ We2.current.left > o2 ? l3 = T.Left : We2.current.left < o2 && (l3 = T.Right), We2.current.top > r3 ? i2 = T.Up : We2.current.top < r3 && (i2 = T.Down), P.throttle(() => {
1427
+ $e2((e3) => {
1394
1428
  const t3 = { ...e3, left: o2, top: r3, horizontalScrollDirection: l3, verticalScrollDirection: i2 };
1395
- return Ae2.current = t3, t3;
1429
+ return We2.current = t3, t3;
1396
1430
  });
1397
- }, 17)(), We2.current?.top === r3 && We2.current?.left === o2 || (We2.current = { left: o2, top: r3 }, ve2({ left: o2, top: r3 }), Se2({ left: o2, top: r3, width: Qe, height: et, totalWidth: dt, totalHeight: ut })), vt();
1431
+ }, 17)(), Ae2.current?.top === r3 && Ae2.current?.left === o2 || (Ae2.current = { left: o2, top: r3 }, ve2({ left: o2, top: r3 }), Se2({ left: o2, top: r3, width: Qe, height: et, totalWidth: dt, totalHeight: ut })), vt();
1398
1432
  }, [dt, ut, rt, lt]);
1399
1433
  m(() => {
1400
- We2.current || yt({ left: Ue2, top: Ve2 });
1434
+ Ae2.current || yt({ left: Ue2, top: Ve2 });
1401
1435
  }, [dt, Qe, ut, et]), S(() => {
1402
- We2.current = { left: xe2?.left, top: xe2?.top }, yt(We2.current);
1436
+ Ae2.current = { left: xe2?.left, top: xe2?.top }, yt(Ae2.current);
1403
1437
  }, [xe2?.left, xe2?.top]);
1404
1438
  const bt = o((e2) => {
1405
- const t2 = e2?.left ?? e2?.[0], n2 = e2?.top ?? e2?.[1], o2 = e2?.behavior ?? "auto", r3 = { left: Ae2.current.left + (t2 ?? 0), top: Ae2.current.top + (n2 ?? 0) };
1439
+ const t2 = e2?.left ?? e2?.[0], n2 = e2?.top ?? e2?.[1], o2 = e2?.behavior ?? "auto", r3 = { left: We2.current.left + (t2 ?? 0), top: We2.current.top + (n2 ?? 0) };
1406
1440
  o2 && (r3.behavior = o2), yt(r3);
1407
1441
  }, [dt, Qe, ut, et]), Ct = v((e2) => {
1408
1442
  let t2 = null;
1409
1443
  if (Object.keys(st).length > 1) {
1410
- const n2 = ke;
1411
- for (let o2 = 0; !t2 && o2 < n2.length; o2++) {
1412
- const r3 = st[n2[o2]];
1413
- r3 && k.isCellWithinRange(e2, r3.getVisibleRangeCoords()) && (t2 = r3);
1444
+ const n2 = Le, o2 = n2.length;
1445
+ for (let r3 = 0; !t2 && r3 < o2; r3++) {
1446
+ const o3 = st[n2[r3]];
1447
+ o3 && k.isCellWithinRange(e2, o3.getVisibleRangeCoords()) && (t2 = o3);
1414
1448
  }
1415
1449
  }
1416
1450
  return t2 || (t2 = st[O.Center]), t2;
@@ -1422,7 +1456,7 @@ const xe = -10, pe = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1422
1456
  t3("Invalid view");
1423
1457
  });
1424
1458
  } else r3 = Ct(o2);
1425
- const l3 = we2(o2), i2 = r3.getLayout(), c3 = i2.getColOffset(l3.colStart), s3 = i2.getRowOffset(l3.rowStart), a3 = i2.getColOffset(l3.colEnd + 1), d3 = i2.getRowOffset(l3.rowEnd + 1), u3 = r3.getBounds(), h3 = r3.getTotalSize(), g2 = r3.getScrollTopLeft(), f3 = ((e3, t3, n3 = true) => (n3 = true === n3 ? { block: "start", inline: "end" } : false === n3 ? { block: "end", inline: "end" } : { block: "end", inline: "end", ...n3 }, { left: te(n3.inline, e3.x, e3.x + e3.width, t3.left, t3.left + t3.width, t3.totalWidth), top: te(n3.block, e3.y, e3.y + e3.height, t3.top, t3.top + t3.height, t3.totalHeight) }))({ x: c3 + g2.left, y: s3 + g2.top, width: a3 - c3, height: d3 - s3 }, { left: g2.left, top: g2.top, width: u3.width, height: u3.height, totalWidth: h3.width, totalHeight: h3.height }, t2), w2 = { ...f3 };
1459
+ const l3 = fe2(o2), i2 = r3.getLayout(), c3 = i2.getColOffset(l3.colStart), s3 = i2.getRowOffset(l3.rowStart), a3 = i2.getColOffset(l3.colEnd + 1), d3 = i2.getRowOffset(l3.rowEnd + 1), u3 = r3.getBounds(), h3 = r3.getTotalSize(), g2 = r3.getScrollTopLeft(), f3 = ((e3, t3, n3 = true) => (n3 = true === n3 ? { block: "start", inline: "end" } : false === n3 ? { block: "end", inline: "end" } : { block: "end", inline: "end", ...n3 }, { left: ie(n3.inline, e3.x, e3.x + e3.width, t3.left, t3.left + t3.width, t3.totalWidth), top: ie(n3.block, e3.y, e3.y + e3.height, t3.top, t3.top + t3.height, t3.totalHeight) }))({ x: c3 + g2.left, y: s3 + g2.top, width: a3 - c3, height: d3 - s3 }, { left: g2.left, top: g2.top, width: u3.width, height: u3.height, totalWidth: h3.width, totalHeight: h3.height }, t2), w2 = { ...f3 };
1426
1460
  w2.left > Ue2 ? w2.left += 20 : w2.left < Ue2 && (w2.left -= 0), w2.top > Ve2 ? w2.top += 20 : w2.top < Ve2 && (w2.top -= 0);
1427
1461
  const x2 = r3.getScrollOrientation();
1428
1462
  return x2.horizontal && void 0 !== e2.colIndex || delete w2.left, x2.vertical && void 0 !== e2.rowIndex || delete w2.top, new Promise((e3, t3) => {
@@ -1432,30 +1466,30 @@ const xe = -10, pe = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1432
1466
  t3(e4);
1433
1467
  }
1434
1468
  });
1435
- }, [dt, ut, st, we2]), Et = o((e2) => {
1469
+ }, [dt, ut, st, fe2]), Et = o((e2) => {
1436
1470
  const t2 = e2.shiftKey;
1437
1471
  e2.preventDefault();
1438
1472
  const { deltaX: n2, deltaY: o2, deltaMode: r3 } = e2;
1439
- if (ze2.current) return;
1473
+ if (Re2.current) return;
1440
1474
  let l3 = be2?.(e2);
1441
1475
  if (false === l3) return;
1442
1476
  let i2 = t2 ? o2 : n2, c3 = o2;
1443
1477
  const s3 = t2 || Math.abs(i2) > Math.abs(c3);
1444
- 1 === r3 && (c3 *= 0), ze2.current = window.requestAnimationFrame(() => {
1445
- ze2.current = null, bt(s3 ? { left: i2 } : { top: c3 });
1478
+ 1 === r3 && (c3 *= 0), Re2.current = window.requestAnimationFrame(() => {
1479
+ Re2.current = null, bt(s3 ? { left: i2 } : { top: c3 });
1446
1480
  });
1447
1481
  }, [dt, Qe, ut, et, be2]), Rt = v((e2 = null) => {
1448
- je2.current = null, it.current = null, $e2();
1482
+ je2.current = null, it.current = null, ke2();
1449
1483
  }, []);
1450
1484
  S(() => {
1451
1485
  Rt();
1452
1486
  }, [N2]);
1453
- const Mt = g(l2, () => ({ stage: Pe2.current, focus: tt, contains: nt, invalidate: Rt, scrollTo: yt, scrollBy: bt, scrollCellCoordsIntoView: It, getScrollPosition: ot, getDimensions: gt, getViewport: pt, handleWheel: Et, rowCount: a2, columnCount: d2, getLayout: () => Xe, getRelativePointFromClient: ft, getViewFromClient: xt, getViewFromCellCoords: Ct, getViewFromLocation: wt, onViewChangeOnce: (e2) => {
1487
+ const Mt = g(l2, () => ({ stage: Ie2.current, focus: tt, contains: nt, invalidate: Rt, scrollTo: yt, scrollBy: bt, scrollCellCoordsIntoView: It, getScrollPosition: ot, getDimensions: gt, getViewport: pt, handleWheel: Et, rowCount: a2, columnCount: d2, getLayout: () => Xe2, getRelativePointFromClient: ft, getViewFromClient: xt, getViewFromCellCoords: Ct, getViewFromLocation: wt, onViewChangeOnce: (e2) => {
1454
1488
  ct.current.push(e2);
1455
1489
  } }), [a2, d2, st]);
1456
- m(() => (ge2 && Mt.current?.addEventListener("wheel", Et, { passive: false }), Ne2.current = true, We2.current = null, () => {
1490
+ m(() => (se2 && Mt.current?.addEventListener("wheel", Et, { passive: false }), Ne2.current = true, Ae2.current = null, () => {
1457
1491
  Mt.current?.removeEventListener("wheel", Et);
1458
- }), [ge2]);
1492
+ }), [se2]);
1459
1493
  const kt = w([]), Pt = (t2, n2) => {
1460
1494
  if (!t2 || !X2) return;
1461
1495
  kt.current = [];
@@ -1466,81 +1500,85 @@ const xe = -10, pe = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1466
1500
  return e("div", { style: { position: "absolute", left: "0px", top: "0px", width: `${i2.width}px`, height: `${i2.height}px`, overflow: "hidden" }, children: l3 }, `overlay-${t3.getAnchor()}-${o2}`);
1467
1501
  })(t2, 0));
1468
1502
  }, Dt = y(() => {
1469
- const e2 = {}, t2 = Object.keys(st);
1470
- for (let n2 = 0; n2 < t2.length; n2++) {
1471
- const o2 = t2[n2], r3 = [];
1472
- Pt(st[o2], r3), e2[o2] = { overlays: r3 };
1503
+ const e2 = {}, t2 = Object.keys(st), n2 = t2.length;
1504
+ for (let o2 = 0; o2 < n2; o2++) {
1505
+ const n3 = t2[o2], r3 = [];
1506
+ Pt(st[n3], r3), e2[n3] = { overlays: r3 };
1473
1507
  }
1474
1508
  return e2;
1475
- }, [Le2, X2, a2, d2, rt, lt]), Tt = (t2, n2, o2, r3, l3, c3, s3) => {
1509
+ }, [Me2, X2, a2, d2, rt, lt]), Tt = (t2, n2, o2, r3, l3, c3, s3) => {
1476
1510
  if (!t2) return;
1477
1511
  const a3 = t2.getVisibleColumns(), d3 = t2.getVisibleRows();
1478
1512
  if (0 === a3.length || 0 === d3.length) return;
1479
1513
  let u3 = null;
1480
- if (ue2) u3 = ue2(t2);
1514
+ if (re2) u3 = re2(t2);
1481
1515
  else {
1482
1516
  u3 = [];
1483
- for (let e2 = 0; e2 < d3.length; e2++) for (let t3 = 0; t3 < a3.length; t3++) {
1484
- const n3 = { rowIndex: d3[e2], colIndex: a3[t3] };
1485
- if (ae2?.(n3)) continue;
1486
- const o3 = { coords: n3, range: we2(n3) };
1487
- u3.push(o3);
1517
+ const e2 = d3.length, t3 = a3.length;
1518
+ for (let n3 = 0; n3 < e2; n3++) {
1519
+ const e3 = d3[n3];
1520
+ for (let n4 = 0; n4 < t3; n4++) {
1521
+ const t4 = { rowIndex: e3, colIndex: a3[n4] };
1522
+ if (oe2?.(t4)) continue;
1523
+ const o3 = { coords: t4, range: fe2(t4) };
1524
+ u3.push(o3);
1525
+ }
1488
1526
  }
1489
1527
  }
1490
- const h3 = t2.getVisibleColumnOffsets(), g2 = t2.getVisibleRowOffsets(), f3 = t2.getScrollTopLeft(), w2 = t2.getFreezeTopLeft(), x2 = f3.left + w2.left, p2 = f3.top + w2.top, m2 = Math.trunc(x2 / De), v2 = Math.trunc(p2 / De), S2 = {}, y2 = (e2, t3, n3, o3, r4) => {
1491
- const l4 = `view:${e2.getAnchor()}:cell:${ee(t3.rowIndex, t3.colIndex)}`, a4 = o3.x, d4 = o3.y, u4 = Math.trunc((x2 + a4) / De) - m2, h4 = Math.trunc((p2 + d4) / De) - v2;
1528
+ const h3 = t2.getVisibleColumnOffsets(), g2 = t2.getVisibleRowOffsets(), f3 = t2.getScrollTopLeft(), w2 = t2.getFreezeTopLeft(), x2 = f3.left + w2.left, p2 = f3.top + w2.top, m2 = Math.trunc(x2 / Be), v2 = Math.trunc(p2 / Be), S2 = {}, y2 = (e2, t3, n3, o3, r4) => {
1529
+ const l4 = `view:${e2.getAnchor()}:cell:${le(t3.rowIndex, t3.colIndex)}`, a4 = o3.x, d4 = o3.y, u4 = Math.trunc((x2 + a4) / Be) - m2, h4 = Math.trunc((p2 + d4) / Be) - v2;
1492
1530
  S2[h4] || (S2[h4] = {});
1493
1531
  let g3 = S2[h4][u4];
1494
1532
  g3 || (g3 = S2[h4][u4] = []);
1495
1533
  let f4 = c3?.get(l4);
1496
1534
  if (!f4) {
1497
- const c4 = (x2 + a4) % De, s4 = (p2 + d4) % De;
1498
- f4 = N2({ key: l4, coords: t3, bounds: o3, zoom: he2, range: n3, view: e2, value: r4, style: { left: i.boundPixel(c4), top: i.boundPixel(s4), width: i.boundPixel(o3.width, true), height: i.boundPixel(o3.height, true) } });
1535
+ const c4 = (x2 + a4) % Be, s4 = (p2 + d4) % Be;
1536
+ f4 = N2({ key: l4, coords: t3, bounds: o3, zoom: ce2, range: n3, view: e2, value: r4, style: { left: i.boundPixel(c4), top: i.boundPixel(s4), width: i.boundPixel(o3.width, true), height: i.boundPixel(o3.height, true) } });
1499
1537
  }
1500
1538
  s3?.set(l4, f4), g3.push(f4);
1501
- };
1502
- for (let e2 = 0; u3 && e2 < u3.length; e2++) {
1539
+ }, b3 = u3.length;
1540
+ for (let e2 = 0; u3 && e2 < b3; e2++) {
1503
1541
  const n3 = u3[e2], i2 = n3?.coords ?? n3;
1504
1542
  if (!i2) continue;
1505
1543
  const c4 = n3?.range ?? { rowStart: i2.rowIndex, colStart: i2.colIndex, rowEnd: i2.rowIndex, colEnd: i2.colIndex }, s4 = t2.getVisibleRangeCoords();
1506
1544
  if (!k.isRangesIntersect(c4, s4) && !k.isRangeWithinRange(c4, s4)) continue;
1507
1545
  const a4 = c4 && !k.isSingleCell(c4);
1508
- if (!a4 && ae2?.(i2)) continue;
1546
+ if (!a4 && oe2?.(i2)) continue;
1509
1547
  const d4 = i2.rowIndex, f4 = i2.colIndex, w3 = g2[d4], x3 = h3[f4];
1510
1548
  let p3 = null;
1511
1549
  w3 && x3 && (p3 = { x: x3.offset, y: w3.offset, width: x3.size, height: w3.size });
1512
- const m3 = ee(c4.rowStart, c4.colStart);
1550
+ const m3 = le(c4.rowStart, c4.colStart);
1513
1551
  if (a4) {
1514
1552
  if (l3.has(m3)) continue;
1515
1553
  l3.add(m3), c4.rowEnd - c4.rowStart > 0 && o2.push(c4), c4.colEnd - c4.colStart > 0 && r3.push(c4);
1516
1554
  }
1517
- if (a4 && (p3 = ce(t2.getLayout(), c4)), !p3) {
1555
+ if (a4 && (p3 = he(t2.getLayout(), c4)), !p3) {
1518
1556
  console.warn("no bounds for cell", m3);
1519
1557
  continue;
1520
1558
  }
1521
1559
  const v3 = n3?.value;
1522
1560
  y2(t2, i2, c4, p3, v3);
1523
1561
  }
1524
- const b3 = x2 % De, C3 = p2 % De, I2 = Object.keys(S2);
1525
- for (let o3 = 0; o3 < I2.length; o3++) {
1526
- const r4 = S2[I2[o3]];
1527
- if (!r4) continue;
1528
- const l4 = Object.keys(r4);
1529
- for (let c4 = 0; c4 < l4.length; c4++) {
1530
- const s4 = r4[l4[c4]];
1531
- if (!s4) continue;
1532
- const a4 = parseInt(I2[o3]), d4 = parseInt(l4[c4]), u4 = a4 + v2, h4 = d4 + m2, g3 = `view:${t2.getAnchor()}:segment:${h4}:${u4}`;
1533
- n2.push(e("div", { className: "cell-container", style: { transform: `translate(${i.boundPixel(d4 * De - b3, true)}px, ${i.boundPixel(a4 * De - C3, true)}px)`, willChange: "transform" }, children: s4 }, g3));
1562
+ const C3 = x2 % Be, I2 = p2 % Be, E3 = Object.keys(S2), R2 = E3.length;
1563
+ for (let o3 = 0; o3 < R2; o3++) {
1564
+ const r4 = E3[o3], l4 = S2[r4];
1565
+ if (!l4) continue;
1566
+ const c4 = Object.keys(l4), s4 = c4.length;
1567
+ for (let o4 = 0; o4 < s4; o4++) {
1568
+ const s5 = c4[o4], a4 = l4[s5];
1569
+ if (!a4) continue;
1570
+ const d4 = parseInt(r4), u4 = parseInt(s5), h4 = d4 + v2, g3 = u4 + m2, f4 = `view:${t2.getAnchor()}:segment:${g3}:${h4}`;
1571
+ n2.push(e("div", { className: "cell-container", style: { transform: `translate(${i.boundPixel(u4 * Be - C3, true)}px, ${i.boundPixel(d4 * Be - I2, true)}px)`, willChange: "transform" }, children: a4 }, f4));
1534
1572
  }
1535
1573
  }
1536
1574
  }, Ot = y(() => {
1537
- const e2 = je2.current, t2 = /* @__PURE__ */ new Map(), n2 = {}, o2 = Object.keys(st);
1538
- for (let r3 = 0; r3 < o2.length; r3++) {
1539
- const l3 = o2[r3], i2 = [], c3 = [], s3 = [];
1540
- Tt(st[l3], s3, i2, c3, /* @__PURE__ */ new Set(), e2, t2), n2[l3] = { cells: s3, rangesH: i2, rangesV: c3 };
1575
+ const e2 = je2.current, t2 = /* @__PURE__ */ new Map(), n2 = {}, o2 = Object.keys(st), r3 = o2.length;
1576
+ for (let l3 = 0; l3 < r3; l3++) {
1577
+ const r4 = o2[l3], i2 = [], c3 = [], s3 = [];
1578
+ Tt(st[r4], s3, i2, c3, /* @__PURE__ */ new Set(), e2, t2), n2[r4] = { cells: s3, rangesH: i2, rangesV: c3 };
1541
1579
  }
1542
1580
  return je2.current = t2, n2;
1543
- }, [Le2, a2, d2, rt, lt, z2, pe2, F2, ae2, ue2, we2]), zt = (t2, n2, o2, r3, l3) => {
1581
+ }, [Me2, a2, d2, rt, lt, z2, pe2, F2, oe2, re2, fe2]), zt = (t2, n2, o2, r3, l3) => {
1544
1582
  if (t2) if (n2) {
1545
1583
  const e2 = `view:${t2.getAnchor()}:hl:`, n3 = t2.getVisibleRows();
1546
1584
  if (!n3 || 0 === n3.length) return;
@@ -1558,104 +1596,106 @@ const xe = -10, pe = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1558
1596
  g2 && (a3 = a3.sort(k.columnFirstRangeComparator));
1559
1597
  const f3 = t2.getLayout(), w2 = f3.getRowOffset(h3 + 1);
1560
1598
  let x2 = c3;
1561
- for (let t3 = 0; t3 < a3.length + 1; t3++) {
1599
+ const p2 = a3.length;
1600
+ for (let t3 = 0; t3 < p2 + 1; t3++) {
1562
1601
  let n4 = x2, l5 = s3;
1563
1602
  const c4 = a3[t3];
1564
- t3 < a3.length && (l5 = Math.min(s3, f3.getColOffset(c4.colStart)), x2 = Math.min(s3, f3.getColOffset(c4.colEnd + 1))), r3.push(I("path", { d: `M ${i.boundPixel(n4)} ${i.boundPixel(w2, false, o2)} L ${i.boundPixel(l5)} ${i.boundPixel(w2, false, o2)}`, stroke: L2, strokeWidth: 1, vectorEffect: "non-scaling-stroke", ...$2, key: e2 + h3 + ":" + t3 }));
1603
+ t3 < p2 && (l5 = Math.min(s3, f3.getColOffset(c4.colStart)), x2 = Math.min(s3, f3.getColOffset(c4.colEnd + 1))), r3.push(I("path", { d: `M ${i.boundPixel(n4)} ${i.boundPixel(w2, false, o2)} L ${i.boundPixel(l5)} ${i.boundPixel(w2, false, o2)}`, stroke: L2, strokeWidth: 1, vectorEffect: "non-scaling-stroke", ...$2, key: e2 + h3 + ":" + t3 }));
1565
1604
  }
1566
- for (let e3 = a3.length - 1; e3 >= 0; e3--) a3[e3].rowEnd <= n3[l4 + 1] && a3.splice(e3, 1);
1605
+ for (let e3 = p2 - 1; e3 >= 0; e3--) a3[e3].rowEnd <= n3[l4 + 1] && a3.splice(e3, 1);
1567
1606
  }
1568
1607
  } else {
1569
1608
  const n3 = `view:${t2.getAnchor()}:vl:`, c3 = t2.getVisibleColumns();
1570
1609
  if (!c3 || 0 === c3.length) return;
1571
1610
  const s3 = 0, a3 = t2.getBounds().height;
1572
1611
  let d3 = [];
1573
- const u3 = l3.sort(k.columnFirstRangeComparator), h3 = t2.getVisibleRangeCoords();
1574
- for (let l4 = 0; l4 < c3.length && c3[l4] <= h3.colEnd; l4++) {
1575
- const g2 = c3[l4];
1576
- if (g2 < h3.colStart) continue;
1612
+ const u3 = l3.sort(k.columnFirstRangeComparator), h3 = t2.getVisibleRangeCoords(), g2 = c3.length;
1613
+ for (let l4 = 0; l4 < g2 && c3[l4] <= h3.colEnd; l4++) {
1614
+ const g3 = c3[l4];
1615
+ if (g3 < h3.colStart) continue;
1577
1616
  let f3 = false;
1578
- for (; u3.length > 0 && u3[0].colStart <= g2; ) {
1617
+ for (; u3.length > 0 && u3[0].colStart <= g3; ) {
1579
1618
  const e2 = u3.shift();
1580
- e2.colEnd > g2 && (d3.push(e2), f3 = true);
1619
+ e2.colEnd > g3 && (d3.push(e2), f3 = true);
1581
1620
  }
1582
1621
  f3 && (d3 = d3.sort(k.rowFirstRangeComparator));
1583
- const w2 = t2.getLayout(), x2 = w2.getColOffset(g2 + 1);
1622
+ const w2 = t2.getLayout(), x2 = w2.getColOffset(g3 + 1);
1584
1623
  let p2 = s3;
1585
- for (let t3 = 0; t3 < d3.length + 1; t3++) {
1624
+ const m2 = d3.length;
1625
+ for (let t3 = 0; t3 < m2 + 1; t3++) {
1586
1626
  let l5 = p2, c4 = a3;
1587
1627
  const s4 = d3[t3];
1588
- t3 < d3.length && (c4 = Math.min(a3, w2.getRowOffset(s4.rowStart)), p2 = Math.min(a3, w2.getRowOffset(s4.rowEnd + 1)));
1628
+ t3 < m2 && (c4 = Math.min(a3, w2.getRowOffset(s4.rowStart)), p2 = Math.min(a3, w2.getRowOffset(s4.rowEnd + 1)));
1589
1629
  let u4 = L2;
1590
- r3.push(e("path", { d: `M ${i.boundPixel(x2, false, o2)} ${i.boundPixel(l5)} L ${i.boundPixel(x2, false, o2)} ${i.boundPixel(c4)}`, stroke: u4, strokeWidth: 1, vectorEffect: "non-scaling-stroke", ...B2 }, n3 + g2 + ":" + t3));
1630
+ r3.push(e("path", { d: `M ${i.boundPixel(x2, false, o2)} ${i.boundPixel(l5)} L ${i.boundPixel(x2, false, o2)} ${i.boundPixel(c4)}`, stroke: u4, strokeWidth: 1, vectorEffect: "non-scaling-stroke", ...B2 }, n3 + g3 + ":" + t3));
1591
1631
  }
1592
- for (let e2 = d3.length - 1; e2 >= 0; e2--) d3[e2].colEnd <= c3[l4 + 1] && d3.splice(e2, 1);
1632
+ for (let e2 = m2 - 1; e2 >= 0; e2--) d3[e2].colEnd <= c3[l4 + 1] && d3.splice(e2, 1);
1593
1633
  }
1594
1634
  }
1595
1635
  }, Lt = (t2) => {
1596
1636
  if (!Ot) return;
1597
- const n2 = {};
1598
- for (let o2 = 0; o2 < at.length; o2++) {
1599
- const r3 = at[o2], l3 = st[r3], i2 = [];
1600
- zt(l3, t2, 0, i2, t2 ? Ot[r3].rangesH : Ot[r3].rangesV);
1637
+ const n2 = {}, o2 = at.length;
1638
+ for (let r3 = 0; r3 < o2; r3++) {
1639
+ const o3 = at[r3], l3 = st[o3], i2 = [];
1640
+ zt(l3, t2, 0, i2, t2 ? Ot[o3].rangesH : Ot[o3].rangesV);
1601
1641
  const c3 = l3.getRangeCoordsBounds(), s3 = Math.ceil(c3.width), a3 = Math.ceil(c3.height);
1602
- n2[r3] = e("svg", { width: `${s3}`, height: `${a3}`, viewBox: `0 0 ${s3} ${a3}`, preserveAspectRatio: "none", shapeRendering: "crispEdges", style: { position: "absolute" }, children: i2 });
1642
+ n2[o3] = e("svg", { width: `${s3}`, height: `${a3}`, viewBox: `0 0 ${s3} ${a3}`, preserveAspectRatio: "none", shapeRendering: "crispEdges", style: { position: "absolute" }, children: i2 });
1603
1643
  }
1604
1644
  return n2;
1605
- }, $t = y(() => true === z2 || true === z2?.horizontal ? Lt(true) : null, [Le2, z2, rt, U2, A2, L2, $2, a2, d2, Qe, dt, Ot]), Bt = y(() => true === z2 || true === z2?.vertical ? Lt(false) : null, [Le2, z2, lt, U2, A2, L2, B2, a2, d2, et, ut, Ot]), Ft = y(() => 0 === ht.left ? null : e(de, { linePoints: [0, 0, 0, et + 1], bounds: { x: ht.left, y: 0, width: 1, height: et + 1 }, ...H2 }), [Le2, ht.left, et, H2]), Wt = y(() => 0 === ht.top ? null : e(de, { linePoints: [0, 0, Qe + 1, 0], bounds: { x: 0, y: ht.top, width: Qe + 1, height: 1 }, ...K2 }), [Le2, ht.top, Qe, K2]), At = y(() => {
1645
+ }, $t = y(() => true === z2 || true === z2?.horizontal ? Lt(true) : null, [Me2, z2, rt, U2, W2, L2, $2, a2, d2, Qe, dt, Ot]), Bt = y(() => true === z2 || true === z2?.vertical ? Lt(false) : null, [Me2, z2, lt, U2, W2, L2, B2, a2, d2, et, ut, Ot]), Ft = y(() => 0 === ht.left ? null : e(we, { linePoints: [0, 0, 0, et + 1], bounds: { x: ht.left, y: 0, width: 1, height: et + 1 }, ...H2 }), [Me2, ht.left, et, H2]), At = y(() => 0 === ht.top ? null : e(we, { linePoints: [0, 0, Qe + 1, 0], bounds: { x: 0, y: ht.top, width: Qe + 1, height: 1 }, ...K2 }), [Me2, ht.top, Qe, K2]), Wt = y(() => {
1606
1646
  const o2 = [], r3 = (e2) => {
1607
1647
  if (!e2 || !st[e2]) return;
1608
1648
  const n2 = st[e2].getBounds();
1609
1649
  return t("div", { style: { position: "absolute", pointerEvents: "none", left: n2.x, top: n2.y, width: n2.width, height: n2.height, clip: `rect(0, ${n2.width + 1}px, ${n2.height + 1}px, 0)` }, className: `view view-${e2}`, children: [$t?.[e2], Bt?.[e2], Ot?.[e2].cells] }, `view:${e2}`);
1610
- };
1611
- for (let e2 = 0; e2 < at.length; e2++) o2.push(r3(at[e2]));
1650
+ }, l3 = at.length;
1651
+ for (let e2 = 0; e2 < l3; e2++) o2.push(r3(at[e2]));
1612
1652
  return e(n, { children: o2 });
1613
1653
  }, [st, $t, Bt, Ot]), Vt = y(() => {
1614
1654
  if (!l2) return;
1615
1655
  const e2 = (e3, t2, n3, o3) => {
1616
1656
  if (!o3 || 0 === o3.length) return;
1617
- const r4 = [];
1618
- for (let l3 = 0; l3 < o3.length; l3++) {
1619
- const i3 = o3[l3];
1620
- let c4 = e3?.get(i3);
1621
- c4 !== Te && (c4 = i3(n3) ?? Te), t2.set(i3, c4), c4 && c4 !== Te && r4.push(c4);
1657
+ const r4 = [], l3 = o3.length;
1658
+ for (let i3 = 0; i3 < l3; i3++) {
1659
+ const l4 = o3[i3];
1660
+ let c4 = e3?.get(l4);
1661
+ c4 !== Fe && (c4 = l4(n3) ?? Fe), t2.set(l4, c4), c4 && c4 !== Fe && r4.push(c4);
1622
1662
  }
1623
1663
  return r4;
1624
1664
  }, n2 = (n3, o3, r4) => {
1625
1665
  if (!r4) return;
1626
1666
  const l3 = r4.getBounds(), i3 = r4.getInsets(), c4 = r4.getAnchor();
1627
- return t("div", { className: M("view", `view-${c4}`, Ie.view), style: { position: "absolute", pointerEvents: "none", left: l3.x - i3.left, top: l3.y - i3.top, width: l3.width - (i3.left + i3.right), height: l3.height - (i3.top + i3.bottom), clipPath: J2 ? "inset(-2px)" : "inset(0px)" }, children: [e2(n3, o3, r4, G2), Dt?.[c4].overlays] }, `view:${c4}`);
1628
- }, o2 = it.current, r3 = {}, i2 = [], c3 = Object.keys(st);
1629
- for (let e3 = 0; e3 < c3.length; e3++) {
1630
- const t2 = c3[e3], l3 = o2?.[t2], s3 = r3[t2] = /* @__PURE__ */ new Map();
1631
- i2.push(n2(l3, s3, st[t2]));
1667
+ return t("div", { className: M("view", `view-${c4}`, De.view), style: { position: "absolute", pointerEvents: "none", left: l3.x - i3.left, top: l3.y - i3.top, width: l3.width - (i3.left + i3.right), height: l3.height - (i3.top + i3.bottom), clipPath: _2 ? "inset(-2px)" : "inset(0px)" }, children: [e2(n3, o3, r4, G2), Dt?.[c4].overlays] }, `view:${c4}`);
1668
+ }, o2 = it.current, r3 = {}, i2 = [], c3 = Object.keys(st), s3 = c3.length;
1669
+ for (let e3 = 0; e3 < s3; e3++) {
1670
+ const t2 = c3[e3], l3 = o2?.[t2], s4 = r3[t2] = /* @__PURE__ */ new Map();
1671
+ i2.push(n2(l3, s4, st[t2]));
1632
1672
  }
1633
1673
  return it.current = r3, i2;
1634
- }, [Le2, st, J2, G2]), Ut = y(() => {
1635
- const { style: t2, ...n2 } = Q2 ?? {};
1636
- return e("div", { style: { width: Qe, height: et, ...t2 }, className: "sheetxl-stage", tabIndex: 0, ref: Pe2, ...n2, ...me2, children: ne2 ? ne2(At) : At });
1637
- }, [Qe, et, At, Q2, ne2]), Ht = w(false);
1674
+ }, [Me2, st, _2, G2]), Ut = y(() => {
1675
+ const { style: t2, ...n2 } = J2 ?? {};
1676
+ return e("div", { style: { width: Qe, height: et, ...t2 }, className: "sheetxl-stage", tabIndex: 0, ref: Ie2, ...n2, ...me2, children: Q2 ? Q2(Wt) : Wt });
1677
+ }, [Qe, et, Wt, J2, Q2]), Ht = w(false);
1638
1678
  return m(() => {
1639
1679
  !Ht.current && Ot && (Ht.current = true, Ce2?.(Mt.current));
1640
- }, [Ot]), t("div", { className: M("sheetxl-grid", Ie["sheetxl-grid"]), style: { overflow: "visible", cursor: W2, maxWidth: Qe, maxHeight: et, width: Qe, height: et, ...pe2 }, ref: Mt, children: [Ut, t("div", { className: M("sheetxl-overlays"), ref: Oe2, ..._2, children: [Vt, Ft, Wt] })] });
1680
+ }, [Ot]), t("div", { className: M("sheetxl-grid", De["sheetxl-grid"]), style: { overflow: "visible", cursor: A2, maxWidth: Qe, maxHeight: et, width: Qe, height: et, ...pe2 }, ref: Mt, children: [Ut, t("div", { className: M("sheetxl-overlays"), ref: Ee2, ...Z2, children: [Vt, Ft, At] })] });
1641
1681
  }));
1642
- Oe.displayName = "BaseGrid";
1643
- const ze = b(C((t2, n2) => {
1682
+ Ae.displayName = "BaseGrid";
1683
+ const We = b(C((t2, n2) => {
1644
1684
  const { width: o2, height: r2, style: l2 = {}, className: i2, ...c2 } = t2, [s2, { width: a2, height: d2 }] = z();
1645
- return e("div", { className: i2, style: { ...l2 }, children: e("div", { style: { position: "relative", top: "0px", left: "0px", width: "100%", height: "100%", maxWidth: "100%", maxHeight: "100%", boxSizing: "content-box" }, ref: s2, children: e(Oe, { ref: n2, width: o2 ?? a2, height: r2 ?? d2, ...c2 }) }) });
1685
+ return e("div", { className: i2, style: { ...l2 }, children: e("div", { style: { position: "relative", top: "0px", left: "0px", width: "100%", height: "100%", maxWidth: "100%", maxHeight: "100%", boxSizing: "content-box" }, ref: s2, children: e(Ae, { ref: n2, width: o2 ?? a2, height: r2 ?? d2, ...c2 }) }) });
1646
1686
  }));
1647
- ze.displayName = "Grid";
1648
- const Le = b(C((t2, n2) => {
1687
+ We.displayName = "Grid";
1688
+ const Ve = b(C((t2, n2) => {
1649
1689
  const { showVerticalScrollbar: o2, showHorizontalScrollbar: r2, createHorizontalScrollbar: l2, createVerticalScrollbar: i2, createScrollCorner: c2, viewport: s2, onScrollViewport: a2, style: d2 = {}, className: u2, onScroll: h2, ...g2 } = t2, [x2, m2] = p(null), S2 = w(null), y2 = w(null);
1650
1690
  R(!s2, "Viewport can not be specified"), E(n2, () => y2.current && S2.current ? Object.assign(y2.current, S2.current) : null);
1651
1691
  const b2 = v((e2) => {
1652
1692
  y2.current?.scrollTo(e2), a2?.(e2);
1653
1693
  }, []);
1654
- return e(f, { className: u2, style: d2, ref: S2, showVerticalScrollbar: o2, showHorizontalScrollbar: r2, createHorizontalScrollbar: l2, createVerticalScrollbar: i2, createScrollCorner: c2, viewport: x2, onScrollViewport: b2, children: e(ze, { style: { width: "100%", height: "100%" }, ...g2, onViewportChange: (e2) => m2(e2), ref: y2 }) });
1694
+ return e(f, { className: u2, style: d2, ref: S2, showVerticalScrollbar: o2, showHorizontalScrollbar: r2, createHorizontalScrollbar: l2, createVerticalScrollbar: i2, createScrollCorner: c2, viewport: x2, onScrollViewport: b2, children: e(We, { style: { width: "100%", height: "100%" }, ...g2, onViewportChange: (e2) => m2(e2), ref: y2 }) });
1655
1695
  }));
1656
- Le.displayName = "ScrollableGrid";
1657
- const $e = () => false, Be = b((t2) => {
1658
- const { index: n2, value: o2, zoom: r2, zoomScale: l2 = 100, headerText: c2 = (e2) => `${e2}`, headerStyle: s2, headerStyleSelect: a2 = s2, headerStyleSelectAll: d2 = a2, headerStyleHover: u2 = d2, verticalPadding: h2 = 0, horizontalPadding: g2 = 0, isSelected: f2 = $e, isSelectedAll: x2 = $e, coords: m2, bounds: v2, range: S2, orientation: y2, view: b2, style: C2, ...I2 } = t2, E2 = l2 / 100, R2 = w(null), [M2, k2] = p(false), T2 = f2?.(n2) || false, O2 = x2?.(n2) || false ? d2 : T2 ? a2 : s2;
1696
+ Ve.displayName = "ScrollableGrid";
1697
+ const Ue = () => false, He = b((t2) => {
1698
+ const { index: n2, value: o2, zoom: r2, zoomScale: l2 = 100, headerText: c2 = (e2) => `${e2}`, headerStyle: s2, headerStyleSelect: a2 = s2, headerStyleSelectAll: d2 = a2, headerStyleHover: u2 = d2, verticalPadding: h2 = 0, horizontalPadding: g2 = 0, isSelected: f2 = Ue, isSelectedAll: x2 = Ue, coords: m2, bounds: v2, range: S2, orientation: y2, view: b2, style: C2, ...I2 } = t2, E2 = l2 / 100, R2 = w(null), [M2, k2] = p(false), T2 = f2?.(n2) || false, O2 = x2?.(n2) || false ? d2 : T2 ? a2 : s2;
1659
1699
  let z2 = O2;
1660
1700
  if (M2) {
1661
1701
  let e2 = u2;
@@ -1667,8 +1707,8 @@ const $e = () => false, Be = b((t2) => {
1667
1707
  k2(false);
1668
1708
  }, children: c2(n2) });
1669
1709
  });
1670
- Be.displayName = "HeaderRenderer";
1671
- const Fe = "ew-resize", We = "ns-resize", Ae = b(C((n2, o2) => {
1710
+ He.displayName = "HeaderRenderer";
1711
+ const Ke = "ew-resize", Ne = "ns-resize", qe = b(C((n2, o2) => {
1672
1712
  const { orientation: r2, view: l2, index: c2, className: s2, style: a2, disabled: d2 = false, disabledResize: u2 = false, isNextHidden: h2, isHidden: g2, isSelected: f2, isSelectedAll: w2, showTouchDivider: x2, headerStyle: p2, headerStyleSelect: m2, headerStyleSelectAll: v2, headerStyleHover: S2, bounds: y2, onPointerDown: b2, onAutoFit: C2, ...I2 } = n2, E2 = r2 === D.Column;
1673
1713
  let R2 = p2;
1674
1714
  f2 && m2 && (R2 = m2), w2 && v2 && (R2 = v2);
@@ -1676,14 +1716,14 @@ const Fe = "ew-resize", We = "ns-resize", Ae = b(C((n2, o2) => {
1676
1716
  let P2 = E2 ? 14 : 8, T2 = P2 / 2, O2 = 0;
1677
1717
  h2 && (O2 = -2), g2 && (O2 = 2), g2 && (P2 = P2 / 2 + O2, T2 = 2 * O2);
1678
1718
  let z2 = R2.dividerStrokeFill ?? R2.strokeFill;
1679
- return !(f2 || w2) && 0 === O2 && (z2 = `linear-gradient(${E2 ? 180 : 90}deg, ${R2.fill}, ${z2} 55%, ${z2} 100%)`), t("div", { className: M("header-divider", { disabled: d2 }, s2, `index-${c2}`), ref: o2, onPointerDown: k2 ? void 0 : b2, onDoubleClick: k2 ? void 0 : () => C2?.(), style: { top: (E2 ? 0 : -P2 / 2 + (O2 - 1)) + "px", left: (E2 ? -P2 / 2 + (O2 - 1) : 0) + "px", width: E2 ? P2 : "calc(100% + 1px)", height: E2 ? "calc(100% + 1px)" : P2, position: "absolute", overflow: "visible", pointerEvents: "all", cursor: d2 || u2 || k2 ? void 0 : E2 ? Fe : We, ...a2 }, ...I2, children: [e("div", { style: { position: "relative", top: `${E2 ? 0 : T2}px`, left: `${E2 ? T2 : 0}px`, width: E2 ? 1 : "100%", height: E2 ? "100%" : 1, background: z2 }, onDoubleClick: () => C2?.() }), x2 && k2 ? e("div", { style: { position: "absolute", cursor: "grab", zIndex: 1, borderRadius: "4px", right: E2 ? "-6px" : "2px", bottom: E2 ? "2px" : "-9px", height: "24px", width: E2 ? "24px" : "18px", maxHeight: E2 ? "calc(100% - 4px)" : void 0, maxWidth: E2 ? void 0 : "calc(100% - 4px)", background: R2.fill, border: `${v2.edgeStrokeFill} solid 1px`, boxShadow: `0.5px 0.5px 0px 0px ${p2.text.fill}`, display: "flex", alignItems: "center", justifyContent: "center" }, onPointerDown: b2, children: e("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(m2.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: E2 ? void 0 : "rotate(90deg)" } }) }) : null] });
1680
- })), Ve = (t2, n2) => e(Ae, { ...t2, ref: n2 }), Ue = b(C((r2, l2) => {
1681
- const { orientation: i2, view: c2, index: a2, disabled: u2 = false, disabledResize: h2 = false, resizeThreshold: g2 = 1, dividerRenderer: f2 = Ve, onDividerMouseDown: x2, onDividerResizeStart: m2, onDividerResize: v2, onDividerResizeEnd: S2, onDividerMouseUp: y2, onDividerAutoFit: b2, onPointerDown: C2, ...I2 } = r2, E2 = o(C2, [C2]), R2 = o(b2, [b2]), k2 = i2 === D.Column;
1719
+ return !(f2 || w2) && 0 === O2 && (z2 = `linear-gradient(${E2 ? 180 : 90}deg, ${R2.fill}, ${z2} 55%, ${z2} 100%)`), t("div", { className: M("header-divider", { disabled: d2 }, s2, `index-${c2}`), ref: o2, onPointerDown: k2 ? void 0 : b2, onDoubleClick: k2 ? void 0 : () => C2?.(), style: { top: (E2 ? 0 : -P2 / 2 + (O2 - 1)) + "px", left: (E2 ? -P2 / 2 + (O2 - 1) : 0) + "px", width: E2 ? P2 : "calc(100% + 1px)", height: E2 ? "calc(100% + 1px)" : P2, position: "absolute", overflow: "visible", pointerEvents: "all", cursor: d2 || u2 || k2 ? void 0 : E2 ? Ke : Ne, ...a2 }, ...I2, children: [e("div", { style: { position: "relative", top: `${E2 ? 0 : T2}px`, left: `${E2 ? T2 : 0}px`, width: E2 ? 1 : "100%", height: E2 ? "100%" : 1, background: z2 }, onDoubleClick: () => C2?.() }), x2 && k2 ? e("div", { style: { position: "absolute", cursor: "grab", zIndex: 1, borderRadius: "4px", right: E2 ? "-6px" : "2px", bottom: E2 ? "2px" : "-9px", height: "24px", width: E2 ? "24px" : "18px", maxHeight: E2 ? "calc(100% - 4px)" : void 0, maxWidth: E2 ? void 0 : "calc(100% - 4px)", background: R2.fill, border: `${v2.edgeStrokeFill} solid 1px`, boxShadow: `0.5px 0.5px 0px 0px ${p2.text.fill}`, display: "flex", alignItems: "center", justifyContent: "center" }, onPointerDown: b2, children: e("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(m2.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: E2 ? void 0 : "rotate(90deg)" } }) }) : null] });
1720
+ })), je = (t2, n2) => e(qe, { ...t2, ref: n2 }), Xe = b(C((r2, l2) => {
1721
+ const { orientation: i2, view: c2, index: a2, disabled: u2 = false, disabledResize: h2 = false, resizeThreshold: g2 = 1, dividerRenderer: f2 = je, onDividerMouseDown: x2, onDividerResizeStart: m2, onDividerResize: v2, onDividerResizeEnd: S2, onDividerMouseUp: y2, onDividerAutoFit: b2, onPointerDown: C2, ...I2 } = r2, E2 = o(C2, [C2]), R2 = o(b2, [b2]), k2 = i2 === D.Column;
1682
1722
  let P2 = k2 ? c2.getVisibleColumns() : c2.getVisibleRows(), T2 = null;
1683
- P2.length > 0 && (k2 ? T2 = c2.getRangeCoordsBounds({ rowStart: 0, rowEnd: 0, colStart: P2[0], colEnd: P2[P2.length - 1] }) : c2.getRangeCoordsBounds({ rowStart: P2[0], rowEnd: P2[P2.length - 1], colStart: 0, colEnd: 0 }), T2 = c2.toClipBounds(T2, xe));
1684
- const O2 = w(null), [z2, $2] = p(null), B2 = (e2, t2) => k2 ? e2.clientX - t2.clientX : e2.clientY - t2.clientY, F2 = c2.getLayout(), W2 = k2 ? F2.getColOffset(a2 + 1) : F2.getRowOffset(a2 + 1), A2 = s({ processTouch: true, onPointerDown: (e2) => {
1723
+ P2.length > 0 && (k2 ? T2 = c2.getRangeCoordsBounds({ rowStart: 0, rowEnd: 0, colStart: P2[0], colEnd: P2[P2.length - 1] }) : c2.getRangeCoordsBounds({ rowStart: P2[0], rowEnd: P2[P2.length - 1], colStart: 0, colEnd: 0 }), T2 = c2.toClipBounds(T2, be));
1724
+ const O2 = w(null), [z2, $2] = p(null), B2 = (e2, t2) => k2 ? e2.clientX - t2.clientX : e2.clientY - t2.clientY, F2 = c2.getLayout(), A2 = k2 ? F2.getColOffset(a2 + 1) : F2.getRowOffset(a2 + 1), W2 = s({ processTouch: true, onPointerDown: (e2) => {
1685
1725
  if (E2?.(e2), !u2 && !h2) {
1686
- const e3 = k2 ? F2.getColOffset(a2) : F2.getRowOffset(a2), t2 = W2 - e3;
1726
+ const e3 = k2 ? F2.getColOffset(a2) : F2.getRowOffset(a2), t2 = A2 - e3;
1687
1727
  O2.current = { isResizing: false, startSize: t2, index: a2, view: c2, orientation: i2, onDividerMouseDown: x2, onDividerResizeStart: m2, onDividerResize: v2, onDividerResizeEnd: S2, onDividerMouseUp: y2 }, $2(O2.current), x2?.(a2, t2);
1688
1728
  }
1689
1729
  e2.stopPropagation(), e2.preventDefault();
@@ -1700,13 +1740,13 @@ const Fe = "ew-resize", We = "ns-resize", Ae = b(C((n2, o2) => {
1700
1740
  R2?.(a2);
1701
1741
  }, [a2]);
1702
1742
  if (!T2) return;
1703
- const U2 = f2({ bounds: T2, orientation: i2, view: c2, index: a2, disabled: u2, disabledResize: h2, onAutoFit: V2, onPointerDown: A2, ...I2 }, l2);
1743
+ const U2 = f2({ bounds: T2, orientation: i2, view: c2, index: a2, disabled: u2, disabledResize: h2, onAutoFit: V2, onPointerDown: W2, ...I2 }, l2);
1704
1744
  if (!U2) return;
1705
1745
  const { getPortalContainer: H2 } = d();
1706
1746
  let K2 = null;
1707
- return z2 && z2.isResizing && z2.index === a2 && (K2 = L(e("div", { style: { position: "absolute", cursor: k2 ? Fe : We, left: 0, top: 0, width: "100%", height: "100%" } }), H2(), "divider:" + a2)), t(n, { children: [K2, e("div", { className: M("header-divider-anchor"), style: { position: "absolute", pointerEvents: "auto", top: `${k2 ? T2.y : W2}px`, left: `${k2 ? W2 : T2.x}px`, width: (k2 ? 0 : T2.width - 1) + "px", height: (k2 ? T2.height - 1 : 0) + "px", display: "flex" }, tabIndex: -1, children: U2 })] });
1747
+ return z2 && z2.isResizing && z2.index === a2 && (K2 = L(e("div", { style: { position: "absolute", cursor: k2 ? Ke : Ne, left: 0, top: 0, width: "100%", height: "100%" } }), H2(), "divider:" + a2)), t(n, { children: [K2, e("div", { className: M("header-divider-anchor"), style: { position: "absolute", pointerEvents: "auto", top: `${k2 ? T2.y : A2}px`, left: `${k2 ? A2 : T2.x}px`, width: (k2 ? 0 : T2.width - 1) + "px", height: (k2 ? T2.height - 1 : 0) + "px", display: "flex" }, tabIndex: -1, children: U2 })] });
1708
1748
  }));
1709
- class He {
1749
+ class Ye {
1710
1750
  naturalDimensions(e2, t2 = {}) {
1711
1751
  const n2 = document.createElement("div");
1712
1752
  let o2 = t2?.lineHeight ?? "1";
@@ -1723,16 +1763,16 @@ class He {
1723
1763
  return r2.remove(), { width: i2.width, height: i2.height, maxLineHeight: 1.2 * (t2.paintableText?.fontSize || 1056 / 72) };
1724
1764
  }
1725
1765
  }
1726
- const Ke = (e2 = void 0) => Object.freeze({ clean: e2, dirty: void 0, editMode: false }), Ne = Ke(), qe = b(C((t2, n2) => {
1727
- const { editState: r2 = Ne, defaultTextStyle: i2, onStartEdit: c2, onChangeEdit: s2, onSubmitEdit: a2, onCancelEdit: d2, onDoneEdit: u2, containerBounds: h2, setNaturalDimensions: f2, onNavigate: x2, textProperties: b2, style: C2, autoFocus: I2, ...E2 } = t2, R2 = w(null), { width: M2 = 0 } = h2 ?? {}, [k2, P2] = p(() => r2);
1766
+ const Ge = (e2 = void 0) => Object.freeze({ clean: e2, dirty: void 0, editMode: false }), Ze = Ge(), _e = b(C((t2, n2) => {
1767
+ const { editState: r2 = Ze, defaultTextStyle: i2, onStartEdit: c2, onChangeEdit: s2, onSubmitEdit: a2, onCancelEdit: d2, onDoneEdit: u2, containerBounds: h2, setNaturalDimensions: f2, onNavigate: x2, textProperties: b2, style: C2, autoFocus: I2, ...E2 } = t2, R2 = w(null), { width: M2 = 0 } = h2 ?? {}, [k2, P2] = p(() => r2);
1728
1768
  m(() => {
1729
1769
  P2(r2);
1730
1770
  }, [r2]);
1731
- const D2 = b2?.align || "left", O2 = b2?.vAlign || "middle", z2 = b2?.fill || "#040404", L2 = b2?.wrap || "wrap", $2 = b2?.fontFamily || "Calibri", B2 = b2?.fontSize || 11, F2 = b2?.fontWeight || 400, W2 = b2?.fontStyle || "normal", A2 = k2.dirty ?? k2.clean ?? "";
1771
+ const D2 = b2?.align || "left", O2 = b2?.vAlign || "middle", z2 = b2?.fill || "#040404", L2 = b2?.wrap || "wrap", $2 = b2?.fontFamily || "Calibri", B2 = b2?.fontSize || 11, F2 = b2?.fontWeight || 400, A2 = b2?.fontStyle || "normal", W2 = k2.dirty ?? k2.clean ?? "";
1732
1772
  let V2 = 2;
1733
1773
  const H2 = 96 * B2 / 72, K2 = 1.2 * H2;
1734
1774
  "right" === O2 && (V2 += 1);
1735
- const N2 = y(() => new He().naturalDimensions(A2, { maxWidth: "wrap" === L2 ? M2 - V2 : void 0, lineHeight: `${K2}px`, paintableText: { fontStyle: W2, wrap: L2, letterSpacing: -0.25 } }), [A2, L2, V2, H2, $2, F2, W2, f2, M2]), q2 = v(() => N2.maxLineHeight ? N2.maxLineHeight + "px" : "1.2", [N2]), [j2, X2] = p(q2);
1775
+ const N2 = y(() => new Ye().naturalDimensions(W2, { maxWidth: "wrap" === L2 ? M2 - V2 : void 0, lineHeight: `${K2}px`, paintableText: { fontStyle: A2, wrap: L2, letterSpacing: -0.25 } }), [W2, L2, V2, H2, $2, F2, A2, f2, M2]), q2 = v(() => N2.maxLineHeight ? N2.maxLineHeight + "px" : "1.2", [N2]), [j2, X2] = p(q2);
1736
1776
  S(() => {
1737
1777
  X2(q2());
1738
1778
  }, [h2, N2]), S(() => {
@@ -1799,39 +1839,40 @@ const Ke = (e2 = void 0) => Object.freeze({ clean: e2, dirty: void 0, editMode:
1799
1839
  }, autoFocus() {
1800
1840
  R2.current?.focus();
1801
1841
  }, getLineHeight: () => N2?.maxLineHeight ?? K2, dispatchEvent: (e2) => R2.current.dispatchEvent(e2) }), [r2, c2]);
1802
- return e("div", { ref: ne2, ...E2, style: { background: "transparent", display: "flex", flexGrow: 1, alignSelf: "center", height: N2.height, maxWidth: "100%", maxHeight: "100%", ...C2 }, children: e("textarea", { spellCheck: "false", ref: R2, value: A2, autoFocus: false, disabled: ee2, name: "cell-editor", autoComplete: "off", autoCapitalize: "off", style: { flex: "1 1 100%", position: "relative", fontSize: `${H2}px`, fontFamily: `${$2}`, fontWeight: `${F2}`, fontStyle: `${W2}`, padding: "0px", marginRight: "right" === D2 ? "3px" : "0px", marginLeft: "left" === D2 ? "2px" : "0px", lineHeight: j2, height: N2.height, textRendering: "geometricPrecision", letterSpacing: "-0.25px", boxSizing: "border-box", borderWidth: 0, outline: "none", resize: "none", overflow: "hidden", verticalAlign: "baseline", textAlign: D2, background: "transparent", color: z2, marginBottom: "0px", userSelect: "text", maxHeight: "100%", whiteSpace: "wrap" === L2 ? "break-spaces" : "pre", wordWrap: "break-word" }, onChange: (e2) => {
1842
+ return e("div", { ref: ne2, ...E2, style: { background: "transparent", display: "flex", flexGrow: 1, alignSelf: "center", height: N2.height, maxWidth: "100%", maxHeight: "100%", ...C2 }, children: e("textarea", { spellCheck: "false", ref: R2, value: W2, autoFocus: false, disabled: ee2, name: "cell-editor", autoComplete: "off", autoCapitalize: "off", style: { flex: "1 1 100%", position: "relative", fontSize: `${H2}px`, fontFamily: `${$2}`, fontWeight: `${F2}`, fontStyle: `${A2}`, padding: "0px", marginRight: "right" === D2 ? "3px" : "0px", marginLeft: "left" === D2 ? "2px" : "0px", lineHeight: j2, height: N2.height, textRendering: "geometricPrecision", letterSpacing: "-0.25px", boxSizing: "border-box", borderWidth: 0, outline: "none", resize: "none", overflow: "hidden", verticalAlign: "baseline", textAlign: D2, background: "transparent", color: z2, marginBottom: "0px", userSelect: "text", maxHeight: "100%", whiteSpace: "wrap" === L2 ? "break-spaces" : "pre", wordWrap: "break-word" }, onChange: (e2) => {
1803
1843
  G2(e2.target.value);
1804
1844
  }, onDoubleClick: (e2) => {
1805
1845
  e2.isTrusted;
1806
1846
  }, onMouseDown: (e2) => {
1807
1847
  Z2(true);
1808
1848
  }, onKeyDown: Q2 }) });
1809
- })), je = b((t2) => {
1849
+ })), Je = b((t2) => {
1810
1850
  const { value: n2, view: o2, bounds: r2, range: l2, zoom: i2, children: c2, style: s2, ...a2 } = t2;
1811
1851
  return e("div", { style: { padding: "2px 4px", fontFamily: "Calibri", letterSpacing: -0.25, lineHeight: 1.2, fontSize: s2?.fontSize || 1056 / 72, ...s2 }, ...a2, children: n2 });
1812
1852
  });
1813
1853
  export {
1814
- Oe as BaseGrid,
1815
- qe as DefaultCellEditor,
1816
- je as DefaultCellRenderer,
1817
- Ae as DefaultHeaderDivider,
1818
- fe as FillHandle,
1819
- ze as Grid,
1820
- Ue as HeaderDivider,
1821
- Be as HeaderRenderer,
1822
- Pe as RESET_SCROLL_EVENTS_DEBOUNCE_INTERVAL,
1823
- xe as SELECTION_CLIP_INSETS,
1854
+ Ae as BaseGrid,
1855
+ _e as DefaultCellEditor,
1856
+ Je as DefaultCellRenderer,
1857
+ qe as DefaultHeaderDivider,
1858
+ ve as FillHandle,
1859
+ We as Grid,
1860
+ Xe as HeaderDivider,
1861
+ He as HeaderRenderer,
1862
+ $e as RESET_SCROLL_EVENTS_DEBOUNCE_INTERVAL,
1863
+ be as SELECTION_CLIP_INSETS,
1824
1864
  U as STANDARD_KEY_CHARS,
1825
- de as SVGLine,
1826
- ue as SVGRect,
1827
- Le as ScrollableGrid,
1828
- ge as Selection,
1829
- we as TouchSelectHandle,
1830
- he as defaultSelectionRenderer,
1831
- Ke as getDefaultStringEditState,
1832
- Se as safeSelectionCoords,
1865
+ we as SVGLine,
1866
+ xe as SVGRect,
1867
+ Ve as ScrollableGrid,
1868
+ me as Selection,
1869
+ ye as TouchSelectHandle,
1870
+ pe as defaultSelectionRenderer,
1871
+ Ge as getDefaultStringEditState,
1872
+ Re as safeSelectionCoords,
1873
+ J as useAnimatedMeasure,
1833
1874
  V as useCellLayout,
1834
- Y as useHeaderSelection,
1875
+ Q as useHeaderSelection,
1835
1876
  X as useKeyboardEditorOverlay,
1836
- Ce as useSelection
1877
+ Pe as useSelection
1837
1878
  };