@wyxos/vibe 5.16.7 → 5.16.8
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/CardRegion.vue.d.ts +1 -1
- package/lib/components/MediaCard.vue.d.ts +1 -1
- package/lib/components/masonryItemStyleCache.d.ts +13 -0
- package/lib/components/scrollbarPlaybackMutation.d.ts +10 -0
- package/lib/index.cjs +2 -2
- package/lib/index.js +1110 -952
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { Fragment as e, Teleport as t, Transition as n, computed as r, createApp as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, guardReactiveProps as f, h as p, isReactive as m, isReadonly as h, isRef as g, isShallow as _, nextTick as v, normalizeClass as y, normalizeProps as b, normalizeStyle as x, onBeforeUnmount as S, onMounted as C, openBlock as w, reactive as T, renderList as E, resolveDynamicComponent as D, shallowReactive as O, shallowRef as k, toDisplayString as A, toRaw as j, unref as M, useId as
|
|
1
|
+
import { Fragment as e, Teleport as t, Transition as n, computed as r, createApp as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, guardReactiveProps as f, h as p, isReactive as m, isReadonly as h, isRef as g, isShallow as _, nextTick as v, normalizeClass as y, normalizeProps as b, normalizeStyle as x, onBeforeUnmount as S, onMounted as C, openBlock as w, reactive as T, renderList as E, resolveDynamicComponent as D, shallowReactive as O, shallowRef as k, toDisplayString as A, toRaw as j, unref as M, useId as ee, watch as N, withCtx as P, withKeys as F, withModifiers as I } from "vue";
|
|
2
2
|
//#region src/core/mediaType.ts
|
|
3
|
-
var
|
|
4
|
-
function
|
|
3
|
+
var L = /\.(aac|flac|m4a|mp3|oga|ogg|opus|wav)$/i, R = /\.(m4v|mkv|mov|mp4|ogv|webm)$/i;
|
|
4
|
+
function z(e) {
|
|
5
5
|
try {
|
|
6
6
|
return new URL(e).pathname;
|
|
7
7
|
} catch {
|
|
8
8
|
return e.split(/[?#]/)[0] ?? e;
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
let t =
|
|
13
|
-
return
|
|
11
|
+
function B(e) {
|
|
12
|
+
let t = z(e);
|
|
13
|
+
return L.test(t) ? "audio" : R.test(t) ? "video" : "image";
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
return e ??
|
|
15
|
+
function V(e, t) {
|
|
16
|
+
return e ?? B(t);
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
return
|
|
18
|
+
function H(e, t) {
|
|
19
|
+
return V(e, t) !== "image";
|
|
20
20
|
}
|
|
21
21
|
//#endregion
|
|
22
22
|
//#region src/core/mediaAsset.ts
|
|
23
|
-
function
|
|
23
|
+
function U(e) {
|
|
24
24
|
return {
|
|
25
25
|
height: e.height,
|
|
26
26
|
src: e.src,
|
|
@@ -28,9 +28,9 @@ function W(e) {
|
|
|
28
28
|
width: e.width
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function te(e, t) {
|
|
32
32
|
if (t === "preview" && e.preview) {
|
|
33
|
-
let t =
|
|
33
|
+
let t = V(e.type, e.src) === "audio" ? V(e.preview.type, e.preview.src) : e.preview.type ?? e.type;
|
|
34
34
|
return {
|
|
35
35
|
...e.preview,
|
|
36
36
|
type: t
|
|
@@ -39,66 +39,66 @@ function ee(e, t) {
|
|
|
39
39
|
return t === "mobile" && e.mobile ? {
|
|
40
40
|
...e.mobile,
|
|
41
41
|
type: e.mobile.type ?? e.type
|
|
42
|
-
} :
|
|
42
|
+
} : U(e);
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function W(e) {
|
|
45
45
|
let t = e.preview;
|
|
46
|
-
return !t?.src || t.src === e.src ||
|
|
46
|
+
return !t?.src || t.src === e.src || V(t.type, t.src) !== "image" ? null : {
|
|
47
47
|
...t,
|
|
48
48
|
type: "image"
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
|
-
function
|
|
52
|
-
return
|
|
51
|
+
function ne(e, t) {
|
|
52
|
+
return V(e.type, e.src) === "audio" ? t === "mobile" && e.mobile && V(e.mobile.type, e.mobile.src) === "audio" ? {
|
|
53
53
|
...e.mobile,
|
|
54
54
|
type: "audio"
|
|
55
55
|
} : {
|
|
56
|
-
...
|
|
56
|
+
...U(e),
|
|
57
57
|
type: "audio"
|
|
58
|
-
} :
|
|
58
|
+
} : te(e, t);
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function G(e) {
|
|
61
61
|
return [e, ...e.items];
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function K(e, t) {
|
|
64
64
|
return Math.min(e.items.length, Math.max(0, t));
|
|
65
65
|
}
|
|
66
|
-
function
|
|
67
|
-
return
|
|
66
|
+
function re(e, t) {
|
|
67
|
+
return G(e)[K(e, t)] ?? e;
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function q(e, t) {
|
|
70
70
|
return `${String(e)}:${t}`;
|
|
71
71
|
}
|
|
72
72
|
//#endregion
|
|
73
73
|
//#region src/core/itemIds.ts
|
|
74
|
-
var
|
|
75
|
-
function
|
|
74
|
+
var ie = /* @__PURE__ */ new WeakMap();
|
|
75
|
+
function J(e, t) {
|
|
76
76
|
let n = Reflect.get(e, "postId", t);
|
|
77
77
|
return typeof n == "string" || typeof n == "number" ? n : g(n) ? n.value : t.postId;
|
|
78
78
|
}
|
|
79
|
-
function
|
|
79
|
+
function Y(e) {
|
|
80
80
|
if (!m(e) || h(e) || _(e)) return e.map((e) => e.postId);
|
|
81
81
|
let t = j(e);
|
|
82
82
|
return T(t) === e ? t.map((e) => {
|
|
83
|
-
let t =
|
|
84
|
-
if (t !== void 0) return t ?
|
|
83
|
+
let t = ie.get(e);
|
|
84
|
+
if (t !== void 0) return t ? J(t, e) : e.postId;
|
|
85
85
|
let n = j(e);
|
|
86
|
-
if (n === e) return
|
|
86
|
+
if (n === e) return J(n, T(e));
|
|
87
87
|
let r = T(n) === e;
|
|
88
|
-
return
|
|
88
|
+
return ie.set(e, r ? n : null), r ? J(n, e) : e.postId;
|
|
89
89
|
}) : e.map((e) => e.postId);
|
|
90
90
|
}
|
|
91
91
|
//#endregion
|
|
92
92
|
//#region src/core/runtime.ts
|
|
93
|
-
var
|
|
94
|
-
function
|
|
95
|
-
let t =
|
|
96
|
-
return t || (t = r(() => Object.freeze([...e.items])),
|
|
93
|
+
var ae = /* @__PURE__ */ new WeakMap();
|
|
94
|
+
function oe(e) {
|
|
95
|
+
let t = ae.get(e);
|
|
96
|
+
return t || (t = r(() => Object.freeze([...e.items])), ae.set(e, t)), t;
|
|
97
97
|
}
|
|
98
|
-
function
|
|
99
|
-
return n(
|
|
98
|
+
function se(e, t, n) {
|
|
99
|
+
return n(X(e, t.value)), N(() => X(e, t.value), n, { flush: "post" });
|
|
100
100
|
}
|
|
101
|
-
function
|
|
101
|
+
function X(e, t = [...e.items]) {
|
|
102
102
|
return {
|
|
103
103
|
activeReelPostId: e.activeReelPostId,
|
|
104
104
|
autoScroll: { ...e.autoScroll },
|
|
@@ -128,14 +128,14 @@ function oe(e, t = [...e.items]) {
|
|
|
128
128
|
}
|
|
129
129
|
//#endregion
|
|
130
130
|
//#region src/components/GalleryFooter.vue?vue&type=script&setup=true&lang.ts
|
|
131
|
-
var
|
|
131
|
+
var Z = {
|
|
132
132
|
key: 0,
|
|
133
133
|
class: "gallery-footer"
|
|
134
|
-
},
|
|
134
|
+
}, ce = {
|
|
135
135
|
key: 0,
|
|
136
136
|
class: "load-more-status",
|
|
137
137
|
role: "status"
|
|
138
|
-
},
|
|
138
|
+
}, le = ["disabled"], Q = {
|
|
139
139
|
key: 2,
|
|
140
140
|
class: "end-feed"
|
|
141
141
|
}, ue = ["disabled"], de = /* @__PURE__ */ d({
|
|
@@ -154,14 +154,14 @@ var se = {
|
|
|
154
154
|
function i() {
|
|
155
155
|
n.loadMoreLocked || (n.hasNext ? r("loadMore") : r("retryEnd"));
|
|
156
156
|
}
|
|
157
|
-
return (t, n) => e.isLoading || e.hasError || e.hasNext && e.showLoadMore || !e.hasNext && e.canRetryEnd ? (w(), s("footer",
|
|
157
|
+
return (t, n) => e.isLoading || e.hasError || e.hasNext && e.showLoadMore || !e.hasNext && e.canRetryEnd ? (w(), s("footer", Z, [e.isLoading ? (w(), s("p", ce, " Loading more… ")) : e.hasError || e.hasNext && e.showLoadMore ? (w(), s("button", {
|
|
158
158
|
key: 1,
|
|
159
159
|
"data-test": "load-more",
|
|
160
160
|
class: "load-more-button",
|
|
161
161
|
type: "button",
|
|
162
162
|
disabled: e.loadMoreLocked,
|
|
163
163
|
onClick: i
|
|
164
|
-
}, A(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9,
|
|
164
|
+
}, A(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9, le)) : (w(), s("div", Q, [n[1] ||= c("p", {
|
|
165
165
|
class: "end-feed-message",
|
|
166
166
|
role: "status"
|
|
167
167
|
}, " You've reached the end. ", -1), c("button", {
|
|
@@ -410,10 +410,51 @@ function Oe(e, t, n, r, i, a) {
|
|
|
410
410
|
}
|
|
411
411
|
//#endregion
|
|
412
412
|
//#region src/core/masonryViewportIndex.ts
|
|
413
|
-
|
|
414
|
-
return { columns: [...e.entries()].sort(([e], [t]) => e - t).map(([, e]) => e.sort((e, t) => e.top - t.top || e.index - t.index)) };
|
|
415
|
-
}
|
|
413
|
+
var ke = /* @__PURE__ */ new WeakMap();
|
|
416
414
|
function Ae(e, t, n) {
|
|
415
|
+
let r = [...e.entries()].sort(([e], [t]) => e - t), i = { columns: r.map(([, e]) => e.sort((e, t) => e.top - t.top || e.index - t.index)) };
|
|
416
|
+
return t !== void 0 && ke.set(i, {
|
|
417
|
+
count: t,
|
|
418
|
+
width: n,
|
|
419
|
+
columns: new Map(r.map(([e, t], n) => {
|
|
420
|
+
let r = t[t.length - 1];
|
|
421
|
+
return [e, {
|
|
422
|
+
column: n,
|
|
423
|
+
top: r.top,
|
|
424
|
+
bottom: r.bottom
|
|
425
|
+
}];
|
|
426
|
+
}))
|
|
427
|
+
}), i;
|
|
428
|
+
}
|
|
429
|
+
function je(e, t, n, r) {
|
|
430
|
+
let i = r === void 0 ? ke.get(t) : void 0;
|
|
431
|
+
if (!i || i.count !== n || e.length < n) return null;
|
|
432
|
+
if (e.length === n) return t;
|
|
433
|
+
let a = new Map(i.columns), o = /* @__PURE__ */ new Map();
|
|
434
|
+
for (let t = n; t < e.length; t += 1) {
|
|
435
|
+
let n = e[t], r = a.get(n.x), s = n.y, c = s + n.height;
|
|
436
|
+
if (!r || n.width !== i.width || s < r.top || c < r.bottom) return null;
|
|
437
|
+
let l = o.get(r.column) ?? [];
|
|
438
|
+
l.push({
|
|
439
|
+
index: t,
|
|
440
|
+
top: s,
|
|
441
|
+
bottom: c
|
|
442
|
+
}), o.set(r.column, l), a.set(n.x, {
|
|
443
|
+
column: r.column,
|
|
444
|
+
top: s,
|
|
445
|
+
bottom: c
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
let s = t.columns.slice();
|
|
449
|
+
for (let [e, n] of o) s[e] = [...t.columns[e], ...n];
|
|
450
|
+
let c = { columns: s };
|
|
451
|
+
return ke.set(c, {
|
|
452
|
+
count: e.length,
|
|
453
|
+
width: i.width,
|
|
454
|
+
columns: a
|
|
455
|
+
}), c;
|
|
456
|
+
}
|
|
457
|
+
function Me(e, t, n) {
|
|
417
458
|
let r = e.get(t.x) ?? [];
|
|
418
459
|
r.push({
|
|
419
460
|
bottom: t.y + t.height,
|
|
@@ -421,29 +462,31 @@ function Ae(e, t, n) {
|
|
|
421
462
|
top: t.y
|
|
422
463
|
}), e.set(t.x, r);
|
|
423
464
|
}
|
|
424
|
-
function
|
|
465
|
+
function Ne(e, t) {
|
|
425
466
|
let n = /* @__PURE__ */ new Map();
|
|
426
467
|
return e.forEach((e, r) => {
|
|
427
|
-
|
|
428
|
-
}),
|
|
429
|
-
}
|
|
430
|
-
function
|
|
431
|
-
if (n <= 0) return
|
|
432
|
-
let i =
|
|
468
|
+
Me(n, e, t?.[r] ?? r);
|
|
469
|
+
}), Ae(n, t === void 0 ? e.length : void 0, e[0]?.width);
|
|
470
|
+
}
|
|
471
|
+
function Pe(e, t, n, r) {
|
|
472
|
+
if (n <= 0) return Ne(e, r);
|
|
473
|
+
let i = je(e, t, n, r);
|
|
474
|
+
if (i) return i;
|
|
475
|
+
let a = /* @__PURE__ */ new Map();
|
|
433
476
|
t.columns.forEach((t) => {
|
|
434
477
|
t.forEach((t) => {
|
|
435
478
|
if (t.index >= n) return;
|
|
436
479
|
let r = e[t.index];
|
|
437
480
|
if (!r) return;
|
|
438
|
-
let
|
|
439
|
-
|
|
481
|
+
let i = a.get(r.x) ?? [];
|
|
482
|
+
i.push(t), a.set(r.x, i);
|
|
440
483
|
});
|
|
441
484
|
});
|
|
442
|
-
for (let t = n; t < e.length; t += 1)
|
|
443
|
-
return
|
|
485
|
+
for (let t = n; t < e.length; t += 1) Me(a, e[t], r?.[t] ?? t);
|
|
486
|
+
return Ae(a, r === void 0 ? e.length : void 0, e[0]?.width);
|
|
444
487
|
}
|
|
445
|
-
function
|
|
446
|
-
if (r <= 0) return
|
|
488
|
+
function Fe(e, t, n, r) {
|
|
489
|
+
if (r <= 0) return Ne(t.map((t) => e[t]), t);
|
|
447
490
|
let i = /* @__PURE__ */ new Map();
|
|
448
491
|
return n.columns.forEach((t) => {
|
|
449
492
|
t.forEach((t) => {
|
|
@@ -454,10 +497,10 @@ function Ne(e, t, n, r) {
|
|
|
454
497
|
a.push(t), i.set(n.x, a);
|
|
455
498
|
});
|
|
456
499
|
}), t.forEach((t) => {
|
|
457
|
-
t < r ||
|
|
458
|
-
}),
|
|
500
|
+
t < r || Me(i, e[t], t);
|
|
501
|
+
}), Ae(i);
|
|
459
502
|
}
|
|
460
|
-
function
|
|
503
|
+
function Ie(e, t) {
|
|
461
504
|
let n = 0, r = 0, i = e.length;
|
|
462
505
|
for (; r < i;) {
|
|
463
506
|
let a = Math.floor((r + i) / 2);
|
|
@@ -468,10 +511,10 @@ function Pe(e, t) {
|
|
|
468
511
|
inspected: n
|
|
469
512
|
};
|
|
470
513
|
}
|
|
471
|
-
function
|
|
514
|
+
function Le(e, t) {
|
|
472
515
|
let n = Math.max(0, t.overscan), r = t.scrollTop - n, i = t.scrollTop + Math.max(0, t.viewportHeight) + n, a = [], o = 0;
|
|
473
516
|
return e.columns.forEach((e) => {
|
|
474
|
-
let t =
|
|
517
|
+
let t = Ie(e, r);
|
|
475
518
|
o += t.inspected;
|
|
476
519
|
for (let n = t.index; n < e.length; n += 1) {
|
|
477
520
|
let t = e[n];
|
|
@@ -483,14 +526,14 @@ function Fe(e, t) {
|
|
|
483
526
|
inspected: o
|
|
484
527
|
};
|
|
485
528
|
}
|
|
486
|
-
function
|
|
529
|
+
function Re(e) {
|
|
487
530
|
return e?.minColumnWidth ?? 240;
|
|
488
531
|
}
|
|
489
|
-
function
|
|
532
|
+
function ze(e, t) {
|
|
490
533
|
let n = e?.overscan?.minimumPx ?? 800, r = e?.overscan?.viewportMultiplier ?? 1.5, i = Math.max(n, t * r), a = e?.overscan?.maximumPx;
|
|
491
534
|
return a === void 0 ? i : Math.min(i, a);
|
|
492
535
|
}
|
|
493
|
-
function
|
|
536
|
+
function Be(e) {
|
|
494
537
|
for (let t of ["bottomSpacePx", "loadMoreThresholdPx"]) {
|
|
495
538
|
let n = e?.[t];
|
|
496
539
|
if (n !== void 0 && (!Number.isFinite(n) || n < 0)) throw TypeError(`Vibe masonry ${t} must be a finite non-negative number.`);
|
|
@@ -508,10 +551,10 @@ function Re(e) {
|
|
|
508
551
|
}
|
|
509
552
|
//#endregion
|
|
510
553
|
//#region src/core/scrollbar.ts
|
|
511
|
-
function
|
|
554
|
+
function Ve(e, t, n) {
|
|
512
555
|
return Math.min(n, Math.max(t, e));
|
|
513
556
|
}
|
|
514
|
-
function
|
|
557
|
+
function He({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize: r, viewportSize: i }) {
|
|
515
558
|
let a = Math.max(0, e), o = Math.max(0, r), s = Math.max(0, i), c = Math.max(0, a - s);
|
|
516
559
|
if (!(c > 0 && o > 0)) return {
|
|
517
560
|
maximumScrollPosition: c,
|
|
@@ -520,23 +563,68 @@ function Be({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize:
|
|
|
520
563
|
thumbSize: o,
|
|
521
564
|
thumbTravel: 0
|
|
522
565
|
};
|
|
523
|
-
let l =
|
|
566
|
+
let l = Ve(s / a * o, Math.min(Math.max(0, t), o), o), u = Math.max(0, o - l);
|
|
524
567
|
return {
|
|
525
568
|
maximumScrollPosition: c,
|
|
526
569
|
scrollable: !0,
|
|
527
|
-
thumbOffset: u * (
|
|
570
|
+
thumbOffset: u * (Ve(n, 0, c) / c),
|
|
528
571
|
thumbSize: l,
|
|
529
572
|
thumbTravel: u
|
|
530
573
|
};
|
|
531
574
|
}
|
|
532
575
|
//#endregion
|
|
576
|
+
//#region src/components/scrollbarPlaybackMutation.ts
|
|
577
|
+
function Ue(e) {
|
|
578
|
+
if (e.type !== "childList" || !e.addedNodes || !e.removedNodes) return !1;
|
|
579
|
+
let t = 0;
|
|
580
|
+
for (let n of [e.addedNodes, e.removedNodes]) for (let e = 0; e < n.length; e++) {
|
|
581
|
+
if (n[e]?.nodeType !== Node.COMMENT_NODE) return !1;
|
|
582
|
+
t++;
|
|
583
|
+
}
|
|
584
|
+
return t > 0;
|
|
585
|
+
}
|
|
586
|
+
function We(e, t) {
|
|
587
|
+
let n = e.matches("span.media-loading-shimmer"), r = e.matches("video.media-preview,img.media-preview,canvas.media-preview") && e.parentElement?.classList.contains("media-card-frame");
|
|
588
|
+
if (!n && !r || !e.closest(".masonry-item.media-card")) return null;
|
|
589
|
+
let i = n ? "a:media-loading-shimmer:" : "t:transform:";
|
|
590
|
+
for (let e of t) if (e !== i) return null;
|
|
591
|
+
let a = n ? e.parentElement : e.closest(".media-card-media");
|
|
592
|
+
return a?.classList.contains(n ? "media-loading" : "media-card-media") ? a : null;
|
|
593
|
+
}
|
|
594
|
+
function Ge(e, t, n) {
|
|
595
|
+
if (e.type !== "attributes" || !e.attributeName) return !1;
|
|
596
|
+
let r = e.target;
|
|
597
|
+
if (!(r instanceof HTMLElement)) return !1;
|
|
598
|
+
if (e.oldValue === r.getAttribute(e.attributeName)) return null;
|
|
599
|
+
let i = r.closest(".masonry-item.media-card");
|
|
600
|
+
if (!i || !t.contains(i)) return !1;
|
|
601
|
+
let a = r instanceof HTMLInputElement && r.type === "range" && r.classList.contains("media-control-seek") && r.closest(".media-controls"), o = r instanceof HTMLVideoElement && r.classList.contains("media-preview");
|
|
602
|
+
if (!(a && e.attributeName === "aria-valuetext")) {
|
|
603
|
+
if (e.attributeName !== "style" || !a && !o) return !1;
|
|
604
|
+
let t = a ? "--media-range-progress" : "opacity", i = n();
|
|
605
|
+
i.cssText = e.oldValue ?? "";
|
|
606
|
+
let s = (e, n) => {
|
|
607
|
+
for (let r = 0; r < e.length; r++) {
|
|
608
|
+
let i = e[r];
|
|
609
|
+
if (i !== t && (e.getPropertyValue(i) !== n.getPropertyValue(i) || e.getPropertyPriority(i) !== n.getPropertyPriority(i))) return !1;
|
|
610
|
+
}
|
|
611
|
+
return !0;
|
|
612
|
+
};
|
|
613
|
+
if (!s(i, r.style) || !s(r.style, i)) return !1;
|
|
614
|
+
}
|
|
615
|
+
return {
|
|
616
|
+
target: r,
|
|
617
|
+
card: i
|
|
618
|
+
};
|
|
619
|
+
}
|
|
620
|
+
//#endregion
|
|
533
621
|
//#region src/components/GalleryScrollbar.vue?vue&type=script&setup=true&lang.ts
|
|
534
|
-
var
|
|
622
|
+
var Ke = ["aria-hidden"], qe = [
|
|
535
623
|
"aria-controls",
|
|
536
624
|
"aria-valuemax",
|
|
537
625
|
"aria-valuenow",
|
|
538
626
|
"tabindex"
|
|
539
|
-
],
|
|
627
|
+
], Je = 32, Ye = 40, Xe = 120, Ze = 512, Qe = /* @__PURE__ */ d({
|
|
540
628
|
__name: "GalleryScrollbar",
|
|
541
629
|
props: {
|
|
542
630
|
contentSize: {},
|
|
@@ -551,53 +639,93 @@ var Ve = ["aria-hidden"], He = [
|
|
|
551
639
|
thumbOffset: 0,
|
|
552
640
|
thumbSize: 0,
|
|
553
641
|
thumbTravel: 0
|
|
554
|
-
}, i = k(null), a = k(n), o = k(!1), l = k(!1), u = k(!1), d = null, f = 0, p = 0, m = null, h = null, g = null, _ = null, b = !1, C = null, T = null, E = !1, D = !0, O = null, A = /* @__PURE__ */ new Map(), j = r(() => a.value.scrollable && !t.suspended),
|
|
642
|
+
}, i = k(null), a = k(n), o = k(!1), l = k(!1), u = k(!1), d = null, f = 0, p = 0, m = null, h = null, g = null, _ = null, b = !1, C = null, T = null, E = !1, D = !0, O = null, A = /* @__PURE__ */ new Map(), j = /* @__PURE__ */ new Set(), M = /* @__PURE__ */ new WeakMap(), ee, P = [], F = !1, I = !1, L = !1, R = r(() => a.value.scrollable && !t.suspended), z = r(() => ({
|
|
555
643
|
height: `${a.value.thumbSize}px`,
|
|
556
644
|
transform: `translate3d(0, ${a.value.thumbOffset}px, 0)`
|
|
557
645
|
}));
|
|
558
|
-
function
|
|
646
|
+
function B() {
|
|
559
647
|
m !== null && clearTimeout(m), m = setTimeout(() => {
|
|
560
648
|
m = null, o.value || (l.value = !1);
|
|
561
|
-
},
|
|
649
|
+
}, Xe);
|
|
562
650
|
}
|
|
563
|
-
function
|
|
564
|
-
l.value = !0,
|
|
651
|
+
function V() {
|
|
652
|
+
l.value = !0, B();
|
|
565
653
|
}
|
|
566
|
-
function
|
|
654
|
+
function H() {
|
|
567
655
|
T !== null && (cancelAnimationFrame(T), T = null);
|
|
568
656
|
}
|
|
569
|
-
function
|
|
657
|
+
function U(e) {
|
|
658
|
+
E || (D = !0, M = /* @__PURE__ */ new WeakMap(), te(e));
|
|
659
|
+
}
|
|
660
|
+
function te(e) {
|
|
570
661
|
if (E) return;
|
|
571
|
-
if (
|
|
662
|
+
if (o.value) {
|
|
572
663
|
b = !0;
|
|
573
664
|
return;
|
|
574
665
|
}
|
|
575
666
|
if (T !== null) return;
|
|
576
667
|
T = -1;
|
|
577
668
|
let t = requestAnimationFrame(() => {
|
|
578
|
-
T = null, D &&
|
|
669
|
+
T = null, (D || P.length || F) && Y(e);
|
|
579
670
|
});
|
|
580
671
|
T !== null && (T = t);
|
|
581
672
|
}
|
|
582
|
-
function
|
|
583
|
-
|
|
673
|
+
function W(e) {
|
|
674
|
+
let t = M.get(e);
|
|
675
|
+
if (t === void 0) {
|
|
676
|
+
let n = e.ownerDocument.defaultView?.getComputedStyle(e), r = (e) => e === "hidden" || e === "clip";
|
|
677
|
+
t = !!n && r(n.overflowX || n.overflow) && r(n.overflowY || n.overflow), M.set(e, t);
|
|
678
|
+
}
|
|
679
|
+
return t;
|
|
680
|
+
}
|
|
681
|
+
function ne(e) {
|
|
682
|
+
for (let t of e) j.has(t) || (j.add(t), _?.observe(t, { box: "border-box" }));
|
|
683
|
+
}
|
|
684
|
+
function G({ target: e, card: t }) {
|
|
685
|
+
return !_ || !W(t) ? !1 : (ne([e, t]), !0);
|
|
584
686
|
}
|
|
585
|
-
function
|
|
687
|
+
function K() {
|
|
688
|
+
for (let [e, t] of A) {
|
|
689
|
+
let n = We(e, t.keys());
|
|
690
|
+
if (!n || !_ || !W(n)) return !0;
|
|
691
|
+
ne([n]);
|
|
692
|
+
}
|
|
693
|
+
return !1;
|
|
694
|
+
}
|
|
695
|
+
function re(e, t) {
|
|
696
|
+
for (let n of e) Ue(n) || (n.type === "childList" && (L = !0, n.target === t && (I = !0)), !F && (P.length === Ze ? (F = !0, P = []) : P.push(n)));
|
|
697
|
+
}
|
|
698
|
+
function q(e) {
|
|
699
|
+
if (re(g?.takeRecords() ?? [], e), I && Q(e), L) for (let t of j) e.contains(t) || (_?.unobserve(t), j.delete(t));
|
|
700
|
+
let t = P, n = F;
|
|
701
|
+
if (P = [], F = I = L = !1, !t.length && !n) return;
|
|
702
|
+
let r = [], i = n || D || !_;
|
|
703
|
+
for (let n of t) {
|
|
704
|
+
if (i) break;
|
|
705
|
+
let t = Ge(n, e, () => ee ??= document.createElement("span").style);
|
|
706
|
+
t === !1 ? i = !0 : t && r.push(t);
|
|
707
|
+
}
|
|
708
|
+
i ||= r.some((e) => !G(e)), i && (D = !0, M = /* @__PURE__ */ new WeakMap());
|
|
709
|
+
}
|
|
710
|
+
function ie() {
|
|
711
|
+
P = [], F = I = L = !1;
|
|
712
|
+
}
|
|
713
|
+
function J(e) {
|
|
586
714
|
let r = t.scrollElement, a = i.value;
|
|
587
715
|
return !r || !a ? n : ((e || !O) && (O = {
|
|
588
716
|
contentSize: r.scrollHeight,
|
|
589
717
|
trackSize: a.clientHeight,
|
|
590
718
|
viewportSize: r.clientHeight
|
|
591
|
-
}, D = !1, b = !1,
|
|
719
|
+
}, D = !1, b = !1, H()), He({
|
|
592
720
|
...O,
|
|
593
|
-
minimumThumbSize:
|
|
721
|
+
minimumThumbSize: Je,
|
|
594
722
|
scrollPosition: r.scrollTop
|
|
595
723
|
}));
|
|
596
724
|
}
|
|
597
|
-
function
|
|
725
|
+
function Y(e) {
|
|
598
726
|
if (E) return;
|
|
599
727
|
let n = t.scrollElement;
|
|
600
|
-
|
|
728
|
+
if (g || (L = !0), n && q(n), e === "mutation" && !D) return;
|
|
601
729
|
for (let e of A.keys()) n?.contains(e) || A.delete(e);
|
|
602
730
|
if (o.value && e !== "scroll") {
|
|
603
731
|
b = !0;
|
|
@@ -613,101 +741,105 @@ var Ve = ["aria-hidden"], He = [
|
|
|
613
741
|
};
|
|
614
742
|
return;
|
|
615
743
|
}
|
|
616
|
-
let r = g && _ && C
|
|
617
|
-
a.value =
|
|
744
|
+
let r = e !== "scroll" || D || !(g && _ && C);
|
|
745
|
+
a.value = J(r || K()), r && K(), !(u.value || h !== null) && (h = requestAnimationFrame(() => {
|
|
618
746
|
h = null, u.value = !0;
|
|
619
747
|
}));
|
|
620
748
|
}
|
|
621
|
-
function
|
|
622
|
-
|
|
749
|
+
function ae() {
|
|
750
|
+
V(), Y("scroll");
|
|
623
751
|
}
|
|
624
|
-
function
|
|
752
|
+
function oe(e) {
|
|
625
753
|
let n = t.scrollElement;
|
|
626
|
-
n && (n.scrollTop = Math.min(a.value.maximumScrollPosition, Math.max(0, e)),
|
|
754
|
+
n && (n.scrollTop = Math.min(a.value.maximumScrollPosition, Math.max(0, e)), Y("scroll"));
|
|
627
755
|
}
|
|
628
|
-
function
|
|
629
|
-
if (e.target !== e.currentTarget || (
|
|
756
|
+
function se(e) {
|
|
757
|
+
if (e.target !== e.currentTarget || (Y("resize"), !R.value)) return;
|
|
630
758
|
let t = i.value;
|
|
631
759
|
if (!t || a.value.thumbTravel <= 0) return;
|
|
632
|
-
e.preventDefault(),
|
|
760
|
+
e.preventDefault(), V();
|
|
633
761
|
let n = e.clientY - t.getBoundingClientRect().top - a.value.thumbSize / 2;
|
|
634
|
-
|
|
762
|
+
oe(Math.min(1, Math.max(0, n / a.value.thumbTravel)) * a.value.maximumScrollPosition);
|
|
635
763
|
}
|
|
636
|
-
function
|
|
637
|
-
|
|
764
|
+
function X(e) {
|
|
765
|
+
Y("resize"), R.value && (e.preventDefault(), e.stopPropagation(), e.currentTarget.setPointerCapture?.(e.pointerId), d = e.pointerId, f = e.clientY, p = t.scrollElement?.scrollTop ?? 0, o.value = !0, l.value = !0, m !== null && clearTimeout(m), m = null);
|
|
638
766
|
}
|
|
639
|
-
function
|
|
767
|
+
function Z(e) {
|
|
640
768
|
if (!o.value || e.pointerId !== d || (e.preventDefault(), a.value.thumbTravel <= 0)) return;
|
|
641
769
|
let t = (e.clientY - f) / a.value.thumbTravel * a.value.maximumScrollPosition;
|
|
642
|
-
|
|
770
|
+
oe(p + t);
|
|
643
771
|
}
|
|
644
|
-
function
|
|
645
|
-
!o.value || e.pointerId !== d || (e.currentTarget.releasePointerCapture?.(e.pointerId), d = null, o.value = !1, b && (b = !1,
|
|
772
|
+
function ce(e) {
|
|
773
|
+
!o.value || e.pointerId !== d || (e.currentTarget.releasePointerCapture?.(e.pointerId), d = null, o.value = !1, b && (b = !1, Y("content")), B());
|
|
646
774
|
}
|
|
647
|
-
function
|
|
648
|
-
if (
|
|
649
|
-
let n = o.value ? t.scrollElement?.clientHeight ?? 0 : O?.viewportSize ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r -
|
|
650
|
-
i !== null && (e.preventDefault(),
|
|
775
|
+
function le(e) {
|
|
776
|
+
if (Y("resize"), !R.value) return;
|
|
777
|
+
let n = o.value ? t.scrollElement?.clientHeight ?? 0 : O?.viewportSize ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r - Ye : e.key === "ArrowDown" ? r + Ye : e.key === "PageUp" ? r - n : e.key === "PageDown" ? r + n : e.key === "Home" ? 0 : e.key === "End" ? a.value.maximumScrollPosition : null;
|
|
778
|
+
i !== null && (e.preventDefault(), V(), oe(i));
|
|
651
779
|
}
|
|
652
|
-
function
|
|
780
|
+
function Q(e) {
|
|
653
781
|
if (_?.disconnect(), !(typeof ResizeObserver > "u")) {
|
|
654
782
|
_ = new ResizeObserver(() => {
|
|
655
|
-
e === t.scrollElement &&
|
|
783
|
+
e === t.scrollElement && U("content");
|
|
656
784
|
});
|
|
657
785
|
for (let t of e.children) _.observe(t);
|
|
786
|
+
for (let t of j) e.contains(t) && _.observe(t, { box: "border-box" });
|
|
658
787
|
}
|
|
659
788
|
}
|
|
660
|
-
function
|
|
661
|
-
|
|
789
|
+
function ue() {
|
|
790
|
+
U("content");
|
|
662
791
|
}
|
|
663
|
-
function
|
|
792
|
+
function de(e) {
|
|
664
793
|
let t = e.type.startsWith("animation") ? e.animationName : e.propertyName;
|
|
665
794
|
return `${e.type.startsWith("animation") ? "a" : "t"}:${t}:${e.pseudoElement ?? ""}`;
|
|
666
795
|
}
|
|
667
|
-
function
|
|
796
|
+
function fe(e) {
|
|
797
|
+
if (e.type.startsWith("transition") && e.propertyName === "opacity") return;
|
|
668
798
|
let n = e.target;
|
|
669
799
|
if (!(n instanceof Element) || !t.scrollElement?.contains(n)) return;
|
|
670
|
-
let r = A.get(n) ?? /* @__PURE__ */ new Map(), i =
|
|
671
|
-
r.set(i, (r.get(i) ?? 0) + 1), A.set(n, r),
|
|
800
|
+
let r = A.get(n) ?? /* @__PURE__ */ new Map(), i = de(e);
|
|
801
|
+
r.set(i, (r.get(i) ?? 0) + 1), A.set(n, r), U("content");
|
|
672
802
|
}
|
|
673
|
-
function
|
|
803
|
+
function $(e) {
|
|
804
|
+
if (e.type.startsWith("transition") && e.propertyName === "opacity") return;
|
|
674
805
|
let t = e.target;
|
|
675
806
|
if (!(t instanceof Element)) return;
|
|
676
|
-
let n = A.get(t), r =
|
|
677
|
-
i > 0 ? n?.set(r, i) : n?.delete(r), n?.size === 0 && A.delete(t),
|
|
807
|
+
let n = A.get(t), r = de(e), i = (n?.get(r) ?? 0) - 1;
|
|
808
|
+
i > 0 ? n?.set(r, i) : n?.delete(r), n?.size === 0 && A.delete(t), U("content");
|
|
678
809
|
}
|
|
679
|
-
function
|
|
810
|
+
function pe(e, t) {
|
|
680
811
|
let n = [
|
|
681
|
-
["load",
|
|
682
|
-
["loadedmetadata",
|
|
683
|
-
["transitionrun",
|
|
684
|
-
["animationstart",
|
|
685
|
-
["transitionend",
|
|
686
|
-
["transitioncancel",
|
|
687
|
-
["animationend",
|
|
688
|
-
["animationcancel",
|
|
812
|
+
["load", ue],
|
|
813
|
+
["loadedmetadata", ue],
|
|
814
|
+
["transitionrun", fe],
|
|
815
|
+
["animationstart", fe],
|
|
816
|
+
["transitionend", $],
|
|
817
|
+
["transitioncancel", $],
|
|
818
|
+
["animationend", $],
|
|
819
|
+
["animationcancel", $]
|
|
689
820
|
];
|
|
690
821
|
for (let [r, i] of n) t ? e?.addEventListener(r, i, !0) : e?.removeEventListener(r, i, !0);
|
|
691
822
|
}
|
|
692
|
-
return
|
|
693
|
-
n?.removeEventListener("scroll",
|
|
694
|
-
E || e !== t.scrollElement || (
|
|
695
|
-
}), C.observe(e), i.value && C.observe(i.value),
|
|
696
|
-
e !== t.scrollElement || E || (
|
|
823
|
+
return N(() => t.scrollElement, (e, n) => {
|
|
824
|
+
n?.removeEventListener("scroll", ae), pe(n, !1), A.clear(), j.clear(), ie(), M = /* @__PURE__ */ new WeakMap(), H(), O = null, D = !0, g?.disconnect(), g = null, _?.disconnect(), _ = null, C?.disconnect(), C = null, e?.addEventListener("scroll", ae, { passive: !0 }), pe(e, !0), e && typeof ResizeObserver < "u" && (C = new ResizeObserver(() => {
|
|
825
|
+
E || e !== t.scrollElement || (V(), U("resize"));
|
|
826
|
+
}), C.observe(e), i.value && C.observe(i.value), Q(e)), e && typeof MutationObserver < "u" && (g = new MutationObserver((n) => {
|
|
827
|
+
e !== t.scrollElement || E || (re(n, e), te("mutation"));
|
|
697
828
|
}), g.observe(e, {
|
|
698
829
|
childList: !0,
|
|
699
830
|
subtree: !0,
|
|
700
831
|
attributes: !0,
|
|
832
|
+
attributeOldValue: !0,
|
|
701
833
|
characterData: !0
|
|
702
|
-
})), v(() =>
|
|
703
|
-
}, { immediate: !0 }),
|
|
704
|
-
t && C?.unobserve(t), e && C?.observe(e),
|
|
705
|
-
}, { flush: "post" }),
|
|
834
|
+
})), v(() => Y("resize"));
|
|
835
|
+
}, { immediate: !0 }), N(i, (e, t) => {
|
|
836
|
+
t && C?.unobserve(t), e && C?.observe(e), U("resize");
|
|
837
|
+
}, { flush: "post" }), N(() => t.contentSize, () => {
|
|
706
838
|
D = !0, v(() => {
|
|
707
|
-
D &&
|
|
839
|
+
D && Y("content");
|
|
708
840
|
});
|
|
709
841
|
}), S(() => {
|
|
710
|
-
E = !0,
|
|
842
|
+
E = !0, H(), t.scrollElement?.removeEventListener("scroll", ae), pe(t.scrollElement, !1), A.clear(), j.clear(), ie(), g?.disconnect(), _?.disconnect(), C?.disconnect(), m !== null && clearTimeout(m), h !== null && cancelAnimationFrame(h);
|
|
711
843
|
}), (t, n) => (w(), s("div", {
|
|
712
844
|
ref_key: "trackElement",
|
|
713
845
|
ref: i,
|
|
@@ -715,10 +847,10 @@ var Ve = ["aria-hidden"], He = [
|
|
|
715
847
|
"gallery-scrollbar--dragging": o.value,
|
|
716
848
|
"gallery-scrollbar--interacting": l.value,
|
|
717
849
|
"gallery-scrollbar--ready": u.value,
|
|
718
|
-
"gallery-scrollbar--visible":
|
|
850
|
+
"gallery-scrollbar--visible": R.value
|
|
719
851
|
}]),
|
|
720
|
-
"aria-hidden": !
|
|
721
|
-
onPointerdown:
|
|
852
|
+
"aria-hidden": !R.value || void 0,
|
|
853
|
+
onPointerdown: se
|
|
722
854
|
}, [c("div", {
|
|
723
855
|
class: "gallery-scrollbar-thumb",
|
|
724
856
|
"aria-controls": e.controlsId,
|
|
@@ -728,22 +860,22 @@ var Ve = ["aria-hidden"], He = [
|
|
|
728
860
|
"aria-valuemin": "0",
|
|
729
861
|
"aria-valuenow": Math.round(e.scrollElement?.scrollTop ?? 0),
|
|
730
862
|
role: "scrollbar",
|
|
731
|
-
style: x(
|
|
732
|
-
tabindex:
|
|
733
|
-
onKeydown:
|
|
734
|
-
onPointercancel:
|
|
735
|
-
onPointerdown:
|
|
736
|
-
onPointermove:
|
|
737
|
-
onPointerup:
|
|
738
|
-
}, null, 44,
|
|
739
|
-
}
|
|
740
|
-
}),
|
|
863
|
+
style: x(z.value),
|
|
864
|
+
tabindex: R.value ? 0 : -1,
|
|
865
|
+
onKeydown: le,
|
|
866
|
+
onPointercancel: ce,
|
|
867
|
+
onPointerdown: X,
|
|
868
|
+
onPointermove: Z,
|
|
869
|
+
onPointerup: ce
|
|
870
|
+
}, null, 44, qe)], 42, Ke));
|
|
871
|
+
}
|
|
872
|
+
}), $e = (e) => {
|
|
741
873
|
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
|
742
874
|
return !1;
|
|
743
|
-
},
|
|
744
|
-
let t =
|
|
875
|
+
}, et = (e) => e === "", tt = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), nt = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), rt = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), it = (e) => {
|
|
876
|
+
let t = rt(e);
|
|
745
877
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
746
|
-
},
|
|
878
|
+
}, at = {
|
|
747
879
|
xmlns: "http://www.w3.org/2000/svg",
|
|
748
880
|
width: 24,
|
|
749
881
|
height: 24,
|
|
@@ -753,27 +885,27 @@ var Ve = ["aria-hidden"], He = [
|
|
|
753
885
|
"stroke-width": 2,
|
|
754
886
|
"stroke-linecap": "round",
|
|
755
887
|
"stroke-linejoin": "round"
|
|
756
|
-
},
|
|
757
|
-
|
|
888
|
+
}, ot = ({ name: e, iconNode: t, absoluteStrokeWidth: n, "absolute-stroke-width": r, strokeWidth: i, "stroke-width": a, size: o = at.width, color: s = at.stroke, ...c }, { slots: l }) => p("svg", {
|
|
889
|
+
...at,
|
|
758
890
|
...c,
|
|
759
891
|
width: o,
|
|
760
892
|
height: o,
|
|
761
893
|
stroke: s,
|
|
762
|
-
"stroke-width":
|
|
763
|
-
class:
|
|
764
|
-
...!l.default &&
|
|
765
|
-
}, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]),
|
|
894
|
+
"stroke-width": et(n) || et(r) || n === !0 || r === !0 ? Number(i || a || at["stroke-width"]) * 24 / Number(o) : i || a || at["stroke-width"],
|
|
895
|
+
class: tt("lucide", c.class, ...e ? [`lucide-${nt(it(e))}-icon`, `lucide-${nt(e)}`] : ["lucide-icon"]),
|
|
896
|
+
...!l.default && !$e(c) && { "aria-hidden": "true" }
|
|
897
|
+
}, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]), st = (e, t) => (n, { slots: r, attrs: i }) => p(ot, {
|
|
766
898
|
...i,
|
|
767
899
|
...n,
|
|
768
900
|
iconNode: t,
|
|
769
901
|
name: e
|
|
770
|
-
}, r),
|
|
902
|
+
}, r), ct = st("chevron-left", [["path", {
|
|
771
903
|
d: "m15 18-6-6 6-6",
|
|
772
904
|
key: "1wnfg3"
|
|
773
|
-
}]]),
|
|
905
|
+
}]]), lt = st("chevron-right", [["path", {
|
|
774
906
|
d: "m9 18 6-6-6-6",
|
|
775
907
|
key: "mthhwq"
|
|
776
|
-
}]]),
|
|
908
|
+
}]]), ut = st("disc-3", [
|
|
777
909
|
["circle", {
|
|
778
910
|
cx: "12",
|
|
779
911
|
cy: "12",
|
|
@@ -794,7 +926,7 @@ var Ve = ["aria-hidden"], He = [
|
|
|
794
926
|
d: "M18 12c0 1.7-.7 3.2-1.8 4.2",
|
|
795
927
|
key: "1eah9h"
|
|
796
928
|
}]
|
|
797
|
-
]),
|
|
929
|
+
]), dt = st("pause", [["rect", {
|
|
798
930
|
x: "14",
|
|
799
931
|
y: "3",
|
|
800
932
|
width: "5",
|
|
@@ -808,10 +940,10 @@ var Ve = ["aria-hidden"], He = [
|
|
|
808
940
|
height: "18",
|
|
809
941
|
rx: "1",
|
|
810
942
|
key: "1wsw3u"
|
|
811
|
-
}]]),
|
|
943
|
+
}]]), ft = st("play", [["path", {
|
|
812
944
|
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",
|
|
813
945
|
key: "10ikf1"
|
|
814
|
-
}]]),
|
|
946
|
+
}]]), pt = st("volume-2", [
|
|
815
947
|
["path", {
|
|
816
948
|
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",
|
|
817
949
|
key: "uqj9uw"
|
|
@@ -824,7 +956,7 @@ var Ve = ["aria-hidden"], He = [
|
|
|
824
956
|
d: "M19.364 18.364a9 9 0 0 0 0-12.728",
|
|
825
957
|
key: "ijwkga"
|
|
826
958
|
}]
|
|
827
|
-
]),
|
|
959
|
+
]), mt = st("volume-x", [
|
|
828
960
|
["path", {
|
|
829
961
|
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",
|
|
830
962
|
key: "uqj9uw"
|
|
@@ -843,28 +975,28 @@ var Ve = ["aria-hidden"], He = [
|
|
|
843
975
|
y2: "15",
|
|
844
976
|
key: "5ykzw1"
|
|
845
977
|
}]
|
|
846
|
-
]),
|
|
978
|
+
]), ht = {
|
|
847
979
|
401: "Authentication required",
|
|
848
980
|
403: "Access forbidden",
|
|
849
981
|
404: "Preview not found",
|
|
850
982
|
419: "Session expired",
|
|
851
983
|
500: "Server error"
|
|
852
984
|
};
|
|
853
|
-
function
|
|
985
|
+
function gt(e) {
|
|
854
986
|
return e.match(/\/demo-errors\/(401|403|404|419|500)\//)?.[1] ?? "Error";
|
|
855
987
|
}
|
|
856
|
-
function
|
|
857
|
-
return
|
|
988
|
+
function _t(e) {
|
|
989
|
+
return ht[gt(e)] ?? "Preview unavailable";
|
|
858
990
|
}
|
|
859
991
|
//#endregion
|
|
860
992
|
//#region src/components/CardRegion.vue
|
|
861
|
-
var
|
|
993
|
+
var vt = /* @__PURE__ */ d({
|
|
862
994
|
__name: "CardRegion",
|
|
863
995
|
props: {
|
|
864
996
|
index: {},
|
|
865
997
|
item: {},
|
|
866
998
|
layout: {},
|
|
867
|
-
loadedCount: {},
|
|
999
|
+
loadedCount: { type: [Number, Function] },
|
|
868
1000
|
mediaIndex: {},
|
|
869
1001
|
mediaSource: {},
|
|
870
1002
|
placement: {},
|
|
@@ -873,24 +1005,24 @@ var ft = /* @__PURE__ */ d({
|
|
|
873
1005
|
total: {}
|
|
874
1006
|
},
|
|
875
1007
|
setup(e) {
|
|
876
|
-
let t = e, n = r(() =>
|
|
1008
|
+
let t = e, n = r(() => K(t.item, t.mediaIndex)), i = r(() => typeof t.loadedCount == "function" ? t.loadedCount() : t.loadedCount), o = r(() => G(t.item)), c = r(() => re(t.item, n.value)), l = r(() => ({
|
|
877
1009
|
height: `${t.region.height}px`,
|
|
878
1010
|
paddingBlock: t.style?.paddingY === void 0 ? void 0 : `${t.style.paddingY}px`,
|
|
879
1011
|
paddingInline: t.style?.paddingX === void 0 ? void 0 : `${t.style.paddingX}px`
|
|
880
|
-
})),
|
|
1012
|
+
})), u = r(() => t.style?.background ?? t.region.background);
|
|
881
1013
|
return (t, r) => (w(), s("div", {
|
|
882
|
-
class: y(["media-card-region", [`media-card-${e.placement}`, { "media-card-region--transparent":
|
|
883
|
-
style: x(
|
|
884
|
-
onClick: r[0] ||=
|
|
885
|
-
onKeydown: r[1] ||=
|
|
1014
|
+
class: y(["media-card-region", [`media-card-${e.placement}`, { "media-card-region--transparent": u.value === "transparent" }]]),
|
|
1015
|
+
style: x(l.value),
|
|
1016
|
+
onClick: r[0] ||= I(() => {}, ["stop"]),
|
|
1017
|
+
onKeydown: r[1] ||= I(() => {}, ["stop"])
|
|
886
1018
|
}, [(w(), a(D(e.region.component), {
|
|
887
1019
|
index: e.index,
|
|
888
1020
|
item: e.item,
|
|
889
1021
|
layout: e.layout,
|
|
890
|
-
"loaded-count":
|
|
891
|
-
"media-count":
|
|
1022
|
+
"loaded-count": i.value,
|
|
1023
|
+
"media-count": o.value.length,
|
|
892
1024
|
"media-index": n.value,
|
|
893
|
-
"media-item":
|
|
1025
|
+
"media-item": c.value,
|
|
894
1026
|
"media-source": e.mediaSource ?? "preview",
|
|
895
1027
|
total: e.total
|
|
896
1028
|
}, null, 8, [
|
|
@@ -905,7 +1037,7 @@ var ft = /* @__PURE__ */ d({
|
|
|
905
1037
|
"total"
|
|
906
1038
|
]))], 38));
|
|
907
1039
|
}
|
|
908
|
-
}),
|
|
1040
|
+
}), yt = ["aria-busy", "aria-label"], bt = { class: "media-error-code" }, xt = ["disabled"], St = /* @__PURE__ */ d({
|
|
909
1041
|
__name: "MediaError",
|
|
910
1042
|
props: {
|
|
911
1043
|
component: {},
|
|
@@ -928,8 +1060,8 @@ var ft = /* @__PURE__ */ d({
|
|
|
928
1060
|
}, [t.component ? (w(), s("div", {
|
|
929
1061
|
key: 0,
|
|
930
1062
|
class: "media-error-component",
|
|
931
|
-
onClick: r[0] ||=
|
|
932
|
-
onKeydown: r[1] ||=
|
|
1063
|
+
onClick: r[0] ||= I(() => {}, ["stop"]),
|
|
1064
|
+
onKeydown: r[1] ||= I(() => {}, ["stop"])
|
|
933
1065
|
}, [(w(), a(D(t.component), {
|
|
934
1066
|
label: t.label,
|
|
935
1067
|
retry: o,
|
|
@@ -940,35 +1072,35 @@ var ft = /* @__PURE__ */ d({
|
|
|
940
1072
|
"retrying",
|
|
941
1073
|
"status"
|
|
942
1074
|
]))], 32)) : (w(), s(e, { key: 1 }, [
|
|
943
|
-
c("strong",
|
|
1075
|
+
c("strong", bt, A(t.status), 1),
|
|
944
1076
|
c("span", null, A(t.label), 1),
|
|
945
1077
|
c("button", {
|
|
946
1078
|
"data-test": "media-retry",
|
|
947
1079
|
class: "media-error-retry",
|
|
948
1080
|
type: "button",
|
|
949
1081
|
disabled: t.retrying,
|
|
950
|
-
onClick:
|
|
951
|
-
onKeydown: r[2] ||=
|
|
952
|
-
}, A(t.retrying ? "Retrying…" : "Retry"), 41,
|
|
953
|
-
], 64))], 8,
|
|
1082
|
+
onClick: I(o, ["stop"]),
|
|
1083
|
+
onKeydown: r[2] ||= I(() => {}, ["stop"])
|
|
1084
|
+
}, A(t.retrying ? "Retrying…" : "Retry"), 41, xt)
|
|
1085
|
+
], 64))], 8, yt));
|
|
954
1086
|
}
|
|
955
|
-
}),
|
|
1087
|
+
}), Ct = ["aria-label"], wt = [
|
|
956
1088
|
"max",
|
|
957
1089
|
"value",
|
|
958
1090
|
"aria-label",
|
|
959
1091
|
"aria-valuetext",
|
|
960
1092
|
"disabled"
|
|
961
|
-
],
|
|
1093
|
+
], Tt = {
|
|
962
1094
|
key: 0,
|
|
963
1095
|
class: "media-controls-row"
|
|
964
|
-
},
|
|
1096
|
+
}, Et = ["aria-label", "title"], Dt = { class: "media-controls-audio" }, Ot = ["aria-label", "title"], kt = [
|
|
965
1097
|
"value",
|
|
966
1098
|
"aria-label",
|
|
967
1099
|
"aria-valuetext"
|
|
968
|
-
],
|
|
1100
|
+
], At = {
|
|
969
1101
|
class: "media-control-time",
|
|
970
1102
|
"aria-live": "off"
|
|
971
|
-
},
|
|
1103
|
+
}, jt = /* @__PURE__ */ d({
|
|
972
1104
|
__name: "MediaControls",
|
|
973
1105
|
props: {
|
|
974
1106
|
currentTime: {},
|
|
@@ -1005,10 +1137,10 @@ var ft = /* @__PURE__ */ d({
|
|
|
1005
1137
|
class: y(["media-controls", `media-controls--${e.layout}`]),
|
|
1006
1138
|
role: "group",
|
|
1007
1139
|
"aria-label": `${h.value} controls`,
|
|
1008
|
-
onClick: n[4] ||=
|
|
1009
|
-
onDblclick: n[5] ||=
|
|
1140
|
+
onClick: n[4] ||= I(() => {}, ["stop"]),
|
|
1141
|
+
onDblclick: n[5] ||= I(() => {}, ["stop"]),
|
|
1010
1142
|
onKeydown: f,
|
|
1011
|
-
onWheel: n[6] ||=
|
|
1143
|
+
onWheel: n[6] ||= I(() => {}, ["stop"])
|
|
1012
1144
|
}, [c("input", {
|
|
1013
1145
|
class: "media-control-range media-control-seek",
|
|
1014
1146
|
type: "range",
|
|
@@ -1021,35 +1153,35 @@ var ft = /* @__PURE__ */ d({
|
|
|
1021
1153
|
"aria-valuetext": `${u(g.value)} of ${u(p.value)}`,
|
|
1022
1154
|
disabled: p.value <= 0,
|
|
1023
1155
|
onInput: n[0] ||= (e) => i("seek", d(e))
|
|
1024
|
-
}, null, 44,
|
|
1156
|
+
}, null, 44, wt), e.layout === "reel" ? (w(), s("div", Tt, [
|
|
1025
1157
|
c("button", {
|
|
1026
1158
|
type: "button",
|
|
1027
1159
|
class: "media-control-button media-control-playback",
|
|
1028
1160
|
"aria-label": e.playing ? `Pause ${m.value}` : `Play ${m.value}`,
|
|
1029
1161
|
title: e.playing ? "Pause" : "Play",
|
|
1030
1162
|
onClick: n[1] ||= (e) => i("togglePlayback")
|
|
1031
|
-
}, [e.playing ? (w(), a(M(
|
|
1163
|
+
}, [e.playing ? (w(), a(M(dt), {
|
|
1032
1164
|
key: 0,
|
|
1033
1165
|
size: 18,
|
|
1034
1166
|
fill: "currentColor"
|
|
1035
|
-
})) : (w(), a(M(
|
|
1167
|
+
})) : (w(), a(M(ft), {
|
|
1036
1168
|
key: 1,
|
|
1037
1169
|
size: 18,
|
|
1038
1170
|
fill: "currentColor"
|
|
1039
|
-
}))], 8,
|
|
1040
|
-
c("div",
|
|
1171
|
+
}))], 8, Et),
|
|
1172
|
+
c("div", Dt, [c("button", {
|
|
1041
1173
|
type: "button",
|
|
1042
1174
|
class: "media-control-button",
|
|
1043
1175
|
"aria-label": e.muted ? `Unmute ${m.value}` : `Mute ${m.value}`,
|
|
1044
1176
|
title: e.muted ? "Unmute" : "Mute",
|
|
1045
1177
|
onClick: n[2] ||= (e) => i("toggleMute")
|
|
1046
|
-
}, [e.muted || e.volume === 0 ? (w(), a(M(
|
|
1178
|
+
}, [e.muted || e.volume === 0 ? (w(), a(M(mt), {
|
|
1047
1179
|
key: 0,
|
|
1048
1180
|
size: 18
|
|
1049
|
-
})) : (w(), a(M(
|
|
1181
|
+
})) : (w(), a(M(pt), {
|
|
1050
1182
|
key: 1,
|
|
1051
1183
|
size: 18
|
|
1052
|
-
}))], 8,
|
|
1184
|
+
}))], 8, Ot), c("input", {
|
|
1053
1185
|
class: "media-control-range media-control-volume",
|
|
1054
1186
|
type: "range",
|
|
1055
1187
|
min: "0",
|
|
@@ -1060,15 +1192,15 @@ var ft = /* @__PURE__ */ d({
|
|
|
1060
1192
|
"aria-label": `${h.value} volume`,
|
|
1061
1193
|
"aria-valuetext": `${Math.round(e.volume * 100)} percent`,
|
|
1062
1194
|
onInput: n[3] ||= (e) => i("volumeChange", d(e))
|
|
1063
|
-
}, null, 44,
|
|
1064
|
-
c("output",
|
|
1065
|
-
])) : o("", !0)], 42,
|
|
1195
|
+
}, null, 44, kt)]),
|
|
1196
|
+
c("output", At, A(u(g.value)) + " / " + A(u(p.value)), 1)
|
|
1197
|
+
])) : o("", !0)], 42, Ct));
|
|
1066
1198
|
}
|
|
1067
|
-
}),
|
|
1199
|
+
}), Mt = {
|
|
1068
1200
|
key: 0,
|
|
1069
1201
|
class: "media-card-overlay-host",
|
|
1070
1202
|
"data-test": "media-card-overlay"
|
|
1071
|
-
},
|
|
1203
|
+
}, Nt = /* @__PURE__ */ d({
|
|
1072
1204
|
__name: "MediaContextOverlay",
|
|
1073
1205
|
props: {
|
|
1074
1206
|
item: {},
|
|
@@ -1078,7 +1210,7 @@ var ft = /* @__PURE__ */ d({
|
|
|
1078
1210
|
mediaSource: {}
|
|
1079
1211
|
},
|
|
1080
1212
|
setup(e) {
|
|
1081
|
-
return (t, n) => e.mediaCard?.overlay?.component ? (w(), s("div",
|
|
1213
|
+
return (t, n) => e.mediaCard?.overlay?.component ? (w(), s("div", Mt, [(w(), a(D(e.mediaCard.overlay.component), {
|
|
1082
1214
|
item: e.item,
|
|
1083
1215
|
"media-index": e.mediaIndex,
|
|
1084
1216
|
"media-item": e.mediaItem,
|
|
@@ -1090,26 +1222,26 @@ var ft = /* @__PURE__ */ d({
|
|
|
1090
1222
|
"media-source"
|
|
1091
1223
|
]))])) : o("", !0);
|
|
1092
1224
|
}
|
|
1093
|
-
}),
|
|
1094
|
-
function
|
|
1225
|
+
}), Pt = 40, Ft = 160, It = 24;
|
|
1226
|
+
function Lt(e) {
|
|
1095
1227
|
let t = k("next"), n = null, r = 0, i = !1, a = null, o = null;
|
|
1096
1228
|
function s(n, r) {
|
|
1097
|
-
let i =
|
|
1229
|
+
let i = G(e.item()).length, a = (n + i) % i;
|
|
1098
1230
|
a !== e.mediaIndex() && (t.value = n < e.mediaIndex() ? "previous" : "next", e.onChange(a), r?.detail && r.detail > 0 && r.currentTarget?.blur());
|
|
1099
1231
|
}
|
|
1100
1232
|
function c() {
|
|
1101
1233
|
r = 0, i = !1, n !== null && clearTimeout(n), n = null;
|
|
1102
1234
|
}
|
|
1103
1235
|
function l() {
|
|
1104
|
-
n !== null && clearTimeout(n), n = setTimeout(c,
|
|
1236
|
+
n !== null && clearTimeout(n), n = setTimeout(c, Ft);
|
|
1105
1237
|
}
|
|
1106
1238
|
function u(e, t, n) {
|
|
1107
1239
|
return t === 1 ? e * 16 : t === 2 ? e * n : e;
|
|
1108
1240
|
}
|
|
1109
1241
|
function d(t) {
|
|
1110
|
-
if (
|
|
1242
|
+
if (G(e.item()).length <= 1) return;
|
|
1111
1243
|
let n = t.currentTarget, a = u(t.deltaX, t.deltaMode, n?.clientWidth || 1);
|
|
1112
|
-
if (a === 0 || (t.preventDefault(), l(), i) || (r += a, Math.abs(r) <
|
|
1244
|
+
if (a === 0 || (t.preventDefault(), l(), i) || (r += a, Math.abs(r) < It)) return;
|
|
1113
1245
|
let o = Math.sign(r);
|
|
1114
1246
|
r = 0, i = !0, s(e.mediaIndex() + o);
|
|
1115
1247
|
}
|
|
@@ -1121,7 +1253,7 @@ function jt(e) {
|
|
|
1121
1253
|
let n = t.changedTouches[0];
|
|
1122
1254
|
if (a === null || o === null || !n) return;
|
|
1123
1255
|
let r = a - n.clientX, i = o - n.clientY;
|
|
1124
|
-
a = null, o = null, !(Math.abs(r) <= Math.abs(i)) && (Math.abs(r) <
|
|
1256
|
+
a = null, o = null, !(Math.abs(r) <= Math.abs(i)) && (Math.abs(r) < Pt || s(e.mediaIndex() + Math.sign(r)));
|
|
1125
1257
|
}
|
|
1126
1258
|
return S(c), {
|
|
1127
1259
|
change: s,
|
|
@@ -1131,14 +1263,14 @@ function jt(e) {
|
|
|
1131
1263
|
onWheel: d
|
|
1132
1264
|
};
|
|
1133
1265
|
}
|
|
1134
|
-
var
|
|
1135
|
-
function
|
|
1266
|
+
var Rt = /* @__PURE__ */ new Map(), zt = [], Bt = 0, Vt = 0;
|
|
1267
|
+
function Ht(e, t) {
|
|
1136
1268
|
return `${t ? "timed" : "image"}:${e}`;
|
|
1137
1269
|
}
|
|
1138
|
-
function
|
|
1139
|
-
let r =
|
|
1270
|
+
function Ut(e, t, n) {
|
|
1271
|
+
let r = G(e);
|
|
1140
1272
|
if (r.length < 2) return [];
|
|
1141
|
-
let i =
|
|
1273
|
+
let i = K(e, t), a = [];
|
|
1142
1274
|
for (let e = 1; e < r.length; e += 1) {
|
|
1143
1275
|
let t = i + e, n = i - e;
|
|
1144
1276
|
t < r.length && a.push(t), n >= 0 && a.push(n);
|
|
@@ -1147,9 +1279,9 @@ function Lt(e, t, n) {
|
|
|
1147
1279
|
return a.flatMap((e) => {
|
|
1148
1280
|
let t = r[e];
|
|
1149
1281
|
if (!t) return [];
|
|
1150
|
-
let i =
|
|
1282
|
+
let i = V(t.type, t.src) === "audio" ? W(t) : te(t, n);
|
|
1151
1283
|
if (!i) return [];
|
|
1152
|
-
let a =
|
|
1284
|
+
let a = H(i.type, i.src), s = Ht(i.src, a);
|
|
1153
1285
|
return o.has(s) ? [] : (o.add(s), [{
|
|
1154
1286
|
key: s,
|
|
1155
1287
|
src: i.src,
|
|
@@ -1157,22 +1289,22 @@ function Lt(e, t, n) {
|
|
|
1157
1289
|
}]);
|
|
1158
1290
|
});
|
|
1159
1291
|
}
|
|
1160
|
-
function
|
|
1292
|
+
function Wt(e) {
|
|
1161
1293
|
let t = e.element;
|
|
1162
1294
|
e.element = null, t && (t instanceof HTMLVideoElement ? (t.pause(), t.removeAttribute("src"), t.load()) : t.removeAttribute("src"));
|
|
1163
1295
|
}
|
|
1164
|
-
function
|
|
1165
|
-
|
|
1166
|
-
let t =
|
|
1167
|
-
t >= 0 &&
|
|
1296
|
+
function Gt(e) {
|
|
1297
|
+
Rt.delete(e.key);
|
|
1298
|
+
let t = zt.indexOf(e);
|
|
1299
|
+
t >= 0 && zt.splice(t, 1), e.cancel?.(), e.cancel = null, Wt(e);
|
|
1168
1300
|
}
|
|
1169
|
-
function
|
|
1170
|
-
e.state = "loading",
|
|
1301
|
+
function Kt(e) {
|
|
1302
|
+
e.state = "loading", Bt += 1, e.timed && (Vt += 1);
|
|
1171
1303
|
let t = !1, n = () => void 0, r = (r) => {
|
|
1172
|
-
t || (t = !0, n(), --
|
|
1304
|
+
t || (t = !0, n(), --Bt, e.timed && --Vt, e.cancel = null, e.state = r, r === "failed" && Wt(e), e.refs === 0 && Gt(e), qt());
|
|
1173
1305
|
};
|
|
1174
1306
|
if (e.cancel = () => {
|
|
1175
|
-
t || (t = !0, n(), --
|
|
1307
|
+
t || (t = !0, n(), --Bt, e.timed && --Vt, Wt(e), qt());
|
|
1176
1308
|
}, e.timed) {
|
|
1177
1309
|
let t = document.createElement("video"), i = () => r("ready"), a = () => r("failed");
|
|
1178
1310
|
n = () => {
|
|
@@ -1191,49 +1323,49 @@ function Bt(e) {
|
|
|
1191
1323
|
i.removeEventListener("load", a), i.removeEventListener("error", o);
|
|
1192
1324
|
}, i.addEventListener("load", a, { once: !0 }), i.addEventListener("error", o, { once: !0 }), i.decoding = "async", i.fetchPriority = "low", i.src = e.src, e.element = i;
|
|
1193
1325
|
}
|
|
1194
|
-
function
|
|
1195
|
-
for (;
|
|
1196
|
-
let e =
|
|
1326
|
+
function qt() {
|
|
1327
|
+
for (; Bt < 6;) {
|
|
1328
|
+
let e = zt.findIndex((e) => e.refs > 0 && e.state === "queued" && (!e.timed || Vt < 2));
|
|
1197
1329
|
if (e < 0) return;
|
|
1198
|
-
let [t] =
|
|
1199
|
-
t &&
|
|
1330
|
+
let [t] = zt.splice(e, 1);
|
|
1331
|
+
t && Kt(t);
|
|
1200
1332
|
}
|
|
1201
1333
|
}
|
|
1202
|
-
function
|
|
1203
|
-
let t =
|
|
1334
|
+
function Jt(e) {
|
|
1335
|
+
let t = Rt.get(e.key);
|
|
1204
1336
|
t || (t = {
|
|
1205
1337
|
...e,
|
|
1206
1338
|
cancel: null,
|
|
1207
1339
|
element: null,
|
|
1208
1340
|
refs: 0,
|
|
1209
1341
|
state: "queued"
|
|
1210
|
-
},
|
|
1342
|
+
}, Rt.set(t.key, t), zt.push(t)), t.refs += 1, qt();
|
|
1211
1343
|
let n = !1;
|
|
1212
1344
|
return () => {
|
|
1213
|
-
n || (n = !0, --t.refs, t.refs === 0 &&
|
|
1345
|
+
n || (n = !0, --t.refs, t.refs === 0 && Gt(t));
|
|
1214
1346
|
};
|
|
1215
1347
|
}
|
|
1216
1348
|
//#endregion
|
|
1217
1349
|
//#region src/components/useVisiblePostPreload.ts
|
|
1218
|
-
function
|
|
1219
|
-
let t = r(() => e.layout() === "masonry" && e.inViewport() && e.mediaReady() && e.mediaCard()?.feedPreload === "visible-post"), n = r(() => t.value ?
|
|
1350
|
+
function Yt(e) {
|
|
1351
|
+
let t = r(() => e.layout() === "masonry" && e.inViewport() && e.mediaReady() && e.mediaCard()?.feedPreload === "visible-post"), n = r(() => t.value ? Ut(e.item(), e.mediaIndex(), e.mediaSource()) : []), i = /* @__PURE__ */ new Map();
|
|
1220
1352
|
function a() {
|
|
1221
1353
|
let e = new Map(n.value.map((e) => [e.key, e]));
|
|
1222
1354
|
i.forEach((t, n) => {
|
|
1223
1355
|
e.has(n) || (t(), i.delete(n));
|
|
1224
1356
|
}), n.value.forEach((e) => {
|
|
1225
|
-
i.has(e.key) || i.set(e.key,
|
|
1357
|
+
i.has(e.key) || i.set(e.key, Jt(e));
|
|
1226
1358
|
});
|
|
1227
1359
|
}
|
|
1228
|
-
|
|
1360
|
+
N(() => n.value.map(({ key: e }) => e).join("\n"), a, { immediate: !0 }), S(() => {
|
|
1229
1361
|
i.forEach((e) => e()), i.clear();
|
|
1230
1362
|
});
|
|
1231
1363
|
}
|
|
1232
1364
|
//#endregion
|
|
1233
1365
|
//#region src/components/useMediaLoading.ts
|
|
1234
|
-
function
|
|
1235
|
-
let t = r(() =>
|
|
1236
|
-
return
|
|
1366
|
+
function Xt(e) {
|
|
1367
|
+
let t = r(() => H(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");
|
|
1368
|
+
return N(i, (t, n) => {
|
|
1237
1369
|
n !== "none" || t === "none" || v(() => e.mediaElement.value?.load());
|
|
1238
1370
|
}), {
|
|
1239
1371
|
imageLoading: n,
|
|
@@ -1243,7 +1375,7 @@ function Wt(e) {
|
|
|
1243
1375
|
}
|
|
1244
1376
|
//#endregion
|
|
1245
1377
|
//#region src/components/useMediaReadiness.ts
|
|
1246
|
-
function
|
|
1378
|
+
function Zt(e) {
|
|
1247
1379
|
let t = k(null), n = k(null), i = k(0), a = k(0), o = k(!0), s = k(!1), c = k(!1), l = null, u = !1, d = !1, f = !1, p = r(() => c.value || s.value ? "error" : o.value ? "loading" : e.previewState());
|
|
1248
1380
|
function m() {
|
|
1249
1381
|
l !== null && clearTimeout(l), l = null;
|
|
@@ -1286,7 +1418,7 @@ function Gt(e) {
|
|
|
1286
1418
|
function C(e) {
|
|
1287
1419
|
h(e) && o.value && g();
|
|
1288
1420
|
}
|
|
1289
|
-
return
|
|
1421
|
+
return N(e.identity, () => {
|
|
1290
1422
|
m(), i.value += 1, d = !1, a.value = 0, o.value = u || e.previewState() === "loading", s.value = !1, c.value = !1, u = !0, v(y);
|
|
1291
1423
|
}, { immediate: !0 }), S(() => {
|
|
1292
1424
|
f = !0, m();
|
|
@@ -1304,30 +1436,30 @@ function Gt(e) {
|
|
|
1304
1436
|
}
|
|
1305
1437
|
//#endregion
|
|
1306
1438
|
//#region src/core/reelAudio.ts
|
|
1307
|
-
var
|
|
1439
|
+
var Qt = {
|
|
1308
1440
|
lastAudibleVolume: 1,
|
|
1309
1441
|
muted: !1,
|
|
1310
1442
|
volume: 1
|
|
1311
1443
|
};
|
|
1312
|
-
function
|
|
1444
|
+
function $t(e, t) {
|
|
1313
1445
|
return typeof e == "number" && Number.isFinite(e) ? Math.min(1, Math.max(0, e)) : t;
|
|
1314
1446
|
}
|
|
1315
|
-
function
|
|
1316
|
-
let n =
|
|
1447
|
+
function en(e, t = Qt) {
|
|
1448
|
+
let n = $t(e?.volume, t.volume), r = $t(e?.lastAudibleVolume, n > 0 ? n : t.lastAudibleVolume);
|
|
1317
1449
|
return {
|
|
1318
|
-
lastAudibleVolume: r > 0 ? r :
|
|
1450
|
+
lastAudibleVolume: r > 0 ? r : Qt.lastAudibleVolume,
|
|
1319
1451
|
muted: typeof e?.muted == "boolean" ? e.muted : n === 0 || t.muted,
|
|
1320
1452
|
volume: n
|
|
1321
1453
|
};
|
|
1322
1454
|
}
|
|
1323
1455
|
//#endregion
|
|
1324
1456
|
//#region src/components/useMediaCardAudio.ts
|
|
1325
|
-
function
|
|
1326
|
-
let t =
|
|
1457
|
+
function tn(e) {
|
|
1458
|
+
let t = en(e.reelAudioState()), n = e.layout() === "reel" && e.reelAudioState(), r = k(n ? t.muted : e.mediaCard()?.videoMuted ?? e.layout() === "masonry"), i = k(n ? t.volume : 1), a = n ? t.lastAudibleVolume : 1;
|
|
1327
1459
|
function o() {
|
|
1328
1460
|
let t = e.mediaElement.value, n = e.reelAudioState();
|
|
1329
1461
|
if (!t || e.layout() !== "reel" || !n) return;
|
|
1330
|
-
let o =
|
|
1462
|
+
let o = en(n);
|
|
1331
1463
|
a = o.lastAudibleVolume, i.value = o.volume, r.value = o.muted, t.volume = o.volume, t.muted = e.active() === !1 ? !0 : o.muted;
|
|
1332
1464
|
}
|
|
1333
1465
|
function s(e, t) {
|
|
@@ -1335,7 +1467,7 @@ function Yt(e) {
|
|
|
1335
1467
|
}
|
|
1336
1468
|
function c(t) {
|
|
1337
1469
|
if (e.layout() !== "reel") return;
|
|
1338
|
-
let n =
|
|
1470
|
+
let n = en({
|
|
1339
1471
|
lastAudibleVolume: a,
|
|
1340
1472
|
muted: t.muted,
|
|
1341
1473
|
volume: t.volume
|
|
@@ -1352,7 +1484,7 @@ function Yt(e) {
|
|
|
1352
1484
|
let t = e.mediaElement.value;
|
|
1353
1485
|
t && (t.muted && t.volume === 0 && (t.volume = a), t.muted = !t.muted, s(t, !0), c(t));
|
|
1354
1486
|
}
|
|
1355
|
-
return
|
|
1487
|
+
return N([
|
|
1356
1488
|
e.active,
|
|
1357
1489
|
e.layout,
|
|
1358
1490
|
() => e.reelAudioState()?.lastAudibleVolume,
|
|
@@ -1370,7 +1502,7 @@ function Yt(e) {
|
|
|
1370
1502
|
}
|
|
1371
1503
|
//#endregion
|
|
1372
1504
|
//#region src/components/useReelVideoActivity.ts
|
|
1373
|
-
function
|
|
1505
|
+
function nn(e) {
|
|
1374
1506
|
let t = r(() => e.layout() === "reel" ? e.active() === !0 : e.inViewport()), n = r(() => t.value ? e.mediaIsMuted.value : !0);
|
|
1375
1507
|
function i() {
|
|
1376
1508
|
if (!t.value) {
|
|
@@ -1379,7 +1511,7 @@ function Xt(e) {
|
|
|
1379
1511
|
}
|
|
1380
1512
|
e.mediaIsPlaying.value = !0;
|
|
1381
1513
|
}
|
|
1382
|
-
return
|
|
1514
|
+
return N(t, (n) => {
|
|
1383
1515
|
let r = e.mediaElement.value;
|
|
1384
1516
|
if (!n) {
|
|
1385
1517
|
r?.pause(), r && (r.muted = !0), e.mediaIsPlaying.value = !1;
|
|
@@ -1404,18 +1536,18 @@ function Xt(e) {
|
|
|
1404
1536
|
}
|
|
1405
1537
|
//#endregion
|
|
1406
1538
|
//#region src/components/useTimedMediaCard.ts
|
|
1407
|
-
function
|
|
1539
|
+
function rn(e) {
|
|
1408
1540
|
return Number.isFinite(e) ? Math.max(0, e) : 0;
|
|
1409
1541
|
}
|
|
1410
|
-
function
|
|
1411
|
-
let t = k(0), n = k(0), r = k(!1), { apply: i, setVolume: a, sync: o, toggleMute: s, videoIsMuted: c, videoVolume: l } =
|
|
1542
|
+
function an(e) {
|
|
1543
|
+
let t = k(0), n = k(0), r = k(!1), { apply: i, setVolume: a, sync: o, toggleMute: s, videoIsMuted: c, videoVolume: l } = tn({
|
|
1412
1544
|
active: e.active,
|
|
1413
1545
|
layout: e.layout,
|
|
1414
1546
|
mediaCard: e.mediaCard,
|
|
1415
1547
|
mediaElement: e.mediaElement,
|
|
1416
1548
|
onChange: e.onAudioChange,
|
|
1417
1549
|
reelAudioState: e.reelAudioState
|
|
1418
|
-
}), { effectiveMuted: u, onPlaying: d, playbackAllowed: f } =
|
|
1550
|
+
}), { effectiveMuted: u, onPlaying: d, playbackAllowed: f } = nn({
|
|
1419
1551
|
active: e.active,
|
|
1420
1552
|
inViewport: e.inViewport,
|
|
1421
1553
|
layout: e.layout,
|
|
@@ -1425,7 +1557,7 @@ function Qt(e) {
|
|
|
1425
1557
|
});
|
|
1426
1558
|
function p(r) {
|
|
1427
1559
|
let i = r?.currentTarget ?? e.mediaElement.value;
|
|
1428
|
-
i && (t.value =
|
|
1560
|
+
i && (t.value = rn(i.currentTime), n.value = rn(i.duration), o(i, f.value));
|
|
1429
1561
|
}
|
|
1430
1562
|
function m(t) {
|
|
1431
1563
|
i(), p(t), e.onReady(t);
|
|
@@ -1435,7 +1567,7 @@ function Qt(e) {
|
|
|
1435
1567
|
}
|
|
1436
1568
|
function g(n) {
|
|
1437
1569
|
let r = e.mediaElement.value;
|
|
1438
|
-
!r || !Number.isFinite(n) || (r.currentTime = Math.min(
|
|
1570
|
+
!r || !Number.isFinite(n) || (r.currentTime = Math.min(rn(r.duration), Math.max(0, n)), t.value = r.currentTime);
|
|
1439
1571
|
}
|
|
1440
1572
|
async function _() {
|
|
1441
1573
|
let t = e.mediaElement.value;
|
|
@@ -1451,7 +1583,7 @@ function Qt(e) {
|
|
|
1451
1583
|
}
|
|
1452
1584
|
}
|
|
1453
1585
|
}
|
|
1454
|
-
return
|
|
1586
|
+
return N(e.mediaElement, () => {
|
|
1455
1587
|
t.value = 0, n.value = 0, r.value = !1;
|
|
1456
1588
|
}, { flush: "sync" }), {
|
|
1457
1589
|
currentTime: t,
|
|
@@ -1473,7 +1605,7 @@ function Qt(e) {
|
|
|
1473
1605
|
}
|
|
1474
1606
|
//#endregion
|
|
1475
1607
|
//#region src/components/MediaCard.vue?vue&type=script&setup=true&lang.ts
|
|
1476
|
-
var
|
|
1608
|
+
var on = [
|
|
1477
1609
|
"data-post-id",
|
|
1478
1610
|
"data-media-index",
|
|
1479
1611
|
"aria-hidden",
|
|
@@ -1481,19 +1613,19 @@ var $t = [
|
|
|
1481
1613
|
"inert",
|
|
1482
1614
|
"role",
|
|
1483
1615
|
"tabindex"
|
|
1484
|
-
],
|
|
1616
|
+
], sn = { class: "media-card-content" }, cn = ["data-media-direction"], ln = ["data-media-index"], un = {
|
|
1485
1617
|
key: 0,
|
|
1486
1618
|
"data-test": "media-loading",
|
|
1487
1619
|
class: "media-loading",
|
|
1488
1620
|
"aria-hidden": "true"
|
|
1489
|
-
},
|
|
1621
|
+
}, dn = [
|
|
1490
1622
|
"data-source-generation",
|
|
1491
1623
|
"src",
|
|
1492
1624
|
"autoplay",
|
|
1493
1625
|
"loop",
|
|
1494
1626
|
"muted",
|
|
1495
1627
|
"preload"
|
|
1496
|
-
],
|
|
1628
|
+
], fn = ["aria-label", "disabled"], pn = [
|
|
1497
1629
|
"data-cover-identity",
|
|
1498
1630
|
"data-source-generation",
|
|
1499
1631
|
"src",
|
|
@@ -1501,11 +1633,11 @@ var $t = [
|
|
|
1501
1633
|
"height",
|
|
1502
1634
|
"fetchpriority",
|
|
1503
1635
|
"loading"
|
|
1504
|
-
],
|
|
1636
|
+
], mn = {
|
|
1505
1637
|
key: 1,
|
|
1506
1638
|
class: "media-audio-fallback",
|
|
1507
1639
|
"aria-hidden": "true"
|
|
1508
|
-
},
|
|
1640
|
+
}, hn = [
|
|
1509
1641
|
"data-source-generation",
|
|
1510
1642
|
"src",
|
|
1511
1643
|
"width",
|
|
@@ -1514,14 +1646,14 @@ var $t = [
|
|
|
1514
1646
|
"loop",
|
|
1515
1647
|
"muted",
|
|
1516
1648
|
"preload"
|
|
1517
|
-
],
|
|
1649
|
+
], gn = [
|
|
1518
1650
|
"data-source-generation",
|
|
1519
1651
|
"src",
|
|
1520
1652
|
"width",
|
|
1521
1653
|
"height",
|
|
1522
1654
|
"fetchpriority",
|
|
1523
1655
|
"loading"
|
|
1524
|
-
],
|
|
1656
|
+
], _n = ["aria-label"], vn = ["aria-label"], yn = ["aria-label"], bn = /* @__PURE__ */ d({
|
|
1525
1657
|
__name: "MediaCard",
|
|
1526
1658
|
props: {
|
|
1527
1659
|
active: { type: Boolean },
|
|
@@ -1537,7 +1669,7 @@ var $t = [
|
|
|
1537
1669
|
interactive: { type: Boolean },
|
|
1538
1670
|
leaving: { type: Boolean },
|
|
1539
1671
|
layout: {},
|
|
1540
|
-
loadedCount: {},
|
|
1672
|
+
loadedCount: { type: [Number, Function] },
|
|
1541
1673
|
mediaIndex: {},
|
|
1542
1674
|
mediaCard: {},
|
|
1543
1675
|
mediaSource: {},
|
|
@@ -1561,7 +1693,7 @@ var $t = [
|
|
|
1561
1693
|
function f(e = !1, t = "pointer") {
|
|
1562
1694
|
e && d("activate", t);
|
|
1563
1695
|
}
|
|
1564
|
-
let p = r(() =>
|
|
1696
|
+
let p = r(() => G(l.item)), m = r(() => K(l.item, l.mediaIndex)), h = r(() => re(l.item, m.value)), g = r(() => te(h.value, l.mediaSource ?? "preview")), _ = r(() => V(h.value.type, h.value.src)), b = r(() => _.value === "audio"), S = r(() => ne(h.value, l.mediaSource ?? "preview")), C = r(() => b.value ? S.value : g.value), T = r(() => C.value.src), E = r(() => V(C.value.type, C.value.src)), D = r(() => g.value.width), O = r(() => g.value.height), A = r(() => W(h.value)), j = r(() => `${l.item.postId}:${m.value}:${A.value?.src ?? ""}`), ee = k(!1), L = r(() => ee.value ? null : A.value), { effectivePreviewState: R, failSourceAttempt: z, imageElement: B, markSourceReady: H, noteSourceActivity: U, retrySource: q, retrying: ie, sourceGeneration: J, mediaElement: Y } = Zt({
|
|
1565
1697
|
identity: () => `${l.item.postId}:${m.value}:${l.mediaSource ?? "preview"}:${T.value}:${E.value ?? ""}`,
|
|
1566
1698
|
mediaIndex: () => m.value,
|
|
1567
1699
|
onError: (e, t) => {
|
|
@@ -1576,79 +1708,79 @@ var $t = [
|
|
|
1576
1708
|
onReady: (e) => d("ready", e),
|
|
1577
1709
|
previewState: () => l.previewState
|
|
1578
1710
|
});
|
|
1579
|
-
|
|
1711
|
+
Yt({
|
|
1580
1712
|
inViewport: () => l.inViewport === !0,
|
|
1581
1713
|
item: () => l.item,
|
|
1582
1714
|
layout: () => l.layout,
|
|
1583
1715
|
mediaCard: () => l.mediaCard,
|
|
1584
1716
|
mediaIndex: () => m.value,
|
|
1585
|
-
mediaReady: () =>
|
|
1717
|
+
mediaReady: () => R.value === "ready",
|
|
1586
1718
|
mediaSource: () => l.mediaSource ?? "preview"
|
|
1587
1719
|
});
|
|
1588
|
-
let { currentTime:
|
|
1720
|
+
let { currentTime: ae, duration: oe, effectiveMuted: se, isMuted: X, isPlaying: Z, onEnded: ce, onLoadedMetadata: le, onPlaying: Q, playbackAllowed: ue, seek: de, setVolume: fe, sync: $, toggleMute: pe, togglePlayback: me, volume: he } = an({
|
|
1589
1721
|
active: () => l.active,
|
|
1590
1722
|
inViewport: () => l.inViewport === !0,
|
|
1591
1723
|
layout: () => l.layout,
|
|
1592
1724
|
mediaCard: () => l.mediaCard,
|
|
1593
|
-
mediaElement:
|
|
1725
|
+
mediaElement: Y,
|
|
1594
1726
|
onAudioChange: (e) => d("reelAudioChange", e),
|
|
1595
1727
|
onEnded: () => d("ended", m.value),
|
|
1596
|
-
onReady:
|
|
1728
|
+
onReady: H,
|
|
1597
1729
|
reelAudioState: () => l.reelAudioState
|
|
1598
1730
|
}), ge = r(() => l.interactive && !!(l.cardHeader || l.cardFooter));
|
|
1599
1731
|
function _e(e) {
|
|
1600
1732
|
return e.detail === 0 ? "keyboard" : "pointer";
|
|
1601
1733
|
}
|
|
1602
|
-
let { change: ve, direction: ye, onTouchEnd: be, onTouchStart: xe, onWheel: Se } =
|
|
1734
|
+
let { change: ve, direction: ye, onTouchEnd: be, onTouchStart: xe, onWheel: Se } = Lt({
|
|
1603
1735
|
item: () => l.item,
|
|
1604
1736
|
layout: () => l.layout,
|
|
1605
1737
|
mediaIndex: () => m.value,
|
|
1606
1738
|
onChange: (e) => d("mediaChange", e)
|
|
1607
|
-
}), { imageLoading: Ce, mediaIsTimed: we, timedMediaPreload: Te } =
|
|
1739
|
+
}), { imageLoading: Ce, mediaIsTimed: we, timedMediaPreload: Te } = Xt({
|
|
1608
1740
|
active: () => l.active,
|
|
1609
1741
|
fetchPriority: () => l.fetchPriority,
|
|
1610
1742
|
layout: () => l.layout,
|
|
1611
1743
|
mediaSource: () => T.value,
|
|
1612
1744
|
mediaType: () => E.value,
|
|
1613
|
-
mediaElement:
|
|
1614
|
-
}), Ee = r(() => l.layout === "reel" && l.stationaryReelControls === !0), De = r(() => we.value && (!b.value || l.layout === "reel") &&
|
|
1745
|
+
mediaElement: Y
|
|
1746
|
+
}), Ee = r(() => l.layout === "reel" && l.stationaryReelControls === !0), De = r(() => we.value && (!b.value || l.layout === "reel") && R.value === "ready" && (!Ee.value || !!(l.active && l.reelControlsTarget))), Oe = r(() => `${l.item.postId}:${m.value}:${T.value}`);
|
|
1615
1747
|
function ke(e) {
|
|
1616
1748
|
l.layout === "reel" && (e.stopPropagation(), me());
|
|
1617
1749
|
}
|
|
1618
1750
|
function Ae(e) {
|
|
1619
|
-
e.currentTarget.dataset.coverIdentity !== j.value ||
|
|
1751
|
+
e.currentTarget.dataset.coverIdentity !== j.value || ee.value || (d("mediaError", {
|
|
1620
1752
|
mediaIndex: m.value,
|
|
1621
1753
|
source: "preview",
|
|
1622
1754
|
src: A.value?.src ?? ""
|
|
1623
|
-
}),
|
|
1755
|
+
}), ee.value = !0, l.layout === "masonry" && H());
|
|
1624
1756
|
}
|
|
1625
|
-
return
|
|
1626
|
-
|
|
1627
|
-
}),
|
|
1757
|
+
return N(j, () => {
|
|
1758
|
+
ee.value = !1;
|
|
1759
|
+
}), N([
|
|
1628
1760
|
b,
|
|
1629
1761
|
() => l.layout,
|
|
1630
|
-
|
|
1762
|
+
L
|
|
1631
1763
|
], ([e, t, n]) => {
|
|
1632
|
-
e && t === "masonry" && !n && v(() =>
|
|
1764
|
+
e && t === "masonry" && !n && v(() => H());
|
|
1633
1765
|
}, { immediate: !0 }), (r, i) => (w(), s("article", {
|
|
1634
1766
|
"data-post-id": e.item.postId,
|
|
1635
1767
|
"data-media-index": m.value,
|
|
1636
1768
|
class: y(["media-card", {
|
|
1637
1769
|
"media-card--entering": e.entering,
|
|
1638
1770
|
"media-card--leaving": e.leaving,
|
|
1639
|
-
"media-card--error": M(
|
|
1771
|
+
"media-card--error": M(R) === "error",
|
|
1640
1772
|
"media-card--transparent-chrome": e.mediaCard?.header?.background === "transparent" || e.mediaCard?.footer?.background === "transparent" || e.cardHeader?.background === "transparent" || e.cardFooter?.background === "transparent"
|
|
1641
1773
|
}]),
|
|
1642
1774
|
style: x(e.itemStyle),
|
|
1643
1775
|
"aria-hidden": e.leaving || void 0,
|
|
1644
|
-
"aria-busy": M(
|
|
1776
|
+
"aria-busy": M(R) === "loading" || M(ie),
|
|
1645
1777
|
inert: e.leaving || void 0,
|
|
1646
1778
|
role: e.interactive && !e.leaving && !ge.value ? "button" : void 0,
|
|
1647
1779
|
tabindex: e.interactive && !e.leaving && !ge.value ? 0 : void 0,
|
|
1648
1780
|
onClick: i[34] ||= (t) => f(e.interactive && !ge.value, _e(t)),
|
|
1649
|
-
onKeydown: [i[35] ||=
|
|
1650
|
-
}, [c("div",
|
|
1651
|
-
e.cardHeader ? (w(), a(
|
|
1781
|
+
onKeydown: [i[35] ||= F((t) => f(e.interactive && !ge.value, "keyboard"), ["enter"]), i[36] ||= F(I((t) => f(e.interactive && !ge.value, "keyboard"), ["prevent"]), ["space"])]
|
|
1782
|
+
}, [c("div", sn, [
|
|
1783
|
+
e.cardHeader ? (w(), a(vt, {
|
|
1652
1784
|
key: 0,
|
|
1653
1785
|
index: e.index,
|
|
1654
1786
|
item: e.item,
|
|
@@ -1679,21 +1811,21 @@ var $t = [
|
|
|
1679
1811
|
onTouchendPassive: i[33] ||= (...e) => M(be) && M(be)(...e)
|
|
1680
1812
|
}, [
|
|
1681
1813
|
u(n, {
|
|
1682
|
-
css: !M(
|
|
1814
|
+
css: !M(ie),
|
|
1683
1815
|
name: `media-slide-${M(ye)}`
|
|
1684
1816
|
}, {
|
|
1685
|
-
default:
|
|
1686
|
-
key: `${e.item.postId}:${h.value.src}:${e.mediaSource ?? "preview"}:${M(
|
|
1817
|
+
default: P(() => [(w(), s("div", {
|
|
1818
|
+
key: `${e.item.postId}:${h.value.src}:${e.mediaSource ?? "preview"}:${M(J)}`,
|
|
1687
1819
|
class: "media-card-frame",
|
|
1688
1820
|
"data-media-index": m.value
|
|
1689
1821
|
}, [
|
|
1690
|
-
M(
|
|
1822
|
+
M(R) === "loading" ? (w(), s("div", un, [...i[37] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : M(R) === "error" ? (w(), a(St, {
|
|
1691
1823
|
key: 1,
|
|
1692
1824
|
component: e.mediaCard?.error?.component,
|
|
1693
|
-
label: M(
|
|
1694
|
-
retrying: M(
|
|
1695
|
-
status: M(
|
|
1696
|
-
onRetry: M(
|
|
1825
|
+
label: M(_t)(T.value),
|
|
1826
|
+
retrying: M(ie),
|
|
1827
|
+
status: M(gt)(T.value),
|
|
1828
|
+
onRetry: M(q)
|
|
1697
1829
|
}, null, 8, [
|
|
1698
1830
|
"component",
|
|
1699
1831
|
"label",
|
|
@@ -1704,57 +1836,57 @@ var $t = [
|
|
|
1704
1836
|
b.value && e.layout === "reel" ? (w(), s("audio", {
|
|
1705
1837
|
key: 2,
|
|
1706
1838
|
ref_key: "mediaElement",
|
|
1707
|
-
ref:
|
|
1708
|
-
"data-source-generation": M(
|
|
1839
|
+
ref: Y,
|
|
1840
|
+
"data-source-generation": M(J),
|
|
1709
1841
|
class: "media-audio-element",
|
|
1710
1842
|
src: T.value,
|
|
1711
1843
|
autoplay: M(ue),
|
|
1712
1844
|
loop: !e.advanceOnMediaEnd,
|
|
1713
|
-
muted: M(
|
|
1845
|
+
muted: M(se),
|
|
1714
1846
|
preload: M(Te),
|
|
1715
|
-
onLoadedmetadata: i[0] ||= (...e) => M(
|
|
1716
|
-
onProgress: i[1] ||= (...e) => M(
|
|
1717
|
-
onLoadeddata: i[2] ||= (...e) => M(
|
|
1718
|
-
onCanplay: i[3] ||= (...e) => M(
|
|
1847
|
+
onLoadedmetadata: i[0] ||= (...e) => M(le) && M(le)(...e),
|
|
1848
|
+
onProgress: i[1] ||= (...e) => M(U) && M(U)(...e),
|
|
1849
|
+
onLoadeddata: i[2] ||= (...e) => M(U) && M(U)(...e),
|
|
1850
|
+
onCanplay: i[3] ||= (...e) => M(U) && M(U)(...e),
|
|
1719
1851
|
onDurationchange: i[4] ||= (...e) => M($) && M($)(...e),
|
|
1720
1852
|
onTimeupdate: i[5] ||= (...e) => M($) && M($)(...e),
|
|
1721
1853
|
onVolumechange: i[6] ||= (...e) => M($) && M($)(...e),
|
|
1722
|
-
onPlaying: i[7] ||= (...e) => M(
|
|
1723
|
-
onPause: i[8] ||= (e) =>
|
|
1724
|
-
onEnded: i[9] ||= (...e) => M(
|
|
1725
|
-
onError: i[10] ||= (...e) => M(
|
|
1726
|
-
}, null, 40,
|
|
1854
|
+
onPlaying: i[7] ||= (...e) => M(Q) && M(Q)(...e),
|
|
1855
|
+
onPause: i[8] ||= (e) => Z.value = !1,
|
|
1856
|
+
onEnded: i[9] ||= (...e) => M(ce) && M(ce)(...e),
|
|
1857
|
+
onError: i[10] ||= (...e) => M(z) && M(z)(...e)
|
|
1858
|
+
}, null, 40, dn)) : o("", !0),
|
|
1727
1859
|
b.value ? (w(), s("button", {
|
|
1728
1860
|
key: 3,
|
|
1729
1861
|
type: "button",
|
|
1730
|
-
class: y(["media-audio-artwork media-preview", { "media-preview--ready": M(
|
|
1731
|
-
"aria-label": e.layout === "reel" ? M(
|
|
1862
|
+
class: y(["media-audio-artwork media-preview", { "media-preview--ready": M(R) === "ready" }]),
|
|
1863
|
+
"aria-label": e.layout === "reel" ? M(Z) ? "Pause audio" : "Play audio" : "Audio",
|
|
1732
1864
|
disabled: e.layout !== "reel",
|
|
1733
1865
|
onClick: ke
|
|
1734
|
-
}, [
|
|
1866
|
+
}, [L.value ? (w(), s("img", {
|
|
1735
1867
|
key: j.value,
|
|
1736
1868
|
"data-cover-identity": j.value,
|
|
1737
|
-
"data-source-generation": M(
|
|
1869
|
+
"data-source-generation": M(J),
|
|
1738
1870
|
class: "media-audio-cover",
|
|
1739
|
-
src:
|
|
1740
|
-
width:
|
|
1741
|
-
height:
|
|
1871
|
+
src: L.value.src,
|
|
1872
|
+
width: L.value.width ?? void 0,
|
|
1873
|
+
height: L.value.height ?? void 0,
|
|
1742
1874
|
fetchpriority: e.fetchPriority,
|
|
1743
1875
|
alt: "",
|
|
1744
1876
|
decoding: "async",
|
|
1745
1877
|
loading: M(Ce),
|
|
1746
|
-
onLoad: i[11] ||= (t) => e.layout === "masonry" && M(
|
|
1878
|
+
onLoad: i[11] ||= (t) => e.layout === "masonry" && M(H)(t),
|
|
1747
1879
|
onError: Ae
|
|
1748
|
-
}, null, 40,
|
|
1880
|
+
}, null, 40, pn)) : (w(), s("span", mn, [u(M(ut), {
|
|
1749
1881
|
size: 64,
|
|
1750
1882
|
"stroke-width": 1.5
|
|
1751
|
-
})]))], 10,
|
|
1883
|
+
})]))], 10, fn)) : M(we) ? (w(), s("video", {
|
|
1752
1884
|
key: 4,
|
|
1753
1885
|
ref_key: "mediaElement",
|
|
1754
|
-
ref:
|
|
1755
|
-
"data-source-generation": M(
|
|
1886
|
+
ref: Y,
|
|
1887
|
+
"data-source-generation": M(J),
|
|
1756
1888
|
class: y(["media-preview", {
|
|
1757
|
-
"media-preview--ready": M(
|
|
1889
|
+
"media-preview--ready": M(R) === "ready",
|
|
1758
1890
|
"media-preview--reel-video": e.layout === "reel"
|
|
1759
1891
|
}]),
|
|
1760
1892
|
src: T.value,
|
|
@@ -1762,27 +1894,27 @@ var $t = [
|
|
|
1762
1894
|
height: O.value ?? void 0,
|
|
1763
1895
|
autoplay: M(ue),
|
|
1764
1896
|
loop: !e.advanceOnMediaEnd,
|
|
1765
|
-
muted: M(
|
|
1897
|
+
muted: M(se),
|
|
1766
1898
|
playsinline: "",
|
|
1767
1899
|
preload: M(Te),
|
|
1768
|
-
onLoadedmetadata: i[12] ||= (...e) => M(
|
|
1769
|
-
onProgress: i[13] ||= (...e) => M(
|
|
1770
|
-
onLoadeddata: i[14] ||= (...e) => M(
|
|
1771
|
-
onCanplay: i[15] ||= (...e) => M(
|
|
1900
|
+
onLoadedmetadata: i[12] ||= (...e) => M(le) && M(le)(...e),
|
|
1901
|
+
onProgress: i[13] ||= (...e) => M(U) && M(U)(...e),
|
|
1902
|
+
onLoadeddata: i[14] ||= (...e) => M(U) && M(U)(...e),
|
|
1903
|
+
onCanplay: i[15] ||= (...e) => M(U) && M(U)(...e),
|
|
1772
1904
|
onDurationchange: i[16] ||= (...e) => M($) && M($)(...e),
|
|
1773
1905
|
onTimeupdate: i[17] ||= (...e) => M($) && M($)(...e),
|
|
1774
1906
|
onVolumechange: i[18] ||= (...e) => M($) && M($)(...e),
|
|
1775
|
-
onPlaying: i[19] ||= (...e) => M(
|
|
1776
|
-
onPause: i[20] ||= (e) =>
|
|
1777
|
-
onEnded: i[21] ||= (...e) => M(
|
|
1907
|
+
onPlaying: i[19] ||= (...e) => M(Q) && M(Q)(...e),
|
|
1908
|
+
onPause: i[20] ||= (e) => Z.value = !1,
|
|
1909
|
+
onEnded: i[21] ||= (...e) => M(ce) && M(ce)(...e),
|
|
1778
1910
|
onClick: ke,
|
|
1779
|
-
onError: i[22] ||= (...e) => M(
|
|
1780
|
-
}, null, 42,
|
|
1911
|
+
onError: i[22] ||= (...e) => M(z) && M(z)(...e)
|
|
1912
|
+
}, null, 42, hn)) : b.value ? o("", !0) : (w(), s("img", {
|
|
1781
1913
|
key: 5,
|
|
1782
1914
|
ref_key: "imageElement",
|
|
1783
|
-
ref:
|
|
1784
|
-
"data-source-generation": M(
|
|
1785
|
-
class: y(["media-preview", { "media-preview--ready": M(
|
|
1915
|
+
ref: B,
|
|
1916
|
+
"data-source-generation": M(J),
|
|
1917
|
+
class: y(["media-preview", { "media-preview--ready": M(R) === "ready" }]),
|
|
1786
1918
|
src: T.value,
|
|
1787
1919
|
width: D.value ?? void 0,
|
|
1788
1920
|
height: O.value ?? void 0,
|
|
@@ -1790,13 +1922,13 @@ var $t = [
|
|
|
1790
1922
|
alt: "",
|
|
1791
1923
|
decoding: "async",
|
|
1792
1924
|
loading: M(Ce),
|
|
1793
|
-
onLoad: i[23] ||= (...e) => M(
|
|
1794
|
-
onError: i[24] ||= (...e) => M(
|
|
1795
|
-
}, null, 42,
|
|
1796
|
-
], 8,
|
|
1925
|
+
onLoad: i[23] ||= (...e) => M(H) && M(H)(...e),
|
|
1926
|
+
onError: i[24] ||= (...e) => M(z) && M(z)(...e)
|
|
1927
|
+
}, null, 42, gn))
|
|
1928
|
+
], 8, ln))]),
|
|
1797
1929
|
_: 1
|
|
1798
1930
|
}, 8, ["css", "name"]),
|
|
1799
|
-
u(
|
|
1931
|
+
u(Nt, {
|
|
1800
1932
|
item: e.item,
|
|
1801
1933
|
"media-card": e.mediaCard,
|
|
1802
1934
|
"media-index": m.value,
|
|
@@ -1816,15 +1948,15 @@ var $t = [
|
|
|
1816
1948
|
name: "vibe-reel-media-controls",
|
|
1817
1949
|
css: Ee.value
|
|
1818
1950
|
}, {
|
|
1819
|
-
default:
|
|
1951
|
+
default: P(() => [De.value ? (w(), a(jt, {
|
|
1820
1952
|
key: Oe.value,
|
|
1821
|
-
"current-time": M(
|
|
1953
|
+
"current-time": M(ae),
|
|
1822
1954
|
"data-control-post-id": Ee.value ? e.item.postId : void 0,
|
|
1823
|
-
duration: M(
|
|
1955
|
+
duration: M(oe),
|
|
1824
1956
|
layout: e.layout,
|
|
1825
1957
|
"media-type": b.value ? "audio" : "video",
|
|
1826
|
-
muted: M(
|
|
1827
|
-
playing: M(
|
|
1958
|
+
muted: M(X),
|
|
1959
|
+
playing: M(Z),
|
|
1828
1960
|
volume: M(he),
|
|
1829
1961
|
onSeek: M(de),
|
|
1830
1962
|
onToggleMute: M(pe),
|
|
@@ -1854,25 +1986,25 @@ var $t = [
|
|
|
1854
1986
|
type: "button",
|
|
1855
1987
|
class: "media-carousel-control media-carousel-control--previous",
|
|
1856
1988
|
"aria-label": `Previous media for post ${e.item.postId}`,
|
|
1857
|
-
onClick: i[25] ||=
|
|
1858
|
-
onKeydown: i[26] ||=
|
|
1859
|
-
}, [u(M(
|
|
1989
|
+
onClick: i[25] ||= I((e) => M(ve)(m.value - 1, e), ["stop"]),
|
|
1990
|
+
onKeydown: i[26] ||= I(() => {}, ["stop"])
|
|
1991
|
+
}, [u(M(ct), { size: 20 })], 40, _n), c("button", {
|
|
1860
1992
|
type: "button",
|
|
1861
1993
|
class: "media-carousel-control media-carousel-control--next",
|
|
1862
1994
|
"aria-label": `Next media for post ${e.item.postId}`,
|
|
1863
|
-
onClick: i[27] ||=
|
|
1864
|
-
onKeydown: i[28] ||=
|
|
1865
|
-
}, [u(M(
|
|
1995
|
+
onClick: i[27] ||= I((e) => M(ve)(m.value + 1, e), ["stop"]),
|
|
1996
|
+
onKeydown: i[28] ||= I(() => {}, ["stop"])
|
|
1997
|
+
}, [u(M(lt), { size: 20 })], 40, vn)], 2)) : o("", !0),
|
|
1866
1998
|
ge.value ? (w(), s("button", {
|
|
1867
1999
|
key: 1,
|
|
1868
2000
|
class: "media-card-activator",
|
|
1869
2001
|
type: "button",
|
|
1870
2002
|
"aria-label": `Open post ${e.item.postId}`,
|
|
1871
|
-
onClick: i[29] ||=
|
|
1872
|
-
onKeydown: i[30] ||=
|
|
1873
|
-
}, null, 40,
|
|
1874
|
-
], 42,
|
|
1875
|
-
e.cardFooter ? (w(), a(
|
|
2003
|
+
onClick: i[29] ||= I((e) => r.$emit("activate", _e(e)), ["stop"]),
|
|
2004
|
+
onKeydown: i[30] ||= I(() => {}, ["stop"])
|
|
2005
|
+
}, null, 40, yn)) : o("", !0)
|
|
2006
|
+
], 42, cn),
|
|
2007
|
+
e.cardFooter ? (w(), a(vt, {
|
|
1876
2008
|
key: 1,
|
|
1877
2009
|
index: e.index,
|
|
1878
2010
|
item: e.item,
|
|
@@ -1895,17 +2027,17 @@ var $t = [
|
|
|
1895
2027
|
"style",
|
|
1896
2028
|
"total"
|
|
1897
2029
|
])) : o("", !0)
|
|
1898
|
-
])], 46,
|
|
2030
|
+
])], 46, on));
|
|
1899
2031
|
}
|
|
1900
2032
|
});
|
|
1901
2033
|
//#endregion
|
|
1902
2034
|
//#region src/components/useMasonryMediaVisibility.ts
|
|
1903
|
-
function
|
|
2035
|
+
function xn(e) {
|
|
1904
2036
|
function t(t) {
|
|
1905
2037
|
return t.flatMap((t) => {
|
|
1906
2038
|
let n = e.items()[t];
|
|
1907
2039
|
if (!n) return [];
|
|
1908
|
-
let r = e.mediaIndices().get(n.postId) ?? 0, i =
|
|
2040
|
+
let r = e.mediaIndices().get(n.postId) ?? 0, i = q(n.postId, r);
|
|
1909
2041
|
return e.previewStates().get(i) === "ready" ? [{
|
|
1910
2042
|
key: i,
|
|
1911
2043
|
mediaIndex: r,
|
|
@@ -1915,7 +2047,7 @@ function hn(e) {
|
|
|
1915
2047
|
}
|
|
1916
2048
|
function n(e, n) {
|
|
1917
2049
|
let r = /* @__PURE__ */ new Set();
|
|
1918
|
-
|
|
2050
|
+
N(() => t(e()), (e) => {
|
|
1919
2051
|
let t = new Set(e.map(({ key: e }) => e));
|
|
1920
2052
|
e.forEach(({ key: e, mediaIndex: t, postId: i }) => {
|
|
1921
2053
|
r.has(e) || n(i, t);
|
|
@@ -1929,14 +2061,14 @@ function hn(e) {
|
|
|
1929
2061
|
}
|
|
1930
2062
|
//#endregion
|
|
1931
2063
|
//#region src/components/useSettledMasonryFeedLayout.ts
|
|
1932
|
-
var
|
|
1933
|
-
function
|
|
2064
|
+
var Sn = 1500;
|
|
2065
|
+
function Cn(e) {
|
|
1934
2066
|
let t = k(0), n = r(() => [...e.items()]), i = 0, a = null, o = 0, s = 0, c = null, l = 0, u = null, d = null, f = 0;
|
|
1935
2067
|
function p() {
|
|
1936
2068
|
c !== null && (cancelAnimationFrame(c), c = null);
|
|
1937
2069
|
}
|
|
1938
2070
|
function m(e, t, n, r) {
|
|
1939
|
-
return a = e, u = t, d =
|
|
2071
|
+
return a = e, u = t, d = Pe(e.items, d ?? Ne(r.items), n), l = e.items.length < t.length ? Math.max(l, r.height, e.height) : 0, e.items.length < t.length && e.items.length > n && h(), e;
|
|
1940
2072
|
}
|
|
1941
2073
|
function h() {
|
|
1942
2074
|
c === null && (c = requestAnimationFrame(() => {
|
|
@@ -1950,7 +2082,7 @@ function _n(e) {
|
|
|
1950
2082
|
minColumnWidth: e.minColumnWidth.value
|
|
1951
2083
|
}, i, o, {
|
|
1952
2084
|
throughIndex: e.packThroughIndex(),
|
|
1953
|
-
untilIndex: o +
|
|
2085
|
+
untilIndex: o + Sn
|
|
1954
2086
|
}), r, o, i), t.value += 1;
|
|
1955
2087
|
}));
|
|
1956
2088
|
}
|
|
@@ -1971,8 +2103,8 @@ function _n(e) {
|
|
|
1971
2103
|
}
|
|
1972
2104
|
p();
|
|
1973
2105
|
let v = Ee(r, c, g);
|
|
1974
|
-
return a = v, u = r, f = c, o = g.gap, i = g.additionalHeight, s = g.minColumnWidth, d =
|
|
1975
|
-
}), _ = r(() => (g.value, d ??
|
|
2106
|
+
return a = v, u = r, f = c, o = g.gap, i = g.additionalHeight, s = g.minColumnWidth, d = Ne(v.items), l = 0, v;
|
|
2107
|
+
}), _ = r(() => (g.value, d ?? Ne(g.value.items)));
|
|
1976
2108
|
return S(p), {
|
|
1977
2109
|
ensurePackedThrough(r) {
|
|
1978
2110
|
let i = n.value, o = a;
|
|
@@ -1994,11 +2126,40 @@ function _n(e) {
|
|
|
1994
2126
|
};
|
|
1995
2127
|
}
|
|
1996
2128
|
//#endregion
|
|
2129
|
+
//#region src/components/masonryItemStyleCache.ts
|
|
2130
|
+
function wn() {
|
|
2131
|
+
let e = /* @__PURE__ */ new Map();
|
|
2132
|
+
return {
|
|
2133
|
+
retain(t) {
|
|
2134
|
+
let n = new Set(t);
|
|
2135
|
+
for (let t of e.keys()) n.has(t) || e.delete(t);
|
|
2136
|
+
},
|
|
2137
|
+
get(t, n, r, i) {
|
|
2138
|
+
let { width: a, height: o, x: s } = n, c = n.y + r, l = e.get(t);
|
|
2139
|
+
if (l && l.width === a && l.height === o && l.x === s && l.y === c && l.delay === i) return l.style;
|
|
2140
|
+
let u = {
|
|
2141
|
+
"--masonry-entry-delay": `${i}ms`,
|
|
2142
|
+
width: `${a}px`,
|
|
2143
|
+
height: `${o}px`,
|
|
2144
|
+
transform: `translate3d(${s}px, ${c}px, 0)`
|
|
2145
|
+
};
|
|
2146
|
+
return e.set(t, {
|
|
2147
|
+
width: a,
|
|
2148
|
+
height: o,
|
|
2149
|
+
x: s,
|
|
2150
|
+
y: c,
|
|
2151
|
+
delay: i,
|
|
2152
|
+
style: u
|
|
2153
|
+
}), u;
|
|
2154
|
+
}
|
|
2155
|
+
};
|
|
2156
|
+
}
|
|
2157
|
+
//#endregion
|
|
1997
2158
|
//#region src/components/MasonryFeed.vue?vue&type=script&setup=true&lang.ts
|
|
1998
|
-
var
|
|
2159
|
+
var Tn = { class: "masonry-feed-shell" }, En = ["aria-hidden", "inert"], Dn = {
|
|
1999
2160
|
key: 0,
|
|
2000
2161
|
class: "masonry-feed-status-overlay"
|
|
2001
|
-
},
|
|
2162
|
+
}, On = 6, kn = 12, An = 250, jn = /* @__PURE__ */ d({
|
|
2002
2163
|
__name: "MasonryFeed",
|
|
2003
2164
|
props: {
|
|
2004
2165
|
enteringPostIds: {},
|
|
@@ -2037,65 +2198,68 @@ var vn = { class: "masonry-feed-shell" }, yn = ["aria-hidden", "inert"], bn = {
|
|
|
2037
2198
|
"visible"
|
|
2038
2199
|
],
|
|
2039
2200
|
setup(t, { expose: n, emit: i }) {
|
|
2040
|
-
let l = 0, d = t, f = i, p = k(null), m = `vibe-masonry-${
|
|
2201
|
+
let l = 0, d = t, f = i, p = k(null), m = `vibe-masonry-${ee()}`, h = k(null), g = k(0), _ = k(On), v = k(0), b = k(0), C = k(0), T = k([]), D = k([]), O = k([]), A = 0, j = null, P = null, F = null, I = null, L = r(() => ({
|
|
2041
2202
|
additionalHeight: (d.cardHeader?.height ?? 0) + (d.cardFooter?.height ?? 0),
|
|
2042
2203
|
gap: _.value,
|
|
2043
|
-
minColumnWidth:
|
|
2044
|
-
})),
|
|
2045
|
-
function
|
|
2046
|
-
let e = A - C.value + v.value +
|
|
2047
|
-
let n =
|
|
2204
|
+
minColumnWidth: Re(d.masonry)
|
|
2205
|
+
})), R = [];
|
|
2206
|
+
function z() {
|
|
2207
|
+
let e = A - C.value + v.value + ze(d.masonry, v.value), t = O.value.reduce((e, t) => {
|
|
2208
|
+
let n = R[t];
|
|
2048
2209
|
return n ? Math.max(e, n.y + n.height) : e;
|
|
2049
2210
|
}, 0);
|
|
2050
2211
|
return Math.max(e, t);
|
|
2051
2212
|
}
|
|
2052
|
-
function
|
|
2213
|
+
function B() {
|
|
2053
2214
|
return O.value.reduce((e, t) => Math.max(e, t), -1);
|
|
2054
2215
|
}
|
|
2055
|
-
let
|
|
2056
|
-
additionalHeight: r(() =>
|
|
2216
|
+
let V = Cn({
|
|
2217
|
+
additionalHeight: r(() => L.value.additionalHeight),
|
|
2057
2218
|
gap: _,
|
|
2058
2219
|
items: () => d.items,
|
|
2059
|
-
minColumnWidth: r(() =>
|
|
2060
|
-
packThroughIndex:
|
|
2061
|
-
packUntilBottom:
|
|
2220
|
+
minColumnWidth: r(() => L.value.minColumnWidth),
|
|
2221
|
+
packThroughIndex: B,
|
|
2222
|
+
packUntilBottom: z,
|
|
2062
2223
|
width: g
|
|
2063
|
-
}),
|
|
2064
|
-
throughIndex:
|
|
2065
|
-
untilBottom:
|
|
2066
|
-
})),
|
|
2067
|
-
let e =
|
|
2224
|
+
}), H = V.layout, U = V.viewportIndex, te = r(() => d.leavingPostIds.size === 0 ? null : Oe(d.items, g.value, L.value, H.value, (e) => d.leavingPostIds.has(d.items[e].postId), {
|
|
2225
|
+
throughIndex: B(),
|
|
2226
|
+
untilBottom: z()
|
|
2227
|
+
})), W = r(() => {
|
|
2228
|
+
let e = te.value;
|
|
2068
2229
|
return e ? {
|
|
2069
2230
|
columns: e.columns,
|
|
2070
2231
|
height: e.height,
|
|
2071
2232
|
items: e.items
|
|
2072
|
-
} :
|
|
2073
|
-
}),
|
|
2074
|
-
let e =
|
|
2075
|
-
return e ?
|
|
2076
|
-
}),
|
|
2077
|
-
let
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2233
|
+
} : H.value;
|
|
2234
|
+
}), ne = r(() => {
|
|
2235
|
+
let e = te.value;
|
|
2236
|
+
return e ? Fe(e.items, e.retainedIndices, U.value, e.fromIndex) : null;
|
|
2237
|
+
}), G = r(() => (H.value, Math.max(b.value, V.reservedHeight(), d.leavingPostIds.size === 0 ? W.value.height : H.value.height))), K = r(() => ({ height: `${G.value}px` })), re = r(() => !d.infiniteScroll || v.value > 0 && C.value + W.value.height <= v.value + 1), ie = r(() => new Set(D.value)), J = wn(), Y = () => d.items.length, ae = r(() => {
|
|
2238
|
+
let e = O.value.flatMap((e) => {
|
|
2239
|
+
let t = d.items[e], n = W.value.items[e];
|
|
2240
|
+
return !t || !n || n.width <= 0 || n.height <= 0 ? [] : [{
|
|
2241
|
+
fetchPriority: ie.value.has(e) ? "high" : "low",
|
|
2242
|
+
index: e,
|
|
2243
|
+
item: t
|
|
2244
|
+
}];
|
|
2245
|
+
});
|
|
2246
|
+
return J.retain(e.map((e) => e.index)), e;
|
|
2247
|
+
});
|
|
2248
|
+
function oe(e, t) {
|
|
2085
2249
|
return [...new Set([...e, ...t])].sort((e, t) => e - t);
|
|
2086
2250
|
}
|
|
2087
|
-
function
|
|
2251
|
+
function se(e, t) {
|
|
2088
2252
|
return e.length === t.length && e.every((e, n) => e === t[n]);
|
|
2089
2253
|
}
|
|
2090
|
-
function
|
|
2254
|
+
function X(e) {
|
|
2091
2255
|
let t = {
|
|
2092
2256
|
scrollTop: A - C.value,
|
|
2093
2257
|
viewportHeight: v.value
|
|
2094
|
-
}, n =
|
|
2258
|
+
}, n = ne.value, r = Le(n ?? U.value, {
|
|
2095
2259
|
...t,
|
|
2096
2260
|
overscan: e
|
|
2097
2261
|
}).indices;
|
|
2098
|
-
return
|
|
2262
|
+
return oe(r, d.leavingPostIds.size === 0 ? [] : Le(U.value, {
|
|
2099
2263
|
...t,
|
|
2100
2264
|
overscan: e
|
|
2101
2265
|
}).indices.filter((e) => {
|
|
@@ -2103,27 +2267,27 @@ var vn = { class: "masonry-feed-shell" }, yn = ["aria-hidden", "inert"], bn = {
|
|
|
2103
2267
|
return t !== void 0 && d.leavingPostIds.has(t.postId);
|
|
2104
2268
|
}));
|
|
2105
2269
|
}
|
|
2106
|
-
function
|
|
2107
|
-
let e =
|
|
2108
|
-
|
|
2109
|
-
let n = xe(
|
|
2270
|
+
function Z() {
|
|
2271
|
+
let e = X(0), t = X(ze(d.masonry, v.value));
|
|
2272
|
+
se(D.value, e) || (D.value = e);
|
|
2273
|
+
let n = xe(W.value.items, e.filter((e) => {
|
|
2110
2274
|
let t = d.items[e];
|
|
2111
2275
|
return t && !d.leavingPostIds.has(t.postId);
|
|
2112
2276
|
}), {
|
|
2113
2277
|
scrollTop: A - C.value,
|
|
2114
2278
|
viewportHeight: v.value
|
|
2115
2279
|
});
|
|
2116
|
-
|
|
2280
|
+
se(T.value, n) || (T.value = n), se(O.value, t) || (O.value = t);
|
|
2117
2281
|
}
|
|
2118
|
-
function
|
|
2119
|
-
if (
|
|
2120
|
-
|
|
2282
|
+
function ce() {
|
|
2283
|
+
if (I !== null) return;
|
|
2284
|
+
I = -1;
|
|
2121
2285
|
let e = requestAnimationFrame(() => {
|
|
2122
|
-
|
|
2286
|
+
I = null, Z();
|
|
2123
2287
|
});
|
|
2124
|
-
|
|
2288
|
+
I !== null && (I = e);
|
|
2125
2289
|
}
|
|
2126
|
-
|
|
2290
|
+
xn({
|
|
2127
2291
|
fullyVisibleIndices: () => T.value,
|
|
2128
2292
|
items: () => d.items,
|
|
2129
2293
|
mediaIndices: () => d.mediaIndices,
|
|
@@ -2132,19 +2296,14 @@ var vn = { class: "masonry-feed-shell" }, yn = ["aria-hidden", "inert"], bn = {
|
|
|
2132
2296
|
previewStates: () => d.previewStates,
|
|
2133
2297
|
visibleIndices: () => D.value
|
|
2134
2298
|
});
|
|
2135
|
-
function
|
|
2136
|
-
let t =
|
|
2299
|
+
function le(e) {
|
|
2300
|
+
let t = W.value.items[e], n = d.items[e]?.postId;
|
|
2137
2301
|
if (!t || t.width <= 0 || t.height <= 0) return {};
|
|
2138
2302
|
let r = n !== void 0 && d.enteringPostIds.has(n), i = n !== void 0 && d.leavingPostIds.has(n), a = r || i ? ve({
|
|
2139
|
-
containerHeight: Math.max(b.value,
|
|
2303
|
+
containerHeight: Math.max(b.value, H.value.height),
|
|
2140
2304
|
gap: _.value
|
|
2141
2305
|
}) : 0, o = n === void 0 ? 0 : i ? d.removalDelays.get(n) ?? 0 : r ? d.entryDelays.get(n) ?? 0 : 0;
|
|
2142
|
-
return
|
|
2143
|
-
"--masonry-entry-delay": `${o}ms`,
|
|
2144
|
-
width: `${t.width}px`,
|
|
2145
|
-
height: `${t.height}px`,
|
|
2146
|
-
transform: `translate3d(${t.x}px, ${t.y + a}px, 0)`
|
|
2147
|
-
};
|
|
2306
|
+
return J.get(e, t, a, o);
|
|
2148
2307
|
}
|
|
2149
2308
|
function Q() {
|
|
2150
2309
|
let e = p.value;
|
|
@@ -2153,47 +2312,47 @@ var vn = { class: "masonry-feed-shell" }, yn = ["aria-hidden", "inert"], bn = {
|
|
|
2153
2312
|
let t = e.ownerDocument.defaultView?.getComputedStyle(e), n = (Number.parseFloat(t?.paddingTop ?? "") || 0) + (Number.parseFloat(t?.paddingBottom ?? "") || 0);
|
|
2154
2313
|
b.value = Math.max(0, e.clientHeight - n);
|
|
2155
2314
|
let r = h.value;
|
|
2156
|
-
r && (C.value = r.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop,
|
|
2315
|
+
r && (C.value = r.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop, Z());
|
|
2157
2316
|
}
|
|
2158
|
-
function
|
|
2317
|
+
function ue(e) {
|
|
2159
2318
|
let t = e.ownerDocument.documentElement.clientWidth;
|
|
2160
|
-
g.value = e.clientWidth, _.value = Math.min(
|
|
2319
|
+
g.value = e.clientWidth, _.value = Math.min(kn, Math.max(On, t * .0075)), Q();
|
|
2161
2320
|
}
|
|
2162
|
-
function
|
|
2321
|
+
function de(e) {
|
|
2163
2322
|
let t = e.currentTarget;
|
|
2164
|
-
t && (A = t.scrollTop,
|
|
2323
|
+
t && (A = t.scrollTop, V.ensurePackedThrough(z()), ce(), Date.now() >= l && !d.loadMoreLocked && d.infiniteScroll && he(t, d.masonry?.loadMoreThresholdPx) && f("loadMore"));
|
|
2165
2324
|
}
|
|
2166
|
-
function
|
|
2325
|
+
function $() {
|
|
2167
2326
|
let e = p.value;
|
|
2168
2327
|
Date.now() >= l && !d.loadMoreLocked && e && he(e, d.masonry?.loadMoreThresholdPx) && f("loadMore");
|
|
2169
2328
|
}
|
|
2170
|
-
|
|
2171
|
-
e > 0 && e < t && (l = Date.now() +
|
|
2329
|
+
N(() => d.items.length, (e, t) => {
|
|
2330
|
+
e > 0 && e < t && (l = Date.now() + An);
|
|
2172
2331
|
});
|
|
2173
|
-
function
|
|
2332
|
+
function pe() {
|
|
2174
2333
|
return p.value;
|
|
2175
2334
|
}
|
|
2176
|
-
return
|
|
2177
|
-
j?.disconnect(), j = null,
|
|
2335
|
+
return N(h, (e) => {
|
|
2336
|
+
j?.disconnect(), j = null, F !== null && cancelAnimationFrame(F), e && (ue(e), !(typeof ResizeObserver > "u") && (j = new ResizeObserver(([t]) => {
|
|
2178
2337
|
let n = t?.contentRect.width ?? e.clientWidth;
|
|
2179
|
-
Math.abs(n - g.value) < .5 || (
|
|
2180
|
-
|
|
2338
|
+
Math.abs(n - g.value) < .5 || (F = requestAnimationFrame(() => {
|
|
2339
|
+
F = null, ue(e);
|
|
2181
2340
|
}));
|
|
2182
2341
|
}), j.observe(e)));
|
|
2183
|
-
}),
|
|
2184
|
-
|
|
2185
|
-
}),
|
|
2186
|
-
|
|
2187
|
-
}, { flush: "sync" }),
|
|
2188
|
-
|
|
2189
|
-
|
|
2342
|
+
}), N(p, (e) => {
|
|
2343
|
+
P?.disconnect(), P = null, e && (Q(), !(typeof ResizeObserver > "u") && (P = new ResizeObserver(Q), P.observe(e)));
|
|
2344
|
+
}), N(W, (e) => {
|
|
2345
|
+
R = e.items;
|
|
2346
|
+
}, { flush: "sync" }), N([
|
|
2347
|
+
H,
|
|
2348
|
+
W,
|
|
2190
2349
|
() => d.masonry
|
|
2191
|
-
],
|
|
2192
|
-
j?.disconnect(),
|
|
2350
|
+
], Z, { flush: "post" }), S(() => {
|
|
2351
|
+
j?.disconnect(), P?.disconnect(), F !== null && cancelAnimationFrame(F), I !== null && cancelAnimationFrame(I);
|
|
2193
2352
|
}), n({
|
|
2194
|
-
getScrollElement:
|
|
2195
|
-
loadIfNearBottom:
|
|
2196
|
-
}), (n, r) => (w(), s("div",
|
|
2353
|
+
getScrollElement: pe,
|
|
2354
|
+
loadIfNearBottom: $
|
|
2355
|
+
}), (n, r) => (w(), s("div", Tn, [
|
|
2197
2356
|
c("main", {
|
|
2198
2357
|
id: m,
|
|
2199
2358
|
ref_key: "galleryElement",
|
|
@@ -2202,14 +2361,14 @@ var vn = { class: "masonry-feed-shell" }, yn = ["aria-hidden", "inert"], bn = {
|
|
|
2202
2361
|
"data-layout-mode": "masonry",
|
|
2203
2362
|
"aria-hidden": t.suspended || void 0,
|
|
2204
2363
|
inert: t.suspended || void 0,
|
|
2205
|
-
onScrollPassive:
|
|
2364
|
+
onScrollPassive: de
|
|
2206
2365
|
}, [c("section", {
|
|
2207
2366
|
ref_key: "masonryElement",
|
|
2208
2367
|
ref: h,
|
|
2209
2368
|
class: y(["masonry", { "masonry--ready": g.value > 0 }]),
|
|
2210
|
-
style: x(
|
|
2369
|
+
style: x(K.value),
|
|
2211
2370
|
"aria-label": "Media gallery"
|
|
2212
|
-
}, [(w(!0), s(e, null, E(
|
|
2371
|
+
}, [(w(!0), s(e, null, E(ae.value, ({ fetchPriority: e, item: n, index: r }) => (w(), a(bn, {
|
|
2213
2372
|
key: n.postId,
|
|
2214
2373
|
class: "masonry-item",
|
|
2215
2374
|
entering: t.enteringPostIds.has(n.postId),
|
|
@@ -2218,15 +2377,15 @@ var vn = { class: "masonry-feed-shell" }, yn = ["aria-hidden", "inert"], bn = {
|
|
|
2218
2377
|
"card-footer": t.cardFooter,
|
|
2219
2378
|
"card-header": t.cardHeader,
|
|
2220
2379
|
"media-card": t.mediaCard,
|
|
2221
|
-
"in-viewport":
|
|
2380
|
+
"in-viewport": ie.value.has(r),
|
|
2222
2381
|
index: r,
|
|
2223
2382
|
item: n,
|
|
2224
|
-
"item-style":
|
|
2383
|
+
"item-style": le(r),
|
|
2225
2384
|
interactive: "",
|
|
2226
2385
|
layout: "masonry",
|
|
2227
|
-
"loaded-count":
|
|
2386
|
+
"loaded-count": Y,
|
|
2228
2387
|
"media-index": t.mediaIndices.get(n.postId) ?? 0,
|
|
2229
|
-
"preview-state": t.previewStates.get(M(
|
|
2388
|
+
"preview-state": t.previewStates.get(M(q)(n.postId, t.mediaIndices.get(n.postId) ?? 0)) ?? "loading",
|
|
2230
2389
|
total: t.total,
|
|
2231
2390
|
onActivate: (e) => f("activate", n.postId, e),
|
|
2232
2391
|
onMediaChange: (e) => f("mediaChange", n.postId, e),
|
|
@@ -2244,7 +2403,6 @@ var vn = { class: "masonry-feed-shell" }, yn = ["aria-hidden", "inert"], bn = {
|
|
|
2244
2403
|
"index",
|
|
2245
2404
|
"item",
|
|
2246
2405
|
"item-style",
|
|
2247
|
-
"loaded-count",
|
|
2248
2406
|
"media-index",
|
|
2249
2407
|
"preview-state",
|
|
2250
2408
|
"total",
|
|
@@ -2258,8 +2416,8 @@ var vn = { class: "masonry-feed-shell" }, yn = ["aria-hidden", "inert"], bn = {
|
|
|
2258
2416
|
class: "masonry-bottom-space",
|
|
2259
2417
|
"aria-hidden": "true",
|
|
2260
2418
|
style: x({ flex: `0 0 ${t.masonry.bottomSpacePx}px` })
|
|
2261
|
-
}, null, 4)) : o("", !0)], 42,
|
|
2262
|
-
t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext &&
|
|
2419
|
+
}, null, 4)) : o("", !0)], 42, En),
|
|
2420
|
+
t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && re.value || !t.hasNext && t.canRetryEnd ? (w(), s("div", Dn, [u(fe, {
|
|
2263
2421
|
actions: t.feedFooterActions,
|
|
2264
2422
|
"can-retry-end": t.canRetryEnd,
|
|
2265
2423
|
"feed-footer": t.feedFooter,
|
|
@@ -2267,7 +2425,7 @@ var vn = { class: "masonry-feed-shell" }, yn = ["aria-hidden", "inert"], bn = {
|
|
|
2267
2425
|
"has-next": t.hasNext,
|
|
2268
2426
|
"is-loading": t.isLoadingMore,
|
|
2269
2427
|
"load-more-locked": t.loadMoreLocked,
|
|
2270
|
-
"show-load-more":
|
|
2428
|
+
"show-load-more": re.value,
|
|
2271
2429
|
state: t.state,
|
|
2272
2430
|
onLoadMore: r[0] ||= (e) => f("loadMore"),
|
|
2273
2431
|
onRetryEnd: r[1] ||= (e) => f("retryEnd")
|
|
@@ -2282,8 +2440,8 @@ var vn = { class: "masonry-feed-shell" }, yn = ["aria-hidden", "inert"], bn = {
|
|
|
2282
2440
|
"show-load-more",
|
|
2283
2441
|
"state"
|
|
2284
2442
|
])])) : o("", !0),
|
|
2285
|
-
u(
|
|
2286
|
-
"content-size":
|
|
2443
|
+
u(Qe, {
|
|
2444
|
+
"content-size": W.value.height,
|
|
2287
2445
|
"controls-id": m,
|
|
2288
2446
|
"scroll-element": p.value,
|
|
2289
2447
|
suspended: t.suspended
|
|
@@ -2294,8 +2452,8 @@ var vn = { class: "masonry-feed-shell" }, yn = ["aria-hidden", "inert"], bn = {
|
|
|
2294
2452
|
])
|
|
2295
2453
|
]));
|
|
2296
2454
|
}
|
|
2297
|
-
}),
|
|
2298
|
-
function
|
|
2455
|
+
}), Mn = 300;
|
|
2456
|
+
function Nn(e, t, n) {
|
|
2299
2457
|
let r = e.scrollTop;
|
|
2300
2458
|
if (n || Math.abs(r - t) <= 1) return e.scrollTop = t, Promise.resolve();
|
|
2301
2459
|
e.setAttribute("data-transitioning", "");
|
|
@@ -2303,7 +2461,7 @@ function En(e, t, n) {
|
|
|
2303
2461
|
return new Promise((n) => {
|
|
2304
2462
|
let o = (s) => {
|
|
2305
2463
|
a += 1;
|
|
2306
|
-
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c /
|
|
2464
|
+
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / Mn), u = 1 - (1 - l) ** 3;
|
|
2307
2465
|
if (e.scrollTop = r + (t - r) * u, l < 1) {
|
|
2308
2466
|
requestAnimationFrame(o);
|
|
2309
2467
|
return;
|
|
@@ -2315,7 +2473,7 @@ function En(e, t, n) {
|
|
|
2315
2473
|
}
|
|
2316
2474
|
//#endregion
|
|
2317
2475
|
//#region src/components/ReelAutoAdvanceProgress.vue?vue&type=script&setup=true&lang.ts
|
|
2318
|
-
var
|
|
2476
|
+
var Pn = ["aria-label"], Fn = /* @__PURE__ */ d({
|
|
2319
2477
|
__name: "ReelAutoAdvanceProgress",
|
|
2320
2478
|
props: {
|
|
2321
2479
|
durationMs: {},
|
|
@@ -2333,9 +2491,9 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2333
2491
|
class: "reel-auto-advance-progress",
|
|
2334
2492
|
style: x(a.value),
|
|
2335
2493
|
onAnimationend: n[0] ||= (e) => i("complete")
|
|
2336
|
-
}, null, 36)], 8,
|
|
2494
|
+
}, null, 36)], 8, Pn));
|
|
2337
2495
|
}
|
|
2338
|
-
}),
|
|
2496
|
+
}), In = { class: "reel-viewport" }, Ln = ["data-active-post-id", "data-active-media-index"], Rn = ["role", "data-status"], zn = ["disabled"], Bn = 300, Vn = 250, Hn = /* @__PURE__ */ d({
|
|
2339
2497
|
__name: "ReelFeed",
|
|
2340
2498
|
props: {
|
|
2341
2499
|
initialPostId: {},
|
|
@@ -2375,81 +2533,81 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2375
2533
|
"retryForward"
|
|
2376
2534
|
],
|
|
2377
2535
|
setup(t, { expose: n, emit: i }) {
|
|
2378
|
-
let l = 0, u = t, d = i, f = k(null), p = k(null), m = u.initialPostId === null || u.initialPostId === void 0 ? -1 : u.items.findIndex((e) => e.postId === u.initialPostId), h = k(Math.max(0, m)), g = k(!1), _ = k(!1), b = 0, T = null, D = null, O = null, j = r(() => ({ gridTemplateRows: `repeat(${u.items.length}, 100cqh)` })),
|
|
2536
|
+
let l = 0, u = t, d = i, f = k(null), p = k(null), m = u.initialPostId === null || u.initialPostId === void 0 ? -1 : u.items.findIndex((e) => e.postId === u.initialPostId), h = k(Math.max(0, m)), g = k(!1), _ = k(!1), b = 0, T = null, D = null, O = null, j = r(() => ({ gridTemplateRows: `repeat(${u.items.length}, 100cqh)` })), ee = r(() => {
|
|
2379
2537
|
let e = Math.max(0, h.value - 2), t = Math.min(u.items.length - 1, h.value + 2);
|
|
2380
2538
|
return u.items.slice(e, t + 1).map((t, n) => ({
|
|
2381
2539
|
fetchPriority: e + n === h.value ? "high" : "low",
|
|
2382
2540
|
index: e + n,
|
|
2383
2541
|
item: t
|
|
2384
2542
|
}));
|
|
2385
|
-
}),
|
|
2386
|
-
let e =
|
|
2543
|
+
}), P = r(() => u.items[h.value]?.postId), F = r(() => u.items[h.value]), I = r(() => {
|
|
2544
|
+
let e = P.value;
|
|
2387
2545
|
return e === void 0 ? 0 : u.mediaIndices.get(e) ?? 0;
|
|
2388
|
-
}),
|
|
2389
|
-
let e =
|
|
2390
|
-
return e === void 0 ? "loading" : u.previewStates.get(
|
|
2391
|
-
}),
|
|
2392
|
-
|
|
2393
|
-
|
|
2546
|
+
}), L = r(() => {
|
|
2547
|
+
let e = P.value;
|
|
2548
|
+
return e === void 0 ? "loading" : u.previewStates.get(q(e, I.value)) ?? "loading";
|
|
2549
|
+
}), R = r(() => F.value ? re(F.value, I.value) : null), z = r(() => R.value ? ne(R.value, u.mediaSource ?? "preview") : null), B = r(() => L.value === "ready" && !!(z.value && H(z.value.type, z.value.src))), V = r(() => [
|
|
2550
|
+
P.value,
|
|
2551
|
+
I.value,
|
|
2394
2552
|
u.items.length,
|
|
2395
2553
|
u.loadMoreLocked,
|
|
2396
2554
|
u.reelAutoAdvance.enabled,
|
|
2397
2555
|
u.reelAutoAdvance.includePostItems,
|
|
2398
2556
|
u.reelAutoAdvance.intervalMs
|
|
2399
|
-
].join(":")),
|
|
2400
|
-
let e =
|
|
2557
|
+
].join(":")), U = r(() => {
|
|
2558
|
+
let e = F.value, t = !!(e && u.reelAutoAdvance.includePostItems && I.value < G(e).length - 1), n = u.reelAutoAdvance.intervalMs / 1e3;
|
|
2401
2559
|
return `Auto advance to the next ${t ? "post item" : "post"} in ${n}s`;
|
|
2402
|
-
}),
|
|
2403
|
-
function
|
|
2560
|
+
}), te = r(() => u.reelAutoAdvance.enabled && u.reelForward.status === "idle" && F.value !== void 0 && L.value !== "loading" && !B.value), W = r(() => !u.infiniteScroll || u.items.length <= 1), K = r(() => u.reelForward.status === "end" && u.hasNext && !u.infiniteScroll && !u.loadMoreLocked), ie = r(() => u.reelForward.status === "loading" ? "Loading the next media…" : u.reelForward.status === "error" ? "Unable to load the next media." : K.value ? "Load the next page to continue." : "You reached the end of this feed.");
|
|
2561
|
+
function J(e) {
|
|
2404
2562
|
return { gridRow: `${e + 1}` };
|
|
2405
2563
|
}
|
|
2406
|
-
function
|
|
2564
|
+
function Y(e) {
|
|
2407
2565
|
let t = b || e.clientHeight;
|
|
2408
2566
|
return t <= 0 || u.items.length === 0 ? 0 : Math.min(u.items.length - 1, Math.max(0, Math.round(e.scrollTop / t)));
|
|
2409
2567
|
}
|
|
2410
|
-
function
|
|
2568
|
+
function ae(e) {
|
|
2411
2569
|
let t = e.currentTarget;
|
|
2412
2570
|
if (!t) return;
|
|
2413
2571
|
let n = b || t.clientHeight, r = Math.max(0, u.items.length - 1) * n;
|
|
2414
|
-
g.value = u.items.length > 0 && t.scrollTop > r + 1, _.value || (h.value =
|
|
2572
|
+
g.value = u.items.length > 0 && t.scrollTop > r + 1, _.value || (h.value = Y(t)), Date.now() >= l && !u.loadMoreLocked && u.infiniteScroll && he(t) && d("loadMore");
|
|
2415
2573
|
}
|
|
2416
|
-
function
|
|
2574
|
+
function oe() {
|
|
2417
2575
|
let e = f.value;
|
|
2418
|
-
e && (g.value = !1,
|
|
2576
|
+
e && (g.value = !1, Z(!0), b = e.clientHeight, e.scrollTop = h.value * b, D !== null && cancelAnimationFrame(D), D = requestAnimationFrame(() => {
|
|
2419
2577
|
e.scrollTop = h.value * e.clientHeight, b = e.clientHeight, D = null;
|
|
2420
|
-
}),
|
|
2578
|
+
}), se());
|
|
2421
2579
|
}
|
|
2422
|
-
function
|
|
2580
|
+
function se() {
|
|
2423
2581
|
O !== null && clearTimeout(O), O = setTimeout(() => {
|
|
2424
2582
|
O = null;
|
|
2425
2583
|
let e = f.value;
|
|
2426
|
-
e && (b = e.clientHeight, e.scrollTop = h.value * b),
|
|
2584
|
+
e && (b = e.clientHeight, e.scrollTop = h.value * b), Z(!1);
|
|
2427
2585
|
}, 120);
|
|
2428
2586
|
}
|
|
2429
|
-
function
|
|
2430
|
-
|
|
2587
|
+
function X() {
|
|
2588
|
+
Z(!0);
|
|
2431
2589
|
let e = f.value;
|
|
2432
|
-
e && (b = e.clientHeight, e.scrollTop = h.value * b),
|
|
2590
|
+
e && (b = e.clientHeight, e.scrollTop = h.value * b), se();
|
|
2433
2591
|
}
|
|
2434
|
-
function
|
|
2592
|
+
function Z(e) {
|
|
2435
2593
|
_.value = e, f.value?.toggleAttribute("data-resizing", e);
|
|
2436
2594
|
}
|
|
2437
|
-
function
|
|
2595
|
+
function ce() {
|
|
2438
2596
|
let e = f.value;
|
|
2439
2597
|
Date.now() >= l && !u.loadMoreLocked && e && he(e) && d("loadMore");
|
|
2440
2598
|
}
|
|
2441
|
-
|
|
2442
|
-
e > 0 && e < t && (l = Date.now() +
|
|
2599
|
+
N(() => u.items.length, (e, t) => {
|
|
2600
|
+
e > 0 && e < t && (l = Date.now() + Vn);
|
|
2443
2601
|
});
|
|
2444
|
-
function
|
|
2445
|
-
let t =
|
|
2602
|
+
function le(e) {
|
|
2603
|
+
let t = F.value;
|
|
2446
2604
|
if (!t) return !1;
|
|
2447
|
-
let n =
|
|
2605
|
+
let n = G(t).length;
|
|
2448
2606
|
if (n <= 1) return !1;
|
|
2449
|
-
let r = (
|
|
2607
|
+
let r = (I.value + e + n) % n;
|
|
2450
2608
|
return d("mediaChange", t.postId, r), !0;
|
|
2451
2609
|
}
|
|
2452
|
-
function
|
|
2610
|
+
function Q(e) {
|
|
2453
2611
|
let t = h.value + e;
|
|
2454
2612
|
return !f.value || t < 0 || t >= u.items.length ? !1 : (pe(t), !0);
|
|
2455
2613
|
}
|
|
@@ -2464,7 +2622,7 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2464
2622
|
let t = f.value;
|
|
2465
2623
|
if (!t) return Promise.resolve();
|
|
2466
2624
|
let n = e * (b || t.clientHeight);
|
|
2467
|
-
return h.value = e,
|
|
2625
|
+
return h.value = e, Nn(t, n, de());
|
|
2468
2626
|
}
|
|
2469
2627
|
function pe(e) {
|
|
2470
2628
|
$(e);
|
|
@@ -2474,14 +2632,14 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2474
2632
|
return t < 0 || t === h.value ? !1 : (await $(t), !0);
|
|
2475
2633
|
}
|
|
2476
2634
|
async function ge(e) {
|
|
2477
|
-
return
|
|
2635
|
+
return le(e) ? (de() || await new Promise((e) => setTimeout(e, Bn)), !0) : !1;
|
|
2478
2636
|
}
|
|
2479
2637
|
function _e() {
|
|
2480
2638
|
if (!u.reelAutoAdvance.enabled) return;
|
|
2481
|
-
let e =
|
|
2639
|
+
let e = F.value;
|
|
2482
2640
|
if (!e) return;
|
|
2483
|
-
if (u.reelAutoAdvance.includePostItems &&
|
|
2484
|
-
d("mediaChange", e.postId,
|
|
2641
|
+
if (u.reelAutoAdvance.includePostItems && I.value < G(e).length - 1) {
|
|
2642
|
+
d("mediaChange", e.postId, I.value + 1);
|
|
2485
2643
|
return;
|
|
2486
2644
|
}
|
|
2487
2645
|
let t = h.value + 1, n = u.items[t];
|
|
@@ -2492,25 +2650,25 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2492
2650
|
u.reelAutoAdvance.includePostItems && (u.mediaIndices.get(n.postId) ?? 0) !== 0 && d("mediaChange", n.postId, 0), pe(t);
|
|
2493
2651
|
}
|
|
2494
2652
|
function ve(e, t) {
|
|
2495
|
-
!u.reelAutoAdvance.enabled || e !==
|
|
2653
|
+
!u.reelAutoAdvance.enabled || e !== P.value || t !== I.value || !B.value || _e();
|
|
2496
2654
|
}
|
|
2497
|
-
return
|
|
2498
|
-
T?.disconnect(), T = null, e && (b = e.clientHeight, !(typeof ResizeObserver > "u") && (T = new ResizeObserver(
|
|
2499
|
-
}),
|
|
2655
|
+
return N(f, (e) => {
|
|
2656
|
+
T?.disconnect(), T = null, e && (b = e.clientHeight, !(typeof ResizeObserver > "u") && (T = new ResizeObserver(oe), T.observe(e)));
|
|
2657
|
+
}), N(() => u.items.length, async (e) => {
|
|
2500
2658
|
let t = u.initialPostId, n = t == null ? -1 : u.items.findIndex(({ postId: e }) => e === t);
|
|
2501
|
-
h.value = n >= 0 ? n : Math.min(h.value, Math.max(0, e - 1)), await v(),
|
|
2502
|
-
}), P
|
|
2659
|
+
h.value = n >= 0 ? n : Math.min(h.value, Math.max(0, e - 1)), await v(), oe();
|
|
2660
|
+
}), N(P, (e) => {
|
|
2503
2661
|
e !== void 0 && d("activeChange", e);
|
|
2504
2662
|
}, { immediate: !0 }), C(() => {
|
|
2505
|
-
window.addEventListener("resize",
|
|
2663
|
+
window.addEventListener("resize", X), window.addEventListener("orientationchange", X), m >= 0 && v(oe);
|
|
2506
2664
|
}), S(() => {
|
|
2507
|
-
window.removeEventListener("resize",
|
|
2665
|
+
window.removeEventListener("resize", X), window.removeEventListener("orientationchange", X), T?.disconnect(), D !== null && cancelAnimationFrame(D), O !== null && clearTimeout(O);
|
|
2508
2666
|
}), n({
|
|
2509
2667
|
activeIndex: h,
|
|
2510
|
-
activePostId:
|
|
2511
|
-
changeActiveMedia:
|
|
2512
|
-
loadIfNearBottom:
|
|
2513
|
-
moveActivePost:
|
|
2668
|
+
activePostId: P,
|
|
2669
|
+
changeActiveMedia: le,
|
|
2670
|
+
loadIfNearBottom: ce,
|
|
2671
|
+
moveActivePost: Q,
|
|
2514
2672
|
navigateToItem: ue,
|
|
2515
2673
|
transitionActiveMedia: ge,
|
|
2516
2674
|
transitionActivePost: me
|
|
@@ -2521,13 +2679,13 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2521
2679
|
}]),
|
|
2522
2680
|
"data-layout-mode": "reel"
|
|
2523
2681
|
}, [
|
|
2524
|
-
t.cardHeader &&
|
|
2682
|
+
t.cardHeader && F.value && t.reelForward.status === "idle" ? (w(), a(vt, {
|
|
2525
2683
|
key: 0,
|
|
2526
2684
|
index: h.value,
|
|
2527
|
-
item:
|
|
2685
|
+
item: F.value,
|
|
2528
2686
|
layout: "reel",
|
|
2529
2687
|
"loaded-count": t.items.length,
|
|
2530
|
-
"media-index":
|
|
2688
|
+
"media-index": I.value,
|
|
2531
2689
|
"media-source": t.mediaSource,
|
|
2532
2690
|
placement: "header",
|
|
2533
2691
|
region: t.cardHeader,
|
|
@@ -2543,19 +2701,19 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2543
2701
|
"style",
|
|
2544
2702
|
"total"
|
|
2545
2703
|
])) : o("", !0),
|
|
2546
|
-
c("div",
|
|
2704
|
+
c("div", In, [c("div", {
|
|
2547
2705
|
ref_key: "galleryElement",
|
|
2548
2706
|
ref: f,
|
|
2549
2707
|
class: "gallery-shell reel-feed",
|
|
2550
|
-
"data-active-post-id":
|
|
2551
|
-
"data-active-media-index":
|
|
2552
|
-
onScrollPassive:
|
|
2708
|
+
"data-active-post-id": P.value,
|
|
2709
|
+
"data-active-media-index": I.value,
|
|
2710
|
+
onScrollPassive: ae
|
|
2553
2711
|
}, [t.reelForward.status === "idle" ? (w(), s("section", {
|
|
2554
2712
|
key: 1,
|
|
2555
2713
|
class: "reel-track",
|
|
2556
2714
|
style: x(j.value),
|
|
2557
2715
|
"aria-label": "Media gallery"
|
|
2558
|
-
}, [(w(!0), s(e, null, E(
|
|
2716
|
+
}, [(w(!0), s(e, null, E(ee.value, ({ fetchPriority: e, item: n, index: i }) => (w(), a(bn, {
|
|
2559
2717
|
key: n.postId,
|
|
2560
2718
|
active: i === h.value && !g.value,
|
|
2561
2719
|
"advance-on-media-end": u.reelAutoAdvance.enabled && i === h.value,
|
|
@@ -2564,13 +2722,13 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2564
2722
|
"fetch-priority": e,
|
|
2565
2723
|
index: i,
|
|
2566
2724
|
item: n,
|
|
2567
|
-
"item-style":
|
|
2725
|
+
"item-style": J(i),
|
|
2568
2726
|
"media-card": t.mediaCard,
|
|
2569
2727
|
layout: "reel",
|
|
2570
2728
|
"loaded-count": t.items.length,
|
|
2571
2729
|
"media-index": t.mediaIndices.get(n.postId) ?? 0,
|
|
2572
2730
|
"media-source": t.mediaSource,
|
|
2573
|
-
"preview-state": t.previewStates.get(M(
|
|
2731
|
+
"preview-state": t.previewStates.get(M(q)(n.postId, t.mediaIndices.get(n.postId) ?? 0)) ?? "loading",
|
|
2574
2732
|
"reel-controls-target": p.value,
|
|
2575
2733
|
"reel-audio-state": t.reelAudioState,
|
|
2576
2734
|
"stationary-reel-controls": "",
|
|
@@ -2606,13 +2764,13 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2606
2764
|
class: "reel-forward-status",
|
|
2607
2765
|
role: t.reelForward.status === "error" ? "alert" : "status",
|
|
2608
2766
|
"data-status": t.reelForward.status
|
|
2609
|
-
}, [c("p", null, A(
|
|
2767
|
+
}, [c("p", null, A(ie.value), 1), t.reelForward.status === "error" || t.reelForward.status === "end" ? (w(), s("button", {
|
|
2610
2768
|
key: 0,
|
|
2611
2769
|
class: "reel-forward-retry",
|
|
2612
2770
|
type: "button",
|
|
2613
2771
|
disabled: t.loadMoreLocked,
|
|
2614
2772
|
onClick: r[0] ||= (e) => d("retryForward")
|
|
2615
|
-
}, A(
|
|
2773
|
+
}, A(K.value ? "Load more" : "Retry"), 9, zn)) : o("", !0)], 8, Rn)), t.reelForward.status === "idle" ? (w(), a(fe, {
|
|
2616
2774
|
key: 2,
|
|
2617
2775
|
actions: t.feedFooterActions,
|
|
2618
2776
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2621,7 +2779,7 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2621
2779
|
"has-next": t.hasNext,
|
|
2622
2780
|
"is-loading": t.isLoadingMore,
|
|
2623
2781
|
"load-more-locked": t.loadMoreLocked,
|
|
2624
|
-
"show-load-more":
|
|
2782
|
+
"show-load-more": W.value,
|
|
2625
2783
|
state: t.state,
|
|
2626
2784
|
onLoadMore: r[2] ||= (e) => d("loadMore"),
|
|
2627
2785
|
onRetryEnd: r[3] ||= (e) => d("retryEnd")
|
|
@@ -2635,19 +2793,19 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2635
2793
|
"load-more-locked",
|
|
2636
2794
|
"show-load-more",
|
|
2637
2795
|
"state"
|
|
2638
|
-
])) : o("", !0)], 40,
|
|
2796
|
+
])) : o("", !0)], 40, Ln), c("div", {
|
|
2639
2797
|
ref_key: "reelControlsElement",
|
|
2640
2798
|
ref: p,
|
|
2641
2799
|
class: "reel-media-controls-host",
|
|
2642
2800
|
"data-test": "reel-media-controls-host"
|
|
2643
2801
|
}, null, 512)]),
|
|
2644
|
-
t.cardFooter &&
|
|
2802
|
+
t.cardFooter && F.value && t.reelForward.status === "idle" ? (w(), a(vt, {
|
|
2645
2803
|
key: 1,
|
|
2646
2804
|
index: h.value,
|
|
2647
|
-
item:
|
|
2805
|
+
item: F.value,
|
|
2648
2806
|
layout: "reel",
|
|
2649
2807
|
"loaded-count": t.items.length,
|
|
2650
|
-
"media-index":
|
|
2808
|
+
"media-index": I.value,
|
|
2651
2809
|
"media-source": t.mediaSource,
|
|
2652
2810
|
placement: "footer",
|
|
2653
2811
|
region: t.cardFooter,
|
|
@@ -2663,24 +2821,24 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2663
2821
|
"style",
|
|
2664
2822
|
"total"
|
|
2665
2823
|
])) : o("", !0),
|
|
2666
|
-
|
|
2667
|
-
key:
|
|
2824
|
+
te.value ? (w(), a(Fn, {
|
|
2825
|
+
key: V.value,
|
|
2668
2826
|
"duration-ms": t.reelAutoAdvance.intervalMs,
|
|
2669
|
-
label:
|
|
2827
|
+
label: U.value,
|
|
2670
2828
|
onComplete: _e
|
|
2671
2829
|
}, null, 8, ["duration-ms", "label"])) : o("", !0)
|
|
2672
2830
|
], 2));
|
|
2673
2831
|
}
|
|
2674
|
-
}),
|
|
2832
|
+
}), Un = ["data-info-sheet-open", "data-info-sheet-mode"], Wn = ["aria-hidden", "inert"], Gn = {
|
|
2675
2833
|
key: 0,
|
|
2676
2834
|
class: "reel-info-sheet-layer",
|
|
2677
2835
|
"data-test": "reel-info-sheet"
|
|
2678
|
-
},
|
|
2836
|
+
}, Kn = [
|
|
2679
2837
|
"role",
|
|
2680
2838
|
"aria-modal",
|
|
2681
2839
|
"tabindex",
|
|
2682
2840
|
"data-active-post-id"
|
|
2683
|
-
],
|
|
2841
|
+
], qn = /* @__PURE__ */ d({
|
|
2684
2842
|
__name: "ReelLayout",
|
|
2685
2843
|
props: {
|
|
2686
2844
|
forwardIndex: { default: null },
|
|
@@ -2741,9 +2899,9 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2741
2899
|
item: e,
|
|
2742
2900
|
layout: "reel",
|
|
2743
2901
|
loadedCount: l.items.length,
|
|
2744
|
-
mediaCount:
|
|
2902
|
+
mediaCount: G(e).length,
|
|
2745
2903
|
mediaIndex: T.value,
|
|
2746
|
-
mediaItem:
|
|
2904
|
+
mediaItem: re(e, T.value),
|
|
2747
2905
|
mediaSource: l.mediaSource ?? "preview",
|
|
2748
2906
|
origin: l.origin,
|
|
2749
2907
|
total: l.total
|
|
@@ -2758,28 +2916,28 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2758
2916
|
function M() {
|
|
2759
2917
|
p.value?.loadIfNearBottom();
|
|
2760
2918
|
}
|
|
2761
|
-
function
|
|
2919
|
+
function ee(e) {
|
|
2762
2920
|
return p.value?.moveActivePost(e) ?? !1;
|
|
2763
2921
|
}
|
|
2764
|
-
function
|
|
2922
|
+
function F(e, t) {
|
|
2765
2923
|
return p.value?.navigateToItem(e, t) ?? !1;
|
|
2766
2924
|
}
|
|
2767
|
-
function
|
|
2925
|
+
function I(e) {
|
|
2768
2926
|
return p.value?.transitionActiveMedia(e) ?? Promise.resolve(!1);
|
|
2769
2927
|
}
|
|
2770
|
-
function
|
|
2928
|
+
function L(e) {
|
|
2771
2929
|
return p.value?.transitionActivePost(e) ?? Promise.resolve(!1);
|
|
2772
2930
|
}
|
|
2773
|
-
function
|
|
2931
|
+
function R(e, t) {
|
|
2774
2932
|
d("error", e, t);
|
|
2775
2933
|
}
|
|
2776
|
-
function
|
|
2934
|
+
function z(e, t) {
|
|
2777
2935
|
d("mediaChange", e, t);
|
|
2778
2936
|
}
|
|
2779
|
-
function
|
|
2937
|
+
function B(e, t) {
|
|
2780
2938
|
d("ready", e, t);
|
|
2781
2939
|
}
|
|
2782
|
-
return
|
|
2940
|
+
return N(() => ({
|
|
2783
2941
|
overlay: l.infoSheetOverlay,
|
|
2784
2942
|
visible: E.value
|
|
2785
2943
|
}), async (e, t) => {
|
|
@@ -2796,10 +2954,10 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2796
2954
|
}), t({
|
|
2797
2955
|
changeActiveMedia: j,
|
|
2798
2956
|
loadIfNearBottom: M,
|
|
2799
|
-
moveActivePost:
|
|
2800
|
-
navigateToItem:
|
|
2801
|
-
transitionActiveMedia:
|
|
2802
|
-
transitionActivePost:
|
|
2957
|
+
moveActivePost: ee,
|
|
2958
|
+
navigateToItem: F,
|
|
2959
|
+
transitionActiveMedia: I,
|
|
2960
|
+
transitionActivePost: L
|
|
2803
2961
|
}), (t, r) => (w(), s("section", {
|
|
2804
2962
|
class: y(["reel-layout", `reel-layout--${e.infoSheetOverlay ? "overlay" : "layout"}`]),
|
|
2805
2963
|
"data-info-sheet-open": E.value || void 0,
|
|
@@ -2808,7 +2966,7 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2808
2966
|
class: "reel-layout-main",
|
|
2809
2967
|
"aria-hidden": e.infoSheetOverlay && E.value || void 0,
|
|
2810
2968
|
inert: e.infoSheetOverlay && E.value || void 0
|
|
2811
|
-
}, [u(
|
|
2969
|
+
}, [u(Hn, {
|
|
2812
2970
|
ref_key: "reelFeed",
|
|
2813
2971
|
ref: p,
|
|
2814
2972
|
"can-retry-end": e.canRetryEnd,
|
|
@@ -2833,11 +2991,11 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2833
2991
|
state: e.state,
|
|
2834
2992
|
total: e.total,
|
|
2835
2993
|
onActiveChange: r[0] ||= (e) => d("activeChange", e),
|
|
2836
|
-
onError:
|
|
2994
|
+
onError: R,
|
|
2837
2995
|
onMediaError: r[1] ||= (e, t) => d("mediaError", e, t),
|
|
2838
2996
|
onLoadMore: r[2] ||= (e) => d("loadMore"),
|
|
2839
|
-
onMediaChange:
|
|
2840
|
-
onReady:
|
|
2997
|
+
onMediaChange: z,
|
|
2998
|
+
onReady: B,
|
|
2841
2999
|
onRetryEnd: r[3] ||= (e) => d("retryEnd"),
|
|
2842
3000
|
onRetryForward: r[4] ||= (e) => d("retryForward"),
|
|
2843
3001
|
onReelAudioChange: r[5] ||= (e) => d("reelAudioChange", e)
|
|
@@ -2863,8 +3021,8 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2863
3021
|
"reel-forward",
|
|
2864
3022
|
"state",
|
|
2865
3023
|
"total"
|
|
2866
|
-
])], 8,
|
|
2867
|
-
default:
|
|
3024
|
+
])], 8, Wn), u(n, { name: "vibe-info-sheet" }, {
|
|
3025
|
+
default: P(() => [E.value && e.infoSheet && O.value ? (w(), s("div", Gn, [c("aside", {
|
|
2868
3026
|
ref_key: "sheetElement",
|
|
2869
3027
|
ref: m,
|
|
2870
3028
|
class: "reel-info-sheet",
|
|
@@ -2873,21 +3031,21 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2873
3031
|
"aria-modal": e.infoSheetOverlay ? "true" : void 0,
|
|
2874
3032
|
tabindex: e.infoSheetOverlay ? -1 : void 0,
|
|
2875
3033
|
"data-active-post-id": x.value?.postId
|
|
2876
|
-
}, [(w(), a(D(e.infoSheet.component), b(f(O.value)), null, 16))], 8,
|
|
3034
|
+
}, [(w(), a(D(e.infoSheet.component), b(f(O.value)), null, 16))], 8, Kn)])) : o("", !0)]),
|
|
2877
3035
|
_: 1
|
|
2878
|
-
})], 10,
|
|
3036
|
+
})], 10, Un));
|
|
2879
3037
|
}
|
|
2880
|
-
}),
|
|
2881
|
-
function
|
|
3038
|
+
}), Jn = 250, Yn = Array.prototype.forEach, Xn = Array.prototype[Symbol.iterator];
|
|
3039
|
+
function Zn(e) {
|
|
2882
3040
|
try {
|
|
2883
3041
|
if (!Reflect.has(e, "forEach")) return !1;
|
|
2884
3042
|
let t = j(e);
|
|
2885
|
-
return !h(e) && !_(e) && T(t) === e && Object.getPrototypeOf(t) === Array.prototype && !Object.prototype.hasOwnProperty.call(t, "forEach") && !Object.prototype.hasOwnProperty.call(t, Symbol.iterator) && t.forEach ===
|
|
3043
|
+
return !h(e) && !_(e) && T(t) === e && Object.getPrototypeOf(t) === Array.prototype && !Object.prototype.hasOwnProperty.call(t, "forEach") && !Object.prototype.hasOwnProperty.call(t, Symbol.iterator) && t.forEach === Yn && t[Symbol.iterator] === Xn;
|
|
2886
3044
|
} catch {
|
|
2887
3045
|
return !1;
|
|
2888
3046
|
}
|
|
2889
3047
|
}
|
|
2890
|
-
function
|
|
3048
|
+
function Qn(e) {
|
|
2891
3049
|
try {
|
|
2892
3050
|
if (!m(e) || h(e) || _(e)) return !1;
|
|
2893
3051
|
let t = j(e);
|
|
@@ -2898,7 +3056,7 @@ function Gn(e) {
|
|
|
2898
3056
|
return !1;
|
|
2899
3057
|
}
|
|
2900
3058
|
}
|
|
2901
|
-
function
|
|
3059
|
+
function $n(e, t) {
|
|
2902
3060
|
let n = !1;
|
|
2903
3061
|
return {
|
|
2904
3062
|
items: e,
|
|
@@ -2906,14 +3064,14 @@ function Kn(e, t) {
|
|
|
2906
3064
|
let r = /* @__PURE__ */ new Map();
|
|
2907
3065
|
return n = !0, e.forEach((e, i) => {
|
|
2908
3066
|
let a = e.postId;
|
|
2909
|
-
r.has(a) || r.set(a, t + i),
|
|
3067
|
+
r.has(a) || r.set(a, t + i), Qn(e) || (n = !1);
|
|
2910
3068
|
}), r;
|
|
2911
3069
|
}),
|
|
2912
3070
|
canRetain: () => n
|
|
2913
3071
|
};
|
|
2914
3072
|
}
|
|
2915
|
-
function
|
|
2916
|
-
let t =
|
|
3073
|
+
function er(e) {
|
|
3074
|
+
let t = oe(e), n = [], i = [], a = r(() => {
|
|
2917
3075
|
let t = /* @__PURE__ */ new Map(), n = e.items;
|
|
2918
3076
|
return Reflect.has(n, "forEach"), n.forEach((e, n) => {
|
|
2919
3077
|
let r = e.postId;
|
|
@@ -2921,18 +3079,18 @@ function qn(e) {
|
|
|
2921
3079
|
}), t;
|
|
2922
3080
|
}), o = r(() => {
|
|
2923
3081
|
let r = e.items, o = () => (n = [], i = [], [a]);
|
|
2924
|
-
if (!
|
|
3082
|
+
if (!Zn(r)) return o();
|
|
2925
3083
|
let s = t.value, c = s.length >= n.length;
|
|
2926
3084
|
for (let e = 0; e < s.length; e += 1) {
|
|
2927
3085
|
if (s[e] === void 0) return o();
|
|
2928
3086
|
c && e < n.length && n[e] !== s[e] && (c = !1);
|
|
2929
3087
|
}
|
|
2930
|
-
let l = c ? Math.floor(n.length /
|
|
3088
|
+
let l = c ? Math.floor(n.length / Jn) : 0, u = [];
|
|
2931
3089
|
for (let e = 0; e < l; e += 1) {
|
|
2932
3090
|
let t = i[e];
|
|
2933
|
-
u.push(t.canRetain() ? t :
|
|
3091
|
+
u.push(t.canRetain() ? t : $n(t.items, e * Jn));
|
|
2934
3092
|
}
|
|
2935
|
-
for (let e = l *
|
|
3093
|
+
for (let e = l * Jn; e < s.length; e += Jn) u.push($n(Object.freeze(s.slice(e, e + Jn)), e));
|
|
2936
3094
|
return n = s, i = u, i.map((e) => e.positions);
|
|
2937
3095
|
});
|
|
2938
3096
|
return (e) => {
|
|
@@ -2945,17 +3103,17 @@ function qn(e) {
|
|
|
2945
3103
|
}
|
|
2946
3104
|
//#endregion
|
|
2947
3105
|
//#region src/core/mediaLifecycle.ts
|
|
2948
|
-
var
|
|
2949
|
-
function
|
|
3106
|
+
var tr = /* @__PURE__ */ new WeakMap();
|
|
3107
|
+
function nr(e, t) {
|
|
2950
3108
|
if (typeof t == "number" && Number.isNaN(t)) return -1;
|
|
2951
3109
|
if (!m(e) || !m(e.items)) return e.items.findIndex((e) => e.postId === t);
|
|
2952
|
-
let n =
|
|
2953
|
-
return n || (n =
|
|
3110
|
+
let n = tr.get(e);
|
|
3111
|
+
return n || (n = er(e), tr.set(e, n)), n(t);
|
|
2954
3112
|
}
|
|
2955
|
-
function
|
|
2956
|
-
let a =
|
|
3113
|
+
function rr(e, t, n, r, i) {
|
|
3114
|
+
let a = nr(e, t), o = e.items[a];
|
|
2957
3115
|
if (!o) return null;
|
|
2958
|
-
let s =
|
|
3116
|
+
let s = K(o, n), c = re(o, s);
|
|
2959
3117
|
return {
|
|
2960
3118
|
item: o,
|
|
2961
3119
|
layout: r,
|
|
@@ -2968,8 +3126,8 @@ function Xn(e, t, n, r, i) {
|
|
|
2968
3126
|
postIndex: a
|
|
2969
3127
|
};
|
|
2970
3128
|
}
|
|
2971
|
-
function
|
|
2972
|
-
|
|
3129
|
+
function ir(e, t) {
|
|
3130
|
+
N(() => {
|
|
2973
3131
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null;
|
|
2974
3132
|
return {
|
|
2975
3133
|
mediaIndex: t === null ? 0 : e.mediaIndices.get(t) ?? 0,
|
|
@@ -2978,26 +3136,26 @@ function Zn(e, t) {
|
|
|
2978
3136
|
};
|
|
2979
3137
|
}, (n, r) => {
|
|
2980
3138
|
if (n.postId === null || n.postId === r?.postId && n.mediaIndex === r.mediaIndex && n.origin === r.origin) return;
|
|
2981
|
-
let i =
|
|
3139
|
+
let i = rr(e, n.postId, n.mediaIndex, "reel", n.origin);
|
|
2982
3140
|
i && t(i);
|
|
2983
3141
|
}, { flush: "sync" });
|
|
2984
3142
|
}
|
|
2985
3143
|
//#endregion
|
|
2986
3144
|
//#region src/components/useMediaLifecycle.ts
|
|
2987
|
-
function
|
|
3145
|
+
function ar() {
|
|
2988
3146
|
return k(O(/* @__PURE__ */ new Map()));
|
|
2989
3147
|
}
|
|
2990
|
-
function
|
|
2991
|
-
let n = /* @__PURE__ */ new Set(), i =
|
|
3148
|
+
function or(e, t) {
|
|
3149
|
+
let n = /* @__PURE__ */ new Set(), i = ar(), a = ar(), o = ar(), s = () => e.reelMediaSource === "preview" ? i : e.reelMediaSource === "mobile" ? o : a, c = r(() => s().value), l = /* @__PURE__ */ new Set();
|
|
2992
3150
|
function u() {
|
|
2993
3151
|
n.clear(), l.clear(), i.value = O(/* @__PURE__ */ new Map()), a.value = O(/* @__PURE__ */ new Map()), o.value = O(/* @__PURE__ */ new Map());
|
|
2994
3152
|
}
|
|
2995
3153
|
function d(e, t, n, r) {
|
|
2996
|
-
let i =
|
|
3154
|
+
let i = q(t, n);
|
|
2997
3155
|
e.value.set(i, r);
|
|
2998
3156
|
}
|
|
2999
3157
|
function f(t, n, r, i) {
|
|
3000
|
-
return
|
|
3158
|
+
return rr(e, t, n, r, i);
|
|
3001
3159
|
}
|
|
3002
3160
|
function p(e, n, r, i) {
|
|
3003
3161
|
let a = f(e, n, r, i);
|
|
@@ -3023,13 +3181,13 @@ function $n(e, t) {
|
|
|
3023
3181
|
d(s(), t, n, "ready"), p(t, n, "reel", e.reelOrigin ?? "reel");
|
|
3024
3182
|
}
|
|
3025
3183
|
function y(e, n) {
|
|
3026
|
-
let r =
|
|
3184
|
+
let r = q(e, n);
|
|
3027
3185
|
if (l.has(r)) return;
|
|
3028
3186
|
let i = f(e, n, "masonry", null);
|
|
3029
3187
|
i && (l.add(r), t.visible(i));
|
|
3030
3188
|
}
|
|
3031
3189
|
function b(e, r, i, a) {
|
|
3032
|
-
let o = [i,
|
|
3190
|
+
let o = [i, q(e, r)].join(":");
|
|
3033
3191
|
if (n.has(o)) return;
|
|
3034
3192
|
let s = f(e, r, i, a);
|
|
3035
3193
|
s && (n.add(o), t.fullyVisible(s));
|
|
@@ -3037,13 +3195,13 @@ function $n(e, t) {
|
|
|
3037
3195
|
function x(e, t) {
|
|
3038
3196
|
b(e, t, "masonry", null);
|
|
3039
3197
|
}
|
|
3040
|
-
return
|
|
3198
|
+
return ir(e, t.reelChange), N(() => {
|
|
3041
3199
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null, n = t === null ? 0 : e.mediaIndices.get(t) ?? 0;
|
|
3042
3200
|
return {
|
|
3043
3201
|
mediaIndex: n,
|
|
3044
3202
|
origin: e.reelOrigin ?? "reel",
|
|
3045
3203
|
postId: t,
|
|
3046
|
-
ready: t !== null && c.value.get(
|
|
3204
|
+
ready: t !== null && c.value.get(q(t, n)) === "ready"
|
|
3047
3205
|
};
|
|
3048
3206
|
}, (e, t) => {
|
|
3049
3207
|
e.postId === null || !e.ready || t?.ready && t.postId === e.postId && t.mediaIndex === e.mediaIndex && t.origin === e.origin || b(e.postId, e.mediaIndex, "reel", e.origin);
|
|
@@ -3063,16 +3221,16 @@ function $n(e, t) {
|
|
|
3063
3221
|
}
|
|
3064
3222
|
//#endregion
|
|
3065
3223
|
//#region src/core/reelEscapeStack.ts
|
|
3066
|
-
var
|
|
3067
|
-
function
|
|
3068
|
-
return
|
|
3069
|
-
let t =
|
|
3070
|
-
t >= 0 &&
|
|
3224
|
+
var sr = [];
|
|
3225
|
+
function cr(e) {
|
|
3226
|
+
return sr.push(e), () => {
|
|
3227
|
+
let t = sr.indexOf(e);
|
|
3228
|
+
t >= 0 && sr.splice(t, 1);
|
|
3071
3229
|
};
|
|
3072
3230
|
}
|
|
3073
|
-
function
|
|
3231
|
+
function lr(e) {
|
|
3074
3232
|
if (!e.isActive()) return !1;
|
|
3075
|
-
let t =
|
|
3233
|
+
let t = sr.filter((e) => e.isActive()), n = e.element();
|
|
3076
3234
|
return n !== null && t.some((t) => {
|
|
3077
3235
|
if (t === e) return !1;
|
|
3078
3236
|
let r = t.element();
|
|
@@ -3088,14 +3246,14 @@ function nr(e) {
|
|
|
3088
3246
|
}
|
|
3089
3247
|
//#endregion
|
|
3090
3248
|
//#region src/components/useReelKeyboard.ts
|
|
3091
|
-
function
|
|
3249
|
+
function ur(e) {
|
|
3092
3250
|
let t = {
|
|
3093
3251
|
element: e.element,
|
|
3094
3252
|
isActive: () => e.state.layout === "reel" || e.state.reelOrigin === "masonry"
|
|
3095
3253
|
}, n = null;
|
|
3096
3254
|
function r(n) {
|
|
3097
3255
|
let r = t.isActive();
|
|
3098
|
-
if (n.key === "Escape" && r && !
|
|
3256
|
+
if (n.key === "Escape" && r && !lr(t)) return;
|
|
3099
3257
|
if (n.key === "Escape" && e.state.reelOrigin === "masonry") {
|
|
3100
3258
|
n.preventDefault(), e.state.reelInfoSheetOverlay && e.state.reelInfoSheet.enabled && e.setReelInfoSheet(!1), e.closeMasonryReel();
|
|
3101
3259
|
return;
|
|
@@ -3115,14 +3273,14 @@ function rr(e) {
|
|
|
3115
3273
|
a !== 0 && e.reelRenderer()?.changeActiveMedia?.(a) && n.preventDefault();
|
|
3116
3274
|
}
|
|
3117
3275
|
C(() => {
|
|
3118
|
-
n =
|
|
3276
|
+
n = cr(t), window.addEventListener("keydown", r);
|
|
3119
3277
|
}), S(() => {
|
|
3120
3278
|
window.removeEventListener("keydown", r), n?.(), n = null;
|
|
3121
3279
|
});
|
|
3122
3280
|
}
|
|
3123
3281
|
//#endregion
|
|
3124
3282
|
//#region src/components/VibeSurface.vue?vue&type=script&setup=true&lang.ts
|
|
3125
|
-
var
|
|
3283
|
+
var dr = 35, fr = 420, pr = /* @__PURE__ */ d({
|
|
3126
3284
|
__name: "VibeSurface",
|
|
3127
3285
|
props: {
|
|
3128
3286
|
canRetryEnd: { type: Boolean },
|
|
@@ -3152,69 +3310,69 @@ var ir = 35, ar = 420, or = /* @__PURE__ */ d({
|
|
|
3152
3310
|
"retryForward"
|
|
3153
3311
|
],
|
|
3154
3312
|
setup(t, { expose: i, emit: c }) {
|
|
3155
|
-
let l = t, d = c, f = k(null), p = k(null), m = k(null), h = k(null), g = k(!1), _ = k(/* @__PURE__ */ new Set()), y = k(/* @__PURE__ */ new Map()), b = k(/* @__PURE__ */ new Set()), x = k(/* @__PURE__ */ new Map()), C = r(() =>
|
|
3313
|
+
let l = t, d = c, f = k(null), p = k(null), m = k(null), h = k(null), g = k(!1), _ = k(/* @__PURE__ */ new Set()), y = k(/* @__PURE__ */ new Map()), b = k(/* @__PURE__ */ new Set()), x = k(/* @__PURE__ */ new Map()), C = r(() => oe(l.state).value), T = r(() => X(l.state, C.value)), { markMediaError: E, markMasonryFullyVisible: D, markMasonryVisible: O, markPreviewError: A, markPreviewReady: j, markReelError: ee, markReelReady: F, originalStates: I, previewStates: L, reelStates: R, resetMediaLifecycle: z } = or(l.state, {
|
|
3156
3314
|
error: (e) => d("mediaError", e),
|
|
3157
3315
|
fullyVisible: (e) => d("mediaFullyVisible", e),
|
|
3158
3316
|
ready: (e) => d("mediaReady", e),
|
|
3159
3317
|
reelChange: (e) => d("reelMediaChange", e),
|
|
3160
3318
|
visible: (e) => d("mediaVisible", e)
|
|
3161
|
-
}),
|
|
3162
|
-
function
|
|
3319
|
+
}), B = new Set(Y(l.state.items)), V = null, H = null, U = !1;
|
|
3320
|
+
function te() {
|
|
3163
3321
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
3164
3322
|
}
|
|
3165
|
-
function
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3323
|
+
function W() {
|
|
3324
|
+
V !== null && cancelAnimationFrame(V), V = requestAnimationFrame(() => {
|
|
3325
|
+
V = requestAnimationFrame(() => {
|
|
3326
|
+
V = null, _.value = /* @__PURE__ */ new Set();
|
|
3169
3327
|
});
|
|
3170
3328
|
});
|
|
3171
3329
|
}
|
|
3172
|
-
function
|
|
3330
|
+
function ne(e, t) {
|
|
3173
3331
|
let n = l.state.items.find((t) => t.postId === e);
|
|
3174
3332
|
if (!n) return;
|
|
3175
|
-
let r =
|
|
3333
|
+
let r = K(n, t);
|
|
3176
3334
|
(l.state.mediaIndices.get(e) ?? 0) !== r && (l.state.mediaIndices = new Map(l.state.mediaIndices).set(e, r));
|
|
3177
3335
|
}
|
|
3178
|
-
async function
|
|
3336
|
+
async function re() {
|
|
3179
3337
|
await v(), (l.state.layout === "reel" || l.state.reelOrigin === "masonry" ? p.value : f.value)?.loadIfNearBottom();
|
|
3180
3338
|
}
|
|
3181
|
-
function
|
|
3339
|
+
function q(e) {
|
|
3182
3340
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.changeActiveMedia?.(e) ?? !1;
|
|
3183
3341
|
}
|
|
3184
|
-
function
|
|
3342
|
+
function ie(e) {
|
|
3185
3343
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.moveActivePost?.(e) ?? !1;
|
|
3186
3344
|
}
|
|
3187
|
-
function
|
|
3345
|
+
function J(e) {
|
|
3188
3346
|
if (!(l.state.layout === "reel" || l.state.reelOrigin === "masonry") || l.state.isLoading) return "reel-inactive";
|
|
3189
3347
|
let t = l.state.items.find((t) => t.postId === e.postId);
|
|
3190
3348
|
if (!t) return "not-found";
|
|
3191
|
-
let n =
|
|
3349
|
+
let n = G(t).findIndex((t) => t.mediaId === e.mediaId);
|
|
3192
3350
|
return n < 0 ? "not-found" : p.value?.navigateToItem?.(e.postId, n) ? "navigated" : "reel-inactive";
|
|
3193
3351
|
}
|
|
3194
|
-
function
|
|
3352
|
+
function ae() {
|
|
3195
3353
|
return l.state.layout !== "masonry" || l.state.reelOrigin === "masonry" ? null : f.value?.getScrollElement?.() ?? null;
|
|
3196
3354
|
}
|
|
3197
|
-
function
|
|
3198
|
-
|
|
3355
|
+
function se(e, t) {
|
|
3356
|
+
H = e, U = t === "keyboard", d("openReel", e), v(() => m.value?.focus());
|
|
3199
3357
|
}
|
|
3200
|
-
function
|
|
3358
|
+
function Z(e) {
|
|
3201
3359
|
let t = h.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [];
|
|
3202
3360
|
return Array.from(t).find((t) => t.dataset.postId === String(e)) ?? null;
|
|
3203
3361
|
}
|
|
3204
|
-
function
|
|
3205
|
-
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null ||
|
|
3362
|
+
function ce(e, t) {
|
|
3363
|
+
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || te()) return 0;
|
|
3206
3364
|
let n = [...new Set(e)], r = new Set(Array.from(h.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [], (e) => e.dataset.postId)), i = n.filter((e) => r.has(String(e)));
|
|
3207
3365
|
if (i.length === 0) return 0;
|
|
3208
|
-
let a = new Map(x.value), o = t?.staggerMs ??
|
|
3366
|
+
let a = new Map(x.value), o = t?.staggerMs ?? dr;
|
|
3209
3367
|
return i.forEach((e, t) => {
|
|
3210
3368
|
a.set(e, t * o);
|
|
3211
|
-
}), _.value = new Set([..._.value].filter((e) => !i.includes(e))), b.value = new Set([...b.value, ...n]), x.value = a,
|
|
3369
|
+
}), _.value = new Set([..._.value].filter((e) => !i.includes(e))), b.value = new Set([...b.value, ...n]), x.value = a, fr + (i.length - 1) * o;
|
|
3212
3370
|
}
|
|
3213
|
-
function
|
|
3371
|
+
function le() {
|
|
3214
3372
|
b.value = /* @__PURE__ */ new Set(), x.value = /* @__PURE__ */ new Map();
|
|
3215
3373
|
}
|
|
3216
|
-
async function
|
|
3217
|
-
if (t.aborted ||
|
|
3374
|
+
async function Q(e, t) {
|
|
3375
|
+
if (t.aborted || ce(e, { staggerMs: 0 }) === 0 || (await v(), t.aborted)) return;
|
|
3218
3376
|
let n = h.value?.querySelectorAll(".masonry-feed .media-card--leaving") ?? [], r = Array.from(n).flatMap((e) => (getComputedStyle(e).opacity, e.getAnimations?.().filter((e) => e.effect?.getTiming().iterations !== Infinity) ?? []));
|
|
3219
3377
|
await new Promise((e) => {
|
|
3220
3378
|
let n = () => {
|
|
@@ -3224,59 +3382,59 @@ var ir = 35, ar = 420, or = /* @__PURE__ */ d({
|
|
|
3224
3382
|
});
|
|
3225
3383
|
}
|
|
3226
3384
|
function ue(e, t) {
|
|
3227
|
-
let n =
|
|
3385
|
+
let n = Z(e), r = n?.querySelector(".media-card-activator") ?? n;
|
|
3228
3386
|
r && (r.classList.toggle("media-card-focus-silent", !t), t || r.addEventListener("blur", () => {
|
|
3229
3387
|
r.classList.remove("media-card-focus-silent");
|
|
3230
3388
|
}, { once: !0 }), r?.focus({ preventScroll: !0 }));
|
|
3231
3389
|
}
|
|
3232
3390
|
function de() {
|
|
3233
|
-
l.state.reelOrigin === "masonry" && (
|
|
3391
|
+
l.state.reelOrigin === "masonry" && (H ??= l.state.activeReelPostId, g.value = !0, d("closeReel"));
|
|
3234
3392
|
}
|
|
3235
3393
|
function fe() {
|
|
3236
|
-
let e =
|
|
3237
|
-
g.value = !1,
|
|
3394
|
+
let e = H, t = U;
|
|
3395
|
+
g.value = !1, H = null, U = !1, v(() => {
|
|
3238
3396
|
e !== null && ue(e, t);
|
|
3239
3397
|
});
|
|
3240
3398
|
}
|
|
3241
|
-
return
|
|
3399
|
+
return ur({
|
|
3242
3400
|
closeMasonryReel: de,
|
|
3243
3401
|
element: () => h.value,
|
|
3244
3402
|
isReelLeaving: () => g.value,
|
|
3245
3403
|
reelRenderer: () => p.value,
|
|
3246
3404
|
setReelInfoSheet: (e) => d("reelInfoSheetChange", e),
|
|
3247
3405
|
state: l.state
|
|
3248
|
-
}),
|
|
3406
|
+
}), N(() => {
|
|
3249
3407
|
let e = l.state.items;
|
|
3250
3408
|
return [e, e.length];
|
|
3251
3409
|
}, ([e]) => {
|
|
3252
|
-
let t =
|
|
3253
|
-
if (
|
|
3410
|
+
let t = Y(e), n = t.filter((e) => !B.has(e)), r = new Set(t);
|
|
3411
|
+
if (B = r, b.value = new Set([...b.value].filter((e) => r.has(e))), x.value = new Map([...x.value].filter(([e]) => r.has(e))), n.length === 0 || te()) return;
|
|
3254
3412
|
let i = /* @__PURE__ */ new Map();
|
|
3255
3413
|
t.forEach((e) => {
|
|
3256
3414
|
let t = y.value.get(e);
|
|
3257
3415
|
t !== void 0 && i.set(e, t);
|
|
3258
3416
|
}), n.forEach((e, t) => {
|
|
3259
|
-
i.set(e, t *
|
|
3260
|
-
}), y.value = i, _.value = new Set([..._.value, ...n]),
|
|
3417
|
+
i.set(e, t * dr);
|
|
3418
|
+
}), y.value = i, _.value = new Set([..._.value, ...n]), W();
|
|
3261
3419
|
}, { flush: "sync" }), S(() => {
|
|
3262
|
-
|
|
3420
|
+
V !== null && cancelAnimationFrame(V);
|
|
3263
3421
|
}), i({
|
|
3264
|
-
animateItemRemoval:
|
|
3265
|
-
cancelItemRemoval:
|
|
3266
|
-
changeActiveReelMedia:
|
|
3267
|
-
getAutoScrollElement:
|
|
3268
|
-
loadIfNearBottom:
|
|
3269
|
-
moveActiveReelPost:
|
|
3270
|
-
navigateToReelItem:
|
|
3271
|
-
resetMediaLifecycle:
|
|
3272
|
-
startItemRemoval:
|
|
3422
|
+
animateItemRemoval: Q,
|
|
3423
|
+
cancelItemRemoval: le,
|
|
3424
|
+
changeActiveReelMedia: q,
|
|
3425
|
+
getAutoScrollElement: ae,
|
|
3426
|
+
loadIfNearBottom: re,
|
|
3427
|
+
moveActiveReelPost: ie,
|
|
3428
|
+
navigateToReelItem: J,
|
|
3429
|
+
resetMediaLifecycle: z,
|
|
3430
|
+
startItemRemoval: ce,
|
|
3273
3431
|
transitionActiveReelMedia: (e) => p.value?.transitionActiveMedia?.(e) ?? Promise.resolve(!1),
|
|
3274
3432
|
transitionActiveReelPost: (e) => p.value?.transitionActivePost?.(e) ?? Promise.resolve(!1)
|
|
3275
3433
|
}), (r, i) => (w(), s("div", {
|
|
3276
3434
|
ref_key: "surfaceElement",
|
|
3277
3435
|
ref: h,
|
|
3278
3436
|
class: "vibe-surface"
|
|
3279
|
-
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (w(), a(
|
|
3437
|
+
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (w(), a(qn, {
|
|
3280
3438
|
key: 0,
|
|
3281
3439
|
ref_key: "reelRenderer",
|
|
3282
3440
|
ref: p,
|
|
@@ -3301,7 +3459,7 @@ var ir = 35, ar = 420, or = /* @__PURE__ */ d({
|
|
|
3301
3459
|
"info-sheet-overlay": t.state.reelInfoSheetOverlay,
|
|
3302
3460
|
"next-page-error": !!t.state.nextPageError,
|
|
3303
3461
|
origin: "reel",
|
|
3304
|
-
"preview-states": M(
|
|
3462
|
+
"preview-states": M(R),
|
|
3305
3463
|
"reel-auto-advance": t.state.reelAutoAdvance,
|
|
3306
3464
|
"reel-audio-state": t.reelAudioState,
|
|
3307
3465
|
"reel-forward": t.state.reelForward,
|
|
@@ -3309,11 +3467,11 @@ var ir = 35, ar = 420, or = /* @__PURE__ */ d({
|
|
|
3309
3467
|
total: t.state.total,
|
|
3310
3468
|
onActiveChange: i[0] ||= (e) => d("activeReelChange", e),
|
|
3311
3469
|
onCloseInfoSheet: i[1] ||= (e) => d("reelInfoSheetChange", !1),
|
|
3312
|
-
onError: M(
|
|
3470
|
+
onError: M(ee),
|
|
3313
3471
|
onMediaError: i[2] ||= (e, t) => M(E)(e, t, "reel"),
|
|
3314
3472
|
onLoadMore: i[3] ||= (e) => d("loadMore"),
|
|
3315
|
-
onMediaChange:
|
|
3316
|
-
onReady: M(
|
|
3473
|
+
onMediaChange: ne,
|
|
3474
|
+
onReady: M(F),
|
|
3317
3475
|
onRetryEnd: i[4] ||= (e) => d("retryEnd"),
|
|
3318
3476
|
onRetryForward: i[5] ||= (e) => d("retryForward"),
|
|
3319
3477
|
onReelAudioChange: i[6] ||= (e) => d("reelAudioChange", e)
|
|
@@ -3330,7 +3488,7 @@ var ir = 35, ar = 420, or = /* @__PURE__ */ d({
|
|
|
3330
3488
|
"can-retry-end",
|
|
3331
3489
|
"feed-footer",
|
|
3332
3490
|
"state"
|
|
3333
|
-
])) : (w(), s(e, { key: 2 }, [u(
|
|
3491
|
+
])) : (w(), s(e, { key: 2 }, [u(jn, {
|
|
3334
3492
|
ref_key: "masonryRenderer",
|
|
3335
3493
|
ref: f,
|
|
3336
3494
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -3351,16 +3509,16 @@ var ir = 35, ar = 420, or = /* @__PURE__ */ d({
|
|
|
3351
3509
|
"load-more-locked": t.state.loadMoreLocked,
|
|
3352
3510
|
"media-indices": t.state.mediaIndices,
|
|
3353
3511
|
"next-page-error": !!t.state.nextPageError,
|
|
3354
|
-
"preview-states": M(
|
|
3512
|
+
"preview-states": M(L),
|
|
3355
3513
|
suspended: t.state.reelOrigin === "masonry" || g.value,
|
|
3356
3514
|
state: T.value,
|
|
3357
3515
|
total: t.state.total,
|
|
3358
|
-
onActivate:
|
|
3516
|
+
onActivate: se,
|
|
3359
3517
|
onError: M(A),
|
|
3360
3518
|
onMediaError: i[9] ||= (e, t) => M(E)(e, t, "masonry"),
|
|
3361
3519
|
onFullyVisible: M(D),
|
|
3362
3520
|
onLoadMore: i[10] ||= (e) => d("loadMore"),
|
|
3363
|
-
onMediaChange:
|
|
3521
|
+
onMediaChange: ne,
|
|
3364
3522
|
onReady: M(j),
|
|
3365
3523
|
onRetryEnd: i[11] ||= (e) => d("retryEnd"),
|
|
3366
3524
|
onVisible: M(O)
|
|
@@ -3368,7 +3526,7 @@ var ir = 35, ar = 420, or = /* @__PURE__ */ d({
|
|
|
3368
3526
|
name: "vibe-reel-viewer",
|
|
3369
3527
|
onAfterLeave: fe
|
|
3370
3528
|
}, {
|
|
3371
|
-
default:
|
|
3529
|
+
default: P(() => [t.state.reelOrigin === "masonry" ? (w(), s("section", {
|
|
3372
3530
|
key: 0,
|
|
3373
3531
|
ref_key: "reelOverlay",
|
|
3374
3532
|
ref: m,
|
|
@@ -3377,7 +3535,7 @@ var ir = 35, ar = 420, or = /* @__PURE__ */ d({
|
|
|
3377
3535
|
"aria-label": "Media viewer",
|
|
3378
3536
|
"aria-modal": "true",
|
|
3379
3537
|
tabindex: "-1"
|
|
3380
|
-
}, [u(
|
|
3538
|
+
}, [u(qn, {
|
|
3381
3539
|
ref_key: "reelRenderer",
|
|
3382
3540
|
ref: p,
|
|
3383
3541
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -3401,7 +3559,7 @@ var ir = 35, ar = 420, or = /* @__PURE__ */ d({
|
|
|
3401
3559
|
"media-source": "original",
|
|
3402
3560
|
"next-page-error": !!t.state.nextPageError,
|
|
3403
3561
|
origin: "masonry",
|
|
3404
|
-
"preview-states": M(
|
|
3562
|
+
"preview-states": M(I),
|
|
3405
3563
|
"reel-auto-advance": t.state.reelAutoAdvance,
|
|
3406
3564
|
"reel-audio-state": t.reelAudioState,
|
|
3407
3565
|
"reel-forward": t.state.reelForward,
|
|
@@ -3409,11 +3567,11 @@ var ir = 35, ar = 420, or = /* @__PURE__ */ d({
|
|
|
3409
3567
|
total: t.state.total,
|
|
3410
3568
|
onActiveChange: i[12] ||= (e) => d("activeReelChange", e),
|
|
3411
3569
|
onCloseInfoSheet: i[13] ||= (e) => d("reelInfoSheetChange", !1),
|
|
3412
|
-
onError: M(
|
|
3570
|
+
onError: M(ee),
|
|
3413
3571
|
onMediaError: i[14] ||= (e, t) => M(E)(e, t, "reel"),
|
|
3414
3572
|
onLoadMore: i[15] ||= (e) => d("loadMore"),
|
|
3415
|
-
onMediaChange:
|
|
3416
|
-
onReady: M(
|
|
3573
|
+
onMediaChange: ne,
|
|
3574
|
+
onReady: M(F),
|
|
3417
3575
|
onRetryEnd: i[16] ||= (e) => d("retryEnd"),
|
|
3418
3576
|
onRetryForward: i[17] ||= (e) => d("retryForward"),
|
|
3419
3577
|
onReelAudioChange: i[18] ||= (e) => d("reelAudioChange", e)
|
|
@@ -3424,41 +3582,41 @@ var ir = 35, ar = 420, or = /* @__PURE__ */ d({
|
|
|
3424
3582
|
});
|
|
3425
3583
|
//#endregion
|
|
3426
3584
|
//#region src/core/page.ts
|
|
3427
|
-
function
|
|
3585
|
+
function mr(e) {
|
|
3428
3586
|
if (!e || typeof e != "object" || !Array.isArray(e.items)) throw TypeError("Vibe loadPage must resolve to a page with an items array.");
|
|
3429
3587
|
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.");
|
|
3430
3588
|
if (e.next !== null && typeof e.next != "string" && typeof e.next != "number") throw TypeError("Vibe page next must be a string, number, or null.");
|
|
3431
3589
|
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.");
|
|
3432
3590
|
return e;
|
|
3433
3591
|
}
|
|
3434
|
-
function
|
|
3435
|
-
let n = new Set(
|
|
3436
|
-
return [...e, ...
|
|
3592
|
+
function hr(e, t) {
|
|
3593
|
+
let n = new Set(Y(e));
|
|
3594
|
+
return [...e, ...gr(n, t)];
|
|
3437
3595
|
}
|
|
3438
|
-
function
|
|
3596
|
+
function gr(e, t) {
|
|
3439
3597
|
return t.filter((t) => e.has(t.postId) ? !1 : (e.add(t.postId), !0));
|
|
3440
3598
|
}
|
|
3441
|
-
function
|
|
3599
|
+
function _r(e, t) {
|
|
3442
3600
|
if (t.length === 0) return e;
|
|
3443
|
-
let n =
|
|
3601
|
+
let n = gr(new Set(Y(e)), t);
|
|
3444
3602
|
return n.length > 0 ? [...e, ...n] : e;
|
|
3445
3603
|
}
|
|
3446
|
-
function
|
|
3604
|
+
function vr(e) {
|
|
3447
3605
|
return `${typeof e}:${String(e)}`;
|
|
3448
3606
|
}
|
|
3449
|
-
function
|
|
3450
|
-
return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview?.src ?? ""}` : `id:${
|
|
3607
|
+
function yr(e) {
|
|
3608
|
+
return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview?.src ?? ""}` : `id:${vr(e.mediaId)}`;
|
|
3451
3609
|
}
|
|
3452
|
-
function
|
|
3453
|
-
let n = [...e], r = new Map(
|
|
3610
|
+
function br(e, t) {
|
|
3611
|
+
let n = [...e], r = new Map(Y(e).map((e, t) => [vr(e), t]));
|
|
3454
3612
|
return t.forEach((e) => {
|
|
3455
|
-
let t =
|
|
3613
|
+
let t = vr(e.postId), i = r.get(t);
|
|
3456
3614
|
if (i === void 0) {
|
|
3457
3615
|
r.set(t, n.length), n.push(e);
|
|
3458
3616
|
return;
|
|
3459
3617
|
}
|
|
3460
|
-
let a = n[i], o = new Set([a, ...a.items].map(
|
|
3461
|
-
let t =
|
|
3618
|
+
let a = n[i], o = new Set([a, ...a.items].map(yr)), s = [e, ...e.items].filter((e) => {
|
|
3619
|
+
let t = yr(e);
|
|
3462
3620
|
return o.has(t) ? !1 : (o.add(t), !0);
|
|
3463
3621
|
});
|
|
3464
3622
|
s.length > 0 && (n[i] = {
|
|
@@ -3467,14 +3625,14 @@ function pr(e, t) {
|
|
|
3467
3625
|
});
|
|
3468
3626
|
}), n;
|
|
3469
3627
|
}
|
|
3470
|
-
function
|
|
3628
|
+
function xr(e) {
|
|
3471
3629
|
return Object.prototype.hasOwnProperty.call(e, "current") ? e.current ?? null : e.next;
|
|
3472
3630
|
}
|
|
3473
3631
|
//#endregion
|
|
3474
3632
|
//#region src/core/appendPage.ts
|
|
3475
|
-
function
|
|
3476
|
-
let i =
|
|
3477
|
-
t.items =
|
|
3633
|
+
function Sr(e, t, n, r) {
|
|
3634
|
+
let i = mr(e), a = n.filterItems(i.items), o = xr(i);
|
|
3635
|
+
t.items = br(t.items, a), t.next = i.next, i.total !== void 0 && (t.total = i.total), r(o), n.recordPages([{
|
|
3478
3636
|
contributionIds: a.map(({ postId: e }) => e),
|
|
3479
3637
|
cursor: o,
|
|
3480
3638
|
next: i.next,
|
|
@@ -3483,32 +3641,32 @@ function hr(e, t, n, r) {
|
|
|
3483
3641
|
}
|
|
3484
3642
|
//#endregion
|
|
3485
3643
|
//#region src/core/requestDelay.ts
|
|
3486
|
-
var
|
|
3644
|
+
var Cr = 2e3, wr = 1e4, Tr = 250, Er = {
|
|
3487
3645
|
delayRemainingMs: null,
|
|
3488
3646
|
nextRequestAt: null
|
|
3489
3647
|
};
|
|
3490
|
-
function
|
|
3648
|
+
function Dr(e, t) {
|
|
3491
3649
|
return e === void 0 ? t : Math.floor(e);
|
|
3492
3650
|
}
|
|
3493
|
-
function
|
|
3651
|
+
function Or(e, t) {
|
|
3494
3652
|
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.`);
|
|
3495
3653
|
}
|
|
3496
|
-
function
|
|
3497
|
-
let n =
|
|
3654
|
+
function kr(e, t = {}) {
|
|
3655
|
+
let n = Dr(t.delayStepMs, Cr), r = Dr(t.delayMaxMs, wr);
|
|
3498
3656
|
return Math.min(Math.max(0, e) * n, r);
|
|
3499
3657
|
}
|
|
3500
|
-
function
|
|
3501
|
-
if (e == null || !Number.isFinite(e)) return { ...
|
|
3658
|
+
function Ar(e) {
|
|
3659
|
+
if (e == null || !Number.isFinite(e)) return { ...Er };
|
|
3502
3660
|
let t = Math.max(0, Math.floor(e - Date.now()));
|
|
3503
3661
|
return t > 0 ? {
|
|
3504
3662
|
delayRemainingMs: t,
|
|
3505
3663
|
nextRequestAt: e
|
|
3506
|
-
} : { ...
|
|
3664
|
+
} : { ...Er };
|
|
3507
3665
|
}
|
|
3508
|
-
async function
|
|
3666
|
+
async function jr({ delayMs: e, onChange: t, signal: n }) {
|
|
3509
3667
|
if (n.aborted) throw new DOMException("Aborted", "AbortError");
|
|
3510
3668
|
if (e <= 0) {
|
|
3511
|
-
t({ ...
|
|
3669
|
+
t({ ...Er });
|
|
3512
3670
|
return;
|
|
3513
3671
|
}
|
|
3514
3672
|
let r = Date.now() + e;
|
|
@@ -3516,9 +3674,9 @@ async function wr({ delayMs: e, onChange: t, signal: n }) {
|
|
|
3516
3674
|
delayRemainingMs: e,
|
|
3517
3675
|
nextRequestAt: r
|
|
3518
3676
|
}), await new Promise((i, a) => {
|
|
3519
|
-
let o = !1, s = setInterval(f,
|
|
3677
|
+
let o = !1, s = setInterval(f, Tr), c = setTimeout(() => u(), e);
|
|
3520
3678
|
function l() {
|
|
3521
|
-
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...
|
|
3679
|
+
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...Er });
|
|
3522
3680
|
}
|
|
3523
3681
|
function u(e) {
|
|
3524
3682
|
o || (o = !0, l(), e ? a(e) : i());
|
|
@@ -3527,42 +3685,42 @@ async function wr({ delayMs: e, onChange: t, signal: n }) {
|
|
|
3527
3685
|
u(new DOMException("Aborted", "AbortError"));
|
|
3528
3686
|
}
|
|
3529
3687
|
function f() {
|
|
3530
|
-
let e =
|
|
3688
|
+
let e = Ar(r);
|
|
3531
3689
|
t(e), e.delayRemainingMs === null && u();
|
|
3532
3690
|
}
|
|
3533
3691
|
n.addEventListener("abort", d, { once: !0 });
|
|
3534
3692
|
});
|
|
3535
3693
|
}
|
|
3536
|
-
var
|
|
3694
|
+
var Mr = class {
|
|
3537
3695
|
interval = null;
|
|
3538
3696
|
constructor(e) {
|
|
3539
3697
|
this.onChange = e;
|
|
3540
3698
|
}
|
|
3541
3699
|
clear() {
|
|
3542
|
-
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...
|
|
3700
|
+
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...Er });
|
|
3543
3701
|
}
|
|
3544
3702
|
sync(e) {
|
|
3545
3703
|
this.clear();
|
|
3546
|
-
let t =
|
|
3704
|
+
let t = Ar(e);
|
|
3547
3705
|
this.onChange(t), t.delayRemainingMs !== null && (this.interval = setInterval(() => {
|
|
3548
|
-
let t =
|
|
3706
|
+
let t = Ar(e);
|
|
3549
3707
|
this.onChange(t), t.delayRemainingMs === null && this.clear();
|
|
3550
|
-
},
|
|
3708
|
+
}, Tr));
|
|
3551
3709
|
}
|
|
3552
3710
|
};
|
|
3553
|
-
function
|
|
3711
|
+
function Nr(e, t = !0) {
|
|
3554
3712
|
return e.maxAdditionalPages === "unlimited" ? Infinity : (e.maxAdditionalPages ?? 10) + (t ? 1 : 0);
|
|
3555
3713
|
}
|
|
3556
|
-
function
|
|
3714
|
+
function Pr(e) {
|
|
3557
3715
|
return `${typeof e}:${String(e)}`;
|
|
3558
3716
|
}
|
|
3559
|
-
function
|
|
3717
|
+
function Fr(e, t) {
|
|
3560
3718
|
if (!Number.isInteger(e) || e <= 0) throw TypeError(`Vibe ${t} must be a positive integer.`);
|
|
3561
3719
|
}
|
|
3562
|
-
function
|
|
3720
|
+
function Ir(e) {
|
|
3563
3721
|
if (!e) return;
|
|
3564
|
-
if (
|
|
3565
|
-
|
|
3722
|
+
if (Fr(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
|
|
3723
|
+
Or(e, "frontend autofill");
|
|
3566
3724
|
let t = e.maxAdditionalPages;
|
|
3567
3725
|
if (t !== void 0 && t !== "unlimited" && (!Number.isInteger(t) || t < 0)) throw TypeError("Vibe autofill maxAdditionalPages must be a non-negative integer or \"unlimited\".");
|
|
3568
3726
|
return;
|
|
@@ -3574,7 +3732,7 @@ function kr(e) {
|
|
|
3574
3732
|
if (t.pageSize !== e.pageSize) throw TypeError("Vibe backend autofill initialSession pageSize must match autofill pageSize.");
|
|
3575
3733
|
}
|
|
3576
3734
|
}
|
|
3577
|
-
function
|
|
3735
|
+
function Lr(e, t, n = !0) {
|
|
3578
3736
|
if (!e) return {
|
|
3579
3737
|
cycleId: null,
|
|
3580
3738
|
delayRemainingMs: null,
|
|
@@ -3591,7 +3749,7 @@ function Ar(e, t, n = !0) {
|
|
|
3591
3749
|
status: "idle",
|
|
3592
3750
|
strategy: null
|
|
3593
3751
|
};
|
|
3594
|
-
let r = e.strategy === "backend" ? t ?? (n ? e.initialSession : void 0) : void 0, i = r?.received ?? 0, a =
|
|
3752
|
+
let r = e.strategy === "backend" ? t ?? (n ? e.initialSession : void 0) : void 0, i = r?.received ?? 0, a = Ar(r?.nextRequestAt);
|
|
3595
3753
|
return {
|
|
3596
3754
|
cycleId: r?.cycleId ?? null,
|
|
3597
3755
|
...a,
|
|
@@ -3608,7 +3766,7 @@ function Ar(e, t, n = !0) {
|
|
|
3608
3766
|
strategy: e.strategy
|
|
3609
3767
|
};
|
|
3610
3768
|
}
|
|
3611
|
-
function
|
|
3769
|
+
function Rr(e) {
|
|
3612
3770
|
return [
|
|
3613
3771
|
"cancelling",
|
|
3614
3772
|
"filling",
|
|
@@ -3616,9 +3774,9 @@ function jr(e) {
|
|
|
3616
3774
|
"waiting"
|
|
3617
3775
|
].includes(e.status);
|
|
3618
3776
|
}
|
|
3619
|
-
async function
|
|
3777
|
+
async function zr(e, t, n) {
|
|
3620
3778
|
let r = t.autofill;
|
|
3621
|
-
if (!
|
|
3779
|
+
if (!Rr(r) || !r.cycleId) return;
|
|
3622
3780
|
let i = {
|
|
3623
3781
|
cycleId: r.cycleId,
|
|
3624
3782
|
feedKey: r.feedKey ?? "",
|
|
@@ -3631,16 +3789,16 @@ async function Mr(e, t, n) {
|
|
|
3631
3789
|
throw r.error = e, r.status = "error", e;
|
|
3632
3790
|
}
|
|
3633
3791
|
}
|
|
3634
|
-
function
|
|
3792
|
+
function Br(e, t, n) {
|
|
3635
3793
|
return e?.strategy === "backend" && t.feedKey === e.feedKey && t.sessionId === n.sessionId;
|
|
3636
3794
|
}
|
|
3637
|
-
async function
|
|
3638
|
-
let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ??
|
|
3795
|
+
async function Vr({ 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 }) {
|
|
3796
|
+
let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ?? Nr(s), g = t, _ = t, v = t, y = 0, b = [], x;
|
|
3639
3797
|
for (; y < h;) {
|
|
3640
|
-
let e =
|
|
3798
|
+
let e = Pr(g);
|
|
3641
3799
|
if (m.has(e)) throw Error("Vibe autofill received a repeated cursor.");
|
|
3642
|
-
if (m.add(e), await
|
|
3643
|
-
delayMs:
|
|
3800
|
+
if (m.add(e), await jr({
|
|
3801
|
+
delayMs: kr(l + y, s),
|
|
3644
3802
|
onChange: a,
|
|
3645
3803
|
signal: d
|
|
3646
3804
|
}), y > 0 && u()) return {
|
|
@@ -3654,12 +3812,12 @@ async function Pr({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
3654
3812
|
status: "paused",
|
|
3655
3813
|
total: x
|
|
3656
3814
|
};
|
|
3657
|
-
let t =
|
|
3815
|
+
let t = mr(await n({
|
|
3658
3816
|
cursor: g,
|
|
3659
3817
|
signal: d
|
|
3660
3818
|
}));
|
|
3661
3819
|
y += 1, _ = g;
|
|
3662
|
-
let r =
|
|
3820
|
+
let r = hr(p, t.items).slice(p.length);
|
|
3663
3821
|
b.push({
|
|
3664
3822
|
contributionIds: r.map(({ postId: e }) => e),
|
|
3665
3823
|
cursor: g,
|
|
@@ -3711,12 +3869,12 @@ async function Pr({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
3711
3869
|
}
|
|
3712
3870
|
//#endregion
|
|
3713
3871
|
//#region src/core/autofillController.ts
|
|
3714
|
-
var
|
|
3872
|
+
var Hr = class {
|
|
3715
3873
|
collection = null;
|
|
3716
3874
|
cycle = 0;
|
|
3717
3875
|
delayCountdown;
|
|
3718
3876
|
constructor(e) {
|
|
3719
|
-
this.context = e, this.delayCountdown = new
|
|
3877
|
+
this.context = e, this.delayCountdown = new Mr((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
|
|
3720
3878
|
}
|
|
3721
3879
|
beginCycle() {
|
|
3722
3880
|
let { options: e, state: t } = this.context;
|
|
@@ -3724,14 +3882,14 @@ var Fr = class {
|
|
|
3724
3882
|
this.clear();
|
|
3725
3883
|
let n = `vibe-autofill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
3726
3884
|
return t.autofill = {
|
|
3727
|
-
...
|
|
3885
|
+
...Lr(e, void 0, !1),
|
|
3728
3886
|
cycleId: n,
|
|
3729
3887
|
status: "filling"
|
|
3730
3888
|
}, n;
|
|
3731
3889
|
}
|
|
3732
3890
|
async cancel() {
|
|
3733
3891
|
let { cancelRequest: e, options: t, state: n } = this.context;
|
|
3734
|
-
await
|
|
3892
|
+
await zr(t, n, e), this.commitCollection();
|
|
3735
3893
|
}
|
|
3736
3894
|
captureCollection(e, t) {
|
|
3737
3895
|
t && (this.collection = e);
|
|
@@ -3753,36 +3911,36 @@ var Fr = class {
|
|
|
3753
3911
|
let { onLastCursor: e, options: t, state: n } = this.context;
|
|
3754
3912
|
if (t?.strategy !== "frontend") return !1;
|
|
3755
3913
|
let r = this.collection;
|
|
3756
|
-
return this.collection = null, r ? (n.items =
|
|
3914
|
+
return this.collection = null, r ? (n.items = hr(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, {
|
|
3757
3915
|
missing: r.missing,
|
|
3758
3916
|
received: r.received,
|
|
3759
3917
|
requests: r.requests
|
|
3760
3918
|
}), !0) : !1;
|
|
3761
3919
|
}
|
|
3762
|
-
},
|
|
3763
|
-
function
|
|
3920
|
+
}, Ur = 100;
|
|
3921
|
+
function Wr(e, t) {
|
|
3764
3922
|
if (!Number.isFinite(t) || t <= 0) throw TypeError(`Vibe ${e} must be a positive number.`);
|
|
3765
3923
|
}
|
|
3766
|
-
function
|
|
3924
|
+
function Gr(e, t, n) {
|
|
3767
3925
|
return Math.min(n, Math.max(t, e));
|
|
3768
3926
|
}
|
|
3769
|
-
function
|
|
3927
|
+
function Kr(e) {
|
|
3770
3928
|
if (!e) return;
|
|
3771
3929
|
let t = e.minSpeedPxPerSecond ?? 20, n = e.maxSpeedPxPerSecond ?? 240;
|
|
3772
|
-
if (
|
|
3773
|
-
e.speedPxPerSecond !== void 0 &&
|
|
3930
|
+
if (Wr("autoScroll.minSpeedPxPerSecond", t), Wr("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
|
|
3931
|
+
e.speedPxPerSecond !== void 0 && Wr("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
|
|
3774
3932
|
}
|
|
3775
|
-
function
|
|
3933
|
+
function qr(e) {
|
|
3776
3934
|
let t = e?.minSpeedPxPerSecond ?? 20, n = e?.maxSpeedPxPerSecond ?? 240;
|
|
3777
3935
|
return {
|
|
3778
3936
|
enabled: e?.enabled ?? !1,
|
|
3779
3937
|
maxSpeedPxPerSecond: n,
|
|
3780
3938
|
minSpeedPxPerSecond: t,
|
|
3781
3939
|
paused: !1,
|
|
3782
|
-
speedPxPerSecond:
|
|
3940
|
+
speedPxPerSecond: Gr(e?.speedPxPerSecond ?? 80, t, n)
|
|
3783
3941
|
};
|
|
3784
3942
|
}
|
|
3785
|
-
var
|
|
3943
|
+
var Jr = class {
|
|
3786
3944
|
frame = null;
|
|
3787
3945
|
lastTimestamp = null;
|
|
3788
3946
|
mounted = !1;
|
|
@@ -3802,9 +3960,9 @@ var Vr = class {
|
|
|
3802
3960
|
this.options.state.enabled && (this.options.state.paused = e, this.lastTimestamp = null, e ? this.cancelFrame() : this.schedule());
|
|
3803
3961
|
}
|
|
3804
3962
|
setSpeed(e) {
|
|
3805
|
-
|
|
3963
|
+
Wr("auto-scroll speed", e);
|
|
3806
3964
|
let t = this.options.state;
|
|
3807
|
-
t.speedPxPerSecond =
|
|
3965
|
+
t.speedPxPerSecond = Gr(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
|
|
3808
3966
|
}
|
|
3809
3967
|
tick = (e) => {
|
|
3810
3968
|
this.frame = null;
|
|
@@ -3816,7 +3974,7 @@ var Vr = class {
|
|
|
3816
3974
|
return;
|
|
3817
3975
|
}
|
|
3818
3976
|
if (this.lastTimestamp !== null) {
|
|
3819
|
-
let r = Math.min(
|
|
3977
|
+
let r = Math.min(Ur, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
|
|
3820
3978
|
n.scrollTop = Math.min(i, n.scrollTop + t.speedPxPerSecond * r / 1e3);
|
|
3821
3979
|
}
|
|
3822
3980
|
this.lastTimestamp = e, this.schedule();
|
|
@@ -3830,13 +3988,13 @@ var Vr = class {
|
|
|
3830
3988
|
};
|
|
3831
3989
|
//#endregion
|
|
3832
3990
|
//#region src/core/backendAutofill.ts
|
|
3833
|
-
async function
|
|
3991
|
+
async function Yr(e, t, n, r) {
|
|
3834
3992
|
let i = await e.onUnderfilled(n);
|
|
3835
3993
|
if (!r()) return;
|
|
3836
3994
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend autofill requires a sessionId.");
|
|
3837
3995
|
let a = Math.max(n.received, i.received ?? n.received);
|
|
3838
3996
|
Object.assign(t.autofill, {
|
|
3839
|
-
...
|
|
3997
|
+
...Ar(i.nextRequestAt),
|
|
3840
3998
|
missing: Math.max(0, e.pageSize - a),
|
|
3841
3999
|
received: a,
|
|
3842
4000
|
sequence: i.sequence ?? 0,
|
|
@@ -3844,19 +4002,19 @@ async function Hr(e, t, n, r) {
|
|
|
3844
4002
|
status: "waiting"
|
|
3845
4003
|
});
|
|
3846
4004
|
}
|
|
3847
|
-
function
|
|
3848
|
-
["complete", "exhausted"].includes(t.status) && t.items && (e.items =
|
|
4005
|
+
function Xr(e, t) {
|
|
4006
|
+
["complete", "exhausted"].includes(t.status) && t.items && (e.items = hr(e.items, t.items)), t.next !== void 0 && (e.next = t.next), t.total !== void 0 && (e.total = t.total);
|
|
3849
4007
|
}
|
|
3850
|
-
function
|
|
4008
|
+
function Zr(e, t, n) {
|
|
3851
4009
|
let r = t.autofill;
|
|
3852
|
-
return !
|
|
4010
|
+
return !Br(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (Xr(t, n), Object.assign(r, Ar(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);
|
|
3853
4011
|
}
|
|
3854
|
-
function
|
|
3855
|
-
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill =
|
|
4012
|
+
function Qr(e, t, n) {
|
|
4013
|
+
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = Lr(e, n), Xr(t, n), !0);
|
|
3856
4014
|
}
|
|
3857
4015
|
//#endregion
|
|
3858
4016
|
//#region src/core/backlogRestore.ts
|
|
3859
|
-
async function
|
|
4017
|
+
async function $r(e, t, n) {
|
|
3860
4018
|
if (!e) return;
|
|
3861
4019
|
let r = new AbortController();
|
|
3862
4020
|
n(r);
|
|
@@ -3871,7 +4029,7 @@ async function Kr(e, t, n) {
|
|
|
3871
4029
|
}
|
|
3872
4030
|
//#endregion
|
|
3873
4031
|
//#region src/core/initialAutofill.ts
|
|
3874
|
-
async function
|
|
4032
|
+
async function ei({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, onPages: i, options: a, signal: o, state: s }) {
|
|
3875
4033
|
let c = a.autofill;
|
|
3876
4034
|
if (!c) return;
|
|
3877
4035
|
let l = s.items.length;
|
|
@@ -3884,7 +4042,7 @@ async function qr({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3884
4042
|
return;
|
|
3885
4043
|
}
|
|
3886
4044
|
if (c.strategy === "backend") {
|
|
3887
|
-
await
|
|
4045
|
+
await Yr(c, s, {
|
|
3888
4046
|
cycleId: e,
|
|
3889
4047
|
feedKey: c.feedKey,
|
|
3890
4048
|
items: [...s.items],
|
|
@@ -3901,11 +4059,11 @@ async function qr({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3901
4059
|
s.autofill.status = "exhausted";
|
|
3902
4060
|
return;
|
|
3903
4061
|
}
|
|
3904
|
-
let u = await
|
|
4062
|
+
let u = await Vr({
|
|
3905
4063
|
existingItems: s.items,
|
|
3906
4064
|
initialCursor: s.next,
|
|
3907
4065
|
loadPage: a.loadPage,
|
|
3908
|
-
maximumRequests:
|
|
4066
|
+
maximumRequests: Nr(c, !1),
|
|
3909
4067
|
onCollection: n,
|
|
3910
4068
|
onDelayChange: (e) => {
|
|
3911
4069
|
t() && Object.assign(s.autofill, e);
|
|
@@ -3919,7 +4077,7 @@ async function qr({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3919
4077
|
shouldPause: () => s.loadMoreLocked,
|
|
3920
4078
|
signal: o
|
|
3921
4079
|
});
|
|
3922
|
-
t() && (s.items =
|
|
4080
|
+
t() && (s.items = hr(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, {
|
|
3923
4081
|
missing: u.missing,
|
|
3924
4082
|
received: u.received,
|
|
3925
4083
|
requests: u.requests,
|
|
@@ -3928,13 +4086,13 @@ async function qr({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3928
4086
|
}
|
|
3929
4087
|
//#endregion
|
|
3930
4088
|
//#region src/core/fill.ts
|
|
3931
|
-
function
|
|
4089
|
+
function ti(e) {
|
|
3932
4090
|
return "items" in e ? { items: e.items } : "pages" in e ? { pages: e.pages } : { until: "end" };
|
|
3933
4091
|
}
|
|
3934
|
-
function
|
|
4092
|
+
function ni(e) {
|
|
3935
4093
|
return `${typeof e}:${String(e)}`;
|
|
3936
4094
|
}
|
|
3937
|
-
function
|
|
4095
|
+
function ri(e) {
|
|
3938
4096
|
if (!e || typeof e != "object") throw TypeError("Vibe fill target must be an object.");
|
|
3939
4097
|
if ("pages" in e) {
|
|
3940
4098
|
if (!Number.isInteger(e.pages) || e.pages <= 0) throw TypeError("Vibe fill pages must be a positive integer.");
|
|
@@ -3947,21 +4105,21 @@ function Xr(e) {
|
|
|
3947
4105
|
if ("until" in e && e.until === "end") return { until: "end" };
|
|
3948
4106
|
throw TypeError("Vibe fill target must be { items }, { pages }, or { until: 'end' }.");
|
|
3949
4107
|
}
|
|
3950
|
-
function
|
|
4108
|
+
function ii(e) {
|
|
3951
4109
|
if (!e) return;
|
|
3952
4110
|
if (e.strategy === "frontend") {
|
|
3953
|
-
|
|
4111
|
+
Or(e, "frontend fill");
|
|
3954
4112
|
return;
|
|
3955
4113
|
}
|
|
3956
4114
|
if (!e.feedKey.trim()) throw TypeError("Vibe backend fill requires a feedKey.");
|
|
3957
4115
|
let t = e.initialSession;
|
|
3958
4116
|
if (t) {
|
|
3959
4117
|
if (t.feedKey !== e.feedKey) throw TypeError("Vibe backend fill initialSession feedKey must match fill feedKey.");
|
|
3960
|
-
|
|
4118
|
+
ri(t.target);
|
|
3961
4119
|
}
|
|
3962
4120
|
}
|
|
3963
|
-
function
|
|
3964
|
-
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a =
|
|
4121
|
+
function ai(e, t, n = !0) {
|
|
4122
|
+
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a = Ar(i?.nextRequestAt);
|
|
3965
4123
|
return {
|
|
3966
4124
|
completedPages: i?.completedPages ?? 0,
|
|
3967
4125
|
cycleId: i?.cycleId ?? null,
|
|
@@ -3974,10 +4132,10 @@ function Qr(e, t, n = !0) {
|
|
|
3974
4132
|
sessionId: i?.sessionId ?? null,
|
|
3975
4133
|
status: i?.status ?? "idle",
|
|
3976
4134
|
strategy: e?.strategy ?? null,
|
|
3977
|
-
target: i ?
|
|
4135
|
+
target: i ? ti(i.target) : null
|
|
3978
4136
|
};
|
|
3979
4137
|
}
|
|
3980
|
-
function
|
|
4138
|
+
function oi(e) {
|
|
3981
4139
|
return [
|
|
3982
4140
|
"cancelling",
|
|
3983
4141
|
"filling",
|
|
@@ -3985,7 +4143,7 @@ function $r(e) {
|
|
|
3985
4143
|
"waiting"
|
|
3986
4144
|
].includes(e.status);
|
|
3987
4145
|
}
|
|
3988
|
-
async function
|
|
4146
|
+
async function si({ existingItems: e, getLoadedItemCount: t, initialCursor: n, loadPage: r, onCollection: i, onPage: a, onDelayChange: o, onProgress: s, options: c, shouldPause: l = () => !1, signal: u, target: d }) {
|
|
3989
4147
|
let f = [], p = [], m = e.length, h = new Set(e.map(({ postId: e }) => e)), g = /* @__PURE__ */ new Set(), _ = 0, v = n, y = n, b = n, x = 0, S, C = () => t?.() ?? m + f.length;
|
|
3990
4148
|
if ("items" in d && C() >= d.items) return {
|
|
3991
4149
|
completedPages: _,
|
|
@@ -3997,10 +4155,10 @@ async function ei({ existingItems: e, getLoadedItemCount: t, initialCursor: n, l
|
|
|
3997
4155
|
status: "complete"
|
|
3998
4156
|
};
|
|
3999
4157
|
for (; b !== null;) {
|
|
4000
|
-
let e =
|
|
4158
|
+
let e = ni(v);
|
|
4001
4159
|
if (g.has(e)) throw Error("Vibe fill received a repeated cursor.");
|
|
4002
|
-
if (g.add(e), await
|
|
4003
|
-
delayMs:
|
|
4160
|
+
if (g.add(e), await jr({
|
|
4161
|
+
delayMs: kr(_, c),
|
|
4004
4162
|
onChange: o,
|
|
4005
4163
|
signal: u
|
|
4006
4164
|
}), _ > 0 && l()) return {
|
|
@@ -4013,12 +4171,12 @@ async function ei({ existingItems: e, getLoadedItemCount: t, initialCursor: n, l
|
|
|
4013
4171
|
status: "paused",
|
|
4014
4172
|
total: S
|
|
4015
4173
|
};
|
|
4016
|
-
let t =
|
|
4174
|
+
let t = mr(await r({
|
|
4017
4175
|
cursor: v,
|
|
4018
4176
|
signal: u
|
|
4019
4177
|
}));
|
|
4020
4178
|
_ += 1, y = v;
|
|
4021
|
-
let n =
|
|
4179
|
+
let n = gr(h, t.items), m = {
|
|
4022
4180
|
contributionIds: n.map(({ postId: e }) => e),
|
|
4023
4181
|
cursor: v,
|
|
4024
4182
|
next: t.next,
|
|
@@ -4089,12 +4247,12 @@ async function ei({ existingItems: e, getLoadedItemCount: t, initialCursor: n, l
|
|
|
4089
4247
|
}
|
|
4090
4248
|
//#endregion
|
|
4091
4249
|
//#region src/core/backendFill.ts
|
|
4092
|
-
async function
|
|
4250
|
+
async function ci(e, t, n, r) {
|
|
4093
4251
|
let i = await e.onStart(n);
|
|
4094
4252
|
if (r()) {
|
|
4095
4253
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend fill requires a sessionId.");
|
|
4096
4254
|
Object.assign(t.fill, {
|
|
4097
|
-
...
|
|
4255
|
+
...Ar(i.nextRequestAt),
|
|
4098
4256
|
completedPages: i.completedPages ?? 0,
|
|
4099
4257
|
received: i.received ?? 0,
|
|
4100
4258
|
sequence: i.sequence ?? 0,
|
|
@@ -4103,23 +4261,23 @@ async function ti(e, t, n, r) {
|
|
|
4103
4261
|
});
|
|
4104
4262
|
}
|
|
4105
4263
|
}
|
|
4106
|
-
function
|
|
4264
|
+
function li(e, t, n) {
|
|
4107
4265
|
return e?.strategy === "backend" && n.feedKey === e.feedKey && n.sessionId === t.fill.sessionId;
|
|
4108
4266
|
}
|
|
4109
|
-
function
|
|
4267
|
+
function ui(e) {
|
|
4110
4268
|
return Number.isInteger(e.completedPages) && e.completedPages >= 0 && Number.isInteger(e.received) && e.received >= 0 && Number.isInteger(e.sequence) && e.sequence >= 0;
|
|
4111
4269
|
}
|
|
4112
|
-
function
|
|
4270
|
+
function di(e, t) {
|
|
4113
4271
|
if (!["complete", "exhausted"].includes(t.status)) return !0;
|
|
4114
4272
|
let n = e.fill.target;
|
|
4115
4273
|
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;
|
|
4116
4274
|
}
|
|
4117
|
-
function
|
|
4118
|
-
t.total !== void 0 && (e.total = t.total), ["complete", "exhausted"].includes(t.status) && (e.items =
|
|
4275
|
+
function fi(e, t, n) {
|
|
4276
|
+
t.total !== void 0 && (e.total = t.total), ["complete", "exhausted"].includes(t.status) && (e.items = hr(e.items, t.items ?? []), e.next = t.next ?? null, n(t.lastCursor ?? null));
|
|
4119
4277
|
}
|
|
4120
|
-
function
|
|
4121
|
-
return !
|
|
4122
|
-
...
|
|
4278
|
+
function pi(e, t, n, r) {
|
|
4279
|
+
return !li(e, t, n) || !ui(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !di(t, n) ? !1 : (fi(t, n, r), Object.assign(t.fill, {
|
|
4280
|
+
...Ar(n.status === "waiting" ? n.nextRequestAt : null),
|
|
4123
4281
|
completedPages: n.completedPages,
|
|
4124
4282
|
error: n.error ?? null,
|
|
4125
4283
|
received: n.received,
|
|
@@ -4127,45 +4285,45 @@ function oi(e, t, n, r) {
|
|
|
4127
4285
|
status: n.status
|
|
4128
4286
|
}), !0);
|
|
4129
4287
|
}
|
|
4130
|
-
function
|
|
4288
|
+
function mi(e, t, n, r) {
|
|
4131
4289
|
if (e?.strategy !== "backend" || n.feedKey !== e.feedKey) return !1;
|
|
4132
4290
|
let i = t.fill;
|
|
4133
|
-
return t.fill =
|
|
4291
|
+
return t.fill = ai(e, n), !ui(n) || !di(t, n) ? (t.fill = i, !1) : (fi(t, n, r), !0);
|
|
4134
4292
|
}
|
|
4135
4293
|
//#endregion
|
|
4136
4294
|
//#region src/core/fillController.ts
|
|
4137
|
-
var
|
|
4295
|
+
var hi = class {
|
|
4138
4296
|
abortController = null;
|
|
4139
4297
|
cycle = 0;
|
|
4140
4298
|
delayCountdown;
|
|
4141
4299
|
requestVersion = 0;
|
|
4142
4300
|
collection = null;
|
|
4143
4301
|
constructor(e) {
|
|
4144
|
-
this.options = e, this.delayCountdown = new
|
|
4302
|
+
this.options = e, this.delayCountdown = new Mr((e) => {
|
|
4145
4303
|
Object.assign(this.options.state.fill, e);
|
|
4146
4304
|
}), this.syncBackendCountdown();
|
|
4147
4305
|
}
|
|
4148
4306
|
isActive() {
|
|
4149
|
-
return
|
|
4307
|
+
return oi(this.options.state.fill);
|
|
4150
4308
|
}
|
|
4151
4309
|
applyUpdate(e) {
|
|
4152
|
-
let t =
|
|
4310
|
+
let t = pi(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
4153
4311
|
return t && this.syncBackendCountdown(), t;
|
|
4154
4312
|
}
|
|
4155
4313
|
restoreSession(e) {
|
|
4156
|
-
let t =
|
|
4314
|
+
let t = mi(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
4157
4315
|
return t && this.syncBackendCountdown(), t;
|
|
4158
4316
|
}
|
|
4159
4317
|
async start(e, t = {}) {
|
|
4160
4318
|
let n = this.options.fill;
|
|
4161
4319
|
if (!n) throw Error("Vibe fill is not configured.");
|
|
4162
4320
|
if (this.isActive()) throw Error("Vibe fill is already active.");
|
|
4163
|
-
let r =
|
|
4321
|
+
let r = ri(e), i = ri(t.target ?? r), a = t.progressOffset ?? {
|
|
4164
4322
|
completedPages: 0,
|
|
4165
4323
|
received: 0
|
|
4166
4324
|
}, o = t.cycleId ?? `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
4167
4325
|
if (this.options.state.fill = {
|
|
4168
|
-
...
|
|
4326
|
+
...ai(n, void 0, !1),
|
|
4169
4327
|
completedPages: a.completedPages,
|
|
4170
4328
|
cycleId: o,
|
|
4171
4329
|
received: a.received,
|
|
@@ -4178,7 +4336,7 @@ var ci = class {
|
|
|
4178
4336
|
let s = ++this.requestVersion, c = new AbortController();
|
|
4179
4337
|
this.abortController = c;
|
|
4180
4338
|
try {
|
|
4181
|
-
n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await
|
|
4339
|
+
n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await ci(n, this.options.state, {
|
|
4182
4340
|
cycleId: o,
|
|
4183
4341
|
feedKey: n.feedKey,
|
|
4184
4342
|
items: [...this.options.state.items],
|
|
@@ -4196,7 +4354,7 @@ var ci = class {
|
|
|
4196
4354
|
}
|
|
4197
4355
|
async cancel() {
|
|
4198
4356
|
let { fill: e, state: t } = this.options;
|
|
4199
|
-
if (
|
|
4357
|
+
if (!oi(t.fill) || !t.fill.cycleId) return;
|
|
4200
4358
|
let n = {
|
|
4201
4359
|
cycleId: t.fill.cycleId,
|
|
4202
4360
|
feedKey: t.fill.feedKey ?? "",
|
|
@@ -4240,7 +4398,7 @@ var ci = class {
|
|
|
4240
4398
|
});
|
|
4241
4399
|
}
|
|
4242
4400
|
reset() {
|
|
4243
|
-
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill =
|
|
4401
|
+
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = ai(this.options.fill, void 0, !1), this.collection = null;
|
|
4244
4402
|
}
|
|
4245
4403
|
destroy() {
|
|
4246
4404
|
this.abortLocalRequest(), this.delayCountdown.clear();
|
|
@@ -4275,7 +4433,7 @@ var ci = class {
|
|
|
4275
4433
|
s.fill.status = "until" in t ? "complete" : "exhausted";
|
|
4276
4434
|
return;
|
|
4277
4435
|
}
|
|
4278
|
-
let c = await
|
|
4436
|
+
let c = await si({
|
|
4279
4437
|
existingItems: s.items,
|
|
4280
4438
|
getLoadedItemCount: () => s.items.length,
|
|
4281
4439
|
initialCursor: s.next,
|
|
@@ -4312,7 +4470,7 @@ var ci = class {
|
|
|
4312
4470
|
let e = this.collection;
|
|
4313
4471
|
if (this.collection = null, !e || this.options.fill?.strategy !== "frontend") return;
|
|
4314
4472
|
let t = this.options.state;
|
|
4315
|
-
t.items =
|
|
4473
|
+
t.items = _r(t.items, this.filterItems(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, {
|
|
4316
4474
|
completedPages: e.completedPages,
|
|
4317
4475
|
received: e.received
|
|
4318
4476
|
});
|
|
@@ -4327,7 +4485,7 @@ var ci = class {
|
|
|
4327
4485
|
};
|
|
4328
4486
|
//#endregion
|
|
4329
4487
|
//#region src/core/fillReconciliation.ts
|
|
4330
|
-
async function
|
|
4488
|
+
async function gi({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r, pauseWhenManual: i = !1, setLastCursor: a, signal: o, state: s }) {
|
|
4331
4489
|
if (!e.needsReconciliation(s.items)) return "skipped";
|
|
4332
4490
|
let c = await e.reconcile({
|
|
4333
4491
|
existingItems: s.items,
|
|
@@ -4336,11 +4494,11 @@ async function li({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r,
|
|
|
4336
4494
|
shouldPause: () => s.loadMoreLocked || i && !s.infiniteScroll,
|
|
4337
4495
|
signal: o
|
|
4338
4496
|
});
|
|
4339
|
-
return t() ? (s.items =
|
|
4497
|
+
return t() ? (s.items = hr(s.items, c.items), s.next = c.next, a(c.lastCursor), c.total !== void 0 && (s.total = c.total), e.completeReconciliation(c), c.status) : c.status;
|
|
4340
4498
|
}
|
|
4341
4499
|
//#endregion
|
|
4342
4500
|
//#region src/core/feedFooter.ts
|
|
4343
|
-
function
|
|
4501
|
+
function _i(e) {
|
|
4344
4502
|
return {
|
|
4345
4503
|
cancelAutofill: () => e.cancelAutofill(),
|
|
4346
4504
|
loadMore: () => e.loadNext(),
|
|
@@ -4352,64 +4510,64 @@ function ui(e) {
|
|
|
4352
4510
|
retryFill: () => e.retryFill()
|
|
4353
4511
|
};
|
|
4354
4512
|
}
|
|
4355
|
-
function
|
|
4513
|
+
function vi(e) {
|
|
4356
4514
|
if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
|
|
4357
4515
|
}
|
|
4358
|
-
function
|
|
4359
|
-
e?.intervalMs !== void 0 &&
|
|
4516
|
+
function yi(e) {
|
|
4517
|
+
e?.intervalMs !== void 0 && vi(e.intervalMs);
|
|
4360
4518
|
}
|
|
4361
|
-
function
|
|
4519
|
+
function bi(e) {
|
|
4362
4520
|
return {
|
|
4363
4521
|
enabled: e?.enabled ?? !1,
|
|
4364
4522
|
includePostItems: e?.includePostItems ?? !1,
|
|
4365
4523
|
intervalMs: e?.intervalMs ?? 5e3
|
|
4366
4524
|
};
|
|
4367
4525
|
}
|
|
4368
|
-
function
|
|
4526
|
+
function xi(e, t) {
|
|
4369
4527
|
if (typeof t == "boolean") {
|
|
4370
4528
|
e.enabled = t;
|
|
4371
4529
|
return;
|
|
4372
4530
|
}
|
|
4373
|
-
|
|
4531
|
+
yi(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);
|
|
4374
4532
|
}
|
|
4375
4533
|
//#endregion
|
|
4376
4534
|
//#region src/core/reelInfoSheet.ts
|
|
4377
|
-
function
|
|
4535
|
+
function Si(e) {
|
|
4378
4536
|
return { enabled: e?.enabled ?? !1 };
|
|
4379
4537
|
}
|
|
4380
|
-
function
|
|
4538
|
+
function Ci(e, t, n) {
|
|
4381
4539
|
if (n && !t) throw Error("Vibe cannot enable reelInfoSheet without a configured component.");
|
|
4382
4540
|
e.enabled = n;
|
|
4383
4541
|
}
|
|
4384
4542
|
//#endregion
|
|
4385
4543
|
//#region src/core/initialRuntimeState.ts
|
|
4386
|
-
function
|
|
4544
|
+
function wi(e, t) {
|
|
4387
4545
|
let n = e.initialPage;
|
|
4388
4546
|
return {
|
|
4389
4547
|
activeReelPostId: null,
|
|
4390
|
-
autoScroll:
|
|
4391
|
-
autofill:
|
|
4548
|
+
autoScroll: qr(e.autoScroll),
|
|
4549
|
+
autofill: Lr(e.autofill),
|
|
4392
4550
|
current: n?.current ?? null,
|
|
4393
4551
|
error: null,
|
|
4394
|
-
fill:
|
|
4552
|
+
fill: ai(e.fill),
|
|
4395
4553
|
infiniteScroll: e.infiniteScroll ?? !0,
|
|
4396
4554
|
isLoading: !n,
|
|
4397
4555
|
isLoadingMore: !1,
|
|
4398
|
-
items: n ?
|
|
4556
|
+
items: n ? hr([], n.items) : [],
|
|
4399
4557
|
layout: t === "reel" ? "reel" : "masonry",
|
|
4400
4558
|
loadMoreLocked: !1,
|
|
4401
4559
|
mediaIndices: /* @__PURE__ */ new Map(),
|
|
4402
4560
|
next: n?.next ?? null,
|
|
4403
4561
|
nextPageError: null,
|
|
4404
4562
|
phoneMode: !1,
|
|
4405
|
-
reelAutoAdvance:
|
|
4563
|
+
reelAutoAdvance: bi(e.reelAutoAdvance),
|
|
4406
4564
|
reelForward: {
|
|
4407
4565
|
error: null,
|
|
4408
4566
|
status: "idle"
|
|
4409
4567
|
},
|
|
4410
4568
|
reelForwardIndex: null,
|
|
4411
4569
|
reelForwardItem: null,
|
|
4412
|
-
reelInfoSheet:
|
|
4570
|
+
reelInfoSheet: Si(e.reelInfoSheet),
|
|
4413
4571
|
reelInfoSheetOverlay: !1,
|
|
4414
4572
|
reelMediaSource: "original",
|
|
4415
4573
|
reelOrigin: null,
|
|
@@ -4418,21 +4576,21 @@ function _i(e, t) {
|
|
|
4418
4576
|
}
|
|
4419
4577
|
//#endregion
|
|
4420
4578
|
//#region src/core/options.ts
|
|
4421
|
-
function
|
|
4579
|
+
function Ti(e, t) {
|
|
4422
4580
|
if (t) {
|
|
4423
4581
|
if (!Number.isFinite(t.height) || t.height <= 0) throw TypeError(`Vibe ${e} height must be a positive number.`);
|
|
4424
4582
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe ${e} background must be "default" or "transparent".`);
|
|
4425
4583
|
}
|
|
4426
4584
|
}
|
|
4427
|
-
function
|
|
4585
|
+
function Ei(e, t) {
|
|
4428
4586
|
if (t) {
|
|
4429
4587
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe mediaCard ${e} background must be "default" or "transparent".`);
|
|
4430
4588
|
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.`);
|
|
4431
4589
|
}
|
|
4432
4590
|
}
|
|
4433
|
-
function
|
|
4434
|
-
if (
|
|
4435
|
-
if (
|
|
4591
|
+
function Di(e) {
|
|
4592
|
+
if (Kr(e.autoScroll), Ti("cardHeader", e.cardHeader), Ti("cardFooter", e.cardFooter), Ei("header", e.mediaCard?.header), Ei("footer", e.mediaCard?.footer), e.mediaCard?.feedPreload !== void 0 && e.mediaCard.feedPreload !== "none" && e.mediaCard.feedPreload !== "visible-post") throw TypeError("Vibe mediaCard feedPreload must be \"none\" or \"visible-post\".");
|
|
4593
|
+
if (Ir(e.autofill), ii(e.fill), Be(e.masonry), yi(e.reelAutoAdvance), e.removalReconciliation) {
|
|
4436
4594
|
if (!Number.isInteger(e.removalReconciliation.pageSize) || e.removalReconciliation.pageSize <= 0) throw TypeError("Vibe removalReconciliation pageSize must be a positive integer.");
|
|
4437
4595
|
let t = e.removalReconciliation.maxReplayPages ?? 5;
|
|
4438
4596
|
if (!Number.isInteger(t) || t <= 0) throw TypeError("Vibe removalReconciliation maxReplayPages must be a positive integer.");
|
|
@@ -4447,7 +4605,7 @@ function bi(e) {
|
|
|
4447
4605
|
if (e.fill?.strategy === "frontend" && !e.loadPage) throw TypeError("Vibe frontend fill requires loadPage.");
|
|
4448
4606
|
if (e.fill?.strategy === "backend" && e.fill.initialSession && !e.initialPage) throw TypeError("Vibe backend fill restoration requires initialPage.");
|
|
4449
4607
|
}
|
|
4450
|
-
function
|
|
4608
|
+
function Oi(e) {
|
|
4451
4609
|
if (typeof e != "string") return e;
|
|
4452
4610
|
if (typeof document > "u") throw Error("Vibe cannot resolve a selector without a document.");
|
|
4453
4611
|
let t = document.querySelector(e);
|
|
@@ -4456,7 +4614,7 @@ function xi(e) {
|
|
|
4456
4614
|
}
|
|
4457
4615
|
//#endregion
|
|
4458
4616
|
//#region src/core/pageRequest.ts
|
|
4459
|
-
async function
|
|
4617
|
+
async function ki({ append: e, autofillController: t, cursor: n, isCurrent: r, loadPage: i, onLastCursor: a, onPages: o, options: s, signal: c, state: l }) {
|
|
4460
4618
|
let u = s.autofill, d = e && u?.strategy === "frontend" && (l.autofill.status === "paused" || l.autofill.status === "error"), f = d ? {
|
|
4461
4619
|
received: l.autofill.received,
|
|
4462
4620
|
requests: l.autofill.requests
|
|
@@ -4468,11 +4626,11 @@ async function Si({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
4468
4626
|
let m = !1;
|
|
4469
4627
|
try {
|
|
4470
4628
|
if (u?.strategy === "frontend") {
|
|
4471
|
-
let s = await
|
|
4629
|
+
let s = await Vr({
|
|
4472
4630
|
existingItems: e ? l.items : [],
|
|
4473
4631
|
initialCursor: n,
|
|
4474
4632
|
loadPage: i,
|
|
4475
|
-
maximumRequests: f ? Math.max(0,
|
|
4633
|
+
maximumRequests: f ? Math.max(0, Nr(u) - f.requests) : void 0,
|
|
4476
4634
|
onCollection: (e) => t.captureCollection(e, r()),
|
|
4477
4635
|
onDelayChange: (e) => {
|
|
4478
4636
|
r() && Object.assign(l.autofill, e);
|
|
@@ -4487,7 +4645,7 @@ async function Si({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
4487
4645
|
signal: c
|
|
4488
4646
|
});
|
|
4489
4647
|
if (!r()) return;
|
|
4490
|
-
l.items = e ?
|
|
4648
|
+
l.items = e ? hr(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, {
|
|
4491
4649
|
missing: s.missing,
|
|
4492
4650
|
received: s.received,
|
|
4493
4651
|
requests: s.requests,
|
|
@@ -4495,12 +4653,12 @@ async function Si({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
4495
4653
|
}), o(s.pages), t.clearCollection();
|
|
4496
4654
|
return;
|
|
4497
4655
|
}
|
|
4498
|
-
let s =
|
|
4656
|
+
let s = mr(await i({
|
|
4499
4657
|
cursor: n,
|
|
4500
4658
|
signal: c
|
|
4501
4659
|
}));
|
|
4502
4660
|
if (!r()) return;
|
|
4503
|
-
let d = e ? l.items : [], h =
|
|
4661
|
+
let d = e ? l.items : [], h = hr(d, s.items), g = h.length - d.length;
|
|
4504
4662
|
if (l.items = h, a(n), o([{
|
|
4505
4663
|
contributionIds: h.slice(d.length).map(({ postId: e }) => e),
|
|
4506
4664
|
cursor: n,
|
|
@@ -4515,7 +4673,7 @@ async function Si({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
4515
4673
|
l.autofill.status = "complete";
|
|
4516
4674
|
return;
|
|
4517
4675
|
}
|
|
4518
|
-
await
|
|
4676
|
+
await Yr(u, l, {
|
|
4519
4677
|
cycleId: p,
|
|
4520
4678
|
feedKey: u.feedKey,
|
|
4521
4679
|
items: h.slice(d.length),
|
|
@@ -4537,7 +4695,7 @@ async function Si({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
4537
4695
|
}
|
|
4538
4696
|
//#endregion
|
|
4539
4697
|
//#region src/core/pageReplacement.ts
|
|
4540
|
-
var
|
|
4698
|
+
var Ai = class {
|
|
4541
4699
|
controller = null;
|
|
4542
4700
|
constructor(e) {
|
|
4543
4701
|
this.options = e;
|
|
@@ -4549,7 +4707,7 @@ var Ci = class {
|
|
|
4549
4707
|
this.controller?.abort(), this.controller = null, this.options.surface()?.cancelItemRemoval();
|
|
4550
4708
|
}
|
|
4551
4709
|
async replace(e, t) {
|
|
4552
|
-
let n =
|
|
4710
|
+
let n = mr(e);
|
|
4553
4711
|
this.cancel();
|
|
4554
4712
|
let r = new AbortController();
|
|
4555
4713
|
this.controller = r;
|
|
@@ -4569,7 +4727,7 @@ var Ci = class {
|
|
|
4569
4727
|
let e = this.options.surface()?.getAutoScrollElement();
|
|
4570
4728
|
e && (e.scrollTop = 0);
|
|
4571
4729
|
}
|
|
4572
|
-
e.mediaIndices = new Map(a.map((t) => [t.postId,
|
|
4730
|
+
e.mediaIndices = new Map(a.map((t) => [t.postId, K(t, e.mediaIndices.get(t.postId) ?? 0)])), e.activeReelPostId !== null && !o.has(String(e.activeReelPostId)) && (e.activeReelPostId = null, e.reelOrigin = null), e.items = a, e.next = n.next, e.total = n.total ?? null, e.error = null, e.nextPageError = null, this.options.commit({
|
|
4573
4731
|
...n,
|
|
4574
4732
|
items: a
|
|
4575
4733
|
});
|
|
@@ -4580,7 +4738,7 @@ var Ci = class {
|
|
|
4580
4738
|
};
|
|
4581
4739
|
//#endregion
|
|
4582
4740
|
//#region src/core/loadingLock.ts
|
|
4583
|
-
function
|
|
4741
|
+
function ji(e, t, n) {
|
|
4584
4742
|
if (e.loadMoreLocked !== t && (e.loadMoreLocked = t, !t)) {
|
|
4585
4743
|
if (e.fill.status === "paused" && e.fill.target) {
|
|
4586
4744
|
n.resumeFill();
|
|
@@ -4596,16 +4754,16 @@ function wi(e, t, n) {
|
|
|
4596
4754
|
}
|
|
4597
4755
|
//#endregion
|
|
4598
4756
|
//#region src/core/removalReconciliationController.ts
|
|
4599
|
-
function
|
|
4757
|
+
function Mi(e) {
|
|
4600
4758
|
return `${typeof e}:${String(e)}`;
|
|
4601
4759
|
}
|
|
4602
|
-
function
|
|
4760
|
+
function Ni(e) {
|
|
4603
4761
|
return `${typeof e}:${String(e)}`;
|
|
4604
4762
|
}
|
|
4605
|
-
function
|
|
4763
|
+
function Pi(e) {
|
|
4606
4764
|
return e.map(({ postId: e }) => e);
|
|
4607
4765
|
}
|
|
4608
|
-
var
|
|
4766
|
+
var Fi = class {
|
|
4609
4767
|
delay;
|
|
4610
4768
|
enabled;
|
|
4611
4769
|
maxReplayPages;
|
|
@@ -4624,7 +4782,7 @@ var Oi = class {
|
|
|
4624
4782
|
e.status === "complete" && (this.pages = [...this.pages.slice(0, e.replaceFrom), ...e.pages].slice(-this.maxReplayPages), this.pending = null);
|
|
4625
4783
|
}
|
|
4626
4784
|
filterItems(e) {
|
|
4627
|
-
return this.tombstones.size === 0 ? [...e] : e.filter(({ postId: e }) => !this.tombstones.has(
|
|
4785
|
+
return this.tombstones.size === 0 ? [...e] : e.filter(({ postId: e }) => !this.tombstones.has(Mi(e)));
|
|
4628
4786
|
}
|
|
4629
4787
|
needsReconciliation(e) {
|
|
4630
4788
|
return this.pending !== null || this.findUnderfilledPage(e) >= 0;
|
|
@@ -4637,45 +4795,45 @@ var Oi = class {
|
|
|
4637
4795
|
}
|
|
4638
4796
|
recordInitialPage(e) {
|
|
4639
4797
|
e && this.recordPages([{
|
|
4640
|
-
contributionIds:
|
|
4641
|
-
cursor:
|
|
4798
|
+
contributionIds: Pi(e.items),
|
|
4799
|
+
cursor: xr(e),
|
|
4642
4800
|
next: e.next,
|
|
4643
|
-
returnedIds:
|
|
4801
|
+
returnedIds: Pi(e.items)
|
|
4644
4802
|
}]);
|
|
4645
4803
|
}
|
|
4646
4804
|
remove(e) {
|
|
4647
|
-
e.forEach((e) => this.tombstones.add(
|
|
4805
|
+
e.forEach((e) => this.tombstones.add(Mi(e)));
|
|
4648
4806
|
}
|
|
4649
4807
|
reset() {
|
|
4650
4808
|
this.pages = [], this.pending = null, this.tombstones.clear();
|
|
4651
4809
|
}
|
|
4652
4810
|
restore(e) {
|
|
4653
|
-
e.forEach((e) => this.tombstones.delete(
|
|
4811
|
+
e.forEach((e) => this.tombstones.delete(Mi(e)));
|
|
4654
4812
|
}
|
|
4655
4813
|
async reconcile({ existingItems: e, loadPage: t, onDelayChange: n = () => void 0, shouldPause: r = () => !1, signal: i }) {
|
|
4656
4814
|
let a = this.pending ?? this.createSession(e);
|
|
4657
4815
|
for (this.pending = a; a.remainingRequests > 0;) {
|
|
4658
|
-
let e =
|
|
4816
|
+
let e = Ni(a.cursor);
|
|
4659
4817
|
if (a.seenCursors.has(e)) throw Error("Vibe removal reconciliation received a repeated cursor.");
|
|
4660
|
-
if (await
|
|
4661
|
-
delayMs:
|
|
4818
|
+
if (await jr({
|
|
4819
|
+
delayMs: kr(a.pages.length, this.delay),
|
|
4662
4820
|
onChange: n,
|
|
4663
4821
|
signal: i
|
|
4664
4822
|
}), a.pages.length > 0 && r()) return this.result(a, "paused");
|
|
4665
|
-
let o =
|
|
4823
|
+
let o = mr(await t({
|
|
4666
4824
|
cursor: a.cursor,
|
|
4667
4825
|
signal: i
|
|
4668
4826
|
}));
|
|
4669
4827
|
a.seenCursors.add(e);
|
|
4670
4828
|
let s = this.filterItems(o.items), c = [];
|
|
4671
4829
|
if (s.forEach((e) => {
|
|
4672
|
-
let t =
|
|
4830
|
+
let t = Mi(e.postId);
|
|
4673
4831
|
a.attributed.has(t) || (a.attributed.add(t), c.push(e.postId)), a.appended.has(t) || (a.appended.add(t), a.items.push(e));
|
|
4674
4832
|
}), a.pages.push({
|
|
4675
4833
|
contributionIds: c,
|
|
4676
4834
|
cursor: a.cursor,
|
|
4677
4835
|
next: o.next,
|
|
4678
|
-
returnedIds:
|
|
4836
|
+
returnedIds: Pi(s)
|
|
4679
4837
|
}), 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");
|
|
4680
4838
|
}
|
|
4681
4839
|
return this.result(a, "complete");
|
|
@@ -4683,9 +4841,9 @@ var Oi = class {
|
|
|
4683
4841
|
createSession(e) {
|
|
4684
4842
|
let t = this.findUnderfilledPage(e), n = t < 0 ? [] : this.pages.slice(t), r = n[0];
|
|
4685
4843
|
if (!r) throw Error("Vibe has no underfilled provider page to reconcile.");
|
|
4686
|
-
let i = new Set(n.flatMap(({ contributionIds: e }) => e.map(
|
|
4844
|
+
let i = new Set(n.flatMap(({ contributionIds: e }) => e.map(Mi))), a = new Set(e.map(({ postId: e }) => Mi(e)).filter((e) => !i.has(e)));
|
|
4687
4845
|
return {
|
|
4688
|
-
appended: new Set(e.map(({ postId: e }) =>
|
|
4846
|
+
appended: new Set(e.map(({ postId: e }) => Mi(e))),
|
|
4689
4847
|
attributed: new Set(a),
|
|
4690
4848
|
cursor: r.cursor,
|
|
4691
4849
|
items: [],
|
|
@@ -4710,11 +4868,11 @@ var Oi = class {
|
|
|
4710
4868
|
}
|
|
4711
4869
|
findUnderfilledPage(e) {
|
|
4712
4870
|
if (!this.enabled || this.pages.length === 0) return -1;
|
|
4713
|
-
let t = new Set(e.map(({ postId: e }) =>
|
|
4714
|
-
return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has(
|
|
4871
|
+
let t = new Set(e.map(({ postId: e }) => Mi(e)));
|
|
4872
|
+
return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has(Mi(e))).length < this.pageSize);
|
|
4715
4873
|
}
|
|
4716
4874
|
recordPage(e) {
|
|
4717
|
-
let t =
|
|
4875
|
+
let t = Ni(e.cursor), n = this.pages.findIndex(({ cursor: e }) => Ni(e) === t);
|
|
4718
4876
|
n >= 0 && (this.pages = this.pages.slice(0, n)), this.pages.push({
|
|
4719
4877
|
...e,
|
|
4720
4878
|
contributionIds: [...e.contributionIds],
|
|
@@ -4724,7 +4882,7 @@ var Oi = class {
|
|
|
4724
4882
|
};
|
|
4725
4883
|
//#endregion
|
|
4726
4884
|
//#region src/core/activeItemRemoval.ts
|
|
4727
|
-
function
|
|
4885
|
+
function Ii(e, t, n, r, i) {
|
|
4728
4886
|
let a = new Set(t.map(({ item: e }) => e.postId));
|
|
4729
4887
|
if (e.activeReelPostId === null || !a.has(e.activeReelPostId)) return;
|
|
4730
4888
|
let o = e.items[Math.max(n, 0)];
|
|
@@ -4737,7 +4895,7 @@ function ki(e, t, n, r, i) {
|
|
|
4737
4895
|
}
|
|
4738
4896
|
//#endregion
|
|
4739
4897
|
//#region src/core/exactMediaRemovalController.ts
|
|
4740
|
-
function
|
|
4898
|
+
function Li(e, t) {
|
|
4741
4899
|
let [n, ...r] = t;
|
|
4742
4900
|
if (!n) throw Error("Vibe items must contain at least one media asset.");
|
|
4743
4901
|
return {
|
|
@@ -4746,10 +4904,10 @@ function Ai(e, t) {
|
|
|
4746
4904
|
items: r
|
|
4747
4905
|
};
|
|
4748
4906
|
}
|
|
4749
|
-
function
|
|
4907
|
+
function Ri(e) {
|
|
4750
4908
|
if (!Number.isInteger(e.mediaIndex) || e.mediaIndex < 0) throw TypeError("Vibe mediaIndex must be a non-negative integer.");
|
|
4751
4909
|
}
|
|
4752
|
-
var
|
|
4910
|
+
var zi = class {
|
|
4753
4911
|
generation = 0;
|
|
4754
4912
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
4755
4913
|
state;
|
|
@@ -4757,10 +4915,10 @@ var Mi = class {
|
|
|
4757
4915
|
this.options = e, this.state = e.state;
|
|
4758
4916
|
}
|
|
4759
4917
|
remove(e) {
|
|
4760
|
-
|
|
4918
|
+
Ri(e);
|
|
4761
4919
|
let t = this.state.items.findIndex(({ postId: t }) => t === e.postId), n = this.state.items[t];
|
|
4762
4920
|
if (!n) return null;
|
|
4763
|
-
let r = [...
|
|
4921
|
+
let r = [...G(n)], i = r[e.mediaIndex];
|
|
4764
4922
|
if (!i) return null;
|
|
4765
4923
|
let a = Object.freeze({
|
|
4766
4924
|
media: i,
|
|
@@ -4774,7 +4932,7 @@ var Mi = class {
|
|
|
4774
4932
|
restored: !1
|
|
4775
4933
|
});
|
|
4776
4934
|
let o = this.state.mediaIndices.get(n.postId) ?? 0, s = this.isReelOpen() && this.state.activeReelPostId === n.postId, c = s && o === e.mediaIndex;
|
|
4777
|
-
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] =
|
|
4935
|
+
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = Li(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);
|
|
4778
4936
|
}
|
|
4779
4937
|
reset() {
|
|
4780
4938
|
this.generation += 1;
|
|
@@ -4799,32 +4957,32 @@ var Mi = class {
|
|
|
4799
4957
|
return this.state.layout === "reel" || this.state.reelOrigin === "masonry";
|
|
4800
4958
|
}
|
|
4801
4959
|
restoreIntoPost(e, t) {
|
|
4802
|
-
let n = this.state.items[e], r = [...
|
|
4803
|
-
if (r.splice(i, 0, t.media), this.state.items[e] =
|
|
4960
|
+
let n = this.state.items[e], r = [...G(n)], i = Math.min(t.mediaIndex, r.length);
|
|
4961
|
+
if (r.splice(i, 0, t.media), this.state.items[e] = Li(n, r), this.state.activeReelPostId !== t.postId) return;
|
|
4804
4962
|
let a = this.state.mediaIndices.get(t.postId) ?? 0;
|
|
4805
4963
|
a >= i && this.state.mediaIndices.set(t.postId, a + 1);
|
|
4806
4964
|
}
|
|
4807
4965
|
updateMediaIndexAfterRemoval(e, t, n) {
|
|
4808
4966
|
let r = this.state.items.find((t) => t.postId === e);
|
|
4809
4967
|
if (!r) return;
|
|
4810
|
-
let i =
|
|
4968
|
+
let i = G(r).length, a = this.state.mediaIndices.get(e) ?? 0, o = a;
|
|
4811
4969
|
n ? o = t < i ? t : 0 : t < a && (o = a - 1), this.state.mediaIndices.set(e, Math.min(o, i - 1));
|
|
4812
4970
|
}
|
|
4813
4971
|
};
|
|
4814
4972
|
//#endregion
|
|
4815
4973
|
//#region src/core/itemPlacement.ts
|
|
4816
|
-
function
|
|
4974
|
+
function Bi(e, t) {
|
|
4817
4975
|
let n = new Set(t);
|
|
4818
4976
|
return e.flatMap((e, t) => n.has(e.postId) ? [{
|
|
4819
4977
|
index: t,
|
|
4820
4978
|
item: e
|
|
4821
4979
|
}] : []);
|
|
4822
4980
|
}
|
|
4823
|
-
function
|
|
4981
|
+
function Vi(e, t) {
|
|
4824
4982
|
let n = new Set(t.map(({ item: e }) => e.postId));
|
|
4825
4983
|
return e.filter((e) => !n.has(e.postId));
|
|
4826
4984
|
}
|
|
4827
|
-
function
|
|
4985
|
+
function Hi(e, t) {
|
|
4828
4986
|
t.forEach(({ index: e }) => {
|
|
4829
4987
|
if (!Number.isInteger(e) || e < 0) throw Error("Vibe item restore indexes must be non-negative integers.");
|
|
4830
4988
|
});
|
|
@@ -4835,7 +4993,7 @@ function Fi(e, t) {
|
|
|
4835
4993
|
}
|
|
4836
4994
|
//#endregion
|
|
4837
4995
|
//#region src/core/itemRemovalController.ts
|
|
4838
|
-
var
|
|
4996
|
+
var Ui = 20, Wi = class {
|
|
4839
4997
|
generation = 0;
|
|
4840
4998
|
historyLimit;
|
|
4841
4999
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
@@ -4844,7 +5002,7 @@ var Ii = 20, Li = class {
|
|
|
4844
5002
|
itemOrder;
|
|
4845
5003
|
stopItemsWatcher;
|
|
4846
5004
|
constructor(e) {
|
|
4847
|
-
this.options = e, this.historyLimit = e.historyLimit ??
|
|
5005
|
+
this.options = e, this.historyLimit = e.historyLimit ?? Ui, this.state = e.state, this.itemOrder = Y(this.state.items), this.stopItemsWatcher = N(() => this.state.items, (e) => this.appendUnknownItems(e), { flush: "sync" });
|
|
4848
5006
|
}
|
|
4849
5007
|
destroy() {
|
|
4850
5008
|
this.reset(), this.stopItemsWatcher();
|
|
@@ -4858,7 +5016,7 @@ var Ii = 20, Li = class {
|
|
|
4858
5016
|
let a = this.options.startRemoval(i, t);
|
|
4859
5017
|
if (a > 0 && await new Promise((e) => setTimeout(e, a)), this.metadata.get(r)?.generation !== this.generation) return r;
|
|
4860
5018
|
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);
|
|
4861
|
-
return this.state.items =
|
|
5019
|
+
return this.state.items = Vi(this.state.items, n), this.options.onItemsRemoved(r, n, l), this.record(r), r;
|
|
4862
5020
|
}
|
|
4863
5021
|
reset() {
|
|
4864
5022
|
this.generation += 1, this.history = [], this.itemOrder = [];
|
|
@@ -4869,7 +5027,7 @@ var Ii = 20, Li = class {
|
|
|
4869
5027
|
this.restoreRemoval(t);
|
|
4870
5028
|
return;
|
|
4871
5029
|
}
|
|
4872
|
-
let n = new Set(
|
|
5030
|
+
let n = new Set(Y(this.state.items)), r = e.filter(({ item: e }) => n.has(e.postId) ? !1 : (n.add(e.postId), !0)), i = Hi(this.state.items, r);
|
|
4873
5031
|
this.registerExternalPlacements(r), this.state.items = i, r.length > 0 && this.options.onRemovalRestored(r);
|
|
4874
5032
|
}
|
|
4875
5033
|
restoreRemoval(e) {
|
|
@@ -4889,13 +5047,13 @@ var Ii = 20, Li = class {
|
|
|
4889
5047
|
}
|
|
4890
5048
|
appendUnknownItems(e) {
|
|
4891
5049
|
let t = new Set(this.itemOrder);
|
|
4892
|
-
|
|
5050
|
+
Y(e).forEach((e) => {
|
|
4893
5051
|
t.has(e) || (this.itemOrder.push(e), t.add(e));
|
|
4894
5052
|
});
|
|
4895
5053
|
}
|
|
4896
5054
|
collectOrderedPlacements(e) {
|
|
4897
5055
|
let t = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
4898
|
-
return
|
|
5056
|
+
return Bi(this.state.items, e).map((e) => ({
|
|
4899
5057
|
index: t.get(e.item.postId) ?? e.index,
|
|
4900
5058
|
item: e.item
|
|
4901
5059
|
}));
|
|
@@ -4921,12 +5079,12 @@ var Ii = 20, Li = class {
|
|
|
4921
5079
|
t >= 0 && this.history.splice(t, 1);
|
|
4922
5080
|
}
|
|
4923
5081
|
restoreOrderedPlacements(e) {
|
|
4924
|
-
let t = new Set(
|
|
5082
|
+
let t = new Set(Y(this.state.items)), n = e.map(({ item: e }) => e).filter(({ postId: e }) => !t.has(e));
|
|
4925
5083
|
if (n.length === 0) return !1;
|
|
4926
5084
|
let r = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
4927
5085
|
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;
|
|
4928
5086
|
}
|
|
4929
|
-
},
|
|
5087
|
+
}, Gi = class {
|
|
4930
5088
|
forward = null;
|
|
4931
5089
|
forwardPromise = null;
|
|
4932
5090
|
forwardVersion = 0;
|
|
@@ -5022,7 +5180,7 @@ var Ii = 20, Li = class {
|
|
|
5022
5180
|
}
|
|
5023
5181
|
}
|
|
5024
5182
|
}
|
|
5025
|
-
},
|
|
5183
|
+
}, Ki = class {
|
|
5026
5184
|
generation = 0;
|
|
5027
5185
|
pending = Promise.resolve();
|
|
5028
5186
|
constructor(e) {
|
|
@@ -5039,7 +5197,7 @@ var Ii = 20, Li = class {
|
|
|
5039
5197
|
if (!n) return;
|
|
5040
5198
|
let r = t.mediaIndices.get(e.postId) ?? 0;
|
|
5041
5199
|
if (e.mediaIndex === r) {
|
|
5042
|
-
if (
|
|
5200
|
+
if (G(n).length > 1) {
|
|
5043
5201
|
await this.options.transitionMedia(1);
|
|
5044
5202
|
return;
|
|
5045
5203
|
}
|
|
@@ -5072,24 +5230,24 @@ var Ii = 20, Li = class {
|
|
|
5072
5230
|
};
|
|
5073
5231
|
//#endregion
|
|
5074
5232
|
//#region src/core/removalControllers.ts
|
|
5075
|
-
function
|
|
5076
|
-
let t = new
|
|
5233
|
+
function qi(e) {
|
|
5234
|
+
let t = new Gi(e), n = new Ki({
|
|
5077
5235
|
state: e.state,
|
|
5078
5236
|
transitionMedia: (t) => e.surface()?.transitionActiveReelMedia(t) ?? Promise.resolve(!1),
|
|
5079
5237
|
transitionPost: (t) => e.surface()?.transitionActiveReelPost(t) ?? Promise.resolve(!1)
|
|
5080
5238
|
});
|
|
5081
5239
|
return {
|
|
5082
|
-
exactMediaRemoval: new
|
|
5240
|
+
exactMediaRemoval: new zi({
|
|
5083
5241
|
onActivate: e.onActivate,
|
|
5084
5242
|
onPostRemoved: (t) => e.onItemsRemoved([t]),
|
|
5085
5243
|
onPostRestored: (t) => e.onItemsRestored([t]),
|
|
5086
5244
|
reelForward: t,
|
|
5087
5245
|
state: e.state
|
|
5088
5246
|
}),
|
|
5089
|
-
itemRemoval: new
|
|
5247
|
+
itemRemoval: new Wi({
|
|
5090
5248
|
historyLimit: e.historyLimit,
|
|
5091
5249
|
onItemsRemoved: (n, r, i) => {
|
|
5092
|
-
e.onItemsRemoved(r.map(({ item: e }) => e.postId)),
|
|
5250
|
+
e.onItemsRemoved(r.map(({ item: e }) => e.postId)), Ii(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
|
|
5093
5251
|
},
|
|
5094
5252
|
onRemovalRestored: (n) => {
|
|
5095
5253
|
e.onItemsRestored(n.map(({ item: e }) => e.postId));
|
|
@@ -5104,17 +5262,17 @@ function Bi(e) {
|
|
|
5104
5262
|
reelRemoval: n
|
|
5105
5263
|
};
|
|
5106
5264
|
}
|
|
5107
|
-
var
|
|
5108
|
-
function
|
|
5265
|
+
var Ji = 1.5;
|
|
5266
|
+
function Yi(e) {
|
|
5109
5267
|
let t = Math.min(e.screenWidth, e.screenHeight);
|
|
5110
5268
|
if (t > 0 && t < 600) return !0;
|
|
5111
|
-
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n *
|
|
5269
|
+
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * Ji;
|
|
5112
5270
|
return !e.hasHover && n > 0 && n < 600 && r;
|
|
5113
5271
|
}
|
|
5114
|
-
function
|
|
5115
|
-
return
|
|
5272
|
+
function Xi(e) {
|
|
5273
|
+
return Yi(e) ? "reel" : "masonry";
|
|
5116
5274
|
}
|
|
5117
|
-
function
|
|
5275
|
+
function Zi(e) {
|
|
5118
5276
|
let t = e.ownerDocument.defaultView, n = e.ownerDocument.documentElement;
|
|
5119
5277
|
return {
|
|
5120
5278
|
hasHover: typeof t?.matchMedia == "function" && t.matchMedia("(hover: hover)").matches,
|
|
@@ -5124,15 +5282,15 @@ function Wi(e) {
|
|
|
5124
5282
|
viewportWidth: n.clientWidth
|
|
5125
5283
|
};
|
|
5126
5284
|
}
|
|
5127
|
-
function
|
|
5128
|
-
return
|
|
5285
|
+
function Qi(e) {
|
|
5286
|
+
return Yi(Zi(e));
|
|
5129
5287
|
}
|
|
5130
|
-
function
|
|
5131
|
-
return
|
|
5288
|
+
function $i(e) {
|
|
5289
|
+
return Xi(Zi(e));
|
|
5132
5290
|
}
|
|
5133
5291
|
//#endregion
|
|
5134
5292
|
//#region src/core/responsiveLayoutController.ts
|
|
5135
|
-
var
|
|
5293
|
+
var ea = class {
|
|
5136
5294
|
layoutMode;
|
|
5137
5295
|
resizeObserver = null;
|
|
5138
5296
|
target = null;
|
|
@@ -5157,13 +5315,13 @@ var qi = class {
|
|
|
5157
5315
|
}
|
|
5158
5316
|
handleResponsiveLayout = () => {
|
|
5159
5317
|
if (!this.target) return;
|
|
5160
|
-
let e =
|
|
5161
|
-
this.state.phoneMode =
|
|
5318
|
+
let e = $i(this.target);
|
|
5319
|
+
this.state.phoneMode = Qi(this.target), this.state.reelInfoSheetOverlay = this.state.phoneMode, this.state.reelMediaSource = this.state.phoneMode ? "mobile" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
|
|
5162
5320
|
};
|
|
5163
|
-
},
|
|
5321
|
+
}, ta = class {
|
|
5164
5322
|
state;
|
|
5165
5323
|
constructor(e) {
|
|
5166
|
-
this.options = e, this.state = T(
|
|
5324
|
+
this.options = e, this.state = T(en({
|
|
5167
5325
|
...e.initialReelAudioState,
|
|
5168
5326
|
muted: e.initialReelAudioState?.muted ?? e.mediaCard?.videoMuted ?? !1
|
|
5169
5327
|
}));
|
|
@@ -5172,9 +5330,9 @@ var qi = class {
|
|
|
5172
5330
|
return { ...this.state };
|
|
5173
5331
|
}
|
|
5174
5332
|
set(e, t = !1) {
|
|
5175
|
-
Object.assign(this.state,
|
|
5333
|
+
Object.assign(this.state, en(e, this.state)), t && this.options.onReelAudioStateChange?.(this.get());
|
|
5176
5334
|
}
|
|
5177
|
-
},
|
|
5335
|
+
}, na = class {
|
|
5178
5336
|
routedReelPostId = null;
|
|
5179
5337
|
reelRouteIsActive = !1;
|
|
5180
5338
|
constructor(e, t) {
|
|
@@ -5204,30 +5362,30 @@ var qi = class {
|
|
|
5204
5362
|
};
|
|
5205
5363
|
//#endregion
|
|
5206
5364
|
//#region src/core/updateItems.ts
|
|
5207
|
-
function
|
|
5365
|
+
function ra(e) {
|
|
5208
5366
|
return String(e);
|
|
5209
5367
|
}
|
|
5210
|
-
function
|
|
5211
|
-
let n =
|
|
5368
|
+
function ia(e, t) {
|
|
5369
|
+
let n = G(t).length;
|
|
5212
5370
|
(e.mediaIndices.get(t.postId) ?? 0) >= n && e.mediaIndices.set(t.postId, Math.max(0, n - 1));
|
|
5213
5371
|
}
|
|
5214
|
-
function
|
|
5372
|
+
function aa(e, t) {
|
|
5215
5373
|
let n = /* @__PURE__ */ new Map();
|
|
5216
|
-
if (t.forEach((e) => n.set(
|
|
5374
|
+
if (t.forEach((e) => n.set(ra(e.postId), e)), n.size === 0) return [];
|
|
5217
5375
|
let r = [], i = e.items.map((t) => {
|
|
5218
|
-
let i = n.get(
|
|
5376
|
+
let i = n.get(ra(t.postId));
|
|
5219
5377
|
if (!i) return t;
|
|
5220
5378
|
let a = {
|
|
5221
5379
|
...i,
|
|
5222
5380
|
postId: t.postId
|
|
5223
5381
|
};
|
|
5224
|
-
return
|
|
5382
|
+
return ia(e, a), e.reelForwardItem && ra(e.reelForwardItem.postId) === ra(t.postId) && (e.reelForwardItem = a), r.push(t.postId), a;
|
|
5225
5383
|
});
|
|
5226
5384
|
return r.length > 0 && (e.items = i), r;
|
|
5227
5385
|
}
|
|
5228
5386
|
//#endregion
|
|
5229
5387
|
//#region src/core/createVibe.ts
|
|
5230
|
-
var
|
|
5388
|
+
var oa = class {
|
|
5231
5389
|
app = null;
|
|
5232
5390
|
autoScroll;
|
|
5233
5391
|
autofillController;
|
|
@@ -5251,25 +5409,25 @@ var $i = class {
|
|
|
5251
5409
|
state;
|
|
5252
5410
|
pageReplacement;
|
|
5253
5411
|
constructor(e) {
|
|
5254
|
-
this.options = e,
|
|
5412
|
+
this.options = e, Di(e);
|
|
5255
5413
|
let t = e.layout ?? "masonry";
|
|
5256
|
-
this.state = T(
|
|
5414
|
+
this.state = T(wi(e, t)), this.reelAudio = new ta(e), this.lastLoadedCursor = e.initialPage ? xr(e.initialPage) : null, this.notificationItems = oe(this.state), this.autoScroll = new Jr({
|
|
5257
5415
|
getScrollElement: () => this.surface?.getAutoScrollElement() ?? null,
|
|
5258
5416
|
state: this.state.autoScroll
|
|
5259
|
-
}), this.autofillController = new
|
|
5417
|
+
}), this.autofillController = new Hr({
|
|
5260
5418
|
cancelRequest: () => this.cancelRequest(!this.pageReplacement?.isActive()),
|
|
5261
5419
|
onLastCursor: (e) => this.setCurrentCursor(e),
|
|
5262
5420
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
5263
5421
|
options: e.autofill,
|
|
5264
5422
|
state: this.state
|
|
5265
|
-
}), this.removalReconciliation = new
|
|
5423
|
+
}), this.removalReconciliation = new Fi(e), this.removalReconciliation.recordInitialPage(e.initialPage), this.fillController = new hi({
|
|
5266
5424
|
filterItems: (e) => this.removalReconciliation.filterItems(e),
|
|
5267
5425
|
fill: e.fill,
|
|
5268
5426
|
loadPage: e.loadPage ? (e) => this.loadFilteredPage(e) : void 0,
|
|
5269
5427
|
needsFrontendPreparation: () => this.removalReconciliation.needsReconciliation(this.state.items),
|
|
5270
5428
|
onLastCursor: (e) => this.setCurrentCursor(e),
|
|
5271
5429
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
5272
|
-
prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) =>
|
|
5430
|
+
prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) => gi({
|
|
5273
5431
|
controller: this.removalReconciliation,
|
|
5274
5432
|
isCurrent: t,
|
|
5275
5433
|
loadPage: e.loadPage,
|
|
@@ -5279,8 +5437,8 @@ var $i = class {
|
|
|
5279
5437
|
state: this.state
|
|
5280
5438
|
}),
|
|
5281
5439
|
state: this.state
|
|
5282
|
-
}), this.routing = new
|
|
5283
|
-
let n =
|
|
5440
|
+
}), this.routing = new na(e.routing, this.state);
|
|
5441
|
+
let n = qi({
|
|
5284
5442
|
historyLimit: e.removalHistoryLimit,
|
|
5285
5443
|
onActivate: (e) => this.setActiveReelPost(e),
|
|
5286
5444
|
onCloseReel: () => this.closeMasonryReel(),
|
|
@@ -5290,29 +5448,29 @@ var $i = class {
|
|
|
5290
5448
|
state: this.state,
|
|
5291
5449
|
surface: () => this.surface
|
|
5292
5450
|
});
|
|
5293
|
-
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.pageReplacement = new
|
|
5451
|
+
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.pageReplacement = new Ai({
|
|
5294
5452
|
state: this.state,
|
|
5295
5453
|
surface: () => this.surface,
|
|
5296
5454
|
prepare: async () => {
|
|
5297
|
-
this.cancelRequest(!1),
|
|
5455
|
+
this.cancelRequest(!1), Rr(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill();
|
|
5298
5456
|
},
|
|
5299
5457
|
commit: (e) => {
|
|
5300
|
-
this.resetFeedVisit(), this.setCurrentCursor(
|
|
5458
|
+
this.resetFeedVisit(), this.setCurrentCursor(xr(e)), this.removalReconciliation.recordInitialPage(e), this.state.reelOrigin === null && this.routing.syncFeed();
|
|
5301
5459
|
}
|
|
5302
|
-
}), this.responsiveLayout = new
|
|
5460
|
+
}), this.responsiveLayout = new ea(t, this.state, () => {
|
|
5303
5461
|
this.routing.syncFeed();
|
|
5304
5462
|
}), this.startStateNotifications();
|
|
5305
5463
|
}
|
|
5306
5464
|
async mount() {
|
|
5307
5465
|
if (this.app) throw Error("Vibe is already mounted.");
|
|
5308
5466
|
this.startStateNotifications();
|
|
5309
|
-
let e =
|
|
5310
|
-
this.responsiveLayout.mount(e), this.app = i(
|
|
5467
|
+
let e = Oi(this.options.target);
|
|
5468
|
+
this.responsiveLayout.mount(e), this.app = i(pr, {
|
|
5311
5469
|
canRetryEnd: !!this.options.loadPage,
|
|
5312
5470
|
cardFooter: this.options.cardFooter,
|
|
5313
5471
|
cardHeader: this.options.cardHeader,
|
|
5314
5472
|
feedFooter: this.options.feedFooter,
|
|
5315
|
-
feedFooterActions:
|
|
5473
|
+
feedFooterActions: _i(this),
|
|
5316
5474
|
mediaCard: this.options.mediaCard,
|
|
5317
5475
|
masonry: this.options.masonry,
|
|
5318
5476
|
onMediaFullyVisible: this.options.onMediaFullyVisible,
|
|
@@ -5339,7 +5497,7 @@ var $i = class {
|
|
|
5339
5497
|
onRetryForward: () => {
|
|
5340
5498
|
this.retryReelForward();
|
|
5341
5499
|
}
|
|
5342
|
-
}), this.surface = this.app.mount(e), this.autoScroll.mount(), await
|
|
5500
|
+
}), this.surface = this.app.mount(e), this.autoScroll.mount(), await $r(this.options.restoreBacklog, (e) => this.appendPage(e), (e) => {
|
|
5343
5501
|
this.restoreController = e;
|
|
5344
5502
|
}), !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();
|
|
5345
5503
|
}
|
|
@@ -5347,7 +5505,7 @@ var $i = class {
|
|
|
5347
5505
|
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;
|
|
5348
5506
|
}
|
|
5349
5507
|
getState() {
|
|
5350
|
-
return
|
|
5508
|
+
return X(this.state, this.notificationItems.value);
|
|
5351
5509
|
}
|
|
5352
5510
|
getReelAudioState() {
|
|
5353
5511
|
return this.reelAudio.get();
|
|
@@ -5374,7 +5532,7 @@ var $i = class {
|
|
|
5374
5532
|
return this.itemRemoval.restoreRemoval(e);
|
|
5375
5533
|
}
|
|
5376
5534
|
updateItems(e) {
|
|
5377
|
-
return
|
|
5535
|
+
return aa(this.state, e);
|
|
5378
5536
|
}
|
|
5379
5537
|
retryReelForward() {
|
|
5380
5538
|
return this.reelForward.retry();
|
|
@@ -5413,7 +5571,7 @@ var $i = class {
|
|
|
5413
5571
|
this.autoScroll.setSpeed(e);
|
|
5414
5572
|
}
|
|
5415
5573
|
applyAutofillUpdate(e) {
|
|
5416
|
-
let t =
|
|
5574
|
+
let t = Zr(this.options.autofill, this.state, e);
|
|
5417
5575
|
return t && this.autofillController.syncCountdown(), t;
|
|
5418
5576
|
}
|
|
5419
5577
|
cancelAutofill() {
|
|
@@ -5424,7 +5582,7 @@ var $i = class {
|
|
|
5424
5582
|
await this.cancelFill();
|
|
5425
5583
|
return;
|
|
5426
5584
|
}
|
|
5427
|
-
if (
|
|
5585
|
+
if (Rr(this.state.autofill)) {
|
|
5428
5586
|
await this.cancelAutofill();
|
|
5429
5587
|
return;
|
|
5430
5588
|
}
|
|
@@ -5437,12 +5595,12 @@ var $i = class {
|
|
|
5437
5595
|
}
|
|
5438
5596
|
async fill(e) {
|
|
5439
5597
|
if (!(this.state.loadMoreLocked || this.pageReplacement.isActive())) {
|
|
5440
|
-
if (this.pendingRequest ||
|
|
5598
|
+
if (this.pendingRequest || Rr(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
|
|
5441
5599
|
await this.fillController.start(e);
|
|
5442
5600
|
}
|
|
5443
5601
|
}
|
|
5444
5602
|
restoreAutofillSession(e) {
|
|
5445
|
-
let t =
|
|
5603
|
+
let t = Qr(this.options.autofill, this.state, e);
|
|
5446
5604
|
return t && this.autofillController.syncCountdown(), t;
|
|
5447
5605
|
}
|
|
5448
5606
|
restoreFillSession(e) {
|
|
@@ -5452,7 +5610,7 @@ var $i = class {
|
|
|
5452
5610
|
return this.startLoadMore(() => this.loadNextSequence());
|
|
5453
5611
|
}
|
|
5454
5612
|
appendPage(e) {
|
|
5455
|
-
|
|
5613
|
+
Sr(e, this.state, this.removalReconciliation, (e) => this.setCurrentCursor(e));
|
|
5456
5614
|
}
|
|
5457
5615
|
replenishAfterRemoval(e = !0) {
|
|
5458
5616
|
return this.startLoadMore(() => this.replenishAfterRemovalSequence(e));
|
|
@@ -5460,7 +5618,7 @@ var $i = class {
|
|
|
5460
5618
|
async startLoadMore(e) {
|
|
5461
5619
|
if (this.pageReplacement.isActive()) return;
|
|
5462
5620
|
if (this.pendingRequest) return this.pendingRequest;
|
|
5463
|
-
if (this.state.loadMoreLocked ||
|
|
5621
|
+
if (this.state.loadMoreLocked || Rr(this.state.autofill) || this.fillController.isActive() || !this.options.loadPage || this.state.next === null && !this.removalReconciliation.needsReconciliation(this.state.items)) return;
|
|
5464
5622
|
this.state.isLoadingMore = !0, this.state.nextPageError = null;
|
|
5465
5623
|
let t = e();
|
|
5466
5624
|
return this.pendingRequest = t, t.finally(() => {
|
|
@@ -5478,15 +5636,15 @@ var $i = class {
|
|
|
5478
5636
|
}
|
|
5479
5637
|
async replaceFeed(e, t) {
|
|
5480
5638
|
if (!this.options.loadPage) throw Error(`Vibe cannot ${t} without loadPage.`);
|
|
5481
|
-
return
|
|
5639
|
+
return Rr(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.resetFeedVisit(), this.surface?.resetMediaLifecycle(), 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);
|
|
5482
5640
|
}
|
|
5483
5641
|
resetFeedVisit() {
|
|
5484
|
-
this.state.autofill =
|
|
5642
|
+
this.state.autofill = Lr(this.options.autofill, void 0, !1), this.fillController.reset(), this.reelForward.reset(), this.reelRemoval.reset(), this.exactMediaRemoval.reset(), this.itemRemoval.reset(), this.removalReconciliation.reset();
|
|
5485
5643
|
}
|
|
5486
5644
|
async loadFilteredPage(e) {
|
|
5487
5645
|
let t = this.options.loadPage;
|
|
5488
5646
|
if (!t) throw Error("Vibe cannot load a page without loadPage.");
|
|
5489
|
-
let n =
|
|
5647
|
+
let n = mr(await t(e));
|
|
5490
5648
|
return {
|
|
5491
5649
|
...n,
|
|
5492
5650
|
items: this.removalReconciliation.filterItems(n.items)
|
|
@@ -5506,7 +5664,7 @@ var $i = class {
|
|
|
5506
5664
|
let n = ++this.requestVersion, r = new AbortController();
|
|
5507
5665
|
this.abortController = r;
|
|
5508
5666
|
try {
|
|
5509
|
-
let i = await
|
|
5667
|
+
let i = await gi({
|
|
5510
5668
|
controller: this.removalReconciliation,
|
|
5511
5669
|
isCurrent: () => n === this.requestVersion,
|
|
5512
5670
|
loadPage: t,
|
|
@@ -5526,14 +5684,14 @@ var $i = class {
|
|
|
5526
5684
|
async retryEnd() {
|
|
5527
5685
|
if (!this.pageReplacement.isActive()) {
|
|
5528
5686
|
if (this.pendingRequest) return this.pendingRequest;
|
|
5529
|
-
if (!this.state.loadMoreLocked && !(
|
|
5687
|
+
if (!this.state.loadMoreLocked && !(Rr(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);
|
|
5530
5688
|
}
|
|
5531
5689
|
}
|
|
5532
5690
|
setInfiniteScroll(e) {
|
|
5533
5691
|
this.state.infiniteScroll = e, e && v(() => this.surface?.loadIfNearBottom());
|
|
5534
5692
|
}
|
|
5535
5693
|
setLoadMoreLocked(e) {
|
|
5536
|
-
|
|
5694
|
+
ji(this.state, e, {
|
|
5537
5695
|
getPending: () => this.pendingRequest,
|
|
5538
5696
|
hasPendingSession: () => this.removalReconciliation.hasPendingSession(),
|
|
5539
5697
|
loadNext: () => this.loadNext(),
|
|
@@ -5546,10 +5704,10 @@ var $i = class {
|
|
|
5546
5704
|
this.state.total = e;
|
|
5547
5705
|
}
|
|
5548
5706
|
setReelAutoAdvance(e) {
|
|
5549
|
-
|
|
5707
|
+
xi(this.state.reelAutoAdvance, e);
|
|
5550
5708
|
}
|
|
5551
5709
|
setReelInfoSheet(e) {
|
|
5552
|
-
|
|
5710
|
+
Ci(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
|
|
5553
5711
|
}
|
|
5554
5712
|
setLayout(e) {
|
|
5555
5713
|
this.responsiveLayout.setLayout(e);
|
|
@@ -5569,7 +5727,7 @@ var $i = class {
|
|
|
5569
5727
|
async fetchPage(e, t) {
|
|
5570
5728
|
if (!this.options.loadPage) return;
|
|
5571
5729
|
let n = ++this.requestVersion, r = new AbortController();
|
|
5572
|
-
this.abortController = r, await
|
|
5730
|
+
this.abortController = r, await ki({
|
|
5573
5731
|
append: t,
|
|
5574
5732
|
autofillController: this.autofillController,
|
|
5575
5733
|
cursor: e,
|
|
@@ -5591,7 +5749,7 @@ var $i = class {
|
|
|
5591
5749
|
startInitialAutofill() {
|
|
5592
5750
|
let e = ++this.requestVersion, t = new AbortController(), n = this.autofillController.beginCycle();
|
|
5593
5751
|
this.abortController = t, this.state.isLoadingMore = !0;
|
|
5594
|
-
let r =
|
|
5752
|
+
let r = ei({
|
|
5595
5753
|
cycleId: n,
|
|
5596
5754
|
isCurrent: () => e === this.requestVersion,
|
|
5597
5755
|
onCollection: (t) => this.autofillController.captureCollection(t, e === this.requestVersion),
|
|
@@ -5609,11 +5767,11 @@ var $i = class {
|
|
|
5609
5767
|
}
|
|
5610
5768
|
startStateNotifications() {
|
|
5611
5769
|
let e = this.options.onStateChange;
|
|
5612
|
-
!e || this.stopStateWatcher || (this.stopStateWatcher =
|
|
5770
|
+
!e || this.stopStateWatcher || (this.stopStateWatcher = se(this.state, this.notificationItems, e));
|
|
5613
5771
|
}
|
|
5614
5772
|
setCurrentCursor(e) {
|
|
5615
5773
|
this.lastLoadedCursor = this.state.current = e;
|
|
5616
5774
|
}
|
|
5617
|
-
},
|
|
5775
|
+
}, sa = (e) => new oa(e);
|
|
5618
5776
|
//#endregion
|
|
5619
|
-
export {
|
|
5777
|
+
export { sa as createVibe };
|