@wyxos/vibe 5.5.4 → 5.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/useMediaLoading.d.ts +3 -1
- package/lib/components/useMediaReadiness.d.ts +19 -0
- package/lib/core/appendPage.d.ts +4 -0
- package/lib/core/backlogRestore.d.ts +2 -0
- package/lib/core/feedFooter.d.ts +1 -0
- package/lib/core/fillController.d.ts +1 -0
- package/lib/core/mediaType.d.ts +2 -0
- package/lib/core/page.d.ts +2 -0
- package/lib/index.cjs +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +913 -737
- package/lib/types.d.ts +14 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -54,10 +54,10 @@ var R = {
|
|
|
54
54
|
key: 0,
|
|
55
55
|
class: "load-more-status",
|
|
56
56
|
role: "status"
|
|
57
|
-
}, B = ["disabled"],
|
|
57
|
+
}, B = ["disabled"], ee = {
|
|
58
58
|
key: 2,
|
|
59
59
|
class: "end-feed"
|
|
60
|
-
},
|
|
60
|
+
}, V = ["disabled"], H = /* @__PURE__ */ d({
|
|
61
61
|
__name: "GalleryFooter",
|
|
62
62
|
props: {
|
|
63
63
|
canRetryEnd: { type: Boolean },
|
|
@@ -80,7 +80,7 @@ var R = {
|
|
|
80
80
|
type: "button",
|
|
81
81
|
disabled: e.loadMoreLocked,
|
|
82
82
|
onClick: i
|
|
83
|
-
}, T(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9, B)) : (b(), s("div",
|
|
83
|
+
}, T(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9, B)) : (b(), s("div", ee, [n[1] ||= c("p", {
|
|
84
84
|
class: "end-feed-message",
|
|
85
85
|
role: "status"
|
|
86
86
|
}, " You've reached the end. ", -1), c("button", {
|
|
@@ -89,7 +89,7 @@ var R = {
|
|
|
89
89
|
type: "button",
|
|
90
90
|
disabled: e.loadMoreLocked,
|
|
91
91
|
onClick: n[0] ||= (e) => t.$emit("retryEnd")
|
|
92
|
-
}, " Check for more ", 8,
|
|
92
|
+
}, " Check for more ", 8, V)]))])) : o("", !0);
|
|
93
93
|
}
|
|
94
94
|
}), U = /* @__PURE__ */ d({
|
|
95
95
|
__name: "FeedFooter",
|
|
@@ -128,7 +128,7 @@ var R = {
|
|
|
128
128
|
"can-retry-end",
|
|
129
129
|
"show-load-more",
|
|
130
130
|
"state"
|
|
131
|
-
])) : (b(), a(
|
|
131
|
+
])) : (b(), a(H, {
|
|
132
132
|
key: 1,
|
|
133
133
|
"can-retry-end": e.canRetryEnd,
|
|
134
134
|
"has-error": e.hasError,
|
|
@@ -186,29 +186,29 @@ var R = {
|
|
|
186
186
|
])) : o("", !0)], 8, W));
|
|
187
187
|
}
|
|
188
188
|
});
|
|
189
|
-
function
|
|
189
|
+
function ne(e) {
|
|
190
190
|
return e.scrollHeight - e.scrollTop - e.clientHeight <= 240;
|
|
191
191
|
}
|
|
192
192
|
//#endregion
|
|
193
193
|
//#region src/core/masonry.ts
|
|
194
|
-
function
|
|
194
|
+
function re(e) {
|
|
195
195
|
let t = e.preview.width ?? e.width, n = e.preview.height ?? e.height;
|
|
196
196
|
return !t || !n || t <= 0 || n <= 0 ? 1 : n / t;
|
|
197
197
|
}
|
|
198
|
-
function
|
|
198
|
+
function K(e) {
|
|
199
199
|
return e.reduce((t, n, r) => n < e[t] ? r : t, 0);
|
|
200
200
|
}
|
|
201
|
-
function
|
|
201
|
+
function ie(e) {
|
|
202
202
|
return Math.max(0, e.containerHeight) + Math.max(0, e.gap);
|
|
203
203
|
}
|
|
204
|
-
function
|
|
204
|
+
function ae(e, t, n) {
|
|
205
205
|
if (t <= 0 || e.length === 0) return {
|
|
206
206
|
columns: 0,
|
|
207
207
|
height: 0,
|
|
208
208
|
items: []
|
|
209
209
|
};
|
|
210
210
|
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) => {
|
|
211
|
-
let t =
|
|
211
|
+
let t = K(c), n = s * re(e) + i, a = {
|
|
212
212
|
x: t * (s + r),
|
|
213
213
|
y: c[t],
|
|
214
214
|
width: s,
|
|
@@ -224,7 +224,7 @@ function ie(e, t, n) {
|
|
|
224
224
|
}
|
|
225
225
|
//#endregion
|
|
226
226
|
//#region src/core/masonryViewportIndex.ts
|
|
227
|
-
function
|
|
227
|
+
function oe(e, t) {
|
|
228
228
|
let n = /* @__PURE__ */ new Map();
|
|
229
229
|
return e.forEach((e, r) => {
|
|
230
230
|
let i = n.get(e.x) ?? [];
|
|
@@ -235,7 +235,7 @@ function ae(e, t) {
|
|
|
235
235
|
}), n.set(e.x, i);
|
|
236
236
|
}), { columns: [...n.entries()].sort(([e], [t]) => e - t).map(([, e]) => e.sort((e, t) => e.top - t.top || e.index - t.index)) };
|
|
237
237
|
}
|
|
238
|
-
function
|
|
238
|
+
function q(e, t) {
|
|
239
239
|
let n = 0, r = 0, i = e.length;
|
|
240
240
|
for (; r < i;) {
|
|
241
241
|
let a = Math.floor((r + i) / 2);
|
|
@@ -249,7 +249,7 @@ function oe(e, t) {
|
|
|
249
249
|
function se(e, t) {
|
|
250
250
|
let n = Math.max(0, t.overscan), r = t.scrollTop - n, i = t.scrollTop + Math.max(0, t.viewportHeight) + n, a = [], o = 0;
|
|
251
251
|
return e.columns.forEach((e) => {
|
|
252
|
-
let t =
|
|
252
|
+
let t = q(e, r);
|
|
253
253
|
o += t.inspected;
|
|
254
254
|
for (let n = t.index; n < e.length; n += 1) {
|
|
255
255
|
let t = e[n];
|
|
@@ -261,14 +261,14 @@ function se(e, t) {
|
|
|
261
261
|
inspected: o
|
|
262
262
|
};
|
|
263
263
|
}
|
|
264
|
-
function
|
|
264
|
+
function J(e) {
|
|
265
265
|
return e?.minColumnWidth ?? 240;
|
|
266
266
|
}
|
|
267
|
-
function
|
|
267
|
+
function Y(e, t) {
|
|
268
268
|
let n = e?.overscan?.minimumPx ?? 800, r = e?.overscan?.viewportMultiplier ?? 1.5, i = Math.max(n, t * r), a = e?.overscan?.maximumPx;
|
|
269
269
|
return a === void 0 ? i : Math.min(i, a);
|
|
270
270
|
}
|
|
271
|
-
function
|
|
271
|
+
function X(e) {
|
|
272
272
|
if (e?.minColumnWidth !== void 0 && (!Number.isFinite(e.minColumnWidth) || e.minColumnWidth <= 0)) throw TypeError("Vibe masonry minColumnWidth must be a positive number.");
|
|
273
273
|
let t = e?.overscan;
|
|
274
274
|
if (t) {
|
|
@@ -282,10 +282,10 @@ function J(e) {
|
|
|
282
282
|
}
|
|
283
283
|
//#endregion
|
|
284
284
|
//#region src/core/scrollbar.ts
|
|
285
|
-
function
|
|
285
|
+
function Z(e, t, n) {
|
|
286
286
|
return Math.min(n, Math.max(t, e));
|
|
287
287
|
}
|
|
288
|
-
function
|
|
288
|
+
function ce({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize: r, viewportSize: i }) {
|
|
289
289
|
let a = Math.max(0, e), o = Math.max(0, r), s = Math.max(0, i), c = Math.max(0, a - s);
|
|
290
290
|
if (!(c > 0 && o > 0)) return {
|
|
291
291
|
maximumScrollPosition: c,
|
|
@@ -294,23 +294,23 @@ function Y({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize:
|
|
|
294
294
|
thumbSize: o,
|
|
295
295
|
thumbTravel: 0
|
|
296
296
|
};
|
|
297
|
-
let l =
|
|
297
|
+
let l = Z(s / a * o, Math.min(Math.max(0, t), o), o), u = Math.max(0, o - l);
|
|
298
298
|
return {
|
|
299
299
|
maximumScrollPosition: c,
|
|
300
300
|
scrollable: !0,
|
|
301
|
-
thumbOffset: u * (
|
|
301
|
+
thumbOffset: u * (Z(n, 0, c) / c),
|
|
302
302
|
thumbSize: l,
|
|
303
303
|
thumbTravel: u
|
|
304
304
|
};
|
|
305
305
|
}
|
|
306
306
|
//#endregion
|
|
307
307
|
//#region src/components/GalleryScrollbar.vue?vue&type=script&setup=true&lang.ts
|
|
308
|
-
var
|
|
308
|
+
var le = ["aria-hidden"], ue = [
|
|
309
309
|
"aria-controls",
|
|
310
310
|
"aria-valuemax",
|
|
311
311
|
"aria-valuenow",
|
|
312
312
|
"tabindex"
|
|
313
|
-
],
|
|
313
|
+
], de = 32, fe = 40, pe = 120, me = /* @__PURE__ */ d({
|
|
314
314
|
__name: "GalleryScrollbar",
|
|
315
315
|
props: {
|
|
316
316
|
contentSize: {},
|
|
@@ -332,16 +332,16 @@ var de = ["aria-hidden"], fe = [
|
|
|
332
332
|
function k() {
|
|
333
333
|
g !== null && clearTimeout(g), g = setTimeout(() => {
|
|
334
334
|
g = null, o.value || (l.value = !1);
|
|
335
|
-
},
|
|
335
|
+
}, pe);
|
|
336
336
|
}
|
|
337
337
|
function A() {
|
|
338
338
|
l.value = !0, k();
|
|
339
339
|
}
|
|
340
340
|
function j() {
|
|
341
341
|
let e = t.scrollElement, r = i.value;
|
|
342
|
-
return !e || !r ? n :
|
|
342
|
+
return !e || !r ? n : ce({
|
|
343
343
|
contentSize: e.scrollHeight,
|
|
344
|
-
minimumThumbSize:
|
|
344
|
+
minimumThumbSize: de,
|
|
345
345
|
scrollPosition: e.scrollTop,
|
|
346
346
|
trackSize: r.clientHeight,
|
|
347
347
|
viewportSize: e.clientHeight
|
|
@@ -394,7 +394,7 @@ var de = ["aria-hidden"], fe = [
|
|
|
394
394
|
}
|
|
395
395
|
function z(e) {
|
|
396
396
|
if (!E.value) return;
|
|
397
|
-
let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r -
|
|
397
|
+
let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r - fe : e.key === "ArrowDown" ? r + fe : e.key === "PageUp" ? r - n : e.key === "PageDown" ? r + n : e.key === "Home" ? 0 : e.key === "End" ? a.value.maximumScrollPosition : null;
|
|
398
398
|
i !== null && (e.preventDefault(), A(), P(i));
|
|
399
399
|
}
|
|
400
400
|
function B(e) {
|
|
@@ -440,15 +440,15 @@ var de = ["aria-hidden"], fe = [
|
|
|
440
440
|
onPointerdown: I,
|
|
441
441
|
onPointermove: L,
|
|
442
442
|
onPointerup: R
|
|
443
|
-
}, null, 44,
|
|
443
|
+
}, null, 44, ue)], 42, le));
|
|
444
444
|
}
|
|
445
|
-
}),
|
|
445
|
+
}), he = (e) => {
|
|
446
446
|
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
|
447
447
|
return !1;
|
|
448
|
-
},
|
|
449
|
-
let t =
|
|
448
|
+
}, ge = (e) => e === "", _e = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), ve = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), ye = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), be = (e) => {
|
|
449
|
+
let t = ye(e);
|
|
450
450
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
451
|
-
},
|
|
451
|
+
}, xe = {
|
|
452
452
|
xmlns: "http://www.w3.org/2000/svg",
|
|
453
453
|
width: 24,
|
|
454
454
|
height: 24,
|
|
@@ -458,27 +458,27 @@ var de = ["aria-hidden"], fe = [
|
|
|
458
458
|
"stroke-width": 2,
|
|
459
459
|
"stroke-linecap": "round",
|
|
460
460
|
"stroke-linejoin": "round"
|
|
461
|
-
},
|
|
462
|
-
...
|
|
461
|
+
}, Se = ({ name: e, iconNode: t, absoluteStrokeWidth: n, "absolute-stroke-width": r, strokeWidth: i, "stroke-width": a, size: o = xe.width, color: s = xe.stroke, ...c }, { slots: l }) => p("svg", {
|
|
462
|
+
...xe,
|
|
463
463
|
...c,
|
|
464
464
|
width: o,
|
|
465
465
|
height: o,
|
|
466
466
|
stroke: s,
|
|
467
|
-
"stroke-width":
|
|
468
|
-
class:
|
|
469
|
-
...!l.default && !
|
|
470
|
-
}, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]),
|
|
467
|
+
"stroke-width": ge(n) || ge(r) || n === !0 || r === !0 ? Number(i || a || xe["stroke-width"]) * 24 / Number(o) : i || a || xe["stroke-width"],
|
|
468
|
+
class: _e("lucide", c.class, ...e ? [`lucide-${ve(be(e))}-icon`, `lucide-${ve(e)}`] : ["lucide-icon"]),
|
|
469
|
+
...!l.default && !he(c) && { "aria-hidden": "true" }
|
|
470
|
+
}, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]), Ce = (e, t) => (n, { slots: r, attrs: i }) => p(Se, {
|
|
471
471
|
...i,
|
|
472
472
|
...n,
|
|
473
473
|
iconNode: t,
|
|
474
474
|
name: e
|
|
475
|
-
}, r),
|
|
475
|
+
}, r), we = Ce("chevron-left", [["path", {
|
|
476
476
|
d: "m15 18-6-6 6-6",
|
|
477
477
|
key: "1wnfg3"
|
|
478
|
-
}]]),
|
|
478
|
+
}]]), Te = Ce("chevron-right", [["path", {
|
|
479
479
|
d: "m9 18 6-6-6-6",
|
|
480
480
|
key: "mthhwq"
|
|
481
|
-
}]]),
|
|
481
|
+
}]]), Ee = Ce("pause", [["rect", {
|
|
482
482
|
x: "14",
|
|
483
483
|
y: "3",
|
|
484
484
|
width: "5",
|
|
@@ -492,10 +492,10 @@ var de = ["aria-hidden"], fe = [
|
|
|
492
492
|
height: "18",
|
|
493
493
|
rx: "1",
|
|
494
494
|
key: "1wsw3u"
|
|
495
|
-
}]]),
|
|
495
|
+
}]]), De = Ce("play", [["path", {
|
|
496
496
|
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",
|
|
497
497
|
key: "10ikf1"
|
|
498
|
-
}]]),
|
|
498
|
+
}]]), Oe = Ce("volume-2", [
|
|
499
499
|
["path", {
|
|
500
500
|
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",
|
|
501
501
|
key: "uqj9uw"
|
|
@@ -508,7 +508,7 @@ var de = ["aria-hidden"], fe = [
|
|
|
508
508
|
d: "M19.364 18.364a9 9 0 0 0 0-12.728",
|
|
509
509
|
key: "ijwkga"
|
|
510
510
|
}]
|
|
511
|
-
]),
|
|
511
|
+
]), ke = Ce("volume-x", [
|
|
512
512
|
["path", {
|
|
513
513
|
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",
|
|
514
514
|
key: "uqj9uw"
|
|
@@ -527,22 +527,22 @@ var de = ["aria-hidden"], fe = [
|
|
|
527
527
|
y2: "15",
|
|
528
528
|
key: "5ykzw1"
|
|
529
529
|
}]
|
|
530
|
-
]),
|
|
530
|
+
]), Ae = {
|
|
531
531
|
401: "Authentication required",
|
|
532
532
|
403: "Access forbidden",
|
|
533
533
|
404: "Preview not found",
|
|
534
534
|
419: "Session expired",
|
|
535
535
|
500: "Server error"
|
|
536
536
|
};
|
|
537
|
-
function
|
|
537
|
+
function je(e) {
|
|
538
538
|
return e.match(/\/demo-errors\/(401|403|404|419|500)\//)?.[1] ?? "Error";
|
|
539
539
|
}
|
|
540
|
-
function
|
|
541
|
-
return je
|
|
540
|
+
function Me(e) {
|
|
541
|
+
return Ae[je(e)] ?? "Preview unavailable";
|
|
542
542
|
}
|
|
543
543
|
//#endregion
|
|
544
544
|
//#region src/components/CardRegion.vue
|
|
545
|
-
var
|
|
545
|
+
var Ne = /* @__PURE__ */ d({
|
|
546
546
|
__name: "CardRegion",
|
|
547
547
|
props: {
|
|
548
548
|
index: {},
|
|
@@ -589,18 +589,18 @@ var Pe = /* @__PURE__ */ d({
|
|
|
589
589
|
"total"
|
|
590
590
|
]))], 38));
|
|
591
591
|
}
|
|
592
|
-
}),
|
|
592
|
+
}), Pe = [
|
|
593
593
|
"max",
|
|
594
594
|
"value",
|
|
595
595
|
"aria-valuetext",
|
|
596
596
|
"disabled"
|
|
597
|
-
],
|
|
597
|
+
], Fe = {
|
|
598
598
|
key: 0,
|
|
599
599
|
class: "media-controls-row"
|
|
600
|
-
},
|
|
600
|
+
}, Ie = ["aria-label", "title"], Le = { class: "media-controls-audio" }, Re = ["aria-label", "title"], ze = ["value", "aria-valuetext"], Be = {
|
|
601
601
|
class: "media-control-time",
|
|
602
602
|
"aria-live": "off"
|
|
603
|
-
},
|
|
603
|
+
}, Ve = /* @__PURE__ */ d({
|
|
604
604
|
__name: "MediaControls",
|
|
605
605
|
props: {
|
|
606
606
|
currentTime: {},
|
|
@@ -648,35 +648,35 @@ var Pe = /* @__PURE__ */ d({
|
|
|
648
648
|
"aria-valuetext": `${u(p.value)} of ${u(f.value)}`,
|
|
649
649
|
disabled: f.value <= 0,
|
|
650
650
|
onInput: n[0] ||= (e) => i("seek", d(e))
|
|
651
|
-
}, null, 44,
|
|
651
|
+
}, null, 44, Pe), e.layout === "reel" ? (b(), s("div", Fe, [
|
|
652
652
|
c("button", {
|
|
653
653
|
type: "button",
|
|
654
654
|
class: "media-control-button media-control-playback",
|
|
655
655
|
"aria-label": e.playing ? "Pause video" : "Play video",
|
|
656
656
|
title: e.playing ? "Pause" : "Play",
|
|
657
657
|
onClick: n[1] ||= (e) => i("togglePlayback")
|
|
658
|
-
}, [e.playing ? (b(), a(E(
|
|
658
|
+
}, [e.playing ? (b(), a(E(Ee), {
|
|
659
659
|
key: 0,
|
|
660
660
|
size: 18,
|
|
661
661
|
fill: "currentColor"
|
|
662
|
-
})) : (b(), a(E(
|
|
662
|
+
})) : (b(), a(E(De), {
|
|
663
663
|
key: 1,
|
|
664
664
|
size: 18,
|
|
665
665
|
fill: "currentColor"
|
|
666
|
-
}))], 8,
|
|
667
|
-
c("div",
|
|
666
|
+
}))], 8, Ie),
|
|
667
|
+
c("div", Le, [c("button", {
|
|
668
668
|
type: "button",
|
|
669
669
|
class: "media-control-button",
|
|
670
670
|
"aria-label": e.muted ? "Unmute video" : "Mute video",
|
|
671
671
|
title: e.muted ? "Unmute" : "Mute",
|
|
672
672
|
onClick: n[2] ||= (e) => i("toggleMute")
|
|
673
|
-
}, [e.muted || e.volume === 0 ? (b(), a(E(
|
|
673
|
+
}, [e.muted || e.volume === 0 ? (b(), a(E(ke), {
|
|
674
674
|
key: 0,
|
|
675
675
|
size: 18
|
|
676
|
-
})) : (b(), a(E(
|
|
676
|
+
})) : (b(), a(E(Oe), {
|
|
677
677
|
key: 1,
|
|
678
678
|
size: 18
|
|
679
|
-
}))], 8,
|
|
679
|
+
}))], 8, Re), c("input", {
|
|
680
680
|
class: "media-control-range media-control-volume",
|
|
681
681
|
type: "range",
|
|
682
682
|
min: "0",
|
|
@@ -687,14 +687,14 @@ var Pe = /* @__PURE__ */ d({
|
|
|
687
687
|
"aria-label": "Video volume",
|
|
688
688
|
"aria-valuetext": `${Math.round(e.volume * 100)} percent`,
|
|
689
689
|
onInput: n[3] ||= (e) => i("volumeChange", d(e))
|
|
690
|
-
}, null, 44,
|
|
691
|
-
c("output",
|
|
690
|
+
}, null, 44, ze)]),
|
|
691
|
+
c("output", Be, T(u(p.value)) + " / " + T(u(f.value)), 1)
|
|
692
692
|
])) : o("", !0)], 34));
|
|
693
693
|
}
|
|
694
694
|
});
|
|
695
695
|
//#endregion
|
|
696
696
|
//#region src/components/useReelVideoActivity.ts
|
|
697
|
-
function
|
|
697
|
+
function He(e) {
|
|
698
698
|
let t = r(() => e.layout() !== "reel" || e.active() === !0), n = r(() => t.value ? e.videoIsMuted.value : !0);
|
|
699
699
|
function i() {
|
|
700
700
|
if (!t.value) {
|
|
@@ -728,18 +728,21 @@ function Ue(e) {
|
|
|
728
728
|
}
|
|
729
729
|
//#endregion
|
|
730
730
|
//#region src/core/mediaType.ts
|
|
731
|
-
var
|
|
732
|
-
function
|
|
731
|
+
var Ue = /\.(aac|flac|m4a|mp3|mp4|mov|ogg|opus|wav|webm)$/i;
|
|
732
|
+
function We(e) {
|
|
733
733
|
try {
|
|
734
|
-
return
|
|
734
|
+
return Ue.test(new URL(e).pathname);
|
|
735
735
|
} catch {
|
|
736
|
-
return
|
|
736
|
+
return Ue.test(e.split("?")[0] ?? e);
|
|
737
737
|
}
|
|
738
738
|
}
|
|
739
|
+
function Ge(e, t) {
|
|
740
|
+
return e === void 0 ? We(t) : e === "video";
|
|
741
|
+
}
|
|
739
742
|
//#endregion
|
|
740
743
|
//#region src/components/useMediaLoading.ts
|
|
741
744
|
function Ke(e) {
|
|
742
|
-
let t = r(() => Ge(e.mediaSource())), n = r(() => e.layout() === "masonry" && e.fetchPriority() === "low" ? "lazy" : "eager"), i = r(() => e.fetchPriority() === "high" ? "auto" : e.layout() === "masonry" ? "none" : "metadata");
|
|
745
|
+
let t = r(() => Ge(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");
|
|
743
746
|
return O(i, (t, n) => {
|
|
744
747
|
n !== "none" || t === "none" || m(() => e.videoElement.value?.load());
|
|
745
748
|
}), {
|
|
@@ -749,8 +752,65 @@ function Ke(e) {
|
|
|
749
752
|
};
|
|
750
753
|
}
|
|
751
754
|
//#endregion
|
|
755
|
+
//#region src/components/useMediaReadiness.ts
|
|
756
|
+
function qe(e) {
|
|
757
|
+
let t = w(null), n = w(null), i = w(0), a = w(0), o = w(!0), s = w(!1), c = null, l = !1, u = r(() => s.value ? "error" : o.value ? "loading" : e.previewState());
|
|
758
|
+
function d() {
|
|
759
|
+
c !== null && clearTimeout(c), c = null;
|
|
760
|
+
}
|
|
761
|
+
function f(e) {
|
|
762
|
+
return Number(e.currentTarget.dataset.sourceGeneration) === i.value;
|
|
763
|
+
}
|
|
764
|
+
function p() {
|
|
765
|
+
d(), c = setTimeout(() => _(), 15e3);
|
|
766
|
+
}
|
|
767
|
+
function h(t) {
|
|
768
|
+
t && !f(t) || (d(), o.value = !1, s.value = !1, e.onReady(e.mediaIndex()));
|
|
769
|
+
}
|
|
770
|
+
function g() {
|
|
771
|
+
let e = t.value;
|
|
772
|
+
if (e?.complete) {
|
|
773
|
+
e.naturalWidth > 0 ? h() : _();
|
|
774
|
+
return;
|
|
775
|
+
}
|
|
776
|
+
let r = n.value;
|
|
777
|
+
if (r && r.readyState >= HTMLMediaElement.HAVE_METADATA) {
|
|
778
|
+
h();
|
|
779
|
+
return;
|
|
780
|
+
}
|
|
781
|
+
p();
|
|
782
|
+
}
|
|
783
|
+
function _(t) {
|
|
784
|
+
if (!(t && !f(t))) {
|
|
785
|
+
if (d(), !t && a.value === 0) {
|
|
786
|
+
a.value = 1, i.value += 1, o.value = !0, m(g);
|
|
787
|
+
return;
|
|
788
|
+
}
|
|
789
|
+
o.value = !1, s.value = !0, e.onError(e.mediaIndex());
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
function y() {
|
|
793
|
+
a.value = 0, s.value = !1, o.value = !0, i.value += 1, m(g);
|
|
794
|
+
}
|
|
795
|
+
function b(e) {
|
|
796
|
+
f(e) && o.value && p();
|
|
797
|
+
}
|
|
798
|
+
return O(e.identity, () => {
|
|
799
|
+
d(), i.value += 1, a.value = 0, o.value = l || e.previewState() === "loading", s.value = !1, l = !0, m(g);
|
|
800
|
+
}, { immediate: !0 }), v(d), {
|
|
801
|
+
effectivePreviewState: u,
|
|
802
|
+
failSourceAttempt: _,
|
|
803
|
+
imageElement: t,
|
|
804
|
+
markSourceReady: h,
|
|
805
|
+
noteSourceActivity: b,
|
|
806
|
+
retrySource: y,
|
|
807
|
+
sourceGeneration: i,
|
|
808
|
+
videoElement: n
|
|
809
|
+
};
|
|
810
|
+
}
|
|
811
|
+
//#endregion
|
|
752
812
|
//#region src/components/MediaCard.vue?vue&type=script&setup=true&lang.ts
|
|
753
|
-
var
|
|
813
|
+
var Je = [
|
|
754
814
|
"data-post-id",
|
|
755
815
|
"data-media-index",
|
|
756
816
|
"aria-hidden",
|
|
@@ -758,12 +818,13 @@ var qe = [
|
|
|
758
818
|
"inert",
|
|
759
819
|
"role",
|
|
760
820
|
"tabindex"
|
|
761
|
-
],
|
|
821
|
+
], Ye = { class: "media-card-content" }, Xe = ["data-media-direction"], Ze = ["data-media-index"], Qe = {
|
|
762
822
|
key: 0,
|
|
763
823
|
"data-test": "media-loading",
|
|
764
824
|
class: "media-loading",
|
|
765
825
|
"aria-hidden": "true"
|
|
766
|
-
},
|
|
826
|
+
}, $e = ["aria-label"], et = { class: "media-error-code" }, tt = [
|
|
827
|
+
"data-source-generation",
|
|
767
828
|
"src",
|
|
768
829
|
"width",
|
|
769
830
|
"height",
|
|
@@ -771,13 +832,14 @@ var qe = [
|
|
|
771
832
|
"loop",
|
|
772
833
|
"muted",
|
|
773
834
|
"preload"
|
|
774
|
-
],
|
|
835
|
+
], nt = [
|
|
836
|
+
"data-source-generation",
|
|
775
837
|
"src",
|
|
776
838
|
"width",
|
|
777
839
|
"height",
|
|
778
840
|
"fetchpriority",
|
|
779
841
|
"loading"
|
|
780
|
-
],
|
|
842
|
+
], rt = ["aria-label"], it = ["aria-label"], at = ["aria-label"], ot = 40, st = 160, ct = 24, lt = /* @__PURE__ */ d({
|
|
781
843
|
__name: "MediaCard",
|
|
782
844
|
props: {
|
|
783
845
|
active: { type: Boolean },
|
|
@@ -813,116 +875,124 @@ var qe = [
|
|
|
813
875
|
function S(e = !1, t = "pointer") {
|
|
814
876
|
e && x("activate", t);
|
|
815
877
|
}
|
|
816
|
-
let C = r(() => M(l.item)), D = r(() => N(l.item, l.mediaIndex)), O = r(() => P(l.item, D.value)), F = r(() => l.mediaSource === "original" ? O.value.src : O.value.preview.src), I = r(() => l.mediaSource === "original" ? O.value.
|
|
878
|
+
let C = r(() => M(l.item)), D = r(() => N(l.item, l.mediaIndex)), O = r(() => P(l.item, D.value)), F = r(() => l.mediaSource === "original" ? O.value.src : O.value.preview.src), I = r(() => l.mediaSource === "original" ? O.value.type : O.value.preview.type ?? O.value.type), L = r(() => l.mediaSource === "original" ? O.value.width : O.value.preview.width), R = r(() => l.mediaSource === "original" ? O.value.height : O.value.preview.height), { effectivePreviewState: z, failSourceAttempt: B, imageElement: ee, markSourceReady: V, noteSourceActivity: H, retrySource: U, sourceGeneration: W, videoElement: G } = qe({
|
|
879
|
+
identity: () => `${l.item.postId}:${D.value}:${l.mediaSource ?? "preview"}:${F.value}:${I.value ?? ""}`,
|
|
880
|
+
mediaIndex: () => D.value,
|
|
881
|
+
onError: (e) => x("error", e),
|
|
882
|
+
onReady: (e) => x("ready", e),
|
|
883
|
+
previewState: () => l.previewState
|
|
884
|
+
}), te = w(0), ne = w(0), re = w(l.mediaCard?.videoMuted ?? l.layout === "masonry"), K = w(!1), ie = w(1), ae = 1, { effectiveMuted: oe, onPlaying: q, playbackAllowed: se } = He({
|
|
817
885
|
active: () => l.active,
|
|
818
886
|
layout: () => l.layout,
|
|
819
|
-
videoElement:
|
|
820
|
-
videoIsMuted:
|
|
821
|
-
videoIsPlaying:
|
|
822
|
-
}),
|
|
823
|
-
function
|
|
887
|
+
videoElement: G,
|
|
888
|
+
videoIsMuted: re,
|
|
889
|
+
videoIsPlaying: K
|
|
890
|
+
}), J = r(() => l.interactive && !!(l.cardHeader || l.cardFooter));
|
|
891
|
+
function Y(e) {
|
|
824
892
|
return e.detail === 0 ? "keyboard" : "pointer";
|
|
825
893
|
}
|
|
826
|
-
function
|
|
894
|
+
function X(e, t) {
|
|
827
895
|
let n = C.value.length, r = (e + n) % n;
|
|
828
896
|
r !== D.value && (y.value = e < D.value ? "previous" : "next", x("mediaChange", r), t && t.detail > 0 && t.currentTarget?.blur());
|
|
829
897
|
}
|
|
830
|
-
function
|
|
898
|
+
function Z(e, t, n) {
|
|
831
899
|
return t === 1 ? e * 16 : t === 2 ? e * n : e;
|
|
832
900
|
}
|
|
833
|
-
function
|
|
901
|
+
function ce() {
|
|
834
902
|
f = 0, p = !1, d !== null && clearTimeout(d), d = null;
|
|
835
903
|
}
|
|
836
|
-
function
|
|
837
|
-
d !== null && clearTimeout(d), d = setTimeout(
|
|
904
|
+
function le() {
|
|
905
|
+
d !== null && clearTimeout(d), d = setTimeout(ce, st);
|
|
838
906
|
}
|
|
839
|
-
function
|
|
907
|
+
function ue(e) {
|
|
840
908
|
if (C.value.length <= 1) return;
|
|
841
|
-
let t = e.currentTarget?.clientWidth || 1, n =
|
|
842
|
-
if (n === 0 || (e.preventDefault(),
|
|
909
|
+
let t = e.currentTarget?.clientWidth || 1, n = Z(e.deltaX, e.deltaMode, t);
|
|
910
|
+
if (n === 0 || (e.preventDefault(), le(), p) || (f += n, Math.abs(f) < ct)) return;
|
|
843
911
|
let r = Math.sign(f);
|
|
844
|
-
f = 0, p = !0,
|
|
912
|
+
f = 0, p = !0, X(D.value + r);
|
|
845
913
|
}
|
|
846
|
-
function
|
|
914
|
+
function de(e) {
|
|
847
915
|
let t = e.touches[0];
|
|
848
916
|
l.layout !== "reel" || !t || (m = t.clientX, g = t.clientY);
|
|
849
917
|
}
|
|
850
|
-
function
|
|
918
|
+
function fe(e) {
|
|
851
919
|
let t = e.changedTouches[0];
|
|
852
920
|
if (m === null || g === null || !t) return;
|
|
853
921
|
let n = m - t.clientX, r = g - t.clientY;
|
|
854
|
-
m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) <
|
|
922
|
+
m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) < ot || X(D.value + Math.sign(n)));
|
|
855
923
|
}
|
|
856
|
-
let { imageLoading:
|
|
924
|
+
let { imageLoading: pe, mediaIsTimed: me, videoPreload: he } = Ke({
|
|
925
|
+
active: () => l.active,
|
|
857
926
|
fetchPriority: () => l.fetchPriority,
|
|
858
927
|
layout: () => l.layout,
|
|
859
928
|
mediaSource: () => F.value,
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
929
|
+
mediaType: () => I.value,
|
|
930
|
+
videoElement: G
|
|
931
|
+
}), ge = r(() => l.layout === "reel" && l.stationaryReelControls === !0), _e = r(() => me.value && z.value === "ready" && (!ge.value || !!(l.active && l.reelControlsTarget))), ve = r(() => `${l.item.postId}:${D.value}:${F.value}`);
|
|
932
|
+
function ye(e) {
|
|
933
|
+
l.layout === "reel" && (e.stopPropagation(), be());
|
|
864
934
|
}
|
|
865
|
-
async function
|
|
866
|
-
if (!(!
|
|
867
|
-
if (
|
|
868
|
-
|
|
935
|
+
async function be() {
|
|
936
|
+
if (!(!G.value || !se.value)) {
|
|
937
|
+
if (K.value) {
|
|
938
|
+
G.value.pause();
|
|
869
939
|
return;
|
|
870
940
|
}
|
|
871
941
|
try {
|
|
872
|
-
await
|
|
942
|
+
await G.value.play();
|
|
873
943
|
} catch {
|
|
874
|
-
|
|
944
|
+
K.value = !1;
|
|
875
945
|
}
|
|
876
946
|
}
|
|
877
947
|
}
|
|
878
|
-
function
|
|
948
|
+
function xe(e) {
|
|
879
949
|
return Number.isFinite(e) ? Math.max(0, e) : 0;
|
|
880
950
|
}
|
|
881
|
-
function
|
|
882
|
-
let t = e?.currentTarget ??
|
|
883
|
-
t && (
|
|
951
|
+
function Se(e) {
|
|
952
|
+
let t = e?.currentTarget ?? G.value;
|
|
953
|
+
t && (te.value = xe(t.currentTime), ne.value = xe(t.duration), se.value && (re.value = t.muted), ie.value = t.volume, t.volume > 0 && (ae = t.volume));
|
|
884
954
|
}
|
|
885
|
-
function
|
|
886
|
-
|
|
955
|
+
function Ce(e) {
|
|
956
|
+
Se(e), V(e);
|
|
887
957
|
}
|
|
888
|
-
function
|
|
889
|
-
|
|
958
|
+
function Ee() {
|
|
959
|
+
K.value = !1, x("ended", D.value);
|
|
890
960
|
}
|
|
891
|
-
function
|
|
892
|
-
let t =
|
|
893
|
-
!t || !Number.isFinite(e) || (t.currentTime = Math.min(
|
|
961
|
+
function De(e) {
|
|
962
|
+
let t = G.value;
|
|
963
|
+
!t || !Number.isFinite(e) || (t.currentTime = Math.min(xe(t.duration), Math.max(0, e)), te.value = t.currentTime);
|
|
894
964
|
}
|
|
895
|
-
function
|
|
896
|
-
let t =
|
|
965
|
+
function Oe(e) {
|
|
966
|
+
let t = G.value;
|
|
897
967
|
if (!t || !Number.isFinite(e)) return;
|
|
898
968
|
let n = Math.min(1, Math.max(0, e));
|
|
899
|
-
t.volume = n, t.muted = n === 0, n > 0 && (
|
|
969
|
+
t.volume = n, t.muted = n === 0, n > 0 && (ae = n), Se();
|
|
900
970
|
}
|
|
901
|
-
function
|
|
902
|
-
let e =
|
|
903
|
-
e && (e.muted && e.volume === 0 && (e.volume =
|
|
971
|
+
function ke() {
|
|
972
|
+
let e = G.value;
|
|
973
|
+
e && (e.muted && e.volume === 0 && (e.volume = ae), e.muted = !e.muted, Se());
|
|
904
974
|
}
|
|
905
975
|
return v(() => {
|
|
906
|
-
|
|
976
|
+
ce();
|
|
907
977
|
}), (r, i) => (b(), s("article", {
|
|
908
978
|
"data-post-id": e.item.postId,
|
|
909
979
|
"data-media-index": D.value,
|
|
910
980
|
class: h(["media-card", {
|
|
911
981
|
"media-card--entering": e.entering,
|
|
912
982
|
"media-card--leaving": e.leaving,
|
|
913
|
-
"media-card--error":
|
|
983
|
+
"media-card--error": E(z) === "error",
|
|
914
984
|
"media-card--transparent-chrome": e.mediaCard?.header?.background === "transparent" || e.mediaCard?.footer?.background === "transparent" || e.cardHeader?.background === "transparent" || e.cardFooter?.background === "transparent"
|
|
915
985
|
}]),
|
|
916
986
|
style: _(e.itemStyle),
|
|
917
987
|
"aria-hidden": e.leaving || void 0,
|
|
918
|
-
"aria-busy":
|
|
988
|
+
"aria-busy": E(z) === "loading",
|
|
919
989
|
inert: e.leaving || void 0,
|
|
920
|
-
role: e.interactive && !e.leaving && !
|
|
921
|
-
tabindex: e.interactive && !e.leaving && !
|
|
922
|
-
onClick: i[
|
|
923
|
-
onKeydown: [i[
|
|
924
|
-
}, [c("div",
|
|
925
|
-
e.cardHeader ? (b(), a(
|
|
990
|
+
role: e.interactive && !e.leaving && !J.value ? "button" : void 0,
|
|
991
|
+
tabindex: e.interactive && !e.leaving && !J.value ? 0 : void 0,
|
|
992
|
+
onClick: i[15] ||= (t) => S(e.interactive && !J.value, Y(t)),
|
|
993
|
+
onKeydown: [i[16] ||= A((t) => S(e.interactive && !J.value, "keyboard"), ["enter"]), i[17] ||= A(j((t) => S(e.interactive && !J.value, "keyboard"), ["prevent"]), ["space"])]
|
|
994
|
+
}, [c("div", Ye, [
|
|
995
|
+
e.cardHeader ? (b(), a(Ne, {
|
|
926
996
|
key: 0,
|
|
927
997
|
index: e.index,
|
|
928
998
|
item: e.item,
|
|
@@ -948,81 +1018,96 @@ var qe = [
|
|
|
948
1018
|
c("div", {
|
|
949
1019
|
class: h(["media-card-media", { "media-card-media--carousel": e.layout === "reel" && C.value.length > 1 }]),
|
|
950
1020
|
"data-media-direction": y.value,
|
|
951
|
-
onWheel:
|
|
952
|
-
onTouchstartPassive:
|
|
953
|
-
onTouchendPassive:
|
|
1021
|
+
onWheel: ue,
|
|
1022
|
+
onTouchstartPassive: de,
|
|
1023
|
+
onTouchendPassive: fe
|
|
954
1024
|
}, [
|
|
955
1025
|
u(n, { name: `media-slide-${y.value}` }, {
|
|
956
1026
|
default: k(() => [(b(), s("div", {
|
|
957
|
-
key: `${e.item.postId}:${O.value.src}:${e.mediaSource ?? "preview"}`,
|
|
1027
|
+
key: `${e.item.postId}:${O.value.src}:${e.mediaSource ?? "preview"}:${E(W)}`,
|
|
958
1028
|
class: "media-card-frame",
|
|
959
1029
|
"data-media-index": D.value
|
|
960
|
-
}, [
|
|
1030
|
+
}, [E(z) === "loading" ? (b(), s("div", Qe, [...i[18] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : E(z) === "error" ? (b(), s("div", {
|
|
961
1031
|
key: 1,
|
|
962
1032
|
"data-test": "media-error",
|
|
963
1033
|
class: "media-error",
|
|
964
1034
|
role: "img",
|
|
965
|
-
"aria-label": `${E(
|
|
966
|
-
}, [
|
|
1035
|
+
"aria-label": `${E(je)(F.value)} ${E(Me)(F.value)}`
|
|
1036
|
+
}, [
|
|
1037
|
+
c("strong", et, T(E(je)(F.value)), 1),
|
|
1038
|
+
c("span", null, T(E(Me)(F.value)), 1),
|
|
1039
|
+
c("button", {
|
|
1040
|
+
type: "button",
|
|
1041
|
+
"data-test": "media-retry",
|
|
1042
|
+
onClick: i[0] ||= j((...e) => E(U) && E(U)(...e), ["stop"])
|
|
1043
|
+
}, "Retry")
|
|
1044
|
+
], 8, $e)) : o("", !0), E(me) ? (b(), s("video", {
|
|
967
1045
|
key: 2,
|
|
968
1046
|
ref_key: "videoElement",
|
|
969
|
-
ref:
|
|
1047
|
+
ref: G,
|
|
1048
|
+
"data-source-generation": E(W),
|
|
970
1049
|
class: h(["media-preview", {
|
|
971
|
-
"media-preview--ready":
|
|
1050
|
+
"media-preview--ready": E(z) === "ready",
|
|
972
1051
|
"media-preview--reel-video": e.layout === "reel"
|
|
973
1052
|
}]),
|
|
974
1053
|
src: F.value,
|
|
975
|
-
width:
|
|
976
|
-
height:
|
|
977
|
-
autoplay: E(
|
|
1054
|
+
width: L.value ?? void 0,
|
|
1055
|
+
height: R.value ?? void 0,
|
|
1056
|
+
autoplay: E(se),
|
|
978
1057
|
loop: !e.advanceOnMediaEnd,
|
|
979
|
-
muted: E(
|
|
1058
|
+
muted: E(oe),
|
|
980
1059
|
playsinline: "",
|
|
981
|
-
preload: E(
|
|
982
|
-
onLoadedmetadata:
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
1060
|
+
preload: E(he),
|
|
1061
|
+
onLoadedmetadata: Ce,
|
|
1062
|
+
onProgress: i[1] ||= (...e) => E(H) && E(H)(...e),
|
|
1063
|
+
onLoadeddata: i[2] ||= (...e) => E(H) && E(H)(...e),
|
|
1064
|
+
onCanplay: i[3] ||= (...e) => E(H) && E(H)(...e),
|
|
1065
|
+
onDurationchange: Se,
|
|
1066
|
+
onTimeupdate: Se,
|
|
1067
|
+
onVolumechange: Se,
|
|
1068
|
+
onPlaying: i[4] ||= (...e) => E(q) && E(q)(...e),
|
|
1069
|
+
onPause: i[5] ||= (e) => K.value = !1,
|
|
1070
|
+
onEnded: Ee,
|
|
1071
|
+
onClick: ye,
|
|
1072
|
+
onError: i[6] ||= (...e) => E(B) && E(B)(...e)
|
|
1073
|
+
}, null, 42, tt)) : (b(), s("img", {
|
|
992
1074
|
key: 3,
|
|
993
|
-
|
|
1075
|
+
ref_key: "imageElement",
|
|
1076
|
+
ref: ee,
|
|
1077
|
+
"data-source-generation": E(W),
|
|
1078
|
+
class: h(["media-preview", { "media-preview--ready": E(z) === "ready" }]),
|
|
994
1079
|
src: F.value,
|
|
995
|
-
width:
|
|
996
|
-
height:
|
|
1080
|
+
width: L.value ?? void 0,
|
|
1081
|
+
height: R.value ?? void 0,
|
|
997
1082
|
fetchpriority: e.fetchPriority,
|
|
998
1083
|
alt: "",
|
|
999
1084
|
decoding: "async",
|
|
1000
|
-
loading: E(
|
|
1001
|
-
onLoad: i[
|
|
1002
|
-
onError: i[
|
|
1003
|
-
}, null, 42,
|
|
1085
|
+
loading: E(pe),
|
|
1086
|
+
onLoad: i[7] ||= (...e) => E(V) && E(V)(...e),
|
|
1087
|
+
onError: i[8] ||= (...e) => E(B) && E(B)(...e)
|
|
1088
|
+
}, null, 42, nt))], 8, Ze))]),
|
|
1004
1089
|
_: 1
|
|
1005
1090
|
}, 8, ["name"]),
|
|
1006
1091
|
(b(), a(t, {
|
|
1007
|
-
disabled: !
|
|
1092
|
+
disabled: !ge.value || !e.reelControlsTarget,
|
|
1008
1093
|
to: e.reelControlsTarget ?? "body"
|
|
1009
1094
|
}, [u(n, {
|
|
1010
1095
|
name: "vibe-reel-media-controls",
|
|
1011
|
-
css:
|
|
1096
|
+
css: ge.value
|
|
1012
1097
|
}, {
|
|
1013
|
-
default: k(() => [
|
|
1014
|
-
key:
|
|
1015
|
-
"current-time":
|
|
1016
|
-
"data-control-post-id":
|
|
1017
|
-
duration:
|
|
1098
|
+
default: k(() => [_e.value ? (b(), a(Ve, {
|
|
1099
|
+
key: ve.value,
|
|
1100
|
+
"current-time": te.value,
|
|
1101
|
+
"data-control-post-id": ge.value ? e.item.postId : void 0,
|
|
1102
|
+
duration: ne.value,
|
|
1018
1103
|
layout: e.layout,
|
|
1019
|
-
muted:
|
|
1020
|
-
playing:
|
|
1021
|
-
volume:
|
|
1022
|
-
onSeek:
|
|
1023
|
-
onToggleMute:
|
|
1024
|
-
onTogglePlayback:
|
|
1025
|
-
onVolumeChange:
|
|
1104
|
+
muted: re.value,
|
|
1105
|
+
playing: K.value,
|
|
1106
|
+
volume: ie.value,
|
|
1107
|
+
onSeek: De,
|
|
1108
|
+
onToggleMute: ke,
|
|
1109
|
+
onTogglePlayback: be,
|
|
1110
|
+
onVolumeChange: Oe
|
|
1026
1111
|
}, null, 8, [
|
|
1027
1112
|
"current-time",
|
|
1028
1113
|
"data-control-post-id",
|
|
@@ -1042,25 +1127,25 @@ var qe = [
|
|
|
1042
1127
|
type: "button",
|
|
1043
1128
|
class: "media-carousel-control media-carousel-control--previous",
|
|
1044
1129
|
"aria-label": `Previous media for post ${e.item.postId}`,
|
|
1045
|
-
onClick: i[
|
|
1046
|
-
onKeydown: i[
|
|
1047
|
-
}, [u(E(
|
|
1130
|
+
onClick: i[9] ||= j((e) => X(D.value - 1, e), ["stop"]),
|
|
1131
|
+
onKeydown: i[10] ||= j(() => {}, ["stop"])
|
|
1132
|
+
}, [u(E(we), { size: 20 })], 40, rt), c("button", {
|
|
1048
1133
|
type: "button",
|
|
1049
1134
|
class: "media-carousel-control media-carousel-control--next",
|
|
1050
1135
|
"aria-label": `Next media for post ${e.item.postId}`,
|
|
1051
|
-
onClick: i[
|
|
1052
|
-
onKeydown: i[
|
|
1053
|
-
}, [u(E(
|
|
1054
|
-
|
|
1136
|
+
onClick: i[11] ||= j((e) => X(D.value + 1, e), ["stop"]),
|
|
1137
|
+
onKeydown: i[12] ||= j(() => {}, ["stop"])
|
|
1138
|
+
}, [u(E(Te), { size: 20 })], 40, it)], 2)) : o("", !0),
|
|
1139
|
+
J.value ? (b(), s("button", {
|
|
1055
1140
|
key: 1,
|
|
1056
1141
|
class: "media-card-activator",
|
|
1057
1142
|
type: "button",
|
|
1058
1143
|
"aria-label": `Open post ${e.item.postId}`,
|
|
1059
|
-
onClick: i[
|
|
1060
|
-
onKeydown: i[
|
|
1061
|
-
}, null, 40,
|
|
1062
|
-
], 42,
|
|
1063
|
-
e.cardFooter ? (b(), a(
|
|
1144
|
+
onClick: i[13] ||= j((e) => r.$emit("activate", Y(e)), ["stop"]),
|
|
1145
|
+
onKeydown: i[14] ||= j(() => {}, ["stop"])
|
|
1146
|
+
}, null, 40, at)) : o("", !0)
|
|
1147
|
+
], 42, Xe),
|
|
1148
|
+
e.cardFooter ? (b(), a(Ne, {
|
|
1064
1149
|
key: 1,
|
|
1065
1150
|
index: e.index,
|
|
1066
1151
|
item: e.item,
|
|
@@ -1083,12 +1168,12 @@ var qe = [
|
|
|
1083
1168
|
"style",
|
|
1084
1169
|
"total"
|
|
1085
1170
|
])) : o("", !0)
|
|
1086
|
-
])], 46,
|
|
1171
|
+
])], 46, Je));
|
|
1087
1172
|
}
|
|
1088
|
-
}),
|
|
1173
|
+
}), ut = { class: "masonry-feed-shell" }, dt = ["aria-hidden", "inert"], ft = {
|
|
1089
1174
|
key: 0,
|
|
1090
1175
|
class: "masonry-feed-status-overlay"
|
|
1091
|
-
},
|
|
1176
|
+
}, pt = 6, mt = 12, ht = 250, gt = /* @__PURE__ */ d({
|
|
1092
1177
|
__name: "MasonryFeed",
|
|
1093
1178
|
props: {
|
|
1094
1179
|
enteringPostIds: {},
|
|
@@ -1124,79 +1209,79 @@ var qe = [
|
|
|
1124
1209
|
"visible"
|
|
1125
1210
|
],
|
|
1126
1211
|
setup(t, { expose: n, emit: i }) {
|
|
1127
|
-
let l =
|
|
1128
|
-
additionalHeight: (
|
|
1129
|
-
gap:
|
|
1130
|
-
minColumnWidth:
|
|
1131
|
-
})),
|
|
1132
|
-
if (
|
|
1133
|
-
let e =
|
|
1212
|
+
let l = 0, d = t, f = i, p = w(null), m = `vibe-masonry-${D()}`, g = w(null), y = w(0), x = w(pt), C = w(0), T = w(0), k = w(0), A = w([]), j = w([]), M = 0, N = null, P = null, I = null, L = null, R = r(() => ae(d.items, y.value, {
|
|
1213
|
+
additionalHeight: (d.cardHeader?.height ?? 0) + (d.cardFooter?.height ?? 0),
|
|
1214
|
+
gap: x.value,
|
|
1215
|
+
minColumnWidth: J(d.masonry)
|
|
1216
|
+
})), z = r(() => {
|
|
1217
|
+
if (d.leavingPostIds.size === 0) return null;
|
|
1218
|
+
let e = d.items.flatMap((e, t) => d.leavingPostIds.has(e.postId) ? [] : [{
|
|
1134
1219
|
index: t,
|
|
1135
1220
|
item: e
|
|
1136
|
-
}]), t =
|
|
1137
|
-
additionalHeight: (
|
|
1138
|
-
gap:
|
|
1139
|
-
minColumnWidth:
|
|
1221
|
+
}]), t = ae(e.map(({ item: e }) => e), y.value, {
|
|
1222
|
+
additionalHeight: (d.cardHeader?.height ?? 0) + (d.cardFooter?.height ?? 0),
|
|
1223
|
+
gap: x.value,
|
|
1224
|
+
minColumnWidth: J(d.masonry)
|
|
1140
1225
|
});
|
|
1141
1226
|
return {
|
|
1142
1227
|
indices: e.map(({ index: e }) => e),
|
|
1143
1228
|
layout: t,
|
|
1144
1229
|
positions: new Map(e.map(({ item: e }, n) => [e.postId, t.items[n]]))
|
|
1145
1230
|
};
|
|
1146
|
-
}),
|
|
1147
|
-
let e =
|
|
1231
|
+
}), B = r(() => {
|
|
1232
|
+
let e = R.value, t = z.value;
|
|
1148
1233
|
return t ? {
|
|
1149
1234
|
...t.layout,
|
|
1150
|
-
items:
|
|
1235
|
+
items: d.items.map((n, r) => d.leavingPostIds.has(n.postId) ? e.items[r] : t.positions.get(n.postId) ?? e.items[r])
|
|
1151
1236
|
} : e;
|
|
1152
|
-
}),
|
|
1153
|
-
let e =
|
|
1154
|
-
return e ?
|
|
1155
|
-
}), H = r(() => Math.max(
|
|
1156
|
-
let t =
|
|
1237
|
+
}), ee = r(() => oe(R.value.items)), V = r(() => {
|
|
1238
|
+
let e = z.value;
|
|
1239
|
+
return e ? oe(e.layout.items, e.indices) : null;
|
|
1240
|
+
}), H = r(() => Math.max(T.value, d.leavingPostIds.size === 0 ? B.value.height : R.value.height)), W = r(() => ({ height: `${H.value}px` })), G = r(() => !d.infiniteScroll || C.value > 0 && k.value + B.value.height <= C.value + 1), te = r(() => new Set(A.value)), re = r(() => j.value.flatMap((e) => {
|
|
1241
|
+
let t = d.items[e];
|
|
1157
1242
|
return t ? [{
|
|
1158
|
-
fetchPriority:
|
|
1243
|
+
fetchPriority: te.value.has(e) ? "high" : "low",
|
|
1159
1244
|
index: e,
|
|
1160
1245
|
item: t
|
|
1161
1246
|
}] : [];
|
|
1162
1247
|
}));
|
|
1163
|
-
function
|
|
1248
|
+
function K(e, t) {
|
|
1164
1249
|
return [...new Set([...e, ...t])].sort((e, t) => e - t);
|
|
1165
1250
|
}
|
|
1166
1251
|
function q(e, t) {
|
|
1167
1252
|
return e.length === t.length && e.every((e, n) => e === t[n]);
|
|
1168
1253
|
}
|
|
1169
|
-
function
|
|
1254
|
+
function X(e) {
|
|
1170
1255
|
let t = {
|
|
1171
|
-
scrollTop:
|
|
1172
|
-
viewportHeight:
|
|
1173
|
-
}, n = V.value, r = se(n ??
|
|
1256
|
+
scrollTop: M - k.value,
|
|
1257
|
+
viewportHeight: C.value
|
|
1258
|
+
}, n = V.value, r = se(n ?? ee.value, {
|
|
1174
1259
|
...t,
|
|
1175
1260
|
overscan: e
|
|
1176
1261
|
}).indices;
|
|
1177
|
-
return
|
|
1262
|
+
return K(r, d.leavingPostIds.size === 0 ? [] : se(ee.value, {
|
|
1178
1263
|
...t,
|
|
1179
1264
|
overscan: e
|
|
1180
1265
|
}).indices);
|
|
1181
1266
|
}
|
|
1182
|
-
function
|
|
1183
|
-
let e =
|
|
1184
|
-
q(
|
|
1267
|
+
function Z() {
|
|
1268
|
+
let e = d.suspended ? [] : X(0), t = X(Y(d.masonry, C.value));
|
|
1269
|
+
q(A.value, e) || (A.value = e), q(j.value, t) || (j.value = t);
|
|
1185
1270
|
}
|
|
1186
|
-
function
|
|
1187
|
-
if (
|
|
1188
|
-
|
|
1271
|
+
function ce() {
|
|
1272
|
+
if (L !== null) return;
|
|
1273
|
+
L = -1;
|
|
1189
1274
|
let e = requestAnimationFrame(() => {
|
|
1190
|
-
|
|
1275
|
+
L = null, Z();
|
|
1191
1276
|
});
|
|
1192
|
-
|
|
1277
|
+
L !== null && (L = e);
|
|
1193
1278
|
}
|
|
1194
|
-
let
|
|
1195
|
-
O(() => [...
|
|
1196
|
-
let t =
|
|
1279
|
+
let le = /* @__PURE__ */ new Set();
|
|
1280
|
+
O(() => [...te.value].flatMap((e) => {
|
|
1281
|
+
let t = d.items[e];
|
|
1197
1282
|
if (!t) return [];
|
|
1198
|
-
let n =
|
|
1199
|
-
return
|
|
1283
|
+
let n = d.mediaIndices.get(t.postId) ?? 0, r = F(t.postId, n);
|
|
1284
|
+
return d.previewStates.get(r) === "ready" ? [{
|
|
1200
1285
|
key: r,
|
|
1201
1286
|
mediaIndex: n,
|
|
1202
1287
|
postId: t.postId
|
|
@@ -1204,19 +1289,19 @@ var qe = [
|
|
|
1204
1289
|
}), (e) => {
|
|
1205
1290
|
let t = new Set(e.map(({ key: e }) => e));
|
|
1206
1291
|
e.forEach(({ key: e, mediaIndex: t, postId: n }) => {
|
|
1207
|
-
|
|
1208
|
-
}),
|
|
1292
|
+
le.has(e) || f("visible", n, t);
|
|
1293
|
+
}), le = t;
|
|
1209
1294
|
}, {
|
|
1210
1295
|
immediate: !0,
|
|
1211
1296
|
flush: "post"
|
|
1212
1297
|
});
|
|
1213
|
-
function
|
|
1214
|
-
let t =
|
|
1298
|
+
function ue(e) {
|
|
1299
|
+
let t = B.value.items[e], n = d.items[e]?.postId;
|
|
1215
1300
|
if (!t) return {};
|
|
1216
|
-
let r = n !== void 0 &&
|
|
1217
|
-
containerHeight: Math.max(
|
|
1218
|
-
gap:
|
|
1219
|
-
}) : 0, o = n === void 0 ? 0 : i ?
|
|
1301
|
+
let r = n !== void 0 && d.enteringPostIds.has(n), i = n !== void 0 && d.leavingPostIds.has(n), a = r || i ? ie({
|
|
1302
|
+
containerHeight: Math.max(T.value, R.value.height),
|
|
1303
|
+
gap: x.value
|
|
1304
|
+
}) : 0, o = n === void 0 ? 0 : i ? d.removalDelays.get(n) ?? 0 : r ? d.entryDelays.get(n) ?? 0 : 0;
|
|
1220
1305
|
return {
|
|
1221
1306
|
"--masonry-entry-delay": `${o}ms`,
|
|
1222
1307
|
width: `${t.width}px`,
|
|
@@ -1224,66 +1309,69 @@ var qe = [
|
|
|
1224
1309
|
transform: `translate3d(${t.x}px, ${t.y + a}px, 0)`
|
|
1225
1310
|
};
|
|
1226
1311
|
}
|
|
1227
|
-
function
|
|
1228
|
-
let e =
|
|
1312
|
+
function de() {
|
|
1313
|
+
let e = p.value;
|
|
1229
1314
|
if (!e) return;
|
|
1230
|
-
|
|
1315
|
+
M = e.scrollTop, C.value = e.clientHeight;
|
|
1231
1316
|
let t = e.ownerDocument.defaultView?.getComputedStyle(e), n = (Number.parseFloat(t?.paddingTop ?? "") || 0) + (Number.parseFloat(t?.paddingBottom ?? "") || 0);
|
|
1232
|
-
|
|
1233
|
-
let r =
|
|
1234
|
-
r && (
|
|
1317
|
+
T.value = Math.max(0, e.clientHeight - n);
|
|
1318
|
+
let r = g.value;
|
|
1319
|
+
r && (k.value = r.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop, Z());
|
|
1235
1320
|
}
|
|
1236
|
-
function
|
|
1321
|
+
function fe(e) {
|
|
1237
1322
|
let t = e.ownerDocument.documentElement.clientWidth;
|
|
1238
|
-
|
|
1323
|
+
y.value = e.clientWidth, x.value = Math.min(mt, Math.max(pt, t * .0075)), de();
|
|
1239
1324
|
}
|
|
1240
|
-
function
|
|
1325
|
+
function pe(e) {
|
|
1241
1326
|
let t = e.currentTarget;
|
|
1242
|
-
t && (
|
|
1327
|
+
t && (M = t.scrollTop, ce(), Date.now() >= l && !d.loadMoreLocked && d.infiniteScroll && ne(t) && f("loadMore"));
|
|
1243
1328
|
}
|
|
1244
1329
|
function he() {
|
|
1245
|
-
let e =
|
|
1246
|
-
!
|
|
1330
|
+
let e = p.value;
|
|
1331
|
+
Date.now() >= l && !d.loadMoreLocked && e && ne(e) && f("loadMore");
|
|
1247
1332
|
}
|
|
1333
|
+
O(() => d.items.length, (e, t) => {
|
|
1334
|
+
e > 0 && e < t && (l = Date.now() + ht);
|
|
1335
|
+
});
|
|
1248
1336
|
function ge() {
|
|
1249
|
-
return
|
|
1337
|
+
return p.value;
|
|
1250
1338
|
}
|
|
1251
|
-
return O(
|
|
1252
|
-
|
|
1339
|
+
return O(g, (e) => {
|
|
1340
|
+
N?.disconnect(), N = null, I !== null && cancelAnimationFrame(I), e && (fe(e), !(typeof ResizeObserver > "u") && (N = new ResizeObserver(([t]) => {
|
|
1253
1341
|
let n = t?.contentRect.width ?? e.clientWidth;
|
|
1254
|
-
Math.abs(n -
|
|
1255
|
-
|
|
1342
|
+
Math.abs(n - y.value) < .5 || (I = requestAnimationFrame(() => {
|
|
1343
|
+
I = null, fe(e);
|
|
1256
1344
|
}));
|
|
1257
|
-
}),
|
|
1258
|
-
}), O(
|
|
1259
|
-
|
|
1345
|
+
}), N.observe(e)));
|
|
1346
|
+
}), O(p, (e) => {
|
|
1347
|
+
P?.disconnect(), P = null, e && (de(), !(typeof ResizeObserver > "u") && (P = new ResizeObserver(de), P.observe(e)));
|
|
1260
1348
|
}), O([
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
() =>
|
|
1264
|
-
() =>
|
|
1265
|
-
],
|
|
1266
|
-
|
|
1349
|
+
R,
|
|
1350
|
+
B,
|
|
1351
|
+
() => d.suspended,
|
|
1352
|
+
() => d.masonry
|
|
1353
|
+
], Z, { flush: "post" }), v(() => {
|
|
1354
|
+
N?.disconnect(), P?.disconnect(), I !== null && cancelAnimationFrame(I), L !== null && cancelAnimationFrame(L);
|
|
1267
1355
|
}), n({
|
|
1268
1356
|
getScrollElement: ge,
|
|
1269
1357
|
loadIfNearBottom: he
|
|
1270
|
-
}), (n, r) => (b(), s("div",
|
|
1358
|
+
}), (n, r) => (b(), s("div", ut, [
|
|
1271
1359
|
c("main", {
|
|
1272
|
-
id:
|
|
1360
|
+
id: m,
|
|
1273
1361
|
ref_key: "galleryElement",
|
|
1274
|
-
ref:
|
|
1362
|
+
ref: p,
|
|
1275
1363
|
class: h(["gallery-shell masonry-feed", { "masonry-feed--suspended": t.suspended }]),
|
|
1276
1364
|
"data-layout-mode": "masonry",
|
|
1277
1365
|
"aria-hidden": t.suspended || void 0,
|
|
1278
1366
|
inert: t.suspended || void 0,
|
|
1279
|
-
onScrollPassive:
|
|
1367
|
+
onScrollPassive: pe
|
|
1280
1368
|
}, [c("section", {
|
|
1281
1369
|
ref_key: "masonryElement",
|
|
1282
|
-
ref:
|
|
1283
|
-
class: h(["masonry", { "masonry--ready":
|
|
1284
|
-
style: _(
|
|
1370
|
+
ref: g,
|
|
1371
|
+
class: h(["masonry", { "masonry--ready": y.value > 0 }]),
|
|
1372
|
+
style: _(W.value),
|
|
1285
1373
|
"aria-label": "Media gallery"
|
|
1286
|
-
}, [(b(!0), s(e, null, S(
|
|
1374
|
+
}, [(b(!0), s(e, null, S(re.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(lt, {
|
|
1287
1375
|
key: n.postId,
|
|
1288
1376
|
class: "masonry-item",
|
|
1289
1377
|
entering: t.enteringPostIds.has(n.postId),
|
|
@@ -1294,17 +1382,17 @@ var qe = [
|
|
|
1294
1382
|
"media-card": t.mediaCard,
|
|
1295
1383
|
index: r,
|
|
1296
1384
|
item: n,
|
|
1297
|
-
"item-style":
|
|
1385
|
+
"item-style": ue(r),
|
|
1298
1386
|
interactive: "",
|
|
1299
1387
|
layout: "masonry",
|
|
1300
1388
|
"loaded-count": t.items.length,
|
|
1301
1389
|
"media-index": t.mediaIndices.get(n.postId) ?? 0,
|
|
1302
1390
|
"preview-state": t.previewStates.get(E(F)(n.postId, t.mediaIndices.get(n.postId) ?? 0)) ?? "loading",
|
|
1303
1391
|
total: t.total,
|
|
1304
|
-
onActivate: (e) =>
|
|
1305
|
-
onMediaChange: (e) =>
|
|
1306
|
-
onReady: (e) =>
|
|
1307
|
-
onError: (e) =>
|
|
1392
|
+
onActivate: (e) => f("activate", n.postId, e),
|
|
1393
|
+
onMediaChange: (e) => f("mediaChange", n.postId, e),
|
|
1394
|
+
onReady: (e) => f("ready", n.postId, e),
|
|
1395
|
+
onError: (e) => f("error", n.postId, e)
|
|
1308
1396
|
}, null, 8, [
|
|
1309
1397
|
"entering",
|
|
1310
1398
|
"leaving",
|
|
@@ -1323,8 +1411,8 @@ var qe = [
|
|
|
1323
1411
|
"onMediaChange",
|
|
1324
1412
|
"onReady",
|
|
1325
1413
|
"onError"
|
|
1326
|
-
]))), 128))], 6)], 42,
|
|
1327
|
-
t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext &&
|
|
1414
|
+
]))), 128))], 6)], 42, dt),
|
|
1415
|
+
t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && G.value || !t.hasNext && t.canRetryEnd ? (b(), s("div", ft, [u(U, {
|
|
1328
1416
|
actions: t.feedFooterActions,
|
|
1329
1417
|
"can-retry-end": t.canRetryEnd,
|
|
1330
1418
|
"feed-footer": t.feedFooter,
|
|
@@ -1332,10 +1420,10 @@ var qe = [
|
|
|
1332
1420
|
"has-next": t.hasNext,
|
|
1333
1421
|
"is-loading": t.isLoadingMore,
|
|
1334
1422
|
"load-more-locked": t.loadMoreLocked,
|
|
1335
|
-
"show-load-more":
|
|
1423
|
+
"show-load-more": G.value,
|
|
1336
1424
|
state: t.state,
|
|
1337
|
-
onLoadMore: r[0] ||= (e) =>
|
|
1338
|
-
onRetryEnd: r[1] ||= (e) =>
|
|
1425
|
+
onLoadMore: r[0] ||= (e) => f("loadMore"),
|
|
1426
|
+
onRetryEnd: r[1] ||= (e) => f("retryEnd")
|
|
1339
1427
|
}, null, 8, [
|
|
1340
1428
|
"actions",
|
|
1341
1429
|
"can-retry-end",
|
|
@@ -1347,10 +1435,10 @@ var qe = [
|
|
|
1347
1435
|
"show-load-more",
|
|
1348
1436
|
"state"
|
|
1349
1437
|
])])) : o("", !0),
|
|
1350
|
-
u(
|
|
1351
|
-
"content-size":
|
|
1352
|
-
"controls-id":
|
|
1353
|
-
"scroll-element":
|
|
1438
|
+
u(me, {
|
|
1439
|
+
"content-size": B.value.height,
|
|
1440
|
+
"controls-id": m,
|
|
1441
|
+
"scroll-element": p.value,
|
|
1354
1442
|
suspended: t.suspended
|
|
1355
1443
|
}, null, 8, [
|
|
1356
1444
|
"content-size",
|
|
@@ -1359,8 +1447,8 @@ var qe = [
|
|
|
1359
1447
|
])
|
|
1360
1448
|
]));
|
|
1361
1449
|
}
|
|
1362
|
-
}),
|
|
1363
|
-
function
|
|
1450
|
+
}), _t = 300;
|
|
1451
|
+
function vt(e, t, n) {
|
|
1364
1452
|
let r = e.scrollTop;
|
|
1365
1453
|
if (n || Math.abs(r - t) <= 1) return e.scrollTop = t, Promise.resolve();
|
|
1366
1454
|
e.setAttribute("data-transitioning", "");
|
|
@@ -1368,7 +1456,7 @@ function gt(e, t, n) {
|
|
|
1368
1456
|
return new Promise((n) => {
|
|
1369
1457
|
let o = (s) => {
|
|
1370
1458
|
a += 1;
|
|
1371
|
-
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c /
|
|
1459
|
+
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / _t), u = 1 - (1 - l) ** 3;
|
|
1372
1460
|
if (e.scrollTop = r + (t - r) * u, l < 1) {
|
|
1373
1461
|
requestAnimationFrame(o);
|
|
1374
1462
|
return;
|
|
@@ -1380,7 +1468,7 @@ function gt(e, t, n) {
|
|
|
1380
1468
|
}
|
|
1381
1469
|
//#endregion
|
|
1382
1470
|
//#region src/components/ReelAutoAdvanceProgress.vue?vue&type=script&setup=true&lang.ts
|
|
1383
|
-
var
|
|
1471
|
+
var yt = ["aria-label"], bt = /* @__PURE__ */ d({
|
|
1384
1472
|
__name: "ReelAutoAdvanceProgress",
|
|
1385
1473
|
props: {
|
|
1386
1474
|
durationMs: {},
|
|
@@ -1398,9 +1486,9 @@ var _t = ["aria-label"], vt = /* @__PURE__ */ d({
|
|
|
1398
1486
|
class: "reel-auto-advance-progress",
|
|
1399
1487
|
style: _(a.value),
|
|
1400
1488
|
onAnimationend: n[0] ||= (e) => i("complete")
|
|
1401
|
-
}, null, 36)], 8,
|
|
1489
|
+
}, null, 36)], 8, yt));
|
|
1402
1490
|
}
|
|
1403
|
-
}),
|
|
1491
|
+
}), xt = { class: "reel-viewport" }, St = ["data-active-post-id", "data-active-media-index"], Ct = ["role", "data-status"], wt = 2, Tt = 300, Et = 250, Dt = /* @__PURE__ */ d({
|
|
1404
1492
|
__name: "ReelFeed",
|
|
1405
1493
|
props: {
|
|
1406
1494
|
initialPostId: {},
|
|
@@ -1437,147 +1525,145 @@ var _t = ["aria-label"], vt = /* @__PURE__ */ d({
|
|
|
1437
1525
|
"retryForward"
|
|
1438
1526
|
],
|
|
1439
1527
|
setup(t, { expose: n, emit: i }) {
|
|
1440
|
-
let l =
|
|
1441
|
-
let e = Math.max(0,
|
|
1442
|
-
return
|
|
1443
|
-
fetchPriority: e + n ===
|
|
1528
|
+
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, N = null, I = r(() => ({ gridTemplateRows: `repeat(${u.items.length}, 100cqh)` })), L = r(() => {
|
|
1529
|
+
let e = Math.max(0, x.value - wt), t = Math.min(u.items.length - 1, x.value + wt);
|
|
1530
|
+
return u.items.slice(e, t + 1).map((t, n) => ({
|
|
1531
|
+
fetchPriority: e + n === x.value ? "high" : "low",
|
|
1444
1532
|
index: e + n,
|
|
1445
1533
|
item: t
|
|
1446
1534
|
}));
|
|
1447
|
-
}),
|
|
1448
|
-
let e = L.value;
|
|
1449
|
-
return e === void 0 ? 0 : l.mediaIndices.get(e) ?? 0;
|
|
1450
|
-
}), B = r(() => {
|
|
1451
|
-
let e = L.value;
|
|
1452
|
-
return e === void 0 ? "loading" : l.previewStates.get(F(e, z.value)) ?? "loading";
|
|
1453
|
-
}), V = r(() => {
|
|
1535
|
+
}), R = r(() => u.items[x.value]?.postId), z = r(() => u.items[x.value]), B = r(() => {
|
|
1454
1536
|
let e = R.value;
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1537
|
+
return e === void 0 ? 0 : u.mediaIndices.get(e) ?? 0;
|
|
1538
|
+
}), ee = r(() => {
|
|
1539
|
+
let e = R.value;
|
|
1540
|
+
return e === void 0 ? "loading" : u.previewStates.get(F(e, B.value)) ?? "loading";
|
|
1541
|
+
}), V = r(() => z.value ? P(z.value, B.value) : null), H = r(() => ee.value === "ready" && !!(V.value && Ge(u.mediaSource === "original" ? V.value.type : V.value.preview.type ?? V.value.type, u.mediaSource === "original" ? V.value.src : V.value.preview.src))), W = r(() => [
|
|
1542
|
+
R.value,
|
|
1543
|
+
B.value,
|
|
1544
|
+
u.items.length,
|
|
1545
|
+
u.loadMoreLocked,
|
|
1546
|
+
u.reelAutoAdvance.enabled,
|
|
1547
|
+
u.reelAutoAdvance.includePostItems,
|
|
1548
|
+
u.reelAutoAdvance.intervalMs
|
|
1549
|
+
].join(":")), G = r(() => {
|
|
1550
|
+
let e = z.value, t = !!(e && u.reelAutoAdvance.includePostItems && B.value < M(e).length - 1), n = u.reelAutoAdvance.intervalMs / 1e3;
|
|
1468
1551
|
return `Auto advance to the next ${t ? "post item" : "post"} in ${n}s`;
|
|
1469
|
-
}),
|
|
1470
|
-
function
|
|
1552
|
+
}), te = r(() => u.reelAutoAdvance.enabled && u.reelForward.status === "idle" && z.value !== void 0 && ee.value !== "loading" && !H.value), re = r(() => !u.infiniteScroll || u.items.length <= 1), K = 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.");
|
|
1553
|
+
function ie(e) {
|
|
1471
1554
|
return { gridRow: `${e + 1}` };
|
|
1472
1555
|
}
|
|
1473
|
-
function
|
|
1474
|
-
let t =
|
|
1475
|
-
return t <= 0 ||
|
|
1556
|
+
function ae(e) {
|
|
1557
|
+
let t = k || e.clientHeight;
|
|
1558
|
+
return t <= 0 || u.items.length === 0 ? 0 : Math.min(u.items.length - 1, Math.max(0, Math.round(e.scrollTop / t)));
|
|
1476
1559
|
}
|
|
1477
|
-
function
|
|
1560
|
+
function oe(e) {
|
|
1478
1561
|
let t = e.currentTarget;
|
|
1479
1562
|
if (!t) return;
|
|
1480
|
-
let n =
|
|
1481
|
-
|
|
1563
|
+
let n = k || t.clientHeight, r = Math.max(0, u.items.length - 1) * n;
|
|
1564
|
+
C.value = u.items.length > 0 && t.scrollTop > r + 1, D.value || (x.value = ae(t)), Date.now() >= l && !u.loadMoreLocked && u.infiniteScroll && ne(t) && d("loadMore");
|
|
1482
1565
|
}
|
|
1483
|
-
function
|
|
1484
|
-
let e =
|
|
1485
|
-
e && (
|
|
1486
|
-
e.scrollTop =
|
|
1487
|
-
}),
|
|
1566
|
+
function q() {
|
|
1567
|
+
let e = f.value;
|
|
1568
|
+
e && (C.value = !1, Y(!0), k = e.clientHeight, e.scrollTop = x.value * k, j !== null && cancelAnimationFrame(j), j = requestAnimationFrame(() => {
|
|
1569
|
+
e.scrollTop = x.value * e.clientHeight, k = e.clientHeight, j = null;
|
|
1570
|
+
}), se());
|
|
1488
1571
|
}
|
|
1489
|
-
function
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
let e =
|
|
1493
|
-
e && (
|
|
1572
|
+
function se() {
|
|
1573
|
+
N !== null && clearTimeout(N), N = setTimeout(() => {
|
|
1574
|
+
N = null;
|
|
1575
|
+
let e = f.value;
|
|
1576
|
+
e && (k = e.clientHeight, e.scrollTop = x.value * k), Y(!1);
|
|
1494
1577
|
}, 120);
|
|
1495
1578
|
}
|
|
1496
|
-
function
|
|
1497
|
-
|
|
1498
|
-
let e =
|
|
1499
|
-
e && (
|
|
1579
|
+
function J() {
|
|
1580
|
+
Y(!0);
|
|
1581
|
+
let e = f.value;
|
|
1582
|
+
e && (k = e.clientHeight, e.scrollTop = x.value * k), se();
|
|
1500
1583
|
}
|
|
1501
|
-
function
|
|
1502
|
-
|
|
1584
|
+
function Y(e) {
|
|
1585
|
+
D.value = e, f.value?.toggleAttribute("data-resizing", e);
|
|
1503
1586
|
}
|
|
1504
|
-
function
|
|
1505
|
-
let e =
|
|
1506
|
-
!
|
|
1587
|
+
function X() {
|
|
1588
|
+
let e = f.value;
|
|
1589
|
+
Date.now() >= l && !u.loadMoreLocked && e && ne(e) && d("loadMore");
|
|
1507
1590
|
}
|
|
1508
|
-
|
|
1509
|
-
|
|
1591
|
+
O(() => u.items.length, (e, t) => {
|
|
1592
|
+
e > 0 && e < t && (l = Date.now() + Et);
|
|
1593
|
+
});
|
|
1594
|
+
function Z(e) {
|
|
1595
|
+
let t = z.value;
|
|
1510
1596
|
if (!t) return !1;
|
|
1511
1597
|
let n = M(t).length;
|
|
1512
1598
|
if (n <= 1) return !1;
|
|
1513
|
-
let r = (
|
|
1514
|
-
return
|
|
1599
|
+
let r = (B.value + e + n) % n;
|
|
1600
|
+
return d("mediaChange", t.postId, r), !0;
|
|
1515
1601
|
}
|
|
1516
|
-
function
|
|
1517
|
-
let t =
|
|
1518
|
-
return !
|
|
1602
|
+
function ce(e) {
|
|
1603
|
+
let t = x.value + e;
|
|
1604
|
+
return !f.value || t < 0 || t >= u.items.length ? !1 : (fe(t), !0);
|
|
1519
1605
|
}
|
|
1520
|
-
function
|
|
1521
|
-
let n =
|
|
1522
|
-
return !
|
|
1606
|
+
function le(e, t) {
|
|
1607
|
+
let n = u.items.findIndex((t) => t.postId === e), r = u.items[n];
|
|
1608
|
+
return !f.value || !r || t < 0 || t > r.items.length ? !1 : ((u.mediaIndices.get(e) ?? 0) !== t && d("mediaChange", e, t), n !== x.value && fe(n), !0);
|
|
1523
1609
|
}
|
|
1524
|
-
function
|
|
1610
|
+
function ue() {
|
|
1525
1611
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
1526
1612
|
}
|
|
1527
|
-
function
|
|
1528
|
-
let t =
|
|
1613
|
+
function de(e) {
|
|
1614
|
+
let t = f.value;
|
|
1529
1615
|
if (!t) return Promise.resolve();
|
|
1530
|
-
let n = e * (
|
|
1531
|
-
return
|
|
1616
|
+
let n = e * (k || t.clientHeight);
|
|
1617
|
+
return x.value = e, vt(t, n, ue());
|
|
1532
1618
|
}
|
|
1533
|
-
function
|
|
1534
|
-
|
|
1619
|
+
function fe(e) {
|
|
1620
|
+
de(e);
|
|
1535
1621
|
}
|
|
1536
|
-
async function
|
|
1537
|
-
let t =
|
|
1538
|
-
return t < 0 || t ===
|
|
1622
|
+
async function pe(e) {
|
|
1623
|
+
let t = u.items.findIndex((t) => t.postId === e);
|
|
1624
|
+
return t < 0 || t === x.value ? !1 : (await de(t), !0);
|
|
1539
1625
|
}
|
|
1540
|
-
async function
|
|
1541
|
-
return
|
|
1626
|
+
async function me(e) {
|
|
1627
|
+
return Z(e) ? (ue() || await new Promise((e) => setTimeout(e, Tt)), !0) : !1;
|
|
1542
1628
|
}
|
|
1543
|
-
function
|
|
1544
|
-
if (!
|
|
1545
|
-
let e =
|
|
1629
|
+
function he() {
|
|
1630
|
+
if (!u.reelAutoAdvance.enabled) return;
|
|
1631
|
+
let e = z.value;
|
|
1546
1632
|
if (!e) return;
|
|
1547
|
-
if (
|
|
1548
|
-
|
|
1633
|
+
if (u.reelAutoAdvance.includePostItems && B.value < M(e).length - 1) {
|
|
1634
|
+
d("mediaChange", e.postId, B.value + 1);
|
|
1549
1635
|
return;
|
|
1550
1636
|
}
|
|
1551
|
-
let t =
|
|
1637
|
+
let t = x.value + 1, n = u.items[t];
|
|
1552
1638
|
if (!n) {
|
|
1553
|
-
|
|
1639
|
+
u.hasNext && !u.loadMoreLocked && d("loadMore");
|
|
1554
1640
|
return;
|
|
1555
1641
|
}
|
|
1556
|
-
|
|
1642
|
+
u.reelAutoAdvance.includePostItems && (u.mediaIndices.get(n.postId) ?? 0) !== 0 && d("mediaChange", n.postId, 0), fe(t);
|
|
1557
1643
|
}
|
|
1558
1644
|
function ge(e, t) {
|
|
1559
|
-
!
|
|
1645
|
+
!u.reelAutoAdvance.enabled || e !== R.value || t !== B.value || !H.value || he();
|
|
1560
1646
|
}
|
|
1561
|
-
return O(
|
|
1562
|
-
|
|
1563
|
-
}), O(() =>
|
|
1564
|
-
let t =
|
|
1565
|
-
|
|
1566
|
-
}), O(
|
|
1567
|
-
e !== void 0 &&
|
|
1647
|
+
return O(f, (e) => {
|
|
1648
|
+
A?.disconnect(), A = null, e && (k = e.clientHeight, !(typeof ResizeObserver > "u") && (A = new ResizeObserver(q), A.observe(e)));
|
|
1649
|
+
}), O(() => u.items.length, async (e) => {
|
|
1650
|
+
let t = u.initialPostId, n = t == null ? -1 : u.items.findIndex(({ postId: e }) => e === t);
|
|
1651
|
+
x.value = n >= 0 ? n : Math.min(x.value, Math.max(0, e - 1)), await m(), q();
|
|
1652
|
+
}), O(R, (e) => {
|
|
1653
|
+
e !== void 0 && d("activeChange", e);
|
|
1568
1654
|
}, { immediate: !0 }), y(() => {
|
|
1569
|
-
window.addEventListener("resize",
|
|
1655
|
+
window.addEventListener("resize", J), window.addEventListener("orientationchange", J), g >= 0 && m(q);
|
|
1570
1656
|
}), v(() => {
|
|
1571
|
-
window.removeEventListener("resize",
|
|
1657
|
+
window.removeEventListener("resize", J), window.removeEventListener("orientationchange", J), A?.disconnect(), j !== null && cancelAnimationFrame(j), N !== null && clearTimeout(N);
|
|
1572
1658
|
}), n({
|
|
1573
|
-
activeIndex:
|
|
1574
|
-
activePostId:
|
|
1575
|
-
changeActiveMedia:
|
|
1576
|
-
loadIfNearBottom:
|
|
1577
|
-
moveActivePost:
|
|
1578
|
-
navigateToItem:
|
|
1579
|
-
transitionActiveMedia:
|
|
1580
|
-
transitionActivePost:
|
|
1659
|
+
activeIndex: x,
|
|
1660
|
+
activePostId: R,
|
|
1661
|
+
changeActiveMedia: Z,
|
|
1662
|
+
loadIfNearBottom: X,
|
|
1663
|
+
moveActivePost: ce,
|
|
1664
|
+
navigateToItem: le,
|
|
1665
|
+
transitionActiveMedia: me,
|
|
1666
|
+
transitionActivePost: pe
|
|
1581
1667
|
}), (n, r) => (b(), s("main", {
|
|
1582
1668
|
class: h(["reel-shell", {
|
|
1583
1669
|
"reel-shell--has-footer": !!t.cardFooter,
|
|
@@ -1585,13 +1671,13 @@ var _t = ["aria-label"], vt = /* @__PURE__ */ d({
|
|
|
1585
1671
|
}]),
|
|
1586
1672
|
"data-layout-mode": "reel"
|
|
1587
1673
|
}, [
|
|
1588
|
-
t.cardHeader &&
|
|
1674
|
+
t.cardHeader && z.value && t.reelForward.status === "idle" ? (b(), a(Ne, {
|
|
1589
1675
|
key: 0,
|
|
1590
|
-
index:
|
|
1591
|
-
item:
|
|
1676
|
+
index: x.value,
|
|
1677
|
+
item: z.value,
|
|
1592
1678
|
layout: "reel",
|
|
1593
1679
|
"loaded-count": t.items.length,
|
|
1594
|
-
"media-index":
|
|
1680
|
+
"media-index": B.value,
|
|
1595
1681
|
"media-source": t.mediaSource,
|
|
1596
1682
|
placement: "header",
|
|
1597
1683
|
region: t.cardHeader,
|
|
@@ -1607,41 +1693,41 @@ var _t = ["aria-label"], vt = /* @__PURE__ */ d({
|
|
|
1607
1693
|
"style",
|
|
1608
1694
|
"total"
|
|
1609
1695
|
])) : o("", !0),
|
|
1610
|
-
c("div",
|
|
1696
|
+
c("div", xt, [c("div", {
|
|
1611
1697
|
ref_key: "galleryElement",
|
|
1612
|
-
ref:
|
|
1698
|
+
ref: f,
|
|
1613
1699
|
class: "gallery-shell reel-feed",
|
|
1614
|
-
"data-active-post-id":
|
|
1615
|
-
"data-active-media-index":
|
|
1616
|
-
onScrollPassive:
|
|
1700
|
+
"data-active-post-id": R.value,
|
|
1701
|
+
"data-active-media-index": B.value,
|
|
1702
|
+
onScrollPassive: oe
|
|
1617
1703
|
}, [t.reelForward.status === "idle" ? (b(), s("section", {
|
|
1618
1704
|
key: 1,
|
|
1619
1705
|
class: "reel-track",
|
|
1620
|
-
style: _(
|
|
1706
|
+
style: _(I.value),
|
|
1621
1707
|
"aria-label": "Media gallery"
|
|
1622
|
-
}, [(b(!0), s(e, null, S(
|
|
1708
|
+
}, [(b(!0), s(e, null, S(L.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(lt, {
|
|
1623
1709
|
key: n.postId,
|
|
1624
|
-
active: r ===
|
|
1625
|
-
"advance-on-media-end":
|
|
1710
|
+
active: r === x.value && !C.value,
|
|
1711
|
+
"advance-on-media-end": u.reelAutoAdvance.enabled && r === x.value,
|
|
1626
1712
|
class: "reel-item",
|
|
1627
1713
|
entering: !1,
|
|
1628
1714
|
"fetch-priority": e,
|
|
1629
1715
|
index: r,
|
|
1630
1716
|
item: n,
|
|
1631
|
-
"item-style":
|
|
1717
|
+
"item-style": ie(r),
|
|
1632
1718
|
"media-card": t.mediaCard,
|
|
1633
1719
|
layout: "reel",
|
|
1634
1720
|
"loaded-count": t.items.length,
|
|
1635
1721
|
"media-index": t.mediaIndices.get(n.postId) ?? 0,
|
|
1636
1722
|
"media-source": t.mediaSource,
|
|
1637
1723
|
"preview-state": t.previewStates.get(E(F)(n.postId, t.mediaIndices.get(n.postId) ?? 0)) ?? "loading",
|
|
1638
|
-
"reel-controls-target":
|
|
1724
|
+
"reel-controls-target": p.value,
|
|
1639
1725
|
"stationary-reel-controls": "",
|
|
1640
1726
|
total: t.total,
|
|
1641
|
-
onMediaChange: (e) =>
|
|
1727
|
+
onMediaChange: (e) => d("mediaChange", n.postId, e),
|
|
1642
1728
|
onEnded: (e) => ge(n.postId, e),
|
|
1643
|
-
onReady: (e) =>
|
|
1644
|
-
onError: (e) =>
|
|
1729
|
+
onReady: (e) => d("ready", n.postId, e),
|
|
1730
|
+
onError: (e) => d("error", n.postId, e)
|
|
1645
1731
|
}, null, 8, [
|
|
1646
1732
|
"active",
|
|
1647
1733
|
"advance-on-media-end",
|
|
@@ -1665,12 +1751,12 @@ var _t = ["aria-label"], vt = /* @__PURE__ */ d({
|
|
|
1665
1751
|
class: "reel-forward-status",
|
|
1666
1752
|
role: t.reelForward.status === "error" ? "alert" : "status",
|
|
1667
1753
|
"data-status": t.reelForward.status
|
|
1668
|
-
}, [c("p", null, T(
|
|
1754
|
+
}, [c("p", null, T(K.value), 1), t.reelForward.status === "error" || t.reelForward.status === "end" ? (b(), s("button", {
|
|
1669
1755
|
key: 0,
|
|
1670
1756
|
class: "reel-forward-retry",
|
|
1671
1757
|
type: "button",
|
|
1672
|
-
onClick: r[0] ||= (e) =>
|
|
1673
|
-
}, " Retry ")) : o("", !0)], 8,
|
|
1758
|
+
onClick: r[0] ||= (e) => d("retryForward")
|
|
1759
|
+
}, " Retry ")) : o("", !0)], 8, Ct)), t.reelForward.status === "idle" ? (b(), a(U, {
|
|
1674
1760
|
key: 2,
|
|
1675
1761
|
actions: t.feedFooterActions,
|
|
1676
1762
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -1679,10 +1765,10 @@ var _t = ["aria-label"], vt = /* @__PURE__ */ d({
|
|
|
1679
1765
|
"has-next": t.hasNext,
|
|
1680
1766
|
"is-loading": t.isLoadingMore,
|
|
1681
1767
|
"load-more-locked": t.loadMoreLocked,
|
|
1682
|
-
"show-load-more":
|
|
1768
|
+
"show-load-more": re.value,
|
|
1683
1769
|
state: t.state,
|
|
1684
|
-
onLoadMore: r[1] ||= (e) =>
|
|
1685
|
-
onRetryEnd: r[2] ||= (e) =>
|
|
1770
|
+
onLoadMore: r[1] ||= (e) => d("loadMore"),
|
|
1771
|
+
onRetryEnd: r[2] ||= (e) => d("retryEnd")
|
|
1686
1772
|
}, null, 8, [
|
|
1687
1773
|
"actions",
|
|
1688
1774
|
"can-retry-end",
|
|
@@ -1693,19 +1779,19 @@ var _t = ["aria-label"], vt = /* @__PURE__ */ d({
|
|
|
1693
1779
|
"load-more-locked",
|
|
1694
1780
|
"show-load-more",
|
|
1695
1781
|
"state"
|
|
1696
|
-
])) : o("", !0)], 40,
|
|
1782
|
+
])) : o("", !0)], 40, St), c("div", {
|
|
1697
1783
|
ref_key: "reelControlsElement",
|
|
1698
|
-
ref:
|
|
1784
|
+
ref: p,
|
|
1699
1785
|
class: "reel-media-controls-host",
|
|
1700
1786
|
"data-test": "reel-media-controls-host"
|
|
1701
1787
|
}, null, 512)]),
|
|
1702
|
-
t.cardFooter &&
|
|
1788
|
+
t.cardFooter && z.value && t.reelForward.status === "idle" ? (b(), a(Ne, {
|
|
1703
1789
|
key: 1,
|
|
1704
|
-
index:
|
|
1705
|
-
item:
|
|
1790
|
+
index: x.value,
|
|
1791
|
+
item: z.value,
|
|
1706
1792
|
layout: "reel",
|
|
1707
1793
|
"loaded-count": t.items.length,
|
|
1708
|
-
"media-index":
|
|
1794
|
+
"media-index": B.value,
|
|
1709
1795
|
"media-source": t.mediaSource,
|
|
1710
1796
|
placement: "footer",
|
|
1711
1797
|
region: t.cardFooter,
|
|
@@ -1721,24 +1807,24 @@ var _t = ["aria-label"], vt = /* @__PURE__ */ d({
|
|
|
1721
1807
|
"style",
|
|
1722
1808
|
"total"
|
|
1723
1809
|
])) : o("", !0),
|
|
1724
|
-
|
|
1725
|
-
key:
|
|
1810
|
+
te.value ? (b(), a(bt, {
|
|
1811
|
+
key: W.value,
|
|
1726
1812
|
"duration-ms": t.reelAutoAdvance.intervalMs,
|
|
1727
|
-
label:
|
|
1728
|
-
onComplete:
|
|
1813
|
+
label: G.value,
|
|
1814
|
+
onComplete: he
|
|
1729
1815
|
}, null, 8, ["duration-ms", "label"])) : o("", !0)
|
|
1730
1816
|
], 2));
|
|
1731
1817
|
}
|
|
1732
|
-
}),
|
|
1818
|
+
}), Ot = ["data-info-sheet-open", "data-info-sheet-mode"], kt = ["aria-hidden", "inert"], At = {
|
|
1733
1819
|
key: 0,
|
|
1734
1820
|
class: "reel-info-sheet-layer",
|
|
1735
1821
|
"data-test": "reel-info-sheet"
|
|
1736
|
-
},
|
|
1822
|
+
}, jt = [
|
|
1737
1823
|
"role",
|
|
1738
1824
|
"aria-modal",
|
|
1739
1825
|
"tabindex",
|
|
1740
1826
|
"data-active-post-id"
|
|
1741
|
-
],
|
|
1827
|
+
], Mt = /* @__PURE__ */ d({
|
|
1742
1828
|
__name: "ReelLayout",
|
|
1743
1829
|
props: {
|
|
1744
1830
|
forwardIndex: { default: null },
|
|
@@ -1825,13 +1911,13 @@ var _t = ["aria-label"], vt = /* @__PURE__ */ d({
|
|
|
1825
1911
|
function B(e) {
|
|
1826
1912
|
return p.value?.transitionActivePost(e) ?? Promise.resolve(!1);
|
|
1827
1913
|
}
|
|
1828
|
-
function
|
|
1914
|
+
function ee(e, t) {
|
|
1829
1915
|
d("error", e, t);
|
|
1830
1916
|
}
|
|
1831
|
-
function
|
|
1917
|
+
function V(e, t) {
|
|
1832
1918
|
d("mediaChange", e, t);
|
|
1833
1919
|
}
|
|
1834
|
-
function
|
|
1920
|
+
function H(e, t) {
|
|
1835
1921
|
d("ready", e, t);
|
|
1836
1922
|
}
|
|
1837
1923
|
return O(() => ({
|
|
@@ -1863,7 +1949,7 @@ var _t = ["aria-label"], vt = /* @__PURE__ */ d({
|
|
|
1863
1949
|
class: "reel-layout-main",
|
|
1864
1950
|
"aria-hidden": e.infoSheetOverlay && A.value || void 0,
|
|
1865
1951
|
inert: e.infoSheetOverlay && A.value || void 0
|
|
1866
|
-
}, [u(
|
|
1952
|
+
}, [u(Dt, {
|
|
1867
1953
|
ref_key: "reelFeed",
|
|
1868
1954
|
ref: p,
|
|
1869
1955
|
"can-retry-end": e.canRetryEnd,
|
|
@@ -1887,10 +1973,10 @@ var _t = ["aria-label"], vt = /* @__PURE__ */ d({
|
|
|
1887
1973
|
state: e.state,
|
|
1888
1974
|
total: e.total,
|
|
1889
1975
|
onActiveChange: r[0] ||= (e) => d("activeChange", e),
|
|
1890
|
-
onError:
|
|
1976
|
+
onError: ee,
|
|
1891
1977
|
onLoadMore: r[1] ||= (e) => d("loadMore"),
|
|
1892
|
-
onMediaChange:
|
|
1893
|
-
onReady:
|
|
1978
|
+
onMediaChange: V,
|
|
1979
|
+
onReady: H,
|
|
1894
1980
|
onRetryEnd: r[2] ||= (e) => d("retryEnd"),
|
|
1895
1981
|
onRetryForward: r[3] ||= (e) => d("retryForward")
|
|
1896
1982
|
}, null, 8, [
|
|
@@ -1914,8 +2000,8 @@ var _t = ["aria-label"], vt = /* @__PURE__ */ d({
|
|
|
1914
2000
|
"reel-forward",
|
|
1915
2001
|
"state",
|
|
1916
2002
|
"total"
|
|
1917
|
-
])], 8,
|
|
1918
|
-
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div",
|
|
2003
|
+
])], 8, kt), u(n, { name: "vibe-info-sheet" }, {
|
|
2004
|
+
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", At, [c("aside", {
|
|
1919
2005
|
ref_key: "sheetElement",
|
|
1920
2006
|
ref: _,
|
|
1921
2007
|
class: "reel-info-sheet",
|
|
@@ -1924,14 +2010,14 @@ var _t = ["aria-label"], vt = /* @__PURE__ */ d({
|
|
|
1924
2010
|
"aria-modal": e.infoSheetOverlay ? "true" : void 0,
|
|
1925
2011
|
tabindex: e.infoSheetOverlay ? -1 : void 0,
|
|
1926
2012
|
"data-active-post-id": T.value?.postId
|
|
1927
|
-
}, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8,
|
|
2013
|
+
}, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8, jt)])) : o("", !0)]),
|
|
1928
2014
|
_: 1
|
|
1929
|
-
})], 10,
|
|
2015
|
+
})], 10, Ot));
|
|
1930
2016
|
}
|
|
1931
2017
|
});
|
|
1932
2018
|
//#endregion
|
|
1933
2019
|
//#region src/core/mediaLifecycle.ts
|
|
1934
|
-
function
|
|
2020
|
+
function Nt(e, t, n, r, i) {
|
|
1935
2021
|
let a = e.items.findIndex((e) => e.postId === t), o = e.items[a];
|
|
1936
2022
|
if (!o) return null;
|
|
1937
2023
|
let s = N(o, n), c = P(o, s);
|
|
@@ -1947,7 +2033,7 @@ function At(e, t, n, r, i) {
|
|
|
1947
2033
|
postIndex: a
|
|
1948
2034
|
};
|
|
1949
2035
|
}
|
|
1950
|
-
function
|
|
2036
|
+
function Pt(e, t) {
|
|
1951
2037
|
O(() => {
|
|
1952
2038
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null;
|
|
1953
2039
|
return {
|
|
@@ -1957,20 +2043,20 @@ function jt(e, t) {
|
|
|
1957
2043
|
};
|
|
1958
2044
|
}, (n, r) => {
|
|
1959
2045
|
if (n.postId === null || n.postId === r?.postId && n.mediaIndex === r.mediaIndex && n.origin === r.origin) return;
|
|
1960
|
-
let i =
|
|
2046
|
+
let i = Nt(e, n.postId, n.mediaIndex, "reel", n.origin);
|
|
1961
2047
|
i && t(i);
|
|
1962
2048
|
}, { flush: "sync" });
|
|
1963
2049
|
}
|
|
1964
2050
|
//#endregion
|
|
1965
2051
|
//#region src/components/useMediaLifecycle.ts
|
|
1966
|
-
function
|
|
2052
|
+
function Ft(e, t) {
|
|
1967
2053
|
let n = w(/* @__PURE__ */ new Map()), i = w(/* @__PURE__ */ new Map()), a = r(() => e.reelMediaSource === "original" ? i.value : n.value);
|
|
1968
2054
|
function o(e, t, n, r) {
|
|
1969
2055
|
let i = F(t, n);
|
|
1970
2056
|
e.value.get(i) !== r && (e.value = new Map(e.value).set(i, r));
|
|
1971
2057
|
}
|
|
1972
2058
|
function s(t, n, r, i) {
|
|
1973
|
-
return
|
|
2059
|
+
return Nt(e, t, n, r, i);
|
|
1974
2060
|
}
|
|
1975
2061
|
function c(e, n, r, i) {
|
|
1976
2062
|
let a = s(e, n, r, i);
|
|
@@ -1992,7 +2078,7 @@ function Mt(e, t) {
|
|
|
1992
2078
|
let r = s(e, n, "masonry", null);
|
|
1993
2079
|
r && t.visible(r);
|
|
1994
2080
|
}
|
|
1995
|
-
return
|
|
2081
|
+
return Pt(e, t.reelChange), O(() => {
|
|
1996
2082
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null, n = t === null ? 0 : e.mediaIndices.get(t) ?? 0;
|
|
1997
2083
|
return {
|
|
1998
2084
|
mediaIndex: n,
|
|
@@ -2017,16 +2103,16 @@ function Mt(e, t) {
|
|
|
2017
2103
|
}
|
|
2018
2104
|
//#endregion
|
|
2019
2105
|
//#region src/core/reelEscapeStack.ts
|
|
2020
|
-
var
|
|
2021
|
-
function
|
|
2022
|
-
return
|
|
2023
|
-
let t =
|
|
2024
|
-
t >= 0 &&
|
|
2106
|
+
var It = [];
|
|
2107
|
+
function Lt(e) {
|
|
2108
|
+
return It.push(e), () => {
|
|
2109
|
+
let t = It.indexOf(e);
|
|
2110
|
+
t >= 0 && It.splice(t, 1);
|
|
2025
2111
|
};
|
|
2026
2112
|
}
|
|
2027
|
-
function
|
|
2113
|
+
function Rt(e) {
|
|
2028
2114
|
if (!e.isActive()) return !1;
|
|
2029
|
-
let t =
|
|
2115
|
+
let t = It.filter((e) => e.isActive()), n = e.element();
|
|
2030
2116
|
return n !== null && t.some((t) => {
|
|
2031
2117
|
if (t === e) return !1;
|
|
2032
2118
|
let r = t.element();
|
|
@@ -2042,14 +2128,14 @@ function Ft(e) {
|
|
|
2042
2128
|
}
|
|
2043
2129
|
//#endregion
|
|
2044
2130
|
//#region src/components/useReelKeyboard.ts
|
|
2045
|
-
function
|
|
2131
|
+
function zt(e) {
|
|
2046
2132
|
let t = {
|
|
2047
2133
|
element: e.element,
|
|
2048
2134
|
isActive: () => e.state.layout === "reel" || e.state.reelOrigin === "masonry"
|
|
2049
2135
|
}, n = null;
|
|
2050
2136
|
function r(n) {
|
|
2051
2137
|
let r = t.isActive();
|
|
2052
|
-
if (n.key === "Escape" && r && !
|
|
2138
|
+
if (n.key === "Escape" && r && !Rt(t)) return;
|
|
2053
2139
|
if (n.key === "Escape" && e.state.reelOrigin === "masonry") {
|
|
2054
2140
|
n.preventDefault(), e.state.reelInfoSheetOverlay && e.state.reelInfoSheet.enabled && e.setReelInfoSheet(!1), e.closeMasonryReel();
|
|
2055
2141
|
return;
|
|
@@ -2069,14 +2155,14 @@ function It(e) {
|
|
|
2069
2155
|
a !== 0 && e.reelRenderer()?.changeActiveMedia?.(a) && n.preventDefault();
|
|
2070
2156
|
}
|
|
2071
2157
|
y(() => {
|
|
2072
|
-
n =
|
|
2158
|
+
n = Lt(t), window.addEventListener("keydown", r);
|
|
2073
2159
|
}), v(() => {
|
|
2074
2160
|
window.removeEventListener("keydown", r), n?.(), n = null;
|
|
2075
2161
|
});
|
|
2076
2162
|
}
|
|
2077
2163
|
//#endregion
|
|
2078
2164
|
//#region src/components/VibeSurface.vue?vue&type=script&setup=true&lang.ts
|
|
2079
|
-
var
|
|
2165
|
+
var Bt = 35, Vt = 420, Ht = /* @__PURE__ */ d({
|
|
2080
2166
|
__name: "VibeSurface",
|
|
2081
2167
|
props: {
|
|
2082
2168
|
canRetryEnd: { type: Boolean },
|
|
@@ -2102,37 +2188,37 @@ var Lt = 35, Rt = 420, zt = /* @__PURE__ */ d({
|
|
|
2102
2188
|
"retryForward"
|
|
2103
2189
|
],
|
|
2104
2190
|
setup(t, { expose: i, emit: c }) {
|
|
2105
|
-
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(() => L(l.state, A.value)), { markMasonryVisible: P, markPreviewError: F, markPreviewReady: I, markReelError: R, markReelReady: z, originalStates: B, previewStates:
|
|
2191
|
+
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(() => L(l.state, A.value)), { markMasonryVisible: P, markPreviewError: F, markPreviewReady: I, markReelError: R, markReelReady: z, originalStates: B, previewStates: ee, reelStates: V } = Ft(l.state, {
|
|
2106
2192
|
ready: (e) => d("mediaReady", e),
|
|
2107
2193
|
reelChange: (e) => d("reelMediaChange", e),
|
|
2108
2194
|
visible: (e) => d("mediaVisible", e)
|
|
2109
|
-
}),
|
|
2110
|
-
function
|
|
2195
|
+
}), H = new Set(l.state.items.map((e) => e.postId)), U = null, W = null, G = !1;
|
|
2196
|
+
function ne() {
|
|
2111
2197
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
2112
2198
|
}
|
|
2113
|
-
function
|
|
2199
|
+
function re() {
|
|
2114
2200
|
U !== null && cancelAnimationFrame(U), U = requestAnimationFrame(() => {
|
|
2115
2201
|
U = requestAnimationFrame(() => {
|
|
2116
2202
|
U = null, S.value = /* @__PURE__ */ new Set();
|
|
2117
2203
|
});
|
|
2118
2204
|
});
|
|
2119
2205
|
}
|
|
2120
|
-
function
|
|
2206
|
+
function K(e, t) {
|
|
2121
2207
|
let n = l.state.items.find((t) => t.postId === e);
|
|
2122
2208
|
if (!n) return;
|
|
2123
2209
|
let r = N(n, t);
|
|
2124
2210
|
(l.state.mediaIndices.get(e) ?? 0) !== r && (l.state.mediaIndices = new Map(l.state.mediaIndices).set(e, r));
|
|
2125
2211
|
}
|
|
2126
|
-
async function
|
|
2212
|
+
async function ie() {
|
|
2127
2213
|
await m(), (l.state.layout === "reel" || l.state.reelOrigin === "masonry" ? p.value : f.value)?.loadIfNearBottom();
|
|
2128
2214
|
}
|
|
2129
|
-
function
|
|
2215
|
+
function ae(e) {
|
|
2130
2216
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.changeActiveMedia?.(e) ?? !1;
|
|
2131
2217
|
}
|
|
2132
|
-
function
|
|
2218
|
+
function oe(e) {
|
|
2133
2219
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.moveActivePost?.(e) ?? !1;
|
|
2134
2220
|
}
|
|
2135
|
-
function
|
|
2221
|
+
function q(e) {
|
|
2136
2222
|
if (!(l.state.layout === "reel" || l.state.reelOrigin === "masonry") || l.state.isLoading) return "reel-inactive";
|
|
2137
2223
|
let t = l.state.items.find((t) => t.postId === e.postId);
|
|
2138
2224
|
if (!t) return "not-found";
|
|
@@ -2142,30 +2228,30 @@ var Lt = 35, Rt = 420, zt = /* @__PURE__ */ d({
|
|
|
2142
2228
|
function se() {
|
|
2143
2229
|
return l.state.layout !== "masonry" || l.state.reelOrigin === "masonry" ? null : f.value?.getScrollElement?.() ?? null;
|
|
2144
2230
|
}
|
|
2145
|
-
function
|
|
2146
|
-
W = e, G = t === "keyboard", y.value =
|
|
2231
|
+
function J(e, t) {
|
|
2232
|
+
W = e, G = t === "keyboard", y.value = ce(e), d("openReel", e), m(() => h.value?.focus());
|
|
2147
2233
|
}
|
|
2148
|
-
function
|
|
2234
|
+
function Y(e) {
|
|
2149
2235
|
let t = g.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [];
|
|
2150
2236
|
return Array.from(t).find((t) => t.dataset.postId === String(e)) ?? null;
|
|
2151
2237
|
}
|
|
2152
|
-
function
|
|
2153
|
-
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null ||
|
|
2154
|
-
let n = [...new Set(e)], r = n.filter(
|
|
2238
|
+
function X(e, t) {
|
|
2239
|
+
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || ne()) return 0;
|
|
2240
|
+
let n = [...new Set(e)], r = n.filter(Y);
|
|
2155
2241
|
if (r.length === 0) return 0;
|
|
2156
|
-
let i = new Map(D.value), a = t?.staggerMs ??
|
|
2242
|
+
let i = new Map(D.value), a = t?.staggerMs ?? Bt;
|
|
2157
2243
|
return r.forEach((e, t) => {
|
|
2158
2244
|
i.set(e, t * a);
|
|
2159
|
-
}), S.value = new Set([...S.value].filter((e) => !r.includes(e))), T.value = new Set([...T.value, ...n]), D.value = i,
|
|
2245
|
+
}), S.value = new Set([...S.value].filter((e) => !r.includes(e))), T.value = new Set([...T.value, ...n]), D.value = i, Vt + (r.length - 1) * a;
|
|
2160
2246
|
}
|
|
2161
|
-
function
|
|
2162
|
-
let n =
|
|
2247
|
+
function Z(e, t) {
|
|
2248
|
+
let n = Y(e), r = n?.querySelector(".media-card-activator") ?? n;
|
|
2163
2249
|
r && (r.classList.toggle("media-card-focus-silent", !t), t || r.addEventListener("blur", () => {
|
|
2164
2250
|
r.classList.remove("media-card-focus-silent");
|
|
2165
2251
|
}, { once: !0 }), r?.focus({ preventScroll: !0 }));
|
|
2166
2252
|
}
|
|
2167
|
-
function
|
|
2168
|
-
let t = g.value, n =
|
|
2253
|
+
function ce(e) {
|
|
2254
|
+
let t = g.value, n = Y(e);
|
|
2169
2255
|
if (t === null || n === null) return {};
|
|
2170
2256
|
let r = t.getBoundingClientRect(), i = n.getBoundingClientRect();
|
|
2171
2257
|
return {
|
|
@@ -2175,48 +2261,48 @@ var Lt = 35, Rt = 420, zt = /* @__PURE__ */ d({
|
|
|
2175
2261
|
"--vibe-reel-origin-left": `${Math.max(0, i.left - r.left)}px`
|
|
2176
2262
|
};
|
|
2177
2263
|
}
|
|
2178
|
-
function
|
|
2264
|
+
function le() {
|
|
2179
2265
|
l.state.reelOrigin === "masonry" && (W ??= l.state.activeReelPostId, x.value = !0, d("closeReel"));
|
|
2180
2266
|
}
|
|
2181
|
-
function
|
|
2267
|
+
function ue() {
|
|
2182
2268
|
let e = W, t = G;
|
|
2183
2269
|
x.value = !1, W = null, G = !1, y.value = {}, m(() => {
|
|
2184
|
-
e !== null &&
|
|
2270
|
+
e !== null && Z(e, t);
|
|
2185
2271
|
});
|
|
2186
2272
|
}
|
|
2187
|
-
return
|
|
2188
|
-
closeMasonryReel:
|
|
2273
|
+
return zt({
|
|
2274
|
+
closeMasonryReel: le,
|
|
2189
2275
|
element: () => g.value,
|
|
2190
2276
|
isReelLeaving: () => x.value,
|
|
2191
2277
|
reelRenderer: () => p.value,
|
|
2192
2278
|
setReelInfoSheet: (e) => d("reelInfoSheetChange", e),
|
|
2193
2279
|
state: l.state
|
|
2194
2280
|
}), O(() => l.state.items.map((e) => e.postId), (e) => {
|
|
2195
|
-
let t = e.filter((e) => !
|
|
2196
|
-
if (
|
|
2281
|
+
let t = e.filter((e) => !H.has(e)), n = new Set(e);
|
|
2282
|
+
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 || ne()) return;
|
|
2197
2283
|
let r = /* @__PURE__ */ new Map();
|
|
2198
2284
|
e.forEach((e) => {
|
|
2199
2285
|
let t = C.value.get(e);
|
|
2200
2286
|
t !== void 0 && r.set(e, t);
|
|
2201
2287
|
}), t.forEach((e, t) => {
|
|
2202
|
-
r.set(e, t *
|
|
2203
|
-
}), C.value = r, S.value = new Set([...S.value, ...t]),
|
|
2288
|
+
r.set(e, t * Bt);
|
|
2289
|
+
}), C.value = r, S.value = new Set([...S.value, ...t]), re();
|
|
2204
2290
|
}, { flush: "sync" }), v(() => {
|
|
2205
2291
|
U !== null && cancelAnimationFrame(U);
|
|
2206
2292
|
}), i({
|
|
2207
|
-
changeActiveReelMedia:
|
|
2293
|
+
changeActiveReelMedia: ae,
|
|
2208
2294
|
getAutoScrollElement: se,
|
|
2209
|
-
loadIfNearBottom:
|
|
2210
|
-
moveActiveReelPost:
|
|
2211
|
-
navigateToReelItem:
|
|
2212
|
-
startItemRemoval:
|
|
2295
|
+
loadIfNearBottom: ie,
|
|
2296
|
+
moveActiveReelPost: oe,
|
|
2297
|
+
navigateToReelItem: q,
|
|
2298
|
+
startItemRemoval: X,
|
|
2213
2299
|
transitionActiveReelMedia: (e) => p.value?.transitionActiveMedia?.(e) ?? Promise.resolve(!1),
|
|
2214
2300
|
transitionActiveReelPost: (e) => p.value?.transitionActivePost?.(e) ?? Promise.resolve(!1)
|
|
2215
2301
|
}), (r, i) => (b(), s("div", {
|
|
2216
2302
|
ref_key: "surfaceElement",
|
|
2217
2303
|
ref: g,
|
|
2218
2304
|
class: "vibe-surface"
|
|
2219
|
-
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(
|
|
2305
|
+
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(Mt, {
|
|
2220
2306
|
key: 0,
|
|
2221
2307
|
ref_key: "reelRenderer",
|
|
2222
2308
|
ref: p,
|
|
@@ -2241,7 +2327,7 @@ var Lt = 35, Rt = 420, zt = /* @__PURE__ */ d({
|
|
|
2241
2327
|
"info-sheet-overlay": t.state.reelInfoSheetOverlay,
|
|
2242
2328
|
"next-page-error": !!t.state.nextPageError,
|
|
2243
2329
|
origin: "reel",
|
|
2244
|
-
"preview-states": E(
|
|
2330
|
+
"preview-states": E(V),
|
|
2245
2331
|
"reel-auto-advance": t.state.reelAutoAdvance,
|
|
2246
2332
|
"reel-forward": t.state.reelForward,
|
|
2247
2333
|
state: j.value,
|
|
@@ -2250,7 +2336,7 @@ var Lt = 35, Rt = 420, zt = /* @__PURE__ */ d({
|
|
|
2250
2336
|
onCloseInfoSheet: i[1] ||= (e) => d("reelInfoSheetChange", !1),
|
|
2251
2337
|
onError: E(R),
|
|
2252
2338
|
onLoadMore: i[2] ||= (e) => d("loadMore"),
|
|
2253
|
-
onMediaChange:
|
|
2339
|
+
onMediaChange: K,
|
|
2254
2340
|
onReady: E(z),
|
|
2255
2341
|
onRetryEnd: i[3] ||= (e) => d("retryEnd"),
|
|
2256
2342
|
onRetryForward: i[4] ||= (e) => d("retryForward")
|
|
@@ -2267,7 +2353,7 @@ var Lt = 35, Rt = 420, zt = /* @__PURE__ */ d({
|
|
|
2267
2353
|
"can-retry-end",
|
|
2268
2354
|
"feed-footer",
|
|
2269
2355
|
"state"
|
|
2270
|
-
])) : (b(), s(e, { key: 2 }, [u(
|
|
2356
|
+
])) : (b(), s(e, { key: 2 }, [u(gt, {
|
|
2271
2357
|
ref_key: "masonryRenderer",
|
|
2272
2358
|
ref: f,
|
|
2273
2359
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2288,14 +2374,14 @@ var Lt = 35, Rt = 420, zt = /* @__PURE__ */ d({
|
|
|
2288
2374
|
"load-more-locked": t.state.loadMoreLocked,
|
|
2289
2375
|
"media-indices": t.state.mediaIndices,
|
|
2290
2376
|
"next-page-error": !!t.state.nextPageError,
|
|
2291
|
-
"preview-states": E(
|
|
2377
|
+
"preview-states": E(ee),
|
|
2292
2378
|
suspended: t.state.reelOrigin === "masonry" || x.value,
|
|
2293
2379
|
state: j.value,
|
|
2294
2380
|
total: t.state.total,
|
|
2295
|
-
onActivate:
|
|
2381
|
+
onActivate: J,
|
|
2296
2382
|
onError: E(F),
|
|
2297
2383
|
onLoadMore: i[7] ||= (e) => d("loadMore"),
|
|
2298
|
-
onMediaChange:
|
|
2384
|
+
onMediaChange: K,
|
|
2299
2385
|
onReady: E(I),
|
|
2300
2386
|
onRetryEnd: i[8] ||= (e) => d("retryEnd"),
|
|
2301
2387
|
onVisible: E(P)
|
|
@@ -2327,7 +2413,7 @@ var Lt = 35, Rt = 420, zt = /* @__PURE__ */ d({
|
|
|
2327
2413
|
"onVisible"
|
|
2328
2414
|
]), u(n, {
|
|
2329
2415
|
name: "vibe-reel-viewer",
|
|
2330
|
-
onAfterLeave:
|
|
2416
|
+
onAfterLeave: ue
|
|
2331
2417
|
}, {
|
|
2332
2418
|
default: k(() => [t.state.reelOrigin === "masonry" ? (b(), s("section", {
|
|
2333
2419
|
key: 0,
|
|
@@ -2339,7 +2425,7 @@ var Lt = 35, Rt = 420, zt = /* @__PURE__ */ d({
|
|
|
2339
2425
|
"aria-modal": "true",
|
|
2340
2426
|
tabindex: "-1",
|
|
2341
2427
|
style: _(y.value)
|
|
2342
|
-
}, [u(
|
|
2428
|
+
}, [u(Mt, {
|
|
2343
2429
|
ref_key: "reelRenderer",
|
|
2344
2430
|
ref: p,
|
|
2345
2431
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2372,7 +2458,7 @@ var Lt = 35, Rt = 420, zt = /* @__PURE__ */ d({
|
|
|
2372
2458
|
onCloseInfoSheet: i[10] ||= (e) => d("reelInfoSheetChange", !1),
|
|
2373
2459
|
onError: E(R),
|
|
2374
2460
|
onLoadMore: i[11] ||= (e) => d("loadMore"),
|
|
2375
|
-
onMediaChange:
|
|
2461
|
+
onMediaChange: K,
|
|
2376
2462
|
onReady: E(z),
|
|
2377
2463
|
onRetryEnd: i[12] ||= (e) => d("retryEnd"),
|
|
2378
2464
|
onRetryForward: i[13] ||= (e) => d("retryForward")
|
|
@@ -2383,45 +2469,83 @@ var Lt = 35, Rt = 420, zt = /* @__PURE__ */ d({
|
|
|
2383
2469
|
});
|
|
2384
2470
|
//#endregion
|
|
2385
2471
|
//#region src/core/page.ts
|
|
2386
|
-
function
|
|
2472
|
+
function Ut(e) {
|
|
2387
2473
|
if (!e || typeof e != "object" || !Array.isArray(e.items)) throw TypeError("Vibe loadPage must resolve to a page with an items array.");
|
|
2388
2474
|
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.");
|
|
2389
2475
|
if (e.next !== null && typeof e.next != "string" && typeof e.next != "number") throw TypeError("Vibe page next must be a string, number, or null.");
|
|
2390
2476
|
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.");
|
|
2391
2477
|
return e;
|
|
2392
2478
|
}
|
|
2393
|
-
function
|
|
2479
|
+
function Q(e, t) {
|
|
2394
2480
|
let n = new Set(e.map((e) => e.postId));
|
|
2395
2481
|
return [...e, ...t.filter((e) => n.has(e.postId) ? !1 : (n.add(e.postId), !0))];
|
|
2396
2482
|
}
|
|
2483
|
+
function Wt(e) {
|
|
2484
|
+
return `${typeof e}:${String(e)}`;
|
|
2485
|
+
}
|
|
2486
|
+
function Gt(e) {
|
|
2487
|
+
return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview.src}` : `id:${Wt(e.mediaId)}`;
|
|
2488
|
+
}
|
|
2489
|
+
function Kt(e, t) {
|
|
2490
|
+
let n = [...e], r = new Map(e.map((e, t) => [Wt(e.postId), t]));
|
|
2491
|
+
return t.forEach((e) => {
|
|
2492
|
+
let t = Wt(e.postId), i = r.get(t);
|
|
2493
|
+
if (i === void 0) {
|
|
2494
|
+
r.set(t, n.length), n.push(e);
|
|
2495
|
+
return;
|
|
2496
|
+
}
|
|
2497
|
+
let a = n[i], o = new Set([a, ...a.items].map(Gt)), s = [e, ...e.items].filter((e) => {
|
|
2498
|
+
let t = Gt(e);
|
|
2499
|
+
return o.has(t) ? !1 : (o.add(t), !0);
|
|
2500
|
+
});
|
|
2501
|
+
s.length > 0 && (n[i] = {
|
|
2502
|
+
...a,
|
|
2503
|
+
items: [...a.items, ...s]
|
|
2504
|
+
});
|
|
2505
|
+
}), n;
|
|
2506
|
+
}
|
|
2507
|
+
function qt(e) {
|
|
2508
|
+
return Object.prototype.hasOwnProperty.call(e, "current") ? e.current ?? null : e.next;
|
|
2509
|
+
}
|
|
2510
|
+
//#endregion
|
|
2511
|
+
//#region src/core/appendPage.ts
|
|
2512
|
+
function Jt(e, t, n, r) {
|
|
2513
|
+
let i = Ut(e), a = n.filterItems(i.items), o = qt(i);
|
|
2514
|
+
t.items = Kt(t.items, a), t.next = i.next, i.total !== void 0 && (t.total = i.total), r(o), n.recordPages([{
|
|
2515
|
+
contributionIds: a.map(({ postId: e }) => e),
|
|
2516
|
+
cursor: o,
|
|
2517
|
+
next: i.next,
|
|
2518
|
+
returnedIds: a.map(({ postId: e }) => e)
|
|
2519
|
+
}]);
|
|
2520
|
+
}
|
|
2397
2521
|
//#endregion
|
|
2398
2522
|
//#region src/core/requestDelay.ts
|
|
2399
|
-
var
|
|
2523
|
+
var Yt = 2e3, Xt = 1e4, Zt = 250, Qt = {
|
|
2400
2524
|
delayRemainingMs: null,
|
|
2401
2525
|
nextRequestAt: null
|
|
2402
2526
|
};
|
|
2403
|
-
function
|
|
2527
|
+
function $t(e, t) {
|
|
2404
2528
|
return e === void 0 ? t : Math.floor(e);
|
|
2405
2529
|
}
|
|
2406
|
-
function
|
|
2530
|
+
function en(e, t) {
|
|
2407
2531
|
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.`);
|
|
2408
2532
|
}
|
|
2409
|
-
function
|
|
2410
|
-
let n =
|
|
2533
|
+
function tn(e, t = {}) {
|
|
2534
|
+
let n = $t(t.delayStepMs, Yt), r = $t(t.delayMaxMs, Xt);
|
|
2411
2535
|
return Math.min(Math.max(0, e) * n, r);
|
|
2412
2536
|
}
|
|
2413
|
-
function
|
|
2414
|
-
if (e == null || !Number.isFinite(e)) return { ...
|
|
2537
|
+
function $(e) {
|
|
2538
|
+
if (e == null || !Number.isFinite(e)) return { ...Qt };
|
|
2415
2539
|
let t = Math.max(0, Math.floor(e - Date.now()));
|
|
2416
2540
|
return t > 0 ? {
|
|
2417
2541
|
delayRemainingMs: t,
|
|
2418
2542
|
nextRequestAt: e
|
|
2419
|
-
} : { ...
|
|
2543
|
+
} : { ...Qt };
|
|
2420
2544
|
}
|
|
2421
|
-
async function
|
|
2545
|
+
async function nn({ delayMs: e, onChange: t, signal: n }) {
|
|
2422
2546
|
if (n.aborted) throw new DOMException("Aborted", "AbortError");
|
|
2423
2547
|
if (e <= 0) {
|
|
2424
|
-
t({ ...
|
|
2548
|
+
t({ ...Qt });
|
|
2425
2549
|
return;
|
|
2426
2550
|
}
|
|
2427
2551
|
let r = Date.now() + e;
|
|
@@ -2429,9 +2553,9 @@ async function Jt({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2429
2553
|
delayRemainingMs: e,
|
|
2430
2554
|
nextRequestAt: r
|
|
2431
2555
|
}), await new Promise((i, a) => {
|
|
2432
|
-
let o = !1, s = setInterval(f,
|
|
2556
|
+
let o = !1, s = setInterval(f, Zt), c = setTimeout(() => u(), e);
|
|
2433
2557
|
function l() {
|
|
2434
|
-
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...
|
|
2558
|
+
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...Qt });
|
|
2435
2559
|
}
|
|
2436
2560
|
function u(e) {
|
|
2437
2561
|
o || (o = !0, l(), e ? a(e) : i());
|
|
@@ -2440,42 +2564,42 @@ async function Jt({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2440
2564
|
u(new DOMException("Aborted", "AbortError"));
|
|
2441
2565
|
}
|
|
2442
2566
|
function f() {
|
|
2443
|
-
let e =
|
|
2567
|
+
let e = $(r);
|
|
2444
2568
|
t(e), e.delayRemainingMs === null && u();
|
|
2445
2569
|
}
|
|
2446
2570
|
n.addEventListener("abort", d, { once: !0 });
|
|
2447
2571
|
});
|
|
2448
2572
|
}
|
|
2449
|
-
var
|
|
2573
|
+
var rn = class {
|
|
2450
2574
|
interval = null;
|
|
2451
2575
|
constructor(e) {
|
|
2452
2576
|
this.onChange = e;
|
|
2453
2577
|
}
|
|
2454
2578
|
clear() {
|
|
2455
|
-
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...
|
|
2579
|
+
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...Qt });
|
|
2456
2580
|
}
|
|
2457
2581
|
sync(e) {
|
|
2458
2582
|
this.clear();
|
|
2459
|
-
let t =
|
|
2583
|
+
let t = $(e);
|
|
2460
2584
|
this.onChange(t), t.delayRemainingMs !== null && (this.interval = setInterval(() => {
|
|
2461
|
-
let t =
|
|
2585
|
+
let t = $(e);
|
|
2462
2586
|
this.onChange(t), t.delayRemainingMs === null && this.clear();
|
|
2463
|
-
},
|
|
2587
|
+
}, Zt));
|
|
2464
2588
|
}
|
|
2465
2589
|
};
|
|
2466
|
-
function
|
|
2590
|
+
function an(e, t = !0) {
|
|
2467
2591
|
return e.maxAdditionalPages === "unlimited" ? Infinity : (e.maxAdditionalPages ?? 10) + (t ? 1 : 0);
|
|
2468
2592
|
}
|
|
2469
|
-
function
|
|
2593
|
+
function on(e) {
|
|
2470
2594
|
return `${typeof e}:${String(e)}`;
|
|
2471
2595
|
}
|
|
2472
|
-
function
|
|
2596
|
+
function sn(e, t) {
|
|
2473
2597
|
if (!Number.isInteger(e) || e <= 0) throw TypeError(`Vibe ${t} must be a positive integer.`);
|
|
2474
2598
|
}
|
|
2475
|
-
function
|
|
2599
|
+
function cn(e) {
|
|
2476
2600
|
if (!e) return;
|
|
2477
|
-
if (
|
|
2478
|
-
|
|
2601
|
+
if (sn(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
|
|
2602
|
+
en(e, "frontend autofill");
|
|
2479
2603
|
let t = e.maxAdditionalPages;
|
|
2480
2604
|
if (t !== void 0 && t !== "unlimited" && (!Number.isInteger(t) || t < 0)) throw TypeError("Vibe autofill maxAdditionalPages must be a non-negative integer or \"unlimited\".");
|
|
2481
2605
|
return;
|
|
@@ -2487,7 +2611,7 @@ function $t(e) {
|
|
|
2487
2611
|
if (t.pageSize !== e.pageSize) throw TypeError("Vibe backend autofill initialSession pageSize must match autofill pageSize.");
|
|
2488
2612
|
}
|
|
2489
2613
|
}
|
|
2490
|
-
function
|
|
2614
|
+
function ln(e, t, n = !0) {
|
|
2491
2615
|
if (!e) return {
|
|
2492
2616
|
cycleId: null,
|
|
2493
2617
|
delayRemainingMs: null,
|
|
@@ -2504,7 +2628,7 @@ function en(e, t, n = !0) {
|
|
|
2504
2628
|
status: "idle",
|
|
2505
2629
|
strategy: null
|
|
2506
2630
|
};
|
|
2507
|
-
let r = e.strategy === "backend" ? t ?? (n ? e.initialSession : void 0) : void 0, i = r?.received ?? 0, a =
|
|
2631
|
+
let r = e.strategy === "backend" ? t ?? (n ? e.initialSession : void 0) : void 0, i = r?.received ?? 0, a = $(r?.nextRequestAt);
|
|
2508
2632
|
return {
|
|
2509
2633
|
cycleId: r?.cycleId ?? null,
|
|
2510
2634
|
...a,
|
|
@@ -2521,7 +2645,7 @@ function en(e, t, n = !0) {
|
|
|
2521
2645
|
strategy: e.strategy
|
|
2522
2646
|
};
|
|
2523
2647
|
}
|
|
2524
|
-
function
|
|
2648
|
+
function un(e) {
|
|
2525
2649
|
return [
|
|
2526
2650
|
"cancelling",
|
|
2527
2651
|
"filling",
|
|
@@ -2529,9 +2653,9 @@ function tn(e) {
|
|
|
2529
2653
|
"waiting"
|
|
2530
2654
|
].includes(e.status);
|
|
2531
2655
|
}
|
|
2532
|
-
async function
|
|
2656
|
+
async function dn(e, t, n) {
|
|
2533
2657
|
let r = t.autofill;
|
|
2534
|
-
if (!
|
|
2658
|
+
if (!un(r) || !r.cycleId) return;
|
|
2535
2659
|
let i = {
|
|
2536
2660
|
cycleId: r.cycleId,
|
|
2537
2661
|
feedKey: r.feedKey ?? "",
|
|
@@ -2544,16 +2668,16 @@ async function nn(e, t, n) {
|
|
|
2544
2668
|
throw r.error = e, r.status = "error", e;
|
|
2545
2669
|
}
|
|
2546
2670
|
}
|
|
2547
|
-
function
|
|
2671
|
+
function fn(e, t, n) {
|
|
2548
2672
|
return e?.strategy === "backend" && t.feedKey === e.feedKey && t.sessionId === n.sessionId;
|
|
2549
2673
|
}
|
|
2550
|
-
async function
|
|
2551
|
-
let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ??
|
|
2674
|
+
async function pn({ 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 }) {
|
|
2675
|
+
let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ?? an(s), g = t, _ = t, v = t, y = 0, b = [], x;
|
|
2552
2676
|
for (; y < h;) {
|
|
2553
|
-
let e =
|
|
2677
|
+
let e = on(g);
|
|
2554
2678
|
if (m.has(e)) throw Error("Vibe autofill received a repeated cursor.");
|
|
2555
|
-
if (m.add(e), await
|
|
2556
|
-
delayMs:
|
|
2679
|
+
if (m.add(e), await nn({
|
|
2680
|
+
delayMs: tn(l + y, s),
|
|
2557
2681
|
onChange: a,
|
|
2558
2682
|
signal: d
|
|
2559
2683
|
}), y > 0 && u()) return {
|
|
@@ -2567,12 +2691,12 @@ async function an({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
2567
2691
|
status: "paused",
|
|
2568
2692
|
total: x
|
|
2569
2693
|
};
|
|
2570
|
-
let t =
|
|
2694
|
+
let t = Ut(await n({
|
|
2571
2695
|
cursor: g,
|
|
2572
2696
|
signal: d
|
|
2573
2697
|
}));
|
|
2574
2698
|
y += 1, _ = g;
|
|
2575
|
-
let r =
|
|
2699
|
+
let r = Q(p, t.items).slice(p.length);
|
|
2576
2700
|
b.push({
|
|
2577
2701
|
contributionIds: r.map(({ postId: e }) => e),
|
|
2578
2702
|
cursor: g,
|
|
@@ -2624,12 +2748,12 @@ async function an({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
2624
2748
|
}
|
|
2625
2749
|
//#endregion
|
|
2626
2750
|
//#region src/core/autofillController.ts
|
|
2627
|
-
var
|
|
2751
|
+
var mn = class {
|
|
2628
2752
|
collection = null;
|
|
2629
2753
|
cycle = 0;
|
|
2630
2754
|
delayCountdown;
|
|
2631
2755
|
constructor(e) {
|
|
2632
|
-
this.context = e, this.delayCountdown = new
|
|
2756
|
+
this.context = e, this.delayCountdown = new rn((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
|
|
2633
2757
|
}
|
|
2634
2758
|
beginCycle() {
|
|
2635
2759
|
let { options: e, state: t } = this.context;
|
|
@@ -2637,14 +2761,14 @@ var on = class {
|
|
|
2637
2761
|
this.clear();
|
|
2638
2762
|
let n = `vibe-autofill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
2639
2763
|
return t.autofill = {
|
|
2640
|
-
...
|
|
2764
|
+
...ln(e, void 0, !1),
|
|
2641
2765
|
cycleId: n,
|
|
2642
2766
|
status: "filling"
|
|
2643
2767
|
}, n;
|
|
2644
2768
|
}
|
|
2645
2769
|
async cancel() {
|
|
2646
2770
|
let { cancelRequest: e, options: t, state: n } = this.context;
|
|
2647
|
-
await
|
|
2771
|
+
await dn(t, n, e), this.commitCollection();
|
|
2648
2772
|
}
|
|
2649
2773
|
captureCollection(e, t) {
|
|
2650
2774
|
t && (this.collection = e);
|
|
@@ -2666,36 +2790,36 @@ var on = class {
|
|
|
2666
2790
|
let { onLastCursor: e, options: t, state: n } = this.context;
|
|
2667
2791
|
if (t?.strategy !== "frontend") return !1;
|
|
2668
2792
|
let r = this.collection;
|
|
2669
|
-
return this.collection = null, r ? (n.items =
|
|
2793
|
+
return this.collection = null, r ? (n.items = Q(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, {
|
|
2670
2794
|
missing: r.missing,
|
|
2671
2795
|
received: r.received,
|
|
2672
2796
|
requests: r.requests
|
|
2673
2797
|
}), !0) : !1;
|
|
2674
2798
|
}
|
|
2675
|
-
},
|
|
2676
|
-
function
|
|
2799
|
+
}, hn = 100;
|
|
2800
|
+
function gn(e, t) {
|
|
2677
2801
|
if (!Number.isFinite(t) || t <= 0) throw TypeError(`Vibe ${e} must be a positive number.`);
|
|
2678
2802
|
}
|
|
2679
|
-
function
|
|
2803
|
+
function _n(e, t, n) {
|
|
2680
2804
|
return Math.min(n, Math.max(t, e));
|
|
2681
2805
|
}
|
|
2682
|
-
function
|
|
2806
|
+
function vn(e) {
|
|
2683
2807
|
if (!e) return;
|
|
2684
2808
|
let t = e.minSpeedPxPerSecond ?? 20, n = e.maxSpeedPxPerSecond ?? 240;
|
|
2685
|
-
if (
|
|
2686
|
-
e.speedPxPerSecond !== void 0 &&
|
|
2809
|
+
if (gn("autoScroll.minSpeedPxPerSecond", t), gn("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
|
|
2810
|
+
e.speedPxPerSecond !== void 0 && gn("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
|
|
2687
2811
|
}
|
|
2688
|
-
function
|
|
2812
|
+
function yn(e) {
|
|
2689
2813
|
let t = e?.minSpeedPxPerSecond ?? 20, n = e?.maxSpeedPxPerSecond ?? 240;
|
|
2690
2814
|
return {
|
|
2691
2815
|
enabled: e?.enabled ?? !1,
|
|
2692
2816
|
maxSpeedPxPerSecond: n,
|
|
2693
2817
|
minSpeedPxPerSecond: t,
|
|
2694
2818
|
paused: !1,
|
|
2695
|
-
speedPxPerSecond:
|
|
2819
|
+
speedPxPerSecond: _n(e?.speedPxPerSecond ?? 80, t, n)
|
|
2696
2820
|
};
|
|
2697
2821
|
}
|
|
2698
|
-
var
|
|
2822
|
+
var bn = class {
|
|
2699
2823
|
frame = null;
|
|
2700
2824
|
lastTimestamp = null;
|
|
2701
2825
|
mounted = !1;
|
|
@@ -2715,9 +2839,9 @@ var fn = class {
|
|
|
2715
2839
|
this.options.state.enabled && (this.options.state.paused = e, this.lastTimestamp = null, e ? this.cancelFrame() : this.schedule());
|
|
2716
2840
|
}
|
|
2717
2841
|
setSpeed(e) {
|
|
2718
|
-
|
|
2842
|
+
gn("auto-scroll speed", e);
|
|
2719
2843
|
let t = this.options.state;
|
|
2720
|
-
t.speedPxPerSecond =
|
|
2844
|
+
t.speedPxPerSecond = _n(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
|
|
2721
2845
|
}
|
|
2722
2846
|
tick = (e) => {
|
|
2723
2847
|
this.frame = null;
|
|
@@ -2729,7 +2853,7 @@ var fn = class {
|
|
|
2729
2853
|
return;
|
|
2730
2854
|
}
|
|
2731
2855
|
if (this.lastTimestamp !== null) {
|
|
2732
|
-
let r = Math.min(
|
|
2856
|
+
let r = Math.min(hn, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
|
|
2733
2857
|
n.scrollTop = Math.min(i, n.scrollTop + t.speedPxPerSecond * r / 1e3);
|
|
2734
2858
|
}
|
|
2735
2859
|
this.lastTimestamp = e, this.schedule();
|
|
@@ -2743,13 +2867,13 @@ var fn = class {
|
|
|
2743
2867
|
};
|
|
2744
2868
|
//#endregion
|
|
2745
2869
|
//#region src/core/backendAutofill.ts
|
|
2746
|
-
async function
|
|
2870
|
+
async function xn(e, t, n, r) {
|
|
2747
2871
|
let i = await e.onUnderfilled(n);
|
|
2748
2872
|
if (!r()) return;
|
|
2749
2873
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend autofill requires a sessionId.");
|
|
2750
2874
|
let a = Math.max(n.received, i.received ?? n.received);
|
|
2751
2875
|
Object.assign(t.autofill, {
|
|
2752
|
-
|
|
2876
|
+
...$(i.nextRequestAt),
|
|
2753
2877
|
missing: Math.max(0, e.pageSize - a),
|
|
2754
2878
|
received: a,
|
|
2755
2879
|
sequence: i.sequence ?? 0,
|
|
@@ -2757,19 +2881,34 @@ async function pn(e, t, n, r) {
|
|
|
2757
2881
|
status: "waiting"
|
|
2758
2882
|
});
|
|
2759
2883
|
}
|
|
2760
|
-
function
|
|
2761
|
-
["complete", "exhausted"].includes(t.status) && t.items && (e.items =
|
|
2884
|
+
function Sn(e, t) {
|
|
2885
|
+
["complete", "exhausted"].includes(t.status) && t.items && (e.items = Q(e.items, t.items)), t.next !== void 0 && (e.next = t.next), t.total !== void 0 && (e.total = t.total);
|
|
2762
2886
|
}
|
|
2763
|
-
function
|
|
2887
|
+
function Cn(e, t, n) {
|
|
2764
2888
|
let r = t.autofill;
|
|
2765
|
-
return !
|
|
2889
|
+
return !fn(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (Sn(t, n), Object.assign(r, $(n.status === "waiting" ? n.nextRequestAt : null)), r.error = n.error ?? null, r.missing = Math.max(0, (r.pageSize ?? 0) - n.received), r.received = n.received, n.requests !== void 0 && (r.requests = n.requests), r.sequence = n.sequence, r.status = n.status, !0);
|
|
2766
2890
|
}
|
|
2767
|
-
function
|
|
2768
|
-
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill =
|
|
2891
|
+
function wn(e, t, n) {
|
|
2892
|
+
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = ln(e, n), Sn(t, n), !0);
|
|
2893
|
+
}
|
|
2894
|
+
//#endregion
|
|
2895
|
+
//#region src/core/backlogRestore.ts
|
|
2896
|
+
async function Tn(e, t, n) {
|
|
2897
|
+
if (!e) return;
|
|
2898
|
+
let r = new AbortController();
|
|
2899
|
+
n(r);
|
|
2900
|
+
try {
|
|
2901
|
+
await e({
|
|
2902
|
+
appendPage: t,
|
|
2903
|
+
signal: r.signal
|
|
2904
|
+
});
|
|
2905
|
+
} finally {
|
|
2906
|
+
n(null);
|
|
2907
|
+
}
|
|
2769
2908
|
}
|
|
2770
2909
|
//#endregion
|
|
2771
2910
|
//#region src/core/initialAutofill.ts
|
|
2772
|
-
async function
|
|
2911
|
+
async function En({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, onPages: i, options: a, signal: o, state: s }) {
|
|
2773
2912
|
let c = a.autofill;
|
|
2774
2913
|
if (!c) return;
|
|
2775
2914
|
let l = s.items.length;
|
|
@@ -2782,7 +2921,7 @@ async function _n({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
2782
2921
|
return;
|
|
2783
2922
|
}
|
|
2784
2923
|
if (c.strategy === "backend") {
|
|
2785
|
-
await
|
|
2924
|
+
await xn(c, s, {
|
|
2786
2925
|
cycleId: e,
|
|
2787
2926
|
feedKey: c.feedKey,
|
|
2788
2927
|
items: [...s.items],
|
|
@@ -2799,11 +2938,11 @@ async function _n({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
2799
2938
|
s.autofill.status = "exhausted";
|
|
2800
2939
|
return;
|
|
2801
2940
|
}
|
|
2802
|
-
let u = await
|
|
2941
|
+
let u = await pn({
|
|
2803
2942
|
existingItems: s.items,
|
|
2804
2943
|
initialCursor: s.next,
|
|
2805
2944
|
loadPage: a.loadPage,
|
|
2806
|
-
maximumRequests:
|
|
2945
|
+
maximumRequests: an(c, !1),
|
|
2807
2946
|
onCollection: n,
|
|
2808
2947
|
onDelayChange: (e) => {
|
|
2809
2948
|
t() && Object.assign(s.autofill, e);
|
|
@@ -2817,7 +2956,7 @@ async function _n({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
2817
2956
|
shouldPause: () => s.loadMoreLocked,
|
|
2818
2957
|
signal: o
|
|
2819
2958
|
});
|
|
2820
|
-
t() && (s.items =
|
|
2959
|
+
t() && (s.items = Q(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, {
|
|
2821
2960
|
missing: u.missing,
|
|
2822
2961
|
received: u.received,
|
|
2823
2962
|
requests: u.requests,
|
|
@@ -2826,36 +2965,40 @@ async function _n({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
2826
2965
|
}
|
|
2827
2966
|
//#endregion
|
|
2828
2967
|
//#region src/core/fill.ts
|
|
2829
|
-
function
|
|
2830
|
-
return "pages" in e ? { pages: e.pages } : { until: "end" };
|
|
2968
|
+
function Dn(e) {
|
|
2969
|
+
return "items" in e ? { items: e.items } : "pages" in e ? { pages: e.pages } : { until: "end" };
|
|
2831
2970
|
}
|
|
2832
|
-
function
|
|
2971
|
+
function On(e) {
|
|
2833
2972
|
return `${typeof e}:${String(e)}`;
|
|
2834
2973
|
}
|
|
2835
|
-
function
|
|
2974
|
+
function kn(e) {
|
|
2836
2975
|
if (!e || typeof e != "object") throw TypeError("Vibe fill target must be an object.");
|
|
2837
2976
|
if ("pages" in e) {
|
|
2838
2977
|
if (!Number.isInteger(e.pages) || e.pages <= 0) throw TypeError("Vibe fill pages must be a positive integer.");
|
|
2839
2978
|
return { pages: e.pages };
|
|
2840
2979
|
}
|
|
2980
|
+
if ("items" in e) {
|
|
2981
|
+
if (!Number.isInteger(e.items) || e.items <= 0) throw TypeError("Vibe fill items must be a positive integer.");
|
|
2982
|
+
return { items: e.items };
|
|
2983
|
+
}
|
|
2841
2984
|
if ("until" in e && e.until === "end") return { until: "end" };
|
|
2842
|
-
throw TypeError("Vibe fill target must be { pages } or { until: 'end' }.");
|
|
2985
|
+
throw TypeError("Vibe fill target must be { items }, { pages }, or { until: 'end' }.");
|
|
2843
2986
|
}
|
|
2844
|
-
function
|
|
2987
|
+
function An(e) {
|
|
2845
2988
|
if (!e) return;
|
|
2846
2989
|
if (e.strategy === "frontend") {
|
|
2847
|
-
|
|
2990
|
+
en(e, "frontend fill");
|
|
2848
2991
|
return;
|
|
2849
2992
|
}
|
|
2850
2993
|
if (!e.feedKey.trim()) throw TypeError("Vibe backend fill requires a feedKey.");
|
|
2851
2994
|
let t = e.initialSession;
|
|
2852
2995
|
if (t) {
|
|
2853
2996
|
if (t.feedKey !== e.feedKey) throw TypeError("Vibe backend fill initialSession feedKey must match fill feedKey.");
|
|
2854
|
-
|
|
2997
|
+
kn(t.target);
|
|
2855
2998
|
}
|
|
2856
2999
|
}
|
|
2857
|
-
function
|
|
2858
|
-
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a =
|
|
3000
|
+
function jn(e, t, n = !0) {
|
|
3001
|
+
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a = $(i?.nextRequestAt);
|
|
2859
3002
|
return {
|
|
2860
3003
|
completedPages: i?.completedPages ?? 0,
|
|
2861
3004
|
cycleId: i?.cycleId ?? null,
|
|
@@ -2868,10 +3011,10 @@ function Sn(e, t, n = !0) {
|
|
|
2868
3011
|
sessionId: i?.sessionId ?? null,
|
|
2869
3012
|
status: i?.status ?? "idle",
|
|
2870
3013
|
strategy: e?.strategy ?? null,
|
|
2871
|
-
target: i ?
|
|
3014
|
+
target: i ? Dn(i.target) : null
|
|
2872
3015
|
};
|
|
2873
3016
|
}
|
|
2874
|
-
function
|
|
3017
|
+
function Mn(e) {
|
|
2875
3018
|
return [
|
|
2876
3019
|
"cancelling",
|
|
2877
3020
|
"filling",
|
|
@@ -2879,13 +3022,22 @@ function Cn(e) {
|
|
|
2879
3022
|
"waiting"
|
|
2880
3023
|
].includes(e.status);
|
|
2881
3024
|
}
|
|
2882
|
-
async function
|
|
3025
|
+
async function Nn({ existingItems: e, initialCursor: t, loadPage: n, onCollection: r = () => void 0, onDelayChange: i, onProgress: a, options: o, shouldPause: s = () => !1, signal: c, target: l }) {
|
|
2883
3026
|
let u = [], d = [], f = [...e], p = /* @__PURE__ */ new Set(), m = 0, h = t, g = t, _ = t, v = 0, y;
|
|
3027
|
+
if ("items" in l && f.length >= l.items) return {
|
|
3028
|
+
completedPages: m,
|
|
3029
|
+
items: u,
|
|
3030
|
+
lastCursor: g,
|
|
3031
|
+
next: _,
|
|
3032
|
+
pages: d,
|
|
3033
|
+
received: v,
|
|
3034
|
+
status: "complete"
|
|
3035
|
+
};
|
|
2884
3036
|
for (; _ !== null;) {
|
|
2885
|
-
let e =
|
|
3037
|
+
let e = On(h);
|
|
2886
3038
|
if (p.has(e)) throw Error("Vibe fill received a repeated cursor.");
|
|
2887
|
-
if (p.add(e), await
|
|
2888
|
-
delayMs:
|
|
3039
|
+
if (p.add(e), await nn({
|
|
3040
|
+
delayMs: tn(m, o),
|
|
2889
3041
|
onChange: i,
|
|
2890
3042
|
signal: c
|
|
2891
3043
|
}), m > 0 && s()) return {
|
|
@@ -2898,12 +3050,12 @@ async function wn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
2898
3050
|
status: "paused",
|
|
2899
3051
|
total: y
|
|
2900
3052
|
};
|
|
2901
|
-
let t =
|
|
3053
|
+
let t = Ut(await n({
|
|
2902
3054
|
cursor: h,
|
|
2903
3055
|
signal: c
|
|
2904
3056
|
}));
|
|
2905
3057
|
m += 1, g = h;
|
|
2906
|
-
let b =
|
|
3058
|
+
let b = Q(f, t.items).slice(f.length);
|
|
2907
3059
|
if (d.push({
|
|
2908
3060
|
contributionIds: b.map(({ postId: e }) => e),
|
|
2909
3061
|
cursor: h,
|
|
@@ -2921,7 +3073,7 @@ async function wn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
2921
3073
|
pages: [...d],
|
|
2922
3074
|
received: v,
|
|
2923
3075
|
total: y
|
|
2924
|
-
}), "pages" in l && m >= l.pages) return {
|
|
3076
|
+
}), "items" in l && f.length >= l.items || "pages" in l && m >= l.pages) return {
|
|
2925
3077
|
completedPages: m,
|
|
2926
3078
|
items: u,
|
|
2927
3079
|
lastCursor: h,
|
|
@@ -2938,7 +3090,7 @@ async function wn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
2938
3090
|
next: _,
|
|
2939
3091
|
pages: d,
|
|
2940
3092
|
received: v,
|
|
2941
|
-
status: "
|
|
3093
|
+
status: "until" in l ? "complete" : "exhausted",
|
|
2942
3094
|
total: y
|
|
2943
3095
|
};
|
|
2944
3096
|
if (s()) return {
|
|
@@ -2960,18 +3112,18 @@ async function wn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
2960
3112
|
next: null,
|
|
2961
3113
|
pages: d,
|
|
2962
3114
|
received: v,
|
|
2963
|
-
status: "
|
|
3115
|
+
status: "until" in l ? "complete" : "exhausted",
|
|
2964
3116
|
total: y
|
|
2965
3117
|
};
|
|
2966
3118
|
}
|
|
2967
3119
|
//#endregion
|
|
2968
3120
|
//#region src/core/backendFill.ts
|
|
2969
|
-
async function
|
|
3121
|
+
async function Pn(e, t, n, r) {
|
|
2970
3122
|
let i = await e.onStart(n);
|
|
2971
3123
|
if (r()) {
|
|
2972
3124
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend fill requires a sessionId.");
|
|
2973
3125
|
Object.assign(t.fill, {
|
|
2974
|
-
|
|
3126
|
+
...$(i.nextRequestAt),
|
|
2975
3127
|
completedPages: i.completedPages ?? 0,
|
|
2976
3128
|
received: i.received ?? 0,
|
|
2977
3129
|
sequence: i.sequence ?? 0,
|
|
@@ -2980,23 +3132,23 @@ async function Tn(e, t, n, r) {
|
|
|
2980
3132
|
});
|
|
2981
3133
|
}
|
|
2982
3134
|
}
|
|
2983
|
-
function
|
|
3135
|
+
function Fn(e, t, n) {
|
|
2984
3136
|
return e?.strategy === "backend" && n.feedKey === e.feedKey && n.sessionId === t.fill.sessionId;
|
|
2985
3137
|
}
|
|
2986
|
-
function
|
|
3138
|
+
function In(e) {
|
|
2987
3139
|
return Number.isInteger(e.completedPages) && e.completedPages >= 0 && Number.isInteger(e.received) && e.received >= 0 && Number.isInteger(e.sequence) && e.sequence >= 0;
|
|
2988
3140
|
}
|
|
2989
|
-
function
|
|
3141
|
+
function Ln(e, t) {
|
|
2990
3142
|
if (!["complete", "exhausted"].includes(t.status)) return !0;
|
|
2991
3143
|
let n = e.fill.target;
|
|
2992
3144
|
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;
|
|
2993
3145
|
}
|
|
2994
|
-
function
|
|
2995
|
-
t.total !== void 0 && (e.total = t.total), ["complete", "exhausted"].includes(t.status) && (e.items =
|
|
3146
|
+
function Rn(e, t, n) {
|
|
3147
|
+
t.total !== void 0 && (e.total = t.total), ["complete", "exhausted"].includes(t.status) && (e.items = Q(e.items, t.items ?? []), e.next = t.next ?? null, n(t.lastCursor ?? null));
|
|
2996
3148
|
}
|
|
2997
|
-
function
|
|
2998
|
-
return !
|
|
2999
|
-
|
|
3149
|
+
function zn(e, t, n, r) {
|
|
3150
|
+
return !Fn(e, t, n) || !In(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !Ln(t, n) ? !1 : (Rn(t, n, r), Object.assign(t.fill, {
|
|
3151
|
+
...$(n.status === "waiting" ? n.nextRequestAt : null),
|
|
3000
3152
|
completedPages: n.completedPages,
|
|
3001
3153
|
error: n.error ?? null,
|
|
3002
3154
|
received: n.received,
|
|
@@ -3004,58 +3156,58 @@ function An(e, t, n, r) {
|
|
|
3004
3156
|
status: n.status
|
|
3005
3157
|
}), !0);
|
|
3006
3158
|
}
|
|
3007
|
-
function
|
|
3159
|
+
function Bn(e, t, n, r) {
|
|
3008
3160
|
if (e?.strategy !== "backend" || n.feedKey !== e.feedKey) return !1;
|
|
3009
3161
|
let i = t.fill;
|
|
3010
|
-
return t.fill =
|
|
3162
|
+
return t.fill = jn(e, n), !In(n) || !Ln(t, n) ? (t.fill = i, !1) : (Rn(t, n, r), !0);
|
|
3011
3163
|
}
|
|
3012
3164
|
//#endregion
|
|
3013
3165
|
//#region src/core/fillController.ts
|
|
3014
|
-
var
|
|
3166
|
+
var Vn = class {
|
|
3015
3167
|
abortController = null;
|
|
3016
3168
|
cycle = 0;
|
|
3017
3169
|
delayCountdown;
|
|
3018
3170
|
requestVersion = 0;
|
|
3019
3171
|
collection = null;
|
|
3020
3172
|
constructor(e) {
|
|
3021
|
-
this.options = e, this.delayCountdown = new
|
|
3173
|
+
this.options = e, this.delayCountdown = new rn((e) => {
|
|
3022
3174
|
Object.assign(this.options.state.fill, e);
|
|
3023
3175
|
}), this.syncBackendCountdown();
|
|
3024
3176
|
}
|
|
3025
3177
|
isActive() {
|
|
3026
|
-
return
|
|
3178
|
+
return Mn(this.options.state.fill);
|
|
3027
3179
|
}
|
|
3028
3180
|
applyUpdate(e) {
|
|
3029
|
-
let t =
|
|
3181
|
+
let t = zn(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
3030
3182
|
return t && this.syncBackendCountdown(), t;
|
|
3031
3183
|
}
|
|
3032
3184
|
restoreSession(e) {
|
|
3033
|
-
let t =
|
|
3185
|
+
let t = Bn(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
3034
3186
|
return t && this.syncBackendCountdown(), t;
|
|
3035
3187
|
}
|
|
3036
3188
|
async start(e, t = {}) {
|
|
3037
3189
|
let n = this.options.fill;
|
|
3038
3190
|
if (!n) throw Error("Vibe fill is not configured.");
|
|
3039
3191
|
if (this.isActive()) throw Error("Vibe fill is already active.");
|
|
3040
|
-
let r =
|
|
3192
|
+
let r = kn(e), i = kn(t.target ?? r), a = t.progressOffset ?? {
|
|
3041
3193
|
completedPages: 0,
|
|
3042
3194
|
received: 0
|
|
3043
3195
|
}, o = t.cycleId ?? `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
3044
3196
|
if (this.options.state.fill = {
|
|
3045
|
-
...
|
|
3197
|
+
...jn(n, void 0, !1),
|
|
3046
3198
|
completedPages: a.completedPages,
|
|
3047
3199
|
cycleId: o,
|
|
3048
3200
|
received: a.received,
|
|
3049
3201
|
status: "filling",
|
|
3050
3202
|
target: i
|
|
3051
3203
|
}, n.strategy === "backend" && this.options.state.next === null) {
|
|
3052
|
-
this.options.state.fill.status = "
|
|
3204
|
+
this.options.state.fill.status = "until" in r ? "complete" : "exhausted";
|
|
3053
3205
|
return;
|
|
3054
3206
|
}
|
|
3055
3207
|
let s = ++this.requestVersion, c = new AbortController();
|
|
3056
3208
|
this.abortController = c;
|
|
3057
3209
|
try {
|
|
3058
|
-
n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await
|
|
3210
|
+
n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await Pn(n, this.options.state, {
|
|
3059
3211
|
cycleId: o,
|
|
3060
3212
|
feedKey: n.feedKey,
|
|
3061
3213
|
items: [...this.options.state.items],
|
|
@@ -3066,14 +3218,14 @@ var Mn = class {
|
|
|
3066
3218
|
}, () => this.isCurrent(s)), this.syncBackendCountdown());
|
|
3067
3219
|
} catch (e) {
|
|
3068
3220
|
if (c.signal.aborted || !this.isCurrent(s)) return;
|
|
3069
|
-
throw this.options.state.fill.error = e, this.options.state.fill.status = "error", e;
|
|
3221
|
+
throw this.commitCollection(), this.options.state.fill.error = e, this.options.state.fill.status = "error", e;
|
|
3070
3222
|
} finally {
|
|
3071
3223
|
this.isCurrent(s) && (this.abortController = null, this.options.state.isLoadingMore = !1);
|
|
3072
3224
|
}
|
|
3073
3225
|
}
|
|
3074
3226
|
async cancel() {
|
|
3075
3227
|
let { fill: e, state: t } = this.options;
|
|
3076
|
-
if (!
|
|
3228
|
+
if (!Mn(t.fill) || !t.fill.cycleId) return;
|
|
3077
3229
|
let n = {
|
|
3078
3230
|
cycleId: t.fill.cycleId,
|
|
3079
3231
|
feedKey: t.fill.feedKey ?? "",
|
|
@@ -3091,7 +3243,7 @@ var Mn = class {
|
|
|
3091
3243
|
if (t.status !== "paused" || !t.target) return Promise.resolve();
|
|
3092
3244
|
let n = t.target, r = "pages" in n ? n.pages - t.completedPages : null;
|
|
3093
3245
|
if (r !== null && r <= 0) return t.status = "complete", Promise.resolve();
|
|
3094
|
-
let i = r === null ?
|
|
3246
|
+
let i = r === null ? n : { pages: r };
|
|
3095
3247
|
return t.strategy === "backend" ? this.start(i) : this.start(i, {
|
|
3096
3248
|
cycleId: t.cycleId ?? void 0,
|
|
3097
3249
|
prepareFrontend: e,
|
|
@@ -3102,8 +3254,22 @@ var Mn = class {
|
|
|
3102
3254
|
target: n
|
|
3103
3255
|
});
|
|
3104
3256
|
}
|
|
3257
|
+
retry(e) {
|
|
3258
|
+
let { fill: t } = this.options.state;
|
|
3259
|
+
if (t.status !== "error" || !t.target) return Promise.resolve();
|
|
3260
|
+
let n = t.target, r = "pages" in n ? n.pages - t.completedPages : null;
|
|
3261
|
+
return r !== null && r <= 0 ? (t.status = "complete", Promise.resolve()) : this.start(r === null ? n : { pages: r }, {
|
|
3262
|
+
cycleId: t.cycleId ?? void 0,
|
|
3263
|
+
prepareFrontend: e,
|
|
3264
|
+
progressOffset: {
|
|
3265
|
+
completedPages: t.completedPages,
|
|
3266
|
+
received: t.received
|
|
3267
|
+
},
|
|
3268
|
+
target: n
|
|
3269
|
+
});
|
|
3270
|
+
}
|
|
3105
3271
|
reset() {
|
|
3106
|
-
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill =
|
|
3272
|
+
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = jn(this.options.fill, void 0, !1), this.collection = null;
|
|
3107
3273
|
}
|
|
3108
3274
|
destroy() {
|
|
3109
3275
|
this.abortLocalRequest(), this.delayCountdown.clear();
|
|
@@ -3135,10 +3301,10 @@ var Mn = class {
|
|
|
3135
3301
|
s.fill.status = "filling";
|
|
3136
3302
|
}
|
|
3137
3303
|
if (s.next === null) {
|
|
3138
|
-
s.fill.status = "
|
|
3304
|
+
s.fill.status = "until" in t ? "complete" : "exhausted";
|
|
3139
3305
|
return;
|
|
3140
3306
|
}
|
|
3141
|
-
let c = await
|
|
3307
|
+
let c = await Nn({
|
|
3142
3308
|
existingItems: s.items,
|
|
3143
3309
|
initialCursor: s.next,
|
|
3144
3310
|
loadPage: o,
|
|
@@ -3147,7 +3313,7 @@ var Mn = class {
|
|
|
3147
3313
|
...e,
|
|
3148
3314
|
completedPages: a.completedPages + e.completedPages,
|
|
3149
3315
|
received: a.received + e.received
|
|
3150
|
-
});
|
|
3316
|
+
}, this.commitCollection());
|
|
3151
3317
|
},
|
|
3152
3318
|
onDelayChange: (e) => {
|
|
3153
3319
|
this.isCurrent(r) && Object.assign(s.fill, e);
|
|
@@ -3164,7 +3330,7 @@ var Mn = class {
|
|
|
3164
3330
|
signal: n.signal,
|
|
3165
3331
|
target: t
|
|
3166
3332
|
});
|
|
3167
|
-
this.isCurrent(r) && (s.items =
|
|
3333
|
+
this.isCurrent(r) && (s.items = Q(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, {
|
|
3168
3334
|
completedPages: a.completedPages + c.completedPages,
|
|
3169
3335
|
received: a.received + c.received,
|
|
3170
3336
|
status: c.status
|
|
@@ -3174,7 +3340,7 @@ var Mn = class {
|
|
|
3174
3340
|
let e = this.collection;
|
|
3175
3341
|
if (this.collection = null, !e || this.options.fill?.strategy !== "frontend") return;
|
|
3176
3342
|
let t = this.options.state;
|
|
3177
|
-
t.items =
|
|
3343
|
+
t.items = Q(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, {
|
|
3178
3344
|
completedPages: e.completedPages,
|
|
3179
3345
|
received: e.received
|
|
3180
3346
|
});
|
|
@@ -3186,7 +3352,7 @@ var Mn = class {
|
|
|
3186
3352
|
};
|
|
3187
3353
|
//#endregion
|
|
3188
3354
|
//#region src/core/fillReconciliation.ts
|
|
3189
|
-
async function
|
|
3355
|
+
async function Hn({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r, setLastCursor: i, signal: a, state: o }) {
|
|
3190
3356
|
if (!e.needsReconciliation(o.items)) return "skipped";
|
|
3191
3357
|
let s = await e.reconcile({
|
|
3192
3358
|
existingItems: o.items,
|
|
@@ -3195,11 +3361,11 @@ async function Nn({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r,
|
|
|
3195
3361
|
shouldPause: () => o.loadMoreLocked,
|
|
3196
3362
|
signal: a
|
|
3197
3363
|
});
|
|
3198
|
-
return t() ? (o.items =
|
|
3364
|
+
return t() ? (o.items = Q(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;
|
|
3199
3365
|
}
|
|
3200
3366
|
//#endregion
|
|
3201
3367
|
//#region src/core/feedFooter.ts
|
|
3202
|
-
function
|
|
3368
|
+
function Un(e) {
|
|
3203
3369
|
return {
|
|
3204
3370
|
cancelAutofill: () => e.cancelAutofill(),
|
|
3205
3371
|
loadMore: () => e.loadNext(),
|
|
@@ -3207,67 +3373,68 @@ function Pn(e) {
|
|
|
3207
3373
|
let t = e.getState();
|
|
3208
3374
|
return t.autofill.strategy === "frontend" && t.autofill.status === "error" && t.items.length > 0 && t.next !== null ? e.loadNext() : e.reload();
|
|
3209
3375
|
},
|
|
3210
|
-
retryEnd: () => e.retryEnd()
|
|
3376
|
+
retryEnd: () => e.retryEnd(),
|
|
3377
|
+
retryFill: () => e.retryFill()
|
|
3211
3378
|
};
|
|
3212
3379
|
}
|
|
3213
|
-
function
|
|
3380
|
+
function Wn(e) {
|
|
3214
3381
|
if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
|
|
3215
3382
|
}
|
|
3216
|
-
function
|
|
3217
|
-
e?.intervalMs !== void 0 &&
|
|
3383
|
+
function Gn(e) {
|
|
3384
|
+
e?.intervalMs !== void 0 && Wn(e.intervalMs);
|
|
3218
3385
|
}
|
|
3219
|
-
function
|
|
3386
|
+
function Kn(e) {
|
|
3220
3387
|
return {
|
|
3221
3388
|
enabled: e?.enabled ?? !1,
|
|
3222
3389
|
includePostItems: e?.includePostItems ?? !1,
|
|
3223
3390
|
intervalMs: e?.intervalMs ?? 5e3
|
|
3224
3391
|
};
|
|
3225
3392
|
}
|
|
3226
|
-
function
|
|
3393
|
+
function qn(e, t) {
|
|
3227
3394
|
if (typeof t == "boolean") {
|
|
3228
3395
|
e.enabled = t;
|
|
3229
3396
|
return;
|
|
3230
3397
|
}
|
|
3231
|
-
|
|
3398
|
+
Gn(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);
|
|
3232
3399
|
}
|
|
3233
3400
|
//#endregion
|
|
3234
3401
|
//#region src/core/reelInfoSheet.ts
|
|
3235
|
-
function
|
|
3402
|
+
function Jn(e) {
|
|
3236
3403
|
return { enabled: e?.enabled ?? !1 };
|
|
3237
3404
|
}
|
|
3238
|
-
function
|
|
3405
|
+
function Yn(e, t, n) {
|
|
3239
3406
|
if (n && !t) throw Error("Vibe cannot enable reelInfoSheet without a configured component.");
|
|
3240
3407
|
e.enabled = n;
|
|
3241
3408
|
}
|
|
3242
3409
|
//#endregion
|
|
3243
3410
|
//#region src/core/initialRuntimeState.ts
|
|
3244
|
-
function
|
|
3411
|
+
function Xn(e, t) {
|
|
3245
3412
|
let n = e.initialPage;
|
|
3246
3413
|
return {
|
|
3247
3414
|
activeReelPostId: null,
|
|
3248
|
-
autoScroll:
|
|
3249
|
-
autofill:
|
|
3415
|
+
autoScroll: yn(e.autoScroll),
|
|
3416
|
+
autofill: ln(e.autofill),
|
|
3250
3417
|
current: n?.current ?? null,
|
|
3251
3418
|
error: null,
|
|
3252
|
-
fill:
|
|
3419
|
+
fill: jn(e.fill),
|
|
3253
3420
|
infiniteScroll: e.infiniteScroll ?? !0,
|
|
3254
3421
|
isLoading: !n,
|
|
3255
3422
|
isLoadingMore: !1,
|
|
3256
|
-
items: n ?
|
|
3423
|
+
items: n ? Q([], n.items) : [],
|
|
3257
3424
|
layout: t === "reel" ? "reel" : "masonry",
|
|
3258
3425
|
loadMoreLocked: !1,
|
|
3259
3426
|
mediaIndices: /* @__PURE__ */ new Map(),
|
|
3260
3427
|
next: n?.next ?? null,
|
|
3261
3428
|
nextPageError: null,
|
|
3262
3429
|
phoneMode: !1,
|
|
3263
|
-
reelAutoAdvance:
|
|
3430
|
+
reelAutoAdvance: Kn(e.reelAutoAdvance),
|
|
3264
3431
|
reelForward: {
|
|
3265
3432
|
error: null,
|
|
3266
3433
|
status: "idle"
|
|
3267
3434
|
},
|
|
3268
3435
|
reelForwardIndex: null,
|
|
3269
3436
|
reelForwardItem: null,
|
|
3270
|
-
reelInfoSheet:
|
|
3437
|
+
reelInfoSheet: Jn(e.reelInfoSheet),
|
|
3271
3438
|
reelInfoSheetOverlay: !1,
|
|
3272
3439
|
reelMediaSource: "original",
|
|
3273
3440
|
reelOrigin: null,
|
|
@@ -3276,20 +3443,20 @@ function Vn(e, t) {
|
|
|
3276
3443
|
}
|
|
3277
3444
|
//#endregion
|
|
3278
3445
|
//#region src/core/options.ts
|
|
3279
|
-
function
|
|
3446
|
+
function Zn(e, t) {
|
|
3280
3447
|
if (t) {
|
|
3281
3448
|
if (!Number.isFinite(t.height) || t.height <= 0) throw TypeError(`Vibe ${e} height must be a positive number.`);
|
|
3282
3449
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe ${e} background must be "default" or "transparent".`);
|
|
3283
3450
|
}
|
|
3284
3451
|
}
|
|
3285
|
-
function
|
|
3452
|
+
function Qn(e, t) {
|
|
3286
3453
|
if (t) {
|
|
3287
3454
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe mediaCard ${e} background must be "default" or "transparent".`);
|
|
3288
3455
|
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.`);
|
|
3289
3456
|
}
|
|
3290
3457
|
}
|
|
3291
|
-
function
|
|
3292
|
-
if (
|
|
3458
|
+
function $n(e) {
|
|
3459
|
+
if (vn(e.autoScroll), Zn("cardHeader", e.cardHeader), Zn("cardFooter", e.cardFooter), Qn("header", e.mediaCard?.header), Qn("footer", e.mediaCard?.footer), cn(e.autofill), An(e.fill), X(e.masonry), Gn(e.reelAutoAdvance), e.removalReconciliation) {
|
|
3293
3460
|
if (!Number.isInteger(e.removalReconciliation.pageSize) || e.removalReconciliation.pageSize <= 0) throw TypeError("Vibe removalReconciliation pageSize must be a positive integer.");
|
|
3294
3461
|
let t = e.removalReconciliation.maxReplayPages ?? 5;
|
|
3295
3462
|
if (!Number.isInteger(t) || t <= 0) throw TypeError("Vibe removalReconciliation maxReplayPages must be a positive integer.");
|
|
@@ -3304,7 +3471,7 @@ function Wn(e) {
|
|
|
3304
3471
|
if (e.fill?.strategy === "frontend" && !e.loadPage) throw TypeError("Vibe frontend fill requires loadPage.");
|
|
3305
3472
|
if (e.fill?.strategy === "backend" && e.fill.initialSession && !e.initialPage) throw TypeError("Vibe backend fill restoration requires initialPage.");
|
|
3306
3473
|
}
|
|
3307
|
-
function
|
|
3474
|
+
function er(e) {
|
|
3308
3475
|
if (typeof e != "string") return e;
|
|
3309
3476
|
if (typeof document > "u") throw Error("Vibe cannot resolve a selector without a document.");
|
|
3310
3477
|
let t = document.querySelector(e);
|
|
@@ -3313,7 +3480,7 @@ function Gn(e) {
|
|
|
3313
3480
|
}
|
|
3314
3481
|
//#endregion
|
|
3315
3482
|
//#region src/core/pageRequest.ts
|
|
3316
|
-
async function
|
|
3483
|
+
async function tr({ append: e, autofillController: t, cursor: n, isCurrent: r, loadPage: i, onLastCursor: a, onPages: o, options: s, signal: c, state: l }) {
|
|
3317
3484
|
let u = s.autofill, d = e && u?.strategy === "frontend" && (l.autofill.status === "paused" || l.autofill.status === "error"), f = d ? {
|
|
3318
3485
|
received: l.autofill.received,
|
|
3319
3486
|
requests: l.autofill.requests
|
|
@@ -3325,11 +3492,11 @@ async function Kn({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3325
3492
|
let m = !1;
|
|
3326
3493
|
try {
|
|
3327
3494
|
if (u?.strategy === "frontend") {
|
|
3328
|
-
let s = await
|
|
3495
|
+
let s = await pn({
|
|
3329
3496
|
existingItems: e ? l.items : [],
|
|
3330
3497
|
initialCursor: n,
|
|
3331
3498
|
loadPage: i,
|
|
3332
|
-
maximumRequests: f ? Math.max(0,
|
|
3499
|
+
maximumRequests: f ? Math.max(0, an(u) - f.requests) : void 0,
|
|
3333
3500
|
onCollection: (e) => t.captureCollection(e, r()),
|
|
3334
3501
|
onDelayChange: (e) => {
|
|
3335
3502
|
r() && Object.assign(l.autofill, e);
|
|
@@ -3344,7 +3511,7 @@ async function Kn({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3344
3511
|
signal: c
|
|
3345
3512
|
});
|
|
3346
3513
|
if (!r()) return;
|
|
3347
|
-
l.items = e ?
|
|
3514
|
+
l.items = e ? Q(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, {
|
|
3348
3515
|
missing: s.missing,
|
|
3349
3516
|
received: s.received,
|
|
3350
3517
|
requests: s.requests,
|
|
@@ -3352,12 +3519,12 @@ async function Kn({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3352
3519
|
}), o(s.pages), t.clearCollection();
|
|
3353
3520
|
return;
|
|
3354
3521
|
}
|
|
3355
|
-
let s =
|
|
3522
|
+
let s = Ut(await i({
|
|
3356
3523
|
cursor: n,
|
|
3357
3524
|
signal: c
|
|
3358
3525
|
}));
|
|
3359
3526
|
if (!r()) return;
|
|
3360
|
-
let d = e ? l.items : [], h =
|
|
3527
|
+
let d = e ? l.items : [], h = Q(d, s.items), g = h.length - d.length;
|
|
3361
3528
|
if (l.items = h, a(n), o([{
|
|
3362
3529
|
contributionIds: h.slice(d.length).map(({ postId: e }) => e),
|
|
3363
3530
|
cursor: n,
|
|
@@ -3372,7 +3539,7 @@ async function Kn({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3372
3539
|
l.autofill.status = "complete";
|
|
3373
3540
|
return;
|
|
3374
3541
|
}
|
|
3375
|
-
await
|
|
3542
|
+
await xn(u, l, {
|
|
3376
3543
|
cycleId: p,
|
|
3377
3544
|
feedKey: u.feedKey,
|
|
3378
3545
|
items: h.slice(d.length),
|
|
@@ -3394,16 +3561,16 @@ async function Kn({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3394
3561
|
}
|
|
3395
3562
|
//#endregion
|
|
3396
3563
|
//#region src/core/removalReconciliationController.ts
|
|
3397
|
-
function
|
|
3564
|
+
function nr(e) {
|
|
3398
3565
|
return `${typeof e}:${String(e)}`;
|
|
3399
3566
|
}
|
|
3400
|
-
function
|
|
3567
|
+
function rr(e) {
|
|
3401
3568
|
return `${typeof e}:${String(e)}`;
|
|
3402
3569
|
}
|
|
3403
|
-
function
|
|
3570
|
+
function ir(e) {
|
|
3404
3571
|
return e.map(({ postId: e }) => e);
|
|
3405
3572
|
}
|
|
3406
|
-
var
|
|
3573
|
+
var ar = class {
|
|
3407
3574
|
delay;
|
|
3408
3575
|
enabled;
|
|
3409
3576
|
maxReplayPages;
|
|
@@ -3422,7 +3589,7 @@ var Yn = class {
|
|
|
3422
3589
|
e.status === "complete" && (this.pages = [...this.pages.slice(0, e.replaceFrom), ...e.pages].slice(-this.maxReplayPages), this.pending = null);
|
|
3423
3590
|
}
|
|
3424
3591
|
filterItems(e) {
|
|
3425
|
-
return
|
|
3592
|
+
return this.tombstones.size === 0 ? [...e] : e.filter(({ postId: e }) => !this.tombstones.has(nr(e)));
|
|
3426
3593
|
}
|
|
3427
3594
|
needsReconciliation(e) {
|
|
3428
3595
|
return this.pending !== null || this.findUnderfilledPage(e) >= 0;
|
|
@@ -3435,45 +3602,45 @@ var Yn = class {
|
|
|
3435
3602
|
}
|
|
3436
3603
|
recordInitialPage(e) {
|
|
3437
3604
|
e && this.recordPages([{
|
|
3438
|
-
contributionIds:
|
|
3439
|
-
cursor: e
|
|
3605
|
+
contributionIds: ir(e.items),
|
|
3606
|
+
cursor: qt(e),
|
|
3440
3607
|
next: e.next,
|
|
3441
|
-
returnedIds:
|
|
3608
|
+
returnedIds: ir(e.items)
|
|
3442
3609
|
}]);
|
|
3443
3610
|
}
|
|
3444
3611
|
remove(e) {
|
|
3445
|
-
|
|
3612
|
+
e.forEach((e) => this.tombstones.add(nr(e)));
|
|
3446
3613
|
}
|
|
3447
3614
|
reset() {
|
|
3448
3615
|
this.pages = [], this.pending = null, this.tombstones.clear();
|
|
3449
3616
|
}
|
|
3450
3617
|
restore(e) {
|
|
3451
|
-
|
|
3618
|
+
e.forEach((e) => this.tombstones.delete(nr(e)));
|
|
3452
3619
|
}
|
|
3453
3620
|
async reconcile({ existingItems: e, loadPage: t, onDelayChange: n = () => void 0, shouldPause: r = () => !1, signal: i }) {
|
|
3454
3621
|
let a = this.pending ?? this.createSession(e);
|
|
3455
3622
|
for (this.pending = a; a.remainingRequests > 0;) {
|
|
3456
|
-
let e =
|
|
3623
|
+
let e = rr(a.cursor);
|
|
3457
3624
|
if (a.seenCursors.has(e)) throw Error("Vibe removal reconciliation received a repeated cursor.");
|
|
3458
|
-
if (await
|
|
3459
|
-
delayMs:
|
|
3625
|
+
if (await nn({
|
|
3626
|
+
delayMs: tn(a.pages.length, this.delay),
|
|
3460
3627
|
onChange: n,
|
|
3461
3628
|
signal: i
|
|
3462
3629
|
}), a.pages.length > 0 && r()) return this.result(a, "paused");
|
|
3463
|
-
let o =
|
|
3630
|
+
let o = Ut(await t({
|
|
3464
3631
|
cursor: a.cursor,
|
|
3465
3632
|
signal: i
|
|
3466
3633
|
}));
|
|
3467
3634
|
a.seenCursors.add(e);
|
|
3468
3635
|
let s = this.filterItems(o.items), c = [];
|
|
3469
3636
|
if (s.forEach((e) => {
|
|
3470
|
-
let t =
|
|
3637
|
+
let t = nr(e.postId);
|
|
3471
3638
|
a.attributed.has(t) || (a.attributed.add(t), c.push(e.postId)), a.appended.has(t) || (a.appended.add(t), a.items.push(e));
|
|
3472
3639
|
}), a.pages.push({
|
|
3473
3640
|
contributionIds: c,
|
|
3474
3641
|
cursor: a.cursor,
|
|
3475
3642
|
next: o.next,
|
|
3476
|
-
returnedIds:
|
|
3643
|
+
returnedIds: ir(s)
|
|
3477
3644
|
}), 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");
|
|
3478
3645
|
}
|
|
3479
3646
|
return this.result(a, "complete");
|
|
@@ -3481,9 +3648,9 @@ var Yn = class {
|
|
|
3481
3648
|
createSession(e) {
|
|
3482
3649
|
let t = this.findUnderfilledPage(e), n = t < 0 ? [] : this.pages.slice(t), r = n[0];
|
|
3483
3650
|
if (!r) throw Error("Vibe has no underfilled provider page to reconcile.");
|
|
3484
|
-
let i = new Set(n.flatMap(({ contributionIds: e }) => e.map(
|
|
3651
|
+
let i = new Set(n.flatMap(({ contributionIds: e }) => e.map(nr))), a = new Set(e.map(({ postId: e }) => nr(e)).filter((e) => !i.has(e)));
|
|
3485
3652
|
return {
|
|
3486
|
-
appended: new Set(e.map(({ postId: e }) =>
|
|
3653
|
+
appended: new Set(e.map(({ postId: e }) => nr(e))),
|
|
3487
3654
|
attributed: new Set(a),
|
|
3488
3655
|
cursor: r.cursor,
|
|
3489
3656
|
items: [],
|
|
@@ -3508,11 +3675,11 @@ var Yn = class {
|
|
|
3508
3675
|
}
|
|
3509
3676
|
findUnderfilledPage(e) {
|
|
3510
3677
|
if (!this.enabled || this.pages.length === 0) return -1;
|
|
3511
|
-
let t = new Set(e.map(({ postId: e }) =>
|
|
3512
|
-
return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has(
|
|
3678
|
+
let t = new Set(e.map(({ postId: e }) => nr(e)));
|
|
3679
|
+
return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has(nr(e))).length < this.pageSize);
|
|
3513
3680
|
}
|
|
3514
3681
|
recordPage(e) {
|
|
3515
|
-
let t =
|
|
3682
|
+
let t = rr(e.cursor), n = this.pages.findIndex(({ cursor: e }) => rr(e) === t);
|
|
3516
3683
|
n >= 0 && (this.pages = this.pages.slice(0, n)), this.pages.push({
|
|
3517
3684
|
...e,
|
|
3518
3685
|
contributionIds: [...e.contributionIds],
|
|
@@ -3522,7 +3689,7 @@ var Yn = class {
|
|
|
3522
3689
|
};
|
|
3523
3690
|
//#endregion
|
|
3524
3691
|
//#region src/core/activeItemRemoval.ts
|
|
3525
|
-
function
|
|
3692
|
+
function or(e, t, n, r, i) {
|
|
3526
3693
|
let a = new Set(t.map(({ item: e }) => e.postId));
|
|
3527
3694
|
if (e.activeReelPostId === null || !a.has(e.activeReelPostId)) return;
|
|
3528
3695
|
let o = e.items[Math.max(n, 0)];
|
|
@@ -3535,7 +3702,7 @@ function Xn(e, t, n, r, i) {
|
|
|
3535
3702
|
}
|
|
3536
3703
|
//#endregion
|
|
3537
3704
|
//#region src/core/exactMediaRemovalController.ts
|
|
3538
|
-
function
|
|
3705
|
+
function sr(e, t) {
|
|
3539
3706
|
let [n, ...r] = t;
|
|
3540
3707
|
if (!n) throw Error("Vibe items must contain at least one media asset.");
|
|
3541
3708
|
return {
|
|
@@ -3544,10 +3711,10 @@ function Zn(e, t) {
|
|
|
3544
3711
|
items: r
|
|
3545
3712
|
};
|
|
3546
3713
|
}
|
|
3547
|
-
function
|
|
3714
|
+
function cr(e) {
|
|
3548
3715
|
if (!Number.isInteger(e.mediaIndex) || e.mediaIndex < 0) throw TypeError("Vibe mediaIndex must be a non-negative integer.");
|
|
3549
3716
|
}
|
|
3550
|
-
var
|
|
3717
|
+
var lr = class {
|
|
3551
3718
|
generation = 0;
|
|
3552
3719
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
3553
3720
|
state;
|
|
@@ -3555,7 +3722,7 @@ var $n = class {
|
|
|
3555
3722
|
this.options = e, this.state = e.state;
|
|
3556
3723
|
}
|
|
3557
3724
|
remove(e) {
|
|
3558
|
-
|
|
3725
|
+
cr(e);
|
|
3559
3726
|
let t = this.state.items.findIndex(({ postId: t }) => t === e.postId), n = this.state.items[t];
|
|
3560
3727
|
if (!n) return null;
|
|
3561
3728
|
let r = [...M(n)], i = r[e.mediaIndex];
|
|
@@ -3572,7 +3739,7 @@ var $n = class {
|
|
|
3572
3739
|
restored: !1
|
|
3573
3740
|
});
|
|
3574
3741
|
let o = this.state.mediaIndices.get(n.postId) ?? 0, s = this.isReelOpen() && this.state.activeReelPostId === n.postId, c = s && o === e.mediaIndex;
|
|
3575
|
-
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] =
|
|
3742
|
+
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = sr(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);
|
|
3576
3743
|
}
|
|
3577
3744
|
reset() {
|
|
3578
3745
|
this.generation += 1;
|
|
@@ -3598,7 +3765,7 @@ var $n = class {
|
|
|
3598
3765
|
}
|
|
3599
3766
|
restoreIntoPost(e, t) {
|
|
3600
3767
|
let n = this.state.items[e], r = [...M(n)], i = Math.min(t.mediaIndex, r.length);
|
|
3601
|
-
if (r.splice(i, 0, t.media), this.state.items[e] =
|
|
3768
|
+
if (r.splice(i, 0, t.media), this.state.items[e] = sr(n, r), this.state.activeReelPostId !== t.postId) return;
|
|
3602
3769
|
let a = this.state.mediaIndices.get(t.postId) ?? 0;
|
|
3603
3770
|
a >= i && this.state.mediaIndices.set(t.postId, a + 1);
|
|
3604
3771
|
}
|
|
@@ -3611,18 +3778,18 @@ var $n = class {
|
|
|
3611
3778
|
};
|
|
3612
3779
|
//#endregion
|
|
3613
3780
|
//#region src/core/itemPlacement.ts
|
|
3614
|
-
function
|
|
3781
|
+
function ur(e, t) {
|
|
3615
3782
|
let n = new Set(t);
|
|
3616
3783
|
return e.flatMap((e, t) => n.has(e.postId) ? [{
|
|
3617
3784
|
index: t,
|
|
3618
3785
|
item: e
|
|
3619
3786
|
}] : []);
|
|
3620
3787
|
}
|
|
3621
|
-
function
|
|
3788
|
+
function dr(e, t) {
|
|
3622
3789
|
let n = new Set(t.map(({ item: e }) => e.postId));
|
|
3623
3790
|
return e.filter((e) => !n.has(e.postId));
|
|
3624
3791
|
}
|
|
3625
|
-
function
|
|
3792
|
+
function fr(e, t) {
|
|
3626
3793
|
t.forEach(({ index: e }) => {
|
|
3627
3794
|
if (!Number.isInteger(e) || e < 0) throw Error("Vibe item restore indexes must be non-negative integers.");
|
|
3628
3795
|
});
|
|
@@ -3633,7 +3800,7 @@ function nr(e, t) {
|
|
|
3633
3800
|
}
|
|
3634
3801
|
//#endregion
|
|
3635
3802
|
//#region src/core/itemRemovalController.ts
|
|
3636
|
-
var
|
|
3803
|
+
var pr = 20, mr = class {
|
|
3637
3804
|
generation = 0;
|
|
3638
3805
|
historyLimit;
|
|
3639
3806
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
@@ -3642,7 +3809,7 @@ var rr = 20, ir = class {
|
|
|
3642
3809
|
itemOrder;
|
|
3643
3810
|
stopItemsWatcher;
|
|
3644
3811
|
constructor(e) {
|
|
3645
|
-
this.options = e, this.historyLimit = e.historyLimit ??
|
|
3812
|
+
this.options = e, this.historyLimit = e.historyLimit ?? pr, 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" });
|
|
3646
3813
|
}
|
|
3647
3814
|
destroy() {
|
|
3648
3815
|
this.reset(), this.stopItemsWatcher();
|
|
@@ -3656,7 +3823,7 @@ var rr = 20, ir = class {
|
|
|
3656
3823
|
let a = this.options.startRemoval(i, t);
|
|
3657
3824
|
if (a > 0 && await new Promise((e) => setTimeout(e, a)), this.metadata.get(r)?.generation !== this.generation) return r;
|
|
3658
3825
|
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);
|
|
3659
|
-
return this.state.items =
|
|
3826
|
+
return this.state.items = dr(this.state.items, n), this.options.onItemsRemoved(r, n, l), this.record(r), r;
|
|
3660
3827
|
}
|
|
3661
3828
|
reset() {
|
|
3662
3829
|
this.generation += 1, this.history = [], this.itemOrder = [];
|
|
@@ -3667,7 +3834,7 @@ var rr = 20, ir = class {
|
|
|
3667
3834
|
this.restoreRemoval(t);
|
|
3668
3835
|
return;
|
|
3669
3836
|
}
|
|
3670
|
-
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 =
|
|
3837
|
+
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 = fr(this.state.items, r);
|
|
3671
3838
|
this.registerExternalPlacements(r), this.state.items = i, r.length > 0 && this.options.onRemovalRestored(r);
|
|
3672
3839
|
}
|
|
3673
3840
|
restoreRemoval(e) {
|
|
@@ -3693,7 +3860,7 @@ var rr = 20, ir = class {
|
|
|
3693
3860
|
}
|
|
3694
3861
|
collectOrderedPlacements(e) {
|
|
3695
3862
|
let t = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
3696
|
-
return
|
|
3863
|
+
return ur(this.state.items, e).map((e) => ({
|
|
3697
3864
|
index: t.get(e.item.postId) ?? e.index,
|
|
3698
3865
|
item: e.item
|
|
3699
3866
|
}));
|
|
@@ -3724,7 +3891,7 @@ var rr = 20, ir = class {
|
|
|
3724
3891
|
let r = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
3725
3892
|
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;
|
|
3726
3893
|
}
|
|
3727
|
-
},
|
|
3894
|
+
}, hr = class {
|
|
3728
3895
|
forward = null;
|
|
3729
3896
|
forwardPromise = null;
|
|
3730
3897
|
forwardVersion = 0;
|
|
@@ -3811,7 +3978,7 @@ var rr = 20, ir = class {
|
|
|
3811
3978
|
}
|
|
3812
3979
|
}
|
|
3813
3980
|
}
|
|
3814
|
-
},
|
|
3981
|
+
}, gr = class {
|
|
3815
3982
|
generation = 0;
|
|
3816
3983
|
pending = Promise.resolve();
|
|
3817
3984
|
constructor(e) {
|
|
@@ -3861,24 +4028,24 @@ var rr = 20, ir = class {
|
|
|
3861
4028
|
};
|
|
3862
4029
|
//#endregion
|
|
3863
4030
|
//#region src/core/removalControllers.ts
|
|
3864
|
-
function
|
|
3865
|
-
let t = new
|
|
4031
|
+
function _r(e) {
|
|
4032
|
+
let t = new hr(e), n = new gr({
|
|
3866
4033
|
state: e.state,
|
|
3867
4034
|
transitionMedia: (t) => e.surface()?.transitionActiveReelMedia(t) ?? Promise.resolve(!1),
|
|
3868
4035
|
transitionPost: (t) => e.surface()?.transitionActiveReelPost(t) ?? Promise.resolve(!1)
|
|
3869
4036
|
});
|
|
3870
4037
|
return {
|
|
3871
|
-
exactMediaRemoval: new
|
|
4038
|
+
exactMediaRemoval: new lr({
|
|
3872
4039
|
onActivate: e.onActivate,
|
|
3873
4040
|
onPostRemoved: (t) => e.onItemsRemoved([t]),
|
|
3874
4041
|
onPostRestored: (t) => e.onItemsRestored([t]),
|
|
3875
4042
|
reelForward: t,
|
|
3876
4043
|
state: e.state
|
|
3877
4044
|
}),
|
|
3878
|
-
itemRemoval: new
|
|
4045
|
+
itemRemoval: new mr({
|
|
3879
4046
|
historyLimit: e.historyLimit,
|
|
3880
4047
|
onItemsRemoved: (n, r, i) => {
|
|
3881
|
-
e.onItemsRemoved(r.map(({ item: e }) => e.postId)),
|
|
4048
|
+
e.onItemsRemoved(r.map(({ item: e }) => e.postId)), or(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
|
|
3882
4049
|
},
|
|
3883
4050
|
onRemovalRestored: (n) => {
|
|
3884
4051
|
e.onItemsRestored(n.map(({ item: e }) => e.postId));
|
|
@@ -3893,17 +4060,17 @@ function sr(e) {
|
|
|
3893
4060
|
reelRemoval: n
|
|
3894
4061
|
};
|
|
3895
4062
|
}
|
|
3896
|
-
var
|
|
3897
|
-
function
|
|
4063
|
+
var vr = 1.5;
|
|
4064
|
+
function yr(e) {
|
|
3898
4065
|
let t = Math.min(e.screenWidth, e.screenHeight);
|
|
3899
4066
|
if (t > 0 && t < 600) return !0;
|
|
3900
|
-
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n *
|
|
4067
|
+
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * vr;
|
|
3901
4068
|
return !e.hasHover && n > 0 && n < 600 && r;
|
|
3902
4069
|
}
|
|
3903
|
-
function
|
|
3904
|
-
return
|
|
4070
|
+
function br(e) {
|
|
4071
|
+
return yr(e) ? "reel" : "masonry";
|
|
3905
4072
|
}
|
|
3906
|
-
function
|
|
4073
|
+
function xr(e) {
|
|
3907
4074
|
let t = e.ownerDocument.defaultView, n = e.ownerDocument.documentElement;
|
|
3908
4075
|
return {
|
|
3909
4076
|
hasHover: typeof t?.matchMedia == "function" && t.matchMedia("(hover: hover)").matches,
|
|
@@ -3913,15 +4080,15 @@ function dr(e) {
|
|
|
3913
4080
|
viewportWidth: n.clientWidth
|
|
3914
4081
|
};
|
|
3915
4082
|
}
|
|
3916
|
-
function
|
|
3917
|
-
return
|
|
4083
|
+
function Sr(e) {
|
|
4084
|
+
return yr(xr(e));
|
|
3918
4085
|
}
|
|
3919
|
-
function
|
|
3920
|
-
return
|
|
4086
|
+
function Cr(e) {
|
|
4087
|
+
return br(xr(e));
|
|
3921
4088
|
}
|
|
3922
4089
|
//#endregion
|
|
3923
4090
|
//#region src/core/responsiveLayoutController.ts
|
|
3924
|
-
var
|
|
4091
|
+
var wr = class {
|
|
3925
4092
|
layoutMode;
|
|
3926
4093
|
resizeObserver = null;
|
|
3927
4094
|
target = null;
|
|
@@ -3946,10 +4113,10 @@ var mr = class {
|
|
|
3946
4113
|
}
|
|
3947
4114
|
handleResponsiveLayout = () => {
|
|
3948
4115
|
if (!this.target) return;
|
|
3949
|
-
let e =
|
|
3950
|
-
this.state.phoneMode =
|
|
4116
|
+
let e = Cr(this.target);
|
|
4117
|
+
this.state.phoneMode = Sr(this.target), this.state.reelInfoSheetOverlay = this.state.phoneMode, this.state.reelMediaSource = e === "reel" ? "preview" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
|
|
3951
4118
|
};
|
|
3952
|
-
},
|
|
4119
|
+
}, Tr = class {
|
|
3953
4120
|
routedReelPostId = null;
|
|
3954
4121
|
reelRouteIsActive = !1;
|
|
3955
4122
|
constructor(e, t) {
|
|
@@ -3976,13 +4143,14 @@ var mr = class {
|
|
|
3976
4143
|
let i = this.reelRouteIsActive ? "replace" : "push";
|
|
3977
4144
|
this.reelRouteIsActive = !0, this.routedReelPostId = e, this.options.router[i](r);
|
|
3978
4145
|
}
|
|
3979
|
-
},
|
|
4146
|
+
}, Er = class {
|
|
3980
4147
|
app = null;
|
|
3981
4148
|
autoScroll;
|
|
3982
4149
|
autofillController;
|
|
3983
4150
|
abortController = null;
|
|
3984
4151
|
pendingRequest = null;
|
|
3985
4152
|
requestVersion = 0;
|
|
4153
|
+
restoreController = null;
|
|
3986
4154
|
responsiveLayout;
|
|
3987
4155
|
routing;
|
|
3988
4156
|
fillController;
|
|
@@ -3997,24 +4165,24 @@ var mr = class {
|
|
|
3997
4165
|
notificationItems;
|
|
3998
4166
|
state;
|
|
3999
4167
|
constructor(e) {
|
|
4000
|
-
this.options = e,
|
|
4168
|
+
this.options = e, $n(e);
|
|
4001
4169
|
let t = e.layout ?? "masonry";
|
|
4002
|
-
this.state = x(
|
|
4170
|
+
this.state = x(Xn(e, t)), this.lastLoadedCursor = e.initialPage ? qt(e.initialPage) : null, this.notificationItems = I(this.state), this.autoScroll = new bn({
|
|
4003
4171
|
getScrollElement: () => this.surface?.getAutoScrollElement() ?? null,
|
|
4004
4172
|
state: this.state.autoScroll
|
|
4005
|
-
}), this.autofillController = new
|
|
4173
|
+
}), this.autofillController = new mn({
|
|
4006
4174
|
cancelRequest: () => this.cancelRequest(),
|
|
4007
4175
|
onLastCursor: (e) => this.setCurrentCursor(e),
|
|
4008
4176
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
4009
4177
|
options: e.autofill,
|
|
4010
4178
|
state: this.state
|
|
4011
|
-
}), this.removalReconciliation = new
|
|
4179
|
+
}), this.removalReconciliation = new ar(e), this.removalReconciliation.recordInitialPage(e.initialPage), this.fillController = new Vn({
|
|
4012
4180
|
fill: e.fill,
|
|
4013
4181
|
loadPage: e.loadPage ? (e) => this.loadFilteredPage(e) : void 0,
|
|
4014
4182
|
needsFrontendPreparation: () => this.removalReconciliation.needsReconciliation(this.state.items),
|
|
4015
4183
|
onLastCursor: (e) => this.setCurrentCursor(e),
|
|
4016
4184
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
4017
|
-
prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) =>
|
|
4185
|
+
prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) => Hn({
|
|
4018
4186
|
controller: this.removalReconciliation,
|
|
4019
4187
|
isCurrent: t,
|
|
4020
4188
|
loadPage: e.loadPage,
|
|
@@ -4024,8 +4192,8 @@ var mr = class {
|
|
|
4024
4192
|
state: this.state
|
|
4025
4193
|
}),
|
|
4026
4194
|
state: this.state
|
|
4027
|
-
}), this.routing = new
|
|
4028
|
-
let n =
|
|
4195
|
+
}), this.routing = new Tr(e.routing, this.state);
|
|
4196
|
+
let n = _r({
|
|
4029
4197
|
historyLimit: e.removalHistoryLimit,
|
|
4030
4198
|
onActivate: (e) => this.setActiveReelPost(e),
|
|
4031
4199
|
onItemsRemoved: (e) => this.removalReconciliation.remove(e),
|
|
@@ -4034,20 +4202,20 @@ var mr = class {
|
|
|
4034
4202
|
state: this.state,
|
|
4035
4203
|
surface: () => this.surface
|
|
4036
4204
|
});
|
|
4037
|
-
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new
|
|
4205
|
+
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new wr(t, this.state, () => {
|
|
4038
4206
|
this.routing.syncFeed();
|
|
4039
4207
|
}), this.startStateNotifications();
|
|
4040
4208
|
}
|
|
4041
4209
|
async mount() {
|
|
4042
4210
|
if (this.app) throw Error("Vibe is already mounted.");
|
|
4043
4211
|
this.startStateNotifications();
|
|
4044
|
-
let e =
|
|
4045
|
-
this.responsiveLayout.mount(e), this.app = i(
|
|
4212
|
+
let e = er(this.options.target);
|
|
4213
|
+
this.responsiveLayout.mount(e), this.app = i(Ht, {
|
|
4046
4214
|
canRetryEnd: !!this.options.loadPage,
|
|
4047
4215
|
cardFooter: this.options.cardFooter,
|
|
4048
4216
|
cardHeader: this.options.cardHeader,
|
|
4049
4217
|
feedFooter: this.options.feedFooter,
|
|
4050
|
-
feedFooterActions:
|
|
4218
|
+
feedFooterActions: Un(this),
|
|
4051
4219
|
mediaCard: this.options.mediaCard,
|
|
4052
4220
|
masonry: this.options.masonry,
|
|
4053
4221
|
onMediaReady: this.options.onMediaReady,
|
|
@@ -4070,10 +4238,12 @@ var mr = class {
|
|
|
4070
4238
|
onRetryForward: () => {
|
|
4071
4239
|
this.retryReelForward();
|
|
4072
4240
|
}
|
|
4073
|
-
}), this.surface = this.app.mount(e), this.autoScroll.mount(),
|
|
4241
|
+
}), this.surface = this.app.mount(e), this.autoScroll.mount(), await Tn(this.options.restoreBacklog, (e) => this.appendPage(e), (e) => {
|
|
4242
|
+
this.restoreController = e;
|
|
4243
|
+
}), !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();
|
|
4074
4244
|
}
|
|
4075
4245
|
destroy() {
|
|
4076
|
-
this.autoScroll.destroy(), this.fillController.destroy(), this.cancelRequest(), this.reelForward.reset(), this.reelRemoval.reset(), this.exactMediaRemoval.reset(), this.itemRemoval.destroy(), this.removalReconciliation.reset(), this.responsiveLayout.destroy(), this.stopStateWatcher?.(), this.stopStateWatcher = null, this.app?.unmount(), this.app = null, this.surface = null;
|
|
4246
|
+
this.restoreController?.abort(), this.restoreController = null, this.autoScroll.destroy(), this.fillController.destroy(), this.cancelRequest(), this.reelForward.reset(), this.reelRemoval.reset(), this.exactMediaRemoval.reset(), this.itemRemoval.destroy(), this.removalReconciliation.reset(), this.responsiveLayout.destroy(), this.stopStateWatcher?.(), this.stopStateWatcher = null, this.app?.unmount(), this.app = null, this.surface = null;
|
|
4077
4247
|
}
|
|
4078
4248
|
getState() {
|
|
4079
4249
|
return L(this.state);
|
|
@@ -4099,6 +4269,9 @@ var mr = class {
|
|
|
4099
4269
|
retryReelForward() {
|
|
4100
4270
|
return this.reelForward.retry();
|
|
4101
4271
|
}
|
|
4272
|
+
retryFill() {
|
|
4273
|
+
return this.fillController.retry(this.removalReconciliation.hasPendingSession());
|
|
4274
|
+
}
|
|
4102
4275
|
undoLastRemoval() {
|
|
4103
4276
|
return this.itemRemoval.undoLast();
|
|
4104
4277
|
}
|
|
@@ -4130,7 +4303,7 @@ var mr = class {
|
|
|
4130
4303
|
this.autoScroll.setSpeed(e);
|
|
4131
4304
|
}
|
|
4132
4305
|
applyAutofillUpdate(e) {
|
|
4133
|
-
let t =
|
|
4306
|
+
let t = Cn(this.options.autofill, this.state, e);
|
|
4134
4307
|
return t && this.autofillController.syncCountdown(), t;
|
|
4135
4308
|
}
|
|
4136
4309
|
cancelAutofill() {
|
|
@@ -4141,7 +4314,7 @@ var mr = class {
|
|
|
4141
4314
|
await this.cancelFill();
|
|
4142
4315
|
return;
|
|
4143
4316
|
}
|
|
4144
|
-
if (
|
|
4317
|
+
if (un(this.state.autofill)) {
|
|
4145
4318
|
await this.cancelAutofill();
|
|
4146
4319
|
return;
|
|
4147
4320
|
}
|
|
@@ -4155,12 +4328,12 @@ var mr = class {
|
|
|
4155
4328
|
}
|
|
4156
4329
|
async fill(e) {
|
|
4157
4330
|
if (!this.state.loadMoreLocked) {
|
|
4158
|
-
if (this.pendingRequest ||
|
|
4331
|
+
if (this.pendingRequest || un(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
|
|
4159
4332
|
await this.fillController.start(e);
|
|
4160
4333
|
}
|
|
4161
4334
|
}
|
|
4162
4335
|
restoreAutofillSession(e) {
|
|
4163
|
-
let t =
|
|
4336
|
+
let t = wn(this.options.autofill, this.state, e);
|
|
4164
4337
|
return t && this.autofillController.syncCountdown(), t;
|
|
4165
4338
|
}
|
|
4166
4339
|
restoreFillSession(e) {
|
|
@@ -4169,12 +4342,15 @@ var mr = class {
|
|
|
4169
4342
|
loadNext() {
|
|
4170
4343
|
return this.startLoadMore(() => this.loadNextSequence());
|
|
4171
4344
|
}
|
|
4345
|
+
appendPage(e) {
|
|
4346
|
+
Jt(e, this.state, this.removalReconciliation, (e) => this.setCurrentCursor(e));
|
|
4347
|
+
}
|
|
4172
4348
|
replenishAfterRemoval() {
|
|
4173
4349
|
return this.startLoadMore(() => this.replenishAfterRemovalSequence());
|
|
4174
4350
|
}
|
|
4175
4351
|
async startLoadMore(e) {
|
|
4176
4352
|
if (this.pendingRequest) return this.pendingRequest;
|
|
4177
|
-
if (this.state.loadMoreLocked ||
|
|
4353
|
+
if (this.state.loadMoreLocked || un(this.state.autofill) || this.fillController.isActive() || !this.options.loadPage || this.state.next === null && !this.removalReconciliation.needsReconciliation(this.state.items)) return;
|
|
4178
4354
|
this.state.isLoadingMore = !0, this.state.nextPageError = null;
|
|
4179
4355
|
let t = e();
|
|
4180
4356
|
return this.pendingRequest = t, t.finally(() => {
|
|
@@ -4189,12 +4365,12 @@ var mr = class {
|
|
|
4189
4365
|
}
|
|
4190
4366
|
async replaceFeed(e, t) {
|
|
4191
4367
|
if (!this.options.loadPage) throw Error(`Vibe cannot ${t} without loadPage.`);
|
|
4192
|
-
return
|
|
4368
|
+
return un(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.state.autofill = ln(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);
|
|
4193
4369
|
}
|
|
4194
4370
|
async loadFilteredPage(e) {
|
|
4195
4371
|
let t = this.options.loadPage;
|
|
4196
4372
|
if (!t) throw Error("Vibe cannot load a page without loadPage.");
|
|
4197
|
-
let n =
|
|
4373
|
+
let n = Ut(await t(e));
|
|
4198
4374
|
return {
|
|
4199
4375
|
...n,
|
|
4200
4376
|
items: this.removalReconciliation.filterItems(n.items)
|
|
@@ -4213,7 +4389,7 @@ var mr = class {
|
|
|
4213
4389
|
let t = ++this.requestVersion, n = new AbortController();
|
|
4214
4390
|
this.abortController = n;
|
|
4215
4391
|
try {
|
|
4216
|
-
let r = await
|
|
4392
|
+
let r = await Hn({
|
|
4217
4393
|
controller: this.removalReconciliation,
|
|
4218
4394
|
isCurrent: () => t === this.requestVersion,
|
|
4219
4395
|
loadPage: e,
|
|
@@ -4231,7 +4407,7 @@ var mr = class {
|
|
|
4231
4407
|
}
|
|
4232
4408
|
async retryEnd() {
|
|
4233
4409
|
if (this.pendingRequest) return this.pendingRequest;
|
|
4234
|
-
if (!this.state.loadMoreLocked && !(
|
|
4410
|
+
if (!this.state.loadMoreLocked && !(un(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);
|
|
4235
4411
|
}
|
|
4236
4412
|
setInfiniteScroll(e) {
|
|
4237
4413
|
this.state.infiniteScroll = e, e && m(() => this.surface?.loadIfNearBottom());
|
|
@@ -4255,10 +4431,10 @@ var mr = class {
|
|
|
4255
4431
|
this.state.total = e;
|
|
4256
4432
|
}
|
|
4257
4433
|
setReelAutoAdvance(e) {
|
|
4258
|
-
|
|
4434
|
+
qn(this.state.reelAutoAdvance, e);
|
|
4259
4435
|
}
|
|
4260
4436
|
setReelInfoSheet(e) {
|
|
4261
|
-
|
|
4437
|
+
Yn(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
|
|
4262
4438
|
}
|
|
4263
4439
|
setLayout(e) {
|
|
4264
4440
|
this.responsiveLayout.setLayout(e);
|
|
@@ -4278,7 +4454,7 @@ var mr = class {
|
|
|
4278
4454
|
async fetchPage(e, t) {
|
|
4279
4455
|
if (!this.options.loadPage) return;
|
|
4280
4456
|
let n = ++this.requestVersion, r = new AbortController();
|
|
4281
|
-
this.abortController = r, await
|
|
4457
|
+
this.abortController = r, await tr({
|
|
4282
4458
|
append: t,
|
|
4283
4459
|
autofillController: this.autofillController,
|
|
4284
4460
|
cursor: e,
|
|
@@ -4300,7 +4476,7 @@ var mr = class {
|
|
|
4300
4476
|
startInitialAutofill() {
|
|
4301
4477
|
let e = ++this.requestVersion, t = new AbortController(), n = this.autofillController.beginCycle();
|
|
4302
4478
|
this.abortController = t, this.state.isLoadingMore = !0;
|
|
4303
|
-
let r =
|
|
4479
|
+
let r = En({
|
|
4304
4480
|
cycleId: n,
|
|
4305
4481
|
isCurrent: () => e === this.requestVersion,
|
|
4306
4482
|
onCollection: (t) => this.autofillController.captureCollection(t, e === this.requestVersion),
|
|
@@ -4327,8 +4503,8 @@ var mr = class {
|
|
|
4327
4503
|
this.lastLoadedCursor = e, this.state.current = e;
|
|
4328
4504
|
}
|
|
4329
4505
|
};
|
|
4330
|
-
function
|
|
4331
|
-
return new
|
|
4506
|
+
function Dr(e) {
|
|
4507
|
+
return new Er(e);
|
|
4332
4508
|
}
|
|
4333
4509
|
//#endregion
|
|
4334
|
-
export {
|
|
4510
|
+
export { Dr as createVibe };
|