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