@aiquants/virtualscroll 1.10.0 → 1.12.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,6 +1,6 @@
1
- import { jsx as U, jsxs as te, Fragment as Re } from "react/jsx-runtime";
2
- import { memo as Xe, forwardRef as Ie, useState as Nt, useRef as M, useCallback as C, useImperativeHandle as be, useMemo as kt, useEffect as Y, useLayoutEffect as oe, useId as He } from "react";
3
- import { twMerge as Qt } from "tailwind-merge";
1
+ import { jsx as B, jsxs as Bt, Fragment as Ce } from "react/jsx-runtime";
2
+ import ze, { memo as Xe, forwardRef as xe, useState as Vt, useRef as P, useCallback as T, useImperativeHandle as Ie, useMemo as yt, useEffect as X, useLayoutEffect as ee, useId as qe } from "react";
3
+ import { twMerge as Wt } from "tailwind-merge";
4
4
  const ve = {
5
5
  active: !1,
6
6
  offsetX: 0,
@@ -8,22 +8,22 @@ const ve = {
8
8
  distance: 0,
9
9
  direction: 0,
10
10
  pointerId: null
11
- }, he = 6, Ue = 8, qe = ({ dragState: n, normalizedDistance: t }) => {
12
- const e = 1 + t * 0.18, r = 0.16 + t * 0.24, s = 0.38 + t * 0.28, a = n.active ? "80ms ease-out" : "220ms ease";
13
- return /* @__PURE__ */ te(Re, { children: [
14
- /* @__PURE__ */ U(
11
+ }, me = 6, He = 8, Be = ({ dragState: o, normalizedDistance: t }) => {
12
+ const e = 1 + t * 0.18, n = 0.16 + t * 0.24, s = 0.38 + t * 0.28, c = o.active ? "80ms ease-out" : "220ms ease";
13
+ return /* @__PURE__ */ Bt(Ce, { children: [
14
+ /* @__PURE__ */ B(
15
15
  "div",
16
16
  {
17
17
  className: "absolute inset-0 rounded-full",
18
18
  style: {
19
19
  background: "linear-gradient(140deg, rgba(255,255,255,0.62), rgba(72,72,72,0.48))",
20
- boxShadow: `0 0 0 1px rgba(255,255,255,0.28), 0 10px 22px rgba(0,0,0,${r})`,
20
+ boxShadow: `0 0 0 1px rgba(255,255,255,0.28), 0 10px 22px rgba(0,0,0,${n})`,
21
21
  transform: `scale(${e})`,
22
- transition: `${a}, ${n.active ? "80ms" : "260ms"} box-shadow ease`
22
+ transition: `${c}, ${o.active ? "80ms" : "260ms"} box-shadow ease`
23
23
  }
24
24
  }
25
25
  ),
26
- /* @__PURE__ */ U(
26
+ /* @__PURE__ */ B(
27
27
  "div",
28
28
  {
29
29
  className: "aqvs:tap-scroll-circle-inner absolute rounded-full",
@@ -31,114 +31,114 @@ const ve = {
31
31
  background: "linear-gradient(140deg, rgba(255,255,255,0.72), rgba(28,28,28,0.58))",
32
32
  boxShadow: "inset 0 4px 10px rgba(0,0,0,0.24), inset 0 0 2px rgba(255,255,255,0.55)",
33
33
  opacity: s,
34
- transition: n.active ? "120ms opacity ease-out" : "220ms opacity ease"
34
+ transition: o.active ? "120ms opacity ease-out" : "220ms opacity ease"
35
35
  }
36
36
  }
37
37
  )
38
38
  ] });
39
- }, Ae = Xe(
40
- Ie(({ onDragChange: n, className: t, maxVisualDistance: e = 160, size: r = 40, style: s, opacity: a = 1, renderVisual: u }, m) => {
41
- const [l, d] = Nt(ve), c = M(null), f = M({ x: 0, y: 0 }), P = M(null), v = M(0), N = C(
42
- (I) => {
43
- d(I), n(I);
39
+ }, Re = Xe(
40
+ xe(({ onDragChange: o, className: t, maxVisualDistance: e = 160, size: n = 40, style: s, opacity: c = 1, renderVisual: u }, h) => {
41
+ const [l, d] = Vt(ve), f = P(null), p = P({ x: 0, y: 0 }), R = P(null), b = P(0), A = T(
42
+ (C) => {
43
+ d(C), o(C);
44
44
  },
45
- [n]
46
- ), q = C(
47
- (I, O, g = !1) => {
48
- const { x: et, y: w } = f.current, ut = I - et, dt = O - w, Tt = Math.abs(dt), rt = Tt < he ? 0 : dt < 0 ? -1 : 1, X = v.current;
49
- let mt = rt;
50
- const vt = he + Ue;
51
- rt === 0 ? X !== 0 && Tt < vt ? mt = X : (mt = 0, g || (v.current = 0)) : rt !== X && X !== 0 && Tt < vt ? mt = X : v.current = rt, N({
52
- active: g || Tt >= he,
53
- offsetX: ut,
54
- offsetY: dt,
55
- distance: Tt,
56
- direction: mt,
57
- pointerId: c.current
45
+ [o]
46
+ ), U = T(
47
+ (C, q, K = !1) => {
48
+ const { x: L, y: st } = p.current, v = C - L, vt = q - st, y = Math.abs(vt), lt = y < me ? 0 : vt < 0 ? -1 : 1, k = b.current;
49
+ let bt = lt;
50
+ const it = me + He;
51
+ lt === 0 ? k !== 0 && y < it ? bt = k : (bt = 0, K || (b.current = 0)) : lt !== k && k !== 0 && y < it ? bt = k : b.current = lt, A({
52
+ active: K || y >= me,
53
+ offsetX: v,
54
+ offsetY: vt,
55
+ distance: y,
56
+ direction: bt,
57
+ pointerId: f.current
58
58
  });
59
59
  },
60
- [N]
61
- ), L = C((I) => {
62
- if (I === null)
60
+ [A]
61
+ ), Y = T((C) => {
62
+ if (C === null)
63
63
  return;
64
- const O = P.current;
65
- O?.hasPointerCapture(I) && O.releasePointerCapture(I);
66
- }, []), K = C(
67
- (I = !1) => {
68
- I && L(c.current), c.current = null, v.current = 0, N(ve);
64
+ const q = R.current;
65
+ q?.hasPointerCapture(C) && q.releasePointerCapture(C);
66
+ }, []), G = T(
67
+ (C = !1) => {
68
+ C && Y(f.current), f.current = null, b.current = 0, A(ve);
69
69
  },
70
- [N, L]
71
- ), It = C(
72
- (I) => {
73
- I.preventDefault(), I.stopPropagation();
74
- const O = P.current ?? I.currentTarget, { left: g, top: et, width: w, height: ut } = O.getBoundingClientRect();
75
- f.current = { x: g + w / 2, y: et + ut / 2 }, c.current = I.pointerId, O.setPointerCapture(I.pointerId), q(I.clientX, I.clientY, !0);
70
+ [A, Y]
71
+ ), dt = T(
72
+ (C) => {
73
+ C.preventDefault(), C.stopPropagation();
74
+ const q = R.current ?? C.currentTarget, { left: K, top: L, width: st, height: v } = q.getBoundingClientRect();
75
+ p.current = { x: K + st / 2, y: L + v / 2 }, f.current = C.pointerId, q.setPointerCapture(C.pointerId), U(C.clientX, C.clientY, !0);
76
76
  },
77
- [q]
78
- ), $ = C(
79
- (I) => {
80
- c.current === I.pointerId && (I.preventDefault(), q(I.clientX, I.clientY));
77
+ [U]
78
+ ), rt = T(
79
+ (C) => {
80
+ f.current === C.pointerId && (C.preventDefault(), U(C.clientX, C.clientY));
81
81
  },
82
- [q]
83
- ), k = C(
84
- (I) => {
85
- c.current === I.pointerId && (I.preventDefault(), I.stopPropagation(), K(!0));
82
+ [U]
83
+ ), Q = T(
84
+ (C) => {
85
+ f.current === C.pointerId && (C.preventDefault(), C.stopPropagation(), G(!0));
86
86
  },
87
- [K]
87
+ [G]
88
88
  );
89
- be(
90
- m,
89
+ Ie(
90
+ h,
91
91
  () => ({
92
92
  reset: () => {
93
- K(!0);
93
+ G(!0);
94
94
  },
95
- getElement: () => P.current
95
+ getElement: () => R.current
96
96
  }),
97
- [K]
97
+ [G]
98
98
  );
99
- const z = Math.min(Math.max(a, 0), 1), A = r / 64, V = Math.min(l.distance, e) / e, F = l.direction * V * 10 * A, at = u ?? qe, G = {
99
+ const N = Math.min(Math.max(c, 0), 1), w = n / 64, $ = Math.min(l.distance, e) / e, z = l.direction * $ * 10 * w, Z = u ?? Be, _ = {
100
100
  dragState: l,
101
- normalizedDistance: V,
102
- sizeScale: A,
103
- size: r,
104
- opacity: z
105
- }, Ct = {
101
+ normalizedDistance: $,
102
+ sizeScale: w,
103
+ size: n,
104
+ opacity: N
105
+ }, ft = {
106
106
  ...s,
107
- width: r,
108
- height: r,
109
- transform: `translateY(${F}px)`
107
+ width: n,
108
+ height: n,
109
+ transform: `translateY(${z}px)`
110
110
  };
111
- return Ct.opacity = z, /* @__PURE__ */ U(
111
+ return ft.opacity = N, /* @__PURE__ */ B(
112
112
  "div",
113
113
  {
114
- ref: P,
114
+ ref: R,
115
115
  "data-testid": "virtual-scroll-tap-circle",
116
- className: Qt("relative flex touch-none select-none items-center justify-center", "transition-transform duration-100 ease-out", t),
117
- style: Ct,
116
+ className: Wt("relative flex touch-none select-none items-center justify-center", "transition-transform duration-100 ease-out", t),
117
+ style: ft,
118
118
  tabIndex: -1,
119
- onPointerDown: It,
120
- onPointerMove: $,
121
- onPointerUp: k,
122
- onPointerCancel: k,
119
+ onPointerDown: dt,
120
+ onPointerMove: rt,
121
+ onPointerUp: Q,
122
+ onPointerCancel: Q,
123
123
  role: "presentation",
124
- children: at(G)
124
+ children: Z(_)
125
125
  }
126
126
  );
127
127
  })
128
128
  );
129
- Ae.displayName = "TapScrollCircle";
130
- const xt = (n, t, e) => Math.min(e, Math.max(t, n)), xe = "virtualscroll:tap-scroll-cancel", Pe = 20, $e = 250, Be = 60, We = 20, je = 20, Ke = 240, Se = { active: !1, offsetX: 0, offsetY: 0, distance: 0, direction: 0, pointerId: null }, ge = 2.2, Ge = 8, Ze = 120, Je = 1 / 60, Xt = {
129
+ Re.displayName = "TapScrollCircle";
130
+ const ht = (o, t, e) => Math.min(e, Math.max(t, o)), be = "virtualscroll:tap-scroll-cancel", Se = 20, Ue = 250, $e = 60, Ke = 20, We = 20, je = 240, Pe = { active: !1, offsetX: 0, offsetY: 0, distance: 0, direction: 0, pointerId: null }, he = 2.2, Ge = 8, Ze = 120, Je = 1 / 60, kt = {
131
131
  enabled: !0,
132
132
  size: 40,
133
133
  offsetX: -80,
134
134
  offsetY: 0,
135
135
  className: void 0,
136
- maxVisualDistance: Ke,
136
+ maxVisualDistance: je,
137
137
  minSpeedMultiplier: 0.2,
138
138
  opacity: 0.9,
139
139
  renderVisual: void 0,
140
140
  maxSpeedCurve: void 0
141
- }, Qe = (n) => n ? {
141
+ }, Qe = (o) => o ? {
142
142
  mainSizeKey: "width",
143
143
  crossSizeKey: "height",
144
144
  positionKey: "left",
@@ -158,332 +158,332 @@ const xt = (n, t, e) => Math.min(e, Math.max(t, n)), xe = "virtualscroll:tap-scr
158
158
  arrowIcons: ["▲", "▼"],
159
159
  directionClass: "flex flex-col items-stretch",
160
160
  orientation: "vertical"
161
- }, tr = (n, t) => {
162
- const e = n?.maxSpeedMultiplier, r = typeof e == "number" ? e : nr(t);
161
+ }, tr = (o, t) => {
162
+ const e = o?.maxSpeedMultiplier, n = typeof e == "number" ? e : nr(t);
163
163
  return {
164
- enabled: n?.enabled ?? Xt.enabled,
165
- size: n?.size ?? Xt.size,
166
- offsetX: n?.offsetX ?? Xt.offsetX,
167
- offsetY: n?.offsetY ?? Xt.offsetY,
168
- className: n?.className ?? Xt.className,
169
- maxVisualDistance: n?.maxVisualDistance ?? Xt.maxVisualDistance,
170
- maxSpeedMultiplier: r,
171
- minSpeedMultiplier: Math.max(n?.minSpeedMultiplier ?? Xt.minSpeedMultiplier, 0),
172
- opacity: xt(n?.opacity ?? Xt.opacity, 0, 1),
173
- renderVisual: n?.renderVisual ?? Xt.renderVisual,
174
- maxSpeedCurve: n?.maxSpeedCurve ?? Xt.maxSpeedCurve
164
+ enabled: o?.enabled ?? kt.enabled,
165
+ size: o?.size ?? kt.size,
166
+ offsetX: o?.offsetX ?? kt.offsetX,
167
+ offsetY: o?.offsetY ?? kt.offsetY,
168
+ className: o?.className ?? kt.className,
169
+ maxVisualDistance: o?.maxVisualDistance ?? kt.maxVisualDistance,
170
+ maxSpeedMultiplier: n,
171
+ minSpeedMultiplier: Math.max(o?.minSpeedMultiplier ?? kt.minSpeedMultiplier, 0),
172
+ opacity: ht(o?.opacity ?? kt.opacity, 0, 1),
173
+ renderVisual: o?.renderVisual ?? kt.renderVisual,
174
+ maxSpeedCurve: o?.maxSpeedCurve ?? kt.maxSpeedCurve
175
175
  };
176
- }, er = ({ isDragging: n, isThumbHovered: t, enableThumbDrag: e }) => kt(() => e ? n ? "dragging" : t ? "hover" : "idle" : "disabled", [e, n, t]), rr = ({ canUseArrowButtons: n, enableArrowButtons: t, resetTapScroll: e, scrollByStep: r }) => {
177
- const s = M(null), a = M(null), u = C(() => {
178
- s.current !== null && (window.clearInterval(s.current), s.current = null), a.current !== null && (window.clearTimeout(a.current), a.current = null);
179
- }, []), m = C(() => {
176
+ }, er = ({ isDragging: o, isThumbHovered: t, enableThumbDrag: e }) => yt(() => e ? o ? "dragging" : t ? "hover" : "idle" : "disabled", [e, o, t]), rr = ({ canUseArrowButtons: o, enableArrowButtons: t, resetTapScroll: e, scrollByStep: n }) => {
177
+ const s = P(null), c = P(null), u = T(() => {
178
+ s.current !== null && (window.clearInterval(s.current), s.current = null), c.current !== null && (window.clearTimeout(c.current), c.current = null);
179
+ }, []), h = T(() => {
180
180
  u();
181
- }, [u]), l = C(
182
- (c) => (f) => {
183
- n && (f.preventDefault(), f.stopPropagation(), e(), u(), r(c), a.current = window.setTimeout(() => {
181
+ }, [u]), l = T(
182
+ (f) => (p) => {
183
+ o && (p.preventDefault(), p.stopPropagation(), e(), u(), n(f), c.current = window.setTimeout(() => {
184
184
  s.current = window.setInterval(() => {
185
- r(c);
186
- }, Be);
187
- }, $e));
185
+ n(f);
186
+ }, $e);
187
+ }, Ue));
188
188
  },
189
- [n, u, e, r]
190
- ), d = C(
191
- (c) => (f) => {
192
- t && (f.key === "Enter" || f.key === " " || f.key === "Spacebar") && (f.preventDefault(), r(c));
189
+ [o, u, e, n]
190
+ ), d = T(
191
+ (f) => (p) => {
192
+ t && (p.key === "Enter" || p.key === " " || p.key === "Spacebar") && (p.preventDefault(), n(f));
193
193
  },
194
- [t, r]
194
+ [t, n]
195
195
  );
196
- return Y(() => () => {
196
+ return X(() => () => {
197
197
  u();
198
- }, [u]), { handleArrowPointerDown: l, handleArrowPointerUp: m, handleArrowKeyDown: d };
199
- }, nr = (n) => {
200
- if (!n || n <= 0)
201
- return ge;
202
- const t = Math.max(1, n), e = Math.log10(t), r = ge + e * Ge;
203
- return xt(r, ge, Ze);
198
+ }, [u]), { handleArrowPointerDown: l, handleArrowPointerUp: h, handleArrowKeyDown: d };
199
+ }, nr = (o) => {
200
+ if (!o || o <= 0)
201
+ return he;
202
+ const t = Math.max(1, o), e = Math.log10(t), n = he + e * Ge;
203
+ return ht(n, he, Ze);
204
204
  }, or = ({
205
- contentSize: n,
205
+ contentSize: o,
206
206
  viewportSize: t,
207
207
  scrollPosition: e,
208
- onScroll: r,
208
+ onScroll: n,
209
209
  enableThumbDrag: s = !0,
210
- enableTrackClick: a = !0,
210
+ enableTrackClick: c = !0,
211
211
  enableArrowButtons: u = !0,
212
- horizontal: m = !1,
212
+ horizontal: h = !1,
213
213
  scrollBarWidth: l = 12,
214
214
  className: d,
215
- ariaControls: c,
216
- tapScrollCircleOptions: f,
217
- itemCount: P,
218
- renderThumbOverlay: v,
219
- visibleStartIndex: N,
220
- visibleEndIndex: q
215
+ ariaControls: f,
216
+ tapScrollCircleOptions: p,
217
+ itemCount: R,
218
+ renderThumbOverlay: b,
219
+ visibleStartIndex: A,
220
+ visibleEndIndex: U
221
221
  }) => {
222
- const [L, K] = Nt(!1), [It, $] = Nt(!1), [k, z] = Nt(!1), A = M(null), V = M({ pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }), F = M({ pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }), at = M(e), G = M(Se), Ct = M(null), I = M(null), O = M(null), g = kt(() => tr(f, P), [P, f]), et = kt(() => Qe(m), [m]), {
223
- enabled: w,
224
- size: ut,
225
- offsetX: dt,
226
- offsetY: Tt,
227
- className: rt,
228
- maxVisualDistance: X,
229
- maxSpeedMultiplier: mt,
230
- minSpeedMultiplier: vt,
231
- opacity: D,
232
- renderVisual: T,
233
- maxSpeedCurve: S
234
- } = g, J = M({
222
+ const [Y, G] = Vt(!1), [dt, rt] = Vt(!1), [Q, N] = Vt(!1), w = P(null), $ = P({ pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }), z = P({ pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }), Z = P(e), _ = P(Pe), ft = P(null), C = P(null), q = P(null), K = yt(() => tr(p, R), [R, p]), L = yt(() => Qe(h), [h]), {
223
+ enabled: st,
224
+ size: v,
225
+ offsetX: vt,
226
+ offsetY: y,
227
+ className: lt,
228
+ maxVisualDistance: k,
229
+ maxSpeedMultiplier: bt,
230
+ minSpeedMultiplier: it,
231
+ opacity: At,
232
+ renderVisual: I,
233
+ maxSpeedCurve: D
234
+ } = K, M = P({
235
235
  viewportSize: t,
236
- maxScrollPosition: Math.max(n - t, 0),
237
- scrollBarVisible: n > t,
238
- effectiveTapMaxDistance: Math.max(X, 1),
239
- tapCircleMaxSpeedMultiplier: mt,
240
- tapCircleMinSpeedMultiplier: vt,
241
- tapCircleMaxSpeedCurve: S,
242
- tapScrollCircleOptions: f
243
- }), { mainSizeKey: Q, crossSizeKey: st, positionKey: bt, selectDelta: nt, getPointerCoordinate: ft, arrowLabels: lt, arrowIcons: Ft, directionClass: Pt, orientation: ht } = et, Rt = Math.max(X, 1), Lt = t / n, St = l, p = Math.max(t - St * 2, 0), y = Lt * p, it = Math.min(Math.max(Pe, y || 0), p || Pe), B = n - t, W = Math.max(p - it, 0), At = B <= 0 || W <= 0 ? 0 : e / B * W, Vt = At + it / 2, H = n > t, Ht = H && u;
244
- J.current = {
236
+ maxScrollPosition: Math.max(o - t, 0),
237
+ scrollBarVisible: o > t,
238
+ effectiveTapMaxDistance: Math.max(k, 1),
239
+ tapCircleMaxSpeedMultiplier: bt,
240
+ tapCircleMinSpeedMultiplier: it,
241
+ tapCircleMaxSpeedCurve: D,
242
+ tapScrollCircleOptions: p
243
+ }), { mainSizeKey: tt, crossSizeKey: F, positionKey: Mt, selectDelta: xt, getPointerCoordinate: It, arrowLabels: et, arrowIcons: at, directionClass: ct, orientation: gt } = L, Et = Math.max(k, 1), zt = t / o, St = l, g = Math.max(t - St * 2, 0), S = zt * g, nt = Math.min(Math.max(Se, S || 0), g || Se), W = o - t, j = Math.max(g - nt, 0), Dt = W <= 0 || j <= 0 ? 0 : e / W * j, wt = Dt + nt / 2, pt = o > t, Ct = pt && u;
244
+ M.current = {
245
245
  viewportSize: t,
246
- maxScrollPosition: B,
247
- scrollBarVisible: H,
248
- effectiveTapMaxDistance: Rt,
249
- tapCircleMaxSpeedMultiplier: mt,
250
- tapCircleMinSpeedMultiplier: vt,
251
- tapCircleMaxSpeedCurve: S,
252
- tapScrollCircleOptions: f
253
- }, Y(() => {
254
- at.current = e;
255
- }, [e]), Y(() => {
256
- s || $(!1);
246
+ maxScrollPosition: W,
247
+ scrollBarVisible: pt,
248
+ effectiveTapMaxDistance: Et,
249
+ tapCircleMaxSpeedMultiplier: bt,
250
+ tapCircleMinSpeedMultiplier: it,
251
+ tapCircleMaxSpeedCurve: D,
252
+ tapScrollCircleOptions: p
253
+ }, X(() => {
254
+ Z.current = e;
255
+ }, [e]), X(() => {
256
+ s || rt(!1);
257
257
  }, [s]);
258
- const yt = er({ isDragging: L, isThumbHovered: It, enableThumbDrag: s }), Ut = C(
259
- (o, h) => {
260
- const R = J.current, ot = h ?? at.current;
261
- if (r) {
262
- const wt = r(o, ot);
263
- if (typeof wt == "number" && Number.isFinite(wt))
264
- return at.current = wt, wt;
258
+ const Xt = er({ isDragging: Y, isThumbHovered: dt, enableThumbDrag: s }), Nt = T(
259
+ (r, a) => {
260
+ const x = M.current, V = a ?? Z.current;
261
+ if (n) {
262
+ const mt = n(r, V);
263
+ if (typeof mt == "number" && Number.isFinite(mt))
264
+ return Z.current = mt, mt;
265
265
  }
266
- const E = typeof o == "function" ? o(ot) : o, tt = Math.max(R.maxScrollPosition, 0), _t = R.scrollBarVisible ? xt(E, 0, tt) : 0;
267
- return at.current = _t, _t;
266
+ const O = typeof r == "function" ? r(V) : r, E = Math.max(x.maxScrollPosition, 0), H = x.scrollBarVisible ? ht(O, 0, E) : 0;
267
+ return Z.current = H, H;
268
268
  },
269
- [r]
270
- ), Zt = C(
271
- (o) => {
272
- const h = J.current, R = at.current;
273
- if (!h.scrollBarVisible || h.maxScrollPosition <= 0) {
274
- const wt = Ut(0, R), ee = wt - R;
275
- return { nextPosition: wt, actualDelta: ee, reachedBoundary: !0 };
269
+ [n]
270
+ ), Ut = T(
271
+ (r) => {
272
+ const a = M.current, x = Z.current;
273
+ if (!a.scrollBarVisible || a.maxScrollPosition <= 0) {
274
+ const mt = Nt(0, x), $t = mt - x;
275
+ return { nextPosition: mt, actualDelta: $t, reachedBoundary: !0 };
276
276
  }
277
- if (o === 0)
278
- return { nextPosition: R, actualDelta: 0, reachedBoundary: !1 };
279
- const E = Ut((wt) => xt(wt + o, 0, h.maxScrollPosition), R), tt = E - R, _t = tt === 0 || o < 0 && E <= 0 || o > 0 && E >= h.maxScrollPosition;
280
- return { nextPosition: E, actualDelta: tt, reachedBoundary: _t };
277
+ if (r === 0)
278
+ return { nextPosition: x, actualDelta: 0, reachedBoundary: !1 };
279
+ const O = Nt((mt) => ht(mt + r, 0, a.maxScrollPosition), x), E = O - x, H = E === 0 || r < 0 && O <= 0 || r > 0 && O >= a.maxScrollPosition;
280
+ return { nextPosition: O, actualDelta: E, reachedBoundary: H };
281
281
  },
282
- [Ut]
283
- ), Et = C(() => {
284
- I.current !== null && (window.cancelAnimationFrame(I.current), I.current = null), O.current = null;
285
- }, []), gt = C(() => {
286
- G.current = { ...Se }, z(!1), Ct.current?.reset(), Et();
287
- }, [Et]), Jt = C(
288
- (o) => {
289
- const h = G.current, R = J.current;
290
- if (!h.active || h.direction === 0) {
291
- Et();
282
+ [Nt]
283
+ ), J = T(() => {
284
+ C.current !== null && (window.cancelAnimationFrame(C.current), C.current = null), q.current = null;
285
+ }, []), Pt = T(() => {
286
+ _.current = { ...Pe }, N(!1), ft.current?.reset(), J();
287
+ }, [J]), Tt = T(
288
+ (r) => {
289
+ const a = _.current, x = M.current;
290
+ if (!a.active || a.direction === 0) {
291
+ J();
292
292
  return;
293
293
  }
294
- if (!R.scrollBarVisible || R.maxScrollPosition <= 0) {
295
- Et();
294
+ if (!x.scrollBarVisible || x.maxScrollPosition <= 0) {
295
+ J();
296
296
  return;
297
297
  }
298
- const ot = O.current ?? o, E = Math.max((o - ot) / 1e3, 0), tt = Math.min(E, Je);
299
- if (O.current = o, tt <= 0) {
300
- I.current = window.requestAnimationFrame(Jt);
298
+ const V = q.current ?? r, O = Math.max((r - V) / 1e3, 0), E = Math.min(O, Je);
299
+ if (q.current = r, E <= 0) {
300
+ C.current = window.requestAnimationFrame(Tt);
301
301
  return;
302
302
  }
303
- const _t = Math.min(h.distance, R.effectiveTapMaxDistance) / R.effectiveTapMaxDistance, wt = _t ** 1.1, ee = typeof R.tapScrollCircleOptions?.maxSpeedMultiplier == "number", Gt = Math.max(R.viewportSize * R.tapCircleMinSpeedMultiplier, 40), pe = ee ? Gt : 1200;
304
- let me = Math.max(R.viewportSize * R.tapCircleMaxSpeedMultiplier, pe);
305
- const ie = R.tapCircleMaxSpeedCurve;
303
+ const H = Math.min(a.distance, x.effectiveTapMaxDistance) / x.effectiveTapMaxDistance, mt = H ** 1.1, $t = typeof x.tapScrollCircleOptions?.maxSpeedMultiplier == "number", _t = Math.max(x.viewportSize * x.tapCircleMinSpeedMultiplier, 40), Kt = $t ? _t : 1200;
304
+ let pe = Math.max(x.viewportSize * x.tapCircleMaxSpeedMultiplier, Kt);
305
+ const ie = x.tapCircleMaxSpeedCurve;
306
306
  if (ie) {
307
- const ae = Math.max(ie.exponentialSteepness, 0), Oe = Math.max(ie.exponentialScale ?? R.tapCircleMaxSpeedMultiplier, 0), Le = ae === 0 ? _t : Math.expm1(ae * _t), Te = ae === 0 ? 1 : Math.expm1(ae) || 1, Ye = Te === 0 ? _t : Math.min(Math.max(Le / Te, 0), 1), ze = R.viewportSize * Oe * Ye;
308
- me = Math.min(me, Math.max(ze, Gt));
307
+ const ae = Math.max(ie.exponentialSteepness, 0), Fe = Math.max(ie.exponentialScale ?? x.tapCircleMaxSpeedMultiplier, 0), Oe = ae === 0 ? H : Math.expm1(ae * H), Te = ae === 0 ? 1 : Math.expm1(ae) || 1, Le = Te === 0 ? H : Math.min(Math.max(Oe / Te, 0), 1), Ye = x.viewportSize * Fe * Le;
308
+ pe = Math.min(pe, Math.max(Ye, _t));
309
309
  }
310
- const Ve = Math.max(me, Gt), Ee = Math.max(ie?.easedOffset ?? 0, 0), De = Math.min(1, wt + Ee), _e = Gt + (Ve - Gt) * De, Ne = h.direction * _e * tt, { actualDelta: ke, reachedBoundary: Fe } = Zt(Ne);
311
- if (Fe || ke === 0) {
312
- Et();
310
+ const Ve = Math.max(pe, _t), Ae = Math.max(ie?.easedOffset ?? 0, 0), De = Math.min(1, mt + Ae), Ee = _t + (Ve - _t) * De, Ne = a.direction * Ee * E, { actualDelta: _e, reachedBoundary: ke } = Ut(Ne);
311
+ if (ke || _e === 0) {
312
+ J();
313
313
  return;
314
314
  }
315
- I.current = window.requestAnimationFrame(Jt);
315
+ C.current = window.requestAnimationFrame(Tt);
316
316
  },
317
- [Zt, Et]
318
- ), qt = C(() => {
319
- I.current === null && (O.current = null, I.current = window.requestAnimationFrame(Jt));
320
- }, [Jt]);
321
- Y(() => () => {
322
- Et();
323
- }, [Et]);
324
- const Bt = C(
325
- (o) => {
326
- G.current = o, z(o.active), o.active && o.direction !== 0 ? qt() : Et();
317
+ [Ut, J]
318
+ ), jt = T(() => {
319
+ C.current === null && (q.current = null, C.current = window.requestAnimationFrame(Tt));
320
+ }, [Tt]);
321
+ X(() => () => {
322
+ J();
323
+ }, [J]);
324
+ const re = T(
325
+ (r) => {
326
+ _.current = r, N(r.active), r.active && r.direction !== 0 ? jt() : J();
327
327
  },
328
- [qt, Et]
328
+ [jt, J]
329
329
  );
330
- Y(() => {
331
- w || gt();
332
- }, [gt, w]), Y(() => {
333
- const o = (h) => {
334
- const ot = h.detail?.paneId;
335
- ot && c && ot !== c || gt();
330
+ X(() => {
331
+ st || Pt();
332
+ }, [Pt, st]), X(() => {
333
+ const r = (a) => {
334
+ const V = a.detail?.paneId;
335
+ V && f && V !== f || Pt();
336
336
  };
337
- return window.addEventListener(xe, o), () => {
338
- window.removeEventListener(xe, o);
337
+ return window.addEventListener(be, r), () => {
338
+ window.removeEventListener(be, r);
339
339
  };
340
- }, [c, gt]), Y(() => {
341
- if (!w)
340
+ }, [f, Pt]), X(() => {
341
+ if (!st)
342
342
  return;
343
- const o = (h) => {
344
- if (!G.current.active || G.current.pointerId === h.pointerId)
343
+ const r = (a) => {
344
+ if (!_.current.active || _.current.pointerId === a.pointerId)
345
345
  return;
346
- const R = h.target;
347
- if (!(R instanceof Node)) {
348
- gt();
346
+ const x = a.target;
347
+ if (!(x instanceof Node)) {
348
+ Pt();
349
349
  return;
350
350
  }
351
- Ct.current?.getElement()?.contains(R) || gt();
351
+ ft.current?.getElement()?.contains(x) || Pt();
352
352
  };
353
- return document.addEventListener("pointerdown", o, !0), () => {
354
- document.removeEventListener("pointerdown", o, !0);
353
+ return document.addEventListener("pointerdown", r, !0), () => {
354
+ document.removeEventListener("pointerdown", r, !0);
355
355
  };
356
- }, [gt, w]);
357
- const Ot = (o) => {
358
- if (!H || W <= 0 || B <= 0)
356
+ }, [Pt, st]);
357
+ const Gt = (r) => {
358
+ if (!pt || j <= 0 || W <= 0)
359
359
  return 0;
360
- const h = xt(o, 0, W);
361
- return xt(h / W * B, 0, B);
362
- }, $t = (o) => {
363
- const h = Math.max(Math.round(t / je), We);
364
- Zt(o * h);
365
- }, { handleArrowPointerDown: Yt, handleArrowPointerUp: Kt, handleArrowKeyDown: se } = rr({
366
- canUseArrowButtons: Ht,
360
+ const a = ht(r, 0, j);
361
+ return ht(a / j * W, 0, W);
362
+ }, Ht = (r) => {
363
+ const a = Math.max(Math.round(t / We), Ke);
364
+ Ut(r * a);
365
+ }, { handleArrowPointerDown: ne, handleArrowPointerUp: Rt, handleArrowKeyDown: Ft } = rr({
366
+ canUseArrowButtons: Ct,
367
367
  enableArrowButtons: u,
368
- resetTapScroll: gt,
369
- scrollByStep: $t
370
- }), ue = (o) => {
371
- if (!H)
368
+ resetTapScroll: Pt,
369
+ scrollByStep: Ht
370
+ }), Ot = (r) => {
371
+ if (!pt)
372
372
  return;
373
373
  if (!s) {
374
- o.preventDefault(), o.stopPropagation();
374
+ r.preventDefault(), r.stopPropagation();
375
375
  return;
376
376
  }
377
- if (o.pointerType === "mouse" && o.button !== 0 || o.ctrlKey)
377
+ if (r.pointerType === "mouse" && r.button !== 0 || r.ctrlKey)
378
378
  return;
379
- gt();
380
- const h = o.currentTarget;
381
- h.setPointerCapture && h.setPointerCapture(o.pointerId), V.current = {
382
- pointerId: o.pointerId,
383
- startThumbPosition: At,
384
- startClientX: o.clientX,
385
- startClientY: o.clientY
386
- }, K(!0), $(!0), o.preventDefault(), o.stopPropagation();
387
- }, de = (o) => {
388
- const h = V.current;
389
- if (h.pointerId !== o.pointerId)
379
+ Pt();
380
+ const a = r.currentTarget;
381
+ a.setPointerCapture && a.setPointerCapture(r.pointerId), $.current = {
382
+ pointerId: r.pointerId,
383
+ startThumbPosition: Dt,
384
+ startClientX: r.clientX,
385
+ startClientY: r.clientY
386
+ }, G(!0), rt(!0), r.preventDefault(), r.stopPropagation();
387
+ }, Lt = (r) => {
388
+ const a = $.current;
389
+ if (a.pointerId !== r.pointerId)
390
390
  return;
391
- const R = o.clientX - h.startClientX, ot = o.clientY - h.startClientY, E = nt(R, ot), tt = Ot(h.startThumbPosition + E);
392
- Ut(tt), o.cancelable && o.preventDefault();
393
- }, fe = (o) => {
394
- if (V.current.pointerId !== o.pointerId)
391
+ const x = r.clientX - a.startClientX, V = r.clientY - a.startClientY, O = xt(x, V), E = Gt(a.startThumbPosition + O);
392
+ Nt(E), r.cancelable && r.preventDefault();
393
+ }, Yt = (r) => {
394
+ if ($.current.pointerId !== r.pointerId)
395
395
  return;
396
- const h = o.currentTarget;
397
- h.hasPointerCapture(o.pointerId) && h.releasePointerCapture(o.pointerId), V.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }, K(!1), A.current && !A.current.matches(":hover") && $(!1), o.preventDefault(), o.stopPropagation();
398
- }, i = (o) => {
399
- if (V.current.pointerId !== o.pointerId)
396
+ const a = r.currentTarget;
397
+ a.hasPointerCapture(r.pointerId) && a.releasePointerCapture(r.pointerId), $.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }, G(!1), w.current && !w.current.matches(":hover") && rt(!1), r.preventDefault(), r.stopPropagation();
398
+ }, oe = (r) => {
399
+ if ($.current.pointerId !== r.pointerId)
400
400
  return;
401
- const h = o.currentTarget;
402
- h.hasPointerCapture(o.pointerId) && h.releasePointerCapture(o.pointerId), V.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }, K(!1), A.current && !A.current.matches(":hover") && $(!1);
403
- }, x = (o) => {
404
- if (!H)
401
+ const a = r.currentTarget;
402
+ a.hasPointerCapture(r.pointerId) && a.releasePointerCapture(r.pointerId), $.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }, G(!1), w.current && !w.current.matches(":hover") && rt(!1);
403
+ }, se = (r) => {
404
+ if (!pt)
405
405
  return;
406
- if (!a) {
407
- o.preventDefault(), o.stopPropagation();
406
+ if (!c) {
407
+ r.preventDefault(), r.stopPropagation();
408
408
  return;
409
409
  }
410
- if (o.pointerType === "mouse" && o.button !== 0 || o.ctrlKey)
410
+ if (r.pointerType === "mouse" && r.button !== 0 || r.ctrlKey)
411
411
  return;
412
- const h = o.currentTarget, R = h.getBoundingClientRect(), E = ft(o) - (m ? R.left : R.top);
413
- gt();
414
- const tt = E - it / 2, _t = Ot(tt);
415
- Ut(_t), h.setPointerCapture && h.setPointerCapture(o.pointerId), F.current = {
416
- pointerId: o.pointerId,
417
- startThumbPosition: tt,
418
- startClientX: o.clientX,
419
- startClientY: o.clientY
420
- }, o.preventDefault(), o.stopPropagation();
421
- }, b = (o) => {
422
- const h = F.current;
423
- if (h.pointerId !== o.pointerId)
412
+ const a = r.currentTarget, x = a.getBoundingClientRect(), O = It(r) - (h ? x.left : x.top);
413
+ Pt();
414
+ const E = O - nt / 2, H = Gt(E);
415
+ Nt(H), a.setPointerCapture && a.setPointerCapture(r.pointerId), z.current = {
416
+ pointerId: r.pointerId,
417
+ startThumbPosition: E,
418
+ startClientX: r.clientX,
419
+ startClientY: r.clientY
420
+ }, r.preventDefault(), r.stopPropagation();
421
+ }, ue = (r) => {
422
+ const a = z.current;
423
+ if (a.pointerId !== r.pointerId)
424
424
  return;
425
- const R = o.clientX - h.startClientX, ot = o.clientY - h.startClientY, E = nt(R, ot), tt = Ot(h.startThumbPosition + E);
426
- Ut(tt), o.cancelable && o.preventDefault();
427
- }, _ = (o) => {
428
- if (F.current.pointerId !== o.pointerId)
425
+ const x = r.clientX - a.startClientX, V = r.clientY - a.startClientY, O = xt(x, V), E = Gt(a.startThumbPosition + O);
426
+ Nt(E), r.cancelable && r.preventDefault();
427
+ }, Zt = (r) => {
428
+ if (z.current.pointerId !== r.pointerId)
429
429
  return;
430
- const h = o.currentTarget;
431
- h.hasPointerCapture(o.pointerId) && h.releasePointerCapture(o.pointerId), F.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }, o.preventDefault(), o.stopPropagation();
432
- }, j = (o) => {
433
- if (F.current.pointerId !== o.pointerId)
430
+ const a = r.currentTarget;
431
+ a.hasPointerCapture(r.pointerId) && a.releasePointerCapture(r.pointerId), z.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }, r.preventDefault(), r.stopPropagation();
432
+ }, Jt = (r) => {
433
+ if (z.current.pointerId !== r.pointerId)
434
434
  return;
435
- const h = o.currentTarget;
436
- h.hasPointerCapture(o.pointerId) && h.releasePointerCapture(o.pointerId), F.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 };
437
- }, Z = kt(() => xt((k ? 1 : 0.8) * D, 0, 1), [k, D]), Mt = kt(() => {
438
- const h = `calc(50% - ${ut / 2}px + ${Tt}px)`;
435
+ const a = r.currentTarget;
436
+ a.hasPointerCapture(r.pointerId) && a.releasePointerCapture(r.pointerId), z.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 };
437
+ }, de = yt(() => ht((Q ? 1 : 0.8) * At, 0, 1), [Q, At]), fe = yt(() => {
438
+ const a = `calc(50% - ${v / 2}px + ${y}px)`;
439
439
  return {
440
- left: dt,
441
- top: h
440
+ left: vt,
441
+ top: a
442
442
  };
443
- }, [dt, Tt, ut]), zt = (o, h, R) => /* @__PURE__ */ U(
443
+ }, [vt, y, v]), i = (r, a, x) => /* @__PURE__ */ B(
444
444
  "button",
445
445
  {
446
446
  type: "button",
447
447
  tabIndex: -1,
448
448
  className: "aqvs:scrollbar-arrow-button flex items-center justify-center text-xs transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 disabled:cursor-not-allowed disabled:opacity-50",
449
449
  style: {
450
- [Q]: St,
451
- [st]: l
450
+ [tt]: St,
451
+ [F]: l
452
452
  },
453
- "aria-label": h,
454
- onMouseDown: Yt(o),
455
- onTouchStart: Yt(o),
456
- onMouseUp: Kt,
457
- onMouseLeave: Kt,
458
- onTouchEnd: Kt,
459
- onTouchCancel: Kt,
460
- onKeyDown: se(o),
453
+ "aria-label": a,
454
+ onMouseDown: ne(r),
455
+ onTouchStart: ne(r),
456
+ onMouseUp: Rt,
457
+ onMouseLeave: Rt,
458
+ onTouchEnd: Rt,
459
+ onTouchCancel: Rt,
460
+ onKeyDown: Ft(r),
461
461
  "aria-disabled": !u,
462
- disabled: !Ht,
463
- children: /* @__PURE__ */ U("span", { "aria-hidden": "true", children: R })
462
+ disabled: !Ct,
463
+ children: /* @__PURE__ */ B("span", { "aria-hidden": "true", children: x })
464
464
  }
465
- ), Dt = v && H ? {
466
- orientation: ht,
465
+ ), m = b && pt ? {
466
+ orientation: gt,
467
467
  scrollPosition: e,
468
- maxScrollPosition: B,
469
- contentSize: n,
468
+ maxScrollPosition: W,
469
+ contentSize: o,
470
470
  viewportSize: t,
471
- thumbSize: it,
472
- thumbPosition: At,
473
- thumbCenter: Vt,
474
- trackSize: p,
475
- isDragging: L,
476
- isTapScrollActive: k,
477
- visibleStartIndex: N,
478
- visibleEndIndex: q
471
+ thumbSize: nt,
472
+ thumbPosition: Dt,
473
+ thumbCenter: wt,
474
+ trackSize: g,
475
+ isDragging: Y,
476
+ isTapScrollActive: Q,
477
+ visibleStartIndex: A,
478
+ visibleEndIndex: U
479
479
  } : null;
480
- return /* @__PURE__ */ te(
480
+ return /* @__PURE__ */ Bt(
481
481
  "div",
482
482
  {
483
- className: Qt("group relative cursor-default select-none", Pt, d),
483
+ className: Wt("group relative cursor-default select-none", ct, d),
484
484
  style: {
485
- [Q]: t,
486
- [st]: l,
485
+ [tt]: t,
486
+ [F]: l,
487
487
  backgroundColor: "white",
488
488
  userSelect: "none",
489
489
  position: "relative",
@@ -491,27 +491,27 @@ const xt = (n, t, e) => Math.min(e, Math.max(t, n)), xe = "virtualscroll:tap-scr
491
491
  },
492
492
  role: "scrollbar",
493
493
  tabIndex: -1,
494
- "aria-controls": c,
494
+ "aria-controls": f,
495
495
  "aria-valuenow": e,
496
496
  "aria-valuemin": 0,
497
- "aria-valuemax": B,
498
- "aria-orientation": m ? "horizontal" : "vertical",
497
+ "aria-valuemax": W,
498
+ "aria-orientation": h ? "horizontal" : "vertical",
499
499
  children: [
500
- !m && H && w && /* @__PURE__ */ U(
501
- Ae,
500
+ !h && pt && st && /* @__PURE__ */ B(
501
+ Re,
502
502
  {
503
- ref: Ct,
504
- className: Qt("pointer-events-auto absolute transition-opacity duration-150", rt),
505
- size: ut,
506
- maxVisualDistance: Rt,
507
- style: Mt,
508
- opacity: Z,
509
- renderVisual: T,
510
- onDragChange: Bt
503
+ ref: ft,
504
+ className: Wt("pointer-events-auto absolute transition-opacity duration-150", lt),
505
+ size: v,
506
+ maxVisualDistance: Et,
507
+ style: fe,
508
+ opacity: de,
509
+ renderVisual: I,
510
+ onDragChange: re
511
511
  }
512
512
  ),
513
- zt(-1, lt[0], Ft[0]),
514
- /* @__PURE__ */ te(
513
+ i(-1, et[0], at[0]),
514
+ /* @__PURE__ */ Bt(
515
515
  "div",
516
516
  {
517
517
  className: "aqvs:scrollbar-track relative flex-1",
@@ -519,50 +519,50 @@ const xt = (n, t, e) => Math.min(e, Math.max(t, n)), xe = "virtualscroll:tap-scr
519
519
  borderRadius: l / 2,
520
520
  touchAction: "none"
521
521
  },
522
- onPointerDown: x,
523
- onPointerMove: b,
524
- onPointerUp: _,
525
- onPointerCancel: j,
526
- "aria-disabled": !a,
522
+ onPointerDown: se,
523
+ onPointerMove: ue,
524
+ onPointerUp: Zt,
525
+ onPointerCancel: Jt,
526
+ "aria-disabled": !c,
527
527
  children: [
528
- Dt && /* @__PURE__ */ U("div", { className: "pointer-events-none absolute inset-0", "aria-hidden": !0, children: v?.(Dt) }),
529
- H && // スクロールバーのつまみの当たり判定を広げるためのラッパー
530
- /* @__PURE__ */ U(
528
+ m && /* @__PURE__ */ B("div", { className: "pointer-events-none absolute inset-0", "aria-hidden": !0, children: b?.(m) }),
529
+ pt && // スクロールバーのつまみの当たり判定を広げるためのラッパー
530
+ /* @__PURE__ */ B(
531
531
  "div",
532
532
  {
533
533
  className: "group absolute",
534
534
  style: {
535
- [Q]: it,
536
- [bt]: At,
537
- ...m ? { top: 0, bottom: 0 } : { left: 0, right: 0 },
535
+ [tt]: nt,
536
+ [Mt]: Dt,
537
+ ...h ? { top: 0, bottom: 0 } : { left: 0, right: 0 },
538
538
  touchAction: "none"
539
539
  },
540
- onPointerDown: ue,
541
- onPointerMove: de,
542
- onPointerUp: fe,
543
- onPointerCancel: i,
540
+ onPointerDown: Ot,
541
+ onPointerMove: Lt,
542
+ onPointerUp: Yt,
543
+ onPointerCancel: oe,
544
544
  role: "slider",
545
- "aria-orientation": m ? "horizontal" : "vertical",
545
+ "aria-orientation": h ? "horizontal" : "vertical",
546
546
  "aria-valuenow": e,
547
547
  "aria-valuemin": 0,
548
- "aria-valuemax": B,
548
+ "aria-valuemax": W,
549
549
  "aria-disabled": !s,
550
550
  tabIndex: -1,
551
- children: /* @__PURE__ */ U(
551
+ children: /* @__PURE__ */ B(
552
552
  "div",
553
553
  {
554
- ref: A,
555
- className: Qt("aqvs:scrollbar-thumb absolute", m ? "aqvs:scrollbar-thumb-horizontal" : "aqvs:scrollbar-thumb-vertical"),
556
- "data-thumb-state": yt,
554
+ ref: w,
555
+ className: Wt("aqvs:scrollbar-thumb absolute", h ? "aqvs:scrollbar-thumb-horizontal" : "aqvs:scrollbar-thumb-vertical"),
556
+ "data-thumb-state": Xt,
557
557
  style: {
558
558
  borderRadius: l - 1,
559
559
  cursor: s ? "pointer" : "default"
560
560
  },
561
561
  onMouseEnter: () => {
562
- s && $(!0);
562
+ s && rt(!0);
563
563
  },
564
564
  onMouseLeave: () => {
565
- s && $(!1);
565
+ s && rt(!1);
566
566
  }
567
567
  }
568
568
  )
@@ -571,179 +571,179 @@ const xt = (n, t, e) => Math.min(e, Math.max(t, n)), xe = "virtualscroll:tap-scr
571
571
  ]
572
572
  }
573
573
  ),
574
- zt(1, lt[1], Ft[1])
574
+ i(1, et[1], at[1])
575
575
  ]
576
576
  }
577
577
  );
578
- }, pt = {
579
- debug(n, ...t) {
580
- process.env.NODE_ENV === "___" && console.debug(`[VirtualScroll] ${n}`, ...t);
578
+ }, ut = {
579
+ debug(o, ...t) {
580
+ process.env.NODE_ENV === "___" && console.debug(`[VirtualScroll] ${o}`, ...t);
581
581
  },
582
- warn(n, ...t) {
583
- console.warn(`[VirtualScroll] ${n}`, ...t);
582
+ warn(o, ...t) {
583
+ console.warn(`[VirtualScroll] ${o}`, ...t);
584
584
  },
585
- error(n, ...t) {
586
- console.error(`[VirtualScroll] ${n}`, ...t);
585
+ error(o, ...t) {
586
+ console.error(`[VirtualScroll] ${o}`, ...t);
587
587
  }
588
- }, re = {
588
+ }, Qt = {
589
589
  maxVelocity: 6,
590
590
  minVelocity: 0.02,
591
591
  deceleration: 25e-4,
592
592
  velocitySampleWindow: 90,
593
593
  startVelocityThreshold: 0.04
594
- }, le = (n, t, e) => {
595
- for (const [r, s, a] of t)
596
- e === "add" ? n.addEventListener(r, s, a) : n.removeEventListener(r, s, a);
597
- }, sr = Ie(
594
+ }, le = (o, t, e) => {
595
+ for (const [n, s, c] of t)
596
+ e === "add" ? o.addEventListener(n, s, c) : o.removeEventListener(n, s, c);
597
+ }, sr = xe(
598
598
  ({
599
- children: n,
599
+ children: o,
600
600
  contentSize: t,
601
601
  viewportSize: e,
602
- scrollBarWidth: r = 12,
602
+ scrollBarWidth: n = 12,
603
603
  enableThumbDrag: s = !0,
604
- enableTrackClick: a = !0,
604
+ enableTrackClick: c = !0,
605
605
  enableArrowButtons: u = !0,
606
- enablePointerDrag: m = !0,
606
+ enablePointerDrag: h = !0,
607
607
  onScroll: l,
608
608
  className: d,
609
- style: c,
610
- background: f,
611
- tapScrollCircleOptions: P,
612
- inertiaOptions: v,
613
- itemCount: N,
614
- renderThumbOverlay: q,
615
- wheelSpeedMultiplier: L = 1,
616
- contentInsets: K,
617
- visibleStartIndex: It,
618
- visibleEndIndex: $,
619
- renderOverlay: k
620
- }, z) => {
621
- const A = M(0), V = M(null), F = M(null), at = M({
609
+ style: f,
610
+ background: p,
611
+ tapScrollCircleOptions: R,
612
+ inertiaOptions: b,
613
+ itemCount: A,
614
+ renderThumbOverlay: U,
615
+ wheelSpeedMultiplier: Y = 1,
616
+ contentInsets: G,
617
+ visibleStartIndex: dt,
618
+ visibleEndIndex: rt,
619
+ renderOverlay: Q
620
+ }, N) => {
621
+ const w = P(0), $ = P(null), z = P(null), Z = P({
622
622
  frame: null,
623
623
  velocity: 0,
624
624
  lastTimestamp: null
625
- }), G = kt(
625
+ }), _ = yt(
626
626
  () => ({
627
- maxVelocity: v?.maxVelocity ?? re.maxVelocity,
628
- minVelocity: v?.minVelocity ?? re.minVelocity,
629
- deceleration: v?.deceleration ?? re.deceleration,
630
- velocitySampleWindow: v?.velocitySampleWindow ?? re.velocitySampleWindow,
631
- startVelocityThreshold: v?.startVelocityThreshold ?? re.startVelocityThreshold
627
+ maxVelocity: b?.maxVelocity ?? Qt.maxVelocity,
628
+ minVelocity: b?.minVelocity ?? Qt.minVelocity,
629
+ deceleration: b?.deceleration ?? Qt.deceleration,
630
+ velocitySampleWindow: b?.velocitySampleWindow ?? Qt.velocitySampleWindow,
631
+ startVelocityThreshold: b?.startVelocityThreshold ?? Qt.startVelocityThreshold
632
632
  }),
633
- [v]
634
- ), Ct = kt(() => ({
635
- top: Math.max(0, K?.top ?? 0),
636
- bottom: Math.max(0, K?.bottom ?? 0)
637
- }), [K]);
638
- pt.debug("[ScrollPane] ScrollPane rendered", {
633
+ [b]
634
+ ), ft = yt(() => ({
635
+ top: Math.max(0, G?.top ?? 0),
636
+ bottom: Math.max(0, G?.bottom ?? 0)
637
+ }), [G]);
638
+ ut.debug("[ScrollPane] ScrollPane rendered", {
639
639
  contentSize: t,
640
640
  viewportSize: e,
641
- scrollBarWidth: r,
641
+ scrollBarWidth: n,
642
642
  className: d,
643
- style: c,
644
- tapScrollCircleOptions: P,
645
- inertiaOptions: v,
646
- enablePointerDrag: m,
647
- contentInsets: Ct
643
+ style: f,
644
+ tapScrollCircleOptions: R,
645
+ inertiaOptions: b,
646
+ enablePointerDrag: h,
647
+ contentInsets: ft
648
648
  });
649
- const I = M({ contentSize: t, viewportSize: e }), O = kt(() => t > e, [t, e]), g = C(
650
- (T) => {
651
- const { contentSize: S, viewportSize: J } = I.current, Q = S > J, st = A.current;
652
- if (pt.debug("[ScrollPane] scrollTo called", { newPosition: T, contentSize: S, viewportSize: J, currentIsScrollable: Q, prevPosition: st }), !Q)
653
- return A.current !== 0 && (A.current = 0, l?.(0, st)), A.current;
654
- const bt = typeof T == "function" ? T(A.current) : T, nt = Math.max(S - J, 0), ft = xt(bt, 0, nt);
655
- return A.current !== ft && (A.current = ft, l?.(ft, st)), A.current;
649
+ const C = P({ contentSize: t, viewportSize: e }), q = yt(() => t > e, [t, e]), K = T(
650
+ (I) => {
651
+ const { contentSize: D, viewportSize: M } = C.current, tt = D > M, F = w.current;
652
+ if (ut.debug("[ScrollPane] scrollTo called", { newPosition: I, contentSize: D, viewportSize: M, currentIsScrollable: tt, prevPosition: F }), !tt)
653
+ return w.current !== 0 && (w.current = 0, l?.(0, F)), w.current;
654
+ const Mt = typeof I == "function" ? I(w.current) : I, xt = Math.max(D - M, 0), It = ht(Mt, 0, xt);
655
+ return w.current !== It && (w.current = It, l?.(It, F)), w.current;
656
656
  },
657
657
  [l]
658
- ), et = C(() => {
659
- const T = at.current;
660
- T.frame !== null && cancelAnimationFrame(T.frame), T.frame = null, T.velocity = 0, T.lastTimestamp = null;
661
- }, []), w = M(et);
662
- Y(() => {
663
- w.current = et;
664
- }, [et]);
665
- const ut = C(
666
- (T) => {
667
- if (!O)
658
+ ), L = T(() => {
659
+ const I = Z.current;
660
+ I.frame !== null && cancelAnimationFrame(I.frame), I.frame = null, I.velocity = 0, I.lastTimestamp = null;
661
+ }, []), st = P(L);
662
+ X(() => {
663
+ st.current = L;
664
+ }, [L]);
665
+ const v = T(
666
+ (I) => {
667
+ if (!q)
668
668
  return;
669
- const { maxVelocity: S, minVelocity: J, deceleration: Q, startVelocityThreshold: st } = G, bt = xt(T, -S, S);
670
- if (Math.abs(bt) < st)
669
+ const { maxVelocity: D, minVelocity: M, deceleration: tt, startVelocityThreshold: F } = _, Mt = ht(I, -D, D);
670
+ if (Math.abs(Mt) < F)
671
671
  return;
672
- et(), at.current.velocity = bt, at.current.lastTimestamp = null;
673
- const nt = (ft) => {
674
- const lt = at.current;
675
- if (lt.lastTimestamp === null) {
676
- lt.lastTimestamp = ft, lt.frame = requestAnimationFrame(nt);
672
+ L(), Z.current.velocity = Mt, Z.current.lastTimestamp = null;
673
+ const xt = (It) => {
674
+ const et = Z.current;
675
+ if (et.lastTimestamp === null) {
676
+ et.lastTimestamp = It, et.frame = requestAnimationFrame(xt);
677
677
  return;
678
678
  }
679
- const Ft = ft - lt.lastTimestamp;
680
- if (lt.lastTimestamp = ft, Ft <= 0) {
681
- lt.frame = requestAnimationFrame(nt);
679
+ const at = It - et.lastTimestamp;
680
+ if (et.lastTimestamp = It, at <= 0) {
681
+ et.frame = requestAnimationFrame(xt);
682
682
  return;
683
683
  }
684
- const Pt = lt.velocity;
685
- let ht = Pt;
686
- const Rt = Q * Ft;
687
- Pt > 0 ? ht = Math.max(0, Pt - Rt) : Pt < 0 && (ht = Math.min(0, Pt + Rt));
688
- const St = (Pt + ht) / 2 * Ft, p = A.current;
689
- St !== 0 && g((Vt) => Vt + St);
690
- const y = A.current, { contentSize: it, viewportSize: B } = I.current, W = Math.max(it - B, 0);
691
- lt.velocity = ht;
692
- const At = y === p || y <= 0 && ht <= 0 || y >= W && ht >= 0;
693
- if (Math.abs(ht) < J || At) {
694
- et();
684
+ const ct = et.velocity;
685
+ let gt = ct;
686
+ const Et = tt * at;
687
+ ct > 0 ? gt = Math.max(0, ct - Et) : ct < 0 && (gt = Math.min(0, ct + Et));
688
+ const St = (ct + gt) / 2 * at, g = w.current;
689
+ St !== 0 && K((wt) => wt + St);
690
+ const S = w.current, { contentSize: nt, viewportSize: W } = C.current, j = Math.max(nt - W, 0);
691
+ et.velocity = gt;
692
+ const Dt = S === g || S <= 0 && gt <= 0 || S >= j && gt >= 0;
693
+ if (Math.abs(gt) < M || Dt) {
694
+ L();
695
695
  return;
696
696
  }
697
- lt.frame = requestAnimationFrame(nt);
697
+ et.frame = requestAnimationFrame(xt);
698
698
  };
699
- at.current.frame = requestAnimationFrame(nt);
699
+ Z.current.frame = requestAnimationFrame(xt);
700
700
  },
701
- [O, G, g, et]
702
- ), dt = M(ut);
703
- Y(() => {
704
- dt.current = ut;
705
- }, [ut]), oe(() => {
706
- I.current = { contentSize: t, viewportSize: e };
707
- }, [t, e]), oe(() => {
708
- const T = F.current;
709
- if (!T) return;
710
- const S = () => {
711
- T.scrollTop !== 0 && (pt.debug("[ScrollPane] Native scroll detected, resetting to 0", { scrollTop: T.scrollTop }), T.scrollTop = 0), T.scrollLeft !== 0 && (T.scrollLeft = 0);
701
+ [q, _, K, L]
702
+ ), vt = P(v);
703
+ X(() => {
704
+ vt.current = v;
705
+ }, [v]), ee(() => {
706
+ C.current = { contentSize: t, viewportSize: e };
707
+ }, [t, e]), ee(() => {
708
+ const I = z.current;
709
+ if (!I) return;
710
+ const D = () => {
711
+ I.scrollTop !== 0 && (ut.debug("[ScrollPane] Native scroll detected, resetting to 0", { scrollTop: I.scrollTop }), I.scrollTop = 0), I.scrollLeft !== 0 && (I.scrollLeft = 0);
712
712
  };
713
- return T.addEventListener("scroll", S), () => T.removeEventListener("scroll", S);
714
- }, []), oe(() => {
715
- if (O) {
716
- pt.debug("[ScrollPane] Adjusting scroll position due to content or viewport size change", { contentSize: t, viewportSize: e, scrollPosition: A.current });
717
- const T = xt(t - e, 0, t);
718
- A.current > T && g(T);
713
+ return I.addEventListener("scroll", D), () => I.removeEventListener("scroll", D);
714
+ }, []), ee(() => {
715
+ if (q) {
716
+ ut.debug("[ScrollPane] Adjusting scroll position due to content or viewport size change", { contentSize: t, viewportSize: e, scrollPosition: w.current });
717
+ const I = ht(t - e, 0, t);
718
+ w.current > I && K(I);
719
719
  } else
720
- g(0);
721
- }, [O, g, t, e]), Y(() => {
722
- const T = (J) => {
723
- if (!O)
720
+ K(0);
721
+ }, [q, K, t, e]), X(() => {
722
+ const I = (M) => {
723
+ if (!q)
724
724
  return;
725
- J.preventDefault(), et();
726
- let Q = J.deltaY;
727
- J.deltaMode === 1 ? Q *= 16 : J.deltaMode === 2 && (Q *= e), L !== 1 && (Q *= L), pt.debug("[ScrollPane] wheel event", { deltaY: Q, scrollPosition: A.current, wheelSpeedMultiplier: L, deltaMode: J.deltaMode, scrollTop: F.current?.scrollTop }), g((st) => st + Q);
728
- }, S = V.current;
729
- return S && S.addEventListener("wheel", T, { passive: !1 }), () => {
730
- S && S.removeEventListener("wheel", T);
725
+ M.preventDefault(), L();
726
+ let tt = M.deltaY;
727
+ M.deltaMode === 1 ? tt *= 16 : M.deltaMode === 2 && (tt *= e), Y !== 1 && (tt *= Y), ut.debug("[ScrollPane] wheel event", { deltaY: tt, scrollPosition: w.current, wheelSpeedMultiplier: Y, deltaMode: M.deltaMode, scrollTop: z.current?.scrollTop }), K((F) => F + tt);
728
+ }, D = $.current;
729
+ return D && D.addEventListener("wheel", I, { passive: !1 }), () => {
730
+ D && D.removeEventListener("wheel", I);
731
731
  };
732
- }, [O, g, et, e, L]), be(
733
- z,
732
+ }, [q, K, L, e, Y]), Ie(
733
+ N,
734
734
  () => ({
735
- scrollTo: (T) => (et(), g(T)),
736
- getScrollPosition: () => A.current,
735
+ scrollTo: (I) => (L(), K(I)),
736
+ getScrollPosition: () => w.current,
737
737
  getContentSize: () => t,
738
738
  getViewportSize: () => e
739
739
  }),
740
- [g, t, e, et]
740
+ [K, t, e, L]
741
741
  );
742
- const Tt = M(g);
743
- Y(() => {
744
- Tt.current = g;
745
- }, [g]);
746
- const rt = He(), X = M({
742
+ const y = P(K);
743
+ X(() => {
744
+ y.current = K;
745
+ }, [K]);
746
+ const lt = qe(), k = P({
747
747
  pointerId: null,
748
748
  startClientY: 0,
749
749
  startScroll: 0,
@@ -751,197 +751,197 @@ const xt = (n, t, e) => Math.min(e, Math.max(t, n)), xe = "virtualscroll:tap-scr
751
751
  shouldCancelNextClick: !1,
752
752
  clickResetTimer: null,
753
753
  velocitySamples: []
754
- }), mt = M(m);
755
- Y(() => {
756
- mt.current = m;
757
- }, [m]);
758
- const vt = M(O);
759
- Y(() => {
760
- vt.current = O;
761
- }, [O]);
762
- const D = M(G);
763
- return Y(() => {
764
- D.current = G;
765
- }, [G]), Y(() => {
766
- if (m)
754
+ }), bt = P(h);
755
+ X(() => {
756
+ bt.current = h;
757
+ }, [h]);
758
+ const it = P(q);
759
+ X(() => {
760
+ it.current = q;
761
+ }, [q]);
762
+ const At = P(_);
763
+ return X(() => {
764
+ At.current = _;
765
+ }, [_]), X(() => {
766
+ if (h)
767
767
  return;
768
- const T = F.current, S = X.current;
769
- S.pointerId !== null && T && T.hasPointerCapture(S.pointerId) && T.releasePointerCapture(S.pointerId), S.clickResetTimer !== null && (window.clearTimeout(S.clickResetTimer), S.clickResetTimer = null), S.pointerId = null, S.startClientY = 0, S.startScroll = 0, S.isDragging = !1, S.shouldCancelNextClick = !1, S.velocitySamples = [];
770
- }, [m]), Y(() => {
771
- const T = F.current;
772
- if (!T)
768
+ const I = z.current, D = k.current;
769
+ D.pointerId !== null && I && I.hasPointerCapture(D.pointerId) && I.releasePointerCapture(D.pointerId), D.clickResetTimer !== null && (window.clearTimeout(D.clickResetTimer), D.clickResetTimer = null), D.pointerId = null, D.startClientY = 0, D.startScroll = 0, D.isDragging = !1, D.shouldCancelNextClick = !1, D.velocitySamples = [];
770
+ }, [h]), X(() => {
771
+ const I = z.current;
772
+ if (!I)
773
773
  return;
774
- const S = 6, J = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(), Q = () => {
775
- const p = X.current;
776
- p.pointerId = null, p.startClientY = 0, p.startScroll = 0, p.isDragging = !1, p.velocitySamples = [];
777
- }, st = () => {
778
- const p = X.current;
779
- p.clickResetTimer !== null && (window.clearTimeout(p.clickResetTimer), p.clickResetTimer = null);
780
- }, bt = (p) => {
781
- const y = X.current, it = J();
782
- y.velocitySamples.push({ clientY: p, time: it });
783
- const B = D.current.velocitySampleWindow;
784
- y.velocitySamples = y.velocitySamples.filter((W) => it - W.time <= B);
785
- }, nt = (p) => p instanceof HTMLElement && p.closest("[data-scrollpane-ignore-drag='true']") !== null, ft = (p) => {
786
- const y = X.current;
787
- y.shouldCancelNextClick && (p.preventDefault(), p.stopPropagation(), y.shouldCancelNextClick = !1);
788
- }, lt = (p) => {
789
- const y = X.current;
790
- y.isDragging || (y.isDragging = !0, y.shouldCancelNextClick = !0, T.hasPointerCapture(p.pointerId) || T.setPointerCapture(p.pointerId), bt(p.clientY));
791
- }, Ft = (p) => {
792
- const y = X.current;
793
- if (y.pointerId !== p.pointerId || !(mt.current && vt.current) || !y.isDragging && (Math.abs(p.clientY - y.startClientY) < S || (lt(p), !y.isDragging)))
774
+ const D = 6, M = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(), tt = () => {
775
+ const g = k.current;
776
+ g.pointerId = null, g.startClientY = 0, g.startScroll = 0, g.isDragging = !1, g.velocitySamples = [];
777
+ }, F = () => {
778
+ const g = k.current;
779
+ g.clickResetTimer !== null && (window.clearTimeout(g.clickResetTimer), g.clickResetTimer = null);
780
+ }, Mt = (g) => {
781
+ const S = k.current, nt = M();
782
+ S.velocitySamples.push({ clientY: g, time: nt });
783
+ const W = At.current.velocitySampleWindow;
784
+ S.velocitySamples = S.velocitySamples.filter((j) => nt - j.time <= W);
785
+ }, xt = (g) => g instanceof HTMLElement && g.closest("[data-scrollpane-ignore-drag='true']") !== null, It = (g) => {
786
+ const S = k.current;
787
+ S.shouldCancelNextClick && (g.preventDefault(), g.stopPropagation(), S.shouldCancelNextClick = !1);
788
+ }, et = (g) => {
789
+ const S = k.current;
790
+ S.isDragging || (S.isDragging = !0, S.shouldCancelNextClick = !0, I.hasPointerCapture(g.pointerId) || I.setPointerCapture(g.pointerId), Mt(g.clientY));
791
+ }, at = (g) => {
792
+ const S = k.current;
793
+ if (S.pointerId !== g.pointerId || !(bt.current && it.current) || !S.isDragging && (Math.abs(g.clientY - S.startClientY) < D || (et(g), !S.isDragging)))
794
794
  return;
795
- bt(p.clientY);
796
- const it = p.clientY - y.startClientY, B = y.startScroll - it;
797
- Tt.current(B), p.cancelable && p.preventDefault();
798
- }, Pt = (p) => {
799
- const y = X.current;
800
- if (y.pointerId !== p.pointerId)
795
+ Mt(g.clientY);
796
+ const nt = g.clientY - S.startClientY, W = S.startScroll - nt;
797
+ y.current(W), g.cancelable && g.preventDefault();
798
+ }, ct = (g) => {
799
+ const S = k.current;
800
+ if (S.pointerId !== g.pointerId)
801
801
  return;
802
- y.isDragging && y.shouldCancelNextClick && p.cancelable && (p.preventDefault(), p.stopPropagation()), T.hasPointerCapture(p.pointerId) && T.releasePointerCapture(p.pointerId);
803
- let it = 0;
804
- if (y.isDragging && y.velocitySamples.length >= 2) {
805
- const W = y.velocitySamples, At = D.current.velocitySampleWindow, Vt = W[W.length - 1], H = W.find((Ht) => Vt.time - Ht.time <= At) ?? W[0];
806
- if (Vt && H && Vt.time !== H.time) {
807
- const Ht = Vt.clientY - H.clientY, yt = Vt.time - H.time;
808
- it = -(Ht / yt);
802
+ S.isDragging && S.shouldCancelNextClick && g.cancelable && (g.preventDefault(), g.stopPropagation()), I.hasPointerCapture(g.pointerId) && I.releasePointerCapture(g.pointerId);
803
+ let nt = 0;
804
+ if (S.isDragging && S.velocitySamples.length >= 2) {
805
+ const j = S.velocitySamples, Dt = At.current.velocitySampleWindow, wt = j[j.length - 1], pt = j.find((Ct) => wt.time - Ct.time <= Dt) ?? j[0];
806
+ if (wt && pt && wt.time !== pt.time) {
807
+ const Ct = wt.clientY - pt.clientY, Xt = wt.time - pt.time;
808
+ nt = -(Ct / Xt);
809
809
  }
810
810
  }
811
- st(), y.shouldCancelNextClick && (y.clickResetTimer = window.setTimeout(() => {
812
- const W = X.current;
813
- W.shouldCancelNextClick = !1, W.clickResetTimer = null;
811
+ F(), S.shouldCancelNextClick && (S.clickResetTimer = window.setTimeout(() => {
812
+ const j = k.current;
813
+ j.shouldCancelNextClick = !1, j.clickResetTimer = null;
814
814
  }, 0));
815
- const B = D.current.startVelocityThreshold;
816
- Q(), Math.abs(it) >= B && dt.current?.(it);
817
- }, ht = (p) => {
818
- if (!(mt.current && vt.current) || p.button !== 0 && p.pointerType === "mouse" || p.ctrlKey || p.metaKey || p.altKey || nt(p.target))
815
+ const W = At.current.startVelocityThreshold;
816
+ tt(), Math.abs(nt) >= W && vt.current?.(nt);
817
+ }, gt = (g) => {
818
+ if (!(bt.current && it.current) || g.button !== 0 && g.pointerType === "mouse" || g.ctrlKey || g.metaKey || g.altKey || xt(g.target))
819
819
  return;
820
- window.dispatchEvent(new CustomEvent(xe, { detail: { paneId: rt } })), w.current?.();
821
- const y = X.current;
822
- st(), y.pointerId = p.pointerId, y.startClientY = p.clientY, y.startScroll = A.current, y.isDragging = !1, y.shouldCancelNextClick = !1, y.velocitySamples = [];
823
- }, Rt = (p) => {
824
- const y = X.current;
825
- y.pointerId === p.pointerId && (y.shouldCancelNextClick = !1, T.hasPointerCapture(p.pointerId) && T.releasePointerCapture(p.pointerId), st(), Q());
826
- }, Lt = [
827
- ["click", ft, !0],
828
- ["pointerdown", ht, { passive: !1 }],
829
- ["pointermove", Ft, { passive: !1 }],
830
- ["pointerup", Pt, void 0],
831
- ["pointercancel", Rt, void 0]
820
+ window.dispatchEvent(new CustomEvent(be, { detail: { paneId: lt } })), st.current?.();
821
+ const S = k.current;
822
+ F(), S.pointerId = g.pointerId, S.startClientY = g.clientY, S.startScroll = w.current, S.isDragging = !1, S.shouldCancelNextClick = !1, S.velocitySamples = [];
823
+ }, Et = (g) => {
824
+ const S = k.current;
825
+ S.pointerId === g.pointerId && (S.shouldCancelNextClick = !1, I.hasPointerCapture(g.pointerId) && I.releasePointerCapture(g.pointerId), F(), tt());
826
+ }, zt = [
827
+ ["click", It, !0],
828
+ ["pointerdown", gt, { passive: !1 }],
829
+ ["pointermove", at, { passive: !1 }],
830
+ ["pointerup", ct, void 0],
831
+ ["pointercancel", Et, void 0]
832
832
  ], St = [
833
- ["pointermove", Ft, { passive: !1 }],
834
- ["pointerup", Pt, void 0],
835
- ["pointercancel", Rt, void 0]
833
+ ["pointermove", at, { passive: !1 }],
834
+ ["pointerup", ct, void 0],
835
+ ["pointercancel", Et, void 0]
836
836
  ];
837
- return le(T, Lt, "add"), le(window, St, "add"), () => {
838
- le(T, Lt, "remove"), le(window, St, "remove");
839
- const p = X.current;
840
- p.pointerId !== null && T.hasPointerCapture(p.pointerId) && T.releasePointerCapture(p.pointerId), st(), Q();
837
+ return le(I, zt, "add"), le(window, St, "add"), () => {
838
+ le(I, zt, "remove"), le(window, St, "remove");
839
+ const g = k.current;
840
+ g.pointerId !== null && I.hasPointerCapture(g.pointerId) && I.releasePointerCapture(g.pointerId), F(), tt();
841
841
  };
842
- }, [rt]), /* @__PURE__ */ te("div", { ref: V, className: Qt("relative flex", d), style: c, children: [
843
- /* @__PURE__ */ te(
842
+ }, [lt]), /* @__PURE__ */ Bt("div", { ref: $, className: Wt("relative flex", d), style: f, children: [
843
+ /* @__PURE__ */ Bt(
844
844
  "div",
845
845
  {
846
- ref: F,
847
- className: Qt("relative h-full flex-1 overflow-hidden"),
846
+ ref: z,
847
+ className: Wt("relative h-full flex-1 overflow-hidden"),
848
848
  style: {
849
849
  height: e,
850
- paddingTop: Ct.top,
851
- paddingBottom: Ct.bottom,
852
- ...m ? { touchAction: "none" } : {}
850
+ paddingTop: ft.top,
851
+ paddingBottom: ft.bottom,
852
+ ...h ? { touchAction: "none" } : {}
853
853
  },
854
- id: rt,
854
+ id: lt,
855
855
  children: [
856
- f,
857
- n(A.current)
856
+ p,
857
+ o(w.current)
858
858
  ]
859
859
  }
860
860
  ),
861
- O && /* @__PURE__ */ U(
861
+ q && /* @__PURE__ */ B(
862
862
  or,
863
863
  {
864
864
  contentSize: t,
865
865
  viewportSize: e,
866
- scrollPosition: A.current,
867
- onScroll: g,
866
+ scrollPosition: w.current,
867
+ onScroll: K,
868
868
  enableThumbDrag: s,
869
- enableTrackClick: a,
869
+ enableTrackClick: c,
870
870
  enableArrowButtons: u,
871
- scrollBarWidth: r,
872
- ariaControls: rt,
873
- tapScrollCircleOptions: P,
874
- itemCount: N,
875
- renderThumbOverlay: q,
876
- visibleStartIndex: It,
877
- visibleEndIndex: $
871
+ scrollBarWidth: n,
872
+ ariaControls: lt,
873
+ tapScrollCircleOptions: R,
874
+ itemCount: A,
875
+ renderThumbOverlay: U,
876
+ visibleStartIndex: dt,
877
+ visibleEndIndex: rt
878
878
  }
879
879
  ),
880
- k?.()
880
+ Q?.()
881
881
  ] });
882
882
  }
883
- ), ye = (n, t, e) => Math.min(Math.max(n, t), e), Tr = ({ dragState: n, normalizedDistance: t, sizeScale: e, size: r }) => {
884
- const s = Math.max(r / 2, 1), a = 1 + t * 0.65, u = Math.max(0.65, 1 - t * 0.25), m = n.direction * t * 26 * e, l = 0.8 + t * 0.18, d = 3 * e, c = 6 * e, f = 22 * e, P = Math.abs(m) + c, v = m > 0 ? d : -Math.abs(m) - d, N = Math.max(2.5, 3 * e), q = ye(n.offsetX, -s, s), L = ye(n.offsetY, -s, s), K = s * 0.35, It = q / s * K, $ = L / s * K, k = It * 0.45, z = $ * 0.45, A = Math.max(f * 0.38, 6), V = 0.65 + t * 0.2, F = n.active;
885
- return /* @__PURE__ */ te(Re, { children: [
886
- /* @__PURE__ */ U(
883
+ ), ye = (o, t, e) => Math.min(Math.max(o, t), e), Sr = ({ dragState: o, normalizedDistance: t, sizeScale: e, size: n }) => {
884
+ const s = Math.max(n / 2, 1), c = 1 + t * 0.65, u = Math.max(0.65, 1 - t * 0.25), h = o.direction * t * 26 * e, l = 0.8 + t * 0.18, d = 3 * e, f = 6 * e, p = 22 * e, R = Math.abs(h) + f, b = h > 0 ? d : -Math.abs(h) - d, A = Math.max(2.5, 3 * e), U = ye(o.offsetX, -s, s), Y = ye(o.offsetY, -s, s), G = s * 0.35, dt = U / s * G, rt = Y / s * G, Q = dt * 0.45, N = rt * 0.45, w = Math.max(p * 0.38, 6), $ = 0.65 + t * 0.2, z = o.active;
885
+ return /* @__PURE__ */ Bt(Ce, { children: [
886
+ /* @__PURE__ */ B(
887
887
  "div",
888
888
  {
889
889
  className: "aqvs:tap-scroll-circle-gradient absolute inset-0 rounded-full border border-white/40 shadow-md",
890
890
  style: {
891
- transform: `scale(${u}, ${a})`,
892
- transition: F ? "40ms transform ease-out" : "200ms ease transform"
891
+ transform: `scale(${u}, ${c})`,
892
+ transition: z ? "40ms transform ease-out" : "200ms ease transform"
893
893
  }
894
894
  }
895
895
  ),
896
- /* @__PURE__ */ U(
896
+ /* @__PURE__ */ B(
897
897
  "div",
898
898
  {
899
899
  className: "absolute top-1/2 left-1/2 rounded-full border border-white/50 bg-white/85",
900
900
  style: {
901
- width: f,
902
- height: f,
903
- transform: `translate(calc(-50% + ${It}px), calc(-50% + ${$}px)) scale(${u}, ${l * a})`,
904
- transition: F ? "70ms transform ease-out" : "200ms ease transform"
901
+ width: p,
902
+ height: p,
903
+ transform: `translate(calc(-50% + ${dt}px), calc(-50% + ${rt}px)) scale(${u}, ${l * c})`,
904
+ transition: z ? "70ms transform ease-out" : "200ms ease transform"
905
905
  }
906
906
  }
907
907
  ),
908
- /* @__PURE__ */ U(
908
+ /* @__PURE__ */ B(
909
909
  "div",
910
910
  {
911
911
  className: "absolute top-1/2 left-1/2 rounded-full bg-white/80",
912
912
  style: {
913
- width: A,
914
- height: A,
915
- transform: `translate(calc(-50% + ${k}px), calc(-50% + ${z}px)) scale(${u}, ${a})`,
916
- opacity: V,
913
+ width: w,
914
+ height: w,
915
+ transform: `translate(calc(-50% + ${Q}px), calc(-50% + ${N}px)) scale(${u}, ${c})`,
916
+ opacity: $,
917
917
  boxShadow: "0 0 8px rgba(255,255,255,0.45)",
918
- transition: F ? "120ms opacity 150ms, 120ms transform ease-out ease-out" : "220ms ease transform, 240ms opacity ease"
918
+ transition: z ? "120ms opacity 150ms, 120ms transform ease-out ease-out" : "220ms ease transform, 240ms opacity ease"
919
919
  }
920
920
  }
921
921
  ),
922
- /* @__PURE__ */ U(
922
+ /* @__PURE__ */ B(
923
923
  "div",
924
924
  {
925
925
  className: "absolute top-1/2 left-1/2 rounded-full bg-white/50",
926
926
  style: {
927
- width: N,
928
- height: P,
929
- transform: `translate(-50%, ${v}px)`,
927
+ width: A,
928
+ height: R,
929
+ transform: `translate(-50%, ${b}px)`,
930
930
  opacity: t,
931
- transition: F ? "40ms height, 60ms opacity ease-out ease-out" : "200ms ease height, 120ms ease opacity"
931
+ transition: z ? "40ms height, 60ms opacity ease-out ease-out" : "200ms ease height, 120ms ease opacity"
932
932
  }
933
933
  }
934
934
  )
935
935
  ] });
936
- }, ir = (n) => {
937
- if (!Number.isFinite(n))
936
+ }, ir = (o) => {
937
+ if (!Number.isFinite(o))
938
938
  return 0n;
939
- const t = Math.trunc(n);
939
+ const t = Math.trunc(o);
940
940
  return t <= 0 ? 0n : BigInt(t);
941
- }, ce = (n) => {
942
- if (n <= 0 || !Number.isFinite(n))
941
+ }, ce = (o) => {
942
+ if (o <= 0 || !Number.isFinite(o))
943
943
  return 0;
944
- const t = Math.trunc(n), e = BigInt(t) & -BigInt(t);
944
+ const t = Math.trunc(o), e = BigInt(t) & -BigInt(t);
945
945
  return Number(e);
946
946
  };
947
947
  class ar {
@@ -984,8 +984,8 @@ class ar {
984
984
  * @param {number | ((index: number) => number)} valueOrFn - The value for all elements, or a function to generate values.
985
985
  * @param {{ sampleRange?: { from: number; to: number }, materialize?: boolean }} [options] - Optional settings for initialization.
986
986
  */
987
- constructor(t, e, r) {
988
- this.reset(t, e, r);
987
+ constructor(t, e, n) {
988
+ this.reset(t, e, n);
989
989
  }
990
990
  /**
991
991
  * @method reset
@@ -995,20 +995,20 @@ class ar {
995
995
  * @param {number | ((index: number) => number)} valueOrFn - The value for all elements, or a function to generate values.
996
996
  * @param {{ sampleRange?: { from: number; to: number }, materialize?: boolean }} [options] - Optional settings for initialization.
997
997
  */
998
- reset(t, e, r) {
998
+ reset(t, e, n) {
999
999
  if (this.size = t, this.tree = /* @__PURE__ */ new Map(), this.deltas = /* @__PURE__ */ new Map(), this.total = void 0, typeof e == "function") {
1000
1000
  if (this.valueFn = e, this.size > 0) {
1001
- const a = r?.sampleRange ?? {
1001
+ const c = n?.sampleRange ?? {
1002
1002
  from: 0,
1003
1003
  to: Math.min(99, this.size - 1)
1004
- }, { mode: u, materializedValues: m } = this._calculateMode(a.from, a.to);
1005
- if (this.baseValue = u, r?.materialize)
1006
- for (let l = 0; l < m.length; l++) {
1007
- const d = m[l], c = a.from + l;
1008
- if (c >= this.size)
1004
+ }, { mode: u, materializedValues: h } = this._calculateMode(c.from, c.to);
1005
+ if (this.baseValue = u, n?.materialize)
1006
+ for (let l = 0; l < h.length; l++) {
1007
+ const d = h[l], f = c.from + l;
1008
+ if (f >= this.size)
1009
1009
  break;
1010
- const f = d - this.baseValue;
1011
- this.deltas.set(c, f), this._updateTree(c, f);
1010
+ const p = d - this.baseValue;
1011
+ this.deltas.set(f, p), this._updateTree(f, p);
1012
1012
  }
1013
1013
  } else
1014
1014
  this.baseValue = 0;
@@ -1021,8 +1021,13 @@ class ar {
1021
1021
  * @description Updates the value function and re-initializes the tree.
1022
1022
  * @description 値関数を更新し、ツリーを再初期化する。
1023
1023
  * @param {number | ((index: number) => number)} valueOrFn - The new value for all elements, or a function to generate values.
1024
+ * @param {{ reset?: boolean }} [options] - Optional settings. If reset is true, the tree is reset with the new value function.
1024
1025
  */
1025
- setValueFn(t) {
1026
+ setValueFn(t, e) {
1027
+ if (e?.reset) {
1028
+ this.reset(this.size, t);
1029
+ return;
1030
+ }
1026
1031
  typeof t == "function" ? this.valueFn = t : (this.valueFn = void 0, this.baseValue = t);
1027
1032
  }
1028
1033
  /**
@@ -1037,28 +1042,28 @@ class ar {
1037
1042
  _calculateMode(t, e) {
1038
1043
  if (!this.valueFn)
1039
1044
  return { mode: 0, materializedValues: [] };
1040
- const r = [];
1045
+ const n = [];
1041
1046
  for (let d = t; d <= e && !(d >= this.size); d++)
1042
- r.push(this.valueFn(d));
1043
- const s = [...r];
1044
- if (r.length === 0)
1047
+ n.push(this.valueFn(d));
1048
+ const s = [...n];
1049
+ if (n.length === 0)
1045
1050
  return { mode: 0, materializedValues: [] };
1046
- r.sort((d, c) => d - c);
1047
- const a = Math.floor(r.length / 2);
1051
+ n.sort((d, f) => d - f);
1052
+ const c = Math.floor(n.length / 2);
1048
1053
  let u;
1049
- r.length % 2 === 0 ? u = Math.floor((r[a - 1] + r[a]) / 2) : u = r[a];
1050
- const m = /* @__PURE__ */ new Map();
1054
+ n.length % 2 === 0 ? u = Math.floor((n[c - 1] + n[c]) / 2) : u = n[c];
1055
+ const h = /* @__PURE__ */ new Map();
1051
1056
  let l = 0;
1052
- for (const d of r) {
1053
- const c = (m.get(d) ?? 0) + 1;
1054
- m.set(d, c), c > l && (l = c);
1057
+ for (const d of n) {
1058
+ const f = (h.get(d) ?? 0) + 1;
1059
+ h.set(d, f), f > l && (l = f);
1055
1060
  }
1056
- if (l > r.length * 0.2) {
1061
+ if (l > n.length * 0.2) {
1057
1062
  const d = [];
1058
- for (const [f, P] of m.entries())
1059
- P === l && d.push(f);
1060
- const c = d.reduce((f, P) => f + P, 0);
1061
- u = Math.floor(c / d.length);
1063
+ for (const [p, R] of h.entries())
1064
+ R === l && d.push(p);
1065
+ const f = d.reduce((p, R) => p + R, 0);
1066
+ u = Math.floor(f / d.length);
1062
1067
  }
1063
1068
  return { mode: u, materializedValues: s };
1064
1069
  }
@@ -1099,11 +1104,11 @@ class ar {
1099
1104
  * @param {DeltaUpdate[]} updates - An array of updates, each with an index and the change to apply.
1100
1105
  */
1101
1106
  updateDeltas(t) {
1102
- for (const { index: e, change: r } of t) {
1107
+ for (const { index: e, change: n } of t) {
1103
1108
  if (e < 0 || e >= this.size)
1104
1109
  throw new Error(`Index ${e} out of bounds`);
1105
1110
  const s = this.deltas.get(e) ?? 0;
1106
- this.deltas.set(e, s + r), this._updateTree(e, r);
1111
+ this.deltas.set(e, s + n), this._updateTree(e, n);
1107
1112
  }
1108
1113
  return this.total;
1109
1114
  }
@@ -1118,13 +1123,13 @@ class ar {
1118
1123
  _updateTree(t, e) {
1119
1124
  if (e === 0)
1120
1125
  return;
1121
- let r = t + 1;
1122
- for (; r <= this.size; ) {
1123
- this.tree.set(r, (this.tree.get(r) ?? 0) + e);
1124
- const s = ce(r);
1126
+ let n = t + 1;
1127
+ for (; n <= this.size; ) {
1128
+ this.tree.set(n, (this.tree.get(n) ?? 0) + e);
1129
+ const s = ce(n);
1125
1130
  if (s === 0)
1126
1131
  break;
1127
- r += s;
1132
+ n += s;
1128
1133
  }
1129
1134
  this.total !== void 0 && (this.total += e);
1130
1135
  }
@@ -1138,13 +1143,13 @@ class ar {
1138
1143
  */
1139
1144
  _buildDeltaUpdates(t) {
1140
1145
  const e = [];
1141
- for (const { index: r, value: s } of t) {
1142
- if (r < 0 || r >= this.size)
1143
- throw new Error(`Index ${r} out of bounds`);
1146
+ for (const { index: n, value: s } of t) {
1147
+ if (n < 0 || n >= this.size)
1148
+ throw new Error(`Index ${n} out of bounds`);
1144
1149
  if (s < 0)
1145
1150
  throw new Error("Value cannot be negative.");
1146
- const a = this.deltas.has(r) ? (this.deltas.get(r) ?? 0) + this.baseValue : this.baseValue, u = s - a;
1147
- u !== 0 && e.push({ index: r, change: u });
1151
+ const c = this.deltas.has(n) ? (this.deltas.get(n) ?? 0) + this.baseValue : this.baseValue, u = s - c;
1152
+ u !== 0 && e.push({ index: n, change: u });
1148
1153
  }
1149
1154
  return e;
1150
1155
  }
@@ -1161,10 +1166,10 @@ class ar {
1161
1166
  let t = 0, e = this.size;
1162
1167
  for (; e > 0; ) {
1163
1168
  t += this.tree.get(e) ?? 0;
1164
- const r = ce(e);
1165
- if (r === 0)
1169
+ const n = ce(e);
1170
+ if (n === 0)
1166
1171
  break;
1167
- e -= r;
1172
+ e -= n;
1168
1173
  }
1169
1174
  return t + this.baseValue * this.size;
1170
1175
  }
@@ -1178,9 +1183,9 @@ class ar {
1178
1183
  */
1179
1184
  _materialize(t, e = !0) {
1180
1185
  if (this.valueFn) {
1181
- const r = this.deltas.get(t) ?? 0, a = this.valueFn(t) - this.baseValue;
1182
- if (a !== r && (this.deltas.set(t, a), e)) {
1183
- const u = a - r;
1186
+ const n = this.deltas.get(t) ?? 0, c = this.valueFn(t) - this.baseValue;
1187
+ if (c !== n && (this.deltas.set(t, c), e)) {
1188
+ const u = c - n;
1184
1189
  this._updateTree(t, u);
1185
1190
  }
1186
1191
  }
@@ -1194,24 +1199,24 @@ class ar {
1194
1199
  * @param {number | undefined} index - Target index for materialization.
1195
1200
  * @param {boolean} [forceIndex=false] - When true, materializes the index even if it is outside the provided ranges.
1196
1201
  */
1197
- _materializeRanges(t, e, r = !1) {
1202
+ _materializeRanges(t, e, n = !1) {
1198
1203
  if (!(t?.materialize && this.valueFn))
1199
1204
  return;
1200
1205
  const s = t.ranges;
1201
1206
  if (s && s.length > 0) {
1202
- for (const m of s) {
1203
- const l = m.from, d = Math.min(m.to, this.size - 1);
1204
- for (let c = l; c <= d; c++)
1205
- this._materialize(c);
1207
+ for (const h of s) {
1208
+ const l = h.from, d = Math.min(h.to, this.size - 1);
1209
+ for (let f = l; f <= d; f++)
1210
+ this._materialize(f);
1206
1211
  }
1207
1212
  if (e === void 0)
1208
1213
  return;
1209
- if (r) {
1214
+ if (n) {
1210
1215
  this._materialize(e);
1211
1216
  return;
1212
1217
  }
1213
- const a = s[0].from, u = s[s.length - 1].to;
1214
- e >= a && e <= u && this._materialize(e);
1218
+ const c = s[0].from, u = s[s.length - 1].to;
1219
+ e >= c && e <= u && this._materialize(e);
1215
1220
  return;
1216
1221
  }
1217
1222
  e !== void 0 && this._materialize(e);
@@ -1226,55 +1231,69 @@ class ar {
1226
1231
  * @param {boolean} chooseLowerBound - When true, finds the smallest index meeting or exceeding the target; otherwise finds the largest index not exceeding it.
1227
1232
  * @returns {{ index: number; total: number | undefined; cumulative: number | undefined; currentValue: number | undefined; safeIndex: number | undefined }} Binary search result.
1228
1233
  */
1229
- _findIndex(t, e = {}, r) {
1234
+ _findIndex(t, e = {}, n) {
1230
1235
  if (this.size >= Number.MAX_SAFE_INTEGER)
1231
- return this._findIndexLarge(t, e, r);
1236
+ return this._findIndexLarge(t, e, n);
1232
1237
  if (this.size === 0)
1233
1238
  return { index: -1, total: this.total ?? 0, cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
1234
- let s = 0, a = this.size - 1, u = -1, m, l, d = this.total;
1235
- for (; s <= a; ) {
1236
- const f = Math.floor((s + a) / 2);
1237
- m = this.prefixSum(f, e), d = m.total, (r ? m.cumulative >= t : m.cumulative <= t) ? (u = f, l = m, r ? a = f - 1 : s = f + 1) : r ? s = f + 1 : a = f - 1;
1239
+ let s = 0, c = 0, u = 1;
1240
+ for (; u << 1 <= this.size; )
1241
+ u <<= 1;
1242
+ for (; u > 0; u >>= 1) {
1243
+ const d = s + u;
1244
+ if (d <= this.size) {
1245
+ const p = (this.tree.get(d) ?? 0) + this.baseValue * u;
1246
+ (n ? c + p < t : c + p <= t) && (s = d, c += p);
1247
+ }
1238
1248
  }
1239
- const c = l ?? m;
1240
- return { index: u, total: d, cumulative: c?.cumulative, currentValue: c?.currentValue, safeIndex: c?.safeIndex };
1249
+ const h = n ? s : s - 1;
1250
+ if (h < 0 || h >= this.size)
1251
+ return { index: -1, total: this.total ?? this.getTotal(), cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
1252
+ const l = this.prefixSum(h, e);
1253
+ return {
1254
+ index: h,
1255
+ total: this.total ?? l.total,
1256
+ cumulative: l.cumulative,
1257
+ currentValue: l.currentValue,
1258
+ safeIndex: l.safeIndex
1259
+ };
1241
1260
  }
1242
1261
  /**
1243
1262
  * Executes a binary search using bigint arithmetic for extremely large sizes.
1244
1263
  *
1245
1264
  * 非常に大きなサイズに対して bigint 演算を用いた二分探索を実施。
1246
1265
  */
1247
- _findIndexLarge(t, e, r) {
1266
+ _findIndexLarge(t, e, n) {
1248
1267
  if (this.size === 0)
1249
1268
  return { index: -1, total: this.total ?? 0, cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
1250
1269
  const s = ir(this.size);
1251
1270
  if (s === 0n)
1252
1271
  return { index: -1, total: this.total ?? 0, cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
1253
- let a = 0n, u = s - 1n, m, l, d, c = this.total;
1254
- for (; a <= u; ) {
1255
- const v = a + u >> 1n, N = Number(v), q = this.prefixSum(N, e);
1256
- if (d = q, c = q.total, r ? q.cumulative >= t : q.cumulative <= t)
1257
- if (m = v, l = q, r) {
1258
- if (v === 0n)
1272
+ let c = 0n, u = s - 1n, h, l, d, f = this.total;
1273
+ for (; c <= u; ) {
1274
+ const b = c + u >> 1n, A = Number(b), U = this.prefixSum(A, e);
1275
+ if (d = U, f = U.total, n ? U.cumulative >= t : U.cumulative <= t)
1276
+ if (h = b, l = U, n) {
1277
+ if (b === 0n)
1259
1278
  break;
1260
- u = v - 1n;
1279
+ u = b - 1n;
1261
1280
  } else
1262
- a = v + 1n;
1263
- else if (r)
1264
- a = v + 1n;
1281
+ c = b + 1n;
1282
+ else if (n)
1283
+ c = b + 1n;
1265
1284
  else {
1266
- if (v === 0n)
1285
+ if (b === 0n)
1267
1286
  break;
1268
- u = v - 1n;
1287
+ u = b - 1n;
1269
1288
  }
1270
1289
  }
1271
- const f = l ?? d;
1290
+ const p = l ?? d;
1272
1291
  return {
1273
- index: m !== void 0 ? Number(m) : -1,
1274
- total: c,
1275
- cumulative: f?.cumulative,
1276
- currentValue: f?.currentValue,
1277
- safeIndex: f?.safeIndex
1292
+ index: h !== void 0 ? Number(h) : -1,
1293
+ total: f,
1294
+ cumulative: p?.cumulative,
1295
+ currentValue: p?.currentValue,
1296
+ safeIndex: p?.safeIndex
1278
1297
  };
1279
1298
  }
1280
1299
  /**
@@ -1288,19 +1307,19 @@ class ar {
1288
1307
  prefixSum(t, e) {
1289
1308
  if (t < 0)
1290
1309
  return { cumulative: 0, total: this.total, currentValue: 0, safeIndex: 0 };
1291
- const r = xt(t, 0, this.size - 1), s = e?.materializeOption;
1292
- this._materializeRanges(s, r, !0);
1293
- let a = 0, u = r + 1;
1310
+ const n = ht(t, 0, this.size - 1), s = e?.materializeOption;
1311
+ this._materializeRanges(s, n, !0);
1312
+ let c = 0, u = n + 1;
1294
1313
  for (; u > 0; ) {
1295
1314
  const l = this.tree.get(u) ?? 0;
1296
- a += l;
1315
+ c += l;
1297
1316
  const d = ce(u);
1298
1317
  if (d === 0)
1299
1318
  break;
1300
1319
  u -= d;
1301
1320
  }
1302
- const m = s?.materialize ? this.get(r) : (this.deltas.get(r) || 0) + this.baseValue;
1303
- return { cumulative: a + this.baseValue * (r + 1), total: this.total, currentValue: m, safeIndex: r };
1321
+ const h = s?.materialize ? this.get(n) : (this.deltas.get(n) || 0) + this.baseValue;
1322
+ return { cumulative: c + this.baseValue * (n + 1), total: this.total, currentValue: h, safeIndex: n };
1304
1323
  }
1305
1324
  /**
1306
1325
  * @method get
@@ -1313,8 +1332,8 @@ class ar {
1313
1332
  get(t, e) {
1314
1333
  if (t < 0 || t >= this.size)
1315
1334
  throw new Error("Index out of bounds");
1316
- const r = e?.materializeOption;
1317
- return this._materializeRanges(r, t), (this.deltas.get(t) ?? 0) + this.baseValue;
1335
+ const n = e?.materializeOption;
1336
+ return this._materializeRanges(n, t), (this.deltas.get(t) ?? 0) + this.baseValue;
1318
1337
  }
1319
1338
  /**
1320
1339
  * @method getTotal
@@ -1330,8 +1349,8 @@ class ar {
1330
1349
  this.total = 0;
1331
1350
  else {
1332
1351
  this.total = this._computeTreeTotal();
1333
- const r = this.prefixSum(this.getSize() - 1);
1334
- console.assert(r.cumulative === r.total, "Inconsistent Fenwick Tree state");
1352
+ const n = this.prefixSum(this.getSize() - 1);
1353
+ console.assert(n.cumulative === n.total, "Inconsistent Fenwick Tree state");
1335
1354
  }
1336
1355
  return this.total;
1337
1356
  }
@@ -1344,21 +1363,21 @@ class ar {
1344
1363
  */
1345
1364
  rebuildTree(t) {
1346
1365
  if (t?.materialize && this.valueFn) {
1347
- const r = this.valueFn;
1348
- this.reset(this.size, (s) => r(s), { materialize: !0 });
1366
+ const n = this.valueFn;
1367
+ this.reset(this.size, (s) => n(s), { materialize: !0 });
1349
1368
  return;
1350
1369
  }
1351
1370
  const e = /* @__PURE__ */ new Map();
1352
- for (const [r, s] of this.deltas.entries()) {
1371
+ for (const [n, s] of this.deltas.entries()) {
1353
1372
  if (s === 0)
1354
1373
  continue;
1355
- let a = r + 1;
1356
- for (; a <= this.size; ) {
1357
- e.set(a, (e.get(a) ?? 0) + s);
1358
- const u = ce(a);
1374
+ let c = n + 1;
1375
+ for (; c <= this.size; ) {
1376
+ e.set(c, (e.get(c) ?? 0) + s);
1377
+ const u = ce(c);
1359
1378
  if (u === 0)
1360
1379
  break;
1361
- a += u;
1380
+ c += u;
1362
1381
  }
1363
1382
  }
1364
1383
  this.tree = e, this.total = this._computeTreeTotal();
@@ -1391,8 +1410,8 @@ class ar {
1391
1410
  for (const s of this.deltas.keys())
1392
1411
  s >= t && this.deltas.delete(s);
1393
1412
  this.size = t, this.rebuildTree();
1394
- const r = this.prefixSum(this.getSize() - 1);
1395
- console.assert(r.cumulative === r.total, "Inconsistent Fenwick Tree state");
1413
+ const n = this.prefixSum(this.getSize() - 1);
1414
+ console.assert(n.cumulative === n.total, "Inconsistent Fenwick Tree state");
1396
1415
  }
1397
1416
  /**
1398
1417
  * @method getSize
@@ -1432,9 +1451,9 @@ class ar {
1432
1451
  return this._findIndex(t, e ?? {}, !1);
1433
1452
  }
1434
1453
  }
1435
- const lr = (n, t, e) => {
1436
- const r = Math.max(0, n), s = M(null), a = kt(() => new ar(r, t, e), [r, t, e]);
1437
- return Object.is(s.current, a) || console.warn("[useFenwickMapTree] instance changed"), s.current = a, a;
1454
+ const lr = (o, t, e) => {
1455
+ const n = Math.max(0, o), s = P(null), c = yt(() => new ar(n, t, e), [n, t, e]);
1456
+ return Object.is(s.current, c) || console.warn("[useFenwickMapTree] instance changed"), s.current = c, c;
1438
1457
  };
1439
1458
  class cr {
1440
1459
  key;
@@ -1486,137 +1505,139 @@ class Me {
1486
1505
  this.remove(t), this.addToTail(t);
1487
1506
  }
1488
1507
  }
1489
- function ur(n) {
1490
- const t = M(/* @__PURE__ */ new Map()), e = M(new Me());
1491
- Y(() => {
1492
- for (; t.current.size > n; ) {
1493
- const c = e.current.removeHead();
1494
- if (c)
1495
- t.current.delete(c.key);
1508
+ function ur(o) {
1509
+ const t = P(/* @__PURE__ */ new Map()), e = P(new Me());
1510
+ X(() => {
1511
+ for (; t.current.size > o; ) {
1512
+ const f = e.current.removeHead();
1513
+ if (f)
1514
+ t.current.delete(f.key);
1496
1515
  else
1497
1516
  break;
1498
1517
  }
1499
- }, [n]);
1500
- const r = C((c) => {
1501
- const f = t.current.get(c);
1502
- if (f)
1503
- return e.current.moveToTail(f), f.value;
1504
- }, []), s = C(
1505
- (c, f) => {
1506
- if (n <= 0)
1518
+ }, [o]);
1519
+ const n = T((f) => {
1520
+ const p = t.current.get(f);
1521
+ if (p)
1522
+ return e.current.moveToTail(p), p.value;
1523
+ }, []), s = T(
1524
+ (f, p) => {
1525
+ if (o <= 0)
1507
1526
  return;
1508
- let P = t.current.get(c);
1509
- if (P)
1510
- P.value = f, e.current.moveToTail(P);
1527
+ let R = t.current.get(f);
1528
+ if (R)
1529
+ R.value = p, e.current.moveToTail(R);
1511
1530
  else {
1512
- if (t.current.size >= n) {
1513
- const v = e.current.removeHead();
1514
- v && t.current.delete(v.key);
1531
+ if (t.current.size >= o) {
1532
+ const b = e.current.removeHead();
1533
+ b && t.current.delete(b.key);
1515
1534
  }
1516
- P = new cr(c, f), t.current.set(c, P), e.current.addToTail(P);
1535
+ R = new cr(f, p), t.current.set(f, R), e.current.addToTail(R);
1517
1536
  }
1518
1537
  },
1519
- [n]
1520
- ), a = C((c) => t.current.has(c), []), u = C((c) => {
1521
- const f = t.current.get(c);
1522
- f && (e.current.remove(f), t.current.delete(c));
1523
- }, []), m = C(() => {
1538
+ [o]
1539
+ ), c = T((f) => t.current.has(f), []), u = T((f) => {
1540
+ const p = t.current.get(f);
1541
+ p && (e.current.remove(p), t.current.delete(f));
1542
+ }, []), h = T(() => {
1524
1543
  t.current.clear(), e.current = new Me();
1525
- }, []), [l, d] = Nt(() => ({ get: r, set: s, has: a, remove: u, clear: m }));
1526
- return Y(() => d({ get: r, set: s, has: a, remove: u, clear: m }), [r, s, a, u, m]), l;
1544
+ }, []), [l, d] = Vt(() => ({ get: n, set: s, has: c, remove: u, clear: h }));
1545
+ return X(() => d({ get: n, set: s, has: c, remove: u, clear: h }), [n, s, c, u, h]), l;
1527
1546
  }
1528
- const dr = 1e4, vr = () => {
1529
- const { get: n, set: t, has: e, clear: r } = ur(dr);
1530
- return { get: n, set: t, has: e, clear: r };
1531
- }, ct = (n, t) => t <= 0 ? 0 : xt(n, 0, t - 1), fr = (n) => ({
1532
- top: Math.max(0, n?.top ?? 0),
1533
- bottom: Math.max(0, n?.bottom ?? 0)
1534
- }), jt = (n, t) => n <= t ? 0 : n - t, ne = (n, t) => n <= 0 ? t : n + t, we = (n) => {
1535
- if (!Number.isFinite(n))
1547
+ const dr = 1e4, Pr = () => {
1548
+ const { get: o, set: t, has: e, clear: n } = ur(dr);
1549
+ return { get: o, set: t, has: e, clear: n };
1550
+ }, ot = (o, t) => t <= 0 ? 0 : ht(o, 0, t - 1), fr = (o) => ({
1551
+ top: Math.max(0, o?.top ?? 0),
1552
+ bottom: Math.max(0, o?.bottom ?? 0)
1553
+ }), qt = (o, t) => o <= t ? 0 : o - t, te = (o, t) => o <= 0 ? t : o + t, ge = (o) => {
1554
+ if (!Number.isFinite(o))
1536
1555
  return 0n;
1537
- const t = Math.trunc(n);
1556
+ const t = Math.trunc(o);
1538
1557
  return t <= 0 ? 0n : BigInt(t);
1539
- }, pr = (n, t, e, r, s, a, u, m) => {
1540
- const l = we(r);
1558
+ }, pr = (o, t, e, n, s, c, u, h) => {
1559
+ const l = ge(n);
1541
1560
  if (l === 0n)
1542
1561
  return { renderingStartIndex: 0, renderingEndIndex: 0, visibleStartIndex: 0, visibleEndIndex: 0 };
1543
- const d = (k) => k < 0n ? 0n : k >= l ? l - 1n : k, c = { materializeOption: { materialize: !1 } }, { index: f } = a.findIndexAtOrAfter(n, c);
1544
- let P;
1545
- f === -1 ? P = l - 1n : (P = we(f), P >= l && (P = l - 1n)), n <= 0 && (P = 0n), m && n >= u && (P = l - 1n);
1546
- const v = (k) => {
1547
- let z = 0, A = k, V = k, F = 0n;
1548
- for (; A < l && z < t; ) {
1549
- const at = Number(A), G = s(at);
1550
- if (z += G, V = A, A += 1n, F += 1n, !Number.isFinite(G) || G <= 0)
1562
+ const d = (N) => N < 0n ? 0n : N >= l ? l - 1n : N, f = { materializeOption: { materialize: !1 } }, { index: p, cumulative: R } = c.findIndexAtOrAfter(o, f);
1563
+ let b;
1564
+ p === -1 ? b = l - 1n : (R === o ? b = ge(p + 1) : b = ge(p), b >= l && (b = l - 1n)), o <= 0 && (b = 0n), h && o >= u && (b = l - 1n);
1565
+ const A = (N) => {
1566
+ let w = 0, $ = N, z = N, Z = 0n;
1567
+ for (; $ < l && w < t; ) {
1568
+ const _ = Number($), ft = s(_);
1569
+ if (w += ft, z = $, $ += 1n, Z += 1n, !Number.isFinite(ft) || ft <= 0)
1551
1570
  break;
1552
1571
  }
1553
- return F === 0n && (V = k), { height: z, end: V };
1572
+ return Z === 0n && (z = N), { height: w, end: z };
1554
1573
  };
1555
- let { height: N, end: q } = v(P);
1556
- if (N < t && P > 0n) {
1557
- let k = P, z = N;
1558
- for (; k > 0n && z < t; ) {
1559
- k -= 1n;
1560
- const V = Number(k), F = s(V);
1561
- if (z += F, !Number.isFinite(F) || F <= 0)
1574
+ let { height: U, end: Y } = A(b);
1575
+ if (U < t && b > 0n) {
1576
+ let N = b, w = U;
1577
+ for (; N > 0n && w < t; ) {
1578
+ N -= 1n;
1579
+ const z = Number(N), Z = s(z);
1580
+ if (w += Z, !Number.isFinite(Z) || Z <= 0)
1562
1581
  break;
1563
1582
  }
1564
- P = d(k);
1565
- const A = v(P);
1566
- N = A.height, q = A.end;
1583
+ b = d(N);
1584
+ const $ = A(b);
1585
+ U = $.height, Y = $.end;
1567
1586
  }
1568
- const L = d(P), K = d(q), It = d(L - BigInt(Math.max(0, e))), $ = d(K + BigInt(Math.max(0, e)));
1587
+ const G = d(b), dt = d(Y), rt = d(G - BigInt(Math.max(0, e))), Q = d(dt + BigInt(Math.max(0, e)));
1569
1588
  return {
1570
- renderingStartIndex: ct(Number(It), r),
1571
- renderingEndIndex: ct(Number($), r),
1572
- visibleStartIndex: ct(Number(L), r),
1573
- visibleEndIndex: ct(Number(K), r)
1589
+ renderingStartIndex: ot(Number(rt), n),
1590
+ renderingEndIndex: ot(Number(Q), n),
1591
+ visibleStartIndex: ot(Number(G), n),
1592
+ visibleEndIndex: ot(Number(dt), n)
1574
1593
  };
1575
- }, mr = (n, t, e, r, s, a, u) => {
1576
- if (r === 0)
1594
+ }, mr = (o, t, e, n, s, c, u) => {
1595
+ if (n === 0)
1577
1596
  return { renderingStartIndex: 0, renderingEndIndex: 0, visibleStartIndex: 0, visibleEndIndex: 0 };
1578
- const m = Number.isFinite(u), l = m ? Math.min(Math.max(0, n), u) : Math.max(0, n);
1579
- if (r >= Number.MAX_SAFE_INTEGER)
1580
- return pr(l, t, e, r, s, a, u, m);
1581
- const { index: d, cumulative: c, currentValue: f } = a.findIndexAtOrAfter(l, { materializeOption: { materialize: !1 } }), P = d === -1 ? t <= 0 || (c ?? 0) < l + (f ?? 0) ? r - 1 : 0 : d;
1582
- let v = ct(P, r), N = 0;
1583
- if (v === d && c !== void 0 && f !== void 0)
1584
- N = c - f - l;
1597
+ const h = Number.isFinite(u), l = h ? Math.min(Math.max(0, o), u) : Math.max(0, o);
1598
+ if (n >= Number.MAX_SAFE_INTEGER)
1599
+ return pr(l, t, e, n, s, c, u, h);
1600
+ const { index: d, cumulative: f, currentValue: p } = c.findIndexAtOrAfter(l, { materializeOption: { materialize: !1 } }), R = d === -1 ? t <= 0 || (f ?? 0) < l + (p ?? 0) ? n - 1 : 0 : d;
1601
+ let b = ot(R, n), A = 0;
1602
+ if (d !== -1 && f === l)
1603
+ b = ot(d + 1, n), A = 0;
1604
+ else if (b === d && f !== void 0 && p !== void 0)
1605
+ A = f - p - l;
1585
1606
  else {
1586
- const { cumulative: k, currentValue: z } = a.prefixSum(v, { materializeOption: { materialize: !1 } });
1587
- N = (k ?? 0) - (z ?? 0) - l;
1607
+ const { cumulative: Q, currentValue: N } = c.prefixSum(b, { materializeOption: { materialize: !1 } });
1608
+ A = (Q ?? 0) - (N ?? 0) - l;
1588
1609
  }
1589
- const q = N;
1590
- let L = v;
1591
- for (; L < r && N < t; )
1592
- N += s(L), L++;
1593
- if (N < t && v > 0) {
1594
- let k = N + Math.abs(Math.min(0, q)), z = v - 1;
1595
- for (; z >= 0 && k < t; )
1596
- k += s(z), z--;
1597
- for (v = ct(z + 1, r), N = 0, L = v; L < r && N < t; )
1598
- N += s(L), L++;
1610
+ const U = A;
1611
+ let Y = b;
1612
+ for (; Y < n && A < t; )
1613
+ A += s(Y), Y++;
1614
+ if (A < t && b > 0) {
1615
+ let Q = A + Math.abs(Math.min(0, U)), N = b - 1;
1616
+ for (; N >= 0 && Q < t; )
1617
+ Q += s(N), N--;
1618
+ for (b = ot(N + 1, n), A = 0, Y = b; Y < n && A < t; )
1619
+ A += s(Y), Y++;
1599
1620
  }
1600
- const K = ct(v - e, r), It = ct(Math.max(L - 1, v), r), $ = ct(It + e, r);
1601
- return { renderingStartIndex: K, renderingEndIndex: $, visibleStartIndex: v, visibleEndIndex: It };
1602
- }, hr = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(), Ce = (n, t, e) => {
1603
- const r = Math.max(0, t ?? 0), s = M({
1621
+ const G = ot(b - e, n), dt = ot(Math.max(Y - 1, b), n), rt = ot(dt + e, n);
1622
+ return { renderingStartIndex: G, renderingEndIndex: rt, visibleStartIndex: b, visibleEndIndex: dt };
1623
+ }, hr = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(), we = (o, t, e) => {
1624
+ const n = Math.max(0, t ?? 0), s = P({
1604
1625
  lastInvokeAt: 0,
1605
1626
  rafId: null,
1606
1627
  pendingPayload: null,
1607
1628
  loopActive: !1,
1608
- normalizedThrottle: r
1609
- }), a = C(() => {
1629
+ normalizedThrottle: n
1630
+ }), c = T(() => {
1610
1631
  const l = s.current;
1611
1632
  l.rafId !== null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(l.rafId), l.rafId = null, l.loopActive = !1;
1612
- }, []), u = C(
1633
+ }, []), u = T(
1613
1634
  (l) => {
1614
1635
  const d = s.current;
1615
1636
  d.rafId = null;
1616
- const c = typeof l == "number" ? l : hr(), f = d.normalizedThrottle, P = d.pendingPayload, v = n.current;
1617
- if (P !== null && v) {
1618
- const N = c - d.lastInvokeAt;
1619
- (f === 0 || d.lastInvokeAt === 0 || N >= f) && (d.pendingPayload = null, d.lastInvokeAt = c, e(v, P));
1637
+ const f = typeof l == "number" ? l : hr(), p = d.normalizedThrottle, R = d.pendingPayload, b = o.current;
1638
+ if (R !== null && b) {
1639
+ const A = f - d.lastInvokeAt;
1640
+ (p === 0 || d.lastInvokeAt === 0 || A >= p) && (d.pendingPayload = null, d.lastInvokeAt = f, e(b, R));
1620
1641
  }
1621
1642
  if (d.pendingPayload !== null) {
1622
1643
  typeof requestAnimationFrame == "function" ? d.rafId = requestAnimationFrame(u) : d.loopActive = !1;
@@ -1624,8 +1645,8 @@ const dr = 1e4, vr = () => {
1624
1645
  }
1625
1646
  d.loopActive = !1;
1626
1647
  },
1627
- [n, e]
1628
- ), m = C(() => {
1648
+ [o, e]
1649
+ ), h = T(() => {
1629
1650
  const l = s.current;
1630
1651
  if (!l.loopActive) {
1631
1652
  if (l.loopActive = !0, typeof requestAnimationFrame == "function") {
@@ -1635,465 +1656,456 @@ const dr = 1e4, vr = () => {
1635
1656
  l.loopActive = !1;
1636
1657
  }
1637
1658
  }, [u]);
1638
- return Y(() => () => {
1639
- a(), s.current.pendingPayload = null;
1640
- }, [a]), Y(() => {
1641
- a();
1659
+ return X(() => () => {
1660
+ c(), s.current.pendingPayload = null;
1661
+ }, [c]), X(() => {
1662
+ c();
1642
1663
  const l = s.current;
1643
- l.lastInvokeAt = 0, l.pendingPayload = null, l.normalizedThrottle = r;
1644
- }, [r, a]), C(
1664
+ l.lastInvokeAt = 0, l.pendingPayload = null, l.normalizedThrottle = n;
1665
+ }, [n, c]), T(
1645
1666
  (l) => {
1646
1667
  const d = s.current;
1647
- d.pendingPayload = l, m();
1668
+ d.pendingPayload = l, h();
1648
1669
  },
1649
- [m]
1670
+ [h]
1671
+ );
1672
+ }, gr = ze.memo(({ index: o, top: t, height: e, item: n, children: s, clipItemHeight: c, enableKeyboardNavigation: u, onKeyDown: h, onFocus: l, registerItemRef: d }) => {
1673
+ const f = T((A) => d(o, A), [o, d]), p = T((A) => h(A, o), [o, h]), R = T(() => l(o), [o, l]), b = T((A) => {
1674
+ A.currentTarget.focus({ preventScroll: !0 });
1675
+ }, []);
1676
+ return /* @__PURE__ */ B(
1677
+ "div",
1678
+ {
1679
+ ref: f,
1680
+ "data-index": o,
1681
+ "data-virtualscroll-item": "true",
1682
+ className: "aqvs:item-container",
1683
+ style: {
1684
+ top: t,
1685
+ height: e,
1686
+ overflow: c ? "hidden" : void 0
1687
+ },
1688
+ tabIndex: u ? -1 : void 0,
1689
+ onPointerDown: u ? b : void 0,
1690
+ onKeyDownCapture: u ? p : void 0,
1691
+ onFocusCapture: u ? R : void 0,
1692
+ children: s(n, o)
1693
+ }
1650
1694
  );
1651
- }, gr = ({
1652
- itemCount: n,
1695
+ }), br = ({
1696
+ itemCount: o,
1653
1697
  getItem: t,
1654
1698
  getItemHeight: e,
1655
- viewportSize: r,
1699
+ viewportSize: n,
1656
1700
  overscanCount: s = 15,
1657
- className: a,
1701
+ className: c,
1658
1702
  onScroll: u,
1659
- onRangeChange: m,
1703
+ onRangeChange: h,
1660
1704
  children: l,
1661
1705
  background: d,
1662
- initialScrollIndex: c,
1663
- initialScrollOffset: f,
1664
- tapScrollCircleOptions: P,
1665
- scrollBarWidth: v,
1666
- enableThumbDrag: N,
1667
- enableTrackClick: q,
1668
- enableArrowButtons: L,
1669
- enablePointerDrag: K,
1670
- inertiaOptions: It,
1671
- callbackThrottleMs: $ = 5,
1672
- renderThumbOverlay: k,
1673
- wheelSpeedMultiplier: z,
1674
- contentInsets: A,
1675
- enableKeyboardNavigation: V = !0,
1676
- onItemFocus: F,
1677
- clipItemHeight: at = !1,
1678
- enableScrollToTopBottomButtons: G
1679
- }, Ct) => {
1680
- const I = M(null), O = M(!1), g = kt(() => fr(A), [A]), et = M({ size: n, valueOrFn: e, options: { sampleRange: { from: 0, to: 100 } } }), w = lr(et.current.size, et.current.valueOrFn, et.current.options), [ut] = Nt(() => {
1681
- let i = g.top, x = 0;
1682
- if (typeof c == "number") {
1683
- const b = xt(c, 0, n - 1), _ = xt(b - s * 2, 0, n - 1), j = xt(b + s * 2, 0, n - 1), Z = c > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: _, to: j }] } } : void 0, { cumulative: Mt, total: zt, currentValue: Dt } = w.prefixSum(c, Z), o = Math.max(Mt - Dt, 0);
1684
- i = ne(o, g.top), x = zt ?? w.getTotal();
1685
- } else typeof f == "number" && (i = ne(Math.max(f, 0), g.top)), x = w.getTotal();
1686
- return { position: i, total: x };
1687
- }), [dt, Tt] = Nt(ut.position), [rt, X] = Nt(ut.total), [mt, vt] = Nt(ut.position), [D, T] = Nt(n), S = M(ut.position), J = M(g.top), Q = M(u ?? void 0), st = M(m ?? void 0), bt = M(/* @__PURE__ */ new Map()), nt = M(null), ft = M(null), [lt, Ft] = Nt(null), [Pt, ht] = Nt(!1), Rt = M(null), Lt = M(!1);
1688
- Y(() => {
1689
- Q.current = u ?? void 0, st.current = m ?? void 0;
1690
- }, [m, u]);
1691
- const St = C(
1706
+ initialScrollIndex: f,
1707
+ initialScrollOffset: p,
1708
+ callbackThrottleMs: R = 5,
1709
+ contentInsets: b,
1710
+ onItemFocus: A,
1711
+ scrollBarOptions: U,
1712
+ behaviorOptions: Y
1713
+ }, G) => {
1714
+ const { width: dt, enableThumbDrag: rt, enableTrackClick: Q, enableArrowButtons: N, enableScrollToTopBottomButtons: w, renderThumbOverlay: $, tapScrollCircleOptions: z } = U ?? {}, { enablePointerDrag: Z, enableKeyboardNavigation: _ = !0, wheelSpeedMultiplier: ft, inertiaOptions: C, clipItemHeight: q = !1, resetOnGetItemHeightChange: K = !1 } = Y ?? {}, L = P(null), st = P(!1), v = yt(() => fr(b), [b]), vt = P({ size: o, valueOrFn: e, options: { sampleRange: { from: 0, to: 100 } } }), y = lr(vt.current.size, vt.current.valueOrFn, vt.current.options), [lt] = Vt(() => {
1715
+ let i = v.top, m = 0;
1716
+ if (typeof f == "number") {
1717
+ const r = ht(f, 0, o - 1), a = ht(r - s * 2, 0, o - 1), x = ht(r + s * 2, 0, o - 1), V = f > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: a, to: x }] } } : void 0, { cumulative: O, total: E, currentValue: H } = y.prefixSum(f, V), mt = Math.max(O - H, 0);
1718
+ i = te(mt, v.top), m = E ?? y.getTotal();
1719
+ } else typeof p == "number" && (i = te(Math.max(p, 0), v.top)), m = y.getTotal();
1720
+ return { position: i, total: m };
1721
+ }), [k, bt] = Vt(lt.position), [it, At] = Vt(lt.total), [I, D] = Vt(lt.position), [M, tt] = Vt(o), F = P(lt.position), Mt = P(v.top), xt = P(u ?? void 0), It = P(h ?? void 0), et = P(/* @__PURE__ */ new Map()), at = P(null), ct = P(null), [gt, Et] = Vt(null), [zt, St] = Vt(!1), g = P(null), S = P(!1), nt = P(e);
1722
+ X(() => {
1723
+ xt.current = u ?? void 0, It.current = h ?? void 0;
1724
+ }, [h, u]);
1725
+ const W = T(
1692
1726
  (i) => {
1693
- if (V && i && typeof i.focus == "function")
1727
+ if (_ && i && typeof i.focus == "function")
1694
1728
  try {
1695
1729
  i.focus({ preventScroll: !0 });
1696
1730
  } catch {
1697
1731
  i.focus();
1698
1732
  }
1699
1733
  },
1700
- [V]
1701
- ), p = Ce(Q, $, (i, { position: x, totalHeight: b }) => {
1702
- i(x, b);
1703
- }), y = Ce(st, $, (i, { renderingStartIndex: x, renderingEndIndex: b, visibleStartIndex: _, visibleEndIndex: j, scrollPosition: Z, totalHeight: Mt }) => {
1704
- i(x, b, _, j, Z, Mt);
1734
+ [_]
1735
+ ), j = we(xt, R, (i, { position: m, totalHeight: r }) => {
1736
+ i(m, r);
1737
+ }), Dt = we(It, R, (i, { renderingStartIndex: m, renderingEndIndex: r, visibleStartIndex: a, visibleEndIndex: x, scrollPosition: V, totalHeight: O }) => {
1738
+ i(m, r, a, x, V, O);
1705
1739
  });
1706
- Y(() => (O.current = !0, () => {
1707
- O.current = !1;
1708
- }), []), Y(() => {
1709
- V || (bt.current.clear(), nt.current = null, ft.current = null);
1710
- }, [V]);
1711
- const it = 0.01, B = M({
1740
+ X(() => (st.current = !0, () => {
1741
+ st.current = !1;
1742
+ }), []), X(() => {
1743
+ _ || (et.current.clear(), at.current = null, ct.current = null);
1744
+ }, [_]);
1745
+ const wt = T(
1746
+ (i, m) => {
1747
+ if (!m) {
1748
+ et.current.delete(i);
1749
+ return;
1750
+ }
1751
+ _ && (et.current.set(i, m), at.current === i && (at.current = null, ct.current = i, W(m)));
1752
+ },
1753
+ [_, W]
1754
+ ), pt = 0.01, Ct = P({
1712
1755
  rafId: null,
1713
1756
  loopActive: !1,
1714
1757
  idleFrames: 0,
1715
- lastRenderedPosition: ut.position
1716
- }), W = C(() => {
1717
- const i = B.current;
1758
+ lastRenderedPosition: lt.position
1759
+ }), Xt = T(() => {
1760
+ const i = Ct.current;
1718
1761
  i.rafId !== null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(i.rafId), i.rafId = null, i.loopActive = !1, i.idleFrames = 0;
1719
1762
  }, []);
1720
- Y(
1763
+ X(
1721
1764
  () => () => {
1722
- W();
1765
+ Xt();
1723
1766
  },
1724
- [W]
1767
+ [Xt]
1725
1768
  );
1726
- const At = C(() => {
1727
- const i = B.current;
1769
+ const Nt = T(() => {
1770
+ const i = Ct.current;
1728
1771
  i.rafId = null;
1729
- const x = S.current, b = jt(x, g.top), _ = w.getTotal();
1730
- if (Tt((Z) => Math.abs(Z - x) < it ? Z : x), p({ position: b, totalHeight: _ }), Math.abs(i.lastRenderedPosition - x) >= it ? (i.lastRenderedPosition = x, i.idleFrames = 0) : i.idleFrames += 1, i.idleFrames >= 2) {
1731
- W();
1772
+ const m = F.current, r = qt(m, v.top), a = y.getTotal();
1773
+ if (bt((V) => Math.abs(V - m) < pt ? V : m), j({ position: r, totalHeight: a }), Math.abs(i.lastRenderedPosition - m) >= pt ? (i.lastRenderedPosition = m, i.idleFrames = 0) : i.idleFrames += 1, i.idleFrames >= 2) {
1774
+ Xt();
1732
1775
  return;
1733
1776
  }
1734
1777
  if (typeof requestAnimationFrame == "function") {
1735
- i.rafId = requestAnimationFrame(At);
1778
+ i.rafId = requestAnimationFrame(Nt);
1736
1779
  return;
1737
1780
  }
1738
1781
  i.loopActive = !1;
1739
- }, [w, g.top, p, W]), Vt = C(() => {
1740
- const i = B.current;
1782
+ }, [y, v.top, j, Xt]), Ut = T(() => {
1783
+ const i = Ct.current;
1741
1784
  if (i.idleFrames = 0, !i.loopActive) {
1742
1785
  if (i.loopActive = !0, typeof requestAnimationFrame == "function") {
1743
- i.rafId = requestAnimationFrame(At);
1786
+ i.rafId = requestAnimationFrame(Nt);
1744
1787
  return;
1745
1788
  }
1746
1789
  i.loopActive = !1;
1747
1790
  }
1748
- }, [At]), H = C(
1749
- (i, x) => {
1750
- const b = x?.immediate ?? !1, _ = jt(i, g.top);
1751
- if (S.current = i, b) {
1752
- B.current.lastRenderedPosition = i, B.current.idleFrames = 0, Tt(i), p({ position: _, totalHeight: w.getTotal() });
1791
+ }, [Nt]), J = T(
1792
+ (i, m) => {
1793
+ const r = m?.immediate ?? !1, a = qt(i, v.top);
1794
+ if (F.current = i, r) {
1795
+ Ct.current.lastRenderedPosition = i, Ct.current.idleFrames = 0, bt(i), j({ position: a, totalHeight: y.getTotal() });
1753
1796
  return;
1754
1797
  }
1755
- Vt();
1798
+ Ut();
1756
1799
  },
1757
- [Vt, w, g.top, p]
1758
- ), Ht = M(!1);
1759
- Y(() => {
1760
- if (!Ht.current)
1761
- if (Ht.current = !0, typeof f == "number") {
1762
- const i = ne(Math.max(f, 0), g.top), x = Math.abs(i - S.current) > 0.5;
1763
- H(i, { immediate: !0 }), x && vt(i);
1800
+ [Ut, y, v.top, j]
1801
+ ), Pt = P(!1);
1802
+ X(() => {
1803
+ if (!Pt.current)
1804
+ if (Pt.current = !0, typeof p == "number") {
1805
+ const i = te(Math.max(p, 0), v.top), m = Math.abs(i - F.current) > 0.5;
1806
+ J(i, { immediate: !0 }), m && D(i);
1764
1807
  } else
1765
- H(S.current, { immediate: !0 });
1766
- }, [f, g.top, H]), oe(() => {
1767
- w.setValueFn(e), D !== n && (w.changeSize(n), T(n));
1768
- const i = w.getTotal();
1769
- rt !== i && X(i);
1770
- }, [w, D, n, rt, e]), oe(() => {
1771
- mt !== null && I.current && (pt.debug("[VirtualScroll] Scrolling to position:", mt), I.current.scrollTo(mt), vt(null));
1772
- }, [mt]), Y(() => {
1773
- const i = J.current;
1774
- if (i === g.top)
1808
+ J(F.current, { immediate: !0 });
1809
+ }, [p, v.top, J]), ee(() => {
1810
+ nt.current !== e ? (y.setValueFn(e, { reset: K }), nt.current = e) : y.setValueFn(e, { reset: !1 }), M !== o && (y.changeSize(o), tt(o));
1811
+ const m = y.getTotal();
1812
+ it !== m && At(m);
1813
+ }, [y, M, o, it, e, K]), ee(() => {
1814
+ I !== null && L.current && (ut.debug("[VirtualScroll] Scrolling to position:", I), L.current.scrollTo(I), D(null));
1815
+ }, [I]), X(() => {
1816
+ const i = Mt.current;
1817
+ if (i === v.top)
1775
1818
  return;
1776
- const x = jt(S.current, i), b = ne(x, g.top);
1777
- J.current = g.top, S.current = b, vt(b), H(b, { immediate: !0 });
1778
- }, [g.top, H]);
1779
- const yt = C(
1819
+ const m = qt(F.current, i), r = te(m, v.top);
1820
+ Mt.current = v.top, F.current = r, D(r), J(r, { immediate: !0 });
1821
+ }, [v.top, J]);
1822
+ const Tt = T(
1780
1823
  (i) => {
1781
- if (!I.current)
1824
+ if (!L.current)
1782
1825
  return;
1783
- const x = ct(i, D), b = ct(x - s * 2, D), _ = ct(x + s * 2, D), { cumulative: j, total: Z, currentValue: Mt } = w.prefixSum(x, { materializeOption: { materialize: !0, ranges: [{ from: b, to: _ }] } });
1784
- if (pt.debug("[VirtualScroll] Scrolling to index:", x, "Offset:", j, "Total height:", Z, "Current value:", Mt, "safeIndexFrom:", b, "safeIndexTo:", _), !Z)
1826
+ const m = ot(i, M), r = ot(m - s * 2, M), a = ot(m + s * 2, M), { cumulative: x, total: V, currentValue: O } = y.prefixSum(m, { materializeOption: { materialize: !0, ranges: [{ from: r, to: a }] } });
1827
+ if (ut.debug("[VirtualScroll] Scrolling to index:", m, "Offset:", x, "Total height:", V, "Current value:", O, "safeIndexFrom:", r, "safeIndexTo:", a), !V)
1785
1828
  return;
1786
- const zt = Math.max(j - Mt, 0), Dt = ne(zt, g.top);
1787
- X(Z), vt(Dt), pt.debug("[VirtualScroll] Setting scroll position to:", Dt);
1829
+ const E = Math.max(x - O, 0), H = te(E, v.top);
1830
+ At(V), D(H), ut.debug("[VirtualScroll] Setting scroll position to:", H);
1788
1831
  },
1789
- [w, s, D, g.top]
1790
- ), Ut = C(
1832
+ [y, s, M, v.top]
1833
+ ), jt = T(
1791
1834
  (i) => {
1792
- if (!I.current)
1835
+ if (!L.current)
1793
1836
  return;
1794
- const x = w.getTotal(), b = xt(Math.floor(i), 0, x), _ = w.findIndexAtOrAfter(b, { materializeOption: { materialize: !1 } }).index;
1795
- yt(_);
1837
+ const m = y.getTotal(), r = ht(Math.floor(i), 0, m), a = y.findIndexAtOrAfter(r, { materializeOption: { materialize: !1 } }).index;
1838
+ Tt(a);
1796
1839
  },
1797
- [w, yt]
1798
- ), Zt = C(
1840
+ [y, Tt]
1841
+ ), re = T(
1799
1842
  (i) => {
1800
- const x = jt(S.current, g.top), b = typeof i == "function" ? i(x) : i;
1801
- Ut(b);
1802
- const _ = I.current?.getScrollPosition(), j = typeof _ == "number" ? _ : S.current;
1803
- return H(j), j;
1843
+ const m = qt(F.current, v.top), r = typeof i == "function" ? i(m) : i;
1844
+ jt(r);
1845
+ const a = L.current?.getScrollPosition(), x = typeof a == "number" ? a : F.current;
1846
+ return J(x), x;
1804
1847
  },
1805
- [g.top, Ut, H]
1806
- ), Et = C(
1807
- (i, x) => {
1808
- if (pt.debug("[VirtualScroll] Scroll position changed:", i), H(i), G) {
1809
- if (Lt.current) {
1810
- Lt.current = !1;
1848
+ [v.top, jt, J]
1849
+ ), Gt = T(
1850
+ (i, m) => {
1851
+ if (ut.debug("[VirtualScroll] Scroll position changed:", i), J(i), w) {
1852
+ if (S.current) {
1853
+ S.current = !1;
1811
1854
  return;
1812
1855
  }
1813
- const b = i - x;
1814
- if (pt.debug("[VirtualScroll] Scroll diff:", b, "New:", i, "Prev:", x), Math.abs(b) > 1) {
1815
- const _ = b > 0 ? "down" : "up";
1816
- Ft(_), ht(!0), pt.debug("[VirtualScroll] Showing scroll buttons. Direction:", _), Rt.current && clearTimeout(Rt.current), Rt.current = setTimeout(() => {
1817
- ht(!1), pt.debug("[VirtualScroll] Hiding scroll buttons");
1856
+ const r = i - m;
1857
+ if (ut.debug("[VirtualScroll] Scroll diff:", r, "New:", i, "Prev:", m), Math.abs(r) > 1) {
1858
+ const a = r > 0 ? "down" : "up";
1859
+ Et(a), St(!0), ut.debug("[VirtualScroll] Showing scroll buttons. Direction:", a), g.current && clearTimeout(g.current), g.current = setTimeout(() => {
1860
+ St(!1), ut.debug("[VirtualScroll] Hiding scroll buttons");
1818
1861
  }, 2e3);
1819
1862
  }
1820
1863
  }
1821
1864
  },
1822
- [H, G]
1823
- ), gt = kt(() => jt(dt, g.top), [g.top, dt]), Jt = kt(() => {
1824
- const i = mr(gt, r, s, D, e, w, rt);
1825
- return pt.debug("[VirtualScroll] Calculated rendering range:", {
1865
+ [J, w]
1866
+ ), Ht = yt(() => qt(k, v.top), [v.top, k]), ne = yt(() => {
1867
+ const i = mr(Ht, n, s, M, e, y, it);
1868
+ return ut.debug("[VirtualScroll] Calculated rendering range:", {
1826
1869
  ...i,
1827
- scrollPosition: gt,
1828
- renderingContentSize: w.getTotal(),
1870
+ scrollPosition: Ht,
1871
+ renderingContentSize: y.getTotal(),
1829
1872
  overscanCount: s,
1830
- viewportSize: r
1873
+ viewportSize: n
1831
1874
  }), i;
1832
- }, [gt, r, s, D, e, w, rt]), { renderingStartIndex: qt, renderingEndIndex: Bt, visibleStartIndex: Ot, visibleEndIndex: $t } = Jt, Yt = C(
1833
- (i, x) => {
1834
- if (!V || D === 0)
1875
+ }, [Ht, n, s, M, e, y, it]), { renderingStartIndex: Rt, renderingEndIndex: Ft, visibleStartIndex: Ot, visibleEndIndex: Lt } = ne, Yt = T(
1876
+ (i, m) => {
1877
+ if (!_ || M === 0)
1835
1878
  return;
1836
- const b = ct(i, D);
1837
- if (!(x?.ensureVisible ?? !0)) {
1838
- const ot = bt.current.get(b);
1839
- ot && (nt.current = null, ft.current = b, St(ot));
1879
+ const r = ot(i, M);
1880
+ if (!(m?.ensureVisible ?? !0)) {
1881
+ const Kt = et.current.get(r);
1882
+ Kt && (at.current = null, ct.current = r, W(Kt));
1840
1883
  return;
1841
1884
  }
1842
- const j = w.prefixSum(b, { materializeOption: { materialize: !1 } }), Z = j.currentValue, Mt = Math.max(j.cumulative - Z, 0), zt = Mt + Z, Dt = jt(S.current, g.top), o = Dt + r;
1843
- if (Mt < Dt || zt > o) {
1844
- nt.current = b, yt(b);
1885
+ const x = y.prefixSum(r, { materializeOption: { materialize: !1 } }), V = x.currentValue, O = Math.max(x.cumulative - V, 0), E = O + V, H = qt(F.current, v.top), mt = H + n;
1886
+ if (O < H || E > mt) {
1887
+ at.current = r, Tt(r);
1845
1888
  return;
1846
1889
  }
1847
- const R = bt.current.get(b);
1848
- if (R) {
1849
- nt.current = null, ft.current = b, St(R);
1890
+ const _t = et.current.get(r);
1891
+ if (_t) {
1892
+ at.current = null, ct.current = r, W(_t);
1850
1893
  return;
1851
1894
  }
1852
- nt.current = b;
1895
+ at.current = r;
1853
1896
  },
1854
- [V, D, w, g.top, yt, St, r]
1855
- ), Kt = C(
1856
- (i, x) => {
1857
- if (!V || i.defaultPrevented || i.altKey || i.metaKey || i.ctrlKey)
1897
+ [_, M, y, v.top, Tt, W, n]
1898
+ ), oe = T(
1899
+ (i, m) => {
1900
+ if (!_ || i.defaultPrevented || i.altKey || i.metaKey || i.ctrlKey)
1858
1901
  return;
1859
- const b = i.target;
1860
- if (b) {
1861
- const _ = b.tagName;
1862
- if (_ === "INPUT" || _ === "TEXTAREA" || _ === "SELECT" || b.isContentEditable)
1902
+ const r = i.target;
1903
+ if (r) {
1904
+ const a = r.tagName;
1905
+ if (a === "INPUT" || a === "TEXTAREA" || a === "SELECT" || r.isContentEditable)
1863
1906
  return;
1864
1907
  }
1865
1908
  if (i.key === "ArrowDown") {
1866
- x < D - 1 && (i.preventDefault(), Yt(x + 1));
1909
+ m < M - 1 && (i.preventDefault(), Yt(m + 1));
1867
1910
  return;
1868
1911
  }
1869
1912
  if (i.key === "ArrowUp") {
1870
- x > 0 && (i.preventDefault(), Yt(x - 1));
1913
+ m > 0 && (i.preventDefault(), Yt(m - 1));
1871
1914
  return;
1872
1915
  }
1873
1916
  if (i.key === "PageDown") {
1874
- if (x < D - 1) {
1917
+ if (m < M - 1) {
1875
1918
  i.preventDefault();
1876
- const _ = Math.max($t - Ot + 1, 1), j = Math.max(_, 1), Z = ct(Math.min(x + j, D - 1), D);
1877
- Yt(Z);
1919
+ const a = Math.max(Lt - Ot + 1, 1), x = Math.max(a, 1), V = ot(Math.min(m + x, M - 1), M);
1920
+ Yt(V);
1878
1921
  }
1879
1922
  return;
1880
1923
  }
1881
- if (i.key === "PageUp" && x > 0) {
1924
+ if (i.key === "PageUp" && m > 0) {
1882
1925
  i.preventDefault();
1883
- const _ = Math.max($t - Ot + 1, 1), j = Math.max(_, 1), Z = ct(x - j, D);
1884
- Yt(Z);
1926
+ const a = Math.max(Lt - Ot + 1, 1), x = Math.max(a, 1), V = ot(m - x, M);
1927
+ Yt(V);
1885
1928
  }
1886
1929
  },
1887
- [V, D, Yt, $t, Ot]
1888
- ), se = C(
1930
+ [_, M, Yt, Lt, Ot]
1931
+ ), se = T(
1889
1932
  (i) => {
1890
- if (!V)
1933
+ if (!_)
1891
1934
  return;
1892
- const x = ct(i, D);
1893
- nt.current = null, ft.current = x, F?.(x);
1935
+ const m = ot(i, M);
1936
+ at.current = null, ct.current = m, A?.(m);
1894
1937
  },
1895
- [V, D, F]
1938
+ [_, M, A]
1896
1939
  );
1897
- Y(() => {
1898
- const i = I.current?.getScrollPosition() ?? 0, x = S.current, b = jt(x, g.top);
1899
- pt.debug("[VirtualScroll] Range change effect triggered", {
1900
- renderingStartIndex: qt,
1901
- renderingEndIndex: Bt,
1940
+ X(() => {
1941
+ const i = L.current?.getScrollPosition() ?? 0, m = F.current, r = qt(m, v.top);
1942
+ ut.debug("[VirtualScroll] Range change effect triggered", {
1943
+ renderingStartIndex: Rt,
1944
+ renderingEndIndex: Ft,
1902
1945
  visibleStartIndex: Ot,
1903
- visibleEndIndex: $t,
1904
- scrollPositionState: dt,
1905
- paneScrollPosition: x,
1906
- logicalScrollPosition: b,
1907
- contentSize: rt,
1946
+ visibleEndIndex: Lt,
1947
+ scrollPositionState: k,
1948
+ paneScrollPosition: m,
1949
+ logicalScrollPosition: r,
1950
+ contentSize: it,
1908
1951
  scrollPaneScrollPosition: i
1909
- }), y({
1910
- renderingStartIndex: qt,
1911
- renderingEndIndex: Bt,
1952
+ }), Dt({
1953
+ renderingStartIndex: Rt,
1954
+ renderingEndIndex: Ft,
1912
1955
  visibleStartIndex: Ot,
1913
- visibleEndIndex: $t,
1914
- scrollPosition: b,
1915
- totalHeight: rt
1956
+ visibleEndIndex: Lt,
1957
+ scrollPosition: r,
1958
+ totalHeight: it
1916
1959
  });
1917
- }, [rt, Bt, qt, g.top, y, dt, $t, Ot]);
1918
- const ue = C(() => G ? /* @__PURE__ */ U("div", { className: `pointer-events-none absolute inset-0 transition-opacity duration-500 ${Pt && lt !== null ? "opacity-100" : "opacity-0"}`, style: { zIndex: 10 }, children: lt === "up" ? /* @__PURE__ */ U("div", { className: "absolute top-2 right-0 left-0 flex justify-center", children: /* @__PURE__ */ U(
1960
+ }, [it, Ft, Rt, v.top, Dt, k, Lt, Ot]);
1961
+ const ue = T(() => w ? /* @__PURE__ */ B("div", { className: "aqvs:scroll-to-edge-overlay", "data-visible": zt && gt !== null, children: gt === "up" ? /* @__PURE__ */ B("div", { className: "aqvs:scroll-to-edge-button-container aqvs:scroll-to-edge-button-container-top", children: /* @__PURE__ */ B(
1919
1962
  "button",
1920
1963
  {
1921
1964
  type: "button",
1922
- className: "pointer-events-auto transform rounded-full bg-gray-800/80 px-12 py-1 font-medium text-[10px] text-white uppercase tracking-wider shadow-md backdrop-blur-sm transition-transform hover:bg-gray-700 active:scale-95",
1923
- onClick: (b) => {
1924
- b.stopPropagation(), Lt.current = !0, yt(0), ht(!1);
1965
+ className: "aqvs:scroll-to-edge-button",
1966
+ onClick: (r) => {
1967
+ r.stopPropagation(), S.current = !0, Tt(0), St(!1);
1925
1968
  },
1926
1969
  children: "Top"
1927
1970
  }
1928
- ) }) : /* @__PURE__ */ U("div", { className: "absolute right-0 bottom-2 left-0 flex justify-center", children: /* @__PURE__ */ U(
1971
+ ) }) : /* @__PURE__ */ B("div", { className: "aqvs:scroll-to-edge-button-container aqvs:scroll-to-edge-button-container-bottom", children: /* @__PURE__ */ B(
1929
1972
  "button",
1930
1973
  {
1931
1974
  type: "button",
1932
- className: "pointer-events-auto transform rounded-full bg-gray-800/80 px-12 py-1 font-medium text-[10px] text-white uppercase tracking-wider shadow-md backdrop-blur-sm transition-transform hover:bg-gray-700 active:scale-95",
1933
- onClick: (b) => {
1934
- b.stopPropagation(), Lt.current = !0, yt(n - 1), ht(!1);
1975
+ className: "aqvs:scroll-to-edge-button",
1976
+ onClick: (r) => {
1977
+ r.stopPropagation(), S.current = !0, Tt(o - 1), St(!1);
1935
1978
  },
1936
1979
  children: "Bottom"
1937
1980
  }
1938
- ) }) }) : null, [G, Pt, lt, yt, n]), de = C(
1981
+ ) }) }) : null, [w, zt, gt, Tt, o]), { visibleItems: Zt, startPosition: Jt } = yt(() => {
1982
+ if (M === 0)
1983
+ return {
1984
+ visibleItems: /* @__PURE__ */ B("div", { className: "aqvs:no-items-container", children: /* @__PURE__ */ B("div", { className: "aqvs:no-items-text", children: "No items" }) }),
1985
+ startPosition: 0
1986
+ };
1987
+ const i = ot(Rt, M), m = ot(Ft, M), { cumulative: r, currentValue: a } = y.prefixSum(i, { materializeOption: { materialize: !1 } }), x = r - a, V = [], O = [];
1988
+ for (let E = i; E <= m; E++) {
1989
+ const H = e(E);
1990
+ y.get(E) !== H && V.push({ index: E, value: H });
1991
+ const { cumulative: $t, currentValue: _t } = y.prefixSum(E, { materializeOption: { materialize: !1 } }), Kt = $t - _t;
1992
+ O.push(
1993
+ /* @__PURE__ */ B(
1994
+ gr,
1995
+ {
1996
+ index: E,
1997
+ top: Kt - x + v.top,
1998
+ height: H,
1999
+ item: t(E),
2000
+ children: l,
2001
+ clipItemHeight: q,
2002
+ enableKeyboardNavigation: _,
2003
+ onKeyDown: oe,
2004
+ onFocus: se,
2005
+ registerItemRef: wt
2006
+ },
2007
+ E
2008
+ )
2009
+ );
2010
+ }
2011
+ return V.length > 0 && Promise.resolve().then(() => {
2012
+ if (!st.current)
2013
+ return;
2014
+ const E = y.updates(V);
2015
+ if (!st.current || typeof E != "number")
2016
+ return;
2017
+ At(E), ut.debug("[VirtualScroll] Updated heights for items", V, "New total height:", E);
2018
+ const H = L.current?.getScrollPosition() ?? F.current;
2019
+ H === F.current || !st.current || J(H);
2020
+ }), { visibleItems: O, startPosition: x };
2021
+ }, [l, q, _, M, y, t, e, se, oe, wt, Ft, Rt, v.top, J]), de = T(
1939
2022
  (i) => {
1940
- const x = ($ ?? 0) > 0, b = Math.abs(i - dt), _ = x && b > 0.5 ? dt : i, j = jt(_, g.top);
1941
- if (pt.debug("[VirtualScroll] Rendering visible items", {
2023
+ const m = (R ?? 0) > 0, r = Math.abs(i - k), a = m && r > 0.5 ? k : i, x = qt(a, v.top);
2024
+ if (ut.debug("[VirtualScroll] Rendering visible items", {
1942
2025
  currentScrollPosition: i,
1943
- effectiveScrollPosition: j,
1944
- renderingStartIndex: qt,
1945
- renderingEndIndex: Bt,
1946
- fenwickSize: D,
1947
- viewportSize: r,
1948
- callbackThrottleMs: $,
1949
- diff: b,
1950
- rawEffectiveScrollPosition: _
1951
- }), D === 0)
1952
- return /* @__PURE__ */ U("div", { className: "absolute w-full", style: { top: 0 }, children: /* @__PURE__ */ U("div", { className: "text-center text-gray-500", children: "No items" }) });
1953
- const Z = ct(qt, D), Mt = ct(Bt, D), { cumulative: zt, currentValue: Dt } = w.prefixSum(Z, { materializeOption: { materialize: !1 } }), o = zt - Dt, h = [], R = [];
1954
- for (let E = Z; E <= Mt; E++) {
1955
- const tt = e(E);
1956
- w.get(E) !== tt && h.push({ index: E, value: tt });
1957
- const { cumulative: wt, currentValue: ee } = w.prefixSum(E, { materializeOption: { materialize: !1 } }), Gt = wt - ee, pe = (Wt) => {
1958
- if (!Wt) {
1959
- bt.current.delete(E);
1960
- return;
2026
+ effectiveScrollPosition: x,
2027
+ renderingStartIndex: Rt,
2028
+ renderingEndIndex: Ft,
2029
+ fenwickSize: M,
2030
+ viewportSize: n,
2031
+ callbackThrottleMs: R,
2032
+ diff: r,
2033
+ rawEffectiveScrollPosition: a
2034
+ }), M === 0)
2035
+ return Zt;
2036
+ const V = Jt - x, O = v.bottom > 0 ? /* @__PURE__ */ B(
2037
+ "div",
2038
+ {
2039
+ className: "aqvs:bottom-inset",
2040
+ style: {
2041
+ top: y.getTotal() + v.top - Jt,
2042
+ height: v.bottom
1961
2043
  }
1962
- V && (bt.current.set(E, Wt), nt.current === E && (nt.current = null, ft.current = E, St(Wt)));
1963
- };
1964
- R.push(
1965
- /* @__PURE__ */ U(
1966
- "div",
1967
- {
1968
- ref: pe,
1969
- "data-index": E,
1970
- "data-virtualscroll-item": "true",
1971
- style: {
1972
- position: "absolute",
1973
- top: Gt - o + g.top,
1974
- width: "100%",
1975
- height: tt,
1976
- overflow: at ? "hidden" : void 0
1977
- },
1978
- tabIndex: V ? -1 : void 0,
1979
- onPointerDown: V ? (Wt) => {
1980
- Wt.currentTarget.focus({ preventScroll: !0 });
1981
- } : void 0,
1982
- onKeyDownCapture: V ? (Wt) => Kt(Wt, E) : void 0,
1983
- onFocusCapture: V ? () => se(E) : void 0,
1984
- children: l(t(E), E)
1985
- },
1986
- E
1987
- )
1988
- );
1989
- }
1990
- h.length > 0 && Promise.resolve().then(() => {
1991
- if (!O.current)
1992
- return;
1993
- const E = w.updates(h);
1994
- if (!O.current || typeof E != "number")
1995
- return;
1996
- X(E), pt.debug("[VirtualScroll] Updated heights for items", h, "New total height:", E);
1997
- const tt = I.current?.getScrollPosition() ?? S.current;
1998
- tt === S.current || !O.current || H(tt);
1999
- });
2000
- const ot = o - j;
2001
- if (g.bottom > 0) {
2002
- const E = w.getTotal() + g.top - o;
2003
- R.push(
2004
- /* @__PURE__ */ U(
2005
- "div",
2006
- {
2007
- style: {
2008
- position: "absolute",
2009
- top: E,
2010
- height: g.bottom,
2011
- width: "100%"
2012
- }
2013
- },
2014
- "virtualscroll-bottom-inset"
2015
- )
2016
- );
2017
- }
2018
- return pt.debug("[VirtualScroll] Rendering items", {
2019
- nodeCount: R.length,
2020
- containerTop: ot,
2021
- logicalScrollPosition: gt,
2022
- resolvedInsets: g,
2023
- effectiveScrollPosition: j
2024
- }), /* @__PURE__ */ U("div", { className: "absolute w-full", style: { top: ot }, children: R });
2044
+ },
2045
+ "virtualscroll-bottom-inset"
2046
+ ) : null;
2047
+ return ut.debug("[VirtualScroll] Rendering items", {
2048
+ containerTop: V,
2049
+ logicalScrollPosition: Ht,
2050
+ resolvedInsets: v,
2051
+ effectiveScrollPosition: x
2052
+ }), /* @__PURE__ */ Bt("div", { className: "aqvs:items-wrapper", style: { top: V }, children: [
2053
+ Zt,
2054
+ O
2055
+ ] });
2025
2056
  },
2026
- [
2027
- $,
2028
- l,
2029
- V,
2030
- w,
2031
- D,
2032
- t,
2033
- e,
2034
- se,
2035
- Kt,
2036
- gt,
2037
- Bt,
2038
- qt,
2039
- g,
2040
- dt,
2041
- St,
2042
- H,
2043
- r,
2044
- at
2045
- ]
2057
+ [R, M, y, Ht, Ft, Rt, v, k, Jt, n, Zt]
2046
2058
  );
2047
- be(
2048
- Ct,
2059
+ Ie(
2060
+ G,
2049
2061
  () => ({
2050
- getScrollPosition: () => I.current?.getScrollPosition() ?? -1,
2051
- getContentSize: () => I.current?.getContentSize() ?? -1,
2052
- getViewportSize: () => I.current?.getViewportSize() ?? -1,
2053
- scrollTo: Zt,
2054
- scrollToIndex: yt,
2055
- getFenwickTreeTotalHeight: () => w.getTotal(),
2056
- getFenwickSize: () => w.getSize(),
2062
+ getScrollPosition: () => L.current?.getScrollPosition() ?? -1,
2063
+ getContentSize: () => L.current?.getContentSize() ?? -1,
2064
+ getViewportSize: () => L.current?.getViewportSize() ?? -1,
2065
+ scrollTo: re,
2066
+ scrollToIndex: Tt,
2067
+ getFenwickTreeTotalHeight: () => y.getTotal(),
2068
+ getFenwickSize: () => y.getSize(),
2057
2069
  focusItemAtIndex: Yt
2058
2070
  }),
2059
- [Zt, yt, w, Yt]
2071
+ [re, Tt, y, Yt]
2060
2072
  );
2061
- const fe = rt + g.top + g.bottom;
2062
- return /* @__PURE__ */ U(
2073
+ const fe = it + v.top + v.bottom;
2074
+ return /* @__PURE__ */ B(
2063
2075
  sr,
2064
2076
  {
2065
- ref: I,
2077
+ ref: L,
2066
2078
  contentSize: fe,
2067
- viewportSize: r,
2068
- className: a,
2069
- onScroll: Et,
2079
+ viewportSize: n,
2080
+ className: c,
2081
+ onScroll: Gt,
2070
2082
  background: d,
2071
- tapScrollCircleOptions: P,
2072
- inertiaOptions: It,
2073
- itemCount: n,
2074
- scrollBarWidth: v,
2075
- enableThumbDrag: N,
2076
- enableTrackClick: q,
2077
- enableArrowButtons: L,
2078
- enablePointerDrag: K,
2079
- renderThumbOverlay: k,
2080
- wheelSpeedMultiplier: z,
2081
- contentInsets: g,
2083
+ tapScrollCircleOptions: z,
2084
+ inertiaOptions: C,
2085
+ itemCount: o,
2086
+ scrollBarWidth: dt,
2087
+ enableThumbDrag: rt,
2088
+ enableTrackClick: Q,
2089
+ enableArrowButtons: N,
2090
+ enablePointerDrag: Z,
2091
+ renderThumbOverlay: $,
2092
+ wheelSpeedMultiplier: ft,
2093
+ contentInsets: v,
2082
2094
  visibleStartIndex: Ot,
2083
- visibleEndIndex: $t,
2095
+ visibleEndIndex: Lt,
2084
2096
  renderOverlay: ue,
2085
2097
  children: de
2086
2098
  }
2087
2099
  );
2088
- }, Pr = Ie(gr);
2100
+ }, yr = xe(br);
2089
2101
  export {
2090
2102
  ar as FenwickMapTree,
2091
2103
  or as ScrollBar,
2092
2104
  sr as ScrollPane,
2093
- Pr as VirtualScroll,
2094
- xt as minmax,
2095
- Tr as tapScrollCircleSampleVisual,
2105
+ yr as VirtualScroll,
2106
+ ht as minmax,
2107
+ Sr as tapScrollCircleSampleVisual,
2096
2108
  lr as useFenwickMapTree,
2097
- vr as useHeightCache,
2109
+ Pr as useHeightCache,
2098
2110
  ur as useLruCache
2099
2111
  };