@aiquants/virtualscroll 2.2.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -182,7 +182,7 @@ const Ke = {
182
182
  )
183
183
  ] });
184
184
  }, er = ir(
185
- $e(({ onDragChange: r, className: t, maxVisualDistance: e = 160, size: n = 40, style: i, opacity: s = 1, renderVisual: a }, c) => {
185
+ $e(({ onDragChange: r, className: t, maxVisualDistance: e = 160, size: n = 40, style: i, opacity: s = 1, renderVisual: l }, c) => {
186
186
  const [d, b] = re(Ke), I = x(null), v = x(null), C = x({ x: 0, y: 0 }), p = x(null), V = x(0), z = S(
187
187
  (T) => {
188
188
  b(T), r(T);
@@ -280,7 +280,7 @@ const Ke = {
280
280
  }),
281
281
  [Q]
282
282
  );
283
- const O = Math.min(Math.max(s, 0), 1), P = n / 64, U = Math.min(d.distance, e) / e, Z = d.direction * U * 10 * P, w = a ?? ar, lt = {
283
+ const O = Math.min(Math.max(s, 0), 1), P = n / 64, U = Math.min(d.distance, e) / e, Z = d.direction * U * 10 * P, w = l ?? ar, lt = {
284
284
  dragState: d,
285
285
  normalizedDistance: U,
286
286
  sizeScale: P,
@@ -364,8 +364,8 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
364
364
  maxSpeedCurve: r?.maxSpeedCurve ?? ee.maxSpeedCurve
365
365
  };
366
366
  }, xr = ({ isDragging: r, isThumbHovered: t, enableThumbDrag: e }) => Ft(() => e ? r ? "dragging" : t ? "hover" : "idle" : "disabled", [e, r, t]), Ir = ({ canUseArrowButtons: r, enableArrowButtons: t, resetTapScroll: e, scrollByStep: n }) => {
367
- const i = x(null), s = x(null), a = x(null), c = S(() => {
368
- i.current !== null && (window.clearInterval(i.current), i.current = null), s.current !== null && (window.clearTimeout(s.current), s.current = null), a.current !== null && (window.removeEventListener("pointerup", a.current), window.removeEventListener("pointercancel", a.current), window.removeEventListener("blur", a.current), a.current = null);
367
+ const i = x(null), s = x(null), l = x(null), c = S(() => {
368
+ i.current !== null && (window.clearInterval(i.current), i.current = null), s.current !== null && (window.clearTimeout(s.current), s.current = null), l.current !== null && (window.removeEventListener("pointerup", l.current), window.removeEventListener("pointercancel", l.current), window.removeEventListener("blur", l.current), l.current = null);
369
369
  }, []), d = S(() => {
370
370
  c();
371
371
  }, [c]), b = S(
@@ -378,7 +378,7 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
378
378
  }, cr);
379
379
  }, lr);
380
380
  const p = () => c();
381
- a.current = p, window.addEventListener("pointerup", p), window.addEventListener("pointercancel", p), window.addEventListener("blur", p);
381
+ l.current = p, window.addEventListener("pointerup", p), window.addEventListener("pointercancel", p), window.addEventListener("blur", p);
382
382
  },
383
383
  [r, c, e, n]
384
384
  ), I = S(
@@ -392,11 +392,11 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
392
392
  }, [r, c]), Y(() => () => {
393
393
  c();
394
394
  }, [c]), { handleArrowPointerDown: b, handleArrowPointerUp: d, handleArrowKeyDown: I };
395
- }, Tr = 700, he = (r, t) => typeof r == "number" && Number.isFinite(r) ? r : t, Sr = ({ distance: r, maxDistance: t, viewportSize: e, minSpeedMultiplier: n, maxSpeedMultiplier: i, hasCustomMaxSpeedMultiplier: s, curve: a }) => {
396
- const c = Math.max(he(r, 0), 0), d = he(t, 0), b = d > 0 ? Math.min(c, d) / d : 1, I = Math.max(he(e, 0), 0), v = Math.max(he(n, 0), 0), C = Math.max(he(i, 0), 0), p = Math.max(I * v, 40), V = s ? p : 1200, z = Math.max(I * C, V), W = a ? Math.max(he(a.exponentialScale, C), 0) : 0, at = a ? Math.min(z, Math.max(I * W, p)) : z, Q = Math.max(at, p);
395
+ }, Tr = 700, he = (r, t) => typeof r == "number" && Number.isFinite(r) ? r : t, Sr = ({ distance: r, maxDistance: t, viewportSize: e, minSpeedMultiplier: n, maxSpeedMultiplier: i, hasCustomMaxSpeedMultiplier: s, curve: l }) => {
396
+ const c = Math.max(he(r, 0), 0), d = he(t, 0), b = d > 0 ? Math.min(c, d) / d : 1, I = Math.max(he(e, 0), 0), v = Math.max(he(n, 0), 0), C = Math.max(he(i, 0), 0), p = Math.max(I * v, 40), V = s ? p : 1200, z = Math.max(I * C, V), W = l ? Math.max(he(l.exponentialScale, C), 0) : 0, at = l ? Math.min(z, Math.max(I * W, p)) : z, Q = Math.max(at, p);
397
397
  let tt = b ** 1.1;
398
- if (a) {
399
- const Et = Math.min(Math.max(he(a.exponentialSteepness, 0), 0), Tr);
398
+ if (l) {
399
+ const Et = Math.min(Math.max(he(l.exponentialSteepness, 0), 0), Tr);
400
400
  if (Et === 0)
401
401
  tt = b;
402
402
  else {
@@ -404,7 +404,7 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
404
404
  tt = Math.min(Math.max(Math.expm1(Et * b) / A, 0), 1);
405
405
  }
406
406
  }
407
- const xt = Math.min(Math.max(he(a?.easedOffset, 0), 0), 1);
407
+ const xt = Math.min(Math.max(he(l?.easedOffset, 0), 0), 1);
408
408
  return p + (Q - p) * (xt + (1 - xt) * tt);
409
409
  }, vr = (r) => {
410
410
  if (!r || r <= 0)
@@ -418,7 +418,7 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
418
418
  onScroll: n,
419
419
  enableThumbDrag: i = !0,
420
420
  enableTrackClick: s = !0,
421
- enableArrowButtons: a = !0,
421
+ enableArrowButtons: l = !0,
422
422
  horizontal: c = !1,
423
423
  scrollBarWidth: d = 12,
424
424
  className: b,
@@ -460,7 +460,7 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
460
460
  effectiveTrackLength: 0,
461
461
  onScroll: n,
462
462
  scrollPosition: e
463
- }), { mainSizeKey: zt, crossSizeKey: Jt, positionKey: $t, selectDelta: h, getPointerCoordinate: k, arrowLabels: gt, arrowIcons: X, directionClass: Pt, orientation: ct } = Dt, It = Math.max(Lt, 1), Mt = t / r, yt = Math.max(t - d * 2, 0), ut = Mt * yt, At = Math.min(Math.max(We, ut || 0), yt || We), dt = r - t, st = Math.max(yt - At, 0), _t = dt <= 0 || st <= 0 ? 0 : rt(e / dt * st, 0, st), Xt = _t + At / 2, Nt = r > t || W, ne = Nt && a;
463
+ }), { mainSizeKey: zt, crossSizeKey: Jt, positionKey: $t, selectDelta: h, getPointerCoordinate: k, arrowLabels: gt, arrowIcons: X, directionClass: Pt, orientation: ct } = Dt, It = Math.max(Lt, 1), Mt = t / r, yt = Math.max(t - d * 2, 0), ut = Mt * yt, At = Math.min(Math.max(We, ut || 0), yt || We), dt = r - t, st = Math.max(yt - At, 0), _t = dt <= 0 || st <= 0 ? 0 : rt(e / dt * st, 0, st), Xt = _t + At / 2, Nt = r > t || W, ne = Nt && l;
464
464
  Me(() => {
465
465
  Vt.current = {
466
466
  viewportSize: t,
@@ -495,8 +495,8 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
495
495
  (o) => {
496
496
  const g = Vt.current, y = U.current;
497
497
  if (!g.scrollBarVisible || g.maxScrollPosition <= 0) {
498
- const ue = Ct(0, y), l = ue - y;
499
- return { nextPosition: ue, actualDelta: l, reachedBoundary: !0 };
498
+ const ue = Ct(0, y), a = ue - y;
499
+ return { nextPosition: ue, actualDelta: a, reachedBoundary: !0 };
500
500
  }
501
501
  if (o === 0)
502
502
  return { nextPosition: y, actualDelta: 0, reachedBoundary: !1 };
@@ -656,7 +656,7 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
656
656
  [M]
657
657
  ), { handleArrowPointerDown: Ce, handleArrowPointerUp: Se, handleArrowKeyDown: Ut } = Ir({
658
658
  canUseArrowButtons: ne,
659
- enableArrowButtons: a,
659
+ enableArrowButtons: l,
660
660
  resetTapScroll: Tt,
661
661
  scrollByStep: me
662
662
  }), Ve = (o) => {
@@ -755,7 +755,7 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
755
755
  onPointerLeave: Se,
756
756
  onPointerCancel: Se,
757
757
  onKeyDown: Ut(o),
758
- "aria-disabled": !a,
758
+ "aria-disabled": !l,
759
759
  disabled: !ne,
760
760
  children: /* @__PURE__ */ ot("span", { "aria-hidden": "true", children: y })
761
761
  },
@@ -888,7 +888,7 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
888
888
  scrollBarWidth: n = 12,
889
889
  enableThumbDrag: i = !0,
890
890
  enableTrackClick: s = !0,
891
- enableArrowButtons: a = !0,
891
+ enableArrowButtons: l = !0,
892
892
  enablePointerDrag: c = !0,
893
893
  pointerDragInputs: d = Mr,
894
894
  onScroll: b,
@@ -1244,7 +1244,7 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
1244
1244
  onScroll: $t,
1245
1245
  enableThumbDrag: i,
1246
1246
  enableTrackClick: s,
1247
- enableArrowButtons: a,
1247
+ enableArrowButtons: l,
1248
1248
  scrollBarWidth: n,
1249
1249
  ariaControls: de,
1250
1250
  tapScrollCircleOptions: V,
@@ -1259,14 +1259,14 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
1259
1259
  ] });
