@wyxos/vibe 5.7.1 → 5.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/lib/components/MasonryFeed.vue.d.ts +2 -2
- package/lib/components/MediaCard.vue.d.ts +6 -3
- package/lib/components/MediaError.vue.d.ts +14 -0
- package/lib/components/ReelFeed.vue.d.ts +6 -4
- package/lib/components/ReelLayout.vue.d.ts +5 -3
- package/lib/components/VibeSurface.vue.d.ts +4 -1
- package/lib/components/useMediaCardAudio.d.ts +19 -0
- package/lib/components/useMediaReadiness.d.ts +1 -0
- package/lib/core/feed.d.ts +2 -1
- package/lib/core/mediaCardOptions.d.ts +17 -0
- package/lib/core/mediaPreview.d.ts +10 -0
- package/lib/core/reelAudio.d.ts +3 -0
- package/lib/core/reelAudioController.d.ts +8 -0
- package/lib/index.cjs +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +853 -699
- package/lib/style.css +1 -1
- package/lib/types.d.ts +6 -11
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -71,7 +71,7 @@ var B = {
|
|
|
71
71
|
key: 0,
|
|
72
72
|
class: "load-more-status",
|
|
73
73
|
role: "status"
|
|
74
|
-
},
|
|
74
|
+
}, ee = ["disabled"], H = {
|
|
75
75
|
key: 2,
|
|
76
76
|
class: "end-feed"
|
|
77
77
|
}, U = ["disabled"], W = /* @__PURE__ */ d({
|
|
@@ -97,7 +97,7 @@ var B = {
|
|
|
97
97
|
type: "button",
|
|
98
98
|
disabled: e.loadMoreLocked,
|
|
99
99
|
onClick: i
|
|
100
|
-
}, T(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9,
|
|
100
|
+
}, T(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9, ee)) : (b(), s("div", H, [n[1] ||= c("p", {
|
|
101
101
|
class: "end-feed-message",
|
|
102
102
|
role: "status"
|
|
103
103
|
}, " You've reached the end. ", -1), c("button", {
|
|
@@ -108,7 +108,7 @@ var B = {
|
|
|
108
108
|
onClick: n[0] ||= (e) => t.$emit("retryEnd")
|
|
109
109
|
}, " Check for more ", 8, U)]))])) : o("", !0);
|
|
110
110
|
}
|
|
111
|
-
}),
|
|
111
|
+
}), G = /* @__PURE__ */ d({
|
|
112
112
|
__name: "FeedFooter",
|
|
113
113
|
props: {
|
|
114
114
|
actions: {},
|
|
@@ -164,7 +164,7 @@ var B = {
|
|
|
164
164
|
"show-load-more"
|
|
165
165
|
]));
|
|
166
166
|
}
|
|
167
|
-
}),
|
|
167
|
+
}), K = ["role"], q = { class: "gallery-status" }, te = /* @__PURE__ */ d({
|
|
168
168
|
__name: "FeedStatus",
|
|
169
169
|
props: {
|
|
170
170
|
actions: {},
|
|
@@ -178,7 +178,7 @@ var B = {
|
|
|
178
178
|
return (n, u) => (b(), s("main", {
|
|
179
179
|
class: "gallery-shell",
|
|
180
180
|
role: r.state.error ? "alert" : r.state.isLoading ? "status" : void 0
|
|
181
|
-
}, [c("p",
|
|
181
|
+
}, [c("p", q, [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(G, {
|
|
182
182
|
key: 0,
|
|
183
183
|
actions: t.actions,
|
|
184
184
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -200,32 +200,32 @@ var B = {
|
|
|
200
200
|
"is-loading",
|
|
201
201
|
"load-more-locked",
|
|
202
202
|
"state"
|
|
203
|
-
])) : o("", !0)], 8,
|
|
203
|
+
])) : o("", !0)], 8, K));
|
|
204
204
|
}
|
|
205
205
|
});
|
|
206
|
-
function
|
|
206
|
+
function J(e) {
|
|
207
207
|
return e.scrollHeight - e.scrollTop - e.clientHeight <= 240;
|
|
208
208
|
}
|
|
209
209
|
//#endregion
|
|
210
210
|
//#region src/core/masonry.ts
|
|
211
|
-
function
|
|
211
|
+
function Y(e) {
|
|
212
212
|
let t = e.preview.width ?? e.width, n = e.preview.height ?? e.height;
|
|
213
213
|
return !t || !n || t <= 0 || n <= 0 ? 1 : n / t;
|
|
214
214
|
}
|
|
215
|
-
function
|
|
215
|
+
function ne(e) {
|
|
216
216
|
return e.reduce((t, n, r) => n < e[t] ? r : t, 0);
|
|
217
217
|
}
|
|
218
|
-
function
|
|
218
|
+
function re(e) {
|
|
219
219
|
return Math.max(0, e.containerHeight) + Math.max(0, e.gap);
|
|
220
220
|
}
|
|
221
|
-
function
|
|
221
|
+
function ie(e, t, n) {
|
|
222
222
|
if (t <= 0 || e.length === 0) return {
|
|
223
223
|
columns: 0,
|
|
224
224
|
height: 0,
|
|
225
225
|
items: []
|
|
226
226
|
};
|
|
227
227
|
let r = Math.max(0, n.gap), i = Number.isFinite(n.additionalHeight) ? Math.max(0, n.additionalHeight ?? 0) : 0, a = Math.max(1, n.minColumnWidth), o = Math.max(1, Math.floor((t + r) / (a + r))), s = (t - r * (o - 1)) / o, c = Array.from({ length: o }, () => 0), l = e.map((e) => {
|
|
228
|
-
let t =
|
|
228
|
+
let t = ne(c), n = s * Y(e) + i, a = {
|
|
229
229
|
x: t * (s + r),
|
|
230
230
|
y: c[t],
|
|
231
231
|
width: s,
|
|
@@ -241,7 +241,7 @@ function ae(e, t, n) {
|
|
|
241
241
|
}
|
|
242
242
|
//#endregion
|
|
243
243
|
//#region src/core/masonryViewportIndex.ts
|
|
244
|
-
function
|
|
244
|
+
function ae(e, t) {
|
|
245
245
|
let n = /* @__PURE__ */ new Map();
|
|
246
246
|
return e.forEach((e, r) => {
|
|
247
247
|
let i = n.get(e.x) ?? [];
|
|
@@ -252,7 +252,7 @@ function oe(e, t) {
|
|
|
252
252
|
}), n.set(e.x, i);
|
|
253
253
|
}), { columns: [...n.entries()].sort(([e], [t]) => e - t).map(([, e]) => e.sort((e, t) => e.top - t.top || e.index - t.index)) };
|
|
254
254
|
}
|
|
255
|
-
function
|
|
255
|
+
function X(e, t) {
|
|
256
256
|
let n = 0, r = 0, i = e.length;
|
|
257
257
|
for (; r < i;) {
|
|
258
258
|
let a = Math.floor((r + i) / 2);
|
|
@@ -263,10 +263,10 @@ function Y(e, t) {
|
|
|
263
263
|
inspected: n
|
|
264
264
|
};
|
|
265
265
|
}
|
|
266
|
-
function
|
|
266
|
+
function oe(e, t) {
|
|
267
267
|
let n = Math.max(0, t.overscan), r = t.scrollTop - n, i = t.scrollTop + Math.max(0, t.viewportHeight) + n, a = [], o = 0;
|
|
268
268
|
return e.columns.forEach((e) => {
|
|
269
|
-
let t =
|
|
269
|
+
let t = X(e, r);
|
|
270
270
|
o += t.inspected;
|
|
271
271
|
for (let n = t.index; n < e.length; n += 1) {
|
|
272
272
|
let t = e[n];
|
|
@@ -278,14 +278,14 @@ function X(e, t) {
|
|
|
278
278
|
inspected: o
|
|
279
279
|
};
|
|
280
280
|
}
|
|
281
|
-
function
|
|
281
|
+
function se(e) {
|
|
282
282
|
return e?.minColumnWidth ?? 240;
|
|
283
283
|
}
|
|
284
|
-
function
|
|
284
|
+
function ce(e, t) {
|
|
285
285
|
let n = e?.overscan?.minimumPx ?? 800, r = e?.overscan?.viewportMultiplier ?? 1.5, i = Math.max(n, t * r), a = e?.overscan?.maximumPx;
|
|
286
286
|
return a === void 0 ? i : Math.min(i, a);
|
|
287
287
|
}
|
|
288
|
-
function
|
|
288
|
+
function le(e) {
|
|
289
289
|
if (e?.minColumnWidth !== void 0 && (!Number.isFinite(e.minColumnWidth) || e.minColumnWidth <= 0)) throw TypeError("Vibe masonry minColumnWidth must be a positive number.");
|
|
290
290
|
let t = e?.overscan;
|
|
291
291
|
if (t) {
|
|
@@ -299,7 +299,7 @@ function ce(e) {
|
|
|
299
299
|
}
|
|
300
300
|
//#endregion
|
|
301
301
|
//#region src/core/scrollbar.ts
|
|
302
|
-
function
|
|
302
|
+
function Z(e, t, n) {
|
|
303
303
|
return Math.min(n, Math.max(t, e));
|
|
304
304
|
}
|
|
305
305
|
function ue({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize: r, viewportSize: i }) {
|
|
@@ -311,23 +311,23 @@ function ue({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize:
|
|
|
311
311
|
thumbSize: o,
|
|
312
312
|
thumbTravel: 0
|
|
313
313
|
};
|
|
314
|
-
let l =
|
|
314
|
+
let l = Z(s / a * o, Math.min(Math.max(0, t), o), o), u = Math.max(0, o - l);
|
|
315
315
|
return {
|
|
316
316
|
maximumScrollPosition: c,
|
|
317
317
|
scrollable: !0,
|
|
318
|
-
thumbOffset: u * (
|
|
318
|
+
thumbOffset: u * (Z(n, 0, c) / c),
|
|
319
319
|
thumbSize: l,
|
|
320
320
|
thumbTravel: u
|
|
321
321
|
};
|
|
322
322
|
}
|
|
323
323
|
//#endregion
|
|
324
324
|
//#region src/components/GalleryScrollbar.vue?vue&type=script&setup=true&lang.ts
|
|
325
|
-
var
|
|
325
|
+
var Q = ["aria-hidden"], de = [
|
|
326
326
|
"aria-controls",
|
|
327
327
|
"aria-valuemax",
|
|
328
328
|
"aria-valuenow",
|
|
329
329
|
"tabindex"
|
|
330
|
-
],
|
|
330
|
+
], fe = 32, pe = 40, me = 120, he = /* @__PURE__ */ d({
|
|
331
331
|
__name: "GalleryScrollbar",
|
|
332
332
|
props: {
|
|
333
333
|
contentSize: {},
|
|
@@ -349,7 +349,7 @@ var de = ["aria-hidden"], fe = [
|
|
|
349
349
|
function k() {
|
|
350
350
|
g !== null && clearTimeout(g), g = setTimeout(() => {
|
|
351
351
|
g = null, o.value || (l.value = !1);
|
|
352
|
-
},
|
|
352
|
+
}, me);
|
|
353
353
|
}
|
|
354
354
|
function A() {
|
|
355
355
|
l.value = !0, k();
|
|
@@ -358,7 +358,7 @@ var de = ["aria-hidden"], fe = [
|
|
|
358
358
|
let e = t.scrollElement, r = i.value;
|
|
359
359
|
return !e || !r ? n : ue({
|
|
360
360
|
contentSize: e.scrollHeight,
|
|
361
|
-
minimumThumbSize:
|
|
361
|
+
minimumThumbSize: fe,
|
|
362
362
|
scrollPosition: e.scrollTop,
|
|
363
363
|
trackSize: r.clientHeight,
|
|
364
364
|
viewportSize: e.clientHeight
|
|
@@ -411,7 +411,7 @@ var de = ["aria-hidden"], fe = [
|
|
|
411
411
|
}
|
|
412
412
|
function z(e) {
|
|
413
413
|
if (!E.value) return;
|
|
414
|
-
let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r -
|
|
414
|
+
let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r - pe : e.key === "ArrowDown" ? r + pe : e.key === "PageUp" ? r - n : e.key === "PageDown" ? r + n : e.key === "Home" ? 0 : e.key === "End" ? a.value.maximumScrollPosition : null;
|
|
415
415
|
i !== null && (e.preventDefault(), A(), P(i));
|
|
416
416
|
}
|
|
417
417
|
function B(e) {
|
|
@@ -457,15 +457,15 @@ var de = ["aria-hidden"], fe = [
|
|
|
457
457
|
onPointerdown: I,
|
|
458
458
|
onPointermove: L,
|
|
459
459
|
onPointerup: R
|
|
460
|
-
}, null, 44,
|
|
460
|
+
}, null, 44, de)], 42, Q));
|
|
461
461
|
}
|
|
462
|
-
}),
|
|
462
|
+
}), ge = (e) => {
|
|
463
463
|
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
|
464
464
|
return !1;
|
|
465
|
-
},
|
|
466
|
-
let t =
|
|
465
|
+
}, _e = (e) => e === "", ve = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), ye = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), be = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), xe = (e) => {
|
|
466
|
+
let t = be(e);
|
|
467
467
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
468
|
-
},
|
|
468
|
+
}, Se = {
|
|
469
469
|
xmlns: "http://www.w3.org/2000/svg",
|
|
470
470
|
width: 24,
|
|
471
471
|
height: 24,
|
|
@@ -475,27 +475,27 @@ var de = ["aria-hidden"], fe = [
|
|
|
475
475
|
"stroke-width": 2,
|
|
476
476
|
"stroke-linecap": "round",
|
|
477
477
|
"stroke-linejoin": "round"
|
|
478
|
-
},
|
|
479
|
-
...
|
|
478
|
+
}, Ce = ({ name: e, iconNode: t, absoluteStrokeWidth: n, "absolute-stroke-width": r, strokeWidth: i, "stroke-width": a, size: o = Se.width, color: s = Se.stroke, ...c }, { slots: l }) => p("svg", {
|
|
479
|
+
...Se,
|
|
480
480
|
...c,
|
|
481
481
|
width: o,
|
|
482
482
|
height: o,
|
|
483
483
|
stroke: s,
|
|
484
|
-
"stroke-width":
|
|
485
|
-
class:
|
|
486
|
-
...!l.default && !
|
|
487
|
-
}, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]),
|
|
484
|
+
"stroke-width": _e(n) || _e(r) || n === !0 || r === !0 ? Number(i || a || Se["stroke-width"]) * 24 / Number(o) : i || a || Se["stroke-width"],
|
|
485
|
+
class: ve("lucide", c.class, ...e ? [`lucide-${ye(xe(e))}-icon`, `lucide-${ye(e)}`] : ["lucide-icon"]),
|
|
486
|
+
...!l.default && !ge(c) && { "aria-hidden": "true" }
|
|
487
|
+
}, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]), we = (e, t) => (n, { slots: r, attrs: i }) => p(Ce, {
|
|
488
488
|
...i,
|
|
489
489
|
...n,
|
|
490
490
|
iconNode: t,
|
|
491
491
|
name: e
|
|
492
|
-
}, r),
|
|
492
|
+
}, r), Te = we("chevron-left", [["path", {
|
|
493
493
|
d: "m15 18-6-6 6-6",
|
|
494
494
|
key: "1wnfg3"
|
|
495
|
-
}]]),
|
|
495
|
+
}]]), Ee = we("chevron-right", [["path", {
|
|
496
496
|
d: "m9 18 6-6-6-6",
|
|
497
497
|
key: "mthhwq"
|
|
498
|
-
}]]),
|
|
498
|
+
}]]), De = we("pause", [["rect", {
|
|
499
499
|
x: "14",
|
|
500
500
|
y: "3",
|
|
501
501
|
width: "5",
|
|
@@ -509,10 +509,10 @@ var de = ["aria-hidden"], fe = [
|
|
|
509
509
|
height: "18",
|
|
510
510
|
rx: "1",
|
|
511
511
|
key: "1wsw3u"
|
|
512
|
-
}]]),
|
|
512
|
+
}]]), Oe = we("play", [["path", {
|
|
513
513
|
d: "M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",
|
|
514
514
|
key: "10ikf1"
|
|
515
|
-
}]]),
|
|
515
|
+
}]]), ke = we("volume-2", [
|
|
516
516
|
["path", {
|
|
517
517
|
d: "M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",
|
|
518
518
|
key: "uqj9uw"
|
|
@@ -525,7 +525,7 @@ var de = ["aria-hidden"], fe = [
|
|
|
525
525
|
d: "M19.364 18.364a9 9 0 0 0 0-12.728",
|
|
526
526
|
key: "ijwkga"
|
|
527
527
|
}]
|
|
528
|
-
]),
|
|
528
|
+
]), Ae = we("volume-x", [
|
|
529
529
|
["path", {
|
|
530
530
|
d: "M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",
|
|
531
531
|
key: "uqj9uw"
|
|
@@ -544,22 +544,22 @@ var de = ["aria-hidden"], fe = [
|
|
|
544
544
|
y2: "15",
|
|
545
545
|
key: "5ykzw1"
|
|
546
546
|
}]
|
|
547
|
-
]),
|
|
547
|
+
]), je = {
|
|
548
548
|
401: "Authentication required",
|
|
549
549
|
403: "Access forbidden",
|
|
550
550
|
404: "Preview not found",
|
|
551
551
|
419: "Session expired",
|
|
552
552
|
500: "Server error"
|
|
553
553
|
};
|
|
554
|
-
function
|
|
554
|
+
function Me(e) {
|
|
555
555
|
return e.match(/\/demo-errors\/(401|403|404|419|500)\//)?.[1] ?? "Error";
|
|
556
556
|
}
|
|
557
|
-
function
|
|
558
|
-
return Me
|
|
557
|
+
function Ne(e) {
|
|
558
|
+
return je[Me(e)] ?? "Preview unavailable";
|
|
559
559
|
}
|
|
560
560
|
//#endregion
|
|
561
561
|
//#region src/components/CardRegion.vue
|
|
562
|
-
var
|
|
562
|
+
var Pe = /* @__PURE__ */ d({
|
|
563
563
|
__name: "CardRegion",
|
|
564
564
|
props: {
|
|
565
565
|
index: {},
|
|
@@ -606,18 +606,65 @@ var Fe = /* @__PURE__ */ d({
|
|
|
606
606
|
"total"
|
|
607
607
|
]))], 38));
|
|
608
608
|
}
|
|
609
|
-
}), Ie = [
|
|
609
|
+
}), Fe = ["aria-busy", "aria-label"], Ie = { class: "media-error-code" }, Le = ["disabled"], Re = /* @__PURE__ */ d({
|
|
610
|
+
__name: "MediaError",
|
|
611
|
+
props: {
|
|
612
|
+
component: {},
|
|
613
|
+
label: {},
|
|
614
|
+
retrying: { type: Boolean },
|
|
615
|
+
status: {}
|
|
616
|
+
},
|
|
617
|
+
emits: ["retry"],
|
|
618
|
+
setup(t, { emit: n }) {
|
|
619
|
+
let r = t, i = n;
|
|
620
|
+
function o() {
|
|
621
|
+
r.retrying || i("retry");
|
|
622
|
+
}
|
|
623
|
+
return (n, r) => (b(), s("div", {
|
|
624
|
+
"data-test": "media-error",
|
|
625
|
+
class: "media-error",
|
|
626
|
+
role: "group",
|
|
627
|
+
"aria-busy": t.retrying,
|
|
628
|
+
"aria-label": `${t.status} ${t.label}`
|
|
629
|
+
}, [t.component ? (b(), s("div", {
|
|
630
|
+
key: 0,
|
|
631
|
+
class: "media-error-component",
|
|
632
|
+
onClick: r[0] ||= j(() => {}, ["stop"]),
|
|
633
|
+
onKeydown: r[1] ||= j(() => {}, ["stop"])
|
|
634
|
+
}, [(b(), a(C(t.component), {
|
|
635
|
+
label: t.label,
|
|
636
|
+
retry: o,
|
|
637
|
+
retrying: t.retrying,
|
|
638
|
+
status: t.status
|
|
639
|
+
}, null, 8, [
|
|
640
|
+
"label",
|
|
641
|
+
"retrying",
|
|
642
|
+
"status"
|
|
643
|
+
]))], 32)) : (b(), s(e, { key: 1 }, [
|
|
644
|
+
c("strong", Ie, T(t.status), 1),
|
|
645
|
+
c("span", null, T(t.label), 1),
|
|
646
|
+
c("button", {
|
|
647
|
+
"data-test": "media-retry",
|
|
648
|
+
class: "media-error-retry",
|
|
649
|
+
type: "button",
|
|
650
|
+
disabled: t.retrying,
|
|
651
|
+
onClick: j(o, ["stop"]),
|
|
652
|
+
onKeydown: r[2] ||= j(() => {}, ["stop"])
|
|
653
|
+
}, T(t.retrying ? "Retrying…" : "Retry"), 41, Le)
|
|
654
|
+
], 64))], 8, Fe));
|
|
655
|
+
}
|
|
656
|
+
}), ze = [
|
|
610
657
|
"max",
|
|
611
658
|
"value",
|
|
612
659
|
"aria-valuetext",
|
|
613
660
|
"disabled"
|
|
614
|
-
],
|
|
661
|
+
], Be = {
|
|
615
662
|
key: 0,
|
|
616
663
|
class: "media-controls-row"
|
|
617
|
-
},
|
|
664
|
+
}, Ve = ["aria-label", "title"], He = { class: "media-controls-audio" }, Ue = ["aria-label", "title"], We = ["value", "aria-valuetext"], Ge = {
|
|
618
665
|
class: "media-control-time",
|
|
619
666
|
"aria-live": "off"
|
|
620
|
-
},
|
|
667
|
+
}, Ke = /* @__PURE__ */ d({
|
|
621
668
|
__name: "MediaControls",
|
|
622
669
|
props: {
|
|
623
670
|
currentTime: {},
|
|
@@ -665,35 +712,35 @@ var Fe = /* @__PURE__ */ d({
|
|
|
665
712
|
"aria-valuetext": `${u(p.value)} of ${u(f.value)}`,
|
|
666
713
|
disabled: f.value <= 0,
|
|
667
714
|
onInput: n[0] ||= (e) => i("seek", d(e))
|
|
668
|
-
}, null, 44,
|
|
715
|
+
}, null, 44, ze), e.layout === "reel" ? (b(), s("div", Be, [
|
|
669
716
|
c("button", {
|
|
670
717
|
type: "button",
|
|
671
718
|
class: "media-control-button media-control-playback",
|
|
672
719
|
"aria-label": e.playing ? "Pause video" : "Play video",
|
|
673
720
|
title: e.playing ? "Pause" : "Play",
|
|
674
721
|
onClick: n[1] ||= (e) => i("togglePlayback")
|
|
675
|
-
}, [e.playing ? (b(), a(E(
|
|
722
|
+
}, [e.playing ? (b(), a(E(De), {
|
|
676
723
|
key: 0,
|
|
677
724
|
size: 18,
|
|
678
725
|
fill: "currentColor"
|
|
679
|
-
})) : (b(), a(E(
|
|
726
|
+
})) : (b(), a(E(Oe), {
|
|
680
727
|
key: 1,
|
|
681
728
|
size: 18,
|
|
682
729
|
fill: "currentColor"
|
|
683
|
-
}))], 8,
|
|
684
|
-
c("div",
|
|
730
|
+
}))], 8, Ve),
|
|
731
|
+
c("div", He, [c("button", {
|
|
685
732
|
type: "button",
|
|
686
733
|
class: "media-control-button",
|
|
687
734
|
"aria-label": e.muted ? "Unmute video" : "Mute video",
|
|
688
735
|
title: e.muted ? "Unmute" : "Mute",
|
|
689
736
|
onClick: n[2] ||= (e) => i("toggleMute")
|
|
690
|
-
}, [e.muted || e.volume === 0 ? (b(), a(E(
|
|
737
|
+
}, [e.muted || e.volume === 0 ? (b(), a(E(Ae), {
|
|
691
738
|
key: 0,
|
|
692
739
|
size: 18
|
|
693
|
-
})) : (b(), a(E(
|
|
740
|
+
})) : (b(), a(E(ke), {
|
|
694
741
|
key: 1,
|
|
695
742
|
size: 18
|
|
696
|
-
}))], 8,
|
|
743
|
+
}))], 8, Ue), c("input", {
|
|
697
744
|
class: "media-control-range media-control-volume",
|
|
698
745
|
type: "range",
|
|
699
746
|
min: "0",
|
|
@@ -704,14 +751,77 @@ var Fe = /* @__PURE__ */ d({
|
|
|
704
751
|
"aria-label": "Video volume",
|
|
705
752
|
"aria-valuetext": `${Math.round(e.volume * 100)} percent`,
|
|
706
753
|
onInput: n[3] ||= (e) => i("volumeChange", d(e))
|
|
707
|
-
}, null, 44,
|
|
708
|
-
c("output",
|
|
754
|
+
}, null, 44, We)]),
|
|
755
|
+
c("output", Ge, T(u(p.value)) + " / " + T(u(f.value)), 1)
|
|
709
756
|
])) : o("", !0)], 34));
|
|
710
757
|
}
|
|
711
|
-
})
|
|
758
|
+
}), qe = {
|
|
759
|
+
lastAudibleVolume: 1,
|
|
760
|
+
muted: !1,
|
|
761
|
+
volume: 1
|
|
762
|
+
};
|
|
763
|
+
function Je(e, t) {
|
|
764
|
+
return typeof e == "number" && Number.isFinite(e) ? Math.min(1, Math.max(0, e)) : t;
|
|
765
|
+
}
|
|
766
|
+
function Ye(e, t = qe) {
|
|
767
|
+
let n = Je(e?.volume, t.volume), r = Je(e?.lastAudibleVolume, n > 0 ? n : t.lastAudibleVolume);
|
|
768
|
+
return {
|
|
769
|
+
lastAudibleVolume: r > 0 ? r : qe.lastAudibleVolume,
|
|
770
|
+
muted: typeof e?.muted == "boolean" ? e.muted : n === 0 || t.muted,
|
|
771
|
+
volume: n
|
|
772
|
+
};
|
|
773
|
+
}
|
|
774
|
+
//#endregion
|
|
775
|
+
//#region src/components/useMediaCardAudio.ts
|
|
776
|
+
function Xe(e) {
|
|
777
|
+
let t = Ye(e.reelAudioState()), n = e.layout() === "reel" && e.reelAudioState(), r = w(n ? t.muted : e.mediaCard()?.videoMuted ?? e.layout() === "masonry"), i = w(n ? t.volume : 1), a = n ? t.lastAudibleVolume : 1;
|
|
778
|
+
function o() {
|
|
779
|
+
let t = e.videoElement.value, n = e.reelAudioState();
|
|
780
|
+
if (!t || e.layout() !== "reel" || !n) return;
|
|
781
|
+
let o = Ye(n);
|
|
782
|
+
a = o.lastAudibleVolume, i.value = o.volume, r.value = o.muted, t.volume = o.volume, t.muted = e.active() === !1 ? !0 : o.muted;
|
|
783
|
+
}
|
|
784
|
+
function s(e, t) {
|
|
785
|
+
t && (r.value = e.muted), i.value = e.volume, e.volume > 0 && (a = e.volume);
|
|
786
|
+
}
|
|
787
|
+
function c(t) {
|
|
788
|
+
if (e.layout() !== "reel") return;
|
|
789
|
+
let n = Ye({
|
|
790
|
+
lastAudibleVolume: a,
|
|
791
|
+
muted: t.muted,
|
|
792
|
+
volume: t.volume
|
|
793
|
+
});
|
|
794
|
+
r.value = n.muted, i.value = n.volume, a = n.lastAudibleVolume, e.onChange(n);
|
|
795
|
+
}
|
|
796
|
+
function l(t) {
|
|
797
|
+
let n = e.videoElement.value;
|
|
798
|
+
if (!n || !Number.isFinite(t)) return;
|
|
799
|
+
let r = Math.min(1, Math.max(0, t));
|
|
800
|
+
n.volume = r, n.muted = r === 0, r > 0 && (a = r), s(n, !0), c(n);
|
|
801
|
+
}
|
|
802
|
+
function u() {
|
|
803
|
+
let t = e.videoElement.value;
|
|
804
|
+
t && (t.muted && t.volume === 0 && (t.volume = a), t.muted = !t.muted, s(t, !0), c(t));
|
|
805
|
+
}
|
|
806
|
+
return O([
|
|
807
|
+
e.active,
|
|
808
|
+
e.layout,
|
|
809
|
+
() => e.reelAudioState()?.lastAudibleVolume,
|
|
810
|
+
() => e.reelAudioState()?.muted,
|
|
811
|
+
() => e.reelAudioState()?.volume,
|
|
812
|
+
e.videoElement
|
|
813
|
+
], o, { immediate: !0 }), {
|
|
814
|
+
apply: o,
|
|
815
|
+
setVolume: l,
|
|
816
|
+
sync: s,
|
|
817
|
+
toggleMute: u,
|
|
818
|
+
videoIsMuted: r,
|
|
819
|
+
videoVolume: i
|
|
820
|
+
};
|
|
821
|
+
}
|
|
712
822
|
//#endregion
|
|
713
823
|
//#region src/components/useReelVideoActivity.ts
|
|
714
|
-
function
|
|
824
|
+
function Ze(e) {
|
|
715
825
|
let t = r(() => e.layout() !== "reel" || e.active() === !0), n = r(() => t.value ? e.videoIsMuted.value : !0);
|
|
716
826
|
function i() {
|
|
717
827
|
if (!t.value) {
|
|
@@ -745,21 +855,21 @@ function We(e) {
|
|
|
745
855
|
}
|
|
746
856
|
//#endregion
|
|
747
857
|
//#region src/core/mediaType.ts
|
|
748
|
-
var
|
|
749
|
-
function
|
|
858
|
+
var Qe = /\.(aac|flac|m4a|mp3|mp4|mov|ogg|opus|wav|webm)$/i;
|
|
859
|
+
function $e(e) {
|
|
750
860
|
try {
|
|
751
|
-
return
|
|
861
|
+
return Qe.test(new URL(e).pathname);
|
|
752
862
|
} catch {
|
|
753
|
-
return
|
|
863
|
+
return Qe.test(e.split("?")[0] ?? e);
|
|
754
864
|
}
|
|
755
865
|
}
|
|
756
|
-
function
|
|
757
|
-
return e === void 0 ?
|
|
866
|
+
function et(e, t) {
|
|
867
|
+
return e === void 0 ? $e(t) : e === "video";
|
|
758
868
|
}
|
|
759
869
|
//#endregion
|
|
760
870
|
//#region src/components/useMediaLoading.ts
|
|
761
|
-
function
|
|
762
|
-
let t = r(() =>
|
|
871
|
+
function tt(e) {
|
|
872
|
+
let t = r(() => et(e.mediaType(), e.mediaSource())), n = r(() => e.layout() === "masonry" && e.fetchPriority() === "low" ? "lazy" : "eager"), i = r(() => e.layout() === "reel" && !e.active() ? "none" : e.fetchPriority() === "high" ? "auto" : e.layout() === "masonry" ? "none" : "metadata");
|
|
763
873
|
return O(i, (t, n) => {
|
|
764
874
|
n !== "none" || t === "none" || m(() => e.videoElement.value?.load());
|
|
765
875
|
}), {
|
|
@@ -770,64 +880,65 @@ function Je(e) {
|
|
|
770
880
|
}
|
|
771
881
|
//#endregion
|
|
772
882
|
//#region src/components/useMediaReadiness.ts
|
|
773
|
-
function
|
|
774
|
-
let t = w(null), n = w(null), i = w(0), a = w(0), o = w(!0), s = w(!1), c =
|
|
775
|
-
function
|
|
776
|
-
|
|
883
|
+
function nt(e) {
|
|
884
|
+
let t = w(null), n = w(null), i = w(0), a = w(0), o = w(!0), s = w(!1), c = w(!1), l = null, u = !1, d = r(() => c.value || s.value ? "error" : o.value ? "loading" : e.previewState());
|
|
885
|
+
function f() {
|
|
886
|
+
l !== null && clearTimeout(l), l = null;
|
|
777
887
|
}
|
|
778
|
-
function
|
|
888
|
+
function p(e) {
|
|
779
889
|
return Number(e.currentTarget.dataset.sourceGeneration) === i.value;
|
|
780
890
|
}
|
|
781
|
-
function
|
|
782
|
-
|
|
891
|
+
function h() {
|
|
892
|
+
f(), l = setTimeout(() => y(), 15e3);
|
|
783
893
|
}
|
|
784
|
-
function
|
|
785
|
-
t && !
|
|
894
|
+
function g(t) {
|
|
895
|
+
t && !p(t) || (f(), o.value = !1, s.value = !1, c.value = !1, e.onReady(e.mediaIndex()));
|
|
786
896
|
}
|
|
787
|
-
function
|
|
897
|
+
function _() {
|
|
788
898
|
let e = t.value;
|
|
789
899
|
if (e?.complete) {
|
|
790
|
-
e.naturalWidth > 0 ?
|
|
900
|
+
e.naturalWidth > 0 ? g() : y();
|
|
791
901
|
return;
|
|
792
902
|
}
|
|
793
903
|
let r = n.value;
|
|
794
904
|
if (r && r.readyState >= HTMLMediaElement.HAVE_METADATA) {
|
|
795
|
-
|
|
905
|
+
g();
|
|
796
906
|
return;
|
|
797
907
|
}
|
|
798
|
-
|
|
908
|
+
h();
|
|
799
909
|
}
|
|
800
|
-
function
|
|
801
|
-
if (!(t && !
|
|
802
|
-
if (
|
|
803
|
-
a.value = 1, i.value += 1, o.value = !0, m(
|
|
910
|
+
function y(t) {
|
|
911
|
+
if (!(t && !p(t))) {
|
|
912
|
+
if (f(), !t && a.value === 0) {
|
|
913
|
+
a.value = 1, i.value += 1, o.value = !0, m(_);
|
|
804
914
|
return;
|
|
805
915
|
}
|
|
806
|
-
o.value = !1, s.value = !0, e.onError(e.mediaIndex());
|
|
916
|
+
o.value = !1, s.value = !0, c.value = !1, e.onError(e.mediaIndex());
|
|
807
917
|
}
|
|
808
918
|
}
|
|
809
|
-
function
|
|
810
|
-
a.value = 0, s.value = !
|
|
919
|
+
function b() {
|
|
920
|
+
c.value || d.value !== "error" || (a.value = 0, s.value = !0, o.value = !0, c.value = !0, i.value += 1, m(_));
|
|
811
921
|
}
|
|
812
|
-
function
|
|
813
|
-
|
|
922
|
+
function x(e) {
|
|
923
|
+
p(e) && o.value && h();
|
|
814
924
|
}
|
|
815
925
|
return O(e.identity, () => {
|
|
816
|
-
|
|
817
|
-
}, { immediate: !0 }), v(
|
|
818
|
-
effectivePreviewState:
|
|
819
|
-
failSourceAttempt:
|
|
926
|
+
f(), i.value += 1, a.value = 0, o.value = u || e.previewState() === "loading", s.value = !1, c.value = !1, u = !0, m(_);
|
|
927
|
+
}, { immediate: !0 }), v(f), {
|
|
928
|
+
effectivePreviewState: d,
|
|
929
|
+
failSourceAttempt: y,
|
|
820
930
|
imageElement: t,
|
|
821
|
-
markSourceReady:
|
|
822
|
-
noteSourceActivity:
|
|
823
|
-
retrySource:
|
|
931
|
+
markSourceReady: g,
|
|
932
|
+
noteSourceActivity: x,
|
|
933
|
+
retrySource: b,
|
|
934
|
+
retrying: c,
|
|
824
935
|
sourceGeneration: i,
|
|
825
936
|
videoElement: n
|
|
826
937
|
};
|
|
827
938
|
}
|
|
828
939
|
//#endregion
|
|
829
940
|
//#region src/components/MediaCard.vue?vue&type=script&setup=true&lang.ts
|
|
830
|
-
var
|
|
941
|
+
var rt = [
|
|
831
942
|
"data-post-id",
|
|
832
943
|
"data-media-index",
|
|
833
944
|
"aria-hidden",
|
|
@@ -835,12 +946,12 @@ var Xe = [
|
|
|
835
946
|
"inert",
|
|
836
947
|
"role",
|
|
837
948
|
"tabindex"
|
|
838
|
-
],
|
|
949
|
+
], it = { class: "media-card-content" }, at = ["data-media-direction"], ot = ["data-media-index"], st = {
|
|
839
950
|
key: 0,
|
|
840
951
|
"data-test": "media-loading",
|
|
841
952
|
class: "media-loading",
|
|
842
953
|
"aria-hidden": "true"
|
|
843
|
-
},
|
|
954
|
+
}, ct = [
|
|
844
955
|
"data-source-generation",
|
|
845
956
|
"src",
|
|
846
957
|
"width",
|
|
@@ -849,14 +960,14 @@ var Xe = [
|
|
|
849
960
|
"loop",
|
|
850
961
|
"muted",
|
|
851
962
|
"preload"
|
|
852
|
-
],
|
|
963
|
+
], lt = [
|
|
853
964
|
"data-source-generation",
|
|
854
965
|
"src",
|
|
855
966
|
"width",
|
|
856
967
|
"height",
|
|
857
968
|
"fetchpriority",
|
|
858
969
|
"loading"
|
|
859
|
-
],
|
|
970
|
+
], ut = ["aria-label"], dt = ["aria-label"], ft = ["aria-label"], pt = 40, mt = 160, ht = 24, gt = /* @__PURE__ */ d({
|
|
860
971
|
__name: "MediaCard",
|
|
861
972
|
props: {
|
|
862
973
|
active: { type: Boolean },
|
|
@@ -877,6 +988,7 @@ var Xe = [
|
|
|
877
988
|
mediaSource: {},
|
|
878
989
|
previewState: {},
|
|
879
990
|
reelControlsTarget: {},
|
|
991
|
+
reelAudioState: {},
|
|
880
992
|
stationaryReelControls: { type: Boolean },
|
|
881
993
|
total: {}
|
|
882
994
|
},
|
|
@@ -885,137 +997,135 @@ var Xe = [
|
|
|
885
997
|
"ended",
|
|
886
998
|
"error",
|
|
887
999
|
"mediaChange",
|
|
888
|
-
"ready"
|
|
1000
|
+
"ready",
|
|
1001
|
+
"reelAudioChange"
|
|
889
1002
|
],
|
|
890
1003
|
setup(e, { emit: i }) {
|
|
891
1004
|
let l = e, d = null, f = 0, p = !1, m = null, g = null, y = w("next"), x = i;
|
|
892
1005
|
function S(e = !1, t = "pointer") {
|
|
893
1006
|
e && x("activate", t);
|
|
894
1007
|
}
|
|
895
|
-
let C = r(() => P(l.item)),
|
|
896
|
-
identity: () => `${l.item.postId}:${
|
|
897
|
-
mediaIndex: () =>
|
|
1008
|
+
let C = r(() => P(l.item)), T = r(() => F(l.item, l.mediaIndex)), D = r(() => I(l.item, T.value)), O = r(() => N(D.value, l.mediaSource ?? "preview")), M = r(() => O.value.src), L = r(() => O.value.type), R = r(() => O.value.width), z = r(() => O.value.height), { effectivePreviewState: B, failSourceAttempt: V, imageElement: ee, markSourceReady: H, noteSourceActivity: U, retrySource: W, retrying: G, sourceGeneration: K, videoElement: q } = nt({
|
|
1009
|
+
identity: () => `${l.item.postId}:${T.value}:${l.mediaSource ?? "preview"}:${M.value}:${L.value ?? ""}`,
|
|
1010
|
+
mediaIndex: () => T.value,
|
|
898
1011
|
onError: (e) => x("error", e),
|
|
899
1012
|
onReady: (e) => x("ready", e),
|
|
900
1013
|
previewState: () => l.previewState
|
|
901
|
-
}),
|
|
1014
|
+
}), te = w(0), J = w(0), Y = w(!1), { apply: ne, setVolume: re, sync: ie, toggleMute: ae, videoIsMuted: X, videoVolume: oe } = Xe({
|
|
902
1015
|
active: () => l.active,
|
|
903
1016
|
layout: () => l.layout,
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
1017
|
+
mediaCard: () => l.mediaCard,
|
|
1018
|
+
onChange: (e) => x("reelAudioChange", e),
|
|
1019
|
+
reelAudioState: () => l.reelAudioState,
|
|
1020
|
+
videoElement: q
|
|
1021
|
+
}), { effectiveMuted: se, onPlaying: ce, playbackAllowed: le } = Ze({
|
|
1022
|
+
active: () => l.active,
|
|
1023
|
+
layout: () => l.layout,
|
|
1024
|
+
videoElement: q,
|
|
1025
|
+
videoIsMuted: X,
|
|
1026
|
+
videoIsPlaying: Y
|
|
907
1027
|
}), Z = r(() => l.interactive && !!(l.cardHeader || l.cardFooter));
|
|
908
|
-
function
|
|
1028
|
+
function ue(e) {
|
|
909
1029
|
return e.detail === 0 ? "keyboard" : "pointer";
|
|
910
1030
|
}
|
|
911
|
-
function
|
|
1031
|
+
function Q(e, t) {
|
|
912
1032
|
let n = C.value.length, r = (e + n) % n;
|
|
913
|
-
r !==
|
|
1033
|
+
r !== T.value && (y.value = e < T.value ? "previous" : "next", x("mediaChange", r), t && t.detail > 0 && t.currentTarget?.blur());
|
|
914
1034
|
}
|
|
915
|
-
function
|
|
1035
|
+
function de(e, t, n) {
|
|
916
1036
|
return t === 1 ? e * 16 : t === 2 ? e * n : e;
|
|
917
1037
|
}
|
|
918
|
-
function
|
|
1038
|
+
function fe() {
|
|
919
1039
|
f = 0, p = !1, d !== null && clearTimeout(d), d = null;
|
|
920
1040
|
}
|
|
921
|
-
function
|
|
922
|
-
d !== null && clearTimeout(d), d = setTimeout(
|
|
1041
|
+
function pe() {
|
|
1042
|
+
d !== null && clearTimeout(d), d = setTimeout(fe, mt);
|
|
923
1043
|
}
|
|
924
|
-
function
|
|
1044
|
+
function me(e) {
|
|
925
1045
|
if (C.value.length <= 1) return;
|
|
926
|
-
let t = e.currentTarget?.clientWidth || 1, n =
|
|
927
|
-
if (n === 0 || (e.preventDefault(),
|
|
1046
|
+
let t = e.currentTarget?.clientWidth || 1, n = de(e.deltaX, e.deltaMode, t);
|
|
1047
|
+
if (n === 0 || (e.preventDefault(), pe(), p) || (f += n, Math.abs(f) < ht)) return;
|
|
928
1048
|
let r = Math.sign(f);
|
|
929
|
-
f = 0, p = !0,
|
|
1049
|
+
f = 0, p = !0, Q(T.value + r);
|
|
930
1050
|
}
|
|
931
|
-
function
|
|
1051
|
+
function he(e) {
|
|
932
1052
|
let t = e.touches[0];
|
|
933
1053
|
l.layout !== "reel" || !t || (m = t.clientX, g = t.clientY);
|
|
934
1054
|
}
|
|
935
|
-
function
|
|
1055
|
+
function ge(e) {
|
|
936
1056
|
let t = e.changedTouches[0];
|
|
937
1057
|
if (m === null || g === null || !t) return;
|
|
938
1058
|
let n = m - t.clientX, r = g - t.clientY;
|
|
939
|
-
m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) <
|
|
1059
|
+
m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) < pt || Q(T.value + Math.sign(n)));
|
|
940
1060
|
}
|
|
941
|
-
let { imageLoading:
|
|
1061
|
+
let { imageLoading: _e, mediaIsTimed: ve, videoPreload: ye } = tt({
|
|
942
1062
|
active: () => l.active,
|
|
943
1063
|
fetchPriority: () => l.fetchPriority,
|
|
944
1064
|
layout: () => l.layout,
|
|
945
|
-
mediaSource: () =>
|
|
946
|
-
mediaType: () =>
|
|
947
|
-
videoElement:
|
|
948
|
-
}),
|
|
949
|
-
function
|
|
950
|
-
l.layout === "reel" && (e.stopPropagation(),
|
|
1065
|
+
mediaSource: () => M.value,
|
|
1066
|
+
mediaType: () => L.value,
|
|
1067
|
+
videoElement: q
|
|
1068
|
+
}), be = r(() => l.layout === "reel" && l.stationaryReelControls === !0), xe = r(() => ve.value && B.value === "ready" && (!be.value || !!(l.active && l.reelControlsTarget))), Se = r(() => `${l.item.postId}:${T.value}:${M.value}`);
|
|
1069
|
+
function Ce(e) {
|
|
1070
|
+
l.layout === "reel" && (e.stopPropagation(), we());
|
|
951
1071
|
}
|
|
952
|
-
async function
|
|
953
|
-
if (!(!
|
|
954
|
-
if (
|
|
955
|
-
|
|
1072
|
+
async function we() {
|
|
1073
|
+
if (!(!q.value || !le.value)) {
|
|
1074
|
+
if (Y.value) {
|
|
1075
|
+
q.value.pause();
|
|
956
1076
|
return;
|
|
957
1077
|
}
|
|
958
1078
|
try {
|
|
959
|
-
await
|
|
1079
|
+
await q.value.play();
|
|
960
1080
|
} catch {
|
|
961
|
-
|
|
1081
|
+
Y.value = !1;
|
|
962
1082
|
}
|
|
963
1083
|
}
|
|
964
1084
|
}
|
|
965
|
-
function
|
|
1085
|
+
function De(e) {
|
|
966
1086
|
return Number.isFinite(e) ? Math.max(0, e) : 0;
|
|
967
1087
|
}
|
|
968
|
-
function
|
|
969
|
-
let t = e?.currentTarget ??
|
|
970
|
-
t && (
|
|
971
|
-
}
|
|
972
|
-
function Te(e) {
|
|
973
|
-
we(e), U(e);
|
|
974
|
-
}
|
|
975
|
-
function Oe() {
|
|
976
|
-
J.value = !1, x("ended", D.value);
|
|
1088
|
+
function Oe(e) {
|
|
1089
|
+
let t = e?.currentTarget ?? q.value;
|
|
1090
|
+
t && (te.value = De(t.currentTime), J.value = De(t.duration), ie(t, le.value));
|
|
977
1091
|
}
|
|
978
1092
|
function ke(e) {
|
|
979
|
-
|
|
980
|
-
!t || !Number.isFinite(e) || (t.currentTime = Math.min(Ce(t.duration), Math.max(0, e)), ne.value = t.currentTime);
|
|
1093
|
+
ne(), Oe(e), H(e);
|
|
981
1094
|
}
|
|
982
|
-
function Ae(
|
|
983
|
-
|
|
984
|
-
if (!t || !Number.isFinite(e)) return;
|
|
985
|
-
let n = Math.min(1, Math.max(0, e));
|
|
986
|
-
t.volume = n, t.muted = n === 0, n > 0 && (ae = n), we();
|
|
1095
|
+
function Ae() {
|
|
1096
|
+
Y.value = !1, x("ended", T.value);
|
|
987
1097
|
}
|
|
988
|
-
function je() {
|
|
989
|
-
let
|
|
990
|
-
|
|
1098
|
+
function je(e) {
|
|
1099
|
+
let t = q.value;
|
|
1100
|
+
!t || !Number.isFinite(e) || (t.currentTime = Math.min(De(t.duration), Math.max(0, e)), te.value = t.currentTime);
|
|
991
1101
|
}
|
|
992
1102
|
return v(() => {
|
|
993
|
-
|
|
1103
|
+
fe();
|
|
994
1104
|
}), (r, i) => (b(), s("article", {
|
|
995
1105
|
"data-post-id": e.item.postId,
|
|
996
|
-
"data-media-index":
|
|
1106
|
+
"data-media-index": T.value,
|
|
997
1107
|
class: h(["media-card", {
|
|
998
1108
|
"media-card--entering": e.entering,
|
|
999
1109
|
"media-card--leaving": e.leaving,
|
|
1000
|
-
"media-card--error": E(
|
|
1110
|
+
"media-card--error": E(B) === "error",
|
|
1001
1111
|
"media-card--transparent-chrome": e.mediaCard?.header?.background === "transparent" || e.mediaCard?.footer?.background === "transparent" || e.cardHeader?.background === "transparent" || e.cardFooter?.background === "transparent"
|
|
1002
1112
|
}]),
|
|
1003
1113
|
style: _(e.itemStyle),
|
|
1004
1114
|
"aria-hidden": e.leaving || void 0,
|
|
1005
|
-
"aria-busy": E(
|
|
1115
|
+
"aria-busy": E(B) === "loading" || E(G),
|
|
1006
1116
|
inert: e.leaving || void 0,
|
|
1007
1117
|
role: e.interactive && !e.leaving && !Z.value ? "button" : void 0,
|
|
1008
1118
|
tabindex: e.interactive && !e.leaving && !Z.value ? 0 : void 0,
|
|
1009
|
-
onClick: i[
|
|
1010
|
-
onKeydown: [i[
|
|
1011
|
-
}, [c("div",
|
|
1012
|
-
e.cardHeader ? (b(), a(
|
|
1119
|
+
onClick: i[14] ||= (t) => S(e.interactive && !Z.value, ue(t)),
|
|
1120
|
+
onKeydown: [i[15] ||= A((t) => S(e.interactive && !Z.value, "keyboard"), ["enter"]), i[16] ||= A(j((t) => S(e.interactive && !Z.value, "keyboard"), ["prevent"]), ["space"])]
|
|
1121
|
+
}, [c("div", it, [
|
|
1122
|
+
e.cardHeader ? (b(), a(Pe, {
|
|
1013
1123
|
key: 0,
|
|
1014
1124
|
index: e.index,
|
|
1015
1125
|
item: e.item,
|
|
1016
1126
|
layout: e.layout,
|
|
1017
1127
|
"loaded-count": e.loadedCount,
|
|
1018
|
-
"media-index":
|
|
1128
|
+
"media-index": T.value,
|
|
1019
1129
|
"media-source": e.mediaSource,
|
|
1020
1130
|
placement: "header",
|
|
1021
1131
|
region: e.cardHeader,
|
|
@@ -1035,96 +1145,98 @@ var Xe = [
|
|
|
1035
1145
|
c("div", {
|
|
1036
1146
|
class: h(["media-card-media", { "media-card-media--carousel": e.layout === "reel" && C.value.length > 1 }]),
|
|
1037
1147
|
"data-media-direction": y.value,
|
|
1038
|
-
onWheel:
|
|
1039
|
-
onTouchstartPassive:
|
|
1040
|
-
onTouchendPassive:
|
|
1148
|
+
onWheel: me,
|
|
1149
|
+
onTouchstartPassive: he,
|
|
1150
|
+
onTouchendPassive: ge
|
|
1041
1151
|
}, [
|
|
1042
|
-
u(n, {
|
|
1152
|
+
u(n, {
|
|
1153
|
+
css: !E(G),
|
|
1154
|
+
name: `media-slide-${y.value}`
|
|
1155
|
+
}, {
|
|
1043
1156
|
default: k(() => [(b(), s("div", {
|
|
1044
|
-
key: `${e.item.postId}:${
|
|
1157
|
+
key: `${e.item.postId}:${D.value.src}:${e.mediaSource ?? "preview"}:${E(K)}`,
|
|
1045
1158
|
class: "media-card-frame",
|
|
1046
|
-
"data-media-index":
|
|
1047
|
-
}, [E(
|
|
1159
|
+
"data-media-index": T.value
|
|
1160
|
+
}, [E(B) === "loading" ? (b(), s("div", st, [...i[17] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : E(B) === "error" ? (b(), a(Re, {
|
|
1048
1161
|
key: 1,
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
], 8, tt)) : o("", !0), E(ge) ? (b(), s("video", {
|
|
1162
|
+
component: e.mediaCard?.error?.component,
|
|
1163
|
+
label: E(Ne)(M.value),
|
|
1164
|
+
retrying: E(G),
|
|
1165
|
+
status: E(Me)(M.value),
|
|
1166
|
+
onRetry: E(W)
|
|
1167
|
+
}, null, 8, [
|
|
1168
|
+
"component",
|
|
1169
|
+
"label",
|
|
1170
|
+
"retrying",
|
|
1171
|
+
"status",
|
|
1172
|
+
"onRetry"
|
|
1173
|
+
])) : o("", !0), E(ve) ? (b(), s("video", {
|
|
1062
1174
|
key: 2,
|
|
1063
1175
|
ref_key: "videoElement",
|
|
1064
|
-
ref:
|
|
1065
|
-
"data-source-generation": E(
|
|
1176
|
+
ref: q,
|
|
1177
|
+
"data-source-generation": E(K),
|
|
1066
1178
|
class: h(["media-preview", {
|
|
1067
|
-
"media-preview--ready": E(
|
|
1179
|
+
"media-preview--ready": E(B) === "ready",
|
|
1068
1180
|
"media-preview--reel-video": e.layout === "reel"
|
|
1069
1181
|
}]),
|
|
1070
|
-
src:
|
|
1071
|
-
width:
|
|
1072
|
-
height:
|
|
1073
|
-
autoplay: E(
|
|
1182
|
+
src: M.value,
|
|
1183
|
+
width: R.value ?? void 0,
|
|
1184
|
+
height: z.value ?? void 0,
|
|
1185
|
+
autoplay: E(le),
|
|
1074
1186
|
loop: !e.advanceOnMediaEnd,
|
|
1075
|
-
muted: E(
|
|
1187
|
+
muted: E(se),
|
|
1076
1188
|
playsinline: "",
|
|
1077
|
-
preload: E(
|
|
1078
|
-
onLoadedmetadata:
|
|
1079
|
-
onProgress: i[
|
|
1080
|
-
onLoadeddata: i[
|
|
1081
|
-
onCanplay: i[
|
|
1082
|
-
onDurationchange:
|
|
1083
|
-
onTimeupdate:
|
|
1084
|
-
onVolumechange:
|
|
1085
|
-
onPlaying: i[
|
|
1086
|
-
onPause: i[
|
|
1087
|
-
onEnded:
|
|
1088
|
-
onClick:
|
|
1089
|
-
onError: i[
|
|
1090
|
-
}, null, 42,
|
|
1189
|
+
preload: E(ye),
|
|
1190
|
+
onLoadedmetadata: ke,
|
|
1191
|
+
onProgress: i[0] ||= (...e) => E(U) && E(U)(...e),
|
|
1192
|
+
onLoadeddata: i[1] ||= (...e) => E(U) && E(U)(...e),
|
|
1193
|
+
onCanplay: i[2] ||= (...e) => E(U) && E(U)(...e),
|
|
1194
|
+
onDurationchange: Oe,
|
|
1195
|
+
onTimeupdate: Oe,
|
|
1196
|
+
onVolumechange: Oe,
|
|
1197
|
+
onPlaying: i[3] ||= (...e) => E(ce) && E(ce)(...e),
|
|
1198
|
+
onPause: i[4] ||= (e) => Y.value = !1,
|
|
1199
|
+
onEnded: Ae,
|
|
1200
|
+
onClick: Ce,
|
|
1201
|
+
onError: i[5] ||= (...e) => E(V) && E(V)(...e)
|
|
1202
|
+
}, null, 42, ct)) : (b(), s("img", {
|
|
1091
1203
|
key: 3,
|
|
1092
1204
|
ref_key: "imageElement",
|
|
1093
1205
|
ref: ee,
|
|
1094
|
-
"data-source-generation": E(
|
|
1095
|
-
class: h(["media-preview", { "media-preview--ready": E(
|
|
1096
|
-
src:
|
|
1097
|
-
width:
|
|
1098
|
-
height:
|
|
1206
|
+
"data-source-generation": E(K),
|
|
1207
|
+
class: h(["media-preview", { "media-preview--ready": E(B) === "ready" }]),
|
|
1208
|
+
src: M.value,
|
|
1209
|
+
width: R.value ?? void 0,
|
|
1210
|
+
height: z.value ?? void 0,
|
|
1099
1211
|
fetchpriority: e.fetchPriority,
|
|
1100
1212
|
alt: "",
|
|
1101
1213
|
decoding: "async",
|
|
1102
|
-
loading: E(
|
|
1103
|
-
onLoad: i[
|
|
1104
|
-
onError: i[
|
|
1105
|
-
}, null, 42,
|
|
1214
|
+
loading: E(_e),
|
|
1215
|
+
onLoad: i[6] ||= (...e) => E(H) && E(H)(...e),
|
|
1216
|
+
onError: i[7] ||= (...e) => E(V) && E(V)(...e)
|
|
1217
|
+
}, null, 42, lt))], 8, ot))]),
|
|
1106
1218
|
_: 1
|
|
1107
|
-
}, 8, ["name"]),
|
|
1219
|
+
}, 8, ["css", "name"]),
|
|
1108
1220
|
(b(), a(t, {
|
|
1109
|
-
disabled: !
|
|
1221
|
+
disabled: !be.value || !e.reelControlsTarget,
|
|
1110
1222
|
to: e.reelControlsTarget ?? "body"
|
|
1111
1223
|
}, [u(n, {
|
|
1112
1224
|
name: "vibe-reel-media-controls",
|
|
1113
|
-
css:
|
|
1225
|
+
css: be.value
|
|
1114
1226
|
}, {
|
|
1115
|
-
default: k(() => [
|
|
1116
|
-
key:
|
|
1117
|
-
"current-time":
|
|
1118
|
-
"data-control-post-id":
|
|
1119
|
-
duration:
|
|
1227
|
+
default: k(() => [xe.value ? (b(), a(Ke, {
|
|
1228
|
+
key: Se.value,
|
|
1229
|
+
"current-time": te.value,
|
|
1230
|
+
"data-control-post-id": be.value ? e.item.postId : void 0,
|
|
1231
|
+
duration: J.value,
|
|
1120
1232
|
layout: e.layout,
|
|
1121
|
-
muted:
|
|
1122
|
-
playing:
|
|
1123
|
-
volume:
|
|
1124
|
-
onSeek:
|
|
1125
|
-
onToggleMute:
|
|
1126
|
-
onTogglePlayback:
|
|
1127
|
-
onVolumeChange:
|
|
1233
|
+
muted: E(X),
|
|
1234
|
+
playing: Y.value,
|
|
1235
|
+
volume: E(oe),
|
|
1236
|
+
onSeek: je,
|
|
1237
|
+
onToggleMute: E(ae),
|
|
1238
|
+
onTogglePlayback: we,
|
|
1239
|
+
onVolumeChange: E(re)
|
|
1128
1240
|
}, null, 8, [
|
|
1129
1241
|
"current-time",
|
|
1130
1242
|
"data-control-post-id",
|
|
@@ -1132,7 +1244,9 @@ var Xe = [
|
|
|
1132
1244
|
"layout",
|
|
1133
1245
|
"muted",
|
|
1134
1246
|
"playing",
|
|
1135
|
-
"volume"
|
|
1247
|
+
"volume",
|
|
1248
|
+
"onToggleMute",
|
|
1249
|
+
"onVolumeChange"
|
|
1136
1250
|
])) : o("", !0)]),
|
|
1137
1251
|
_: 1
|
|
1138
1252
|
}, 8, ["css"])], 8, ["disabled", "to"])),
|
|
@@ -1144,31 +1258,31 @@ var Xe = [
|
|
|
1144
1258
|
type: "button",
|
|
1145
1259
|
class: "media-carousel-control media-carousel-control--previous",
|
|
1146
1260
|
"aria-label": `Previous media for post ${e.item.postId}`,
|
|
1147
|
-
onClick: i[
|
|
1148
|
-
onKeydown: i[
|
|
1149
|
-
}, [u(E(
|
|
1261
|
+
onClick: i[8] ||= j((e) => Q(T.value - 1, e), ["stop"]),
|
|
1262
|
+
onKeydown: i[9] ||= j(() => {}, ["stop"])
|
|
1263
|
+
}, [u(E(Te), { size: 20 })], 40, ut), c("button", {
|
|
1150
1264
|
type: "button",
|
|
1151
1265
|
class: "media-carousel-control media-carousel-control--next",
|
|
1152
1266
|
"aria-label": `Next media for post ${e.item.postId}`,
|
|
1153
|
-
onClick: i[
|
|
1154
|
-
onKeydown: i[
|
|
1155
|
-
}, [u(E(
|
|
1267
|
+
onClick: i[10] ||= j((e) => Q(T.value + 1, e), ["stop"]),
|
|
1268
|
+
onKeydown: i[11] ||= j(() => {}, ["stop"])
|
|
1269
|
+
}, [u(E(Ee), { size: 20 })], 40, dt)], 2)) : o("", !0),
|
|
1156
1270
|
Z.value ? (b(), s("button", {
|
|
1157
1271
|
key: 1,
|
|
1158
1272
|
class: "media-card-activator",
|
|
1159
1273
|
type: "button",
|
|
1160
1274
|
"aria-label": `Open post ${e.item.postId}`,
|
|
1161
|
-
onClick: i[
|
|
1162
|
-
onKeydown: i[
|
|
1163
|
-
}, null, 40,
|
|
1164
|
-
], 42,
|
|
1165
|
-
e.cardFooter ? (b(), a(
|
|
1275
|
+
onClick: i[12] ||= j((e) => r.$emit("activate", ue(e)), ["stop"]),
|
|
1276
|
+
onKeydown: i[13] ||= j(() => {}, ["stop"])
|
|
1277
|
+
}, null, 40, ft)) : o("", !0)
|
|
1278
|
+
], 42, at),
|
|
1279
|
+
e.cardFooter ? (b(), a(Pe, {
|
|
1166
1280
|
key: 1,
|
|
1167
1281
|
index: e.index,
|
|
1168
1282
|
item: e.item,
|
|
1169
1283
|
layout: e.layout,
|
|
1170
1284
|
"loaded-count": e.loadedCount,
|
|
1171
|
-
"media-index":
|
|
1285
|
+
"media-index": T.value,
|
|
1172
1286
|
"media-source": e.mediaSource,
|
|
1173
1287
|
placement: "footer",
|
|
1174
1288
|
region: e.cardFooter,
|
|
@@ -1185,12 +1299,12 @@ var Xe = [
|
|
|
1185
1299
|
"style",
|
|
1186
1300
|
"total"
|
|
1187
1301
|
])) : o("", !0)
|
|
1188
|
-
])], 46,
|
|
1302
|
+
])], 46, rt));
|
|
1189
1303
|
}
|
|
1190
|
-
}),
|
|
1304
|
+
}), _t = { class: "masonry-feed-shell" }, vt = ["aria-hidden", "inert"], yt = {
|
|
1191
1305
|
key: 0,
|
|
1192
1306
|
class: "masonry-feed-status-overlay"
|
|
1193
|
-
},
|
|
1307
|
+
}, bt = 6, xt = 12, St = 250, Ct = /* @__PURE__ */ d({
|
|
1194
1308
|
__name: "MasonryFeed",
|
|
1195
1309
|
props: {
|
|
1196
1310
|
enteringPostIds: {},
|
|
@@ -1213,6 +1327,7 @@ var Xe = [
|
|
|
1213
1327
|
mediaIndices: {},
|
|
1214
1328
|
nextPageError: { type: Boolean },
|
|
1215
1329
|
previewStates: {},
|
|
1330
|
+
reelAudioState: {},
|
|
1216
1331
|
state: {},
|
|
1217
1332
|
total: {}
|
|
1218
1333
|
},
|
|
@@ -1226,19 +1341,19 @@ var Xe = [
|
|
|
1226
1341
|
"visible"
|
|
1227
1342
|
],
|
|
1228
1343
|
setup(t, { expose: n, emit: i }) {
|
|
1229
|
-
let l = 0, d = t, f = i, p = w(null), m = `vibe-masonry-${D()}`, g = w(null), y = w(0), x = w(
|
|
1344
|
+
let l = 0, d = t, f = i, p = w(null), m = `vibe-masonry-${D()}`, g = w(null), y = w(0), x = w(bt), C = w(0), T = w(0), k = w(0), A = w([]), j = w([]), M = 0, N = null, P = null, F = null, I = null, R = r(() => ie(d.items, y.value, {
|
|
1230
1345
|
additionalHeight: (d.cardHeader?.height ?? 0) + (d.cardFooter?.height ?? 0),
|
|
1231
1346
|
gap: x.value,
|
|
1232
|
-
minColumnWidth:
|
|
1347
|
+
minColumnWidth: se(d.masonry)
|
|
1233
1348
|
})), z = r(() => {
|
|
1234
1349
|
if (d.leavingPostIds.size === 0) return null;
|
|
1235
1350
|
let e = d.items.flatMap((e, t) => d.leavingPostIds.has(e.postId) ? [] : [{
|
|
1236
1351
|
index: t,
|
|
1237
1352
|
item: e
|
|
1238
|
-
}]), t =
|
|
1353
|
+
}]), t = ie(e.map(({ item: e }) => e), y.value, {
|
|
1239
1354
|
additionalHeight: (d.cardHeader?.height ?? 0) + (d.cardFooter?.height ?? 0),
|
|
1240
1355
|
gap: x.value,
|
|
1241
|
-
minColumnWidth:
|
|
1356
|
+
minColumnWidth: se(d.masonry)
|
|
1242
1357
|
});
|
|
1243
1358
|
return {
|
|
1244
1359
|
indices: e.map(({ index: e }) => e),
|
|
@@ -1251,50 +1366,50 @@ var Xe = [
|
|
|
1251
1366
|
...t.layout,
|
|
1252
1367
|
items: d.items.map((n, r) => d.leavingPostIds.has(n.postId) ? e.items[r] : t.positions.get(n.postId) ?? e.items[r])
|
|
1253
1368
|
} : e;
|
|
1254
|
-
}), V = r(() =>
|
|
1369
|
+
}), V = r(() => ae(R.value.items)), ee = r(() => {
|
|
1255
1370
|
let e = z.value;
|
|
1256
|
-
return e ?
|
|
1257
|
-
}),
|
|
1371
|
+
return e ? ae(e.layout.items, e.indices) : null;
|
|
1372
|
+
}), H = r(() => Math.max(T.value, d.leavingPostIds.size === 0 ? B.value.height : R.value.height)), U = r(() => ({ height: `${H.value}px` })), W = r(() => !d.infiniteScroll || C.value > 0 && k.value + B.value.height <= C.value + 1), K = r(() => new Set(A.value)), q = r(() => j.value.flatMap((e) => {
|
|
1258
1373
|
let t = d.items[e];
|
|
1259
1374
|
return t ? [{
|
|
1260
|
-
fetchPriority:
|
|
1375
|
+
fetchPriority: K.value.has(e) ? "high" : "low",
|
|
1261
1376
|
index: e,
|
|
1262
1377
|
item: t
|
|
1263
1378
|
}] : [];
|
|
1264
1379
|
}));
|
|
1265
|
-
function
|
|
1380
|
+
function te(e, t) {
|
|
1266
1381
|
return [...new Set([...e, ...t])].sort((e, t) => e - t);
|
|
1267
1382
|
}
|
|
1268
|
-
function
|
|
1383
|
+
function Y(e, t) {
|
|
1269
1384
|
return e.length === t.length && e.every((e, n) => e === t[n]);
|
|
1270
1385
|
}
|
|
1271
|
-
function
|
|
1386
|
+
function ne(e) {
|
|
1272
1387
|
let t = {
|
|
1273
1388
|
scrollTop: M - k.value,
|
|
1274
1389
|
viewportHeight: C.value
|
|
1275
|
-
}, n =
|
|
1390
|
+
}, n = ee.value, r = oe(n ?? V.value, {
|
|
1276
1391
|
...t,
|
|
1277
1392
|
overscan: e
|
|
1278
1393
|
}).indices;
|
|
1279
|
-
return
|
|
1394
|
+
return te(r, d.leavingPostIds.size === 0 ? [] : oe(V.value, {
|
|
1280
1395
|
...t,
|
|
1281
1396
|
overscan: e
|
|
1282
1397
|
}).indices);
|
|
1283
1398
|
}
|
|
1284
|
-
function
|
|
1285
|
-
let e =
|
|
1286
|
-
|
|
1399
|
+
function X() {
|
|
1400
|
+
let e = ne(0), t = ne(ce(d.masonry, C.value));
|
|
1401
|
+
Y(A.value, e) || (A.value = e), Y(j.value, t) || (j.value = t);
|
|
1287
1402
|
}
|
|
1288
|
-
function
|
|
1403
|
+
function le() {
|
|
1289
1404
|
if (I !== null) return;
|
|
1290
1405
|
I = -1;
|
|
1291
1406
|
let e = requestAnimationFrame(() => {
|
|
1292
|
-
I = null,
|
|
1407
|
+
I = null, X();
|
|
1293
1408
|
});
|
|
1294
1409
|
I !== null && (I = e);
|
|
1295
1410
|
}
|
|
1296
|
-
let
|
|
1297
|
-
O(() => [...
|
|
1411
|
+
let Z = /* @__PURE__ */ new Set();
|
|
1412
|
+
O(() => [...K.value].flatMap((e) => {
|
|
1298
1413
|
let t = d.items[e];
|
|
1299
1414
|
if (!t) return [];
|
|
1300
1415
|
let n = d.mediaIndices.get(t.postId) ?? 0, r = L(t.postId, n);
|
|
@@ -1306,8 +1421,8 @@ var Xe = [
|
|
|
1306
1421
|
}), (e) => {
|
|
1307
1422
|
let t = new Set(e.map(({ key: e }) => e));
|
|
1308
1423
|
e.forEach(({ key: e, mediaIndex: t, postId: n }) => {
|
|
1309
|
-
|
|
1310
|
-
}),
|
|
1424
|
+
Z.has(e) || f("visible", n, t);
|
|
1425
|
+
}), Z = t;
|
|
1311
1426
|
}, {
|
|
1312
1427
|
immediate: !0,
|
|
1313
1428
|
flush: "post"
|
|
@@ -1315,7 +1430,7 @@ var Xe = [
|
|
|
1315
1430
|
function ue(e) {
|
|
1316
1431
|
let t = B.value.items[e], n = d.items[e]?.postId;
|
|
1317
1432
|
if (!t) return {};
|
|
1318
|
-
let r = n !== void 0 && d.enteringPostIds.has(n), i = n !== void 0 && d.leavingPostIds.has(n), a = r || i ?
|
|
1433
|
+
let r = n !== void 0 && d.enteringPostIds.has(n), i = n !== void 0 && d.leavingPostIds.has(n), a = r || i ? re({
|
|
1319
1434
|
containerHeight: Math.max(T.value, R.value.height),
|
|
1320
1435
|
gap: x.value
|
|
1321
1436
|
}) : 0, o = n === void 0 ? 0 : i ? d.removalDelays.get(n) ?? 0 : r ? d.entryDelays.get(n) ?? 0 : 0;
|
|
@@ -1326,52 +1441,52 @@ var Xe = [
|
|
|
1326
1441
|
transform: `translate3d(${t.x}px, ${t.y + a}px, 0)`
|
|
1327
1442
|
};
|
|
1328
1443
|
}
|
|
1329
|
-
function
|
|
1444
|
+
function Q() {
|
|
1330
1445
|
let e = p.value;
|
|
1331
1446
|
if (!e) return;
|
|
1332
1447
|
M = e.scrollTop, C.value = e.clientHeight;
|
|
1333
1448
|
let t = e.ownerDocument.defaultView?.getComputedStyle(e), n = (Number.parseFloat(t?.paddingTop ?? "") || 0) + (Number.parseFloat(t?.paddingBottom ?? "") || 0);
|
|
1334
1449
|
T.value = Math.max(0, e.clientHeight - n);
|
|
1335
1450
|
let r = g.value;
|
|
1336
|
-
r && (k.value = r.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop,
|
|
1451
|
+
r && (k.value = r.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop, X());
|
|
1337
1452
|
}
|
|
1338
|
-
function
|
|
1453
|
+
function de(e) {
|
|
1339
1454
|
let t = e.ownerDocument.documentElement.clientWidth;
|
|
1340
|
-
y.value = e.clientWidth, x.value = Math.min(
|
|
1455
|
+
y.value = e.clientWidth, x.value = Math.min(xt, Math.max(bt, t * .0075)), Q();
|
|
1341
1456
|
}
|
|
1342
|
-
function
|
|
1457
|
+
function fe(e) {
|
|
1343
1458
|
let t = e.currentTarget;
|
|
1344
|
-
t && (M = t.scrollTop,
|
|
1459
|
+
t && (M = t.scrollTop, le(), Date.now() >= l && !d.loadMoreLocked && d.infiniteScroll && J(t) && f("loadMore"));
|
|
1345
1460
|
}
|
|
1346
|
-
function
|
|
1461
|
+
function pe() {
|
|
1347
1462
|
let e = p.value;
|
|
1348
|
-
Date.now() >= l && !d.loadMoreLocked && e &&
|
|
1463
|
+
Date.now() >= l && !d.loadMoreLocked && e && J(e) && f("loadMore");
|
|
1349
1464
|
}
|
|
1350
1465
|
O(() => d.items.length, (e, t) => {
|
|
1351
|
-
e > 0 && e < t && (l = Date.now() +
|
|
1466
|
+
e > 0 && e < t && (l = Date.now() + St);
|
|
1352
1467
|
});
|
|
1353
|
-
function
|
|
1468
|
+
function me() {
|
|
1354
1469
|
return p.value;
|
|
1355
1470
|
}
|
|
1356
1471
|
return O(g, (e) => {
|
|
1357
|
-
N?.disconnect(), N = null, F !== null && cancelAnimationFrame(F), e && (
|
|
1472
|
+
N?.disconnect(), N = null, F !== null && cancelAnimationFrame(F), e && (de(e), !(typeof ResizeObserver > "u") && (N = new ResizeObserver(([t]) => {
|
|
1358
1473
|
let n = t?.contentRect.width ?? e.clientWidth;
|
|
1359
1474
|
Math.abs(n - y.value) < .5 || (F = requestAnimationFrame(() => {
|
|
1360
|
-
F = null,
|
|
1475
|
+
F = null, de(e);
|
|
1361
1476
|
}));
|
|
1362
1477
|
}), N.observe(e)));
|
|
1363
1478
|
}), O(p, (e) => {
|
|
1364
|
-
P?.disconnect(), P = null, e && (
|
|
1479
|
+
P?.disconnect(), P = null, e && (Q(), !(typeof ResizeObserver > "u") && (P = new ResizeObserver(Q), P.observe(e)));
|
|
1365
1480
|
}), O([
|
|
1366
1481
|
R,
|
|
1367
1482
|
B,
|
|
1368
1483
|
() => d.masonry
|
|
1369
|
-
],
|
|
1484
|
+
], X, { flush: "post" }), v(() => {
|
|
1370
1485
|
N?.disconnect(), P?.disconnect(), F !== null && cancelAnimationFrame(F), I !== null && cancelAnimationFrame(I);
|
|
1371
1486
|
}), n({
|
|
1372
|
-
getScrollElement:
|
|
1373
|
-
loadIfNearBottom:
|
|
1374
|
-
}), (n, r) => (b(), s("div",
|
|
1487
|
+
getScrollElement: me,
|
|
1488
|
+
loadIfNearBottom: pe
|
|
1489
|
+
}), (n, r) => (b(), s("div", _t, [
|
|
1375
1490
|
c("main", {
|
|
1376
1491
|
id: m,
|
|
1377
1492
|
ref_key: "galleryElement",
|
|
@@ -1380,14 +1495,14 @@ var Xe = [
|
|
|
1380
1495
|
"data-layout-mode": "masonry",
|
|
1381
1496
|
"aria-hidden": t.suspended || void 0,
|
|
1382
1497
|
inert: t.suspended || void 0,
|
|
1383
|
-
onScrollPassive:
|
|
1498
|
+
onScrollPassive: fe
|
|
1384
1499
|
}, [c("section", {
|
|
1385
1500
|
ref_key: "masonryElement",
|
|
1386
1501
|
ref: g,
|
|
1387
1502
|
class: h(["masonry", { "masonry--ready": y.value > 0 }]),
|
|
1388
1503
|
style: _(U.value),
|
|
1389
1504
|
"aria-label": "Media gallery"
|
|
1390
|
-
}, [(b(!0), s(e, null, S(
|
|
1505
|
+
}, [(b(!0), s(e, null, S(q.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(gt, {
|
|
1391
1506
|
key: n.postId,
|
|
1392
1507
|
class: "masonry-item",
|
|
1393
1508
|
entering: t.enteringPostIds.has(n.postId),
|
|
@@ -1427,8 +1542,8 @@ var Xe = [
|
|
|
1427
1542
|
"onMediaChange",
|
|
1428
1543
|
"onReady",
|
|
1429
1544
|
"onError"
|
|
1430
|
-
]))), 128))], 6)], 42,
|
|
1431
|
-
t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && W.value || !t.hasNext && t.canRetryEnd ? (b(), s("div",
|
|
1545
|
+
]))), 128))], 6)], 42, vt),
|
|
1546
|
+
t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && W.value || !t.hasNext && t.canRetryEnd ? (b(), s("div", yt, [u(G, {
|
|
1432
1547
|
actions: t.feedFooterActions,
|
|
1433
1548
|
"can-retry-end": t.canRetryEnd,
|
|
1434
1549
|
"feed-footer": t.feedFooter,
|
|
@@ -1451,7 +1566,7 @@ var Xe = [
|
|
|
1451
1566
|
"show-load-more",
|
|
1452
1567
|
"state"
|
|
1453
1568
|
])])) : o("", !0),
|
|
1454
|
-
u(
|
|
1569
|
+
u(he, {
|
|
1455
1570
|
"content-size": B.value.height,
|
|
1456
1571
|
"controls-id": m,
|
|
1457
1572
|
"scroll-element": p.value,
|
|
@@ -1463,8 +1578,8 @@ var Xe = [
|
|
|
1463
1578
|
])
|
|
1464
1579
|
]));
|
|
1465
1580
|
}
|
|
1466
|
-
}),
|
|
1467
|
-
function
|
|
1581
|
+
}), wt = 300;
|
|
1582
|
+
function Tt(e, t, n) {
|
|
1468
1583
|
let r = e.scrollTop;
|
|
1469
1584
|
if (n || Math.abs(r - t) <= 1) return e.scrollTop = t, Promise.resolve();
|
|
1470
1585
|
e.setAttribute("data-transitioning", "");
|
|
@@ -1472,7 +1587,7 @@ function bt(e, t, n) {
|
|
|
1472
1587
|
return new Promise((n) => {
|
|
1473
1588
|
let o = (s) => {
|
|
1474
1589
|
a += 1;
|
|
1475
|
-
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c /
|
|
1590
|
+
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / wt), u = 1 - (1 - l) ** 3;
|
|
1476
1591
|
if (e.scrollTop = r + (t - r) * u, l < 1) {
|
|
1477
1592
|
requestAnimationFrame(o);
|
|
1478
1593
|
return;
|
|
@@ -1484,7 +1599,7 @@ function bt(e, t, n) {
|
|
|
1484
1599
|
}
|
|
1485
1600
|
//#endregion
|
|
1486
1601
|
//#region src/components/ReelAutoAdvanceProgress.vue?vue&type=script&setup=true&lang.ts
|
|
1487
|
-
var
|
|
1602
|
+
var Et = ["aria-label"], Dt = /* @__PURE__ */ d({
|
|
1488
1603
|
__name: "ReelAutoAdvanceProgress",
|
|
1489
1604
|
props: {
|
|
1490
1605
|
durationMs: {},
|
|
@@ -1502,9 +1617,9 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1502
1617
|
class: "reel-auto-advance-progress",
|
|
1503
1618
|
style: _(a.value),
|
|
1504
1619
|
onAnimationend: n[0] ||= (e) => i("complete")
|
|
1505
|
-
}, null, 36)], 8,
|
|
1620
|
+
}, null, 36)], 8, Et));
|
|
1506
1621
|
}
|
|
1507
|
-
}),
|
|
1622
|
+
}), Ot = { class: "reel-viewport" }, kt = ["data-active-post-id", "data-active-media-index"], At = ["role", "data-status"], jt = 300, Mt = 250, Nt = /* @__PURE__ */ d({
|
|
1508
1623
|
__name: "ReelFeed",
|
|
1509
1624
|
props: {
|
|
1510
1625
|
initialPostId: {},
|
|
@@ -1528,6 +1643,7 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1528
1643
|
mediaIndices: {},
|
|
1529
1644
|
nextPageError: { type: Boolean },
|
|
1530
1645
|
previewStates: {},
|
|
1646
|
+
reelAudioState: {},
|
|
1531
1647
|
state: {},
|
|
1532
1648
|
total: {}
|
|
1533
1649
|
},
|
|
@@ -1537,12 +1653,13 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1537
1653
|
"loadMore",
|
|
1538
1654
|
"mediaChange",
|
|
1539
1655
|
"ready",
|
|
1656
|
+
"reelAudioChange",
|
|
1540
1657
|
"retryEnd",
|
|
1541
1658
|
"retryForward"
|
|
1542
1659
|
],
|
|
1543
1660
|
setup(t, { expose: n, emit: i }) {
|
|
1544
1661
|
let l = 0, u = t, d = i, f = w(null), p = w(null), g = u.initialPostId === null || u.initialPostId === void 0 ? -1 : u.items.findIndex((e) => e.postId === u.initialPostId), x = w(Math.max(0, g)), C = w(!1), D = w(!1), k = 0, A = null, j = null, M = null, F = r(() => ({ gridTemplateRows: `repeat(${u.items.length}, 100cqh)` })), R = r(() => {
|
|
1545
|
-
let e = Math.max(0, x.value -
|
|
1662
|
+
let e = Math.max(0, x.value - 2), t = Math.min(u.items.length - 1, x.value + 2);
|
|
1546
1663
|
return u.items.slice(e, t + 1).map((t, n) => ({
|
|
1547
1664
|
fetchPriority: e + n === x.value ? "high" : "low",
|
|
1548
1665
|
index: e + n,
|
|
@@ -1551,10 +1668,10 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1551
1668
|
}), z = r(() => u.items[x.value]?.postId), B = r(() => u.items[x.value]), V = r(() => {
|
|
1552
1669
|
let e = z.value;
|
|
1553
1670
|
return e === void 0 ? 0 : u.mediaIndices.get(e) ?? 0;
|
|
1554
|
-
}),
|
|
1671
|
+
}), ee = r(() => {
|
|
1555
1672
|
let e = z.value;
|
|
1556
1673
|
return e === void 0 ? "loading" : u.previewStates.get(L(e, V.value)) ?? "loading";
|
|
1557
|
-
}),
|
|
1674
|
+
}), H = r(() => B.value ? I(B.value, V.value) : null), U = r(() => H.value ? N(H.value, u.mediaSource ?? "preview") : null), W = r(() => ee.value === "ready" && !!(U.value && et(U.value.type, U.value.src))), K = r(() => [
|
|
1558
1675
|
z.value,
|
|
1559
1676
|
V.value,
|
|
1560
1677
|
u.items.length,
|
|
@@ -1562,52 +1679,52 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1562
1679
|
u.reelAutoAdvance.enabled,
|
|
1563
1680
|
u.reelAutoAdvance.includePostItems,
|
|
1564
1681
|
u.reelAutoAdvance.intervalMs
|
|
1565
|
-
].join(":")),
|
|
1682
|
+
].join(":")), q = r(() => {
|
|
1566
1683
|
let e = B.value, t = !!(e && u.reelAutoAdvance.includePostItems && V.value < P(e).length - 1), n = u.reelAutoAdvance.intervalMs / 1e3;
|
|
1567
1684
|
return `Auto advance to the next ${t ? "post item" : "post"} in ${n}s`;
|
|
1568
|
-
}),
|
|
1569
|
-
function
|
|
1685
|
+
}), te = r(() => u.reelAutoAdvance.enabled && u.reelForward.status === "idle" && B.value !== void 0 && ee.value !== "loading" && !W.value), Y = r(() => !u.infiniteScroll || u.items.length <= 1), ne = r(() => u.reelForward.status === "loading" ? "Loading the next media…" : u.reelForward.status === "error" ? "Unable to load the next media." : "You reached the end of this feed.");
|
|
1686
|
+
function re(e) {
|
|
1570
1687
|
return { gridRow: `${e + 1}` };
|
|
1571
1688
|
}
|
|
1572
|
-
function
|
|
1689
|
+
function ie(e) {
|
|
1573
1690
|
let t = k || e.clientHeight;
|
|
1574
1691
|
return t <= 0 || u.items.length === 0 ? 0 : Math.min(u.items.length - 1, Math.max(0, Math.round(e.scrollTop / t)));
|
|
1575
1692
|
}
|
|
1576
|
-
function
|
|
1693
|
+
function ae(e) {
|
|
1577
1694
|
let t = e.currentTarget;
|
|
1578
1695
|
if (!t) return;
|
|
1579
1696
|
let n = k || t.clientHeight, r = Math.max(0, u.items.length - 1) * n;
|
|
1580
|
-
C.value = u.items.length > 0 && t.scrollTop > r + 1, D.value || (x.value =
|
|
1697
|
+
C.value = u.items.length > 0 && t.scrollTop > r + 1, D.value || (x.value = ie(t)), Date.now() >= l && !u.loadMoreLocked && u.infiniteScroll && J(t) && d("loadMore");
|
|
1581
1698
|
}
|
|
1582
|
-
function
|
|
1699
|
+
function X() {
|
|
1583
1700
|
let e = f.value;
|
|
1584
|
-
e && (C.value = !1,
|
|
1701
|
+
e && (C.value = !1, ce(!0), k = e.clientHeight, e.scrollTop = x.value * k, j !== null && cancelAnimationFrame(j), j = requestAnimationFrame(() => {
|
|
1585
1702
|
e.scrollTop = x.value * e.clientHeight, k = e.clientHeight, j = null;
|
|
1586
|
-
}),
|
|
1703
|
+
}), oe());
|
|
1587
1704
|
}
|
|
1588
|
-
function
|
|
1705
|
+
function oe() {
|
|
1589
1706
|
M !== null && clearTimeout(M), M = setTimeout(() => {
|
|
1590
1707
|
M = null;
|
|
1591
1708
|
let e = f.value;
|
|
1592
|
-
e && (k = e.clientHeight, e.scrollTop = x.value * k),
|
|
1709
|
+
e && (k = e.clientHeight, e.scrollTop = x.value * k), ce(!1);
|
|
1593
1710
|
}, 120);
|
|
1594
1711
|
}
|
|
1595
|
-
function
|
|
1596
|
-
|
|
1712
|
+
function se() {
|
|
1713
|
+
ce(!0);
|
|
1597
1714
|
let e = f.value;
|
|
1598
|
-
e && (k = e.clientHeight, e.scrollTop = x.value * k),
|
|
1715
|
+
e && (k = e.clientHeight, e.scrollTop = x.value * k), oe();
|
|
1599
1716
|
}
|
|
1600
|
-
function
|
|
1717
|
+
function ce(e) {
|
|
1601
1718
|
D.value = e, f.value?.toggleAttribute("data-resizing", e);
|
|
1602
1719
|
}
|
|
1603
|
-
function
|
|
1720
|
+
function le() {
|
|
1604
1721
|
let e = f.value;
|
|
1605
|
-
Date.now() >= l && !u.loadMoreLocked && e &&
|
|
1722
|
+
Date.now() >= l && !u.loadMoreLocked && e && J(e) && d("loadMore");
|
|
1606
1723
|
}
|
|
1607
1724
|
O(() => u.items.length, (e, t) => {
|
|
1608
|
-
e > 0 && e < t && (l = Date.now() +
|
|
1725
|
+
e > 0 && e < t && (l = Date.now() + Mt);
|
|
1609
1726
|
});
|
|
1610
|
-
function
|
|
1727
|
+
function Z(e) {
|
|
1611
1728
|
let t = B.value;
|
|
1612
1729
|
if (!t) return !1;
|
|
1613
1730
|
let n = P(t).length;
|
|
@@ -1617,32 +1734,32 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1617
1734
|
}
|
|
1618
1735
|
function ue(e) {
|
|
1619
1736
|
let t = x.value + e;
|
|
1620
|
-
return !f.value || t < 0 || t >= u.items.length ? !1 : (
|
|
1737
|
+
return !f.value || t < 0 || t >= u.items.length ? !1 : (pe(t), !0);
|
|
1621
1738
|
}
|
|
1622
|
-
function
|
|
1739
|
+
function Q(e, t) {
|
|
1623
1740
|
let n = u.items.findIndex((t) => t.postId === e), r = u.items[n];
|
|
1624
|
-
return !f.value || !r || t < 0 || t > r.items.length ? !1 : ((u.mediaIndices.get(e) ?? 0) !== t && d("mediaChange", e, t), n !== x.value &&
|
|
1741
|
+
return !f.value || !r || t < 0 || t > r.items.length ? !1 : ((u.mediaIndices.get(e) ?? 0) !== t && d("mediaChange", e, t), n !== x.value && pe(n), !0);
|
|
1625
1742
|
}
|
|
1626
|
-
function
|
|
1743
|
+
function de() {
|
|
1627
1744
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
1628
1745
|
}
|
|
1629
|
-
function
|
|
1746
|
+
function fe(e) {
|
|
1630
1747
|
let t = f.value;
|
|
1631
1748
|
if (!t) return Promise.resolve();
|
|
1632
1749
|
let n = e * (k || t.clientHeight);
|
|
1633
|
-
return x.value = e,
|
|
1750
|
+
return x.value = e, Tt(t, n, de());
|
|
1634
1751
|
}
|
|
1635
|
-
function
|
|
1636
|
-
|
|
1752
|
+
function pe(e) {
|
|
1753
|
+
fe(e);
|
|
1637
1754
|
}
|
|
1638
|
-
async function
|
|
1755
|
+
async function me(e) {
|
|
1639
1756
|
let t = u.items.findIndex((t) => t.postId === e);
|
|
1640
|
-
return t < 0 || t === x.value ? !1 : (await
|
|
1757
|
+
return t < 0 || t === x.value ? !1 : (await fe(t), !0);
|
|
1641
1758
|
}
|
|
1642
|
-
async function
|
|
1643
|
-
return
|
|
1759
|
+
async function he(e) {
|
|
1760
|
+
return Z(e) ? (de() || await new Promise((e) => setTimeout(e, jt)), !0) : !1;
|
|
1644
1761
|
}
|
|
1645
|
-
function
|
|
1762
|
+
function ge() {
|
|
1646
1763
|
if (!u.reelAutoAdvance.enabled) return;
|
|
1647
1764
|
let e = B.value;
|
|
1648
1765
|
if (!e) return;
|
|
@@ -1655,31 +1772,31 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1655
1772
|
u.hasNext && !u.loadMoreLocked && d("loadMore");
|
|
1656
1773
|
return;
|
|
1657
1774
|
}
|
|
1658
|
-
u.reelAutoAdvance.includePostItems && (u.mediaIndices.get(n.postId) ?? 0) !== 0 && d("mediaChange", n.postId, 0),
|
|
1775
|
+
u.reelAutoAdvance.includePostItems && (u.mediaIndices.get(n.postId) ?? 0) !== 0 && d("mediaChange", n.postId, 0), pe(t);
|
|
1659
1776
|
}
|
|
1660
|
-
function
|
|
1661
|
-
!u.reelAutoAdvance.enabled || e !== z.value || t !== V.value || !W.value ||
|
|
1777
|
+
function _e(e, t) {
|
|
1778
|
+
!u.reelAutoAdvance.enabled || e !== z.value || t !== V.value || !W.value || ge();
|
|
1662
1779
|
}
|
|
1663
1780
|
return O(f, (e) => {
|
|
1664
|
-
A?.disconnect(), A = null, e && (k = e.clientHeight, !(typeof ResizeObserver > "u") && (A = new ResizeObserver(
|
|
1781
|
+
A?.disconnect(), A = null, e && (k = e.clientHeight, !(typeof ResizeObserver > "u") && (A = new ResizeObserver(X), A.observe(e)));
|
|
1665
1782
|
}), O(() => u.items.length, async (e) => {
|
|
1666
1783
|
let t = u.initialPostId, n = t == null ? -1 : u.items.findIndex(({ postId: e }) => e === t);
|
|
1667
|
-
x.value = n >= 0 ? n : Math.min(x.value, Math.max(0, e - 1)), await m(),
|
|
1784
|
+
x.value = n >= 0 ? n : Math.min(x.value, Math.max(0, e - 1)), await m(), X();
|
|
1668
1785
|
}), O(z, (e) => {
|
|
1669
1786
|
e !== void 0 && d("activeChange", e);
|
|
1670
1787
|
}, { immediate: !0 }), y(() => {
|
|
1671
|
-
window.addEventListener("resize",
|
|
1788
|
+
window.addEventListener("resize", se), window.addEventListener("orientationchange", se), g >= 0 && m(X);
|
|
1672
1789
|
}), v(() => {
|
|
1673
|
-
window.removeEventListener("resize",
|
|
1790
|
+
window.removeEventListener("resize", se), window.removeEventListener("orientationchange", se), A?.disconnect(), j !== null && cancelAnimationFrame(j), M !== null && clearTimeout(M);
|
|
1674
1791
|
}), n({
|
|
1675
1792
|
activeIndex: x,
|
|
1676
1793
|
activePostId: z,
|
|
1677
|
-
changeActiveMedia:
|
|
1678
|
-
loadIfNearBottom:
|
|
1794
|
+
changeActiveMedia: Z,
|
|
1795
|
+
loadIfNearBottom: le,
|
|
1679
1796
|
moveActivePost: ue,
|
|
1680
|
-
navigateToItem:
|
|
1681
|
-
transitionActiveMedia:
|
|
1682
|
-
transitionActivePost:
|
|
1797
|
+
navigateToItem: Q,
|
|
1798
|
+
transitionActiveMedia: he,
|
|
1799
|
+
transitionActivePost: me
|
|
1683
1800
|
}), (n, r) => (b(), s("main", {
|
|
1684
1801
|
class: h(["reel-shell", {
|
|
1685
1802
|
"reel-shell--has-footer": !!t.cardFooter,
|
|
@@ -1687,7 +1804,7 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1687
1804
|
}]),
|
|
1688
1805
|
"data-layout-mode": "reel"
|
|
1689
1806
|
}, [
|
|
1690
|
-
t.cardHeader && B.value && t.reelForward.status === "idle" ? (b(), a(
|
|
1807
|
+
t.cardHeader && B.value && t.reelForward.status === "idle" ? (b(), a(Pe, {
|
|
1691
1808
|
key: 0,
|
|
1692
1809
|
index: x.value,
|
|
1693
1810
|
item: B.value,
|
|
@@ -1709,28 +1826,28 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1709
1826
|
"style",
|
|
1710
1827
|
"total"
|
|
1711
1828
|
])) : o("", !0),
|
|
1712
|
-
c("div",
|
|
1829
|
+
c("div", Ot, [c("div", {
|
|
1713
1830
|
ref_key: "galleryElement",
|
|
1714
1831
|
ref: f,
|
|
1715
1832
|
class: "gallery-shell reel-feed",
|
|
1716
1833
|
"data-active-post-id": z.value,
|
|
1717
1834
|
"data-active-media-index": V.value,
|
|
1718
|
-
onScrollPassive:
|
|
1835
|
+
onScrollPassive: ae
|
|
1719
1836
|
}, [t.reelForward.status === "idle" ? (b(), s("section", {
|
|
1720
1837
|
key: 1,
|
|
1721
1838
|
class: "reel-track",
|
|
1722
1839
|
style: _(F.value),
|
|
1723
1840
|
"aria-label": "Media gallery"
|
|
1724
|
-
}, [(b(!0), s(e, null, S(R.value, ({ fetchPriority: e, item: n, index:
|
|
1841
|
+
}, [(b(!0), s(e, null, S(R.value, ({ fetchPriority: e, item: n, index: i }) => (b(), a(gt, {
|
|
1725
1842
|
key: n.postId,
|
|
1726
|
-
active:
|
|
1727
|
-
"advance-on-media-end": u.reelAutoAdvance.enabled &&
|
|
1843
|
+
active: i === x.value && !C.value,
|
|
1844
|
+
"advance-on-media-end": u.reelAutoAdvance.enabled && i === x.value,
|
|
1728
1845
|
class: "reel-item",
|
|
1729
1846
|
entering: !1,
|
|
1730
1847
|
"fetch-priority": e,
|
|
1731
|
-
index:
|
|
1848
|
+
index: i,
|
|
1732
1849
|
item: n,
|
|
1733
|
-
"item-style":
|
|
1850
|
+
"item-style": re(i),
|
|
1734
1851
|
"media-card": t.mediaCard,
|
|
1735
1852
|
layout: "reel",
|
|
1736
1853
|
"loaded-count": t.items.length,
|
|
@@ -1738,11 +1855,13 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1738
1855
|
"media-source": t.mediaSource,
|
|
1739
1856
|
"preview-state": t.previewStates.get(E(L)(n.postId, t.mediaIndices.get(n.postId) ?? 0)) ?? "loading",
|
|
1740
1857
|
"reel-controls-target": p.value,
|
|
1858
|
+
"reel-audio-state": t.reelAudioState,
|
|
1741
1859
|
"stationary-reel-controls": "",
|
|
1742
1860
|
total: t.total,
|
|
1743
1861
|
onMediaChange: (e) => d("mediaChange", n.postId, e),
|
|
1744
|
-
onEnded: (e) =>
|
|
1862
|
+
onEnded: (e) => _e(n.postId, e),
|
|
1745
1863
|
onReady: (e) => d("ready", n.postId, e),
|
|
1864
|
+
onReelAudioChange: r[1] ||= (e) => d("reelAudioChange", e),
|
|
1746
1865
|
onError: (e) => d("error", n.postId, e)
|
|
1747
1866
|
}, null, 8, [
|
|
1748
1867
|
"active",
|
|
@@ -1757,6 +1876,7 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1757
1876
|
"media-source",
|
|
1758
1877
|
"preview-state",
|
|
1759
1878
|
"reel-controls-target",
|
|
1879
|
+
"reel-audio-state",
|
|
1760
1880
|
"total",
|
|
1761
1881
|
"onMediaChange",
|
|
1762
1882
|
"onEnded",
|
|
@@ -1767,12 +1887,12 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1767
1887
|
class: "reel-forward-status",
|
|
1768
1888
|
role: t.reelForward.status === "error" ? "alert" : "status",
|
|
1769
1889
|
"data-status": t.reelForward.status
|
|
1770
|
-
}, [c("p", null, T(
|
|
1890
|
+
}, [c("p", null, T(ne.value), 1), t.reelForward.status === "error" || t.reelForward.status === "end" ? (b(), s("button", {
|
|
1771
1891
|
key: 0,
|
|
1772
1892
|
class: "reel-forward-retry",
|
|
1773
1893
|
type: "button",
|
|
1774
1894
|
onClick: r[0] ||= (e) => d("retryForward")
|
|
1775
|
-
}, " Retry ")) : o("", !0)], 8,
|
|
1895
|
+
}, " Retry ")) : o("", !0)], 8, At)), t.reelForward.status === "idle" ? (b(), a(G, {
|
|
1776
1896
|
key: 2,
|
|
1777
1897
|
actions: t.feedFooterActions,
|
|
1778
1898
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -1781,10 +1901,10 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1781
1901
|
"has-next": t.hasNext,
|
|
1782
1902
|
"is-loading": t.isLoadingMore,
|
|
1783
1903
|
"load-more-locked": t.loadMoreLocked,
|
|
1784
|
-
"show-load-more":
|
|
1904
|
+
"show-load-more": Y.value,
|
|
1785
1905
|
state: t.state,
|
|
1786
|
-
onLoadMore: r[
|
|
1787
|
-
onRetryEnd: r[
|
|
1906
|
+
onLoadMore: r[2] ||= (e) => d("loadMore"),
|
|
1907
|
+
onRetryEnd: r[3] ||= (e) => d("retryEnd")
|
|
1788
1908
|
}, null, 8, [
|
|
1789
1909
|
"actions",
|
|
1790
1910
|
"can-retry-end",
|
|
@@ -1795,13 +1915,13 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1795
1915
|
"load-more-locked",
|
|
1796
1916
|
"show-load-more",
|
|
1797
1917
|
"state"
|
|
1798
|
-
])) : o("", !0)], 40,
|
|
1918
|
+
])) : o("", !0)], 40, kt), c("div", {
|
|
1799
1919
|
ref_key: "reelControlsElement",
|
|
1800
1920
|
ref: p,
|
|
1801
1921
|
class: "reel-media-controls-host",
|
|
1802
1922
|
"data-test": "reel-media-controls-host"
|
|
1803
1923
|
}, null, 512)]),
|
|
1804
|
-
t.cardFooter && B.value && t.reelForward.status === "idle" ? (b(), a(
|
|
1924
|
+
t.cardFooter && B.value && t.reelForward.status === "idle" ? (b(), a(Pe, {
|
|
1805
1925
|
key: 1,
|
|
1806
1926
|
index: x.value,
|
|
1807
1927
|
item: B.value,
|
|
@@ -1823,24 +1943,24 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1823
1943
|
"style",
|
|
1824
1944
|
"total"
|
|
1825
1945
|
])) : o("", !0),
|
|
1826
|
-
|
|
1827
|
-
key:
|
|
1946
|
+
te.value ? (b(), a(Dt, {
|
|
1947
|
+
key: K.value,
|
|
1828
1948
|
"duration-ms": t.reelAutoAdvance.intervalMs,
|
|
1829
|
-
label:
|
|
1830
|
-
onComplete:
|
|
1949
|
+
label: q.value,
|
|
1950
|
+
onComplete: ge
|
|
1831
1951
|
}, null, 8, ["duration-ms", "label"])) : o("", !0)
|
|
1832
1952
|
], 2));
|
|
1833
1953
|
}
|
|
1834
|
-
}),
|
|
1954
|
+
}), Pt = ["data-info-sheet-open", "data-info-sheet-mode"], Ft = ["aria-hidden", "inert"], It = {
|
|
1835
1955
|
key: 0,
|
|
1836
1956
|
class: "reel-info-sheet-layer",
|
|
1837
1957
|
"data-test": "reel-info-sheet"
|
|
1838
|
-
},
|
|
1958
|
+
}, Lt = [
|
|
1839
1959
|
"role",
|
|
1840
1960
|
"aria-modal",
|
|
1841
1961
|
"tabindex",
|
|
1842
1962
|
"data-active-post-id"
|
|
1843
|
-
],
|
|
1963
|
+
], Rt = /* @__PURE__ */ d({
|
|
1844
1964
|
__name: "ReelLayout",
|
|
1845
1965
|
props: {
|
|
1846
1966
|
forwardIndex: { default: null },
|
|
@@ -1870,6 +1990,7 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1870
1990
|
mediaIndices: {},
|
|
1871
1991
|
nextPageError: { type: Boolean },
|
|
1872
1992
|
previewStates: {},
|
|
1993
|
+
reelAudioState: {},
|
|
1873
1994
|
state: {},
|
|
1874
1995
|
total: {}
|
|
1875
1996
|
},
|
|
@@ -1880,6 +2001,7 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1880
2001
|
"loadMore",
|
|
1881
2002
|
"mediaChange",
|
|
1882
2003
|
"ready",
|
|
2004
|
+
"reelAudioChange",
|
|
1883
2005
|
"retryEnd",
|
|
1884
2006
|
"retryForward"
|
|
1885
2007
|
],
|
|
@@ -1930,10 +2052,10 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1930
2052
|
function V(e, t) {
|
|
1931
2053
|
d("error", e, t);
|
|
1932
2054
|
}
|
|
1933
|
-
function
|
|
2055
|
+
function ee(e, t) {
|
|
1934
2056
|
d("mediaChange", e, t);
|
|
1935
2057
|
}
|
|
1936
|
-
function
|
|
2058
|
+
function H(e, t) {
|
|
1937
2059
|
d("ready", e, t);
|
|
1938
2060
|
}
|
|
1939
2061
|
return O(() => ({
|
|
@@ -1965,7 +2087,7 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1965
2087
|
class: "reel-layout-main",
|
|
1966
2088
|
"aria-hidden": e.infoSheetOverlay && A.value || void 0,
|
|
1967
2089
|
inert: e.infoSheetOverlay && A.value || void 0
|
|
1968
|
-
}, [u(
|
|
2090
|
+
}, [u(Nt, {
|
|
1969
2091
|
ref_key: "reelFeed",
|
|
1970
2092
|
ref: p,
|
|
1971
2093
|
"can-retry-end": e.canRetryEnd,
|
|
@@ -1985,16 +2107,18 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1985
2107
|
"next-page-error": e.nextPageError,
|
|
1986
2108
|
"preview-states": e.previewStates,
|
|
1987
2109
|
"reel-auto-advance": e.reelAutoAdvance,
|
|
2110
|
+
"reel-audio-state": e.reelAudioState,
|
|
1988
2111
|
"reel-forward": e.reelForward,
|
|
1989
2112
|
state: e.state,
|
|
1990
2113
|
total: e.total,
|
|
1991
2114
|
onActiveChange: r[0] ||= (e) => d("activeChange", e),
|
|
1992
2115
|
onError: V,
|
|
1993
2116
|
onLoadMore: r[1] ||= (e) => d("loadMore"),
|
|
1994
|
-
onMediaChange:
|
|
1995
|
-
onReady:
|
|
2117
|
+
onMediaChange: ee,
|
|
2118
|
+
onReady: H,
|
|
1996
2119
|
onRetryEnd: r[2] ||= (e) => d("retryEnd"),
|
|
1997
|
-
onRetryForward: r[3] ||= (e) => d("retryForward")
|
|
2120
|
+
onRetryForward: r[3] ||= (e) => d("retryForward"),
|
|
2121
|
+
onReelAudioChange: r[4] ||= (e) => d("reelAudioChange", e)
|
|
1998
2122
|
}, null, 8, [
|
|
1999
2123
|
"can-retry-end",
|
|
2000
2124
|
"card-footer",
|
|
@@ -2013,11 +2137,12 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
2013
2137
|
"next-page-error",
|
|
2014
2138
|
"preview-states",
|
|
2015
2139
|
"reel-auto-advance",
|
|
2140
|
+
"reel-audio-state",
|
|
2016
2141
|
"reel-forward",
|
|
2017
2142
|
"state",
|
|
2018
2143
|
"total"
|
|
2019
|
-
])], 8,
|
|
2020
|
-
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div",
|
|
2144
|
+
])], 8, Ft), u(n, { name: "vibe-info-sheet" }, {
|
|
2145
|
+
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", It, [c("aside", {
|
|
2021
2146
|
ref_key: "sheetElement",
|
|
2022
2147
|
ref: _,
|
|
2023
2148
|
class: "reel-info-sheet",
|
|
@@ -2026,14 +2151,14 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
2026
2151
|
"aria-modal": e.infoSheetOverlay ? "true" : void 0,
|
|
2027
2152
|
tabindex: e.infoSheetOverlay ? -1 : void 0,
|
|
2028
2153
|
"data-active-post-id": T.value?.postId
|
|
2029
|
-
}, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8,
|
|
2154
|
+
}, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8, Lt)])) : o("", !0)]),
|
|
2030
2155
|
_: 1
|
|
2031
|
-
})], 10,
|
|
2156
|
+
})], 10, Pt));
|
|
2032
2157
|
}
|
|
2033
2158
|
});
|
|
2034
2159
|
//#endregion
|
|
2035
2160
|
//#region src/core/mediaLifecycle.ts
|
|
2036
|
-
function
|
|
2161
|
+
function zt(e, t, n, r, i) {
|
|
2037
2162
|
let a = e.items.findIndex((e) => e.postId === t), o = e.items[a];
|
|
2038
2163
|
if (!o) return null;
|
|
2039
2164
|
let s = F(o, n), c = I(o, s);
|
|
@@ -2049,7 +2174,7 @@ function Ft(e, t, n, r, i) {
|
|
|
2049
2174
|
postIndex: a
|
|
2050
2175
|
};
|
|
2051
2176
|
}
|
|
2052
|
-
function
|
|
2177
|
+
function Bt(e, t) {
|
|
2053
2178
|
O(() => {
|
|
2054
2179
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null;
|
|
2055
2180
|
return {
|
|
@@ -2059,20 +2184,20 @@ function It(e, t) {
|
|
|
2059
2184
|
};
|
|
2060
2185
|
}, (n, r) => {
|
|
2061
2186
|
if (n.postId === null || n.postId === r?.postId && n.mediaIndex === r.mediaIndex && n.origin === r.origin) return;
|
|
2062
|
-
let i =
|
|
2187
|
+
let i = zt(e, n.postId, n.mediaIndex, "reel", n.origin);
|
|
2063
2188
|
i && t(i);
|
|
2064
2189
|
}, { flush: "sync" });
|
|
2065
2190
|
}
|
|
2066
2191
|
//#endregion
|
|
2067
2192
|
//#region src/components/useMediaLifecycle.ts
|
|
2068
|
-
function
|
|
2193
|
+
function Vt(e, t) {
|
|
2069
2194
|
let n = w(/* @__PURE__ */ new Map()), i = w(/* @__PURE__ */ new Map()), a = w(/* @__PURE__ */ new Map()), o = () => e.reelMediaSource === "preview" ? n : e.reelMediaSource === "mobile" ? a : i, s = r(() => o().value);
|
|
2070
2195
|
function c(e, t, n, r) {
|
|
2071
2196
|
let i = L(t, n);
|
|
2072
2197
|
e.value.get(i) !== r && (e.value = new Map(e.value).set(i, r));
|
|
2073
2198
|
}
|
|
2074
2199
|
function l(t, n, r, i) {
|
|
2075
|
-
return
|
|
2200
|
+
return zt(e, t, n, r, i);
|
|
2076
2201
|
}
|
|
2077
2202
|
function u(e, n, r, i) {
|
|
2078
2203
|
let a = l(e, n, r, i);
|
|
@@ -2094,7 +2219,7 @@ function Lt(e, t) {
|
|
|
2094
2219
|
let r = l(e, n, "masonry", null);
|
|
2095
2220
|
r && t.visible(r);
|
|
2096
2221
|
}
|
|
2097
|
-
return
|
|
2222
|
+
return Bt(e, t.reelChange), O(() => {
|
|
2098
2223
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null, n = t === null ? 0 : e.mediaIndices.get(t) ?? 0;
|
|
2099
2224
|
return {
|
|
2100
2225
|
mediaIndex: n,
|
|
@@ -2119,16 +2244,16 @@ function Lt(e, t) {
|
|
|
2119
2244
|
}
|
|
2120
2245
|
//#endregion
|
|
2121
2246
|
//#region src/core/reelEscapeStack.ts
|
|
2122
|
-
var
|
|
2123
|
-
function
|
|
2124
|
-
return
|
|
2125
|
-
let t =
|
|
2126
|
-
t >= 0 &&
|
|
2247
|
+
var Ht = [];
|
|
2248
|
+
function Ut(e) {
|
|
2249
|
+
return Ht.push(e), () => {
|
|
2250
|
+
let t = Ht.indexOf(e);
|
|
2251
|
+
t >= 0 && Ht.splice(t, 1);
|
|
2127
2252
|
};
|
|
2128
2253
|
}
|
|
2129
|
-
function
|
|
2254
|
+
function Wt(e) {
|
|
2130
2255
|
if (!e.isActive()) return !1;
|
|
2131
|
-
let t =
|
|
2256
|
+
let t = Ht.filter((e) => e.isActive()), n = e.element();
|
|
2132
2257
|
return n !== null && t.some((t) => {
|
|
2133
2258
|
if (t === e) return !1;
|
|
2134
2259
|
let r = t.element();
|
|
@@ -2144,14 +2269,14 @@ function Bt(e) {
|
|
|
2144
2269
|
}
|
|
2145
2270
|
//#endregion
|
|
2146
2271
|
//#region src/components/useReelKeyboard.ts
|
|
2147
|
-
function
|
|
2272
|
+
function Gt(e) {
|
|
2148
2273
|
let t = {
|
|
2149
2274
|
element: e.element,
|
|
2150
2275
|
isActive: () => e.state.layout === "reel" || e.state.reelOrigin === "masonry"
|
|
2151
2276
|
}, n = null;
|
|
2152
2277
|
function r(n) {
|
|
2153
2278
|
let r = t.isActive();
|
|
2154
|
-
if (n.key === "Escape" && r && !
|
|
2279
|
+
if (n.key === "Escape" && r && !Wt(t)) return;
|
|
2155
2280
|
if (n.key === "Escape" && e.state.reelOrigin === "masonry") {
|
|
2156
2281
|
n.preventDefault(), e.state.reelInfoSheetOverlay && e.state.reelInfoSheet.enabled && e.setReelInfoSheet(!1), e.closeMasonryReel();
|
|
2157
2282
|
return;
|
|
@@ -2171,14 +2296,14 @@ function Vt(e) {
|
|
|
2171
2296
|
a !== 0 && e.reelRenderer()?.changeActiveMedia?.(a) && n.preventDefault();
|
|
2172
2297
|
}
|
|
2173
2298
|
y(() => {
|
|
2174
|
-
n =
|
|
2299
|
+
n = Ut(t), window.addEventListener("keydown", r);
|
|
2175
2300
|
}), v(() => {
|
|
2176
2301
|
window.removeEventListener("keydown", r), n?.(), n = null;
|
|
2177
2302
|
});
|
|
2178
2303
|
}
|
|
2179
2304
|
//#endregion
|
|
2180
2305
|
//#region src/components/VibeSurface.vue?vue&type=script&setup=true&lang.ts
|
|
2181
|
-
var
|
|
2306
|
+
var Kt = 35, qt = 420, Jt = /* @__PURE__ */ d({
|
|
2182
2307
|
__name: "VibeSurface",
|
|
2183
2308
|
props: {
|
|
2184
2309
|
canRetryEnd: { type: Boolean },
|
|
@@ -2189,6 +2314,7 @@ var Ht = 35, Ut = 420, Wt = /* @__PURE__ */ d({
|
|
|
2189
2314
|
mediaCard: {},
|
|
2190
2315
|
masonry: {},
|
|
2191
2316
|
reelInfoSheet: {},
|
|
2317
|
+
reelAudioState: {},
|
|
2192
2318
|
state: {}
|
|
2193
2319
|
},
|
|
2194
2320
|
emits: [
|
|
@@ -2200,74 +2326,75 @@ var Ht = 35, Ut = 420, Wt = /* @__PURE__ */ d({
|
|
|
2200
2326
|
"openReel",
|
|
2201
2327
|
"reelMediaChange",
|
|
2202
2328
|
"reelInfoSheetChange",
|
|
2329
|
+
"reelAudioChange",
|
|
2203
2330
|
"retryEnd",
|
|
2204
2331
|
"retryForward"
|
|
2205
2332
|
],
|
|
2206
2333
|
setup(t, { expose: i, emit: c }) {
|
|
2207
|
-
let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), y = w({}), x = w(!1), S = w(/* @__PURE__ */ new Set()), C = w(/* @__PURE__ */ new Map()), T = w(/* @__PURE__ */ new Set()), D = w(/* @__PURE__ */ new Map()), A = r(() => Object.freeze([...l.state.items])), j = r(() => z(l.state, A.value)), { markMasonryVisible: M, markPreviewError: N, markPreviewReady: I, markReelError: L, markReelReady: R, originalStates: B, previewStates: V, reelStates:
|
|
2334
|
+
let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), y = w({}), x = w(!1), S = w(/* @__PURE__ */ new Set()), C = w(/* @__PURE__ */ new Map()), T = w(/* @__PURE__ */ new Set()), D = w(/* @__PURE__ */ new Map()), A = r(() => Object.freeze([...l.state.items])), j = r(() => z(l.state, A.value)), { markMasonryVisible: M, markPreviewError: N, markPreviewReady: I, markReelError: L, markReelReady: R, originalStates: B, previewStates: V, reelStates: ee } = Vt(l.state, {
|
|
2208
2335
|
ready: (e) => d("mediaReady", e),
|
|
2209
2336
|
reelChange: (e) => d("reelMediaChange", e),
|
|
2210
2337
|
visible: (e) => d("mediaVisible", e)
|
|
2211
|
-
}),
|
|
2212
|
-
function
|
|
2338
|
+
}), H = new Set(l.state.items.map((e) => e.postId)), U = null, W = null, G = !1;
|
|
2339
|
+
function K() {
|
|
2213
2340
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
2214
2341
|
}
|
|
2215
|
-
function
|
|
2342
|
+
function q() {
|
|
2216
2343
|
U !== null && cancelAnimationFrame(U), U = requestAnimationFrame(() => {
|
|
2217
2344
|
U = requestAnimationFrame(() => {
|
|
2218
2345
|
U = null, S.value = /* @__PURE__ */ new Set();
|
|
2219
2346
|
});
|
|
2220
2347
|
});
|
|
2221
2348
|
}
|
|
2222
|
-
function
|
|
2349
|
+
function J(e, t) {
|
|
2223
2350
|
let n = l.state.items.find((t) => t.postId === e);
|
|
2224
2351
|
if (!n) return;
|
|
2225
2352
|
let r = F(n, t);
|
|
2226
2353
|
(l.state.mediaIndices.get(e) ?? 0) !== r && (l.state.mediaIndices = new Map(l.state.mediaIndices).set(e, r));
|
|
2227
2354
|
}
|
|
2228
|
-
async function
|
|
2355
|
+
async function Y() {
|
|
2229
2356
|
await m(), (l.state.layout === "reel" || l.state.reelOrigin === "masonry" ? p.value : f.value)?.loadIfNearBottom();
|
|
2230
2357
|
}
|
|
2231
|
-
function
|
|
2358
|
+
function ne(e) {
|
|
2232
2359
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.changeActiveMedia?.(e) ?? !1;
|
|
2233
2360
|
}
|
|
2234
|
-
function
|
|
2361
|
+
function re(e) {
|
|
2235
2362
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.moveActivePost?.(e) ?? !1;
|
|
2236
2363
|
}
|
|
2237
|
-
function
|
|
2364
|
+
function ie(e) {
|
|
2238
2365
|
if (!(l.state.layout === "reel" || l.state.reelOrigin === "masonry") || l.state.isLoading) return "reel-inactive";
|
|
2239
2366
|
let t = l.state.items.find((t) => t.postId === e.postId);
|
|
2240
2367
|
if (!t) return "not-found";
|
|
2241
2368
|
let n = P(t).findIndex((t) => t.mediaId === e.mediaId);
|
|
2242
2369
|
return n < 0 ? "not-found" : p.value?.navigateToItem?.(e.postId, n) ? "navigated" : "reel-inactive";
|
|
2243
2370
|
}
|
|
2244
|
-
function
|
|
2371
|
+
function ae() {
|
|
2245
2372
|
return l.state.layout !== "masonry" || l.state.reelOrigin === "masonry" ? null : f.value?.getScrollElement?.() ?? null;
|
|
2246
2373
|
}
|
|
2247
|
-
function
|
|
2248
|
-
W = e,
|
|
2374
|
+
function X(e, t) {
|
|
2375
|
+
W = e, G = t === "keyboard", y.value = le(e), d("openReel", e), m(() => h.value?.focus());
|
|
2249
2376
|
}
|
|
2250
|
-
function
|
|
2377
|
+
function oe(e) {
|
|
2251
2378
|
let t = g.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [];
|
|
2252
2379
|
return Array.from(t).find((t) => t.dataset.postId === String(e)) ?? null;
|
|
2253
2380
|
}
|
|
2254
|
-
function
|
|
2255
|
-
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null ||
|
|
2256
|
-
let n = [...new Set(e)], r = n.filter(
|
|
2381
|
+
function se(e, t) {
|
|
2382
|
+
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || K()) return 0;
|
|
2383
|
+
let n = [...new Set(e)], r = n.filter(oe);
|
|
2257
2384
|
if (r.length === 0) return 0;
|
|
2258
|
-
let i = new Map(D.value), a = t?.staggerMs ??
|
|
2385
|
+
let i = new Map(D.value), a = t?.staggerMs ?? Kt;
|
|
2259
2386
|
return r.forEach((e, t) => {
|
|
2260
2387
|
i.set(e, t * a);
|
|
2261
|
-
}), S.value = new Set([...S.value].filter((e) => !r.includes(e))), T.value = new Set([...T.value, ...n]), D.value = i,
|
|
2388
|
+
}), S.value = new Set([...S.value].filter((e) => !r.includes(e))), T.value = new Set([...T.value, ...n]), D.value = i, qt + (r.length - 1) * a;
|
|
2262
2389
|
}
|
|
2263
|
-
function
|
|
2264
|
-
let n =
|
|
2390
|
+
function ce(e, t) {
|
|
2391
|
+
let n = oe(e), r = n?.querySelector(".media-card-activator") ?? n;
|
|
2265
2392
|
r && (r.classList.toggle("media-card-focus-silent", !t), t || r.addEventListener("blur", () => {
|
|
2266
2393
|
r.classList.remove("media-card-focus-silent");
|
|
2267
2394
|
}, { once: !0 }), r?.focus({ preventScroll: !0 }));
|
|
2268
2395
|
}
|
|
2269
|
-
function
|
|
2270
|
-
let t = g.value, n =
|
|
2396
|
+
function le(e) {
|
|
2397
|
+
let t = g.value, n = oe(e);
|
|
2271
2398
|
if (t === null || n === null) return {};
|
|
2272
2399
|
let r = t.getBoundingClientRect(), i = n.getBoundingClientRect();
|
|
2273
2400
|
return {
|
|
@@ -2277,48 +2404,48 @@ var Ht = 35, Ut = 420, Wt = /* @__PURE__ */ d({
|
|
|
2277
2404
|
"--vibe-reel-origin-left": `${Math.max(0, i.left - r.left)}px`
|
|
2278
2405
|
};
|
|
2279
2406
|
}
|
|
2280
|
-
function
|
|
2407
|
+
function Z() {
|
|
2281
2408
|
l.state.reelOrigin === "masonry" && (W ??= l.state.activeReelPostId, x.value = !0, d("closeReel"));
|
|
2282
2409
|
}
|
|
2283
2410
|
function ue() {
|
|
2284
|
-
let e = W, t =
|
|
2285
|
-
x.value = !1, W = null,
|
|
2286
|
-
e !== null &&
|
|
2411
|
+
let e = W, t = G;
|
|
2412
|
+
x.value = !1, W = null, G = !1, y.value = {}, m(() => {
|
|
2413
|
+
e !== null && ce(e, t);
|
|
2287
2414
|
});
|
|
2288
2415
|
}
|
|
2289
|
-
return
|
|
2290
|
-
closeMasonryReel:
|
|
2416
|
+
return Gt({
|
|
2417
|
+
closeMasonryReel: Z,
|
|
2291
2418
|
element: () => g.value,
|
|
2292
2419
|
isReelLeaving: () => x.value,
|
|
2293
2420
|
reelRenderer: () => p.value,
|
|
2294
2421
|
setReelInfoSheet: (e) => d("reelInfoSheetChange", e),
|
|
2295
2422
|
state: l.state
|
|
2296
2423
|
}), O(() => l.state.items.map((e) => e.postId), (e) => {
|
|
2297
|
-
let t = e.filter((e) => !
|
|
2298
|
-
if (
|
|
2424
|
+
let t = e.filter((e) => !H.has(e)), n = new Set(e);
|
|
2425
|
+
if (H = new Set(e), T.value = new Set([...T.value].filter((e) => n.has(e))), D.value = new Map([...D.value].filter(([e]) => n.has(e))), t.length === 0 || K()) return;
|
|
2299
2426
|
let r = /* @__PURE__ */ new Map();
|
|
2300
2427
|
e.forEach((e) => {
|
|
2301
2428
|
let t = C.value.get(e);
|
|
2302
2429
|
t !== void 0 && r.set(e, t);
|
|
2303
2430
|
}), t.forEach((e, t) => {
|
|
2304
|
-
r.set(e, t *
|
|
2305
|
-
}), C.value = r, S.value = new Set([...S.value, ...t]),
|
|
2431
|
+
r.set(e, t * Kt);
|
|
2432
|
+
}), C.value = r, S.value = new Set([...S.value, ...t]), q();
|
|
2306
2433
|
}, { flush: "sync" }), v(() => {
|
|
2307
2434
|
U !== null && cancelAnimationFrame(U);
|
|
2308
2435
|
}), i({
|
|
2309
|
-
changeActiveReelMedia:
|
|
2310
|
-
getAutoScrollElement:
|
|
2311
|
-
loadIfNearBottom:
|
|
2312
|
-
moveActiveReelPost:
|
|
2313
|
-
navigateToReelItem:
|
|
2314
|
-
startItemRemoval:
|
|
2436
|
+
changeActiveReelMedia: ne,
|
|
2437
|
+
getAutoScrollElement: ae,
|
|
2438
|
+
loadIfNearBottom: Y,
|
|
2439
|
+
moveActiveReelPost: re,
|
|
2440
|
+
navigateToReelItem: ie,
|
|
2441
|
+
startItemRemoval: se,
|
|
2315
2442
|
transitionActiveReelMedia: (e) => p.value?.transitionActiveMedia?.(e) ?? Promise.resolve(!1),
|
|
2316
2443
|
transitionActiveReelPost: (e) => p.value?.transitionActivePost?.(e) ?? Promise.resolve(!1)
|
|
2317
2444
|
}), (r, i) => (b(), s("div", {
|
|
2318
2445
|
ref_key: "surfaceElement",
|
|
2319
2446
|
ref: g,
|
|
2320
2447
|
class: "vibe-surface"
|
|
2321
|
-
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(
|
|
2448
|
+
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(Rt, {
|
|
2322
2449
|
key: 0,
|
|
2323
2450
|
ref_key: "reelRenderer",
|
|
2324
2451
|
ref: p,
|
|
@@ -2343,8 +2470,9 @@ var Ht = 35, Ut = 420, Wt = /* @__PURE__ */ d({
|
|
|
2343
2470
|
"info-sheet-overlay": t.state.reelInfoSheetOverlay,
|
|
2344
2471
|
"next-page-error": !!t.state.nextPageError,
|
|
2345
2472
|
origin: "reel",
|
|
2346
|
-
"preview-states": E(
|
|
2473
|
+
"preview-states": E(ee),
|
|
2347
2474
|
"reel-auto-advance": t.state.reelAutoAdvance,
|
|
2475
|
+
"reel-audio-state": t.reelAudioState,
|
|
2348
2476
|
"reel-forward": t.state.reelForward,
|
|
2349
2477
|
state: j.value,
|
|
2350
2478
|
total: t.state.total,
|
|
@@ -2352,24 +2480,25 @@ var Ht = 35, Ut = 420, Wt = /* @__PURE__ */ d({
|
|
|
2352
2480
|
onCloseInfoSheet: i[1] ||= (e) => d("reelInfoSheetChange", !1),
|
|
2353
2481
|
onError: E(L),
|
|
2354
2482
|
onLoadMore: i[2] ||= (e) => d("loadMore"),
|
|
2355
|
-
onMediaChange:
|
|
2483
|
+
onMediaChange: J,
|
|
2356
2484
|
onReady: E(R),
|
|
2357
2485
|
onRetryEnd: i[3] ||= (e) => d("retryEnd"),
|
|
2358
|
-
onRetryForward: i[4] ||= (e) => d("retryForward")
|
|
2359
|
-
|
|
2486
|
+
onRetryForward: i[4] ||= (e) => d("retryForward"),
|
|
2487
|
+
onReelAudioChange: i[5] ||= (e) => d("reelAudioChange", e)
|
|
2488
|
+
}, null, 8, /* @__PURE__ */ "can-retry-end.has-next.card-footer.card-header.feed-footer.feed-footer-actions.forward-index.forward-item.media-card.infinite-scroll.is-loading-more.items.load-more-locked.media-source.media-indices.initial-post-id.info-sheet.info-sheet-enabled.info-sheet-overlay.next-page-error.preview-states.reel-auto-advance.reel-audio-state.reel-forward.state.total.onError.onReady".split("."))) : t.state.error || t.state.isLoading || t.state.items.length === 0 && t.state.reelForward.status === "idle" ? (b(), a(te, {
|
|
2360
2489
|
key: 1,
|
|
2361
2490
|
actions: t.feedFooterActions,
|
|
2362
2491
|
"can-retry-end": t.canRetryEnd,
|
|
2363
2492
|
"feed-footer": t.feedFooter,
|
|
2364
2493
|
state: j.value,
|
|
2365
|
-
onLoadMore: i[
|
|
2366
|
-
onRetryEnd: i[
|
|
2494
|
+
onLoadMore: i[6] ||= (e) => d("loadMore"),
|
|
2495
|
+
onRetryEnd: i[7] ||= (e) => d("retryEnd")
|
|
2367
2496
|
}, null, 8, [
|
|
2368
2497
|
"actions",
|
|
2369
2498
|
"can-retry-end",
|
|
2370
2499
|
"feed-footer",
|
|
2371
2500
|
"state"
|
|
2372
|
-
])) : (b(), s(e, { key: 2 }, [u(
|
|
2501
|
+
])) : (b(), s(e, { key: 2 }, [u(Ct, {
|
|
2373
2502
|
ref_key: "masonryRenderer",
|
|
2374
2503
|
ref: f,
|
|
2375
2504
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2394,12 +2523,12 @@ var Ht = 35, Ut = 420, Wt = /* @__PURE__ */ d({
|
|
|
2394
2523
|
suspended: t.state.reelOrigin === "masonry" || x.value,
|
|
2395
2524
|
state: j.value,
|
|
2396
2525
|
total: t.state.total,
|
|
2397
|
-
onActivate:
|
|
2526
|
+
onActivate: X,
|
|
2398
2527
|
onError: E(N),
|
|
2399
|
-
onLoadMore: i[
|
|
2400
|
-
onMediaChange:
|
|
2528
|
+
onLoadMore: i[8] ||= (e) => d("loadMore"),
|
|
2529
|
+
onMediaChange: J,
|
|
2401
2530
|
onReady: E(I),
|
|
2402
|
-
onRetryEnd: i[
|
|
2531
|
+
onRetryEnd: i[9] ||= (e) => d("retryEnd"),
|
|
2403
2532
|
onVisible: E(M)
|
|
2404
2533
|
}, null, 8, [
|
|
2405
2534
|
"can-retry-end",
|
|
@@ -2441,7 +2570,7 @@ var Ht = 35, Ut = 420, Wt = /* @__PURE__ */ d({
|
|
|
2441
2570
|
"aria-modal": "true",
|
|
2442
2571
|
tabindex: "-1",
|
|
2443
2572
|
style: _(y.value)
|
|
2444
|
-
}, [u(
|
|
2573
|
+
}, [u(Rt, {
|
|
2445
2574
|
ref_key: "reelRenderer",
|
|
2446
2575
|
ref: p,
|
|
2447
2576
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2467,51 +2596,53 @@ var Ht = 35, Ut = 420, Wt = /* @__PURE__ */ d({
|
|
|
2467
2596
|
origin: "masonry",
|
|
2468
2597
|
"preview-states": E(B),
|
|
2469
2598
|
"reel-auto-advance": t.state.reelAutoAdvance,
|
|
2599
|
+
"reel-audio-state": t.reelAudioState,
|
|
2470
2600
|
"reel-forward": t.state.reelForward,
|
|
2471
2601
|
state: j.value,
|
|
2472
2602
|
total: t.state.total,
|
|
2473
|
-
onActiveChange: i[
|
|
2474
|
-
onCloseInfoSheet: i[
|
|
2603
|
+
onActiveChange: i[10] ||= (e) => d("activeReelChange", e),
|
|
2604
|
+
onCloseInfoSheet: i[11] ||= (e) => d("reelInfoSheetChange", !1),
|
|
2475
2605
|
onError: E(L),
|
|
2476
|
-
onLoadMore: i[
|
|
2477
|
-
onMediaChange:
|
|
2606
|
+
onLoadMore: i[12] ||= (e) => d("loadMore"),
|
|
2607
|
+
onMediaChange: J,
|
|
2478
2608
|
onReady: E(R),
|
|
2479
|
-
onRetryEnd: i[
|
|
2480
|
-
onRetryForward: i[
|
|
2481
|
-
|
|
2609
|
+
onRetryEnd: i[13] ||= (e) => d("retryEnd"),
|
|
2610
|
+
onRetryForward: i[14] ||= (e) => d("retryForward"),
|
|
2611
|
+
onReelAudioChange: i[15] ||= (e) => d("reelAudioChange", e)
|
|
2612
|
+
}, null, 8, /* @__PURE__ */ "can-retry-end.card-footer.card-header.feed-footer.feed-footer-actions.forward-index.forward-item.media-card.has-next.infinite-scroll.initial-post-id.info-sheet.info-sheet-enabled.info-sheet-overlay.is-loading-more.items.load-more-locked.media-indices.next-page-error.preview-states.reel-auto-advance.reel-audio-state.reel-forward.state.total.onError.onReady".split("."))], 4)) : o("", !0)]),
|
|
2482
2613
|
_: 1
|
|
2483
2614
|
})], 64))], 512));
|
|
2484
2615
|
}
|
|
2485
2616
|
});
|
|
2486
2617
|
//#endregion
|
|
2487
2618
|
//#region src/core/page.ts
|
|
2488
|
-
function
|
|
2619
|
+
function Yt(e) {
|
|
2489
2620
|
if (!e || typeof e != "object" || !Array.isArray(e.items)) throw TypeError("Vibe loadPage must resolve to a page with an items array.");
|
|
2490
2621
|
if (e.current !== void 0 && e.current !== null && typeof e.current != "string" && typeof e.current != "number") throw TypeError("Vibe page current must be a string, number, null, or undefined.");
|
|
2491
2622
|
if (e.next !== null && typeof e.next != "string" && typeof e.next != "number") throw TypeError("Vibe page next must be a string, number, or null.");
|
|
2492
2623
|
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.");
|
|
2493
2624
|
return e;
|
|
2494
2625
|
}
|
|
2495
|
-
function
|
|
2626
|
+
function $(e, t) {
|
|
2496
2627
|
let n = new Set(e.map((e) => e.postId));
|
|
2497
2628
|
return [...e, ...t.filter((e) => n.has(e.postId) ? !1 : (n.add(e.postId), !0))];
|
|
2498
2629
|
}
|
|
2499
|
-
function
|
|
2630
|
+
function Xt(e) {
|
|
2500
2631
|
return `${typeof e}:${String(e)}`;
|
|
2501
2632
|
}
|
|
2502
|
-
function
|
|
2503
|
-
return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview.src}` : `id:${
|
|
2633
|
+
function Zt(e) {
|
|
2634
|
+
return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview.src}` : `id:${Xt(e.mediaId)}`;
|
|
2504
2635
|
}
|
|
2505
|
-
function
|
|
2506
|
-
let n = [...e], r = new Map(e.map((e, t) => [
|
|
2636
|
+
function Qt(e, t) {
|
|
2637
|
+
let n = [...e], r = new Map(e.map((e, t) => [Xt(e.postId), t]));
|
|
2507
2638
|
return t.forEach((e) => {
|
|
2508
|
-
let t =
|
|
2639
|
+
let t = Xt(e.postId), i = r.get(t);
|
|
2509
2640
|
if (i === void 0) {
|
|
2510
2641
|
r.set(t, n.length), n.push(e);
|
|
2511
2642
|
return;
|
|
2512
2643
|
}
|
|
2513
|
-
let a = n[i], o = new Set([a, ...a.items].map(
|
|
2514
|
-
let t =
|
|
2644
|
+
let a = n[i], o = new Set([a, ...a.items].map(Zt)), s = [e, ...e.items].filter((e) => {
|
|
2645
|
+
let t = Zt(e);
|
|
2515
2646
|
return o.has(t) ? !1 : (o.add(t), !0);
|
|
2516
2647
|
});
|
|
2517
2648
|
s.length > 0 && (n[i] = {
|
|
@@ -2520,14 +2651,14 @@ function Jt(e, t) {
|
|
|
2520
2651
|
});
|
|
2521
2652
|
}), n;
|
|
2522
2653
|
}
|
|
2523
|
-
function
|
|
2654
|
+
function $t(e) {
|
|
2524
2655
|
return Object.prototype.hasOwnProperty.call(e, "current") ? e.current ?? null : e.next;
|
|
2525
2656
|
}
|
|
2526
2657
|
//#endregion
|
|
2527
2658
|
//#region src/core/appendPage.ts
|
|
2528
|
-
function
|
|
2529
|
-
let i =
|
|
2530
|
-
t.items =
|
|
2659
|
+
function en(e, t, n, r) {
|
|
2660
|
+
let i = Yt(e), a = n.filterItems(i.items), o = $t(i);
|
|
2661
|
+
t.items = Qt(t.items, a), t.next = i.next, i.total !== void 0 && (t.total = i.total), r(o), n.recordPages([{
|
|
2531
2662
|
contributionIds: a.map(({ postId: e }) => e),
|
|
2532
2663
|
cursor: o,
|
|
2533
2664
|
next: i.next,
|
|
@@ -2536,32 +2667,32 @@ function Xt(e, t, n, r) {
|
|
|
2536
2667
|
}
|
|
2537
2668
|
//#endregion
|
|
2538
2669
|
//#region src/core/requestDelay.ts
|
|
2539
|
-
var
|
|
2670
|
+
var tn = 2e3, nn = 1e4, rn = 250, an = {
|
|
2540
2671
|
delayRemainingMs: null,
|
|
2541
2672
|
nextRequestAt: null
|
|
2542
2673
|
};
|
|
2543
|
-
function
|
|
2674
|
+
function on(e, t) {
|
|
2544
2675
|
return e === void 0 ? t : Math.floor(e);
|
|
2545
2676
|
}
|
|
2546
|
-
function
|
|
2677
|
+
function sn(e, t) {
|
|
2547
2678
|
for (let [n, r] of [["delayStepMs", e.delayStepMs], ["delayMaxMs", e.delayMaxMs]]) if (r !== void 0 && (!Number.isFinite(r) || r < 0)) throw TypeError(`Vibe ${t} ${n} must be a non-negative number.`);
|
|
2548
2679
|
}
|
|
2549
|
-
function
|
|
2550
|
-
let n =
|
|
2680
|
+
function cn(e, t = {}) {
|
|
2681
|
+
let n = on(t.delayStepMs, tn), r = on(t.delayMaxMs, nn);
|
|
2551
2682
|
return Math.min(Math.max(0, e) * n, r);
|
|
2552
2683
|
}
|
|
2553
|
-
function
|
|
2554
|
-
if (e == null || !Number.isFinite(e)) return { ...
|
|
2684
|
+
function ln(e) {
|
|
2685
|
+
if (e == null || !Number.isFinite(e)) return { ...an };
|
|
2555
2686
|
let t = Math.max(0, Math.floor(e - Date.now()));
|
|
2556
2687
|
return t > 0 ? {
|
|
2557
2688
|
delayRemainingMs: t,
|
|
2558
2689
|
nextRequestAt: e
|
|
2559
|
-
} : { ...
|
|
2690
|
+
} : { ...an };
|
|
2560
2691
|
}
|
|
2561
|
-
async function
|
|
2692
|
+
async function un({ delayMs: e, onChange: t, signal: n }) {
|
|
2562
2693
|
if (n.aborted) throw new DOMException("Aborted", "AbortError");
|
|
2563
2694
|
if (e <= 0) {
|
|
2564
|
-
t({ ...
|
|
2695
|
+
t({ ...an });
|
|
2565
2696
|
return;
|
|
2566
2697
|
}
|
|
2567
2698
|
let r = Date.now() + e;
|
|
@@ -2569,9 +2700,9 @@ async function an({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2569
2700
|
delayRemainingMs: e,
|
|
2570
2701
|
nextRequestAt: r
|
|
2571
2702
|
}), await new Promise((i, a) => {
|
|
2572
|
-
let o = !1, s = setInterval(f,
|
|
2703
|
+
let o = !1, s = setInterval(f, rn), c = setTimeout(() => u(), e);
|
|
2573
2704
|
function l() {
|
|
2574
|
-
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...
|
|
2705
|
+
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...an });
|
|
2575
2706
|
}
|
|
2576
2707
|
function u(e) {
|
|
2577
2708
|
o || (o = !0, l(), e ? a(e) : i());
|
|
@@ -2580,42 +2711,42 @@ async function an({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2580
2711
|
u(new DOMException("Aborted", "AbortError"));
|
|
2581
2712
|
}
|
|
2582
2713
|
function f() {
|
|
2583
|
-
let e =
|
|
2714
|
+
let e = ln(r);
|
|
2584
2715
|
t(e), e.delayRemainingMs === null && u();
|
|
2585
2716
|
}
|
|
2586
2717
|
n.addEventListener("abort", d, { once: !0 });
|
|
2587
2718
|
});
|
|
2588
2719
|
}
|
|
2589
|
-
var
|
|
2720
|
+
var dn = class {
|
|
2590
2721
|
interval = null;
|
|
2591
2722
|
constructor(e) {
|
|
2592
2723
|
this.onChange = e;
|
|
2593
2724
|
}
|
|
2594
2725
|
clear() {
|
|
2595
|
-
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...
|
|
2726
|
+
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...an });
|
|
2596
2727
|
}
|
|
2597
2728
|
sync(e) {
|
|
2598
2729
|
this.clear();
|
|
2599
|
-
let t =
|
|
2730
|
+
let t = ln(e);
|
|
2600
2731
|
this.onChange(t), t.delayRemainingMs !== null && (this.interval = setInterval(() => {
|
|
2601
|
-
let t =
|
|
2732
|
+
let t = ln(e);
|
|
2602
2733
|
this.onChange(t), t.delayRemainingMs === null && this.clear();
|
|
2603
|
-
},
|
|
2734
|
+
}, rn));
|
|
2604
2735
|
}
|
|
2605
2736
|
};
|
|
2606
|
-
function
|
|
2737
|
+
function fn(e, t = !0) {
|
|
2607
2738
|
return e.maxAdditionalPages === "unlimited" ? Infinity : (e.maxAdditionalPages ?? 10) + (t ? 1 : 0);
|
|
2608
2739
|
}
|
|
2609
|
-
function
|
|
2740
|
+
function pn(e) {
|
|
2610
2741
|
return `${typeof e}:${String(e)}`;
|
|
2611
2742
|
}
|
|
2612
|
-
function
|
|
2743
|
+
function mn(e, t) {
|
|
2613
2744
|
if (!Number.isInteger(e) || e <= 0) throw TypeError(`Vibe ${t} must be a positive integer.`);
|
|
2614
2745
|
}
|
|
2615
|
-
function
|
|
2746
|
+
function hn(e) {
|
|
2616
2747
|
if (!e) return;
|
|
2617
|
-
if (
|
|
2618
|
-
|
|
2748
|
+
if (mn(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
|
|
2749
|
+
sn(e, "frontend autofill");
|
|
2619
2750
|
let t = e.maxAdditionalPages;
|
|
2620
2751
|
if (t !== void 0 && t !== "unlimited" && (!Number.isInteger(t) || t < 0)) throw TypeError("Vibe autofill maxAdditionalPages must be a non-negative integer or \"unlimited\".");
|
|
2621
2752
|
return;
|
|
@@ -2627,7 +2758,7 @@ function un(e) {
|
|
|
2627
2758
|
if (t.pageSize !== e.pageSize) throw TypeError("Vibe backend autofill initialSession pageSize must match autofill pageSize.");
|
|
2628
2759
|
}
|
|
2629
2760
|
}
|
|
2630
|
-
function
|
|
2761
|
+
function gn(e, t, n = !0) {
|
|
2631
2762
|
if (!e) return {
|
|
2632
2763
|
cycleId: null,
|
|
2633
2764
|
delayRemainingMs: null,
|
|
@@ -2644,7 +2775,7 @@ function dn(e, t, n = !0) {
|
|
|
2644
2775
|
status: "idle",
|
|
2645
2776
|
strategy: null
|
|
2646
2777
|
};
|
|
2647
|
-
let r = e.strategy === "backend" ? t ?? (n ? e.initialSession : void 0) : void 0, i = r?.received ?? 0, a =
|
|
2778
|
+
let r = e.strategy === "backend" ? t ?? (n ? e.initialSession : void 0) : void 0, i = r?.received ?? 0, a = ln(r?.nextRequestAt);
|
|
2648
2779
|
return {
|
|
2649
2780
|
cycleId: r?.cycleId ?? null,
|
|
2650
2781
|
...a,
|
|
@@ -2661,7 +2792,7 @@ function dn(e, t, n = !0) {
|
|
|
2661
2792
|
strategy: e.strategy
|
|
2662
2793
|
};
|
|
2663
2794
|
}
|
|
2664
|
-
function
|
|
2795
|
+
function _n(e) {
|
|
2665
2796
|
return [
|
|
2666
2797
|
"cancelling",
|
|
2667
2798
|
"filling",
|
|
@@ -2669,9 +2800,9 @@ function fn(e) {
|
|
|
2669
2800
|
"waiting"
|
|
2670
2801
|
].includes(e.status);
|
|
2671
2802
|
}
|
|
2672
|
-
async function
|
|
2803
|
+
async function vn(e, t, n) {
|
|
2673
2804
|
let r = t.autofill;
|
|
2674
|
-
if (!
|
|
2805
|
+
if (!_n(r) || !r.cycleId) return;
|
|
2675
2806
|
let i = {
|
|
2676
2807
|
cycleId: r.cycleId,
|
|
2677
2808
|
feedKey: r.feedKey ?? "",
|
|
@@ -2684,16 +2815,16 @@ async function pn(e, t, n) {
|
|
|
2684
2815
|
throw r.error = e, r.status = "error", e;
|
|
2685
2816
|
}
|
|
2686
2817
|
}
|
|
2687
|
-
function
|
|
2818
|
+
function yn(e, t, n) {
|
|
2688
2819
|
return e?.strategy === "backend" && t.feedKey === e.feedKey && t.sessionId === n.sessionId;
|
|
2689
2820
|
}
|
|
2690
|
-
async function
|
|
2691
|
-
let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ??
|
|
2821
|
+
async function bn({ existingItems: e, initialCursor: t, loadPage: n, maximumRequests: r, onCollection: i, onDelayChange: a, onProgress: o, options: s, receivedOffset: c = 0, requestOffset: l = 0, shouldPause: u = () => !1, signal: d }) {
|
|
2822
|
+
let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ?? fn(s), g = t, _ = t, v = t, y = 0, b = [], x;
|
|
2692
2823
|
for (; y < h;) {
|
|
2693
|
-
let e =
|
|
2824
|
+
let e = pn(g);
|
|
2694
2825
|
if (m.has(e)) throw Error("Vibe autofill received a repeated cursor.");
|
|
2695
|
-
if (m.add(e), await
|
|
2696
|
-
delayMs:
|
|
2826
|
+
if (m.add(e), await un({
|
|
2827
|
+
delayMs: cn(l + y, s),
|
|
2697
2828
|
onChange: a,
|
|
2698
2829
|
signal: d
|
|
2699
2830
|
}), y > 0 && u()) return {
|
|
@@ -2707,12 +2838,12 @@ async function hn({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
2707
2838
|
status: "paused",
|
|
2708
2839
|
total: x
|
|
2709
2840
|
};
|
|
2710
|
-
let t =
|
|
2841
|
+
let t = Yt(await n({
|
|
2711
2842
|
cursor: g,
|
|
2712
2843
|
signal: d
|
|
2713
2844
|
}));
|
|
2714
2845
|
y += 1, _ = g;
|
|
2715
|
-
let r =
|
|
2846
|
+
let r = $(p, t.items).slice(p.length);
|
|
2716
2847
|
b.push({
|
|
2717
2848
|
contributionIds: r.map(({ postId: e }) => e),
|
|
2718
2849
|
cursor: g,
|
|
@@ -2764,12 +2895,12 @@ async function hn({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
2764
2895
|
}
|
|
2765
2896
|
//#endregion
|
|
2766
2897
|
//#region src/core/autofillController.ts
|
|
2767
|
-
var
|
|
2898
|
+
var xn = class {
|
|
2768
2899
|
collection = null;
|
|
2769
2900
|
cycle = 0;
|
|
2770
2901
|
delayCountdown;
|
|
2771
2902
|
constructor(e) {
|
|
2772
|
-
this.context = e, this.delayCountdown = new
|
|
2903
|
+
this.context = e, this.delayCountdown = new dn((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
|
|
2773
2904
|
}
|
|
2774
2905
|
beginCycle() {
|
|
2775
2906
|
let { options: e, state: t } = this.context;
|
|
@@ -2777,14 +2908,14 @@ var gn = class {
|
|
|
2777
2908
|
this.clear();
|
|
2778
2909
|
let n = `vibe-autofill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
2779
2910
|
return t.autofill = {
|
|
2780
|
-
...
|
|
2911
|
+
...gn(e, void 0, !1),
|
|
2781
2912
|
cycleId: n,
|
|
2782
2913
|
status: "filling"
|
|
2783
2914
|
}, n;
|
|
2784
2915
|
}
|
|
2785
2916
|
async cancel() {
|
|
2786
2917
|
let { cancelRequest: e, options: t, state: n } = this.context;
|
|
2787
|
-
await
|
|
2918
|
+
await vn(t, n, e), this.commitCollection();
|
|
2788
2919
|
}
|
|
2789
2920
|
captureCollection(e, t) {
|
|
2790
2921
|
t && (this.collection = e);
|
|
@@ -2806,36 +2937,36 @@ var gn = class {
|
|
|
2806
2937
|
let { onLastCursor: e, options: t, state: n } = this.context;
|
|
2807
2938
|
if (t?.strategy !== "frontend") return !1;
|
|
2808
2939
|
let r = this.collection;
|
|
2809
|
-
return this.collection = null, r ? (n.items =
|
|
2940
|
+
return this.collection = null, r ? (n.items = $(n.items, r.items), e(r.lastCursor), this.context.onPages(r.pages), n.next = r.next, r.total !== void 0 && (n.total = r.total), Object.assign(n.autofill, {
|
|
2810
2941
|
missing: r.missing,
|
|
2811
2942
|
received: r.received,
|
|
2812
2943
|
requests: r.requests
|
|
2813
2944
|
}), !0) : !1;
|
|
2814
2945
|
}
|
|
2815
|
-
},
|
|
2816
|
-
function
|
|
2946
|
+
}, Sn = 100;
|
|
2947
|
+
function Cn(e, t) {
|
|
2817
2948
|
if (!Number.isFinite(t) || t <= 0) throw TypeError(`Vibe ${e} must be a positive number.`);
|
|
2818
2949
|
}
|
|
2819
|
-
function
|
|
2950
|
+
function wn(e, t, n) {
|
|
2820
2951
|
return Math.min(n, Math.max(t, e));
|
|
2821
2952
|
}
|
|
2822
|
-
function
|
|
2953
|
+
function Tn(e) {
|
|
2823
2954
|
if (!e) return;
|
|
2824
2955
|
let t = e.minSpeedPxPerSecond ?? 20, n = e.maxSpeedPxPerSecond ?? 240;
|
|
2825
|
-
if (
|
|
2826
|
-
e.speedPxPerSecond !== void 0 &&
|
|
2956
|
+
if (Cn("autoScroll.minSpeedPxPerSecond", t), Cn("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
|
|
2957
|
+
e.speedPxPerSecond !== void 0 && Cn("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
|
|
2827
2958
|
}
|
|
2828
|
-
function
|
|
2959
|
+
function En(e) {
|
|
2829
2960
|
let t = e?.minSpeedPxPerSecond ?? 20, n = e?.maxSpeedPxPerSecond ?? 240;
|
|
2830
2961
|
return {
|
|
2831
2962
|
enabled: e?.enabled ?? !1,
|
|
2832
2963
|
maxSpeedPxPerSecond: n,
|
|
2833
2964
|
minSpeedPxPerSecond: t,
|
|
2834
2965
|
paused: !1,
|
|
2835
|
-
speedPxPerSecond:
|
|
2966
|
+
speedPxPerSecond: wn(e?.speedPxPerSecond ?? 80, t, n)
|
|
2836
2967
|
};
|
|
2837
2968
|
}
|
|
2838
|
-
var
|
|
2969
|
+
var Dn = class {
|
|
2839
2970
|
frame = null;
|
|
2840
2971
|
lastTimestamp = null;
|
|
2841
2972
|
mounted = !1;
|
|
@@ -2855,9 +2986,9 @@ var Sn = class {
|
|
|
2855
2986
|
this.options.state.enabled && (this.options.state.paused = e, this.lastTimestamp = null, e ? this.cancelFrame() : this.schedule());
|
|
2856
2987
|
}
|
|
2857
2988
|
setSpeed(e) {
|
|
2858
|
-
|
|
2989
|
+
Cn("auto-scroll speed", e);
|
|
2859
2990
|
let t = this.options.state;
|
|
2860
|
-
t.speedPxPerSecond =
|
|
2991
|
+
t.speedPxPerSecond = wn(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
|
|
2861
2992
|
}
|
|
2862
2993
|
tick = (e) => {
|
|
2863
2994
|
this.frame = null;
|
|
@@ -2869,7 +3000,7 @@ var Sn = class {
|
|
|
2869
3000
|
return;
|
|
2870
3001
|
}
|
|
2871
3002
|
if (this.lastTimestamp !== null) {
|
|
2872
|
-
let r = Math.min(
|
|
3003
|
+
let r = Math.min(Sn, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
|
|
2873
3004
|
n.scrollTop = Math.min(i, n.scrollTop + t.speedPxPerSecond * r / 1e3);
|
|
2874
3005
|
}
|
|
2875
3006
|
this.lastTimestamp = e, this.schedule();
|
|
@@ -2883,13 +3014,13 @@ var Sn = class {
|
|
|
2883
3014
|
};
|
|
2884
3015
|
//#endregion
|
|
2885
3016
|
//#region src/core/backendAutofill.ts
|
|
2886
|
-
async function
|
|
3017
|
+
async function On(e, t, n, r) {
|
|
2887
3018
|
let i = await e.onUnderfilled(n);
|
|
2888
3019
|
if (!r()) return;
|
|
2889
3020
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend autofill requires a sessionId.");
|
|
2890
3021
|
let a = Math.max(n.received, i.received ?? n.received);
|
|
2891
3022
|
Object.assign(t.autofill, {
|
|
2892
|
-
|
|
3023
|
+
...ln(i.nextRequestAt),
|
|
2893
3024
|
missing: Math.max(0, e.pageSize - a),
|
|
2894
3025
|
received: a,
|
|
2895
3026
|
sequence: i.sequence ?? 0,
|
|
@@ -2897,19 +3028,19 @@ async function Cn(e, t, n, r) {
|
|
|
2897
3028
|
status: "waiting"
|
|
2898
3029
|
});
|
|
2899
3030
|
}
|
|
2900
|
-
function
|
|
2901
|
-
["complete", "exhausted"].includes(t.status) && t.items && (e.items =
|
|
3031
|
+
function kn(e, t) {
|
|
3032
|
+
["complete", "exhausted"].includes(t.status) && t.items && (e.items = $(e.items, t.items)), t.next !== void 0 && (e.next = t.next), t.total !== void 0 && (e.total = t.total);
|
|
2902
3033
|
}
|
|
2903
|
-
function
|
|
3034
|
+
function An(e, t, n) {
|
|
2904
3035
|
let r = t.autofill;
|
|
2905
|
-
return !
|
|
3036
|
+
return !yn(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (kn(t, n), Object.assign(r, ln(n.status === "waiting" ? n.nextRequestAt : null)), r.error = n.error ?? null, r.missing = Math.max(0, (r.pageSize ?? 0) - n.received), r.received = n.received, n.requests !== void 0 && (r.requests = n.requests), r.sequence = n.sequence, r.status = n.status, !0);
|
|
2906
3037
|
}
|
|
2907
|
-
function
|
|
2908
|
-
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill =
|
|
3038
|
+
function jn(e, t, n) {
|
|
3039
|
+
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = gn(e, n), kn(t, n), !0);
|
|
2909
3040
|
}
|
|
2910
3041
|
//#endregion
|
|
2911
3042
|
//#region src/core/backlogRestore.ts
|
|
2912
|
-
async function
|
|
3043
|
+
async function Mn(e, t, n) {
|
|
2913
3044
|
if (!e) return;
|
|
2914
3045
|
let r = new AbortController();
|
|
2915
3046
|
n(r);
|
|
@@ -2924,7 +3055,7 @@ async function Dn(e, t, n) {
|
|
|
2924
3055
|
}
|
|
2925
3056
|
//#endregion
|
|
2926
3057
|
//#region src/core/initialAutofill.ts
|
|
2927
|
-
async function
|
|
3058
|
+
async function Nn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, onPages: i, options: a, signal: o, state: s }) {
|
|
2928
3059
|
let c = a.autofill;
|
|
2929
3060
|
if (!c) return;
|
|
2930
3061
|
let l = s.items.length;
|
|
@@ -2937,7 +3068,7 @@ async function On({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
2937
3068
|
return;
|
|
2938
3069
|
}
|
|
2939
3070
|
if (c.strategy === "backend") {
|
|
2940
|
-
await
|
|
3071
|
+
await On(c, s, {
|
|
2941
3072
|
cycleId: e,
|
|
2942
3073
|
feedKey: c.feedKey,
|
|
2943
3074
|
items: [...s.items],
|
|
@@ -2954,11 +3085,11 @@ async function On({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
2954
3085
|
s.autofill.status = "exhausted";
|
|
2955
3086
|
return;
|
|
2956
3087
|
}
|
|
2957
|
-
let u = await
|
|
3088
|
+
let u = await bn({
|
|
2958
3089
|
existingItems: s.items,
|
|
2959
3090
|
initialCursor: s.next,
|
|
2960
3091
|
loadPage: a.loadPage,
|
|
2961
|
-
maximumRequests:
|
|
3092
|
+
maximumRequests: fn(c, !1),
|
|
2962
3093
|
onCollection: n,
|
|
2963
3094
|
onDelayChange: (e) => {
|
|
2964
3095
|
t() && Object.assign(s.autofill, e);
|
|
@@ -2972,7 +3103,7 @@ async function On({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
2972
3103
|
shouldPause: () => s.loadMoreLocked,
|
|
2973
3104
|
signal: o
|
|
2974
3105
|
});
|
|
2975
|
-
t() && (s.items =
|
|
3106
|
+
t() && (s.items = $(s.items, u.items), s.next = u.next, u.total !== void 0 && (s.total = u.total), r(u.lastCursor), i(u.pages), Object.assign(s.autofill, {
|
|
2976
3107
|
missing: u.missing,
|
|
2977
3108
|
received: u.received,
|
|
2978
3109
|
requests: u.requests,
|
|
@@ -2981,13 +3112,13 @@ async function On({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
2981
3112
|
}
|
|
2982
3113
|
//#endregion
|
|
2983
3114
|
//#region src/core/fill.ts
|
|
2984
|
-
function
|
|
3115
|
+
function Pn(e) {
|
|
2985
3116
|
return "items" in e ? { items: e.items } : "pages" in e ? { pages: e.pages } : { until: "end" };
|
|
2986
3117
|
}
|
|
2987
|
-
function
|
|
3118
|
+
function Fn(e) {
|
|
2988
3119
|
return `${typeof e}:${String(e)}`;
|
|
2989
3120
|
}
|
|
2990
|
-
function
|
|
3121
|
+
function In(e) {
|
|
2991
3122
|
if (!e || typeof e != "object") throw TypeError("Vibe fill target must be an object.");
|
|
2992
3123
|
if ("pages" in e) {
|
|
2993
3124
|
if (!Number.isInteger(e.pages) || e.pages <= 0) throw TypeError("Vibe fill pages must be a positive integer.");
|
|
@@ -3000,21 +3131,21 @@ function jn(e) {
|
|
|
3000
3131
|
if ("until" in e && e.until === "end") return { until: "end" };
|
|
3001
3132
|
throw TypeError("Vibe fill target must be { items }, { pages }, or { until: 'end' }.");
|
|
3002
3133
|
}
|
|
3003
|
-
function
|
|
3134
|
+
function Ln(e) {
|
|
3004
3135
|
if (!e) return;
|
|
3005
3136
|
if (e.strategy === "frontend") {
|
|
3006
|
-
|
|
3137
|
+
sn(e, "frontend fill");
|
|
3007
3138
|
return;
|
|
3008
3139
|
}
|
|
3009
3140
|
if (!e.feedKey.trim()) throw TypeError("Vibe backend fill requires a feedKey.");
|
|
3010
3141
|
let t = e.initialSession;
|
|
3011
3142
|
if (t) {
|
|
3012
3143
|
if (t.feedKey !== e.feedKey) throw TypeError("Vibe backend fill initialSession feedKey must match fill feedKey.");
|
|
3013
|
-
|
|
3144
|
+
In(t.target);
|
|
3014
3145
|
}
|
|
3015
3146
|
}
|
|
3016
|
-
function
|
|
3017
|
-
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a =
|
|
3147
|
+
function Rn(e, t, n = !0) {
|
|
3148
|
+
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a = ln(i?.nextRequestAt);
|
|
3018
3149
|
return {
|
|
3019
3150
|
completedPages: i?.completedPages ?? 0,
|
|
3020
3151
|
cycleId: i?.cycleId ?? null,
|
|
@@ -3027,10 +3158,10 @@ function Nn(e, t, n = !0) {
|
|
|
3027
3158
|
sessionId: i?.sessionId ?? null,
|
|
3028
3159
|
status: i?.status ?? "idle",
|
|
3029
3160
|
strategy: e?.strategy ?? null,
|
|
3030
|
-
target: i ?
|
|
3161
|
+
target: i ? Pn(i.target) : null
|
|
3031
3162
|
};
|
|
3032
3163
|
}
|
|
3033
|
-
function
|
|
3164
|
+
function zn(e) {
|
|
3034
3165
|
return [
|
|
3035
3166
|
"cancelling",
|
|
3036
3167
|
"filling",
|
|
@@ -3038,7 +3169,7 @@ function Pn(e) {
|
|
|
3038
3169
|
"waiting"
|
|
3039
3170
|
].includes(e.status);
|
|
3040
3171
|
}
|
|
3041
|
-
async function
|
|
3172
|
+
async function Bn({ existingItems: e, initialCursor: t, loadPage: n, onCollection: r = () => void 0, onDelayChange: i, onProgress: a, options: o, shouldPause: s = () => !1, signal: c, target: l }) {
|
|
3042
3173
|
let u = [], d = [], f = [...e], p = /* @__PURE__ */ new Set(), m = 0, h = t, g = t, _ = t, v = 0, y;
|
|
3043
3174
|
if ("items" in l && f.length >= l.items) return {
|
|
3044
3175
|
completedPages: m,
|
|
@@ -3050,10 +3181,10 @@ async function Fn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
3050
3181
|
status: "complete"
|
|
3051
3182
|
};
|
|
3052
3183
|
for (; _ !== null;) {
|
|
3053
|
-
let e =
|
|
3184
|
+
let e = Fn(h);
|
|
3054
3185
|
if (p.has(e)) throw Error("Vibe fill received a repeated cursor.");
|
|
3055
|
-
if (p.add(e), await
|
|
3056
|
-
delayMs:
|
|
3186
|
+
if (p.add(e), await un({
|
|
3187
|
+
delayMs: cn(m, o),
|
|
3057
3188
|
onChange: i,
|
|
3058
3189
|
signal: c
|
|
3059
3190
|
}), m > 0 && s()) return {
|
|
@@ -3066,12 +3197,12 @@ async function Fn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
3066
3197
|
status: "paused",
|
|
3067
3198
|
total: y
|
|
3068
3199
|
};
|
|
3069
|
-
let t =
|
|
3200
|
+
let t = Yt(await n({
|
|
3070
3201
|
cursor: h,
|
|
3071
3202
|
signal: c
|
|
3072
3203
|
}));
|
|
3073
3204
|
m += 1, g = h;
|
|
3074
|
-
let b =
|
|
3205
|
+
let b = $(f, t.items).slice(f.length);
|
|
3075
3206
|
if (d.push({
|
|
3076
3207
|
contributionIds: b.map(({ postId: e }) => e),
|
|
3077
3208
|
cursor: h,
|
|
@@ -3134,12 +3265,12 @@ async function Fn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
3134
3265
|
}
|
|
3135
3266
|
//#endregion
|
|
3136
3267
|
//#region src/core/backendFill.ts
|
|
3137
|
-
async function
|
|
3268
|
+
async function Vn(e, t, n, r) {
|
|
3138
3269
|
let i = await e.onStart(n);
|
|
3139
3270
|
if (r()) {
|
|
3140
3271
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend fill requires a sessionId.");
|
|
3141
3272
|
Object.assign(t.fill, {
|
|
3142
|
-
|
|
3273
|
+
...ln(i.nextRequestAt),
|
|
3143
3274
|
completedPages: i.completedPages ?? 0,
|
|
3144
3275
|
received: i.received ?? 0,
|
|
3145
3276
|
sequence: i.sequence ?? 0,
|
|
@@ -3148,23 +3279,23 @@ async function In(e, t, n, r) {
|
|
|
3148
3279
|
});
|
|
3149
3280
|
}
|
|
3150
3281
|
}
|
|
3151
|
-
function
|
|
3282
|
+
function Hn(e, t, n) {
|
|
3152
3283
|
return e?.strategy === "backend" && n.feedKey === e.feedKey && n.sessionId === t.fill.sessionId;
|
|
3153
3284
|
}
|
|
3154
|
-
function
|
|
3285
|
+
function Un(e) {
|
|
3155
3286
|
return Number.isInteger(e.completedPages) && e.completedPages >= 0 && Number.isInteger(e.received) && e.received >= 0 && Number.isInteger(e.sequence) && e.sequence >= 0;
|
|
3156
3287
|
}
|
|
3157
|
-
function
|
|
3288
|
+
function Wn(e, t) {
|
|
3158
3289
|
if (!["complete", "exhausted"].includes(t.status)) return !0;
|
|
3159
3290
|
let n = e.fill.target;
|
|
3160
3291
|
return !n || !Array.isArray(t.items) || t.next === void 0 || t.lastCursor === void 0 ? !1 : t.status === "exhausted" ? "pages" in n && t.completedPages < n.pages && t.next === null : "pages" in n ? t.completedPages === n.pages : t.next === null;
|
|
3161
3292
|
}
|
|
3162
|
-
function
|
|
3163
|
-
t.total !== void 0 && (e.total = t.total), ["complete", "exhausted"].includes(t.status) && (e.items =
|
|
3293
|
+
function Gn(e, t, n) {
|
|
3294
|
+
t.total !== void 0 && (e.total = t.total), ["complete", "exhausted"].includes(t.status) && (e.items = $(e.items, t.items ?? []), e.next = t.next ?? null, n(t.lastCursor ?? null));
|
|
3164
3295
|
}
|
|
3165
|
-
function
|
|
3166
|
-
return !
|
|
3167
|
-
|
|
3296
|
+
function Kn(e, t, n, r) {
|
|
3297
|
+
return !Hn(e, t, n) || !Un(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !Wn(t, n) ? !1 : (Gn(t, n, r), Object.assign(t.fill, {
|
|
3298
|
+
...ln(n.status === "waiting" ? n.nextRequestAt : null),
|
|
3168
3299
|
completedPages: n.completedPages,
|
|
3169
3300
|
error: n.error ?? null,
|
|
3170
3301
|
received: n.received,
|
|
@@ -3172,45 +3303,45 @@ function Vn(e, t, n, r) {
|
|
|
3172
3303
|
status: n.status
|
|
3173
3304
|
}), !0);
|
|
3174
3305
|
}
|
|
3175
|
-
function
|
|
3306
|
+
function qn(e, t, n, r) {
|
|
3176
3307
|
if (e?.strategy !== "backend" || n.feedKey !== e.feedKey) return !1;
|
|
3177
3308
|
let i = t.fill;
|
|
3178
|
-
return t.fill =
|
|
3309
|
+
return t.fill = Rn(e, n), !Un(n) || !Wn(t, n) ? (t.fill = i, !1) : (Gn(t, n, r), !0);
|
|
3179
3310
|
}
|
|
3180
3311
|
//#endregion
|
|
3181
3312
|
//#region src/core/fillController.ts
|
|
3182
|
-
var
|
|
3313
|
+
var Jn = class {
|
|
3183
3314
|
abortController = null;
|
|
3184
3315
|
cycle = 0;
|
|
3185
3316
|
delayCountdown;
|
|
3186
3317
|
requestVersion = 0;
|
|
3187
3318
|
collection = null;
|
|
3188
3319
|
constructor(e) {
|
|
3189
|
-
this.options = e, this.delayCountdown = new
|
|
3320
|
+
this.options = e, this.delayCountdown = new dn((e) => {
|
|
3190
3321
|
Object.assign(this.options.state.fill, e);
|
|
3191
3322
|
}), this.syncBackendCountdown();
|
|
3192
3323
|
}
|
|
3193
3324
|
isActive() {
|
|
3194
|
-
return
|
|
3325
|
+
return zn(this.options.state.fill);
|
|
3195
3326
|
}
|
|
3196
3327
|
applyUpdate(e) {
|
|
3197
|
-
let t =
|
|
3328
|
+
let t = Kn(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
3198
3329
|
return t && this.syncBackendCountdown(), t;
|
|
3199
3330
|
}
|
|
3200
3331
|
restoreSession(e) {
|
|
3201
|
-
let t =
|
|
3332
|
+
let t = qn(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
3202
3333
|
return t && this.syncBackendCountdown(), t;
|
|
3203
3334
|
}
|
|
3204
3335
|
async start(e, t = {}) {
|
|
3205
3336
|
let n = this.options.fill;
|
|
3206
3337
|
if (!n) throw Error("Vibe fill is not configured.");
|
|
3207
3338
|
if (this.isActive()) throw Error("Vibe fill is already active.");
|
|
3208
|
-
let r =
|
|
3339
|
+
let r = In(e), i = In(t.target ?? r), a = t.progressOffset ?? {
|
|
3209
3340
|
completedPages: 0,
|
|
3210
3341
|
received: 0
|
|
3211
3342
|
}, o = t.cycleId ?? `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
3212
3343
|
if (this.options.state.fill = {
|
|
3213
|
-
...
|
|
3344
|
+
...Rn(n, void 0, !1),
|
|
3214
3345
|
completedPages: a.completedPages,
|
|
3215
3346
|
cycleId: o,
|
|
3216
3347
|
received: a.received,
|
|
@@ -3223,7 +3354,7 @@ var Un = class {
|
|
|
3223
3354
|
let s = ++this.requestVersion, c = new AbortController();
|
|
3224
3355
|
this.abortController = c;
|
|
3225
3356
|
try {
|
|
3226
|
-
n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await
|
|
3357
|
+
n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await Vn(n, this.options.state, {
|
|
3227
3358
|
cycleId: o,
|
|
3228
3359
|
feedKey: n.feedKey,
|
|
3229
3360
|
items: [...this.options.state.items],
|
|
@@ -3241,7 +3372,7 @@ var Un = class {
|
|
|
3241
3372
|
}
|
|
3242
3373
|
async cancel() {
|
|
3243
3374
|
let { fill: e, state: t } = this.options;
|
|
3244
|
-
if (!
|
|
3375
|
+
if (!zn(t.fill) || !t.fill.cycleId) return;
|
|
3245
3376
|
let n = {
|
|
3246
3377
|
cycleId: t.fill.cycleId,
|
|
3247
3378
|
feedKey: t.fill.feedKey ?? "",
|
|
@@ -3285,7 +3416,7 @@ var Un = class {
|
|
|
3285
3416
|
});
|
|
3286
3417
|
}
|
|
3287
3418
|
reset() {
|
|
3288
|
-
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill =
|
|
3419
|
+
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = Rn(this.options.fill, void 0, !1), this.collection = null;
|
|
3289
3420
|
}
|
|
3290
3421
|
destroy() {
|
|
3291
3422
|
this.abortLocalRequest(), this.delayCountdown.clear();
|
|
@@ -3320,7 +3451,7 @@ var Un = class {
|
|
|
3320
3451
|
s.fill.status = "until" in t ? "complete" : "exhausted";
|
|
3321
3452
|
return;
|
|
3322
3453
|
}
|
|
3323
|
-
let c = await
|
|
3454
|
+
let c = await Bn({
|
|
3324
3455
|
existingItems: s.items,
|
|
3325
3456
|
initialCursor: s.next,
|
|
3326
3457
|
loadPage: o,
|
|
@@ -3346,7 +3477,7 @@ var Un = class {
|
|
|
3346
3477
|
signal: n.signal,
|
|
3347
3478
|
target: t
|
|
3348
3479
|
});
|
|
3349
|
-
this.isCurrent(r) && (s.items =
|
|
3480
|
+
this.isCurrent(r) && (s.items = $(s.items, c.items), s.next = c.next, c.total !== void 0 && (s.total = c.total), this.options.onLastCursor(c.lastCursor), Object.assign(s.fill, {
|
|
3350
3481
|
completedPages: a.completedPages + c.completedPages,
|
|
3351
3482
|
received: a.received + c.received,
|
|
3352
3483
|
status: c.status
|
|
@@ -3356,7 +3487,7 @@ var Un = class {
|
|
|
3356
3487
|
let e = this.collection;
|
|
3357
3488
|
if (this.collection = null, !e || this.options.fill?.strategy !== "frontend") return;
|
|
3358
3489
|
let t = this.options.state;
|
|
3359
|
-
t.items =
|
|
3490
|
+
t.items = $(t.items, e.items), t.next = e.next, e.total !== void 0 && (t.total = e.total), this.options.onLastCursor(e.lastCursor), this.options.onPages(e.pages), Object.assign(t.fill, {
|
|
3360
3491
|
completedPages: e.completedPages,
|
|
3361
3492
|
received: e.received
|
|
3362
3493
|
});
|
|
@@ -3368,7 +3499,7 @@ var Un = class {
|
|
|
3368
3499
|
};
|
|
3369
3500
|
//#endregion
|
|
3370
3501
|
//#region src/core/fillReconciliation.ts
|
|
3371
|
-
async function
|
|
3502
|
+
async function Yn({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r, setLastCursor: i, signal: a, state: o }) {
|
|
3372
3503
|
if (!e.needsReconciliation(o.items)) return "skipped";
|
|
3373
3504
|
let s = await e.reconcile({
|
|
3374
3505
|
existingItems: o.items,
|
|
@@ -3377,11 +3508,11 @@ async function Wn({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r,
|
|
|
3377
3508
|
shouldPause: () => o.loadMoreLocked,
|
|
3378
3509
|
signal: a
|
|
3379
3510
|
});
|
|
3380
|
-
return t() ? (o.items =
|
|
3511
|
+
return t() ? (o.items = $(o.items, s.items), o.next = s.next, i(s.lastCursor), s.total !== void 0 && (o.total = s.total), e.completeReconciliation(s), s.status) : s.status;
|
|
3381
3512
|
}
|
|
3382
3513
|
//#endregion
|
|
3383
3514
|
//#region src/core/feedFooter.ts
|
|
3384
|
-
function
|
|
3515
|
+
function Xn(e) {
|
|
3385
3516
|
return {
|
|
3386
3517
|
cancelAutofill: () => e.cancelAutofill(),
|
|
3387
3518
|
loadMore: () => e.loadNext(),
|
|
@@ -3393,64 +3524,64 @@ function Gn(e) {
|
|
|
3393
3524
|
retryFill: () => e.retryFill()
|
|
3394
3525
|
};
|
|
3395
3526
|
}
|
|
3396
|
-
function
|
|
3527
|
+
function Zn(e) {
|
|
3397
3528
|
if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
|
|
3398
3529
|
}
|
|
3399
|
-
function
|
|
3400
|
-
e?.intervalMs !== void 0 &&
|
|
3530
|
+
function Qn(e) {
|
|
3531
|
+
e?.intervalMs !== void 0 && Zn(e.intervalMs);
|
|
3401
3532
|
}
|
|
3402
|
-
function
|
|
3533
|
+
function $n(e) {
|
|
3403
3534
|
return {
|
|
3404
3535
|
enabled: e?.enabled ?? !1,
|
|
3405
3536
|
includePostItems: e?.includePostItems ?? !1,
|
|
3406
3537
|
intervalMs: e?.intervalMs ?? 5e3
|
|
3407
3538
|
};
|
|
3408
3539
|
}
|
|
3409
|
-
function
|
|
3540
|
+
function er(e, t) {
|
|
3410
3541
|
if (typeof t == "boolean") {
|
|
3411
3542
|
e.enabled = t;
|
|
3412
3543
|
return;
|
|
3413
3544
|
}
|
|
3414
|
-
|
|
3545
|
+
Qn(t), t.enabled !== void 0 && (e.enabled = t.enabled), t.includePostItems !== void 0 && (e.includePostItems = t.includePostItems), t.intervalMs !== void 0 && (e.intervalMs = t.intervalMs);
|
|
3415
3546
|
}
|
|
3416
3547
|
//#endregion
|
|
3417
3548
|
//#region src/core/reelInfoSheet.ts
|
|
3418
|
-
function
|
|
3549
|
+
function tr(e) {
|
|
3419
3550
|
return { enabled: e?.enabled ?? !1 };
|
|
3420
3551
|
}
|
|
3421
|
-
function
|
|
3552
|
+
function nr(e, t, n) {
|
|
3422
3553
|
if (n && !t) throw Error("Vibe cannot enable reelInfoSheet without a configured component.");
|
|
3423
3554
|
e.enabled = n;
|
|
3424
3555
|
}
|
|
3425
3556
|
//#endregion
|
|
3426
3557
|
//#region src/core/initialRuntimeState.ts
|
|
3427
|
-
function
|
|
3558
|
+
function rr(e, t) {
|
|
3428
3559
|
let n = e.initialPage;
|
|
3429
3560
|
return {
|
|
3430
3561
|
activeReelPostId: null,
|
|
3431
|
-
autoScroll:
|
|
3432
|
-
autofill:
|
|
3562
|
+
autoScroll: En(e.autoScroll),
|
|
3563
|
+
autofill: gn(e.autofill),
|
|
3433
3564
|
current: n?.current ?? null,
|
|
3434
3565
|
error: null,
|
|
3435
|
-
fill:
|
|
3566
|
+
fill: Rn(e.fill),
|
|
3436
3567
|
infiniteScroll: e.infiniteScroll ?? !0,
|
|
3437
3568
|
isLoading: !n,
|
|
3438
3569
|
isLoadingMore: !1,
|
|
3439
|
-
items: n ?
|
|
3570
|
+
items: n ? $([], n.items) : [],
|
|
3440
3571
|
layout: t === "reel" ? "reel" : "masonry",
|
|
3441
3572
|
loadMoreLocked: !1,
|
|
3442
3573
|
mediaIndices: /* @__PURE__ */ new Map(),
|
|
3443
3574
|
next: n?.next ?? null,
|
|
3444
3575
|
nextPageError: null,
|
|
3445
3576
|
phoneMode: !1,
|
|
3446
|
-
reelAutoAdvance:
|
|
3577
|
+
reelAutoAdvance: $n(e.reelAutoAdvance),
|
|
3447
3578
|
reelForward: {
|
|
3448
3579
|
error: null,
|
|
3449
3580
|
status: "idle"
|
|
3450
3581
|
},
|
|
3451
3582
|
reelForwardIndex: null,
|
|
3452
3583
|
reelForwardItem: null,
|
|
3453
|
-
reelInfoSheet:
|
|
3584
|
+
reelInfoSheet: tr(e.reelInfoSheet),
|
|
3454
3585
|
reelInfoSheetOverlay: !1,
|
|
3455
3586
|
reelMediaSource: "original",
|
|
3456
3587
|
reelOrigin: null,
|
|
@@ -3459,20 +3590,20 @@ function Qn(e, t) {
|
|
|
3459
3590
|
}
|
|
3460
3591
|
//#endregion
|
|
3461
3592
|
//#region src/core/options.ts
|
|
3462
|
-
function
|
|
3593
|
+
function ir(e, t) {
|
|
3463
3594
|
if (t) {
|
|
3464
3595
|
if (!Number.isFinite(t.height) || t.height <= 0) throw TypeError(`Vibe ${e} height must be a positive number.`);
|
|
3465
3596
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe ${e} background must be "default" or "transparent".`);
|
|
3466
3597
|
}
|
|
3467
3598
|
}
|
|
3468
|
-
function
|
|
3599
|
+
function ar(e, t) {
|
|
3469
3600
|
if (t) {
|
|
3470
3601
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe mediaCard ${e} background must be "default" or "transparent".`);
|
|
3471
3602
|
for (let [n, r] of [["paddingX", t.paddingX], ["paddingY", t.paddingY]]) if (r !== void 0 && (!Number.isFinite(r) || r < 0)) throw TypeError(`Vibe mediaCard ${e} ${n} must be a non-negative number.`);
|
|
3472
3603
|
}
|
|
3473
3604
|
}
|
|
3474
|
-
function
|
|
3475
|
-
if (
|
|
3605
|
+
function or(e) {
|
|
3606
|
+
if (Tn(e.autoScroll), ir("cardHeader", e.cardHeader), ir("cardFooter", e.cardFooter), ar("header", e.mediaCard?.header), ar("footer", e.mediaCard?.footer), hn(e.autofill), Ln(e.fill), le(e.masonry), Qn(e.reelAutoAdvance), e.removalReconciliation) {
|
|
3476
3607
|
if (!Number.isInteger(e.removalReconciliation.pageSize) || e.removalReconciliation.pageSize <= 0) throw TypeError("Vibe removalReconciliation pageSize must be a positive integer.");
|
|
3477
3608
|
let t = e.removalReconciliation.maxReplayPages ?? 5;
|
|
3478
3609
|
if (!Number.isInteger(t) || t <= 0) throw TypeError("Vibe removalReconciliation maxReplayPages must be a positive integer.");
|
|
@@ -3487,7 +3618,7 @@ function tr(e) {
|
|
|
3487
3618
|
if (e.fill?.strategy === "frontend" && !e.loadPage) throw TypeError("Vibe frontend fill requires loadPage.");
|
|
3488
3619
|
if (e.fill?.strategy === "backend" && e.fill.initialSession && !e.initialPage) throw TypeError("Vibe backend fill restoration requires initialPage.");
|
|
3489
3620
|
}
|
|
3490
|
-
function
|
|
3621
|
+
function sr(e) {
|
|
3491
3622
|
if (typeof e != "string") return e;
|
|
3492
3623
|
if (typeof document > "u") throw Error("Vibe cannot resolve a selector without a document.");
|
|
3493
3624
|
let t = document.querySelector(e);
|
|
@@ -3496,7 +3627,7 @@ function nr(e) {
|
|
|
3496
3627
|
}
|
|
3497
3628
|
//#endregion
|
|
3498
3629
|
//#region src/core/pageRequest.ts
|
|
3499
|
-
async function
|
|
3630
|
+
async function cr({ append: e, autofillController: t, cursor: n, isCurrent: r, loadPage: i, onLastCursor: a, onPages: o, options: s, signal: c, state: l }) {
|
|
3500
3631
|
let u = s.autofill, d = e && u?.strategy === "frontend" && (l.autofill.status === "paused" || l.autofill.status === "error"), f = d ? {
|
|
3501
3632
|
received: l.autofill.received,
|
|
3502
3633
|
requests: l.autofill.requests
|
|
@@ -3508,11 +3639,11 @@ async function rr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3508
3639
|
let m = !1;
|
|
3509
3640
|
try {
|
|
3510
3641
|
if (u?.strategy === "frontend") {
|
|
3511
|
-
let s = await
|
|
3642
|
+
let s = await bn({
|
|
3512
3643
|
existingItems: e ? l.items : [],
|
|
3513
3644
|
initialCursor: n,
|
|
3514
3645
|
loadPage: i,
|
|
3515
|
-
maximumRequests: f ? Math.max(0,
|
|
3646
|
+
maximumRequests: f ? Math.max(0, fn(u) - f.requests) : void 0,
|
|
3516
3647
|
onCollection: (e) => t.captureCollection(e, r()),
|
|
3517
3648
|
onDelayChange: (e) => {
|
|
3518
3649
|
r() && Object.assign(l.autofill, e);
|
|
@@ -3527,7 +3658,7 @@ async function rr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3527
3658
|
signal: c
|
|
3528
3659
|
});
|
|
3529
3660
|
if (!r()) return;
|
|
3530
|
-
l.items = e ?
|
|
3661
|
+
l.items = e ? $(l.items, s.items) : [...s.items], a(s.lastCursor), l.next = s.next, s.total !== void 0 && (l.total = s.total), Object.assign(l.autofill, {
|
|
3531
3662
|
missing: s.missing,
|
|
3532
3663
|
received: s.received,
|
|
3533
3664
|
requests: s.requests,
|
|
@@ -3535,12 +3666,12 @@ async function rr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3535
3666
|
}), o(s.pages), t.clearCollection();
|
|
3536
3667
|
return;
|
|
3537
3668
|
}
|
|
3538
|
-
let s =
|
|
3669
|
+
let s = Yt(await i({
|
|
3539
3670
|
cursor: n,
|
|
3540
3671
|
signal: c
|
|
3541
3672
|
}));
|
|
3542
3673
|
if (!r()) return;
|
|
3543
|
-
let d = e ? l.items : [], h =
|
|
3674
|
+
let d = e ? l.items : [], h = $(d, s.items), g = h.length - d.length;
|
|
3544
3675
|
if (l.items = h, a(n), o([{
|
|
3545
3676
|
contributionIds: h.slice(d.length).map(({ postId: e }) => e),
|
|
3546
3677
|
cursor: n,
|
|
@@ -3555,7 +3686,7 @@ async function rr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3555
3686
|
l.autofill.status = "complete";
|
|
3556
3687
|
return;
|
|
3557
3688
|
}
|
|
3558
|
-
await
|
|
3689
|
+
await On(u, l, {
|
|
3559
3690
|
cycleId: p,
|
|
3560
3691
|
feedKey: u.feedKey,
|
|
3561
3692
|
items: h.slice(d.length),
|
|
@@ -3577,16 +3708,16 @@ async function rr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3577
3708
|
}
|
|
3578
3709
|
//#endregion
|
|
3579
3710
|
//#region src/core/removalReconciliationController.ts
|
|
3580
|
-
function
|
|
3711
|
+
function lr(e) {
|
|
3581
3712
|
return `${typeof e}:${String(e)}`;
|
|
3582
3713
|
}
|
|
3583
|
-
function
|
|
3714
|
+
function ur(e) {
|
|
3584
3715
|
return `${typeof e}:${String(e)}`;
|
|
3585
3716
|
}
|
|
3586
|
-
function
|
|
3717
|
+
function dr(e) {
|
|
3587
3718
|
return e.map(({ postId: e }) => e);
|
|
3588
3719
|
}
|
|
3589
|
-
var
|
|
3720
|
+
var fr = class {
|
|
3590
3721
|
delay;
|
|
3591
3722
|
enabled;
|
|
3592
3723
|
maxReplayPages;
|
|
@@ -3605,7 +3736,7 @@ var sr = class {
|
|
|
3605
3736
|
e.status === "complete" && (this.pages = [...this.pages.slice(0, e.replaceFrom), ...e.pages].slice(-this.maxReplayPages), this.pending = null);
|
|
3606
3737
|
}
|
|
3607
3738
|
filterItems(e) {
|
|
3608
|
-
return this.tombstones.size === 0 ? [...e] : e.filter(({ postId: e }) => !this.tombstones.has(
|
|
3739
|
+
return this.tombstones.size === 0 ? [...e] : e.filter(({ postId: e }) => !this.tombstones.has(lr(e)));
|
|
3609
3740
|
}
|
|
3610
3741
|
needsReconciliation(e) {
|
|
3611
3742
|
return this.pending !== null || this.findUnderfilledPage(e) >= 0;
|
|
@@ -3618,45 +3749,45 @@ var sr = class {
|
|
|
3618
3749
|
}
|
|
3619
3750
|
recordInitialPage(e) {
|
|
3620
3751
|
e && this.recordPages([{
|
|
3621
|
-
contributionIds:
|
|
3622
|
-
cursor:
|
|
3752
|
+
contributionIds: dr(e.items),
|
|
3753
|
+
cursor: $t(e),
|
|
3623
3754
|
next: e.next,
|
|
3624
|
-
returnedIds:
|
|
3755
|
+
returnedIds: dr(e.items)
|
|
3625
3756
|
}]);
|
|
3626
3757
|
}
|
|
3627
3758
|
remove(e) {
|
|
3628
|
-
e.forEach((e) => this.tombstones.add(
|
|
3759
|
+
e.forEach((e) => this.tombstones.add(lr(e)));
|
|
3629
3760
|
}
|
|
3630
3761
|
reset() {
|
|
3631
3762
|
this.pages = [], this.pending = null, this.tombstones.clear();
|
|
3632
3763
|
}
|
|
3633
3764
|
restore(e) {
|
|
3634
|
-
e.forEach((e) => this.tombstones.delete(
|
|
3765
|
+
e.forEach((e) => this.tombstones.delete(lr(e)));
|
|
3635
3766
|
}
|
|
3636
3767
|
async reconcile({ existingItems: e, loadPage: t, onDelayChange: n = () => void 0, shouldPause: r = () => !1, signal: i }) {
|
|
3637
3768
|
let a = this.pending ?? this.createSession(e);
|
|
3638
3769
|
for (this.pending = a; a.remainingRequests > 0;) {
|
|
3639
|
-
let e =
|
|
3770
|
+
let e = ur(a.cursor);
|
|
3640
3771
|
if (a.seenCursors.has(e)) throw Error("Vibe removal reconciliation received a repeated cursor.");
|
|
3641
|
-
if (await
|
|
3642
|
-
delayMs:
|
|
3772
|
+
if (await un({
|
|
3773
|
+
delayMs: cn(a.pages.length, this.delay),
|
|
3643
3774
|
onChange: n,
|
|
3644
3775
|
signal: i
|
|
3645
3776
|
}), a.pages.length > 0 && r()) return this.result(a, "paused");
|
|
3646
|
-
let o =
|
|
3777
|
+
let o = Yt(await t({
|
|
3647
3778
|
cursor: a.cursor,
|
|
3648
3779
|
signal: i
|
|
3649
3780
|
}));
|
|
3650
3781
|
a.seenCursors.add(e);
|
|
3651
3782
|
let s = this.filterItems(o.items), c = [];
|
|
3652
3783
|
if (s.forEach((e) => {
|
|
3653
|
-
let t =
|
|
3784
|
+
let t = lr(e.postId);
|
|
3654
3785
|
a.attributed.has(t) || (a.attributed.add(t), c.push(e.postId)), a.appended.has(t) || (a.appended.add(t), a.items.push(e));
|
|
3655
3786
|
}), a.pages.push({
|
|
3656
3787
|
contributionIds: c,
|
|
3657
3788
|
cursor: a.cursor,
|
|
3658
3789
|
next: o.next,
|
|
3659
|
-
returnedIds:
|
|
3790
|
+
returnedIds: dr(s)
|
|
3660
3791
|
}), a.lastCursor = a.cursor, a.next = o.next, --a.remainingRequests, o.total !== void 0 && (a.total = o.total), a.next === null ? a.remainingRequests = 0 : a.cursor = a.next, a.remainingRequests > 0 && r()) return this.result(a, "paused");
|
|
3661
3792
|
}
|
|
3662
3793
|
return this.result(a, "complete");
|
|
@@ -3664,9 +3795,9 @@ var sr = class {
|
|
|
3664
3795
|
createSession(e) {
|
|
3665
3796
|
let t = this.findUnderfilledPage(e), n = t < 0 ? [] : this.pages.slice(t), r = n[0];
|
|
3666
3797
|
if (!r) throw Error("Vibe has no underfilled provider page to reconcile.");
|
|
3667
|
-
let i = new Set(n.flatMap(({ contributionIds: e }) => e.map(
|
|
3798
|
+
let i = new Set(n.flatMap(({ contributionIds: e }) => e.map(lr))), a = new Set(e.map(({ postId: e }) => lr(e)).filter((e) => !i.has(e)));
|
|
3668
3799
|
return {
|
|
3669
|
-
appended: new Set(e.map(({ postId: e }) =>
|
|
3800
|
+
appended: new Set(e.map(({ postId: e }) => lr(e))),
|
|
3670
3801
|
attributed: new Set(a),
|
|
3671
3802
|
cursor: r.cursor,
|
|
3672
3803
|
items: [],
|
|
@@ -3691,11 +3822,11 @@ var sr = class {
|
|
|
3691
3822
|
}
|
|
3692
3823
|
findUnderfilledPage(e) {
|
|
3693
3824
|
if (!this.enabled || this.pages.length === 0) return -1;
|
|
3694
|
-
let t = new Set(e.map(({ postId: e }) =>
|
|
3695
|
-
return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has(
|
|
3825
|
+
let t = new Set(e.map(({ postId: e }) => lr(e)));
|
|
3826
|
+
return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has(lr(e))).length < this.pageSize);
|
|
3696
3827
|
}
|
|
3697
3828
|
recordPage(e) {
|
|
3698
|
-
let t =
|
|
3829
|
+
let t = ur(e.cursor), n = this.pages.findIndex(({ cursor: e }) => ur(e) === t);
|
|
3699
3830
|
n >= 0 && (this.pages = this.pages.slice(0, n)), this.pages.push({
|
|
3700
3831
|
...e,
|
|
3701
3832
|
contributionIds: [...e.contributionIds],
|
|
@@ -3705,7 +3836,7 @@ var sr = class {
|
|
|
3705
3836
|
};
|
|
3706
3837
|
//#endregion
|
|
3707
3838
|
//#region src/core/activeItemRemoval.ts
|
|
3708
|
-
function
|
|
3839
|
+
function pr(e, t, n, r, i) {
|
|
3709
3840
|
let a = new Set(t.map(({ item: e }) => e.postId));
|
|
3710
3841
|
if (e.activeReelPostId === null || !a.has(e.activeReelPostId)) return;
|
|
3711
3842
|
let o = e.items[Math.max(n, 0)];
|
|
@@ -3718,7 +3849,7 @@ function cr(e, t, n, r, i) {
|
|
|
3718
3849
|
}
|
|
3719
3850
|
//#endregion
|
|
3720
3851
|
//#region src/core/exactMediaRemovalController.ts
|
|
3721
|
-
function
|
|
3852
|
+
function mr(e, t) {
|
|
3722
3853
|
let [n, ...r] = t;
|
|
3723
3854
|
if (!n) throw Error("Vibe items must contain at least one media asset.");
|
|
3724
3855
|
return {
|
|
@@ -3727,10 +3858,10 @@ function lr(e, t) {
|
|
|
3727
3858
|
items: r
|
|
3728
3859
|
};
|
|
3729
3860
|
}
|
|
3730
|
-
function
|
|
3861
|
+
function hr(e) {
|
|
3731
3862
|
if (!Number.isInteger(e.mediaIndex) || e.mediaIndex < 0) throw TypeError("Vibe mediaIndex must be a non-negative integer.");
|
|
3732
3863
|
}
|
|
3733
|
-
var
|
|
3864
|
+
var gr = class {
|
|
3734
3865
|
generation = 0;
|
|
3735
3866
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
3736
3867
|
state;
|
|
@@ -3738,7 +3869,7 @@ var dr = class {
|
|
|
3738
3869
|
this.options = e, this.state = e.state;
|
|
3739
3870
|
}
|
|
3740
3871
|
remove(e) {
|
|
3741
|
-
|
|
3872
|
+
hr(e);
|
|
3742
3873
|
let t = this.state.items.findIndex(({ postId: t }) => t === e.postId), n = this.state.items[t];
|
|
3743
3874
|
if (!n) return null;
|
|
3744
3875
|
let r = [...P(n)], i = r[e.mediaIndex];
|
|
@@ -3755,7 +3886,7 @@ var dr = class {
|
|
|
3755
3886
|
restored: !1
|
|
3756
3887
|
});
|
|
3757
3888
|
let o = this.state.mediaIndices.get(n.postId) ?? 0, s = this.isReelOpen() && this.state.activeReelPostId === n.postId, c = s && o === e.mediaIndex;
|
|
3758
|
-
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] =
|
|
3889
|
+
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = mr(n, r), this.updateMediaIndexAfterRemoval(n.postId, e.mediaIndex, c), a) : (this.state.items.splice(t, 1), this.options.onPostRemoved(n.postId), this.state.mediaIndices.delete(n.postId), s && this.advanceFromRemovedPost(a, n), a);
|
|
3759
3890
|
}
|
|
3760
3891
|
reset() {
|
|
3761
3892
|
this.generation += 1;
|
|
@@ -3781,7 +3912,7 @@ var dr = class {
|
|
|
3781
3912
|
}
|
|
3782
3913
|
restoreIntoPost(e, t) {
|
|
3783
3914
|
let n = this.state.items[e], r = [...P(n)], i = Math.min(t.mediaIndex, r.length);
|
|
3784
|
-
if (r.splice(i, 0, t.media), this.state.items[e] =
|
|
3915
|
+
if (r.splice(i, 0, t.media), this.state.items[e] = mr(n, r), this.state.activeReelPostId !== t.postId) return;
|
|
3785
3916
|
let a = this.state.mediaIndices.get(t.postId) ?? 0;
|
|
3786
3917
|
a >= i && this.state.mediaIndices.set(t.postId, a + 1);
|
|
3787
3918
|
}
|
|
@@ -3794,18 +3925,18 @@ var dr = class {
|
|
|
3794
3925
|
};
|
|
3795
3926
|
//#endregion
|
|
3796
3927
|
//#region src/core/itemPlacement.ts
|
|
3797
|
-
function
|
|
3928
|
+
function _r(e, t) {
|
|
3798
3929
|
let n = new Set(t);
|
|
3799
3930
|
return e.flatMap((e, t) => n.has(e.postId) ? [{
|
|
3800
3931
|
index: t,
|
|
3801
3932
|
item: e
|
|
3802
3933
|
}] : []);
|
|
3803
3934
|
}
|
|
3804
|
-
function
|
|
3935
|
+
function vr(e, t) {
|
|
3805
3936
|
let n = new Set(t.map(({ item: e }) => e.postId));
|
|
3806
3937
|
return e.filter((e) => !n.has(e.postId));
|
|
3807
3938
|
}
|
|
3808
|
-
function
|
|
3939
|
+
function yr(e, t) {
|
|
3809
3940
|
t.forEach(({ index: e }) => {
|
|
3810
3941
|
if (!Number.isInteger(e) || e < 0) throw Error("Vibe item restore indexes must be non-negative integers.");
|
|
3811
3942
|
});
|
|
@@ -3816,7 +3947,7 @@ function mr(e, t) {
|
|
|
3816
3947
|
}
|
|
3817
3948
|
//#endregion
|
|
3818
3949
|
//#region src/core/itemRemovalController.ts
|
|
3819
|
-
var
|
|
3950
|
+
var br = 20, xr = class {
|
|
3820
3951
|
generation = 0;
|
|
3821
3952
|
historyLimit;
|
|
3822
3953
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
@@ -3825,7 +3956,7 @@ var hr = 20, gr = class {
|
|
|
3825
3956
|
itemOrder;
|
|
3826
3957
|
stopItemsWatcher;
|
|
3827
3958
|
constructor(e) {
|
|
3828
|
-
this.options = e, this.historyLimit = e.historyLimit ??
|
|
3959
|
+
this.options = e, this.historyLimit = e.historyLimit ?? br, this.state = e.state, this.itemOrder = this.state.items.map(({ postId: e }) => e), this.stopItemsWatcher = O(() => this.state.items, (e) => this.appendUnknownItems(e), { flush: "sync" });
|
|
3829
3960
|
}
|
|
3830
3961
|
destroy() {
|
|
3831
3962
|
this.reset(), this.stopItemsWatcher();
|
|
@@ -3839,7 +3970,7 @@ var hr = 20, gr = class {
|
|
|
3839
3970
|
let a = this.options.startRemoval(i, t);
|
|
3840
3971
|
if (a > 0 && await new Promise((e) => setTimeout(e, a)), this.metadata.get(r)?.generation !== this.generation) return r;
|
|
3841
3972
|
let o = this.state.items.findIndex((e) => e.postId === this.state.activeReelPostId), s = new Set(n.map(({ item: e }) => e.postId)), c = o < 0 ? 0 : this.state.items.slice(0, o).filter(({ postId: e }) => s.has(e)).length, l = Math.max(o - c, 0);
|
|
3842
|
-
return this.state.items =
|
|
3973
|
+
return this.state.items = vr(this.state.items, n), this.options.onItemsRemoved(r, n, l), this.record(r), r;
|
|
3843
3974
|
}
|
|
3844
3975
|
reset() {
|
|
3845
3976
|
this.generation += 1, this.history = [], this.itemOrder = [];
|
|
@@ -3850,7 +3981,7 @@ var hr = 20, gr = class {
|
|
|
3850
3981
|
this.restoreRemoval(t);
|
|
3851
3982
|
return;
|
|
3852
3983
|
}
|
|
3853
|
-
let n = new Set(this.state.items.map(({ postId: e }) => e)), r = e.filter(({ item: e }) => n.has(e.postId) ? !1 : (n.add(e.postId), !0)), i =
|
|
3984
|
+
let n = new Set(this.state.items.map(({ postId: e }) => e)), r = e.filter(({ item: e }) => n.has(e.postId) ? !1 : (n.add(e.postId), !0)), i = yr(this.state.items, r);
|
|
3854
3985
|
this.registerExternalPlacements(r), this.state.items = i, r.length > 0 && this.options.onRemovalRestored(r);
|
|
3855
3986
|
}
|
|
3856
3987
|
restoreRemoval(e) {
|
|
@@ -3876,7 +4007,7 @@ var hr = 20, gr = class {
|
|
|
3876
4007
|
}
|
|
3877
4008
|
collectOrderedPlacements(e) {
|
|
3878
4009
|
let t = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
3879
|
-
return
|
|
4010
|
+
return _r(this.state.items, e).map((e) => ({
|
|
3880
4011
|
index: t.get(e.item.postId) ?? e.index,
|
|
3881
4012
|
item: e.item
|
|
3882
4013
|
}));
|
|
@@ -3907,7 +4038,7 @@ var hr = 20, gr = class {
|
|
|
3907
4038
|
let r = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
3908
4039
|
return this.state.items = [...this.state.items, ...n].sort((e, t) => (r.get(e.postId) ?? 2 ** 53 - 1) - (r.get(t.postId) ?? 2 ** 53 - 1)), !0;
|
|
3909
4040
|
}
|
|
3910
|
-
},
|
|
4041
|
+
}, Sr = class {
|
|
3911
4042
|
forward = null;
|
|
3912
4043
|
forwardPromise = null;
|
|
3913
4044
|
forwardVersion = 0;
|
|
@@ -3994,7 +4125,7 @@ var hr = 20, gr = class {
|
|
|
3994
4125
|
}
|
|
3995
4126
|
}
|
|
3996
4127
|
}
|
|
3997
|
-
},
|
|
4128
|
+
}, Cr = class {
|
|
3998
4129
|
generation = 0;
|
|
3999
4130
|
pending = Promise.resolve();
|
|
4000
4131
|
constructor(e) {
|
|
@@ -4044,24 +4175,24 @@ var hr = 20, gr = class {
|
|
|
4044
4175
|
};
|
|
4045
4176
|
//#endregion
|
|
4046
4177
|
//#region src/core/removalControllers.ts
|
|
4047
|
-
function
|
|
4048
|
-
let t = new
|
|
4178
|
+
function wr(e) {
|
|
4179
|
+
let t = new Sr(e), n = new Cr({
|
|
4049
4180
|
state: e.state,
|
|
4050
4181
|
transitionMedia: (t) => e.surface()?.transitionActiveReelMedia(t) ?? Promise.resolve(!1),
|
|
4051
4182
|
transitionPost: (t) => e.surface()?.transitionActiveReelPost(t) ?? Promise.resolve(!1)
|
|
4052
4183
|
});
|
|
4053
4184
|
return {
|
|
4054
|
-
exactMediaRemoval: new
|
|
4185
|
+
exactMediaRemoval: new gr({
|
|
4055
4186
|
onActivate: e.onActivate,
|
|
4056
4187
|
onPostRemoved: (t) => e.onItemsRemoved([t]),
|
|
4057
4188
|
onPostRestored: (t) => e.onItemsRestored([t]),
|
|
4058
4189
|
reelForward: t,
|
|
4059
4190
|
state: e.state
|
|
4060
4191
|
}),
|
|
4061
|
-
itemRemoval: new
|
|
4192
|
+
itemRemoval: new xr({
|
|
4062
4193
|
historyLimit: e.historyLimit,
|
|
4063
4194
|
onItemsRemoved: (n, r, i) => {
|
|
4064
|
-
e.onItemsRemoved(r.map(({ item: e }) => e.postId)),
|
|
4195
|
+
e.onItemsRemoved(r.map(({ item: e }) => e.postId)), pr(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
|
|
4065
4196
|
},
|
|
4066
4197
|
onRemovalRestored: (n) => {
|
|
4067
4198
|
e.onItemsRestored(n.map(({ item: e }) => e.postId));
|
|
@@ -4076,17 +4207,17 @@ function yr(e) {
|
|
|
4076
4207
|
reelRemoval: n
|
|
4077
4208
|
};
|
|
4078
4209
|
}
|
|
4079
|
-
var
|
|
4080
|
-
function
|
|
4210
|
+
var Tr = 1.5;
|
|
4211
|
+
function Er(e) {
|
|
4081
4212
|
let t = Math.min(e.screenWidth, e.screenHeight);
|
|
4082
4213
|
if (t > 0 && t < 600) return !0;
|
|
4083
|
-
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n *
|
|
4214
|
+
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * Tr;
|
|
4084
4215
|
return !e.hasHover && n > 0 && n < 600 && r;
|
|
4085
4216
|
}
|
|
4086
|
-
function
|
|
4087
|
-
return
|
|
4217
|
+
function Dr(e) {
|
|
4218
|
+
return Er(e) ? "reel" : "masonry";
|
|
4088
4219
|
}
|
|
4089
|
-
function
|
|
4220
|
+
function Or(e) {
|
|
4090
4221
|
let t = e.ownerDocument.defaultView, n = e.ownerDocument.documentElement;
|
|
4091
4222
|
return {
|
|
4092
4223
|
hasHover: typeof t?.matchMedia == "function" && t.matchMedia("(hover: hover)").matches,
|
|
@@ -4096,15 +4227,15 @@ function Cr(e) {
|
|
|
4096
4227
|
viewportWidth: n.clientWidth
|
|
4097
4228
|
};
|
|
4098
4229
|
}
|
|
4099
|
-
function
|
|
4100
|
-
return
|
|
4230
|
+
function kr(e) {
|
|
4231
|
+
return Er(Or(e));
|
|
4101
4232
|
}
|
|
4102
|
-
function
|
|
4103
|
-
return
|
|
4233
|
+
function Ar(e) {
|
|
4234
|
+
return Dr(Or(e));
|
|
4104
4235
|
}
|
|
4105
4236
|
//#endregion
|
|
4106
4237
|
//#region src/core/responsiveLayoutController.ts
|
|
4107
|
-
var
|
|
4238
|
+
var jr = class {
|
|
4108
4239
|
layoutMode;
|
|
4109
4240
|
resizeObserver = null;
|
|
4110
4241
|
target = null;
|
|
@@ -4129,10 +4260,24 @@ var Er = class {
|
|
|
4129
4260
|
}
|
|
4130
4261
|
handleResponsiveLayout = () => {
|
|
4131
4262
|
if (!this.target) return;
|
|
4132
|
-
let e =
|
|
4133
|
-
this.state.phoneMode =
|
|
4263
|
+
let e = Ar(this.target);
|
|
4264
|
+
this.state.phoneMode = kr(this.target), this.state.reelInfoSheetOverlay = this.state.phoneMode, this.state.reelMediaSource = this.state.phoneMode ? "mobile" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
|
|
4134
4265
|
};
|
|
4135
|
-
},
|
|
4266
|
+
}, Mr = class {
|
|
4267
|
+
state;
|
|
4268
|
+
constructor(e) {
|
|
4269
|
+
this.options = e, this.state = x(Ye({
|
|
4270
|
+
...e.initialReelAudioState,
|
|
4271
|
+
muted: e.initialReelAudioState?.muted ?? e.mediaCard?.videoMuted ?? !1
|
|
4272
|
+
}));
|
|
4273
|
+
}
|
|
4274
|
+
get() {
|
|
4275
|
+
return { ...this.state };
|
|
4276
|
+
}
|
|
4277
|
+
set(e, t = !1) {
|
|
4278
|
+
Object.assign(this.state, Ye(e, this.state)), t && this.options.onReelAudioStateChange?.(this.get());
|
|
4279
|
+
}
|
|
4280
|
+
}, Nr = class {
|
|
4136
4281
|
routedReelPostId = null;
|
|
4137
4282
|
reelRouteIsActive = !1;
|
|
4138
4283
|
constructor(e, t) {
|
|
@@ -4159,7 +4304,7 @@ var Er = class {
|
|
|
4159
4304
|
let i = this.reelRouteIsActive ? "replace" : "push";
|
|
4160
4305
|
this.reelRouteIsActive = !0, this.routedReelPostId = e, this.options.router[i](r);
|
|
4161
4306
|
}
|
|
4162
|
-
},
|
|
4307
|
+
}, Pr = class {
|
|
4163
4308
|
app = null;
|
|
4164
4309
|
autoScroll;
|
|
4165
4310
|
autofillController;
|
|
@@ -4179,26 +4324,27 @@ var Er = class {
|
|
|
4179
4324
|
stopStateWatcher = null;
|
|
4180
4325
|
lastLoadedCursor = null;
|
|
4181
4326
|
notificationItems;
|
|
4327
|
+
reelAudio;
|
|
4182
4328
|
state;
|
|
4183
4329
|
constructor(e) {
|
|
4184
|
-
this.options = e,
|
|
4330
|
+
this.options = e, or(e);
|
|
4185
4331
|
let t = e.layout ?? "masonry";
|
|
4186
|
-
this.state = x(
|
|
4332
|
+
this.state = x(rr(e, t)), this.reelAudio = new Mr(e), this.lastLoadedCursor = e.initialPage ? $t(e.initialPage) : null, this.notificationItems = R(this.state), this.autoScroll = new Dn({
|
|
4187
4333
|
getScrollElement: () => this.surface?.getAutoScrollElement() ?? null,
|
|
4188
4334
|
state: this.state.autoScroll
|
|
4189
|
-
}), this.autofillController = new
|
|
4335
|
+
}), this.autofillController = new xn({
|
|
4190
4336
|
cancelRequest: () => this.cancelRequest(),
|
|
4191
4337
|
onLastCursor: (e) => this.setCurrentCursor(e),
|
|
4192
4338
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
4193
4339
|
options: e.autofill,
|
|
4194
4340
|
state: this.state
|
|
4195
|
-
}), this.removalReconciliation = new
|
|
4341
|
+
}), this.removalReconciliation = new fr(e), this.removalReconciliation.recordInitialPage(e.initialPage), this.fillController = new Jn({
|
|
4196
4342
|
fill: e.fill,
|
|
4197
4343
|
loadPage: e.loadPage ? (e) => this.loadFilteredPage(e) : void 0,
|
|
4198
4344
|
needsFrontendPreparation: () => this.removalReconciliation.needsReconciliation(this.state.items),
|
|
4199
4345
|
onLastCursor: (e) => this.setCurrentCursor(e),
|
|
4200
4346
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
4201
|
-
prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) =>
|
|
4347
|
+
prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) => Yn({
|
|
4202
4348
|
controller: this.removalReconciliation,
|
|
4203
4349
|
isCurrent: t,
|
|
4204
4350
|
loadPage: e.loadPage,
|
|
@@ -4208,8 +4354,8 @@ var Er = class {
|
|
|
4208
4354
|
state: this.state
|
|
4209
4355
|
}),
|
|
4210
4356
|
state: this.state
|
|
4211
|
-
}), this.routing = new
|
|
4212
|
-
let n =
|
|
4357
|
+
}), this.routing = new Nr(e.routing, this.state);
|
|
4358
|
+
let n = wr({
|
|
4213
4359
|
historyLimit: e.removalHistoryLimit,
|
|
4214
4360
|
onActivate: (e) => this.setActiveReelPost(e),
|
|
4215
4361
|
onItemsRemoved: (e) => this.removalReconciliation.remove(e),
|
|
@@ -4218,25 +4364,26 @@ var Er = class {
|
|
|
4218
4364
|
state: this.state,
|
|
4219
4365
|
surface: () => this.surface
|
|
4220
4366
|
});
|
|
4221
|
-
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new
|
|
4367
|
+
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new jr(t, this.state, () => {
|
|
4222
4368
|
this.routing.syncFeed();
|
|
4223
4369
|
}), this.startStateNotifications();
|
|
4224
4370
|
}
|
|
4225
4371
|
async mount() {
|
|
4226
4372
|
if (this.app) throw Error("Vibe is already mounted.");
|
|
4227
4373
|
this.startStateNotifications();
|
|
4228
|
-
let e =
|
|
4229
|
-
this.responsiveLayout.mount(e), this.app = i(
|
|
4374
|
+
let e = sr(this.options.target);
|
|
4375
|
+
this.responsiveLayout.mount(e), this.app = i(Jt, {
|
|
4230
4376
|
canRetryEnd: !!this.options.loadPage,
|
|
4231
4377
|
cardFooter: this.options.cardFooter,
|
|
4232
4378
|
cardHeader: this.options.cardHeader,
|
|
4233
4379
|
feedFooter: this.options.feedFooter,
|
|
4234
|
-
feedFooterActions:
|
|
4380
|
+
feedFooterActions: Xn(this),
|
|
4235
4381
|
mediaCard: this.options.mediaCard,
|
|
4236
4382
|
masonry: this.options.masonry,
|
|
4237
4383
|
onMediaReady: this.options.onMediaReady,
|
|
4238
4384
|
onMediaVisible: this.options.onMediaVisible,
|
|
4239
4385
|
onReelMediaChange: this.options.onReelMediaChange,
|
|
4386
|
+
reelAudioState: this.reelAudio.state,
|
|
4240
4387
|
reelInfoSheet: this.options.reelInfoSheet,
|
|
4241
4388
|
state: this.state,
|
|
4242
4389
|
onActiveReelChange: (e) => {
|
|
@@ -4248,13 +4395,14 @@ var Er = class {
|
|
|
4248
4395
|
},
|
|
4249
4396
|
onOpenReel: (e) => this.openMasonryReel(e),
|
|
4250
4397
|
onReelInfoSheetChange: (e) => this.setReelInfoSheet(e),
|
|
4398
|
+
onReelAudioChange: (e) => this.reelAudio.set(e, !0),
|
|
4251
4399
|
onRetryEnd: () => {
|
|
4252
4400
|
this.retryEnd();
|
|
4253
4401
|
},
|
|
4254
4402
|
onRetryForward: () => {
|
|
4255
4403
|
this.retryReelForward();
|
|
4256
4404
|
}
|
|
4257
|
-
}), this.surface = this.app.mount(e), this.autoScroll.mount(), await
|
|
4405
|
+
}), this.surface = this.app.mount(e), this.autoScroll.mount(), await Mn(this.options.restoreBacklog, (e) => this.appendPage(e), (e) => {
|
|
4258
4406
|
this.restoreController = e;
|
|
4259
4407
|
}), !this.options.initialPage && this.state.items.length === 0 ? await this.reload() : this.options.autofill && this.state.autofill.status === "idle" && !this.fillController.isActive() && !this.state.loadMoreLocked && await this.startInitialAutofill();
|
|
4260
4408
|
}
|
|
@@ -4264,6 +4412,12 @@ var Er = class {
|
|
|
4264
4412
|
getState() {
|
|
4265
4413
|
return z(this.state);
|
|
4266
4414
|
}
|
|
4415
|
+
getReelAudioState() {
|
|
4416
|
+
return this.reelAudio.get();
|
|
4417
|
+
}
|
|
4418
|
+
setReelAudioState(e) {
|
|
4419
|
+
this.reelAudio.set(e);
|
|
4420
|
+
}
|
|
4267
4421
|
removeMedia(e) {
|
|
4268
4422
|
return this.exactMediaRemoval.remove(e);
|
|
4269
4423
|
}
|
|
@@ -4319,7 +4473,7 @@ var Er = class {
|
|
|
4319
4473
|
this.autoScroll.setSpeed(e);
|
|
4320
4474
|
}
|
|
4321
4475
|
applyAutofillUpdate(e) {
|
|
4322
|
-
let t =
|
|
4476
|
+
let t = An(this.options.autofill, this.state, e);
|
|
4323
4477
|
return t && this.autofillController.syncCountdown(), t;
|
|
4324
4478
|
}
|
|
4325
4479
|
cancelAutofill() {
|
|
@@ -4330,7 +4484,7 @@ var Er = class {
|
|
|
4330
4484
|
await this.cancelFill();
|
|
4331
4485
|
return;
|
|
4332
4486
|
}
|
|
4333
|
-
if (
|
|
4487
|
+
if (_n(this.state.autofill)) {
|
|
4334
4488
|
await this.cancelAutofill();
|
|
4335
4489
|
return;
|
|
4336
4490
|
}
|
|
@@ -4344,12 +4498,12 @@ var Er = class {
|
|
|
4344
4498
|
}
|
|
4345
4499
|
async fill(e) {
|
|
4346
4500
|
if (!this.state.loadMoreLocked) {
|
|
4347
|
-
if (this.pendingRequest ||
|
|
4501
|
+
if (this.pendingRequest || _n(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
|
|
4348
4502
|
await this.fillController.start(e);
|
|
4349
4503
|
}
|
|
4350
4504
|
}
|
|
4351
4505
|
restoreAutofillSession(e) {
|
|
4352
|
-
let t =
|
|
4506
|
+
let t = jn(this.options.autofill, this.state, e);
|
|
4353
4507
|
return t && this.autofillController.syncCountdown(), t;
|
|
4354
4508
|
}
|
|
4355
4509
|
restoreFillSession(e) {
|
|
@@ -4359,14 +4513,14 @@ var Er = class {
|
|
|
4359
4513
|
return this.startLoadMore(() => this.loadNextSequence());
|
|
4360
4514
|
}
|
|
4361
4515
|
appendPage(e) {
|
|
4362
|
-
|
|
4516
|
+
en(e, this.state, this.removalReconciliation, (e) => this.setCurrentCursor(e));
|
|
4363
4517
|
}
|
|
4364
4518
|
replenishAfterRemoval() {
|
|
4365
4519
|
return this.startLoadMore(() => this.replenishAfterRemovalSequence());
|
|
4366
4520
|
}
|
|
4367
4521
|
async startLoadMore(e) {
|
|
4368
4522
|
if (this.pendingRequest) return this.pendingRequest;
|
|
4369
|
-
if (this.state.loadMoreLocked ||
|
|
4523
|
+
if (this.state.loadMoreLocked || _n(this.state.autofill) || this.fillController.isActive() || !this.options.loadPage || this.state.next === null && !this.removalReconciliation.needsReconciliation(this.state.items)) return;
|
|
4370
4524
|
this.state.isLoadingMore = !0, this.state.nextPageError = null;
|
|
4371
4525
|
let t = e();
|
|
4372
4526
|
return this.pendingRequest = t, t.finally(() => {
|
|
@@ -4381,12 +4535,12 @@ var Er = class {
|
|
|
4381
4535
|
}
|
|
4382
4536
|
async replaceFeed(e, t) {
|
|
4383
4537
|
if (!this.options.loadPage) throw Error(`Vibe cannot ${t} without loadPage.`);
|
|
4384
|
-
return
|
|
4538
|
+
return _n(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.state.autofill = gn(this.options.autofill, void 0, !1), this.fillController.reset(), this.reelForward.reset(), this.reelRemoval.reset(), this.exactMediaRemoval.reset(), this.itemRemoval.reset(), this.removalReconciliation.reset(), this.state.error = null, this.state.current = null, this.state.isLoading = !0, this.state.items = [], this.state.next = null, this.state.nextPageError = null, this.state.total = null, this.startRequest(e, !1);
|
|
4385
4539
|
}
|
|
4386
4540
|
async loadFilteredPage(e) {
|
|
4387
4541
|
let t = this.options.loadPage;
|
|
4388
4542
|
if (!t) throw Error("Vibe cannot load a page without loadPage.");
|
|
4389
|
-
let n =
|
|
4543
|
+
let n = Yt(await t(e));
|
|
4390
4544
|
return {
|
|
4391
4545
|
...n,
|
|
4392
4546
|
items: this.removalReconciliation.filterItems(n.items)
|
|
@@ -4405,7 +4559,7 @@ var Er = class {
|
|
|
4405
4559
|
let t = ++this.requestVersion, n = new AbortController();
|
|
4406
4560
|
this.abortController = n;
|
|
4407
4561
|
try {
|
|
4408
|
-
let r = await
|
|
4562
|
+
let r = await Yn({
|
|
4409
4563
|
controller: this.removalReconciliation,
|
|
4410
4564
|
isCurrent: () => t === this.requestVersion,
|
|
4411
4565
|
loadPage: e,
|
|
@@ -4423,7 +4577,7 @@ var Er = class {
|
|
|
4423
4577
|
}
|
|
4424
4578
|
async retryEnd() {
|
|
4425
4579
|
if (this.pendingRequest) return this.pendingRequest;
|
|
4426
|
-
if (!this.state.loadMoreLocked && !(
|
|
4580
|
+
if (!this.state.loadMoreLocked && !(_n(this.state.autofill) || this.fillController.isActive()) && !(this.state.next !== null || !this.options.loadPage)) return this.state.isLoadingMore = !0, this.state.nextPageError = null, this.startRequest(this.lastLoadedCursor, !0);
|
|
4427
4581
|
}
|
|
4428
4582
|
setInfiniteScroll(e) {
|
|
4429
4583
|
this.state.infiniteScroll = e, e && m(() => this.surface?.loadIfNearBottom());
|
|
@@ -4447,10 +4601,10 @@ var Er = class {
|
|
|
4447
4601
|
this.state.total = e;
|
|
4448
4602
|
}
|
|
4449
4603
|
setReelAutoAdvance(e) {
|
|
4450
|
-
|
|
4604
|
+
er(this.state.reelAutoAdvance, e);
|
|
4451
4605
|
}
|
|
4452
4606
|
setReelInfoSheet(e) {
|
|
4453
|
-
|
|
4607
|
+
nr(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
|
|
4454
4608
|
}
|
|
4455
4609
|
setLayout(e) {
|
|
4456
4610
|
this.responsiveLayout.setLayout(e);
|
|
@@ -4470,7 +4624,7 @@ var Er = class {
|
|
|
4470
4624
|
async fetchPage(e, t) {
|
|
4471
4625
|
if (!this.options.loadPage) return;
|
|
4472
4626
|
let n = ++this.requestVersion, r = new AbortController();
|
|
4473
|
-
this.abortController = r, await
|
|
4627
|
+
this.abortController = r, await cr({
|
|
4474
4628
|
append: t,
|
|
4475
4629
|
autofillController: this.autofillController,
|
|
4476
4630
|
cursor: e,
|
|
@@ -4492,7 +4646,7 @@ var Er = class {
|
|
|
4492
4646
|
startInitialAutofill() {
|
|
4493
4647
|
let e = ++this.requestVersion, t = new AbortController(), n = this.autofillController.beginCycle();
|
|
4494
4648
|
this.abortController = t, this.state.isLoadingMore = !0;
|
|
4495
|
-
let r =
|
|
4649
|
+
let r = Nn({
|
|
4496
4650
|
cycleId: n,
|
|
4497
4651
|
isCurrent: () => e === this.requestVersion,
|
|
4498
4652
|
onCollection: (t) => this.autofillController.captureCollection(t, e === this.requestVersion),
|
|
@@ -4519,8 +4673,8 @@ var Er = class {
|
|
|
4519
4673
|
this.lastLoadedCursor = e, this.state.current = e;
|
|
4520
4674
|
}
|
|
4521
4675
|
};
|
|
4522
|
-
function
|
|
4523
|
-
return new
|
|
4676
|
+
function Fr(e) {
|
|
4677
|
+
return new Pr(e);
|
|
4524
4678
|
}
|
|
4525
4679
|
//#endregion
|
|
4526
|
-
export {
|
|
4680
|
+
export { Fr as createVibe };
|