@wyxos/vibe 5.8.1 → 5.8.2
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 +0 -5
- package/lib/components/useMediaLoading.d.ts +1 -1
- package/lib/core/mediaCardOptions.d.ts +0 -1
- package/lib/index.cjs +1 -1
- package/lib/index.js +305 -347
- package/package.json +1 -1
- package/lib/components/useFeedReplacementPreload.d.ts +0 -11
- package/lib/core/feedReplacementPreload.d.ts +0 -3
package/lib/index.js
CHANGED
|
@@ -820,53 +820,8 @@ function Qe(e) {
|
|
|
820
820
|
};
|
|
821
821
|
}
|
|
822
822
|
//#endregion
|
|
823
|
-
//#region src/core/mediaType.ts
|
|
824
|
-
var $e = /\.(aac|flac|m4a|mp3|mp4|mov|ogg|opus|wav|webm)$/i;
|
|
825
|
-
function et(e) {
|
|
826
|
-
try {
|
|
827
|
-
return $e.test(new URL(e).pathname);
|
|
828
|
-
} catch {
|
|
829
|
-
return $e.test(e.split("?")[0] ?? e);
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
|
-
function tt(e, t) {
|
|
833
|
-
return e === void 0 ? et(t) : e === "video";
|
|
834
|
-
}
|
|
835
|
-
//#endregion
|
|
836
|
-
//#region src/core/feedReplacementPreload.ts
|
|
837
|
-
function nt(e, t, n) {
|
|
838
|
-
let r = P(e);
|
|
839
|
-
if (r.length < 2) return null;
|
|
840
|
-
let i = F(e, t), a = r[i < r.length - 1 ? i + 1 : i - 1];
|
|
841
|
-
return a ? N(a, n) : null;
|
|
842
|
-
}
|
|
843
|
-
function rt(e) {
|
|
844
|
-
if (tt(e.type, e.src)) {
|
|
845
|
-
let t = document.createElement("video");
|
|
846
|
-
return t.muted = !0, t.playsInline = !0, t.preload = "auto", t.src = e.src, t.load(), () => {
|
|
847
|
-
t.pause(), t.removeAttribute("src"), t.load();
|
|
848
|
-
};
|
|
849
|
-
}
|
|
850
|
-
let t = document.createElement("img");
|
|
851
|
-
return t.decoding = "async", t.fetchPriority = "low", t.src = e.src, t.decode?.().catch(() => void 0), () => {
|
|
852
|
-
t.onload = null, t.onerror = null;
|
|
853
|
-
};
|
|
854
|
-
}
|
|
855
|
-
//#endregion
|
|
856
|
-
//#region src/components/useFeedReplacementPreload.ts
|
|
857
|
-
function it(e) {
|
|
858
|
-
let t = r(() => e.layout() === "masonry" && e.mediaCard()?.feedPreload === "replacement"), n = r(() => !t.value || !e.mediaReady() ? null : nt(e.item(), e.mediaIndex(), e.mediaSource())), i = null;
|
|
859
|
-
O([
|
|
860
|
-
t,
|
|
861
|
-
() => e.mediaReady(),
|
|
862
|
-
() => n.value && `${n.value.type ?? ""}:${n.value.src}`
|
|
863
|
-
], ([e, t]) => {
|
|
864
|
-
e && !t || (i?.(), i = e && n.value ? rt(n.value) : null);
|
|
865
|
-
}, { immediate: !0 }), v(() => i?.());
|
|
866
|
-
}
|
|
867
|
-
//#endregion
|
|
868
823
|
//#region src/components/useReelVideoActivity.ts
|
|
869
|
-
function
|
|
824
|
+
function $e(e) {
|
|
870
825
|
let t = r(() => e.layout() !== "reel" || e.active() === !0), n = r(() => t.value ? e.videoIsMuted.value : !0);
|
|
871
826
|
function i() {
|
|
872
827
|
if (!t.value) {
|
|
@@ -899,9 +854,22 @@ function at(e) {
|
|
|
899
854
|
};
|
|
900
855
|
}
|
|
901
856
|
//#endregion
|
|
857
|
+
//#region src/core/mediaType.ts
|
|
858
|
+
var et = /\.(aac|flac|m4a|mp3|mp4|mov|ogg|opus|wav|webm)$/i;
|
|
859
|
+
function tt(e) {
|
|
860
|
+
try {
|
|
861
|
+
return et.test(new URL(e).pathname);
|
|
862
|
+
} catch {
|
|
863
|
+
return et.test(e.split("?")[0] ?? e);
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
function nt(e, t) {
|
|
867
|
+
return e === void 0 ? tt(t) : e === "video";
|
|
868
|
+
}
|
|
869
|
+
//#endregion
|
|
902
870
|
//#region src/components/useMediaLoading.ts
|
|
903
|
-
function
|
|
904
|
-
let t = r(() =>
|
|
871
|
+
function rt(e) {
|
|
872
|
+
let t = r(() => nt(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");
|
|
905
873
|
return O(i, (t, n) => {
|
|
906
874
|
n !== "none" || t === "none" || m(() => e.videoElement.value?.load());
|
|
907
875
|
}), {
|
|
@@ -912,7 +880,7 @@ function ot(e) {
|
|
|
912
880
|
}
|
|
913
881
|
//#endregion
|
|
914
882
|
//#region src/components/useMediaReadiness.ts
|
|
915
|
-
function
|
|
883
|
+
function it(e) {
|
|
916
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());
|
|
917
885
|
function f() {
|
|
918
886
|
l !== null && clearTimeout(l), l = null;
|
|
@@ -970,7 +938,7 @@ function st(e) {
|
|
|
970
938
|
}
|
|
971
939
|
//#endregion
|
|
972
940
|
//#region src/components/MediaCard.vue?vue&type=script&setup=true&lang.ts
|
|
973
|
-
var
|
|
941
|
+
var at = [
|
|
974
942
|
"data-post-id",
|
|
975
943
|
"data-media-index",
|
|
976
944
|
"aria-hidden",
|
|
@@ -978,12 +946,12 @@ var ct = [
|
|
|
978
946
|
"inert",
|
|
979
947
|
"role",
|
|
980
948
|
"tabindex"
|
|
981
|
-
],
|
|
949
|
+
], ot = { class: "media-card-content" }, st = ["data-media-direction"], ct = ["data-media-index"], lt = {
|
|
982
950
|
key: 0,
|
|
983
951
|
"data-test": "media-loading",
|
|
984
952
|
class: "media-loading",
|
|
985
953
|
"aria-hidden": "true"
|
|
986
|
-
},
|
|
954
|
+
}, ut = [
|
|
987
955
|
"data-source-generation",
|
|
988
956
|
"src",
|
|
989
957
|
"width",
|
|
@@ -992,14 +960,14 @@ var ct = [
|
|
|
992
960
|
"loop",
|
|
993
961
|
"muted",
|
|
994
962
|
"preload"
|
|
995
|
-
],
|
|
963
|
+
], dt = [
|
|
996
964
|
"data-source-generation",
|
|
997
965
|
"src",
|
|
998
966
|
"width",
|
|
999
967
|
"height",
|
|
1000
968
|
"fetchpriority",
|
|
1001
969
|
"loading"
|
|
1002
|
-
],
|
|
970
|
+
], ft = ["aria-label"], pt = ["aria-label"], mt = ["aria-label"], ht = 40, gt = 160, _t = 24, vt = /* @__PURE__ */ d({
|
|
1003
971
|
__name: "MediaCard",
|
|
1004
972
|
props: {
|
|
1005
973
|
active: { type: Boolean },
|
|
@@ -1037,29 +1005,20 @@ var ct = [
|
|
|
1037
1005
|
function S(e = !1, t = "pointer") {
|
|
1038
1006
|
e && x("activate", t);
|
|
1039
1007
|
}
|
|
1040
|
-
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: H, markSourceReady: U, noteSourceActivity: W, retrySource: ee, retrying: te, sourceGeneration: G, videoElement: K } =
|
|
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: H, markSourceReady: U, noteSourceActivity: W, retrySource: ee, retrying: te, sourceGeneration: G, videoElement: K } = it({
|
|
1041
1009
|
identity: () => `${l.item.postId}:${T.value}:${l.mediaSource ?? "preview"}:${M.value}:${L.value ?? ""}`,
|
|
1042
1010
|
mediaIndex: () => T.value,
|
|
1043
1011
|
onError: (e) => x("error", e),
|
|
1044
1012
|
onReady: (e) => x("ready", e),
|
|
1045
1013
|
previewState: () => l.previewState
|
|
1046
|
-
})
|
|
1047
|
-
it({
|
|
1048
|
-
item: () => l.item,
|
|
1049
|
-
layout: () => l.layout,
|
|
1050
|
-
mediaCard: () => l.mediaCard,
|
|
1051
|
-
mediaIndex: () => T.value,
|
|
1052
|
-
mediaReady: () => B.value === "ready",
|
|
1053
|
-
mediaSource: () => l.mediaSource ?? "preview"
|
|
1054
|
-
});
|
|
1055
|
-
let ne = w(0), re = w(0), q = w(!1), { apply: ie, setVolume: ae, sync: oe, toggleMute: se, videoIsMuted: J, videoVolume: ce } = Qe({
|
|
1014
|
+
}), ne = w(0), re = w(0), q = w(!1), { apply: ie, setVolume: ae, sync: oe, toggleMute: se, videoIsMuted: J, videoVolume: ce } = Qe({
|
|
1056
1015
|
active: () => l.active,
|
|
1057
1016
|
layout: () => l.layout,
|
|
1058
1017
|
mediaCard: () => l.mediaCard,
|
|
1059
1018
|
onChange: (e) => x("reelAudioChange", e),
|
|
1060
1019
|
reelAudioState: () => l.reelAudioState,
|
|
1061
1020
|
videoElement: K
|
|
1062
|
-
}), { effectiveMuted: le, onPlaying: ue, playbackAllowed: de } =
|
|
1021
|
+
}), { effectiveMuted: le, onPlaying: ue, playbackAllowed: de } = $e({
|
|
1063
1022
|
active: () => l.active,
|
|
1064
1023
|
layout: () => l.layout,
|
|
1065
1024
|
videoElement: K,
|
|
@@ -1080,12 +1039,12 @@ var ct = [
|
|
|
1080
1039
|
f = 0, p = !1, d !== null && clearTimeout(d), d = null;
|
|
1081
1040
|
}
|
|
1082
1041
|
function he() {
|
|
1083
|
-
d !== null && clearTimeout(d), d = setTimeout(me,
|
|
1042
|
+
d !== null && clearTimeout(d), d = setTimeout(me, gt);
|
|
1084
1043
|
}
|
|
1085
1044
|
function ge(e) {
|
|
1086
1045
|
if (C.value.length <= 1) return;
|
|
1087
1046
|
let t = e.currentTarget?.clientWidth || 1, n = pe(e.deltaX, e.deltaMode, t);
|
|
1088
|
-
if (n === 0 || (e.preventDefault(), he(), p) || (f += n, Math.abs(f) <
|
|
1047
|
+
if (n === 0 || (e.preventDefault(), he(), p) || (f += n, Math.abs(f) < _t)) return;
|
|
1089
1048
|
let r = Math.sign(f);
|
|
1090
1049
|
f = 0, p = !0, X(T.value + r);
|
|
1091
1050
|
}
|
|
@@ -1097,9 +1056,9 @@ var ct = [
|
|
|
1097
1056
|
let t = e.changedTouches[0];
|
|
1098
1057
|
if (m === null || g === null || !t) return;
|
|
1099
1058
|
let n = m - t.clientX, r = g - t.clientY;
|
|
1100
|
-
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) < ht || X(T.value + Math.sign(n)));
|
|
1101
1060
|
}
|
|
1102
|
-
let { imageLoading: ye, mediaIsTimed: be, videoPreload: xe } =
|
|
1061
|
+
let { imageLoading: ye, mediaIsTimed: be, videoPreload: xe } = rt({
|
|
1103
1062
|
active: () => l.active,
|
|
1104
1063
|
fetchPriority: () => l.fetchPriority,
|
|
1105
1064
|
layout: () => l.layout,
|
|
@@ -1159,7 +1118,7 @@ var ct = [
|
|
|
1159
1118
|
tabindex: e.interactive && !e.leaving && !Y.value ? 0 : void 0,
|
|
1160
1119
|
onClick: i[14] ||= (t) => S(e.interactive && !Y.value, fe(t)),
|
|
1161
1120
|
onKeydown: [i[15] ||= A((t) => S(e.interactive && !Y.value, "keyboard"), ["enter"]), i[16] ||= A(j((t) => S(e.interactive && !Y.value, "keyboard"), ["prevent"]), ["space"])]
|
|
1162
|
-
}, [c("div",
|
|
1121
|
+
}, [c("div", ot, [
|
|
1163
1122
|
e.cardHeader ? (b(), a(Ie, {
|
|
1164
1123
|
key: 0,
|
|
1165
1124
|
index: e.index,
|
|
@@ -1198,7 +1157,7 @@ var ct = [
|
|
|
1198
1157
|
key: `${e.item.postId}:${D.value.src}:${e.mediaSource ?? "preview"}:${E(G)}`,
|
|
1199
1158
|
class: "media-card-frame",
|
|
1200
1159
|
"data-media-index": T.value
|
|
1201
|
-
}, [E(B) === "loading" ? (b(), s("div",
|
|
1160
|
+
}, [E(B) === "loading" ? (b(), s("div", lt, [...i[17] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : E(B) === "error" ? (b(), a(Be, {
|
|
1202
1161
|
key: 1,
|
|
1203
1162
|
component: e.mediaCard?.error?.component,
|
|
1204
1163
|
label: E(Fe)(M.value),
|
|
@@ -1240,7 +1199,7 @@ var ct = [
|
|
|
1240
1199
|
onEnded: Me,
|
|
1241
1200
|
onClick: Te,
|
|
1242
1201
|
onError: i[5] ||= (...e) => E(V) && E(V)(...e)
|
|
1243
|
-
}, null, 42,
|
|
1202
|
+
}, null, 42, ut)) : (b(), s("img", {
|
|
1244
1203
|
key: 3,
|
|
1245
1204
|
ref_key: "imageElement",
|
|
1246
1205
|
ref: H,
|
|
@@ -1255,7 +1214,7 @@ var ct = [
|
|
|
1255
1214
|
loading: E(ye),
|
|
1256
1215
|
onLoad: i[6] ||= (...e) => E(U) && E(U)(...e),
|
|
1257
1216
|
onError: i[7] ||= (...e) => E(V) && E(V)(...e)
|
|
1258
|
-
}, null, 42,
|
|
1217
|
+
}, null, 42, dt))], 8, ct))]),
|
|
1259
1218
|
_: 1
|
|
1260
1219
|
}, 8, ["css", "name"]),
|
|
1261
1220
|
(b(), a(t, {
|
|
@@ -1301,13 +1260,13 @@ var ct = [
|
|
|
1301
1260
|
"aria-label": `Previous media for post ${e.item.postId}`,
|
|
1302
1261
|
onClick: i[8] ||= j((e) => X(T.value - 1, e), ["stop"]),
|
|
1303
1262
|
onKeydown: i[9] ||= j(() => {}, ["stop"])
|
|
1304
|
-
}, [u(E(De), { size: 20 })], 40,
|
|
1263
|
+
}, [u(E(De), { size: 20 })], 40, ft), c("button", {
|
|
1305
1264
|
type: "button",
|
|
1306
1265
|
class: "media-carousel-control media-carousel-control--next",
|
|
1307
1266
|
"aria-label": `Next media for post ${e.item.postId}`,
|
|
1308
1267
|
onClick: i[10] ||= j((e) => X(T.value + 1, e), ["stop"]),
|
|
1309
1268
|
onKeydown: i[11] ||= j(() => {}, ["stop"])
|
|
1310
|
-
}, [u(E(Oe), { size: 20 })], 40,
|
|
1269
|
+
}, [u(E(Oe), { size: 20 })], 40, pt)], 2)) : o("", !0),
|
|
1311
1270
|
Y.value ? (b(), s("button", {
|
|
1312
1271
|
key: 1,
|
|
1313
1272
|
class: "media-card-activator",
|
|
@@ -1315,8 +1274,8 @@ var ct = [
|
|
|
1315
1274
|
"aria-label": `Open post ${e.item.postId}`,
|
|
1316
1275
|
onClick: i[12] ||= j((e) => r.$emit("activate", fe(e)), ["stop"]),
|
|
1317
1276
|
onKeydown: i[13] ||= j(() => {}, ["stop"])
|
|
1318
|
-
}, null, 40,
|
|
1319
|
-
], 42,
|
|
1277
|
+
}, null, 40, mt)) : o("", !0)
|
|
1278
|
+
], 42, st),
|
|
1320
1279
|
e.cardFooter ? (b(), a(Ie, {
|
|
1321
1280
|
key: 1,
|
|
1322
1281
|
index: e.index,
|
|
@@ -1340,12 +1299,12 @@ var ct = [
|
|
|
1340
1299
|
"style",
|
|
1341
1300
|
"total"
|
|
1342
1301
|
])) : o("", !0)
|
|
1343
|
-
])], 46,
|
|
1302
|
+
])], 46, at));
|
|
1344
1303
|
}
|
|
1345
|
-
}),
|
|
1304
|
+
}), yt = { class: "masonry-feed-shell" }, bt = ["aria-hidden", "inert"], xt = {
|
|
1346
1305
|
key: 0,
|
|
1347
1306
|
class: "masonry-feed-status-overlay"
|
|
1348
|
-
},
|
|
1307
|
+
}, St = 6, Ct = 12, wt = 250, Tt = /* @__PURE__ */ d({
|
|
1349
1308
|
__name: "MasonryFeed",
|
|
1350
1309
|
props: {
|
|
1351
1310
|
enteringPostIds: {},
|
|
@@ -1382,7 +1341,7 @@ var ct = [
|
|
|
1382
1341
|
"visible"
|
|
1383
1342
|
],
|
|
1384
1343
|
setup(t, { expose: n, emit: i }) {
|
|
1385
|
-
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(St), 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(() => oe(d.items, y.value, {
|
|
1386
1345
|
additionalHeight: (d.cardHeader?.height ?? 0) + (d.cardFooter?.height ?? 0),
|
|
1387
1346
|
gap: x.value,
|
|
1388
1347
|
minColumnWidth: le(d.masonry)
|
|
@@ -1493,7 +1452,7 @@ var ct = [
|
|
|
1493
1452
|
}
|
|
1494
1453
|
function pe(e) {
|
|
1495
1454
|
let t = e.ownerDocument.documentElement.clientWidth;
|
|
1496
|
-
y.value = e.clientWidth, x.value = Math.min(
|
|
1455
|
+
y.value = e.clientWidth, x.value = Math.min(Ct, Math.max(St, t * .0075)), X();
|
|
1497
1456
|
}
|
|
1498
1457
|
function me(e) {
|
|
1499
1458
|
let t = e.currentTarget;
|
|
@@ -1504,7 +1463,7 @@ var ct = [
|
|
|
1504
1463
|
Date.now() >= l && !d.loadMoreLocked && e && re(e) && f("loadMore");
|
|
1505
1464
|
}
|
|
1506
1465
|
O(() => d.items.length, (e, t) => {
|
|
1507
|
-
e > 0 && e < t && (l = Date.now() +
|
|
1466
|
+
e > 0 && e < t && (l = Date.now() + wt);
|
|
1508
1467
|
});
|
|
1509
1468
|
function ge() {
|
|
1510
1469
|
return p.value;
|
|
@@ -1527,7 +1486,7 @@ var ct = [
|
|
|
1527
1486
|
}), n({
|
|
1528
1487
|
getScrollElement: ge,
|
|
1529
1488
|
loadIfNearBottom: he
|
|
1530
|
-
}), (n, r) => (b(), s("div",
|
|
1489
|
+
}), (n, r) => (b(), s("div", yt, [
|
|
1531
1490
|
c("main", {
|
|
1532
1491
|
id: m,
|
|
1533
1492
|
ref_key: "galleryElement",
|
|
@@ -1543,7 +1502,7 @@ var ct = [
|
|
|
1543
1502
|
class: h(["masonry", { "masonry--ready": y.value > 0 }]),
|
|
1544
1503
|
style: _(W.value),
|
|
1545
1504
|
"aria-label": "Media gallery"
|
|
1546
|
-
}, [(b(!0), s(e, null, S(K.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(
|
|
1505
|
+
}, [(b(!0), s(e, null, S(K.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(vt, {
|
|
1547
1506
|
key: n.postId,
|
|
1548
1507
|
class: "masonry-item",
|
|
1549
1508
|
entering: t.enteringPostIds.has(n.postId),
|
|
@@ -1583,8 +1542,8 @@ var ct = [
|
|
|
1583
1542
|
"onMediaChange",
|
|
1584
1543
|
"onReady",
|
|
1585
1544
|
"onError"
|
|
1586
|
-
]))), 128))], 6)], 42,
|
|
1587
|
-
t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && ee.value || !t.hasNext && t.canRetryEnd ? (b(), s("div",
|
|
1545
|
+
]))), 128))], 6)], 42, bt),
|
|
1546
|
+
t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && ee.value || !t.hasNext && t.canRetryEnd ? (b(), s("div", xt, [u(te, {
|
|
1588
1547
|
actions: t.feedFooterActions,
|
|
1589
1548
|
"can-retry-end": t.canRetryEnd,
|
|
1590
1549
|
"feed-footer": t.feedFooter,
|
|
@@ -1619,8 +1578,8 @@ var ct = [
|
|
|
1619
1578
|
])
|
|
1620
1579
|
]));
|
|
1621
1580
|
}
|
|
1622
|
-
}),
|
|
1623
|
-
function
|
|
1581
|
+
}), Et = 300;
|
|
1582
|
+
function Dt(e, t, n) {
|
|
1624
1583
|
let r = e.scrollTop;
|
|
1625
1584
|
if (n || Math.abs(r - t) <= 1) return e.scrollTop = t, Promise.resolve();
|
|
1626
1585
|
e.setAttribute("data-transitioning", "");
|
|
@@ -1628,7 +1587,7 @@ function At(e, t, n) {
|
|
|
1628
1587
|
return new Promise((n) => {
|
|
1629
1588
|
let o = (s) => {
|
|
1630
1589
|
a += 1;
|
|
1631
|
-
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 / Et), u = 1 - (1 - l) ** 3;
|
|
1632
1591
|
if (e.scrollTop = r + (t - r) * u, l < 1) {
|
|
1633
1592
|
requestAnimationFrame(o);
|
|
1634
1593
|
return;
|
|
@@ -1640,7 +1599,7 @@ function At(e, t, n) {
|
|
|
1640
1599
|
}
|
|
1641
1600
|
//#endregion
|
|
1642
1601
|
//#region src/components/ReelAutoAdvanceProgress.vue?vue&type=script&setup=true&lang.ts
|
|
1643
|
-
var
|
|
1602
|
+
var Ot = ["aria-label"], kt = /* @__PURE__ */ d({
|
|
1644
1603
|
__name: "ReelAutoAdvanceProgress",
|
|
1645
1604
|
props: {
|
|
1646
1605
|
durationMs: {},
|
|
@@ -1658,9 +1617,9 @@ var jt = ["aria-label"], Mt = /* @__PURE__ */ d({
|
|
|
1658
1617
|
class: "reel-auto-advance-progress",
|
|
1659
1618
|
style: _(a.value),
|
|
1660
1619
|
onAnimationend: n[0] ||= (e) => i("complete")
|
|
1661
|
-
}, null, 36)], 8,
|
|
1620
|
+
}, null, 36)], 8, Ot));
|
|
1662
1621
|
}
|
|
1663
|
-
}),
|
|
1622
|
+
}), At = { class: "reel-viewport" }, jt = ["data-active-post-id", "data-active-media-index"], Mt = ["role", "data-status"], Nt = 300, Pt = 250, Ft = /* @__PURE__ */ d({
|
|
1664
1623
|
__name: "ReelFeed",
|
|
1665
1624
|
props: {
|
|
1666
1625
|
initialPostId: {},
|
|
@@ -1712,7 +1671,7 @@ var jt = ["aria-label"], Mt = /* @__PURE__ */ d({
|
|
|
1712
1671
|
}), H = r(() => {
|
|
1713
1672
|
let e = z.value;
|
|
1714
1673
|
return e === void 0 ? "loading" : u.previewStates.get(L(e, V.value)) ?? "loading";
|
|
1715
|
-
}), U = r(() => B.value ? I(B.value, V.value) : null), W = r(() => U.value ? N(U.value, u.mediaSource ?? "preview") : null), ee = r(() => H.value === "ready" && !!(W.value &&
|
|
1674
|
+
}), U = r(() => B.value ? I(B.value, V.value) : null), W = r(() => U.value ? N(U.value, u.mediaSource ?? "preview") : null), ee = r(() => H.value === "ready" && !!(W.value && nt(W.value.type, W.value.src))), G = r(() => [
|
|
1716
1675
|
z.value,
|
|
1717
1676
|
V.value,
|
|
1718
1677
|
u.items.length,
|
|
@@ -1763,7 +1722,7 @@ var jt = ["aria-label"], Mt = /* @__PURE__ */ d({
|
|
|
1763
1722
|
Date.now() >= l && !u.loadMoreLocked && e && re(e) && d("loadMore");
|
|
1764
1723
|
}
|
|
1765
1724
|
O(() => u.items.length, (e, t) => {
|
|
1766
|
-
e > 0 && e < t && (l = Date.now() +
|
|
1725
|
+
e > 0 && e < t && (l = Date.now() + Pt);
|
|
1767
1726
|
});
|
|
1768
1727
|
function Y(e) {
|
|
1769
1728
|
let t = B.value;
|
|
@@ -1788,7 +1747,7 @@ var jt = ["aria-label"], Mt = /* @__PURE__ */ d({
|
|
|
1788
1747
|
let t = f.value;
|
|
1789
1748
|
if (!t) return Promise.resolve();
|
|
1790
1749
|
let n = e * (k || t.clientHeight);
|
|
1791
|
-
return x.value = e,
|
|
1750
|
+
return x.value = e, Dt(t, n, pe());
|
|
1792
1751
|
}
|
|
1793
1752
|
function he(e) {
|
|
1794
1753
|
me(e);
|
|
@@ -1798,7 +1757,7 @@ var jt = ["aria-label"], Mt = /* @__PURE__ */ d({
|
|
|
1798
1757
|
return t < 0 || t === x.value ? !1 : (await me(t), !0);
|
|
1799
1758
|
}
|
|
1800
1759
|
async function _e(e) {
|
|
1801
|
-
return Y(e) ? (pe() || await new Promise((e) => setTimeout(e,
|
|
1760
|
+
return Y(e) ? (pe() || await new Promise((e) => setTimeout(e, Nt)), !0) : !1;
|
|
1802
1761
|
}
|
|
1803
1762
|
function ve() {
|
|
1804
1763
|
if (!u.reelAutoAdvance.enabled) return;
|
|
@@ -1867,7 +1826,7 @@ var jt = ["aria-label"], Mt = /* @__PURE__ */ d({
|
|
|
1867
1826
|
"style",
|
|
1868
1827
|
"total"
|
|
1869
1828
|
])) : o("", !0),
|
|
1870
|
-
c("div",
|
|
1829
|
+
c("div", At, [c("div", {
|
|
1871
1830
|
ref_key: "galleryElement",
|
|
1872
1831
|
ref: f,
|
|
1873
1832
|
class: "gallery-shell reel-feed",
|
|
@@ -1879,7 +1838,7 @@ var jt = ["aria-label"], Mt = /* @__PURE__ */ d({
|
|
|
1879
1838
|
class: "reel-track",
|
|
1880
1839
|
style: _(F.value),
|
|
1881
1840
|
"aria-label": "Media gallery"
|
|
1882
|
-
}, [(b(!0), s(e, null, S(R.value, ({ fetchPriority: e, item: n, index: i }) => (b(), a(
|
|
1841
|
+
}, [(b(!0), s(e, null, S(R.value, ({ fetchPriority: e, item: n, index: i }) => (b(), a(vt, {
|
|
1883
1842
|
key: n.postId,
|
|
1884
1843
|
active: i === x.value && !C.value,
|
|
1885
1844
|
"advance-on-media-end": u.reelAutoAdvance.enabled && i === x.value,
|
|
@@ -1933,7 +1892,7 @@ var jt = ["aria-label"], Mt = /* @__PURE__ */ d({
|
|
|
1933
1892
|
class: "reel-forward-retry",
|
|
1934
1893
|
type: "button",
|
|
1935
1894
|
onClick: r[0] ||= (e) => d("retryForward")
|
|
1936
|
-
}, " Retry ")) : o("", !0)], 8,
|
|
1895
|
+
}, " Retry ")) : o("", !0)], 8, Mt)), t.reelForward.status === "idle" ? (b(), a(te, {
|
|
1937
1896
|
key: 2,
|
|
1938
1897
|
actions: t.feedFooterActions,
|
|
1939
1898
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -1956,7 +1915,7 @@ var jt = ["aria-label"], Mt = /* @__PURE__ */ d({
|
|
|
1956
1915
|
"load-more-locked",
|
|
1957
1916
|
"show-load-more",
|
|
1958
1917
|
"state"
|
|
1959
|
-
])) : o("", !0)], 40,
|
|
1918
|
+
])) : o("", !0)], 40, jt), c("div", {
|
|
1960
1919
|
ref_key: "reelControlsElement",
|
|
1961
1920
|
ref: p,
|
|
1962
1921
|
class: "reel-media-controls-host",
|
|
@@ -1984,7 +1943,7 @@ var jt = ["aria-label"], Mt = /* @__PURE__ */ d({
|
|
|
1984
1943
|
"style",
|
|
1985
1944
|
"total"
|
|
1986
1945
|
])) : o("", !0),
|
|
1987
|
-
ne.value ? (b(), a(
|
|
1946
|
+
ne.value ? (b(), a(kt, {
|
|
1988
1947
|
key: G.value,
|
|
1989
1948
|
"duration-ms": t.reelAutoAdvance.intervalMs,
|
|
1990
1949
|
label: K.value,
|
|
@@ -1992,16 +1951,16 @@ var jt = ["aria-label"], Mt = /* @__PURE__ */ d({
|
|
|
1992
1951
|
}, null, 8, ["duration-ms", "label"])) : o("", !0)
|
|
1993
1952
|
], 2));
|
|
1994
1953
|
}
|
|
1995
|
-
}),
|
|
1954
|
+
}), It = ["data-info-sheet-open", "data-info-sheet-mode"], Lt = ["aria-hidden", "inert"], Rt = {
|
|
1996
1955
|
key: 0,
|
|
1997
1956
|
class: "reel-info-sheet-layer",
|
|
1998
1957
|
"data-test": "reel-info-sheet"
|
|
1999
|
-
},
|
|
1958
|
+
}, zt = [
|
|
2000
1959
|
"role",
|
|
2001
1960
|
"aria-modal",
|
|
2002
1961
|
"tabindex",
|
|
2003
1962
|
"data-active-post-id"
|
|
2004
|
-
],
|
|
1963
|
+
], Bt = /* @__PURE__ */ d({
|
|
2005
1964
|
__name: "ReelLayout",
|
|
2006
1965
|
props: {
|
|
2007
1966
|
forwardIndex: { default: null },
|
|
@@ -2128,7 +2087,7 @@ var jt = ["aria-label"], Mt = /* @__PURE__ */ d({
|
|
|
2128
2087
|
class: "reel-layout-main",
|
|
2129
2088
|
"aria-hidden": e.infoSheetOverlay && A.value || void 0,
|
|
2130
2089
|
inert: e.infoSheetOverlay && A.value || void 0
|
|
2131
|
-
}, [u(
|
|
2090
|
+
}, [u(Ft, {
|
|
2132
2091
|
ref_key: "reelFeed",
|
|
2133
2092
|
ref: p,
|
|
2134
2093
|
"can-retry-end": e.canRetryEnd,
|
|
@@ -2182,8 +2141,8 @@ var jt = ["aria-label"], Mt = /* @__PURE__ */ d({
|
|
|
2182
2141
|
"reel-forward",
|
|
2183
2142
|
"state",
|
|
2184
2143
|
"total"
|
|
2185
|
-
])], 8,
|
|
2186
|
-
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div",
|
|
2144
|
+
])], 8, Lt), u(n, { name: "vibe-info-sheet" }, {
|
|
2145
|
+
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", Rt, [c("aside", {
|
|
2187
2146
|
ref_key: "sheetElement",
|
|
2188
2147
|
ref: _,
|
|
2189
2148
|
class: "reel-info-sheet",
|
|
@@ -2192,14 +2151,14 @@ var jt = ["aria-label"], Mt = /* @__PURE__ */ d({
|
|
|
2192
2151
|
"aria-modal": e.infoSheetOverlay ? "true" : void 0,
|
|
2193
2152
|
tabindex: e.infoSheetOverlay ? -1 : void 0,
|
|
2194
2153
|
"data-active-post-id": T.value?.postId
|
|
2195
|
-
}, [(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, zt)])) : o("", !0)]),
|
|
2196
2155
|
_: 1
|
|
2197
|
-
})], 10,
|
|
2156
|
+
})], 10, It));
|
|
2198
2157
|
}
|
|
2199
2158
|
});
|
|
2200
2159
|
//#endregion
|
|
2201
2160
|
//#region src/core/mediaLifecycle.ts
|
|
2202
|
-
function
|
|
2161
|
+
function Vt(e, t, n, r, i) {
|
|
2203
2162
|
let a = e.items.findIndex((e) => e.postId === t), o = e.items[a];
|
|
2204
2163
|
if (!o) return null;
|
|
2205
2164
|
let s = F(o, n), c = I(o, s);
|
|
@@ -2215,7 +2174,7 @@ function Wt(e, t, n, r, i) {
|
|
|
2215
2174
|
postIndex: a
|
|
2216
2175
|
};
|
|
2217
2176
|
}
|
|
2218
|
-
function
|
|
2177
|
+
function Ht(e, t) {
|
|
2219
2178
|
O(() => {
|
|
2220
2179
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null;
|
|
2221
2180
|
return {
|
|
@@ -2225,20 +2184,20 @@ function Gt(e, t) {
|
|
|
2225
2184
|
};
|
|
2226
2185
|
}, (n, r) => {
|
|
2227
2186
|
if (n.postId === null || n.postId === r?.postId && n.mediaIndex === r.mediaIndex && n.origin === r.origin) return;
|
|
2228
|
-
let i =
|
|
2187
|
+
let i = Vt(e, n.postId, n.mediaIndex, "reel", n.origin);
|
|
2229
2188
|
i && t(i);
|
|
2230
2189
|
}, { flush: "sync" });
|
|
2231
2190
|
}
|
|
2232
2191
|
//#endregion
|
|
2233
2192
|
//#region src/components/useMediaLifecycle.ts
|
|
2234
|
-
function
|
|
2193
|
+
function Ut(e, t) {
|
|
2235
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);
|
|
2236
2195
|
function c(e, t, n, r) {
|
|
2237
2196
|
let i = L(t, n);
|
|
2238
2197
|
e.value.get(i) !== r && (e.value = new Map(e.value).set(i, r));
|
|
2239
2198
|
}
|
|
2240
2199
|
function l(t, n, r, i) {
|
|
2241
|
-
return
|
|
2200
|
+
return Vt(e, t, n, r, i);
|
|
2242
2201
|
}
|
|
2243
2202
|
function u(e, n, r, i) {
|
|
2244
2203
|
let a = l(e, n, r, i);
|
|
@@ -2260,7 +2219,7 @@ function Kt(e, t) {
|
|
|
2260
2219
|
let r = l(e, n, "masonry", null);
|
|
2261
2220
|
r && t.visible(r);
|
|
2262
2221
|
}
|
|
2263
|
-
return
|
|
2222
|
+
return Ht(e, t.reelChange), O(() => {
|
|
2264
2223
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null, n = t === null ? 0 : e.mediaIndices.get(t) ?? 0;
|
|
2265
2224
|
return {
|
|
2266
2225
|
mediaIndex: n,
|
|
@@ -2285,16 +2244,16 @@ function Kt(e, t) {
|
|
|
2285
2244
|
}
|
|
2286
2245
|
//#endregion
|
|
2287
2246
|
//#region src/core/reelEscapeStack.ts
|
|
2288
|
-
var
|
|
2289
|
-
function
|
|
2290
|
-
return
|
|
2291
|
-
let t =
|
|
2292
|
-
t >= 0 &&
|
|
2247
|
+
var Wt = [];
|
|
2248
|
+
function Gt(e) {
|
|
2249
|
+
return Wt.push(e), () => {
|
|
2250
|
+
let t = Wt.indexOf(e);
|
|
2251
|
+
t >= 0 && Wt.splice(t, 1);
|
|
2293
2252
|
};
|
|
2294
2253
|
}
|
|
2295
|
-
function
|
|
2254
|
+
function Kt(e) {
|
|
2296
2255
|
if (!e.isActive()) return !1;
|
|
2297
|
-
let t =
|
|
2256
|
+
let t = Wt.filter((e) => e.isActive()), n = e.element();
|
|
2298
2257
|
return n !== null && t.some((t) => {
|
|
2299
2258
|
if (t === e) return !1;
|
|
2300
2259
|
let r = t.element();
|
|
@@ -2310,14 +2269,14 @@ function Yt(e) {
|
|
|
2310
2269
|
}
|
|
2311
2270
|
//#endregion
|
|
2312
2271
|
//#region src/components/useReelKeyboard.ts
|
|
2313
|
-
function
|
|
2272
|
+
function qt(e) {
|
|
2314
2273
|
let t = {
|
|
2315
2274
|
element: e.element,
|
|
2316
2275
|
isActive: () => e.state.layout === "reel" || e.state.reelOrigin === "masonry"
|
|
2317
2276
|
}, n = null;
|
|
2318
2277
|
function r(n) {
|
|
2319
2278
|
let r = t.isActive();
|
|
2320
|
-
if (n.key === "Escape" && r && !
|
|
2279
|
+
if (n.key === "Escape" && r && !Kt(t)) return;
|
|
2321
2280
|
if (n.key === "Escape" && e.state.reelOrigin === "masonry") {
|
|
2322
2281
|
n.preventDefault(), e.state.reelInfoSheetOverlay && e.state.reelInfoSheet.enabled && e.setReelInfoSheet(!1), e.closeMasonryReel();
|
|
2323
2282
|
return;
|
|
@@ -2337,14 +2296,14 @@ function Xt(e) {
|
|
|
2337
2296
|
a !== 0 && e.reelRenderer()?.changeActiveMedia?.(a) && n.preventDefault();
|
|
2338
2297
|
}
|
|
2339
2298
|
y(() => {
|
|
2340
|
-
n =
|
|
2299
|
+
n = Gt(t), window.addEventListener("keydown", r);
|
|
2341
2300
|
}), v(() => {
|
|
2342
2301
|
window.removeEventListener("keydown", r), n?.(), n = null;
|
|
2343
2302
|
});
|
|
2344
2303
|
}
|
|
2345
2304
|
//#endregion
|
|
2346
2305
|
//#region src/components/VibeSurface.vue?vue&type=script&setup=true&lang.ts
|
|
2347
|
-
var
|
|
2306
|
+
var Jt = 35, Yt = 420, Xt = /* @__PURE__ */ d({
|
|
2348
2307
|
__name: "VibeSurface",
|
|
2349
2308
|
props: {
|
|
2350
2309
|
canRetryEnd: { type: Boolean },
|
|
@@ -2372,7 +2331,7 @@ var Zt = 35, Qt = 420, $t = /* @__PURE__ */ d({
|
|
|
2372
2331
|
"retryForward"
|
|
2373
2332
|
],
|
|
2374
2333
|
setup(t, { expose: i, emit: c }) {
|
|
2375
|
-
let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), _ = w(!1), y = w(/* @__PURE__ */ new Set()), x = w(/* @__PURE__ */ new Map()), S = w(/* @__PURE__ */ new Set()), C = w(/* @__PURE__ */ new Map()), T = r(() => Object.freeze([...l.state.items])), D = r(() => z(l.state, T.value)), { markMasonryVisible: A, markPreviewError: j, markPreviewReady: M, markReelError: N, markReelReady: I, originalStates: L, previewStates: R, reelStates: B } =
|
|
2334
|
+
let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), _ = w(!1), y = w(/* @__PURE__ */ new Set()), x = w(/* @__PURE__ */ new Map()), S = w(/* @__PURE__ */ new Set()), C = w(/* @__PURE__ */ new Map()), T = r(() => Object.freeze([...l.state.items])), D = r(() => z(l.state, T.value)), { markMasonryVisible: A, markPreviewError: j, markPreviewReady: M, markReelError: N, markReelReady: I, originalStates: L, previewStates: R, reelStates: B } = Ut(l.state, {
|
|
2376
2335
|
ready: (e) => d("mediaReady", e),
|
|
2377
2336
|
reelChange: (e) => d("reelMediaChange", e),
|
|
2378
2337
|
visible: (e) => d("mediaVisible", e)
|
|
@@ -2423,10 +2382,10 @@ var Zt = 35, Qt = 420, $t = /* @__PURE__ */ d({
|
|
|
2423
2382
|
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || ee()) return 0;
|
|
2424
2383
|
let n = [...new Set(e)], r = n.filter(se);
|
|
2425
2384
|
if (r.length === 0) return 0;
|
|
2426
|
-
let i = new Map(C.value), a = t?.staggerMs ??
|
|
2385
|
+
let i = new Map(C.value), a = t?.staggerMs ?? Jt;
|
|
2427
2386
|
return r.forEach((e, t) => {
|
|
2428
2387
|
i.set(e, t * a);
|
|
2429
|
-
}), y.value = new Set([...y.value].filter((e) => !r.includes(e))), S.value = new Set([...S.value, ...n]), C.value = i,
|
|
2388
|
+
}), y.value = new Set([...y.value].filter((e) => !r.includes(e))), S.value = new Set([...S.value, ...n]), C.value = i, Yt + (r.length - 1) * a;
|
|
2430
2389
|
}
|
|
2431
2390
|
function ce(e, t) {
|
|
2432
2391
|
let n = se(e), r = n?.querySelector(".media-card-activator") ?? n;
|
|
@@ -2443,7 +2402,7 @@ var Zt = 35, Qt = 420, $t = /* @__PURE__ */ d({
|
|
|
2443
2402
|
e !== null && ce(e, t);
|
|
2444
2403
|
});
|
|
2445
2404
|
}
|
|
2446
|
-
return
|
|
2405
|
+
return qt({
|
|
2447
2406
|
closeMasonryReel: le,
|
|
2448
2407
|
element: () => g.value,
|
|
2449
2408
|
isReelLeaving: () => _.value,
|
|
@@ -2458,7 +2417,7 @@ var Zt = 35, Qt = 420, $t = /* @__PURE__ */ d({
|
|
|
2458
2417
|
let t = x.value.get(e);
|
|
2459
2418
|
t !== void 0 && r.set(e, t);
|
|
2460
2419
|
}), t.forEach((e, t) => {
|
|
2461
|
-
r.set(e, t *
|
|
2420
|
+
r.set(e, t * Jt);
|
|
2462
2421
|
}), x.value = r, y.value = new Set([...y.value, ...t]), te();
|
|
2463
2422
|
}, { flush: "sync" }), v(() => {
|
|
2464
2423
|
H !== null && cancelAnimationFrame(H);
|
|
@@ -2475,7 +2434,7 @@ var Zt = 35, Qt = 420, $t = /* @__PURE__ */ d({
|
|
|
2475
2434
|
ref_key: "surfaceElement",
|
|
2476
2435
|
ref: g,
|
|
2477
2436
|
class: "vibe-surface"
|
|
2478
|
-
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(
|
|
2437
|
+
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(Bt, {
|
|
2479
2438
|
key: 0,
|
|
2480
2439
|
ref_key: "reelRenderer",
|
|
2481
2440
|
ref: p,
|
|
@@ -2528,7 +2487,7 @@ var Zt = 35, Qt = 420, $t = /* @__PURE__ */ d({
|
|
|
2528
2487
|
"can-retry-end",
|
|
2529
2488
|
"feed-footer",
|
|
2530
2489
|
"state"
|
|
2531
|
-
])) : (b(), s(e, { key: 2 }, [u(
|
|
2490
|
+
])) : (b(), s(e, { key: 2 }, [u(Tt, {
|
|
2532
2491
|
ref_key: "masonryRenderer",
|
|
2533
2492
|
ref: f,
|
|
2534
2493
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2599,7 +2558,7 @@ var Zt = 35, Qt = 420, $t = /* @__PURE__ */ d({
|
|
|
2599
2558
|
"aria-label": "Media viewer",
|
|
2600
2559
|
"aria-modal": "true",
|
|
2601
2560
|
tabindex: "-1"
|
|
2602
|
-
}, [u(
|
|
2561
|
+
}, [u(Bt, {
|
|
2603
2562
|
ref_key: "reelRenderer",
|
|
2604
2563
|
ref: p,
|
|
2605
2564
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2645,7 +2604,7 @@ var Zt = 35, Qt = 420, $t = /* @__PURE__ */ d({
|
|
|
2645
2604
|
});
|
|
2646
2605
|
//#endregion
|
|
2647
2606
|
//#region src/core/page.ts
|
|
2648
|
-
function
|
|
2607
|
+
function Zt(e) {
|
|
2649
2608
|
if (!e || typeof e != "object" || !Array.isArray(e.items)) throw TypeError("Vibe loadPage must resolve to a page with an items array.");
|
|
2650
2609
|
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.");
|
|
2651
2610
|
if (e.next !== null && typeof e.next != "string" && typeof e.next != "number") throw TypeError("Vibe page next must be a string, number, or null.");
|
|
@@ -2656,22 +2615,22 @@ function Z(e, t) {
|
|
|
2656
2615
|
let n = new Set(e.map((e) => e.postId));
|
|
2657
2616
|
return [...e, ...t.filter((e) => n.has(e.postId) ? !1 : (n.add(e.postId), !0))];
|
|
2658
2617
|
}
|
|
2659
|
-
function
|
|
2618
|
+
function Qt(e) {
|
|
2660
2619
|
return `${typeof e}:${String(e)}`;
|
|
2661
2620
|
}
|
|
2662
|
-
function
|
|
2663
|
-
return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview.src}` : `id:${
|
|
2621
|
+
function $t(e) {
|
|
2622
|
+
return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview.src}` : `id:${Qt(e.mediaId)}`;
|
|
2664
2623
|
}
|
|
2665
|
-
function
|
|
2666
|
-
let n = [...e], r = new Map(e.map((e, t) => [
|
|
2624
|
+
function en(e, t) {
|
|
2625
|
+
let n = [...e], r = new Map(e.map((e, t) => [Qt(e.postId), t]));
|
|
2667
2626
|
return t.forEach((e) => {
|
|
2668
|
-
let t =
|
|
2627
|
+
let t = Qt(e.postId), i = r.get(t);
|
|
2669
2628
|
if (i === void 0) {
|
|
2670
2629
|
r.set(t, n.length), n.push(e);
|
|
2671
2630
|
return;
|
|
2672
2631
|
}
|
|
2673
|
-
let a = n[i], o = new Set([a, ...a.items].map(
|
|
2674
|
-
let t =
|
|
2632
|
+
let a = n[i], o = new Set([a, ...a.items].map($t)), s = [e, ...e.items].filter((e) => {
|
|
2633
|
+
let t = $t(e);
|
|
2675
2634
|
return o.has(t) ? !1 : (o.add(t), !0);
|
|
2676
2635
|
});
|
|
2677
2636
|
s.length > 0 && (n[i] = {
|
|
@@ -2680,14 +2639,14 @@ function rn(e, t) {
|
|
|
2680
2639
|
});
|
|
2681
2640
|
}), n;
|
|
2682
2641
|
}
|
|
2683
|
-
function
|
|
2642
|
+
function tn(e) {
|
|
2684
2643
|
return Object.prototype.hasOwnProperty.call(e, "current") ? e.current ?? null : e.next;
|
|
2685
2644
|
}
|
|
2686
2645
|
//#endregion
|
|
2687
2646
|
//#region src/core/appendPage.ts
|
|
2688
|
-
function
|
|
2689
|
-
let i =
|
|
2690
|
-
t.items =
|
|
2647
|
+
function nn(e, t, n, r) {
|
|
2648
|
+
let i = Zt(e), a = n.filterItems(i.items), o = tn(i);
|
|
2649
|
+
t.items = en(t.items, a), t.next = i.next, i.total !== void 0 && (t.total = i.total), r(o), n.recordPages([{
|
|
2691
2650
|
contributionIds: a.map(({ postId: e }) => e),
|
|
2692
2651
|
cursor: o,
|
|
2693
2652
|
next: i.next,
|
|
@@ -2696,32 +2655,32 @@ function on(e, t, n, r) {
|
|
|
2696
2655
|
}
|
|
2697
2656
|
//#endregion
|
|
2698
2657
|
//#region src/core/requestDelay.ts
|
|
2699
|
-
var
|
|
2658
|
+
var rn = 2e3, an = 1e4, on = 250, sn = {
|
|
2700
2659
|
delayRemainingMs: null,
|
|
2701
2660
|
nextRequestAt: null
|
|
2702
2661
|
};
|
|
2703
|
-
function
|
|
2662
|
+
function cn(e, t) {
|
|
2704
2663
|
return e === void 0 ? t : Math.floor(e);
|
|
2705
2664
|
}
|
|
2706
|
-
function
|
|
2665
|
+
function ln(e, t) {
|
|
2707
2666
|
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.`);
|
|
2708
2667
|
}
|
|
2709
|
-
function
|
|
2710
|
-
let n =
|
|
2668
|
+
function un(e, t = {}) {
|
|
2669
|
+
let n = cn(t.delayStepMs, rn), r = cn(t.delayMaxMs, an);
|
|
2711
2670
|
return Math.min(Math.max(0, e) * n, r);
|
|
2712
2671
|
}
|
|
2713
2672
|
function Q(e) {
|
|
2714
|
-
if (e == null || !Number.isFinite(e)) return { ...
|
|
2673
|
+
if (e == null || !Number.isFinite(e)) return { ...sn };
|
|
2715
2674
|
let t = Math.max(0, Math.floor(e - Date.now()));
|
|
2716
2675
|
return t > 0 ? {
|
|
2717
2676
|
delayRemainingMs: t,
|
|
2718
2677
|
nextRequestAt: e
|
|
2719
|
-
} : { ...
|
|
2678
|
+
} : { ...sn };
|
|
2720
2679
|
}
|
|
2721
|
-
async function
|
|
2680
|
+
async function dn({ delayMs: e, onChange: t, signal: n }) {
|
|
2722
2681
|
if (n.aborted) throw new DOMException("Aborted", "AbortError");
|
|
2723
2682
|
if (e <= 0) {
|
|
2724
|
-
t({ ...
|
|
2683
|
+
t({ ...sn });
|
|
2725
2684
|
return;
|
|
2726
2685
|
}
|
|
2727
2686
|
let r = Date.now() + e;
|
|
@@ -2729,9 +2688,9 @@ async function mn({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2729
2688
|
delayRemainingMs: e,
|
|
2730
2689
|
nextRequestAt: r
|
|
2731
2690
|
}), await new Promise((i, a) => {
|
|
2732
|
-
let o = !1, s = setInterval(f,
|
|
2691
|
+
let o = !1, s = setInterval(f, on), c = setTimeout(() => u(), e);
|
|
2733
2692
|
function l() {
|
|
2734
|
-
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...
|
|
2693
|
+
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...sn });
|
|
2735
2694
|
}
|
|
2736
2695
|
function u(e) {
|
|
2737
2696
|
o || (o = !0, l(), e ? a(e) : i());
|
|
@@ -2746,13 +2705,13 @@ async function mn({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2746
2705
|
n.addEventListener("abort", d, { once: !0 });
|
|
2747
2706
|
});
|
|
2748
2707
|
}
|
|
2749
|
-
var
|
|
2708
|
+
var fn = class {
|
|
2750
2709
|
interval = null;
|
|
2751
2710
|
constructor(e) {
|
|
2752
2711
|
this.onChange = e;
|
|
2753
2712
|
}
|
|
2754
2713
|
clear() {
|
|
2755
|
-
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...
|
|
2714
|
+
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...sn });
|
|
2756
2715
|
}
|
|
2757
2716
|
sync(e) {
|
|
2758
2717
|
this.clear();
|
|
@@ -2760,22 +2719,22 @@ var hn = class {
|
|
|
2760
2719
|
this.onChange(t), t.delayRemainingMs !== null && (this.interval = setInterval(() => {
|
|
2761
2720
|
let t = Q(e);
|
|
2762
2721
|
this.onChange(t), t.delayRemainingMs === null && this.clear();
|
|
2763
|
-
},
|
|
2722
|
+
}, on));
|
|
2764
2723
|
}
|
|
2765
2724
|
};
|
|
2766
|
-
function
|
|
2725
|
+
function pn(e, t = !0) {
|
|
2767
2726
|
return e.maxAdditionalPages === "unlimited" ? Infinity : (e.maxAdditionalPages ?? 10) + (t ? 1 : 0);
|
|
2768
2727
|
}
|
|
2769
|
-
function
|
|
2728
|
+
function mn(e) {
|
|
2770
2729
|
return `${typeof e}:${String(e)}`;
|
|
2771
2730
|
}
|
|
2772
|
-
function
|
|
2731
|
+
function hn(e, t) {
|
|
2773
2732
|
if (!Number.isInteger(e) || e <= 0) throw TypeError(`Vibe ${t} must be a positive integer.`);
|
|
2774
2733
|
}
|
|
2775
|
-
function
|
|
2734
|
+
function gn(e) {
|
|
2776
2735
|
if (!e) return;
|
|
2777
|
-
if (
|
|
2778
|
-
|
|
2736
|
+
if (hn(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
|
|
2737
|
+
ln(e, "frontend autofill");
|
|
2779
2738
|
let t = e.maxAdditionalPages;
|
|
2780
2739
|
if (t !== void 0 && t !== "unlimited" && (!Number.isInteger(t) || t < 0)) throw TypeError("Vibe autofill maxAdditionalPages must be a non-negative integer or \"unlimited\".");
|
|
2781
2740
|
return;
|
|
@@ -2787,7 +2746,7 @@ function yn(e) {
|
|
|
2787
2746
|
if (t.pageSize !== e.pageSize) throw TypeError("Vibe backend autofill initialSession pageSize must match autofill pageSize.");
|
|
2788
2747
|
}
|
|
2789
2748
|
}
|
|
2790
|
-
function
|
|
2749
|
+
function _n(e, t, n = !0) {
|
|
2791
2750
|
if (!e) return {
|
|
2792
2751
|
cycleId: null,
|
|
2793
2752
|
delayRemainingMs: null,
|
|
@@ -2821,7 +2780,7 @@ function bn(e, t, n = !0) {
|
|
|
2821
2780
|
strategy: e.strategy
|
|
2822
2781
|
};
|
|
2823
2782
|
}
|
|
2824
|
-
function
|
|
2783
|
+
function vn(e) {
|
|
2825
2784
|
return [
|
|
2826
2785
|
"cancelling",
|
|
2827
2786
|
"filling",
|
|
@@ -2829,9 +2788,9 @@ function xn(e) {
|
|
|
2829
2788
|
"waiting"
|
|
2830
2789
|
].includes(e.status);
|
|
2831
2790
|
}
|
|
2832
|
-
async function
|
|
2791
|
+
async function yn(e, t, n) {
|
|
2833
2792
|
let r = t.autofill;
|
|
2834
|
-
if (!
|
|
2793
|
+
if (!vn(r) || !r.cycleId) return;
|
|
2835
2794
|
let i = {
|
|
2836
2795
|
cycleId: r.cycleId,
|
|
2837
2796
|
feedKey: r.feedKey ?? "",
|
|
@@ -2844,16 +2803,16 @@ async function Sn(e, t, n) {
|
|
|
2844
2803
|
throw r.error = e, r.status = "error", e;
|
|
2845
2804
|
}
|
|
2846
2805
|
}
|
|
2847
|
-
function
|
|
2806
|
+
function bn(e, t, n) {
|
|
2848
2807
|
return e?.strategy === "backend" && t.feedKey === e.feedKey && t.sessionId === n.sessionId;
|
|
2849
2808
|
}
|
|
2850
|
-
async function
|
|
2851
|
-
let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ??
|
|
2809
|
+
async function xn({ 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 }) {
|
|
2810
|
+
let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ?? pn(s), g = t, _ = t, v = t, y = 0, b = [], x;
|
|
2852
2811
|
for (; y < h;) {
|
|
2853
|
-
let e =
|
|
2812
|
+
let e = mn(g);
|
|
2854
2813
|
if (m.has(e)) throw Error("Vibe autofill received a repeated cursor.");
|
|
2855
|
-
if (m.add(e), await
|
|
2856
|
-
delayMs:
|
|
2814
|
+
if (m.add(e), await dn({
|
|
2815
|
+
delayMs: un(l + y, s),
|
|
2857
2816
|
onChange: a,
|
|
2858
2817
|
signal: d
|
|
2859
2818
|
}), y > 0 && u()) return {
|
|
@@ -2867,7 +2826,7 @@ async function wn({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
2867
2826
|
status: "paused",
|
|
2868
2827
|
total: x
|
|
2869
2828
|
};
|
|
2870
|
-
let t =
|
|
2829
|
+
let t = Zt(await n({
|
|
2871
2830
|
cursor: g,
|
|
2872
2831
|
signal: d
|
|
2873
2832
|
}));
|
|
@@ -2924,12 +2883,12 @@ async function wn({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
2924
2883
|
}
|
|
2925
2884
|
//#endregion
|
|
2926
2885
|
//#region src/core/autofillController.ts
|
|
2927
|
-
var
|
|
2886
|
+
var Sn = class {
|
|
2928
2887
|
collection = null;
|
|
2929
2888
|
cycle = 0;
|
|
2930
2889
|
delayCountdown;
|
|
2931
2890
|
constructor(e) {
|
|
2932
|
-
this.context = e, this.delayCountdown = new
|
|
2891
|
+
this.context = e, this.delayCountdown = new fn((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
|
|
2933
2892
|
}
|
|
2934
2893
|
beginCycle() {
|
|
2935
2894
|
let { options: e, state: t } = this.context;
|
|
@@ -2937,14 +2896,14 @@ var Tn = class {
|
|
|
2937
2896
|
this.clear();
|
|
2938
2897
|
let n = `vibe-autofill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
2939
2898
|
return t.autofill = {
|
|
2940
|
-
...
|
|
2899
|
+
..._n(e, void 0, !1),
|
|
2941
2900
|
cycleId: n,
|
|
2942
2901
|
status: "filling"
|
|
2943
2902
|
}, n;
|
|
2944
2903
|
}
|
|
2945
2904
|
async cancel() {
|
|
2946
2905
|
let { cancelRequest: e, options: t, state: n } = this.context;
|
|
2947
|
-
await
|
|
2906
|
+
await yn(t, n, e), this.commitCollection();
|
|
2948
2907
|
}
|
|
2949
2908
|
captureCollection(e, t) {
|
|
2950
2909
|
t && (this.collection = e);
|
|
@@ -2972,30 +2931,30 @@ var Tn = class {
|
|
|
2972
2931
|
requests: r.requests
|
|
2973
2932
|
}), !0) : !1;
|
|
2974
2933
|
}
|
|
2975
|
-
},
|
|
2976
|
-
function
|
|
2934
|
+
}, Cn = 100;
|
|
2935
|
+
function wn(e, t) {
|
|
2977
2936
|
if (!Number.isFinite(t) || t <= 0) throw TypeError(`Vibe ${e} must be a positive number.`);
|
|
2978
2937
|
}
|
|
2979
|
-
function
|
|
2938
|
+
function Tn(e, t, n) {
|
|
2980
2939
|
return Math.min(n, Math.max(t, e));
|
|
2981
2940
|
}
|
|
2982
|
-
function
|
|
2941
|
+
function En(e) {
|
|
2983
2942
|
if (!e) return;
|
|
2984
2943
|
let t = e.minSpeedPxPerSecond ?? 20, n = e.maxSpeedPxPerSecond ?? 240;
|
|
2985
|
-
if (
|
|
2986
|
-
e.speedPxPerSecond !== void 0 &&
|
|
2944
|
+
if (wn("autoScroll.minSpeedPxPerSecond", t), wn("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
|
|
2945
|
+
e.speedPxPerSecond !== void 0 && wn("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
|
|
2987
2946
|
}
|
|
2988
|
-
function
|
|
2947
|
+
function Dn(e) {
|
|
2989
2948
|
let t = e?.minSpeedPxPerSecond ?? 20, n = e?.maxSpeedPxPerSecond ?? 240;
|
|
2990
2949
|
return {
|
|
2991
2950
|
enabled: e?.enabled ?? !1,
|
|
2992
2951
|
maxSpeedPxPerSecond: n,
|
|
2993
2952
|
minSpeedPxPerSecond: t,
|
|
2994
2953
|
paused: !1,
|
|
2995
|
-
speedPxPerSecond:
|
|
2954
|
+
speedPxPerSecond: Tn(e?.speedPxPerSecond ?? 80, t, n)
|
|
2996
2955
|
};
|
|
2997
2956
|
}
|
|
2998
|
-
var
|
|
2957
|
+
var On = class {
|
|
2999
2958
|
frame = null;
|
|
3000
2959
|
lastTimestamp = null;
|
|
3001
2960
|
mounted = !1;
|
|
@@ -3015,9 +2974,9 @@ var jn = class {
|
|
|
3015
2974
|
this.options.state.enabled && (this.options.state.paused = e, this.lastTimestamp = null, e ? this.cancelFrame() : this.schedule());
|
|
3016
2975
|
}
|
|
3017
2976
|
setSpeed(e) {
|
|
3018
|
-
|
|
2977
|
+
wn("auto-scroll speed", e);
|
|
3019
2978
|
let t = this.options.state;
|
|
3020
|
-
t.speedPxPerSecond =
|
|
2979
|
+
t.speedPxPerSecond = Tn(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
|
|
3021
2980
|
}
|
|
3022
2981
|
tick = (e) => {
|
|
3023
2982
|
this.frame = null;
|
|
@@ -3029,7 +2988,7 @@ var jn = class {
|
|
|
3029
2988
|
return;
|
|
3030
2989
|
}
|
|
3031
2990
|
if (this.lastTimestamp !== null) {
|
|
3032
|
-
let r = Math.min(
|
|
2991
|
+
let r = Math.min(Cn, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
|
|
3033
2992
|
n.scrollTop = Math.min(i, n.scrollTop + t.speedPxPerSecond * r / 1e3);
|
|
3034
2993
|
}
|
|
3035
2994
|
this.lastTimestamp = e, this.schedule();
|
|
@@ -3043,7 +3002,7 @@ var jn = class {
|
|
|
3043
3002
|
};
|
|
3044
3003
|
//#endregion
|
|
3045
3004
|
//#region src/core/backendAutofill.ts
|
|
3046
|
-
async function
|
|
3005
|
+
async function kn(e, t, n, r) {
|
|
3047
3006
|
let i = await e.onUnderfilled(n);
|
|
3048
3007
|
if (!r()) return;
|
|
3049
3008
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend autofill requires a sessionId.");
|
|
@@ -3057,19 +3016,19 @@ async function Mn(e, t, n, r) {
|
|
|
3057
3016
|
status: "waiting"
|
|
3058
3017
|
});
|
|
3059
3018
|
}
|
|
3060
|
-
function
|
|
3019
|
+
function An(e, t) {
|
|
3061
3020
|
["complete", "exhausted"].includes(t.status) && t.items && (e.items = Z(e.items, t.items)), t.next !== void 0 && (e.next = t.next), t.total !== void 0 && (e.total = t.total);
|
|
3062
3021
|
}
|
|
3063
|
-
function
|
|
3022
|
+
function jn(e, t, n) {
|
|
3064
3023
|
let r = t.autofill;
|
|
3065
|
-
return !
|
|
3024
|
+
return !bn(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (An(t, n), Object.assign(r, Q(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);
|
|
3066
3025
|
}
|
|
3067
|
-
function
|
|
3068
|
-
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill =
|
|
3026
|
+
function Mn(e, t, n) {
|
|
3027
|
+
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = _n(e, n), An(t, n), !0);
|
|
3069
3028
|
}
|
|
3070
3029
|
//#endregion
|
|
3071
3030
|
//#region src/core/backlogRestore.ts
|
|
3072
|
-
async function
|
|
3031
|
+
async function Nn(e, t, n) {
|
|
3073
3032
|
if (!e) return;
|
|
3074
3033
|
let r = new AbortController();
|
|
3075
3034
|
n(r);
|
|
@@ -3084,7 +3043,7 @@ async function In(e, t, n) {
|
|
|
3084
3043
|
}
|
|
3085
3044
|
//#endregion
|
|
3086
3045
|
//#region src/core/initialAutofill.ts
|
|
3087
|
-
async function
|
|
3046
|
+
async function Pn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, onPages: i, options: a, signal: o, state: s }) {
|
|
3088
3047
|
let c = a.autofill;
|
|
3089
3048
|
if (!c) return;
|
|
3090
3049
|
let l = s.items.length;
|
|
@@ -3097,7 +3056,7 @@ async function Ln({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3097
3056
|
return;
|
|
3098
3057
|
}
|
|
3099
3058
|
if (c.strategy === "backend") {
|
|
3100
|
-
await
|
|
3059
|
+
await kn(c, s, {
|
|
3101
3060
|
cycleId: e,
|
|
3102
3061
|
feedKey: c.feedKey,
|
|
3103
3062
|
items: [...s.items],
|
|
@@ -3114,11 +3073,11 @@ async function Ln({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3114
3073
|
s.autofill.status = "exhausted";
|
|
3115
3074
|
return;
|
|
3116
3075
|
}
|
|
3117
|
-
let u = await
|
|
3076
|
+
let u = await xn({
|
|
3118
3077
|
existingItems: s.items,
|
|
3119
3078
|
initialCursor: s.next,
|
|
3120
3079
|
loadPage: a.loadPage,
|
|
3121
|
-
maximumRequests:
|
|
3080
|
+
maximumRequests: pn(c, !1),
|
|
3122
3081
|
onCollection: n,
|
|
3123
3082
|
onDelayChange: (e) => {
|
|
3124
3083
|
t() && Object.assign(s.autofill, e);
|
|
@@ -3141,13 +3100,13 @@ async function Ln({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3141
3100
|
}
|
|
3142
3101
|
//#endregion
|
|
3143
3102
|
//#region src/core/fill.ts
|
|
3144
|
-
function
|
|
3103
|
+
function Fn(e) {
|
|
3145
3104
|
return "items" in e ? { items: e.items } : "pages" in e ? { pages: e.pages } : { until: "end" };
|
|
3146
3105
|
}
|
|
3147
|
-
function
|
|
3106
|
+
function In(e) {
|
|
3148
3107
|
return `${typeof e}:${String(e)}`;
|
|
3149
3108
|
}
|
|
3150
|
-
function
|
|
3109
|
+
function Ln(e) {
|
|
3151
3110
|
if (!e || typeof e != "object") throw TypeError("Vibe fill target must be an object.");
|
|
3152
3111
|
if ("pages" in e) {
|
|
3153
3112
|
if (!Number.isInteger(e.pages) || e.pages <= 0) throw TypeError("Vibe fill pages must be a positive integer.");
|
|
@@ -3160,20 +3119,20 @@ function Bn(e) {
|
|
|
3160
3119
|
if ("until" in e && e.until === "end") return { until: "end" };
|
|
3161
3120
|
throw TypeError("Vibe fill target must be { items }, { pages }, or { until: 'end' }.");
|
|
3162
3121
|
}
|
|
3163
|
-
function
|
|
3122
|
+
function Rn(e) {
|
|
3164
3123
|
if (!e) return;
|
|
3165
3124
|
if (e.strategy === "frontend") {
|
|
3166
|
-
|
|
3125
|
+
ln(e, "frontend fill");
|
|
3167
3126
|
return;
|
|
3168
3127
|
}
|
|
3169
3128
|
if (!e.feedKey.trim()) throw TypeError("Vibe backend fill requires a feedKey.");
|
|
3170
3129
|
let t = e.initialSession;
|
|
3171
3130
|
if (t) {
|
|
3172
3131
|
if (t.feedKey !== e.feedKey) throw TypeError("Vibe backend fill initialSession feedKey must match fill feedKey.");
|
|
3173
|
-
|
|
3132
|
+
Ln(t.target);
|
|
3174
3133
|
}
|
|
3175
3134
|
}
|
|
3176
|
-
function
|
|
3135
|
+
function zn(e, t, n = !0) {
|
|
3177
3136
|
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a = Q(i?.nextRequestAt);
|
|
3178
3137
|
return {
|
|
3179
3138
|
completedPages: i?.completedPages ?? 0,
|
|
@@ -3187,10 +3146,10 @@ function Hn(e, t, n = !0) {
|
|
|
3187
3146
|
sessionId: i?.sessionId ?? null,
|
|
3188
3147
|
status: i?.status ?? "idle",
|
|
3189
3148
|
strategy: e?.strategy ?? null,
|
|
3190
|
-
target: i ?
|
|
3149
|
+
target: i ? Fn(i.target) : null
|
|
3191
3150
|
};
|
|
3192
3151
|
}
|
|
3193
|
-
function
|
|
3152
|
+
function Bn(e) {
|
|
3194
3153
|
return [
|
|
3195
3154
|
"cancelling",
|
|
3196
3155
|
"filling",
|
|
@@ -3198,7 +3157,7 @@ function Un(e) {
|
|
|
3198
3157
|
"waiting"
|
|
3199
3158
|
].includes(e.status);
|
|
3200
3159
|
}
|
|
3201
|
-
async function
|
|
3160
|
+
async function Vn({ existingItems: e, initialCursor: t, loadPage: n, onCollection: r = () => void 0, onDelayChange: i, onProgress: a, options: o, shouldPause: s = () => !1, signal: c, target: l }) {
|
|
3202
3161
|
let u = [], d = [], f = [...e], p = /* @__PURE__ */ new Set(), m = 0, h = t, g = t, _ = t, v = 0, y;
|
|
3203
3162
|
if ("items" in l && f.length >= l.items) return {
|
|
3204
3163
|
completedPages: m,
|
|
@@ -3210,10 +3169,10 @@ async function Wn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
3210
3169
|
status: "complete"
|
|
3211
3170
|
};
|
|
3212
3171
|
for (; _ !== null;) {
|
|
3213
|
-
let e =
|
|
3172
|
+
let e = In(h);
|
|
3214
3173
|
if (p.has(e)) throw Error("Vibe fill received a repeated cursor.");
|
|
3215
|
-
if (p.add(e), await
|
|
3216
|
-
delayMs:
|
|
3174
|
+
if (p.add(e), await dn({
|
|
3175
|
+
delayMs: un(m, o),
|
|
3217
3176
|
onChange: i,
|
|
3218
3177
|
signal: c
|
|
3219
3178
|
}), m > 0 && s()) return {
|
|
@@ -3226,7 +3185,7 @@ async function Wn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
3226
3185
|
status: "paused",
|
|
3227
3186
|
total: y
|
|
3228
3187
|
};
|
|
3229
|
-
let t =
|
|
3188
|
+
let t = Zt(await n({
|
|
3230
3189
|
cursor: h,
|
|
3231
3190
|
signal: c
|
|
3232
3191
|
}));
|
|
@@ -3294,7 +3253,7 @@ async function Wn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
3294
3253
|
}
|
|
3295
3254
|
//#endregion
|
|
3296
3255
|
//#region src/core/backendFill.ts
|
|
3297
|
-
async function
|
|
3256
|
+
async function Hn(e, t, n, r) {
|
|
3298
3257
|
let i = await e.onStart(n);
|
|
3299
3258
|
if (r()) {
|
|
3300
3259
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend fill requires a sessionId.");
|
|
@@ -3308,22 +3267,22 @@ async function Gn(e, t, n, r) {
|
|
|
3308
3267
|
});
|
|
3309
3268
|
}
|
|
3310
3269
|
}
|
|
3311
|
-
function
|
|
3270
|
+
function Un(e, t, n) {
|
|
3312
3271
|
return e?.strategy === "backend" && n.feedKey === e.feedKey && n.sessionId === t.fill.sessionId;
|
|
3313
3272
|
}
|
|
3314
|
-
function
|
|
3273
|
+
function Wn(e) {
|
|
3315
3274
|
return Number.isInteger(e.completedPages) && e.completedPages >= 0 && Number.isInteger(e.received) && e.received >= 0 && Number.isInteger(e.sequence) && e.sequence >= 0;
|
|
3316
3275
|
}
|
|
3317
|
-
function
|
|
3276
|
+
function Gn(e, t) {
|
|
3318
3277
|
if (!["complete", "exhausted"].includes(t.status)) return !0;
|
|
3319
3278
|
let n = e.fill.target;
|
|
3320
3279
|
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;
|
|
3321
3280
|
}
|
|
3322
|
-
function
|
|
3281
|
+
function Kn(e, t, n) {
|
|
3323
3282
|
t.total !== void 0 && (e.total = t.total), ["complete", "exhausted"].includes(t.status) && (e.items = Z(e.items, t.items ?? []), e.next = t.next ?? null, n(t.lastCursor ?? null));
|
|
3324
3283
|
}
|
|
3325
|
-
function
|
|
3326
|
-
return !
|
|
3284
|
+
function qn(e, t, n, r) {
|
|
3285
|
+
return !Un(e, t, n) || !Wn(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !Gn(t, n) ? !1 : (Kn(t, n, r), Object.assign(t.fill, {
|
|
3327
3286
|
...Q(n.status === "waiting" ? n.nextRequestAt : null),
|
|
3328
3287
|
completedPages: n.completedPages,
|
|
3329
3288
|
error: n.error ?? null,
|
|
@@ -3332,45 +3291,45 @@ function Xn(e, t, n, r) {
|
|
|
3332
3291
|
status: n.status
|
|
3333
3292
|
}), !0);
|
|
3334
3293
|
}
|
|
3335
|
-
function
|
|
3294
|
+
function Jn(e, t, n, r) {
|
|
3336
3295
|
if (e?.strategy !== "backend" || n.feedKey !== e.feedKey) return !1;
|
|
3337
3296
|
let i = t.fill;
|
|
3338
|
-
return t.fill =
|
|
3297
|
+
return t.fill = zn(e, n), !Wn(n) || !Gn(t, n) ? (t.fill = i, !1) : (Kn(t, n, r), !0);
|
|
3339
3298
|
}
|
|
3340
3299
|
//#endregion
|
|
3341
3300
|
//#region src/core/fillController.ts
|
|
3342
|
-
var
|
|
3301
|
+
var Yn = class {
|
|
3343
3302
|
abortController = null;
|
|
3344
3303
|
cycle = 0;
|
|
3345
3304
|
delayCountdown;
|
|
3346
3305
|
requestVersion = 0;
|
|
3347
3306
|
collection = null;
|
|
3348
3307
|
constructor(e) {
|
|
3349
|
-
this.options = e, this.delayCountdown = new
|
|
3308
|
+
this.options = e, this.delayCountdown = new fn((e) => {
|
|
3350
3309
|
Object.assign(this.options.state.fill, e);
|
|
3351
3310
|
}), this.syncBackendCountdown();
|
|
3352
3311
|
}
|
|
3353
3312
|
isActive() {
|
|
3354
|
-
return
|
|
3313
|
+
return Bn(this.options.state.fill);
|
|
3355
3314
|
}
|
|
3356
3315
|
applyUpdate(e) {
|
|
3357
|
-
let t =
|
|
3316
|
+
let t = qn(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
3358
3317
|
return t && this.syncBackendCountdown(), t;
|
|
3359
3318
|
}
|
|
3360
3319
|
restoreSession(e) {
|
|
3361
|
-
let t =
|
|
3320
|
+
let t = Jn(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
3362
3321
|
return t && this.syncBackendCountdown(), t;
|
|
3363
3322
|
}
|
|
3364
3323
|
async start(e, t = {}) {
|
|
3365
3324
|
let n = this.options.fill;
|
|
3366
3325
|
if (!n) throw Error("Vibe fill is not configured.");
|
|
3367
3326
|
if (this.isActive()) throw Error("Vibe fill is already active.");
|
|
3368
|
-
let r =
|
|
3327
|
+
let r = Ln(e), i = Ln(t.target ?? r), a = t.progressOffset ?? {
|
|
3369
3328
|
completedPages: 0,
|
|
3370
3329
|
received: 0
|
|
3371
3330
|
}, o = t.cycleId ?? `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
3372
3331
|
if (this.options.state.fill = {
|
|
3373
|
-
...
|
|
3332
|
+
...zn(n, void 0, !1),
|
|
3374
3333
|
completedPages: a.completedPages,
|
|
3375
3334
|
cycleId: o,
|
|
3376
3335
|
received: a.received,
|
|
@@ -3383,7 +3342,7 @@ var Qn = class {
|
|
|
3383
3342
|
let s = ++this.requestVersion, c = new AbortController();
|
|
3384
3343
|
this.abortController = c;
|
|
3385
3344
|
try {
|
|
3386
|
-
n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await
|
|
3345
|
+
n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await Hn(n, this.options.state, {
|
|
3387
3346
|
cycleId: o,
|
|
3388
3347
|
feedKey: n.feedKey,
|
|
3389
3348
|
items: [...this.options.state.items],
|
|
@@ -3401,7 +3360,7 @@ var Qn = class {
|
|
|
3401
3360
|
}
|
|
3402
3361
|
async cancel() {
|
|
3403
3362
|
let { fill: e, state: t } = this.options;
|
|
3404
|
-
if (!
|
|
3363
|
+
if (!Bn(t.fill) || !t.fill.cycleId) return;
|
|
3405
3364
|
let n = {
|
|
3406
3365
|
cycleId: t.fill.cycleId,
|
|
3407
3366
|
feedKey: t.fill.feedKey ?? "",
|
|
@@ -3445,7 +3404,7 @@ var Qn = class {
|
|
|
3445
3404
|
});
|
|
3446
3405
|
}
|
|
3447
3406
|
reset() {
|
|
3448
|
-
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill =
|
|
3407
|
+
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = zn(this.options.fill, void 0, !1), this.collection = null;
|
|
3449
3408
|
}
|
|
3450
3409
|
destroy() {
|
|
3451
3410
|
this.abortLocalRequest(), this.delayCountdown.clear();
|
|
@@ -3480,7 +3439,7 @@ var Qn = class {
|
|
|
3480
3439
|
s.fill.status = "until" in t ? "complete" : "exhausted";
|
|
3481
3440
|
return;
|
|
3482
3441
|
}
|
|
3483
|
-
let c = await
|
|
3442
|
+
let c = await Vn({
|
|
3484
3443
|
existingItems: s.items,
|
|
3485
3444
|
initialCursor: s.next,
|
|
3486
3445
|
loadPage: o,
|
|
@@ -3528,7 +3487,7 @@ var Qn = class {
|
|
|
3528
3487
|
};
|
|
3529
3488
|
//#endregion
|
|
3530
3489
|
//#region src/core/fillReconciliation.ts
|
|
3531
|
-
async function
|
|
3490
|
+
async function Xn({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r, setLastCursor: i, signal: a, state: o }) {
|
|
3532
3491
|
if (!e.needsReconciliation(o.items)) return "skipped";
|
|
3533
3492
|
let s = await e.reconcile({
|
|
3534
3493
|
existingItems: o.items,
|
|
@@ -3541,7 +3500,7 @@ async function $n({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r,
|
|
|
3541
3500
|
}
|
|
3542
3501
|
//#endregion
|
|
3543
3502
|
//#region src/core/feedFooter.ts
|
|
3544
|
-
function
|
|
3503
|
+
function Zn(e) {
|
|
3545
3504
|
return {
|
|
3546
3505
|
cancelAutofill: () => e.cancelAutofill(),
|
|
3547
3506
|
loadMore: () => e.loadNext(),
|
|
@@ -3553,46 +3512,46 @@ function er(e) {
|
|
|
3553
3512
|
retryFill: () => e.retryFill()
|
|
3554
3513
|
};
|
|
3555
3514
|
}
|
|
3556
|
-
function
|
|
3515
|
+
function Qn(e) {
|
|
3557
3516
|
if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
|
|
3558
3517
|
}
|
|
3559
|
-
function
|
|
3560
|
-
e?.intervalMs !== void 0 &&
|
|
3518
|
+
function $n(e) {
|
|
3519
|
+
e?.intervalMs !== void 0 && Qn(e.intervalMs);
|
|
3561
3520
|
}
|
|
3562
|
-
function
|
|
3521
|
+
function er(e) {
|
|
3563
3522
|
return {
|
|
3564
3523
|
enabled: e?.enabled ?? !1,
|
|
3565
3524
|
includePostItems: e?.includePostItems ?? !1,
|
|
3566
3525
|
intervalMs: e?.intervalMs ?? 5e3
|
|
3567
3526
|
};
|
|
3568
3527
|
}
|
|
3569
|
-
function
|
|
3528
|
+
function tr(e, t) {
|
|
3570
3529
|
if (typeof t == "boolean") {
|
|
3571
3530
|
e.enabled = t;
|
|
3572
3531
|
return;
|
|
3573
3532
|
}
|
|
3574
|
-
|
|
3533
|
+
$n(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);
|
|
3575
3534
|
}
|
|
3576
3535
|
//#endregion
|
|
3577
3536
|
//#region src/core/reelInfoSheet.ts
|
|
3578
|
-
function
|
|
3537
|
+
function nr(e) {
|
|
3579
3538
|
return { enabled: e?.enabled ?? !1 };
|
|
3580
3539
|
}
|
|
3581
|
-
function
|
|
3540
|
+
function rr(e, t, n) {
|
|
3582
3541
|
if (n && !t) throw Error("Vibe cannot enable reelInfoSheet without a configured component.");
|
|
3583
3542
|
e.enabled = n;
|
|
3584
3543
|
}
|
|
3585
3544
|
//#endregion
|
|
3586
3545
|
//#region src/core/initialRuntimeState.ts
|
|
3587
|
-
function
|
|
3546
|
+
function ir(e, t) {
|
|
3588
3547
|
let n = e.initialPage;
|
|
3589
3548
|
return {
|
|
3590
3549
|
activeReelPostId: null,
|
|
3591
|
-
autoScroll:
|
|
3592
|
-
autofill:
|
|
3550
|
+
autoScroll: Dn(e.autoScroll),
|
|
3551
|
+
autofill: _n(e.autofill),
|
|
3593
3552
|
current: n?.current ?? null,
|
|
3594
3553
|
error: null,
|
|
3595
|
-
fill:
|
|
3554
|
+
fill: zn(e.fill),
|
|
3596
3555
|
infiniteScroll: e.infiniteScroll ?? !0,
|
|
3597
3556
|
isLoading: !n,
|
|
3598
3557
|
isLoadingMore: !1,
|
|
@@ -3603,14 +3562,14 @@ function sr(e, t) {
|
|
|
3603
3562
|
next: n?.next ?? null,
|
|
3604
3563
|
nextPageError: null,
|
|
3605
3564
|
phoneMode: !1,
|
|
3606
|
-
reelAutoAdvance:
|
|
3565
|
+
reelAutoAdvance: er(e.reelAutoAdvance),
|
|
3607
3566
|
reelForward: {
|
|
3608
3567
|
error: null,
|
|
3609
3568
|
status: "idle"
|
|
3610
3569
|
},
|
|
3611
3570
|
reelForwardIndex: null,
|
|
3612
3571
|
reelForwardItem: null,
|
|
3613
|
-
reelInfoSheet:
|
|
3572
|
+
reelInfoSheet: nr(e.reelInfoSheet),
|
|
3614
3573
|
reelInfoSheetOverlay: !1,
|
|
3615
3574
|
reelMediaSource: "original",
|
|
3616
3575
|
reelOrigin: null,
|
|
@@ -3619,21 +3578,20 @@ function sr(e, t) {
|
|
|
3619
3578
|
}
|
|
3620
3579
|
//#endregion
|
|
3621
3580
|
//#region src/core/options.ts
|
|
3622
|
-
function
|
|
3581
|
+
function ar(e, t) {
|
|
3623
3582
|
if (t) {
|
|
3624
3583
|
if (!Number.isFinite(t.height) || t.height <= 0) throw TypeError(`Vibe ${e} height must be a positive number.`);
|
|
3625
3584
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe ${e} background must be "default" or "transparent".`);
|
|
3626
3585
|
}
|
|
3627
3586
|
}
|
|
3628
|
-
function
|
|
3587
|
+
function or(e, t) {
|
|
3629
3588
|
if (t) {
|
|
3630
3589
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe mediaCard ${e} background must be "default" or "transparent".`);
|
|
3631
3590
|
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.`);
|
|
3632
3591
|
}
|
|
3633
3592
|
}
|
|
3634
|
-
function
|
|
3635
|
-
if (
|
|
3636
|
-
if (yn(e.autofill), Vn(e.fill), de(e.masonry), nr(e.reelAutoAdvance), e.removalReconciliation) {
|
|
3593
|
+
function sr(e) {
|
|
3594
|
+
if (En(e.autoScroll), ar("cardHeader", e.cardHeader), ar("cardFooter", e.cardFooter), or("header", e.mediaCard?.header), or("footer", e.mediaCard?.footer), gn(e.autofill), Rn(e.fill), de(e.masonry), $n(e.reelAutoAdvance), e.removalReconciliation) {
|
|
3637
3595
|
if (!Number.isInteger(e.removalReconciliation.pageSize) || e.removalReconciliation.pageSize <= 0) throw TypeError("Vibe removalReconciliation pageSize must be a positive integer.");
|
|
3638
3596
|
let t = e.removalReconciliation.maxReplayPages ?? 5;
|
|
3639
3597
|
if (!Number.isInteger(t) || t <= 0) throw TypeError("Vibe removalReconciliation maxReplayPages must be a positive integer.");
|
|
@@ -3648,7 +3606,7 @@ function ur(e) {
|
|
|
3648
3606
|
if (e.fill?.strategy === "frontend" && !e.loadPage) throw TypeError("Vibe frontend fill requires loadPage.");
|
|
3649
3607
|
if (e.fill?.strategy === "backend" && e.fill.initialSession && !e.initialPage) throw TypeError("Vibe backend fill restoration requires initialPage.");
|
|
3650
3608
|
}
|
|
3651
|
-
function
|
|
3609
|
+
function cr(e) {
|
|
3652
3610
|
if (typeof e != "string") return e;
|
|
3653
3611
|
if (typeof document > "u") throw Error("Vibe cannot resolve a selector without a document.");
|
|
3654
3612
|
let t = document.querySelector(e);
|
|
@@ -3657,7 +3615,7 @@ function dr(e) {
|
|
|
3657
3615
|
}
|
|
3658
3616
|
//#endregion
|
|
3659
3617
|
//#region src/core/pageRequest.ts
|
|
3660
|
-
async function
|
|
3618
|
+
async function lr({ append: e, autofillController: t, cursor: n, isCurrent: r, loadPage: i, onLastCursor: a, onPages: o, options: s, signal: c, state: l }) {
|
|
3661
3619
|
let u = s.autofill, d = e && u?.strategy === "frontend" && (l.autofill.status === "paused" || l.autofill.status === "error"), f = d ? {
|
|
3662
3620
|
received: l.autofill.received,
|
|
3663
3621
|
requests: l.autofill.requests
|
|
@@ -3669,11 +3627,11 @@ async function fr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3669
3627
|
let m = !1;
|
|
3670
3628
|
try {
|
|
3671
3629
|
if (u?.strategy === "frontend") {
|
|
3672
|
-
let s = await
|
|
3630
|
+
let s = await xn({
|
|
3673
3631
|
existingItems: e ? l.items : [],
|
|
3674
3632
|
initialCursor: n,
|
|
3675
3633
|
loadPage: i,
|
|
3676
|
-
maximumRequests: f ? Math.max(0,
|
|
3634
|
+
maximumRequests: f ? Math.max(0, pn(u) - f.requests) : void 0,
|
|
3677
3635
|
onCollection: (e) => t.captureCollection(e, r()),
|
|
3678
3636
|
onDelayChange: (e) => {
|
|
3679
3637
|
r() && Object.assign(l.autofill, e);
|
|
@@ -3696,7 +3654,7 @@ async function fr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3696
3654
|
}), o(s.pages), t.clearCollection();
|
|
3697
3655
|
return;
|
|
3698
3656
|
}
|
|
3699
|
-
let s =
|
|
3657
|
+
let s = Zt(await i({
|
|
3700
3658
|
cursor: n,
|
|
3701
3659
|
signal: c
|
|
3702
3660
|
}));
|
|
@@ -3716,7 +3674,7 @@ async function fr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3716
3674
|
l.autofill.status = "complete";
|
|
3717
3675
|
return;
|
|
3718
3676
|
}
|
|
3719
|
-
await
|
|
3677
|
+
await kn(u, l, {
|
|
3720
3678
|
cycleId: p,
|
|
3721
3679
|
feedKey: u.feedKey,
|
|
3722
3680
|
items: h.slice(d.length),
|
|
@@ -3741,13 +3699,13 @@ async function fr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3741
3699
|
function $(e) {
|
|
3742
3700
|
return `${typeof e}:${String(e)}`;
|
|
3743
3701
|
}
|
|
3744
|
-
function
|
|
3702
|
+
function ur(e) {
|
|
3745
3703
|
return `${typeof e}:${String(e)}`;
|
|
3746
3704
|
}
|
|
3747
|
-
function
|
|
3705
|
+
function dr(e) {
|
|
3748
3706
|
return e.map(({ postId: e }) => e);
|
|
3749
3707
|
}
|
|
3750
|
-
var
|
|
3708
|
+
var fr = class {
|
|
3751
3709
|
delay;
|
|
3752
3710
|
enabled;
|
|
3753
3711
|
maxReplayPages;
|
|
@@ -3779,10 +3737,10 @@ var hr = class {
|
|
|
3779
3737
|
}
|
|
3780
3738
|
recordInitialPage(e) {
|
|
3781
3739
|
e && this.recordPages([{
|
|
3782
|
-
contributionIds:
|
|
3783
|
-
cursor:
|
|
3740
|
+
contributionIds: dr(e.items),
|
|
3741
|
+
cursor: tn(e),
|
|
3784
3742
|
next: e.next,
|
|
3785
|
-
returnedIds:
|
|
3743
|
+
returnedIds: dr(e.items)
|
|
3786
3744
|
}]);
|
|
3787
3745
|
}
|
|
3788
3746
|
remove(e) {
|
|
@@ -3797,14 +3755,14 @@ var hr = class {
|
|
|
3797
3755
|
async reconcile({ existingItems: e, loadPage: t, onDelayChange: n = () => void 0, shouldPause: r = () => !1, signal: i }) {
|
|
3798
3756
|
let a = this.pending ?? this.createSession(e);
|
|
3799
3757
|
for (this.pending = a; a.remainingRequests > 0;) {
|
|
3800
|
-
let e =
|
|
3758
|
+
let e = ur(a.cursor);
|
|
3801
3759
|
if (a.seenCursors.has(e)) throw Error("Vibe removal reconciliation received a repeated cursor.");
|
|
3802
|
-
if (await
|
|
3803
|
-
delayMs:
|
|
3760
|
+
if (await dn({
|
|
3761
|
+
delayMs: un(a.pages.length, this.delay),
|
|
3804
3762
|
onChange: n,
|
|
3805
3763
|
signal: i
|
|
3806
3764
|
}), a.pages.length > 0 && r()) return this.result(a, "paused");
|
|
3807
|
-
let o =
|
|
3765
|
+
let o = Zt(await t({
|
|
3808
3766
|
cursor: a.cursor,
|
|
3809
3767
|
signal: i
|
|
3810
3768
|
}));
|
|
@@ -3817,7 +3775,7 @@ var hr = class {
|
|
|
3817
3775
|
contributionIds: c,
|
|
3818
3776
|
cursor: a.cursor,
|
|
3819
3777
|
next: o.next,
|
|
3820
|
-
returnedIds:
|
|
3778
|
+
returnedIds: dr(s)
|
|
3821
3779
|
}), 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");
|
|
3822
3780
|
}
|
|
3823
3781
|
return this.result(a, "complete");
|
|
@@ -3856,7 +3814,7 @@ var hr = class {
|
|
|
3856
3814
|
return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has($(e))).length < this.pageSize);
|
|
3857
3815
|
}
|
|
3858
3816
|
recordPage(e) {
|
|
3859
|
-
let t =
|
|
3817
|
+
let t = ur(e.cursor), n = this.pages.findIndex(({ cursor: e }) => ur(e) === t);
|
|
3860
3818
|
n >= 0 && (this.pages = this.pages.slice(0, n)), this.pages.push({
|
|
3861
3819
|
...e,
|
|
3862
3820
|
contributionIds: [...e.contributionIds],
|
|
@@ -3866,7 +3824,7 @@ var hr = class {
|
|
|
3866
3824
|
};
|
|
3867
3825
|
//#endregion
|
|
3868
3826
|
//#region src/core/activeItemRemoval.ts
|
|
3869
|
-
function
|
|
3827
|
+
function pr(e, t, n, r, i) {
|
|
3870
3828
|
let a = new Set(t.map(({ item: e }) => e.postId));
|
|
3871
3829
|
if (e.activeReelPostId === null || !a.has(e.activeReelPostId)) return;
|
|
3872
3830
|
let o = e.items[Math.max(n, 0)];
|
|
@@ -3879,7 +3837,7 @@ function gr(e, t, n, r, i) {
|
|
|
3879
3837
|
}
|
|
3880
3838
|
//#endregion
|
|
3881
3839
|
//#region src/core/exactMediaRemovalController.ts
|
|
3882
|
-
function
|
|
3840
|
+
function mr(e, t) {
|
|
3883
3841
|
let [n, ...r] = t;
|
|
3884
3842
|
if (!n) throw Error("Vibe items must contain at least one media asset.");
|
|
3885
3843
|
return {
|
|
@@ -3888,10 +3846,10 @@ function _r(e, t) {
|
|
|
3888
3846
|
items: r
|
|
3889
3847
|
};
|
|
3890
3848
|
}
|
|
3891
|
-
function
|
|
3849
|
+
function hr(e) {
|
|
3892
3850
|
if (!Number.isInteger(e.mediaIndex) || e.mediaIndex < 0) throw TypeError("Vibe mediaIndex must be a non-negative integer.");
|
|
3893
3851
|
}
|
|
3894
|
-
var
|
|
3852
|
+
var gr = class {
|
|
3895
3853
|
generation = 0;
|
|
3896
3854
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
3897
3855
|
state;
|
|
@@ -3899,7 +3857,7 @@ var yr = class {
|
|
|
3899
3857
|
this.options = e, this.state = e.state;
|
|
3900
3858
|
}
|
|
3901
3859
|
remove(e) {
|
|
3902
|
-
|
|
3860
|
+
hr(e);
|
|
3903
3861
|
let t = this.state.items.findIndex(({ postId: t }) => t === e.postId), n = this.state.items[t];
|
|
3904
3862
|
if (!n) return null;
|
|
3905
3863
|
let r = [...P(n)], i = r[e.mediaIndex];
|
|
@@ -3916,7 +3874,7 @@ var yr = class {
|
|
|
3916
3874
|
restored: !1
|
|
3917
3875
|
});
|
|
3918
3876
|
let o = this.state.mediaIndices.get(n.postId) ?? 0, s = this.isReelOpen() && this.state.activeReelPostId === n.postId, c = s && o === e.mediaIndex;
|
|
3919
|
-
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] =
|
|
3877
|
+
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);
|
|
3920
3878
|
}
|
|
3921
3879
|
reset() {
|
|
3922
3880
|
this.generation += 1;
|
|
@@ -3942,7 +3900,7 @@ var yr = class {
|
|
|
3942
3900
|
}
|
|
3943
3901
|
restoreIntoPost(e, t) {
|
|
3944
3902
|
let n = this.state.items[e], r = [...P(n)], i = Math.min(t.mediaIndex, r.length);
|
|
3945
|
-
if (r.splice(i, 0, t.media), this.state.items[e] =
|
|
3903
|
+
if (r.splice(i, 0, t.media), this.state.items[e] = mr(n, r), this.state.activeReelPostId !== t.postId) return;
|
|
3946
3904
|
let a = this.state.mediaIndices.get(t.postId) ?? 0;
|
|
3947
3905
|
a >= i && this.state.mediaIndices.set(t.postId, a + 1);
|
|
3948
3906
|
}
|
|
@@ -3955,18 +3913,18 @@ var yr = class {
|
|
|
3955
3913
|
};
|
|
3956
3914
|
//#endregion
|
|
3957
3915
|
//#region src/core/itemPlacement.ts
|
|
3958
|
-
function
|
|
3916
|
+
function _r(e, t) {
|
|
3959
3917
|
let n = new Set(t);
|
|
3960
3918
|
return e.flatMap((e, t) => n.has(e.postId) ? [{
|
|
3961
3919
|
index: t,
|
|
3962
3920
|
item: e
|
|
3963
3921
|
}] : []);
|
|
3964
3922
|
}
|
|
3965
|
-
function
|
|
3923
|
+
function vr(e, t) {
|
|
3966
3924
|
let n = new Set(t.map(({ item: e }) => e.postId));
|
|
3967
3925
|
return e.filter((e) => !n.has(e.postId));
|
|
3968
3926
|
}
|
|
3969
|
-
function
|
|
3927
|
+
function yr(e, t) {
|
|
3970
3928
|
t.forEach(({ index: e }) => {
|
|
3971
3929
|
if (!Number.isInteger(e) || e < 0) throw Error("Vibe item restore indexes must be non-negative integers.");
|
|
3972
3930
|
});
|
|
@@ -3977,7 +3935,7 @@ function Sr(e, t) {
|
|
|
3977
3935
|
}
|
|
3978
3936
|
//#endregion
|
|
3979
3937
|
//#region src/core/itemRemovalController.ts
|
|
3980
|
-
var
|
|
3938
|
+
var br = 20, xr = class {
|
|
3981
3939
|
generation = 0;
|
|
3982
3940
|
historyLimit;
|
|
3983
3941
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
@@ -3986,7 +3944,7 @@ var Cr = 20, wr = class {
|
|
|
3986
3944
|
itemOrder;
|
|
3987
3945
|
stopItemsWatcher;
|
|
3988
3946
|
constructor(e) {
|
|
3989
|
-
this.options = e, this.historyLimit = e.historyLimit ??
|
|
3947
|
+
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" });
|
|
3990
3948
|
}
|
|
3991
3949
|
destroy() {
|
|
3992
3950
|
this.reset(), this.stopItemsWatcher();
|
|
@@ -4000,7 +3958,7 @@ var Cr = 20, wr = class {
|
|
|
4000
3958
|
let a = this.options.startRemoval(i, t);
|
|
4001
3959
|
if (a > 0 && await new Promise((e) => setTimeout(e, a)), this.metadata.get(r)?.generation !== this.generation) return r;
|
|
4002
3960
|
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);
|
|
4003
|
-
return this.state.items =
|
|
3961
|
+
return this.state.items = vr(this.state.items, n), this.options.onItemsRemoved(r, n, l), this.record(r), r;
|
|
4004
3962
|
}
|
|
4005
3963
|
reset() {
|
|
4006
3964
|
this.generation += 1, this.history = [], this.itemOrder = [];
|
|
@@ -4011,7 +3969,7 @@ var Cr = 20, wr = class {
|
|
|
4011
3969
|
this.restoreRemoval(t);
|
|
4012
3970
|
return;
|
|
4013
3971
|
}
|
|
4014
|
-
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 =
|
|
3972
|
+
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);
|
|
4015
3973
|
this.registerExternalPlacements(r), this.state.items = i, r.length > 0 && this.options.onRemovalRestored(r);
|
|
4016
3974
|
}
|
|
4017
3975
|
restoreRemoval(e) {
|
|
@@ -4037,7 +3995,7 @@ var Cr = 20, wr = class {
|
|
|
4037
3995
|
}
|
|
4038
3996
|
collectOrderedPlacements(e) {
|
|
4039
3997
|
let t = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
4040
|
-
return
|
|
3998
|
+
return _r(this.state.items, e).map((e) => ({
|
|
4041
3999
|
index: t.get(e.item.postId) ?? e.index,
|
|
4042
4000
|
item: e.item
|
|
4043
4001
|
}));
|
|
@@ -4068,7 +4026,7 @@ var Cr = 20, wr = class {
|
|
|
4068
4026
|
let r = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
4069
4027
|
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;
|
|
4070
4028
|
}
|
|
4071
|
-
},
|
|
4029
|
+
}, Sr = class {
|
|
4072
4030
|
forward = null;
|
|
4073
4031
|
forwardPromise = null;
|
|
4074
4032
|
forwardVersion = 0;
|
|
@@ -4155,7 +4113,7 @@ var Cr = 20, wr = class {
|
|
|
4155
4113
|
}
|
|
4156
4114
|
}
|
|
4157
4115
|
}
|
|
4158
|
-
},
|
|
4116
|
+
}, Cr = class {
|
|
4159
4117
|
generation = 0;
|
|
4160
4118
|
pending = Promise.resolve();
|
|
4161
4119
|
constructor(e) {
|
|
@@ -4205,24 +4163,24 @@ var Cr = 20, wr = class {
|
|
|
4205
4163
|
};
|
|
4206
4164
|
//#endregion
|
|
4207
4165
|
//#region src/core/removalControllers.ts
|
|
4208
|
-
function
|
|
4209
|
-
let t = new
|
|
4166
|
+
function wr(e) {
|
|
4167
|
+
let t = new Sr(e), n = new Cr({
|
|
4210
4168
|
state: e.state,
|
|
4211
4169
|
transitionMedia: (t) => e.surface()?.transitionActiveReelMedia(t) ?? Promise.resolve(!1),
|
|
4212
4170
|
transitionPost: (t) => e.surface()?.transitionActiveReelPost(t) ?? Promise.resolve(!1)
|
|
4213
4171
|
});
|
|
4214
4172
|
return {
|
|
4215
|
-
exactMediaRemoval: new
|
|
4173
|
+
exactMediaRemoval: new gr({
|
|
4216
4174
|
onActivate: e.onActivate,
|
|
4217
4175
|
onPostRemoved: (t) => e.onItemsRemoved([t]),
|
|
4218
4176
|
onPostRestored: (t) => e.onItemsRestored([t]),
|
|
4219
4177
|
reelForward: t,
|
|
4220
4178
|
state: e.state
|
|
4221
4179
|
}),
|
|
4222
|
-
itemRemoval: new
|
|
4180
|
+
itemRemoval: new xr({
|
|
4223
4181
|
historyLimit: e.historyLimit,
|
|
4224
4182
|
onItemsRemoved: (n, r, i) => {
|
|
4225
|
-
e.onItemsRemoved(r.map(({ item: e }) => e.postId)),
|
|
4183
|
+
e.onItemsRemoved(r.map(({ item: e }) => e.postId)), pr(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
|
|
4226
4184
|
},
|
|
4227
4185
|
onRemovalRestored: (n) => {
|
|
4228
4186
|
e.onItemsRestored(n.map(({ item: e }) => e.postId));
|
|
@@ -4237,17 +4195,17 @@ function Dr(e) {
|
|
|
4237
4195
|
reelRemoval: n
|
|
4238
4196
|
};
|
|
4239
4197
|
}
|
|
4240
|
-
var
|
|
4241
|
-
function
|
|
4198
|
+
var Tr = 1.5;
|
|
4199
|
+
function Er(e) {
|
|
4242
4200
|
let t = Math.min(e.screenWidth, e.screenHeight);
|
|
4243
4201
|
if (t > 0 && t < 600) return !0;
|
|
4244
|
-
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n *
|
|
4202
|
+
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * Tr;
|
|
4245
4203
|
return !e.hasHover && n > 0 && n < 600 && r;
|
|
4246
4204
|
}
|
|
4247
|
-
function
|
|
4248
|
-
return
|
|
4205
|
+
function Dr(e) {
|
|
4206
|
+
return Er(e) ? "reel" : "masonry";
|
|
4249
4207
|
}
|
|
4250
|
-
function
|
|
4208
|
+
function Or(e) {
|
|
4251
4209
|
let t = e.ownerDocument.defaultView, n = e.ownerDocument.documentElement;
|
|
4252
4210
|
return {
|
|
4253
4211
|
hasHover: typeof t?.matchMedia == "function" && t.matchMedia("(hover: hover)").matches,
|
|
@@ -4257,15 +4215,15 @@ function jr(e) {
|
|
|
4257
4215
|
viewportWidth: n.clientWidth
|
|
4258
4216
|
};
|
|
4259
4217
|
}
|
|
4260
|
-
function
|
|
4261
|
-
return
|
|
4218
|
+
function kr(e) {
|
|
4219
|
+
return Er(Or(e));
|
|
4262
4220
|
}
|
|
4263
|
-
function
|
|
4264
|
-
return
|
|
4221
|
+
function Ar(e) {
|
|
4222
|
+
return Dr(Or(e));
|
|
4265
4223
|
}
|
|
4266
4224
|
//#endregion
|
|
4267
4225
|
//#region src/core/responsiveLayoutController.ts
|
|
4268
|
-
var
|
|
4226
|
+
var jr = class {
|
|
4269
4227
|
layoutMode;
|
|
4270
4228
|
resizeObserver = null;
|
|
4271
4229
|
target = null;
|
|
@@ -4290,10 +4248,10 @@ var Pr = class {
|
|
|
4290
4248
|
}
|
|
4291
4249
|
handleResponsiveLayout = () => {
|
|
4292
4250
|
if (!this.target) return;
|
|
4293
|
-
let e =
|
|
4294
|
-
this.state.phoneMode =
|
|
4251
|
+
let e = Ar(this.target);
|
|
4252
|
+
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);
|
|
4295
4253
|
};
|
|
4296
|
-
},
|
|
4254
|
+
}, Mr = class {
|
|
4297
4255
|
state;
|
|
4298
4256
|
constructor(e) {
|
|
4299
4257
|
this.options = e, this.state = x(Ze({
|
|
@@ -4307,7 +4265,7 @@ var Pr = class {
|
|
|
4307
4265
|
set(e, t = !1) {
|
|
4308
4266
|
Object.assign(this.state, Ze(e, this.state)), t && this.options.onReelAudioStateChange?.(this.get());
|
|
4309
4267
|
}
|
|
4310
|
-
},
|
|
4268
|
+
}, Nr = class {
|
|
4311
4269
|
routedReelPostId = null;
|
|
4312
4270
|
reelRouteIsActive = !1;
|
|
4313
4271
|
constructor(e, t) {
|
|
@@ -4334,7 +4292,7 @@ var Pr = class {
|
|
|
4334
4292
|
let i = this.reelRouteIsActive ? "replace" : "push";
|
|
4335
4293
|
this.reelRouteIsActive = !0, this.routedReelPostId = e, this.options.router[i](r);
|
|
4336
4294
|
}
|
|
4337
|
-
},
|
|
4295
|
+
}, Pr = class {
|
|
4338
4296
|
app = null;
|
|
4339
4297
|
autoScroll;
|
|
4340
4298
|
autofillController;
|
|
@@ -4357,24 +4315,24 @@ var Pr = class {
|
|
|
4357
4315
|
reelAudio;
|
|
4358
4316
|
state;
|
|
4359
4317
|
constructor(e) {
|
|
4360
|
-
this.options = e,
|
|
4318
|
+
this.options = e, sr(e);
|
|
4361
4319
|
let t = e.layout ?? "masonry";
|
|
4362
|
-
this.state = x(
|
|
4320
|
+
this.state = x(ir(e, t)), this.reelAudio = new Mr(e), this.lastLoadedCursor = e.initialPage ? tn(e.initialPage) : null, this.notificationItems = R(this.state), this.autoScroll = new On({
|
|
4363
4321
|
getScrollElement: () => this.surface?.getAutoScrollElement() ?? null,
|
|
4364
4322
|
state: this.state.autoScroll
|
|
4365
|
-
}), this.autofillController = new
|
|
4323
|
+
}), this.autofillController = new Sn({
|
|
4366
4324
|
cancelRequest: () => this.cancelRequest(),
|
|
4367
4325
|
onLastCursor: (e) => this.setCurrentCursor(e),
|
|
4368
4326
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
4369
4327
|
options: e.autofill,
|
|
4370
4328
|
state: this.state
|
|
4371
|
-
}), this.removalReconciliation = new
|
|
4329
|
+
}), this.removalReconciliation = new fr(e), this.removalReconciliation.recordInitialPage(e.initialPage), this.fillController = new Yn({
|
|
4372
4330
|
fill: e.fill,
|
|
4373
4331
|
loadPage: e.loadPage ? (e) => this.loadFilteredPage(e) : void 0,
|
|
4374
4332
|
needsFrontendPreparation: () => this.removalReconciliation.needsReconciliation(this.state.items),
|
|
4375
4333
|
onLastCursor: (e) => this.setCurrentCursor(e),
|
|
4376
4334
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
4377
|
-
prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) =>
|
|
4335
|
+
prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) => Xn({
|
|
4378
4336
|
controller: this.removalReconciliation,
|
|
4379
4337
|
isCurrent: t,
|
|
4380
4338
|
loadPage: e.loadPage,
|
|
@@ -4384,8 +4342,8 @@ var Pr = class {
|
|
|
4384
4342
|
state: this.state
|
|
4385
4343
|
}),
|
|
4386
4344
|
state: this.state
|
|
4387
|
-
}), this.routing = new
|
|
4388
|
-
let n =
|
|
4345
|
+
}), this.routing = new Nr(e.routing, this.state);
|
|
4346
|
+
let n = wr({
|
|
4389
4347
|
historyLimit: e.removalHistoryLimit,
|
|
4390
4348
|
onActivate: (e) => this.setActiveReelPost(e),
|
|
4391
4349
|
onItemsRemoved: (e) => this.removalReconciliation.remove(e),
|
|
@@ -4394,20 +4352,20 @@ var Pr = class {
|
|
|
4394
4352
|
state: this.state,
|
|
4395
4353
|
surface: () => this.surface
|
|
4396
4354
|
});
|
|
4397
|
-
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new
|
|
4355
|
+
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new jr(t, this.state, () => {
|
|
4398
4356
|
this.routing.syncFeed();
|
|
4399
4357
|
}), this.startStateNotifications();
|
|
4400
4358
|
}
|
|
4401
4359
|
async mount() {
|
|
4402
4360
|
if (this.app) throw Error("Vibe is already mounted.");
|
|
4403
4361
|
this.startStateNotifications();
|
|
4404
|
-
let e =
|
|
4405
|
-
this.responsiveLayout.mount(e), this.app = i(
|
|
4362
|
+
let e = cr(this.options.target);
|
|
4363
|
+
this.responsiveLayout.mount(e), this.app = i(Xt, {
|
|
4406
4364
|
canRetryEnd: !!this.options.loadPage,
|
|
4407
4365
|
cardFooter: this.options.cardFooter,
|
|
4408
4366
|
cardHeader: this.options.cardHeader,
|
|
4409
4367
|
feedFooter: this.options.feedFooter,
|
|
4410
|
-
feedFooterActions:
|
|
4368
|
+
feedFooterActions: Zn(this),
|
|
4411
4369
|
mediaCard: this.options.mediaCard,
|
|
4412
4370
|
masonry: this.options.masonry,
|
|
4413
4371
|
onMediaReady: this.options.onMediaReady,
|
|
@@ -4432,7 +4390,7 @@ var Pr = class {
|
|
|
4432
4390
|
onRetryForward: () => {
|
|
4433
4391
|
this.retryReelForward();
|
|
4434
4392
|
}
|
|
4435
|
-
}), this.surface = this.app.mount(e), this.autoScroll.mount(), await
|
|
4393
|
+
}), this.surface = this.app.mount(e), this.autoScroll.mount(), await Nn(this.options.restoreBacklog, (e) => this.appendPage(e), (e) => {
|
|
4436
4394
|
this.restoreController = e;
|
|
4437
4395
|
}), !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();
|
|
4438
4396
|
}
|
|
@@ -4503,7 +4461,7 @@ var Pr = class {
|
|
|
4503
4461
|
this.autoScroll.setSpeed(e);
|
|
4504
4462
|
}
|
|
4505
4463
|
applyAutofillUpdate(e) {
|
|
4506
|
-
let t =
|
|
4464
|
+
let t = jn(this.options.autofill, this.state, e);
|
|
4507
4465
|
return t && this.autofillController.syncCountdown(), t;
|
|
4508
4466
|
}
|
|
4509
4467
|
cancelAutofill() {
|
|
@@ -4514,7 +4472,7 @@ var Pr = class {
|
|
|
4514
4472
|
await this.cancelFill();
|
|
4515
4473
|
return;
|
|
4516
4474
|
}
|
|
4517
|
-
if (
|
|
4475
|
+
if (vn(this.state.autofill)) {
|
|
4518
4476
|
await this.cancelAutofill();
|
|
4519
4477
|
return;
|
|
4520
4478
|
}
|
|
@@ -4528,12 +4486,12 @@ var Pr = class {
|
|
|
4528
4486
|
}
|
|
4529
4487
|
async fill(e) {
|
|
4530
4488
|
if (!this.state.loadMoreLocked) {
|
|
4531
|
-
if (this.pendingRequest ||
|
|
4489
|
+
if (this.pendingRequest || vn(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
|
|
4532
4490
|
await this.fillController.start(e);
|
|
4533
4491
|
}
|
|
4534
4492
|
}
|
|
4535
4493
|
restoreAutofillSession(e) {
|
|
4536
|
-
let t =
|
|
4494
|
+
let t = Mn(this.options.autofill, this.state, e);
|
|
4537
4495
|
return t && this.autofillController.syncCountdown(), t;
|
|
4538
4496
|
}
|
|
4539
4497
|
restoreFillSession(e) {
|
|
@@ -4543,14 +4501,14 @@ var Pr = class {
|
|
|
4543
4501
|
return this.startLoadMore(() => this.loadNextSequence());
|
|
4544
4502
|
}
|
|
4545
4503
|
appendPage(e) {
|
|
4546
|
-
|
|
4504
|
+
nn(e, this.state, this.removalReconciliation, (e) => this.setCurrentCursor(e));
|
|
4547
4505
|
}
|
|
4548
4506
|
replenishAfterRemoval() {
|
|
4549
4507
|
return this.startLoadMore(() => this.replenishAfterRemovalSequence());
|
|
4550
4508
|
}
|
|
4551
4509
|
async startLoadMore(e) {
|
|
4552
4510
|
if (this.pendingRequest) return this.pendingRequest;
|
|
4553
|
-
if (this.state.loadMoreLocked ||
|
|
4511
|
+
if (this.state.loadMoreLocked || vn(this.state.autofill) || this.fillController.isActive() || !this.options.loadPage || this.state.next === null && !this.removalReconciliation.needsReconciliation(this.state.items)) return;
|
|
4554
4512
|
this.state.isLoadingMore = !0, this.state.nextPageError = null;
|
|
4555
4513
|
let t = e();
|
|
4556
4514
|
return this.pendingRequest = t, t.finally(() => {
|
|
@@ -4565,12 +4523,12 @@ var Pr = class {
|
|
|
4565
4523
|
}
|
|
4566
4524
|
async replaceFeed(e, t) {
|
|
4567
4525
|
if (!this.options.loadPage) throw Error(`Vibe cannot ${t} without loadPage.`);
|
|
4568
|
-
return
|
|
4526
|
+
return vn(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.state.autofill = _n(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);
|
|
4569
4527
|
}
|
|
4570
4528
|
async loadFilteredPage(e) {
|
|
4571
4529
|
let t = this.options.loadPage;
|
|
4572
4530
|
if (!t) throw Error("Vibe cannot load a page without loadPage.");
|
|
4573
|
-
let n =
|
|
4531
|
+
let n = Zt(await t(e));
|
|
4574
4532
|
return {
|
|
4575
4533
|
...n,
|
|
4576
4534
|
items: this.removalReconciliation.filterItems(n.items)
|
|
@@ -4589,7 +4547,7 @@ var Pr = class {
|
|
|
4589
4547
|
let t = ++this.requestVersion, n = new AbortController();
|
|
4590
4548
|
this.abortController = n;
|
|
4591
4549
|
try {
|
|
4592
|
-
let r = await
|
|
4550
|
+
let r = await Xn({
|
|
4593
4551
|
controller: this.removalReconciliation,
|
|
4594
4552
|
isCurrent: () => t === this.requestVersion,
|
|
4595
4553
|
loadPage: e,
|
|
@@ -4607,7 +4565,7 @@ var Pr = class {
|
|
|
4607
4565
|
}
|
|
4608
4566
|
async retryEnd() {
|
|
4609
4567
|
if (this.pendingRequest) return this.pendingRequest;
|
|
4610
|
-
if (!this.state.loadMoreLocked && !(
|
|
4568
|
+
if (!this.state.loadMoreLocked && !(vn(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);
|
|
4611
4569
|
}
|
|
4612
4570
|
setInfiniteScroll(e) {
|
|
4613
4571
|
this.state.infiniteScroll = e, e && m(() => this.surface?.loadIfNearBottom());
|
|
@@ -4631,10 +4589,10 @@ var Pr = class {
|
|
|
4631
4589
|
this.state.total = e;
|
|
4632
4590
|
}
|
|
4633
4591
|
setReelAutoAdvance(e) {
|
|
4634
|
-
|
|
4592
|
+
tr(this.state.reelAutoAdvance, e);
|
|
4635
4593
|
}
|
|
4636
4594
|
setReelInfoSheet(e) {
|
|
4637
|
-
|
|
4595
|
+
rr(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
|
|
4638
4596
|
}
|
|
4639
4597
|
setLayout(e) {
|
|
4640
4598
|
this.responsiveLayout.setLayout(e);
|
|
@@ -4654,7 +4612,7 @@ var Pr = class {
|
|
|
4654
4612
|
async fetchPage(e, t) {
|
|
4655
4613
|
if (!this.options.loadPage) return;
|
|
4656
4614
|
let n = ++this.requestVersion, r = new AbortController();
|
|
4657
|
-
this.abortController = r, await
|
|
4615
|
+
this.abortController = r, await lr({
|
|
4658
4616
|
append: t,
|
|
4659
4617
|
autofillController: this.autofillController,
|
|
4660
4618
|
cursor: e,
|
|
@@ -4676,7 +4634,7 @@ var Pr = class {
|
|
|
4676
4634
|
startInitialAutofill() {
|
|
4677
4635
|
let e = ++this.requestVersion, t = new AbortController(), n = this.autofillController.beginCycle();
|
|
4678
4636
|
this.abortController = t, this.state.isLoadingMore = !0;
|
|
4679
|
-
let r =
|
|
4637
|
+
let r = Pn({
|
|
4680
4638
|
cycleId: n,
|
|
4681
4639
|
isCurrent: () => e === this.requestVersion,
|
|
4682
4640
|
onCollection: (t) => this.autofillController.captureCollection(t, e === this.requestVersion),
|
|
@@ -4703,8 +4661,8 @@ var Pr = class {
|
|
|
4703
4661
|
this.lastLoadedCursor = e, this.state.current = e;
|
|
4704
4662
|
}
|
|
4705
4663
|
};
|
|
4706
|
-
function
|
|
4707
|
-
return new
|
|
4664
|
+
function Fr(e) {
|
|
4665
|
+
return new Pr(e);
|
|
4708
4666
|
}
|
|
4709
4667
|
//#endregion
|
|
4710
|
-
export {
|
|
4668
|
+
export { Fr as createVibe };
|