@cagatayfdn/flora-components 0.0.148 → 0.0.149

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