@aiquants/virtualscroll 3.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,7 +1,26 @@
1
- import { jsx as de, jsxs as Mt, Fragment as dr } from "react/jsx-runtime";
2
- import xr, { memo as Ir, forwardRef as Zt, useState as rt, useRef as g, useCallback as S, useImperativeHandle as Jt, useMemo as Fe, useLayoutEffect as nt, useEffect as q, useId as Sr } from "react";
3
- import { twMerge as Et } from "tailwind-merge";
4
- class T {
1
+ import { jsx as ie, jsxs as Tt, Fragment as rr } from "react/jsx-runtime";
2
+ import Er, { memo as Nr, forwardRef as nr, useState as Je, useRef as g, useCallback as S, useImperativeHandle as ir, useMemo as _e, useLayoutEffect as et, useEffect as X, useId as Vr } from "react";
3
+ import { twMerge as Vt } from "tailwind-merge";
4
+ const bn = (r) => {
5
+ const { quantum: e, resetOnDirectionChange: t = !0 } = r;
6
+ if (!(Number.isFinite(e) && e > 0))
7
+ throw new TypeError(`[createResidualQuantizer] quantum must be a finite positive number, received ${e}`);
8
+ let n = 0;
9
+ return {
10
+ push: (i) => {
11
+ if (!Number.isFinite(i) || Math.abs(i) > Number.MAX_SAFE_INTEGER)
12
+ return 0;
13
+ t && n !== 0 && i !== 0 && Math.sign(i) !== Math.sign(n) && (n = 0), n += i;
14
+ const s = Math.trunc(n / e) * e + 0;
15
+ return n -= s, s;
16
+ },
17
+ peekResidue: () => n,
18
+ reset: () => {
19
+ n = 0;
20
+ }
21
+ };
22
+ };
23
+ class P {
5
24
  level;
6
25
  prefix;
7
26
  impl;
@@ -14,7 +33,7 @@ class T {
14
33
  constructor(e = 2, t = "[virtualscroll]", n = console) {
15
34
  this.level = e, this.prefix = t, this.impl = n;
16
35
  }
17
- static instance = new T(2, "[virtualscroll]");
36
+ static instance = new P(2, "[virtualscroll]");
18
37
  /**
19
38
  * @method setLevel
20
39
  * @description Updates the current log level for the static instance.
@@ -22,7 +41,7 @@ class T {
22
41
  * @param {LogLevel} level - The new log level.
23
42
  */
24
43
  static setLevel(e) {
25
- T.instance.setLevel(e);
44
+ P.instance.setLevel(e);
26
45
  }
27
46
  /**
28
47
  * @method setLevel
@@ -40,7 +59,7 @@ class T {
40
59
  * @param {ILogger} impl - The new logger implementation.
41
60
  */
42
61
  static setImplementation(e) {
43
- T.instance.setImplementation(e);
62
+ P.instance.setImplementation(e);
44
63
  }
45
64
  /**
46
65
  * @method setImplementation
@@ -58,7 +77,7 @@ class T {
58
77
  * @param {string} prefix - The new prefix.
59
78
  */
60
79
  static setPrefix(e) {
61
- T.instance.setPrefix(e);
80
+ P.instance.setPrefix(e);
62
81
  }
63
82
  /**
64
83
  * @method setPrefix
@@ -77,7 +96,7 @@ class T {
77
96
  * @returns {boolean} True if a message at `level` would be emitted. / `level` のメッセージが出力されるなら true。
78
97
  */
79
98
  static isEnabled(e) {
80
- return T.instance.isEnabled(e);
99
+ return P.instance.isEnabled(e);
81
100
  }
82
101
  /**
83
102
  * @method isEnabled
@@ -122,41 +141,41 @@ class T {
122
141
  return typeof e == "string" ? [`${this.prefix} ${e}`] : [this.prefix, e];
123
142
  }
124
143
  static debug(e, ...t) {
125
- T.instance.debug(e, ...t);
144
+ P.instance.debug(e, ...t);
126
145
  }
127
146
  debug(e, ...t) {
128
- this.level <= 0 && this.impl.debug(...this.formatMessage(T.resolveLazy(e)), ...t.map(T.resolveLazy));
147
+ this.level <= 0 && this.impl.debug(...this.formatMessage(P.resolveLazy(e)), ...t.map(P.resolveLazy));
129
148
  }
130
149
  static info(e, ...t) {
131
- T.instance.info(e, ...t);
150
+ P.instance.info(e, ...t);
132
151
  }
133
152
  info(e, ...t) {
134
- this.level <= 1 && this.impl.info(...this.formatMessage(T.resolveLazy(e)), ...t.map(T.resolveLazy));
153
+ this.level <= 1 && this.impl.info(...this.formatMessage(P.resolveLazy(e)), ...t.map(P.resolveLazy));
135
154
  }
136
155
  static warn(e, ...t) {
137
- T.instance.warn(e, ...t);
156
+ P.instance.warn(e, ...t);
138
157
  }
139
158
  warn(e, ...t) {
140
- this.level <= 2 && this.impl.warn(...this.formatMessage(T.resolveLazy(e)), ...t.map(T.resolveLazy));
159
+ this.level <= 2 && this.impl.warn(...this.formatMessage(P.resolveLazy(e)), ...t.map(P.resolveLazy));
141
160
  }
142
161
  static error(e, ...t) {
143
- T.instance.error(e, ...t);
162
+ P.instance.error(e, ...t);
144
163
  }
145
164
  error(e, ...t) {
146
- this.level <= 3 && this.impl.error(...this.formatMessage(T.resolveLazy(e)), ...t.map(T.resolveLazy));
165
+ this.level <= 3 && this.impl.error(...this.formatMessage(P.resolveLazy(e)), ...t.map(P.resolveLazy));
147
166
  }
148
167
  }
149
- const rr = {
168
+ const fr = {
150
169
  active: !1,
151
170
  offsetX: 0,
152
171
  offsetY: 0,
153
172
  distance: 0,
154
173
  direction: 0,
155
174
  pointerId: null
156
- }, $t = 6, vr = 8, wr = ({ dragState: r, normalizedDistance: e }) => {
175
+ }, jt = 6, zr = 8, Cr = ({ dragState: r, normalizedDistance: e }) => {
157
176
  const t = 1 + e * 0.18, n = 0.16 + e * 0.24, i = 0.38 + e * 0.28, s = r.active ? "80ms ease-out" : "220ms ease";
158
- return /* @__PURE__ */ Mt(dr, { children: [
159
- /* @__PURE__ */ de(
177
+ return /* @__PURE__ */ Tt(rr, { children: [
178
+ /* @__PURE__ */ ie(
160
179
  "div",
161
180
  {
162
181
  className: "aqvs-tap-scroll-circle-visual-outer",
@@ -168,7 +187,7 @@ const rr = {
168
187
  }
169
188
  }
170
189
  ),
171
- /* @__PURE__ */ de(
190
+ /* @__PURE__ */ ie(
172
191
  "div",
173
192
  {
174
193
  className: "aqvs-tap-scroll-circle-inner",
@@ -181,154 +200,154 @@ const rr = {
181
200
  }
182
201
  )
183
202
  ] });
184
- }, fr = Ir(
185
- Zt(({ onDragChange: r, className: e, maxVisualDistance: t = 160, size: n = 40, style: i, opacity: s = 1, renderVisual: a }, c) => {
186
- const [f, b] = rt(rr), I = g(null), w = g(null), V = g({ x: 0, y: 0 }), h = g(null), z = g(0), G = S(
187
- (v) => {
188
- b(v), r(v);
203
+ }, Sr = Nr(
204
+ nr(({ onDragChange: r, className: e, maxVisualDistance: t = 160, size: n = 40, style: i, opacity: s = 1, renderVisual: l }, d) => {
205
+ const [m, b] = Je(fr), v = g(null), T = g(null), C = g({ x: 0, y: 0 }), h = g(null), O = g(0), W = S(
206
+ (I) => {
207
+ b(I), r(I);
189
208
  },
190
209
  [r]
191
- ), H = S(
192
- (v, W, ge = !1) => {
193
- const { x: qe, y: ee } = V.current, X = v - qe, Xe = W - ee, $e = Math.abs(Xe), ze = $e < $t ? 0 : Xe < 0 ? -1 : 1, Ce = z.current;
194
- let je = ze;
195
- const Ge = $t + vr;
196
- ze === 0 ? Ce !== 0 && $e < Ge ? je = Ce : (je = 0, ge || (z.current = 0)) : ze !== Ce && Ce !== 0 && $e < Ge ? je = Ce : z.current = ze, G({
197
- active: ge || $e >= $t,
198
- offsetX: X,
199
- offsetY: Xe,
200
- distance: $e,
201
- direction: je,
202
- pointerId: I.current
210
+ ), D = S(
211
+ (I, G, fe = !1) => {
212
+ const { x: $e, y: Ue } = C.current, z = I - $e, ke = G - Ue, We = Math.abs(ke), Ve = We < jt ? 0 : ke < 0 ? -1 : 1, Fe = O.current;
213
+ let Ke = Ve;
214
+ const De = jt + zr;
215
+ Ve === 0 ? Fe !== 0 && We < De ? Ke = Fe : (Ke = 0, fe || (O.current = 0)) : Ve !== Fe && Fe !== 0 && We < De ? Ke = Fe : O.current = Ve, W({
216
+ active: fe || We >= jt,
217
+ offsetX: z,
218
+ offsetY: ke,
219
+ distance: We,
220
+ direction: Ke,
221
+ pointerId: v.current
203
222
  });
204
223
  },
205
- [G]
206
- ), pe = S((v) => {
207
- if (v === null)
224
+ [W]
225
+ ), ce = S((I) => {
226
+ if (I === null)
208
227
  return;
209
- const W = h.current;
210
- W?.hasPointerCapture(v) && W.releasePointerCapture(v);
211
- }, []), me = S(
212
- (v = !1) => {
213
- v && pe(I.current), I.current = null, w.current = null, z.current = 0, G(rr);
228
+ const G = h.current;
229
+ G?.hasPointerCapture(I) && G.releasePointerCapture(I);
230
+ }, []), ue = S(
231
+ (I = !1) => {
232
+ I && ce(v.current), v.current = null, T.current = null, O.current = 0, W(fr);
214
233
  },
215
- [G, pe]
216
- ), oe = S(
217
- (v) => {
218
- if (I.current !== null && I.current !== v.pointerId) {
219
- w.current = { pointerId: v.pointerId, clientX: v.clientX, clientY: v.clientY }, v.preventDefault(), v.stopPropagation();
234
+ [W, ce]
235
+ ), re = S(
236
+ (I) => {
237
+ if (v.current !== null && v.current !== I.pointerId) {
238
+ T.current = { pointerId: I.pointerId, clientX: I.clientX, clientY: I.clientY }, I.preventDefault(), I.stopPropagation();
220
239
  return;
221
240
  }
222
- v.preventDefault(), v.stopPropagation();
223
- const W = h.current ?? v.currentTarget, { left: ge, top: qe, width: ee, height: X } = W.getBoundingClientRect();
224
- V.current = { x: ge + ee / 2, y: qe + X / 2 }, I.current = v.pointerId;
241
+ I.preventDefault(), I.stopPropagation();
242
+ const G = h.current ?? I.currentTarget, { left: fe, top: $e, width: Ue, height: z } = G.getBoundingClientRect();
243
+ C.current = { x: fe + Ue / 2, y: $e + z / 2 }, v.current = I.pointerId;
225
244
  try {
226
- W.setPointerCapture(v.pointerId);
245
+ G.setPointerCapture(I.pointerId);
227
246
  } catch {
228
247
  }
229
- H(v.clientX, v.clientY, !0);
248
+ D(I.clientX, I.clientY, !0);
230
249
  },
231
- [H]
232
- ), ce = S(
233
- (v) => {
234
- if (I.current !== v.pointerId) {
235
- w.current !== null && w.current.pointerId === v.pointerId && (w.current = { pointerId: v.pointerId, clientX: v.clientX, clientY: v.clientY });
250
+ [D]
251
+ ), oe = S(
252
+ (I) => {
253
+ if (v.current !== I.pointerId) {
254
+ T.current !== null && T.current.pointerId === I.pointerId && (T.current = { pointerId: I.pointerId, clientX: I.clientX, clientY: I.clientY });
236
255
  return;
237
256
  }
238
- v.preventDefault(), H(v.clientX, v.clientY);
257
+ I.preventDefault(), D(I.clientX, I.clientY);
239
258
  },
240
- [H]
241
- ), he = S(
242
- (v) => {
243
- if (I.current !== v.pointerId) {
244
- w.current !== null && w.current.pointerId === v.pointerId && (w.current = null);
259
+ [D]
260
+ ), de = S(
261
+ (I) => {
262
+ if (v.current !== I.pointerId) {
263
+ T.current !== null && T.current.pointerId === I.pointerId && (T.current = null);
245
264
  return;
246
265
  }
247
- v.preventDefault(), v.stopPropagation();
248
- const W = w.current;
249
- if (w.current = null, W !== null) {
250
- pe(v.pointerId);
251
- const ge = h.current;
252
- let qe = !0;
253
- if (ge !== null && typeof ge.setPointerCapture == "function")
266
+ I.preventDefault(), I.stopPropagation();
267
+ const G = T.current;
268
+ if (T.current = null, G !== null) {
269
+ ce(I.pointerId);
270
+ const fe = h.current;
271
+ let $e = !0;
272
+ if (fe !== null && typeof fe.setPointerCapture == "function")
254
273
  try {
255
- ge.setPointerCapture(W.pointerId);
256
- } catch (ee) {
257
- (typeof ee == "object" && ee !== null && "name" in ee ? ee.name : void 0) === "NotFoundError" && (qe = !1);
274
+ fe.setPointerCapture(G.pointerId);
275
+ } catch (Ue) {
276
+ (typeof Ue == "object" && Ue !== null && "name" in Ue ? Ue.name : void 0) === "NotFoundError" && ($e = !1);
258
277
  }
259
- if (qe) {
260
- I.current = W.pointerId, H(W.clientX, W.clientY, !0);
278
+ if ($e) {
279
+ v.current = G.pointerId, D(G.clientX, G.clientY, !0);
261
280
  return;
262
281
  }
263
282
  }
264
- me(!0);
283
+ ue(!0);
265
284
  },
266
- [me, pe, H]
267
- ), P = S(
268
- (v) => {
269
- v.target === v.currentTarget && I.current === v.pointerId && me(!1);
285
+ [ue, ce, D]
286
+ ), y = S(
287
+ (I) => {
288
+ I.target === I.currentTarget && v.current === I.pointerId && ue(!1);
270
289
  },
271
- [me]
290
+ [ue]
272
291
  );
273
- Jt(
274
- c,
292
+ ir(
293
+ d,
275
294
  () => ({
276
295
  reset: () => {
277
- me(!0);
296
+ ue(!0);
278
297
  },
279
298
  getElement: () => h.current
280
299
  }),
281
- [me]
300
+ [ue]
282
301
  );
283
- const _ = Math.min(Math.max(s, 0), 1), M = n / 64, Z = Math.min(f.distance, t) / t, Q = f.direction * Z * 10 * M, U = a ?? wr, Se = {
284
- dragState: f,
302
+ const Y = Math.min(Math.max(s, 0), 1), w = n / 64, Z = Math.min(m.distance, t) / t, Q = m.direction * Z * 10 * w, K = l ?? Cr, he = {
303
+ dragState: m,
285
304
  normalizedDistance: Z,
286
- sizeScale: M,
305
+ sizeScale: w,
287
306
  size: n,
288
- opacity: _
289
- }, C = {
307
+ opacity: Y
308
+ }, A = {
290
309
  ...i,
291
310
  width: n,
292
311
  height: n,
293
312
  transform: `translateY(${Q}px)`
294
313
  };
295
- return C.opacity = _, /* @__PURE__ */ de(
314
+ return A.opacity = Y, /* @__PURE__ */ ie(
296
315
  "div",
297
316
  {
298
317
  ref: h,
299
318
  "data-testid": "virtual-scroll-tap-circle",
300
- className: Et("aqvs-tap-scroll-circle", e),
301
- style: C,
319
+ className: Vt("aqvs-tap-scroll-circle", e),
320
+ style: A,
302
321
  tabIndex: -1,
303
- onPointerDown: oe,
304
- onPointerMove: ce,
305
- onPointerUp: he,
306
- onPointerCancel: he,
307
- onLostPointerCapture: P,
322
+ onPointerDown: re,
323
+ onPointerMove: oe,
324
+ onPointerUp: de,
325
+ onPointerCancel: de,
326
+ onLostPointerCapture: y,
308
327
  role: "presentation",
309
- children: U(Se)
328
+ children: K(he)
310
329
  }
311
330
  );
312
331
  })
313
332
  );
314
- fr.displayName = "TapScrollCircle";
315
- const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scroll-cancel", nr = 20, Tr = 250, Pr = 60, Mr = 20, yr = 20, pr = {
333
+ Sr.displayName = "TapScrollCircle";
334
+ const se = (r, e, t) => Math.max(e, Math.min(t, r)), tr = "virtualscroll:tap-scroll-cancel", mr = 20, Dr = 250, Ar = 60, Lr = 20, Or = 20, Tr = {
316
335
  /** 速度が最大に達する引き距離 (px)。`maxVisualDistance` の既定値。 */
317
336
  maxDistance: 240,
318
337
  /** 最小速度倍率 (ビューポート比)。 */
319
338
  minSpeedMultiplier: 0.2
320
- }, Rr = pr.maxDistance, ir = { active: !1, offsetX: 0, offsetY: 0, distance: 0, direction: 0, pointerId: null }, Ut = 2.2, Er = 8, Nr = 120, Vr = 1 / 10, dt = {
339
+ }, _r = Tr.maxDistance, pr = { active: !1, offsetX: 0, offsetY: 0, distance: 0, direction: 0, pointerId: null }, Zt = 2.2, kr = 8, Fr = 120, Yr = 1 / 10, dt = {
321
340
  enabled: !0,
322
341
  size: 40,
323
342
  offsetX: -80,
324
343
  offsetY: 0,
325
344
  className: void 0,
326
- maxVisualDistance: Rr,
327
- minSpeedMultiplier: pr.minSpeedMultiplier,
345
+ maxVisualDistance: _r,
346
+ minSpeedMultiplier: Tr.minSpeedMultiplier,
328
347
  opacity: 0.9,
329
348
  renderVisual: void 0,
330
349
  maxSpeedCurve: void 0
331
- }, zr = (r) => r ? {
350
+ }, Br = (r) => r ? {
332
351
  mainSizeKey: "width",
333
352
  crossSizeKey: "height",
334
353
  positionKey: "left",
@@ -348,8 +367,8 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
348
367
  arrowIcons: ["▲", "▼"],
349
368
  directionClass: "aqvs-scrollbar-vertical",
350
369
  orientation: "vertical"
351
- }, Cr = (r, e) => {
352
- const t = r?.maxSpeedMultiplier, n = typeof t == "number" ? t : _r(e);
370
+ }, Hr = (r, e) => {
371
+ const t = r?.maxSpeedMultiplier, n = typeof t == "number" ? t : Wr(e);
353
372
  return {
354
373
  enabled: r?.enabled ?? dt.enabled,
355
374
  size: r?.size ?? dt.size,
@@ -359,503 +378,503 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
359
378
  maxVisualDistance: r?.maxVisualDistance ?? dt.maxVisualDistance,
360
379
  maxSpeedMultiplier: n,
361
380
  minSpeedMultiplier: Math.max(r?.minSpeedMultiplier ?? dt.minSpeedMultiplier, 0),
362
- opacity: le(r?.opacity ?? dt.opacity, 0, 1),
381
+ opacity: se(r?.opacity ?? dt.opacity, 0, 1),
363
382
  renderVisual: r?.renderVisual ?? dt.renderVisual,
364
383
  maxSpeedCurve: r?.maxSpeedCurve ?? dt.maxSpeedCurve
365
384
  };
366
- }, Dr = ({ isDragging: r, isThumbHovered: e, enableThumbDrag: t }) => Fe(() => t ? r ? "dragging" : e ? "hover" : "idle" : "disabled", [t, r, e]), Ar = ({ canUseArrowButtons: r, enableArrowButtons: e, resetTapScroll: t, scrollByStep: n }) => {
367
- const i = g(null), s = g(null), a = g(null), c = S(() => {
368
- i.current !== null && (window.clearInterval(i.current), i.current = null), s.current !== null && (window.clearTimeout(s.current), s.current = null), a.current !== null && (window.removeEventListener("pointerup", a.current), window.removeEventListener("pointercancel", a.current), window.removeEventListener("blur", a.current), a.current = null);
369
- }, []), f = S(() => {
370
- c();
371
- }, [c]), b = S(
372
- (w) => (V) => {
385
+ }, qr = ({ isDragging: r, isThumbHovered: e, enableThumbDrag: t }) => _e(() => t ? r ? "dragging" : e ? "hover" : "idle" : "disabled", [t, r, e]), Xr = ({ canUseArrowButtons: r, enableArrowButtons: e, resetTapScroll: t, scrollByStep: n }) => {
386
+ const i = g(null), s = g(null), l = g(null), d = S(() => {
387
+ i.current !== null && (window.clearInterval(i.current), i.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);
388
+ }, []), m = S(() => {
389
+ d();
390
+ }, [d]), b = S(
391
+ (T) => (C) => {
373
392
  if (!r)
374
393
  return;
375
- V.cancelable && V.preventDefault(), V.stopPropagation(), t(), c(), n(w), s.current = window.setTimeout(() => {
394
+ C.cancelable && C.preventDefault(), C.stopPropagation(), t(), d(), n(T), s.current = window.setTimeout(() => {
376
395
  i.current = window.setInterval(() => {
377
- n(w);
378
- }, Pr);
379
- }, Tr);
380
- const h = () => c();
381
- a.current = h, window.addEventListener("pointerup", h), window.addEventListener("pointercancel", h), window.addEventListener("blur", h);
396
+ n(T);
397
+ }, Ar);
398
+ }, Dr);
399
+ const h = () => d();
400
+ l.current = h, window.addEventListener("pointerup", h), window.addEventListener("pointercancel", h), window.addEventListener("blur", h);
382
401
  },
383
- [r, c, t, n]
384
- ), I = S(
385
- (w) => (V) => {
386
- e && (V.key === "Enter" || V.key === " " || V.key === "Spacebar") && (V.preventDefault(), n(w));
402
+ [r, d, t, n]
403
+ ), v = S(
404
+ (T) => (C) => {
405
+ e && (C.key === "Enter" || C.key === " " || C.key === "Spacebar") && (C.preventDefault(), n(T));
387
406
  },
388
407
  [e, n]
389
408
  );
390
- return q(() => {
391
- r || c();
392
- }, [r, c]), q(() => () => {
393
- c();
394
- }, [c]), { handleArrowPointerDown: b, handleArrowPointerUp: f, handleArrowKeyDown: I };
395
- }, Lr = 700, It = (r, e) => typeof r == "number" && Number.isFinite(r) ? r : e, Or = ({ distance: r, maxDistance: e, viewportSize: t, minSpeedMultiplier: n, maxSpeedMultiplier: i, hasCustomMaxSpeedMultiplier: s, curve: a }) => {
396
- const c = Math.max(It(r, 0), 0), f = It(e, 0), b = f > 0 ? Math.min(c, f) / f : 1, I = Math.max(It(t, 0), 0), w = Math.max(It(n, 0), 0), V = Math.max(It(i, 0), 0), h = Math.max(I * w, 40), z = s ? h : 1200, G = Math.max(I * V, z), H = a ? Math.max(It(a.exponentialScale, V), 0) : 0, pe = a ? Math.min(G, Math.max(I * H, h)) : G, me = Math.max(pe, h);
397
- let oe = b ** 1.1;
398
- if (a) {
399
- const he = Math.min(Math.max(It(a.exponentialSteepness, 0), 0), Lr);
400
- if (he === 0)
401
- oe = b;
409
+ return X(() => {
410
+ r || d();
411
+ }, [r, d]), X(() => () => {
412
+ d();
413
+ }, [d]), { handleArrowPointerDown: b, handleArrowPointerUp: m, handleArrowKeyDown: v };
414
+ }, $r = 700, It = (r, e) => typeof r == "number" && Number.isFinite(r) ? r : e, Ur = ({ distance: r, maxDistance: e, viewportSize: t, minSpeedMultiplier: n, maxSpeedMultiplier: i, hasCustomMaxSpeedMultiplier: s, curve: l }) => {
415
+ const d = Math.max(It(r, 0), 0), m = It(e, 0), b = m > 0 ? Math.min(d, m) / m : 1, v = Math.max(It(t, 0), 0), T = Math.max(It(n, 0), 0), C = Math.max(It(i, 0), 0), h = Math.max(v * T, 40), O = s ? h : 1200, W = Math.max(v * C, O), D = l ? Math.max(It(l.exponentialScale, C), 0) : 0, ce = l ? Math.min(W, Math.max(v * D, h)) : W, ue = Math.max(ce, h);
416
+ let re = b ** 1.1;
417
+ if (l) {
418
+ const de = Math.min(Math.max(It(l.exponentialSteepness, 0), 0), $r);
419
+ if (de === 0)
420
+ re = b;
402
421
  else {
403
- const P = Math.expm1(he) || 1;
404
- oe = Math.min(Math.max(Math.expm1(he * b) / P, 0), 1);
422
+ const y = Math.expm1(de) || 1;
423
+ re = Math.min(Math.max(Math.expm1(de * b) / y, 0), 1);
405
424
  }
406
425
  }
407
- const ce = Math.min(Math.max(It(a?.easedOffset, 0), 0), 1);
408
- return h + (me - h) * (ce + (1 - ce) * oe);
409
- }, _r = (r) => {
426
+ const oe = Math.min(Math.max(It(l?.easedOffset, 0), 0), 1);
427
+ return h + (ue - h) * (oe + (1 - oe) * re);
428
+ }, Wr = (r) => {
410
429
  if (!r || r <= 0)
411
- return Ut;
412
- const e = Math.max(1, r), t = Math.log10(e), n = Ut + t * Er;
413
- return le(n, Ut, Nr);
414
- }, kr = ({
430
+ return Zt;
431
+ const e = Math.max(1, r), t = Math.log10(e), n = Zt + t * kr;
432
+ return se(n, Zt, Fr);
433
+ }, Kr = ({
415
434
  contentSize: r,
416
435
  viewportSize: e,
417
436
  scrollPosition: t,
418
437
  onScroll: n,
419
438
  enableThumbDrag: i = !0,
420
439
  enableTrackClick: s = !0,
421
- enableArrowButtons: a = !0,
422
- horizontal: c = !1,
423
- scrollBarWidth: f = 12,
440
+ enableArrowButtons: l = !0,
441
+ horizontal: d = !1,
442
+ scrollBarWidth: m = 12,
424
443
  className: b,
425
- ariaControls: I,
426
- tapScrollCircleOptions: w,
427
- itemCount: V,
444
+ ariaControls: v,
445
+ tapScrollCircleOptions: T,
446
+ itemCount: C,
428
447
  renderThumbOverlay: h,
429
- visibleStartIndex: z,
430
- visibleEndIndex: G
448
+ visibleStartIndex: O,
449
+ visibleEndIndex: W
431
450
  }) => {
432
- const [H, pe] = rt(!1), [me, oe] = rt(!1), [ce, he] = rt(!1), P = g(null), _ = g({
451
+ const [D, ce] = Je(!1), [ue, re] = Je(!1), [oe, de] = Je(!1), y = g(null), Y = g({
433
452
  pointerId: null,
434
453
  startThumbPosition: 0,
435
454
  startClientX: 0,
436
455
  startClientY: 0,
437
456
  scale: 1,
438
457
  captureTarget: null
439
- }), M = g({ pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1 }), Z = g(t), Q = g(n), U = g(ir), Se = g(null), C = g(null), v = g(null), W = g(0), ge = g(0), qe = Fe(() => Cr(w, V), [V, w]), ee = Fe(() => zr(c), [c]), {
440
- enabled: X,
441
- size: Xe,
442
- offsetX: $e,
443
- offsetY: ze,
444
- className: Ce,
445
- maxVisualDistance: je,
446
- maxSpeedMultiplier: Ge,
447
- minSpeedMultiplier: K,
448
- opacity: Ae,
449
- renderVisual: ue,
450
- maxSpeedCurve: be
451
- } = qe, Te = g({
458
+ }), w = g({ pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1 }), Z = g(t), Q = g(n), K = g(pr), he = g(null), A = g(null), I = g(null), G = g(0), fe = g(0), $e = _e(() => Hr(T, C), [C, T]), Ue = _e(() => Br(d), [d]), {
459
+ enabled: z,
460
+ size: ke,
461
+ offsetX: We,
462
+ offsetY: Ve,
463
+ className: Fe,
464
+ maxVisualDistance: Ke,
465
+ maxSpeedMultiplier: De,
466
+ minSpeedMultiplier: Pe,
467
+ opacity: ze,
468
+ renderVisual: be,
469
+ maxSpeedCurve: Se
470
+ } = $e, j = g({
452
471
  viewportSize: e,
453
472
  maxScrollPosition: Math.max(r - e, 0),
454
473
  scrollBarVisible: r > e,
455
- effectiveTapMaxDistance: Math.max(je, 1),
456
- tapCircleMaxSpeedMultiplier: Ge,
457
- tapCircleMinSpeedMultiplier: K,
458
- tapCircleMaxSpeedCurve: be,
459
- tapScrollCircleOptions: w,
474
+ effectiveTapMaxDistance: Math.max(Ke, 1),
475
+ tapCircleMaxSpeedMultiplier: De,
476
+ tapCircleMinSpeedMultiplier: Pe,
477
+ tapCircleMaxSpeedCurve: Se,
478
+ tapScrollCircleOptions: T,
460
479
  effectiveTrackLength: 0,
461
480
  onScroll: n,
462
481
  scrollPosition: t
463
- }), { mainSizeKey: et, crossSizeKey: mt, positionKey: N, selectDelta: it, getPointerCoordinate: vt, arrowLabels: E, arrowIcons: J, directionClass: Ze, orientation: ht } = ee, Le = Math.max(je, 1), st = e / r, ie = Math.max(e - f * 2, 0), p = st * ie, F = Math.min(Math.max(nr, p || 0), ie || nr), B = r - e, Y = Math.max(ie - F, 0), te = B <= 0 || Y <= 0 ? 0 : le(t / B * Y, 0, Y), Me = te + F / 2, j = r > e || H, re = j && a;
464
- nt(() => {
465
- Te.current = {
482
+ }), { mainSizeKey: tt, crossSizeKey: Ge, positionKey: ft, selectDelta: st, getPointerCoordinate: N, arrowLabels: gt, arrowIcons: ne, directionClass: V, orientation: ot } = Ue, je = Math.max(Ke, 1), mt = e / r, Ae = Math.max(e - m * 2, 0), f = mt * Ae, M = Math.min(Math.max(mr, f || 0), Ae || mr), q = r - e, H = Math.max(Ae - M, 0), J = q <= 0 || H <= 0 ? 0 : se(t / q * H, 0, H), Te = J + M / 2, ee = r > e || D, xe = ee && l;
483
+ et(() => {
484
+ j.current = {
466
485
  viewportSize: e,
467
- maxScrollPosition: B,
468
- scrollBarVisible: j,
469
- effectiveTapMaxDistance: Le,
470
- tapCircleMaxSpeedMultiplier: Ge,
471
- tapCircleMinSpeedMultiplier: K,
472
- tapCircleMaxSpeedCurve: be,
473
- tapScrollCircleOptions: w,
474
- effectiveTrackLength: Y,
486
+ maxScrollPosition: q,
487
+ scrollBarVisible: ee,
488
+ effectiveTapMaxDistance: je,
489
+ tapCircleMaxSpeedMultiplier: De,
490
+ tapCircleMinSpeedMultiplier: Pe,
491
+ tapCircleMaxSpeedCurve: Se,
492
+ tapScrollCircleOptions: T,
493
+ effectiveTrackLength: H,
475
494
  onScroll: n,
476
495
  scrollPosition: t
477
496
  };
478
- }), nt(() => {
497
+ }), et(() => {
479
498
  Z.current = t;
480
- }, [t]), nt(() => {
499
+ }, [t]), et(() => {
481
500
  Q.current = n;
482
- }, [n]), q(() => {
483
- i || oe(!1);
501
+ }, [n]), X(() => {
502
+ i || re(!1);
484
503
  }, [i]);
485
- const De = Dr({ isDragging: H, isThumbHovered: me, enableThumbDrag: i }), ne = S((l, x) => {
486
- const R = Te.current, D = x ?? Z.current;
504
+ const ye = qr({ isDragging: D, isThumbHovered: ue, enableThumbDrag: i }), $ = S((a, x) => {
505
+ const E = j.current, L = x ?? Z.current;
487
506
  if (Q.current) {
488
- const Ee = Q.current(l, D);
489
- if (typeof Ee == "number" && Number.isFinite(Ee))
490
- return Z.current = Ee, Ee;
507
+ const He = Q.current(a, L);
508
+ if (typeof He == "number" && Number.isFinite(He))
509
+ return Z.current = He, He;
491
510
  }
492
- const $ = typeof l == "function" ? l(D) : l, ye = Math.max(R.maxScrollPosition, 0), Re = R.scrollBarVisible ? le($, 0, ye) : 0;
493
- return Z.current = Re, Re;
494
- }, []), Je = S(
495
- (l) => {
496
- const x = Te.current, R = Z.current;
511
+ const U = typeof a == "function" ? a(L) : a, ve = Math.max(E.maxScrollPosition, 0), Be = E.scrollBarVisible ? se(U, 0, ve) : 0;
512
+ return Z.current = Be, Be;
513
+ }, []), Re = S(
514
+ (a) => {
515
+ const x = j.current, E = Z.current;
497
516
  if (!x.scrollBarVisible || x.maxScrollPosition <= 0) {
498
- const Ye = ne(0, R), xt = Ye - R;
499
- return { nextPosition: Ye, actualDelta: xt, reachedBoundary: !0 };
517
+ const Ze = $(0, E), pt = Ze - E;
518
+ return { nextPosition: Ze, actualDelta: pt, reachedBoundary: !0 };
500
519
  }
501
- if (l === 0)
502
- return { nextPosition: R, actualDelta: 0, reachedBoundary: !1 };
503
- const $ = ne((Ye) => le(Ye + l, 0, x.maxScrollPosition), R), ye = $ - R, Re = l < 0 && R + l <= 0, Ee = l > 0 && R + l >= x.maxScrollPosition, lt = l < 0 && ($ <= 0 || Re && ye === 0) || l > 0 && ($ >= x.maxScrollPosition || Ee && ye === 0);
504
- return { nextPosition: $, actualDelta: ye, reachedBoundary: lt };
520
+ if (a === 0)
521
+ return { nextPosition: E, actualDelta: 0, reachedBoundary: !1 };
522
+ const U = $((Ze) => se(Ze + a, 0, x.maxScrollPosition), E), ve = U - E, Be = a < 0 && E + a <= 0, He = a > 0 && E + a >= x.maxScrollPosition, lt = a < 0 && (U <= 0 || Be && ve === 0) || a > 0 && (U >= x.maxScrollPosition || He && ve === 0);
523
+ return { nextPosition: U, actualDelta: ve, reachedBoundary: lt };
505
524
  },
506
- [ne]
507
- ), Oe = S(
508
- (l, x) => {
509
- l.current += x;
510
- const R = Math.max(Te.current.maxScrollPosition, 0);
511
- R > 0 && (l.current = le(l.current, -R, R));
512
- const D = Je(l.current);
513
- return l.current -= D.actualDelta, D.reachedBoundary && (l.current = 0), D;
525
+ [$]
526
+ ), Ce = S(
527
+ (a, x) => {
528
+ a.current += x;
529
+ const E = Math.max(j.current.maxScrollPosition, 0);
530
+ E > 0 && (a.current = se(a.current, -E, E));
531
+ const L = Re(a.current);
532
+ return a.current -= L.actualDelta, L.reachedBoundary && (a.current = 0), L;
514
533
  },
515
- [Je]
516
- ), ae = S(() => {
517
- C.current !== null && (window.cancelAnimationFrame(C.current), C.current = null), v.current = null, W.current = 0, ge.current = 0;
518
- }, []), ve = S(() => {
519
- U.current = { ...ir }, he(!1), Se.current?.reset(), ae();
520
- }, [ae]), Ue = S(
521
- (l) => {
522
- const x = U.current, R = Te.current;
534
+ [Re]
535
+ ), me = S(() => {
536
+ A.current !== null && (window.cancelAnimationFrame(A.current), A.current = null), I.current = null, G.current = 0, fe.current = 0;
537
+ }, []), Ee = S(() => {
538
+ K.current = { ...pr }, de(!1), he.current?.reset(), me();
539
+ }, [me]), rt = S(
540
+ (a) => {
541
+ const x = K.current, E = j.current;
523
542
  if (!x.active || x.direction === 0) {
524
- ae();
543
+ me();
525
544
  return;
526
545
  }
527
- if (!R.scrollBarVisible || R.maxScrollPosition <= 0) {
528
- ae();
546
+ if (!E.scrollBarVisible || E.maxScrollPosition <= 0) {
547
+ me();
529
548
  return;
530
549
  }
531
- const D = v.current ?? l, $ = Math.max((l - D) / 1e3, 0), ye = Math.min($, Vr);
532
- if (v.current = l, ye <= 0) {
533
- C.current = window.requestAnimationFrame(Ue);
550
+ const L = I.current ?? a, U = Math.max((a - L) / 1e3, 0), ve = Math.min(U, Yr);
551
+ if (I.current = a, ve <= 0) {
552
+ A.current = window.requestAnimationFrame(rt);
534
553
  return;
535
554
  }
536
- const Re = Or({
555
+ const Be = Ur({
537
556
  distance: x.distance,
538
- maxDistance: R.effectiveTapMaxDistance,
539
- viewportSize: R.viewportSize,
540
- minSpeedMultiplier: R.tapCircleMinSpeedMultiplier,
541
- maxSpeedMultiplier: R.tapCircleMaxSpeedMultiplier,
542
- hasCustomMaxSpeedMultiplier: typeof R.tapScrollCircleOptions?.maxSpeedMultiplier == "number",
543
- curve: R.tapCircleMaxSpeedCurve
557
+ maxDistance: E.effectiveTapMaxDistance,
558
+ viewportSize: E.viewportSize,
559
+ minSpeedMultiplier: E.tapCircleMinSpeedMultiplier,
560
+ maxSpeedMultiplier: E.tapCircleMaxSpeedMultiplier,
561
+ hasCustomMaxSpeedMultiplier: typeof E.tapScrollCircleOptions?.maxSpeedMultiplier == "number",
562
+ curve: E.tapCircleMaxSpeedCurve
544
563
  });
545
- ge.current !== x.direction && (ge.current = x.direction, W.current = 0);
546
- const { reachedBoundary: Ee } = Oe(W, x.direction * Re * ye);
547
- if (Ee) {
548
- ae();
564
+ fe.current !== x.direction && (fe.current = x.direction, G.current = 0);
565
+ const { reachedBoundary: He } = Ce(G, x.direction * Be * ve);
566
+ if (He) {
567
+ me();
549
568
  return;
550
569
  }
551
- C.current = window.requestAnimationFrame(Ue);
570
+ A.current = window.requestAnimationFrame(rt);
552
571
  },
553
- [Oe, ae]
554
- ), Ve = S(() => {
555
- C.current === null && (v.current = null, W.current = 0, C.current = window.requestAnimationFrame(Ue));
556
- }, [Ue]);
557
- q(() => {
558
- const l = U.current;
559
- !l.active || l.direction === 0 || Ve();
560
- }, [r, e, Ve]), q(() => () => {
561
- ae();
562
- }, [ae]);
563
- const ft = S(
564
- (l) => {
565
- U.current = l, he(l.active), l.active && l.direction !== 0 ? Ve() : ae();
572
+ [Ce, me]
573
+ ), Le = S(() => {
574
+ A.current === null && (I.current = null, G.current = 0, A.current = window.requestAnimationFrame(rt));
575
+ }, [rt]);
576
+ X(() => {
577
+ const a = K.current;
578
+ !a.active || a.direction === 0 || Le();
579
+ }, [r, e, Le]), X(() => () => {
580
+ me();
581
+ }, [me]);
582
+ const at = S(
583
+ (a) => {
584
+ K.current = a, de(a.active), a.active && a.direction !== 0 ? Le() : me();
566
585
  },
567
- [Ve, ae]
586
+ [Le, me]
568
587
  );
569
- q(() => {
570
- X || ve();
571
- }, [ve, X]), q(() => {
572
- const l = (x) => {
573
- const D = x.detail?.paneId;
574
- D && I && D !== I || ve();
588
+ X(() => {
589
+ z || Ee();
590
+ }, [Ee, z]), X(() => {
591
+ const a = (x) => {
592
+ const L = x.detail?.paneId;
593
+ L && v && L !== v || Ee();
575
594
  };
576
- return window.addEventListener(Gt, l), () => {
577
- window.removeEventListener(Gt, l);
595
+ return window.addEventListener(tr, a), () => {
596
+ window.removeEventListener(tr, a);
578
597
  };
579
- }, [I, ve]), q(() => {
580
- if (!X)
598
+ }, [v, Ee]), X(() => {
599
+ if (!z)
581
600
  return;
582
- const l = (x) => {
583
- if (!U.current.active || U.current.pointerId === x.pointerId)
601
+ const a = (x) => {
602
+ if (!K.current.active || K.current.pointerId === x.pointerId)
584
603
  return;
585
- const R = x.target;
586
- if (!(R instanceof Node)) {
587
- ve();
604
+ const E = x.target;
605
+ if (!(E instanceof Node)) {
606
+ Ee();
588
607
  return;
589
608
  }
590
- Se.current?.getElement()?.contains(R) || ve();
609
+ he.current?.getElement()?.contains(E) || Ee();
591
610
  };
592
- return document.addEventListener("pointerdown", l, !0), () => {
593
- document.removeEventListener("pointerdown", l, !0);
611
+ return document.addEventListener("pointerdown", a, !0), () => {
612
+ document.removeEventListener("pointerdown", a, !0);
594
613
  };
595
- }, [ve, X]);
596
- const Qe = (l) => {
597
- if (!j || Y <= 0 || B <= 0)
614
+ }, [Ee, z]);
615
+ const Me = (a) => {
616
+ if (!ee || H <= 0 || q <= 0)
598
617
  return 0;
599
- const x = le(l, 0, Y);
600
- return le(x / Y * B, 0, B);
601
- }, ot = S((l) => {
602
- const { scrollBarVisible: x, effectiveTrackLength: R, maxScrollPosition: D } = Te.current;
603
- if (T.debug("[ScrollBar] calculateScrollPositionFromThumb", () => ({ thumbPos: l, trackLen: R, maxScroll: D })), R <= 0 || D <= 0)
618
+ const x = se(a, 0, H);
619
+ return se(x / H * q, 0, q);
620
+ }, nt = S((a) => {
621
+ const { scrollBarVisible: x, effectiveTrackLength: E, maxScrollPosition: L } = j.current;
622
+ if (P.debug("[ScrollBar] calculateScrollPositionFromThumb", () => ({ thumbPos: a, trackLen: E, maxScroll: L })), E <= 0 || L <= 0)
604
623
  return null;
605
- const $ = le(l, 0, R);
606
- return le($ / R * D, 0, D);
607
- }, []), d = S(
608
- (l) => {
609
- const x = l.getBoundingClientRect(), R = c ? x.width : x.height, D = (lt) => {
610
- const Ye = Number.parseFloat(lt);
611
- return Number.isFinite(Ye) ? Ye : 0;
612
- }, $ = window.getComputedStyle(l), ye = D(c ? $.width : $.height), Re = ye > 0 ? ye + D(c ? $.paddingLeft : $.paddingTop) + D(c ? $.paddingRight : $.paddingBottom) + D(c ? $.borderLeftWidth : $.borderTopWidth) + D(c ? $.borderRightWidth : $.borderBottomWidth) : 0, Ee = Re > 0 ? Re : c ? l.offsetWidth : l.offsetHeight;
613
- return Ee <= 0 || R <= 0 ? 1 : R / Ee;
624
+ const U = se(a, 0, E);
625
+ return se(U / E * L, 0, L);
626
+ }, []), p = S(
627
+ (a) => {
628
+ const x = a.getBoundingClientRect(), E = d ? x.width : x.height, L = (lt) => {
629
+ const Ze = Number.parseFloat(lt);
630
+ return Number.isFinite(Ze) ? Ze : 0;
631
+ }, U = window.getComputedStyle(a), ve = L(d ? U.width : U.height), Be = ve > 0 ? ve + L(d ? U.paddingLeft : U.paddingTop) + L(d ? U.paddingRight : U.paddingBottom) + L(d ? U.borderLeftWidth : U.borderTopWidth) + L(d ? U.borderRightWidth : U.borderBottomWidth) : 0, He = Be > 0 ? Be : d ? a.offsetWidth : a.offsetHeight;
632
+ return He <= 0 || E <= 0 ? 1 : E / He;
614
633
  },
615
- [c]
616
- ), y = S(
617
- (l) => {
618
- const x = _.current;
619
- if (x.pointerId !== l.pointerId)
634
+ [d]
635
+ ), R = S(
636
+ (a) => {
637
+ const x = Y.current;
638
+ if (x.pointerId !== a.pointerId)
620
639
  return;
621
- const R = l.clientX - x.startClientX, D = l.clientY - x.startClientY, $ = it(R, D) / (x.scale || 1);
622
- T.debug("[ScrollBar] handleThumbPointerMove", () => ({
623
- delta: $,
640
+ const E = a.clientX - x.startClientX, L = a.clientY - x.startClientY, U = st(E, L) / (x.scale || 1);
641
+ P.debug("[ScrollBar] handleThumbPointerMove", () => ({
642
+ delta: U,
624
643
  startThumbPosition: x.startThumbPosition,
625
- clientY: l.clientY,
644
+ clientY: a.clientY,
626
645
  startClientY: x.startClientY,
627
- metrics: Te.current
646
+ metrics: j.current
628
647
  }));
629
- const ye = ot(x.startThumbPosition + $);
630
- ye !== null && ne(ye), l.cancelable && l.preventDefault();
648
+ const ve = nt(x.startThumbPosition + U);
649
+ ve !== null && $(ve), a.cancelable && a.preventDefault();
631
650
  },
632
- [it, ot, ne]
633
- ), xe = S(
634
- (l) => {
635
- const x = _.current;
636
- if (x.pointerId !== l.pointerId)
651
+ [st, nt, $]
652
+ ), ae = S(
653
+ (a) => {
654
+ const x = Y.current;
655
+ if (x.pointerId !== a.pointerId)
637
656
  return;
638
- document.removeEventListener("pointermove", y), document.removeEventListener("pointerup", xe), document.removeEventListener("pointercancel", xe);
639
- const R = x.captureTarget;
640
- if (R?.hasPointerCapture?.(l.pointerId) && R.releasePointerCapture(l.pointerId), _.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1, captureTarget: null }, pe(!1), P.current) {
641
- const D = P.current.getBoundingClientRect();
642
- l.clientX >= D.left && l.clientX <= D.right && l.clientY >= D.top && l.clientY <= D.bottom || oe(!1);
657
+ document.removeEventListener("pointermove", R), document.removeEventListener("pointerup", ae), document.removeEventListener("pointercancel", ae);
658
+ const E = x.captureTarget;
659
+ if (E?.hasPointerCapture?.(a.pointerId) && E.releasePointerCapture(a.pointerId), Y.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1, captureTarget: null }, ce(!1), y.current) {
660
+ const L = y.current.getBoundingClientRect();
661
+ a.clientX >= L.left && a.clientX <= L.right && a.clientY >= L.top && a.clientY <= L.bottom || re(!1);
643
662
  } else
644
- oe(!1);
663
+ re(!1);
645
664
  },
646
- [y]
665
+ [R]
647
666
  );
648
- q(() => () => {
649
- document.removeEventListener("pointermove", y), document.removeEventListener("pointerup", xe), document.removeEventListener("pointercancel", xe);
650
- }, [y, xe]);
651
- const tt = g(0), _e = g(0), ct = S(
652
- (l) => {
653
- const x = Math.max(Math.round(Te.current.viewportSize / yr), Mr);
654
- _e.current !== l && (_e.current = l, tt.current = 0), Oe(tt, l * x);
667
+ X(() => () => {
668
+ document.removeEventListener("pointermove", R), document.removeEventListener("pointerup", ae), document.removeEventListener("pointercancel", ae);
669
+ }, [R, ae]);
670
+ const it = g(0), Ne = g(0), zt = S(
671
+ (a) => {
672
+ const x = Math.max(Math.round(j.current.viewportSize / Or), Lr);
673
+ Ne.current !== a && (Ne.current = a, it.current = 0), Ce(it, a * x);
655
674
  },
656
- [Oe]
657
- ), { handleArrowPointerDown: ut, handleArrowPointerUp: at, handleArrowKeyDown: gt } = Ar({
658
- canUseArrowButtons: re,
659
- enableArrowButtons: a,
660
- resetTapScroll: ve,
661
- scrollByStep: ct
662
- }), pt = (l) => {
663
- if (!j)
675
+ [Ce]
676
+ ), { handleArrowPointerDown: ct, handleArrowPointerUp: Ye, handleArrowKeyDown: bt } = Xr({
677
+ canUseArrowButtons: xe,
678
+ enableArrowButtons: l,
679
+ resetTapScroll: Ee,
680
+ scrollByStep: zt
681
+ }), Pt = (a) => {
682
+ if (!ee)
664
683
  return;
665
684
  if (!i) {
666
- l.preventDefault(), l.stopPropagation();
685
+ a.preventDefault(), a.stopPropagation();
667
686
  return;
668
687
  }
669
- if (l.pointerType === "mouse" && l.button !== 0 || l.ctrlKey)
688
+ if (a.pointerType === "mouse" && a.button !== 0 || a.ctrlKey)
670
689
  return;
671
- ve();
672
- const x = l.currentTarget, R = d(x);
673
- let D = null;
690
+ Ee();
691
+ const x = a.currentTarget, E = p(x);
692
+ let L = null;
674
693
  if (x.setPointerCapture)
675
694
  try {
676
- x.setPointerCapture(l.pointerId), D = x;
695
+ x.setPointerCapture(a.pointerId), L = x;
677
696
  } catch {
678
- D = null;
697
+ L = null;
679
698
  }
680
- _.current = {
681
- pointerId: l.pointerId,
682
- startThumbPosition: te,
683
- startClientX: l.clientX,
684
- startClientY: l.clientY,
685
- scale: R,
686
- captureTarget: D
687
- }, document.addEventListener("pointermove", y), document.addEventListener("pointerup", xe), document.addEventListener("pointercancel", xe), pe(!0), oe(!0), l.preventDefault(), l.stopPropagation();
688
- }, yt = (l) => {
689
- if (!j)
699
+ Y.current = {
700
+ pointerId: a.pointerId,
701
+ startThumbPosition: J,
702
+ startClientX: a.clientX,
703
+ startClientY: a.clientY,
704
+ scale: E,
705
+ captureTarget: L
706
+ }, document.addEventListener("pointermove", R), document.addEventListener("pointerup", ae), document.addEventListener("pointercancel", ae), ce(!0), re(!0), a.preventDefault(), a.stopPropagation();
707
+ }, Ft = (a) => {
708
+ if (!ee)
690
709
  return;
691
710
  if (!s) {
692
- l.preventDefault(), l.stopPropagation();
711
+ a.preventDefault(), a.stopPropagation();
693
712
  return;
694
713
  }
695
- if (l.pointerType === "mouse" && l.button !== 0 || l.ctrlKey)
714
+ if (a.pointerType === "mouse" && a.button !== 0 || a.ctrlKey)
696
715
  return;
697
- const x = l.currentTarget, R = x.getBoundingClientRect(), D = vt(l), $ = d(x), ye = (D - (c ? R.left : R.top)) / $;
698
- ve();
699
- const Re = ye - F / 2, Ee = Qe(Re);
700
- if (ne(Ee), x.setPointerCapture)
716
+ const x = a.currentTarget, E = x.getBoundingClientRect(), L = N(a), U = p(x), ve = (L - (d ? E.left : E.top)) / U;
717
+ Ee();
718
+ const Be = ve - M / 2, He = Me(Be);
719
+ if ($(He), x.setPointerCapture)
701
720
  try {
702
- x.setPointerCapture(l.pointerId);
721
+ x.setPointerCapture(a.pointerId);
703
722
  } catch {
704
723
  }
705
- M.current = {
706
- pointerId: l.pointerId,
707
- startThumbPosition: Re,
708
- startClientX: l.clientX,
709
- startClientY: l.clientY,
710
- scale: $
711
- }, l.preventDefault(), l.stopPropagation();
712
- }, wt = () => {
713
- M.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1 };
714
- }, Nt = (l) => {
715
- const x = M.current;
716
- if (x.pointerId !== l.pointerId)
724
+ w.current = {
725
+ pointerId: a.pointerId,
726
+ startThumbPosition: Be,
727
+ startClientX: a.clientX,
728
+ startClientY: a.clientY,
729
+ scale: U
730
+ }, a.preventDefault(), a.stopPropagation();
731
+ }, ut = () => {
732
+ w.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1 };
733
+ }, yt = (a) => {
734
+ const x = w.current;
735
+ if (x.pointerId !== a.pointerId)
717
736
  return;
718
- if (l.pointerType === "mouse" && l.buttons === 0) {
719
- wt();
737
+ if (a.pointerType === "mouse" && a.buttons === 0) {
738
+ ut();
720
739
  return;
721
740
  }
722
- const R = l.clientX - x.startClientX, D = l.clientY - x.startClientY, $ = it(R, D) / (x.scale || 1), ye = Qe(x.startThumbPosition + $);
723
- ne(ye), l.cancelable && l.preventDefault();
724
- }, At = (l) => {
725
- if (M.current.pointerId !== l.pointerId)
741
+ const E = a.clientX - x.startClientX, L = a.clientY - x.startClientY, U = st(E, L) / (x.scale || 1), ve = Me(x.startThumbPosition + U);
742
+ $(ve), a.cancelable && a.preventDefault();
743
+ }, Yt = (a) => {
744
+ if (w.current.pointerId !== a.pointerId)
726
745
  return;
727
- const x = l.currentTarget;
728
- x.hasPointerCapture?.(l.pointerId) && x.releasePointerCapture(l.pointerId), wt(), l.preventDefault(), l.stopPropagation();
729
- }, we = (l) => {
730
- if (M.current.pointerId !== l.pointerId)
746
+ const x = a.currentTarget;
747
+ x.hasPointerCapture?.(a.pointerId) && x.releasePointerCapture(a.pointerId), ut(), a.preventDefault(), a.stopPropagation();
748
+ }, Ct = (a) => {
749
+ if (w.current.pointerId !== a.pointerId)
731
750
  return;
732
- const x = l.currentTarget;
733
- x.hasPointerCapture?.(l.pointerId) && x.releasePointerCapture(l.pointerId), wt();
734
- }, bt = (l) => {
735
- l.target === l.currentTarget && M.current.pointerId === l.pointerId && wt();
736
- }, Lt = Fe(() => le((ce ? 1 : 0.8) * Ae, 0, 1), [ce, Ae]), Ot = Fe(() => {
737
- const x = `calc(50% - ${Xe / 2}px + ${ze}px)`;
751
+ const x = a.currentTarget;
752
+ x.hasPointerCapture?.(a.pointerId) && x.releasePointerCapture(a.pointerId), ut();
753
+ }, Bt = (a) => {
754
+ a.target === a.currentTarget && w.current.pointerId === a.pointerId && ut();
755
+ }, ge = _e(() => se((oe ? 1 : 0.8) * ze, 0, 1), [oe, ze]), xt = _e(() => {
756
+ const x = `calc(50% - ${ke / 2}px + ${Ve}px)`;
738
757
  return {
739
- left: $e,
758
+ left: We,
740
759
  top: x
741
760
  };
742
- }, [$e, ze, Xe]), We = (l, x, R, D) => /* @__PURE__ */ de(
761
+ }, [We, Ve, ke]), Dt = (a, x, E, L) => /* @__PURE__ */ ie(
743
762
  "button",
744
763
  {
745
764
  type: "button",
746
765
  tabIndex: 0,
747
766
  className: "aqvs-scrollbar-arrow-button",
748
767
  style: {
749
- [et]: f,
750
- [mt]: f
768
+ [tt]: m,
769
+ [Ge]: m
751
770
  },
752
771
  "aria-label": x,
753
- onPointerDown: ut(l),
754
- onPointerUp: at,
755
- onPointerLeave: at,
756
- onPointerCancel: at,
757
- onKeyDown: gt(l),
758
- "aria-disabled": !a,
759
- disabled: !re,
760
- children: /* @__PURE__ */ de("span", { "aria-hidden": "true", children: R })
772
+ onPointerDown: ct(a),
773
+ onPointerUp: Ye,
774
+ onPointerLeave: Ye,
775
+ onPointerCancel: Ye,
776
+ onKeyDown: bt(a),
777
+ "aria-disabled": !l,
778
+ disabled: !xe,
779
+ children: /* @__PURE__ */ ie("span", { "aria-hidden": "true", children: E })
761
780
  },
762
- D
763
- ), Vt = h && j ? {
764
- orientation: ht,
781
+ L
782
+ ), At = h && ee ? {
783
+ orientation: ot,
765
784
  scrollPosition: t,
766
- maxScrollPosition: B,
785
+ maxScrollPosition: q,
767
786
  contentSize: r,
768
787
  viewportSize: e,
769
- thumbSize: F,
770
- thumbPosition: te,
771
- thumbCenter: Me,
772
- trackSize: ie,
773
- isDragging: H,
774
- isTapScrollActive: ce,
775
- visibleStartIndex: z,
776
- visibleEndIndex: G
788
+ thumbSize: M,
789
+ thumbPosition: J,
790
+ thumbCenter: Te,
791
+ trackSize: Ae,
792
+ isDragging: D,
793
+ isTapScrollActive: oe,
794
+ visibleStartIndex: O,
795
+ visibleEndIndex: W
777
796
  } : null;
778
- return /* @__PURE__ */ Mt(
797
+ return /* @__PURE__ */ Tt(
779
798
  "div",
780
799
  {
781
- className: Et("aqvs-scrollbar", Ze, b),
800
+ className: Vt("aqvs-scrollbar", V, b),
782
801
  style: {
783
- [et]: e,
784
- [mt]: f
802
+ [tt]: e,
803
+ [Ge]: m
785
804
  },
786
- "data-visible": j ? "true" : "false",
805
+ "data-visible": ee ? "true" : "false",
787
806
  role: "scrollbar",
788
807
  tabIndex: -1,
789
- "aria-controls": I,
808
+ "aria-controls": v,
790
809
  "aria-valuenow": t,
791
810
  "aria-valuemin": 0,
792
- "aria-valuemax": B,
793
- "aria-orientation": c ? "horizontal" : "vertical",
811
+ "aria-valuemax": q,
812
+ "aria-orientation": d ? "horizontal" : "vertical",
794
813
  children: [
795
- !c && j && X && /* @__PURE__ */ de(
796
- fr,
814
+ !d && ee && z && /* @__PURE__ */ ie(
815
+ Sr,
797
816
  {
798
- ref: Se,
799
- className: Et("aqvs-scrollbar-tap-circle-wrapper", Ce),
800
- size: Xe,
801
- maxVisualDistance: Le,
802
- style: Ot,
803
- opacity: Lt,
804
- renderVisual: ue,
805
- onDragChange: ft
817
+ ref: he,
818
+ className: Vt("aqvs-scrollbar-tap-circle-wrapper", Fe),
819
+ size: ke,
820
+ maxVisualDistance: je,
821
+ style: xt,
822
+ opacity: ge,
823
+ renderVisual: be,
824
+ onDragChange: at
806
825
  },
807
826
  "tap-circle"
808
827
  ),
809
- We(-1, E[0], J[0], "arrow-start"),
810
- /* @__PURE__ */ Mt(
828
+ Dt(-1, gt[0], ne[0], "arrow-start"),
829
+ /* @__PURE__ */ Tt(
811
830
  "div",
812
831
  {
813
832
  className: "aqvs-scrollbar-track",
814
833
  style: {
815
- borderRadius: f / 2
834
+ borderRadius: m / 2
816
835
  },
817
- onPointerDown: yt,
818
- onPointerMove: Nt,
819
- onPointerUp: At,
820
- onPointerCancel: we,
821
- onLostPointerCapture: bt,
836
+ onPointerDown: Ft,
837
+ onPointerMove: yt,
838
+ onPointerUp: Yt,
839
+ onPointerCancel: Ct,
840
+ onLostPointerCapture: Bt,
822
841
  "aria-disabled": !s,
823
842
  children: [
824
- Vt && /* @__PURE__ */ de("div", { className: "aqvs-scrollbar-overlay", "aria-hidden": !0, children: h?.(Vt) }, "overlay"),
825
- /* @__PURE__ */ de(
843
+ At && /* @__PURE__ */ ie("div", { className: "aqvs-scrollbar-overlay", "aria-hidden": !0, children: h?.(At) }, "overlay"),
844
+ /* @__PURE__ */ ie(
826
845
  "div",
827
846
  {
828
847
  className: "aqvs-scrollbar-thumb-wrapper",
829
848
  style: {
830
- [et]: F,
831
- [N]: te,
832
- ...c ? { top: 0, bottom: 0 } : { left: 0, right: 0 }
849
+ [tt]: M,
850
+ [ft]: J,
851
+ ...d ? { top: 0, bottom: 0 } : { left: 0, right: 0 }
833
852
  },
834
- "data-visible": j || H ? "true" : "false",
835
- onPointerDown: pt,
853
+ "data-visible": ee || D ? "true" : "false",
854
+ onPointerDown: Pt,
836
855
  role: "slider",
837
- "aria-orientation": c ? "horizontal" : "vertical",
856
+ "aria-orientation": d ? "horizontal" : "vertical",
838
857
  "aria-valuenow": t,
839
858
  "aria-valuemin": 0,
840
- "aria-valuemax": B,
859
+ "aria-valuemax": q,
841
860
  "aria-disabled": !i,
842
861
  tabIndex: -1,
843
- children: /* @__PURE__ */ de(
862
+ children: /* @__PURE__ */ ie(
844
863
  "div",
845
864
  {
846
- ref: P,
847
- className: Et("aqvs-scrollbar-thumb", c ? "aqvs-scrollbar-thumb-horizontal" : "aqvs-scrollbar-thumb-vertical"),
865
+ ref: y,
866
+ className: Vt("aqvs-scrollbar-thumb", d ? "aqvs-scrollbar-thumb-horizontal" : "aqvs-scrollbar-thumb-vertical"),
848
867
  "data-testid": "aqvs-scrollbar-thumb",
849
- "data-thumb-state": De,
868
+ "data-thumb-state": ye,
850
869
  style: {
851
- borderRadius: f - 1,
870
+ borderRadius: m - 1,
852
871
  cursor: i ? "pointer" : "default"
853
872
  },
854
873
  onMouseEnter: () => {
855
- i && oe(!0);
874
+ i && re(!0);
856
875
  },
857
876
  onMouseLeave: () => {
858
- i && oe(!1);
877
+ i && re(!1);
859
878
  }
860
879
  },
861
880
  "thumb"
@@ -867,11 +886,11 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
867
886
  },
868
887
  "track"
869
888
  ),
870
- We(1, E[1], J[1], "arrow-end")
889
+ Dt(1, gt[1], ne[1], "arrow-end")
871
890
  ]
872
891
  }
873
892
  );
874
- }, Fr = 16, sr = (r, e, t) => e === 1 ? r * Fr : e === 2 ? r * t : r, Yr = (r, e) => {
893
+ }, Gr = 16, hr = (r, e, t) => e === 1 ? r * Gr : e === 2 ? r * t : r, jr = (r, e) => {
875
894
  const t = r.shiftKey && r.deltaX === 0, n = t ? r.deltaY : r.deltaX, i = t ? 0 : r.deltaY, s = n !== 0 && Math.abs(n) >= Math.abs(i);
876
895
  return {
877
896
  // ❗ ズームでもデルタは潰さない。ここは**事実だけ**を報告し、「横取りしない」という
@@ -880,21 +899,21 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
880
899
  // どのテストも検出できなくなる (変異解析で実証済み)。
881
900
  isZoomGesture: r.ctrlKey,
882
901
  isHorizontalDominant: s,
883
- horizontalDelta: sr(n, r.deltaMode, e),
884
- verticalDelta: sr(i, r.deltaMode, e)
902
+ horizontalDelta: hr(n, r.deltaMode, e),
903
+ verticalDelta: hr(i, r.deltaMode, e)
885
904
  };
886
- }, mr = /* @__PURE__ */ new WeakSet(), or = (r) => {
887
- mr.add(r);
888
- }, Br = (r) => mr.has(r), Hr = ["mouse", "pen", "touch"], Wt = (r, e) => !(r === "mouse" || r === "pen" || r === "touch") || e.includes(r), qr = (r) => r === "mouse" || r === "pen", Ct = {
905
+ }, wr = /* @__PURE__ */ new WeakSet(), gr = (r) => {
906
+ wr.add(r);
907
+ }, Zr = (r) => wr.has(r), Qr = ["mouse", "pen", "touch"], Qt = (r, e) => !(r === "mouse" || r === "pen" || r === "touch") || e.includes(r), Jr = (r) => r === "mouse" || r === "pen", _t = {
889
908
  maxVelocity: 6,
890
909
  minVelocity: 0.02,
891
910
  deceleration: 25e-4,
892
911
  velocitySampleWindow: 90,
893
912
  startVelocityThreshold: 0.04
894
- }, kt = (r, e, t) => {
913
+ }, qt = (r, e, t) => {
895
914
  for (const [n, i, s] of e)
896
915
  t === "add" ? r.addEventListener(n, i, s) : r.removeEventListener(n, i, s);
897
- }, Xr = Zt(
916
+ }, en = nr(
898
917
  ({
899
918
  children: r,
900
919
  contentSize: e,
@@ -902,240 +921,240 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
902
921
  onViewportSizeChange: n,
903
922
  scrollBarWidth: i = 12,
904
923
  enableThumbDrag: s = !0,
905
- enableTrackClick: a = !0,
906
- enableArrowButtons: c = !0,
907
- enablePointerDrag: f = !0,
908
- pointerDragInputs: b = Hr,
909
- onScroll: I,
910
- className: w,
911
- testId: V,
924
+ enableTrackClick: l = !0,
925
+ enableArrowButtons: d = !0,
926
+ enablePointerDrag: m = !0,
927
+ pointerDragInputs: b = Qr,
928
+ onScroll: v,
929
+ className: T,
930
+ testId: C,
912
931
  style: h,
913
- background: z,
914
- tapScrollCircleOptions: G,
915
- inertiaOptions: H,
916
- itemCount: pe,
917
- renderThumbOverlay: me,
918
- wheelSpeedMultiplier: oe = 1,
919
- overscrollBehavior: ce = "auto",
920
- onWheelHorizontal: he,
921
- contentInsets: P,
922
- visibleStartIndex: _,
923
- visibleEndIndex: M,
932
+ background: O,
933
+ tapScrollCircleOptions: W,
934
+ inertiaOptions: D,
935
+ itemCount: ce,
936
+ renderThumbOverlay: ue,
937
+ wheelSpeedMultiplier: re = 1,
938
+ overscrollBehavior: oe = "auto",
939
+ onWheelHorizontal: de,
940
+ contentInsets: y,
941
+ visibleStartIndex: Y,
942
+ visibleEndIndex: w,
924
943
  renderOverlay: Z,
925
944
  initialScrollPosition: Q = 0,
926
- contentProps: U
927
- }, Se) => {
928
- const C = g(Number.isFinite(Q) ? Math.max(0, Q) : 0), v = g(null), W = g(null), ge = t === void 0, [qe, ee] = rt(0), X = t ?? qe, Xe = g(null);
929
- nt(() => {
930
- if (!ge)
945
+ contentProps: K
946
+ }, he) => {
947
+ const A = g(Number.isFinite(Q) ? Math.max(0, Q) : 0), I = g(null), G = g(null), fe = t === void 0, [$e, Ue] = Je(0), z = t ?? $e, ke = g(null);
948
+ et(() => {
949
+ if (!fe)
931
950
  return;
932
- const p = W.current;
933
- if (!p)
951
+ const f = G.current;
952
+ if (!f)
934
953
  return;
935
- const F = () => {
936
- const Y = p.offsetHeight;
937
- if (Y > 0) {
938
- ee((te) => te === Y ? te : Y);
954
+ const M = () => {
955
+ const H = f.offsetHeight;
956
+ if (H > 0) {
957
+ Ue((J) => J === H ? J : H);
939
958
  return;
940
959
  }
941
- p.offsetParent !== null && e > 0 && Xe.current !== "zero" && (Xe.current = "zero", T.warn("[ScrollPane] The self-measured viewport is 0px. Give the scroll pane's host element a definite height (e.g. h-full, flex-1 + min-h-0, an explicit px height), or pass viewportSize explicitly."));
960
+ f.offsetParent !== null && e > 0 && ke.current !== "zero" && (ke.current = "zero", P.warn("[ScrollPane] The self-measured viewport is 0px. Give the scroll pane's host element a definite height (e.g. h-full, flex-1 + min-h-0, an explicit px height), or pass viewportSize explicitly."));
942
961
  };
943
- if (F(), typeof ResizeObserver != "function")
962
+ if (M(), typeof ResizeObserver != "function")
944
963
  return;
945
- const B = new ResizeObserver(F);
946
- return B.observe(p), () => {
947
- B.disconnect();
964
+ const q = new ResizeObserver(M);
965
+ return q.observe(f), () => {
966
+ q.disconnect();
948
967
  };
949
- }, [e, ge]), nt(() => {
950
- ge && n?.(qe);
951
- }, [ge, qe, n]), nt(() => {
952
- if (ge)
968
+ }, [e, fe]), et(() => {
969
+ fe && n?.($e);
970
+ }, [fe, $e, n]), et(() => {
971
+ if (fe)
953
972
  return;
954
- const p = v.current;
955
- if (!p)
973
+ const f = I.current;
974
+ if (!f)
956
975
  return;
957
- const F = () => {
958
- const Y = p.clientHeight;
959
- if (Y <= 0 || Math.abs(Y - X) <= 1)
976
+ const M = () => {
977
+ const H = f.clientHeight;
978
+ if (H <= 0 || Math.abs(H - z) <= 1)
960
979
  return;
961
- const te = `${X}/${Y}`;
962
- Xe.current !== te && (Xe.current = te, T.warn(
963
- `[ScrollPane] viewportSize=${X} but the host band is ${Y}px. The clip window, max scroll position, thumb mapping, rendered row count and scrollability all derive from viewportSize, so they are now wrong. Omit viewportSize to let the pane measure itself.`
980
+ const J = `${z}/${H}`;
981
+ ke.current !== J && (ke.current = J, P.warn(
982
+ `[ScrollPane] viewportSize=${z} but the host band is ${H}px. The clip window, max scroll position, thumb mapping, rendered row count and scrollability all derive from viewportSize, so they are now wrong. Omit viewportSize to let the pane measure itself.`
964
983
  ));
965
984
  };
966
- if (F(), typeof ResizeObserver != "function")
985
+ if (M(), typeof ResizeObserver != "function")
967
986
  return;
968
- const B = new ResizeObserver(F);
969
- return B.observe(p), () => {
970
- B.disconnect();
987
+ const q = new ResizeObserver(M);
988
+ return q.observe(f), () => {
989
+ q.disconnect();
971
990
  };
972
- }, [ge, X]);
973
- const $e = g(he);
974
- q(() => {
975
- $e.current = he;
976
- }, [he]);
977
- const ze = g({
991
+ }, [fe, z]);
992
+ const We = g(de);
993
+ X(() => {
994
+ We.current = de;
995
+ }, [de]);
996
+ const Ve = g({
978
997
  frame: null,
979
998
  velocity: 0,
980
999
  lastTimestamp: null,
981
1000
  generation: 0
982
- }), Ce = Fe(
1001
+ }), Fe = _e(
983
1002
  () => ({
984
- maxVelocity: H?.maxVelocity ?? Ct.maxVelocity,
985
- minVelocity: H?.minVelocity ?? Ct.minVelocity,
986
- deceleration: H?.deceleration ?? Ct.deceleration,
987
- velocitySampleWindow: H?.velocitySampleWindow ?? Ct.velocitySampleWindow,
988
- startVelocityThreshold: H?.startVelocityThreshold ?? Ct.startVelocityThreshold
1003
+ maxVelocity: D?.maxVelocity ?? _t.maxVelocity,
1004
+ minVelocity: D?.minVelocity ?? _t.minVelocity,
1005
+ deceleration: D?.deceleration ?? _t.deceleration,
1006
+ velocitySampleWindow: D?.velocitySampleWindow ?? _t.velocitySampleWindow,
1007
+ startVelocityThreshold: D?.startVelocityThreshold ?? _t.startVelocityThreshold
989
1008
  }),
990
- [H]
991
- ), je = Fe(() => ({
992
- top: Math.max(0, P?.top ?? 0),
993
- bottom: Math.max(0, P?.bottom ?? 0)
994
- }), [P]);
995
- T.debug("[ScrollPane] ScrollPane rendered", () => ({
1009
+ [D]
1010
+ ), Ke = _e(() => ({
1011
+ top: Math.max(0, y?.top ?? 0),
1012
+ bottom: Math.max(0, y?.bottom ?? 0)
1013
+ }), [y]);
1014
+ P.debug("[ScrollPane] ScrollPane rendered", () => ({
996
1015
  contentSize: e,
997
- viewportSize: X,
1016
+ viewportSize: z,
998
1017
  scrollBarWidth: i,
999
- className: w,
1018
+ className: T,
1000
1019
  style: h,
1001
- tapScrollCircleOptions: G,
1002
- inertiaOptions: H,
1003
- enablePointerDrag: f,
1004
- contentInsets: je
1020
+ tapScrollCircleOptions: W,
1021
+ inertiaOptions: D,
1022
+ enablePointerDrag: m,
1023
+ contentInsets: Ke
1005
1024
  }));
1006
- const Ge = g({ contentSize: e, viewportSize: X }), K = Fe(() => e > X, [e, X]), Ae = S(
1007
- (p, F) => {
1008
- let B = F ?? Ge.current;
1009
- F && !(Number.isFinite(F.contentSize) && Number.isFinite(F.viewportSize)) && (T.warn("[ScrollPane] scrollTo received non-finite dimsOverride; falling back to the committed dims", { dimsOverride: F }), B = Ge.current);
1010
- const { contentSize: Y, viewportSize: te } = B, Me = Y > te, j = C.current;
1011
- if (T.debug("[ScrollPane] scrollTo called", () => ({ newPosition: p, contentSize: Y, viewportSize: te, currentIsScrollable: Me, prevPosition: j })), !Me)
1012
- return C.current !== 0 && (C.current = 0, I?.(0, j)), C.current;
1013
- const re = typeof p == "function" ? p(C.current) : p;
1014
- if (!Number.isFinite(re))
1015
- return T.warn("[ScrollPane] scrollTo received a non-finite position; keeping the current position", { nextPosition: re }), C.current;
1016
- const De = Math.max(Y - te, 0), ne = le(re, 0, De);
1017
- return C.current !== ne && (C.current = ne, I?.(ne, j)), C.current;
1025
+ const De = g({ contentSize: e, viewportSize: z }), Pe = _e(() => e > z, [e, z]), ze = S(
1026
+ (f, M) => {
1027
+ let q = M ?? De.current;
1028
+ M && !(Number.isFinite(M.contentSize) && Number.isFinite(M.viewportSize)) && (P.warn("[ScrollPane] scrollTo received non-finite dimsOverride; falling back to the committed dims", { dimsOverride: M }), q = De.current);
1029
+ const { contentSize: H, viewportSize: J } = q, Te = H > J, ee = A.current;
1030
+ if (P.debug("[ScrollPane] scrollTo called", () => ({ newPosition: f, contentSize: H, viewportSize: J, currentIsScrollable: Te, prevPosition: ee })), !Te)
1031
+ return A.current !== 0 && (A.current = 0, v?.(0, ee)), A.current;
1032
+ const xe = typeof f == "function" ? f(A.current) : f;
1033
+ if (!Number.isFinite(xe))
1034
+ return P.warn("[ScrollPane] scrollTo received a non-finite position; keeping the current position", { nextPosition: xe }), A.current;
1035
+ const ye = Math.max(H - J, 0), $ = se(xe, 0, ye);
1036
+ return A.current !== $ && (A.current = $, v?.($, ee)), A.current;
1018
1037
  },
1019
- [I]
1020
- ), ue = g(Ae);
1021
- q(() => {
1022
- ue.current = Ae;
1023
- }, [Ae]);
1024
- const be = S(() => {
1025
- const p = ze.current;
1026
- p.generation += 1, p.frame !== null && cancelAnimationFrame(p.frame), p.frame = null, p.velocity = 0, p.lastTimestamp = null;
1027
- }, []), Te = g(be);
1028
- q(() => {
1029
- Te.current = be;
1030
- }, [be]), q(() => () => {
1031
- Te.current();
1038
+ [v]
1039
+ ), be = g(ze);
1040
+ X(() => {
1041
+ be.current = ze;
1042
+ }, [ze]);
1043
+ const Se = S(() => {
1044
+ const f = Ve.current;
1045
+ f.generation += 1, f.frame !== null && cancelAnimationFrame(f.frame), f.frame = null, f.velocity = 0, f.lastTimestamp = null;
1046
+ }, []), j = g(Se);
1047
+ X(() => {
1048
+ j.current = Se;
1049
+ }, [Se]), X(() => () => {
1050
+ j.current();
1032
1051
  }, []);
1033
- const et = S(
1034
- (p) => {
1035
- if (!K)
1052
+ const tt = S(
1053
+ (f) => {
1054
+ if (!Pe)
1036
1055
  return;
1037
- const { maxVelocity: F, minVelocity: B, deceleration: Y, startVelocityThreshold: te } = Ce, Me = le(p, -F, F);
1038
- if (Math.abs(Me) < te)
1056
+ const { maxVelocity: M, minVelocity: q, deceleration: H, startVelocityThreshold: J } = Fe, Te = se(f, -M, M);
1057
+ if (Math.abs(Te) < J)
1039
1058
  return;
1040
- be(), ze.current.velocity = Me, ze.current.lastTimestamp = null;
1041
- const j = ze.current.generation, re = (De) => {
1042
- const ne = ze.current;
1043
- if (ne.generation !== j)
1059
+ Se(), Ve.current.velocity = Te, Ve.current.lastTimestamp = null;
1060
+ const ee = Ve.current.generation, xe = (ye) => {
1061
+ const $ = Ve.current;
1062
+ if ($.generation !== ee)
1044
1063
  return;
1045
- if (ne.lastTimestamp === null) {
1046
- ne.lastTimestamp = De, ne.frame = requestAnimationFrame(re);
1064
+ if ($.lastTimestamp === null) {
1065
+ $.lastTimestamp = ye, $.frame = requestAnimationFrame(xe);
1047
1066
  return;
1048
1067
  }
1049
- const Je = De - ne.lastTimestamp;
1050
- if (ne.lastTimestamp = De, Je <= 0) {
1051
- ne.frame = requestAnimationFrame(re);
1068
+ const Re = ye - $.lastTimestamp;
1069
+ if ($.lastTimestamp = ye, Re <= 0) {
1070
+ $.frame = requestAnimationFrame(xe);
1052
1071
  return;
1053
1072
  }
1054
- const Oe = ne.velocity;
1055
- let ae = Oe;
1056
- const ve = Y * Je;
1057
- Oe > 0 ? ae = Math.max(0, Oe - ve) : Oe < 0 && (ae = Math.min(0, Oe + ve));
1058
- const Ve = (Oe + ae) / 2 * Je, ft = C.current;
1059
- if (Ve !== 0 && ue.current((tt) => tt + Ve), ze.current.generation !== j)
1073
+ const Ce = $.velocity;
1074
+ let me = Ce;
1075
+ const Ee = H * Re;
1076
+ Ce > 0 ? me = Math.max(0, Ce - Ee) : Ce < 0 && (me = Math.min(0, Ce + Ee));
1077
+ const Le = (Ce + me) / 2 * Re, at = A.current;
1078
+ if (Le !== 0 && be.current((it) => it + Le), Ve.current.generation !== ee)
1060
1079
  return;
1061
- const Qe = C.current, { contentSize: ot, viewportSize: d } = Ge.current, y = Math.max(ot - d, 0);
1062
- ne.velocity = ae;
1063
- const xe = Qe === ft || Qe <= 0 && ae <= 0 || Qe >= y && ae >= 0;
1064
- if (Math.abs(ae) < B || xe) {
1065
- be();
1080
+ const Me = A.current, { contentSize: nt, viewportSize: p } = De.current, R = Math.max(nt - p, 0);
1081
+ $.velocity = me;
1082
+ const ae = Me === at || Me <= 0 && me <= 0 || Me >= R && me >= 0;
1083
+ if (Math.abs(me) < q || ae) {
1084
+ Se();
1066
1085
  return;
1067
1086
  }
1068
- ne.frame = requestAnimationFrame(re);
1087
+ $.frame = requestAnimationFrame(xe);
1069
1088
  };
1070
- ze.current.frame = requestAnimationFrame(re);
1089
+ Ve.current.frame = requestAnimationFrame(xe);
1071
1090
  },
1072
- [K, Ce, be]
1073
- ), mt = g(et);
1074
- q(() => {
1075
- mt.current = et;
1076
- }, [et]), nt(() => {
1077
- Ge.current = { contentSize: e, viewportSize: X };
1078
- }, [e, X]), nt(() => {
1079
- const p = W.current;
1080
- if (!p) return;
1081
- const F = () => {
1082
- p.scrollTop !== 0 && (T.debug("[ScrollPane] Native scroll detected, resetting to 0", () => ({ scrollTop: p.scrollTop })), p.scrollTop = 0), p.scrollLeft !== 0 && (p.scrollLeft = 0);
1091
+ [Pe, Fe, Se]
1092
+ ), Ge = g(tt);
1093
+ X(() => {
1094
+ Ge.current = tt;
1095
+ }, [tt]), et(() => {
1096
+ De.current = { contentSize: e, viewportSize: z };
1097
+ }, [e, z]), et(() => {
1098
+ const f = G.current;
1099
+ if (!f) return;
1100
+ const M = () => {
1101
+ f.scrollTop !== 0 && (P.debug("[ScrollPane] Native scroll detected, resetting to 0", () => ({ scrollTop: f.scrollTop })), f.scrollTop = 0), f.scrollLeft !== 0 && (f.scrollLeft = 0);
1083
1102
  };
1084
- return p.addEventListener("scroll", F), () => p.removeEventListener("scroll", F);
1085
- }, []), nt(() => {
1086
- if (K) {
1087
- T.debug("[ScrollPane] Adjusting scroll position due to content or viewport size change", () => ({ contentSize: e, viewportSize: X, scrollPosition: C.current }));
1088
- const p = le(e - X, 0, e);
1089
- C.current > p && Ae(p);
1103
+ return f.addEventListener("scroll", M), () => f.removeEventListener("scroll", M);
1104
+ }, []), et(() => {
1105
+ if (Pe) {
1106
+ P.debug("[ScrollPane] Adjusting scroll position due to content or viewport size change", () => ({ contentSize: e, viewportSize: z, scrollPosition: A.current }));
1107
+ const f = se(e - z, 0, e);
1108
+ A.current > f && ze(f);
1090
1109
  } else
1091
- Ae(0);
1092
- }, [K, Ae, e, X]);
1093
- const N = g({ isScrollable: K, viewportSize: X, wheelSpeedMultiplier: oe, overscrollBehavior: ce });
1094
- nt(() => {
1095
- N.current = { isScrollable: K, viewportSize: X, wheelSpeedMultiplier: oe, overscrollBehavior: ce };
1096
- }, [K, X, oe, ce]);
1097
- const it = S(
1098
- (p) => {
1099
- if (Br(p))
1110
+ ze(0);
1111
+ }, [Pe, ze, e, z]);
1112
+ const ft = g({ isScrollable: Pe, viewportSize: z, wheelSpeedMultiplier: re, overscrollBehavior: oe });
1113
+ et(() => {
1114
+ ft.current = { isScrollable: Pe, viewportSize: z, wheelSpeedMultiplier: re, overscrollBehavior: oe };
1115
+ }, [Pe, z, re, oe]);
1116
+ const st = S(
1117
+ (f) => {
1118
+ if (Zr(f))
1100
1119
  return !1;
1101
- const { isScrollable: F, viewportSize: B, wheelSpeedMultiplier: Y, overscrollBehavior: te } = N.current, Me = Yr(p, B);
1102
- if (Me.isZoomGesture)
1120
+ const { isScrollable: M, viewportSize: q, wheelSpeedMultiplier: H, overscrollBehavior: J } = ft.current, Te = jr(f, q);
1121
+ if (Te.isZoomGesture)
1103
1122
  return !1;
1104
- if (Me.isHorizontalDominant)
1105
- return $e.current ? (or(p), p.preventDefault(), be(), $e.current(Me.horizontalDelta), !0) : !1;
1106
- if (!F || Me.verticalDelta === 0)
1123
+ if (Te.isHorizontalDominant)
1124
+ return We.current ? (gr(f), f.preventDefault(), Se(), We.current(Te.horizontalDelta), !0) : !1;
1125
+ if (!M || Te.verticalDelta === 0)
1107
1126
  return !1;
1108
- let j = Me.verticalDelta;
1109
- if (Y !== 1 && (j *= Y), te !== "contain") {
1110
- const re = C.current, De = Math.max(Ge.current.contentSize - B, 0);
1111
- if (j > 0 && re >= De || j < 0 && re <= 0)
1127
+ let ee = Te.verticalDelta;
1128
+ if (H !== 1 && (ee *= H), J !== "contain") {
1129
+ const xe = A.current, ye = Math.max(De.current.contentSize - q, 0);
1130
+ if (ee > 0 && xe >= ye || ee < 0 && xe <= 0)
1112
1131
  return !1;
1113
1132
  }
1114
- return or(p), p.preventDefault(), be(), T.debug("[ScrollPane] wheel event", () => ({ deltaY: j, scrollPosition: C.current, wheelSpeedMultiplier: Y, deltaMode: p.deltaMode, scrollTop: W.current?.scrollTop })), Ae((re) => re + j), !0;
1133
+ return gr(f), f.preventDefault(), Se(), P.debug("[ScrollPane] wheel event", () => ({ deltaY: ee, scrollPosition: A.current, wheelSpeedMultiplier: H, deltaMode: f.deltaMode, scrollTop: G.current?.scrollTop })), ze((xe) => xe + ee), !0;
1115
1134
  },
1116
- [Ae, be]
1135
+ [ze, Se]
1117
1136
  );
1118
- q(() => {
1119
- const p = (Y) => {
1120
- it(Y);
1121
- }, F = () => {
1122
- be();
1123
- }, B = v.current;
1124
- return B && (B.addEventListener("wheel", p, { passive: !1 }), B.addEventListener("pointerdown", F, { capture: !0, passive: !0 })), () => {
1125
- B && (B.removeEventListener("wheel", p), B.removeEventListener("pointerdown", F, { capture: !0 }));
1137
+ X(() => {
1138
+ const f = (H) => {
1139
+ st(H);
1140
+ }, M = () => {
1141
+ Se();
1142
+ }, q = I.current;
1143
+ return q && (q.addEventListener("wheel", f, { passive: !1 }), q.addEventListener("pointerdown", M, { capture: !0, passive: !0 })), () => {
1144
+ q && (q.removeEventListener("wheel", f), q.removeEventListener("pointerdown", M, { capture: !0 }));
1126
1145
  };
1127
- }, [it, be]), Jt(
1128
- Se,
1146
+ }, [st, Se]), ir(
1147
+ he,
1129
1148
  () => ({
1130
- scrollTo: (p, F) => (be(), Ae(p, F)),
1131
- getScrollPosition: () => C.current,
1149
+ scrollTo: (f, M) => (Se(), ze(f, M)),
1150
+ getScrollPosition: () => A.current,
1132
1151
  getContentSize: () => e,
1133
- getViewportSize: () => X,
1134
- applyWheel: it
1152
+ getViewportSize: () => z,
1153
+ applyWheel: st
1135
1154
  }),
1136
- [Ae, e, X, be, it]
1155
+ [ze, e, z, Se, st]
1137
1156
  );
1138
- const vt = Sr(), E = U?.id ?? vt, J = g({
1157
+ const N = Vr(), gt = K?.id ?? N, ne = g({
1139
1158
  pointerType: "",
1140
1159
  pointerId: null,
1141
1160
  startClientY: 0,
@@ -1144,151 +1163,151 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
1144
1163
  shouldCancelNextClick: !1,
1145
1164
  clickResetTimer: null,
1146
1165
  velocitySamples: []
1147
- }), Ze = g(f), ht = g(b);
1148
- q(() => {
1149
- Ze.current = f;
1150
- }, [f]), q(() => {
1151
- ht.current = b;
1166
+ }), V = g(m), ot = g(b);
1167
+ X(() => {
1168
+ V.current = m;
1169
+ }, [m]), X(() => {
1170
+ ot.current = b;
1152
1171
  }, [b]);
1153
- const Le = g(K);
1154
- q(() => {
1155
- Le.current = K;
1156
- }, [K]);
1157
- const st = g(Ce);
1158
- q(() => {
1159
- st.current = Ce;
1160
- }, [Ce]), q(() => {
1161
- const p = J.current;
1162
- if (f && K && (p.pointerId === null || Wt(p.pointerType, b)) || p.pointerId === null)
1172
+ const je = g(Pe);
1173
+ X(() => {
1174
+ je.current = Pe;
1175
+ }, [Pe]);
1176
+ const mt = g(Fe);
1177
+ X(() => {
1178
+ mt.current = Fe;
1179
+ }, [Fe]), X(() => {
1180
+ const f = ne.current;
1181
+ if (m && Pe && (f.pointerId === null || Qt(f.pointerType, b)) || f.pointerId === null)
1163
1182
  return;
1164
- const F = W.current;
1165
- p.clickResetTimer !== null && (window.clearTimeout(p.clickResetTimer), p.clickResetTimer = null);
1166
- const B = p.isDragging && p.shouldCancelNextClick, Y = p.pointerId;
1167
- p.pointerId = null, p.pointerType = "", p.startClientY = 0, p.startScroll = 0, p.isDragging = !1, p.shouldCancelNextClick = B, p.velocitySamples = [], F?.hasPointerCapture(Y) && F.releasePointerCapture(Y);
1168
- }, [f, b, K]), q(() => {
1169
- const p = W.current;
1170
- if (!p)
1183
+ const M = G.current;
1184
+ f.clickResetTimer !== null && (window.clearTimeout(f.clickResetTimer), f.clickResetTimer = null);
1185
+ const q = f.isDragging && f.shouldCancelNextClick, H = f.pointerId;
1186
+ f.pointerId = null, f.pointerType = "", f.startClientY = 0, f.startScroll = 0, f.isDragging = !1, f.shouldCancelNextClick = q, f.velocitySamples = [], M?.hasPointerCapture(H) && M.releasePointerCapture(H);
1187
+ }, [m, b, Pe]), X(() => {
1188
+ const f = G.current;
1189
+ if (!f)
1171
1190
  return;
1172
- const F = 6, B = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(), Y = () => {
1173
- const d = J.current;
1174
- d.pointerId = null, d.pointerType = "", d.startClientY = 0, d.startScroll = 0, d.isDragging = !1, d.velocitySamples = [];
1175
- }, te = () => {
1176
- const d = J.current;
1177
- d.clickResetTimer !== null && (window.clearTimeout(d.clickResetTimer), d.clickResetTimer = null);
1178
- }, Me = (d) => {
1179
- const y = J.current, xe = B();
1180
- y.velocitySamples.push({ clientY: d, time: xe });
1181
- const tt = st.current.velocitySampleWindow;
1182
- y.velocitySamples = y.velocitySamples.filter((_e) => xe - _e.time <= tt);
1183
- }, j = (d) => d instanceof HTMLElement && d.closest("[data-scrollpane-ignore-drag='true']") !== null, re = (d) => {
1184
- const y = J.current;
1185
- y.shouldCancelNextClick && (d.preventDefault(), d.stopPropagation(), y.shouldCancelNextClick = !1);
1186
- }, De = (d) => {
1187
- const y = J.current;
1188
- if (!y.isDragging) {
1189
- if (y.isDragging = !0, y.shouldCancelNextClick = !0, !p.hasPointerCapture(d.pointerId))
1191
+ const M = 6, q = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(), H = () => {
1192
+ const p = ne.current;
1193
+ p.pointerId = null, p.pointerType = "", p.startClientY = 0, p.startScroll = 0, p.isDragging = !1, p.velocitySamples = [];
1194
+ }, J = () => {
1195
+ const p = ne.current;
1196
+ p.clickResetTimer !== null && (window.clearTimeout(p.clickResetTimer), p.clickResetTimer = null);
1197
+ }, Te = (p) => {
1198
+ const R = ne.current, ae = q();
1199
+ R.velocitySamples.push({ clientY: p, time: ae });
1200
+ const it = mt.current.velocitySampleWindow;
1201
+ R.velocitySamples = R.velocitySamples.filter((Ne) => ae - Ne.time <= it);
1202
+ }, ee = (p) => p instanceof HTMLElement && p.closest("[data-scrollpane-ignore-drag='true']") !== null, xe = (p) => {
1203
+ const R = ne.current;
1204
+ R.shouldCancelNextClick && (p.preventDefault(), p.stopPropagation(), R.shouldCancelNextClick = !1);
1205
+ }, ye = (p) => {
1206
+ const R = ne.current;
1207
+ if (!R.isDragging) {
1208
+ if (R.isDragging = !0, R.shouldCancelNextClick = !0, !f.hasPointerCapture(p.pointerId))
1190
1209
  try {
1191
- p.setPointerCapture(d.pointerId);
1210
+ f.setPointerCapture(p.pointerId);
1192
1211
  } catch {
1193
1212
  }
1194
- Me(d.clientY);
1213
+ Te(p.clientY);
1195
1214
  }
1196
- }, ne = (d) => d.isTrusted || d.target === p, Je = (d) => {
1197
- const y = J.current;
1198
- p.hasPointerCapture(d) && p.releasePointerCapture(d), y.shouldCancelNextClick = !1, te(), Y();
1199
- }, Oe = (d) => {
1200
- const y = J.current;
1201
- if (y.pointerId !== d.pointerId)
1215
+ }, $ = (p) => p.isTrusted || p.target === f, Re = (p) => {
1216
+ const R = ne.current;
1217
+ f.hasPointerCapture(p) && f.releasePointerCapture(p), R.shouldCancelNextClick = !1, J(), H();
1218
+ }, Ce = (p) => {
1219
+ const R = ne.current;
1220
+ if (R.pointerId !== p.pointerId)
1202
1221
  return;
1203
- if (d.buttons === 0 && qr(d.pointerType)) {
1204
- Je(d.pointerId);
1222
+ if (p.buttons === 0 && Jr(p.pointerType)) {
1223
+ Re(p.pointerId);
1205
1224
  return;
1206
1225
  }
1207
- if (!(Ze.current && Le.current) || !Wt(d.pointerType, ht.current) || !y.isDragging && (Math.abs(d.clientY - y.startClientY) < F || (De(d), !y.isDragging)))
1226
+ if (!(V.current && je.current) || !Qt(p.pointerType, ot.current) || !R.isDragging && (Math.abs(p.clientY - R.startClientY) < M || (ye(p), !R.isDragging)))
1208
1227
  return;
1209
- Me(d.clientY);
1210
- const xe = d.clientY - y.startClientY, tt = y.startScroll - xe;
1211
- ue.current(tt), d.cancelable && d.preventDefault();
1212
- }, ae = () => {
1213
- const d = J.current;
1214
- return d.pointerId !== null || !d.shouldCancelNextClick ? !1 : (te(), d.clickResetTimer = window.setTimeout(() => {
1215
- const y = J.current;
1216
- y.shouldCancelNextClick = !1, y.clickResetTimer = null;
1228
+ Te(p.clientY);
1229
+ const ae = p.clientY - R.startClientY, it = R.startScroll - ae;
1230
+ be.current(it), p.cancelable && p.preventDefault();
1231
+ }, me = () => {
1232
+ const p = ne.current;
1233
+ return p.pointerId !== null || !p.shouldCancelNextClick ? !1 : (J(), p.clickResetTimer = window.setTimeout(() => {
1234
+ const R = ne.current;
1235
+ R.shouldCancelNextClick = !1, R.clickResetTimer = null;
1217
1236
  }, 0), !0);
1218
- }, ve = (d) => {
1219
- const y = J.current;
1220
- if (y.pointerId !== d.pointerId) {
1221
- ae();
1237
+ }, Ee = (p) => {
1238
+ const R = ne.current;
1239
+ if (R.pointerId !== p.pointerId) {
1240
+ me();
1222
1241
  return;
1223
1242
  }
1224
- y.isDragging && y.shouldCancelNextClick && d.cancelable && (d.preventDefault(), d.stopPropagation()), y.isDragging && Me(d.clientY);
1225
- let xe = 0;
1226
- if (y.isDragging && y.velocitySamples.length >= 2) {
1227
- const _e = y.velocitySamples, ct = st.current.velocitySampleWindow, ut = _e[_e.length - 1], at = _e.find((gt) => ut.time - gt.time <= ct) ?? _e[0];
1228
- if (ut && at && ut.time !== at.time) {
1229
- const gt = ut.clientY - at.clientY, pt = ut.time - at.time;
1230
- xe = -(gt / pt);
1243
+ R.isDragging && R.shouldCancelNextClick && p.cancelable && (p.preventDefault(), p.stopPropagation()), R.isDragging && Te(p.clientY);
1244
+ let ae = 0;
1245
+ if (R.isDragging && R.velocitySamples.length >= 2) {
1246
+ const Ne = R.velocitySamples, zt = mt.current.velocitySampleWindow, ct = Ne[Ne.length - 1], Ye = Ne.find((bt) => ct.time - bt.time <= zt) ?? Ne[0];
1247
+ if (ct && Ye && ct.time !== Ye.time) {
1248
+ const bt = ct.clientY - Ye.clientY, Pt = ct.time - Ye.time;
1249
+ ae = -(bt / Pt);
1231
1250
  }
1232
1251
  }
1233
- te(), y.shouldCancelNextClick && (y.clickResetTimer = window.setTimeout(() => {
1234
- const _e = J.current;
1235
- _e.shouldCancelNextClick = !1, _e.clickResetTimer = null;
1252
+ J(), R.shouldCancelNextClick && (R.clickResetTimer = window.setTimeout(() => {
1253
+ const Ne = ne.current;
1254
+ Ne.shouldCancelNextClick = !1, Ne.clickResetTimer = null;
1236
1255
  }, 0));
1237
- const tt = st.current.startVelocityThreshold;
1238
- Y(), p.hasPointerCapture(d.pointerId) && p.releasePointerCapture(d.pointerId), Math.abs(xe) >= tt && mt.current?.(xe);
1239
- }, Ue = (d) => {
1240
- if (J.current.pointerId !== null) {
1241
- if (!d.isPrimary || d.pointerType !== J.current.pointerType)
1256
+ const it = mt.current.startVelocityThreshold;
1257
+ H(), f.hasPointerCapture(p.pointerId) && f.releasePointerCapture(p.pointerId), Math.abs(ae) >= it && Ge.current?.(ae);
1258
+ }, rt = (p) => {
1259
+ if (ne.current.pointerId !== null) {
1260
+ if (!p.isPrimary || p.pointerType !== ne.current.pointerType)
1242
1261
  return;
1243
- Je(J.current.pointerId);
1262
+ Re(ne.current.pointerId);
1244
1263
  }
1245
- if (J.current.shouldCancelNextClick && (te(), J.current.shouldCancelNextClick = !1), !(Ze.current && Le.current) || !Wt(d.pointerType, ht.current) || d.button !== 0 && d.pointerType === "mouse" || d.ctrlKey || d.metaKey || d.altKey || j(d.target))
1264
+ if (ne.current.shouldCancelNextClick && (J(), ne.current.shouldCancelNextClick = !1), !(V.current && je.current) || !Qt(p.pointerType, ot.current) || p.button !== 0 && p.pointerType === "mouse" || p.ctrlKey || p.metaKey || p.altKey || ee(p.target))
1246
1265
  return;
1247
- window.dispatchEvent(new CustomEvent(Gt, { detail: { paneId: vt } })), Te.current?.();
1248
- const y = J.current;
1249
- te(), y.pointerId = d.pointerId, y.pointerType = d.pointerType, y.startClientY = d.clientY, y.startScroll = C.current, y.isDragging = !1, y.shouldCancelNextClick = !1, y.velocitySamples = [];
1250
- }, Ve = (d) => {
1251
- if (J.current.pointerId !== d.pointerId) {
1252
- ae();
1266
+ window.dispatchEvent(new CustomEvent(tr, { detail: { paneId: N } })), j.current?.();
1267
+ const R = ne.current;
1268
+ J(), R.pointerId = p.pointerId, R.pointerType = p.pointerType, R.startClientY = p.clientY, R.startScroll = A.current, R.isDragging = !1, R.shouldCancelNextClick = !1, R.velocitySamples = [];
1269
+ }, Le = (p) => {
1270
+ if (ne.current.pointerId !== p.pointerId) {
1271
+ me();
1253
1272
  return;
1254
1273
  }
1255
- ne(d) && Je(d.pointerId);
1256
- }, Qe = [
1257
- ["click", re, !0],
1258
- ["pointerdown", Ue, { passive: !1 }],
1259
- ["lostpointercapture", (d) => {
1260
- d.target !== p || J.current.pointerId !== d.pointerId || Je(d.pointerId);
1274
+ $(p) && Re(p.pointerId);
1275
+ }, Me = [
1276
+ ["click", xe, !0],
1277
+ ["pointerdown", rt, { passive: !1 }],
1278
+ ["lostpointercapture", (p) => {
1279
+ p.target !== f || ne.current.pointerId !== p.pointerId || Re(p.pointerId);
1261
1280
  }, void 0]
1262
- ], ot = [
1263
- ["pointermove", Oe, { passive: !1 }],
1264
- ["pointerup", ve, void 0],
1265
- ["pointercancel", Ve, void 0]
1281
+ ], nt = [
1282
+ ["pointermove", Ce, { passive: !1 }],
1283
+ ["pointerup", Ee, void 0],
1284
+ ["pointercancel", Le, void 0]
1266
1285
  ];
1267
- return kt(p, Qe, "add"), kt(window, ot, "add"), () => {
1268
- kt(p, Qe, "remove"), kt(window, ot, "remove");
1269
- const d = J.current;
1270
- d.pointerId !== null && p.hasPointerCapture(d.pointerId) && p.releasePointerCapture(d.pointerId), te(), Y();
1286
+ return qt(f, Me, "add"), qt(window, nt, "add"), () => {
1287
+ qt(f, Me, "remove"), qt(window, nt, "remove");
1288
+ const p = ne.current;
1289
+ p.pointerId !== null && f.hasPointerCapture(p.pointerId) && f.releasePointerCapture(p.pointerId), J(), H();
1271
1290
  };
1272
- }, [vt]);
1273
- const ie = S(
1274
- (p) => (be(), Ae(p)),
1275
- [Ae, be]
1291
+ }, [N]);
1292
+ const Ae = S(
1293
+ (f) => (Se(), ze(f)),
1294
+ [ze, Se]
1276
1295
  );
1277
- return /* @__PURE__ */ Mt("div", { ref: v, "data-testid": V, "data-self-measured": ge ? "true" : void 0, className: Et("aqvs-scroll-pane", w), style: h, children: [
1278
- /* @__PURE__ */ Mt(
1296
+ return /* @__PURE__ */ Tt("div", { ref: I, "data-testid": C, "data-self-measured": fe ? "true" : void 0, className: Vt("aqvs-scroll-pane", T), style: h, children: [
1297
+ /* @__PURE__ */ Tt(
1279
1298
  "div",
1280
1299
  {
1281
- ref: W,
1282
- className: Et("aqvs-scroll-pane-content"),
1300
+ ref: G,
1301
+ className: Vt("aqvs-scroll-pane-content"),
1283
1302
  "data-testid": "aqvs-scroll-pane-content",
1284
1303
  style: {
1285
1304
  // ❗ 自己計測モードでは高さを書かない。CSS の `height: 100%` (= ルートの確定高さ) が
1286
1305
  // レイアウトを所有することで、「計測した値を書き戻して自分のサイズを変える」
1287
1306
  // フィードバックループが構造的に起こらず、初回 paint の時点でも帯は実寸で正しい
1288
1307
  // (数値の反映だけが 1 コミット遅れる)。明示モードは従来どおり px を書く。
1289
- height: ge ? void 0 : X,
1290
- paddingTop: je.top,
1291
- paddingBottom: je.bottom,
1308
+ height: fe ? void 0 : z,
1309
+ paddingTop: Ke.top,
1310
+ paddingBottom: Ke.bottom,
1292
1311
  // スクロール不能時 (contentSize <= viewportSize) は touch-action を通常に戻し、
1293
1312
  // 短いリスト上のタッチがページ全体のパンを妨げるデッドゾーン化を防ぐ。
1294
1313
  // 直接操作 (指・ペン) のドラッグを許可していない場合も付けない。
@@ -1302,102 +1321,102 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
1302
1321
  // 同一条件で揃えてあるため状態としても一貫している。
1303
1322
  // 非同期コンテンツを先読みして確保する挙動は意図的に入れていない
1304
1323
  // (空のペインがページのパンを殺すデッドゾーンになり、そちらの実害の方が大きいため)。
1305
- ...f && K && b.some((p) => p === "touch" || p === "pen") ? { touchAction: "none" } : {}
1324
+ ...m && Pe && b.some((f) => f === "touch" || f === "pen") ? { touchAction: "none" } : {}
1306
1325
  },
1307
- ...U,
1308
- id: E,
1326
+ ...K,
1327
+ id: gt,
1309
1328
  children: [
1310
- z,
1311
- r(C.current)
1329
+ O,
1330
+ r(A.current)
1312
1331
  ]
1313
1332
  }
1314
1333
  ),
1315
- /* @__PURE__ */ de(
1316
- kr,
1334
+ /* @__PURE__ */ ie(
1335
+ Kr,
1317
1336
  {
1318
1337
  contentSize: e,
1319
- viewportSize: X,
1320
- scrollPosition: C.current,
1321
- onScroll: ie,
1338
+ viewportSize: z,
1339
+ scrollPosition: A.current,
1340
+ onScroll: Ae,
1322
1341
  enableThumbDrag: s,
1323
- enableTrackClick: a,
1324
- enableArrowButtons: c,
1342
+ enableTrackClick: l,
1343
+ enableArrowButtons: d,
1325
1344
  scrollBarWidth: i,
1326
- ariaControls: E,
1327
- tapScrollCircleOptions: G,
1328
- itemCount: pe,
1329
- renderThumbOverlay: me,
1330
- visibleStartIndex: _,
1331
- visibleEndIndex: M
1345
+ ariaControls: gt,
1346
+ tapScrollCircleOptions: W,
1347
+ itemCount: ce,
1348
+ renderThumbOverlay: ue,
1349
+ visibleStartIndex: Y,
1350
+ visibleEndIndex: w
1332
1351
  },
1333
1352
  "scrollbar"
1334
1353
  ),
1335
1354
  Z?.()
1336
1355
  ] });
1337
1356
  }
1338
- ), ar = (r, e, t) => Math.min(Math.max(r, e), t), an = ({ dragState: r, normalizedDistance: e, sizeScale: t, size: n }) => {
1339
- const i = Math.max(n / 2, 1), s = 1 + e * 0.65, a = Math.max(0.65, 1 - e * 0.25), c = r.direction * e * 26 * t, f = 0.8 + e * 0.18, b = 3 * t, I = 6 * t, w = 22 * t, V = Math.abs(c) + I, h = c > 0 ? b : -Math.abs(c) - b, z = Math.max(2.5, 3 * t), G = ar(r.offsetX, -i, i), H = ar(r.offsetY, -i, i), pe = i * 0.35, me = G / i * pe, oe = H / i * pe, ce = me * 0.45, he = oe * 0.45, P = Math.max(w * 0.38, 6), _ = 0.65 + e * 0.2, M = r.active;
1340
- return /* @__PURE__ */ Mt(dr, { children: [
1341
- /* @__PURE__ */ de(
1357
+ ), br = (r, e, t) => Math.min(Math.max(r, e), t), xn = ({ dragState: r, normalizedDistance: e, sizeScale: t, size: n }) => {
1358
+ const i = Math.max(n / 2, 1), s = 1 + e * 0.65, l = Math.max(0.65, 1 - e * 0.25), d = r.direction * e * 26 * t, m = 0.8 + e * 0.18, b = 3 * t, v = 6 * t, T = 22 * t, C = Math.abs(d) + v, h = d > 0 ? b : -Math.abs(d) - b, O = Math.max(2.5, 3 * t), W = br(r.offsetX, -i, i), D = br(r.offsetY, -i, i), ce = i * 0.35, ue = W / i * ce, re = D / i * ce, oe = ue * 0.45, de = re * 0.45, y = Math.max(T * 0.38, 6), Y = 0.65 + e * 0.2, w = r.active;
1359
+ return /* @__PURE__ */ Tt(rr, { children: [
1360
+ /* @__PURE__ */ ie(
1342
1361
  "div",
1343
1362
  {
1344
1363
  className: "aqvs-tap-scroll-circle-gradient",
1345
1364
  style: {
1346
- transform: `scale(${a}, ${s})`,
1347
- transition: M ? "40ms transform ease-out" : "200ms ease transform"
1365
+ transform: `scale(${l}, ${s})`,
1366
+ transition: w ? "40ms transform ease-out" : "200ms ease transform"
1348
1367
  }
1349
1368
  }
1350
1369
  ),
1351
- /* @__PURE__ */ de(
1370
+ /* @__PURE__ */ ie(
1352
1371
  "div",
1353
1372
  {
1354
1373
  className: "aqvs-sample-visual-pupil",
1355
1374
  style: {
1356
- width: w,
1357
- height: w,
1358
- transform: `translate(calc(-50% + ${me}px), calc(-50% + ${oe}px)) scale(${a}, ${f * s})`,
1359
- transition: M ? "70ms transform ease-out" : "200ms ease transform"
1375
+ width: T,
1376
+ height: T,
1377
+ transform: `translate(calc(-50% + ${ue}px), calc(-50% + ${re}px)) scale(${l}, ${m * s})`,
1378
+ transition: w ? "70ms transform ease-out" : "200ms ease transform"
1360
1379
  }
1361
1380
  }
1362
1381
  ),
1363
- /* @__PURE__ */ de(
1382
+ /* @__PURE__ */ ie(
1364
1383
  "div",
1365
1384
  {
1366
1385
  className: "aqvs-sample-visual-highlight",
1367
1386
  style: {
1368
- width: P,
1369
- height: P,
1370
- transform: `translate(calc(-50% + ${ce}px), calc(-50% + ${he}px)) scale(${a}, ${s})`,
1371
- opacity: _,
1387
+ width: y,
1388
+ height: y,
1389
+ transform: `translate(calc(-50% + ${oe}px), calc(-50% + ${de}px)) scale(${l}, ${s})`,
1390
+ opacity: Y,
1372
1391
  boxShadow: "0 0 8px rgba(255,255,255,0.45)",
1373
- transition: M ? "120ms opacity 150ms, 120ms transform ease-out ease-out" : "220ms ease transform, 240ms opacity ease"
1392
+ transition: w ? "120ms opacity 150ms, 120ms transform ease-out ease-out" : "220ms ease transform, 240ms opacity ease"
1374
1393
  }
1375
1394
  }
1376
1395
  ),
1377
- /* @__PURE__ */ de(
1396
+ /* @__PURE__ */ ie(
1378
1397
  "div",
1379
1398
  {
1380
1399
  className: "aqvs-sample-visual-rod",
1381
1400
  style: {
1382
- width: z,
1383
- height: V,
1401
+ width: O,
1402
+ height: C,
1384
1403
  transform: `translate(-50%, ${h}px)`,
1385
1404
  opacity: e,
1386
- transition: M ? "40ms height, 60ms opacity ease-out ease-out" : "200ms ease height, 120ms ease opacity"
1405
+ transition: w ? "40ms height, 60ms opacity ease-out ease-out" : "200ms ease height, 120ms ease opacity"
1387
1406
  }
1388
1407
  }
1389
1408
  )
1390
1409
  ] });
1391
- }, Ft = 100, $r = (r) => {
1410
+ }, Xt = 100, tn = (r) => {
1392
1411
  if (!Number.isFinite(r))
1393
1412
  return 0n;
1394
1413
  const e = Math.trunc(r);
1395
1414
  return e <= 0 ? 0n : BigInt(e);
1396
- }, Kt = (r, e) => {
1415
+ }, Jt = (r, e) => {
1397
1416
  if (!Number.isFinite(r))
1398
1417
  throw new Error(`valueFn returned a non-finite value at index ${e}: ${r}`);
1399
1418
  return r;
1400
- }, Rt = (r) => {
1419
+ }, Nt = (r) => {
1401
1420
  if (r <= 0 || !Number.isFinite(r))
1402
1421
  return 0;
1403
1422
  const e = Math.trunc(r);
@@ -1470,27 +1489,27 @@ class St {
1470
1489
  this.size = i, this.tree = /* @__PURE__ */ new Map(), this.deltas = /* @__PURE__ */ new Map(), this.valueFn = void 0, this.baseValue = t, this.total = this.baseValue * this.size;
1471
1490
  return;
1472
1491
  }
1473
- let s = 0, a;
1492
+ let s = 0, l;
1474
1493
  if (i > 0) {
1475
- const c = n?.sampleRange ?? {
1494
+ const d = n?.sampleRange ?? {
1476
1495
  from: 0,
1477
- to: Math.min(Ft - 1, i - 1)
1496
+ to: Math.min(Xt - 1, i - 1)
1478
1497
  };
1479
- let f = Math.max(0, Math.trunc(c.from)), b = Math.min(Math.trunc(c.to), i - 1);
1480
- if (f > b && (f = 0, b = Math.min(Ft - 1, i - 1)), i > Ft)
1481
- s = St._sampleBaseValueStrided(t, i, Ft), n?.materialize && (a = { from: f, values: St._collectValidatedValues(t, f, b) });
1498
+ let m = Math.max(0, Math.trunc(d.from)), b = Math.min(Math.trunc(d.to), i - 1);
1499
+ if (m > b && (m = 0, b = Math.min(Xt - 1, i - 1)), i > Xt)
1500
+ s = St._sampleBaseValueStrided(t, i, Xt), n?.materialize && (l = { from: m, values: St._collectValidatedValues(t, m, b) });
1482
1501
  else {
1483
- const I = St._collectValidatedValues(t, f, b);
1484
- s = St._modeOrMedian([...I]), n?.materialize && (a = { from: f, values: I });
1502
+ const v = St._collectValidatedValues(t, m, b);
1503
+ s = St._modeOrMedian([...v]), n?.materialize && (l = { from: m, values: v });
1485
1504
  }
1486
1505
  }
1487
- if (this.size = i, this.tree = /* @__PURE__ */ new Map(), this.deltas = /* @__PURE__ */ new Map(), this.total = void 0, this.valueFn = t, this.baseValue = s, a)
1488
- for (let c = 0; c < a.values.length; c++) {
1489
- const f = a.from + c;
1490
- if (f >= this.size)
1506
+ if (this.size = i, this.tree = /* @__PURE__ */ new Map(), this.deltas = /* @__PURE__ */ new Map(), this.total = void 0, this.valueFn = t, this.baseValue = s, l)
1507
+ for (let d = 0; d < l.values.length; d++) {
1508
+ const m = l.from + d;
1509
+ if (m >= this.size)
1491
1510
  break;
1492
- const b = a.values[c] - this.baseValue;
1493
- b !== 0 && (this.deltas.set(f, b), this._updateTree(f, b));
1511
+ const b = l.values[d] - this.baseValue;
1512
+ b !== 0 && (this.deltas.set(m, b), this._updateTree(m, b));
1494
1513
  }
1495
1514
  this.total = this.getTotal();
1496
1515
  }
@@ -1521,7 +1540,7 @@ class St {
1521
1540
  static _collectValidatedValues(e, t, n) {
1522
1541
  const i = [];
1523
1542
  for (let s = t; s <= n; s++)
1524
- i.push(Kt(e(s), s));
1543
+ i.push(Jt(e(s), s));
1525
1544
  return i;
1526
1545
  }
1527
1546
  /**
@@ -1535,22 +1554,22 @@ class St {
1535
1554
  static _modeOrMedian(e) {
1536
1555
  if (e.length === 0)
1537
1556
  return 0;
1538
- e.sort((a, c) => a - c);
1557
+ e.sort((l, d) => l - d);
1539
1558
  const t = Math.floor(e.length / 2);
1540
1559
  let n;
1541
1560
  e.length % 2 === 0 ? n = Math.floor((e[t - 1] + e[t]) / 2) : n = e[t];
1542
1561
  const i = /* @__PURE__ */ new Map();
1543
1562
  let s = 0;
1544
- for (const a of e) {
1545
- const c = (i.get(a) ?? 0) + 1;
1546
- i.set(a, c), c > s && (s = c);
1563
+ for (const l of e) {
1564
+ const d = (i.get(l) ?? 0) + 1;
1565
+ i.set(l, d), d > s && (s = d);
1547
1566
  }
1548
1567
  if (s > e.length * 0.2) {
1549
- const a = [];
1550
- for (const [f, b] of i.entries())
1551
- b === s && a.push(f);
1552
- const c = a.reduce((f, b) => f + b, 0);
1553
- n = Math.floor(c / a.length);
1568
+ const l = [];
1569
+ for (const [m, b] of i.entries())
1570
+ b === s && l.push(m);
1571
+ const d = l.reduce((m, b) => m + b, 0);
1572
+ n = Math.floor(d / l.length);
1554
1573
  }
1555
1574
  return n;
1556
1575
  }
@@ -1570,8 +1589,8 @@ class St {
1570
1589
  let i = Math.max(1, Math.ceil(t / n));
1571
1590
  i % 2 === 0 && (i += 1);
1572
1591
  const s = [];
1573
- for (let a = 0; a < t && s.length < n; a += i)
1574
- s.push(Kt(e(a), a));
1592
+ for (let l = 0; l < t && s.length < n; l += i)
1593
+ s.push(Jt(e(l), l));
1575
1594
  return St._modeOrMedian(s);
1576
1595
  }
1577
1596
  /**
@@ -1619,14 +1638,14 @@ class St {
1619
1638
  throw new Error(`Index must be an integer: ${n}`);
1620
1639
  if (!Number.isFinite(i))
1621
1640
  throw new Error(`Change must be a finite number: ${i}`);
1622
- const a = (t.get(n) ?? this.deltas.get(n) ?? 0) + i;
1623
- if (a + this.baseValue < -1e-9)
1624
- throw new Error(`Change would make the value at index ${n} negative: ${a + this.baseValue}`);
1625
- t.set(n, a);
1641
+ const l = (t.get(n) ?? this.deltas.get(n) ?? 0) + i;
1642
+ if (l + this.baseValue < -1e-9)
1643
+ throw new Error(`Change would make the value at index ${n} negative: ${l + this.baseValue}`);
1644
+ t.set(n, l);
1626
1645
  }
1627
1646
  for (const { index: n, change: i } of e) {
1628
- const a = (this.deltas.get(n) ?? 0) + i;
1629
- a === 0 ? this.deltas.delete(n) : this.deltas.set(n, a), this._updateTree(n, i);
1647
+ const l = (this.deltas.get(n) ?? 0) + i;
1648
+ l === 0 ? this.deltas.delete(n) : this.deltas.set(n, l), this._updateTree(n, i);
1630
1649
  }
1631
1650
  return this.total;
1632
1651
  }
@@ -1644,7 +1663,7 @@ class St {
1644
1663
  let n = e + 1;
1645
1664
  for (; n <= this.size; ) {
1646
1665
  this.tree.set(n, (this.tree.get(n) ?? 0) + t);
1647
- const i = Rt(n);
1666
+ const i = Nt(n);
1648
1667
  if (i === 0)
1649
1668
  break;
1650
1669
  n += i;
@@ -1670,8 +1689,8 @@ class St {
1670
1689
  throw new Error(`Value must be a finite number: ${s}`);
1671
1690
  if (s < 0)
1672
1691
  throw new Error("Value cannot be negative.");
1673
- const a = n.has(i) ? n.get(i) ?? 0 : this.deltas.get(i) ?? 0, c = a + this.baseValue, f = s - c;
1674
- f !== 0 && t.push({ index: i, change: f }), n.set(i, a + f);
1692
+ const l = n.has(i) ? n.get(i) ?? 0 : this.deltas.get(i) ?? 0, d = l + this.baseValue, m = s - d;
1693
+ m !== 0 && t.push({ index: i, change: m }), n.set(i, l + m);
1675
1694
  }
1676
1695
  return t;
1677
1696
  }
@@ -1688,7 +1707,7 @@ class St {
1688
1707
  let e = 0, t = this.size;
1689
1708
  for (; t > 0; ) {
1690
1709
  e += this.tree.get(t) ?? 0;
1691
- const n = Rt(t);
1710
+ const n = Nt(t);
1692
1711
  if (n === 0)
1693
1712
  break;
1694
1713
  t -= n;
@@ -1705,10 +1724,10 @@ class St {
1705
1724
  */
1706
1725
  _materialize(e, t = !0) {
1707
1726
  if (this.valueFn) {
1708
- const n = this.deltas.get(e) ?? 0, s = Kt(this.valueFn(e), e) - this.baseValue;
1727
+ const n = this.deltas.get(e) ?? 0, s = Jt(this.valueFn(e), e) - this.baseValue;
1709
1728
  if (s !== n && (s === 0 ? this.deltas.delete(e) : this.deltas.set(e, s), t)) {
1710
- const a = s - n;
1711
- this._updateTree(e, a);
1729
+ const l = s - n;
1730
+ this._updateTree(e, l);
1712
1731
  }
1713
1732
  }
1714
1733
  }
@@ -1726,10 +1745,10 @@ class St {
1726
1745
  return;
1727
1746
  const i = e.ranges;
1728
1747
  if (i && i.length > 0) {
1729
- for (const c of i) {
1730
- const f = Math.max(0, Math.trunc(c.from)), b = Math.min(Math.trunc(c.to), this.size - 1);
1731
- for (let I = f; I <= b; I++)
1732
- this._materialize(I);
1748
+ for (const d of i) {
1749
+ const m = Math.max(0, Math.trunc(d.from)), b = Math.min(Math.trunc(d.to), this.size - 1);
1750
+ for (let v = m; v <= b; v++)
1751
+ this._materialize(v);
1733
1752
  }
1734
1753
  if (t === void 0)
1735
1754
  return;
@@ -1737,8 +1756,8 @@ class St {
1737
1756
  this._materialize(t);
1738
1757
  return;
1739
1758
  }
1740
- const s = i[0].from, a = i[i.length - 1].to;
1741
- t >= s && t <= a && this._materialize(t);
1759
+ const s = i[0].from, l = i[i.length - 1].to;
1760
+ t >= s && t <= l && this._materialize(t);
1742
1761
  return;
1743
1762
  }
1744
1763
  t !== void 0 && this._materialize(t);
@@ -1766,17 +1785,17 @@ class St {
1766
1785
  return { index: -1, total: this.total ?? this.getTotal(), cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
1767
1786
  if (!i)
1768
1787
  break;
1769
- const c = this.deltas.get(s) ?? 0;
1770
- if (this._materialize(s), (this.deltas.get(s) ?? 0) === c)
1788
+ const d = this.deltas.get(s) ?? 0;
1789
+ if (this._materialize(s), (this.deltas.get(s) ?? 0) === d)
1771
1790
  break;
1772
1791
  }
1773
- const a = this.prefixSum(s);
1792
+ const l = this.prefixSum(s);
1774
1793
  return {
1775
1794
  index: s,
1776
- total: this.total ?? a.total,
1777
- cumulative: a.cumulative,
1778
- currentValue: a.currentValue,
1779
- safeIndex: a.safeIndex
1795
+ total: this.total ?? l.total,
1796
+ cumulative: l.cumulative,
1797
+ currentValue: l.currentValue,
1798
+ safeIndex: l.safeIndex
1780
1799
  };
1781
1800
  }
1782
1801
  /**
@@ -1793,10 +1812,10 @@ class St {
1793
1812
  for (; s << 1 <= this.size; )
1794
1813
  s <<= 1;
1795
1814
  for (; s > 0; s >>= 1) {
1796
- const a = n + s;
1797
- if (a <= this.size) {
1798
- const f = (this.tree.get(a) ?? 0) + this.baseValue * s;
1799
- (t ? i + f < e : i + f <= e) && (n = a, i += f);
1815
+ const l = n + s;
1816
+ if (l <= this.size) {
1817
+ const m = (this.tree.get(l) ?? 0) + this.baseValue * s;
1818
+ (t ? i + m < e : i + m <= e) && (n = l, i += m);
1800
1819
  }
1801
1820
  }
1802
1821
  return t ? n : n - 1;
@@ -1809,42 +1828,42 @@ class St {
1809
1828
  _findIndexLarge(e, t, n) {
1810
1829
  if (this.size === 0)
1811
1830
  return { index: -1, total: this.total ?? 0, cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
1812
- const i = $r(this.size);
1831
+ const i = tn(this.size);
1813
1832
  if (i === 0n)
1814
1833
  return { index: -1, total: this.total ?? 0, cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
1815
1834
  this._materializeRanges(t.materializeOption);
1816
1835
  const s = t.materializeOption?.materialize === !0;
1817
1836
  for (; ; ) {
1818
- let a = 0n, c = i - 1n, f, b, I = this.total;
1819
- for (; a <= c; ) {
1820
- const h = a + c >> 1n, z = Number(h), G = this.prefixSum(z);
1821
- if (I = G.total, n ? G.cumulative >= e : G.cumulative <= e)
1822
- if (f = h, b = G, n) {
1837
+ let l = 0n, d = i - 1n, m, b, v = this.total;
1838
+ for (; l <= d; ) {
1839
+ const h = l + d >> 1n, O = Number(h), W = this.prefixSum(O);
1840
+ if (v = W.total, n ? W.cumulative >= e : W.cumulative <= e)
1841
+ if (m = h, b = W, n) {
1823
1842
  if (h === 0n)
1824
1843
  break;
1825
- c = h - 1n;
1844
+ d = h - 1n;
1826
1845
  } else
1827
- a = h + 1n;
1846
+ l = h + 1n;
1828
1847
  else if (n)
1829
- a = h + 1n;
1848
+ l = h + 1n;
1830
1849
  else {
1831
1850
  if (h === 0n)
1832
1851
  break;
1833
- c = h - 1n;
1852
+ d = h - 1n;
1834
1853
  }
1835
1854
  }
1836
- const w = b, V = f !== void 0 ? Number(f) : -1;
1837
- if (s && V >= 0) {
1838
- const h = this.deltas.get(V) ?? 0;
1839
- if (this._materialize(V), (this.deltas.get(V) ?? 0) !== h)
1855
+ const T = b, C = m !== void 0 ? Number(m) : -1;
1856
+ if (s && C >= 0) {
1857
+ const h = this.deltas.get(C) ?? 0;
1858
+ if (this._materialize(C), (this.deltas.get(C) ?? 0) !== h)
1840
1859
  continue;
1841
1860
  }
1842
1861
  return {
1843
- index: V,
1844
- total: I,
1845
- cumulative: w?.cumulative,
1846
- currentValue: w?.currentValue,
1847
- safeIndex: w?.safeIndex
1862
+ index: C,
1863
+ total: v,
1864
+ cumulative: T?.cumulative,
1865
+ currentValue: T?.currentValue,
1866
+ safeIndex: T?.safeIndex
1848
1867
  };
1849
1868
  }
1850
1869
  }
@@ -1861,19 +1880,19 @@ class St {
1861
1880
  return { cumulative: 0, total: this.total, currentValue: 0, safeIndex: 0 };
1862
1881
  if (this.size === 0)
1863
1882
  return { cumulative: 0, total: this.total ?? 0, currentValue: 0, safeIndex: 0 };
1864
- const n = le(Math.trunc(e), 0, this.size - 1), i = t?.materializeOption;
1883
+ const n = se(Math.trunc(e), 0, this.size - 1), i = t?.materializeOption;
1865
1884
  this._materializeRanges(i, n, !0);
1866
- let s = 0, a = n + 1;
1867
- for (; a > 0; ) {
1868
- const f = this.tree.get(a) ?? 0;
1869
- s += f;
1870
- const b = Rt(a);
1885
+ let s = 0, l = n + 1;
1886
+ for (; l > 0; ) {
1887
+ const m = this.tree.get(l) ?? 0;
1888
+ s += m;
1889
+ const b = Nt(l);
1871
1890
  if (b === 0)
1872
1891
  break;
1873
- a -= b;
1892
+ l -= b;
1874
1893
  }
1875
- const c = i?.materialize ? this.get(n) : (this.deltas.get(n) || 0) + this.baseValue;
1876
- return { cumulative: s + this.baseValue * (n + 1), total: this.total, currentValue: c, safeIndex: n };
1894
+ const d = i?.materialize ? this.get(n) : (this.deltas.get(n) || 0) + this.baseValue;
1895
+ return { cumulative: s + this.baseValue * (n + 1), total: this.total, currentValue: d, safeIndex: n };
1877
1896
  }
1878
1897
  /**
1879
1898
  * @method get
@@ -1906,7 +1925,7 @@ class St {
1906
1925
  else {
1907
1926
  this.total = this._computeTreeTotal();
1908
1927
  const n = this.prefixSum(this.getSize() - 1);
1909
- n.cumulative !== n.total && T.error("Inconsistent Fenwick Tree state");
1928
+ n.cumulative !== n.total && P.error("Inconsistent Fenwick Tree state");
1910
1929
  }
1911
1930
  return this.total;
1912
1931
  }
@@ -1930,10 +1949,10 @@ class St {
1930
1949
  let s = n + 1;
1931
1950
  for (; s <= this.size; ) {
1932
1951
  t.set(s, (t.get(s) ?? 0) + i);
1933
- const a = Rt(s);
1934
- if (a === 0)
1952
+ const l = Nt(s);
1953
+ if (l === 0)
1935
1954
  break;
1936
- s += a;
1955
+ s += l;
1937
1956
  }
1938
1957
  }
1939
1958
  this.tree = t, this.total = this._computeTreeTotal();
@@ -2013,7 +2032,7 @@ class St {
2013
2032
  this.size = t, this.rebuildTree();
2014
2033
  }
2015
2034
  const i = this.prefixSum(this.getSize() - 1);
2016
- i.cumulative !== i.total && T.error("Inconsistent Fenwick Tree state");
2035
+ i.cumulative !== i.total && P.error("Inconsistent Fenwick Tree state");
2017
2036
  }
2018
2037
  /**
2019
2038
  * @private
@@ -2047,17 +2066,17 @@ class St {
2047
2066
  _propagateDeltaToGrownNodes(e, t, n, i) {
2048
2067
  let s = e + 1;
2049
2068
  for (; s <= n; ) {
2050
- const a = Rt(s);
2051
- if (a === 0)
2069
+ const l = Nt(s);
2070
+ if (l === 0)
2052
2071
  break;
2053
- s += a;
2072
+ s += l;
2054
2073
  }
2055
2074
  for (; s <= i; ) {
2056
2075
  this.tree.set(s, (this.tree.get(s) ?? 0) + t);
2057
- const a = Rt(s);
2058
- if (a === 0)
2076
+ const l = Nt(s);
2077
+ if (l === 0)
2059
2078
  break;
2060
- s += a;
2079
+ s += l;
2061
2080
  }
2062
2081
  }
2063
2082
  /**
@@ -2073,12 +2092,12 @@ class St {
2073
2092
  const n = St._minCoveredLowBound(e, t);
2074
2093
  if (e - n < this.deltas.size)
2075
2094
  for (let s = n; s < e; s++) {
2076
- const a = this.deltas.get(s);
2077
- a === void 0 || a === 0 || this._propagateDeltaToGrownNodes(s, a, e, t);
2095
+ const l = this.deltas.get(s);
2096
+ l === void 0 || l === 0 || this._propagateDeltaToGrownNodes(s, l, e, t);
2078
2097
  }
2079
2098
  else
2080
- for (const [s, a] of this.deltas.entries())
2081
- a === 0 || s < n || this._propagateDeltaToGrownNodes(s, a, e, t);
2099
+ for (const [s, l] of this.deltas.entries())
2100
+ l === 0 || s < n || this._propagateDeltaToGrownNodes(s, l, e, t);
2082
2101
  }
2083
2102
  this.total = this._computeTreeTotal();
2084
2103
  }
@@ -2148,20 +2167,20 @@ class St {
2148
2167
  return this._findIndex(e, t ?? {}, !1);
2149
2168
  }
2150
2169
  }
2151
- const Ur = (r, e) => {
2170
+ const rn = (r, e) => {
2152
2171
  const t = r?.sampleRange, n = e?.sampleRange;
2153
2172
  return t === n ? !1 : t && n ? t.from !== n.from || t.to !== n.to : !0;
2154
- }, Wr = (r, e, t) => {
2173
+ }, nn = (r, e, t) => {
2155
2174
  const n = Number.isFinite(r) && r > 0 ? Math.trunc(r) : 0, i = g(null), s = g({ size: n, valueOrFn: e, options: t });
2156
2175
  i.current === null && (i.current = new St(n, e, t));
2157
- const a = i.current, c = s.current, f = c.size !== n, b = c.valueOrFn !== e, I = Ur(c.options, t), w = c.size === 0 && n > 0 && (!i.current || i.current.base === 0);
2158
- if (b || I) {
2159
- const V = t?.resetOnValueFnChange ?? !0;
2160
- I || b && V || w ? (t?.debug && T.debug("[useFenwickMapTree] reset", { valueOrFnChanged: b, optionsChanged: I }), a.reset(n, e, t)) : (f && (t?.debug && T.debug("[useFenwickMapTree] resize (with valueFn change)", { from: c.size, to: n }), a.changeSize(n)), t?.debug && T.debug("[useFenwickMapTree] setValueFn (no reset)", { valueOrFnChanged: b }), a.setValueFn(e, { reset: !1 })), s.current = { size: n, valueOrFn: e, options: t };
2161
- } else f && (t?.debug && T.debug("[useFenwickMapTree] resize", { from: c.size, to: n }), w ? a.reset(n, e, t) : a.changeSize(n), s.current = { size: n, valueOrFn: e, options: t });
2162
- return a;
2176
+ const l = i.current, d = s.current, m = d.size !== n, b = d.valueOrFn !== e, v = rn(d.options, t), T = d.size === 0 && n > 0 && (!i.current || i.current.base === 0);
2177
+ if (b || v) {
2178
+ const C = t?.resetOnValueFnChange ?? !0;
2179
+ v || b && C || T ? (t?.debug && P.debug("[useFenwickMapTree] reset", { valueOrFnChanged: b, optionsChanged: v }), l.reset(n, e, t)) : (m && (t?.debug && P.debug("[useFenwickMapTree] resize (with valueFn change)", { from: d.size, to: n }), l.changeSize(n)), t?.debug && P.debug("[useFenwickMapTree] setValueFn (no reset)", { valueOrFnChanged: b }), l.setValueFn(e, { reset: !1 })), s.current = { size: n, valueOrFn: e, options: t };
2180
+ } else m && (t?.debug && P.debug("[useFenwickMapTree] resize", { from: d.size, to: n }), T ? l.reset(n, e, t) : l.changeSize(n), s.current = { size: n, valueOrFn: e, options: t });
2181
+ return l;
2163
2182
  };
2164
- class Kr {
2183
+ class sn {
2165
2184
  key;
2166
2185
  value;
2167
2186
  prev = null;
@@ -2170,7 +2189,7 @@ class Kr {
2170
2189
  this.key = e, this.value = t;
2171
2190
  }
2172
2191
  }
2173
- class jt {
2192
+ class er {
2174
2193
  head = null;
2175
2194
  tail = null;
2176
2195
  /**
@@ -2211,180 +2230,180 @@ class jt {
2211
2230
  this.remove(e), this.addToTail(e);
2212
2231
  }
2213
2232
  }
2214
- function jr(r) {
2215
- const e = g(/* @__PURE__ */ new Map()), t = g(new jt()), n = Math.floor(r), i = g(n);
2216
- q(() => {
2233
+ function on(r) {
2234
+ const e = g(/* @__PURE__ */ new Map()), t = g(new er()), n = Math.floor(r), i = g(n);
2235
+ X(() => {
2217
2236
  if (i.current = n, Number.isNaN(n) || n < 0) {
2218
- T.warn(`useLruCache: invalid capacity ${r}; the cache will not store any entries.`), e.current.clear(), t.current = new jt();
2237
+ P.warn(`useLruCache: invalid capacity ${r}; the cache will not store any entries.`), e.current.clear(), t.current = new er();
2219
2238
  return;
2220
2239
  }
2221
2240
  if (Number.isFinite(n))
2222
2241
  for (; e.current.size > n; ) {
2223
- const I = t.current.removeHead();
2224
- if (I)
2225
- e.current.delete(I.key);
2242
+ const v = t.current.removeHead();
2243
+ if (v)
2244
+ e.current.delete(v.key);
2226
2245
  else
2227
2246
  break;
2228
2247
  }
2229
2248
  }, [r, n]);
2230
- const s = S((I) => {
2231
- const w = e.current.get(I);
2232
- if (w)
2233
- return t.current.moveToTail(w), w.value;
2234
- }, []), a = S((I, w) => {
2235
- const V = i.current;
2236
- if (Number.isNaN(V) || V <= 0)
2249
+ const s = S((v) => {
2250
+ const T = e.current.get(v);
2251
+ if (T)
2252
+ return t.current.moveToTail(T), T.value;
2253
+ }, []), l = S((v, T) => {
2254
+ const C = i.current;
2255
+ if (Number.isNaN(C) || C <= 0)
2237
2256
  return;
2238
- let h = e.current.get(I);
2257
+ let h = e.current.get(v);
2239
2258
  if (h)
2240
- h.value = w, t.current.moveToTail(h);
2259
+ h.value = T, t.current.moveToTail(h);
2241
2260
  else {
2242
- if (e.current.size >= V) {
2243
- const z = t.current.removeHead();
2244
- z && e.current.delete(z.key);
2261
+ if (e.current.size >= C) {
2262
+ const O = t.current.removeHead();
2263
+ O && e.current.delete(O.key);
2245
2264
  }
2246
- h = new Kr(I, w), e.current.set(I, h), t.current.addToTail(h);
2265
+ h = new sn(v, T), e.current.set(v, h), t.current.addToTail(h);
2247
2266
  }
2248
- }, []), c = S((I) => e.current.has(I), []), f = S((I) => {
2249
- const w = e.current.get(I);
2250
- w && (t.current.remove(w), e.current.delete(I));
2267
+ }, []), d = S((v) => e.current.has(v), []), m = S((v) => {
2268
+ const T = e.current.get(v);
2269
+ T && (t.current.remove(T), e.current.delete(v));
2251
2270
  }, []), b = S(() => {
2252
- e.current.clear(), t.current = new jt();
2271
+ e.current.clear(), t.current = new er();
2253
2272
  }, []);
2254
- return Fe(() => ({ get: s, set: a, has: c, remove: f, clear: b }), [s, a, c, f, b]);
2273
+ return _e(() => ({ get: s, set: l, has: d, remove: m, clear: b }), [s, l, d, m, b]);
2255
2274
  }
2256
- const Gr = 1e4, ln = () => {
2257
- const { get: r, set: e, has: t, clear: n } = jr(Gr);
2258
- return Fe(() => ({ get: r, set: e, has: t, clear: n }), [r, e, t, n]);
2259
- }, cn = (r, e) => {
2275
+ const an = 1e4, vn = () => {
2276
+ const { get: r, set: e, has: t, clear: n } = on(an);
2277
+ return _e(() => ({ get: r, set: e, has: t, clear: n }), [r, e, t, n]);
2278
+ }, In = (r, e) => {
2260
2279
  const t = g(e), n = g(r);
2261
- nt(() => {
2280
+ et(() => {
2262
2281
  t.current = e, n.current = r;
2263
2282
  }, [e, r]);
2264
2283
  const i = g(/* @__PURE__ */ new WeakMap());
2265
2284
  return S((s) => {
2266
2285
  if (!s || i.current.has(s))
2267
2286
  return;
2268
- const a = (c) => {
2269
- t.current?.enableBridge !== !1 && n.current.current?.applyWheel(c);
2287
+ const l = (d) => {
2288
+ t.current?.enableBridge !== !1 && n.current.current?.applyWheel(d);
2270
2289
  };
2271
- return s.addEventListener("wheel", a, { passive: !1 }), i.current.set(s, a), () => {
2272
- i.current.get(s) === a && (s.removeEventListener("wheel", a), i.current.delete(s));
2290
+ return s.addEventListener("wheel", l, { passive: !1 }), i.current.set(s, l), () => {
2291
+ i.current.get(s) === l && (s.removeEventListener("wheel", l), i.current.delete(s));
2273
2292
  };
2274
2293
  }, []);
2275
- }, Pe = (r, e) => e <= 0 ? 0 : le(r, 0, e - 1), lr = (r) => ({
2294
+ }, Ie = (r, e) => e <= 0 ? 0 : se(r, 0, e - 1), xr = (r) => ({
2276
2295
  top: Math.max(0, r?.top ?? 0),
2277
2296
  bottom: Math.max(0, r?.bottom ?? 0)
2278
- }), Ke = (r, e) => r <= e ? 0 : r - e, Pt = (r, e) => r <= 0 ? 0 : r + e, Yt = 1e3, cr = 2e3, Zr = 1048576, Jr = 40, Dt = (r) => {
2297
+ }), Qe = (r, e) => r <= e ? 0 : r - e, Mt = (r, e) => r <= 0 ? 0 : r + e, $t = 1e3, vr = 2e3, ln = 1048576, cn = 40, kt = (r) => {
2279
2298
  if (!Number.isFinite(r)) return 0n;
2280
2299
  const e = Math.trunc(r);
2281
2300
  return e <= 0 ? 0n : BigInt(e);
2282
- }, Qr = (r, e, t, n, i, s, a, c) => {
2283
- const f = Dt(n);
2284
- if (f === 0n)
2301
+ }, un = (r, e, t, n, i, s, l, d) => {
2302
+ const m = kt(n);
2303
+ if (m === 0n)
2285
2304
  return { renderingStartIndex: 0, renderingEndIndex: 0, visibleStartIndex: 0, visibleEndIndex: 0 };
2286
- const b = (P) => P < 0n ? 0n : P >= f ? f - 1n : P, I = { materializeOption: { materialize: !1 } }, { index: w, cumulative: V } = s.findIndexAtOrAfter(r, I);
2305
+ const b = (y) => y < 0n ? 0n : y >= m ? m - 1n : y, v = { materializeOption: { materialize: !1 } }, { index: T, cumulative: C } = s.findIndexAtOrAfter(r, v);
2287
2306
  let h;
2288
- w === -1 ? h = f - 1n : (V === r ? h = Dt(w + 1) : h = Dt(w), h >= f && (h = f - 1n)), r <= 0 && (h = 0n), c && r >= a && (h = f - 1n);
2289
- const z = (P) => {
2290
- const _ = Number(P);
2291
- if (!Number.isSafeInteger(_))
2307
+ T === -1 ? h = m - 1n : (C === r ? h = kt(T + 1) : h = kt(T), h >= m && (h = m - 1n)), r <= 0 && (h = 0n), d && r >= l && (h = m - 1n);
2308
+ const O = (y) => {
2309
+ const Y = Number(y);
2310
+ if (!Number.isSafeInteger(Y))
2292
2311
  return null;
2293
- const { cumulative: M } = s.prefixSum(_, { materializeOption: { materialize: !1 } });
2294
- if (!Number.isFinite(M))
2312
+ const { cumulative: w } = s.prefixSum(Y, { materializeOption: { materialize: !1 } });
2313
+ if (!Number.isFinite(w))
2295
2314
  return null;
2296
- const { index: Z } = s.findIndexAtOrAfter(M + 0.5, { materializeOption: { materialize: !1 } });
2315
+ const { index: Z } = s.findIndexAtOrAfter(w + 0.5, { materializeOption: { materialize: !1 } });
2297
2316
  if (Z === -1)
2298
2317
  return null;
2299
- const Q = Dt(Z);
2300
- return Q > P ? Q : null;
2301
- }, G = (P) => {
2302
- let _ = 0, M = P, Z = P, Q = 0n, U = 0;
2303
- for (; M < f && _ < e; ) {
2304
- const Se = Number(M), C = i(Se);
2305
- if (_ += C, Z = M, M += 1n, Q += 1n, !Number.isFinite(C) || C < 0)
2318
+ const Q = kt(Z);
2319
+ return Q > y ? Q : null;
2320
+ }, W = (y) => {
2321
+ let Y = 0, w = y, Z = y, Q = 0n, K = 0;
2322
+ for (; w < m && Y < e; ) {
2323
+ const he = Number(w), A = i(he);
2324
+ if (Y += A, Z = w, w += 1n, Q += 1n, !Number.isFinite(A) || A < 0)
2306
2325
  break;
2307
- if (C === 0) {
2308
- if (U += 1, U > Yt) {
2309
- const v = z(Z);
2310
- if (v !== null && v > M)
2311
- M = v, U = 0;
2312
- else if (v !== null && v === M && i(Number(M)) > 0)
2313
- U = 0;
2326
+ if (A === 0) {
2327
+ if (K += 1, K > $t) {
2328
+ const I = O(Z);
2329
+ if (I !== null && I > w)
2330
+ w = I, K = 0;
2331
+ else if (I !== null && I === w && i(Number(w)) > 0)
2332
+ K = 0;
2314
2333
  else
2315
2334
  break;
2316
2335
  }
2317
2336
  } else
2318
- U = 0;
2337
+ K = 0;
2319
2338
  }
2320
- return Q === 0n && (Z = P), { height: _, end: Z };
2339
+ return Q === 0n && (Z = y), { height: Y, end: Z };
2321
2340
  };
2322
- let { height: H, end: pe } = G(h);
2323
- if (H < e && h > 0n) {
2324
- let P = h, _ = H, M = 0;
2325
- for (; P > 0n && _ < e; ) {
2326
- P -= 1n;
2327
- const Q = Number(P), U = i(Q);
2328
- if (_ += U, !Number.isFinite(U) || U < 0)
2341
+ let { height: D, end: ce } = W(h);
2342
+ if (D < e && h > 0n) {
2343
+ let y = h, Y = D, w = 0;
2344
+ for (; y > 0n && Y < e; ) {
2345
+ y -= 1n;
2346
+ const Q = Number(y), K = i(Q);
2347
+ if (Y += K, !Number.isFinite(K) || K < 0)
2329
2348
  break;
2330
- if (U === 0) {
2331
- if (M += 1, M > Yt) {
2332
- const Se = Number(P);
2333
- if (!Number.isSafeInteger(Se))
2349
+ if (K === 0) {
2350
+ if (w += 1, w > $t) {
2351
+ const he = Number(y);
2352
+ if (!Number.isSafeInteger(he))
2334
2353
  break;
2335
- const { cumulative: C } = s.prefixSum(Se, { materializeOption: { materialize: !1 } });
2336
- if (!Number.isFinite(C))
2354
+ const { cumulative: A } = s.prefixSum(he, { materializeOption: { materialize: !1 } });
2355
+ if (!Number.isFinite(A))
2337
2356
  break;
2338
- const { index: v } = s.findIndexAtOrAfter(C - 0.5, { materializeOption: { materialize: !1 } }), W = v === -1 ? -1n : Dt(v);
2339
- if (W >= 0n && W < P)
2340
- P = W + 1n, M = 0;
2341
- else if (W === P && P >= 1n && i(Number(P - 1n)) > 0)
2342
- M = 0;
2357
+ const { index: I } = s.findIndexAtOrAfter(A - 0.5, { materializeOption: { materialize: !1 } }), G = I === -1 ? -1n : kt(I);
2358
+ if (G >= 0n && G < y)
2359
+ y = G + 1n, w = 0;
2360
+ else if (G === y && y >= 1n && i(Number(y - 1n)) > 0)
2361
+ w = 0;
2343
2362
  else
2344
2363
  break;
2345
2364
  }
2346
2365
  } else
2347
- M = 0;
2366
+ w = 0;
2348
2367
  }
2349
- h = b(P);
2350
- const Z = G(h);
2351
- H = Z.height, pe = Z.end;
2368
+ h = b(y);
2369
+ const Z = W(h);
2370
+ D = Z.height, ce = Z.end;
2352
2371
  }
2353
- const me = b(h), oe = b(pe), ce = b(me - BigInt(Math.max(0, t))), he = b(oe + BigInt(Math.max(0, t)));
2372
+ const ue = b(h), re = b(ce), oe = b(ue - BigInt(Math.max(0, t))), de = b(re + BigInt(Math.max(0, t)));
2354
2373
  return {
2355
- renderingStartIndex: Pe(Number(ce), n),
2356
- renderingEndIndex: Pe(Number(he), n),
2357
- visibleStartIndex: Pe(Number(me), n),
2358
- visibleEndIndex: Pe(Number(oe), n)
2374
+ renderingStartIndex: Ie(Number(oe), n),
2375
+ renderingEndIndex: Ie(Number(de), n),
2376
+ visibleStartIndex: Ie(Number(ue), n),
2377
+ visibleEndIndex: Ie(Number(re), n)
2359
2378
  };
2360
- }, en = (r, e, t, n, i, s, a) => {
2379
+ }, dn = (r, e, t, n, i, s, l) => {
2361
2380
  if (n === 0)
2362
2381
  return { renderingStartIndex: 0, renderingEndIndex: 0, visibleStartIndex: 0, visibleEndIndex: 0 };
2363
- const c = Number.isFinite(a), f = c ? Math.min(Math.max(0, r), a) : Math.max(0, r);
2382
+ const d = Number.isFinite(l), m = d ? Math.min(Math.max(0, r), l) : Math.max(0, r);
2364
2383
  if (n >= Number.MAX_SAFE_INTEGER)
2365
- return Qr(f, e, t, n, i, s, a, c);
2366
- const { index: b, cumulative: I, currentValue: w } = s.findIndexAtOrAfter(f, { materializeOption: { materialize: !1 } }), V = b === -1 ? e <= 0 || (I ?? 0) < f + (w ?? 0) ? n - 1 : 0 : b;
2367
- let h = Pe(V, n), z = 0;
2368
- if (b !== -1 && I === f)
2369
- h = Pe(b + 1, n), z = 0;
2370
- else if (h === b && I !== void 0 && w !== void 0)
2371
- z = I - w - f;
2384
+ return un(m, e, t, n, i, s, l, d);
2385
+ const { index: b, cumulative: v, currentValue: T } = s.findIndexAtOrAfter(m, { materializeOption: { materialize: !1 } }), C = b === -1 ? e <= 0 || (v ?? 0) < m + (T ?? 0) ? n - 1 : 0 : b;
2386
+ let h = Ie(C, n), O = 0;
2387
+ if (b !== -1 && v === m)
2388
+ h = Ie(b + 1, n), O = 0;
2389
+ else if (h === b && v !== void 0 && T !== void 0)
2390
+ O = v - T - m;
2372
2391
  else {
2373
- const { cumulative: P, currentValue: _ } = s.prefixSum(h, { materializeOption: { materialize: !1 } });
2374
- z = (P ?? 0) - (_ ?? 0) - f;
2392
+ const { cumulative: y, currentValue: Y } = s.prefixSum(h, { materializeOption: { materialize: !1 } });
2393
+ O = (y ?? 0) - (Y ?? 0) - m;
2375
2394
  }
2376
- const G = z, H = (P, _) => {
2377
- let M = P, Z = _, Q = 0;
2378
- for (; M < n && Z < e; ) {
2379
- const U = i(M);
2380
- if (Z += U, M++, !Number.isFinite(U) || U < 0)
2395
+ const W = O, D = (y, Y) => {
2396
+ let w = y, Z = Y, Q = 0;
2397
+ for (; w < n && Z < e; ) {
2398
+ const K = i(w);
2399
+ if (Z += K, w++, !Number.isFinite(K) || K < 0)
2381
2400
  break;
2382
- if (U === 0) {
2383
- if (Q++, Q > Yt) {
2384
- const { cumulative: Se } = s.prefixSum(M - 1, { materializeOption: { materialize: !1 } }), { index: C } = Number.isFinite(Se) ? s.findIndexAtOrAfter(Se + 0.5, { materializeOption: { materialize: !1 } }) : { index: -1 };
2385
- if (C > M)
2386
- M = C, Q = 0;
2387
- else if (C === M && i(M) > 0)
2401
+ if (K === 0) {
2402
+ if (Q++, Q > $t) {
2403
+ const { cumulative: he } = s.prefixSum(w - 1, { materializeOption: { materialize: !1 } }), { index: A } = Number.isFinite(he) ? s.findIndexAtOrAfter(he + 0.5, { materializeOption: { materialize: !1 } }) : { index: -1 };
2404
+ if (A > w)
2405
+ w = A, Q = 0;
2406
+ else if (A === w && i(w) > 0)
2388
2407
  Q = 0;
2389
2408
  else
2390
2409
  break;
@@ -2392,44 +2411,44 @@ const Gr = 1e4, ln = () => {
2392
2411
  } else
2393
2412
  Q = 0;
2394
2413
  }
2395
- return { cursor: M, height: Z };
2396
- }, pe = H(h, z);
2397
- let me = pe.cursor;
2398
- if (z = pe.height, z < e && h > 0) {
2399
- let P = z + Math.abs(Math.min(0, G)), _ = h - 1, M = 0;
2400
- for (; _ >= 0 && P < e; ) {
2401
- const Q = i(_);
2402
- if (P += Q, !Number.isFinite(Q) || Q < 0) {
2403
- _--;
2414
+ return { cursor: w, height: Z };
2415
+ }, ce = D(h, O);
2416
+ let ue = ce.cursor;
2417
+ if (O = ce.height, O < e && h > 0) {
2418
+ let y = O + Math.abs(Math.min(0, W)), Y = h - 1, w = 0;
2419
+ for (; Y >= 0 && y < e; ) {
2420
+ const Q = i(Y);
2421
+ if (y += Q, !Number.isFinite(Q) || Q < 0) {
2422
+ Y--;
2404
2423
  break;
2405
2424
  }
2406
2425
  if (Q === 0) {
2407
- if (M++, M > Yt) {
2408
- const { cumulative: U } = s.prefixSum(_, { materializeOption: { materialize: !1 } }), { index: Se } = Number.isFinite(U) ? s.findIndexAtOrAfter(U - 0.5, { materializeOption: { materialize: !1 } }) : { index: -1 };
2409
- if (Se !== -1 && Se < _) {
2410
- _ = Se, M = 0;
2426
+ if (w++, w > $t) {
2427
+ const { cumulative: K } = s.prefixSum(Y, { materializeOption: { materialize: !1 } }), { index: he } = Number.isFinite(K) ? s.findIndexAtOrAfter(K - 0.5, { materializeOption: { materialize: !1 } }) : { index: -1 };
2428
+ if (he !== -1 && he < Y) {
2429
+ Y = he, w = 0;
2411
2430
  continue;
2412
2431
  }
2413
- if (Se === _ && _ >= 1 && i(_ - 1) > 0)
2414
- M = 0;
2432
+ if (he === Y && Y >= 1 && i(Y - 1) > 0)
2433
+ w = 0;
2415
2434
  else {
2416
- _--;
2435
+ Y--;
2417
2436
  break;
2418
2437
  }
2419
2438
  }
2420
2439
  } else
2421
- M = 0;
2422
- _--;
2440
+ w = 0;
2441
+ Y--;
2423
2442
  }
2424
- h = Pe(_ + 1, n);
2425
- const Z = H(h, 0);
2426
- me = Z.cursor, z = Z.height;
2443
+ h = Ie(Y + 1, n);
2444
+ const Z = D(h, 0);
2445
+ ue = Z.cursor, O = Z.height;
2427
2446
  }
2428
- const oe = Pe(h - t, n), ce = Pe(Math.max(me - 1, h), n), he = Pe(ce + t, n);
2429
- return { renderingStartIndex: oe, renderingEndIndex: he, visibleStartIndex: h, visibleEndIndex: ce };
2430
- }, ur = (r, e, t) => {
2447
+ const re = Ie(h - t, n), oe = Ie(Math.max(ue - 1, h), n), de = Ie(oe + t, n);
2448
+ return { renderingStartIndex: re, renderingEndIndex: de, visibleStartIndex: h, visibleEndIndex: oe };
2449
+ }, Ir = (r, e, t) => {
2431
2450
  const n = Math.max(0, e ?? 0), i = g({ last: 0, id: null, arg: null }).current;
2432
- return q(
2451
+ return X(
2433
2452
  () => () => {
2434
2453
  if (i.id !== null && (cancelAnimationFrame(i.id), i.id = null), i.arg !== null && r.current) {
2435
2454
  try {
@@ -2444,673 +2463,724 @@ const Gr = 1e4, ln = () => {
2444
2463
  ), S(
2445
2464
  (s) => {
2446
2465
  if (i.arg = s, i.id !== null) return;
2447
- const a = (c) => {
2466
+ const l = (d) => {
2448
2467
  if (i.id = null, i.arg === null) return;
2449
- const f = c - i.last;
2450
- if (n === 0 || i.last === 0 || f >= n) {
2468
+ const m = d - i.last;
2469
+ if (n === 0 || i.last === 0 || m >= n) {
2451
2470
  if (r.current)
2452
2471
  try {
2453
2472
  t(r.current, i.arg);
2454
2473
  } catch (b) {
2455
2474
  console.error("[useThrottledInvoker] Error invoking callback", b);
2456
2475
  }
2457
- i.arg = null, i.last = c;
2476
+ i.arg = null, i.last = d;
2458
2477
  }
2459
- i.arg !== null && (i.id = requestAnimationFrame(a));
2478
+ i.arg !== null && (i.id = requestAnimationFrame(l));
2460
2479
  };
2461
- i.id = requestAnimationFrame(a);
2480
+ i.id = requestAnimationFrame(l);
2462
2481
  },
2463
2482
  [n, t, r, i]
2464
2483
  );
2465
- }, tn = xr.memo(({ index: r, top: e, height: t, item: n, children: i, clipItemHeight: s, enableKeyboardNavigation: a, onKeyDown: c, onFocus: f, registerItemRef: b }) => {
2466
- const I = S((z) => b(r, z), [r, b]), w = S((z) => c(z, r), [r, c]), V = S(() => f(r), [r, f]), h = S((z) => {
2467
- z.currentTarget.focus({ preventScroll: !0 });
2484
+ }, fn = Er.memo(({ index: r, top: e, height: t, item: n, children: i, clipItemHeight: s, enableKeyboardNavigation: l, onKeyDown: d, onEscapeKeyDown: m, onFocus: b, registerItemRef: v }) => {
2485
+ const T = S((D) => v(r, D), [r, v]), C = S((D) => d(D, r), [r, d]), h = S((D) => m?.(D, r), [r, m]), O = S(() => b(r), [r, b]), W = S((D) => {
2486
+ D.currentTarget.focus({ preventScroll: !0 });
2468
2487
  }, []);
2469
- return /* @__PURE__ */ de(
2470
- "div",
2471
- {
2472
- ref: I,
2473
- "data-index": r,
2474
- "data-virtualscroll-item": "true",
2475
- className: "aqvs-item-container",
2476
- style: {
2477
- top: e,
2478
- height: t,
2479
- overflow: s ? "hidden" : void 0
2480
- },
2481
- tabIndex: a ? -1 : void 0,
2482
- onPointerDown: a ? h : void 0,
2483
- onKeyDownCapture: a ? w : void 0,
2484
- onFocusCapture: a ? V : void 0,
2485
- children: i(n, r)
2486
- }
2488
+ return (
2489
+ // 行ラッパーの role は消費側の複合ウィジェット契約 (listbox / tree / grid — README「Composite widget
2490
+ // roles」) の所有物で、パッケージが既定 role を課すと衝突する。キー/フォーカス結線は
2491
+ // enableKeyboardNavigation の行ナビゲーション機構そのもの。
2492
+ // biome-ignore lint/a11y/noStaticElementInteractions: role は消費側の複合ウィジェット契約の所有物 (上記)
2493
+ /* @__PURE__ */ ie(
2494
+ "div",
2495
+ {
2496
+ ref: T,
2497
+ "data-index": r,
2498
+ "data-virtualscroll-item": "true",
2499
+ className: "aqvs-item-container",
2500
+ style: {
2501
+ top: e,
2502
+ height: t,
2503
+ overflow: s ? "hidden" : void 0
2504
+ },
2505
+ tabIndex: l ? -1 : void 0,
2506
+ onPointerDown: l ? W : void 0,
2507
+ onKeyDownCapture: l ? C : void 0,
2508
+ onKeyDown: l && m ? h : void 0,
2509
+ onFocusCapture: l ? O : void 0,
2510
+ children: i(n, r)
2511
+ }
2512
+ )
2487
2513
  );
2488
- }), rn = ({
2514
+ }), mn = ({
2489
2515
  itemCount: r,
2490
2516
  getItem: e,
2491
2517
  getItemKey: t,
2492
2518
  getItemHeight: n,
2493
2519
  viewportSize: i,
2494
2520
  overscanCount: s = 15,
2495
- className: a,
2496
- testId: c,
2497
- onScroll: f,
2521
+ className: l,
2522
+ testId: d,
2523
+ onScroll: m,
2498
2524
  onRangeChange: b,
2499
- children: I,
2500
- background: w,
2501
- initialScrollIndex: V,
2525
+ children: v,
2526
+ background: T,
2527
+ initialScrollIndex: C,
2502
2528
  initialScrollOffset: h,
2503
- initialScrollAnchor: z,
2504
- callbackThrottleMs: G = 5,
2505
- contentInsets: H,
2506
- onItemFocus: pe,
2507
- scrollBarOptions: me,
2508
- behaviorOptions: oe,
2509
- onWheelHorizontal: ce,
2510
- horizontalKeyInputs: he,
2511
- horizontalKeyStep: P = Jr,
2512
- contentProps: _
2513
- }, M) => {
2514
- const { width: Z, enableThumbDrag: Q, enableTrackClick: U, enableArrowButtons: Se, enableScrollToTopBottomButtons: C, renderThumbOverlay: v, tapScrollCircleOptions: W } = me ?? {}, { enablePointerDrag: ge, pointerDragInputs: qe, enableKeyboardNavigation: ee = !0, wheelSpeedMultiplier: X, inertiaOptions: Xe, overscrollBehavior: $e, clipItemHeight: ze = !1, resetOnGetItemHeightChange: Ce = !1 } = oe ?? {}, [je, Ge] = rt(0), K = i ?? je, Ae = S((o) => {
2515
- Ge((u) => u === o ? u : o);
2516
- }, []), ue = g(null), be = g({
2529
+ initialScrollAnchor: O,
2530
+ callbackThrottleMs: W = 5,
2531
+ contentInsets: D,
2532
+ onItemFocus: ce,
2533
+ scrollBarOptions: ue,
2534
+ behaviorOptions: re,
2535
+ onWheelHorizontal: oe,
2536
+ horizontalKeyInputs: de,
2537
+ horizontalKeyStep: y = cn,
2538
+ contentProps: Y,
2539
+ liveRegion: w
2540
+ }, Z) => {
2541
+ const { width: Q, enableThumbDrag: K, enableTrackClick: he, enableArrowButtons: A, enableScrollToTopBottomButtons: I, renderThumbOverlay: G, tapScrollCircleOptions: fe } = ue ?? {}, { enablePointerDrag: $e, pointerDragInputs: Ue, enableKeyboardNavigation: z = !0, enableEscapeRowReturn: ke = !1, wheelSpeedMultiplier: We, inertiaOptions: Ve, overscrollBehavior: Fe, clipItemHeight: Ke = !1, resetOnGetItemHeightChange: De = !1 } = re ?? {}, [Pe, ze] = Je(0), be = i ?? Pe, Se = S((o) => {
2542
+ ze((c) => c === o ? c : o);
2543
+ }, []), j = g(null), tt = g({
2517
2544
  renderingStartIndex: 0,
2518
2545
  renderingEndIndex: 0,
2519
2546
  visibleStartIndex: 0,
2520
2547
  visibleEndIndex: 0,
2521
2548
  scrollPosition: 0,
2522
2549
  totalHeight: 0
2523
- }), Te = g(z && r > 0 ? { index: le(Math.trunc(z.index), 0, r - 1), align: "top", offset: -Math.max(0, z.offsetPx ?? 0) } : null), et = g(!1), mt = g(!0);
2524
- q(() => {
2525
- if (mt.current) {
2526
- mt.current = !1;
2550
+ }), Ge = g(O && r > 0 ? { index: se(Math.trunc(O.index), 0, r - 1), align: "top", offset: -Math.max(0, O.offsetPx ?? 0) } : null), ft = g(!1), st = g(!0);
2551
+ X(() => {
2552
+ if (st.current) {
2553
+ st.current = !1;
2527
2554
  return;
2528
2555
  }
2529
- Ce && (Te.current = null);
2530
- }, [Ce, n]);
2531
- const N = Fe(() => lr(H), [H]), [it] = rt(() => {
2532
- const u = z?.index ?? V, m = typeof u == "number" && Number.isFinite(u) ? Math.max(0, Math.trunc(u)) : 0;
2533
- return { from: Math.max(0, m - 50), to: m + 50 };
2534
- }), vt = Fe(
2556
+ De && (Ge.current = null);
2557
+ }, [De, n]);
2558
+ const N = _e(() => xr(D), [D]), [gt] = Je(() => {
2559
+ const c = O?.index ?? C, u = typeof c == "number" && Number.isFinite(c) ? Math.max(0, Math.trunc(c)) : 0;
2560
+ return { from: Math.max(0, u - 50), to: u + 50 };
2561
+ }), ne = _e(
2535
2562
  // 目的: Fenwick Tree のオプション設定
2536
2563
  // 依存関係: resetOnGetItemHeightChange, initialSampleRange (マウント時固定)
2537
2564
  // itemCount には依存させない (依存させると追記のたびに options 参照が変わり、計測済み高さが全消去される)。
2538
2565
  // この useMemo により sampleRange を毎レンダー新規生成しない = 参照同一性由来の破壊的 reset を防ぐ。
2539
2566
  () => ({
2540
- sampleRange: it,
2541
- resetOnValueFnChange: Ce,
2567
+ sampleRange: gt,
2568
+ resetOnValueFnChange: De,
2542
2569
  materialize: !0
2543
2570
  }),
2544
- [Ce, it]
2545
- ), E = Wr(r, n, vt), [J] = rt(() => {
2546
- let o = 0, u = 0;
2547
- if (z && r > 0) {
2548
- const m = le(Math.trunc(z.index), 0, r - 1), A = Math.max(0, z.offsetPx ?? 0), L = le(m - s * 2, 0, r - 1), O = le(m + s * 2, 0, r - 1), k = m > 0 || A > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: L, to: O }] } } : void 0, { cumulative: se, total: Ne, currentValue: Ie } = E.prefixSum(m, k), fe = Math.max(se - Ie + A, 0);
2549
- o = Pt(fe, N.top), u = Ne ?? E.getTotal();
2550
- } else if (typeof V == "number") {
2551
- const m = le(V, 0, r - 1), A = le(m - s * 2, 0, r - 1), L = le(m + s * 2, 0, r - 1), O = V > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: A, to: L }] } } : void 0, { cumulative: k, total: se, currentValue: Ne } = E.prefixSum(V, O), Ie = Math.max(k - Ne, 0);
2552
- o = Pt(Ie, N.top), u = se ?? E.getTotal();
2553
- } else typeof h == "number" && (o = Pt(Math.max(h, 0), N.top)), u = E.getTotal();
2554
- return { position: o, total: u };
2555
- }), [Ze, ht] = rt(J.position), [Le, st] = rt(J.total), ie = g(J.position), p = g(N.top), F = g(f ?? void 0), B = g(b ?? void 0), Y = g(ce), te = (he?.length ?? 0) > 0, Me = !!ce;
2556
- q(() => {
2557
- te && (ee || T.warn("[VirtualScroll] horizontalKeyInputs is set but behaviorOptions.enableKeyboardNavigation is false; horizontal keyboard scrolling is disabled because the row key handler is not mounted."), Me || T.warn("[VirtualScroll] horizontalKeyInputs is set but onWheelHorizontal is missing; horizontal keyboard scrolling is disabled because the package does not own the horizontal axis."), Number.isFinite(P) && P > 0 || T.warn(`[VirtualScroll] horizontalKeyStep must be a finite positive number, received ${P}. Horizontal arrow keys are left untouched.`));
2558
- }, [te, Me, ee, P]);
2559
- const j = g(/* @__PURE__ */ new Map()), re = g(null), De = g(null), [ne, Je] = rt(null), [Oe, ae] = rt(!1), ve = g(null), Ue = g(!1), Ve = g(0), ft = g(!1), Qe = g(!1), ot = g(r);
2560
- ot.current !== r && (ot.current = r, Qe.current = !0), nt(() => {
2561
- F.current = f ?? void 0, B.current = b ?? void 0, Y.current = ce;
2562
- }, [b, f, ce]);
2563
- const d = S(
2571
+ [De, gt]
2572
+ ), V = nn(r, n, ne), [ot] = Je(() => {
2573
+ let o = 0, c = 0;
2574
+ if (O && r > 0) {
2575
+ const u = se(Math.trunc(O.index), 0, r - 1), _ = Math.max(0, O.offsetPx ?? 0), k = se(u - s * 2, 0, r - 1), F = se(u + s * 2, 0, r - 1), B = u > 0 || _ > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: k, to: F }] } } : void 0, { cumulative: te, total: we, currentValue: pe } = V.prefixSum(u, B), le = Math.max(te - pe + _, 0);
2576
+ o = Mt(le, N.top), c = we ?? V.getTotal();
2577
+ } else if (typeof C == "number") {
2578
+ const u = se(C, 0, r - 1), _ = se(u - s * 2, 0, r - 1), k = se(u + s * 2, 0, r - 1), F = C > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: _, to: k }] } } : void 0, { cumulative: B, total: te, currentValue: we } = V.prefixSum(C, F), pe = Math.max(B - we, 0);
2579
+ o = Mt(pe, N.top), c = te ?? V.getTotal();
2580
+ } else typeof h == "number" && (o = Mt(Math.max(h, 0), N.top)), c = V.getTotal();
2581
+ return { position: o, total: c };
2582
+ }), [je, mt] = Je(ot.position), [Ae, f] = Je(ot.total), M = g(ot.position), q = g(N.top), H = g(m ?? void 0), J = g(b ?? void 0), Te = g(oe), ee = (de?.length ?? 0) > 0, xe = !!oe;
2583
+ X(() => {
2584
+ ee && (z || P.warn("[VirtualScroll] horizontalKeyInputs is set but behaviorOptions.enableKeyboardNavigation is false; horizontal keyboard scrolling is disabled because the row key handler is not mounted."), xe || P.warn("[VirtualScroll] horizontalKeyInputs is set but onWheelHorizontal is missing; horizontal keyboard scrolling is disabled because the package does not own the horizontal axis."), Number.isFinite(y) && y > 0 || P.warn(`[VirtualScroll] horizontalKeyStep must be a finite positive number, received ${y}. Horizontal arrow keys are left untouched.`));
2585
+ }, [ee, xe, z, y]);
2586
+ const ye = g(/* @__PURE__ */ new Map()), $ = g(null), Re = g(null), [Ce, me] = Je(null), [Ee, rt] = Je(!1), Le = g(null), at = g(!1), Me = g(0), nt = g(!1), p = g(!1), R = g(r);
2587
+ R.current !== r && (R.current = r, p.current = !0), et(() => {
2588
+ H.current = m ?? void 0, J.current = b ?? void 0, Te.current = oe;
2589
+ }, [b, m, oe]);
2590
+ const ae = S(
2564
2591
  (o) => {
2565
- if (ee && o && typeof o.focus == "function")
2592
+ if (z && o && typeof o.focus == "function")
2566
2593
  try {
2567
2594
  o.focus({ preventScroll: !0 });
2568
2595
  } catch {
2569
2596
  o.focus();
2570
2597
  }
2571
2598
  },
2572
- [ee]
2573
- ), y = S((o, { position: u, totalHeight: m }) => {
2574
- o(u, m);
2575
- }, []), xe = ur(F, G, y), tt = S((o, u) => {
2576
- o(u);
2577
- }, []), _e = ur(B, G, tt), ct = g(N.top);
2578
- ct.current = N.top;
2579
- const ut = g(xe);
2580
- ut.current = xe, q(() => (et.current = !1, () => {
2581
- et.current = !0, ve.current && (clearTimeout(ve.current), ve.current = null);
2582
- }), []), q(() => {
2583
- ee || (j.current.clear(), re.current = null, De.current = null);
2584
- }, [ee]);
2585
- const at = S(
2586
- (o, u) => {
2587
- if (!u) {
2588
- j.current.delete(o);
2599
+ [z]
2600
+ ), it = S((o, { position: c, totalHeight: u }) => {
2601
+ o(c, u);
2602
+ }, []), Ne = Ir(H, W, it), zt = S((o, c) => {
2603
+ o(c);
2604
+ }, []), ct = Ir(J, W, zt), Ye = g(N.top);
2605
+ Ye.current = N.top;
2606
+ const bt = g(Ne);
2607
+ bt.current = Ne, X(() => (ft.current = !1, () => {
2608
+ ft.current = !0, Le.current && (clearTimeout(Le.current), Le.current = null);
2609
+ }), []), X(() => {
2610
+ z || (ye.current.clear(), $.current = null, Re.current = null);
2611
+ }, [z]);
2612
+ const Pt = S(
2613
+ (o, c) => {
2614
+ if (!c) {
2615
+ ye.current.delete(o);
2589
2616
  return;
2590
2617
  }
2591
- ee && (j.current.set(o, u), re.current === o && (re.current = null, De.current = o, d(u)));
2618
+ z && (ye.current.set(o, c), $.current === o && ($.current = null, Re.current = o, ae(c)));
2592
2619
  },
2593
- [ee, d]
2594
- ), gt = 0.01, pt = g({
2620
+ [z, ae]
2621
+ ), Ft = 0.01, ut = g({
2595
2622
  rafId: null,
2596
2623
  loopActive: !1,
2597
2624
  idleFrames: 0,
2598
- lastRenderedPosition: J.position
2625
+ lastRenderedPosition: ot.position
2599
2626
  }), yt = S(() => {
2600
- const o = pt.current;
2627
+ const o = ut.current;
2601
2628
  o.rafId !== null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(o.rafId), o.rafId = null, o.loopActive = !1, o.idleFrames = 0;
2602
2629
  }, []);
2603
- q(
2630
+ X(
2604
2631
  () => () => {
2605
2632
  yt();
2606
2633
  },
2607
2634
  [yt]
2608
2635
  );
2609
- const wt = g(() => {
2610
- }), Nt = S(() => {
2611
- const o = pt.current;
2636
+ const Yt = g(() => {
2637
+ }), Ct = S(() => {
2638
+ const o = ut.current;
2612
2639
  o.rafId = null;
2613
- const u = ie.current, m = Ke(u, ct.current), A = E.getTotal();
2614
- if (ht((O) => Math.abs(O - u) < gt ? O : u), Math.abs(o.lastRenderedPosition - u) >= gt ? (ut.current({ position: m, totalHeight: A }), o.lastRenderedPosition = u, o.idleFrames = 0) : o.idleFrames += 1, o.idleFrames >= 2) {
2640
+ const c = M.current, u = Qe(c, Ye.current), _ = V.getTotal();
2641
+ if (mt((F) => Math.abs(F - c) < Ft ? F : c), Math.abs(o.lastRenderedPosition - c) >= Ft ? (bt.current({ position: u, totalHeight: _ }), o.lastRenderedPosition = c, o.idleFrames = 0) : o.idleFrames += 1, o.idleFrames >= 2) {
2615
2642
  yt();
2616
2643
  return;
2617
2644
  }
2618
2645
  if (typeof requestAnimationFrame == "function") {
2619
- o.rafId = requestAnimationFrame((O) => wt.current(O));
2646
+ o.rafId = requestAnimationFrame((F) => Yt.current(F));
2620
2647
  return;
2621
2648
  }
2622
2649
  o.loopActive = !1;
2623
- }, [E, yt]);
2624
- wt.current = Nt;
2625
- const At = S(() => {
2626
- const o = pt.current;
2650
+ }, [V, yt]);
2651
+ Yt.current = Ct;
2652
+ const Bt = S(() => {
2653
+ const o = ut.current;
2627
2654
  if (o.idleFrames = 0, !o.loopActive) {
2628
2655
  if (o.loopActive = !0, typeof requestAnimationFrame == "function") {
2629
- o.rafId = requestAnimationFrame(Nt);
2656
+ o.rafId = requestAnimationFrame(Ct);
2630
2657
  return;
2631
2658
  }
2632
2659
  o.loopActive = !1;
2633
2660
  }
2634
- }, [Nt]), we = S(
2635
- (o, u) => {
2636
- const m = u?.immediate ?? !1, A = Ke(o, N.top);
2637
- if (ie.current = o, m) {
2638
- pt.current.lastRenderedPosition = o, pt.current.idleFrames = 0, ht(o), xe({ position: A, totalHeight: E.getTotal() });
2661
+ }, [Ct]), ge = S(
2662
+ (o, c) => {
2663
+ const u = c?.immediate ?? !1, _ = Qe(o, N.top);
2664
+ if (M.current = o, u) {
2665
+ ut.current.lastRenderedPosition = o, ut.current.idleFrames = 0, mt(o), Ne({ position: _, totalHeight: V.getTotal() });
2639
2666
  return;
2640
2667
  }
2641
- At();
2668
+ Bt();
2642
2669
  },
2643
- [At, E, N.top, xe]
2644
- ), bt = S((o, u = 0) => {
2645
- const m = ue.current;
2646
- if (!m)
2670
+ [Bt, V, N.top, Ne]
2671
+ ), xt = S((o, c = 0) => {
2672
+ const u = j.current;
2673
+ if (!u)
2647
2674
  return o;
2648
- const A = m.getScrollPosition();
2649
- Ve.current += 1;
2650
- const L = m.getContentSize() + u, O = m.getViewportSize(), k = m.scrollTo(o, { contentSize: L, viewportSize: O });
2651
- return k === A && (Ve.current = Math.max(0, Ve.current - 1)), Math.abs(k - o) > 0.5 && (ft.current = !0), k;
2652
- }, []), Lt = g(!1);
2653
- q(() => {
2654
- if (!Lt.current)
2655
- if (Lt.current = !0, z == null && typeof V != "number" && typeof h == "number") {
2656
- const o = Pt(Math.max(h, 0), N.top), u = Math.abs(o - ie.current) > 0.5;
2657
- we(o, { immediate: !0 }), u && ue.current?.scrollTo(o);
2675
+ const _ = u.getScrollPosition();
2676
+ Me.current += 1;
2677
+ const k = u.getContentSize() + c, F = u.getViewportSize(), B = u.scrollTo(o, { contentSize: k, viewportSize: F });
2678
+ return B === _ && (Me.current = Math.max(0, Me.current - 1)), Math.abs(B - o) > 0.5 && (nt.current = !0), B;
2679
+ }, []), Dt = g(!1);
2680
+ X(() => {
2681
+ if (!Dt.current)
2682
+ if (Dt.current = !0, O == null && typeof C != "number" && typeof h == "number") {
2683
+ const o = Mt(Math.max(h, 0), N.top), c = Math.abs(o - M.current) > 0.5;
2684
+ ge(o, { immediate: !0 }), c && j.current?.scrollTo(o);
2658
2685
  } else
2659
- we(ie.current, { immediate: !0 });
2660
- }, [z, V, h, N.top, we]), q(() => {
2661
- const o = E.getTotal();
2662
- if (Le !== o) {
2663
- st(o);
2686
+ ge(M.current, { immediate: !0 });
2687
+ }, [O, C, h, N.top, ge]), X(() => {
2688
+ const o = V.getTotal();
2689
+ if (Ae !== o) {
2690
+ f(o);
2664
2691
  return;
2665
2692
  }
2666
- if (ft.current) {
2667
- ft.current = !1;
2668
- const u = ue.current;
2669
- if (u && Math.abs(u.getScrollPosition() - ie.current) > 0.5) {
2670
- const m = bt(ie.current);
2671
- ft.current = !1, we(m, { immediate: !0 });
2693
+ if (nt.current) {
2694
+ nt.current = !1;
2695
+ const c = j.current;
2696
+ if (c && Math.abs(c.getScrollPosition() - M.current) > 0.5) {
2697
+ const u = xt(M.current);
2698
+ nt.current = !1, ge(u, { immediate: !0 });
2672
2699
  }
2673
2700
  }
2674
- }, [E, Le, r, bt, we]), q(() => {
2675
- if (Te.current !== null) {
2676
- const { index: o, align: u, offset: m } = Te.current, A = Pe(o, r), { cumulative: L, currentValue: O } = E.prefixSum(A, { materializeOption: { materialize: !1 } });
2677
- if (L !== void 0 && O !== void 0) {
2678
- const k = Math.max(L - O, 0);
2679
- let se = k;
2680
- u === "bottom" ? se = L - K : u === "center" && (se = k + O / 2 - K / 2), m && (se -= m), se = Math.max(0, se);
2681
- const Ne = Math.max(0, Le + N.top + N.bottom - K), Ie = Math.min(Pt(se, N.top), Ne);
2682
- Math.abs(Ie - ie.current) > 1 && (T.debug("[VirtualScroll] Drift correction", {
2683
- from: ie.current,
2684
- to: Ie,
2685
- targetIndex: A
2686
- }), Ve.current === 0 && (Ve.current += 1), ue.current?.scrollTo(Ie), we(Ie, { immediate: !0 }));
2701
+ }, [V, Ae, r, xt, ge]), X(() => {
2702
+ if (Ge.current !== null) {
2703
+ const { index: o, align: c, offset: u } = Ge.current, _ = Ie(o, r), { cumulative: k, currentValue: F } = V.prefixSum(_, { materializeOption: { materialize: !1 } });
2704
+ if (k !== void 0 && F !== void 0) {
2705
+ const B = Math.max(k - F, 0);
2706
+ let te = B;
2707
+ c === "bottom" ? te = k - be : c === "center" && (te = B + F / 2 - be / 2), u && (te -= u), te = Math.max(0, te);
2708
+ const we = Math.max(0, Ae + N.top + N.bottom - be), pe = Math.min(Mt(te, N.top), we);
2709
+ Math.abs(pe - M.current) > 1 && (P.debug("[VirtualScroll] Drift correction", {
2710
+ from: M.current,
2711
+ to: pe,
2712
+ targetIndex: _
2713
+ }), Me.current === 0 && (Me.current += 1), j.current?.scrollTo(pe), ge(pe, { immediate: !0 }));
2687
2714
  }
2688
2715
  }
2689
- Qe.current = !1;
2690
- }, [Le, E, r, N.top, we, K, N.bottom]), q(() => {
2691
- const o = p.current;
2692
- if (o === N.top || (p.current = N.top, Te.current))
2716
+ p.current = !1;
2717
+ }, [Ae, V, r, N.top, ge, be, N.bottom]), X(() => {
2718
+ const o = q.current;
2719
+ if (o === N.top || (q.current = N.top, Ge.current))
2693
2720
  return;
2694
- const u = Ke(ie.current, o), m = Pt(u, N.top);
2695
- ie.current = m, ue.current?.scrollTo(m), we(m, { immediate: !0 });
2696
- }, [N.top, we]);
2697
- const Ot = S(
2698
- (o, u) => {
2721
+ const c = Qe(M.current, o), u = Mt(c, N.top);
2722
+ M.current = u, j.current?.scrollTo(u), ge(u, { immediate: !0 });
2723
+ }, [N.top, ge]);
2724
+ const At = S(
2725
+ (o, c) => {
2699
2726
  if (r === 0)
2700
2727
  return;
2701
- const m = Pe(o, r), A = E.get(m), L = u - A, O = E.update(m, u);
2702
- O !== void 0 && st(O), T.debug("[VirtualScroll] Updated item size manually", { index: m, size: u, total: O });
2703
- let k = Te.current ? Te.current.index : null;
2704
- if (k === null) {
2705
- const se = ie.current, Ne = lr(H).top, Ie = Ke(se, Ne), { index: fe, cumulative: Be } = E.findIndexAtOrAfter(Ie, { materializeOption: { materialize: !1 } });
2706
- k = Be !== void 0 && Be === Ie ? fe + 1 : fe;
2728
+ const u = Ie(o, r), _ = V.get(u), k = c - _, F = V.update(u, c);
2729
+ F !== void 0 && f(F), P.debug("[VirtualScroll] Updated item size manually", { index: u, size: c, total: F });
2730
+ let B = Ge.current ? Ge.current.index : null;
2731
+ if (B === null) {
2732
+ const te = M.current, we = xr(D).top, pe = Qe(te, we), { index: le, cumulative: qe } = V.findIndexAtOrAfter(pe, { materializeOption: { materialize: !1 } });
2733
+ B = qe !== void 0 && qe === pe ? le + 1 : le;
2707
2734
  }
2708
- if (k !== -1 && m < k && L !== 0) {
2709
- const se = ie.current, Ne = se + L;
2710
- bt(Ne, L), we(Ne, { immediate: !0 }), T.debug("[VirtualScroll] Adjusted scroll for layout shift (manual update)", { from: se, to: Ne, causedByIndex: m, delta: L, activeVisibleStartIndex: k });
2735
+ if (B !== -1 && u < B && k !== 0) {
2736
+ const te = M.current, we = te + k;
2737
+ xt(we, k), ge(we, { immediate: !0 }), P.debug("[VirtualScroll] Adjusted scroll for layout shift (manual update)", { from: te, to: we, causedByIndex: u, delta: k, activeVisibleStartIndex: B });
2711
2738
  }
2712
2739
  },
2713
- [E, r, bt, we, H]
2714
- ), We = S(
2715
- (o, u) => {
2716
- if (!ue.current || r === 0)
2740
+ [V, r, xt, ge, D]
2741
+ ), a = S(
2742
+ (o, c) => {
2743
+ if (!j.current || r === 0)
2717
2744
  return;
2718
- const m = Pe(o, r), A = Pe(m - s * 2, r), L = Pe(m + s * 2, r), { cumulative: O, total: k, currentValue: se } = E.prefixSum(m, { materializeOption: { materialize: !0, ranges: [{ from: A, to: L }] } });
2719
- if (T.debug("[VirtualScroll] Scrolling to index:", m, "ItemBottom:", O, "Total height:", k, "ItemHeight:", se, "safeIndexFrom:", A, "safeIndexTo:", L), !k)
2745
+ const u = Ie(o, r), _ = Ie(u - s * 2, r), k = Ie(u + s * 2, r), { cumulative: F, total: B, currentValue: te } = V.prefixSum(u, { materializeOption: { materialize: !0, ranges: [{ from: _, to: k }] } });
2746
+ if (P.debug("[VirtualScroll] Scrolling to index:", u, "ItemBottom:", F, "Total height:", B, "ItemHeight:", te, "safeIndexFrom:", _, "safeIndexTo:", k), !B)
2720
2747
  return;
2721
- const Ne = Math.max(O - se, 0);
2722
- let Ie = Ne;
2723
- u?.align === "bottom" ? Ie = O - K : u?.align === "center" && (Ie = Ne + se / 2 - K / 2), u?.offset && (Ie -= u.offset), Ie = Math.max(0, Ie);
2724
- const fe = Pt(Ie, N.top), Be = ue.current?.getContentSize() ?? k + N.top + N.bottom, ke = Math.max(0, Be - K), He = Math.min(fe, ke);
2725
- Te.current = {
2726
- index: m,
2727
- align: u?.align,
2728
- offset: u?.offset
2748
+ const we = Math.max(F - te, 0);
2749
+ let pe = we;
2750
+ c?.align === "bottom" ? pe = F - be : c?.align === "center" && (pe = we + te / 2 - be / 2), c?.offset && (pe -= c.offset), pe = Math.max(0, pe);
2751
+ const le = Mt(pe, N.top), qe = j.current?.getContentSize() ?? B + N.top + N.bottom, Oe = Math.max(0, qe - be), Xe = Math.min(le, Oe);
2752
+ Ge.current = {
2753
+ index: u,
2754
+ align: c?.align,
2755
+ offset: c?.offset
2729
2756
  };
2730
- const zt = ue.current?.getScrollPosition() ?? -1, Xt = Math.abs(zt - He) > 0.5;
2731
- Ue.current = !1, Ve.current = 0, Xt && (Ue.current = !0, Ve.current += 1, ue.current?.scrollTo(He)), st(k), we(He, { immediate: !0 }), T.debug("[VirtualScroll] Setting scroll position to:", He, { original: fe, max: ke });
2757
+ const Ot = j.current?.getScrollPosition() ?? -1, Gt = Math.abs(Ot - Xe) > 0.5;
2758
+ at.current = !1, Me.current = 0, Gt && (at.current = !0, Me.current += 1, j.current?.scrollTo(Xe)), f(B), ge(Xe, { immediate: !0 }), P.debug("[VirtualScroll] Setting scroll position to:", Xe, { original: le, max: Oe });
2732
2759
  },
2733
- [E, s, r, N.top, N.bottom, K, we]
2734
- ), Vt = g(z && r === 0 ? z : null);
2735
- q(() => {
2736
- const o = Vt.current;
2737
- !o || r === 0 || (Vt.current = null, We(le(Math.trunc(o.index), 0, r - 1), { align: "top", offset: -Math.max(0, o.offsetPx ?? 0) }));
2738
- }, [r, We]);
2739
- const l = S(
2760
+ [V, s, r, N.top, N.bottom, be, ge]
2761
+ ), x = g(O && r === 0 ? O : null);
2762
+ X(() => {
2763
+ const o = x.current;
2764
+ !o || r === 0 || (x.current = null, a(se(Math.trunc(o.index), 0, r - 1), { align: "top", offset: -Math.max(0, o.offsetPx ?? 0) }));
2765
+ }, [r, a]);
2766
+ const E = S(
2740
2767
  (o) => {
2741
- if (!ue.current || r === 0)
2768
+ if (!j.current || r === 0)
2742
2769
  return;
2743
- const u = E.getTotal(), m = le(Math.floor(o), 0, u), { index: A, cumulative: L, currentValue: O } = E.findIndexAtOrAfter(m, { materializeOption: { materialize: !1 } }), se = (L ?? 0) - (O ?? 0) - m;
2744
- We(A, { offset: se });
2770
+ const c = V.getTotal(), u = se(Math.floor(o), 0, c), { index: _, cumulative: k, currentValue: F } = V.findIndexAtOrAfter(u, { materializeOption: { materialize: !1 } }), te = (k ?? 0) - (F ?? 0) - u;
2771
+ a(_, { offset: te });
2745
2772
  },
2746
- [E, r, We]
2747
- ), x = S(() => {
2773
+ [V, r, a]
2774
+ ), L = S(() => {
2748
2775
  if (r === 0)
2749
2776
  return null;
2750
- const o = Ke(ie.current, N.top), { index: u, cumulative: m, currentValue: A } = E.findIndexAtOrAfter(o, { materializeOption: { materialize: !1 } });
2751
- if (u === -1)
2777
+ const o = Qe(M.current, N.top), { index: c, cumulative: u, currentValue: _ } = V.findIndexAtOrAfter(o, { materializeOption: { materialize: !1 } });
2778
+ if (c === -1)
2752
2779
  return { index: r - 1, offsetPx: 0 };
2753
- if (m === o)
2754
- return { index: le(u + 1, 0, r - 1), offsetPx: 0 };
2755
- const L = (m ?? 0) - (A ?? 0);
2756
- return { index: u, offsetPx: Math.max(0, o - L) };
2757
- }, [E, r, N.top]), R = S(
2780
+ if (u === o)
2781
+ return { index: se(c + 1, 0, r - 1), offsetPx: 0 };
2782
+ const k = (u ?? 0) - (_ ?? 0);
2783
+ return { index: c, offsetPx: Math.max(0, o - k) };
2784
+ }, [V, r, N.top]), U = S(
2758
2785
  (o) => {
2759
- const u = Ke(ie.current, N.top), m = typeof o == "function" ? o(u) : o;
2760
- l(m);
2761
- const A = ue.current?.getScrollPosition(), L = typeof A == "number" ? A : ie.current;
2762
- return we(L), Ke(L, ct.current);
2786
+ const c = Qe(M.current, N.top), u = typeof o == "function" ? o(c) : o;
2787
+ E(u);
2788
+ const _ = j.current?.getScrollPosition(), k = typeof _ == "number" ? _ : M.current;
2789
+ return ge(k), Qe(k, Ye.current);
2763
2790
  },
2764
- [N.top, l, we]
2765
- ), D = S((o) => {
2766
- const u = ue.current;
2767
- if (!u)
2768
- return Ke(ie.current, ct.current);
2769
- const m = u.scrollTo((A) => A + o);
2770
- return Ke(m, ct.current);
2771
- }, []), $ = S((o) => ue.current?.applyWheel(o) ?? !1, []), ye = S(
2772
- (o, u) => {
2773
- T.debug("[VirtualScroll] Scroll position changed:", o);
2774
- const m = Ue.current;
2775
- m && (Ue.current = !1);
2776
- const A = Ve.current > 0;
2777
- A && (Ve.current = 0);
2778
- const L = Qe.current && ot.current === r;
2779
- if (m || A || L || (Te.current = null), we(o), C) {
2780
- if (m || A)
2791
+ [N.top, E, ge]
2792
+ ), ve = S((o) => {
2793
+ const c = j.current;
2794
+ if (!c)
2795
+ return Qe(M.current, Ye.current);
2796
+ const u = c.scrollTo((_) => _ + o);
2797
+ return Qe(u, Ye.current);
2798
+ }, []), Be = S((o) => j.current?.applyWheel(o) ?? !1, []), He = S(
2799
+ (o, c) => {
2800
+ P.debug("[VirtualScroll] Scroll position changed:", o);
2801
+ const u = at.current;
2802
+ u && (at.current = !1);
2803
+ const _ = Me.current > 0;
2804
+ _ && (Me.current = 0);
2805
+ const k = p.current && R.current === r;
2806
+ if (u || _ || k || (Ge.current = null), ge(o), I) {
2807
+ if (u || _)
2781
2808
  return;
2782
- const O = o - u;
2783
- if (T.debug("[VirtualScroll] Scroll diff:", O, "New:", o, "Prev:", u), Math.abs(O) > 1) {
2784
- const k = O > 0 ? "down" : "up";
2785
- Je(k), ae(!0), T.debug("[VirtualScroll] Showing scroll buttons. Direction:", k), ve.current && clearTimeout(ve.current), ve.current = setTimeout(() => {
2786
- ae(!1), T.debug("[VirtualScroll] Hiding scroll buttons");
2809
+ const F = o - c;
2810
+ if (P.debug("[VirtualScroll] Scroll diff:", F, "New:", o, "Prev:", c), Math.abs(F) > 1) {
2811
+ const B = F > 0 ? "down" : "up";
2812
+ me(B), rt(!0), P.debug("[VirtualScroll] Showing scroll buttons. Direction:", B), Le.current && clearTimeout(Le.current), Le.current = setTimeout(() => {
2813
+ rt(!1), P.debug("[VirtualScroll] Hiding scroll buttons");
2787
2814
  }, 2e3);
2788
2815
  }
2789
2816
  }
2790
2817
  },
2791
- [we, C, r]
2792
- ), Re = Fe(() => Ke(Ze, N.top), [N.top, Ze]), Ee = Fe(() => {
2793
- const o = E.getTotal(), u = en(Re, K, s, r, n, E, o);
2794
- return T.debug("[VirtualScroll] Calculated rendering range:", () => ({
2795
- ...u,
2796
- scrollPosition: Re,
2818
+ [ge, I, r]
2819
+ ), lt = _e(() => Qe(je, N.top), [N.top, je]), Ze = _e(() => {
2820
+ const o = V.getTotal(), c = dn(lt, be, s, r, n, V, o);
2821
+ return P.debug("[VirtualScroll] Calculated rendering range:", () => ({
2822
+ ...c,
2823
+ scrollPosition: lt,
2797
2824
  renderingContentSize: o,
2798
2825
  overscanCount: s,
2799
- viewportSize: K
2800
- })), u;
2801
- }, [Re, K, s, r, n, E]), { renderingStartIndex: lt, renderingEndIndex: Ye, visibleStartIndex: xt, visibleEndIndex: _t } = Ee, Tt = S(
2802
- (o, u) => {
2803
- if (!ee || r === 0)
2826
+ viewportSize: be
2827
+ })), c;
2828
+ }, [lt, be, s, r, n, V]), { renderingStartIndex: pt, renderingEndIndex: wt, visibleStartIndex: vt, visibleEndIndex: Rt } = Ze, ht = S(
2829
+ (o, c) => {
2830
+ if (!z || r === 0)
2804
2831
  return;
2805
- const m = Pe(o, r);
2806
- if (!(u?.ensureVisible ?? !0)) {
2807
- const ke = j.current.get(m);
2808
- ke && (re.current = null, De.current = m, d(ke));
2832
+ const u = Ie(o, r);
2833
+ if (!(c?.ensureVisible ?? !0)) {
2834
+ const Oe = ye.current.get(u);
2835
+ Oe && ($.current = null, Re.current = u, ae(Oe));
2809
2836
  return;
2810
2837
  }
2811
- const L = E.prefixSum(m, { materializeOption: { materialize: !1 } }), O = L.currentValue, k = Math.max(L.cumulative - O, 0), se = k + O, Ne = Ke(ie.current, N.top), Ie = Ne + K;
2812
- if (k < Ne || se > Ie) {
2813
- We(m);
2814
- const ke = j.current.get(m);
2815
- ke ? (re.current = null, De.current = m, d(ke)) : re.current = m;
2838
+ const k = V.prefixSum(u, { materializeOption: { materialize: !1 } }), F = k.currentValue, B = Math.max(k.cumulative - F, 0), te = B + F, we = Qe(M.current, N.top), pe = we + be;
2839
+ if (B < we || te > pe) {
2840
+ a(u);
2841
+ const Oe = ye.current.get(u);
2842
+ Oe ? ($.current = null, Re.current = u, ae(Oe)) : $.current = u;
2816
2843
  return;
2817
2844
  }
2818
- const Be = j.current.get(m);
2819
- if (Be) {
2820
- re.current = null, De.current = m, d(Be);
2845
+ const qe = ye.current.get(u);
2846
+ if (qe) {
2847
+ $.current = null, Re.current = u, ae(qe);
2821
2848
  return;
2822
2849
  }
2823
- re.current = m;
2850
+ $.current = u;
2824
2851
  },
2825
- [ee, r, E, N.top, We, d, K]
2826
- ), Qt = S(
2827
- (o, u) => {
2828
- if (!(!ee || o.defaultPrevented) && !(o.altKey || o.metaKey || o.ctrlKey) && o.target === o.currentTarget && !o.currentTarget.isContentEditable) {
2852
+ [z, r, V, N.top, a, ae, be]
2853
+ ), sr = S(
2854
+ (o, c) => {
2855
+ if (!(!z || o.defaultPrevented) && !(o.altKey || o.metaKey || o.ctrlKey) && o.target === o.currentTarget && !o.currentTarget.isContentEditable) {
2829
2856
  if (o.key === "ArrowLeft" || o.key === "ArrowRight") {
2830
- const m = Y.current;
2831
- if (!m || o.shiftKey || !he?.includes("arrow") || !(Number.isFinite(P) && P > 0))
2857
+ const u = Te.current;
2858
+ if (!u || o.shiftKey || !de?.includes("arrow") || !(Number.isFinite(y) && y > 0))
2832
2859
  return;
2833
- o.preventDefault(), m(o.key === "ArrowLeft" ? -P : P);
2860
+ o.preventDefault(), u(o.key === "ArrowLeft" ? -y : y);
2834
2861
  return;
2835
2862
  }
2836
2863
  if (o.key === "ArrowDown") {
2837
- u < r - 1 && (o.preventDefault(), Tt(u + 1));
2864
+ c < r - 1 && (o.preventDefault(), ht(c + 1));
2838
2865
  return;
2839
2866
  }
2840
2867
  if (o.key === "ArrowUp") {
2841
- u > 0 && (o.preventDefault(), Tt(u - 1));
2868
+ c > 0 && (o.preventDefault(), ht(c - 1));
2842
2869
  return;
2843
2870
  }
2844
2871
  if (o.key === "PageDown") {
2845
- if (u < r - 1) {
2872
+ if (c < r - 1) {
2846
2873
  o.preventDefault();
2847
- const { visibleStartIndex: m, visibleEndIndex: A } = be.current, L = Math.max(A - m + 1, 1), O = Math.max(L, 1), k = Pe(Math.min(u + O, r - 1), r);
2848
- Tt(k);
2874
+ const { visibleStartIndex: u, visibleEndIndex: _ } = tt.current, k = Math.max(_ - u + 1, 1), F = Math.max(k, 1), B = Ie(Math.min(c + F, r - 1), r);
2875
+ ht(B);
2849
2876
  }
2850
2877
  return;
2851
2878
  }
2852
- if (o.key === "PageUp" && u > 0) {
2879
+ if (o.key === "PageUp" && c > 0) {
2853
2880
  o.preventDefault();
2854
- const { visibleStartIndex: m, visibleEndIndex: A } = be.current, L = Math.max(A - m + 1, 1), O = Math.max(L, 1), k = Pe(u - O, r);
2855
- Tt(k);
2881
+ const { visibleStartIndex: u, visibleEndIndex: _ } = tt.current, k = Math.max(_ - u + 1, 1), F = Math.max(k, 1), B = Ie(c - F, r);
2882
+ ht(B);
2856
2883
  }
2857
2884
  }
2858
2885
  },
2859
- [ee, r, Tt, he, P]
2860
- ), er = S(
2886
+ [z, r, ht, de, y]
2887
+ ), or = S(
2888
+ /**
2889
+ * Returns focus from an element inside the row back to the row wrapper on Escape.
2890
+ * 行内要素の Escape で行ラッパーへフォーカスを戻す処理。
2891
+ *
2892
+ * @param event - Keyboard event (bubble phase on the row wrapper) / 行ラッパー bubble フェーズのキーイベント
2893
+ * @param index - Row index / 行インデックス
2894
+ */
2895
+ (o, c) => {
2896
+ if (o.key !== "Escape" || o.defaultPrevented || o.nativeEvent.isComposing || o.target === o.currentTarget)
2897
+ return;
2898
+ const u = o.target;
2899
+ u instanceof HTMLInputElement || u instanceof HTMLTextAreaElement || u instanceof HTMLSelectElement || u.isContentEditable || (o.preventDefault(), ht(c));
2900
+ },
2901
+ [ht]
2902
+ ), ar = S(
2861
2903
  (o) => {
2862
- if (!ee)
2904
+ if (!z)
2863
2905
  return;
2864
- const u = Pe(o, r);
2865
- re.current = null, De.current = u, pe?.(u);
2906
+ const c = Ie(o, r);
2907
+ $.current = null, Re.current = c, ce?.(c);
2866
2908
  },
2867
- [ee, r, pe]
2909
+ [z, r, ce]
2868
2910
  );
2869
- q(() => {
2870
- const o = ue.current?.getScrollPosition() ?? 0, u = ie.current, m = Ke(u, N.top);
2871
- T.debug("[VirtualScroll] Range change effect triggered", () => ({
2872
- renderingStartIndex: lt,
2873
- renderingEndIndex: Ye,
2874
- visibleStartIndex: xt,
2875
- visibleEndIndex: _t,
2876
- scrollPositionState: Ze,
2877
- paneScrollPosition: u,
2878
- logicalScrollPosition: m,
2879
- contentSize: Le,
2911
+ X(() => {
2912
+ const o = j.current?.getScrollPosition() ?? 0, c = M.current, u = Qe(c, N.top);
2913
+ P.debug("[VirtualScroll] Range change effect triggered", () => ({
2914
+ renderingStartIndex: pt,
2915
+ renderingEndIndex: wt,
2916
+ visibleStartIndex: vt,
2917
+ visibleEndIndex: Rt,
2918
+ scrollPositionState: je,
2919
+ paneScrollPosition: c,
2920
+ logicalScrollPosition: u,
2921
+ contentSize: Ae,
2880
2922
  scrollPaneScrollPosition: o
2881
- })), _e({
2882
- renderingStartIndex: lt,
2883
- renderingEndIndex: Ye,
2884
- visibleStartIndex: xt,
2885
- visibleEndIndex: _t,
2886
- scrollPosition: m,
2887
- totalHeight: Le
2923
+ })), ct({
2924
+ renderingStartIndex: pt,
2925
+ renderingEndIndex: wt,
2926
+ visibleStartIndex: vt,
2927
+ visibleEndIndex: Rt,
2928
+ scrollPosition: u,
2929
+ totalHeight: Ae
2888
2930
  });
2889
- }, [Le, Ye, lt, N.top, _e, Ze, _t, xt]);
2890
- const hr = S(() => {
2891
- if (!C)
2931
+ }, [Ae, wt, pt, N.top, ct, je, Rt, vt]);
2932
+ const Mr = S(() => {
2933
+ if (!I)
2892
2934
  return null;
2893
- const o = Oe && ne !== null;
2894
- return /* @__PURE__ */ de("div", { className: "aqvs-scroll-to-edge-overlay", "data-visible": o, inert: !o, children: ne === "up" ? /* @__PURE__ */ de("div", { className: "aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-top", children: /* @__PURE__ */ de(
2935
+ const o = Ee && Ce !== null;
2936
+ return /* @__PURE__ */ ie("div", { className: "aqvs-scroll-to-edge-overlay", "data-visible": o, inert: !o, children: Ce === "up" ? /* @__PURE__ */ ie("div", { className: "aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-top", children: /* @__PURE__ */ ie(
2895
2937
  "button",
2896
2938
  {
2897
2939
  type: "button",
2898
2940
  className: "aqvs-scroll-to-edge-button",
2899
2941
  tabIndex: o ? 0 : -1,
2900
- onClick: (m) => {
2901
- m.stopPropagation(), Ue.current = !0, We(0), ae(!1);
2942
+ onClick: (u) => {
2943
+ u.stopPropagation(), at.current = !0, a(0), rt(!1);
2902
2944
  },
2903
2945
  children: "Top"
2904
2946
  }
2905
- ) }) : /* @__PURE__ */ de("div", { className: "aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-bottom", children: /* @__PURE__ */ de(
2947
+ ) }) : /* @__PURE__ */ ie("div", { className: "aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-bottom", children: /* @__PURE__ */ ie(
2906
2948
  "button",
2907
2949
  {
2908
2950
  type: "button",
2909
2951
  className: "aqvs-scroll-to-edge-button",
2910
2952
  tabIndex: o ? 0 : -1,
2911
- onClick: (m) => {
2912
- m.stopPropagation(), Ue.current = !0, We(r - 1), ae(!1);
2953
+ onClick: (u) => {
2954
+ u.stopPropagation(), at.current = !0, a(r - 1), rt(!1);
2913
2955
  },
2914
2956
  children: "Bottom"
2915
2957
  }
2916
2958
  ) }) });
2917
- }, [C, Oe, ne, We, r]), Bt = g(0), { visibleItems: Ht, renderAnchor: qt } = Fe(() => {
2959
+ }, [I, Ee, Ce, a, r]), Ut = g(0), { visibleItems: Wt, renderAnchor: Kt } = _e(() => {
2918
2960
  if (r === 0)
2919
2961
  return {
2920
- visibleItems: /* @__PURE__ */ de("div", { className: "aqvs-no-items-container", children: /* @__PURE__ */ de("div", { className: "aqvs-no-items-text", children: "No items" }) }),
2962
+ visibleItems: /* @__PURE__ */ ie("div", { className: "aqvs-no-items-container", children: /* @__PURE__ */ ie("div", { className: "aqvs-no-items-text", children: "No items" }) }),
2921
2963
  renderAnchor: 0
2922
2964
  };
2923
- const o = Pe(lt, r), u = Pe(Ye, r), { cumulative: m, currentValue: A } = E.prefixSum(o, { materializeOption: { materialize: !1 } }), L = m - A;
2924
- Number.isFinite(L) && Math.abs(L - Bt.current) > Zr && (Bt.current = L);
2925
- const O = Bt.current, k = [], se = [];
2926
- let Ne = 0, Ie = L;
2927
- for (let fe = o; fe <= u; fe++) {
2928
- if (se.length >= cr) {
2929
- T.warn("[VirtualScroll] Rendered item count reached the safety cap; truncating render window.", { cap: cr, safeRenderingStartIndex: o, safeRenderingEndIndex: u });
2965
+ const o = Ie(pt, r), c = Ie(wt, r), { cumulative: u, currentValue: _ } = V.prefixSum(o, { materializeOption: { materialize: !1 } }), k = u - _;
2966
+ Number.isFinite(k) && Math.abs(k - Ut.current) > ln && (Ut.current = k);
2967
+ const F = Ut.current, B = [], te = [];
2968
+ let we = 0, pe = k;
2969
+ for (let le = o; le <= c; le++) {
2970
+ if (te.length >= vr) {
2971
+ P.warn("[VirtualScroll] Rendered item count reached the safety cap; truncating render window.", { cap: vr, safeRenderingStartIndex: o, safeRenderingEndIndex: c });
2930
2972
  break;
2931
2973
  }
2932
- const Be = n(fe), ke = E.get(fe), He = Be - ke;
2933
- He !== 0 && k.push({ index: fe, value: Be });
2934
- const zt = Ie + Ne, Xt = t ? t(fe) : fe;
2935
- se.push(
2936
- /* @__PURE__ */ de(
2937
- tn,
2974
+ const qe = n(le), Oe = V.get(le), Xe = qe - Oe;
2975
+ Xe !== 0 && B.push({ index: le, value: qe });
2976
+ const Ot = pe + we, Gt = t ? t(le) : le;
2977
+ te.push(
2978
+ /* @__PURE__ */ ie(
2979
+ fn,
2938
2980
  {
2939
- index: fe,
2940
- top: zt - O,
2941
- height: Be,
2942
- item: e(fe),
2943
- clipItemHeight: ze,
2944
- enableKeyboardNavigation: ee,
2945
- onKeyDown: Qt,
2946
- onFocus: er,
2947
- registerItemRef: at,
2948
- children: I
2981
+ index: le,
2982
+ top: Ot - F,
2983
+ height: qe,
2984
+ item: e(le),
2985
+ clipItemHeight: Ke,
2986
+ enableKeyboardNavigation: z,
2987
+ onKeyDown: sr,
2988
+ onEscapeKeyDown: ke ? or : void 0,
2989
+ onFocus: ar,
2990
+ registerItemRef: Pt,
2991
+ children: v
2949
2992
  },
2950
- Xt
2993
+ Gt
2951
2994
  )
2952
- ), Ne += He, Ie += ke;
2995
+ ), we += Xe, pe += Oe;
2953
2996
  }
2954
- return k.length > 0 && Promise.resolve().then(() => {
2955
- if (et.current)
2997
+ return B.length > 0 && Promise.resolve().then(() => {
2998
+ if (ft.current)
2956
2999
  return;
2957
- let fe = 0;
2958
- for (const He of k)
2959
- if (He.index < xt) {
2960
- const zt = E.get(He.index);
2961
- fe += He.value - zt;
3000
+ let le = 0;
3001
+ for (const Xe of B)
3002
+ if (Xe.index < vt) {
3003
+ const Ot = V.get(Xe.index);
3004
+ le += Xe.value - Ot;
2962
3005
  }
2963
- const Be = E.updates(k);
2964
- if (et.current || typeof Be != "number")
3006
+ const qe = V.updates(B);
3007
+ if (ft.current || typeof qe != "number")
2965
3008
  return;
2966
- st(Be), T.debug("[VirtualScroll] Updated heights for items", k, "New total height:", Be);
2967
- const ke = ue.current?.getScrollPosition() ?? ie.current;
2968
- if (fe !== 0) {
2969
- const He = ke + fe;
2970
- bt(He, fe), we(He, { immediate: !0 }), T.debug("[VirtualScroll] Adjusted scroll for layout shift (auto update)", { from: ke, to: He, shiftAmount: fe });
2971
- } else ke !== ie.current && we(ke);
2972
- }), { visibleItems: se, renderAnchor: O };
3009
+ f(qe), P.debug("[VirtualScroll] Updated heights for items", B, "New total height:", qe);
3010
+ const Oe = j.current?.getScrollPosition() ?? M.current;
3011
+ if (le !== 0) {
3012
+ const Xe = Oe + le;
3013
+ xt(Xe, le), ge(Xe, { immediate: !0 }), P.debug("[VirtualScroll] Adjusted scroll for layout shift (auto update)", { from: Oe, to: Xe, shiftAmount: le });
3014
+ } else Oe !== M.current && ge(Oe);
3015
+ }), { visibleItems: te, renderAnchor: F };
2973
3016
  }, [
2974
- I,
2975
- ze,
2976
- Le,
2977
- ee,
3017
+ v,
3018
+ Ke,
3019
+ Ae,
3020
+ z,
2978
3021
  r,
2979
- E,
3022
+ V,
2980
3023
  e,
2981
3024
  t,
2982
3025
  n,
2983
- er,
2984
- Qt,
2985
- bt,
2986
- at,
2987
- Ye,
2988
- lt,
2989
- we,
2990
- xt
2991
- ]), gr = S(
3026
+ ar,
3027
+ sr,
3028
+ ke,
3029
+ or,
3030
+ xt,
3031
+ Pt,
3032
+ wt,
3033
+ pt,
3034
+ ge,
3035
+ vt
3036
+ ]), Pr = S(
2992
3037
  (o) => {
2993
- const u = (G ?? 0) > 0, m = Math.abs(o - Ze), A = u && m > 0.5 ? Ze : o, L = Ke(A, N.top);
2994
- if (T.debug("[VirtualScroll] Rendering visible items", () => ({
3038
+ const c = (W ?? 0) > 0, u = Math.abs(o - je), _ = c && u > 0.5 ? je : o, k = Qe(_, N.top);
3039
+ if (P.debug("[VirtualScroll] Rendering visible items", () => ({
2995
3040
  currentScrollPosition: o,
2996
- effectiveScrollPosition: L,
2997
- renderingStartIndex: lt,
2998
- renderingEndIndex: Ye,
3041
+ effectiveScrollPosition: k,
3042
+ renderingStartIndex: pt,
3043
+ renderingEndIndex: wt,
2999
3044
  itemCount: r,
3000
- viewportSize: K,
3001
- callbackThrottleMs: G,
3002
- diff: m,
3003
- rawEffectiveScrollPosition: A
3045
+ viewportSize: be,
3046
+ callbackThrottleMs: W,
3047
+ diff: u,
3048
+ rawEffectiveScrollPosition: _
3004
3049
  })), r === 0)
3005
- return Ht;
3006
- const O = N.top + qt - A, k = N.bottom > 0 ? /* @__PURE__ */ de(
3050
+ return Wt;
3051
+ const F = N.top + Kt - _, B = N.bottom > 0 ? /* @__PURE__ */ ie(
3007
3052
  "div",
3008
3053
  {
3009
3054
  className: "aqvs-bottom-inset",
3010
3055
  style: {
3011
3056
  // ラッパー座標での bottom インセット位置 = コンテンツ総高さ (最終行の下端) - アンカー。
3012
- top: E.getTotal() - qt,
3057
+ top: V.getTotal() - Kt,
3013
3058
  height: N.bottom
3014
3059
  }
3015
3060
  },
3016
3061
  "virtualscroll-bottom-inset"
3017
3062
  ) : null;
3018
- return T.debug("[VirtualScroll] Rendering items", () => ({
3019
- containerTop: O,
3020
- logicalScrollPosition: Re,
3063
+ return P.debug("[VirtualScroll] Rendering items", () => ({
3064
+ containerTop: F,
3065
+ logicalScrollPosition: lt,
3021
3066
  resolvedInsets: N,
3022
- effectiveScrollPosition: L
3023
- })), /* @__PURE__ */ Mt("div", { className: "aqvs-items-wrapper", style: { top: 0, transform: `translateY(${O}px)`, willChange: "transform" }, children: [
3024
- Ht,
3025
- k
3067
+ effectiveScrollPosition: k
3068
+ })), /* @__PURE__ */ Tt("div", { className: "aqvs-items-wrapper", style: { top: 0, transform: `translateY(${F}px)`, willChange: "transform" }, children: [
3069
+ Wt,
3070
+ B
3026
3071
  ] });
3027
3072
  },
3028
- [G, r, E, Re, qt, Ye, lt, N, Ze, K, Ht]
3029
- ), tr = Fe(
3073
+ [W, r, V, lt, Kt, wt, pt, N, je, be, Wt]
3074
+ ), lr = _e(
3030
3075
  () => ({
3031
- renderingStartIndex: Ee.renderingStartIndex,
3032
- renderingEndIndex: Ee.renderingEndIndex,
3033
- visibleStartIndex: Ee.visibleStartIndex,
3034
- visibleEndIndex: Ee.visibleEndIndex,
3035
- scrollPosition: Re,
3036
- totalHeight: E.getTotal()
3076
+ renderingStartIndex: Ze.renderingStartIndex,
3077
+ renderingEndIndex: Ze.renderingEndIndex,
3078
+ visibleStartIndex: Ze.visibleStartIndex,
3079
+ visibleEndIndex: Ze.visibleEndIndex,
3080
+ scrollPosition: lt,
3081
+ totalHeight: V.getTotal()
3037
3082
  // contentSize (State) ではなく最新値を反映
3038
3083
  }),
3039
3084
  // contentSize を依存に含めることで、updateItemSize/updates 等で木の総高さが変わった際に
3040
3085
  // (fenwickTree は安定参照のため getTotal() の変化だけでは再計算されない) 総高さを再取得する。
3041
- [Ee, Re, E, Le]
3086
+ [Ze, lt, V, Ae]
3042
3087
  );
3043
- q(() => {
3044
- be.current = tr;
3045
- }, [tr]), Jt(
3046
- M,
3088
+ X(() => {
3089
+ tt.current = lr;
3090
+ }, [lr]);
3091
+ const [yr, cr] = Je(""), ur = g(w);
3092
+ et(() => {
3093
+ ur.current = w;
3094
+ }, [w]);
3095
+ const Et = w?.debounceMs ?? 400, Ht = Number.isFinite(Et) && Et >= 0, Lt = w !== void 0;
3096
+ X(() => {
3097
+ Lt && !Ht && P.warn(`[VirtualScroll] liveRegion.debounceMs must be a finite number >= 0, received ${Et}. Announcements are disabled.`);
3098
+ }, [Lt, Ht, Et]), X(() => {
3099
+ if (!(Lt && Ht)) {
3100
+ cr("");
3101
+ return;
3102
+ }
3103
+ const o = setTimeout(() => {
3104
+ const c = ur.current?.format;
3105
+ if (!c)
3106
+ return;
3107
+ const u = c({ visibleStartIndex: vt, visibleEndIndex: Rt, itemCount: r });
3108
+ cr(u);
3109
+ }, Et);
3110
+ return () => clearTimeout(o);
3111
+ }, [Lt, Ht, Et, vt, Rt, r]), ir(
3112
+ Z,
3047
3113
  () => ({
3048
3114
  getScrollPosition: () => {
3049
- const o = ue.current?.getScrollPosition();
3050
- return typeof o == "number" ? Ke(o, ct.current) : -1;
3115
+ const o = j.current?.getScrollPosition();
3116
+ return typeof o == "number" ? Qe(o, Ye.current) : -1;
3051
3117
  },
3052
- getContentSize: () => ue.current?.getContentSize() ?? -1,
3053
- getViewportSize: () => ue.current?.getViewportSize() ?? -1,
3054
- scrollTo: R,
3055
- scrollBy: D,
3056
- applyWheel: $,
3057
- scrollToIndex: We,
3058
- getFenwickTreeTotalHeight: () => E.getTotal(),
3059
- getFenwickSize: () => E.getSize(),
3060
- focusItemAtIndex: Tt,
3061
- getRange: () => be.current,
3062
- getScrollAnchor: x,
3063
- updateItemSize: Ot
3118
+ getContentSize: () => j.current?.getContentSize() ?? -1,
3119
+ getViewportSize: () => j.current?.getViewportSize() ?? -1,
3120
+ scrollTo: U,
3121
+ scrollBy: ve,
3122
+ applyWheel: Be,
3123
+ scrollToIndex: a,
3124
+ getFenwickTreeTotalHeight: () => V.getTotal(),
3125
+ getFenwickSize: () => V.getSize(),
3126
+ focusItemAtIndex: ht,
3127
+ getRange: () => tt.current,
3128
+ getScrollAnchor: L,
3129
+ updateItemSize: At
3064
3130
  }),
3065
- [R, D, $, We, E, Tt, x, Ot]
3131
+ [U, ve, Be, a, V, ht, L, At]
3066
3132
  );
3067
- const br = E.getTotal() + N.top + N.bottom;
3068
- return /* @__PURE__ */ de(
3069
- Xr,
3133
+ const Rr = V.getTotal() + N.top + N.bottom, dr = /* @__PURE__ */ ie(
3134
+ en,
3070
3135
  {
3071
- ref: ue,
3072
- contentSize: br,
3136
+ ref: j,
3137
+ contentSize: Rr,
3073
3138
  viewportSize: i,
3074
- onViewportSizeChange: Ae,
3075
- className: a,
3076
- testId: c,
3077
- onScroll: ye,
3078
- background: w,
3079
- tapScrollCircleOptions: W,
3080
- inertiaOptions: Xe,
3081
- overscrollBehavior: $e,
3139
+ onViewportSizeChange: Se,
3140
+ className: l,
3141
+ testId: d,
3142
+ onScroll: He,
3143
+ background: T,
3144
+ tapScrollCircleOptions: fe,
3145
+ inertiaOptions: Ve,
3146
+ overscrollBehavior: Fe,
3082
3147
  itemCount: r,
3083
- scrollBarWidth: Z,
3084
- enableThumbDrag: Q,
3085
- enableTrackClick: U,
3086
- enableArrowButtons: Se,
3087
- enablePointerDrag: ge,
3088
- pointerDragInputs: qe,
3089
- renderThumbOverlay: v,
3090
- wheelSpeedMultiplier: X,
3091
- onWheelHorizontal: ce,
3148
+ scrollBarWidth: Q,
3149
+ enableThumbDrag: K,
3150
+ enableTrackClick: he,
3151
+ enableArrowButtons: A,
3152
+ enablePointerDrag: $e,
3153
+ pointerDragInputs: Ue,
3154
+ renderThumbOverlay: G,
3155
+ wheelSpeedMultiplier: We,
3156
+ onWheelHorizontal: oe,
3092
3157
  contentInsets: N,
3093
- contentProps: _,
3094
- visibleStartIndex: xt,
3095
- visibleEndIndex: _t,
3096
- renderOverlay: hr,
3097
- initialScrollPosition: J.position,
3098
- children: gr
3158
+ contentProps: Y,
3159
+ visibleStartIndex: vt,
3160
+ visibleEndIndex: Rt,
3161
+ renderOverlay: Mr,
3162
+ initialScrollPosition: ot.position,
3163
+ children: Pr
3099
3164
  }
3100
3165
  );
3101
- }, un = Zt(rn);
3166
+ return Lt ? /* @__PURE__ */ Tt(rr, { children: [
3167
+ dr,
3168
+ /* @__PURE__ */ ie("div", { className: "aqvs-live-region", role: "status", "aria-live": "polite", "aria-atomic": "true", "data-aqvs-live-region": "", children: yr })
3169
+ ] }) : dr;
3170
+ }, Sn = nr(mn);
3102
3171
  export {
3103
3172
  St as FenwickMapTree,
3104
- kr as ScrollBar,
3105
- Xr as ScrollPane,
3106
- pr as TAP_SCROLL_SPEED_DEFAULTS,
3107
- un as VirtualScroll,
3108
- _r as computeAutoTapScrollMaxSpeedMultiplier,
3109
- Or as computeTapScrollSpeed,
3110
- le as minmax,
3111
- an as tapScrollCircleSampleVisual,
3112
- Wr as useFenwickMapTree,
3113
- ln as useHeightCache,
3114
- jr as useLruCache,
3115
- cn as useWheelBridge
3173
+ Kr as ScrollBar,
3174
+ en as ScrollPane,
3175
+ Tr as TAP_SCROLL_SPEED_DEFAULTS,
3176
+ Sn as VirtualScroll,
3177
+ Wr as computeAutoTapScrollMaxSpeedMultiplier,
3178
+ Ur as computeTapScrollSpeed,
3179
+ bn as createResidualQuantizer,
3180
+ se as minmax,
3181
+ xn as tapScrollCircleSampleVisual,
3182
+ nn as useFenwickMapTree,
3183
+ vn as useHeightCache,
3184
+ on as useLruCache,
3185
+ In as useWheelBridge
3116
3186
  };