@cagatayfdn/flora-components 0.0.164 → 0.0.166

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