@aiquants/virtualscroll 3.1.0 → 3.1.1

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