@wyxos/vibe 5.0.1 → 5.0.3
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 +24 -3
- package/lib/components/ReelFeed.vue.d.ts +2 -0
- package/lib/components/ReelLayout.vue.d.ts +2 -0
- package/lib/components/VibeSurface.vue.d.ts +3 -1
- package/lib/components/useReelKeyboard.d.ts +12 -0
- package/lib/components/useReelVideoActivity.d.ts +15 -0
- package/lib/core/feed.d.ts +3 -1
- package/lib/core/reelEscapeStack.d.ts +6 -0
- package/lib/index.cjs +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +550 -440
- package/lib/types.d.ts +7 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -142,7 +142,7 @@ var L = {
|
|
|
142
142
|
"show-load-more"
|
|
143
143
|
]));
|
|
144
144
|
}
|
|
145
|
-
}), W = ["role"],
|
|
145
|
+
}), W = ["role"], ee = { class: "gallery-status" }, te = /* @__PURE__ */ d({
|
|
146
146
|
__name: "FeedStatus",
|
|
147
147
|
props: {
|
|
148
148
|
actions: {},
|
|
@@ -156,7 +156,7 @@ var L = {
|
|
|
156
156
|
return (n, u) => (b(), s("main", {
|
|
157
157
|
class: "gallery-shell",
|
|
158
158
|
role: r.state.error ? "alert" : r.state.isLoading ? "status" : void 0
|
|
159
|
-
}, [c("p",
|
|
159
|
+
}, [c("p", ee, [r.state.error ? (b(), s(e, { key: 0 }, [l(" Unable to load media. ")], 64)) : r.state.isLoading ? (b(), s(e, { key: 1 }, [l(" Loading media… ")], 64)) : (b(), s(e, { key: 2 }, [l(" No media found. ")], 64))]), t.feedFooter ? (b(), a(U, {
|
|
160
160
|
key: 0,
|
|
161
161
|
actions: t.actions,
|
|
162
162
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -181,33 +181,33 @@ var L = {
|
|
|
181
181
|
])) : o("", !0)], 8, W));
|
|
182
182
|
}
|
|
183
183
|
});
|
|
184
|
-
function
|
|
184
|
+
function G(e) {
|
|
185
185
|
return e.scrollHeight - e.scrollTop - e.clientHeight <= 240;
|
|
186
186
|
}
|
|
187
187
|
//#endregion
|
|
188
188
|
//#region src/core/masonry.ts
|
|
189
|
-
function
|
|
189
|
+
function K(e) {
|
|
190
190
|
let t = e.preview.width ?? e.width, n = e.preview.height ?? e.height;
|
|
191
191
|
return !t || !n || t <= 0 || n <= 0 ? 1 : n / t;
|
|
192
192
|
}
|
|
193
193
|
function ne(e) {
|
|
194
194
|
return e.reduce((t, n, r) => n < e[t] ? r : t, 0);
|
|
195
195
|
}
|
|
196
|
-
function
|
|
196
|
+
function q(e) {
|
|
197
197
|
return Math.max(0, e.containerHeight) + Math.max(0, e.gap);
|
|
198
198
|
}
|
|
199
|
-
function
|
|
199
|
+
function re(e, t) {
|
|
200
200
|
let n = Math.max(0, t.overscan), r = t.scrollTop - n, i = t.scrollTop + Math.max(0, t.viewportHeight) + n;
|
|
201
201
|
return e.reduce((e, t, n) => (t.y + t.height >= r && t.y <= i && e.push(n), e), []);
|
|
202
202
|
}
|
|
203
|
-
function
|
|
203
|
+
function J(e, t, n) {
|
|
204
204
|
if (t <= 0 || e.length === 0) return {
|
|
205
205
|
columns: 0,
|
|
206
206
|
height: 0,
|
|
207
207
|
items: []
|
|
208
208
|
};
|
|
209
209
|
let r = Math.max(0, n.gap), i = Number.isFinite(n.additionalHeight) ? Math.max(0, n.additionalHeight ?? 0) : 0, a = Math.max(1, n.minColumnWidth), o = Math.max(1, Math.floor((t + r) / (a + r))), s = (t - r * (o - 1)) / o, c = Array.from({ length: o }, () => 0), l = e.map((e) => {
|
|
210
|
-
let t = ne(c), n = s *
|
|
210
|
+
let t = ne(c), n = s * K(e) + i, a = {
|
|
211
211
|
x: t * (s + r),
|
|
212
212
|
y: c[t],
|
|
213
213
|
width: s,
|
|
@@ -223,10 +223,10 @@ function ae(e, t, n) {
|
|
|
223
223
|
}
|
|
224
224
|
//#endregion
|
|
225
225
|
//#region src/core/scrollbar.ts
|
|
226
|
-
function
|
|
226
|
+
function ie(e, t, n) {
|
|
227
227
|
return Math.min(n, Math.max(t, e));
|
|
228
228
|
}
|
|
229
|
-
function
|
|
229
|
+
function ae({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize: r, viewportSize: i }) {
|
|
230
230
|
let a = Math.max(0, e), o = Math.max(0, r), s = Math.max(0, i), c = Math.max(0, a - s);
|
|
231
231
|
if (!(c > 0 && o > 0)) return {
|
|
232
232
|
maximumScrollPosition: c,
|
|
@@ -235,23 +235,23 @@ function oe({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize:
|
|
|
235
235
|
thumbSize: o,
|
|
236
236
|
thumbTravel: 0
|
|
237
237
|
};
|
|
238
|
-
let l =
|
|
238
|
+
let l = ie(s / a * o, Math.min(Math.max(0, t), o), o), u = Math.max(0, o - l);
|
|
239
239
|
return {
|
|
240
240
|
maximumScrollPosition: c,
|
|
241
241
|
scrollable: !0,
|
|
242
|
-
thumbOffset: u * (
|
|
242
|
+
thumbOffset: u * (ie(n, 0, c) / c),
|
|
243
243
|
thumbSize: l,
|
|
244
244
|
thumbTravel: u
|
|
245
245
|
};
|
|
246
246
|
}
|
|
247
247
|
//#endregion
|
|
248
248
|
//#region src/components/GalleryScrollbar.vue?vue&type=script&setup=true&lang.ts
|
|
249
|
-
var
|
|
249
|
+
var oe = ["aria-hidden"], se = [
|
|
250
250
|
"aria-controls",
|
|
251
251
|
"aria-valuemax",
|
|
252
252
|
"aria-valuenow",
|
|
253
253
|
"tabindex"
|
|
254
|
-
], ce = 32, Y = 40, le = 120,
|
|
254
|
+
], ce = 32, Y = 40, le = 120, ue = /* @__PURE__ */ d({
|
|
255
255
|
__name: "GalleryScrollbar",
|
|
256
256
|
props: {
|
|
257
257
|
contentSize: {},
|
|
@@ -280,7 +280,7 @@ var J = ["aria-hidden"], se = [
|
|
|
280
280
|
}
|
|
281
281
|
function j() {
|
|
282
282
|
let e = t.scrollElement, r = i.value;
|
|
283
|
-
return !e || !r ? n :
|
|
283
|
+
return !e || !r ? n : ae({
|
|
284
284
|
contentSize: e.scrollHeight,
|
|
285
285
|
minimumThumbSize: ce,
|
|
286
286
|
scrollPosition: e.scrollTop,
|
|
@@ -381,12 +381,12 @@ var J = ["aria-hidden"], se = [
|
|
|
381
381
|
onPointerdown: I,
|
|
382
382
|
onPointermove: L,
|
|
383
383
|
onPointerup: R
|
|
384
|
-
}, null, 44, se)], 42,
|
|
384
|
+
}, null, 44, se)], 42, oe));
|
|
385
385
|
}
|
|
386
|
-
}),
|
|
386
|
+
}), de = (e) => {
|
|
387
387
|
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
|
388
388
|
return !1;
|
|
389
|
-
},
|
|
389
|
+
}, fe = (e) => e === "", X = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), Z = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), pe = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), me = (e) => {
|
|
390
390
|
let t = pe(e);
|
|
391
391
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
392
392
|
}, he = {
|
|
@@ -405,9 +405,9 @@ var J = ["aria-hidden"], se = [
|
|
|
405
405
|
width: o,
|
|
406
406
|
height: o,
|
|
407
407
|
stroke: s,
|
|
408
|
-
"stroke-width":
|
|
409
|
-
class:
|
|
410
|
-
...!l.default && !
|
|
408
|
+
"stroke-width": fe(n) || fe(r) || n === !0 || r === !0 ? Number(i || a || he["stroke-width"]) * 24 / Number(o) : i || a || he["stroke-width"],
|
|
409
|
+
class: X("lucide", c.class, ...e ? [`lucide-${Z(me(e))}-icon`, `lucide-${Z(e)}`] : ["lucide-icon"]),
|
|
410
|
+
...!l.default && !de(c) && { "aria-hidden": "true" }
|
|
411
411
|
}, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]), _e = (e, t) => (n, { slots: r, attrs: i }) => p(ge, {
|
|
412
412
|
...i,
|
|
413
413
|
...n,
|
|
@@ -642,7 +642,44 @@ var ke = /* @__PURE__ */ d({
|
|
|
642
642
|
c("output", Ie, T(u(p.value)) + " / " + T(u(f.value)), 1)
|
|
643
643
|
])) : o("", !0)], 34));
|
|
644
644
|
}
|
|
645
|
-
})
|
|
645
|
+
});
|
|
646
|
+
//#endregion
|
|
647
|
+
//#region src/components/useReelVideoActivity.ts
|
|
648
|
+
function Re(e) {
|
|
649
|
+
let t = r(() => e.layout() !== "reel" || e.active() === !0), n = r(() => t.value ? e.videoIsMuted.value : !0);
|
|
650
|
+
function i() {
|
|
651
|
+
if (!t.value) {
|
|
652
|
+
e.videoElement.value?.pause(), e.videoIsPlaying.value = !1;
|
|
653
|
+
return;
|
|
654
|
+
}
|
|
655
|
+
e.videoIsPlaying.value = !0;
|
|
656
|
+
}
|
|
657
|
+
return O(t, (n) => {
|
|
658
|
+
let r = e.videoElement.value;
|
|
659
|
+
if (!n) {
|
|
660
|
+
r?.pause(), r && (r.muted = !0), e.videoIsPlaying.value = !1;
|
|
661
|
+
return;
|
|
662
|
+
}
|
|
663
|
+
m().then(async () => {
|
|
664
|
+
let n = e.videoElement.value;
|
|
665
|
+
if (!(!n || !t.value)) {
|
|
666
|
+
n.muted = e.videoIsMuted.value;
|
|
667
|
+
try {
|
|
668
|
+
await n.play();
|
|
669
|
+
} catch {
|
|
670
|
+
e.videoIsPlaying.value = !1;
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
});
|
|
674
|
+
}), {
|
|
675
|
+
effectiveMuted: n,
|
|
676
|
+
onPlaying: i,
|
|
677
|
+
playbackAllowed: t
|
|
678
|
+
};
|
|
679
|
+
}
|
|
680
|
+
//#endregion
|
|
681
|
+
//#region src/components/MediaCard.vue?vue&type=script&setup=true&lang.ts
|
|
682
|
+
var ze = [
|
|
646
683
|
"data-post-id",
|
|
647
684
|
"data-media-index",
|
|
648
685
|
"aria-hidden",
|
|
@@ -650,24 +687,25 @@ var ke = /* @__PURE__ */ d({
|
|
|
650
687
|
"inert",
|
|
651
688
|
"role",
|
|
652
689
|
"tabindex"
|
|
653
|
-
],
|
|
690
|
+
], Be = { class: "media-card-content" }, Ve = ["data-media-direction"], He = ["data-media-index"], Ue = {
|
|
654
691
|
key: 0,
|
|
655
692
|
"data-test": "media-loading",
|
|
656
693
|
class: "media-loading",
|
|
657
694
|
"aria-hidden": "true"
|
|
658
|
-
},
|
|
695
|
+
}, We = ["aria-label"], Ge = { class: "media-error-code" }, Ke = [
|
|
659
696
|
"src",
|
|
660
697
|
"width",
|
|
661
698
|
"height",
|
|
699
|
+
"autoplay",
|
|
662
700
|
"loop",
|
|
663
701
|
"muted",
|
|
664
702
|
"preload"
|
|
665
|
-
],
|
|
703
|
+
], qe = [
|
|
666
704
|
"src",
|
|
667
705
|
"width",
|
|
668
706
|
"height",
|
|
669
707
|
"fetchpriority"
|
|
670
|
-
],
|
|
708
|
+
], Je = ["aria-label"], Ye = ["aria-label"], Xe = ["aria-label"], Ze = 40, Qe = 160, $e = 24, et = /* @__PURE__ */ d({
|
|
671
709
|
__name: "MediaCard",
|
|
672
710
|
props: {
|
|
673
711
|
active: { type: Boolean },
|
|
@@ -703,46 +741,52 @@ var ke = /* @__PURE__ */ d({
|
|
|
703
741
|
function S(e = !1, t = "pointer") {
|
|
704
742
|
e && x("activate", t);
|
|
705
743
|
}
|
|
706
|
-
let C = r(() => M(l.item)), D = r(() => N(l.item, l.mediaIndex)), O = r(() => P(l.item, D.value)), F = r(() => l.mediaSource === "original" ? O.value.src : O.value.preview.src), I = r(() => l.mediaSource === "original" ? O.value.width : O.value.preview.width), L = r(() => l.mediaSource === "original" ? O.value.height : O.value.preview.height), R = w(null), z = w(0), B = w(0), V = w(l.mediaCard?.videoMuted ?? l.layout === "masonry"), H = w(!1), U = w(1), W = 1,
|
|
707
|
-
|
|
744
|
+
let C = r(() => M(l.item)), D = r(() => N(l.item, l.mediaIndex)), O = r(() => P(l.item, D.value)), F = r(() => l.mediaSource === "original" ? O.value.src : O.value.preview.src), I = r(() => l.mediaSource === "original" ? O.value.width : O.value.preview.width), L = r(() => l.mediaSource === "original" ? O.value.height : O.value.preview.height), R = w(null), z = w(0), B = w(0), V = w(l.mediaCard?.videoMuted ?? l.layout === "masonry"), H = w(!1), U = w(1), W = 1, { effectiveMuted: ee, onPlaying: te, playbackAllowed: G } = Re({
|
|
745
|
+
active: () => l.active,
|
|
746
|
+
layout: () => l.layout,
|
|
747
|
+
videoElement: R,
|
|
748
|
+
videoIsMuted: V,
|
|
749
|
+
videoIsPlaying: H
|
|
750
|
+
}), K = r(() => l.interactive && !!(l.cardHeader || l.cardFooter));
|
|
751
|
+
function ne(e) {
|
|
708
752
|
return e.detail === 0 ? "keyboard" : "pointer";
|
|
709
753
|
}
|
|
710
|
-
function
|
|
754
|
+
function q(e, t) {
|
|
711
755
|
let n = C.value.length, r = (e + n) % n;
|
|
712
756
|
r !== D.value && (y.value = e < D.value ? "previous" : "next", x("mediaChange", r), t && t.detail > 0 && t.currentTarget?.blur());
|
|
713
757
|
}
|
|
714
|
-
function
|
|
758
|
+
function re(e, t, n) {
|
|
715
759
|
return t === 1 ? e * 16 : t === 2 ? e * n : e;
|
|
716
760
|
}
|
|
717
|
-
function
|
|
761
|
+
function J() {
|
|
718
762
|
f = 0, p = !1, d !== null && clearTimeout(d), d = null;
|
|
719
763
|
}
|
|
720
|
-
function
|
|
721
|
-
d !== null && clearTimeout(d), d = setTimeout(
|
|
764
|
+
function ie() {
|
|
765
|
+
d !== null && clearTimeout(d), d = setTimeout(J, Qe);
|
|
722
766
|
}
|
|
723
|
-
function
|
|
767
|
+
function ae(e) {
|
|
724
768
|
if (C.value.length <= 1) return;
|
|
725
|
-
let t = e.currentTarget?.clientWidth || 1, n =
|
|
726
|
-
if (n === 0 || (e.preventDefault(),
|
|
769
|
+
let t = e.currentTarget?.clientWidth || 1, n = re(e.deltaX, e.deltaMode, t);
|
|
770
|
+
if (n === 0 || (e.preventDefault(), ie(), p) || (f += n, Math.abs(f) < $e)) return;
|
|
727
771
|
let r = Math.sign(f);
|
|
728
|
-
f = 0, p = !0,
|
|
772
|
+
f = 0, p = !0, q(D.value + r);
|
|
729
773
|
}
|
|
730
|
-
function
|
|
774
|
+
function oe(e) {
|
|
731
775
|
let t = e.touches[0];
|
|
732
776
|
l.layout !== "reel" || !t || (m = t.clientX, g = t.clientY);
|
|
733
777
|
}
|
|
734
|
-
function
|
|
778
|
+
function se(e) {
|
|
735
779
|
let t = e.changedTouches[0];
|
|
736
780
|
if (m === null || g === null || !t) return;
|
|
737
781
|
let n = m - t.clientX, r = g - t.clientY;
|
|
738
|
-
m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) <
|
|
782
|
+
m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) < Ze || q(D.value + Math.sign(n)));
|
|
739
783
|
}
|
|
740
|
-
let
|
|
741
|
-
function
|
|
742
|
-
l.layout === "reel" && (e.stopPropagation(),
|
|
784
|
+
let ce = r(() => Oe(F.value)), Y = r(() => l.layout === "reel" && l.stationaryReelControls === !0), le = r(() => ce.value && l.previewState === "ready" && (!Y.value || !!(l.active && l.reelControlsTarget))), ue = r(() => `${l.item.postId}:${D.value}:${F.value}`);
|
|
785
|
+
function de(e) {
|
|
786
|
+
l.layout === "reel" && (e.stopPropagation(), fe());
|
|
743
787
|
}
|
|
744
|
-
async function
|
|
745
|
-
if (R.value) {
|
|
788
|
+
async function fe() {
|
|
789
|
+
if (!(!R.value || !G.value)) {
|
|
746
790
|
if (H.value) {
|
|
747
791
|
R.value.pause();
|
|
748
792
|
return;
|
|
@@ -759,30 +803,30 @@ var ke = /* @__PURE__ */ d({
|
|
|
759
803
|
}
|
|
760
804
|
function Z(e) {
|
|
761
805
|
let t = e?.currentTarget ?? R.value;
|
|
762
|
-
t && (z.value = X(t.currentTime), B.value = X(t.duration), V.value = t.muted, U.value = t.volume, t.volume > 0 && (W = t.volume));
|
|
806
|
+
t && (z.value = X(t.currentTime), B.value = X(t.duration), G.value && (V.value = t.muted), U.value = t.volume, t.volume > 0 && (W = t.volume));
|
|
763
807
|
}
|
|
764
|
-
function
|
|
808
|
+
function pe(e) {
|
|
765
809
|
Z(e), x("ready", D.value);
|
|
766
810
|
}
|
|
767
|
-
function
|
|
811
|
+
function me() {
|
|
768
812
|
H.value = !1, x("ended", D.value);
|
|
769
813
|
}
|
|
770
|
-
function
|
|
814
|
+
function he(e) {
|
|
771
815
|
let t = R.value;
|
|
772
816
|
!t || !Number.isFinite(e) || (t.currentTime = Math.min(X(t.duration), Math.max(0, e)), z.value = t.currentTime);
|
|
773
817
|
}
|
|
774
|
-
function
|
|
818
|
+
function ge(e) {
|
|
775
819
|
let t = R.value;
|
|
776
820
|
if (!t || !Number.isFinite(e)) return;
|
|
777
821
|
let n = Math.min(1, Math.max(0, e));
|
|
778
822
|
t.volume = n, t.muted = n === 0, n > 0 && (W = n), Z();
|
|
779
823
|
}
|
|
780
|
-
function
|
|
824
|
+
function _e() {
|
|
781
825
|
let e = R.value;
|
|
782
826
|
e && (e.muted && e.volume === 0 && (e.volume = W), e.muted = !e.muted, Z());
|
|
783
827
|
}
|
|
784
828
|
return v(() => {
|
|
785
|
-
|
|
829
|
+
J();
|
|
786
830
|
}), (r, i) => (b(), s("article", {
|
|
787
831
|
"data-post-id": e.item.postId,
|
|
788
832
|
"data-media-index": D.value,
|
|
@@ -796,11 +840,11 @@ var ke = /* @__PURE__ */ d({
|
|
|
796
840
|
"aria-hidden": e.leaving || void 0,
|
|
797
841
|
"aria-busy": e.previewState === "loading",
|
|
798
842
|
inert: e.leaving || void 0,
|
|
799
|
-
role: e.interactive && !e.leaving && !
|
|
800
|
-
tabindex: e.interactive && !e.leaving && !
|
|
801
|
-
onClick: i[11] ||= (t) => S(e.interactive && !
|
|
802
|
-
onKeydown: [i[12] ||= A((t) => S(e.interactive && !
|
|
803
|
-
}, [c("div",
|
|
843
|
+
role: e.interactive && !e.leaving && !K.value ? "button" : void 0,
|
|
844
|
+
tabindex: e.interactive && !e.leaving && !K.value ? 0 : void 0,
|
|
845
|
+
onClick: i[11] ||= (t) => S(e.interactive && !K.value, ne(t)),
|
|
846
|
+
onKeydown: [i[12] ||= A((t) => S(e.interactive && !K.value, "keyboard"), ["enter"]), i[13] ||= A(j((t) => S(e.interactive && !K.value, "keyboard"), ["prevent"]), ["space"])]
|
|
847
|
+
}, [c("div", Be, [
|
|
804
848
|
e.cardHeader ? (b(), a(ke, {
|
|
805
849
|
key: 0,
|
|
806
850
|
index: e.index,
|
|
@@ -827,22 +871,22 @@ var ke = /* @__PURE__ */ d({
|
|
|
827
871
|
c("div", {
|
|
828
872
|
class: h(["media-card-media", { "media-card-media--carousel": e.layout === "reel" && C.value.length > 1 }]),
|
|
829
873
|
"data-media-direction": y.value,
|
|
830
|
-
onWheel:
|
|
831
|
-
onTouchstartPassive:
|
|
832
|
-
onTouchendPassive:
|
|
874
|
+
onWheel: ae,
|
|
875
|
+
onTouchstartPassive: oe,
|
|
876
|
+
onTouchendPassive: se
|
|
833
877
|
}, [
|
|
834
878
|
u(n, { name: `media-slide-${y.value}` }, {
|
|
835
879
|
default: k(() => [(b(), s("div", {
|
|
836
880
|
key: `${e.item.postId}:${O.value.src}:${e.mediaSource ?? "preview"}`,
|
|
837
881
|
class: "media-card-frame",
|
|
838
882
|
"data-media-index": D.value
|
|
839
|
-
}, [e.previewState === "loading" ? (b(), s("div",
|
|
883
|
+
}, [e.previewState === "loading" ? (b(), s("div", Ue, [...i[14] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : e.previewState === "error" ? (b(), s("div", {
|
|
840
884
|
key: 1,
|
|
841
885
|
"data-test": "media-error",
|
|
842
886
|
class: "media-error",
|
|
843
887
|
role: "img",
|
|
844
888
|
"aria-label": `${E(Te)(F.value)} ${E(Ee)(F.value)}`
|
|
845
|
-
}, [c("strong",
|
|
889
|
+
}, [c("strong", Ge, T(E(Te)(F.value)), 1), c("span", null, T(E(Ee)(F.value)), 1)], 8, We)) : o("", !0), ce.value ? (b(), s("video", {
|
|
846
890
|
key: 2,
|
|
847
891
|
ref_key: "videoElement",
|
|
848
892
|
ref: R,
|
|
@@ -853,21 +897,21 @@ var ke = /* @__PURE__ */ d({
|
|
|
853
897
|
src: F.value,
|
|
854
898
|
width: I.value ?? void 0,
|
|
855
899
|
height: L.value ?? void 0,
|
|
856
|
-
autoplay:
|
|
900
|
+
autoplay: E(G),
|
|
857
901
|
loop: !e.advanceOnMediaEnd,
|
|
858
|
-
muted:
|
|
902
|
+
muted: E(ee),
|
|
859
903
|
playsinline: "",
|
|
860
904
|
preload: e.fetchPriority === "high" ? "auto" : "metadata",
|
|
861
|
-
onLoadedmetadata:
|
|
905
|
+
onLoadedmetadata: pe,
|
|
862
906
|
onDurationchange: Z,
|
|
863
907
|
onTimeupdate: Z,
|
|
864
908
|
onVolumechange: Z,
|
|
865
|
-
onPlaying: i[0] ||= (e) =>
|
|
909
|
+
onPlaying: i[0] ||= (...e) => E(te) && E(te)(...e),
|
|
866
910
|
onPause: i[1] ||= (e) => H.value = !1,
|
|
867
|
-
onEnded:
|
|
868
|
-
onClick:
|
|
911
|
+
onEnded: me,
|
|
912
|
+
onClick: de,
|
|
869
913
|
onError: i[2] ||= (e) => r.$emit("error", D.value)
|
|
870
|
-
}, null, 42,
|
|
914
|
+
}, null, 42, Ke)) : (b(), s("img", {
|
|
871
915
|
key: 3,
|
|
872
916
|
class: h(["media-preview", { "media-preview--ready": e.previewState === "ready" }]),
|
|
873
917
|
src: F.value,
|
|
@@ -879,29 +923,29 @@ var ke = /* @__PURE__ */ d({
|
|
|
879
923
|
loading: "eager",
|
|
880
924
|
onLoad: i[3] ||= (e) => r.$emit("ready", D.value),
|
|
881
925
|
onError: i[4] ||= (e) => r.$emit("error", D.value)
|
|
882
|
-
}, null, 42,
|
|
926
|
+
}, null, 42, qe))], 8, He))]),
|
|
883
927
|
_: 1
|
|
884
928
|
}, 8, ["name"]),
|
|
885
929
|
(b(), a(t, {
|
|
886
|
-
disabled: !
|
|
930
|
+
disabled: !Y.value || !e.reelControlsTarget,
|
|
887
931
|
to: e.reelControlsTarget ?? "body"
|
|
888
932
|
}, [u(n, {
|
|
889
933
|
name: "vibe-reel-media-controls",
|
|
890
|
-
css:
|
|
934
|
+
css: Y.value
|
|
891
935
|
}, {
|
|
892
|
-
default: k(() => [
|
|
893
|
-
key:
|
|
936
|
+
default: k(() => [le.value ? (b(), a(Le, {
|
|
937
|
+
key: ue.value,
|
|
894
938
|
"current-time": z.value,
|
|
895
|
-
"data-control-post-id":
|
|
939
|
+
"data-control-post-id": Y.value ? e.item.postId : void 0,
|
|
896
940
|
duration: B.value,
|
|
897
941
|
layout: e.layout,
|
|
898
942
|
muted: V.value,
|
|
899
943
|
playing: H.value,
|
|
900
944
|
volume: U.value,
|
|
901
|
-
onSeek:
|
|
902
|
-
onToggleMute:
|
|
903
|
-
onTogglePlayback:
|
|
904
|
-
onVolumeChange:
|
|
945
|
+
onSeek: he,
|
|
946
|
+
onToggleMute: _e,
|
|
947
|
+
onTogglePlayback: fe,
|
|
948
|
+
onVolumeChange: ge
|
|
905
949
|
}, null, 8, [
|
|
906
950
|
"current-time",
|
|
907
951
|
"data-control-post-id",
|
|
@@ -921,24 +965,24 @@ var ke = /* @__PURE__ */ d({
|
|
|
921
965
|
type: "button",
|
|
922
966
|
class: "media-carousel-control media-carousel-control--previous",
|
|
923
967
|
"aria-label": `Previous media for post ${e.item.postId}`,
|
|
924
|
-
onClick: i[5] ||= j((e) =>
|
|
968
|
+
onClick: i[5] ||= j((e) => q(D.value - 1, e), ["stop"]),
|
|
925
969
|
onKeydown: i[6] ||= j(() => {}, ["stop"])
|
|
926
|
-
}, [u(E(ve), { size: 20 })], 40,
|
|
970
|
+
}, [u(E(ve), { size: 20 })], 40, Je), c("button", {
|
|
927
971
|
type: "button",
|
|
928
972
|
class: "media-carousel-control media-carousel-control--next",
|
|
929
973
|
"aria-label": `Next media for post ${e.item.postId}`,
|
|
930
|
-
onClick: i[7] ||= j((e) =>
|
|
974
|
+
onClick: i[7] ||= j((e) => q(D.value + 1, e), ["stop"]),
|
|
931
975
|
onKeydown: i[8] ||= j(() => {}, ["stop"])
|
|
932
|
-
}, [u(E(ye), { size: 20 })], 40,
|
|
933
|
-
|
|
976
|
+
}, [u(E(ye), { size: 20 })], 40, Ye)], 2)) : o("", !0),
|
|
977
|
+
K.value ? (b(), s("button", {
|
|
934
978
|
key: 1,
|
|
935
979
|
class: "media-card-activator",
|
|
936
980
|
type: "button",
|
|
937
981
|
"aria-label": `Open post ${e.item.postId}`,
|
|
938
|
-
onClick: i[9] ||= j((e) => r.$emit("activate",
|
|
982
|
+
onClick: i[9] ||= j((e) => r.$emit("activate", ne(e)), ["stop"]),
|
|
939
983
|
onKeydown: i[10] ||= j(() => {}, ["stop"])
|
|
940
|
-
}, null, 40,
|
|
941
|
-
], 42,
|
|
984
|
+
}, null, 40, Xe)) : o("", !0)
|
|
985
|
+
], 42, Ve),
|
|
942
986
|
e.cardFooter ? (b(), a(ke, {
|
|
943
987
|
key: 1,
|
|
944
988
|
index: e.index,
|
|
@@ -962,9 +1006,9 @@ var ke = /* @__PURE__ */ d({
|
|
|
962
1006
|
"style",
|
|
963
1007
|
"total"
|
|
964
1008
|
])) : o("", !0)
|
|
965
|
-
])], 46,
|
|
1009
|
+
])], 46, ze));
|
|
966
1010
|
}
|
|
967
|
-
}),
|
|
1011
|
+
}), tt = { class: "masonry-feed-shell" }, nt = ["aria-hidden", "inert"], rt = 240, it = 6, at = 12, ot = 800, st = 1.5, ct = /* @__PURE__ */ d({
|
|
968
1012
|
__name: "MasonryFeed",
|
|
969
1013
|
props: {
|
|
970
1014
|
enteringPostIds: {},
|
|
@@ -998,36 +1042,36 @@ var ke = /* @__PURE__ */ d({
|
|
|
998
1042
|
"retryEnd"
|
|
999
1043
|
],
|
|
1000
1044
|
setup(t, { expose: n, emit: i }) {
|
|
1001
|
-
let o = t, l = i, d = w(null), f = `vibe-masonry-${D()}`, p = w(null), m = w(0), g = w(
|
|
1045
|
+
let o = t, l = i, d = w(null), f = `vibe-masonry-${D()}`, p = w(null), m = w(0), g = w(it), y = w(0), x = w(0), C = w(0), T = null, k = null, A = null, j = r(() => J(o.items, m.value, {
|
|
1002
1046
|
additionalHeight: (o.cardHeader?.height ?? 0) + (o.cardFooter?.height ?? 0),
|
|
1003
1047
|
gap: g.value,
|
|
1004
|
-
minColumnWidth:
|
|
1048
|
+
minColumnWidth: rt
|
|
1005
1049
|
})), M = r(() => {
|
|
1006
1050
|
let e = j.value;
|
|
1007
1051
|
if (o.leavingPostIds.size === 0) return e;
|
|
1008
|
-
let t = o.items.filter((e) => !o.leavingPostIds.has(e.postId)), n =
|
|
1052
|
+
let t = o.items.filter((e) => !o.leavingPostIds.has(e.postId)), n = J(t, m.value, {
|
|
1009
1053
|
additionalHeight: (o.cardHeader?.height ?? 0) + (o.cardFooter?.height ?? 0),
|
|
1010
1054
|
gap: g.value,
|
|
1011
|
-
minColumnWidth:
|
|
1055
|
+
minColumnWidth: rt
|
|
1012
1056
|
}), r = new Map(t.map((e, t) => [e.postId, n.items[t]]));
|
|
1013
1057
|
return {
|
|
1014
1058
|
...n,
|
|
1015
1059
|
items: o.items.map((t, n) => o.leavingPostIds.has(t.postId) ? e.items[n] : r.get(t.postId) ?? e.items[n])
|
|
1016
1060
|
};
|
|
1017
1061
|
}), N = r(() => ({ height: `${o.leavingPostIds.size === 0 ? M.value.height : j.value.height}px` })), P = r(() => !o.infiniteScroll || x.value > 0 && C.value + M.value.height <= x.value + 1), I = r(() => {
|
|
1018
|
-
let e = Math.max(
|
|
1062
|
+
let e = Math.max(ot, x.value * st), t = {
|
|
1019
1063
|
scrollTop: y.value - C.value,
|
|
1020
1064
|
viewportHeight: x.value
|
|
1021
|
-
}, n =
|
|
1065
|
+
}, n = re(M.value.items, {
|
|
1022
1066
|
...t,
|
|
1023
1067
|
overscan: e
|
|
1024
|
-
}), r = o.leavingPostIds.size === 0 ? [] :
|
|
1068
|
+
}), r = o.leavingPostIds.size === 0 ? [] : re(j.value.items, {
|
|
1025
1069
|
...t,
|
|
1026
1070
|
overscan: e
|
|
1027
|
-
}), i = [...new Set([...n, ...r])].sort((e, t) => e - t), a =
|
|
1071
|
+
}), i = [...new Set([...n, ...r])].sort((e, t) => e - t), a = re(M.value.items, {
|
|
1028
1072
|
...t,
|
|
1029
1073
|
overscan: 0
|
|
1030
|
-
}), s = o.leavingPostIds.size === 0 ? [] :
|
|
1074
|
+
}), s = o.leavingPostIds.size === 0 ? [] : re(j.value.items, {
|
|
1031
1075
|
...t,
|
|
1032
1076
|
overscan: 0
|
|
1033
1077
|
}), c = new Set([...a, ...s]);
|
|
@@ -1043,7 +1087,7 @@ var ke = /* @__PURE__ */ d({
|
|
|
1043
1087
|
function L(e) {
|
|
1044
1088
|
let t = M.value.items[e], n = o.items[e]?.postId;
|
|
1045
1089
|
if (!t) return {};
|
|
1046
|
-
let r = n !== void 0 && o.enteringPostIds.has(n), i = n !== void 0 && o.leavingPostIds.has(n), a = r || i ?
|
|
1090
|
+
let r = n !== void 0 && o.enteringPostIds.has(n), i = n !== void 0 && o.leavingPostIds.has(n), a = r || i ? q({
|
|
1047
1091
|
containerHeight: j.value.height,
|
|
1048
1092
|
gap: g.value
|
|
1049
1093
|
}) : 0, s = n === void 0 ? 0 : i ? o.removalDelays.get(n) ?? 0 : r ? o.entryDelays.get(n) ?? 0 : 0;
|
|
@@ -1063,15 +1107,15 @@ var ke = /* @__PURE__ */ d({
|
|
|
1063
1107
|
}
|
|
1064
1108
|
function z(e) {
|
|
1065
1109
|
let t = e.ownerDocument.documentElement.clientWidth;
|
|
1066
|
-
m.value = e.clientWidth, g.value = Math.min(
|
|
1110
|
+
m.value = e.clientWidth, g.value = Math.min(at, Math.max(it, t * .0075)), R();
|
|
1067
1111
|
}
|
|
1068
1112
|
function B(e) {
|
|
1069
1113
|
let t = e.currentTarget;
|
|
1070
|
-
t && (y.value = t.scrollTop, !o.loadMoreLocked && o.infiniteScroll &&
|
|
1114
|
+
t && (y.value = t.scrollTop, !o.loadMoreLocked && o.infiniteScroll && G(t) && l("loadMore"));
|
|
1071
1115
|
}
|
|
1072
1116
|
function V() {
|
|
1073
1117
|
let e = d.value;
|
|
1074
|
-
!o.loadMoreLocked && e &&
|
|
1118
|
+
!o.loadMoreLocked && e && G(e) && l("loadMore");
|
|
1075
1119
|
}
|
|
1076
1120
|
function H() {
|
|
1077
1121
|
return d.value;
|
|
@@ -1090,7 +1134,7 @@ var ke = /* @__PURE__ */ d({
|
|
|
1090
1134
|
}), n({
|
|
1091
1135
|
getScrollElement: H,
|
|
1092
1136
|
loadIfNearBottom: V
|
|
1093
|
-
}), (n, r) => (b(), s("div",
|
|
1137
|
+
}), (n, r) => (b(), s("div", tt, [c("main", {
|
|
1094
1138
|
id: f,
|
|
1095
1139
|
ref_key: "galleryElement",
|
|
1096
1140
|
ref: d,
|
|
@@ -1105,7 +1149,7 @@ var ke = /* @__PURE__ */ d({
|
|
|
1105
1149
|
class: h(["masonry", { "masonry--ready": m.value > 0 }]),
|
|
1106
1150
|
style: _(N.value),
|
|
1107
1151
|
"aria-label": "Media gallery"
|
|
1108
|
-
}, [(b(!0), s(e, null, S(I.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(
|
|
1152
|
+
}, [(b(!0), s(e, null, S(I.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(et, {
|
|
1109
1153
|
key: n.postId,
|
|
1110
1154
|
class: "masonry-item",
|
|
1111
1155
|
entering: t.enteringPostIds.has(n.postId),
|
|
@@ -1167,7 +1211,7 @@ var ke = /* @__PURE__ */ d({
|
|
|
1167
1211
|
"load-more-locked",
|
|
1168
1212
|
"show-load-more",
|
|
1169
1213
|
"state"
|
|
1170
|
-
])], 42,
|
|
1214
|
+
])], 42, nt), u(ue, {
|
|
1171
1215
|
"content-size": M.value.height,
|
|
1172
1216
|
"controls-id": f,
|
|
1173
1217
|
"scroll-element": d.value,
|
|
@@ -1178,8 +1222,8 @@ var ke = /* @__PURE__ */ d({
|
|
|
1178
1222
|
"suspended"
|
|
1179
1223
|
])]));
|
|
1180
1224
|
}
|
|
1181
|
-
}),
|
|
1182
|
-
function
|
|
1225
|
+
}), lt = 300;
|
|
1226
|
+
function ut(e, t, n) {
|
|
1183
1227
|
let r = e.scrollTop;
|
|
1184
1228
|
if (n || Math.abs(r - t) <= 1) return e.scrollTop = t, Promise.resolve();
|
|
1185
1229
|
e.setAttribute("data-transitioning", "");
|
|
@@ -1187,7 +1231,7 @@ function lt(e, t, n) {
|
|
|
1187
1231
|
return new Promise((n) => {
|
|
1188
1232
|
let o = (s) => {
|
|
1189
1233
|
a += 1;
|
|
1190
|
-
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c /
|
|
1234
|
+
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / lt), u = 1 - (1 - l) ** 3;
|
|
1191
1235
|
if (e.scrollTop = r + (t - r) * u, l < 1) {
|
|
1192
1236
|
requestAnimationFrame(o);
|
|
1193
1237
|
return;
|
|
@@ -1199,7 +1243,7 @@ function lt(e, t, n) {
|
|
|
1199
1243
|
}
|
|
1200
1244
|
//#endregion
|
|
1201
1245
|
//#region src/components/ReelAutoAdvanceProgress.vue?vue&type=script&setup=true&lang.ts
|
|
1202
|
-
var
|
|
1246
|
+
var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
1203
1247
|
__name: "ReelAutoAdvanceProgress",
|
|
1204
1248
|
props: {
|
|
1205
1249
|
durationMs: {},
|
|
@@ -1217,9 +1261,9 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1217
1261
|
class: "reel-auto-advance-progress",
|
|
1218
1262
|
style: _(a.value),
|
|
1219
1263
|
onAnimationend: n[0] ||= (e) => i("complete")
|
|
1220
|
-
}, null, 36)], 8,
|
|
1264
|
+
}, null, 36)], 8, dt));
|
|
1221
1265
|
}
|
|
1222
|
-
}),
|
|
1266
|
+
}), pt = { class: "reel-viewport" }, mt = ["data-active-post-id", "data-active-media-index"], ht = ["role", "data-status"], gt = 2, _t = 300, vt = /* @__PURE__ */ d({
|
|
1223
1267
|
__name: "ReelFeed",
|
|
1224
1268
|
props: {
|
|
1225
1269
|
initialPostId: {},
|
|
@@ -1257,7 +1301,7 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1257
1301
|
],
|
|
1258
1302
|
setup(t, { expose: n, emit: i }) {
|
|
1259
1303
|
let l = t, u = i, d = w(null), f = w(null), p = l.initialPostId === null || l.initialPostId === void 0 ? -1 : l.items.findIndex((e) => e.postId === l.initialPostId), g = w(Math.max(0, p)), x = w(!1), C = w(!1), D = 0, k = null, A = null, j = null, N = r(() => ({ gridTemplateRows: `repeat(${l.items.length}, 100cqh)` })), I = r(() => {
|
|
1260
|
-
let e = Math.max(0, g.value -
|
|
1304
|
+
let e = Math.max(0, g.value - gt), t = Math.min(l.items.length - 1, g.value + gt);
|
|
1261
1305
|
return l.items.slice(e, t + 1).map((t, n) => ({
|
|
1262
1306
|
fetchPriority: e + n === g.value ? "high" : "low",
|
|
1263
1307
|
index: e + n,
|
|
@@ -1282,47 +1326,47 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1282
1326
|
l.reelAutoAdvance.enabled,
|
|
1283
1327
|
l.reelAutoAdvance.includePostItems,
|
|
1284
1328
|
l.reelAutoAdvance.intervalMs
|
|
1285
|
-
].join(":")),
|
|
1329
|
+
].join(":")), ee = r(() => {
|
|
1286
1330
|
let e = R.value, t = !!(e && l.reelAutoAdvance.includePostItems && z.value < M(e).length - 1), n = l.reelAutoAdvance.intervalMs / 1e3;
|
|
1287
1331
|
return `Auto advance to the next ${t ? "post item" : "post"} in ${n}s`;
|
|
1288
|
-
}),
|
|
1289
|
-
function
|
|
1332
|
+
}), te = r(() => l.reelAutoAdvance.enabled && l.reelForward.status === "idle" && R.value !== void 0 && B.value !== "loading" && !H.value), K = r(() => !l.infiniteScroll || l.items.length <= 1), ne = r(() => l.reelForward.status === "loading" ? "Loading the next media…" : l.reelForward.status === "error" ? "Unable to load the next media." : "You reached the end of this feed.");
|
|
1333
|
+
function q(e) {
|
|
1290
1334
|
return { gridRow: `${e + 1}` };
|
|
1291
1335
|
}
|
|
1292
|
-
function
|
|
1336
|
+
function re(e) {
|
|
1293
1337
|
let t = D || e.clientHeight;
|
|
1294
1338
|
return t <= 0 || l.items.length === 0 ? 0 : Math.min(l.items.length - 1, Math.max(0, Math.round(e.scrollTop / t)));
|
|
1295
1339
|
}
|
|
1296
|
-
function
|
|
1340
|
+
function J(e) {
|
|
1297
1341
|
let t = e.currentTarget;
|
|
1298
1342
|
if (!t) return;
|
|
1299
1343
|
let n = D || t.clientHeight, r = Math.max(0, l.items.length - 1) * n;
|
|
1300
|
-
x.value = l.items.length > 0 && t.scrollTop > r + 1, C.value || (g.value =
|
|
1344
|
+
x.value = l.items.length > 0 && t.scrollTop > r + 1, C.value || (g.value = re(t)), !l.loadMoreLocked && l.infiniteScroll && G(t) && u("loadMore");
|
|
1301
1345
|
}
|
|
1302
|
-
function
|
|
1346
|
+
function ie() {
|
|
1303
1347
|
let e = d.value;
|
|
1304
1348
|
e && (x.value = !1, se(!0), D = e.clientHeight, e.scrollTop = g.value * D, A !== null && cancelAnimationFrame(A), A = requestAnimationFrame(() => {
|
|
1305
1349
|
e.scrollTop = g.value * e.clientHeight, D = e.clientHeight, A = null;
|
|
1306
|
-
}),
|
|
1350
|
+
}), ae());
|
|
1307
1351
|
}
|
|
1308
|
-
function
|
|
1352
|
+
function ae() {
|
|
1309
1353
|
j !== null && clearTimeout(j), j = setTimeout(() => {
|
|
1310
1354
|
j = null;
|
|
1311
1355
|
let e = d.value;
|
|
1312
1356
|
e && (D = e.clientHeight, e.scrollTop = g.value * D), se(!1);
|
|
1313
1357
|
}, 120);
|
|
1314
1358
|
}
|
|
1315
|
-
function
|
|
1359
|
+
function oe() {
|
|
1316
1360
|
se(!0);
|
|
1317
1361
|
let e = d.value;
|
|
1318
|
-
e && (D = e.clientHeight, e.scrollTop = g.value * D),
|
|
1362
|
+
e && (D = e.clientHeight, e.scrollTop = g.value * D), ae();
|
|
1319
1363
|
}
|
|
1320
1364
|
function se(e) {
|
|
1321
1365
|
C.value = e, d.value?.toggleAttribute("data-resizing", e);
|
|
1322
1366
|
}
|
|
1323
1367
|
function ce() {
|
|
1324
1368
|
let e = d.value;
|
|
1325
|
-
!l.loadMoreLocked && e &&
|
|
1369
|
+
!l.loadMoreLocked && e && G(e) && u("loadMore");
|
|
1326
1370
|
}
|
|
1327
1371
|
function Y(e) {
|
|
1328
1372
|
let t = R.value;
|
|
@@ -1334,28 +1378,32 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1334
1378
|
}
|
|
1335
1379
|
function le(e) {
|
|
1336
1380
|
let t = g.value + e;
|
|
1337
|
-
return !d.value || t < 0 || t >= l.items.length ? !1 : (
|
|
1381
|
+
return !d.value || t < 0 || t >= l.items.length ? !1 : (X(t), !0);
|
|
1338
1382
|
}
|
|
1339
|
-
function
|
|
1383
|
+
function ue(e, t) {
|
|
1384
|
+
let n = l.items.findIndex((t) => t.postId === e), r = l.items[n];
|
|
1385
|
+
return !d.value || !r || t < 0 || t > r.items.length ? !1 : ((l.mediaIndices.get(e) ?? 0) !== t && u("mediaChange", e, t), n !== g.value && X(n), !0);
|
|
1386
|
+
}
|
|
1387
|
+
function de() {
|
|
1340
1388
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
1341
1389
|
}
|
|
1342
|
-
function
|
|
1390
|
+
function fe(e) {
|
|
1343
1391
|
let t = d.value;
|
|
1344
1392
|
if (!t) return Promise.resolve();
|
|
1345
1393
|
let n = e * (D || t.clientHeight);
|
|
1346
|
-
return g.value = e,
|
|
1394
|
+
return g.value = e, ut(t, n, de());
|
|
1347
1395
|
}
|
|
1348
|
-
function
|
|
1349
|
-
|
|
1396
|
+
function X(e) {
|
|
1397
|
+
fe(e);
|
|
1350
1398
|
}
|
|
1351
|
-
async function
|
|
1399
|
+
async function Z(e) {
|
|
1352
1400
|
let t = l.items.findIndex((t) => t.postId === e);
|
|
1353
|
-
return t < 0 || t === g.value ? !1 : (await
|
|
1401
|
+
return t < 0 || t === g.value ? !1 : (await fe(t), !0);
|
|
1354
1402
|
}
|
|
1355
|
-
async function
|
|
1356
|
-
return Y(e) ? (
|
|
1403
|
+
async function pe(e) {
|
|
1404
|
+
return Y(e) ? (de() || await new Promise((e) => setTimeout(e, _t)), !0) : !1;
|
|
1357
1405
|
}
|
|
1358
|
-
function
|
|
1406
|
+
function me() {
|
|
1359
1407
|
if (!l.reelAutoAdvance.enabled) return;
|
|
1360
1408
|
let e = R.value;
|
|
1361
1409
|
if (!e) return;
|
|
@@ -1368,30 +1416,31 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1368
1416
|
l.hasNext && !l.loadMoreLocked && u("loadMore");
|
|
1369
1417
|
return;
|
|
1370
1418
|
}
|
|
1371
|
-
l.reelAutoAdvance.includePostItems && (l.mediaIndices.get(n.postId) ?? 0) !== 0 && u("mediaChange", n.postId, 0),
|
|
1419
|
+
l.reelAutoAdvance.includePostItems && (l.mediaIndices.get(n.postId) ?? 0) !== 0 && u("mediaChange", n.postId, 0), X(t);
|
|
1372
1420
|
}
|
|
1373
|
-
function
|
|
1374
|
-
!l.reelAutoAdvance.enabled || e !== L.value || t !== z.value || !H.value ||
|
|
1421
|
+
function he(e, t) {
|
|
1422
|
+
!l.reelAutoAdvance.enabled || e !== L.value || t !== z.value || !H.value || me();
|
|
1375
1423
|
}
|
|
1376
1424
|
return O(d, (e) => {
|
|
1377
|
-
k?.disconnect(), k = null, e && (D = e.clientHeight, !(typeof ResizeObserver > "u") && (k = new ResizeObserver(
|
|
1425
|
+
k?.disconnect(), k = null, e && (D = e.clientHeight, !(typeof ResizeObserver > "u") && (k = new ResizeObserver(ie), k.observe(e)));
|
|
1378
1426
|
}), O(() => l.items.length, async (e) => {
|
|
1379
1427
|
let t = l.initialPostId, n = t == null ? -1 : l.items.findIndex(({ postId: e }) => e === t);
|
|
1380
|
-
g.value = n >= 0 ? n : Math.min(g.value, Math.max(0, e - 1)), await m(),
|
|
1428
|
+
g.value = n >= 0 ? n : Math.min(g.value, Math.max(0, e - 1)), await m(), ie();
|
|
1381
1429
|
}), O(L, (e) => {
|
|
1382
1430
|
e !== void 0 && u("activeChange", e);
|
|
1383
1431
|
}, { immediate: !0 }), y(() => {
|
|
1384
|
-
window.addEventListener("resize",
|
|
1432
|
+
window.addEventListener("resize", oe), window.addEventListener("orientationchange", oe), p >= 0 && m(ie);
|
|
1385
1433
|
}), v(() => {
|
|
1386
|
-
window.removeEventListener("resize",
|
|
1434
|
+
window.removeEventListener("resize", oe), window.removeEventListener("orientationchange", oe), k?.disconnect(), A !== null && cancelAnimationFrame(A), j !== null && clearTimeout(j);
|
|
1387
1435
|
}), n({
|
|
1388
1436
|
activeIndex: g,
|
|
1389
1437
|
activePostId: L,
|
|
1390
1438
|
changeActiveMedia: Y,
|
|
1391
1439
|
loadIfNearBottom: ce,
|
|
1392
1440
|
moveActivePost: le,
|
|
1393
|
-
|
|
1394
|
-
|
|
1441
|
+
navigateToItem: ue,
|
|
1442
|
+
transitionActiveMedia: pe,
|
|
1443
|
+
transitionActivePost: Z
|
|
1395
1444
|
}), (n, r) => (b(), s("main", {
|
|
1396
1445
|
class: h(["reel-shell", {
|
|
1397
1446
|
"reel-shell--has-footer": !!t.cardFooter,
|
|
@@ -1421,19 +1470,19 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1421
1470
|
"style",
|
|
1422
1471
|
"total"
|
|
1423
1472
|
])) : o("", !0),
|
|
1424
|
-
c("div",
|
|
1473
|
+
c("div", pt, [c("div", {
|
|
1425
1474
|
ref_key: "galleryElement",
|
|
1426
1475
|
ref: d,
|
|
1427
1476
|
class: "gallery-shell reel-feed",
|
|
1428
1477
|
"data-active-post-id": L.value,
|
|
1429
1478
|
"data-active-media-index": z.value,
|
|
1430
|
-
onScrollPassive:
|
|
1479
|
+
onScrollPassive: J
|
|
1431
1480
|
}, [t.reelForward.status === "idle" ? (b(), s("section", {
|
|
1432
1481
|
key: 1,
|
|
1433
1482
|
class: "reel-track",
|
|
1434
1483
|
style: _(N.value),
|
|
1435
1484
|
"aria-label": "Media gallery"
|
|
1436
|
-
}, [(b(!0), s(e, null, S(I.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(
|
|
1485
|
+
}, [(b(!0), s(e, null, S(I.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(et, {
|
|
1437
1486
|
key: n.postId,
|
|
1438
1487
|
active: r === g.value && !x.value,
|
|
1439
1488
|
"advance-on-media-end": l.reelAutoAdvance.enabled && r === g.value,
|
|
@@ -1442,7 +1491,7 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1442
1491
|
"fetch-priority": e,
|
|
1443
1492
|
index: r,
|
|
1444
1493
|
item: n,
|
|
1445
|
-
"item-style":
|
|
1494
|
+
"item-style": q(r),
|
|
1446
1495
|
"media-card": t.mediaCard,
|
|
1447
1496
|
layout: "reel",
|
|
1448
1497
|
"loaded-count": t.items.length,
|
|
@@ -1453,7 +1502,7 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1453
1502
|
"stationary-reel-controls": "",
|
|
1454
1503
|
total: t.total,
|
|
1455
1504
|
onMediaChange: (e) => u("mediaChange", n.postId, e),
|
|
1456
|
-
onEnded: (e) =>
|
|
1505
|
+
onEnded: (e) => he(n.postId, e),
|
|
1457
1506
|
onReady: (e) => u("ready", n.postId, e),
|
|
1458
1507
|
onError: (e) => u("error", n.postId, e)
|
|
1459
1508
|
}, null, 8, [
|
|
@@ -1484,7 +1533,7 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1484
1533
|
class: "reel-forward-retry",
|
|
1485
1534
|
type: "button",
|
|
1486
1535
|
onClick: r[0] ||= (e) => u("retryForward")
|
|
1487
|
-
}, " Retry ")) : o("", !0)], 8,
|
|
1536
|
+
}, " Retry ")) : o("", !0)], 8, ht)), t.reelForward.status === "idle" ? (b(), a(U, {
|
|
1488
1537
|
key: 2,
|
|
1489
1538
|
actions: t.feedFooterActions,
|
|
1490
1539
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -1493,7 +1542,7 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1493
1542
|
"has-next": t.hasNext,
|
|
1494
1543
|
"is-loading": t.isLoadingMore,
|
|
1495
1544
|
"load-more-locked": t.loadMoreLocked,
|
|
1496
|
-
"show-load-more":
|
|
1545
|
+
"show-load-more": K.value,
|
|
1497
1546
|
state: t.state,
|
|
1498
1547
|
onLoadMore: r[1] ||= (e) => u("loadMore"),
|
|
1499
1548
|
onRetryEnd: r[2] ||= (e) => u("retryEnd")
|
|
@@ -1507,7 +1556,7 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1507
1556
|
"load-more-locked",
|
|
1508
1557
|
"show-load-more",
|
|
1509
1558
|
"state"
|
|
1510
|
-
])) : o("", !0)], 40,
|
|
1559
|
+
])) : o("", !0)], 40, mt), c("div", {
|
|
1511
1560
|
ref_key: "reelControlsElement",
|
|
1512
1561
|
ref: f,
|
|
1513
1562
|
class: "reel-media-controls-host",
|
|
@@ -1535,24 +1584,24 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1535
1584
|
"style",
|
|
1536
1585
|
"total"
|
|
1537
1586
|
])) : o("", !0),
|
|
1538
|
-
|
|
1587
|
+
te.value ? (b(), a(ft, {
|
|
1539
1588
|
key: W.value,
|
|
1540
1589
|
"duration-ms": t.reelAutoAdvance.intervalMs,
|
|
1541
|
-
label:
|
|
1542
|
-
onComplete:
|
|
1590
|
+
label: ee.value,
|
|
1591
|
+
onComplete: me
|
|
1543
1592
|
}, null, 8, ["duration-ms", "label"])) : o("", !0)
|
|
1544
1593
|
], 2));
|
|
1545
1594
|
}
|
|
1546
|
-
}),
|
|
1595
|
+
}), yt = ["data-info-sheet-open", "data-info-sheet-mode"], bt = ["aria-hidden", "inert"], xt = {
|
|
1547
1596
|
key: 0,
|
|
1548
1597
|
class: "reel-info-sheet-layer",
|
|
1549
1598
|
"data-test": "reel-info-sheet"
|
|
1550
|
-
},
|
|
1599
|
+
}, St = [
|
|
1551
1600
|
"role",
|
|
1552
1601
|
"aria-modal",
|
|
1553
1602
|
"tabindex",
|
|
1554
1603
|
"data-active-post-id"
|
|
1555
|
-
],
|
|
1604
|
+
], Ct = /* @__PURE__ */ d({
|
|
1556
1605
|
__name: "ReelLayout",
|
|
1557
1606
|
props: {
|
|
1558
1607
|
forwardIndex: { default: null },
|
|
@@ -1630,19 +1679,22 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1630
1679
|
function L(e) {
|
|
1631
1680
|
return p.value?.moveActivePost(e) ?? !1;
|
|
1632
1681
|
}
|
|
1633
|
-
function R(e) {
|
|
1634
|
-
return p.value?.
|
|
1682
|
+
function R(e, t) {
|
|
1683
|
+
return p.value?.navigateToItem(e, t) ?? !1;
|
|
1635
1684
|
}
|
|
1636
1685
|
function z(e) {
|
|
1686
|
+
return p.value?.transitionActiveMedia(e) ?? Promise.resolve(!1);
|
|
1687
|
+
}
|
|
1688
|
+
function B(e) {
|
|
1637
1689
|
return p.value?.transitionActivePost(e) ?? Promise.resolve(!1);
|
|
1638
1690
|
}
|
|
1639
|
-
function
|
|
1691
|
+
function V(e, t) {
|
|
1640
1692
|
d("error", e, t);
|
|
1641
1693
|
}
|
|
1642
|
-
function
|
|
1694
|
+
function H(e, t) {
|
|
1643
1695
|
d("mediaChange", e, t);
|
|
1644
1696
|
}
|
|
1645
|
-
function
|
|
1697
|
+
function U(e, t) {
|
|
1646
1698
|
d("ready", e, t);
|
|
1647
1699
|
}
|
|
1648
1700
|
return O(() => ({
|
|
@@ -1663,8 +1715,9 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1663
1715
|
changeActiveMedia: F,
|
|
1664
1716
|
loadIfNearBottom: I,
|
|
1665
1717
|
moveActivePost: L,
|
|
1666
|
-
|
|
1667
|
-
|
|
1718
|
+
navigateToItem: R,
|
|
1719
|
+
transitionActiveMedia: z,
|
|
1720
|
+
transitionActivePost: B
|
|
1668
1721
|
}), (t, r) => (b(), s("section", {
|
|
1669
1722
|
class: h(["reel-layout", `reel-layout--${e.infoSheetOverlay ? "overlay" : "layout"}`]),
|
|
1670
1723
|
"data-info-sheet-open": A.value || void 0,
|
|
@@ -1673,7 +1726,7 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1673
1726
|
class: "reel-layout-main",
|
|
1674
1727
|
"aria-hidden": e.infoSheetOverlay && A.value || void 0,
|
|
1675
1728
|
inert: e.infoSheetOverlay && A.value || void 0
|
|
1676
|
-
}, [u(
|
|
1729
|
+
}, [u(vt, {
|
|
1677
1730
|
ref_key: "reelFeed",
|
|
1678
1731
|
ref: p,
|
|
1679
1732
|
"can-retry-end": e.canRetryEnd,
|
|
@@ -1697,10 +1750,10 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1697
1750
|
state: e.state,
|
|
1698
1751
|
total: e.total,
|
|
1699
1752
|
onActiveChange: r[0] ||= (e) => d("activeChange", e),
|
|
1700
|
-
onError:
|
|
1753
|
+
onError: V,
|
|
1701
1754
|
onLoadMore: r[1] ||= (e) => d("loadMore"),
|
|
1702
|
-
onMediaChange:
|
|
1703
|
-
onReady:
|
|
1755
|
+
onMediaChange: H,
|
|
1756
|
+
onReady: U,
|
|
1704
1757
|
onRetryEnd: r[2] ||= (e) => d("retryEnd"),
|
|
1705
1758
|
onRetryForward: r[3] ||= (e) => d("retryForward")
|
|
1706
1759
|
}, null, 8, [
|
|
@@ -1724,8 +1777,8 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1724
1777
|
"reel-forward",
|
|
1725
1778
|
"state",
|
|
1726
1779
|
"total"
|
|
1727
|
-
])], 8,
|
|
1728
|
-
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div",
|
|
1780
|
+
])], 8, bt), u(n, { name: "vibe-info-sheet" }, {
|
|
1781
|
+
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", xt, [c("aside", {
|
|
1729
1782
|
ref_key: "sheetElement",
|
|
1730
1783
|
ref: _,
|
|
1731
1784
|
class: "reel-info-sheet",
|
|
@@ -1734,11 +1787,70 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1734
1787
|
"aria-modal": e.infoSheetOverlay ? "true" : void 0,
|
|
1735
1788
|
tabindex: e.infoSheetOverlay ? -1 : void 0,
|
|
1736
1789
|
"data-active-post-id": T.value?.postId
|
|
1737
|
-
}, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8,
|
|
1790
|
+
}, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8, St)])) : o("", !0)]),
|
|
1738
1791
|
_: 1
|
|
1739
|
-
})], 10,
|
|
1792
|
+
})], 10, yt));
|
|
1740
1793
|
}
|
|
1741
|
-
}),
|
|
1794
|
+
}), wt = [];
|
|
1795
|
+
function Tt(e) {
|
|
1796
|
+
return wt.push(e), () => {
|
|
1797
|
+
let t = wt.indexOf(e);
|
|
1798
|
+
t >= 0 && wt.splice(t, 1);
|
|
1799
|
+
};
|
|
1800
|
+
}
|
|
1801
|
+
function Et(e) {
|
|
1802
|
+
if (!e.isActive()) return !1;
|
|
1803
|
+
let t = wt.filter((e) => e.isActive()), n = e.element();
|
|
1804
|
+
return n !== null && t.some((t) => {
|
|
1805
|
+
if (t === e) return !1;
|
|
1806
|
+
let r = t.element();
|
|
1807
|
+
return r !== null && n.contains(r);
|
|
1808
|
+
}) ? !1 : t.filter((e) => {
|
|
1809
|
+
let n = e.element();
|
|
1810
|
+
return n === null || !t.some((t) => {
|
|
1811
|
+
if (t === e) return !1;
|
|
1812
|
+
let r = t.element();
|
|
1813
|
+
return r !== null && n.contains(r);
|
|
1814
|
+
});
|
|
1815
|
+
}).at(-1) === e;
|
|
1816
|
+
}
|
|
1817
|
+
//#endregion
|
|
1818
|
+
//#region src/components/useReelKeyboard.ts
|
|
1819
|
+
function Dt(e) {
|
|
1820
|
+
let t = {
|
|
1821
|
+
element: e.element,
|
|
1822
|
+
isActive: () => e.state.layout === "reel" || e.state.reelOrigin === "masonry"
|
|
1823
|
+
}, n = null;
|
|
1824
|
+
function r(n) {
|
|
1825
|
+
let r = t.isActive();
|
|
1826
|
+
if (n.key === "Escape" && r && !Et(t)) return;
|
|
1827
|
+
if (n.key === "Escape" && e.state.reelOrigin === "masonry") {
|
|
1828
|
+
n.preventDefault(), e.state.reelInfoSheetOverlay && e.state.reelInfoSheet.enabled && e.setReelInfoSheet(!1), e.closeMasonryReel();
|
|
1829
|
+
return;
|
|
1830
|
+
}
|
|
1831
|
+
if (n.key === "Escape" && r && e.state.reelInfoSheet.enabled) {
|
|
1832
|
+
n.preventDefault(), e.setReelInfoSheet(!1);
|
|
1833
|
+
return;
|
|
1834
|
+
}
|
|
1835
|
+
if (n.defaultPrevented || n.altKey || n.ctrlKey || n.metaKey || n.shiftKey || e.isReelLeaving() || !r) return;
|
|
1836
|
+
let i = n.target;
|
|
1837
|
+
if (i instanceof HTMLElement && (i.isContentEditable || [
|
|
1838
|
+
"INPUT",
|
|
1839
|
+
"SELECT",
|
|
1840
|
+
"TEXTAREA"
|
|
1841
|
+
].includes(i.tagName))) return;
|
|
1842
|
+
let a = n.key === "ArrowLeft" ? -1 : n.key === "ArrowRight" ? 1 : 0;
|
|
1843
|
+
a !== 0 && e.reelRenderer()?.changeActiveMedia?.(a) && n.preventDefault();
|
|
1844
|
+
}
|
|
1845
|
+
y(() => {
|
|
1846
|
+
n = Tt(t), window.addEventListener("keydown", r);
|
|
1847
|
+
}), v(() => {
|
|
1848
|
+
window.removeEventListener("keydown", r), n?.(), n = null;
|
|
1849
|
+
});
|
|
1850
|
+
}
|
|
1851
|
+
//#endregion
|
|
1852
|
+
//#region src/components/VibeSurface.vue?vue&type=script&setup=true&lang.ts
|
|
1853
|
+
var Ot = 35, kt = 420, At = /* @__PURE__ */ d({
|
|
1742
1854
|
__name: "VibeSurface",
|
|
1743
1855
|
props: {
|
|
1744
1856
|
canRetryEnd: { type: Boolean },
|
|
@@ -1760,93 +1872,100 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1760
1872
|
"retryForward"
|
|
1761
1873
|
],
|
|
1762
1874
|
setup(t, { expose: i, emit: c }) {
|
|
1763
|
-
let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null),
|
|
1875
|
+
let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), y = w({}), x = w(!1), S = w(/* @__PURE__ */ new Set()), C = w(/* @__PURE__ */ new Map()), T = w(/* @__PURE__ */ new Set()), E = w(/* @__PURE__ */ new Map()), D = w(/* @__PURE__ */ new Map()), A = w(/* @__PURE__ */ new Map()), j = r(() => I(l.state)), P = r(() => l.state.reelMediaSource === "original" ? A.value : D.value), L = new Set(l.state.items.map((e) => e.postId)), R = null, z = null, B = !1;
|
|
1764
1876
|
function V() {
|
|
1765
1877
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
1766
1878
|
}
|
|
1767
1879
|
function H() {
|
|
1768
1880
|
R !== null && cancelAnimationFrame(R), R = requestAnimationFrame(() => {
|
|
1769
1881
|
R = requestAnimationFrame(() => {
|
|
1770
|
-
R = null,
|
|
1882
|
+
R = null, S.value = /* @__PURE__ */ new Set();
|
|
1771
1883
|
});
|
|
1772
1884
|
});
|
|
1773
1885
|
}
|
|
1774
1886
|
function U(e, t, n) {
|
|
1775
1887
|
let r = F(e, t);
|
|
1776
|
-
|
|
1888
|
+
D.value.get(r) !== n && (D.value = new Map(D.value).set(r, n));
|
|
1777
1889
|
}
|
|
1778
1890
|
function W(e, t, n) {
|
|
1779
1891
|
let r = F(e, t);
|
|
1780
|
-
|
|
1892
|
+
A.value.get(r) !== n && (A.value = new Map(A.value).set(r, n));
|
|
1781
1893
|
}
|
|
1782
|
-
function
|
|
1894
|
+
function ee(e, t) {
|
|
1783
1895
|
U(e, t, "error");
|
|
1784
1896
|
}
|
|
1785
|
-
function
|
|
1897
|
+
function G(e, t) {
|
|
1786
1898
|
U(e, t, "ready");
|
|
1787
1899
|
}
|
|
1788
|
-
function
|
|
1900
|
+
function K(e, t) {
|
|
1789
1901
|
W(e, t, "error");
|
|
1790
1902
|
}
|
|
1791
1903
|
function ne(e, t) {
|
|
1792
1904
|
W(e, t, "ready");
|
|
1793
1905
|
}
|
|
1794
|
-
function
|
|
1906
|
+
function q(e, t) {
|
|
1795
1907
|
if (l.state.reelMediaSource === "original") {
|
|
1796
|
-
|
|
1908
|
+
K(e, t);
|
|
1797
1909
|
return;
|
|
1798
1910
|
}
|
|
1799
|
-
|
|
1911
|
+
ee(e, t);
|
|
1800
1912
|
}
|
|
1801
|
-
function
|
|
1913
|
+
function re(e, t) {
|
|
1802
1914
|
if (l.state.reelMediaSource === "original") {
|
|
1803
1915
|
ne(e, t);
|
|
1804
1916
|
return;
|
|
1805
1917
|
}
|
|
1806
|
-
|
|
1918
|
+
G(e, t);
|
|
1807
1919
|
}
|
|
1808
|
-
function
|
|
1920
|
+
function J(e, t) {
|
|
1809
1921
|
let n = l.state.items.find((t) => t.postId === e);
|
|
1810
1922
|
if (!n) return;
|
|
1811
1923
|
let r = N(n, t);
|
|
1812
1924
|
(l.state.mediaIndices.get(e) ?? 0) !== r && (l.state.mediaIndices = new Map(l.state.mediaIndices).set(e, r));
|
|
1813
1925
|
}
|
|
1814
|
-
async function
|
|
1926
|
+
async function ie() {
|
|
1815
1927
|
await m(), (l.state.layout === "reel" || l.state.reelOrigin === "masonry" ? p.value : f.value)?.loadIfNearBottom();
|
|
1816
1928
|
}
|
|
1817
|
-
function
|
|
1929
|
+
function ae(e) {
|
|
1818
1930
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.changeActiveMedia?.(e) ?? !1;
|
|
1819
1931
|
}
|
|
1820
|
-
function
|
|
1932
|
+
function oe(e) {
|
|
1821
1933
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.moveActivePost?.(e) ?? !1;
|
|
1822
1934
|
}
|
|
1823
|
-
function se() {
|
|
1935
|
+
function se(e) {
|
|
1936
|
+
if (!(l.state.layout === "reel" || l.state.reelOrigin === "masonry") || l.state.isLoading) return "reel-inactive";
|
|
1937
|
+
let t = l.state.items.find((t) => t.postId === e.postId);
|
|
1938
|
+
if (!t) return "not-found";
|
|
1939
|
+
let n = M(t).findIndex((t) => t.mediaId === e.mediaId);
|
|
1940
|
+
return n < 0 ? "not-found" : p.value?.navigateToItem?.(e.postId, n) ? "navigated" : "reel-inactive";
|
|
1941
|
+
}
|
|
1942
|
+
function ce() {
|
|
1824
1943
|
return l.state.layout !== "masonry" || l.state.reelOrigin === "masonry" ? null : f.value?.getScrollElement?.() ?? null;
|
|
1825
1944
|
}
|
|
1826
|
-
function
|
|
1827
|
-
z = e, B = t === "keyboard",
|
|
1945
|
+
function Y(e, t) {
|
|
1946
|
+
z = e, B = t === "keyboard", y.value = fe(e), d("openReel", e), m(() => h.value?.focus());
|
|
1828
1947
|
}
|
|
1829
|
-
function
|
|
1948
|
+
function le(e) {
|
|
1830
1949
|
let t = g.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [];
|
|
1831
1950
|
return Array.from(t).find((t) => t.dataset.postId === String(e)) ?? null;
|
|
1832
1951
|
}
|
|
1833
|
-
function
|
|
1952
|
+
function ue(e) {
|
|
1834
1953
|
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || V()) return 0;
|
|
1835
|
-
let t = [...new Set(e)], n = t.filter(
|
|
1954
|
+
let t = [...new Set(e)], n = t.filter(le);
|
|
1836
1955
|
if (n.length === 0) return 0;
|
|
1837
|
-
let r = new Map(
|
|
1956
|
+
let r = new Map(E.value);
|
|
1838
1957
|
return n.forEach((e, t) => {
|
|
1839
|
-
r.set(e, t *
|
|
1840
|
-
}),
|
|
1958
|
+
r.set(e, t * Ot);
|
|
1959
|
+
}), S.value = new Set([...S.value].filter((e) => !n.includes(e))), T.value = new Set([...T.value, ...t]), E.value = r, kt + (n.length - 1) * Ot;
|
|
1841
1960
|
}
|
|
1842
|
-
function
|
|
1843
|
-
let n =
|
|
1961
|
+
function de(e, t) {
|
|
1962
|
+
let n = le(e), r = n?.querySelector(".media-card-activator") ?? n;
|
|
1844
1963
|
r && (r.classList.toggle("media-card-focus-silent", !t), t || r.addEventListener("blur", () => {
|
|
1845
1964
|
r.classList.remove("media-card-focus-silent");
|
|
1846
1965
|
}, { once: !0 }), r?.focus({ preventScroll: !0 }));
|
|
1847
1966
|
}
|
|
1848
|
-
function
|
|
1849
|
-
let t = g.value, n =
|
|
1967
|
+
function fe(e) {
|
|
1968
|
+
let t = g.value, n = le(e);
|
|
1850
1969
|
if (t === null || n === null) return {};
|
|
1851
1970
|
let r = t.getBoundingClientRect(), i = n.getBoundingClientRect();
|
|
1852
1971
|
return {
|
|
@@ -1856,60 +1975,48 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1856
1975
|
"--vibe-reel-origin-left": `${Math.max(0, i.left - r.left)}px`
|
|
1857
1976
|
};
|
|
1858
1977
|
}
|
|
1859
|
-
function
|
|
1860
|
-
l.state.reelOrigin === "masonry" && (z ??= l.state.activeReelPostId,
|
|
1978
|
+
function X() {
|
|
1979
|
+
l.state.reelOrigin === "masonry" && (z ??= l.state.activeReelPostId, x.value = !0, d("closeReel"));
|
|
1861
1980
|
}
|
|
1862
|
-
function
|
|
1981
|
+
function Z() {
|
|
1863
1982
|
let e = z, t = B;
|
|
1864
|
-
|
|
1865
|
-
e !== null &&
|
|
1983
|
+
x.value = !1, z = null, B = !1, y.value = {}, m(() => {
|
|
1984
|
+
e !== null && de(e, t);
|
|
1866
1985
|
});
|
|
1867
1986
|
}
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
return;
|
|
1877
|
-
}
|
|
1878
|
-
if (e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey || e.shiftKey || S.value || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry") return;
|
|
1879
|
-
let n = e.target;
|
|
1880
|
-
if (n instanceof HTMLElement && (n.isContentEditable || [
|
|
1881
|
-
"INPUT",
|
|
1882
|
-
"SELECT",
|
|
1883
|
-
"TEXTAREA"
|
|
1884
|
-
].includes(n.tagName))) return;
|
|
1885
|
-
let r = e.key === "ArrowLeft" ? -1 : e.key === "ArrowRight" ? 1 : 0;
|
|
1886
|
-
r !== 0 && p.value?.changeActiveMedia?.(r) && e.preventDefault();
|
|
1887
|
-
}
|
|
1888
|
-
return O(() => l.state.items.map((e) => e.postId), (e) => {
|
|
1987
|
+
return Dt({
|
|
1988
|
+
closeMasonryReel: X,
|
|
1989
|
+
element: () => g.value,
|
|
1990
|
+
isReelLeaving: () => x.value,
|
|
1991
|
+
reelRenderer: () => p.value,
|
|
1992
|
+
setReelInfoSheet: (e) => d("reelInfoSheetChange", e),
|
|
1993
|
+
state: l.state
|
|
1994
|
+
}), O(() => l.state.items.map((e) => e.postId), (e) => {
|
|
1889
1995
|
let t = e.filter((e) => !L.has(e)), n = new Set(e);
|
|
1890
|
-
if (L = new Set(e),
|
|
1996
|
+
if (L = new Set(e), T.value = new Set([...T.value].filter((e) => n.has(e))), E.value = new Map([...E.value].filter(([e]) => n.has(e))), t.length === 0 || V()) return;
|
|
1891
1997
|
let r = /* @__PURE__ */ new Map();
|
|
1892
1998
|
e.forEach((e) => {
|
|
1893
|
-
let t =
|
|
1999
|
+
let t = C.value.get(e);
|
|
1894
2000
|
t !== void 0 && r.set(e, t);
|
|
1895
2001
|
}), t.forEach((e, t) => {
|
|
1896
|
-
r.set(e, t *
|
|
1897
|
-
}),
|
|
1898
|
-
}, { flush: "sync" }),
|
|
1899
|
-
|
|
2002
|
+
r.set(e, t * Ot);
|
|
2003
|
+
}), C.value = r, S.value = new Set([...S.value, ...t]), H();
|
|
2004
|
+
}, { flush: "sync" }), v(() => {
|
|
2005
|
+
R !== null && cancelAnimationFrame(R);
|
|
1900
2006
|
}), i({
|
|
1901
|
-
changeActiveReelMedia:
|
|
1902
|
-
getAutoScrollElement:
|
|
1903
|
-
loadIfNearBottom:
|
|
1904
|
-
moveActiveReelPost:
|
|
1905
|
-
|
|
2007
|
+
changeActiveReelMedia: ae,
|
|
2008
|
+
getAutoScrollElement: ce,
|
|
2009
|
+
loadIfNearBottom: ie,
|
|
2010
|
+
moveActiveReelPost: oe,
|
|
2011
|
+
navigateToReelItem: se,
|
|
2012
|
+
startItemRemoval: ue,
|
|
1906
2013
|
transitionActiveReelMedia: (e) => p.value?.transitionActiveMedia?.(e) ?? Promise.resolve(!1),
|
|
1907
2014
|
transitionActiveReelPost: (e) => p.value?.transitionActivePost?.(e) ?? Promise.resolve(!1)
|
|
1908
2015
|
}), (r, i) => (b(), s("div", {
|
|
1909
2016
|
ref_key: "surfaceElement",
|
|
1910
2017
|
ref: g,
|
|
1911
2018
|
class: "vibe-surface"
|
|
1912
|
-
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(
|
|
2019
|
+
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(Ct, {
|
|
1913
2020
|
key: 0,
|
|
1914
2021
|
ref_key: "reelRenderer",
|
|
1915
2022
|
ref: p,
|
|
@@ -1937,14 +2044,14 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1937
2044
|
"preview-states": P.value,
|
|
1938
2045
|
"reel-auto-advance": t.state.reelAutoAdvance,
|
|
1939
2046
|
"reel-forward": t.state.reelForward,
|
|
1940
|
-
state:
|
|
2047
|
+
state: j.value,
|
|
1941
2048
|
total: t.state.total,
|
|
1942
2049
|
onActiveChange: i[0] ||= (e) => d("activeReelChange", e),
|
|
1943
2050
|
onCloseInfoSheet: i[1] ||= (e) => d("reelInfoSheetChange", !1),
|
|
1944
|
-
onError:
|
|
2051
|
+
onError: q,
|
|
1945
2052
|
onLoadMore: i[2] ||= (e) => d("loadMore"),
|
|
1946
|
-
onMediaChange:
|
|
1947
|
-
onReady:
|
|
2053
|
+
onMediaChange: J,
|
|
2054
|
+
onReady: re,
|
|
1948
2055
|
onRetryEnd: i[3] ||= (e) => d("retryEnd"),
|
|
1949
2056
|
onRetryForward: i[4] ||= (e) => d("retryForward")
|
|
1950
2057
|
}, null, 8, [
|
|
@@ -1973,12 +2080,12 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1973
2080
|
"reel-forward",
|
|
1974
2081
|
"state",
|
|
1975
2082
|
"total"
|
|
1976
|
-
])) : t.state.error || t.state.isLoading || t.state.items.length === 0 && t.state.reelForward.status === "idle" ? (b(), a(
|
|
2083
|
+
])) : t.state.error || t.state.isLoading || t.state.items.length === 0 && t.state.reelForward.status === "idle" ? (b(), a(te, {
|
|
1977
2084
|
key: 1,
|
|
1978
2085
|
actions: t.feedFooterActions,
|
|
1979
2086
|
"can-retry-end": t.canRetryEnd,
|
|
1980
2087
|
"feed-footer": t.feedFooter,
|
|
1981
|
-
state:
|
|
2088
|
+
state: j.value,
|
|
1982
2089
|
onLoadMore: i[5] ||= (e) => d("loadMore"),
|
|
1983
2090
|
onRetryEnd: i[6] ||= (e) => d("retryEnd")
|
|
1984
2091
|
}, null, 8, [
|
|
@@ -1986,14 +2093,14 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1986
2093
|
"can-retry-end",
|
|
1987
2094
|
"feed-footer",
|
|
1988
2095
|
"state"
|
|
1989
|
-
])) : (b(), s(e, { key: 2 }, [u(
|
|
2096
|
+
])) : (b(), s(e, { key: 2 }, [u(ct, {
|
|
1990
2097
|
ref_key: "masonryRenderer",
|
|
1991
2098
|
ref: f,
|
|
1992
2099
|
"can-retry-end": t.canRetryEnd,
|
|
1993
|
-
"entering-post-ids":
|
|
1994
|
-
"entry-delays":
|
|
1995
|
-
"leaving-post-ids":
|
|
1996
|
-
"removal-delays":
|
|
2100
|
+
"entering-post-ids": S.value,
|
|
2101
|
+
"entry-delays": C.value,
|
|
2102
|
+
"leaving-post-ids": T.value,
|
|
2103
|
+
"removal-delays": E.value,
|
|
1997
2104
|
"card-footer": t.cardFooter,
|
|
1998
2105
|
"card-header": t.cardHeader,
|
|
1999
2106
|
"feed-footer": t.feedFooter,
|
|
@@ -2006,15 +2113,15 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
2006
2113
|
"load-more-locked": t.state.loadMoreLocked,
|
|
2007
2114
|
"media-indices": t.state.mediaIndices,
|
|
2008
2115
|
"next-page-error": !!t.state.nextPageError,
|
|
2009
|
-
"preview-states":
|
|
2010
|
-
suspended: t.state.reelOrigin === "masonry" ||
|
|
2011
|
-
state:
|
|
2116
|
+
"preview-states": D.value,
|
|
2117
|
+
suspended: t.state.reelOrigin === "masonry" || x.value,
|
|
2118
|
+
state: j.value,
|
|
2012
2119
|
total: t.state.total,
|
|
2013
|
-
onActivate:
|
|
2014
|
-
onError:
|
|
2120
|
+
onActivate: Y,
|
|
2121
|
+
onError: ee,
|
|
2015
2122
|
onLoadMore: i[7] ||= (e) => d("loadMore"),
|
|
2016
|
-
onMediaChange:
|
|
2017
|
-
onReady:
|
|
2123
|
+
onMediaChange: J,
|
|
2124
|
+
onReady: G,
|
|
2018
2125
|
onRetryEnd: i[8] ||= (e) => d("retryEnd")
|
|
2019
2126
|
}, null, 8, [
|
|
2020
2127
|
"can-retry-end",
|
|
@@ -2040,7 +2147,7 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
2040
2147
|
"total"
|
|
2041
2148
|
]), u(n, {
|
|
2042
2149
|
name: "vibe-reel-viewer",
|
|
2043
|
-
onAfterLeave:
|
|
2150
|
+
onAfterLeave: Z
|
|
2044
2151
|
}, {
|
|
2045
2152
|
default: k(() => [t.state.reelOrigin === "masonry" ? (b(), s("section", {
|
|
2046
2153
|
key: 0,
|
|
@@ -2051,8 +2158,8 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
2051
2158
|
"aria-label": "Media viewer",
|
|
2052
2159
|
"aria-modal": "true",
|
|
2053
2160
|
tabindex: "-1",
|
|
2054
|
-
style: _(
|
|
2055
|
-
}, [u(
|
|
2161
|
+
style: _(y.value)
|
|
2162
|
+
}, [u(Ct, {
|
|
2056
2163
|
ref_key: "reelRenderer",
|
|
2057
2164
|
ref: p,
|
|
2058
2165
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2076,16 +2183,16 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
2076
2183
|
"media-source": "original",
|
|
2077
2184
|
"next-page-error": !!t.state.nextPageError,
|
|
2078
2185
|
origin: "masonry",
|
|
2079
|
-
"preview-states":
|
|
2186
|
+
"preview-states": A.value,
|
|
2080
2187
|
"reel-auto-advance": t.state.reelAutoAdvance,
|
|
2081
2188
|
"reel-forward": t.state.reelForward,
|
|
2082
|
-
state:
|
|
2189
|
+
state: j.value,
|
|
2083
2190
|
total: t.state.total,
|
|
2084
2191
|
onActiveChange: i[9] ||= (e) => d("activeReelChange", e),
|
|
2085
2192
|
onCloseInfoSheet: i[10] ||= (e) => d("reelInfoSheetChange", !1),
|
|
2086
|
-
onError:
|
|
2193
|
+
onError: K,
|
|
2087
2194
|
onLoadMore: i[11] ||= (e) => d("loadMore"),
|
|
2088
|
-
onMediaChange:
|
|
2195
|
+
onMediaChange: J,
|
|
2089
2196
|
onReady: ne,
|
|
2090
2197
|
onRetryEnd: i[12] ||= (e) => d("retryEnd"),
|
|
2091
2198
|
onRetryForward: i[13] ||= (e) => d("retryForward")
|
|
@@ -2121,7 +2228,7 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
2121
2228
|
});
|
|
2122
2229
|
//#endregion
|
|
2123
2230
|
//#region src/core/page.ts
|
|
2124
|
-
function
|
|
2231
|
+
function jt(e) {
|
|
2125
2232
|
if (!e || typeof e != "object" || !Array.isArray(e.items)) throw TypeError("Vibe loadPage must resolve to a page with an items array.");
|
|
2126
2233
|
if (e.next !== null && typeof e.next != "string" && typeof e.next != "number") throw TypeError("Vibe page next must be a string, number, or null.");
|
|
2127
2234
|
if (e.total !== void 0 && (!Number.isFinite(e.total) || e.total < 0)) throw TypeError("Vibe page total must be a non-negative number when provided.");
|
|
@@ -2133,32 +2240,32 @@ function Q(e, t) {
|
|
|
2133
2240
|
}
|
|
2134
2241
|
//#endregion
|
|
2135
2242
|
//#region src/core/requestDelay.ts
|
|
2136
|
-
var
|
|
2243
|
+
var Mt = 2e3, Nt = 1e4, Pt = 250, Ft = {
|
|
2137
2244
|
delayRemainingMs: null,
|
|
2138
2245
|
nextRequestAt: null
|
|
2139
2246
|
};
|
|
2140
|
-
function
|
|
2247
|
+
function It(e, t) {
|
|
2141
2248
|
return e === void 0 ? t : Math.floor(e);
|
|
2142
2249
|
}
|
|
2143
|
-
function
|
|
2250
|
+
function Lt(e, t) {
|
|
2144
2251
|
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.`);
|
|
2145
2252
|
}
|
|
2146
|
-
function
|
|
2147
|
-
let n =
|
|
2253
|
+
function Rt(e, t = {}) {
|
|
2254
|
+
let n = It(t.delayStepMs, Mt), r = It(t.delayMaxMs, Nt);
|
|
2148
2255
|
return Math.min(Math.max(0, e) * n, r);
|
|
2149
2256
|
}
|
|
2150
2257
|
function $(e) {
|
|
2151
|
-
if (e == null || !Number.isFinite(e)) return { ...
|
|
2258
|
+
if (e == null || !Number.isFinite(e)) return { ...Ft };
|
|
2152
2259
|
let t = Math.max(0, Math.floor(e - Date.now()));
|
|
2153
2260
|
return t > 0 ? {
|
|
2154
2261
|
delayRemainingMs: t,
|
|
2155
2262
|
nextRequestAt: e
|
|
2156
|
-
} : { ...
|
|
2263
|
+
} : { ...Ft };
|
|
2157
2264
|
}
|
|
2158
|
-
async function
|
|
2265
|
+
async function zt({ delayMs: e, onChange: t, signal: n }) {
|
|
2159
2266
|
if (n.aborted) throw new DOMException("Aborted", "AbortError");
|
|
2160
2267
|
if (e <= 0) {
|
|
2161
|
-
t({ ...
|
|
2268
|
+
t({ ...Ft });
|
|
2162
2269
|
return;
|
|
2163
2270
|
}
|
|
2164
2271
|
let r = Date.now() + e;
|
|
@@ -2166,9 +2273,9 @@ async function Pt({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2166
2273
|
delayRemainingMs: e,
|
|
2167
2274
|
nextRequestAt: r
|
|
2168
2275
|
}), await new Promise((i, a) => {
|
|
2169
|
-
let o = !1, s = setInterval(f,
|
|
2276
|
+
let o = !1, s = setInterval(f, Pt), c = setTimeout(() => u(), e);
|
|
2170
2277
|
function l() {
|
|
2171
|
-
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...
|
|
2278
|
+
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...Ft });
|
|
2172
2279
|
}
|
|
2173
2280
|
function u(e) {
|
|
2174
2281
|
o || (o = !0, l(), e ? a(e) : i());
|
|
@@ -2183,13 +2290,13 @@ async function Pt({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2183
2290
|
n.addEventListener("abort", d, { once: !0 });
|
|
2184
2291
|
});
|
|
2185
2292
|
}
|
|
2186
|
-
var
|
|
2293
|
+
var Bt = class {
|
|
2187
2294
|
interval = null;
|
|
2188
2295
|
constructor(e) {
|
|
2189
2296
|
this.onChange = e;
|
|
2190
2297
|
}
|
|
2191
2298
|
clear() {
|
|
2192
|
-
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...
|
|
2299
|
+
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...Ft });
|
|
2193
2300
|
}
|
|
2194
2301
|
sync(e) {
|
|
2195
2302
|
this.clear();
|
|
@@ -2197,22 +2304,22 @@ var Ft = class {
|
|
|
2197
2304
|
this.onChange(t), t.delayRemainingMs !== null && (this.interval = setInterval(() => {
|
|
2198
2305
|
let t = $(e);
|
|
2199
2306
|
this.onChange(t), t.delayRemainingMs === null && this.clear();
|
|
2200
|
-
},
|
|
2307
|
+
}, Pt));
|
|
2201
2308
|
}
|
|
2202
2309
|
};
|
|
2203
|
-
function
|
|
2310
|
+
function Vt(e, t = !0) {
|
|
2204
2311
|
return e.maxAdditionalPages === "unlimited" ? Infinity : (e.maxAdditionalPages ?? 10) + (t ? 1 : 0);
|
|
2205
2312
|
}
|
|
2206
|
-
function
|
|
2313
|
+
function Ht(e) {
|
|
2207
2314
|
return `${typeof e}:${String(e)}`;
|
|
2208
2315
|
}
|
|
2209
|
-
function
|
|
2316
|
+
function Ut(e, t) {
|
|
2210
2317
|
if (!Number.isInteger(e) || e <= 0) throw TypeError(`Vibe ${t} must be a positive integer.`);
|
|
2211
2318
|
}
|
|
2212
|
-
function
|
|
2319
|
+
function Wt(e) {
|
|
2213
2320
|
if (!e) return;
|
|
2214
|
-
if (
|
|
2215
|
-
|
|
2321
|
+
if (Ut(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
|
|
2322
|
+
Lt(e, "frontend autofill");
|
|
2216
2323
|
let t = e.maxAdditionalPages;
|
|
2217
2324
|
if (t !== void 0 && t !== "unlimited" && (!Number.isInteger(t) || t < 0)) throw TypeError("Vibe autofill maxAdditionalPages must be a non-negative integer or \"unlimited\".");
|
|
2218
2325
|
return;
|
|
@@ -2224,7 +2331,7 @@ function zt(e) {
|
|
|
2224
2331
|
if (t.pageSize !== e.pageSize) throw TypeError("Vibe backend autofill initialSession pageSize must match autofill pageSize.");
|
|
2225
2332
|
}
|
|
2226
2333
|
}
|
|
2227
|
-
function
|
|
2334
|
+
function Gt(e, t, n = !0) {
|
|
2228
2335
|
if (!e) return {
|
|
2229
2336
|
cycleId: null,
|
|
2230
2337
|
delayRemainingMs: null,
|
|
@@ -2258,7 +2365,7 @@ function Bt(e, t, n = !0) {
|
|
|
2258
2365
|
strategy: e.strategy
|
|
2259
2366
|
};
|
|
2260
2367
|
}
|
|
2261
|
-
function
|
|
2368
|
+
function Kt(e) {
|
|
2262
2369
|
return [
|
|
2263
2370
|
"cancelling",
|
|
2264
2371
|
"filling",
|
|
@@ -2266,9 +2373,9 @@ function Vt(e) {
|
|
|
2266
2373
|
"waiting"
|
|
2267
2374
|
].includes(e.status);
|
|
2268
2375
|
}
|
|
2269
|
-
async function
|
|
2376
|
+
async function qt(e, t, n) {
|
|
2270
2377
|
let r = t.autofill;
|
|
2271
|
-
if (!
|
|
2378
|
+
if (!Kt(r) || !r.cycleId) return;
|
|
2272
2379
|
let i = {
|
|
2273
2380
|
cycleId: r.cycleId,
|
|
2274
2381
|
feedKey: r.feedKey ?? "",
|
|
@@ -2281,20 +2388,20 @@ async function Ht(e, t, n) {
|
|
|
2281
2388
|
throw r.error = e, r.status = "error", e;
|
|
2282
2389
|
}
|
|
2283
2390
|
}
|
|
2284
|
-
function
|
|
2391
|
+
function Jt(e, t, n) {
|
|
2285
2392
|
return e?.strategy === "backend" && t.feedKey === e.feedKey && t.sessionId === n.sessionId;
|
|
2286
2393
|
}
|
|
2287
|
-
async function
|
|
2288
|
-
let d = [], f = [...e], p = /* @__PURE__ */ new Set(), m = r ??
|
|
2394
|
+
async function Yt({ existingItems: e, initialCursor: t, loadPage: n, maximumRequests: r, onCollection: i, onDelayChange: a, onProgress: o, options: s, receivedOffset: c = 0, requestOffset: l = 0, signal: u }) {
|
|
2395
|
+
let d = [], f = [...e], p = /* @__PURE__ */ new Set(), m = r ?? Vt(s), h = t, g = t, _ = 0, v;
|
|
2289
2396
|
for (; _ < m;) {
|
|
2290
|
-
let e =
|
|
2397
|
+
let e = Ht(h);
|
|
2291
2398
|
if (p.has(e)) throw Error("Vibe autofill received a repeated cursor.");
|
|
2292
|
-
p.add(e), await
|
|
2293
|
-
delayMs:
|
|
2399
|
+
p.add(e), await zt({
|
|
2400
|
+
delayMs: Rt(l + _, s),
|
|
2294
2401
|
onChange: a,
|
|
2295
2402
|
signal: u
|
|
2296
2403
|
});
|
|
2297
|
-
let t =
|
|
2404
|
+
let t = jt(await n({
|
|
2298
2405
|
cursor: h,
|
|
2299
2406
|
signal: u
|
|
2300
2407
|
}));
|
|
@@ -2337,12 +2444,12 @@ async function Wt({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
2337
2444
|
}
|
|
2338
2445
|
//#endregion
|
|
2339
2446
|
//#region src/core/autofillController.ts
|
|
2340
|
-
var
|
|
2447
|
+
var Xt = class {
|
|
2341
2448
|
collection = null;
|
|
2342
2449
|
cycle = 0;
|
|
2343
2450
|
delayCountdown;
|
|
2344
2451
|
constructor(e) {
|
|
2345
|
-
this.context = e, this.delayCountdown = new
|
|
2452
|
+
this.context = e, this.delayCountdown = new Bt((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
|
|
2346
2453
|
}
|
|
2347
2454
|
beginCycle() {
|
|
2348
2455
|
let { options: e, state: t } = this.context;
|
|
@@ -2350,14 +2457,14 @@ var Gt = class {
|
|
|
2350
2457
|
this.clear();
|
|
2351
2458
|
let n = `vibe-autofill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
2352
2459
|
return t.autofill = {
|
|
2353
|
-
...
|
|
2460
|
+
...Gt(e, void 0, !1),
|
|
2354
2461
|
cycleId: n,
|
|
2355
2462
|
status: "filling"
|
|
2356
2463
|
}, n;
|
|
2357
2464
|
}
|
|
2358
2465
|
async cancel() {
|
|
2359
2466
|
let { cancelRequest: e, options: t, state: n } = this.context;
|
|
2360
|
-
await
|
|
2467
|
+
await qt(t, n, e), this.commitCollection();
|
|
2361
2468
|
}
|
|
2362
2469
|
captureCollection(e, t) {
|
|
2363
2470
|
t && (this.collection = e);
|
|
@@ -2385,30 +2492,30 @@ var Gt = class {
|
|
|
2385
2492
|
requests: r.requests
|
|
2386
2493
|
}));
|
|
2387
2494
|
}
|
|
2388
|
-
},
|
|
2389
|
-
function
|
|
2495
|
+
}, Zt = 100;
|
|
2496
|
+
function Qt(e, t) {
|
|
2390
2497
|
if (!Number.isFinite(t) || t <= 0) throw TypeError(`Vibe ${e} must be a positive number.`);
|
|
2391
2498
|
}
|
|
2392
|
-
function
|
|
2499
|
+
function $t(e, t, n) {
|
|
2393
2500
|
return Math.min(n, Math.max(t, e));
|
|
2394
2501
|
}
|
|
2395
|
-
function
|
|
2502
|
+
function en(e) {
|
|
2396
2503
|
if (!e) return;
|
|
2397
2504
|
let t = e.minSpeedPxPerSecond ?? 20, n = e.maxSpeedPxPerSecond ?? 240;
|
|
2398
|
-
if (
|
|
2399
|
-
e.speedPxPerSecond !== void 0 &&
|
|
2505
|
+
if (Qt("autoScroll.minSpeedPxPerSecond", t), Qt("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
|
|
2506
|
+
e.speedPxPerSecond !== void 0 && Qt("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
|
|
2400
2507
|
}
|
|
2401
|
-
function
|
|
2508
|
+
function tn(e) {
|
|
2402
2509
|
let t = e?.minSpeedPxPerSecond ?? 20, n = e?.maxSpeedPxPerSecond ?? 240;
|
|
2403
2510
|
return {
|
|
2404
2511
|
enabled: e?.enabled ?? !1,
|
|
2405
2512
|
maxSpeedPxPerSecond: n,
|
|
2406
2513
|
minSpeedPxPerSecond: t,
|
|
2407
2514
|
paused: !1,
|
|
2408
|
-
speedPxPerSecond:
|
|
2515
|
+
speedPxPerSecond: $t(e?.speedPxPerSecond ?? 80, t, n)
|
|
2409
2516
|
};
|
|
2410
2517
|
}
|
|
2411
|
-
var
|
|
2518
|
+
var nn = class {
|
|
2412
2519
|
frame = null;
|
|
2413
2520
|
lastTimestamp = null;
|
|
2414
2521
|
mounted = !1;
|
|
@@ -2428,9 +2535,9 @@ var Zt = class {
|
|
|
2428
2535
|
this.options.state.enabled && (this.options.state.paused = e, this.lastTimestamp = null, e ? this.cancelFrame() : this.schedule());
|
|
2429
2536
|
}
|
|
2430
2537
|
setSpeed(e) {
|
|
2431
|
-
|
|
2538
|
+
Qt("auto-scroll speed", e);
|
|
2432
2539
|
let t = this.options.state;
|
|
2433
|
-
t.speedPxPerSecond =
|
|
2540
|
+
t.speedPxPerSecond = $t(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
|
|
2434
2541
|
}
|
|
2435
2542
|
tick = (e) => {
|
|
2436
2543
|
this.frame = null;
|
|
@@ -2442,7 +2549,7 @@ var Zt = class {
|
|
|
2442
2549
|
return;
|
|
2443
2550
|
}
|
|
2444
2551
|
if (this.lastTimestamp !== null) {
|
|
2445
|
-
let r = Math.min(
|
|
2552
|
+
let r = Math.min(Zt, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
|
|
2446
2553
|
n.scrollTop = Math.min(i, n.scrollTop + t.speedPxPerSecond * r / 1e3);
|
|
2447
2554
|
}
|
|
2448
2555
|
this.lastTimestamp = e, this.schedule();
|
|
@@ -2456,7 +2563,7 @@ var Zt = class {
|
|
|
2456
2563
|
};
|
|
2457
2564
|
//#endregion
|
|
2458
2565
|
//#region src/core/backendAutofill.ts
|
|
2459
|
-
async function
|
|
2566
|
+
async function rn(e, t, n, r) {
|
|
2460
2567
|
let i = await e.onUnderfilled(n);
|
|
2461
2568
|
if (!r()) return;
|
|
2462
2569
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend autofill requires a sessionId.");
|
|
@@ -2470,19 +2577,19 @@ async function Qt(e, t, n, r) {
|
|
|
2470
2577
|
status: "waiting"
|
|
2471
2578
|
});
|
|
2472
2579
|
}
|
|
2473
|
-
function
|
|
2580
|
+
function an(e, t) {
|
|
2474
2581
|
["complete", "exhausted"].includes(t.status) && t.items && (e.items = Q(e.items, t.items)), t.next !== void 0 && (e.next = t.next), t.total !== void 0 && (e.total = t.total);
|
|
2475
2582
|
}
|
|
2476
|
-
function
|
|
2583
|
+
function on(e, t, n) {
|
|
2477
2584
|
let r = t.autofill;
|
|
2478
|
-
return !
|
|
2585
|
+
return !Jt(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, $(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);
|
|
2479
2586
|
}
|
|
2480
|
-
function
|
|
2481
|
-
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill =
|
|
2587
|
+
function sn(e, t, n) {
|
|
2588
|
+
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = Gt(e, n), an(t, n), !0);
|
|
2482
2589
|
}
|
|
2483
2590
|
//#endregion
|
|
2484
2591
|
//#region src/core/initialAutofill.ts
|
|
2485
|
-
async function
|
|
2592
|
+
async function cn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, options: i, signal: a, state: o }) {
|
|
2486
2593
|
let s = i.autofill;
|
|
2487
2594
|
if (!s) return;
|
|
2488
2595
|
let c = o.items.length;
|
|
@@ -2495,7 +2602,7 @@ async function nn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
2495
2602
|
return;
|
|
2496
2603
|
}
|
|
2497
2604
|
if (s.strategy === "backend") {
|
|
2498
|
-
await
|
|
2605
|
+
await rn(s, o, {
|
|
2499
2606
|
cycleId: e,
|
|
2500
2607
|
feedKey: s.feedKey,
|
|
2501
2608
|
items: [...o.items],
|
|
@@ -2512,11 +2619,11 @@ async function nn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
2512
2619
|
o.autofill.status = "exhausted";
|
|
2513
2620
|
return;
|
|
2514
2621
|
}
|
|
2515
|
-
let l = await
|
|
2622
|
+
let l = await Yt({
|
|
2516
2623
|
existingItems: o.items,
|
|
2517
2624
|
initialCursor: o.next,
|
|
2518
2625
|
loadPage: i.loadPage,
|
|
2519
|
-
maximumRequests:
|
|
2626
|
+
maximumRequests: Vt(s, !1),
|
|
2520
2627
|
onCollection: n,
|
|
2521
2628
|
onDelayChange: (e) => {
|
|
2522
2629
|
t() && Object.assign(o.autofill, e);
|
|
@@ -2538,13 +2645,13 @@ async function nn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
2538
2645
|
}
|
|
2539
2646
|
//#endregion
|
|
2540
2647
|
//#region src/core/fill.ts
|
|
2541
|
-
function
|
|
2648
|
+
function ln(e) {
|
|
2542
2649
|
return "pages" in e ? { pages: e.pages } : { until: "end" };
|
|
2543
2650
|
}
|
|
2544
|
-
function
|
|
2651
|
+
function un(e) {
|
|
2545
2652
|
return `${typeof e}:${String(e)}`;
|
|
2546
2653
|
}
|
|
2547
|
-
function
|
|
2654
|
+
function dn(e) {
|
|
2548
2655
|
if (!e || typeof e != "object") throw TypeError("Vibe fill target must be an object.");
|
|
2549
2656
|
if ("pages" in e) {
|
|
2550
2657
|
if (!Number.isInteger(e.pages) || e.pages <= 0) throw TypeError("Vibe fill pages must be a positive integer.");
|
|
@@ -2553,20 +2660,20 @@ function on(e) {
|
|
|
2553
2660
|
if ("until" in e && e.until === "end") return { until: "end" };
|
|
2554
2661
|
throw TypeError("Vibe fill target must be { pages } or { until: 'end' }.");
|
|
2555
2662
|
}
|
|
2556
|
-
function
|
|
2663
|
+
function fn(e) {
|
|
2557
2664
|
if (!e) return;
|
|
2558
2665
|
if (e.strategy === "frontend") {
|
|
2559
|
-
|
|
2666
|
+
Lt(e, "frontend fill");
|
|
2560
2667
|
return;
|
|
2561
2668
|
}
|
|
2562
2669
|
if (!e.feedKey.trim()) throw TypeError("Vibe backend fill requires a feedKey.");
|
|
2563
2670
|
let t = e.initialSession;
|
|
2564
2671
|
if (t) {
|
|
2565
2672
|
if (t.feedKey !== e.feedKey) throw TypeError("Vibe backend fill initialSession feedKey must match fill feedKey.");
|
|
2566
|
-
|
|
2673
|
+
dn(t.target);
|
|
2567
2674
|
}
|
|
2568
2675
|
}
|
|
2569
|
-
function
|
|
2676
|
+
function pn(e, t, n = !0) {
|
|
2570
2677
|
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a = $(i?.nextRequestAt);
|
|
2571
2678
|
return {
|
|
2572
2679
|
completedPages: i?.completedPages ?? 0,
|
|
@@ -2580,10 +2687,10 @@ function cn(e, t, n = !0) {
|
|
|
2580
2687
|
sessionId: i?.sessionId ?? null,
|
|
2581
2688
|
status: i?.status ?? "idle",
|
|
2582
2689
|
strategy: e?.strategy ?? null,
|
|
2583
|
-
target: i ?
|
|
2690
|
+
target: i ? ln(i.target) : null
|
|
2584
2691
|
};
|
|
2585
2692
|
}
|
|
2586
|
-
function
|
|
2693
|
+
function mn(e) {
|
|
2587
2694
|
return [
|
|
2588
2695
|
"cancelling",
|
|
2589
2696
|
"filling",
|
|
@@ -2591,17 +2698,17 @@ function ln(e) {
|
|
|
2591
2698
|
"waiting"
|
|
2592
2699
|
].includes(e.status);
|
|
2593
2700
|
}
|
|
2594
|
-
async function
|
|
2701
|
+
async function hn({ existingItems: e, initialCursor: t, loadPage: n, onDelayChange: r, onProgress: i, options: a, signal: o, target: s }) {
|
|
2595
2702
|
let c = [], l = [...e], u = /* @__PURE__ */ new Set(), d = 0, f = t, p = t, m = 0, h;
|
|
2596
2703
|
for (; p !== null;) {
|
|
2597
|
-
let e =
|
|
2704
|
+
let e = un(f);
|
|
2598
2705
|
if (u.has(e)) throw Error("Vibe fill received a repeated cursor.");
|
|
2599
|
-
u.add(e), await
|
|
2600
|
-
delayMs:
|
|
2706
|
+
u.add(e), await zt({
|
|
2707
|
+
delayMs: Rt(d, a),
|
|
2601
2708
|
onChange: r,
|
|
2602
2709
|
signal: o
|
|
2603
2710
|
});
|
|
2604
|
-
let t =
|
|
2711
|
+
let t = jt(await n({
|
|
2605
2712
|
cursor: f,
|
|
2606
2713
|
signal: o
|
|
2607
2714
|
}));
|
|
@@ -2643,7 +2750,7 @@ async function un({ existingItems: e, initialCursor: t, loadPage: n, onDelayChan
|
|
|
2643
2750
|
}
|
|
2644
2751
|
//#endregion
|
|
2645
2752
|
//#region src/core/backendFill.ts
|
|
2646
|
-
async function
|
|
2753
|
+
async function gn(e, t, n, r) {
|
|
2647
2754
|
let i = await e.onStart(n);
|
|
2648
2755
|
if (r()) {
|
|
2649
2756
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend fill requires a sessionId.");
|
|
@@ -2657,22 +2764,22 @@ async function dn(e, t, n, r) {
|
|
|
2657
2764
|
});
|
|
2658
2765
|
}
|
|
2659
2766
|
}
|
|
2660
|
-
function
|
|
2767
|
+
function _n(e, t, n) {
|
|
2661
2768
|
return e?.strategy === "backend" && n.feedKey === e.feedKey && n.sessionId === t.fill.sessionId;
|
|
2662
2769
|
}
|
|
2663
|
-
function
|
|
2770
|
+
function vn(e) {
|
|
2664
2771
|
return Number.isInteger(e.completedPages) && e.completedPages >= 0 && Number.isInteger(e.received) && e.received >= 0 && Number.isInteger(e.sequence) && e.sequence >= 0;
|
|
2665
2772
|
}
|
|
2666
|
-
function
|
|
2773
|
+
function yn(e, t) {
|
|
2667
2774
|
if (!["complete", "exhausted"].includes(t.status)) return !0;
|
|
2668
2775
|
let n = e.fill.target;
|
|
2669
2776
|
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;
|
|
2670
2777
|
}
|
|
2671
|
-
function
|
|
2778
|
+
function bn(e, t, n) {
|
|
2672
2779
|
t.total !== void 0 && (e.total = t.total), ["complete", "exhausted"].includes(t.status) && (e.items = Q(e.items, t.items ?? []), e.next = t.next ?? null, n(t.lastCursor ?? null));
|
|
2673
2780
|
}
|
|
2674
|
-
function
|
|
2675
|
-
return !
|
|
2781
|
+
function xn(e, t, n, r) {
|
|
2782
|
+
return !_n(e, t, n) || !vn(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !yn(t, n) ? !1 : (bn(t, n, r), Object.assign(t.fill, {
|
|
2676
2783
|
...$(n.status === "waiting" ? n.nextRequestAt : null),
|
|
2677
2784
|
completedPages: n.completedPages,
|
|
2678
2785
|
error: n.error ?? null,
|
|
@@ -2681,41 +2788,41 @@ function gn(e, t, n, r) {
|
|
|
2681
2788
|
status: n.status
|
|
2682
2789
|
}), !0);
|
|
2683
2790
|
}
|
|
2684
|
-
function
|
|
2791
|
+
function Sn(e, t, n, r) {
|
|
2685
2792
|
if (e?.strategy !== "backend" || n.feedKey !== e.feedKey) return !1;
|
|
2686
2793
|
let i = t.fill;
|
|
2687
|
-
return t.fill =
|
|
2794
|
+
return t.fill = pn(e, n), !vn(n) || !yn(t, n) ? (t.fill = i, !1) : (bn(t, n, r), !0);
|
|
2688
2795
|
}
|
|
2689
2796
|
//#endregion
|
|
2690
2797
|
//#region src/core/fillController.ts
|
|
2691
|
-
var
|
|
2798
|
+
var Cn = class {
|
|
2692
2799
|
abortController = null;
|
|
2693
2800
|
cycle = 0;
|
|
2694
2801
|
delayCountdown;
|
|
2695
2802
|
requestVersion = 0;
|
|
2696
2803
|
constructor(e) {
|
|
2697
|
-
this.options = e, this.delayCountdown = new
|
|
2804
|
+
this.options = e, this.delayCountdown = new Bt((e) => {
|
|
2698
2805
|
Object.assign(this.options.state.fill, e);
|
|
2699
2806
|
}), this.syncBackendCountdown();
|
|
2700
2807
|
}
|
|
2701
2808
|
isActive() {
|
|
2702
|
-
return
|
|
2809
|
+
return mn(this.options.state.fill);
|
|
2703
2810
|
}
|
|
2704
2811
|
applyUpdate(e) {
|
|
2705
|
-
let t =
|
|
2812
|
+
let t = xn(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
2706
2813
|
return t && this.syncBackendCountdown(), t;
|
|
2707
2814
|
}
|
|
2708
2815
|
restoreSession(e) {
|
|
2709
|
-
let t =
|
|
2816
|
+
let t = Sn(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
2710
2817
|
return t && this.syncBackendCountdown(), t;
|
|
2711
2818
|
}
|
|
2712
2819
|
async start(e) {
|
|
2713
2820
|
let t = this.options.fill;
|
|
2714
2821
|
if (!t) throw Error("Vibe fill is not configured.");
|
|
2715
2822
|
if (this.isActive()) throw Error("Vibe fill is already active.");
|
|
2716
|
-
let n =
|
|
2823
|
+
let n = dn(e), r = `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
2717
2824
|
if (this.options.state.fill = {
|
|
2718
|
-
...
|
|
2825
|
+
...pn(t, void 0, !1),
|
|
2719
2826
|
cycleId: r,
|
|
2720
2827
|
status: "filling",
|
|
2721
2828
|
target: n
|
|
@@ -2726,7 +2833,7 @@ var vn = class {
|
|
|
2726
2833
|
let i = ++this.requestVersion, a = new AbortController();
|
|
2727
2834
|
this.abortController = a;
|
|
2728
2835
|
try {
|
|
2729
|
-
t.strategy === "frontend" ? await this.startFrontend(t, n, a, i) : (await
|
|
2836
|
+
t.strategy === "frontend" ? await this.startFrontend(t, n, a, i) : (await gn(t, this.options.state, {
|
|
2730
2837
|
cycleId: r,
|
|
2731
2838
|
feedKey: t.feedKey,
|
|
2732
2839
|
items: [...this.options.state.items],
|
|
@@ -2744,7 +2851,7 @@ var vn = class {
|
|
|
2744
2851
|
}
|
|
2745
2852
|
async cancel() {
|
|
2746
2853
|
let { fill: e, state: t } = this.options;
|
|
2747
|
-
if (!
|
|
2854
|
+
if (!mn(t.fill) || !t.fill.cycleId) return;
|
|
2748
2855
|
let n = {
|
|
2749
2856
|
cycleId: t.fill.cycleId,
|
|
2750
2857
|
feedKey: t.fill.feedKey ?? "",
|
|
@@ -2758,7 +2865,7 @@ var vn = class {
|
|
|
2758
2865
|
}
|
|
2759
2866
|
}
|
|
2760
2867
|
reset() {
|
|
2761
|
-
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill =
|
|
2868
|
+
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = pn(this.options.fill, void 0, !1);
|
|
2762
2869
|
}
|
|
2763
2870
|
destroy() {
|
|
2764
2871
|
this.abortLocalRequest(), this.delayCountdown.clear();
|
|
@@ -2774,7 +2881,7 @@ var vn = class {
|
|
|
2774
2881
|
if (!i) throw Error("Vibe frontend fill requires loadPage.");
|
|
2775
2882
|
let a = this.options.state;
|
|
2776
2883
|
a.isLoadingMore = !0;
|
|
2777
|
-
let o = await
|
|
2884
|
+
let o = await hn({
|
|
2778
2885
|
existingItems: a.items,
|
|
2779
2886
|
initialCursor: a.next,
|
|
2780
2887
|
loadPage: i,
|
|
@@ -2801,7 +2908,7 @@ var vn = class {
|
|
|
2801
2908
|
};
|
|
2802
2909
|
//#endregion
|
|
2803
2910
|
//#region src/core/feedFooter.ts
|
|
2804
|
-
function
|
|
2911
|
+
function wn(e) {
|
|
2805
2912
|
return {
|
|
2806
2913
|
cancelAutofill: () => e.cancelAutofill(),
|
|
2807
2914
|
loadMore: () => e.loadNext(),
|
|
@@ -2809,45 +2916,45 @@ function yn(e) {
|
|
|
2809
2916
|
retryEnd: () => e.retryEnd()
|
|
2810
2917
|
};
|
|
2811
2918
|
}
|
|
2812
|
-
function
|
|
2919
|
+
function Tn(e) {
|
|
2813
2920
|
if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
|
|
2814
2921
|
}
|
|
2815
|
-
function
|
|
2816
|
-
e?.intervalMs !== void 0 &&
|
|
2922
|
+
function En(e) {
|
|
2923
|
+
e?.intervalMs !== void 0 && Tn(e.intervalMs);
|
|
2817
2924
|
}
|
|
2818
|
-
function
|
|
2925
|
+
function Dn(e) {
|
|
2819
2926
|
return {
|
|
2820
2927
|
enabled: e?.enabled ?? !1,
|
|
2821
2928
|
includePostItems: e?.includePostItems ?? !1,
|
|
2822
2929
|
intervalMs: e?.intervalMs ?? 5e3
|
|
2823
2930
|
};
|
|
2824
2931
|
}
|
|
2825
|
-
function
|
|
2932
|
+
function On(e, t) {
|
|
2826
2933
|
if (typeof t == "boolean") {
|
|
2827
2934
|
e.enabled = t;
|
|
2828
2935
|
return;
|
|
2829
2936
|
}
|
|
2830
|
-
|
|
2937
|
+
En(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);
|
|
2831
2938
|
}
|
|
2832
2939
|
//#endregion
|
|
2833
2940
|
//#region src/core/reelInfoSheet.ts
|
|
2834
|
-
function
|
|
2941
|
+
function kn(e) {
|
|
2835
2942
|
return { enabled: e?.enabled ?? !1 };
|
|
2836
2943
|
}
|
|
2837
|
-
function
|
|
2944
|
+
function An(e, t, n) {
|
|
2838
2945
|
if (n && !t) throw Error("Vibe cannot enable reelInfoSheet without a configured component.");
|
|
2839
2946
|
e.enabled = n;
|
|
2840
2947
|
}
|
|
2841
2948
|
//#endregion
|
|
2842
2949
|
//#region src/core/initialRuntimeState.ts
|
|
2843
|
-
function
|
|
2950
|
+
function jn(e, t) {
|
|
2844
2951
|
let n = e.initialPage;
|
|
2845
2952
|
return {
|
|
2846
2953
|
activeReelPostId: null,
|
|
2847
|
-
autoScroll:
|
|
2848
|
-
autofill:
|
|
2954
|
+
autoScroll: tn(e.autoScroll),
|
|
2955
|
+
autofill: Gt(e.autofill),
|
|
2849
2956
|
error: null,
|
|
2850
|
-
fill:
|
|
2957
|
+
fill: pn(e.fill),
|
|
2851
2958
|
infiniteScroll: e.infiniteScroll ?? !0,
|
|
2852
2959
|
isLoading: !n,
|
|
2853
2960
|
isLoadingMore: !1,
|
|
@@ -2857,14 +2964,14 @@ function En(e, t) {
|
|
|
2857
2964
|
mediaIndices: /* @__PURE__ */ new Map(),
|
|
2858
2965
|
next: n?.next ?? null,
|
|
2859
2966
|
nextPageError: null,
|
|
2860
|
-
reelAutoAdvance:
|
|
2967
|
+
reelAutoAdvance: Dn(e.reelAutoAdvance),
|
|
2861
2968
|
reelForward: {
|
|
2862
2969
|
error: null,
|
|
2863
2970
|
status: "idle"
|
|
2864
2971
|
},
|
|
2865
2972
|
reelForwardIndex: null,
|
|
2866
2973
|
reelForwardItem: null,
|
|
2867
|
-
reelInfoSheet:
|
|
2974
|
+
reelInfoSheet: kn(e.reelInfoSheet),
|
|
2868
2975
|
reelInfoSheetOverlay: !1,
|
|
2869
2976
|
reelMediaSource: "original",
|
|
2870
2977
|
reelOrigin: null,
|
|
@@ -2873,26 +2980,26 @@ function En(e, t) {
|
|
|
2873
2980
|
}
|
|
2874
2981
|
//#endregion
|
|
2875
2982
|
//#region src/core/options.ts
|
|
2876
|
-
function
|
|
2983
|
+
function Mn(e, t) {
|
|
2877
2984
|
if (t) {
|
|
2878
2985
|
if (!Number.isFinite(t.height) || t.height <= 0) throw TypeError(`Vibe ${e} height must be a positive number.`);
|
|
2879
2986
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe ${e} background must be "default" or "transparent".`);
|
|
2880
2987
|
}
|
|
2881
2988
|
}
|
|
2882
|
-
function
|
|
2989
|
+
function Nn(e, t) {
|
|
2883
2990
|
if (t) {
|
|
2884
2991
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe mediaCard ${e} background must be "default" or "transparent".`);
|
|
2885
2992
|
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.`);
|
|
2886
2993
|
}
|
|
2887
2994
|
}
|
|
2888
|
-
function
|
|
2889
|
-
if (
|
|
2995
|
+
function Pn(e) {
|
|
2996
|
+
if (en(e.autoScroll), Mn("cardHeader", e.cardHeader), Mn("cardFooter", e.cardFooter), Nn("header", e.mediaCard?.header), Nn("footer", e.mediaCard?.footer), Wt(e.autofill), fn(e.fill), En(e.reelAutoAdvance), e.removalHistoryLimit !== void 0 && (!Number.isInteger(e.removalHistoryLimit) || e.removalHistoryLimit < 0)) throw TypeError("Vibe removalHistoryLimit must be a non-negative integer.");
|
|
2890
2997
|
if (!e.initialPage && !e.loadPage) throw TypeError("Vibe requires either initialPage or loadPage.");
|
|
2891
2998
|
if (e.initialPage?.next !== null && !e.loadPage) throw TypeError("Vibe requires loadPage when initialPage has a next cursor.");
|
|
2892
2999
|
if (e.fill?.strategy === "frontend" && !e.loadPage) throw TypeError("Vibe frontend fill requires loadPage.");
|
|
2893
3000
|
if (e.fill?.strategy === "backend" && e.fill.initialSession && !e.initialPage) throw TypeError("Vibe backend fill restoration requires initialPage.");
|
|
2894
3001
|
}
|
|
2895
|
-
function
|
|
3002
|
+
function Fn(e) {
|
|
2896
3003
|
if (typeof e != "string") return e;
|
|
2897
3004
|
if (typeof document > "u") throw Error("Vibe cannot resolve a selector without a document.");
|
|
2898
3005
|
let t = document.querySelector(e);
|
|
@@ -2901,7 +3008,7 @@ function An(e) {
|
|
|
2901
3008
|
}
|
|
2902
3009
|
//#endregion
|
|
2903
3010
|
//#region src/core/activeItemRemoval.ts
|
|
2904
|
-
function
|
|
3011
|
+
function In(e, t, n, r, i) {
|
|
2905
3012
|
let a = new Set(t.map(({ item: e }) => e.postId));
|
|
2906
3013
|
if (e.activeReelPostId === null || !a.has(e.activeReelPostId)) return;
|
|
2907
3014
|
let o = e.items[Math.max(n, 0)];
|
|
@@ -2914,7 +3021,7 @@ function jn(e, t, n, r, i) {
|
|
|
2914
3021
|
}
|
|
2915
3022
|
//#endregion
|
|
2916
3023
|
//#region src/core/exactMediaRemovalController.ts
|
|
2917
|
-
function
|
|
3024
|
+
function Ln(e, t) {
|
|
2918
3025
|
let [n, ...r] = t;
|
|
2919
3026
|
if (!n) throw Error("Vibe items must contain at least one media asset.");
|
|
2920
3027
|
return {
|
|
@@ -2923,10 +3030,10 @@ function Mn(e, t) {
|
|
|
2923
3030
|
items: r
|
|
2924
3031
|
};
|
|
2925
3032
|
}
|
|
2926
|
-
function
|
|
3033
|
+
function Rn(e) {
|
|
2927
3034
|
if (!Number.isInteger(e.mediaIndex) || e.mediaIndex < 0) throw TypeError("Vibe mediaIndex must be a non-negative integer.");
|
|
2928
3035
|
}
|
|
2929
|
-
var
|
|
3036
|
+
var zn = class {
|
|
2930
3037
|
generation = 0;
|
|
2931
3038
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
2932
3039
|
state;
|
|
@@ -2934,7 +3041,7 @@ var Pn = class {
|
|
|
2934
3041
|
this.options = e, this.state = e.state;
|
|
2935
3042
|
}
|
|
2936
3043
|
remove(e) {
|
|
2937
|
-
|
|
3044
|
+
Rn(e);
|
|
2938
3045
|
let t = this.state.items.findIndex(({ postId: t }) => t === e.postId), n = this.state.items[t];
|
|
2939
3046
|
if (!n) return null;
|
|
2940
3047
|
let r = [...M(n)], i = r[e.mediaIndex];
|
|
@@ -2951,7 +3058,7 @@ var Pn = class {
|
|
|
2951
3058
|
restored: !1
|
|
2952
3059
|
});
|
|
2953
3060
|
let o = this.state.mediaIndices.get(n.postId) ?? 0, s = this.isReelOpen() && this.state.activeReelPostId === n.postId, c = s && o === e.mediaIndex;
|
|
2954
|
-
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] =
|
|
3061
|
+
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = Ln(n, r), this.updateMediaIndexAfterRemoval(n.postId, e.mediaIndex, c), a) : (this.state.items.splice(t, 1), this.state.mediaIndices.delete(n.postId), s && this.advanceFromRemovedPost(a, n), a);
|
|
2955
3062
|
}
|
|
2956
3063
|
reset() {
|
|
2957
3064
|
this.generation += 1;
|
|
@@ -2977,7 +3084,7 @@ var Pn = class {
|
|
|
2977
3084
|
}
|
|
2978
3085
|
restoreIntoPost(e, t) {
|
|
2979
3086
|
let n = this.state.items[e], r = [...M(n)], i = Math.min(t.mediaIndex, r.length);
|
|
2980
|
-
if (r.splice(i, 0, t.media), this.state.items[e] =
|
|
3087
|
+
if (r.splice(i, 0, t.media), this.state.items[e] = Ln(n, r), this.state.activeReelPostId !== t.postId) return;
|
|
2981
3088
|
let a = this.state.mediaIndices.get(t.postId) ?? 0;
|
|
2982
3089
|
a >= i && this.state.mediaIndices.set(t.postId, a + 1);
|
|
2983
3090
|
}
|
|
@@ -2990,18 +3097,18 @@ var Pn = class {
|
|
|
2990
3097
|
};
|
|
2991
3098
|
//#endregion
|
|
2992
3099
|
//#region src/core/itemPlacement.ts
|
|
2993
|
-
function
|
|
3100
|
+
function Bn(e, t) {
|
|
2994
3101
|
let n = new Set(t);
|
|
2995
3102
|
return e.flatMap((e, t) => n.has(e.postId) ? [{
|
|
2996
3103
|
index: t,
|
|
2997
3104
|
item: e
|
|
2998
3105
|
}] : []);
|
|
2999
3106
|
}
|
|
3000
|
-
function
|
|
3107
|
+
function Vn(e, t) {
|
|
3001
3108
|
let n = new Set(t.map(({ item: e }) => e.postId));
|
|
3002
3109
|
return e.filter((e) => !n.has(e.postId));
|
|
3003
3110
|
}
|
|
3004
|
-
function
|
|
3111
|
+
function Hn(e, t) {
|
|
3005
3112
|
t.forEach(({ index: e }) => {
|
|
3006
3113
|
if (!Number.isInteger(e) || e < 0) throw Error("Vibe item restore indexes must be non-negative integers.");
|
|
3007
3114
|
});
|
|
@@ -3012,7 +3119,7 @@ function Ln(e, t) {
|
|
|
3012
3119
|
}
|
|
3013
3120
|
//#endregion
|
|
3014
3121
|
//#region src/core/itemRemovalController.ts
|
|
3015
|
-
var
|
|
3122
|
+
var Un = 20, Wn = class {
|
|
3016
3123
|
generation = 0;
|
|
3017
3124
|
historyLimit;
|
|
3018
3125
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
@@ -3021,7 +3128,7 @@ var Rn = 20, zn = class {
|
|
|
3021
3128
|
itemOrder;
|
|
3022
3129
|
stopItemsWatcher;
|
|
3023
3130
|
constructor(e) {
|
|
3024
|
-
this.options = e, this.historyLimit = e.historyLimit ??
|
|
3131
|
+
this.options = e, this.historyLimit = e.historyLimit ?? Un, 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" });
|
|
3025
3132
|
}
|
|
3026
3133
|
destroy() {
|
|
3027
3134
|
this.reset(), this.stopItemsWatcher();
|
|
@@ -3034,7 +3141,7 @@ var Rn = 20, zn = class {
|
|
|
3034
3141
|
let i = this.options.startRemoval(r);
|
|
3035
3142
|
if (i > 0 && await new Promise((e) => setTimeout(e, i)), this.metadata.get(n)?.generation !== this.generation) return n;
|
|
3036
3143
|
let a = this.state.items.findIndex((e) => e.postId === this.state.activeReelPostId), o = new Set(t.map(({ item: e }) => e.postId)), s = a < 0 ? 0 : this.state.items.slice(0, a).filter(({ postId: e }) => o.has(e)).length, c = Math.max(a - s, 0);
|
|
3037
|
-
return this.state.items =
|
|
3144
|
+
return this.state.items = Vn(this.state.items, t), this.options.onItemsRemoved(n, t, c), this.record(n), n;
|
|
3038
3145
|
}
|
|
3039
3146
|
reset() {
|
|
3040
3147
|
this.generation += 1, this.history = [], this.itemOrder = [];
|
|
@@ -3045,7 +3152,7 @@ var Rn = 20, zn = class {
|
|
|
3045
3152
|
this.restoreRemoval(t);
|
|
3046
3153
|
return;
|
|
3047
3154
|
}
|
|
3048
|
-
let n =
|
|
3155
|
+
let n = Hn(this.state.items, e);
|
|
3049
3156
|
this.registerExternalPlacements(e), this.state.items = n;
|
|
3050
3157
|
}
|
|
3051
3158
|
restoreRemoval(e) {
|
|
@@ -3071,7 +3178,7 @@ var Rn = 20, zn = class {
|
|
|
3071
3178
|
}
|
|
3072
3179
|
collectOrderedPlacements(e) {
|
|
3073
3180
|
let t = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
3074
|
-
return
|
|
3181
|
+
return Bn(this.state.items, e).map((e) => ({
|
|
3075
3182
|
index: t.get(e.item.postId) ?? e.index,
|
|
3076
3183
|
item: e.item
|
|
3077
3184
|
}));
|
|
@@ -3102,7 +3209,7 @@ var Rn = 20, zn = class {
|
|
|
3102
3209
|
let r = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
3103
3210
|
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;
|
|
3104
3211
|
}
|
|
3105
|
-
},
|
|
3212
|
+
}, Gn = class {
|
|
3106
3213
|
forward = null;
|
|
3107
3214
|
forwardPromise = null;
|
|
3108
3215
|
forwardVersion = 0;
|
|
@@ -3180,7 +3287,7 @@ var Rn = 20, zn = class {
|
|
|
3180
3287
|
}
|
|
3181
3288
|
}
|
|
3182
3289
|
}
|
|
3183
|
-
},
|
|
3290
|
+
}, Kn = class {
|
|
3184
3291
|
generation = 0;
|
|
3185
3292
|
pending = Promise.resolve();
|
|
3186
3293
|
constructor(e) {
|
|
@@ -3230,22 +3337,22 @@ var Rn = 20, zn = class {
|
|
|
3230
3337
|
};
|
|
3231
3338
|
//#endregion
|
|
3232
3339
|
//#region src/core/removalControllers.ts
|
|
3233
|
-
function
|
|
3234
|
-
let t = new
|
|
3340
|
+
function qn(e) {
|
|
3341
|
+
let t = new Gn(e), n = new Kn({
|
|
3235
3342
|
state: e.state,
|
|
3236
3343
|
transitionMedia: (t) => e.surface()?.transitionActiveReelMedia(t) ?? Promise.resolve(!1),
|
|
3237
3344
|
transitionPost: (t) => e.surface()?.transitionActiveReelPost(t) ?? Promise.resolve(!1)
|
|
3238
3345
|
});
|
|
3239
3346
|
return {
|
|
3240
|
-
exactMediaRemoval: new
|
|
3347
|
+
exactMediaRemoval: new zn({
|
|
3241
3348
|
onActivate: e.onActivate,
|
|
3242
3349
|
reelForward: t,
|
|
3243
3350
|
state: e.state
|
|
3244
3351
|
}),
|
|
3245
|
-
itemRemoval: new
|
|
3352
|
+
itemRemoval: new Wn({
|
|
3246
3353
|
historyLimit: e.historyLimit,
|
|
3247
3354
|
onItemsRemoved: (n, r, i) => {
|
|
3248
|
-
|
|
3355
|
+
In(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
|
|
3249
3356
|
},
|
|
3250
3357
|
onRemovalRestored: (n) => {
|
|
3251
3358
|
let r = t.cancel(n);
|
|
@@ -3259,17 +3366,17 @@ function Hn(e) {
|
|
|
3259
3366
|
reelRemoval: n
|
|
3260
3367
|
};
|
|
3261
3368
|
}
|
|
3262
|
-
var
|
|
3263
|
-
function
|
|
3369
|
+
var Jn = 1.5;
|
|
3370
|
+
function Yn(e) {
|
|
3264
3371
|
let t = Math.min(e.screenWidth, e.screenHeight);
|
|
3265
3372
|
if (t > 0 && t < 600) return !0;
|
|
3266
|
-
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n *
|
|
3373
|
+
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * Jn;
|
|
3267
3374
|
return !e.hasHover && n > 0 && n < 600 && r;
|
|
3268
3375
|
}
|
|
3269
|
-
function
|
|
3270
|
-
return
|
|
3376
|
+
function Xn(e) {
|
|
3377
|
+
return Yn(e) ? "reel" : "masonry";
|
|
3271
3378
|
}
|
|
3272
|
-
function
|
|
3379
|
+
function Zn(e) {
|
|
3273
3380
|
let t = e.ownerDocument.defaultView, n = e.ownerDocument.documentElement;
|
|
3274
3381
|
return {
|
|
3275
3382
|
hasHover: typeof t?.matchMedia == "function" && t.matchMedia("(hover: hover)").matches,
|
|
@@ -3279,15 +3386,15 @@ function Kn(e) {
|
|
|
3279
3386
|
viewportWidth: n.clientWidth
|
|
3280
3387
|
};
|
|
3281
3388
|
}
|
|
3282
|
-
function
|
|
3283
|
-
return
|
|
3389
|
+
function Qn(e) {
|
|
3390
|
+
return Yn(Zn(e));
|
|
3284
3391
|
}
|
|
3285
|
-
function
|
|
3286
|
-
return
|
|
3392
|
+
function $n(e) {
|
|
3393
|
+
return Xn(Zn(e));
|
|
3287
3394
|
}
|
|
3288
3395
|
//#endregion
|
|
3289
3396
|
//#region src/core/responsiveLayoutController.ts
|
|
3290
|
-
var
|
|
3397
|
+
var er = class {
|
|
3291
3398
|
layoutMode;
|
|
3292
3399
|
resizeObserver = null;
|
|
3293
3400
|
target = null;
|
|
@@ -3312,10 +3419,10 @@ var Yn = class {
|
|
|
3312
3419
|
}
|
|
3313
3420
|
handleResponsiveLayout = () => {
|
|
3314
3421
|
if (!this.target) return;
|
|
3315
|
-
let e =
|
|
3316
|
-
this.state.reelInfoSheetOverlay =
|
|
3422
|
+
let e = $n(this.target);
|
|
3423
|
+
this.state.reelInfoSheetOverlay = Qn(this.target), this.state.reelMediaSource = e === "reel" ? "preview" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
|
|
3317
3424
|
};
|
|
3318
|
-
},
|
|
3425
|
+
}, tr = class {
|
|
3319
3426
|
routedReelPostId = null;
|
|
3320
3427
|
reelRouteIsActive = !1;
|
|
3321
3428
|
constructor(e, t) {
|
|
@@ -3342,7 +3449,7 @@ var Yn = class {
|
|
|
3342
3449
|
let i = this.reelRouteIsActive ? "replace" : "push";
|
|
3343
3450
|
this.reelRouteIsActive = !0, this.routedReelPostId = e, this.options.router[i](r);
|
|
3344
3451
|
}
|
|
3345
|
-
},
|
|
3452
|
+
}, nr = class {
|
|
3346
3453
|
app = null;
|
|
3347
3454
|
autoScroll;
|
|
3348
3455
|
autofillController;
|
|
@@ -3361,27 +3468,27 @@ var Yn = class {
|
|
|
3361
3468
|
lastLoadedCursor = null;
|
|
3362
3469
|
state;
|
|
3363
3470
|
constructor(e) {
|
|
3364
|
-
this.options = e,
|
|
3471
|
+
this.options = e, Pn(e);
|
|
3365
3472
|
let t = e.layout ?? "masonry";
|
|
3366
|
-
this.state = x(
|
|
3473
|
+
this.state = x(jn(e, t)), this.autoScroll = new nn({
|
|
3367
3474
|
getScrollElement: () => this.surface?.getAutoScrollElement() ?? null,
|
|
3368
3475
|
state: this.state.autoScroll
|
|
3369
|
-
}), this.autofillController = new
|
|
3476
|
+
}), this.autofillController = new Xt({
|
|
3370
3477
|
cancelRequest: () => this.cancelRequest(),
|
|
3371
3478
|
onLastCursor: (e) => {
|
|
3372
3479
|
this.lastLoadedCursor = e;
|
|
3373
3480
|
},
|
|
3374
3481
|
options: e.autofill,
|
|
3375
3482
|
state: this.state
|
|
3376
|
-
}), this.fillController = new
|
|
3483
|
+
}), this.fillController = new Cn({
|
|
3377
3484
|
fill: e.fill,
|
|
3378
3485
|
loadPage: e.loadPage,
|
|
3379
3486
|
onLastCursor: (e) => {
|
|
3380
3487
|
this.lastLoadedCursor = e;
|
|
3381
3488
|
},
|
|
3382
3489
|
state: this.state
|
|
3383
|
-
}), this.routing = new
|
|
3384
|
-
let n =
|
|
3490
|
+
}), this.routing = new tr(e.routing, this.state);
|
|
3491
|
+
let n = qn({
|
|
3385
3492
|
historyLimit: e.removalHistoryLimit,
|
|
3386
3493
|
loadNext: () => this.loadNext(),
|
|
3387
3494
|
onActivate: (e) => this.setActiveReelPost(e),
|
|
@@ -3389,20 +3496,20 @@ var Yn = class {
|
|
|
3389
3496
|
state: this.state,
|
|
3390
3497
|
surface: () => this.surface
|
|
3391
3498
|
});
|
|
3392
|
-
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new
|
|
3499
|
+
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new er(t, this.state, () => {
|
|
3393
3500
|
this.routing.syncFeed();
|
|
3394
3501
|
}), this.startStateNotifications();
|
|
3395
3502
|
}
|
|
3396
3503
|
async mount() {
|
|
3397
3504
|
if (this.app) throw Error("Vibe is already mounted.");
|
|
3398
3505
|
this.startStateNotifications();
|
|
3399
|
-
let e =
|
|
3400
|
-
this.responsiveLayout.mount(e), this.app = i(
|
|
3506
|
+
let e = Fn(this.options.target);
|
|
3507
|
+
this.responsiveLayout.mount(e), this.app = i(At, {
|
|
3401
3508
|
canRetryEnd: !!this.options.loadPage,
|
|
3402
3509
|
cardFooter: this.options.cardFooter,
|
|
3403
3510
|
cardHeader: this.options.cardHeader,
|
|
3404
3511
|
feedFooter: this.options.feedFooter,
|
|
3405
|
-
feedFooterActions:
|
|
3512
|
+
feedFooterActions: wn(this),
|
|
3406
3513
|
mediaCard: this.options.mediaCard,
|
|
3407
3514
|
reelInfoSheet: this.options.reelInfoSheet,
|
|
3408
3515
|
state: this.state,
|
|
@@ -3465,6 +3572,9 @@ var Yn = class {
|
|
|
3465
3572
|
previousReelPost() {
|
|
3466
3573
|
return this.surface?.moveActiveReelPost(-1) ?? !1;
|
|
3467
3574
|
}
|
|
3575
|
+
navigateToReelItem(e) {
|
|
3576
|
+
return this.surface?.navigateToReelItem(e) ?? "reel-inactive";
|
|
3577
|
+
}
|
|
3468
3578
|
pauseAutoScroll() {
|
|
3469
3579
|
this.autoScroll.setPaused(!0);
|
|
3470
3580
|
}
|
|
@@ -3478,7 +3588,7 @@ var Yn = class {
|
|
|
3478
3588
|
this.autoScroll.setSpeed(e);
|
|
3479
3589
|
}
|
|
3480
3590
|
applyAutofillUpdate(e) {
|
|
3481
|
-
let t =
|
|
3591
|
+
let t = on(this.options.autofill, this.state, e);
|
|
3482
3592
|
return t && this.autofillController.syncCountdown(), t;
|
|
3483
3593
|
}
|
|
3484
3594
|
cancelAutofill() {
|
|
@@ -3491,11 +3601,11 @@ var Yn = class {
|
|
|
3491
3601
|
return this.fillController.cancel();
|
|
3492
3602
|
}
|
|
3493
3603
|
async fill(e) {
|
|
3494
|
-
if (this.pendingRequest ||
|
|
3604
|
+
if (this.pendingRequest || Kt(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
|
|
3495
3605
|
await this.fillController.start(e);
|
|
3496
3606
|
}
|
|
3497
3607
|
restoreAutofillSession(e) {
|
|
3498
|
-
let t =
|
|
3608
|
+
let t = sn(this.options.autofill, this.state, e);
|
|
3499
3609
|
return t && this.autofillController.syncCountdown(), t;
|
|
3500
3610
|
}
|
|
3501
3611
|
restoreFillSession(e) {
|
|
@@ -3503,7 +3613,7 @@ var Yn = class {
|
|
|
3503
3613
|
}
|
|
3504
3614
|
async loadNext() {
|
|
3505
3615
|
if (this.pendingRequest) return this.pendingRequest;
|
|
3506
|
-
if (!this.state.loadMoreLocked && !(
|
|
3616
|
+
if (!this.state.loadMoreLocked && !(Kt(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.state.next, !0);
|
|
3507
3617
|
}
|
|
3508
3618
|
async refresh() {
|
|
3509
3619
|
return this.replaceFeed(this.state.next ?? this.lastLoadedCursor, "refresh");
|
|
@@ -3513,11 +3623,11 @@ var Yn = class {
|
|
|
3513
3623
|
}
|
|
3514
3624
|
async replaceFeed(e, t) {
|
|
3515
3625
|
if (!this.options.loadPage) throw Error(`Vibe cannot ${t} without loadPage.`);
|
|
3516
|
-
return
|
|
3626
|
+
return Kt(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.state.autofill = Gt(this.options.autofill, void 0, !1), this.fillController.reset(), this.reelForward.reset(), this.reelRemoval.reset(), this.exactMediaRemoval.reset(), this.itemRemoval.reset(), this.state.error = null, this.state.isLoading = !0, this.state.items = [], this.state.next = null, this.state.nextPageError = null, this.state.total = null, this.startRequest(e, !1);
|
|
3517
3627
|
}
|
|
3518
3628
|
async retryEnd() {
|
|
3519
3629
|
if (this.pendingRequest) return this.pendingRequest;
|
|
3520
|
-
if (!this.state.loadMoreLocked && !(
|
|
3630
|
+
if (!this.state.loadMoreLocked && !(Kt(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);
|
|
3521
3631
|
}
|
|
3522
3632
|
setInfiniteScroll(e) {
|
|
3523
3633
|
this.state.infiniteScroll = e, e && m(() => this.surface?.loadIfNearBottom());
|
|
@@ -3526,10 +3636,10 @@ var Yn = class {
|
|
|
3526
3636
|
this.state.loadMoreLocked !== e && (this.state.loadMoreLocked = e, !e && this.state.infiniteScroll && m(() => this.surface?.loadIfNearBottom()));
|
|
3527
3637
|
}
|
|
3528
3638
|
setReelAutoAdvance(e) {
|
|
3529
|
-
|
|
3639
|
+
On(this.state.reelAutoAdvance, e);
|
|
3530
3640
|
}
|
|
3531
3641
|
setReelInfoSheet(e) {
|
|
3532
|
-
|
|
3642
|
+
An(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
|
|
3533
3643
|
}
|
|
3534
3644
|
setLayout(e) {
|
|
3535
3645
|
this.responsiveLayout.setLayout(e);
|
|
@@ -3553,7 +3663,7 @@ var Yn = class {
|
|
|
3553
3663
|
this.abortController = i;
|
|
3554
3664
|
try {
|
|
3555
3665
|
if (a?.strategy === "frontend") {
|
|
3556
|
-
let o = await
|
|
3666
|
+
let o = await Yt({
|
|
3557
3667
|
existingItems: t ? this.state.items : [],
|
|
3558
3668
|
initialCursor: e,
|
|
3559
3669
|
loadPage: n,
|
|
@@ -3576,7 +3686,7 @@ var Yn = class {
|
|
|
3576
3686
|
}), this.autofillController.clearCollection();
|
|
3577
3687
|
return;
|
|
3578
3688
|
}
|
|
3579
|
-
let c =
|
|
3689
|
+
let c = jt(await n({
|
|
3580
3690
|
cursor: e,
|
|
3581
3691
|
signal: i.signal
|
|
3582
3692
|
}));
|
|
@@ -3591,7 +3701,7 @@ var Yn = class {
|
|
|
3591
3701
|
this.state.autofill.status = "complete";
|
|
3592
3702
|
return;
|
|
3593
3703
|
}
|
|
3594
|
-
await
|
|
3704
|
+
await rn(a, this.state, {
|
|
3595
3705
|
cycleId: o,
|
|
3596
3706
|
feedKey: a.feedKey,
|
|
3597
3707
|
items: u.slice(l.length),
|
|
@@ -3619,7 +3729,7 @@ var Yn = class {
|
|
|
3619
3729
|
startInitialAutofill() {
|
|
3620
3730
|
let e = ++this.requestVersion, t = new AbortController(), n = this.autofillController.beginCycle();
|
|
3621
3731
|
this.abortController = t, this.state.isLoadingMore = !0;
|
|
3622
|
-
let r =
|
|
3732
|
+
let r = cn({
|
|
3623
3733
|
cycleId: n,
|
|
3624
3734
|
isCurrent: () => e === this.requestVersion,
|
|
3625
3735
|
onCollection: (t) => this.autofillController.captureCollection(t, e === this.requestVersion),
|
|
@@ -3644,8 +3754,8 @@ var Yn = class {
|
|
|
3644
3754
|
}));
|
|
3645
3755
|
}
|
|
3646
3756
|
};
|
|
3647
|
-
function
|
|
3648
|
-
return new
|
|
3757
|
+
function rr(e) {
|
|
3758
|
+
return new nr(e);
|
|
3649
3759
|
}
|
|
3650
3760
|
//#endregion
|
|
3651
|
-
export {
|
|
3761
|
+
export { rr as createVibe };
|