@wyxos/vibe 5.17.1 → 5.18.0
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/components/ReelEntrySpinner.vue.d.ts +3 -0
- package/lib/components/VibeSurface.vue.d.ts +1 -0
- package/lib/components/useReelEntryReveal.d.ts +10 -0
- package/lib/core/feed.d.ts +2 -0
- package/lib/core/mediaPreview.d.ts +2 -2
- package/lib/core/reelViewer.d.ts +4 -0
- package/lib/index.cjs +2 -2
- package/lib/index.js +706 -635
- package/lib/instance.d.ts +49 -0
- package/lib/style.css +1 -1
- package/lib/types.d.ts +1 -46
- package/package.json +11 -14
- package/README.md +0 -845
package/lib/index.js
CHANGED
|
@@ -63,21 +63,21 @@ function V(e) {
|
|
|
63
63
|
function H(e, t) {
|
|
64
64
|
return Math.min(e.items.length, Math.max(0, t));
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function te(e, t) {
|
|
67
67
|
return V(e)[H(e, t)] ?? e;
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function U(e, t) {
|
|
70
70
|
return `${String(e)}:${t}`;
|
|
71
71
|
}
|
|
72
72
|
//#endregion
|
|
73
73
|
//#region src/core/runtime.ts
|
|
74
|
-
function
|
|
74
|
+
function W(e) {
|
|
75
75
|
return r(() => Object.freeze([...e.items]));
|
|
76
76
|
}
|
|
77
|
-
function
|
|
78
|
-
return n(
|
|
77
|
+
function G(e, t, n) {
|
|
78
|
+
return n(ne(e, t.value)), O(() => ne(e, t.value), n, { flush: "post" });
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function ne(e, t = [...e.items]) {
|
|
81
81
|
return {
|
|
82
82
|
activeReelPostId: e.activeReelPostId,
|
|
83
83
|
autoScroll: { ...e.autoScroll },
|
|
@@ -107,17 +107,17 @@ function te(e, t = [...e.items]) {
|
|
|
107
107
|
}
|
|
108
108
|
//#endregion
|
|
109
109
|
//#region src/components/GalleryFooter.vue?vue&type=script&setup=true&lang.ts
|
|
110
|
-
var
|
|
110
|
+
var K = {
|
|
111
111
|
key: 0,
|
|
112
112
|
class: "gallery-footer"
|
|
113
|
-
},
|
|
113
|
+
}, q = {
|
|
114
114
|
key: 0,
|
|
115
115
|
class: "load-more-status",
|
|
116
116
|
role: "status"
|
|
117
|
-
},
|
|
117
|
+
}, re = ["disabled"], ie = {
|
|
118
118
|
key: 2,
|
|
119
119
|
class: "end-feed"
|
|
120
|
-
},
|
|
120
|
+
}, ae = ["disabled"], J = /* @__PURE__ */ d({
|
|
121
121
|
__name: "GalleryFooter",
|
|
122
122
|
props: {
|
|
123
123
|
canRetryEnd: { type: Boolean },
|
|
@@ -133,14 +133,14 @@ var q = {
|
|
|
133
133
|
function i() {
|
|
134
134
|
n.loadMoreLocked || (n.hasNext ? r("loadMore") : r("retryEnd"));
|
|
135
135
|
}
|
|
136
|
-
return (t, n) => e.isLoading || e.hasError || e.hasNext && e.showLoadMore || !e.hasNext && e.canRetryEnd ? (b(), s("footer",
|
|
136
|
+
return (t, n) => e.isLoading || e.hasError || e.hasNext && e.showLoadMore || !e.hasNext && e.canRetryEnd ? (b(), s("footer", K, [e.isLoading ? (b(), s("p", q, " Loading more… ")) : e.hasError || e.hasNext && e.showLoadMore ? (b(), s("button", {
|
|
137
137
|
key: 1,
|
|
138
138
|
"data-test": "load-more",
|
|
139
139
|
class: "load-more-button",
|
|
140
140
|
type: "button",
|
|
141
141
|
disabled: e.loadMoreLocked,
|
|
142
142
|
onClick: i
|
|
143
|
-
}, T(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9,
|
|
143
|
+
}, T(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9, re)) : (b(), s("div", ie, [n[1] ||= c("p", {
|
|
144
144
|
class: "end-feed-message",
|
|
145
145
|
role: "status"
|
|
146
146
|
}, " You've reached the end. ", -1), c("button", {
|
|
@@ -149,7 +149,7 @@ var q = {
|
|
|
149
149
|
type: "button",
|
|
150
150
|
disabled: e.loadMoreLocked,
|
|
151
151
|
onClick: n[0] ||= (e) => t.$emit("retryEnd")
|
|
152
|
-
}, " Check for more ", 8,
|
|
152
|
+
}, " Check for more ", 8, ae)]))])) : o("", !0);
|
|
153
153
|
}
|
|
154
154
|
}), oe = /* @__PURE__ */ d({
|
|
155
155
|
__name: "FeedFooter",
|
|
@@ -188,7 +188,7 @@ var q = {
|
|
|
188
188
|
"can-retry-end",
|
|
189
189
|
"show-load-more",
|
|
190
190
|
"state"
|
|
191
|
-
])) : (b(), a(
|
|
191
|
+
])) : (b(), a(J, {
|
|
192
192
|
key: 1,
|
|
193
193
|
"can-retry-end": e.canRetryEnd,
|
|
194
194
|
"has-error": e.hasError,
|
|
@@ -246,22 +246,22 @@ var q = {
|
|
|
246
246
|
])) : o("", !0)], 8, se));
|
|
247
247
|
}
|
|
248
248
|
});
|
|
249
|
-
function
|
|
249
|
+
function ue(e, t = 240) {
|
|
250
250
|
return e.scrollHeight - e.scrollTop - e.clientHeight <= t;
|
|
251
251
|
}
|
|
252
252
|
//#endregion
|
|
253
253
|
//#region src/core/masonry.ts
|
|
254
|
-
function
|
|
254
|
+
function Y(e) {
|
|
255
255
|
let t = e.preview?.width ?? e.width, n = e.preview?.height ?? e.height;
|
|
256
256
|
return !t || !n || t <= 0 || n <= 0 ? 1 : n / t;
|
|
257
257
|
}
|
|
258
|
-
function
|
|
258
|
+
function X(e) {
|
|
259
259
|
return e.reduce((t, n, r) => n < e[t] ? r : t, 0);
|
|
260
260
|
}
|
|
261
|
-
function
|
|
261
|
+
function de(e) {
|
|
262
262
|
return Math.max(0, e.containerHeight) + Math.max(0, e.gap);
|
|
263
263
|
}
|
|
264
|
-
var
|
|
264
|
+
var Z = .8, fe = .5;
|
|
265
265
|
function pe(e, t, n) {
|
|
266
266
|
let r = Math.max(0, n.viewportHeight);
|
|
267
267
|
if (r === 0) return [];
|
|
@@ -269,7 +269,7 @@ function pe(e, t, n) {
|
|
|
269
269
|
return t.filter((t) => {
|
|
270
270
|
let n = e[t];
|
|
271
271
|
if (!n || n.height <= 0) return !1;
|
|
272
|
-
let o = Math.max(0, Math.min(n.y + n.height, a) - Math.max(n.y, i)), s = n.height <= r ? n.height : r *
|
|
272
|
+
let o = Math.max(0, Math.min(n.y + n.height, a) - Math.max(n.y, i)), s = n.height <= r ? n.height : r * Z;
|
|
273
273
|
return o + fe >= s;
|
|
274
274
|
});
|
|
275
275
|
}
|
|
@@ -284,7 +284,7 @@ function Q(e, t) {
|
|
|
284
284
|
};
|
|
285
285
|
}
|
|
286
286
|
function me(e, t, n) {
|
|
287
|
-
let r =
|
|
287
|
+
let r = X(t), i = n.itemWidth * Y(e) + n.additionalHeight, a = {
|
|
288
288
|
x: r * (n.itemWidth + n.gap),
|
|
289
289
|
y: t[r],
|
|
290
290
|
width: n.itemWidth,
|
|
@@ -753,22 +753,18 @@ var Me = ["aria-hidden"], Ne = [
|
|
|
753
753
|
y2: "15",
|
|
754
754
|
key: "5ykzw1"
|
|
755
755
|
}]
|
|
756
|
-
])
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
500: "Server error"
|
|
762
|
-
};
|
|
763
|
-
function tt(e) {
|
|
764
|
-
return e.match(/\/demo-errors\/(401|403|404|419|500)\//)?.[1] ?? "Error";
|
|
756
|
+
]);
|
|
757
|
+
//#endregion
|
|
758
|
+
//#region src/core/mediaPreview.ts
|
|
759
|
+
function et(e) {
|
|
760
|
+
return "Error";
|
|
765
761
|
}
|
|
766
|
-
function
|
|
767
|
-
return
|
|
762
|
+
function tt(e) {
|
|
763
|
+
return "Preview unavailable";
|
|
768
764
|
}
|
|
769
765
|
//#endregion
|
|
770
766
|
//#region src/components/CardRegion.vue
|
|
771
|
-
var
|
|
767
|
+
var nt = /* @__PURE__ */ d({
|
|
772
768
|
__name: "CardRegion",
|
|
773
769
|
props: {
|
|
774
770
|
index: {},
|
|
@@ -783,7 +779,7 @@ var rt = /* @__PURE__ */ d({
|
|
|
783
779
|
total: {}
|
|
784
780
|
},
|
|
785
781
|
setup(e) {
|
|
786
|
-
let t = e, n = r(() => H(t.item, t.mediaIndex)), i = r(() => V(t.item)), o = r(() =>
|
|
782
|
+
let t = e, n = r(() => H(t.item, t.mediaIndex)), i = r(() => V(t.item)), o = r(() => te(t.item, n.value)), c = r(() => ({
|
|
787
783
|
height: `${t.region.height}px`,
|
|
788
784
|
paddingBlock: t.style?.paddingY === void 0 ? void 0 : `${t.style.paddingY}px`,
|
|
789
785
|
paddingInline: t.style?.paddingX === void 0 ? void 0 : `${t.style.paddingX}px`
|
|
@@ -815,7 +811,7 @@ var rt = /* @__PURE__ */ d({
|
|
|
815
811
|
"total"
|
|
816
812
|
]))], 38));
|
|
817
813
|
}
|
|
818
|
-
}),
|
|
814
|
+
}), rt = ["aria-busy", "aria-label"], it = { class: "media-error-code" }, at = ["disabled"], ot = /* @__PURE__ */ d({
|
|
819
815
|
__name: "MediaError",
|
|
820
816
|
props: {
|
|
821
817
|
component: {},
|
|
@@ -850,7 +846,7 @@ var rt = /* @__PURE__ */ d({
|
|
|
850
846
|
"retrying",
|
|
851
847
|
"status"
|
|
852
848
|
]))], 32)) : (b(), s(e, { key: 1 }, [
|
|
853
|
-
c("strong",
|
|
849
|
+
c("strong", it, T(t.status), 1),
|
|
854
850
|
c("span", null, T(t.label), 1),
|
|
855
851
|
c("button", {
|
|
856
852
|
"data-test": "media-retry",
|
|
@@ -859,26 +855,26 @@ var rt = /* @__PURE__ */ d({
|
|
|
859
855
|
disabled: t.retrying,
|
|
860
856
|
onClick: j(o, ["stop"]),
|
|
861
857
|
onKeydown: r[2] ||= j(() => {}, ["stop"])
|
|
862
|
-
}, T(t.retrying ? "Retrying…" : "Retry"), 41,
|
|
863
|
-
], 64))], 8,
|
|
858
|
+
}, T(t.retrying ? "Retrying…" : "Retry"), 41, at)
|
|
859
|
+
], 64))], 8, rt));
|
|
864
860
|
}
|
|
865
|
-
}),
|
|
861
|
+
}), st = ["aria-label"], ct = [
|
|
866
862
|
"max",
|
|
867
863
|
"value",
|
|
868
864
|
"aria-label",
|
|
869
865
|
"aria-valuetext",
|
|
870
866
|
"disabled"
|
|
871
|
-
],
|
|
867
|
+
], lt = {
|
|
872
868
|
key: 0,
|
|
873
869
|
class: "media-controls-row"
|
|
874
|
-
},
|
|
870
|
+
}, ut = ["aria-label", "title"], dt = { class: "media-controls-audio" }, ft = ["aria-label", "title"], pt = [
|
|
875
871
|
"value",
|
|
876
872
|
"aria-label",
|
|
877
873
|
"aria-valuetext"
|
|
878
|
-
],
|
|
874
|
+
], mt = {
|
|
879
875
|
class: "media-control-time",
|
|
880
876
|
"aria-live": "off"
|
|
881
|
-
},
|
|
877
|
+
}, ht = /* @__PURE__ */ d({
|
|
882
878
|
__name: "MediaControls",
|
|
883
879
|
props: {
|
|
884
880
|
currentTime: {},
|
|
@@ -931,7 +927,7 @@ var rt = /* @__PURE__ */ d({
|
|
|
931
927
|
"aria-valuetext": `${u(v.value)} of ${u(p.value)}`,
|
|
932
928
|
disabled: p.value <= 0,
|
|
933
929
|
onInput: n[0] ||= (e) => i("seek", d(e))
|
|
934
|
-
}, null, 44,
|
|
930
|
+
}, null, 44, ct), e.layout === "reel" ? (b(), s("div", lt, [
|
|
935
931
|
c("button", {
|
|
936
932
|
type: "button",
|
|
937
933
|
class: "media-control-button media-control-playback",
|
|
@@ -946,8 +942,8 @@ var rt = /* @__PURE__ */ d({
|
|
|
946
942
|
key: 1,
|
|
947
943
|
size: 18,
|
|
948
944
|
fill: "currentColor"
|
|
949
|
-
}))], 8,
|
|
950
|
-
c("div",
|
|
945
|
+
}))], 8, ut),
|
|
946
|
+
c("div", dt, [c("button", {
|
|
951
947
|
type: "button",
|
|
952
948
|
class: "media-control-button",
|
|
953
949
|
"aria-label": e.muted ? `Unmute ${m.value}` : `Mute ${m.value}`,
|
|
@@ -959,7 +955,7 @@ var rt = /* @__PURE__ */ d({
|
|
|
959
955
|
})) : (b(), a(E(Qe), {
|
|
960
956
|
key: 1,
|
|
961
957
|
size: 18
|
|
962
|
-
}))], 8,
|
|
958
|
+
}))], 8, ft), c("input", {
|
|
963
959
|
class: "media-control-range media-control-volume",
|
|
964
960
|
type: "range",
|
|
965
961
|
min: "0",
|
|
@@ -970,15 +966,15 @@ var rt = /* @__PURE__ */ d({
|
|
|
970
966
|
"aria-label": `${g.value} volume`,
|
|
971
967
|
"aria-valuetext": `${Math.round(e.volume * 100)} percent`,
|
|
972
968
|
onInput: n[3] ||= (e) => i("volumeChange", d(e))
|
|
973
|
-
}, null, 44,
|
|
974
|
-
c("output",
|
|
975
|
-
])) : o("", !0)], 42,
|
|
969
|
+
}, null, 44, pt)]),
|
|
970
|
+
c("output", mt, T(u(v.value)) + " / " + T(u(p.value)), 1)
|
|
971
|
+
])) : o("", !0)], 42, st));
|
|
976
972
|
}
|
|
977
|
-
}),
|
|
973
|
+
}), gt = {
|
|
978
974
|
key: 0,
|
|
979
975
|
class: "media-card-overlay-host",
|
|
980
976
|
"data-test": "media-card-overlay"
|
|
981
|
-
},
|
|
977
|
+
}, _t = /* @__PURE__ */ d({
|
|
982
978
|
__name: "MediaContextOverlay",
|
|
983
979
|
props: {
|
|
984
980
|
item: {},
|
|
@@ -988,7 +984,7 @@ var rt = /* @__PURE__ */ d({
|
|
|
988
984
|
mediaSource: {}
|
|
989
985
|
},
|
|
990
986
|
setup(e) {
|
|
991
|
-
return (t, n) => e.mediaCard?.overlay?.component ? (b(), s("div",
|
|
987
|
+
return (t, n) => e.mediaCard?.overlay?.component ? (b(), s("div", gt, [(b(), a(C(e.mediaCard.overlay.component), {
|
|
992
988
|
item: e.item,
|
|
993
989
|
"media-index": e.mediaIndex,
|
|
994
990
|
"media-item": e.mediaItem,
|
|
@@ -1000,8 +996,8 @@ var rt = /* @__PURE__ */ d({
|
|
|
1000
996
|
"media-source"
|
|
1001
997
|
]))])) : o("", !0);
|
|
1002
998
|
}
|
|
1003
|
-
}),
|
|
1004
|
-
function
|
|
999
|
+
}), vt = 40, yt = 160, bt = 24;
|
|
1000
|
+
function xt(e) {
|
|
1005
1001
|
let t = w("next"), n = null, r = 0, i = !1, a = null, o = null;
|
|
1006
1002
|
function s(n, r) {
|
|
1007
1003
|
let i = V(e.item()).length, a = (n + i) % i;
|
|
@@ -1011,7 +1007,7 @@ function St(e) {
|
|
|
1011
1007
|
r = 0, i = !1, n !== null && clearTimeout(n), n = null;
|
|
1012
1008
|
}
|
|
1013
1009
|
function l() {
|
|
1014
|
-
n !== null && clearTimeout(n), n = setTimeout(c,
|
|
1010
|
+
n !== null && clearTimeout(n), n = setTimeout(c, yt);
|
|
1015
1011
|
}
|
|
1016
1012
|
function u(e, t, n) {
|
|
1017
1013
|
return t === 1 ? e * 16 : t === 2 ? e * n : e;
|
|
@@ -1019,7 +1015,7 @@ function St(e) {
|
|
|
1019
1015
|
function d(t) {
|
|
1020
1016
|
if (V(e.item()).length <= 1) return;
|
|
1021
1017
|
let n = t.currentTarget, a = u(t.deltaX, t.deltaMode, n?.clientWidth || 1);
|
|
1022
|
-
if (a === 0 || (t.preventDefault(), l(), i) || (r += a, Math.abs(r) <
|
|
1018
|
+
if (a === 0 || (t.preventDefault(), l(), i) || (r += a, Math.abs(r) < bt)) return;
|
|
1023
1019
|
let o = Math.sign(r);
|
|
1024
1020
|
r = 0, i = !0, s(e.mediaIndex() + o);
|
|
1025
1021
|
}
|
|
@@ -1031,7 +1027,7 @@ function St(e) {
|
|
|
1031
1027
|
let n = t.changedTouches[0];
|
|
1032
1028
|
if (a === null || o === null || !n) return;
|
|
1033
1029
|
let r = a - n.clientX, i = o - n.clientY;
|
|
1034
|
-
a = null, o = null, !(Math.abs(r) <= Math.abs(i)) && (Math.abs(r) <
|
|
1030
|
+
a = null, o = null, !(Math.abs(r) <= Math.abs(i)) && (Math.abs(r) < vt || s(e.mediaIndex() + Math.sign(r)));
|
|
1035
1031
|
}
|
|
1036
1032
|
return v(c), {
|
|
1037
1033
|
change: s,
|
|
@@ -1041,11 +1037,11 @@ function St(e) {
|
|
|
1041
1037
|
onWheel: d
|
|
1042
1038
|
};
|
|
1043
1039
|
}
|
|
1044
|
-
var
|
|
1045
|
-
function
|
|
1040
|
+
var St = /* @__PURE__ */ new Map(), Ct = [], wt = 0, Tt = 0;
|
|
1041
|
+
function Et(e, t) {
|
|
1046
1042
|
return `${t ? "timed" : "image"}:${e}`;
|
|
1047
1043
|
}
|
|
1048
|
-
function
|
|
1044
|
+
function Dt(e, t, n) {
|
|
1049
1045
|
let r = V(e);
|
|
1050
1046
|
if (r.length < 2) return [];
|
|
1051
1047
|
let i = H(e, t), a = [];
|
|
@@ -1059,7 +1055,7 @@ function Ot(e, t, n) {
|
|
|
1059
1055
|
if (!t) return [];
|
|
1060
1056
|
let i = I(t.type, t.src) === "audio" ? B(t) : z(t, n);
|
|
1061
1057
|
if (!i) return [];
|
|
1062
|
-
let a = L(i.type, i.src), s =
|
|
1058
|
+
let a = L(i.type, i.src), s = Et(i.src, a);
|
|
1063
1059
|
return o.has(s) ? [] : (o.add(s), [{
|
|
1064
1060
|
key: s,
|
|
1065
1061
|
src: i.src,
|
|
@@ -1067,22 +1063,22 @@ function Ot(e, t, n) {
|
|
|
1067
1063
|
}]);
|
|
1068
1064
|
});
|
|
1069
1065
|
}
|
|
1070
|
-
function
|
|
1066
|
+
function Ot(e) {
|
|
1071
1067
|
let t = e.element;
|
|
1072
1068
|
e.element = null, t && (t instanceof HTMLVideoElement ? (t.pause(), t.removeAttribute("src"), t.load()) : t.removeAttribute("src"));
|
|
1073
1069
|
}
|
|
1074
|
-
function
|
|
1075
|
-
|
|
1076
|
-
let t =
|
|
1077
|
-
t >= 0 &&
|
|
1070
|
+
function kt(e) {
|
|
1071
|
+
St.delete(e.key);
|
|
1072
|
+
let t = Ct.indexOf(e);
|
|
1073
|
+
t >= 0 && Ct.splice(t, 1), e.cancel?.(), e.cancel = null, Ot(e);
|
|
1078
1074
|
}
|
|
1079
|
-
function
|
|
1080
|
-
e.state = "loading",
|
|
1075
|
+
function At(e) {
|
|
1076
|
+
e.state = "loading", wt += 1, e.timed && (Tt += 1);
|
|
1081
1077
|
let t = !1, n = () => void 0, r = (r) => {
|
|
1082
|
-
t || (t = !0, n(), --
|
|
1078
|
+
t || (t = !0, n(), --wt, e.timed && --Tt, e.cancel = null, e.state = r, r === "failed" && Ot(e), e.refs === 0 && kt(e), jt());
|
|
1083
1079
|
};
|
|
1084
1080
|
if (e.cancel = () => {
|
|
1085
|
-
t || (t = !0, n(), --
|
|
1081
|
+
t || (t = !0, n(), --wt, e.timed && --Tt, Ot(e), jt());
|
|
1086
1082
|
}, e.timed) {
|
|
1087
1083
|
let t = document.createElement("video"), i = () => r("ready"), a = () => r("failed");
|
|
1088
1084
|
n = () => {
|
|
@@ -1101,38 +1097,38 @@ function jt(e) {
|
|
|
1101
1097
|
i.removeEventListener("load", a), i.removeEventListener("error", o);
|
|
1102
1098
|
}, i.addEventListener("load", a, { once: !0 }), i.addEventListener("error", o, { once: !0 }), i.decoding = "async", i.fetchPriority = "low", i.src = e.src, e.element = i;
|
|
1103
1099
|
}
|
|
1104
|
-
function
|
|
1105
|
-
for (;
|
|
1106
|
-
let e =
|
|
1100
|
+
function jt() {
|
|
1101
|
+
for (; wt < 6;) {
|
|
1102
|
+
let e = Ct.findIndex((e) => e.refs > 0 && e.state === "queued" && (!e.timed || Tt < 2));
|
|
1107
1103
|
if (e < 0) return;
|
|
1108
|
-
let [t] =
|
|
1109
|
-
t &&
|
|
1104
|
+
let [t] = Ct.splice(e, 1);
|
|
1105
|
+
t && At(t);
|
|
1110
1106
|
}
|
|
1111
1107
|
}
|
|
1112
|
-
function
|
|
1113
|
-
let t =
|
|
1108
|
+
function Mt(e) {
|
|
1109
|
+
let t = St.get(e.key);
|
|
1114
1110
|
t || (t = {
|
|
1115
1111
|
...e,
|
|
1116
1112
|
cancel: null,
|
|
1117
1113
|
element: null,
|
|
1118
1114
|
refs: 0,
|
|
1119
1115
|
state: "queued"
|
|
1120
|
-
},
|
|
1116
|
+
}, St.set(t.key, t), Ct.push(t)), t.refs += 1, jt();
|
|
1121
1117
|
let n = !1;
|
|
1122
1118
|
return () => {
|
|
1123
|
-
n || (n = !0, --t.refs, t.refs === 0 &&
|
|
1119
|
+
n || (n = !0, --t.refs, t.refs === 0 && kt(t));
|
|
1124
1120
|
};
|
|
1125
1121
|
}
|
|
1126
1122
|
//#endregion
|
|
1127
1123
|
//#region src/components/useVisiblePostPreload.ts
|
|
1128
|
-
function
|
|
1129
|
-
let t = r(() => e.layout() === "masonry" && e.inViewport() && e.mediaReady() && e.mediaCard()?.feedPreload === "visible-post"), n = r(() => t.value ?
|
|
1124
|
+
function Nt(e) {
|
|
1125
|
+
let t = r(() => e.layout() === "masonry" && e.inViewport() && e.mediaReady() && e.mediaCard()?.feedPreload === "visible-post"), n = r(() => t.value ? Dt(e.item(), e.mediaIndex(), e.mediaSource()) : []), i = /* @__PURE__ */ new Map();
|
|
1130
1126
|
function a() {
|
|
1131
1127
|
let e = new Map(n.value.map((e) => [e.key, e]));
|
|
1132
1128
|
i.forEach((t, n) => {
|
|
1133
1129
|
e.has(n) || (t(), i.delete(n));
|
|
1134
1130
|
}), n.value.forEach((e) => {
|
|
1135
|
-
i.has(e.key) || i.set(e.key,
|
|
1131
|
+
i.has(e.key) || i.set(e.key, Mt(e));
|
|
1136
1132
|
});
|
|
1137
1133
|
}
|
|
1138
1134
|
O(() => n.value.map(({ key: e }) => e).join("\n"), a, { immediate: !0 }), v(() => {
|
|
@@ -1141,7 +1137,7 @@ function Pt(e) {
|
|
|
1141
1137
|
}
|
|
1142
1138
|
//#endregion
|
|
1143
1139
|
//#region src/components/useMediaLoading.ts
|
|
1144
|
-
function
|
|
1140
|
+
function Pt(e) {
|
|
1145
1141
|
let t = r(() => L(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");
|
|
1146
1142
|
return O(i, (t, n) => {
|
|
1147
1143
|
n !== "none" || t === "none" || m(() => {
|
|
@@ -1156,7 +1152,7 @@ function Ft(e) {
|
|
|
1156
1152
|
}
|
|
1157
1153
|
//#endregion
|
|
1158
1154
|
//#region src/components/useMediaReadiness.ts
|
|
1159
|
-
function
|
|
1155
|
+
function Ft(e) {
|
|
1160
1156
|
let t = w(null), n = w(null), i = w(0), a = w(0), o = w(!0), s = w(!1), c = w(!1), l = null, u = !1, d = !1, f = !1, p = r(() => c.value || s.value ? "error" : o.value ? "loading" : e.previewState());
|
|
1161
1157
|
function h() {
|
|
1162
1158
|
l !== null && clearTimeout(l), l = null;
|
|
@@ -1217,30 +1213,30 @@ function It(e) {
|
|
|
1217
1213
|
}
|
|
1218
1214
|
//#endregion
|
|
1219
1215
|
//#region src/core/reelAudio.ts
|
|
1220
|
-
var
|
|
1216
|
+
var It = {
|
|
1221
1217
|
lastAudibleVolume: 1,
|
|
1222
1218
|
muted: !1,
|
|
1223
1219
|
volume: 1
|
|
1224
1220
|
};
|
|
1225
|
-
function
|
|
1221
|
+
function Lt(e, t) {
|
|
1226
1222
|
return typeof e == "number" && Number.isFinite(e) ? Math.min(1, Math.max(0, e)) : t;
|
|
1227
1223
|
}
|
|
1228
|
-
function
|
|
1229
|
-
let n =
|
|
1224
|
+
function Rt(e, t = It) {
|
|
1225
|
+
let n = Lt(e?.volume, t.volume), r = Lt(e?.lastAudibleVolume, n > 0 ? n : t.lastAudibleVolume);
|
|
1230
1226
|
return {
|
|
1231
|
-
lastAudibleVolume: r > 0 ? r :
|
|
1227
|
+
lastAudibleVolume: r > 0 ? r : It.lastAudibleVolume,
|
|
1232
1228
|
muted: typeof e?.muted == "boolean" ? e.muted : n === 0 || t.muted,
|
|
1233
1229
|
volume: n
|
|
1234
1230
|
};
|
|
1235
1231
|
}
|
|
1236
1232
|
//#endregion
|
|
1237
1233
|
//#region src/components/useMediaCardAudio.ts
|
|
1238
|
-
function
|
|
1239
|
-
let t =
|
|
1234
|
+
function zt(e) {
|
|
1235
|
+
let t = Rt(e.reelAudioState()), n = e.layout() === "reel" && e.reelAudioState(), r = w(n ? t.muted : e.mediaCard()?.videoMuted ?? e.layout() === "masonry"), i = w(n ? t.volume : 1), a = n ? t.lastAudibleVolume : 1;
|
|
1240
1236
|
function o() {
|
|
1241
1237
|
let t = e.mediaElement.value, n = e.reelAudioState();
|
|
1242
1238
|
if (!t || e.layout() !== "reel" || !n) return;
|
|
1243
|
-
let o =
|
|
1239
|
+
let o = Rt(n);
|
|
1244
1240
|
a = o.lastAudibleVolume, i.value = o.volume, r.value = o.muted, t.volume = o.volume, t.muted = e.active() === !1 ? !0 : o.muted;
|
|
1245
1241
|
}
|
|
1246
1242
|
function s(e, t) {
|
|
@@ -1248,7 +1244,7 @@ function Bt(e) {
|
|
|
1248
1244
|
}
|
|
1249
1245
|
function c(t) {
|
|
1250
1246
|
if (e.layout() !== "reel") return;
|
|
1251
|
-
let n =
|
|
1247
|
+
let n = Rt({
|
|
1252
1248
|
lastAudibleVolume: a,
|
|
1253
1249
|
muted: t.muted,
|
|
1254
1250
|
volume: t.volume
|
|
@@ -1283,7 +1279,7 @@ function Bt(e) {
|
|
|
1283
1279
|
}
|
|
1284
1280
|
//#endregion
|
|
1285
1281
|
//#region src/components/useReelVideoActivity.ts
|
|
1286
|
-
function
|
|
1282
|
+
function Bt(e) {
|
|
1287
1283
|
let t = r(() => e.layout() === "reel" ? e.active() === !0 : e.inViewport()), n = r(() => t.value ? e.mediaIsMuted.value : !0);
|
|
1288
1284
|
function i() {
|
|
1289
1285
|
if (!t.value) {
|
|
@@ -1317,18 +1313,18 @@ function Vt(e) {
|
|
|
1317
1313
|
}
|
|
1318
1314
|
//#endregion
|
|
1319
1315
|
//#region src/components/useTimedMediaCard.ts
|
|
1320
|
-
function
|
|
1316
|
+
function Vt(e) {
|
|
1321
1317
|
return Number.isFinite(e) ? Math.max(0, e) : 0;
|
|
1322
1318
|
}
|
|
1323
|
-
function
|
|
1324
|
-
let t = w(0), n = w(0), r = w(!1), { apply: i, setVolume: a, sync: o, toggleMute: s, videoIsMuted: c, videoVolume: l } =
|
|
1319
|
+
function Ht(e) {
|
|
1320
|
+
let t = w(0), n = w(0), r = w(!1), { apply: i, setVolume: a, sync: o, toggleMute: s, videoIsMuted: c, videoVolume: l } = zt({
|
|
1325
1321
|
active: e.active,
|
|
1326
1322
|
layout: e.layout,
|
|
1327
1323
|
mediaCard: e.mediaCard,
|
|
1328
1324
|
mediaElement: e.mediaElement,
|
|
1329
1325
|
onChange: e.onAudioChange,
|
|
1330
1326
|
reelAudioState: e.reelAudioState
|
|
1331
|
-
}), { effectiveMuted: u, onPlaying: d, playbackAllowed: f } =
|
|
1327
|
+
}), { effectiveMuted: u, onPlaying: d, playbackAllowed: f } = Bt({
|
|
1332
1328
|
active: e.active,
|
|
1333
1329
|
inViewport: e.inViewport,
|
|
1334
1330
|
layout: e.layout,
|
|
@@ -1338,7 +1334,7 @@ function Ut(e) {
|
|
|
1338
1334
|
});
|
|
1339
1335
|
function p(r) {
|
|
1340
1336
|
let i = r?.currentTarget ?? e.mediaElement.value;
|
|
1341
|
-
i && (t.value =
|
|
1337
|
+
i && (t.value = Vt(i.currentTime), n.value = Vt(i.duration), o(i, f.value));
|
|
1342
1338
|
}
|
|
1343
1339
|
function m(t) {
|
|
1344
1340
|
i(), p(t), e.onReady(t);
|
|
@@ -1348,7 +1344,7 @@ function Ut(e) {
|
|
|
1348
1344
|
}
|
|
1349
1345
|
function g(n) {
|
|
1350
1346
|
let r = e.mediaElement.value;
|
|
1351
|
-
!r || !Number.isFinite(n) || (r.currentTime = Math.min(
|
|
1347
|
+
!r || !Number.isFinite(n) || (r.currentTime = Math.min(Vt(r.duration), Math.max(0, n)), t.value = r.currentTime);
|
|
1352
1348
|
}
|
|
1353
1349
|
async function _() {
|
|
1354
1350
|
let t = e.mediaElement.value;
|
|
@@ -1386,7 +1382,7 @@ function Ut(e) {
|
|
|
1386
1382
|
}
|
|
1387
1383
|
//#endregion
|
|
1388
1384
|
//#region src/components/MediaCard.vue?vue&type=script&setup=true&lang.ts
|
|
1389
|
-
var
|
|
1385
|
+
var Ut = [
|
|
1390
1386
|
"data-post-id",
|
|
1391
1387
|
"data-media-index",
|
|
1392
1388
|
"aria-hidden",
|
|
@@ -1394,19 +1390,19 @@ var Wt = [
|
|
|
1394
1390
|
"inert",
|
|
1395
1391
|
"role",
|
|
1396
1392
|
"tabindex"
|
|
1397
|
-
],
|
|
1393
|
+
], Wt = { class: "media-card-content" }, Gt = ["data-media-direction"], Kt = ["data-media-index"], qt = {
|
|
1398
1394
|
key: 0,
|
|
1399
1395
|
"data-test": "media-loading",
|
|
1400
1396
|
class: "media-loading",
|
|
1401
1397
|
"aria-hidden": "true"
|
|
1402
|
-
},
|
|
1398
|
+
}, Jt = [
|
|
1403
1399
|
"data-source-generation",
|
|
1404
1400
|
"src",
|
|
1405
1401
|
"autoplay",
|
|
1406
1402
|
"loop",
|
|
1407
1403
|
"muted",
|
|
1408
1404
|
"preload"
|
|
1409
|
-
],
|
|
1405
|
+
], Yt = ["aria-label", "disabled"], Xt = [
|
|
1410
1406
|
"data-cover-identity",
|
|
1411
1407
|
"data-source-generation",
|
|
1412
1408
|
"src",
|
|
@@ -1414,11 +1410,11 @@ var Wt = [
|
|
|
1414
1410
|
"height",
|
|
1415
1411
|
"fetchpriority",
|
|
1416
1412
|
"loading"
|
|
1417
|
-
],
|
|
1413
|
+
], Zt = {
|
|
1418
1414
|
key: 1,
|
|
1419
1415
|
class: "media-audio-fallback",
|
|
1420
1416
|
"aria-hidden": "true"
|
|
1421
|
-
},
|
|
1417
|
+
}, Qt = [
|
|
1422
1418
|
"data-source-generation",
|
|
1423
1419
|
"src",
|
|
1424
1420
|
"width",
|
|
@@ -1427,14 +1423,14 @@ var Wt = [
|
|
|
1427
1423
|
"loop",
|
|
1428
1424
|
"muted",
|
|
1429
1425
|
"preload"
|
|
1430
|
-
],
|
|
1426
|
+
], $t = [
|
|
1431
1427
|
"data-source-generation",
|
|
1432
1428
|
"src",
|
|
1433
1429
|
"width",
|
|
1434
1430
|
"height",
|
|
1435
1431
|
"fetchpriority",
|
|
1436
1432
|
"loading"
|
|
1437
|
-
],
|
|
1433
|
+
], en = ["aria-label"], tn = ["aria-label"], nn = ["aria-label"], rn = /* @__PURE__ */ d({
|
|
1438
1434
|
__name: "MediaCard",
|
|
1439
1435
|
props: {
|
|
1440
1436
|
active: { type: Boolean },
|
|
@@ -1474,7 +1470,7 @@ var Wt = [
|
|
|
1474
1470
|
function f(e = !1, t = "pointer") {
|
|
1475
1471
|
e && d("activate", t);
|
|
1476
1472
|
}
|
|
1477
|
-
let p = r(() => V(l.item)), g = r(() => H(l.item, l.mediaIndex)), v = r(() =>
|
|
1473
|
+
let p = r(() => V(l.item)), g = r(() => H(l.item, l.mediaIndex)), v = r(() => te(l.item, g.value)), y = r(() => z(v.value, l.mediaSource ?? "preview")), x = r(() => I(v.value.type, v.value.src)), S = r(() => x.value === "audio"), C = r(() => ee(v.value, l.mediaSource ?? "preview")), T = r(() => S.value ? C.value : y.value), D = r(() => T.value.src), M = r(() => I(T.value.type, T.value.src)), N = r(() => y.value.width), P = r(() => y.value.height), F = r(() => B(v.value)), L = r(() => `${l.item.postId}:${g.value}:${F.value?.src ?? ""}`), R = w(!1), U = r(() => R.value ? null : F.value), { effectivePreviewState: W, failSourceAttempt: G, imageElement: ne, markSourceReady: K, noteSourceActivity: q, retrySource: re, retrying: ie, sourceGeneration: ae, mediaElement: J } = Ft({
|
|
1478
1474
|
identity: () => `${l.item.postId}:${g.value}:${l.mediaSource ?? "preview"}:${D.value}:${M.value ?? ""}`,
|
|
1479
1475
|
mediaIndex: () => g.value,
|
|
1480
1476
|
onError: (e, t) => {
|
|
@@ -1489,43 +1485,43 @@ var Wt = [
|
|
|
1489
1485
|
onReady: (e) => d("ready", e),
|
|
1490
1486
|
previewState: () => l.previewState
|
|
1491
1487
|
});
|
|
1492
|
-
|
|
1488
|
+
Nt({
|
|
1493
1489
|
inViewport: () => l.inViewport === !0,
|
|
1494
1490
|
item: () => l.item,
|
|
1495
1491
|
layout: () => l.layout,
|
|
1496
1492
|
mediaCard: () => l.mediaCard,
|
|
1497
1493
|
mediaIndex: () => g.value,
|
|
1498
|
-
mediaReady: () =>
|
|
1494
|
+
mediaReady: () => W.value === "ready",
|
|
1499
1495
|
mediaSource: () => l.mediaSource ?? "preview"
|
|
1500
1496
|
});
|
|
1501
|
-
let { currentTime: oe, duration: se, effectiveMuted: ce, isMuted: le, isPlaying:
|
|
1497
|
+
let { currentTime: oe, duration: se, effectiveMuted: ce, isMuted: le, isPlaying: ue, onEnded: Y, onLoadedMetadata: X, onPlaying: de, playbackAllowed: Z, seek: fe, setVolume: pe, sync: Q, toggleMute: me, togglePlayback: he, volume: ge } = Ht({
|
|
1502
1498
|
active: () => l.active,
|
|
1503
1499
|
inViewport: () => l.inViewport === !0,
|
|
1504
1500
|
layout: () => l.layout,
|
|
1505
1501
|
mediaCard: () => l.mediaCard,
|
|
1506
|
-
mediaElement:
|
|
1502
|
+
mediaElement: J,
|
|
1507
1503
|
onAudioChange: (e) => d("reelAudioChange", e),
|
|
1508
1504
|
onEnded: () => d("ended", g.value),
|
|
1509
|
-
onReady:
|
|
1505
|
+
onReady: K,
|
|
1510
1506
|
reelAudioState: () => l.reelAudioState
|
|
1511
1507
|
}), _e = r(() => l.interactive && !!(l.cardHeader || l.cardFooter));
|
|
1512
1508
|
function ve(e) {
|
|
1513
1509
|
return e.detail === 0 ? "keyboard" : "pointer";
|
|
1514
1510
|
}
|
|
1515
|
-
let { change: ye, direction: be, onTouchEnd: xe, onTouchStart: Se, onWheel: Ce } =
|
|
1511
|
+
let { change: ye, direction: be, onTouchEnd: xe, onTouchStart: Se, onWheel: Ce } = xt({
|
|
1516
1512
|
item: () => l.item,
|
|
1517
1513
|
layout: () => l.layout,
|
|
1518
1514
|
mediaIndex: () => g.value,
|
|
1519
1515
|
onChange: (e) => d("mediaChange", e)
|
|
1520
|
-
}), { imageLoading: we, mediaIsTimed: Te, timedMediaPreload: Ee } =
|
|
1516
|
+
}), { imageLoading: we, mediaIsTimed: Te, timedMediaPreload: Ee } = Pt({
|
|
1521
1517
|
active: () => l.active,
|
|
1522
1518
|
fetchPriority: () => l.fetchPriority,
|
|
1523
1519
|
layout: () => l.layout,
|
|
1524
1520
|
mediaSource: () => D.value,
|
|
1525
1521
|
mediaType: () => M.value,
|
|
1526
|
-
mediaElement:
|
|
1527
|
-
playbackAllowed: () =>
|
|
1528
|
-
}), De = r(() => l.layout === "reel" && l.stationaryReelControls === !0), Oe = r(() => Te.value && (!S.value || l.layout === "reel") &&
|
|
1522
|
+
mediaElement: J,
|
|
1523
|
+
playbackAllowed: () => Z.value
|
|
1524
|
+
}), De = r(() => l.layout === "reel" && l.stationaryReelControls === !0), Oe = r(() => Te.value && (!S.value || l.layout === "reel") && W.value === "ready" && (!De.value || !!(l.active && l.reelControlsTarget))), ke = r(() => `${l.item.postId}:${g.value}:${D.value}`);
|
|
1529
1525
|
function Ae(e) {
|
|
1530
1526
|
l.layout === "reel" && (e.stopPropagation(), he());
|
|
1531
1527
|
}
|
|
@@ -1534,35 +1530,35 @@ var Wt = [
|
|
|
1534
1530
|
mediaIndex: g.value,
|
|
1535
1531
|
source: "preview",
|
|
1536
1532
|
src: F.value?.src ?? ""
|
|
1537
|
-
}), R.value = !0, l.layout === "masonry" &&
|
|
1533
|
+
}), R.value = !0, l.layout === "masonry" && K());
|
|
1538
1534
|
}
|
|
1539
1535
|
return O(L, () => {
|
|
1540
1536
|
R.value = !1;
|
|
1541
1537
|
}), O([
|
|
1542
1538
|
S,
|
|
1543
1539
|
() => l.layout,
|
|
1544
|
-
|
|
1540
|
+
U
|
|
1545
1541
|
], ([e, t, n]) => {
|
|
1546
|
-
e && t === "masonry" && !n && m(() =>
|
|
1542
|
+
e && t === "masonry" && !n && m(() => K());
|
|
1547
1543
|
}, { immediate: !0 }), (r, i) => (b(), s("article", {
|
|
1548
1544
|
"data-post-id": e.item.postId,
|
|
1549
1545
|
"data-media-index": g.value,
|
|
1550
1546
|
class: h(["media-card", {
|
|
1551
1547
|
"media-card--entering": e.entering,
|
|
1552
1548
|
"media-card--leaving": e.leaving,
|
|
1553
|
-
"media-card--error": E(
|
|
1549
|
+
"media-card--error": E(W) === "error",
|
|
1554
1550
|
"media-card--transparent-chrome": e.mediaCard?.header?.background === "transparent" || e.mediaCard?.footer?.background === "transparent" || e.cardHeader?.background === "transparent" || e.cardFooter?.background === "transparent"
|
|
1555
1551
|
}]),
|
|
1556
1552
|
style: _(e.itemStyle),
|
|
1557
1553
|
"aria-hidden": e.leaving || void 0,
|
|
1558
|
-
"aria-busy": E(
|
|
1554
|
+
"aria-busy": E(W) === "loading" || E(ie),
|
|
1559
1555
|
inert: e.leaving || void 0,
|
|
1560
1556
|
role: e.interactive && !e.leaving && !_e.value ? "button" : void 0,
|
|
1561
1557
|
tabindex: e.interactive && !e.leaving && !_e.value ? 0 : void 0,
|
|
1562
1558
|
onClick: i[34] ||= (t) => f(e.interactive && !_e.value, ve(t)),
|
|
1563
1559
|
onKeydown: [i[35] ||= A((t) => f(e.interactive && !_e.value, "keyboard"), ["enter"]), i[36] ||= A(j((t) => f(e.interactive && !_e.value, "keyboard"), ["prevent"]), ["space"])]
|
|
1564
|
-
}, [c("div",
|
|
1565
|
-
e.cardHeader ? (b(), a(
|
|
1560
|
+
}, [c("div", Wt, [
|
|
1561
|
+
e.cardHeader ? (b(), a(nt, {
|
|
1566
1562
|
key: 0,
|
|
1567
1563
|
index: e.index,
|
|
1568
1564
|
item: e.item,
|
|
@@ -1593,21 +1589,21 @@ var Wt = [
|
|
|
1593
1589
|
onTouchendPassive: i[33] ||= (...e) => E(xe) && E(xe)(...e)
|
|
1594
1590
|
}, [
|
|
1595
1591
|
u(n, {
|
|
1596
|
-
css: !E(
|
|
1592
|
+
css: !E(ie),
|
|
1597
1593
|
name: `media-slide-${E(be)}`
|
|
1598
1594
|
}, {
|
|
1599
1595
|
default: k(() => [(b(), s("div", {
|
|
1600
|
-
key: `${e.item.postId}:${v.value.src}:${e.mediaSource ?? "preview"}:${E(
|
|
1596
|
+
key: `${e.item.postId}:${v.value.src}:${e.mediaSource ?? "preview"}:${E(ae)}`,
|
|
1601
1597
|
class: "media-card-frame",
|
|
1602
1598
|
"data-media-index": g.value
|
|
1603
1599
|
}, [
|
|
1604
|
-
E(
|
|
1600
|
+
E(W) === "loading" ? (b(), s("div", qt, [...i[37] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : E(W) === "error" ? (b(), a(ot, {
|
|
1605
1601
|
key: 1,
|
|
1606
1602
|
component: e.mediaCard?.error?.component,
|
|
1607
|
-
label: E(
|
|
1608
|
-
retrying: E(
|
|
1609
|
-
status: E(
|
|
1610
|
-
onRetry: E(
|
|
1603
|
+
label: E(tt)(D.value),
|
|
1604
|
+
retrying: E(ie),
|
|
1605
|
+
status: E(et)(D.value),
|
|
1606
|
+
onRetry: E(re)
|
|
1611
1607
|
}, null, 8, [
|
|
1612
1608
|
"component",
|
|
1613
1609
|
"label",
|
|
@@ -1618,85 +1614,85 @@ var Wt = [
|
|
|
1618
1614
|
S.value && e.layout === "reel" ? (b(), s("audio", {
|
|
1619
1615
|
key: 2,
|
|
1620
1616
|
ref_key: "mediaElement",
|
|
1621
|
-
ref:
|
|
1622
|
-
"data-source-generation": E(
|
|
1617
|
+
ref: J,
|
|
1618
|
+
"data-source-generation": E(ae),
|
|
1623
1619
|
class: "media-audio-element",
|
|
1624
1620
|
src: D.value,
|
|
1625
|
-
autoplay: E(
|
|
1621
|
+
autoplay: E(Z),
|
|
1626
1622
|
loop: !e.advanceOnMediaEnd,
|
|
1627
1623
|
muted: E(ce),
|
|
1628
1624
|
preload: E(Ee),
|
|
1629
|
-
onLoadedmetadata: i[0] ||= (...e) => E(
|
|
1630
|
-
onProgress: i[1] ||= (...e) => E(
|
|
1631
|
-
onLoadeddata: i[2] ||= (...e) => E(
|
|
1632
|
-
onCanplay: i[3] ||= (...e) => E(
|
|
1625
|
+
onLoadedmetadata: i[0] ||= (...e) => E(X) && E(X)(...e),
|
|
1626
|
+
onProgress: i[1] ||= (...e) => E(q) && E(q)(...e),
|
|
1627
|
+
onLoadeddata: i[2] ||= (...e) => E(q) && E(q)(...e),
|
|
1628
|
+
onCanplay: i[3] ||= (...e) => E(q) && E(q)(...e),
|
|
1633
1629
|
onDurationchange: i[4] ||= (...e) => E(Q) && E(Q)(...e),
|
|
1634
1630
|
onTimeupdate: i[5] ||= (...e) => E(Q) && E(Q)(...e),
|
|
1635
1631
|
onVolumechange: i[6] ||= (...e) => E(Q) && E(Q)(...e),
|
|
1636
|
-
onPlaying: i[7] ||= (...e) => E(
|
|
1637
|
-
onPause: i[8] ||= (e) =>
|
|
1638
|
-
onEnded: i[9] ||= (...e) => E(
|
|
1639
|
-
onError: i[10] ||= (...e) => E(
|
|
1640
|
-
}, null, 40,
|
|
1632
|
+
onPlaying: i[7] ||= (...e) => E(de) && E(de)(...e),
|
|
1633
|
+
onPause: i[8] ||= (e) => ue.value = !1,
|
|
1634
|
+
onEnded: i[9] ||= (...e) => E(Y) && E(Y)(...e),
|
|
1635
|
+
onError: i[10] ||= (...e) => E(G) && E(G)(...e)
|
|
1636
|
+
}, null, 40, Jt)) : o("", !0),
|
|
1641
1637
|
S.value ? (b(), s("button", {
|
|
1642
1638
|
key: 3,
|
|
1643
1639
|
type: "button",
|
|
1644
|
-
class: h(["media-audio-artwork media-preview", { "media-preview--ready": E(
|
|
1645
|
-
"aria-label": e.layout === "reel" ? E(
|
|
1640
|
+
class: h(["media-audio-artwork media-preview", { "media-preview--ready": E(W) === "ready" }]),
|
|
1641
|
+
"aria-label": e.layout === "reel" ? E(ue) ? "Pause audio" : "Play audio" : "Audio",
|
|
1646
1642
|
disabled: e.layout !== "reel",
|
|
1647
1643
|
onClick: Ae
|
|
1648
|
-
}, [
|
|
1644
|
+
}, [U.value ? (b(), s("img", {
|
|
1649
1645
|
key: L.value,
|
|
1650
1646
|
"data-cover-identity": L.value,
|
|
1651
|
-
"data-source-generation": E(
|
|
1647
|
+
"data-source-generation": E(ae),
|
|
1652
1648
|
class: "media-audio-cover",
|
|
1653
|
-
src:
|
|
1654
|
-
width:
|
|
1655
|
-
height:
|
|
1649
|
+
src: U.value.src,
|
|
1650
|
+
width: U.value.width ?? void 0,
|
|
1651
|
+
height: U.value.height ?? void 0,
|
|
1656
1652
|
fetchpriority: e.fetchPriority,
|
|
1657
1653
|
alt: "",
|
|
1658
1654
|
decoding: "async",
|
|
1659
1655
|
loading: E(we),
|
|
1660
|
-
onLoad: i[11] ||= (t) => e.layout === "masonry" && E(
|
|
1656
|
+
onLoad: i[11] ||= (t) => e.layout === "masonry" && E(K)(t),
|
|
1661
1657
|
onError: je
|
|
1662
|
-
}, null, 40,
|
|
1658
|
+
}, null, 40, Xt)) : (b(), s("span", Zt, [u(E(Ye), {
|
|
1663
1659
|
size: 64,
|
|
1664
1660
|
"stroke-width": 1.5
|
|
1665
|
-
})]))], 10,
|
|
1661
|
+
})]))], 10, Yt)) : E(Te) ? (b(), s("video", {
|
|
1666
1662
|
key: 4,
|
|
1667
1663
|
ref_key: "mediaElement",
|
|
1668
|
-
ref:
|
|
1669
|
-
"data-source-generation": E(
|
|
1664
|
+
ref: J,
|
|
1665
|
+
"data-source-generation": E(ae),
|
|
1670
1666
|
class: h(["media-preview", {
|
|
1671
|
-
"media-preview--ready": E(
|
|
1667
|
+
"media-preview--ready": E(W) === "ready",
|
|
1672
1668
|
"media-preview--reel-video": e.layout === "reel"
|
|
1673
1669
|
}]),
|
|
1674
1670
|
src: D.value,
|
|
1675
1671
|
width: N.value ?? void 0,
|
|
1676
1672
|
height: P.value ?? void 0,
|
|
1677
|
-
autoplay: E(
|
|
1673
|
+
autoplay: E(Z),
|
|
1678
1674
|
loop: !e.advanceOnMediaEnd,
|
|
1679
1675
|
muted: E(ce),
|
|
1680
1676
|
playsinline: "",
|
|
1681
1677
|
preload: E(Ee),
|
|
1682
|
-
onLoadedmetadata: i[12] ||= (...e) => E(
|
|
1683
|
-
onProgress: i[13] ||= (...e) => E(
|
|
1684
|
-
onLoadeddata: i[14] ||= (...e) => E(
|
|
1685
|
-
onCanplay: i[15] ||= (...e) => E(
|
|
1678
|
+
onLoadedmetadata: i[12] ||= (...e) => E(X) && E(X)(...e),
|
|
1679
|
+
onProgress: i[13] ||= (...e) => E(q) && E(q)(...e),
|
|
1680
|
+
onLoadeddata: i[14] ||= (...e) => E(q) && E(q)(...e),
|
|
1681
|
+
onCanplay: i[15] ||= (...e) => E(q) && E(q)(...e),
|
|
1686
1682
|
onDurationchange: i[16] ||= (...e) => E(Q) && E(Q)(...e),
|
|
1687
1683
|
onTimeupdate: i[17] ||= (...e) => E(Q) && E(Q)(...e),
|
|
1688
1684
|
onVolumechange: i[18] ||= (...e) => E(Q) && E(Q)(...e),
|
|
1689
|
-
onPlaying: i[19] ||= (...e) => E(
|
|
1690
|
-
onPause: i[20] ||= (e) =>
|
|
1691
|
-
onEnded: i[21] ||= (...e) => E(
|
|
1685
|
+
onPlaying: i[19] ||= (...e) => E(de) && E(de)(...e),
|
|
1686
|
+
onPause: i[20] ||= (e) => ue.value = !1,
|
|
1687
|
+
onEnded: i[21] ||= (...e) => E(Y) && E(Y)(...e),
|
|
1692
1688
|
onClick: Ae,
|
|
1693
|
-
onError: i[22] ||= (...e) => E(
|
|
1694
|
-
}, null, 42,
|
|
1689
|
+
onError: i[22] ||= (...e) => E(G) && E(G)(...e)
|
|
1690
|
+
}, null, 42, Qt)) : S.value ? o("", !0) : (b(), s("img", {
|
|
1695
1691
|
key: 5,
|
|
1696
1692
|
ref_key: "imageElement",
|
|
1697
|
-
ref:
|
|
1698
|
-
"data-source-generation": E(
|
|
1699
|
-
class: h(["media-preview", { "media-preview--ready": E(
|
|
1693
|
+
ref: ne,
|
|
1694
|
+
"data-source-generation": E(ae),
|
|
1695
|
+
class: h(["media-preview", { "media-preview--ready": E(W) === "ready" }]),
|
|
1700
1696
|
src: D.value,
|
|
1701
1697
|
width: N.value ?? void 0,
|
|
1702
1698
|
height: P.value ?? void 0,
|
|
@@ -1704,13 +1700,13 @@ var Wt = [
|
|
|
1704
1700
|
alt: "",
|
|
1705
1701
|
decoding: "async",
|
|
1706
1702
|
loading: E(we),
|
|
1707
|
-
onLoad: i[23] ||= (...e) => E(
|
|
1708
|
-
onError: i[24] ||= (...e) => E(
|
|
1709
|
-
}, null, 42,
|
|
1710
|
-
], 8,
|
|
1703
|
+
onLoad: i[23] ||= (...e) => E(K) && E(K)(...e),
|
|
1704
|
+
onError: i[24] ||= (...e) => E(G) && E(G)(...e)
|
|
1705
|
+
}, null, 42, $t))
|
|
1706
|
+
], 8, Kt))]),
|
|
1711
1707
|
_: 1
|
|
1712
1708
|
}, 8, ["css", "name"]),
|
|
1713
|
-
u(
|
|
1709
|
+
u(_t, {
|
|
1714
1710
|
item: e.item,
|
|
1715
1711
|
"media-card": e.mediaCard,
|
|
1716
1712
|
"media-index": g.value,
|
|
@@ -1730,7 +1726,7 @@ var Wt = [
|
|
|
1730
1726
|
name: "vibe-reel-media-controls",
|
|
1731
1727
|
css: De.value
|
|
1732
1728
|
}, {
|
|
1733
|
-
default: k(() => [Oe.value ? (b(), a(
|
|
1729
|
+
default: k(() => [Oe.value ? (b(), a(ht, {
|
|
1734
1730
|
key: ke.value,
|
|
1735
1731
|
"current-time": E(oe),
|
|
1736
1732
|
"data-control-post-id": De.value ? e.item.postId : void 0,
|
|
@@ -1738,7 +1734,7 @@ var Wt = [
|
|
|
1738
1734
|
layout: e.layout,
|
|
1739
1735
|
"media-type": S.value ? "audio" : "video",
|
|
1740
1736
|
muted: E(le),
|
|
1741
|
-
playing: E(
|
|
1737
|
+
playing: E(ue),
|
|
1742
1738
|
volume: E(ge),
|
|
1743
1739
|
onSeek: E(fe),
|
|
1744
1740
|
onToggleMute: E(me),
|
|
@@ -1770,13 +1766,13 @@ var Wt = [
|
|
|
1770
1766
|
"aria-label": `Previous media for post ${e.item.postId}`,
|
|
1771
1767
|
onClick: i[25] ||= j((e) => E(ye)(g.value - 1, e), ["stop"]),
|
|
1772
1768
|
onKeydown: i[26] ||= j(() => {}, ["stop"])
|
|
1773
|
-
}, [u(E(qe), { size: 20 })], 40,
|
|
1769
|
+
}, [u(E(qe), { size: 20 })], 40, en), c("button", {
|
|
1774
1770
|
type: "button",
|
|
1775
1771
|
class: "media-carousel-control media-carousel-control--next",
|
|
1776
1772
|
"aria-label": `Next media for post ${e.item.postId}`,
|
|
1777
1773
|
onClick: i[27] ||= j((e) => E(ye)(g.value + 1, e), ["stop"]),
|
|
1778
1774
|
onKeydown: i[28] ||= j(() => {}, ["stop"])
|
|
1779
|
-
}, [u(E(Je), { size: 20 })], 40,
|
|
1775
|
+
}, [u(E(Je), { size: 20 })], 40, tn)], 2)) : o("", !0),
|
|
1780
1776
|
_e.value ? (b(), s("button", {
|
|
1781
1777
|
key: 1,
|
|
1782
1778
|
class: "media-card-activator",
|
|
@@ -1784,9 +1780,9 @@ var Wt = [
|
|
|
1784
1780
|
"aria-label": `Open post ${e.item.postId}`,
|
|
1785
1781
|
onClick: i[29] ||= j((e) => r.$emit("activate", ve(e)), ["stop"]),
|
|
1786
1782
|
onKeydown: i[30] ||= j(() => {}, ["stop"])
|
|
1787
|
-
}, null, 40,
|
|
1788
|
-
], 42,
|
|
1789
|
-
e.cardFooter ? (b(), a(
|
|
1783
|
+
}, null, 40, nn)) : o("", !0)
|
|
1784
|
+
], 42, Gt),
|
|
1785
|
+
e.cardFooter ? (b(), a(nt, {
|
|
1790
1786
|
key: 1,
|
|
1791
1787
|
index: e.index,
|
|
1792
1788
|
item: e.item,
|
|
@@ -1809,17 +1805,17 @@ var Wt = [
|
|
|
1809
1805
|
"style",
|
|
1810
1806
|
"total"
|
|
1811
1807
|
])) : o("", !0)
|
|
1812
|
-
])], 46,
|
|
1808
|
+
])], 46, Ut));
|
|
1813
1809
|
}
|
|
1814
1810
|
});
|
|
1815
1811
|
//#endregion
|
|
1816
1812
|
//#region src/components/useMasonryMediaVisibility.ts
|
|
1817
|
-
function
|
|
1813
|
+
function an(e) {
|
|
1818
1814
|
function t(t) {
|
|
1819
1815
|
return t.flatMap((t) => {
|
|
1820
1816
|
let n = e.items()[t];
|
|
1821
1817
|
if (!n) return [];
|
|
1822
|
-
let r = e.mediaIndices().get(n.postId) ?? 0, i =
|
|
1818
|
+
let r = e.mediaIndices().get(n.postId) ?? 0, i = U(n.postId, r);
|
|
1823
1819
|
return e.previewStates().get(i) === "ready" ? [{
|
|
1824
1820
|
key: i,
|
|
1825
1821
|
mediaIndex: r,
|
|
@@ -1843,8 +1839,8 @@ function on(e) {
|
|
|
1843
1839
|
}
|
|
1844
1840
|
//#endregion
|
|
1845
1841
|
//#region src/components/useSettledMasonryFeedLayout.ts
|
|
1846
|
-
var
|
|
1847
|
-
function
|
|
1842
|
+
var on = 1500;
|
|
1843
|
+
function sn(e) {
|
|
1848
1844
|
let t = w(0), n = 0, i = null, a = 0, o = 0, s = null, c = 0, l = null, u = null, d = 0;
|
|
1849
1845
|
function f() {
|
|
1850
1846
|
s !== null && (cancelAnimationFrame(s), s = null);
|
|
@@ -1864,7 +1860,7 @@ function cn(e) {
|
|
|
1864
1860
|
minColumnWidth: e.minColumnWidth.value
|
|
1865
1861
|
}, r, a, {
|
|
1866
1862
|
throughIndex: e.packThroughIndex(),
|
|
1867
|
-
untilIndex: a +
|
|
1863
|
+
untilIndex: a + on
|
|
1868
1864
|
}), n, a, r), t.value += 1;
|
|
1869
1865
|
}));
|
|
1870
1866
|
}
|
|
@@ -1909,10 +1905,10 @@ function cn(e) {
|
|
|
1909
1905
|
}
|
|
1910
1906
|
//#endregion
|
|
1911
1907
|
//#region src/components/MasonryFeed.vue?vue&type=script&setup=true&lang.ts
|
|
1912
|
-
var
|
|
1908
|
+
var cn = { class: "masonry-feed-shell" }, ln = ["aria-hidden", "inert"], un = {
|
|
1913
1909
|
key: 0,
|
|
1914
1910
|
class: "masonry-feed-status-overlay"
|
|
1915
|
-
},
|
|
1911
|
+
}, dn = 6, fn = 12, pn = 250, mn = /* @__PURE__ */ d({
|
|
1916
1912
|
__name: "MasonryFeed",
|
|
1917
1913
|
props: {
|
|
1918
1914
|
enteringPostIds: {},
|
|
@@ -1951,7 +1947,7 @@ var ln = { class: "masonry-feed-shell" }, un = ["aria-hidden", "inert"], dn = {
|
|
|
1951
1947
|
"visible"
|
|
1952
1948
|
],
|
|
1953
1949
|
setup(t, { expose: n, emit: i }) {
|
|
1954
|
-
let l = 0, d = t, f = i, p = w(null), m = `vibe-masonry-${D()}`, g = w(null), y = w(0), x = w(
|
|
1950
|
+
let l = 0, d = t, f = i, p = w(null), m = `vibe-masonry-${D()}`, g = w(null), y = w(0), x = w(dn), C = w(0), T = w(0), k = w(0), A = w([]), j = w([]), M = w([]), N = 0, P = null, F = null, I = null, L = null, R = r(() => ({
|
|
1955
1951
|
additionalHeight: (d.cardHeader?.height ?? 0) + (d.cardFooter?.height ?? 0),
|
|
1956
1952
|
gap: x.value,
|
|
1957
1953
|
minColumnWidth: De(d.masonry)
|
|
@@ -1966,7 +1962,7 @@ var ln = { class: "masonry-feed-shell" }, un = ["aria-hidden", "inert"], dn = {
|
|
|
1966
1962
|
function ee() {
|
|
1967
1963
|
return M.value.reduce((e, t) => Math.max(e, t), -1);
|
|
1968
1964
|
}
|
|
1969
|
-
let V =
|
|
1965
|
+
let V = sn({
|
|
1970
1966
|
additionalHeight: r(() => R.value.additionalHeight),
|
|
1971
1967
|
gap: x,
|
|
1972
1968
|
items: () => d.items,
|
|
@@ -1974,28 +1970,28 @@ var ln = { class: "masonry-feed-shell" }, un = ["aria-hidden", "inert"], dn = {
|
|
|
1974
1970
|
packThroughIndex: ee,
|
|
1975
1971
|
packUntilBottom: B,
|
|
1976
1972
|
width: y
|
|
1977
|
-
}), H = V.layout,
|
|
1973
|
+
}), H = V.layout, te = V.viewportIndex, W = r(() => d.leavingPostIds.size === 0 ? null : ye(d.items, y.value, R.value, H.value, (e) => d.leavingPostIds.has(d.items[e].postId), {
|
|
1978
1974
|
throughIndex: ee(),
|
|
1979
1975
|
untilBottom: B()
|
|
1980
|
-
})),
|
|
1981
|
-
let e =
|
|
1976
|
+
})), G = r(() => {
|
|
1977
|
+
let e = W.value;
|
|
1982
1978
|
return e ? {
|
|
1983
1979
|
columns: e.columns,
|
|
1984
1980
|
height: e.height,
|
|
1985
1981
|
items: e.items
|
|
1986
1982
|
} : H.value;
|
|
1987
|
-
}),
|
|
1988
|
-
let e =
|
|
1989
|
-
return e ? we(e.items, e.retainedIndices,
|
|
1990
|
-
}),
|
|
1991
|
-
let t = d.items[e], n =
|
|
1983
|
+
}), ne = r(() => {
|
|
1984
|
+
let e = W.value;
|
|
1985
|
+
return e ? we(e.items, e.retainedIndices, te.value, e.fromIndex) : null;
|
|
1986
|
+
}), K = r(() => (H.value, Math.max(T.value, V.reservedHeight(), d.leavingPostIds.size === 0 ? G.value.height : H.value.height))), q = r(() => ({ height: `${K.value}px` })), re = r(() => !d.infiniteScroll || C.value > 0 && k.value + G.value.height <= C.value + 1), ie = r(() => new Set(j.value)), ae = r(() => M.value.flatMap((e) => {
|
|
1987
|
+
let t = d.items[e], n = G.value.items[e];
|
|
1992
1988
|
return !t || !n || n.width <= 0 || n.height <= 0 ? [] : [{
|
|
1993
|
-
fetchPriority:
|
|
1989
|
+
fetchPriority: ie.value.has(e) ? "high" : "low",
|
|
1994
1990
|
index: e,
|
|
1995
1991
|
item: t
|
|
1996
1992
|
}];
|
|
1997
1993
|
}));
|
|
1998
|
-
function
|
|
1994
|
+
function J(e, t) {
|
|
1999
1995
|
return [...new Set([...e, ...t])].sort((e, t) => e - t);
|
|
2000
1996
|
}
|
|
2001
1997
|
function se(e, t) {
|
|
@@ -2005,11 +2001,11 @@ var ln = { class: "masonry-feed-shell" }, un = ["aria-hidden", "inert"], dn = {
|
|
|
2005
2001
|
let t = {
|
|
2006
2002
|
scrollTop: N - k.value,
|
|
2007
2003
|
viewportHeight: C.value
|
|
2008
|
-
}, n =
|
|
2004
|
+
}, n = ne.value, r = Ee(n ?? te.value, {
|
|
2009
2005
|
...t,
|
|
2010
2006
|
overscan: e
|
|
2011
2007
|
}).indices;
|
|
2012
|
-
return
|
|
2008
|
+
return J(r, d.leavingPostIds.size === 0 ? [] : Ee(te.value, {
|
|
2013
2009
|
...t,
|
|
2014
2010
|
overscan: e
|
|
2015
2011
|
}).indices.filter((e) => {
|
|
@@ -2020,7 +2016,7 @@ var ln = { class: "masonry-feed-shell" }, un = ["aria-hidden", "inert"], dn = {
|
|
|
2020
2016
|
function le() {
|
|
2021
2017
|
let e = ce(0), t = ce(Oe(d.masonry, C.value));
|
|
2022
2018
|
se(j.value, e) || (j.value = e);
|
|
2023
|
-
let n = pe(
|
|
2019
|
+
let n = pe(G.value.items, e.filter((e) => {
|
|
2024
2020
|
let t = d.items[e];
|
|
2025
2021
|
return t && !d.leavingPostIds.has(t.postId);
|
|
2026
2022
|
}), {
|
|
@@ -2029,7 +2025,7 @@ var ln = { class: "masonry-feed-shell" }, un = ["aria-hidden", "inert"], dn = {
|
|
|
2029
2025
|
});
|
|
2030
2026
|
se(A.value, n) || (A.value = n), se(M.value, t) || (M.value = t);
|
|
2031
2027
|
}
|
|
2032
|
-
function
|
|
2028
|
+
function Y() {
|
|
2033
2029
|
if (L !== null) return;
|
|
2034
2030
|
L = -1;
|
|
2035
2031
|
let e = requestAnimationFrame(() => {
|
|
@@ -2037,7 +2033,7 @@ var ln = { class: "masonry-feed-shell" }, un = ["aria-hidden", "inert"], dn = {
|
|
|
2037
2033
|
});
|
|
2038
2034
|
L !== null && (L = e);
|
|
2039
2035
|
}
|
|
2040
|
-
|
|
2036
|
+
an({
|
|
2041
2037
|
fullyVisibleIndices: () => A.value,
|
|
2042
2038
|
items: () => d.items,
|
|
2043
2039
|
mediaIndices: () => d.mediaIndices,
|
|
@@ -2046,10 +2042,10 @@ var ln = { class: "masonry-feed-shell" }, un = ["aria-hidden", "inert"], dn = {
|
|
|
2046
2042
|
previewStates: () => d.previewStates,
|
|
2047
2043
|
visibleIndices: () => j.value
|
|
2048
2044
|
});
|
|
2049
|
-
function
|
|
2050
|
-
let t =
|
|
2045
|
+
function X(e) {
|
|
2046
|
+
let t = G.value.items[e], n = d.items[e]?.postId;
|
|
2051
2047
|
if (!t || t.width <= 0 || t.height <= 0) return {};
|
|
2052
|
-
let r = n !== void 0 && d.enteringPostIds.has(n), i = n !== void 0 && d.leavingPostIds.has(n), a = r || i ?
|
|
2048
|
+
let r = n !== void 0 && d.enteringPostIds.has(n), i = n !== void 0 && d.leavingPostIds.has(n), a = r || i ? de({
|
|
2053
2049
|
containerHeight: Math.max(T.value, H.value.height),
|
|
2054
2050
|
gap: x.value
|
|
2055
2051
|
}) : 0, o = n === void 0 ? 0 : i ? d.removalDelays.get(n) ?? 0 : r ? d.entryDelays.get(n) ?? 0 : 0;
|
|
@@ -2060,7 +2056,7 @@ var ln = { class: "masonry-feed-shell" }, un = ["aria-hidden", "inert"], dn = {
|
|
|
2060
2056
|
transform: `translate3d(${t.x}px, ${t.y + a}px, 0)`
|
|
2061
2057
|
};
|
|
2062
2058
|
}
|
|
2063
|
-
function
|
|
2059
|
+
function Z() {
|
|
2064
2060
|
let e = p.value;
|
|
2065
2061
|
if (!e) return;
|
|
2066
2062
|
N = e.scrollTop, C.value = e.clientHeight;
|
|
@@ -2071,18 +2067,18 @@ var ln = { class: "masonry-feed-shell" }, un = ["aria-hidden", "inert"], dn = {
|
|
|
2071
2067
|
}
|
|
2072
2068
|
function fe(e) {
|
|
2073
2069
|
let t = e.ownerDocument.documentElement.clientWidth;
|
|
2074
|
-
y.value = e.clientWidth, x.value = Math.min(
|
|
2070
|
+
y.value = e.clientWidth, x.value = Math.min(fn, Math.max(dn, t * .0075)), Z();
|
|
2075
2071
|
}
|
|
2076
2072
|
function Q(e) {
|
|
2077
2073
|
let t = e.currentTarget;
|
|
2078
|
-
t && (N = t.scrollTop, V.ensurePackedThrough(B()),
|
|
2074
|
+
t && (N = t.scrollTop, V.ensurePackedThrough(B()), Y(), Date.now() >= l && !d.loadMoreLocked && d.infiniteScroll && ue(t, d.masonry?.loadMoreThresholdPx) && f("loadMore"));
|
|
2079
2075
|
}
|
|
2080
2076
|
function me() {
|
|
2081
2077
|
let e = p.value;
|
|
2082
|
-
Date.now() >= l && !d.loadMoreLocked && e &&
|
|
2078
|
+
Date.now() >= l && !d.loadMoreLocked && e && ue(e, d.masonry?.loadMoreThresholdPx) && f("loadMore");
|
|
2083
2079
|
}
|
|
2084
2080
|
O(() => d.items.length, (e, t) => {
|
|
2085
|
-
e > 0 && e < t && (l = Date.now() +
|
|
2081
|
+
e > 0 && e < t && (l = Date.now() + pn);
|
|
2086
2082
|
});
|
|
2087
2083
|
function he() {
|
|
2088
2084
|
return p.value;
|
|
@@ -2095,19 +2091,19 @@ var ln = { class: "masonry-feed-shell" }, un = ["aria-hidden", "inert"], dn = {
|
|
|
2095
2091
|
}));
|
|
2096
2092
|
}), P.observe(e)));
|
|
2097
2093
|
}), O(p, (e) => {
|
|
2098
|
-
F?.disconnect(), F = null, e && (
|
|
2099
|
-
}), O(
|
|
2094
|
+
F?.disconnect(), F = null, e && (Z(), !(typeof ResizeObserver > "u") && (F = new ResizeObserver(Z), F.observe(e)));
|
|
2095
|
+
}), O(G, (e) => {
|
|
2100
2096
|
z = e.items;
|
|
2101
2097
|
}, { flush: "sync" }), O([
|
|
2102
2098
|
H,
|
|
2103
|
-
|
|
2099
|
+
G,
|
|
2104
2100
|
() => d.masonry
|
|
2105
2101
|
], le, { flush: "post" }), v(() => {
|
|
2106
2102
|
P?.disconnect(), F?.disconnect(), I !== null && cancelAnimationFrame(I), L !== null && cancelAnimationFrame(L);
|
|
2107
2103
|
}), n({
|
|
2108
2104
|
getScrollElement: he,
|
|
2109
2105
|
loadIfNearBottom: me
|
|
2110
|
-
}), (n, r) => (b(), s("div",
|
|
2106
|
+
}), (n, r) => (b(), s("div", cn, [
|
|
2111
2107
|
c("main", {
|
|
2112
2108
|
id: m,
|
|
2113
2109
|
ref_key: "galleryElement",
|
|
@@ -2121,9 +2117,9 @@ var ln = { class: "masonry-feed-shell" }, un = ["aria-hidden", "inert"], dn = {
|
|
|
2121
2117
|
ref_key: "masonryElement",
|
|
2122
2118
|
ref: g,
|
|
2123
2119
|
class: h(["masonry", { "masonry--ready": y.value > 0 }]),
|
|
2124
|
-
style: _(
|
|
2120
|
+
style: _(q.value),
|
|
2125
2121
|
"aria-label": "Media gallery"
|
|
2126
|
-
}, [(b(!0), s(e, null, S(
|
|
2122
|
+
}, [(b(!0), s(e, null, S(ae.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(rn, {
|
|
2127
2123
|
key: n.postId,
|
|
2128
2124
|
class: "masonry-item",
|
|
2129
2125
|
entering: t.enteringPostIds.has(n.postId),
|
|
@@ -2132,15 +2128,15 @@ var ln = { class: "masonry-feed-shell" }, un = ["aria-hidden", "inert"], dn = {
|
|
|
2132
2128
|
"card-footer": t.cardFooter,
|
|
2133
2129
|
"card-header": t.cardHeader,
|
|
2134
2130
|
"media-card": t.mediaCard,
|
|
2135
|
-
"in-viewport":
|
|
2131
|
+
"in-viewport": ie.value.has(r),
|
|
2136
2132
|
index: r,
|
|
2137
2133
|
item: n,
|
|
2138
|
-
"item-style":
|
|
2134
|
+
"item-style": X(r),
|
|
2139
2135
|
interactive: "",
|
|
2140
2136
|
layout: "masonry",
|
|
2141
2137
|
"loaded-count": t.items.length,
|
|
2142
2138
|
"media-index": t.mediaIndices.get(n.postId) ?? 0,
|
|
2143
|
-
"preview-state": t.previewStates.get(E(
|
|
2139
|
+
"preview-state": t.previewStates.get(E(U)(n.postId, t.mediaIndices.get(n.postId) ?? 0)) ?? "loading",
|
|
2144
2140
|
total: t.total,
|
|
2145
2141
|
onActivate: (e) => f("activate", n.postId, e),
|
|
2146
2142
|
onMediaChange: (e) => f("mediaChange", n.postId, e),
|
|
@@ -2172,8 +2168,8 @@ var ln = { class: "masonry-feed-shell" }, un = ["aria-hidden", "inert"], dn = {
|
|
|
2172
2168
|
class: "masonry-bottom-space",
|
|
2173
2169
|
"aria-hidden": "true",
|
|
2174
2170
|
style: _({ flex: `0 0 ${t.masonry.bottomSpacePx}px` })
|
|
2175
|
-
}, null, 4)) : o("", !0)], 42,
|
|
2176
|
-
t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext &&
|
|
2171
|
+
}, null, 4)) : o("", !0)], 42, ln),
|
|
2172
|
+
t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && re.value || !t.hasNext && t.canRetryEnd ? (b(), s("div", un, [u(oe, {
|
|
2177
2173
|
actions: t.feedFooterActions,
|
|
2178
2174
|
"can-retry-end": t.canRetryEnd,
|
|
2179
2175
|
"feed-footer": t.feedFooter,
|
|
@@ -2181,7 +2177,7 @@ var ln = { class: "masonry-feed-shell" }, un = ["aria-hidden", "inert"], dn = {
|
|
|
2181
2177
|
"has-next": t.hasNext,
|
|
2182
2178
|
"is-loading": t.isLoadingMore,
|
|
2183
2179
|
"load-more-locked": t.loadMoreLocked,
|
|
2184
|
-
"show-load-more":
|
|
2180
|
+
"show-load-more": re.value,
|
|
2185
2181
|
state: t.state,
|
|
2186
2182
|
onLoadMore: r[0] ||= (e) => f("loadMore"),
|
|
2187
2183
|
onRetryEnd: r[1] ||= (e) => f("retryEnd")
|
|
@@ -2197,7 +2193,7 @@ var ln = { class: "masonry-feed-shell" }, un = ["aria-hidden", "inert"], dn = {
|
|
|
2197
2193
|
"state"
|
|
2198
2194
|
])])) : o("", !0),
|
|
2199
2195
|
u(Le, {
|
|
2200
|
-
"content-size":
|
|
2196
|
+
"content-size": G.value.height,
|
|
2201
2197
|
"controls-id": m,
|
|
2202
2198
|
"scroll-element": p.value,
|
|
2203
2199
|
suspended: t.suspended
|
|
@@ -2208,28 +2204,27 @@ var ln = { class: "masonry-feed-shell" }, un = ["aria-hidden", "inert"], dn = {
|
|
|
2208
2204
|
])
|
|
2209
2205
|
]));
|
|
2210
2206
|
}
|
|
2211
|
-
}),
|
|
2212
|
-
function
|
|
2207
|
+
}), hn = 300;
|
|
2208
|
+
function gn(e, t, n) {
|
|
2213
2209
|
let r = e.scrollTop;
|
|
2214
2210
|
if (n || Math.abs(r - t) <= 1) return e.scrollTop = t, Promise.resolve();
|
|
2215
2211
|
e.setAttribute("data-transitioning", "");
|
|
2216
|
-
let i = performance.now()
|
|
2212
|
+
let i = performance.now();
|
|
2217
2213
|
return new Promise((n) => {
|
|
2218
|
-
let
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
requestAnimationFrame(o);
|
|
2214
|
+
let a = (o) => {
|
|
2215
|
+
let s = Math.max(0, o - i), c = Math.min(1, s / hn), l = 1 - (1 - c) ** 3;
|
|
2216
|
+
if (e.scrollTop = r + (t - r) * l, c < 1) {
|
|
2217
|
+
requestAnimationFrame(a);
|
|
2223
2218
|
return;
|
|
2224
2219
|
}
|
|
2225
2220
|
e.removeAttribute("data-transitioning"), e.scrollTop = t, n();
|
|
2226
2221
|
};
|
|
2227
|
-
requestAnimationFrame(
|
|
2222
|
+
requestAnimationFrame(a);
|
|
2228
2223
|
});
|
|
2229
2224
|
}
|
|
2230
2225
|
//#endregion
|
|
2231
2226
|
//#region src/components/ReelAutoAdvanceProgress.vue?vue&type=script&setup=true&lang.ts
|
|
2232
|
-
var
|
|
2227
|
+
var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
2233
2228
|
__name: "ReelAutoAdvanceProgress",
|
|
2234
2229
|
props: {
|
|
2235
2230
|
durationMs: {},
|
|
@@ -2247,9 +2242,9 @@ var vn = ["aria-label"], yn = /* @__PURE__ */ d({
|
|
|
2247
2242
|
class: "reel-auto-advance-progress",
|
|
2248
2243
|
style: _(a.value),
|
|
2249
2244
|
onAnimationend: n[0] ||= (e) => i("complete")
|
|
2250
|
-
}, null, 36)], 8,
|
|
2245
|
+
}, null, 36)], 8, _n));
|
|
2251
2246
|
}
|
|
2252
|
-
}),
|
|
2247
|
+
}), yn = { class: "reel-viewport" }, bn = ["data-active-post-id", "data-active-media-index"], xn = ["role", "data-status"], Sn = ["disabled"], Cn = 300, wn = 250, Tn = /* @__PURE__ */ d({
|
|
2253
2248
|
__name: "ReelFeed",
|
|
2254
2249
|
props: {
|
|
2255
2250
|
initialPostId: {},
|
|
@@ -2301,8 +2296,8 @@ var vn = ["aria-label"], yn = /* @__PURE__ */ d({
|
|
|
2301
2296
|
return e === void 0 ? 0 : u.mediaIndices.get(e) ?? 0;
|
|
2302
2297
|
}), z = r(() => {
|
|
2303
2298
|
let e = F.value;
|
|
2304
|
-
return e === void 0 ? "loading" : u.previewStates.get(
|
|
2305
|
-
}), B = r(() => I.value ?
|
|
2299
|
+
return e === void 0 ? "loading" : u.previewStates.get(U(e, R.value)) ?? "loading";
|
|
2300
|
+
}), B = r(() => I.value ? te(I.value, R.value) : null), H = r(() => B.value ? ee(B.value, u.mediaSource ?? "preview") : null), W = r(() => z.value === "ready" && !!(H.value && L(H.value.type, H.value.src))), G = r(() => [
|
|
2306
2301
|
F.value,
|
|
2307
2302
|
R.value,
|
|
2308
2303
|
u.items.length,
|
|
@@ -2310,14 +2305,14 @@ var vn = ["aria-label"], yn = /* @__PURE__ */ d({
|
|
|
2310
2305
|
u.reelAutoAdvance.enabled,
|
|
2311
2306
|
u.reelAutoAdvance.includePostItems,
|
|
2312
2307
|
u.reelAutoAdvance.intervalMs
|
|
2313
|
-
].join(":")),
|
|
2308
|
+
].join(":")), ne = r(() => {
|
|
2314
2309
|
let e = I.value, t = !!(e && u.reelAutoAdvance.includePostItems && R.value < V(e).length - 1), n = u.reelAutoAdvance.intervalMs / 1e3;
|
|
2315
2310
|
return `Auto advance to the next ${t ? "post item" : "post"} in ${n}s`;
|
|
2316
|
-
}),
|
|
2317
|
-
function
|
|
2311
|
+
}), K = r(() => u.reelAutoAdvance.enabled && u.reelForward.status === "idle" && I.value !== void 0 && z.value !== "loading" && !W.value), q = r(() => !u.infiniteScroll || u.items.length <= 1), re = r(() => u.reelForward.status === "end" && u.hasNext && !u.infiniteScroll && !u.loadMoreLocked), ie = r(() => u.reelForward.status === "loading" ? "Loading the next media…" : u.reelForward.status === "error" ? "Unable to load the next media." : re.value ? "Load the next page to continue." : "You reached the end of this feed.");
|
|
2312
|
+
function ae(e) {
|
|
2318
2313
|
return { gridRow: `${e + 1}` };
|
|
2319
2314
|
}
|
|
2320
|
-
function
|
|
2315
|
+
function J(e) {
|
|
2321
2316
|
let t = k || e.clientHeight;
|
|
2322
2317
|
return t <= 0 || u.items.length === 0 ? 0 : Math.min(u.items.length - 1, Math.max(0, Math.round(e.scrollTop / t)));
|
|
2323
2318
|
}
|
|
@@ -2325,11 +2320,11 @@ var vn = ["aria-label"], yn = /* @__PURE__ */ d({
|
|
|
2325
2320
|
let t = e.currentTarget;
|
|
2326
2321
|
if (!t) return;
|
|
2327
2322
|
let n = k || t.clientHeight, r = Math.max(0, u.items.length - 1) * n;
|
|
2328
|
-
C.value = u.items.length > 0 && t.scrollTop > r + 1, D.value
|
|
2323
|
+
C.value = u.items.length > 0 && t.scrollTop > r + 1, !D.value && !t.hasAttribute("data-transitioning") && (x.value = J(t)), Date.now() >= l && !u.loadMoreLocked && u.infiniteScroll && ue(t) && d("loadMore");
|
|
2329
2324
|
}
|
|
2330
2325
|
function ce() {
|
|
2331
2326
|
let e = f.value;
|
|
2332
|
-
e && (C.value = !1,
|
|
2327
|
+
e && (C.value = !1, X(!0), k = e.clientHeight, e.scrollTop = x.value * k, j !== null && cancelAnimationFrame(j), j = requestAnimationFrame(() => {
|
|
2333
2328
|
e.scrollTop = x.value * e.clientHeight, k = e.clientHeight, j = null;
|
|
2334
2329
|
}), le());
|
|
2335
2330
|
}
|
|
@@ -2337,25 +2332,25 @@ var vn = ["aria-label"], yn = /* @__PURE__ */ d({
|
|
|
2337
2332
|
M !== null && clearTimeout(M), M = setTimeout(() => {
|
|
2338
2333
|
M = null;
|
|
2339
2334
|
let e = f.value;
|
|
2340
|
-
e && (k = e.clientHeight, e.scrollTop = x.value * k),
|
|
2335
|
+
e && (k = e.clientHeight, e.scrollTop = x.value * k), X(!1);
|
|
2341
2336
|
}, 120);
|
|
2342
2337
|
}
|
|
2343
|
-
function
|
|
2344
|
-
|
|
2338
|
+
function Y() {
|
|
2339
|
+
X(!0);
|
|
2345
2340
|
let e = f.value;
|
|
2346
2341
|
e && (k = e.clientHeight, e.scrollTop = x.value * k), le();
|
|
2347
2342
|
}
|
|
2348
|
-
function
|
|
2343
|
+
function X(e) {
|
|
2349
2344
|
D.value = e, f.value?.toggleAttribute("data-resizing", e);
|
|
2350
2345
|
}
|
|
2351
|
-
function
|
|
2346
|
+
function de() {
|
|
2352
2347
|
let e = f.value;
|
|
2353
|
-
Date.now() >= l && !u.loadMoreLocked && e &&
|
|
2348
|
+
Date.now() >= l && !u.loadMoreLocked && e && ue(e) && d("loadMore");
|
|
2354
2349
|
}
|
|
2355
2350
|
O(() => u.items.length, (e, t) => {
|
|
2356
|
-
e > 0 && e < t && (l = Date.now() +
|
|
2351
|
+
e > 0 && e < t && (l = Date.now() + wn);
|
|
2357
2352
|
});
|
|
2358
|
-
function
|
|
2353
|
+
function Z(e) {
|
|
2359
2354
|
let t = I.value;
|
|
2360
2355
|
if (!t) return !1;
|
|
2361
2356
|
let n = V(t).length;
|
|
@@ -2378,7 +2373,7 @@ var vn = ["aria-label"], yn = /* @__PURE__ */ d({
|
|
|
2378
2373
|
let t = f.value;
|
|
2379
2374
|
if (!t) return Promise.resolve();
|
|
2380
2375
|
let n = e * (k || t.clientHeight);
|
|
2381
|
-
return x.value = e,
|
|
2376
|
+
return x.value = e, gn(t, n, Q());
|
|
2382
2377
|
}
|
|
2383
2378
|
function he(e) {
|
|
2384
2379
|
me(e);
|
|
@@ -2388,7 +2383,7 @@ var vn = ["aria-label"], yn = /* @__PURE__ */ d({
|
|
|
2388
2383
|
return t < 0 || t === x.value ? !1 : (await me(t), !0);
|
|
2389
2384
|
}
|
|
2390
2385
|
async function _e(e) {
|
|
2391
|
-
return
|
|
2386
|
+
return Z(e) ? (Q() || await new Promise((e) => setTimeout(e, Cn)), !0) : !1;
|
|
2392
2387
|
}
|
|
2393
2388
|
function ve() {
|
|
2394
2389
|
if (!u.reelAutoAdvance.enabled) return;
|
|
@@ -2406,7 +2401,7 @@ var vn = ["aria-label"], yn = /* @__PURE__ */ d({
|
|
|
2406
2401
|
u.reelAutoAdvance.includePostItems && (u.mediaIndices.get(n.postId) ?? 0) !== 0 && d("mediaChange", n.postId, 0), he(t);
|
|
2407
2402
|
}
|
|
2408
2403
|
function ye(e, t) {
|
|
2409
|
-
!u.reelAutoAdvance.enabled || e !== F.value || t !== R.value || !
|
|
2404
|
+
!u.reelAutoAdvance.enabled || e !== F.value || t !== R.value || !W.value || ve();
|
|
2410
2405
|
}
|
|
2411
2406
|
return O(f, (e) => {
|
|
2412
2407
|
A?.disconnect(), A = null, e && (k = e.clientHeight, !(typeof ResizeObserver > "u") && (A = new ResizeObserver(ce), A.observe(e)));
|
|
@@ -2416,14 +2411,14 @@ var vn = ["aria-label"], yn = /* @__PURE__ */ d({
|
|
|
2416
2411
|
}), O(F, (e) => {
|
|
2417
2412
|
e !== void 0 && d("activeChange", e);
|
|
2418
2413
|
}, { immediate: !0 }), y(() => {
|
|
2419
|
-
window.addEventListener("resize",
|
|
2414
|
+
window.addEventListener("resize", Y), window.addEventListener("orientationchange", Y), g >= 0 && m(ce);
|
|
2420
2415
|
}), v(() => {
|
|
2421
|
-
window.removeEventListener("resize",
|
|
2416
|
+
window.removeEventListener("resize", Y), window.removeEventListener("orientationchange", Y), A?.disconnect(), j !== null && cancelAnimationFrame(j), M !== null && clearTimeout(M);
|
|
2422
2417
|
}), n({
|
|
2423
2418
|
activeIndex: x,
|
|
2424
2419
|
activePostId: F,
|
|
2425
|
-
changeActiveMedia:
|
|
2426
|
-
loadIfNearBottom:
|
|
2420
|
+
changeActiveMedia: Z,
|
|
2421
|
+
loadIfNearBottom: de,
|
|
2427
2422
|
moveActivePost: fe,
|
|
2428
2423
|
navigateToItem: pe,
|
|
2429
2424
|
transitionActiveMedia: _e,
|
|
@@ -2435,7 +2430,7 @@ var vn = ["aria-label"], yn = /* @__PURE__ */ d({
|
|
|
2435
2430
|
}]),
|
|
2436
2431
|
"data-layout-mode": "reel"
|
|
2437
2432
|
}, [
|
|
2438
|
-
t.cardHeader && I.value && t.reelForward.status === "idle" ? (b(), a(
|
|
2433
|
+
t.cardHeader && I.value && t.reelForward.status === "idle" ? (b(), a(nt, {
|
|
2439
2434
|
key: 0,
|
|
2440
2435
|
index: x.value,
|
|
2441
2436
|
item: I.value,
|
|
@@ -2457,7 +2452,7 @@ var vn = ["aria-label"], yn = /* @__PURE__ */ d({
|
|
|
2457
2452
|
"style",
|
|
2458
2453
|
"total"
|
|
2459
2454
|
])) : o("", !0),
|
|
2460
|
-
c("div",
|
|
2455
|
+
c("div", yn, [c("div", {
|
|
2461
2456
|
ref_key: "galleryElement",
|
|
2462
2457
|
ref: f,
|
|
2463
2458
|
class: "gallery-shell reel-feed",
|
|
@@ -2469,7 +2464,7 @@ var vn = ["aria-label"], yn = /* @__PURE__ */ d({
|
|
|
2469
2464
|
class: "reel-track",
|
|
2470
2465
|
style: _(N.value),
|
|
2471
2466
|
"aria-label": "Media gallery"
|
|
2472
|
-
}, [(b(!0), s(e, null, S(P.value, ({ fetchPriority: e, item: n, index: i }) => (b(), a(
|
|
2467
|
+
}, [(b(!0), s(e, null, S(P.value, ({ fetchPriority: e, item: n, index: i }) => (b(), a(rn, {
|
|
2473
2468
|
key: n.postId,
|
|
2474
2469
|
active: i === x.value && !C.value,
|
|
2475
2470
|
"advance-on-media-end": u.reelAutoAdvance.enabled && i === x.value,
|
|
@@ -2478,13 +2473,13 @@ var vn = ["aria-label"], yn = /* @__PURE__ */ d({
|
|
|
2478
2473
|
"fetch-priority": e,
|
|
2479
2474
|
index: i,
|
|
2480
2475
|
item: n,
|
|
2481
|
-
"item-style":
|
|
2476
|
+
"item-style": ae(i),
|
|
2482
2477
|
"media-card": t.mediaCard,
|
|
2483
2478
|
layout: "reel",
|
|
2484
2479
|
"loaded-count": t.items.length,
|
|
2485
2480
|
"media-index": t.mediaIndices.get(n.postId) ?? 0,
|
|
2486
2481
|
"media-source": t.mediaSource,
|
|
2487
|
-
"preview-state": t.previewStates.get(E(
|
|
2482
|
+
"preview-state": t.previewStates.get(E(U)(n.postId, t.mediaIndices.get(n.postId) ?? 0)) ?? "loading",
|
|
2488
2483
|
"reel-controls-target": p.value,
|
|
2489
2484
|
"reel-audio-state": t.reelAudioState,
|
|
2490
2485
|
"stationary-reel-controls": "",
|
|
@@ -2520,13 +2515,13 @@ var vn = ["aria-label"], yn = /* @__PURE__ */ d({
|
|
|
2520
2515
|
class: "reel-forward-status",
|
|
2521
2516
|
role: t.reelForward.status === "error" ? "alert" : "status",
|
|
2522
2517
|
"data-status": t.reelForward.status
|
|
2523
|
-
}, [c("p", null, T(
|
|
2518
|
+
}, [c("p", null, T(ie.value), 1), t.reelForward.status === "error" || t.reelForward.status === "end" ? (b(), s("button", {
|
|
2524
2519
|
key: 0,
|
|
2525
2520
|
class: "reel-forward-retry",
|
|
2526
2521
|
type: "button",
|
|
2527
2522
|
disabled: t.loadMoreLocked,
|
|
2528
2523
|
onClick: r[0] ||= (e) => d("retryForward")
|
|
2529
|
-
}, T(
|
|
2524
|
+
}, T(re.value ? "Load more" : "Retry"), 9, Sn)) : o("", !0)], 8, xn)), t.reelForward.status === "idle" ? (b(), a(oe, {
|
|
2530
2525
|
key: 2,
|
|
2531
2526
|
actions: t.feedFooterActions,
|
|
2532
2527
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2535,7 +2530,7 @@ var vn = ["aria-label"], yn = /* @__PURE__ */ d({
|
|
|
2535
2530
|
"has-next": t.hasNext,
|
|
2536
2531
|
"is-loading": t.isLoadingMore,
|
|
2537
2532
|
"load-more-locked": t.loadMoreLocked,
|
|
2538
|
-
"show-load-more":
|
|
2533
|
+
"show-load-more": q.value,
|
|
2539
2534
|
state: t.state,
|
|
2540
2535
|
onLoadMore: r[2] ||= (e) => d("loadMore"),
|
|
2541
2536
|
onRetryEnd: r[3] ||= (e) => d("retryEnd")
|
|
@@ -2549,13 +2544,13 @@ var vn = ["aria-label"], yn = /* @__PURE__ */ d({
|
|
|
2549
2544
|
"load-more-locked",
|
|
2550
2545
|
"show-load-more",
|
|
2551
2546
|
"state"
|
|
2552
|
-
])) : o("", !0)], 40,
|
|
2547
|
+
])) : o("", !0)], 40, bn), c("div", {
|
|
2553
2548
|
ref_key: "reelControlsElement",
|
|
2554
2549
|
ref: p,
|
|
2555
2550
|
class: "reel-media-controls-host",
|
|
2556
2551
|
"data-test": "reel-media-controls-host"
|
|
2557
2552
|
}, null, 512)]),
|
|
2558
|
-
t.cardFooter && I.value && t.reelForward.status === "idle" ? (b(), a(
|
|
2553
|
+
t.cardFooter && I.value && t.reelForward.status === "idle" ? (b(), a(nt, {
|
|
2559
2554
|
key: 1,
|
|
2560
2555
|
index: x.value,
|
|
2561
2556
|
item: I.value,
|
|
@@ -2577,26 +2572,27 @@ var vn = ["aria-label"], yn = /* @__PURE__ */ d({
|
|
|
2577
2572
|
"style",
|
|
2578
2573
|
"total"
|
|
2579
2574
|
])) : o("", !0),
|
|
2580
|
-
|
|
2581
|
-
key:
|
|
2575
|
+
K.value ? (b(), a(vn, {
|
|
2576
|
+
key: G.value,
|
|
2582
2577
|
"duration-ms": t.reelAutoAdvance.intervalMs,
|
|
2583
|
-
label:
|
|
2578
|
+
label: ne.value,
|
|
2584
2579
|
onComplete: ve
|
|
2585
2580
|
}, null, 8, ["duration-ms", "label"])) : o("", !0)
|
|
2586
2581
|
], 2));
|
|
2587
2582
|
}
|
|
2588
|
-
}),
|
|
2583
|
+
}), En = ["data-info-sheet-open", "data-info-sheet-mode"], Dn = ["aria-hidden", "inert"], On = {
|
|
2589
2584
|
key: 0,
|
|
2590
2585
|
class: "reel-info-sheet-layer",
|
|
2591
2586
|
"data-test": "reel-info-sheet"
|
|
2592
|
-
},
|
|
2587
|
+
}, kn = [
|
|
2593
2588
|
"role",
|
|
2594
2589
|
"aria-modal",
|
|
2595
2590
|
"tabindex",
|
|
2596
2591
|
"data-active-post-id"
|
|
2597
|
-
],
|
|
2592
|
+
], An = /* @__PURE__ */ d({
|
|
2598
2593
|
__name: "ReelLayout",
|
|
2599
2594
|
props: {
|
|
2595
|
+
entryPending: { type: Boolean },
|
|
2600
2596
|
forwardIndex: { default: null },
|
|
2601
2597
|
forwardItem: { default: null },
|
|
2602
2598
|
infoSheet: {},
|
|
@@ -2657,7 +2653,7 @@ var vn = ["aria-label"], yn = /* @__PURE__ */ d({
|
|
|
2657
2653
|
loadedCount: l.items.length,
|
|
2658
2654
|
mediaCount: V(e).length,
|
|
2659
2655
|
mediaIndex: D.value,
|
|
2660
|
-
mediaItem:
|
|
2656
|
+
mediaItem: te(e, D.value),
|
|
2661
2657
|
mediaSource: l.mediaSource ?? "preview",
|
|
2662
2658
|
origin: l.origin,
|
|
2663
2659
|
total: l.total
|
|
@@ -2721,8 +2717,8 @@ var vn = ["aria-label"], yn = /* @__PURE__ */ d({
|
|
|
2721
2717
|
}, [c("div", {
|
|
2722
2718
|
class: "reel-layout-main",
|
|
2723
2719
|
"aria-hidden": e.infoSheetOverlay && A.value || void 0,
|
|
2724
|
-
inert: e.infoSheetOverlay && A.value || void 0
|
|
2725
|
-
}, [u(
|
|
2720
|
+
inert: e.entryPending || e.infoSheetOverlay && A.value || void 0
|
|
2721
|
+
}, [u(Tn, {
|
|
2726
2722
|
ref_key: "reelFeed",
|
|
2727
2723
|
ref: p,
|
|
2728
2724
|
"can-retry-end": e.canRetryEnd,
|
|
@@ -2777,8 +2773,8 @@ var vn = ["aria-label"], yn = /* @__PURE__ */ d({
|
|
|
2777
2773
|
"reel-forward",
|
|
2778
2774
|
"state",
|
|
2779
2775
|
"total"
|
|
2780
|
-
])], 8,
|
|
2781
|
-
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div",
|
|
2776
|
+
])], 8, Dn), u(n, { name: "vibe-info-sheet" }, {
|
|
2777
|
+
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", On, [c("aside", {
|
|
2782
2778
|
ref_key: "sheetElement",
|
|
2783
2779
|
ref: _,
|
|
2784
2780
|
class: "reel-info-sheet",
|
|
@@ -2787,17 +2783,32 @@ var vn = ["aria-label"], yn = /* @__PURE__ */ d({
|
|
|
2787
2783
|
"aria-modal": e.infoSheetOverlay ? "true" : void 0,
|
|
2788
2784
|
tabindex: e.infoSheetOverlay ? -1 : void 0,
|
|
2789
2785
|
"data-active-post-id": T.value?.postId
|
|
2790
|
-
}, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8,
|
|
2786
|
+
}, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8, kn)])) : o("", !0)]),
|
|
2791
2787
|
_: 1
|
|
2792
|
-
})], 10,
|
|
2793
|
-
}
|
|
2794
|
-
})
|
|
2788
|
+
})], 10, En));
|
|
2789
|
+
}
|
|
2790
|
+
}), jn = (e, t) => {
|
|
2791
|
+
let n = e.__vccOpts || e;
|
|
2792
|
+
for (let [e, r] of t) n[e] = r;
|
|
2793
|
+
return n;
|
|
2794
|
+
}, Mn = {}, Nn = {
|
|
2795
|
+
class: "vibe-reel-entry-spinner",
|
|
2796
|
+
role: "status",
|
|
2797
|
+
"aria-label": "Loading media"
|
|
2798
|
+
};
|
|
2799
|
+
function Pn(e, t) {
|
|
2800
|
+
return b(), s("div", Nn, [...t[0] ||= [c("span", {
|
|
2801
|
+
class: "vibe-reel-entry-spinner-ring",
|
|
2802
|
+
"aria-hidden": "true"
|
|
2803
|
+
}, null, -1)]]);
|
|
2804
|
+
}
|
|
2805
|
+
var Fn = /* @__PURE__ */ jn(Mn, [["render", Pn]]);
|
|
2795
2806
|
//#endregion
|
|
2796
2807
|
//#region src/core/mediaLifecycle.ts
|
|
2797
|
-
function
|
|
2808
|
+
function In(e, t, n, r, i) {
|
|
2798
2809
|
let a = e.items.findIndex((e) => e.postId === t), o = e.items[a];
|
|
2799
2810
|
if (!o) return null;
|
|
2800
|
-
let s = H(o, n), c =
|
|
2811
|
+
let s = H(o, n), c = te(o, s);
|
|
2801
2812
|
return {
|
|
2802
2813
|
item: o,
|
|
2803
2814
|
layout: r,
|
|
@@ -2810,7 +2821,7 @@ function Mn(e, t, n, r, i) {
|
|
|
2810
2821
|
postIndex: a
|
|
2811
2822
|
};
|
|
2812
2823
|
}
|
|
2813
|
-
function
|
|
2824
|
+
function Ln(e, t) {
|
|
2814
2825
|
O(() => {
|
|
2815
2826
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null;
|
|
2816
2827
|
return {
|
|
@@ -2820,23 +2831,23 @@ function Nn(e, t) {
|
|
|
2820
2831
|
};
|
|
2821
2832
|
}, (n, r) => {
|
|
2822
2833
|
if (n.postId === null || n.postId === r?.postId && n.mediaIndex === r.mediaIndex && n.origin === r.origin) return;
|
|
2823
|
-
let i =
|
|
2834
|
+
let i = In(e, n.postId, n.mediaIndex, "reel", n.origin);
|
|
2824
2835
|
i && t(i);
|
|
2825
2836
|
}, { flush: "sync" });
|
|
2826
2837
|
}
|
|
2827
2838
|
//#endregion
|
|
2828
2839
|
//#region src/components/useMediaLifecycle.ts
|
|
2829
|
-
function
|
|
2830
|
-
let n = /* @__PURE__ */ new Set(), i = w(/* @__PURE__ */ new Map()), a = w(/* @__PURE__ */ new Map()), o = w(/* @__PURE__ */ new Map()), s = () => e.reelMediaSource === "preview" ? i : e.reelMediaSource === "mobile" ? o : a, c = r(() => s().value), l = /* @__PURE__ */ new Set();
|
|
2840
|
+
function Rn(e, t) {
|
|
2841
|
+
let n = /* @__PURE__ */ new Set(), i = w(/* @__PURE__ */ new Map()), a = w(/* @__PURE__ */ new Map()), o = w(/* @__PURE__ */ new Map()), s = () => e.reelOrigin === "masonry" ? a : e.reelMediaSource === "preview" ? i : e.reelMediaSource === "mobile" ? o : a, c = r(() => s().value), l = /* @__PURE__ */ new Set();
|
|
2831
2842
|
function u() {
|
|
2832
2843
|
n.clear(), l.clear(), i.value = /* @__PURE__ */ new Map(), a.value = /* @__PURE__ */ new Map(), o.value = /* @__PURE__ */ new Map();
|
|
2833
2844
|
}
|
|
2834
2845
|
function d(e, t, n, r) {
|
|
2835
|
-
let i =
|
|
2846
|
+
let i = U(t, n);
|
|
2836
2847
|
e.value.get(i) !== r && (e.value = new Map(e.value).set(i, r));
|
|
2837
2848
|
}
|
|
2838
2849
|
function f(t, n, r, i) {
|
|
2839
|
-
return
|
|
2850
|
+
return In(e, t, n, r, i);
|
|
2840
2851
|
}
|
|
2841
2852
|
function p(e, n, r, i) {
|
|
2842
2853
|
let a = f(e, n, r, i);
|
|
@@ -2862,13 +2873,13 @@ function Pn(e, t) {
|
|
|
2862
2873
|
d(s(), t, n, "ready"), p(t, n, "reel", e.reelOrigin ?? "reel");
|
|
2863
2874
|
}
|
|
2864
2875
|
function y(e, n) {
|
|
2865
|
-
let r =
|
|
2876
|
+
let r = U(e, n);
|
|
2866
2877
|
if (l.has(r)) return;
|
|
2867
2878
|
let i = f(e, n, "masonry", null);
|
|
2868
2879
|
i && (l.add(r), t.visible(i));
|
|
2869
2880
|
}
|
|
2870
2881
|
function b(e, r, i, a) {
|
|
2871
|
-
let o = [i,
|
|
2882
|
+
let o = [i, U(e, r)].join(":");
|
|
2872
2883
|
if (n.has(o)) return;
|
|
2873
2884
|
let s = f(e, r, i, a);
|
|
2874
2885
|
s && (n.add(o), t.fullyVisible(s));
|
|
@@ -2876,13 +2887,13 @@ function Pn(e, t) {
|
|
|
2876
2887
|
function x(e, t) {
|
|
2877
2888
|
b(e, t, "masonry", null);
|
|
2878
2889
|
}
|
|
2879
|
-
return
|
|
2890
|
+
return Ln(e, t.reelChange), O(() => {
|
|
2880
2891
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null, n = t === null ? 0 : e.mediaIndices.get(t) ?? 0;
|
|
2881
2892
|
return {
|
|
2882
2893
|
mediaIndex: n,
|
|
2883
2894
|
origin: e.reelOrigin ?? "reel",
|
|
2884
2895
|
postId: t,
|
|
2885
|
-
ready: t !== null && c.value.get(
|
|
2896
|
+
ready: t !== null && c.value.get(U(t, n)) === "ready"
|
|
2886
2897
|
};
|
|
2887
2898
|
}, (e, t) => {
|
|
2888
2899
|
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);
|
|
@@ -2902,66 +2913,111 @@ function Pn(e, t) {
|
|
|
2902
2913
|
}
|
|
2903
2914
|
//#endregion
|
|
2904
2915
|
//#region src/core/reelEscapeStack.ts
|
|
2905
|
-
var
|
|
2906
|
-
function
|
|
2907
|
-
return
|
|
2908
|
-
let t =
|
|
2909
|
-
t >= 0 &&
|
|
2916
|
+
var zn = [];
|
|
2917
|
+
function Bn(e) {
|
|
2918
|
+
return zn.push(e), () => {
|
|
2919
|
+
let t = zn.indexOf(e);
|
|
2920
|
+
t >= 0 && zn.splice(t, 1);
|
|
2910
2921
|
};
|
|
2911
2922
|
}
|
|
2912
|
-
function
|
|
2923
|
+
function Vn(e) {
|
|
2913
2924
|
if (!e.isActive()) return !1;
|
|
2914
|
-
let t =
|
|
2915
|
-
|
|
2925
|
+
let t = zn.filter((e) => e.isActive()), n = e.element();
|
|
2926
|
+
if (n !== null && t.some((t) => {
|
|
2916
2927
|
if (t === e) return !1;
|
|
2917
2928
|
let r = t.element();
|
|
2918
2929
|
return r !== null && n.contains(r);
|
|
2919
|
-
})
|
|
2930
|
+
})) return !1;
|
|
2931
|
+
let r = t.filter((e) => {
|
|
2920
2932
|
let n = e.element();
|
|
2921
2933
|
return n === null || !t.some((t) => {
|
|
2922
2934
|
if (t === e) return !1;
|
|
2923
2935
|
let r = t.element();
|
|
2924
2936
|
return r !== null && n.contains(r);
|
|
2925
2937
|
});
|
|
2926
|
-
})
|
|
2938
|
+
});
|
|
2939
|
+
return (r.filter((e) => e.element()?.contains(document.activeElement)).at(-1) ?? r.at(-1)) === e;
|
|
2927
2940
|
}
|
|
2928
2941
|
//#endregion
|
|
2929
2942
|
//#region src/components/useReelKeyboard.ts
|
|
2930
|
-
function
|
|
2943
|
+
function Hn(e) {
|
|
2931
2944
|
let t = {
|
|
2932
2945
|
element: e.element,
|
|
2933
2946
|
isActive: () => e.state.layout === "reel" || e.state.reelOrigin === "masonry"
|
|
2934
2947
|
}, n = null;
|
|
2935
2948
|
function r(n) {
|
|
2936
|
-
|
|
2937
|
-
|
|
2949
|
+
if (n.defaultPrevented) return;
|
|
2950
|
+
let r = n.target, i = r instanceof Element ? r.closest("dialog, [role=\"dialog\"], [role=\"alertdialog\"]") : null;
|
|
2951
|
+
if (n.key === "Escape" && i && !e.element()?.contains(i)) return;
|
|
2952
|
+
let a = t.isActive();
|
|
2953
|
+
if (n.key === "Escape" && a && !Vn(t)) return;
|
|
2938
2954
|
if (n.key === "Escape" && e.state.reelOrigin === "masonry") {
|
|
2939
2955
|
n.preventDefault(), e.state.reelInfoSheetOverlay && e.state.reelInfoSheet.enabled && e.setReelInfoSheet(!1), e.closeMasonryReel();
|
|
2940
2956
|
return;
|
|
2941
2957
|
}
|
|
2942
|
-
if (n.key === "Escape" &&
|
|
2958
|
+
if (n.key === "Escape" && a && e.state.reelInfoSheet.enabled) {
|
|
2943
2959
|
n.preventDefault(), e.setReelInfoSheet(!1);
|
|
2944
2960
|
return;
|
|
2945
2961
|
}
|
|
2946
|
-
if (n.
|
|
2947
|
-
let i = n.target;
|
|
2948
|
-
if (i instanceof HTMLElement && (i.isContentEditable || [
|
|
2962
|
+
if (n.altKey || n.ctrlKey || n.metaKey || n.shiftKey || e.isReelLeaving() || !a || r instanceof HTMLElement && (r.isContentEditable || [
|
|
2949
2963
|
"INPUT",
|
|
2950
2964
|
"SELECT",
|
|
2951
2965
|
"TEXTAREA"
|
|
2952
|
-
].includes(
|
|
2953
|
-
let
|
|
2954
|
-
|
|
2966
|
+
].includes(r.tagName))) return;
|
|
2967
|
+
let o = n.key === "ArrowLeft" ? -1 : n.key === "ArrowRight" ? 1 : 0;
|
|
2968
|
+
o !== 0 && e.reelRenderer()?.changeActiveMedia?.(o) && n.preventDefault();
|
|
2955
2969
|
}
|
|
2956
2970
|
y(() => {
|
|
2957
|
-
n =
|
|
2971
|
+
n = Bn(t), window.addEventListener("keydown", r);
|
|
2958
2972
|
}), v(() => {
|
|
2959
2973
|
window.removeEventListener("keydown", r), n?.(), n = null;
|
|
2960
2974
|
});
|
|
2961
2975
|
}
|
|
2962
2976
|
//#endregion
|
|
2977
|
+
//#region src/components/useReelEntryReveal.ts
|
|
2978
|
+
function Un(e, t) {
|
|
2979
|
+
let n = w("waiting"), i = typeof matchMedia == "function" ? matchMedia("(prefers-reduced-motion: reduce)") : null, a = !1, o = null, s = r(() => {
|
|
2980
|
+
let t = e.items.find((t) => t.postId === e.activeReelPostId);
|
|
2981
|
+
if (!t) return null;
|
|
2982
|
+
let n = e.mediaIndices.get(t.postId) ?? 0, r = te(t, n);
|
|
2983
|
+
return JSON.stringify([
|
|
2984
|
+
t.postId,
|
|
2985
|
+
n,
|
|
2986
|
+
r.src,
|
|
2987
|
+
r.type
|
|
2988
|
+
]);
|
|
2989
|
+
});
|
|
2990
|
+
function c() {
|
|
2991
|
+
if (e.reelOrigin !== "masonry" || !a || n.value !== "waiting" || s.value === null || o !== s.value) return;
|
|
2992
|
+
let r = t.value?.querySelector(".reel-layout-main");
|
|
2993
|
+
r && (getComputedStyle(r).opacity, n.value = i?.matches ? "ready" : "revealing");
|
|
2994
|
+
}
|
|
2995
|
+
function l(t, n) {
|
|
2996
|
+
e.reelOrigin !== "masonry" || t !== e.activeReelPostId || n !== (e.mediaIndices.get(t) ?? 0) || (o = s.value, m(c));
|
|
2997
|
+
}
|
|
2998
|
+
function u() {
|
|
2999
|
+
a = !0, c();
|
|
3000
|
+
}
|
|
3001
|
+
function d(e) {
|
|
3002
|
+
e.target instanceof HTMLElement && e.target.matches(".reel-layout-main") && e.propertyName === "opacity" && n.value === "revealing" && (n.value = "ready");
|
|
3003
|
+
}
|
|
3004
|
+
function f() {
|
|
3005
|
+
i?.matches && n.value === "revealing" && (n.value = "ready");
|
|
3006
|
+
}
|
|
3007
|
+
return O(() => e.reelOrigin, (e) => {
|
|
3008
|
+
e === "masonry" && (a = !1, o = null, n.value = "waiting");
|
|
3009
|
+
}, { flush: "sync" }), O(s, () => {
|
|
3010
|
+
o = null, n.value === "revealing" && (n.value = "waiting");
|
|
3011
|
+
}, { flush: "sync" }), y(() => i?.addEventListener("change", f)), v(() => i?.removeEventListener("change", f)), {
|
|
3012
|
+
phase: n,
|
|
3013
|
+
finishSlide: u,
|
|
3014
|
+
finishFade: d,
|
|
3015
|
+
markSettled: l
|
|
3016
|
+
};
|
|
3017
|
+
}
|
|
3018
|
+
//#endregion
|
|
2963
3019
|
//#region src/components/VibeSurface.vue?vue&type=script&setup=true&lang.ts
|
|
2964
|
-
var
|
|
3020
|
+
var Wn = ["data-reel-entry"], Gn = 35, Kn = 420, qn = /* @__PURE__ */ d({
|
|
2965
3021
|
__name: "VibeSurface",
|
|
2966
3022
|
props: {
|
|
2967
3023
|
canRetryEnd: { type: Boolean },
|
|
@@ -2991,20 +3047,20 @@ var zn = 35, Bn = 420, Vn = /* @__PURE__ */ d({
|
|
|
2991
3047
|
"retryForward"
|
|
2992
3048
|
],
|
|
2993
3049
|
setup(t, { expose: i, emit: c }) {
|
|
2994
|
-
let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), _ = w(!1), y = w(/* @__PURE__ */ new Set()), x = w(/* @__PURE__ */ new Map()), S = w(/* @__PURE__ */ new Set()), C = w(/* @__PURE__ */ new Map()), T = r(() => Object.freeze([...l.state.items])), D = r(() =>
|
|
3050
|
+
let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), _ = w(!1), y = w(/* @__PURE__ */ new Set()), x = w(/* @__PURE__ */ new Map()), S = w(/* @__PURE__ */ new Set()), C = w(/* @__PURE__ */ new Map()), T = r(() => Object.freeze([...l.state.items])), D = r(() => ne(l.state, T.value)), { markMediaError: A, markMasonryFullyVisible: j, markMasonryVisible: M, markPreviewError: N, markPreviewReady: P, markReelError: F, markReelReady: I, originalStates: L, previewStates: R, reelStates: z, resetMediaLifecycle: B } = Rn(l.state, {
|
|
2995
3051
|
error: (e) => d("mediaError", e),
|
|
2996
3052
|
fullyVisible: (e) => d("mediaFullyVisible", e),
|
|
2997
3053
|
ready: (e) => d("mediaReady", e),
|
|
2998
3054
|
reelChange: (e) => d("reelMediaChange", e),
|
|
2999
3055
|
visible: (e) => d("mediaVisible", e)
|
|
3000
|
-
}), ee = new Set(l.state.items.map((e) => e.postId)),
|
|
3001
|
-
function
|
|
3056
|
+
}), { phase: ee, finishSlide: te, finishFade: U, markSettled: W } = Un(l.state, h), G = new Set(l.state.items.map((e) => e.postId)), K = null, q = null, re = !1;
|
|
3057
|
+
function ie() {
|
|
3002
3058
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
3003
3059
|
}
|
|
3004
|
-
function
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3060
|
+
function ae() {
|
|
3061
|
+
K !== null && cancelAnimationFrame(K), K = requestAnimationFrame(() => {
|
|
3062
|
+
K = requestAnimationFrame(() => {
|
|
3063
|
+
K = null, y.value = /* @__PURE__ */ new Set();
|
|
3008
3064
|
});
|
|
3009
3065
|
});
|
|
3010
3066
|
}
|
|
@@ -3014,46 +3070,46 @@ var zn = 35, Bn = 420, Vn = /* @__PURE__ */ d({
|
|
|
3014
3070
|
let r = H(n, t);
|
|
3015
3071
|
(l.state.mediaIndices.get(e) ?? 0) !== r && (l.state.mediaIndices = new Map(l.state.mediaIndices).set(e, r));
|
|
3016
3072
|
}
|
|
3017
|
-
async function
|
|
3073
|
+
async function oe() {
|
|
3018
3074
|
await m(), (l.state.layout === "reel" || l.state.reelOrigin === "masonry" ? p.value : f.value)?.loadIfNearBottom();
|
|
3019
3075
|
}
|
|
3020
|
-
function
|
|
3076
|
+
function se(e) {
|
|
3021
3077
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.changeActiveMedia?.(e) ?? !1;
|
|
3022
3078
|
}
|
|
3023
|
-
function
|
|
3079
|
+
function ce(e) {
|
|
3024
3080
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.moveActivePost?.(e) ?? !1;
|
|
3025
3081
|
}
|
|
3026
|
-
function
|
|
3082
|
+
function ue(e) {
|
|
3027
3083
|
if (!(l.state.layout === "reel" || l.state.reelOrigin === "masonry") || l.state.isLoading) return "reel-inactive";
|
|
3028
3084
|
let t = l.state.items.find((t) => t.postId === e.postId);
|
|
3029
3085
|
if (!t) return "not-found";
|
|
3030
3086
|
let n = V(t).findIndex((t) => t.mediaId === e.mediaId);
|
|
3031
3087
|
return n < 0 ? "not-found" : p.value?.navigateToItem?.(e.postId, n) ? "navigated" : "reel-inactive";
|
|
3032
3088
|
}
|
|
3033
|
-
function
|
|
3089
|
+
function Y() {
|
|
3034
3090
|
return l.state.layout !== "masonry" || l.state.reelOrigin === "masonry" ? null : f.value?.getScrollElement?.() ?? null;
|
|
3035
3091
|
}
|
|
3036
|
-
function
|
|
3037
|
-
|
|
3092
|
+
function X(e, t) {
|
|
3093
|
+
q = e, re = t === "keyboard", d("openReel", e), m(() => h.value?.focus());
|
|
3038
3094
|
}
|
|
3039
|
-
function
|
|
3095
|
+
function de(e) {
|
|
3040
3096
|
let t = g.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [];
|
|
3041
3097
|
return Array.from(t).find((t) => t.dataset.postId === String(e)) ?? null;
|
|
3042
3098
|
}
|
|
3043
|
-
function
|
|
3044
|
-
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null ||
|
|
3099
|
+
function Z(e, t) {
|
|
3100
|
+
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || ie()) return 0;
|
|
3045
3101
|
let n = [...new Set(e)], r = new Set(Array.from(g.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [], (e) => e.dataset.postId)), i = n.filter((e) => r.has(String(e)));
|
|
3046
3102
|
if (i.length === 0) return 0;
|
|
3047
|
-
let a = new Map(C.value), o = t?.staggerMs ??
|
|
3103
|
+
let a = new Map(C.value), o = t?.staggerMs ?? Gn;
|
|
3048
3104
|
return i.forEach((e, t) => {
|
|
3049
3105
|
a.set(e, t * o);
|
|
3050
|
-
}), y.value = new Set([...y.value].filter((e) => !i.includes(e))), S.value = new Set([...S.value, ...n]), C.value = a,
|
|
3106
|
+
}), y.value = new Set([...y.value].filter((e) => !i.includes(e))), S.value = new Set([...S.value, ...n]), C.value = a, Kn + (i.length - 1) * o;
|
|
3051
3107
|
}
|
|
3052
|
-
function
|
|
3108
|
+
function fe() {
|
|
3053
3109
|
S.value = /* @__PURE__ */ new Set(), C.value = /* @__PURE__ */ new Map();
|
|
3054
3110
|
}
|
|
3055
|
-
async function
|
|
3056
|
-
if (t.aborted ||
|
|
3111
|
+
async function pe(e, t) {
|
|
3112
|
+
if (t.aborted || Z(e, { staggerMs: 0 }) === 0 || (await m(), t.aborted)) return;
|
|
3057
3113
|
let n = g.value?.querySelectorAll(".masonry-feed .media-card--leaving") ?? [], r = Array.from(n).flatMap((e) => (getComputedStyle(e).opacity, e.getAnimations?.().filter((e) => e.effect?.getTiming().iterations !== Infinity) ?? []));
|
|
3058
3114
|
await new Promise((e) => {
|
|
3059
3115
|
let n = () => {
|
|
@@ -3062,23 +3118,23 @@ var zn = 35, Bn = 420, Vn = /* @__PURE__ */ d({
|
|
|
3062
3118
|
t.addEventListener("abort", n, { once: !0 }), t.aborted ? n() : Promise.allSettled(r.map((e) => e.finished)).then(n);
|
|
3063
3119
|
});
|
|
3064
3120
|
}
|
|
3065
|
-
function
|
|
3066
|
-
let n =
|
|
3121
|
+
function Q(e, t) {
|
|
3122
|
+
let n = de(e), r = n?.querySelector(".media-card-activator") ?? n;
|
|
3067
3123
|
r && (r.classList.toggle("media-card-focus-silent", !t), t || r.addEventListener("blur", () => {
|
|
3068
3124
|
r.classList.remove("media-card-focus-silent");
|
|
3069
3125
|
}, { once: !0 }), r?.focus({ preventScroll: !0 }));
|
|
3070
3126
|
}
|
|
3071
|
-
function
|
|
3072
|
-
l.state.reelOrigin === "masonry" && (
|
|
3127
|
+
function me() {
|
|
3128
|
+
l.state.reelOrigin === "masonry" && (q ??= l.state.activeReelPostId, _.value = !0, d("closeReel"));
|
|
3073
3129
|
}
|
|
3074
|
-
function
|
|
3075
|
-
let e =
|
|
3076
|
-
_.value = !1,
|
|
3077
|
-
e !== null &&
|
|
3130
|
+
function he() {
|
|
3131
|
+
let e = q, t = re;
|
|
3132
|
+
_.value = !1, q = null, re = !1, m(() => {
|
|
3133
|
+
e !== null && Q(e, t);
|
|
3078
3134
|
});
|
|
3079
3135
|
}
|
|
3080
|
-
return
|
|
3081
|
-
closeMasonryReel:
|
|
3136
|
+
return Hn({
|
|
3137
|
+
closeMasonryReel: me,
|
|
3082
3138
|
element: () => g.value,
|
|
3083
3139
|
isReelLeaving: () => _.value,
|
|
3084
3140
|
reelRenderer: () => p.value,
|
|
@@ -3088,34 +3144,35 @@ var zn = 35, Bn = 420, Vn = /* @__PURE__ */ d({
|
|
|
3088
3144
|
let e = l.state.items;
|
|
3089
3145
|
return [e, e.length];
|
|
3090
3146
|
}, ([e]) => {
|
|
3091
|
-
let t = e.map((e) => e.postId), n = t.filter((e) => !
|
|
3092
|
-
if (
|
|
3147
|
+
let t = e.map((e) => e.postId), n = t.filter((e) => !G.has(e)), r = new Set(t);
|
|
3148
|
+
if (G = new Set(t), S.value = new Set([...S.value].filter((e) => r.has(e))), C.value = new Map([...C.value].filter(([e]) => r.has(e))), n.length === 0 || ie()) return;
|
|
3093
3149
|
let i = /* @__PURE__ */ new Map();
|
|
3094
3150
|
t.forEach((e) => {
|
|
3095
3151
|
let t = x.value.get(e);
|
|
3096
3152
|
t !== void 0 && i.set(e, t);
|
|
3097
3153
|
}), n.forEach((e, t) => {
|
|
3098
|
-
i.set(e, t *
|
|
3099
|
-
}), x.value = i, y.value = new Set([...y.value, ...n]),
|
|
3154
|
+
i.set(e, t * Gn);
|
|
3155
|
+
}), x.value = i, y.value = new Set([...y.value, ...n]), ae();
|
|
3100
3156
|
}, { flush: "sync" }), v(() => {
|
|
3101
|
-
|
|
3157
|
+
K !== null && cancelAnimationFrame(K);
|
|
3102
3158
|
}), i({
|
|
3103
|
-
animateItemRemoval:
|
|
3104
|
-
cancelItemRemoval:
|
|
3105
|
-
changeActiveReelMedia:
|
|
3106
|
-
getAutoScrollElement:
|
|
3107
|
-
loadIfNearBottom:
|
|
3108
|
-
moveActiveReelPost:
|
|
3109
|
-
navigateToReelItem:
|
|
3159
|
+
animateItemRemoval: pe,
|
|
3160
|
+
cancelItemRemoval: fe,
|
|
3161
|
+
changeActiveReelMedia: se,
|
|
3162
|
+
getAutoScrollElement: Y,
|
|
3163
|
+
loadIfNearBottom: oe,
|
|
3164
|
+
moveActiveReelPost: ce,
|
|
3165
|
+
navigateToReelItem: ue,
|
|
3166
|
+
openReel: (e) => X(e, "keyboard"),
|
|
3110
3167
|
resetMediaLifecycle: B,
|
|
3111
|
-
startItemRemoval:
|
|
3168
|
+
startItemRemoval: Z,
|
|
3112
3169
|
transitionActiveReelMedia: (e) => p.value?.transitionActiveMedia?.(e) ?? Promise.resolve(!1),
|
|
3113
3170
|
transitionActiveReelPost: (e) => p.value?.transitionActivePost?.(e) ?? Promise.resolve(!1)
|
|
3114
3171
|
}), (r, i) => (b(), s("div", {
|
|
3115
3172
|
ref_key: "surfaceElement",
|
|
3116
3173
|
ref: g,
|
|
3117
3174
|
class: "vibe-surface"
|
|
3118
|
-
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(
|
|
3175
|
+
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(An, {
|
|
3119
3176
|
key: 0,
|
|
3120
3177
|
ref_key: "reelRenderer",
|
|
3121
3178
|
ref: p,
|
|
@@ -3169,7 +3226,7 @@ var zn = 35, Bn = 420, Vn = /* @__PURE__ */ d({
|
|
|
3169
3226
|
"can-retry-end",
|
|
3170
3227
|
"feed-footer",
|
|
3171
3228
|
"state"
|
|
3172
|
-
])) : (b(), s(e, { key: 2 }, [u(
|
|
3229
|
+
])) : (b(), s(e, { key: 2 }, [u(mn, {
|
|
3173
3230
|
ref_key: "masonryRenderer",
|
|
3174
3231
|
ref: f,
|
|
3175
3232
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -3194,7 +3251,7 @@ var zn = 35, Bn = 420, Vn = /* @__PURE__ */ d({
|
|
|
3194
3251
|
suspended: t.state.reelOrigin === "masonry" || _.value,
|
|
3195
3252
|
state: D.value,
|
|
3196
3253
|
total: t.state.total,
|
|
3197
|
-
onActivate:
|
|
3254
|
+
onActivate: X,
|
|
3198
3255
|
onError: E(N),
|
|
3199
3256
|
onMediaError: i[9] ||= (e, t) => E(A)(e, t, "masonry"),
|
|
3200
3257
|
onFullyVisible: E(j),
|
|
@@ -3205,20 +3262,25 @@ var zn = 35, Bn = 420, Vn = /* @__PURE__ */ d({
|
|
|
3205
3262
|
onVisible: E(M)
|
|
3206
3263
|
}, null, 8, /* @__PURE__ */ "can-retry-end.entering-post-ids.entry-delays.leaving-post-ids.removal-delays.card-footer.card-header.feed-footer.feed-footer-actions.media-card.masonry.has-next.infinite-scroll.is-loading-more.items.load-more-locked.media-indices.next-page-error.preview-states.suspended.state.total.onError.onFullyVisible.onReady.onVisible".split(".")), u(n, {
|
|
3207
3264
|
name: "vibe-reel-viewer",
|
|
3208
|
-
|
|
3265
|
+
onAfterEnter: E(te),
|
|
3266
|
+
onAfterLeave: he
|
|
3209
3267
|
}, {
|
|
3210
3268
|
default: k(() => [t.state.reelOrigin === "masonry" ? (b(), s("section", {
|
|
3211
3269
|
key: 0,
|
|
3212
3270
|
ref_key: "reelOverlay",
|
|
3213
3271
|
ref: h,
|
|
3214
3272
|
class: "vibe-reel-overlay",
|
|
3273
|
+
"data-reel-entry": E(ee),
|
|
3215
3274
|
role: "dialog",
|
|
3216
3275
|
"aria-label": "Media viewer",
|
|
3217
3276
|
"aria-modal": "true",
|
|
3218
|
-
tabindex: "-1"
|
|
3219
|
-
|
|
3277
|
+
tabindex: "-1",
|
|
3278
|
+
onTransitionend: i[21] ||= (...e) => E(U) && E(U)(...e),
|
|
3279
|
+
onTransitioncancel: i[22] ||= (...e) => E(U) && E(U)(...e)
|
|
3280
|
+
}, [u(An, {
|
|
3220
3281
|
ref_key: "reelRenderer",
|
|
3221
3282
|
ref: p,
|
|
3283
|
+
"entry-pending": E(ee) !== "ready",
|
|
3222
3284
|
"can-retry-end": t.canRetryEnd,
|
|
3223
3285
|
"card-footer": t.cardFooter,
|
|
3224
3286
|
"card-header": t.cardHeader,
|
|
@@ -3248,22 +3310,26 @@ var zn = 35, Bn = 420, Vn = /* @__PURE__ */ d({
|
|
|
3248
3310
|
total: t.state.total,
|
|
3249
3311
|
onActiveChange: i[12] ||= (e) => d("activeReelChange", e),
|
|
3250
3312
|
onCloseInfoSheet: i[13] ||= (e) => d("reelInfoSheetChange", !1),
|
|
3251
|
-
onError:
|
|
3252
|
-
|
|
3253
|
-
|
|
3313
|
+
onError: i[14] ||= (e, t) => {
|
|
3314
|
+
E(F)(e, t), E(W)(e, t);
|
|
3315
|
+
},
|
|
3316
|
+
onMediaError: i[15] ||= (e, t) => E(A)(e, t, "reel"),
|
|
3317
|
+
onLoadMore: i[16] ||= (e) => d("loadMore"),
|
|
3254
3318
|
onMediaChange: J,
|
|
3255
|
-
onReady:
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3319
|
+
onReady: i[17] ||= (e, t) => {
|
|
3320
|
+
E(I)(e, t), E(W)(e, t);
|
|
3321
|
+
},
|
|
3322
|
+
onRetryEnd: i[18] ||= (e) => d("retryEnd"),
|
|
3323
|
+
onRetryForward: i[19] ||= (e) => d("retryForward"),
|
|
3324
|
+
onReelAudioChange: i[20] ||= (e) => d("reelAudioChange", e)
|
|
3325
|
+
}, null, 8, /* @__PURE__ */ "entry-pending.can-retry-end.card-footer.card-header.feed-footer.feed-footer-actions.forward-index.forward-item.media-card.has-next.infinite-scroll.initial-post-id.info-sheet.info-sheet-enabled.info-sheet-overlay.is-loading-more.items.load-more-locked.media-indices.next-page-error.preview-states.reel-auto-advance.reel-audio-state.reel-forward.state.total".split(".")), E(ee) === "waiting" ? (b(), a(Fn, { key: 0 })) : o("", !0)], 40, Wn)) : o("", !0)]),
|
|
3260
3326
|
_: 1
|
|
3261
|
-
})], 64))], 512));
|
|
3327
|
+
}, 8, ["onAfterEnter"])], 64))], 512));
|
|
3262
3328
|
}
|
|
3263
3329
|
});
|
|
3264
3330
|
//#endregion
|
|
3265
3331
|
//#region src/core/page.ts
|
|
3266
|
-
function
|
|
3332
|
+
function Jn(e) {
|
|
3267
3333
|
if (!e || typeof e != "object" || !Array.isArray(e.items)) throw TypeError("Vibe loadPage must resolve to a page with an items array.");
|
|
3268
3334
|
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.");
|
|
3269
3335
|
if (e.next !== null && typeof e.next != "string" && typeof e.next != "number") throw TypeError("Vibe page next must be a string, number, or null.");
|
|
@@ -3274,22 +3340,22 @@ function $(e, t) {
|
|
|
3274
3340
|
let n = new Set(e.map((e) => e.postId));
|
|
3275
3341
|
return [...e, ...t.filter((e) => n.has(e.postId) ? !1 : (n.add(e.postId), !0))];
|
|
3276
3342
|
}
|
|
3277
|
-
function
|
|
3343
|
+
function Yn(e) {
|
|
3278
3344
|
return `${typeof e}:${String(e)}`;
|
|
3279
3345
|
}
|
|
3280
|
-
function
|
|
3281
|
-
return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview?.src ?? ""}` : `id:${
|
|
3346
|
+
function Xn(e) {
|
|
3347
|
+
return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview?.src ?? ""}` : `id:${Yn(e.mediaId)}`;
|
|
3282
3348
|
}
|
|
3283
|
-
function
|
|
3284
|
-
let n = [...e], r = new Map(e.map((e, t) => [
|
|
3349
|
+
function Zn(e, t) {
|
|
3350
|
+
let n = [...e], r = new Map(e.map((e, t) => [Yn(e.postId), t]));
|
|
3285
3351
|
return t.forEach((e) => {
|
|
3286
|
-
let t =
|
|
3352
|
+
let t = Yn(e.postId), i = r.get(t);
|
|
3287
3353
|
if (i === void 0) {
|
|
3288
3354
|
r.set(t, n.length), n.push(e);
|
|
3289
3355
|
return;
|
|
3290
3356
|
}
|
|
3291
|
-
let a = n[i], o = new Set([a, ...a.items].map(
|
|
3292
|
-
let t =
|
|
3357
|
+
let a = n[i], o = new Set([a, ...a.items].map(Xn)), s = [e, ...e.items].filter((e) => {
|
|
3358
|
+
let t = Xn(e);
|
|
3293
3359
|
return o.has(t) ? !1 : (o.add(t), !0);
|
|
3294
3360
|
});
|
|
3295
3361
|
s.length > 0 && (n[i] = {
|
|
@@ -3298,14 +3364,14 @@ function Gn(e, t) {
|
|
|
3298
3364
|
});
|
|
3299
3365
|
}), n;
|
|
3300
3366
|
}
|
|
3301
|
-
function
|
|
3367
|
+
function Qn(e) {
|
|
3302
3368
|
return Object.prototype.hasOwnProperty.call(e, "current") ? e.current ?? null : e.next;
|
|
3303
3369
|
}
|
|
3304
3370
|
//#endregion
|
|
3305
3371
|
//#region src/core/appendPage.ts
|
|
3306
|
-
function
|
|
3307
|
-
let i =
|
|
3308
|
-
t.items =
|
|
3372
|
+
function $n(e, t, n, r) {
|
|
3373
|
+
let i = Jn(e), a = n.filterItems(i.items), o = Qn(i);
|
|
3374
|
+
t.items = Zn(t.items, a), t.next = i.next, i.total !== void 0 && (t.total = i.total), r(o), n.recordPages([{
|
|
3309
3375
|
contributionIds: a.map(({ postId: e }) => e),
|
|
3310
3376
|
cursor: o,
|
|
3311
3377
|
next: i.next,
|
|
@@ -3314,32 +3380,32 @@ function qn(e, t, n, r) {
|
|
|
3314
3380
|
}
|
|
3315
3381
|
//#endregion
|
|
3316
3382
|
//#region src/core/requestDelay.ts
|
|
3317
|
-
var
|
|
3383
|
+
var er = 2e3, tr = 1e4, nr = 250, rr = {
|
|
3318
3384
|
delayRemainingMs: null,
|
|
3319
3385
|
nextRequestAt: null
|
|
3320
3386
|
};
|
|
3321
|
-
function
|
|
3387
|
+
function ir(e, t) {
|
|
3322
3388
|
return e === void 0 ? t : Math.floor(e);
|
|
3323
3389
|
}
|
|
3324
|
-
function
|
|
3390
|
+
function ar(e, t) {
|
|
3325
3391
|
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.`);
|
|
3326
3392
|
}
|
|
3327
|
-
function
|
|
3328
|
-
let n =
|
|
3393
|
+
function or(e, t = {}) {
|
|
3394
|
+
let n = ir(t.delayStepMs, er), r = ir(t.delayMaxMs, tr);
|
|
3329
3395
|
return Math.min(Math.max(0, e) * n, r);
|
|
3330
3396
|
}
|
|
3331
|
-
function
|
|
3332
|
-
if (e == null || !Number.isFinite(e)) return { ...
|
|
3397
|
+
function sr(e) {
|
|
3398
|
+
if (e == null || !Number.isFinite(e)) return { ...rr };
|
|
3333
3399
|
let t = Math.max(0, Math.floor(e - Date.now()));
|
|
3334
3400
|
return t > 0 ? {
|
|
3335
3401
|
delayRemainingMs: t,
|
|
3336
3402
|
nextRequestAt: e
|
|
3337
|
-
} : { ...
|
|
3403
|
+
} : { ...rr };
|
|
3338
3404
|
}
|
|
3339
|
-
async function
|
|
3405
|
+
async function cr({ delayMs: e, onChange: t, signal: n }) {
|
|
3340
3406
|
if (n.aborted) throw new DOMException("Aborted", "AbortError");
|
|
3341
3407
|
if (e <= 0) {
|
|
3342
|
-
t({ ...
|
|
3408
|
+
t({ ...rr });
|
|
3343
3409
|
return;
|
|
3344
3410
|
}
|
|
3345
3411
|
let r = Date.now() + e;
|
|
@@ -3347,9 +3413,9 @@ async function nr({ delayMs: e, onChange: t, signal: n }) {
|
|
|
3347
3413
|
delayRemainingMs: e,
|
|
3348
3414
|
nextRequestAt: r
|
|
3349
3415
|
}), await new Promise((i, a) => {
|
|
3350
|
-
let o = !1, s = setInterval(f,
|
|
3416
|
+
let o = !1, s = setInterval(f, nr), c = setTimeout(() => u(), e);
|
|
3351
3417
|
function l() {
|
|
3352
|
-
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...
|
|
3418
|
+
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...rr });
|
|
3353
3419
|
}
|
|
3354
3420
|
function u(e) {
|
|
3355
3421
|
o || (o = !0, l(), e ? a(e) : i());
|
|
@@ -3358,42 +3424,42 @@ async function nr({ delayMs: e, onChange: t, signal: n }) {
|
|
|
3358
3424
|
u(new DOMException("Aborted", "AbortError"));
|
|
3359
3425
|
}
|
|
3360
3426
|
function f() {
|
|
3361
|
-
let e =
|
|
3427
|
+
let e = sr(r);
|
|
3362
3428
|
t(e), e.delayRemainingMs === null && u();
|
|
3363
3429
|
}
|
|
3364
3430
|
n.addEventListener("abort", d, { once: !0 });
|
|
3365
3431
|
});
|
|
3366
3432
|
}
|
|
3367
|
-
var
|
|
3433
|
+
var lr = class {
|
|
3368
3434
|
interval = null;
|
|
3369
3435
|
constructor(e) {
|
|
3370
3436
|
this.onChange = e;
|
|
3371
3437
|
}
|
|
3372
3438
|
clear() {
|
|
3373
|
-
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...
|
|
3439
|
+
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...rr });
|
|
3374
3440
|
}
|
|
3375
3441
|
sync(e) {
|
|
3376
3442
|
this.clear();
|
|
3377
|
-
let t =
|
|
3443
|
+
let t = sr(e);
|
|
3378
3444
|
this.onChange(t), t.delayRemainingMs !== null && (this.interval = setInterval(() => {
|
|
3379
|
-
let t =
|
|
3445
|
+
let t = sr(e);
|
|
3380
3446
|
this.onChange(t), t.delayRemainingMs === null && this.clear();
|
|
3381
|
-
},
|
|
3447
|
+
}, nr));
|
|
3382
3448
|
}
|
|
3383
3449
|
};
|
|
3384
|
-
function
|
|
3450
|
+
function ur(e, t = !0) {
|
|
3385
3451
|
return e.maxAdditionalPages === "unlimited" ? Infinity : (e.maxAdditionalPages ?? 10) + (t ? 1 : 0);
|
|
3386
3452
|
}
|
|
3387
|
-
function
|
|
3453
|
+
function dr(e) {
|
|
3388
3454
|
return `${typeof e}:${String(e)}`;
|
|
3389
3455
|
}
|
|
3390
|
-
function
|
|
3456
|
+
function fr(e, t) {
|
|
3391
3457
|
if (!Number.isInteger(e) || e <= 0) throw TypeError(`Vibe ${t} must be a positive integer.`);
|
|
3392
3458
|
}
|
|
3393
|
-
function
|
|
3459
|
+
function pr(e) {
|
|
3394
3460
|
if (!e) return;
|
|
3395
|
-
if (
|
|
3396
|
-
|
|
3461
|
+
if (fr(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
|
|
3462
|
+
ar(e, "frontend autofill");
|
|
3397
3463
|
let t = e.maxAdditionalPages;
|
|
3398
3464
|
if (t !== void 0 && t !== "unlimited" && (!Number.isInteger(t) || t < 0)) throw TypeError("Vibe autofill maxAdditionalPages must be a non-negative integer or \"unlimited\".");
|
|
3399
3465
|
return;
|
|
@@ -3405,7 +3471,7 @@ function sr(e) {
|
|
|
3405
3471
|
if (t.pageSize !== e.pageSize) throw TypeError("Vibe backend autofill initialSession pageSize must match autofill pageSize.");
|
|
3406
3472
|
}
|
|
3407
3473
|
}
|
|
3408
|
-
function
|
|
3474
|
+
function mr(e, t, n = !0) {
|
|
3409
3475
|
if (!e) return {
|
|
3410
3476
|
cycleId: null,
|
|
3411
3477
|
delayRemainingMs: null,
|
|
@@ -3422,7 +3488,7 @@ function cr(e, t, n = !0) {
|
|
|
3422
3488
|
status: "idle",
|
|
3423
3489
|
strategy: null
|
|
3424
3490
|
};
|
|
3425
|
-
let r = e.strategy === "backend" ? t ?? (n ? e.initialSession : void 0) : void 0, i = r?.received ?? 0, a =
|
|
3491
|
+
let r = e.strategy === "backend" ? t ?? (n ? e.initialSession : void 0) : void 0, i = r?.received ?? 0, a = sr(r?.nextRequestAt);
|
|
3426
3492
|
return {
|
|
3427
3493
|
cycleId: r?.cycleId ?? null,
|
|
3428
3494
|
...a,
|
|
@@ -3439,7 +3505,7 @@ function cr(e, t, n = !0) {
|
|
|
3439
3505
|
strategy: e.strategy
|
|
3440
3506
|
};
|
|
3441
3507
|
}
|
|
3442
|
-
function
|
|
3508
|
+
function hr(e) {
|
|
3443
3509
|
return [
|
|
3444
3510
|
"cancelling",
|
|
3445
3511
|
"filling",
|
|
@@ -3447,9 +3513,9 @@ function lr(e) {
|
|
|
3447
3513
|
"waiting"
|
|
3448
3514
|
].includes(e.status);
|
|
3449
3515
|
}
|
|
3450
|
-
async function
|
|
3516
|
+
async function gr(e, t, n) {
|
|
3451
3517
|
let r = t.autofill;
|
|
3452
|
-
if (!
|
|
3518
|
+
if (!hr(r) || !r.cycleId) return;
|
|
3453
3519
|
let i = {
|
|
3454
3520
|
cycleId: r.cycleId,
|
|
3455
3521
|
feedKey: r.feedKey ?? "",
|
|
@@ -3462,16 +3528,16 @@ async function ur(e, t, n) {
|
|
|
3462
3528
|
throw r.error = e, r.status = "error", e;
|
|
3463
3529
|
}
|
|
3464
3530
|
}
|
|
3465
|
-
function
|
|
3531
|
+
function _r(e, t, n) {
|
|
3466
3532
|
return e?.strategy === "backend" && t.feedKey === e.feedKey && t.sessionId === n.sessionId;
|
|
3467
3533
|
}
|
|
3468
|
-
async function
|
|
3469
|
-
let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ??
|
|
3534
|
+
async function vr({ 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 }) {
|
|
3535
|
+
let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ?? ur(s), g = t, _ = t, v = t, y = 0, b = [], x;
|
|
3470
3536
|
for (; y < h;) {
|
|
3471
|
-
let e =
|
|
3537
|
+
let e = dr(g);
|
|
3472
3538
|
if (m.has(e)) throw Error("Vibe autofill received a repeated cursor.");
|
|
3473
|
-
if (m.add(e), await
|
|
3474
|
-
delayMs:
|
|
3539
|
+
if (m.add(e), await cr({
|
|
3540
|
+
delayMs: or(l + y, s),
|
|
3475
3541
|
onChange: a,
|
|
3476
3542
|
signal: d
|
|
3477
3543
|
}), y > 0 && u()) return {
|
|
@@ -3485,7 +3551,7 @@ async function fr({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
3485
3551
|
status: "paused",
|
|
3486
3552
|
total: x
|
|
3487
3553
|
};
|
|
3488
|
-
let t =
|
|
3554
|
+
let t = Jn(await n({
|
|
3489
3555
|
cursor: g,
|
|
3490
3556
|
signal: d
|
|
3491
3557
|
}));
|
|
@@ -3542,12 +3608,12 @@ async function fr({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
3542
3608
|
}
|
|
3543
3609
|
//#endregion
|
|
3544
3610
|
//#region src/core/autofillController.ts
|
|
3545
|
-
var
|
|
3611
|
+
var yr = class {
|
|
3546
3612
|
collection = null;
|
|
3547
3613
|
cycle = 0;
|
|
3548
3614
|
delayCountdown;
|
|
3549
3615
|
constructor(e) {
|
|
3550
|
-
this.context = e, this.delayCountdown = new
|
|
3616
|
+
this.context = e, this.delayCountdown = new lr((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
|
|
3551
3617
|
}
|
|
3552
3618
|
beginCycle() {
|
|
3553
3619
|
let { options: e, state: t } = this.context;
|
|
@@ -3555,14 +3621,14 @@ var pr = class {
|
|
|
3555
3621
|
this.clear();
|
|
3556
3622
|
let n = `vibe-autofill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
3557
3623
|
return t.autofill = {
|
|
3558
|
-
...
|
|
3624
|
+
...mr(e, void 0, !1),
|
|
3559
3625
|
cycleId: n,
|
|
3560
3626
|
status: "filling"
|
|
3561
3627
|
}, n;
|
|
3562
3628
|
}
|
|
3563
3629
|
async cancel() {
|
|
3564
3630
|
let { cancelRequest: e, options: t, state: n } = this.context;
|
|
3565
|
-
await
|
|
3631
|
+
await gr(t, n, e), this.commitCollection();
|
|
3566
3632
|
}
|
|
3567
3633
|
captureCollection(e, t) {
|
|
3568
3634
|
t && (this.collection = e);
|
|
@@ -3590,30 +3656,30 @@ var pr = class {
|
|
|
3590
3656
|
requests: r.requests
|
|
3591
3657
|
}), !0) : !1;
|
|
3592
3658
|
}
|
|
3593
|
-
},
|
|
3594
|
-
function
|
|
3659
|
+
}, br = 100;
|
|
3660
|
+
function xr(e, t) {
|
|
3595
3661
|
if (!Number.isFinite(t) || t <= 0) throw TypeError(`Vibe ${e} must be a positive number.`);
|
|
3596
3662
|
}
|
|
3597
|
-
function
|
|
3663
|
+
function Sr(e, t, n) {
|
|
3598
3664
|
return Math.min(n, Math.max(t, e));
|
|
3599
3665
|
}
|
|
3600
|
-
function
|
|
3666
|
+
function Cr(e) {
|
|
3601
3667
|
if (!e) return;
|
|
3602
3668
|
let t = e.minSpeedPxPerSecond ?? 20, n = e.maxSpeedPxPerSecond ?? 240;
|
|
3603
|
-
if (
|
|
3604
|
-
e.speedPxPerSecond !== void 0 &&
|
|
3669
|
+
if (xr("autoScroll.minSpeedPxPerSecond", t), xr("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
|
|
3670
|
+
e.speedPxPerSecond !== void 0 && xr("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
|
|
3605
3671
|
}
|
|
3606
|
-
function
|
|
3672
|
+
function wr(e) {
|
|
3607
3673
|
let t = e?.minSpeedPxPerSecond ?? 20, n = e?.maxSpeedPxPerSecond ?? 240;
|
|
3608
3674
|
return {
|
|
3609
3675
|
enabled: e?.enabled ?? !1,
|
|
3610
3676
|
maxSpeedPxPerSecond: n,
|
|
3611
3677
|
minSpeedPxPerSecond: t,
|
|
3612
3678
|
paused: !1,
|
|
3613
|
-
speedPxPerSecond:
|
|
3679
|
+
speedPxPerSecond: Sr(e?.speedPxPerSecond ?? 80, t, n)
|
|
3614
3680
|
};
|
|
3615
3681
|
}
|
|
3616
|
-
var
|
|
3682
|
+
var Tr = class {
|
|
3617
3683
|
frame = null;
|
|
3618
3684
|
lastTimestamp = null;
|
|
3619
3685
|
mounted = !1;
|
|
@@ -3633,9 +3699,9 @@ var yr = class {
|
|
|
3633
3699
|
this.options.state.enabled && (this.options.state.paused = e, this.lastTimestamp = null, e ? this.cancelFrame() : this.schedule());
|
|
3634
3700
|
}
|
|
3635
3701
|
setSpeed(e) {
|
|
3636
|
-
|
|
3702
|
+
xr("auto-scroll speed", e);
|
|
3637
3703
|
let t = this.options.state;
|
|
3638
|
-
t.speedPxPerSecond =
|
|
3704
|
+
t.speedPxPerSecond = Sr(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
|
|
3639
3705
|
}
|
|
3640
3706
|
tick = (e) => {
|
|
3641
3707
|
this.frame = null;
|
|
@@ -3647,7 +3713,7 @@ var yr = class {
|
|
|
3647
3713
|
return;
|
|
3648
3714
|
}
|
|
3649
3715
|
if (this.lastTimestamp !== null) {
|
|
3650
|
-
let r = Math.min(
|
|
3716
|
+
let r = Math.min(br, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
|
|
3651
3717
|
n.scrollTop = Math.min(i, n.scrollTop + t.speedPxPerSecond * r / 1e3);
|
|
3652
3718
|
}
|
|
3653
3719
|
this.lastTimestamp = e, this.schedule();
|
|
@@ -3661,13 +3727,13 @@ var yr = class {
|
|
|
3661
3727
|
};
|
|
3662
3728
|
//#endregion
|
|
3663
3729
|
//#region src/core/backendAutofill.ts
|
|
3664
|
-
async function
|
|
3730
|
+
async function Er(e, t, n, r) {
|
|
3665
3731
|
let i = await e.onUnderfilled(n);
|
|
3666
3732
|
if (!r()) return;
|
|
3667
3733
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend autofill requires a sessionId.");
|
|
3668
3734
|
let a = Math.max(n.received, i.received ?? n.received);
|
|
3669
3735
|
Object.assign(t.autofill, {
|
|
3670
|
-
...
|
|
3736
|
+
...sr(i.nextRequestAt),
|
|
3671
3737
|
missing: Math.max(0, e.pageSize - a),
|
|
3672
3738
|
received: a,
|
|
3673
3739
|
sequence: i.sequence ?? 0,
|
|
@@ -3675,19 +3741,19 @@ async function br(e, t, n, r) {
|
|
|
3675
3741
|
status: "waiting"
|
|
3676
3742
|
});
|
|
3677
3743
|
}
|
|
3678
|
-
function
|
|
3744
|
+
function Dr(e, t) {
|
|
3679
3745
|
["complete", "exhausted"].includes(t.status) && t.items && (e.items = $(e.items, t.items)), t.next !== void 0 && (e.next = t.next), t.total !== void 0 && (e.total = t.total);
|
|
3680
3746
|
}
|
|
3681
|
-
function
|
|
3747
|
+
function Or(e, t, n) {
|
|
3682
3748
|
let r = t.autofill;
|
|
3683
|
-
return !
|
|
3749
|
+
return !_r(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (Dr(t, n), Object.assign(r, sr(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);
|
|
3684
3750
|
}
|
|
3685
|
-
function
|
|
3686
|
-
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill =
|
|
3751
|
+
function kr(e, t, n) {
|
|
3752
|
+
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = mr(e, n), Dr(t, n), !0);
|
|
3687
3753
|
}
|
|
3688
3754
|
//#endregion
|
|
3689
3755
|
//#region src/core/backlogRestore.ts
|
|
3690
|
-
async function
|
|
3756
|
+
async function Ar(e, t, n) {
|
|
3691
3757
|
if (!e) return;
|
|
3692
3758
|
let r = new AbortController();
|
|
3693
3759
|
n(r);
|
|
@@ -3702,7 +3768,7 @@ async function wr(e, t, n) {
|
|
|
3702
3768
|
}
|
|
3703
3769
|
//#endregion
|
|
3704
3770
|
//#region src/core/initialAutofill.ts
|
|
3705
|
-
async function
|
|
3771
|
+
async function jr({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, onPages: i, options: a, signal: o, state: s }) {
|
|
3706
3772
|
let c = a.autofill;
|
|
3707
3773
|
if (!c) return;
|
|
3708
3774
|
let l = s.items.length;
|
|
@@ -3715,7 +3781,7 @@ async function Tr({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3715
3781
|
return;
|
|
3716
3782
|
}
|
|
3717
3783
|
if (c.strategy === "backend") {
|
|
3718
|
-
await
|
|
3784
|
+
await Er(c, s, {
|
|
3719
3785
|
cycleId: e,
|
|
3720
3786
|
feedKey: c.feedKey,
|
|
3721
3787
|
items: [...s.items],
|
|
@@ -3732,11 +3798,11 @@ async function Tr({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3732
3798
|
s.autofill.status = "exhausted";
|
|
3733
3799
|
return;
|
|
3734
3800
|
}
|
|
3735
|
-
let u = await
|
|
3801
|
+
let u = await vr({
|
|
3736
3802
|
existingItems: s.items,
|
|
3737
3803
|
initialCursor: s.next,
|
|
3738
3804
|
loadPage: a.loadPage,
|
|
3739
|
-
maximumRequests:
|
|
3805
|
+
maximumRequests: ur(c, !1),
|
|
3740
3806
|
onCollection: n,
|
|
3741
3807
|
onDelayChange: (e) => {
|
|
3742
3808
|
t() && Object.assign(s.autofill, e);
|
|
@@ -3759,13 +3825,13 @@ async function Tr({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3759
3825
|
}
|
|
3760
3826
|
//#endregion
|
|
3761
3827
|
//#region src/core/fill.ts
|
|
3762
|
-
function
|
|
3828
|
+
function Mr(e) {
|
|
3763
3829
|
return "items" in e ? { items: e.items } : "pages" in e ? { pages: e.pages } : { until: "end" };
|
|
3764
3830
|
}
|
|
3765
|
-
function
|
|
3831
|
+
function Nr(e) {
|
|
3766
3832
|
return `${typeof e}:${String(e)}`;
|
|
3767
3833
|
}
|
|
3768
|
-
function
|
|
3834
|
+
function Pr(e) {
|
|
3769
3835
|
if (!e || typeof e != "object") throw TypeError("Vibe fill target must be an object.");
|
|
3770
3836
|
if ("pages" in e) {
|
|
3771
3837
|
if (!Number.isInteger(e.pages) || e.pages <= 0) throw TypeError("Vibe fill pages must be a positive integer.");
|
|
@@ -3778,21 +3844,21 @@ function Or(e) {
|
|
|
3778
3844
|
if ("until" in e && e.until === "end") return { until: "end" };
|
|
3779
3845
|
throw TypeError("Vibe fill target must be { items }, { pages }, or { until: 'end' }.");
|
|
3780
3846
|
}
|
|
3781
|
-
function
|
|
3847
|
+
function Fr(e) {
|
|
3782
3848
|
if (!e) return;
|
|
3783
3849
|
if (e.strategy === "frontend") {
|
|
3784
|
-
|
|
3850
|
+
ar(e, "frontend fill");
|
|
3785
3851
|
return;
|
|
3786
3852
|
}
|
|
3787
3853
|
if (!e.feedKey.trim()) throw TypeError("Vibe backend fill requires a feedKey.");
|
|
3788
3854
|
let t = e.initialSession;
|
|
3789
3855
|
if (t) {
|
|
3790
3856
|
if (t.feedKey !== e.feedKey) throw TypeError("Vibe backend fill initialSession feedKey must match fill feedKey.");
|
|
3791
|
-
|
|
3857
|
+
Pr(t.target);
|
|
3792
3858
|
}
|
|
3793
3859
|
}
|
|
3794
|
-
function
|
|
3795
|
-
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a =
|
|
3860
|
+
function Ir(e, t, n = !0) {
|
|
3861
|
+
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a = sr(i?.nextRequestAt);
|
|
3796
3862
|
return {
|
|
3797
3863
|
completedPages: i?.completedPages ?? 0,
|
|
3798
3864
|
cycleId: i?.cycleId ?? null,
|
|
@@ -3805,10 +3871,10 @@ function Ar(e, t, n = !0) {
|
|
|
3805
3871
|
sessionId: i?.sessionId ?? null,
|
|
3806
3872
|
status: i?.status ?? "idle",
|
|
3807
3873
|
strategy: e?.strategy ?? null,
|
|
3808
|
-
target: i ?
|
|
3874
|
+
target: i ? Mr(i.target) : null
|
|
3809
3875
|
};
|
|
3810
3876
|
}
|
|
3811
|
-
function
|
|
3877
|
+
function Lr(e) {
|
|
3812
3878
|
return [
|
|
3813
3879
|
"cancelling",
|
|
3814
3880
|
"filling",
|
|
@@ -3816,7 +3882,7 @@ function jr(e) {
|
|
|
3816
3882
|
"waiting"
|
|
3817
3883
|
].includes(e.status);
|
|
3818
3884
|
}
|
|
3819
|
-
async function
|
|
3885
|
+
async function Rr({ existingItems: e, getLoadedItemCount: t, initialCursor: n, loadPage: r, onCollection: i = () => void 0, onDelayChange: a, onProgress: o, options: s, shouldPause: c = () => !1, signal: l, target: u }) {
|
|
3820
3886
|
let d = [], f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = 0, g = n, _ = n, v = n, y = 0, b, x = () => t?.() ?? p.length;
|
|
3821
3887
|
if ("items" in u && x() >= u.items) return {
|
|
3822
3888
|
completedPages: h,
|
|
@@ -3828,10 +3894,10 @@ async function Mr({ existingItems: e, getLoadedItemCount: t, initialCursor: n, l
|
|
|
3828
3894
|
status: "complete"
|
|
3829
3895
|
};
|
|
3830
3896
|
for (; v !== null;) {
|
|
3831
|
-
let e =
|
|
3897
|
+
let e = Nr(g);
|
|
3832
3898
|
if (m.has(e)) throw Error("Vibe fill received a repeated cursor.");
|
|
3833
|
-
if (m.add(e), await
|
|
3834
|
-
delayMs:
|
|
3899
|
+
if (m.add(e), await cr({
|
|
3900
|
+
delayMs: or(h, s),
|
|
3835
3901
|
onChange: a,
|
|
3836
3902
|
signal: l
|
|
3837
3903
|
}), h > 0 && c()) return {
|
|
@@ -3844,7 +3910,7 @@ async function Mr({ existingItems: e, getLoadedItemCount: t, initialCursor: n, l
|
|
|
3844
3910
|
status: "paused",
|
|
3845
3911
|
total: b
|
|
3846
3912
|
};
|
|
3847
|
-
let t =
|
|
3913
|
+
let t = Jn(await r({
|
|
3848
3914
|
cursor: g,
|
|
3849
3915
|
signal: l
|
|
3850
3916
|
}));
|
|
@@ -3912,12 +3978,12 @@ async function Mr({ existingItems: e, getLoadedItemCount: t, initialCursor: n, l
|
|
|
3912
3978
|
}
|
|
3913
3979
|
//#endregion
|
|
3914
3980
|
//#region src/core/backendFill.ts
|
|
3915
|
-
async function
|
|
3981
|
+
async function zr(e, t, n, r) {
|
|
3916
3982
|
let i = await e.onStart(n);
|
|
3917
3983
|
if (r()) {
|
|
3918
3984
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend fill requires a sessionId.");
|
|
3919
3985
|
Object.assign(t.fill, {
|
|
3920
|
-
...
|
|
3986
|
+
...sr(i.nextRequestAt),
|
|
3921
3987
|
completedPages: i.completedPages ?? 0,
|
|
3922
3988
|
received: i.received ?? 0,
|
|
3923
3989
|
sequence: i.sequence ?? 0,
|
|
@@ -3926,23 +3992,23 @@ async function Nr(e, t, n, r) {
|
|
|
3926
3992
|
});
|
|
3927
3993
|
}
|
|
3928
3994
|
}
|
|
3929
|
-
function
|
|
3995
|
+
function Br(e, t, n) {
|
|
3930
3996
|
return e?.strategy === "backend" && n.feedKey === e.feedKey && n.sessionId === t.fill.sessionId;
|
|
3931
3997
|
}
|
|
3932
|
-
function
|
|
3998
|
+
function Vr(e) {
|
|
3933
3999
|
return Number.isInteger(e.completedPages) && e.completedPages >= 0 && Number.isInteger(e.received) && e.received >= 0 && Number.isInteger(e.sequence) && e.sequence >= 0;
|
|
3934
4000
|
}
|
|
3935
|
-
function
|
|
4001
|
+
function Hr(e, t) {
|
|
3936
4002
|
if (!["complete", "exhausted"].includes(t.status)) return !0;
|
|
3937
4003
|
let n = e.fill.target;
|
|
3938
4004
|
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;
|
|
3939
4005
|
}
|
|
3940
|
-
function
|
|
4006
|
+
function Ur(e, t, n) {
|
|
3941
4007
|
t.total !== void 0 && (e.total = t.total), ["complete", "exhausted"].includes(t.status) && (e.items = $(e.items, t.items ?? []), e.next = t.next ?? null, n(t.lastCursor ?? null));
|
|
3942
4008
|
}
|
|
3943
|
-
function
|
|
3944
|
-
return !
|
|
3945
|
-
...
|
|
4009
|
+
function Wr(e, t, n, r) {
|
|
4010
|
+
return !Br(e, t, n) || !Vr(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !Hr(t, n) ? !1 : (Ur(t, n, r), Object.assign(t.fill, {
|
|
4011
|
+
...sr(n.status === "waiting" ? n.nextRequestAt : null),
|
|
3946
4012
|
completedPages: n.completedPages,
|
|
3947
4013
|
error: n.error ?? null,
|
|
3948
4014
|
received: n.received,
|
|
@@ -3950,45 +4016,45 @@ function Rr(e, t, n, r) {
|
|
|
3950
4016
|
status: n.status
|
|
3951
4017
|
}), !0);
|
|
3952
4018
|
}
|
|
3953
|
-
function
|
|
4019
|
+
function Gr(e, t, n, r) {
|
|
3954
4020
|
if (e?.strategy !== "backend" || n.feedKey !== e.feedKey) return !1;
|
|
3955
4021
|
let i = t.fill;
|
|
3956
|
-
return t.fill =
|
|
4022
|
+
return t.fill = Ir(e, n), !Vr(n) || !Hr(t, n) ? (t.fill = i, !1) : (Ur(t, n, r), !0);
|
|
3957
4023
|
}
|
|
3958
4024
|
//#endregion
|
|
3959
4025
|
//#region src/core/fillController.ts
|
|
3960
|
-
var
|
|
4026
|
+
var Kr = class {
|
|
3961
4027
|
abortController = null;
|
|
3962
4028
|
cycle = 0;
|
|
3963
4029
|
delayCountdown;
|
|
3964
4030
|
requestVersion = 0;
|
|
3965
4031
|
collection = null;
|
|
3966
4032
|
constructor(e) {
|
|
3967
|
-
this.options = e, this.delayCountdown = new
|
|
4033
|
+
this.options = e, this.delayCountdown = new lr((e) => {
|
|
3968
4034
|
Object.assign(this.options.state.fill, e);
|
|
3969
4035
|
}), this.syncBackendCountdown();
|
|
3970
4036
|
}
|
|
3971
4037
|
isActive() {
|
|
3972
|
-
return
|
|
4038
|
+
return Lr(this.options.state.fill);
|
|
3973
4039
|
}
|
|
3974
4040
|
applyUpdate(e) {
|
|
3975
|
-
let t =
|
|
4041
|
+
let t = Wr(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
3976
4042
|
return t && this.syncBackendCountdown(), t;
|
|
3977
4043
|
}
|
|
3978
4044
|
restoreSession(e) {
|
|
3979
|
-
let t =
|
|
4045
|
+
let t = Gr(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
3980
4046
|
return t && this.syncBackendCountdown(), t;
|
|
3981
4047
|
}
|
|
3982
4048
|
async start(e, t = {}) {
|
|
3983
4049
|
let n = this.options.fill;
|
|
3984
4050
|
if (!n) throw Error("Vibe fill is not configured.");
|
|
3985
4051
|
if (this.isActive()) throw Error("Vibe fill is already active.");
|
|
3986
|
-
let r =
|
|
4052
|
+
let r = Pr(e), i = Pr(t.target ?? r), a = t.progressOffset ?? {
|
|
3987
4053
|
completedPages: 0,
|
|
3988
4054
|
received: 0
|
|
3989
4055
|
}, o = t.cycleId ?? `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
3990
4056
|
if (this.options.state.fill = {
|
|
3991
|
-
...
|
|
4057
|
+
...Ir(n, void 0, !1),
|
|
3992
4058
|
completedPages: a.completedPages,
|
|
3993
4059
|
cycleId: o,
|
|
3994
4060
|
received: a.received,
|
|
@@ -4001,7 +4067,7 @@ var Br = class {
|
|
|
4001
4067
|
let s = ++this.requestVersion, c = new AbortController();
|
|
4002
4068
|
this.abortController = c;
|
|
4003
4069
|
try {
|
|
4004
|
-
n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await
|
|
4070
|
+
n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await zr(n, this.options.state, {
|
|
4005
4071
|
cycleId: o,
|
|
4006
4072
|
feedKey: n.feedKey,
|
|
4007
4073
|
items: [...this.options.state.items],
|
|
@@ -4019,7 +4085,7 @@ var Br = class {
|
|
|
4019
4085
|
}
|
|
4020
4086
|
async cancel() {
|
|
4021
4087
|
let { fill: e, state: t } = this.options;
|
|
4022
|
-
if (!
|
|
4088
|
+
if (!Lr(t.fill) || !t.fill.cycleId) return;
|
|
4023
4089
|
let n = {
|
|
4024
4090
|
cycleId: t.fill.cycleId,
|
|
4025
4091
|
feedKey: t.fill.feedKey ?? "",
|
|
@@ -4063,7 +4129,7 @@ var Br = class {
|
|
|
4063
4129
|
});
|
|
4064
4130
|
}
|
|
4065
4131
|
reset() {
|
|
4066
|
-
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill =
|
|
4132
|
+
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = Ir(this.options.fill, void 0, !1), this.collection = null;
|
|
4067
4133
|
}
|
|
4068
4134
|
destroy() {
|
|
4069
4135
|
this.abortLocalRequest(), this.delayCountdown.clear();
|
|
@@ -4098,7 +4164,7 @@ var Br = class {
|
|
|
4098
4164
|
s.fill.status = "until" in t ? "complete" : "exhausted";
|
|
4099
4165
|
return;
|
|
4100
4166
|
}
|
|
4101
|
-
let c = await
|
|
4167
|
+
let c = await Rr({
|
|
4102
4168
|
existingItems: s.items,
|
|
4103
4169
|
getLoadedItemCount: () => s.items.length,
|
|
4104
4170
|
initialCursor: s.next,
|
|
@@ -4150,7 +4216,7 @@ var Br = class {
|
|
|
4150
4216
|
};
|
|
4151
4217
|
//#endregion
|
|
4152
4218
|
//#region src/core/fillReconciliation.ts
|
|
4153
|
-
async function
|
|
4219
|
+
async function qr({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r, pauseWhenManual: i = !1, setLastCursor: a, signal: o, state: s }) {
|
|
4154
4220
|
if (!e.needsReconciliation(s.items)) return "skipped";
|
|
4155
4221
|
let c = await e.reconcile({
|
|
4156
4222
|
existingItems: s.items,
|
|
@@ -4163,7 +4229,7 @@ async function Vr({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r,
|
|
|
4163
4229
|
}
|
|
4164
4230
|
//#endregion
|
|
4165
4231
|
//#region src/core/feedFooter.ts
|
|
4166
|
-
function
|
|
4232
|
+
function Jr(e) {
|
|
4167
4233
|
return {
|
|
4168
4234
|
cancelAutofill: () => e.cancelAutofill(),
|
|
4169
4235
|
loadMore: () => e.loadNext(),
|
|
@@ -4175,46 +4241,46 @@ function Hr(e) {
|
|
|
4175
4241
|
retryFill: () => e.retryFill()
|
|
4176
4242
|
};
|
|
4177
4243
|
}
|
|
4178
|
-
function
|
|
4244
|
+
function Yr(e) {
|
|
4179
4245
|
if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
|
|
4180
4246
|
}
|
|
4181
|
-
function
|
|
4182
|
-
e?.intervalMs !== void 0 &&
|
|
4247
|
+
function Xr(e) {
|
|
4248
|
+
e?.intervalMs !== void 0 && Yr(e.intervalMs);
|
|
4183
4249
|
}
|
|
4184
|
-
function
|
|
4250
|
+
function Zr(e) {
|
|
4185
4251
|
return {
|
|
4186
4252
|
enabled: e?.enabled ?? !1,
|
|
4187
4253
|
includePostItems: e?.includePostItems ?? !1,
|
|
4188
4254
|
intervalMs: e?.intervalMs ?? 5e3
|
|
4189
4255
|
};
|
|
4190
4256
|
}
|
|
4191
|
-
function
|
|
4257
|
+
function Qr(e, t) {
|
|
4192
4258
|
if (typeof t == "boolean") {
|
|
4193
4259
|
e.enabled = t;
|
|
4194
4260
|
return;
|
|
4195
4261
|
}
|
|
4196
|
-
|
|
4262
|
+
Xr(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);
|
|
4197
4263
|
}
|
|
4198
4264
|
//#endregion
|
|
4199
4265
|
//#region src/core/reelInfoSheet.ts
|
|
4200
|
-
function
|
|
4266
|
+
function $r(e) {
|
|
4201
4267
|
return { enabled: e?.enabled ?? !1 };
|
|
4202
4268
|
}
|
|
4203
|
-
function
|
|
4269
|
+
function ei(e, t, n) {
|
|
4204
4270
|
if (n && !t) throw Error("Vibe cannot enable reelInfoSheet without a configured component.");
|
|
4205
4271
|
e.enabled = n;
|
|
4206
4272
|
}
|
|
4207
4273
|
//#endregion
|
|
4208
4274
|
//#region src/core/initialRuntimeState.ts
|
|
4209
|
-
function
|
|
4275
|
+
function ti(e, t) {
|
|
4210
4276
|
let n = e.initialPage;
|
|
4211
4277
|
return {
|
|
4212
4278
|
activeReelPostId: null,
|
|
4213
|
-
autoScroll:
|
|
4214
|
-
autofill:
|
|
4279
|
+
autoScroll: wr(e.autoScroll),
|
|
4280
|
+
autofill: mr(e.autofill),
|
|
4215
4281
|
current: n?.current ?? null,
|
|
4216
4282
|
error: null,
|
|
4217
|
-
fill:
|
|
4283
|
+
fill: Ir(e.fill),
|
|
4218
4284
|
infiniteScroll: e.infiniteScroll ?? !0,
|
|
4219
4285
|
isLoading: !n,
|
|
4220
4286
|
isLoadingMore: !1,
|
|
@@ -4225,14 +4291,14 @@ function Yr(e, t) {
|
|
|
4225
4291
|
next: n?.next ?? null,
|
|
4226
4292
|
nextPageError: null,
|
|
4227
4293
|
phoneMode: !1,
|
|
4228
|
-
reelAutoAdvance:
|
|
4294
|
+
reelAutoAdvance: Zr(e.reelAutoAdvance),
|
|
4229
4295
|
reelForward: {
|
|
4230
4296
|
error: null,
|
|
4231
4297
|
status: "idle"
|
|
4232
4298
|
},
|
|
4233
4299
|
reelForwardIndex: null,
|
|
4234
4300
|
reelForwardItem: null,
|
|
4235
|
-
reelInfoSheet:
|
|
4301
|
+
reelInfoSheet: $r(e.reelInfoSheet),
|
|
4236
4302
|
reelInfoSheetOverlay: !1,
|
|
4237
4303
|
reelMediaSource: "original",
|
|
4238
4304
|
reelOrigin: null,
|
|
@@ -4241,21 +4307,21 @@ function Yr(e, t) {
|
|
|
4241
4307
|
}
|
|
4242
4308
|
//#endregion
|
|
4243
4309
|
//#region src/core/options.ts
|
|
4244
|
-
function
|
|
4310
|
+
function ni(e, t) {
|
|
4245
4311
|
if (t) {
|
|
4246
4312
|
if (!Number.isFinite(t.height) || t.height <= 0) throw TypeError(`Vibe ${e} height must be a positive number.`);
|
|
4247
4313
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe ${e} background must be "default" or "transparent".`);
|
|
4248
4314
|
}
|
|
4249
4315
|
}
|
|
4250
|
-
function
|
|
4316
|
+
function ri(e, t) {
|
|
4251
4317
|
if (t) {
|
|
4252
4318
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe mediaCard ${e} background must be "default" or "transparent".`);
|
|
4253
4319
|
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.`);
|
|
4254
4320
|
}
|
|
4255
4321
|
}
|
|
4256
|
-
function
|
|
4257
|
-
if (
|
|
4258
|
-
if (
|
|
4322
|
+
function ii(e) {
|
|
4323
|
+
if (Cr(e.autoScroll), ni("cardHeader", e.cardHeader), ni("cardFooter", e.cardFooter), ri("header", e.mediaCard?.header), ri("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\".");
|
|
4324
|
+
if (pr(e.autofill), Fr(e.fill), ke(e.masonry), Xr(e.reelAutoAdvance), e.removalReconciliation) {
|
|
4259
4325
|
if (!Number.isInteger(e.removalReconciliation.pageSize) || e.removalReconciliation.pageSize <= 0) throw TypeError("Vibe removalReconciliation pageSize must be a positive integer.");
|
|
4260
4326
|
let t = e.removalReconciliation.maxReplayPages ?? 5;
|
|
4261
4327
|
if (!Number.isInteger(t) || t <= 0) throw TypeError("Vibe removalReconciliation maxReplayPages must be a positive integer.");
|
|
@@ -4270,7 +4336,7 @@ function Qr(e) {
|
|
|
4270
4336
|
if (e.fill?.strategy === "frontend" && !e.loadPage) throw TypeError("Vibe frontend fill requires loadPage.");
|
|
4271
4337
|
if (e.fill?.strategy === "backend" && e.fill.initialSession && !e.initialPage) throw TypeError("Vibe backend fill restoration requires initialPage.");
|
|
4272
4338
|
}
|
|
4273
|
-
function
|
|
4339
|
+
function ai(e) {
|
|
4274
4340
|
if (typeof e != "string") return e;
|
|
4275
4341
|
if (typeof document > "u") throw Error("Vibe cannot resolve a selector without a document.");
|
|
4276
4342
|
let t = document.querySelector(e);
|
|
@@ -4279,7 +4345,7 @@ function $r(e) {
|
|
|
4279
4345
|
}
|
|
4280
4346
|
//#endregion
|
|
4281
4347
|
//#region src/core/pageRequest.ts
|
|
4282
|
-
async function
|
|
4348
|
+
async function oi({ append: e, autofillController: t, cursor: n, isCurrent: r, loadPage: i, onLastCursor: a, onPages: o, options: s, signal: c, state: l }) {
|
|
4283
4349
|
let u = s.autofill, d = e && u?.strategy === "frontend" && (l.autofill.status === "paused" || l.autofill.status === "error"), f = d ? {
|
|
4284
4350
|
received: l.autofill.received,
|
|
4285
4351
|
requests: l.autofill.requests
|
|
@@ -4291,11 +4357,11 @@ async function ei({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
4291
4357
|
let m = !1;
|
|
4292
4358
|
try {
|
|
4293
4359
|
if (u?.strategy === "frontend") {
|
|
4294
|
-
let s = await
|
|
4360
|
+
let s = await vr({
|
|
4295
4361
|
existingItems: e ? l.items : [],
|
|
4296
4362
|
initialCursor: n,
|
|
4297
4363
|
loadPage: i,
|
|
4298
|
-
maximumRequests: f ? Math.max(0,
|
|
4364
|
+
maximumRequests: f ? Math.max(0, ur(u) - f.requests) : void 0,
|
|
4299
4365
|
onCollection: (e) => t.captureCollection(e, r()),
|
|
4300
4366
|
onDelayChange: (e) => {
|
|
4301
4367
|
r() && Object.assign(l.autofill, e);
|
|
@@ -4318,7 +4384,7 @@ async function ei({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
4318
4384
|
}), o(s.pages), t.clearCollection();
|
|
4319
4385
|
return;
|
|
4320
4386
|
}
|
|
4321
|
-
let s =
|
|
4387
|
+
let s = Jn(await i({
|
|
4322
4388
|
cursor: n,
|
|
4323
4389
|
signal: c
|
|
4324
4390
|
}));
|
|
@@ -4338,7 +4404,7 @@ async function ei({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
4338
4404
|
l.autofill.status = "complete";
|
|
4339
4405
|
return;
|
|
4340
4406
|
}
|
|
4341
|
-
await
|
|
4407
|
+
await Er(u, l, {
|
|
4342
4408
|
cycleId: p,
|
|
4343
4409
|
feedKey: u.feedKey,
|
|
4344
4410
|
items: h.slice(d.length),
|
|
@@ -4360,7 +4426,7 @@ async function ei({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
4360
4426
|
}
|
|
4361
4427
|
//#endregion
|
|
4362
4428
|
//#region src/core/pageReplacement.ts
|
|
4363
|
-
var
|
|
4429
|
+
var si = class {
|
|
4364
4430
|
controller = null;
|
|
4365
4431
|
constructor(e) {
|
|
4366
4432
|
this.options = e;
|
|
@@ -4372,7 +4438,7 @@ var ti = class {
|
|
|
4372
4438
|
this.controller?.abort(), this.controller = null, this.options.surface()?.cancelItemRemoval();
|
|
4373
4439
|
}
|
|
4374
4440
|
async replace(e, t) {
|
|
4375
|
-
let n =
|
|
4441
|
+
let n = Jn(e);
|
|
4376
4442
|
this.cancel();
|
|
4377
4443
|
let r = new AbortController();
|
|
4378
4444
|
this.controller = r;
|
|
@@ -4403,7 +4469,7 @@ var ti = class {
|
|
|
4403
4469
|
};
|
|
4404
4470
|
//#endregion
|
|
4405
4471
|
//#region src/core/loadingLock.ts
|
|
4406
|
-
function
|
|
4472
|
+
function ci(e, t, n) {
|
|
4407
4473
|
if (e.loadMoreLocked !== t && (e.loadMoreLocked = t, !t)) {
|
|
4408
4474
|
if (e.fill.status === "paused" && e.fill.target) {
|
|
4409
4475
|
n.resumeFill();
|
|
@@ -4419,16 +4485,16 @@ function ni(e, t, n) {
|
|
|
4419
4485
|
}
|
|
4420
4486
|
//#endregion
|
|
4421
4487
|
//#region src/core/removalReconciliationController.ts
|
|
4422
|
-
function
|
|
4488
|
+
function li(e) {
|
|
4423
4489
|
return `${typeof e}:${String(e)}`;
|
|
4424
4490
|
}
|
|
4425
|
-
function
|
|
4491
|
+
function ui(e) {
|
|
4426
4492
|
return `${typeof e}:${String(e)}`;
|
|
4427
4493
|
}
|
|
4428
|
-
function
|
|
4494
|
+
function di(e) {
|
|
4429
4495
|
return e.map(({ postId: e }) => e);
|
|
4430
4496
|
}
|
|
4431
|
-
var
|
|
4497
|
+
var fi = class {
|
|
4432
4498
|
delay;
|
|
4433
4499
|
enabled;
|
|
4434
4500
|
maxReplayPages;
|
|
@@ -4447,7 +4513,7 @@ var oi = class {
|
|
|
4447
4513
|
e.status === "complete" && (this.pages = [...this.pages.slice(0, e.replaceFrom), ...e.pages].slice(-this.maxReplayPages), this.pending = null);
|
|
4448
4514
|
}
|
|
4449
4515
|
filterItems(e) {
|
|
4450
|
-
return this.tombstones.size === 0 ? [...e] : e.filter(({ postId: e }) => !this.tombstones.has(
|
|
4516
|
+
return this.tombstones.size === 0 ? [...e] : e.filter(({ postId: e }) => !this.tombstones.has(li(e)));
|
|
4451
4517
|
}
|
|
4452
4518
|
needsReconciliation(e) {
|
|
4453
4519
|
return this.pending !== null || this.findUnderfilledPage(e) >= 0;
|
|
@@ -4460,45 +4526,45 @@ var oi = class {
|
|
|
4460
4526
|
}
|
|
4461
4527
|
recordInitialPage(e) {
|
|
4462
4528
|
e && this.recordPages([{
|
|
4463
|
-
contributionIds:
|
|
4464
|
-
cursor:
|
|
4529
|
+
contributionIds: di(e.items),
|
|
4530
|
+
cursor: Qn(e),
|
|
4465
4531
|
next: e.next,
|
|
4466
|
-
returnedIds:
|
|
4532
|
+
returnedIds: di(e.items)
|
|
4467
4533
|
}]);
|
|
4468
4534
|
}
|
|
4469
4535
|
remove(e) {
|
|
4470
|
-
e.forEach((e) => this.tombstones.add(
|
|
4536
|
+
e.forEach((e) => this.tombstones.add(li(e)));
|
|
4471
4537
|
}
|
|
4472
4538
|
reset() {
|
|
4473
4539
|
this.pages = [], this.pending = null, this.tombstones.clear();
|
|
4474
4540
|
}
|
|
4475
4541
|
restore(e) {
|
|
4476
|
-
e.forEach((e) => this.tombstones.delete(
|
|
4542
|
+
e.forEach((e) => this.tombstones.delete(li(e)));
|
|
4477
4543
|
}
|
|
4478
4544
|
async reconcile({ existingItems: e, loadPage: t, onDelayChange: n = () => void 0, shouldPause: r = () => !1, signal: i }) {
|
|
4479
4545
|
let a = this.pending ?? this.createSession(e);
|
|
4480
4546
|
for (this.pending = a; a.remainingRequests > 0;) {
|
|
4481
|
-
let e =
|
|
4547
|
+
let e = ui(a.cursor);
|
|
4482
4548
|
if (a.seenCursors.has(e)) throw Error("Vibe removal reconciliation received a repeated cursor.");
|
|
4483
|
-
if (await
|
|
4484
|
-
delayMs:
|
|
4549
|
+
if (await cr({
|
|
4550
|
+
delayMs: or(a.pages.length, this.delay),
|
|
4485
4551
|
onChange: n,
|
|
4486
4552
|
signal: i
|
|
4487
4553
|
}), a.pages.length > 0 && r()) return this.result(a, "paused");
|
|
4488
|
-
let o =
|
|
4554
|
+
let o = Jn(await t({
|
|
4489
4555
|
cursor: a.cursor,
|
|
4490
4556
|
signal: i
|
|
4491
4557
|
}));
|
|
4492
4558
|
a.seenCursors.add(e);
|
|
4493
4559
|
let s = this.filterItems(o.items), c = [];
|
|
4494
4560
|
if (s.forEach((e) => {
|
|
4495
|
-
let t =
|
|
4561
|
+
let t = li(e.postId);
|
|
4496
4562
|
a.attributed.has(t) || (a.attributed.add(t), c.push(e.postId)), a.appended.has(t) || (a.appended.add(t), a.items.push(e));
|
|
4497
4563
|
}), a.pages.push({
|
|
4498
4564
|
contributionIds: c,
|
|
4499
4565
|
cursor: a.cursor,
|
|
4500
4566
|
next: o.next,
|
|
4501
|
-
returnedIds:
|
|
4567
|
+
returnedIds: di(s)
|
|
4502
4568
|
}), 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");
|
|
4503
4569
|
}
|
|
4504
4570
|
return this.result(a, "complete");
|
|
@@ -4506,9 +4572,9 @@ var oi = class {
|
|
|
4506
4572
|
createSession(e) {
|
|
4507
4573
|
let t = this.findUnderfilledPage(e), n = t < 0 ? [] : this.pages.slice(t), r = n[0];
|
|
4508
4574
|
if (!r) throw Error("Vibe has no underfilled provider page to reconcile.");
|
|
4509
|
-
let i = new Set(n.flatMap(({ contributionIds: e }) => e.map(
|
|
4575
|
+
let i = new Set(n.flatMap(({ contributionIds: e }) => e.map(li))), a = new Set(e.map(({ postId: e }) => li(e)).filter((e) => !i.has(e)));
|
|
4510
4576
|
return {
|
|
4511
|
-
appended: new Set(e.map(({ postId: e }) =>
|
|
4577
|
+
appended: new Set(e.map(({ postId: e }) => li(e))),
|
|
4512
4578
|
attributed: new Set(a),
|
|
4513
4579
|
cursor: r.cursor,
|
|
4514
4580
|
items: [],
|
|
@@ -4533,11 +4599,11 @@ var oi = class {
|
|
|
4533
4599
|
}
|
|
4534
4600
|
findUnderfilledPage(e) {
|
|
4535
4601
|
if (!this.enabled || this.pages.length === 0) return -1;
|
|
4536
|
-
let t = new Set(e.map(({ postId: e }) =>
|
|
4537
|
-
return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has(
|
|
4602
|
+
let t = new Set(e.map(({ postId: e }) => li(e)));
|
|
4603
|
+
return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has(li(e))).length < this.pageSize);
|
|
4538
4604
|
}
|
|
4539
4605
|
recordPage(e) {
|
|
4540
|
-
let t =
|
|
4606
|
+
let t = ui(e.cursor), n = this.pages.findIndex(({ cursor: e }) => ui(e) === t);
|
|
4541
4607
|
n >= 0 && (this.pages = this.pages.slice(0, n)), this.pages.push({
|
|
4542
4608
|
...e,
|
|
4543
4609
|
contributionIds: [...e.contributionIds],
|
|
@@ -4547,7 +4613,7 @@ var oi = class {
|
|
|
4547
4613
|
};
|
|
4548
4614
|
//#endregion
|
|
4549
4615
|
//#region src/core/activeItemRemoval.ts
|
|
4550
|
-
function
|
|
4616
|
+
function pi(e, t, n, r, i) {
|
|
4551
4617
|
let a = new Set(t.map(({ item: e }) => e.postId));
|
|
4552
4618
|
if (e.activeReelPostId === null || !a.has(e.activeReelPostId)) return;
|
|
4553
4619
|
let o = e.items[Math.max(n, 0)];
|
|
@@ -4560,7 +4626,7 @@ function si(e, t, n, r, i) {
|
|
|
4560
4626
|
}
|
|
4561
4627
|
//#endregion
|
|
4562
4628
|
//#region src/core/exactMediaRemovalController.ts
|
|
4563
|
-
function
|
|
4629
|
+
function mi(e, t) {
|
|
4564
4630
|
let [n, ...r] = t;
|
|
4565
4631
|
if (!n) throw Error("Vibe items must contain at least one media asset.");
|
|
4566
4632
|
return {
|
|
@@ -4569,10 +4635,10 @@ function ci(e, t) {
|
|
|
4569
4635
|
items: r
|
|
4570
4636
|
};
|
|
4571
4637
|
}
|
|
4572
|
-
function
|
|
4638
|
+
function hi(e) {
|
|
4573
4639
|
if (!Number.isInteger(e.mediaIndex) || e.mediaIndex < 0) throw TypeError("Vibe mediaIndex must be a non-negative integer.");
|
|
4574
4640
|
}
|
|
4575
|
-
var
|
|
4641
|
+
var gi = class {
|
|
4576
4642
|
generation = 0;
|
|
4577
4643
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
4578
4644
|
state;
|
|
@@ -4580,7 +4646,7 @@ var ui = class {
|
|
|
4580
4646
|
this.options = e, this.state = e.state;
|
|
4581
4647
|
}
|
|
4582
4648
|
remove(e) {
|
|
4583
|
-
|
|
4649
|
+
hi(e);
|
|
4584
4650
|
let t = this.state.items.findIndex(({ postId: t }) => t === e.postId), n = this.state.items[t];
|
|
4585
4651
|
if (!n) return null;
|
|
4586
4652
|
let r = [...V(n)], i = r[e.mediaIndex];
|
|
@@ -4597,7 +4663,7 @@ var ui = class {
|
|
|
4597
4663
|
restored: !1
|
|
4598
4664
|
});
|
|
4599
4665
|
let o = this.state.mediaIndices.get(n.postId) ?? 0, s = this.isReelOpen() && this.state.activeReelPostId === n.postId, c = s && o === e.mediaIndex;
|
|
4600
|
-
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] =
|
|
4666
|
+
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = mi(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);
|
|
4601
4667
|
}
|
|
4602
4668
|
reset() {
|
|
4603
4669
|
this.generation += 1;
|
|
@@ -4623,7 +4689,7 @@ var ui = class {
|
|
|
4623
4689
|
}
|
|
4624
4690
|
restoreIntoPost(e, t) {
|
|
4625
4691
|
let n = this.state.items[e], r = [...V(n)], i = Math.min(t.mediaIndex, r.length);
|
|
4626
|
-
if (r.splice(i, 0, t.media), this.state.items[e] =
|
|
4692
|
+
if (r.splice(i, 0, t.media), this.state.items[e] = mi(n, r), this.state.activeReelPostId !== t.postId) return;
|
|
4627
4693
|
let a = this.state.mediaIndices.get(t.postId) ?? 0;
|
|
4628
4694
|
a >= i && this.state.mediaIndices.set(t.postId, a + 1);
|
|
4629
4695
|
}
|
|
@@ -4636,18 +4702,18 @@ var ui = class {
|
|
|
4636
4702
|
};
|
|
4637
4703
|
//#endregion
|
|
4638
4704
|
//#region src/core/itemPlacement.ts
|
|
4639
|
-
function
|
|
4705
|
+
function _i(e, t) {
|
|
4640
4706
|
let n = new Set(t);
|
|
4641
4707
|
return e.flatMap((e, t) => n.has(e.postId) ? [{
|
|
4642
4708
|
index: t,
|
|
4643
4709
|
item: e
|
|
4644
4710
|
}] : []);
|
|
4645
4711
|
}
|
|
4646
|
-
function
|
|
4712
|
+
function vi(e, t) {
|
|
4647
4713
|
let n = new Set(t.map(({ item: e }) => e.postId));
|
|
4648
4714
|
return e.filter((e) => !n.has(e.postId));
|
|
4649
4715
|
}
|
|
4650
|
-
function
|
|
4716
|
+
function yi(e, t) {
|
|
4651
4717
|
t.forEach(({ index: e }) => {
|
|
4652
4718
|
if (!Number.isInteger(e) || e < 0) throw Error("Vibe item restore indexes must be non-negative integers.");
|
|
4653
4719
|
});
|
|
@@ -4658,7 +4724,7 @@ function pi(e, t) {
|
|
|
4658
4724
|
}
|
|
4659
4725
|
//#endregion
|
|
4660
4726
|
//#region src/core/itemRemovalController.ts
|
|
4661
|
-
var
|
|
4727
|
+
var bi = 20, xi = class {
|
|
4662
4728
|
generation = 0;
|
|
4663
4729
|
historyLimit;
|
|
4664
4730
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
@@ -4667,7 +4733,7 @@ var mi = 20, hi = class {
|
|
|
4667
4733
|
itemOrder;
|
|
4668
4734
|
stopItemsWatcher;
|
|
4669
4735
|
constructor(e) {
|
|
4670
|
-
this.options = e, this.historyLimit = e.historyLimit ??
|
|
4736
|
+
this.options = e, this.historyLimit = e.historyLimit ?? bi, this.state = e.state, this.itemOrder = this.state.items.map(({ postId: e }) => e), this.stopItemsWatcher = O(() => this.state.items, (e) => this.appendUnknownItems(e), { flush: "sync" });
|
|
4671
4737
|
}
|
|
4672
4738
|
destroy() {
|
|
4673
4739
|
this.reset(), this.stopItemsWatcher();
|
|
@@ -4681,7 +4747,7 @@ var mi = 20, hi = class {
|
|
|
4681
4747
|
let a = this.options.startRemoval(i, t);
|
|
4682
4748
|
if (a > 0 && await new Promise((e) => setTimeout(e, a)), this.metadata.get(r)?.generation !== this.generation) return r;
|
|
4683
4749
|
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);
|
|
4684
|
-
return this.state.items =
|
|
4750
|
+
return this.state.items = vi(this.state.items, n), this.options.onItemsRemoved(r, n, l), this.record(r), r;
|
|
4685
4751
|
}
|
|
4686
4752
|
reset() {
|
|
4687
4753
|
this.generation += 1, this.history = [], this.itemOrder = [];
|
|
@@ -4692,7 +4758,7 @@ var mi = 20, hi = class {
|
|
|
4692
4758
|
this.restoreRemoval(t);
|
|
4693
4759
|
return;
|
|
4694
4760
|
}
|
|
4695
|
-
let n = new Set(this.state.items.map(({ postId: e }) => e)), r = e.filter(({ item: e }) => n.has(e.postId) ? !1 : (n.add(e.postId), !0)), i =
|
|
4761
|
+
let n = new Set(this.state.items.map(({ postId: e }) => e)), r = e.filter(({ item: e }) => n.has(e.postId) ? !1 : (n.add(e.postId), !0)), i = yi(this.state.items, r);
|
|
4696
4762
|
this.registerExternalPlacements(r), this.state.items = i, r.length > 0 && this.options.onRemovalRestored(r);
|
|
4697
4763
|
}
|
|
4698
4764
|
restoreRemoval(e) {
|
|
@@ -4718,7 +4784,7 @@ var mi = 20, hi = class {
|
|
|
4718
4784
|
}
|
|
4719
4785
|
collectOrderedPlacements(e) {
|
|
4720
4786
|
let t = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
4721
|
-
return
|
|
4787
|
+
return _i(this.state.items, e).map((e) => ({
|
|
4722
4788
|
index: t.get(e.item.postId) ?? e.index,
|
|
4723
4789
|
item: e.item
|
|
4724
4790
|
}));
|
|
@@ -4749,7 +4815,7 @@ var mi = 20, hi = class {
|
|
|
4749
4815
|
let r = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
4750
4816
|
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;
|
|
4751
4817
|
}
|
|
4752
|
-
},
|
|
4818
|
+
}, Si = class {
|
|
4753
4819
|
forward = null;
|
|
4754
4820
|
forwardPromise = null;
|
|
4755
4821
|
forwardVersion = 0;
|
|
@@ -4845,7 +4911,7 @@ var mi = 20, hi = class {
|
|
|
4845
4911
|
}
|
|
4846
4912
|
}
|
|
4847
4913
|
}
|
|
4848
|
-
},
|
|
4914
|
+
}, Ci = class {
|
|
4849
4915
|
generation = 0;
|
|
4850
4916
|
pending = Promise.resolve();
|
|
4851
4917
|
constructor(e) {
|
|
@@ -4895,24 +4961,24 @@ var mi = 20, hi = class {
|
|
|
4895
4961
|
};
|
|
4896
4962
|
//#endregion
|
|
4897
4963
|
//#region src/core/removalControllers.ts
|
|
4898
|
-
function
|
|
4899
|
-
let t = new
|
|
4964
|
+
function wi(e) {
|
|
4965
|
+
let t = new Si(e), n = new Ci({
|
|
4900
4966
|
state: e.state,
|
|
4901
4967
|
transitionMedia: (t) => e.surface()?.transitionActiveReelMedia(t) ?? Promise.resolve(!1),
|
|
4902
4968
|
transitionPost: (t) => e.surface()?.transitionActiveReelPost(t) ?? Promise.resolve(!1)
|
|
4903
4969
|
});
|
|
4904
4970
|
return {
|
|
4905
|
-
exactMediaRemoval: new
|
|
4971
|
+
exactMediaRemoval: new gi({
|
|
4906
4972
|
onActivate: e.onActivate,
|
|
4907
4973
|
onPostRemoved: (t) => e.onItemsRemoved([t]),
|
|
4908
4974
|
onPostRestored: (t) => e.onItemsRestored([t]),
|
|
4909
4975
|
reelForward: t,
|
|
4910
4976
|
state: e.state
|
|
4911
4977
|
}),
|
|
4912
|
-
itemRemoval: new
|
|
4978
|
+
itemRemoval: new xi({
|
|
4913
4979
|
historyLimit: e.historyLimit,
|
|
4914
4980
|
onItemsRemoved: (n, r, i) => {
|
|
4915
|
-
e.onItemsRemoved(r.map(({ item: e }) => e.postId)),
|
|
4981
|
+
e.onItemsRemoved(r.map(({ item: e }) => e.postId)), pi(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
|
|
4916
4982
|
},
|
|
4917
4983
|
onRemovalRestored: (n) => {
|
|
4918
4984
|
e.onItemsRestored(n.map(({ item: e }) => e.postId));
|
|
@@ -4927,17 +4993,17 @@ function vi(e) {
|
|
|
4927
4993
|
reelRemoval: n
|
|
4928
4994
|
};
|
|
4929
4995
|
}
|
|
4930
|
-
var
|
|
4931
|
-
function
|
|
4996
|
+
var Ti = 1.5;
|
|
4997
|
+
function Ei(e) {
|
|
4932
4998
|
let t = Math.min(e.screenWidth, e.screenHeight);
|
|
4933
4999
|
if (t > 0 && t < 600) return !0;
|
|
4934
|
-
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n *
|
|
5000
|
+
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * Ti;
|
|
4935
5001
|
return !e.hasHover && n > 0 && n < 600 && r;
|
|
4936
5002
|
}
|
|
4937
|
-
function
|
|
4938
|
-
return
|
|
5003
|
+
function Di(e) {
|
|
5004
|
+
return Ei(e) ? "reel" : "masonry";
|
|
4939
5005
|
}
|
|
4940
|
-
function
|
|
5006
|
+
function Oi(e) {
|
|
4941
5007
|
let t = e.ownerDocument.defaultView, n = e.ownerDocument.documentElement;
|
|
4942
5008
|
return {
|
|
4943
5009
|
hasHover: typeof t?.matchMedia == "function" && t.matchMedia("(hover: hover)").matches,
|
|
@@ -4947,15 +5013,15 @@ function Si(e) {
|
|
|
4947
5013
|
viewportWidth: n.clientWidth
|
|
4948
5014
|
};
|
|
4949
5015
|
}
|
|
4950
|
-
function
|
|
4951
|
-
return
|
|
5016
|
+
function ki(e) {
|
|
5017
|
+
return Ei(Oi(e));
|
|
4952
5018
|
}
|
|
4953
|
-
function
|
|
4954
|
-
return
|
|
5019
|
+
function Ai(e) {
|
|
5020
|
+
return Di(Oi(e));
|
|
4955
5021
|
}
|
|
4956
5022
|
//#endregion
|
|
4957
5023
|
//#region src/core/responsiveLayoutController.ts
|
|
4958
|
-
var
|
|
5024
|
+
var ji = class {
|
|
4959
5025
|
layoutMode;
|
|
4960
5026
|
resizeObserver = null;
|
|
4961
5027
|
target = null;
|
|
@@ -4980,13 +5046,13 @@ var Ti = class {
|
|
|
4980
5046
|
}
|
|
4981
5047
|
handleResponsiveLayout = () => {
|
|
4982
5048
|
if (!this.target) return;
|
|
4983
|
-
let e =
|
|
4984
|
-
this.state.phoneMode =
|
|
5049
|
+
let e = Ai(this.target);
|
|
5050
|
+
this.state.phoneMode = ki(this.target), this.state.reelInfoSheetOverlay = this.state.phoneMode, this.state.reelMediaSource = this.state.phoneMode ? "mobile" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
|
|
4985
5051
|
};
|
|
4986
|
-
},
|
|
5052
|
+
}, Mi = class {
|
|
4987
5053
|
state;
|
|
4988
5054
|
constructor(e) {
|
|
4989
|
-
this.options = e, this.state = x(
|
|
5055
|
+
this.options = e, this.state = x(Rt({
|
|
4990
5056
|
...e.initialReelAudioState,
|
|
4991
5057
|
muted: e.initialReelAudioState?.muted ?? e.mediaCard?.videoMuted ?? !1
|
|
4992
5058
|
}));
|
|
@@ -4995,9 +5061,9 @@ var Ti = class {
|
|
|
4995
5061
|
return { ...this.state };
|
|
4996
5062
|
}
|
|
4997
5063
|
set(e, t = !1) {
|
|
4998
|
-
Object.assign(this.state,
|
|
5064
|
+
Object.assign(this.state, Rt(e, this.state)), t && this.options.onReelAudioStateChange?.(this.get());
|
|
4999
5065
|
}
|
|
5000
|
-
},
|
|
5066
|
+
}, Ni = class {
|
|
5001
5067
|
routedReelPostId = null;
|
|
5002
5068
|
reelRouteIsActive = !1;
|
|
5003
5069
|
constructor(e, t) {
|
|
@@ -5026,31 +5092,36 @@ var Ti = class {
|
|
|
5026
5092
|
}
|
|
5027
5093
|
};
|
|
5028
5094
|
//#endregion
|
|
5095
|
+
//#region src/core/reelViewer.ts
|
|
5096
|
+
function Pi(e, t, n) {
|
|
5097
|
+
e.layout !== "masonry" || !e.items.some((e) => e.postId === n) || (e.activeReelPostId = n, e.reelOrigin = "masonry", t.syncReel(n));
|
|
5098
|
+
}
|
|
5099
|
+
//#endregion
|
|
5029
5100
|
//#region src/core/updateItems.ts
|
|
5030
|
-
function
|
|
5101
|
+
function Fi(e) {
|
|
5031
5102
|
return String(e);
|
|
5032
5103
|
}
|
|
5033
|
-
function
|
|
5104
|
+
function Ii(e, t) {
|
|
5034
5105
|
let n = V(t).length;
|
|
5035
5106
|
(e.mediaIndices.get(t.postId) ?? 0) >= n && e.mediaIndices.set(t.postId, Math.max(0, n - 1));
|
|
5036
5107
|
}
|
|
5037
|
-
function
|
|
5108
|
+
function Li(e, t) {
|
|
5038
5109
|
let n = /* @__PURE__ */ new Map();
|
|
5039
|
-
if (t.forEach((e) => n.set(
|
|
5110
|
+
if (t.forEach((e) => n.set(Fi(e.postId), e)), n.size === 0) return [];
|
|
5040
5111
|
let r = [], i = e.items.map((t) => {
|
|
5041
|
-
let i = n.get(
|
|
5112
|
+
let i = n.get(Fi(t.postId));
|
|
5042
5113
|
if (!i) return t;
|
|
5043
5114
|
let a = {
|
|
5044
5115
|
...i,
|
|
5045
5116
|
postId: t.postId
|
|
5046
5117
|
};
|
|
5047
|
-
return
|
|
5118
|
+
return Ii(e, a), e.reelForwardItem && Fi(e.reelForwardItem.postId) === Fi(t.postId) && (e.reelForwardItem = a), r.push(t.postId), a;
|
|
5048
5119
|
});
|
|
5049
5120
|
return r.length > 0 && (e.items = i), r;
|
|
5050
5121
|
}
|
|
5051
5122
|
//#endregion
|
|
5052
5123
|
//#region src/core/createVibe.ts
|
|
5053
|
-
var
|
|
5124
|
+
var Ri = class {
|
|
5054
5125
|
app = null;
|
|
5055
5126
|
autoScroll;
|
|
5056
5127
|
autofillController;
|
|
@@ -5074,25 +5145,25 @@ var ji = class {
|
|
|
5074
5145
|
state;
|
|
5075
5146
|
pageReplacement;
|
|
5076
5147
|
constructor(e) {
|
|
5077
|
-
this.options = e,
|
|
5148
|
+
this.options = e, ii(e);
|
|
5078
5149
|
let t = e.layout ?? "masonry";
|
|
5079
|
-
this.state = x(
|
|
5150
|
+
this.state = x(ti(e, t)), this.reelAudio = new Mi(e), this.lastLoadedCursor = e.initialPage ? Qn(e.initialPage) : null, this.notificationItems = W(this.state), this.autoScroll = new Tr({
|
|
5080
5151
|
getScrollElement: () => this.surface?.getAutoScrollElement() ?? null,
|
|
5081
5152
|
state: this.state.autoScroll
|
|
5082
|
-
}), this.autofillController = new
|
|
5153
|
+
}), this.autofillController = new yr({
|
|
5083
5154
|
cancelRequest: () => this.cancelRequest(!this.pageReplacement?.isActive()),
|
|
5084
5155
|
onLastCursor: (e) => this.setCurrentCursor(e),
|
|
5085
5156
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
5086
5157
|
options: e.autofill,
|
|
5087
5158
|
state: this.state
|
|
5088
|
-
}), this.removalReconciliation = new
|
|
5159
|
+
}), this.removalReconciliation = new fi(e), this.removalReconciliation.recordInitialPage(e.initialPage), this.fillController = new Kr({
|
|
5089
5160
|
filterItems: (e) => this.removalReconciliation.filterItems(e),
|
|
5090
5161
|
fill: e.fill,
|
|
5091
5162
|
loadPage: e.loadPage ? (e) => this.loadFilteredPage(e) : void 0,
|
|
5092
5163
|
needsFrontendPreparation: () => this.removalReconciliation.needsReconciliation(this.state.items),
|
|
5093
5164
|
onLastCursor: (e) => this.setCurrentCursor(e),
|
|
5094
5165
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
5095
|
-
prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) =>
|
|
5166
|
+
prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) => qr({
|
|
5096
5167
|
controller: this.removalReconciliation,
|
|
5097
5168
|
isCurrent: t,
|
|
5098
5169
|
loadPage: e.loadPage,
|
|
@@ -5102,8 +5173,8 @@ var ji = class {
|
|
|
5102
5173
|
state: this.state
|
|
5103
5174
|
}),
|
|
5104
5175
|
state: this.state
|
|
5105
|
-
}), this.routing = new
|
|
5106
|
-
let n =
|
|
5176
|
+
}), this.routing = new Ni(e.routing, this.state);
|
|
5177
|
+
let n = wi({
|
|
5107
5178
|
historyLimit: e.removalHistoryLimit,
|
|
5108
5179
|
onActivate: (e) => this.setActiveReelPost(e),
|
|
5109
5180
|
onCloseReel: () => this.closeMasonryReel(),
|
|
@@ -5113,29 +5184,29 @@ var ji = class {
|
|
|
5113
5184
|
state: this.state,
|
|
5114
5185
|
surface: () => this.surface
|
|
5115
5186
|
});
|
|
5116
|
-
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.pageReplacement = new
|
|
5187
|
+
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.pageReplacement = new si({
|
|
5117
5188
|
state: this.state,
|
|
5118
5189
|
surface: () => this.surface,
|
|
5119
5190
|
prepare: async () => {
|
|
5120
|
-
this.cancelRequest(!1),
|
|
5191
|
+
this.cancelRequest(!1), hr(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill();
|
|
5121
5192
|
},
|
|
5122
5193
|
commit: (e) => {
|
|
5123
|
-
this.resetFeedVisit(), this.setCurrentCursor(
|
|
5194
|
+
this.resetFeedVisit(), this.setCurrentCursor(Qn(e)), this.removalReconciliation.recordInitialPage(e), this.state.reelOrigin === null && this.routing.syncFeed();
|
|
5124
5195
|
}
|
|
5125
|
-
}), this.responsiveLayout = new
|
|
5196
|
+
}), this.responsiveLayout = new ji(t, this.state, () => {
|
|
5126
5197
|
this.routing.syncFeed();
|
|
5127
5198
|
}), this.startStateNotifications();
|
|
5128
5199
|
}
|
|
5129
5200
|
async mount() {
|
|
5130
5201
|
if (this.app) throw Error("Vibe is already mounted.");
|
|
5131
5202
|
this.startStateNotifications();
|
|
5132
|
-
let e =
|
|
5133
|
-
this.responsiveLayout.mount(e), this.app = i(
|
|
5203
|
+
let e = ai(this.options.target);
|
|
5204
|
+
this.responsiveLayout.mount(e), this.app = i(qn, {
|
|
5134
5205
|
canRetryEnd: !!this.options.loadPage,
|
|
5135
5206
|
cardFooter: this.options.cardFooter,
|
|
5136
5207
|
cardHeader: this.options.cardHeader,
|
|
5137
5208
|
feedFooter: this.options.feedFooter,
|
|
5138
|
-
feedFooterActions:
|
|
5209
|
+
feedFooterActions: Jr(this),
|
|
5139
5210
|
mediaCard: this.options.mediaCard,
|
|
5140
5211
|
masonry: this.options.masonry,
|
|
5141
5212
|
onMediaFullyVisible: this.options.onMediaFullyVisible,
|
|
@@ -5153,7 +5224,7 @@ var ji = class {
|
|
|
5153
5224
|
onLoadMore: () => {
|
|
5154
5225
|
this.loadNext();
|
|
5155
5226
|
},
|
|
5156
|
-
onOpenReel: (e) => this.
|
|
5227
|
+
onOpenReel: (e) => Pi(this.state, this.routing, e),
|
|
5157
5228
|
onReelInfoSheetChange: (e) => this.setReelInfoSheet(e),
|
|
5158
5229
|
onReelAudioChange: (e) => this.reelAudio.set(e, !0),
|
|
5159
5230
|
onRetryEnd: () => {
|
|
@@ -5162,7 +5233,7 @@ var ji = class {
|
|
|
5162
5233
|
onRetryForward: () => {
|
|
5163
5234
|
this.retryReelForward();
|
|
5164
5235
|
}
|
|
5165
|
-
}), this.surface = this.app.mount(e), this.autoScroll.mount(), await
|
|
5236
|
+
}), this.surface = this.app.mount(e), this.autoScroll.mount(), await Ar(this.options.restoreBacklog, (e) => this.appendPage(e), (e) => {
|
|
5166
5237
|
this.restoreController = e;
|
|
5167
5238
|
}), !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();
|
|
5168
5239
|
}
|
|
@@ -5170,7 +5241,7 @@ var ji = class {
|
|
|
5170
5241
|
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;
|
|
5171
5242
|
}
|
|
5172
5243
|
getState() {
|
|
5173
|
-
return
|
|
5244
|
+
return ne(this.state);
|
|
5174
5245
|
}
|
|
5175
5246
|
getReelAudioState() {
|
|
5176
5247
|
return this.reelAudio.get();
|
|
@@ -5197,7 +5268,7 @@ var ji = class {
|
|
|
5197
5268
|
return this.itemRemoval.restoreRemoval(e);
|
|
5198
5269
|
}
|
|
5199
5270
|
updateItems(e) {
|
|
5200
|
-
return
|
|
5271
|
+
return Li(this.state, e);
|
|
5201
5272
|
}
|
|
5202
5273
|
retryReelForward() {
|
|
5203
5274
|
return this.reelForward.retry();
|
|
@@ -5236,7 +5307,7 @@ var ji = class {
|
|
|
5236
5307
|
this.autoScroll.setSpeed(e);
|
|
5237
5308
|
}
|
|
5238
5309
|
applyAutofillUpdate(e) {
|
|
5239
|
-
let t =
|
|
5310
|
+
let t = Or(this.options.autofill, this.state, e);
|
|
5240
5311
|
return t && this.autofillController.syncCountdown(), t;
|
|
5241
5312
|
}
|
|
5242
5313
|
cancelAutofill() {
|
|
@@ -5247,7 +5318,7 @@ var ji = class {
|
|
|
5247
5318
|
await this.cancelFill();
|
|
5248
5319
|
return;
|
|
5249
5320
|
}
|
|
5250
|
-
if (
|
|
5321
|
+
if (hr(this.state.autofill)) {
|
|
5251
5322
|
await this.cancelAutofill();
|
|
5252
5323
|
return;
|
|
5253
5324
|
}
|
|
@@ -5260,12 +5331,12 @@ var ji = class {
|
|
|
5260
5331
|
}
|
|
5261
5332
|
async fill(e) {
|
|
5262
5333
|
if (!(this.state.loadMoreLocked || this.pageReplacement.isActive())) {
|
|
5263
|
-
if (this.pendingRequest ||
|
|
5334
|
+
if (this.pendingRequest || hr(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
|
|
5264
5335
|
await this.fillController.start(e);
|
|
5265
5336
|
}
|
|
5266
5337
|
}
|
|
5267
5338
|
restoreAutofillSession(e) {
|
|
5268
|
-
let t =
|
|
5339
|
+
let t = kr(this.options.autofill, this.state, e);
|
|
5269
5340
|
return t && this.autofillController.syncCountdown(), t;
|
|
5270
5341
|
}
|
|
5271
5342
|
restoreFillSession(e) {
|
|
@@ -5275,7 +5346,7 @@ var ji = class {
|
|
|
5275
5346
|
return this.startLoadMore(() => this.loadNextSequence());
|
|
5276
5347
|
}
|
|
5277
5348
|
appendPage(e) {
|
|
5278
|
-
|
|
5349
|
+
$n(e, this.state, this.removalReconciliation, (e) => this.setCurrentCursor(e));
|
|
5279
5350
|
}
|
|
5280
5351
|
replenishAfterRemoval(e = !0) {
|
|
5281
5352
|
return this.startLoadMore(() => this.replenishAfterRemovalSequence(e));
|
|
@@ -5283,7 +5354,7 @@ var ji = class {
|
|
|
5283
5354
|
async startLoadMore(e) {
|
|
5284
5355
|
if (this.pageReplacement.isActive()) return;
|
|
5285
5356
|
if (this.pendingRequest) return this.pendingRequest;
|
|
5286
|
-
if (this.state.loadMoreLocked ||
|
|
5357
|
+
if (this.state.loadMoreLocked || hr(this.state.autofill) || this.fillController.isActive() || !this.options.loadPage || this.state.next === null && !this.removalReconciliation.needsReconciliation(this.state.items)) return;
|
|
5287
5358
|
this.state.isLoadingMore = !0, this.state.nextPageError = null;
|
|
5288
5359
|
let t = e();
|
|
5289
5360
|
return this.pendingRequest = t, t.finally(() => {
|
|
@@ -5301,15 +5372,15 @@ var ji = class {
|
|
|
5301
5372
|
}
|
|
5302
5373
|
async replaceFeed(e, t) {
|
|
5303
5374
|
if (!this.options.loadPage) throw Error(`Vibe cannot ${t} without loadPage.`);
|
|
5304
|
-
return
|
|
5375
|
+
return hr(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);
|
|
5305
5376
|
}
|
|
5306
5377
|
resetFeedVisit() {
|
|
5307
|
-
this.state.autofill =
|
|
5378
|
+
this.state.autofill = mr(this.options.autofill, void 0, !1), this.fillController.reset(), this.reelForward.reset(), this.reelRemoval.reset(), this.exactMediaRemoval.reset(), this.itemRemoval.reset(), this.removalReconciliation.reset();
|
|
5308
5379
|
}
|
|
5309
5380
|
async loadFilteredPage(e) {
|
|
5310
5381
|
let t = this.options.loadPage;
|
|
5311
5382
|
if (!t) throw Error("Vibe cannot load a page without loadPage.");
|
|
5312
|
-
let n =
|
|
5383
|
+
let n = Jn(await t(e));
|
|
5313
5384
|
return {
|
|
5314
5385
|
...n,
|
|
5315
5386
|
items: this.removalReconciliation.filterItems(n.items)
|
|
@@ -5329,7 +5400,7 @@ var ji = class {
|
|
|
5329
5400
|
let n = ++this.requestVersion, r = new AbortController();
|
|
5330
5401
|
this.abortController = r;
|
|
5331
5402
|
try {
|
|
5332
|
-
let i = await
|
|
5403
|
+
let i = await qr({
|
|
5333
5404
|
controller: this.removalReconciliation,
|
|
5334
5405
|
isCurrent: () => n === this.requestVersion,
|
|
5335
5406
|
loadPage: t,
|
|
@@ -5349,14 +5420,14 @@ var ji = class {
|
|
|
5349
5420
|
async retryEnd() {
|
|
5350
5421
|
if (!this.pageReplacement.isActive()) {
|
|
5351
5422
|
if (this.pendingRequest) return this.pendingRequest;
|
|
5352
|
-
if (!this.state.loadMoreLocked && !(
|
|
5423
|
+
if (!this.state.loadMoreLocked && !(hr(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);
|
|
5353
5424
|
}
|
|
5354
5425
|
}
|
|
5355
5426
|
setInfiniteScroll(e) {
|
|
5356
5427
|
this.state.infiniteScroll = e, e && m(() => this.surface?.loadIfNearBottom());
|
|
5357
5428
|
}
|
|
5358
5429
|
setLoadMoreLocked(e) {
|
|
5359
|
-
|
|
5430
|
+
ci(this.state, e, {
|
|
5360
5431
|
getPending: () => this.pendingRequest,
|
|
5361
5432
|
hasPendingSession: () => this.removalReconciliation.hasPendingSession(),
|
|
5362
5433
|
loadNext: () => this.loadNext(),
|
|
@@ -5369,20 +5440,20 @@ var ji = class {
|
|
|
5369
5440
|
this.state.total = e;
|
|
5370
5441
|
}
|
|
5371
5442
|
setReelAutoAdvance(e) {
|
|
5372
|
-
|
|
5443
|
+
Qr(this.state.reelAutoAdvance, e);
|
|
5373
5444
|
}
|
|
5374
5445
|
setReelInfoSheet(e) {
|
|
5375
|
-
|
|
5446
|
+
ei(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
|
|
5376
5447
|
}
|
|
5377
5448
|
setLayout(e) {
|
|
5378
5449
|
this.responsiveLayout.setLayout(e);
|
|
5379
5450
|
}
|
|
5451
|
+
openReel(e) {
|
|
5452
|
+
this.state.layout !== "masonry" || !this.state.items.some((t) => t.postId === e) || this.surface?.openReel(e);
|
|
5453
|
+
}
|
|
5380
5454
|
closeMasonryReel() {
|
|
5381
5455
|
this.state.reelOrigin === "masonry" && (this.state.activeReelPostId = null, this.state.reelOrigin = null, this.routing.syncFeed());
|
|
5382
5456
|
}
|
|
5383
|
-
openMasonryReel(e) {
|
|
5384
|
-
this.state.layout === "masonry" && this.state.items.some((t) => t.postId === e) && (this.state.activeReelPostId = e, this.state.reelOrigin = "masonry", this.routing.syncReel(e));
|
|
5385
|
-
}
|
|
5386
5457
|
setActiveReelPost(e) {
|
|
5387
5458
|
this.state.layout !== "reel" && this.state.reelOrigin !== "masonry" || (this.state.activeReelPostId = e, this.routing.syncReel(e));
|
|
5388
5459
|
}
|
|
@@ -5392,7 +5463,7 @@ var ji = class {
|
|
|
5392
5463
|
async fetchPage(e, t) {
|
|
5393
5464
|
if (!this.options.loadPage) return;
|
|
5394
5465
|
let n = ++this.requestVersion, r = new AbortController();
|
|
5395
|
-
this.abortController = r, await
|
|
5466
|
+
this.abortController = r, await oi({
|
|
5396
5467
|
append: t,
|
|
5397
5468
|
autofillController: this.autofillController,
|
|
5398
5469
|
cursor: e,
|
|
@@ -5414,7 +5485,7 @@ var ji = class {
|
|
|
5414
5485
|
startInitialAutofill() {
|
|
5415
5486
|
let e = ++this.requestVersion, t = new AbortController(), n = this.autofillController.beginCycle();
|
|
5416
5487
|
this.abortController = t, this.state.isLoadingMore = !0;
|
|
5417
|
-
let r =
|
|
5488
|
+
let r = jr({
|
|
5418
5489
|
cycleId: n,
|
|
5419
5490
|
isCurrent: () => e === this.requestVersion,
|
|
5420
5491
|
onCollection: (t) => this.autofillController.captureCollection(t, e === this.requestVersion),
|
|
@@ -5432,11 +5503,11 @@ var ji = class {
|
|
|
5432
5503
|
}
|
|
5433
5504
|
startStateNotifications() {
|
|
5434
5505
|
let e = this.options.onStateChange;
|
|
5435
|
-
!e || this.stopStateWatcher || (this.stopStateWatcher =
|
|
5506
|
+
!e || this.stopStateWatcher || (this.stopStateWatcher = G(this.state, this.notificationItems, e));
|
|
5436
5507
|
}
|
|
5437
5508
|
setCurrentCursor(e) {
|
|
5438
5509
|
this.lastLoadedCursor = this.state.current = e;
|
|
5439
5510
|
}
|
|
5440
|
-
},
|
|
5511
|
+
}, zi = (e) => new Ri(e);
|
|
5441
5512
|
//#endregion
|
|
5442
|
-
export {
|
|
5513
|
+
export { zi as createVibe };
|