1260
1260
  }
1261
1261
  ), Ge = (r, t, e) => Math.min(Math.max(r, t), e), Br = ({ dragState: r, normalizedDistance: t, sizeScale: e, size: n }) => {
1262
- const i = Math.max(n / 2, 1), s = 1 + t * 0.65, a = Math.max(0.65, 1 - t * 0.25), c = r.direction * t * 26 * e, d = 0.8 + t * 0.18, b = 3 * e, I = 6 * e, v = 22 * e, C = Math.abs(c) + I, p = c > 0 ? b : -Math.abs(c) - b, V = Math.max(2.5, 3 * e), z = Ge(r.offsetX, -i, i), W = Ge(r.offsetY, -i, i), at = i * 0.35, Q = z / i * at, tt = W / i * at, xt = Q * 0.45, Et = tt * 0.45, A = Math.max(v * 0.38, 6), O = 0.65 + t * 0.2, P = r.active;
1262
+ const i = Math.max(n / 2, 1), s = 1 + t * 0.65, l = Math.max(0.65, 1 - t * 0.25), c = r.direction * t * 26 * e, d = 0.8 + t * 0.18, b = 3 * e, I = 6 * e, v = 22 * e, C = Math.abs(c) + I, p = c > 0 ? b : -Math.abs(c) - b, V = Math.max(2.5, 3 * e), z = Ge(r.offsetX, -i, i), W = Ge(r.offsetY, -i, i), at = i * 0.35, Q = z / i * at, tt = W / i * at, xt = Q * 0.45, Et = tt * 0.45, A = Math.max(v * 0.38, 6), O = 0.65 + t * 0.2, P = r.active;
1263
1263
  return /* @__PURE__ */ Te(tr, { children: [
1264
1264
  /* @__PURE__ */ ot(
1265
1265
  "div",
1266
1266
  {
1267
1267
  className: "aqvs-tap-scroll-circle-gradient",
1268
1268
  style: {
1269
- transform: `scale(${a}, ${s})`,
1269
+ transform: `scale(${l}, ${s})`,
1270
1270
  transition: P ? "40ms transform ease-out" : "200ms ease transform"
1271
1271
  }
1272
1272
  }
@@ -1278,7 +1278,7 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
1278
1278
  style: {
1279
1279
  width: v,
1280
1280
  height: v,
1281
- transform: `translate(calc(-50% + ${Q}px), calc(-50% + ${tt}px)) scale(${a}, ${d * s})`,
1281
+ transform: `translate(calc(-50% + ${Q}px), calc(-50% + ${tt}px)) scale(${l}, ${d * s})`,
1282
1282
  transition: P ? "70ms transform ease-out" : "200ms ease transform"
1283
1283
  }
1284
1284
  }
@@ -1290,7 +1290,7 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
1290
1290
  style: {
1291
1291
  width: A,
1292
1292
  height: A,
1293
- transform: `translate(calc(-50% + ${xt}px), calc(-50% + ${Et}px)) scale(${a}, ${s})`,
1293
+ transform: `translate(calc(-50% + ${xt}px), calc(-50% + ${Et}px)) scale(${l}, ${s})`,
1294
1294
  opacity: O,
1295
1295
  boxShadow: "0 0 8px rgba(255,255,255,0.45)",
1296
1296
  transition: P ? "120ms opacity 150ms, 120ms transform ease-out ease-out" : "220ms ease transform, 240ms opacity ease"
@@ -1393,7 +1393,7 @@ class ge {
1393
1393
  this.size = i, this.tree = /* @__PURE__ */ new Map(), this.deltas = /* @__PURE__ */ new Map(), this.valueFn = void 0, this.baseValue = e, this.total = this.baseValue * this.size;
1394
1394
  return;
1395
1395
  }
1396
- let s = 0, a;
1396
+ let s = 0, l;
1397
1397
  if (i > 0) {
1398
1398
  const c = n?.sampleRange ?? {
1399
1399
  from: 0,
@@ -1401,18 +1401,18 @@ class ge {
1401
1401
  };
1402
1402
  let d = Math.max(0, Math.trunc(c.from)), b = Math.min(Math.trunc(c.to), i - 1);
1403
1403
  if (d > b && (d = 0, b = Math.min(_e - 1, i - 1)), i > _e)
1404
- s = ge._sampleBaseValueStrided(e, i, _e), n?.materialize && (a = { from: d, values: ge._collectValidatedValues(e, d, b) });
1404
+ s = ge._sampleBaseValueStrided(e, i, _e), n?.materialize && (l = { from: d, values: ge._collectValidatedValues(e, d, b) });
1405
1405
  else {
1406
1406
  const I = ge._collectValidatedValues(e, d, b);
1407
- s = ge._modeOrMedian([...I]), n?.materialize && (a = { from: d, values: I });
1407
+ s = ge._modeOrMedian([...I]), n?.materialize && (l = { from: d, values: I });
1408
1408
  }
1409
1409
  }
1410
- if (this.size = i, this.tree = /* @__PURE__ */ new Map(), this.deltas = /* @__PURE__ */ new Map(), this.total = void 0, this.valueFn = e, this.baseValue = s, a)
1411
- for (let c = 0; c < a.values.length; c++) {
1412
- const d = a.from + c;
1410
+ if (this.size = i, this.tree = /* @__PURE__ */ new Map(), this.deltas = /* @__PURE__ */ new Map(), this.total = void 0, this.valueFn = e, this.baseValue = s, l)
1411
+ for (let c = 0; c < l.values.length; c++) {
1412
+ const d = l.from + c;
1413
1413
  if (d >= this.size)
1414
1414
  break;
1415
- const b = a.values[c] - this.baseValue;
1415
+ const b = l.values[c] - this.baseValue;
1416
1416
  b !== 0 && (this.deltas.set(d, b), this._updateTree(d, b));
1417
1417
  }
1418
1418
  this.total = this.getTotal();
@@ -1458,22 +1458,22 @@ class ge {
1458
1458
  static _modeOrMedian(t) {
1459
1459
  if (t.length === 0)
1460
1460
  return 0;
1461
- t.sort((a, c) => a - c);
1461
+ t.sort((l, c) => l - c);
1462
1462
  const e = Math.floor(t.length / 2);
1463
1463
  let n;
1464
1464
  t.length % 2 === 0 ? n = Math.floor((t[e - 1] + t[e]) / 2) : n = t[e];
1465
1465
  const i = /* @__PURE__ */ new Map();
1466
1466
  let s = 0;
1467
- for (const a of t) {
1468
- const c = (i.get(a) ?? 0) + 1;
1469
- i.set(a, c), c > s && (s = c);
1467
+ for (const l of t) {
1468
+ const c = (i.get(l) ?? 0) + 1;
1469
+ i.set(l, c), c > s && (s = c);
1470
1470
  }
1471
1471
  if (s > t.length * 0.2) {
1472
- const a = [];
1472
+ const l = [];
1473
1473
  for (const [d, b] of i.entries())
1474
- b === s && a.push(d);
1475
- const c = a.reduce((d, b) => d + b, 0);
1476
- n = Math.floor(c / a.length);
1474
+ b === s && l.push(d);
1475
+ const c = l.reduce((d, b) => d + b, 0);
1476
+ n = Math.floor(c / l.length);
1477
1477
  }
1478
1478
  return n;
1479
1479
  }
@@ -1493,8 +1493,8 @@ class ge {
1493
1493
  let i = Math.max(1, Math.ceil(e / n));
1494
1494
  i % 2 === 0 && (i += 1);
1495
1495
  const s = [];
1496
- for (let a = 0; a < e && s.length < n; a += i)
1497
- s.push(qe(t(a), a));
1496
+ for (let l = 0; l < e && s.length < n; l += i)
1497
+ s.push(qe(t(l), l));
1498
1498
  return ge._modeOrMedian(s);
1499
1499
  }
1500
1500
  /**
@@ -1542,14 +1542,14 @@ class ge {
1542
1542
  throw new Error(`Index must be an integer: ${n}`);
1543
1543
  if (!Number.isFinite(i))
1544
1544
  throw new Error(`Change must be a finite number: ${i}`);
1545
- const a = (e.get(n) ?? this.deltas.get(n) ?? 0) + i;
1546
- if (a + this.baseValue < -1e-9)
1547
- throw new Error(`Change would make the value at index ${n} negative: ${a + this.baseValue}`);
1548
- e.set(n, a);
1545
+ const l = (e.get(n) ?? this.deltas.get(n) ?? 0) + i;
1546
+ if (l + this.baseValue < -1e-9)
1547
+ throw new Error(`Change would make the value at index ${n} negative: ${l + this.baseValue}`);
1548
+ e.set(n, l);
1549
1549
  }
1550
1550
  for (const { index: n, change: i } of t) {
1551
- const a = (this.deltas.get(n) ?? 0) + i;
1552
- a === 0 ? this.deltas.delete(n) : this.deltas.set(n, a), this._updateTree(n, i);
1551
+ const l = (this.deltas.get(n) ?? 0) + i;
1552
+ l === 0 ? this.deltas.delete(n) : this.deltas.set(n, l), this._updateTree(n, i);
1553
1553
  }
1554
1554
  return this.total;
1555
1555
  }
@@ -1593,8 +1593,8 @@ class ge {
1593
1593
  throw new Error(`Value must be a finite number: ${s}`);
1594
1594
  if (s < 0)
1595
1595
  throw new Error("Value cannot be negative.");
1596
- const a = n.has(i) ? n.get(i) ?? 0 : this.deltas.get(i) ?? 0, c = a + this.baseValue, d = s - c;
1597
- d !== 0 && e.push({ index: i, change: d }), n.set(i, a + d);
1596
+ const l = n.has(i) ? n.get(i) ?? 0 : this.deltas.get(i) ?? 0, c = l + this.baseValue, d = s - c;
1597
+ d !== 0 && e.push({ index: i, change: d }), n.set(i, l + d);
1598
1598
  }
1599
1599
  return e;
1600
1600
  }
@@ -1630,8 +1630,8 @@ class ge {
1630
1630
  if (this.valueFn) {
1631
1631
  const n = this.deltas.get(t) ?? 0, s = qe(this.valueFn(t), t) - this.baseValue;
1632
1632
  if (s !== n && (s === 0 ? this.deltas.delete(t) : this.deltas.set(t, s), e)) {
1633
- const a = s - n;
1634
- this._updateTree(t, a);
1633
+ const l = s - n;
1634
+ this._updateTree(t, l);
1635
1635
  }
1636
1636
  }
1637
1637
  }
@@ -1660,8 +1660,8 @@ class ge {
1660
1660
  this._materialize(e);
1661
1661
  return;
1662
1662
  }
1663
- const s = i[0].from, a = i[i.length - 1].to;
1664
- e >= s && e <= a && this._materialize(e);
1663
+ const s = i[0].from, l = i[i.length - 1].to;
1664
+ e >= s && e <= l && this._materialize(e);
1665
1665
  return;
1666
1666
  }
1667
1667
  e !== void 0 && this._materialize(e);
@@ -1693,13 +1693,13 @@ class ge {
1693
1693
  if (this._materialize(s), (this.deltas.get(s) ?? 0) === c)
1694
1694
  break;
1695
1695
  }
1696
- const a = this.prefixSum(s);
1696
+ const l = this.prefixSum(s);
1697
1697
  return {
1698
1698
  index: s,
1699
- total: this.total ?? a.total,
1700
- cumulative: a.cumulative,
1701
- currentValue: a.currentValue,
1702
- safeIndex: a.safeIndex
1699
+ total: this.total ?? l.total,
1700
+ cumulative: l.cumulative,
1701
+ currentValue: l.currentValue,
1702
+ safeIndex: l.safeIndex
1703
1703
  };
1704
1704
  }
1705
1705
  /**
@@ -1716,10 +1716,10 @@ class ge {
1716
1716
  for (; s << 1 <= this.size; )
1717
1717
  s <<= 1;
1718
1718
  for (; s > 0; s >>= 1) {
1719
- const a = n + s;
1720
- if (a <= this.size) {
1721
- const d = (this.tree.get(a) ?? 0) + this.baseValue * s;
1722
- (e ? i + d < t : i + d <= t) && (n = a, i += d);
1719
+ const l = n + s;
1720
+ if (l <= this.size) {
1721
+ const d = (this.tree.get(l) ?? 0) + this.baseValue * s;
1722
+ (e ? i + d < t : i + d <= t) && (n = l, i += d);
1723
1723
  }
1724
1724
  }
1725
1725
  return e ? n : n - 1;
@@ -1738,18 +1738,18 @@ class ge {
1738
1738
  this._materializeRanges(e.materializeOption);
1739
1739
  const s = e.materializeOption?.materialize === !0;
1740
1740
  for (; ; ) {
1741
- let a = 0n, c = i - 1n, d, b, I = this.total;
1742
- for (; a <= c; ) {
1743
- const p = a + c >> 1n, V = Number(p), z = this.prefixSum(V);
1741
+ let l = 0n, c = i - 1n, d, b, I = this.total;
1742
+ for (; l <= c; ) {
1743
+ const p = l + c >> 1n, V = Number(p), z = this.prefixSum(V);
1744
1744
  if (I = z.total, n ? z.cumulative >= t : z.cumulative <= t)
1745
1745
  if (d = p, b = z, n) {
1746
1746
  if (p === 0n)
1747
1747
  break;
1748
1748
  c = p - 1n;
1749
1749
  } else
1750
- a = p + 1n;
1750
+ l = p + 1n;
1751
1751
  else if (n)
1752
- a = p + 1n;
1752
+ l = p + 1n;
1753
1753
  else {
1754
1754
  if (p === 0n)
1755
1755
  break;
@@ -1786,14 +1786,14 @@ class ge {
1786
1786
  return { cumulative: 0, total: this.total ?? 0, currentValue: 0, safeIndex: 0 };
1787
1787
  const n = rt(Math.trunc(t), 0, this.size - 1), i = e?.materializeOption;
1788
1788
  this._materializeRanges(i, n, !0);
1789
- let s = 0, a = n + 1;
1790
- for (; a > 0; ) {
1791
- const d = this.tree.get(a) ?? 0;
1789
+ let s = 0, l = n + 1;
1790
+ for (; l > 0; ) {
1791
+ const d = this.tree.get(l) ?? 0;
1792
1792
  s += d;
1793
- const b = Pe(a);
1793
+ const b = Pe(l);
1794
1794
  if (b === 0)
1795
1795
  break;
1796
- a -= b;
1796
+ l -= b;
1797
1797
  }
1798
1798
  const c = i?.materialize ? this.get(n) : (this.deltas.get(n) || 0) + this.baseValue;
1799
1799
  return { cumulative: s + this.baseValue * (n + 1), total: this.total, currentValue: c, safeIndex: n };
@@ -1853,10 +1853,10 @@ class ge {
1853
1853
  let s = n + 1;
1854
1854
  for (; s <= this.size; ) {
1855
1855
  e.set(s, (e.get(s) ?? 0) + i);
1856
- const a = Pe(s);
1857
- if (a === 0)
1856
+ const l = Pe(s);
1857
+ if (l === 0)
1858
1858
  break;
1859
- s += a;
1859
+ s += l;
1860
1860
  }
1861
1861
  }
1862
1862
  this.tree = e, this.total = this._computeTreeTotal();
@@ -1970,17 +1970,17 @@ class ge {
1970
1970
  _propagateDeltaToGrownNodes(t, e, n, i) {
1971
1971
  let s = t + 1;
1972
1972
  for (; s <= n; ) {
1973
- const a = Pe(s);
1974
- if (a === 0)
1973
+ const l = Pe(s);
1974
+ if (l === 0)
1975
1975
  break;
1976
- s += a;
1976
+ s += l;
1977
1977
  }
1978
1978
  for (; s <= i; ) {
1979
1979
  this.tree.set(s, (this.tree.get(s) ?? 0) + e);
1980
- const a = Pe(s);
1981
- if (a === 0)
1980
+ const l = Pe(s);
1981
+ if (l === 0)
1982
1982
  break;
1983
- s += a;
1983
+ s += l;
1984
1984
  }
1985
1985
  }
1986
1986
  /**
@@ -1996,12 +1996,12 @@ class ge {
1996
1996
  const n = ge._minCoveredLowBound(t, e);
1997
1997
  if (t - n < this.deltas.size)
1998
1998
  for (let s = n; s < t; s++) {
1999
- const a = this.deltas.get(s);
2000
- a === void 0 || a === 0 || this._propagateDeltaToGrownNodes(s, a, t, e);
1999
+ const l = this.deltas.get(s);
2000
+ l === void 0 || l === 0 || this._propagateDeltaToGrownNodes(s, l, t, e);
2001
2001
  }
2002
2002
  else
2003
- for (const [s, a] of this.deltas.entries())
2004
- a === 0 || s < n || this._propagateDeltaToGrownNodes(s, a, t, e);
2003
+ for (const [s, l] of this.deltas.entries())
2004
+ l === 0 || s < n || this._propagateDeltaToGrownNodes(s, l, t, e);
2005
2005
  }
2006
2006
  this.total = this._computeTreeTotal();
2007
2007
  }
@@ -2077,12 +2077,12 @@ const Er = (r, t) => {
2077
2077
  }, Nr = (r, t, e) => {
2078
2078
  const n = Number.isFinite(r) && r > 0 ? Math.trunc(r) : 0, i = x(null), s = x({ size: n, valueOrFn: t, options: e });
2079
2079
  i.current === null && (i.current = new ge(n, t, e));
2080
- const a = i.current, c = s.current, d = c.size !== n, b = c.valueOrFn !== t, I = Er(c.options, e), v = c.size === 0 && n > 0 && (!i.current || i.current.base === 0);
2080
+ const l = i.current, c = s.current, d = c.size !== n, b = c.valueOrFn !== t, I = Er(c.options, e), v = c.size === 0 && n > 0 && (!i.current || i.current.base === 0);
2081
2081
  if (b || I) {
2082
2082
  const C = e?.resetOnValueFnChange ?? !0;
2083
- I || b && C || v ? (e?.debug && N.debug("[useFenwickMapTree] reset", { valueOrFnChanged: b, optionsChanged: I }), a.reset(n, t, e)) : (d && (e?.debug && N.debug("[useFenwickMapTree] resize (with valueFn change)", { from: c.size, to: n }), a.changeSize(n)), e?.debug && N.debug("[useFenwickMapTree] setValueFn (no reset)", { valueOrFnChanged: b }), a.setValueFn(t, { reset: !1 })), s.current = { size: n, valueOrFn: t, options: e };
2084
- } else d && (e?.debug && N.debug("[useFenwickMapTree] resize", { from: c.size, to: n }), v ? a.reset(n, t, e) : a.changeSize(n), s.current = { size: n, valueOrFn: t, options: e });
2085
- return a;
2083
+ I || b && C || v ? (e?.debug && N.debug("[useFenwickMapTree] reset", { valueOrFnChanged: b, optionsChanged: I }), l.reset(n, t, e)) : (d && (e?.debug && N.debug("[useFenwickMapTree] resize (with valueFn change)", { from: c.size, to: n }), l.changeSize(n)), e?.debug && N.debug("[useFenwickMapTree] setValueFn (no reset)", { valueOrFnChanged: b }), l.setValueFn(t, { reset: !1 })), s.current = { size: n, valueOrFn: t, options: e };
2084
+ } else d && (e?.debug && N.debug("[useFenwickMapTree] resize", { from: c.size, to: n }), v ? l.reset(n, t, e) : l.changeSize(n), s.current = { size: n, valueOrFn: t, options: e });
2085
+ return l;
2086
2086
  };
2087
2087
  class Cr {
2088
2088
  key;
@@ -2154,7 +2154,7 @@ function Vr(r) {
2154
2154
  const v = t.current.get(I);
2155
2155
  if (v)
2156
2156
  return e.current.moveToTail(v), v.value;
2157
- }, []), a = S((I, v) => {
2157
+ }, []), l = S((I, v) => {
2158
2158
  const C = i.current;
2159
2159
  if (Number.isNaN(C) || C <= 0)
2160
2160
  return;
@@ -2174,7 +2174,7 @@ function Vr(r) {
2174
2174
  }, []), b = S(() => {
2175
2175
  t.current.clear(), e.current = new He();
2176
2176
  }, []);
2177
- return Ft(() => ({ get: s, set: a, has: c, remove: d, clear: b }), [s, a, c, d, b]);
2177
+ return Ft(() => ({ get: s, set: l, has: c, remove: d, clear: b }), [s, l, c, d, b]);
2178
2178
  }
2179
2179
  const Dr = 1e4, qr = () => {
2180
2180
  const { get: r, set: t, has: e, clear: n } = Vr(Dr);
@@ -2186,13 +2186,13 @@ const Dr = 1e4, qr = () => {
2186
2186
  if (!Number.isFinite(r)) return 0n;
2187
2187
  const t = Math.trunc(r);
2188
2188
  return t <= 0 ? 0n : BigInt(t);
2189
- }, Lr = (r, t, e, n, i, s, a, c) => {
2189
+ }, Lr = (r, t, e, n, i, s, l, c) => {
2190
2190
  const d = Ne(n);
2191
2191
  if (d === 0n)
2192
2192
  return { renderingStartIndex: 0, renderingEndIndex: 0, visibleStartIndex: 0, visibleEndIndex: 0 };
2193
2193
  const b = (A) => A < 0n ? 0n : A >= d ? d - 1n : A, I = { materializeOption: { materialize: !1 } }, { index: v, cumulative: C } = s.findIndexAtOrAfter(r, I);
2194
2194
  let p;
2195
- v === -1 ? p = d - 1n : (C === r ? p = Ne(v + 1) : p = Ne(v), p >= d && (p = d - 1n)), r <= 0 && (p = 0n), c && r >= a && (p = d - 1n);
2195
+ v === -1 ? p = d - 1n : (C === r ? p = Ne(v + 1) : p = Ne(v), p >= d && (p = d - 1n)), r <= 0 && (p = 0n), c && r >= l && (p = d - 1n);
2196
2196
  const V = (A) => {
2197
2197
  const O = Number(A);
2198
2198
  if (!Number.isSafeInteger(O))
@@ -2264,12 +2264,12 @@ const Dr = 1e4, qr = () => {
2264
2264
  visibleStartIndex: St(Number(Q), n),
2265
2265
  visibleEndIndex: St(Number(tt), n)
2266
2266
  };
2267
- }, _r = (r, t, e, n, i, s, a) => {
2267
+ }, _r = (r, t, e, n, i, s, l) => {
2268
2268
  if (n === 0)
2269
2269
  return { renderingStartIndex: 0, renderingEndIndex: 0, visibleStartIndex: 0, visibleEndIndex: 0 };
2270
- const c = Number.isFinite(a), d = c ? Math.min(Math.max(0, r), a) : Math.max(0, r);
2270
+ const c = Number.isFinite(l), d = c ? Math.min(Math.max(0, r), l) : Math.max(0, r);
2271
2271
  if (n >= Number.MAX_SAFE_INTEGER)
2272
- return Lr(d, t, e, n, i, s, a, c);
2272
+ return Lr(d, t, e, n, i, s, l, c);
2273
2273
  const { index: b, cumulative: I, currentValue: v } = s.findIndexAtOrAfter(d, { materializeOption: { materialize: !1 } }), C = b === -1 ? t <= 0 || (I ?? 0) < d + (v ?? 0) ? n - 1 : 0 : b;
2274
2274
  let p = St(C, n), V = 0;
2275
2275
  if (b !== -1 && I === d)
@@ -2351,7 +2351,7 @@ const Dr = 1e4, qr = () => {
2351
2351
  ), S(
2352
2352
  (s) => {
2353
2353
  if (i.arg = s, i.id !== null) return;
2354
- const a = (c) => {
2354
+ const l = (c) => {
2355
2355
  if (i.id = null, i.arg === null) return;
2356
2356
  const d = c - i.last;
2357
2357
  if (n === 0 || i.last === 0 || d >= n) {
@@ -2363,13 +2363,13 @@ const Dr = 1e4, qr = () => {
2363
2363
  }
2364
2364
  i.arg = null, i.last = c;
2365
2365
  }
2366
- i.arg !== null && (i.id = requestAnimationFrame(a));
2366
+ i.arg !== null && (i.id = requestAnimationFrame(l));
2367
2367
  };
2368
- i.id = requestAnimationFrame(a);
2368
+ i.id = requestAnimationFrame(l);
2369
2369
  },
2370
2370
  [n, e, r, i]
2371
2371
  );
2372
- }, Or = nr.memo(({ index: r, top: t, height: e, item: n, children: i, clipItemHeight: s, enableKeyboardNavigation: a, onKeyDown: c, onFocus: d, registerItemRef: b }) => {
2372
+ }, Or = nr.memo(({ index: r, top: t, height: e, item: n, children: i, clipItemHeight: s, enableKeyboardNavigation: l, onKeyDown: c, onFocus: d, registerItemRef: b }) => {
2373
2373
  const I = S((V) => b(r, V), [r, b]), v = S((V) => c(V, r), [r, c]), C = S(() => d(r), [r, d]), p = S((V) => {
2374
2374
  V.currentTarget.focus({ preventScroll: !0 });
2375
2375
  }, []);
@@ -2385,10 +2385,10 @@ const Dr = 1e4, qr = () => {
2385
2385
  height: e,
2386
2386
  overflow: s ? "hidden" : void 0
2387
2387
  },
2388
- tabIndex: a ? -1 : void 0,
2389
- onPointerDown: a ? p : void 0,
2390
- onKeyDownCapture: a ? v : void 0,
2391
- onFocusCapture: a ? C : void 0,
2388
+ tabIndex: l ? -1 : void 0,
2389
+ onPointerDown: l ? p : void 0,
2390
+ onKeyDownCapture: l ? v : void 0,
2391
+ onFocusCapture: l ? C : void 0,
2392
2392
  children: i(n, r)
2393
2393
  }
2394
2394
  );
@@ -2399,7 +2399,7 @@ const Dr = 1e4, qr = () => {
2399
2399
  getItemHeight: n,
2400
2400
  viewportSize: i,
2401
2401
  overscanCount: s = 15,
2402
- className: a,
2402
+ className: l,
2403
2403
  testId: c,
2404
2404
  onScroll: d,
2405
2405
  onRangeChange: b,
@@ -2446,33 +2446,33 @@ const Dr = 1e4, qr = () => {
2446
2446
  }),
2447
2447
  [nt, de]
2448
2448
  ), E = Nr(r, n, it), [Vt] = re(() => {
2449
- let l = 0, u = 0;
2449
+ let a = 0, u = 0;
2450
2450
  if (V && r > 0) {
2451
2451
  const m = rt(Math.trunc(V.index), 0, r - 1), D = Math.max(0, V.offsetPx ?? 0), _ = rt(m - s * 2, 0, r - 1), F = rt(m + s * 2, 0, r - 1), $ = m > 0 || D > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: _, to: F }] } } : void 0, { cumulative: K, total: Rt, currentValue: pt } = E.prefixSum(m, $), ht = Math.max(K - pt + D, 0);
2452
- l = Ie(ht, R.top), u = Rt ?? E.getTotal();
2452
+ a = Ie(ht, R.top), u = Rt ?? E.getTotal();
2453
2453
  } else if (typeof C == "number") {
2454
2454
  const m = rt(C, 0, r - 1), D = rt(m - s * 2, 0, r - 1), _ = rt(m + s * 2, 0, r - 1), F = C > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: D, to: _ }] } } : void 0, { cumulative: $, total: K, currentValue: Rt } = E.prefixSum(C, F), pt = Math.max($ - Rt, 0);
2455
- l = Ie(pt, R.top), u = K ?? E.getTotal();
2456
- } else typeof p == "number" && (l = Ie(Math.max(p, 0), R.top)), u = E.getTotal();
2457
- return { position: l, total: u };
2455
+ a = Ie(pt, R.top), u = K ?? E.getTotal();
2456
+ } else typeof p == "number" && (a = Ie(Math.max(p, 0), R.top)), u = E.getTotal();
2457
+ return { position: a, total: u };
2458
2458
  }), [zt, Jt] = re(Vt.position), [$t, h] = re(Vt.total), k = x(Vt.position), gt = x(R.top), X = x(d ?? void 0), Pt = x(b ?? void 0), ct = x(/* @__PURE__ */ new Map()), It = x(null), Mt = x(null), [yt, ut] = re(null), [At, dt] = re(!1), st = x(null), _t = x(!1), Xt = x(0), Nt = x(!1), ne = x(!1), Gt = x(r);
2459
2459
  Gt.current !== r && (Gt.current = r, ne.current = !0), Y(() => {
2460
2460
  X.current = d ?? void 0, Pt.current = b ?? void 0;
2461
2461
  }, [b, d]);
2462
2462
  const Ct = S(
2463
- (l) => {
2464
- if (H && l && typeof l.focus == "function")
2463
+ (a) => {
2464
+ if (H && a && typeof a.focus == "function")
2465
2465
  try {
2466
- l.focus({ preventScroll: !0 });
2466
+ a.focus({ preventScroll: !0 });
2467
2467
  } catch {
2468
- l.focus();
2468
+ a.focus();
2469
2469
  }
2470
2470
  },
2471
2471
  [H]
2472
- ), f = S((l, { position: u, totalHeight: m }) => {
2473
- l(u, m);
2474
- }, []), M = Qe(X, z, f), ft = S((l, u) => {
2475
- l(u);
2472
+ ), f = S((a, { position: u, totalHeight: m }) => {
2473
+ a(u, m);
2474
+ }, []), M = Qe(X, z, f), ft = S((a, u) => {
2475
+ a(u);
2476
2476
  }, []), Tt = Qe(Pt, z, ft), wt = x(R.top);
2477
2477
  wt.current = R.top;
2478
2478
  const ie = x(M);
@@ -2482,12 +2482,12 @@ const Dr = 1e4, qr = () => {
2482
2482
  H || (ct.current.clear(), It.current = null, Mt.current = null);
2483
2483
  }, [H]);
2484
2484
  const Qt = S(
2485
- (l, u) => {
2485
+ (a, u) => {
2486
2486
  if (!u) {
2487
- ct.current.delete(l);
2487
+ ct.current.delete(a);
2488
2488
  return;
2489
2489
  }
2490
- H && (ct.current.set(l, u), It.current === l && (It.current = null, Mt.current = l, Ct(u)));
2490
+ H && (ct.current.set(a, u), It.current === a && (It.current = null, Mt.current = a, Ct(u)));
2491
2491
  },
2492
2492
  [H, Ct]
2493
2493
  ), te = 0.01, Kt = x({
@@ -2496,8 +2496,8 @@ const Dr = 1e4, qr = () => {
2496
2496
  idleFrames: 0,
2497
2497
  lastRenderedPosition: Vt.position
2498
2498
  }), se = S(() => {
2499
- const l = Kt.current;
2500
- l.rafId !== null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(l.rafId), l.rafId = null, l.loopActive = !1, l.idleFrames = 0;
2499
+ const a = Kt.current;
2500
+ a.rafId !== null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(a.rafId), a.rafId = null, a.loopActive = !1, a.idleFrames = 0;
2501
2501
  }, []);
2502
2502
  Y(
2503
2503
  () => () => {
@@ -2507,59 +2507,59 @@ const Dr = 1e4, qr = () => {
2507
2507
  );
2508
2508
  const fe = x(() => {
2509
2509
  }), Zt = S(() => {
2510
- const l = Kt.current;
2511
- l.rafId = null;
2510
+ const a = Kt.current;
2511
+ a.rafId = null;
2512
2512
  const u = k.current, m = Wt(u, wt.current), D = E.getTotal();
2513
- if (Jt((F) => Math.abs(F - u) < te ? F : u), Math.abs(l.lastRenderedPosition - u) >= te ? (ie.current({ position: m, totalHeight: D }), l.lastRenderedPosition = u, l.idleFrames = 0) : l.idleFrames += 1, l.idleFrames >= 2) {
2513
+ if (Jt((F) => Math.abs(F - u) < te ? F : u), Math.abs(a.lastRenderedPosition - u) >= te ? (ie.current({ position: m, totalHeight: D }), a.lastRenderedPosition = u, a.idleFrames = 0) : a.idleFrames += 1, a.idleFrames >= 2) {
2514
2514
  se();
2515
2515
  return;
2516
2516
  }
2517
2517
  if (typeof requestAnimationFrame == "function") {
2518
- l.rafId = requestAnimationFrame((F) => fe.current(F));
2518
+ a.rafId = requestAnimationFrame((F) => fe.current(F));
2519
2519
  return;
2520
2520
  }
2521
- l.loopActive = !1;
2521
+ a.loopActive = !1;
2522
2522
  }, [E, se]);
2523
2523
  fe.current = Zt;
2524
2524
  const we = S(() => {
2525
- const l = Kt.current;
2526
- if (l.idleFrames = 0, !l.loopActive) {
2527
- if (l.loopActive = !0, typeof requestAnimationFrame == "function") {
2528
- l.rafId = requestAnimationFrame(Zt);
2525
+ const a = Kt.current;
2526
+ if (a.idleFrames = 0, !a.loopActive) {
2527
+ if (a.loopActive = !0, typeof requestAnimationFrame == "function") {
2528
+ a.rafId = requestAnimationFrame(Zt);
2529
2529
  return;
2530
2530
  }
2531
- l.loopActive = !1;
2531
+ a.loopActive = !1;
2532
2532
  }
2533
2533
  }, [Zt]), mt = S(
2534
- (l, u) => {
2535
- const m = u?.immediate ?? !1, D = Wt(l, R.top);
2536
- if (k.current = l, m) {
2537
- Kt.current.lastRenderedPosition = l, Kt.current.idleFrames = 0, Jt(l), M({ position: D, totalHeight: E.getTotal() });
2534
+ (a, u) => {
2535
+ const m = u?.immediate ?? !1, D = Wt(a, R.top);
2536
+ if (k.current = a, m) {
2537
+ Kt.current.lastRenderedPosition = a, Kt.current.idleFrames = 0, Jt(a), M({ position: D, totalHeight: E.getTotal() });
2538
2538
  return;
2539
2539
  }
2540
2540
  we();
2541
2541
  },
2542
2542
  [we, E, R.top, M]
2543
- ), me = S((l) => {
2543
+ ), me = S((a) => {
2544
2544
  const u = G.current;
2545
2545
  if (!u)
2546
- return l;
2546
+ return a;
2547
2547
  const m = u.getScrollPosition();
2548
2548
  Xt.current += 1;
2549
- const D = u.scrollTo(l);
2550
- return D === m && (Xt.current = Math.max(0, Xt.current - 1)), Math.abs(D - l) > 0.5 && (Nt.current = !0), D;
2549
+ const D = u.scrollTo(a);
2550
+ return D === m && (Xt.current = Math.max(0, Xt.current - 1)), Math.abs(D - a) > 0.5 && (Nt.current = !0), D;
2551
2551
  }, []), Ce = x(!1);
2552
2552
  Y(() => {
2553
2553
  if (!Ce.current)
2554
2554
  if (Ce.current = !0, V == null && typeof C != "number" && typeof p == "number") {
2555
- const l = Ie(Math.max(p, 0), R.top), u = Math.abs(l - k.current) > 0.5;
2556
- mt(l, { immediate: !0 }), u && G.current?.scrollTo(l);
2555
+ const a = Ie(Math.max(p, 0), R.top), u = Math.abs(a - k.current) > 0.5;
2556
+ mt(a, { immediate: !0 }), u && G.current?.scrollTo(a);
2557
2557
  } else
2558
2558
  mt(k.current, { immediate: !0 });
2559
2559
  }, [V, C, p, R.top, mt]), Y(() => {
2560
- const l = E.getTotal();
2561
- if ($t !== l) {
2562
- h(l);
2560
+ const a = E.getTotal();
2561
+ if ($t !== a) {
2562
+ h(a);
2563
2563
  return;
2564
2564
  }
2565
2565
  if (Nt.current) {
@@ -2572,7 +2572,7 @@ const Dr = 1e4, qr = () => {
2572
2572
  }
2573
2573
  }, [E, $t, r, me, mt]), Y(() => {
2574
2574
  if (vt.current !== null) {
2575
- const { index: l, align: u, offset: m } = vt.current, D = St(l, r), { cumulative: _, currentValue: F } = E.prefixSum(D, { materializeOption: { materialize: !1 } });
2575
+ const { index: a, align: u, offset: m } = vt.current, D = St(a, r), { cumulative: _, currentValue: F } = E.prefixSum(D, { materializeOption: { materialize: !1 } });
2576
2576
  if (_ !== void 0 && F !== void 0) {
2577
2577
  const $ = Math.max(_ - F, 0);
2578
2578
  let K = $;
@@ -2587,17 +2587,17 @@ const Dr = 1e4, qr = () => {
2587
2587
  }
2588
2588
  ne.current = !1;
2589
2589
  }, [$t, E, r, R.top, mt, i, R.bottom]), Y(() => {
2590
- const l = gt.current;
2591
- if (l === R.top || (gt.current = R.top, vt.current))
2590
+ const a = gt.current;
2591
+ if (a === R.top || (gt.current = R.top, vt.current))
2592
2592
  return;
2593
- const u = Wt(k.current, l), m = Ie(u, R.top);
2593
+ const u = Wt(k.current, a), m = Ie(u, R.top);
2594
2594
  k.current = m, G.current?.scrollTo(m), mt(m, { immediate: !0 });
2595
2595
  }, [R.top, mt]);
2596
2596
  const Se = S(
2597
- (l, u) => {
2597
+ (a, u) => {
2598
2598
  if (r === 0)
2599
2599
  return;
2600
- const m = St(l, r), D = E.get(m), _ = u - D, F = E.update(m, u);
2600
+ const m = St(a, r), D = E.get(m), _ = u - D, F = E.update(m, u);
2601
2601
  F !== void 0 && h(F), N.debug("[VirtualScroll] Updated item size manually", { index: m, size: u, total: F });
2602
2602
  let $ = vt.current ? vt.current.index : null;
2603
2603
  if ($ === null) {
@@ -2611,10 +2611,10 @@ const Dr = 1e4, qr = () => {
2611
2611
  },
2612
2612
  [E, r, me, mt, W]
2613
2613
  ), Ut = S(
2614
- (l, u) => {
2614
+ (a, u) => {
2615
2615
  if (!G.current || r === 0)
2616
2616
  return;
2617
- const m = St(l, r), D = St(m - s * 2, r), _ = St(m + s * 2, r), { cumulative: F, total: $, currentValue: K } = E.prefixSum(m, { materializeOption: { materialize: !0, ranges: [{ from: D, to: _ }] } });
2617
+ const m = St(a, r), D = St(m - s * 2, r), _ = St(m + s * 2, r), { cumulative: F, total: $, currentValue: K } = E.prefixSum(m, { materializeOption: { materialize: !0, ranges: [{ from: D, to: _ }] } });
2618
2618
  if (N.debug("[VirtualScroll] Scrolling to index:", m, "ItemBottom:", F, "Total height:", $, "ItemHeight:", K, "safeIndexFrom:", D, "safeIndexTo:", _), !$)
2619
2619
  return;
2620
2620
  const Rt = Math.max(F - K, 0);
@@ -2632,46 +2632,46 @@ const Dr = 1e4, qr = () => {
2632
2632
  [E, s, r, R.top, R.bottom, i, mt]
2633
2633
  ), Ve = x(V && r === 0 ? V : null);
2634
2634
  Y(() => {
2635
- const l = Ve.current;
2636
- !l || r === 0 || (Ve.current = null, Ut(rt(Math.trunc(l.index), 0, r - 1), { align: "top", offset: -Math.max(0, l.offsetPx ?? 0) }));
2635
+ const a = Ve.current;
2636
+ !a || r === 0 || (Ve.current = null, Ut(rt(Math.trunc(a.index), 0, r - 1), { align: "top", offset: -Math.max(0, a.offsetPx ?? 0) }));
2637
2637
  }, [r, Ut]);
2638
2638
  const De = S(
2639
- (l) => {
2639
+ (a) => {
2640
2640
  if (!G.current || r === 0)
2641
2641
  return;
2642
- const u = E.getTotal(), m = rt(Math.floor(l), 0, u), { index: D, cumulative: _, currentValue: F } = E.findIndexAtOrAfter(m, { materializeOption: { materialize: !1 } }), K = (_ ?? 0) - (F ?? 0) - m;
2642
+ const u = E.getTotal(), m = rt(Math.floor(a), 0, u), { index: D, cumulative: _, currentValue: F } = E.findIndexAtOrAfter(m, { materializeOption: { materialize: !1 } }), K = (_ ?? 0) - (F ?? 0) - m;
2643
2643
  Ut(D, { offset: K });
2644
2644
  },
2645
2645
  [E, r, Ut]
2646
2646
  ), be = S(() => {
2647
2647
  if (r === 0)
2648
2648
  return null;
2649
- const l = Wt(k.current, R.top), { index: u, cumulative: m, currentValue: D } = E.findIndexAtOrAfter(l, { materializeOption: { materialize: !1 } });
2649
+ const a = Wt(k.current, R.top), { index: u, cumulative: m, currentValue: D } = E.findIndexAtOrAfter(a, { materializeOption: { materialize: !1 } });
2650
2650
  if (u === -1)
2651
2651
  return { index: r - 1, offsetPx: 0 };
2652
- if (m === l)
2652
+ if (m === a)
2653
2653
  return { index: rt(u + 1, 0, r - 1), offsetPx: 0 };
2654
2654
  const _ = (m ?? 0) - (D ?? 0);
2655
- return { index: u, offsetPx: Math.max(0, l - _) };
2655
+ return { index: u, offsetPx: Math.max(0, a - _) };
2656
2656
  }, [E, r, R.top]), Ae = S(
2657
- (l) => {
2658
- const u = Wt(k.current, R.top), m = typeof l == "function" ? l(u) : l;
2657
+ (a) => {
2658
+ const u = Wt(k.current, R.top), m = typeof a == "function" ? a(u) : a;
2659
2659
  De(m);
2660
2660
  const D = G.current?.getScrollPosition(), _ = typeof D == "number" ? D : k.current;
2661
2661
  return mt(_), Wt(_, wt.current);
2662
2662
  },
2663
2663
  [R.top, De, mt]
2664
2664
  ), ke = S(
2665
- (l, u) => {
2666
- N.debug("[VirtualScroll] Scroll position changed:", l);
2665
+ (a, u) => {
2666
+ N.debug("[VirtualScroll] Scroll position changed:", a);
2667
2667
  const m = _t.current;
2668
2668
  m && (_t.current = !1);
2669
2669
  const D = Xt.current > 0;
2670
- if (D && (Xt.current = 0), m || D || ne.current || (vt.current = null), mt(l), w) {
2670
+ if (D && (Xt.current = 0), m || D || ne.current || (vt.current = null), mt(a), w) {
2671
2671
  if (m || D)
2672
2672
  return;
2673
- const _ = l - u;
2674
- if (N.debug("[VirtualScroll] Scroll diff:", _, "New:", l, "Prev:", u), Math.abs(_) > 1) {
2673
+ const _ = a - u;
2674
+ if (N.debug("[VirtualScroll] Scroll diff:", _, "New:", a, "Prev:", u), Math.abs(_) > 1) {
2675
2675
  const F = _ > 0 ? "down" : "up";
2676
2676
  ut(F), dt(!0), N.debug("[VirtualScroll] Showing scroll buttons. Direction:", F), st.current && clearTimeout(st.current), st.current = setTimeout(() => {
2677
2677
  dt(!1), N.debug("[VirtualScroll] Hiding scroll buttons");
@@ -2681,19 +2681,19 @@ const Dr = 1e4, qr = () => {
2681
2681
  },
2682
2682
  [mt, w]
2683
2683
  ), oe = Ft(() => Wt(zt, R.top), [R.top, zt]), pe = Ft(() => {
2684
- const l = E.getTotal(), u = _r(oe, i, s, r, n, E, l);
2684
+ const a = E.getTotal(), u = _r(oe, i, s, r, n, E, a);
2685
2685
  return N.debug("[VirtualScroll] Calculated rendering range:", () => ({
2686
2686
  ...u,
2687
2687
  scrollPosition: oe,
2688
- renderingContentSize: l,
2688
+ renderingContentSize: a,
2689
2689
  overscanCount: s,
2690
2690
  viewportSize: i
2691
2691
  })), u;
2692
2692
  }, [oe, i, s, r, n, E]), { renderingStartIndex: ae, renderingEndIndex: le, visibleStartIndex: ce, visibleEndIndex: xe } = pe, o = S(
2693
- (l, u) => {
2693
+ (a, u) => {
2694
2694
  if (!H || r === 0)
2695
2695
  return;
2696
- const m = St(l, r);
2696
+ const m = St(a, r);
2697
2697
  if (!(u?.ensureVisible ?? !0)) {
2698
2698
  const kt = ct.current.get(m);
2699
2699
  kt && (It.current = null, Mt.current = m, Ct(kt));
@@ -2715,49 +2715,49 @@ const Dr = 1e4, qr = () => {
2715
2715
  },
2716
2716
  [H, r, E, R.top, Ut, Ct, i]
2717
2717
  ), g = S(
2718
- (l, u) => {
2719
- if (!H || l.defaultPrevented || l.altKey || l.metaKey || l.ctrlKey)
2718
+ (a, u) => {
2719
+ if (!H || a.defaultPrevented || a.altKey || a.metaKey || a.ctrlKey)
2720
2720
  return;
2721
- const m = l.target;
2721
+ const m = a.target;
2722
2722
  if (m) {
2723
2723
  const D = m.tagName;
2724
2724
  if (D === "INPUT" || D === "TEXTAREA" || D === "SELECT" || m.isContentEditable)
2725
2725
  return;
2726
2726
  }
2727
- if (l.key === "ArrowDown") {
2728
- u < r - 1 && (l.preventDefault(), o(u + 1));
2727
+ if (a.key === "ArrowDown") {
2728
+ u < r - 1 && (a.preventDefault(), o(u + 1));
2729
2729
  return;
2730
2730
  }
2731
- if (l.key === "ArrowUp") {
2732
- u > 0 && (l.preventDefault(), o(u - 1));
2731
+ if (a.key === "ArrowUp") {
2732
+ u > 0 && (a.preventDefault(), o(u - 1));
2733
2733
  return;
2734
2734
  }
2735
- if (l.key === "PageDown") {
2735
+ if (a.key === "PageDown") {
2736
2736
  if (u < r - 1) {
2737
- l.preventDefault();
2737
+ a.preventDefault();
2738
2738
  const { visibleStartIndex: D, visibleEndIndex: _ } = J.current, F = Math.max(_ - D + 1, 1), $ = Math.max(F, 1), K = St(Math.min(u + $, r - 1), r);
2739
2739
  o(K);
2740
2740
  }
2741
2741
  return;
2742
2742
  }
2743
- if (l.key === "PageUp" && u > 0) {
2744
- l.preventDefault();
2743
+ if (a.key === "PageUp" && u > 0) {
2744
+ a.preventDefault();
2745
2745
  const { visibleStartIndex: D, visibleEndIndex: _ } = J.current, F = Math.max(_ - D + 1, 1), $ = Math.max(F, 1), K = St(u - $, r);
2746
2746
  o(K);
2747
2747
  }
2748
2748
  },
2749
2749
  [H, r, o]
2750
2750
  ), y = S(
2751
- (l) => {
2751
+ (a) => {
2752
2752
  if (!H)
2753
2753
  return;
2754
- const u = St(l, r);
2754
+ const u = St(a, r);
2755
2755
  It.current = null, Mt.current = u, at?.(u);
2756
2756
  },
2757
2757
  [H, r, at]
2758
2758
  );
2759
2759
  Y(() => {
2760
- const l = G.current?.getScrollPosition() ?? 0, u = k.current, m = Wt(u, R.top);
2760
+ const a = G.current?.getScrollPosition() ?? 0, u = k.current, m = Wt(u, R.top);
2761
2761
  N.debug("[VirtualScroll] Range change effect triggered", () => ({
2762
2762
  renderingStartIndex: ae,
2763
2763
  renderingEndIndex: le,
@@ -2767,7 +2767,7 @@ const Dr = 1e4, qr = () => {
2767
2767
  paneScrollPosition: u,
2768
2768
  logicalScrollPosition: m,
2769
2769
  contentSize: $t,
2770
- scrollPaneScrollPosition: l
2770
+ scrollPaneScrollPosition: a
2771
2771
  })), Tt({
2772
2772
  renderingStartIndex: ae,
2773
2773
  renderingEndIndex: le,
@@ -2777,39 +2777,46 @@ const Dr = 1e4, qr = () => {
2777
2777
  totalHeight: $t
2778
2778
  });
2779
2779
  }, [$t, le, ae, R.top, Tt, zt, xe, ce]);
2780
- const L = S(() => w ? /* @__PURE__ */ ot("div", { className: "aqvs-scroll-to-edge-overlay", "data-visible": At && yt !== null, children: yt === "up" ? /* @__PURE__ */ ot("div", { className: "aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-top", children: /* @__PURE__ */ ot(
2781
- "button",
2782
- {
2783
- type: "button",
2784
- className: "aqvs-scroll-to-edge-button",
2785
- onClick: (m) => {
2786
- m.stopPropagation(), _t.current = !0, Ut(0), dt(!1);
2787
- },
2788
- children: "Top"
2789
- }
2790
- ) }) : /* @__PURE__ */ ot("div", { className: "aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-bottom", children: /* @__PURE__ */ ot(
2791
- "button",
2792
- {
2793
- type: "button",
2794
- className: "aqvs-scroll-to-edge-button",
2795
- onClick: (m) => {
2796
- m.stopPropagation(), _t.current = !0, Ut(r - 1), dt(!1);
2797
- },
2798
- children: "Bottom"
2799
- }
2800
- ) }) }) : null, [w, At, yt, Ut, r]), B = x(0), { visibleItems: bt, renderAnchor: Ot } = Ft(() => {
2780
+ const L = S(() => {
2781
+ if (!w)
2782
+ return null;
2783
+ const a = At && yt !== null;
2784
+ return /* @__PURE__ */ ot("div", { className: "aqvs-scroll-to-edge-overlay", "data-visible": a, inert: !a, children: yt === "up" ? /* @__PURE__ */ ot("div", { className: "aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-top", children: /* @__PURE__ */ ot(
2785
+ "button",
2786
+ {
2787
+ type: "button",
2788
+ className: "aqvs-scroll-to-edge-button",
2789
+ tabIndex: a ? 0 : -1,
2790
+ onClick: (m) => {
2791
+ m.stopPropagation(), _t.current = !0, Ut(0), dt(!1);
2792
+ },
2793
+ children: "Top"
2794
+ }
2795
+ ) }) : /* @__PURE__ */ ot("div", { className: "aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-bottom", children: /* @__PURE__ */ ot(
2796
+ "button",
2797
+ {
2798
+ type: "button",
2799
+ className: "aqvs-scroll-to-edge-button",
2800
+ tabIndex: a ? 0 : -1,
2801
+ onClick: (m) => {
2802
+ m.stopPropagation(), _t.current = !0, Ut(r - 1), dt(!1);
2803
+ },
2804
+ children: "Bottom"
2805
+ }
2806
+ ) }) });
2807
+ }, [w, At, yt, Ut, r]), B = x(0), { visibleItems: bt, renderAnchor: Ot } = Ft(() => {
2801
2808
  if (r === 0)
2802
2809
  return {
2803
2810
  visibleItems: /* @__PURE__ */ ot("div", { className: "aqvs-no-items-container", children: /* @__PURE__ */ ot("div", { className: "aqvs-no-items-text", children: "No items" }) }),
2804
2811
  renderAnchor: 0
2805
2812
  };
2806
- const l = St(ae, r), u = St(le, r), { cumulative: m, currentValue: D } = E.prefixSum(l, { materializeOption: { materialize: !1 } }), _ = m - D;
2813
+ const a = St(ae, r), u = St(le, r), { cumulative: m, currentValue: D } = E.prefixSum(a, { materializeOption: { materialize: !1 } }), _ = m - D;
2807
2814
  Number.isFinite(_) && Math.abs(_ - B.current) > Ar && (B.current = _);
2808
2815
  const F = B.current, $ = [], K = [];
2809
2816
  let Rt = 0, pt = _;
2810
- for (let ht = l; ht <= u; ht++) {
2817
+ for (let ht = a; ht <= u; ht++) {
2811
2818
  if (K.length >= Je) {
2812
- N.warn("[VirtualScroll] Rendered item count reached the safety cap; truncating render window.", { cap: Je, safeRenderingStartIndex: l, safeRenderingEndIndex: u });
2819
+ N.warn("[VirtualScroll] Rendered item count reached the safety cap; truncating render window.", { cap: Je, safeRenderingStartIndex: a, safeRenderingEndIndex: u });
2813
2820
  break;
2814
2821
  }
2815
2822
  const Bt = n(ht), kt = E.get(ht), qt = Bt - kt;
@@ -2872,10 +2879,10 @@ const Dr = 1e4, qr = () => {
2872
2879
  mt,
2873
2880
  ce
2874
2881
  ]), Yt = S(
2875
- (l) => {
2876
- const u = (z ?? 0) > 0, m = Math.abs(l - zt), D = u && m > 0.5 ? zt : l, _ = Wt(D, R.top);
2882
+ (a) => {
2883
+ const u = (z ?? 0) > 0, m = Math.abs(a - zt), D = u && m > 0.5 ? zt : a, _ = Wt(D, R.top);
2877
2884
  if (N.debug("[VirtualScroll] Rendering visible items", () => ({
2878
- currentScrollPosition: l,
2885
+ currentScrollPosition: a,
2879
2886
  effectiveScrollPosition: _,
2880
2887
  renderingStartIndex: ae,
2881
2888
  renderingEndIndex: le,
@@ -2929,8 +2936,8 @@ const Dr = 1e4, qr = () => {
2929
2936
  A,
2930
2937
  () => ({
2931
2938
  getScrollPosition: () => {
2932
- const l = G.current?.getScrollPosition();
2933
- return typeof l == "number" ? Wt(l, wt.current) : -1;
2939
+ const a = G.current?.getScrollPosition();
2940
+ return typeof a == "number" ? Wt(a, wt.current) : -1;
2934
2941
  },
2935
2942
  getContentSize: () => G.current?.getContentSize() ?? -1,
2936
2943
  getViewportSize: () => G.current?.getViewportSize() ?? -1,
@@ -2952,7 +2959,7 @@ const Dr = 1e4, qr = () => {
2952
2959
  ref: G,
2953
2960
  contentSize: ue,
2954
2961
  viewportSize: i,
2955
- className: a,
2962
+ className: l,
2956
2963
  testId: c,
2957
2964
  onScroll: ke,
2958
2965
  background: v,