@wyxos/vibe 5.16.6 → 5.16.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/core/mediaLifecycleIndex.d.ts +4 -0
- package/lib/index.cjs +2 -2
- package/lib/index.js +690 -559
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -8,19 +8,19 @@ function B(e) {
|
|
|
8
8
|
return e.split(/[?#]/)[0] ?? e;
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function V(e) {
|
|
12
12
|
let t = B(e);
|
|
13
13
|
return R.test(t) ? "audio" : z.test(t) ? "video" : "image";
|
|
14
14
|
}
|
|
15
|
-
function V(e, t) {
|
|
16
|
-
return e ?? ee(t);
|
|
17
|
-
}
|
|
18
15
|
function H(e, t) {
|
|
19
|
-
return V(
|
|
16
|
+
return e ?? V(t);
|
|
17
|
+
}
|
|
18
|
+
function U(e, t) {
|
|
19
|
+
return H(e, t) !== "image";
|
|
20
20
|
}
|
|
21
21
|
//#endregion
|
|
22
22
|
//#region src/core/mediaAsset.ts
|
|
23
|
-
function
|
|
23
|
+
function W(e) {
|
|
24
24
|
return {
|
|
25
25
|
height: e.height,
|
|
26
26
|
src: e.src,
|
|
@@ -28,9 +28,9 @@ function U(e) {
|
|
|
28
28
|
width: e.width
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function ee(e, t) {
|
|
32
32
|
if (t === "preview" && e.preview) {
|
|
33
|
-
let t =
|
|
33
|
+
let t = H(e.type, e.src) === "audio" ? H(e.preview.type, e.preview.src) : e.preview.type ?? e.type;
|
|
34
34
|
return {
|
|
35
35
|
...e.preview,
|
|
36
36
|
type: t
|
|
@@ -39,66 +39,66 @@ function te(e, t) {
|
|
|
39
39
|
return t === "mobile" && e.mobile ? {
|
|
40
40
|
...e.mobile,
|
|
41
41
|
type: e.mobile.type ?? e.type
|
|
42
|
-
} :
|
|
42
|
+
} : W(e);
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function G(e) {
|
|
45
45
|
let t = e.preview;
|
|
46
|
-
return !t?.src || t.src === e.src ||
|
|
46
|
+
return !t?.src || t.src === e.src || H(t.type, t.src) !== "image" ? null : {
|
|
47
47
|
...t,
|
|
48
48
|
type: "image"
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
|
-
function
|
|
52
|
-
return
|
|
51
|
+
function te(e, t) {
|
|
52
|
+
return H(e.type, e.src) === "audio" ? t === "mobile" && e.mobile && H(e.mobile.type, e.mobile.src) === "audio" ? {
|
|
53
53
|
...e.mobile,
|
|
54
54
|
type: "audio"
|
|
55
55
|
} : {
|
|
56
|
-
...
|
|
56
|
+
...W(e),
|
|
57
57
|
type: "audio"
|
|
58
|
-
} :
|
|
58
|
+
} : ee(e, t);
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function K(e) {
|
|
61
61
|
return [e, ...e.items];
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function q(e, t) {
|
|
64
64
|
return Math.min(e.items.length, Math.max(0, t));
|
|
65
65
|
}
|
|
66
|
-
function
|
|
67
|
-
return
|
|
66
|
+
function ne(e, t) {
|
|
67
|
+
return K(e)[q(e, t)] ?? e;
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function J(e, t) {
|
|
70
70
|
return `${String(e)}:${t}`;
|
|
71
71
|
}
|
|
72
72
|
//#endregion
|
|
73
73
|
//#region src/core/itemIds.ts
|
|
74
|
-
var
|
|
75
|
-
function
|
|
74
|
+
var Y = /* @__PURE__ */ new WeakMap();
|
|
75
|
+
function X(e, t) {
|
|
76
76
|
let n = Reflect.get(e, "postId", t);
|
|
77
77
|
return typeof n == "string" || typeof n == "number" ? n : g(n) ? n.value : t.postId;
|
|
78
78
|
}
|
|
79
|
-
function
|
|
79
|
+
function Z(e) {
|
|
80
80
|
if (!m(e) || h(e) || _(e)) return e.map((e) => e.postId);
|
|
81
81
|
let t = j(e);
|
|
82
82
|
return T(t) === e ? t.map((e) => {
|
|
83
|
-
let t =
|
|
84
|
-
if (t !== void 0) return t ?
|
|
83
|
+
let t = Y.get(e);
|
|
84
|
+
if (t !== void 0) return t ? X(t, e) : e.postId;
|
|
85
85
|
let n = j(e);
|
|
86
|
-
if (n === e) return
|
|
86
|
+
if (n === e) return X(n, T(e));
|
|
87
87
|
let r = T(n) === e;
|
|
88
|
-
return
|
|
88
|
+
return Y.set(e, r ? n : null), r ? X(n, e) : e.postId;
|
|
89
89
|
}) : e.map((e) => e.postId);
|
|
90
90
|
}
|
|
91
91
|
//#endregion
|
|
92
92
|
//#region src/core/runtime.ts
|
|
93
|
-
var
|
|
94
|
-
function
|
|
95
|
-
let t =
|
|
96
|
-
return t || (t = r(() => Object.freeze([...e.items])),
|
|
93
|
+
var re = /* @__PURE__ */ new WeakMap();
|
|
94
|
+
function ie(e) {
|
|
95
|
+
let t = re.get(e);
|
|
96
|
+
return t || (t = r(() => Object.freeze([...e.items])), re.set(e, t)), t;
|
|
97
97
|
}
|
|
98
|
-
function
|
|
99
|
-
return n(
|
|
98
|
+
function ae(e, t, n) {
|
|
99
|
+
return n(oe(e, t.value)), P(() => oe(e, t.value), n, { flush: "post" });
|
|
100
100
|
}
|
|
101
|
-
function
|
|
101
|
+
function oe(e, t = [...e.items]) {
|
|
102
102
|
return {
|
|
103
103
|
activeReelPostId: e.activeReelPostId,
|
|
104
104
|
autoScroll: { ...e.autoScroll },
|
|
@@ -128,7 +128,7 @@ function X(e, t = [...e.items]) {
|
|
|
128
128
|
}
|
|
129
129
|
//#endregion
|
|
130
130
|
//#region src/components/GalleryFooter.vue?vue&type=script&setup=true&lang.ts
|
|
131
|
-
var
|
|
131
|
+
var se = {
|
|
132
132
|
key: 0,
|
|
133
133
|
class: "gallery-footer"
|
|
134
134
|
}, Q = {
|
|
@@ -154,7 +154,7 @@ var Z = {
|
|
|
154
154
|
function i() {
|
|
155
155
|
n.loadMoreLocked || (n.hasNext ? r("loadMore") : r("retryEnd"));
|
|
156
156
|
}
|
|
157
|
-
return (t, n) => e.isLoading || e.hasError || e.hasNext && e.showLoadMore || !e.hasNext && e.canRetryEnd ? (w(), s("footer",
|
|
157
|
+
return (t, n) => e.isLoading || e.hasError || e.hasNext && e.showLoadMore || !e.hasNext && e.canRetryEnd ? (w(), s("footer", se, [e.isLoading ? (w(), s("p", Q, " Loading more… ")) : e.hasError || e.hasNext && e.showLoadMore ? (w(), s("button", {
|
|
158
158
|
key: 1,
|
|
159
159
|
"data-test": "load-more",
|
|
160
160
|
class: "load-more-button",
|
|
@@ -551,29 +551,54 @@ var Ve = ["aria-hidden"], He = [
|
|
|
551
551
|
thumbOffset: 0,
|
|
552
552
|
thumbSize: 0,
|
|
553
553
|
thumbTravel: 0
|
|
554
|
-
}, i = k(null), a = k(n), o = k(!1), l = k(!1), u = k(!1), d = null, f = 0, p = 0, m = null, h = null, g = null, _ = null, b = !1, C = null, T = r(() => a.value.scrollable && !t.suspended),
|
|
554
|
+
}, i = k(null), a = k(n), o = k(!1), l = k(!1), u = k(!1), d = null, f = 0, p = 0, m = null, h = null, g = null, _ = null, b = !1, C = null, T = null, E = !1, D = !0, O = null, A = /* @__PURE__ */ new Map(), j = r(() => a.value.scrollable && !t.suspended), M = r(() => ({
|
|
555
555
|
height: `${a.value.thumbSize}px`,
|
|
556
556
|
transform: `translate3d(0, ${a.value.thumbOffset}px, 0)`
|
|
557
557
|
}));
|
|
558
|
-
function
|
|
558
|
+
function N() {
|
|
559
559
|
m !== null && clearTimeout(m), m = setTimeout(() => {
|
|
560
560
|
m = null, o.value || (l.value = !1);
|
|
561
561
|
}, Ge);
|
|
562
562
|
}
|
|
563
|
-
function
|
|
564
|
-
l.value = !0,
|
|
563
|
+
function F() {
|
|
564
|
+
l.value = !0, N();
|
|
565
565
|
}
|
|
566
|
-
function
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
566
|
+
function I() {
|
|
567
|
+
T !== null && (cancelAnimationFrame(T), T = null);
|
|
568
|
+
}
|
|
569
|
+
function L(e) {
|
|
570
|
+
if (E) return;
|
|
571
|
+
if (D = !0, o.value) {
|
|
572
|
+
b = !0;
|
|
573
|
+
return;
|
|
574
|
+
}
|
|
575
|
+
if (T !== null) return;
|
|
576
|
+
T = -1;
|
|
577
|
+
let t = requestAnimationFrame(() => {
|
|
578
|
+
T = null, D && B(e);
|
|
574
579
|
});
|
|
580
|
+
T !== null && (T = t);
|
|
575
581
|
}
|
|
576
|
-
function
|
|
582
|
+
function R(e, t) {
|
|
583
|
+
e.some((e) => e.type === "childList" && e.target === t) && K(t), e.length > 0 && (D = !0);
|
|
584
|
+
}
|
|
585
|
+
function z(e) {
|
|
586
|
+
let r = t.scrollElement, a = i.value;
|
|
587
|
+
return !r || !a ? n : ((e || !O) && (O = {
|
|
588
|
+
contentSize: r.scrollHeight,
|
|
589
|
+
trackSize: a.clientHeight,
|
|
590
|
+
viewportSize: r.clientHeight
|
|
591
|
+
}, D = !1, b = !1, I()), Be({
|
|
592
|
+
...O,
|
|
593
|
+
minimumThumbSize: Ue,
|
|
594
|
+
scrollPosition: r.scrollTop
|
|
595
|
+
}));
|
|
596
|
+
}
|
|
597
|
+
function B(e) {
|
|
598
|
+
if (E) return;
|
|
599
|
+
let n = t.scrollElement;
|
|
600
|
+
n && R(g?.takeRecords() ?? [], n);
|
|
601
|
+
for (let e of A.keys()) n?.contains(e) || A.delete(e);
|
|
577
602
|
if (o.value && e !== "scroll") {
|
|
578
603
|
b = !0;
|
|
579
604
|
return;
|
|
@@ -588,57 +613,101 @@ var Ve = ["aria-hidden"], He = [
|
|
|
588
613
|
};
|
|
589
614
|
return;
|
|
590
615
|
}
|
|
591
|
-
|
|
616
|
+
let r = g && _ && C && A.size === 0;
|
|
617
|
+
a.value = z(e !== "scroll" || D || !r), !(u.value || h !== null) && (h = requestAnimationFrame(() => {
|
|
592
618
|
h = null, u.value = !0;
|
|
593
619
|
}));
|
|
594
620
|
}
|
|
595
|
-
function
|
|
596
|
-
|
|
621
|
+
function V() {
|
|
622
|
+
F(), B("scroll");
|
|
597
623
|
}
|
|
598
|
-
function
|
|
624
|
+
function H(e) {
|
|
599
625
|
let n = t.scrollElement;
|
|
600
|
-
n && (n.scrollTop = Math.min(a.value.maximumScrollPosition, Math.max(0, e)),
|
|
626
|
+
n && (n.scrollTop = Math.min(a.value.maximumScrollPosition, Math.max(0, e)), B("scroll"));
|
|
601
627
|
}
|
|
602
|
-
function
|
|
603
|
-
if (
|
|
628
|
+
function U(e) {
|
|
629
|
+
if (e.target !== e.currentTarget || (B("resize"), !j.value)) return;
|
|
604
630
|
let t = i.value;
|
|
605
631
|
if (!t || a.value.thumbTravel <= 0) return;
|
|
606
|
-
e.preventDefault(),
|
|
632
|
+
e.preventDefault(), F();
|
|
607
633
|
let n = e.clientY - t.getBoundingClientRect().top - a.value.thumbSize / 2;
|
|
608
|
-
|
|
634
|
+
H(Math.min(1, Math.max(0, n / a.value.thumbTravel)) * a.value.maximumScrollPosition);
|
|
609
635
|
}
|
|
610
|
-
function
|
|
611
|
-
|
|
636
|
+
function W(e) {
|
|
637
|
+
B("resize"), j.value && (e.preventDefault(), e.stopPropagation(), e.currentTarget.setPointerCapture?.(e.pointerId), d = e.pointerId, f = e.clientY, p = t.scrollElement?.scrollTop ?? 0, o.value = !0, l.value = !0, m !== null && clearTimeout(m), m = null);
|
|
612
638
|
}
|
|
613
|
-
function
|
|
639
|
+
function ee(e) {
|
|
614
640
|
if (!o.value || e.pointerId !== d || (e.preventDefault(), a.value.thumbTravel <= 0)) return;
|
|
615
641
|
let t = (e.clientY - f) / a.value.thumbTravel * a.value.maximumScrollPosition;
|
|
616
|
-
|
|
642
|
+
H(p + t);
|
|
617
643
|
}
|
|
618
|
-
function
|
|
619
|
-
!o.value || e.pointerId !== d || (e.currentTarget.releasePointerCapture?.(e.pointerId), d = null, o.value = !1, b && (b = !1,
|
|
644
|
+
function G(e) {
|
|
645
|
+
!o.value || e.pointerId !== d || (e.currentTarget.releasePointerCapture?.(e.pointerId), d = null, o.value = !1, b && (b = !1, B("content")), N());
|
|
620
646
|
}
|
|
621
|
-
function
|
|
622
|
-
if (!
|
|
623
|
-
let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r - We : e.key === "ArrowDown" ? r + We : e.key === "PageUp" ? r - n : e.key === "PageDown" ? r + n : e.key === "Home" ? 0 : e.key === "End" ? a.value.maximumScrollPosition : null;
|
|
624
|
-
i !== null && (e.preventDefault(),
|
|
647
|
+
function te(e) {
|
|
648
|
+
if (B("resize"), !j.value) return;
|
|
649
|
+
let n = o.value ? t.scrollElement?.clientHeight ?? 0 : O?.viewportSize ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r - We : e.key === "ArrowDown" ? r + We : e.key === "PageUp" ? r - n : e.key === "PageDown" ? r + n : e.key === "Home" ? 0 : e.key === "End" ? a.value.maximumScrollPosition : null;
|
|
650
|
+
i !== null && (e.preventDefault(), F(), H(i));
|
|
625
651
|
}
|
|
626
|
-
function
|
|
652
|
+
function K(e) {
|
|
627
653
|
if (_?.disconnect(), !(typeof ResizeObserver > "u")) {
|
|
628
|
-
_ = new ResizeObserver(() =>
|
|
654
|
+
_ = new ResizeObserver(() => {
|
|
655
|
+
e === t.scrollElement && L("content");
|
|
656
|
+
});
|
|
629
657
|
for (let t of e.children) _.observe(t);
|
|
630
658
|
}
|
|
631
659
|
}
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
}
|
|
639
|
-
|
|
660
|
+
function q() {
|
|
661
|
+
L("content");
|
|
662
|
+
}
|
|
663
|
+
function ne(e) {
|
|
664
|
+
let t = e.type.startsWith("animation") ? e.animationName : e.propertyName;
|
|
665
|
+
return `${e.type.startsWith("animation") ? "a" : "t"}:${t}:${e.pseudoElement ?? ""}`;
|
|
666
|
+
}
|
|
667
|
+
function J(e) {
|
|
668
|
+
let n = e.target;
|
|
669
|
+
if (!(n instanceof Element) || !t.scrollElement?.contains(n)) return;
|
|
670
|
+
let r = A.get(n) ?? /* @__PURE__ */ new Map(), i = ne(e);
|
|
671
|
+
r.set(i, (r.get(i) ?? 0) + 1), A.set(n, r), L("content");
|
|
672
|
+
}
|
|
673
|
+
function Y(e) {
|
|
674
|
+
let t = e.target;
|
|
675
|
+
if (!(t instanceof Element)) return;
|
|
676
|
+
let n = A.get(t), r = ne(e), i = (n?.get(r) ?? 0) - 1;
|
|
677
|
+
i > 0 ? n?.set(r, i) : n?.delete(r), n?.size === 0 && A.delete(t), L("content");
|
|
678
|
+
}
|
|
679
|
+
function X(e, t) {
|
|
680
|
+
let n = [
|
|
681
|
+
["load", q],
|
|
682
|
+
["loadedmetadata", q],
|
|
683
|
+
["transitionrun", J],
|
|
684
|
+
["animationstart", J],
|
|
685
|
+
["transitionend", Y],
|
|
686
|
+
["transitioncancel", Y],
|
|
687
|
+
["animationend", Y],
|
|
688
|
+
["animationcancel", Y]
|
|
689
|
+
];
|
|
690
|
+
for (let [r, i] of n) t ? e?.addEventListener(r, i, !0) : e?.removeEventListener(r, i, !0);
|
|
691
|
+
}
|
|
692
|
+
return P(() => t.scrollElement, (e, n) => {
|
|
693
|
+
n?.removeEventListener("scroll", V), X(n, !1), A.clear(), I(), O = null, D = !0, g?.disconnect(), g = null, _?.disconnect(), _ = null, C?.disconnect(), C = null, e?.addEventListener("scroll", V, { passive: !0 }), X(e, !0), e && typeof ResizeObserver < "u" && (C = new ResizeObserver(() => {
|
|
694
|
+
E || e !== t.scrollElement || (F(), L("resize"));
|
|
695
|
+
}), C.observe(e), i.value && C.observe(i.value), K(e)), e && typeof MutationObserver < "u" && (g = new MutationObserver((n) => {
|
|
696
|
+
e !== t.scrollElement || E || (R(n, e), L("content"));
|
|
697
|
+
}), g.observe(e, {
|
|
698
|
+
childList: !0,
|
|
699
|
+
subtree: !0,
|
|
700
|
+
attributes: !0,
|
|
701
|
+
characterData: !0
|
|
702
|
+
})), v(() => B("resize"));
|
|
703
|
+
}, { immediate: !0 }), P(i, (e, t) => {
|
|
704
|
+
t && C?.unobserve(t), e && C?.observe(e), L("resize");
|
|
705
|
+
}, { flush: "post" }), P(() => t.contentSize, () => {
|
|
706
|
+
D = !0, v(() => {
|
|
707
|
+
D && B("content");
|
|
708
|
+
});
|
|
640
709
|
}), S(() => {
|
|
641
|
-
t.scrollElement?.removeEventListener("scroll",
|
|
710
|
+
E = !0, I(), t.scrollElement?.removeEventListener("scroll", V), X(t.scrollElement, !1), A.clear(), g?.disconnect(), _?.disconnect(), C?.disconnect(), m !== null && clearTimeout(m), h !== null && cancelAnimationFrame(h);
|
|
642
711
|
}), (t, n) => (w(), s("div", {
|
|
643
712
|
ref_key: "trackElement",
|
|
644
713
|
ref: i,
|
|
@@ -646,10 +715,10 @@ var Ve = ["aria-hidden"], He = [
|
|
|
646
715
|
"gallery-scrollbar--dragging": o.value,
|
|
647
716
|
"gallery-scrollbar--interacting": l.value,
|
|
648
717
|
"gallery-scrollbar--ready": u.value,
|
|
649
|
-
"gallery-scrollbar--visible":
|
|
718
|
+
"gallery-scrollbar--visible": j.value
|
|
650
719
|
}]),
|
|
651
|
-
"aria-hidden": !
|
|
652
|
-
onPointerdown:
|
|
720
|
+
"aria-hidden": !j.value || void 0,
|
|
721
|
+
onPointerdown: U
|
|
653
722
|
}, [c("div", {
|
|
654
723
|
class: "gallery-scrollbar-thumb",
|
|
655
724
|
"aria-controls": e.controlsId,
|
|
@@ -659,13 +728,13 @@ var Ve = ["aria-hidden"], He = [
|
|
|
659
728
|
"aria-valuemin": "0",
|
|
660
729
|
"aria-valuenow": Math.round(e.scrollElement?.scrollTop ?? 0),
|
|
661
730
|
role: "scrollbar",
|
|
662
|
-
style: x(
|
|
663
|
-
tabindex:
|
|
664
|
-
onKeydown:
|
|
665
|
-
onPointercancel:
|
|
666
|
-
onPointerdown:
|
|
667
|
-
onPointermove:
|
|
668
|
-
onPointerup:
|
|
731
|
+
style: x(M.value),
|
|
732
|
+
tabindex: j.value ? 0 : -1,
|
|
733
|
+
onKeydown: te,
|
|
734
|
+
onPointercancel: G,
|
|
735
|
+
onPointerdown: W,
|
|
736
|
+
onPointermove: ee,
|
|
737
|
+
onPointerup: G
|
|
669
738
|
}, null, 44, He)], 42, Ve));
|
|
670
739
|
}
|
|
671
740
|
}), qe = (e) => {
|
|
@@ -804,7 +873,7 @@ var ft = /* @__PURE__ */ d({
|
|
|
804
873
|
total: {}
|
|
805
874
|
},
|
|
806
875
|
setup(e) {
|
|
807
|
-
let t = e, n = r(() =>
|
|
876
|
+
let t = e, n = r(() => q(t.item, t.mediaIndex)), i = r(() => K(t.item)), o = r(() => ne(t.item, n.value)), c = r(() => ({
|
|
808
877
|
height: `${t.region.height}px`,
|
|
809
878
|
paddingBlock: t.style?.paddingY === void 0 ? void 0 : `${t.style.paddingY}px`,
|
|
810
879
|
paddingInline: t.style?.paddingX === void 0 ? void 0 : `${t.style.paddingX}px`
|
|
@@ -1025,7 +1094,7 @@ var ft = /* @__PURE__ */ d({
|
|
|
1025
1094
|
function jt(e) {
|
|
1026
1095
|
let t = k("next"), n = null, r = 0, i = !1, a = null, o = null;
|
|
1027
1096
|
function s(n, r) {
|
|
1028
|
-
let i =
|
|
1097
|
+
let i = K(e.item()).length, a = (n + i) % i;
|
|
1029
1098
|
a !== e.mediaIndex() && (t.value = n < e.mediaIndex() ? "previous" : "next", e.onChange(a), r?.detail && r.detail > 0 && r.currentTarget?.blur());
|
|
1030
1099
|
}
|
|
1031
1100
|
function c() {
|
|
@@ -1038,7 +1107,7 @@ function jt(e) {
|
|
|
1038
1107
|
return t === 1 ? e * 16 : t === 2 ? e * n : e;
|
|
1039
1108
|
}
|
|
1040
1109
|
function d(t) {
|
|
1041
|
-
if (
|
|
1110
|
+
if (K(e.item()).length <= 1) return;
|
|
1042
1111
|
let n = t.currentTarget, a = u(t.deltaX, t.deltaMode, n?.clientWidth || 1);
|
|
1043
1112
|
if (a === 0 || (t.preventDefault(), l(), i) || (r += a, Math.abs(r) < At)) return;
|
|
1044
1113
|
let o = Math.sign(r);
|
|
@@ -1067,9 +1136,9 @@ function It(e, t) {
|
|
|
1067
1136
|
return `${t ? "timed" : "image"}:${e}`;
|
|
1068
1137
|
}
|
|
1069
1138
|
function Lt(e, t, n) {
|
|
1070
|
-
let r =
|
|
1139
|
+
let r = K(e);
|
|
1071
1140
|
if (r.length < 2) return [];
|
|
1072
|
-
let i =
|
|
1141
|
+
let i = q(e, t), a = [];
|
|
1073
1142
|
for (let e = 1; e < r.length; e += 1) {
|
|
1074
1143
|
let t = i + e, n = i - e;
|
|
1075
1144
|
t < r.length && a.push(t), n >= 0 && a.push(n);
|
|
@@ -1078,9 +1147,9 @@ function Lt(e, t, n) {
|
|
|
1078
1147
|
return a.flatMap((e) => {
|
|
1079
1148
|
let t = r[e];
|
|
1080
1149
|
if (!t) return [];
|
|
1081
|
-
let i =
|
|
1150
|
+
let i = H(t.type, t.src) === "audio" ? G(t) : ee(t, n);
|
|
1082
1151
|
if (!i) return [];
|
|
1083
|
-
let a =
|
|
1152
|
+
let a = U(i.type, i.src), s = It(i.src, a);
|
|
1084
1153
|
return o.has(s) ? [] : (o.add(s), [{
|
|
1085
1154
|
key: s,
|
|
1086
1155
|
src: i.src,
|
|
@@ -1163,7 +1232,7 @@ function Ut(e) {
|
|
|
1163
1232
|
//#endregion
|
|
1164
1233
|
//#region src/components/useMediaLoading.ts
|
|
1165
1234
|
function Wt(e) {
|
|
1166
|
-
let t = r(() =>
|
|
1235
|
+
let t = r(() => U(e.mediaType(), e.mediaSource())), n = r(() => e.layout() === "masonry" && e.fetchPriority() === "low" ? "lazy" : "eager"), i = r(() => e.layout() === "reel" && !e.active() ? "none" : e.fetchPriority() === "high" ? "auto" : e.layout() === "masonry" ? "none" : "metadata");
|
|
1167
1236
|
return P(i, (t, n) => {
|
|
1168
1237
|
n !== "none" || t === "none" || v(() => e.mediaElement.value?.load());
|
|
1169
1238
|
}), {
|
|
@@ -1492,7 +1561,7 @@ var $t = [
|
|
|
1492
1561
|
function f(e = !1, t = "pointer") {
|
|
1493
1562
|
e && d("activate", t);
|
|
1494
1563
|
}
|
|
1495
|
-
let p = r(() =>
|
|
1564
|
+
let p = r(() => K(l.item)), m = r(() => q(l.item, l.mediaIndex)), h = r(() => ne(l.item, m.value)), g = r(() => ee(h.value, l.mediaSource ?? "preview")), _ = r(() => H(h.value.type, h.value.src)), b = r(() => _.value === "audio"), S = r(() => te(h.value, l.mediaSource ?? "preview")), C = r(() => b.value ? S.value : g.value), T = r(() => C.value.src), E = r(() => H(C.value.type, C.value.src)), D = r(() => g.value.width), O = r(() => g.value.height), A = r(() => G(h.value)), j = r(() => `${l.item.postId}:${m.value}:${A.value?.src ?? ""}`), N = k(!1), R = r(() => N.value ? null : A.value), { effectivePreviewState: z, failSourceAttempt: B, imageElement: V, markSourceReady: U, noteSourceActivity: W, retrySource: J, retrying: Y, sourceGeneration: X, mediaElement: Z } = Gt({
|
|
1496
1565
|
identity: () => `${l.item.postId}:${m.value}:${l.mediaSource ?? "preview"}:${T.value}:${E.value ?? ""}`,
|
|
1497
1566
|
mediaIndex: () => m.value,
|
|
1498
1567
|
onError: (e, t) => {
|
|
@@ -1516,15 +1585,15 @@ var $t = [
|
|
|
1516
1585
|
mediaReady: () => z.value === "ready",
|
|
1517
1586
|
mediaSource: () => l.mediaSource ?? "preview"
|
|
1518
1587
|
});
|
|
1519
|
-
let { currentTime:
|
|
1588
|
+
let { currentTime: re, duration: ie, effectiveMuted: ae, isMuted: oe, isPlaying: se, onEnded: Q, onLoadedMetadata: ce, onPlaying: le, playbackAllowed: ue, seek: de, setVolume: fe, sync: $, toggleMute: pe, togglePlayback: me, volume: he } = Qt({
|
|
1520
1589
|
active: () => l.active,
|
|
1521
1590
|
inViewport: () => l.inViewport === !0,
|
|
1522
1591
|
layout: () => l.layout,
|
|
1523
1592
|
mediaCard: () => l.mediaCard,
|
|
1524
|
-
mediaElement:
|
|
1593
|
+
mediaElement: Z,
|
|
1525
1594
|
onAudioChange: (e) => d("reelAudioChange", e),
|
|
1526
1595
|
onEnded: () => d("ended", m.value),
|
|
1527
|
-
onReady:
|
|
1596
|
+
onReady: U,
|
|
1528
1597
|
reelAudioState: () => l.reelAudioState
|
|
1529
1598
|
}), ge = r(() => l.interactive && !!(l.cardHeader || l.cardFooter));
|
|
1530
1599
|
function _e(e) {
|
|
@@ -1541,7 +1610,7 @@ var $t = [
|
|
|
1541
1610
|
layout: () => l.layout,
|
|
1542
1611
|
mediaSource: () => T.value,
|
|
1543
1612
|
mediaType: () => E.value,
|
|
1544
|
-
mediaElement:
|
|
1613
|
+
mediaElement: Z
|
|
1545
1614
|
}), Ee = r(() => l.layout === "reel" && l.stationaryReelControls === !0), De = r(() => we.value && (!b.value || l.layout === "reel") && z.value === "ready" && (!Ee.value || !!(l.active && l.reelControlsTarget))), Oe = r(() => `${l.item.postId}:${m.value}:${T.value}`);
|
|
1546
1615
|
function ke(e) {
|
|
1547
1616
|
l.layout === "reel" && (e.stopPropagation(), me());
|
|
@@ -1551,7 +1620,7 @@ var $t = [
|
|
|
1551
1620
|
mediaIndex: m.value,
|
|
1552
1621
|
source: "preview",
|
|
1553
1622
|
src: A.value?.src ?? ""
|
|
1554
|
-
}), N.value = !0, l.layout === "masonry" &&
|
|
1623
|
+
}), N.value = !0, l.layout === "masonry" && U());
|
|
1555
1624
|
}
|
|
1556
1625
|
return P(j, () => {
|
|
1557
1626
|
N.value = !1;
|
|
@@ -1560,7 +1629,7 @@ var $t = [
|
|
|
1560
1629
|
() => l.layout,
|
|
1561
1630
|
R
|
|
1562
1631
|
], ([e, t, n]) => {
|
|
1563
|
-
e && t === "masonry" && !n && v(() =>
|
|
1632
|
+
e && t === "masonry" && !n && v(() => U());
|
|
1564
1633
|
}, { immediate: !0 }), (r, i) => (w(), s("article", {
|
|
1565
1634
|
"data-post-id": e.item.postId,
|
|
1566
1635
|
"data-media-index": m.value,
|
|
@@ -1572,7 +1641,7 @@ var $t = [
|
|
|
1572
1641
|
}]),
|
|
1573
1642
|
style: x(e.itemStyle),
|
|
1574
1643
|
"aria-hidden": e.leaving || void 0,
|
|
1575
|
-
"aria-busy": M(z) === "loading" || M(
|
|
1644
|
+
"aria-busy": M(z) === "loading" || M(Y),
|
|
1576
1645
|
inert: e.leaving || void 0,
|
|
1577
1646
|
role: e.interactive && !e.leaving && !ge.value ? "button" : void 0,
|
|
1578
1647
|
tabindex: e.interactive && !e.leaving && !ge.value ? 0 : void 0,
|
|
@@ -1610,11 +1679,11 @@ var $t = [
|
|
|
1610
1679
|
onTouchendPassive: i[33] ||= (...e) => M(be) && M(be)(...e)
|
|
1611
1680
|
}, [
|
|
1612
1681
|
u(n, {
|
|
1613
|
-
css: !M(
|
|
1682
|
+
css: !M(Y),
|
|
1614
1683
|
name: `media-slide-${M(ye)}`
|
|
1615
1684
|
}, {
|
|
1616
1685
|
default: F(() => [(w(), s("div", {
|
|
1617
|
-
key: `${e.item.postId}:${h.value.src}:${e.mediaSource ?? "preview"}:${M(
|
|
1686
|
+
key: `${e.item.postId}:${h.value.src}:${e.mediaSource ?? "preview"}:${M(X)}`,
|
|
1618
1687
|
class: "media-card-frame",
|
|
1619
1688
|
"data-media-index": m.value
|
|
1620
1689
|
}, [
|
|
@@ -1622,9 +1691,9 @@ var $t = [
|
|
|
1622
1691
|
key: 1,
|
|
1623
1692
|
component: e.mediaCard?.error?.component,
|
|
1624
1693
|
label: M(dt)(T.value),
|
|
1625
|
-
retrying: M(
|
|
1694
|
+
retrying: M(Y),
|
|
1626
1695
|
status: M(ut)(T.value),
|
|
1627
|
-
onRetry: M(
|
|
1696
|
+
onRetry: M(J)
|
|
1628
1697
|
}, null, 8, [
|
|
1629
1698
|
"component",
|
|
1630
1699
|
"label",
|
|
@@ -1635,23 +1704,23 @@ var $t = [
|
|
|
1635
1704
|
b.value && e.layout === "reel" ? (w(), s("audio", {
|
|
1636
1705
|
key: 2,
|
|
1637
1706
|
ref_key: "mediaElement",
|
|
1638
|
-
ref:
|
|
1639
|
-
"data-source-generation": M(
|
|
1707
|
+
ref: Z,
|
|
1708
|
+
"data-source-generation": M(X),
|
|
1640
1709
|
class: "media-audio-element",
|
|
1641
1710
|
src: T.value,
|
|
1642
1711
|
autoplay: M(ue),
|
|
1643
1712
|
loop: !e.advanceOnMediaEnd,
|
|
1644
|
-
muted: M(
|
|
1713
|
+
muted: M(ae),
|
|
1645
1714
|
preload: M(Te),
|
|
1646
1715
|
onLoadedmetadata: i[0] ||= (...e) => M(ce) && M(ce)(...e),
|
|
1647
|
-
onProgress: i[1] ||= (...e) => M(
|
|
1648
|
-
onLoadeddata: i[2] ||= (...e) => M(
|
|
1649
|
-
onCanplay: i[3] ||= (...e) => M(
|
|
1716
|
+
onProgress: i[1] ||= (...e) => M(W) && M(W)(...e),
|
|
1717
|
+
onLoadeddata: i[2] ||= (...e) => M(W) && M(W)(...e),
|
|
1718
|
+
onCanplay: i[3] ||= (...e) => M(W) && M(W)(...e),
|
|
1650
1719
|
onDurationchange: i[4] ||= (...e) => M($) && M($)(...e),
|
|
1651
1720
|
onTimeupdate: i[5] ||= (...e) => M($) && M($)(...e),
|
|
1652
1721
|
onVolumechange: i[6] ||= (...e) => M($) && M($)(...e),
|
|
1653
1722
|
onPlaying: i[7] ||= (...e) => M(le) && M(le)(...e),
|
|
1654
|
-
onPause: i[8] ||= (e) =>
|
|
1723
|
+
onPause: i[8] ||= (e) => se.value = !1,
|
|
1655
1724
|
onEnded: i[9] ||= (...e) => M(Q) && M(Q)(...e),
|
|
1656
1725
|
onError: i[10] ||= (...e) => M(B) && M(B)(...e)
|
|
1657
1726
|
}, null, 40, an)) : o("", !0),
|
|
@@ -1659,13 +1728,13 @@ var $t = [
|
|
|
1659
1728
|
key: 3,
|
|
1660
1729
|
type: "button",
|
|
1661
1730
|
class: y(["media-audio-artwork media-preview", { "media-preview--ready": M(z) === "ready" }]),
|
|
1662
|
-
"aria-label": e.layout === "reel" ? M(
|
|
1731
|
+
"aria-label": e.layout === "reel" ? M(se) ? "Pause audio" : "Play audio" : "Audio",
|
|
1663
1732
|
disabled: e.layout !== "reel",
|
|
1664
1733
|
onClick: ke
|
|
1665
1734
|
}, [R.value ? (w(), s("img", {
|
|
1666
1735
|
key: j.value,
|
|
1667
1736
|
"data-cover-identity": j.value,
|
|
1668
|
-
"data-source-generation": M(
|
|
1737
|
+
"data-source-generation": M(X),
|
|
1669
1738
|
class: "media-audio-cover",
|
|
1670
1739
|
src: R.value.src,
|
|
1671
1740
|
width: R.value.width ?? void 0,
|
|
@@ -1674,7 +1743,7 @@ var $t = [
|
|
|
1674
1743
|
alt: "",
|
|
1675
1744
|
decoding: "async",
|
|
1676
1745
|
loading: M(Ce),
|
|
1677
|
-
onLoad: i[11] ||= (t) => e.layout === "masonry" && M(
|
|
1746
|
+
onLoad: i[11] ||= (t) => e.layout === "masonry" && M(U)(t),
|
|
1678
1747
|
onError: Ae
|
|
1679
1748
|
}, null, 40, sn)) : (w(), s("span", cn, [u(M(it), {
|
|
1680
1749
|
size: 64,
|
|
@@ -1682,8 +1751,8 @@ var $t = [
|
|
|
1682
1751
|
})]))], 10, on)) : M(we) ? (w(), s("video", {
|
|
1683
1752
|
key: 4,
|
|
1684
1753
|
ref_key: "mediaElement",
|
|
1685
|
-
ref:
|
|
1686
|
-
"data-source-generation": M(
|
|
1754
|
+
ref: Z,
|
|
1755
|
+
"data-source-generation": M(X),
|
|
1687
1756
|
class: y(["media-preview", {
|
|
1688
1757
|
"media-preview--ready": M(z) === "ready",
|
|
1689
1758
|
"media-preview--reel-video": e.layout === "reel"
|
|
@@ -1693,26 +1762,26 @@ var $t = [
|
|
|
1693
1762
|
height: O.value ?? void 0,
|
|
1694
1763
|
autoplay: M(ue),
|
|
1695
1764
|
loop: !e.advanceOnMediaEnd,
|
|
1696
|
-
muted: M(
|
|
1765
|
+
muted: M(ae),
|
|
1697
1766
|
playsinline: "",
|
|
1698
1767
|
preload: M(Te),
|
|
1699
1768
|
onLoadedmetadata: i[12] ||= (...e) => M(ce) && M(ce)(...e),
|
|
1700
|
-
onProgress: i[13] ||= (...e) => M(
|
|
1701
|
-
onLoadeddata: i[14] ||= (...e) => M(
|
|
1702
|
-
onCanplay: i[15] ||= (...e) => M(
|
|
1769
|
+
onProgress: i[13] ||= (...e) => M(W) && M(W)(...e),
|
|
1770
|
+
onLoadeddata: i[14] ||= (...e) => M(W) && M(W)(...e),
|
|
1771
|
+
onCanplay: i[15] ||= (...e) => M(W) && M(W)(...e),
|
|
1703
1772
|
onDurationchange: i[16] ||= (...e) => M($) && M($)(...e),
|
|
1704
1773
|
onTimeupdate: i[17] ||= (...e) => M($) && M($)(...e),
|
|
1705
1774
|
onVolumechange: i[18] ||= (...e) => M($) && M($)(...e),
|
|
1706
1775
|
onPlaying: i[19] ||= (...e) => M(le) && M(le)(...e),
|
|
1707
|
-
onPause: i[20] ||= (e) =>
|
|
1776
|
+
onPause: i[20] ||= (e) => se.value = !1,
|
|
1708
1777
|
onEnded: i[21] ||= (...e) => M(Q) && M(Q)(...e),
|
|
1709
1778
|
onClick: ke,
|
|
1710
1779
|
onError: i[22] ||= (...e) => M(B) && M(B)(...e)
|
|
1711
1780
|
}, null, 42, ln)) : b.value ? o("", !0) : (w(), s("img", {
|
|
1712
1781
|
key: 5,
|
|
1713
1782
|
ref_key: "imageElement",
|
|
1714
|
-
ref:
|
|
1715
|
-
"data-source-generation": M(
|
|
1783
|
+
ref: V,
|
|
1784
|
+
"data-source-generation": M(X),
|
|
1716
1785
|
class: y(["media-preview", { "media-preview--ready": M(z) === "ready" }]),
|
|
1717
1786
|
src: T.value,
|
|
1718
1787
|
width: D.value ?? void 0,
|
|
@@ -1721,7 +1790,7 @@ var $t = [
|
|
|
1721
1790
|
alt: "",
|
|
1722
1791
|
decoding: "async",
|
|
1723
1792
|
loading: M(Ce),
|
|
1724
|
-
onLoad: i[23] ||= (...e) => M(
|
|
1793
|
+
onLoad: i[23] ||= (...e) => M(U) && M(U)(...e),
|
|
1725
1794
|
onError: i[24] ||= (...e) => M(B) && M(B)(...e)
|
|
1726
1795
|
}, null, 42, un))
|
|
1727
1796
|
], 8, nn))]),
|
|
@@ -1749,13 +1818,13 @@ var $t = [
|
|
|
1749
1818
|
}, {
|
|
1750
1819
|
default: F(() => [De.value ? (w(), a(Tt, {
|
|
1751
1820
|
key: Oe.value,
|
|
1752
|
-
"current-time": M(
|
|
1821
|
+
"current-time": M(re),
|
|
1753
1822
|
"data-control-post-id": Ee.value ? e.item.postId : void 0,
|
|
1754
|
-
duration: M(
|
|
1823
|
+
duration: M(ie),
|
|
1755
1824
|
layout: e.layout,
|
|
1756
1825
|
"media-type": b.value ? "audio" : "video",
|
|
1757
|
-
muted: M(
|
|
1758
|
-
playing: M(
|
|
1826
|
+
muted: M(oe),
|
|
1827
|
+
playing: M(se),
|
|
1759
1828
|
volume: M(he),
|
|
1760
1829
|
onSeek: M(de),
|
|
1761
1830
|
onToggleMute: M(pe),
|
|
@@ -1836,7 +1905,7 @@ function hn(e) {
|
|
|
1836
1905
|
return t.flatMap((t) => {
|
|
1837
1906
|
let n = e.items()[t];
|
|
1838
1907
|
if (!n) return [];
|
|
1839
|
-
let r = e.mediaIndices().get(n.postId) ?? 0, i =
|
|
1908
|
+
let r = e.mediaIndices().get(n.postId) ?? 0, i = J(n.postId, r);
|
|
1840
1909
|
return e.previewStates().get(i) === "ready" ? [{
|
|
1841
1910
|
key: i,
|
|
1842
1911
|
mediaIndex: r,
|
|
@@ -1980,53 +2049,53 @@ var vn = { class: "masonry-feed-shell" }, yn = ["aria-hidden", "inert"], bn = {
|
|
|
1980
2049
|
}, 0);
|
|
1981
2050
|
return Math.max(e, t);
|
|
1982
2051
|
}
|
|
1983
|
-
function
|
|
2052
|
+
function V() {
|
|
1984
2053
|
return O.value.reduce((e, t) => Math.max(e, t), -1);
|
|
1985
2054
|
}
|
|
1986
|
-
let
|
|
2055
|
+
let H = _n({
|
|
1987
2056
|
additionalHeight: r(() => R.value.additionalHeight),
|
|
1988
2057
|
gap: _,
|
|
1989
2058
|
items: () => d.items,
|
|
1990
2059
|
minColumnWidth: r(() => R.value.minColumnWidth),
|
|
1991
|
-
packThroughIndex:
|
|
2060
|
+
packThroughIndex: V,
|
|
1992
2061
|
packUntilBottom: B,
|
|
1993
2062
|
width: g
|
|
1994
|
-
}),
|
|
1995
|
-
throughIndex:
|
|
2063
|
+
}), U = H.layout, W = H.viewportIndex, ee = r(() => d.leavingPostIds.size === 0 ? null : Oe(d.items, g.value, R.value, U.value, (e) => d.leavingPostIds.has(d.items[e].postId), {
|
|
2064
|
+
throughIndex: V(),
|
|
1996
2065
|
untilBottom: B()
|
|
1997
|
-
})),
|
|
1998
|
-
let e =
|
|
2066
|
+
})), G = r(() => {
|
|
2067
|
+
let e = ee.value;
|
|
1999
2068
|
return e ? {
|
|
2000
2069
|
columns: e.columns,
|
|
2001
2070
|
height: e.height,
|
|
2002
2071
|
items: e.items
|
|
2003
|
-
} :
|
|
2004
|
-
}),
|
|
2005
|
-
let e =
|
|
2006
|
-
return e ? Ne(e.items, e.retainedIndices,
|
|
2007
|
-
}),
|
|
2008
|
-
let t = d.items[e], n =
|
|
2072
|
+
} : U.value;
|
|
2073
|
+
}), te = r(() => {
|
|
2074
|
+
let e = ee.value;
|
|
2075
|
+
return e ? Ne(e.items, e.retainedIndices, W.value, e.fromIndex) : null;
|
|
2076
|
+
}), K = r(() => (U.value, Math.max(b.value, H.reservedHeight(), d.leavingPostIds.size === 0 ? G.value.height : U.value.height))), q = r(() => ({ height: `${K.value}px` })), ne = r(() => !d.infiniteScroll || v.value > 0 && C.value + G.value.height <= v.value + 1), Y = r(() => new Set(D.value)), X = r(() => O.value.flatMap((e) => {
|
|
2077
|
+
let t = d.items[e], n = G.value.items[e];
|
|
2009
2078
|
return !t || !n || n.width <= 0 || n.height <= 0 ? [] : [{
|
|
2010
|
-
fetchPriority:
|
|
2079
|
+
fetchPriority: Y.value.has(e) ? "high" : "low",
|
|
2011
2080
|
index: e,
|
|
2012
2081
|
item: t
|
|
2013
2082
|
}];
|
|
2014
2083
|
}));
|
|
2015
|
-
function
|
|
2084
|
+
function Z(e, t) {
|
|
2016
2085
|
return [...new Set([...e, ...t])].sort((e, t) => e - t);
|
|
2017
2086
|
}
|
|
2018
|
-
function
|
|
2087
|
+
function re(e, t) {
|
|
2019
2088
|
return e.length === t.length && e.every((e, n) => e === t[n]);
|
|
2020
2089
|
}
|
|
2021
|
-
function
|
|
2090
|
+
function ie(e) {
|
|
2022
2091
|
let t = {
|
|
2023
2092
|
scrollTop: A - C.value,
|
|
2024
2093
|
viewportHeight: v.value
|
|
2025
|
-
}, n =
|
|
2094
|
+
}, n = te.value, r = Fe(n ?? W.value, {
|
|
2026
2095
|
...t,
|
|
2027
2096
|
overscan: e
|
|
2028
2097
|
}).indices;
|
|
2029
|
-
return
|
|
2098
|
+
return Z(r, d.leavingPostIds.size === 0 ? [] : Fe(W.value, {
|
|
2030
2099
|
...t,
|
|
2031
2100
|
overscan: e
|
|
2032
2101
|
}).indices.filter((e) => {
|
|
@@ -2034,23 +2103,23 @@ var vn = { class: "masonry-feed-shell" }, yn = ["aria-hidden", "inert"], bn = {
|
|
|
2034
2103
|
return t !== void 0 && d.leavingPostIds.has(t.postId);
|
|
2035
2104
|
}));
|
|
2036
2105
|
}
|
|
2037
|
-
function
|
|
2038
|
-
let e =
|
|
2039
|
-
|
|
2040
|
-
let n = xe(
|
|
2106
|
+
function ae() {
|
|
2107
|
+
let e = ie(0), t = ie(Le(d.masonry, v.value));
|
|
2108
|
+
re(D.value, e) || (D.value = e);
|
|
2109
|
+
let n = xe(G.value.items, e.filter((e) => {
|
|
2041
2110
|
let t = d.items[e];
|
|
2042
2111
|
return t && !d.leavingPostIds.has(t.postId);
|
|
2043
2112
|
}), {
|
|
2044
2113
|
scrollTop: A - C.value,
|
|
2045
2114
|
viewportHeight: v.value
|
|
2046
2115
|
});
|
|
2047
|
-
|
|
2116
|
+
re(T.value, n) || (T.value = n), re(O.value, t) || (O.value = t);
|
|
2048
2117
|
}
|
|
2049
|
-
function
|
|
2118
|
+
function oe() {
|
|
2050
2119
|
if (L !== null) return;
|
|
2051
2120
|
L = -1;
|
|
2052
2121
|
let e = requestAnimationFrame(() => {
|
|
2053
|
-
L = null,
|
|
2122
|
+
L = null, ae();
|
|
2054
2123
|
});
|
|
2055
2124
|
L !== null && (L = e);
|
|
2056
2125
|
}
|
|
@@ -2063,11 +2132,11 @@ var vn = { class: "masonry-feed-shell" }, yn = ["aria-hidden", "inert"], bn = {
|
|
|
2063
2132
|
previewStates: () => d.previewStates,
|
|
2064
2133
|
visibleIndices: () => D.value
|
|
2065
2134
|
});
|
|
2066
|
-
function
|
|
2067
|
-
let t =
|
|
2135
|
+
function se(e) {
|
|
2136
|
+
let t = G.value.items[e], n = d.items[e]?.postId;
|
|
2068
2137
|
if (!t || t.width <= 0 || t.height <= 0) return {};
|
|
2069
2138
|
let r = n !== void 0 && d.enteringPostIds.has(n), i = n !== void 0 && d.leavingPostIds.has(n), a = r || i ? ve({
|
|
2070
|
-
containerHeight: Math.max(b.value,
|
|
2139
|
+
containerHeight: Math.max(b.value, U.value.height),
|
|
2071
2140
|
gap: _.value
|
|
2072
2141
|
}) : 0, o = n === void 0 ? 0 : i ? d.removalDelays.get(n) ?? 0 : r ? d.entryDelays.get(n) ?? 0 : 0;
|
|
2073
2142
|
return {
|
|
@@ -2084,7 +2153,7 @@ var vn = { class: "masonry-feed-shell" }, yn = ["aria-hidden", "inert"], bn = {
|
|
|
2084
2153
|
let t = e.ownerDocument.defaultView?.getComputedStyle(e), n = (Number.parseFloat(t?.paddingTop ?? "") || 0) + (Number.parseFloat(t?.paddingBottom ?? "") || 0);
|
|
2085
2154
|
b.value = Math.max(0, e.clientHeight - n);
|
|
2086
2155
|
let r = h.value;
|
|
2087
|
-
r && (C.value = r.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop,
|
|
2156
|
+
r && (C.value = r.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop, ae());
|
|
2088
2157
|
}
|
|
2089
2158
|
function ce(e) {
|
|
2090
2159
|
let t = e.ownerDocument.documentElement.clientWidth;
|
|
@@ -2092,7 +2161,7 @@ var vn = { class: "masonry-feed-shell" }, yn = ["aria-hidden", "inert"], bn = {
|
|
|
2092
2161
|
}
|
|
2093
2162
|
function le(e) {
|
|
2094
2163
|
let t = e.currentTarget;
|
|
2095
|
-
t && (A = t.scrollTop,
|
|
2164
|
+
t && (A = t.scrollTop, H.ensurePackedThrough(B()), oe(), Date.now() >= l && !d.loadMoreLocked && d.infiniteScroll && he(t, d.masonry?.loadMoreThresholdPx) && f("loadMore"));
|
|
2096
2165
|
}
|
|
2097
2166
|
function ue() {
|
|
2098
2167
|
let e = p.value;
|
|
@@ -2113,13 +2182,13 @@ var vn = { class: "masonry-feed-shell" }, yn = ["aria-hidden", "inert"], bn = {
|
|
|
2113
2182
|
}), j.observe(e)));
|
|
2114
2183
|
}), P(p, (e) => {
|
|
2115
2184
|
F?.disconnect(), F = null, e && (Q(), !(typeof ResizeObserver > "u") && (F = new ResizeObserver(Q), F.observe(e)));
|
|
2116
|
-
}), P(
|
|
2185
|
+
}), P(G, (e) => {
|
|
2117
2186
|
z = e.items;
|
|
2118
2187
|
}, { flush: "sync" }), P([
|
|
2119
|
-
|
|
2120
|
-
|
|
2188
|
+
U,
|
|
2189
|
+
G,
|
|
2121
2190
|
() => d.masonry
|
|
2122
|
-
],
|
|
2191
|
+
], ae, { flush: "post" }), S(() => {
|
|
2123
2192
|
j?.disconnect(), F?.disconnect(), I !== null && cancelAnimationFrame(I), L !== null && cancelAnimationFrame(L);
|
|
2124
2193
|
}), n({
|
|
2125
2194
|
getScrollElement: de,
|
|
@@ -2138,9 +2207,9 @@ var vn = { class: "masonry-feed-shell" }, yn = ["aria-hidden", "inert"], bn = {
|
|
|
2138
2207
|
ref_key: "masonryElement",
|
|
2139
2208
|
ref: h,
|
|
2140
2209
|
class: y(["masonry", { "masonry--ready": g.value > 0 }]),
|
|
2141
|
-
style: x(
|
|
2210
|
+
style: x(q.value),
|
|
2142
2211
|
"aria-label": "Media gallery"
|
|
2143
|
-
}, [(w(!0), s(e, null, E(
|
|
2212
|
+
}, [(w(!0), s(e, null, E(X.value, ({ fetchPriority: e, item: n, index: r }) => (w(), a(mn, {
|
|
2144
2213
|
key: n.postId,
|
|
2145
2214
|
class: "masonry-item",
|
|
2146
2215
|
entering: t.enteringPostIds.has(n.postId),
|
|
@@ -2149,15 +2218,15 @@ var vn = { class: "masonry-feed-shell" }, yn = ["aria-hidden", "inert"], bn = {
|
|
|
2149
2218
|
"card-footer": t.cardFooter,
|
|
2150
2219
|
"card-header": t.cardHeader,
|
|
2151
2220
|
"media-card": t.mediaCard,
|
|
2152
|
-
"in-viewport":
|
|
2221
|
+
"in-viewport": Y.value.has(r),
|
|
2153
2222
|
index: r,
|
|
2154
2223
|
item: n,
|
|
2155
|
-
"item-style":
|
|
2224
|
+
"item-style": se(r),
|
|
2156
2225
|
interactive: "",
|
|
2157
2226
|
layout: "masonry",
|
|
2158
2227
|
"loaded-count": t.items.length,
|
|
2159
2228
|
"media-index": t.mediaIndices.get(n.postId) ?? 0,
|
|
2160
|
-
"preview-state": t.previewStates.get(M(
|
|
2229
|
+
"preview-state": t.previewStates.get(M(J)(n.postId, t.mediaIndices.get(n.postId) ?? 0)) ?? "loading",
|
|
2161
2230
|
total: t.total,
|
|
2162
2231
|
onActivate: (e) => f("activate", n.postId, e),
|
|
2163
2232
|
onMediaChange: (e) => f("mediaChange", n.postId, e),
|
|
@@ -2190,7 +2259,7 @@ var vn = { class: "masonry-feed-shell" }, yn = ["aria-hidden", "inert"], bn = {
|
|
|
2190
2259
|
"aria-hidden": "true",
|
|
2191
2260
|
style: x({ flex: `0 0 ${t.masonry.bottomSpacePx}px` })
|
|
2192
2261
|
}, null, 4)) : o("", !0)], 42, yn),
|
|
2193
|
-
t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext &&
|
|
2262
|
+
t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && ne.value || !t.hasNext && t.canRetryEnd ? (w(), s("div", bn, [u(fe, {
|
|
2194
2263
|
actions: t.feedFooterActions,
|
|
2195
2264
|
"can-retry-end": t.canRetryEnd,
|
|
2196
2265
|
"feed-footer": t.feedFooter,
|
|
@@ -2198,7 +2267,7 @@ var vn = { class: "masonry-feed-shell" }, yn = ["aria-hidden", "inert"], bn = {
|
|
|
2198
2267
|
"has-next": t.hasNext,
|
|
2199
2268
|
"is-loading": t.isLoadingMore,
|
|
2200
2269
|
"load-more-locked": t.loadMoreLocked,
|
|
2201
|
-
"show-load-more":
|
|
2270
|
+
"show-load-more": ne.value,
|
|
2202
2271
|
state: t.state,
|
|
2203
2272
|
onLoadMore: r[0] ||= (e) => f("loadMore"),
|
|
2204
2273
|
onRetryEnd: r[1] ||= (e) => f("retryEnd")
|
|
@@ -2214,7 +2283,7 @@ var vn = { class: "masonry-feed-shell" }, yn = ["aria-hidden", "inert"], bn = {
|
|
|
2214
2283
|
"state"
|
|
2215
2284
|
])])) : o("", !0),
|
|
2216
2285
|
u(Ke, {
|
|
2217
|
-
"content-size":
|
|
2286
|
+
"content-size": G.value.height,
|
|
2218
2287
|
"controls-id": m,
|
|
2219
2288
|
"scroll-element": p.value,
|
|
2220
2289
|
suspended: t.suspended
|
|
@@ -2318,8 +2387,8 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2318
2387
|
return e === void 0 ? 0 : u.mediaIndices.get(e) ?? 0;
|
|
2319
2388
|
}), R = r(() => {
|
|
2320
2389
|
let e = F.value;
|
|
2321
|
-
return e === void 0 ? "loading" : u.previewStates.get(
|
|
2322
|
-
}), z = r(() => I.value ?
|
|
2390
|
+
return e === void 0 ? "loading" : u.previewStates.get(J(e, L.value)) ?? "loading";
|
|
2391
|
+
}), z = r(() => I.value ? ne(I.value, L.value) : null), B = r(() => z.value ? te(z.value, u.mediaSource ?? "preview") : null), V = r(() => R.value === "ready" && !!(B.value && U(B.value.type, B.value.src))), H = r(() => [
|
|
2323
2392
|
F.value,
|
|
2324
2393
|
L.value,
|
|
2325
2394
|
u.items.length,
|
|
@@ -2327,42 +2396,42 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2327
2396
|
u.reelAutoAdvance.enabled,
|
|
2328
2397
|
u.reelAutoAdvance.includePostItems,
|
|
2329
2398
|
u.reelAutoAdvance.intervalMs
|
|
2330
|
-
].join(":")),
|
|
2331
|
-
let e = I.value, t = !!(e && u.reelAutoAdvance.includePostItems && L.value <
|
|
2399
|
+
].join(":")), W = r(() => {
|
|
2400
|
+
let e = I.value, t = !!(e && u.reelAutoAdvance.includePostItems && L.value < K(e).length - 1), n = u.reelAutoAdvance.intervalMs / 1e3;
|
|
2332
2401
|
return `Auto advance to the next ${t ? "post item" : "post"} in ${n}s`;
|
|
2333
|
-
}),
|
|
2334
|
-
function
|
|
2402
|
+
}), ee = r(() => u.reelAutoAdvance.enabled && u.reelForward.status === "idle" && I.value !== void 0 && R.value !== "loading" && !V.value), G = r(() => !u.infiniteScroll || u.items.length <= 1), q = r(() => u.reelForward.status === "end" && u.hasNext && !u.infiniteScroll && !u.loadMoreLocked), Y = r(() => u.reelForward.status === "loading" ? "Loading the next media…" : u.reelForward.status === "error" ? "Unable to load the next media." : q.value ? "Load the next page to continue." : "You reached the end of this feed.");
|
|
2403
|
+
function X(e) {
|
|
2335
2404
|
return { gridRow: `${e + 1}` };
|
|
2336
2405
|
}
|
|
2337
|
-
function
|
|
2406
|
+
function Z(e) {
|
|
2338
2407
|
let t = b || e.clientHeight;
|
|
2339
2408
|
return t <= 0 || u.items.length === 0 ? 0 : Math.min(u.items.length - 1, Math.max(0, Math.round(e.scrollTop / t)));
|
|
2340
2409
|
}
|
|
2341
|
-
function
|
|
2410
|
+
function re(e) {
|
|
2342
2411
|
let t = e.currentTarget;
|
|
2343
2412
|
if (!t) return;
|
|
2344
2413
|
let n = b || t.clientHeight, r = Math.max(0, u.items.length - 1) * n;
|
|
2345
|
-
g.value = u.items.length > 0 && t.scrollTop > r + 1, _.value || (h.value =
|
|
2414
|
+
g.value = u.items.length > 0 && t.scrollTop > r + 1, _.value || (h.value = Z(t)), Date.now() >= l && !u.loadMoreLocked && u.infiniteScroll && he(t) && d("loadMore");
|
|
2346
2415
|
}
|
|
2347
|
-
function
|
|
2416
|
+
function ie() {
|
|
2348
2417
|
let e = f.value;
|
|
2349
|
-
e && (g.value = !1,
|
|
2418
|
+
e && (g.value = !1, se(!0), b = e.clientHeight, e.scrollTop = h.value * b, D !== null && cancelAnimationFrame(D), D = requestAnimationFrame(() => {
|
|
2350
2419
|
e.scrollTop = h.value * e.clientHeight, b = e.clientHeight, D = null;
|
|
2351
|
-
}),
|
|
2420
|
+
}), ae());
|
|
2352
2421
|
}
|
|
2353
|
-
function
|
|
2422
|
+
function ae() {
|
|
2354
2423
|
O !== null && clearTimeout(O), O = setTimeout(() => {
|
|
2355
2424
|
O = null;
|
|
2356
2425
|
let e = f.value;
|
|
2357
|
-
e && (b = e.clientHeight, e.scrollTop = h.value * b),
|
|
2426
|
+
e && (b = e.clientHeight, e.scrollTop = h.value * b), se(!1);
|
|
2358
2427
|
}, 120);
|
|
2359
2428
|
}
|
|
2360
|
-
function
|
|
2361
|
-
|
|
2429
|
+
function oe() {
|
|
2430
|
+
se(!0);
|
|
2362
2431
|
let e = f.value;
|
|
2363
|
-
e && (b = e.clientHeight, e.scrollTop = h.value * b),
|
|
2432
|
+
e && (b = e.clientHeight, e.scrollTop = h.value * b), ae();
|
|
2364
2433
|
}
|
|
2365
|
-
function
|
|
2434
|
+
function se(e) {
|
|
2366
2435
|
_.value = e, f.value?.toggleAttribute("data-resizing", e);
|
|
2367
2436
|
}
|
|
2368
2437
|
function Q() {
|
|
@@ -2375,7 +2444,7 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2375
2444
|
function ce(e) {
|
|
2376
2445
|
let t = I.value;
|
|
2377
2446
|
if (!t) return !1;
|
|
2378
|
-
let n =
|
|
2447
|
+
let n = K(t).length;
|
|
2379
2448
|
if (n <= 1) return !1;
|
|
2380
2449
|
let r = (L.value + e + n) % n;
|
|
2381
2450
|
return d("mediaChange", t.postId, r), !0;
|
|
@@ -2411,7 +2480,7 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2411
2480
|
if (!u.reelAutoAdvance.enabled) return;
|
|
2412
2481
|
let e = I.value;
|
|
2413
2482
|
if (!e) return;
|
|
2414
|
-
if (u.reelAutoAdvance.includePostItems && L.value <
|
|
2483
|
+
if (u.reelAutoAdvance.includePostItems && L.value < K(e).length - 1) {
|
|
2415
2484
|
d("mediaChange", e.postId, L.value + 1);
|
|
2416
2485
|
return;
|
|
2417
2486
|
}
|
|
@@ -2423,19 +2492,19 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2423
2492
|
u.reelAutoAdvance.includePostItems && (u.mediaIndices.get(n.postId) ?? 0) !== 0 && d("mediaChange", n.postId, 0), pe(t);
|
|
2424
2493
|
}
|
|
2425
2494
|
function ve(e, t) {
|
|
2426
|
-
!u.reelAutoAdvance.enabled || e !== F.value || t !== L.value || !
|
|
2495
|
+
!u.reelAutoAdvance.enabled || e !== F.value || t !== L.value || !V.value || _e();
|
|
2427
2496
|
}
|
|
2428
2497
|
return P(f, (e) => {
|
|
2429
|
-
T?.disconnect(), T = null, e && (b = e.clientHeight, !(typeof ResizeObserver > "u") && (T = new ResizeObserver(
|
|
2498
|
+
T?.disconnect(), T = null, e && (b = e.clientHeight, !(typeof ResizeObserver > "u") && (T = new ResizeObserver(ie), T.observe(e)));
|
|
2430
2499
|
}), P(() => u.items.length, async (e) => {
|
|
2431
2500
|
let t = u.initialPostId, n = t == null ? -1 : u.items.findIndex(({ postId: e }) => e === t);
|
|
2432
|
-
h.value = n >= 0 ? n : Math.min(h.value, Math.max(0, e - 1)), await v(),
|
|
2501
|
+
h.value = n >= 0 ? n : Math.min(h.value, Math.max(0, e - 1)), await v(), ie();
|
|
2433
2502
|
}), P(F, (e) => {
|
|
2434
2503
|
e !== void 0 && d("activeChange", e);
|
|
2435
2504
|
}, { immediate: !0 }), C(() => {
|
|
2436
|
-
window.addEventListener("resize",
|
|
2505
|
+
window.addEventListener("resize", oe), window.addEventListener("orientationchange", oe), m >= 0 && v(ie);
|
|
2437
2506
|
}), S(() => {
|
|
2438
|
-
window.removeEventListener("resize",
|
|
2507
|
+
window.removeEventListener("resize", oe), window.removeEventListener("orientationchange", oe), T?.disconnect(), D !== null && cancelAnimationFrame(D), O !== null && clearTimeout(O);
|
|
2439
2508
|
}), n({
|
|
2440
2509
|
activeIndex: h,
|
|
2441
2510
|
activePostId: F,
|
|
@@ -2480,7 +2549,7 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2480
2549
|
class: "gallery-shell reel-feed",
|
|
2481
2550
|
"data-active-post-id": F.value,
|
|
2482
2551
|
"data-active-media-index": L.value,
|
|
2483
|
-
onScrollPassive:
|
|
2552
|
+
onScrollPassive: re
|
|
2484
2553
|
}, [t.reelForward.status === "idle" ? (w(), s("section", {
|
|
2485
2554
|
key: 1,
|
|
2486
2555
|
class: "reel-track",
|
|
@@ -2495,13 +2564,13 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2495
2564
|
"fetch-priority": e,
|
|
2496
2565
|
index: i,
|
|
2497
2566
|
item: n,
|
|
2498
|
-
"item-style":
|
|
2567
|
+
"item-style": X(i),
|
|
2499
2568
|
"media-card": t.mediaCard,
|
|
2500
2569
|
layout: "reel",
|
|
2501
2570
|
"loaded-count": t.items.length,
|
|
2502
2571
|
"media-index": t.mediaIndices.get(n.postId) ?? 0,
|
|
2503
2572
|
"media-source": t.mediaSource,
|
|
2504
|
-
"preview-state": t.previewStates.get(M(
|
|
2573
|
+
"preview-state": t.previewStates.get(M(J)(n.postId, t.mediaIndices.get(n.postId) ?? 0)) ?? "loading",
|
|
2505
2574
|
"reel-controls-target": p.value,
|
|
2506
2575
|
"reel-audio-state": t.reelAudioState,
|
|
2507
2576
|
"stationary-reel-controls": "",
|
|
@@ -2537,13 +2606,13 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2537
2606
|
class: "reel-forward-status",
|
|
2538
2607
|
role: t.reelForward.status === "error" ? "alert" : "status",
|
|
2539
2608
|
"data-status": t.reelForward.status
|
|
2540
|
-
}, [c("p", null, A(
|
|
2609
|
+
}, [c("p", null, A(Y.value), 1), t.reelForward.status === "error" || t.reelForward.status === "end" ? (w(), s("button", {
|
|
2541
2610
|
key: 0,
|
|
2542
2611
|
class: "reel-forward-retry",
|
|
2543
2612
|
type: "button",
|
|
2544
2613
|
disabled: t.loadMoreLocked,
|
|
2545
2614
|
onClick: r[0] ||= (e) => d("retryForward")
|
|
2546
|
-
}, A(
|
|
2615
|
+
}, A(q.value ? "Load more" : "Retry"), 9, Mn)) : o("", !0)], 8, jn)), t.reelForward.status === "idle" ? (w(), a(fe, {
|
|
2547
2616
|
key: 2,
|
|
2548
2617
|
actions: t.feedFooterActions,
|
|
2549
2618
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2552,7 +2621,7 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2552
2621
|
"has-next": t.hasNext,
|
|
2553
2622
|
"is-loading": t.isLoadingMore,
|
|
2554
2623
|
"load-more-locked": t.loadMoreLocked,
|
|
2555
|
-
"show-load-more":
|
|
2624
|
+
"show-load-more": G.value,
|
|
2556
2625
|
state: t.state,
|
|
2557
2626
|
onLoadMore: r[2] ||= (e) => d("loadMore"),
|
|
2558
2627
|
onRetryEnd: r[3] ||= (e) => d("retryEnd")
|
|
@@ -2594,10 +2663,10 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2594
2663
|
"style",
|
|
2595
2664
|
"total"
|
|
2596
2665
|
])) : o("", !0),
|
|
2597
|
-
|
|
2598
|
-
key:
|
|
2666
|
+
ee.value ? (w(), a(On, {
|
|
2667
|
+
key: H.value,
|
|
2599
2668
|
"duration-ms": t.reelAutoAdvance.intervalMs,
|
|
2600
|
-
label:
|
|
2669
|
+
label: W.value,
|
|
2601
2670
|
onComplete: _e
|
|
2602
2671
|
}, null, 8, ["duration-ms", "label"])) : o("", !0)
|
|
2603
2672
|
], 2));
|
|
@@ -2672,9 +2741,9 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2672
2741
|
item: e,
|
|
2673
2742
|
layout: "reel",
|
|
2674
2743
|
loadedCount: l.items.length,
|
|
2675
|
-
mediaCount:
|
|
2744
|
+
mediaCount: K(e).length,
|
|
2676
2745
|
mediaIndex: T.value,
|
|
2677
|
-
mediaItem:
|
|
2746
|
+
mediaItem: ne(e, T.value),
|
|
2678
2747
|
mediaSource: l.mediaSource ?? "preview",
|
|
2679
2748
|
origin: l.origin,
|
|
2680
2749
|
total: l.total
|
|
@@ -2707,7 +2776,7 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2707
2776
|
function B(e, t) {
|
|
2708
2777
|
d("mediaChange", e, t);
|
|
2709
2778
|
}
|
|
2710
|
-
function
|
|
2779
|
+
function V(e, t) {
|
|
2711
2780
|
d("ready", e, t);
|
|
2712
2781
|
}
|
|
2713
2782
|
return P(() => ({
|
|
@@ -2768,7 +2837,7 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2768
2837
|
onMediaError: r[1] ||= (e, t) => d("mediaError", e, t),
|
|
2769
2838
|
onLoadMore: r[2] ||= (e) => d("loadMore"),
|
|
2770
2839
|
onMediaChange: B,
|
|
2771
|
-
onReady:
|
|
2840
|
+
onReady: V,
|
|
2772
2841
|
onRetryEnd: r[3] ||= (e) => d("retryEnd"),
|
|
2773
2842
|
onRetryForward: r[4] ||= (e) => d("retryForward"),
|
|
2774
2843
|
onReelAudioChange: r[5] ||= (e) => d("reelAudioChange", e)
|
|
@@ -2808,23 +2877,85 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2808
2877
|
_: 1
|
|
2809
2878
|
})], 10, In));
|
|
2810
2879
|
}
|
|
2811
|
-
}), Vn =
|
|
2812
|
-
function
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
return
|
|
2880
|
+
}), Vn = 250, Hn = Array.prototype.forEach, Un = Array.prototype[Symbol.iterator];
|
|
2881
|
+
function Wn(e) {
|
|
2882
|
+
try {
|
|
2883
|
+
if (!Reflect.has(e, "forEach")) return !1;
|
|
2884
|
+
let t = j(e);
|
|
2885
|
+
return !h(e) && !_(e) && T(t) === e && Object.getPrototypeOf(t) === Array.prototype && !Object.prototype.hasOwnProperty.call(t, "forEach") && !Object.prototype.hasOwnProperty.call(t, Symbol.iterator) && t.forEach === Hn && t[Symbol.iterator] === Un;
|
|
2886
|
+
} catch {
|
|
2887
|
+
return !1;
|
|
2888
|
+
}
|
|
2889
|
+
}
|
|
2890
|
+
function Gn(e) {
|
|
2891
|
+
try {
|
|
2892
|
+
if (!m(e) || h(e) || _(e)) return !1;
|
|
2893
|
+
let t = j(e);
|
|
2894
|
+
if (T(t) !== e) return !1;
|
|
2895
|
+
let n = Object.getOwnPropertyDescriptor(t, "postId")?.value;
|
|
2896
|
+
return typeof n == "string" || typeof n == "number";
|
|
2897
|
+
} catch {
|
|
2898
|
+
return !1;
|
|
2899
|
+
}
|
|
2900
|
+
}
|
|
2901
|
+
function Kn(e, t) {
|
|
2902
|
+
let n = !1;
|
|
2903
|
+
return {
|
|
2904
|
+
items: e,
|
|
2905
|
+
positions: r(() => {
|
|
2906
|
+
let r = /* @__PURE__ */ new Map();
|
|
2907
|
+
return n = !0, e.forEach((e, i) => {
|
|
2908
|
+
let a = e.postId;
|
|
2909
|
+
r.has(a) || r.set(a, t + i), Gn(e) || (n = !1);
|
|
2910
|
+
}), r;
|
|
2911
|
+
}),
|
|
2912
|
+
canRetain: () => n
|
|
2913
|
+
};
|
|
2914
|
+
}
|
|
2915
|
+
function qn(e) {
|
|
2916
|
+
let t = ie(e), n = [], i = [], a = r(() => {
|
|
2917
|
+
let t = /* @__PURE__ */ new Map(), n = e.items;
|
|
2918
|
+
return Reflect.has(n, "forEach"), n.forEach((e, n) => {
|
|
2819
2919
|
let r = e.postId;
|
|
2820
2920
|
t.has(r) || t.set(r, n);
|
|
2821
2921
|
}), t;
|
|
2822
|
-
}),
|
|
2922
|
+
}), o = r(() => {
|
|
2923
|
+
let r = e.items, o = () => (n = [], i = [], [a]);
|
|
2924
|
+
if (!Wn(r)) return o();
|
|
2925
|
+
let s = t.value, c = s.length >= n.length;
|
|
2926
|
+
for (let e = 0; e < s.length; e += 1) {
|
|
2927
|
+
if (s[e] === void 0) return o();
|
|
2928
|
+
c && e < n.length && n[e] !== s[e] && (c = !1);
|
|
2929
|
+
}
|
|
2930
|
+
let l = c ? Math.floor(n.length / Vn) : 0, u = [];
|
|
2931
|
+
for (let e = 0; e < l; e += 1) {
|
|
2932
|
+
let t = i[e];
|
|
2933
|
+
u.push(t.canRetain() ? t : Kn(t.items, e * Vn));
|
|
2934
|
+
}
|
|
2935
|
+
for (let e = l * Vn; e < s.length; e += Vn) u.push(Kn(Object.freeze(s.slice(e, e + Vn)), e));
|
|
2936
|
+
return n = s, i = u, i.map((e) => e.positions);
|
|
2937
|
+
});
|
|
2938
|
+
return (e) => {
|
|
2939
|
+
for (let t of o.value) {
|
|
2940
|
+
let n = t.value.get(e);
|
|
2941
|
+
if (n !== void 0) return n;
|
|
2942
|
+
}
|
|
2943
|
+
return -1;
|
|
2944
|
+
};
|
|
2945
|
+
}
|
|
2946
|
+
//#endregion
|
|
2947
|
+
//#region src/core/mediaLifecycle.ts
|
|
2948
|
+
var Jn = /* @__PURE__ */ new WeakMap();
|
|
2949
|
+
function Yn(e, t) {
|
|
2950
|
+
if (typeof t == "number" && Number.isNaN(t)) return -1;
|
|
2951
|
+
if (!m(e) || !m(e.items)) return e.items.findIndex((e) => e.postId === t);
|
|
2952
|
+
let n = Jn.get(e);
|
|
2953
|
+
return n || (n = qn(e), Jn.set(e, n)), n(t);
|
|
2823
2954
|
}
|
|
2824
|
-
function
|
|
2825
|
-
let a =
|
|
2955
|
+
function Xn(e, t, n, r, i) {
|
|
2956
|
+
let a = Yn(e, t), o = e.items[a];
|
|
2826
2957
|
if (!o) return null;
|
|
2827
|
-
let s =
|
|
2958
|
+
let s = q(o, n), c = ne(o, s);
|
|
2828
2959
|
return {
|
|
2829
2960
|
item: o,
|
|
2830
2961
|
layout: r,
|
|
@@ -2837,7 +2968,7 @@ function Un(e, t, n, r, i) {
|
|
|
2837
2968
|
postIndex: a
|
|
2838
2969
|
};
|
|
2839
2970
|
}
|
|
2840
|
-
function
|
|
2971
|
+
function Zn(e, t) {
|
|
2841
2972
|
P(() => {
|
|
2842
2973
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null;
|
|
2843
2974
|
return {
|
|
@@ -2847,26 +2978,26 @@ function Wn(e, t) {
|
|
|
2847
2978
|
};
|
|
2848
2979
|
}, (n, r) => {
|
|
2849
2980
|
if (n.postId === null || n.postId === r?.postId && n.mediaIndex === r.mediaIndex && n.origin === r.origin) return;
|
|
2850
|
-
let i =
|
|
2981
|
+
let i = Xn(e, n.postId, n.mediaIndex, "reel", n.origin);
|
|
2851
2982
|
i && t(i);
|
|
2852
2983
|
}, { flush: "sync" });
|
|
2853
2984
|
}
|
|
2854
2985
|
//#endregion
|
|
2855
2986
|
//#region src/components/useMediaLifecycle.ts
|
|
2856
|
-
function
|
|
2987
|
+
function Qn() {
|
|
2857
2988
|
return k(O(/* @__PURE__ */ new Map()));
|
|
2858
2989
|
}
|
|
2859
|
-
function
|
|
2860
|
-
let n = /* @__PURE__ */ new Set(), i =
|
|
2990
|
+
function $n(e, t) {
|
|
2991
|
+
let n = /* @__PURE__ */ new Set(), i = Qn(), a = Qn(), o = Qn(), s = () => e.reelMediaSource === "preview" ? i : e.reelMediaSource === "mobile" ? o : a, c = r(() => s().value), l = /* @__PURE__ */ new Set();
|
|
2861
2992
|
function u() {
|
|
2862
2993
|
n.clear(), l.clear(), i.value = O(/* @__PURE__ */ new Map()), a.value = O(/* @__PURE__ */ new Map()), o.value = O(/* @__PURE__ */ new Map());
|
|
2863
2994
|
}
|
|
2864
2995
|
function d(e, t, n, r) {
|
|
2865
|
-
let i =
|
|
2996
|
+
let i = J(t, n);
|
|
2866
2997
|
e.value.set(i, r);
|
|
2867
2998
|
}
|
|
2868
2999
|
function f(t, n, r, i) {
|
|
2869
|
-
return
|
|
3000
|
+
return Xn(e, t, n, r, i);
|
|
2870
3001
|
}
|
|
2871
3002
|
function p(e, n, r, i) {
|
|
2872
3003
|
let a = f(e, n, r, i);
|
|
@@ -2892,13 +3023,13 @@ function Kn(e, t) {
|
|
|
2892
3023
|
d(s(), t, n, "ready"), p(t, n, "reel", e.reelOrigin ?? "reel");
|
|
2893
3024
|
}
|
|
2894
3025
|
function y(e, n) {
|
|
2895
|
-
let r =
|
|
3026
|
+
let r = J(e, n);
|
|
2896
3027
|
if (l.has(r)) return;
|
|
2897
3028
|
let i = f(e, n, "masonry", null);
|
|
2898
3029
|
i && (l.add(r), t.visible(i));
|
|
2899
3030
|
}
|
|
2900
3031
|
function b(e, r, i, a) {
|
|
2901
|
-
let o = [i,
|
|
3032
|
+
let o = [i, J(e, r)].join(":");
|
|
2902
3033
|
if (n.has(o)) return;
|
|
2903
3034
|
let s = f(e, r, i, a);
|
|
2904
3035
|
s && (n.add(o), t.fullyVisible(s));
|
|
@@ -2906,13 +3037,13 @@ function Kn(e, t) {
|
|
|
2906
3037
|
function x(e, t) {
|
|
2907
3038
|
b(e, t, "masonry", null);
|
|
2908
3039
|
}
|
|
2909
|
-
return
|
|
3040
|
+
return Zn(e, t.reelChange), P(() => {
|
|
2910
3041
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null, n = t === null ? 0 : e.mediaIndices.get(t) ?? 0;
|
|
2911
3042
|
return {
|
|
2912
3043
|
mediaIndex: n,
|
|
2913
3044
|
origin: e.reelOrigin ?? "reel",
|
|
2914
3045
|
postId: t,
|
|
2915
|
-
ready: t !== null && c.value.get(
|
|
3046
|
+
ready: t !== null && c.value.get(J(t, n)) === "ready"
|
|
2916
3047
|
};
|
|
2917
3048
|
}, (e, t) => {
|
|
2918
3049
|
e.postId === null || !e.ready || t?.ready && t.postId === e.postId && t.mediaIndex === e.mediaIndex && t.origin === e.origin || b(e.postId, e.mediaIndex, "reel", e.origin);
|
|
@@ -2932,16 +3063,16 @@ function Kn(e, t) {
|
|
|
2932
3063
|
}
|
|
2933
3064
|
//#endregion
|
|
2934
3065
|
//#region src/core/reelEscapeStack.ts
|
|
2935
|
-
var
|
|
2936
|
-
function
|
|
2937
|
-
return
|
|
2938
|
-
let t =
|
|
2939
|
-
t >= 0 &&
|
|
3066
|
+
var er = [];
|
|
3067
|
+
function tr(e) {
|
|
3068
|
+
return er.push(e), () => {
|
|
3069
|
+
let t = er.indexOf(e);
|
|
3070
|
+
t >= 0 && er.splice(t, 1);
|
|
2940
3071
|
};
|
|
2941
3072
|
}
|
|
2942
|
-
function
|
|
3073
|
+
function nr(e) {
|
|
2943
3074
|
if (!e.isActive()) return !1;
|
|
2944
|
-
let t =
|
|
3075
|
+
let t = er.filter((e) => e.isActive()), n = e.element();
|
|
2945
3076
|
return n !== null && t.some((t) => {
|
|
2946
3077
|
if (t === e) return !1;
|
|
2947
3078
|
let r = t.element();
|
|
@@ -2957,14 +3088,14 @@ function Yn(e) {
|
|
|
2957
3088
|
}
|
|
2958
3089
|
//#endregion
|
|
2959
3090
|
//#region src/components/useReelKeyboard.ts
|
|
2960
|
-
function
|
|
3091
|
+
function rr(e) {
|
|
2961
3092
|
let t = {
|
|
2962
3093
|
element: e.element,
|
|
2963
3094
|
isActive: () => e.state.layout === "reel" || e.state.reelOrigin === "masonry"
|
|
2964
3095
|
}, n = null;
|
|
2965
3096
|
function r(n) {
|
|
2966
3097
|
let r = t.isActive();
|
|
2967
|
-
if (n.key === "Escape" && r && !
|
|
3098
|
+
if (n.key === "Escape" && r && !nr(t)) return;
|
|
2968
3099
|
if (n.key === "Escape" && e.state.reelOrigin === "masonry") {
|
|
2969
3100
|
n.preventDefault(), e.state.reelInfoSheetOverlay && e.state.reelInfoSheet.enabled && e.setReelInfoSheet(!1), e.closeMasonryReel();
|
|
2970
3101
|
return;
|
|
@@ -2984,14 +3115,14 @@ function Xn(e) {
|
|
|
2984
3115
|
a !== 0 && e.reelRenderer()?.changeActiveMedia?.(a) && n.preventDefault();
|
|
2985
3116
|
}
|
|
2986
3117
|
C(() => {
|
|
2987
|
-
n =
|
|
3118
|
+
n = tr(t), window.addEventListener("keydown", r);
|
|
2988
3119
|
}), S(() => {
|
|
2989
3120
|
window.removeEventListener("keydown", r), n?.(), n = null;
|
|
2990
3121
|
});
|
|
2991
3122
|
}
|
|
2992
3123
|
//#endregion
|
|
2993
3124
|
//#region src/components/VibeSurface.vue?vue&type=script&setup=true&lang.ts
|
|
2994
|
-
var
|
|
3125
|
+
var ir = 35, ar = 420, or = /* @__PURE__ */ d({
|
|
2995
3126
|
__name: "VibeSurface",
|
|
2996
3127
|
props: {
|
|
2997
3128
|
canRetryEnd: { type: Boolean },
|
|
@@ -3021,63 +3152,63 @@ var Zn = 35, Qn = 420, $n = /* @__PURE__ */ d({
|
|
|
3021
3152
|
"retryForward"
|
|
3022
3153
|
],
|
|
3023
3154
|
setup(t, { expose: i, emit: c }) {
|
|
3024
|
-
let l = t, d = c, f = k(null), p = k(null), m = k(null), h = k(null), g = k(!1), _ = k(/* @__PURE__ */ new Set()), y = k(/* @__PURE__ */ new Map()), b = k(/* @__PURE__ */ new Set()), x = k(/* @__PURE__ */ new Map()), C = r(() =>
|
|
3155
|
+
let l = t, d = c, f = k(null), p = k(null), m = k(null), h = k(null), g = k(!1), _ = k(/* @__PURE__ */ new Set()), y = k(/* @__PURE__ */ new Map()), b = k(/* @__PURE__ */ new Set()), x = k(/* @__PURE__ */ new Map()), C = r(() => ie(l.state).value), T = r(() => oe(l.state, C.value)), { markMediaError: E, markMasonryFullyVisible: D, markMasonryVisible: O, markPreviewError: A, markPreviewReady: j, markReelError: N, markReelReady: I, originalStates: L, previewStates: R, reelStates: z, resetMediaLifecycle: B } = $n(l.state, {
|
|
3025
3156
|
error: (e) => d("mediaError", e),
|
|
3026
3157
|
fullyVisible: (e) => d("mediaFullyVisible", e),
|
|
3027
3158
|
ready: (e) => d("mediaReady", e),
|
|
3028
3159
|
reelChange: (e) => d("reelMediaChange", e),
|
|
3029
3160
|
visible: (e) => d("mediaVisible", e)
|
|
3030
|
-
}),
|
|
3031
|
-
function
|
|
3161
|
+
}), V = new Set(Z(l.state.items)), H = null, U = null, W = !1;
|
|
3162
|
+
function ee() {
|
|
3032
3163
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
3033
3164
|
}
|
|
3034
|
-
function
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3165
|
+
function G() {
|
|
3166
|
+
H !== null && cancelAnimationFrame(H), H = requestAnimationFrame(() => {
|
|
3167
|
+
H = requestAnimationFrame(() => {
|
|
3168
|
+
H = null, _.value = /* @__PURE__ */ new Set();
|
|
3038
3169
|
});
|
|
3039
3170
|
});
|
|
3040
3171
|
}
|
|
3041
|
-
function
|
|
3172
|
+
function te(e, t) {
|
|
3042
3173
|
let n = l.state.items.find((t) => t.postId === e);
|
|
3043
3174
|
if (!n) return;
|
|
3044
|
-
let r =
|
|
3175
|
+
let r = q(n, t);
|
|
3045
3176
|
(l.state.mediaIndices.get(e) ?? 0) !== r && (l.state.mediaIndices = new Map(l.state.mediaIndices).set(e, r));
|
|
3046
3177
|
}
|
|
3047
|
-
async function
|
|
3178
|
+
async function ne() {
|
|
3048
3179
|
await v(), (l.state.layout === "reel" || l.state.reelOrigin === "masonry" ? p.value : f.value)?.loadIfNearBottom();
|
|
3049
3180
|
}
|
|
3050
|
-
function
|
|
3181
|
+
function J(e) {
|
|
3051
3182
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.changeActiveMedia?.(e) ?? !1;
|
|
3052
3183
|
}
|
|
3053
|
-
function
|
|
3184
|
+
function Y(e) {
|
|
3054
3185
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.moveActivePost?.(e) ?? !1;
|
|
3055
3186
|
}
|
|
3056
|
-
function
|
|
3187
|
+
function X(e) {
|
|
3057
3188
|
if (!(l.state.layout === "reel" || l.state.reelOrigin === "masonry") || l.state.isLoading) return "reel-inactive";
|
|
3058
3189
|
let t = l.state.items.find((t) => t.postId === e.postId);
|
|
3059
3190
|
if (!t) return "not-found";
|
|
3060
|
-
let n =
|
|
3191
|
+
let n = K(t).findIndex((t) => t.mediaId === e.mediaId);
|
|
3061
3192
|
return n < 0 ? "not-found" : p.value?.navigateToItem?.(e.postId, n) ? "navigated" : "reel-inactive";
|
|
3062
3193
|
}
|
|
3063
|
-
function
|
|
3194
|
+
function re() {
|
|
3064
3195
|
return l.state.layout !== "masonry" || l.state.reelOrigin === "masonry" ? null : f.value?.getScrollElement?.() ?? null;
|
|
3065
3196
|
}
|
|
3066
|
-
function
|
|
3067
|
-
|
|
3197
|
+
function ae(e, t) {
|
|
3198
|
+
U = e, W = t === "keyboard", d("openReel", e), v(() => m.value?.focus());
|
|
3068
3199
|
}
|
|
3069
|
-
function
|
|
3200
|
+
function se(e) {
|
|
3070
3201
|
let t = h.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [];
|
|
3071
3202
|
return Array.from(t).find((t) => t.dataset.postId === String(e)) ?? null;
|
|
3072
3203
|
}
|
|
3073
3204
|
function Q(e, t) {
|
|
3074
|
-
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null ||
|
|
3205
|
+
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || ee()) return 0;
|
|
3075
3206
|
let n = [...new Set(e)], r = new Set(Array.from(h.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [], (e) => e.dataset.postId)), i = n.filter((e) => r.has(String(e)));
|
|
3076
3207
|
if (i.length === 0) return 0;
|
|
3077
|
-
let a = new Map(x.value), o = t?.staggerMs ??
|
|
3208
|
+
let a = new Map(x.value), o = t?.staggerMs ?? ir;
|
|
3078
3209
|
return i.forEach((e, t) => {
|
|
3079
3210
|
a.set(e, t * o);
|
|
3080
|
-
}), _.value = new Set([..._.value].filter((e) => !i.includes(e))), b.value = new Set([...b.value, ...n]), x.value = a,
|
|
3211
|
+
}), _.value = new Set([..._.value].filter((e) => !i.includes(e))), b.value = new Set([...b.value, ...n]), x.value = a, ar + (i.length - 1) * o;
|
|
3081
3212
|
}
|
|
3082
3213
|
function ce() {
|
|
3083
3214
|
b.value = /* @__PURE__ */ new Set(), x.value = /* @__PURE__ */ new Map();
|
|
@@ -3093,21 +3224,21 @@ var Zn = 35, Qn = 420, $n = /* @__PURE__ */ d({
|
|
|
3093
3224
|
});
|
|
3094
3225
|
}
|
|
3095
3226
|
function ue(e, t) {
|
|
3096
|
-
let n =
|
|
3227
|
+
let n = se(e), r = n?.querySelector(".media-card-activator") ?? n;
|
|
3097
3228
|
r && (r.classList.toggle("media-card-focus-silent", !t), t || r.addEventListener("blur", () => {
|
|
3098
3229
|
r.classList.remove("media-card-focus-silent");
|
|
3099
3230
|
}, { once: !0 }), r?.focus({ preventScroll: !0 }));
|
|
3100
3231
|
}
|
|
3101
3232
|
function de() {
|
|
3102
|
-
l.state.reelOrigin === "masonry" && (
|
|
3233
|
+
l.state.reelOrigin === "masonry" && (U ??= l.state.activeReelPostId, g.value = !0, d("closeReel"));
|
|
3103
3234
|
}
|
|
3104
3235
|
function fe() {
|
|
3105
|
-
let e =
|
|
3106
|
-
g.value = !1,
|
|
3236
|
+
let e = U, t = W;
|
|
3237
|
+
g.value = !1, U = null, W = !1, v(() => {
|
|
3107
3238
|
e !== null && ue(e, t);
|
|
3108
3239
|
});
|
|
3109
3240
|
}
|
|
3110
|
-
return
|
|
3241
|
+
return rr({
|
|
3111
3242
|
closeMasonryReel: de,
|
|
3112
3243
|
element: () => h.value,
|
|
3113
3244
|
isReelLeaving: () => g.value,
|
|
@@ -3118,25 +3249,25 @@ var Zn = 35, Qn = 420, $n = /* @__PURE__ */ d({
|
|
|
3118
3249
|
let e = l.state.items;
|
|
3119
3250
|
return [e, e.length];
|
|
3120
3251
|
}, ([e]) => {
|
|
3121
|
-
let t =
|
|
3122
|
-
if (
|
|
3252
|
+
let t = Z(e), n = t.filter((e) => !V.has(e)), r = new Set(t);
|
|
3253
|
+
if (V = r, b.value = new Set([...b.value].filter((e) => r.has(e))), x.value = new Map([...x.value].filter(([e]) => r.has(e))), n.length === 0 || ee()) return;
|
|
3123
3254
|
let i = /* @__PURE__ */ new Map();
|
|
3124
3255
|
t.forEach((e) => {
|
|
3125
3256
|
let t = y.value.get(e);
|
|
3126
3257
|
t !== void 0 && i.set(e, t);
|
|
3127
3258
|
}), n.forEach((e, t) => {
|
|
3128
|
-
i.set(e, t *
|
|
3129
|
-
}), y.value = i, _.value = new Set([..._.value, ...n]),
|
|
3259
|
+
i.set(e, t * ir);
|
|
3260
|
+
}), y.value = i, _.value = new Set([..._.value, ...n]), G();
|
|
3130
3261
|
}, { flush: "sync" }), S(() => {
|
|
3131
|
-
|
|
3262
|
+
H !== null && cancelAnimationFrame(H);
|
|
3132
3263
|
}), i({
|
|
3133
3264
|
animateItemRemoval: le,
|
|
3134
3265
|
cancelItemRemoval: ce,
|
|
3135
|
-
changeActiveReelMedia:
|
|
3136
|
-
getAutoScrollElement:
|
|
3137
|
-
loadIfNearBottom:
|
|
3138
|
-
moveActiveReelPost:
|
|
3139
|
-
navigateToReelItem:
|
|
3266
|
+
changeActiveReelMedia: J,
|
|
3267
|
+
getAutoScrollElement: re,
|
|
3268
|
+
loadIfNearBottom: ne,
|
|
3269
|
+
moveActiveReelPost: Y,
|
|
3270
|
+
navigateToReelItem: X,
|
|
3140
3271
|
resetMediaLifecycle: B,
|
|
3141
3272
|
startItemRemoval: Q,
|
|
3142
3273
|
transitionActiveReelMedia: (e) => p.value?.transitionActiveMedia?.(e) ?? Promise.resolve(!1),
|
|
@@ -3181,7 +3312,7 @@ var Zn = 35, Qn = 420, $n = /* @__PURE__ */ d({
|
|
|
3181
3312
|
onError: M(N),
|
|
3182
3313
|
onMediaError: i[2] ||= (e, t) => M(E)(e, t, "reel"),
|
|
3183
3314
|
onLoadMore: i[3] ||= (e) => d("loadMore"),
|
|
3184
|
-
onMediaChange:
|
|
3315
|
+
onMediaChange: te,
|
|
3185
3316
|
onReady: M(I),
|
|
3186
3317
|
onRetryEnd: i[4] ||= (e) => d("retryEnd"),
|
|
3187
3318
|
onRetryForward: i[5] ||= (e) => d("retryForward"),
|
|
@@ -3224,12 +3355,12 @@ var Zn = 35, Qn = 420, $n = /* @__PURE__ */ d({
|
|
|
3224
3355
|
suspended: t.state.reelOrigin === "masonry" || g.value,
|
|
3225
3356
|
state: T.value,
|
|
3226
3357
|
total: t.state.total,
|
|
3227
|
-
onActivate:
|
|
3358
|
+
onActivate: ae,
|
|
3228
3359
|
onError: M(A),
|
|
3229
3360
|
onMediaError: i[9] ||= (e, t) => M(E)(e, t, "masonry"),
|
|
3230
3361
|
onFullyVisible: M(D),
|
|
3231
3362
|
onLoadMore: i[10] ||= (e) => d("loadMore"),
|
|
3232
|
-
onMediaChange:
|
|
3363
|
+
onMediaChange: te,
|
|
3233
3364
|
onReady: M(j),
|
|
3234
3365
|
onRetryEnd: i[11] ||= (e) => d("retryEnd"),
|
|
3235
3366
|
onVisible: M(O)
|
|
@@ -3281,7 +3412,7 @@ var Zn = 35, Qn = 420, $n = /* @__PURE__ */ d({
|
|
|
3281
3412
|
onError: M(N),
|
|
3282
3413
|
onMediaError: i[14] ||= (e, t) => M(E)(e, t, "reel"),
|
|
3283
3414
|
onLoadMore: i[15] ||= (e) => d("loadMore"),
|
|
3284
|
-
onMediaChange:
|
|
3415
|
+
onMediaChange: te,
|
|
3285
3416
|
onReady: M(I),
|
|
3286
3417
|
onRetryEnd: i[16] ||= (e) => d("retryEnd"),
|
|
3287
3418
|
onRetryForward: i[17] ||= (e) => d("retryForward"),
|
|
@@ -3293,41 +3424,41 @@ var Zn = 35, Qn = 420, $n = /* @__PURE__ */ d({
|
|
|
3293
3424
|
});
|
|
3294
3425
|
//#endregion
|
|
3295
3426
|
//#region src/core/page.ts
|
|
3296
|
-
function
|
|
3427
|
+
function sr(e) {
|
|
3297
3428
|
if (!e || typeof e != "object" || !Array.isArray(e.items)) throw TypeError("Vibe loadPage must resolve to a page with an items array.");
|
|
3298
3429
|
if (e.current !== void 0 && e.current !== null && typeof e.current != "string" && typeof e.current != "number") throw TypeError("Vibe page current must be a string, number, null, or undefined.");
|
|
3299
3430
|
if (e.next !== null && typeof e.next != "string" && typeof e.next != "number") throw TypeError("Vibe page next must be a string, number, or null.");
|
|
3300
3431
|
if (e.total !== void 0 && (!Number.isFinite(e.total) || e.total < 0)) throw TypeError("Vibe page total must be a non-negative number when provided.");
|
|
3301
3432
|
return e;
|
|
3302
3433
|
}
|
|
3303
|
-
function
|
|
3304
|
-
let n = new Set(
|
|
3305
|
-
return [...e, ...
|
|
3434
|
+
function cr(e, t) {
|
|
3435
|
+
let n = new Set(Z(e));
|
|
3436
|
+
return [...e, ...lr(n, t)];
|
|
3306
3437
|
}
|
|
3307
|
-
function
|
|
3438
|
+
function lr(e, t) {
|
|
3308
3439
|
return t.filter((t) => e.has(t.postId) ? !1 : (e.add(t.postId), !0));
|
|
3309
3440
|
}
|
|
3310
|
-
function
|
|
3441
|
+
function ur(e, t) {
|
|
3311
3442
|
if (t.length === 0) return e;
|
|
3312
|
-
let n =
|
|
3443
|
+
let n = lr(new Set(Z(e)), t);
|
|
3313
3444
|
return n.length > 0 ? [...e, ...n] : e;
|
|
3314
3445
|
}
|
|
3315
|
-
function
|
|
3446
|
+
function dr(e) {
|
|
3316
3447
|
return `${typeof e}:${String(e)}`;
|
|
3317
3448
|
}
|
|
3318
|
-
function
|
|
3319
|
-
return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview?.src ?? ""}` : `id:${
|
|
3449
|
+
function fr(e) {
|
|
3450
|
+
return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview?.src ?? ""}` : `id:${dr(e.mediaId)}`;
|
|
3320
3451
|
}
|
|
3321
|
-
function
|
|
3322
|
-
let n = [...e], r = new Map(
|
|
3452
|
+
function pr(e, t) {
|
|
3453
|
+
let n = [...e], r = new Map(Z(e).map((e, t) => [dr(e), t]));
|
|
3323
3454
|
return t.forEach((e) => {
|
|
3324
|
-
let t =
|
|
3455
|
+
let t = dr(e.postId), i = r.get(t);
|
|
3325
3456
|
if (i === void 0) {
|
|
3326
3457
|
r.set(t, n.length), n.push(e);
|
|
3327
3458
|
return;
|
|
3328
3459
|
}
|
|
3329
|
-
let a = n[i], o = new Set([a, ...a.items].map(
|
|
3330
|
-
let t =
|
|
3460
|
+
let a = n[i], o = new Set([a, ...a.items].map(fr)), s = [e, ...e.items].filter((e) => {
|
|
3461
|
+
let t = fr(e);
|
|
3331
3462
|
return o.has(t) ? !1 : (o.add(t), !0);
|
|
3332
3463
|
});
|
|
3333
3464
|
s.length > 0 && (n[i] = {
|
|
@@ -3336,14 +3467,14 @@ function or(e, t) {
|
|
|
3336
3467
|
});
|
|
3337
3468
|
}), n;
|
|
3338
3469
|
}
|
|
3339
|
-
function
|
|
3470
|
+
function mr(e) {
|
|
3340
3471
|
return Object.prototype.hasOwnProperty.call(e, "current") ? e.current ?? null : e.next;
|
|
3341
3472
|
}
|
|
3342
3473
|
//#endregion
|
|
3343
3474
|
//#region src/core/appendPage.ts
|
|
3344
|
-
function
|
|
3345
|
-
let i =
|
|
3346
|
-
t.items =
|
|
3475
|
+
function hr(e, t, n, r) {
|
|
3476
|
+
let i = sr(e), a = n.filterItems(i.items), o = mr(i);
|
|
3477
|
+
t.items = pr(t.items, a), t.next = i.next, i.total !== void 0 && (t.total = i.total), r(o), n.recordPages([{
|
|
3347
3478
|
contributionIds: a.map(({ postId: e }) => e),
|
|
3348
3479
|
cursor: o,
|
|
3349
3480
|
next: i.next,
|
|
@@ -3352,32 +3483,32 @@ function cr(e, t, n, r) {
|
|
|
3352
3483
|
}
|
|
3353
3484
|
//#endregion
|
|
3354
3485
|
//#region src/core/requestDelay.ts
|
|
3355
|
-
var
|
|
3486
|
+
var gr = 2e3, _r = 1e4, vr = 250, yr = {
|
|
3356
3487
|
delayRemainingMs: null,
|
|
3357
3488
|
nextRequestAt: null
|
|
3358
3489
|
};
|
|
3359
|
-
function
|
|
3490
|
+
function br(e, t) {
|
|
3360
3491
|
return e === void 0 ? t : Math.floor(e);
|
|
3361
3492
|
}
|
|
3362
|
-
function
|
|
3493
|
+
function xr(e, t) {
|
|
3363
3494
|
for (let [n, r] of [["delayStepMs", e.delayStepMs], ["delayMaxMs", e.delayMaxMs]]) if (r !== void 0 && (!Number.isFinite(r) || r < 0)) throw TypeError(`Vibe ${t} ${n} must be a non-negative number.`);
|
|
3364
3495
|
}
|
|
3365
|
-
function
|
|
3366
|
-
let n =
|
|
3496
|
+
function Sr(e, t = {}) {
|
|
3497
|
+
let n = br(t.delayStepMs, gr), r = br(t.delayMaxMs, _r);
|
|
3367
3498
|
return Math.min(Math.max(0, e) * n, r);
|
|
3368
3499
|
}
|
|
3369
|
-
function
|
|
3370
|
-
if (e == null || !Number.isFinite(e)) return { ...
|
|
3500
|
+
function Cr(e) {
|
|
3501
|
+
if (e == null || !Number.isFinite(e)) return { ...yr };
|
|
3371
3502
|
let t = Math.max(0, Math.floor(e - Date.now()));
|
|
3372
3503
|
return t > 0 ? {
|
|
3373
3504
|
delayRemainingMs: t,
|
|
3374
3505
|
nextRequestAt: e
|
|
3375
|
-
} : { ...
|
|
3506
|
+
} : { ...yr };
|
|
3376
3507
|
}
|
|
3377
|
-
async function
|
|
3508
|
+
async function wr({ delayMs: e, onChange: t, signal: n }) {
|
|
3378
3509
|
if (n.aborted) throw new DOMException("Aborted", "AbortError");
|
|
3379
3510
|
if (e <= 0) {
|
|
3380
|
-
t({ ...
|
|
3511
|
+
t({ ...yr });
|
|
3381
3512
|
return;
|
|
3382
3513
|
}
|
|
3383
3514
|
let r = Date.now() + e;
|
|
@@ -3385,9 +3516,9 @@ async function _r({ delayMs: e, onChange: t, signal: n }) {
|
|
|
3385
3516
|
delayRemainingMs: e,
|
|
3386
3517
|
nextRequestAt: r
|
|
3387
3518
|
}), await new Promise((i, a) => {
|
|
3388
|
-
let o = !1, s = setInterval(f,
|
|
3519
|
+
let o = !1, s = setInterval(f, vr), c = setTimeout(() => u(), e);
|
|
3389
3520
|
function l() {
|
|
3390
|
-
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...
|
|
3521
|
+
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...yr });
|
|
3391
3522
|
}
|
|
3392
3523
|
function u(e) {
|
|
3393
3524
|
o || (o = !0, l(), e ? a(e) : i());
|
|
@@ -3396,42 +3527,42 @@ async function _r({ delayMs: e, onChange: t, signal: n }) {
|
|
|
3396
3527
|
u(new DOMException("Aborted", "AbortError"));
|
|
3397
3528
|
}
|
|
3398
3529
|
function f() {
|
|
3399
|
-
let e =
|
|
3530
|
+
let e = Cr(r);
|
|
3400
3531
|
t(e), e.delayRemainingMs === null && u();
|
|
3401
3532
|
}
|
|
3402
3533
|
n.addEventListener("abort", d, { once: !0 });
|
|
3403
3534
|
});
|
|
3404
3535
|
}
|
|
3405
|
-
var
|
|
3536
|
+
var Tr = class {
|
|
3406
3537
|
interval = null;
|
|
3407
3538
|
constructor(e) {
|
|
3408
3539
|
this.onChange = e;
|
|
3409
3540
|
}
|
|
3410
3541
|
clear() {
|
|
3411
|
-
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...
|
|
3542
|
+
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...yr });
|
|
3412
3543
|
}
|
|
3413
3544
|
sync(e) {
|
|
3414
3545
|
this.clear();
|
|
3415
|
-
let t =
|
|
3546
|
+
let t = Cr(e);
|
|
3416
3547
|
this.onChange(t), t.delayRemainingMs !== null && (this.interval = setInterval(() => {
|
|
3417
|
-
let t =
|
|
3548
|
+
let t = Cr(e);
|
|
3418
3549
|
this.onChange(t), t.delayRemainingMs === null && this.clear();
|
|
3419
|
-
},
|
|
3550
|
+
}, vr));
|
|
3420
3551
|
}
|
|
3421
3552
|
};
|
|
3422
|
-
function
|
|
3553
|
+
function Er(e, t = !0) {
|
|
3423
3554
|
return e.maxAdditionalPages === "unlimited" ? Infinity : (e.maxAdditionalPages ?? 10) + (t ? 1 : 0);
|
|
3424
3555
|
}
|
|
3425
|
-
function
|
|
3556
|
+
function Dr(e) {
|
|
3426
3557
|
return `${typeof e}:${String(e)}`;
|
|
3427
3558
|
}
|
|
3428
|
-
function
|
|
3559
|
+
function Or(e, t) {
|
|
3429
3560
|
if (!Number.isInteger(e) || e <= 0) throw TypeError(`Vibe ${t} must be a positive integer.`);
|
|
3430
3561
|
}
|
|
3431
|
-
function
|
|
3562
|
+
function kr(e) {
|
|
3432
3563
|
if (!e) return;
|
|
3433
|
-
if (
|
|
3434
|
-
|
|
3564
|
+
if (Or(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
|
|
3565
|
+
xr(e, "frontend autofill");
|
|
3435
3566
|
let t = e.maxAdditionalPages;
|
|
3436
3567
|
if (t !== void 0 && t !== "unlimited" && (!Number.isInteger(t) || t < 0)) throw TypeError("Vibe autofill maxAdditionalPages must be a non-negative integer or \"unlimited\".");
|
|
3437
3568
|
return;
|
|
@@ -3443,7 +3574,7 @@ function Sr(e) {
|
|
|
3443
3574
|
if (t.pageSize !== e.pageSize) throw TypeError("Vibe backend autofill initialSession pageSize must match autofill pageSize.");
|
|
3444
3575
|
}
|
|
3445
3576
|
}
|
|
3446
|
-
function
|
|
3577
|
+
function Ar(e, t, n = !0) {
|
|
3447
3578
|
if (!e) return {
|
|
3448
3579
|
cycleId: null,
|
|
3449
3580
|
delayRemainingMs: null,
|
|
@@ -3460,7 +3591,7 @@ function Cr(e, t, n = !0) {
|
|
|
3460
3591
|
status: "idle",
|
|
3461
3592
|
strategy: null
|
|
3462
3593
|
};
|
|
3463
|
-
let r = e.strategy === "backend" ? t ?? (n ? e.initialSession : void 0) : void 0, i = r?.received ?? 0, a =
|
|
3594
|
+
let r = e.strategy === "backend" ? t ?? (n ? e.initialSession : void 0) : void 0, i = r?.received ?? 0, a = Cr(r?.nextRequestAt);
|
|
3464
3595
|
return {
|
|
3465
3596
|
cycleId: r?.cycleId ?? null,
|
|
3466
3597
|
...a,
|
|
@@ -3477,7 +3608,7 @@ function Cr(e, t, n = !0) {
|
|
|
3477
3608
|
strategy: e.strategy
|
|
3478
3609
|
};
|
|
3479
3610
|
}
|
|
3480
|
-
function
|
|
3611
|
+
function jr(e) {
|
|
3481
3612
|
return [
|
|
3482
3613
|
"cancelling",
|
|
3483
3614
|
"filling",
|
|
@@ -3485,9 +3616,9 @@ function wr(e) {
|
|
|
3485
3616
|
"waiting"
|
|
3486
3617
|
].includes(e.status);
|
|
3487
3618
|
}
|
|
3488
|
-
async function
|
|
3619
|
+
async function Mr(e, t, n) {
|
|
3489
3620
|
let r = t.autofill;
|
|
3490
|
-
if (!
|
|
3621
|
+
if (!jr(r) || !r.cycleId) return;
|
|
3491
3622
|
let i = {
|
|
3492
3623
|
cycleId: r.cycleId,
|
|
3493
3624
|
feedKey: r.feedKey ?? "",
|
|
@@ -3500,16 +3631,16 @@ async function Tr(e, t, n) {
|
|
|
3500
3631
|
throw r.error = e, r.status = "error", e;
|
|
3501
3632
|
}
|
|
3502
3633
|
}
|
|
3503
|
-
function
|
|
3634
|
+
function Nr(e, t, n) {
|
|
3504
3635
|
return e?.strategy === "backend" && t.feedKey === e.feedKey && t.sessionId === n.sessionId;
|
|
3505
3636
|
}
|
|
3506
|
-
async function
|
|
3507
|
-
let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ??
|
|
3637
|
+
async function Pr({ existingItems: e, initialCursor: t, loadPage: n, maximumRequests: r, onCollection: i, onDelayChange: a, onProgress: o, options: s, receivedOffset: c = 0, requestOffset: l = 0, shouldPause: u = () => !1, signal: d }) {
|
|
3638
|
+
let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ?? Er(s), g = t, _ = t, v = t, y = 0, b = [], x;
|
|
3508
3639
|
for (; y < h;) {
|
|
3509
|
-
let e =
|
|
3640
|
+
let e = Dr(g);
|
|
3510
3641
|
if (m.has(e)) throw Error("Vibe autofill received a repeated cursor.");
|
|
3511
|
-
if (m.add(e), await
|
|
3512
|
-
delayMs:
|
|
3642
|
+
if (m.add(e), await wr({
|
|
3643
|
+
delayMs: Sr(l + y, s),
|
|
3513
3644
|
onChange: a,
|
|
3514
3645
|
signal: d
|
|
3515
3646
|
}), y > 0 && u()) return {
|
|
@@ -3523,12 +3654,12 @@ async function Dr({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
3523
3654
|
status: "paused",
|
|
3524
3655
|
total: x
|
|
3525
3656
|
};
|
|
3526
|
-
let t =
|
|
3657
|
+
let t = sr(await n({
|
|
3527
3658
|
cursor: g,
|
|
3528
3659
|
signal: d
|
|
3529
3660
|
}));
|
|
3530
3661
|
y += 1, _ = g;
|
|
3531
|
-
let r =
|
|
3662
|
+
let r = cr(p, t.items).slice(p.length);
|
|
3532
3663
|
b.push({
|
|
3533
3664
|
contributionIds: r.map(({ postId: e }) => e),
|
|
3534
3665
|
cursor: g,
|
|
@@ -3580,12 +3711,12 @@ async function Dr({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
3580
3711
|
}
|
|
3581
3712
|
//#endregion
|
|
3582
3713
|
//#region src/core/autofillController.ts
|
|
3583
|
-
var
|
|
3714
|
+
var Fr = class {
|
|
3584
3715
|
collection = null;
|
|
3585
3716
|
cycle = 0;
|
|
3586
3717
|
delayCountdown;
|
|
3587
3718
|
constructor(e) {
|
|
3588
|
-
this.context = e, this.delayCountdown = new
|
|
3719
|
+
this.context = e, this.delayCountdown = new Tr((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
|
|
3589
3720
|
}
|
|
3590
3721
|
beginCycle() {
|
|
3591
3722
|
let { options: e, state: t } = this.context;
|
|
@@ -3593,14 +3724,14 @@ var Or = class {
|
|
|
3593
3724
|
this.clear();
|
|
3594
3725
|
let n = `vibe-autofill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
3595
3726
|
return t.autofill = {
|
|
3596
|
-
...
|
|
3727
|
+
...Ar(e, void 0, !1),
|
|
3597
3728
|
cycleId: n,
|
|
3598
3729
|
status: "filling"
|
|
3599
3730
|
}, n;
|
|
3600
3731
|
}
|
|
3601
3732
|
async cancel() {
|
|
3602
3733
|
let { cancelRequest: e, options: t, state: n } = this.context;
|
|
3603
|
-
await
|
|
3734
|
+
await Mr(t, n, e), this.commitCollection();
|
|
3604
3735
|
}
|
|
3605
3736
|
captureCollection(e, t) {
|
|
3606
3737
|
t && (this.collection = e);
|
|
@@ -3622,36 +3753,36 @@ var Or = class {
|
|
|
3622
3753
|
let { onLastCursor: e, options: t, state: n } = this.context;
|
|
3623
3754
|
if (t?.strategy !== "frontend") return !1;
|
|
3624
3755
|
let r = this.collection;
|
|
3625
|
-
return this.collection = null, r ? (n.items =
|
|
3756
|
+
return this.collection = null, r ? (n.items = cr(n.items, r.items), e(r.lastCursor), this.context.onPages(r.pages), n.next = r.next, r.total !== void 0 && (n.total = r.total), Object.assign(n.autofill, {
|
|
3626
3757
|
missing: r.missing,
|
|
3627
3758
|
received: r.received,
|
|
3628
3759
|
requests: r.requests
|
|
3629
3760
|
}), !0) : !1;
|
|
3630
3761
|
}
|
|
3631
|
-
},
|
|
3632
|
-
function
|
|
3762
|
+
}, Ir = 100;
|
|
3763
|
+
function Lr(e, t) {
|
|
3633
3764
|
if (!Number.isFinite(t) || t <= 0) throw TypeError(`Vibe ${e} must be a positive number.`);
|
|
3634
3765
|
}
|
|
3635
|
-
function
|
|
3766
|
+
function Rr(e, t, n) {
|
|
3636
3767
|
return Math.min(n, Math.max(t, e));
|
|
3637
3768
|
}
|
|
3638
|
-
function
|
|
3769
|
+
function zr(e) {
|
|
3639
3770
|
if (!e) return;
|
|
3640
3771
|
let t = e.minSpeedPxPerSecond ?? 20, n = e.maxSpeedPxPerSecond ?? 240;
|
|
3641
|
-
if (
|
|
3642
|
-
e.speedPxPerSecond !== void 0 &&
|
|
3772
|
+
if (Lr("autoScroll.minSpeedPxPerSecond", t), Lr("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
|
|
3773
|
+
e.speedPxPerSecond !== void 0 && Lr("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
|
|
3643
3774
|
}
|
|
3644
|
-
function
|
|
3775
|
+
function Br(e) {
|
|
3645
3776
|
let t = e?.minSpeedPxPerSecond ?? 20, n = e?.maxSpeedPxPerSecond ?? 240;
|
|
3646
3777
|
return {
|
|
3647
3778
|
enabled: e?.enabled ?? !1,
|
|
3648
3779
|
maxSpeedPxPerSecond: n,
|
|
3649
3780
|
minSpeedPxPerSecond: t,
|
|
3650
3781
|
paused: !1,
|
|
3651
|
-
speedPxPerSecond:
|
|
3782
|
+
speedPxPerSecond: Rr(e?.speedPxPerSecond ?? 80, t, n)
|
|
3652
3783
|
};
|
|
3653
3784
|
}
|
|
3654
|
-
var
|
|
3785
|
+
var Vr = class {
|
|
3655
3786
|
frame = null;
|
|
3656
3787
|
lastTimestamp = null;
|
|
3657
3788
|
mounted = !1;
|
|
@@ -3671,9 +3802,9 @@ var Pr = class {
|
|
|
3671
3802
|
this.options.state.enabled && (this.options.state.paused = e, this.lastTimestamp = null, e ? this.cancelFrame() : this.schedule());
|
|
3672
3803
|
}
|
|
3673
3804
|
setSpeed(e) {
|
|
3674
|
-
|
|
3805
|
+
Lr("auto-scroll speed", e);
|
|
3675
3806
|
let t = this.options.state;
|
|
3676
|
-
t.speedPxPerSecond =
|
|
3807
|
+
t.speedPxPerSecond = Rr(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
|
|
3677
3808
|
}
|
|
3678
3809
|
tick = (e) => {
|
|
3679
3810
|
this.frame = null;
|
|
@@ -3685,7 +3816,7 @@ var Pr = class {
|
|
|
3685
3816
|
return;
|
|
3686
3817
|
}
|
|
3687
3818
|
if (this.lastTimestamp !== null) {
|
|
3688
|
-
let r = Math.min(
|
|
3819
|
+
let r = Math.min(Ir, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
|
|
3689
3820
|
n.scrollTop = Math.min(i, n.scrollTop + t.speedPxPerSecond * r / 1e3);
|
|
3690
3821
|
}
|
|
3691
3822
|
this.lastTimestamp = e, this.schedule();
|
|
@@ -3699,13 +3830,13 @@ var Pr = class {
|
|
|
3699
3830
|
};
|
|
3700
3831
|
//#endregion
|
|
3701
3832
|
//#region src/core/backendAutofill.ts
|
|
3702
|
-
async function
|
|
3833
|
+
async function Hr(e, t, n, r) {
|
|
3703
3834
|
let i = await e.onUnderfilled(n);
|
|
3704
3835
|
if (!r()) return;
|
|
3705
3836
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend autofill requires a sessionId.");
|
|
3706
3837
|
let a = Math.max(n.received, i.received ?? n.received);
|
|
3707
3838
|
Object.assign(t.autofill, {
|
|
3708
|
-
...
|
|
3839
|
+
...Cr(i.nextRequestAt),
|
|
3709
3840
|
missing: Math.max(0, e.pageSize - a),
|
|
3710
3841
|
received: a,
|
|
3711
3842
|
sequence: i.sequence ?? 0,
|
|
@@ -3713,19 +3844,19 @@ async function Fr(e, t, n, r) {
|
|
|
3713
3844
|
status: "waiting"
|
|
3714
3845
|
});
|
|
3715
3846
|
}
|
|
3716
|
-
function
|
|
3717
|
-
["complete", "exhausted"].includes(t.status) && t.items && (e.items =
|
|
3847
|
+
function Ur(e, t) {
|
|
3848
|
+
["complete", "exhausted"].includes(t.status) && t.items && (e.items = cr(e.items, t.items)), t.next !== void 0 && (e.next = t.next), t.total !== void 0 && (e.total = t.total);
|
|
3718
3849
|
}
|
|
3719
|
-
function
|
|
3850
|
+
function Wr(e, t, n) {
|
|
3720
3851
|
let r = t.autofill;
|
|
3721
|
-
return !
|
|
3852
|
+
return !Nr(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (Ur(t, n), Object.assign(r, Cr(n.status === "waiting" ? n.nextRequestAt : null)), r.error = n.error ?? null, r.missing = Math.max(0, (r.pageSize ?? 0) - n.received), r.received = n.received, n.requests !== void 0 && (r.requests = n.requests), r.sequence = n.sequence, r.status = n.status, !0);
|
|
3722
3853
|
}
|
|
3723
|
-
function
|
|
3724
|
-
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill =
|
|
3854
|
+
function Gr(e, t, n) {
|
|
3855
|
+
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = Ar(e, n), Ur(t, n), !0);
|
|
3725
3856
|
}
|
|
3726
3857
|
//#endregion
|
|
3727
3858
|
//#region src/core/backlogRestore.ts
|
|
3728
|
-
async function
|
|
3859
|
+
async function Kr(e, t, n) {
|
|
3729
3860
|
if (!e) return;
|
|
3730
3861
|
let r = new AbortController();
|
|
3731
3862
|
n(r);
|
|
@@ -3740,7 +3871,7 @@ async function zr(e, t, n) {
|
|
|
3740
3871
|
}
|
|
3741
3872
|
//#endregion
|
|
3742
3873
|
//#region src/core/initialAutofill.ts
|
|
3743
|
-
async function
|
|
3874
|
+
async function qr({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, onPages: i, options: a, signal: o, state: s }) {
|
|
3744
3875
|
let c = a.autofill;
|
|
3745
3876
|
if (!c) return;
|
|
3746
3877
|
let l = s.items.length;
|
|
@@ -3753,7 +3884,7 @@ async function Br({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3753
3884
|
return;
|
|
3754
3885
|
}
|
|
3755
3886
|
if (c.strategy === "backend") {
|
|
3756
|
-
await
|
|
3887
|
+
await Hr(c, s, {
|
|
3757
3888
|
cycleId: e,
|
|
3758
3889
|
feedKey: c.feedKey,
|
|
3759
3890
|
items: [...s.items],
|
|
@@ -3770,11 +3901,11 @@ async function Br({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3770
3901
|
s.autofill.status = "exhausted";
|
|
3771
3902
|
return;
|
|
3772
3903
|
}
|
|
3773
|
-
let u = await
|
|
3904
|
+
let u = await Pr({
|
|
3774
3905
|
existingItems: s.items,
|
|
3775
3906
|
initialCursor: s.next,
|
|
3776
3907
|
loadPage: a.loadPage,
|
|
3777
|
-
maximumRequests:
|
|
3908
|
+
maximumRequests: Er(c, !1),
|
|
3778
3909
|
onCollection: n,
|
|
3779
3910
|
onDelayChange: (e) => {
|
|
3780
3911
|
t() && Object.assign(s.autofill, e);
|
|
@@ -3788,7 +3919,7 @@ async function Br({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3788
3919
|
shouldPause: () => s.loadMoreLocked,
|
|
3789
3920
|
signal: o
|
|
3790
3921
|
});
|
|
3791
|
-
t() && (s.items =
|
|
3922
|
+
t() && (s.items = cr(s.items, u.items), s.next = u.next, u.total !== void 0 && (s.total = u.total), r(u.lastCursor), i(u.pages), Object.assign(s.autofill, {
|
|
3792
3923
|
missing: u.missing,
|
|
3793
3924
|
received: u.received,
|
|
3794
3925
|
requests: u.requests,
|
|
@@ -3797,13 +3928,13 @@ async function Br({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3797
3928
|
}
|
|
3798
3929
|
//#endregion
|
|
3799
3930
|
//#region src/core/fill.ts
|
|
3800
|
-
function
|
|
3931
|
+
function Jr(e) {
|
|
3801
3932
|
return "items" in e ? { items: e.items } : "pages" in e ? { pages: e.pages } : { until: "end" };
|
|
3802
3933
|
}
|
|
3803
|
-
function
|
|
3934
|
+
function Yr(e) {
|
|
3804
3935
|
return `${typeof e}:${String(e)}`;
|
|
3805
3936
|
}
|
|
3806
|
-
function
|
|
3937
|
+
function Xr(e) {
|
|
3807
3938
|
if (!e || typeof e != "object") throw TypeError("Vibe fill target must be an object.");
|
|
3808
3939
|
if ("pages" in e) {
|
|
3809
3940
|
if (!Number.isInteger(e.pages) || e.pages <= 0) throw TypeError("Vibe fill pages must be a positive integer.");
|
|
@@ -3816,21 +3947,21 @@ function Ur(e) {
|
|
|
3816
3947
|
if ("until" in e && e.until === "end") return { until: "end" };
|
|
3817
3948
|
throw TypeError("Vibe fill target must be { items }, { pages }, or { until: 'end' }.");
|
|
3818
3949
|
}
|
|
3819
|
-
function
|
|
3950
|
+
function Zr(e) {
|
|
3820
3951
|
if (!e) return;
|
|
3821
3952
|
if (e.strategy === "frontend") {
|
|
3822
|
-
|
|
3953
|
+
xr(e, "frontend fill");
|
|
3823
3954
|
return;
|
|
3824
3955
|
}
|
|
3825
3956
|
if (!e.feedKey.trim()) throw TypeError("Vibe backend fill requires a feedKey.");
|
|
3826
3957
|
let t = e.initialSession;
|
|
3827
3958
|
if (t) {
|
|
3828
3959
|
if (t.feedKey !== e.feedKey) throw TypeError("Vibe backend fill initialSession feedKey must match fill feedKey.");
|
|
3829
|
-
|
|
3960
|
+
Xr(t.target);
|
|
3830
3961
|
}
|
|
3831
3962
|
}
|
|
3832
|
-
function
|
|
3833
|
-
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a =
|
|
3963
|
+
function Qr(e, t, n = !0) {
|
|
3964
|
+
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a = Cr(i?.nextRequestAt);
|
|
3834
3965
|
return {
|
|
3835
3966
|
completedPages: i?.completedPages ?? 0,
|
|
3836
3967
|
cycleId: i?.cycleId ?? null,
|
|
@@ -3843,10 +3974,10 @@ function Gr(e, t, n = !0) {
|
|
|
3843
3974
|
sessionId: i?.sessionId ?? null,
|
|
3844
3975
|
status: i?.status ?? "idle",
|
|
3845
3976
|
strategy: e?.strategy ?? null,
|
|
3846
|
-
target: i ?
|
|
3977
|
+
target: i ? Jr(i.target) : null
|
|
3847
3978
|
};
|
|
3848
3979
|
}
|
|
3849
|
-
function
|
|
3980
|
+
function $r(e) {
|
|
3850
3981
|
return [
|
|
3851
3982
|
"cancelling",
|
|
3852
3983
|
"filling",
|
|
@@ -3854,7 +3985,7 @@ function Kr(e) {
|
|
|
3854
3985
|
"waiting"
|
|
3855
3986
|
].includes(e.status);
|
|
3856
3987
|
}
|
|
3857
|
-
async function
|
|
3988
|
+
async function ei({ existingItems: e, getLoadedItemCount: t, initialCursor: n, loadPage: r, onCollection: i, onPage: a, onDelayChange: o, onProgress: s, options: c, shouldPause: l = () => !1, signal: u, target: d }) {
|
|
3858
3989
|
let f = [], p = [], m = e.length, h = new Set(e.map(({ postId: e }) => e)), g = /* @__PURE__ */ new Set(), _ = 0, v = n, y = n, b = n, x = 0, S, C = () => t?.() ?? m + f.length;
|
|
3859
3990
|
if ("items" in d && C() >= d.items) return {
|
|
3860
3991
|
completedPages: _,
|
|
@@ -3866,10 +3997,10 @@ async function qr({ existingItems: e, getLoadedItemCount: t, initialCursor: n, l
|
|
|
3866
3997
|
status: "complete"
|
|
3867
3998
|
};
|
|
3868
3999
|
for (; b !== null;) {
|
|
3869
|
-
let e =
|
|
4000
|
+
let e = Yr(v);
|
|
3870
4001
|
if (g.has(e)) throw Error("Vibe fill received a repeated cursor.");
|
|
3871
|
-
if (g.add(e), await
|
|
3872
|
-
delayMs:
|
|
4002
|
+
if (g.add(e), await wr({
|
|
4003
|
+
delayMs: Sr(_, c),
|
|
3873
4004
|
onChange: o,
|
|
3874
4005
|
signal: u
|
|
3875
4006
|
}), _ > 0 && l()) return {
|
|
@@ -3882,12 +4013,12 @@ async function qr({ existingItems: e, getLoadedItemCount: t, initialCursor: n, l
|
|
|
3882
4013
|
status: "paused",
|
|
3883
4014
|
total: S
|
|
3884
4015
|
};
|
|
3885
|
-
let t =
|
|
4016
|
+
let t = sr(await r({
|
|
3886
4017
|
cursor: v,
|
|
3887
4018
|
signal: u
|
|
3888
4019
|
}));
|
|
3889
4020
|
_ += 1, y = v;
|
|
3890
|
-
let n =
|
|
4021
|
+
let n = lr(h, t.items), m = {
|
|
3891
4022
|
contributionIds: n.map(({ postId: e }) => e),
|
|
3892
4023
|
cursor: v,
|
|
3893
4024
|
next: t.next,
|
|
@@ -3958,12 +4089,12 @@ async function qr({ existingItems: e, getLoadedItemCount: t, initialCursor: n, l
|
|
|
3958
4089
|
}
|
|
3959
4090
|
//#endregion
|
|
3960
4091
|
//#region src/core/backendFill.ts
|
|
3961
|
-
async function
|
|
4092
|
+
async function ti(e, t, n, r) {
|
|
3962
4093
|
let i = await e.onStart(n);
|
|
3963
4094
|
if (r()) {
|
|
3964
4095
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend fill requires a sessionId.");
|
|
3965
4096
|
Object.assign(t.fill, {
|
|
3966
|
-
...
|
|
4097
|
+
...Cr(i.nextRequestAt),
|
|
3967
4098
|
completedPages: i.completedPages ?? 0,
|
|
3968
4099
|
received: i.received ?? 0,
|
|
3969
4100
|
sequence: i.sequence ?? 0,
|
|
@@ -3972,23 +4103,23 @@ async function Jr(e, t, n, r) {
|
|
|
3972
4103
|
});
|
|
3973
4104
|
}
|
|
3974
4105
|
}
|
|
3975
|
-
function
|
|
4106
|
+
function ni(e, t, n) {
|
|
3976
4107
|
return e?.strategy === "backend" && n.feedKey === e.feedKey && n.sessionId === t.fill.sessionId;
|
|
3977
4108
|
}
|
|
3978
|
-
function
|
|
4109
|
+
function ri(e) {
|
|
3979
4110
|
return Number.isInteger(e.completedPages) && e.completedPages >= 0 && Number.isInteger(e.received) && e.received >= 0 && Number.isInteger(e.sequence) && e.sequence >= 0;
|
|
3980
4111
|
}
|
|
3981
|
-
function
|
|
4112
|
+
function ii(e, t) {
|
|
3982
4113
|
if (!["complete", "exhausted"].includes(t.status)) return !0;
|
|
3983
4114
|
let n = e.fill.target;
|
|
3984
4115
|
return !n || !Array.isArray(t.items) || t.next === void 0 || t.lastCursor === void 0 ? !1 : t.status === "exhausted" ? "pages" in n && t.completedPages < n.pages && t.next === null : "pages" in n ? t.completedPages === n.pages : t.next === null;
|
|
3985
4116
|
}
|
|
3986
|
-
function
|
|
3987
|
-
t.total !== void 0 && (e.total = t.total), ["complete", "exhausted"].includes(t.status) && (e.items =
|
|
4117
|
+
function ai(e, t, n) {
|
|
4118
|
+
t.total !== void 0 && (e.total = t.total), ["complete", "exhausted"].includes(t.status) && (e.items = cr(e.items, t.items ?? []), e.next = t.next ?? null, n(t.lastCursor ?? null));
|
|
3988
4119
|
}
|
|
3989
|
-
function
|
|
3990
|
-
return !
|
|
3991
|
-
...
|
|
4120
|
+
function oi(e, t, n, r) {
|
|
4121
|
+
return !ni(e, t, n) || !ri(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !ii(t, n) ? !1 : (ai(t, n, r), Object.assign(t.fill, {
|
|
4122
|
+
...Cr(n.status === "waiting" ? n.nextRequestAt : null),
|
|
3992
4123
|
completedPages: n.completedPages,
|
|
3993
4124
|
error: n.error ?? null,
|
|
3994
4125
|
received: n.received,
|
|
@@ -3996,45 +4127,45 @@ function $r(e, t, n, r) {
|
|
|
3996
4127
|
status: n.status
|
|
3997
4128
|
}), !0);
|
|
3998
4129
|
}
|
|
3999
|
-
function
|
|
4130
|
+
function si(e, t, n, r) {
|
|
4000
4131
|
if (e?.strategy !== "backend" || n.feedKey !== e.feedKey) return !1;
|
|
4001
4132
|
let i = t.fill;
|
|
4002
|
-
return t.fill =
|
|
4133
|
+
return t.fill = Qr(e, n), !ri(n) || !ii(t, n) ? (t.fill = i, !1) : (ai(t, n, r), !0);
|
|
4003
4134
|
}
|
|
4004
4135
|
//#endregion
|
|
4005
4136
|
//#region src/core/fillController.ts
|
|
4006
|
-
var
|
|
4137
|
+
var ci = class {
|
|
4007
4138
|
abortController = null;
|
|
4008
4139
|
cycle = 0;
|
|
4009
4140
|
delayCountdown;
|
|
4010
4141
|
requestVersion = 0;
|
|
4011
4142
|
collection = null;
|
|
4012
4143
|
constructor(e) {
|
|
4013
|
-
this.options = e, this.delayCountdown = new
|
|
4144
|
+
this.options = e, this.delayCountdown = new Tr((e) => {
|
|
4014
4145
|
Object.assign(this.options.state.fill, e);
|
|
4015
4146
|
}), this.syncBackendCountdown();
|
|
4016
4147
|
}
|
|
4017
4148
|
isActive() {
|
|
4018
|
-
return
|
|
4149
|
+
return $r(this.options.state.fill);
|
|
4019
4150
|
}
|
|
4020
4151
|
applyUpdate(e) {
|
|
4021
|
-
let t =
|
|
4152
|
+
let t = oi(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
4022
4153
|
return t && this.syncBackendCountdown(), t;
|
|
4023
4154
|
}
|
|
4024
4155
|
restoreSession(e) {
|
|
4025
|
-
let t =
|
|
4156
|
+
let t = si(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
4026
4157
|
return t && this.syncBackendCountdown(), t;
|
|
4027
4158
|
}
|
|
4028
4159
|
async start(e, t = {}) {
|
|
4029
4160
|
let n = this.options.fill;
|
|
4030
4161
|
if (!n) throw Error("Vibe fill is not configured.");
|
|
4031
4162
|
if (this.isActive()) throw Error("Vibe fill is already active.");
|
|
4032
|
-
let r =
|
|
4163
|
+
let r = Xr(e), i = Xr(t.target ?? r), a = t.progressOffset ?? {
|
|
4033
4164
|
completedPages: 0,
|
|
4034
4165
|
received: 0
|
|
4035
4166
|
}, o = t.cycleId ?? `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
4036
4167
|
if (this.options.state.fill = {
|
|
4037
|
-
...
|
|
4168
|
+
...Qr(n, void 0, !1),
|
|
4038
4169
|
completedPages: a.completedPages,
|
|
4039
4170
|
cycleId: o,
|
|
4040
4171
|
received: a.received,
|
|
@@ -4047,7 +4178,7 @@ var ti = class {
|
|
|
4047
4178
|
let s = ++this.requestVersion, c = new AbortController();
|
|
4048
4179
|
this.abortController = c;
|
|
4049
4180
|
try {
|
|
4050
|
-
n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await
|
|
4181
|
+
n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await ti(n, this.options.state, {
|
|
4051
4182
|
cycleId: o,
|
|
4052
4183
|
feedKey: n.feedKey,
|
|
4053
4184
|
items: [...this.options.state.items],
|
|
@@ -4065,7 +4196,7 @@ var ti = class {
|
|
|
4065
4196
|
}
|
|
4066
4197
|
async cancel() {
|
|
4067
4198
|
let { fill: e, state: t } = this.options;
|
|
4068
|
-
if (
|
|
4199
|
+
if (!$r(t.fill) || !t.fill.cycleId) return;
|
|
4069
4200
|
let n = {
|
|
4070
4201
|
cycleId: t.fill.cycleId,
|
|
4071
4202
|
feedKey: t.fill.feedKey ?? "",
|
|
@@ -4109,7 +4240,7 @@ var ti = class {
|
|
|
4109
4240
|
});
|
|
4110
4241
|
}
|
|
4111
4242
|
reset() {
|
|
4112
|
-
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill =
|
|
4243
|
+
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = Qr(this.options.fill, void 0, !1), this.collection = null;
|
|
4113
4244
|
}
|
|
4114
4245
|
destroy() {
|
|
4115
4246
|
this.abortLocalRequest(), this.delayCountdown.clear();
|
|
@@ -4144,7 +4275,7 @@ var ti = class {
|
|
|
4144
4275
|
s.fill.status = "until" in t ? "complete" : "exhausted";
|
|
4145
4276
|
return;
|
|
4146
4277
|
}
|
|
4147
|
-
let c = await
|
|
4278
|
+
let c = await ei({
|
|
4148
4279
|
existingItems: s.items,
|
|
4149
4280
|
getLoadedItemCount: () => s.items.length,
|
|
4150
4281
|
initialCursor: s.next,
|
|
@@ -4181,7 +4312,7 @@ var ti = class {
|
|
|
4181
4312
|
let e = this.collection;
|
|
4182
4313
|
if (this.collection = null, !e || this.options.fill?.strategy !== "frontend") return;
|
|
4183
4314
|
let t = this.options.state;
|
|
4184
|
-
t.items =
|
|
4315
|
+
t.items = ur(t.items, this.filterItems(e.items)), t.next = e.next, e.total !== void 0 && (t.total = e.total), this.options.onLastCursor(e.lastCursor), this.options.onPages(e.pages), Object.assign(t.fill, {
|
|
4185
4316
|
completedPages: e.completedPages,
|
|
4186
4317
|
received: e.received
|
|
4187
4318
|
});
|
|
@@ -4196,7 +4327,7 @@ var ti = class {
|
|
|
4196
4327
|
};
|
|
4197
4328
|
//#endregion
|
|
4198
4329
|
//#region src/core/fillReconciliation.ts
|
|
4199
|
-
async function
|
|
4330
|
+
async function li({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r, pauseWhenManual: i = !1, setLastCursor: a, signal: o, state: s }) {
|
|
4200
4331
|
if (!e.needsReconciliation(s.items)) return "skipped";
|
|
4201
4332
|
let c = await e.reconcile({
|
|
4202
4333
|
existingItems: s.items,
|
|
@@ -4205,11 +4336,11 @@ async function ni({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r,
|
|
|
4205
4336
|
shouldPause: () => s.loadMoreLocked || i && !s.infiniteScroll,
|
|
4206
4337
|
signal: o
|
|
4207
4338
|
});
|
|
4208
|
-
return t() ? (s.items =
|
|
4339
|
+
return t() ? (s.items = cr(s.items, c.items), s.next = c.next, a(c.lastCursor), c.total !== void 0 && (s.total = c.total), e.completeReconciliation(c), c.status) : c.status;
|
|
4209
4340
|
}
|
|
4210
4341
|
//#endregion
|
|
4211
4342
|
//#region src/core/feedFooter.ts
|
|
4212
|
-
function
|
|
4343
|
+
function ui(e) {
|
|
4213
4344
|
return {
|
|
4214
4345
|
cancelAutofill: () => e.cancelAutofill(),
|
|
4215
4346
|
loadMore: () => e.loadNext(),
|
|
@@ -4221,64 +4352,64 @@ function ri(e) {
|
|
|
4221
4352
|
retryFill: () => e.retryFill()
|
|
4222
4353
|
};
|
|
4223
4354
|
}
|
|
4224
|
-
function
|
|
4355
|
+
function di(e) {
|
|
4225
4356
|
if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
|
|
4226
4357
|
}
|
|
4227
|
-
function
|
|
4228
|
-
e?.intervalMs !== void 0 &&
|
|
4358
|
+
function fi(e) {
|
|
4359
|
+
e?.intervalMs !== void 0 && di(e.intervalMs);
|
|
4229
4360
|
}
|
|
4230
|
-
function
|
|
4361
|
+
function pi(e) {
|
|
4231
4362
|
return {
|
|
4232
4363
|
enabled: e?.enabled ?? !1,
|
|
4233
4364
|
includePostItems: e?.includePostItems ?? !1,
|
|
4234
4365
|
intervalMs: e?.intervalMs ?? 5e3
|
|
4235
4366
|
};
|
|
4236
4367
|
}
|
|
4237
|
-
function
|
|
4368
|
+
function mi(e, t) {
|
|
4238
4369
|
if (typeof t == "boolean") {
|
|
4239
4370
|
e.enabled = t;
|
|
4240
4371
|
return;
|
|
4241
4372
|
}
|
|
4242
|
-
|
|
4373
|
+
fi(t), t.enabled !== void 0 && (e.enabled = t.enabled), t.includePostItems !== void 0 && (e.includePostItems = t.includePostItems), t.intervalMs !== void 0 && (e.intervalMs = t.intervalMs);
|
|
4243
4374
|
}
|
|
4244
4375
|
//#endregion
|
|
4245
4376
|
//#region src/core/reelInfoSheet.ts
|
|
4246
|
-
function
|
|
4377
|
+
function hi(e) {
|
|
4247
4378
|
return { enabled: e?.enabled ?? !1 };
|
|
4248
4379
|
}
|
|
4249
|
-
function
|
|
4380
|
+
function gi(e, t, n) {
|
|
4250
4381
|
if (n && !t) throw Error("Vibe cannot enable reelInfoSheet without a configured component.");
|
|
4251
4382
|
e.enabled = n;
|
|
4252
4383
|
}
|
|
4253
4384
|
//#endregion
|
|
4254
4385
|
//#region src/core/initialRuntimeState.ts
|
|
4255
|
-
function
|
|
4386
|
+
function _i(e, t) {
|
|
4256
4387
|
let n = e.initialPage;
|
|
4257
4388
|
return {
|
|
4258
4389
|
activeReelPostId: null,
|
|
4259
|
-
autoScroll:
|
|
4260
|
-
autofill:
|
|
4390
|
+
autoScroll: Br(e.autoScroll),
|
|
4391
|
+
autofill: Ar(e.autofill),
|
|
4261
4392
|
current: n?.current ?? null,
|
|
4262
4393
|
error: null,
|
|
4263
|
-
fill:
|
|
4394
|
+
fill: Qr(e.fill),
|
|
4264
4395
|
infiniteScroll: e.infiniteScroll ?? !0,
|
|
4265
4396
|
isLoading: !n,
|
|
4266
4397
|
isLoadingMore: !1,
|
|
4267
|
-
items: n ?
|
|
4398
|
+
items: n ? cr([], n.items) : [],
|
|
4268
4399
|
layout: t === "reel" ? "reel" : "masonry",
|
|
4269
4400
|
loadMoreLocked: !1,
|
|
4270
4401
|
mediaIndices: /* @__PURE__ */ new Map(),
|
|
4271
4402
|
next: n?.next ?? null,
|
|
4272
4403
|
nextPageError: null,
|
|
4273
4404
|
phoneMode: !1,
|
|
4274
|
-
reelAutoAdvance:
|
|
4405
|
+
reelAutoAdvance: pi(e.reelAutoAdvance),
|
|
4275
4406
|
reelForward: {
|
|
4276
4407
|
error: null,
|
|
4277
4408
|
status: "idle"
|
|
4278
4409
|
},
|
|
4279
4410
|
reelForwardIndex: null,
|
|
4280
4411
|
reelForwardItem: null,
|
|
4281
|
-
reelInfoSheet:
|
|
4412
|
+
reelInfoSheet: hi(e.reelInfoSheet),
|
|
4282
4413
|
reelInfoSheetOverlay: !1,
|
|
4283
4414
|
reelMediaSource: "original",
|
|
4284
4415
|
reelOrigin: null,
|
|
@@ -4287,21 +4418,21 @@ function ui(e, t) {
|
|
|
4287
4418
|
}
|
|
4288
4419
|
//#endregion
|
|
4289
4420
|
//#region src/core/options.ts
|
|
4290
|
-
function
|
|
4421
|
+
function vi(e, t) {
|
|
4291
4422
|
if (t) {
|
|
4292
4423
|
if (!Number.isFinite(t.height) || t.height <= 0) throw TypeError(`Vibe ${e} height must be a positive number.`);
|
|
4293
4424
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe ${e} background must be "default" or "transparent".`);
|
|
4294
4425
|
}
|
|
4295
4426
|
}
|
|
4296
|
-
function
|
|
4427
|
+
function yi(e, t) {
|
|
4297
4428
|
if (t) {
|
|
4298
4429
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe mediaCard ${e} background must be "default" or "transparent".`);
|
|
4299
4430
|
for (let [n, r] of [["paddingX", t.paddingX], ["paddingY", t.paddingY]]) if (r !== void 0 && (!Number.isFinite(r) || r < 0)) throw TypeError(`Vibe mediaCard ${e} ${n} must be a non-negative number.`);
|
|
4300
4431
|
}
|
|
4301
4432
|
}
|
|
4302
|
-
function
|
|
4303
|
-
if (
|
|
4304
|
-
if (
|
|
4433
|
+
function bi(e) {
|
|
4434
|
+
if (zr(e.autoScroll), vi("cardHeader", e.cardHeader), vi("cardFooter", e.cardFooter), yi("header", e.mediaCard?.header), yi("footer", e.mediaCard?.footer), e.mediaCard?.feedPreload !== void 0 && e.mediaCard.feedPreload !== "none" && e.mediaCard.feedPreload !== "visible-post") throw TypeError("Vibe mediaCard feedPreload must be \"none\" or \"visible-post\".");
|
|
4435
|
+
if (kr(e.autofill), Zr(e.fill), Re(e.masonry), fi(e.reelAutoAdvance), e.removalReconciliation) {
|
|
4305
4436
|
if (!Number.isInteger(e.removalReconciliation.pageSize) || e.removalReconciliation.pageSize <= 0) throw TypeError("Vibe removalReconciliation pageSize must be a positive integer.");
|
|
4306
4437
|
let t = e.removalReconciliation.maxReplayPages ?? 5;
|
|
4307
4438
|
if (!Number.isInteger(t) || t <= 0) throw TypeError("Vibe removalReconciliation maxReplayPages must be a positive integer.");
|
|
@@ -4316,7 +4447,7 @@ function pi(e) {
|
|
|
4316
4447
|
if (e.fill?.strategy === "frontend" && !e.loadPage) throw TypeError("Vibe frontend fill requires loadPage.");
|
|
4317
4448
|
if (e.fill?.strategy === "backend" && e.fill.initialSession && !e.initialPage) throw TypeError("Vibe backend fill restoration requires initialPage.");
|
|
4318
4449
|
}
|
|
4319
|
-
function
|
|
4450
|
+
function xi(e) {
|
|
4320
4451
|
if (typeof e != "string") return e;
|
|
4321
4452
|
if (typeof document > "u") throw Error("Vibe cannot resolve a selector without a document.");
|
|
4322
4453
|
let t = document.querySelector(e);
|
|
@@ -4325,7 +4456,7 @@ function mi(e) {
|
|
|
4325
4456
|
}
|
|
4326
4457
|
//#endregion
|
|
4327
4458
|
//#region src/core/pageRequest.ts
|
|
4328
|
-
async function
|
|
4459
|
+
async function Si({ append: e, autofillController: t, cursor: n, isCurrent: r, loadPage: i, onLastCursor: a, onPages: o, options: s, signal: c, state: l }) {
|
|
4329
4460
|
let u = s.autofill, d = e && u?.strategy === "frontend" && (l.autofill.status === "paused" || l.autofill.status === "error"), f = d ? {
|
|
4330
4461
|
received: l.autofill.received,
|
|
4331
4462
|
requests: l.autofill.requests
|
|
@@ -4337,11 +4468,11 @@ async function hi({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
4337
4468
|
let m = !1;
|
|
4338
4469
|
try {
|
|
4339
4470
|
if (u?.strategy === "frontend") {
|
|
4340
|
-
let s = await
|
|
4471
|
+
let s = await Pr({
|
|
4341
4472
|
existingItems: e ? l.items : [],
|
|
4342
4473
|
initialCursor: n,
|
|
4343
4474
|
loadPage: i,
|
|
4344
|
-
maximumRequests: f ? Math.max(0,
|
|
4475
|
+
maximumRequests: f ? Math.max(0, Er(u) - f.requests) : void 0,
|
|
4345
4476
|
onCollection: (e) => t.captureCollection(e, r()),
|
|
4346
4477
|
onDelayChange: (e) => {
|
|
4347
4478
|
r() && Object.assign(l.autofill, e);
|
|
@@ -4356,7 +4487,7 @@ async function hi({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
4356
4487
|
signal: c
|
|
4357
4488
|
});
|
|
4358
4489
|
if (!r()) return;
|
|
4359
|
-
l.items = e ?
|
|
4490
|
+
l.items = e ? cr(l.items, s.items) : [...s.items], a(s.lastCursor), l.next = s.next, s.total !== void 0 && (l.total = s.total), Object.assign(l.autofill, {
|
|
4360
4491
|
missing: s.missing,
|
|
4361
4492
|
received: s.received,
|
|
4362
4493
|
requests: s.requests,
|
|
@@ -4364,12 +4495,12 @@ async function hi({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
4364
4495
|
}), o(s.pages), t.clearCollection();
|
|
4365
4496
|
return;
|
|
4366
4497
|
}
|
|
4367
|
-
let s =
|
|
4498
|
+
let s = sr(await i({
|
|
4368
4499
|
cursor: n,
|
|
4369
4500
|
signal: c
|
|
4370
4501
|
}));
|
|
4371
4502
|
if (!r()) return;
|
|
4372
|
-
let d = e ? l.items : [], h =
|
|
4503
|
+
let d = e ? l.items : [], h = cr(d, s.items), g = h.length - d.length;
|
|
4373
4504
|
if (l.items = h, a(n), o([{
|
|
4374
4505
|
contributionIds: h.slice(d.length).map(({ postId: e }) => e),
|
|
4375
4506
|
cursor: n,
|
|
@@ -4384,7 +4515,7 @@ async function hi({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
4384
4515
|
l.autofill.status = "complete";
|
|
4385
4516
|
return;
|
|
4386
4517
|
}
|
|
4387
|
-
await
|
|
4518
|
+
await Hr(u, l, {
|
|
4388
4519
|
cycleId: p,
|
|
4389
4520
|
feedKey: u.feedKey,
|
|
4390
4521
|
items: h.slice(d.length),
|
|
@@ -4406,7 +4537,7 @@ async function hi({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
4406
4537
|
}
|
|
4407
4538
|
//#endregion
|
|
4408
4539
|
//#region src/core/pageReplacement.ts
|
|
4409
|
-
var
|
|
4540
|
+
var Ci = class {
|
|
4410
4541
|
controller = null;
|
|
4411
4542
|
constructor(e) {
|
|
4412
4543
|
this.options = e;
|
|
@@ -4418,7 +4549,7 @@ var gi = class {
|
|
|
4418
4549
|
this.controller?.abort(), this.controller = null, this.options.surface()?.cancelItemRemoval();
|
|
4419
4550
|
}
|
|
4420
4551
|
async replace(e, t) {
|
|
4421
|
-
let n =
|
|
4552
|
+
let n = sr(e);
|
|
4422
4553
|
this.cancel();
|
|
4423
4554
|
let r = new AbortController();
|
|
4424
4555
|
this.controller = r;
|
|
@@ -4438,7 +4569,7 @@ var gi = class {
|
|
|
4438
4569
|
let e = this.options.surface()?.getAutoScrollElement();
|
|
4439
4570
|
e && (e.scrollTop = 0);
|
|
4440
4571
|
}
|
|
4441
|
-
e.mediaIndices = new Map(a.map((t) => [t.postId,
|
|
4572
|
+
e.mediaIndices = new Map(a.map((t) => [t.postId, q(t, e.mediaIndices.get(t.postId) ?? 0)])), e.activeReelPostId !== null && !o.has(String(e.activeReelPostId)) && (e.activeReelPostId = null, e.reelOrigin = null), e.items = a, e.next = n.next, e.total = n.total ?? null, e.error = null, e.nextPageError = null, this.options.commit({
|
|
4442
4573
|
...n,
|
|
4443
4574
|
items: a
|
|
4444
4575
|
});
|
|
@@ -4449,7 +4580,7 @@ var gi = class {
|
|
|
4449
4580
|
};
|
|
4450
4581
|
//#endregion
|
|
4451
4582
|
//#region src/core/loadingLock.ts
|
|
4452
|
-
function
|
|
4583
|
+
function wi(e, t, n) {
|
|
4453
4584
|
if (e.loadMoreLocked !== t && (e.loadMoreLocked = t, !t)) {
|
|
4454
4585
|
if (e.fill.status === "paused" && e.fill.target) {
|
|
4455
4586
|
n.resumeFill();
|
|
@@ -4465,16 +4596,16 @@ function _i(e, t, n) {
|
|
|
4465
4596
|
}
|
|
4466
4597
|
//#endregion
|
|
4467
4598
|
//#region src/core/removalReconciliationController.ts
|
|
4468
|
-
function
|
|
4599
|
+
function Ti(e) {
|
|
4469
4600
|
return `${typeof e}:${String(e)}`;
|
|
4470
4601
|
}
|
|
4471
|
-
function
|
|
4602
|
+
function Ei(e) {
|
|
4472
4603
|
return `${typeof e}:${String(e)}`;
|
|
4473
4604
|
}
|
|
4474
|
-
function
|
|
4605
|
+
function Di(e) {
|
|
4475
4606
|
return e.map(({ postId: e }) => e);
|
|
4476
4607
|
}
|
|
4477
|
-
var
|
|
4608
|
+
var Oi = class {
|
|
4478
4609
|
delay;
|
|
4479
4610
|
enabled;
|
|
4480
4611
|
maxReplayPages;
|
|
@@ -4493,7 +4624,7 @@ var xi = class {
|
|
|
4493
4624
|
e.status === "complete" && (this.pages = [...this.pages.slice(0, e.replaceFrom), ...e.pages].slice(-this.maxReplayPages), this.pending = null);
|
|
4494
4625
|
}
|
|
4495
4626
|
filterItems(e) {
|
|
4496
|
-
return this.tombstones.size === 0 ? [...e] : e.filter(({ postId: e }) => !this.tombstones.has(
|
|
4627
|
+
return this.tombstones.size === 0 ? [...e] : e.filter(({ postId: e }) => !this.tombstones.has(Ti(e)));
|
|
4497
4628
|
}
|
|
4498
4629
|
needsReconciliation(e) {
|
|
4499
4630
|
return this.pending !== null || this.findUnderfilledPage(e) >= 0;
|
|
@@ -4506,45 +4637,45 @@ var xi = class {
|
|
|
4506
4637
|
}
|
|
4507
4638
|
recordInitialPage(e) {
|
|
4508
4639
|
e && this.recordPages([{
|
|
4509
|
-
contributionIds:
|
|
4510
|
-
cursor:
|
|
4640
|
+
contributionIds: Di(e.items),
|
|
4641
|
+
cursor: mr(e),
|
|
4511
4642
|
next: e.next,
|
|
4512
|
-
returnedIds:
|
|
4643
|
+
returnedIds: Di(e.items)
|
|
4513
4644
|
}]);
|
|
4514
4645
|
}
|
|
4515
4646
|
remove(e) {
|
|
4516
|
-
e.forEach((e) => this.tombstones.add(
|
|
4647
|
+
e.forEach((e) => this.tombstones.add(Ti(e)));
|
|
4517
4648
|
}
|
|
4518
4649
|
reset() {
|
|
4519
4650
|
this.pages = [], this.pending = null, this.tombstones.clear();
|
|
4520
4651
|
}
|
|
4521
4652
|
restore(e) {
|
|
4522
|
-
e.forEach((e) => this.tombstones.delete(
|
|
4653
|
+
e.forEach((e) => this.tombstones.delete(Ti(e)));
|
|
4523
4654
|
}
|
|
4524
4655
|
async reconcile({ existingItems: e, loadPage: t, onDelayChange: n = () => void 0, shouldPause: r = () => !1, signal: i }) {
|
|
4525
4656
|
let a = this.pending ?? this.createSession(e);
|
|
4526
4657
|
for (this.pending = a; a.remainingRequests > 0;) {
|
|
4527
|
-
let e =
|
|
4658
|
+
let e = Ei(a.cursor);
|
|
4528
4659
|
if (a.seenCursors.has(e)) throw Error("Vibe removal reconciliation received a repeated cursor.");
|
|
4529
|
-
if (await
|
|
4530
|
-
delayMs:
|
|
4660
|
+
if (await wr({
|
|
4661
|
+
delayMs: Sr(a.pages.length, this.delay),
|
|
4531
4662
|
onChange: n,
|
|
4532
4663
|
signal: i
|
|
4533
4664
|
}), a.pages.length > 0 && r()) return this.result(a, "paused");
|
|
4534
|
-
let o =
|
|
4665
|
+
let o = sr(await t({
|
|
4535
4666
|
cursor: a.cursor,
|
|
4536
4667
|
signal: i
|
|
4537
4668
|
}));
|
|
4538
4669
|
a.seenCursors.add(e);
|
|
4539
4670
|
let s = this.filterItems(o.items), c = [];
|
|
4540
4671
|
if (s.forEach((e) => {
|
|
4541
|
-
let t =
|
|
4672
|
+
let t = Ti(e.postId);
|
|
4542
4673
|
a.attributed.has(t) || (a.attributed.add(t), c.push(e.postId)), a.appended.has(t) || (a.appended.add(t), a.items.push(e));
|
|
4543
4674
|
}), a.pages.push({
|
|
4544
4675
|
contributionIds: c,
|
|
4545
4676
|
cursor: a.cursor,
|
|
4546
4677
|
next: o.next,
|
|
4547
|
-
returnedIds:
|
|
4678
|
+
returnedIds: Di(s)
|
|
4548
4679
|
}), a.lastCursor = a.cursor, a.next = o.next, --a.remainingRequests, o.total !== void 0 && (a.total = o.total), a.next === null ? a.remainingRequests = 0 : a.cursor = a.next, a.remainingRequests > 0 && r()) return this.result(a, "paused");
|
|
4549
4680
|
}
|
|
4550
4681
|
return this.result(a, "complete");
|
|
@@ -4552,9 +4683,9 @@ var xi = class {
|
|
|
4552
4683
|
createSession(e) {
|
|
4553
4684
|
let t = this.findUnderfilledPage(e), n = t < 0 ? [] : this.pages.slice(t), r = n[0];
|
|
4554
4685
|
if (!r) throw Error("Vibe has no underfilled provider page to reconcile.");
|
|
4555
|
-
let i = new Set(n.flatMap(({ contributionIds: e }) => e.map(
|
|
4686
|
+
let i = new Set(n.flatMap(({ contributionIds: e }) => e.map(Ti))), a = new Set(e.map(({ postId: e }) => Ti(e)).filter((e) => !i.has(e)));
|
|
4556
4687
|
return {
|
|
4557
|
-
appended: new Set(e.map(({ postId: e }) =>
|
|
4688
|
+
appended: new Set(e.map(({ postId: e }) => Ti(e))),
|
|
4558
4689
|
attributed: new Set(a),
|
|
4559
4690
|
cursor: r.cursor,
|
|
4560
4691
|
items: [],
|
|
@@ -4579,11 +4710,11 @@ var xi = class {
|
|
|
4579
4710
|
}
|
|
4580
4711
|
findUnderfilledPage(e) {
|
|
4581
4712
|
if (!this.enabled || this.pages.length === 0) return -1;
|
|
4582
|
-
let t = new Set(e.map(({ postId: e }) =>
|
|
4583
|
-
return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has(
|
|
4713
|
+
let t = new Set(e.map(({ postId: e }) => Ti(e)));
|
|
4714
|
+
return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has(Ti(e))).length < this.pageSize);
|
|
4584
4715
|
}
|
|
4585
4716
|
recordPage(e) {
|
|
4586
|
-
let t =
|
|
4717
|
+
let t = Ei(e.cursor), n = this.pages.findIndex(({ cursor: e }) => Ei(e) === t);
|
|
4587
4718
|
n >= 0 && (this.pages = this.pages.slice(0, n)), this.pages.push({
|
|
4588
4719
|
...e,
|
|
4589
4720
|
contributionIds: [...e.contributionIds],
|
|
@@ -4593,7 +4724,7 @@ var xi = class {
|
|
|
4593
4724
|
};
|
|
4594
4725
|
//#endregion
|
|
4595
4726
|
//#region src/core/activeItemRemoval.ts
|
|
4596
|
-
function
|
|
4727
|
+
function ki(e, t, n, r, i) {
|
|
4597
4728
|
let a = new Set(t.map(({ item: e }) => e.postId));
|
|
4598
4729
|
if (e.activeReelPostId === null || !a.has(e.activeReelPostId)) return;
|
|
4599
4730
|
let o = e.items[Math.max(n, 0)];
|
|
@@ -4606,7 +4737,7 @@ function Si(e, t, n, r, i) {
|
|
|
4606
4737
|
}
|
|
4607
4738
|
//#endregion
|
|
4608
4739
|
//#region src/core/exactMediaRemovalController.ts
|
|
4609
|
-
function
|
|
4740
|
+
function Ai(e, t) {
|
|
4610
4741
|
let [n, ...r] = t;
|
|
4611
4742
|
if (!n) throw Error("Vibe items must contain at least one media asset.");
|
|
4612
4743
|
return {
|
|
@@ -4615,10 +4746,10 @@ function Ci(e, t) {
|
|
|
4615
4746
|
items: r
|
|
4616
4747
|
};
|
|
4617
4748
|
}
|
|
4618
|
-
function
|
|
4749
|
+
function ji(e) {
|
|
4619
4750
|
if (!Number.isInteger(e.mediaIndex) || e.mediaIndex < 0) throw TypeError("Vibe mediaIndex must be a non-negative integer.");
|
|
4620
4751
|
}
|
|
4621
|
-
var
|
|
4752
|
+
var Mi = class {
|
|
4622
4753
|
generation = 0;
|
|
4623
4754
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
4624
4755
|
state;
|
|
@@ -4626,10 +4757,10 @@ var Ti = class {
|
|
|
4626
4757
|
this.options = e, this.state = e.state;
|
|
4627
4758
|
}
|
|
4628
4759
|
remove(e) {
|
|
4629
|
-
|
|
4760
|
+
ji(e);
|
|
4630
4761
|
let t = this.state.items.findIndex(({ postId: t }) => t === e.postId), n = this.state.items[t];
|
|
4631
4762
|
if (!n) return null;
|
|
4632
|
-
let r = [...
|
|
4763
|
+
let r = [...K(n)], i = r[e.mediaIndex];
|
|
4633
4764
|
if (!i) return null;
|
|
4634
4765
|
let a = Object.freeze({
|
|
4635
4766
|
media: i,
|
|
@@ -4643,7 +4774,7 @@ var Ti = class {
|
|
|
4643
4774
|
restored: !1
|
|
4644
4775
|
});
|
|
4645
4776
|
let o = this.state.mediaIndices.get(n.postId) ?? 0, s = this.isReelOpen() && this.state.activeReelPostId === n.postId, c = s && o === e.mediaIndex;
|
|
4646
|
-
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] =
|
|
4777
|
+
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = Ai(n, r), this.updateMediaIndexAfterRemoval(n.postId, e.mediaIndex, c), a) : (this.state.items.splice(t, 1), this.options.onPostRemoved(n.postId), this.state.mediaIndices.delete(n.postId), s && this.advanceFromRemovedPost(a, n), a);
|
|
4647
4778
|
}
|
|
4648
4779
|
reset() {
|
|
4649
4780
|
this.generation += 1;
|
|
@@ -4668,32 +4799,32 @@ var Ti = class {
|
|
|
4668
4799
|
return this.state.layout === "reel" || this.state.reelOrigin === "masonry";
|
|
4669
4800
|
}
|
|
4670
4801
|
restoreIntoPost(e, t) {
|
|
4671
|
-
let n = this.state.items[e], r = [...
|
|
4672
|
-
if (r.splice(i, 0, t.media), this.state.items[e] =
|
|
4802
|
+
let n = this.state.items[e], r = [...K(n)], i = Math.min(t.mediaIndex, r.length);
|
|
4803
|
+
if (r.splice(i, 0, t.media), this.state.items[e] = Ai(n, r), this.state.activeReelPostId !== t.postId) return;
|
|
4673
4804
|
let a = this.state.mediaIndices.get(t.postId) ?? 0;
|
|
4674
4805
|
a >= i && this.state.mediaIndices.set(t.postId, a + 1);
|
|
4675
4806
|
}
|
|
4676
4807
|
updateMediaIndexAfterRemoval(e, t, n) {
|
|
4677
4808
|
let r = this.state.items.find((t) => t.postId === e);
|
|
4678
4809
|
if (!r) return;
|
|
4679
|
-
let i =
|
|
4810
|
+
let i = K(r).length, a = this.state.mediaIndices.get(e) ?? 0, o = a;
|
|
4680
4811
|
n ? o = t < i ? t : 0 : t < a && (o = a - 1), this.state.mediaIndices.set(e, Math.min(o, i - 1));
|
|
4681
4812
|
}
|
|
4682
4813
|
};
|
|
4683
4814
|
//#endregion
|
|
4684
4815
|
//#region src/core/itemPlacement.ts
|
|
4685
|
-
function
|
|
4816
|
+
function Ni(e, t) {
|
|
4686
4817
|
let n = new Set(t);
|
|
4687
4818
|
return e.flatMap((e, t) => n.has(e.postId) ? [{
|
|
4688
4819
|
index: t,
|
|
4689
4820
|
item: e
|
|
4690
4821
|
}] : []);
|
|
4691
4822
|
}
|
|
4692
|
-
function
|
|
4823
|
+
function Pi(e, t) {
|
|
4693
4824
|
let n = new Set(t.map(({ item: e }) => e.postId));
|
|
4694
4825
|
return e.filter((e) => !n.has(e.postId));
|
|
4695
4826
|
}
|
|
4696
|
-
function
|
|
4827
|
+
function Fi(e, t) {
|
|
4697
4828
|
t.forEach(({ index: e }) => {
|
|
4698
4829
|
if (!Number.isInteger(e) || e < 0) throw Error("Vibe item restore indexes must be non-negative integers.");
|
|
4699
4830
|
});
|
|
@@ -4704,7 +4835,7 @@ function Oi(e, t) {
|
|
|
4704
4835
|
}
|
|
4705
4836
|
//#endregion
|
|
4706
4837
|
//#region src/core/itemRemovalController.ts
|
|
4707
|
-
var
|
|
4838
|
+
var Ii = 20, Li = class {
|
|
4708
4839
|
generation = 0;
|
|
4709
4840
|
historyLimit;
|
|
4710
4841
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
@@ -4713,7 +4844,7 @@ var ki = 20, Ai = class {
|
|
|
4713
4844
|
itemOrder;
|
|
4714
4845
|
stopItemsWatcher;
|
|
4715
4846
|
constructor(e) {
|
|
4716
|
-
this.options = e, this.historyLimit = e.historyLimit ??
|
|
4847
|
+
this.options = e, this.historyLimit = e.historyLimit ?? Ii, this.state = e.state, this.itemOrder = Z(this.state.items), this.stopItemsWatcher = P(() => this.state.items, (e) => this.appendUnknownItems(e), { flush: "sync" });
|
|
4717
4848
|
}
|
|
4718
4849
|
destroy() {
|
|
4719
4850
|
this.reset(), this.stopItemsWatcher();
|
|
@@ -4727,7 +4858,7 @@ var ki = 20, Ai = class {
|
|
|
4727
4858
|
let a = this.options.startRemoval(i, t);
|
|
4728
4859
|
if (a > 0 && await new Promise((e) => setTimeout(e, a)), this.metadata.get(r)?.generation !== this.generation) return r;
|
|
4729
4860
|
let o = this.state.items.findIndex((e) => e.postId === this.state.activeReelPostId), s = new Set(n.map(({ item: e }) => e.postId)), c = o < 0 ? 0 : this.state.items.slice(0, o).filter(({ postId: e }) => s.has(e)).length, l = Math.max(o - c, 0);
|
|
4730
|
-
return this.state.items =
|
|
4861
|
+
return this.state.items = Pi(this.state.items, n), this.options.onItemsRemoved(r, n, l), this.record(r), r;
|
|
4731
4862
|
}
|
|
4732
4863
|
reset() {
|
|
4733
4864
|
this.generation += 1, this.history = [], this.itemOrder = [];
|
|
@@ -4738,7 +4869,7 @@ var ki = 20, Ai = class {
|
|
|
4738
4869
|
this.restoreRemoval(t);
|
|
4739
4870
|
return;
|
|
4740
4871
|
}
|
|
4741
|
-
let n = new Set(
|
|
4872
|
+
let n = new Set(Z(this.state.items)), r = e.filter(({ item: e }) => n.has(e.postId) ? !1 : (n.add(e.postId), !0)), i = Fi(this.state.items, r);
|
|
4742
4873
|
this.registerExternalPlacements(r), this.state.items = i, r.length > 0 && this.options.onRemovalRestored(r);
|
|
4743
4874
|
}
|
|
4744
4875
|
restoreRemoval(e) {
|
|
@@ -4758,13 +4889,13 @@ var ki = 20, Ai = class {
|
|
|
4758
4889
|
}
|
|
4759
4890
|
appendUnknownItems(e) {
|
|
4760
4891
|
let t = new Set(this.itemOrder);
|
|
4761
|
-
|
|
4892
|
+
Z(e).forEach((e) => {
|
|
4762
4893
|
t.has(e) || (this.itemOrder.push(e), t.add(e));
|
|
4763
4894
|
});
|
|
4764
4895
|
}
|
|
4765
4896
|
collectOrderedPlacements(e) {
|
|
4766
4897
|
let t = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
4767
|
-
return
|
|
4898
|
+
return Ni(this.state.items, e).map((e) => ({
|
|
4768
4899
|
index: t.get(e.item.postId) ?? e.index,
|
|
4769
4900
|
item: e.item
|
|
4770
4901
|
}));
|
|
@@ -4790,12 +4921,12 @@ var ki = 20, Ai = class {
|
|
|
4790
4921
|
t >= 0 && this.history.splice(t, 1);
|
|
4791
4922
|
}
|
|
4792
4923
|
restoreOrderedPlacements(e) {
|
|
4793
|
-
let t = new Set(
|
|
4924
|
+
let t = new Set(Z(this.state.items)), n = e.map(({ item: e }) => e).filter(({ postId: e }) => !t.has(e));
|
|
4794
4925
|
if (n.length === 0) return !1;
|
|
4795
4926
|
let r = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
4796
4927
|
return this.state.items = [...this.state.items, ...n].sort((e, t) => (r.get(e.postId) ?? 2 ** 53 - 1) - (r.get(t.postId) ?? 2 ** 53 - 1)), !0;
|
|
4797
4928
|
}
|
|
4798
|
-
},
|
|
4929
|
+
}, Ri = class {
|
|
4799
4930
|
forward = null;
|
|
4800
4931
|
forwardPromise = null;
|
|
4801
4932
|
forwardVersion = 0;
|
|
@@ -4891,7 +5022,7 @@ var ki = 20, Ai = class {
|
|
|
4891
5022
|
}
|
|
4892
5023
|
}
|
|
4893
5024
|
}
|
|
4894
|
-
},
|
|
5025
|
+
}, zi = class {
|
|
4895
5026
|
generation = 0;
|
|
4896
5027
|
pending = Promise.resolve();
|
|
4897
5028
|
constructor(e) {
|
|
@@ -4908,7 +5039,7 @@ var ki = 20, Ai = class {
|
|
|
4908
5039
|
if (!n) return;
|
|
4909
5040
|
let r = t.mediaIndices.get(e.postId) ?? 0;
|
|
4910
5041
|
if (e.mediaIndex === r) {
|
|
4911
|
-
if (
|
|
5042
|
+
if (K(n).length > 1) {
|
|
4912
5043
|
await this.options.transitionMedia(1);
|
|
4913
5044
|
return;
|
|
4914
5045
|
}
|
|
@@ -4941,24 +5072,24 @@ var ki = 20, Ai = class {
|
|
|
4941
5072
|
};
|
|
4942
5073
|
//#endregion
|
|
4943
5074
|
//#region src/core/removalControllers.ts
|
|
4944
|
-
function
|
|
4945
|
-
let t = new
|
|
5075
|
+
function Bi(e) {
|
|
5076
|
+
let t = new Ri(e), n = new zi({
|
|
4946
5077
|
state: e.state,
|
|
4947
5078
|
transitionMedia: (t) => e.surface()?.transitionActiveReelMedia(t) ?? Promise.resolve(!1),
|
|
4948
5079
|
transitionPost: (t) => e.surface()?.transitionActiveReelPost(t) ?? Promise.resolve(!1)
|
|
4949
5080
|
});
|
|
4950
5081
|
return {
|
|
4951
|
-
exactMediaRemoval: new
|
|
5082
|
+
exactMediaRemoval: new Mi({
|
|
4952
5083
|
onActivate: e.onActivate,
|
|
4953
5084
|
onPostRemoved: (t) => e.onItemsRemoved([t]),
|
|
4954
5085
|
onPostRestored: (t) => e.onItemsRestored([t]),
|
|
4955
5086
|
reelForward: t,
|
|
4956
5087
|
state: e.state
|
|
4957
5088
|
}),
|
|
4958
|
-
itemRemoval: new
|
|
5089
|
+
itemRemoval: new Li({
|
|
4959
5090
|
historyLimit: e.historyLimit,
|
|
4960
5091
|
onItemsRemoved: (n, r, i) => {
|
|
4961
|
-
e.onItemsRemoved(r.map(({ item: e }) => e.postId)),
|
|
5092
|
+
e.onItemsRemoved(r.map(({ item: e }) => e.postId)), ki(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
|
|
4962
5093
|
},
|
|
4963
5094
|
onRemovalRestored: (n) => {
|
|
4964
5095
|
e.onItemsRestored(n.map(({ item: e }) => e.postId));
|
|
@@ -4973,17 +5104,17 @@ function Ni(e) {
|
|
|
4973
5104
|
reelRemoval: n
|
|
4974
5105
|
};
|
|
4975
5106
|
}
|
|
4976
|
-
var
|
|
4977
|
-
function
|
|
5107
|
+
var Vi = 1.5;
|
|
5108
|
+
function Hi(e) {
|
|
4978
5109
|
let t = Math.min(e.screenWidth, e.screenHeight);
|
|
4979
5110
|
if (t > 0 && t < 600) return !0;
|
|
4980
|
-
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n *
|
|
5111
|
+
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * Vi;
|
|
4981
5112
|
return !e.hasHover && n > 0 && n < 600 && r;
|
|
4982
5113
|
}
|
|
4983
|
-
function
|
|
4984
|
-
return
|
|
5114
|
+
function Ui(e) {
|
|
5115
|
+
return Hi(e) ? "reel" : "masonry";
|
|
4985
5116
|
}
|
|
4986
|
-
function
|
|
5117
|
+
function Wi(e) {
|
|
4987
5118
|
let t = e.ownerDocument.defaultView, n = e.ownerDocument.documentElement;
|
|
4988
5119
|
return {
|
|
4989
5120
|
hasHover: typeof t?.matchMedia == "function" && t.matchMedia("(hover: hover)").matches,
|
|
@@ -4993,15 +5124,15 @@ function Li(e) {
|
|
|
4993
5124
|
viewportWidth: n.clientWidth
|
|
4994
5125
|
};
|
|
4995
5126
|
}
|
|
4996
|
-
function
|
|
4997
|
-
return
|
|
5127
|
+
function Gi(e) {
|
|
5128
|
+
return Hi(Wi(e));
|
|
4998
5129
|
}
|
|
4999
|
-
function
|
|
5000
|
-
return
|
|
5130
|
+
function Ki(e) {
|
|
5131
|
+
return Ui(Wi(e));
|
|
5001
5132
|
}
|
|
5002
5133
|
//#endregion
|
|
5003
5134
|
//#region src/core/responsiveLayoutController.ts
|
|
5004
|
-
var
|
|
5135
|
+
var qi = class {
|
|
5005
5136
|
layoutMode;
|
|
5006
5137
|
resizeObserver = null;
|
|
5007
5138
|
target = null;
|
|
@@ -5026,10 +5157,10 @@ var Bi = class {
|
|
|
5026
5157
|
}
|
|
5027
5158
|
handleResponsiveLayout = () => {
|
|
5028
5159
|
if (!this.target) return;
|
|
5029
|
-
let e =
|
|
5030
|
-
this.state.phoneMode =
|
|
5160
|
+
let e = Ki(this.target);
|
|
5161
|
+
this.state.phoneMode = Gi(this.target), this.state.reelInfoSheetOverlay = this.state.phoneMode, this.state.reelMediaSource = this.state.phoneMode ? "mobile" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
|
|
5031
5162
|
};
|
|
5032
|
-
},
|
|
5163
|
+
}, Ji = class {
|
|
5033
5164
|
state;
|
|
5034
5165
|
constructor(e) {
|
|
5035
5166
|
this.options = e, this.state = T(Jt({
|
|
@@ -5043,7 +5174,7 @@ var Bi = class {
|
|
|
5043
5174
|
set(e, t = !1) {
|
|
5044
5175
|
Object.assign(this.state, Jt(e, this.state)), t && this.options.onReelAudioStateChange?.(this.get());
|
|
5045
5176
|
}
|
|
5046
|
-
},
|
|
5177
|
+
}, Yi = class {
|
|
5047
5178
|
routedReelPostId = null;
|
|
5048
5179
|
reelRouteIsActive = !1;
|
|
5049
5180
|
constructor(e, t) {
|
|
@@ -5073,30 +5204,30 @@ var Bi = class {
|
|
|
5073
5204
|
};
|
|
5074
5205
|
//#endregion
|
|
5075
5206
|
//#region src/core/updateItems.ts
|
|
5076
|
-
function
|
|
5207
|
+
function Xi(e) {
|
|
5077
5208
|
return String(e);
|
|
5078
5209
|
}
|
|
5079
|
-
function
|
|
5080
|
-
let n =
|
|
5210
|
+
function Zi(e, t) {
|
|
5211
|
+
let n = K(t).length;
|
|
5081
5212
|
(e.mediaIndices.get(t.postId) ?? 0) >= n && e.mediaIndices.set(t.postId, Math.max(0, n - 1));
|
|
5082
5213
|
}
|
|
5083
|
-
function
|
|
5214
|
+
function Qi(e, t) {
|
|
5084
5215
|
let n = /* @__PURE__ */ new Map();
|
|
5085
|
-
if (t.forEach((e) => n.set(
|
|
5216
|
+
if (t.forEach((e) => n.set(Xi(e.postId), e)), n.size === 0) return [];
|
|
5086
5217
|
let r = [], i = e.items.map((t) => {
|
|
5087
|
-
let i = n.get(
|
|
5218
|
+
let i = n.get(Xi(t.postId));
|
|
5088
5219
|
if (!i) return t;
|
|
5089
5220
|
let a = {
|
|
5090
5221
|
...i,
|
|
5091
5222
|
postId: t.postId
|
|
5092
5223
|
};
|
|
5093
|
-
return
|
|
5224
|
+
return Zi(e, a), e.reelForwardItem && Xi(e.reelForwardItem.postId) === Xi(t.postId) && (e.reelForwardItem = a), r.push(t.postId), a;
|
|
5094
5225
|
});
|
|
5095
5226
|
return r.length > 0 && (e.items = i), r;
|
|
5096
5227
|
}
|
|
5097
5228
|
//#endregion
|
|
5098
5229
|
//#region src/core/createVibe.ts
|
|
5099
|
-
var
|
|
5230
|
+
var $i = class {
|
|
5100
5231
|
app = null;
|
|
5101
5232
|
autoScroll;
|
|
5102
5233
|
autofillController;
|
|
@@ -5120,25 +5251,25 @@ var Ki = class {
|
|
|
5120
5251
|
state;
|
|
5121
5252
|
pageReplacement;
|
|
5122
5253
|
constructor(e) {
|
|
5123
|
-
this.options = e,
|
|
5254
|
+
this.options = e, bi(e);
|
|
5124
5255
|
let t = e.layout ?? "masonry";
|
|
5125
|
-
this.state = T(
|
|
5256
|
+
this.state = T(_i(e, t)), this.reelAudio = new Ji(e), this.lastLoadedCursor = e.initialPage ? mr(e.initialPage) : null, this.notificationItems = ie(this.state), this.autoScroll = new Vr({
|
|
5126
5257
|
getScrollElement: () => this.surface?.getAutoScrollElement() ?? null,
|
|
5127
5258
|
state: this.state.autoScroll
|
|
5128
|
-
}), this.autofillController = new
|
|
5259
|
+
}), this.autofillController = new Fr({
|
|
5129
5260
|
cancelRequest: () => this.cancelRequest(!this.pageReplacement?.isActive()),
|
|
5130
5261
|
onLastCursor: (e) => this.setCurrentCursor(e),
|
|
5131
5262
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
5132
5263
|
options: e.autofill,
|
|
5133
5264
|
state: this.state
|
|
5134
|
-
}), this.removalReconciliation = new
|
|
5265
|
+
}), this.removalReconciliation = new Oi(e), this.removalReconciliation.recordInitialPage(e.initialPage), this.fillController = new ci({
|
|
5135
5266
|
filterItems: (e) => this.removalReconciliation.filterItems(e),
|
|
5136
5267
|
fill: e.fill,
|
|
5137
5268
|
loadPage: e.loadPage ? (e) => this.loadFilteredPage(e) : void 0,
|
|
5138
5269
|
needsFrontendPreparation: () => this.removalReconciliation.needsReconciliation(this.state.items),
|
|
5139
5270
|
onLastCursor: (e) => this.setCurrentCursor(e),
|
|
5140
5271
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
5141
|
-
prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) =>
|
|
5272
|
+
prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) => li({
|
|
5142
5273
|
controller: this.removalReconciliation,
|
|
5143
5274
|
isCurrent: t,
|
|
5144
5275
|
loadPage: e.loadPage,
|
|
@@ -5148,8 +5279,8 @@ var Ki = class {
|
|
|
5148
5279
|
state: this.state
|
|
5149
5280
|
}),
|
|
5150
5281
|
state: this.state
|
|
5151
|
-
}), this.routing = new
|
|
5152
|
-
let n =
|
|
5282
|
+
}), this.routing = new Yi(e.routing, this.state);
|
|
5283
|
+
let n = Bi({
|
|
5153
5284
|
historyLimit: e.removalHistoryLimit,
|
|
5154
5285
|
onActivate: (e) => this.setActiveReelPost(e),
|
|
5155
5286
|
onCloseReel: () => this.closeMasonryReel(),
|
|
@@ -5159,29 +5290,29 @@ var Ki = class {
|
|
|
5159
5290
|
state: this.state,
|
|
5160
5291
|
surface: () => this.surface
|
|
5161
5292
|
});
|
|
5162
|
-
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.pageReplacement = new
|
|
5293
|
+
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.pageReplacement = new Ci({
|
|
5163
5294
|
state: this.state,
|
|
5164
5295
|
surface: () => this.surface,
|
|
5165
5296
|
prepare: async () => {
|
|
5166
|
-
this.cancelRequest(!1),
|
|
5297
|
+
this.cancelRequest(!1), jr(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill();
|
|
5167
5298
|
},
|
|
5168
5299
|
commit: (e) => {
|
|
5169
|
-
this.resetFeedVisit(), this.setCurrentCursor(
|
|
5300
|
+
this.resetFeedVisit(), this.setCurrentCursor(mr(e)), this.removalReconciliation.recordInitialPage(e), this.state.reelOrigin === null && this.routing.syncFeed();
|
|
5170
5301
|
}
|
|
5171
|
-
}), this.responsiveLayout = new
|
|
5302
|
+
}), this.responsiveLayout = new qi(t, this.state, () => {
|
|
5172
5303
|
this.routing.syncFeed();
|
|
5173
5304
|
}), this.startStateNotifications();
|
|
5174
5305
|
}
|
|
5175
5306
|
async mount() {
|
|
5176
5307
|
if (this.app) throw Error("Vibe is already mounted.");
|
|
5177
5308
|
this.startStateNotifications();
|
|
5178
|
-
let e =
|
|
5179
|
-
this.responsiveLayout.mount(e), this.app = i(
|
|
5309
|
+
let e = xi(this.options.target);
|
|
5310
|
+
this.responsiveLayout.mount(e), this.app = i(or, {
|
|
5180
5311
|
canRetryEnd: !!this.options.loadPage,
|
|
5181
5312
|
cardFooter: this.options.cardFooter,
|
|
5182
5313
|
cardHeader: this.options.cardHeader,
|
|
5183
5314
|
feedFooter: this.options.feedFooter,
|
|
5184
|
-
feedFooterActions:
|
|
5315
|
+
feedFooterActions: ui(this),
|
|
5185
5316
|
mediaCard: this.options.mediaCard,
|
|
5186
5317
|
masonry: this.options.masonry,
|
|
5187
5318
|
onMediaFullyVisible: this.options.onMediaFullyVisible,
|
|
@@ -5208,7 +5339,7 @@ var Ki = class {
|
|
|
5208
5339
|
onRetryForward: () => {
|
|
5209
5340
|
this.retryReelForward();
|
|
5210
5341
|
}
|
|
5211
|
-
}), this.surface = this.app.mount(e), this.autoScroll.mount(), await
|
|
5342
|
+
}), this.surface = this.app.mount(e), this.autoScroll.mount(), await Kr(this.options.restoreBacklog, (e) => this.appendPage(e), (e) => {
|
|
5212
5343
|
this.restoreController = e;
|
|
5213
5344
|
}), !this.options.initialPage && this.state.items.length === 0 ? await this.reload() : this.options.autofill && this.state.autofill.status === "idle" && !this.fillController.isActive() && !this.state.loadMoreLocked && await this.startInitialAutofill();
|
|
5214
5345
|
}
|
|
@@ -5216,7 +5347,7 @@ var Ki = class {
|
|
|
5216
5347
|
this.restoreController?.abort(), this.restoreController = null, this.autoScroll.destroy(), this.fillController.destroy(), this.cancelRequest(), this.reelForward.reset(), this.reelRemoval.reset(), this.exactMediaRemoval.reset(), this.itemRemoval.destroy(), this.removalReconciliation.reset(), this.responsiveLayout.destroy(), this.stopStateWatcher?.(), this.stopStateWatcher = null, this.app?.unmount(), this.app = null, this.surface = null;
|
|
5217
5348
|
}
|
|
5218
5349
|
getState() {
|
|
5219
|
-
return
|
|
5350
|
+
return oe(this.state, this.notificationItems.value);
|
|
5220
5351
|
}
|
|
5221
5352
|
getReelAudioState() {
|
|
5222
5353
|
return this.reelAudio.get();
|
|
@@ -5243,7 +5374,7 @@ var Ki = class {
|
|
|
5243
5374
|
return this.itemRemoval.restoreRemoval(e);
|
|
5244
5375
|
}
|
|
5245
5376
|
updateItems(e) {
|
|
5246
|
-
return
|
|
5377
|
+
return Qi(this.state, e);
|
|
5247
5378
|
}
|
|
5248
5379
|
retryReelForward() {
|
|
5249
5380
|
return this.reelForward.retry();
|
|
@@ -5282,7 +5413,7 @@ var Ki = class {
|
|
|
5282
5413
|
this.autoScroll.setSpeed(e);
|
|
5283
5414
|
}
|
|
5284
5415
|
applyAutofillUpdate(e) {
|
|
5285
|
-
let t =
|
|
5416
|
+
let t = Wr(this.options.autofill, this.state, e);
|
|
5286
5417
|
return t && this.autofillController.syncCountdown(), t;
|
|
5287
5418
|
}
|
|
5288
5419
|
cancelAutofill() {
|
|
@@ -5293,7 +5424,7 @@ var Ki = class {
|
|
|
5293
5424
|
await this.cancelFill();
|
|
5294
5425
|
return;
|
|
5295
5426
|
}
|
|
5296
|
-
if (
|
|
5427
|
+
if (jr(this.state.autofill)) {
|
|
5297
5428
|
await this.cancelAutofill();
|
|
5298
5429
|
return;
|
|
5299
5430
|
}
|
|
@@ -5306,12 +5437,12 @@ var Ki = class {
|
|
|
5306
5437
|
}
|
|
5307
5438
|
async fill(e) {
|
|
5308
5439
|
if (!(this.state.loadMoreLocked || this.pageReplacement.isActive())) {
|
|
5309
|
-
if (this.pendingRequest ||
|
|
5440
|
+
if (this.pendingRequest || jr(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
|
|
5310
5441
|
await this.fillController.start(e);
|
|
5311
5442
|
}
|
|
5312
5443
|
}
|
|
5313
5444
|
restoreAutofillSession(e) {
|
|
5314
|
-
let t =
|
|
5445
|
+
let t = Gr(this.options.autofill, this.state, e);
|
|
5315
5446
|
return t && this.autofillController.syncCountdown(), t;
|
|
5316
5447
|
}
|
|
5317
5448
|
restoreFillSession(e) {
|
|
@@ -5321,7 +5452,7 @@ var Ki = class {
|
|
|
5321
5452
|
return this.startLoadMore(() => this.loadNextSequence());
|
|
5322
5453
|
}
|
|
5323
5454
|
appendPage(e) {
|
|
5324
|
-
|
|
5455
|
+
hr(e, this.state, this.removalReconciliation, (e) => this.setCurrentCursor(e));
|
|
5325
5456
|
}
|
|
5326
5457
|
replenishAfterRemoval(e = !0) {
|
|
5327
5458
|
return this.startLoadMore(() => this.replenishAfterRemovalSequence(e));
|
|
@@ -5329,7 +5460,7 @@ var Ki = class {
|
|
|
5329
5460
|
async startLoadMore(e) {
|
|
5330
5461
|
if (this.pageReplacement.isActive()) return;
|
|
5331
5462
|
if (this.pendingRequest) return this.pendingRequest;
|
|
5332
|
-
if (this.state.loadMoreLocked ||
|
|
5463
|
+
if (this.state.loadMoreLocked || jr(this.state.autofill) || this.fillController.isActive() || !this.options.loadPage || this.state.next === null && !this.removalReconciliation.needsReconciliation(this.state.items)) return;
|
|
5333
5464
|
this.state.isLoadingMore = !0, this.state.nextPageError = null;
|
|
5334
5465
|
let t = e();
|
|
5335
5466
|
return this.pendingRequest = t, t.finally(() => {
|
|
@@ -5347,15 +5478,15 @@ var Ki = class {
|
|
|
5347
5478
|
}
|
|
5348
5479
|
async replaceFeed(e, t) {
|
|
5349
5480
|
if (!this.options.loadPage) throw Error(`Vibe cannot ${t} without loadPage.`);
|
|
5350
|
-
return
|
|
5481
|
+
return jr(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.resetFeedVisit(), this.surface?.resetMediaLifecycle(), this.state.error = null, this.state.current = null, this.state.isLoading = !0, this.state.items = [], this.state.next = null, this.state.nextPageError = null, this.state.total = null, this.startRequest(e, !1);
|
|
5351
5482
|
}
|
|
5352
5483
|
resetFeedVisit() {
|
|
5353
|
-
this.state.autofill =
|
|
5484
|
+
this.state.autofill = Ar(this.options.autofill, void 0, !1), this.fillController.reset(), this.reelForward.reset(), this.reelRemoval.reset(), this.exactMediaRemoval.reset(), this.itemRemoval.reset(), this.removalReconciliation.reset();
|
|
5354
5485
|
}
|
|
5355
5486
|
async loadFilteredPage(e) {
|
|
5356
5487
|
let t = this.options.loadPage;
|
|
5357
5488
|
if (!t) throw Error("Vibe cannot load a page without loadPage.");
|
|
5358
|
-
let n =
|
|
5489
|
+
let n = sr(await t(e));
|
|
5359
5490
|
return {
|
|
5360
5491
|
...n,
|
|
5361
5492
|
items: this.removalReconciliation.filterItems(n.items)
|
|
@@ -5375,7 +5506,7 @@ var Ki = class {
|
|
|
5375
5506
|
let n = ++this.requestVersion, r = new AbortController();
|
|
5376
5507
|
this.abortController = r;
|
|
5377
5508
|
try {
|
|
5378
|
-
let i = await
|
|
5509
|
+
let i = await li({
|
|
5379
5510
|
controller: this.removalReconciliation,
|
|
5380
5511
|
isCurrent: () => n === this.requestVersion,
|
|
5381
5512
|
loadPage: t,
|
|
@@ -5395,14 +5526,14 @@ var Ki = class {
|
|
|
5395
5526
|
async retryEnd() {
|
|
5396
5527
|
if (!this.pageReplacement.isActive()) {
|
|
5397
5528
|
if (this.pendingRequest) return this.pendingRequest;
|
|
5398
|
-
if (!this.state.loadMoreLocked && !(
|
|
5529
|
+
if (!this.state.loadMoreLocked && !(jr(this.state.autofill) || this.fillController.isActive()) && !(this.state.next !== null || !this.options.loadPage)) return this.state.isLoadingMore = !0, this.state.nextPageError = null, this.startRequest(this.lastLoadedCursor, !0);
|
|
5399
5530
|
}
|
|
5400
5531
|
}
|
|
5401
5532
|
setInfiniteScroll(e) {
|
|
5402
5533
|
this.state.infiniteScroll = e, e && v(() => this.surface?.loadIfNearBottom());
|
|
5403
5534
|
}
|
|
5404
5535
|
setLoadMoreLocked(e) {
|
|
5405
|
-
|
|
5536
|
+
wi(this.state, e, {
|
|
5406
5537
|
getPending: () => this.pendingRequest,
|
|
5407
5538
|
hasPendingSession: () => this.removalReconciliation.hasPendingSession(),
|
|
5408
5539
|
loadNext: () => this.loadNext(),
|
|
@@ -5415,10 +5546,10 @@ var Ki = class {
|
|
|
5415
5546
|
this.state.total = e;
|
|
5416
5547
|
}
|
|
5417
5548
|
setReelAutoAdvance(e) {
|
|
5418
|
-
|
|
5549
|
+
mi(this.state.reelAutoAdvance, e);
|
|
5419
5550
|
}
|
|
5420
5551
|
setReelInfoSheet(e) {
|
|
5421
|
-
|
|
5552
|
+
gi(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
|
|
5422
5553
|
}
|
|
5423
5554
|
setLayout(e) {
|
|
5424
5555
|
this.responsiveLayout.setLayout(e);
|
|
@@ -5438,7 +5569,7 @@ var Ki = class {
|
|
|
5438
5569
|
async fetchPage(e, t) {
|
|
5439
5570
|
if (!this.options.loadPage) return;
|
|
5440
5571
|
let n = ++this.requestVersion, r = new AbortController();
|
|
5441
|
-
this.abortController = r, await
|
|
5572
|
+
this.abortController = r, await Si({
|
|
5442
5573
|
append: t,
|
|
5443
5574
|
autofillController: this.autofillController,
|
|
5444
5575
|
cursor: e,
|
|
@@ -5460,7 +5591,7 @@ var Ki = class {
|
|
|
5460
5591
|
startInitialAutofill() {
|
|
5461
5592
|
let e = ++this.requestVersion, t = new AbortController(), n = this.autofillController.beginCycle();
|
|
5462
5593
|
this.abortController = t, this.state.isLoadingMore = !0;
|
|
5463
|
-
let r =
|
|
5594
|
+
let r = qr({
|
|
5464
5595
|
cycleId: n,
|
|
5465
5596
|
isCurrent: () => e === this.requestVersion,
|
|
5466
5597
|
onCollection: (t) => this.autofillController.captureCollection(t, e === this.requestVersion),
|
|
@@ -5478,11 +5609,11 @@ var Ki = class {
|
|
|
5478
5609
|
}
|
|
5479
5610
|
startStateNotifications() {
|
|
5480
5611
|
let e = this.options.onStateChange;
|
|
5481
|
-
!e || this.stopStateWatcher || (this.stopStateWatcher =
|
|
5612
|
+
!e || this.stopStateWatcher || (this.stopStateWatcher = ae(this.state, this.notificationItems, e));
|
|
5482
5613
|
}
|
|
5483
5614
|
setCurrentCursor(e) {
|
|
5484
5615
|
this.lastLoadedCursor = this.state.current = e;
|
|
5485
5616
|
}
|
|
5486
|
-
},
|
|
5617
|
+
}, ea = (e) => new $i(e);
|
|
5487
5618
|
//#endregion
|
|
5488
|
-
export {
|
|
5619
|
+
export { ea as createVibe };
|