@aiquants/virtualscroll 1.15.0 → 1.18.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 $, jsxs as re, Fragment as ke } from "react/jsx-runtime";
2
- import He, { memo as Be, forwardRef as Me, useState as Bt, useRef as P, useCallback as I, useImperativeHandle as ye, useMemo as Vt, useLayoutEffect as ae, useEffect as B, useId as Xe } from "react";
3
- import { twMerge as ee } from "tailwind-merge";
1
+ import { jsx as $, jsxs as ne, Fragment as _e } from "react/jsx-runtime";
2
+ import He, { memo as Xe, forwardRef as ye, useState as Bt, useRef as T, useCallback as P, useImperativeHandle as we, useMemo as At, useLayoutEffect as oe, useEffect as Y, useId as Be } from "react";
3
+ import { twMerge as re } from "tailwind-merge";
4
4
  class _ {
5
5
  level;
6
6
  prefix;
@@ -97,7 +97,7 @@ class _ {
97
97
  this.level <= 3 && this.impl.error(...this.formatMessage(t), ...e);
98
98
  }
99
99
  }
100
- const Re = {
100
+ const Ve = {
101
101
  active: !1,
102
102
  offsetX: 0,
103
103
  offsetY: 0,
@@ -105,8 +105,8 @@ const Re = {
105
105
  direction: 0,
106
106
  pointerId: null
107
107
  }, Te = 6, Ue = 8, $e = ({ dragState: n, normalizedDistance: t }) => {
108
- const e = 1 + t * 0.18, r = 0.16 + t * 0.24, s = 0.38 + t * 0.28, l = n.active ? "80ms ease-out" : "220ms ease";
109
- return /* @__PURE__ */ re(ke, { children: [
108
+ const e = 1 + t * 0.18, r = 0.16 + t * 0.24, i = 0.38 + t * 0.28, l = n.active ? "80ms ease-out" : "220ms ease";
109
+ return /* @__PURE__ */ ne(_e, { children: [
110
110
  /* @__PURE__ */ $(
111
111
  "div",
112
112
  {
@@ -126,104 +126,104 @@ const Re = {
126
126
  style: {
127
127
  background: "linear-gradient(140deg, rgba(255,255,255,0.72), rgba(28,28,28,0.58))",
128
128
  boxShadow: "inset 0 4px 10px rgba(0,0,0,0.24), inset 0 0 2px rgba(255,255,255,0.55)",
129
- opacity: s,
129
+ opacity: i,
130
130
  transition: n.active ? "120ms opacity ease-out" : "220ms opacity ease"
131
131
  }
132
132
  }
133
133
  )
134
134
  ] });
135
- }, _e = Be(
136
- Me(({ onDragChange: n, className: t, maxVisualDistance: e = 160, size: r = 40, style: s, opacity: l = 1, renderVisual: c }, d) => {
137
- const [f, p] = Bt(Re), m = P(null), g = P({ x: 0, y: 0 }), E = P(null), x = P(0), A = I(
138
- (D) => {
139
- p(D), n(D);
135
+ }, Fe = Xe(
136
+ ye(({ onDragChange: n, className: t, maxVisualDistance: e = 160, size: r = 40, style: i, opacity: l = 1, renderVisual: c }, d) => {
137
+ const [f, h] = Bt(Ve), m = T(null), g = T({ x: 0, y: 0 }), N = T(null), x = T(0), k = P(
138
+ (I) => {
139
+ h(I), n(I);
140
140
  },
141
141
  [n]
142
- ), U = I(
143
- (D, Z, J = !1) => {
144
- const { x: W, y: F } = g.current, It = D - W, ct = Z - F, vt = Math.abs(ct), T = vt < Te ? 0 : ct < 0 ? -1 : 1, Mt = x.current;
145
- let b = T;
146
- const St = Te + Ue;
147
- T === 0 ? Mt !== 0 && vt < St ? b = Mt : (b = 0, J || (x.current = 0)) : T !== Mt && Mt !== 0 && vt < St ? b = Mt : x.current = T, A({
148
- active: J || vt >= Te,
149
- offsetX: It,
150
- offsetY: ct,
151
- distance: vt,
152
- direction: b,
142
+ ), B = P(
143
+ (I, W, St = !1) => {
144
+ const { x: Dt, y: ot } = g.current, A = I - Dt, G = W - ot, dt = Math.abs(G), It = dt < Te ? 0 : G < 0 ? -1 : 1, v = x.current;
145
+ let kt = It;
146
+ const S = Te + Ue;
147
+ It === 0 ? v !== 0 && dt < S ? kt = v : (kt = 0, St || (x.current = 0)) : It !== v && v !== 0 && dt < S ? kt = v : x.current = It, k({
148
+ active: St || dt >= Te,
149
+ offsetX: A,
150
+ offsetY: G,
151
+ distance: dt,
152
+ direction: kt,
153
153
  pointerId: m.current
154
154
  });
155
155
  },
156
- [A]
157
- ), q = I((D) => {
158
- if (D === null)
156
+ [k]
157
+ ), z = P((I) => {
158
+ if (I === null)
159
159
  return;
160
- const Z = E.current;
161
- Z?.hasPointerCapture(D) && Z.releasePointerCapture(D);
162
- }, []), Q = I(
163
- (D = !1) => {
164
- D && q(m.current), m.current = null, x.current = 0, A(Re);
160
+ const W = N.current;
161
+ W?.hasPointerCapture(I) && W.releasePointerCapture(I);
162
+ }, []), Q = P(
163
+ (I = !1) => {
164
+ I && z(m.current), m.current = null, x.current = 0, k(Ve);
165
165
  },
166
- [A, q]
167
- ), bt = I(
168
- (D) => {
169
- D.preventDefault(), D.stopPropagation();
170
- const Z = E.current ?? D.currentTarget, { left: J, top: W, width: F, height: It } = Z.getBoundingClientRect();
171
- g.current = { x: J + F / 2, y: W + It / 2 }, m.current = D.pointerId, Z.setPointerCapture(D.pointerId), U(D.clientX, D.clientY, !0);
166
+ [k, z]
167
+ ), pt = P(
168
+ (I) => {
169
+ I.preventDefault(), I.stopPropagation();
170
+ const W = N.current ?? I.currentTarget, { left: St, top: Dt, width: ot, height: A } = W.getBoundingClientRect();
171
+ g.current = { x: St + ot / 2, y: Dt + A / 2 }, m.current = I.pointerId, W.setPointerCapture(I.pointerId), B(I.clientX, I.clientY, !0);
172
172
  },
173
- [U]
174
- ), lt = I(
175
- (D) => {
176
- m.current === D.pointerId && (D.preventDefault(), U(D.clientX, D.clientY));
173
+ [B]
174
+ ), ct = P(
175
+ (I) => {
176
+ m.current === I.pointerId && (I.preventDefault(), B(I.clientX, I.clientY));
177
177
  },
178
- [U]
179
- ), it = I(
180
- (D) => {
181
- m.current === D.pointerId && (D.preventDefault(), D.stopPropagation(), Q(!0));
178
+ [B]
179
+ ), st = P(
180
+ (I) => {
181
+ m.current === I.pointerId && (I.preventDefault(), I.stopPropagation(), Q(!0));
182
182
  },
183
183
  [Q]
184
184
  );
185
- ye(
185
+ we(
186
186
  d,
187
187
  () => ({
188
188
  reset: () => {
189
189
  Q(!0);
190
190
  },
191
- getElement: () => E.current
191
+ getElement: () => N.current
192
192
  }),
193
193
  [Q]
194
194
  );
195
- const Y = Math.min(Math.max(l, 0), 1), tt = r / 64, C = Math.min(f.distance, e) / e, K = f.direction * C * 10 * tt, G = c ?? $e, Tt = {
195
+ const L = Math.min(Math.max(l, 0), 1), tt = r / 64, et = Math.min(f.distance, e) / e, E = f.direction * et * 10 * tt, ut = c ?? $e, Pt = {
196
196
  dragState: f,
197
- normalizedDistance: C,
197
+ normalizedDistance: et,
198
198
  sizeScale: tt,
199
199
  size: r,
200
- opacity: Y
201
- }, L = {
202
- ...s,
200
+ opacity: L
201
+ }, ht = {
202
+ ...i,
203
203
  width: r,
204
204
  height: r,
205
- transform: `translateY(${K}px)`
205
+ transform: `translateY(${E}px)`
206
206
  };
207
- return L.opacity = Y, /* @__PURE__ */ $(
207
+ return ht.opacity = L, /* @__PURE__ */ $(
208
208
  "div",
209
209
  {
210
- ref: E,
210
+ ref: N,
211
211
  "data-testid": "virtual-scroll-tap-circle",
212
- className: ee("aqvs-tap-scroll-circle", t),
213
- style: L,
212
+ className: re("aqvs-tap-scroll-circle", t),
213
+ style: ht,
214
214
  tabIndex: -1,
215
- onPointerDown: bt,
216
- onPointerMove: lt,
217
- onPointerUp: it,
218
- onPointerCancel: it,
215
+ onPointerDown: pt,
216
+ onPointerMove: ct,
217
+ onPointerUp: st,
218
+ onPointerCancel: st,
219
219
  role: "presentation",
220
- children: G(Tt)
220
+ children: ut(Pt)
221
221
  }
222
222
  );
223
223
  })
224
224
  );
225
- _e.displayName = "TapScrollCircle";
226
- const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Pe = "virtualscroll:tap-scroll-cancel", Ve = 20, Ke = 250, We = 60, je = 20, Ge = 20, Ze = 240, Ce = { active: !1, offsetX: 0, offsetY: 0, distance: 0, direction: 0, pointerId: null }, Ie = 2.2, Je = 8, Qe = 120, tr = 1 / 60, Ht = {
225
+ Fe.displayName = "TapScrollCircle";
226
+ const xt = (n, t, e) => Math.min(e, Math.max(t, n)), Me = "virtualscroll:tap-scroll-cancel", Ce = 20, Ke = 250, We = 60, je = 20, Ge = 20, Ze = 240, Ee = { active: !1, offsetX: 0, offsetY: 0, distance: 0, direction: 0, pointerId: null }, Pe = 2.2, Je = 8, Qe = 120, tr = 1 / 60, Xt = {
227
227
  enabled: !0,
228
228
  size: 40,
229
229
  offsetX: -80,
@@ -257,267 +257,267 @@ const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Pe = "virtualscroll:tap-scr
257
257
  }, rr = (n, t) => {
258
258
  const e = n?.maxSpeedMultiplier, r = typeof e == "number" ? e : sr(t);
259
259
  return {
260
- enabled: n?.enabled ?? Ht.enabled,
261
- size: n?.size ?? Ht.size,
262
- offsetX: n?.offsetX ?? Ht.offsetX,
263
- offsetY: n?.offsetY ?? Ht.offsetY,
264
- className: n?.className ?? Ht.className,
265
- maxVisualDistance: n?.maxVisualDistance ?? Ht.maxVisualDistance,
260
+ enabled: n?.enabled ?? Xt.enabled,
261
+ size: n?.size ?? Xt.size,
262
+ offsetX: n?.offsetX ?? Xt.offsetX,
263
+ offsetY: n?.offsetY ?? Xt.offsetY,
264
+ className: n?.className ?? Xt.className,
265
+ maxVisualDistance: n?.maxVisualDistance ?? Xt.maxVisualDistance,
266
266
  maxSpeedMultiplier: r,
267
- minSpeedMultiplier: Math.max(n?.minSpeedMultiplier ?? Ht.minSpeedMultiplier, 0),
268
- opacity: pt(n?.opacity ?? Ht.opacity, 0, 1),
269
- renderVisual: n?.renderVisual ?? Ht.renderVisual,
270
- maxSpeedCurve: n?.maxSpeedCurve ?? Ht.maxSpeedCurve
267
+ minSpeedMultiplier: Math.max(n?.minSpeedMultiplier ?? Xt.minSpeedMultiplier, 0),
268
+ opacity: xt(n?.opacity ?? Xt.opacity, 0, 1),
269
+ renderVisual: n?.renderVisual ?? Xt.renderVisual,
270
+ maxSpeedCurve: n?.maxSpeedCurve ?? Xt.maxSpeedCurve
271
271
  };
272
- }, nr = ({ isDragging: n, isThumbHovered: t, enableThumbDrag: e }) => Vt(() => e ? n ? "dragging" : t ? "hover" : "idle" : "disabled", [e, n, t]), ir = ({ canUseArrowButtons: n, enableArrowButtons: t, resetTapScroll: e, scrollByStep: r }) => {
273
- const s = P(null), l = P(null), c = I(() => {
274
- s.current !== null && (window.clearInterval(s.current), s.current = null), l.current !== null && (window.clearTimeout(l.current), l.current = null);
275
- }, []), d = I(() => {
272
+ }, nr = ({ isDragging: n, isThumbHovered: t, enableThumbDrag: e }) => At(() => e ? n ? "dragging" : t ? "hover" : "idle" : "disabled", [e, n, t]), ir = ({ canUseArrowButtons: n, enableArrowButtons: t, resetTapScroll: e, scrollByStep: r }) => {
273
+ const i = T(null), l = T(null), c = P(() => {
274
+ i.current !== null && (window.clearInterval(i.current), i.current = null), l.current !== null && (window.clearTimeout(l.current), l.current = null);
275
+ }, []), d = P(() => {
276
276
  c();
277
- }, [c]), f = I(
277
+ }, [c]), f = P(
278
278
  (m) => (g) => {
279
- n && (g.preventDefault(), g.stopPropagation(), e(), c(), r(m), l.current = window.setTimeout(() => {
280
- s.current = window.setInterval(() => {
279
+ n && (g.cancelable && g.preventDefault(), g.stopPropagation(), e(), c(), r(m), l.current = window.setTimeout(() => {
280
+ i.current = window.setInterval(() => {
281
281
  r(m);
282
282
  }, We);
283
283
  }, Ke));
284
284
  },
285
285
  [n, c, e, r]
286
- ), p = I(
286
+ ), h = P(
287
287
  (m) => (g) => {
288
288
  t && (g.key === "Enter" || g.key === " " || g.key === "Spacebar") && (g.preventDefault(), r(m));
289
289
  },
290
290
  [t, r]
291
291
  );
292
- return B(() => () => {
292
+ return Y(() => () => {
293
293
  c();
294
- }, [c]), { handleArrowPointerDown: f, handleArrowPointerUp: d, handleArrowKeyDown: p };
294
+ }, [c]), { handleArrowPointerDown: f, handleArrowPointerUp: d, handleArrowKeyDown: h };
295
295
  }, sr = (n) => {
296
296
  if (!n || n <= 0)
297
- return Ie;
298
- const t = Math.max(1, n), e = Math.log10(t), r = Ie + e * Je;
299
- return pt(r, Ie, Qe);
297
+ return Pe;
298
+ const t = Math.max(1, n), e = Math.log10(t), r = Pe + e * Je;
299
+ return xt(r, Pe, Qe);
300
300
  }, or = ({
301
301
  contentSize: n,
302
302
  viewportSize: t,
303
303
  scrollPosition: e,
304
304
  onScroll: r,
305
- enableThumbDrag: s = !0,
305
+ enableThumbDrag: i = !0,
306
306
  enableTrackClick: l = !0,
307
307
  enableArrowButtons: c = !0,
308
308
  horizontal: d = !1,
309
309
  scrollBarWidth: f = 12,
310
- className: p,
310
+ className: h,
311
311
  ariaControls: m,
312
312
  tapScrollCircleOptions: g,
313
- itemCount: E,
313
+ itemCount: N,
314
314
  renderThumbOverlay: x,
315
- visibleStartIndex: A,
316
- visibleEndIndex: U
315
+ visibleStartIndex: k,
316
+ visibleEndIndex: B
317
317
  }) => {
318
- const [q, Q] = Bt(!1), [bt, lt] = Bt(!1), [it, Y] = Bt(!1), tt = P(null), C = P({ pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }), K = P({ pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }), G = P(e), Tt = P(r), L = P(Ce), D = P(null), Z = P(null), J = P(null), W = Vt(() => rr(g, E), [E, g]), F = Vt(() => er(d), [d]), {
319
- enabled: It,
320
- size: ct,
321
- offsetX: vt,
322
- offsetY: T,
323
- className: Mt,
324
- maxVisualDistance: b,
325
- maxSpeedMultiplier: St,
326
- minSpeedMultiplier: yt,
327
- opacity: Ot,
328
- renderVisual: v,
329
- maxSpeedCurve: N
330
- } = W, k = P({
318
+ const [z, Q] = Bt(!1), [pt, ct] = Bt(!1), [st, L] = Bt(!1), tt = T(null), et = T({ pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }), E = T({ pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }), ut = T(e), Pt = T(r), ht = T(Ee), I = T(null), W = T(null), St = T(null), Dt = At(() => rr(g, N), [N, g]), ot = At(() => er(d), [d]), {
319
+ enabled: A,
320
+ size: G,
321
+ offsetX: dt,
322
+ offsetY: It,
323
+ className: v,
324
+ maxVisualDistance: kt,
325
+ maxSpeedMultiplier: S,
326
+ minSpeedMultiplier: rt,
327
+ opacity: Vt,
328
+ renderVisual: Gt,
329
+ maxSpeedCurve: Mt
330
+ } = Dt, b = T({
331
331
  viewportSize: t,
332
332
  maxScrollPosition: Math.max(n - t, 0),
333
333
  scrollBarVisible: n > t,
334
- effectiveTapMaxDistance: Math.max(b, 1),
335
- tapCircleMaxSpeedMultiplier: St,
336
- tapCircleMinSpeedMultiplier: yt,
337
- tapCircleMaxSpeedCurve: N,
334
+ effectiveTapMaxDistance: Math.max(kt, 1),
335
+ tapCircleMaxSpeedMultiplier: S,
336
+ tapCircleMinSpeedMultiplier: rt,
337
+ tapCircleMaxSpeedCurve: Mt,
338
338
  tapScrollCircleOptions: g,
339
339
  effectiveTrackLength: 0,
340
340
  onScroll: r,
341
341
  scrollPosition: e
342
- }), { mainSizeKey: et, crossSizeKey: ut, positionKey: Dt, selectDelta: mt, getPointerCoordinate: st, arrowLabels: ot, arrowIcons: Ct, directionClass: Et, orientation: wt } = F, At = Math.max(b, 1), Xt = t / n, ht = Math.max(t - f * 2, 0), h = Xt * ht, M = Math.min(Math.max(Ve, h || 0), ht || Ve), j = n - t, at = Math.max(ht - M, 0), dt = j <= 0 || at <= 0 ? 0 : e / j * at, Yt = dt + M / 2, ft = n > t || q, zt = ft && c;
343
- ae(() => {
344
- k.current = {
342
+ }), { mainSizeKey: M, crossSizeKey: q, positionKey: ft, selectDelta: j, getPointerCoordinate: mt, arrowLabels: Z, arrowIcons: J, directionClass: bt, orientation: qt } = ot, yt = Math.max(kt, 1), Tt = t / n, Ct = Math.max(t - f * 2, 0), _t = Tt * Ct, at = Math.min(Math.max(Ce, _t || 0), Ct || Ce), p = n - t, y = Math.max(Ct - at, 0), nt = p <= 0 || y <= 0 ? 0 : e / p * y, Lt = nt + at / 2, H = n > t || z, Zt = H && c;
343
+ oe(() => {
344
+ b.current = {
345
345
  viewportSize: t,
346
- maxScrollPosition: j,
347
- scrollBarVisible: ft,
348
- effectiveTapMaxDistance: At,
349
- tapCircleMaxSpeedMultiplier: St,
350
- tapCircleMinSpeedMultiplier: yt,
351
- tapCircleMaxSpeedCurve: N,
346
+ maxScrollPosition: p,
347
+ scrollBarVisible: H,
348
+ effectiveTapMaxDistance: yt,
349
+ tapCircleMaxSpeedMultiplier: S,
350
+ tapCircleMinSpeedMultiplier: rt,
351
+ tapCircleMaxSpeedCurve: Mt,
352
352
  tapScrollCircleOptions: g,
353
- effectiveTrackLength: at,
353
+ effectiveTrackLength: y,
354
354
  onScroll: r,
355
355
  scrollPosition: e
356
356
  };
357
- }), ae(() => {
358
- G.current = e;
359
- }, [e]), ae(() => {
360
- Tt.current = r;
361
- }, [r]), B(() => {
362
- s || lt(!1);
363
- }, [s]);
364
- const Zt = nr({ isDragging: q, isThumbHovered: bt, enableThumbDrag: s }), Nt = I((o, S) => {
365
- const R = k.current, i = S ?? G.current;
366
- if (Tt.current) {
367
- const w = Tt.current(o, i);
368
- if (typeof w == "number" && Number.isFinite(w))
369
- return G.current = w, w;
357
+ }), oe(() => {
358
+ ut.current = e;
359
+ }, [e]), oe(() => {
360
+ Pt.current = r;
361
+ }, [r]), Y(() => {
362
+ i || ct(!1);
363
+ }, [i]);
364
+ const Ft = nr({ isDragging: z, isThumbHovered: pt, enableThumbDrag: i }), wt = P((o, w) => {
365
+ const V = b.current, K = w ?? ut.current;
366
+ if (Pt.current) {
367
+ const R = Pt.current(o, K);
368
+ if (typeof R == "number" && Number.isFinite(R))
369
+ return ut.current = R, R;
370
370
  }
371
- const a = typeof o == "function" ? o(i) : o, u = Math.max(R.maxScrollPosition, 0), y = R.scrollBarVisible ? pt(a, 0, u) : 0;
372
- return G.current = y, y;
373
- }, []), Ut = I(
371
+ const s = typeof o == "function" ? o(K) : o, a = Math.max(V.maxScrollPosition, 0), u = V.scrollBarVisible ? xt(s, 0, a) : 0;
372
+ return ut.current = u, u;
373
+ }, []), Ht = P(
374
374
  (o) => {
375
- const S = k.current, R = G.current;
376
- if (!S.scrollBarVisible || S.maxScrollPosition <= 0) {
377
- const w = Nt(0, R), V = w - R;
378
- return { nextPosition: w, actualDelta: V, reachedBoundary: !0 };
375
+ const w = b.current, V = ut.current;
376
+ if (!w.scrollBarVisible || w.maxScrollPosition <= 0) {
377
+ const R = wt(0, V), D = R - V;
378
+ return { nextPosition: R, actualDelta: D, reachedBoundary: !0 };
379
379
  }
380
380
  if (o === 0)
381
- return { nextPosition: R, actualDelta: 0, reachedBoundary: !1 };
382
- const a = Nt((w) => pt(w + o, 0, S.maxScrollPosition), R), u = a - R, y = u === 0 || o < 0 && a <= 0 || o > 0 && a >= S.maxScrollPosition;
383
- return { nextPosition: a, actualDelta: u, reachedBoundary: y };
381
+ return { nextPosition: V, actualDelta: 0, reachedBoundary: !1 };
382
+ const s = wt((R) => xt(R + o, 0, w.maxScrollPosition), V), a = s - V, u = a === 0 || o < 0 && s <= 0 || o > 0 && s >= w.maxScrollPosition;
383
+ return { nextPosition: s, actualDelta: a, reachedBoundary: u };
384
384
  },
385
- [Nt]
386
- ), Pt = I(() => {
387
- Z.current !== null && (window.cancelAnimationFrame(Z.current), Z.current = null), J.current = null;
388
- }, []), Rt = I(() => {
389
- L.current = { ...Ce }, Y(!1), D.current?.reset(), Pt();
390
- }, [Pt]), Qt = I(
385
+ [wt]
386
+ ), gt = P(() => {
387
+ W.current !== null && (window.cancelAnimationFrame(W.current), W.current = null), St.current = null;
388
+ }, []), Rt = P(() => {
389
+ ht.current = { ...Ee }, L(!1), I.current?.reset(), gt();
390
+ }, [gt]), Jt = P(
391
391
  (o) => {
392
- const S = L.current, R = k.current;
393
- if (!S.active || S.direction === 0) {
394
- Pt();
392
+ const w = ht.current, V = b.current;
393
+ if (!w.active || w.direction === 0) {
394
+ gt();
395
395
  return;
396
396
  }
397
- if (!R.scrollBarVisible || R.maxScrollPosition <= 0) {
398
- Pt();
397
+ if (!V.scrollBarVisible || V.maxScrollPosition <= 0) {
398
+ gt();
399
399
  return;
400
400
  }
401
- const i = J.current ?? o, a = Math.max((o - i) / 1e3, 0), u = Math.min(a, tr);
402
- if (J.current = o, u <= 0) {
403
- Z.current = window.requestAnimationFrame(Qt);
401
+ const K = St.current ?? o, s = Math.max((o - K) / 1e3, 0), a = Math.min(s, tr);
402
+ if (St.current = o, a <= 0) {
403
+ W.current = window.requestAnimationFrame(Jt);
404
404
  return;
405
405
  }
406
- const y = Math.min(S.distance, R.effectiveTapMaxDistance) / R.effectiveTapMaxDistance, w = y ** 1.1, V = typeof R.tapScrollCircleOptions?.maxSpeedMultiplier == "number", z = Math.max(R.viewportSize * R.tapCircleMinSpeedMultiplier, 40), X = V ? z : 1200;
407
- let H = Math.max(R.viewportSize * R.tapCircleMaxSpeedMultiplier, X);
408
- const gt = R.tapCircleMaxSpeedCurve;
409
- if (gt) {
410
- const he = Math.max(gt.exponentialSteepness, 0), Oe = Math.max(gt.exponentialScale ?? R.tapCircleMaxSpeedMultiplier, 0), Ye = he === 0 ? y : Math.expm1(he * y), we = he === 0 ? 1 : Math.expm1(he) || 1, ze = we === 0 ? y : Math.min(Math.max(Ye / we, 0), 1), qe = R.viewportSize * Oe * ze;
411
- H = Math.min(H, Math.max(qe, z));
406
+ const u = Math.min(w.distance, V.effectiveTapMaxDistance) / V.effectiveTapMaxDistance, R = u ** 1.1, D = typeof V.tapScrollCircleOptions?.maxSpeedMultiplier == "number", C = Math.max(V.viewportSize * V.tapCircleMinSpeedMultiplier, 40), X = D ? C : 1200;
407
+ let F = Math.max(V.viewportSize * V.tapCircleMaxSpeedMultiplier, X);
408
+ const O = V.tapCircleMaxSpeedCurve;
409
+ if (O) {
410
+ const xe = Math.max(O.exponentialSteepness, 0), Oe = Math.max(O.exponentialScale ?? V.tapCircleMaxSpeedMultiplier, 0), Ye = xe === 0 ? u : Math.expm1(xe * u), Re = xe === 0 ? 1 : Math.expm1(xe) || 1, ze = Re === 0 ? u : Math.min(Math.max(Ye / Re, 0), 1), qe = V.viewportSize * Oe * ze;
411
+ F = Math.min(F, Math.max(qe, C));
412
412
  }
413
- const xt = Math.max(H, z), Lt = Math.max(gt?.easedOffset ?? 0, 0), Jt = Math.min(1, w + Lt), ce = z + (xt - z) * Jt, ue = S.direction * ce * u, { actualDelta: Fe, reachedBoundary: Le } = Ut(ue);
414
- if (Le || Fe === 0) {
415
- Pt();
413
+ const Et = Math.max(F, C), vt = Math.max(O?.easedOffset ?? 0, 0), zt = Math.min(1, R + vt), te = C + (Et - C) * zt, ue = w.direction * te * a, { actualDelta: de, reachedBoundary: Le } = Ht(ue);
414
+ if (Le || de === 0) {
415
+ gt();
416
416
  return;
417
417
  }
418
- Z.current = window.requestAnimationFrame(Qt);
418
+ W.current = window.requestAnimationFrame(Jt);
419
419
  },
420
- [Ut, Pt]
421
- ), rt = I(() => {
422
- Z.current === null && (J.current = null, Z.current = window.requestAnimationFrame(Qt));
423
- }, [Qt]);
424
- B(() => () => {
425
- Pt();
426
- }, [Pt]);
427
- const fe = I(
420
+ [Ht, gt]
421
+ ), ae = P(() => {
422
+ W.current === null && (St.current = null, W.current = window.requestAnimationFrame(Jt));
423
+ }, [Jt]);
424
+ Y(() => () => {
425
+ gt();
426
+ }, [gt]);
427
+ const lt = P(
428
428
  (o) => {
429
- L.current = o, Y(o.active), o.active && o.direction !== 0 ? rt() : Pt();
429
+ ht.current = o, L(o.active), o.active && o.direction !== 0 ? ae() : gt();
430
430
  },
431
- [rt, Pt]
431
+ [ae, gt]
432
432
  );
433
- B(() => {
434
- It || Rt();
435
- }, [Rt, It]), B(() => {
436
- const o = (S) => {
437
- const i = S.detail?.paneId;
438
- i && m && i !== m || Rt();
433
+ Y(() => {
434
+ A || Rt();
435
+ }, [Rt, A]), Y(() => {
436
+ const o = (w) => {
437
+ const K = w.detail?.paneId;
438
+ K && m && K !== m || Rt();
439
439
  };
440
- return window.addEventListener(Pe, o), () => {
441
- window.removeEventListener(Pe, o);
440
+ return window.addEventListener(Me, o), () => {
441
+ window.removeEventListener(Me, o);
442
442
  };
443
- }, [m, Rt]), B(() => {
444
- if (!It)
443
+ }, [m, Rt]), Y(() => {
444
+ if (!A)
445
445
  return;
446
- const o = (S) => {
447
- if (!L.current.active || L.current.pointerId === S.pointerId)
446
+ const o = (w) => {
447
+ if (!ht.current.active || ht.current.pointerId === w.pointerId)
448
448
  return;
449
- const R = S.target;
450
- if (!(R instanceof Node)) {
449
+ const V = w.target;
450
+ if (!(V instanceof Node)) {
451
451
  Rt();
452
452
  return;
453
453
  }
454
- D.current?.getElement()?.contains(R) || Rt();
454
+ I.current?.getElement()?.contains(V) || Rt();
455
455
  };
456
456
  return document.addEventListener("pointerdown", o, !0), () => {
457
457
  document.removeEventListener("pointerdown", o, !0);
458
458
  };
459
- }, [Rt, It]);
459
+ }, [Rt, A]);
460
460
  const le = (o) => {
461
- if (!ft || at <= 0 || j <= 0)
461
+ if (!H || y <= 0 || p <= 0)
462
462
  return 0;
463
- const S = pt(o, 0, at);
464
- return pt(S / at * j, 0, j);
465
- }, kt = I((o) => {
466
- const { scrollBarVisible: S, effectiveTrackLength: R, maxScrollPosition: i } = k.current;
467
- if (_.debug("[ScrollBar] calculateScrollPositionFromThumb", { thumbPos: o, trackLen: R, maxScroll: i }), R <= 0 || i <= 0)
463
+ const w = xt(o, 0, y);
464
+ return xt(w / y * p, 0, p);
465
+ }, ce = P((o) => {
466
+ const { scrollBarVisible: w, effectiveTrackLength: V, maxScrollPosition: K } = b.current;
467
+ if (_.debug("[ScrollBar] calculateScrollPositionFromThumb", { thumbPos: o, trackLen: V, maxScroll: K }), V <= 0 || K <= 0)
468
468
  return null;
469
- const a = pt(o, 0, R);
470
- return pt(a / R * i, 0, i);
471
- }, []), ne = I(
469
+ const s = xt(o, 0, V);
470
+ return xt(s / V * K, 0, K);
471
+ }, []), Nt = P(
472
472
  (o) => {
473
- const S = C.current;
474
- if (S.pointerId !== o.pointerId)
473
+ const w = et.current;
474
+ if (w.pointerId !== o.pointerId)
475
475
  return;
476
- const R = o.clientX - S.startClientX, i = o.clientY - S.startClientY, a = mt(R, i);
476
+ const V = o.clientX - w.startClientX, K = o.clientY - w.startClientY, s = j(V, K);
477
477
  _.debug("[ScrollBar] handleThumbPointerMove", {
478
- delta: a,
479
- startThumbPosition: S.startThumbPosition,
478
+ delta: s,
479
+ startThumbPosition: w.startThumbPosition,
480
480
  clientY: o.clientY,
481
- startClientY: S.startClientY,
482
- metrics: k.current
481
+ startClientY: w.startClientY,
482
+ metrics: b.current
483
483
  });
484
- const u = kt(S.startThumbPosition + a);
485
- u !== null && Nt(u), o.cancelable && o.preventDefault();
484
+ const a = ce(w.startThumbPosition + s);
485
+ a !== null && wt(a), o.cancelable && o.preventDefault();
486
486
  },
487
- [mt, kt, Nt]
488
- ), te = I(
487
+ [j, ce, wt]
488
+ ), ee = P(
489
489
  (o) => {
490
- if (C.current.pointerId === o.pointerId)
491
- if (document.removeEventListener("pointermove", ne), document.removeEventListener("pointerup", te), document.removeEventListener("pointercancel", te), C.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }, Q(!1), tt.current) {
492
- const R = tt.current.getBoundingClientRect();
493
- o.clientX >= R.left && o.clientX <= R.right && o.clientY >= R.top && o.clientY <= R.bottom || lt(!1);
490
+ if (et.current.pointerId === o.pointerId)
491
+ if (document.removeEventListener("pointermove", Nt), document.removeEventListener("pointerup", ee), document.removeEventListener("pointercancel", ee), et.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }, Q(!1), tt.current) {
492
+ const V = tt.current.getBoundingClientRect();
493
+ o.clientX >= V.left && o.clientX <= V.right && o.clientY >= V.top && o.clientY <= V.bottom || ct(!1);
494
494
  } else
495
- lt(!1);
495
+ ct(!1);
496
496
  },
497
- [ne]
498
- ), be = (o) => {
499
- const S = Math.max(Math.round(t / Ge), je);
500
- Ut(o * S);
501
- }, { handleArrowPointerDown: qt, handleArrowPointerUp: _t, handleArrowKeyDown: $t } = ir({
502
- canUseArrowButtons: zt,
497
+ [Nt]
498
+ ), me = (o) => {
499
+ const w = Math.max(Math.round(t / Ge), je);
500
+ Ht(o * w);
501
+ }, { handleArrowPointerDown: Ie, handleArrowPointerUp: Ot, handleArrowKeyDown: Qt } = ir({
502
+ canUseArrowButtons: Zt,
503
503
  enableArrowButtons: c,
504
504
  resetTapScroll: Rt,
505
- scrollByStep: be
506
- }), Kt = (o) => {
507
- if (ft) {
508
- if (!s) {
505
+ scrollByStep: me
506
+ }), Ut = (o) => {
507
+ if (H) {
508
+ if (!i) {
509
509
  o.preventDefault(), o.stopPropagation();
510
510
  return;
511
511
  }
512
- o.pointerType === "mouse" && o.button !== 0 || o.ctrlKey || (Rt(), C.current = {
512
+ o.pointerType === "mouse" && o.button !== 0 || o.ctrlKey || (Rt(), et.current = {
513
513
  pointerId: o.pointerId,
514
- startThumbPosition: dt,
514
+ startThumbPosition: nt,
515
515
  startClientX: o.clientX,
516
516
  startClientY: o.clientY
517
- }, document.addEventListener("pointermove", ne), document.addEventListener("pointerup", te), document.addEventListener("pointercancel", te), Q(!0), lt(!0), o.preventDefault(), o.stopPropagation());
517
+ }, document.addEventListener("pointermove", Nt), document.addEventListener("pointerup", ee), document.addEventListener("pointercancel", ee), Q(!0), ct(!0), o.preventDefault(), o.stopPropagation());
518
518
  }
519
- }, Ft = (o) => {
520
- if (!ft)
519
+ }, $t = (o) => {
520
+ if (!H)
521
521
  return;
522
522
  if (!l) {
523
523
  o.preventDefault(), o.stopPropagation();
@@ -525,152 +525,150 @@ const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Pe = "virtualscroll:tap-scr
525
525
  }
526
526
  if (o.pointerType === "mouse" && o.button !== 0 || o.ctrlKey)
527
527
  return;
528
- const S = o.currentTarget, R = S.getBoundingClientRect(), a = st(o) - (d ? R.left : R.top);
528
+ const w = o.currentTarget, V = w.getBoundingClientRect(), s = mt(o) - (d ? V.left : V.top);
529
529
  Rt();
530
- const u = a - M / 2, y = le(u);
531
- Nt(y), S.setPointerCapture && S.setPointerCapture(o.pointerId), K.current = {
530
+ const a = s - at / 2, u = le(a);
531
+ wt(u), w.setPointerCapture && w.setPointerCapture(o.pointerId), E.current = {
532
532
  pointerId: o.pointerId,
533
- startThumbPosition: u,
533
+ startThumbPosition: a,
534
534
  startClientX: o.clientX,
535
535
  startClientY: o.clientY
536
536
  }, o.preventDefault(), o.stopPropagation();
537
- }, Wt = (o) => {
538
- const S = K.current;
539
- if (S.pointerId !== o.pointerId)
537
+ }, Yt = (o) => {
538
+ const w = E.current;
539
+ if (w.pointerId !== o.pointerId)
540
540
  return;
541
- const R = o.clientX - S.startClientX, i = o.clientY - S.startClientY, a = mt(R, i), u = le(S.startThumbPosition + a);
542
- Nt(u), o.cancelable && o.preventDefault();
543
- }, jt = (o) => {
544
- if (K.current.pointerId !== o.pointerId)
541
+ const V = o.clientX - w.startClientX, K = o.clientY - w.startClientY, s = j(V, K), a = le(w.startThumbPosition + s);
542
+ wt(a), o.cancelable && o.preventDefault();
543
+ }, Kt = (o) => {
544
+ if (E.current.pointerId !== o.pointerId)
545
545
  return;
546
- const S = o.currentTarget;
547
- S.hasPointerCapture(o.pointerId) && S.releasePointerCapture(o.pointerId), K.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }, o.preventDefault(), o.stopPropagation();
548
- }, me = (o) => {
549
- if (K.current.pointerId !== o.pointerId)
546
+ const w = o.currentTarget;
547
+ w.hasPointerCapture(o.pointerId) && w.releasePointerCapture(o.pointerId), E.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }, o.preventDefault(), o.stopPropagation();
548
+ }, Wt = (o) => {
549
+ if (E.current.pointerId !== o.pointerId)
550
550
  return;
551
- const S = o.currentTarget;
552
- S.hasPointerCapture(o.pointerId) && S.releasePointerCapture(o.pointerId), K.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 };
553
- }, pe = Vt(() => pt((it ? 1 : 0.8) * Ot, 0, 1), [it, Ot]), ve = Vt(() => {
554
- const S = `calc(50% - ${ct / 2}px + ${T}px)`;
551
+ const w = o.currentTarget;
552
+ w.hasPointerCapture(o.pointerId) && w.releasePointerCapture(o.pointerId), E.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 };
553
+ }, pe = At(() => xt((st ? 1 : 0.8) * Vt, 0, 1), [st, Vt]), he = At(() => {
554
+ const w = `calc(50% - ${G / 2}px + ${It}px)`;
555
555
  return {
556
- left: vt,
557
- top: S
556
+ left: dt,
557
+ top: w
558
558
  };
559
- }, [vt, T, ct]), ie = (o, S, R, i) => /* @__PURE__ */ $(
559
+ }, [dt, It, G]), ge = (o, w, V, K) => /* @__PURE__ */ $(
560
560
  "button",
561
561
  {
562
562
  type: "button",
563
563
  tabIndex: -1,
564
564
  className: "aqvs-scrollbar-arrow-button",
565
565
  style: {
566
- [et]: f,
567
- [ut]: f
566
+ [M]: f,
567
+ [q]: f
568
568
  },
569
- "aria-label": S,
570
- onMouseDown: qt(o),
571
- onTouchStart: qt(o),
572
- onMouseUp: _t,
573
- onMouseLeave: _t,
574
- onTouchEnd: _t,
575
- onTouchCancel: _t,
576
- onKeyDown: $t(o),
569
+ "aria-label": w,
570
+ onPointerDown: Ie(o),
571
+ onPointerUp: Ot,
572
+ onPointerLeave: Ot,
573
+ onPointerCancel: Ot,
574
+ onKeyDown: Qt(o),
577
575
  "aria-disabled": !c,
578
- disabled: !zt,
579
- children: /* @__PURE__ */ $("span", { "aria-hidden": "true", children: R })
576
+ disabled: !Zt,
577
+ children: /* @__PURE__ */ $("span", { "aria-hidden": "true", children: V })
580
578
  },
581
- i
582
- ), se = x && ft ? {
583
- orientation: wt,
579
+ K
580
+ ), ie = x && H ? {
581
+ orientation: qt,
584
582
  scrollPosition: e,
585
- maxScrollPosition: j,
583
+ maxScrollPosition: p,
586
584
  contentSize: n,
587
585
  viewportSize: t,
588
- thumbSize: M,
589
- thumbPosition: dt,
590
- thumbCenter: Yt,
591
- trackSize: ht,
592
- isDragging: q,
593
- isTapScrollActive: it,
594
- visibleStartIndex: A,
595
- visibleEndIndex: U
586
+ thumbSize: at,
587
+ thumbPosition: nt,
588
+ thumbCenter: Lt,
589
+ trackSize: Ct,
590
+ isDragging: z,
591
+ isTapScrollActive: st,
592
+ visibleStartIndex: k,
593
+ visibleEndIndex: B
596
594
  } : null;
597
- return /* @__PURE__ */ re(
595
+ return /* @__PURE__ */ ne(
598
596
  "div",
599
597
  {
600
- className: ee("aqvs-scrollbar", Et, !ft && "pointer-events-none opacity-0", p),
598
+ className: re("aqvs-scrollbar", bt, !H && "pointer-events-none opacity-0", h),
601
599
  style: {
602
- [et]: t,
603
- [ut]: f
600
+ [M]: t,
601
+ [q]: f
604
602
  },
605
603
  role: "scrollbar",
606
604
  tabIndex: -1,
607
605
  "aria-controls": m,
608
606
  "aria-valuenow": e,
609
607
  "aria-valuemin": 0,
610
- "aria-valuemax": j,
608
+ "aria-valuemax": p,
611
609
  "aria-orientation": d ? "horizontal" : "vertical",
612
610
  children: [
613
- !d && ft && It && /* @__PURE__ */ $(
614
- _e,
611
+ !d && H && A && /* @__PURE__ */ $(
612
+ Fe,
615
613
  {
616
- ref: D,
617
- className: ee("aqvs-scrollbar-tap-circle-wrapper", Mt),
618
- size: ct,
619
- maxVisualDistance: At,
620
- style: ve,
614
+ ref: I,
615
+ className: re("aqvs-scrollbar-tap-circle-wrapper", v),
616
+ size: G,
617
+ maxVisualDistance: yt,
618
+ style: he,
621
619
  opacity: pe,
622
- renderVisual: v,
623
- onDragChange: fe
620
+ renderVisual: Gt,
621
+ onDragChange: lt
624
622
  },
625
623
  "tap-circle"
626
624
  ),
627
- ie(-1, ot[0], Ct[0], "arrow-start"),
628
- /* @__PURE__ */ re(
625
+ ge(-1, Z[0], J[0], "arrow-start"),
626
+ /* @__PURE__ */ ne(
629
627
  "div",
630
628
  {
631
629
  className: "aqvs-scrollbar-track",
632
630
  style: {
633
631
  borderRadius: f / 2
634
632
  },
635
- onPointerDown: Ft,
636
- onPointerMove: Wt,
637
- onPointerUp: jt,
638
- onPointerCancel: me,
633
+ onPointerDown: $t,
634
+ onPointerMove: Yt,
635
+ onPointerUp: Kt,
636
+ onPointerCancel: Wt,
639
637
  "aria-disabled": !l,
640
638
  children: [
641
- se && /* @__PURE__ */ $("div", { className: "aqvs-scrollbar-overlay", "aria-hidden": !0, children: x?.(se) }, "overlay"),
639
+ ie && /* @__PURE__ */ $("div", { className: "aqvs-scrollbar-overlay", "aria-hidden": !0, children: x?.(ie) }, "overlay"),
642
640
  /* @__PURE__ */ $(
643
641
  "div",
644
642
  {
645
- className: ee("aqvs-scrollbar-thumb-wrapper", !(ft || q) && "pointer-events-none opacity-0"),
643
+ className: re("aqvs-scrollbar-thumb-wrapper", !(H || z) && "pointer-events-none opacity-0"),
646
644
  style: {
647
- [et]: M,
648
- [Dt]: dt,
645
+ [M]: at,
646
+ [ft]: nt,
649
647
  ...d ? { top: 0, bottom: 0 } : { left: 0, right: 0 }
650
648
  },
651
- onPointerDown: Kt,
649
+ onPointerDown: Ut,
652
650
  role: "slider",
653
651
  "aria-orientation": d ? "horizontal" : "vertical",
654
652
  "aria-valuenow": e,
655
653
  "aria-valuemin": 0,
656
- "aria-valuemax": j,
657
- "aria-disabled": !s,
654
+ "aria-valuemax": p,
655
+ "aria-disabled": !i,
658
656
  tabIndex: -1,
659
657
  children: /* @__PURE__ */ $(
660
658
  "div",
661
659
  {
662
660
  ref: tt,
663
- className: ee("aqvs-scrollbar-thumb", d ? "aqvs-scrollbar-thumb-horizontal" : "aqvs-scrollbar-thumb-vertical"),
664
- "data-thumb-state": Zt,
661
+ className: re("aqvs-scrollbar-thumb", d ? "aqvs-scrollbar-thumb-horizontal" : "aqvs-scrollbar-thumb-vertical"),
662
+ "data-thumb-state": Ft,
665
663
  style: {
666
664
  borderRadius: f - 1,
667
- cursor: s ? "pointer" : "default"
665
+ cursor: i ? "pointer" : "default"
668
666
  },
669
667
  onMouseEnter: () => {
670
- s && lt(!0);
668
+ i && ct(!0);
671
669
  },
672
670
  onMouseLeave: () => {
673
- s && lt(!1);
671
+ i && ct(!1);
674
672
  }
675
673
  },
676
674
  "thumb"
@@ -682,172 +680,186 @@ const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Pe = "virtualscroll:tap-scr
682
680
  },
683
681
  "track"
684
682
  ),
685
- ie(1, ot[1], Ct[1], "arrow-end")
683
+ ge(1, Z[1], J[1], "arrow-end")
686
684
  ]
687
685
  }
688
686
  );
689
- }, de = {
687
+ }, fe = {
690
688
  maxVelocity: 6,
691
689
  minVelocity: 0.02,
692
690
  deceleration: 25e-4,
693
691
  velocitySampleWindow: 90,
694
692
  startVelocityThreshold: 0.04
695
- }, ge = (n, t, e) => {
696
- for (const [r, s, l] of t)
697
- e === "add" ? n.addEventListener(r, s, l) : n.removeEventListener(r, s, l);
698
- }, ar = Me(
693
+ }, be = (n, t, e) => {
694
+ for (const [r, i, l] of t)
695
+ e === "add" ? n.addEventListener(r, i, l) : n.removeEventListener(r, i, l);
696
+ }, ar = ye(
699
697
  ({
700
698
  children: n,
701
699
  contentSize: t,
702
700
  viewportSize: e,
703
701
  scrollBarWidth: r = 12,
704
- enableThumbDrag: s = !0,
702
+ enableThumbDrag: i = !0,
705
703
  enableTrackClick: l = !0,
706
704
  enableArrowButtons: c = !0,
707
705
  enablePointerDrag: d = !0,
708
706
  onScroll: f,
709
- className: p,
707
+ className: h,
710
708
  style: m,
711
709
  background: g,
712
- tapScrollCircleOptions: E,
710
+ tapScrollCircleOptions: N,
713
711
  inertiaOptions: x,
714
- itemCount: A,
715
- renderThumbOverlay: U,
716
- wheelSpeedMultiplier: q = 1,
717
- contentInsets: Q,
718
- visibleStartIndex: bt,
719
- visibleEndIndex: lt,
720
- renderOverlay: it,
721
- initialScrollPosition: Y = 0
722
- }, tt) => {
723
- const C = P(Y), K = P(null), G = P(null), Tt = P({
712
+ itemCount: k,
713
+ renderThumbOverlay: B,
714
+ wheelSpeedMultiplier: z = 1,
715
+ onWheelHorizontal: Q,
716
+ contentInsets: pt,
717
+ visibleStartIndex: ct,
718
+ visibleEndIndex: st,
719
+ renderOverlay: L,
720
+ initialScrollPosition: tt = 0
721
+ }, et) => {
722
+ const E = T(tt), ut = T(null), Pt = T(null), ht = T(Q);
723
+ Y(() => {
724
+ ht.current = Q;
725
+ }, [Q]);
726
+ const I = T({
724
727
  frame: null,
725
728
  velocity: 0,
726
729
  lastTimestamp: null
727
- }), L = Vt(
730
+ }), W = At(
728
731
  () => ({
729
- maxVelocity: x?.maxVelocity ?? de.maxVelocity,
730
- minVelocity: x?.minVelocity ?? de.minVelocity,
731
- deceleration: x?.deceleration ?? de.deceleration,
732
- velocitySampleWindow: x?.velocitySampleWindow ?? de.velocitySampleWindow,
733
- startVelocityThreshold: x?.startVelocityThreshold ?? de.startVelocityThreshold
732
+ maxVelocity: x?.maxVelocity ?? fe.maxVelocity,
733
+ minVelocity: x?.minVelocity ?? fe.minVelocity,
734
+ deceleration: x?.deceleration ?? fe.deceleration,
735
+ velocitySampleWindow: x?.velocitySampleWindow ?? fe.velocitySampleWindow,
736
+ startVelocityThreshold: x?.startVelocityThreshold ?? fe.startVelocityThreshold
734
737
  }),
735
738
  [x]
736
- ), D = Vt(() => ({
737
- top: Math.max(0, Q?.top ?? 0),
738
- bottom: Math.max(0, Q?.bottom ?? 0)
739
- }), [Q]);
739
+ ), St = At(() => ({
740
+ top: Math.max(0, pt?.top ?? 0),
741
+ bottom: Math.max(0, pt?.bottom ?? 0)
742
+ }), [pt]);
740
743
  _.debug("[ScrollPane] ScrollPane rendered", {
741
744
  contentSize: t,
742
745
  viewportSize: e,
743
746
  scrollBarWidth: r,
744
- className: p,
747
+ className: h,
745
748
  style: m,
746
- tapScrollCircleOptions: E,
749
+ tapScrollCircleOptions: N,
747
750
  inertiaOptions: x,
748
751
  enablePointerDrag: d,
749
- contentInsets: D
752
+ contentInsets: St
750
753
  });
751
- const Z = P({ contentSize: t, viewportSize: e });
752
- Z.current = { contentSize: t, viewportSize: e };
753
- const J = Vt(() => t > e, [t, e]), W = I(
754
- (v) => {
755
- const { contentSize: N, viewportSize: k } = Z.current, et = N > k, ut = C.current;
756
- if (_.debug("[ScrollPane] scrollTo called", { newPosition: v, contentSize: N, viewportSize: k, currentIsScrollable: et, prevPosition: ut }), !et)
757
- return C.current !== 0 && (C.current = 0, f?.(0, ut)), C.current;
758
- const Dt = typeof v == "function" ? v(C.current) : v, mt = Math.max(N - k, 0), st = pt(Dt, 0, mt);
759
- return C.current !== st && (C.current = st, f?.(st, ut)), C.current;
754
+ const Dt = T({ contentSize: t, viewportSize: e });
755
+ Dt.current = { contentSize: t, viewportSize: e };
756
+ const ot = At(() => t > e, [t, e]), A = P(
757
+ (b) => {
758
+ const { contentSize: M, viewportSize: q } = Dt.current, ft = M > q, j = E.current;
759
+ if (_.debug("[ScrollPane] scrollTo called", { newPosition: b, contentSize: M, viewportSize: q, currentIsScrollable: ft, prevPosition: j }), !ft)
760
+ return E.current !== 0 && (E.current = 0, f?.(0, j)), E.current;
761
+ const mt = typeof b == "function" ? b(E.current) : b, Z = Math.max(M - q, 0), J = xt(mt, 0, Z);
762
+ return E.current !== J && (E.current = J, f?.(J, j)), E.current;
760
763
  },
761
764
  [f]
762
- ), F = I(() => {
763
- const v = Tt.current;
764
- v.frame !== null && cancelAnimationFrame(v.frame), v.frame = null, v.velocity = 0, v.lastTimestamp = null;
765
- }, []), It = P(F);
766
- B(() => {
767
- It.current = F;
768
- }, [F]);
769
- const ct = I(
770
- (v) => {
771
- if (!J)
765
+ ), G = P(() => {
766
+ const b = I.current;
767
+ b.frame !== null && cancelAnimationFrame(b.frame), b.frame = null, b.velocity = 0, b.lastTimestamp = null;
768
+ }, []), dt = T(G);
769
+ Y(() => {
770
+ dt.current = G;
771
+ }, [G]);
772
+ const It = P(
773
+ (b) => {
774
+ if (!ot)
772
775
  return;
773
- const { maxVelocity: N, minVelocity: k, deceleration: et, startVelocityThreshold: ut } = L, Dt = pt(v, -N, N);
774
- if (Math.abs(Dt) < ut)
776
+ const { maxVelocity: M, minVelocity: q, deceleration: ft, startVelocityThreshold: j } = W, mt = xt(b, -M, M);
777
+ if (Math.abs(mt) < j)
775
778
  return;
776
- F(), Tt.current.velocity = Dt, Tt.current.lastTimestamp = null;
777
- const mt = (st) => {
778
- const ot = Tt.current;
779
- if (ot.lastTimestamp === null) {
780
- ot.lastTimestamp = st, ot.frame = requestAnimationFrame(mt);
779
+ G(), I.current.velocity = mt, I.current.lastTimestamp = null;
780
+ const Z = (J) => {
781
+ const bt = I.current;
782
+ if (bt.lastTimestamp === null) {
783
+ bt.lastTimestamp = J, bt.frame = requestAnimationFrame(Z);
781
784
  return;
782
785
  }
783
- const Ct = st - ot.lastTimestamp;
784
- if (ot.lastTimestamp = st, Ct <= 0) {
785
- ot.frame = requestAnimationFrame(mt);
786
+ const qt = J - bt.lastTimestamp;
787
+ if (bt.lastTimestamp = J, qt <= 0) {
788
+ bt.frame = requestAnimationFrame(Z);
786
789
  return;
787
790
  }
788
- const Et = ot.velocity;
789
- let wt = Et;
790
- const At = et * Ct;
791
- Et > 0 ? wt = Math.max(0, Et - At) : Et < 0 && (wt = Math.min(0, Et + At));
792
- const ht = (Et + wt) / 2 * Ct, h = C.current;
793
- ht !== 0 && W((ft) => ft + ht);
794
- const M = C.current, { contentSize: j, viewportSize: at } = Z.current, dt = Math.max(j - at, 0);
795
- ot.velocity = wt;
796
- const Yt = M === h || M <= 0 && wt <= 0 || M >= dt && wt >= 0;
797
- if (Math.abs(wt) < k || Yt) {
798
- F();
791
+ const yt = bt.velocity;
792
+ let Tt = yt;
793
+ const Ct = ft * qt;
794
+ yt > 0 ? Tt = Math.max(0, yt - Ct) : yt < 0 && (Tt = Math.min(0, yt + Ct));
795
+ const at = (yt + Tt) / 2 * qt, p = E.current;
796
+ at !== 0 && A((Ft) => Ft + at);
797
+ const y = E.current, { contentSize: nt, viewportSize: Lt } = Dt.current, H = Math.max(nt - Lt, 0);
798
+ bt.velocity = Tt;
799
+ const Zt = y === p || y <= 0 && Tt <= 0 || y >= H && Tt >= 0;
800
+ if (Math.abs(Tt) < q || Zt) {
801
+ G();
799
802
  return;
800
803
  }
801
- ot.frame = requestAnimationFrame(mt);
804
+ bt.frame = requestAnimationFrame(Z);
802
805
  };
803
- Tt.current.frame = requestAnimationFrame(mt);
806
+ I.current.frame = requestAnimationFrame(Z);
804
807
  },
805
- [J, L, W, F]
806
- ), vt = P(ct);
807
- B(() => {
808
- vt.current = ct;
809
- }, [ct]), ae(() => {
810
- Z.current = { contentSize: t, viewportSize: e };
811
- }, [t, e]), ae(() => {
812
- const v = G.current;
813
- if (!v) return;
814
- const N = () => {
815
- v.scrollTop !== 0 && (_.debug("[ScrollPane] Native scroll detected, resetting to 0", { scrollTop: v.scrollTop }), v.scrollTop = 0), v.scrollLeft !== 0 && (v.scrollLeft = 0);
808
+ [ot, W, A, G]
809
+ ), v = T(It);
810
+ Y(() => {
811
+ v.current = It;
812
+ }, [It]), oe(() => {
813
+ Dt.current = { contentSize: t, viewportSize: e };
814
+ }, [t, e]), oe(() => {
815
+ const b = Pt.current;
816
+ if (!b) return;
817
+ const M = () => {
818
+ b.scrollTop !== 0 && (_.debug("[ScrollPane] Native scroll detected, resetting to 0", { scrollTop: b.scrollTop }), b.scrollTop = 0), b.scrollLeft !== 0 && (b.scrollLeft = 0);
816
819
  };
817
- return v.addEventListener("scroll", N), () => v.removeEventListener("scroll", N);
818
- }, []), ae(() => {
819
- if (J) {
820
- _.debug("[ScrollPane] Adjusting scroll position due to content or viewport size change", { contentSize: t, viewportSize: e, scrollPosition: C.current });
821
- const v = pt(t - e, 0, t);
822
- C.current > v && W(v);
820
+ return b.addEventListener("scroll", M), () => b.removeEventListener("scroll", M);
821
+ }, []), oe(() => {
822
+ if (ot) {
823
+ _.debug("[ScrollPane] Adjusting scroll position due to content or viewport size change", { contentSize: t, viewportSize: e, scrollPosition: E.current });
824
+ const b = xt(t - e, 0, t);
825
+ E.current > b && A(b);
823
826
  } else
824
- W(0);
825
- }, [J, W, t, e]), B(() => {
826
- const v = (k) => {
827
- if (!J)
827
+ A(0);
828
+ }, [ot, A, t, e]), Y(() => {
829
+ const b = (q) => {
830
+ if (ht.current) {
831
+ const j = q.shiftKey && q.deltaX === 0, mt = j ? q.deltaY : q.deltaX, Z = j ? 0 : q.deltaY;
832
+ if (mt !== 0 && Math.abs(mt) >= Math.abs(Z)) {
833
+ q.preventDefault(), G();
834
+ let J = mt;
835
+ q.deltaMode === 1 ? J *= 16 : q.deltaMode === 2 && (J *= e), ht.current(J);
836
+ return;
837
+ }
838
+ }
839
+ if (!ot)
828
840
  return;
829
- k.preventDefault(), F();
830
- let et = k.deltaY;
831
- k.deltaMode === 1 ? et *= 16 : k.deltaMode === 2 && (et *= e), q !== 1 && (et *= q), _.debug("[ScrollPane] wheel event", { deltaY: et, scrollPosition: C.current, wheelSpeedMultiplier: q, deltaMode: k.deltaMode, scrollTop: G.current?.scrollTop }), W((ut) => ut + et);
832
- }, N = K.current;
833
- return N && N.addEventListener("wheel", v, { passive: !1 }), () => {
834
- N && N.removeEventListener("wheel", v);
841
+ q.preventDefault(), G();
842
+ let ft = q.deltaY;
843
+ q.deltaMode === 1 ? ft *= 16 : q.deltaMode === 2 && (ft *= e), z !== 1 && (ft *= z), _.debug("[ScrollPane] wheel event", { deltaY: ft, scrollPosition: E.current, wheelSpeedMultiplier: z, deltaMode: q.deltaMode, scrollTop: Pt.current?.scrollTop }), A((j) => j + ft);
844
+ }, M = ut.current;
845
+ return M && M.addEventListener("wheel", b, { passive: !1 }), () => {
846
+ M && M.removeEventListener("wheel", b);
835
847
  };
836
- }, [J, W, F, e, q]), ye(
837
- tt,
848
+ }, [ot, A, G, e, z]), we(
849
+ et,
838
850
  () => ({
839
- scrollTo: (v) => (F(), W(v)),
840
- getScrollPosition: () => C.current,
851
+ scrollTo: (b) => (G(), A(b)),
852
+ getScrollPosition: () => E.current,
841
853
  getContentSize: () => t,
842
854
  getViewportSize: () => e
843
855
  }),
844
- [W, t, e, F]
856
+ [A, t, e, G]
845
857
  );
846
- const T = P(W);
847
- B(() => {
848
- T.current = W;
849
- }, [W]);
850
- const Mt = Xe(), b = P({
858
+ const kt = T(A);
859
+ Y(() => {
860
+ kt.current = A;
861
+ }, [A]);
862
+ const S = Be(), rt = T({
851
863
  pointerId: null,
852
864
  startClientY: 0,
853
865
  startScroll: 0,
@@ -855,110 +867,110 @@ const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Pe = "virtualscroll:tap-scr
855
867
  shouldCancelNextClick: !1,
856
868
  clickResetTimer: null,
857
869
  velocitySamples: []
858
- }), St = P(d);
859
- B(() => {
860
- St.current = d;
870
+ }), Vt = T(d);
871
+ Y(() => {
872
+ Vt.current = d;
861
873
  }, [d]);
862
- const yt = P(J);
863
- B(() => {
864
- yt.current = J;
865
- }, [J]);
866
- const Ot = P(L);
867
- return B(() => {
868
- Ot.current = L;
869
- }, [L]), B(() => {
874
+ const Gt = T(ot);
875
+ Y(() => {
876
+ Gt.current = ot;
877
+ }, [ot]);
878
+ const Mt = T(W);
879
+ return Y(() => {
880
+ Mt.current = W;
881
+ }, [W]), Y(() => {
870
882
  if (d)
871
883
  return;
872
- const v = G.current, N = b.current;
873
- N.pointerId !== null && v && v.hasPointerCapture(N.pointerId) && v.releasePointerCapture(N.pointerId), N.clickResetTimer !== null && (window.clearTimeout(N.clickResetTimer), N.clickResetTimer = null), N.pointerId = null, N.startClientY = 0, N.startScroll = 0, N.isDragging = !1, N.shouldCancelNextClick = !1, N.velocitySamples = [];
874
- }, [d]), B(() => {
875
- const v = G.current;
876
- if (!v)
884
+ const b = Pt.current, M = rt.current;
885
+ M.pointerId && b?.hasPointerCapture(M.pointerId) && b.releasePointerCapture(M.pointerId), M.clickResetTimer !== null && (window.clearTimeout(M.clickResetTimer), M.clickResetTimer = null), M.pointerId = null, M.startClientY = 0, M.startScroll = 0, M.isDragging = !1, M.shouldCancelNextClick = !1, M.velocitySamples = [];
886
+ }, [d]), Y(() => {
887
+ const b = Pt.current;
888
+ if (!b)
877
889
  return;
878
- const N = 6, k = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(), et = () => {
879
- const h = b.current;
880
- h.pointerId = null, h.startClientY = 0, h.startScroll = 0, h.isDragging = !1, h.velocitySamples = [];
881
- }, ut = () => {
882
- const h = b.current;
883
- h.clickResetTimer !== null && (window.clearTimeout(h.clickResetTimer), h.clickResetTimer = null);
884
- }, Dt = (h) => {
885
- const M = b.current, j = k();
886
- M.velocitySamples.push({ clientY: h, time: j });
887
- const at = Ot.current.velocitySampleWindow;
888
- M.velocitySamples = M.velocitySamples.filter((dt) => j - dt.time <= at);
889
- }, mt = (h) => h instanceof HTMLElement && h.closest("[data-scrollpane-ignore-drag='true']") !== null, st = (h) => {
890
- const M = b.current;
891
- M.shouldCancelNextClick && (h.preventDefault(), h.stopPropagation(), M.shouldCancelNextClick = !1);
892
- }, ot = (h) => {
893
- const M = b.current;
894
- M.isDragging || (M.isDragging = !0, M.shouldCancelNextClick = !0, v.hasPointerCapture(h.pointerId) || v.setPointerCapture(h.pointerId), Dt(h.clientY));
895
- }, Ct = (h) => {
896
- const M = b.current;
897
- if (M.pointerId !== h.pointerId || !(St.current && yt.current) || !M.isDragging && (Math.abs(h.clientY - M.startClientY) < N || (ot(h), !M.isDragging)))
890
+ const M = 6, q = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(), ft = () => {
891
+ const p = rt.current;
892
+ p.pointerId = null, p.startClientY = 0, p.startScroll = 0, p.isDragging = !1, p.velocitySamples = [];
893
+ }, j = () => {
894
+ const p = rt.current;
895
+ p.clickResetTimer !== null && (window.clearTimeout(p.clickResetTimer), p.clickResetTimer = null);
896
+ }, mt = (p) => {
897
+ const y = rt.current, nt = q();
898
+ y.velocitySamples.push({ clientY: p, time: nt });
899
+ const Lt = Mt.current.velocitySampleWindow;
900
+ y.velocitySamples = y.velocitySamples.filter((H) => nt - H.time <= Lt);
901
+ }, Z = (p) => p instanceof HTMLElement && p.closest("[data-scrollpane-ignore-drag='true']") !== null, J = (p) => {
902
+ const y = rt.current;
903
+ y.shouldCancelNextClick && (p.preventDefault(), p.stopPropagation(), y.shouldCancelNextClick = !1);
904
+ }, bt = (p) => {
905
+ const y = rt.current;
906
+ y.isDragging || (y.isDragging = !0, y.shouldCancelNextClick = !0, b.hasPointerCapture(p.pointerId) || b.setPointerCapture(p.pointerId), mt(p.clientY));
907
+ }, qt = (p) => {
908
+ const y = rt.current;
909
+ if (y.pointerId !== p.pointerId || !(Vt.current && Gt.current) || !y.isDragging && (Math.abs(p.clientY - y.startClientY) < M || (bt(p), !y.isDragging)))
898
910
  return;
899
- Dt(h.clientY);
900
- const j = h.clientY - M.startClientY, at = M.startScroll - j;
901
- T.current(at), h.cancelable && h.preventDefault();
902
- }, Et = (h) => {
903
- const M = b.current;
904
- if (M.pointerId !== h.pointerId)
911
+ mt(p.clientY);
912
+ const nt = p.clientY - y.startClientY, Lt = y.startScroll - nt;
913
+ kt.current(Lt), p.cancelable && p.preventDefault();
914
+ }, yt = (p) => {
915
+ const y = rt.current;
916
+ if (y.pointerId !== p.pointerId)
905
917
  return;
906
- M.isDragging && M.shouldCancelNextClick && h.cancelable && (h.preventDefault(), h.stopPropagation()), v.hasPointerCapture(h.pointerId) && v.releasePointerCapture(h.pointerId);
907
- let j = 0;
908
- if (M.isDragging && M.velocitySamples.length >= 2) {
909
- const dt = M.velocitySamples, Yt = Ot.current.velocitySampleWindow, ft = dt[dt.length - 1], zt = dt.find((Zt) => ft.time - Zt.time <= Yt) ?? dt[0];
910
- if (ft && zt && ft.time !== zt.time) {
911
- const Zt = ft.clientY - zt.clientY, Nt = ft.time - zt.time;
912
- j = -(Zt / Nt);
918
+ y.isDragging && y.shouldCancelNextClick && p.cancelable && (p.preventDefault(), p.stopPropagation()), b.hasPointerCapture(p.pointerId) && b.releasePointerCapture(p.pointerId);
919
+ let nt = 0;
920
+ if (y.isDragging && y.velocitySamples.length >= 2) {
921
+ const H = y.velocitySamples, Zt = Mt.current.velocitySampleWindow, Ft = H[H.length - 1], wt = H.find((Ht) => Ft.time - Ht.time <= Zt) ?? H[0];
922
+ if (Ft && wt && Ft.time !== wt.time) {
923
+ const Ht = Ft.clientY - wt.clientY, gt = Ft.time - wt.time;
924
+ nt = -(Ht / gt);
913
925
  }
914
926
  }
915
- ut(), M.shouldCancelNextClick && (M.clickResetTimer = window.setTimeout(() => {
916
- const dt = b.current;
917
- dt.shouldCancelNextClick = !1, dt.clickResetTimer = null;
927
+ j(), y.shouldCancelNextClick && (y.clickResetTimer = window.setTimeout(() => {
928
+ const H = rt.current;
929
+ H.shouldCancelNextClick = !1, H.clickResetTimer = null;
918
930
  }, 0));
919
- const at = Ot.current.startVelocityThreshold;
920
- et(), Math.abs(j) >= at && vt.current?.(j);
921
- }, wt = (h) => {
922
- if (!(St.current && yt.current) || h.button !== 0 && h.pointerType === "mouse" || h.ctrlKey || h.metaKey || h.altKey || mt(h.target))
931
+ const Lt = Mt.current.startVelocityThreshold;
932
+ ft(), Math.abs(nt) >= Lt && v.current?.(nt);
933
+ }, Tt = (p) => {
934
+ if (!(Vt.current && Gt.current) || p.button !== 0 && p.pointerType === "mouse" || p.ctrlKey || p.metaKey || p.altKey || Z(p.target))
923
935
  return;
924
- window.dispatchEvent(new CustomEvent(Pe, { detail: { paneId: Mt } })), It.current?.();
925
- const M = b.current;
926
- ut(), M.pointerId = h.pointerId, M.startClientY = h.clientY, M.startScroll = C.current, M.isDragging = !1, M.shouldCancelNextClick = !1, M.velocitySamples = [];
927
- }, At = (h) => {
928
- const M = b.current;
929
- M.pointerId === h.pointerId && (M.shouldCancelNextClick = !1, v.hasPointerCapture(h.pointerId) && v.releasePointerCapture(h.pointerId), ut(), et());
930
- }, Xt = [
931
- ["click", st, !0],
932
- ["pointerdown", wt, { passive: !1 }],
933
- ["pointermove", Ct, { passive: !1 }],
934
- ["pointerup", Et, void 0],
935
- ["pointercancel", At, void 0]
936
- ], ht = [
937
- ["pointermove", Ct, { passive: !1 }],
938
- ["pointerup", Et, void 0],
939
- ["pointercancel", At, void 0]
936
+ window.dispatchEvent(new CustomEvent(Me, { detail: { paneId: S } })), dt.current?.();
937
+ const y = rt.current;
938
+ j(), y.pointerId = p.pointerId, y.startClientY = p.clientY, y.startScroll = E.current, y.isDragging = !1, y.shouldCancelNextClick = !1, y.velocitySamples = [];
939
+ }, Ct = (p) => {
940
+ const y = rt.current;
941
+ y.pointerId === p.pointerId && (y.shouldCancelNextClick = !1, b.hasPointerCapture(p.pointerId) && b.releasePointerCapture(p.pointerId), j(), ft());
942
+ }, _t = [
943
+ ["click", J, !0],
944
+ ["pointerdown", Tt, { passive: !1 }],
945
+ ["pointermove", qt, { passive: !1 }],
946
+ ["pointerup", yt, void 0],
947
+ ["pointercancel", Ct, void 0]
948
+ ], at = [
949
+ ["pointermove", qt, { passive: !1 }],
950
+ ["pointerup", yt, void 0],
951
+ ["pointercancel", Ct, void 0]
940
952
  ];
941
- return ge(v, Xt, "add"), ge(window, ht, "add"), () => {
942
- ge(v, Xt, "remove"), ge(window, ht, "remove");
943
- const h = b.current;
944
- h.pointerId !== null && v.hasPointerCapture(h.pointerId) && v.releasePointerCapture(h.pointerId), ut(), et();
953
+ return be(b, _t, "add"), be(window, at, "add"), () => {
954
+ be(b, _t, "remove"), be(window, at, "remove");
955
+ const p = rt.current;
956
+ p.pointerId !== null && b.hasPointerCapture(p.pointerId) && b.releasePointerCapture(p.pointerId), j(), ft();
945
957
  };
946
- }, [Mt]), /* @__PURE__ */ re("div", { ref: K, className: ee("aqvs-scroll-pane", p), style: m, children: [
947
- /* @__PURE__ */ re(
958
+ }, [S]), /* @__PURE__ */ ne("div", { ref: ut, className: re("aqvs-scroll-pane", h), style: m, children: [
959
+ /* @__PURE__ */ ne(
948
960
  "div",
949
961
  {
950
- ref: G,
951
- className: ee("aqvs-scroll-pane-content"),
962
+ ref: Pt,
963
+ className: re("aqvs-scroll-pane-content"),
952
964
  style: {
953
965
  height: e,
954
- paddingTop: D.top,
955
- paddingBottom: D.bottom,
966
+ paddingTop: St.top,
967
+ paddingBottom: St.bottom,
956
968
  ...d ? { touchAction: "none" } : {}
957
969
  },
958
- id: Mt,
970
+ id: S,
959
971
  children: [
960
972
  g,
961
- n(C.current)
973
+ n(E.current)
962
974
  ]
963
975
  }
964
976
  ),
@@ -967,34 +979,34 @@ const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Pe = "virtualscroll:tap-scr
967
979
  {
968
980
  contentSize: t,
969
981
  viewportSize: e,
970
- scrollPosition: C.current,
971
- onScroll: W,
972
- enableThumbDrag: s,
982
+ scrollPosition: E.current,
983
+ onScroll: A,
984
+ enableThumbDrag: i,
973
985
  enableTrackClick: l,
974
986
  enableArrowButtons: c,
975
987
  scrollBarWidth: r,
976
- ariaControls: Mt,
977
- tapScrollCircleOptions: E,
978
- itemCount: A,
979
- renderThumbOverlay: U,
980
- visibleStartIndex: bt,
981
- visibleEndIndex: lt
988
+ ariaControls: S,
989
+ tapScrollCircleOptions: N,
990
+ itemCount: k,
991
+ renderThumbOverlay: B,
992
+ visibleStartIndex: ct,
993
+ visibleEndIndex: st
982
994
  },
983
995
  "scrollbar"
984
996
  ),
985
- it?.()
997
+ L?.()
986
998
  ] });
987
999
  }
988
- ), Ee = (n, t, e) => Math.min(Math.max(n, t), e), Ir = ({ dragState: n, normalizedDistance: t, sizeScale: e, size: r }) => {
989
- const s = Math.max(r / 2, 1), l = 1 + t * 0.65, c = Math.max(0.65, 1 - t * 0.25), d = n.direction * t * 26 * e, f = 0.8 + t * 0.18, p = 3 * e, m = 6 * e, g = 22 * e, E = Math.abs(d) + m, x = d > 0 ? p : -Math.abs(d) - p, A = Math.max(2.5, 3 * e), U = Ee(n.offsetX, -s, s), q = Ee(n.offsetY, -s, s), Q = s * 0.35, bt = U / s * Q, lt = q / s * Q, it = bt * 0.45, Y = lt * 0.45, tt = Math.max(g * 0.38, 6), C = 0.65 + t * 0.2, K = n.active;
990
- return /* @__PURE__ */ re(ke, { children: [
1000
+ ), Ae = (n, t, e) => Math.min(Math.max(n, t), e), Tr = ({ dragState: n, normalizedDistance: t, sizeScale: e, size: r }) => {
1001
+ const i = Math.max(r / 2, 1), l = 1 + t * 0.65, c = Math.max(0.65, 1 - t * 0.25), d = n.direction * t * 26 * e, f = 0.8 + t * 0.18, h = 3 * e, m = 6 * e, g = 22 * e, N = Math.abs(d) + m, x = d > 0 ? h : -Math.abs(d) - h, k = Math.max(2.5, 3 * e), B = Ae(n.offsetX, -i, i), z = Ae(n.offsetY, -i, i), Q = i * 0.35, pt = B / i * Q, ct = z / i * Q, st = pt * 0.45, L = ct * 0.45, tt = Math.max(g * 0.38, 6), et = 0.65 + t * 0.2, E = n.active;
1002
+ return /* @__PURE__ */ ne(_e, { children: [
991
1003
  /* @__PURE__ */ $(
992
1004
  "div",
993
1005
  {
994
1006
  className: "aqvs-tap-scroll-circle-gradient",
995
1007
  style: {
996
1008
  transform: `scale(${c}, ${l})`,
997
- transition: K ? "40ms transform ease-out" : "200ms ease transform"
1009
+ transition: E ? "40ms transform ease-out" : "200ms ease transform"
998
1010
  }
999
1011
  }
1000
1012
  ),
@@ -1005,8 +1017,8 @@ const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Pe = "virtualscroll:tap-scr
1005
1017
  style: {
1006
1018
  width: g,
1007
1019
  height: g,
1008
- transform: `translate(calc(-50% + ${bt}px), calc(-50% + ${lt}px)) scale(${c}, ${f * l})`,
1009
- transition: K ? "70ms transform ease-out" : "200ms ease transform"
1020
+ transform: `translate(calc(-50% + ${pt}px), calc(-50% + ${ct}px)) scale(${c}, ${f * l})`,
1021
+ transition: E ? "70ms transform ease-out" : "200ms ease transform"
1010
1022
  }
1011
1023
  }
1012
1024
  ),
@@ -1017,10 +1029,10 @@ const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Pe = "virtualscroll:tap-scr
1017
1029
  style: {
1018
1030
  width: tt,
1019
1031
  height: tt,
1020
- transform: `translate(calc(-50% + ${it}px), calc(-50% + ${Y}px)) scale(${c}, ${l})`,
1021
- opacity: C,
1032
+ transform: `translate(calc(-50% + ${st}px), calc(-50% + ${L}px)) scale(${c}, ${l})`,
1033
+ opacity: et,
1022
1034
  boxShadow: "0 0 8px rgba(255,255,255,0.45)",
1023
- transition: K ? "120ms opacity 150ms, 120ms transform ease-out ease-out" : "220ms ease transform, 240ms opacity ease"
1035
+ transition: E ? "120ms opacity 150ms, 120ms transform ease-out ease-out" : "220ms ease transform, 240ms opacity ease"
1024
1036
  }
1025
1037
  }
1026
1038
  ),
@@ -1029,11 +1041,11 @@ const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Pe = "virtualscroll:tap-scr
1029
1041
  {
1030
1042
  className: "aqvs-sample-visual-highlight",
1031
1043
  style: {
1032
- width: A,
1033
- height: E,
1044
+ width: k,
1045
+ height: N,
1034
1046
  transform: `translate(-50%, ${x}px)`,
1035
1047
  opacity: t,
1036
- transition: K ? "40ms height, 60ms opacity ease-out ease-out" : "200ms ease height, 120ms ease opacity"
1048
+ transition: E ? "40ms height, 60ms opacity ease-out ease-out" : "200ms ease height, 120ms ease opacity"
1037
1049
  }
1038
1050
  }
1039
1051
  )
@@ -1043,7 +1055,7 @@ const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Pe = "virtualscroll:tap-scr
1043
1055
  return 0n;
1044
1056
  const t = Math.trunc(n);
1045
1057
  return t <= 0 ? 0n : BigInt(t);
1046
- }, xe = (n) => {
1058
+ }, ve = (n) => {
1047
1059
  if (n <= 0 || !Number.isFinite(n))
1048
1060
  return 0;
1049
1061
  const t = Math.trunc(n), e = BigInt(t) & -BigInt(t);
@@ -1109,10 +1121,10 @@ class cr {
1109
1121
  }, { mode: c, materializedValues: d } = this._calculateMode(l.from, l.to);
1110
1122
  if (this.baseValue = c, r?.materialize)
1111
1123
  for (let f = 0; f < d.length; f++) {
1112
- const p = d[f], m = l.from + f;
1124
+ const h = d[f], m = l.from + f;
1113
1125
  if (m >= this.size)
1114
1126
  break;
1115
- const g = p - this.baseValue;
1127
+ const g = h - this.baseValue;
1116
1128
  this.deltas.set(m, g), this._updateTree(m, g);
1117
1129
  }
1118
1130
  } else
@@ -1148,29 +1160,29 @@ class cr {
1148
1160
  if (!this.valueFn)
1149
1161
  return { mode: 0, materializedValues: [] };
1150
1162
  const r = [];
1151
- for (let p = t; p <= e && !(p >= this.size); p++)
1152
- r.push(this.valueFn(p));
1153
- const s = [...r];
1163
+ for (let h = t; h <= e && !(h >= this.size); h++)
1164
+ r.push(this.valueFn(h));
1165
+ const i = [...r];
1154
1166
  if (r.length === 0)
1155
1167
  return { mode: 0, materializedValues: [] };
1156
- r.sort((p, m) => p - m);
1168
+ r.sort((h, m) => h - m);
1157
1169
  const l = Math.floor(r.length / 2);
1158
1170
  let c;
1159
1171
  r.length % 2 === 0 ? c = Math.floor((r[l - 1] + r[l]) / 2) : c = r[l];
1160
1172
  const d = /* @__PURE__ */ new Map();
1161
1173
  let f = 0;
1162
- for (const p of r) {
1163
- const m = (d.get(p) ?? 0) + 1;
1164
- d.set(p, m), m > f && (f = m);
1174
+ for (const h of r) {
1175
+ const m = (d.get(h) ?? 0) + 1;
1176
+ d.set(h, m), m > f && (f = m);
1165
1177
  }
1166
1178
  if (f > r.length * 0.2) {
1167
- const p = [];
1168
- for (const [g, E] of d.entries())
1169
- E === f && p.push(g);
1170
- const m = p.reduce((g, E) => g + E, 0);
1171
- c = Math.floor(m / p.length);
1179
+ const h = [];
1180
+ for (const [g, N] of d.entries())
1181
+ N === f && h.push(g);
1182
+ const m = h.reduce((g, N) => g + N, 0);
1183
+ c = Math.floor(m / h.length);
1172
1184
  }
1173
- return { mode: c, materializedValues: s };
1185
+ return { mode: c, materializedValues: i };
1174
1186
  }
1175
1187
  /**
1176
1188
  * @method update
@@ -1212,8 +1224,8 @@ class cr {
1212
1224
  for (const { index: e, change: r } of t) {
1213
1225
  if (e < 0 || e >= this.size)
1214
1226
  throw new Error(`Index ${e} out of bounds`);
1215
- const s = this.deltas.get(e) ?? 0;
1216
- this.deltas.set(e, s + r), this._updateTree(e, r);
1227
+ const i = this.deltas.get(e) ?? 0;
1228
+ this.deltas.set(e, i + r), this._updateTree(e, r);
1217
1229
  }
1218
1230
  return this.total;
1219
1231
  }
@@ -1231,10 +1243,10 @@ class cr {
1231
1243
  let r = t + 1;
1232
1244
  for (; r <= this.size; ) {
1233
1245
  this.tree.set(r, (this.tree.get(r) ?? 0) + e);
1234
- const s = xe(r);
1235
- if (s === 0)
1246
+ const i = ve(r);
1247
+ if (i === 0)
1236
1248
  break;
1237
- r += s;
1249
+ r += i;
1238
1250
  }
1239
1251
  this.total !== void 0 && (this.total += e);
1240
1252
  }
@@ -1248,12 +1260,12 @@ class cr {
1248
1260
  */
1249
1261
  _buildDeltaUpdates(t) {
1250
1262
  const e = [];
1251
- for (const { index: r, value: s } of t) {
1263
+ for (const { index: r, value: i } of t) {
1252
1264
  if (r < 0 || r >= this.size)
1253
1265
  throw new Error(`Index ${r} out of bounds`);
1254
- if (s < 0)
1266
+ if (i < 0)
1255
1267
  throw new Error("Value cannot be negative.");
1256
- const l = this.deltas.has(r) ? (this.deltas.get(r) ?? 0) + this.baseValue : this.baseValue, c = s - l;
1268
+ const l = this.deltas.has(r) ? (this.deltas.get(r) ?? 0) + this.baseValue : this.baseValue, c = i - l;
1257
1269
  c !== 0 && e.push({ index: r, change: c });
1258
1270
  }
1259
1271
  return e;
@@ -1271,7 +1283,7 @@ class cr {
1271
1283
  let t = 0, e = this.size;
1272
1284
  for (; e > 0; ) {
1273
1285
  t += this.tree.get(e) ?? 0;
1274
- const r = xe(e);
1286
+ const r = ve(e);
1275
1287
  if (r === 0)
1276
1288
  break;
1277
1289
  e -= r;
@@ -1307,11 +1319,11 @@ class cr {
1307
1319
  _materializeRanges(t, e, r = !1) {
1308
1320
  if (!(t?.materialize && this.valueFn))
1309
1321
  return;
1310
- const s = t.ranges;
1311
- if (s && s.length > 0) {
1312
- for (const d of s) {
1313
- const f = d.from, p = Math.min(d.to, this.size - 1);
1314
- for (let m = f; m <= p; m++)
1322
+ const i = t.ranges;
1323
+ if (i && i.length > 0) {
1324
+ for (const d of i) {
1325
+ const f = d.from, h = Math.min(d.to, this.size - 1);
1326
+ for (let m = f; m <= h; m++)
1315
1327
  this._materialize(m);
1316
1328
  }
1317
1329
  if (e === void 0)
@@ -1320,7 +1332,7 @@ class cr {
1320
1332
  this._materialize(e);
1321
1333
  return;
1322
1334
  }
1323
- const l = s[0].from, c = s[s.length - 1].to;
1335
+ const l = i[0].from, c = i[i.length - 1].to;
1324
1336
  e >= l && e <= c && this._materialize(e);
1325
1337
  return;
1326
1338
  }
@@ -1341,17 +1353,17 @@ class cr {
1341
1353
  return this._findIndexLarge(t, e, r);
1342
1354
  if (this.size === 0)
1343
1355
  return { index: -1, total: this.total ?? 0, cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
1344
- let s = 0, l = 0, c = 1;
1356
+ let i = 0, l = 0, c = 1;
1345
1357
  for (; c << 1 <= this.size; )
1346
1358
  c <<= 1;
1347
1359
  for (; c > 0; c >>= 1) {
1348
- const p = s + c;
1349
- if (p <= this.size) {
1350
- const g = (this.tree.get(p) ?? 0) + this.baseValue * c;
1351
- (r ? l + g < t : l + g <= t) && (s = p, l += g);
1360
+ const h = i + c;
1361
+ if (h <= this.size) {
1362
+ const g = (this.tree.get(h) ?? 0) + this.baseValue * c;
1363
+ (r ? l + g < t : l + g <= t) && (i = h, l += g);
1352
1364
  }
1353
1365
  }
1354
- const d = r ? s : s - 1;
1366
+ const d = r ? i : i - 1;
1355
1367
  if (d < 0 || d >= this.size)
1356
1368
  return { index: -1, total: this.total ?? this.getTotal(), cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
1357
1369
  const f = this.prefixSum(d, e);
@@ -1371,14 +1383,14 @@ class cr {
1371
1383
  _findIndexLarge(t, e, r) {
1372
1384
  if (this.size === 0)
1373
1385
  return { index: -1, total: this.total ?? 0, cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
1374
- const s = lr(this.size);
1375
- if (s === 0n)
1386
+ const i = lr(this.size);
1387
+ if (i === 0n)
1376
1388
  return { index: -1, total: this.total ?? 0, cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
1377
- let l = 0n, c = s - 1n, d, f, p, m = this.total;
1389
+ let l = 0n, c = i - 1n, d, f, h, m = this.total;
1378
1390
  for (; l <= c; ) {
1379
- const x = l + c >> 1n, A = Number(x), U = this.prefixSum(A, e);
1380
- if (p = U, m = U.total, r ? U.cumulative >= t : U.cumulative <= t)
1381
- if (d = x, f = U, r) {
1391
+ const x = l + c >> 1n, k = Number(x), B = this.prefixSum(k, e);
1392
+ if (h = B, m = B.total, r ? B.cumulative >= t : B.cumulative <= t)
1393
+ if (d = x, f = B, r) {
1382
1394
  if (x === 0n)
1383
1395
  break;
1384
1396
  c = x - 1n;
@@ -1392,7 +1404,7 @@ class cr {
1392
1404
  c = x - 1n;
1393
1405
  }
1394
1406
  }
1395
- const g = f ?? p;
1407
+ const g = f ?? h;
1396
1408
  return {
1397
1409
  index: d !== void 0 ? Number(d) : -1,
1398
1410
  total: m,
@@ -1412,18 +1424,18 @@ class cr {
1412
1424
  prefixSum(t, e) {
1413
1425
  if (t < 0)
1414
1426
  return { cumulative: 0, total: this.total, currentValue: 0, safeIndex: 0 };
1415
- const r = pt(t, 0, this.size - 1), s = e?.materializeOption;
1416
- this._materializeRanges(s, r, !0);
1427
+ const r = xt(t, 0, this.size - 1), i = e?.materializeOption;
1428
+ this._materializeRanges(i, r, !0);
1417
1429
  let l = 0, c = r + 1;
1418
1430
  for (; c > 0; ) {
1419
1431
  const f = this.tree.get(c) ?? 0;
1420
1432
  l += f;
1421
- const p = xe(c);
1422
- if (p === 0)
1433
+ const h = ve(c);
1434
+ if (h === 0)
1423
1435
  break;
1424
- c -= p;
1436
+ c -= h;
1425
1437
  }
1426
- const d = s?.materialize ? this.get(r) : (this.deltas.get(r) || 0) + this.baseValue;
1438
+ const d = i?.materialize ? this.get(r) : (this.deltas.get(r) || 0) + this.baseValue;
1427
1439
  return { cumulative: l + this.baseValue * (r + 1), total: this.total, currentValue: d, safeIndex: r };
1428
1440
  }
1429
1441
  /**
@@ -1469,17 +1481,17 @@ class cr {
1469
1481
  rebuildTree(t) {
1470
1482
  if (t?.materialize && this.valueFn) {
1471
1483
  const r = this.valueFn;
1472
- this.reset(this.size, (s) => r(s), { materialize: !0 });
1484
+ this.reset(this.size, (i) => r(i), { materialize: !0 });
1473
1485
  return;
1474
1486
  }
1475
1487
  const e = /* @__PURE__ */ new Map();
1476
- for (const [r, s] of this.deltas.entries()) {
1477
- if (s === 0)
1488
+ for (const [r, i] of this.deltas.entries()) {
1489
+ if (i === 0)
1478
1490
  continue;
1479
1491
  let l = r + 1;
1480
1492
  for (; l <= this.size; ) {
1481
- e.set(l, (e.get(l) ?? 0) + s);
1482
- const c = xe(l);
1493
+ e.set(l, (e.get(l) ?? 0) + i);
1494
+ const c = ve(l);
1483
1495
  if (c === 0)
1484
1496
  break;
1485
1497
  l += c;
@@ -1512,8 +1524,8 @@ class cr {
1512
1524
  if (t === e)
1513
1525
  return;
1514
1526
  if (t < e)
1515
- for (const s of this.deltas.keys())
1516
- s >= t && this.deltas.delete(s);
1527
+ for (const i of this.deltas.keys())
1528
+ i >= t && this.deltas.delete(i);
1517
1529
  this.size = t, this.rebuildTree();
1518
1530
  const r = this.prefixSum(this.getSize() - 1);
1519
1531
  r.cumulative !== r.total && _.error("Inconsistent Fenwick Tree state");
@@ -1557,12 +1569,12 @@ class cr {
1557
1569
  }
1558
1570
  }
1559
1571
  const ur = (n, t, e) => {
1560
- const r = Math.max(0, n), s = P(null), l = P({ size: r, valueOrFn: t, options: e });
1561
- s.current === null && (s.current = new cr(r, t, e));
1562
- const c = s.current, d = l.current, f = d.size !== r, p = d.valueOrFn !== t, m = d.options !== e;
1563
- if (p || m) {
1572
+ const r = Math.max(0, n), i = T(null), l = T({ size: r, valueOrFn: t, options: e });
1573
+ i.current === null && (i.current = new cr(r, t, e));
1574
+ const c = i.current, d = l.current, f = d.size !== r, h = d.valueOrFn !== t, m = d.options !== e;
1575
+ if (h || m) {
1564
1576
  const g = e?.resetOnValueFnChange ?? !0;
1565
- m || p && g ? (e?.debug && _.debug("[useFenwickMapTree] reset", { valueOrFnChanged: p, optionsChanged: m }), c.reset(r, t, e)) : (f && (e?.debug && _.debug("[useFenwickMapTree] resize (with valueFn change)", { from: d.size, to: r }), c.changeSize(r)), e?.debug && _.debug("[useFenwickMapTree] setValueFn (no reset)", { valueOrFnChanged: p }), c.setValueFn(t, { reset: !1 })), l.current = { size: r, valueOrFn: t, options: e };
1577
+ m || h && g ? (e?.debug && _.debug("[useFenwickMapTree] reset", { valueOrFnChanged: h, optionsChanged: m }), c.reset(r, t, e)) : (f && (e?.debug && _.debug("[useFenwickMapTree] resize (with valueFn change)", { from: d.size, to: r }), c.changeSize(r)), e?.debug && _.debug("[useFenwickMapTree] setValueFn (no reset)", { valueOrFnChanged: h }), c.setValueFn(t, { reset: !1 })), l.current = { size: r, valueOrFn: t, options: e };
1566
1578
  } else f && (e?.debug && _.debug("[useFenwickMapTree] resize", { from: d.size, to: r }), d.size === 0 && r > 0 ? c.reset(r, t, e) : c.changeSize(r), l.current = { size: r, valueOrFn: t, options: e });
1567
1579
  return c;
1568
1580
  };
@@ -1575,7 +1587,7 @@ class dr {
1575
1587
  this.key = t, this.value = e;
1576
1588
  }
1577
1589
  }
1578
- class Ae {
1590
+ class De {
1579
1591
  head = null;
1580
1592
  tail = null;
1581
1593
  /**
@@ -1617,8 +1629,8 @@ class Ae {
1617
1629
  }
1618
1630
  }
1619
1631
  function fr(n) {
1620
- const t = P(/* @__PURE__ */ new Map()), e = P(new Ae());
1621
- B(() => {
1632
+ const t = T(/* @__PURE__ */ new Map()), e = T(new De());
1633
+ Y(() => {
1622
1634
  for (; t.current.size > n; ) {
1623
1635
  const m = e.current.removeHead();
1624
1636
  if (m)
@@ -1627,140 +1639,140 @@ function fr(n) {
1627
1639
  break;
1628
1640
  }
1629
1641
  }, [n]);
1630
- const r = I((m) => {
1642
+ const r = P((m) => {
1631
1643
  const g = t.current.get(m);
1632
1644
  if (g)
1633
1645
  return e.current.moveToTail(g), g.value;
1634
- }, []), s = I(
1646
+ }, []), i = P(
1635
1647
  (m, g) => {
1636
1648
  if (n <= 0)
1637
1649
  return;
1638
- let E = t.current.get(m);
1639
- if (E)
1640
- E.value = g, e.current.moveToTail(E);
1650
+ let N = t.current.get(m);
1651
+ if (N)
1652
+ N.value = g, e.current.moveToTail(N);
1641
1653
  else {
1642
1654
  if (t.current.size >= n) {
1643
1655
  const x = e.current.removeHead();
1644
1656
  x && t.current.delete(x.key);
1645
1657
  }
1646
- E = new dr(m, g), t.current.set(m, E), e.current.addToTail(E);
1658
+ N = new dr(m, g), t.current.set(m, N), e.current.addToTail(N);
1647
1659
  }
1648
1660
  },
1649
1661
  [n]
1650
- ), l = I((m) => t.current.has(m), []), c = I((m) => {
1662
+ ), l = P((m) => t.current.has(m), []), c = P((m) => {
1651
1663
  const g = t.current.get(m);
1652
1664
  g && (e.current.remove(g), t.current.delete(m));
1653
- }, []), d = I(() => {
1654
- t.current.clear(), e.current = new Ae();
1655
- }, []), [f, p] = Bt(() => ({ get: r, set: s, has: l, remove: c, clear: d }));
1656
- return B(() => p({ get: r, set: s, has: l, remove: c, clear: d }), [r, s, l, c, d]), f;
1665
+ }, []), d = P(() => {
1666
+ t.current.clear(), e.current = new De();
1667
+ }, []), [f, h] = Bt(() => ({ get: r, set: i, has: l, remove: c, clear: d }));
1668
+ return Y(() => h({ get: r, set: i, has: l, remove: c, clear: d }), [r, i, l, c, d]), f;
1657
1669
  }
1658
- const mr = 1e4, Sr = () => {
1670
+ const mr = 1e4, Pr = () => {
1659
1671
  const { get: n, set: t, has: e, clear: r } = fr(mr);
1660
1672
  return { get: n, set: t, has: e, clear: r };
1661
- }, nt = (n, t) => t <= 0 ? 0 : pt(n, 0, t - 1), De = (n) => ({
1673
+ }, it = (n, t) => t <= 0 ? 0 : xt(n, 0, t - 1), Ne = (n) => ({
1662
1674
  top: Math.max(0, n?.top ?? 0),
1663
1675
  bottom: Math.max(0, n?.bottom ?? 0)
1664
- }), Gt = (n, t) => n <= t ? 0 : n - t, oe = (n, t) => n <= 0 ? t : n + t, Se = (n) => {
1676
+ }), jt = (n, t) => n <= t ? 0 : n - t, se = (n, t) => n <= 0 ? t : n + t, Se = (n) => {
1665
1677
  if (!Number.isFinite(n)) return 0n;
1666
1678
  const t = Math.trunc(n);
1667
1679
  return t <= 0 ? 0n : BigInt(t);
1668
- }, pr = (n, t, e, r, s, l, c, d) => {
1680
+ }, pr = (n, t, e, r, i, l, c, d) => {
1669
1681
  const f = Se(r);
1670
1682
  if (f === 0n)
1671
1683
  return { renderingStartIndex: 0, renderingEndIndex: 0, visibleStartIndex: 0, visibleEndIndex: 0 };
1672
- const p = (Y) => Y < 0n ? 0n : Y >= f ? f - 1n : Y, m = { materializeOption: { materialize: !1 } }, { index: g, cumulative: E } = l.findIndexAtOrAfter(n, m);
1684
+ const h = (L) => L < 0n ? 0n : L >= f ? f - 1n : L, m = { materializeOption: { materialize: !1 } }, { index: g, cumulative: N } = l.findIndexAtOrAfter(n, m);
1673
1685
  let x;
1674
- g === -1 ? x = f - 1n : (E === n ? x = Se(g + 1) : x = Se(g), x >= f && (x = f - 1n)), n <= 0 && (x = 0n), d && n >= c && (x = f - 1n);
1675
- const A = (Y) => {
1676
- let tt = 0, C = Y, K = Y, G = 0n;
1677
- for (; C < f && tt < t; ) {
1678
- const Tt = Number(C), L = s(Tt);
1679
- if (tt += L, K = C, C += 1n, G += 1n, !Number.isFinite(L) || L <= 0)
1686
+ g === -1 ? x = f - 1n : (N === n ? x = Se(g + 1) : x = Se(g), x >= f && (x = f - 1n)), n <= 0 && (x = 0n), d && n >= c && (x = f - 1n);
1687
+ const k = (L) => {
1688
+ let tt = 0, et = L, E = L, ut = 0n;
1689
+ for (; et < f && tt < t; ) {
1690
+ const Pt = Number(et), ht = i(Pt);
1691
+ if (tt += ht, E = et, et += 1n, ut += 1n, !Number.isFinite(ht) || ht <= 0)
1680
1692
  break;
1681
1693
  }
1682
- return G === 0n && (K = Y), { height: tt, end: K };
1694
+ return ut === 0n && (E = L), { height: tt, end: E };
1683
1695
  };
1684
- let { height: U, end: q } = A(x);
1685
- if (U < t && x > 0n) {
1686
- let Y = x, tt = U;
1687
- for (; Y > 0n && tt < t; ) {
1688
- Y -= 1n;
1689
- const K = Number(Y), G = s(K);
1690
- if (tt += G, !Number.isFinite(G) || G <= 0)
1696
+ let { height: B, end: z } = k(x);
1697
+ if (B < t && x > 0n) {
1698
+ let L = x, tt = B;
1699
+ for (; L > 0n && tt < t; ) {
1700
+ L -= 1n;
1701
+ const E = Number(L), ut = i(E);
1702
+ if (tt += ut, !Number.isFinite(ut) || ut <= 0)
1691
1703
  break;
1692
1704
  }
1693
- x = p(Y);
1694
- const C = A(x);
1695
- U = C.height, q = C.end;
1705
+ x = h(L);
1706
+ const et = k(x);
1707
+ B = et.height, z = et.end;
1696
1708
  }
1697
- const Q = p(x), bt = p(q), lt = p(Q - BigInt(Math.max(0, e))), it = p(bt + BigInt(Math.max(0, e)));
1709
+ const Q = h(x), pt = h(z), ct = h(Q - BigInt(Math.max(0, e))), st = h(pt + BigInt(Math.max(0, e)));
1698
1710
  return {
1699
- renderingStartIndex: nt(Number(lt), r),
1700
- renderingEndIndex: nt(Number(it), r),
1701
- visibleStartIndex: nt(Number(Q), r),
1702
- visibleEndIndex: nt(Number(bt), r)
1711
+ renderingStartIndex: it(Number(ct), r),
1712
+ renderingEndIndex: it(Number(st), r),
1713
+ visibleStartIndex: it(Number(Q), r),
1714
+ visibleEndIndex: it(Number(pt), r)
1703
1715
  };
1704
- }, hr = (n, t, e, r, s, l, c) => {
1716
+ }, hr = (n, t, e, r, i, l, c) => {
1705
1717
  if (r === 0)
1706
1718
  return { renderingStartIndex: 0, renderingEndIndex: 0, visibleStartIndex: 0, visibleEndIndex: 0 };
1707
1719
  const d = Number.isFinite(c), f = d ? Math.min(Math.max(0, n), c) : Math.max(0, n);
1708
1720
  if (r >= Number.MAX_SAFE_INTEGER)
1709
- return pr(f, t, e, r, s, l, c, d);
1710
- const { index: p, cumulative: m, currentValue: g } = l.findIndexAtOrAfter(f, { materializeOption: { materialize: !1 } }), E = p === -1 ? t <= 0 || (m ?? 0) < f + (g ?? 0) ? r - 1 : 0 : p;
1711
- let x = nt(E, r), A = 0;
1712
- if (p !== -1 && m === f)
1713
- x = nt(p + 1, r), A = 0;
1714
- else if (x === p && m !== void 0 && g !== void 0)
1715
- A = m - g - f;
1721
+ return pr(f, t, e, r, i, l, c, d);
1722
+ const { index: h, cumulative: m, currentValue: g } = l.findIndexAtOrAfter(f, { materializeOption: { materialize: !1 } }), N = h === -1 ? t <= 0 || (m ?? 0) < f + (g ?? 0) ? r - 1 : 0 : h;
1723
+ let x = it(N, r), k = 0;
1724
+ if (h !== -1 && m === f)
1725
+ x = it(h + 1, r), k = 0;
1726
+ else if (x === h && m !== void 0 && g !== void 0)
1727
+ k = m - g - f;
1716
1728
  else {
1717
- const { cumulative: it, currentValue: Y } = l.prefixSum(x, { materializeOption: { materialize: !1 } });
1718
- A = (it ?? 0) - (Y ?? 0) - f;
1729
+ const { cumulative: st, currentValue: L } = l.prefixSum(x, { materializeOption: { materialize: !1 } });
1730
+ k = (st ?? 0) - (L ?? 0) - f;
1719
1731
  }
1720
- const U = A;
1721
- let q = x;
1722
- for (; q < r && A < t; )
1723
- A += s(q), q++;
1724
- if (A < t && x > 0) {
1725
- let it = A + Math.abs(Math.min(0, U)), Y = x - 1;
1726
- for (; Y >= 0 && it < t; )
1727
- it += s(Y), Y--;
1728
- for (x = nt(Y + 1, r), A = 0, q = x; q < r && A < t; )
1729
- A += s(q), q++;
1732
+ const B = k;
1733
+ let z = x;
1734
+ for (; z < r && k < t; )
1735
+ k += i(z), z++;
1736
+ if (k < t && x > 0) {
1737
+ let st = k + Math.abs(Math.min(0, B)), L = x - 1;
1738
+ for (; L >= 0 && st < t; )
1739
+ st += i(L), L--;
1740
+ for (x = it(L + 1, r), k = 0, z = x; z < r && k < t; )
1741
+ k += i(z), z++;
1730
1742
  }
1731
- const Q = nt(x - e, r), bt = nt(Math.max(q - 1, x), r), lt = nt(bt + e, r);
1732
- return { renderingStartIndex: Q, renderingEndIndex: lt, visibleStartIndex: x, visibleEndIndex: bt };
1733
- }, Ne = (n, t, e) => {
1734
- const r = Math.max(0, t ?? 0), s = P({ last: 0, id: null, arg: null }).current;
1735
- return B(
1743
+ const Q = it(x - e, r), pt = it(Math.max(z - 1, x), r), ct = it(pt + e, r);
1744
+ return { renderingStartIndex: Q, renderingEndIndex: ct, visibleStartIndex: x, visibleEndIndex: pt };
1745
+ }, ke = (n, t, e) => {
1746
+ const r = Math.max(0, t ?? 0), i = T({ last: 0, id: null, arg: null }).current;
1747
+ return Y(
1736
1748
  () => () => {
1737
- s.id !== null && (cancelAnimationFrame(s.id), s.id = null);
1749
+ i.id !== null && (cancelAnimationFrame(i.id), i.id = null);
1738
1750
  },
1739
- [s]
1740
- ), I(
1751
+ [i]
1752
+ ), P(
1741
1753
  (l) => {
1742
- if (s.arg = l, s.id !== null) return;
1754
+ if (i.arg = l, i.id !== null) return;
1743
1755
  const c = (d) => {
1744
- if (s.id = null, s.arg === null) return;
1745
- const f = d - s.last;
1746
- if (r === 0 || s.last === 0 || f >= r) {
1756
+ if (i.id = null, i.arg === null) return;
1757
+ const f = d - i.last;
1758
+ if (r === 0 || i.last === 0 || f >= r) {
1747
1759
  if (n.current)
1748
1760
  try {
1749
- e(n.current, s.arg);
1750
- } catch (p) {
1751
- console.error("[useThrottledInvoker] Error invoking callback", p);
1761
+ e(n.current, i.arg);
1762
+ } catch (h) {
1763
+ console.error("[useThrottledInvoker] Error invoking callback", h);
1752
1764
  }
1753
- s.arg = null, s.last = d;
1765
+ i.arg = null, i.last = d;
1754
1766
  }
1755
- s.arg !== null && (s.id = requestAnimationFrame(c));
1767
+ i.arg !== null && (i.id = requestAnimationFrame(c));
1756
1768
  };
1757
- s.id = requestAnimationFrame(c);
1769
+ i.id = requestAnimationFrame(c);
1758
1770
  },
1759
- [r, e, n, s]
1771
+ [r, e, n, i]
1760
1772
  );
1761
- }, gr = He.memo(({ index: n, top: t, height: e, item: r, children: s, clipItemHeight: l, enableKeyboardNavigation: c, onKeyDown: d, onFocus: f, registerItemRef: p }) => {
1762
- const m = I((A) => p(n, A), [n, p]), g = I((A) => d(A, n), [n, d]), E = I(() => f(n), [n, f]), x = I((A) => {
1763
- A.currentTarget.focus({ preventScroll: !0 });
1773
+ }, gr = He.memo(({ index: n, top: t, height: e, item: r, children: i, clipItemHeight: l, enableKeyboardNavigation: c, onKeyDown: d, onFocus: f, registerItemRef: h }) => {
1774
+ const m = P((k) => h(n, k), [n, h]), g = P((k) => d(k, n), [n, d]), N = P(() => f(n), [n, f]), x = P((k) => {
1775
+ k.currentTarget.focus({ preventScroll: !0 });
1764
1776
  }, []);
1765
1777
  return /* @__PURE__ */ $(
1766
1778
  "div",
@@ -1777,8 +1789,8 @@ const mr = 1e4, Sr = () => {
1777
1789
  tabIndex: c ? -1 : void 0,
1778
1790
  onPointerDown: c ? x : void 0,
1779
1791
  onKeyDownCapture: c ? g : void 0,
1780
- onFocusCapture: c ? E : void 0,
1781
- children: s(r, n)
1792
+ onFocusCapture: c ? N : void 0,
1793
+ children: i(r, n)
1782
1794
  }
1783
1795
  );
1784
1796
  }), xr = ({
@@ -1786,333 +1798,334 @@ const mr = 1e4, Sr = () => {
1786
1798
  getItem: t,
1787
1799
  getItemKey: e,
1788
1800
  getItemHeight: r,
1789
- viewportSize: s,
1801
+ viewportSize: i,
1790
1802
  overscanCount: l = 15,
1791
1803
  className: c,
1792
1804
  onScroll: d,
1793
1805
  onRangeChange: f,
1794
- children: p,
1806
+ children: h,
1795
1807
  background: m,
1796
1808
  initialScrollIndex: g,
1797
- initialScrollOffset: E,
1809
+ initialScrollOffset: N,
1798
1810
  callbackThrottleMs: x = 5,
1799
- contentInsets: A,
1800
- onItemFocus: U,
1801
- scrollBarOptions: q,
1802
- behaviorOptions: Q
1803
- }, bt) => {
1804
- const { width: lt, enableThumbDrag: it, enableTrackClick: Y, enableArrowButtons: tt, enableScrollToTopBottomButtons: C, renderThumbOverlay: K, tapScrollCircleOptions: G } = q ?? {}, { enablePointerDrag: Tt, enableKeyboardNavigation: L = !0, wheelSpeedMultiplier: D, inertiaOptions: Z, clipItemHeight: J = !1, resetOnGetItemHeightChange: W = !1 } = Q ?? {}, F = P(null), It = P({
1811
+ contentInsets: k,
1812
+ onItemFocus: B,
1813
+ scrollBarOptions: z,
1814
+ behaviorOptions: Q,
1815
+ onWheelHorizontal: pt
1816
+ }, ct) => {
1817
+ const { width: st, enableThumbDrag: L, enableTrackClick: tt, enableArrowButtons: et, enableScrollToTopBottomButtons: E, renderThumbOverlay: ut, tapScrollCircleOptions: Pt } = z ?? {}, { enablePointerDrag: ht, enableKeyboardNavigation: I = !0, wheelSpeedMultiplier: W, inertiaOptions: St, clipItemHeight: Dt = !1, resetOnGetItemHeightChange: ot = !1 } = Q ?? {}, A = T(null), G = T({
1805
1818
  renderingStartIndex: 0,
1806
1819
  renderingEndIndex: 0,
1807
1820
  visibleStartIndex: 0,
1808
1821
  visibleEndIndex: 0,
1809
1822
  scrollPosition: 0,
1810
1823
  totalHeight: 0
1811
- }), ct = P(null), vt = P(!1);
1812
- B(() => {
1813
- W && (ct.current = null);
1814
- }, [W]);
1815
- const T = Vt(() => De(A), [A]), Mt = Vt(
1824
+ }), dt = T(null), It = T(!1);
1825
+ Y(() => {
1826
+ ot && (dt.current = null);
1827
+ }, [ot]);
1828
+ const v = At(() => Ne(k), [k]), kt = At(
1816
1829
  // 目的: Fenwick Tree のオプション設定
1817
1830
  // 依存関係: resetOnGetItemHeightChange
1818
1831
  () => ({
1819
1832
  sampleRange: { from: 0, to: 100 },
1820
- resetOnValueFnChange: W,
1833
+ resetOnValueFnChange: ot,
1821
1834
  materialize: !0
1822
1835
  }),
1823
- [W]
1824
- ), b = ur(n, r, Mt), [St] = Bt(() => {
1825
- let i = T.top, a = 0;
1836
+ [ot]
1837
+ ), S = ur(n, r, kt), [rt] = Bt(() => {
1838
+ let s = v.top, a = 0;
1826
1839
  if (typeof g == "number") {
1827
- const u = pt(g, 0, n - 1), y = pt(u - l * 2, 0, n - 1), w = pt(u + l * 2, 0, n - 1), V = g > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: y, to: w }] } } : void 0, { cumulative: z, total: X, currentValue: O } = b.prefixSum(g, V), H = Math.max(z - O, 0);
1828
- i = oe(H, T.top), a = X ?? b.getTotal();
1829
- } else typeof E == "number" && (i = oe(Math.max(E, 0), T.top)), a = b.getTotal();
1830
- return { position: i, total: a };
1831
- }), [yt, Ot] = Bt(St.position), [v, N] = Bt(St.total), k = P(St.position), et = P(T.top), ut = P(d ?? void 0), Dt = P(f ?? void 0), mt = P(/* @__PURE__ */ new Map()), st = P(null), ot = P(null), [Ct, Et] = Bt(null), [wt, At] = Bt(!1), Xt = P(null), ht = P(!1), h = P(0), M = P(!1), j = P(n);
1832
- j.current !== n && (j.current = n, M.current = !0), B(() => {
1833
- ut.current = d ?? void 0, Dt.current = f ?? void 0;
1840
+ const u = xt(g, 0, n - 1), R = xt(u - l * 2, 0, n - 1), D = xt(u + l * 2, 0, n - 1), C = g > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: R, to: D }] } } : void 0, { cumulative: X, total: U, currentValue: F } = S.prefixSum(g, C), O = Math.max(X - F, 0);
1841
+ s = se(O, v.top), a = U ?? S.getTotal();
1842
+ } else typeof N == "number" && (s = se(Math.max(N, 0), v.top)), a = S.getTotal();
1843
+ return { position: s, total: a };
1844
+ }), [Vt, Gt] = Bt(rt.position), [Mt, b] = Bt(rt.total), M = T(rt.position), q = T(v.top), ft = T(d ?? void 0), j = T(f ?? void 0), mt = T(/* @__PURE__ */ new Map()), Z = T(null), J = T(null), [bt, qt] = Bt(null), [yt, Tt] = Bt(!1), Ct = T(null), _t = T(!1), at = T(0), p = T(!1), y = T(n);
1845
+ y.current !== n && (y.current = n, p.current = !0), Y(() => {
1846
+ ft.current = d ?? void 0, j.current = f ?? void 0;
1834
1847
  }, [f, d]);
1835
- const at = I(
1836
- (i) => {
1837
- if (L && i && typeof i.focus == "function")
1848
+ const nt = P(
1849
+ (s) => {
1850
+ if (I && s && typeof s.focus == "function")
1838
1851
  try {
1839
- i.focus({ preventScroll: !0 });
1852
+ s.focus({ preventScroll: !0 });
1840
1853
  } catch {
1841
- i.focus();
1854
+ s.focus();
1842
1855
  }
1843
1856
  },
1844
- [L]
1845
- ), dt = I((i, { position: a, totalHeight: u }) => {
1846
- i(a, u);
1847
- }, []), Yt = Ne(ut, x, dt), ft = I((i, a) => {
1848
- i(a);
1849
- }, []), zt = Ne(Dt, x, ft);
1850
- B(() => (vt.current = !0, () => {
1851
- vt.current = !1;
1852
- }), []), B(() => {
1853
- L || (mt.current.clear(), st.current = null, ot.current = null);
1854
- }, [L]);
1855
- const Zt = I(
1856
- (i, a) => {
1857
+ [I]
1858
+ ), Lt = P((s, { position: a, totalHeight: u }) => {
1859
+ s(a, u);
1860
+ }, []), H = ke(ft, x, Lt), Zt = P((s, a) => {
1861
+ s(a);
1862
+ }, []), Ft = ke(j, x, Zt);
1863
+ Y(() => (It.current = !0, () => {
1864
+ It.current = !1;
1865
+ }), []), Y(() => {
1866
+ I || (mt.current.clear(), Z.current = null, J.current = null);
1867
+ }, [I]);
1868
+ const wt = P(
1869
+ (s, a) => {
1857
1870
  if (!a) {
1858
- mt.current.delete(i);
1871
+ mt.current.delete(s);
1859
1872
  return;
1860
1873
  }
1861
- L && (mt.current.set(i, a), st.current === i && (st.current = null, ot.current = i, at(a)));
1874
+ I && (mt.current.set(s, a), Z.current === s && (Z.current = null, J.current = s, nt(a)));
1862
1875
  },
1863
- [L, at]
1864
- ), Nt = 0.01, Ut = P({
1876
+ [I, nt]
1877
+ ), Ht = 0.01, gt = T({
1865
1878
  rafId: null,
1866
1879
  loopActive: !1,
1867
1880
  idleFrames: 0,
1868
- lastRenderedPosition: St.position
1869
- }), Pt = I(() => {
1870
- const i = Ut.current;
1871
- i.rafId !== null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(i.rafId), i.rafId = null, i.loopActive = !1, i.idleFrames = 0;
1881
+ lastRenderedPosition: rt.position
1882
+ }), Rt = P(() => {
1883
+ const s = gt.current;
1884
+ s.rafId !== null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(s.rafId), s.rafId = null, s.loopActive = !1, s.idleFrames = 0;
1872
1885
  }, []);
1873
- B(
1886
+ Y(
1874
1887
  () => () => {
1875
- Pt();
1888
+ Rt();
1876
1889
  },
1877
- [Pt]
1890
+ [Rt]
1878
1891
  );
1879
- const Rt = I(() => {
1880
- const i = Ut.current;
1881
- i.rafId = null;
1882
- const a = k.current, u = Gt(a, T.top), y = b.getTotal();
1883
- if (Ot((V) => Math.abs(V - a) < Nt ? V : a), Yt({ position: u, totalHeight: y }), Math.abs(i.lastRenderedPosition - a) >= Nt ? (i.lastRenderedPosition = a, i.idleFrames = 0) : i.idleFrames += 1, i.idleFrames >= 2) {
1884
- Pt();
1892
+ const Jt = P(() => {
1893
+ const s = gt.current;
1894
+ s.rafId = null;
1895
+ const a = M.current, u = jt(a, v.top), R = S.getTotal();
1896
+ if (Gt((C) => Math.abs(C - a) < Ht ? C : a), H({ position: u, totalHeight: R }), Math.abs(s.lastRenderedPosition - a) >= Ht ? (s.lastRenderedPosition = a, s.idleFrames = 0) : s.idleFrames += 1, s.idleFrames >= 2) {
1897
+ Rt();
1885
1898
  return;
1886
1899
  }
1887
1900
  if (typeof requestAnimationFrame == "function") {
1888
- i.rafId = requestAnimationFrame(Rt);
1901
+ s.rafId = requestAnimationFrame(Jt);
1889
1902
  return;
1890
1903
  }
1891
- i.loopActive = !1;
1892
- }, [b, T.top, Yt, Pt]), Qt = I(() => {
1893
- const i = Ut.current;
1894
- if (i.idleFrames = 0, !i.loopActive) {
1895
- if (i.loopActive = !0, typeof requestAnimationFrame == "function") {
1896
- i.rafId = requestAnimationFrame(Rt);
1904
+ s.loopActive = !1;
1905
+ }, [S, v.top, H, Rt]), ae = P(() => {
1906
+ const s = gt.current;
1907
+ if (s.idleFrames = 0, !s.loopActive) {
1908
+ if (s.loopActive = !0, typeof requestAnimationFrame == "function") {
1909
+ s.rafId = requestAnimationFrame(Jt);
1897
1910
  return;
1898
1911
  }
1899
- i.loopActive = !1;
1912
+ s.loopActive = !1;
1900
1913
  }
1901
- }, [Rt]), rt = I(
1902
- (i, a) => {
1903
- const u = a?.immediate ?? !1, y = Gt(i, T.top);
1904
- if (k.current = i, u) {
1905
- Ut.current.lastRenderedPosition = i, Ut.current.idleFrames = 0, Ot(i), Yt({ position: y, totalHeight: b.getTotal() });
1914
+ }, [Jt]), lt = P(
1915
+ (s, a) => {
1916
+ const u = a?.immediate ?? !1, R = jt(s, v.top);
1917
+ if (M.current = s, u) {
1918
+ gt.current.lastRenderedPosition = s, gt.current.idleFrames = 0, Gt(s), H({ position: R, totalHeight: S.getTotal() });
1906
1919
  return;
1907
1920
  }
1908
- Qt();
1921
+ ae();
1909
1922
  },
1910
- [Qt, b, T.top, Yt]
1911
- ), fe = P(!1);
1912
- B(() => {
1913
- if (!fe.current)
1914
- if (fe.current = !0, typeof E == "number") {
1915
- const i = oe(Math.max(E, 0), T.top), a = Math.abs(i - k.current) > 0.5;
1916
- rt(i, { immediate: !0 }), a && F.current?.scrollTo(i);
1923
+ [ae, S, v.top, H]
1924
+ ), le = T(!1);
1925
+ Y(() => {
1926
+ if (!le.current)
1927
+ if (le.current = !0, typeof N == "number") {
1928
+ const s = se(Math.max(N, 0), v.top), a = Math.abs(s - M.current) > 0.5;
1929
+ lt(s, { immediate: !0 }), a && A.current?.scrollTo(s);
1917
1930
  } else
1918
- rt(k.current, { immediate: !0 });
1919
- }, [E, T.top, rt]), B(() => {
1920
- const i = b.getTotal();
1921
- v !== i && N(i);
1922
- }, [b, v, n]), B(() => {
1923
- if (ct.current !== null) {
1924
- const { index: i, align: a, offset: u } = ct.current, y = nt(i, n), { cumulative: w, currentValue: V } = b.prefixSum(y, { materializeOption: { materialize: !1 } });
1925
- if (w !== void 0 && V !== void 0) {
1926
- const z = Math.max(w - V, 0);
1927
- let X = z;
1928
- a === "bottom" ? X = w - s : a === "center" && (X = z + V / 2 - s / 2), u && (X -= u), X = Math.max(0, X);
1929
- const O = Math.max(0, v + T.top + T.bottom - s), H = Math.min(oe(X, T.top), O);
1930
- Math.abs(H - k.current) > 1 && (_.debug("[VirtualScroll] Drift correction", {
1931
- from: k.current,
1932
- to: H,
1933
- targetIndex: y
1934
- }), h.current === 0 && (h.current += 1), F.current?.scrollTo(H), rt(H, { immediate: !0 }));
1931
+ lt(M.current, { immediate: !0 });
1932
+ }, [N, v.top, lt]), Y(() => {
1933
+ const s = S.getTotal();
1934
+ Mt !== s && b(s);
1935
+ }, [S, Mt, n]), Y(() => {
1936
+ if (dt.current !== null) {
1937
+ const { index: s, align: a, offset: u } = dt.current, R = it(s, n), { cumulative: D, currentValue: C } = S.prefixSum(R, { materializeOption: { materialize: !1 } });
1938
+ if (D !== void 0 && C !== void 0) {
1939
+ const X = Math.max(D - C, 0);
1940
+ let U = X;
1941
+ a === "bottom" ? U = D - i : a === "center" && (U = X + C / 2 - i / 2), u && (U -= u), U = Math.max(0, U);
1942
+ const F = Math.max(0, Mt + v.top + v.bottom - i), O = Math.min(se(U, v.top), F);
1943
+ Math.abs(O - M.current) > 1 && (_.debug("[VirtualScroll] Drift correction", {
1944
+ from: M.current,
1945
+ to: O,
1946
+ targetIndex: R
1947
+ }), at.current === 0 && (at.current += 1), A.current?.scrollTo(O), lt(O, { immediate: !0 }));
1935
1948
  }
1936
1949
  }
1937
- M.current = !1;
1938
- }, [v, b, n, T.top, rt, s, T.bottom]), B(() => {
1939
- const i = et.current;
1940
- if (i === T.top) return;
1941
- const a = Gt(k.current, i), u = oe(a, T.top);
1942
- et.current = T.top, k.current = u, F.current?.scrollTo(u), rt(u, { immediate: !0 });
1943
- }, [T.top, rt]);
1944
- const le = I(
1945
- (i, a) => {
1946
- const u = nt(i, n), y = b.get(u), w = a - y, V = b.update(u, a);
1947
- V !== void 0 && N(V), _.debug("[VirtualScroll] Updated item size manually", { index: u, size: a, total: V });
1948
- let z = ct.current ? ct.current.index : null;
1949
- if (z === null) {
1950
- const X = k.current, O = De(A).top, H = Gt(X, O), { index: gt } = b.findIndexAtOrAfter(H, { materializeOption: { materialize: !1 } });
1951
- z = gt;
1950
+ p.current = !1;
1951
+ }, [Mt, S, n, v.top, lt, i, v.bottom]), Y(() => {
1952
+ const s = q.current;
1953
+ if (s === v.top) return;
1954
+ const a = jt(M.current, s), u = se(a, v.top);
1955
+ q.current = v.top, M.current = u, A.current?.scrollTo(u), lt(u, { immediate: !0 });
1956
+ }, [v.top, lt]);
1957
+ const ce = P(
1958
+ (s, a) => {
1959
+ const u = it(s, n), R = S.get(u), D = a - R, C = S.update(u, a);
1960
+ C !== void 0 && b(C), _.debug("[VirtualScroll] Updated item size manually", { index: u, size: a, total: C });
1961
+ let X = dt.current ? dt.current.index : null;
1962
+ if (X === null) {
1963
+ const U = M.current, F = Ne(k).top, O = jt(U, F), { index: Et } = S.findIndexAtOrAfter(O, { materializeOption: { materialize: !1 } });
1964
+ X = Et;
1952
1965
  }
1953
- if (z !== -1 && u < z && w !== 0) {
1954
- const X = k.current, O = X + w;
1955
- h.current += 1, rt(O, { immediate: !0 }), F.current?.scrollTo(O), _.debug("[VirtualScroll] Adjusted scroll for layout shift (manual update)", { from: X, to: O, causedByIndex: u, delta: w, activeVisibleStartIndex: z });
1966
+ if (X !== -1 && u < X && D !== 0) {
1967
+ const U = M.current, F = U + D;
1968
+ at.current += 1, lt(F, { immediate: !0 }), A.current?.scrollTo(F), _.debug("[VirtualScroll] Adjusted scroll for layout shift (manual update)", { from: U, to: F, causedByIndex: u, delta: D, activeVisibleStartIndex: X });
1956
1969
  }
1957
1970
  },
1958
- [b, n, rt, A]
1959
- ), kt = I(
1960
- (i, a) => {
1961
- if (!F.current)
1971
+ [S, n, lt, k]
1972
+ ), Nt = P(
1973
+ (s, a) => {
1974
+ if (!A.current)
1962
1975
  return;
1963
- const u = nt(i, n), y = nt(u - l * 2, n), w = nt(u + l * 2, n), { cumulative: V, total: z, currentValue: X } = b.prefixSum(u, { materializeOption: { materialize: !0, ranges: [{ from: y, to: w }] } });
1964
- if (_.debug("[VirtualScroll] Scrolling to index:", u, "ItemBottom:", V, "Total height:", z, "ItemHeight:", X, "safeIndexFrom:", y, "safeIndexTo:", w), !z)
1976
+ const u = it(s, n), R = it(u - l * 2, n), D = it(u + l * 2, n), { cumulative: C, total: X, currentValue: U } = S.prefixSum(u, { materializeOption: { materialize: !0, ranges: [{ from: R, to: D }] } });
1977
+ if (_.debug("[VirtualScroll] Scrolling to index:", u, "ItemBottom:", C, "Total height:", X, "ItemHeight:", U, "safeIndexFrom:", R, "safeIndexTo:", D), !X)
1965
1978
  return;
1966
- const O = Math.max(V - X, 0);
1967
- let H = O;
1968
- a?.align === "bottom" ? H = V - s : a?.align === "center" && (H = O + X / 2 - s / 2), a?.offset && (H -= a.offset), H = Math.max(0, H);
1969
- const gt = oe(H, T.top), xt = F.current?.getContentSize() ?? z + T.top + T.bottom, Lt = Math.max(0, xt - s), Jt = Math.min(gt, Lt);
1970
- ct.current = {
1979
+ const F = Math.max(C - U, 0);
1980
+ let O = F;
1981
+ a?.align === "bottom" ? O = C - i : a?.align === "center" && (O = F + U / 2 - i / 2), a?.offset && (O -= a.offset), O = Math.max(0, O);
1982
+ const Et = se(O, v.top), vt = A.current?.getContentSize() ?? X + v.top + v.bottom, zt = Math.max(0, vt - i), te = Math.min(Et, zt);
1983
+ dt.current = {
1971
1984
  index: u,
1972
1985
  align: a?.align,
1973
1986
  offset: a?.offset
1974
1987
  };
1975
- const ce = F.current?.getScrollPosition() ?? -1, ue = Math.abs(ce - Jt) > 0.5;
1976
- ht.current = !1, h.current = 0, ue && (ht.current = !0, h.current += 1, F.current?.scrollTo(Jt)), N(z), rt(Jt, { immediate: !0 }), _.debug("[VirtualScroll] Setting scroll position to:", Jt, { original: gt, max: Lt });
1988
+ const ue = A.current?.getScrollPosition() ?? -1, de = Math.abs(ue - te) > 0.5;
1989
+ _t.current = !1, at.current = 0, de && (_t.current = !0, at.current += 1, A.current?.scrollTo(te)), b(X), lt(te, { immediate: !0 }), _.debug("[VirtualScroll] Setting scroll position to:", te, { original: Et, max: zt });
1977
1990
  },
1978
- [b, l, n, T.top, T.bottom, s, rt]
1979
- ), ne = I(
1980
- (i) => {
1981
- if (!F.current)
1991
+ [S, l, n, v.top, v.bottom, i, lt]
1992
+ ), ee = P(
1993
+ (s) => {
1994
+ if (!A.current)
1982
1995
  return;
1983
- const a = b.getTotal(), u = pt(Math.floor(i), 0, a), { index: y, cumulative: w, currentValue: V } = b.findIndexAtOrAfter(u, { materializeOption: { materialize: !1 } }), X = (w ?? 0) - (V ?? 0) - u;
1984
- kt(y, { offset: X });
1996
+ const a = S.getTotal(), u = xt(Math.floor(s), 0, a), { index: R, cumulative: D, currentValue: C } = S.findIndexAtOrAfter(u, { materializeOption: { materialize: !1 } }), U = (D ?? 0) - (C ?? 0) - u;
1997
+ Nt(R, { offset: U });
1985
1998
  },
1986
- [b, kt]
1987
- ), te = I(
1988
- (i) => {
1989
- const a = Gt(k.current, T.top), u = typeof i == "function" ? i(a) : i;
1990
- ne(u);
1991
- const y = F.current?.getScrollPosition(), w = typeof y == "number" ? y : k.current;
1992
- return rt(w), w;
1999
+ [S, Nt]
2000
+ ), me = P(
2001
+ (s) => {
2002
+ const a = jt(M.current, v.top), u = typeof s == "function" ? s(a) : s;
2003
+ ee(u);
2004
+ const R = A.current?.getScrollPosition(), D = typeof R == "number" ? R : M.current;
2005
+ return lt(D), D;
1993
2006
  },
1994
- [T.top, ne, rt]
1995
- ), be = I(
1996
- (i, a) => {
1997
- _.debug("[VirtualScroll] Scroll position changed:", i);
1998
- const u = ht.current;
1999
- u && (ht.current = !1);
2000
- const y = h.current > 0;
2001
- if (y && (h.current = 0), u || y || M.current || (ct.current = null), rt(i), C) {
2002
- if (u || y)
2007
+ [v.top, ee, lt]
2008
+ ), Ie = P(
2009
+ (s, a) => {
2010
+ _.debug("[VirtualScroll] Scroll position changed:", s);
2011
+ const u = _t.current;
2012
+ u && (_t.current = !1);
2013
+ const R = at.current > 0;
2014
+ if (R && (at.current = 0), u || R || p.current || (dt.current = null), lt(s), E) {
2015
+ if (u || R)
2003
2016
  return;
2004
- const w = i - a;
2005
- if (_.debug("[VirtualScroll] Scroll diff:", w, "New:", i, "Prev:", a), Math.abs(w) > 1) {
2006
- const V = w > 0 ? "down" : "up";
2007
- Et(V), At(!0), _.debug("[VirtualScroll] Showing scroll buttons. Direction:", V), Xt.current && clearTimeout(Xt.current), Xt.current = setTimeout(() => {
2008
- At(!1), _.debug("[VirtualScroll] Hiding scroll buttons");
2017
+ const D = s - a;
2018
+ if (_.debug("[VirtualScroll] Scroll diff:", D, "New:", s, "Prev:", a), Math.abs(D) > 1) {
2019
+ const C = D > 0 ? "down" : "up";
2020
+ qt(C), Tt(!0), _.debug("[VirtualScroll] Showing scroll buttons. Direction:", C), Ct.current && clearTimeout(Ct.current), Ct.current = setTimeout(() => {
2021
+ Tt(!1), _.debug("[VirtualScroll] Hiding scroll buttons");
2009
2022
  }, 2e3);
2010
2023
  }
2011
2024
  }
2012
2025
  },
2013
- [rt, C]
2014
- ), qt = Vt(() => Gt(yt, T.top), [T.top, yt]), _t = Vt(() => {
2015
- const i = b.getTotal(), a = hr(qt, s, l, n, r, b, i);
2026
+ [lt, E]
2027
+ ), Ot = At(() => jt(Vt, v.top), [v.top, Vt]), Qt = At(() => {
2028
+ const s = S.getTotal(), a = hr(Ot, i, l, n, r, S, s);
2016
2029
  return _.debug("[VirtualScroll] Calculated rendering range:", {
2017
2030
  ...a,
2018
- scrollPosition: qt,
2019
- renderingContentSize: i,
2031
+ scrollPosition: Ot,
2032
+ renderingContentSize: s,
2020
2033
  overscanCount: l,
2021
- viewportSize: s
2034
+ viewportSize: i
2022
2035
  }), a;
2023
- }, [qt, s, l, n, r, b]), { renderingStartIndex: $t, renderingEndIndex: Kt, visibleStartIndex: Ft, visibleEndIndex: Wt } = _t, jt = I(
2024
- (i, a) => {
2025
- if (!L || n === 0)
2036
+ }, [Ot, i, l, n, r, S]), { renderingStartIndex: Ut, renderingEndIndex: $t, visibleStartIndex: Yt, visibleEndIndex: Kt } = Qt, Wt = P(
2037
+ (s, a) => {
2038
+ if (!I || n === 0)
2026
2039
  return;
2027
- const u = nt(i, n);
2040
+ const u = it(s, n);
2028
2041
  if (!(a?.ensureVisible ?? !0)) {
2029
- const Lt = mt.current.get(u);
2030
- Lt && (st.current = null, ot.current = u, at(Lt));
2042
+ const zt = mt.current.get(u);
2043
+ zt && (Z.current = null, J.current = u, nt(zt));
2031
2044
  return;
2032
2045
  }
2033
- const w = b.prefixSum(u, { materializeOption: { materialize: !1 } }), V = w.currentValue, z = Math.max(w.cumulative - V, 0), X = z + V, O = Gt(k.current, T.top), H = O + s;
2034
- if (z < O || X > H) {
2035
- st.current = u, kt(u);
2046
+ const D = S.prefixSum(u, { materializeOption: { materialize: !1 } }), C = D.currentValue, X = Math.max(D.cumulative - C, 0), U = X + C, F = jt(M.current, v.top), O = F + i;
2047
+ if (X < F || U > O) {
2048
+ Z.current = u, Nt(u);
2036
2049
  return;
2037
2050
  }
2038
- const xt = mt.current.get(u);
2039
- if (xt) {
2040
- st.current = null, ot.current = u, at(xt);
2051
+ const vt = mt.current.get(u);
2052
+ if (vt) {
2053
+ Z.current = null, J.current = u, nt(vt);
2041
2054
  return;
2042
2055
  }
2043
- st.current = u;
2056
+ Z.current = u;
2044
2057
  },
2045
- [L, n, b, T.top, kt, at, s]
2046
- ), me = I(
2047
- (i, a) => {
2048
- if (!L || i.defaultPrevented || i.altKey || i.metaKey || i.ctrlKey)
2058
+ [I, n, S, v.top, Nt, nt, i]
2059
+ ), pe = P(
2060
+ (s, a) => {
2061
+ if (!I || s.defaultPrevented || s.altKey || s.metaKey || s.ctrlKey)
2049
2062
  return;
2050
- const u = i.target;
2063
+ const u = s.target;
2051
2064
  if (u) {
2052
- const y = u.tagName;
2053
- if (y === "INPUT" || y === "TEXTAREA" || y === "SELECT" || u.isContentEditable)
2065
+ const R = u.tagName;
2066
+ if (R === "INPUT" || R === "TEXTAREA" || R === "SELECT" || u.isContentEditable)
2054
2067
  return;
2055
2068
  }
2056
- if (i.key === "ArrowDown") {
2057
- a < n - 1 && (i.preventDefault(), jt(a + 1));
2069
+ if (s.key === "ArrowDown") {
2070
+ a < n - 1 && (s.preventDefault(), Wt(a + 1));
2058
2071
  return;
2059
2072
  }
2060
- if (i.key === "ArrowUp") {
2061
- a > 0 && (i.preventDefault(), jt(a - 1));
2073
+ if (s.key === "ArrowUp") {
2074
+ a > 0 && (s.preventDefault(), Wt(a - 1));
2062
2075
  return;
2063
2076
  }
2064
- if (i.key === "PageDown") {
2077
+ if (s.key === "PageDown") {
2065
2078
  if (a < n - 1) {
2066
- i.preventDefault();
2067
- const y = Math.max(Wt - Ft + 1, 1), w = Math.max(y, 1), V = nt(Math.min(a + w, n - 1), n);
2068
- jt(V);
2079
+ s.preventDefault();
2080
+ const R = Math.max(Kt - Yt + 1, 1), D = Math.max(R, 1), C = it(Math.min(a + D, n - 1), n);
2081
+ Wt(C);
2069
2082
  }
2070
2083
  return;
2071
2084
  }
2072
- if (i.key === "PageUp" && a > 0) {
2073
- i.preventDefault();
2074
- const y = Math.max(Wt - Ft + 1, 1), w = Math.max(y, 1), V = nt(a - w, n);
2075
- jt(V);
2085
+ if (s.key === "PageUp" && a > 0) {
2086
+ s.preventDefault();
2087
+ const R = Math.max(Kt - Yt + 1, 1), D = Math.max(R, 1), C = it(a - D, n);
2088
+ Wt(C);
2076
2089
  }
2077
2090
  },
2078
- [L, n, jt, Wt, Ft]
2079
- ), pe = I(
2080
- (i) => {
2081
- if (!L)
2091
+ [I, n, Wt, Kt, Yt]
2092
+ ), he = P(
2093
+ (s) => {
2094
+ if (!I)
2082
2095
  return;
2083
- const a = nt(i, n);
2084
- st.current = null, ot.current = a, U?.(a);
2096
+ const a = it(s, n);
2097
+ Z.current = null, J.current = a, B?.(a);
2085
2098
  },
2086
- [L, n, U]
2099
+ [I, n, B]
2087
2100
  );
2088
- B(() => {
2089
- const i = F.current?.getScrollPosition() ?? 0, a = k.current, u = Gt(a, T.top);
2101
+ Y(() => {
2102
+ const s = A.current?.getScrollPosition() ?? 0, a = M.current, u = jt(a, v.top);
2090
2103
  _.debug("[VirtualScroll] Range change effect triggered", {
2091
- renderingStartIndex: $t,
2092
- renderingEndIndex: Kt,
2093
- visibleStartIndex: Ft,
2094
- visibleEndIndex: Wt,
2095
- scrollPositionState: yt,
2104
+ renderingStartIndex: Ut,
2105
+ renderingEndIndex: $t,
2106
+ visibleStartIndex: Yt,
2107
+ visibleEndIndex: Kt,
2108
+ scrollPositionState: Vt,
2096
2109
  paneScrollPosition: a,
2097
2110
  logicalScrollPosition: u,
2098
- contentSize: v,
2099
- scrollPaneScrollPosition: i
2100
- }), zt({
2101
- renderingStartIndex: $t,
2102
- renderingEndIndex: Kt,
2103
- visibleStartIndex: Ft,
2104
- visibleEndIndex: Wt,
2111
+ contentSize: Mt,
2112
+ scrollPaneScrollPosition: s
2113
+ }), Ft({
2114
+ renderingStartIndex: Ut,
2115
+ renderingEndIndex: $t,
2116
+ visibleStartIndex: Yt,
2117
+ visibleEndIndex: Kt,
2105
2118
  scrollPosition: u,
2106
- totalHeight: v
2119
+ totalHeight: Mt
2107
2120
  });
2108
- }, [v, Kt, $t, T.top, zt, yt, Wt, Ft]);
2109
- const ve = I(() => C ? /* @__PURE__ */ $("div", { className: "aqvs-scroll-to-edge-overlay", "data-visible": wt && Ct !== null, children: Ct === "up" ? /* @__PURE__ */ $("div", { className: "aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-top", children: /* @__PURE__ */ $(
2121
+ }, [Mt, $t, Ut, v.top, Ft, Vt, Kt, Yt]);
2122
+ const ge = P(() => E ? /* @__PURE__ */ $("div", { className: "aqvs-scroll-to-edge-overlay", "data-visible": yt && bt !== null, children: bt === "up" ? /* @__PURE__ */ $("div", { className: "aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-top", children: /* @__PURE__ */ $(
2110
2123
  "button",
2111
2124
  {
2112
2125
  type: "button",
2113
2126
  className: "aqvs-scroll-to-edge-button",
2114
2127
  onClick: (u) => {
2115
- u.stopPropagation(), ht.current = !0, kt(0), At(!1);
2128
+ u.stopPropagation(), _t.current = !0, Nt(0), Tt(!1);
2116
2129
  },
2117
2130
  children: "Top"
2118
2131
  }
@@ -2122,181 +2135,182 @@ const mr = 1e4, Sr = () => {
2122
2135
  type: "button",
2123
2136
  className: "aqvs-scroll-to-edge-button",
2124
2137
  onClick: (u) => {
2125
- u.stopPropagation(), ht.current = !0, kt(n - 1), At(!1);
2138
+ u.stopPropagation(), _t.current = !0, Nt(n - 1), Tt(!1);
2126
2139
  },
2127
2140
  children: "Bottom"
2128
2141
  }
2129
- ) }) }) : null, [C, wt, Ct, kt, n]), { visibleItems: ie, startPosition: se } = Vt(() => {
2142
+ ) }) }) : null, [E, yt, bt, Nt, n]), { visibleItems: ie, startPosition: o } = At(() => {
2130
2143
  if (n === 0)
2131
2144
  return {
2132
2145
  visibleItems: /* @__PURE__ */ $("div", { className: "aqvs-no-items-container", children: /* @__PURE__ */ $("div", { className: "aqvs-no-items-text", children: "No items" }) }),
2133
2146
  startPosition: 0
2134
2147
  };
2135
- const i = nt($t, n), a = nt(Kt, n), { cumulative: u, currentValue: y } = b.prefixSum(i, { materializeOption: { materialize: !1 } }), w = u - y, V = [], z = [];
2136
- let X = 0;
2137
- for (let O = i; O <= a; O++) {
2138
- const H = r(O), gt = b.get(O), xt = H - gt;
2139
- xt !== 0 && V.push({ index: O, value: H });
2140
- const { cumulative: Lt, currentValue: Jt } = b.prefixSum(O, { materializeOption: { materialize: !1 } }), ce = Lt - Jt + X, ue = e ? e(O) : O;
2141
- z.push(
2148
+ const s = it(Ut, n), a = it($t, n), { cumulative: u, currentValue: R } = S.prefixSum(s, { materializeOption: { materialize: !1 } }), D = u - R, C = [], X = [];
2149
+ let U = 0;
2150
+ for (let F = s; F <= a; F++) {
2151
+ const O = r(F), Et = S.get(F), vt = O - Et;
2152
+ vt !== 0 && C.push({ index: F, value: O });
2153
+ const { cumulative: zt, currentValue: te } = S.prefixSum(F, { materializeOption: { materialize: !1 } }), ue = zt - te + U, de = e ? e(F) : F;
2154
+ X.push(
2142
2155
  /* @__PURE__ */ $(
2143
2156
  gr,
2144
2157
  {
2145
- index: O,
2146
- top: ce - w + T.top,
2147
- height: H,
2148
- item: t(O),
2149
- clipItemHeight: J,
2150
- enableKeyboardNavigation: L,
2151
- onKeyDown: me,
2152
- onFocus: pe,
2153
- registerItemRef: Zt,
2154
- children: p
2158
+ index: F,
2159
+ top: ue - D + v.top,
2160
+ height: O,
2161
+ item: t(F),
2162
+ clipItemHeight: Dt,
2163
+ enableKeyboardNavigation: I,
2164
+ onKeyDown: pe,
2165
+ onFocus: he,
2166
+ registerItemRef: wt,
2167
+ children: h
2155
2168
  },
2156
- ue
2169
+ de
2157
2170
  )
2158
- ), X += xt;
2171
+ ), U += vt;
2159
2172
  }
2160
- return V.length > 0 && Promise.resolve().then(() => {
2161
- if (!vt.current)
2173
+ return C.length > 0 && Promise.resolve().then(() => {
2174
+ if (!It.current)
2162
2175
  return;
2163
- let O = 0;
2164
- for (const xt of V)
2165
- if (xt.index < Ft) {
2166
- const Lt = b.get(xt.index);
2167
- O += xt.value - Lt;
2176
+ let F = 0;
2177
+ for (const vt of C)
2178
+ if (vt.index < Yt) {
2179
+ const zt = S.get(vt.index);
2180
+ F += vt.value - zt;
2168
2181
  }
2169
- const H = b.updates(V);
2170
- if (!vt.current || typeof H != "number")
2182
+ const O = S.updates(C);
2183
+ if (!It.current || typeof O != "number")
2171
2184
  return;
2172
- N(H), _.debug("[VirtualScroll] Updated heights for items", V, "New total height:", H);
2173
- const gt = F.current?.getScrollPosition() ?? k.current;
2174
- if (O !== 0) {
2175
- const xt = gt + O;
2176
- h.current += 1, rt(xt, { immediate: !0 }), F.current?.scrollTo(xt), _.debug("[VirtualScroll] Adjusted scroll for layout shift (auto update)", { from: gt, to: xt, shiftAmount: O });
2177
- } else gt !== k.current && rt(gt);
2178
- }), { visibleItems: z, startPosition: w };
2185
+ b(O), _.debug("[VirtualScroll] Updated heights for items", C, "New total height:", O);
2186
+ const Et = A.current?.getScrollPosition() ?? M.current;
2187
+ if (F !== 0) {
2188
+ const vt = Et + F;
2189
+ at.current += 1, lt(vt, { immediate: !0 }), A.current?.scrollTo(vt), _.debug("[VirtualScroll] Adjusted scroll for layout shift (auto update)", { from: Et, to: vt, shiftAmount: F });
2190
+ } else Et !== M.current && lt(Et);
2191
+ }), { visibleItems: X, startPosition: D };
2179
2192
  }, [
2180
- p,
2181
- J,
2182
- L,
2193
+ h,
2194
+ Dt,
2195
+ I,
2183
2196
  n,
2184
- b,
2197
+ S,
2185
2198
  t,
2186
2199
  e,
2187
2200
  r,
2201
+ he,
2188
2202
  pe,
2189
- me,
2190
- Zt,
2191
- Kt,
2203
+ wt,
2192
2204
  $t,
2193
- T.top,
2194
- rt,
2195
- Ft
2196
- ]), o = I(
2197
- (i) => {
2198
- const a = (x ?? 0) > 0, u = Math.abs(i - yt), y = a && u > 0.5 ? yt : i, w = Gt(y, T.top);
2205
+ Ut,
2206
+ v.top,
2207
+ lt,
2208
+ Yt
2209
+ ]), w = P(
2210
+ (s) => {
2211
+ const a = (x ?? 0) > 0, u = Math.abs(s - Vt), R = a && u > 0.5 ? Vt : s, D = jt(R, v.top);
2199
2212
  if (_.debug("[VirtualScroll] Rendering visible items", {
2200
- currentScrollPosition: i,
2201
- effectiveScrollPosition: w,
2202
- renderingStartIndex: $t,
2203
- renderingEndIndex: Kt,
2213
+ currentScrollPosition: s,
2214
+ effectiveScrollPosition: D,
2215
+ renderingStartIndex: Ut,
2216
+ renderingEndIndex: $t,
2204
2217
  itemCount: n,
2205
- viewportSize: s,
2218
+ viewportSize: i,
2206
2219
  callbackThrottleMs: x,
2207
2220
  diff: u,
2208
- rawEffectiveScrollPosition: y
2221
+ rawEffectiveScrollPosition: R
2209
2222
  }), n === 0)
2210
2223
  return ie;
2211
- const V = se - w, z = T.bottom > 0 ? /* @__PURE__ */ $(
2224
+ const C = o - D, X = v.bottom > 0 ? /* @__PURE__ */ $(
2212
2225
  "div",
2213
2226
  {
2214
2227
  className: "aqvs-bottom-inset",
2215
2228
  style: {
2216
- top: b.getTotal() + T.top - se,
2217
- height: T.bottom
2229
+ top: S.getTotal() + v.top - o,
2230
+ height: v.bottom
2218
2231
  }
2219
2232
  },
2220
2233
  "virtualscroll-bottom-inset"
2221
2234
  ) : null;
2222
2235
  return _.debug("[VirtualScroll] Rendering items", {
2223
- containerTop: V,
2224
- logicalScrollPosition: qt,
2225
- resolvedInsets: T,
2226
- effectiveScrollPosition: w
2227
- }), /* @__PURE__ */ re("div", { className: "aqvs-items-wrapper", style: { top: V, position: "relative" }, children: [
2236
+ containerTop: C,
2237
+ logicalScrollPosition: Ot,
2238
+ resolvedInsets: v,
2239
+ effectiveScrollPosition: D
2240
+ }), /* @__PURE__ */ ne("div", { className: "aqvs-items-wrapper", style: { top: C, position: "relative" }, children: [
2228
2241
  ie,
2229
- z
2242
+ X
2230
2243
  ] });
2231
2244
  },
2232
- [x, n, b, qt, Kt, $t, T, yt, se, s, ie]
2233
- ), S = Vt(
2245
+ [x, n, S, Ot, $t, Ut, v, Vt, o, i, ie]
2246
+ ), V = At(
2234
2247
  () => ({
2235
- renderingStartIndex: _t.renderingStartIndex,
2236
- renderingEndIndex: _t.renderingEndIndex,
2237
- visibleStartIndex: _t.visibleStartIndex,
2238
- visibleEndIndex: _t.visibleEndIndex,
2239
- scrollPosition: qt,
2240
- totalHeight: b.getTotal()
2248
+ renderingStartIndex: Qt.renderingStartIndex,
2249
+ renderingEndIndex: Qt.renderingEndIndex,
2250
+ visibleStartIndex: Qt.visibleStartIndex,
2251
+ visibleEndIndex: Qt.visibleEndIndex,
2252
+ scrollPosition: Ot,
2253
+ totalHeight: S.getTotal()
2241
2254
  // contentSize (State) ではなく最新値を反映
2242
2255
  }),
2243
- [_t, qt, b]
2256
+ [Qt, Ot, S]
2244
2257
  );
2245
- B(() => {
2246
- It.current = S;
2247
- }, [S]), ye(
2248
- bt,
2258
+ Y(() => {
2259
+ G.current = V;
2260
+ }, [V]), we(
2261
+ ct,
2249
2262
  () => ({
2250
- getScrollPosition: () => F.current?.getScrollPosition() ?? -1,
2251
- getContentSize: () => F.current?.getContentSize() ?? -1,
2252
- getViewportSize: () => F.current?.getViewportSize() ?? -1,
2253
- scrollTo: te,
2254
- scrollToIndex: kt,
2255
- getFenwickTreeTotalHeight: () => b.getTotal(),
2256
- getFenwickSize: () => b.getSize(),
2257
- focusItemAtIndex: jt,
2258
- getRange: () => It.current,
2259
- updateItemSize: le
2263
+ getScrollPosition: () => A.current?.getScrollPosition() ?? -1,
2264
+ getContentSize: () => A.current?.getContentSize() ?? -1,
2265
+ getViewportSize: () => A.current?.getViewportSize() ?? -1,
2266
+ scrollTo: me,
2267
+ scrollToIndex: Nt,
2268
+ getFenwickTreeTotalHeight: () => S.getTotal(),
2269
+ getFenwickSize: () => S.getSize(),
2270
+ focusItemAtIndex: Wt,
2271
+ getRange: () => G.current,
2272
+ updateItemSize: ce
2260
2273
  }),
2261
- [te, kt, b, jt, le]
2274
+ [me, Nt, S, Wt, ce]
2262
2275
  );
2263
- const R = b.getTotal() + T.top + T.bottom;
2276
+ const K = S.getTotal() + v.top + v.bottom;
2264
2277
  return /* @__PURE__ */ $(
2265
2278
  ar,
2266
2279
  {
2267
- ref: F,
2268
- contentSize: R,
2269
- viewportSize: s,
2280
+ ref: A,
2281
+ contentSize: K,
2282
+ viewportSize: i,
2270
2283
  className: c,
2271
- onScroll: be,
2284
+ onScroll: Ie,
2272
2285
  background: m,
2273
- tapScrollCircleOptions: G,
2274
- inertiaOptions: Z,
2286
+ tapScrollCircleOptions: Pt,
2287
+ inertiaOptions: St,
2275
2288
  itemCount: n,
2276
- scrollBarWidth: lt,
2277
- enableThumbDrag: it,
2278
- enableTrackClick: Y,
2279
- enableArrowButtons: tt,
2280
- enablePointerDrag: Tt,
2281
- renderThumbOverlay: K,
2282
- wheelSpeedMultiplier: D,
2283
- contentInsets: T,
2284
- visibleStartIndex: Ft,
2285
- visibleEndIndex: Wt,
2286
- renderOverlay: ve,
2287
- initialScrollPosition: St.position,
2288
- children: o
2289
+ scrollBarWidth: st,
2290
+ enableThumbDrag: L,
2291
+ enableTrackClick: tt,
2292
+ enableArrowButtons: et,
2293
+ enablePointerDrag: ht,
2294
+ renderThumbOverlay: ut,
2295
+ wheelSpeedMultiplier: W,
2296
+ onWheelHorizontal: pt,
2297
+ contentInsets: v,
2298
+ visibleStartIndex: Yt,
2299
+ visibleEndIndex: Kt,
2300
+ renderOverlay: ge,
2301
+ initialScrollPosition: rt.position,
2302
+ children: w
2289
2303
  }
2290
2304
  );
2291
- }, Pr = Me(xr);
2305
+ }, Sr = ye(xr);
2292
2306
  export {
2293
2307
  cr as FenwickMapTree,
2294
2308
  or as ScrollBar,
2295
2309
  ar as ScrollPane,
2296
- Pr as VirtualScroll,
2297
- pt as minmax,
2298
- Ir as tapScrollCircleSampleVisual,
2310
+ Sr as VirtualScroll,
2311
+ xt as minmax,
2312
+ Tr as tapScrollCircleSampleVisual,
2299
2313
  ur as useFenwickMapTree,
2300
- Sr as useHeightCache,
2314
+ Pr as useHeightCache,
2301
2315
  fr as useLruCache
2302
2316
  };