@aiquants/virtualscroll 1.24.0 → 1.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { jsx as ot, jsxs as he, Fragment as Ge } from "react/jsx-runtime";
2
- import Qe, { memo as tr, forwardRef as Be, useState as Jt, useRef as I, useCallback as S, useImperativeHandle as qe, useMemo as Lt, useLayoutEffect as Te, useEffect as q, useId as er } from "react";
3
- import { twMerge as pe } from "tailwind-merge";
4
- class C {
1
+ import { jsx as ot, jsxs as Se, Fragment as tr } from "react/jsx-runtime";
2
+ import nr, { memo as ir, forwardRef as $e, useState as re, useRef as x, useCallback as S, useImperativeHandle as Ue, useMemo as Ft, useLayoutEffect as ye, useEffect as Y, useId as sr } from "react";
3
+ import { twMerge as Te } from "tailwind-merge";
4
+ class N {
5
5
  level;
6
6
  prefix;
7
7
  impl;
@@ -11,10 +11,10 @@ class C {
11
11
  * @param {string} [prefix="[virtualscroll]"] - The prefix to add to all log messages.
12
12
  * @param {ILogger} [impl=console] - The implementation to use for logging.
13
13
  */
14
- constructor(t = 2, e = "[virtualscroll]", r = console) {
15
- this.level = t, this.prefix = e, this.impl = r;
14
+ constructor(t = 2, e = "[virtualscroll]", n = console) {
15
+ this.level = t, this.prefix = e, this.impl = n;
16
16
  }
17
- static instance = new C(2, "[virtualscroll]");
17
+ static instance = new N(2, "[virtualscroll]");
18
18
  /**
19
19
  * @method setLevel
20
20
  * @description Updates the current log level for the static instance.
@@ -22,7 +22,7 @@ class C {
22
22
  * @param {LogLevel} level - The new log level.
23
23
  */
24
24
  static setLevel(t) {
25
- C.instance.setLevel(t);
25
+ N.instance.setLevel(t);
26
26
  }
27
27
  /**
28
28
  * @method setLevel
@@ -40,7 +40,7 @@ class C {
40
40
  * @param {ILogger} impl - The new logger implementation.
41
41
  */
42
42
  static setImplementation(t) {
43
- C.instance.setImplementation(t);
43
+ N.instance.setImplementation(t);
44
44
  }
45
45
  /**
46
46
  * @method setImplementation
@@ -58,7 +58,7 @@ class C {
58
58
  * @param {string} prefix - The new prefix.
59
59
  */
60
60
  static setPrefix(t) {
61
- C.instance.setPrefix(t);
61
+ N.instance.setPrefix(t);
62
62
  }
63
63
  /**
64
64
  * @method setPrefix
@@ -77,7 +77,7 @@ class C {
77
77
  * @returns {boolean} True if a message at `level` would be emitted. / `level` のメッセージが出力されるなら true。
78
78
  */
79
79
  static isEnabled(t) {
80
- return C.instance.isEnabled(t);
80
+ return N.instance.isEnabled(t);
81
81
  }
82
82
  /**
83
83
  * @method isEnabled
@@ -122,49 +122,49 @@ class C {
122
122
  return typeof t == "string" ? [`${this.prefix} ${t}`] : [this.prefix, t];
123
123
  }
124
124
  static debug(t, ...e) {
125
- C.instance.debug(t, ...e);
125
+ N.instance.debug(t, ...e);
126
126
  }
127
127
  debug(t, ...e) {
128
- this.level <= 0 && this.impl.debug(...this.formatMessage(C.resolveLazy(t)), ...e.map(C.resolveLazy));
128
+ this.level <= 0 && this.impl.debug(...this.formatMessage(N.resolveLazy(t)), ...e.map(N.resolveLazy));
129
129
  }
130
130
  static info(t, ...e) {
131
- C.instance.info(t, ...e);
131
+ N.instance.info(t, ...e);
132
132
  }
133
133
  info(t, ...e) {
134
- this.level <= 1 && this.impl.info(...this.formatMessage(C.resolveLazy(t)), ...e.map(C.resolveLazy));
134
+ this.level <= 1 && this.impl.info(...this.formatMessage(N.resolveLazy(t)), ...e.map(N.resolveLazy));
135
135
  }
136
136
  static warn(t, ...e) {
137
- C.instance.warn(t, ...e);
137
+ N.instance.warn(t, ...e);
138
138
  }
139
139
  warn(t, ...e) {
140
- this.level <= 2 && this.impl.warn(...this.formatMessage(C.resolveLazy(t)), ...e.map(C.resolveLazy));
140
+ this.level <= 2 && this.impl.warn(...this.formatMessage(N.resolveLazy(t)), ...e.map(N.resolveLazy));
141
141
  }
142
142
  static error(t, ...e) {
143
- C.instance.error(t, ...e);
143
+ N.instance.error(t, ...e);
144
144
  }
145
145
  error(t, ...e) {
146
- this.level <= 3 && this.impl.error(...this.formatMessage(C.resolveLazy(t)), ...e.map(C.resolveLazy));
146
+ this.level <= 3 && this.impl.error(...this.formatMessage(N.resolveLazy(t)), ...e.map(N.resolveLazy));
147
147
  }
148
148
  }
149
- const He = {
149
+ const Ke = {
150
150
  active: !1,
151
151
  offsetX: 0,
152
152
  offsetY: 0,
153
153
  distance: 0,
154
154
  direction: 0,
155
155
  pointerId: null
156
- }, _e = 6, rr = 8, nr = ({ dragState: n, normalizedDistance: t }) => {
157
- const e = 1 + t * 0.18, r = 0.16 + t * 0.24, i = 0.38 + t * 0.28, s = n.active ? "80ms ease-out" : "220ms ease";
158
- return /* @__PURE__ */ he(Ge, { children: [
156
+ }, ze = 6, or = 8, ar = ({ dragState: r, normalizedDistance: t }) => {
157
+ const e = 1 + t * 0.18, n = 0.16 + t * 0.24, i = 0.38 + t * 0.28, s = r.active ? "80ms ease-out" : "220ms ease";
158
+ return /* @__PURE__ */ Se(tr, { children: [
159
159
  /* @__PURE__ */ ot(
160
160
  "div",
161
161
  {
162
162
  className: "aqvs-tap-scroll-circle-visual-outer",
163
163
  style: {
164
164
  background: "linear-gradient(140deg, rgba(255,255,255,0.62), rgba(72,72,72,0.48))",
165
- boxShadow: `0 0 0 1px rgba(255,255,255,0.28), 0 10px 22px rgba(0,0,0,${r})`,
165
+ boxShadow: `0 0 0 1px rgba(255,255,255,0.28), 0 10px 22px rgba(0,0,0,${n})`,
166
166
  transform: `scale(${e})`,
167
- transition: `${s}, ${n.active ? "80ms" : "260ms"} box-shadow ease`
167
+ transition: `${s}, ${r.active ? "80ms" : "260ms"} box-shadow ease`
168
168
  }
169
169
  }
170
170
  ),
@@ -176,159 +176,159 @@ const He = {
176
176
  background: "linear-gradient(140deg, rgba(255,255,255,0.72), rgba(28,28,28,0.58))",
177
177
  boxShadow: "inset 0 4px 10px rgba(0,0,0,0.24), inset 0 0 2px rgba(255,255,255,0.55)",
178
178
  opacity: i,
179
- transition: n.active ? "120ms opacity ease-out" : "220ms opacity ease"
179
+ transition: r.active ? "120ms opacity ease-out" : "220ms opacity ease"
180
180
  }
181
181
  }
182
182
  )
183
183
  ] });
184
- }, Ze = tr(
185
- Be(({ onDragChange: n, className: t, maxVisualDistance: e = 160, size: r = 40, style: i, opacity: s = 1, renderVisual: a }, c) => {
186
- const [d, b] = Jt(He), x = I(null), v = I(null), E = I({ x: 0, y: 0 }), m = I(null), _ = I(0), B = S(
184
+ }, er = ir(
185
+ $e(({ onDragChange: r, className: t, maxVisualDistance: e = 160, size: n = 40, style: i, opacity: s = 1, renderVisual: a }, c) => {
186
+ const [d, b] = re(Ke), I = x(null), v = x(null), C = x({ x: 0, y: 0 }), p = x(null), V = x(0), z = S(
187
187
  (T) => {
188
- b(T), n(T);
188
+ b(T), r(T);
189
189
  },
190
- [n]
191
- ), Z = S(
192
- (T, V, Tt = !1) => {
193
- const { x: Yt, y: yt } = E.current, J = T - Yt, F = V - yt, Ct = Math.abs(F), W = Ct < _e ? 0 : F < 0 ? -1 : 1, At = _.current;
194
- let y = W;
195
- const Kt = _e + rr;
196
- W === 0 ? At !== 0 && Ct < Kt ? y = At : (y = 0, Tt || (_.current = 0)) : W !== At && At !== 0 && Ct < Kt ? y = At : _.current = W, B({
197
- active: Tt || Ct >= _e,
198
- offsetX: J,
199
- offsetY: F,
200
- distance: Ct,
201
- direction: y,
202
- pointerId: x.current
190
+ [r]
191
+ ), W = S(
192
+ (T, q, H = !1) => {
193
+ const { x: Ht, y: Dt } = C.current, et = T - Ht, nt = q - Dt, G = Math.abs(nt), J = G < ze ? 0 : nt < 0 ? -1 : 1, Rt = V.current;
194
+ let Lt = J;
195
+ const Wt = ze + or;
196
+ J === 0 ? Rt !== 0 && G < Wt ? Lt = Rt : (Lt = 0, H || (V.current = 0)) : J !== Rt && Rt !== 0 && G < Wt ? Lt = Rt : V.current = J, z({
197
+ active: H || G >= ze,
198
+ offsetX: et,
199
+ offsetY: nt,
200
+ distance: G,
201
+ direction: Lt,
202
+ pointerId: I.current
203
203
  });
204
204
  },
205
- [B]
206
- ), ut = S((T) => {
205
+ [z]
206
+ ), at = S((T) => {
207
207
  if (T === null)
208
208
  return;
209
- const V = m.current;
210
- V?.hasPointerCapture(T) && V.releasePointerCapture(T);
211
- }, []), rt = S(
209
+ const q = p.current;
210
+ q?.hasPointerCapture(T) && q.releasePointerCapture(T);
211
+ }, []), Q = S(
212
212
  (T = !1) => {
213
- T && ut(x.current), x.current = null, v.current = null, _.current = 0, B(He);
213
+ T && at(I.current), I.current = null, v.current = null, V.current = 0, z(Ke);
214
214
  },
215
- [B, ut]
216
- ), nt = S(
215
+ [z, at]
216
+ ), tt = S(
217
217
  (T) => {
218
- if (x.current !== null && x.current !== T.pointerId) {
218
+ if (I.current !== null && I.current !== T.pointerId) {
219
219
  v.current = { pointerId: T.pointerId, clientX: T.clientX, clientY: T.clientY }, T.preventDefault(), T.stopPropagation();
220
220
  return;
221
221
  }
222
222
  T.preventDefault(), T.stopPropagation();
223
- const V = m.current ?? T.currentTarget, { left: Tt, top: Yt, width: yt, height: J } = V.getBoundingClientRect();
224
- E.current = { x: Tt + yt / 2, y: Yt + J / 2 }, x.current = T.pointerId;
223
+ const q = p.current ?? T.currentTarget, { left: H, top: Ht, width: Dt, height: et } = q.getBoundingClientRect();
224
+ C.current = { x: H + Dt / 2, y: Ht + et / 2 }, I.current = T.pointerId;
225
225
  try {
226
- V.setPointerCapture(T.pointerId);
226
+ q.setPointerCapture(T.pointerId);
227
227
  } catch {
228
228
  }
229
- Z(T.clientX, T.clientY, !0);
229
+ W(T.clientX, T.clientY, !0);
230
230
  },
231
- [Z]
232
- ), pt = S(
231
+ [W]
232
+ ), xt = S(
233
233
  (T) => {
234
- if (x.current !== T.pointerId) {
234
+ if (I.current !== T.pointerId) {
235
235
  v.current !== null && v.current.pointerId === T.pointerId && (v.current = { pointerId: T.pointerId, clientX: T.clientX, clientY: T.clientY });
236
236
  return;
237
237
  }
238
- T.preventDefault(), Z(T.clientX, T.clientY);
238
+ T.preventDefault(), W(T.clientX, T.clientY);
239
239
  },
240
- [Z]
241
- ), Pt = S(
240
+ [W]
241
+ ), wt = S(
242
242
  (T) => {
243
- if (x.current !== T.pointerId) {
243
+ if (I.current !== T.pointerId) {
244
244
  v.current !== null && v.current.pointerId === T.pointerId && (v.current = null);
245
245
  return;
246
246
  }
247
247
  T.preventDefault(), T.stopPropagation();
248
- const V = v.current;
249
- if (v.current = null, V !== null) {
250
- ut(T.pointerId);
251
- const Tt = m.current;
252
- let Yt = !0;
253
- if (Tt !== null && typeof Tt.setPointerCapture == "function")
248
+ const q = v.current;
249
+ if (v.current = null, q !== null) {
250
+ at(T.pointerId);
251
+ const H = p.current;
252
+ let Ht = !0;
253
+ if (H !== null && typeof H.setPointerCapture == "function")
254
254
  try {
255
- Tt.setPointerCapture(V.pointerId);
256
- } catch (yt) {
257
- (typeof yt == "object" && yt !== null && "name" in yt ? yt.name : void 0) === "NotFoundError" && (Yt = !1);
255
+ H.setPointerCapture(q.pointerId);
256
+ } catch (Dt) {
257
+ (typeof Dt == "object" && Dt !== null && "name" in Dt ? Dt.name : void 0) === "NotFoundError" && (Ht = !1);
258
258
  }
259
- if (Yt) {
260
- x.current = V.pointerId, Z(V.clientX, V.clientY, !0);
259
+ if (Ht) {
260
+ I.current = q.pointerId, W(q.clientX, q.clientY, !0);
261
261
  return;
262
262
  }
263
263
  }
264
- rt(!0);
264
+ Q(!0);
265
265
  },
266
- [rt, ut, Z]
267
- ), D = S(
266
+ [Q, at, W]
267
+ ), A = S(
268
268
  (T) => {
269
- T.target === T.currentTarget && x.current === T.pointerId && rt(!1);
269
+ T.target === T.currentTarget && I.current === T.pointerId && Q(!1);
270
270
  },
271
- [rt]
271
+ [Q]
272
272
  );
273
- qe(
273
+ Ue(
274
274
  c,
275
275
  () => ({
276
276
  reset: () => {
277
- rt(!0);
277
+ Q(!0);
278
278
  },
279
- getElement: () => m.current
279
+ getElement: () => p.current
280
280
  }),
281
- [rt]
281
+ [Q]
282
282
  );
283
- const O = Math.min(Math.max(s, 0), 1), P = r / 64, X = Math.min(d.distance, e) / e, $ = d.direction * X * 10 * P, N = a ?? nr, lt = {
283
+ const O = Math.min(Math.max(s, 0), 1), M = n / 64, U = Math.min(d.distance, e) / e, Z = d.direction * U * 10 * M, w = a ?? ar, lt = {
284
284
  dragState: d,
285
- normalizedDistance: X,
286
- sizeScale: P,
287
- size: r,
285
+ normalizedDistance: U,
286
+ sizeScale: M,
287
+ size: n,
288
288
  opacity: O
289
- }, K = {
289
+ }, j = {
290
290
  ...i,
291
- width: r,
292
- height: r,
293
- transform: `translateY(${$}px)`
291
+ width: n,
292
+ height: n,
293
+ transform: `translateY(${Z}px)`
294
294
  };
295
- return K.opacity = O, /* @__PURE__ */ ot(
295
+ return j.opacity = O, /* @__PURE__ */ ot(
296
296
  "div",
297
297
  {
298
- ref: m,
298
+ ref: p,
299
299
  "data-testid": "virtual-scroll-tap-circle",
300
- className: pe("aqvs-tap-scroll-circle", t),
301
- style: K,
300
+ className: Te("aqvs-tap-scroll-circle", t),
301
+ style: j,
302
302
  tabIndex: -1,
303
- onPointerDown: nt,
304
- onPointerMove: pt,
305
- onPointerUp: Pt,
306
- onPointerCancel: Pt,
307
- onLostPointerCapture: D,
303
+ onPointerDown: tt,
304
+ onPointerMove: xt,
305
+ onPointerUp: wt,
306
+ onPointerCancel: wt,
307
+ onLostPointerCapture: A,
308
308
  role: "presentation",
309
- children: N(lt)
309
+ children: w(lt)
310
310
  }
311
311
  );
312
312
  })
313
313
  );
314
- Ze.displayName = "TapScrollCircle";
315
- const vt = (n, t, e) => Math.max(t, Math.min(e, n)), Ye = "virtualscroll:tap-scroll-cancel", Xe = 20, ir = 250, sr = 60, or = 20, ar = 20, Je = {
314
+ er.displayName = "TapScrollCircle";
315
+ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scroll-cancel", We = 20, lr = 250, cr = 60, ur = 20, dr = 20, rr = {
316
316
  /** 速度が最大に達する引き距離 (px)。`maxVisualDistance` の既定値。 */
317
317
  maxDistance: 240,
318
318
  /** 最小速度倍率 (ビューポート比)。 */
319
319
  minSpeedMultiplier: 0.2
320
- }, lr = Je.maxDistance, $e = { active: !1, offsetX: 0, offsetY: 0, distance: 0, direction: 0, pointerId: null }, Oe = 2.2, cr = 8, ur = 120, dr = 1 / 10, Zt = {
320
+ }, fr = rr.maxDistance, je = { active: !1, offsetX: 0, offsetY: 0, distance: 0, direction: 0, pointerId: null }, Ye = 2.2, mr = 8, pr = 120, hr = 1 / 10, te = {
321
321
  enabled: !0,
322
322
  size: 40,
323
323
  offsetX: -80,
324
324
  offsetY: 0,
325
325
  className: void 0,
326
- maxVisualDistance: lr,
327
- minSpeedMultiplier: Je.minSpeedMultiplier,
326
+ maxVisualDistance: fr,
327
+ minSpeedMultiplier: rr.minSpeedMultiplier,
328
328
  opacity: 0.9,
329
329
  renderVisual: void 0,
330
330
  maxSpeedCurve: void 0
331
- }, fr = (n) => n ? {
331
+ }, gr = (r) => r ? {
332
332
  mainSizeKey: "width",
333
333
  crossSizeKey: "height",
334
334
  positionKey: "left",
@@ -348,319 +348,319 @@ const vt = (n, t, e) => Math.max(t, Math.min(e, n)), Ye = "virtualscroll:tap-scr
348
348
  arrowIcons: ["▲", "▼"],
349
349
  directionClass: "aqvs-scrollbar-vertical",
350
350
  orientation: "vertical"
351
- }, mr = (n, t) => {
352
- const e = n?.maxSpeedMultiplier, r = typeof e == "number" ? e : xr(t);
351
+ }, br = (r, t) => {
352
+ const e = r?.maxSpeedMultiplier, n = typeof e == "number" ? e : vr(t);
353
353
  return {
354
- enabled: n?.enabled ?? Zt.enabled,
355
- size: n?.size ?? Zt.size,
356
- offsetX: n?.offsetX ?? Zt.offsetX,
357
- offsetY: n?.offsetY ?? Zt.offsetY,
358
- className: n?.className ?? Zt.className,
359
- maxVisualDistance: n?.maxVisualDistance ?? Zt.maxVisualDistance,
360
- maxSpeedMultiplier: r,
361
- minSpeedMultiplier: Math.max(n?.minSpeedMultiplier ?? Zt.minSpeedMultiplier, 0),
362
- opacity: vt(n?.opacity ?? Zt.opacity, 0, 1),
363
- renderVisual: n?.renderVisual ?? Zt.renderVisual,
364
- maxSpeedCurve: n?.maxSpeedCurve ?? Zt.maxSpeedCurve
354
+ enabled: r?.enabled ?? te.enabled,
355
+ size: r?.size ?? te.size,
356
+ offsetX: r?.offsetX ?? te.offsetX,
357
+ offsetY: r?.offsetY ?? te.offsetY,
358
+ className: r?.className ?? te.className,
359
+ maxVisualDistance: r?.maxVisualDistance ?? te.maxVisualDistance,
360
+ maxSpeedMultiplier: n,
361
+ minSpeedMultiplier: Math.max(r?.minSpeedMultiplier ?? te.minSpeedMultiplier, 0),
362
+ opacity: rt(r?.opacity ?? te.opacity, 0, 1),
363
+ renderVisual: r?.renderVisual ?? te.renderVisual,
364
+ maxSpeedCurve: r?.maxSpeedCurve ?? te.maxSpeedCurve
365
365
  };
366
- }, pr = ({ isDragging: n, isThumbHovered: t, enableThumbDrag: e }) => Lt(() => e ? n ? "dragging" : t ? "hover" : "idle" : "disabled", [e, n, t]), hr = ({ canUseArrowButtons: n, enableArrowButtons: t, resetTapScroll: e, scrollByStep: r }) => {
367
- const i = I(null), s = I(null), a = I(null), c = S(() => {
366
+ }, xr = ({ isDragging: r, isThumbHovered: t, enableThumbDrag: e }) => Ft(() => e ? r ? "dragging" : t ? "hover" : "idle" : "disabled", [e, r, t]), Ir = ({ canUseArrowButtons: r, enableArrowButtons: t, resetTapScroll: e, scrollByStep: n }) => {
367
+ const i = x(null), s = x(null), a = x(null), c = S(() => {
368
368
  i.current !== null && (window.clearInterval(i.current), i.current = null), s.current !== null && (window.clearTimeout(s.current), s.current = null), a.current !== null && (window.removeEventListener("pointerup", a.current), window.removeEventListener("pointercancel", a.current), window.removeEventListener("blur", a.current), a.current = null);
369
369
  }, []), d = S(() => {
370
370
  c();
371
371
  }, [c]), b = S(
372
- (v) => (E) => {
373
- if (!n)
372
+ (v) => (C) => {
373
+ if (!r)
374
374
  return;
375
- E.cancelable && E.preventDefault(), E.stopPropagation(), e(), c(), r(v), s.current = window.setTimeout(() => {
375
+ C.cancelable && C.preventDefault(), C.stopPropagation(), e(), c(), n(v), s.current = window.setTimeout(() => {
376
376
  i.current = window.setInterval(() => {
377
- r(v);
378
- }, sr);
379
- }, ir);
380
- const m = () => c();
381
- a.current = m, window.addEventListener("pointerup", m), window.addEventListener("pointercancel", m), window.addEventListener("blur", m);
377
+ n(v);
378
+ }, cr);
379
+ }, lr);
380
+ const p = () => c();
381
+ a.current = p, window.addEventListener("pointerup", p), window.addEventListener("pointercancel", p), window.addEventListener("blur", p);
382
382
  },
383
- [n, c, e, r]
384
- ), x = S(
385
- (v) => (E) => {
386
- t && (E.key === "Enter" || E.key === " " || E.key === "Spacebar") && (E.preventDefault(), r(v));
383
+ [r, c, e, n]
384
+ ), I = S(
385
+ (v) => (C) => {
386
+ t && (C.key === "Enter" || C.key === " " || C.key === "Spacebar") && (C.preventDefault(), n(v));
387
387
  },
388
- [t, r]
388
+ [t, n]
389
389
  );
390
- return q(() => {
391
- n || c();
392
- }, [n, c]), q(() => () => {
390
+ return Y(() => {
391
+ r || c();
392
+ }, [r, c]), Y(() => () => {
393
393
  c();
394
- }, [c]), { handleArrowPointerDown: b, handleArrowPointerUp: d, handleArrowKeyDown: x };
395
- }, gr = 700, fe = (n, t) => typeof n == "number" && Number.isFinite(n) ? n : t, br = ({ distance: n, maxDistance: t, viewportSize: e, minSpeedMultiplier: r, maxSpeedMultiplier: i, hasCustomMaxSpeedMultiplier: s, curve: a }) => {
396
- const c = Math.max(fe(n, 0), 0), d = fe(t, 0), b = d > 0 ? Math.min(c, d) / d : 1, x = Math.max(fe(e, 0), 0), v = Math.max(fe(r, 0), 0), E = Math.max(fe(i, 0), 0), m = Math.max(x * v, 40), _ = s ? m : 1200, B = Math.max(x * E, _), Z = a ? Math.max(fe(a.exponentialScale, E), 0) : 0, ut = a ? Math.min(B, Math.max(x * Z, m)) : B, rt = Math.max(ut, m);
397
- let nt = b ** 1.1;
394
+ }, [c]), { handleArrowPointerDown: b, handleArrowPointerUp: d, handleArrowKeyDown: I };
395
+ }, Tr = 700, he = (r, t) => typeof r == "number" && Number.isFinite(r) ? r : t, Sr = ({ distance: r, maxDistance: t, viewportSize: e, minSpeedMultiplier: n, maxSpeedMultiplier: i, hasCustomMaxSpeedMultiplier: s, curve: a }) => {
396
+ const c = Math.max(he(r, 0), 0), d = he(t, 0), b = d > 0 ? Math.min(c, d) / d : 1, I = Math.max(he(e, 0), 0), v = Math.max(he(n, 0), 0), C = Math.max(he(i, 0), 0), p = Math.max(I * v, 40), V = s ? p : 1200, z = Math.max(I * C, V), W = a ? Math.max(he(a.exponentialScale, C), 0) : 0, at = a ? Math.min(z, Math.max(I * W, p)) : z, Q = Math.max(at, p);
397
+ let tt = b ** 1.1;
398
398
  if (a) {
399
- const Pt = Math.min(Math.max(fe(a.exponentialSteepness, 0), 0), gr);
400
- if (Pt === 0)
401
- nt = b;
399
+ const wt = Math.min(Math.max(he(a.exponentialSteepness, 0), 0), Tr);
400
+ if (wt === 0)
401
+ tt = b;
402
402
  else {
403
- const D = Math.expm1(Pt) || 1;
404
- nt = Math.min(Math.max(Math.expm1(Pt * b) / D, 0), 1);
403
+ const A = Math.expm1(wt) || 1;
404
+ tt = Math.min(Math.max(Math.expm1(wt * b) / A, 0), 1);
405
405
  }
406
406
  }
407
- const pt = Math.min(Math.max(fe(a?.easedOffset, 0), 0), 1);
408
- return m + (rt - m) * (pt + (1 - pt) * nt);
409
- }, xr = (n) => {
410
- if (!n || n <= 0)
411
- return Oe;
412
- const t = Math.max(1, n), e = Math.log10(t), r = Oe + e * cr;
413
- return vt(r, Oe, ur);
414
- }, Ir = ({
415
- contentSize: n,
407
+ const xt = Math.min(Math.max(he(a?.easedOffset, 0), 0), 1);
408
+ return p + (Q - p) * (xt + (1 - xt) * tt);
409
+ }, vr = (r) => {
410
+ if (!r || r <= 0)
411
+ return Ye;
412
+ const t = Math.max(1, r), e = Math.log10(t), n = Ye + e * mr;
413
+ return rt(n, Ye, pr);
414
+ }, Mr = ({
415
+ contentSize: r,
416
416
  viewportSize: t,
417
417
  scrollPosition: e,
418
- onScroll: r,
418
+ onScroll: n,
419
419
  enableThumbDrag: i = !0,
420
420
  enableTrackClick: s = !0,
421
421
  enableArrowButtons: a = !0,
422
422
  horizontal: c = !1,
423
423
  scrollBarWidth: d = 12,
424
424
  className: b,
425
- ariaControls: x,
425
+ ariaControls: I,
426
426
  tapScrollCircleOptions: v,
427
- itemCount: E,
428
- renderThumbOverlay: m,
429
- visibleStartIndex: _,
430
- visibleEndIndex: B
427
+ itemCount: C,
428
+ renderThumbOverlay: p,
429
+ visibleStartIndex: V,
430
+ visibleEndIndex: z
431
431
  }) => {
432
- const [Z, ut] = Jt(!1), [rt, nt] = Jt(!1), [pt, Pt] = Jt(!1), D = I(null), O = I({
432
+ const [W, at] = re(!1), [Q, tt] = re(!1), [xt, wt] = re(!1), A = x(null), O = x({
433
433
  pointerId: null,
434
434
  startThumbPosition: 0,
435
435
  startClientX: 0,
436
436
  startClientY: 0,
437
437
  scale: 1,
438
438
  captureTarget: null
439
- }), P = I({ pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1 }), X = I(e), $ = I(r), N = I($e), lt = I(null), K = I(null), T = I(null), V = I(0), Tt = I(0), Yt = Lt(() => mr(v, E), [E, v]), yt = Lt(() => fr(c), [c]), {
440
- enabled: J,
441
- size: F,
442
- offsetX: Ct,
443
- offsetY: W,
444
- className: At,
445
- maxVisualDistance: y,
446
- maxSpeedMultiplier: Kt,
447
- minSpeedMultiplier: ae,
448
- opacity: A,
449
- renderVisual: j,
450
- maxSpeedCurve: Bt
451
- } = Yt, _t = I({
439
+ }), M = x({ pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1 }), U = x(e), Z = x(n), w = x(je), lt = x(null), j = x(null), T = x(null), q = x(0), H = x(0), Ht = Ft(() => br(v, C), [C, v]), Dt = Ft(() => gr(c), [c]), {
440
+ enabled: et,
441
+ size: nt,
442
+ offsetX: G,
443
+ offsetY: J,
444
+ className: Rt,
445
+ maxVisualDistance: Lt,
446
+ maxSpeedMultiplier: Wt,
447
+ minSpeedMultiplier: R,
448
+ opacity: de,
449
+ renderVisual: it,
450
+ maxSpeedCurve: E
451
+ } = Ht, Ct = x({
452
452
  viewportSize: t,
453
- maxScrollPosition: Math.max(n - t, 0),
454
- scrollBarVisible: n > t,
455
- effectiveTapMaxDistance: Math.max(y, 1),
456
- tapCircleMaxSpeedMultiplier: Kt,
457
- tapCircleMinSpeedMultiplier: ae,
458
- tapCircleMaxSpeedCurve: Bt,
453
+ maxScrollPosition: Math.max(r - t, 0),
454
+ scrollBarVisible: r > t,
455
+ effectiveTapMaxDistance: Math.max(Lt, 1),
456
+ tapCircleMaxSpeedMultiplier: Wt,
457
+ tapCircleMinSpeedMultiplier: R,
458
+ tapCircleMaxSpeedCurve: E,
459
459
  tapScrollCircleOptions: v,
460
460
  effectiveTrackLength: 0,
461
- onScroll: r,
461
+ onScroll: n,
462
462
  scrollPosition: e
463
- }), { mainSizeKey: Et, crossSizeKey: Xt, positionKey: dt, selectDelta: p, getPointerCoordinate: ft, arrowLabels: mt, arrowIcons: z, directionClass: et, orientation: ct } = yt, Ot = Math.max(y, 1), kt = t / n, Mt = Math.max(t - d * 2, 0), it = kt * Mt, ht = Math.min(Math.max(Xe, it || 0), Mt || Xe), st = n - t, Q = Math.max(Mt - ht, 0), qt = st <= 0 || Q <= 0 ? 0 : vt(e / st * Q, 0, Q), le = qt + ht / 2, Nt = n > t || Z, $t = Nt && a;
464
- Te(() => {
465
- _t.current = {
463
+ }), { mainSizeKey: zt, crossSizeKey: Zt, positionKey: $t, selectDelta: h, getPointerCoordinate: k, arrowLabels: gt, arrowIcons: X, directionClass: vt, orientation: ct } = Dt, It = Math.max(Lt, 1), Mt = t / r, Pt = Math.max(t - d * 2, 0), ut = Mt * Pt, At = Math.min(Math.max(We, ut || 0), Pt || We), dt = r - t, st = Math.max(Pt - At, 0), _t = dt <= 0 || st <= 0 ? 0 : rt(e / dt * st, 0, st), Xt = _t + At / 2, Et = r > t || W, ne = Et && a;
464
+ ye(() => {
465
+ Ct.current = {
466
466
  viewportSize: t,
467
- maxScrollPosition: st,
468
- scrollBarVisible: Nt,
469
- effectiveTapMaxDistance: Ot,
470
- tapCircleMaxSpeedMultiplier: Kt,
471
- tapCircleMinSpeedMultiplier: ae,
472
- tapCircleMaxSpeedCurve: Bt,
467
+ maxScrollPosition: dt,
468
+ scrollBarVisible: Et,
469
+ effectiveTapMaxDistance: It,
470
+ tapCircleMaxSpeedMultiplier: Wt,
471
+ tapCircleMinSpeedMultiplier: R,
472
+ tapCircleMaxSpeedCurve: E,
473
473
  tapScrollCircleOptions: v,
474
- effectiveTrackLength: Q,
475
- onScroll: r,
474
+ effectiveTrackLength: st,
475
+ onScroll: n,
476
476
  scrollPosition: e
477
477
  };
478
- }), Te(() => {
479
- X.current = e;
480
- }, [e]), Te(() => {
481
- $.current = r;
482
- }, [r]), q(() => {
483
- i || nt(!1);
478
+ }), ye(() => {
479
+ U.current = e;
480
+ }, [e]), ye(() => {
481
+ Z.current = n;
482
+ }, [n]), Y(() => {
483
+ i || tt(!1);
484
484
  }, [i]);
485
- const Gt = pr({ isDragging: Z, isThumbHovered: rt, enableThumbDrag: i }), Vt = S((o, g) => {
486
- const M = _t.current, L = g ?? X.current;
487
- if ($.current) {
488
- const u = $.current(o, L);
489
- if (typeof u == "number" && Number.isFinite(u))
490
- return X.current = u, u;
485
+ const jt = xr({ isDragging: W, isThumbHovered: Q, enableThumbDrag: i }), Nt = S((o, g) => {
486
+ const y = Ct.current, L = g ?? U.current;
487
+ if (Z.current) {
488
+ const Yt = Z.current(o, L);
489
+ if (typeof Yt == "number" && Number.isFinite(Yt))
490
+ return U.current = Yt, Yt;
491
491
  }
492
- const H = typeof o == "function" ? o(L) : o, St = Math.max(M.maxScrollPosition, 0), l = M.scrollBarVisible ? vt(H, 0, St) : 0;
493
- return X.current = l, l;
492
+ const B = typeof o == "function" ? o(L) : o, bt = Math.max(y.maxScrollPosition, 0), Ot = y.scrollBarVisible ? rt(B, 0, bt) : 0;
493
+ return U.current = Ot, Ot;
494
494
  }, []), f = S(
495
495
  (o) => {
496
- const g = _t.current, M = X.current;
496
+ const g = Ct.current, y = U.current;
497
497
  if (!g.scrollBarVisible || g.maxScrollPosition <= 0) {
498
- const R = Vt(0, M), k = R - M;
499
- return { nextPosition: R, actualDelta: k, reachedBoundary: !0 };
498
+ const ue = Nt(0, y), l = ue - y;
499
+ return { nextPosition: ue, actualDelta: l, reachedBoundary: !0 };
500
500
  }
501
501
  if (o === 0)
502
- return { nextPosition: M, actualDelta: 0, reachedBoundary: !1 };
503
- const H = Vt((R) => vt(R + o, 0, g.maxScrollPosition), M), St = H - M, l = o < 0 && M + o <= 0, u = o > 0 && M + o >= g.maxScrollPosition, h = o < 0 && (H <= 0 || l && St === 0) || o > 0 && (H >= g.maxScrollPosition || u && St === 0);
504
- return { nextPosition: H, actualDelta: St, reachedBoundary: h };
502
+ return { nextPosition: y, actualDelta: 0, reachedBoundary: !1 };
503
+ const B = Nt((ue) => rt(ue + o, 0, g.maxScrollPosition), y), bt = B - y, Ot = o < 0 && y + o <= 0, Yt = o > 0 && y + o >= g.maxScrollPosition, Me = o < 0 && (B <= 0 || Ot && bt === 0) || o > 0 && (B >= g.maxScrollPosition || Yt && bt === 0);
504
+ return { nextPosition: B, actualDelta: bt, reachedBoundary: Me };
505
505
  },
506
- [Vt]
507
- ), w = S(
506
+ [Nt]
507
+ ), P = S(
508
508
  (o, g) => {
509
509
  o.current += g;
510
- const M = Math.max(_t.current.maxScrollPosition, 0);
511
- M > 0 && (o.current = vt(o.current, -M, M));
510
+ const y = Math.max(Ct.current.maxScrollPosition, 0);
511
+ y > 0 && (o.current = rt(o.current, -y, y));
512
512
  const L = f(o.current);
513
513
  return o.current -= L.actualDelta, L.reachedBoundary && (o.current = 0), L;
514
514
  },
515
515
  [f]
516
- ), at = S(() => {
517
- K.current !== null && (window.cancelAnimationFrame(K.current), K.current = null), T.current = null, V.current = 0, Tt.current = 0;
518
- }, []), gt = S(() => {
519
- N.current = { ...$e }, Pt(!1), lt.current?.reset(), at();
520
- }, [at]), wt = S(
516
+ ), ft = S(() => {
517
+ j.current !== null && (window.cancelAnimationFrame(j.current), j.current = null), T.current = null, q.current = 0, H.current = 0;
518
+ }, []), Tt = S(() => {
519
+ w.current = { ...je }, wt(!1), lt.current?.reset(), ft();
520
+ }, [ft]), Vt = S(
521
521
  (o) => {
522
- const g = N.current, M = _t.current;
522
+ const g = w.current, y = Ct.current;
523
523
  if (!g.active || g.direction === 0) {
524
- at();
524
+ ft();
525
525
  return;
526
526
  }
527
- if (!M.scrollBarVisible || M.maxScrollPosition <= 0) {
528
- at();
527
+ if (!y.scrollBarVisible || y.maxScrollPosition <= 0) {
528
+ ft();
529
529
  return;
530
530
  }
531
- const L = T.current ?? o, H = Math.max((o - L) / 1e3, 0), St = Math.min(H, dr);
532
- if (T.current = o, St <= 0) {
533
- K.current = window.requestAnimationFrame(wt);
531
+ const L = T.current ?? o, B = Math.max((o - L) / 1e3, 0), bt = Math.min(B, hr);
532
+ if (T.current = o, bt <= 0) {
533
+ j.current = window.requestAnimationFrame(Vt);
534
534
  return;
535
535
  }
536
- const l = br({
536
+ const Ot = Sr({
537
537
  distance: g.distance,
538
- maxDistance: M.effectiveTapMaxDistance,
539
- viewportSize: M.viewportSize,
540
- minSpeedMultiplier: M.tapCircleMinSpeedMultiplier,
541
- maxSpeedMultiplier: M.tapCircleMaxSpeedMultiplier,
542
- hasCustomMaxSpeedMultiplier: typeof M.tapScrollCircleOptions?.maxSpeedMultiplier == "number",
543
- curve: M.tapCircleMaxSpeedCurve
538
+ maxDistance: y.effectiveTapMaxDistance,
539
+ viewportSize: y.viewportSize,
540
+ minSpeedMultiplier: y.tapCircleMinSpeedMultiplier,
541
+ maxSpeedMultiplier: y.tapCircleMaxSpeedMultiplier,
542
+ hasCustomMaxSpeedMultiplier: typeof y.tapScrollCircleOptions?.maxSpeedMultiplier == "number",
543
+ curve: y.tapCircleMaxSpeedCurve
544
544
  });
545
- Tt.current !== g.direction && (Tt.current = g.direction, V.current = 0);
546
- const { reachedBoundary: u } = w(V, g.direction * l * St);
547
- if (u) {
548
- at();
545
+ H.current !== g.direction && (H.current = g.direction, q.current = 0);
546
+ const { reachedBoundary: Yt } = P(q, g.direction * Ot * bt);
547
+ if (Yt) {
548
+ ft();
549
549
  return;
550
550
  }
551
- K.current = window.requestAnimationFrame(wt);
551
+ j.current = window.requestAnimationFrame(Vt);
552
552
  },
553
- [w, at]
554
- ), Qt = S(() => {
555
- K.current === null && (T.current = null, V.current = 0, K.current = window.requestAnimationFrame(wt));
556
- }, [wt]);
557
- q(() => {
558
- const o = N.current;
559
- !o.active || o.direction === 0 || Qt();
560
- }, [n, t, Qt]), q(() => () => {
561
- at();
562
- }, [at]);
563
- const Ht = S(
553
+ [P, ft]
554
+ ), ie = S(() => {
555
+ j.current === null && (T.current = null, q.current = 0, j.current = window.requestAnimationFrame(Vt));
556
+ }, [Vt]);
557
+ Y(() => {
558
+ const o = w.current;
559
+ !o.active || o.direction === 0 || ie();
560
+ }, [r, t, ie]), Y(() => () => {
561
+ ft();
562
+ }, [ft]);
563
+ const Jt = S(
564
564
  (o) => {
565
- N.current = o, Pt(o.active), o.active && o.direction !== 0 ? Qt() : at();
565
+ w.current = o, wt(o.active), o.active && o.direction !== 0 ? ie() : ft();
566
566
  },
567
- [Qt, at]
567
+ [ie, ft]
568
568
  );
569
- q(() => {
570
- J || gt();
571
- }, [gt, J]), q(() => {
569
+ Y(() => {
570
+ et || Tt();
571
+ }, [Tt, et]), Y(() => {
572
572
  const o = (g) => {
573
573
  const L = g.detail?.paneId;
574
- L && x && L !== x || gt();
574
+ L && I && L !== I || Tt();
575
575
  };
576
- return window.addEventListener(Ye, o), () => {
577
- window.removeEventListener(Ye, o);
576
+ return window.addEventListener(Xe, o), () => {
577
+ window.removeEventListener(Xe, o);
578
578
  };
579
- }, [x, gt]), q(() => {
580
- if (!J)
579
+ }, [I, Tt]), Y(() => {
580
+ if (!et)
581
581
  return;
582
582
  const o = (g) => {
583
- if (!N.current.active || N.current.pointerId === g.pointerId)
583
+ if (!w.current.active || w.current.pointerId === g.pointerId)
584
584
  return;
585
- const M = g.target;
586
- if (!(M instanceof Node)) {
587
- gt();
585
+ const y = g.target;
586
+ if (!(y instanceof Node)) {
587
+ Tt();
588
588
  return;
589
589
  }
590
- lt.current?.getElement()?.contains(M) || gt();
590
+ lt.current?.getElement()?.contains(y) || Tt();
591
591
  };
592
592
  return document.addEventListener("pointerdown", o, !0), () => {
593
593
  document.removeEventListener("pointerdown", o, !0);
594
594
  };
595
- }, [gt, J]);
596
- const Ut = (o) => {
597
- if (!Nt || Q <= 0 || st <= 0)
595
+ }, [Tt, et]);
596
+ const Qt = (o) => {
597
+ if (!Et || st <= 0 || dt <= 0)
598
598
  return 0;
599
- const g = vt(o, 0, Q);
600
- return vt(g / Q * st, 0, st);
601
- }, te = S((o) => {
602
- const { scrollBarVisible: g, effectiveTrackLength: M, maxScrollPosition: L } = _t.current;
603
- if (C.debug("[ScrollBar] calculateScrollPositionFromThumb", () => ({ thumbPos: o, trackLen: M, maxScroll: L })), M <= 0 || L <= 0)
599
+ const g = rt(o, 0, st);
600
+ return rt(g / st * dt, 0, dt);
601
+ }, Kt = S((o) => {
602
+ const { scrollBarVisible: g, effectiveTrackLength: y, maxScrollPosition: L } = Ct.current;
603
+ if (N.debug("[ScrollBar] calculateScrollPositionFromThumb", () => ({ thumbPos: o, trackLen: y, maxScroll: L })), y <= 0 || L <= 0)
604
604
  return null;
605
- const H = vt(o, 0, M);
606
- return vt(H / M * L, 0, L);
607
- }, []), ce = S(
605
+ const B = rt(o, 0, y);
606
+ return rt(B / y * L, 0, L);
607
+ }, []), se = S(
608
608
  (o) => {
609
- const g = o.getBoundingClientRect(), M = c ? g.width : g.height, L = (h) => {
610
- const R = Number.parseFloat(h);
611
- return Number.isFinite(R) ? R : 0;
612
- }, H = window.getComputedStyle(o), St = L(c ? H.width : H.height), l = St > 0 ? St + L(c ? H.paddingLeft : H.paddingTop) + L(c ? H.paddingRight : H.paddingBottom) + L(c ? H.borderLeftWidth : H.borderTopWidth) + L(c ? H.borderRightWidth : H.borderBottomWidth) : 0, u = l > 0 ? l : c ? o.offsetWidth : o.offsetHeight;
613
- return u <= 0 || M <= 0 ? 1 : M / u;
609
+ const g = o.getBoundingClientRect(), y = c ? g.width : g.height, L = (Me) => {
610
+ const ue = Number.parseFloat(Me);
611
+ return Number.isFinite(ue) ? ue : 0;
612
+ }, B = window.getComputedStyle(o), bt = L(c ? B.width : B.height), Ot = bt > 0 ? bt + L(c ? B.paddingLeft : B.paddingTop) + L(c ? B.paddingRight : B.paddingBottom) + L(c ? B.borderLeftWidth : B.borderTopWidth) + L(c ? B.borderRightWidth : B.borderBottomWidth) : 0, Yt = Ot > 0 ? Ot : c ? o.offsetWidth : o.offsetHeight;
613
+ return Yt <= 0 || y <= 0 ? 1 : y / Yt;
614
614
  },
615
615
  [c]
616
- ), ue = S(
616
+ ), fe = S(
617
617
  (o) => {
618
618
  const g = O.current;
619
619
  if (g.pointerId !== o.pointerId)
620
620
  return;
621
- const M = o.clientX - g.startClientX, L = o.clientY - g.startClientY, H = p(M, L) / (g.scale || 1);
622
- C.debug("[ScrollBar] handleThumbPointerMove", () => ({
623
- delta: H,
621
+ const y = o.clientX - g.startClientX, L = o.clientY - g.startClientY, B = h(y, L) / (g.scale || 1);
622
+ N.debug("[ScrollBar] handleThumbPointerMove", () => ({
623
+ delta: B,
624
624
  startThumbPosition: g.startThumbPosition,
625
625
  clientY: o.clientY,
626
626
  startClientY: g.startClientY,
627
- metrics: _t.current
627
+ metrics: Ct.current
628
628
  }));
629
- const St = te(g.startThumbPosition + H);
630
- St !== null && Vt(St), o.cancelable && o.preventDefault();
629
+ const bt = Kt(g.startThumbPosition + B);
630
+ bt !== null && Nt(bt), o.cancelable && o.preventDefault();
631
631
  },
632
- [p, te, Vt]
633
- ), tt = S(
632
+ [h, Kt, Nt]
633
+ ), Gt = S(
634
634
  (o) => {
635
635
  const g = O.current;
636
636
  if (g.pointerId !== o.pointerId)
637
637
  return;
638
- document.removeEventListener("pointermove", ue), document.removeEventListener("pointerup", tt), document.removeEventListener("pointercancel", tt);
639
- const M = g.captureTarget;
640
- if (M?.hasPointerCapture?.(o.pointerId) && M.releasePointerCapture(o.pointerId), O.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1, captureTarget: null }, ut(!1), D.current) {
641
- const L = D.current.getBoundingClientRect();
642
- o.clientX >= L.left && o.clientX <= L.right && o.clientY >= L.top && o.clientY <= L.bottom || nt(!1);
638
+ document.removeEventListener("pointermove", fe), document.removeEventListener("pointerup", Gt), document.removeEventListener("pointercancel", Gt);
639
+ const y = g.captureTarget;
640
+ if (y?.hasPointerCapture?.(o.pointerId) && y.releasePointerCapture(o.pointerId), O.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1, captureTarget: null }, at(!1), A.current) {
641
+ const L = A.current.getBoundingClientRect();
642
+ o.clientX >= L.left && o.clientX <= L.right && o.clientY >= L.top && o.clientY <= L.bottom || tt(!1);
643
643
  } else
644
- nt(!1);
644
+ tt(!1);
645
645
  },
646
- [ue]
646
+ [fe]
647
647
  );
648
- q(() => () => {
649
- document.removeEventListener("pointermove", ue), document.removeEventListener("pointerup", tt), document.removeEventListener("pointercancel", tt);
650
- }, [ue, tt]);
651
- const ee = I(0), Se = I(0), we = S(
648
+ Y(() => () => {
649
+ document.removeEventListener("pointermove", fe), document.removeEventListener("pointerup", Gt), document.removeEventListener("pointercancel", Gt);
650
+ }, [fe, Gt]);
651
+ const we = x(0), mt = x(0), me = S(
652
652
  (o) => {
653
- const g = Math.max(Math.round(_t.current.viewportSize / ar), or);
654
- Se.current !== o && (Se.current = o, ee.current = 0), w(ee, o * g);
653
+ const g = Math.max(Math.round(Ct.current.viewportSize / dr), ur);
654
+ mt.current !== o && (mt.current = o, we.current = 0), P(we, o * g);
655
655
  },
656
- [w]
657
- ), { handleArrowPointerDown: Wt, handleArrowPointerUp: ge, handleArrowKeyDown: Re } = hr({
658
- canUseArrowButtons: $t,
656
+ [P]
657
+ ), { handleArrowPointerDown: Ce, handleArrowPointerUp: ve, handleArrowKeyDown: Ut } = Ir({
658
+ canUseArrowButtons: ne,
659
659
  enableArrowButtons: a,
660
- resetTapScroll: gt,
661
- scrollByStep: we
662
- }), De = (o) => {
663
- if (!Nt)
660
+ resetTapScroll: Tt,
661
+ scrollByStep: me
662
+ }), Ve = (o) => {
663
+ if (!Et)
664
664
  return;
665
665
  if (!i) {
666
666
  o.preventDefault(), o.stopPropagation();
@@ -668,8 +668,8 @@ const vt = (n, t, e) => Math.max(t, Math.min(e, n)), Ye = "virtualscroll:tap-scr
668
668
  }
669
669
  if (o.pointerType === "mouse" && o.button !== 0 || o.ctrlKey)
670
670
  return;
671
- gt();
672
- const g = o.currentTarget, M = ce(g);
671
+ Tt();
672
+ const g = o.currentTarget, y = se(g);
673
673
  let L = null;
674
674
  if (g.setPointerCapture)
675
675
  try {
@@ -679,14 +679,14 @@ const vt = (n, t, e) => Math.max(t, Math.min(e, n)), Ye = "virtualscroll:tap-scr
679
679
  }
680
680
  O.current = {
681
681
  pointerId: o.pointerId,
682
- startThumbPosition: qt,
682
+ startThumbPosition: _t,
683
683
  startClientX: o.clientX,
684
684
  startClientY: o.clientY,
685
- scale: M,
685
+ scale: y,
686
686
  captureTarget: L
687
- }, document.addEventListener("pointermove", ue), document.addEventListener("pointerup", tt), document.addEventListener("pointercancel", tt), ut(!0), nt(!0), o.preventDefault(), o.stopPropagation();
688
- }, re = (o) => {
689
- if (!Nt)
687
+ }, document.addEventListener("pointermove", fe), document.addEventListener("pointerup", Gt), document.addEventListener("pointercancel", Gt), at(!0), tt(!0), o.preventDefault(), o.stopPropagation();
688
+ }, De = (o) => {
689
+ if (!Et)
690
690
  return;
691
691
  if (!s) {
692
692
  o.preventDefault(), o.stopPropagation();
@@ -694,166 +694,166 @@ const vt = (n, t, e) => Math.max(t, Math.min(e, n)), Ye = "virtualscroll:tap-scr
694
694
  }
695
695
  if (o.pointerType === "mouse" && o.button !== 0 || o.ctrlKey)
696
696
  return;
697
- const g = o.currentTarget, M = g.getBoundingClientRect(), L = ft(o), H = ce(g), St = (L - (c ? M.left : M.top)) / H;
698
- gt();
699
- const l = St - ht / 2, u = Ut(l);
700
- if (Vt(u), g.setPointerCapture)
697
+ const g = o.currentTarget, y = g.getBoundingClientRect(), L = k(o), B = se(g), bt = (L - (c ? y.left : y.top)) / B;
698
+ Tt();
699
+ const Ot = bt - At / 2, Yt = Qt(Ot);
700
+ if (Nt(Yt), g.setPointerCapture)
701
701
  try {
702
702
  g.setPointerCapture(o.pointerId);
703
703
  } catch {
704
704
  }
705
- P.current = {
705
+ M.current = {
706
706
  pointerId: o.pointerId,
707
- startThumbPosition: l,
707
+ startThumbPosition: Ot,
708
708
  startClientX: o.clientX,
709
709
  startClientY: o.clientY,
710
- scale: H
710
+ scale: B
711
711
  }, o.preventDefault(), o.stopPropagation();
712
- }, jt = () => {
713
- P.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1 };
714
- }, ne = (o) => {
715
- const g = P.current;
712
+ }, be = () => {
713
+ M.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1 };
714
+ }, Ae = (o) => {
715
+ const g = M.current;
716
716
  if (g.pointerId !== o.pointerId)
717
717
  return;
718
718
  if (o.pointerType === "mouse" && o.buttons === 0) {
719
- jt();
719
+ be();
720
720
  return;
721
721
  }
722
- const M = o.clientX - g.startClientX, L = o.clientY - g.startClientY, H = p(M, L) / (g.scale || 1), St = Ut(g.startThumbPosition + H);
723
- Vt(St), o.cancelable && o.preventDefault();
724
- }, ie = (o) => {
725
- if (P.current.pointerId !== o.pointerId)
722
+ const y = o.clientX - g.startClientX, L = o.clientY - g.startClientY, B = h(y, L) / (g.scale || 1), bt = Qt(g.startThumbPosition + B);
723
+ Nt(bt), o.cancelable && o.preventDefault();
724
+ }, ke = (o) => {
725
+ if (M.current.pointerId !== o.pointerId)
726
726
  return;
727
727
  const g = o.currentTarget;
728
- g.hasPointerCapture?.(o.pointerId) && g.releasePointerCapture(o.pointerId), jt(), o.preventDefault(), o.stopPropagation();
729
- }, de = (o) => {
730
- if (P.current.pointerId !== o.pointerId)
728
+ g.hasPointerCapture?.(o.pointerId) && g.releasePointerCapture(o.pointerId), be(), o.preventDefault(), o.stopPropagation();
729
+ }, oe = (o) => {
730
+ if (M.current.pointerId !== o.pointerId)
731
731
  return;
732
732
  const g = o.currentTarget;
733
- g.hasPointerCapture?.(o.pointerId) && g.releasePointerCapture(o.pointerId), jt();
734
- }, be = (o) => {
735
- o.target === o.currentTarget && P.current.pointerId === o.pointerId && jt();
736
- }, se = Lt(() => vt((pt ? 1 : 0.8) * A, 0, 1), [pt, A]), Ce = Lt(() => {
737
- const g = `calc(50% - ${F / 2}px + ${W}px)`;
733
+ g.hasPointerCapture?.(o.pointerId) && g.releasePointerCapture(o.pointerId), be();
734
+ }, pe = (o) => {
735
+ o.target === o.currentTarget && M.current.pointerId === o.pointerId && be();
736
+ }, ae = Ft(() => rt((xt ? 1 : 0.8) * de, 0, 1), [xt, de]), le = Ft(() => {
737
+ const g = `calc(50% - ${nt / 2}px + ${J}px)`;
738
738
  return {
739
- left: Ct,
739
+ left: G,
740
740
  top: g
741
741
  };
742
- }, [Ct, W, F]), ve = (o, g, M, L) => /* @__PURE__ */ ot(
742
+ }, [G, J, nt]), ce = (o, g, y, L) => /* @__PURE__ */ ot(
743
743
  "button",
744
744
  {
745
745
  type: "button",
746
746
  tabIndex: 0,
747
747
  className: "aqvs-scrollbar-arrow-button",
748
748
  style: {
749
- [Et]: d,
750
- [Xt]: d
749
+ [zt]: d,
750
+ [Zt]: d
751
751
  },
752
752
  "aria-label": g,
753
- onPointerDown: Wt(o),
754
- onPointerUp: ge,
755
- onPointerLeave: ge,
756
- onPointerCancel: ge,
757
- onKeyDown: Re(o),
753
+ onPointerDown: Ce(o),
754
+ onPointerUp: ve,
755
+ onPointerLeave: ve,
756
+ onPointerCancel: ve,
757
+ onKeyDown: Ut(o),
758
758
  "aria-disabled": !a,
759
- disabled: !$t,
760
- children: /* @__PURE__ */ ot("span", { "aria-hidden": "true", children: M })
759
+ disabled: !ne,
760
+ children: /* @__PURE__ */ ot("span", { "aria-hidden": "true", children: y })
761
761
  },
762
762
  L
763
- ), Ee = m && Nt ? {
763
+ ), xe = p && Et ? {
764
764
  orientation: ct,
765
765
  scrollPosition: e,
766
- maxScrollPosition: st,
767
- contentSize: n,
766
+ maxScrollPosition: dt,
767
+ contentSize: r,
768
768
  viewportSize: t,
769
- thumbSize: ht,
770
- thumbPosition: qt,
771
- thumbCenter: le,
772
- trackSize: Mt,
773
- isDragging: Z,
774
- isTapScrollActive: pt,
775
- visibleStartIndex: _,
776
- visibleEndIndex: B
769
+ thumbSize: At,
770
+ thumbPosition: _t,
771
+ thumbCenter: Xt,
772
+ trackSize: Pt,
773
+ isDragging: W,
774
+ isTapScrollActive: xt,
775
+ visibleStartIndex: V,
776
+ visibleEndIndex: z
777
777
  } : null;
778
- return /* @__PURE__ */ he(
778
+ return /* @__PURE__ */ Se(
779
779
  "div",
780
780
  {
781
- className: pe("aqvs-scrollbar", et, !Nt && "pointer-events-none opacity-0", b),
781
+ className: Te("aqvs-scrollbar", vt, !Et && "pointer-events-none opacity-0", b),
782
782
  style: {
783
- [Et]: t,
784
- [Xt]: d
783
+ [zt]: t,
784
+ [Zt]: d
785
785
  },
786
786
  role: "scrollbar",
787
787
  tabIndex: -1,
788
- "aria-controls": x,
788
+ "aria-controls": I,
789
789
  "aria-valuenow": e,
790
790
  "aria-valuemin": 0,
791
- "aria-valuemax": st,
791
+ "aria-valuemax": dt,
792
792
  "aria-orientation": c ? "horizontal" : "vertical",
793
793
  children: [
794
- !c && Nt && J && /* @__PURE__ */ ot(
795
- Ze,
794
+ !c && Et && et && /* @__PURE__ */ ot(
795
+ er,
796
796
  {
797
797
  ref: lt,
798
- className: pe("aqvs-scrollbar-tap-circle-wrapper", At),
799
- size: F,
800
- maxVisualDistance: Ot,
801
- style: Ce,
802
- opacity: se,
803
- renderVisual: j,
804
- onDragChange: Ht
798
+ className: Te("aqvs-scrollbar-tap-circle-wrapper", Rt),
799
+ size: nt,
800
+ maxVisualDistance: It,
801
+ style: le,
802
+ opacity: ae,
803
+ renderVisual: it,
804
+ onDragChange: Jt
805
805
  },
806
806
  "tap-circle"
807
807
  ),
808
- ve(-1, mt[0], z[0], "arrow-start"),
809
- /* @__PURE__ */ he(
808
+ ce(-1, gt[0], X[0], "arrow-start"),
809
+ /* @__PURE__ */ Se(
810
810
  "div",
811
811
  {
812
812
  className: "aqvs-scrollbar-track",
813
813
  style: {
814
814
  borderRadius: d / 2
815
815
  },
816
- onPointerDown: re,
817
- onPointerMove: ne,
818
- onPointerUp: ie,
819
- onPointerCancel: de,
820
- onLostPointerCapture: be,
816
+ onPointerDown: De,
817
+ onPointerMove: Ae,
818
+ onPointerUp: ke,
819
+ onPointerCancel: oe,
820
+ onLostPointerCapture: pe,
821
821
  "aria-disabled": !s,
822
822
  children: [
823
- Ee && /* @__PURE__ */ ot("div", { className: "aqvs-scrollbar-overlay", "aria-hidden": !0, children: m?.(Ee) }, "overlay"),
823
+ xe && /* @__PURE__ */ ot("div", { className: "aqvs-scrollbar-overlay", "aria-hidden": !0, children: p?.(xe) }, "overlay"),
824
824
  /* @__PURE__ */ ot(
825
825
  "div",
826
826
  {
827
- className: pe("aqvs-scrollbar-thumb-wrapper", !(Nt || Z) && "pointer-events-none opacity-0"),
827
+ className: Te("aqvs-scrollbar-thumb-wrapper", !(Et || W) && "pointer-events-none opacity-0"),
828
828
  style: {
829
- [Et]: ht,
830
- [dt]: qt,
829
+ [zt]: At,
830
+ [$t]: _t,
831
831
  ...c ? { top: 0, bottom: 0 } : { left: 0, right: 0 }
832
832
  },
833
- onPointerDown: De,
833
+ onPointerDown: Ve,
834
834
  role: "slider",
835
835
  "aria-orientation": c ? "horizontal" : "vertical",
836
836
  "aria-valuenow": e,
837
837
  "aria-valuemin": 0,
838
- "aria-valuemax": st,
838
+ "aria-valuemax": dt,
839
839
  "aria-disabled": !i,
840
840
  tabIndex: -1,
841
841
  children: /* @__PURE__ */ ot(
842
842
  "div",
843
843
  {
844
- ref: D,
845
- className: pe("aqvs-scrollbar-thumb", c ? "aqvs-scrollbar-thumb-horizontal" : "aqvs-scrollbar-thumb-vertical"),
844
+ ref: A,
845
+ className: Te("aqvs-scrollbar-thumb", c ? "aqvs-scrollbar-thumb-horizontal" : "aqvs-scrollbar-thumb-vertical"),
846
846
  "data-testid": "aqvs-scrollbar-thumb",
847
- "data-thumb-state": Gt,
847
+ "data-thumb-state": jt,
848
848
  style: {
849
849
  borderRadius: d - 1,
850
850
  cursor: i ? "pointer" : "default"
851
851
  },
852
852
  onMouseEnter: () => {
853
- i && nt(!0);
853
+ i && tt(!0);
854
854
  },
855
855
  onMouseLeave: () => {
856
- i && nt(!1);
856
+ i && tt(!1);
857
857
  }
858
858
  },
859
859
  "thumb"
@@ -865,202 +865,202 @@ const vt = (n, t, e) => Math.max(t, Math.min(e, n)), Ye = "virtualscroll:tap-scr
865
865
  },
866
866
  "track"
867
867
  ),
868
- ve(1, mt[1], z[1], "arrow-end")
868
+ ce(1, gt[1], X[1], "arrow-end")
869
869
  ]
870
870
  }
871
871
  );
872
- }, Tr = ["mouse", "pen", "touch"], ke = (n, t) => !(n === "mouse" || n === "pen" || n === "touch") || t.includes(n), Sr = (n) => n === "mouse" || n === "pen", Me = {
872
+ }, Pr = ["mouse", "pen", "touch"], Be = (r, t) => !(r === "mouse" || r === "pen" || r === "touch") || t.includes(r), yr = (r) => r === "mouse" || r === "pen", Ee = {
873
873
  maxVelocity: 6,
874
874
  minVelocity: 0.02,
875
875
  deceleration: 25e-4,
876
876
  velocitySampleWindow: 90,
877
877
  startVelocityThreshold: 0.04
878
- }, Ne = (n, t, e) => {
879
- for (const [r, i, s] of t)
880
- e === "add" ? n.addEventListener(r, i, s) : n.removeEventListener(r, i, s);
881
- }, vr = Be(
878
+ }, Le = (r, t, e) => {
879
+ for (const [n, i, s] of t)
880
+ e === "add" ? r.addEventListener(n, i, s) : r.removeEventListener(n, i, s);
881
+ }, wr = $e(
882
882
  ({
883
- children: n,
883
+ children: r,
884
884
  contentSize: t,
885
885
  viewportSize: e,
886
- scrollBarWidth: r = 12,
886
+ scrollBarWidth: n = 12,
887
887
  enableThumbDrag: i = !0,
888
888
  enableTrackClick: s = !0,
889
889
  enableArrowButtons: a = !0,
890
890
  enablePointerDrag: c = !0,
891
- pointerDragInputs: d = Tr,
891
+ pointerDragInputs: d = Pr,
892
892
  onScroll: b,
893
- className: x,
893
+ className: I,
894
894
  testId: v,
895
- style: E,
896
- background: m,
897
- tapScrollCircleOptions: _,
898
- inertiaOptions: B,
899
- itemCount: Z,
900
- renderThumbOverlay: ut,
901
- wheelSpeedMultiplier: rt = 1,
902
- onWheelHorizontal: nt,
903
- contentInsets: pt,
904
- visibleStartIndex: Pt,
905
- visibleEndIndex: D,
895
+ style: C,
896
+ background: p,
897
+ tapScrollCircleOptions: V,
898
+ inertiaOptions: z,
899
+ itemCount: W,
900
+ renderThumbOverlay: at,
901
+ wheelSpeedMultiplier: Q = 1,
902
+ onWheelHorizontal: tt,
903
+ contentInsets: xt,
904
+ visibleStartIndex: wt,
905
+ visibleEndIndex: A,
906
906
  renderOverlay: O,
907
- initialScrollPosition: P = 0,
908
- contentProps: X
909
- }, $) => {
910
- const N = I(Number.isFinite(P) ? Math.max(0, P) : 0), lt = I(null), K = I(null), T = I(nt);
911
- q(() => {
912
- T.current = nt;
913
- }, [nt]);
914
- const V = I({
907
+ initialScrollPosition: M = 0,
908
+ contentProps: U
909
+ }, Z) => {
910
+ const w = x(Number.isFinite(M) ? Math.max(0, M) : 0), lt = x(null), j = x(null), T = x(tt);
911
+ Y(() => {
912
+ T.current = tt;
913
+ }, [tt]);
914
+ const q = x({
915
915
  frame: null,
916
916
  velocity: 0,
917
917
  lastTimestamp: null,
918
918
  generation: 0
919
- }), Tt = Lt(
919
+ }), H = Ft(
920
920
  () => ({
921
- maxVelocity: B?.maxVelocity ?? Me.maxVelocity,
922
- minVelocity: B?.minVelocity ?? Me.minVelocity,
923
- deceleration: B?.deceleration ?? Me.deceleration,
924
- velocitySampleWindow: B?.velocitySampleWindow ?? Me.velocitySampleWindow,
925
- startVelocityThreshold: B?.startVelocityThreshold ?? Me.startVelocityThreshold
921
+ maxVelocity: z?.maxVelocity ?? Ee.maxVelocity,
922
+ minVelocity: z?.minVelocity ?? Ee.minVelocity,
923
+ deceleration: z?.deceleration ?? Ee.deceleration,
924
+ velocitySampleWindow: z?.velocitySampleWindow ?? Ee.velocitySampleWindow,
925
+ startVelocityThreshold: z?.startVelocityThreshold ?? Ee.startVelocityThreshold
926
926
  }),
927
- [B]
928
- ), Yt = Lt(() => ({
929
- top: Math.max(0, pt?.top ?? 0),
930
- bottom: Math.max(0, pt?.bottom ?? 0)
931
- }), [pt]);
932
- C.debug("[ScrollPane] ScrollPane rendered", () => ({
927
+ [z]
928
+ ), Ht = Ft(() => ({
929
+ top: Math.max(0, xt?.top ?? 0),
930
+ bottom: Math.max(0, xt?.bottom ?? 0)
931
+ }), [xt]);
932
+ N.debug("[ScrollPane] ScrollPane rendered", () => ({
933
933
  contentSize: t,
934
934
  viewportSize: e,
935
- scrollBarWidth: r,
936
- className: x,
937
- style: E,
938
- tapScrollCircleOptions: _,
939
- inertiaOptions: B,
935
+ scrollBarWidth: n,
936
+ className: I,
937
+ style: C,
938
+ tapScrollCircleOptions: V,
939
+ inertiaOptions: z,
940
940
  enablePointerDrag: c,
941
- contentInsets: Yt
941
+ contentInsets: Ht
942
942
  }));
943
- const yt = I({ contentSize: t, viewportSize: e });
944
- yt.current = { contentSize: t, viewportSize: e };
945
- const J = Lt(() => t > e, [t, e]), F = S(
946
- (p) => {
947
- const { contentSize: ft, viewportSize: mt } = yt.current, z = ft > mt, et = N.current;
948
- if (C.debug("[ScrollPane] scrollTo called", () => ({ newPosition: p, contentSize: ft, viewportSize: mt, currentIsScrollable: z, prevPosition: et })), !z)
949
- return N.current !== 0 && (N.current = 0, b?.(0, et)), N.current;
950
- const ct = typeof p == "function" ? p(N.current) : p;
943
+ const Dt = x({ contentSize: t, viewportSize: e });
944
+ Dt.current = { contentSize: t, viewportSize: e };
945
+ const et = Ft(() => t > e, [t, e]), nt = S(
946
+ (h) => {
947
+ const { contentSize: k, viewportSize: gt } = Dt.current, X = k > gt, vt = w.current;
948
+ if (N.debug("[ScrollPane] scrollTo called", () => ({ newPosition: h, contentSize: k, viewportSize: gt, currentIsScrollable: X, prevPosition: vt })), !X)
949
+ return w.current !== 0 && (w.current = 0, b?.(0, vt)), w.current;
950
+ const ct = typeof h == "function" ? h(w.current) : h;
951
951
  if (!Number.isFinite(ct))
952
- return C.warn("[ScrollPane] scrollTo received a non-finite position; keeping the current position", { nextPosition: ct }), N.current;
953
- const Ot = Math.max(ft - mt, 0), kt = vt(ct, 0, Ot);
954
- return N.current !== kt && (N.current = kt, b?.(kt, et)), N.current;
952
+ return N.warn("[ScrollPane] scrollTo received a non-finite position; keeping the current position", { nextPosition: ct }), w.current;
953
+ const It = Math.max(k - gt, 0), Mt = rt(ct, 0, It);
954
+ return w.current !== Mt && (w.current = Mt, b?.(Mt, vt)), w.current;
955
955
  },
956
956
  [b]
957
- ), Ct = I(F);
958
- q(() => {
959
- Ct.current = F;
960
- }, [F]);
961
- const W = S(() => {
962
- const p = V.current;
963
- p.generation += 1, p.frame !== null && cancelAnimationFrame(p.frame), p.frame = null, p.velocity = 0, p.lastTimestamp = null;
964
- }, []), At = I(W);
965
- q(() => {
966
- At.current = W;
967
- }, [W]), q(() => () => {
968
- At.current();
957
+ ), G = x(nt);
958
+ Y(() => {
959
+ G.current = nt;
960
+ }, [nt]);
961
+ const J = S(() => {
962
+ const h = q.current;
963
+ h.generation += 1, h.frame !== null && cancelAnimationFrame(h.frame), h.frame = null, h.velocity = 0, h.lastTimestamp = null;
964
+ }, []), Rt = x(J);
965
+ Y(() => {
966
+ Rt.current = J;
967
+ }, [J]), Y(() => () => {
968
+ Rt.current();
969
969
  }, []);
970
- const y = S(
971
- (p) => {
972
- if (!J)
970
+ const Lt = S(
971
+ (h) => {
972
+ if (!et)
973
973
  return;
974
- const { maxVelocity: ft, minVelocity: mt, deceleration: z, startVelocityThreshold: et } = Tt, ct = vt(p, -ft, ft);
975
- if (Math.abs(ct) < et)
974
+ const { maxVelocity: k, minVelocity: gt, deceleration: X, startVelocityThreshold: vt } = H, ct = rt(h, -k, k);
975
+ if (Math.abs(ct) < vt)
976
976
  return;
977
- W(), V.current.velocity = ct, V.current.lastTimestamp = null;
978
- const Ot = V.current.generation, kt = (Mt) => {
979
- const it = V.current;
980
- if (it.generation !== Ot)
977
+ J(), q.current.velocity = ct, q.current.lastTimestamp = null;
978
+ const It = q.current.generation, Mt = (Pt) => {
979
+ const ut = q.current;
980
+ if (ut.generation !== It)
981
981
  return;
982
- if (it.lastTimestamp === null) {
983
- it.lastTimestamp = Mt, it.frame = requestAnimationFrame(kt);
982
+ if (ut.lastTimestamp === null) {
983
+ ut.lastTimestamp = Pt, ut.frame = requestAnimationFrame(Mt);
984
984
  return;
985
985
  }
986
- const ht = Mt - it.lastTimestamp;
987
- if (it.lastTimestamp = Mt, ht <= 0) {
988
- it.frame = requestAnimationFrame(kt);
986
+ const At = Pt - ut.lastTimestamp;
987
+ if (ut.lastTimestamp = Pt, At <= 0) {
988
+ ut.frame = requestAnimationFrame(Mt);
989
989
  return;
990
990
  }
991
- const st = it.velocity;
992
- let Q = st;
993
- const qt = z * ht;
994
- st > 0 ? Q = Math.max(0, st - qt) : st < 0 && (Q = Math.min(0, st + qt));
995
- const Nt = (st + Q) / 2 * ht, $t = N.current;
996
- if (Nt !== 0 && Ct.current((gt) => gt + Nt), V.current.generation !== Ot)
991
+ const dt = ut.velocity;
992
+ let st = dt;
993
+ const _t = X * At;
994
+ dt > 0 ? st = Math.max(0, dt - _t) : dt < 0 && (st = Math.min(0, dt + _t));
995
+ const Et = (dt + st) / 2 * At, ne = w.current;
996
+ if (Et !== 0 && G.current((Tt) => Tt + Et), q.current.generation !== It)
997
997
  return;
998
- const Gt = N.current, { contentSize: Vt, viewportSize: f } = yt.current, w = Math.max(Vt - f, 0);
999
- it.velocity = Q;
1000
- const at = Gt === $t || Gt <= 0 && Q <= 0 || Gt >= w && Q >= 0;
1001
- if (Math.abs(Q) < mt || at) {
1002
- W();
998
+ const jt = w.current, { contentSize: Nt, viewportSize: f } = Dt.current, P = Math.max(Nt - f, 0);
999
+ ut.velocity = st;
1000
+ const ft = jt === ne || jt <= 0 && st <= 0 || jt >= P && st >= 0;
1001
+ if (Math.abs(st) < gt || ft) {
1002
+ J();
1003
1003
  return;
1004
1004
  }
1005
- it.frame = requestAnimationFrame(kt);
1005
+ ut.frame = requestAnimationFrame(Mt);
1006
1006
  };
1007
- V.current.frame = requestAnimationFrame(kt);
1007
+ q.current.frame = requestAnimationFrame(Mt);
1008
1008
  },
1009
- [J, Tt, W]
1010
- ), Kt = I(y);
1011
- q(() => {
1012
- Kt.current = y;
1013
- }, [y]), Te(() => {
1014
- yt.current = { contentSize: t, viewportSize: e };
1015
- }, [t, e]), Te(() => {
1016
- const p = K.current;
1017
- if (!p) return;
1018
- const ft = () => {
1019
- p.scrollTop !== 0 && (C.debug("[ScrollPane] Native scroll detected, resetting to 0", () => ({ scrollTop: p.scrollTop })), p.scrollTop = 0), p.scrollLeft !== 0 && (p.scrollLeft = 0);
1009
+ [et, H, J]
1010
+ ), Wt = x(Lt);
1011
+ Y(() => {
1012
+ Wt.current = Lt;
1013
+ }, [Lt]), ye(() => {
1014
+ Dt.current = { contentSize: t, viewportSize: e };
1015
+ }, [t, e]), ye(() => {
1016
+ const h = j.current;
1017
+ if (!h) return;
1018
+ const k = () => {
1019
+ h.scrollTop !== 0 && (N.debug("[ScrollPane] Native scroll detected, resetting to 0", () => ({ scrollTop: h.scrollTop })), h.scrollTop = 0), h.scrollLeft !== 0 && (h.scrollLeft = 0);
1020
1020
  };
1021
- return p.addEventListener("scroll", ft), () => p.removeEventListener("scroll", ft);
1022
- }, []), Te(() => {
1023
- if (J) {
1024
- C.debug("[ScrollPane] Adjusting scroll position due to content or viewport size change", () => ({ contentSize: t, viewportSize: e, scrollPosition: N.current }));
1025
- const p = vt(t - e, 0, t);
1026
- N.current > p && F(p);
1021
+ return h.addEventListener("scroll", k), () => h.removeEventListener("scroll", k);
1022
+ }, []), ye(() => {
1023
+ if (et) {
1024
+ N.debug("[ScrollPane] Adjusting scroll position due to content or viewport size change", () => ({ contentSize: t, viewportSize: e, scrollPosition: w.current }));
1025
+ const h = rt(t - e, 0, t);
1026
+ w.current > h && nt(h);
1027
1027
  } else
1028
- F(0);
1029
- }, [J, F, t, e]), q(() => {
1030
- const p = (z) => {
1031
- if (z.ctrlKey)
1028
+ nt(0);
1029
+ }, [et, nt, t, e]), Y(() => {
1030
+ const h = (X) => {
1031
+ if (X.ctrlKey)
1032
1032
  return;
1033
- const et = z.shiftKey && z.deltaX === 0, ct = et ? z.deltaY : z.deltaX, Ot = et ? 0 : z.deltaY;
1034
- if (ct !== 0 && Math.abs(ct) >= Math.abs(Ot)) {
1033
+ const vt = X.shiftKey && X.deltaX === 0, ct = vt ? X.deltaY : X.deltaX, It = vt ? 0 : X.deltaY;
1034
+ if (ct !== 0 && Math.abs(ct) >= Math.abs(It)) {
1035
1035
  if (T.current) {
1036
- z.preventDefault(), W();
1037
- let it = ct;
1038
- z.deltaMode === 1 ? it *= 16 : z.deltaMode === 2 && (it *= e), T.current(it);
1036
+ X.preventDefault(), J();
1037
+ let ut = ct;
1038
+ X.deltaMode === 1 ? ut *= 16 : X.deltaMode === 2 && (ut *= e), T.current(ut);
1039
1039
  }
1040
1040
  return;
1041
1041
  }
1042
- if (!J || z.deltaY === 0)
1042
+ if (!et || X.deltaY === 0)
1043
1043
  return;
1044
- z.preventDefault(), W();
1045
- let Mt = z.deltaY;
1046
- z.deltaMode === 1 ? Mt *= 16 : z.deltaMode === 2 && (Mt *= e), rt !== 1 && (Mt *= rt), C.debug("[ScrollPane] wheel event", () => ({ deltaY: Mt, scrollPosition: N.current, wheelSpeedMultiplier: rt, deltaMode: z.deltaMode, scrollTop: K.current?.scrollTop })), F((it) => it + Mt);
1047
- }, ft = () => {
1048
- W();
1049
- }, mt = lt.current;
1050
- return mt && (mt.addEventListener("wheel", p, { passive: !1 }), mt.addEventListener("pointerdown", ft, { capture: !0, passive: !0 })), () => {
1051
- mt && (mt.removeEventListener("wheel", p), mt.removeEventListener("pointerdown", ft, { capture: !0 }));
1044
+ X.preventDefault(), J();
1045
+ let Pt = X.deltaY;
1046
+ X.deltaMode === 1 ? Pt *= 16 : X.deltaMode === 2 && (Pt *= e), Q !== 1 && (Pt *= Q), N.debug("[ScrollPane] wheel event", () => ({ deltaY: Pt, scrollPosition: w.current, wheelSpeedMultiplier: Q, deltaMode: X.deltaMode, scrollTop: j.current?.scrollTop })), nt((ut) => ut + Pt);
1047
+ }, k = () => {
1048
+ J();
1049
+ }, gt = lt.current;
1050
+ return gt && (gt.addEventListener("wheel", h, { passive: !1 }), gt.addEventListener("pointerdown", k, { capture: !0, passive: !0 })), () => {
1051
+ gt && (gt.removeEventListener("wheel", h), gt.removeEventListener("pointerdown", k, { capture: !0 }));
1052
1052
  };
1053
- }, [J, F, W, e, rt]), qe(
1054
- $,
1053
+ }, [et, nt, J, e, Q]), Ue(
1054
+ Z,
1055
1055
  () => ({
1056
- scrollTo: (p) => (W(), F(p)),
1057
- getScrollPosition: () => N.current,
1056
+ scrollTo: (h) => (J(), nt(h)),
1057
+ getScrollPosition: () => w.current,
1058
1058
  getContentSize: () => t,
1059
1059
  getViewportSize: () => e
1060
1060
  }),
1061
- [F, t, e, W]
1061
+ [nt, t, e, J]
1062
1062
  );
1063
- const ae = er(), A = X?.id ?? ae, j = I({
1063
+ const R = sr(), de = U?.id ?? R, it = x({
1064
1064
  pointerType: "",
1065
1065
  pointerId: null,
1066
1066
  startClientY: 0,
@@ -1069,147 +1069,147 @@ const vt = (n, t, e) => Math.max(t, Math.min(e, n)), Ye = "virtualscroll:tap-scr
1069
1069
  shouldCancelNextClick: !1,
1070
1070
  clickResetTimer: null,
1071
1071
  velocitySamples: []
1072
- }), Bt = I(c), _t = I(d);
1073
- q(() => {
1074
- Bt.current = c;
1075
- }, [c]), q(() => {
1076
- _t.current = d;
1072
+ }), E = x(c), Ct = x(d);
1073
+ Y(() => {
1074
+ E.current = c;
1075
+ }, [c]), Y(() => {
1076
+ Ct.current = d;
1077
1077
  }, [d]);
1078
- const Et = I(J);
1079
- q(() => {
1080
- Et.current = J;
1081
- }, [J]);
1082
- const Xt = I(Tt);
1083
- q(() => {
1084
- Xt.current = Tt;
1085
- }, [Tt]), q(() => {
1086
- const p = j.current;
1087
- if (c && J && (p.pointerId === null || ke(p.pointerType, d)) || p.pointerId === null)
1078
+ const zt = x(et);
1079
+ Y(() => {
1080
+ zt.current = et;
1081
+ }, [et]);
1082
+ const Zt = x(H);
1083
+ Y(() => {
1084
+ Zt.current = H;
1085
+ }, [H]), Y(() => {
1086
+ const h = it.current;
1087
+ if (c && et && (h.pointerId === null || Be(h.pointerType, d)) || h.pointerId === null)
1088
1088
  return;
1089
- const ft = K.current;
1090
- p.clickResetTimer !== null && (window.clearTimeout(p.clickResetTimer), p.clickResetTimer = null);
1091
- const mt = p.isDragging && p.shouldCancelNextClick, z = p.pointerId;
1092
- p.pointerId = null, p.pointerType = "", p.startClientY = 0, p.startScroll = 0, p.isDragging = !1, p.shouldCancelNextClick = mt, p.velocitySamples = [], ft?.hasPointerCapture(z) && ft.releasePointerCapture(z);
1093
- }, [c, d, J]), q(() => {
1094
- const p = K.current;
1095
- if (!p)
1089
+ const k = j.current;
1090
+ h.clickResetTimer !== null && (window.clearTimeout(h.clickResetTimer), h.clickResetTimer = null);
1091
+ const gt = h.isDragging && h.shouldCancelNextClick, X = h.pointerId;
1092
+ h.pointerId = null, h.pointerType = "", h.startClientY = 0, h.startScroll = 0, h.isDragging = !1, h.shouldCancelNextClick = gt, h.velocitySamples = [], k?.hasPointerCapture(X) && k.releasePointerCapture(X);
1093
+ }, [c, d, et]), Y(() => {
1094
+ const h = j.current;
1095
+ if (!h)
1096
1096
  return;
1097
- const ft = 6, mt = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(), z = () => {
1098
- const f = j.current;
1097
+ const k = 6, gt = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(), X = () => {
1098
+ const f = it.current;
1099
1099
  f.pointerId = null, f.pointerType = "", f.startClientY = 0, f.startScroll = 0, f.isDragging = !1, f.velocitySamples = [];
1100
- }, et = () => {
1101
- const f = j.current;
1100
+ }, vt = () => {
1101
+ const f = it.current;
1102
1102
  f.clickResetTimer !== null && (window.clearTimeout(f.clickResetTimer), f.clickResetTimer = null);
1103
1103
  }, ct = (f) => {
1104
- const w = j.current, at = mt();
1105
- w.velocitySamples.push({ clientY: f, time: at });
1106
- const gt = Xt.current.velocitySampleWindow;
1107
- w.velocitySamples = w.velocitySamples.filter((wt) => at - wt.time <= gt);
1108
- }, Ot = (f) => f instanceof HTMLElement && f.closest("[data-scrollpane-ignore-drag='true']") !== null, kt = (f) => {
1109
- const w = j.current;
1110
- w.shouldCancelNextClick && (f.preventDefault(), f.stopPropagation(), w.shouldCancelNextClick = !1);
1111
- }, Mt = (f) => {
1112
- const w = j.current;
1113
- if (!w.isDragging) {
1114
- if (w.isDragging = !0, w.shouldCancelNextClick = !0, !p.hasPointerCapture(f.pointerId))
1104
+ const P = it.current, ft = gt();
1105
+ P.velocitySamples.push({ clientY: f, time: ft });
1106
+ const Tt = Zt.current.velocitySampleWindow;
1107
+ P.velocitySamples = P.velocitySamples.filter((Vt) => ft - Vt.time <= Tt);
1108
+ }, It = (f) => f instanceof HTMLElement && f.closest("[data-scrollpane-ignore-drag='true']") !== null, Mt = (f) => {
1109
+ const P = it.current;
1110
+ P.shouldCancelNextClick && (f.preventDefault(), f.stopPropagation(), P.shouldCancelNextClick = !1);
1111
+ }, Pt = (f) => {
1112
+ const P = it.current;
1113
+ if (!P.isDragging) {
1114
+ if (P.isDragging = !0, P.shouldCancelNextClick = !0, !h.hasPointerCapture(f.pointerId))
1115
1115
  try {
1116
- p.setPointerCapture(f.pointerId);
1116
+ h.setPointerCapture(f.pointerId);
1117
1117
  } catch {
1118
1118
  }
1119
1119
  ct(f.clientY);
1120
1120
  }
1121
- }, it = (f) => f.isTrusted || f.target === p, ht = (f) => {
1122
- const w = j.current;
1123
- p.hasPointerCapture(f) && p.releasePointerCapture(f), w.shouldCancelNextClick = !1, et(), z();
1124
- }, st = (f) => {
1125
- const w = j.current;
1126
- if (w.pointerId !== f.pointerId)
1121
+ }, ut = (f) => f.isTrusted || f.target === h, At = (f) => {
1122
+ const P = it.current;
1123
+ h.hasPointerCapture(f) && h.releasePointerCapture(f), P.shouldCancelNextClick = !1, vt(), X();
1124
+ }, dt = (f) => {
1125
+ const P = it.current;
1126
+ if (P.pointerId !== f.pointerId)
1127
1127
  return;
1128
- if (f.buttons === 0 && Sr(f.pointerType)) {
1129
- ht(f.pointerId);
1128
+ if (f.buttons === 0 && yr(f.pointerType)) {
1129
+ At(f.pointerId);
1130
1130
  return;
1131
1131
  }
1132
- if (!(Bt.current && Et.current) || !ke(f.pointerType, _t.current) || !w.isDragging && (Math.abs(f.clientY - w.startClientY) < ft || (Mt(f), !w.isDragging)))
1132
+ if (!(E.current && zt.current) || !Be(f.pointerType, Ct.current) || !P.isDragging && (Math.abs(f.clientY - P.startClientY) < k || (Pt(f), !P.isDragging)))
1133
1133
  return;
1134
1134
  ct(f.clientY);
1135
- const at = f.clientY - w.startClientY, gt = w.startScroll - at;
1136
- Ct.current(gt), f.cancelable && f.preventDefault();
1137
- }, Q = () => {
1138
- const f = j.current;
1139
- return f.pointerId !== null || !f.shouldCancelNextClick ? !1 : (et(), f.clickResetTimer = window.setTimeout(() => {
1140
- const w = j.current;
1141
- w.shouldCancelNextClick = !1, w.clickResetTimer = null;
1135
+ const ft = f.clientY - P.startClientY, Tt = P.startScroll - ft;
1136
+ G.current(Tt), f.cancelable && f.preventDefault();
1137
+ }, st = () => {
1138
+ const f = it.current;
1139
+ return f.pointerId !== null || !f.shouldCancelNextClick ? !1 : (vt(), f.clickResetTimer = window.setTimeout(() => {
1140
+ const P = it.current;
1141
+ P.shouldCancelNextClick = !1, P.clickResetTimer = null;
1142
1142
  }, 0), !0);
1143
- }, qt = (f) => {
1144
- const w = j.current;
1145
- if (w.pointerId !== f.pointerId) {
1146
- Q();
1143
+ }, _t = (f) => {
1144
+ const P = it.current;
1145
+ if (P.pointerId !== f.pointerId) {
1146
+ st();
1147
1147
  return;
1148
1148
  }
1149
- w.isDragging && w.shouldCancelNextClick && f.cancelable && (f.preventDefault(), f.stopPropagation()), w.isDragging && ct(f.clientY);
1150
- let at = 0;
1151
- if (w.isDragging && w.velocitySamples.length >= 2) {
1152
- const wt = w.velocitySamples, Qt = Xt.current.velocitySampleWindow, Ht = wt[wt.length - 1], Ut = wt.find((te) => Ht.time - te.time <= Qt) ?? wt[0];
1153
- if (Ht && Ut && Ht.time !== Ut.time) {
1154
- const te = Ht.clientY - Ut.clientY, ce = Ht.time - Ut.time;
1155
- at = -(te / ce);
1149
+ P.isDragging && P.shouldCancelNextClick && f.cancelable && (f.preventDefault(), f.stopPropagation()), P.isDragging && ct(f.clientY);
1150
+ let ft = 0;
1151
+ if (P.isDragging && P.velocitySamples.length >= 2) {
1152
+ const Vt = P.velocitySamples, ie = Zt.current.velocitySampleWindow, Jt = Vt[Vt.length - 1], Qt = Vt.find((Kt) => Jt.time - Kt.time <= ie) ?? Vt[0];
1153
+ if (Jt && Qt && Jt.time !== Qt.time) {
1154
+ const Kt = Jt.clientY - Qt.clientY, se = Jt.time - Qt.time;
1155
+ ft = -(Kt / se);
1156
1156
  }
1157
1157
  }
1158
- et(), w.shouldCancelNextClick && (w.clickResetTimer = window.setTimeout(() => {
1159
- const wt = j.current;
1160
- wt.shouldCancelNextClick = !1, wt.clickResetTimer = null;
1158
+ vt(), P.shouldCancelNextClick && (P.clickResetTimer = window.setTimeout(() => {
1159
+ const Vt = it.current;
1160
+ Vt.shouldCancelNextClick = !1, Vt.clickResetTimer = null;
1161
1161
  }, 0));
1162
- const gt = Xt.current.startVelocityThreshold;
1163
- z(), p.hasPointerCapture(f.pointerId) && p.releasePointerCapture(f.pointerId), Math.abs(at) >= gt && Kt.current?.(at);
1164
- }, le = (f) => {
1165
- if (j.current.pointerId !== null) {
1166
- if (!f.isPrimary || f.pointerType !== j.current.pointerType)
1162
+ const Tt = Zt.current.startVelocityThreshold;
1163
+ X(), h.hasPointerCapture(f.pointerId) && h.releasePointerCapture(f.pointerId), Math.abs(ft) >= Tt && Wt.current?.(ft);
1164
+ }, Xt = (f) => {
1165
+ if (it.current.pointerId !== null) {
1166
+ if (!f.isPrimary || f.pointerType !== it.current.pointerType)
1167
1167
  return;
1168
- ht(j.current.pointerId);
1168
+ At(it.current.pointerId);
1169
1169
  }
1170
- if (j.current.shouldCancelNextClick && (et(), j.current.shouldCancelNextClick = !1), !(Bt.current && Et.current) || !ke(f.pointerType, _t.current) || f.button !== 0 && f.pointerType === "mouse" || f.ctrlKey || f.metaKey || f.altKey || Ot(f.target))
1170
+ if (it.current.shouldCancelNextClick && (vt(), it.current.shouldCancelNextClick = !1), !(E.current && zt.current) || !Be(f.pointerType, Ct.current) || f.button !== 0 && f.pointerType === "mouse" || f.ctrlKey || f.metaKey || f.altKey || It(f.target))
1171
1171
  return;
1172
- window.dispatchEvent(new CustomEvent(Ye, { detail: { paneId: ae } })), At.current?.();
1173
- const w = j.current;
1174
- et(), w.pointerId = f.pointerId, w.pointerType = f.pointerType, w.startClientY = f.clientY, w.startScroll = N.current, w.isDragging = !1, w.shouldCancelNextClick = !1, w.velocitySamples = [];
1175
- }, Nt = (f) => {
1176
- if (j.current.pointerId !== f.pointerId) {
1177
- Q();
1172
+ window.dispatchEvent(new CustomEvent(Xe, { detail: { paneId: R } })), Rt.current?.();
1173
+ const P = it.current;
1174
+ vt(), P.pointerId = f.pointerId, P.pointerType = f.pointerType, P.startClientY = f.clientY, P.startScroll = w.current, P.isDragging = !1, P.shouldCancelNextClick = !1, P.velocitySamples = [];
1175
+ }, Et = (f) => {
1176
+ if (it.current.pointerId !== f.pointerId) {
1177
+ st();
1178
1178
  return;
1179
1179
  }
1180
- it(f) && ht(f.pointerId);
1181
- }, Gt = [
1182
- ["click", kt, !0],
1183
- ["pointerdown", le, { passive: !1 }],
1180
+ ut(f) && At(f.pointerId);
1181
+ }, jt = [
1182
+ ["click", Mt, !0],
1183
+ ["pointerdown", Xt, { passive: !1 }],
1184
1184
  ["lostpointercapture", (f) => {
1185
- f.target !== p || j.current.pointerId !== f.pointerId || ht(f.pointerId);
1185
+ f.target !== h || it.current.pointerId !== f.pointerId || At(f.pointerId);
1186
1186
  }, void 0]
1187
- ], Vt = [
1188
- ["pointermove", st, { passive: !1 }],
1189
- ["pointerup", qt, void 0],
1190
- ["pointercancel", Nt, void 0]
1187
+ ], Nt = [
1188
+ ["pointermove", dt, { passive: !1 }],
1189
+ ["pointerup", _t, void 0],
1190
+ ["pointercancel", Et, void 0]
1191
1191
  ];
1192
- return Ne(p, Gt, "add"), Ne(window, Vt, "add"), () => {
1193
- Ne(p, Gt, "remove"), Ne(window, Vt, "remove");
1194
- const f = j.current;
1195
- f.pointerId !== null && p.hasPointerCapture(f.pointerId) && p.releasePointerCapture(f.pointerId), et(), z();
1192
+ return Le(h, jt, "add"), Le(window, Nt, "add"), () => {
1193
+ Le(h, jt, "remove"), Le(window, Nt, "remove");
1194
+ const f = it.current;
1195
+ f.pointerId !== null && h.hasPointerCapture(f.pointerId) && h.releasePointerCapture(f.pointerId), vt(), X();
1196
1196
  };
1197
- }, [ae]);
1198
- const dt = S(
1199
- (p) => (W(), F(p)),
1200
- [F, W]
1197
+ }, [R]);
1198
+ const $t = S(
1199
+ (h) => (J(), nt(h)),
1200
+ [nt, J]
1201
1201
  );
1202
- return /* @__PURE__ */ he("div", { ref: lt, "data-testid": v, className: pe("aqvs-scroll-pane", x), style: E, children: [
1203
- /* @__PURE__ */ he(
1202
+ return /* @__PURE__ */ Se("div", { ref: lt, "data-testid": v, className: Te("aqvs-scroll-pane", I), style: C, children: [
1203
+ /* @__PURE__ */ Se(
1204
1204
  "div",
1205
1205
  {
1206
- ref: K,
1207
- className: pe("aqvs-scroll-pane-content"),
1206
+ ref: j,
1207
+ className: Te("aqvs-scroll-pane-content"),
1208
1208
  "data-testid": "aqvs-scroll-pane-content",
1209
1209
  style: {
1210
1210
  height: e,
1211
- paddingTop: Yt.top,
1212
- paddingBottom: Yt.bottom,
1211
+ paddingTop: Ht.top,
1212
+ paddingBottom: Ht.bottom,
1213
1213
  // スクロール不能時 (contentSize <= viewportSize) は touch-action を通常に戻し、
1214
1214
  // 短いリスト上のタッチがページ全体のパンを妨げるデッドゾーン化を防ぐ。
1215
1215
  // 直接操作 (指・ペン) のドラッグを許可していない場合も付けない。
@@ -1223,49 +1223,49 @@ const vt = (n, t, e) => Math.max(t, Math.min(e, n)), Ye = "virtualscroll:tap-scr
1223
1223
  // 同一条件で揃えてあるため状態としても一貫している。
1224
1224
  // 非同期コンテンツを先読みして確保する挙動は意図的に入れていない
1225
1225
  // (空のペインがページのパンを殺すデッドゾーンになり、そちらの実害の方が大きいため)。
1226
- ...c && J && d.some((p) => p === "touch" || p === "pen") ? { touchAction: "none" } : {}
1226
+ ...c && et && d.some((h) => h === "touch" || h === "pen") ? { touchAction: "none" } : {}
1227
1227
  },
1228
- ...X,
1229
- id: A,
1228
+ ...U,
1229
+ id: de,
1230
1230
  children: [
1231
- m,
1232
- n(N.current)
1231
+ p,
1232
+ r(w.current)
1233
1233
  ]
1234
1234
  }
1235
1235
  ),
1236
1236
  /* @__PURE__ */ ot(
1237
- Ir,
1237
+ Mr,
1238
1238
  {
1239
1239
  contentSize: t,
1240
1240
  viewportSize: e,
1241
- scrollPosition: N.current,
1242
- onScroll: dt,
1241
+ scrollPosition: w.current,
1242
+ onScroll: $t,
1243
1243
  enableThumbDrag: i,
1244
1244
  enableTrackClick: s,
1245
1245
  enableArrowButtons: a,
1246
- scrollBarWidth: r,
1247
- ariaControls: A,
1248
- tapScrollCircleOptions: _,
1249
- itemCount: Z,
1250
- renderThumbOverlay: ut,
1251
- visibleStartIndex: Pt,
1252
- visibleEndIndex: D
1246
+ scrollBarWidth: n,
1247
+ ariaControls: de,
1248
+ tapScrollCircleOptions: V,
1249
+ itemCount: W,
1250
+ renderThumbOverlay: at,
1251
+ visibleStartIndex: wt,
1252
+ visibleEndIndex: A
1253
1253
  },
1254
1254
  "scrollbar"
1255
1255
  ),
1256
1256
  O?.()
1257
1257
  ] });
1258
1258
  }
1259
- ), Ue = (n, t, e) => Math.min(Math.max(n, t), e), kr = ({ dragState: n, normalizedDistance: t, sizeScale: e, size: r }) => {
1260
- const i = Math.max(r / 2, 1), s = 1 + t * 0.65, a = Math.max(0.65, 1 - t * 0.25), c = n.direction * t * 26 * e, d = 0.8 + t * 0.18, b = 3 * e, x = 6 * e, v = 22 * e, E = Math.abs(c) + x, m = c > 0 ? b : -Math.abs(c) - b, _ = Math.max(2.5, 3 * e), B = Ue(n.offsetX, -i, i), Z = Ue(n.offsetY, -i, i), ut = i * 0.35, rt = B / i * ut, nt = Z / i * ut, pt = rt * 0.45, Pt = nt * 0.45, D = Math.max(v * 0.38, 6), O = 0.65 + t * 0.2, P = n.active;
1261
- return /* @__PURE__ */ he(Ge, { children: [
1259
+ ), Ge = (r, t, e) => Math.min(Math.max(r, t), e), Br = ({ dragState: r, normalizedDistance: t, sizeScale: e, size: n }) => {
1260
+ const i = Math.max(n / 2, 1), s = 1 + t * 0.65, a = Math.max(0.65, 1 - t * 0.25), c = r.direction * t * 26 * e, d = 0.8 + t * 0.18, b = 3 * e, I = 6 * e, v = 22 * e, C = Math.abs(c) + I, p = c > 0 ? b : -Math.abs(c) - b, V = Math.max(2.5, 3 * e), z = Ge(r.offsetX, -i, i), W = Ge(r.offsetY, -i, i), at = i * 0.35, Q = z / i * at, tt = W / i * at, xt = Q * 0.45, wt = tt * 0.45, A = Math.max(v * 0.38, 6), O = 0.65 + t * 0.2, M = r.active;
1261
+ return /* @__PURE__ */ Se(tr, { children: [
1262
1262
  /* @__PURE__ */ ot(
1263
1263
  "div",
1264
1264
  {
1265
1265
  className: "aqvs-tap-scroll-circle-gradient",
1266
1266
  style: {
1267
1267
  transform: `scale(${a}, ${s})`,
1268
- transition: P ? "40ms transform ease-out" : "200ms ease transform"
1268
+ transition: M ? "40ms transform ease-out" : "200ms ease transform"
1269
1269
  }
1270
1270
  }
1271
1271
  ),
@@ -1276,8 +1276,8 @@ const vt = (n, t, e) => Math.max(t, Math.min(e, n)), Ye = "virtualscroll:tap-scr
1276
1276
  style: {
1277
1277
  width: v,
1278
1278
  height: v,
1279
- transform: `translate(calc(-50% + ${rt}px), calc(-50% + ${nt}px)) scale(${a}, ${d * s})`,
1280
- transition: P ? "70ms transform ease-out" : "200ms ease transform"
1279
+ transform: `translate(calc(-50% + ${Q}px), calc(-50% + ${tt}px)) scale(${a}, ${d * s})`,
1280
+ transition: M ? "70ms transform ease-out" : "200ms ease transform"
1281
1281
  }
1282
1282
  }
1283
1283
  ),
@@ -1286,12 +1286,12 @@ const vt = (n, t, e) => Math.max(t, Math.min(e, n)), Ye = "virtualscroll:tap-scr
1286
1286
  {
1287
1287
  className: "aqvs-sample-visual-highlight",
1288
1288
  style: {
1289
- width: D,
1290
- height: D,
1291
- transform: `translate(calc(-50% + ${pt}px), calc(-50% + ${Pt}px)) scale(${a}, ${s})`,
1289
+ width: A,
1290
+ height: A,
1291
+ transform: `translate(calc(-50% + ${xt}px), calc(-50% + ${wt}px)) scale(${a}, ${s})`,
1292
1292
  opacity: O,
1293
1293
  boxShadow: "0 0 8px rgba(255,255,255,0.45)",
1294
- transition: P ? "120ms opacity 150ms, 120ms transform ease-out ease-out" : "220ms ease transform, 240ms opacity ease"
1294
+ transition: M ? "120ms opacity 150ms, 120ms transform ease-out ease-out" : "220ms ease transform, 240ms opacity ease"
1295
1295
  }
1296
1296
  }
1297
1297
  ),
@@ -1300,34 +1300,34 @@ const vt = (n, t, e) => Math.max(t, Math.min(e, n)), Ye = "virtualscroll:tap-scr
1300
1300
  {
1301
1301
  className: "aqvs-sample-visual-rod",
1302
1302
  style: {
1303
- width: _,
1304
- height: E,
1305
- transform: `translate(-50%, ${m}px)`,
1303
+ width: V,
1304
+ height: C,
1305
+ transform: `translate(-50%, ${p}px)`,
1306
1306
  opacity: t,
1307
- transition: P ? "40ms height, 60ms opacity ease-out ease-out" : "200ms ease height, 120ms ease opacity"
1307
+ transition: M ? "40ms height, 60ms opacity ease-out ease-out" : "200ms ease height, 120ms ease opacity"
1308
1308
  }
1309
1309
  }
1310
1310
  )
1311
1311
  ] });
1312
- }, Ve = 100, Pr = (n) => {
1313
- if (!Number.isFinite(n))
1312
+ }, _e = 100, Rr = (r) => {
1313
+ if (!Number.isFinite(r))
1314
1314
  return 0n;
1315
- const t = Math.trunc(n);
1315
+ const t = Math.trunc(r);
1316
1316
  return t <= 0 ? 0n : BigInt(t);
1317
- }, Fe = (n, t) => {
1318
- if (!Number.isFinite(n))
1319
- throw new Error(`valueFn returned a non-finite value at index ${t}: ${n}`);
1320
- return n;
1321
- }, xe = (n) => {
1322
- if (n <= 0 || !Number.isFinite(n))
1317
+ }, qe = (r, t) => {
1318
+ if (!Number.isFinite(r))
1319
+ throw new Error(`valueFn returned a non-finite value at index ${t}: ${r}`);
1320
+ return r;
1321
+ }, Pe = (r) => {
1322
+ if (r <= 0 || !Number.isFinite(r))
1323
1323
  return 0;
1324
- const t = Math.trunc(n);
1324
+ const t = Math.trunc(r);
1325
1325
  if (t <= 2147483647)
1326
1326
  return t & -t;
1327
1327
  const e = BigInt(t) & -BigInt(t);
1328
1328
  return Number(e);
1329
1329
  };
1330
- class me {
1330
+ class ge {
1331
1331
  /**
1332
1332
  * @private
1333
1333
  * @property {Map<number, number>} tree - The Map storing the Fenwick tree structure, specifically the sums of deltas. It is 1-indexed.
@@ -1367,8 +1367,8 @@ class me {
1367
1367
  * @param {number | ((index: number) => number)} valueOrFn - The value for all elements, or a function to generate values.
1368
1368
  * @param {{ sampleRange?: { from: number; to: number }, materialize?: boolean }} [options] - Optional settings for initialization.
1369
1369
  */
1370
- constructor(t, e, r) {
1371
- this.reset(t, e, r);
1370
+ constructor(t, e, n) {
1371
+ this.reset(t, e, n);
1372
1372
  }
1373
1373
  /**
1374
1374
  * @method reset
@@ -1385,7 +1385,7 @@ class me {
1385
1385
  * @param {number | ((index: number) => number)} valueOrFn - The value for all elements, or a function to generate values.
1386
1386
  * @param {{ sampleRange?: { from: number; to: number }, materialize?: boolean }} [options] - Optional settings for initialization.
1387
1387
  */
1388
- reset(t, e, r) {
1388
+ reset(t, e, n) {
1389
1389
  const i = Number.isFinite(t) && t > 0 ? Math.trunc(t) : 0;
1390
1390
  if (typeof e != "function") {
1391
1391
  this.size = i, this.tree = /* @__PURE__ */ new Map(), this.deltas = /* @__PURE__ */ new Map(), this.valueFn = void 0, this.baseValue = e, this.total = this.baseValue * this.size;
@@ -1393,16 +1393,16 @@ class me {
1393
1393
  }
1394
1394
  let s = 0, a;
1395
1395
  if (i > 0) {
1396
- const c = r?.sampleRange ?? {
1396
+ const c = n?.sampleRange ?? {
1397
1397
  from: 0,
1398
- to: Math.min(Ve - 1, i - 1)
1398
+ to: Math.min(_e - 1, i - 1)
1399
1399
  };
1400
1400
  let d = Math.max(0, Math.trunc(c.from)), b = Math.min(Math.trunc(c.to), i - 1);
1401
- if (d > b && (d = 0, b = Math.min(Ve - 1, i - 1)), i > Ve)
1402
- s = me._sampleBaseValueStrided(e, i, Ve), r?.materialize && (a = { from: d, values: me._collectValidatedValues(e, d, b) });
1401
+ if (d > b && (d = 0, b = Math.min(_e - 1, i - 1)), i > _e)
1402
+ s = ge._sampleBaseValueStrided(e, i, _e), n?.materialize && (a = { from: d, values: ge._collectValidatedValues(e, d, b) });
1403
1403
  else {
1404
- const x = me._collectValidatedValues(e, d, b);
1405
- s = me._modeOrMedian([...x]), r?.materialize && (a = { from: d, values: x });
1404
+ const I = ge._collectValidatedValues(e, d, b);
1405
+ s = ge._modeOrMedian([...I]), n?.materialize && (a = { from: d, values: I });
1406
1406
  }
1407
1407
  }
1408
1408
  if (this.size = i, this.tree = /* @__PURE__ */ new Map(), this.deltas = /* @__PURE__ */ new Map(), this.total = void 0, this.valueFn = e, this.baseValue = s, a)
@@ -1439,10 +1439,10 @@ class me {
1439
1439
  * @param {number} to - The ending index of the range (inclusive).
1440
1440
  * @returns {number[]} The validated (finite-only) values in index order.
1441
1441
  */
1442
- static _collectValidatedValues(t, e, r) {
1442
+ static _collectValidatedValues(t, e, n) {
1443
1443
  const i = [];
1444
- for (let s = e; s <= r; s++)
1445
- i.push(Fe(t(s), s));
1444
+ for (let s = e; s <= n; s++)
1445
+ i.push(qe(t(s), s));
1446
1446
  return i;
1447
1447
  }
1448
1448
  /**
@@ -1458,8 +1458,8 @@ class me {
1458
1458
  return 0;
1459
1459
  t.sort((a, c) => a - c);
1460
1460
  const e = Math.floor(t.length / 2);
1461
- let r;
1462
- t.length % 2 === 0 ? r = Math.floor((t[e - 1] + t[e]) / 2) : r = t[e];
1461
+ let n;
1462
+ t.length % 2 === 0 ? n = Math.floor((t[e - 1] + t[e]) / 2) : n = t[e];
1463
1463
  const i = /* @__PURE__ */ new Map();
1464
1464
  let s = 0;
1465
1465
  for (const a of t) {
@@ -1471,9 +1471,9 @@ class me {
1471
1471
  for (const [d, b] of i.entries())
1472
1472
  b === s && a.push(d);
1473
1473
  const c = a.reduce((d, b) => d + b, 0);
1474
- r = Math.floor(c / a.length);
1474
+ n = Math.floor(c / a.length);
1475
1475
  }
1476
- return r;
1476
+ return n;
1477
1477
  }
1478
1478
  /**
1479
1479
  * @private
@@ -1485,15 +1485,15 @@ class me {
1485
1485
  * @param {number} sampleCount - Maximum number of points to evaluate.
1486
1486
  * @returns {number} The estimated base value.
1487
1487
  */
1488
- static _sampleBaseValueStrided(t, e, r) {
1488
+ static _sampleBaseValueStrided(t, e, n) {
1489
1489
  if (e <= 0)
1490
1490
  return 0;
1491
- let i = Math.max(1, Math.ceil(e / r));
1491
+ let i = Math.max(1, Math.ceil(e / n));
1492
1492
  i % 2 === 0 && (i += 1);
1493
1493
  const s = [];
1494
- for (let a = 0; a < e && s.length < r; a += i)
1495
- s.push(Fe(t(a), a));
1496
- return me._modeOrMedian(s);
1494
+ for (let a = 0; a < e && s.length < n; a += i)
1495
+ s.push(qe(t(a), a));
1496
+ return ge._modeOrMedian(s);
1497
1497
  }
1498
1498
  /**
1499
1499
  * @method update
@@ -1533,21 +1533,21 @@ class me {
1533
1533
  */
1534
1534
  updateDeltas(t) {
1535
1535
  const e = /* @__PURE__ */ new Map();
1536
- for (const { index: r, change: i } of t) {
1537
- if (r < 0 || r >= this.size)
1538
- throw new Error(`Index ${r} out of bounds`);
1539
- if (!Number.isInteger(r))
1540
- throw new Error(`Index must be an integer: ${r}`);
1536
+ for (const { index: n, change: i } of t) {
1537
+ if (n < 0 || n >= this.size)
1538
+ throw new Error(`Index ${n} out of bounds`);
1539
+ if (!Number.isInteger(n))
1540
+ throw new Error(`Index must be an integer: ${n}`);
1541
1541
  if (!Number.isFinite(i))
1542
1542
  throw new Error(`Change must be a finite number: ${i}`);
1543
- const a = (e.get(r) ?? this.deltas.get(r) ?? 0) + i;
1543
+ const a = (e.get(n) ?? this.deltas.get(n) ?? 0) + i;
1544
1544
  if (a + this.baseValue < -1e-9)
1545
- throw new Error(`Change would make the value at index ${r} negative: ${a + this.baseValue}`);
1546
- e.set(r, a);
1545
+ throw new Error(`Change would make the value at index ${n} negative: ${a + this.baseValue}`);
1546
+ e.set(n, a);
1547
1547
  }
1548
- for (const { index: r, change: i } of t) {
1549
- const a = (this.deltas.get(r) ?? 0) + i;
1550
- a === 0 ? this.deltas.delete(r) : this.deltas.set(r, a), this._updateTree(r, i);
1548
+ for (const { index: n, change: i } of t) {
1549
+ const a = (this.deltas.get(n) ?? 0) + i;
1550
+ a === 0 ? this.deltas.delete(n) : this.deltas.set(n, a), this._updateTree(n, i);
1551
1551
  }
1552
1552
  return this.total;
1553
1553
  }
@@ -1562,13 +1562,13 @@ class me {
1562
1562
  _updateTree(t, e) {
1563
1563
  if (e === 0)
1564
1564
  return;
1565
- let r = t + 1;
1566
- for (; r <= this.size; ) {
1567
- this.tree.set(r, (this.tree.get(r) ?? 0) + e);
1568
- const i = xe(r);
1565
+ let n = t + 1;
1566
+ for (; n <= this.size; ) {
1567
+ this.tree.set(n, (this.tree.get(n) ?? 0) + e);
1568
+ const i = Pe(n);
1569
1569
  if (i === 0)
1570
1570
  break;
1571
- r += i;
1571
+ n += i;
1572
1572
  }
1573
1573
  this.total !== void 0 && (this.total += e);
1574
1574
  }
@@ -1581,7 +1581,7 @@ class me {
1581
1581
  * @returns {DeltaUpdate[]} Sanitized delta updates ready to apply.
1582
1582
  */
1583
1583
  _buildDeltaUpdates(t) {
1584
- const e = [], r = /* @__PURE__ */ new Map();
1584
+ const e = [], n = /* @__PURE__ */ new Map();
1585
1585
  for (const { index: i, value: s } of t) {
1586
1586
  if (i < 0 || i >= this.size)
1587
1587
  throw new Error(`Index ${i} out of bounds`);
@@ -1591,8 +1591,8 @@ class me {
1591
1591
  throw new Error(`Value must be a finite number: ${s}`);
1592
1592
  if (s < 0)
1593
1593
  throw new Error("Value cannot be negative.");
1594
- const a = r.has(i) ? r.get(i) ?? 0 : this.deltas.get(i) ?? 0, c = a + this.baseValue, d = s - c;
1595
- d !== 0 && e.push({ index: i, change: d }), r.set(i, a + d);
1594
+ const a = n.has(i) ? n.get(i) ?? 0 : this.deltas.get(i) ?? 0, c = a + this.baseValue, d = s - c;
1595
+ d !== 0 && e.push({ index: i, change: d }), n.set(i, a + d);
1596
1596
  }
1597
1597
  return e;
1598
1598
  }
@@ -1609,10 +1609,10 @@ class me {
1609
1609
  let t = 0, e = this.size;
1610
1610
  for (; e > 0; ) {
1611
1611
  t += this.tree.get(e) ?? 0;
1612
- const r = xe(e);
1613
- if (r === 0)
1612
+ const n = Pe(e);
1613
+ if (n === 0)
1614
1614
  break;
1615
- e -= r;
1615
+ e -= n;
1616
1616
  }
1617
1617
  return t + this.baseValue * this.size;
1618
1618
  }
@@ -1626,9 +1626,9 @@ class me {
1626
1626
  */
1627
1627
  _materialize(t, e = !0) {
1628
1628
  if (this.valueFn) {
1629
- const r = this.deltas.get(t) ?? 0, s = Fe(this.valueFn(t), t) - this.baseValue;
1630
- if (s !== r && (s === 0 ? this.deltas.delete(t) : this.deltas.set(t, s), e)) {
1631
- const a = s - r;
1629
+ const n = this.deltas.get(t) ?? 0, s = qe(this.valueFn(t), t) - this.baseValue;
1630
+ if (s !== n && (s === 0 ? this.deltas.delete(t) : this.deltas.set(t, s), e)) {
1631
+ const a = s - n;
1632
1632
  this._updateTree(t, a);
1633
1633
  }
1634
1634
  }
@@ -1642,19 +1642,19 @@ class me {
1642
1642
  * @param {number | undefined} index - Target index for materialization.
1643
1643
  * @param {boolean} [forceIndex=false] - When true, materializes the index even if it is outside the provided ranges.
1644
1644
  */
1645
- _materializeRanges(t, e, r = !1) {
1645
+ _materializeRanges(t, e, n = !1) {
1646
1646
  if (!(t?.materialize && this.valueFn))
1647
1647
  return;
1648
1648
  const i = t.ranges;
1649
1649
  if (i && i.length > 0) {
1650
1650
  for (const c of i) {
1651
1651
  const d = Math.max(0, Math.trunc(c.from)), b = Math.min(Math.trunc(c.to), this.size - 1);
1652
- for (let x = d; x <= b; x++)
1653
- this._materialize(x);
1652
+ for (let I = d; I <= b; I++)
1653
+ this._materialize(I);
1654
1654
  }
1655
1655
  if (e === void 0)
1656
1656
  return;
1657
- if (r) {
1657
+ if (n) {
1658
1658
  this._materialize(e);
1659
1659
  return;
1660
1660
  }
@@ -1674,16 +1674,16 @@ class me {
1674
1674
  * @param {boolean} chooseLowerBound - When true, finds the smallest index meeting or exceeding the target; otherwise finds the largest index not exceeding it.
1675
1675
  * @returns {{ index: number; total: number | undefined; cumulative: number | undefined; currentValue: number | undefined; safeIndex: number | undefined }} Binary search result.
1676
1676
  */
1677
- _findIndex(t, e = {}, r) {
1677
+ _findIndex(t, e = {}, n) {
1678
1678
  if (this.size >= 1073741824)
1679
- return this._findIndexLarge(t, e, r);
1679
+ return this._findIndexLarge(t, e, n);
1680
1680
  if (this.size === 0)
1681
1681
  return { index: -1, total: this.total ?? 0, cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
1682
1682
  this._materializeRanges(e.materializeOption);
1683
1683
  const i = e.materializeOption?.materialize === !0;
1684
1684
  let s;
1685
1685
  for (; ; ) {
1686
- if (s = this._descend(t, r), s < 0 || s >= this.size)
1686
+ if (s = this._descend(t, n), s < 0 || s >= this.size)
1687
1687
  return { index: -1, total: this.total ?? this.getTotal(), cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
1688
1688
  if (!i)
1689
1689
  break;
@@ -1710,59 +1710,59 @@ class me {
1710
1710
  * @returns {number} The candidate index (may be out of range when no index satisfies the condition).
1711
1711
  */
1712
1712
  _descend(t, e) {
1713
- let r = 0, i = 0, s = 1;
1713
+ let n = 0, i = 0, s = 1;
1714
1714
  for (; s << 1 <= this.size; )
1715
1715
  s <<= 1;
1716
1716
  for (; s > 0; s >>= 1) {
1717
- const a = r + s;
1717
+ const a = n + s;
1718
1718
  if (a <= this.size) {
1719
1719
  const d = (this.tree.get(a) ?? 0) + this.baseValue * s;
1720
- (e ? i + d < t : i + d <= t) && (r = a, i += d);
1720
+ (e ? i + d < t : i + d <= t) && (n = a, i += d);
1721
1721
  }
1722
1722
  }
1723
- return e ? r : r - 1;
1723
+ return e ? n : n - 1;
1724
1724
  }
1725
1725
  /**
1726
1726
  * Executes a binary search using bigint arithmetic for extremely large sizes.
1727
1727
  *
1728
1728
  * 非常に大きなサイズに対して bigint 演算を用いた二分探索を実施。
1729
1729
  */
1730
- _findIndexLarge(t, e, r) {
1730
+ _findIndexLarge(t, e, n) {
1731
1731
  if (this.size === 0)
1732
1732
  return { index: -1, total: this.total ?? 0, cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
1733
- const i = Pr(this.size);
1733
+ const i = Rr(this.size);
1734
1734
  if (i === 0n)
1735
1735
  return { index: -1, total: this.total ?? 0, cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
1736
1736
  this._materializeRanges(e.materializeOption);
1737
1737
  const s = e.materializeOption?.materialize === !0;
1738
1738
  for (; ; ) {
1739
- let a = 0n, c = i - 1n, d, b, x = this.total;
1739
+ let a = 0n, c = i - 1n, d, b, I = this.total;
1740
1740
  for (; a <= c; ) {
1741
- const m = a + c >> 1n, _ = Number(m), B = this.prefixSum(_);
1742
- if (x = B.total, r ? B.cumulative >= t : B.cumulative <= t)
1743
- if (d = m, b = B, r) {
1744
- if (m === 0n)
1741
+ const p = a + c >> 1n, V = Number(p), z = this.prefixSum(V);
1742
+ if (I = z.total, n ? z.cumulative >= t : z.cumulative <= t)
1743
+ if (d = p, b = z, n) {
1744
+ if (p === 0n)
1745
1745
  break;
1746
- c = m - 1n;
1746
+ c = p - 1n;
1747
1747
  } else
1748
- a = m + 1n;
1749
- else if (r)
1750
- a = m + 1n;
1748
+ a = p + 1n;
1749
+ else if (n)
1750
+ a = p + 1n;
1751
1751
  else {
1752
- if (m === 0n)
1752
+ if (p === 0n)
1753
1753
  break;
1754
- c = m - 1n;
1754
+ c = p - 1n;
1755
1755
  }
1756
1756
  }
1757
- const v = b, E = d !== void 0 ? Number(d) : -1;
1758
- if (s && E >= 0) {
1759
- const m = this.deltas.get(E) ?? 0;
1760
- if (this._materialize(E), (this.deltas.get(E) ?? 0) !== m)
1757
+ const v = b, C = d !== void 0 ? Number(d) : -1;
1758
+ if (s && C >= 0) {
1759
+ const p = this.deltas.get(C) ?? 0;
1760
+ if (this._materialize(C), (this.deltas.get(C) ?? 0) !== p)
1761
1761
  continue;
1762
1762
  }
1763
1763
  return {
1764
- index: E,
1765
- total: x,
1764
+ index: C,
1765
+ total: I,
1766
1766
  cumulative: v?.cumulative,
1767
1767
  currentValue: v?.currentValue,
1768
1768
  safeIndex: v?.safeIndex
@@ -1782,19 +1782,19 @@ class me {
1782
1782
  return { cumulative: 0, total: this.total, currentValue: 0, safeIndex: 0 };
1783
1783
  if (this.size === 0)
1784
1784
  return { cumulative: 0, total: this.total ?? 0, currentValue: 0, safeIndex: 0 };
1785
- const r = vt(Math.trunc(t), 0, this.size - 1), i = e?.materializeOption;
1786
- this._materializeRanges(i, r, !0);
1787
- let s = 0, a = r + 1;
1785
+ const n = rt(Math.trunc(t), 0, this.size - 1), i = e?.materializeOption;
1786
+ this._materializeRanges(i, n, !0);
1787
+ let s = 0, a = n + 1;
1788
1788
  for (; a > 0; ) {
1789
1789
  const d = this.tree.get(a) ?? 0;
1790
1790
  s += d;
1791
- const b = xe(a);
1791
+ const b = Pe(a);
1792
1792
  if (b === 0)
1793
1793
  break;
1794
1794
  a -= b;
1795
1795
  }
1796
- const c = i?.materialize ? this.get(r) : (this.deltas.get(r) || 0) + this.baseValue;
1797
- return { cumulative: s + this.baseValue * (r + 1), total: this.total, currentValue: c, safeIndex: r };
1796
+ const c = i?.materialize ? this.get(n) : (this.deltas.get(n) || 0) + this.baseValue;
1797
+ return { cumulative: s + this.baseValue * (n + 1), total: this.total, currentValue: c, safeIndex: n };
1798
1798
  }
1799
1799
  /**
1800
1800
  * @method get
@@ -1809,8 +1809,8 @@ class me {
1809
1809
  return 0;
1810
1810
  if (!Number.isInteger(t) || t < 0 || t >= this.size)
1811
1811
  throw new Error("Index out of bounds");
1812
- const r = e?.materializeOption;
1813
- return this._materializeRanges(r, t), (this.deltas.get(t) ?? 0) + this.baseValue;
1812
+ const n = e?.materializeOption;
1813
+ return this._materializeRanges(n, t), (this.deltas.get(t) ?? 0) + this.baseValue;
1814
1814
  }
1815
1815
  /**
1816
1816
  * @method getTotal
@@ -1826,8 +1826,8 @@ class me {
1826
1826
  this.total = 0;
1827
1827
  else {
1828
1828
  this.total = this._computeTreeTotal();
1829
- const r = this.prefixSum(this.getSize() - 1);
1830
- r.cumulative !== r.total && C.error("Inconsistent Fenwick Tree state");
1829
+ const n = this.prefixSum(this.getSize() - 1);
1830
+ n.cumulative !== n.total && N.error("Inconsistent Fenwick Tree state");
1831
1831
  }
1832
1832
  return this.total;
1833
1833
  }
@@ -1840,18 +1840,18 @@ class me {
1840
1840
  */
1841
1841
  rebuildTree(t) {
1842
1842
  if (t?.materialize && this.valueFn) {
1843
- const r = this.valueFn;
1844
- this.reset(this.size, (i) => r(i), { materialize: !0 });
1843
+ const n = this.valueFn;
1844
+ this.reset(this.size, (i) => n(i), { materialize: !0 });
1845
1845
  return;
1846
1846
  }
1847
1847
  const e = /* @__PURE__ */ new Map();
1848
- for (const [r, i] of this.deltas.entries()) {
1848
+ for (const [n, i] of this.deltas.entries()) {
1849
1849
  if (i === 0)
1850
1850
  continue;
1851
- let s = r + 1;
1851
+ let s = n + 1;
1852
1852
  for (; s <= this.size; ) {
1853
1853
  e.set(s, (e.get(s) ?? 0) + i);
1854
- const a = xe(s);
1854
+ const a = Pe(s);
1855
1855
  if (a === 0)
1856
1856
  break;
1857
1857
  s += a;
@@ -1874,8 +1874,8 @@ class me {
1874
1874
  if (this.total === void 0)
1875
1875
  return 0;
1876
1876
  let t = this.baseValue * this.size;
1877
- for (const [e, r] of this.deltas)
1878
- e < this.size && (t += r);
1877
+ for (const [e, n] of this.deltas)
1878
+ e < this.size && (t += n);
1879
1879
  return this.total - t;
1880
1880
  }
1881
1881
  /**
@@ -1917,16 +1917,16 @@ class me {
1917
1917
  changeSize(t) {
1918
1918
  if (!Number.isFinite(t))
1919
1919
  throw new Error(`Size must be a finite number: ${t}`);
1920
- const e = Math.max(0, Math.trunc(t)), r = this.size;
1921
- if (e === r)
1920
+ const e = Math.max(0, Math.trunc(t)), n = this.size;
1921
+ if (e === n)
1922
1922
  return;
1923
- if (e > r)
1924
- if (r === 0 && this.deltas.size > 0) {
1923
+ if (e > n)
1924
+ if (n === 0 && this.deltas.size > 0) {
1925
1925
  for (const s of this.deltas.keys())
1926
1926
  s >= e && this.deltas.delete(s);
1927
1927
  this.size = e, this.rebuildTree();
1928
1928
  } else
1929
- this._growSize(r, e);
1929
+ this._growSize(n, e);
1930
1930
  else {
1931
1931
  if (e > 0)
1932
1932
  for (const s of this.deltas.keys())
@@ -1934,7 +1934,7 @@ class me {
1934
1934
  this.size = e, this.rebuildTree();
1935
1935
  }
1936
1936
  const i = this.prefixSum(this.getSize() - 1);
1937
- i.cumulative !== i.total && C.error("Inconsistent Fenwick Tree state");
1937
+ i.cumulative !== i.total && N.error("Inconsistent Fenwick Tree state");
1938
1938
  }
1939
1939
  /**
1940
1940
  * @private
@@ -1946,14 +1946,14 @@ class me {
1946
1946
  * @returns {number} The minimum left boundary `t - lowestSetBit(t)` of the newly-activated nodes.
1947
1947
  */
1948
1948
  static _minCoveredLowBound(t, e) {
1949
- let r = 1;
1949
+ let n = 1;
1950
1950
  for (; ; ) {
1951
- const i = r * 2;
1951
+ const i = n * 2;
1952
1952
  if (Math.floor(e / i) * i <= t)
1953
1953
  break;
1954
- r = i;
1954
+ n = i;
1955
1955
  }
1956
- return r * Math.floor(t / r);
1956
+ return n * Math.floor(t / n);
1957
1957
  }
1958
1958
  /**
1959
1959
  * @private
@@ -1965,17 +1965,17 @@ class me {
1965
1965
  * @param {number} oldSize - The previous size.
1966
1966
  * @param {number} newSize - The new (larger) size.
1967
1967
  */
1968
- _propagateDeltaToGrownNodes(t, e, r, i) {
1968
+ _propagateDeltaToGrownNodes(t, e, n, i) {
1969
1969
  let s = t + 1;
1970
- for (; s <= r; ) {
1971
- const a = xe(s);
1970
+ for (; s <= n; ) {
1971
+ const a = Pe(s);
1972
1972
  if (a === 0)
1973
1973
  break;
1974
1974
  s += a;
1975
1975
  }
1976
1976
  for (; s <= i; ) {
1977
1977
  this.tree.set(s, (this.tree.get(s) ?? 0) + e);
1978
- const a = xe(s);
1978
+ const a = Pe(s);
1979
1979
  if (a === 0)
1980
1980
  break;
1981
1981
  s += a;
@@ -1991,15 +1991,15 @@ class me {
1991
1991
  */
1992
1992
  _growSize(t, e) {
1993
1993
  if (this.size = e, this.deltas.size > 0) {
1994
- const r = me._minCoveredLowBound(t, e);
1995
- if (t - r < this.deltas.size)
1996
- for (let s = r; s < t; s++) {
1994
+ const n = ge._minCoveredLowBound(t, e);
1995
+ if (t - n < this.deltas.size)
1996
+ for (let s = n; s < t; s++) {
1997
1997
  const a = this.deltas.get(s);
1998
1998
  a === void 0 || a === 0 || this._propagateDeltaToGrownNodes(s, a, t, e);
1999
1999
  }
2000
2000
  else
2001
2001
  for (const [s, a] of this.deltas.entries())
2002
- a === 0 || s < r || this._propagateDeltaToGrownNodes(s, a, t, e);
2002
+ a === 0 || s < n || this._propagateDeltaToGrownNodes(s, a, t, e);
2003
2003
  }
2004
2004
  this.total = this._computeTreeTotal();
2005
2005
  }
@@ -2069,20 +2069,20 @@ class me {
2069
2069
  return this._findIndex(t, e ?? {}, !1);
2070
2070
  }
2071
2071
  }
2072
- const Mr = (n, t) => {
2073
- const e = n?.sampleRange, r = t?.sampleRange;
2074
- return e === r ? !1 : e && r ? e.from !== r.from || e.to !== r.to : !0;
2075
- }, yr = (n, t, e) => {
2076
- const r = Number.isFinite(n) && n > 0 ? Math.trunc(n) : 0, i = I(null), s = I({ size: r, valueOrFn: t, options: e });
2077
- i.current === null && (i.current = new me(r, t, e));
2078
- const a = i.current, c = s.current, d = c.size !== r, b = c.valueOrFn !== t, x = Mr(c.options, e), v = c.size === 0 && r > 0 && (!i.current || i.current.base === 0);
2079
- if (b || x) {
2080
- const E = e?.resetOnValueFnChange ?? !0;
2081
- x || b && E || v ? (e?.debug && C.debug("[useFenwickMapTree] reset", { valueOrFnChanged: b, optionsChanged: x }), a.reset(r, t, e)) : (d && (e?.debug && C.debug("[useFenwickMapTree] resize (with valueFn change)", { from: c.size, to: r }), a.changeSize(r)), e?.debug && C.debug("[useFenwickMapTree] setValueFn (no reset)", { valueOrFnChanged: b }), a.setValueFn(t, { reset: !1 })), s.current = { size: r, valueOrFn: t, options: e };
2082
- } else d && (e?.debug && C.debug("[useFenwickMapTree] resize", { from: c.size, to: r }), v ? a.reset(r, t, e) : a.changeSize(r), s.current = { size: r, valueOrFn: t, options: e });
2072
+ const Er = (r, t) => {
2073
+ const e = r?.sampleRange, n = t?.sampleRange;
2074
+ return e === n ? !1 : e && n ? e.from !== n.from || e.to !== n.to : !0;
2075
+ }, Nr = (r, t, e) => {
2076
+ const n = Number.isFinite(r) && r > 0 ? Math.trunc(r) : 0, i = x(null), s = x({ size: n, valueOrFn: t, options: e });
2077
+ i.current === null && (i.current = new ge(n, t, e));
2078
+ const a = i.current, c = s.current, d = c.size !== n, b = c.valueOrFn !== t, I = Er(c.options, e), v = c.size === 0 && n > 0 && (!i.current || i.current.base === 0);
2079
+ if (b || I) {
2080
+ const C = e?.resetOnValueFnChange ?? !0;
2081
+ I || b && C || v ? (e?.debug && N.debug("[useFenwickMapTree] reset", { valueOrFnChanged: b, optionsChanged: I }), a.reset(n, t, e)) : (d && (e?.debug && N.debug("[useFenwickMapTree] resize (with valueFn change)", { from: c.size, to: n }), a.changeSize(n)), e?.debug && N.debug("[useFenwickMapTree] setValueFn (no reset)", { valueOrFnChanged: b }), a.setValueFn(t, { reset: !1 })), s.current = { size: n, valueOrFn: t, options: e };
2082
+ } else d && (e?.debug && N.debug("[useFenwickMapTree] resize", { from: c.size, to: n }), v ? a.reset(n, t, e) : a.changeSize(n), s.current = { size: n, valueOrFn: t, options: e });
2083
2083
  return a;
2084
2084
  };
2085
- class wr {
2085
+ class Cr {
2086
2086
  key;
2087
2087
  value;
2088
2088
  prev = null;
@@ -2091,7 +2091,7 @@ class wr {
2091
2091
  this.key = t, this.value = e;
2092
2092
  }
2093
2093
  }
2094
- class ze {
2094
+ class He {
2095
2095
  head = null;
2096
2096
  tail = null;
2097
2097
  /**
@@ -2132,230 +2132,230 @@ class ze {
2132
2132
  this.remove(t), this.addToTail(t);
2133
2133
  }
2134
2134
  }
2135
- function Rr(n) {
2136
- const t = I(/* @__PURE__ */ new Map()), e = I(new ze()), r = Math.floor(n), i = I(r);
2137
- q(() => {
2138
- if (i.current = r, Number.isNaN(r) || r < 0) {
2139
- C.warn(`useLruCache: invalid capacity ${n}; the cache will not store any entries.`), t.current.clear(), e.current = new ze();
2135
+ function Vr(r) {
2136
+ const t = x(/* @__PURE__ */ new Map()), e = x(new He()), n = Math.floor(r), i = x(n);
2137
+ Y(() => {
2138
+ if (i.current = n, Number.isNaN(n) || n < 0) {
2139
+ N.warn(`useLruCache: invalid capacity ${r}; the cache will not store any entries.`), t.current.clear(), e.current = new He();
2140
2140
  return;
2141
2141
  }
2142
- if (Number.isFinite(r))
2143
- for (; t.current.size > r; ) {
2144
- const x = e.current.removeHead();
2145
- if (x)
2146
- t.current.delete(x.key);
2142
+ if (Number.isFinite(n))
2143
+ for (; t.current.size > n; ) {
2144
+ const I = e.current.removeHead();
2145
+ if (I)
2146
+ t.current.delete(I.key);
2147
2147
  else
2148
2148
  break;
2149
2149
  }
2150
- }, [n, r]);
2151
- const s = S((x) => {
2152
- const v = t.current.get(x);
2150
+ }, [r, n]);
2151
+ const s = S((I) => {
2152
+ const v = t.current.get(I);
2153
2153
  if (v)
2154
2154
  return e.current.moveToTail(v), v.value;
2155
- }, []), a = S((x, v) => {
2156
- const E = i.current;
2157
- if (Number.isNaN(E) || E <= 0)
2155
+ }, []), a = S((I, v) => {
2156
+ const C = i.current;
2157
+ if (Number.isNaN(C) || C <= 0)
2158
2158
  return;
2159
- let m = t.current.get(x);
2160
- if (m)
2161
- m.value = v, e.current.moveToTail(m);
2159
+ let p = t.current.get(I);
2160
+ if (p)
2161
+ p.value = v, e.current.moveToTail(p);
2162
2162
  else {
2163
- if (t.current.size >= E) {
2164
- const _ = e.current.removeHead();
2165
- _ && t.current.delete(_.key);
2163
+ if (t.current.size >= C) {
2164
+ const V = e.current.removeHead();
2165
+ V && t.current.delete(V.key);
2166
2166
  }
2167
- m = new wr(x, v), t.current.set(x, m), e.current.addToTail(m);
2167
+ p = new Cr(I, v), t.current.set(I, p), e.current.addToTail(p);
2168
2168
  }
2169
- }, []), c = S((x) => t.current.has(x), []), d = S((x) => {
2170
- const v = t.current.get(x);
2171
- v && (e.current.remove(v), t.current.delete(x));
2169
+ }, []), c = S((I) => t.current.has(I), []), d = S((I) => {
2170
+ const v = t.current.get(I);
2171
+ v && (e.current.remove(v), t.current.delete(I));
2172
2172
  }, []), b = S(() => {
2173
- t.current.clear(), e.current = new ze();
2173
+ t.current.clear(), e.current = new He();
2174
2174
  }, []);
2175
- return Lt(() => ({ get: s, set: a, has: c, remove: d, clear: b }), [s, a, c, d, b]);
2175
+ return Ft(() => ({ get: s, set: a, has: c, remove: d, clear: b }), [s, a, c, d, b]);
2176
2176
  }
2177
- const Cr = 1e4, Fr = () => {
2178
- const { get: n, set: t, has: e, clear: r } = Rr(Cr);
2179
- return Lt(() => ({ get: n, set: t, has: e, clear: r }), [n, t, e, r]);
2180
- }, It = (n, t) => t <= 0 ? 0 : vt(n, 0, t - 1), Ke = (n) => ({
2181
- top: Math.max(0, n?.top ?? 0),
2182
- bottom: Math.max(0, n?.bottom ?? 0)
2183
- }), oe = (n, t) => n <= t ? 0 : n - t, Ie = (n, t) => n <= 0 ? 0 : n + t, Ae = 1e3, We = 2e3, Er = 1048576, ye = (n) => {
2184
- if (!Number.isFinite(n)) return 0n;
2185
- const t = Math.trunc(n);
2177
+ const Dr = 1e4, qr = () => {
2178
+ const { get: r, set: t, has: e, clear: n } = Vr(Dr);
2179
+ return Ft(() => ({ get: r, set: t, has: e, clear: n }), [r, t, e, n]);
2180
+ }, St = (r, t) => t <= 0 ? 0 : rt(r, 0, t - 1), Ze = (r) => ({
2181
+ top: Math.max(0, r?.top ?? 0),
2182
+ bottom: Math.max(0, r?.bottom ?? 0)
2183
+ }), ee = (r, t) => r <= t ? 0 : r - t, Ie = (r, t) => r <= 0 ? 0 : r + t, Oe = 1e3, Je = 2e3, Ar = 1048576, Ne = (r) => {
2184
+ if (!Number.isFinite(r)) return 0n;
2185
+ const t = Math.trunc(r);
2186
2186
  return t <= 0 ? 0n : BigInt(t);
2187
- }, Nr = (n, t, e, r, i, s, a, c) => {
2188
- const d = ye(r);
2187
+ }, Lr = (r, t, e, n, i, s, a, c) => {
2188
+ const d = Ne(n);
2189
2189
  if (d === 0n)
2190
2190
  return { renderingStartIndex: 0, renderingEndIndex: 0, visibleStartIndex: 0, visibleEndIndex: 0 };
2191
- const b = (D) => D < 0n ? 0n : D >= d ? d - 1n : D, x = { materializeOption: { materialize: !1 } }, { index: v, cumulative: E } = s.findIndexAtOrAfter(n, x);
2192
- let m;
2193
- v === -1 ? m = d - 1n : (E === n ? m = ye(v + 1) : m = ye(v), m >= d && (m = d - 1n)), n <= 0 && (m = 0n), c && n >= a && (m = d - 1n);
2194
- const _ = (D) => {
2195
- const O = Number(D);
2191
+ const b = (A) => A < 0n ? 0n : A >= d ? d - 1n : A, I = { materializeOption: { materialize: !1 } }, { index: v, cumulative: C } = s.findIndexAtOrAfter(r, I);
2192
+ let p;
2193
+ v === -1 ? p = d - 1n : (C === r ? p = Ne(v + 1) : p = Ne(v), p >= d && (p = d - 1n)), r <= 0 && (p = 0n), c && r >= a && (p = d - 1n);
2194
+ const V = (A) => {
2195
+ const O = Number(A);
2196
2196
  if (!Number.isSafeInteger(O))
2197
2197
  return null;
2198
- const { cumulative: P } = s.prefixSum(O, { materializeOption: { materialize: !1 } });
2199
- if (!Number.isFinite(P))
2198
+ const { cumulative: M } = s.prefixSum(O, { materializeOption: { materialize: !1 } });
2199
+ if (!Number.isFinite(M))
2200
2200
  return null;
2201
- const { index: X } = s.findIndexAtOrAfter(P + 0.5, { materializeOption: { materialize: !1 } });
2202
- if (X === -1)
2201
+ const { index: U } = s.findIndexAtOrAfter(M + 0.5, { materializeOption: { materialize: !1 } });
2202
+ if (U === -1)
2203
2203
  return null;
2204
- const $ = ye(X);
2205
- return $ > D ? $ : null;
2206
- }, B = (D) => {
2207
- let O = 0, P = D, X = D, $ = 0n, N = 0;
2208
- for (; P < d && O < t; ) {
2209
- const lt = Number(P), K = i(lt);
2210
- if (O += K, X = P, P += 1n, $ += 1n, !Number.isFinite(K) || K < 0)
2204
+ const Z = Ne(U);
2205
+ return Z > A ? Z : null;
2206
+ }, z = (A) => {
2207
+ let O = 0, M = A, U = A, Z = 0n, w = 0;
2208
+ for (; M < d && O < t; ) {
2209
+ const lt = Number(M), j = i(lt);
2210
+ if (O += j, U = M, M += 1n, Z += 1n, !Number.isFinite(j) || j < 0)
2211
2211
  break;
2212
- if (K === 0) {
2213
- if (N += 1, N > Ae) {
2214
- const T = _(X);
2215
- if (T !== null && T > P)
2216
- P = T, N = 0;
2217
- else if (T !== null && T === P && i(Number(P)) > 0)
2218
- N = 0;
2212
+ if (j === 0) {
2213
+ if (w += 1, w > Oe) {
2214
+ const T = V(U);
2215
+ if (T !== null && T > M)
2216
+ M = T, w = 0;
2217
+ else if (T !== null && T === M && i(Number(M)) > 0)
2218
+ w = 0;
2219
2219
  else
2220
2220
  break;
2221
2221
  }
2222
2222
  } else
2223
- N = 0;
2223
+ w = 0;
2224
2224
  }
2225
- return $ === 0n && (X = D), { height: O, end: X };
2225
+ return Z === 0n && (U = A), { height: O, end: U };
2226
2226
  };
2227
- let { height: Z, end: ut } = B(m);
2228
- if (Z < t && m > 0n) {
2229
- let D = m, O = Z, P = 0;
2230
- for (; D > 0n && O < t; ) {
2231
- D -= 1n;
2232
- const $ = Number(D), N = i($);
2233
- if (O += N, !Number.isFinite(N) || N < 0)
2227
+ let { height: W, end: at } = z(p);
2228
+ if (W < t && p > 0n) {
2229
+ let A = p, O = W, M = 0;
2230
+ for (; A > 0n && O < t; ) {
2231
+ A -= 1n;
2232
+ const Z = Number(A), w = i(Z);
2233
+ if (O += w, !Number.isFinite(w) || w < 0)
2234
2234
  break;
2235
- if (N === 0) {
2236
- if (P += 1, P > Ae) {
2237
- const lt = Number(D);
2235
+ if (w === 0) {
2236
+ if (M += 1, M > Oe) {
2237
+ const lt = Number(A);
2238
2238
  if (!Number.isSafeInteger(lt))
2239
2239
  break;
2240
- const { cumulative: K } = s.prefixSum(lt, { materializeOption: { materialize: !1 } });
2241
- if (!Number.isFinite(K))
2240
+ const { cumulative: j } = s.prefixSum(lt, { materializeOption: { materialize: !1 } });
2241
+ if (!Number.isFinite(j))
2242
2242
  break;
2243
- const { index: T } = s.findIndexAtOrAfter(K - 0.5, { materializeOption: { materialize: !1 } }), V = T === -1 ? -1n : ye(T);
2244
- if (V >= 0n && V < D)
2245
- D = V + 1n, P = 0;
2246
- else if (V === D && D >= 1n && i(Number(D - 1n)) > 0)
2247
- P = 0;
2243
+ const { index: T } = s.findIndexAtOrAfter(j - 0.5, { materializeOption: { materialize: !1 } }), q = T === -1 ? -1n : Ne(T);
2244
+ if (q >= 0n && q < A)
2245
+ A = q + 1n, M = 0;
2246
+ else if (q === A && A >= 1n && i(Number(A - 1n)) > 0)
2247
+ M = 0;
2248
2248
  else
2249
2249
  break;
2250
2250
  }
2251
2251
  } else
2252
- P = 0;
2252
+ M = 0;
2253
2253
  }
2254
- m = b(D);
2255
- const X = B(m);
2256
- Z = X.height, ut = X.end;
2254
+ p = b(A);
2255
+ const U = z(p);
2256
+ W = U.height, at = U.end;
2257
2257
  }
2258
- const rt = b(m), nt = b(ut), pt = b(rt - BigInt(Math.max(0, e))), Pt = b(nt + BigInt(Math.max(0, e)));
2258
+ const Q = b(p), tt = b(at), xt = b(Q - BigInt(Math.max(0, e))), wt = b(tt + BigInt(Math.max(0, e)));
2259
2259
  return {
2260
- renderingStartIndex: It(Number(pt), r),
2261
- renderingEndIndex: It(Number(Pt), r),
2262
- visibleStartIndex: It(Number(rt), r),
2263
- visibleEndIndex: It(Number(nt), r)
2260
+ renderingStartIndex: St(Number(xt), n),
2261
+ renderingEndIndex: St(Number(wt), n),
2262
+ visibleStartIndex: St(Number(Q), n),
2263
+ visibleEndIndex: St(Number(tt), n)
2264
2264
  };
2265
- }, Vr = (n, t, e, r, i, s, a) => {
2266
- if (r === 0)
2265
+ }, _r = (r, t, e, n, i, s, a) => {
2266
+ if (n === 0)
2267
2267
  return { renderingStartIndex: 0, renderingEndIndex: 0, visibleStartIndex: 0, visibleEndIndex: 0 };
2268
- const c = Number.isFinite(a), d = c ? Math.min(Math.max(0, n), a) : Math.max(0, n);
2269
- if (r >= Number.MAX_SAFE_INTEGER)
2270
- return Nr(d, t, e, r, i, s, a, c);
2271
- const { index: b, cumulative: x, currentValue: v } = s.findIndexAtOrAfter(d, { materializeOption: { materialize: !1 } }), E = b === -1 ? t <= 0 || (x ?? 0) < d + (v ?? 0) ? r - 1 : 0 : b;
2272
- let m = It(E, r), _ = 0;
2273
- if (b !== -1 && x === d)
2274
- m = It(b + 1, r), _ = 0;
2275
- else if (m === b && x !== void 0 && v !== void 0)
2276
- _ = x - v - d;
2268
+ const c = Number.isFinite(a), d = c ? Math.min(Math.max(0, r), a) : Math.max(0, r);
2269
+ if (n >= Number.MAX_SAFE_INTEGER)
2270
+ return Lr(d, t, e, n, i, s, a, c);
2271
+ const { index: b, cumulative: I, currentValue: v } = s.findIndexAtOrAfter(d, { materializeOption: { materialize: !1 } }), C = b === -1 ? t <= 0 || (I ?? 0) < d + (v ?? 0) ? n - 1 : 0 : b;
2272
+ let p = St(C, n), V = 0;
2273
+ if (b !== -1 && I === d)
2274
+ p = St(b + 1, n), V = 0;
2275
+ else if (p === b && I !== void 0 && v !== void 0)
2276
+ V = I - v - d;
2277
2277
  else {
2278
- const { cumulative: D, currentValue: O } = s.prefixSum(m, { materializeOption: { materialize: !1 } });
2279
- _ = (D ?? 0) - (O ?? 0) - d;
2278
+ const { cumulative: A, currentValue: O } = s.prefixSum(p, { materializeOption: { materialize: !1 } });
2279
+ V = (A ?? 0) - (O ?? 0) - d;
2280
2280
  }
2281
- const B = _, Z = (D, O) => {
2282
- let P = D, X = O, $ = 0;
2283
- for (; P < r && X < t; ) {
2284
- const N = i(P);
2285
- if (X += N, P++, !Number.isFinite(N) || N < 0)
2281
+ const z = V, W = (A, O) => {
2282
+ let M = A, U = O, Z = 0;
2283
+ for (; M < n && U < t; ) {
2284
+ const w = i(M);
2285
+ if (U += w, M++, !Number.isFinite(w) || w < 0)
2286
2286
  break;
2287
- if (N === 0) {
2288
- if ($++, $ > Ae) {
2289
- const { cumulative: lt } = s.prefixSum(P - 1, { materializeOption: { materialize: !1 } }), { index: K } = Number.isFinite(lt) ? s.findIndexAtOrAfter(lt + 0.5, { materializeOption: { materialize: !1 } }) : { index: -1 };
2290
- if (K > P)
2291
- P = K, $ = 0;
2292
- else if (K === P && i(P) > 0)
2293
- $ = 0;
2287
+ if (w === 0) {
2288
+ if (Z++, Z > Oe) {
2289
+ const { cumulative: lt } = s.prefixSum(M - 1, { materializeOption: { materialize: !1 } }), { index: j } = Number.isFinite(lt) ? s.findIndexAtOrAfter(lt + 0.5, { materializeOption: { materialize: !1 } }) : { index: -1 };
2290
+ if (j > M)
2291
+ M = j, Z = 0;
2292
+ else if (j === M && i(M) > 0)
2293
+ Z = 0;
2294
2294
  else
2295
2295
  break;
2296
2296
  }
2297
2297
  } else
2298
- $ = 0;
2298
+ Z = 0;
2299
2299
  }
2300
- return { cursor: P, height: X };
2301
- }, ut = Z(m, _);
2302
- let rt = ut.cursor;
2303
- if (_ = ut.height, _ < t && m > 0) {
2304
- let D = _ + Math.abs(Math.min(0, B)), O = m - 1, P = 0;
2305
- for (; O >= 0 && D < t; ) {
2306
- const $ = i(O);
2307
- if (D += $, !Number.isFinite($) || $ < 0) {
2300
+ return { cursor: M, height: U };
2301
+ }, at = W(p, V);
2302
+ let Q = at.cursor;
2303
+ if (V = at.height, V < t && p > 0) {
2304
+ let A = V + Math.abs(Math.min(0, z)), O = p - 1, M = 0;
2305
+ for (; O >= 0 && A < t; ) {
2306
+ const Z = i(O);
2307
+ if (A += Z, !Number.isFinite(Z) || Z < 0) {
2308
2308
  O--;
2309
2309
  break;
2310
2310
  }
2311
- if ($ === 0) {
2312
- if (P++, P > Ae) {
2313
- const { cumulative: N } = s.prefixSum(O, { materializeOption: { materialize: !1 } }), { index: lt } = Number.isFinite(N) ? s.findIndexAtOrAfter(N - 0.5, { materializeOption: { materialize: !1 } }) : { index: -1 };
2311
+ if (Z === 0) {
2312
+ if (M++, M > Oe) {
2313
+ const { cumulative: w } = s.prefixSum(O, { materializeOption: { materialize: !1 } }), { index: lt } = Number.isFinite(w) ? s.findIndexAtOrAfter(w - 0.5, { materializeOption: { materialize: !1 } }) : { index: -1 };
2314
2314
  if (lt !== -1 && lt < O) {
2315
- O = lt, P = 0;
2315
+ O = lt, M = 0;
2316
2316
  continue;
2317
2317
  }
2318
2318
  if (lt === O && O >= 1 && i(O - 1) > 0)
2319
- P = 0;
2319
+ M = 0;
2320
2320
  else {
2321
2321
  O--;
2322
2322
  break;
2323
2323
  }
2324
2324
  }
2325
2325
  } else
2326
- P = 0;
2326
+ M = 0;
2327
2327
  O--;
2328
2328
  }
2329
- m = It(O + 1, r);
2330
- const X = Z(m, 0);
2331
- rt = X.cursor, _ = X.height;
2329
+ p = St(O + 1, n);
2330
+ const U = W(p, 0);
2331
+ Q = U.cursor, V = U.height;
2332
2332
  }
2333
- const nt = It(m - e, r), pt = It(Math.max(rt - 1, m), r), Pt = It(pt + e, r);
2334
- return { renderingStartIndex: nt, renderingEndIndex: Pt, visibleStartIndex: m, visibleEndIndex: pt };
2335
- }, je = (n, t, e) => {
2336
- const r = Math.max(0, t ?? 0), i = I({ last: 0, id: null, arg: null }).current;
2337
- return q(
2333
+ const tt = St(p - e, n), xt = St(Math.max(Q - 1, p), n), wt = St(xt + e, n);
2334
+ return { renderingStartIndex: tt, renderingEndIndex: wt, visibleStartIndex: p, visibleEndIndex: xt };
2335
+ }, Qe = (r, t, e) => {
2336
+ const n = Math.max(0, t ?? 0), i = x({ last: 0, id: null, arg: null }).current;
2337
+ return Y(
2338
2338
  () => () => {
2339
- if (i.id !== null && (cancelAnimationFrame(i.id), i.id = null), i.arg !== null && n.current) {
2339
+ if (i.id !== null && (cancelAnimationFrame(i.id), i.id = null), i.arg !== null && r.current) {
2340
2340
  try {
2341
- e(n.current, i.arg);
2341
+ e(r.current, i.arg);
2342
2342
  } catch (s) {
2343
2343
  console.error("[useThrottledInvoker] Error flushing pending callback on unmount", s);
2344
2344
  }
2345
2345
  i.arg = null;
2346
2346
  }
2347
2347
  },
2348
- [i, n, e]
2348
+ [i, r, e]
2349
2349
  ), S(
2350
2350
  (s) => {
2351
2351
  if (i.arg = s, i.id !== null) return;
2352
2352
  const a = (c) => {
2353
2353
  if (i.id = null, i.arg === null) return;
2354
2354
  const d = c - i.last;
2355
- if (r === 0 || i.last === 0 || d >= r) {
2356
- if (n.current)
2355
+ if (n === 0 || i.last === 0 || d >= n) {
2356
+ if (r.current)
2357
2357
  try {
2358
- e(n.current, i.arg);
2358
+ e(r.current, i.arg);
2359
2359
  } catch (b) {
2360
2360
  console.error("[useThrottledInvoker] Error invoking callback", b);
2361
2361
  }
@@ -2365,17 +2365,17 @@ const Cr = 1e4, Fr = () => {
2365
2365
  };
2366
2366
  i.id = requestAnimationFrame(a);
2367
2367
  },
2368
- [r, e, n, i]
2368
+ [n, e, r, i]
2369
2369
  );
2370
- }, Ar = Qe.memo(({ index: n, top: t, height: e, item: r, children: i, clipItemHeight: s, enableKeyboardNavigation: a, onKeyDown: c, onFocus: d, registerItemRef: b }) => {
2371
- const x = S((_) => b(n, _), [n, b]), v = S((_) => c(_, n), [n, c]), E = S(() => d(n), [n, d]), m = S((_) => {
2372
- _.currentTarget.focus({ preventScroll: !0 });
2370
+ }, Or = nr.memo(({ index: r, top: t, height: e, item: n, children: i, clipItemHeight: s, enableKeyboardNavigation: a, onKeyDown: c, onFocus: d, registerItemRef: b }) => {
2371
+ const I = S((V) => b(r, V), [r, b]), v = S((V) => c(V, r), [r, c]), C = S(() => d(r), [r, d]), p = S((V) => {
2372
+ V.currentTarget.focus({ preventScroll: !0 });
2373
2373
  }, []);
2374
2374
  return /* @__PURE__ */ ot(
2375
2375
  "div",
2376
2376
  {
2377
- ref: x,
2378
- "data-index": n,
2377
+ ref: I,
2378
+ "data-index": r,
2379
2379
  "data-virtualscroll-item": "true",
2380
2380
  className: "aqvs-item-container",
2381
2381
  style: {
@@ -2384,380 +2384,403 @@ const Cr = 1e4, Fr = () => {
2384
2384
  overflow: s ? "hidden" : void 0
2385
2385
  },
2386
2386
  tabIndex: a ? -1 : void 0,
2387
- onPointerDown: a ? m : void 0,
2387
+ onPointerDown: a ? p : void 0,
2388
2388
  onKeyDownCapture: a ? v : void 0,
2389
- onFocusCapture: a ? E : void 0,
2390
- children: i(r, n)
2389
+ onFocusCapture: a ? C : void 0,
2390
+ children: i(n, r)
2391
2391
  }
2392
2392
  );
2393
- }), Dr = ({
2394
- itemCount: n,
2393
+ }), kr = ({
2394
+ itemCount: r,
2395
2395
  getItem: t,
2396
2396
  getItemKey: e,
2397
- getItemHeight: r,
2397
+ getItemHeight: n,
2398
2398
  viewportSize: i,
2399
2399
  overscanCount: s = 15,
2400
2400
  className: a,
2401
2401
  testId: c,
2402
2402
  onScroll: d,
2403
2403
  onRangeChange: b,
2404
- children: x,
2404
+ children: I,
2405
2405
  background: v,
2406
- initialScrollIndex: E,
2407
- initialScrollOffset: m,
2408
- callbackThrottleMs: _ = 5,
2409
- contentInsets: B,
2410
- onItemFocus: Z,
2411
- scrollBarOptions: ut,
2412
- behaviorOptions: rt,
2413
- onWheelHorizontal: nt,
2414
- contentProps: pt
2415
- }, Pt) => {
2416
- const { width: D, enableThumbDrag: O, enableTrackClick: P, enableArrowButtons: X, enableScrollToTopBottomButtons: $, renderThumbOverlay: N, tapScrollCircleOptions: lt } = ut ?? {}, { enablePointerDrag: K, pointerDragInputs: T, enableKeyboardNavigation: V = !0, wheelSpeedMultiplier: Tt, inertiaOptions: Yt, clipItemHeight: yt = !1, resetOnGetItemHeightChange: J = !1 } = rt ?? {}, F = I(null), Ct = I({
2406
+ initialScrollIndex: C,
2407
+ initialScrollOffset: p,
2408
+ initialScrollAnchor: V,
2409
+ callbackThrottleMs: z = 5,
2410
+ contentInsets: W,
2411
+ onItemFocus: at,
2412
+ scrollBarOptions: Q,
2413
+ behaviorOptions: tt,
2414
+ onWheelHorizontal: xt,
2415
+ contentProps: wt
2416
+ }, A) => {
2417
+ const { width: O, enableThumbDrag: M, enableTrackClick: U, enableArrowButtons: Z, enableScrollToTopBottomButtons: w, renderThumbOverlay: lt, tapScrollCircleOptions: j } = Q ?? {}, { enablePointerDrag: T, pointerDragInputs: q, enableKeyboardNavigation: H = !0, wheelSpeedMultiplier: Ht, inertiaOptions: Dt, clipItemHeight: et = !1, resetOnGetItemHeightChange: nt = !1 } = tt ?? {}, G = x(null), J = x({
2417
2418
  renderingStartIndex: 0,
2418
2419
  renderingEndIndex: 0,
2419
2420
  visibleStartIndex: 0,
2420
2421
  visibleEndIndex: 0,
2421
2422
  scrollPosition: 0,
2422
2423
  totalHeight: 0
2423
- }), W = I(null), At = I(!1);
2424
- q(() => {
2425
- J && (W.current = null);
2426
- }, [J, r]);
2427
- const y = Lt(() => Ke(B), [B]), [Kt] = Jt(() => {
2428
- const u = typeof E == "number" && Number.isFinite(E) ? Math.max(0, Math.trunc(E)) : 0;
2429
- return { from: Math.max(0, u - 50), to: u + 50 };
2430
- }), ae = Lt(
2424
+ }), Rt = x(V && r > 0 ? { index: rt(Math.trunc(V.index), 0, r - 1), align: "top", offset: -Math.max(0, V.offsetPx ?? 0) } : null), Lt = x(!1), Wt = x(!0);
2425
+ Y(() => {
2426
+ if (Wt.current) {
2427
+ Wt.current = !1;
2428
+ return;
2429
+ }
2430
+ nt && (Rt.current = null);
2431
+ }, [nt, n]);
2432
+ const R = Ft(() => Ze(W), [W]), [de] = re(() => {
2433
+ const u = V?.index ?? C, m = typeof u == "number" && Number.isFinite(u) ? Math.max(0, Math.trunc(u)) : 0;
2434
+ return { from: Math.max(0, m - 50), to: m + 50 };
2435
+ }), it = Ft(
2431
2436
  // 目的: Fenwick Tree のオプション設定
2432
2437
  // 依存関係: resetOnGetItemHeightChange, initialSampleRange (マウント時固定)
2433
2438
  // itemCount には依存させない (依存させると追記のたびに options 参照が変わり、計測済み高さが全消去される)。
2434
2439
  // この useMemo により sampleRange を毎レンダー新規生成しない = 参照同一性由来の破壊的 reset を防ぐ。
2435
2440
  () => ({
2436
- sampleRange: Kt,
2437
- resetOnValueFnChange: J,
2441
+ sampleRange: de,
2442
+ resetOnValueFnChange: nt,
2438
2443
  materialize: !0
2439
2444
  }),
2440
- [J, Kt]
2441
- ), A = yr(n, r, ae), [j] = Jt(() => {
2445
+ [nt, de]
2446
+ ), E = Nr(r, n, it), [Ct] = re(() => {
2442
2447
  let l = 0, u = 0;
2443
- if (typeof E == "number") {
2444
- const h = vt(E, 0, n - 1), R = vt(h - s * 2, 0, n - 1), k = vt(h + s * 2, 0, n - 1), Y = E > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: R, to: k }] } } : void 0, { cumulative: U, total: G, currentValue: Rt } = A.prefixSum(E, Y), bt = Math.max(U - Rt, 0);
2445
- l = Ie(bt, y.top), u = G ?? A.getTotal();
2446
- } else typeof m == "number" && (l = Ie(Math.max(m, 0), y.top)), u = A.getTotal();
2448
+ if (V && r > 0) {
2449
+ const m = rt(Math.trunc(V.index), 0, r - 1), D = Math.max(0, V.offsetPx ?? 0), _ = rt(m - s * 2, 0, r - 1), F = rt(m + s * 2, 0, r - 1), $ = m > 0 || D > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: _, to: F }] } } : void 0, { cumulative: K, total: yt, currentValue: pt } = E.prefixSum(m, $), ht = Math.max(K - pt + D, 0);
2450
+ l = Ie(ht, R.top), u = yt ?? E.getTotal();
2451
+ } else if (typeof C == "number") {
2452
+ const m = rt(C, 0, r - 1), D = rt(m - s * 2, 0, r - 1), _ = rt(m + s * 2, 0, r - 1), F = C > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: D, to: _ }] } } : void 0, { cumulative: $, total: K, currentValue: yt } = E.prefixSum(C, F), pt = Math.max($ - yt, 0);
2453
+ l = Ie(pt, R.top), u = K ?? E.getTotal();
2454
+ } else typeof p == "number" && (l = Ie(Math.max(p, 0), R.top)), u = E.getTotal();
2447
2455
  return { position: l, total: u };
2448
- }), [Bt, _t] = Jt(j.position), [Et, Xt] = Jt(j.total), dt = I(j.position), p = I(y.top), ft = I(d ?? void 0), mt = I(b ?? void 0), z = I(/* @__PURE__ */ new Map()), et = I(null), ct = I(null), [Ot, kt] = Jt(null), [Mt, it] = Jt(!1), ht = I(null), st = I(!1), Q = I(0), qt = I(!1), le = I(!1), Nt = I(n);
2449
- Nt.current !== n && (Nt.current = n, le.current = !0), q(() => {
2450
- ft.current = d ?? void 0, mt.current = b ?? void 0;
2456
+ }), [zt, Zt] = re(Ct.position), [$t, h] = re(Ct.total), k = x(Ct.position), gt = x(R.top), X = x(d ?? void 0), vt = x(b ?? void 0), ct = x(/* @__PURE__ */ new Map()), It = x(null), Mt = x(null), [Pt, ut] = re(null), [At, dt] = re(!1), st = x(null), _t = x(!1), Xt = x(0), Et = x(!1), ne = x(!1), jt = x(r);
2457
+ jt.current !== r && (jt.current = r, ne.current = !0), Y(() => {
2458
+ X.current = d ?? void 0, vt.current = b ?? void 0;
2451
2459
  }, [b, d]);
2452
- const $t = S(
2460
+ const Nt = S(
2453
2461
  (l) => {
2454
- if (V && l && typeof l.focus == "function")
2462
+ if (H && l && typeof l.focus == "function")
2455
2463
  try {
2456
2464
  l.focus({ preventScroll: !0 });
2457
2465
  } catch {
2458
2466
  l.focus();
2459
2467
  }
2460
2468
  },
2461
- [V]
2462
- ), Gt = S((l, { position: u, totalHeight: h }) => {
2463
- l(u, h);
2464
- }, []), Vt = je(ft, _, Gt), f = S((l, u) => {
2469
+ [H]
2470
+ ), f = S((l, { position: u, totalHeight: m }) => {
2471
+ l(u, m);
2472
+ }, []), P = Qe(X, z, f), ft = S((l, u) => {
2465
2473
  l(u);
2466
- }, []), w = je(mt, _, f), at = I(y.top);
2467
- at.current = y.top;
2468
- const gt = I(Vt);
2469
- gt.current = Vt, q(() => (At.current = !1, () => {
2470
- At.current = !0, ht.current && (clearTimeout(ht.current), ht.current = null);
2471
- }), []), q(() => {
2472
- V || (z.current.clear(), et.current = null, ct.current = null);
2473
- }, [V]);
2474
- const wt = S(
2474
+ }, []), Tt = Qe(vt, z, ft), Vt = x(R.top);
2475
+ Vt.current = R.top;
2476
+ const ie = x(P);
2477
+ ie.current = P, Y(() => (Lt.current = !1, () => {
2478
+ Lt.current = !0, st.current && (clearTimeout(st.current), st.current = null);
2479
+ }), []), Y(() => {
2480
+ H || (ct.current.clear(), It.current = null, Mt.current = null);
2481
+ }, [H]);
2482
+ const Jt = S(
2475
2483
  (l, u) => {
2476
2484
  if (!u) {
2477
- z.current.delete(l);
2485
+ ct.current.delete(l);
2478
2486
  return;
2479
2487
  }
2480
- V && (z.current.set(l, u), et.current === l && (et.current = null, ct.current = l, $t(u)));
2488
+ H && (ct.current.set(l, u), It.current === l && (It.current = null, Mt.current = l, Nt(u)));
2481
2489
  },
2482
- [V, $t]
2483
- ), Qt = 0.01, Ht = I({
2490
+ [H, Nt]
2491
+ ), Qt = 0.01, Kt = x({
2484
2492
  rafId: null,
2485
2493
  loopActive: !1,
2486
2494
  idleFrames: 0,
2487
- lastRenderedPosition: j.position
2488
- }), Ut = S(() => {
2489
- const l = Ht.current;
2495
+ lastRenderedPosition: Ct.position
2496
+ }), se = S(() => {
2497
+ const l = Kt.current;
2490
2498
  l.rafId !== null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(l.rafId), l.rafId = null, l.loopActive = !1, l.idleFrames = 0;
2491
2499
  }, []);
2492
- q(
2500
+ Y(
2493
2501
  () => () => {
2494
- Ut();
2502
+ se();
2495
2503
  },
2496
- [Ut]
2504
+ [se]
2497
2505
  );
2498
- const te = I(() => {
2499
- }), ce = S(() => {
2500
- const l = Ht.current;
2506
+ const fe = x(() => {
2507
+ }), Gt = S(() => {
2508
+ const l = Kt.current;
2501
2509
  l.rafId = null;
2502
- const u = dt.current, h = oe(u, at.current), R = A.getTotal();
2503
- if (_t((Y) => Math.abs(Y - u) < Qt ? Y : u), Math.abs(l.lastRenderedPosition - u) >= Qt ? (gt.current({ position: h, totalHeight: R }), l.lastRenderedPosition = u, l.idleFrames = 0) : l.idleFrames += 1, l.idleFrames >= 2) {
2504
- Ut();
2510
+ const u = k.current, m = ee(u, Vt.current), D = E.getTotal();
2511
+ if (Zt((F) => Math.abs(F - u) < Qt ? F : u), Math.abs(l.lastRenderedPosition - u) >= Qt ? (ie.current({ position: m, totalHeight: D }), l.lastRenderedPosition = u, l.idleFrames = 0) : l.idleFrames += 1, l.idleFrames >= 2) {
2512
+ se();
2505
2513
  return;
2506
2514
  }
2507
2515
  if (typeof requestAnimationFrame == "function") {
2508
- l.rafId = requestAnimationFrame((Y) => te.current(Y));
2516
+ l.rafId = requestAnimationFrame((F) => fe.current(F));
2509
2517
  return;
2510
2518
  }
2511
2519
  l.loopActive = !1;
2512
- }, [A, Ut]);
2513
- te.current = ce;
2514
- const ue = S(() => {
2515
- const l = Ht.current;
2520
+ }, [E, se]);
2521
+ fe.current = Gt;
2522
+ const we = S(() => {
2523
+ const l = Kt.current;
2516
2524
  if (l.idleFrames = 0, !l.loopActive) {
2517
2525
  if (l.loopActive = !0, typeof requestAnimationFrame == "function") {
2518
- l.rafId = requestAnimationFrame(ce);
2526
+ l.rafId = requestAnimationFrame(Gt);
2519
2527
  return;
2520
2528
  }
2521
2529
  l.loopActive = !1;
2522
2530
  }
2523
- }, [ce]), tt = S(
2531
+ }, [Gt]), mt = S(
2524
2532
  (l, u) => {
2525
- const h = u?.immediate ?? !1, R = oe(l, y.top);
2526
- if (dt.current = l, h) {
2527
- Ht.current.lastRenderedPosition = l, Ht.current.idleFrames = 0, _t(l), Vt({ position: R, totalHeight: A.getTotal() });
2533
+ const m = u?.immediate ?? !1, D = ee(l, R.top);
2534
+ if (k.current = l, m) {
2535
+ Kt.current.lastRenderedPosition = l, Kt.current.idleFrames = 0, Zt(l), P({ position: D, totalHeight: E.getTotal() });
2528
2536
  return;
2529
2537
  }
2530
- ue();
2538
+ we();
2531
2539
  },
2532
- [ue, A, y.top, Vt]
2533
- ), ee = S((l) => {
2534
- const u = F.current;
2540
+ [we, E, R.top, P]
2541
+ ), me = S((l) => {
2542
+ const u = G.current;
2535
2543
  if (!u)
2536
2544
  return l;
2537
- const h = u.getScrollPosition();
2538
- Q.current += 1;
2539
- const R = u.scrollTo(l);
2540
- return R === h && (Q.current = Math.max(0, Q.current - 1)), Math.abs(R - l) > 0.5 && (qt.current = !0), R;
2541
- }, []), Se = I(!1);
2542
- q(() => {
2543
- if (!Se.current)
2544
- if (Se.current = !0, typeof m == "number") {
2545
- const l = Ie(Math.max(m, 0), y.top), u = Math.abs(l - dt.current) > 0.5;
2546
- tt(l, { immediate: !0 }), u && F.current?.scrollTo(l);
2545
+ const m = u.getScrollPosition();
2546
+ Xt.current += 1;
2547
+ const D = u.scrollTo(l);
2548
+ return D === m && (Xt.current = Math.max(0, Xt.current - 1)), Math.abs(D - l) > 0.5 && (Et.current = !0), D;
2549
+ }, []), Ce = x(!1);
2550
+ Y(() => {
2551
+ if (!Ce.current)
2552
+ if (Ce.current = !0, V == null && typeof C != "number" && typeof p == "number") {
2553
+ const l = Ie(Math.max(p, 0), R.top), u = Math.abs(l - k.current) > 0.5;
2554
+ mt(l, { immediate: !0 }), u && G.current?.scrollTo(l);
2547
2555
  } else
2548
- tt(dt.current, { immediate: !0 });
2549
- }, [m, y.top, tt]), q(() => {
2550
- const l = A.getTotal();
2551
- if (Et !== l) {
2552
- Xt(l);
2556
+ mt(k.current, { immediate: !0 });
2557
+ }, [V, C, p, R.top, mt]), Y(() => {
2558
+ const l = E.getTotal();
2559
+ if ($t !== l) {
2560
+ h(l);
2553
2561
  return;
2554
2562
  }
2555
- if (qt.current) {
2556
- qt.current = !1;
2557
- const u = F.current;
2558
- if (u && Math.abs(u.getScrollPosition() - dt.current) > 0.5) {
2559
- const h = ee(dt.current);
2560
- qt.current = !1, tt(h, { immediate: !0 });
2563
+ if (Et.current) {
2564
+ Et.current = !1;
2565
+ const u = G.current;
2566
+ if (u && Math.abs(u.getScrollPosition() - k.current) > 0.5) {
2567
+ const m = me(k.current);
2568
+ Et.current = !1, mt(m, { immediate: !0 });
2561
2569
  }
2562
2570
  }
2563
- }, [A, Et, n, ee, tt]), q(() => {
2564
- if (W.current !== null) {
2565
- const { index: l, align: u, offset: h } = W.current, R = It(l, n), { cumulative: k, currentValue: Y } = A.prefixSum(R, { materializeOption: { materialize: !1 } });
2566
- if (k !== void 0 && Y !== void 0) {
2567
- const U = Math.max(k - Y, 0);
2568
- let G = U;
2569
- u === "bottom" ? G = k - i : u === "center" && (G = U + Y / 2 - i / 2), h && (G -= h), G = Math.max(0, G);
2570
- const Rt = Math.max(0, Et + y.top + y.bottom - i), bt = Math.min(Ie(G, y.top), Rt);
2571
- Math.abs(bt - dt.current) > 1 && (C.debug("[VirtualScroll] Drift correction", {
2572
- from: dt.current,
2573
- to: bt,
2574
- targetIndex: R
2575
- }), Q.current === 0 && (Q.current += 1), F.current?.scrollTo(bt), tt(bt, { immediate: !0 }));
2571
+ }, [E, $t, r, me, mt]), Y(() => {
2572
+ if (Rt.current !== null) {
2573
+ const { index: l, align: u, offset: m } = Rt.current, D = St(l, r), { cumulative: _, currentValue: F } = E.prefixSum(D, { materializeOption: { materialize: !1 } });
2574
+ if (_ !== void 0 && F !== void 0) {
2575
+ const $ = Math.max(_ - F, 0);
2576
+ let K = $;
2577
+ u === "bottom" ? K = _ - i : u === "center" && (K = $ + F / 2 - i / 2), m && (K -= m), K = Math.max(0, K);
2578
+ const yt = Math.max(0, $t + R.top + R.bottom - i), pt = Math.min(Ie(K, R.top), yt);
2579
+ Math.abs(pt - k.current) > 1 && (N.debug("[VirtualScroll] Drift correction", {
2580
+ from: k.current,
2581
+ to: pt,
2582
+ targetIndex: D
2583
+ }), Xt.current === 0 && (Xt.current += 1), G.current?.scrollTo(pt), mt(pt, { immediate: !0 }));
2576
2584
  }
2577
2585
  }
2578
- le.current = !1;
2579
- }, [Et, A, n, y.top, tt, i, y.bottom]), q(() => {
2580
- const l = p.current;
2581
- if (l === y.top) return;
2582
- const u = oe(dt.current, l), h = Ie(u, y.top);
2583
- p.current = y.top, dt.current = h, F.current?.scrollTo(h), tt(h, { immediate: !0 });
2584
- }, [y.top, tt]);
2585
- const we = S(
2586
+ ne.current = !1;
2587
+ }, [$t, E, r, R.top, mt, i, R.bottom]), Y(() => {
2588
+ const l = gt.current;
2589
+ if (l === R.top) return;
2590
+ const u = ee(k.current, l), m = Ie(u, R.top);
2591
+ gt.current = R.top, k.current = m, G.current?.scrollTo(m), mt(m, { immediate: !0 });
2592
+ }, [R.top, mt]);
2593
+ const ve = S(
2586
2594
  (l, u) => {
2587
- if (n === 0)
2595
+ if (r === 0)
2588
2596
  return;
2589
- const h = It(l, n), R = A.get(h), k = u - R, Y = A.update(h, u);
2590
- Y !== void 0 && Xt(Y), C.debug("[VirtualScroll] Updated item size manually", { index: h, size: u, total: Y });
2591
- let U = W.current ? W.current.index : null;
2592
- if (U === null) {
2593
- const G = dt.current, Rt = Ke(B).top, bt = oe(G, Rt), { index: xt, cumulative: Ft } = A.findIndexAtOrAfter(bt, { materializeOption: { materialize: !1 } });
2594
- U = Ft !== void 0 && Ft === bt ? xt + 1 : xt;
2597
+ const m = St(l, r), D = E.get(m), _ = u - D, F = E.update(m, u);
2598
+ F !== void 0 && h(F), N.debug("[VirtualScroll] Updated item size manually", { index: m, size: u, total: F });
2599
+ let $ = Rt.current ? Rt.current.index : null;
2600
+ if ($ === null) {
2601
+ const K = k.current, yt = Ze(W).top, pt = ee(K, yt), { index: ht, cumulative: Bt } = E.findIndexAtOrAfter(pt, { materializeOption: { materialize: !1 } });
2602
+ $ = Bt !== void 0 && Bt === pt ? ht + 1 : ht;
2595
2603
  }
2596
- if (U !== -1 && h < U && k !== 0) {
2597
- const G = dt.current, Rt = G + k;
2598
- ee(Rt), tt(Rt, { immediate: !0 }), C.debug("[VirtualScroll] Adjusted scroll for layout shift (manual update)", { from: G, to: Rt, causedByIndex: h, delta: k, activeVisibleStartIndex: U });
2604
+ if ($ !== -1 && m < $ && _ !== 0) {
2605
+ const K = k.current, yt = K + _;
2606
+ me(yt), mt(yt, { immediate: !0 }), N.debug("[VirtualScroll] Adjusted scroll for layout shift (manual update)", { from: K, to: yt, causedByIndex: m, delta: _, activeVisibleStartIndex: $ });
2599
2607
  }
2600
2608
  },
2601
- [A, n, ee, tt, B]
2602
- ), Wt = S(
2609
+ [E, r, me, mt, W]
2610
+ ), Ut = S(
2603
2611
  (l, u) => {
2604
- if (!F.current || n === 0)
2612
+ if (!G.current || r === 0)
2605
2613
  return;
2606
- const h = It(l, n), R = It(h - s * 2, n), k = It(h + s * 2, n), { cumulative: Y, total: U, currentValue: G } = A.prefixSum(h, { materializeOption: { materialize: !0, ranges: [{ from: R, to: k }] } });
2607
- if (C.debug("[VirtualScroll] Scrolling to index:", h, "ItemBottom:", Y, "Total height:", U, "ItemHeight:", G, "safeIndexFrom:", R, "safeIndexTo:", k), !U)
2614
+ const m = St(l, r), D = St(m - s * 2, r), _ = St(m + s * 2, r), { cumulative: F, total: $, currentValue: K } = E.prefixSum(m, { materializeOption: { materialize: !0, ranges: [{ from: D, to: _ }] } });
2615
+ if (N.debug("[VirtualScroll] Scrolling to index:", m, "ItemBottom:", F, "Total height:", $, "ItemHeight:", K, "safeIndexFrom:", D, "safeIndexTo:", _), !$)
2608
2616
  return;
2609
- const Rt = Math.max(Y - G, 0);
2610
- let bt = Rt;
2611
- u?.align === "bottom" ? bt = Y - i : u?.align === "center" && (bt = Rt + G / 2 - i / 2), u?.offset && (bt -= u.offset), bt = Math.max(0, bt);
2612
- const xt = Ie(bt, y.top), Ft = F.current?.getContentSize() ?? U + y.top + y.bottom, Dt = Math.max(0, Ft - i), zt = Math.min(xt, Dt);
2613
- W.current = {
2614
- index: h,
2617
+ const yt = Math.max(F - K, 0);
2618
+ let pt = yt;
2619
+ u?.align === "bottom" ? pt = F - i : u?.align === "center" && (pt = yt + K / 2 - i / 2), u?.offset && (pt -= u.offset), pt = Math.max(0, pt);
2620
+ const ht = Ie(pt, R.top), Bt = G.current?.getContentSize() ?? $ + R.top + R.bottom, kt = Math.max(0, Bt - i), qt = Math.min(ht, kt);
2621
+ Rt.current = {
2622
+ index: m,
2615
2623
  align: u?.align,
2616
2624
  offset: u?.offset
2617
2625
  };
2618
- const Pe = F.current?.getScrollPosition() ?? -1, Le = Math.abs(Pe - zt) > 0.5;
2619
- st.current = !1, Q.current = 0, Le && (st.current = !0, Q.current += 1, F.current?.scrollTo(zt)), Xt(U), tt(zt, { immediate: !0 }), C.debug("[VirtualScroll] Setting scroll position to:", zt, { original: xt, max: Dt });
2626
+ const Re = G.current?.getScrollPosition() ?? -1, Fe = Math.abs(Re - qt) > 0.5;
2627
+ _t.current = !1, Xt.current = 0, Fe && (_t.current = !0, Xt.current += 1, G.current?.scrollTo(qt)), h($), mt(qt, { immediate: !0 }), N.debug("[VirtualScroll] Setting scroll position to:", qt, { original: ht, max: kt });
2620
2628
  },
2621
- [A, s, n, y.top, y.bottom, i, tt]
2622
- ), ge = S(
2629
+ [E, s, r, R.top, R.bottom, i, mt]
2630
+ ), Ve = x(V && r === 0 ? V : null);
2631
+ Y(() => {
2632
+ const l = Ve.current;
2633
+ !l || r === 0 || (Ve.current = null, Ut(rt(Math.trunc(l.index), 0, r - 1), { align: "top", offset: -Math.max(0, l.offsetPx ?? 0) }));
2634
+ }, [r, Ut]);
2635
+ const De = S(
2623
2636
  (l) => {
2624
- if (!F.current || n === 0)
2637
+ if (!G.current || r === 0)
2625
2638
  return;
2626
- const u = A.getTotal(), h = vt(Math.floor(l), 0, u), { index: R, cumulative: k, currentValue: Y } = A.findIndexAtOrAfter(h, { materializeOption: { materialize: !1 } }), G = (k ?? 0) - (Y ?? 0) - h;
2627
- Wt(R, { offset: G });
2639
+ const u = E.getTotal(), m = rt(Math.floor(l), 0, u), { index: D, cumulative: _, currentValue: F } = E.findIndexAtOrAfter(m, { materializeOption: { materialize: !1 } }), K = (_ ?? 0) - (F ?? 0) - m;
2640
+ Ut(D, { offset: K });
2628
2641
  },
2629
- [A, n, Wt]
2630
- ), Re = S(
2642
+ [E, r, Ut]
2643
+ ), be = S(() => {
2644
+ if (r === 0)
2645
+ return null;
2646
+ const l = ee(k.current, R.top), { index: u, cumulative: m, currentValue: D } = E.findIndexAtOrAfter(l, { materializeOption: { materialize: !1 } });
2647
+ if (u === -1)
2648
+ return { index: r - 1, offsetPx: 0 };
2649
+ if (m === l)
2650
+ return { index: rt(u + 1, 0, r - 1), offsetPx: 0 };
2651
+ const _ = (m ?? 0) - (D ?? 0);
2652
+ return { index: u, offsetPx: Math.max(0, l - _) };
2653
+ }, [E, r, R.top]), Ae = S(
2631
2654
  (l) => {
2632
- const u = oe(dt.current, y.top), h = typeof l == "function" ? l(u) : l;
2633
- ge(h);
2634
- const R = F.current?.getScrollPosition(), k = typeof R == "number" ? R : dt.current;
2635
- return tt(k), k;
2655
+ const u = ee(k.current, R.top), m = typeof l == "function" ? l(u) : l;
2656
+ De(m);
2657
+ const D = G.current?.getScrollPosition(), _ = typeof D == "number" ? D : k.current;
2658
+ return mt(_), _;
2636
2659
  },
2637
- [y.top, ge, tt]
2638
- ), De = S(
2660
+ [R.top, De, mt]
2661
+ ), ke = S(
2639
2662
  (l, u) => {
2640
- C.debug("[VirtualScroll] Scroll position changed:", l);
2641
- const h = st.current;
2642
- h && (st.current = !1);
2643
- const R = Q.current > 0;
2644
- if (R && (Q.current = 0), h || R || le.current || (W.current = null), tt(l), $) {
2645
- if (h || R)
2663
+ N.debug("[VirtualScroll] Scroll position changed:", l);
2664
+ const m = _t.current;
2665
+ m && (_t.current = !1);
2666
+ const D = Xt.current > 0;
2667
+ if (D && (Xt.current = 0), m || D || ne.current || (Rt.current = null), mt(l), w) {
2668
+ if (m || D)
2646
2669
  return;
2647
- const k = l - u;
2648
- if (C.debug("[VirtualScroll] Scroll diff:", k, "New:", l, "Prev:", u), Math.abs(k) > 1) {
2649
- const Y = k > 0 ? "down" : "up";
2650
- kt(Y), it(!0), C.debug("[VirtualScroll] Showing scroll buttons. Direction:", Y), ht.current && clearTimeout(ht.current), ht.current = setTimeout(() => {
2651
- it(!1), C.debug("[VirtualScroll] Hiding scroll buttons");
2670
+ const _ = l - u;
2671
+ if (N.debug("[VirtualScroll] Scroll diff:", _, "New:", l, "Prev:", u), Math.abs(_) > 1) {
2672
+ const F = _ > 0 ? "down" : "up";
2673
+ ut(F), dt(!0), N.debug("[VirtualScroll] Showing scroll buttons. Direction:", F), st.current && clearTimeout(st.current), st.current = setTimeout(() => {
2674
+ dt(!1), N.debug("[VirtualScroll] Hiding scroll buttons");
2652
2675
  }, 2e3);
2653
2676
  }
2654
2677
  }
2655
2678
  },
2656
- [tt, $]
2657
- ), re = Lt(() => oe(Bt, y.top), [y.top, Bt]), jt = Lt(() => {
2658
- const l = A.getTotal(), u = Vr(re, i, s, n, r, A, l);
2659
- return C.debug("[VirtualScroll] Calculated rendering range:", () => ({
2679
+ [mt, w]
2680
+ ), oe = Ft(() => ee(zt, R.top), [R.top, zt]), pe = Ft(() => {
2681
+ const l = E.getTotal(), u = _r(oe, i, s, r, n, E, l);
2682
+ return N.debug("[VirtualScroll] Calculated rendering range:", () => ({
2660
2683
  ...u,
2661
- scrollPosition: re,
2684
+ scrollPosition: oe,
2662
2685
  renderingContentSize: l,
2663
2686
  overscanCount: s,
2664
2687
  viewportSize: i
2665
2688
  })), u;
2666
- }, [re, i, s, n, r, A]), { renderingStartIndex: ne, renderingEndIndex: ie, visibleStartIndex: de, visibleEndIndex: be } = jt, se = S(
2689
+ }, [oe, i, s, r, n, E]), { renderingStartIndex: ae, renderingEndIndex: le, visibleStartIndex: ce, visibleEndIndex: xe } = pe, o = S(
2667
2690
  (l, u) => {
2668
- if (!V || n === 0)
2691
+ if (!H || r === 0)
2669
2692
  return;
2670
- const h = It(l, n);
2693
+ const m = St(l, r);
2671
2694
  if (!(u?.ensureVisible ?? !0)) {
2672
- const Dt = z.current.get(h);
2673
- Dt && (et.current = null, ct.current = h, $t(Dt));
2695
+ const kt = ct.current.get(m);
2696
+ kt && (It.current = null, Mt.current = m, Nt(kt));
2674
2697
  return;
2675
2698
  }
2676
- const k = A.prefixSum(h, { materializeOption: { materialize: !1 } }), Y = k.currentValue, U = Math.max(k.cumulative - Y, 0), G = U + Y, Rt = oe(dt.current, y.top), bt = Rt + i;
2677
- if (U < Rt || G > bt) {
2678
- Wt(h);
2679
- const Dt = z.current.get(h);
2680
- Dt ? (et.current = null, ct.current = h, $t(Dt)) : et.current = h;
2699
+ const _ = E.prefixSum(m, { materializeOption: { materialize: !1 } }), F = _.currentValue, $ = Math.max(_.cumulative - F, 0), K = $ + F, yt = ee(k.current, R.top), pt = yt + i;
2700
+ if ($ < yt || K > pt) {
2701
+ Ut(m);
2702
+ const kt = ct.current.get(m);
2703
+ kt ? (It.current = null, Mt.current = m, Nt(kt)) : It.current = m;
2681
2704
  return;
2682
2705
  }
2683
- const Ft = z.current.get(h);
2684
- if (Ft) {
2685
- et.current = null, ct.current = h, $t(Ft);
2706
+ const Bt = ct.current.get(m);
2707
+ if (Bt) {
2708
+ It.current = null, Mt.current = m, Nt(Bt);
2686
2709
  return;
2687
2710
  }
2688
- et.current = h;
2711
+ It.current = m;
2689
2712
  },
2690
- [V, n, A, y.top, Wt, $t, i]
2691
- ), Ce = S(
2713
+ [H, r, E, R.top, Ut, Nt, i]
2714
+ ), g = S(
2692
2715
  (l, u) => {
2693
- if (!V || l.defaultPrevented || l.altKey || l.metaKey || l.ctrlKey)
2716
+ if (!H || l.defaultPrevented || l.altKey || l.metaKey || l.ctrlKey)
2694
2717
  return;
2695
- const h = l.target;
2696
- if (h) {
2697
- const R = h.tagName;
2698
- if (R === "INPUT" || R === "TEXTAREA" || R === "SELECT" || h.isContentEditable)
2718
+ const m = l.target;
2719
+ if (m) {
2720
+ const D = m.tagName;
2721
+ if (D === "INPUT" || D === "TEXTAREA" || D === "SELECT" || m.isContentEditable)
2699
2722
  return;
2700
2723
  }
2701
2724
  if (l.key === "ArrowDown") {
2702
- u < n - 1 && (l.preventDefault(), se(u + 1));
2725
+ u < r - 1 && (l.preventDefault(), o(u + 1));
2703
2726
  return;
2704
2727
  }
2705
2728
  if (l.key === "ArrowUp") {
2706
- u > 0 && (l.preventDefault(), se(u - 1));
2729
+ u > 0 && (l.preventDefault(), o(u - 1));
2707
2730
  return;
2708
2731
  }
2709
2732
  if (l.key === "PageDown") {
2710
- if (u < n - 1) {
2733
+ if (u < r - 1) {
2711
2734
  l.preventDefault();
2712
- const { visibleStartIndex: R, visibleEndIndex: k } = Ct.current, Y = Math.max(k - R + 1, 1), U = Math.max(Y, 1), G = It(Math.min(u + U, n - 1), n);
2713
- se(G);
2735
+ const { visibleStartIndex: D, visibleEndIndex: _ } = J.current, F = Math.max(_ - D + 1, 1), $ = Math.max(F, 1), K = St(Math.min(u + $, r - 1), r);
2736
+ o(K);
2714
2737
  }
2715
2738
  return;
2716
2739
  }
2717
2740
  if (l.key === "PageUp" && u > 0) {
2718
2741
  l.preventDefault();
2719
- const { visibleStartIndex: R, visibleEndIndex: k } = Ct.current, Y = Math.max(k - R + 1, 1), U = Math.max(Y, 1), G = It(u - U, n);
2720
- se(G);
2742
+ const { visibleStartIndex: D, visibleEndIndex: _ } = J.current, F = Math.max(_ - D + 1, 1), $ = Math.max(F, 1), K = St(u - $, r);
2743
+ o(K);
2721
2744
  }
2722
2745
  },
2723
- [V, n, se]
2724
- ), ve = S(
2746
+ [H, r, o]
2747
+ ), y = S(
2725
2748
  (l) => {
2726
- if (!V)
2749
+ if (!H)
2727
2750
  return;
2728
- const u = It(l, n);
2729
- et.current = null, ct.current = u, Z?.(u);
2751
+ const u = St(l, r);
2752
+ It.current = null, Mt.current = u, at?.(u);
2730
2753
  },
2731
- [V, n, Z]
2754
+ [H, r, at]
2732
2755
  );
2733
- q(() => {
2734
- const l = F.current?.getScrollPosition() ?? 0, u = dt.current, h = oe(u, y.top);
2735
- C.debug("[VirtualScroll] Range change effect triggered", () => ({
2736
- renderingStartIndex: ne,
2737
- renderingEndIndex: ie,
2738
- visibleStartIndex: de,
2739
- visibleEndIndex: be,
2740
- scrollPositionState: Bt,
2756
+ Y(() => {
2757
+ const l = G.current?.getScrollPosition() ?? 0, u = k.current, m = ee(u, R.top);
2758
+ N.debug("[VirtualScroll] Range change effect triggered", () => ({
2759
+ renderingStartIndex: ae,
2760
+ renderingEndIndex: le,
2761
+ visibleStartIndex: ce,
2762
+ visibleEndIndex: xe,
2763
+ scrollPositionState: zt,
2741
2764
  paneScrollPosition: u,
2742
- logicalScrollPosition: h,
2743
- contentSize: Et,
2765
+ logicalScrollPosition: m,
2766
+ contentSize: $t,
2744
2767
  scrollPaneScrollPosition: l
2745
- })), w({
2746
- renderingStartIndex: ne,
2747
- renderingEndIndex: ie,
2748
- visibleStartIndex: de,
2749
- visibleEndIndex: be,
2750
- scrollPosition: h,
2751
- totalHeight: Et
2768
+ })), Tt({
2769
+ renderingStartIndex: ae,
2770
+ renderingEndIndex: le,
2771
+ visibleStartIndex: ce,
2772
+ visibleEndIndex: xe,
2773
+ scrollPosition: m,
2774
+ totalHeight: $t
2752
2775
  });
2753
- }, [Et, ie, ne, y.top, w, Bt, be, de]);
2754
- const Ee = S(() => $ ? /* @__PURE__ */ ot("div", { className: "aqvs-scroll-to-edge-overlay", "data-visible": Mt && Ot !== null, children: Ot === "up" ? /* @__PURE__ */ ot("div", { className: "aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-top", children: /* @__PURE__ */ ot(
2776
+ }, [$t, le, ae, R.top, Tt, zt, xe, ce]);
2777
+ const L = S(() => w ? /* @__PURE__ */ ot("div", { className: "aqvs-scroll-to-edge-overlay", "data-visible": At && Pt !== null, children: Pt === "up" ? /* @__PURE__ */ ot("div", { className: "aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-top", children: /* @__PURE__ */ ot(
2755
2778
  "button",
2756
2779
  {
2757
2780
  type: "button",
2758
2781
  className: "aqvs-scroll-to-edge-button",
2759
- onClick: (h) => {
2760
- h.stopPropagation(), st.current = !0, Wt(0), it(!1);
2782
+ onClick: (m) => {
2783
+ m.stopPropagation(), _t.current = !0, Ut(0), dt(!1);
2761
2784
  },
2762
2785
  children: "Top"
2763
2786
  }
@@ -2766,199 +2789,200 @@ const Cr = 1e4, Fr = () => {
2766
2789
  {
2767
2790
  type: "button",
2768
2791
  className: "aqvs-scroll-to-edge-button",
2769
- onClick: (h) => {
2770
- h.stopPropagation(), st.current = !0, Wt(n - 1), it(!1);
2792
+ onClick: (m) => {
2793
+ m.stopPropagation(), _t.current = !0, Ut(r - 1), dt(!1);
2771
2794
  },
2772
2795
  children: "Bottom"
2773
2796
  }
2774
- ) }) }) : null, [$, Mt, Ot, Wt, n]), o = I(0), { visibleItems: g, renderAnchor: M } = Lt(() => {
2775
- if (n === 0)
2797
+ ) }) }) : null, [w, At, Pt, Ut, r]), B = x(0), { visibleItems: bt, renderAnchor: Ot } = Ft(() => {
2798
+ if (r === 0)
2776
2799
  return {
2777
2800
  visibleItems: /* @__PURE__ */ ot("div", { className: "aqvs-no-items-container", children: /* @__PURE__ */ ot("div", { className: "aqvs-no-items-text", children: "No items" }) }),
2778
2801
  renderAnchor: 0
2779
2802
  };
2780
- const l = It(ne, n), u = It(ie, n), { cumulative: h, currentValue: R } = A.prefixSum(l, { materializeOption: { materialize: !1 } }), k = h - R;
2781
- Number.isFinite(k) && Math.abs(k - o.current) > Er && (o.current = k);
2782
- const Y = o.current, U = [], G = [];
2783
- let Rt = 0, bt = k;
2784
- for (let xt = l; xt <= u; xt++) {
2785
- if (G.length >= We) {
2786
- C.warn("[VirtualScroll] Rendered item count reached the safety cap; truncating render window.", { cap: We, safeRenderingStartIndex: l, safeRenderingEndIndex: u });
2803
+ const l = St(ae, r), u = St(le, r), { cumulative: m, currentValue: D } = E.prefixSum(l, { materializeOption: { materialize: !1 } }), _ = m - D;
2804
+ Number.isFinite(_) && Math.abs(_ - B.current) > Ar && (B.current = _);
2805
+ const F = B.current, $ = [], K = [];
2806
+ let yt = 0, pt = _;
2807
+ for (let ht = l; ht <= u; ht++) {
2808
+ if (K.length >= Je) {
2809
+ N.warn("[VirtualScroll] Rendered item count reached the safety cap; truncating render window.", { cap: Je, safeRenderingStartIndex: l, safeRenderingEndIndex: u });
2787
2810
  break;
2788
2811
  }
2789
- const Ft = r(xt), Dt = A.get(xt), zt = Ft - Dt;
2790
- zt !== 0 && U.push({ index: xt, value: Ft });
2791
- const Pe = bt + Rt, Le = e ? e(xt) : xt;
2792
- G.push(
2812
+ const Bt = n(ht), kt = E.get(ht), qt = Bt - kt;
2813
+ qt !== 0 && $.push({ index: ht, value: Bt });
2814
+ const Re = pt + yt, Fe = e ? e(ht) : ht;
2815
+ K.push(
2793
2816
  /* @__PURE__ */ ot(
2794
- Ar,
2817
+ Or,
2795
2818
  {
2796
- index: xt,
2797
- top: Pe - Y,
2798
- height: Ft,
2799
- item: t(xt),
2800
- clipItemHeight: yt,
2801
- enableKeyboardNavigation: V,
2802
- onKeyDown: Ce,
2803
- onFocus: ve,
2804
- registerItemRef: wt,
2805
- children: x
2819
+ index: ht,
2820
+ top: Re - F,
2821
+ height: Bt,
2822
+ item: t(ht),
2823
+ clipItemHeight: et,
2824
+ enableKeyboardNavigation: H,
2825
+ onKeyDown: g,
2826
+ onFocus: y,
2827
+ registerItemRef: Jt,
2828
+ children: I
2806
2829
  },
2807
- Le
2830
+ Fe
2808
2831
  )
2809
- ), Rt += zt, bt += Dt;
2832
+ ), yt += qt, pt += kt;
2810
2833
  }
2811
- return U.length > 0 && Promise.resolve().then(() => {
2812
- if (At.current)
2834
+ return $.length > 0 && Promise.resolve().then(() => {
2835
+ if (Lt.current)
2813
2836
  return;
2814
- let xt = 0;
2815
- for (const zt of U)
2816
- if (zt.index < de) {
2817
- const Pe = A.get(zt.index);
2818
- xt += zt.value - Pe;
2837
+ let ht = 0;
2838
+ for (const qt of $)
2839
+ if (qt.index < ce) {
2840
+ const Re = E.get(qt.index);
2841
+ ht += qt.value - Re;
2819
2842
  }
2820
- const Ft = A.updates(U);
2821
- if (At.current || typeof Ft != "number")
2843
+ const Bt = E.updates($);
2844
+ if (Lt.current || typeof Bt != "number")
2822
2845
  return;
2823
- Xt(Ft), C.debug("[VirtualScroll] Updated heights for items", U, "New total height:", Ft);
2824
- const Dt = F.current?.getScrollPosition() ?? dt.current;
2825
- if (xt !== 0) {
2826
- const zt = Dt + xt;
2827
- ee(zt), tt(zt, { immediate: !0 }), C.debug("[VirtualScroll] Adjusted scroll for layout shift (auto update)", { from: Dt, to: zt, shiftAmount: xt });
2828
- } else Dt !== dt.current && tt(Dt);
2829
- }), { visibleItems: G, renderAnchor: Y };
2846
+ h(Bt), N.debug("[VirtualScroll] Updated heights for items", $, "New total height:", Bt);
2847
+ const kt = G.current?.getScrollPosition() ?? k.current;
2848
+ if (ht !== 0) {
2849
+ const qt = kt + ht;
2850
+ me(qt), mt(qt, { immediate: !0 }), N.debug("[VirtualScroll] Adjusted scroll for layout shift (auto update)", { from: kt, to: qt, shiftAmount: ht });
2851
+ } else kt !== k.current && mt(kt);
2852
+ }), { visibleItems: K, renderAnchor: F };
2830
2853
  }, [
2831
- x,
2832
- yt,
2833
- Et,
2834
- V,
2835
- n,
2836
- A,
2854
+ I,
2855
+ et,
2856
+ $t,
2857
+ H,
2858
+ r,
2859
+ E,
2837
2860
  t,
2838
2861
  e,
2839
- r,
2840
- ve,
2841
- Ce,
2842
- ee,
2843
- wt,
2844
- ie,
2845
- ne,
2846
- tt,
2847
- de
2848
- ]), L = S(
2862
+ n,
2863
+ y,
2864
+ g,
2865
+ me,
2866
+ Jt,
2867
+ le,
2868
+ ae,
2869
+ mt,
2870
+ ce
2871
+ ]), Yt = S(
2849
2872
  (l) => {
2850
- const u = (_ ?? 0) > 0, h = Math.abs(l - Bt), R = u && h > 0.5 ? Bt : l, k = oe(R, y.top);
2851
- if (C.debug("[VirtualScroll] Rendering visible items", () => ({
2873
+ const u = (z ?? 0) > 0, m = Math.abs(l - zt), D = u && m > 0.5 ? zt : l, _ = ee(D, R.top);
2874
+ if (N.debug("[VirtualScroll] Rendering visible items", () => ({
2852
2875
  currentScrollPosition: l,
2853
- effectiveScrollPosition: k,
2854
- renderingStartIndex: ne,
2855
- renderingEndIndex: ie,
2856
- itemCount: n,
2876
+ effectiveScrollPosition: _,
2877
+ renderingStartIndex: ae,
2878
+ renderingEndIndex: le,
2879
+ itemCount: r,
2857
2880
  viewportSize: i,
2858
- callbackThrottleMs: _,
2859
- diff: h,
2860
- rawEffectiveScrollPosition: R
2861
- })), n === 0)
2862
- return g;
2863
- const Y = y.top + M - R, U = y.bottom > 0 ? /* @__PURE__ */ ot(
2881
+ callbackThrottleMs: z,
2882
+ diff: m,
2883
+ rawEffectiveScrollPosition: D
2884
+ })), r === 0)
2885
+ return bt;
2886
+ const F = R.top + Ot - D, $ = R.bottom > 0 ? /* @__PURE__ */ ot(
2864
2887
  "div",
2865
2888
  {
2866
2889
  className: "aqvs-bottom-inset",
2867
2890
  style: {
2868
2891
  // ラッパー座標での bottom インセット位置 = コンテンツ総高さ (最終行の下端) - アンカー。
2869
- top: A.getTotal() - M,
2870
- height: y.bottom
2892
+ top: E.getTotal() - Ot,
2893
+ height: R.bottom
2871
2894
  }
2872
2895
  },
2873
2896
  "virtualscroll-bottom-inset"
2874
2897
  ) : null;
2875
- return C.debug("[VirtualScroll] Rendering items", () => ({
2876
- containerTop: Y,
2877
- logicalScrollPosition: re,
2878
- resolvedInsets: y,
2879
- effectiveScrollPosition: k
2880
- })), /* @__PURE__ */ he("div", { className: "aqvs-items-wrapper", style: { top: 0, transform: `translateY(${Y}px)`, willChange: "transform" }, children: [
2881
- g,
2882
- U
2898
+ return N.debug("[VirtualScroll] Rendering items", () => ({
2899
+ containerTop: F,
2900
+ logicalScrollPosition: oe,
2901
+ resolvedInsets: R,
2902
+ effectiveScrollPosition: _
2903
+ })), /* @__PURE__ */ Se("div", { className: "aqvs-items-wrapper", style: { top: 0, transform: `translateY(${F}px)`, willChange: "transform" }, children: [
2904
+ bt,
2905
+ $
2883
2906
  ] });
2884
2907
  },
2885
- [_, n, A, re, M, ie, ne, y, Bt, i, g]
2886
- ), H = Lt(
2908
+ [z, r, E, oe, Ot, le, ae, R, zt, i, bt]
2909
+ ), Me = Ft(
2887
2910
  () => ({
2888
- renderingStartIndex: jt.renderingStartIndex,
2889
- renderingEndIndex: jt.renderingEndIndex,
2890
- visibleStartIndex: jt.visibleStartIndex,
2891
- visibleEndIndex: jt.visibleEndIndex,
2892
- scrollPosition: re,
2893
- totalHeight: A.getTotal()
2911
+ renderingStartIndex: pe.renderingStartIndex,
2912
+ renderingEndIndex: pe.renderingEndIndex,
2913
+ visibleStartIndex: pe.visibleStartIndex,
2914
+ visibleEndIndex: pe.visibleEndIndex,
2915
+ scrollPosition: oe,
2916
+ totalHeight: E.getTotal()
2894
2917
  // contentSize (State) ではなく最新値を反映
2895
2918
  }),
2896
2919
  // contentSize を依存に含めることで、updateItemSize/updates 等で木の総高さが変わった際に
2897
2920
  // (fenwickTree は安定参照のため getTotal() の変化だけでは再計算されない) 総高さを再取得する。
2898
- [jt, re, A, Et]
2921
+ [pe, oe, E, $t]
2899
2922
  );
2900
- q(() => {
2901
- Ct.current = H;
2902
- }, [H]), qe(
2903
- Pt,
2923
+ Y(() => {
2924
+ J.current = Me;
2925
+ }, [Me]), Ue(
2926
+ A,
2904
2927
  () => ({
2905
- getScrollPosition: () => F.current?.getScrollPosition() ?? -1,
2906
- getContentSize: () => F.current?.getContentSize() ?? -1,
2907
- getViewportSize: () => F.current?.getViewportSize() ?? -1,
2908
- scrollTo: Re,
2909
- scrollToIndex: Wt,
2910
- getFenwickTreeTotalHeight: () => A.getTotal(),
2911
- getFenwickSize: () => A.getSize(),
2912
- focusItemAtIndex: se,
2913
- getRange: () => Ct.current,
2914
- updateItemSize: we
2928
+ getScrollPosition: () => G.current?.getScrollPosition() ?? -1,
2929
+ getContentSize: () => G.current?.getContentSize() ?? -1,
2930
+ getViewportSize: () => G.current?.getViewportSize() ?? -1,
2931
+ scrollTo: Ae,
2932
+ scrollToIndex: Ut,
2933
+ getFenwickTreeTotalHeight: () => E.getTotal(),
2934
+ getFenwickSize: () => E.getSize(),
2935
+ focusItemAtIndex: o,
2936
+ getRange: () => J.current,
2937
+ getScrollAnchor: be,
2938
+ updateItemSize: ve
2915
2939
  }),
2916
- [Re, Wt, A, se, we]
2940
+ [Ae, Ut, E, o, be, ve]
2917
2941
  );
2918
- const St = A.getTotal() + y.top + y.bottom;
2942
+ const ue = E.getTotal() + R.top + R.bottom;
2919
2943
  return /* @__PURE__ */ ot(
2920
- vr,
2944
+ wr,
2921
2945
  {
2922
- ref: F,
2923
- contentSize: St,
2946
+ ref: G,
2947
+ contentSize: ue,
2924
2948
  viewportSize: i,
2925
2949
  className: a,
2926
2950
  testId: c,
2927
- onScroll: De,
2951
+ onScroll: ke,
2928
2952
  background: v,
2929
- tapScrollCircleOptions: lt,
2930
- inertiaOptions: Yt,
2931
- itemCount: n,
2932
- scrollBarWidth: D,
2933
- enableThumbDrag: O,
2934
- enableTrackClick: P,
2935
- enableArrowButtons: X,
2936
- enablePointerDrag: K,
2937
- pointerDragInputs: T,
2938
- renderThumbOverlay: N,
2939
- wheelSpeedMultiplier: Tt,
2940
- onWheelHorizontal: nt,
2941
- contentInsets: y,
2942
- contentProps: pt,
2943
- visibleStartIndex: de,
2944
- visibleEndIndex: be,
2945
- renderOverlay: Ee,
2946
- initialScrollPosition: j.position,
2947
- children: L
2953
+ tapScrollCircleOptions: j,
2954
+ inertiaOptions: Dt,
2955
+ itemCount: r,
2956
+ scrollBarWidth: O,
2957
+ enableThumbDrag: M,
2958
+ enableTrackClick: U,
2959
+ enableArrowButtons: Z,
2960
+ enablePointerDrag: T,
2961
+ pointerDragInputs: q,
2962
+ renderThumbOverlay: lt,
2963
+ wheelSpeedMultiplier: Ht,
2964
+ onWheelHorizontal: xt,
2965
+ contentInsets: R,
2966
+ contentProps: wt,
2967
+ visibleStartIndex: ce,
2968
+ visibleEndIndex: xe,
2969
+ renderOverlay: L,
2970
+ initialScrollPosition: Ct.position,
2971
+ children: Yt
2948
2972
  }
2949
2973
  );
2950
- }, zr = Be(Dr);
2974
+ }, Hr = $e(kr);
2951
2975
  export {
2952
- me as FenwickMapTree,
2953
- Ir as ScrollBar,
2954
- vr as ScrollPane,
2955
- Je as TAP_SCROLL_SPEED_DEFAULTS,
2956
- zr as VirtualScroll,
2957
- xr as computeAutoTapScrollMaxSpeedMultiplier,
2958
- br as computeTapScrollSpeed,
2959
- vt as minmax,
2960
- kr as tapScrollCircleSampleVisual,
2961
- yr as useFenwickMapTree,
2962
- Fr as useHeightCache,
2963
- Rr as useLruCache
2976
+ ge as FenwickMapTree,
2977
+ Mr as ScrollBar,
2978
+ wr as ScrollPane,
2979
+ rr as TAP_SCROLL_SPEED_DEFAULTS,
2980
+ Hr as VirtualScroll,
2981
+ vr as computeAutoTapScrollMaxSpeedMultiplier,
2982
+ Sr as computeTapScrollSpeed,
2983
+ rt as minmax,
2984
+ Br as tapScrollCircleSampleVisual,
2985
+ Nr as useFenwickMapTree,
2986
+ qr as useHeightCache,
2987
+ Vr as useLruCache
2964
2988
  };