@wyxos/vibe 5.7.2 → 5.8.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/README.md +8 -0
- package/lib/components/MediaCard.vue.d.ts +4 -1
- package/lib/components/ReelFeed.vue.d.ts +4 -2
- package/lib/components/ReelLayout.vue.d.ts +3 -1
- package/lib/components/VibeSurface.vue.d.ts +4 -1
- package/lib/components/useMediaCardAudio.d.ts +19 -0
- package/lib/core/feed.d.ts +2 -1
- package/lib/core/mediaCardOptions.d.ts +17 -0
- package/lib/core/reelAudio.d.ts +3 -0
- package/lib/core/reelAudioController.d.ts +8 -0
- package/lib/index.cjs +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +581 -477
- package/lib/types.d.ts +6 -13
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -208,11 +208,11 @@ function J(e) {
|
|
|
208
208
|
}
|
|
209
209
|
//#endregion
|
|
210
210
|
//#region src/core/masonry.ts
|
|
211
|
-
function
|
|
211
|
+
function Y(e) {
|
|
212
212
|
let t = e.preview.width ?? e.width, n = e.preview.height ?? e.height;
|
|
213
213
|
return !t || !n || t <= 0 || n <= 0 ? 1 : n / t;
|
|
214
214
|
}
|
|
215
|
-
function
|
|
215
|
+
function ne(e) {
|
|
216
216
|
return e.reduce((t, n, r) => n < e[t] ? r : t, 0);
|
|
217
217
|
}
|
|
218
218
|
function re(e) {
|
|
@@ -225,7 +225,7 @@ function ie(e, t, n) {
|
|
|
225
225
|
items: []
|
|
226
226
|
};
|
|
227
227
|
let r = Math.max(0, n.gap), i = Number.isFinite(n.additionalHeight) ? Math.max(0, n.additionalHeight ?? 0) : 0, a = Math.max(1, n.minColumnWidth), o = Math.max(1, Math.floor((t + r) / (a + r))), s = (t - r * (o - 1)) / o, c = Array.from({ length: o }, () => 0), l = e.map((e) => {
|
|
228
|
-
let t =
|
|
228
|
+
let t = ne(c), n = s * Y(e) + i, a = {
|
|
229
229
|
x: t * (s + r),
|
|
230
230
|
y: c[t],
|
|
231
231
|
width: s,
|
|
@@ -263,7 +263,7 @@ function X(e, t) {
|
|
|
263
263
|
inspected: n
|
|
264
264
|
};
|
|
265
265
|
}
|
|
266
|
-
function
|
|
266
|
+
function oe(e, t) {
|
|
267
267
|
let n = Math.max(0, t.overscan), r = t.scrollTop - n, i = t.scrollTop + Math.max(0, t.viewportHeight) + n, a = [], o = 0;
|
|
268
268
|
return e.columns.forEach((e) => {
|
|
269
269
|
let t = X(e, r);
|
|
@@ -278,14 +278,14 @@ function Z(e, t) {
|
|
|
278
278
|
inspected: o
|
|
279
279
|
};
|
|
280
280
|
}
|
|
281
|
-
function
|
|
281
|
+
function se(e) {
|
|
282
282
|
return e?.minColumnWidth ?? 240;
|
|
283
283
|
}
|
|
284
|
-
function
|
|
284
|
+
function ce(e, t) {
|
|
285
285
|
let n = e?.overscan?.minimumPx ?? 800, r = e?.overscan?.viewportMultiplier ?? 1.5, i = Math.max(n, t * r), a = e?.overscan?.maximumPx;
|
|
286
286
|
return a === void 0 ? i : Math.min(i, a);
|
|
287
287
|
}
|
|
288
|
-
function
|
|
288
|
+
function le(e) {
|
|
289
289
|
if (e?.minColumnWidth !== void 0 && (!Number.isFinite(e.minColumnWidth) || e.minColumnWidth <= 0)) throw TypeError("Vibe masonry minColumnWidth must be a positive number.");
|
|
290
290
|
let t = e?.overscan;
|
|
291
291
|
if (t) {
|
|
@@ -299,10 +299,10 @@ function se(e) {
|
|
|
299
299
|
}
|
|
300
300
|
//#endregion
|
|
301
301
|
//#region src/core/scrollbar.ts
|
|
302
|
-
function
|
|
302
|
+
function Z(e, t, n) {
|
|
303
303
|
return Math.min(n, Math.max(t, e));
|
|
304
304
|
}
|
|
305
|
-
function
|
|
305
|
+
function ue({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize: r, viewportSize: i }) {
|
|
306
306
|
let a = Math.max(0, e), o = Math.max(0, r), s = Math.max(0, i), c = Math.max(0, a - s);
|
|
307
307
|
if (!(c > 0 && o > 0)) return {
|
|
308
308
|
maximumScrollPosition: c,
|
|
@@ -311,18 +311,18 @@ function le({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize:
|
|
|
311
311
|
thumbSize: o,
|
|
312
312
|
thumbTravel: 0
|
|
313
313
|
};
|
|
314
|
-
let l =
|
|
314
|
+
let l = Z(s / a * o, Math.min(Math.max(0, t), o), o), u = Math.max(0, o - l);
|
|
315
315
|
return {
|
|
316
316
|
maximumScrollPosition: c,
|
|
317
317
|
scrollable: !0,
|
|
318
|
-
thumbOffset: u * (
|
|
318
|
+
thumbOffset: u * (Z(n, 0, c) / c),
|
|
319
319
|
thumbSize: l,
|
|
320
320
|
thumbTravel: u
|
|
321
321
|
};
|
|
322
322
|
}
|
|
323
323
|
//#endregion
|
|
324
324
|
//#region src/components/GalleryScrollbar.vue?vue&type=script&setup=true&lang.ts
|
|
325
|
-
var
|
|
325
|
+
var Q = ["aria-hidden"], de = [
|
|
326
326
|
"aria-controls",
|
|
327
327
|
"aria-valuemax",
|
|
328
328
|
"aria-valuenow",
|
|
@@ -356,7 +356,7 @@ var ue = ["aria-hidden"], de = [
|
|
|
356
356
|
}
|
|
357
357
|
function j() {
|
|
358
358
|
let e = t.scrollElement, r = i.value;
|
|
359
|
-
return !e || !r ? n :
|
|
359
|
+
return !e || !r ? n : ue({
|
|
360
360
|
contentSize: e.scrollHeight,
|
|
361
361
|
minimumThumbSize: fe,
|
|
362
362
|
scrollPosition: e.scrollTop,
|
|
@@ -457,7 +457,7 @@ var ue = ["aria-hidden"], de = [
|
|
|
457
457
|
onPointerdown: I,
|
|
458
458
|
onPointermove: L,
|
|
459
459
|
onPointerup: R
|
|
460
|
-
}, null, 44, de)], 42,
|
|
460
|
+
}, null, 44, de)], 42, Q));
|
|
461
461
|
}
|
|
462
462
|
}), ge = (e) => {
|
|
463
463
|
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
|
@@ -755,10 +755,73 @@ var Pe = /* @__PURE__ */ d({
|
|
|
755
755
|
c("output", Ge, T(u(p.value)) + " / " + T(u(f.value)), 1)
|
|
756
756
|
])) : o("", !0)], 34));
|
|
757
757
|
}
|
|
758
|
-
})
|
|
758
|
+
}), qe = {
|
|
759
|
+
lastAudibleVolume: 1,
|
|
760
|
+
muted: !1,
|
|
761
|
+
volume: 1
|
|
762
|
+
};
|
|
763
|
+
function Je(e, t) {
|
|
764
|
+
return typeof e == "number" && Number.isFinite(e) ? Math.min(1, Math.max(0, e)) : t;
|
|
765
|
+
}
|
|
766
|
+
function Ye(e, t = qe) {
|
|
767
|
+
let n = Je(e?.volume, t.volume), r = Je(e?.lastAudibleVolume, n > 0 ? n : t.lastAudibleVolume);
|
|
768
|
+
return {
|
|
769
|
+
lastAudibleVolume: r > 0 ? r : qe.lastAudibleVolume,
|
|
770
|
+
muted: typeof e?.muted == "boolean" ? e.muted : n === 0 || t.muted,
|
|
771
|
+
volume: n
|
|
772
|
+
};
|
|
773
|
+
}
|
|
774
|
+
//#endregion
|
|
775
|
+
//#region src/components/useMediaCardAudio.ts
|
|
776
|
+
function Xe(e) {
|
|
777
|
+
let t = Ye(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;
|
|
778
|
+
function o() {
|
|
779
|
+
let t = e.videoElement.value, n = e.reelAudioState();
|
|
780
|
+
if (!t || e.layout() !== "reel" || !n) return;
|
|
781
|
+
let o = Ye(n);
|
|
782
|
+
a = o.lastAudibleVolume, i.value = o.volume, r.value = o.muted, t.volume = o.volume, t.muted = e.active() === !1 ? !0 : o.muted;
|
|
783
|
+
}
|
|
784
|
+
function s(e, t) {
|
|
785
|
+
t && (r.value = e.muted), i.value = e.volume, e.volume > 0 && (a = e.volume);
|
|
786
|
+
}
|
|
787
|
+
function c(t) {
|
|
788
|
+
if (e.layout() !== "reel") return;
|
|
789
|
+
let n = Ye({
|
|
790
|
+
lastAudibleVolume: a,
|
|
791
|
+
muted: t.muted,
|
|
792
|
+
volume: t.volume
|
|
793
|
+
});
|
|
794
|
+
r.value = n.muted, i.value = n.volume, a = n.lastAudibleVolume, e.onChange(n);
|
|
795
|
+
}
|
|
796
|
+
function l(t) {
|
|
797
|
+
let n = e.videoElement.value;
|
|
798
|
+
if (!n || !Number.isFinite(t)) return;
|
|
799
|
+
let r = Math.min(1, Math.max(0, t));
|
|
800
|
+
n.volume = r, n.muted = r === 0, r > 0 && (a = r), s(n, !0), c(n);
|
|
801
|
+
}
|
|
802
|
+
function u() {
|
|
803
|
+
let t = e.videoElement.value;
|
|
804
|
+
t && (t.muted && t.volume === 0 && (t.volume = a), t.muted = !t.muted, s(t, !0), c(t));
|
|
805
|
+
}
|
|
806
|
+
return O([
|
|
807
|
+
e.active,
|
|
808
|
+
e.layout,
|
|
809
|
+
() => e.reelAudioState()?.lastAudibleVolume,
|
|
810
|
+
() => e.reelAudioState()?.muted,
|
|
811
|
+
() => e.reelAudioState()?.volume,
|
|
812
|
+
e.videoElement
|
|
813
|
+
], o, { immediate: !0 }), {
|
|
814
|
+
apply: o,
|
|
815
|
+
setVolume: l,
|
|
816
|
+
sync: s,
|
|
817
|
+
toggleMute: u,
|
|
818
|
+
videoIsMuted: r,
|
|
819
|
+
videoVolume: i
|
|
820
|
+
};
|
|
821
|
+
}
|
|
759
822
|
//#endregion
|
|
760
823
|
//#region src/components/useReelVideoActivity.ts
|
|
761
|
-
function
|
|
824
|
+
function Ze(e) {
|
|
762
825
|
let t = r(() => e.layout() !== "reel" || e.active() === !0), n = r(() => t.value ? e.videoIsMuted.value : !0);
|
|
763
826
|
function i() {
|
|
764
827
|
if (!t.value) {
|
|
@@ -792,21 +855,21 @@ function qe(e) {
|
|
|
792
855
|
}
|
|
793
856
|
//#endregion
|
|
794
857
|
//#region src/core/mediaType.ts
|
|
795
|
-
var
|
|
796
|
-
function
|
|
858
|
+
var Qe = /\.(aac|flac|m4a|mp3|mp4|mov|ogg|opus|wav|webm)$/i;
|
|
859
|
+
function $e(e) {
|
|
797
860
|
try {
|
|
798
|
-
return
|
|
861
|
+
return Qe.test(new URL(e).pathname);
|
|
799
862
|
} catch {
|
|
800
|
-
return
|
|
863
|
+
return Qe.test(e.split("?")[0] ?? e);
|
|
801
864
|
}
|
|
802
865
|
}
|
|
803
|
-
function
|
|
804
|
-
return e === void 0 ?
|
|
866
|
+
function et(e, t) {
|
|
867
|
+
return e === void 0 ? $e(t) : e === "video";
|
|
805
868
|
}
|
|
806
869
|
//#endregion
|
|
807
870
|
//#region src/components/useMediaLoading.ts
|
|
808
|
-
function
|
|
809
|
-
let t = r(() =>
|
|
871
|
+
function tt(e) {
|
|
872
|
+
let t = r(() => et(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");
|
|
810
873
|
return O(i, (t, n) => {
|
|
811
874
|
n !== "none" || t === "none" || m(() => e.videoElement.value?.load());
|
|
812
875
|
}), {
|
|
@@ -817,7 +880,7 @@ function Ze(e) {
|
|
|
817
880
|
}
|
|
818
881
|
//#endregion
|
|
819
882
|
//#region src/components/useMediaReadiness.ts
|
|
820
|
-
function
|
|
883
|
+
function nt(e) {
|
|
821
884
|
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 = r(() => c.value || s.value ? "error" : o.value ? "loading" : e.previewState());
|
|
822
885
|
function f() {
|
|
823
886
|
l !== null && clearTimeout(l), l = null;
|
|
@@ -875,7 +938,7 @@ function Qe(e) {
|
|
|
875
938
|
}
|
|
876
939
|
//#endregion
|
|
877
940
|
//#region src/components/MediaCard.vue?vue&type=script&setup=true&lang.ts
|
|
878
|
-
var
|
|
941
|
+
var rt = [
|
|
879
942
|
"data-post-id",
|
|
880
943
|
"data-media-index",
|
|
881
944
|
"aria-hidden",
|
|
@@ -883,12 +946,12 @@ var $e = [
|
|
|
883
946
|
"inert",
|
|
884
947
|
"role",
|
|
885
948
|
"tabindex"
|
|
886
|
-
],
|
|
949
|
+
], it = { class: "media-card-content" }, at = ["data-media-direction"], ot = ["data-media-index"], st = {
|
|
887
950
|
key: 0,
|
|
888
951
|
"data-test": "media-loading",
|
|
889
952
|
class: "media-loading",
|
|
890
953
|
"aria-hidden": "true"
|
|
891
|
-
},
|
|
954
|
+
}, ct = [
|
|
892
955
|
"data-source-generation",
|
|
893
956
|
"src",
|
|
894
957
|
"width",
|
|
@@ -897,14 +960,14 @@ var $e = [
|
|
|
897
960
|
"loop",
|
|
898
961
|
"muted",
|
|
899
962
|
"preload"
|
|
900
|
-
],
|
|
963
|
+
], lt = [
|
|
901
964
|
"data-source-generation",
|
|
902
965
|
"src",
|
|
903
966
|
"width",
|
|
904
967
|
"height",
|
|
905
968
|
"fetchpriority",
|
|
906
969
|
"loading"
|
|
907
|
-
],
|
|
970
|
+
], ut = ["aria-label"], dt = ["aria-label"], ft = ["aria-label"], pt = 40, mt = 160, ht = 24, gt = /* @__PURE__ */ d({
|
|
908
971
|
__name: "MediaCard",
|
|
909
972
|
props: {
|
|
910
973
|
active: { type: Boolean },
|
|
@@ -925,6 +988,7 @@ var $e = [
|
|
|
925
988
|
mediaSource: {},
|
|
926
989
|
previewState: {},
|
|
927
990
|
reelControlsTarget: {},
|
|
991
|
+
reelAudioState: {},
|
|
928
992
|
stationaryReelControls: { type: Boolean },
|
|
929
993
|
total: {}
|
|
930
994
|
},
|
|
@@ -933,72 +997,80 @@ var $e = [
|
|
|
933
997
|
"ended",
|
|
934
998
|
"error",
|
|
935
999
|
"mediaChange",
|
|
936
|
-
"ready"
|
|
1000
|
+
"ready",
|
|
1001
|
+
"reelAudioChange"
|
|
937
1002
|
],
|
|
938
1003
|
setup(e, { emit: i }) {
|
|
939
1004
|
let l = e, d = null, f = 0, p = !1, m = null, g = null, y = w("next"), x = i;
|
|
940
1005
|
function S(e = !1, t = "pointer") {
|
|
941
1006
|
e && x("activate", t);
|
|
942
1007
|
}
|
|
943
|
-
let C = r(() => P(l.item)), T = r(() => F(l.item, l.mediaIndex)), D = r(() => I(l.item, T.value)), O = r(() => N(D.value, l.mediaSource ?? "preview")), M = r(() => O.value.src), L = r(() => O.value.type), R = r(() => O.value.width), z = r(() => O.value.height), { effectivePreviewState: B, failSourceAttempt: V, imageElement: ee, markSourceReady: H, noteSourceActivity: U, retrySource: W, retrying: G, sourceGeneration: K, videoElement: q } =
|
|
1008
|
+
let C = r(() => P(l.item)), T = r(() => F(l.item, l.mediaIndex)), D = r(() => I(l.item, T.value)), O = r(() => N(D.value, l.mediaSource ?? "preview")), M = r(() => O.value.src), L = r(() => O.value.type), R = r(() => O.value.width), z = r(() => O.value.height), { effectivePreviewState: B, failSourceAttempt: V, imageElement: ee, markSourceReady: H, noteSourceActivity: U, retrySource: W, retrying: G, sourceGeneration: K, videoElement: q } = nt({
|
|
944
1009
|
identity: () => `${l.item.postId}:${T.value}:${l.mediaSource ?? "preview"}:${M.value}:${L.value ?? ""}`,
|
|
945
1010
|
mediaIndex: () => T.value,
|
|
946
1011
|
onError: (e) => x("error", e),
|
|
947
1012
|
onReady: (e) => x("ready", e),
|
|
948
1013
|
previewState: () => l.previewState
|
|
949
|
-
}), te = w(0), J = w(0),
|
|
1014
|
+
}), te = w(0), J = w(0), Y = w(!1), { apply: ne, setVolume: re, sync: ie, toggleMute: ae, videoIsMuted: X, videoVolume: oe } = Xe({
|
|
1015
|
+
active: () => l.active,
|
|
1016
|
+
layout: () => l.layout,
|
|
1017
|
+
mediaCard: () => l.mediaCard,
|
|
1018
|
+
onChange: (e) => x("reelAudioChange", e),
|
|
1019
|
+
reelAudioState: () => l.reelAudioState,
|
|
1020
|
+
videoElement: q
|
|
1021
|
+
}), { effectiveMuted: se, onPlaying: ce, playbackAllowed: le } = Ze({
|
|
950
1022
|
active: () => l.active,
|
|
951
1023
|
layout: () => l.layout,
|
|
952
1024
|
videoElement: q,
|
|
953
|
-
videoIsMuted:
|
|
1025
|
+
videoIsMuted: X,
|
|
954
1026
|
videoIsPlaying: Y
|
|
955
|
-
}),
|
|
956
|
-
function
|
|
1027
|
+
}), Z = r(() => l.interactive && !!(l.cardHeader || l.cardFooter));
|
|
1028
|
+
function ue(e) {
|
|
957
1029
|
return e.detail === 0 ? "keyboard" : "pointer";
|
|
958
1030
|
}
|
|
959
|
-
function
|
|
1031
|
+
function Q(e, t) {
|
|
960
1032
|
let n = C.value.length, r = (e + n) % n;
|
|
961
1033
|
r !== T.value && (y.value = e < T.value ? "previous" : "next", x("mediaChange", r), t && t.detail > 0 && t.currentTarget?.blur());
|
|
962
1034
|
}
|
|
963
|
-
function
|
|
1035
|
+
function de(e, t, n) {
|
|
964
1036
|
return t === 1 ? e * 16 : t === 2 ? e * n : e;
|
|
965
1037
|
}
|
|
966
|
-
function
|
|
1038
|
+
function fe() {
|
|
967
1039
|
f = 0, p = !1, d !== null && clearTimeout(d), d = null;
|
|
968
1040
|
}
|
|
969
|
-
function
|
|
970
|
-
d !== null && clearTimeout(d), d = setTimeout(
|
|
1041
|
+
function pe() {
|
|
1042
|
+
d !== null && clearTimeout(d), d = setTimeout(fe, mt);
|
|
971
1043
|
}
|
|
972
|
-
function
|
|
1044
|
+
function me(e) {
|
|
973
1045
|
if (C.value.length <= 1) return;
|
|
974
|
-
let t = e.currentTarget?.clientWidth || 1, n =
|
|
975
|
-
if (n === 0 || (e.preventDefault(),
|
|
1046
|
+
let t = e.currentTarget?.clientWidth || 1, n = de(e.deltaX, e.deltaMode, t);
|
|
1047
|
+
if (n === 0 || (e.preventDefault(), pe(), p) || (f += n, Math.abs(f) < ht)) return;
|
|
976
1048
|
let r = Math.sign(f);
|
|
977
|
-
f = 0, p = !0,
|
|
1049
|
+
f = 0, p = !0, Q(T.value + r);
|
|
978
1050
|
}
|
|
979
|
-
function
|
|
1051
|
+
function he(e) {
|
|
980
1052
|
let t = e.touches[0];
|
|
981
1053
|
l.layout !== "reel" || !t || (m = t.clientX, g = t.clientY);
|
|
982
1054
|
}
|
|
983
|
-
function
|
|
1055
|
+
function ge(e) {
|
|
984
1056
|
let t = e.changedTouches[0];
|
|
985
1057
|
if (m === null || g === null || !t) return;
|
|
986
1058
|
let n = m - t.clientX, r = g - t.clientY;
|
|
987
|
-
m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) <
|
|
1059
|
+
m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) < pt || Q(T.value + Math.sign(n)));
|
|
988
1060
|
}
|
|
989
|
-
let { imageLoading:
|
|
1061
|
+
let { imageLoading: _e, mediaIsTimed: ve, videoPreload: ye } = tt({
|
|
990
1062
|
active: () => l.active,
|
|
991
1063
|
fetchPriority: () => l.fetchPriority,
|
|
992
1064
|
layout: () => l.layout,
|
|
993
1065
|
mediaSource: () => M.value,
|
|
994
1066
|
mediaType: () => L.value,
|
|
995
1067
|
videoElement: q
|
|
996
|
-
}),
|
|
997
|
-
function
|
|
998
|
-
l.layout === "reel" && (e.stopPropagation(),
|
|
1068
|
+
}), be = r(() => l.layout === "reel" && l.stationaryReelControls === !0), xe = r(() => ve.value && B.value === "ready" && (!be.value || !!(l.active && l.reelControlsTarget))), Se = r(() => `${l.item.postId}:${T.value}:${M.value}`);
|
|
1069
|
+
function Ce(e) {
|
|
1070
|
+
l.layout === "reel" && (e.stopPropagation(), we());
|
|
999
1071
|
}
|
|
1000
|
-
async function
|
|
1001
|
-
if (!(!q.value || !
|
|
1072
|
+
async function we() {
|
|
1073
|
+
if (!(!q.value || !le.value)) {
|
|
1002
1074
|
if (Y.value) {
|
|
1003
1075
|
q.value.pause();
|
|
1004
1076
|
return;
|
|
@@ -1010,35 +1082,25 @@ var $e = [
|
|
|
1010
1082
|
}
|
|
1011
1083
|
}
|
|
1012
1084
|
}
|
|
1013
|
-
function
|
|
1085
|
+
function De(e) {
|
|
1014
1086
|
return Number.isFinite(e) ? Math.max(0, e) : 0;
|
|
1015
1087
|
}
|
|
1016
|
-
function
|
|
1088
|
+
function Oe(e) {
|
|
1017
1089
|
let t = e?.currentTarget ?? q.value;
|
|
1018
|
-
t && (te.value =
|
|
1090
|
+
t && (te.value = De(t.currentTime), J.value = De(t.duration), ie(t, le.value));
|
|
1019
1091
|
}
|
|
1020
|
-
function
|
|
1021
|
-
|
|
1092
|
+
function ke(e) {
|
|
1093
|
+
ne(), Oe(e), H(e);
|
|
1022
1094
|
}
|
|
1023
|
-
function
|
|
1095
|
+
function Ae() {
|
|
1024
1096
|
Y.value = !1, x("ended", T.value);
|
|
1025
1097
|
}
|
|
1026
|
-
function
|
|
1027
|
-
let t = q.value;
|
|
1028
|
-
!t || !Number.isFinite(e) || (t.currentTime = Math.min(Se(t.duration), Math.max(0, e)), te.value = t.currentTime);
|
|
1029
|
-
}
|
|
1030
|
-
function ke(e) {
|
|
1098
|
+
function je(e) {
|
|
1031
1099
|
let t = q.value;
|
|
1032
|
-
|
|
1033
|
-
let n = Math.min(1, Math.max(0, e));
|
|
1034
|
-
t.volume = n, t.muted = n === 0, n > 0 && (ie = n), Ce();
|
|
1035
|
-
}
|
|
1036
|
-
function Ae() {
|
|
1037
|
-
let e = q.value;
|
|
1038
|
-
e && (e.muted && e.volume === 0 && (e.volume = ie), e.muted = !e.muted, Ce());
|
|
1100
|
+
!t || !Number.isFinite(e) || (t.currentTime = Math.min(De(t.duration), Math.max(0, e)), te.value = t.currentTime);
|
|
1039
1101
|
}
|
|
1040
1102
|
return v(() => {
|
|
1041
|
-
|
|
1103
|
+
fe();
|
|
1042
1104
|
}), (r, i) => (b(), s("article", {
|
|
1043
1105
|
"data-post-id": e.item.postId,
|
|
1044
1106
|
"data-media-index": T.value,
|
|
@@ -1052,11 +1114,11 @@ var $e = [
|
|
|
1052
1114
|
"aria-hidden": e.leaving || void 0,
|
|
1053
1115
|
"aria-busy": E(B) === "loading" || E(G),
|
|
1054
1116
|
inert: e.leaving || void 0,
|
|
1055
|
-
role: e.interactive && !e.leaving && !
|
|
1056
|
-
tabindex: e.interactive && !e.leaving && !
|
|
1057
|
-
onClick: i[14] ||= (t) => S(e.interactive && !
|
|
1058
|
-
onKeydown: [i[15] ||= A((t) => S(e.interactive && !
|
|
1059
|
-
}, [c("div",
|
|
1117
|
+
role: e.interactive && !e.leaving && !Z.value ? "button" : void 0,
|
|
1118
|
+
tabindex: e.interactive && !e.leaving && !Z.value ? 0 : void 0,
|
|
1119
|
+
onClick: i[14] ||= (t) => S(e.interactive && !Z.value, ue(t)),
|
|
1120
|
+
onKeydown: [i[15] ||= A((t) => S(e.interactive && !Z.value, "keyboard"), ["enter"]), i[16] ||= A(j((t) => S(e.interactive && !Z.value, "keyboard"), ["prevent"]), ["space"])]
|
|
1121
|
+
}, [c("div", it, [
|
|
1060
1122
|
e.cardHeader ? (b(), a(Pe, {
|
|
1061
1123
|
key: 0,
|
|
1062
1124
|
index: e.index,
|
|
@@ -1083,9 +1145,9 @@ var $e = [
|
|
|
1083
1145
|
c("div", {
|
|
1084
1146
|
class: h(["media-card-media", { "media-card-media--carousel": e.layout === "reel" && C.value.length > 1 }]),
|
|
1085
1147
|
"data-media-direction": y.value,
|
|
1086
|
-
onWheel:
|
|
1087
|
-
onTouchstartPassive:
|
|
1088
|
-
onTouchendPassive:
|
|
1148
|
+
onWheel: me,
|
|
1149
|
+
onTouchstartPassive: he,
|
|
1150
|
+
onTouchendPassive: ge
|
|
1089
1151
|
}, [
|
|
1090
1152
|
u(n, {
|
|
1091
1153
|
css: !E(G),
|
|
@@ -1095,7 +1157,7 @@ var $e = [
|
|
|
1095
1157
|
key: `${e.item.postId}:${D.value.src}:${e.mediaSource ?? "preview"}:${E(K)}`,
|
|
1096
1158
|
class: "media-card-frame",
|
|
1097
1159
|
"data-media-index": T.value
|
|
1098
|
-
}, [E(B) === "loading" ? (b(), s("div",
|
|
1160
|
+
}, [E(B) === "loading" ? (b(), s("div", st, [...i[17] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : E(B) === "error" ? (b(), a(Re, {
|
|
1099
1161
|
key: 1,
|
|
1100
1162
|
component: e.mediaCard?.error?.component,
|
|
1101
1163
|
label: E(Ne)(M.value),
|
|
@@ -1108,7 +1170,7 @@ var $e = [
|
|
|
1108
1170
|
"retrying",
|
|
1109
1171
|
"status",
|
|
1110
1172
|
"onRetry"
|
|
1111
|
-
])) : o("", !0), E(
|
|
1173
|
+
])) : o("", !0), E(ve) ? (b(), s("video", {
|
|
1112
1174
|
key: 2,
|
|
1113
1175
|
ref_key: "videoElement",
|
|
1114
1176
|
ref: q,
|
|
@@ -1120,24 +1182,24 @@ var $e = [
|
|
|
1120
1182
|
src: M.value,
|
|
1121
1183
|
width: R.value ?? void 0,
|
|
1122
1184
|
height: z.value ?? void 0,
|
|
1123
|
-
autoplay: E(
|
|
1185
|
+
autoplay: E(le),
|
|
1124
1186
|
loop: !e.advanceOnMediaEnd,
|
|
1125
|
-
muted: E(
|
|
1187
|
+
muted: E(se),
|
|
1126
1188
|
playsinline: "",
|
|
1127
|
-
preload: E(
|
|
1128
|
-
onLoadedmetadata:
|
|
1189
|
+
preload: E(ye),
|
|
1190
|
+
onLoadedmetadata: ke,
|
|
1129
1191
|
onProgress: i[0] ||= (...e) => E(U) && E(U)(...e),
|
|
1130
1192
|
onLoadeddata: i[1] ||= (...e) => E(U) && E(U)(...e),
|
|
1131
1193
|
onCanplay: i[2] ||= (...e) => E(U) && E(U)(...e),
|
|
1132
|
-
onDurationchange:
|
|
1133
|
-
onTimeupdate:
|
|
1134
|
-
onVolumechange:
|
|
1135
|
-
onPlaying: i[3] ||= (...e) => E(
|
|
1194
|
+
onDurationchange: Oe,
|
|
1195
|
+
onTimeupdate: Oe,
|
|
1196
|
+
onVolumechange: Oe,
|
|
1197
|
+
onPlaying: i[3] ||= (...e) => E(ce) && E(ce)(...e),
|
|
1136
1198
|
onPause: i[4] ||= (e) => Y.value = !1,
|
|
1137
|
-
onEnded:
|
|
1138
|
-
onClick:
|
|
1199
|
+
onEnded: Ae,
|
|
1200
|
+
onClick: Ce,
|
|
1139
1201
|
onError: i[5] ||= (...e) => E(V) && E(V)(...e)
|
|
1140
|
-
}, null, 42,
|
|
1202
|
+
}, null, 42, ct)) : (b(), s("img", {
|
|
1141
1203
|
key: 3,
|
|
1142
1204
|
ref_key: "imageElement",
|
|
1143
1205
|
ref: ee,
|
|
@@ -1149,32 +1211,32 @@ var $e = [
|
|
|
1149
1211
|
fetchpriority: e.fetchPriority,
|
|
1150
1212
|
alt: "",
|
|
1151
1213
|
decoding: "async",
|
|
1152
|
-
loading: E(
|
|
1214
|
+
loading: E(_e),
|
|
1153
1215
|
onLoad: i[6] ||= (...e) => E(H) && E(H)(...e),
|
|
1154
1216
|
onError: i[7] ||= (...e) => E(V) && E(V)(...e)
|
|
1155
|
-
}, null, 42,
|
|
1217
|
+
}, null, 42, lt))], 8, ot))]),
|
|
1156
1218
|
_: 1
|
|
1157
1219
|
}, 8, ["css", "name"]),
|
|
1158
1220
|
(b(), a(t, {
|
|
1159
|
-
disabled: !
|
|
1221
|
+
disabled: !be.value || !e.reelControlsTarget,
|
|
1160
1222
|
to: e.reelControlsTarget ?? "body"
|
|
1161
1223
|
}, [u(n, {
|
|
1162
1224
|
name: "vibe-reel-media-controls",
|
|
1163
|
-
css:
|
|
1225
|
+
css: be.value
|
|
1164
1226
|
}, {
|
|
1165
|
-
default: k(() => [
|
|
1166
|
-
key:
|
|
1227
|
+
default: k(() => [xe.value ? (b(), a(Ke, {
|
|
1228
|
+
key: Se.value,
|
|
1167
1229
|
"current-time": te.value,
|
|
1168
|
-
"data-control-post-id":
|
|
1230
|
+
"data-control-post-id": be.value ? e.item.postId : void 0,
|
|
1169
1231
|
duration: J.value,
|
|
1170
1232
|
layout: e.layout,
|
|
1171
|
-
muted:
|
|
1233
|
+
muted: E(X),
|
|
1172
1234
|
playing: Y.value,
|
|
1173
|
-
volume:
|
|
1174
|
-
onSeek:
|
|
1175
|
-
onToggleMute:
|
|
1176
|
-
onTogglePlayback:
|
|
1177
|
-
onVolumeChange:
|
|
1235
|
+
volume: E(oe),
|
|
1236
|
+
onSeek: je,
|
|
1237
|
+
onToggleMute: E(ae),
|
|
1238
|
+
onTogglePlayback: we,
|
|
1239
|
+
onVolumeChange: E(re)
|
|
1178
1240
|
}, null, 8, [
|
|
1179
1241
|
"current-time",
|
|
1180
1242
|
"data-control-post-id",
|
|
@@ -1182,7 +1244,9 @@ var $e = [
|
|
|
1182
1244
|
"layout",
|
|
1183
1245
|
"muted",
|
|
1184
1246
|
"playing",
|
|
1185
|
-
"volume"
|
|
1247
|
+
"volume",
|
|
1248
|
+
"onToggleMute",
|
|
1249
|
+
"onVolumeChange"
|
|
1186
1250
|
])) : o("", !0)]),
|
|
1187
1251
|
_: 1
|
|
1188
1252
|
}, 8, ["css"])], 8, ["disabled", "to"])),
|
|
@@ -1194,24 +1258,24 @@ var $e = [
|
|
|
1194
1258
|
type: "button",
|
|
1195
1259
|
class: "media-carousel-control media-carousel-control--previous",
|
|
1196
1260
|
"aria-label": `Previous media for post ${e.item.postId}`,
|
|
1197
|
-
onClick: i[8] ||= j((e) =>
|
|
1261
|
+
onClick: i[8] ||= j((e) => Q(T.value - 1, e), ["stop"]),
|
|
1198
1262
|
onKeydown: i[9] ||= j(() => {}, ["stop"])
|
|
1199
|
-
}, [u(E(Te), { size: 20 })], 40,
|
|
1263
|
+
}, [u(E(Te), { size: 20 })], 40, ut), c("button", {
|
|
1200
1264
|
type: "button",
|
|
1201
1265
|
class: "media-carousel-control media-carousel-control--next",
|
|
1202
1266
|
"aria-label": `Next media for post ${e.item.postId}`,
|
|
1203
|
-
onClick: i[10] ||= j((e) =>
|
|
1267
|
+
onClick: i[10] ||= j((e) => Q(T.value + 1, e), ["stop"]),
|
|
1204
1268
|
onKeydown: i[11] ||= j(() => {}, ["stop"])
|
|
1205
|
-
}, [u(E(Ee), { size: 20 })], 40,
|
|
1206
|
-
|
|
1269
|
+
}, [u(E(Ee), { size: 20 })], 40, dt)], 2)) : o("", !0),
|
|
1270
|
+
Z.value ? (b(), s("button", {
|
|
1207
1271
|
key: 1,
|
|
1208
1272
|
class: "media-card-activator",
|
|
1209
1273
|
type: "button",
|
|
1210
1274
|
"aria-label": `Open post ${e.item.postId}`,
|
|
1211
|
-
onClick: i[12] ||= j((e) => r.$emit("activate",
|
|
1275
|
+
onClick: i[12] ||= j((e) => r.$emit("activate", ue(e)), ["stop"]),
|
|
1212
1276
|
onKeydown: i[13] ||= j(() => {}, ["stop"])
|
|
1213
|
-
}, null, 40,
|
|
1214
|
-
], 42,
|
|
1277
|
+
}, null, 40, ft)) : o("", !0)
|
|
1278
|
+
], 42, at),
|
|
1215
1279
|
e.cardFooter ? (b(), a(Pe, {
|
|
1216
1280
|
key: 1,
|
|
1217
1281
|
index: e.index,
|
|
@@ -1235,12 +1299,12 @@ var $e = [
|
|
|
1235
1299
|
"style",
|
|
1236
1300
|
"total"
|
|
1237
1301
|
])) : o("", !0)
|
|
1238
|
-
])], 46,
|
|
1302
|
+
])], 46, rt));
|
|
1239
1303
|
}
|
|
1240
|
-
}),
|
|
1304
|
+
}), _t = { class: "masonry-feed-shell" }, vt = ["aria-hidden", "inert"], yt = {
|
|
1241
1305
|
key: 0,
|
|
1242
1306
|
class: "masonry-feed-status-overlay"
|
|
1243
|
-
},
|
|
1307
|
+
}, bt = 6, xt = 12, St = 250, Ct = /* @__PURE__ */ d({
|
|
1244
1308
|
__name: "MasonryFeed",
|
|
1245
1309
|
props: {
|
|
1246
1310
|
enteringPostIds: {},
|
|
@@ -1263,6 +1327,7 @@ var $e = [
|
|
|
1263
1327
|
mediaIndices: {},
|
|
1264
1328
|
nextPageError: { type: Boolean },
|
|
1265
1329
|
previewStates: {},
|
|
1330
|
+
reelAudioState: {},
|
|
1266
1331
|
state: {},
|
|
1267
1332
|
total: {}
|
|
1268
1333
|
},
|
|
@@ -1276,10 +1341,10 @@ var $e = [
|
|
|
1276
1341
|
"visible"
|
|
1277
1342
|
],
|
|
1278
1343
|
setup(t, { expose: n, emit: i }) {
|
|
1279
|
-
let l = 0, d = t, f = i, p = w(null), m = `vibe-masonry-${D()}`, g = w(null), y = w(0), x = w(
|
|
1344
|
+
let l = 0, d = t, f = i, p = w(null), m = `vibe-masonry-${D()}`, g = w(null), y = w(0), x = w(bt), C = w(0), T = w(0), k = w(0), A = w([]), j = w([]), M = 0, N = null, P = null, F = null, I = null, R = r(() => ie(d.items, y.value, {
|
|
1280
1345
|
additionalHeight: (d.cardHeader?.height ?? 0) + (d.cardFooter?.height ?? 0),
|
|
1281
1346
|
gap: x.value,
|
|
1282
|
-
minColumnWidth:
|
|
1347
|
+
minColumnWidth: se(d.masonry)
|
|
1283
1348
|
})), z = r(() => {
|
|
1284
1349
|
if (d.leavingPostIds.size === 0) return null;
|
|
1285
1350
|
let e = d.items.flatMap((e, t) => d.leavingPostIds.has(e.postId) ? [] : [{
|
|
@@ -1288,7 +1353,7 @@ var $e = [
|
|
|
1288
1353
|
}]), t = ie(e.map(({ item: e }) => e), y.value, {
|
|
1289
1354
|
additionalHeight: (d.cardHeader?.height ?? 0) + (d.cardFooter?.height ?? 0),
|
|
1290
1355
|
gap: x.value,
|
|
1291
|
-
minColumnWidth:
|
|
1356
|
+
minColumnWidth: se(d.masonry)
|
|
1292
1357
|
});
|
|
1293
1358
|
return {
|
|
1294
1359
|
indices: e.map(({ index: e }) => e),
|
|
@@ -1315,27 +1380,27 @@ var $e = [
|
|
|
1315
1380
|
function te(e, t) {
|
|
1316
1381
|
return [...new Set([...e, ...t])].sort((e, t) => e - t);
|
|
1317
1382
|
}
|
|
1318
|
-
function
|
|
1383
|
+
function Y(e, t) {
|
|
1319
1384
|
return e.length === t.length && e.every((e, n) => e === t[n]);
|
|
1320
1385
|
}
|
|
1321
|
-
function
|
|
1386
|
+
function ne(e) {
|
|
1322
1387
|
let t = {
|
|
1323
1388
|
scrollTop: M - k.value,
|
|
1324
1389
|
viewportHeight: C.value
|
|
1325
|
-
}, n = ee.value, r =
|
|
1390
|
+
}, n = ee.value, r = oe(n ?? V.value, {
|
|
1326
1391
|
...t,
|
|
1327
1392
|
overscan: e
|
|
1328
1393
|
}).indices;
|
|
1329
|
-
return te(r, d.leavingPostIds.size === 0 ? [] :
|
|
1394
|
+
return te(r, d.leavingPostIds.size === 0 ? [] : oe(V.value, {
|
|
1330
1395
|
...t,
|
|
1331
1396
|
overscan: e
|
|
1332
1397
|
}).indices);
|
|
1333
1398
|
}
|
|
1334
1399
|
function X() {
|
|
1335
|
-
let e =
|
|
1336
|
-
|
|
1400
|
+
let e = ne(0), t = ne(ce(d.masonry, C.value));
|
|
1401
|
+
Y(A.value, e) || (A.value = e), Y(j.value, t) || (j.value = t);
|
|
1337
1402
|
}
|
|
1338
|
-
function
|
|
1403
|
+
function le() {
|
|
1339
1404
|
if (I !== null) return;
|
|
1340
1405
|
I = -1;
|
|
1341
1406
|
let e = requestAnimationFrame(() => {
|
|
@@ -1343,7 +1408,7 @@ var $e = [
|
|
|
1343
1408
|
});
|
|
1344
1409
|
I !== null && (I = e);
|
|
1345
1410
|
}
|
|
1346
|
-
let
|
|
1411
|
+
let Z = /* @__PURE__ */ new Set();
|
|
1347
1412
|
O(() => [...K.value].flatMap((e) => {
|
|
1348
1413
|
let t = d.items[e];
|
|
1349
1414
|
if (!t) return [];
|
|
@@ -1356,13 +1421,13 @@ var $e = [
|
|
|
1356
1421
|
}), (e) => {
|
|
1357
1422
|
let t = new Set(e.map(({ key: e }) => e));
|
|
1358
1423
|
e.forEach(({ key: e, mediaIndex: t, postId: n }) => {
|
|
1359
|
-
|
|
1360
|
-
}),
|
|
1424
|
+
Z.has(e) || f("visible", n, t);
|
|
1425
|
+
}), Z = t;
|
|
1361
1426
|
}, {
|
|
1362
1427
|
immediate: !0,
|
|
1363
1428
|
flush: "post"
|
|
1364
1429
|
});
|
|
1365
|
-
function
|
|
1430
|
+
function ue(e) {
|
|
1366
1431
|
let t = B.value.items[e], n = d.items[e]?.postId;
|
|
1367
1432
|
if (!t) return {};
|
|
1368
1433
|
let r = n !== void 0 && d.enteringPostIds.has(n), i = n !== void 0 && d.leavingPostIds.has(n), a = r || i ? re({
|
|
@@ -1376,7 +1441,7 @@ var $e = [
|
|
|
1376
1441
|
transform: `translate3d(${t.x}px, ${t.y + a}px, 0)`
|
|
1377
1442
|
};
|
|
1378
1443
|
}
|
|
1379
|
-
function
|
|
1444
|
+
function Q() {
|
|
1380
1445
|
let e = p.value;
|
|
1381
1446
|
if (!e) return;
|
|
1382
1447
|
M = e.scrollTop, C.value = e.clientHeight;
|
|
@@ -1387,18 +1452,18 @@ var $e = [
|
|
|
1387
1452
|
}
|
|
1388
1453
|
function de(e) {
|
|
1389
1454
|
let t = e.ownerDocument.documentElement.clientWidth;
|
|
1390
|
-
y.value = e.clientWidth, x.value = Math.min(
|
|
1455
|
+
y.value = e.clientWidth, x.value = Math.min(xt, Math.max(bt, t * .0075)), Q();
|
|
1391
1456
|
}
|
|
1392
1457
|
function fe(e) {
|
|
1393
1458
|
let t = e.currentTarget;
|
|
1394
|
-
t && (M = t.scrollTop,
|
|
1459
|
+
t && (M = t.scrollTop, le(), Date.now() >= l && !d.loadMoreLocked && d.infiniteScroll && J(t) && f("loadMore"));
|
|
1395
1460
|
}
|
|
1396
1461
|
function pe() {
|
|
1397
1462
|
let e = p.value;
|
|
1398
1463
|
Date.now() >= l && !d.loadMoreLocked && e && J(e) && f("loadMore");
|
|
1399
1464
|
}
|
|
1400
1465
|
O(() => d.items.length, (e, t) => {
|
|
1401
|
-
e > 0 && e < t && (l = Date.now() +
|
|
1466
|
+
e > 0 && e < t && (l = Date.now() + St);
|
|
1402
1467
|
});
|
|
1403
1468
|
function me() {
|
|
1404
1469
|
return p.value;
|
|
@@ -1411,7 +1476,7 @@ var $e = [
|
|
|
1411
1476
|
}));
|
|
1412
1477
|
}), N.observe(e)));
|
|
1413
1478
|
}), O(p, (e) => {
|
|
1414
|
-
P?.disconnect(), P = null, e && (
|
|
1479
|
+
P?.disconnect(), P = null, e && (Q(), !(typeof ResizeObserver > "u") && (P = new ResizeObserver(Q), P.observe(e)));
|
|
1415
1480
|
}), O([
|
|
1416
1481
|
R,
|
|
1417
1482
|
B,
|
|
@@ -1421,7 +1486,7 @@ var $e = [
|
|
|
1421
1486
|
}), n({
|
|
1422
1487
|
getScrollElement: me,
|
|
1423
1488
|
loadIfNearBottom: pe
|
|
1424
|
-
}), (n, r) => (b(), s("div",
|
|
1489
|
+
}), (n, r) => (b(), s("div", _t, [
|
|
1425
1490
|
c("main", {
|
|
1426
1491
|
id: m,
|
|
1427
1492
|
ref_key: "galleryElement",
|
|
@@ -1437,7 +1502,7 @@ var $e = [
|
|
|
1437
1502
|
class: h(["masonry", { "masonry--ready": y.value > 0 }]),
|
|
1438
1503
|
style: _(U.value),
|
|
1439
1504
|
"aria-label": "Media gallery"
|
|
1440
|
-
}, [(b(!0), s(e, null, S(q.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(
|
|
1505
|
+
}, [(b(!0), s(e, null, S(q.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(gt, {
|
|
1441
1506
|
key: n.postId,
|
|
1442
1507
|
class: "masonry-item",
|
|
1443
1508
|
entering: t.enteringPostIds.has(n.postId),
|
|
@@ -1448,7 +1513,7 @@ var $e = [
|
|
|
1448
1513
|
"media-card": t.mediaCard,
|
|
1449
1514
|
index: r,
|
|
1450
1515
|
item: n,
|
|
1451
|
-
"item-style":
|
|
1516
|
+
"item-style": ue(r),
|
|
1452
1517
|
interactive: "",
|
|
1453
1518
|
layout: "masonry",
|
|
1454
1519
|
"loaded-count": t.items.length,
|
|
@@ -1477,8 +1542,8 @@ var $e = [
|
|
|
1477
1542
|
"onMediaChange",
|
|
1478
1543
|
"onReady",
|
|
1479
1544
|
"onError"
|
|
1480
|
-
]))), 128))], 6)], 42,
|
|
1481
|
-
t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && W.value || !t.hasNext && t.canRetryEnd ? (b(), s("div",
|
|
1545
|
+
]))), 128))], 6)], 42, vt),
|
|
1546
|
+
t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && W.value || !t.hasNext && t.canRetryEnd ? (b(), s("div", yt, [u(G, {
|
|
1482
1547
|
actions: t.feedFooterActions,
|
|
1483
1548
|
"can-retry-end": t.canRetryEnd,
|
|
1484
1549
|
"feed-footer": t.feedFooter,
|
|
@@ -1513,8 +1578,8 @@ var $e = [
|
|
|
1513
1578
|
])
|
|
1514
1579
|
]));
|
|
1515
1580
|
}
|
|
1516
|
-
}),
|
|
1517
|
-
function
|
|
1581
|
+
}), wt = 300;
|
|
1582
|
+
function Tt(e, t, n) {
|
|
1518
1583
|
let r = e.scrollTop;
|
|
1519
1584
|
if (n || Math.abs(r - t) <= 1) return e.scrollTop = t, Promise.resolve();
|
|
1520
1585
|
e.setAttribute("data-transitioning", "");
|
|
@@ -1522,7 +1587,7 @@ function xt(e, t, n) {
|
|
|
1522
1587
|
return new Promise((n) => {
|
|
1523
1588
|
let o = (s) => {
|
|
1524
1589
|
a += 1;
|
|
1525
|
-
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c /
|
|
1590
|
+
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / wt), u = 1 - (1 - l) ** 3;
|
|
1526
1591
|
if (e.scrollTop = r + (t - r) * u, l < 1) {
|
|
1527
1592
|
requestAnimationFrame(o);
|
|
1528
1593
|
return;
|
|
@@ -1534,7 +1599,7 @@ function xt(e, t, n) {
|
|
|
1534
1599
|
}
|
|
1535
1600
|
//#endregion
|
|
1536
1601
|
//#region src/components/ReelAutoAdvanceProgress.vue?vue&type=script&setup=true&lang.ts
|
|
1537
|
-
var
|
|
1602
|
+
var Et = ["aria-label"], Dt = /* @__PURE__ */ d({
|
|
1538
1603
|
__name: "ReelAutoAdvanceProgress",
|
|
1539
1604
|
props: {
|
|
1540
1605
|
durationMs: {},
|
|
@@ -1552,9 +1617,9 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
1552
1617
|
class: "reel-auto-advance-progress",
|
|
1553
1618
|
style: _(a.value),
|
|
1554
1619
|
onAnimationend: n[0] ||= (e) => i("complete")
|
|
1555
|
-
}, null, 36)], 8,
|
|
1620
|
+
}, null, 36)], 8, Et));
|
|
1556
1621
|
}
|
|
1557
|
-
}),
|
|
1622
|
+
}), Ot = { class: "reel-viewport" }, kt = ["data-active-post-id", "data-active-media-index"], At = ["role", "data-status"], jt = 300, Mt = 250, Nt = /* @__PURE__ */ d({
|
|
1558
1623
|
__name: "ReelFeed",
|
|
1559
1624
|
props: {
|
|
1560
1625
|
initialPostId: {},
|
|
@@ -1578,6 +1643,7 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
1578
1643
|
mediaIndices: {},
|
|
1579
1644
|
nextPageError: { type: Boolean },
|
|
1580
1645
|
previewStates: {},
|
|
1646
|
+
reelAudioState: {},
|
|
1581
1647
|
state: {},
|
|
1582
1648
|
total: {}
|
|
1583
1649
|
},
|
|
@@ -1587,12 +1653,13 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
1587
1653
|
"loadMore",
|
|
1588
1654
|
"mediaChange",
|
|
1589
1655
|
"ready",
|
|
1656
|
+
"reelAudioChange",
|
|
1590
1657
|
"retryEnd",
|
|
1591
1658
|
"retryForward"
|
|
1592
1659
|
],
|
|
1593
1660
|
setup(t, { expose: n, emit: i }) {
|
|
1594
1661
|
let l = 0, u = t, d = i, f = w(null), p = w(null), g = u.initialPostId === null || u.initialPostId === void 0 ? -1 : u.items.findIndex((e) => e.postId === u.initialPostId), x = w(Math.max(0, g)), C = w(!1), D = w(!1), k = 0, A = null, j = null, M = null, F = r(() => ({ gridTemplateRows: `repeat(${u.items.length}, 100cqh)` })), R = r(() => {
|
|
1595
|
-
let e = Math.max(0, x.value -
|
|
1662
|
+
let e = Math.max(0, x.value - 2), t = Math.min(u.items.length - 1, x.value + 2);
|
|
1596
1663
|
return u.items.slice(e, t + 1).map((t, n) => ({
|
|
1597
1664
|
fetchPriority: e + n === x.value ? "high" : "low",
|
|
1598
1665
|
index: e + n,
|
|
@@ -1604,7 +1671,7 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
1604
1671
|
}), ee = r(() => {
|
|
1605
1672
|
let e = z.value;
|
|
1606
1673
|
return e === void 0 ? "loading" : u.previewStates.get(L(e, V.value)) ?? "loading";
|
|
1607
|
-
}), H = r(() => B.value ? I(B.value, V.value) : null), U = r(() => H.value ? N(H.value, u.mediaSource ?? "preview") : null), W = r(() => ee.value === "ready" && !!(U.value &&
|
|
1674
|
+
}), H = r(() => B.value ? I(B.value, V.value) : null), U = r(() => H.value ? N(H.value, u.mediaSource ?? "preview") : null), W = r(() => ee.value === "ready" && !!(U.value && et(U.value.type, U.value.src))), K = r(() => [
|
|
1608
1675
|
z.value,
|
|
1609
1676
|
V.value,
|
|
1610
1677
|
u.items.length,
|
|
@@ -1615,7 +1682,7 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
1615
1682
|
].join(":")), q = r(() => {
|
|
1616
1683
|
let e = B.value, t = !!(e && u.reelAutoAdvance.includePostItems && V.value < P(e).length - 1), n = u.reelAutoAdvance.intervalMs / 1e3;
|
|
1617
1684
|
return `Auto advance to the next ${t ? "post item" : "post"} in ${n}s`;
|
|
1618
|
-
}), te = r(() => u.reelAutoAdvance.enabled && u.reelForward.status === "idle" && B.value !== void 0 && ee.value !== "loading" && !W.value),
|
|
1685
|
+
}), te = r(() => u.reelAutoAdvance.enabled && u.reelForward.status === "idle" && B.value !== void 0 && ee.value !== "loading" && !W.value), Y = r(() => !u.infiniteScroll || u.items.length <= 1), ne = r(() => u.reelForward.status === "loading" ? "Loading the next media…" : u.reelForward.status === "error" ? "Unable to load the next media." : "You reached the end of this feed.");
|
|
1619
1686
|
function re(e) {
|
|
1620
1687
|
return { gridRow: `${e + 1}` };
|
|
1621
1688
|
}
|
|
@@ -1631,33 +1698,33 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
1631
1698
|
}
|
|
1632
1699
|
function X() {
|
|
1633
1700
|
let e = f.value;
|
|
1634
|
-
e && (C.value = !1,
|
|
1701
|
+
e && (C.value = !1, ce(!0), k = e.clientHeight, e.scrollTop = x.value * k, j !== null && cancelAnimationFrame(j), j = requestAnimationFrame(() => {
|
|
1635
1702
|
e.scrollTop = x.value * e.clientHeight, k = e.clientHeight, j = null;
|
|
1636
|
-
}),
|
|
1703
|
+
}), oe());
|
|
1637
1704
|
}
|
|
1638
|
-
function
|
|
1705
|
+
function oe() {
|
|
1639
1706
|
M !== null && clearTimeout(M), M = setTimeout(() => {
|
|
1640
1707
|
M = null;
|
|
1641
1708
|
let e = f.value;
|
|
1642
|
-
e && (k = e.clientHeight, e.scrollTop = x.value * k),
|
|
1709
|
+
e && (k = e.clientHeight, e.scrollTop = x.value * k), ce(!1);
|
|
1643
1710
|
}, 120);
|
|
1644
1711
|
}
|
|
1645
|
-
function
|
|
1646
|
-
|
|
1712
|
+
function se() {
|
|
1713
|
+
ce(!0);
|
|
1647
1714
|
let e = f.value;
|
|
1648
|
-
e && (k = e.clientHeight, e.scrollTop = x.value * k),
|
|
1715
|
+
e && (k = e.clientHeight, e.scrollTop = x.value * k), oe();
|
|
1649
1716
|
}
|
|
1650
|
-
function
|
|
1717
|
+
function ce(e) {
|
|
1651
1718
|
D.value = e, f.value?.toggleAttribute("data-resizing", e);
|
|
1652
1719
|
}
|
|
1653
|
-
function
|
|
1720
|
+
function le() {
|
|
1654
1721
|
let e = f.value;
|
|
1655
1722
|
Date.now() >= l && !u.loadMoreLocked && e && J(e) && d("loadMore");
|
|
1656
1723
|
}
|
|
1657
1724
|
O(() => u.items.length, (e, t) => {
|
|
1658
|
-
e > 0 && e < t && (l = Date.now() +
|
|
1725
|
+
e > 0 && e < t && (l = Date.now() + Mt);
|
|
1659
1726
|
});
|
|
1660
|
-
function
|
|
1727
|
+
function Z(e) {
|
|
1661
1728
|
let t = B.value;
|
|
1662
1729
|
if (!t) return !1;
|
|
1663
1730
|
let n = P(t).length;
|
|
@@ -1665,11 +1732,11 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
1665
1732
|
let r = (V.value + e + n) % n;
|
|
1666
1733
|
return d("mediaChange", t.postId, r), !0;
|
|
1667
1734
|
}
|
|
1668
|
-
function
|
|
1735
|
+
function ue(e) {
|
|
1669
1736
|
let t = x.value + e;
|
|
1670
1737
|
return !f.value || t < 0 || t >= u.items.length ? !1 : (pe(t), !0);
|
|
1671
1738
|
}
|
|
1672
|
-
function
|
|
1739
|
+
function Q(e, t) {
|
|
1673
1740
|
let n = u.items.findIndex((t) => t.postId === e), r = u.items[n];
|
|
1674
1741
|
return !f.value || !r || t < 0 || t > r.items.length ? !1 : ((u.mediaIndices.get(e) ?? 0) !== t && d("mediaChange", e, t), n !== x.value && pe(n), !0);
|
|
1675
1742
|
}
|
|
@@ -1680,7 +1747,7 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
1680
1747
|
let t = f.value;
|
|
1681
1748
|
if (!t) return Promise.resolve();
|
|
1682
1749
|
let n = e * (k || t.clientHeight);
|
|
1683
|
-
return x.value = e,
|
|
1750
|
+
return x.value = e, Tt(t, n, de());
|
|
1684
1751
|
}
|
|
1685
1752
|
function pe(e) {
|
|
1686
1753
|
fe(e);
|
|
@@ -1690,7 +1757,7 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
1690
1757
|
return t < 0 || t === x.value ? !1 : (await fe(t), !0);
|
|
1691
1758
|
}
|
|
1692
1759
|
async function he(e) {
|
|
1693
|
-
return
|
|
1760
|
+
return Z(e) ? (de() || await new Promise((e) => setTimeout(e, jt)), !0) : !1;
|
|
1694
1761
|
}
|
|
1695
1762
|
function ge() {
|
|
1696
1763
|
if (!u.reelAutoAdvance.enabled) return;
|
|
@@ -1718,16 +1785,16 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
1718
1785
|
}), O(z, (e) => {
|
|
1719
1786
|
e !== void 0 && d("activeChange", e);
|
|
1720
1787
|
}, { immediate: !0 }), y(() => {
|
|
1721
|
-
window.addEventListener("resize",
|
|
1788
|
+
window.addEventListener("resize", se), window.addEventListener("orientationchange", se), g >= 0 && m(X);
|
|
1722
1789
|
}), v(() => {
|
|
1723
|
-
window.removeEventListener("resize",
|
|
1790
|
+
window.removeEventListener("resize", se), window.removeEventListener("orientationchange", se), A?.disconnect(), j !== null && cancelAnimationFrame(j), M !== null && clearTimeout(M);
|
|
1724
1791
|
}), n({
|
|
1725
1792
|
activeIndex: x,
|
|
1726
1793
|
activePostId: z,
|
|
1727
|
-
changeActiveMedia:
|
|
1728
|
-
loadIfNearBottom:
|
|
1729
|
-
moveActivePost:
|
|
1730
|
-
navigateToItem:
|
|
1794
|
+
changeActiveMedia: Z,
|
|
1795
|
+
loadIfNearBottom: le,
|
|
1796
|
+
moveActivePost: ue,
|
|
1797
|
+
navigateToItem: Q,
|
|
1731
1798
|
transitionActiveMedia: he,
|
|
1732
1799
|
transitionActivePost: me
|
|
1733
1800
|
}), (n, r) => (b(), s("main", {
|
|
@@ -1759,7 +1826,7 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
1759
1826
|
"style",
|
|
1760
1827
|
"total"
|
|
1761
1828
|
])) : o("", !0),
|
|
1762
|
-
c("div",
|
|
1829
|
+
c("div", Ot, [c("div", {
|
|
1763
1830
|
ref_key: "galleryElement",
|
|
1764
1831
|
ref: f,
|
|
1765
1832
|
class: "gallery-shell reel-feed",
|
|
@@ -1771,16 +1838,16 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
1771
1838
|
class: "reel-track",
|
|
1772
1839
|
style: _(F.value),
|
|
1773
1840
|
"aria-label": "Media gallery"
|
|
1774
|
-
}, [(b(!0), s(e, null, S(R.value, ({ fetchPriority: e, item: n, index:
|
|
1841
|
+
}, [(b(!0), s(e, null, S(R.value, ({ fetchPriority: e, item: n, index: i }) => (b(), a(gt, {
|
|
1775
1842
|
key: n.postId,
|
|
1776
|
-
active:
|
|
1777
|
-
"advance-on-media-end": u.reelAutoAdvance.enabled &&
|
|
1843
|
+
active: i === x.value && !C.value,
|
|
1844
|
+
"advance-on-media-end": u.reelAutoAdvance.enabled && i === x.value,
|
|
1778
1845
|
class: "reel-item",
|
|
1779
1846
|
entering: !1,
|
|
1780
1847
|
"fetch-priority": e,
|
|
1781
|
-
index:
|
|
1848
|
+
index: i,
|
|
1782
1849
|
item: n,
|
|
1783
|
-
"item-style": re(
|
|
1850
|
+
"item-style": re(i),
|
|
1784
1851
|
"media-card": t.mediaCard,
|
|
1785
1852
|
layout: "reel",
|
|
1786
1853
|
"loaded-count": t.items.length,
|
|
@@ -1788,11 +1855,13 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
1788
1855
|
"media-source": t.mediaSource,
|
|
1789
1856
|
"preview-state": t.previewStates.get(E(L)(n.postId, t.mediaIndices.get(n.postId) ?? 0)) ?? "loading",
|
|
1790
1857
|
"reel-controls-target": p.value,
|
|
1858
|
+
"reel-audio-state": t.reelAudioState,
|
|
1791
1859
|
"stationary-reel-controls": "",
|
|
1792
1860
|
total: t.total,
|
|
1793
1861
|
onMediaChange: (e) => d("mediaChange", n.postId, e),
|
|
1794
1862
|
onEnded: (e) => _e(n.postId, e),
|
|
1795
1863
|
onReady: (e) => d("ready", n.postId, e),
|
|
1864
|
+
onReelAudioChange: r[1] ||= (e) => d("reelAudioChange", e),
|
|
1796
1865
|
onError: (e) => d("error", n.postId, e)
|
|
1797
1866
|
}, null, 8, [
|
|
1798
1867
|
"active",
|
|
@@ -1807,6 +1876,7 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
1807
1876
|
"media-source",
|
|
1808
1877
|
"preview-state",
|
|
1809
1878
|
"reel-controls-target",
|
|
1879
|
+
"reel-audio-state",
|
|
1810
1880
|
"total",
|
|
1811
1881
|
"onMediaChange",
|
|
1812
1882
|
"onEnded",
|
|
@@ -1817,12 +1887,12 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
1817
1887
|
class: "reel-forward-status",
|
|
1818
1888
|
role: t.reelForward.status === "error" ? "alert" : "status",
|
|
1819
1889
|
"data-status": t.reelForward.status
|
|
1820
|
-
}, [c("p", null, T(
|
|
1890
|
+
}, [c("p", null, T(ne.value), 1), t.reelForward.status === "error" || t.reelForward.status === "end" ? (b(), s("button", {
|
|
1821
1891
|
key: 0,
|
|
1822
1892
|
class: "reel-forward-retry",
|
|
1823
1893
|
type: "button",
|
|
1824
1894
|
onClick: r[0] ||= (e) => d("retryForward")
|
|
1825
|
-
}, " Retry ")) : o("", !0)], 8,
|
|
1895
|
+
}, " Retry ")) : o("", !0)], 8, At)), t.reelForward.status === "idle" ? (b(), a(G, {
|
|
1826
1896
|
key: 2,
|
|
1827
1897
|
actions: t.feedFooterActions,
|
|
1828
1898
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -1831,10 +1901,10 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
1831
1901
|
"has-next": t.hasNext,
|
|
1832
1902
|
"is-loading": t.isLoadingMore,
|
|
1833
1903
|
"load-more-locked": t.loadMoreLocked,
|
|
1834
|
-
"show-load-more":
|
|
1904
|
+
"show-load-more": Y.value,
|
|
1835
1905
|
state: t.state,
|
|
1836
|
-
onLoadMore: r[
|
|
1837
|
-
onRetryEnd: r[
|
|
1906
|
+
onLoadMore: r[2] ||= (e) => d("loadMore"),
|
|
1907
|
+
onRetryEnd: r[3] ||= (e) => d("retryEnd")
|
|
1838
1908
|
}, null, 8, [
|
|
1839
1909
|
"actions",
|
|
1840
1910
|
"can-retry-end",
|
|
@@ -1845,7 +1915,7 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
1845
1915
|
"load-more-locked",
|
|
1846
1916
|
"show-load-more",
|
|
1847
1917
|
"state"
|
|
1848
|
-
])) : o("", !0)], 40,
|
|
1918
|
+
])) : o("", !0)], 40, kt), c("div", {
|
|
1849
1919
|
ref_key: "reelControlsElement",
|
|
1850
1920
|
ref: p,
|
|
1851
1921
|
class: "reel-media-controls-host",
|
|
@@ -1873,7 +1943,7 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
1873
1943
|
"style",
|
|
1874
1944
|
"total"
|
|
1875
1945
|
])) : o("", !0),
|
|
1876
|
-
te.value ? (b(), a(
|
|
1946
|
+
te.value ? (b(), a(Dt, {
|
|
1877
1947
|
key: K.value,
|
|
1878
1948
|
"duration-ms": t.reelAutoAdvance.intervalMs,
|
|
1879
1949
|
label: q.value,
|
|
@@ -1881,16 +1951,16 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
1881
1951
|
}, null, 8, ["duration-ms", "label"])) : o("", !0)
|
|
1882
1952
|
], 2));
|
|
1883
1953
|
}
|
|
1884
|
-
}),
|
|
1954
|
+
}), Pt = ["data-info-sheet-open", "data-info-sheet-mode"], Ft = ["aria-hidden", "inert"], It = {
|
|
1885
1955
|
key: 0,
|
|
1886
1956
|
class: "reel-info-sheet-layer",
|
|
1887
1957
|
"data-test": "reel-info-sheet"
|
|
1888
|
-
},
|
|
1958
|
+
}, Lt = [
|
|
1889
1959
|
"role",
|
|
1890
1960
|
"aria-modal",
|
|
1891
1961
|
"tabindex",
|
|
1892
1962
|
"data-active-post-id"
|
|
1893
|
-
],
|
|
1963
|
+
], Rt = /* @__PURE__ */ d({
|
|
1894
1964
|
__name: "ReelLayout",
|
|
1895
1965
|
props: {
|
|
1896
1966
|
forwardIndex: { default: null },
|
|
@@ -1920,6 +1990,7 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
1920
1990
|
mediaIndices: {},
|
|
1921
1991
|
nextPageError: { type: Boolean },
|
|
1922
1992
|
previewStates: {},
|
|
1993
|
+
reelAudioState: {},
|
|
1923
1994
|
state: {},
|
|
1924
1995
|
total: {}
|
|
1925
1996
|
},
|
|
@@ -1930,6 +2001,7 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
1930
2001
|
"loadMore",
|
|
1931
2002
|
"mediaChange",
|
|
1932
2003
|
"ready",
|
|
2004
|
+
"reelAudioChange",
|
|
1933
2005
|
"retryEnd",
|
|
1934
2006
|
"retryForward"
|
|
1935
2007
|
],
|
|
@@ -2015,7 +2087,7 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
2015
2087
|
class: "reel-layout-main",
|
|
2016
2088
|
"aria-hidden": e.infoSheetOverlay && A.value || void 0,
|
|
2017
2089
|
inert: e.infoSheetOverlay && A.value || void 0
|
|
2018
|
-
}, [u(
|
|
2090
|
+
}, [u(Nt, {
|
|
2019
2091
|
ref_key: "reelFeed",
|
|
2020
2092
|
ref: p,
|
|
2021
2093
|
"can-retry-end": e.canRetryEnd,
|
|
@@ -2035,6 +2107,7 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
2035
2107
|
"next-page-error": e.nextPageError,
|
|
2036
2108
|
"preview-states": e.previewStates,
|
|
2037
2109
|
"reel-auto-advance": e.reelAutoAdvance,
|
|
2110
|
+
"reel-audio-state": e.reelAudioState,
|
|
2038
2111
|
"reel-forward": e.reelForward,
|
|
2039
2112
|
state: e.state,
|
|
2040
2113
|
total: e.total,
|
|
@@ -2044,7 +2117,8 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
2044
2117
|
onMediaChange: ee,
|
|
2045
2118
|
onReady: H,
|
|
2046
2119
|
onRetryEnd: r[2] ||= (e) => d("retryEnd"),
|
|
2047
|
-
onRetryForward: r[3] ||= (e) => d("retryForward")
|
|
2120
|
+
onRetryForward: r[3] ||= (e) => d("retryForward"),
|
|
2121
|
+
onReelAudioChange: r[4] ||= (e) => d("reelAudioChange", e)
|
|
2048
2122
|
}, null, 8, [
|
|
2049
2123
|
"can-retry-end",
|
|
2050
2124
|
"card-footer",
|
|
@@ -2063,11 +2137,12 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
2063
2137
|
"next-page-error",
|
|
2064
2138
|
"preview-states",
|
|
2065
2139
|
"reel-auto-advance",
|
|
2140
|
+
"reel-audio-state",
|
|
2066
2141
|
"reel-forward",
|
|
2067
2142
|
"state",
|
|
2068
2143
|
"total"
|
|
2069
|
-
])], 8,
|
|
2070
|
-
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div",
|
|
2144
|
+
])], 8, Ft), u(n, { name: "vibe-info-sheet" }, {
|
|
2145
|
+
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", It, [c("aside", {
|
|
2071
2146
|
ref_key: "sheetElement",
|
|
2072
2147
|
ref: _,
|
|
2073
2148
|
class: "reel-info-sheet",
|
|
@@ -2076,14 +2151,14 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
2076
2151
|
"aria-modal": e.infoSheetOverlay ? "true" : void 0,
|
|
2077
2152
|
tabindex: e.infoSheetOverlay ? -1 : void 0,
|
|
2078
2153
|
"data-active-post-id": T.value?.postId
|
|
2079
|
-
}, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8,
|
|
2154
|
+
}, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8, Lt)])) : o("", !0)]),
|
|
2080
2155
|
_: 1
|
|
2081
|
-
})], 10,
|
|
2156
|
+
})], 10, Pt));
|
|
2082
2157
|
}
|
|
2083
2158
|
});
|
|
2084
2159
|
//#endregion
|
|
2085
2160
|
//#region src/core/mediaLifecycle.ts
|
|
2086
|
-
function
|
|
2161
|
+
function zt(e, t, n, r, i) {
|
|
2087
2162
|
let a = e.items.findIndex((e) => e.postId === t), o = e.items[a];
|
|
2088
2163
|
if (!o) return null;
|
|
2089
2164
|
let s = F(o, n), c = I(o, s);
|
|
@@ -2099,7 +2174,7 @@ function It(e, t, n, r, i) {
|
|
|
2099
2174
|
postIndex: a
|
|
2100
2175
|
};
|
|
2101
2176
|
}
|
|
2102
|
-
function
|
|
2177
|
+
function Bt(e, t) {
|
|
2103
2178
|
O(() => {
|
|
2104
2179
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null;
|
|
2105
2180
|
return {
|
|
@@ -2109,20 +2184,20 @@ function Lt(e, t) {
|
|
|
2109
2184
|
};
|
|
2110
2185
|
}, (n, r) => {
|
|
2111
2186
|
if (n.postId === null || n.postId === r?.postId && n.mediaIndex === r.mediaIndex && n.origin === r.origin) return;
|
|
2112
|
-
let i =
|
|
2187
|
+
let i = zt(e, n.postId, n.mediaIndex, "reel", n.origin);
|
|
2113
2188
|
i && t(i);
|
|
2114
2189
|
}, { flush: "sync" });
|
|
2115
2190
|
}
|
|
2116
2191
|
//#endregion
|
|
2117
2192
|
//#region src/components/useMediaLifecycle.ts
|
|
2118
|
-
function
|
|
2193
|
+
function Vt(e, t) {
|
|
2119
2194
|
let n = w(/* @__PURE__ */ new Map()), i = w(/* @__PURE__ */ new Map()), a = w(/* @__PURE__ */ new Map()), o = () => e.reelMediaSource === "preview" ? n : e.reelMediaSource === "mobile" ? a : i, s = r(() => o().value);
|
|
2120
2195
|
function c(e, t, n, r) {
|
|
2121
2196
|
let i = L(t, n);
|
|
2122
2197
|
e.value.get(i) !== r && (e.value = new Map(e.value).set(i, r));
|
|
2123
2198
|
}
|
|
2124
2199
|
function l(t, n, r, i) {
|
|
2125
|
-
return
|
|
2200
|
+
return zt(e, t, n, r, i);
|
|
2126
2201
|
}
|
|
2127
2202
|
function u(e, n, r, i) {
|
|
2128
2203
|
let a = l(e, n, r, i);
|
|
@@ -2144,7 +2219,7 @@ function Rt(e, t) {
|
|
|
2144
2219
|
let r = l(e, n, "masonry", null);
|
|
2145
2220
|
r && t.visible(r);
|
|
2146
2221
|
}
|
|
2147
|
-
return
|
|
2222
|
+
return Bt(e, t.reelChange), O(() => {
|
|
2148
2223
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null, n = t === null ? 0 : e.mediaIndices.get(t) ?? 0;
|
|
2149
2224
|
return {
|
|
2150
2225
|
mediaIndex: n,
|
|
@@ -2169,16 +2244,16 @@ function Rt(e, t) {
|
|
|
2169
2244
|
}
|
|
2170
2245
|
//#endregion
|
|
2171
2246
|
//#region src/core/reelEscapeStack.ts
|
|
2172
|
-
var
|
|
2173
|
-
function
|
|
2174
|
-
return
|
|
2175
|
-
let t =
|
|
2176
|
-
t >= 0 &&
|
|
2247
|
+
var Ht = [];
|
|
2248
|
+
function Ut(e) {
|
|
2249
|
+
return Ht.push(e), () => {
|
|
2250
|
+
let t = Ht.indexOf(e);
|
|
2251
|
+
t >= 0 && Ht.splice(t, 1);
|
|
2177
2252
|
};
|
|
2178
2253
|
}
|
|
2179
|
-
function
|
|
2254
|
+
function Wt(e) {
|
|
2180
2255
|
if (!e.isActive()) return !1;
|
|
2181
|
-
let t =
|
|
2256
|
+
let t = Ht.filter((e) => e.isActive()), n = e.element();
|
|
2182
2257
|
return n !== null && t.some((t) => {
|
|
2183
2258
|
if (t === e) return !1;
|
|
2184
2259
|
let r = t.element();
|
|
@@ -2194,14 +2269,14 @@ function Vt(e) {
|
|
|
2194
2269
|
}
|
|
2195
2270
|
//#endregion
|
|
2196
2271
|
//#region src/components/useReelKeyboard.ts
|
|
2197
|
-
function
|
|
2272
|
+
function Gt(e) {
|
|
2198
2273
|
let t = {
|
|
2199
2274
|
element: e.element,
|
|
2200
2275
|
isActive: () => e.state.layout === "reel" || e.state.reelOrigin === "masonry"
|
|
2201
2276
|
}, n = null;
|
|
2202
2277
|
function r(n) {
|
|
2203
2278
|
let r = t.isActive();
|
|
2204
|
-
if (n.key === "Escape" && r && !
|
|
2279
|
+
if (n.key === "Escape" && r && !Wt(t)) return;
|
|
2205
2280
|
if (n.key === "Escape" && e.state.reelOrigin === "masonry") {
|
|
2206
2281
|
n.preventDefault(), e.state.reelInfoSheetOverlay && e.state.reelInfoSheet.enabled && e.setReelInfoSheet(!1), e.closeMasonryReel();
|
|
2207
2282
|
return;
|
|
@@ -2221,14 +2296,14 @@ function Ht(e) {
|
|
|
2221
2296
|
a !== 0 && e.reelRenderer()?.changeActiveMedia?.(a) && n.preventDefault();
|
|
2222
2297
|
}
|
|
2223
2298
|
y(() => {
|
|
2224
|
-
n =
|
|
2299
|
+
n = Ut(t), window.addEventListener("keydown", r);
|
|
2225
2300
|
}), v(() => {
|
|
2226
2301
|
window.removeEventListener("keydown", r), n?.(), n = null;
|
|
2227
2302
|
});
|
|
2228
2303
|
}
|
|
2229
2304
|
//#endregion
|
|
2230
2305
|
//#region src/components/VibeSurface.vue?vue&type=script&setup=true&lang.ts
|
|
2231
|
-
var
|
|
2306
|
+
var Kt = 35, qt = 420, Jt = /* @__PURE__ */ d({
|
|
2232
2307
|
__name: "VibeSurface",
|
|
2233
2308
|
props: {
|
|
2234
2309
|
canRetryEnd: { type: Boolean },
|
|
@@ -2239,6 +2314,7 @@ var Ut = 35, Wt = 420, Gt = /* @__PURE__ */ d({
|
|
|
2239
2314
|
mediaCard: {},
|
|
2240
2315
|
masonry: {},
|
|
2241
2316
|
reelInfoSheet: {},
|
|
2317
|
+
reelAudioState: {},
|
|
2242
2318
|
state: {}
|
|
2243
2319
|
},
|
|
2244
2320
|
emits: [
|
|
@@ -2250,11 +2326,12 @@ var Ut = 35, Wt = 420, Gt = /* @__PURE__ */ d({
|
|
|
2250
2326
|
"openReel",
|
|
2251
2327
|
"reelMediaChange",
|
|
2252
2328
|
"reelInfoSheetChange",
|
|
2329
|
+
"reelAudioChange",
|
|
2253
2330
|
"retryEnd",
|
|
2254
2331
|
"retryForward"
|
|
2255
2332
|
],
|
|
2256
2333
|
setup(t, { expose: i, emit: c }) {
|
|
2257
|
-
let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), y = w({}), x = w(!1), S = w(/* @__PURE__ */ new Set()), C = w(/* @__PURE__ */ new Map()), T = w(/* @__PURE__ */ new Set()), D = w(/* @__PURE__ */ new Map()), A = r(() => Object.freeze([...l.state.items])), j = r(() => z(l.state, A.value)), { markMasonryVisible: M, markPreviewError: N, markPreviewReady: I, markReelError: L, markReelReady: R, originalStates: B, previewStates: V, reelStates: ee } =
|
|
2334
|
+
let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), y = w({}), x = w(!1), S = w(/* @__PURE__ */ new Set()), C = w(/* @__PURE__ */ new Map()), T = w(/* @__PURE__ */ new Set()), D = w(/* @__PURE__ */ new Map()), A = r(() => Object.freeze([...l.state.items])), j = r(() => z(l.state, A.value)), { markMasonryVisible: M, markPreviewError: N, markPreviewReady: I, markReelError: L, markReelReady: R, originalStates: B, previewStates: V, reelStates: ee } = Vt(l.state, {
|
|
2258
2335
|
ready: (e) => d("mediaReady", e),
|
|
2259
2336
|
reelChange: (e) => d("reelMediaChange", e),
|
|
2260
2337
|
visible: (e) => d("mediaVisible", e)
|
|
@@ -2275,10 +2352,10 @@ var Ut = 35, Wt = 420, Gt = /* @__PURE__ */ d({
|
|
|
2275
2352
|
let r = F(n, t);
|
|
2276
2353
|
(l.state.mediaIndices.get(e) ?? 0) !== r && (l.state.mediaIndices = new Map(l.state.mediaIndices).set(e, r));
|
|
2277
2354
|
}
|
|
2278
|
-
async function
|
|
2355
|
+
async function Y() {
|
|
2279
2356
|
await m(), (l.state.layout === "reel" || l.state.reelOrigin === "masonry" ? p.value : f.value)?.loadIfNearBottom();
|
|
2280
2357
|
}
|
|
2281
|
-
function
|
|
2358
|
+
function ne(e) {
|
|
2282
2359
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.changeActiveMedia?.(e) ?? !1;
|
|
2283
2360
|
}
|
|
2284
2361
|
function re(e) {
|
|
@@ -2295,29 +2372,29 @@ var Ut = 35, Wt = 420, Gt = /* @__PURE__ */ d({
|
|
|
2295
2372
|
return l.state.layout !== "masonry" || l.state.reelOrigin === "masonry" ? null : f.value?.getScrollElement?.() ?? null;
|
|
2296
2373
|
}
|
|
2297
2374
|
function X(e, t) {
|
|
2298
|
-
W = e, G = t === "keyboard", y.value =
|
|
2375
|
+
W = e, G = t === "keyboard", y.value = le(e), d("openReel", e), m(() => h.value?.focus());
|
|
2299
2376
|
}
|
|
2300
|
-
function
|
|
2377
|
+
function oe(e) {
|
|
2301
2378
|
let t = g.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [];
|
|
2302
2379
|
return Array.from(t).find((t) => t.dataset.postId === String(e)) ?? null;
|
|
2303
2380
|
}
|
|
2304
|
-
function
|
|
2381
|
+
function se(e, t) {
|
|
2305
2382
|
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || K()) return 0;
|
|
2306
|
-
let n = [...new Set(e)], r = n.filter(
|
|
2383
|
+
let n = [...new Set(e)], r = n.filter(oe);
|
|
2307
2384
|
if (r.length === 0) return 0;
|
|
2308
|
-
let i = new Map(D.value), a = t?.staggerMs ??
|
|
2385
|
+
let i = new Map(D.value), a = t?.staggerMs ?? Kt;
|
|
2309
2386
|
return r.forEach((e, t) => {
|
|
2310
2387
|
i.set(e, t * a);
|
|
2311
|
-
}), S.value = new Set([...S.value].filter((e) => !r.includes(e))), T.value = new Set([...T.value, ...n]), D.value = i,
|
|
2388
|
+
}), S.value = new Set([...S.value].filter((e) => !r.includes(e))), T.value = new Set([...T.value, ...n]), D.value = i, qt + (r.length - 1) * a;
|
|
2312
2389
|
}
|
|
2313
|
-
function
|
|
2314
|
-
let n =
|
|
2390
|
+
function ce(e, t) {
|
|
2391
|
+
let n = oe(e), r = n?.querySelector(".media-card-activator") ?? n;
|
|
2315
2392
|
r && (r.classList.toggle("media-card-focus-silent", !t), t || r.addEventListener("blur", () => {
|
|
2316
2393
|
r.classList.remove("media-card-focus-silent");
|
|
2317
2394
|
}, { once: !0 }), r?.focus({ preventScroll: !0 }));
|
|
2318
2395
|
}
|
|
2319
|
-
function
|
|
2320
|
-
let t = g.value, n =
|
|
2396
|
+
function le(e) {
|
|
2397
|
+
let t = g.value, n = oe(e);
|
|
2321
2398
|
if (t === null || n === null) return {};
|
|
2322
2399
|
let r = t.getBoundingClientRect(), i = n.getBoundingClientRect();
|
|
2323
2400
|
return {
|
|
@@ -2327,17 +2404,17 @@ var Ut = 35, Wt = 420, Gt = /* @__PURE__ */ d({
|
|
|
2327
2404
|
"--vibe-reel-origin-left": `${Math.max(0, i.left - r.left)}px`
|
|
2328
2405
|
};
|
|
2329
2406
|
}
|
|
2330
|
-
function
|
|
2407
|
+
function Z() {
|
|
2331
2408
|
l.state.reelOrigin === "masonry" && (W ??= l.state.activeReelPostId, x.value = !0, d("closeReel"));
|
|
2332
2409
|
}
|
|
2333
|
-
function
|
|
2410
|
+
function ue() {
|
|
2334
2411
|
let e = W, t = G;
|
|
2335
2412
|
x.value = !1, W = null, G = !1, y.value = {}, m(() => {
|
|
2336
|
-
e !== null &&
|
|
2413
|
+
e !== null && ce(e, t);
|
|
2337
2414
|
});
|
|
2338
2415
|
}
|
|
2339
|
-
return
|
|
2340
|
-
closeMasonryReel:
|
|
2416
|
+
return Gt({
|
|
2417
|
+
closeMasonryReel: Z,
|
|
2341
2418
|
element: () => g.value,
|
|
2342
2419
|
isReelLeaving: () => x.value,
|
|
2343
2420
|
reelRenderer: () => p.value,
|
|
@@ -2351,24 +2428,24 @@ var Ut = 35, Wt = 420, Gt = /* @__PURE__ */ d({
|
|
|
2351
2428
|
let t = C.value.get(e);
|
|
2352
2429
|
t !== void 0 && r.set(e, t);
|
|
2353
2430
|
}), t.forEach((e, t) => {
|
|
2354
|
-
r.set(e, t *
|
|
2431
|
+
r.set(e, t * Kt);
|
|
2355
2432
|
}), C.value = r, S.value = new Set([...S.value, ...t]), q();
|
|
2356
2433
|
}, { flush: "sync" }), v(() => {
|
|
2357
2434
|
U !== null && cancelAnimationFrame(U);
|
|
2358
2435
|
}), i({
|
|
2359
|
-
changeActiveReelMedia:
|
|
2436
|
+
changeActiveReelMedia: ne,
|
|
2360
2437
|
getAutoScrollElement: ae,
|
|
2361
|
-
loadIfNearBottom:
|
|
2438
|
+
loadIfNearBottom: Y,
|
|
2362
2439
|
moveActiveReelPost: re,
|
|
2363
2440
|
navigateToReelItem: ie,
|
|
2364
|
-
startItemRemoval:
|
|
2441
|
+
startItemRemoval: se,
|
|
2365
2442
|
transitionActiveReelMedia: (e) => p.value?.transitionActiveMedia?.(e) ?? Promise.resolve(!1),
|
|
2366
2443
|
transitionActiveReelPost: (e) => p.value?.transitionActivePost?.(e) ?? Promise.resolve(!1)
|
|
2367
2444
|
}), (r, i) => (b(), s("div", {
|
|
2368
2445
|
ref_key: "surfaceElement",
|
|
2369
2446
|
ref: g,
|
|
2370
2447
|
class: "vibe-surface"
|
|
2371
|
-
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(
|
|
2448
|
+
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(Rt, {
|
|
2372
2449
|
key: 0,
|
|
2373
2450
|
ref_key: "reelRenderer",
|
|
2374
2451
|
ref: p,
|
|
@@ -2395,6 +2472,7 @@ var Ut = 35, Wt = 420, Gt = /* @__PURE__ */ d({
|
|
|
2395
2472
|
origin: "reel",
|
|
2396
2473
|
"preview-states": E(ee),
|
|
2397
2474
|
"reel-auto-advance": t.state.reelAutoAdvance,
|
|
2475
|
+
"reel-audio-state": t.reelAudioState,
|
|
2398
2476
|
"reel-forward": t.state.reelForward,
|
|
2399
2477
|
state: j.value,
|
|
2400
2478
|
total: t.state.total,
|
|
@@ -2405,21 +2483,22 @@ var Ut = 35, Wt = 420, Gt = /* @__PURE__ */ d({
|
|
|
2405
2483
|
onMediaChange: J,
|
|
2406
2484
|
onReady: E(R),
|
|
2407
2485
|
onRetryEnd: i[3] ||= (e) => d("retryEnd"),
|
|
2408
|
-
onRetryForward: i[4] ||= (e) => d("retryForward")
|
|
2409
|
-
|
|
2486
|
+
onRetryForward: i[4] ||= (e) => d("retryForward"),
|
|
2487
|
+
onReelAudioChange: i[5] ||= (e) => d("reelAudioChange", e)
|
|
2488
|
+
}, null, 8, /* @__PURE__ */ "can-retry-end.has-next.card-footer.card-header.feed-footer.feed-footer-actions.forward-index.forward-item.media-card.infinite-scroll.is-loading-more.items.load-more-locked.media-source.media-indices.initial-post-id.info-sheet.info-sheet-enabled.info-sheet-overlay.next-page-error.preview-states.reel-auto-advance.reel-audio-state.reel-forward.state.total.onError.onReady".split("."))) : t.state.error || t.state.isLoading || t.state.items.length === 0 && t.state.reelForward.status === "idle" ? (b(), a(te, {
|
|
2410
2489
|
key: 1,
|
|
2411
2490
|
actions: t.feedFooterActions,
|
|
2412
2491
|
"can-retry-end": t.canRetryEnd,
|
|
2413
2492
|
"feed-footer": t.feedFooter,
|
|
2414
2493
|
state: j.value,
|
|
2415
|
-
onLoadMore: i[
|
|
2416
|
-
onRetryEnd: i[
|
|
2494
|
+
onLoadMore: i[6] ||= (e) => d("loadMore"),
|
|
2495
|
+
onRetryEnd: i[7] ||= (e) => d("retryEnd")
|
|
2417
2496
|
}, null, 8, [
|
|
2418
2497
|
"actions",
|
|
2419
2498
|
"can-retry-end",
|
|
2420
2499
|
"feed-footer",
|
|
2421
2500
|
"state"
|
|
2422
|
-
])) : (b(), s(e, { key: 2 }, [u(
|
|
2501
|
+
])) : (b(), s(e, { key: 2 }, [u(Ct, {
|
|
2423
2502
|
ref_key: "masonryRenderer",
|
|
2424
2503
|
ref: f,
|
|
2425
2504
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2446,10 +2525,10 @@ var Ut = 35, Wt = 420, Gt = /* @__PURE__ */ d({
|
|
|
2446
2525
|
total: t.state.total,
|
|
2447
2526
|
onActivate: X,
|
|
2448
2527
|
onError: E(N),
|
|
2449
|
-
onLoadMore: i[
|
|
2528
|
+
onLoadMore: i[8] ||= (e) => d("loadMore"),
|
|
2450
2529
|
onMediaChange: J,
|
|
2451
2530
|
onReady: E(I),
|
|
2452
|
-
onRetryEnd: i[
|
|
2531
|
+
onRetryEnd: i[9] ||= (e) => d("retryEnd"),
|
|
2453
2532
|
onVisible: E(M)
|
|
2454
2533
|
}, null, 8, [
|
|
2455
2534
|
"can-retry-end",
|
|
@@ -2479,7 +2558,7 @@ var Ut = 35, Wt = 420, Gt = /* @__PURE__ */ d({
|
|
|
2479
2558
|
"onVisible"
|
|
2480
2559
|
]), u(n, {
|
|
2481
2560
|
name: "vibe-reel-viewer",
|
|
2482
|
-
onAfterLeave:
|
|
2561
|
+
onAfterLeave: ue
|
|
2483
2562
|
}, {
|
|
2484
2563
|
default: k(() => [t.state.reelOrigin === "masonry" ? (b(), s("section", {
|
|
2485
2564
|
key: 0,
|
|
@@ -2491,7 +2570,7 @@ var Ut = 35, Wt = 420, Gt = /* @__PURE__ */ d({
|
|
|
2491
2570
|
"aria-modal": "true",
|
|
2492
2571
|
tabindex: "-1",
|
|
2493
2572
|
style: _(y.value)
|
|
2494
|
-
}, [u(
|
|
2573
|
+
}, [u(Rt, {
|
|
2495
2574
|
ref_key: "reelRenderer",
|
|
2496
2575
|
ref: p,
|
|
2497
2576
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2517,25 +2596,27 @@ var Ut = 35, Wt = 420, Gt = /* @__PURE__ */ d({
|
|
|
2517
2596
|
origin: "masonry",
|
|
2518
2597
|
"preview-states": E(B),
|
|
2519
2598
|
"reel-auto-advance": t.state.reelAutoAdvance,
|
|
2599
|
+
"reel-audio-state": t.reelAudioState,
|
|
2520
2600
|
"reel-forward": t.state.reelForward,
|
|
2521
2601
|
state: j.value,
|
|
2522
2602
|
total: t.state.total,
|
|
2523
|
-
onActiveChange: i[
|
|
2524
|
-
onCloseInfoSheet: i[
|
|
2603
|
+
onActiveChange: i[10] ||= (e) => d("activeReelChange", e),
|
|
2604
|
+
onCloseInfoSheet: i[11] ||= (e) => d("reelInfoSheetChange", !1),
|
|
2525
2605
|
onError: E(L),
|
|
2526
|
-
onLoadMore: i[
|
|
2606
|
+
onLoadMore: i[12] ||= (e) => d("loadMore"),
|
|
2527
2607
|
onMediaChange: J,
|
|
2528
2608
|
onReady: E(R),
|
|
2529
|
-
onRetryEnd: i[
|
|
2530
|
-
onRetryForward: i[
|
|
2531
|
-
|
|
2609
|
+
onRetryEnd: i[13] ||= (e) => d("retryEnd"),
|
|
2610
|
+
onRetryForward: i[14] ||= (e) => d("retryForward"),
|
|
2611
|
+
onReelAudioChange: i[15] ||= (e) => d("reelAudioChange", e)
|
|
2612
|
+
}, null, 8, /* @__PURE__ */ "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.onError.onReady".split("."))], 4)) : o("", !0)]),
|
|
2532
2613
|
_: 1
|
|
2533
2614
|
})], 64))], 512));
|
|
2534
2615
|
}
|
|
2535
2616
|
});
|
|
2536
2617
|
//#endregion
|
|
2537
2618
|
//#region src/core/page.ts
|
|
2538
|
-
function
|
|
2619
|
+
function Yt(e) {
|
|
2539
2620
|
if (!e || typeof e != "object" || !Array.isArray(e.items)) throw TypeError("Vibe loadPage must resolve to a page with an items array.");
|
|
2540
2621
|
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.");
|
|
2541
2622
|
if (e.next !== null && typeof e.next != "string" && typeof e.next != "number") throw TypeError("Vibe page next must be a string, number, or null.");
|
|
@@ -2546,22 +2627,22 @@ function $(e, t) {
|
|
|
2546
2627
|
let n = new Set(e.map((e) => e.postId));
|
|
2547
2628
|
return [...e, ...t.filter((e) => n.has(e.postId) ? !1 : (n.add(e.postId), !0))];
|
|
2548
2629
|
}
|
|
2549
|
-
function
|
|
2630
|
+
function Xt(e) {
|
|
2550
2631
|
return `${typeof e}:${String(e)}`;
|
|
2551
2632
|
}
|
|
2552
|
-
function
|
|
2553
|
-
return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview.src}` : `id:${
|
|
2633
|
+
function Zt(e) {
|
|
2634
|
+
return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview.src}` : `id:${Xt(e.mediaId)}`;
|
|
2554
2635
|
}
|
|
2555
|
-
function
|
|
2556
|
-
let n = [...e], r = new Map(e.map((e, t) => [
|
|
2636
|
+
function Qt(e, t) {
|
|
2637
|
+
let n = [...e], r = new Map(e.map((e, t) => [Xt(e.postId), t]));
|
|
2557
2638
|
return t.forEach((e) => {
|
|
2558
|
-
let t =
|
|
2639
|
+
let t = Xt(e.postId), i = r.get(t);
|
|
2559
2640
|
if (i === void 0) {
|
|
2560
2641
|
r.set(t, n.length), n.push(e);
|
|
2561
2642
|
return;
|
|
2562
2643
|
}
|
|
2563
|
-
let a = n[i], o = new Set([a, ...a.items].map(
|
|
2564
|
-
let t =
|
|
2644
|
+
let a = n[i], o = new Set([a, ...a.items].map(Zt)), s = [e, ...e.items].filter((e) => {
|
|
2645
|
+
let t = Zt(e);
|
|
2565
2646
|
return o.has(t) ? !1 : (o.add(t), !0);
|
|
2566
2647
|
});
|
|
2567
2648
|
s.length > 0 && (n[i] = {
|
|
@@ -2570,14 +2651,14 @@ function Yt(e, t) {
|
|
|
2570
2651
|
});
|
|
2571
2652
|
}), n;
|
|
2572
2653
|
}
|
|
2573
|
-
function
|
|
2654
|
+
function $t(e) {
|
|
2574
2655
|
return Object.prototype.hasOwnProperty.call(e, "current") ? e.current ?? null : e.next;
|
|
2575
2656
|
}
|
|
2576
2657
|
//#endregion
|
|
2577
2658
|
//#region src/core/appendPage.ts
|
|
2578
|
-
function
|
|
2579
|
-
let i =
|
|
2580
|
-
t.items =
|
|
2659
|
+
function en(e, t, n, r) {
|
|
2660
|
+
let i = Yt(e), a = n.filterItems(i.items), o = $t(i);
|
|
2661
|
+
t.items = Qt(t.items, a), t.next = i.next, i.total !== void 0 && (t.total = i.total), r(o), n.recordPages([{
|
|
2581
2662
|
contributionIds: a.map(({ postId: e }) => e),
|
|
2582
2663
|
cursor: o,
|
|
2583
2664
|
next: i.next,
|
|
@@ -2586,32 +2667,32 @@ function Zt(e, t, n, r) {
|
|
|
2586
2667
|
}
|
|
2587
2668
|
//#endregion
|
|
2588
2669
|
//#region src/core/requestDelay.ts
|
|
2589
|
-
var
|
|
2670
|
+
var tn = 2e3, nn = 1e4, rn = 250, an = {
|
|
2590
2671
|
delayRemainingMs: null,
|
|
2591
2672
|
nextRequestAt: null
|
|
2592
2673
|
};
|
|
2593
|
-
function
|
|
2674
|
+
function on(e, t) {
|
|
2594
2675
|
return e === void 0 ? t : Math.floor(e);
|
|
2595
2676
|
}
|
|
2596
|
-
function
|
|
2677
|
+
function sn(e, t) {
|
|
2597
2678
|
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.`);
|
|
2598
2679
|
}
|
|
2599
|
-
function
|
|
2600
|
-
let n =
|
|
2680
|
+
function cn(e, t = {}) {
|
|
2681
|
+
let n = on(t.delayStepMs, tn), r = on(t.delayMaxMs, nn);
|
|
2601
2682
|
return Math.min(Math.max(0, e) * n, r);
|
|
2602
2683
|
}
|
|
2603
|
-
function
|
|
2604
|
-
if (e == null || !Number.isFinite(e)) return { ...
|
|
2684
|
+
function ln(e) {
|
|
2685
|
+
if (e == null || !Number.isFinite(e)) return { ...an };
|
|
2605
2686
|
let t = Math.max(0, Math.floor(e - Date.now()));
|
|
2606
2687
|
return t > 0 ? {
|
|
2607
2688
|
delayRemainingMs: t,
|
|
2608
2689
|
nextRequestAt: e
|
|
2609
|
-
} : { ...
|
|
2690
|
+
} : { ...an };
|
|
2610
2691
|
}
|
|
2611
|
-
async function
|
|
2692
|
+
async function un({ delayMs: e, onChange: t, signal: n }) {
|
|
2612
2693
|
if (n.aborted) throw new DOMException("Aborted", "AbortError");
|
|
2613
2694
|
if (e <= 0) {
|
|
2614
|
-
t({ ...
|
|
2695
|
+
t({ ...an });
|
|
2615
2696
|
return;
|
|
2616
2697
|
}
|
|
2617
2698
|
let r = Date.now() + e;
|
|
@@ -2619,9 +2700,9 @@ async function sn({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2619
2700
|
delayRemainingMs: e,
|
|
2620
2701
|
nextRequestAt: r
|
|
2621
2702
|
}), await new Promise((i, a) => {
|
|
2622
|
-
let o = !1, s = setInterval(f,
|
|
2703
|
+
let o = !1, s = setInterval(f, rn), c = setTimeout(() => u(), e);
|
|
2623
2704
|
function l() {
|
|
2624
|
-
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...
|
|
2705
|
+
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...an });
|
|
2625
2706
|
}
|
|
2626
2707
|
function u(e) {
|
|
2627
2708
|
o || (o = !0, l(), e ? a(e) : i());
|
|
@@ -2630,42 +2711,42 @@ async function sn({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2630
2711
|
u(new DOMException("Aborted", "AbortError"));
|
|
2631
2712
|
}
|
|
2632
2713
|
function f() {
|
|
2633
|
-
let e =
|
|
2714
|
+
let e = ln(r);
|
|
2634
2715
|
t(e), e.delayRemainingMs === null && u();
|
|
2635
2716
|
}
|
|
2636
2717
|
n.addEventListener("abort", d, { once: !0 });
|
|
2637
2718
|
});
|
|
2638
2719
|
}
|
|
2639
|
-
var
|
|
2720
|
+
var dn = class {
|
|
2640
2721
|
interval = null;
|
|
2641
2722
|
constructor(e) {
|
|
2642
2723
|
this.onChange = e;
|
|
2643
2724
|
}
|
|
2644
2725
|
clear() {
|
|
2645
|
-
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...
|
|
2726
|
+
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...an });
|
|
2646
2727
|
}
|
|
2647
2728
|
sync(e) {
|
|
2648
2729
|
this.clear();
|
|
2649
|
-
let t =
|
|
2730
|
+
let t = ln(e);
|
|
2650
2731
|
this.onChange(t), t.delayRemainingMs !== null && (this.interval = setInterval(() => {
|
|
2651
|
-
let t =
|
|
2732
|
+
let t = ln(e);
|
|
2652
2733
|
this.onChange(t), t.delayRemainingMs === null && this.clear();
|
|
2653
|
-
},
|
|
2734
|
+
}, rn));
|
|
2654
2735
|
}
|
|
2655
2736
|
};
|
|
2656
|
-
function
|
|
2737
|
+
function fn(e, t = !0) {
|
|
2657
2738
|
return e.maxAdditionalPages === "unlimited" ? Infinity : (e.maxAdditionalPages ?? 10) + (t ? 1 : 0);
|
|
2658
2739
|
}
|
|
2659
|
-
function
|
|
2740
|
+
function pn(e) {
|
|
2660
2741
|
return `${typeof e}:${String(e)}`;
|
|
2661
2742
|
}
|
|
2662
|
-
function
|
|
2743
|
+
function mn(e, t) {
|
|
2663
2744
|
if (!Number.isInteger(e) || e <= 0) throw TypeError(`Vibe ${t} must be a positive integer.`);
|
|
2664
2745
|
}
|
|
2665
|
-
function
|
|
2746
|
+
function hn(e) {
|
|
2666
2747
|
if (!e) return;
|
|
2667
|
-
if (
|
|
2668
|
-
|
|
2748
|
+
if (mn(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
|
|
2749
|
+
sn(e, "frontend autofill");
|
|
2669
2750
|
let t = e.maxAdditionalPages;
|
|
2670
2751
|
if (t !== void 0 && t !== "unlimited" && (!Number.isInteger(t) || t < 0)) throw TypeError("Vibe autofill maxAdditionalPages must be a non-negative integer or \"unlimited\".");
|
|
2671
2752
|
return;
|
|
@@ -2677,7 +2758,7 @@ function fn(e) {
|
|
|
2677
2758
|
if (t.pageSize !== e.pageSize) throw TypeError("Vibe backend autofill initialSession pageSize must match autofill pageSize.");
|
|
2678
2759
|
}
|
|
2679
2760
|
}
|
|
2680
|
-
function
|
|
2761
|
+
function gn(e, t, n = !0) {
|
|
2681
2762
|
if (!e) return {
|
|
2682
2763
|
cycleId: null,
|
|
2683
2764
|
delayRemainingMs: null,
|
|
@@ -2694,7 +2775,7 @@ function pn(e, t, n = !0) {
|
|
|
2694
2775
|
status: "idle",
|
|
2695
2776
|
strategy: null
|
|
2696
2777
|
};
|
|
2697
|
-
let r = e.strategy === "backend" ? t ?? (n ? e.initialSession : void 0) : void 0, i = r?.received ?? 0, a =
|
|
2778
|
+
let r = e.strategy === "backend" ? t ?? (n ? e.initialSession : void 0) : void 0, i = r?.received ?? 0, a = ln(r?.nextRequestAt);
|
|
2698
2779
|
return {
|
|
2699
2780
|
cycleId: r?.cycleId ?? null,
|
|
2700
2781
|
...a,
|
|
@@ -2711,7 +2792,7 @@ function pn(e, t, n = !0) {
|
|
|
2711
2792
|
strategy: e.strategy
|
|
2712
2793
|
};
|
|
2713
2794
|
}
|
|
2714
|
-
function
|
|
2795
|
+
function _n(e) {
|
|
2715
2796
|
return [
|
|
2716
2797
|
"cancelling",
|
|
2717
2798
|
"filling",
|
|
@@ -2719,9 +2800,9 @@ function mn(e) {
|
|
|
2719
2800
|
"waiting"
|
|
2720
2801
|
].includes(e.status);
|
|
2721
2802
|
}
|
|
2722
|
-
async function
|
|
2803
|
+
async function vn(e, t, n) {
|
|
2723
2804
|
let r = t.autofill;
|
|
2724
|
-
if (!
|
|
2805
|
+
if (!_n(r) || !r.cycleId) return;
|
|
2725
2806
|
let i = {
|
|
2726
2807
|
cycleId: r.cycleId,
|
|
2727
2808
|
feedKey: r.feedKey ?? "",
|
|
@@ -2734,16 +2815,16 @@ async function hn(e, t, n) {
|
|
|
2734
2815
|
throw r.error = e, r.status = "error", e;
|
|
2735
2816
|
}
|
|
2736
2817
|
}
|
|
2737
|
-
function
|
|
2818
|
+
function yn(e, t, n) {
|
|
2738
2819
|
return e?.strategy === "backend" && t.feedKey === e.feedKey && t.sessionId === n.sessionId;
|
|
2739
2820
|
}
|
|
2740
|
-
async function
|
|
2741
|
-
let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ??
|
|
2821
|
+
async function bn({ 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 }) {
|
|
2822
|
+
let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ?? fn(s), g = t, _ = t, v = t, y = 0, b = [], x;
|
|
2742
2823
|
for (; y < h;) {
|
|
2743
|
-
let e =
|
|
2824
|
+
let e = pn(g);
|
|
2744
2825
|
if (m.has(e)) throw Error("Vibe autofill received a repeated cursor.");
|
|
2745
|
-
if (m.add(e), await
|
|
2746
|
-
delayMs:
|
|
2826
|
+
if (m.add(e), await un({
|
|
2827
|
+
delayMs: cn(l + y, s),
|
|
2747
2828
|
onChange: a,
|
|
2748
2829
|
signal: d
|
|
2749
2830
|
}), y > 0 && u()) return {
|
|
@@ -2757,7 +2838,7 @@ async function _n({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
2757
2838
|
status: "paused",
|
|
2758
2839
|
total: x
|
|
2759
2840
|
};
|
|
2760
|
-
let t =
|
|
2841
|
+
let t = Yt(await n({
|
|
2761
2842
|
cursor: g,
|
|
2762
2843
|
signal: d
|
|
2763
2844
|
}));
|
|
@@ -2814,12 +2895,12 @@ async function _n({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
2814
2895
|
}
|
|
2815
2896
|
//#endregion
|
|
2816
2897
|
//#region src/core/autofillController.ts
|
|
2817
|
-
var
|
|
2898
|
+
var xn = class {
|
|
2818
2899
|
collection = null;
|
|
2819
2900
|
cycle = 0;
|
|
2820
2901
|
delayCountdown;
|
|
2821
2902
|
constructor(e) {
|
|
2822
|
-
this.context = e, this.delayCountdown = new
|
|
2903
|
+
this.context = e, this.delayCountdown = new dn((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
|
|
2823
2904
|
}
|
|
2824
2905
|
beginCycle() {
|
|
2825
2906
|
let { options: e, state: t } = this.context;
|
|
@@ -2827,14 +2908,14 @@ var vn = class {
|
|
|
2827
2908
|
this.clear();
|
|
2828
2909
|
let n = `vibe-autofill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
2829
2910
|
return t.autofill = {
|
|
2830
|
-
...
|
|
2911
|
+
...gn(e, void 0, !1),
|
|
2831
2912
|
cycleId: n,
|
|
2832
2913
|
status: "filling"
|
|
2833
2914
|
}, n;
|
|
2834
2915
|
}
|
|
2835
2916
|
async cancel() {
|
|
2836
2917
|
let { cancelRequest: e, options: t, state: n } = this.context;
|
|
2837
|
-
await
|
|
2918
|
+
await vn(t, n, e), this.commitCollection();
|
|
2838
2919
|
}
|
|
2839
2920
|
captureCollection(e, t) {
|
|
2840
2921
|
t && (this.collection = e);
|
|
@@ -2862,30 +2943,30 @@ var vn = class {
|
|
|
2862
2943
|
requests: r.requests
|
|
2863
2944
|
}), !0) : !1;
|
|
2864
2945
|
}
|
|
2865
|
-
},
|
|
2866
|
-
function
|
|
2946
|
+
}, Sn = 100;
|
|
2947
|
+
function Cn(e, t) {
|
|
2867
2948
|
if (!Number.isFinite(t) || t <= 0) throw TypeError(`Vibe ${e} must be a positive number.`);
|
|
2868
2949
|
}
|
|
2869
|
-
function
|
|
2950
|
+
function wn(e, t, n) {
|
|
2870
2951
|
return Math.min(n, Math.max(t, e));
|
|
2871
2952
|
}
|
|
2872
|
-
function
|
|
2953
|
+
function Tn(e) {
|
|
2873
2954
|
if (!e) return;
|
|
2874
2955
|
let t = e.minSpeedPxPerSecond ?? 20, n = e.maxSpeedPxPerSecond ?? 240;
|
|
2875
|
-
if (
|
|
2876
|
-
e.speedPxPerSecond !== void 0 &&
|
|
2956
|
+
if (Cn("autoScroll.minSpeedPxPerSecond", t), Cn("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
|
|
2957
|
+
e.speedPxPerSecond !== void 0 && Cn("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
|
|
2877
2958
|
}
|
|
2878
|
-
function
|
|
2959
|
+
function En(e) {
|
|
2879
2960
|
let t = e?.minSpeedPxPerSecond ?? 20, n = e?.maxSpeedPxPerSecond ?? 240;
|
|
2880
2961
|
return {
|
|
2881
2962
|
enabled: e?.enabled ?? !1,
|
|
2882
2963
|
maxSpeedPxPerSecond: n,
|
|
2883
2964
|
minSpeedPxPerSecond: t,
|
|
2884
2965
|
paused: !1,
|
|
2885
|
-
speedPxPerSecond:
|
|
2966
|
+
speedPxPerSecond: wn(e?.speedPxPerSecond ?? 80, t, n)
|
|
2886
2967
|
};
|
|
2887
2968
|
}
|
|
2888
|
-
var
|
|
2969
|
+
var Dn = class {
|
|
2889
2970
|
frame = null;
|
|
2890
2971
|
lastTimestamp = null;
|
|
2891
2972
|
mounted = !1;
|
|
@@ -2905,9 +2986,9 @@ var wn = class {
|
|
|
2905
2986
|
this.options.state.enabled && (this.options.state.paused = e, this.lastTimestamp = null, e ? this.cancelFrame() : this.schedule());
|
|
2906
2987
|
}
|
|
2907
2988
|
setSpeed(e) {
|
|
2908
|
-
|
|
2989
|
+
Cn("auto-scroll speed", e);
|
|
2909
2990
|
let t = this.options.state;
|
|
2910
|
-
t.speedPxPerSecond =
|
|
2991
|
+
t.speedPxPerSecond = wn(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
|
|
2911
2992
|
}
|
|
2912
2993
|
tick = (e) => {
|
|
2913
2994
|
this.frame = null;
|
|
@@ -2919,7 +3000,7 @@ var wn = class {
|
|
|
2919
3000
|
return;
|
|
2920
3001
|
}
|
|
2921
3002
|
if (this.lastTimestamp !== null) {
|
|
2922
|
-
let r = Math.min(
|
|
3003
|
+
let r = Math.min(Sn, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
|
|
2923
3004
|
n.scrollTop = Math.min(i, n.scrollTop + t.speedPxPerSecond * r / 1e3);
|
|
2924
3005
|
}
|
|
2925
3006
|
this.lastTimestamp = e, this.schedule();
|
|
@@ -2933,13 +3014,13 @@ var wn = class {
|
|
|
2933
3014
|
};
|
|
2934
3015
|
//#endregion
|
|
2935
3016
|
//#region src/core/backendAutofill.ts
|
|
2936
|
-
async function
|
|
3017
|
+
async function On(e, t, n, r) {
|
|
2937
3018
|
let i = await e.onUnderfilled(n);
|
|
2938
3019
|
if (!r()) return;
|
|
2939
3020
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend autofill requires a sessionId.");
|
|
2940
3021
|
let a = Math.max(n.received, i.received ?? n.received);
|
|
2941
3022
|
Object.assign(t.autofill, {
|
|
2942
|
-
...
|
|
3023
|
+
...ln(i.nextRequestAt),
|
|
2943
3024
|
missing: Math.max(0, e.pageSize - a),
|
|
2944
3025
|
received: a,
|
|
2945
3026
|
sequence: i.sequence ?? 0,
|
|
@@ -2947,19 +3028,19 @@ async function Tn(e, t, n, r) {
|
|
|
2947
3028
|
status: "waiting"
|
|
2948
3029
|
});
|
|
2949
3030
|
}
|
|
2950
|
-
function
|
|
3031
|
+
function kn(e, t) {
|
|
2951
3032
|
["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);
|
|
2952
3033
|
}
|
|
2953
|
-
function
|
|
3034
|
+
function An(e, t, n) {
|
|
2954
3035
|
let r = t.autofill;
|
|
2955
|
-
return !
|
|
3036
|
+
return !yn(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (kn(t, n), Object.assign(r, ln(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);
|
|
2956
3037
|
}
|
|
2957
|
-
function
|
|
2958
|
-
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill =
|
|
3038
|
+
function jn(e, t, n) {
|
|
3039
|
+
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = gn(e, n), kn(t, n), !0);
|
|
2959
3040
|
}
|
|
2960
3041
|
//#endregion
|
|
2961
3042
|
//#region src/core/backlogRestore.ts
|
|
2962
|
-
async function
|
|
3043
|
+
async function Mn(e, t, n) {
|
|
2963
3044
|
if (!e) return;
|
|
2964
3045
|
let r = new AbortController();
|
|
2965
3046
|
n(r);
|
|
@@ -2974,7 +3055,7 @@ async function kn(e, t, n) {
|
|
|
2974
3055
|
}
|
|
2975
3056
|
//#endregion
|
|
2976
3057
|
//#region src/core/initialAutofill.ts
|
|
2977
|
-
async function
|
|
3058
|
+
async function Nn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, onPages: i, options: a, signal: o, state: s }) {
|
|
2978
3059
|
let c = a.autofill;
|
|
2979
3060
|
if (!c) return;
|
|
2980
3061
|
let l = s.items.length;
|
|
@@ -2987,7 +3068,7 @@ async function An({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
2987
3068
|
return;
|
|
2988
3069
|
}
|
|
2989
3070
|
if (c.strategy === "backend") {
|
|
2990
|
-
await
|
|
3071
|
+
await On(c, s, {
|
|
2991
3072
|
cycleId: e,
|
|
2992
3073
|
feedKey: c.feedKey,
|
|
2993
3074
|
items: [...s.items],
|
|
@@ -3004,11 +3085,11 @@ async function An({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3004
3085
|
s.autofill.status = "exhausted";
|
|
3005
3086
|
return;
|
|
3006
3087
|
}
|
|
3007
|
-
let u = await
|
|
3088
|
+
let u = await bn({
|
|
3008
3089
|
existingItems: s.items,
|
|
3009
3090
|
initialCursor: s.next,
|
|
3010
3091
|
loadPage: a.loadPage,
|
|
3011
|
-
maximumRequests:
|
|
3092
|
+
maximumRequests: fn(c, !1),
|
|
3012
3093
|
onCollection: n,
|
|
3013
3094
|
onDelayChange: (e) => {
|
|
3014
3095
|
t() && Object.assign(s.autofill, e);
|
|
@@ -3031,13 +3112,13 @@ async function An({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3031
3112
|
}
|
|
3032
3113
|
//#endregion
|
|
3033
3114
|
//#region src/core/fill.ts
|
|
3034
|
-
function
|
|
3115
|
+
function Pn(e) {
|
|
3035
3116
|
return "items" in e ? { items: e.items } : "pages" in e ? { pages: e.pages } : { until: "end" };
|
|
3036
3117
|
}
|
|
3037
|
-
function
|
|
3118
|
+
function Fn(e) {
|
|
3038
3119
|
return `${typeof e}:${String(e)}`;
|
|
3039
3120
|
}
|
|
3040
|
-
function
|
|
3121
|
+
function In(e) {
|
|
3041
3122
|
if (!e || typeof e != "object") throw TypeError("Vibe fill target must be an object.");
|
|
3042
3123
|
if ("pages" in e) {
|
|
3043
3124
|
if (!Number.isInteger(e.pages) || e.pages <= 0) throw TypeError("Vibe fill pages must be a positive integer.");
|
|
@@ -3050,21 +3131,21 @@ function Nn(e) {
|
|
|
3050
3131
|
if ("until" in e && e.until === "end") return { until: "end" };
|
|
3051
3132
|
throw TypeError("Vibe fill target must be { items }, { pages }, or { until: 'end' }.");
|
|
3052
3133
|
}
|
|
3053
|
-
function
|
|
3134
|
+
function Ln(e) {
|
|
3054
3135
|
if (!e) return;
|
|
3055
3136
|
if (e.strategy === "frontend") {
|
|
3056
|
-
|
|
3137
|
+
sn(e, "frontend fill");
|
|
3057
3138
|
return;
|
|
3058
3139
|
}
|
|
3059
3140
|
if (!e.feedKey.trim()) throw TypeError("Vibe backend fill requires a feedKey.");
|
|
3060
3141
|
let t = e.initialSession;
|
|
3061
3142
|
if (t) {
|
|
3062
3143
|
if (t.feedKey !== e.feedKey) throw TypeError("Vibe backend fill initialSession feedKey must match fill feedKey.");
|
|
3063
|
-
|
|
3144
|
+
In(t.target);
|
|
3064
3145
|
}
|
|
3065
3146
|
}
|
|
3066
|
-
function
|
|
3067
|
-
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a =
|
|
3147
|
+
function Rn(e, t, n = !0) {
|
|
3148
|
+
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a = ln(i?.nextRequestAt);
|
|
3068
3149
|
return {
|
|
3069
3150
|
completedPages: i?.completedPages ?? 0,
|
|
3070
3151
|
cycleId: i?.cycleId ?? null,
|
|
@@ -3077,10 +3158,10 @@ function Fn(e, t, n = !0) {
|
|
|
3077
3158
|
sessionId: i?.sessionId ?? null,
|
|
3078
3159
|
status: i?.status ?? "idle",
|
|
3079
3160
|
strategy: e?.strategy ?? null,
|
|
3080
|
-
target: i ?
|
|
3161
|
+
target: i ? Pn(i.target) : null
|
|
3081
3162
|
};
|
|
3082
3163
|
}
|
|
3083
|
-
function
|
|
3164
|
+
function zn(e) {
|
|
3084
3165
|
return [
|
|
3085
3166
|
"cancelling",
|
|
3086
3167
|
"filling",
|
|
@@ -3088,7 +3169,7 @@ function In(e) {
|
|
|
3088
3169
|
"waiting"
|
|
3089
3170
|
].includes(e.status);
|
|
3090
3171
|
}
|
|
3091
|
-
async function
|
|
3172
|
+
async function Bn({ existingItems: e, initialCursor: t, loadPage: n, onCollection: r = () => void 0, onDelayChange: i, onProgress: a, options: o, shouldPause: s = () => !1, signal: c, target: l }) {
|
|
3092
3173
|
let u = [], d = [], f = [...e], p = /* @__PURE__ */ new Set(), m = 0, h = t, g = t, _ = t, v = 0, y;
|
|
3093
3174
|
if ("items" in l && f.length >= l.items) return {
|
|
3094
3175
|
completedPages: m,
|
|
@@ -3100,10 +3181,10 @@ async function Ln({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
3100
3181
|
status: "complete"
|
|
3101
3182
|
};
|
|
3102
3183
|
for (; _ !== null;) {
|
|
3103
|
-
let e =
|
|
3184
|
+
let e = Fn(h);
|
|
3104
3185
|
if (p.has(e)) throw Error("Vibe fill received a repeated cursor.");
|
|
3105
|
-
if (p.add(e), await
|
|
3106
|
-
delayMs:
|
|
3186
|
+
if (p.add(e), await un({
|
|
3187
|
+
delayMs: cn(m, o),
|
|
3107
3188
|
onChange: i,
|
|
3108
3189
|
signal: c
|
|
3109
3190
|
}), m > 0 && s()) return {
|
|
@@ -3116,7 +3197,7 @@ async function Ln({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
3116
3197
|
status: "paused",
|
|
3117
3198
|
total: y
|
|
3118
3199
|
};
|
|
3119
|
-
let t =
|
|
3200
|
+
let t = Yt(await n({
|
|
3120
3201
|
cursor: h,
|
|
3121
3202
|
signal: c
|
|
3122
3203
|
}));
|
|
@@ -3184,12 +3265,12 @@ async function Ln({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
3184
3265
|
}
|
|
3185
3266
|
//#endregion
|
|
3186
3267
|
//#region src/core/backendFill.ts
|
|
3187
|
-
async function
|
|
3268
|
+
async function Vn(e, t, n, r) {
|
|
3188
3269
|
let i = await e.onStart(n);
|
|
3189
3270
|
if (r()) {
|
|
3190
3271
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend fill requires a sessionId.");
|
|
3191
3272
|
Object.assign(t.fill, {
|
|
3192
|
-
...
|
|
3273
|
+
...ln(i.nextRequestAt),
|
|
3193
3274
|
completedPages: i.completedPages ?? 0,
|
|
3194
3275
|
received: i.received ?? 0,
|
|
3195
3276
|
sequence: i.sequence ?? 0,
|
|
@@ -3198,23 +3279,23 @@ async function Rn(e, t, n, r) {
|
|
|
3198
3279
|
});
|
|
3199
3280
|
}
|
|
3200
3281
|
}
|
|
3201
|
-
function
|
|
3282
|
+
function Hn(e, t, n) {
|
|
3202
3283
|
return e?.strategy === "backend" && n.feedKey === e.feedKey && n.sessionId === t.fill.sessionId;
|
|
3203
3284
|
}
|
|
3204
|
-
function
|
|
3285
|
+
function Un(e) {
|
|
3205
3286
|
return Number.isInteger(e.completedPages) && e.completedPages >= 0 && Number.isInteger(e.received) && e.received >= 0 && Number.isInteger(e.sequence) && e.sequence >= 0;
|
|
3206
3287
|
}
|
|
3207
|
-
function
|
|
3288
|
+
function Wn(e, t) {
|
|
3208
3289
|
if (!["complete", "exhausted"].includes(t.status)) return !0;
|
|
3209
3290
|
let n = e.fill.target;
|
|
3210
3291
|
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;
|
|
3211
3292
|
}
|
|
3212
|
-
function
|
|
3293
|
+
function Gn(e, t, n) {
|
|
3213
3294
|
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));
|
|
3214
3295
|
}
|
|
3215
|
-
function
|
|
3216
|
-
return !
|
|
3217
|
-
...
|
|
3296
|
+
function Kn(e, t, n, r) {
|
|
3297
|
+
return !Hn(e, t, n) || !Un(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !Wn(t, n) ? !1 : (Gn(t, n, r), Object.assign(t.fill, {
|
|
3298
|
+
...ln(n.status === "waiting" ? n.nextRequestAt : null),
|
|
3218
3299
|
completedPages: n.completedPages,
|
|
3219
3300
|
error: n.error ?? null,
|
|
3220
3301
|
received: n.received,
|
|
@@ -3222,45 +3303,45 @@ function Un(e, t, n, r) {
|
|
|
3222
3303
|
status: n.status
|
|
3223
3304
|
}), !0);
|
|
3224
3305
|
}
|
|
3225
|
-
function
|
|
3306
|
+
function qn(e, t, n, r) {
|
|
3226
3307
|
if (e?.strategy !== "backend" || n.feedKey !== e.feedKey) return !1;
|
|
3227
3308
|
let i = t.fill;
|
|
3228
|
-
return t.fill =
|
|
3309
|
+
return t.fill = Rn(e, n), !Un(n) || !Wn(t, n) ? (t.fill = i, !1) : (Gn(t, n, r), !0);
|
|
3229
3310
|
}
|
|
3230
3311
|
//#endregion
|
|
3231
3312
|
//#region src/core/fillController.ts
|
|
3232
|
-
var
|
|
3313
|
+
var Jn = class {
|
|
3233
3314
|
abortController = null;
|
|
3234
3315
|
cycle = 0;
|
|
3235
3316
|
delayCountdown;
|
|
3236
3317
|
requestVersion = 0;
|
|
3237
3318
|
collection = null;
|
|
3238
3319
|
constructor(e) {
|
|
3239
|
-
this.options = e, this.delayCountdown = new
|
|
3320
|
+
this.options = e, this.delayCountdown = new dn((e) => {
|
|
3240
3321
|
Object.assign(this.options.state.fill, e);
|
|
3241
3322
|
}), this.syncBackendCountdown();
|
|
3242
3323
|
}
|
|
3243
3324
|
isActive() {
|
|
3244
|
-
return
|
|
3325
|
+
return zn(this.options.state.fill);
|
|
3245
3326
|
}
|
|
3246
3327
|
applyUpdate(e) {
|
|
3247
|
-
let t =
|
|
3328
|
+
let t = Kn(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
3248
3329
|
return t && this.syncBackendCountdown(), t;
|
|
3249
3330
|
}
|
|
3250
3331
|
restoreSession(e) {
|
|
3251
|
-
let t =
|
|
3332
|
+
let t = qn(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
3252
3333
|
return t && this.syncBackendCountdown(), t;
|
|
3253
3334
|
}
|
|
3254
3335
|
async start(e, t = {}) {
|
|
3255
3336
|
let n = this.options.fill;
|
|
3256
3337
|
if (!n) throw Error("Vibe fill is not configured.");
|
|
3257
3338
|
if (this.isActive()) throw Error("Vibe fill is already active.");
|
|
3258
|
-
let r =
|
|
3339
|
+
let r = In(e), i = In(t.target ?? r), a = t.progressOffset ?? {
|
|
3259
3340
|
completedPages: 0,
|
|
3260
3341
|
received: 0
|
|
3261
3342
|
}, o = t.cycleId ?? `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
3262
3343
|
if (this.options.state.fill = {
|
|
3263
|
-
...
|
|
3344
|
+
...Rn(n, void 0, !1),
|
|
3264
3345
|
completedPages: a.completedPages,
|
|
3265
3346
|
cycleId: o,
|
|
3266
3347
|
received: a.received,
|
|
@@ -3273,7 +3354,7 @@ var Gn = class {
|
|
|
3273
3354
|
let s = ++this.requestVersion, c = new AbortController();
|
|
3274
3355
|
this.abortController = c;
|
|
3275
3356
|
try {
|
|
3276
|
-
n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await
|
|
3357
|
+
n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await Vn(n, this.options.state, {
|
|
3277
3358
|
cycleId: o,
|
|
3278
3359
|
feedKey: n.feedKey,
|
|
3279
3360
|
items: [...this.options.state.items],
|
|
@@ -3291,7 +3372,7 @@ var Gn = class {
|
|
|
3291
3372
|
}
|
|
3292
3373
|
async cancel() {
|
|
3293
3374
|
let { fill: e, state: t } = this.options;
|
|
3294
|
-
if (!
|
|
3375
|
+
if (!zn(t.fill) || !t.fill.cycleId) return;
|
|
3295
3376
|
let n = {
|
|
3296
3377
|
cycleId: t.fill.cycleId,
|
|
3297
3378
|
feedKey: t.fill.feedKey ?? "",
|
|
@@ -3335,7 +3416,7 @@ var Gn = class {
|
|
|
3335
3416
|
});
|
|
3336
3417
|
}
|
|
3337
3418
|
reset() {
|
|
3338
|
-
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill =
|
|
3419
|
+
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = Rn(this.options.fill, void 0, !1), this.collection = null;
|
|
3339
3420
|
}
|
|
3340
3421
|
destroy() {
|
|
3341
3422
|
this.abortLocalRequest(), this.delayCountdown.clear();
|
|
@@ -3370,7 +3451,7 @@ var Gn = class {
|
|
|
3370
3451
|
s.fill.status = "until" in t ? "complete" : "exhausted";
|
|
3371
3452
|
return;
|
|
3372
3453
|
}
|
|
3373
|
-
let c = await
|
|
3454
|
+
let c = await Bn({
|
|
3374
3455
|
existingItems: s.items,
|
|
3375
3456
|
initialCursor: s.next,
|
|
3376
3457
|
loadPage: o,
|
|
@@ -3418,7 +3499,7 @@ var Gn = class {
|
|
|
3418
3499
|
};
|
|
3419
3500
|
//#endregion
|
|
3420
3501
|
//#region src/core/fillReconciliation.ts
|
|
3421
|
-
async function
|
|
3502
|
+
async function Yn({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r, setLastCursor: i, signal: a, state: o }) {
|
|
3422
3503
|
if (!e.needsReconciliation(o.items)) return "skipped";
|
|
3423
3504
|
let s = await e.reconcile({
|
|
3424
3505
|
existingItems: o.items,
|
|
@@ -3431,7 +3512,7 @@ async function Kn({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r,
|
|
|
3431
3512
|
}
|
|
3432
3513
|
//#endregion
|
|
3433
3514
|
//#region src/core/feedFooter.ts
|
|
3434
|
-
function
|
|
3515
|
+
function Xn(e) {
|
|
3435
3516
|
return {
|
|
3436
3517
|
cancelAutofill: () => e.cancelAutofill(),
|
|
3437
3518
|
loadMore: () => e.loadNext(),
|
|
@@ -3443,46 +3524,46 @@ function qn(e) {
|
|
|
3443
3524
|
retryFill: () => e.retryFill()
|
|
3444
3525
|
};
|
|
3445
3526
|
}
|
|
3446
|
-
function
|
|
3527
|
+
function Zn(e) {
|
|
3447
3528
|
if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
|
|
3448
3529
|
}
|
|
3449
|
-
function
|
|
3450
|
-
e?.intervalMs !== void 0 &&
|
|
3530
|
+
function Qn(e) {
|
|
3531
|
+
e?.intervalMs !== void 0 && Zn(e.intervalMs);
|
|
3451
3532
|
}
|
|
3452
|
-
function
|
|
3533
|
+
function $n(e) {
|
|
3453
3534
|
return {
|
|
3454
3535
|
enabled: e?.enabled ?? !1,
|
|
3455
3536
|
includePostItems: e?.includePostItems ?? !1,
|
|
3456
3537
|
intervalMs: e?.intervalMs ?? 5e3
|
|
3457
3538
|
};
|
|
3458
3539
|
}
|
|
3459
|
-
function
|
|
3540
|
+
function er(e, t) {
|
|
3460
3541
|
if (typeof t == "boolean") {
|
|
3461
3542
|
e.enabled = t;
|
|
3462
3543
|
return;
|
|
3463
3544
|
}
|
|
3464
|
-
|
|
3545
|
+
Qn(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);
|
|
3465
3546
|
}
|
|
3466
3547
|
//#endregion
|
|
3467
3548
|
//#region src/core/reelInfoSheet.ts
|
|
3468
|
-
function
|
|
3549
|
+
function tr(e) {
|
|
3469
3550
|
return { enabled: e?.enabled ?? !1 };
|
|
3470
3551
|
}
|
|
3471
|
-
function
|
|
3552
|
+
function nr(e, t, n) {
|
|
3472
3553
|
if (n && !t) throw Error("Vibe cannot enable reelInfoSheet without a configured component.");
|
|
3473
3554
|
e.enabled = n;
|
|
3474
3555
|
}
|
|
3475
3556
|
//#endregion
|
|
3476
3557
|
//#region src/core/initialRuntimeState.ts
|
|
3477
|
-
function
|
|
3558
|
+
function rr(e, t) {
|
|
3478
3559
|
let n = e.initialPage;
|
|
3479
3560
|
return {
|
|
3480
3561
|
activeReelPostId: null,
|
|
3481
|
-
autoScroll:
|
|
3482
|
-
autofill:
|
|
3562
|
+
autoScroll: En(e.autoScroll),
|
|
3563
|
+
autofill: gn(e.autofill),
|
|
3483
3564
|
current: n?.current ?? null,
|
|
3484
3565
|
error: null,
|
|
3485
|
-
fill:
|
|
3566
|
+
fill: Rn(e.fill),
|
|
3486
3567
|
infiniteScroll: e.infiniteScroll ?? !0,
|
|
3487
3568
|
isLoading: !n,
|
|
3488
3569
|
isLoadingMore: !1,
|
|
@@ -3493,14 +3574,14 @@ function er(e, t) {
|
|
|
3493
3574
|
next: n?.next ?? null,
|
|
3494
3575
|
nextPageError: null,
|
|
3495
3576
|
phoneMode: !1,
|
|
3496
|
-
reelAutoAdvance:
|
|
3577
|
+
reelAutoAdvance: $n(e.reelAutoAdvance),
|
|
3497
3578
|
reelForward: {
|
|
3498
3579
|
error: null,
|
|
3499
3580
|
status: "idle"
|
|
3500
3581
|
},
|
|
3501
3582
|
reelForwardIndex: null,
|
|
3502
3583
|
reelForwardItem: null,
|
|
3503
|
-
reelInfoSheet:
|
|
3584
|
+
reelInfoSheet: tr(e.reelInfoSheet),
|
|
3504
3585
|
reelInfoSheetOverlay: !1,
|
|
3505
3586
|
reelMediaSource: "original",
|
|
3506
3587
|
reelOrigin: null,
|
|
@@ -3509,20 +3590,20 @@ function er(e, t) {
|
|
|
3509
3590
|
}
|
|
3510
3591
|
//#endregion
|
|
3511
3592
|
//#region src/core/options.ts
|
|
3512
|
-
function
|
|
3593
|
+
function ir(e, t) {
|
|
3513
3594
|
if (t) {
|
|
3514
3595
|
if (!Number.isFinite(t.height) || t.height <= 0) throw TypeError(`Vibe ${e} height must be a positive number.`);
|
|
3515
3596
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe ${e} background must be "default" or "transparent".`);
|
|
3516
3597
|
}
|
|
3517
3598
|
}
|
|
3518
|
-
function
|
|
3599
|
+
function ar(e, t) {
|
|
3519
3600
|
if (t) {
|
|
3520
3601
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe mediaCard ${e} background must be "default" or "transparent".`);
|
|
3521
3602
|
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.`);
|
|
3522
3603
|
}
|
|
3523
3604
|
}
|
|
3524
|
-
function
|
|
3525
|
-
if (
|
|
3605
|
+
function or(e) {
|
|
3606
|
+
if (Tn(e.autoScroll), ir("cardHeader", e.cardHeader), ir("cardFooter", e.cardFooter), ar("header", e.mediaCard?.header), ar("footer", e.mediaCard?.footer), hn(e.autofill), Ln(e.fill), le(e.masonry), Qn(e.reelAutoAdvance), e.removalReconciliation) {
|
|
3526
3607
|
if (!Number.isInteger(e.removalReconciliation.pageSize) || e.removalReconciliation.pageSize <= 0) throw TypeError("Vibe removalReconciliation pageSize must be a positive integer.");
|
|
3527
3608
|
let t = e.removalReconciliation.maxReplayPages ?? 5;
|
|
3528
3609
|
if (!Number.isInteger(t) || t <= 0) throw TypeError("Vibe removalReconciliation maxReplayPages must be a positive integer.");
|
|
@@ -3537,7 +3618,7 @@ function rr(e) {
|
|
|
3537
3618
|
if (e.fill?.strategy === "frontend" && !e.loadPage) throw TypeError("Vibe frontend fill requires loadPage.");
|
|
3538
3619
|
if (e.fill?.strategy === "backend" && e.fill.initialSession && !e.initialPage) throw TypeError("Vibe backend fill restoration requires initialPage.");
|
|
3539
3620
|
}
|
|
3540
|
-
function
|
|
3621
|
+
function sr(e) {
|
|
3541
3622
|
if (typeof e != "string") return e;
|
|
3542
3623
|
if (typeof document > "u") throw Error("Vibe cannot resolve a selector without a document.");
|
|
3543
3624
|
let t = document.querySelector(e);
|
|
@@ -3546,7 +3627,7 @@ function ir(e) {
|
|
|
3546
3627
|
}
|
|
3547
3628
|
//#endregion
|
|
3548
3629
|
//#region src/core/pageRequest.ts
|
|
3549
|
-
async function
|
|
3630
|
+
async function cr({ append: e, autofillController: t, cursor: n, isCurrent: r, loadPage: i, onLastCursor: a, onPages: o, options: s, signal: c, state: l }) {
|
|
3550
3631
|
let u = s.autofill, d = e && u?.strategy === "frontend" && (l.autofill.status === "paused" || l.autofill.status === "error"), f = d ? {
|
|
3551
3632
|
received: l.autofill.received,
|
|
3552
3633
|
requests: l.autofill.requests
|
|
@@ -3558,11 +3639,11 @@ async function ar({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3558
3639
|
let m = !1;
|
|
3559
3640
|
try {
|
|
3560
3641
|
if (u?.strategy === "frontend") {
|
|
3561
|
-
let s = await
|
|
3642
|
+
let s = await bn({
|
|
3562
3643
|
existingItems: e ? l.items : [],
|
|
3563
3644
|
initialCursor: n,
|
|
3564
3645
|
loadPage: i,
|
|
3565
|
-
maximumRequests: f ? Math.max(0,
|
|
3646
|
+
maximumRequests: f ? Math.max(0, fn(u) - f.requests) : void 0,
|
|
3566
3647
|
onCollection: (e) => t.captureCollection(e, r()),
|
|
3567
3648
|
onDelayChange: (e) => {
|
|
3568
3649
|
r() && Object.assign(l.autofill, e);
|
|
@@ -3585,7 +3666,7 @@ async function ar({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3585
3666
|
}), o(s.pages), t.clearCollection();
|
|
3586
3667
|
return;
|
|
3587
3668
|
}
|
|
3588
|
-
let s =
|
|
3669
|
+
let s = Yt(await i({
|
|
3589
3670
|
cursor: n,
|
|
3590
3671
|
signal: c
|
|
3591
3672
|
}));
|
|
@@ -3605,7 +3686,7 @@ async function ar({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3605
3686
|
l.autofill.status = "complete";
|
|
3606
3687
|
return;
|
|
3607
3688
|
}
|
|
3608
|
-
await
|
|
3689
|
+
await On(u, l, {
|
|
3609
3690
|
cycleId: p,
|
|
3610
3691
|
feedKey: u.feedKey,
|
|
3611
3692
|
items: h.slice(d.length),
|
|
@@ -3627,16 +3708,16 @@ async function ar({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3627
3708
|
}
|
|
3628
3709
|
//#endregion
|
|
3629
3710
|
//#region src/core/removalReconciliationController.ts
|
|
3630
|
-
function
|
|
3711
|
+
function lr(e) {
|
|
3631
3712
|
return `${typeof e}:${String(e)}`;
|
|
3632
3713
|
}
|
|
3633
|
-
function
|
|
3714
|
+
function ur(e) {
|
|
3634
3715
|
return `${typeof e}:${String(e)}`;
|
|
3635
3716
|
}
|
|
3636
|
-
function
|
|
3717
|
+
function dr(e) {
|
|
3637
3718
|
return e.map(({ postId: e }) => e);
|
|
3638
3719
|
}
|
|
3639
|
-
var
|
|
3720
|
+
var fr = class {
|
|
3640
3721
|
delay;
|
|
3641
3722
|
enabled;
|
|
3642
3723
|
maxReplayPages;
|
|
@@ -3655,7 +3736,7 @@ var lr = class {
|
|
|
3655
3736
|
e.status === "complete" && (this.pages = [...this.pages.slice(0, e.replaceFrom), ...e.pages].slice(-this.maxReplayPages), this.pending = null);
|
|
3656
3737
|
}
|
|
3657
3738
|
filterItems(e) {
|
|
3658
|
-
return this.tombstones.size === 0 ? [...e] : e.filter(({ postId: e }) => !this.tombstones.has(
|
|
3739
|
+
return this.tombstones.size === 0 ? [...e] : e.filter(({ postId: e }) => !this.tombstones.has(lr(e)));
|
|
3659
3740
|
}
|
|
3660
3741
|
needsReconciliation(e) {
|
|
3661
3742
|
return this.pending !== null || this.findUnderfilledPage(e) >= 0;
|
|
@@ -3668,45 +3749,45 @@ var lr = class {
|
|
|
3668
3749
|
}
|
|
3669
3750
|
recordInitialPage(e) {
|
|
3670
3751
|
e && this.recordPages([{
|
|
3671
|
-
contributionIds:
|
|
3672
|
-
cursor:
|
|
3752
|
+
contributionIds: dr(e.items),
|
|
3753
|
+
cursor: $t(e),
|
|
3673
3754
|
next: e.next,
|
|
3674
|
-
returnedIds:
|
|
3755
|
+
returnedIds: dr(e.items)
|
|
3675
3756
|
}]);
|
|
3676
3757
|
}
|
|
3677
3758
|
remove(e) {
|
|
3678
|
-
e.forEach((e) => this.tombstones.add(
|
|
3759
|
+
e.forEach((e) => this.tombstones.add(lr(e)));
|
|
3679
3760
|
}
|
|
3680
3761
|
reset() {
|
|
3681
3762
|
this.pages = [], this.pending = null, this.tombstones.clear();
|
|
3682
3763
|
}
|
|
3683
3764
|
restore(e) {
|
|
3684
|
-
e.forEach((e) => this.tombstones.delete(
|
|
3765
|
+
e.forEach((e) => this.tombstones.delete(lr(e)));
|
|
3685
3766
|
}
|
|
3686
3767
|
async reconcile({ existingItems: e, loadPage: t, onDelayChange: n = () => void 0, shouldPause: r = () => !1, signal: i }) {
|
|
3687
3768
|
let a = this.pending ?? this.createSession(e);
|
|
3688
3769
|
for (this.pending = a; a.remainingRequests > 0;) {
|
|
3689
|
-
let e =
|
|
3770
|
+
let e = ur(a.cursor);
|
|
3690
3771
|
if (a.seenCursors.has(e)) throw Error("Vibe removal reconciliation received a repeated cursor.");
|
|
3691
|
-
if (await
|
|
3692
|
-
delayMs:
|
|
3772
|
+
if (await un({
|
|
3773
|
+
delayMs: cn(a.pages.length, this.delay),
|
|
3693
3774
|
onChange: n,
|
|
3694
3775
|
signal: i
|
|
3695
3776
|
}), a.pages.length > 0 && r()) return this.result(a, "paused");
|
|
3696
|
-
let o =
|
|
3777
|
+
let o = Yt(await t({
|
|
3697
3778
|
cursor: a.cursor,
|
|
3698
3779
|
signal: i
|
|
3699
3780
|
}));
|
|
3700
3781
|
a.seenCursors.add(e);
|
|
3701
3782
|
let s = this.filterItems(o.items), c = [];
|
|
3702
3783
|
if (s.forEach((e) => {
|
|
3703
|
-
let t =
|
|
3784
|
+
let t = lr(e.postId);
|
|
3704
3785
|
a.attributed.has(t) || (a.attributed.add(t), c.push(e.postId)), a.appended.has(t) || (a.appended.add(t), a.items.push(e));
|
|
3705
3786
|
}), a.pages.push({
|
|
3706
3787
|
contributionIds: c,
|
|
3707
3788
|
cursor: a.cursor,
|
|
3708
3789
|
next: o.next,
|
|
3709
|
-
returnedIds:
|
|
3790
|
+
returnedIds: dr(s)
|
|
3710
3791
|
}), 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");
|
|
3711
3792
|
}
|
|
3712
3793
|
return this.result(a, "complete");
|
|
@@ -3714,9 +3795,9 @@ var lr = class {
|
|
|
3714
3795
|
createSession(e) {
|
|
3715
3796
|
let t = this.findUnderfilledPage(e), n = t < 0 ? [] : this.pages.slice(t), r = n[0];
|
|
3716
3797
|
if (!r) throw Error("Vibe has no underfilled provider page to reconcile.");
|
|
3717
|
-
let i = new Set(n.flatMap(({ contributionIds: e }) => e.map(
|
|
3798
|
+
let i = new Set(n.flatMap(({ contributionIds: e }) => e.map(lr))), a = new Set(e.map(({ postId: e }) => lr(e)).filter((e) => !i.has(e)));
|
|
3718
3799
|
return {
|
|
3719
|
-
appended: new Set(e.map(({ postId: e }) =>
|
|
3800
|
+
appended: new Set(e.map(({ postId: e }) => lr(e))),
|
|
3720
3801
|
attributed: new Set(a),
|
|
3721
3802
|
cursor: r.cursor,
|
|
3722
3803
|
items: [],
|
|
@@ -3741,11 +3822,11 @@ var lr = class {
|
|
|
3741
3822
|
}
|
|
3742
3823
|
findUnderfilledPage(e) {
|
|
3743
3824
|
if (!this.enabled || this.pages.length === 0) return -1;
|
|
3744
|
-
let t = new Set(e.map(({ postId: e }) =>
|
|
3745
|
-
return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has(
|
|
3825
|
+
let t = new Set(e.map(({ postId: e }) => lr(e)));
|
|
3826
|
+
return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has(lr(e))).length < this.pageSize);
|
|
3746
3827
|
}
|
|
3747
3828
|
recordPage(e) {
|
|
3748
|
-
let t =
|
|
3829
|
+
let t = ur(e.cursor), n = this.pages.findIndex(({ cursor: e }) => ur(e) === t);
|
|
3749
3830
|
n >= 0 && (this.pages = this.pages.slice(0, n)), this.pages.push({
|
|
3750
3831
|
...e,
|
|
3751
3832
|
contributionIds: [...e.contributionIds],
|
|
@@ -3755,7 +3836,7 @@ var lr = class {
|
|
|
3755
3836
|
};
|
|
3756
3837
|
//#endregion
|
|
3757
3838
|
//#region src/core/activeItemRemoval.ts
|
|
3758
|
-
function
|
|
3839
|
+
function pr(e, t, n, r, i) {
|
|
3759
3840
|
let a = new Set(t.map(({ item: e }) => e.postId));
|
|
3760
3841
|
if (e.activeReelPostId === null || !a.has(e.activeReelPostId)) return;
|
|
3761
3842
|
let o = e.items[Math.max(n, 0)];
|
|
@@ -3768,7 +3849,7 @@ function ur(e, t, n, r, i) {
|
|
|
3768
3849
|
}
|
|
3769
3850
|
//#endregion
|
|
3770
3851
|
//#region src/core/exactMediaRemovalController.ts
|
|
3771
|
-
function
|
|
3852
|
+
function mr(e, t) {
|
|
3772
3853
|
let [n, ...r] = t;
|
|
3773
3854
|
if (!n) throw Error("Vibe items must contain at least one media asset.");
|
|
3774
3855
|
return {
|
|
@@ -3777,10 +3858,10 @@ function dr(e, t) {
|
|
|
3777
3858
|
items: r
|
|
3778
3859
|
};
|
|
3779
3860
|
}
|
|
3780
|
-
function
|
|
3861
|
+
function hr(e) {
|
|
3781
3862
|
if (!Number.isInteger(e.mediaIndex) || e.mediaIndex < 0) throw TypeError("Vibe mediaIndex must be a non-negative integer.");
|
|
3782
3863
|
}
|
|
3783
|
-
var
|
|
3864
|
+
var gr = class {
|
|
3784
3865
|
generation = 0;
|
|
3785
3866
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
3786
3867
|
state;
|
|
@@ -3788,7 +3869,7 @@ var pr = class {
|
|
|
3788
3869
|
this.options = e, this.state = e.state;
|
|
3789
3870
|
}
|
|
3790
3871
|
remove(e) {
|
|
3791
|
-
|
|
3872
|
+
hr(e);
|
|
3792
3873
|
let t = this.state.items.findIndex(({ postId: t }) => t === e.postId), n = this.state.items[t];
|
|
3793
3874
|
if (!n) return null;
|
|
3794
3875
|
let r = [...P(n)], i = r[e.mediaIndex];
|
|
@@ -3805,7 +3886,7 @@ var pr = class {
|
|
|
3805
3886
|
restored: !1
|
|
3806
3887
|
});
|
|
3807
3888
|
let o = this.state.mediaIndices.get(n.postId) ?? 0, s = this.isReelOpen() && this.state.activeReelPostId === n.postId, c = s && o === e.mediaIndex;
|
|
3808
|
-
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] =
|
|
3889
|
+
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = mr(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);
|
|
3809
3890
|
}
|
|
3810
3891
|
reset() {
|
|
3811
3892
|
this.generation += 1;
|
|
@@ -3831,7 +3912,7 @@ var pr = class {
|
|
|
3831
3912
|
}
|
|
3832
3913
|
restoreIntoPost(e, t) {
|
|
3833
3914
|
let n = this.state.items[e], r = [...P(n)], i = Math.min(t.mediaIndex, r.length);
|
|
3834
|
-
if (r.splice(i, 0, t.media), this.state.items[e] =
|
|
3915
|
+
if (r.splice(i, 0, t.media), this.state.items[e] = mr(n, r), this.state.activeReelPostId !== t.postId) return;
|
|
3835
3916
|
let a = this.state.mediaIndices.get(t.postId) ?? 0;
|
|
3836
3917
|
a >= i && this.state.mediaIndices.set(t.postId, a + 1);
|
|
3837
3918
|
}
|
|
@@ -3844,18 +3925,18 @@ var pr = class {
|
|
|
3844
3925
|
};
|
|
3845
3926
|
//#endregion
|
|
3846
3927
|
//#region src/core/itemPlacement.ts
|
|
3847
|
-
function
|
|
3928
|
+
function _r(e, t) {
|
|
3848
3929
|
let n = new Set(t);
|
|
3849
3930
|
return e.flatMap((e, t) => n.has(e.postId) ? [{
|
|
3850
3931
|
index: t,
|
|
3851
3932
|
item: e
|
|
3852
3933
|
}] : []);
|
|
3853
3934
|
}
|
|
3854
|
-
function
|
|
3935
|
+
function vr(e, t) {
|
|
3855
3936
|
let n = new Set(t.map(({ item: e }) => e.postId));
|
|
3856
3937
|
return e.filter((e) => !n.has(e.postId));
|
|
3857
3938
|
}
|
|
3858
|
-
function
|
|
3939
|
+
function yr(e, t) {
|
|
3859
3940
|
t.forEach(({ index: e }) => {
|
|
3860
3941
|
if (!Number.isInteger(e) || e < 0) throw Error("Vibe item restore indexes must be non-negative integers.");
|
|
3861
3942
|
});
|
|
@@ -3866,7 +3947,7 @@ function gr(e, t) {
|
|
|
3866
3947
|
}
|
|
3867
3948
|
//#endregion
|
|
3868
3949
|
//#region src/core/itemRemovalController.ts
|
|
3869
|
-
var
|
|
3950
|
+
var br = 20, xr = class {
|
|
3870
3951
|
generation = 0;
|
|
3871
3952
|
historyLimit;
|
|
3872
3953
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
@@ -3875,7 +3956,7 @@ var _r = 20, vr = class {
|
|
|
3875
3956
|
itemOrder;
|
|
3876
3957
|
stopItemsWatcher;
|
|
3877
3958
|
constructor(e) {
|
|
3878
|
-
this.options = e, this.historyLimit = e.historyLimit ??
|
|
3959
|
+
this.options = e, this.historyLimit = e.historyLimit ?? br, 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" });
|
|
3879
3960
|
}
|
|
3880
3961
|
destroy() {
|
|
3881
3962
|
this.reset(), this.stopItemsWatcher();
|
|
@@ -3889,7 +3970,7 @@ var _r = 20, vr = class {
|
|
|
3889
3970
|
let a = this.options.startRemoval(i, t);
|
|
3890
3971
|
if (a > 0 && await new Promise((e) => setTimeout(e, a)), this.metadata.get(r)?.generation !== this.generation) return r;
|
|
3891
3972
|
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);
|
|
3892
|
-
return this.state.items =
|
|
3973
|
+
return this.state.items = vr(this.state.items, n), this.options.onItemsRemoved(r, n, l), this.record(r), r;
|
|
3893
3974
|
}
|
|
3894
3975
|
reset() {
|
|
3895
3976
|
this.generation += 1, this.history = [], this.itemOrder = [];
|
|
@@ -3900,7 +3981,7 @@ var _r = 20, vr = class {
|
|
|
3900
3981
|
this.restoreRemoval(t);
|
|
3901
3982
|
return;
|
|
3902
3983
|
}
|
|
3903
|
-
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 =
|
|
3984
|
+
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 = yr(this.state.items, r);
|
|
3904
3985
|
this.registerExternalPlacements(r), this.state.items = i, r.length > 0 && this.options.onRemovalRestored(r);
|
|
3905
3986
|
}
|
|
3906
3987
|
restoreRemoval(e) {
|
|
@@ -3926,7 +4007,7 @@ var _r = 20, vr = class {
|
|
|
3926
4007
|
}
|
|
3927
4008
|
collectOrderedPlacements(e) {
|
|
3928
4009
|
let t = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
3929
|
-
return
|
|
4010
|
+
return _r(this.state.items, e).map((e) => ({
|
|
3930
4011
|
index: t.get(e.item.postId) ?? e.index,
|
|
3931
4012
|
item: e.item
|
|
3932
4013
|
}));
|
|
@@ -3957,7 +4038,7 @@ var _r = 20, vr = class {
|
|
|
3957
4038
|
let r = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
3958
4039
|
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;
|
|
3959
4040
|
}
|
|
3960
|
-
},
|
|
4041
|
+
}, Sr = class {
|
|
3961
4042
|
forward = null;
|
|
3962
4043
|
forwardPromise = null;
|
|
3963
4044
|
forwardVersion = 0;
|
|
@@ -4044,7 +4125,7 @@ var _r = 20, vr = class {
|
|
|
4044
4125
|
}
|
|
4045
4126
|
}
|
|
4046
4127
|
}
|
|
4047
|
-
},
|
|
4128
|
+
}, Cr = class {
|
|
4048
4129
|
generation = 0;
|
|
4049
4130
|
pending = Promise.resolve();
|
|
4050
4131
|
constructor(e) {
|
|
@@ -4094,24 +4175,24 @@ var _r = 20, vr = class {
|
|
|
4094
4175
|
};
|
|
4095
4176
|
//#endregion
|
|
4096
4177
|
//#region src/core/removalControllers.ts
|
|
4097
|
-
function
|
|
4098
|
-
let t = new
|
|
4178
|
+
function wr(e) {
|
|
4179
|
+
let t = new Sr(e), n = new Cr({
|
|
4099
4180
|
state: e.state,
|
|
4100
4181
|
transitionMedia: (t) => e.surface()?.transitionActiveReelMedia(t) ?? Promise.resolve(!1),
|
|
4101
4182
|
transitionPost: (t) => e.surface()?.transitionActiveReelPost(t) ?? Promise.resolve(!1)
|
|
4102
4183
|
});
|
|
4103
4184
|
return {
|
|
4104
|
-
exactMediaRemoval: new
|
|
4185
|
+
exactMediaRemoval: new gr({
|
|
4105
4186
|
onActivate: e.onActivate,
|
|
4106
4187
|
onPostRemoved: (t) => e.onItemsRemoved([t]),
|
|
4107
4188
|
onPostRestored: (t) => e.onItemsRestored([t]),
|
|
4108
4189
|
reelForward: t,
|
|
4109
4190
|
state: e.state
|
|
4110
4191
|
}),
|
|
4111
|
-
itemRemoval: new
|
|
4192
|
+
itemRemoval: new xr({
|
|
4112
4193
|
historyLimit: e.historyLimit,
|
|
4113
4194
|
onItemsRemoved: (n, r, i) => {
|
|
4114
|
-
e.onItemsRemoved(r.map(({ item: e }) => e.postId)),
|
|
4195
|
+
e.onItemsRemoved(r.map(({ item: e }) => e.postId)), pr(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
|
|
4115
4196
|
},
|
|
4116
4197
|
onRemovalRestored: (n) => {
|
|
4117
4198
|
e.onItemsRestored(n.map(({ item: e }) => e.postId));
|
|
@@ -4126,17 +4207,17 @@ function xr(e) {
|
|
|
4126
4207
|
reelRemoval: n
|
|
4127
4208
|
};
|
|
4128
4209
|
}
|
|
4129
|
-
var
|
|
4130
|
-
function
|
|
4210
|
+
var Tr = 1.5;
|
|
4211
|
+
function Er(e) {
|
|
4131
4212
|
let t = Math.min(e.screenWidth, e.screenHeight);
|
|
4132
4213
|
if (t > 0 && t < 600) return !0;
|
|
4133
|
-
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n *
|
|
4214
|
+
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * Tr;
|
|
4134
4215
|
return !e.hasHover && n > 0 && n < 600 && r;
|
|
4135
4216
|
}
|
|
4136
|
-
function
|
|
4137
|
-
return
|
|
4217
|
+
function Dr(e) {
|
|
4218
|
+
return Er(e) ? "reel" : "masonry";
|
|
4138
4219
|
}
|
|
4139
|
-
function
|
|
4220
|
+
function Or(e) {
|
|
4140
4221
|
let t = e.ownerDocument.defaultView, n = e.ownerDocument.documentElement;
|
|
4141
4222
|
return {
|
|
4142
4223
|
hasHover: typeof t?.matchMedia == "function" && t.matchMedia("(hover: hover)").matches,
|
|
@@ -4146,15 +4227,15 @@ function Tr(e) {
|
|
|
4146
4227
|
viewportWidth: n.clientWidth
|
|
4147
4228
|
};
|
|
4148
4229
|
}
|
|
4149
|
-
function
|
|
4150
|
-
return
|
|
4230
|
+
function kr(e) {
|
|
4231
|
+
return Er(Or(e));
|
|
4151
4232
|
}
|
|
4152
|
-
function
|
|
4153
|
-
return
|
|
4233
|
+
function Ar(e) {
|
|
4234
|
+
return Dr(Or(e));
|
|
4154
4235
|
}
|
|
4155
4236
|
//#endregion
|
|
4156
4237
|
//#region src/core/responsiveLayoutController.ts
|
|
4157
|
-
var
|
|
4238
|
+
var jr = class {
|
|
4158
4239
|
layoutMode;
|
|
4159
4240
|
resizeObserver = null;
|
|
4160
4241
|
target = null;
|
|
@@ -4179,10 +4260,24 @@ var Or = class {
|
|
|
4179
4260
|
}
|
|
4180
4261
|
handleResponsiveLayout = () => {
|
|
4181
4262
|
if (!this.target) return;
|
|
4182
|
-
let e =
|
|
4183
|
-
this.state.phoneMode =
|
|
4263
|
+
let e = Ar(this.target);
|
|
4264
|
+
this.state.phoneMode = kr(this.target), this.state.reelInfoSheetOverlay = this.state.phoneMode, this.state.reelMediaSource = this.state.phoneMode ? "mobile" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
|
|
4184
4265
|
};
|
|
4185
|
-
},
|
|
4266
|
+
}, Mr = class {
|
|
4267
|
+
state;
|
|
4268
|
+
constructor(e) {
|
|
4269
|
+
this.options = e, this.state = x(Ye({
|
|
4270
|
+
...e.initialReelAudioState,
|
|
4271
|
+
muted: e.initialReelAudioState?.muted ?? e.mediaCard?.videoMuted ?? !1
|
|
4272
|
+
}));
|
|
4273
|
+
}
|
|
4274
|
+
get() {
|
|
4275
|
+
return { ...this.state };
|
|
4276
|
+
}
|
|
4277
|
+
set(e, t = !1) {
|
|
4278
|
+
Object.assign(this.state, Ye(e, this.state)), t && this.options.onReelAudioStateChange?.(this.get());
|
|
4279
|
+
}
|
|
4280
|
+
}, Nr = class {
|
|
4186
4281
|
routedReelPostId = null;
|
|
4187
4282
|
reelRouteIsActive = !1;
|
|
4188
4283
|
constructor(e, t) {
|
|
@@ -4209,7 +4304,7 @@ var Or = class {
|
|
|
4209
4304
|
let i = this.reelRouteIsActive ? "replace" : "push";
|
|
4210
4305
|
this.reelRouteIsActive = !0, this.routedReelPostId = e, this.options.router[i](r);
|
|
4211
4306
|
}
|
|
4212
|
-
},
|
|
4307
|
+
}, Pr = class {
|
|
4213
4308
|
app = null;
|
|
4214
4309
|
autoScroll;
|
|
4215
4310
|
autofillController;
|
|
@@ -4229,26 +4324,27 @@ var Or = class {
|
|
|
4229
4324
|
stopStateWatcher = null;
|
|
4230
4325
|
lastLoadedCursor = null;
|
|
4231
4326
|
notificationItems;
|
|
4327
|
+
reelAudio;
|
|
4232
4328
|
state;
|
|
4233
4329
|
constructor(e) {
|
|
4234
|
-
this.options = e,
|
|
4330
|
+
this.options = e, or(e);
|
|
4235
4331
|
let t = e.layout ?? "masonry";
|
|
4236
|
-
this.state = x(
|
|
4332
|
+
this.state = x(rr(e, t)), this.reelAudio = new Mr(e), this.lastLoadedCursor = e.initialPage ? $t(e.initialPage) : null, this.notificationItems = R(this.state), this.autoScroll = new Dn({
|
|
4237
4333
|
getScrollElement: () => this.surface?.getAutoScrollElement() ?? null,
|
|
4238
4334
|
state: this.state.autoScroll
|
|
4239
|
-
}), this.autofillController = new
|
|
4335
|
+
}), this.autofillController = new xn({
|
|
4240
4336
|
cancelRequest: () => this.cancelRequest(),
|
|
4241
4337
|
onLastCursor: (e) => this.setCurrentCursor(e),
|
|
4242
4338
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
4243
4339
|
options: e.autofill,
|
|
4244
4340
|
state: this.state
|
|
4245
|
-
}), this.removalReconciliation = new
|
|
4341
|
+
}), this.removalReconciliation = new fr(e), this.removalReconciliation.recordInitialPage(e.initialPage), this.fillController = new Jn({
|
|
4246
4342
|
fill: e.fill,
|
|
4247
4343
|
loadPage: e.loadPage ? (e) => this.loadFilteredPage(e) : void 0,
|
|
4248
4344
|
needsFrontendPreparation: () => this.removalReconciliation.needsReconciliation(this.state.items),
|
|
4249
4345
|
onLastCursor: (e) => this.setCurrentCursor(e),
|
|
4250
4346
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
4251
|
-
prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) =>
|
|
4347
|
+
prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) => Yn({
|
|
4252
4348
|
controller: this.removalReconciliation,
|
|
4253
4349
|
isCurrent: t,
|
|
4254
4350
|
loadPage: e.loadPage,
|
|
@@ -4258,8 +4354,8 @@ var Or = class {
|
|
|
4258
4354
|
state: this.state
|
|
4259
4355
|
}),
|
|
4260
4356
|
state: this.state
|
|
4261
|
-
}), this.routing = new
|
|
4262
|
-
let n =
|
|
4357
|
+
}), this.routing = new Nr(e.routing, this.state);
|
|
4358
|
+
let n = wr({
|
|
4263
4359
|
historyLimit: e.removalHistoryLimit,
|
|
4264
4360
|
onActivate: (e) => this.setActiveReelPost(e),
|
|
4265
4361
|
onItemsRemoved: (e) => this.removalReconciliation.remove(e),
|
|
@@ -4268,25 +4364,26 @@ var Or = class {
|
|
|
4268
4364
|
state: this.state,
|
|
4269
4365
|
surface: () => this.surface
|
|
4270
4366
|
});
|
|
4271
|
-
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new
|
|
4367
|
+
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new jr(t, this.state, () => {
|
|
4272
4368
|
this.routing.syncFeed();
|
|
4273
4369
|
}), this.startStateNotifications();
|
|
4274
4370
|
}
|
|
4275
4371
|
async mount() {
|
|
4276
4372
|
if (this.app) throw Error("Vibe is already mounted.");
|
|
4277
4373
|
this.startStateNotifications();
|
|
4278
|
-
let e =
|
|
4279
|
-
this.responsiveLayout.mount(e), this.app = i(
|
|
4374
|
+
let e = sr(this.options.target);
|
|
4375
|
+
this.responsiveLayout.mount(e), this.app = i(Jt, {
|
|
4280
4376
|
canRetryEnd: !!this.options.loadPage,
|
|
4281
4377
|
cardFooter: this.options.cardFooter,
|
|
4282
4378
|
cardHeader: this.options.cardHeader,
|
|
4283
4379
|
feedFooter: this.options.feedFooter,
|
|
4284
|
-
feedFooterActions:
|
|
4380
|
+
feedFooterActions: Xn(this),
|
|
4285
4381
|
mediaCard: this.options.mediaCard,
|
|
4286
4382
|
masonry: this.options.masonry,
|
|
4287
4383
|
onMediaReady: this.options.onMediaReady,
|
|
4288
4384
|
onMediaVisible: this.options.onMediaVisible,
|
|
4289
4385
|
onReelMediaChange: this.options.onReelMediaChange,
|
|
4386
|
+
reelAudioState: this.reelAudio.state,
|
|
4290
4387
|
reelInfoSheet: this.options.reelInfoSheet,
|
|
4291
4388
|
state: this.state,
|
|
4292
4389
|
onActiveReelChange: (e) => {
|
|
@@ -4298,13 +4395,14 @@ var Or = class {
|
|
|
4298
4395
|
},
|
|
4299
4396
|
onOpenReel: (e) => this.openMasonryReel(e),
|
|
4300
4397
|
onReelInfoSheetChange: (e) => this.setReelInfoSheet(e),
|
|
4398
|
+
onReelAudioChange: (e) => this.reelAudio.set(e, !0),
|
|
4301
4399
|
onRetryEnd: () => {
|
|
4302
4400
|
this.retryEnd();
|
|
4303
4401
|
},
|
|
4304
4402
|
onRetryForward: () => {
|
|
4305
4403
|
this.retryReelForward();
|
|
4306
4404
|
}
|
|
4307
|
-
}), this.surface = this.app.mount(e), this.autoScroll.mount(), await
|
|
4405
|
+
}), this.surface = this.app.mount(e), this.autoScroll.mount(), await Mn(this.options.restoreBacklog, (e) => this.appendPage(e), (e) => {
|
|
4308
4406
|
this.restoreController = e;
|
|
4309
4407
|
}), !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();
|
|
4310
4408
|
}
|
|
@@ -4314,6 +4412,12 @@ var Or = class {
|
|
|
4314
4412
|
getState() {
|
|
4315
4413
|
return z(this.state);
|
|
4316
4414
|
}
|
|
4415
|
+
getReelAudioState() {
|
|
4416
|
+
return this.reelAudio.get();
|
|
4417
|
+
}
|
|
4418
|
+
setReelAudioState(e) {
|
|
4419
|
+
this.reelAudio.set(e);
|
|
4420
|
+
}
|
|
4317
4421
|
removeMedia(e) {
|
|
4318
4422
|
return this.exactMediaRemoval.remove(e);
|
|
4319
4423
|
}
|
|
@@ -4369,7 +4473,7 @@ var Or = class {
|
|
|
4369
4473
|
this.autoScroll.setSpeed(e);
|
|
4370
4474
|
}
|
|
4371
4475
|
applyAutofillUpdate(e) {
|
|
4372
|
-
let t =
|
|
4476
|
+
let t = An(this.options.autofill, this.state, e);
|
|
4373
4477
|
return t && this.autofillController.syncCountdown(), t;
|
|
4374
4478
|
}
|
|
4375
4479
|
cancelAutofill() {
|
|
@@ -4380,7 +4484,7 @@ var Or = class {
|
|
|
4380
4484
|
await this.cancelFill();
|
|
4381
4485
|
return;
|
|
4382
4486
|
}
|
|
4383
|
-
if (
|
|
4487
|
+
if (_n(this.state.autofill)) {
|
|
4384
4488
|
await this.cancelAutofill();
|
|
4385
4489
|
return;
|
|
4386
4490
|
}
|
|
@@ -4394,12 +4498,12 @@ var Or = class {
|
|
|
4394
4498
|
}
|
|
4395
4499
|
async fill(e) {
|
|
4396
4500
|
if (!this.state.loadMoreLocked) {
|
|
4397
|
-
if (this.pendingRequest ||
|
|
4501
|
+
if (this.pendingRequest || _n(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
|
|
4398
4502
|
await this.fillController.start(e);
|
|
4399
4503
|
}
|
|
4400
4504
|
}
|
|
4401
4505
|
restoreAutofillSession(e) {
|
|
4402
|
-
let t =
|
|
4506
|
+
let t = jn(this.options.autofill, this.state, e);
|
|
4403
4507
|
return t && this.autofillController.syncCountdown(), t;
|
|
4404
4508
|
}
|
|
4405
4509
|
restoreFillSession(e) {
|
|
@@ -4409,14 +4513,14 @@ var Or = class {
|
|
|
4409
4513
|
return this.startLoadMore(() => this.loadNextSequence());
|
|
4410
4514
|
}
|
|
4411
4515
|
appendPage(e) {
|
|
4412
|
-
|
|
4516
|
+
en(e, this.state, this.removalReconciliation, (e) => this.setCurrentCursor(e));
|
|
4413
4517
|
}
|
|
4414
4518
|
replenishAfterRemoval() {
|
|
4415
4519
|
return this.startLoadMore(() => this.replenishAfterRemovalSequence());
|
|
4416
4520
|
}
|
|
4417
4521
|
async startLoadMore(e) {
|
|
4418
4522
|
if (this.pendingRequest) return this.pendingRequest;
|
|
4419
|
-
if (this.state.loadMoreLocked ||
|
|
4523
|
+
if (this.state.loadMoreLocked || _n(this.state.autofill) || this.fillController.isActive() || !this.options.loadPage || this.state.next === null && !this.removalReconciliation.needsReconciliation(this.state.items)) return;
|
|
4420
4524
|
this.state.isLoadingMore = !0, this.state.nextPageError = null;
|
|
4421
4525
|
let t = e();
|
|
4422
4526
|
return this.pendingRequest = t, t.finally(() => {
|
|
@@ -4431,12 +4535,12 @@ var Or = class {
|
|
|
4431
4535
|
}
|
|
4432
4536
|
async replaceFeed(e, t) {
|
|
4433
4537
|
if (!this.options.loadPage) throw Error(`Vibe cannot ${t} without loadPage.`);
|
|
4434
|
-
return
|
|
4538
|
+
return _n(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.state.autofill = gn(this.options.autofill, void 0, !1), this.fillController.reset(), this.reelForward.reset(), this.reelRemoval.reset(), this.exactMediaRemoval.reset(), this.itemRemoval.reset(), this.removalReconciliation.reset(), 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);
|
|
4435
4539
|
}
|
|
4436
4540
|
async loadFilteredPage(e) {
|
|
4437
4541
|
let t = this.options.loadPage;
|
|
4438
4542
|
if (!t) throw Error("Vibe cannot load a page without loadPage.");
|
|
4439
|
-
let n =
|
|
4543
|
+
let n = Yt(await t(e));
|
|
4440
4544
|
return {
|
|
4441
4545
|
...n,
|
|
4442
4546
|
items: this.removalReconciliation.filterItems(n.items)
|
|
@@ -4455,7 +4559,7 @@ var Or = class {
|
|
|
4455
4559
|
let t = ++this.requestVersion, n = new AbortController();
|
|
4456
4560
|
this.abortController = n;
|
|
4457
4561
|
try {
|
|
4458
|
-
let r = await
|
|
4562
|
+
let r = await Yn({
|
|
4459
4563
|
controller: this.removalReconciliation,
|
|
4460
4564
|
isCurrent: () => t === this.requestVersion,
|
|
4461
4565
|
loadPage: e,
|
|
@@ -4473,7 +4577,7 @@ var Or = class {
|
|
|
4473
4577
|
}
|
|
4474
4578
|
async retryEnd() {
|
|
4475
4579
|
if (this.pendingRequest) return this.pendingRequest;
|
|
4476
|
-
if (!this.state.loadMoreLocked && !(
|
|
4580
|
+
if (!this.state.loadMoreLocked && !(_n(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);
|
|
4477
4581
|
}
|
|
4478
4582
|
setInfiniteScroll(e) {
|
|
4479
4583
|
this.state.infiniteScroll = e, e && m(() => this.surface?.loadIfNearBottom());
|
|
@@ -4497,10 +4601,10 @@ var Or = class {
|
|
|
4497
4601
|
this.state.total = e;
|
|
4498
4602
|
}
|
|
4499
4603
|
setReelAutoAdvance(e) {
|
|
4500
|
-
|
|
4604
|
+
er(this.state.reelAutoAdvance, e);
|
|
4501
4605
|
}
|
|
4502
4606
|
setReelInfoSheet(e) {
|
|
4503
|
-
|
|
4607
|
+
nr(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
|
|
4504
4608
|
}
|
|
4505
4609
|
setLayout(e) {
|
|
4506
4610
|
this.responsiveLayout.setLayout(e);
|
|
@@ -4520,7 +4624,7 @@ var Or = class {
|
|
|
4520
4624
|
async fetchPage(e, t) {
|
|
4521
4625
|
if (!this.options.loadPage) return;
|
|
4522
4626
|
let n = ++this.requestVersion, r = new AbortController();
|
|
4523
|
-
this.abortController = r, await
|
|
4627
|
+
this.abortController = r, await cr({
|
|
4524
4628
|
append: t,
|
|
4525
4629
|
autofillController: this.autofillController,
|
|
4526
4630
|
cursor: e,
|
|
@@ -4542,7 +4646,7 @@ var Or = class {
|
|
|
4542
4646
|
startInitialAutofill() {
|
|
4543
4647
|
let e = ++this.requestVersion, t = new AbortController(), n = this.autofillController.beginCycle();
|
|
4544
4648
|
this.abortController = t, this.state.isLoadingMore = !0;
|
|
4545
|
-
let r =
|
|
4649
|
+
let r = Nn({
|
|
4546
4650
|
cycleId: n,
|
|
4547
4651
|
isCurrent: () => e === this.requestVersion,
|
|
4548
4652
|
onCollection: (t) => this.autofillController.captureCollection(t, e === this.requestVersion),
|
|
@@ -4569,8 +4673,8 @@ var Or = class {
|
|
|
4569
4673
|
this.lastLoadedCursor = e, this.state.current = e;
|
|
4570
4674
|
}
|
|
4571
4675
|
};
|
|
4572
|
-
function
|
|
4573
|
-
return new
|
|
4676
|
+
function Fr(e) {
|
|
4677
|
+
return new Pr(e);
|
|
4574
4678
|
}
|
|
4575
4679
|
//#endregion
|
|
4576
|
-
export {
|
|
4680
|
+
export { Fr as createVibe };
|