@cagatayfdn/flora-components 0.0.165 → 0.0.166

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.
@@ -0,0 +1,3311 @@
1
+ import { j as M } from "./jsx-runtime-BcAkpsdy.js";
2
+ import b, { createElement as Fe } from "react";
3
+ import sn from "react-dom";
4
+ const Ct = 0, Oe = 1, Ke = 2, Bo = 4;
5
+ function so(e) {
6
+ return () => e;
7
+ }
8
+ function cn(e) {
9
+ e();
10
+ }
11
+ function tt(e, t) {
12
+ return (o) => e(t(o));
13
+ }
14
+ function co(e, t) {
15
+ return () => e(t);
16
+ }
17
+ function an(e, t) {
18
+ return (o) => e(t, o);
19
+ }
20
+ function At(e) {
21
+ return e !== void 0;
22
+ }
23
+ function un(...e) {
24
+ return () => {
25
+ e.map(cn);
26
+ };
27
+ }
28
+ function $e() {
29
+ }
30
+ function St(e, t) {
31
+ return t(e), e;
32
+ }
33
+ function dn(e, t) {
34
+ return t(e);
35
+ }
36
+ function J(...e) {
37
+ return e;
38
+ }
39
+ function K(e, t) {
40
+ return e(Oe, t);
41
+ }
42
+ function F(e, t) {
43
+ e(Ct, t);
44
+ }
45
+ function Vt(e) {
46
+ e(Ke);
47
+ }
48
+ function oe(e) {
49
+ return e(Bo);
50
+ }
51
+ function L(e, t) {
52
+ return K(e, an(t, Ct));
53
+ }
54
+ function Te(e, t) {
55
+ const o = e(Oe, (n) => {
56
+ o(), t(n);
57
+ });
58
+ return o;
59
+ }
60
+ function ao(e) {
61
+ let t, o;
62
+ return (n) => (r) => {
63
+ t = r, o && clearTimeout(o), o = setTimeout(() => {
64
+ n(t);
65
+ }, e);
66
+ };
67
+ }
68
+ function ko(e, t) {
69
+ return e === t;
70
+ }
71
+ function Z(e = ko) {
72
+ let t;
73
+ return (o) => (n) => {
74
+ e(t, n) || (t = n, o(n));
75
+ };
76
+ }
77
+ function P(e) {
78
+ return (t) => (o) => {
79
+ e(o) && t(o);
80
+ };
81
+ }
82
+ function B(e) {
83
+ return (t) => tt(t, e);
84
+ }
85
+ function ye(e) {
86
+ return (t) => () => {
87
+ t(e);
88
+ };
89
+ }
90
+ function I(e, ...t) {
91
+ const o = hn(...t);
92
+ return (n, r) => {
93
+ switch (n) {
94
+ case Ke:
95
+ Vt(e);
96
+ return;
97
+ case Oe:
98
+ return K(e, o(r));
99
+ }
100
+ };
101
+ }
102
+ function be(e, t) {
103
+ return (o) => (n) => {
104
+ o(t = e(t, n));
105
+ };
106
+ }
107
+ function De(e) {
108
+ return (t) => (o) => {
109
+ e > 0 ? e-- : t(o);
110
+ };
111
+ }
112
+ function ke(e) {
113
+ let t = null, o;
114
+ return (n) => (r) => {
115
+ t = r, !o && (o = setTimeout(() => {
116
+ o = void 0, n(t);
117
+ }, e));
118
+ };
119
+ }
120
+ function D(...e) {
121
+ const t = new Array(e.length);
122
+ let o = 0, n = null;
123
+ const r = Math.pow(2, e.length) - 1;
124
+ return e.forEach((i, l) => {
125
+ const s = Math.pow(2, l);
126
+ K(i, (c) => {
127
+ const a = o;
128
+ o = o | s, t[l] = c, a !== r && o === r && n && (n(), n = null);
129
+ });
130
+ }), (i) => (l) => {
131
+ const s = () => {
132
+ i([l].concat(t));
133
+ };
134
+ o === r ? s() : n = s;
135
+ };
136
+ }
137
+ function hn(...e) {
138
+ return (t) => e.reduceRight(dn, t);
139
+ }
140
+ function mn(e) {
141
+ let t, o;
142
+ const n = () => t == null ? void 0 : t();
143
+ return function(r, i) {
144
+ switch (r) {
145
+ case Oe:
146
+ return i ? o === i ? void 0 : (n(), o = i, t = K(e, i), t) : (n(), $e);
147
+ case Ke:
148
+ n(), o = null;
149
+ return;
150
+ }
151
+ };
152
+ }
153
+ function C(e) {
154
+ let t = e;
155
+ const o = N();
156
+ return (n, r) => {
157
+ switch (n) {
158
+ case Ct:
159
+ t = r;
160
+ break;
161
+ case Oe: {
162
+ r(t);
163
+ break;
164
+ }
165
+ case Bo:
166
+ return t;
167
+ }
168
+ return o(n, r);
169
+ };
170
+ }
171
+ function se(e, t) {
172
+ return St(C(t), (o) => L(e, o));
173
+ }
174
+ function N() {
175
+ const e = [];
176
+ return (t, o) => {
177
+ switch (t) {
178
+ case Ct:
179
+ e.slice().forEach((n) => {
180
+ n(o);
181
+ });
182
+ return;
183
+ case Ke:
184
+ e.splice(0, e.length);
185
+ return;
186
+ case Oe:
187
+ return e.push(o), () => {
188
+ const n = e.indexOf(o);
189
+ n > -1 && e.splice(n, 1);
190
+ };
191
+ }
192
+ };
193
+ }
194
+ function me(e) {
195
+ return St(N(), (t) => L(e, t));
196
+ }
197
+ function q(e, t = [], { singleton: o } = { singleton: !0 }) {
198
+ return {
199
+ constructor: e,
200
+ dependencies: t,
201
+ id: fn(),
202
+ singleton: o
203
+ };
204
+ }
205
+ const fn = () => Symbol();
206
+ function pn(e) {
207
+ const t = /* @__PURE__ */ new Map(), o = ({ constructor: n, dependencies: r, id: i, singleton: l }) => {
208
+ if (l && t.has(i))
209
+ return t.get(i);
210
+ const s = n(r.map((c) => o(c)));
211
+ return l && t.set(i, s), s;
212
+ };
213
+ return o(e);
214
+ }
215
+ function ne(...e) {
216
+ const t = N(), o = new Array(e.length);
217
+ let n = 0;
218
+ const r = Math.pow(2, e.length) - 1;
219
+ return e.forEach((i, l) => {
220
+ const s = Math.pow(2, l);
221
+ K(i, (c) => {
222
+ o[l] = c, n = n | s, n === r && F(t, o);
223
+ });
224
+ }), function(i, l) {
225
+ switch (i) {
226
+ case Ke: {
227
+ Vt(t);
228
+ return;
229
+ }
230
+ case Oe:
231
+ return n === r && l(o), K(t, l);
232
+ }
233
+ };
234
+ }
235
+ function j(e, t = ko) {
236
+ return I(e, Z(t));
237
+ }
238
+ function Lt(...e) {
239
+ return function(t, o) {
240
+ switch (t) {
241
+ case Ke:
242
+ return;
243
+ case Oe:
244
+ return un(...e.map((n) => K(n, o)));
245
+ }
246
+ };
247
+ }
248
+ var de = /* @__PURE__ */ ((e) => (e[e.DEBUG = 0] = "DEBUG", e[e.INFO = 1] = "INFO", e[e.WARN = 2] = "WARN", e[e.ERROR = 3] = "ERROR", e))(de || {});
249
+ const gn = {
250
+ 0: "debug",
251
+ 3: "error",
252
+ 1: "log",
253
+ 2: "warn"
254
+ }, xn = () => typeof globalThis > "u" ? window : globalThis, Me = q(
255
+ () => {
256
+ const e = C(
257
+ 3
258
+ /* ERROR */
259
+ );
260
+ return {
261
+ log: C((t, o, n = 1) => {
262
+ var r;
263
+ const i = (r = xn().VIRTUOSO_LOG_LEVEL) != null ? r : oe(e);
264
+ n >= i && console[gn[n]](
265
+ "%creact-virtuoso: %c%s %o",
266
+ "color: #0253b3; font-weight: bold",
267
+ "color: initial",
268
+ t,
269
+ o
270
+ );
271
+ }),
272
+ logLevel: e
273
+ };
274
+ },
275
+ [],
276
+ { singleton: !0 }
277
+ );
278
+ function ze(e, t, o) {
279
+ return Ft(e, t, o).callbackRef;
280
+ }
281
+ function Ft(e, t, o) {
282
+ const n = b.useRef(null);
283
+ let r = (l) => {
284
+ };
285
+ const i = b.useMemo(() => typeof ResizeObserver < "u" ? new ResizeObserver((l) => {
286
+ const s = () => {
287
+ const c = l[0].target;
288
+ c.offsetParent !== null && e(c);
289
+ };
290
+ o ? s() : requestAnimationFrame(s);
291
+ }) : null, [e, o]);
292
+ return r = (l) => {
293
+ l && t ? (i == null || i.observe(l), n.current = l) : (n.current && (i == null || i.unobserve(n.current)), n.current = null);
294
+ }, { callbackRef: r, ref: n };
295
+ }
296
+ function Eo(e, t, o, n, r, i, l, s, c) {
297
+ const a = b.useCallback(
298
+ (f) => {
299
+ const T = vn(f.children, t, s ? "offsetWidth" : "offsetHeight", r);
300
+ let p = f.parentElement;
301
+ for (; !p.dataset.virtuosoScroller; )
302
+ p = p.parentElement;
303
+ const v = p.lastElementChild.dataset.viewportType === "window";
304
+ let w;
305
+ v && (w = p.ownerDocument.defaultView);
306
+ const x = l ? s ? l.scrollLeft : l.scrollTop : v ? s ? w.scrollX || w.document.documentElement.scrollLeft : w.scrollY || w.document.documentElement.scrollTop : s ? p.scrollLeft : p.scrollTop, g = l ? s ? l.scrollWidth : l.scrollHeight : v ? s ? w.document.documentElement.scrollWidth : w.document.documentElement.scrollHeight : s ? p.scrollWidth : p.scrollHeight, h = l ? s ? l.offsetWidth : l.offsetHeight : v ? s ? w.innerWidth : w.innerHeight : s ? p.offsetWidth : p.offsetHeight;
307
+ n({
308
+ scrollHeight: g,
309
+ scrollTop: Math.max(x, 0),
310
+ viewportHeight: h
311
+ }), i == null || i(
312
+ s ? uo("column-gap", getComputedStyle(f).columnGap, r) : uo("row-gap", getComputedStyle(f).rowGap, r)
313
+ ), T !== null && e(T);
314
+ },
315
+ [e, t, r, i, l, n, s]
316
+ );
317
+ return Ft(a, o, c);
318
+ }
319
+ function vn(e, t, o, n) {
320
+ const r = e.length;
321
+ if (r === 0)
322
+ return null;
323
+ const i = [];
324
+ for (let l = 0; l < r; l++) {
325
+ const s = e.item(l);
326
+ if (s.dataset.index === void 0)
327
+ continue;
328
+ const c = parseInt(s.dataset.index), a = parseFloat(s.dataset.knownSize), f = t(s, o);
329
+ if (f === 0 && n("Zero-sized element, this should not happen", { child: s }, de.ERROR), f === a)
330
+ continue;
331
+ const T = i[i.length - 1];
332
+ i.length === 0 || T.size !== f || T.endIndex !== c - 1 ? i.push({ endIndex: c, size: f, startIndex: c }) : i[i.length - 1].endIndex++;
333
+ }
334
+ return i;
335
+ }
336
+ function uo(e, t, o) {
337
+ return t !== "normal" && !(t != null && t.endsWith("px")) && o(`${e} was not resolved to pixel value correctly`, t, de.WARN), t === "normal" ? 0 : parseInt(t ?? "0", 10);
338
+ }
339
+ function Dt(e, t, o) {
340
+ const n = b.useRef(null), r = b.useCallback(
341
+ (c) => {
342
+ if (!(c != null && c.offsetParent))
343
+ return;
344
+ const a = c.getBoundingClientRect(), f = a.width;
345
+ let T, p;
346
+ if (t) {
347
+ const v = t.getBoundingClientRect(), w = a.top - v.top;
348
+ p = v.height - Math.max(0, w), T = w + t.scrollTop;
349
+ } else {
350
+ const v = l.current.ownerDocument.defaultView;
351
+ p = v.innerHeight - Math.max(0, a.top), T = a.top + v.scrollY;
352
+ }
353
+ n.current = {
354
+ offsetTop: T,
355
+ visibleHeight: p,
356
+ visibleWidth: f
357
+ }, e(n.current);
358
+ },
359
+ // eslint-disable-next-line react-hooks/exhaustive-deps
360
+ [e, t]
361
+ ), { callbackRef: i, ref: l } = Ft(r, !0, o), s = b.useCallback(() => {
362
+ r(l.current);
363
+ }, [r, l]);
364
+ return b.useEffect(() => {
365
+ var c;
366
+ if (t) {
367
+ t.addEventListener("scroll", s);
368
+ const a = new ResizeObserver(() => {
369
+ requestAnimationFrame(s);
370
+ });
371
+ return a.observe(t), () => {
372
+ t.removeEventListener("scroll", s), a.unobserve(t);
373
+ };
374
+ } else {
375
+ const a = (c = l.current) == null ? void 0 : c.ownerDocument.defaultView;
376
+ return a == null || a.addEventListener("scroll", s), a == null || a.addEventListener("resize", s), () => {
377
+ a == null || a.removeEventListener("scroll", s), a == null || a.removeEventListener("resize", s);
378
+ };
379
+ }
380
+ }, [s, t, l]), i;
381
+ }
382
+ const ae = q(
383
+ () => {
384
+ const e = N(), t = N(), o = C(0), n = N(), r = C(0), i = N(), l = N(), s = C(0), c = C(0), a = C(0), f = C(0), T = N(), p = N(), v = C(!1), w = C(!1), x = C(!1);
385
+ return L(
386
+ I(
387
+ e,
388
+ B(({ scrollTop: g }) => g)
389
+ ),
390
+ t
391
+ ), L(
392
+ I(
393
+ e,
394
+ B(({ scrollHeight: g }) => g)
395
+ ),
396
+ l
397
+ ), L(t, r), {
398
+ deviation: o,
399
+ fixedFooterHeight: a,
400
+ fixedHeaderHeight: c,
401
+ footerHeight: f,
402
+ headerHeight: s,
403
+ horizontalDirection: w,
404
+ scrollBy: p,
405
+ // input
406
+ scrollContainerState: e,
407
+ scrollHeight: l,
408
+ scrollingInProgress: v,
409
+ // signals
410
+ scrollTo: T,
411
+ scrollTop: t,
412
+ skipAnimationFrameInResizeObserver: x,
413
+ smoothScrollTargetReached: n,
414
+ // state
415
+ statefulScrollTop: r,
416
+ viewportHeight: i
417
+ };
418
+ },
419
+ [],
420
+ { singleton: !0 }
421
+ ), ot = { lvl: 0 };
422
+ function Lo(e, t) {
423
+ const o = e.length;
424
+ if (o === 0)
425
+ return [];
426
+ let { index: n, value: r } = t(e[0]);
427
+ const i = [];
428
+ for (let l = 1; l < o; l++) {
429
+ const { index: s, value: c } = t(e[l]);
430
+ i.push({ end: s - 1, start: n, value: r }), n = s, r = c;
431
+ }
432
+ return i.push({ end: 1 / 0, start: n, value: r }), i;
433
+ }
434
+ function $(e) {
435
+ return e === ot;
436
+ }
437
+ function nt(e, t) {
438
+ if (!$(e))
439
+ return t === e.k ? e.v : t < e.k ? nt(e.l, t) : nt(e.r, t);
440
+ }
441
+ function Se(e, t, o = "k") {
442
+ if ($(e))
443
+ return [-1 / 0, void 0];
444
+ if (Number(e[o]) === t)
445
+ return [e.k, e.v];
446
+ if (Number(e[o]) < t) {
447
+ const n = Se(e.r, t, o);
448
+ return n[0] === -1 / 0 ? [e.k, e.v] : n;
449
+ }
450
+ return Se(e.l, t, o);
451
+ }
452
+ function he(e, t, o) {
453
+ return $(e) ? jo(t, o, 1) : t === e.k ? re(e, { k: t, v: o }) : t < e.k ? ho(re(e, { l: he(e.l, t, o) })) : ho(re(e, { r: he(e.r, t, o) }));
454
+ }
455
+ function Ue() {
456
+ return ot;
457
+ }
458
+ function wt(e, t, o) {
459
+ if ($(e))
460
+ return [];
461
+ const n = Se(e, t)[0];
462
+ return In(Mt(e, n, o));
463
+ }
464
+ function Ot(e, t) {
465
+ if ($(e))
466
+ return ot;
467
+ const { k: o, l: n, r } = e;
468
+ if (t === o) {
469
+ if ($(n))
470
+ return r;
471
+ if ($(r))
472
+ return n;
473
+ {
474
+ const [i, l] = Mo(n);
475
+ return pt(re(e, { k: i, l: Oo(n), v: l }));
476
+ }
477
+ } else
478
+ return t < o ? pt(re(e, { l: Ot(n, t) })) : pt(re(e, { r: Ot(r, t) }));
479
+ }
480
+ function Ve(e) {
481
+ return $(e) ? [] : [...Ve(e.l), { k: e.k, v: e.v }, ...Ve(e.r)];
482
+ }
483
+ function Mt(e, t, o) {
484
+ if ($(e))
485
+ return [];
486
+ const { k: n, l: r, r: i, v: l } = e;
487
+ let s = [];
488
+ return n > t && (s = s.concat(Mt(r, t, o))), n >= t && n <= o && s.push({ k: n, v: l }), n <= o && (s = s.concat(Mt(i, t, o))), s;
489
+ }
490
+ function pt(e) {
491
+ const { l: t, lvl: o, r: n } = e;
492
+ if (n.lvl >= o - 1 && t.lvl >= o - 1)
493
+ return e;
494
+ if (o > n.lvl + 1) {
495
+ if (zt(t))
496
+ return Wo(re(e, { lvl: o - 1 }));
497
+ if (!$(t) && !$(t.r))
498
+ return re(t.r, {
499
+ l: re(t, { r: t.r.l }),
500
+ lvl: o,
501
+ r: re(e, {
502
+ l: t.r.r,
503
+ lvl: o - 1
504
+ })
505
+ });
506
+ throw new Error("Unexpected empty nodes");
507
+ } else {
508
+ if (zt(e))
509
+ return jt(re(e, { lvl: o - 1 }));
510
+ if (!$(n) && !$(n.l)) {
511
+ const r = n.l, i = zt(r) ? n.lvl - 1 : n.lvl;
512
+ return re(r, {
513
+ l: re(e, {
514
+ lvl: o - 1,
515
+ r: r.l
516
+ }),
517
+ lvl: r.lvl + 1,
518
+ r: jt(re(n, { l: r.r, lvl: i }))
519
+ });
520
+ } else
521
+ throw new Error("Unexpected empty nodes");
522
+ }
523
+ }
524
+ function re(e, t) {
525
+ return jo(
526
+ t.k !== void 0 ? t.k : e.k,
527
+ t.v !== void 0 ? t.v : e.v,
528
+ t.lvl !== void 0 ? t.lvl : e.lvl,
529
+ t.l !== void 0 ? t.l : e.l,
530
+ t.r !== void 0 ? t.r : e.r
531
+ );
532
+ }
533
+ function Oo(e) {
534
+ return $(e.r) ? e.l : pt(re(e, { r: Oo(e.r) }));
535
+ }
536
+ function zt(e) {
537
+ return $(e) || e.lvl > e.r.lvl;
538
+ }
539
+ function Mo(e) {
540
+ return $(e.r) ? [e.k, e.v] : Mo(e.r);
541
+ }
542
+ function jo(e, t, o, n = ot, r = ot) {
543
+ return { k: e, l: n, lvl: o, r, v: t };
544
+ }
545
+ function ho(e) {
546
+ return jt(Wo(e));
547
+ }
548
+ function Wo(e) {
549
+ const { l: t } = e;
550
+ return !$(t) && t.lvl === e.lvl ? re(t, { r: re(e, { l: t.r }) }) : e;
551
+ }
552
+ function jt(e) {
553
+ const { lvl: t, r: o } = e;
554
+ return !$(o) && !$(o.r) && o.lvl === t && o.r.lvl === t ? re(o, { l: re(e, { r: o.l }), lvl: t + 1 }) : e;
555
+ }
556
+ function In(e) {
557
+ return Lo(e, ({ k: t, v: o }) => ({ index: t, value: o }));
558
+ }
559
+ function Po(e, t) {
560
+ return !!(e && e.startIndex === t.startIndex && e.endIndex === t.endIndex);
561
+ }
562
+ function rt(e, t) {
563
+ return !!(e && e[0] === t[0] && e[1] === t[1]);
564
+ }
565
+ const Gt = q(
566
+ () => ({ recalcInProgress: C(!1) }),
567
+ [],
568
+ { singleton: !0 }
569
+ );
570
+ function Ao(e, t, o) {
571
+ return e[xt(e, t, o)];
572
+ }
573
+ function xt(e, t, o, n = 0) {
574
+ let r = e.length - 1;
575
+ for (; n <= r; ) {
576
+ const i = Math.floor((n + r) / 2), l = e[i], s = o(l, t);
577
+ if (s === 0)
578
+ return i;
579
+ if (s === -1) {
580
+ if (r - n < 2)
581
+ return i - 1;
582
+ r = i - 1;
583
+ } else {
584
+ if (r === n)
585
+ return i;
586
+ n = i + 1;
587
+ }
588
+ }
589
+ throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`);
590
+ }
591
+ function Tn(e, t, o, n) {
592
+ const r = xt(e, t, n), i = xt(e, o, n, r);
593
+ return e.slice(r, i + 1);
594
+ }
595
+ function we(e, t) {
596
+ return Math.round(e.getBoundingClientRect()[t]);
597
+ }
598
+ function Ht(e) {
599
+ return !$(e.groupOffsetTree);
600
+ }
601
+ function Nt({ index: e }, t) {
602
+ return t === e ? 0 : t < e ? -1 : 1;
603
+ }
604
+ function Cn() {
605
+ return {
606
+ groupIndices: [],
607
+ groupOffsetTree: Ue(),
608
+ lastIndex: 0,
609
+ lastOffset: 0,
610
+ lastSize: 0,
611
+ offsetTree: [],
612
+ sizeTree: Ue()
613
+ };
614
+ }
615
+ function Sn(e, t) {
616
+ let o = $(e) ? 0 : 1 / 0;
617
+ for (const n of t) {
618
+ const { endIndex: r, size: i, startIndex: l } = n;
619
+ if (o = Math.min(o, l), $(e)) {
620
+ e = he(e, 0, i);
621
+ continue;
622
+ }
623
+ const s = wt(e, l - 1, r + 1);
624
+ if (s.some(Bn(n)))
625
+ continue;
626
+ let c = !1, a = !1;
627
+ for (const { end: f, start: T, value: p } of s)
628
+ c ? (r >= T || i === p) && (e = Ot(e, T)) : (a = p !== i, c = !0), f > r && r >= T && p !== i && (e = he(e, r + 1, p));
629
+ a && (e = he(e, l, i));
630
+ }
631
+ return [e, o];
632
+ }
633
+ function wn(e) {
634
+ return typeof e.groupIndex < "u";
635
+ }
636
+ function Hn({ offset: e }, t) {
637
+ return t === e ? 0 : t < e ? -1 : 1;
638
+ }
639
+ function it(e, t, o) {
640
+ if (t.length === 0)
641
+ return 0;
642
+ const { index: n, offset: r, size: i } = Ao(t, e, Nt), l = e - n, s = i * l + (l - 1) * o + r;
643
+ return s > 0 ? s + o : s;
644
+ }
645
+ function Vo(e, t) {
646
+ if (!Ht(t))
647
+ return e;
648
+ let o = 0;
649
+ for (; t.groupIndices[o] <= e + o; )
650
+ o++;
651
+ return e + o;
652
+ }
653
+ function Fo(e, t, o) {
654
+ if (wn(e))
655
+ return t.groupIndices[e.groupIndex] + 1;
656
+ {
657
+ const n = e.index === "LAST" ? o : e.index;
658
+ let r = Vo(n, t);
659
+ return r = Math.max(0, r, Math.min(o, r)), r;
660
+ }
661
+ }
662
+ function yn(e, t, o, n = 0) {
663
+ return n > 0 && (t = Math.max(t, Ao(e, n, Nt).offset)), Lo(Tn(e, t, o, Hn), Rn);
664
+ }
665
+ function bn(e, [t, o, n, r]) {
666
+ t.length > 0 && n("received item sizes", t, de.DEBUG);
667
+ const i = e.sizeTree;
668
+ let l = i, s = 0;
669
+ if (o.length > 0 && $(i) && t.length === 2) {
670
+ const p = t[0].size, v = t[1].size;
671
+ l = o.reduce((w, x) => he(he(w, x, p), x + 1, v), l);
672
+ } else
673
+ [l, s] = Sn(l, t);
674
+ if (l === i)
675
+ return e;
676
+ const { lastIndex: c, lastOffset: a, lastSize: f, offsetTree: T } = Wt(e.offsetTree, s, l, r);
677
+ return {
678
+ groupIndices: o,
679
+ groupOffsetTree: o.reduce((p, v) => he(p, v, it(v, T, r)), Ue()),
680
+ lastIndex: c,
681
+ lastOffset: a,
682
+ lastSize: f,
683
+ offsetTree: T,
684
+ sizeTree: l
685
+ };
686
+ }
687
+ function zn(e) {
688
+ return Ve(e).map(({ k: t, v: o }, n, r) => {
689
+ const i = r[n + 1];
690
+ return { endIndex: i ? i.k - 1 : 1 / 0, size: o, startIndex: t };
691
+ });
692
+ }
693
+ function mo(e, t) {
694
+ let o = 0, n = 0;
695
+ for (; o < e; )
696
+ o += t[n + 1] - t[n] - 1, n++;
697
+ return n - (o === e ? 0 : 1);
698
+ }
699
+ function Wt(e, t, o, n) {
700
+ let r = e, i = 0, l = 0, s = 0, c = 0;
701
+ if (t !== 0) {
702
+ c = xt(r, t - 1, Nt), s = r[c].offset;
703
+ const a = Se(o, t - 1);
704
+ i = a[0], l = a[1], r.length && r[c].size === Se(o, t)[1] && (c -= 1), r = r.slice(0, c + 1);
705
+ } else
706
+ r = [];
707
+ for (const { start: a, value: f } of wt(o, t, 1 / 0)) {
708
+ const T = a - i, p = T * l + s + T * n;
709
+ r.push({
710
+ index: a,
711
+ offset: p,
712
+ size: f
713
+ }), i = a, s = p, l = f;
714
+ }
715
+ return {
716
+ lastIndex: i,
717
+ lastOffset: s,
718
+ lastSize: l,
719
+ offsetTree: r
720
+ };
721
+ }
722
+ function Rn(e) {
723
+ return { index: e.index, value: e };
724
+ }
725
+ function Bn(e) {
726
+ const { endIndex: t, size: o, startIndex: n } = e;
727
+ return (r) => r.start === n && (r.end === t || r.end === 1 / 0) && r.value === o;
728
+ }
729
+ const kn = {
730
+ offsetHeight: "height",
731
+ offsetWidth: "width"
732
+ }, Re = q(
733
+ ([{ log: e }, { recalcInProgress: t }]) => {
734
+ const o = N(), n = N(), r = se(n, 0), i = N(), l = N(), s = C(0), c = C([]), a = C(void 0), f = C(void 0), T = C((m, d) => we(m, kn[d])), p = C(void 0), v = C(0), w = Cn(), x = se(
735
+ I(o, D(c, e, v), be(bn, w), Z()),
736
+ w
737
+ ), g = se(
738
+ I(
739
+ c,
740
+ Z(),
741
+ be((m, d) => ({ current: d, prev: m.current }), {
742
+ current: [],
743
+ prev: []
744
+ }),
745
+ B(({ prev: m }) => m)
746
+ ),
747
+ []
748
+ );
749
+ L(
750
+ I(
751
+ c,
752
+ P((m) => m.length > 0),
753
+ D(x, v),
754
+ B(([m, d, S]) => {
755
+ const z = m.reduce((O, k, W) => he(O, k, it(k, d.offsetTree, S) || W), Ue());
756
+ return {
757
+ ...d,
758
+ groupIndices: m,
759
+ groupOffsetTree: z
760
+ };
761
+ })
762
+ ),
763
+ x
764
+ ), L(
765
+ I(
766
+ n,
767
+ D(x),
768
+ P(([m, { lastIndex: d }]) => m < d),
769
+ B(([m, { lastIndex: d, lastSize: S }]) => [
770
+ {
771
+ endIndex: d,
772
+ size: S,
773
+ startIndex: m
774
+ }
775
+ ])
776
+ ),
777
+ o
778
+ ), L(a, f);
779
+ const h = se(
780
+ I(
781
+ a,
782
+ B((m) => m === void 0)
783
+ ),
784
+ !0
785
+ );
786
+ L(
787
+ I(
788
+ f,
789
+ P((m) => m !== void 0 && $(oe(x).sizeTree)),
790
+ B((m) => [{ endIndex: 0, size: m, startIndex: 0 }])
791
+ ),
792
+ o
793
+ );
794
+ const u = me(
795
+ I(
796
+ o,
797
+ D(x),
798
+ be(
799
+ ({ sizes: m }, [d, S]) => ({
800
+ changed: S !== m,
801
+ sizes: S
802
+ }),
803
+ { changed: !1, sizes: w }
804
+ ),
805
+ B((m) => m.changed)
806
+ )
807
+ );
808
+ K(
809
+ I(
810
+ s,
811
+ be(
812
+ (m, d) => ({ diff: m.prev - d, prev: d }),
813
+ { diff: 0, prev: 0 }
814
+ ),
815
+ B((m) => m.diff)
816
+ ),
817
+ (m) => {
818
+ const { groupIndices: d } = oe(x);
819
+ if (m > 0)
820
+ F(t, !0), F(i, m + mo(m, d));
821
+ else if (m < 0) {
822
+ const S = oe(g);
823
+ S.length > 0 && (m -= mo(-m, S)), F(l, m);
824
+ }
825
+ }
826
+ ), K(I(s, D(e)), ([m, d]) => {
827
+ m < 0 && d(
828
+ "`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",
829
+ { firstItemIndex: s },
830
+ de.ERROR
831
+ );
832
+ });
833
+ const H = me(i);
834
+ L(
835
+ I(
836
+ i,
837
+ D(x),
838
+ B(([m, d]) => {
839
+ const S = d.groupIndices.length > 0, z = [], O = d.lastSize;
840
+ if (S) {
841
+ const k = nt(d.sizeTree, 0);
842
+ let W = 0, _ = 0;
843
+ for (; W < m; ) {
844
+ const E = d.groupIndices[_], U = d.groupIndices.length === _ + 1 ? 1 / 0 : d.groupIndices[_ + 1] - E - 1;
845
+ z.push({
846
+ endIndex: E,
847
+ size: k,
848
+ startIndex: E
849
+ }), z.push({
850
+ endIndex: E + 1 + U - 1,
851
+ size: O,
852
+ startIndex: E + 1
853
+ }), _++, W += U + 1;
854
+ }
855
+ const Y = Ve(d.sizeTree);
856
+ return W !== m && Y.shift(), Y.reduce(
857
+ (E, { k: U, v: ie }) => {
858
+ let fe = E.ranges;
859
+ return E.prevSize !== 0 && (fe = [
860
+ ...E.ranges,
861
+ {
862
+ endIndex: U + m - 1,
863
+ size: E.prevSize,
864
+ startIndex: E.prevIndex
865
+ }
866
+ ]), {
867
+ prevIndex: U + m,
868
+ prevSize: ie,
869
+ ranges: fe
870
+ };
871
+ },
872
+ {
873
+ prevIndex: m,
874
+ prevSize: 0,
875
+ ranges: z
876
+ }
877
+ ).ranges;
878
+ }
879
+ return Ve(d.sizeTree).reduce(
880
+ (k, { k: W, v: _ }) => ({
881
+ prevIndex: W + m,
882
+ prevSize: _,
883
+ ranges: [...k.ranges, { endIndex: W + m - 1, size: k.prevSize, startIndex: k.prevIndex }]
884
+ }),
885
+ {
886
+ prevIndex: 0,
887
+ prevSize: O,
888
+ ranges: []
889
+ }
890
+ ).ranges;
891
+ })
892
+ ),
893
+ o
894
+ );
895
+ const R = me(
896
+ I(
897
+ l,
898
+ D(x, v),
899
+ B(([m, { offsetTree: d }, S]) => {
900
+ const z = -m;
901
+ return it(z, d, S);
902
+ })
903
+ )
904
+ );
905
+ return L(
906
+ I(
907
+ l,
908
+ D(x, v),
909
+ B(([m, d, S]) => {
910
+ if (d.groupIndices.length > 0) {
911
+ if ($(d.sizeTree))
912
+ return d;
913
+ let z = Ue();
914
+ const O = oe(g);
915
+ let k = 0, W = 0, _ = 0;
916
+ for (; k < -m; ) {
917
+ _ = O[W];
918
+ const Y = O[W + 1] - _ - 1;
919
+ W++, k += Y + 1;
920
+ }
921
+ if (z = Ve(d.sizeTree).reduce((Y, { k: E, v: U }) => he(Y, Math.max(0, E + m), U), z), k !== -m) {
922
+ const Y = nt(d.sizeTree, _);
923
+ z = he(z, 0, Y);
924
+ const E = Se(d.sizeTree, -m + 1)[1];
925
+ z = he(z, 1, E);
926
+ }
927
+ return {
928
+ ...d,
929
+ sizeTree: z,
930
+ ...Wt(d.offsetTree, 0, z, S)
931
+ };
932
+ } else {
933
+ const z = Ve(d.sizeTree).reduce((O, { k, v: W }) => he(O, Math.max(0, k + m), W), Ue());
934
+ return {
935
+ ...d,
936
+ sizeTree: z,
937
+ ...Wt(d.offsetTree, 0, z, S)
938
+ };
939
+ }
940
+ })
941
+ ),
942
+ x
943
+ ), {
944
+ beforeUnshiftWith: H,
945
+ // input
946
+ data: p,
947
+ defaultItemSize: f,
948
+ firstItemIndex: s,
949
+ fixedItemSize: a,
950
+ gap: v,
951
+ groupIndices: c,
952
+ itemSize: T,
953
+ listRefresh: u,
954
+ shiftWith: l,
955
+ shiftWithOffset: R,
956
+ sizeRanges: o,
957
+ // output
958
+ sizes: x,
959
+ statefulTotalCount: r,
960
+ totalCount: n,
961
+ trackItemSizes: h,
962
+ unshiftWith: i
963
+ };
964
+ },
965
+ J(Me, Gt),
966
+ { singleton: !0 }
967
+ );
968
+ function En(e) {
969
+ return e.reduce(
970
+ (t, o) => (t.groupIndices.push(t.totalCount), t.totalCount += o + 1, t),
971
+ {
972
+ groupIndices: [],
973
+ totalCount: 0
974
+ }
975
+ );
976
+ }
977
+ const Do = q(
978
+ ([{ groupIndices: e, sizes: t, totalCount: o }, { headerHeight: n, scrollTop: r }]) => {
979
+ const i = N(), l = N(), s = me(I(i, B(En)));
980
+ return L(
981
+ I(
982
+ s,
983
+ B((c) => c.totalCount)
984
+ ),
985
+ o
986
+ ), L(
987
+ I(
988
+ s,
989
+ B((c) => c.groupIndices)
990
+ ),
991
+ e
992
+ ), L(
993
+ I(
994
+ ne(r, t, n),
995
+ P(([c, a]) => Ht(a)),
996
+ B(([c, a, f]) => Se(a.groupOffsetTree, Math.max(c - f, 0), "v")[0]),
997
+ Z(),
998
+ B((c) => [c])
999
+ ),
1000
+ l
1001
+ ), { groupCounts: i, topItemsIndexes: l };
1002
+ },
1003
+ J(Re, ae)
1004
+ ), je = q(
1005
+ ([{ log: e }]) => {
1006
+ const t = C(!1), o = me(
1007
+ I(
1008
+ t,
1009
+ P((n) => n),
1010
+ Z()
1011
+ )
1012
+ );
1013
+ return K(t, (n) => {
1014
+ n && oe(e)("props updated", {}, de.DEBUG);
1015
+ }), { didMount: o, propsReady: t };
1016
+ },
1017
+ J(Me),
1018
+ { singleton: !0 }
1019
+ ), Ln = typeof document < "u" && "scrollBehavior" in document.documentElement.style;
1020
+ function Go(e) {
1021
+ const t = typeof e == "number" ? { index: e } : e;
1022
+ return t.align || (t.align = "start"), (!t.behavior || !Ln) && (t.behavior = "auto"), t.offset || (t.offset = 0), t;
1023
+ }
1024
+ const st = q(
1025
+ ([
1026
+ { gap: e, listRefresh: t, sizes: o, totalCount: n },
1027
+ {
1028
+ fixedFooterHeight: r,
1029
+ fixedHeaderHeight: i,
1030
+ footerHeight: l,
1031
+ headerHeight: s,
1032
+ scrollingInProgress: c,
1033
+ scrollTo: a,
1034
+ smoothScrollTargetReached: f,
1035
+ viewportHeight: T
1036
+ },
1037
+ { log: p }
1038
+ ]) => {
1039
+ const v = N(), w = N(), x = C(0);
1040
+ let g = null, h = null, u = null;
1041
+ function H() {
1042
+ g && (g(), g = null), u && (u(), u = null), h && (clearTimeout(h), h = null), F(c, !1);
1043
+ }
1044
+ return L(
1045
+ I(
1046
+ v,
1047
+ D(o, T, n, x, s, l, p),
1048
+ D(e, i, r),
1049
+ B(
1050
+ ([
1051
+ [R, m, d, S, z, O, k, W],
1052
+ _,
1053
+ Y,
1054
+ E
1055
+ ]) => {
1056
+ const U = Go(R), { align: ie, behavior: fe, offset: xe } = U, ve = S - 1, ue = Fo(U, m, ve);
1057
+ let ce = it(ue, m.offsetTree, _) + O;
1058
+ ie === "end" ? (ce += Y + Se(m.sizeTree, ue)[1] - d + E, ue === ve && (ce += k)) : ie === "center" ? ce += (Y + Se(m.sizeTree, ue)[1] - d + E) / 2 : ce -= z, xe && (ce += xe);
1059
+ const We = (Ie) => {
1060
+ H(), Ie ? (W("retrying to scroll to", { location: R }, de.DEBUG), F(v, R)) : (F(w, !0), W("list did not change, scroll successful", {}, de.DEBUG));
1061
+ };
1062
+ if (H(), fe === "smooth") {
1063
+ let Ie = !1;
1064
+ u = K(t, (Ze) => {
1065
+ Ie = Ie || Ze;
1066
+ }), g = Te(f, () => {
1067
+ We(Ie);
1068
+ });
1069
+ } else
1070
+ g = Te(I(t, On(150)), We);
1071
+ return h = setTimeout(() => {
1072
+ H();
1073
+ }, 1200), F(c, !0), W("scrolling from index to", { behavior: fe, index: ue, top: ce }, de.DEBUG), { behavior: fe, top: ce };
1074
+ }
1075
+ )
1076
+ ),
1077
+ a
1078
+ ), {
1079
+ scrollTargetReached: w,
1080
+ scrollToIndex: v,
1081
+ topListHeight: x
1082
+ };
1083
+ },
1084
+ J(Re, ae, Me),
1085
+ { singleton: !0 }
1086
+ );
1087
+ function On(e) {
1088
+ return (t) => {
1089
+ const o = setTimeout(() => {
1090
+ t(!1);
1091
+ }, e);
1092
+ return (n) => {
1093
+ n && (t(!0), clearTimeout(o));
1094
+ };
1095
+ };
1096
+ }
1097
+ function _t(e, t) {
1098
+ e == 0 ? t() : requestAnimationFrame(() => {
1099
+ _t(e - 1, t);
1100
+ });
1101
+ }
1102
+ function qt(e, t) {
1103
+ const o = t - 1;
1104
+ return typeof e == "number" ? e : e.index === "LAST" ? o : e.index;
1105
+ }
1106
+ const ct = q(
1107
+ ([{ defaultItemSize: e, listRefresh: t, sizes: o }, { scrollTop: n }, { scrollTargetReached: r, scrollToIndex: i }, { didMount: l }]) => {
1108
+ const s = C(!0), c = C(0), a = C(!0);
1109
+ return L(
1110
+ I(
1111
+ l,
1112
+ D(c),
1113
+ P(([f, T]) => !!T),
1114
+ ye(!1)
1115
+ ),
1116
+ s
1117
+ ), L(
1118
+ I(
1119
+ l,
1120
+ D(c),
1121
+ P(([f, T]) => !!T),
1122
+ ye(!1)
1123
+ ),
1124
+ a
1125
+ ), K(
1126
+ I(
1127
+ ne(t, l),
1128
+ D(s, o, e, a),
1129
+ P(([[, f], T, { sizeTree: p }, v, w]) => f && (!$(p) || At(v)) && !T && !w),
1130
+ D(c)
1131
+ ),
1132
+ ([, f]) => {
1133
+ Te(r, () => {
1134
+ F(a, !0);
1135
+ }), _t(4, () => {
1136
+ Te(n, () => {
1137
+ F(s, !0);
1138
+ }), F(i, f);
1139
+ });
1140
+ }
1141
+ ), {
1142
+ initialItemFinalLocationReached: a,
1143
+ initialTopMostItemIndex: c,
1144
+ scrolledToInitialItem: s
1145
+ };
1146
+ },
1147
+ J(Re, ae, st, je),
1148
+ { singleton: !0 }
1149
+ );
1150
+ function No(e, t) {
1151
+ return Math.abs(e - t) < 1.01;
1152
+ }
1153
+ const lt = "up", Qe = "down", Mn = "none", jn = {
1154
+ atBottom: !1,
1155
+ notAtBottomBecause: "NOT_SHOWING_LAST_ITEM",
1156
+ state: {
1157
+ offsetBottom: 0,
1158
+ scrollHeight: 0,
1159
+ scrollTop: 0,
1160
+ viewportHeight: 0
1161
+ }
1162
+ }, Wn = 0, at = q(([{ footerHeight: e, headerHeight: t, scrollBy: o, scrollContainerState: n, scrollTop: r, viewportHeight: i }]) => {
1163
+ const l = C(!1), s = C(!0), c = N(), a = N(), f = C(4), T = C(Wn), p = se(
1164
+ I(
1165
+ Lt(I(j(r), De(1), ye(!0)), I(j(r), De(1), ye(!1), ao(100))),
1166
+ Z()
1167
+ ),
1168
+ !1
1169
+ ), v = se(
1170
+ I(Lt(I(o, ye(!0)), I(o, ye(!1), ao(200))), Z()),
1171
+ !1
1172
+ );
1173
+ L(
1174
+ I(
1175
+ ne(j(r), j(T)),
1176
+ B(([u, H]) => u <= H),
1177
+ Z()
1178
+ ),
1179
+ s
1180
+ ), L(I(s, ke(50)), a);
1181
+ const w = me(
1182
+ I(
1183
+ ne(n, j(i), j(t), j(e), j(f)),
1184
+ be((u, [{ scrollHeight: H, scrollTop: R }, m, d, S, z]) => {
1185
+ const O = R + m - H > -z, k = {
1186
+ scrollHeight: H,
1187
+ scrollTop: R,
1188
+ viewportHeight: m
1189
+ };
1190
+ if (O) {
1191
+ let _, Y;
1192
+ return R > u.state.scrollTop ? (_ = "SCROLLED_DOWN", Y = u.state.scrollTop - R) : (_ = "SIZE_DECREASED", Y = u.state.scrollTop - R || u.scrollTopDelta), {
1193
+ atBottom: !0,
1194
+ atBottomBecause: _,
1195
+ scrollTopDelta: Y,
1196
+ state: k
1197
+ };
1198
+ }
1199
+ let W;
1200
+ return k.scrollHeight > u.state.scrollHeight ? W = "SIZE_INCREASED" : m < u.state.viewportHeight ? W = "VIEWPORT_HEIGHT_DECREASING" : R < u.state.scrollTop ? W = "SCROLLING_UPWARDS" : W = "NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM", {
1201
+ atBottom: !1,
1202
+ notAtBottomBecause: W,
1203
+ state: k
1204
+ };
1205
+ }, jn),
1206
+ Z((u, H) => u && u.atBottom === H.atBottom)
1207
+ )
1208
+ ), x = se(
1209
+ I(
1210
+ n,
1211
+ be(
1212
+ (u, { scrollHeight: H, scrollTop: R, viewportHeight: m }) => {
1213
+ if (No(u.scrollHeight, H))
1214
+ return {
1215
+ changed: !1,
1216
+ jump: 0,
1217
+ scrollHeight: H,
1218
+ scrollTop: R
1219
+ };
1220
+ {
1221
+ const d = H - (R + m) < 1;
1222
+ return u.scrollTop !== R && d ? {
1223
+ changed: !0,
1224
+ jump: u.scrollTop - R,
1225
+ scrollHeight: H,
1226
+ scrollTop: R
1227
+ } : {
1228
+ changed: !0,
1229
+ jump: 0,
1230
+ scrollHeight: H,
1231
+ scrollTop: R
1232
+ };
1233
+ }
1234
+ },
1235
+ { changed: !1, jump: 0, scrollHeight: 0, scrollTop: 0 }
1236
+ ),
1237
+ P((u) => u.changed),
1238
+ B((u) => u.jump)
1239
+ ),
1240
+ 0
1241
+ );
1242
+ L(
1243
+ I(
1244
+ w,
1245
+ B((u) => u.atBottom)
1246
+ ),
1247
+ l
1248
+ ), L(I(l, ke(50)), c);
1249
+ const g = C(Qe);
1250
+ L(
1251
+ I(
1252
+ n,
1253
+ B(({ scrollTop: u }) => u),
1254
+ Z(),
1255
+ be(
1256
+ (u, H) => oe(v) ? { direction: u.direction, prevScrollTop: H } : { direction: H < u.prevScrollTop ? lt : Qe, prevScrollTop: H },
1257
+ { direction: Qe, prevScrollTop: 0 }
1258
+ ),
1259
+ B((u) => u.direction)
1260
+ ),
1261
+ g
1262
+ ), L(I(n, ke(50), ye(Mn)), g);
1263
+ const h = C(0);
1264
+ return L(
1265
+ I(
1266
+ p,
1267
+ P((u) => !u),
1268
+ ye(0)
1269
+ ),
1270
+ h
1271
+ ), L(
1272
+ I(
1273
+ r,
1274
+ ke(100),
1275
+ D(p),
1276
+ P(([u, H]) => !!H),
1277
+ be(([u, H], [R]) => [H, R], [0, 0]),
1278
+ B(([u, H]) => H - u)
1279
+ ),
1280
+ h
1281
+ ), {
1282
+ atBottomState: w,
1283
+ atBottomStateChange: c,
1284
+ atBottomThreshold: f,
1285
+ atTopStateChange: a,
1286
+ atTopThreshold: T,
1287
+ isAtBottom: l,
1288
+ isAtTop: s,
1289
+ isScrolling: p,
1290
+ lastJumpDueToItemResize: x,
1291
+ scrollDirection: g,
1292
+ scrollVelocity: h
1293
+ };
1294
+ }, J(ae)), vt = "top", It = "bottom", fo = "none";
1295
+ function po(e, t, o) {
1296
+ return typeof e == "number" ? o === lt && t === vt || o === Qe && t === It ? e : 0 : o === lt ? t === vt ? e.main : e.reverse : t === It ? e.main : e.reverse;
1297
+ }
1298
+ function go(e, t) {
1299
+ var o;
1300
+ return typeof e == "number" ? e : (o = e[t]) != null ? o : 0;
1301
+ }
1302
+ const Ut = q(
1303
+ ([{ deviation: e, fixedHeaderHeight: t, headerHeight: o, scrollTop: n, viewportHeight: r }]) => {
1304
+ const i = N(), l = C(0), s = C(0), c = C(0), a = se(
1305
+ I(
1306
+ ne(
1307
+ j(n),
1308
+ j(r),
1309
+ j(o),
1310
+ j(i, rt),
1311
+ j(c),
1312
+ j(l),
1313
+ j(t),
1314
+ j(e),
1315
+ j(s)
1316
+ ),
1317
+ B(
1318
+ ([
1319
+ f,
1320
+ T,
1321
+ p,
1322
+ [v, w],
1323
+ x,
1324
+ g,
1325
+ h,
1326
+ u,
1327
+ H
1328
+ ]) => {
1329
+ const R = f - u, m = g + h, d = Math.max(p - R, 0);
1330
+ let S = fo;
1331
+ const z = go(H, vt), O = go(H, It);
1332
+ return v -= u, v += p + h, w += p + h, w -= u, v > f + m - z && (S = lt), w < f - d + T + O && (S = Qe), S !== fo ? [
1333
+ Math.max(R - p - po(x, vt, S) - z, 0),
1334
+ R - d - h + T + po(x, It, S) + O
1335
+ ] : null;
1336
+ }
1337
+ ),
1338
+ P((f) => f != null),
1339
+ Z(rt)
1340
+ ),
1341
+ [0, 0]
1342
+ );
1343
+ return {
1344
+ increaseViewportBy: s,
1345
+ // input
1346
+ listBoundary: i,
1347
+ overscan: c,
1348
+ topListHeight: l,
1349
+ // output
1350
+ visibleRange: a
1351
+ };
1352
+ },
1353
+ J(ae),
1354
+ { singleton: !0 }
1355
+ );
1356
+ function Pn(e, t, o) {
1357
+ if (Ht(t)) {
1358
+ const n = Vo(e, t);
1359
+ return [
1360
+ { index: Se(t.groupOffsetTree, n)[0], offset: 0, size: 0 },
1361
+ { data: o == null ? void 0 : o[0], index: n, offset: 0, size: 0 }
1362
+ ];
1363
+ }
1364
+ return [{ data: o == null ? void 0 : o[0], index: e, offset: 0, size: 0 }];
1365
+ }
1366
+ const Rt = {
1367
+ bottom: 0,
1368
+ firstItemIndex: 0,
1369
+ items: [],
1370
+ offsetBottom: 0,
1371
+ offsetTop: 0,
1372
+ top: 0,
1373
+ topItems: [],
1374
+ topListHeight: 0,
1375
+ totalCount: 0
1376
+ };
1377
+ function gt(e, t, o, n, r, i) {
1378
+ const { lastIndex: l, lastOffset: s, lastSize: c } = r;
1379
+ let a = 0, f = 0;
1380
+ if (e.length > 0) {
1381
+ a = e[0].offset;
1382
+ const x = e[e.length - 1];
1383
+ f = x.offset + x.size;
1384
+ }
1385
+ const T = o - l, p = s + T * c + (T - 1) * n, v = a, w = p - f;
1386
+ return {
1387
+ bottom: f,
1388
+ firstItemIndex: i,
1389
+ items: xo(e, r, i),
1390
+ offsetBottom: w,
1391
+ offsetTop: a,
1392
+ top: v,
1393
+ topItems: xo(t, r, i),
1394
+ topListHeight: t.reduce((x, g) => g.size + x, 0),
1395
+ totalCount: o
1396
+ };
1397
+ }
1398
+ function _o(e, t, o, n, r, i) {
1399
+ let l = 0;
1400
+ if (o.groupIndices.length > 0)
1401
+ for (const f of o.groupIndices) {
1402
+ if (f - l >= e)
1403
+ break;
1404
+ l++;
1405
+ }
1406
+ const s = e + l, c = qt(t, s), a = Array.from({ length: s }).map((f, T) => ({
1407
+ data: i[T + c],
1408
+ index: T + c,
1409
+ offset: 0,
1410
+ size: 0
1411
+ }));
1412
+ return gt(a, [], s, r, o, n);
1413
+ }
1414
+ function xo(e, t, o) {
1415
+ if (e.length === 0)
1416
+ return [];
1417
+ if (!Ht(t))
1418
+ return e.map((a) => ({ ...a, index: a.index + o, originalIndex: a.index }));
1419
+ const n = e[0].index, r = e[e.length - 1].index, i = [], l = wt(t.groupOffsetTree, n, r);
1420
+ let s, c = 0;
1421
+ for (const a of e) {
1422
+ (!s || s.end < a.index) && (s = l.shift(), c = t.groupIndices.indexOf(s.start));
1423
+ let f;
1424
+ a.index === s.start ? f = {
1425
+ index: c,
1426
+ type: "group"
1427
+ } : f = {
1428
+ groupIndex: c,
1429
+ index: a.index - (c + 1) + o
1430
+ }, i.push({
1431
+ ...f,
1432
+ data: a.data,
1433
+ offset: a.offset,
1434
+ originalIndex: a.index,
1435
+ size: a.size
1436
+ });
1437
+ }
1438
+ return i;
1439
+ }
1440
+ const Ge = q(
1441
+ ([
1442
+ { data: e, firstItemIndex: t, gap: o, sizes: n, totalCount: r },
1443
+ i,
1444
+ { listBoundary: l, topListHeight: s, visibleRange: c },
1445
+ { initialTopMostItemIndex: a, scrolledToInitialItem: f },
1446
+ { topListHeight: T },
1447
+ p,
1448
+ { didMount: v },
1449
+ { recalcInProgress: w }
1450
+ ]) => {
1451
+ const x = C([]), g = C(0), h = N();
1452
+ L(i.topItemsIndexes, x);
1453
+ const u = se(
1454
+ I(
1455
+ ne(
1456
+ v,
1457
+ w,
1458
+ j(c, rt),
1459
+ j(r),
1460
+ j(n),
1461
+ j(a),
1462
+ f,
1463
+ j(x),
1464
+ j(t),
1465
+ j(o),
1466
+ e
1467
+ ),
1468
+ P(([d, S, , z, , , , , , , O]) => {
1469
+ const k = O && O.length !== z;
1470
+ return d && !S && !k;
1471
+ }),
1472
+ B(
1473
+ ([
1474
+ ,
1475
+ ,
1476
+ [d, S],
1477
+ z,
1478
+ O,
1479
+ k,
1480
+ W,
1481
+ _,
1482
+ Y,
1483
+ E,
1484
+ U
1485
+ ]) => {
1486
+ const ie = O, { offsetTree: fe, sizeTree: xe } = ie, ve = oe(g);
1487
+ if (z === 0)
1488
+ return { ...Rt, totalCount: z };
1489
+ if (d === 0 && S === 0)
1490
+ return ve === 0 ? { ...Rt, totalCount: z } : _o(ve, k, O, Y, E, U || []);
1491
+ if ($(xe))
1492
+ return ve > 0 ? null : gt(
1493
+ Pn(qt(k, z), ie, U),
1494
+ [],
1495
+ z,
1496
+ E,
1497
+ ie,
1498
+ Y
1499
+ );
1500
+ const ue = [];
1501
+ if (_.length > 0) {
1502
+ const Ne = _[0], He = _[_.length - 1];
1503
+ let Be = 0;
1504
+ for (const y of wt(xe, Ne, He)) {
1505
+ const G = y.value, Q = Math.max(y.start, Ne), le = Math.min(y.end, He);
1506
+ for (let te = Q; te <= le; te++)
1507
+ ue.push({ data: U == null ? void 0 : U[te], index: te, offset: Be, size: G }), Be += G;
1508
+ }
1509
+ }
1510
+ if (!W)
1511
+ return gt([], ue, z, E, ie, Y);
1512
+ const ce = _.length > 0 ? _[_.length - 1] + 1 : 0, We = yn(fe, d, S, ce);
1513
+ if (We.length === 0)
1514
+ return null;
1515
+ const Ie = z - 1, Ze = St([], (Ne) => {
1516
+ for (const He of We) {
1517
+ const Be = He.value;
1518
+ let y = Be.offset, G = He.start;
1519
+ const Q = Be.size;
1520
+ if (Be.offset < d) {
1521
+ G += Math.floor((d - Be.offset + E) / (Q + E));
1522
+ const te = G - He.start;
1523
+ y += te * Q + te * E;
1524
+ }
1525
+ G < ce && (y += (ce - G) * Q, G = ce);
1526
+ const le = Math.min(He.end, Ie);
1527
+ for (let te = G; te <= le && !(y >= S); te++)
1528
+ Ne.push({ data: U == null ? void 0 : U[te], index: te, offset: y, size: Q }), y += Q + E;
1529
+ }
1530
+ });
1531
+ return gt(Ze, ue, z, E, ie, Y);
1532
+ }
1533
+ ),
1534
+ //@ts-expect-error filter needs to be fixed
1535
+ P((d) => d !== null),
1536
+ Z()
1537
+ ),
1538
+ Rt
1539
+ );
1540
+ L(
1541
+ I(
1542
+ e,
1543
+ P(At),
1544
+ B((d) => d == null ? void 0 : d.length)
1545
+ ),
1546
+ r
1547
+ ), L(
1548
+ I(
1549
+ u,
1550
+ B((d) => d.topListHeight)
1551
+ ),
1552
+ T
1553
+ ), L(T, s), L(
1554
+ I(
1555
+ u,
1556
+ B((d) => [d.top, d.bottom])
1557
+ ),
1558
+ l
1559
+ ), L(
1560
+ I(
1561
+ u,
1562
+ B((d) => d.items)
1563
+ ),
1564
+ h
1565
+ );
1566
+ const H = me(
1567
+ I(
1568
+ u,
1569
+ P(({ items: d }) => d.length > 0),
1570
+ D(r, e),
1571
+ P(([{ items: d }, S]) => d[d.length - 1].originalIndex === S - 1),
1572
+ B(([, d, S]) => [d - 1, S]),
1573
+ Z(rt),
1574
+ B(([d]) => d)
1575
+ )
1576
+ ), R = me(
1577
+ I(
1578
+ u,
1579
+ ke(200),
1580
+ P(({ items: d, topItems: S }) => d.length > 0 && d[0].originalIndex === S.length),
1581
+ B(({ items: d }) => d[0].index),
1582
+ Z()
1583
+ )
1584
+ ), m = me(
1585
+ I(
1586
+ u,
1587
+ P(({ items: d }) => d.length > 0),
1588
+ B(({ items: d }) => {
1589
+ let S = 0, z = d.length - 1;
1590
+ for (; d[S].type === "group" && S < z; )
1591
+ S++;
1592
+ for (; d[z].type === "group" && z > S; )
1593
+ z--;
1594
+ return {
1595
+ endIndex: d[z].index,
1596
+ startIndex: d[S].index
1597
+ };
1598
+ }),
1599
+ Z(Po)
1600
+ )
1601
+ );
1602
+ return { endReached: H, initialItemCount: g, itemsRendered: h, listState: u, rangeChanged: m, startReached: R, topItemsIndexes: x, ...p };
1603
+ },
1604
+ J(
1605
+ Re,
1606
+ Do,
1607
+ Ut,
1608
+ ct,
1609
+ st,
1610
+ at,
1611
+ je,
1612
+ Gt
1613
+ ),
1614
+ { singleton: !0 }
1615
+ ), qo = q(
1616
+ ([{ fixedFooterHeight: e, fixedHeaderHeight: t, footerHeight: o, headerHeight: n }, { listState: r }]) => {
1617
+ const i = N(), l = se(
1618
+ I(
1619
+ ne(o, e, n, t, r),
1620
+ B(([s, c, a, f, T]) => s + c + a + f + T.offsetBottom + T.bottom)
1621
+ ),
1622
+ 0
1623
+ );
1624
+ return L(j(l), i), { totalListHeight: l, totalListHeightChanged: i };
1625
+ },
1626
+ J(ae, Ge),
1627
+ { singleton: !0 }
1628
+ ), An = q(
1629
+ ([{ viewportHeight: e }, { totalListHeight: t }]) => {
1630
+ const o = C(!1), n = se(
1631
+ I(
1632
+ ne(o, e, t),
1633
+ P(([r]) => r),
1634
+ B(([, r, i]) => Math.max(0, r - i)),
1635
+ ke(0),
1636
+ Z()
1637
+ ),
1638
+ 0
1639
+ );
1640
+ return { alignToBottom: o, paddingTopAddition: n };
1641
+ },
1642
+ J(ae, qo),
1643
+ { singleton: !0 }
1644
+ ), Uo = q(() => ({
1645
+ context: C(null)
1646
+ })), Vn = ({
1647
+ itemBottom: e,
1648
+ itemTop: t,
1649
+ locationParams: { align: o, behavior: n, ...r },
1650
+ viewportBottom: i,
1651
+ viewportTop: l
1652
+ }) => t < l ? { ...r, align: o ?? "start", behavior: n } : e > i ? { ...r, align: o ?? "end", behavior: n } : null, Ko = q(
1653
+ ([
1654
+ { gap: e, sizes: t, totalCount: o },
1655
+ { fixedFooterHeight: n, fixedHeaderHeight: r, headerHeight: i, scrollingInProgress: l, scrollTop: s, viewportHeight: c },
1656
+ { scrollToIndex: a }
1657
+ ]) => {
1658
+ const f = N();
1659
+ return L(
1660
+ I(
1661
+ f,
1662
+ D(t, c, o, i, r, n, s),
1663
+ D(e),
1664
+ B(([[T, p, v, w, x, g, h, u], H]) => {
1665
+ const { align: R, behavior: m, calculateViewLocation: d = Vn, done: S, ...z } = T, O = Fo(T, p, w - 1), k = it(O, p.offsetTree, H) + x + g, W = k + Se(p.sizeTree, O)[1], _ = u + g, Y = u + v - h, E = d({
1666
+ itemBottom: W,
1667
+ itemTop: k,
1668
+ locationParams: { align: R, behavior: m, ...z },
1669
+ viewportBottom: Y,
1670
+ viewportTop: _
1671
+ });
1672
+ return E ? S && Te(
1673
+ I(
1674
+ l,
1675
+ P((U) => !U),
1676
+ // skips the initial publish of false, and the cleanup call.
1677
+ // but if scrollingInProgress is true, we skip the initial publish.
1678
+ De(oe(l) ? 1 : 2)
1679
+ ),
1680
+ S
1681
+ ) : S && S(), E;
1682
+ }),
1683
+ P((T) => T !== null)
1684
+ ),
1685
+ a
1686
+ ), {
1687
+ scrollIntoView: f
1688
+ };
1689
+ },
1690
+ J(Re, ae, st, Ge, Me),
1691
+ { singleton: !0 }
1692
+ );
1693
+ function vo(e) {
1694
+ return e ? e === "smooth" ? "smooth" : "auto" : !1;
1695
+ }
1696
+ const Fn = (e, t) => typeof e == "function" ? vo(e(t)) : t && vo(e), Dn = q(
1697
+ ([
1698
+ { listRefresh: e, totalCount: t, fixedItemSize: o, data: n },
1699
+ { atBottomState: r, isAtBottom: i },
1700
+ { scrollToIndex: l },
1701
+ { scrolledToInitialItem: s },
1702
+ { didMount: c, propsReady: a },
1703
+ { log: f },
1704
+ { scrollingInProgress: T },
1705
+ { context: p },
1706
+ { scrollIntoView: v }
1707
+ ]) => {
1708
+ const w = C(!1), x = N();
1709
+ let g = null;
1710
+ function h(m) {
1711
+ F(l, {
1712
+ align: "end",
1713
+ behavior: m,
1714
+ index: "LAST"
1715
+ });
1716
+ }
1717
+ K(
1718
+ I(
1719
+ ne(I(j(t), De(1)), c),
1720
+ D(j(w), i, s, T),
1721
+ B(([[m, d], S, z, O, k]) => {
1722
+ let W = d && O, _ = "auto";
1723
+ return W && (_ = Fn(S, z || k), W = W && !!_), { followOutputBehavior: _, shouldFollow: W, totalCount: m };
1724
+ }),
1725
+ P(({ shouldFollow: m }) => m)
1726
+ ),
1727
+ ({ followOutputBehavior: m, totalCount: d }) => {
1728
+ g && (g(), g = null), oe(o) ? requestAnimationFrame(() => {
1729
+ oe(f)("following output to ", { totalCount: d }, de.DEBUG), h(m);
1730
+ }) : g = Te(e, () => {
1731
+ oe(f)("following output to ", { totalCount: d }, de.DEBUG), h(m), g = null;
1732
+ });
1733
+ }
1734
+ );
1735
+ function u(m) {
1736
+ const d = Te(r, (S) => {
1737
+ m && !S.atBottom && S.notAtBottomBecause === "SIZE_INCREASED" && !g && (oe(f)("scrolling to bottom due to increased size", {}, de.DEBUG), h("auto"));
1738
+ });
1739
+ setTimeout(d, 100);
1740
+ }
1741
+ K(
1742
+ I(
1743
+ ne(j(w), t, a),
1744
+ P(([m, , d]) => m && d),
1745
+ be(
1746
+ ({ value: m }, [, d]) => ({ refreshed: m === d, value: d }),
1747
+ { refreshed: !1, value: 0 }
1748
+ ),
1749
+ P(({ refreshed: m }) => m),
1750
+ D(w, t)
1751
+ ),
1752
+ ([, m]) => {
1753
+ oe(s) && u(m !== !1);
1754
+ }
1755
+ ), K(x, () => {
1756
+ u(oe(w) !== !1);
1757
+ }), K(ne(j(w), r), ([m, d]) => {
1758
+ m && !d.atBottom && d.notAtBottomBecause === "VIEWPORT_HEIGHT_DECREASING" && h("auto");
1759
+ });
1760
+ const H = C(null), R = N();
1761
+ return L(
1762
+ Lt(
1763
+ I(
1764
+ j(n),
1765
+ B((m) => {
1766
+ var d;
1767
+ return (d = m == null ? void 0 : m.length) != null ? d : 0;
1768
+ })
1769
+ ),
1770
+ I(j(t))
1771
+ ),
1772
+ R
1773
+ ), K(
1774
+ I(
1775
+ ne(I(R, De(1)), c),
1776
+ D(j(H), s, T, p),
1777
+ B(([[m, d], S, z, O, k]) => d && z && (S == null ? void 0 : S({ context: k, totalCount: m, scrollingInProgress: O }))),
1778
+ P((m) => !!m),
1779
+ ke(0)
1780
+ ),
1781
+ (m) => {
1782
+ g && (g(), g = null), oe(o) ? requestAnimationFrame(() => {
1783
+ oe(f)("scrolling into view", {}), F(v, m);
1784
+ }) : g = Te(e, () => {
1785
+ oe(f)("scrolling into view", {}), F(v, m), g = null;
1786
+ });
1787
+ }
1788
+ ), { autoscrollToBottom: x, followOutput: w, scrollIntoViewOnChange: H };
1789
+ },
1790
+ J(
1791
+ Re,
1792
+ at,
1793
+ st,
1794
+ ct,
1795
+ je,
1796
+ Me,
1797
+ ae,
1798
+ Uo,
1799
+ Ko
1800
+ )
1801
+ ), Gn = q(
1802
+ ([{ data: e, firstItemIndex: t, gap: o, sizes: n }, { initialTopMostItemIndex: r }, { initialItemCount: i, listState: l }, { didMount: s }]) => (L(
1803
+ I(
1804
+ s,
1805
+ D(i),
1806
+ P(([, c]) => c !== 0),
1807
+ D(r, n, t, o, e),
1808
+ B(([[, c], a, f, T, p, v = []]) => _o(c, a, f, T, p, v))
1809
+ ),
1810
+ l
1811
+ ), {}),
1812
+ J(Re, ct, Ge, je),
1813
+ { singleton: !0 }
1814
+ ), Nn = q(
1815
+ ([{ didMount: e }, { scrollTo: t }, { listState: o }]) => {
1816
+ const n = C(0);
1817
+ return K(
1818
+ I(
1819
+ e,
1820
+ D(n),
1821
+ P(([, r]) => r !== 0),
1822
+ B(([, r]) => ({ top: r }))
1823
+ ),
1824
+ (r) => {
1825
+ Te(
1826
+ I(
1827
+ o,
1828
+ De(1),
1829
+ P((i) => i.items.length > 1)
1830
+ ),
1831
+ () => {
1832
+ requestAnimationFrame(() => {
1833
+ F(t, r);
1834
+ });
1835
+ }
1836
+ );
1837
+ }
1838
+ ), {
1839
+ initialScrollTop: n
1840
+ };
1841
+ },
1842
+ J(je, ae, Ge),
1843
+ { singleton: !0 }
1844
+ ), $o = q(
1845
+ ([{ scrollVelocity: e }]) => {
1846
+ const t = C(!1), o = N(), n = C(!1);
1847
+ return L(
1848
+ I(
1849
+ e,
1850
+ D(n, t, o),
1851
+ P(([r, i]) => !!i),
1852
+ B(([r, i, l, s]) => {
1853
+ const { enter: c, exit: a } = i;
1854
+ if (l) {
1855
+ if (a(r, s))
1856
+ return !1;
1857
+ } else if (c(r, s))
1858
+ return !0;
1859
+ return l;
1860
+ }),
1861
+ Z()
1862
+ ),
1863
+ t
1864
+ ), K(
1865
+ I(ne(t, e, o), D(n)),
1866
+ ([[r, i, l], s]) => {
1867
+ r && s && s.change && s.change(i, l);
1868
+ }
1869
+ ), { isSeeking: t, scrollSeekConfiguration: n, scrollSeekRangeChanged: o, scrollVelocity: e };
1870
+ },
1871
+ J(at),
1872
+ { singleton: !0 }
1873
+ ), Kt = q(([{ scrollContainerState: e, scrollTo: t }]) => {
1874
+ const o = N(), n = N(), r = N(), i = C(!1), l = C(void 0);
1875
+ return L(
1876
+ I(
1877
+ ne(o, n),
1878
+ B(([{ scrollHeight: s, scrollTop: c, viewportHeight: a }, { offsetTop: f }]) => ({
1879
+ scrollHeight: s,
1880
+ scrollTop: Math.max(0, c - f),
1881
+ viewportHeight: a
1882
+ }))
1883
+ ),
1884
+ e
1885
+ ), L(
1886
+ I(
1887
+ t,
1888
+ D(n),
1889
+ B(([s, { offsetTop: c }]) => ({
1890
+ ...s,
1891
+ top: s.top + c
1892
+ }))
1893
+ ),
1894
+ r
1895
+ ), {
1896
+ customScrollParent: l,
1897
+ // config
1898
+ useWindowScroll: i,
1899
+ // input
1900
+ windowScrollContainerState: o,
1901
+ // signals
1902
+ windowScrollTo: r,
1903
+ windowViewportRect: n
1904
+ };
1905
+ }, J(ae)), _n = q(
1906
+ ([
1907
+ { sizeRanges: e, sizes: t },
1908
+ { headerHeight: o, scrollTop: n },
1909
+ { initialTopMostItemIndex: r },
1910
+ { didMount: i },
1911
+ { useWindowScroll: l, windowScrollContainerState: s, windowViewportRect: c }
1912
+ ]) => {
1913
+ const a = N(), f = C(void 0), T = C(null), p = C(null);
1914
+ return L(s, T), L(c, p), K(
1915
+ I(
1916
+ a,
1917
+ D(t, n, l, T, p, o)
1918
+ ),
1919
+ ([v, w, x, g, h, u, H]) => {
1920
+ const R = zn(w.sizeTree);
1921
+ g && h !== null && u !== null && (x = h.scrollTop - u.offsetTop), x -= H, v({ ranges: R, scrollTop: x });
1922
+ }
1923
+ ), L(I(f, P(At), B(qn)), r), L(
1924
+ I(
1925
+ i,
1926
+ D(f),
1927
+ P(([, v]) => v !== void 0),
1928
+ Z(),
1929
+ B(([, v]) => v.ranges)
1930
+ ),
1931
+ e
1932
+ ), {
1933
+ getState: a,
1934
+ restoreStateFrom: f
1935
+ };
1936
+ },
1937
+ J(Re, ae, ct, je, Kt)
1938
+ );
1939
+ function qn(e) {
1940
+ return { align: "start", index: 0, offset: e.scrollTop };
1941
+ }
1942
+ const Un = q(([{ topItemsIndexes: e }]) => {
1943
+ const t = C(0);
1944
+ return L(
1945
+ I(
1946
+ t,
1947
+ P((o) => o >= 0),
1948
+ B((o) => Array.from({ length: o }).map((n, r) => r))
1949
+ ),
1950
+ e
1951
+ ), { topItemCount: t };
1952
+ }, J(Ge));
1953
+ function Yo(e) {
1954
+ let t = !1, o;
1955
+ return () => (t || (t = !0, o = e()), o);
1956
+ }
1957
+ const Kn = Yo(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.test(navigator.userAgent)), $n = q(
1958
+ ([
1959
+ { deviation: e, scrollBy: t, scrollingInProgress: o, scrollTop: n },
1960
+ { isAtBottom: r, isScrolling: i, lastJumpDueToItemResize: l, scrollDirection: s },
1961
+ { listState: c },
1962
+ { beforeUnshiftWith: a, gap: f, shiftWithOffset: T, sizes: p },
1963
+ { log: v },
1964
+ { recalcInProgress: w }
1965
+ ]) => {
1966
+ const x = me(
1967
+ I(
1968
+ c,
1969
+ D(l),
1970
+ be(
1971
+ ([, h, u, H], [{ bottom: R, items: m, offsetBottom: d, totalCount: S }, z]) => {
1972
+ const O = R + d;
1973
+ let k = 0;
1974
+ return u === S && h.length > 0 && m.length > 0 && (m[0].originalIndex === 0 && h[0].originalIndex === 0 || (k = O - H, k !== 0 && (k += z))), [k, m, S, O];
1975
+ },
1976
+ [0, [], 0, 0]
1977
+ ),
1978
+ P(([h]) => h !== 0),
1979
+ D(n, s, o, r, v, w),
1980
+ P(([, h, u, H, , , R]) => !R && !H && h !== 0 && u === lt),
1981
+ B(([[h], , , , , u]) => (u("Upward scrolling compensation", { amount: h }, de.DEBUG), h))
1982
+ )
1983
+ );
1984
+ function g(h) {
1985
+ h > 0 ? (F(t, { behavior: "auto", top: -h }), F(e, 0)) : (F(e, 0), F(t, { behavior: "auto", top: -h }));
1986
+ }
1987
+ return K(I(x, D(e, i)), ([h, u, H]) => {
1988
+ H && Kn() ? F(e, u - h) : g(-h);
1989
+ }), K(
1990
+ I(
1991
+ ne(se(i, !1), e, w),
1992
+ P(([h, u, H]) => !h && !H && u !== 0),
1993
+ B(([h, u]) => u),
1994
+ ke(1)
1995
+ ),
1996
+ g
1997
+ ), L(
1998
+ I(
1999
+ T,
2000
+ B((h) => ({ top: -h }))
2001
+ ),
2002
+ t
2003
+ ), K(
2004
+ I(
2005
+ a,
2006
+ D(p, f),
2007
+ B(([h, { groupIndices: u, lastSize: H, sizeTree: R }, m]) => {
2008
+ function d(S) {
2009
+ return S * (H + m);
2010
+ }
2011
+ if (u.length === 0)
2012
+ return d(h);
2013
+ {
2014
+ let S = 0;
2015
+ const z = nt(R, 0);
2016
+ let O = 0, k = 0;
2017
+ for (; O < h; ) {
2018
+ O++, S += z;
2019
+ let W = u.length === k + 1 ? 1 / 0 : u[k + 1] - u[k] - 1;
2020
+ O + W > h && (S -= z, W = h - O + 1), O += W, S += d(W), k++;
2021
+ }
2022
+ return S;
2023
+ }
2024
+ })
2025
+ ),
2026
+ (h) => {
2027
+ F(e, h), requestAnimationFrame(() => {
2028
+ F(t, { top: h }), requestAnimationFrame(() => {
2029
+ F(e, 0), F(w, !1);
2030
+ });
2031
+ });
2032
+ }
2033
+ ), { deviation: e };
2034
+ },
2035
+ J(ae, at, Ge, Re, Me, Gt)
2036
+ ), Yn = q(
2037
+ ([
2038
+ e,
2039
+ t,
2040
+ o,
2041
+ n,
2042
+ r,
2043
+ i,
2044
+ l,
2045
+ s,
2046
+ c,
2047
+ a,
2048
+ f
2049
+ ]) => ({
2050
+ ...e,
2051
+ ...t,
2052
+ ...o,
2053
+ ...n,
2054
+ ...r,
2055
+ ...i,
2056
+ ...l,
2057
+ ...s,
2058
+ ...c,
2059
+ ...a,
2060
+ ...f
2061
+ }),
2062
+ J(
2063
+ Ut,
2064
+ Gn,
2065
+ je,
2066
+ $o,
2067
+ qo,
2068
+ Nn,
2069
+ An,
2070
+ Kt,
2071
+ Ko,
2072
+ Me,
2073
+ Uo
2074
+ )
2075
+ ), Zo = q(
2076
+ ([
2077
+ {
2078
+ data: e,
2079
+ defaultItemSize: t,
2080
+ firstItemIndex: o,
2081
+ fixedItemSize: n,
2082
+ gap: r,
2083
+ groupIndices: i,
2084
+ itemSize: l,
2085
+ sizeRanges: s,
2086
+ sizes: c,
2087
+ statefulTotalCount: a,
2088
+ totalCount: f,
2089
+ trackItemSizes: T
2090
+ },
2091
+ { initialItemFinalLocationReached: p, initialTopMostItemIndex: v, scrolledToInitialItem: w },
2092
+ x,
2093
+ g,
2094
+ h,
2095
+ { listState: u, topItemsIndexes: H, ...R },
2096
+ { scrollToIndex: m },
2097
+ d,
2098
+ { topItemCount: S },
2099
+ { groupCounts: z },
2100
+ O
2101
+ ]) => (L(R.rangeChanged, O.scrollSeekRangeChanged), L(
2102
+ I(
2103
+ O.windowViewportRect,
2104
+ B((k) => k.visibleHeight)
2105
+ ),
2106
+ x.viewportHeight
2107
+ ), {
2108
+ data: e,
2109
+ defaultItemHeight: t,
2110
+ firstItemIndex: o,
2111
+ fixedItemHeight: n,
2112
+ gap: r,
2113
+ groupCounts: z,
2114
+ initialItemFinalLocationReached: p,
2115
+ initialTopMostItemIndex: v,
2116
+ scrolledToInitialItem: w,
2117
+ sizeRanges: s,
2118
+ topItemCount: S,
2119
+ topItemsIndexes: H,
2120
+ // input
2121
+ totalCount: f,
2122
+ ...h,
2123
+ groupIndices: i,
2124
+ itemSize: l,
2125
+ listState: u,
2126
+ scrollToIndex: m,
2127
+ // output
2128
+ statefulTotalCount: a,
2129
+ trackItemSizes: T,
2130
+ // exported from stateFlagsSystem
2131
+ ...R,
2132
+ // the bag of IO from featureGroup1System
2133
+ ...O,
2134
+ ...x,
2135
+ sizes: c,
2136
+ ...g
2137
+ }),
2138
+ J(
2139
+ Re,
2140
+ ct,
2141
+ ae,
2142
+ _n,
2143
+ Dn,
2144
+ Ge,
2145
+ st,
2146
+ $n,
2147
+ Un,
2148
+ Do,
2149
+ Yn
2150
+ )
2151
+ );
2152
+ function Zn(e, t) {
2153
+ const o = {}, n = {};
2154
+ let r = 0;
2155
+ const i = e.length;
2156
+ for (; r < i; )
2157
+ n[e[r]] = 1, r += 1;
2158
+ for (const l in t)
2159
+ Object.hasOwn(n, l) || (o[l] = t[l]);
2160
+ return o;
2161
+ }
2162
+ const mt = typeof document < "u" ? b.useLayoutEffect : b.useEffect;
2163
+ function $t(e, t, o) {
2164
+ const n = Object.keys(t.required || {}), r = Object.keys(t.optional || {}), i = Object.keys(t.methods || {}), l = Object.keys(t.events || {}), s = b.createContext({});
2165
+ function c(g, h) {
2166
+ g.propsReady && F(g.propsReady, !1);
2167
+ for (const u of n) {
2168
+ const H = g[t.required[u]];
2169
+ F(H, h[u]);
2170
+ }
2171
+ for (const u of r)
2172
+ if (u in h) {
2173
+ const H = g[t.optional[u]];
2174
+ F(H, h[u]);
2175
+ }
2176
+ g.propsReady && F(g.propsReady, !0);
2177
+ }
2178
+ function a(g) {
2179
+ return i.reduce((h, u) => (h[u] = (H) => {
2180
+ const R = g[t.methods[u]];
2181
+ F(R, H);
2182
+ }, h), {});
2183
+ }
2184
+ function f(g) {
2185
+ return l.reduce((h, u) => (h[u] = mn(g[t.events[u]]), h), {});
2186
+ }
2187
+ const T = b.forwardRef((g, h) => {
2188
+ const { children: u, ...H } = g, [R] = b.useState(() => St(pn(e), (S) => {
2189
+ c(S, H);
2190
+ })), [m] = b.useState(co(f, R));
2191
+ mt(() => {
2192
+ for (const S of l)
2193
+ S in H && K(m[S], H[S]);
2194
+ return () => {
2195
+ Object.values(m).map(Vt);
2196
+ };
2197
+ }, [H, m, R]), mt(() => {
2198
+ c(R, H);
2199
+ }), b.useImperativeHandle(h, so(a(R)));
2200
+ const d = o;
2201
+ return /* @__PURE__ */ M.jsx(s.Provider, { value: R, children: o ? /* @__PURE__ */ M.jsx(d, { ...Zn([...n, ...r, ...l], H), children: u }) : u });
2202
+ }), p = (g) => {
2203
+ const h = b.useContext(s);
2204
+ return b.useCallback(
2205
+ (u) => {
2206
+ F(h[g], u);
2207
+ },
2208
+ [h, g]
2209
+ );
2210
+ }, v = (g) => {
2211
+ const h = b.useContext(s)[g], u = b.useCallback(
2212
+ (H) => K(h, H),
2213
+ [h]
2214
+ );
2215
+ return b.useSyncExternalStore(
2216
+ u,
2217
+ () => oe(h),
2218
+ () => oe(h)
2219
+ );
2220
+ }, w = (g) => {
2221
+ const h = b.useContext(s)[g], [u, H] = b.useState(co(oe, h));
2222
+ return mt(
2223
+ () => K(h, (R) => {
2224
+ R !== u && H(so(R));
2225
+ }),
2226
+ [h, u]
2227
+ ), u;
2228
+ }, x = b.version.startsWith("18") ? v : w;
2229
+ return {
2230
+ Component: T,
2231
+ useEmitter: (g, h) => {
2232
+ const u = b.useContext(s)[g];
2233
+ mt(() => K(u, h), [h, u]);
2234
+ },
2235
+ useEmitterValue: x,
2236
+ usePublisher: p
2237
+ };
2238
+ }
2239
+ const yt = b.createContext(void 0), Xo = b.createContext(void 0), Jo = typeof document < "u" ? b.useLayoutEffect : b.useEffect;
2240
+ function Bt(e) {
2241
+ return "self" in e;
2242
+ }
2243
+ function Xn(e) {
2244
+ return "body" in e;
2245
+ }
2246
+ function Qo(e, t, o, n = $e, r, i) {
2247
+ const l = b.useRef(null), s = b.useRef(null), c = b.useRef(null), a = b.useCallback(
2248
+ (p) => {
2249
+ let v, w, x;
2250
+ const g = p.target;
2251
+ if (Xn(g) || Bt(g)) {
2252
+ const u = Bt(g) ? g : g.defaultView;
2253
+ x = i ? u.scrollX : u.scrollY, v = i ? u.document.documentElement.scrollWidth : u.document.documentElement.scrollHeight, w = i ? u.innerWidth : u.innerHeight;
2254
+ } else
2255
+ x = i ? g.scrollLeft : g.scrollTop, v = i ? g.scrollWidth : g.scrollHeight, w = i ? g.offsetWidth : g.offsetHeight;
2256
+ const h = () => {
2257
+ e({
2258
+ scrollHeight: v,
2259
+ scrollTop: Math.max(x, 0),
2260
+ viewportHeight: w
2261
+ });
2262
+ };
2263
+ p.suppressFlushSync ? h() : sn.flushSync(h), s.current !== null && (x === s.current || x <= 0 || x === v - w) && (s.current = null, t(!0), c.current && (clearTimeout(c.current), c.current = null));
2264
+ },
2265
+ [e, t, i]
2266
+ );
2267
+ b.useEffect(() => {
2268
+ const p = r || l.current;
2269
+ return n(r || l.current), a({ suppressFlushSync: !0, target: p }), p.addEventListener("scroll", a, { passive: !0 }), () => {
2270
+ n(null), p.removeEventListener("scroll", a);
2271
+ };
2272
+ }, [l, a, o, n, r]);
2273
+ function f(p) {
2274
+ const v = l.current;
2275
+ if (!v || (i ? "offsetWidth" in v && v.offsetWidth === 0 : "offsetHeight" in v && v.offsetHeight === 0))
2276
+ return;
2277
+ const w = p.behavior === "smooth";
2278
+ let x, g, h;
2279
+ Bt(v) ? (g = Math.max(
2280
+ we(v.document.documentElement, i ? "width" : "height"),
2281
+ i ? v.document.documentElement.scrollWidth : v.document.documentElement.scrollHeight
2282
+ ), x = i ? v.innerWidth : v.innerHeight, h = i ? window.scrollX : window.scrollY) : (g = v[i ? "scrollWidth" : "scrollHeight"], x = we(v, i ? "width" : "height"), h = v[i ? "scrollLeft" : "scrollTop"]);
2283
+ const u = g - x;
2284
+ if (p.top = Math.ceil(Math.max(Math.min(u, p.top), 0)), No(x, g) || p.top === h) {
2285
+ e({ scrollHeight: g, scrollTop: h, viewportHeight: x }), w && t(!0);
2286
+ return;
2287
+ }
2288
+ w ? (s.current = p.top, c.current && clearTimeout(c.current), c.current = setTimeout(() => {
2289
+ c.current = null, s.current = null, t(!0);
2290
+ }, 1e3)) : s.current = null, i && (p = { behavior: p.behavior, left: p.top }), v.scrollTo(p);
2291
+ }
2292
+ function T(p) {
2293
+ i && (p = { behavior: p.behavior, left: p.top }), l.current.scrollBy(p);
2294
+ }
2295
+ return { scrollByCallback: T, scrollerRef: l, scrollToCallback: f };
2296
+ }
2297
+ const kt = "-webkit-sticky", Io = "sticky", Yt = Yo(() => {
2298
+ if (typeof document > "u")
2299
+ return Io;
2300
+ const e = document.createElement("div");
2301
+ return e.style.position = kt, e.style.position === kt ? kt : Io;
2302
+ });
2303
+ function Zt(e) {
2304
+ return e;
2305
+ }
2306
+ const Jn = /* @__PURE__ */ q(() => {
2307
+ const e = C((s) => `Item ${s}`), t = C((s) => `Group ${s}`), o = C({}), n = C(Zt), r = C("div"), i = C($e), l = (s, c = null) => se(
2308
+ I(
2309
+ o,
2310
+ B((a) => a[s]),
2311
+ Z()
2312
+ ),
2313
+ c
2314
+ );
2315
+ return {
2316
+ components: o,
2317
+ computeItemKey: n,
2318
+ EmptyPlaceholder: l("EmptyPlaceholder"),
2319
+ FooterComponent: l("Footer"),
2320
+ GroupComponent: l("Group", "div"),
2321
+ groupContent: t,
2322
+ HeaderComponent: l("Header"),
2323
+ HeaderFooterTag: r,
2324
+ ItemComponent: l("Item", "div"),
2325
+ itemContent: e,
2326
+ ListComponent: l("List", "div"),
2327
+ ScrollerComponent: l("Scroller", "div"),
2328
+ scrollerRef: i,
2329
+ ScrollSeekPlaceholder: l("ScrollSeekPlaceholder"),
2330
+ TopItemListComponent: l("TopItemList")
2331
+ };
2332
+ }), Qn = /* @__PURE__ */ q(
2333
+ ([e, t]) => ({ ...e, ...t }),
2334
+ J(Zo, Jn)
2335
+ ), er = ({ height: e }) => /* @__PURE__ */ M.jsx("div", { style: { height: e } }), tr = { overflowAnchor: "none", position: Yt(), zIndex: 1 }, en = { overflowAnchor: "none" }, or = { ...en, display: "inline-block", height: "100%" }, To = /* @__PURE__ */ b.memo(function({ showTopList: e = !1 }) {
2336
+ const t = A("listState"), o = pe("sizeRanges"), n = A("useWindowScroll"), r = A("customScrollParent"), i = pe("windowScrollContainerState"), l = pe("scrollContainerState"), s = r || n ? i : l, c = A("itemContent"), a = A("context"), f = A("groupContent"), T = A("trackItemSizes"), p = A("itemSize"), v = A("log"), w = pe("gap"), x = A("horizontalDirection"), { callbackRef: g } = Eo(
2337
+ o,
2338
+ p,
2339
+ T,
2340
+ e ? $e : s,
2341
+ v,
2342
+ w,
2343
+ r,
2344
+ x,
2345
+ A("skipAnimationFrameInResizeObserver")
2346
+ ), [h, u] = b.useState(0);
2347
+ Qt("deviation", (E) => {
2348
+ h !== E && u(E);
2349
+ });
2350
+ const H = A("EmptyPlaceholder"), R = A("ScrollSeekPlaceholder") || er, m = A("ListComponent"), d = A("ItemComponent"), S = A("GroupComponent"), z = A("computeItemKey"), O = A("isSeeking"), k = A("groupIndices").length > 0, W = A("alignToBottom"), _ = A("initialItemFinalLocationReached"), Y = e ? {} : {
2351
+ boxSizing: "border-box",
2352
+ ...x ? {
2353
+ display: "inline-block",
2354
+ height: "100%",
2355
+ marginLeft: h !== 0 ? h : W ? "auto" : 0,
2356
+ paddingLeft: t.offsetTop,
2357
+ paddingRight: t.offsetBottom,
2358
+ whiteSpace: "nowrap"
2359
+ } : {
2360
+ marginTop: h !== 0 ? h : W ? "auto" : 0,
2361
+ paddingBottom: t.offsetBottom,
2362
+ paddingTop: t.offsetTop
2363
+ },
2364
+ ..._ ? {} : { visibility: "hidden" }
2365
+ };
2366
+ return !e && t.totalCount === 0 && H ? /* @__PURE__ */ M.jsx(H, { ...X(H, a) }) : /* @__PURE__ */ M.jsx(
2367
+ m,
2368
+ {
2369
+ ...X(m, a),
2370
+ "data-testid": e ? "virtuoso-top-item-list" : "virtuoso-item-list",
2371
+ ref: g,
2372
+ style: Y,
2373
+ children: (e ? t.topItems : t.items).map((E) => {
2374
+ const U = E.originalIndex, ie = z(U + t.firstItemIndex, E.data, a);
2375
+ return O ? /* @__PURE__ */ Fe(
2376
+ R,
2377
+ {
2378
+ ...X(R, a),
2379
+ height: E.size,
2380
+ index: E.index,
2381
+ key: ie,
2382
+ type: E.type || "item",
2383
+ ...E.type === "group" ? {} : { groupIndex: E.groupIndex }
2384
+ }
2385
+ ) : E.type === "group" ? /* @__PURE__ */ Fe(
2386
+ S,
2387
+ {
2388
+ ...X(S, a),
2389
+ "data-index": U,
2390
+ "data-item-index": E.index,
2391
+ "data-known-size": E.size,
2392
+ key: ie,
2393
+ style: tr
2394
+ },
2395
+ f(E.index, a)
2396
+ ) : /* @__PURE__ */ Fe(
2397
+ d,
2398
+ {
2399
+ ...X(d, a),
2400
+ ...tn(d, E.data),
2401
+ "data-index": U,
2402
+ "data-item-group-index": E.groupIndex,
2403
+ "data-item-index": E.index,
2404
+ "data-known-size": E.size,
2405
+ key: ie,
2406
+ style: x ? or : en
2407
+ },
2408
+ k ? c(E.index, E.groupIndex, E.data, a) : c(E.index, E.data, a)
2409
+ );
2410
+ })
2411
+ }
2412
+ );
2413
+ }), nr = {
2414
+ height: "100%",
2415
+ outline: "none",
2416
+ overflowY: "auto",
2417
+ position: "relative",
2418
+ WebkitOverflowScrolling: "touch"
2419
+ }, rr = {
2420
+ outline: "none",
2421
+ overflowX: "auto",
2422
+ position: "relative"
2423
+ }, Ye = (e) => ({
2424
+ height: "100%",
2425
+ position: "absolute",
2426
+ top: 0,
2427
+ width: "100%",
2428
+ ...e ? { display: "flex", flexDirection: "column" } : {}
2429
+ }), ir = {
2430
+ position: Yt(),
2431
+ top: 0,
2432
+ width: "100%",
2433
+ zIndex: 1
2434
+ };
2435
+ function X(e, t) {
2436
+ if (typeof e != "string")
2437
+ return { context: t };
2438
+ }
2439
+ function tn(e, t) {
2440
+ return { item: typeof e == "string" ? void 0 : t };
2441
+ }
2442
+ const lr = /* @__PURE__ */ b.memo(function() {
2443
+ const e = A("HeaderComponent"), t = pe("headerHeight"), o = A("HeaderFooterTag"), n = ze(
2444
+ b.useMemo(
2445
+ () => (i) => {
2446
+ t(we(i, "height"));
2447
+ },
2448
+ [t]
2449
+ ),
2450
+ !0,
2451
+ A("skipAnimationFrameInResizeObserver")
2452
+ ), r = A("context");
2453
+ return e ? /* @__PURE__ */ M.jsx(o, { ref: n, children: /* @__PURE__ */ M.jsx(e, { ...X(e, r) }) }) : null;
2454
+ }), sr = /* @__PURE__ */ b.memo(function() {
2455
+ const e = A("FooterComponent"), t = pe("footerHeight"), o = A("HeaderFooterTag"), n = ze(
2456
+ b.useMemo(
2457
+ () => (i) => {
2458
+ t(we(i, "height"));
2459
+ },
2460
+ [t]
2461
+ ),
2462
+ !0,
2463
+ A("skipAnimationFrameInResizeObserver")
2464
+ ), r = A("context");
2465
+ return e ? /* @__PURE__ */ M.jsx(o, { ref: n, children: /* @__PURE__ */ M.jsx(e, { ...X(e, r) }) }) : null;
2466
+ });
2467
+ function Xt({ useEmitter: e, useEmitterValue: t, usePublisher: o }) {
2468
+ return b.memo(function({ children: n, style: r, context: i, ...l }) {
2469
+ const s = o("scrollContainerState"), c = t("ScrollerComponent"), a = o("smoothScrollTargetReached"), f = t("scrollerRef"), T = t("horizontalDirection") || !1, { scrollByCallback: p, scrollerRef: v, scrollToCallback: w } = Qo(
2470
+ s,
2471
+ a,
2472
+ c,
2473
+ f,
2474
+ void 0,
2475
+ T
2476
+ );
2477
+ return e("scrollTo", w), e("scrollBy", p), /* @__PURE__ */ M.jsx(
2478
+ c,
2479
+ {
2480
+ "data-testid": "virtuoso-scroller",
2481
+ "data-virtuoso-scroller": !0,
2482
+ ref: v,
2483
+ style: { ...T ? rr : nr, ...r },
2484
+ tabIndex: 0,
2485
+ ...l,
2486
+ ...X(c, i),
2487
+ children: n
2488
+ }
2489
+ );
2490
+ });
2491
+ }
2492
+ function Jt({ useEmitter: e, useEmitterValue: t, usePublisher: o }) {
2493
+ return b.memo(function({ children: n, style: r, context: i, ...l }) {
2494
+ const s = o("windowScrollContainerState"), c = t("ScrollerComponent"), a = o("smoothScrollTargetReached"), f = t("totalListHeight"), T = t("deviation"), p = t("customScrollParent"), v = b.useRef(null), w = t("scrollerRef"), { scrollByCallback: x, scrollerRef: g, scrollToCallback: h } = Qo(
2495
+ s,
2496
+ a,
2497
+ c,
2498
+ w,
2499
+ p
2500
+ );
2501
+ return Jo(() => {
2502
+ var u;
2503
+ return g.current = p || ((u = v.current) == null ? void 0 : u.ownerDocument.defaultView), () => {
2504
+ g.current = null;
2505
+ };
2506
+ }, [g, p]), e("windowScrollTo", h), e("scrollBy", x), /* @__PURE__ */ M.jsx(
2507
+ c,
2508
+ {
2509
+ ref: v,
2510
+ "data-virtuoso-scroller": !0,
2511
+ style: { position: "relative", ...r, ...f !== 0 ? { height: f + T } : {} },
2512
+ ...l,
2513
+ ...X(c, i),
2514
+ children: n
2515
+ }
2516
+ );
2517
+ });
2518
+ }
2519
+ const cr = ({ children: e }) => {
2520
+ const t = b.useContext(yt), o = pe("viewportHeight"), n = pe("fixedItemHeight"), r = A("alignToBottom"), i = A("horizontalDirection"), l = b.useMemo(
2521
+ () => tt(o, (c) => we(c, i ? "width" : "height")),
2522
+ [o, i]
2523
+ ), s = ze(l, !0, A("skipAnimationFrameInResizeObserver"));
2524
+ return b.useEffect(() => {
2525
+ t && (o(t.viewportHeight), n(t.itemHeight));
2526
+ }, [t, o, n]), /* @__PURE__ */ M.jsx("div", { "data-viewport-type": "element", ref: s, style: Ye(r), children: e });
2527
+ }, ar = ({ children: e }) => {
2528
+ const t = b.useContext(yt), o = pe("windowViewportRect"), n = pe("fixedItemHeight"), r = A("customScrollParent"), i = Dt(
2529
+ o,
2530
+ r,
2531
+ A("skipAnimationFrameInResizeObserver")
2532
+ ), l = A("alignToBottom");
2533
+ return b.useEffect(() => {
2534
+ t && (n(t.itemHeight), o({ offsetTop: 0, visibleHeight: t.viewportHeight, visibleWidth: 100 }));
2535
+ }, [t, o, n]), /* @__PURE__ */ M.jsx("div", { "data-viewport-type": "window", ref: i, style: Ye(l), children: e });
2536
+ }, ur = ({ children: e }) => {
2537
+ const t = A("TopItemListComponent") || "div", o = A("headerHeight"), n = { ...ir, marginTop: `${o}px` }, r = A("context");
2538
+ return /* @__PURE__ */ M.jsx(t, { style: n, ...X(t, r), children: e });
2539
+ }, dr = /* @__PURE__ */ b.memo(function(e) {
2540
+ const t = A("useWindowScroll"), o = A("topItemsIndexes").length > 0, n = A("customScrollParent"), r = A("context");
2541
+ return /* @__PURE__ */ M.jsxs(n || t ? fr : mr, { ...e, context: r, children: [
2542
+ o && /* @__PURE__ */ M.jsx(ur, { children: /* @__PURE__ */ M.jsx(To, { showTopList: !0 }) }),
2543
+ /* @__PURE__ */ M.jsxs(n || t ? ar : cr, { children: [
2544
+ /* @__PURE__ */ M.jsx(lr, {}),
2545
+ /* @__PURE__ */ M.jsx(To, {}),
2546
+ /* @__PURE__ */ M.jsx(sr, {})
2547
+ ] })
2548
+ ] });
2549
+ }), {
2550
+ Component: hr,
2551
+ useEmitter: Qt,
2552
+ useEmitterValue: A,
2553
+ usePublisher: pe
2554
+ } = /* @__PURE__ */ $t(
2555
+ Qn,
2556
+ {
2557
+ required: {},
2558
+ optional: {
2559
+ restoreStateFrom: "restoreStateFrom",
2560
+ context: "context",
2561
+ followOutput: "followOutput",
2562
+ scrollIntoViewOnChange: "scrollIntoViewOnChange",
2563
+ itemContent: "itemContent",
2564
+ groupContent: "groupContent",
2565
+ overscan: "overscan",
2566
+ increaseViewportBy: "increaseViewportBy",
2567
+ totalCount: "totalCount",
2568
+ groupCounts: "groupCounts",
2569
+ topItemCount: "topItemCount",
2570
+ firstItemIndex: "firstItemIndex",
2571
+ initialTopMostItemIndex: "initialTopMostItemIndex",
2572
+ components: "components",
2573
+ atBottomThreshold: "atBottomThreshold",
2574
+ atTopThreshold: "atTopThreshold",
2575
+ computeItemKey: "computeItemKey",
2576
+ defaultItemHeight: "defaultItemHeight",
2577
+ fixedItemHeight: "fixedItemHeight",
2578
+ itemSize: "itemSize",
2579
+ scrollSeekConfiguration: "scrollSeekConfiguration",
2580
+ headerFooterTag: "HeaderFooterTag",
2581
+ data: "data",
2582
+ initialItemCount: "initialItemCount",
2583
+ initialScrollTop: "initialScrollTop",
2584
+ alignToBottom: "alignToBottom",
2585
+ useWindowScroll: "useWindowScroll",
2586
+ customScrollParent: "customScrollParent",
2587
+ scrollerRef: "scrollerRef",
2588
+ logLevel: "logLevel",
2589
+ horizontalDirection: "horizontalDirection",
2590
+ skipAnimationFrameInResizeObserver: "skipAnimationFrameInResizeObserver"
2591
+ },
2592
+ methods: {
2593
+ scrollToIndex: "scrollToIndex",
2594
+ scrollIntoView: "scrollIntoView",
2595
+ scrollTo: "scrollTo",
2596
+ scrollBy: "scrollBy",
2597
+ autoscrollToBottom: "autoscrollToBottom",
2598
+ getState: "getState"
2599
+ },
2600
+ events: {
2601
+ isScrolling: "isScrolling",
2602
+ endReached: "endReached",
2603
+ startReached: "startReached",
2604
+ rangeChanged: "rangeChanged",
2605
+ atBottomStateChange: "atBottomStateChange",
2606
+ atTopStateChange: "atTopStateChange",
2607
+ totalListHeightChanged: "totalListHeightChanged",
2608
+ itemsRendered: "itemsRendered",
2609
+ groupIndices: "groupIndices"
2610
+ }
2611
+ },
2612
+ dr
2613
+ ), mr = /* @__PURE__ */ Xt({ useEmitter: Qt, useEmitterValue: A, usePublisher: pe }), fr = /* @__PURE__ */ Jt({ useEmitter: Qt, useEmitterValue: A, usePublisher: pe }), _r = hr, pr = /* @__PURE__ */ q(() => {
2614
+ const e = C((a) => /* @__PURE__ */ M.jsxs("td", { children: [
2615
+ "Item $",
2616
+ a
2617
+ ] })), t = C(null), o = C((a) => /* @__PURE__ */ M.jsxs("td", { colSpan: 1e3, children: [
2618
+ "Group ",
2619
+ a
2620
+ ] })), n = C(null), r = C(null), i = C({}), l = C(Zt), s = C($e), c = (a, f = null) => se(
2621
+ I(
2622
+ i,
2623
+ B((T) => T[a]),
2624
+ Z()
2625
+ ),
2626
+ f
2627
+ );
2628
+ return {
2629
+ components: i,
2630
+ computeItemKey: l,
2631
+ context: t,
2632
+ EmptyPlaceholder: c("EmptyPlaceholder"),
2633
+ FillerRow: c("FillerRow"),
2634
+ fixedFooterContent: r,
2635
+ fixedHeaderContent: n,
2636
+ itemContent: e,
2637
+ groupContent: o,
2638
+ ScrollerComponent: c("Scroller", "div"),
2639
+ scrollerRef: s,
2640
+ ScrollSeekPlaceholder: c("ScrollSeekPlaceholder"),
2641
+ TableBodyComponent: c("TableBody", "tbody"),
2642
+ TableComponent: c("Table", "table"),
2643
+ TableFooterComponent: c("TableFoot", "tfoot"),
2644
+ TableHeadComponent: c("TableHead", "thead"),
2645
+ TableRowComponent: c("TableRow", "tr"),
2646
+ GroupComponent: c("Group", "tr")
2647
+ };
2648
+ }), gr = /* @__PURE__ */ q(
2649
+ ([e, t]) => ({ ...e, ...t }),
2650
+ J(Zo, pr)
2651
+ ), xr = ({ height: e }) => /* @__PURE__ */ M.jsx("tr", { children: /* @__PURE__ */ M.jsx("td", { style: { height: e } }) }), vr = ({ height: e }) => /* @__PURE__ */ M.jsx("tr", { children: /* @__PURE__ */ M.jsx("td", { style: { border: 0, height: e, padding: 0 } }) }), Ir = { overflowAnchor: "none" }, Co = { position: Yt(), zIndex: 2, overflowAnchor: "none" }, So = /* @__PURE__ */ b.memo(function({ showTopList: e = !1 }) {
2652
+ const t = V("listState"), o = V("computeItemKey"), n = V("firstItemIndex"), r = V("context"), i = V("isSeeking"), l = V("fixedHeaderHeight"), s = V("groupIndices").length > 0, c = V("itemContent"), a = V("groupContent"), f = V("ScrollSeekPlaceholder") || xr, T = V("GroupComponent"), p = V("TableRowComponent"), v = (e ? t.topItems : []).reduce((x, g, h) => (h === 0 ? x.push(g.size) : x.push(x[h - 1] + g.size), x), []), w = (e ? t.topItems : t.items).map((x) => {
2653
+ const g = x.originalIndex, h = o(g + n, x.data, r), u = e ? g === 0 ? 0 : v[g - 1] : 0;
2654
+ return i ? /* @__PURE__ */ Fe(
2655
+ f,
2656
+ {
2657
+ ...X(f, r),
2658
+ height: x.size,
2659
+ index: x.index,
2660
+ key: h,
2661
+ type: x.type || "item"
2662
+ }
2663
+ ) : x.type === "group" ? /* @__PURE__ */ Fe(
2664
+ T,
2665
+ {
2666
+ ...X(T, r),
2667
+ "data-index": g,
2668
+ "data-item-index": x.index,
2669
+ "data-known-size": x.size,
2670
+ key: h,
2671
+ style: {
2672
+ ...Co,
2673
+ top: l
2674
+ }
2675
+ },
2676
+ a(x.index, r)
2677
+ ) : /* @__PURE__ */ Fe(
2678
+ p,
2679
+ {
2680
+ ...X(p, r),
2681
+ ...tn(p, x.data),
2682
+ "data-index": g,
2683
+ "data-item-index": x.index,
2684
+ "data-known-size": x.size,
2685
+ "data-item-group-index": x.groupIndex,
2686
+ key: h,
2687
+ style: e ? { ...Co, top: l + u } : Ir
2688
+ },
2689
+ s ? c(x.index, x.groupIndex, x.data, r) : c(x.index, x.data, r)
2690
+ );
2691
+ });
2692
+ return /* @__PURE__ */ M.jsx(M.Fragment, { children: w });
2693
+ }), Tr = /* @__PURE__ */ b.memo(function() {
2694
+ const e = V("listState"), t = V("topItemsIndexes").length > 0, o = Ce("sizeRanges"), n = V("useWindowScroll"), r = V("customScrollParent"), i = Ce("windowScrollContainerState"), l = Ce("scrollContainerState"), s = r || n ? i : l, c = V("trackItemSizes"), a = V("itemSize"), f = V("log"), { callbackRef: T, ref: p } = Eo(
2695
+ o,
2696
+ a,
2697
+ c,
2698
+ s,
2699
+ f,
2700
+ void 0,
2701
+ r,
2702
+ !1,
2703
+ V("skipAnimationFrameInResizeObserver")
2704
+ ), [v, w] = b.useState(0);
2705
+ eo("deviation", (k) => {
2706
+ v !== k && (p.current.style.marginTop = `${k}px`, w(k));
2707
+ });
2708
+ const x = V("EmptyPlaceholder"), g = V("FillerRow") || vr, h = V("TableBodyComponent"), u = V("paddingTopAddition"), H = V("statefulTotalCount"), R = V("context");
2709
+ if (H === 0 && x)
2710
+ return /* @__PURE__ */ M.jsx(x, { ...X(x, R) });
2711
+ const m = (t ? e.topItems : []).reduce((k, W) => k + W.size, 0), d = e.offsetTop + u + v - m, S = e.offsetBottom, z = d > 0 ? /* @__PURE__ */ M.jsx(g, { context: R, height: d }, "padding-top") : null, O = S > 0 ? /* @__PURE__ */ M.jsx(g, { context: R, height: S }, "padding-bottom") : null;
2712
+ return /* @__PURE__ */ M.jsxs(h, { "data-testid": "virtuoso-item-list", ref: T, ...X(h, R), children: [
2713
+ z,
2714
+ t && /* @__PURE__ */ M.jsx(So, { showTopList: !0 }),
2715
+ /* @__PURE__ */ M.jsx(So, {}),
2716
+ O
2717
+ ] });
2718
+ }), Cr = ({ children: e }) => {
2719
+ const t = b.useContext(yt), o = Ce("viewportHeight"), n = Ce("fixedItemHeight"), r = ze(
2720
+ b.useMemo(() => tt(o, (i) => we(i, "height")), [o]),
2721
+ !0,
2722
+ V("skipAnimationFrameInResizeObserver")
2723
+ );
2724
+ return b.useEffect(() => {
2725
+ t && (o(t.viewportHeight), n(t.itemHeight));
2726
+ }, [t, o, n]), /* @__PURE__ */ M.jsx("div", { "data-viewport-type": "element", ref: r, style: Ye(!1), children: e });
2727
+ }, Sr = ({ children: e }) => {
2728
+ const t = b.useContext(yt), o = Ce("windowViewportRect"), n = Ce("fixedItemHeight"), r = V("customScrollParent"), i = Dt(
2729
+ o,
2730
+ r,
2731
+ V("skipAnimationFrameInResizeObserver")
2732
+ );
2733
+ return b.useEffect(() => {
2734
+ t && (n(t.itemHeight), o({ offsetTop: 0, visibleHeight: t.viewportHeight, visibleWidth: 100 }));
2735
+ }, [t, o, n]), /* @__PURE__ */ M.jsx("div", { "data-viewport-type": "window", ref: i, style: Ye(!1), children: e });
2736
+ }, wr = /* @__PURE__ */ b.memo(function(e) {
2737
+ const t = V("useWindowScroll"), o = V("customScrollParent"), n = Ce("fixedHeaderHeight"), r = Ce("fixedFooterHeight"), i = V("fixedHeaderContent"), l = V("fixedFooterContent"), s = V("context"), c = ze(
2738
+ b.useMemo(() => tt(n, (h) => we(h, "height")), [n]),
2739
+ !0,
2740
+ V("skipAnimationFrameInResizeObserver")
2741
+ ), a = ze(
2742
+ b.useMemo(() => tt(r, (h) => we(h, "height")), [r]),
2743
+ !0,
2744
+ V("skipAnimationFrameInResizeObserver")
2745
+ ), f = o || t ? br : yr, T = o || t ? Sr : Cr, p = V("TableComponent"), v = V("TableHeadComponent"), w = V("TableFooterComponent"), x = i ? /* @__PURE__ */ M.jsx(
2746
+ v,
2747
+ {
2748
+ ref: c,
2749
+ style: { position: "sticky", top: 0, zIndex: 2 },
2750
+ ...X(v, s),
2751
+ children: i()
2752
+ },
2753
+ "TableHead"
2754
+ ) : null, g = l ? /* @__PURE__ */ M.jsx(
2755
+ w,
2756
+ {
2757
+ ref: a,
2758
+ style: { bottom: 0, position: "sticky", zIndex: 1 },
2759
+ ...X(w, s),
2760
+ children: l()
2761
+ },
2762
+ "TableFoot"
2763
+ ) : null;
2764
+ return /* @__PURE__ */ M.jsx(f, { ...e, ...X(f, s), children: /* @__PURE__ */ M.jsx(T, { children: /* @__PURE__ */ M.jsxs(p, { style: { borderSpacing: 0, overflowAnchor: "none" }, ...X(p, s), children: [
2765
+ x,
2766
+ /* @__PURE__ */ M.jsx(Tr, {}, "TableBody"),
2767
+ g
2768
+ ] }) }) });
2769
+ }), {
2770
+ Component: Hr,
2771
+ useEmitter: eo,
2772
+ useEmitterValue: V,
2773
+ usePublisher: Ce
2774
+ } = /* @__PURE__ */ $t(
2775
+ gr,
2776
+ {
2777
+ required: {},
2778
+ optional: {
2779
+ restoreStateFrom: "restoreStateFrom",
2780
+ context: "context",
2781
+ followOutput: "followOutput",
2782
+ firstItemIndex: "firstItemIndex",
2783
+ itemContent: "itemContent",
2784
+ groupContent: "groupContent",
2785
+ fixedHeaderContent: "fixedHeaderContent",
2786
+ fixedFooterContent: "fixedFooterContent",
2787
+ overscan: "overscan",
2788
+ increaseViewportBy: "increaseViewportBy",
2789
+ totalCount: "totalCount",
2790
+ topItemCount: "topItemCount",
2791
+ initialTopMostItemIndex: "initialTopMostItemIndex",
2792
+ components: "components",
2793
+ groupCounts: "groupCounts",
2794
+ atBottomThreshold: "atBottomThreshold",
2795
+ atTopThreshold: "atTopThreshold",
2796
+ computeItemKey: "computeItemKey",
2797
+ defaultItemHeight: "defaultItemHeight",
2798
+ fixedItemHeight: "fixedItemHeight",
2799
+ itemSize: "itemSize",
2800
+ scrollSeekConfiguration: "scrollSeekConfiguration",
2801
+ data: "data",
2802
+ initialItemCount: "initialItemCount",
2803
+ initialScrollTop: "initialScrollTop",
2804
+ alignToBottom: "alignToBottom",
2805
+ useWindowScroll: "useWindowScroll",
2806
+ customScrollParent: "customScrollParent",
2807
+ scrollerRef: "scrollerRef",
2808
+ logLevel: "logLevel"
2809
+ },
2810
+ methods: {
2811
+ scrollToIndex: "scrollToIndex",
2812
+ scrollIntoView: "scrollIntoView",
2813
+ scrollTo: "scrollTo",
2814
+ scrollBy: "scrollBy",
2815
+ getState: "getState"
2816
+ },
2817
+ events: {
2818
+ isScrolling: "isScrolling",
2819
+ endReached: "endReached",
2820
+ startReached: "startReached",
2821
+ rangeChanged: "rangeChanged",
2822
+ atBottomStateChange: "atBottomStateChange",
2823
+ atTopStateChange: "atTopStateChange",
2824
+ totalListHeightChanged: "totalListHeightChanged",
2825
+ itemsRendered: "itemsRendered",
2826
+ groupIndices: "groupIndices"
2827
+ }
2828
+ },
2829
+ wr
2830
+ ), yr = /* @__PURE__ */ Xt({ useEmitter: eo, useEmitterValue: V, usePublisher: Ce }), br = /* @__PURE__ */ Jt({ useEmitter: eo, useEmitterValue: V, usePublisher: Ce }), qr = Hr, wo = {
2831
+ bottom: 0,
2832
+ itemHeight: 0,
2833
+ items: [],
2834
+ itemWidth: 0,
2835
+ offsetBottom: 0,
2836
+ offsetTop: 0,
2837
+ top: 0
2838
+ }, zr = {
2839
+ bottom: 0,
2840
+ itemHeight: 0,
2841
+ items: [{ index: 0 }],
2842
+ itemWidth: 0,
2843
+ offsetBottom: 0,
2844
+ offsetTop: 0,
2845
+ top: 0
2846
+ }, { ceil: Ho, floor: Tt, max: et, min: Et, round: yo } = Math;
2847
+ function bo(e, t, o) {
2848
+ return Array.from({ length: t - e + 1 }).map((n, r) => ({ data: o === null ? null : o[r + e], index: r + e }));
2849
+ }
2850
+ function Rr(e) {
2851
+ return {
2852
+ ...zr,
2853
+ items: e
2854
+ };
2855
+ }
2856
+ function ft(e, t) {
2857
+ return e && e.width === t.width && e.height === t.height;
2858
+ }
2859
+ function Br(e, t) {
2860
+ return e && e.column === t.column && e.row === t.row;
2861
+ }
2862
+ const kr = /* @__PURE__ */ q(
2863
+ ([
2864
+ { increaseViewportBy: e, listBoundary: t, overscan: o, visibleRange: n },
2865
+ { footerHeight: r, headerHeight: i, scrollBy: l, scrollContainerState: s, scrollTo: c, scrollTop: a, smoothScrollTargetReached: f, viewportHeight: T },
2866
+ p,
2867
+ v,
2868
+ { didMount: w, propsReady: x },
2869
+ { customScrollParent: g, useWindowScroll: h, windowScrollContainerState: u, windowScrollTo: H, windowViewportRect: R },
2870
+ m
2871
+ ]) => {
2872
+ const d = C(0), S = C(0), z = C(wo), O = C({ height: 0, width: 0 }), k = C({ height: 0, width: 0 }), W = N(), _ = N(), Y = C(0), E = C(null), U = C({ column: 0, row: 0 }), ie = N(), fe = N(), xe = C(!1), ve = C(0), ue = C(!0), ce = C(!1), We = C(!1);
2873
+ K(
2874
+ I(
2875
+ w,
2876
+ D(ve),
2877
+ P(([y, G]) => !!G)
2878
+ ),
2879
+ () => {
2880
+ F(ue, !1);
2881
+ }
2882
+ ), K(
2883
+ I(
2884
+ ne(w, ue, k, O, ve, ce),
2885
+ P(([y, G, Q, le, , te]) => y && !G && Q.height !== 0 && le.height !== 0 && !te)
2886
+ ),
2887
+ ([, , , , y]) => {
2888
+ F(ce, !0), _t(1, () => {
2889
+ F(W, y);
2890
+ }), Te(I(a), () => {
2891
+ F(t, [0, 0]), F(ue, !0);
2892
+ });
2893
+ }
2894
+ ), L(
2895
+ I(
2896
+ fe,
2897
+ P((y) => y != null && y.scrollTop > 0),
2898
+ ye(0)
2899
+ ),
2900
+ S
2901
+ ), K(
2902
+ I(
2903
+ w,
2904
+ D(fe),
2905
+ P(([, y]) => y != null)
2906
+ ),
2907
+ ([, y]) => {
2908
+ y && (F(O, y.viewport), F(k, y.item), F(U, y.gap), y.scrollTop > 0 && (F(xe, !0), Te(I(a, De(1)), (G) => {
2909
+ F(xe, !1);
2910
+ }), F(c, { top: y.scrollTop })));
2911
+ }
2912
+ ), L(
2913
+ I(
2914
+ O,
2915
+ B(({ height: y }) => y)
2916
+ ),
2917
+ T
2918
+ ), L(
2919
+ I(
2920
+ ne(
2921
+ j(O, ft),
2922
+ j(k, ft),
2923
+ j(U, (y, G) => y && y.column === G.column && y.row === G.row),
2924
+ j(a)
2925
+ ),
2926
+ B(([y, G, Q, le]) => ({
2927
+ gap: Q,
2928
+ item: G,
2929
+ scrollTop: le,
2930
+ viewport: y
2931
+ }))
2932
+ ),
2933
+ ie
2934
+ ), L(
2935
+ I(
2936
+ ne(
2937
+ j(d),
2938
+ n,
2939
+ j(U, Br),
2940
+ j(k, ft),
2941
+ j(O, ft),
2942
+ j(E),
2943
+ j(S),
2944
+ j(xe),
2945
+ j(ue),
2946
+ j(ve)
2947
+ ),
2948
+ P(([, , , , , , , y]) => !y),
2949
+ B(
2950
+ ([
2951
+ y,
2952
+ [G, Q],
2953
+ le,
2954
+ te,
2955
+ Pe,
2956
+ Xe,
2957
+ _e,
2958
+ ,
2959
+ ut,
2960
+ Ee
2961
+ ]) => {
2962
+ const { column: Le, row: Je } = le, { height: dt, width: bt } = te, { width: to } = Pe;
2963
+ if (_e === 0 && (y === 0 || to === 0))
2964
+ return wo;
2965
+ if (bt === 0) {
2966
+ const lo = qt(Ee, y), ln = lo + Math.max(_e - 1, 0);
2967
+ return Rr(bo(lo, ln, Xe));
2968
+ }
2969
+ const ht = on(to, bt, Le);
2970
+ let qe, Ae;
2971
+ ut ? G === 0 && Q === 0 && _e > 0 ? (qe = 0, Ae = _e - 1) : (qe = ht * Tt((G + Je) / (dt + Je)), Ae = ht * Ho((Q + Je) / (dt + Je)) - 1, Ae = Et(y - 1, et(Ae, ht - 1)), qe = Et(Ae, et(0, qe))) : (qe = 0, Ae = -1);
2972
+ const oo = bo(qe, Ae, Xe), { bottom: no, top: ro } = zo(Pe, le, te, oo), io = Ho(y / ht), rn = io * dt + (io - 1) * Je - no;
2973
+ return { bottom: no, itemHeight: dt, items: oo, itemWidth: bt, offsetBottom: rn, offsetTop: ro, top: ro };
2974
+ }
2975
+ )
2976
+ ),
2977
+ z
2978
+ ), L(
2979
+ I(
2980
+ E,
2981
+ P((y) => y !== null),
2982
+ B((y) => y.length)
2983
+ ),
2984
+ d
2985
+ ), L(
2986
+ I(
2987
+ ne(O, k, z, U),
2988
+ P(([y, G, { items: Q }]) => Q.length > 0 && G.height !== 0 && y.height !== 0),
2989
+ B(([y, G, { items: Q }, le]) => {
2990
+ const { bottom: te, top: Pe } = zo(y, le, G, Q);
2991
+ return [Pe, te];
2992
+ }),
2993
+ Z(rt)
2994
+ ),
2995
+ t
2996
+ );
2997
+ const Ie = C(!1);
2998
+ L(
2999
+ I(
3000
+ a,
3001
+ D(Ie),
3002
+ B(([y, G]) => G || y !== 0)
3003
+ ),
3004
+ Ie
3005
+ );
3006
+ const Ze = me(
3007
+ I(
3008
+ ne(z, d),
3009
+ P(([{ items: y }]) => y.length > 0),
3010
+ D(Ie),
3011
+ P(([[y, G], Q]) => {
3012
+ const le = y.items[y.items.length - 1].index === G - 1;
3013
+ return (Q || y.bottom > 0 && y.itemHeight > 0 && y.offsetBottom === 0 && y.items.length === G) && le;
3014
+ }),
3015
+ B(([[, y]]) => y - 1),
3016
+ Z()
3017
+ )
3018
+ ), Ne = me(
3019
+ I(
3020
+ j(z),
3021
+ P(({ items: y }) => y.length > 0 && y[0].index === 0),
3022
+ ye(0),
3023
+ Z()
3024
+ )
3025
+ ), He = me(
3026
+ I(
3027
+ j(z),
3028
+ D(xe),
3029
+ P(([{ items: y }, G]) => y.length > 0 && !G),
3030
+ B(([{ items: y }]) => ({
3031
+ endIndex: y[y.length - 1].index,
3032
+ startIndex: y[0].index
3033
+ })),
3034
+ Z(Po),
3035
+ ke(0)
3036
+ )
3037
+ );
3038
+ L(He, v.scrollSeekRangeChanged), L(
3039
+ I(
3040
+ W,
3041
+ D(O, k, d, U),
3042
+ B(([y, G, Q, le, te]) => {
3043
+ const Pe = Go(y), { align: Xe, behavior: _e, offset: ut } = Pe;
3044
+ let Ee = Pe.index;
3045
+ Ee === "LAST" && (Ee = le - 1), Ee = et(0, Ee, Et(le - 1, Ee));
3046
+ let Le = Pt(G, te, Q, Ee);
3047
+ return Xe === "end" ? Le = yo(Le - G.height + Q.height) : Xe === "center" && (Le = yo(Le - G.height / 2 + Q.height / 2)), ut && (Le += ut), { behavior: _e, top: Le };
3048
+ })
3049
+ ),
3050
+ c
3051
+ );
3052
+ const Be = se(
3053
+ I(
3054
+ z,
3055
+ B((y) => y.offsetBottom + y.bottom)
3056
+ ),
3057
+ 0
3058
+ );
3059
+ return L(
3060
+ I(
3061
+ R,
3062
+ B((y) => ({ height: y.visibleHeight, width: y.visibleWidth }))
3063
+ ),
3064
+ O
3065
+ ), {
3066
+ customScrollParent: g,
3067
+ // input
3068
+ data: E,
3069
+ deviation: Y,
3070
+ footerHeight: r,
3071
+ gap: U,
3072
+ headerHeight: i,
3073
+ increaseViewportBy: e,
3074
+ initialItemCount: S,
3075
+ itemDimensions: k,
3076
+ overscan: o,
3077
+ restoreStateFrom: fe,
3078
+ scrollBy: l,
3079
+ scrollContainerState: s,
3080
+ scrollHeight: _,
3081
+ scrollTo: c,
3082
+ scrollToIndex: W,
3083
+ scrollTop: a,
3084
+ smoothScrollTargetReached: f,
3085
+ totalCount: d,
3086
+ useWindowScroll: h,
3087
+ viewportDimensions: O,
3088
+ windowScrollContainerState: u,
3089
+ windowScrollTo: H,
3090
+ windowViewportRect: R,
3091
+ ...v,
3092
+ // output
3093
+ gridState: z,
3094
+ horizontalDirection: We,
3095
+ initialTopMostItemIndex: ve,
3096
+ totalListHeight: Be,
3097
+ ...p,
3098
+ endReached: Ze,
3099
+ propsReady: x,
3100
+ rangeChanged: He,
3101
+ startReached: Ne,
3102
+ stateChanged: ie,
3103
+ stateRestoreInProgress: xe,
3104
+ ...m
3105
+ };
3106
+ },
3107
+ J(Ut, ae, at, $o, je, Kt, Me)
3108
+ );
3109
+ function on(e, t, o) {
3110
+ return et(1, Tt((e + o) / (Tt(t) + o)));
3111
+ }
3112
+ function zo(e, t, o, n) {
3113
+ const { height: r } = o;
3114
+ if (r === void 0 || n.length === 0)
3115
+ return { bottom: 0, top: 0 };
3116
+ const i = Pt(e, t, o, n[0].index);
3117
+ return { bottom: Pt(e, t, o, n[n.length - 1].index) + r, top: i };
3118
+ }
3119
+ function Pt(e, t, o, n) {
3120
+ const r = on(e.width, o.width, t.column), i = Tt(n / r), l = i * o.height + et(0, i - 1) * t.row;
3121
+ return l > 0 ? l + t.row : l;
3122
+ }
3123
+ const Er = /* @__PURE__ */ q(() => {
3124
+ const e = C((T) => `Item ${T}`), t = C({}), o = C(null), n = C("virtuoso-grid-item"), r = C("virtuoso-grid-list"), i = C(Zt), l = C("div"), s = C($e), c = (T, p = null) => se(
3125
+ I(
3126
+ t,
3127
+ B((v) => v[T]),
3128
+ Z()
3129
+ ),
3130
+ p
3131
+ ), a = C(!1), f = C(!1);
3132
+ return L(j(f), a), {
3133
+ components: t,
3134
+ computeItemKey: i,
3135
+ context: o,
3136
+ FooterComponent: c("Footer"),
3137
+ HeaderComponent: c("Header"),
3138
+ headerFooterTag: l,
3139
+ itemClassName: n,
3140
+ ItemComponent: c("Item", "div"),
3141
+ itemContent: e,
3142
+ listClassName: r,
3143
+ ListComponent: c("List", "div"),
3144
+ readyStateChanged: a,
3145
+ reportReadyState: f,
3146
+ ScrollerComponent: c("Scroller", "div"),
3147
+ scrollerRef: s,
3148
+ ScrollSeekPlaceholder: c("ScrollSeekPlaceholder", "div")
3149
+ };
3150
+ }), Lr = /* @__PURE__ */ q(
3151
+ ([e, t]) => ({ ...e, ...t }),
3152
+ J(kr, Er)
3153
+ ), Or = /* @__PURE__ */ b.memo(function() {
3154
+ const e = ee("gridState"), t = ee("listClassName"), o = ee("itemClassName"), n = ee("itemContent"), r = ee("computeItemKey"), i = ee("isSeeking"), l = ge("scrollHeight"), s = ee("ItemComponent"), c = ee("ListComponent"), a = ee("ScrollSeekPlaceholder"), f = ee("context"), T = ge("itemDimensions"), p = ge("gap"), v = ee("log"), w = ee("stateRestoreInProgress"), x = ge("reportReadyState"), g = ze(
3155
+ b.useMemo(
3156
+ () => (h) => {
3157
+ const u = h.parentElement.parentElement.scrollHeight;
3158
+ l(u);
3159
+ const H = h.firstChild;
3160
+ if (H) {
3161
+ const { height: R, width: m } = H.getBoundingClientRect();
3162
+ T({ height: R, width: m });
3163
+ }
3164
+ p({
3165
+ column: Ro("column-gap", getComputedStyle(h).columnGap, v),
3166
+ row: Ro("row-gap", getComputedStyle(h).rowGap, v)
3167
+ });
3168
+ },
3169
+ [l, T, p, v]
3170
+ ),
3171
+ !0,
3172
+ !1
3173
+ );
3174
+ return Jo(() => {
3175
+ e.itemHeight > 0 && e.itemWidth > 0 && x(!0);
3176
+ }, [e]), w ? null : /* @__PURE__ */ M.jsx(
3177
+ c,
3178
+ {
3179
+ className: t,
3180
+ ref: g,
3181
+ ...X(c, f),
3182
+ "data-testid": "virtuoso-item-list",
3183
+ style: { paddingBottom: e.offsetBottom, paddingTop: e.offsetTop },
3184
+ children: e.items.map((h) => {
3185
+ const u = r(h.index, h.data, f);
3186
+ return i ? /* @__PURE__ */ M.jsx(
3187
+ a,
3188
+ {
3189
+ ...X(a, f),
3190
+ height: e.itemHeight,
3191
+ index: h.index,
3192
+ width: e.itemWidth
3193
+ },
3194
+ u
3195
+ ) : /* @__PURE__ */ Fe(
3196
+ s,
3197
+ {
3198
+ ...X(s, f),
3199
+ className: o,
3200
+ "data-index": h.index,
3201
+ key: u
3202
+ },
3203
+ n(h.index, h.data, f)
3204
+ );
3205
+ })
3206
+ }
3207
+ );
3208
+ }), Mr = b.memo(function() {
3209
+ const e = ee("HeaderComponent"), t = ge("headerHeight"), o = ee("headerFooterTag"), n = ze(
3210
+ b.useMemo(
3211
+ () => (i) => {
3212
+ t(we(i, "height"));
3213
+ },
3214
+ [t]
3215
+ ),
3216
+ !0,
3217
+ !1
3218
+ ), r = ee("context");
3219
+ return e ? /* @__PURE__ */ M.jsx(o, { ref: n, children: /* @__PURE__ */ M.jsx(e, { ...X(e, r) }) }) : null;
3220
+ }), jr = b.memo(function() {
3221
+ const e = ee("FooterComponent"), t = ge("footerHeight"), o = ee("headerFooterTag"), n = ze(
3222
+ b.useMemo(
3223
+ () => (i) => {
3224
+ t(we(i, "height"));
3225
+ },
3226
+ [t]
3227
+ ),
3228
+ !0,
3229
+ !1
3230
+ ), r = ee("context");
3231
+ return e ? /* @__PURE__ */ M.jsx(o, { ref: n, children: /* @__PURE__ */ M.jsx(e, { ...X(e, r) }) }) : null;
3232
+ }), Wr = ({ children: e }) => {
3233
+ const t = b.useContext(Xo), o = ge("itemDimensions"), n = ge("viewportDimensions"), r = ze(
3234
+ b.useMemo(
3235
+ () => (i) => {
3236
+ n(i.getBoundingClientRect());
3237
+ },
3238
+ [n]
3239
+ ),
3240
+ !0,
3241
+ !1
3242
+ );
3243
+ return b.useEffect(() => {
3244
+ t && (n({ height: t.viewportHeight, width: t.viewportWidth }), o({ height: t.itemHeight, width: t.itemWidth }));
3245
+ }, [t, n, o]), /* @__PURE__ */ M.jsx("div", { ref: r, style: Ye(!1), children: e });
3246
+ }, Pr = ({ children: e }) => {
3247
+ const t = b.useContext(Xo), o = ge("windowViewportRect"), n = ge("itemDimensions"), r = ee("customScrollParent"), i = Dt(o, r, !1);
3248
+ return b.useEffect(() => {
3249
+ t && (n({ height: t.itemHeight, width: t.itemWidth }), o({ offsetTop: 0, visibleHeight: t.viewportHeight, visibleWidth: t.viewportWidth }));
3250
+ }, [t, o, n]), /* @__PURE__ */ M.jsx("div", { ref: i, style: Ye(!1), children: e });
3251
+ }, Ar = /* @__PURE__ */ b.memo(function({ ...e }) {
3252
+ const t = ee("useWindowScroll"), o = ee("customScrollParent"), n = o || t ? Fr : Vr, r = o || t ? Pr : Wr, i = ee("context");
3253
+ return /* @__PURE__ */ M.jsx(n, { ...e, ...X(n, i), children: /* @__PURE__ */ M.jsxs(r, { children: [
3254
+ /* @__PURE__ */ M.jsx(Mr, {}),
3255
+ /* @__PURE__ */ M.jsx(Or, {}),
3256
+ /* @__PURE__ */ M.jsx(jr, {})
3257
+ ] }) });
3258
+ }), {
3259
+ Component: Ur,
3260
+ useEmitter: nn,
3261
+ useEmitterValue: ee,
3262
+ usePublisher: ge
3263
+ } = /* @__PURE__ */ $t(
3264
+ Lr,
3265
+ {
3266
+ optional: {
3267
+ context: "context",
3268
+ totalCount: "totalCount",
3269
+ overscan: "overscan",
3270
+ itemContent: "itemContent",
3271
+ components: "components",
3272
+ computeItemKey: "computeItemKey",
3273
+ data: "data",
3274
+ initialItemCount: "initialItemCount",
3275
+ scrollSeekConfiguration: "scrollSeekConfiguration",
3276
+ headerFooterTag: "headerFooterTag",
3277
+ listClassName: "listClassName",
3278
+ itemClassName: "itemClassName",
3279
+ useWindowScroll: "useWindowScroll",
3280
+ customScrollParent: "customScrollParent",
3281
+ scrollerRef: "scrollerRef",
3282
+ logLevel: "logLevel",
3283
+ restoreStateFrom: "restoreStateFrom",
3284
+ initialTopMostItemIndex: "initialTopMostItemIndex",
3285
+ increaseViewportBy: "increaseViewportBy"
3286
+ },
3287
+ methods: {
3288
+ scrollTo: "scrollTo",
3289
+ scrollBy: "scrollBy",
3290
+ scrollToIndex: "scrollToIndex"
3291
+ },
3292
+ events: {
3293
+ isScrolling: "isScrolling",
3294
+ endReached: "endReached",
3295
+ startReached: "startReached",
3296
+ rangeChanged: "rangeChanged",
3297
+ atBottomStateChange: "atBottomStateChange",
3298
+ atTopStateChange: "atTopStateChange",
3299
+ stateChanged: "stateChanged",
3300
+ readyStateChanged: "readyStateChanged"
3301
+ }
3302
+ },
3303
+ Ar
3304
+ ), Vr = /* @__PURE__ */ Xt({ useEmitter: nn, useEmitterValue: ee, usePublisher: ge }), Fr = /* @__PURE__ */ Jt({ useEmitter: nn, useEmitterValue: ee, usePublisher: ge });
3305
+ function Ro(e, t, o) {
3306
+ return t !== "normal" && !(t != null && t.endsWith("px")) && o(`${e} was not resolved to pixel value correctly`, t, de.WARN), t === "normal" ? 0 : parseInt(t ?? "0", 10);
3307
+ }
3308
+ export {
3309
+ qr as Z,
3310
+ _r as q
3311
+ };