@aiquants/virtualscroll 1.15.0 → 1.17.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
@@ -1,5 +1,5 @@
1
1
  import { jsx as $, jsxs as re, Fragment as ke } from "react/jsx-runtime";
2
- import He, { memo as Be, forwardRef as Me, useState as Bt, useRef as P, useCallback as I, useImperativeHandle as ye, useMemo as Vt, useLayoutEffect as ae, useEffect as B, useId as Xe } from "react";
2
+ import He, { memo as Be, forwardRef as Me, useState as Ht, useRef as S, useCallback as T, useImperativeHandle as ye, useMemo as Vt, useLayoutEffect as ae, useEffect as B, useId as Xe } from "react";
3
3
  import { twMerge as ee } from "tailwind-merge";
4
4
  class _ {
5
5
  level;
@@ -104,7 +104,7 @@ const Re = {
104
104
  distance: 0,
105
105
  direction: 0,
106
106
  pointerId: null
107
- }, Te = 6, Ue = 8, $e = ({ dragState: n, normalizedDistance: t }) => {
107
+ }, Ie = 6, Ue = 8, $e = ({ dragState: n, normalizedDistance: t }) => {
108
108
  const e = 1 + t * 0.18, r = 0.16 + t * 0.24, s = 0.38 + t * 0.28, l = n.active ? "80ms ease-out" : "220ms ease";
109
109
  return /* @__PURE__ */ re(ke, { children: [
110
110
  /* @__PURE__ */ $(
@@ -134,19 +134,19 @@ const Re = {
134
134
  ] });
135
135
  }, _e = Be(
136
136
  Me(({ onDragChange: n, className: t, maxVisualDistance: e = 160, size: r = 40, style: s, opacity: l = 1, renderVisual: c }, d) => {
137
- const [f, p] = Bt(Re), m = P(null), g = P({ x: 0, y: 0 }), E = P(null), x = P(0), A = I(
137
+ const [f, p] = Ht(Re), m = S(null), g = S({ x: 0, y: 0 }), E = S(null), x = S(0), A = T(
138
138
  (D) => {
139
139
  p(D), n(D);
140
140
  },
141
141
  [n]
142
- ), U = I(
142
+ ), U = T(
143
143
  (D, Z, J = !1) => {
144
- const { x: W, y: F } = g.current, It = D - W, ct = Z - F, vt = Math.abs(ct), T = vt < Te ? 0 : ct < 0 ? -1 : 1, Mt = x.current;
145
- let b = T;
146
- const St = Te + Ue;
147
- T === 0 ? Mt !== 0 && vt < St ? b = Mt : (b = 0, J || (x.current = 0)) : T !== Mt && Mt !== 0 && vt < St ? b = Mt : x.current = T, A({
148
- active: J || vt >= Te,
149
- offsetX: It,
144
+ const { x: W, y: F } = g.current, Tt = D - W, ct = Z - F, vt = Math.abs(ct), v = vt < Ie ? 0 : ct < 0 ? -1 : 1, Mt = x.current;
145
+ let b = v;
146
+ const Pt = Ie + Ue;
147
+ v === 0 ? Mt !== 0 && vt < Pt ? b = Mt : (b = 0, J || (x.current = 0)) : v !== Mt && Mt !== 0 && vt < Pt ? b = Mt : x.current = v, A({
148
+ active: J || vt >= Ie,
149
+ offsetX: Tt,
150
150
  offsetY: ct,
151
151
  distance: vt,
152
152
  direction: b,
@@ -154,29 +154,29 @@ const Re = {
154
154
  });
155
155
  },
156
156
  [A]
157
- ), q = I((D) => {
157
+ ), q = T((D) => {
158
158
  if (D === null)
159
159
  return;
160
160
  const Z = E.current;
161
161
  Z?.hasPointerCapture(D) && Z.releasePointerCapture(D);
162
- }, []), Q = I(
162
+ }, []), Q = T(
163
163
  (D = !1) => {
164
164
  D && q(m.current), m.current = null, x.current = 0, A(Re);
165
165
  },
166
166
  [A, q]
167
- ), bt = I(
167
+ ), bt = T(
168
168
  (D) => {
169
169
  D.preventDefault(), D.stopPropagation();
170
- const Z = E.current ?? D.currentTarget, { left: J, top: W, width: F, height: It } = Z.getBoundingClientRect();
171
- g.current = { x: J + F / 2, y: W + It / 2 }, m.current = D.pointerId, Z.setPointerCapture(D.pointerId), U(D.clientX, D.clientY, !0);
170
+ const Z = E.current ?? D.currentTarget, { left: J, top: W, width: F, height: Tt } = Z.getBoundingClientRect();
171
+ g.current = { x: J + F / 2, y: W + Tt / 2 }, m.current = D.pointerId, Z.setPointerCapture(D.pointerId), U(D.clientX, D.clientY, !0);
172
172
  },
173
173
  [U]
174
- ), lt = I(
174
+ ), lt = T(
175
175
  (D) => {
176
176
  m.current === D.pointerId && (D.preventDefault(), U(D.clientX, D.clientY));
177
177
  },
178
178
  [U]
179
- ), it = I(
179
+ ), it = T(
180
180
  (D) => {
181
181
  m.current === D.pointerId && (D.preventDefault(), D.stopPropagation(), Q(!0));
182
182
  },
@@ -192,7 +192,7 @@ const Re = {
192
192
  }),
193
193
  [Q]
194
194
  );
195
- const Y = Math.min(Math.max(l, 0), 1), tt = r / 64, C = Math.min(f.distance, e) / e, K = f.direction * C * 10 * tt, G = c ?? $e, Tt = {
195
+ const Y = Math.min(Math.max(l, 0), 1), tt = r / 64, C = Math.min(f.distance, e) / e, K = f.direction * C * 10 * tt, G = c ?? $e, It = {
196
196
  dragState: f,
197
197
  normalizedDistance: C,
198
198
  sizeScale: tt,
@@ -217,13 +217,13 @@ const Re = {
217
217
  onPointerUp: it,
218
218
  onPointerCancel: it,
219
219
  role: "presentation",
220
- children: G(Tt)
220
+ children: G(It)
221
221
  }
222
222
  );
223
223
  })
224
224
  );
225
225
  _e.displayName = "TapScrollCircle";
226
- const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Pe = "virtualscroll:tap-scroll-cancel", Ve = 20, Ke = 250, We = 60, je = 20, Ge = 20, Ze = 240, Ce = { active: !1, offsetX: 0, offsetY: 0, distance: 0, direction: 0, pointerId: null }, Ie = 2.2, Je = 8, Qe = 120, tr = 1 / 60, Ht = {
226
+ const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Se = "virtualscroll:tap-scroll-cancel", Ve = 20, Ke = 250, We = 60, je = 20, Ge = 20, Ze = 240, Ce = { active: !1, offsetX: 0, offsetY: 0, distance: 0, direction: 0, pointerId: null }, Te = 2.2, Je = 8, Qe = 120, tr = 1 / 60, qt = {
227
227
  enabled: !0,
228
228
  size: 40,
229
229
  offsetX: -80,
@@ -257,33 +257,33 @@ const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Pe = "virtualscroll:tap-scr
257
257
  }, rr = (n, t) => {
258
258
  const e = n?.maxSpeedMultiplier, r = typeof e == "number" ? e : sr(t);
259
259
  return {
260
- enabled: n?.enabled ?? Ht.enabled,
261
- size: n?.size ?? Ht.size,
262
- offsetX: n?.offsetX ?? Ht.offsetX,
263
- offsetY: n?.offsetY ?? Ht.offsetY,
264
- className: n?.className ?? Ht.className,
265
- maxVisualDistance: n?.maxVisualDistance ?? Ht.maxVisualDistance,
260
+ enabled: n?.enabled ?? qt.enabled,
261
+ size: n?.size ?? qt.size,
262
+ offsetX: n?.offsetX ?? qt.offsetX,
263
+ offsetY: n?.offsetY ?? qt.offsetY,
264
+ className: n?.className ?? qt.className,
265
+ maxVisualDistance: n?.maxVisualDistance ?? qt.maxVisualDistance,
266
266
  maxSpeedMultiplier: r,
267
- minSpeedMultiplier: Math.max(n?.minSpeedMultiplier ?? Ht.minSpeedMultiplier, 0),
268
- opacity: pt(n?.opacity ?? Ht.opacity, 0, 1),
269
- renderVisual: n?.renderVisual ?? Ht.renderVisual,
270
- maxSpeedCurve: n?.maxSpeedCurve ?? Ht.maxSpeedCurve
267
+ minSpeedMultiplier: Math.max(n?.minSpeedMultiplier ?? qt.minSpeedMultiplier, 0),
268
+ opacity: pt(n?.opacity ?? qt.opacity, 0, 1),
269
+ renderVisual: n?.renderVisual ?? qt.renderVisual,
270
+ maxSpeedCurve: n?.maxSpeedCurve ?? qt.maxSpeedCurve
271
271
  };
272
272
  }, nr = ({ isDragging: n, isThumbHovered: t, enableThumbDrag: e }) => Vt(() => e ? n ? "dragging" : t ? "hover" : "idle" : "disabled", [e, n, t]), ir = ({ canUseArrowButtons: n, enableArrowButtons: t, resetTapScroll: e, scrollByStep: r }) => {
273
- const s = P(null), l = P(null), c = I(() => {
273
+ const s = S(null), l = S(null), c = T(() => {
274
274
  s.current !== null && (window.clearInterval(s.current), s.current = null), l.current !== null && (window.clearTimeout(l.current), l.current = null);
275
- }, []), d = I(() => {
275
+ }, []), d = T(() => {
276
276
  c();
277
- }, [c]), f = I(
277
+ }, [c]), f = T(
278
278
  (m) => (g) => {
279
- n && (g.preventDefault(), g.stopPropagation(), e(), c(), r(m), l.current = window.setTimeout(() => {
279
+ n && (g.cancelable && g.preventDefault(), g.stopPropagation(), e(), c(), r(m), l.current = window.setTimeout(() => {
280
280
  s.current = window.setInterval(() => {
281
281
  r(m);
282
282
  }, We);
283
283
  }, Ke));
284
284
  },
285
285
  [n, c, e, r]
286
- ), p = I(
286
+ ), p = T(
287
287
  (m) => (g) => {
288
288
  t && (g.key === "Enter" || g.key === " " || g.key === "Spacebar") && (g.preventDefault(), r(m));
289
289
  },
@@ -294,9 +294,9 @@ const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Pe = "virtualscroll:tap-scr
294
294
  }, [c]), { handleArrowPointerDown: f, handleArrowPointerUp: d, handleArrowKeyDown: p };
295
295
  }, sr = (n) => {
296
296
  if (!n || n <= 0)
297
- return Ie;
298
- const t = Math.max(1, n), e = Math.log10(t), r = Ie + e * Je;
299
- return pt(r, Ie, Qe);
297
+ return Te;
298
+ const t = Math.max(1, n), e = Math.log10(t), r = Te + e * Je;
299
+ return pt(r, Te, Qe);
300
300
  }, or = ({
301
301
  contentSize: n,
302
302
  viewportSize: t,
@@ -315,38 +315,38 @@ const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Pe = "virtualscroll:tap-scr
315
315
  visibleStartIndex: A,
316
316
  visibleEndIndex: U
317
317
  }) => {
318
- const [q, Q] = Bt(!1), [bt, lt] = Bt(!1), [it, Y] = Bt(!1), tt = P(null), C = P({ pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }), K = P({ pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }), G = P(e), Tt = P(r), L = P(Ce), D = P(null), Z = P(null), J = P(null), W = Vt(() => rr(g, E), [E, g]), F = Vt(() => er(d), [d]), {
319
- enabled: It,
318
+ const [q, Q] = Ht(!1), [bt, lt] = Ht(!1), [it, Y] = Ht(!1), tt = S(null), C = S({ pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }), K = S({ pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }), G = S(e), It = S(r), L = S(Ce), D = S(null), Z = S(null), J = S(null), W = Vt(() => rr(g, E), [E, g]), F = Vt(() => er(d), [d]), {
319
+ enabled: Tt,
320
320
  size: ct,
321
321
  offsetX: vt,
322
- offsetY: T,
322
+ offsetY: v,
323
323
  className: Mt,
324
324
  maxVisualDistance: b,
325
- maxSpeedMultiplier: St,
325
+ maxSpeedMultiplier: Pt,
326
326
  minSpeedMultiplier: yt,
327
- opacity: Ot,
328
- renderVisual: v,
327
+ opacity: Lt,
328
+ renderVisual: I,
329
329
  maxSpeedCurve: N
330
- } = W, k = P({
330
+ } = W, k = S({
331
331
  viewportSize: t,
332
332
  maxScrollPosition: Math.max(n - t, 0),
333
333
  scrollBarVisible: n > t,
334
334
  effectiveTapMaxDistance: Math.max(b, 1),
335
- tapCircleMaxSpeedMultiplier: St,
335
+ tapCircleMaxSpeedMultiplier: Pt,
336
336
  tapCircleMinSpeedMultiplier: yt,
337
337
  tapCircleMaxSpeedCurve: N,
338
338
  tapScrollCircleOptions: g,
339
339
  effectiveTrackLength: 0,
340
340
  onScroll: r,
341
341
  scrollPosition: e
342
- }), { mainSizeKey: et, crossSizeKey: ut, positionKey: Dt, selectDelta: mt, getPointerCoordinate: st, arrowLabels: ot, arrowIcons: Ct, directionClass: Et, orientation: wt } = F, At = Math.max(b, 1), Xt = t / n, ht = Math.max(t - f * 2, 0), h = Xt * ht, M = Math.min(Math.max(Ve, h || 0), ht || Ve), j = n - t, at = Math.max(ht - M, 0), dt = j <= 0 || at <= 0 ? 0 : e / j * at, Yt = dt + M / 2, ft = n > t || q, zt = ft && c;
342
+ }), { mainSizeKey: et, crossSizeKey: ut, positionKey: Dt, selectDelta: mt, getPointerCoordinate: st, arrowLabels: ot, arrowIcons: Ct, directionClass: Et, orientation: wt } = F, At = Math.max(b, 1), Bt = t / n, ht = Math.max(t - f * 2, 0), h = Bt * ht, M = Math.min(Math.max(Ve, h || 0), ht || Ve), j = n - t, at = Math.max(ht - M, 0), dt = j <= 0 || at <= 0 ? 0 : e / j * at, Ot = dt + M / 2, ft = n > t || q, Yt = ft && c;
343
343
  ae(() => {
344
344
  k.current = {
345
345
  viewportSize: t,
346
346
  maxScrollPosition: j,
347
347
  scrollBarVisible: ft,
348
348
  effectiveTapMaxDistance: At,
349
- tapCircleMaxSpeedMultiplier: St,
349
+ tapCircleMaxSpeedMultiplier: Pt,
350
350
  tapCircleMinSpeedMultiplier: yt,
351
351
  tapCircleMaxSpeedCurve: N,
352
352
  tapScrollCircleOptions: g,
@@ -357,45 +357,45 @@ const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Pe = "virtualscroll:tap-scr
357
357
  }), ae(() => {
358
358
  G.current = e;
359
359
  }, [e]), ae(() => {
360
- Tt.current = r;
360
+ It.current = r;
361
361
  }, [r]), B(() => {
362
362
  s || lt(!1);
363
363
  }, [s]);
364
- const Zt = nr({ isDragging: q, isThumbHovered: bt, enableThumbDrag: s }), Nt = I((o, S) => {
365
- const R = k.current, i = S ?? G.current;
366
- if (Tt.current) {
367
- const w = Tt.current(o, i);
364
+ const Zt = nr({ isDragging: q, isThumbHovered: bt, enableThumbDrag: s }), Nt = T((o, P) => {
365
+ const R = k.current, i = P ?? G.current;
366
+ if (It.current) {
367
+ const w = It.current(o, i);
368
368
  if (typeof w == "number" && Number.isFinite(w))
369
369
  return G.current = w, w;
370
370
  }
371
371
  const a = typeof o == "function" ? o(i) : o, u = Math.max(R.maxScrollPosition, 0), y = R.scrollBarVisible ? pt(a, 0, u) : 0;
372
372
  return G.current = y, y;
373
- }, []), Ut = I(
373
+ }, []), Xt = T(
374
374
  (o) => {
375
- const S = k.current, R = G.current;
376
- if (!S.scrollBarVisible || S.maxScrollPosition <= 0) {
375
+ const P = k.current, R = G.current;
376
+ if (!P.scrollBarVisible || P.maxScrollPosition <= 0) {
377
377
  const w = Nt(0, R), V = w - R;
378
378
  return { nextPosition: w, actualDelta: V, reachedBoundary: !0 };
379
379
  }
380
380
  if (o === 0)
381
381
  return { nextPosition: R, actualDelta: 0, reachedBoundary: !1 };
382
- const a = Nt((w) => pt(w + o, 0, S.maxScrollPosition), R), u = a - R, y = u === 0 || o < 0 && a <= 0 || o > 0 && a >= S.maxScrollPosition;
382
+ const a = Nt((w) => pt(w + o, 0, P.maxScrollPosition), R), u = a - R, y = u === 0 || o < 0 && a <= 0 || o > 0 && a >= P.maxScrollPosition;
383
383
  return { nextPosition: a, actualDelta: u, reachedBoundary: y };
384
384
  },
385
385
  [Nt]
386
- ), Pt = I(() => {
386
+ ), St = T(() => {
387
387
  Z.current !== null && (window.cancelAnimationFrame(Z.current), Z.current = null), J.current = null;
388
- }, []), Rt = I(() => {
389
- L.current = { ...Ce }, Y(!1), D.current?.reset(), Pt();
390
- }, [Pt]), Qt = I(
388
+ }, []), Rt = T(() => {
389
+ L.current = { ...Ce }, Y(!1), D.current?.reset(), St();
390
+ }, [St]), Qt = T(
391
391
  (o) => {
392
- const S = L.current, R = k.current;
393
- if (!S.active || S.direction === 0) {
394
- Pt();
392
+ const P = L.current, R = k.current;
393
+ if (!P.active || P.direction === 0) {
394
+ St();
395
395
  return;
396
396
  }
397
397
  if (!R.scrollBarVisible || R.maxScrollPosition <= 0) {
398
- Pt();
398
+ St();
399
399
  return;
400
400
  }
401
401
  const i = J.current ?? o, a = Math.max((o - i) / 1e3, 0), u = Math.min(a, tr);
@@ -403,50 +403,50 @@ const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Pe = "virtualscroll:tap-scr
403
403
  Z.current = window.requestAnimationFrame(Qt);
404
404
  return;
405
405
  }
406
- const y = Math.min(S.distance, R.effectiveTapMaxDistance) / R.effectiveTapMaxDistance, w = y ** 1.1, V = typeof R.tapScrollCircleOptions?.maxSpeedMultiplier == "number", z = Math.max(R.viewportSize * R.tapCircleMinSpeedMultiplier, 40), X = V ? z : 1200;
406
+ const y = Math.min(P.distance, R.effectiveTapMaxDistance) / R.effectiveTapMaxDistance, w = y ** 1.1, V = typeof R.tapScrollCircleOptions?.maxSpeedMultiplier == "number", z = Math.max(R.viewportSize * R.tapCircleMinSpeedMultiplier, 40), X = V ? z : 1200;
407
407
  let H = Math.max(R.viewportSize * R.tapCircleMaxSpeedMultiplier, X);
408
408
  const gt = R.tapCircleMaxSpeedCurve;
409
409
  if (gt) {
410
410
  const he = Math.max(gt.exponentialSteepness, 0), Oe = Math.max(gt.exponentialScale ?? R.tapCircleMaxSpeedMultiplier, 0), Ye = he === 0 ? y : Math.expm1(he * y), we = he === 0 ? 1 : Math.expm1(he) || 1, ze = we === 0 ? y : Math.min(Math.max(Ye / we, 0), 1), qe = R.viewportSize * Oe * ze;
411
411
  H = Math.min(H, Math.max(qe, z));
412
412
  }
413
- const xt = Math.max(H, z), Lt = Math.max(gt?.easedOffset ?? 0, 0), Jt = Math.min(1, w + Lt), ce = z + (xt - z) * Jt, ue = S.direction * ce * u, { actualDelta: Fe, reachedBoundary: Le } = Ut(ue);
413
+ const xt = Math.max(H, z), Ft = Math.max(gt?.easedOffset ?? 0, 0), Jt = Math.min(1, w + Ft), ce = z + (xt - z) * Jt, ue = P.direction * ce * u, { actualDelta: Fe, reachedBoundary: Le } = Xt(ue);
414
414
  if (Le || Fe === 0) {
415
- Pt();
415
+ St();
416
416
  return;
417
417
  }
418
418
  Z.current = window.requestAnimationFrame(Qt);
419
419
  },
420
- [Ut, Pt]
421
- ), rt = I(() => {
420
+ [Xt, St]
421
+ ), rt = T(() => {
422
422
  Z.current === null && (J.current = null, Z.current = window.requestAnimationFrame(Qt));
423
423
  }, [Qt]);
424
424
  B(() => () => {
425
- Pt();
426
- }, [Pt]);
427
- const fe = I(
425
+ St();
426
+ }, [St]);
427
+ const fe = T(
428
428
  (o) => {
429
- L.current = o, Y(o.active), o.active && o.direction !== 0 ? rt() : Pt();
429
+ L.current = o, Y(o.active), o.active && o.direction !== 0 ? rt() : St();
430
430
  },
431
- [rt, Pt]
431
+ [rt, St]
432
432
  );
433
433
  B(() => {
434
- It || Rt();
435
- }, [Rt, It]), B(() => {
436
- const o = (S) => {
437
- const i = S.detail?.paneId;
434
+ Tt || Rt();
435
+ }, [Rt, Tt]), B(() => {
436
+ const o = (P) => {
437
+ const i = P.detail?.paneId;
438
438
  i && m && i !== m || Rt();
439
439
  };
440
- return window.addEventListener(Pe, o), () => {
441
- window.removeEventListener(Pe, o);
440
+ return window.addEventListener(Se, o), () => {
441
+ window.removeEventListener(Se, o);
442
442
  };
443
443
  }, [m, Rt]), B(() => {
444
- if (!It)
444
+ if (!Tt)
445
445
  return;
446
- const o = (S) => {
447
- if (!L.current.active || L.current.pointerId === S.pointerId)
446
+ const o = (P) => {
447
+ if (!L.current.active || L.current.pointerId === P.pointerId)
448
448
  return;
449
- const R = S.target;
449
+ const R = P.target;
450
450
  if (!(R instanceof Node)) {
451
451
  Rt();
452
452
  return;
@@ -456,36 +456,36 @@ const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Pe = "virtualscroll:tap-scr
456
456
  return document.addEventListener("pointerdown", o, !0), () => {
457
457
  document.removeEventListener("pointerdown", o, !0);
458
458
  };
459
- }, [Rt, It]);
459
+ }, [Rt, Tt]);
460
460
  const le = (o) => {
461
461
  if (!ft || at <= 0 || j <= 0)
462
462
  return 0;
463
- const S = pt(o, 0, at);
464
- return pt(S / at * j, 0, j);
465
- }, kt = I((o) => {
466
- const { scrollBarVisible: S, effectiveTrackLength: R, maxScrollPosition: i } = k.current;
463
+ const P = pt(o, 0, at);
464
+ return pt(P / at * j, 0, j);
465
+ }, kt = T((o) => {
466
+ const { scrollBarVisible: P, effectiveTrackLength: R, maxScrollPosition: i } = k.current;
467
467
  if (_.debug("[ScrollBar] calculateScrollPositionFromThumb", { thumbPos: o, trackLen: R, maxScroll: i }), R <= 0 || i <= 0)
468
468
  return null;
469
469
  const a = pt(o, 0, R);
470
470
  return pt(a / R * i, 0, i);
471
- }, []), ne = I(
471
+ }, []), ne = T(
472
472
  (o) => {
473
- const S = C.current;
474
- if (S.pointerId !== o.pointerId)
473
+ const P = C.current;
474
+ if (P.pointerId !== o.pointerId)
475
475
  return;
476
- const R = o.clientX - S.startClientX, i = o.clientY - S.startClientY, a = mt(R, i);
476
+ const R = o.clientX - P.startClientX, i = o.clientY - P.startClientY, a = mt(R, i);
477
477
  _.debug("[ScrollBar] handleThumbPointerMove", {
478
478
  delta: a,
479
- startThumbPosition: S.startThumbPosition,
479
+ startThumbPosition: P.startThumbPosition,
480
480
  clientY: o.clientY,
481
- startClientY: S.startClientY,
481
+ startClientY: P.startClientY,
482
482
  metrics: k.current
483
483
  });
484
- const u = kt(S.startThumbPosition + a);
484
+ const u = kt(P.startThumbPosition + a);
485
485
  u !== null && Nt(u), o.cancelable && o.preventDefault();
486
486
  },
487
487
  [mt, kt, Nt]
488
- ), te = I(
488
+ ), te = T(
489
489
  (o) => {
490
490
  if (C.current.pointerId === o.pointerId)
491
491
  if (document.removeEventListener("pointermove", ne), document.removeEventListener("pointerup", te), document.removeEventListener("pointercancel", te), C.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }, Q(!1), tt.current) {
@@ -496,10 +496,10 @@ const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Pe = "virtualscroll:tap-scr
496
496
  },
497
497
  [ne]
498
498
  ), be = (o) => {
499
- const S = Math.max(Math.round(t / Ge), je);
500
- Ut(o * S);
501
- }, { handleArrowPointerDown: qt, handleArrowPointerUp: _t, handleArrowKeyDown: $t } = ir({
502
- canUseArrowButtons: zt,
499
+ const P = Math.max(Math.round(t / Ge), je);
500
+ Xt(o * P);
501
+ }, { handleArrowPointerDown: Ut, handleArrowPointerUp: zt, handleArrowKeyDown: $t } = ir({
502
+ canUseArrowButtons: Yt,
503
503
  enableArrowButtons: c,
504
504
  resetTapScroll: Rt,
505
505
  scrollByStep: be
@@ -516,7 +516,7 @@ const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Pe = "virtualscroll:tap-scr
516
516
  startClientY: o.clientY
517
517
  }, document.addEventListener("pointermove", ne), document.addEventListener("pointerup", te), document.addEventListener("pointercancel", te), Q(!0), lt(!0), o.preventDefault(), o.stopPropagation());
518
518
  }
519
- }, Ft = (o) => {
519
+ }, _t = (o) => {
520
520
  if (!ft)
521
521
  return;
522
522
  if (!l) {
@@ -525,38 +525,38 @@ const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Pe = "virtualscroll:tap-scr
525
525
  }
526
526
  if (o.pointerType === "mouse" && o.button !== 0 || o.ctrlKey)
527
527
  return;
528
- const S = o.currentTarget, R = S.getBoundingClientRect(), a = st(o) - (d ? R.left : R.top);
528
+ const P = o.currentTarget, R = P.getBoundingClientRect(), a = st(o) - (d ? R.left : R.top);
529
529
  Rt();
530
530
  const u = a - M / 2, y = le(u);
531
- Nt(y), S.setPointerCapture && S.setPointerCapture(o.pointerId), K.current = {
531
+ Nt(y), P.setPointerCapture && P.setPointerCapture(o.pointerId), K.current = {
532
532
  pointerId: o.pointerId,
533
533
  startThumbPosition: u,
534
534
  startClientX: o.clientX,
535
535
  startClientY: o.clientY
536
536
  }, o.preventDefault(), o.stopPropagation();
537
537
  }, Wt = (o) => {
538
- const S = K.current;
539
- if (S.pointerId !== o.pointerId)
538
+ const P = K.current;
539
+ if (P.pointerId !== o.pointerId)
540
540
  return;
541
- const R = o.clientX - S.startClientX, i = o.clientY - S.startClientY, a = mt(R, i), u = le(S.startThumbPosition + a);
541
+ const R = o.clientX - P.startClientX, i = o.clientY - P.startClientY, a = mt(R, i), u = le(P.startThumbPosition + a);
542
542
  Nt(u), o.cancelable && o.preventDefault();
543
543
  }, jt = (o) => {
544
544
  if (K.current.pointerId !== o.pointerId)
545
545
  return;
546
- const S = o.currentTarget;
547
- S.hasPointerCapture(o.pointerId) && S.releasePointerCapture(o.pointerId), K.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }, o.preventDefault(), o.stopPropagation();
546
+ const P = o.currentTarget;
547
+ P.hasPointerCapture(o.pointerId) && P.releasePointerCapture(o.pointerId), K.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }, o.preventDefault(), o.stopPropagation();
548
548
  }, me = (o) => {
549
549
  if (K.current.pointerId !== o.pointerId)
550
550
  return;
551
- const S = o.currentTarget;
552
- S.hasPointerCapture(o.pointerId) && S.releasePointerCapture(o.pointerId), K.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 };
553
- }, pe = Vt(() => pt((it ? 1 : 0.8) * Ot, 0, 1), [it, Ot]), ve = Vt(() => {
554
- const S = `calc(50% - ${ct / 2}px + ${T}px)`;
551
+ const P = o.currentTarget;
552
+ P.hasPointerCapture(o.pointerId) && P.releasePointerCapture(o.pointerId), K.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 };
553
+ }, pe = Vt(() => pt((it ? 1 : 0.8) * Lt, 0, 1), [it, Lt]), ve = Vt(() => {
554
+ const P = `calc(50% - ${ct / 2}px + ${v}px)`;
555
555
  return {
556
556
  left: vt,
557
- top: S
557
+ top: P
558
558
  };
559
- }, [vt, T, ct]), ie = (o, S, R, i) => /* @__PURE__ */ $(
559
+ }, [vt, v, ct]), ie = (o, P, R, i) => /* @__PURE__ */ $(
560
560
  "button",
561
561
  {
562
562
  type: "button",
@@ -566,16 +566,14 @@ const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Pe = "virtualscroll:tap-scr
566
566
  [et]: f,
567
567
  [ut]: f
568
568
  },
569
- "aria-label": S,
570
- onMouseDown: qt(o),
571
- onTouchStart: qt(o),
572
- onMouseUp: _t,
573
- onMouseLeave: _t,
574
- onTouchEnd: _t,
575
- onTouchCancel: _t,
569
+ "aria-label": P,
570
+ onPointerDown: Ut(o),
571
+ onPointerUp: zt,
572
+ onPointerLeave: zt,
573
+ onPointerCancel: zt,
576
574
  onKeyDown: $t(o),
577
575
  "aria-disabled": !c,
578
- disabled: !zt,
576
+ disabled: !Yt,
579
577
  children: /* @__PURE__ */ $("span", { "aria-hidden": "true", children: R })
580
578
  },
581
579
  i
@@ -587,7 +585,7 @@ const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Pe = "virtualscroll:tap-scr
587
585
  viewportSize: t,
588
586
  thumbSize: M,
589
587
  thumbPosition: dt,
590
- thumbCenter: Yt,
588
+ thumbCenter: Ot,
591
589
  trackSize: ht,
592
590
  isDragging: q,
593
591
  isTapScrollActive: it,
@@ -610,7 +608,7 @@ const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Pe = "virtualscroll:tap-scr
610
608
  "aria-valuemax": j,
611
609
  "aria-orientation": d ? "horizontal" : "vertical",
612
610
  children: [
613
- !d && ft && It && /* @__PURE__ */ $(
611
+ !d && ft && Tt && /* @__PURE__ */ $(
614
612
  _e,
615
613
  {
616
614
  ref: D,
@@ -619,7 +617,7 @@ const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Pe = "virtualscroll:tap-scr
619
617
  maxVisualDistance: At,
620
618
  style: ve,
621
619
  opacity: pe,
622
- renderVisual: v,
620
+ renderVisual: I,
623
621
  onDragChange: fe
624
622
  },
625
623
  "tap-circle"
@@ -632,7 +630,7 @@ const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Pe = "virtualscroll:tap-scr
632
630
  style: {
633
631
  borderRadius: f / 2
634
632
  },
635
- onPointerDown: Ft,
633
+ onPointerDown: _t,
636
634
  onPointerMove: Wt,
637
635
  onPointerUp: jt,
638
636
  onPointerCancel: me,
@@ -720,7 +718,7 @@ const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Pe = "virtualscroll:tap-scr
720
718
  renderOverlay: it,
721
719
  initialScrollPosition: Y = 0
722
720
  }, tt) => {
723
- const C = P(Y), K = P(null), G = P(null), Tt = P({
721
+ const C = S(Y), K = S(null), G = S(null), It = S({
724
722
  frame: null,
725
723
  velocity: 0,
726
724
  lastTimestamp: null
@@ -748,34 +746,34 @@ const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Pe = "virtualscroll:tap-scr
748
746
  enablePointerDrag: d,
749
747
  contentInsets: D
750
748
  });
751
- const Z = P({ contentSize: t, viewportSize: e });
749
+ const Z = S({ contentSize: t, viewportSize: e });
752
750
  Z.current = { contentSize: t, viewportSize: e };
753
- const J = Vt(() => t > e, [t, e]), W = I(
754
- (v) => {
751
+ const J = Vt(() => t > e, [t, e]), W = T(
752
+ (I) => {
755
753
  const { contentSize: N, viewportSize: k } = Z.current, et = N > k, ut = C.current;
756
- if (_.debug("[ScrollPane] scrollTo called", { newPosition: v, contentSize: N, viewportSize: k, currentIsScrollable: et, prevPosition: ut }), !et)
754
+ if (_.debug("[ScrollPane] scrollTo called", { newPosition: I, contentSize: N, viewportSize: k, currentIsScrollable: et, prevPosition: ut }), !et)
757
755
  return C.current !== 0 && (C.current = 0, f?.(0, ut)), C.current;
758
- const Dt = typeof v == "function" ? v(C.current) : v, mt = Math.max(N - k, 0), st = pt(Dt, 0, mt);
756
+ const Dt = typeof I == "function" ? I(C.current) : I, mt = Math.max(N - k, 0), st = pt(Dt, 0, mt);
759
757
  return C.current !== st && (C.current = st, f?.(st, ut)), C.current;
760
758
  },
761
759
  [f]
762
- ), F = I(() => {
763
- const v = Tt.current;
764
- v.frame !== null && cancelAnimationFrame(v.frame), v.frame = null, v.velocity = 0, v.lastTimestamp = null;
765
- }, []), It = P(F);
760
+ ), F = T(() => {
761
+ const I = It.current;
762
+ I.frame !== null && cancelAnimationFrame(I.frame), I.frame = null, I.velocity = 0, I.lastTimestamp = null;
763
+ }, []), Tt = S(F);
766
764
  B(() => {
767
- It.current = F;
765
+ Tt.current = F;
768
766
  }, [F]);
769
- const ct = I(
770
- (v) => {
767
+ const ct = T(
768
+ (I) => {
771
769
  if (!J)
772
770
  return;
773
- const { maxVelocity: N, minVelocity: k, deceleration: et, startVelocityThreshold: ut } = L, Dt = pt(v, -N, N);
771
+ const { maxVelocity: N, minVelocity: k, deceleration: et, startVelocityThreshold: ut } = L, Dt = pt(I, -N, N);
774
772
  if (Math.abs(Dt) < ut)
775
773
  return;
776
- F(), Tt.current.velocity = Dt, Tt.current.lastTimestamp = null;
774
+ F(), It.current.velocity = Dt, It.current.lastTimestamp = null;
777
775
  const mt = (st) => {
778
- const ot = Tt.current;
776
+ const ot = It.current;
779
777
  if (ot.lastTimestamp === null) {
780
778
  ot.lastTimestamp = st, ot.frame = requestAnimationFrame(mt);
781
779
  return;
@@ -793,61 +791,61 @@ const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Pe = "virtualscroll:tap-scr
793
791
  ht !== 0 && W((ft) => ft + ht);
794
792
  const M = C.current, { contentSize: j, viewportSize: at } = Z.current, dt = Math.max(j - at, 0);
795
793
  ot.velocity = wt;
796
- const Yt = M === h || M <= 0 && wt <= 0 || M >= dt && wt >= 0;
797
- if (Math.abs(wt) < k || Yt) {
794
+ const Ot = M === h || M <= 0 && wt <= 0 || M >= dt && wt >= 0;
795
+ if (Math.abs(wt) < k || Ot) {
798
796
  F();
799
797
  return;
800
798
  }
801
799
  ot.frame = requestAnimationFrame(mt);
802
800
  };
803
- Tt.current.frame = requestAnimationFrame(mt);
801
+ It.current.frame = requestAnimationFrame(mt);
804
802
  },
805
803
  [J, L, W, F]
806
- ), vt = P(ct);
804
+ ), vt = S(ct);
807
805
  B(() => {
808
806
  vt.current = ct;
809
807
  }, [ct]), ae(() => {
810
808
  Z.current = { contentSize: t, viewportSize: e };
811
809
  }, [t, e]), ae(() => {
812
- const v = G.current;
813
- if (!v) return;
810
+ const I = G.current;
811
+ if (!I) return;
814
812
  const N = () => {
815
- v.scrollTop !== 0 && (_.debug("[ScrollPane] Native scroll detected, resetting to 0", { scrollTop: v.scrollTop }), v.scrollTop = 0), v.scrollLeft !== 0 && (v.scrollLeft = 0);
813
+ I.scrollTop !== 0 && (_.debug("[ScrollPane] Native scroll detected, resetting to 0", { scrollTop: I.scrollTop }), I.scrollTop = 0), I.scrollLeft !== 0 && (I.scrollLeft = 0);
816
814
  };
817
- return v.addEventListener("scroll", N), () => v.removeEventListener("scroll", N);
815
+ return I.addEventListener("scroll", N), () => I.removeEventListener("scroll", N);
818
816
  }, []), ae(() => {
819
817
  if (J) {
820
818
  _.debug("[ScrollPane] Adjusting scroll position due to content or viewport size change", { contentSize: t, viewportSize: e, scrollPosition: C.current });
821
- const v = pt(t - e, 0, t);
822
- C.current > v && W(v);
819
+ const I = pt(t - e, 0, t);
820
+ C.current > I && W(I);
823
821
  } else
824
822
  W(0);
825
823
  }, [J, W, t, e]), B(() => {
826
- const v = (k) => {
824
+ const I = (k) => {
827
825
  if (!J)
828
826
  return;
829
827
  k.preventDefault(), F();
830
828
  let et = k.deltaY;
831
829
  k.deltaMode === 1 ? et *= 16 : k.deltaMode === 2 && (et *= e), q !== 1 && (et *= q), _.debug("[ScrollPane] wheel event", { deltaY: et, scrollPosition: C.current, wheelSpeedMultiplier: q, deltaMode: k.deltaMode, scrollTop: G.current?.scrollTop }), W((ut) => ut + et);
832
830
  }, N = K.current;
833
- return N && N.addEventListener("wheel", v, { passive: !1 }), () => {
834
- N && N.removeEventListener("wheel", v);
831
+ return N && N.addEventListener("wheel", I, { passive: !1 }), () => {
832
+ N && N.removeEventListener("wheel", I);
835
833
  };
836
834
  }, [J, W, F, e, q]), ye(
837
835
  tt,
838
836
  () => ({
839
- scrollTo: (v) => (F(), W(v)),
837
+ scrollTo: (I) => (F(), W(I)),
840
838
  getScrollPosition: () => C.current,
841
839
  getContentSize: () => t,
842
840
  getViewportSize: () => e
843
841
  }),
844
842
  [W, t, e, F]
845
843
  );
846
- const T = P(W);
844
+ const v = S(W);
847
845
  B(() => {
848
- T.current = W;
846
+ v.current = W;
849
847
  }, [W]);
850
- const Mt = Xe(), b = P({
848
+ const Mt = Xe(), b = S({
851
849
  pointerId: null,
852
850
  startClientY: 0,
853
851
  startScroll: 0,
@@ -855,25 +853,25 @@ const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Pe = "virtualscroll:tap-scr
855
853
  shouldCancelNextClick: !1,
856
854
  clickResetTimer: null,
857
855
  velocitySamples: []
858
- }), St = P(d);
856
+ }), Pt = S(d);
859
857
  B(() => {
860
- St.current = d;
858
+ Pt.current = d;
861
859
  }, [d]);
862
- const yt = P(J);
860
+ const yt = S(J);
863
861
  B(() => {
864
862
  yt.current = J;
865
863
  }, [J]);
866
- const Ot = P(L);
864
+ const Lt = S(L);
867
865
  return B(() => {
868
- Ot.current = L;
866
+ Lt.current = L;
869
867
  }, [L]), B(() => {
870
868
  if (d)
871
869
  return;
872
- const v = G.current, N = b.current;
873
- N.pointerId !== null && v && v.hasPointerCapture(N.pointerId) && v.releasePointerCapture(N.pointerId), N.clickResetTimer !== null && (window.clearTimeout(N.clickResetTimer), N.clickResetTimer = null), N.pointerId = null, N.startClientY = 0, N.startScroll = 0, N.isDragging = !1, N.shouldCancelNextClick = !1, N.velocitySamples = [];
870
+ const I = G.current, N = b.current;
871
+ N.pointerId && I?.hasPointerCapture(N.pointerId) && I.releasePointerCapture(N.pointerId), N.clickResetTimer !== null && (window.clearTimeout(N.clickResetTimer), N.clickResetTimer = null), N.pointerId = null, N.startClientY = 0, N.startScroll = 0, N.isDragging = !1, N.shouldCancelNextClick = !1, N.velocitySamples = [];
874
872
  }, [d]), B(() => {
875
- const v = G.current;
876
- if (!v)
873
+ const I = G.current;
874
+ if (!I)
877
875
  return;
878
876
  const N = 6, k = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(), et = () => {
879
877
  const h = b.current;
@@ -884,31 +882,31 @@ const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Pe = "virtualscroll:tap-scr
884
882
  }, Dt = (h) => {
885
883
  const M = b.current, j = k();
886
884
  M.velocitySamples.push({ clientY: h, time: j });
887
- const at = Ot.current.velocitySampleWindow;
885
+ const at = Lt.current.velocitySampleWindow;
888
886
  M.velocitySamples = M.velocitySamples.filter((dt) => j - dt.time <= at);
889
887
  }, mt = (h) => h instanceof HTMLElement && h.closest("[data-scrollpane-ignore-drag='true']") !== null, st = (h) => {
890
888
  const M = b.current;
891
889
  M.shouldCancelNextClick && (h.preventDefault(), h.stopPropagation(), M.shouldCancelNextClick = !1);
892
890
  }, ot = (h) => {
893
891
  const M = b.current;
894
- M.isDragging || (M.isDragging = !0, M.shouldCancelNextClick = !0, v.hasPointerCapture(h.pointerId) || v.setPointerCapture(h.pointerId), Dt(h.clientY));
892
+ M.isDragging || (M.isDragging = !0, M.shouldCancelNextClick = !0, I.hasPointerCapture(h.pointerId) || I.setPointerCapture(h.pointerId), Dt(h.clientY));
895
893
  }, Ct = (h) => {
896
894
  const M = b.current;
897
- if (M.pointerId !== h.pointerId || !(St.current && yt.current) || !M.isDragging && (Math.abs(h.clientY - M.startClientY) < N || (ot(h), !M.isDragging)))
895
+ if (M.pointerId !== h.pointerId || !(Pt.current && yt.current) || !M.isDragging && (Math.abs(h.clientY - M.startClientY) < N || (ot(h), !M.isDragging)))
898
896
  return;
899
897
  Dt(h.clientY);
900
898
  const j = h.clientY - M.startClientY, at = M.startScroll - j;
901
- T.current(at), h.cancelable && h.preventDefault();
899
+ v.current(at), h.cancelable && h.preventDefault();
902
900
  }, Et = (h) => {
903
901
  const M = b.current;
904
902
  if (M.pointerId !== h.pointerId)
905
903
  return;
906
- M.isDragging && M.shouldCancelNextClick && h.cancelable && (h.preventDefault(), h.stopPropagation()), v.hasPointerCapture(h.pointerId) && v.releasePointerCapture(h.pointerId);
904
+ M.isDragging && M.shouldCancelNextClick && h.cancelable && (h.preventDefault(), h.stopPropagation()), I.hasPointerCapture(h.pointerId) && I.releasePointerCapture(h.pointerId);
907
905
  let j = 0;
908
906
  if (M.isDragging && M.velocitySamples.length >= 2) {
909
- const dt = M.velocitySamples, Yt = Ot.current.velocitySampleWindow, ft = dt[dt.length - 1], zt = dt.find((Zt) => ft.time - Zt.time <= Yt) ?? dt[0];
910
- if (ft && zt && ft.time !== zt.time) {
911
- const Zt = ft.clientY - zt.clientY, Nt = ft.time - zt.time;
907
+ const dt = M.velocitySamples, Ot = Lt.current.velocitySampleWindow, ft = dt[dt.length - 1], Yt = dt.find((Zt) => ft.time - Zt.time <= Ot) ?? dt[0];
908
+ if (ft && Yt && ft.time !== Yt.time) {
909
+ const Zt = ft.clientY - Yt.clientY, Nt = ft.time - Yt.time;
912
910
  j = -(Zt / Nt);
913
911
  }
914
912
  }
@@ -916,18 +914,18 @@ const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Pe = "virtualscroll:tap-scr
916
914
  const dt = b.current;
917
915
  dt.shouldCancelNextClick = !1, dt.clickResetTimer = null;
918
916
  }, 0));
919
- const at = Ot.current.startVelocityThreshold;
917
+ const at = Lt.current.startVelocityThreshold;
920
918
  et(), Math.abs(j) >= at && vt.current?.(j);
921
919
  }, wt = (h) => {
922
- if (!(St.current && yt.current) || h.button !== 0 && h.pointerType === "mouse" || h.ctrlKey || h.metaKey || h.altKey || mt(h.target))
920
+ if (!(Pt.current && yt.current) || h.button !== 0 && h.pointerType === "mouse" || h.ctrlKey || h.metaKey || h.altKey || mt(h.target))
923
921
  return;
924
- window.dispatchEvent(new CustomEvent(Pe, { detail: { paneId: Mt } })), It.current?.();
922
+ window.dispatchEvent(new CustomEvent(Se, { detail: { paneId: Mt } })), Tt.current?.();
925
923
  const M = b.current;
926
924
  ut(), M.pointerId = h.pointerId, M.startClientY = h.clientY, M.startScroll = C.current, M.isDragging = !1, M.shouldCancelNextClick = !1, M.velocitySamples = [];
927
925
  }, At = (h) => {
928
926
  const M = b.current;
929
- M.pointerId === h.pointerId && (M.shouldCancelNextClick = !1, v.hasPointerCapture(h.pointerId) && v.releasePointerCapture(h.pointerId), ut(), et());
930
- }, Xt = [
927
+ M.pointerId === h.pointerId && (M.shouldCancelNextClick = !1, I.hasPointerCapture(h.pointerId) && I.releasePointerCapture(h.pointerId), ut(), et());
928
+ }, Bt = [
931
929
  ["click", st, !0],
932
930
  ["pointerdown", wt, { passive: !1 }],
933
931
  ["pointermove", Ct, { passive: !1 }],
@@ -938,10 +936,10 @@ const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Pe = "virtualscroll:tap-scr
938
936
  ["pointerup", Et, void 0],
939
937
  ["pointercancel", At, void 0]
940
938
  ];
941
- return ge(v, Xt, "add"), ge(window, ht, "add"), () => {
942
- ge(v, Xt, "remove"), ge(window, ht, "remove");
939
+ return ge(I, Bt, "add"), ge(window, ht, "add"), () => {
940
+ ge(I, Bt, "remove"), ge(window, ht, "remove");
943
941
  const h = b.current;
944
- h.pointerId !== null && v.hasPointerCapture(h.pointerId) && v.releasePointerCapture(h.pointerId), ut(), et();
942
+ h.pointerId !== null && I.hasPointerCapture(h.pointerId) && I.releasePointerCapture(h.pointerId), ut(), et();
945
943
  };
946
944
  }, [Mt]), /* @__PURE__ */ re("div", { ref: K, className: ee("aqvs-scroll-pane", p), style: m, children: [
947
945
  /* @__PURE__ */ re(
@@ -985,7 +983,7 @@ const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Pe = "virtualscroll:tap-scr
985
983
  it?.()
986
984
  ] });
987
985
  }
988
- ), Ee = (n, t, e) => Math.min(Math.max(n, t), e), Ir = ({ dragState: n, normalizedDistance: t, sizeScale: e, size: r }) => {
986
+ ), Ee = (n, t, e) => Math.min(Math.max(n, t), e), Tr = ({ dragState: n, normalizedDistance: t, sizeScale: e, size: r }) => {
989
987
  const s = Math.max(r / 2, 1), l = 1 + t * 0.65, c = Math.max(0.65, 1 - t * 0.25), d = n.direction * t * 26 * e, f = 0.8 + t * 0.18, p = 3 * e, m = 6 * e, g = 22 * e, E = Math.abs(d) + m, x = d > 0 ? p : -Math.abs(d) - p, A = Math.max(2.5, 3 * e), U = Ee(n.offsetX, -s, s), q = Ee(n.offsetY, -s, s), Q = s * 0.35, bt = U / s * Q, lt = q / s * Q, it = bt * 0.45, Y = lt * 0.45, tt = Math.max(g * 0.38, 6), C = 0.65 + t * 0.2, K = n.active;
990
988
  return /* @__PURE__ */ re(ke, { children: [
991
989
  /* @__PURE__ */ $(
@@ -1557,7 +1555,7 @@ class cr {
1557
1555
  }
1558
1556
  }
1559
1557
  const ur = (n, t, e) => {
1560
- const r = Math.max(0, n), s = P(null), l = P({ size: r, valueOrFn: t, options: e });
1558
+ const r = Math.max(0, n), s = S(null), l = S({ size: r, valueOrFn: t, options: e });
1561
1559
  s.current === null && (s.current = new cr(r, t, e));
1562
1560
  const c = s.current, d = l.current, f = d.size !== r, p = d.valueOrFn !== t, m = d.options !== e;
1563
1561
  if (p || m) {
@@ -1617,7 +1615,7 @@ class Ae {
1617
1615
  }
1618
1616
  }
1619
1617
  function fr(n) {
1620
- const t = P(/* @__PURE__ */ new Map()), e = P(new Ae());
1618
+ const t = S(/* @__PURE__ */ new Map()), e = S(new Ae());
1621
1619
  B(() => {
1622
1620
  for (; t.current.size > n; ) {
1623
1621
  const m = e.current.removeHead();
@@ -1627,11 +1625,11 @@ function fr(n) {
1627
1625
  break;
1628
1626
  }
1629
1627
  }, [n]);
1630
- const r = I((m) => {
1628
+ const r = T((m) => {
1631
1629
  const g = t.current.get(m);
1632
1630
  if (g)
1633
1631
  return e.current.moveToTail(g), g.value;
1634
- }, []), s = I(
1632
+ }, []), s = T(
1635
1633
  (m, g) => {
1636
1634
  if (n <= 0)
1637
1635
  return;
@@ -1647,35 +1645,35 @@ function fr(n) {
1647
1645
  }
1648
1646
  },
1649
1647
  [n]
1650
- ), l = I((m) => t.current.has(m), []), c = I((m) => {
1648
+ ), l = T((m) => t.current.has(m), []), c = T((m) => {
1651
1649
  const g = t.current.get(m);
1652
1650
  g && (e.current.remove(g), t.current.delete(m));
1653
- }, []), d = I(() => {
1651
+ }, []), d = T(() => {
1654
1652
  t.current.clear(), e.current = new Ae();
1655
- }, []), [f, p] = Bt(() => ({ get: r, set: s, has: l, remove: c, clear: d }));
1653
+ }, []), [f, p] = Ht(() => ({ get: r, set: s, has: l, remove: c, clear: d }));
1656
1654
  return B(() => p({ get: r, set: s, has: l, remove: c, clear: d }), [r, s, l, c, d]), f;
1657
1655
  }
1658
- const mr = 1e4, Sr = () => {
1656
+ const mr = 1e4, Pr = () => {
1659
1657
  const { get: n, set: t, has: e, clear: r } = fr(mr);
1660
1658
  return { get: n, set: t, has: e, clear: r };
1661
1659
  }, nt = (n, t) => t <= 0 ? 0 : pt(n, 0, t - 1), De = (n) => ({
1662
1660
  top: Math.max(0, n?.top ?? 0),
1663
1661
  bottom: Math.max(0, n?.bottom ?? 0)
1664
- }), Gt = (n, t) => n <= t ? 0 : n - t, oe = (n, t) => n <= 0 ? t : n + t, Se = (n) => {
1662
+ }), Gt = (n, t) => n <= t ? 0 : n - t, oe = (n, t) => n <= 0 ? t : n + t, Pe = (n) => {
1665
1663
  if (!Number.isFinite(n)) return 0n;
1666
1664
  const t = Math.trunc(n);
1667
1665
  return t <= 0 ? 0n : BigInt(t);
1668
1666
  }, pr = (n, t, e, r, s, l, c, d) => {
1669
- const f = Se(r);
1667
+ const f = Pe(r);
1670
1668
  if (f === 0n)
1671
1669
  return { renderingStartIndex: 0, renderingEndIndex: 0, visibleStartIndex: 0, visibleEndIndex: 0 };
1672
1670
  const p = (Y) => Y < 0n ? 0n : Y >= f ? f - 1n : Y, m = { materializeOption: { materialize: !1 } }, { index: g, cumulative: E } = l.findIndexAtOrAfter(n, m);
1673
1671
  let x;
1674
- g === -1 ? x = f - 1n : (E === n ? x = Se(g + 1) : x = Se(g), x >= f && (x = f - 1n)), n <= 0 && (x = 0n), d && n >= c && (x = f - 1n);
1672
+ g === -1 ? x = f - 1n : (E === n ? x = Pe(g + 1) : x = Pe(g), x >= f && (x = f - 1n)), n <= 0 && (x = 0n), d && n >= c && (x = f - 1n);
1675
1673
  const A = (Y) => {
1676
1674
  let tt = 0, C = Y, K = Y, G = 0n;
1677
1675
  for (; C < f && tt < t; ) {
1678
- const Tt = Number(C), L = s(Tt);
1676
+ const It = Number(C), L = s(It);
1679
1677
  if (tt += L, K = C, C += 1n, G += 1n, !Number.isFinite(L) || L <= 0)
1680
1678
  break;
1681
1679
  }
@@ -1731,13 +1729,13 @@ const mr = 1e4, Sr = () => {
1731
1729
  const Q = nt(x - e, r), bt = nt(Math.max(q - 1, x), r), lt = nt(bt + e, r);
1732
1730
  return { renderingStartIndex: Q, renderingEndIndex: lt, visibleStartIndex: x, visibleEndIndex: bt };
1733
1731
  }, Ne = (n, t, e) => {
1734
- const r = Math.max(0, t ?? 0), s = P({ last: 0, id: null, arg: null }).current;
1732
+ const r = Math.max(0, t ?? 0), s = S({ last: 0, id: null, arg: null }).current;
1735
1733
  return B(
1736
1734
  () => () => {
1737
1735
  s.id !== null && (cancelAnimationFrame(s.id), s.id = null);
1738
1736
  },
1739
1737
  [s]
1740
- ), I(
1738
+ ), T(
1741
1739
  (l) => {
1742
1740
  if (s.arg = l, s.id !== null) return;
1743
1741
  const c = (d) => {
@@ -1759,7 +1757,7 @@ const mr = 1e4, Sr = () => {
1759
1757
  [r, e, n, s]
1760
1758
  );
1761
1759
  }, gr = He.memo(({ index: n, top: t, height: e, item: r, children: s, clipItemHeight: l, enableKeyboardNavigation: c, onKeyDown: d, onFocus: f, registerItemRef: p }) => {
1762
- const m = I((A) => p(n, A), [n, p]), g = I((A) => d(A, n), [n, d]), E = I(() => f(n), [n, f]), x = I((A) => {
1760
+ const m = T((A) => p(n, A), [n, p]), g = T((A) => d(A, n), [n, d]), E = T(() => f(n), [n, f]), x = T((A) => {
1763
1761
  A.currentTarget.focus({ preventScroll: !0 });
1764
1762
  }, []);
1765
1763
  return /* @__PURE__ */ $(
@@ -1801,18 +1799,18 @@ const mr = 1e4, Sr = () => {
1801
1799
  scrollBarOptions: q,
1802
1800
  behaviorOptions: Q
1803
1801
  }, bt) => {
1804
- const { width: lt, enableThumbDrag: it, enableTrackClick: Y, enableArrowButtons: tt, enableScrollToTopBottomButtons: C, renderThumbOverlay: K, tapScrollCircleOptions: G } = q ?? {}, { enablePointerDrag: Tt, enableKeyboardNavigation: L = !0, wheelSpeedMultiplier: D, inertiaOptions: Z, clipItemHeight: J = !1, resetOnGetItemHeightChange: W = !1 } = Q ?? {}, F = P(null), It = P({
1802
+ const { width: lt, enableThumbDrag: it, enableTrackClick: Y, enableArrowButtons: tt, enableScrollToTopBottomButtons: C, renderThumbOverlay: K, tapScrollCircleOptions: G } = q ?? {}, { enablePointerDrag: It, enableKeyboardNavigation: L = !0, wheelSpeedMultiplier: D, inertiaOptions: Z, clipItemHeight: J = !1, resetOnGetItemHeightChange: W = !1 } = Q ?? {}, F = S(null), Tt = S({
1805
1803
  renderingStartIndex: 0,
1806
1804
  renderingEndIndex: 0,
1807
1805
  visibleStartIndex: 0,
1808
1806
  visibleEndIndex: 0,
1809
1807
  scrollPosition: 0,
1810
1808
  totalHeight: 0
1811
- }), ct = P(null), vt = P(!1);
1809
+ }), ct = S(null), vt = S(!1);
1812
1810
  B(() => {
1813
1811
  W && (ct.current = null);
1814
1812
  }, [W]);
1815
- const T = Vt(() => De(A), [A]), Mt = Vt(
1813
+ const v = Vt(() => De(A), [A]), Mt = Vt(
1816
1814
  // 目的: Fenwick Tree のオプション設定
1817
1815
  // 依存関係: resetOnGetItemHeightChange
1818
1816
  () => ({
@@ -1821,18 +1819,18 @@ const mr = 1e4, Sr = () => {
1821
1819
  materialize: !0
1822
1820
  }),
1823
1821
  [W]
1824
- ), b = ur(n, r, Mt), [St] = Bt(() => {
1825
- let i = T.top, a = 0;
1822
+ ), b = ur(n, r, Mt), [Pt] = Ht(() => {
1823
+ let i = v.top, a = 0;
1826
1824
  if (typeof g == "number") {
1827
1825
  const u = pt(g, 0, n - 1), y = pt(u - l * 2, 0, n - 1), w = pt(u + l * 2, 0, n - 1), V = g > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: y, to: w }] } } : void 0, { cumulative: z, total: X, currentValue: O } = b.prefixSum(g, V), H = Math.max(z - O, 0);
1828
- i = oe(H, T.top), a = X ?? b.getTotal();
1829
- } else typeof E == "number" && (i = oe(Math.max(E, 0), T.top)), a = b.getTotal();
1826
+ i = oe(H, v.top), a = X ?? b.getTotal();
1827
+ } else typeof E == "number" && (i = oe(Math.max(E, 0), v.top)), a = b.getTotal();
1830
1828
  return { position: i, total: a };
1831
- }), [yt, Ot] = Bt(St.position), [v, N] = Bt(St.total), k = P(St.position), et = P(T.top), ut = P(d ?? void 0), Dt = P(f ?? void 0), mt = P(/* @__PURE__ */ new Map()), st = P(null), ot = P(null), [Ct, Et] = Bt(null), [wt, At] = Bt(!1), Xt = P(null), ht = P(!1), h = P(0), M = P(!1), j = P(n);
1829
+ }), [yt, Lt] = Ht(Pt.position), [I, N] = Ht(Pt.total), k = S(Pt.position), et = S(v.top), ut = S(d ?? void 0), Dt = S(f ?? void 0), mt = S(/* @__PURE__ */ new Map()), st = S(null), ot = S(null), [Ct, Et] = Ht(null), [wt, At] = Ht(!1), Bt = S(null), ht = S(!1), h = S(0), M = S(!1), j = S(n);
1832
1830
  j.current !== n && (j.current = n, M.current = !0), B(() => {
1833
1831
  ut.current = d ?? void 0, Dt.current = f ?? void 0;
1834
1832
  }, [f, d]);
1835
- const at = I(
1833
+ const at = T(
1836
1834
  (i) => {
1837
1835
  if (L && i && typeof i.focus == "function")
1838
1836
  try {
@@ -1842,17 +1840,17 @@ const mr = 1e4, Sr = () => {
1842
1840
  }
1843
1841
  },
1844
1842
  [L]
1845
- ), dt = I((i, { position: a, totalHeight: u }) => {
1843
+ ), dt = T((i, { position: a, totalHeight: u }) => {
1846
1844
  i(a, u);
1847
- }, []), Yt = Ne(ut, x, dt), ft = I((i, a) => {
1845
+ }, []), Ot = Ne(ut, x, dt), ft = T((i, a) => {
1848
1846
  i(a);
1849
- }, []), zt = Ne(Dt, x, ft);
1847
+ }, []), Yt = Ne(Dt, x, ft);
1850
1848
  B(() => (vt.current = !0, () => {
1851
1849
  vt.current = !1;
1852
1850
  }), []), B(() => {
1853
1851
  L || (mt.current.clear(), st.current = null, ot.current = null);
1854
1852
  }, [L]);
1855
- const Zt = I(
1853
+ const Zt = T(
1856
1854
  (i, a) => {
1857
1855
  if (!a) {
1858
1856
  mt.current.delete(i);
@@ -1861,27 +1859,27 @@ const mr = 1e4, Sr = () => {
1861
1859
  L && (mt.current.set(i, a), st.current === i && (st.current = null, ot.current = i, at(a)));
1862
1860
  },
1863
1861
  [L, at]
1864
- ), Nt = 0.01, Ut = P({
1862
+ ), Nt = 0.01, Xt = S({
1865
1863
  rafId: null,
1866
1864
  loopActive: !1,
1867
1865
  idleFrames: 0,
1868
- lastRenderedPosition: St.position
1869
- }), Pt = I(() => {
1870
- const i = Ut.current;
1866
+ lastRenderedPosition: Pt.position
1867
+ }), St = T(() => {
1868
+ const i = Xt.current;
1871
1869
  i.rafId !== null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(i.rafId), i.rafId = null, i.loopActive = !1, i.idleFrames = 0;
1872
1870
  }, []);
1873
1871
  B(
1874
1872
  () => () => {
1875
- Pt();
1873
+ St();
1876
1874
  },
1877
- [Pt]
1875
+ [St]
1878
1876
  );
1879
- const Rt = I(() => {
1880
- const i = Ut.current;
1877
+ const Rt = T(() => {
1878
+ const i = Xt.current;
1881
1879
  i.rafId = null;
1882
- const a = k.current, u = Gt(a, T.top), y = b.getTotal();
1883
- if (Ot((V) => Math.abs(V - a) < Nt ? V : a), Yt({ position: u, totalHeight: y }), Math.abs(i.lastRenderedPosition - a) >= Nt ? (i.lastRenderedPosition = a, i.idleFrames = 0) : i.idleFrames += 1, i.idleFrames >= 2) {
1884
- Pt();
1880
+ const a = k.current, u = Gt(a, v.top), y = b.getTotal();
1881
+ if (Lt((V) => Math.abs(V - a) < Nt ? V : a), Ot({ position: u, totalHeight: y }), Math.abs(i.lastRenderedPosition - a) >= Nt ? (i.lastRenderedPosition = a, i.idleFrames = 0) : i.idleFrames += 1, i.idleFrames >= 2) {
1882
+ St();
1885
1883
  return;
1886
1884
  }
1887
1885
  if (typeof requestAnimationFrame == "function") {
@@ -1889,8 +1887,8 @@ const mr = 1e4, Sr = () => {
1889
1887
  return;
1890
1888
  }
1891
1889
  i.loopActive = !1;
1892
- }, [b, T.top, Yt, Pt]), Qt = I(() => {
1893
- const i = Ut.current;
1890
+ }, [b, v.top, Ot, St]), Qt = T(() => {
1891
+ const i = Xt.current;
1894
1892
  if (i.idleFrames = 0, !i.loopActive) {
1895
1893
  if (i.loopActive = !0, typeof requestAnimationFrame == "function") {
1896
1894
  i.rafId = requestAnimationFrame(Rt);
@@ -1898,35 +1896,35 @@ const mr = 1e4, Sr = () => {
1898
1896
  }
1899
1897
  i.loopActive = !1;
1900
1898
  }
1901
- }, [Rt]), rt = I(
1899
+ }, [Rt]), rt = T(
1902
1900
  (i, a) => {
1903
- const u = a?.immediate ?? !1, y = Gt(i, T.top);
1901
+ const u = a?.immediate ?? !1, y = Gt(i, v.top);
1904
1902
  if (k.current = i, u) {
1905
- Ut.current.lastRenderedPosition = i, Ut.current.idleFrames = 0, Ot(i), Yt({ position: y, totalHeight: b.getTotal() });
1903
+ Xt.current.lastRenderedPosition = i, Xt.current.idleFrames = 0, Lt(i), Ot({ position: y, totalHeight: b.getTotal() });
1906
1904
  return;
1907
1905
  }
1908
1906
  Qt();
1909
1907
  },
1910
- [Qt, b, T.top, Yt]
1911
- ), fe = P(!1);
1908
+ [Qt, b, v.top, Ot]
1909
+ ), fe = S(!1);
1912
1910
  B(() => {
1913
1911
  if (!fe.current)
1914
1912
  if (fe.current = !0, typeof E == "number") {
1915
- const i = oe(Math.max(E, 0), T.top), a = Math.abs(i - k.current) > 0.5;
1913
+ const i = oe(Math.max(E, 0), v.top), a = Math.abs(i - k.current) > 0.5;
1916
1914
  rt(i, { immediate: !0 }), a && F.current?.scrollTo(i);
1917
1915
  } else
1918
1916
  rt(k.current, { immediate: !0 });
1919
- }, [E, T.top, rt]), B(() => {
1917
+ }, [E, v.top, rt]), B(() => {
1920
1918
  const i = b.getTotal();
1921
- v !== i && N(i);
1922
- }, [b, v, n]), B(() => {
1919
+ I !== i && N(i);
1920
+ }, [b, I, n]), B(() => {
1923
1921
  if (ct.current !== null) {
1924
1922
  const { index: i, align: a, offset: u } = ct.current, y = nt(i, n), { cumulative: w, currentValue: V } = b.prefixSum(y, { materializeOption: { materialize: !1 } });
1925
1923
  if (w !== void 0 && V !== void 0) {
1926
1924
  const z = Math.max(w - V, 0);
1927
1925
  let X = z;
1928
1926
  a === "bottom" ? X = w - s : a === "center" && (X = z + V / 2 - s / 2), u && (X -= u), X = Math.max(0, X);
1929
- const O = Math.max(0, v + T.top + T.bottom - s), H = Math.min(oe(X, T.top), O);
1927
+ const O = Math.max(0, I + v.top + v.bottom - s), H = Math.min(oe(X, v.top), O);
1930
1928
  Math.abs(H - k.current) > 1 && (_.debug("[VirtualScroll] Drift correction", {
1931
1929
  from: k.current,
1932
1930
  to: H,
@@ -1935,13 +1933,13 @@ const mr = 1e4, Sr = () => {
1935
1933
  }
1936
1934
  }
1937
1935
  M.current = !1;
1938
- }, [v, b, n, T.top, rt, s, T.bottom]), B(() => {
1936
+ }, [I, b, n, v.top, rt, s, v.bottom]), B(() => {
1939
1937
  const i = et.current;
1940
- if (i === T.top) return;
1941
- const a = Gt(k.current, i), u = oe(a, T.top);
1942
- et.current = T.top, k.current = u, F.current?.scrollTo(u), rt(u, { immediate: !0 });
1943
- }, [T.top, rt]);
1944
- const le = I(
1938
+ if (i === v.top) return;
1939
+ const a = Gt(k.current, i), u = oe(a, v.top);
1940
+ et.current = v.top, k.current = u, F.current?.scrollTo(u), rt(u, { immediate: !0 });
1941
+ }, [v.top, rt]);
1942
+ const le = T(
1945
1943
  (i, a) => {
1946
1944
  const u = nt(i, n), y = b.get(u), w = a - y, V = b.update(u, a);
1947
1945
  V !== void 0 && N(V), _.debug("[VirtualScroll] Updated item size manually", { index: u, size: a, total: V });
@@ -1956,7 +1954,7 @@ const mr = 1e4, Sr = () => {
1956
1954
  }
1957
1955
  },
1958
1956
  [b, n, rt, A]
1959
- ), kt = I(
1957
+ ), kt = T(
1960
1958
  (i, a) => {
1961
1959
  if (!F.current)
1962
1960
  return;
@@ -1966,17 +1964,17 @@ const mr = 1e4, Sr = () => {
1966
1964
  const O = Math.max(V - X, 0);
1967
1965
  let H = O;
1968
1966
  a?.align === "bottom" ? H = V - s : a?.align === "center" && (H = O + X / 2 - s / 2), a?.offset && (H -= a.offset), H = Math.max(0, H);
1969
- const gt = oe(H, T.top), xt = F.current?.getContentSize() ?? z + T.top + T.bottom, Lt = Math.max(0, xt - s), Jt = Math.min(gt, Lt);
1967
+ const gt = oe(H, v.top), xt = F.current?.getContentSize() ?? z + v.top + v.bottom, Ft = Math.max(0, xt - s), Jt = Math.min(gt, Ft);
1970
1968
  ct.current = {
1971
1969
  index: u,
1972
1970
  align: a?.align,
1973
1971
  offset: a?.offset
1974
1972
  };
1975
1973
  const ce = F.current?.getScrollPosition() ?? -1, ue = Math.abs(ce - Jt) > 0.5;
1976
- ht.current = !1, h.current = 0, ue && (ht.current = !0, h.current += 1, F.current?.scrollTo(Jt)), N(z), rt(Jt, { immediate: !0 }), _.debug("[VirtualScroll] Setting scroll position to:", Jt, { original: gt, max: Lt });
1974
+ ht.current = !1, h.current = 0, ue && (ht.current = !0, h.current += 1, F.current?.scrollTo(Jt)), N(z), rt(Jt, { immediate: !0 }), _.debug("[VirtualScroll] Setting scroll position to:", Jt, { original: gt, max: Ft });
1977
1975
  },
1978
- [b, l, n, T.top, T.bottom, s, rt]
1979
- ), ne = I(
1976
+ [b, l, n, v.top, v.bottom, s, rt]
1977
+ ), ne = T(
1980
1978
  (i) => {
1981
1979
  if (!F.current)
1982
1980
  return;
@@ -1984,15 +1982,15 @@ const mr = 1e4, Sr = () => {
1984
1982
  kt(y, { offset: X });
1985
1983
  },
1986
1984
  [b, kt]
1987
- ), te = I(
1985
+ ), te = T(
1988
1986
  (i) => {
1989
- const a = Gt(k.current, T.top), u = typeof i == "function" ? i(a) : i;
1987
+ const a = Gt(k.current, v.top), u = typeof i == "function" ? i(a) : i;
1990
1988
  ne(u);
1991
1989
  const y = F.current?.getScrollPosition(), w = typeof y == "number" ? y : k.current;
1992
1990
  return rt(w), w;
1993
1991
  },
1994
- [T.top, ne, rt]
1995
- ), be = I(
1992
+ [v.top, ne, rt]
1993
+ ), be = T(
1996
1994
  (i, a) => {
1997
1995
  _.debug("[VirtualScroll] Scroll position changed:", i);
1998
1996
  const u = ht.current;
@@ -2004,33 +2002,33 @@ const mr = 1e4, Sr = () => {
2004
2002
  const w = i - a;
2005
2003
  if (_.debug("[VirtualScroll] Scroll diff:", w, "New:", i, "Prev:", a), Math.abs(w) > 1) {
2006
2004
  const V = w > 0 ? "down" : "up";
2007
- Et(V), At(!0), _.debug("[VirtualScroll] Showing scroll buttons. Direction:", V), Xt.current && clearTimeout(Xt.current), Xt.current = setTimeout(() => {
2005
+ Et(V), At(!0), _.debug("[VirtualScroll] Showing scroll buttons. Direction:", V), Bt.current && clearTimeout(Bt.current), Bt.current = setTimeout(() => {
2008
2006
  At(!1), _.debug("[VirtualScroll] Hiding scroll buttons");
2009
2007
  }, 2e3);
2010
2008
  }
2011
2009
  }
2012
2010
  },
2013
2011
  [rt, C]
2014
- ), qt = Vt(() => Gt(yt, T.top), [T.top, yt]), _t = Vt(() => {
2015
- const i = b.getTotal(), a = hr(qt, s, l, n, r, b, i);
2012
+ ), Ut = Vt(() => Gt(yt, v.top), [v.top, yt]), zt = Vt(() => {
2013
+ const i = b.getTotal(), a = hr(Ut, s, l, n, r, b, i);
2016
2014
  return _.debug("[VirtualScroll] Calculated rendering range:", {
2017
2015
  ...a,
2018
- scrollPosition: qt,
2016
+ scrollPosition: Ut,
2019
2017
  renderingContentSize: i,
2020
2018
  overscanCount: l,
2021
2019
  viewportSize: s
2022
2020
  }), a;
2023
- }, [qt, s, l, n, r, b]), { renderingStartIndex: $t, renderingEndIndex: Kt, visibleStartIndex: Ft, visibleEndIndex: Wt } = _t, jt = I(
2021
+ }, [Ut, s, l, n, r, b]), { renderingStartIndex: $t, renderingEndIndex: Kt, visibleStartIndex: _t, visibleEndIndex: Wt } = zt, jt = T(
2024
2022
  (i, a) => {
2025
2023
  if (!L || n === 0)
2026
2024
  return;
2027
2025
  const u = nt(i, n);
2028
2026
  if (!(a?.ensureVisible ?? !0)) {
2029
- const Lt = mt.current.get(u);
2030
- Lt && (st.current = null, ot.current = u, at(Lt));
2027
+ const Ft = mt.current.get(u);
2028
+ Ft && (st.current = null, ot.current = u, at(Ft));
2031
2029
  return;
2032
2030
  }
2033
- const w = b.prefixSum(u, { materializeOption: { materialize: !1 } }), V = w.currentValue, z = Math.max(w.cumulative - V, 0), X = z + V, O = Gt(k.current, T.top), H = O + s;
2031
+ const w = b.prefixSum(u, { materializeOption: { materialize: !1 } }), V = w.currentValue, z = Math.max(w.cumulative - V, 0), X = z + V, O = Gt(k.current, v.top), H = O + s;
2034
2032
  if (z < O || X > H) {
2035
2033
  st.current = u, kt(u);
2036
2034
  return;
@@ -2042,8 +2040,8 @@ const mr = 1e4, Sr = () => {
2042
2040
  }
2043
2041
  st.current = u;
2044
2042
  },
2045
- [L, n, b, T.top, kt, at, s]
2046
- ), me = I(
2043
+ [L, n, b, v.top, kt, at, s]
2044
+ ), me = T(
2047
2045
  (i, a) => {
2048
2046
  if (!L || i.defaultPrevented || i.altKey || i.metaKey || i.ctrlKey)
2049
2047
  return;
@@ -2064,19 +2062,19 @@ const mr = 1e4, Sr = () => {
2064
2062
  if (i.key === "PageDown") {
2065
2063
  if (a < n - 1) {
2066
2064
  i.preventDefault();
2067
- const y = Math.max(Wt - Ft + 1, 1), w = Math.max(y, 1), V = nt(Math.min(a + w, n - 1), n);
2065
+ const y = Math.max(Wt - _t + 1, 1), w = Math.max(y, 1), V = nt(Math.min(a + w, n - 1), n);
2068
2066
  jt(V);
2069
2067
  }
2070
2068
  return;
2071
2069
  }
2072
2070
  if (i.key === "PageUp" && a > 0) {
2073
2071
  i.preventDefault();
2074
- const y = Math.max(Wt - Ft + 1, 1), w = Math.max(y, 1), V = nt(a - w, n);
2072
+ const y = Math.max(Wt - _t + 1, 1), w = Math.max(y, 1), V = nt(a - w, n);
2075
2073
  jt(V);
2076
2074
  }
2077
2075
  },
2078
- [L, n, jt, Wt, Ft]
2079
- ), pe = I(
2076
+ [L, n, jt, Wt, _t]
2077
+ ), pe = T(
2080
2078
  (i) => {
2081
2079
  if (!L)
2082
2080
  return;
@@ -2086,27 +2084,27 @@ const mr = 1e4, Sr = () => {
2086
2084
  [L, n, U]
2087
2085
  );
2088
2086
  B(() => {
2089
- const i = F.current?.getScrollPosition() ?? 0, a = k.current, u = Gt(a, T.top);
2087
+ const i = F.current?.getScrollPosition() ?? 0, a = k.current, u = Gt(a, v.top);
2090
2088
  _.debug("[VirtualScroll] Range change effect triggered", {
2091
2089
  renderingStartIndex: $t,
2092
2090
  renderingEndIndex: Kt,
2093
- visibleStartIndex: Ft,
2091
+ visibleStartIndex: _t,
2094
2092
  visibleEndIndex: Wt,
2095
2093
  scrollPositionState: yt,
2096
2094
  paneScrollPosition: a,
2097
2095
  logicalScrollPosition: u,
2098
- contentSize: v,
2096
+ contentSize: I,
2099
2097
  scrollPaneScrollPosition: i
2100
- }), zt({
2098
+ }), Yt({
2101
2099
  renderingStartIndex: $t,
2102
2100
  renderingEndIndex: Kt,
2103
- visibleStartIndex: Ft,
2101
+ visibleStartIndex: _t,
2104
2102
  visibleEndIndex: Wt,
2105
2103
  scrollPosition: u,
2106
- totalHeight: v
2104
+ totalHeight: I
2107
2105
  });
2108
- }, [v, Kt, $t, T.top, zt, yt, Wt, Ft]);
2109
- const ve = I(() => C ? /* @__PURE__ */ $("div", { className: "aqvs-scroll-to-edge-overlay", "data-visible": wt && Ct !== null, children: Ct === "up" ? /* @__PURE__ */ $("div", { className: "aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-top", children: /* @__PURE__ */ $(
2106
+ }, [I, Kt, $t, v.top, Yt, yt, Wt, _t]);
2107
+ const ve = T(() => C ? /* @__PURE__ */ $("div", { className: "aqvs-scroll-to-edge-overlay", "data-visible": wt && Ct !== null, children: Ct === "up" ? /* @__PURE__ */ $("div", { className: "aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-top", children: /* @__PURE__ */ $(
2110
2108
  "button",
2111
2109
  {
2112
2110
  type: "button",
@@ -2137,13 +2135,13 @@ const mr = 1e4, Sr = () => {
2137
2135
  for (let O = i; O <= a; O++) {
2138
2136
  const H = r(O), gt = b.get(O), xt = H - gt;
2139
2137
  xt !== 0 && V.push({ index: O, value: H });
2140
- const { cumulative: Lt, currentValue: Jt } = b.prefixSum(O, { materializeOption: { materialize: !1 } }), ce = Lt - Jt + X, ue = e ? e(O) : O;
2138
+ const { cumulative: Ft, currentValue: Jt } = b.prefixSum(O, { materializeOption: { materialize: !1 } }), ce = Ft - Jt + X, ue = e ? e(O) : O;
2141
2139
  z.push(
2142
2140
  /* @__PURE__ */ $(
2143
2141
  gr,
2144
2142
  {
2145
2143
  index: O,
2146
- top: ce - w + T.top,
2144
+ top: ce - w + v.top,
2147
2145
  height: H,
2148
2146
  item: t(O),
2149
2147
  clipItemHeight: J,
@@ -2162,9 +2160,9 @@ const mr = 1e4, Sr = () => {
2162
2160
  return;
2163
2161
  let O = 0;
2164
2162
  for (const xt of V)
2165
- if (xt.index < Ft) {
2166
- const Lt = b.get(xt.index);
2167
- O += xt.value - Lt;
2163
+ if (xt.index < _t) {
2164
+ const Ft = b.get(xt.index);
2165
+ O += xt.value - Ft;
2168
2166
  }
2169
2167
  const H = b.updates(V);
2170
2168
  if (!vt.current || typeof H != "number")
@@ -2190,12 +2188,12 @@ const mr = 1e4, Sr = () => {
2190
2188
  Zt,
2191
2189
  Kt,
2192
2190
  $t,
2193
- T.top,
2191
+ v.top,
2194
2192
  rt,
2195
- Ft
2196
- ]), o = I(
2193
+ _t
2194
+ ]), o = T(
2197
2195
  (i) => {
2198
- const a = (x ?? 0) > 0, u = Math.abs(i - yt), y = a && u > 0.5 ? yt : i, w = Gt(y, T.top);
2196
+ const a = (x ?? 0) > 0, u = Math.abs(i - yt), y = a && u > 0.5 ? yt : i, w = Gt(y, v.top);
2199
2197
  if (_.debug("[VirtualScroll] Rendering visible items", {
2200
2198
  currentScrollPosition: i,
2201
2199
  effectiveScrollPosition: w,
@@ -2208,43 +2206,43 @@ const mr = 1e4, Sr = () => {
2208
2206
  rawEffectiveScrollPosition: y
2209
2207
  }), n === 0)
2210
2208
  return ie;
2211
- const V = se - w, z = T.bottom > 0 ? /* @__PURE__ */ $(
2209
+ const V = se - w, z = v.bottom > 0 ? /* @__PURE__ */ $(
2212
2210
  "div",
2213
2211
  {
2214
2212
  className: "aqvs-bottom-inset",
2215
2213
  style: {
2216
- top: b.getTotal() + T.top - se,
2217
- height: T.bottom
2214
+ top: b.getTotal() + v.top - se,
2215
+ height: v.bottom
2218
2216
  }
2219
2217
  },
2220
2218
  "virtualscroll-bottom-inset"
2221
2219
  ) : null;
2222
2220
  return _.debug("[VirtualScroll] Rendering items", {
2223
2221
  containerTop: V,
2224
- logicalScrollPosition: qt,
2225
- resolvedInsets: T,
2222
+ logicalScrollPosition: Ut,
2223
+ resolvedInsets: v,
2226
2224
  effectiveScrollPosition: w
2227
2225
  }), /* @__PURE__ */ re("div", { className: "aqvs-items-wrapper", style: { top: V, position: "relative" }, children: [
2228
2226
  ie,
2229
2227
  z
2230
2228
  ] });
2231
2229
  },
2232
- [x, n, b, qt, Kt, $t, T, yt, se, s, ie]
2233
- ), S = Vt(
2230
+ [x, n, b, Ut, Kt, $t, v, yt, se, s, ie]
2231
+ ), P = Vt(
2234
2232
  () => ({
2235
- renderingStartIndex: _t.renderingStartIndex,
2236
- renderingEndIndex: _t.renderingEndIndex,
2237
- visibleStartIndex: _t.visibleStartIndex,
2238
- visibleEndIndex: _t.visibleEndIndex,
2239
- scrollPosition: qt,
2233
+ renderingStartIndex: zt.renderingStartIndex,
2234
+ renderingEndIndex: zt.renderingEndIndex,
2235
+ visibleStartIndex: zt.visibleStartIndex,
2236
+ visibleEndIndex: zt.visibleEndIndex,
2237
+ scrollPosition: Ut,
2240
2238
  totalHeight: b.getTotal()
2241
2239
  // contentSize (State) ではなく最新値を反映
2242
2240
  }),
2243
- [_t, qt, b]
2241
+ [zt, Ut, b]
2244
2242
  );
2245
2243
  B(() => {
2246
- It.current = S;
2247
- }, [S]), ye(
2244
+ Tt.current = P;
2245
+ }, [P]), ye(
2248
2246
  bt,
2249
2247
  () => ({
2250
2248
  getScrollPosition: () => F.current?.getScrollPosition() ?? -1,
@@ -2255,12 +2253,12 @@ const mr = 1e4, Sr = () => {
2255
2253
  getFenwickTreeTotalHeight: () => b.getTotal(),
2256
2254
  getFenwickSize: () => b.getSize(),
2257
2255
  focusItemAtIndex: jt,
2258
- getRange: () => It.current,
2256
+ getRange: () => Tt.current,
2259
2257
  updateItemSize: le
2260
2258
  }),
2261
2259
  [te, kt, b, jt, le]
2262
2260
  );
2263
- const R = b.getTotal() + T.top + T.bottom;
2261
+ const R = b.getTotal() + v.top + v.bottom;
2264
2262
  return /* @__PURE__ */ $(
2265
2263
  ar,
2266
2264
  {
@@ -2277,26 +2275,26 @@ const mr = 1e4, Sr = () => {
2277
2275
  enableThumbDrag: it,
2278
2276
  enableTrackClick: Y,
2279
2277
  enableArrowButtons: tt,
2280
- enablePointerDrag: Tt,
2278
+ enablePointerDrag: It,
2281
2279
  renderThumbOverlay: K,
2282
2280
  wheelSpeedMultiplier: D,
2283
- contentInsets: T,
2284
- visibleStartIndex: Ft,
2281
+ contentInsets: v,
2282
+ visibleStartIndex: _t,
2285
2283
  visibleEndIndex: Wt,
2286
2284
  renderOverlay: ve,
2287
- initialScrollPosition: St.position,
2285
+ initialScrollPosition: Pt.position,
2288
2286
  children: o
2289
2287
  }
2290
2288
  );
2291
- }, Pr = Me(xr);
2289
+ }, Sr = Me(xr);
2292
2290
  export {
2293
2291
  cr as FenwickMapTree,
2294
2292
  or as ScrollBar,
2295
2293
  ar as ScrollPane,
2296
- Pr as VirtualScroll,
2294
+ Sr as VirtualScroll,
2297
2295
  pt as minmax,
2298
- Ir as tapScrollCircleSampleVisual,
2296
+ Tr as tapScrollCircleSampleVisual,
2299
2297
  ur as useFenwickMapTree,
2300
- Sr as useHeightCache,
2298
+ Pr as useHeightCache,
2301
2299
  fr as useLruCache
2302
2300
  };