@aiquants/virtualscroll 1.18.3 → 1.19.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.
Files changed (40) hide show
  1. package/README.md +20 -13
  2. package/dist/ScrollPane.d.cts +2 -0
  3. package/dist/ScrollPane.d.ts +2 -0
  4. package/dist/ScrollPane.d.ts.map +1 -1
  5. package/dist/VirtualScroll.d.cts +2 -0
  6. package/dist/VirtualScroll.d.ts +2 -0
  7. package/dist/VirtualScroll.d.ts.map +1 -1
  8. package/dist/index.cjs +1 -1
  9. package/dist/index.d.cts +6 -0
  10. package/dist/index.d.ts +6 -0
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +1115 -1112
  13. package/dist/styles/virtualscroll.css +1 -1
  14. package/dist/styles/virtualscroll.standalone.css +3 -0
  15. package/package.json +9 -7
  16. package/src/ScrollBar.spec.tsx +620 -0
  17. package/src/ScrollBar.tsx +1397 -0
  18. package/src/ScrollPane.spec.tsx +482 -0
  19. package/src/ScrollPane.tsx +913 -0
  20. package/src/TapScrollCircle.spec.tsx +275 -0
  21. package/src/TapScrollCircle.tsx +363 -0
  22. package/src/VirtualScroll.spec.ts +623 -0
  23. package/src/VirtualScroll.tsx +1891 -0
  24. package/src/cli.server.spec.ts +137 -0
  25. package/src/cli.server.ts +110 -0
  26. package/src/index.ts +24 -0
  27. package/src/logger.spec.ts +128 -0
  28. package/src/logger.ts +229 -0
  29. package/src/styles/components.entry.css +7 -0
  30. package/src/styles/standalone.entry.css +11 -0
  31. package/src/styles/virtualscroll.css +298 -0
  32. package/src/tapScrollCircleSampleVisual.tsx +74 -0
  33. package/src/useFenwickMapTree.huge.spec.ts +388 -0
  34. package/src/useFenwickMapTree.spec.ts +1518 -0
  35. package/src/useFenwickMapTree.ts +1368 -0
  36. package/src/useHeightCache.ts +32 -0
  37. package/src/useLruCache.spec.ts +382 -0
  38. package/src/useLruCache.ts +301 -0
  39. package/src/utils.spec.ts +39 -0
  40. package/src/utils.ts +16 -0
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { jsx as et, jsxs as le, Fragment as Ke } from "react/jsx-runtime";
2
- import Qe, { memo as tr, forwardRef as Fe, useState as Ut, useRef as b, useCallback as y, useImperativeHandle as ke, useMemo as yt, useLayoutEffect as pe, useEffect as X, useId as er } from "react";
3
- import { twMerge as ae } from "tailwind-merge";
4
- class V {
1
+ import { jsx as Q, jsxs as ue, Fragment as Ke } from "react/jsx-runtime";
2
+ import Qe, { memo as tr, forwardRef as Fe, useState as jt, useRef as g, useCallback as S, useImperativeHandle as ke, useMemo as Nt, useLayoutEffect as be, useEffect as X, useId as er } from "react";
3
+ import { twMerge as ce } from "tailwind-merge";
4
+ class N {
5
5
  level;
6
6
  prefix;
7
7
  impl;
@@ -14,7 +14,7 @@ class V {
14
14
  constructor(t = 2, e = "[virtualscroll]", r = console) {
15
15
  this.level = t, this.prefix = e, this.impl = r;
16
16
  }
17
- static instance = new V(2, "[virtualscroll]");
17
+ static instance = new N(2, "[virtualscroll]");
18
18
  /**
19
19
  * @method setLevel
20
20
  * @description Updates the current log level for the static instance.
@@ -22,7 +22,7 @@ class V {
22
22
  * @param {LogLevel} level - The new log level.
23
23
  */
24
24
  static setLevel(t) {
25
- V.instance.setLevel(t);
25
+ N.instance.setLevel(t);
26
26
  }
27
27
  /**
28
28
  * @method setLevel
@@ -40,7 +40,7 @@ class V {
40
40
  * @param {ILogger} impl - The new logger implementation.
41
41
  */
42
42
  static setImplementation(t) {
43
- V.instance.setImplementation(t);
43
+ N.instance.setImplementation(t);
44
44
  }
45
45
  /**
46
46
  * @method setImplementation
@@ -58,7 +58,7 @@ class V {
58
58
  * @param {string} prefix - The new prefix.
59
59
  */
60
60
  static setPrefix(t) {
61
- V.instance.setPrefix(t);
61
+ N.instance.setPrefix(t);
62
62
  }
63
63
  /**
64
64
  * @method setPrefix
@@ -77,7 +77,7 @@ class V {
77
77
  * @returns {boolean} True if a message at `level` would be emitted. / `level` のメッセージが出力されるなら true。
78
78
  */
79
79
  static isEnabled(t) {
80
- return V.instance.isEnabled(t);
80
+ return N.instance.isEnabled(t);
81
81
  }
82
82
  /**
83
83
  * @method isEnabled
@@ -122,28 +122,28 @@ class V {
122
122
  return typeof t == "string" ? [`${this.prefix} ${t}`] : [this.prefix, t];
123
123
  }
124
124
  static debug(t, ...e) {
125
- V.instance.debug(t, ...e);
125
+ N.instance.debug(t, ...e);
126
126
  }
127
127
  debug(t, ...e) {
128
- this.level <= 0 && this.impl.debug(...this.formatMessage(V.resolveLazy(t)), ...e.map(V.resolveLazy));
128
+ this.level <= 0 && this.impl.debug(...this.formatMessage(N.resolveLazy(t)), ...e.map(N.resolveLazy));
129
129
  }
130
130
  static info(t, ...e) {
131
- V.instance.info(t, ...e);
131
+ N.instance.info(t, ...e);
132
132
  }
133
133
  info(t, ...e) {
134
- this.level <= 1 && this.impl.info(...this.formatMessage(V.resolveLazy(t)), ...e.map(V.resolveLazy));
134
+ this.level <= 1 && this.impl.info(...this.formatMessage(N.resolveLazy(t)), ...e.map(N.resolveLazy));
135
135
  }
136
136
  static warn(t, ...e) {
137
- V.instance.warn(t, ...e);
137
+ N.instance.warn(t, ...e);
138
138
  }
139
139
  warn(t, ...e) {
140
- this.level <= 2 && this.impl.warn(...this.formatMessage(V.resolveLazy(t)), ...e.map(V.resolveLazy));
140
+ this.level <= 2 && this.impl.warn(...this.formatMessage(N.resolveLazy(t)), ...e.map(N.resolveLazy));
141
141
  }
142
142
  static error(t, ...e) {
143
- V.instance.error(t, ...e);
143
+ N.instance.error(t, ...e);
144
144
  }
145
145
  error(t, ...e) {
146
- this.level <= 3 && this.impl.error(...this.formatMessage(V.resolveLazy(t)), ...e.map(V.resolveLazy));
146
+ this.level <= 3 && this.impl.error(...this.formatMessage(N.resolveLazy(t)), ...e.map(N.resolveLazy));
147
147
  }
148
148
  }
149
149
  const Ye = {
@@ -155,8 +155,8 @@ const Ye = {
155
155
  pointerId: null
156
156
  }, Ae = 6, rr = 8, nr = ({ dragState: i, normalizedDistance: t }) => {
157
157
  const e = 1 + t * 0.18, r = 0.16 + t * 0.24, n = 0.38 + t * 0.28, s = i.active ? "80ms ease-out" : "220ms ease";
158
- return /* @__PURE__ */ le(Ke, { children: [
159
- /* @__PURE__ */ et(
158
+ return /* @__PURE__ */ ue(Ke, { children: [
159
+ /* @__PURE__ */ Q(
160
160
  "div",
161
161
  {
162
162
  className: "aqvs-tap-scroll-circle-visual-outer",
@@ -168,7 +168,7 @@ const Ye = {
168
168
  }
169
169
  }
170
170
  ),
171
- /* @__PURE__ */ et(
171
+ /* @__PURE__ */ Q(
172
172
  "div",
173
173
  {
174
174
  className: "aqvs-tap-scroll-circle-inner",
@@ -183,90 +183,90 @@ const Ye = {
183
183
  ] });
184
184
  }, We = tr(
185
185
  Fe(({ onDragChange: i, className: t, maxVisualDistance: e = 160, size: r = 40, style: n, opacity: s = 1, renderVisual: l }, u) => {
186
- const [f, I] = Ut(Ye), v = b(null), T = b(null), D = b({ x: 0, y: 0 }), p = b(null), z = b(0), rt = y(
187
- (S) => {
188
- I(S), i(S);
186
+ const [f, x] = jt(Ye), I = g(null), M = g(null), _ = g({ x: 0, y: 0 }), p = g(null), D = g(0), J = S(
187
+ (b) => {
188
+ x(b), i(b);
189
189
  },
190
190
  [i]
191
- ), W = y(
192
- (S, U, j = !1) => {
193
- const { x: k, y: G } = D.current, st = S - k, Mt = U - G, R = Math.abs(Mt), Dt = R < Ae ? 0 : Mt < 0 ? -1 : 1, Vt = z.current;
194
- let x = Dt;
195
- const Rt = Ae + rr;
196
- Dt === 0 ? Vt !== 0 && R < Rt ? x = Vt : (x = 0, j || (z.current = 0)) : Dt !== Vt && Vt !== 0 && R < Rt ? x = Vt : z.current = Dt, rt({
197
- active: j || R >= Ae,
198
- offsetX: st,
199
- offsetY: Mt,
200
- distance: R,
201
- direction: x,
202
- pointerId: v.current
191
+ ), G = S(
192
+ (b, K, ft = !1) => {
193
+ const { x: et, y: Y } = _.current, W = b - et, bt = K - Y, St = Math.abs(bt), R = St < Ae ? 0 : bt < 0 ? -1 : 1, Ft = D.current;
194
+ let Lt = R;
195
+ const v = Ae + rr;
196
+ R === 0 ? Ft !== 0 && St < v ? Lt = Ft : (Lt = 0, ft || (D.current = 0)) : R !== Ft && Ft !== 0 && St < v ? Lt = Ft : D.current = R, J({
197
+ active: ft || St >= Ae,
198
+ offsetX: W,
199
+ offsetY: bt,
200
+ distance: St,
201
+ direction: Lt,
202
+ pointerId: I.current
203
203
  });
204
204
  },
205
- [rt]
206
- ), ot = y((S) => {
207
- if (S === null)
205
+ [J]
206
+ ), rt = S((b) => {
207
+ if (b === null)
208
208
  return;
209
- const U = p.current;
210
- U?.hasPointerCapture(S) && U.releasePointerCapture(S);
211
- }, []), nt = y(
212
- (S = !1) => {
213
- S && ot(v.current), v.current = null, T.current = null, z.current = 0, rt(Ye);
209
+ const K = p.current;
210
+ K?.hasPointerCapture(b) && K.releasePointerCapture(b);
211
+ }, []), nt = S(
212
+ (b = !1) => {
213
+ b && rt(I.current), I.current = null, M.current = null, D.current = 0, J(Ye);
214
214
  },
215
- [rt, ot]
216
- ), ft = y(
217
- (S) => {
218
- if (v.current !== null && v.current !== S.pointerId) {
219
- T.current = { pointerId: S.pointerId, clientX: S.clientX, clientY: S.clientY }, S.preventDefault(), S.stopPropagation();
215
+ [J, rt]
216
+ ), st = S(
217
+ (b) => {
218
+ if (I.current !== null && I.current !== b.pointerId) {
219
+ M.current = { pointerId: b.pointerId, clientX: b.clientX, clientY: b.clientY }, b.preventDefault(), b.stopPropagation();
220
220
  return;
221
221
  }
222
- S.preventDefault(), S.stopPropagation();
223
- const U = p.current ?? S.currentTarget, { left: j, top: k, width: G, height: st } = U.getBoundingClientRect();
224
- D.current = { x: j + G / 2, y: k + st / 2 }, v.current = S.pointerId;
222
+ b.preventDefault(), b.stopPropagation();
223
+ const K = p.current ?? b.currentTarget, { left: ft, top: et, width: Y, height: W } = K.getBoundingClientRect();
224
+ _.current = { x: ft + Y / 2, y: et + W / 2 }, I.current = b.pointerId;
225
225
  try {
226
- U.setPointerCapture(S.pointerId);
226
+ K.setPointerCapture(b.pointerId);
227
227
  } catch {
228
228
  }
229
- W(S.clientX, S.clientY, !0);
229
+ G(b.clientX, b.clientY, !0);
230
230
  },
231
- [W]
232
- ), St = y(
233
- (S) => {
234
- if (v.current !== S.pointerId) {
235
- T.current !== null && T.current.pointerId === S.pointerId && (T.current = { pointerId: S.pointerId, clientX: S.clientX, clientY: S.clientY });
231
+ [G]
232
+ ), wt = S(
233
+ (b) => {
234
+ if (I.current !== b.pointerId) {
235
+ M.current !== null && M.current.pointerId === b.pointerId && (M.current = { pointerId: b.pointerId, clientX: b.clientX, clientY: b.clientY });
236
236
  return;
237
237
  }
238
- S.preventDefault(), W(S.clientX, S.clientY);
238
+ b.preventDefault(), G(b.clientX, b.clientY);
239
239
  },
240
- [W]
241
- ), wt = y(
242
- (S) => {
243
- if (v.current !== S.pointerId) {
244
- T.current !== null && T.current.pointerId === S.pointerId && (T.current = null);
240
+ [G]
241
+ ), Vt = S(
242
+ (b) => {
243
+ if (I.current !== b.pointerId) {
244
+ M.current !== null && M.current.pointerId === b.pointerId && (M.current = null);
245
245
  return;
246
246
  }
247
- S.preventDefault(), S.stopPropagation();
248
- const U = T.current;
249
- if (T.current = null, U !== null) {
250
- ot(S.pointerId);
251
- const j = p.current;
252
- let k = !0;
253
- if (j !== null && typeof j.setPointerCapture == "function")
247
+ b.preventDefault(), b.stopPropagation();
248
+ const K = M.current;
249
+ if (M.current = null, K !== null) {
250
+ rt(b.pointerId);
251
+ const ft = p.current;
252
+ let et = !0;
253
+ if (ft !== null && typeof ft.setPointerCapture == "function")
254
254
  try {
255
- j.setPointerCapture(U.pointerId);
256
- } catch (G) {
257
- (typeof G == "object" && G !== null && "name" in G ? G.name : void 0) === "NotFoundError" && (k = !1);
255
+ ft.setPointerCapture(K.pointerId);
256
+ } catch (Y) {
257
+ (typeof Y == "object" && Y !== null && "name" in Y ? Y.name : void 0) === "NotFoundError" && (et = !1);
258
258
  }
259
- if (k) {
260
- v.current = U.pointerId, W(U.clientX, U.clientY, !0);
259
+ if (et) {
260
+ I.current = K.pointerId, G(K.clientX, K.clientY, !0);
261
261
  return;
262
262
  }
263
263
  }
264
264
  nt(!0);
265
265
  },
266
- [nt, ot, W]
267
- ), L = y(
268
- (S) => {
269
- v.current === S.pointerId && nt(!1);
266
+ [nt, rt, G]
267
+ ), z = S(
268
+ (b) => {
269
+ I.current === b.pointerId && nt(!1);
270
270
  },
271
271
  [nt]
272
272
  );
@@ -280,39 +280,39 @@ const Ye = {
280
280
  }),
281
281
  [nt]
282
282
  );
283
- const F = Math.min(Math.max(s, 0), 1), h = r / 64, $ = Math.min(f.distance, e) / e, q = f.direction * $ * 10 * h, H = l ?? nr, O = {
283
+ const B = Math.min(Math.max(s, 0), 1), w = r / 64, C = Math.min(f.distance, e) / e, U = f.direction * C * 10 * w, H = l ?? nr, tt = {
284
284
  dragState: f,
285
- normalizedDistance: $,
286
- sizeScale: h,
285
+ normalizedDistance: C,
286
+ sizeScale: w,
287
287
  size: r,
288
- opacity: F
289
- }, K = {
288
+ opacity: B
289
+ }, L = {
290
290
  ...n,
291
291
  width: r,
292
292
  height: r,
293
- transform: `translateY(${q}px)`
293
+ transform: `translateY(${U}px)`
294
294
  };
295
- return K.opacity = F, /* @__PURE__ */ et(
295
+ return L.opacity = B, /* @__PURE__ */ Q(
296
296
  "div",
297
297
  {
298
298
  ref: p,
299
299
  "data-testid": "virtual-scroll-tap-circle",
300
- className: ae("aqvs-tap-scroll-circle", t),
301
- style: K,
300
+ className: ce("aqvs-tap-scroll-circle", t),
301
+ style: L,
302
302
  tabIndex: -1,
303
- onPointerDown: ft,
304
- onPointerMove: St,
305
- onPointerUp: wt,
306
- onPointerCancel: wt,
307
- onLostPointerCapture: L,
303
+ onPointerDown: st,
304
+ onPointerMove: wt,
305
+ onPointerUp: Vt,
306
+ onPointerCancel: Vt,
307
+ onLostPointerCapture: z,
308
308
  role: "presentation",
309
- children: H(O)
309
+ children: H(tt)
310
310
  }
311
311
  );
312
312
  })
313
313
  );
314
314
  We.displayName = "TapScrollCircle";
315
- const mt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scroll-cancel", Be = 20, ir = 250, or = 60, sr = 20, ar = 20, lr = 240, qe = { active: !1, offsetX: 0, offsetY: 0, distance: 0, direction: 0, pointerId: null }, De = 2.2, cr = 8, ur = 120, dr = 1 / 10, $t = {
315
+ const gt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scroll-cancel", Be = 20, ir = 250, or = 60, sr = 20, ar = 20, lr = 240, qe = { active: !1, offsetX: 0, offsetY: 0, distance: 0, direction: 0, pointerId: null }, De = 2.2, cr = 8, ur = 120, dr = 1 / 10, Wt = {
316
316
  enabled: !0,
317
317
  size: 40,
318
318
  offsetX: -80,
@@ -346,39 +346,39 @@ const mt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
346
346
  }, mr = (i, t) => {
347
347
  const e = i?.maxSpeedMultiplier, r = typeof e == "number" ? e : gr(t);
348
348
  return {
349
- enabled: i?.enabled ?? $t.enabled,
350
- size: i?.size ?? $t.size,
351
- offsetX: i?.offsetX ?? $t.offsetX,
352
- offsetY: i?.offsetY ?? $t.offsetY,
353
- className: i?.className ?? $t.className,
354
- maxVisualDistance: i?.maxVisualDistance ?? $t.maxVisualDistance,
349
+ enabled: i?.enabled ?? Wt.enabled,
350
+ size: i?.size ?? Wt.size,
351
+ offsetX: i?.offsetX ?? Wt.offsetX,
352
+ offsetY: i?.offsetY ?? Wt.offsetY,
353
+ className: i?.className ?? Wt.className,
354
+ maxVisualDistance: i?.maxVisualDistance ?? Wt.maxVisualDistance,
355
355
  maxSpeedMultiplier: r,
356
- minSpeedMultiplier: Math.max(i?.minSpeedMultiplier ?? $t.minSpeedMultiplier, 0),
357
- opacity: mt(i?.opacity ?? $t.opacity, 0, 1),
358
- renderVisual: i?.renderVisual ?? $t.renderVisual,
359
- maxSpeedCurve: i?.maxSpeedCurve ?? $t.maxSpeedCurve
356
+ minSpeedMultiplier: Math.max(i?.minSpeedMultiplier ?? Wt.minSpeedMultiplier, 0),
357
+ opacity: gt(i?.opacity ?? Wt.opacity, 0, 1),
358
+ renderVisual: i?.renderVisual ?? Wt.renderVisual,
359
+ maxSpeedCurve: i?.maxSpeedCurve ?? Wt.maxSpeedCurve
360
360
  };
361
- }, pr = ({ isDragging: i, isThumbHovered: t, enableThumbDrag: e }) => yt(() => e ? i ? "dragging" : t ? "hover" : "idle" : "disabled", [e, i, t]), hr = ({ canUseArrowButtons: i, enableArrowButtons: t, resetTapScroll: e, scrollByStep: r }) => {
362
- const n = b(null), s = b(null), l = b(null), u = y(() => {
361
+ }, pr = ({ isDragging: i, isThumbHovered: t, enableThumbDrag: e }) => Nt(() => e ? i ? "dragging" : t ? "hover" : "idle" : "disabled", [e, i, t]), hr = ({ canUseArrowButtons: i, enableArrowButtons: t, resetTapScroll: e, scrollByStep: r }) => {
362
+ const n = g(null), s = g(null), l = g(null), u = S(() => {
363
363
  n.current !== null && (window.clearInterval(n.current), n.current = null), s.current !== null && (window.clearTimeout(s.current), s.current = null), l.current !== null && (window.removeEventListener("pointerup", l.current), window.removeEventListener("pointercancel", l.current), window.removeEventListener("blur", l.current), l.current = null);
364
- }, []), f = y(() => {
364
+ }, []), f = S(() => {
365
365
  u();
366
- }, [u]), I = y(
367
- (T) => (D) => {
366
+ }, [u]), x = S(
367
+ (M) => (_) => {
368
368
  if (!i)
369
369
  return;
370
- D.cancelable && D.preventDefault(), D.stopPropagation(), e(), u(), r(T), s.current = window.setTimeout(() => {
370
+ _.cancelable && _.preventDefault(), _.stopPropagation(), e(), u(), r(M), s.current = window.setTimeout(() => {
371
371
  n.current = window.setInterval(() => {
372
- r(T);
372
+ r(M);
373
373
  }, or);
374
374
  }, ir);
375
375
  const p = () => u();
376
376
  l.current = p, window.addEventListener("pointerup", p), window.addEventListener("pointercancel", p), window.addEventListener("blur", p);
377
377
  },
378
378
  [i, u, e, r]
379
- ), v = y(
380
- (T) => (D) => {
381
- t && (D.key === "Enter" || D.key === " " || D.key === "Spacebar") && (D.preventDefault(), r(T));
379
+ ), I = S(
380
+ (M) => (_) => {
381
+ t && (_.key === "Enter" || _.key === " " || _.key === "Spacebar") && (_.preventDefault(), r(M));
382
382
  },
383
383
  [t, r]
384
384
  );
@@ -386,12 +386,12 @@ const mt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
386
386
  i || u();
387
387
  }, [i, u]), X(() => () => {
388
388
  u();
389
- }, [u]), { handleArrowPointerDown: I, handleArrowPointerUp: f, handleArrowKeyDown: v };
389
+ }, [u]), { handleArrowPointerDown: x, handleArrowPointerUp: f, handleArrowKeyDown: I };
390
390
  }, gr = (i) => {
391
391
  if (!i || i <= 0)
392
392
  return De;
393
393
  const t = Math.max(1, i), e = Math.log10(t), r = De + e * cr;
394
- return mt(r, De, ur);
394
+ return gt(r, De, ur);
395
395
  }, br = ({
396
396
  contentSize: i,
397
397
  viewportSize: t,
@@ -402,242 +402,242 @@ const mt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
402
402
  enableArrowButtons: l = !0,
403
403
  horizontal: u = !1,
404
404
  scrollBarWidth: f = 12,
405
- className: I,
406
- ariaControls: v,
407
- tapScrollCircleOptions: T,
408
- itemCount: D,
405
+ className: x,
406
+ ariaControls: I,
407
+ tapScrollCircleOptions: M,
408
+ itemCount: _,
409
409
  renderThumbOverlay: p,
410
- visibleStartIndex: z,
411
- visibleEndIndex: rt
410
+ visibleStartIndex: D,
411
+ visibleEndIndex: J
412
412
  }) => {
413
- const [W, ot] = Ut(!1), [nt, ft] = Ut(!1), [St, wt] = Ut(!1), L = b(null), F = b({
413
+ const [G, rt] = jt(!1), [nt, st] = jt(!1), [wt, Vt] = jt(!1), z = g(null), B = g({
414
414
  pointerId: null,
415
415
  startThumbPosition: 0,
416
416
  startClientX: 0,
417
417
  startClientY: 0,
418
418
  scale: 1,
419
419
  captureTarget: null
420
- }), h = b({ pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1 }), $ = b(e), q = b(r), H = b(qe), O = b(null), K = b(null), S = b(null), U = b(0), j = b(0), k = yt(() => mr(T, D), [D, T]), G = yt(() => fr(u), [u]), {
421
- enabled: st,
422
- size: Mt,
423
- offsetX: R,
424
- offsetY: Dt,
425
- className: Vt,
426
- maxVisualDistance: x,
427
- maxSpeedMultiplier: Rt,
428
- minSpeedMultiplier: At,
429
- opacity: qt,
430
- renderVisual: M,
431
- maxSpeedCurve: Y
432
- } = k, C = b({
420
+ }), w = g({ pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1 }), C = g(e), U = g(r), H = g(qe), tt = g(null), L = g(null), b = g(null), K = g(0), ft = g(0), et = Nt(() => mr(M, _), [_, M]), Y = Nt(() => fr(u), [u]), {
421
+ enabled: W,
422
+ size: bt,
423
+ offsetX: St,
424
+ offsetY: R,
425
+ className: Ft,
426
+ maxVisualDistance: Lt,
427
+ maxSpeedMultiplier: v,
428
+ minSpeedMultiplier: zt,
429
+ opacity: _t,
430
+ renderVisual: Gt,
431
+ maxSpeedCurve: T
432
+ } = et, O = g({
433
433
  viewportSize: t,
434
434
  maxScrollPosition: Math.max(i - t, 0),
435
435
  scrollBarVisible: i > t,
436
- effectiveTapMaxDistance: Math.max(x, 1),
437
- tapCircleMaxSpeedMultiplier: Rt,
438
- tapCircleMinSpeedMultiplier: At,
439
- tapCircleMaxSpeedCurve: Y,
440
- tapScrollCircleOptions: T,
436
+ effectiveTapMaxDistance: Math.max(Lt, 1),
437
+ tapCircleMaxSpeedMultiplier: v,
438
+ tapCircleMinSpeedMultiplier: zt,
439
+ tapCircleMaxSpeedCurve: T,
440
+ tapScrollCircleOptions: M,
441
441
  effectiveTrackLength: 0,
442
442
  onScroll: r,
443
443
  scrollPosition: e
444
- }), { mainSizeKey: ct, crossSizeKey: at, positionKey: pt, selectDelta: ht, getPointerCoordinate: J, arrowLabels: Ct, arrowIcons: ut, directionClass: Kt, orientation: Lt } = G, xt = Math.max(x, 1), _t = t / i, Ot = Math.max(t - f * 2, 0), It = _t * Ot, Et = Math.min(Math.max(Be, It || 0), Ot || Be), m = i - t, E = Math.max(Ot - Et, 0), lt = m <= 0 || E <= 0 ? 0 : mt(e / m * E, 0, E), zt = lt + Et / 2, Z = i > t || W, re = Z && l;
445
- pe(() => {
446
- C.current = {
444
+ }), { mainSizeKey: A, crossSizeKey: mt, positionKey: lt, selectDelta: ct, getPointerCoordinate: Mt, arrowLabels: j, arrowIcons: At, directionClass: pt, orientation: Zt } = Y, Ot = Math.max(Lt, 1), Rt = t / i, Ct = Math.max(t - f * 2, 0), Xt = Rt * Ct, ut = Math.min(Math.max(Be, Xt || 0), Ct || Be), xt = i - t, m = Math.max(Ct - ut, 0), V = xt <= 0 || m <= 0 ? 0 : gt(e / xt * m, 0, m), It = V + ut / 2, vt = i > t || G, ht = vt && l;
445
+ be(() => {
446
+ O.current = {
447
447
  viewportSize: t,
448
- maxScrollPosition: m,
449
- scrollBarVisible: Z,
450
- effectiveTapMaxDistance: xt,
451
- tapCircleMaxSpeedMultiplier: Rt,
452
- tapCircleMinSpeedMultiplier: At,
453
- tapCircleMaxSpeedCurve: Y,
454
- tapScrollCircleOptions: T,
455
- effectiveTrackLength: E,
448
+ maxScrollPosition: xt,
449
+ scrollBarVisible: vt,
450
+ effectiveTapMaxDistance: Ot,
451
+ tapCircleMaxSpeedMultiplier: v,
452
+ tapCircleMinSpeedMultiplier: zt,
453
+ tapCircleMaxSpeedCurve: T,
454
+ tapScrollCircleOptions: M,
455
+ effectiveTrackLength: m,
456
456
  onScroll: r,
457
457
  scrollPosition: e
458
458
  };
459
- }), pe(() => {
460
- $.current = e;
461
- }, [e]), pe(() => {
462
- q.current = r;
459
+ }), be(() => {
460
+ C.current = e;
461
+ }, [e]), be(() => {
462
+ U.current = r;
463
463
  }, [r]), X(() => {
464
- n || ft(!1);
464
+ n || st(!1);
465
465
  }, [n]);
466
- const Ht = pr({ isDragging: W, isThumbHovered: nt, enableThumbDrag: n }), Nt = y((a, g) => {
467
- const w = C.current, o = g ?? $.current;
468
- if (q.current) {
469
- const N = q.current(a, o);
470
- if (typeof N == "number" && Number.isFinite(N))
471
- return $.current = N, N;
466
+ const se = pr({ isDragging: G, isThumbHovered: nt, enableThumbDrag: n }), Et = S((a, h) => {
467
+ const P = O.current, F = h ?? C.current;
468
+ if (U.current) {
469
+ const y = U.current(a, F);
470
+ if (typeof y == "number" && Number.isFinite(y))
471
+ return C.current = y, y;
472
472
  }
473
- const c = typeof a == "function" ? a(o) : a, d = Math.max(w.maxScrollPosition, 0), P = w.scrollBarVisible ? mt(c, 0, d) : 0;
474
- return $.current = P, P;
475
- }, []), Wt = y(
473
+ const o = typeof a == "function" ? a(F) : a, c = Math.max(P.maxScrollPosition, 0), d = P.scrollBarVisible ? gt(o, 0, c) : 0;
474
+ return C.current = d, d;
475
+ }, []), $t = S(
476
476
  (a) => {
477
- const g = C.current, w = $.current;
478
- if (!g.scrollBarVisible || g.maxScrollPosition <= 0) {
479
- const A = Nt(0, w), B = A - w;
480
- return { nextPosition: A, actualDelta: B, reachedBoundary: !0 };
477
+ const h = O.current, P = C.current;
478
+ if (!h.scrollBarVisible || h.maxScrollPosition <= 0) {
479
+ const E = Et(0, P), q = E - P;
480
+ return { nextPosition: E, actualDelta: q, reachedBoundary: !0 };
481
481
  }
482
482
  if (a === 0)
483
- return { nextPosition: w, actualDelta: 0, reachedBoundary: !1 };
484
- const c = Nt((A) => mt(A + a, 0, g.maxScrollPosition), w), d = c - w, P = a < 0 && w + a <= 0, N = a > 0 && w + a >= g.maxScrollPosition, _ = a < 0 && (c <= 0 || P && d === 0) || a > 0 && (c >= g.maxScrollPosition || N && d === 0);
485
- return { nextPosition: c, actualDelta: d, reachedBoundary: _ };
483
+ return { nextPosition: P, actualDelta: 0, reachedBoundary: !1 };
484
+ const o = Et((E) => gt(E + a, 0, h.maxScrollPosition), P), c = o - P, d = a < 0 && P + a <= 0, y = a > 0 && P + a >= h.maxScrollPosition, k = a < 0 && (o <= 0 || d && c === 0) || a > 0 && (o >= h.maxScrollPosition || y && c === 0);
485
+ return { nextPosition: o, actualDelta: c, reachedBoundary: k };
486
486
  },
487
- [Nt]
488
- ), jt = y(
489
- (a, g) => {
490
- a.current += g;
491
- const w = Math.max(C.current.maxScrollPosition, 0);
492
- w > 0 && (a.current = mt(a.current, -w, w));
493
- const o = Wt(a.current);
494
- return a.current -= o.actualDelta, o.reachedBoundary && (a.current = 0), o;
487
+ [Et]
488
+ ), Ht = S(
489
+ (a, h) => {
490
+ a.current += h;
491
+ const P = Math.max(O.current.maxScrollPosition, 0);
492
+ P > 0 && (a.current = gt(a.current, -P, P));
493
+ const F = $t(a.current);
494
+ return a.current -= F.actualDelta, F.reachedBoundary && (a.current = 0), F;
495
495
  },
496
- [Wt]
497
- ), Ft = y(() => {
498
- K.current !== null && (window.cancelAnimationFrame(K.current), K.current = null), S.current = null, U.current = 0, j.current = 0;
499
- }, []), Pt = y(() => {
500
- H.current = { ...qe }, wt(!1), O.current?.reset(), Ft();
501
- }, [Ft]), Gt = y(
496
+ [$t]
497
+ ), Dt = S(() => {
498
+ L.current !== null && (window.cancelAnimationFrame(L.current), L.current = null), b.current = null, K.current = 0, ft.current = 0;
499
+ }, []), kt = S(() => {
500
+ H.current = { ...qe }, Vt(!1), tt.current?.reset(), Dt();
501
+ }, [Dt]), Ut = S(
502
502
  (a) => {
503
- const g = H.current, w = C.current;
504
- if (!g.active || g.direction === 0) {
505
- Ft();
503
+ const h = H.current, P = O.current;
504
+ if (!h.active || h.direction === 0) {
505
+ Dt();
506
506
  return;
507
507
  }
508
- if (!w.scrollBarVisible || w.maxScrollPosition <= 0) {
509
- Ft();
508
+ if (!P.scrollBarVisible || P.maxScrollPosition <= 0) {
509
+ Dt();
510
510
  return;
511
511
  }
512
- const o = S.current ?? a, c = Math.max((a - o) / 1e3, 0), d = Math.min(c, dr);
513
- if (S.current = a, d <= 0) {
514
- K.current = window.requestAnimationFrame(Gt);
512
+ const F = b.current ?? a, o = Math.max((a - F) / 1e3, 0), c = Math.min(o, dr);
513
+ if (b.current = a, c <= 0) {
514
+ L.current = window.requestAnimationFrame(Ut);
515
515
  return;
516
516
  }
517
- const P = Math.min(g.distance, w.effectiveTapMaxDistance) / w.effectiveTapMaxDistance, N = P ** 1.1, _ = typeof w.tapScrollCircleOptions?.maxSpeedMultiplier == "number", A = Math.max(w.viewportSize * w.tapCircleMinSpeedMultiplier, 40), B = _ ? A : 1200;
518
- let tt = Math.max(w.viewportSize * w.tapCircleMaxSpeedMultiplier, B);
519
- const Q = w.tapCircleMaxSpeedCurve;
520
- if (Q) {
521
- const we = Math.max(Q.exponentialSteepness, 0), je = Math.max(Q.exponentialScale ?? w.tapCircleMaxSpeedMultiplier, 0), Ge = we === 0 ? P : Math.expm1(we * P), ze = we === 0 ? 1 : Math.expm1(we) || 1, Ze = ze === 0 ? P : Math.min(Math.max(Ge / ze, 0), 1), Je = w.viewportSize * je * Ze;
522
- tt = Math.min(tt, Math.max(Je, A));
517
+ const d = Math.min(h.distance, P.effectiveTapMaxDistance) / P.effectiveTapMaxDistance, y = d ** 1.1, k = typeof P.tapScrollCircleOptions?.maxSpeedMultiplier == "number", E = Math.max(P.viewportSize * P.tapCircleMinSpeedMultiplier, 40), q = k ? E : 1200;
518
+ let at = Math.max(P.viewportSize * P.tapCircleMaxSpeedMultiplier, q);
519
+ const Z = P.tapCircleMaxSpeedCurve;
520
+ if (Z) {
521
+ const ie = Math.max(Z.exponentialSteepness, 0), je = Math.max(Z.exponentialScale ?? P.tapCircleMaxSpeedMultiplier, 0), Ge = ie === 0 ? d : Math.expm1(ie * d), ze = ie === 0 ? 1 : Math.expm1(ie) || 1, Ze = ze === 0 ? d : Math.min(Math.max(Ge / ze, 0), 1), Je = P.viewportSize * je * Ze;
522
+ at = Math.min(at, Math.max(Je, E));
523
523
  }
524
- const vt = Math.max(tt, A), bt = Math.max(Q?.easedOffset ?? 0, 0), Tt = Math.min(1, N + bt), se = A + (vt - A) * Tt;
525
- j.current !== g.direction && (j.current = g.direction, U.current = 0);
526
- const { reachedBoundary: ve } = jt(U, g.direction * se * d);
527
- if (ve) {
528
- Ft();
524
+ const ot = Math.max(at, E), Pt = Math.max(Z?.easedOffset ?? 0, 0), Tt = Math.min(1, y + Pt), yt = E + (ot - E) * Tt;
525
+ ft.current !== h.direction && (ft.current = h.direction, K.current = 0);
526
+ const { reachedBoundary: le } = Ht(K, h.direction * yt * c);
527
+ if (le) {
528
+ Dt();
529
529
  return;
530
530
  }
531
- K.current = window.requestAnimationFrame(Gt);
531
+ L.current = window.requestAnimationFrame(Ut);
532
532
  },
533
- [jt, Ft]
534
- ), he = y(() => {
535
- K.current === null && (S.current = null, U.current = 0, K.current = window.requestAnimationFrame(Gt));
536
- }, [Gt]);
533
+ [Ht, Dt]
534
+ ), ae = S(() => {
535
+ L.current === null && (b.current = null, K.current = 0, L.current = window.requestAnimationFrame(Ut));
536
+ }, [Ut]);
537
537
  X(() => () => {
538
- Ft();
539
- }, [Ft]);
540
- const ge = y(
538
+ Dt();
539
+ }, [Dt]);
540
+ const Me = S(
541
541
  (a) => {
542
- H.current = a, wt(a.active), a.active && a.direction !== 0 ? he() : Ft();
542
+ H.current = a, Vt(a.active), a.active && a.direction !== 0 ? ae() : Dt();
543
543
  },
544
- [he, Ft]
544
+ [ae, Dt]
545
545
  );
546
546
  X(() => {
547
- st || Pt();
548
- }, [Pt, st]), X(() => {
549
- const a = (g) => {
550
- const o = g.detail?.paneId;
551
- o && v && o !== v || Pt();
547
+ W || kt();
548
+ }, [kt, W]), X(() => {
549
+ const a = (h) => {
550
+ const F = h.detail?.paneId;
551
+ F && I && F !== I || kt();
552
552
  };
553
553
  return window.addEventListener(Oe, a), () => {
554
554
  window.removeEventListener(Oe, a);
555
555
  };
556
- }, [v, Pt]), X(() => {
557
- if (!st)
556
+ }, [I, kt]), X(() => {
557
+ if (!W)
558
558
  return;
559
- const a = (g) => {
560
- if (!H.current.active || H.current.pointerId === g.pointerId)
559
+ const a = (h) => {
560
+ if (!H.current.active || H.current.pointerId === h.pointerId)
561
561
  return;
562
- const w = g.target;
563
- if (!(w instanceof Node)) {
564
- Pt();
562
+ const P = h.target;
563
+ if (!(P instanceof Node)) {
564
+ kt();
565
565
  return;
566
566
  }
567
- O.current?.getElement()?.contains(w) || Pt();
567
+ tt.current?.getElement()?.contains(P) || kt();
568
568
  };
569
569
  return document.addEventListener("pointerdown", a, !0), () => {
570
570
  document.removeEventListener("pointerdown", a, !0);
571
571
  };
572
- }, [Pt, st]);
573
- const be = (a) => {
574
- if (!Z || E <= 0 || m <= 0)
572
+ }, [kt, W]);
573
+ const de = (a) => {
574
+ if (!vt || m <= 0 || xt <= 0)
575
575
  return 0;
576
- const g = mt(a, 0, E);
577
- return mt(g / E * m, 0, m);
578
- }, it = y((a) => {
579
- const { scrollBarVisible: g, effectiveTrackLength: w, maxScrollPosition: o } = C.current;
580
- if (V.debug("[ScrollBar] calculateScrollPositionFromThumb", () => ({ thumbPos: a, trackLen: w, maxScroll: o })), w <= 0 || o <= 0)
576
+ const h = gt(a, 0, m);
577
+ return gt(h / m * xt, 0, xt);
578
+ }, xe = S((a) => {
579
+ const { scrollBarVisible: h, effectiveTrackLength: P, maxScrollPosition: F } = O.current;
580
+ if (N.debug("[ScrollBar] calculateScrollPositionFromThumb", () => ({ thumbPos: a, trackLen: P, maxScroll: F })), P <= 0 || F <= 0)
581
581
  return null;
582
- const c = mt(a, 0, w);
583
- return mt(c / w * o, 0, o);
584
- }, []), Zt = y(
582
+ const o = gt(a, 0, P);
583
+ return gt(o / P * F, 0, F);
584
+ }, []), it = S(
585
585
  (a) => {
586
- const g = a.getBoundingClientRect(), w = u ? g.width : g.height, o = (_) => {
587
- const A = Number.parseFloat(_);
588
- return Number.isFinite(A) ? A : 0;
589
- }, c = window.getComputedStyle(a), d = o(u ? c.width : c.height), P = d > 0 ? d + o(u ? c.paddingLeft : c.paddingTop) + o(u ? c.paddingRight : c.paddingBottom) + o(u ? c.borderLeftWidth : c.borderTopWidth) + o(u ? c.borderRightWidth : c.borderBottomWidth) : 0, N = P > 0 ? P : u ? a.offsetWidth : a.offsetHeight;
590
- return N <= 0 || w <= 0 ? 1 : w / N;
586
+ const h = a.getBoundingClientRect(), P = u ? h.width : h.height, F = (k) => {
587
+ const E = Number.parseFloat(k);
588
+ return Number.isFinite(E) ? E : 0;
589
+ }, o = window.getComputedStyle(a), c = F(u ? o.width : o.height), d = c > 0 ? c + F(u ? o.paddingLeft : o.paddingTop) + F(u ? o.paddingRight : o.paddingBottom) + F(u ? o.borderLeftWidth : o.borderTopWidth) + F(u ? o.borderRightWidth : o.borderBottomWidth) : 0, y = d > 0 ? d : u ? a.offsetWidth : a.offsetHeight;
590
+ return y <= 0 || P <= 0 ? 1 : P / y;
591
591
  },
592
592
  [u]
593
- ), ne = y(
593
+ ), Yt = S(
594
594
  (a) => {
595
- const g = F.current;
596
- if (g.pointerId !== a.pointerId)
595
+ const h = B.current;
596
+ if (h.pointerId !== a.pointerId)
597
597
  return;
598
- const w = a.clientX - g.startClientX, o = a.clientY - g.startClientY, c = ht(w, o) / (g.scale || 1);
599
- V.debug("[ScrollBar] handleThumbPointerMove", () => ({
600
- delta: c,
601
- startThumbPosition: g.startThumbPosition,
598
+ const P = a.clientX - h.startClientX, F = a.clientY - h.startClientY, o = ct(P, F) / (h.scale || 1);
599
+ N.debug("[ScrollBar] handleThumbPointerMove", () => ({
600
+ delta: o,
601
+ startThumbPosition: h.startThumbPosition,
602
602
  clientY: a.clientY,
603
- startClientY: g.startClientY,
604
- metrics: C.current
603
+ startClientY: h.startClientY,
604
+ metrics: O.current
605
605
  }));
606
- const d = it(g.startThumbPosition + c);
607
- d !== null && Nt(d), a.cancelable && a.preventDefault();
606
+ const c = xe(h.startThumbPosition + o);
607
+ c !== null && Et(c), a.cancelable && a.preventDefault();
608
608
  },
609
- [ht, it, Nt]
610
- ), Xt = y(
609
+ [ct, xe, Et]
610
+ ), Kt = S(
611
611
  (a) => {
612
- const g = F.current;
613
- if (g.pointerId !== a.pointerId)
612
+ const h = B.current;
613
+ if (h.pointerId !== a.pointerId)
614
614
  return;
615
- document.removeEventListener("pointermove", ne), document.removeEventListener("pointerup", Xt), document.removeEventListener("pointercancel", Xt);
616
- const w = g.captureTarget;
617
- if (w?.hasPointerCapture?.(a.pointerId) && w.releasePointerCapture(a.pointerId), F.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1, captureTarget: null }, ot(!1), L.current) {
618
- const o = L.current.getBoundingClientRect();
619
- a.clientX >= o.left && a.clientX <= o.right && a.clientY >= o.top && a.clientY <= o.bottom || ft(!1);
615
+ document.removeEventListener("pointermove", Yt), document.removeEventListener("pointerup", Kt), document.removeEventListener("pointercancel", Kt);
616
+ const P = h.captureTarget;
617
+ if (P?.hasPointerCapture?.(a.pointerId) && P.releasePointerCapture(a.pointerId), B.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1, captureTarget: null }, rt(!1), z.current) {
618
+ const F = z.current.getBoundingClientRect();
619
+ a.clientX >= F.left && a.clientX <= F.right && a.clientY >= F.top && a.clientY <= F.bottom || st(!1);
620
620
  } else
621
- ft(!1);
621
+ st(!1);
622
622
  },
623
- [ne]
623
+ [Yt]
624
624
  );
625
625
  X(() => () => {
626
- document.removeEventListener("pointermove", ne), document.removeEventListener("pointerup", Xt), document.removeEventListener("pointercancel", Xt);
627
- }, [ne, Xt]);
628
- const kt = b(0), xe = b(0), Me = y(
626
+ document.removeEventListener("pointermove", Yt), document.removeEventListener("pointerup", Kt), document.removeEventListener("pointercancel", Kt);
627
+ }, [Yt, Kt]);
628
+ const Ie = g(0), Bt = g(0), Pe = S(
629
629
  (a) => {
630
- const g = Math.max(Math.round(C.current.viewportSize / ar), sr);
631
- xe.current !== a && (xe.current = a, kt.current = 0), jt(kt, a * g);
630
+ const h = Math.max(Math.round(O.current.viewportSize / ar), sr);
631
+ Bt.current !== a && (Bt.current = a, Ie.current = 0), Ht(Ie, a * h);
632
632
  },
633
- [jt]
634
- ), { handleArrowPointerDown: Ne, handleArrowPointerUp: Yt, handleArrowKeyDown: ie } = hr({
635
- canUseArrowButtons: re,
633
+ [Ht]
634
+ ), { handleArrowPointerDown: ye, handleArrowPointerUp: ve, handleArrowKeyDown: Jt } = hr({
635
+ canUseArrowButtons: ht,
636
636
  enableArrowButtons: l,
637
- resetTapScroll: Pt,
638
- scrollByStep: Me
639
- }), Jt = (a) => {
640
- if (!Z)
637
+ resetTapScroll: kt,
638
+ scrollByStep: Pe
639
+ }), re = (a) => {
640
+ if (!vt)
641
641
  return;
642
642
  if (!n) {
643
643
  a.preventDefault(), a.stopPropagation();
@@ -645,25 +645,25 @@ const mt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
645
645
  }
646
646
  if (a.pointerType === "mouse" && a.button !== 0 || a.ctrlKey)
647
647
  return;
648
- Pt();
649
- const g = a.currentTarget, w = Zt(g);
650
- let o = null;
651
- if (g.setPointerCapture)
648
+ kt();
649
+ const h = a.currentTarget, P = it(h);
650
+ let F = null;
651
+ if (h.setPointerCapture)
652
652
  try {
653
- g.setPointerCapture(a.pointerId), o = g;
653
+ h.setPointerCapture(a.pointerId), F = h;
654
654
  } catch {
655
- o = null;
655
+ F = null;
656
656
  }
657
- F.current = {
657
+ B.current = {
658
658
  pointerId: a.pointerId,
659
- startThumbPosition: lt,
659
+ startThumbPosition: V,
660
660
  startClientX: a.clientX,
661
661
  startClientY: a.clientY,
662
- scale: w,
663
- captureTarget: o
664
- }, document.addEventListener("pointermove", ne), document.addEventListener("pointerup", Xt), document.addEventListener("pointercancel", Xt), ot(!0), ft(!0), a.preventDefault(), a.stopPropagation();
662
+ scale: P,
663
+ captureTarget: F
664
+ }, document.addEventListener("pointermove", Yt), document.addEventListener("pointerup", Kt), document.addEventListener("pointercancel", Kt), rt(!0), st(!0), a.preventDefault(), a.stopPropagation();
665
665
  }, Qt = (a) => {
666
- if (!Z)
666
+ if (!vt)
667
667
  return;
668
668
  if (!s) {
669
669
  a.preventDefault(), a.stopPropagation();
@@ -671,119 +671,119 @@ const mt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
671
671
  }
672
672
  if (a.pointerType === "mouse" && a.button !== 0 || a.ctrlKey)
673
673
  return;
674
- const g = a.currentTarget, w = g.getBoundingClientRect(), o = J(a), c = Zt(g), d = (o - (u ? w.left : w.top)) / c;
675
- Pt();
676
- const P = d - Et / 2, N = be(P);
677
- if (Nt(N), g.setPointerCapture)
674
+ const h = a.currentTarget, P = h.getBoundingClientRect(), F = Mt(a), o = it(h), c = (F - (u ? P.left : P.top)) / o;
675
+ kt();
676
+ const d = c - ut / 2, y = de(d);
677
+ if (Et(y), h.setPointerCapture)
678
678
  try {
679
- g.setPointerCapture(a.pointerId);
679
+ h.setPointerCapture(a.pointerId);
680
680
  } catch {
681
681
  }
682
- h.current = {
682
+ w.current = {
683
683
  pointerId: a.pointerId,
684
- startThumbPosition: P,
684
+ startThumbPosition: d,
685
685
  startClientX: a.clientX,
686
686
  startClientY: a.clientY,
687
- scale: c
687
+ scale: o
688
688
  }, a.preventDefault(), a.stopPropagation();
689
- }, Bt = () => {
690
- h.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1 };
691
- }, ce = (a) => {
692
- const g = h.current;
693
- if (g.pointerId !== a.pointerId)
689
+ }, qt = () => {
690
+ w.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1 };
691
+ }, ne = (a) => {
692
+ const h = w.current;
693
+ if (h.pointerId !== a.pointerId)
694
694
  return;
695
695
  if (a.pointerType === "mouse" && a.buttons === 0) {
696
- Bt();
696
+ qt();
697
697
  return;
698
698
  }
699
- const w = a.clientX - g.startClientX, o = a.clientY - g.startClientY, c = ht(w, o) / (g.scale || 1), d = be(g.startThumbPosition + c);
700
- Nt(d), a.cancelable && a.preventDefault();
701
- }, te = (a) => {
702
- if (h.current.pointerId !== a.pointerId)
699
+ const P = a.clientX - h.startClientX, F = a.clientY - h.startClientY, o = ct(P, F) / (h.scale || 1), c = de(h.startThumbPosition + o);
700
+ Et(c), a.cancelable && a.preventDefault();
701
+ }, fe = (a) => {
702
+ if (w.current.pointerId !== a.pointerId)
703
703
  return;
704
- const g = a.currentTarget;
705
- g.hasPointerCapture?.(a.pointerId) && g.releasePointerCapture(a.pointerId), Bt(), a.preventDefault(), a.stopPropagation();
706
- }, Pe = (a) => {
707
- if (h.current.pointerId !== a.pointerId)
704
+ const h = a.currentTarget;
705
+ h.hasPointerCapture?.(a.pointerId) && h.releasePointerCapture(a.pointerId), qt(), a.preventDefault(), a.stopPropagation();
706
+ }, te = (a) => {
707
+ if (w.current.pointerId !== a.pointerId)
708
708
  return;
709
- const g = a.currentTarget;
710
- g.hasPointerCapture?.(a.pointerId) && g.releasePointerCapture(a.pointerId), Bt();
711
- }, ye = (a) => {
712
- h.current.pointerId === a.pointerId && Bt();
713
- }, Ve = yt(() => mt((St ? 1 : 0.8) * qt, 0, 1), [St, qt]), Ie = yt(() => {
714
- const g = `calc(50% - ${Mt / 2}px + ${Dt}px)`;
709
+ const h = a.currentTarget;
710
+ h.hasPointerCapture?.(a.pointerId) && h.releasePointerCapture(a.pointerId), qt();
711
+ }, we = (a) => {
712
+ w.current.pointerId === a.pointerId && qt();
713
+ }, Re = Nt(() => gt((wt ? 1 : 0.8) * _t, 0, 1), [wt, _t]), Ve = Nt(() => {
714
+ const h = `calc(50% - ${bt / 2}px + ${R}px)`;
715
715
  return {
716
- left: R,
717
- top: g
716
+ left: St,
717
+ top: h
718
718
  };
719
- }, [R, Dt, Mt]), ue = (a, g, w, o) => /* @__PURE__ */ et(
719
+ }, [St, R, bt]), me = (a, h, P, F) => /* @__PURE__ */ Q(
720
720
  "button",
721
721
  {
722
722
  type: "button",
723
723
  tabIndex: 0,
724
724
  className: "aqvs-scrollbar-arrow-button",
725
725
  style: {
726
- [ct]: f,
727
- [at]: f
726
+ [A]: f,
727
+ [mt]: f
728
728
  },
729
- "aria-label": g,
730
- onPointerDown: Ne(a),
731
- onPointerUp: Yt,
732
- onPointerLeave: Yt,
733
- onPointerCancel: Yt,
734
- onKeyDown: ie(a),
729
+ "aria-label": h,
730
+ onPointerDown: ye(a),
731
+ onPointerUp: ve,
732
+ onPointerLeave: ve,
733
+ onPointerCancel: ve,
734
+ onKeyDown: Jt(a),
735
735
  "aria-disabled": !l,
736
- disabled: !re,
737
- children: /* @__PURE__ */ et("span", { "aria-hidden": "true", children: w })
736
+ disabled: !ht,
737
+ children: /* @__PURE__ */ Q("span", { "aria-hidden": "true", children: P })
738
738
  },
739
- o
740
- ), de = p && Z ? {
741
- orientation: Lt,
739
+ F
740
+ ), pe = p && vt ? {
741
+ orientation: Zt,
742
742
  scrollPosition: e,
743
- maxScrollPosition: m,
743
+ maxScrollPosition: xt,
744
744
  contentSize: i,
745
745
  viewportSize: t,
746
- thumbSize: Et,
747
- thumbPosition: lt,
748
- thumbCenter: zt,
749
- trackSize: Ot,
750
- isDragging: W,
751
- isTapScrollActive: St,
752
- visibleStartIndex: z,
753
- visibleEndIndex: rt
746
+ thumbSize: ut,
747
+ thumbPosition: V,
748
+ thumbCenter: It,
749
+ trackSize: Ct,
750
+ isDragging: G,
751
+ isTapScrollActive: wt,
752
+ visibleStartIndex: D,
753
+ visibleEndIndex: J
754
754
  } : null;
755
- return /* @__PURE__ */ le(
755
+ return /* @__PURE__ */ ue(
756
756
  "div",
757
757
  {
758
- className: ae("aqvs-scrollbar", Kt, !Z && "pointer-events-none opacity-0", I),
758
+ className: ce("aqvs-scrollbar", pt, !vt && "pointer-events-none opacity-0", x),
759
759
  style: {
760
- [ct]: t,
761
- [at]: f
760
+ [A]: t,
761
+ [mt]: f
762
762
  },
763
763
  role: "scrollbar",
764
764
  tabIndex: -1,
765
- "aria-controls": v,
765
+ "aria-controls": I,
766
766
  "aria-valuenow": e,
767
767
  "aria-valuemin": 0,
768
- "aria-valuemax": m,
768
+ "aria-valuemax": xt,
769
769
  "aria-orientation": u ? "horizontal" : "vertical",
770
770
  children: [
771
- !u && Z && st && /* @__PURE__ */ et(
771
+ !u && vt && W && /* @__PURE__ */ Q(
772
772
  We,
773
773
  {
774
- ref: O,
775
- className: ae("aqvs-scrollbar-tap-circle-wrapper", Vt),
776
- size: Mt,
777
- maxVisualDistance: xt,
778
- style: Ie,
779
- opacity: Ve,
780
- renderVisual: M,
781
- onDragChange: ge
774
+ ref: tt,
775
+ className: ce("aqvs-scrollbar-tap-circle-wrapper", Ft),
776
+ size: bt,
777
+ maxVisualDistance: Ot,
778
+ style: Ve,
779
+ opacity: Re,
780
+ renderVisual: Gt,
781
+ onDragChange: Me
782
782
  },
783
783
  "tap-circle"
784
784
  ),
785
- ue(-1, Ct[0], ut[0], "arrow-start"),
786
- /* @__PURE__ */ le(
785
+ me(-1, j[0], At[0], "arrow-start"),
786
+ /* @__PURE__ */ ue(
787
787
  "div",
788
788
  {
789
789
  className: "aqvs-scrollbar-track",
@@ -791,45 +791,45 @@ const mt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
791
791
  borderRadius: f / 2
792
792
  },
793
793
  onPointerDown: Qt,
794
- onPointerMove: ce,
795
- onPointerUp: te,
796
- onPointerCancel: Pe,
797
- onLostPointerCapture: ye,
794
+ onPointerMove: ne,
795
+ onPointerUp: fe,
796
+ onPointerCancel: te,
797
+ onLostPointerCapture: we,
798
798
  "aria-disabled": !s,
799
799
  children: [
800
- de && /* @__PURE__ */ et("div", { className: "aqvs-scrollbar-overlay", "aria-hidden": !0, children: p?.(de) }, "overlay"),
801
- /* @__PURE__ */ et(
800
+ pe && /* @__PURE__ */ Q("div", { className: "aqvs-scrollbar-overlay", "aria-hidden": !0, children: p?.(pe) }, "overlay"),
801
+ /* @__PURE__ */ Q(
802
802
  "div",
803
803
  {
804
- className: ae("aqvs-scrollbar-thumb-wrapper", !(Z || W) && "pointer-events-none opacity-0"),
804
+ className: ce("aqvs-scrollbar-thumb-wrapper", !(vt || G) && "pointer-events-none opacity-0"),
805
805
  style: {
806
- [ct]: Et,
807
- [pt]: lt,
806
+ [A]: ut,
807
+ [lt]: V,
808
808
  ...u ? { top: 0, bottom: 0 } : { left: 0, right: 0 }
809
809
  },
810
- onPointerDown: Jt,
810
+ onPointerDown: re,
811
811
  role: "slider",
812
812
  "aria-orientation": u ? "horizontal" : "vertical",
813
813
  "aria-valuenow": e,
814
814
  "aria-valuemin": 0,
815
- "aria-valuemax": m,
815
+ "aria-valuemax": xt,
816
816
  "aria-disabled": !n,
817
817
  tabIndex: -1,
818
- children: /* @__PURE__ */ et(
818
+ children: /* @__PURE__ */ Q(
819
819
  "div",
820
820
  {
821
- ref: L,
822
- className: ae("aqvs-scrollbar-thumb", u ? "aqvs-scrollbar-thumb-horizontal" : "aqvs-scrollbar-thumb-vertical"),
823
- "data-thumb-state": Ht,
821
+ ref: z,
822
+ className: ce("aqvs-scrollbar-thumb", u ? "aqvs-scrollbar-thumb-horizontal" : "aqvs-scrollbar-thumb-vertical"),
823
+ "data-thumb-state": se,
824
824
  style: {
825
825
  borderRadius: f - 1,
826
826
  cursor: n ? "pointer" : "default"
827
827
  },
828
828
  onMouseEnter: () => {
829
- n && ft(!0);
829
+ n && st(!0);
830
830
  },
831
831
  onMouseLeave: () => {
832
- n && ft(!1);
832
+ n && st(!1);
833
833
  }
834
834
  },
835
835
  "thumb"
@@ -841,7 +841,7 @@ const mt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
841
841
  },
842
842
  "track"
843
843
  ),
844
- ue(1, Ct[1], ut[1], "arrow-end")
844
+ me(1, j[1], At[1], "arrow-end")
845
845
  ]
846
846
  }
847
847
  );
@@ -851,7 +851,7 @@ const mt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
851
851
  deceleration: 25e-4,
852
852
  velocitySampleWindow: 90,
853
853
  startVelocityThreshold: 0.04
854
- }, Re = (i, t, e) => {
854
+ }, Ce = (i, t, e) => {
855
855
  for (const [r, n, s] of t)
856
856
  e === "add" ? i.addEventListener(r, n, s) : i.removeEventListener(r, n, s);
857
857
  }, xr = Fe(
@@ -865,171 +865,172 @@ const mt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
865
865
  enableArrowButtons: l = !0,
866
866
  enablePointerDrag: u = !0,
867
867
  onScroll: f,
868
- className: I,
869
- style: v,
870
- background: T,
871
- tapScrollCircleOptions: D,
872
- inertiaOptions: p,
873
- itemCount: z,
874
- renderThumbOverlay: rt,
875
- wheelSpeedMultiplier: W = 1,
876
- onWheelHorizontal: ot,
877
- contentInsets: nt,
878
- visibleStartIndex: ft,
879
- visibleEndIndex: St,
880
- renderOverlay: wt,
881
- initialScrollPosition: L = 0
882
- }, F) => {
883
- const h = b(Number.isFinite(L) ? Math.max(0, L) : 0), $ = b(null), q = b(null), H = b(ot);
868
+ className: x,
869
+ testId: I,
870
+ style: M,
871
+ background: _,
872
+ tapScrollCircleOptions: p,
873
+ inertiaOptions: D,
874
+ itemCount: J,
875
+ renderThumbOverlay: G,
876
+ wheelSpeedMultiplier: rt = 1,
877
+ onWheelHorizontal: nt,
878
+ contentInsets: st,
879
+ visibleStartIndex: wt,
880
+ visibleEndIndex: Vt,
881
+ renderOverlay: z,
882
+ initialScrollPosition: B = 0
883
+ }, w) => {
884
+ const C = g(Number.isFinite(B) ? Math.max(0, B) : 0), U = g(null), H = g(null), tt = g(nt);
884
885
  X(() => {
885
- H.current = ot;
886
- }, [ot]);
887
- const O = b({
886
+ tt.current = nt;
887
+ }, [nt]);
888
+ const L = g({
888
889
  frame: null,
889
890
  velocity: 0,
890
891
  lastTimestamp: null,
891
892
  generation: 0
892
- }), K = yt(
893
+ }), b = Nt(
893
894
  () => ({
894
- maxVelocity: p?.maxVelocity ?? Te.maxVelocity,
895
- minVelocity: p?.minVelocity ?? Te.minVelocity,
896
- deceleration: p?.deceleration ?? Te.deceleration,
897
- velocitySampleWindow: p?.velocitySampleWindow ?? Te.velocitySampleWindow,
898
- startVelocityThreshold: p?.startVelocityThreshold ?? Te.startVelocityThreshold
895
+ maxVelocity: D?.maxVelocity ?? Te.maxVelocity,
896
+ minVelocity: D?.minVelocity ?? Te.minVelocity,
897
+ deceleration: D?.deceleration ?? Te.deceleration,
898
+ velocitySampleWindow: D?.velocitySampleWindow ?? Te.velocitySampleWindow,
899
+ startVelocityThreshold: D?.startVelocityThreshold ?? Te.startVelocityThreshold
899
900
  }),
900
- [p]
901
- ), S = yt(() => ({
902
- top: Math.max(0, nt?.top ?? 0),
903
- bottom: Math.max(0, nt?.bottom ?? 0)
904
- }), [nt]);
905
- V.debug("[ScrollPane] ScrollPane rendered", () => ({
901
+ [D]
902
+ ), K = Nt(() => ({
903
+ top: Math.max(0, st?.top ?? 0),
904
+ bottom: Math.max(0, st?.bottom ?? 0)
905
+ }), [st]);
906
+ N.debug("[ScrollPane] ScrollPane rendered", () => ({
906
907
  contentSize: t,
907
908
  viewportSize: e,
908
909
  scrollBarWidth: r,
909
- className: I,
910
- style: v,
911
- tapScrollCircleOptions: D,
912
- inertiaOptions: p,
910
+ className: x,
911
+ style: M,
912
+ tapScrollCircleOptions: p,
913
+ inertiaOptions: D,
913
914
  enablePointerDrag: u,
914
- contentInsets: S
915
+ contentInsets: K
915
916
  }));
916
- const U = b({ contentSize: t, viewportSize: e });
917
- U.current = { contentSize: t, viewportSize: e };
918
- const j = yt(() => t > e, [t, e]), k = y(
919
- (M) => {
920
- const { contentSize: Y, viewportSize: C } = U.current, ct = Y > C, at = h.current;
921
- if (V.debug("[ScrollPane] scrollTo called", () => ({ newPosition: M, contentSize: Y, viewportSize: C, currentIsScrollable: ct, prevPosition: at })), !ct)
922
- return h.current !== 0 && (h.current = 0, f?.(0, at)), h.current;
923
- const pt = typeof M == "function" ? M(h.current) : M;
924
- if (!Number.isFinite(pt))
925
- return V.warn("[ScrollPane] scrollTo received a non-finite position; keeping the current position", { nextPosition: pt }), h.current;
926
- const ht = Math.max(Y - C, 0), J = mt(pt, 0, ht);
927
- return h.current !== J && (h.current = J, f?.(J, at)), h.current;
917
+ const ft = g({ contentSize: t, viewportSize: e });
918
+ ft.current = { contentSize: t, viewportSize: e };
919
+ const et = Nt(() => t > e, [t, e]), Y = S(
920
+ (T) => {
921
+ const { contentSize: O, viewportSize: A } = ft.current, mt = O > A, lt = C.current;
922
+ if (N.debug("[ScrollPane] scrollTo called", () => ({ newPosition: T, contentSize: O, viewportSize: A, currentIsScrollable: mt, prevPosition: lt })), !mt)
923
+ return C.current !== 0 && (C.current = 0, f?.(0, lt)), C.current;
924
+ const ct = typeof T == "function" ? T(C.current) : T;
925
+ if (!Number.isFinite(ct))
926
+ return N.warn("[ScrollPane] scrollTo received a non-finite position; keeping the current position", { nextPosition: ct }), C.current;
927
+ const Mt = Math.max(O - A, 0), j = gt(ct, 0, Mt);
928
+ return C.current !== j && (C.current = j, f?.(j, lt)), C.current;
928
929
  },
929
930
  [f]
930
- ), G = y(() => {
931
- const M = O.current;
932
- M.generation += 1, M.frame !== null && cancelAnimationFrame(M.frame), M.frame = null, M.velocity = 0, M.lastTimestamp = null;
933
- }, []), st = b(G);
931
+ ), W = S(() => {
932
+ const T = L.current;
933
+ T.generation += 1, T.frame !== null && cancelAnimationFrame(T.frame), T.frame = null, T.velocity = 0, T.lastTimestamp = null;
934
+ }, []), bt = g(W);
934
935
  X(() => {
935
- st.current = G;
936
- }, [G]), X(() => () => {
937
- st.current();
936
+ bt.current = W;
937
+ }, [W]), X(() => () => {
938
+ bt.current();
938
939
  }, []);
939
- const Mt = y(
940
- (M) => {
941
- if (!j)
940
+ const St = S(
941
+ (T) => {
942
+ if (!et)
942
943
  return;
943
- const { maxVelocity: Y, minVelocity: C, deceleration: ct, startVelocityThreshold: at } = K, pt = mt(M, -Y, Y);
944
- if (Math.abs(pt) < at)
944
+ const { maxVelocity: O, minVelocity: A, deceleration: mt, startVelocityThreshold: lt } = b, ct = gt(T, -O, O);
945
+ if (Math.abs(ct) < lt)
945
946
  return;
946
- G(), O.current.velocity = pt, O.current.lastTimestamp = null;
947
- const ht = O.current.generation, J = (Ct) => {
948
- const ut = O.current;
949
- if (ut.generation !== ht)
947
+ W(), L.current.velocity = ct, L.current.lastTimestamp = null;
948
+ const Mt = L.current.generation, j = (At) => {
949
+ const pt = L.current;
950
+ if (pt.generation !== Mt)
950
951
  return;
951
- if (ut.lastTimestamp === null) {
952
- ut.lastTimestamp = Ct, ut.frame = requestAnimationFrame(J);
952
+ if (pt.lastTimestamp === null) {
953
+ pt.lastTimestamp = At, pt.frame = requestAnimationFrame(j);
953
954
  return;
954
955
  }
955
- const Kt = Ct - ut.lastTimestamp;
956
- if (ut.lastTimestamp = Ct, Kt <= 0) {
957
- ut.frame = requestAnimationFrame(J);
956
+ const Zt = At - pt.lastTimestamp;
957
+ if (pt.lastTimestamp = At, Zt <= 0) {
958
+ pt.frame = requestAnimationFrame(j);
958
959
  return;
959
960
  }
960
- const Lt = ut.velocity;
961
- let xt = Lt;
962
- const _t = ct * Kt;
963
- Lt > 0 ? xt = Math.max(0, Lt - _t) : Lt < 0 && (xt = Math.min(0, Lt + _t));
964
- const It = (Lt + xt) / 2 * Kt, Et = h.current;
965
- if (It !== 0 && k((re) => re + It), O.current.generation !== ht)
961
+ const Ot = pt.velocity;
962
+ let Rt = Ot;
963
+ const Ct = mt * Zt;
964
+ Ot > 0 ? Rt = Math.max(0, Ot - Ct) : Ot < 0 && (Rt = Math.min(0, Ot + Ct));
965
+ const ut = (Ot + Rt) / 2 * Zt, xt = C.current;
966
+ if (ut !== 0 && Y((se) => se + ut), L.current.generation !== Mt)
966
967
  return;
967
- const m = h.current, { contentSize: E, viewportSize: lt } = U.current, zt = Math.max(E - lt, 0);
968
- ut.velocity = xt;
969
- const Z = m === Et || m <= 0 && xt <= 0 || m >= zt && xt >= 0;
970
- if (Math.abs(xt) < C || Z) {
971
- G();
968
+ const m = C.current, { contentSize: V, viewportSize: It } = ft.current, vt = Math.max(V - It, 0);
969
+ pt.velocity = Rt;
970
+ const ht = m === xt || m <= 0 && Rt <= 0 || m >= vt && Rt >= 0;
971
+ if (Math.abs(Rt) < A || ht) {
972
+ W();
972
973
  return;
973
974
  }
974
- ut.frame = requestAnimationFrame(J);
975
+ pt.frame = requestAnimationFrame(j);
975
976
  };
976
- O.current.frame = requestAnimationFrame(J);
977
+ L.current.frame = requestAnimationFrame(j);
977
978
  },
978
- [j, K, k, G]
979
- ), R = b(Mt);
979
+ [et, b, Y, W]
980
+ ), R = g(St);
980
981
  X(() => {
981
- R.current = Mt;
982
- }, [Mt]), pe(() => {
983
- U.current = { contentSize: t, viewportSize: e };
984
- }, [t, e]), pe(() => {
985
- const M = q.current;
986
- if (!M) return;
987
- const Y = () => {
988
- M.scrollTop !== 0 && (V.debug("[ScrollPane] Native scroll detected, resetting to 0", () => ({ scrollTop: M.scrollTop })), M.scrollTop = 0), M.scrollLeft !== 0 && (M.scrollLeft = 0);
982
+ R.current = St;
983
+ }, [St]), be(() => {
984
+ ft.current = { contentSize: t, viewportSize: e };
985
+ }, [t, e]), be(() => {
986
+ const T = H.current;
987
+ if (!T) return;
988
+ const O = () => {
989
+ T.scrollTop !== 0 && (N.debug("[ScrollPane] Native scroll detected, resetting to 0", () => ({ scrollTop: T.scrollTop })), T.scrollTop = 0), T.scrollLeft !== 0 && (T.scrollLeft = 0);
989
990
  };
990
- return M.addEventListener("scroll", Y), () => M.removeEventListener("scroll", Y);
991
- }, []), pe(() => {
992
- if (j) {
993
- V.debug("[ScrollPane] Adjusting scroll position due to content or viewport size change", () => ({ contentSize: t, viewportSize: e, scrollPosition: h.current }));
994
- const M = mt(t - e, 0, t);
995
- h.current > M && k(M);
991
+ return T.addEventListener("scroll", O), () => T.removeEventListener("scroll", O);
992
+ }, []), be(() => {
993
+ if (et) {
994
+ N.debug("[ScrollPane] Adjusting scroll position due to content or viewport size change", () => ({ contentSize: t, viewportSize: e, scrollPosition: C.current }));
995
+ const T = gt(t - e, 0, t);
996
+ C.current > T && Y(T);
996
997
  } else
997
- k(0);
998
- }, [j, k, t, e]), X(() => {
999
- const M = (C) => {
1000
- if (H.current && !C.ctrlKey) {
1001
- const at = C.shiftKey && C.deltaX === 0, pt = at ? C.deltaY : C.deltaX, ht = at ? 0 : C.deltaY;
1002
- if (pt !== 0 && Math.abs(pt) >= Math.abs(ht)) {
1003
- C.preventDefault(), G();
1004
- let J = pt;
1005
- C.deltaMode === 1 ? J *= 16 : C.deltaMode === 2 && (J *= e), H.current(J);
998
+ Y(0);
999
+ }, [et, Y, t, e]), X(() => {
1000
+ const T = (A) => {
1001
+ if (tt.current && !A.ctrlKey) {
1002
+ const lt = A.shiftKey && A.deltaX === 0, ct = lt ? A.deltaY : A.deltaX, Mt = lt ? 0 : A.deltaY;
1003
+ if (ct !== 0 && Math.abs(ct) >= Math.abs(Mt)) {
1004
+ A.preventDefault(), W();
1005
+ let j = ct;
1006
+ A.deltaMode === 1 ? j *= 16 : A.deltaMode === 2 && (j *= e), tt.current(j);
1006
1007
  return;
1007
1008
  }
1008
1009
  }
1009
- if (!j || C.ctrlKey || C.deltaY === 0)
1010
+ if (!et || A.ctrlKey || A.deltaY === 0)
1010
1011
  return;
1011
- C.preventDefault(), G();
1012
- let ct = C.deltaY;
1013
- C.deltaMode === 1 ? ct *= 16 : C.deltaMode === 2 && (ct *= e), W !== 1 && (ct *= W), V.debug("[ScrollPane] wheel event", () => ({ deltaY: ct, scrollPosition: h.current, wheelSpeedMultiplier: W, deltaMode: C.deltaMode, scrollTop: q.current?.scrollTop })), k((at) => at + ct);
1014
- }, Y = $.current;
1015
- return Y && Y.addEventListener("wheel", M, { passive: !1 }), () => {
1016
- Y && Y.removeEventListener("wheel", M);
1012
+ A.preventDefault(), W();
1013
+ let mt = A.deltaY;
1014
+ A.deltaMode === 1 ? mt *= 16 : A.deltaMode === 2 && (mt *= e), rt !== 1 && (mt *= rt), N.debug("[ScrollPane] wheel event", () => ({ deltaY: mt, scrollPosition: C.current, wheelSpeedMultiplier: rt, deltaMode: A.deltaMode, scrollTop: H.current?.scrollTop })), Y((lt) => lt + mt);
1015
+ }, O = U.current;
1016
+ return O && O.addEventListener("wheel", T, { passive: !1 }), () => {
1017
+ O && O.removeEventListener("wheel", T);
1017
1018
  };
1018
- }, [j, k, G, e, W]), ke(
1019
- F,
1019
+ }, [et, Y, W, e, rt]), ke(
1020
+ w,
1020
1021
  () => ({
1021
- scrollTo: (M) => (G(), k(M)),
1022
- getScrollPosition: () => h.current,
1022
+ scrollTo: (T) => (W(), Y(T)),
1023
+ getScrollPosition: () => C.current,
1023
1024
  getContentSize: () => t,
1024
1025
  getViewportSize: () => e
1025
1026
  }),
1026
- [k, t, e, G]
1027
+ [Y, t, e, W]
1027
1028
  );
1028
- const Dt = b(k);
1029
+ const Ft = g(Y);
1029
1030
  X(() => {
1030
- Dt.current = k;
1031
- }, [k]);
1032
- const Vt = er(), x = b({
1031
+ Ft.current = Y;
1032
+ }, [Y]);
1033
+ const Lt = er(), v = g({
1033
1034
  pointerId: null,
1034
1035
  startClientY: 0,
1035
1036
  startScroll: 0,
@@ -1037,207 +1038,207 @@ const mt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
1037
1038
  shouldCancelNextClick: !1,
1038
1039
  clickResetTimer: null,
1039
1040
  velocitySamples: []
1040
- }), Rt = b(u);
1041
+ }), zt = g(u);
1041
1042
  X(() => {
1042
- Rt.current = u;
1043
+ zt.current = u;
1043
1044
  }, [u]);
1044
- const At = b(j);
1045
+ const _t = g(et);
1045
1046
  X(() => {
1046
- At.current = j;
1047
- }, [j]);
1048
- const qt = b(K);
1047
+ _t.current = et;
1048
+ }, [et]);
1049
+ const Gt = g(b);
1049
1050
  return X(() => {
1050
- qt.current = K;
1051
- }, [K]), X(() => {
1051
+ Gt.current = b;
1052
+ }, [b]), X(() => {
1052
1053
  if (u)
1053
1054
  return;
1054
- const M = q.current, Y = x.current;
1055
- Y.pointerId !== null && M?.hasPointerCapture(Y.pointerId) && M.releasePointerCapture(Y.pointerId), Y.clickResetTimer !== null && (window.clearTimeout(Y.clickResetTimer), Y.clickResetTimer = null), Y.pointerId = null, Y.startClientY = 0, Y.startScroll = 0, Y.isDragging = !1, Y.shouldCancelNextClick = !1, Y.velocitySamples = [];
1055
+ const T = H.current, O = v.current;
1056
+ O.pointerId !== null && T?.hasPointerCapture(O.pointerId) && T.releasePointerCapture(O.pointerId), O.clickResetTimer !== null && (window.clearTimeout(O.clickResetTimer), O.clickResetTimer = null), O.pointerId = null, O.startClientY = 0, O.startScroll = 0, O.isDragging = !1, O.shouldCancelNextClick = !1, O.velocitySamples = [];
1056
1057
  }, [u]), X(() => {
1057
- const M = q.current;
1058
- if (!M)
1058
+ const T = H.current;
1059
+ if (!T)
1059
1060
  return;
1060
- const Y = 6, C = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(), ct = () => {
1061
- const m = x.current;
1061
+ const O = 6, A = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(), mt = () => {
1062
+ const m = v.current;
1062
1063
  m.pointerId = null, m.startClientY = 0, m.startScroll = 0, m.isDragging = !1, m.velocitySamples = [];
1063
- }, at = () => {
1064
- const m = x.current;
1064
+ }, lt = () => {
1065
+ const m = v.current;
1065
1066
  m.clickResetTimer !== null && (window.clearTimeout(m.clickResetTimer), m.clickResetTimer = null);
1066
- }, pt = (m) => {
1067
- const E = x.current, lt = C();
1068
- E.velocitySamples.push({ clientY: m, time: lt });
1069
- const zt = qt.current.velocitySampleWindow;
1070
- E.velocitySamples = E.velocitySamples.filter((Z) => lt - Z.time <= zt);
1071
- }, ht = (m) => m instanceof HTMLElement && m.closest("[data-scrollpane-ignore-drag='true']") !== null, J = (m) => {
1072
- const E = x.current;
1073
- E.shouldCancelNextClick && (m.preventDefault(), m.stopPropagation(), E.shouldCancelNextClick = !1);
1074
- }, Ct = (m) => {
1075
- const E = x.current;
1076
- if (!E.isDragging) {
1077
- if (E.isDragging = !0, E.shouldCancelNextClick = !0, !M.hasPointerCapture(m.pointerId))
1067
+ }, ct = (m) => {
1068
+ const V = v.current, It = A();
1069
+ V.velocitySamples.push({ clientY: m, time: It });
1070
+ const vt = Gt.current.velocitySampleWindow;
1071
+ V.velocitySamples = V.velocitySamples.filter((ht) => It - ht.time <= vt);
1072
+ }, Mt = (m) => m instanceof HTMLElement && m.closest("[data-scrollpane-ignore-drag='true']") !== null, j = (m) => {
1073
+ const V = v.current;
1074
+ V.shouldCancelNextClick && (m.preventDefault(), m.stopPropagation(), V.shouldCancelNextClick = !1);
1075
+ }, At = (m) => {
1076
+ const V = v.current;
1077
+ if (!V.isDragging) {
1078
+ if (V.isDragging = !0, V.shouldCancelNextClick = !0, !T.hasPointerCapture(m.pointerId))
1078
1079
  try {
1079
- M.setPointerCapture(m.pointerId);
1080
+ T.setPointerCapture(m.pointerId);
1080
1081
  } catch {
1081
1082
  }
1082
- pt(m.clientY);
1083
+ ct(m.clientY);
1083
1084
  }
1084
- }, ut = (m) => {
1085
- const E = x.current;
1086
- M.hasPointerCapture(m) && M.releasePointerCapture(m), E.shouldCancelNextClick = !1, at(), ct();
1087
- }, Kt = (m) => {
1088
- const E = x.current;
1089
- if (E.pointerId !== m.pointerId)
1085
+ }, pt = (m) => {
1086
+ const V = v.current;
1087
+ T.hasPointerCapture(m) && T.releasePointerCapture(m), V.shouldCancelNextClick = !1, lt(), mt();
1088
+ }, Zt = (m) => {
1089
+ const V = v.current;
1090
+ if (V.pointerId !== m.pointerId)
1090
1091
  return;
1091
1092
  if (m.buttons === 0) {
1092
- ut(m.pointerId);
1093
+ pt(m.pointerId);
1093
1094
  return;
1094
1095
  }
1095
- if (!(Rt.current && At.current) || !E.isDragging && (Math.abs(m.clientY - E.startClientY) < Y || (Ct(m), !E.isDragging)))
1096
+ if (!(zt.current && _t.current) || !V.isDragging && (Math.abs(m.clientY - V.startClientY) < O || (At(m), !V.isDragging)))
1096
1097
  return;
1097
- pt(m.clientY);
1098
- const lt = m.clientY - E.startClientY, zt = E.startScroll - lt;
1099
- Dt.current(zt), m.cancelable && m.preventDefault();
1100
- }, Lt = (m) => {
1101
- const E = x.current;
1102
- if (E.pointerId !== m.pointerId)
1098
+ ct(m.clientY);
1099
+ const It = m.clientY - V.startClientY, vt = V.startScroll - It;
1100
+ Ft.current(vt), m.cancelable && m.preventDefault();
1101
+ }, Ot = (m) => {
1102
+ const V = v.current;
1103
+ if (V.pointerId !== m.pointerId)
1103
1104
  return;
1104
- E.isDragging && E.shouldCancelNextClick && m.cancelable && (m.preventDefault(), m.stopPropagation()), E.isDragging && pt(m.clientY);
1105
- let lt = 0;
1106
- if (E.isDragging && E.velocitySamples.length >= 2) {
1107
- const Z = E.velocitySamples, re = qt.current.velocitySampleWindow, Ht = Z[Z.length - 1], Nt = Z.find((Wt) => Ht.time - Wt.time <= re) ?? Z[0];
1108
- if (Ht && Nt && Ht.time !== Nt.time) {
1109
- const Wt = Ht.clientY - Nt.clientY, jt = Ht.time - Nt.time;
1110
- lt = -(Wt / jt);
1105
+ V.isDragging && V.shouldCancelNextClick && m.cancelable && (m.preventDefault(), m.stopPropagation()), V.isDragging && ct(m.clientY);
1106
+ let It = 0;
1107
+ if (V.isDragging && V.velocitySamples.length >= 2) {
1108
+ const ht = V.velocitySamples, se = Gt.current.velocitySampleWindow, Et = ht[ht.length - 1], $t = ht.find((Ht) => Et.time - Ht.time <= se) ?? ht[0];
1109
+ if (Et && $t && Et.time !== $t.time) {
1110
+ const Ht = Et.clientY - $t.clientY, Dt = Et.time - $t.time;
1111
+ It = -(Ht / Dt);
1111
1112
  }
1112
1113
  }
1113
- at(), E.shouldCancelNextClick && (E.clickResetTimer = window.setTimeout(() => {
1114
- const Z = x.current;
1115
- Z.shouldCancelNextClick = !1, Z.clickResetTimer = null;
1114
+ lt(), V.shouldCancelNextClick && (V.clickResetTimer = window.setTimeout(() => {
1115
+ const ht = v.current;
1116
+ ht.shouldCancelNextClick = !1, ht.clickResetTimer = null;
1116
1117
  }, 0));
1117
- const zt = qt.current.startVelocityThreshold;
1118
- ct(), M.hasPointerCapture(m.pointerId) && M.releasePointerCapture(m.pointerId), Math.abs(lt) >= zt && R.current?.(lt);
1119
- }, xt = (m) => {
1120
- if (x.current.pointerId !== null || !(Rt.current && At.current) || m.button !== 0 && m.pointerType === "mouse" || m.ctrlKey || m.metaKey || m.altKey || ht(m.target))
1118
+ const vt = Gt.current.startVelocityThreshold;
1119
+ mt(), T.hasPointerCapture(m.pointerId) && T.releasePointerCapture(m.pointerId), Math.abs(It) >= vt && R.current?.(It);
1120
+ }, Rt = (m) => {
1121
+ if (v.current.pointerId !== null || !(zt.current && _t.current) || m.button !== 0 && m.pointerType === "mouse" || m.ctrlKey || m.metaKey || m.altKey || Mt(m.target))
1121
1122
  return;
1122
- window.dispatchEvent(new CustomEvent(Oe, { detail: { paneId: Vt } })), st.current?.();
1123
- const E = x.current;
1124
- at(), E.pointerId = m.pointerId, E.startClientY = m.clientY, E.startScroll = h.current, E.isDragging = !1, E.shouldCancelNextClick = !1, E.velocitySamples = [];
1125
- }, _t = (m) => {
1126
- x.current.pointerId === m.pointerId && ut(m.pointerId);
1127
- }, It = [
1128
- ["click", J, !0],
1129
- ["pointerdown", xt, { passive: !1 }],
1123
+ window.dispatchEvent(new CustomEvent(Oe, { detail: { paneId: Lt } })), bt.current?.();
1124
+ const V = v.current;
1125
+ lt(), V.pointerId = m.pointerId, V.startClientY = m.clientY, V.startScroll = C.current, V.isDragging = !1, V.shouldCancelNextClick = !1, V.velocitySamples = [];
1126
+ }, Ct = (m) => {
1127
+ v.current.pointerId === m.pointerId && pt(m.pointerId);
1128
+ }, ut = [
1129
+ ["click", j, !0],
1130
+ ["pointerdown", Rt, { passive: !1 }],
1130
1131
  ["lostpointercapture", (m) => {
1131
- x.current.pointerId === m.pointerId && ut(m.pointerId);
1132
+ v.current.pointerId === m.pointerId && pt(m.pointerId);
1132
1133
  }, void 0]
1133
- ], Et = [
1134
- ["pointermove", Kt, { passive: !1 }],
1135
- ["pointerup", Lt, void 0],
1136
- ["pointercancel", _t, void 0]
1134
+ ], xt = [
1135
+ ["pointermove", Zt, { passive: !1 }],
1136
+ ["pointerup", Ot, void 0],
1137
+ ["pointercancel", Ct, void 0]
1137
1138
  ];
1138
- return Re(M, It, "add"), Re(window, Et, "add"), () => {
1139
- Re(M, It, "remove"), Re(window, Et, "remove");
1140
- const m = x.current;
1141
- m.pointerId !== null && M.hasPointerCapture(m.pointerId) && M.releasePointerCapture(m.pointerId), at(), ct();
1139
+ return Ce(T, ut, "add"), Ce(window, xt, "add"), () => {
1140
+ Ce(T, ut, "remove"), Ce(window, xt, "remove");
1141
+ const m = v.current;
1142
+ m.pointerId !== null && T.hasPointerCapture(m.pointerId) && T.releasePointerCapture(m.pointerId), lt(), mt();
1142
1143
  };
1143
- }, [Vt]), /* @__PURE__ */ le("div", { ref: $, className: ae("aqvs-scroll-pane", I), style: v, children: [
1144
- /* @__PURE__ */ le(
1144
+ }, [Lt]), /* @__PURE__ */ ue("div", { ref: U, "data-testid": I, className: ce("aqvs-scroll-pane", x), style: M, children: [
1145
+ /* @__PURE__ */ ue(
1145
1146
  "div",
1146
1147
  {
1147
- ref: q,
1148
- className: ae("aqvs-scroll-pane-content"),
1148
+ ref: H,
1149
+ className: ce("aqvs-scroll-pane-content"),
1149
1150
  style: {
1150
1151
  height: e,
1151
- paddingTop: S.top,
1152
- paddingBottom: S.bottom,
1152
+ paddingTop: K.top,
1153
+ paddingBottom: K.bottom,
1153
1154
  // スクロール不能時 (contentSize <= viewportSize) は touch-action を通常に戻し、
1154
1155
  // 短いリスト上のタッチがページ全体のパンを妨げるデッドゾーン化を防ぐ
1155
- ...u && j ? { touchAction: "none" } : {}
1156
+ ...u && et ? { touchAction: "none" } : {}
1156
1157
  },
1157
- id: Vt,
1158
+ id: Lt,
1158
1159
  children: [
1159
- T,
1160
- i(h.current)
1160
+ _,
1161
+ i(C.current)
1161
1162
  ]
1162
1163
  }
1163
1164
  ),
1164
- /* @__PURE__ */ et(
1165
+ /* @__PURE__ */ Q(
1165
1166
  br,
1166
1167
  {
1167
1168
  contentSize: t,
1168
1169
  viewportSize: e,
1169
- scrollPosition: h.current,
1170
- onScroll: k,
1170
+ scrollPosition: C.current,
1171
+ onScroll: Y,
1171
1172
  enableThumbDrag: n,
1172
1173
  enableTrackClick: s,
1173
1174
  enableArrowButtons: l,
1174
1175
  scrollBarWidth: r,
1175
- ariaControls: Vt,
1176
- tapScrollCircleOptions: D,
1177
- itemCount: z,
1178
- renderThumbOverlay: rt,
1179
- visibleStartIndex: ft,
1180
- visibleEndIndex: St
1176
+ ariaControls: Lt,
1177
+ tapScrollCircleOptions: p,
1178
+ itemCount: J,
1179
+ renderThumbOverlay: G,
1180
+ visibleStartIndex: wt,
1181
+ visibleEndIndex: Vt
1181
1182
  },
1182
1183
  "scrollbar"
1183
1184
  ),
1184
- wt?.()
1185
+ z?.()
1185
1186
  ] });
1186
1187
  }
1187
1188
  ), He = (i, t, e) => Math.min(Math.max(i, t), e), Dr = ({ dragState: i, normalizedDistance: t, sizeScale: e, size: r }) => {
1188
- const n = Math.max(r / 2, 1), s = 1 + t * 0.65, l = Math.max(0.65, 1 - t * 0.25), u = i.direction * t * 26 * e, f = 0.8 + t * 0.18, I = 3 * e, v = 6 * e, T = 22 * e, D = Math.abs(u) + v, p = u > 0 ? I : -Math.abs(u) - I, z = Math.max(2.5, 3 * e), rt = He(i.offsetX, -n, n), W = He(i.offsetY, -n, n), ot = n * 0.35, nt = rt / n * ot, ft = W / n * ot, St = nt * 0.45, wt = ft * 0.45, L = Math.max(T * 0.38, 6), F = 0.65 + t * 0.2, h = i.active;
1189
- return /* @__PURE__ */ le(Ke, { children: [
1190
- /* @__PURE__ */ et(
1189
+ const n = Math.max(r / 2, 1), s = 1 + t * 0.65, l = Math.max(0.65, 1 - t * 0.25), u = i.direction * t * 26 * e, f = 0.8 + t * 0.18, x = 3 * e, I = 6 * e, M = 22 * e, _ = Math.abs(u) + I, p = u > 0 ? x : -Math.abs(u) - x, D = Math.max(2.5, 3 * e), J = He(i.offsetX, -n, n), G = He(i.offsetY, -n, n), rt = n * 0.35, nt = J / n * rt, st = G / n * rt, wt = nt * 0.45, Vt = st * 0.45, z = Math.max(M * 0.38, 6), B = 0.65 + t * 0.2, w = i.active;
1190
+ return /* @__PURE__ */ ue(Ke, { children: [
1191
+ /* @__PURE__ */ Q(
1191
1192
  "div",
1192
1193
  {
1193
1194
  className: "aqvs-tap-scroll-circle-gradient",
1194
1195
  style: {
1195
1196
  transform: `scale(${l}, ${s})`,
1196
- transition: h ? "40ms transform ease-out" : "200ms ease transform"
1197
+ transition: w ? "40ms transform ease-out" : "200ms ease transform"
1197
1198
  }
1198
1199
  }
1199
1200
  ),
1200
- /* @__PURE__ */ et(
1201
+ /* @__PURE__ */ Q(
1201
1202
  "div",
1202
1203
  {
1203
1204
  className: "aqvs-sample-visual-rod",
1204
1205
  style: {
1205
- width: T,
1206
- height: T,
1207
- transform: `translate(calc(-50% + ${nt}px), calc(-50% + ${ft}px)) scale(${l}, ${f * s})`,
1208
- transition: h ? "70ms transform ease-out" : "200ms ease transform"
1206
+ width: M,
1207
+ height: M,
1208
+ transform: `translate(calc(-50% + ${nt}px), calc(-50% + ${st}px)) scale(${l}, ${f * s})`,
1209
+ transition: w ? "70ms transform ease-out" : "200ms ease transform"
1209
1210
  }
1210
1211
  }
1211
1212
  ),
1212
- /* @__PURE__ */ et(
1213
+ /* @__PURE__ */ Q(
1213
1214
  "div",
1214
1215
  {
1215
1216
  className: "aqvs-sample-visual-pupil",
1216
1217
  style: {
1217
- width: L,
1218
- height: L,
1219
- transform: `translate(calc(-50% + ${St}px), calc(-50% + ${wt}px)) scale(${l}, ${s})`,
1220
- opacity: F,
1218
+ width: z,
1219
+ height: z,
1220
+ transform: `translate(calc(-50% + ${wt}px), calc(-50% + ${Vt}px)) scale(${l}, ${s})`,
1221
+ opacity: B,
1221
1222
  boxShadow: "0 0 8px rgba(255,255,255,0.45)",
1222
- transition: h ? "120ms opacity 150ms, 120ms transform ease-out ease-out" : "220ms ease transform, 240ms opacity ease"
1223
+ transition: w ? "120ms opacity 150ms, 120ms transform ease-out ease-out" : "220ms ease transform, 240ms opacity ease"
1223
1224
  }
1224
1225
  }
1225
1226
  ),
1226
- /* @__PURE__ */ et(
1227
+ /* @__PURE__ */ Q(
1227
1228
  "div",
1228
1229
  {
1229
1230
  className: "aqvs-sample-visual-highlight",
1230
1231
  style: {
1231
- width: z,
1232
- height: D,
1232
+ width: D,
1233
+ height: _,
1233
1234
  transform: `translate(-50%, ${p}px)`,
1234
1235
  opacity: t,
1235
- transition: h ? "40ms height, 60ms opacity ease-out ease-out" : "200ms ease height, 120ms ease opacity"
1236
+ transition: w ? "40ms height, 60ms opacity ease-out ease-out" : "200ms ease height, 120ms ease opacity"
1236
1237
  }
1237
1238
  }
1238
1239
  )
1239
1240
  ] });
1240
- }, Ce = 100, Ir = (i) => {
1241
+ }, Ee = 100, Ir = (i) => {
1241
1242
  if (!Number.isFinite(i))
1242
1243
  return 0n;
1243
1244
  const t = Math.trunc(i);
@@ -1246,7 +1247,7 @@ const mt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
1246
1247
  if (!Number.isFinite(i))
1247
1248
  throw new Error(`valueFn returned a non-finite value at index ${t}: ${i}`);
1248
1249
  return i;
1249
- }, fe = (i) => {
1250
+ }, he = (i) => {
1250
1251
  if (i <= 0 || !Number.isFinite(i))
1251
1252
  return 0;
1252
1253
  const t = Math.trunc(i);
@@ -1323,14 +1324,14 @@ class oe {
1323
1324
  if (n > 0) {
1324
1325
  const u = r?.sampleRange ?? {
1325
1326
  from: 0,
1326
- to: Math.min(Ce - 1, n - 1)
1327
+ to: Math.min(Ee - 1, n - 1)
1327
1328
  };
1328
- let f = Math.max(0, Math.trunc(u.from)), I = Math.min(Math.trunc(u.to), n - 1);
1329
- if (f > I && (f = 0, I = Math.min(Ce - 1, n - 1)), n > Ce)
1330
- s = oe._sampleBaseValueStrided(e, n, Ce), r?.materialize && (l = { from: f, values: oe._collectValidatedValues(e, f, I) });
1329
+ let f = Math.max(0, Math.trunc(u.from)), x = Math.min(Math.trunc(u.to), n - 1);
1330
+ if (f > x && (f = 0, x = Math.min(Ee - 1, n - 1)), n > Ee)
1331
+ s = oe._sampleBaseValueStrided(e, n, Ee), r?.materialize && (l = { from: f, values: oe._collectValidatedValues(e, f, x) });
1331
1332
  else {
1332
- const v = oe._collectValidatedValues(e, f, I);
1333
- s = oe._modeOrMedian([...v]), r?.materialize && (l = { from: f, values: v });
1333
+ const I = oe._collectValidatedValues(e, f, x);
1334
+ s = oe._modeOrMedian([...I]), r?.materialize && (l = { from: f, values: I });
1334
1335
  }
1335
1336
  }
1336
1337
  if (this.size = n, this.tree = /* @__PURE__ */ new Map(), this.deltas = /* @__PURE__ */ new Map(), this.total = void 0, this.valueFn = e, this.baseValue = s, l)
@@ -1338,8 +1339,8 @@ class oe {
1338
1339
  const f = l.from + u;
1339
1340
  if (f >= this.size)
1340
1341
  break;
1341
- const I = l.values[u] - this.baseValue;
1342
- I !== 0 && (this.deltas.set(f, I), this._updateTree(f, I));
1342
+ const x = l.values[u] - this.baseValue;
1343
+ x !== 0 && (this.deltas.set(f, x), this._updateTree(f, x));
1343
1344
  }
1344
1345
  this.total = this.getTotal();
1345
1346
  }
@@ -1396,9 +1397,9 @@ class oe {
1396
1397
  }
1397
1398
  if (s > t.length * 0.2) {
1398
1399
  const l = [];
1399
- for (const [f, I] of n.entries())
1400
- I === s && l.push(f);
1401
- const u = l.reduce((f, I) => f + I, 0);
1400
+ for (const [f, x] of n.entries())
1401
+ x === s && l.push(f);
1402
+ const u = l.reduce((f, x) => f + x, 0);
1402
1403
  r = Math.floor(u / l.length);
1403
1404
  }
1404
1405
  return r;
@@ -1493,7 +1494,7 @@ class oe {
1493
1494
  let r = t + 1;
1494
1495
  for (; r <= this.size; ) {
1495
1496
  this.tree.set(r, (this.tree.get(r) ?? 0) + e);
1496
- const n = fe(r);
1497
+ const n = he(r);
1497
1498
  if (n === 0)
1498
1499
  break;
1499
1500
  r += n;
@@ -1537,7 +1538,7 @@ class oe {
1537
1538
  let t = 0, e = this.size;
1538
1539
  for (; e > 0; ) {
1539
1540
  t += this.tree.get(e) ?? 0;
1540
- const r = fe(e);
1541
+ const r = he(e);
1541
1542
  if (r === 0)
1542
1543
  break;
1543
1544
  e -= r;
@@ -1576,9 +1577,9 @@ class oe {
1576
1577
  const n = t.ranges;
1577
1578
  if (n && n.length > 0) {
1578
1579
  for (const u of n) {
1579
- const f = Math.max(0, Math.trunc(u.from)), I = Math.min(Math.trunc(u.to), this.size - 1);
1580
- for (let v = f; v <= I; v++)
1581
- this._materialize(v);
1580
+ const f = Math.max(0, Math.trunc(u.from)), x = Math.min(Math.trunc(u.to), this.size - 1);
1581
+ for (let I = f; I <= x; I++)
1582
+ this._materialize(I);
1582
1583
  }
1583
1584
  if (e === void 0)
1584
1585
  return;
@@ -1664,11 +1665,11 @@ class oe {
1664
1665
  this._materializeRanges(e.materializeOption);
1665
1666
  const s = e.materializeOption?.materialize === !0;
1666
1667
  for (; ; ) {
1667
- let l = 0n, u = n - 1n, f, I, v = this.total;
1668
+ let l = 0n, u = n - 1n, f, x, I = this.total;
1668
1669
  for (; l <= u; ) {
1669
- const p = l + u >> 1n, z = Number(p), rt = this.prefixSum(z);
1670
- if (v = rt.total, r ? rt.cumulative >= t : rt.cumulative <= t)
1671
- if (f = p, I = rt, r) {
1670
+ const p = l + u >> 1n, D = Number(p), J = this.prefixSum(D);
1671
+ if (I = J.total, r ? J.cumulative >= t : J.cumulative <= t)
1672
+ if (f = p, x = J, r) {
1672
1673
  if (p === 0n)
1673
1674
  break;
1674
1675
  u = p - 1n;
@@ -1682,18 +1683,18 @@ class oe {
1682
1683
  u = p - 1n;
1683
1684
  }
1684
1685
  }
1685
- const T = I, D = f !== void 0 ? Number(f) : -1;
1686
- if (s && D >= 0) {
1687
- const p = this.deltas.get(D) ?? 0;
1688
- if (this._materialize(D), (this.deltas.get(D) ?? 0) !== p)
1686
+ const M = x, _ = f !== void 0 ? Number(f) : -1;
1687
+ if (s && _ >= 0) {
1688
+ const p = this.deltas.get(_) ?? 0;
1689
+ if (this._materialize(_), (this.deltas.get(_) ?? 0) !== p)
1689
1690
  continue;
1690
1691
  }
1691
1692
  return {
1692
- index: D,
1693
- total: v,
1694
- cumulative: T?.cumulative,
1695
- currentValue: T?.currentValue,
1696
- safeIndex: T?.safeIndex
1693
+ index: _,
1694
+ total: I,
1695
+ cumulative: M?.cumulative,
1696
+ currentValue: M?.currentValue,
1697
+ safeIndex: M?.safeIndex
1697
1698
  };
1698
1699
  }
1699
1700
  }
@@ -1710,16 +1711,16 @@ class oe {
1710
1711
  return { cumulative: 0, total: this.total, currentValue: 0, safeIndex: 0 };
1711
1712
  if (this.size === 0)
1712
1713
  return { cumulative: 0, total: this.total ?? 0, currentValue: 0, safeIndex: 0 };
1713
- const r = mt(Math.trunc(t), 0, this.size - 1), n = e?.materializeOption;
1714
+ const r = gt(Math.trunc(t), 0, this.size - 1), n = e?.materializeOption;
1714
1715
  this._materializeRanges(n, r, !0);
1715
1716
  let s = 0, l = r + 1;
1716
1717
  for (; l > 0; ) {
1717
1718
  const f = this.tree.get(l) ?? 0;
1718
1719
  s += f;
1719
- const I = fe(l);
1720
- if (I === 0)
1720
+ const x = he(l);
1721
+ if (x === 0)
1721
1722
  break;
1722
- l -= I;
1723
+ l -= x;
1723
1724
  }
1724
1725
  const u = n?.materialize ? this.get(r) : (this.deltas.get(r) || 0) + this.baseValue;
1725
1726
  return { cumulative: s + this.baseValue * (r + 1), total: this.total, currentValue: u, safeIndex: r };
@@ -1755,7 +1756,7 @@ class oe {
1755
1756
  else {
1756
1757
  this.total = this._computeTreeTotal();
1757
1758
  const r = this.prefixSum(this.getSize() - 1);
1758
- r.cumulative !== r.total && V.error("Inconsistent Fenwick Tree state");
1759
+ r.cumulative !== r.total && N.error("Inconsistent Fenwick Tree state");
1759
1760
  }
1760
1761
  return this.total;
1761
1762
  }
@@ -1779,7 +1780,7 @@ class oe {
1779
1780
  let s = r + 1;
1780
1781
  for (; s <= this.size; ) {
1781
1782
  e.set(s, (e.get(s) ?? 0) + n);
1782
- const l = fe(s);
1783
+ const l = he(s);
1783
1784
  if (l === 0)
1784
1785
  break;
1785
1786
  s += l;
@@ -1839,7 +1840,7 @@ class oe {
1839
1840
  this.size = e, this.rebuildTree();
1840
1841
  }
1841
1842
  const n = this.prefixSum(this.getSize() - 1);
1842
- n.cumulative !== n.total && V.error("Inconsistent Fenwick Tree state");
1843
+ n.cumulative !== n.total && N.error("Inconsistent Fenwick Tree state");
1843
1844
  }
1844
1845
  /**
1845
1846
  * @private
@@ -1873,14 +1874,14 @@ class oe {
1873
1874
  _propagateDeltaToGrownNodes(t, e, r, n) {
1874
1875
  let s = t + 1;
1875
1876
  for (; s <= r; ) {
1876
- const l = fe(s);
1877
+ const l = he(s);
1877
1878
  if (l === 0)
1878
1879
  break;
1879
1880
  s += l;
1880
1881
  }
1881
1882
  for (; s <= n; ) {
1882
1883
  this.tree.set(s, (this.tree.get(s) ?? 0) + e);
1883
- const l = fe(s);
1884
+ const l = he(s);
1884
1885
  if (l === 0)
1885
1886
  break;
1886
1887
  s += l;
@@ -1950,13 +1951,13 @@ const vr = (i, t) => {
1950
1951
  const e = i?.sampleRange, r = t?.sampleRange;
1951
1952
  return e === r ? !1 : e && r ? e.from !== r.from || e.to !== r.to : !0;
1952
1953
  }, Tr = (i, t, e) => {
1953
- const r = Number.isFinite(i) && i > 0 ? Math.trunc(i) : 0, n = b(null), s = b({ size: r, valueOrFn: t, options: e });
1954
+ const r = Number.isFinite(i) && i > 0 ? Math.trunc(i) : 0, n = g(null), s = g({ size: r, valueOrFn: t, options: e });
1954
1955
  n.current === null && (n.current = new oe(r, t, e));
1955
- const l = n.current, u = s.current, f = u.size !== r, I = u.valueOrFn !== t, v = vr(u.options, e), T = u.size === 0 && r > 0;
1956
- if (I || v) {
1957
- const D = e?.resetOnValueFnChange ?? !0;
1958
- v || I && D || T ? (e?.debug && V.debug("[useFenwickMapTree] reset", { valueOrFnChanged: I, optionsChanged: v }), l.reset(r, t, e)) : (f && (e?.debug && V.debug("[useFenwickMapTree] resize (with valueFn change)", { from: u.size, to: r }), l.changeSize(r)), e?.debug && V.debug("[useFenwickMapTree] setValueFn (no reset)", { valueOrFnChanged: I }), l.setValueFn(t, { reset: !1 })), s.current = { size: r, valueOrFn: t, options: e };
1959
- } else f && (e?.debug && V.debug("[useFenwickMapTree] resize", { from: u.size, to: r }), T ? l.reset(r, t, e) : l.changeSize(r), s.current = { size: r, valueOrFn: t, options: e });
1956
+ const l = n.current, u = s.current, f = u.size !== r, x = u.valueOrFn !== t, I = vr(u.options, e), M = u.size === 0 && r > 0;
1957
+ if (x || I) {
1958
+ const _ = e?.resetOnValueFnChange ?? !0;
1959
+ I || x && _ || M ? (e?.debug && N.debug("[useFenwickMapTree] reset", { valueOrFnChanged: x, optionsChanged: I }), l.reset(r, t, e)) : (f && (e?.debug && N.debug("[useFenwickMapTree] resize (with valueFn change)", { from: u.size, to: r }), l.changeSize(r)), e?.debug && N.debug("[useFenwickMapTree] setValueFn (no reset)", { valueOrFnChanged: x }), l.setValueFn(t, { reset: !1 })), s.current = { size: r, valueOrFn: t, options: e };
1960
+ } else f && (e?.debug && N.debug("[useFenwickMapTree] resize", { from: u.size, to: r }), M ? l.reset(r, t, e) : l.changeSize(r), s.current = { size: r, valueOrFn: t, options: e });
1960
1961
  return l;
1961
1962
  };
1962
1963
  class Sr {
@@ -2010,54 +2011,54 @@ class _e {
2010
2011
  }
2011
2012
  }
2012
2013
  function Mr(i) {
2013
- const t = b(/* @__PURE__ */ new Map()), e = b(new _e()), r = Math.floor(i), n = b(r);
2014
+ const t = g(/* @__PURE__ */ new Map()), e = g(new _e()), r = Math.floor(i), n = g(r);
2014
2015
  X(() => {
2015
2016
  if (n.current = r, Number.isNaN(r) || r < 0) {
2016
- V.warn(`useLruCache: invalid capacity ${i}; the cache will not store any entries.`), t.current.clear(), e.current = new _e();
2017
+ N.warn(`useLruCache: invalid capacity ${i}; the cache will not store any entries.`), t.current.clear(), e.current = new _e();
2017
2018
  return;
2018
2019
  }
2019
2020
  if (Number.isFinite(r))
2020
2021
  for (; t.current.size > r; ) {
2021
- const v = e.current.removeHead();
2022
- if (v)
2023
- t.current.delete(v.key);
2022
+ const I = e.current.removeHead();
2023
+ if (I)
2024
+ t.current.delete(I.key);
2024
2025
  else
2025
2026
  break;
2026
2027
  }
2027
2028
  }, [i, r]);
2028
- const s = y((v) => {
2029
- const T = t.current.get(v);
2030
- if (T)
2031
- return e.current.moveToTail(T), T.value;
2032
- }, []), l = y((v, T) => {
2033
- const D = n.current;
2034
- if (Number.isNaN(D) || D <= 0)
2029
+ const s = S((I) => {
2030
+ const M = t.current.get(I);
2031
+ if (M)
2032
+ return e.current.moveToTail(M), M.value;
2033
+ }, []), l = S((I, M) => {
2034
+ const _ = n.current;
2035
+ if (Number.isNaN(_) || _ <= 0)
2035
2036
  return;
2036
- let p = t.current.get(v);
2037
+ let p = t.current.get(I);
2037
2038
  if (p)
2038
- p.value = T, e.current.moveToTail(p);
2039
+ p.value = M, e.current.moveToTail(p);
2039
2040
  else {
2040
- if (t.current.size >= D) {
2041
- const z = e.current.removeHead();
2042
- z && t.current.delete(z.key);
2041
+ if (t.current.size >= _) {
2042
+ const D = e.current.removeHead();
2043
+ D && t.current.delete(D.key);
2043
2044
  }
2044
- p = new Sr(v, T), t.current.set(v, p), e.current.addToTail(p);
2045
+ p = new Sr(I, M), t.current.set(I, p), e.current.addToTail(p);
2045
2046
  }
2046
- }, []), u = y((v) => t.current.has(v), []), f = y((v) => {
2047
- const T = t.current.get(v);
2048
- T && (e.current.remove(T), t.current.delete(v));
2049
- }, []), I = y(() => {
2047
+ }, []), u = S((I) => t.current.has(I), []), f = S((I) => {
2048
+ const M = t.current.get(I);
2049
+ M && (e.current.remove(M), t.current.delete(I));
2050
+ }, []), x = S(() => {
2050
2051
  t.current.clear(), e.current = new _e();
2051
2052
  }, []);
2052
- return yt(() => ({ get: s, set: l, has: u, remove: f, clear: I }), [s, l, u, f, I]);
2053
+ return Nt(() => ({ get: s, set: l, has: u, remove: f, clear: x }), [s, l, u, f, x]);
2053
2054
  }
2054
2055
  const Pr = 1e4, Lr = () => {
2055
2056
  const { get: i, set: t, has: e, clear: r } = Mr(Pr);
2056
- return yt(() => ({ get: i, set: t, has: e, clear: r }), [i, t, e, r]);
2057
- }, dt = (i, t) => t <= 0 ? 0 : mt(i, 0, t - 1), Xe = (i) => ({
2057
+ return Nt(() => ({ get: i, set: t, has: e, clear: r }), [i, t, e, r]);
2058
+ }, dt = (i, t) => t <= 0 ? 0 : gt(i, 0, t - 1), Xe = (i) => ({
2058
2059
  top: Math.max(0, i?.top ?? 0),
2059
2060
  bottom: Math.max(0, i?.bottom ?? 0)
2060
- }), ee = (i, t) => i <= t ? 0 : i - t, me = (i, t) => i <= 0 ? t : i + t, Ee = 1e3, $e = 2e3, yr = 1048576, Se = (i) => {
2061
+ }), ee = (i, t) => i <= t ? 0 : i - t, ge = (i, t) => i <= 0 ? t : i + t, Ne = 1e3, $e = 2e3, yr = 1048576, Se = (i) => {
2061
2062
  if (!Number.isFinite(i)) return 0n;
2062
2063
  const t = Math.trunc(i);
2063
2064
  return t <= 0 ? 0n : BigInt(t);
@@ -2065,33 +2066,33 @@ const Pr = 1e4, Lr = () => {
2065
2066
  const f = Se(r);
2066
2067
  if (f === 0n)
2067
2068
  return { renderingStartIndex: 0, renderingEndIndex: 0, visibleStartIndex: 0, visibleEndIndex: 0 };
2068
- const I = (L) => L < 0n ? 0n : L >= f ? f - 1n : L, v = { materializeOption: { materialize: !1 } }, { index: T, cumulative: D } = s.findIndexAtOrAfter(i, v);
2069
+ const x = (z) => z < 0n ? 0n : z >= f ? f - 1n : z, I = { materializeOption: { materialize: !1 } }, { index: M, cumulative: _ } = s.findIndexAtOrAfter(i, I);
2069
2070
  let p;
2070
- T === -1 ? p = f - 1n : (D === i ? p = Se(T + 1) : p = Se(T), p >= f && (p = f - 1n)), i <= 0 && (p = 0n), u && i >= l && (p = f - 1n);
2071
- const z = (L) => {
2072
- const F = Number(L);
2073
- if (!Number.isSafeInteger(F))
2071
+ M === -1 ? p = f - 1n : (_ === i ? p = Se(M + 1) : p = Se(M), p >= f && (p = f - 1n)), i <= 0 && (p = 0n), u && i >= l && (p = f - 1n);
2072
+ const D = (z) => {
2073
+ const B = Number(z);
2074
+ if (!Number.isSafeInteger(B))
2074
2075
  return null;
2075
- const { cumulative: h } = s.prefixSum(F, { materializeOption: { materialize: !1 } });
2076
- if (!Number.isFinite(h))
2076
+ const { cumulative: w } = s.prefixSum(B, { materializeOption: { materialize: !1 } });
2077
+ if (!Number.isFinite(w))
2077
2078
  return null;
2078
- const { index: $ } = s.findIndexAtOrAfter(h + 0.5, { materializeOption: { materialize: !1 } });
2079
- if ($ === -1)
2079
+ const { index: C } = s.findIndexAtOrAfter(w + 0.5, { materializeOption: { materialize: !1 } });
2080
+ if (C === -1)
2080
2081
  return null;
2081
- const q = Se($);
2082
- return q > L ? q : null;
2083
- }, rt = (L) => {
2084
- let F = 0, h = L, $ = L, q = 0n, H = 0;
2085
- for (; h < f && F < t; ) {
2086
- const O = Number(h), K = n(O);
2087
- if (F += K, $ = h, h += 1n, q += 1n, !Number.isFinite(K) || K < 0)
2082
+ const U = Se(C);
2083
+ return U > z ? U : null;
2084
+ }, J = (z) => {
2085
+ let B = 0, w = z, C = z, U = 0n, H = 0;
2086
+ for (; w < f && B < t; ) {
2087
+ const tt = Number(w), L = n(tt);
2088
+ if (B += L, C = w, w += 1n, U += 1n, !Number.isFinite(L) || L < 0)
2088
2089
  break;
2089
- if (K === 0) {
2090
- if (H += 1, H > Ee) {
2091
- const S = z($);
2092
- if (S !== null && S > h)
2093
- h = S, H = 0;
2094
- else if (S !== null && S === h && n(Number(h)) > 0)
2090
+ if (L === 0) {
2091
+ if (H += 1, H > Ne) {
2092
+ const b = D(C);
2093
+ if (b !== null && b > w)
2094
+ w = b, H = 0;
2095
+ else if (b !== null && b === w && n(Number(w)) > 0)
2095
2096
  H = 0;
2096
2097
  else
2097
2098
  break;
@@ -2099,45 +2100,45 @@ const Pr = 1e4, Lr = () => {
2099
2100
  } else
2100
2101
  H = 0;
2101
2102
  }
2102
- return q === 0n && ($ = L), { height: F, end: $ };
2103
+ return U === 0n && (C = z), { height: B, end: C };
2103
2104
  };
2104
- let { height: W, end: ot } = rt(p);
2105
- if (W < t && p > 0n) {
2106
- let L = p, F = W, h = 0;
2107
- for (; L > 0n && F < t; ) {
2108
- L -= 1n;
2109
- const q = Number(L), H = n(q);
2110
- if (F += H, !Number.isFinite(H) || H < 0)
2105
+ let { height: G, end: rt } = J(p);
2106
+ if (G < t && p > 0n) {
2107
+ let z = p, B = G, w = 0;
2108
+ for (; z > 0n && B < t; ) {
2109
+ z -= 1n;
2110
+ const U = Number(z), H = n(U);
2111
+ if (B += H, !Number.isFinite(H) || H < 0)
2111
2112
  break;
2112
2113
  if (H === 0) {
2113
- if (h += 1, h > Ee) {
2114
- const O = Number(L);
2115
- if (!Number.isSafeInteger(O))
2114
+ if (w += 1, w > Ne) {
2115
+ const tt = Number(z);
2116
+ if (!Number.isSafeInteger(tt))
2116
2117
  break;
2117
- const { cumulative: K } = s.prefixSum(O, { materializeOption: { materialize: !1 } });
2118
- if (!Number.isFinite(K))
2118
+ const { cumulative: L } = s.prefixSum(tt, { materializeOption: { materialize: !1 } });
2119
+ if (!Number.isFinite(L))
2119
2120
  break;
2120
- const { index: S } = s.findIndexAtOrAfter(K - 0.5, { materializeOption: { materialize: !1 } }), U = S === -1 ? -1n : Se(S);
2121
- if (U >= 0n && U < L)
2122
- L = U + 1n, h = 0;
2123
- else if (U === L && L >= 1n && n(Number(L - 1n)) > 0)
2124
- h = 0;
2121
+ const { index: b } = s.findIndexAtOrAfter(L - 0.5, { materializeOption: { materialize: !1 } }), K = b === -1 ? -1n : Se(b);
2122
+ if (K >= 0n && K < z)
2123
+ z = K + 1n, w = 0;
2124
+ else if (K === z && z >= 1n && n(Number(z - 1n)) > 0)
2125
+ w = 0;
2125
2126
  else
2126
2127
  break;
2127
2128
  }
2128
2129
  } else
2129
- h = 0;
2130
+ w = 0;
2130
2131
  }
2131
- p = I(L);
2132
- const $ = rt(p);
2133
- W = $.height, ot = $.end;
2132
+ p = x(z);
2133
+ const C = J(p);
2134
+ G = C.height, rt = C.end;
2134
2135
  }
2135
- const nt = I(p), ft = I(ot), St = I(nt - BigInt(Math.max(0, e))), wt = I(ft + BigInt(Math.max(0, e)));
2136
+ const nt = x(p), st = x(rt), wt = x(nt - BigInt(Math.max(0, e))), Vt = x(st + BigInt(Math.max(0, e)));
2136
2137
  return {
2137
- renderingStartIndex: dt(Number(St), r),
2138
- renderingEndIndex: dt(Number(wt), r),
2138
+ renderingStartIndex: dt(Number(wt), r),
2139
+ renderingEndIndex: dt(Number(Vt), r),
2139
2140
  visibleStartIndex: dt(Number(nt), r),
2140
- visibleEndIndex: dt(Number(ft), r)
2141
+ visibleEndIndex: dt(Number(st), r)
2141
2142
  };
2142
2143
  }, Rr = (i, t, e, r, n, s, l) => {
2143
2144
  if (r === 0)
@@ -2145,78 +2146,78 @@ const Pr = 1e4, Lr = () => {
2145
2146
  const u = Number.isFinite(l), f = u ? Math.min(Math.max(0, i), l) : Math.max(0, i);
2146
2147
  if (r >= Number.MAX_SAFE_INTEGER)
2147
2148
  return wr(f, t, e, r, n, s, l, u);
2148
- const { index: I, cumulative: v, currentValue: T } = s.findIndexAtOrAfter(f, { materializeOption: { materialize: !1 } }), D = I === -1 ? t <= 0 || (v ?? 0) < f + (T ?? 0) ? r - 1 : 0 : I;
2149
- let p = dt(D, r), z = 0;
2150
- if (I !== -1 && v === f)
2151
- p = dt(I + 1, r), z = 0;
2152
- else if (p === I && v !== void 0 && T !== void 0)
2153
- z = v - T - f;
2149
+ const { index: x, cumulative: I, currentValue: M } = s.findIndexAtOrAfter(f, { materializeOption: { materialize: !1 } }), _ = x === -1 ? t <= 0 || (I ?? 0) < f + (M ?? 0) ? r - 1 : 0 : x;
2150
+ let p = dt(_, r), D = 0;
2151
+ if (x !== -1 && I === f)
2152
+ p = dt(x + 1, r), D = 0;
2153
+ else if (p === x && I !== void 0 && M !== void 0)
2154
+ D = I - M - f;
2154
2155
  else {
2155
- const { cumulative: L, currentValue: F } = s.prefixSum(p, { materializeOption: { materialize: !1 } });
2156
- z = (L ?? 0) - (F ?? 0) - f;
2156
+ const { cumulative: z, currentValue: B } = s.prefixSum(p, { materializeOption: { materialize: !1 } });
2157
+ D = (z ?? 0) - (B ?? 0) - f;
2157
2158
  }
2158
- const rt = z, W = (L, F) => {
2159
- let h = L, $ = F, q = 0;
2160
- for (; h < r && $ < t; ) {
2161
- const H = n(h);
2162
- if ($ += H, h++, !Number.isFinite(H) || H < 0)
2159
+ const J = D, G = (z, B) => {
2160
+ let w = z, C = B, U = 0;
2161
+ for (; w < r && C < t; ) {
2162
+ const H = n(w);
2163
+ if (C += H, w++, !Number.isFinite(H) || H < 0)
2163
2164
  break;
2164
2165
  if (H === 0) {
2165
- if (q++, q > Ee) {
2166
- const { cumulative: O } = s.prefixSum(h - 1, { materializeOption: { materialize: !1 } }), { index: K } = Number.isFinite(O) ? s.findIndexAtOrAfter(O + 0.5, { materializeOption: { materialize: !1 } }) : { index: -1 };
2167
- if (K > h)
2168
- h = K, q = 0;
2169
- else if (K === h && n(h) > 0)
2170
- q = 0;
2166
+ if (U++, U > Ne) {
2167
+ const { cumulative: tt } = s.prefixSum(w - 1, { materializeOption: { materialize: !1 } }), { index: L } = Number.isFinite(tt) ? s.findIndexAtOrAfter(tt + 0.5, { materializeOption: { materialize: !1 } }) : { index: -1 };
2168
+ if (L > w)
2169
+ w = L, U = 0;
2170
+ else if (L === w && n(w) > 0)
2171
+ U = 0;
2171
2172
  else
2172
2173
  break;
2173
2174
  }
2174
2175
  } else
2175
- q = 0;
2176
+ U = 0;
2176
2177
  }
2177
- return { cursor: h, height: $ };
2178
- }, ot = W(p, z);
2179
- let nt = ot.cursor;
2180
- if (z = ot.height, z < t && p > 0) {
2181
- let L = z + Math.abs(Math.min(0, rt)), F = p - 1, h = 0;
2182
- for (; F >= 0 && L < t; ) {
2183
- const q = n(F);
2184
- if (L += q, !Number.isFinite(q) || q < 0) {
2185
- F--;
2178
+ return { cursor: w, height: C };
2179
+ }, rt = G(p, D);
2180
+ let nt = rt.cursor;
2181
+ if (D = rt.height, D < t && p > 0) {
2182
+ let z = D + Math.abs(Math.min(0, J)), B = p - 1, w = 0;
2183
+ for (; B >= 0 && z < t; ) {
2184
+ const U = n(B);
2185
+ if (z += U, !Number.isFinite(U) || U < 0) {
2186
+ B--;
2186
2187
  break;
2187
2188
  }
2188
- if (q === 0) {
2189
- if (h++, h > Ee) {
2190
- const { cumulative: H } = s.prefixSum(F, { materializeOption: { materialize: !1 } }), { index: O } = Number.isFinite(H) ? s.findIndexAtOrAfter(H - 0.5, { materializeOption: { materialize: !1 } }) : { index: -1 };
2191
- if (O !== -1 && O < F) {
2192
- F = O, h = 0;
2189
+ if (U === 0) {
2190
+ if (w++, w > Ne) {
2191
+ const { cumulative: H } = s.prefixSum(B, { materializeOption: { materialize: !1 } }), { index: tt } = Number.isFinite(H) ? s.findIndexAtOrAfter(H - 0.5, { materializeOption: { materialize: !1 } }) : { index: -1 };
2192
+ if (tt !== -1 && tt < B) {
2193
+ B = tt, w = 0;
2193
2194
  continue;
2194
2195
  }
2195
- if (O === F && F >= 1 && n(F - 1) > 0)
2196
- h = 0;
2196
+ if (tt === B && B >= 1 && n(B - 1) > 0)
2197
+ w = 0;
2197
2198
  else {
2198
- F--;
2199
+ B--;
2199
2200
  break;
2200
2201
  }
2201
2202
  }
2202
2203
  } else
2203
- h = 0;
2204
- F--;
2204
+ w = 0;
2205
+ B--;
2205
2206
  }
2206
- p = dt(F + 1, r);
2207
- const $ = W(p, 0);
2208
- nt = $.cursor, z = $.height;
2207
+ p = dt(B + 1, r);
2208
+ const C = G(p, 0);
2209
+ nt = C.cursor, D = C.height;
2209
2210
  }
2210
- const ft = dt(p - e, r), St = dt(Math.max(nt - 1, p), r), wt = dt(St + e, r);
2211
- return { renderingStartIndex: ft, renderingEndIndex: wt, visibleStartIndex: p, visibleEndIndex: St };
2211
+ const st = dt(p - e, r), wt = dt(Math.max(nt - 1, p), r), Vt = dt(wt + e, r);
2212
+ return { renderingStartIndex: st, renderingEndIndex: Vt, visibleStartIndex: p, visibleEndIndex: wt };
2212
2213
  }, Ue = (i, t, e) => {
2213
- const r = Math.max(0, t ?? 0), n = b({ last: 0, id: null, arg: null }).current;
2214
+ const r = Math.max(0, t ?? 0), n = g({ last: 0, id: null, arg: null }).current;
2214
2215
  return X(
2215
2216
  () => () => {
2216
2217
  n.id !== null && (cancelAnimationFrame(n.id), n.id = null);
2217
2218
  },
2218
2219
  [n]
2219
- ), y(
2220
+ ), S(
2220
2221
  (s) => {
2221
2222
  if (n.arg = s, n.id !== null) return;
2222
2223
  const l = (u) => {
@@ -2226,8 +2227,8 @@ const Pr = 1e4, Lr = () => {
2226
2227
  if (i.current)
2227
2228
  try {
2228
2229
  e(i.current, n.arg);
2229
- } catch (I) {
2230
- console.error("[useThrottledInvoker] Error invoking callback", I);
2230
+ } catch (x) {
2231
+ console.error("[useThrottledInvoker] Error invoking callback", x);
2231
2232
  }
2232
2233
  n.arg = null, n.last = u;
2233
2234
  }
@@ -2237,14 +2238,14 @@ const Pr = 1e4, Lr = () => {
2237
2238
  },
2238
2239
  [r, e, i, n]
2239
2240
  );
2240
- }, Cr = Qe.memo(({ index: i, top: t, height: e, item: r, children: n, clipItemHeight: s, enableKeyboardNavigation: l, onKeyDown: u, onFocus: f, registerItemRef: I }) => {
2241
- const v = y((z) => I(i, z), [i, I]), T = y((z) => u(z, i), [i, u]), D = y(() => f(i), [i, f]), p = y((z) => {
2242
- z.currentTarget.focus({ preventScroll: !0 });
2241
+ }, Cr = Qe.memo(({ index: i, top: t, height: e, item: r, children: n, clipItemHeight: s, enableKeyboardNavigation: l, onKeyDown: u, onFocus: f, registerItemRef: x }) => {
2242
+ const I = S((D) => x(i, D), [i, x]), M = S((D) => u(D, i), [i, u]), _ = S(() => f(i), [i, f]), p = S((D) => {
2243
+ D.currentTarget.focus({ preventScroll: !0 });
2243
2244
  }, []);
2244
- return /* @__PURE__ */ et(
2245
+ return /* @__PURE__ */ Q(
2245
2246
  "div",
2246
2247
  {
2247
- ref: v,
2248
+ ref: I,
2248
2249
  "data-index": i,
2249
2250
  "data-virtualscroll-item": "true",
2250
2251
  className: "aqvs-item-container",
@@ -2255,8 +2256,8 @@ const Pr = 1e4, Lr = () => {
2255
2256
  },
2256
2257
  tabIndex: l ? -1 : void 0,
2257
2258
  onPointerDown: l ? p : void 0,
2258
- onKeyDownCapture: l ? T : void 0,
2259
- onFocusCapture: l ? D : void 0,
2259
+ onKeyDownCapture: l ? M : void 0,
2260
+ onFocusCapture: l ? _ : void 0,
2260
2261
  children: n(r, i)
2261
2262
  }
2262
2263
  );
@@ -2268,302 +2269,303 @@ const Pr = 1e4, Lr = () => {
2268
2269
  viewportSize: n,
2269
2270
  overscanCount: s = 15,
2270
2271
  className: l,
2271
- onScroll: u,
2272
- onRangeChange: f,
2272
+ testId: u,
2273
+ onScroll: f,
2274
+ onRangeChange: x,
2273
2275
  children: I,
2274
- background: v,
2275
- initialScrollIndex: T,
2276
- initialScrollOffset: D,
2277
- callbackThrottleMs: p = 5,
2278
- contentInsets: z,
2279
- onItemFocus: rt,
2280
- scrollBarOptions: W,
2281
- behaviorOptions: ot,
2282
- onWheelHorizontal: nt
2283
- }, ft) => {
2284
- const { width: St, enableThumbDrag: wt, enableTrackClick: L, enableArrowButtons: F, enableScrollToTopBottomButtons: h, renderThumbOverlay: $, tapScrollCircleOptions: q } = W ?? {}, { enablePointerDrag: H, enableKeyboardNavigation: O = !0, wheelSpeedMultiplier: K, inertiaOptions: S, clipItemHeight: U = !1, resetOnGetItemHeightChange: j = !1 } = ot ?? {}, k = b(null), G = b({
2276
+ background: M,
2277
+ initialScrollIndex: _,
2278
+ initialScrollOffset: p,
2279
+ callbackThrottleMs: D = 5,
2280
+ contentInsets: J,
2281
+ onItemFocus: G,
2282
+ scrollBarOptions: rt,
2283
+ behaviorOptions: nt,
2284
+ onWheelHorizontal: st
2285
+ }, wt) => {
2286
+ const { width: Vt, enableThumbDrag: z, enableTrackClick: B, enableArrowButtons: w, enableScrollToTopBottomButtons: C, renderThumbOverlay: U, tapScrollCircleOptions: H } = rt ?? {}, { enablePointerDrag: tt, enableKeyboardNavigation: L = !0, wheelSpeedMultiplier: b, inertiaOptions: K, clipItemHeight: ft = !1, resetOnGetItemHeightChange: et = !1 } = nt ?? {}, Y = g(null), W = g({
2285
2287
  renderingStartIndex: 0,
2286
2288
  renderingEndIndex: 0,
2287
2289
  visibleStartIndex: 0,
2288
2290
  visibleEndIndex: 0,
2289
2291
  scrollPosition: 0,
2290
2292
  totalHeight: 0
2291
- }), st = b(null), Mt = b(!1);
2293
+ }), bt = g(null), St = g(!1);
2292
2294
  X(() => {
2293
- j && (st.current = null);
2294
- }, [j, r]);
2295
- const R = yt(() => Xe(z), [z]), [Dt] = Ut(() => {
2296
- const c = typeof T == "number" && Number.isFinite(T) ? Math.max(0, Math.trunc(T)) : 0;
2295
+ et && (bt.current = null);
2296
+ }, [et, r]);
2297
+ const R = Nt(() => Xe(J), [J]), [Ft] = jt(() => {
2298
+ const c = typeof _ == "number" && Number.isFinite(_) ? Math.max(0, Math.trunc(_)) : 0;
2297
2299
  return { from: Math.max(0, c - 50), to: c + 50 };
2298
- }), Vt = yt(
2300
+ }), Lt = Nt(
2299
2301
  // 目的: Fenwick Tree のオプション設定
2300
2302
  // 依存関係: resetOnGetItemHeightChange, initialSampleRange (マウント時固定)
2301
2303
  // itemCount には依存させない (依存させると追記のたびに options 参照が変わり、計測済み高さが全消去される)。
2302
2304
  // この useMemo により sampleRange を毎レンダー新規生成しない = 参照同一性由来の破壊的 reset を防ぐ。
2303
2305
  () => ({
2304
- sampleRange: Dt,
2305
- resetOnValueFnChange: j,
2306
+ sampleRange: Ft,
2307
+ resetOnValueFnChange: et,
2306
2308
  materialize: !0
2307
2309
  }),
2308
- [j, Dt]
2309
- ), x = Tr(i, r, Vt), [Rt] = Ut(() => {
2310
+ [et, Ft]
2311
+ ), v = Tr(i, r, Lt), [zt] = jt(() => {
2310
2312
  let o = R.top, c = 0;
2311
- if (typeof T == "number") {
2312
- const d = mt(T, 0, i - 1), P = mt(d - s * 2, 0, i - 1), N = mt(d + s * 2, 0, i - 1), _ = T > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: P, to: N }] } } : void 0, { cumulative: A, total: B, currentValue: gt } = x.prefixSum(T, _), tt = Math.max(A - gt, 0);
2313
- o = me(tt, R.top), c = B ?? x.getTotal();
2314
- } else typeof D == "number" && (o = me(Math.max(D, 0), R.top)), c = x.getTotal();
2313
+ if (typeof _ == "number") {
2314
+ const d = gt(_, 0, i - 1), y = gt(d - s * 2, 0, i - 1), k = gt(d + s * 2, 0, i - 1), E = _ > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: y, to: k }] } } : void 0, { cumulative: q, total: $, currentValue: at } = v.prefixSum(_, E), Z = Math.max(q - at, 0);
2315
+ o = ge(Z, R.top), c = $ ?? v.getTotal();
2316
+ } else typeof p == "number" && (o = ge(Math.max(p, 0), R.top)), c = v.getTotal();
2315
2317
  return { position: o, total: c };
2316
- }), [At, qt] = Ut(Rt.position), [M, Y] = Ut(Rt.total), C = b(Rt.position), ct = b(R.top), at = b(u ?? void 0), pt = b(f ?? void 0), ht = b(/* @__PURE__ */ new Map()), J = b(null), Ct = b(null), [ut, Kt] = Ut(null), [Lt, xt] = Ut(!1), _t = b(null), Ot = b(!1), It = b(0), Et = b(!1), m = b(!1), E = b(i);
2317
- E.current !== i && (E.current = i, m.current = !0), X(() => {
2318
- at.current = u ?? void 0, pt.current = f ?? void 0;
2319
- }, [f, u]);
2320
- const lt = y(
2318
+ }), [_t, Gt] = jt(zt.position), [T, O] = jt(zt.total), A = g(zt.position), mt = g(R.top), lt = g(f ?? void 0), ct = g(x ?? void 0), Mt = g(/* @__PURE__ */ new Map()), j = g(null), At = g(null), [pt, Zt] = jt(null), [Ot, Rt] = jt(!1), Ct = g(null), Xt = g(!1), ut = g(0), xt = g(!1), m = g(!1), V = g(i);
2319
+ V.current !== i && (V.current = i, m.current = !0), X(() => {
2320
+ lt.current = f ?? void 0, ct.current = x ?? void 0;
2321
+ }, [x, f]);
2322
+ const It = S(
2321
2323
  (o) => {
2322
- if (O && o && typeof o.focus == "function")
2324
+ if (L && o && typeof o.focus == "function")
2323
2325
  try {
2324
2326
  o.focus({ preventScroll: !0 });
2325
2327
  } catch {
2326
2328
  o.focus();
2327
2329
  }
2328
2330
  },
2329
- [O]
2330
- ), zt = y((o, { position: c, totalHeight: d }) => {
2331
+ [L]
2332
+ ), vt = S((o, { position: c, totalHeight: d }) => {
2331
2333
  o(c, d);
2332
- }, []), Z = Ue(at, p, zt), re = y((o, c) => {
2334
+ }, []), ht = Ue(lt, D, vt), se = S((o, c) => {
2333
2335
  o(c);
2334
- }, []), Ht = Ue(pt, p, re), Nt = b(R.top);
2335
- Nt.current = R.top;
2336
- const Wt = b(Z);
2337
- Wt.current = Z, X(() => (Mt.current = !1, () => {
2338
- Mt.current = !0, _t.current && (clearTimeout(_t.current), _t.current = null);
2336
+ }, []), Et = Ue(ct, D, se), $t = g(R.top);
2337
+ $t.current = R.top;
2338
+ const Ht = g(ht);
2339
+ Ht.current = ht, X(() => (St.current = !1, () => {
2340
+ St.current = !0, Ct.current && (clearTimeout(Ct.current), Ct.current = null);
2339
2341
  }), []), X(() => {
2340
- O || (ht.current.clear(), J.current = null, Ct.current = null);
2341
- }, [O]);
2342
- const jt = y(
2342
+ L || (Mt.current.clear(), j.current = null, At.current = null);
2343
+ }, [L]);
2344
+ const Dt = S(
2343
2345
  (o, c) => {
2344
2346
  if (!c) {
2345
- ht.current.delete(o);
2347
+ Mt.current.delete(o);
2346
2348
  return;
2347
2349
  }
2348
- O && (ht.current.set(o, c), J.current === o && (J.current = null, Ct.current = o, lt(c)));
2350
+ L && (Mt.current.set(o, c), j.current === o && (j.current = null, At.current = o, It(c)));
2349
2351
  },
2350
- [O, lt]
2351
- ), Ft = 0.01, Pt = b({
2352
+ [L, It]
2353
+ ), kt = 0.01, Ut = g({
2352
2354
  rafId: null,
2353
2355
  loopActive: !1,
2354
2356
  idleFrames: 0,
2355
- lastRenderedPosition: Rt.position
2356
- }), Gt = y(() => {
2357
- const o = Pt.current;
2357
+ lastRenderedPosition: zt.position
2358
+ }), ae = S(() => {
2359
+ const o = Ut.current;
2358
2360
  o.rafId !== null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(o.rafId), o.rafId = null, o.loopActive = !1, o.idleFrames = 0;
2359
2361
  }, []);
2360
2362
  X(
2361
2363
  () => () => {
2362
- Gt();
2364
+ ae();
2363
2365
  },
2364
- [Gt]
2366
+ [ae]
2365
2367
  );
2366
- const he = b(() => {
2367
- }), ge = y(() => {
2368
- const o = Pt.current;
2368
+ const Me = g(() => {
2369
+ }), de = S(() => {
2370
+ const o = Ut.current;
2369
2371
  o.rafId = null;
2370
- const c = C.current, d = ee(c, Nt.current), P = x.getTotal();
2371
- if (qt((_) => Math.abs(_ - c) < Ft ? _ : c), Math.abs(o.lastRenderedPosition - c) >= Ft ? (Wt.current({ position: d, totalHeight: P }), o.lastRenderedPosition = c, o.idleFrames = 0) : o.idleFrames += 1, o.idleFrames >= 2) {
2372
- Gt();
2372
+ const c = A.current, d = ee(c, $t.current), y = v.getTotal();
2373
+ if (Gt((E) => Math.abs(E - c) < kt ? E : c), Math.abs(o.lastRenderedPosition - c) >= kt ? (Ht.current({ position: d, totalHeight: y }), o.lastRenderedPosition = c, o.idleFrames = 0) : o.idleFrames += 1, o.idleFrames >= 2) {
2374
+ ae();
2373
2375
  return;
2374
2376
  }
2375
2377
  if (typeof requestAnimationFrame == "function") {
2376
- o.rafId = requestAnimationFrame((_) => he.current(_));
2378
+ o.rafId = requestAnimationFrame((E) => Me.current(E));
2377
2379
  return;
2378
2380
  }
2379
2381
  o.loopActive = !1;
2380
- }, [x, Gt]);
2381
- he.current = ge;
2382
- const be = y(() => {
2383
- const o = Pt.current;
2382
+ }, [v, ae]);
2383
+ Me.current = de;
2384
+ const xe = S(() => {
2385
+ const o = Ut.current;
2384
2386
  if (o.idleFrames = 0, !o.loopActive) {
2385
2387
  if (o.loopActive = !0, typeof requestAnimationFrame == "function") {
2386
- o.rafId = requestAnimationFrame(ge);
2388
+ o.rafId = requestAnimationFrame(de);
2387
2389
  return;
2388
2390
  }
2389
2391
  o.loopActive = !1;
2390
2392
  }
2391
- }, [ge]), it = y(
2393
+ }, [de]), it = S(
2392
2394
  (o, c) => {
2393
- const d = c?.immediate ?? !1, P = ee(o, R.top);
2394
- if (C.current = o, d) {
2395
- Pt.current.lastRenderedPosition = o, Pt.current.idleFrames = 0, qt(o), Z({ position: P, totalHeight: x.getTotal() });
2395
+ const d = c?.immediate ?? !1, y = ee(o, R.top);
2396
+ if (A.current = o, d) {
2397
+ Ut.current.lastRenderedPosition = o, Ut.current.idleFrames = 0, Gt(o), ht({ position: y, totalHeight: v.getTotal() });
2396
2398
  return;
2397
2399
  }
2398
- be();
2400
+ xe();
2399
2401
  },
2400
- [be, x, R.top, Z]
2401
- ), Zt = y((o) => {
2402
- const c = k.current;
2402
+ [xe, v, R.top, ht]
2403
+ ), Yt = S((o) => {
2404
+ const c = Y.current;
2403
2405
  if (!c)
2404
2406
  return o;
2405
2407
  const d = c.getScrollPosition();
2406
- It.current += 1;
2407
- const P = c.scrollTo(o);
2408
- return P === d && (It.current = Math.max(0, It.current - 1)), Math.abs(P - o) > 0.5 && (Et.current = !0), P;
2409
- }, []), ne = b(!1);
2408
+ ut.current += 1;
2409
+ const y = c.scrollTo(o);
2410
+ return y === d && (ut.current = Math.max(0, ut.current - 1)), Math.abs(y - o) > 0.5 && (xt.current = !0), y;
2411
+ }, []), Kt = g(!1);
2410
2412
  X(() => {
2411
- if (!ne.current)
2412
- if (ne.current = !0, typeof D == "number") {
2413
- const o = me(Math.max(D, 0), R.top), c = Math.abs(o - C.current) > 0.5;
2414
- it(o, { immediate: !0 }), c && k.current?.scrollTo(o);
2413
+ if (!Kt.current)
2414
+ if (Kt.current = !0, typeof p == "number") {
2415
+ const o = ge(Math.max(p, 0), R.top), c = Math.abs(o - A.current) > 0.5;
2416
+ it(o, { immediate: !0 }), c && Y.current?.scrollTo(o);
2415
2417
  } else
2416
- it(C.current, { immediate: !0 });
2417
- }, [D, R.top, it]), X(() => {
2418
- const o = x.getTotal();
2419
- if (M !== o) {
2420
- Y(o);
2418
+ it(A.current, { immediate: !0 });
2419
+ }, [p, R.top, it]), X(() => {
2420
+ const o = v.getTotal();
2421
+ if (T !== o) {
2422
+ O(o);
2421
2423
  return;
2422
2424
  }
2423
- if (Et.current) {
2424
- Et.current = !1;
2425
- const c = k.current;
2426
- if (c && Math.abs(c.getScrollPosition() - C.current) > 0.5) {
2427
- const d = Zt(C.current);
2428
- Et.current = !1, it(d, { immediate: !0 });
2425
+ if (xt.current) {
2426
+ xt.current = !1;
2427
+ const c = Y.current;
2428
+ if (c && Math.abs(c.getScrollPosition() - A.current) > 0.5) {
2429
+ const d = Yt(A.current);
2430
+ xt.current = !1, it(d, { immediate: !0 });
2429
2431
  }
2430
2432
  }
2431
- }, [x, M, i, Zt, it]), X(() => {
2432
- if (st.current !== null) {
2433
- const { index: o, align: c, offset: d } = st.current, P = dt(o, i), { cumulative: N, currentValue: _ } = x.prefixSum(P, { materializeOption: { materialize: !1 } });
2434
- if (N !== void 0 && _ !== void 0) {
2435
- const A = Math.max(N - _, 0);
2436
- let B = A;
2437
- c === "bottom" ? B = N - n : c === "center" && (B = A + _ / 2 - n / 2), d && (B -= d), B = Math.max(0, B);
2438
- const gt = Math.max(0, M + R.top + R.bottom - n), tt = Math.min(me(B, R.top), gt);
2439
- Math.abs(tt - C.current) > 1 && (V.debug("[VirtualScroll] Drift correction", {
2440
- from: C.current,
2441
- to: tt,
2442
- targetIndex: P
2443
- }), It.current === 0 && (It.current += 1), k.current?.scrollTo(tt), it(tt, { immediate: !0 }));
2433
+ }, [v, T, i, Yt, it]), X(() => {
2434
+ if (bt.current !== null) {
2435
+ const { index: o, align: c, offset: d } = bt.current, y = dt(o, i), { cumulative: k, currentValue: E } = v.prefixSum(y, { materializeOption: { materialize: !1 } });
2436
+ if (k !== void 0 && E !== void 0) {
2437
+ const q = Math.max(k - E, 0);
2438
+ let $ = q;
2439
+ c === "bottom" ? $ = k - n : c === "center" && ($ = q + E / 2 - n / 2), d && ($ -= d), $ = Math.max(0, $);
2440
+ const at = Math.max(0, T + R.top + R.bottom - n), Z = Math.min(ge($, R.top), at);
2441
+ Math.abs(Z - A.current) > 1 && (N.debug("[VirtualScroll] Drift correction", {
2442
+ from: A.current,
2443
+ to: Z,
2444
+ targetIndex: y
2445
+ }), ut.current === 0 && (ut.current += 1), Y.current?.scrollTo(Z), it(Z, { immediate: !0 }));
2444
2446
  }
2445
2447
  }
2446
2448
  m.current = !1;
2447
- }, [M, x, i, R.top, it, n, R.bottom]), X(() => {
2448
- const o = ct.current;
2449
+ }, [T, v, i, R.top, it, n, R.bottom]), X(() => {
2450
+ const o = mt.current;
2449
2451
  if (o === R.top) return;
2450
- const c = ee(C.current, o), d = me(c, R.top);
2451
- ct.current = R.top, C.current = d, k.current?.scrollTo(d), it(d, { immediate: !0 });
2452
+ const c = ee(A.current, o), d = ge(c, R.top);
2453
+ mt.current = R.top, A.current = d, Y.current?.scrollTo(d), it(d, { immediate: !0 });
2452
2454
  }, [R.top, it]);
2453
- const Xt = y(
2455
+ const Ie = S(
2454
2456
  (o, c) => {
2455
2457
  if (i === 0)
2456
2458
  return;
2457
- const d = dt(o, i), P = x.get(d), N = c - P, _ = x.update(d, c);
2458
- _ !== void 0 && Y(_), V.debug("[VirtualScroll] Updated item size manually", { index: d, size: c, total: _ });
2459
- let A = st.current ? st.current.index : null;
2460
- if (A === null) {
2461
- const B = C.current, gt = Xe(z).top, tt = ee(B, gt), { index: Q, cumulative: vt } = x.findIndexAtOrAfter(tt, { materializeOption: { materialize: !1 } });
2462
- A = vt !== void 0 && vt === tt ? Q + 1 : Q;
2459
+ const d = dt(o, i), y = v.get(d), k = c - y, E = v.update(d, c);
2460
+ E !== void 0 && O(E), N.debug("[VirtualScroll] Updated item size manually", { index: d, size: c, total: E });
2461
+ let q = bt.current ? bt.current.index : null;
2462
+ if (q === null) {
2463
+ const $ = A.current, at = Xe(J).top, Z = ee($, at), { index: ot, cumulative: Pt } = v.findIndexAtOrAfter(Z, { materializeOption: { materialize: !1 } });
2464
+ q = Pt !== void 0 && Pt === Z ? ot + 1 : ot;
2463
2465
  }
2464
- if (A !== -1 && d < A && N !== 0) {
2465
- const B = C.current, gt = B + N;
2466
- Zt(gt), it(gt, { immediate: !0 }), V.debug("[VirtualScroll] Adjusted scroll for layout shift (manual update)", { from: B, to: gt, causedByIndex: d, delta: N, activeVisibleStartIndex: A });
2466
+ if (q !== -1 && d < q && k !== 0) {
2467
+ const $ = A.current, at = $ + k;
2468
+ Yt(at), it(at, { immediate: !0 }), N.debug("[VirtualScroll] Adjusted scroll for layout shift (manual update)", { from: $, to: at, causedByIndex: d, delta: k, activeVisibleStartIndex: q });
2467
2469
  }
2468
2470
  },
2469
- [x, i, Zt, it, z]
2470
- ), kt = y(
2471
+ [v, i, Yt, it, J]
2472
+ ), Bt = S(
2471
2473
  (o, c) => {
2472
- if (!k.current || i === 0)
2474
+ if (!Y.current || i === 0)
2473
2475
  return;
2474
- const d = dt(o, i), P = dt(d - s * 2, i), N = dt(d + s * 2, i), { cumulative: _, total: A, currentValue: B } = x.prefixSum(d, { materializeOption: { materialize: !0, ranges: [{ from: P, to: N }] } });
2475
- if (V.debug("[VirtualScroll] Scrolling to index:", d, "ItemBottom:", _, "Total height:", A, "ItemHeight:", B, "safeIndexFrom:", P, "safeIndexTo:", N), !A)
2476
+ const d = dt(o, i), y = dt(d - s * 2, i), k = dt(d + s * 2, i), { cumulative: E, total: q, currentValue: $ } = v.prefixSum(d, { materializeOption: { materialize: !0, ranges: [{ from: y, to: k }] } });
2477
+ if (N.debug("[VirtualScroll] Scrolling to index:", d, "ItemBottom:", E, "Total height:", q, "ItemHeight:", $, "safeIndexFrom:", y, "safeIndexTo:", k), !q)
2476
2478
  return;
2477
- const gt = Math.max(_ - B, 0);
2478
- let tt = gt;
2479
- c?.align === "bottom" ? tt = _ - n : c?.align === "center" && (tt = gt + B / 2 - n / 2), c?.offset && (tt -= c.offset), tt = Math.max(0, tt);
2480
- const Q = me(tt, R.top), vt = k.current?.getContentSize() ?? A + R.top + R.bottom, bt = Math.max(0, vt - n), Tt = Math.min(Q, bt);
2481
- st.current = {
2479
+ const at = Math.max(E - $, 0);
2480
+ let Z = at;
2481
+ c?.align === "bottom" ? Z = E - n : c?.align === "center" && (Z = at + $ / 2 - n / 2), c?.offset && (Z -= c.offset), Z = Math.max(0, Z);
2482
+ const ot = ge(Z, R.top), Pt = Y.current?.getContentSize() ?? q + R.top + R.bottom, Tt = Math.max(0, Pt - n), yt = Math.min(ot, Tt);
2483
+ bt.current = {
2482
2484
  index: d,
2483
2485
  align: c?.align,
2484
2486
  offset: c?.offset
2485
2487
  };
2486
- const se = k.current?.getScrollPosition() ?? -1, ve = Math.abs(se - Tt) > 0.5;
2487
- Ot.current = !1, It.current = 0, ve && (Ot.current = !0, It.current += 1, k.current?.scrollTo(Tt)), Y(A), it(Tt, { immediate: !0 }), V.debug("[VirtualScroll] Setting scroll position to:", Tt, { original: Q, max: bt });
2488
+ const le = Y.current?.getScrollPosition() ?? -1, ie = Math.abs(le - yt) > 0.5;
2489
+ Xt.current = !1, ut.current = 0, ie && (Xt.current = !0, ut.current += 1, Y.current?.scrollTo(yt)), O(q), it(yt, { immediate: !0 }), N.debug("[VirtualScroll] Setting scroll position to:", yt, { original: ot, max: Tt });
2488
2490
  },
2489
- [x, s, i, R.top, R.bottom, n, it]
2490
- ), xe = y(
2491
+ [v, s, i, R.top, R.bottom, n, it]
2492
+ ), Pe = S(
2491
2493
  (o) => {
2492
- if (!k.current || i === 0)
2494
+ if (!Y.current || i === 0)
2493
2495
  return;
2494
- const c = x.getTotal(), d = mt(Math.floor(o), 0, c), { index: P, cumulative: N, currentValue: _ } = x.findIndexAtOrAfter(d, { materializeOption: { materialize: !1 } }), B = (N ?? 0) - (_ ?? 0) - d;
2495
- kt(P, { offset: B });
2496
+ const c = v.getTotal(), d = gt(Math.floor(o), 0, c), { index: y, cumulative: k, currentValue: E } = v.findIndexAtOrAfter(d, { materializeOption: { materialize: !1 } }), $ = (k ?? 0) - (E ?? 0) - d;
2497
+ Bt(y, { offset: $ });
2496
2498
  },
2497
- [x, i, kt]
2498
- ), Me = y(
2499
+ [v, i, Bt]
2500
+ ), ye = S(
2499
2501
  (o) => {
2500
- const c = ee(C.current, R.top), d = typeof o == "function" ? o(c) : o;
2501
- xe(d);
2502
- const P = k.current?.getScrollPosition(), N = typeof P == "number" ? P : C.current;
2503
- return it(N), N;
2502
+ const c = ee(A.current, R.top), d = typeof o == "function" ? o(c) : o;
2503
+ Pe(d);
2504
+ const y = Y.current?.getScrollPosition(), k = typeof y == "number" ? y : A.current;
2505
+ return it(k), k;
2504
2506
  },
2505
- [R.top, xe, it]
2506
- ), Ne = y(
2507
+ [R.top, Pe, it]
2508
+ ), ve = S(
2507
2509
  (o, c) => {
2508
- V.debug("[VirtualScroll] Scroll position changed:", o);
2509
- const d = Ot.current;
2510
- d && (Ot.current = !1);
2511
- const P = It.current > 0;
2512
- if (P && (It.current = 0), d || P || m.current || (st.current = null), it(o), h) {
2513
- if (d || P)
2510
+ N.debug("[VirtualScroll] Scroll position changed:", o);
2511
+ const d = Xt.current;
2512
+ d && (Xt.current = !1);
2513
+ const y = ut.current > 0;
2514
+ if (y && (ut.current = 0), d || y || m.current || (bt.current = null), it(o), C) {
2515
+ if (d || y)
2514
2516
  return;
2515
- const N = o - c;
2516
- if (V.debug("[VirtualScroll] Scroll diff:", N, "New:", o, "Prev:", c), Math.abs(N) > 1) {
2517
- const _ = N > 0 ? "down" : "up";
2518
- Kt(_), xt(!0), V.debug("[VirtualScroll] Showing scroll buttons. Direction:", _), _t.current && clearTimeout(_t.current), _t.current = setTimeout(() => {
2519
- xt(!1), V.debug("[VirtualScroll] Hiding scroll buttons");
2517
+ const k = o - c;
2518
+ if (N.debug("[VirtualScroll] Scroll diff:", k, "New:", o, "Prev:", c), Math.abs(k) > 1) {
2519
+ const E = k > 0 ? "down" : "up";
2520
+ Zt(E), Rt(!0), N.debug("[VirtualScroll] Showing scroll buttons. Direction:", E), Ct.current && clearTimeout(Ct.current), Ct.current = setTimeout(() => {
2521
+ Rt(!1), N.debug("[VirtualScroll] Hiding scroll buttons");
2520
2522
  }, 2e3);
2521
2523
  }
2522
2524
  }
2523
2525
  },
2524
- [it, h]
2525
- ), Yt = yt(() => ee(At, R.top), [R.top, At]), ie = yt(() => {
2526
- const o = x.getTotal(), c = Rr(Yt, n, s, i, r, x, o);
2527
- return V.debug("[VirtualScroll] Calculated rendering range:", () => ({
2526
+ [it, C]
2527
+ ), Jt = Nt(() => ee(_t, R.top), [R.top, _t]), re = Nt(() => {
2528
+ const o = v.getTotal(), c = Rr(Jt, n, s, i, r, v, o);
2529
+ return N.debug("[VirtualScroll] Calculated rendering range:", () => ({
2528
2530
  ...c,
2529
- scrollPosition: Yt,
2531
+ scrollPosition: Jt,
2530
2532
  renderingContentSize: o,
2531
2533
  overscanCount: s,
2532
2534
  viewportSize: n
2533
2535
  })), c;
2534
- }, [Yt, n, s, i, r, x]), { renderingStartIndex: Jt, renderingEndIndex: Qt, visibleStartIndex: Bt, visibleEndIndex: ce } = ie, te = y(
2536
+ }, [Jt, n, s, i, r, v]), { renderingStartIndex: Qt, renderingEndIndex: qt, visibleStartIndex: ne, visibleEndIndex: fe } = re, te = S(
2535
2537
  (o, c) => {
2536
- if (!O || i === 0)
2538
+ if (!L || i === 0)
2537
2539
  return;
2538
2540
  const d = dt(o, i);
2539
2541
  if (!(c?.ensureVisible ?? !0)) {
2540
- const bt = ht.current.get(d);
2541
- bt && (J.current = null, Ct.current = d, lt(bt));
2542
+ const Tt = Mt.current.get(d);
2543
+ Tt && (j.current = null, At.current = d, It(Tt));
2542
2544
  return;
2543
2545
  }
2544
- const N = x.prefixSum(d, { materializeOption: { materialize: !1 } }), _ = N.currentValue, A = Math.max(N.cumulative - _, 0), B = A + _, gt = ee(C.current, R.top), tt = gt + n;
2545
- if (A < gt || B > tt) {
2546
- kt(d);
2547
- const bt = ht.current.get(d);
2548
- bt ? (J.current = null, Ct.current = d, lt(bt)) : J.current = d;
2546
+ const k = v.prefixSum(d, { materializeOption: { materialize: !1 } }), E = k.currentValue, q = Math.max(k.cumulative - E, 0), $ = q + E, at = ee(A.current, R.top), Z = at + n;
2547
+ if (q < at || $ > Z) {
2548
+ Bt(d);
2549
+ const Tt = Mt.current.get(d);
2550
+ Tt ? (j.current = null, At.current = d, It(Tt)) : j.current = d;
2549
2551
  return;
2550
2552
  }
2551
- const vt = ht.current.get(d);
2552
- if (vt) {
2553
- J.current = null, Ct.current = d, lt(vt);
2553
+ const Pt = Mt.current.get(d);
2554
+ if (Pt) {
2555
+ j.current = null, At.current = d, It(Pt);
2554
2556
  return;
2555
2557
  }
2556
- J.current = d;
2558
+ j.current = d;
2557
2559
  },
2558
- [O, i, x, R.top, kt, lt, n]
2559
- ), Pe = y(
2560
+ [L, i, v, R.top, Bt, It, n]
2561
+ ), we = S(
2560
2562
  (o, c) => {
2561
- if (!O || o.defaultPrevented || o.altKey || o.metaKey || o.ctrlKey)
2563
+ if (!L || o.defaultPrevented || o.altKey || o.metaKey || o.ctrlKey)
2562
2564
  return;
2563
2565
  const d = o.target;
2564
2566
  if (d) {
2565
- const P = d.tagName;
2566
- if (P === "INPUT" || P === "TEXTAREA" || P === "SELECT" || d.isContentEditable)
2567
+ const y = d.tagName;
2568
+ if (y === "INPUT" || y === "TEXTAREA" || y === "SELECT" || d.isContentEditable)
2567
2569
  return;
2568
2570
  }
2569
2571
  if (o.key === "ArrowDown") {
@@ -2577,239 +2579,240 @@ const Pr = 1e4, Lr = () => {
2577
2579
  if (o.key === "PageDown") {
2578
2580
  if (c < i - 1) {
2579
2581
  o.preventDefault();
2580
- const { visibleStartIndex: P, visibleEndIndex: N } = G.current, _ = Math.max(N - P + 1, 1), A = Math.max(_, 1), B = dt(Math.min(c + A, i - 1), i);
2581
- te(B);
2582
+ const { visibleStartIndex: y, visibleEndIndex: k } = W.current, E = Math.max(k - y + 1, 1), q = Math.max(E, 1), $ = dt(Math.min(c + q, i - 1), i);
2583
+ te($);
2582
2584
  }
2583
2585
  return;
2584
2586
  }
2585
2587
  if (o.key === "PageUp" && c > 0) {
2586
2588
  o.preventDefault();
2587
- const { visibleStartIndex: P, visibleEndIndex: N } = G.current, _ = Math.max(N - P + 1, 1), A = Math.max(_, 1), B = dt(c - A, i);
2588
- te(B);
2589
+ const { visibleStartIndex: y, visibleEndIndex: k } = W.current, E = Math.max(k - y + 1, 1), q = Math.max(E, 1), $ = dt(c - q, i);
2590
+ te($);
2589
2591
  }
2590
2592
  },
2591
- [O, i, te]
2592
- ), ye = y(
2593
+ [L, i, te]
2594
+ ), Re = S(
2593
2595
  (o) => {
2594
- if (!O)
2596
+ if (!L)
2595
2597
  return;
2596
2598
  const c = dt(o, i);
2597
- J.current = null, Ct.current = c, rt?.(c);
2599
+ j.current = null, At.current = c, G?.(c);
2598
2600
  },
2599
- [O, i, rt]
2601
+ [L, i, G]
2600
2602
  );
2601
2603
  X(() => {
2602
- const o = k.current?.getScrollPosition() ?? 0, c = C.current, d = ee(c, R.top);
2603
- V.debug("[VirtualScroll] Range change effect triggered", () => ({
2604
- renderingStartIndex: Jt,
2605
- renderingEndIndex: Qt,
2606
- visibleStartIndex: Bt,
2607
- visibleEndIndex: ce,
2608
- scrollPositionState: At,
2604
+ const o = Y.current?.getScrollPosition() ?? 0, c = A.current, d = ee(c, R.top);
2605
+ N.debug("[VirtualScroll] Range change effect triggered", () => ({
2606
+ renderingStartIndex: Qt,
2607
+ renderingEndIndex: qt,
2608
+ visibleStartIndex: ne,
2609
+ visibleEndIndex: fe,
2610
+ scrollPositionState: _t,
2609
2611
  paneScrollPosition: c,
2610
2612
  logicalScrollPosition: d,
2611
- contentSize: M,
2613
+ contentSize: T,
2612
2614
  scrollPaneScrollPosition: o
2613
- })), Ht({
2614
- renderingStartIndex: Jt,
2615
- renderingEndIndex: Qt,
2616
- visibleStartIndex: Bt,
2617
- visibleEndIndex: ce,
2615
+ })), Et({
2616
+ renderingStartIndex: Qt,
2617
+ renderingEndIndex: qt,
2618
+ visibleStartIndex: ne,
2619
+ visibleEndIndex: fe,
2618
2620
  scrollPosition: d,
2619
- totalHeight: M
2621
+ totalHeight: T
2620
2622
  });
2621
- }, [M, Qt, Jt, R.top, Ht, At, ce, Bt]);
2622
- const Ve = y(() => h ? /* @__PURE__ */ et("div", { className: "aqvs-scroll-to-edge-overlay", "data-visible": Lt && ut !== null, children: ut === "up" ? /* @__PURE__ */ et("div", { className: "aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-top", children: /* @__PURE__ */ et(
2623
+ }, [T, qt, Qt, R.top, Et, _t, fe, ne]);
2624
+ const Ve = S(() => C ? /* @__PURE__ */ Q("div", { className: "aqvs-scroll-to-edge-overlay", "data-visible": Ot && pt !== null, children: pt === "up" ? /* @__PURE__ */ Q("div", { className: "aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-top", children: /* @__PURE__ */ Q(
2623
2625
  "button",
2624
2626
  {
2625
2627
  type: "button",
2626
2628
  className: "aqvs-scroll-to-edge-button",
2627
2629
  onClick: (d) => {
2628
- d.stopPropagation(), Ot.current = !0, kt(0), xt(!1);
2630
+ d.stopPropagation(), Xt.current = !0, Bt(0), Rt(!1);
2629
2631
  },
2630
2632
  children: "Top"
2631
2633
  }
2632
- ) }) : /* @__PURE__ */ et("div", { className: "aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-bottom", children: /* @__PURE__ */ et(
2634
+ ) }) : /* @__PURE__ */ Q("div", { className: "aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-bottom", children: /* @__PURE__ */ Q(
2633
2635
  "button",
2634
2636
  {
2635
2637
  type: "button",
2636
2638
  className: "aqvs-scroll-to-edge-button",
2637
2639
  onClick: (d) => {
2638
- d.stopPropagation(), Ot.current = !0, kt(i - 1), xt(!1);
2640
+ d.stopPropagation(), Xt.current = !0, Bt(i - 1), Rt(!1);
2639
2641
  },
2640
2642
  children: "Bottom"
2641
2643
  }
2642
- ) }) }) : null, [h, Lt, ut, kt, i]), Ie = b(0), { visibleItems: ue, renderAnchor: de } = yt(() => {
2644
+ ) }) }) : null, [C, Ot, pt, Bt, i]), me = g(0), { visibleItems: pe, renderAnchor: a } = Nt(() => {
2643
2645
  if (i === 0)
2644
2646
  return {
2645
- visibleItems: /* @__PURE__ */ et("div", { className: "aqvs-no-items-container", children: /* @__PURE__ */ et("div", { className: "aqvs-no-items-text", children: "No items" }) }),
2647
+ visibleItems: /* @__PURE__ */ Q("div", { className: "aqvs-no-items-container", children: /* @__PURE__ */ Q("div", { className: "aqvs-no-items-text", children: "No items" }) }),
2646
2648
  renderAnchor: 0
2647
2649
  };
2648
- const o = dt(Jt, i), c = dt(Qt, i), { cumulative: d, currentValue: P } = x.prefixSum(o, { materializeOption: { materialize: !1 } }), N = d - P;
2649
- Number.isFinite(N) && Math.abs(N - Ie.current) > yr && (Ie.current = N);
2650
- const _ = Ie.current, A = [], B = [];
2651
- let gt = 0, tt = N;
2652
- for (let Q = o; Q <= c; Q++) {
2653
- if (B.length >= $e) {
2654
- V.warn("[VirtualScroll] Rendered item count reached the safety cap; truncating render window.", { cap: $e, safeRenderingStartIndex: o, safeRenderingEndIndex: c });
2650
+ const o = dt(Qt, i), c = dt(qt, i), { cumulative: d, currentValue: y } = v.prefixSum(o, { materializeOption: { materialize: !1 } }), k = d - y;
2651
+ Number.isFinite(k) && Math.abs(k - me.current) > yr && (me.current = k);
2652
+ const E = me.current, q = [], $ = [];
2653
+ let at = 0, Z = k;
2654
+ for (let ot = o; ot <= c; ot++) {
2655
+ if ($.length >= $e) {
2656
+ N.warn("[VirtualScroll] Rendered item count reached the safety cap; truncating render window.", { cap: $e, safeRenderingStartIndex: o, safeRenderingEndIndex: c });
2655
2657
  break;
2656
2658
  }
2657
- const vt = r(Q), bt = x.get(Q), Tt = vt - bt;
2658
- Tt !== 0 && A.push({ index: Q, value: vt });
2659
- const se = tt + gt, ve = e ? e(Q) : Q;
2660
- B.push(
2661
- /* @__PURE__ */ et(
2659
+ const Pt = r(ot), Tt = v.get(ot), yt = Pt - Tt;
2660
+ yt !== 0 && q.push({ index: ot, value: Pt });
2661
+ const le = Z + at, ie = e ? e(ot) : ot;
2662
+ $.push(
2663
+ /* @__PURE__ */ Q(
2662
2664
  Cr,
2663
2665
  {
2664
- index: Q,
2665
- top: se - _,
2666
- height: vt,
2667
- item: t(Q),
2668
- clipItemHeight: U,
2669
- enableKeyboardNavigation: O,
2670
- onKeyDown: Pe,
2671
- onFocus: ye,
2672
- registerItemRef: jt,
2666
+ index: ot,
2667
+ top: le - E,
2668
+ height: Pt,
2669
+ item: t(ot),
2670
+ clipItemHeight: ft,
2671
+ enableKeyboardNavigation: L,
2672
+ onKeyDown: we,
2673
+ onFocus: Re,
2674
+ registerItemRef: Dt,
2673
2675
  children: I
2674
2676
  },
2675
- ve
2677
+ ie
2676
2678
  )
2677
- ), gt += Tt, tt += bt;
2679
+ ), at += yt, Z += Tt;
2678
2680
  }
2679
- return A.length > 0 && Promise.resolve().then(() => {
2680
- if (Mt.current)
2681
+ return q.length > 0 && Promise.resolve().then(() => {
2682
+ if (St.current)
2681
2683
  return;
2682
- let Q = 0;
2683
- for (const Tt of A)
2684
- if (Tt.index < Bt) {
2685
- const se = x.get(Tt.index);
2686
- Q += Tt.value - se;
2684
+ let ot = 0;
2685
+ for (const yt of q)
2686
+ if (yt.index < ne) {
2687
+ const le = v.get(yt.index);
2688
+ ot += yt.value - le;
2687
2689
  }
2688
- const vt = x.updates(A);
2689
- if (Mt.current || typeof vt != "number")
2690
+ const Pt = v.updates(q);
2691
+ if (St.current || typeof Pt != "number")
2690
2692
  return;
2691
- Y(vt), V.debug("[VirtualScroll] Updated heights for items", A, "New total height:", vt);
2692
- const bt = k.current?.getScrollPosition() ?? C.current;
2693
- if (Q !== 0) {
2694
- const Tt = bt + Q;
2695
- Zt(Tt), it(Tt, { immediate: !0 }), V.debug("[VirtualScroll] Adjusted scroll for layout shift (auto update)", { from: bt, to: Tt, shiftAmount: Q });
2696
- } else bt !== C.current && it(bt);
2697
- }), { visibleItems: B, renderAnchor: _ };
2693
+ O(Pt), N.debug("[VirtualScroll] Updated heights for items", q, "New total height:", Pt);
2694
+ const Tt = Y.current?.getScrollPosition() ?? A.current;
2695
+ if (ot !== 0) {
2696
+ const yt = Tt + ot;
2697
+ Yt(yt), it(yt, { immediate: !0 }), N.debug("[VirtualScroll] Adjusted scroll for layout shift (auto update)", { from: Tt, to: yt, shiftAmount: ot });
2698
+ } else Tt !== A.current && it(Tt);
2699
+ }), { visibleItems: $, renderAnchor: E };
2698
2700
  }, [
2699
2701
  I,
2700
- U,
2701
- M,
2702
- O,
2702
+ ft,
2703
+ T,
2704
+ L,
2703
2705
  i,
2704
- x,
2706
+ v,
2705
2707
  t,
2706
2708
  e,
2707
2709
  r,
2708
- ye,
2709
- Pe,
2710
- Zt,
2711
- jt,
2710
+ Re,
2711
+ we,
2712
+ Yt,
2713
+ Dt,
2714
+ qt,
2712
2715
  Qt,
2713
- Jt,
2714
2716
  it,
2715
- Bt
2716
- ]), a = y(
2717
+ ne
2718
+ ]), h = S(
2717
2719
  (o) => {
2718
- const c = (p ?? 0) > 0, d = Math.abs(o - At), P = c && d > 0.5 ? At : o, N = ee(P, R.top);
2719
- if (V.debug("[VirtualScroll] Rendering visible items", () => ({
2720
+ const c = (D ?? 0) > 0, d = Math.abs(o - _t), y = c && d > 0.5 ? _t : o, k = ee(y, R.top);
2721
+ if (N.debug("[VirtualScroll] Rendering visible items", () => ({
2720
2722
  currentScrollPosition: o,
2721
- effectiveScrollPosition: N,
2722
- renderingStartIndex: Jt,
2723
- renderingEndIndex: Qt,
2723
+ effectiveScrollPosition: k,
2724
+ renderingStartIndex: Qt,
2725
+ renderingEndIndex: qt,
2724
2726
  itemCount: i,
2725
2727
  viewportSize: n,
2726
- callbackThrottleMs: p,
2728
+ callbackThrottleMs: D,
2727
2729
  diff: d,
2728
- rawEffectiveScrollPosition: P
2730
+ rawEffectiveScrollPosition: y
2729
2731
  })), i === 0)
2730
- return ue;
2731
- const _ = R.top + de - P, A = R.bottom > 0 ? /* @__PURE__ */ et(
2732
+ return pe;
2733
+ const E = R.top + a - y, q = R.bottom > 0 ? /* @__PURE__ */ Q(
2732
2734
  "div",
2733
2735
  {
2734
2736
  className: "aqvs-bottom-inset",
2735
2737
  style: {
2736
2738
  // ラッパー座標での bottom インセット位置 = コンテンツ総高さ (最終行の下端) - アンカー。
2737
- top: x.getTotal() - de,
2739
+ top: v.getTotal() - a,
2738
2740
  height: R.bottom
2739
2741
  }
2740
2742
  },
2741
2743
  "virtualscroll-bottom-inset"
2742
2744
  ) : null;
2743
- return V.debug("[VirtualScroll] Rendering items", () => ({
2744
- containerTop: _,
2745
- logicalScrollPosition: Yt,
2745
+ return N.debug("[VirtualScroll] Rendering items", () => ({
2746
+ containerTop: E,
2747
+ logicalScrollPosition: Jt,
2746
2748
  resolvedInsets: R,
2747
- effectiveScrollPosition: N
2748
- })), /* @__PURE__ */ le("div", { className: "aqvs-items-wrapper", style: { top: 0, transform: `translateY(${_}px)`, willChange: "transform" }, children: [
2749
- ue,
2750
- A
2749
+ effectiveScrollPosition: k
2750
+ })), /* @__PURE__ */ ue("div", { className: "aqvs-items-wrapper", style: { top: 0, transform: `translateY(${E}px)`, willChange: "transform" }, children: [
2751
+ pe,
2752
+ q
2751
2753
  ] });
2752
2754
  },
2753
- [p, i, x, Yt, de, Qt, Jt, R, At, n, ue]
2754
- ), g = yt(
2755
+ [D, i, v, Jt, a, qt, Qt, R, _t, n, pe]
2756
+ ), P = Nt(
2755
2757
  () => ({
2756
- renderingStartIndex: ie.renderingStartIndex,
2757
- renderingEndIndex: ie.renderingEndIndex,
2758
- visibleStartIndex: ie.visibleStartIndex,
2759
- visibleEndIndex: ie.visibleEndIndex,
2760
- scrollPosition: Yt,
2761
- totalHeight: x.getTotal()
2758
+ renderingStartIndex: re.renderingStartIndex,
2759
+ renderingEndIndex: re.renderingEndIndex,
2760
+ visibleStartIndex: re.visibleStartIndex,
2761
+ visibleEndIndex: re.visibleEndIndex,
2762
+ scrollPosition: Jt,
2763
+ totalHeight: v.getTotal()
2762
2764
  // contentSize (State) ではなく最新値を反映
2763
2765
  }),
2764
2766
  // contentSize を依存に含めることで、updateItemSize/updates 等で木の総高さが変わった際に
2765
2767
  // (fenwickTree は安定参照のため getTotal() の変化だけでは再計算されない) 総高さを再取得する。
2766
- [ie, Yt, x, M]
2768
+ [re, Jt, v, T]
2767
2769
  );
2768
2770
  X(() => {
2769
- G.current = g;
2770
- }, [g]), ke(
2771
- ft,
2771
+ W.current = P;
2772
+ }, [P]), ke(
2773
+ wt,
2772
2774
  () => ({
2773
- getScrollPosition: () => k.current?.getScrollPosition() ?? -1,
2774
- getContentSize: () => k.current?.getContentSize() ?? -1,
2775
- getViewportSize: () => k.current?.getViewportSize() ?? -1,
2776
- scrollTo: Me,
2777
- scrollToIndex: kt,
2778
- getFenwickTreeTotalHeight: () => x.getTotal(),
2779
- getFenwickSize: () => x.getSize(),
2775
+ getScrollPosition: () => Y.current?.getScrollPosition() ?? -1,
2776
+ getContentSize: () => Y.current?.getContentSize() ?? -1,
2777
+ getViewportSize: () => Y.current?.getViewportSize() ?? -1,
2778
+ scrollTo: ye,
2779
+ scrollToIndex: Bt,
2780
+ getFenwickTreeTotalHeight: () => v.getTotal(),
2781
+ getFenwickSize: () => v.getSize(),
2780
2782
  focusItemAtIndex: te,
2781
- getRange: () => G.current,
2782
- updateItemSize: Xt
2783
+ getRange: () => W.current,
2784
+ updateItemSize: Ie
2783
2785
  }),
2784
- [Me, kt, x, te, Xt]
2786
+ [ye, Bt, v, te, Ie]
2785
2787
  );
2786
- const w = x.getTotal() + R.top + R.bottom;
2787
- return /* @__PURE__ */ et(
2788
+ const F = v.getTotal() + R.top + R.bottom;
2789
+ return /* @__PURE__ */ Q(
2788
2790
  xr,
2789
2791
  {
2790
- ref: k,
2791
- contentSize: w,
2792
+ ref: Y,
2793
+ contentSize: F,
2792
2794
  viewportSize: n,
2793
2795
  className: l,
2794
- onScroll: Ne,
2795
- background: v,
2796
- tapScrollCircleOptions: q,
2797
- inertiaOptions: S,
2796
+ testId: u,
2797
+ onScroll: ve,
2798
+ background: M,
2799
+ tapScrollCircleOptions: H,
2800
+ inertiaOptions: K,
2798
2801
  itemCount: i,
2799
- scrollBarWidth: St,
2800
- enableThumbDrag: wt,
2801
- enableTrackClick: L,
2802
- enableArrowButtons: F,
2803
- enablePointerDrag: H,
2804
- renderThumbOverlay: $,
2805
- wheelSpeedMultiplier: K,
2806
- onWheelHorizontal: nt,
2802
+ scrollBarWidth: Vt,
2803
+ enableThumbDrag: z,
2804
+ enableTrackClick: B,
2805
+ enableArrowButtons: w,
2806
+ enablePointerDrag: tt,
2807
+ renderThumbOverlay: U,
2808
+ wheelSpeedMultiplier: b,
2809
+ onWheelHorizontal: st,
2807
2810
  contentInsets: R,
2808
- visibleStartIndex: Bt,
2809
- visibleEndIndex: ce,
2811
+ visibleStartIndex: ne,
2812
+ visibleEndIndex: fe,
2810
2813
  renderOverlay: Ve,
2811
- initialScrollPosition: Rt.position,
2812
- children: a
2814
+ initialScrollPosition: zt.position,
2815
+ children: h
2813
2816
  }
2814
2817
  );
2815
2818
  }, _r = Fe(Er);
@@ -2818,7 +2821,7 @@ export {
2818
2821
  br as ScrollBar,
2819
2822
  xr as ScrollPane,
2820
2823
  _r as VirtualScroll,
2821
- mt as minmax,
2824
+ gt as minmax,
2822
2825
  Dr as tapScrollCircleSampleVisual,
2823
2826
  Tr as useFenwickMapTree,
2824
2827
  Lr as useHeightCache,