@aiquants/virtualscroll 0.4.0 → 0.5.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,286 +1,7 @@
1
- import He, { forwardRef as Re, useState as le, useRef as H, useCallback as $, useImperativeHandle as Ae, useMemo as U, useEffect as ae, useReducer as $e, useLayoutEffect as be, useId as Ue } from "react";
2
- import { twMerge as pe } from "tailwind-merge";
3
- var Te = { exports: {} }, fe = {};
4
- /**
5
- * @license React
6
- * react-jsx-runtime.production.js
7
- *
8
- * Copyright (c) Meta Platforms, Inc. and affiliates.
9
- *
10
- * This source code is licensed under the MIT license found in the
11
- * LICENSE file in the root directory of this source tree.
12
- */
13
- var Ve;
14
- function qe() {
15
- if (Ve) return fe;
16
- Ve = 1;
17
- var c = Symbol.for("react.transitional.element"), e = Symbol.for("react.fragment");
18
- function n(r, s, a) {
19
- var i = null;
20
- if (a !== void 0 && (i = "" + a), s.key !== void 0 && (i = "" + s.key), "key" in s) {
21
- a = {};
22
- for (var f in s)
23
- f !== "key" && (a[f] = s[f]);
24
- } else a = s;
25
- return s = a.ref, {
26
- $$typeof: c,
27
- type: r,
28
- key: i,
29
- ref: s !== void 0 ? s : null,
30
- props: a
31
- };
32
- }
33
- return fe.Fragment = e, fe.jsx = n, fe.jsxs = n, fe;
34
- }
35
- var me = {};
36
- /**
37
- * @license React
38
- * react-jsx-runtime.development.js
39
- *
40
- * Copyright (c) Meta Platforms, Inc. and affiliates.
41
- *
42
- * This source code is licensed under the MIT license found in the
43
- * LICENSE file in the root directory of this source tree.
44
- */
45
- var ke;
46
- function Xe() {
47
- return ke || (ke = 1, process.env.NODE_ENV !== "production" && (function() {
48
- function c(t) {
49
- if (t == null) return null;
50
- if (typeof t == "function")
51
- return t.$$typeof === l ? null : t.displayName || t.name || null;
52
- if (typeof t == "string") return t;
53
- switch (t) {
54
- case N:
55
- return "Fragment";
56
- case F:
57
- return "Profiler";
58
- case K:
59
- return "StrictMode";
60
- case k:
61
- return "Suspense";
62
- case C:
63
- return "SuspenseList";
64
- case se:
65
- return "Activity";
66
- }
67
- if (typeof t == "object")
68
- switch (typeof t.tag == "number" && console.error(
69
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
70
- ), t.$$typeof) {
71
- case ie:
72
- return "Portal";
73
- case Z:
74
- return (t.displayName || "Context") + ".Provider";
75
- case m:
76
- return (t._context.displayName || "Context") + ".Consumer";
77
- case A:
78
- var o = t.render;
79
- return t = t.displayName, t || (t = o.displayName || o.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
80
- case B:
81
- return o = t.displayName || null, o !== null ? o : c(t.type) || "Memo";
82
- case X:
83
- o = t._payload, t = t._init;
84
- try {
85
- return c(t(o));
86
- } catch {
87
- }
88
- }
89
- return null;
90
- }
91
- function e(t) {
92
- return "" + t;
93
- }
94
- function n(t) {
95
- try {
96
- e(t);
97
- var o = !1;
98
- } catch {
99
- o = !0;
100
- }
101
- if (o) {
102
- o = console;
103
- var T = o.error, y = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
104
- return T.call(
105
- o,
106
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
107
- y
108
- ), e(t);
109
- }
110
- }
111
- function r(t) {
112
- if (t === N) return "<>";
113
- if (typeof t == "object" && t !== null && t.$$typeof === X)
114
- return "<...>";
115
- try {
116
- var o = c(t);
117
- return o ? "<" + o + ">" : "<...>";
118
- } catch {
119
- return "<...>";
120
- }
121
- }
122
- function s() {
123
- var t = Y.A;
124
- return t === null ? null : t.getOwner();
125
- }
126
- function a() {
127
- return Error("react-stack-top-frame");
128
- }
129
- function i(t) {
130
- if (j.call(t, "key")) {
131
- var o = Object.getOwnPropertyDescriptor(t, "key").get;
132
- if (o && o.isReactWarning) return !1;
133
- }
134
- return t.key !== void 0;
135
- }
136
- function f(t, o) {
137
- function T() {
138
- E || (E = !0, console.error(
139
- "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
140
- o
141
- ));
142
- }
143
- T.isReactWarning = !0, Object.defineProperty(t, "key", {
144
- get: T,
145
- configurable: !0
146
- });
147
- }
148
- function p() {
149
- var t = c(this.type);
150
- return M[t] || (M[t] = !0, console.error(
151
- "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
152
- )), t = this.props.ref, t !== void 0 ? t : null;
153
- }
154
- function g(t, o, T, y, w, V, D, _) {
155
- return T = V.ref, t = {
156
- $$typeof: ne,
157
- type: t,
158
- key: o,
159
- props: V,
160
- _owner: w
161
- }, (T !== void 0 ? T : null) !== null ? Object.defineProperty(t, "ref", {
162
- enumerable: !1,
163
- get: p
164
- }) : Object.defineProperty(t, "ref", { enumerable: !1, value: null }), t._store = {}, Object.defineProperty(t._store, "validated", {
165
- configurable: !1,
166
- enumerable: !1,
167
- writable: !0,
168
- value: 0
169
- }), Object.defineProperty(t, "_debugInfo", {
170
- configurable: !1,
171
- enumerable: !1,
172
- writable: !0,
173
- value: null
174
- }), Object.defineProperty(t, "_debugStack", {
175
- configurable: !1,
176
- enumerable: !1,
177
- writable: !0,
178
- value: D
179
- }), Object.defineProperty(t, "_debugTask", {
180
- configurable: !1,
181
- enumerable: !1,
182
- writable: !0,
183
- value: _
184
- }), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
185
- }
186
- function x(t, o, T, y, w, V, D, _) {
187
- var R = o.children;
188
- if (R !== void 0)
189
- if (y)
190
- if (L(R)) {
191
- for (y = 0; y < R.length; y++)
192
- P(R[y]);
193
- Object.freeze && Object.freeze(R);
194
- } else
195
- console.error(
196
- "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
197
- );
198
- else P(R);
199
- if (j.call(o, "key")) {
200
- R = c(t);
201
- var G = Object.keys(o).filter(function(u) {
202
- return u !== "key";
203
- });
204
- y = 0 < G.length ? "{key: someKey, " + G.join(": ..., ") + ": ...}" : "{key: someKey}", I[R + y] || (G = 0 < G.length ? "{" + G.join(": ..., ") + ": ...}" : "{}", console.error(
205
- `A props object containing a "key" prop is being spread into JSX:
206
- let props = %s;
207
- <%s {...props} />
208
- React keys must be passed directly to JSX without using spread:
209
- let props = %s;
210
- <%s key={someKey} {...props} />`,
211
- y,
212
- R,
213
- G,
214
- R
215
- ), I[R + y] = !0);
216
- }
217
- if (R = null, T !== void 0 && (n(T), R = "" + T), i(o) && (n(o.key), R = "" + o.key), "key" in o) {
218
- T = {};
219
- for (var J in o)
220
- J !== "key" && (T[J] = o[J]);
221
- } else T = o;
222
- return R && f(
223
- T,
224
- typeof t == "function" ? t.displayName || t.name || "Unknown" : t
225
- ), g(
226
- t,
227
- R,
228
- V,
229
- w,
230
- s(),
231
- T,
232
- D,
233
- _
234
- );
235
- }
236
- function P(t) {
237
- typeof t == "object" && t !== null && t.$$typeof === ne && t._store && (t._store.validated = 1);
238
- }
239
- var S = He, ne = Symbol.for("react.transitional.element"), ie = Symbol.for("react.portal"), N = Symbol.for("react.fragment"), K = Symbol.for("react.strict_mode"), F = Symbol.for("react.profiler"), m = Symbol.for("react.consumer"), Z = Symbol.for("react.context"), A = Symbol.for("react.forward_ref"), k = Symbol.for("react.suspense"), C = Symbol.for("react.suspense_list"), B = Symbol.for("react.memo"), X = Symbol.for("react.lazy"), se = Symbol.for("react.activity"), l = Symbol.for("react.client.reference"), Y = S.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, j = Object.prototype.hasOwnProperty, L = Array.isArray, b = console.createTask ? console.createTask : function() {
240
- return null;
241
- };
242
- S = {
243
- react_stack_bottom_frame: function(t) {
244
- return t();
245
- }
246
- };
247
- var E, M = {}, h = S.react_stack_bottom_frame.bind(
248
- S,
249
- a
250
- )(), v = b(r(a)), I = {};
251
- me.Fragment = N, me.jsx = function(t, o, T, y, w) {
252
- var V = 1e4 > Y.recentlyCreatedOwnerStacks++;
253
- return x(
254
- t,
255
- o,
256
- T,
257
- !1,
258
- y,
259
- w,
260
- V ? Error("react-stack-top-frame") : h,
261
- V ? b(r(t)) : v
262
- );
263
- }, me.jsxs = function(t, o, T, y, w) {
264
- var V = 1e4 > Y.recentlyCreatedOwnerStacks++;
265
- return x(
266
- t,
267
- o,
268
- T,
269
- !0,
270
- y,
271
- w,
272
- V ? Error("react-stack-top-frame") : h,
273
- V ? b(r(t)) : v
274
- );
275
- };
276
- })()), me;
277
- }
278
- var Le;
279
- function We() {
280
- return Le || (Le = 1, process.env.NODE_ENV === "production" ? Te.exports = qe() : Te.exports = Xe()), Te.exports;
281
- }
282
- var q = We();
283
- const re = {
1
+ import { jsxs as xe, jsx as j } from "react/jsx-runtime";
2
+ import { forwardRef as Ve, useState as le, useRef as N, useCallback as z, useImperativeHandle as Me, useMemo as O, useEffect as re, useReducer as ze, useLayoutEffect as ve, useId as ke } from "react";
3
+ import { twMerge as he } from "tailwind-merge";
4
+ const J = {
284
5
  debug(c, ...e) {
285
6
  typeof window < "u" && window.localStorage?.getItem("debug") === "true" && console.debug(`[VirtualScroll] ${c}`, ...e);
286
7
  },
@@ -290,120 +11,120 @@ const re = {
290
11
  error(c, ...e) {
291
12
  console.error(`[VirtualScroll] ${c}`, ...e);
292
13
  }
293
- }, z = (c, e, n) => Math.min(n, Math.max(e, c)), Ie = {
14
+ }, C = (c, e, n) => Math.min(n, Math.max(e, c)), ye = {
294
15
  active: !1,
295
16
  offsetY: 0,
296
17
  distance: 0,
297
18
  direction: 0
298
- }, Oe = 6, je = Re(({ onDragChange: c, className: e, maxVisualDistance: n = 160, size: r = 64, style: s, opacity: a = 1 }, i) => {
299
- const [f, p] = le(Ie), g = H(null), x = H({ x: 0, y: 0 }), P = H(null), S = $(
300
- (b, E = !1) => {
301
- const { y: M } = x.current, h = b - M, v = Math.abs(h), I = v < Oe ? 0 : h < 0 ? -1 : 1, t = {
302
- active: E || v >= Oe,
19
+ }, Le = 6, Re = Ve(({ onDragChange: c, className: e, maxVisualDistance: n = 160, size: t = 64, style: r, opacity: o = 1 }, s) => {
20
+ const [m, d] = le(ye), f = N(null), g = N({ x: 0, y: 0 }), y = N(null), w = z(
21
+ (x, T = !1) => {
22
+ const { y: M } = g.current, h = x - M, p = Math.abs(h), I = p < Le ? 0 : h < 0 ? -1 : 1, v = {
23
+ active: T || p >= Le,
303
24
  offsetY: h,
304
- distance: v,
25
+ distance: p,
305
26
  direction: I
306
27
  };
307
- p(t), c(t);
28
+ d(v), c(v);
308
29
  },
309
30
  [c]
310
- ), ne = $(
311
- (b = !1) => {
312
- if (b && g.current !== null) {
313
- const E = P.current;
314
- E?.hasPointerCapture(g.current) && E.releasePointerCapture(g.current);
31
+ ), ie = z(
32
+ (x = !1) => {
33
+ if (x && f.current !== null) {
34
+ const T = y.current;
35
+ T?.hasPointerCapture(f.current) && T.releasePointerCapture(f.current);
315
36
  }
316
- g.current = null, p(Ie), c(Ie);
37
+ f.current = null, d(ye), c(ye);
317
38
  },
318
39
  [c]
319
- ), ie = $(
320
- (b) => {
321
- b.preventDefault(), b.stopPropagation();
322
- const E = P.current ?? b.currentTarget, M = E.getBoundingClientRect();
323
- x.current = {
40
+ ), ae = z(
41
+ (x) => {
42
+ x.preventDefault(), x.stopPropagation();
43
+ const T = y.current ?? x.currentTarget, M = T.getBoundingClientRect();
44
+ g.current = {
324
45
  x: M.left + M.width / 2,
325
46
  y: M.top + M.height / 2
326
- }, g.current = b.pointerId, E.setPointerCapture(b.pointerId), S(b.clientY, !0);
47
+ }, f.current = x.pointerId, T.setPointerCapture(x.pointerId), w(x.clientY, !0);
327
48
  },
328
- [S]
329
- ), N = $(
330
- (b) => {
331
- g.current === b.pointerId && (b.preventDefault(), S(b.clientY));
49
+ [w]
50
+ ), Y = z(
51
+ (x) => {
52
+ f.current === x.pointerId && (x.preventDefault(), w(x.clientY));
332
53
  },
333
- [S]
334
- ), K = $(
335
- (b) => {
336
- g.current === b.pointerId && (b.preventDefault(), b.stopPropagation(), ne(!0));
54
+ [w]
55
+ ), Q = z(
56
+ (x) => {
57
+ f.current === x.pointerId && (x.preventDefault(), x.stopPropagation(), ie(!0));
337
58
  },
338
- [ne]
59
+ [ie]
339
60
  );
340
- Ae(
341
- i,
61
+ Me(
62
+ s,
342
63
  () => ({
343
64
  reset: () => {
344
- ne(!0);
65
+ ie(!0);
345
66
  },
346
- getElement: () => P.current
67
+ getElement: () => y.current
347
68
  }),
348
- [ne]
69
+ [ie]
349
70
  );
350
- const F = U(() => Math.min(f.distance, n) / n, [f.distance, n]), m = U(() => r / 64, [r]), Z = U(() => 1 + F * 0.4, [F]), A = U(() => f.direction * F * 10 * m, [f.direction, F, m]), k = U(() => f.direction * F * 26 * m, [f.direction, F, m]), C = U(() => 22 * m, [m]), B = U(() => Math.max(2.5, 3 * m), [m]), X = U(() => 6 * m, [m]), se = U(() => 3 * m, [m]), l = U(() => Math.min(Math.max(a, 0), 1), [a]), Y = U(() => {
351
- const b = {
352
- ...s,
353
- width: r,
354
- height: r,
355
- transform: `translateY(${A}px)`
71
+ const D = O(() => Math.min(m.distance, n) / n, [m.distance, n]), u = O(() => t / 64, [t]), ee = O(() => 1 + D * 0.4, [D]), E = O(() => m.direction * D * 10 * u, [m.direction, D, u]), P = O(() => m.direction * D * 26 * u, [m.direction, D, u]), F = O(() => 22 * u, [u]), W = O(() => Math.max(2.5, 3 * u), [u]), q = O(() => 6 * u, [u]), se = O(() => 3 * u, [u]), i = O(() => Math.min(Math.max(o, 0), 1), [o]), $ = O(() => {
72
+ const x = {
73
+ ...r,
74
+ width: t,
75
+ height: t,
76
+ transform: `translateY(${E}px)`
356
77
  };
357
- return b.opacity = l, b;
358
- }, [l, A, r, s]), j = U(() => Math.abs(k) + X, [X, k]), L = U(() => k > 0 ? se : -Math.abs(k) - se, [se, k]);
359
- return /* @__PURE__ */ q.jsxs(
78
+ return x.opacity = i, x;
79
+ }, [i, E, t, r]), k = O(() => Math.abs(P) + q, [q, P]), A = O(() => P > 0 ? se : -Math.abs(P) - se, [se, P]);
80
+ return /* @__PURE__ */ xe(
360
81
  "div",
361
82
  {
362
- ref: P,
363
- className: pe(
83
+ ref: y,
84
+ className: he(
364
85
  "relative flex items-center justify-center touch-none select-none",
365
86
  "transition-transform duration-100 ease-out",
366
87
  e
367
88
  ),
368
- style: Y,
369
- onPointerDown: ie,
370
- onPointerMove: N,
371
- onPointerUp: K,
372
- onPointerCancel: K,
89
+ style: $,
90
+ onPointerDown: ae,
91
+ onPointerMove: Y,
92
+ onPointerUp: Q,
93
+ onPointerCancel: Q,
373
94
  role: "presentation",
374
95
  children: [
375
- /* @__PURE__ */ q.jsx(
96
+ /* @__PURE__ */ j(
376
97
  "div",
377
98
  {
378
99
  className: "absolute inset-0 rounded-full border border-white/40 bg-gradient-to-br from-[#1d4ed8]/60 via-[#60a5fa]/55 to-[#bfdbfe]/40 shadow-md",
379
100
  style: {
380
- transform: `scaleY(${Z})`,
381
- transition: f.active ? "transform 40ms ease-out" : "transform 200ms ease"
101
+ transform: `scaleY(${ee})`,
102
+ transition: m.active ? "transform 40ms ease-out" : "transform 200ms ease"
382
103
  }
383
104
  }
384
105
  ),
385
- /* @__PURE__ */ q.jsx(
106
+ /* @__PURE__ */ j(
386
107
  "div",
387
108
  {
388
109
  className: "absolute left-1/2 top-1/2 h-6 w-6 -translate-x-1/2 -translate-y-1/2 rounded-full border border-white/50 bg-white/85",
389
110
  style: {
390
- width: C,
391
- height: C,
392
- transform: `translate(-50%, calc(-50% + ${k * 0.3}px)) scale(${1 + F * 0.2})`,
393
- transition: f.active ? "transform 40ms ease-out" : "transform 200ms ease"
111
+ width: F,
112
+ height: F,
113
+ transform: `translate(-50%, calc(-50% + ${P * 0.3}px)) scale(${1 + D * 0.2})`,
114
+ transition: m.active ? "transform 40ms ease-out" : "transform 200ms ease"
394
115
  }
395
116
  }
396
117
  ),
397
- /* @__PURE__ */ q.jsx(
118
+ /* @__PURE__ */ j(
398
119
  "div",
399
120
  {
400
121
  className: "absolute left-1/2 top-1/2 w-1 rounded-full bg-white/50",
401
122
  style: {
402
- width: B,
403
- height: j,
404
- transform: `translate(-50%, ${L}px)`,
405
- opacity: F,
406
- transition: f.active ? "height 40ms ease-out, opacity 60ms" : "height 200ms ease, opacity 120ms"
123
+ width: W,
124
+ height: k,
125
+ transform: `translate(-50%, ${A}px)`,
126
+ opacity: D,
127
+ transition: m.active ? "height 40ms ease-out, opacity 60ms" : "height 200ms ease, opacity 120ms"
407
128
  }
408
129
  }
409
130
  )
@@ -411,295 +132,295 @@ const re = {
411
132
  }
412
133
  );
413
134
  });
414
- je.displayName = "TapScrollCircle";
415
- const De = (c, e, n) => {
416
- const r = "touches" in c.nativeEvent, s = r ? c.nativeEvent.touches[0] : c.nativeEvent, a = (f) => {
417
- r && f.cancelable && f.preventDefault();
418
- const p = "touches" in f ? f.touches[0] : f;
135
+ Re.displayName = "TapScrollCircle";
136
+ const Ae = (c, e, n) => {
137
+ const t = "touches" in c.nativeEvent, r = t ? c.nativeEvent.touches[0] : c.nativeEvent, o = (m) => {
138
+ t && m.cancelable && m.preventDefault();
139
+ const d = "touches" in m ? m.touches[0] : m;
419
140
  e({
420
- deltaX: p.clientX - s.clientX,
421
- deltaY: p.clientY - s.clientY
141
+ deltaX: d.clientX - r.clientX,
142
+ deltaY: d.clientY - r.clientY
422
143
  });
423
- }, i = () => {
424
- r ? (document.removeEventListener("touchmove", a), document.removeEventListener("touchend", i)) : (document.removeEventListener("mousemove", a), document.removeEventListener("mouseup", i)), n?.();
144
+ }, s = () => {
145
+ t ? (document.removeEventListener("touchmove", o), document.removeEventListener("touchend", s)) : (document.removeEventListener("mousemove", o), document.removeEventListener("mouseup", s)), n?.();
425
146
  };
426
- r ? (document.addEventListener("touchmove", a, { passive: !1 }), document.addEventListener("touchend", i)) : (document.addEventListener("mousemove", a), document.addEventListener("mouseup", i));
427
- }, Pe = "virtualscroll:tap-scroll-cancel", Fe = 20, Ge = 250, Je = 60, Be = 20, Ke = 20, Ze = 220, Ne = { active: !1, offsetY: 0, distance: 0, direction: 0 }, _e = 2.2, Qe = 8, et = 120, ce = {
147
+ t ? (document.addEventListener("touchmove", o, { passive: !1 }), document.addEventListener("touchend", s)) : (document.addEventListener("mousemove", o), document.addEventListener("mouseup", s));
148
+ }, Ee = "virtualscroll:tap-scroll-cancel", De = 20, Oe = 250, Ye = 60, He = 20, Ue = 20, $e = 220, _e = { active: !1, offsetY: 0, distance: 0, direction: 0 }, Se = 2.2, Xe = 8, qe = 120, ce = {
428
149
  enabled: !0,
429
150
  size: 64,
430
151
  offsetX: -80,
431
152
  offsetY: 0,
432
153
  className: void 0,
433
- maxVisualDistance: Ze,
154
+ maxVisualDistance: $e,
434
155
  opacity: 1
435
- }, tt = (c) => {
156
+ }, je = (c) => {
436
157
  if (!c || c <= 0)
437
- return _e;
438
- const e = Math.max(1, c), n = Math.log10(e), r = _e + n * Qe;
439
- return z(r, _e, et);
440
- }, rt = ({ contentSize: c, viewportSize: e, scrollPosition: n, onScroll: r, horizontal: s = !1, scrollBarWidth: a = 12, className: i, ariaControls: f, tapScrollCircleOptions: p, itemCount: g }) => {
441
- const [x, P] = le(!1), [S, ne] = le(!1), ie = H(null), N = H(n), K = H(null), F = H(null), m = H(Ne), Z = H(null), A = H(null), k = H(null), C = U(() => {
442
- const d = p?.maxSpeedMultiplier, O = typeof d == "number" ? d : tt(g);
158
+ return Se;
159
+ const e = Math.max(1, c), n = Math.log10(e), t = Se + n * Xe;
160
+ return C(t, Se, qe);
161
+ }, Ke = ({ contentSize: c, viewportSize: e, scrollPosition: n, onScroll: t, horizontal: r = !1, scrollBarWidth: o = 12, className: s, ariaControls: m, tapScrollCircleOptions: d, itemCount: f }) => {
162
+ const [g, y] = le(!1), [w, ie] = le(!1), ae = N(null), Y = N(n), Q = N(null), D = N(null), u = N(_e), ee = N(null), E = N(null), P = N(null), F = O(() => {
163
+ const l = d?.maxSpeedMultiplier, L = typeof l == "number" ? l : je(f);
443
164
  return {
444
- enabled: p?.enabled ?? ce.enabled,
445
- size: p?.size ?? ce.size,
446
- offsetX: p?.offsetX ?? ce.offsetX,
447
- offsetY: p?.offsetY ?? ce.offsetY,
448
- className: p?.className ?? ce.className,
449
- maxVisualDistance: p?.maxVisualDistance ?? ce.maxVisualDistance,
450
- maxSpeedMultiplier: O,
451
- opacity: z(p?.opacity ?? ce.opacity, 0, 1)
165
+ enabled: d?.enabled ?? ce.enabled,
166
+ size: d?.size ?? ce.size,
167
+ offsetX: d?.offsetX ?? ce.offsetX,
168
+ offsetY: d?.offsetY ?? ce.offsetY,
169
+ className: d?.className ?? ce.className,
170
+ maxVisualDistance: d?.maxVisualDistance ?? ce.maxVisualDistance,
171
+ maxSpeedMultiplier: L,
172
+ opacity: C(d?.opacity ?? ce.opacity, 0, 1)
452
173
  };
453
- }, [g, p]), {
454
- enabled: B,
455
- size: X,
174
+ }, [f, d]), {
175
+ enabled: W,
176
+ size: q,
456
177
  offsetX: se,
457
- offsetY: l,
458
- className: Y,
459
- maxVisualDistance: j,
460
- maxSpeedMultiplier: L,
461
- opacity: b
462
- } = C, E = Math.max(j, 1), M = e / c, h = a, v = Math.max(e - h * 2, 0), I = M * v, t = Math.min(Math.max(Fe, I || 0), v || Fe), o = c - e, T = Math.max(v - t, 0), y = o <= 0 || T <= 0 ? 0 : n / o * T, w = c > e;
463
- ae(() => {
464
- N.current = n;
465
- }, [n]), ae(() => {
466
- ie.current && (x ? ie.current.style.backgroundColor = "#4F4F4F" : ie.current.style.backgroundColor = "#7F7F7F");
467
- }, [x]);
468
- const V = $(() => {
469
- K.current !== null && (window.clearInterval(K.current), K.current = null), F.current !== null && (window.clearTimeout(F.current), F.current = null);
470
- }, []), D = $(() => {
471
- A.current !== null && (window.cancelAnimationFrame(A.current), A.current = null), k.current = null;
472
- }, []), _ = $(() => {
473
- m.current = { ...Ne }, ne(!1), Z.current?.reset(), D();
474
- }, [D]), R = $(
475
- (d) => {
476
- const O = m.current;
477
- if (!O.active || O.direction === 0) {
478
- D();
178
+ offsetY: i,
179
+ className: $,
180
+ maxVisualDistance: k,
181
+ maxSpeedMultiplier: A,
182
+ opacity: x
183
+ } = F, T = Math.max(k, 1), M = e / c, h = o, p = Math.max(e - h * 2, 0), I = M * p, v = Math.min(Math.max(De, I || 0), p || De), b = c - e, _ = Math.max(p - v, 0), H = b <= 0 || _ <= 0 ? 0 : n / b * _, V = c > e;
184
+ re(() => {
185
+ Y.current = n;
186
+ }, [n]), re(() => {
187
+ ae.current && (g ? ae.current.style.backgroundColor = "#4F4F4F" : ae.current.style.backgroundColor = "#7F7F7F");
188
+ }, [g]);
189
+ const X = z(() => {
190
+ Q.current !== null && (window.clearInterval(Q.current), Q.current = null), D.current !== null && (window.clearTimeout(D.current), D.current = null);
191
+ }, []), R = z(() => {
192
+ E.current !== null && (window.cancelAnimationFrame(E.current), E.current = null), P.current = null;
193
+ }, []), S = z(() => {
194
+ u.current = { ..._e }, ie(!1), ee.current?.reset(), R();
195
+ }, [R]), K = z(
196
+ (l) => {
197
+ const L = u.current;
198
+ if (!L.active || L.direction === 0) {
199
+ R();
479
200
  return;
480
201
  }
481
- if (!w || o <= 0) {
482
- D();
202
+ if (!V || b <= 0) {
203
+ R();
483
204
  return;
484
205
  }
485
- const te = k.current ?? d, Q = Math.max((d - te) / 1e3, 0);
486
- if (k.current = d, Q <= 0) {
487
- A.current = window.requestAnimationFrame(R);
206
+ const Z = P.current ?? l, B = Math.max((l - Z) / 1e3, 0);
207
+ if (P.current = l, B <= 0) {
208
+ E.current = window.requestAnimationFrame(K);
488
209
  return;
489
210
  }
490
- const Ee = (Math.min(O.distance, E) / E) ** 1.1, de = Math.max(e * 0.2, 40), we = Math.max(e * L, 1200), Se = de + (we - de) * Ee, xe = N.current, ye = z(xe + O.direction * Se * Q, 0, o);
491
- if (ye === xe) {
492
- D();
211
+ const Te = (Math.min(L.distance, T) / T) ** 1.1, de = Math.max(e * 0.2, 40), be = Math.max(e * A, 1200), we = de + (be - de) * Te, ge = Y.current, Ie = C(ge + L.direction * we * B, 0, b);
212
+ if (Ie === ge) {
213
+ R();
493
214
  return;
494
215
  }
495
- N.current = ye, r?.(ye, xe), A.current = window.requestAnimationFrame(R);
216
+ Y.current = Ie, t?.(Ie, ge), E.current = window.requestAnimationFrame(K);
496
217
  },
497
- [E, o, r, w, D, L, e]
498
- ), G = $(() => {
499
- A.current === null && (k.current = null, A.current = window.requestAnimationFrame(R));
500
- }, [R]);
501
- ae(() => () => {
502
- V(), D();
503
- }, [V, D]);
504
- const J = $(
505
- (d) => {
506
- m.current = d, ne(d.active), d.active && d.direction !== 0 ? G() : D();
218
+ [T, b, t, V, R, A, e]
219
+ ), oe = z(() => {
220
+ E.current === null && (P.current = null, E.current = window.requestAnimationFrame(K));
221
+ }, [K]);
222
+ re(() => () => {
223
+ X(), R();
224
+ }, [X, R]);
225
+ const te = z(
226
+ (l) => {
227
+ u.current = l, ie(l.active), l.active && l.direction !== 0 ? oe() : R();
507
228
  },
508
- [G, D]
229
+ [oe, R]
509
230
  );
510
- ae(() => {
511
- B || _();
512
- }, [_, B]), ae(() => {
513
- const d = (O) => {
514
- const Q = O.detail?.paneId;
515
- Q && f && Q !== f || _();
231
+ re(() => {
232
+ W || S();
233
+ }, [S, W]), re(() => {
234
+ const l = (L) => {
235
+ const B = L.detail?.paneId;
236
+ B && m && B !== m || S();
516
237
  };
517
- return window.addEventListener(Pe, d), () => {
518
- window.removeEventListener(Pe, d);
238
+ return window.addEventListener(Ee, l), () => {
239
+ window.removeEventListener(Ee, l);
519
240
  };
520
- }, [f, _]), ae(() => {
521
- if (!B)
241
+ }, [m, S]), re(() => {
242
+ if (!W)
522
243
  return;
523
- const d = (O) => {
524
- if (!m.current.active)
244
+ const l = (L) => {
245
+ if (!u.current.active)
525
246
  return;
526
- const te = O.target;
527
- if (!(te instanceof Node)) {
528
- _();
247
+ const Z = L.target;
248
+ if (!(Z instanceof Node)) {
249
+ S();
529
250
  return;
530
251
  }
531
- Z.current?.getElement()?.contains(te) || _();
252
+ ee.current?.getElement()?.contains(Z) || S();
532
253
  };
533
- return document.addEventListener("pointerdown", d, !0), () => {
534
- document.removeEventListener("pointerdown", d, !0);
254
+ return document.addEventListener("pointerdown", l, !0), () => {
255
+ document.removeEventListener("pointerdown", l, !0);
535
256
  };
536
- }, [_, B]);
537
- const u = (d) => {
538
- if (!w || T <= 0 || o <= 0)
257
+ }, [S, W]);
258
+ const a = (l) => {
259
+ if (!V || _ <= 0 || b <= 0)
539
260
  return 0;
540
- const O = z(d, 0, T);
541
- return z(O / T * o, 0, o);
542
- }, ee = (d) => {
543
- if (!w || o <= 0)
261
+ const L = C(l, 0, _);
262
+ return C(L / _ * b, 0, b);
263
+ }, G = (l) => {
264
+ if (!V || b <= 0)
544
265
  return;
545
- const O = Math.max(Math.round(e / Ke), Be), te = N.current, Q = z(te + d * O, 0, o);
546
- Q !== te && (N.current = Q, r?.(Q, te));
547
- }, W = () => {
548
- V();
549
- }, oe = (d) => (O) => {
550
- w && (O.preventDefault(), O.stopPropagation(), _(), V(), ee(d), F.current = window.setTimeout(() => {
551
- K.current = window.setInterval(() => {
552
- ee(d);
553
- }, Je);
554
- }, Ge));
555
- }, ue = (d) => (O) => {
556
- (O.key === "Enter" || O.key === " " || O.key === "Spacebar") && (O.preventDefault(), ee(d));
557
- }, ge = (d) => {
558
- if (!w || "button" in d && d.button !== 0 || d.ctrlKey)
266
+ const L = Math.max(Math.round(e / Ue), He), Z = Y.current, B = C(Z + l * L, 0, b);
267
+ B !== Z && (Y.current = B, t?.(B, Z));
268
+ }, U = () => {
269
+ X();
270
+ }, ne = (l) => (L) => {
271
+ V && (L.preventDefault(), L.stopPropagation(), S(), X(), G(l), D.current = window.setTimeout(() => {
272
+ Q.current = window.setInterval(() => {
273
+ G(l);
274
+ }, Ye);
275
+ }, Oe));
276
+ }, ue = (l) => (L) => {
277
+ (L.key === "Enter" || L.key === " " || L.key === "Spacebar") && (L.preventDefault(), G(l));
278
+ }, me = (l) => {
279
+ if (!V || "button" in l && l.button !== 0 || l.ctrlKey)
559
280
  return;
560
- d.stopPropagation(), _();
561
- const O = y;
562
- P(!0), De(
563
- d,
564
- ({ deltaX: te, deltaY: Q }) => {
565
- r?.(u(O + (s ? te : Q)), y);
281
+ l.stopPropagation(), S();
282
+ const L = H;
283
+ y(!0), Ae(
284
+ l,
285
+ ({ deltaX: Z, deltaY: B }) => {
286
+ t?.(a(L + (r ? Z : B)), H);
566
287
  },
567
288
  () => {
568
- P(!1);
289
+ y(!1);
569
290
  }
570
291
  );
571
- }, Me = (d) => {
572
- if (!w || "button" in d && d.button !== 0 || d.ctrlKey)
292
+ }, Pe = (l) => {
293
+ if (!V || "button" in l && l.button !== 0 || l.ctrlKey)
573
294
  return;
574
- const te = "touches" in d.nativeEvent ? d.nativeEvent.touches[0] : d.nativeEvent, Q = s ? te.clientX : te.clientY, ve = d.currentTarget.getBoundingClientRect(), Ee = s ? Q - ve.left : Q - ve.top;
575
- _();
576
- const de = Ee - t / 2;
577
- r?.(u(de), y), De(d, ({ deltaX: we, deltaY: Se }) => {
578
- r?.(u(de + (s ? we : Se)), y);
295
+ const Z = "touches" in l.nativeEvent ? l.nativeEvent.touches[0] : l.nativeEvent, B = r ? Z.clientX : Z.clientY, pe = l.currentTarget.getBoundingClientRect(), Te = r ? B - pe.left : B - pe.top;
296
+ S();
297
+ const de = Te - v / 2;
298
+ t?.(a(de), H), Ae(l, ({ deltaX: be, deltaY: we }) => {
299
+ t?.(a(de + (r ? be : we)), H);
579
300
  });
580
- }, Ye = U(() => z((S ? 1 : 0.8) * b, 0, 1), [S, b]), ze = U(() => {
581
- const O = `calc(50% - ${X / 2}px + ${l}px)`;
301
+ }, Ce = O(() => C((w ? 1 : 0.8) * x, 0, 1), [w, x]), Ne = O(() => {
302
+ const L = `calc(50% - ${q / 2}px + ${i}px)`;
582
303
  return {
583
304
  left: se,
584
- top: O
305
+ top: L
585
306
  };
586
- }, [se, l, X]);
587
- return /* @__PURE__ */ q.jsxs(
307
+ }, [se, i, q]);
308
+ return /* @__PURE__ */ xe(
588
309
  "div",
589
310
  {
590
- className: pe(
311
+ className: he(
591
312
  "group relative cursor-default select-none",
592
- s ? "flex flex-row items-stretch" : "flex flex-col items-stretch",
593
- i
313
+ r ? "flex flex-row items-stretch" : "flex flex-col items-stretch",
314
+ s
594
315
  ),
595
316
  style: {
596
- [s ? "width" : "height"]: e,
597
- [s ? "height" : "width"]: a,
317
+ [r ? "width" : "height"]: e,
318
+ [r ? "height" : "width"]: o,
598
319
  backgroundColor: "white",
599
320
  userSelect: "none",
600
321
  position: "relative"
601
322
  },
602
323
  role: "scrollbar",
603
324
  tabIndex: -1,
604
- "aria-controls": f,
325
+ "aria-controls": m,
605
326
  "aria-valuenow": n,
606
327
  "aria-valuemin": 0,
607
- "aria-valuemax": o,
608
- "aria-orientation": s ? "horizontal" : "vertical",
328
+ "aria-valuemax": b,
329
+ "aria-orientation": r ? "horizontal" : "vertical",
609
330
  children: [
610
- !s && w && B && /* @__PURE__ */ q.jsx(
611
- je,
331
+ !r && V && W && /* @__PURE__ */ j(
332
+ Re,
612
333
  {
613
- ref: Z,
614
- className: pe(
334
+ ref: ee,
335
+ className: he(
615
336
  "pointer-events-auto absolute transition-opacity duration-150",
616
- Y
337
+ $
617
338
  ),
618
- size: X,
619
- maxVisualDistance: E,
620
- style: ze,
621
- opacity: Ye,
622
- onDragChange: J
339
+ size: q,
340
+ maxVisualDistance: T,
341
+ style: Ne,
342
+ opacity: Ce,
343
+ onDragChange: te
623
344
  }
624
345
  ),
625
- /* @__PURE__ */ q.jsx(
346
+ /* @__PURE__ */ j(
626
347
  "button",
627
348
  {
628
349
  type: "button",
629
350
  className: "flex items-center justify-center text-xs text-[#313131] transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-[#60a5fa] focus-visible:ring-offset-1 disabled:cursor-not-allowed disabled:opacity-50",
630
351
  style: {
631
- [s ? "width" : "height"]: h,
632
- [s ? "height" : "width"]: a,
352
+ [r ? "width" : "height"]: h,
353
+ [r ? "height" : "width"]: o,
633
354
  backgroundColor: "#E0E0E0"
634
355
  },
635
- "aria-label": s ? "Scroll left" : "Scroll up",
636
- onMouseDown: oe(-1),
637
- onTouchStart: oe(-1),
638
- onMouseUp: W,
639
- onMouseLeave: W,
640
- onTouchEnd: W,
641
- onTouchCancel: W,
356
+ "aria-label": r ? "Scroll left" : "Scroll up",
357
+ onMouseDown: ne(-1),
358
+ onTouchStart: ne(-1),
359
+ onMouseUp: U,
360
+ onMouseLeave: U,
361
+ onTouchEnd: U,
362
+ onTouchCancel: U,
642
363
  onKeyDown: ue(-1),
643
- disabled: !w,
644
- children: /* @__PURE__ */ q.jsx("span", { "aria-hidden": "true", children: s ? "◀" : "▲" })
364
+ disabled: !V,
365
+ children: /* @__PURE__ */ j("span", { "aria-hidden": "true", children: r ? "◀" : "▲" })
645
366
  }
646
367
  ),
647
- /* @__PURE__ */ q.jsx(
368
+ /* @__PURE__ */ j(
648
369
  "div",
649
370
  {
650
371
  className: "relative flex-1",
651
372
  style: {
652
373
  backgroundColor: "#F5F5F5",
653
- borderRadius: a / 2
374
+ borderRadius: o / 2
654
375
  },
655
- onMouseDown: Me,
656
- onTouchStart: Me,
376
+ onMouseDown: Pe,
377
+ onTouchStart: Pe,
657
378
  children: c > e && // スクロールバーのつまみの当たり判定を広げるためのラッパー
658
- /* @__PURE__ */ q.jsx(
379
+ /* @__PURE__ */ j(
659
380
  "div",
660
381
  {
661
382
  className: "group absolute",
662
383
  style: {
663
- [s ? "width" : "height"]: t,
664
- [s ? "left" : "top"]: y,
665
- ...s ? { top: 0, bottom: 0 } : { left: 0, right: 0 }
384
+ [r ? "width" : "height"]: v,
385
+ [r ? "left" : "top"]: H,
386
+ ...r ? { top: 0, bottom: 0 } : { left: 0, right: 0 }
666
387
  },
667
- onMouseDown: ge,
668
- onTouchStart: ge,
388
+ onMouseDown: me,
389
+ onTouchStart: me,
669
390
  role: "slider",
670
- "aria-orientation": s ? "horizontal" : "vertical",
391
+ "aria-orientation": r ? "horizontal" : "vertical",
671
392
  "aria-valuenow": n,
672
393
  "aria-valuemin": 0,
673
- "aria-valuemax": o,
394
+ "aria-valuemax": b,
674
395
  tabIndex: 0,
675
- children: /* @__PURE__ */ q.jsx(
396
+ children: /* @__PURE__ */ j(
676
397
  "div",
677
398
  {
678
- ref: ie,
679
- className: pe(
399
+ ref: ae,
400
+ className: he(
680
401
  "absolute",
681
- s ? `inset-x-0 inset-y-[1.5px] group-hover:inset-y-[-0.5px] ${x ? "inset-y-[-2px]" : "group-active:inset-y-[-2px]"}` : `inset-x-[1.5px] inset-y-0 group-hover:inset-x-[-0.5px] ${x ? "inset-x-[-2px]" : "group-active:inset-x-[-2px]"}`
402
+ r ? `inset-x-0 inset-y-[1.5px] group-hover:inset-y-[-0.5px] ${g ? "inset-y-[-2px]" : "group-active:inset-y-[-2px]"}` : `inset-x-[1.5px] inset-y-0 group-hover:inset-x-[-0.5px] ${g ? "inset-x-[-2px]" : "group-active:inset-x-[-2px]"}`
682
403
  ),
683
404
  style: {
684
405
  backgroundColor: "#7F7F7F",
685
- borderRadius: a - 1,
686
- ...s ? {
406
+ borderRadius: o - 1,
407
+ ...r ? {
687
408
  left: 0,
688
409
  right: 0,
689
- top: x ? -2 : 1.5,
690
- bottom: x ? -2 : 1.5
410
+ top: g ? -2 : 1.5,
411
+ bottom: g ? -2 : 1.5
691
412
  } : {
692
413
  top: 0,
693
414
  bottom: 0,
694
- left: x ? -2 : 1.5,
695
- right: x ? -2 : 1.5
415
+ left: g ? -2 : 1.5,
416
+ right: g ? -2 : 1.5
696
417
  }
697
418
  },
698
- onMouseEnter: (d) => {
699
- s ? (d.currentTarget.style.top = "-0.5px", d.currentTarget.style.bottom = "-0.5px") : (d.currentTarget.style.left = "-0.5px", d.currentTarget.style.right = "-0.5px"), x || (d.currentTarget.style.backgroundColor = "#5F5F5F");
419
+ onMouseEnter: (l) => {
420
+ r ? (l.currentTarget.style.top = "-0.5px", l.currentTarget.style.bottom = "-0.5px") : (l.currentTarget.style.left = "-0.5px", l.currentTarget.style.right = "-0.5px"), g || (l.currentTarget.style.backgroundColor = "#5F5F5F");
700
421
  },
701
- onMouseLeave: (d) => {
702
- s ? (d.currentTarget.style.top = x ? "-2px" : "1.5px", d.currentTarget.style.bottom = x ? "-2px" : "1.5px") : (d.currentTarget.style.left = x ? "-2px" : "1.5px", d.currentTarget.style.right = x ? "-2px" : "1.5px"), x || (d.currentTarget.style.backgroundColor = "#7F7F7F");
422
+ onMouseLeave: (l) => {
423
+ r ? (l.currentTarget.style.top = g ? "-2px" : "1.5px", l.currentTarget.style.bottom = g ? "-2px" : "1.5px") : (l.currentTarget.style.left = g ? "-2px" : "1.5px", l.currentTarget.style.right = g ? "-2px" : "1.5px"), g || (l.currentTarget.style.backgroundColor = "#7F7F7F");
703
424
  }
704
425
  }
705
426
  )
@@ -707,209 +428,209 @@ const De = (c, e, n) => {
707
428
  )
708
429
  }
709
430
  ),
710
- /* @__PURE__ */ q.jsx(
431
+ /* @__PURE__ */ j(
711
432
  "button",
712
433
  {
713
434
  type: "button",
714
435
  className: "flex items-center justify-center text-xs text-[#313131] transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-[#60a5fa] focus-visible:ring-offset-1 disabled:cursor-not-allowed disabled:opacity-50",
715
436
  style: {
716
- [s ? "width" : "height"]: h,
717
- [s ? "height" : "width"]: a,
437
+ [r ? "width" : "height"]: h,
438
+ [r ? "height" : "width"]: o,
718
439
  backgroundColor: "#E0E0E0"
719
440
  },
720
- "aria-label": s ? "Scroll right" : "Scroll down",
721
- onMouseDown: oe(1),
722
- onTouchStart: oe(1),
723
- onMouseUp: W,
724
- onMouseLeave: W,
725
- onTouchEnd: W,
726
- onTouchCancel: W,
441
+ "aria-label": r ? "Scroll right" : "Scroll down",
442
+ onMouseDown: ne(1),
443
+ onTouchStart: ne(1),
444
+ onMouseUp: U,
445
+ onMouseLeave: U,
446
+ onTouchEnd: U,
447
+ onTouchCancel: U,
727
448
  onKeyDown: ue(1),
728
- disabled: !w,
729
- children: /* @__PURE__ */ q.jsx("span", { "aria-hidden": "true", children: s ? "▶" : "▼" })
449
+ disabled: !V,
450
+ children: /* @__PURE__ */ j("span", { "aria-hidden": "true", children: r ? "▶" : "▼" })
730
451
  }
731
452
  )
732
453
  ]
733
454
  }
734
455
  );
735
- }, he = {
456
+ }, fe = {
736
457
  maxVelocity: 6,
737
458
  minVelocity: 0.02,
738
459
  deceleration: 25e-4,
739
460
  velocitySampleWindow: 90,
740
461
  startVelocityThreshold: 0.04
741
- }, nt = Re(({ children: c, contentSize: e, viewportSize: n, scrollBarWidth: r = 12, onScroll: s, className: a, style: i, background: f, tapScrollCircleOptions: p, inertiaOptions: g, itemCount: x }, P) => {
742
- const S = H(0), [ne, ie] = $e((l) => l + 1, 0), N = H(null), K = H(null), F = H({
462
+ }, Be = Ve(({ children: c, contentSize: e, viewportSize: n, scrollBarWidth: t = 12, onScroll: r, className: o, style: s, background: m, tapScrollCircleOptions: d, inertiaOptions: f, itemCount: g }, y) => {
463
+ const w = N(0), [ie, ae] = ze((i) => i + 1, 0), Y = N(null), Q = N(null), D = N({
743
464
  frame: null,
744
465
  velocity: 0,
745
466
  lastTimestamp: null
746
- }), m = U(
467
+ }), u = O(
747
468
  () => ({
748
- maxVelocity: g?.maxVelocity ?? he.maxVelocity,
749
- minVelocity: g?.minVelocity ?? he.minVelocity,
750
- deceleration: g?.deceleration ?? he.deceleration,
751
- velocitySampleWindow: g?.velocitySampleWindow ?? he.velocitySampleWindow,
752
- startVelocityThreshold: g?.startVelocityThreshold ?? he.startVelocityThreshold
469
+ maxVelocity: f?.maxVelocity ?? fe.maxVelocity,
470
+ minVelocity: f?.minVelocity ?? fe.minVelocity,
471
+ deceleration: f?.deceleration ?? fe.deceleration,
472
+ velocitySampleWindow: f?.velocitySampleWindow ?? fe.velocitySampleWindow,
473
+ startVelocityThreshold: f?.startVelocityThreshold ?? fe.startVelocityThreshold
753
474
  }),
754
- [g]
475
+ [f]
755
476
  );
756
- re.debug("[ScrollPane] ScrollPane rendered", { contentSize: e, viewportSize: n, scrollBarWidth: r, className: a, style: i, tapScrollCircleOptions: p, inertiaOptions: g });
757
- const Z = H({ contentSize: e, viewportSize: n }), A = U(() => e > n, [e, n]), k = $(
758
- (l) => {
759
- const { contentSize: Y, viewportSize: j } = Z.current, L = Y > j, b = S.current;
760
- if (re.debug("[ScrollPane] scrollTo called", { newPosition: l, contentSize: Y, viewportSize: j, currentIsScrollable: L, prevPosition: b }), !L) {
761
- S.current !== 0 && (S.current = 0, s?.(0, b));
477
+ J.debug("[ScrollPane] ScrollPane rendered", { contentSize: e, viewportSize: n, scrollBarWidth: t, className: o, style: s, tapScrollCircleOptions: d, inertiaOptions: f });
478
+ const ee = N({ contentSize: e, viewportSize: n }), E = O(() => e > n, [e, n]), P = z(
479
+ (i) => {
480
+ const { contentSize: $, viewportSize: k } = ee.current, A = $ > k, x = w.current;
481
+ if (J.debug("[ScrollPane] scrollTo called", { newPosition: i, contentSize: $, viewportSize: k, currentIsScrollable: A, prevPosition: x }), !A) {
482
+ w.current !== 0 && (w.current = 0, r?.(0, x));
762
483
  return;
763
484
  }
764
- const E = typeof l == "function" ? l(S.current) : l, M = z(E, 0, Y - j);
765
- S.current !== M && (S.current = M, s?.(M, b));
485
+ const T = typeof i == "function" ? i(w.current) : i, M = C(T, 0, $ - k);
486
+ w.current !== M && (w.current = M, r?.(M, x));
766
487
  },
767
- [s]
768
- ), C = $(() => {
769
- const l = F.current;
770
- l.frame !== null && cancelAnimationFrame(l.frame), l.frame = null, l.velocity = 0, l.lastTimestamp = null;
771
- }, []), B = $(
772
- (l) => {
773
- if (!A)
488
+ [r]
489
+ ), F = z(() => {
490
+ const i = D.current;
491
+ i.frame !== null && cancelAnimationFrame(i.frame), i.frame = null, i.velocity = 0, i.lastTimestamp = null;
492
+ }, []), W = z(
493
+ (i) => {
494
+ if (!E)
774
495
  return;
775
- const { maxVelocity: Y, minVelocity: j, deceleration: L, startVelocityThreshold: b } = m, E = z(l, -Y, Y);
776
- if (Math.abs(E) < b)
496
+ const { maxVelocity: $, minVelocity: k, deceleration: A, startVelocityThreshold: x } = u, T = C(i, -$, $);
497
+ if (Math.abs(T) < x)
777
498
  return;
778
- C(), F.current.velocity = E, F.current.lastTimestamp = null;
499
+ F(), D.current.velocity = T, D.current.lastTimestamp = null;
779
500
  const M = (h) => {
780
- const v = F.current;
781
- if (v.lastTimestamp === null) {
782
- v.lastTimestamp = h, v.frame = requestAnimationFrame(M);
501
+ const p = D.current;
502
+ if (p.lastTimestamp === null) {
503
+ p.lastTimestamp = h, p.frame = requestAnimationFrame(M);
783
504
  return;
784
505
  }
785
- const I = h - v.lastTimestamp;
786
- if (v.lastTimestamp = h, I <= 0) {
787
- v.frame = requestAnimationFrame(M);
506
+ const I = h - p.lastTimestamp;
507
+ if (p.lastTimestamp = h, I <= 0) {
508
+ p.frame = requestAnimationFrame(M);
788
509
  return;
789
510
  }
790
- const t = v.velocity;
791
- let o = t;
792
- const T = L * I;
793
- t > 0 ? o = Math.max(0, t - T) : t < 0 && (o = Math.min(0, t + T));
794
- const w = (t + o) / 2 * I, V = S.current;
795
- w !== 0 && k((u) => u + w);
796
- const D = S.current, { contentSize: _, viewportSize: R } = Z.current, G = Math.max(_ - R, 0);
797
- v.velocity = o;
798
- const J = D === V || D <= 0 && o <= 0 || D >= G && o >= 0;
799
- if (Math.abs(o) < j || J) {
800
- C();
511
+ const v = p.velocity;
512
+ let b = v;
513
+ const _ = A * I;
514
+ v > 0 ? b = Math.max(0, v - _) : v < 0 && (b = Math.min(0, v + _));
515
+ const V = (v + b) / 2 * I, X = w.current;
516
+ V !== 0 && P((a) => a + V);
517
+ const R = w.current, { contentSize: S, viewportSize: K } = ee.current, oe = Math.max(S - K, 0);
518
+ p.velocity = b;
519
+ const te = R === X || R <= 0 && b <= 0 || R >= oe && b >= 0;
520
+ if (Math.abs(b) < k || te) {
521
+ F();
801
522
  return;
802
523
  }
803
- v.frame = requestAnimationFrame(M);
524
+ p.frame = requestAnimationFrame(M);
804
525
  };
805
- F.current.frame = requestAnimationFrame(M);
526
+ D.current.frame = requestAnimationFrame(M);
806
527
  },
807
- [A, m, k, C]
528
+ [E, u, P, F]
808
529
  );
809
- be(() => {
810
- Z.current = { contentSize: e, viewportSize: n };
811
- }, [e, n]), be(() => {
812
- if (A) {
813
- re.debug("[ScrollPane] Adjusting scroll position due to content or viewport size change", { contentSize: e, viewportSize: n, scrollPosition: S.current });
814
- const l = z(e - n, 0, e);
815
- S.current > l && k(l);
530
+ ve(() => {
531
+ ee.current = { contentSize: e, viewportSize: n };
532
+ }, [e, n]), ve(() => {
533
+ if (E) {
534
+ J.debug("[ScrollPane] Adjusting scroll position due to content or viewport size change", { contentSize: e, viewportSize: n, scrollPosition: w.current });
535
+ const i = C(e - n, 0, e);
536
+ w.current > i && P(i);
816
537
  } else
817
- k(0);
818
- }, [A, k, e, n]), ae(() => {
819
- const l = (j) => {
820
- if (!A)
538
+ P(0);
539
+ }, [E, P, e, n]), re(() => {
540
+ const i = (k) => {
541
+ if (!E)
821
542
  return;
822
- j.preventDefault(), C();
823
- let L = j.deltaY;
824
- j.deltaMode === 1 ? L *= 16 : j.deltaMode === 2 && (L *= n), re.debug("[ScrollPane] wheel event", { deltaY: L, scrollPosition: S.current }), k((b) => b + L);
825
- }, Y = N.current;
826
- return Y && Y.addEventListener("wheel", l, { passive: !1 }), () => {
827
- Y && Y.removeEventListener("wheel", l);
543
+ k.preventDefault(), F();
544
+ let A = k.deltaY;
545
+ k.deltaMode === 1 ? A *= 16 : k.deltaMode === 2 && (A *= n), J.debug("[ScrollPane] wheel event", { deltaY: A, scrollPosition: w.current }), P((x) => x + A);
546
+ }, $ = Y.current;
547
+ return $ && $.addEventListener("wheel", i, { passive: !1 }), () => {
548
+ $ && $.removeEventListener("wheel", i);
828
549
  };
829
- }, [A, k, C, n]), Ae(
830
- P,
550
+ }, [E, P, F, n]), Me(
551
+ y,
831
552
  () => ({
832
- scrollTo: k,
833
- getScrollPosition: () => S.current,
553
+ scrollTo: P,
554
+ getScrollPosition: () => w.current,
834
555
  getContentSize: () => e,
835
556
  getViewportSize: () => n
836
557
  }),
837
- [k, e, n]
558
+ [P, e, n]
838
559
  );
839
- const X = Ue(), se = U(() => /* @__PURE__ */ q.jsxs("div", { ref: N, className: pe("flex", a), style: i, children: [
840
- /* @__PURE__ */ q.jsxs("div", { ref: K, className: "relative h-full flex-1 overflow-hidden", style: { height: n, touchAction: "none" }, id: X, children: [
841
- f,
842
- c(S.current)
560
+ const q = ke(), se = O(() => /* @__PURE__ */ xe("div", { ref: Y, className: he("flex", o), style: s, children: [
561
+ /* @__PURE__ */ xe("div", { ref: Q, className: "relative h-full flex-1 overflow-hidden", style: { height: n, touchAction: "none" }, id: q, children: [
562
+ m,
563
+ c(w.current)
843
564
  ] }),
844
- A && /* @__PURE__ */ q.jsx(
845
- rt,
565
+ E && /* @__PURE__ */ j(
566
+ Ke,
846
567
  {
847
568
  contentSize: e,
848
569
  viewportSize: n,
849
- scrollPosition: S.current,
850
- onScroll: k,
851
- scrollBarWidth: r,
852
- ariaControls: X,
853
- tapScrollCircleOptions: p,
854
- itemCount: x
570
+ scrollPosition: w.current,
571
+ onScroll: P,
572
+ scrollBarWidth: t,
573
+ ariaControls: q,
574
+ tapScrollCircleOptions: d,
575
+ itemCount: g
855
576
  }
856
577
  )
857
- ] }), [c, e, n, r, a, i, A, k, X, f, p, x]);
858
- return ae(() => {
859
- const l = K.current;
860
- if (!l)
578
+ ] }), [c, e, n, t, o, s, E, P, q, m, d, g]);
579
+ return re(() => {
580
+ const i = Q.current;
581
+ if (!i)
861
582
  return;
862
- const Y = 6, j = "input, textarea, select, button, a[href], [role='button']";
863
- let L = null, b = 0, E = 0, M = !1, h = !1, v = !1, I = null, t = [];
864
- const o = () => {
865
- L = null, b = 0, E = 0, M = !1, h = !1, t = [];
866
- }, T = (u) => {
867
- const ee = performance.now();
868
- t.push({ clientY: u, time: ee }), t = t.filter((W) => ee - W.time <= m.velocitySampleWindow);
869
- }, y = (u) => u instanceof HTMLElement ? u.closest("[data-scrollpane-ignore-drag='true']") !== null : !1, w = (u) => u instanceof HTMLElement ? u.closest(j) !== null : !1, V = (u) => {
870
- v && (u.preventDefault(), u.stopPropagation(), v = !1);
871
- }, D = (u) => {
872
- M || (M = !0, h = !1, v = !0, l.hasPointerCapture(u.pointerId) || l.setPointerCapture(u.pointerId), T(u.clientY));
873
- }, _ = (u) => {
874
- if (L !== u.pointerId)
583
+ const $ = 6, k = "input, textarea, select, button, a[href], [role='button']";
584
+ let A = null, x = 0, T = 0, M = !1, h = !1, p = !1, I = null, v = [];
585
+ const b = () => {
586
+ A = null, x = 0, T = 0, M = !1, h = !1, v = [];
587
+ }, _ = (a) => {
588
+ const G = performance.now();
589
+ v.push({ clientY: a, time: G }), v = v.filter((U) => G - U.time <= u.velocitySampleWindow);
590
+ }, H = (a) => a instanceof HTMLElement ? a.closest("[data-scrollpane-ignore-drag='true']") !== null : !1, V = (a) => a instanceof HTMLElement ? a.closest(k) !== null : !1, X = (a) => {
591
+ p && (a.preventDefault(), a.stopPropagation(), p = !1);
592
+ }, R = (a) => {
593
+ M || (M = !0, h = !1, p = !0, i.hasPointerCapture(a.pointerId) || i.setPointerCapture(a.pointerId), _(a.clientY));
594
+ }, S = (a) => {
595
+ if (A !== a.pointerId)
875
596
  return;
876
597
  if (!M) {
877
- const oe = Math.abs(u.clientY - b);
878
- if (h && oe < Y)
598
+ const ne = Math.abs(a.clientY - x);
599
+ if (h && ne < $)
879
600
  return;
880
- D(u);
601
+ R(a);
881
602
  }
882
603
  if (!M)
883
604
  return;
884
- T(u.clientY);
885
- const ee = u.clientY - b, W = E - ee;
886
- k(W), u.cancelable && u.preventDefault();
887
- }, R = (u) => {
888
- if (L !== u.pointerId)
605
+ _(a.clientY);
606
+ const G = a.clientY - x, U = T - G;
607
+ P(U), a.cancelable && a.preventDefault();
608
+ }, K = (a) => {
609
+ if (A !== a.pointerId)
889
610
  return;
890
- M && v && u.cancelable && (u.preventDefault(), u.stopPropagation()), l.hasPointerCapture(u.pointerId) && l.releasePointerCapture(u.pointerId);
891
- let ee = 0;
892
- if (M && t.length >= 2) {
893
- const W = t[t.length - 1], oe = t.find((ue) => W.time - ue.time <= m.velocitySampleWindow) ?? t[0];
894
- if (W && oe && W.time !== oe.time) {
895
- const ue = W.clientY - oe.clientY, ge = W.time - oe.time;
896
- ee = -(ue / ge);
611
+ M && p && a.cancelable && (a.preventDefault(), a.stopPropagation()), i.hasPointerCapture(a.pointerId) && i.releasePointerCapture(a.pointerId);
612
+ let G = 0;
613
+ if (M && v.length >= 2) {
614
+ const U = v[v.length - 1], ne = v.find((ue) => U.time - ue.time <= u.velocitySampleWindow) ?? v[0];
615
+ if (U && ne && U.time !== ne.time) {
616
+ const ue = U.clientY - ne.clientY, me = U.time - ne.time;
617
+ G = -(ue / me);
897
618
  }
898
619
  }
899
- o(), I !== null && window.clearTimeout(I), v && (I = window.setTimeout(() => {
900
- v = !1, I = null;
901
- }, 0)), Math.abs(ee) >= m.startVelocityThreshold && B(ee);
902
- }, G = (u) => {
903
- A && (u.button !== 0 && u.pointerType === "mouse" || u.ctrlKey || u.metaKey || u.altKey || y(u.target) || (window.dispatchEvent(new CustomEvent(Pe, { detail: { paneId: X } })), C(), L = u.pointerId, b = u.clientY, E = S.current, h = w(u.target), M = !1, v = !1, t = [], h || (v = !0, D(u), T(u.clientY), u.cancelable && u.preventDefault())));
904
- }, J = (u) => {
905
- L === u.pointerId && (v = !1, l.hasPointerCapture(u.pointerId) && l.releasePointerCapture(u.pointerId), I !== null && (window.clearTimeout(I), I = null), o());
620
+ b(), I !== null && window.clearTimeout(I), p && (I = window.setTimeout(() => {
621
+ p = !1, I = null;
622
+ }, 0)), Math.abs(G) >= u.startVelocityThreshold && W(G);
623
+ }, oe = (a) => {
624
+ E && (a.button !== 0 && a.pointerType === "mouse" || a.ctrlKey || a.metaKey || a.altKey || H(a.target) || (window.dispatchEvent(new CustomEvent(Ee, { detail: { paneId: q } })), F(), A = a.pointerId, x = a.clientY, T = w.current, h = V(a.target), M = !1, p = !1, v = [], h || (p = !0, R(a), _(a.clientY), a.cancelable && a.preventDefault())));
625
+ }, te = (a) => {
626
+ A === a.pointerId && (p = !1, i.hasPointerCapture(a.pointerId) && i.releasePointerCapture(a.pointerId), I !== null && (window.clearTimeout(I), I = null), b());
906
627
  };
907
- return l.addEventListener("click", V, !0), l.addEventListener("pointerdown", G, { passive: !1 }), l.addEventListener("pointermove", _, { passive: !1 }), l.addEventListener("pointerup", R), l.addEventListener("pointercancel", J), window.addEventListener("pointermove", _, { passive: !1 }), window.addEventListener("pointerup", R), window.addEventListener("pointercancel", J), () => {
908
- l.removeEventListener("click", V, !0), l.removeEventListener("pointerdown", G), l.removeEventListener("pointermove", _), l.removeEventListener("pointerup", R), l.removeEventListener("pointercancel", J), window.removeEventListener("pointermove", _), window.removeEventListener("pointerup", R), window.removeEventListener("pointercancel", J), L !== null && l.hasPointerCapture(L) && l.releasePointerCapture(L), I !== null && window.clearTimeout(I), C();
628
+ return i.addEventListener("click", X, !0), i.addEventListener("pointerdown", oe, { passive: !1 }), i.addEventListener("pointermove", S, { passive: !1 }), i.addEventListener("pointerup", K), i.addEventListener("pointercancel", te), window.addEventListener("pointermove", S, { passive: !1 }), window.addEventListener("pointerup", K), window.addEventListener("pointercancel", te), () => {
629
+ i.removeEventListener("click", X, !0), i.removeEventListener("pointerdown", oe), i.removeEventListener("pointermove", S), i.removeEventListener("pointerup", K), i.removeEventListener("pointercancel", te), window.removeEventListener("pointermove", S), window.removeEventListener("pointerup", K), window.removeEventListener("pointercancel", te), A !== null && i.hasPointerCapture(A) && i.releasePointerCapture(A), I !== null && window.clearTimeout(I), F();
909
630
  };
910
- }, [X, A, m, k, B, C]), se;
631
+ }, [q, E, u, P, W, F]), se;
911
632
  });
912
- class st {
633
+ class We {
913
634
  /**
914
635
  * @private
915
636
  * @property {Map<number, number>} tree - The Map storing the Fenwick tree structure, specifically the sums of deltas. It is 1-indexed.
@@ -949,8 +670,8 @@ class st {
949
670
  * @param {number | ((index: number) => number)} valueOrFn - The value for all elements, or a function to generate values.
950
671
  * @param {{ sampleRange?: { from: number; to: number }, materialize?: boolean }} [options] - Optional settings for initialization.
951
672
  */
952
- constructor(e, n, r) {
953
- this.reset(e, n, r);
673
+ constructor(e, n, t) {
674
+ this.reset(e, n, t);
954
675
  }
955
676
  /**
956
677
  * @method reset
@@ -960,20 +681,20 @@ class st {
960
681
  * @param {number | ((index: number) => number)} valueOrFn - The value for all elements, or a function to generate values.
961
682
  * @param {{ sampleRange?: { from: number; to: number }, materialize?: boolean }} [options] - Optional settings for initialization.
962
683
  */
963
- reset(e, n, r) {
684
+ reset(e, n, t) {
964
685
  if (this.size = e, this.tree = /* @__PURE__ */ new Map(), this.deltas = /* @__PURE__ */ new Map(), this.total = void 0, typeof n == "function") {
965
686
  if (this.valueFn = n, this.size > 0) {
966
- const a = r?.sampleRange ?? {
687
+ const o = t?.sampleRange ?? {
967
688
  from: 0,
968
689
  to: Math.min(99, this.size - 1)
969
- }, { mode: i, materializedValues: f } = this._calculateMode(a.from, a.to);
970
- if (this.baseValue = i, r?.materialize)
971
- for (let p = 0; p < f.length; p++) {
972
- const g = f[p], x = a.from + p;
973
- if (x >= this.size)
690
+ }, { mode: s, materializedValues: m } = this._calculateMode(o.from, o.to);
691
+ if (this.baseValue = s, t?.materialize)
692
+ for (let d = 0; d < m.length; d++) {
693
+ const f = m[d], g = o.from + d;
694
+ if (g >= this.size)
974
695
  break;
975
- const P = g - this.baseValue;
976
- this.deltas.set(x, P), this._updateTree(x, P);
696
+ const y = f - this.baseValue;
697
+ this.deltas.set(g, y), this._updateTree(g, y);
977
698
  }
978
699
  } else
979
700
  this.baseValue = 0;
@@ -1002,30 +723,30 @@ class st {
1002
723
  _calculateMode(e, n) {
1003
724
  if (!this.valueFn)
1004
725
  return { mode: 0, materializedValues: [] };
1005
- const r = [];
1006
- for (let g = e; g <= n && !(g >= this.size); g++)
1007
- r.push(this.valueFn(g));
1008
- const s = [...r];
1009
- if (r.length === 0)
726
+ const t = [];
727
+ for (let f = e; f <= n && !(f >= this.size); f++)
728
+ t.push(this.valueFn(f));
729
+ const r = [...t];
730
+ if (t.length === 0)
1010
731
  return { mode: 0, materializedValues: [] };
1011
- r.sort((g, x) => g - x);
1012
- const a = Math.floor(r.length / 2);
1013
- let i;
1014
- r.length % 2 === 0 ? i = Math.floor((r[a - 1] + r[a]) / 2) : i = r[a];
1015
- const f = /* @__PURE__ */ new Map();
1016
- let p = 0;
1017
- for (const g of r) {
1018
- const x = (f.get(g) ?? 0) + 1;
1019
- f.set(g, x), x > p && (p = x);
732
+ t.sort((f, g) => f - g);
733
+ const o = Math.floor(t.length / 2);
734
+ let s;
735
+ t.length % 2 === 0 ? s = Math.floor((t[o - 1] + t[o]) / 2) : s = t[o];
736
+ const m = /* @__PURE__ */ new Map();
737
+ let d = 0;
738
+ for (const f of t) {
739
+ const g = (m.get(f) ?? 0) + 1;
740
+ m.set(f, g), g > d && (d = g);
1020
741
  }
1021
- if (p > 1) {
1022
- const g = [];
1023
- for (const [P, S] of f.entries())
1024
- S === p && g.push(P);
1025
- const x = g.reduce((P, S) => P + S, 0);
1026
- i = Math.floor(x / g.length);
742
+ if (d > 1) {
743
+ const f = [];
744
+ for (const [y, w] of m.entries())
745
+ w === d && f.push(y);
746
+ const g = f.reduce((y, w) => y + w, 0);
747
+ s = Math.floor(g / f.length);
1027
748
  }
1028
- return { mode: i, materializedValues: s };
749
+ return { mode: s, materializedValues: r };
1029
750
  }
1030
751
  /**
1031
752
  * @method update
@@ -1044,14 +765,14 @@ class st {
1044
765
  * @param {{ index: number; value: number }[]} updates - An array of updates, each with an index and the new value.
1045
766
  */
1046
767
  updates(e) {
1047
- const n = e.map(({ index: r, value: s }) => {
1048
- if (r < 0 || r >= this.size)
1049
- throw new Error(`Index ${r} out of bounds`);
1050
- if (s < 0)
768
+ const n = e.map(({ index: t, value: r }) => {
769
+ if (t < 0 || t >= this.size)
770
+ throw new Error(`Index ${t} out of bounds`);
771
+ if (r < 0)
1051
772
  throw new Error("Value cannot be negative.");
1052
- const a = this.deltas.has(r) ? (this.deltas.get(r) ?? 0) + this.baseValue : this.baseValue, i = s - a;
1053
- return { index: r, change: i };
1054
- }).filter((r) => r.change !== 0);
773
+ const o = this.deltas.has(t) ? (this.deltas.get(t) ?? 0) + this.baseValue : this.baseValue, s = r - o;
774
+ return { index: t, change: s };
775
+ }).filter((t) => t.change !== 0);
1055
776
  return n.length > 0 ? this.updateDeltas(n) : this.total;
1056
777
  }
1057
778
  /**
@@ -1071,11 +792,11 @@ class st {
1071
792
  * @param {{ index: number; change: number }[]} updates - An array of updates, each with an index and the change to apply.
1072
793
  */
1073
794
  updateDeltas(e) {
1074
- for (const { index: n, change: r } of e) {
795
+ for (const { index: n, change: t } of e) {
1075
796
  if (n < 0 || n >= this.size)
1076
797
  throw new Error(`Index ${n} out of bounds`);
1077
- const s = this.deltas.get(n) ?? 0;
1078
- this.deltas.set(n, s + r), this._updateTree(n, r);
798
+ const r = this.deltas.get(n) ?? 0;
799
+ this.deltas.set(n, r + t), this._updateTree(n, t);
1079
800
  }
1080
801
  return this.total;
1081
802
  }
@@ -1090,9 +811,9 @@ class st {
1090
811
  _updateTree(e, n) {
1091
812
  if (n === 0)
1092
813
  return;
1093
- let r = e + 1;
1094
- for (; r <= this.size; )
1095
- this.tree.set(r, (this.tree.get(r) ?? 0) + n), r += r & -r;
814
+ let t = e + 1;
815
+ for (; t <= this.size; )
816
+ this.tree.set(t, (this.tree.get(t) ?? 0) + n), t += t & -t;
1096
817
  this.total !== void 0 && (this.total += n);
1097
818
  }
1098
819
  /**
@@ -1105,10 +826,10 @@ class st {
1105
826
  */
1106
827
  _materialize(e, n = !0) {
1107
828
  if (this.valueFn) {
1108
- const r = this.deltas.get(e) ?? 0, a = this.valueFn(e) - this.baseValue;
1109
- if (a !== r && (this.deltas.set(e, a), n)) {
1110
- const i = a - r;
1111
- this._updateTree(e, i);
829
+ const t = this.deltas.get(e) ?? 0, o = this.valueFn(e) - this.baseValue;
830
+ if (o !== t && (this.deltas.set(e, o), n)) {
831
+ const s = o - t;
832
+ this._updateTree(e, s);
1112
833
  }
1113
834
  }
1114
835
  }
@@ -1128,23 +849,23 @@ class st {
1128
849
  prefixSum(e, n) {
1129
850
  if (e < 0)
1130
851
  return { cumulative: 0, total: this.total, currentValue: 0, safeIndex: 0 };
1131
- const r = z(e, 0, this.size - 1), s = n?.materializeOption;
1132
- if (s?.materialize && this.valueFn) {
1133
- if (s.ranges)
1134
- for (const p of s.ranges) {
1135
- const g = p.from, x = Math.min(p.to, this.size - 1);
1136
- for (let P = g; P <= x; P++)
1137
- this._materialize(P);
852
+ const t = C(e, 0, this.size - 1), r = n?.materializeOption;
853
+ if (r?.materialize && this.valueFn) {
854
+ if (r.ranges)
855
+ for (const d of r.ranges) {
856
+ const f = d.from, g = Math.min(d.to, this.size - 1);
857
+ for (let y = f; y <= g; y++)
858
+ this._materialize(y);
1138
859
  }
1139
- this._materialize(r);
860
+ this._materialize(t);
1140
861
  }
1141
- let a = 0, i = r + 1;
1142
- for (; i > 0; ) {
1143
- const p = this.tree.get(i) ?? 0;
1144
- a += p, i -= i & -i;
862
+ let o = 0, s = t + 1;
863
+ for (; s > 0; ) {
864
+ const d = this.tree.get(s) ?? 0;
865
+ o += d, s -= s & -s;
1145
866
  }
1146
- const f = s?.materialize ? this.get(r) : (this.deltas.get(r) || 0) + this.baseValue;
1147
- return { cumulative: a + this.baseValue * (r + 1), total: this.total, currentValue: f, safeIndex: r };
867
+ const m = r?.materialize ? this.get(t) : (this.deltas.get(t) || 0) + this.baseValue;
868
+ return { cumulative: o + this.baseValue * (t + 1), total: this.total, currentValue: m, safeIndex: t };
1148
869
  }
1149
870
  /**
1150
871
  * @method get
@@ -1162,15 +883,15 @@ class st {
1162
883
  get(e, n) {
1163
884
  if (e < 0 || e >= this.size)
1164
885
  throw new Error("Index out of bounds");
1165
- const r = n?.materializeOption;
1166
- if (r?.materialize && this.valueFn)
1167
- if (r.ranges) {
1168
- for (const s of r.ranges) {
1169
- const a = s.from, i = Math.min(s.to, this.size - 1);
1170
- for (let f = a; f <= i; f++)
1171
- this._materialize(f);
886
+ const t = n?.materializeOption;
887
+ if (t?.materialize && this.valueFn)
888
+ if (t.ranges) {
889
+ for (const r of t.ranges) {
890
+ const o = r.from, s = Math.min(r.to, this.size - 1);
891
+ for (let m = o; m <= s; m++)
892
+ this._materialize(m);
1172
893
  }
1173
- e >= r.ranges[0].from && e <= r.ranges[r.ranges.length - 1].to && this._materialize(e);
894
+ e >= t.ranges[0].from && e <= t.ranges[t.ranges.length - 1].to && this._materialize(e);
1174
895
  } else
1175
896
  this._materialize(e);
1176
897
  return (this.deltas.get(e) ?? 0) + this.baseValue;
@@ -1190,19 +911,19 @@ class st {
1190
911
  getTotal(e) {
1191
912
  const n = e?.materializeOption;
1192
913
  if (n?.materialize && this.valueFn && n.ranges)
1193
- for (const r of n.ranges) {
1194
- const s = r.from, a = Math.min(r.to, this.size - 1);
1195
- for (let i = s; i <= a; i++)
1196
- this._materialize(i);
914
+ for (const t of n.ranges) {
915
+ const r = t.from, o = Math.min(t.to, this.size - 1);
916
+ for (let s = r; s <= o; s++)
917
+ this._materialize(s);
1197
918
  }
1198
919
  if (this.total === void 0)
1199
920
  if (this.size === 0)
1200
921
  this.total = 0;
1201
922
  else {
1202
- let r = this.baseValue * this.size;
1203
- for (const s of this.deltas.values())
1204
- r += s;
1205
- this.total = r, console.assert(this.prefixSum(this.getSize() - 1).cumulative === this.prefixSum(this.getSize() - 1).total, "Inconsistent Fenwick Tree state");
923
+ let t = this.baseValue * this.size;
924
+ for (const r of this.deltas.values())
925
+ t += r;
926
+ this.total = t, console.assert(this.prefixSum(this.getSize() - 1).cumulative === this.prefixSum(this.getSize() - 1).total, "Inconsistent Fenwick Tree state");
1206
927
  }
1207
928
  return this.total;
1208
929
  }
@@ -1215,20 +936,20 @@ class st {
1215
936
  */
1216
937
  rebuildTree(e) {
1217
938
  if (e?.materialize && this.valueFn) {
1218
- const s = this.valueFn;
1219
- this.reset(this.size, (a) => s(a), { materialize: !0 });
939
+ const r = this.valueFn;
940
+ this.reset(this.size, (o) => r(o), { materialize: !0 });
1220
941
  return;
1221
942
  }
1222
943
  const n = /* @__PURE__ */ new Map();
1223
- let r = this.baseValue * this.size;
1224
- for (const [s, a] of this.deltas.entries()) {
1225
- if (r += a, a === 0)
944
+ let t = this.baseValue * this.size;
945
+ for (const [r, o] of this.deltas.entries()) {
946
+ if (t += o, o === 0)
1226
947
  continue;
1227
- let i = s + 1;
1228
- for (; i <= this.size; )
1229
- n.set(i, (n.get(i) ?? 0) + a), i += i & -i;
948
+ let s = r + 1;
949
+ for (; s <= this.size; )
950
+ n.set(s, (n.get(s) ?? 0) + o), s += s & -s;
1230
951
  }
1231
- this.tree = n, this.total = r;
952
+ this.tree = n, this.total = t;
1232
953
  }
1233
954
  /**
1234
955
  * @method calculateAccumulatedError
@@ -1254,8 +975,8 @@ class st {
1254
975
  const n = this.size;
1255
976
  if (e !== n) {
1256
977
  if (e < n)
1257
- for (const r of this.deltas.keys())
1258
- r >= e && this.deltas.delete(r);
978
+ for (const t of this.deltas.keys())
979
+ t >= e && this.deltas.delete(t);
1259
980
  this.size = e, this.rebuildTree(), console.assert(this.prefixSum(this.getSize() - 1).cumulative === this.prefixSum(this.getSize() - 1).total, "Inconsistent Fenwick Tree state");
1260
981
  }
1261
982
  }
@@ -1284,12 +1005,12 @@ class st {
1284
1005
  findIndexAtOrAfter(e, n) {
1285
1006
  if (this.size === 0)
1286
1007
  return { index: -1, total: this.total ?? 0, cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
1287
- let r = 0, s = this.size - 1, a = -1, i, f = this.total;
1288
- for (; r <= s; ) {
1289
- const p = Math.floor((r + s) / 2);
1290
- i = this.prefixSum(p, n), f = i.total, i.cumulative >= e ? (a = p, s = p - 1) : r = p + 1;
1008
+ let t = 0, r = this.size - 1, o = -1, s, m = this.total;
1009
+ for (; t <= r; ) {
1010
+ const d = Math.floor((t + r) / 2);
1011
+ s = this.prefixSum(d, n), m = s.total, s.cumulative >= e ? (o = d, r = d - 1) : t = d + 1;
1291
1012
  }
1292
- return { index: a, total: f, cumulative: i?.cumulative, currentValue: i?.currentValue, safeIndex: i?.safeIndex };
1013
+ return { index: o, total: m, cumulative: s?.cumulative, currentValue: s?.currentValue, safeIndex: s?.safeIndex };
1293
1014
  }
1294
1015
  /**
1295
1016
  * @method findIndexAtOrBefore
@@ -1307,163 +1028,163 @@ class st {
1307
1028
  findIndexAtOrBefore(e, n) {
1308
1029
  if (this.size === 0)
1309
1030
  return { index: -1, total: this.total ?? 0, cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
1310
- let r = 0, s = this.size - 1, a = -1, i, f = this.total;
1311
- for (; r <= s; ) {
1312
- const p = Math.floor((r + s) / 2);
1313
- i = this.prefixSum(p, n), f = i.total, i.cumulative <= e ? (a = p, r = p + 1) : s = p - 1;
1031
+ let t = 0, r = this.size - 1, o = -1, s, m = this.total;
1032
+ for (; t <= r; ) {
1033
+ const d = Math.floor((t + r) / 2);
1034
+ s = this.prefixSum(d, n), m = s.total, s.cumulative <= e ? (o = d, t = d + 1) : r = d - 1;
1314
1035
  }
1315
- return { index: a, total: f, cumulative: i?.cumulative, currentValue: i?.currentValue, safeIndex: i?.safeIndex };
1036
+ return { index: o, total: m, cumulative: s?.cumulative, currentValue: s?.currentValue, safeIndex: s?.safeIndex };
1316
1037
  }
1317
1038
  }
1318
- const ot = (c, e, n) => {
1319
- const r = Math.max(0, c), s = H(null), a = U(() => new st(r, e, n), [r, e, n]);
1320
- return Object.is(s.current, a) || console.warn("[useFenwickMapTree] instance changed"), s.current = a, a;
1039
+ const Ge = (c, e, n) => {
1040
+ const t = Math.max(0, c), r = N(null), o = O(() => new We(t, e, n), [t, e, n]);
1041
+ return Object.is(r.current, o) || console.warn("[useFenwickMapTree] instance changed"), r.current = o, o;
1321
1042
  };
1322
- function at({ itemCount: c, getItem: e, getItemHeight: n, viewportSize: r, overscanCount: s = 5, className: a, onScroll: i, onRangeChange: f, children: p, background: g, initialScrollIndex: x, initialScrollOffset: P, tapScrollCircleOptions: S, inertiaOptions: ne }, ie) {
1323
- const N = H(null), K = H(!1);
1324
- ae(() => (K.current = !0, () => {
1325
- K.current = !1;
1043
+ function Ze({ itemCount: c, getItem: e, getItemHeight: n, viewportSize: t, overscanCount: r = 5, className: o, onScroll: s, onRangeChange: m, children: d, background: f, initialScrollIndex: g, initialScrollOffset: y, tapScrollCircleOptions: w, inertiaOptions: ie }, ae) {
1044
+ const Y = N(null), Q = N(!1);
1045
+ re(() => (Q.current = !0, () => {
1046
+ Q.current = !1;
1326
1047
  }), []);
1327
- const F = H({ size: c, valueOrFn: n, options: { sampleRange: { from: 0, to: 100 } } }), m = ot(F.current.size, F.current.valueOrFn, F.current.options), [Z] = le(() => {
1328
- let h = 0, v = 0;
1329
- if (typeof x == "number") {
1330
- const I = z(x, 0, c - 1), t = z(I - s * 2, 0, c - 1), o = z(I + s * 2, 0, c - 1), T = x > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: t, to: o }] } } : void 0, { cumulative: y, total: w, currentValue: V } = m.prefixSum(x, T);
1331
- h = y - V, v = w ?? m.getTotal();
1332
- } else typeof P == "number" && (h = P), v = m.getTotal();
1333
- return { position: h, total: v };
1334
- }), [A, k] = le(Z.position), [C, B] = le(Z.total), [X, se] = le(Z.position), [l, Y] = le(c);
1335
- be(() => {
1336
- m.setValueFn(n), l !== c && (m.changeSize(c), Y(c));
1337
- const h = m.getTotal();
1338
- C !== h && B(h);
1339
- }, [m, l, c, C, n]), be(() => {
1340
- X !== null && N.current && (re.debug("[VirtualScroll] Scrolling to position:", X), N.current.scrollTo(X), se(null));
1341
- }, [X]);
1342
- const j = $(
1048
+ const D = N({ size: c, valueOrFn: n, options: { sampleRange: { from: 0, to: 100 } } }), u = Ge(D.current.size, D.current.valueOrFn, D.current.options), [ee] = le(() => {
1049
+ let h = 0, p = 0;
1050
+ if (typeof g == "number") {
1051
+ const I = C(g, 0, c - 1), v = C(I - r * 2, 0, c - 1), b = C(I + r * 2, 0, c - 1), _ = g > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: v, to: b }] } } : void 0, { cumulative: H, total: V, currentValue: X } = u.prefixSum(g, _);
1052
+ h = H - X, p = V ?? u.getTotal();
1053
+ } else typeof y == "number" && (h = y), p = u.getTotal();
1054
+ return { position: h, total: p };
1055
+ }), [E, P] = le(ee.position), [F, W] = le(ee.total), [q, se] = le(ee.position), [i, $] = le(c);
1056
+ ve(() => {
1057
+ u.setValueFn(n), i !== c && (u.changeSize(c), $(c));
1058
+ const h = u.getTotal();
1059
+ F !== h && W(h);
1060
+ }, [u, i, c, F, n]), ve(() => {
1061
+ q !== null && Y.current && (J.debug("[VirtualScroll] Scrolling to position:", q), Y.current.scrollTo(q), se(null));
1062
+ }, [q]);
1063
+ const k = z(
1343
1064
  (h) => {
1344
- if (N.current) {
1345
- re.debug("[VirtualScroll] Scrolling to index:", h);
1346
- const v = z(h, 0, l - 1), I = z(v - s * 2, 0, l - 1), t = z(v + s * 2, 0, l - 1), { cumulative: o, total: T, currentValue: y } = m.prefixSum(v, { materializeOption: { materialize: !0, ranges: [{ from: I, to: t }] } });
1347
- re.debug("[VirtualScroll] Scrolling to index:", h, "Offset:", o, "Total height:", T, "Current value:", y, "safeIndex:", v, "safeIndexFrom:", I, "safeIndexTo:", t), T && (B(T), se(o - y)), re.debug("[VirtualScroll] Setting scroll position to:", o - y);
1065
+ if (Y.current) {
1066
+ J.debug("[VirtualScroll] Scrolling to index:", h);
1067
+ const p = C(h, 0, i - 1), I = C(p - r * 2, 0, i - 1), v = C(p + r * 2, 0, i - 1), { cumulative: b, total: _, currentValue: H } = u.prefixSum(p, { materializeOption: { materialize: !0, ranges: [{ from: I, to: v }] } });
1068
+ J.debug("[VirtualScroll] Scrolling to index:", h, "Offset:", b, "Total height:", _, "Current value:", H, "safeIndex:", p, "safeIndexFrom:", I, "safeIndexTo:", v), _ && (W(_), se(b - H)), J.debug("[VirtualScroll] Setting scroll position to:", b - H);
1348
1069
  }
1349
1070
  },
1350
- [m, s, l]
1351
- ), L = $(
1071
+ [u, r, i]
1072
+ ), A = z(
1352
1073
  (h) => {
1353
- if (N.current) {
1354
- const v = m.getTotal(), I = z(Math.floor(h), 0, v), t = m.findIndexAtOrAfter(I, { materializeOption: { materialize: !1 } }).index;
1355
- j(t);
1074
+ if (Y.current) {
1075
+ const p = u.getTotal(), I = C(Math.floor(h), 0, p), v = u.findIndexAtOrAfter(I, { materializeOption: { materialize: !1 } }).index;
1076
+ k(v);
1356
1077
  }
1357
1078
  },
1358
- [m, j]
1359
- ), b = $(
1360
- (h, v) => {
1361
- re.debug("[VirtualScroll] Scroll position changed:", h), k(h);
1362
- const I = m.getTotal();
1363
- i?.(h, I);
1079
+ [u, k]
1080
+ ), x = z(
1081
+ (h, p) => {
1082
+ J.debug("[VirtualScroll] Scroll position changed:", h), P(h);
1083
+ const I = u.getTotal();
1084
+ s?.(h, I);
1364
1085
  },
1365
- [m, i]
1366
- ), E = U(() => {
1367
- if (l === 0)
1086
+ [u, s]
1087
+ ), T = O(() => {
1088
+ if (i === 0)
1368
1089
  return { renderingStartIndex: 0, renderingEndIndex: 0, visibleStartIndex: 0, visibleEndIndex: 0 };
1369
- const { index: h, cumulative: v, currentValue: I } = m.findIndexAtOrAfter(A, { materializeOption: { materialize: !1 } });
1370
- let t = 0;
1371
- h === -1 ? t = 0 : (v ?? 0) < A + (I ?? 0) ? t = 1 : t = 0;
1372
- const o = h === -1 ? 0 : h + t, T = z(o - s, 0, l - 1);
1373
- let y = 0, w = h === -1 ? 0 : h + t;
1374
- for (; w < l && y < r; ) {
1375
- const D = n(w);
1376
- y += D, w++;
1090
+ const { index: h, cumulative: p, currentValue: I } = u.findIndexAtOrAfter(E, { materializeOption: { materialize: !1 } });
1091
+ let v = 0;
1092
+ h === -1 ? v = 0 : (p ?? 0) < E + (I ?? 0) ? v = 1 : v = 0;
1093
+ const b = h === -1 ? 0 : h + v, _ = C(b - r, 0, i - 1);
1094
+ let H = 0, V = h === -1 ? 0 : h + v;
1095
+ for (; V < i && H < t; ) {
1096
+ const R = n(V);
1097
+ H += R, V++;
1377
1098
  }
1378
- w -= 1;
1379
- const V = z(w + s, 0, l - 1);
1380
- return re.debug("[VirtualScroll] Calculated rendering range:", {
1381
- renderingStartIndex: T,
1382
- renderingEndIndex: V,
1383
- visibleStartIndex: o,
1384
- visibleEndIndex: w,
1385
- scrollPosition: A,
1386
- renderingContentSize: m.getTotal(),
1387
- overscanCount: s,
1388
- viewportSize: r
1389
- }), { renderingStartIndex: T, renderingEndIndex: V, visibleStartIndex: o, visibleEndIndex: w };
1390
- }, [A, s, r, n, m, l]);
1391
- ae(() => {
1392
- const h = N.current?.getScrollPosition() ?? 0;
1393
- re.debug("[VirtualScroll] Range change effect triggered", {
1394
- renderingStartIndex: E.renderingStartIndex,
1395
- renderingEndIndex: E.renderingEndIndex,
1396
- visibleStartIndex: E.visibleStartIndex,
1397
- visibleEndIndex: E.visibleEndIndex,
1398
- scrollPosition: A,
1399
- contentSize: C,
1099
+ V -= 1;
1100
+ const X = C(V + r, 0, i - 1);
1101
+ return J.debug("[VirtualScroll] Calculated rendering range:", {
1102
+ renderingStartIndex: _,
1103
+ renderingEndIndex: X,
1104
+ visibleStartIndex: b,
1105
+ visibleEndIndex: V,
1106
+ scrollPosition: E,
1107
+ renderingContentSize: u.getTotal(),
1108
+ overscanCount: r,
1109
+ viewportSize: t
1110
+ }), { renderingStartIndex: _, renderingEndIndex: X, visibleStartIndex: b, visibleEndIndex: V };
1111
+ }, [E, r, t, n, u, i]);
1112
+ re(() => {
1113
+ const h = Y.current?.getScrollPosition() ?? 0;
1114
+ J.debug("[VirtualScroll] Range change effect triggered", {
1115
+ renderingStartIndex: T.renderingStartIndex,
1116
+ renderingEndIndex: T.renderingEndIndex,
1117
+ visibleStartIndex: T.visibleStartIndex,
1118
+ visibleEndIndex: T.visibleEndIndex,
1119
+ scrollPosition: E,
1120
+ contentSize: F,
1400
1121
  scrollPaneScrollPosition: h
1401
- }), f?.(E.renderingStartIndex, E.renderingEndIndex, E.visibleStartIndex, E.visibleEndIndex, A, C);
1402
- }, [E.renderingStartIndex, E.renderingEndIndex, E.visibleStartIndex, E.visibleEndIndex, f, A, C]);
1403
- const M = $(
1122
+ }), m?.(T.renderingStartIndex, T.renderingEndIndex, T.visibleStartIndex, T.visibleEndIndex, E, F);
1123
+ }, [T.renderingStartIndex, T.renderingEndIndex, T.visibleStartIndex, T.visibleEndIndex, m, E, F]);
1124
+ const M = z(
1404
1125
  (h) => {
1405
- const { renderingStartIndex: v, renderingEndIndex: I } = E;
1406
- if (re.debug("[VirtualScroll] Rendering visible items", { currentScrollPosition: h, renderingStartIndex: v, renderingEndIndex: I, fenwickSize: l, viewportSize: r }), l === 0)
1407
- return /* @__PURE__ */ q.jsx("div", { className: "absolute w-full", style: { top: 0 }, children: /* @__PURE__ */ q.jsx("div", { className: "text-center text-gray-500", children: "No items" }) });
1408
- const t = z(v, 0, l - 1), { cumulative: o, currentValue: T } = m.prefixSum(t, { materializeOption: { materialize: !1 } }), y = o - T, w = [], V = [];
1409
- for (let _ = v; _ <= I; _++) {
1410
- const R = n(_);
1411
- w.push({ item: e(_), height: R }), m.get(_) !== R && V.push({ index: _, value: R });
1126
+ const { renderingStartIndex: p, renderingEndIndex: I } = T;
1127
+ if (J.debug("[VirtualScroll] Rendering visible items", { currentScrollPosition: h, renderingStartIndex: p, renderingEndIndex: I, fenwickSize: i, viewportSize: t }), i === 0)
1128
+ return /* @__PURE__ */ j("div", { className: "absolute w-full", style: { top: 0 }, children: /* @__PURE__ */ j("div", { className: "text-center text-gray-500", children: "No items" }) });
1129
+ const v = C(p, 0, i - 1), { cumulative: b, currentValue: _ } = u.prefixSum(v, { materializeOption: { materialize: !1 } }), H = b - _, V = [], X = [];
1130
+ for (let S = p; S <= I; S++) {
1131
+ const K = n(S);
1132
+ V.push({ item: e(S), height: K }), u.get(S) !== K && X.push({ index: S, value: K });
1412
1133
  }
1413
- V.length > 0 && Promise.resolve().then(() => {
1414
- const _ = m.updates(V);
1415
- _ && (B(_), re.debug("[VirtualScroll] Updated heights for items", V, "New total height:", _));
1134
+ X.length > 0 && Promise.resolve().then(() => {
1135
+ const S = u.updates(X);
1136
+ S && (W(S), J.debug("[VirtualScroll] Updated heights for items", X, "New total height:", S));
1416
1137
  });
1417
- const D = C < r ? 0 : y - h;
1418
- return re.debug("[VirtualScroll] Rendering items", { visibleItems: w, containerTop: D }), /* @__PURE__ */ q.jsx("div", { className: "absolute w-full", style: { top: D }, children: w.map(({ item: _, height: R }, G) => {
1419
- const J = v + G, u = z(J, 0, l - 1), { cumulative: ee, currentValue: W } = m.prefixSum(u, { materializeOption: { materialize: !1 } }), oe = ee - W;
1420
- return /* @__PURE__ */ q.jsx(
1138
+ const R = F < t ? 0 : H - h;
1139
+ return J.debug("[VirtualScroll] Rendering items", { visibleItems: V, containerTop: R }), /* @__PURE__ */ j("div", { className: "absolute w-full", style: { top: R }, children: V.map(({ item: S, height: K }, oe) => {
1140
+ const te = p + oe, a = C(te, 0, i - 1), { cumulative: G, currentValue: U } = u.prefixSum(a, { materializeOption: { materialize: !1 } }), ne = G - U;
1141
+ return /* @__PURE__ */ j(
1421
1142
  "div",
1422
1143
  {
1423
- "data-index": J,
1144
+ "data-index": te,
1424
1145
  style: {
1425
1146
  position: "absolute",
1426
- top: oe - y,
1147
+ top: ne - H,
1427
1148
  width: "100%"
1428
1149
  },
1429
- children: p(_, J)
1150
+ children: d(S, te)
1430
1151
  },
1431
- J
1152
+ te
1432
1153
  );
1433
1154
  }) });
1434
1155
  },
1435
- [e, p, C, r, E, m, l, n]
1156
+ [e, d, F, t, T, u, i, n]
1436
1157
  );
1437
- return Ae(
1438
- ie,
1158
+ return Me(
1159
+ ae,
1439
1160
  () => ({
1440
- getScrollPosition: () => N.current?.getScrollPosition() ?? -1,
1441
- getContentSize: () => N.current?.getContentSize() ?? -1,
1442
- getViewportSize: () => N.current?.getViewportSize() ?? -1,
1443
- scrollTo: (h) => L(h),
1444
- scrollToIndex: (h) => j(h),
1445
- getFenwickTreeTotalHeight: () => m.getTotal(),
1446
- getFenwickSize: () => m.getSize()
1161
+ getScrollPosition: () => Y.current?.getScrollPosition() ?? -1,
1162
+ getContentSize: () => Y.current?.getContentSize() ?? -1,
1163
+ getViewportSize: () => Y.current?.getViewportSize() ?? -1,
1164
+ scrollTo: (h) => A(h),
1165
+ scrollToIndex: (h) => k(h),
1166
+ getFenwickTreeTotalHeight: () => u.getTotal(),
1167
+ getFenwickSize: () => u.getSize()
1447
1168
  }),
1448
- [j, m, L]
1449
- ), /* @__PURE__ */ q.jsx(
1450
- nt,
1169
+ [k, u, A]
1170
+ ), /* @__PURE__ */ j(
1171
+ Be,
1451
1172
  {
1452
- ref: N,
1453
- contentSize: C,
1454
- viewportSize: r,
1455
- className: a,
1456
- onScroll: b,
1457
- background: g,
1458
- tapScrollCircleOptions: S,
1459
- inertiaOptions: ne,
1173
+ ref: Y,
1174
+ contentSize: F,
1175
+ viewportSize: t,
1176
+ className: o,
1177
+ onScroll: x,
1178
+ background: f,
1179
+ tapScrollCircleOptions: w,
1180
+ inertiaOptions: ie,
1460
1181
  itemCount: c,
1461
1182
  children: M
1462
1183
  }
1463
1184
  );
1464
1185
  }
1465
- const ft = Re(at);
1466
- class it {
1186
+ const st = Ve(Ze);
1187
+ class Je {
1467
1188
  key;
1468
1189
  value;
1469
1190
  prev = null;
@@ -1472,7 +1193,7 @@ class it {
1472
1193
  this.key = e, this.value = n;
1473
1194
  }
1474
1195
  }
1475
- class Ce {
1196
+ class Fe {
1476
1197
  head = null;
1477
1198
  tail = null;
1478
1199
  /**
@@ -1513,54 +1234,54 @@ class Ce {
1513
1234
  this.remove(e), this.addToTail(e);
1514
1235
  }
1515
1236
  }
1516
- function lt(c) {
1517
- const e = H(/* @__PURE__ */ new Map()), n = H(new Ce());
1518
- ae(() => {
1237
+ function Qe(c) {
1238
+ const e = N(/* @__PURE__ */ new Map()), n = N(new Fe());
1239
+ re(() => {
1519
1240
  for (; e.current.size > c; ) {
1520
- const g = n.current.removeHead();
1521
- if (g)
1522
- e.current.delete(g.key);
1241
+ const f = n.current.removeHead();
1242
+ if (f)
1243
+ e.current.delete(f.key);
1523
1244
  else
1524
1245
  break;
1525
1246
  }
1526
1247
  }, [c]);
1527
- const r = $((g) => {
1528
- const x = e.current.get(g);
1529
- if (x)
1530
- return n.current.moveToTail(x), x.value;
1531
- }, []), s = $(
1532
- (g, x) => {
1248
+ const t = z((f) => {
1249
+ const g = e.current.get(f);
1250
+ if (g)
1251
+ return n.current.moveToTail(g), g.value;
1252
+ }, []), r = z(
1253
+ (f, g) => {
1533
1254
  if (c <= 0)
1534
1255
  return;
1535
- let P = e.current.get(g);
1536
- if (P)
1537
- P.value = x, n.current.moveToTail(P);
1256
+ let y = e.current.get(f);
1257
+ if (y)
1258
+ y.value = g, n.current.moveToTail(y);
1538
1259
  else {
1539
1260
  if (e.current.size >= c) {
1540
- const S = n.current.removeHead();
1541
- S && e.current.delete(S.key);
1261
+ const w = n.current.removeHead();
1262
+ w && e.current.delete(w.key);
1542
1263
  }
1543
- P = new it(g, x), e.current.set(g, P), n.current.addToTail(P);
1264
+ y = new Je(f, g), e.current.set(f, y), n.current.addToTail(y);
1544
1265
  }
1545
1266
  },
1546
1267
  [c]
1547
- ), a = $((g) => e.current.has(g), []), i = $(() => {
1548
- e.current.clear(), n.current = new Ce();
1549
- }, []), [f, p] = le(() => ({ get: r, set: s, has: a, clear: i }));
1550
- return ae(() => p({ get: r, set: s, has: a, clear: i }), [r, s, a, i]), f;
1268
+ ), o = z((f) => e.current.has(f), []), s = z(() => {
1269
+ e.current.clear(), n.current = new Fe();
1270
+ }, []), [m, d] = le(() => ({ get: t, set: r, has: o, clear: s }));
1271
+ return re(() => d({ get: t, set: r, has: o, clear: s }), [t, r, o, s]), m;
1551
1272
  }
1552
- const ct = 1e4, mt = () => {
1553
- const { get: c, set: e, has: n, clear: r } = lt(ct);
1554
- return { get: c, set: e, has: n, clear: r };
1273
+ const et = 1e4, it = () => {
1274
+ const { get: c, set: e, has: n, clear: t } = Qe(et);
1275
+ return { get: c, set: e, has: n, clear: t };
1555
1276
  };
1556
1277
  export {
1557
- st as FenwickMapTree,
1558
- rt as ScrollBar,
1559
- nt as ScrollPane,
1560
- ft as VirtualScroll,
1561
- z as minmax,
1562
- ot as useFenwickMapTree,
1563
- mt as useHeightCache,
1564
- lt as useLruCache
1278
+ We as FenwickMapTree,
1279
+ Ke as ScrollBar,
1280
+ Be as ScrollPane,
1281
+ st as VirtualScroll,
1282
+ C as minmax,
1283
+ Ge as useFenwickMapTree,
1284
+ it as useHeightCache,
1285
+ Qe as useLruCache
1565
1286
  };
1566
1287
  //# sourceMappingURL=index.js.map