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