@himanshu-sorathiya/react-kit 1.0.26 → 1.0.28

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.
@@ -1,25 +1,41 @@
1
1
  import { t as e } from "./useEventListener.js";
2
2
  import { t } from "./utils.js";
3
3
  import { useCallback as n, useEffect as r, useLayoutEffect as i, useMemo as a, useRef as o, useState as s } from "react";
4
- //#region src/performance/useDebounce/useDebounce.ts
5
- function c(e, t = {}) {
6
- let i = Math.max(0, Number(e) || 0), [a, c] = s(!1), l = t?.maxWait, u = !!t?.leading, d = !u && t?.trailing === !1 ? !0 : t?.trailing ?? !u, f = o(null), p = o(null), m = o(null), h = o(-1), g = o(-1), _ = n(() => {
7
- m.current &&= (clearTimeout(m.current), null), h.current = -1, g.current = -1, p.current = null, f.current = null, c(!1);
4
+ //#region src/performance/useDebouncer/useDebouncer.ts
5
+ var c = globalThis.process?.env?.NODE_ENV !== "production";
6
+ function l(e, t = {}) {
7
+ let i = Math.max(0, Number(e) || 0);
8
+ c && (typeof e != "number" || !Number.isFinite(e) || e < 0) && console.warn(`[useDebouncer] Received an invalid \`delay\` (${String(e)}) — falling back to ${i}ms.`);
9
+ let [a, l] = s(!1), u = t?.maxWait, d = !!t?.leading, f = t?.trailing ?? !0;
10
+ c && !d && !f && console.warn("[useDebouncer] Both `leading` and `trailing` are false — the debounced function will never be invoked."), c && u !== void 0 && u < i && console.warn(`[useDebouncer] \`maxWait\` (${u}ms) is smaller than \`delay\` (${i}ms) — the function will fire on almost every call.`);
11
+ let p = o(null), m = o(null), h = o(null), g = o(-1), _ = n(() => {
12
+ h.current !== null && (clearTimeout(h.current), h.current = null), g.current = -1, m.current = null, p.current = null, l(!1);
8
13
  }, []), v = n(() => {
9
- m.current && f.current && p.current && (clearTimeout(m.current), m.current = null, f.current(...p.current), h.current = Date.now(), g.current = -1, p.current = null, f.current = null, c(!1));
14
+ let e = p.current, t = m.current;
15
+ h.current === null || e === null || t === null || (clearTimeout(h.current), h.current = null, g.current = -1, m.current = null, p.current = null, l(!1), e(...t));
10
16
  }, []);
11
- return r(() => () => {
12
- _();
13
- }, [_]), {
17
+ return r(() => _, [_]), {
14
18
  run: n((e, ...t) => {
15
- c(!0), g.current = Date.now(), p.current = t, f.current = e, h.current === -1 && (h.current = Date.now(), u === !0 && f.current(...t)), l !== void 0 && Date.now() - h.current >= l ? (m.current && clearTimeout(m.current), f.current && f.current(...t), h.current = -1, c(!1)) : (m.current && clearTimeout(m.current), m.current = setTimeout(() => {
16
- g.current !== h.current && d !== !1 && f.current && p.current && f.current(...p.current), h.current = -1, c(!1);
17
- }, i));
19
+ let n = Date.now();
20
+ if (p.current = e, m.current = t, g.current === -1 && (g.current = n, d)) {
21
+ let e = p.current, t = m.current;
22
+ m.current = null, e(...t);
23
+ }
24
+ let r = p.current, a = m.current;
25
+ if (u !== void 0 && r !== null && a !== null && n - g.current >= u) {
26
+ h.current !== null && (clearTimeout(h.current), h.current = null), g.current = -1, m.current = null, p.current = null, l(!1), r(...a);
27
+ return;
28
+ }
29
+ h.current !== null && clearTimeout(h.current), h.current = setTimeout(() => {
30
+ h.current = null;
31
+ let e = p.current, t = m.current;
32
+ g.current = -1, m.current = null, p.current = null, l(!1), f && e !== null && t !== null && e(...t);
33
+ }, i), l(f);
18
34
  }, [
19
35
  i,
20
- l,
21
- d,
22
- u
36
+ u,
37
+ f,
38
+ d
23
39
  ]),
24
40
  cancel: _,
25
41
  flush: v,
@@ -27,121 +43,219 @@ function c(e, t = {}) {
27
43
  };
28
44
  }
29
45
  //#endregion
30
- //#region src/performance/useDebounce/useDebouncedCallback.ts
31
- function l(e, t, i = {}) {
46
+ //#region src/performance/useDebouncer/useDebouncedCallback.ts
47
+ var u = globalThis.process?.env?.NODE_ENV !== "production";
48
+ function d(e, t, i = {}) {
49
+ u && typeof e != "function" && console.warn(`[useDebouncedCallback] Expected \`func\` to be a function, received ${typeof e}.`);
32
50
  let a = o(e);
33
51
  r(() => {
34
52
  a.current = e;
35
53
  }, [e]);
36
- let { run: s, cancel: l, flush: u, isPending: d } = c(t, i);
54
+ let { run: s, cancel: c, flush: d, isPending: f } = l(t, i);
37
55
  return {
38
56
  debouncedFunc: n((...e) => {
39
57
  s(a.current, ...e);
40
58
  }, [s]),
41
- cancel: l,
42
- flush: u,
43
- isPending: d
59
+ cancel: c,
60
+ flush: d,
61
+ isPending: f
44
62
  };
45
63
  }
46
64
  //#endregion
47
- //#region src/performance/useDebounce/useDebouncedState.ts
48
- function u(e, t, n = {}) {
49
- let [r, i] = s(e), { debouncedFunc: a, cancel: o, flush: c, isPending: u } = l((e) => {
50
- i(e);
51
- }, t, n);
65
+ //#region src/shared/rateControlShared/utils.ts
66
+ function f(e) {
67
+ return typeof e == "function";
68
+ }
69
+ //#endregion
70
+ //#region src/performance/useDebouncer/useDebouncedState.ts
71
+ var p = globalThis.process?.env?.NODE_ENV !== "production";
72
+ function m(e, t, r = {}) {
73
+ p && r.equalityFn !== void 0 && typeof r.equalityFn != "function" && console.warn("[useDebouncedState] `equalityFn` must be a function — falling back to `Object.is`.");
74
+ let i = typeof r.equalityFn == "function" ? r.equalityFn : Object.is, [a, c] = s(e), l = o(a), { debouncedFunc: u, cancel: m, flush: h, isPending: g } = d(n((e) => {
75
+ c((t) => i(t, e) ? t : e);
76
+ }, [i]), t, r);
52
77
  return [
53
- r,
54
78
  a,
79
+ n((e) => {
80
+ let t = f(e) ? e(l.current) : e;
81
+ l.current = t, u(t);
82
+ }, [u]),
55
83
  {
56
- isPending: u,
57
- cancel: o,
58
- flush: c,
59
- forceSetValue: i
84
+ isPending: g,
85
+ cancel: n(() => {
86
+ m(), c((e) => (l.current = e, e));
87
+ }, [m]),
88
+ flush: h,
89
+ forceSetValue: n((e) => {
90
+ m(), c((t) => {
91
+ let n = f(e) ? e(t) : e;
92
+ return l.current = n, n;
93
+ });
94
+ }, [m])
60
95
  }
61
96
  ];
62
97
  }
63
98
  //#endregion
64
- //#region src/performance/useDebounce/useDebouncedValue.ts
65
- function d(e, t, n = {}) {
66
- let [i, a] = s(e), { debouncedFunc: o } = l((e) => {
67
- a(e);
99
+ //#region src/performance/useDebouncer/useDebouncedValue.ts
100
+ var h = globalThis.process?.env?.NODE_ENV !== "production";
101
+ function g(e, t, n = {}) {
102
+ h && n.equalityFn !== void 0 && typeof n.equalityFn != "function" && console.warn("[useDebouncedValue] `equalityFn` must be a function — falling back to `Object.is`.");
103
+ let i = typeof n.equalityFn == "function" ? n.equalityFn : Object.is, [a, o] = s(e), { debouncedFunc: c, cancel: l, flush: u, isPending: f } = d((e) => {
104
+ o((t) => i(t, e) ? t : e);
68
105
  }, t, n);
69
106
  return r(() => {
70
- o(e);
71
- }, [e, o]), i;
107
+ c(e);
108
+ }, [e, c]), [a, {
109
+ isPending: f,
110
+ cancel: l,
111
+ flush: u
112
+ }];
72
113
  }
73
114
  //#endregion
74
- //#region src/performance/useRateLimit/useRateLimit.ts
75
- function f(e, t, i) {
76
- let a = Math.max(1, Number(e) || 1), c = Math.max(0, Number(t) || 0), [l, u] = s(a), d = i?.refillStrategy ?? "burst", f = o(i?.onRateLimitReached);
115
+ //#region src/performance/useRateLimiter/useRateLimiter.ts
116
+ var _ = globalThis.process?.env?.NODE_ENV !== "production";
117
+ function v(e, t, i) {
118
+ let a = Math.max(1, Math.floor(Number(e) || 1)), c = Math.max(0, Number(t) || 0);
119
+ _ && (typeof e != "number" || !Number.isFinite(e) || e < 1) && console.warn(`[useRateLimiter] Received an invalid \`limit\` (${String(e)}) — falling back to ${a}.`), _ && (typeof t != "number" || !Number.isFinite(t) || t < 0) && console.warn(`[useRateLimiter] Received an invalid \`windowMs\` (${String(t)}) — falling back to ${c}ms.`), _ && c === 0 && console.warn("[useRateLimiter] `windowMs` is 0 — rate limiting is effectively disabled; every call will be allowed."), _ && i?.refillStrategy !== void 0 && i.refillStrategy !== "burst" && i.refillStrategy !== "gradual" && console.warn(`[useRateLimiter] \`refillStrategy\` must be "burst" or "gradual", received "${String(i.refillStrategy)}" — falling back to "burst".`), _ && i?.onRateLimitReached !== void 0 && typeof i.onRateLimitReached != "function" && console.warn("[useRateLimiter] `onRateLimitReached` must be a function — ignoring the provided value.");
120
+ let [l, u] = s(a), d = i?.refillStrategy === "gradual" ? "gradual" : "burst", f = o(typeof i?.onRateLimitReached == "function" ? i.onRateLimitReached : void 0);
77
121
  r(() => {
78
- f.current = i?.onRateLimitReached;
122
+ f.current = typeof i?.onRateLimitReached == "function" ? i.onRateLimitReached : void 0;
79
123
  }, [i?.onRateLimitReached]);
80
- let p = o(a), [m] = s(() => Date.now()), h = o(m), g = o(null);
81
- return r(() => () => {
82
- g.current && clearTimeout(g.current);
83
- }, []), {
84
- run: n((e, ...t) => {
85
- let n = Date.now(), r = n - h.current;
86
- if (d === "burst") r >= c && (p.current = a, h.current = n);
87
- else {
88
- let e = c / a, t = Math.floor(r / e);
89
- t > 0 && (p.current = Math.min(a, p.current + t), h.current += t * e);
90
- }
91
- if (p.current > 0 ? (--p.current, u(p.current), e(...t)) : f.current && f.current(), g.current && clearTimeout(g.current), p.current < a) {
92
- let e = c / a, t = d === "burst" ? c - (Date.now() - h.current) : e - (Date.now() - h.current);
93
- g.current = setTimeout(() => {
94
- u((e) => Math.min(a, e + 1)), h.current = Date.now(), p.current = Math.min(a, p.current + 1);
95
- }, Math.max(0, t));
96
- }
97
- }, [
98
- a,
99
- c,
100
- d
101
- ]),
124
+ let p = o(a), m = o(Date.now()), h = o(null);
125
+ r(() => () => {
126
+ h.current !== null && clearTimeout(h.current);
127
+ }, []);
128
+ let g = n(() => {
129
+ if (c === 0) {
130
+ p.current !== a && (p.current = a, u(a));
131
+ return;
132
+ }
133
+ let e = Date.now(), t = e - m.current;
134
+ if (d === "burst") {
135
+ t >= c && p.current !== a && (p.current = a, m.current = e, u(a));
136
+ return;
137
+ }
138
+ let n = c / a, r = Math.floor(t / n);
139
+ r > 0 && (p.current = Math.min(a, p.current + r), m.current += r * n, u(p.current));
140
+ }, [
141
+ d,
142
+ c,
143
+ a
144
+ ]), v = n(function e() {
145
+ if (h.current !== null && (clearTimeout(h.current), h.current = null), p.current >= a || c === 0) return;
146
+ let t = c / a, n = Date.now() - m.current, r = d === "burst" ? c - n : t - n;
147
+ h.current = setTimeout(() => {
148
+ h.current = null, g(), e();
149
+ }, Math.max(0, r));
150
+ }, [
151
+ a,
152
+ c,
153
+ d,
154
+ g
155
+ ]), y = n(() => {
156
+ h.current !== null && (clearTimeout(h.current), h.current = null), p.current = a, m.current = Date.now(), u(a);
157
+ }, [a]);
158
+ return {
159
+ run: n((e, ...t) => (g(), p.current > 0 ? (--p.current, u(p.current), v(), e(...t), !0) : (f.current?.(), v(), !1)), [g, v]),
160
+ reset: y,
102
161
  remaining: l,
103
162
  isRateLimited: l === 0
104
163
  };
105
164
  }
106
165
  //#endregion
107
- //#region src/performance/useRateLimit/useRateLimitedCallback.ts
108
- function p(e, t, i, a) {
166
+ //#region src/performance/useRateLimiter/useRateLimitedCallback.ts
167
+ var y = globalThis.process?.env?.NODE_ENV !== "production";
168
+ function b(e, t, i, a) {
169
+ y && typeof e != "function" && console.warn(`[useRateLimitedCallback] Expected \`func\` to be a function, received ${typeof e}.`);
109
170
  let s = o(e);
110
171
  r(() => {
111
172
  s.current = e;
112
173
  }, [e]);
113
- let { run: c, remaining: l, isRateLimited: u } = f(t, i, a);
174
+ let { run: c, reset: l, remaining: u, isRateLimited: d } = v(t, i, a);
114
175
  return {
115
- rateLimitedFunc: n((...e) => {
116
- c(s.current, ...e);
117
- }, [c]),
118
- remaining: l,
119
- isRateLimited: u
176
+ rateLimitedFunc: n((...e) => c(s.current, ...e), [c]),
177
+ reset: l,
178
+ remaining: u,
179
+ isRateLimited: d
120
180
  };
121
181
  }
122
182
  //#endregion
123
- //#region src/performance/useThrottle/useThrottle.ts
124
- function m(e, t = {}) {
125
- let i = Math.max(0, Number(e) || 0), [a, c] = s(!1), l = t?.leading ?? !0, u = t?.trailing ?? !0;
126
- l === !1 && u === !1 && (l = !0, u = !0);
183
+ //#region src/performance/useRateLimiter/useRateLimitedState.ts
184
+ var x = globalThis.process?.env?.NODE_ENV !== "production";
185
+ function S(e, t, r, i = {}) {
186
+ x && i.equalityFn !== void 0 && typeof i.equalityFn != "function" && console.warn("[useRateLimitedState] `equalityFn` must be a function — falling back to `Object.is`.");
187
+ let a = typeof i.equalityFn == "function" ? i.equalityFn : Object.is, [o, c] = s(e), l = n((e) => {
188
+ c((t) => {
189
+ let n = f(e) ? e(t) : e;
190
+ return a(t, n) ? t : n;
191
+ });
192
+ }, [a]), { rateLimitedFunc: u, reset: d, remaining: p, isRateLimited: m } = b(l, t, r, i);
193
+ return [
194
+ o,
195
+ n((e) => u(e), [u]),
196
+ {
197
+ remaining: p,
198
+ isRateLimited: m,
199
+ reset: d,
200
+ forceSetValue: n((e) => {
201
+ l(e);
202
+ }, [l])
203
+ }
204
+ ];
205
+ }
206
+ //#endregion
207
+ //#region src/performance/useRateLimiter/useRateLimitedValue.ts
208
+ var C = globalThis.process?.env?.NODE_ENV !== "production";
209
+ function w(e, t, n, i = {}) {
210
+ C && i.equalityFn !== void 0 && typeof i.equalityFn != "function" && console.warn("[useRateLimitedValue] `equalityFn` must be a function — falling back to `Object.is`.");
211
+ let a = typeof i.equalityFn == "function" ? i.equalityFn : Object.is, [c, l] = s(e), { rateLimitedFunc: u, reset: d, remaining: f, isRateLimited: p } = b((e) => {
212
+ l((t) => a(t, e) ? t : e);
213
+ }, t, n, i), m = o(!0);
214
+ return r(() => {
215
+ if (m.current) {
216
+ m.current = !1;
217
+ return;
218
+ }
219
+ u(e);
220
+ }, [e, u]), [c, {
221
+ remaining: f,
222
+ isRateLimited: p,
223
+ reset: d
224
+ }];
225
+ }
226
+ //#endregion
227
+ //#region src/performance/useThrottler/useThrottler.ts
228
+ var T = globalThis.process?.env?.NODE_ENV !== "production";
229
+ function E(e, t = {}) {
230
+ let i = Math.max(0, Number(e) || 0);
231
+ T && (typeof e != "number" || !Number.isFinite(e) || e < 0) && console.warn(`[useThrottler] Received an invalid \`delay\` (${String(e)}) — falling back to ${i}ms.`);
232
+ let [a, c] = s(!1), l = t?.leading ?? !0, u = t?.trailing ?? !0;
233
+ T && !l && !u && console.warn("[useThrottler] Both `leading` and `trailing` are false — the throttled function will never be invoked.");
127
234
  let d = o(null), f = o(null), p = o(null), m = o(-1), h = n(() => {
128
- p.current &&= (clearTimeout(p.current), null), m.current = -1, f.current = null, d.current = null, c(!1);
235
+ p.current !== null && (clearTimeout(p.current), p.current = null), m.current = -1, f.current = null, d.current = null, c(!1);
129
236
  }, []), g = n(() => {
130
- f.current && d.current && (p.current &&= (clearTimeout(p.current), null), d.current(...f.current), m.current = l ? Date.now() : -1, f.current = null, d.current = null, c(!1));
237
+ let e = d.current, t = f.current;
238
+ e === null || t === null || (p.current !== null && (clearTimeout(p.current), p.current = null), m.current = l ? Date.now() : -1, f.current = null, d.current = null, c(!1), e(...t));
131
239
  }, [l]);
132
- return r(() => () => {
133
- h();
134
- }, [h]), {
240
+ return r(() => h, [h]), {
135
241
  run: n((e, ...t) => {
136
- c(!0);
242
+ if (!l && !u) return;
137
243
  let n = Date.now();
138
- if (f.current = t, d.current = e, m.current === -1 ? l : n - m.current >= i) p.current &&= (clearTimeout(p.current), null), d.current(...t), m.current = n, f.current = null, c(!1);
139
- else if (!p.current) {
244
+ if (f.current = t, d.current = e, m.current === -1 ? l : n - m.current >= i) {
245
+ p.current !== null && (clearTimeout(p.current), p.current = null);
246
+ let e = d.current, t = f.current;
247
+ m.current = n, f.current = null, c(!1), e(...t);
248
+ return;
249
+ }
250
+ if (p.current === null) {
140
251
  let e = m.current === -1 ? 0 : n - m.current, t = i - e;
141
252
  p.current = setTimeout(() => {
142
- u && f.current && d.current ? (d.current(...f.current), m.current = l ? Date.now() : -1) : m.current = -1, f.current = null, d.current = null, p.current = null, c(!1);
143
- }, t);
253
+ p.current = null;
254
+ let e = d.current, t = f.current;
255
+ f.current = null, d.current = null, c(!1), u && e !== null && t !== null ? (m.current = l ? Date.now() : -1, e(...t)) : m.current = -1;
256
+ }, Math.max(0, t));
144
257
  }
258
+ c(u);
145
259
  }, [
146
260
  i,
147
261
  l,
@@ -153,13 +267,15 @@ function m(e, t = {}) {
153
267
  };
154
268
  }
155
269
  //#endregion
156
- //#region src/performance/useThrottle/useThrottledCallback.ts
157
- function h(e, t, i = {}) {
270
+ //#region src/performance/useThrottler/useThrottledCallback.ts
271
+ var D = globalThis.process?.env?.NODE_ENV !== "production";
272
+ function O(e, t, i = {}) {
273
+ D && typeof e != "function" && console.warn(`[useThrottledCallback] Expected \`func\` to be a function, received ${typeof e}.`);
158
274
  let a = o(e);
159
275
  r(() => {
160
276
  a.current = e;
161
277
  }, [e]);
162
- let { run: s, cancel: c, flush: l, isPending: u } = m(t, i);
278
+ let { run: s, cancel: c, flush: l, isPending: u } = E(t, i);
163
279
  return {
164
280
  throttledFunc: n((...e) => {
165
281
  s(a.current, ...e);
@@ -170,35 +286,53 @@ function h(e, t, i = {}) {
170
286
  };
171
287
  }
172
288
  //#endregion
173
- //#region src/performance/useThrottle/useThrottledState.ts
174
- function g(e, t, n = {}) {
175
- let [r, i] = s(e), { throttledFunc: a, isPending: o, cancel: c, flush: l } = h((e) => {
176
- i(e);
177
- }, t, n);
289
+ //#region src/performance/useThrottler/useThrottledState.ts
290
+ var k = globalThis.process?.env?.NODE_ENV !== "production";
291
+ function A(e, t, r = {}) {
292
+ k && r.equalityFn !== void 0 && typeof r.equalityFn != "function" && console.warn("[useThrottledState] `equalityFn` must be a function — falling back to `Object.is`.");
293
+ let i = typeof r.equalityFn == "function" ? r.equalityFn : Object.is, [a, c] = s(e), l = o(a), { throttledFunc: u, cancel: d, flush: p, isPending: m } = O(n((e) => {
294
+ c((t) => i(t, e) ? t : e);
295
+ }, [i]), t, r);
178
296
  return [
179
- r,
180
297
  a,
298
+ n((e) => {
299
+ let t = f(e) ? e(l.current) : e;
300
+ l.current = t, u(t);
301
+ }, [u]),
181
302
  {
182
- isPending: o,
183
- cancel: c,
184
- flush: l,
185
- forceSetValue: i
303
+ isPending: m,
304
+ cancel: n(() => {
305
+ d(), c((e) => (l.current = e, e));
306
+ }, [d]),
307
+ flush: p,
308
+ forceSetValue: n((e) => {
309
+ d(), c((t) => {
310
+ let n = f(e) ? e(t) : e;
311
+ return l.current = n, n;
312
+ });
313
+ }, [d])
186
314
  }
187
315
  ];
188
316
  }
189
317
  //#endregion
190
- //#region src/performance/useThrottle/useThrottledValue.ts
191
- function _(e, t, n = {}) {
192
- let [i, a] = s(e), { throttledFunc: o } = h((e) => {
193
- a(e);
318
+ //#region src/performance/useThrottler/useThrottledValue.ts
319
+ var j = globalThis.process?.env?.NODE_ENV !== "production";
320
+ function M(e, t, n = {}) {
321
+ j && n.equalityFn !== void 0 && typeof n.equalityFn != "function" && console.warn("[useThrottledValue] `equalityFn` must be a function — falling back to `Object.is`.");
322
+ let i = typeof n.equalityFn == "function" ? n.equalityFn : Object.is, [a, o] = s(e), { throttledFunc: c, cancel: l, flush: u, isPending: d } = O((e) => {
323
+ o((t) => i(t, e) ? t : e);
194
324
  }, t, n);
195
325
  return r(() => {
196
- o(e);
197
- }, [e, o]), i;
326
+ c(e);
327
+ }, [e, c]), [a, {
328
+ isPending: d,
329
+ cancel: l,
330
+ flush: u
331
+ }];
198
332
  }
199
333
  //#endregion
200
334
  //#region src/shared/virtualShared/offsetCache.ts
201
- var v = class {
335
+ var N = class {
202
336
  _offsets = /* @__PURE__ */ new Float64Array();
203
337
  _count = 0;
204
338
  initializeOffsets(e, t) {
@@ -267,42 +401,42 @@ var v = class {
267
401
  };
268
402
  //#endregion
269
403
  //#region src/shared/virtualShared/utils.ts
270
- function y(e, t) {
404
+ function P(e, t) {
271
405
  let n = typeof t == "function" ? t(e) : t, r = Number(n);
272
406
  return Number.isFinite(r) && r >= 0 ? r : 0;
273
407
  }
274
- function b(e, t, n) {
408
+ function F(e, t, n) {
275
409
  if (e <= 0) return 0;
276
410
  if (typeof t == "number") return e * Math.max(0, t);
277
411
  if (n) return n.getItemStartOffset(e);
278
412
  let r = 0;
279
- for (let n = 0; n < e; n++) r += y(n, t);
413
+ for (let n = 0; n < e; n++) r += P(n, t);
280
414
  return r;
281
415
  }
282
- function x(e, t, n) {
416
+ function I(e, t, n) {
283
417
  if (e <= 0) return 0;
284
418
  if (typeof t == "number") return e * Math.max(0, t);
285
419
  if (n) return n.getTotalSize();
286
420
  let r = 0;
287
- for (let n = 0; n < e; n++) r += y(n, t);
421
+ for (let n = 0; n < e; n++) r += P(n, t);
288
422
  return r;
289
423
  }
290
- function S(e, t) {
424
+ function L(e, t) {
291
425
  if (!e) return 0;
292
426
  let n = t === "vertical";
293
427
  return e instanceof Window ? n ? document.documentElement.clientHeight : document.documentElement.clientWidth : e instanceof Document ? n ? e.documentElement.clientHeight : e.documentElement.clientWidth : n ? e.clientHeight : e.clientWidth;
294
428
  }
295
- function C(e, t) {
429
+ function R(e, t) {
296
430
  if (!e) return 0;
297
431
  let n = t === "vertical";
298
432
  return e instanceof Window ? n ? e.scrollY : e.scrollX : e instanceof Document ? n ? e.documentElement.scrollTop : e.documentElement.scrollLeft : n ? e.scrollTop : e.scrollLeft;
299
433
  }
300
- function w(e) {
434
+ function z(e) {
301
435
  return e ? e instanceof Window ? document.documentElement : e instanceof Document ? e.scrollingElement ?? e.documentElement : e : null;
302
436
  }
303
437
  //#endregion
304
438
  //#region src/performance/useVirtualGrid/utils.ts
305
- function T(e, t, n, r, i, a) {
439
+ function B(e, t, n, r, i, a) {
306
440
  if (n <= 0 || t <= 0) return {
307
441
  startIndex: 0,
308
442
  endIndex: -1
@@ -318,7 +452,7 @@ function T(e, t, n, r, i, a) {
318
452
  o = 0, s = -1;
319
453
  let i = 0, a = !1;
320
454
  for (let c = 0; c < n; c++) {
321
- let n = y(c, r), l = i + n;
455
+ let n = P(c, r), l = i + n;
322
456
  if (!a && l > e && (o = c, a = !0), a) if (i < e + t) s = c;
323
457
  else break;
324
458
  i += n;
@@ -330,8 +464,8 @@ function T(e, t, n, r, i, a) {
330
464
  endIndex: s
331
465
  };
332
466
  }
333
- function E(e, t, n, r, i, a, o) {
334
- let s = o ? o.getItemSize(e) : y(e, a), c = b(e, a, o), l = c + s, u = Math.max(0, r - n), d;
467
+ function V(e, t, n, r, i, a, o) {
468
+ let s = o ? o.getItemSize(e) : P(e, a), c = F(e, a, o), l = c + s, u = Math.max(0, r - n), d;
335
469
  switch (t) {
336
470
  case "start":
337
471
  d = c;
@@ -351,47 +485,47 @@ function E(e, t, n, r, i, a, o) {
351
485
  }
352
486
  //#endregion
353
487
  //#region src/performance/useVirtualGrid/useVirtualGrid.ts
354
- function D(t) {
355
- let { rowCount: c, colCount: u, estimateRowHeight: d, estimateColumnWidth: f, getScrollElement: p, overscanRows: m = 3, overscanCols: h = 3, scrollingDelay: g = 150, initialViewportHeight: _ = 0, initialViewportWidth: D = 0, initialScrollTop: O, initialScrollLeft: k, initialScrollRow: A, initialScrollCol: j, itemKey: M } = t, N = Math.max(0, Math.trunc(Number(c)) || 0), P = Math.max(0, Math.trunc(Number(u)) || 0), F = Math.max(0, Math.trunc(Number(m)) || 0), I = Math.max(0, Math.trunc(Number(h)) || 0), L = o(t);
488
+ function H(t) {
489
+ let { rowCount: c, colCount: l, estimateRowHeight: u, estimateColumnWidth: f, getScrollElement: p, overscanRows: m = 3, overscanCols: h = 3, scrollingDelay: g = 150, initialViewportHeight: _ = 0, initialViewportWidth: v = 0, initialScrollTop: y, initialScrollLeft: b, initialScrollRow: x, initialScrollCol: S, itemKey: C } = t, w = Math.max(0, Math.trunc(Number(c)) || 0), T = Math.max(0, Math.trunc(Number(l)) || 0), E = Math.max(0, Math.trunc(Number(m)) || 0), D = Math.max(0, Math.trunc(Number(h)) || 0), O = o(t);
356
490
  i(() => {
357
- L.current = t;
491
+ O.current = t;
358
492
  });
359
- let R = a(() => {
360
- if (typeof d != "function") return;
361
- let e = new v();
362
- return e.initializeOffsets(N, d), e;
363
- }, [N, d]), z = a(() => {
493
+ let k = a(() => {
494
+ if (typeof u != "function") return;
495
+ let e = new N();
496
+ return e.initializeOffsets(w, u), e;
497
+ }, [w, u]), A = a(() => {
364
498
  if (typeof f != "function") return;
365
- let e = new v();
366
- return e.initializeOffsets(P, f), e;
367
- }, [P, f]), B = o(R), V = o(z);
499
+ let e = new N();
500
+ return e.initializeOffsets(T, f), e;
501
+ }, [T, f]), j = o(k), M = o(A);
368
502
  i(() => {
369
- B.current = R;
370
- }, [R]), i(() => {
371
- V.current = z;
372
- }, [z]);
503
+ j.current = k;
504
+ }, [k]), i(() => {
505
+ M.current = A;
506
+ }, [A]);
373
507
  let [H, U] = s(() => {
374
- if (typeof O == "number") return Math.max(0, O);
375
- if (typeof A == "number" && N > 0) {
376
- let e = Math.max(0, Math.min(Math.trunc(Number(A)) || 0, N - 1));
377
- return R ? R.getItemStartOffset(e) : b(e, d);
508
+ if (typeof y == "number") return Math.max(0, y);
509
+ if (typeof x == "number" && w > 0) {
510
+ let e = Math.max(0, Math.min(Math.trunc(Number(x)) || 0, w - 1));
511
+ return k ? k.getItemStartOffset(e) : F(e, u);
378
512
  }
379
513
  return 0;
380
514
  }), [W, G] = s(() => {
381
- if (typeof k == "number") return Math.max(0, k);
382
- if (typeof j == "number" && P > 0) {
383
- let e = Math.max(0, Math.min(Math.trunc(Number(j)) || 0, P - 1));
384
- return z ? z.getItemStartOffset(e) : b(e, f);
515
+ if (typeof b == "number") return Math.max(0, b);
516
+ if (typeof S == "number" && T > 0) {
517
+ let e = Math.max(0, Math.min(Math.trunc(Number(S)) || 0, T - 1));
518
+ return A ? A.getItemStartOffset(e) : F(e, f);
385
519
  }
386
520
  return 0;
387
- }), [K, q] = s(!1), [, J] = s({}), Y = o(!1), { debouncedFunc: X } = l(() => q(!1), g), Z = p();
521
+ }), [K, q] = s(!1), [, J] = s({}), Y = o(!1), { debouncedFunc: X } = d(() => q(!1), g), Z = p();
388
522
  r(() => {
389
523
  if (!Z) return;
390
524
  if (!Y.current) {
391
525
  Y.current = !0;
392
- let e = typeof O == "number" || typeof A == "number", t = typeof k == "number" || typeof j == "number";
526
+ let e = typeof y == "number" || typeof x == "number", t = typeof b == "number" || typeof S == "number";
393
527
  if (e || t) {
394
- let n = w(Z);
528
+ let n = z(Z);
395
529
  n && n.scrollTo({
396
530
  ...e && { top: H },
397
531
  ...t && { left: W },
@@ -400,21 +534,21 @@ function D(t) {
400
534
  return;
401
535
  }
402
536
  }
403
- let e = C(Z, "vertical"), t = C(Z, "horizontal");
537
+ let e = R(Z, "vertical"), t = R(Z, "horizontal");
404
538
  U((t) => t === e ? t : e), G((e) => e === t ? e : t);
405
539
  }, [
406
540
  Z,
407
- O,
408
- k,
409
- A,
410
- j,
541
+ y,
542
+ b,
543
+ x,
544
+ S,
411
545
  H,
412
546
  W
413
547
  ]);
414
548
  function ee() {
415
- let { getScrollElement: e, scrollingDelay: t } = L.current, n = e();
549
+ let { getScrollElement: e, scrollingDelay: t } = O.current, n = e();
416
550
  if (!n) return;
417
- let r = C(n, "vertical"), i = C(n, "horizontal");
551
+ let r = R(n, "vertical"), i = R(n, "horizontal");
418
552
  U(r), G(i), (t ?? 150) > 0 && (q(!0), X());
419
553
  }
420
554
  e("scroll", ee, {
@@ -427,13 +561,13 @@ function D(t) {
427
561
  let t = new ResizeObserver(e), n = Z instanceof Document ? Z.documentElement : Z;
428
562
  return t.observe(n), () => t.disconnect();
429
563
  }, [Z]);
430
- let te = S(Z, "vertical") || _, ne = S(Z, "horizontal") || D, re = x(N, d, R), ie = x(P, f, z), { startIndex: Q, endIndex: ae } = T(H, te, N, d, F, R), { startIndex: $, endIndex: oe } = T(W, ne, P, f, I, z), se = [];
564
+ let te = L(Z, "vertical") || _, ne = L(Z, "horizontal") || v, re = I(w, u, k), ie = I(T, f, A), { startIndex: Q, endIndex: ae } = B(H, te, w, u, E, k), { startIndex: $, endIndex: oe } = B(W, ne, T, f, D, A), se = [];
431
565
  if (Q <= ae && $ <= oe) {
432
- let e = R ? R.getItemStartOffset(Q) : b(Q, d);
566
+ let e = k ? k.getItemStartOffset(Q) : F(Q, u);
433
567
  for (let t = Q; t <= ae; t++) {
434
- let n = R ? R.getItemSize(t) : y(t, d), r = z ? z.getItemStartOffset($) : b($, f);
568
+ let n = k ? k.getItemSize(t) : P(t, u), r = A ? A.getItemStartOffset($) : F($, f);
435
569
  for (let i = $; i <= oe; i++) {
436
- let a = z ? z.getItemSize(i) : y(i, f), o = M ? M(t, i) : `${t}:${i}`;
570
+ let a = A ? A.getItemSize(i) : P(i, f), o = C ? C(t, i) : `${t}:${i}`;
437
571
  se.push({
438
572
  key: o,
439
573
  rowIndex: t,
@@ -453,9 +587,9 @@ function D(t) {
453
587
  totalWidth: ie,
454
588
  isScrolling: K,
455
589
  scrollToOffset: n((e, t) => {
456
- let { getScrollElement: n, initialViewportHeight: r, initialViewportWidth: i } = L.current, a = n();
590
+ let { getScrollElement: n, initialViewportHeight: r, initialViewportWidth: i } = O.current, a = n();
457
591
  if (!a) return;
458
- let { rowCount: o, colCount: s, estimateRowHeight: c, estimateColumnWidth: l } = L.current, u = Math.max(0, Math.trunc(Number(o)) || 0), d = Math.max(0, Math.trunc(Number(s)) || 0), f = x(u, c, B.current), p = x(d, l, V.current), m = S(a, "vertical") || r || 0, h = S(a, "horizontal") || i || 0, g = Math.max(0, Math.min(e.top, Math.max(0, f - m))), _ = Math.max(0, Math.min(e.left, Math.max(0, p - h))), v = w(a);
592
+ let { rowCount: o, colCount: s, estimateRowHeight: c, estimateColumnWidth: l } = O.current, u = Math.max(0, Math.trunc(Number(o)) || 0), d = Math.max(0, Math.trunc(Number(s)) || 0), f = I(u, c, j.current), p = I(d, l, M.current), m = L(a, "vertical") || r || 0, h = L(a, "horizontal") || i || 0, g = Math.max(0, Math.min(e.top, Math.max(0, f - m))), _ = Math.max(0, Math.min(e.left, Math.max(0, p - h))), v = z(a);
459
593
  v && v.scrollTo({
460
594
  top: g,
461
595
  left: _,
@@ -463,36 +597,36 @@ function D(t) {
463
597
  });
464
598
  }, []),
465
599
  scrollToRow: n((e, t) => {
466
- let { getScrollElement: n, rowCount: r, estimateRowHeight: i, initialViewportHeight: a } = L.current, o = n();
600
+ let { getScrollElement: n, rowCount: r, estimateRowHeight: i, initialViewportHeight: a } = O.current, o = n();
467
601
  if (!o) return;
468
602
  let s = Math.max(0, Math.trunc(Number(r)) || 0);
469
603
  if (s === 0) return;
470
- let c = Math.max(0, Math.min(Math.trunc(Number(e)) || 0, s - 1)), l = S(o, "vertical") || a || 0, u = x(s, i, B.current), d = C(o, "vertical"), f = E(c, t?.align ?? "auto", l, u, d, i, B.current), p = w(o);
604
+ let c = Math.max(0, Math.min(Math.trunc(Number(e)) || 0, s - 1)), l = L(o, "vertical") || a || 0, u = I(s, i, j.current), d = R(o, "vertical"), f = V(c, t?.align ?? "auto", l, u, d, i, j.current), p = z(o);
471
605
  p && p.scrollTo({
472
606
  top: f,
473
607
  behavior: t?.smooth === !0 ? "smooth" : "auto"
474
608
  });
475
609
  }, []),
476
610
  scrollToColumn: n((e, t) => {
477
- let { getScrollElement: n, colCount: r, estimateColumnWidth: i, initialViewportWidth: a } = L.current, o = n();
611
+ let { getScrollElement: n, colCount: r, estimateColumnWidth: i, initialViewportWidth: a } = O.current, o = n();
478
612
  if (!o) return;
479
613
  let s = Math.max(0, Math.trunc(Number(r)) || 0);
480
614
  if (s === 0) return;
481
- let c = Math.max(0, Math.min(Math.trunc(Number(e)) || 0, s - 1)), l = S(o, "horizontal") || a || 0, u = x(s, i, V.current), d = C(o, "horizontal"), f = E(c, t?.align ?? "auto", l, u, d, i, V.current), p = w(o);
615
+ let c = Math.max(0, Math.min(Math.trunc(Number(e)) || 0, s - 1)), l = L(o, "horizontal") || a || 0, u = I(s, i, M.current), d = R(o, "horizontal"), f = V(c, t?.align ?? "auto", l, u, d, i, M.current), p = z(o);
482
616
  p && p.scrollTo({
483
617
  left: f,
484
618
  behavior: t?.smooth === !0 ? "smooth" : "auto"
485
619
  });
486
620
  }, []),
487
621
  scrollToCell: n((e, t, n) => {
488
- let { getScrollElement: r, rowCount: i, colCount: a, estimateRowHeight: o, estimateColumnWidth: s, initialViewportHeight: c, initialViewportWidth: l } = L.current, u = r();
622
+ let { getScrollElement: r, rowCount: i, colCount: a, estimateRowHeight: o, estimateColumnWidth: s, initialViewportHeight: c, initialViewportWidth: l } = O.current, u = r();
489
623
  if (!u) return;
490
624
  let d = Math.max(0, Math.trunc(Number(i)) || 0), f = Math.max(0, Math.trunc(Number(a)) || 0);
491
625
  if (d === 0 || f === 0) return;
492
- let p = Math.max(0, Math.min(Math.trunc(Number(e)) || 0, d - 1)), m = Math.max(0, Math.min(Math.trunc(Number(t)) || 0, f - 1)), h = S(u, "vertical") || c || 0, g = S(u, "horizontal") || l || 0, _ = x(d, o, B.current), v = x(f, s, V.current), y = C(u, "vertical"), b = C(u, "horizontal"), T = E(p, n?.rowAlign ?? "auto", h, _, y, o, B.current), D = E(m, n?.colAlign ?? "auto", g, v, b, s, V.current), O = w(u);
493
- O && O.scrollTo({
494
- top: T,
495
- left: D,
626
+ let p = Math.max(0, Math.min(Math.trunc(Number(e)) || 0, d - 1)), m = Math.max(0, Math.min(Math.trunc(Number(t)) || 0, f - 1)), h = L(u, "vertical") || c || 0, g = L(u, "horizontal") || l || 0, _ = I(d, o, j.current), v = I(f, s, M.current), y = R(u, "vertical"), b = R(u, "horizontal"), x = V(p, n?.rowAlign ?? "auto", h, _, y, o, j.current), S = V(m, n?.colAlign ?? "auto", g, v, b, s, M.current), C = z(u);
627
+ C && C.scrollTo({
628
+ top: x,
629
+ left: S,
496
630
  behavior: n?.smooth === !0 ? "smooth" : "auto"
497
631
  });
498
632
  }, [])
@@ -500,13 +634,13 @@ function D(t) {
500
634
  }
501
635
  //#endregion
502
636
  //#region src/performance/useVirtualList/utils.ts
503
- function O(e, t) {
504
- return S(e, t ? "horizontal" : "vertical");
637
+ function U(e, t) {
638
+ return L(e, t ? "horizontal" : "vertical");
505
639
  }
506
- function k(e, t) {
507
- return C(e, t ? "horizontal" : "vertical");
640
+ function W(e, t) {
641
+ return R(e, t ? "horizontal" : "vertical");
508
642
  }
509
- function A(e, t, n, r, i, a, o, s) {
643
+ function G(e, t, n, r, i, a, o, s) {
510
644
  if (r <= 0 || t <= 0) return {
511
645
  startIndex: 0,
512
646
  endIndex: -1
@@ -526,7 +660,7 @@ function A(e, t, n, r, i, a, o, s) {
526
660
  c = r, l = -1;
527
661
  let a = 0;
528
662
  for (let o = 0; o < r; o++) {
529
- let r = y(o, i), s = n - a - r;
663
+ let r = P(o, i), s = n - a - r;
530
664
  if (n - a <= e) break;
531
665
  s < e + t && (o < c && (c = o), l = o), a += r;
532
666
  }
@@ -535,7 +669,7 @@ function A(e, t, n, r, i, a, o, s) {
535
669
  c = 0, l = -1;
536
670
  let n = 0, a = !1;
537
671
  for (let o = 0; o < r; o++) {
538
- let r = y(o, i), s = n + r;
672
+ let r = P(o, i), s = n + r;
539
673
  if (!a && s > e && (c = o, a = !0), a) if (n < e + t) l = o;
540
674
  else break;
541
675
  n += r;
@@ -547,8 +681,8 @@ function A(e, t, n, r, i, a, o, s) {
547
681
  endIndex: l
548
682
  };
549
683
  }
550
- function j(e, t, n, r, i, a, o, s) {
551
- let c = s ? s.getItemSize(e) : y(e, a), l = b(e, a, s), u = o ? r - l - c : l, d = u + c, f = Math.max(0, r - n), p;
684
+ function K(e, t, n, r, i, a, o, s) {
685
+ let c = s ? s.getItemSize(e) : P(e, a), l = F(e, a, s), u = o ? r - l - c : l, d = u + c, f = Math.max(0, r - n), p;
552
686
  switch (t) {
553
687
  case "start":
554
688
  p = o ? Math.max(0, d - n) : u;
@@ -568,75 +702,75 @@ function j(e, t, n, r, i, a, o, s) {
568
702
  }
569
703
  //#endregion
570
704
  //#region src/performance/useVirtualList/useVirtualList.ts
571
- function M(c) {
572
- let { count: u, estimateSize: d, getScrollElement: f, overscan: p = 3, horizontal: m = !1, reverse: h = !1, scrollingDelay: g = 150, initialViewportSize: _ = 0, data: S, itemKey: C, initialOffset: T, initialScrollIndex: E } = c, D = Math.max(0, Math.trunc(Number(u)) || 0), M = Math.max(0, Math.trunc(Number(p)) || 0), N = o(c);
705
+ function q(c) {
706
+ let { count: l, estimateSize: u, getScrollElement: f, overscan: p = 3, horizontal: m = !1, reverse: h = !1, scrollingDelay: g = 150, initialViewportSize: _ = 0, data: v, itemKey: y, initialOffset: b, initialScrollIndex: x } = c, S = Math.max(0, Math.trunc(Number(l)) || 0), C = Math.max(0, Math.trunc(Number(p)) || 0), w = o(c);
573
707
  i(() => {
574
- N.current = c;
708
+ w.current = c;
575
709
  });
576
- let P = a(() => {
577
- if (typeof d != "function") return;
578
- let e = new v();
579
- return e.initializeOffsets(D, d), e;
580
- }, [D, d]), F = o(P);
710
+ let T = a(() => {
711
+ if (typeof u != "function") return;
712
+ let e = new N();
713
+ return e.initializeOffsets(S, u), e;
714
+ }, [S, u]), E = o(T);
581
715
  i(() => {
582
- F.current = P;
583
- }, [P]);
584
- let [I, L] = s(() => {
585
- if (typeof T == "number") return Math.max(0, T);
586
- if (typeof E == "number" && D > 0) {
587
- let e = Math.max(0, Math.min(Math.trunc(Number(E)) || 0, D - 1)), t = P ? P.getItemStartOffset(e) : b(e, d);
716
+ E.current = T;
717
+ }, [T]);
718
+ let [D, O] = s(() => {
719
+ if (typeof b == "number") return Math.max(0, b);
720
+ if (typeof x == "number" && S > 0) {
721
+ let e = Math.max(0, Math.min(Math.trunc(Number(x)) || 0, S - 1)), t = T ? T.getItemStartOffset(e) : F(e, u);
588
722
  if (h) {
589
- let n = P ? P.getItemSize(e) : y(e, d), r = x(D, d, P);
723
+ let n = T ? T.getItemSize(e) : P(e, u), r = I(S, u, T);
590
724
  return Math.max(0, r - t - n);
591
725
  }
592
726
  return t;
593
727
  }
594
728
  return 0;
595
- }), [R, z] = s(!1), [, B] = s({}), V = o(!1), { debouncedFunc: H } = l(() => z(!1), g), U = f();
729
+ }), [k, A] = s(!1), [, j] = s({}), M = o(!1), { debouncedFunc: L } = d(() => A(!1), g), R = f();
596
730
  r(() => {
597
- if (!U) return;
598
- if (!V.current && (V.current = !0, typeof T == "number" || typeof E == "number")) {
599
- let e = w(U);
731
+ if (!R) return;
732
+ if (!M.current && (M.current = !0, typeof b == "number" || typeof x == "number")) {
733
+ let e = z(R);
600
734
  e && e.scrollTo({
601
- [m ? "left" : "top"]: I,
735
+ [m ? "left" : "top"]: D,
602
736
  behavior: "auto"
603
737
  });
604
738
  return;
605
739
  }
606
- let e = k(U, m);
607
- L((t) => t === e ? t : e);
740
+ let e = W(R, m);
741
+ O((t) => t === e ? t : e);
608
742
  }, [
609
- U,
743
+ R,
610
744
  m,
611
- T,
612
- E,
613
- I
745
+ b,
746
+ x,
747
+ D
614
748
  ]);
615
- function W() {
616
- let { getScrollElement: e, horizontal: t } = N.current, n = e();
749
+ function B() {
750
+ let { getScrollElement: e, horizontal: t } = w.current, n = e();
617
751
  if (!n) return;
618
- let r = k(n, t ?? !1);
619
- L(r), (N.current.scrollingDelay ?? 150) > 0 && (z(!0), H());
752
+ let r = W(n, t ?? !1);
753
+ O(r), (w.current.scrollingDelay ?? 150) > 0 && (A(!0), L());
620
754
  }
621
- e("scroll", W, {
622
- target: U,
755
+ e("scroll", B, {
756
+ target: R,
623
757
  passive: !0
624
758
  }), r(() => {
625
- if (!U) return;
626
- let e = () => B({});
627
- if (U instanceof Window) return U.addEventListener("resize", e), () => U.removeEventListener("resize", e);
628
- let t = new ResizeObserver(e), n = U instanceof Document ? U.documentElement : U;
759
+ if (!R) return;
760
+ let e = () => j({});
761
+ if (R instanceof Window) return R.addEventListener("resize", e), () => R.removeEventListener("resize", e);
762
+ let t = new ResizeObserver(e), n = R instanceof Document ? R.documentElement : R;
629
763
  return t.observe(n), () => t.disconnect();
630
- }, [U]);
631
- let G = O(U, m) || _, K = x(D, d, P), { startIndex: q, endIndex: J } = A(I, G, K, D, d, M, h, P), Y = [];
764
+ }, [R]);
765
+ let V = U(R, m) || _, H = I(S, u, T), { startIndex: q, endIndex: J } = G(D, V, H, S, u, C, h, T), Y = [];
632
766
  if (q <= J) {
633
- let e = P ? P.getItemStartOffset(q) : b(q, d);
767
+ let e = T ? T.getItemStartOffset(q) : F(q, u);
634
768
  for (let n = q; n <= J; n++) {
635
- let r = P ? P.getItemSize(n) : y(n, d), i = h ? K - e - r : e, a = n;
636
- if (C) {
637
- if (typeof C == "function") a = C(n, S?.[n]);
638
- else if (S && S[n] !== void 0 && S[n] !== null) {
639
- let e = t(S[n], C);
769
+ let r = T ? T.getItemSize(n) : P(n, u), i = h ? H - e - r : e, a = n;
770
+ if (y) {
771
+ if (typeof y == "function") a = y(n, v?.[n]);
772
+ else if (v && v[n] !== void 0 && v[n] !== null) {
773
+ let e = t(v[n], y);
640
774
  (typeof e == "string" || typeof e == "number") && (a = e);
641
775
  }
642
776
  }
@@ -649,23 +783,23 @@ function M(c) {
649
783
  }
650
784
  }
651
785
  let X = n((e, t) => {
652
- let { getScrollElement: n, horizontal: r, count: i, estimateSize: a } = N.current, o = n();
786
+ let { getScrollElement: n, horizontal: r, count: i, estimateSize: a } = w.current, o = n();
653
787
  if (!o) return;
654
- let s = r ?? !1, c = O(o, s) || N.current.initialViewportSize || 0, l = F.current, u = x(Math.max(0, Math.trunc(Number(i)) || 0), a, l), d = Math.max(0, Math.min(e, Math.max(0, u - c))), f = w(o);
788
+ let s = r ?? !1, c = U(o, s) || w.current.initialViewportSize || 0, l = E.current, u = I(Math.max(0, Math.trunc(Number(i)) || 0), a, l), d = Math.max(0, Math.min(e, Math.max(0, u - c))), f = z(o);
655
789
  if (!f) return;
656
790
  let p = { behavior: t?.smooth === !0 ? "smooth" : "auto" };
657
791
  s ? p.left = d : p.top = d, f.scrollTo(p);
658
792
  }, []);
659
793
  return {
660
794
  virtualItems: Y,
661
- totalSize: K,
662
- isScrolling: R,
795
+ totalSize: H,
796
+ isScrolling: k,
663
797
  scrollToIndex: n((e, t) => {
664
- let { getScrollElement: n, count: r, estimateSize: i, horizontal: a, reverse: o } = N.current, s = n();
798
+ let { getScrollElement: n, count: r, estimateSize: i, horizontal: a, reverse: o } = w.current, s = n();
665
799
  if (!s) return;
666
800
  let c = Math.max(0, Math.trunc(Number(r)) || 0);
667
801
  if (c === 0) return;
668
- let l = Math.max(0, Math.min(Math.trunc(Number(e)) || 0, c - 1)), u = t?.align ?? "auto", d = a ?? !1, f = o ?? !1, p = F.current, m = j(l, u, O(s, d) || N.current.initialViewportSize || 0, x(c, i, p), k(s, d), i, f, p), h = w(s);
802
+ let l = Math.max(0, Math.min(Math.trunc(Number(e)) || 0, c - 1)), u = t?.align ?? "auto", d = a ?? !1, f = o ?? !1, p = E.current, m = K(l, u, U(s, d) || w.current.initialViewportSize || 0, I(c, i, p), W(s, d), i, f, p), h = z(s);
669
803
  if (!h) return;
670
804
  let g = { behavior: t?.smooth === !0 ? "smooth" : "auto" };
671
805
  d ? g.left = m : g.top = m, h.scrollTo(g);
@@ -674,4 +808,4 @@ function M(c) {
674
808
  };
675
809
  }
676
810
  //#endregion
677
- export { h as a, f as c, l as d, c as f, g as i, d as l, D as n, m as o, _ as r, p as s, M as t, u };
811
+ export { O as a, S as c, g as d, m as f, A as i, b as l, l as m, H as n, E as o, d as p, M as r, w as s, q as t, v as u };