@wyxos/vibe 5.16.6 → 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/core/mediaLifecycleIndex.d.ts +4 -0
- package/lib/index.cjs +2 -2
- package/lib/index.js +1050 -761
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
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
15
|
function V(e, t) {
|
|
16
|
-
return e ??
|
|
16
|
+
return e ?? B(t);
|
|
17
17
|
}
|
|
18
18
|
function H(e, t) {
|
|
19
19
|
return V(e, t) !== "image";
|
|
@@ -96,7 +96,7 @@ function oe(e) {
|
|
|
96
96
|
return t || (t = r(() => Object.freeze([...e.items])), ae.set(e, t)), t;
|
|
97
97
|
}
|
|
98
98
|
function se(e, t, n) {
|
|
99
|
-
return n(X(e, t.value)),
|
|
99
|
+
return n(X(e, t.value)), N(() => X(e, t.value), n, { flush: "post" });
|
|
100
100
|
}
|
|
101
101
|
function X(e, t = [...e.items]) {
|
|
102
102
|
return {
|
|
@@ -131,11 +131,11 @@ function X(e, t = [...e.items]) {
|
|
|
131
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 Z = {
|
|
|
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", Z, [e.isLoading ? (w(), s("p",
|
|
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,29 +639,94 @@ 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 = 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
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
654
|
+
function H() {
|
|
655
|
+
T !== null && (cancelAnimationFrame(T), T = null);
|
|
656
|
+
}
|
|
657
|
+
function U(e) {
|
|
658
|
+
E || (D = !0, M = /* @__PURE__ */ new WeakMap(), te(e));
|
|
659
|
+
}
|
|
660
|
+
function te(e) {
|
|
661
|
+
if (E) return;
|
|
662
|
+
if (o.value) {
|
|
663
|
+
b = !0;
|
|
664
|
+
return;
|
|
665
|
+
}
|
|
666
|
+
if (T !== null) return;
|
|
667
|
+
T = -1;
|
|
668
|
+
let t = requestAnimationFrame(() => {
|
|
669
|
+
T = null, (D || P.length || F) && Y(e);
|
|
574
670
|
});
|
|
671
|
+
T !== null && (T = t);
|
|
575
672
|
}
|
|
576
|
-
function
|
|
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);
|
|
686
|
+
}
|
|
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) {
|
|
714
|
+
let r = t.scrollElement, a = i.value;
|
|
715
|
+
return !r || !a ? n : ((e || !O) && (O = {
|
|
716
|
+
contentSize: r.scrollHeight,
|
|
717
|
+
trackSize: a.clientHeight,
|
|
718
|
+
viewportSize: r.clientHeight
|
|
719
|
+
}, D = !1, b = !1, H()), He({
|
|
720
|
+
...O,
|
|
721
|
+
minimumThumbSize: Je,
|
|
722
|
+
scrollPosition: r.scrollTop
|
|
723
|
+
}));
|
|
724
|
+
}
|
|
725
|
+
function Y(e) {
|
|
726
|
+
if (E) return;
|
|
727
|
+
let n = t.scrollElement;
|
|
728
|
+
if (g || (L = !0), n && q(n), e === "mutation" && !D) return;
|
|
729
|
+
for (let e of A.keys()) n?.contains(e) || A.delete(e);
|
|
577
730
|
if (o.value && e !== "scroll") {
|
|
578
731
|
b = !0;
|
|
579
732
|
return;
|
|
@@ -588,57 +741,105 @@ var Ve = ["aria-hidden"], He = [
|
|
|
588
741
|
};
|
|
589
742
|
return;
|
|
590
743
|
}
|
|
591
|
-
|
|
744
|
+
let r = e !== "scroll" || D || !(g && _ && C);
|
|
745
|
+
a.value = J(r || K()), r && K(), !(u.value || h !== null) && (h = requestAnimationFrame(() => {
|
|
592
746
|
h = null, u.value = !0;
|
|
593
747
|
}));
|
|
594
748
|
}
|
|
595
|
-
function
|
|
596
|
-
|
|
749
|
+
function ae() {
|
|
750
|
+
V(), Y("scroll");
|
|
597
751
|
}
|
|
598
|
-
function
|
|
752
|
+
function oe(e) {
|
|
599
753
|
let n = t.scrollElement;
|
|
600
|
-
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"));
|
|
601
755
|
}
|
|
602
|
-
function
|
|
603
|
-
if (
|
|
756
|
+
function se(e) {
|
|
757
|
+
if (e.target !== e.currentTarget || (Y("resize"), !R.value)) return;
|
|
604
758
|
let t = i.value;
|
|
605
759
|
if (!t || a.value.thumbTravel <= 0) return;
|
|
606
|
-
e.preventDefault(),
|
|
760
|
+
e.preventDefault(), V();
|
|
607
761
|
let n = e.clientY - t.getBoundingClientRect().top - a.value.thumbSize / 2;
|
|
608
|
-
|
|
762
|
+
oe(Math.min(1, Math.max(0, n / a.value.thumbTravel)) * a.value.maximumScrollPosition);
|
|
609
763
|
}
|
|
610
|
-
function
|
|
611
|
-
|
|
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);
|
|
612
766
|
}
|
|
613
|
-
function
|
|
767
|
+
function Z(e) {
|
|
614
768
|
if (!o.value || e.pointerId !== d || (e.preventDefault(), a.value.thumbTravel <= 0)) return;
|
|
615
769
|
let t = (e.clientY - f) / a.value.thumbTravel * a.value.maximumScrollPosition;
|
|
616
|
-
|
|
770
|
+
oe(p + t);
|
|
617
771
|
}
|
|
618
|
-
function
|
|
619
|
-
!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());
|
|
620
774
|
}
|
|
621
|
-
function
|
|
622
|
-
if (!
|
|
623
|
-
let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r -
|
|
624
|
-
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));
|
|
625
779
|
}
|
|
626
|
-
function
|
|
780
|
+
function Q(e) {
|
|
627
781
|
if (_?.disconnect(), !(typeof ResizeObserver > "u")) {
|
|
628
|
-
_ = new ResizeObserver(() =>
|
|
782
|
+
_ = new ResizeObserver(() => {
|
|
783
|
+
e === t.scrollElement && U("content");
|
|
784
|
+
});
|
|
629
785
|
for (let t of e.children) _.observe(t);
|
|
786
|
+
for (let t of j) e.contains(t) && _.observe(t, { box: "border-box" });
|
|
630
787
|
}
|
|
631
788
|
}
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
}
|
|
639
|
-
|
|
789
|
+
function ue() {
|
|
790
|
+
U("content");
|
|
791
|
+
}
|
|
792
|
+
function de(e) {
|
|
793
|
+
let t = e.type.startsWith("animation") ? e.animationName : e.propertyName;
|
|
794
|
+
return `${e.type.startsWith("animation") ? "a" : "t"}:${t}:${e.pseudoElement ?? ""}`;
|
|
795
|
+
}
|
|
796
|
+
function fe(e) {
|
|
797
|
+
if (e.type.startsWith("transition") && e.propertyName === "opacity") return;
|
|
798
|
+
let n = e.target;
|
|
799
|
+
if (!(n instanceof Element) || !t.scrollElement?.contains(n)) return;
|
|
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");
|
|
802
|
+
}
|
|
803
|
+
function $(e) {
|
|
804
|
+
if (e.type.startsWith("transition") && e.propertyName === "opacity") return;
|
|
805
|
+
let t = e.target;
|
|
806
|
+
if (!(t instanceof Element)) return;
|
|
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");
|
|
809
|
+
}
|
|
810
|
+
function pe(e, t) {
|
|
811
|
+
let n = [
|
|
812
|
+
["load", ue],
|
|
813
|
+
["loadedmetadata", ue],
|
|
814
|
+
["transitionrun", fe],
|
|
815
|
+
["animationstart", fe],
|
|
816
|
+
["transitionend", $],
|
|
817
|
+
["transitioncancel", $],
|
|
818
|
+
["animationend", $],
|
|
819
|
+
["animationcancel", $]
|
|
820
|
+
];
|
|
821
|
+
for (let [r, i] of n) t ? e?.addEventListener(r, i, !0) : e?.removeEventListener(r, i, !0);
|
|
822
|
+
}
|
|
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"));
|
|
828
|
+
}), g.observe(e, {
|
|
829
|
+
childList: !0,
|
|
830
|
+
subtree: !0,
|
|
831
|
+
attributes: !0,
|
|
832
|
+
attributeOldValue: !0,
|
|
833
|
+
characterData: !0
|
|
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, () => {
|
|
838
|
+
D = !0, v(() => {
|
|
839
|
+
D && Y("content");
|
|
840
|
+
});
|
|
640
841
|
}), S(() => {
|
|
641
|
-
t.scrollElement?.removeEventListener("scroll",
|
|
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);
|
|
642
843
|
}), (t, n) => (w(), s("div", {
|
|
643
844
|
ref_key: "trackElement",
|
|
644
845
|
ref: i,
|
|
@@ -646,10 +847,10 @@ var Ve = ["aria-hidden"], He = [
|
|
|
646
847
|
"gallery-scrollbar--dragging": o.value,
|
|
647
848
|
"gallery-scrollbar--interacting": l.value,
|
|
648
849
|
"gallery-scrollbar--ready": u.value,
|
|
649
|
-
"gallery-scrollbar--visible":
|
|
850
|
+
"gallery-scrollbar--visible": R.value
|
|
650
851
|
}]),
|
|
651
|
-
"aria-hidden": !
|
|
652
|
-
onPointerdown:
|
|
852
|
+
"aria-hidden": !R.value || void 0,
|
|
853
|
+
onPointerdown: se
|
|
653
854
|
}, [c("div", {
|
|
654
855
|
class: "gallery-scrollbar-thumb",
|
|
655
856
|
"aria-controls": e.controlsId,
|
|
@@ -659,22 +860,22 @@ var Ve = ["aria-hidden"], He = [
|
|
|
659
860
|
"aria-valuemin": "0",
|
|
660
861
|
"aria-valuenow": Math.round(e.scrollElement?.scrollTop ?? 0),
|
|
661
862
|
role: "scrollbar",
|
|
662
|
-
style: x(
|
|
663
|
-
tabindex:
|
|
664
|
-
onKeydown:
|
|
665
|
-
onPointercancel:
|
|
666
|
-
onPointerdown:
|
|
667
|
-
onPointermove:
|
|
668
|
-
onPointerup:
|
|
669
|
-
}, null, 44,
|
|
670
|
-
}
|
|
671
|
-
}),
|
|
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) => {
|
|
672
873
|
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
|
673
874
|
return !1;
|
|
674
|
-
},
|
|
675
|
-
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);
|
|
676
877
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
677
|
-
},
|
|
878
|
+
}, at = {
|
|
678
879
|
xmlns: "http://www.w3.org/2000/svg",
|
|
679
880
|
width: 24,
|
|
680
881
|
height: 24,
|
|
@@ -684,27 +885,27 @@ var Ve = ["aria-hidden"], He = [
|
|
|
684
885
|
"stroke-width": 2,
|
|
685
886
|
"stroke-linecap": "round",
|
|
686
887
|
"stroke-linejoin": "round"
|
|
687
|
-
},
|
|
688
|
-
|
|
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,
|
|
689
890
|
...c,
|
|
690
891
|
width: o,
|
|
691
892
|
height: o,
|
|
692
893
|
stroke: s,
|
|
693
|
-
"stroke-width":
|
|
694
|
-
class:
|
|
695
|
-
...!l.default &&
|
|
696
|
-
}, [...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, {
|
|
697
898
|
...i,
|
|
698
899
|
...n,
|
|
699
900
|
iconNode: t,
|
|
700
901
|
name: e
|
|
701
|
-
}, r),
|
|
902
|
+
}, r), ct = st("chevron-left", [["path", {
|
|
702
903
|
d: "m15 18-6-6 6-6",
|
|
703
904
|
key: "1wnfg3"
|
|
704
|
-
}]]),
|
|
905
|
+
}]]), lt = st("chevron-right", [["path", {
|
|
705
906
|
d: "m9 18 6-6-6-6",
|
|
706
907
|
key: "mthhwq"
|
|
707
|
-
}]]),
|
|
908
|
+
}]]), ut = st("disc-3", [
|
|
708
909
|
["circle", {
|
|
709
910
|
cx: "12",
|
|
710
911
|
cy: "12",
|
|
@@ -725,7 +926,7 @@ var Ve = ["aria-hidden"], He = [
|
|
|
725
926
|
d: "M18 12c0 1.7-.7 3.2-1.8 4.2",
|
|
726
927
|
key: "1eah9h"
|
|
727
928
|
}]
|
|
728
|
-
]),
|
|
929
|
+
]), dt = st("pause", [["rect", {
|
|
729
930
|
x: "14",
|
|
730
931
|
y: "3",
|
|
731
932
|
width: "5",
|
|
@@ -739,10 +940,10 @@ var Ve = ["aria-hidden"], He = [
|
|
|
739
940
|
height: "18",
|
|
740
941
|
rx: "1",
|
|
741
942
|
key: "1wsw3u"
|
|
742
|
-
}]]),
|
|
943
|
+
}]]), ft = st("play", [["path", {
|
|
743
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",
|
|
744
945
|
key: "10ikf1"
|
|
745
|
-
}]]),
|
|
946
|
+
}]]), pt = st("volume-2", [
|
|
746
947
|
["path", {
|
|
747
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",
|
|
748
949
|
key: "uqj9uw"
|
|
@@ -755,7 +956,7 @@ var Ve = ["aria-hidden"], He = [
|
|
|
755
956
|
d: "M19.364 18.364a9 9 0 0 0 0-12.728",
|
|
756
957
|
key: "ijwkga"
|
|
757
958
|
}]
|
|
758
|
-
]),
|
|
959
|
+
]), mt = st("volume-x", [
|
|
759
960
|
["path", {
|
|
760
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",
|
|
761
962
|
key: "uqj9uw"
|
|
@@ -774,28 +975,28 @@ var Ve = ["aria-hidden"], He = [
|
|
|
774
975
|
y2: "15",
|
|
775
976
|
key: "5ykzw1"
|
|
776
977
|
}]
|
|
777
|
-
]),
|
|
978
|
+
]), ht = {
|
|
778
979
|
401: "Authentication required",
|
|
779
980
|
403: "Access forbidden",
|
|
780
981
|
404: "Preview not found",
|
|
781
982
|
419: "Session expired",
|
|
782
983
|
500: "Server error"
|
|
783
984
|
};
|
|
784
|
-
function
|
|
985
|
+
function gt(e) {
|
|
785
986
|
return e.match(/\/demo-errors\/(401|403|404|419|500)\//)?.[1] ?? "Error";
|
|
786
987
|
}
|
|
787
|
-
function
|
|
788
|
-
return
|
|
988
|
+
function _t(e) {
|
|
989
|
+
return ht[gt(e)] ?? "Preview unavailable";
|
|
789
990
|
}
|
|
790
991
|
//#endregion
|
|
791
992
|
//#region src/components/CardRegion.vue
|
|
792
|
-
var
|
|
993
|
+
var vt = /* @__PURE__ */ d({
|
|
793
994
|
__name: "CardRegion",
|
|
794
995
|
props: {
|
|
795
996
|
index: {},
|
|
796
997
|
item: {},
|
|
797
998
|
layout: {},
|
|
798
|
-
loadedCount: {},
|
|
999
|
+
loadedCount: { type: [Number, Function] },
|
|
799
1000
|
mediaIndex: {},
|
|
800
1001
|
mediaSource: {},
|
|
801
1002
|
placement: {},
|
|
@@ -804,24 +1005,24 @@ var ft = /* @__PURE__ */ d({
|
|
|
804
1005
|
total: {}
|
|
805
1006
|
},
|
|
806
1007
|
setup(e) {
|
|
807
|
-
let t = e, n = r(() => K(t.item, t.mediaIndex)), i = r(() => G(t.item)),
|
|
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(() => ({
|
|
808
1009
|
height: `${t.region.height}px`,
|
|
809
1010
|
paddingBlock: t.style?.paddingY === void 0 ? void 0 : `${t.style.paddingY}px`,
|
|
810
1011
|
paddingInline: t.style?.paddingX === void 0 ? void 0 : `${t.style.paddingX}px`
|
|
811
|
-
})),
|
|
1012
|
+
})), u = r(() => t.style?.background ?? t.region.background);
|
|
812
1013
|
return (t, r) => (w(), s("div", {
|
|
813
|
-
class: y(["media-card-region", [`media-card-${e.placement}`, { "media-card-region--transparent":
|
|
814
|
-
style: x(
|
|
815
|
-
onClick: r[0] ||=
|
|
816
|
-
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"])
|
|
817
1018
|
}, [(w(), a(D(e.region.component), {
|
|
818
1019
|
index: e.index,
|
|
819
1020
|
item: e.item,
|
|
820
1021
|
layout: e.layout,
|
|
821
|
-
"loaded-count":
|
|
822
|
-
"media-count":
|
|
1022
|
+
"loaded-count": i.value,
|
|
1023
|
+
"media-count": o.value.length,
|
|
823
1024
|
"media-index": n.value,
|
|
824
|
-
"media-item":
|
|
1025
|
+
"media-item": c.value,
|
|
825
1026
|
"media-source": e.mediaSource ?? "preview",
|
|
826
1027
|
total: e.total
|
|
827
1028
|
}, null, 8, [
|
|
@@ -836,7 +1037,7 @@ var ft = /* @__PURE__ */ d({
|
|
|
836
1037
|
"total"
|
|
837
1038
|
]))], 38));
|
|
838
1039
|
}
|
|
839
|
-
}),
|
|
1040
|
+
}), yt = ["aria-busy", "aria-label"], bt = { class: "media-error-code" }, xt = ["disabled"], St = /* @__PURE__ */ d({
|
|
840
1041
|
__name: "MediaError",
|
|
841
1042
|
props: {
|
|
842
1043
|
component: {},
|
|
@@ -859,8 +1060,8 @@ var ft = /* @__PURE__ */ d({
|
|
|
859
1060
|
}, [t.component ? (w(), s("div", {
|
|
860
1061
|
key: 0,
|
|
861
1062
|
class: "media-error-component",
|
|
862
|
-
onClick: r[0] ||=
|
|
863
|
-
onKeydown: r[1] ||=
|
|
1063
|
+
onClick: r[0] ||= I(() => {}, ["stop"]),
|
|
1064
|
+
onKeydown: r[1] ||= I(() => {}, ["stop"])
|
|
864
1065
|
}, [(w(), a(D(t.component), {
|
|
865
1066
|
label: t.label,
|
|
866
1067
|
retry: o,
|
|
@@ -871,35 +1072,35 @@ var ft = /* @__PURE__ */ d({
|
|
|
871
1072
|
"retrying",
|
|
872
1073
|
"status"
|
|
873
1074
|
]))], 32)) : (w(), s(e, { key: 1 }, [
|
|
874
|
-
c("strong",
|
|
1075
|
+
c("strong", bt, A(t.status), 1),
|
|
875
1076
|
c("span", null, A(t.label), 1),
|
|
876
1077
|
c("button", {
|
|
877
1078
|
"data-test": "media-retry",
|
|
878
1079
|
class: "media-error-retry",
|
|
879
1080
|
type: "button",
|
|
880
1081
|
disabled: t.retrying,
|
|
881
|
-
onClick:
|
|
882
|
-
onKeydown: r[2] ||=
|
|
883
|
-
}, A(t.retrying ? "Retrying…" : "Retry"), 41,
|
|
884
|
-
], 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));
|
|
885
1086
|
}
|
|
886
|
-
}),
|
|
1087
|
+
}), Ct = ["aria-label"], wt = [
|
|
887
1088
|
"max",
|
|
888
1089
|
"value",
|
|
889
1090
|
"aria-label",
|
|
890
1091
|
"aria-valuetext",
|
|
891
1092
|
"disabled"
|
|
892
|
-
],
|
|
1093
|
+
], Tt = {
|
|
893
1094
|
key: 0,
|
|
894
1095
|
class: "media-controls-row"
|
|
895
|
-
},
|
|
1096
|
+
}, Et = ["aria-label", "title"], Dt = { class: "media-controls-audio" }, Ot = ["aria-label", "title"], kt = [
|
|
896
1097
|
"value",
|
|
897
1098
|
"aria-label",
|
|
898
1099
|
"aria-valuetext"
|
|
899
|
-
],
|
|
1100
|
+
], At = {
|
|
900
1101
|
class: "media-control-time",
|
|
901
1102
|
"aria-live": "off"
|
|
902
|
-
},
|
|
1103
|
+
}, jt = /* @__PURE__ */ d({
|
|
903
1104
|
__name: "MediaControls",
|
|
904
1105
|
props: {
|
|
905
1106
|
currentTime: {},
|
|
@@ -936,10 +1137,10 @@ var ft = /* @__PURE__ */ d({
|
|
|
936
1137
|
class: y(["media-controls", `media-controls--${e.layout}`]),
|
|
937
1138
|
role: "group",
|
|
938
1139
|
"aria-label": `${h.value} controls`,
|
|
939
|
-
onClick: n[4] ||=
|
|
940
|
-
onDblclick: n[5] ||=
|
|
1140
|
+
onClick: n[4] ||= I(() => {}, ["stop"]),
|
|
1141
|
+
onDblclick: n[5] ||= I(() => {}, ["stop"]),
|
|
941
1142
|
onKeydown: f,
|
|
942
|
-
onWheel: n[6] ||=
|
|
1143
|
+
onWheel: n[6] ||= I(() => {}, ["stop"])
|
|
943
1144
|
}, [c("input", {
|
|
944
1145
|
class: "media-control-range media-control-seek",
|
|
945
1146
|
type: "range",
|
|
@@ -952,35 +1153,35 @@ var ft = /* @__PURE__ */ d({
|
|
|
952
1153
|
"aria-valuetext": `${u(g.value)} of ${u(p.value)}`,
|
|
953
1154
|
disabled: p.value <= 0,
|
|
954
1155
|
onInput: n[0] ||= (e) => i("seek", d(e))
|
|
955
|
-
}, null, 44,
|
|
1156
|
+
}, null, 44, wt), e.layout === "reel" ? (w(), s("div", Tt, [
|
|
956
1157
|
c("button", {
|
|
957
1158
|
type: "button",
|
|
958
1159
|
class: "media-control-button media-control-playback",
|
|
959
1160
|
"aria-label": e.playing ? `Pause ${m.value}` : `Play ${m.value}`,
|
|
960
1161
|
title: e.playing ? "Pause" : "Play",
|
|
961
1162
|
onClick: n[1] ||= (e) => i("togglePlayback")
|
|
962
|
-
}, [e.playing ? (w(), a(M(
|
|
1163
|
+
}, [e.playing ? (w(), a(M(dt), {
|
|
963
1164
|
key: 0,
|
|
964
1165
|
size: 18,
|
|
965
1166
|
fill: "currentColor"
|
|
966
|
-
})) : (w(), a(M(
|
|
1167
|
+
})) : (w(), a(M(ft), {
|
|
967
1168
|
key: 1,
|
|
968
1169
|
size: 18,
|
|
969
1170
|
fill: "currentColor"
|
|
970
|
-
}))], 8,
|
|
971
|
-
c("div",
|
|
1171
|
+
}))], 8, Et),
|
|
1172
|
+
c("div", Dt, [c("button", {
|
|
972
1173
|
type: "button",
|
|
973
1174
|
class: "media-control-button",
|
|
974
1175
|
"aria-label": e.muted ? `Unmute ${m.value}` : `Mute ${m.value}`,
|
|
975
1176
|
title: e.muted ? "Unmute" : "Mute",
|
|
976
1177
|
onClick: n[2] ||= (e) => i("toggleMute")
|
|
977
|
-
}, [e.muted || e.volume === 0 ? (w(), a(M(
|
|
1178
|
+
}, [e.muted || e.volume === 0 ? (w(), a(M(mt), {
|
|
978
1179
|
key: 0,
|
|
979
1180
|
size: 18
|
|
980
|
-
})) : (w(), a(M(
|
|
1181
|
+
})) : (w(), a(M(pt), {
|
|
981
1182
|
key: 1,
|
|
982
1183
|
size: 18
|
|
983
|
-
}))], 8,
|
|
1184
|
+
}))], 8, Ot), c("input", {
|
|
984
1185
|
class: "media-control-range media-control-volume",
|
|
985
1186
|
type: "range",
|
|
986
1187
|
min: "0",
|
|
@@ -991,15 +1192,15 @@ var ft = /* @__PURE__ */ d({
|
|
|
991
1192
|
"aria-label": `${h.value} volume`,
|
|
992
1193
|
"aria-valuetext": `${Math.round(e.volume * 100)} percent`,
|
|
993
1194
|
onInput: n[3] ||= (e) => i("volumeChange", d(e))
|
|
994
|
-
}, null, 44,
|
|
995
|
-
c("output",
|
|
996
|
-
])) : 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));
|
|
997
1198
|
}
|
|
998
|
-
}),
|
|
1199
|
+
}), Mt = {
|
|
999
1200
|
key: 0,
|
|
1000
1201
|
class: "media-card-overlay-host",
|
|
1001
1202
|
"data-test": "media-card-overlay"
|
|
1002
|
-
},
|
|
1203
|
+
}, Nt = /* @__PURE__ */ d({
|
|
1003
1204
|
__name: "MediaContextOverlay",
|
|
1004
1205
|
props: {
|
|
1005
1206
|
item: {},
|
|
@@ -1009,7 +1210,7 @@ var ft = /* @__PURE__ */ d({
|
|
|
1009
1210
|
mediaSource: {}
|
|
1010
1211
|
},
|
|
1011
1212
|
setup(e) {
|
|
1012
|
-
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), {
|
|
1013
1214
|
item: e.item,
|
|
1014
1215
|
"media-index": e.mediaIndex,
|
|
1015
1216
|
"media-item": e.mediaItem,
|
|
@@ -1021,8 +1222,8 @@ var ft = /* @__PURE__ */ d({
|
|
|
1021
1222
|
"media-source"
|
|
1022
1223
|
]))])) : o("", !0);
|
|
1023
1224
|
}
|
|
1024
|
-
}),
|
|
1025
|
-
function
|
|
1225
|
+
}), Pt = 40, Ft = 160, It = 24;
|
|
1226
|
+
function Lt(e) {
|
|
1026
1227
|
let t = k("next"), n = null, r = 0, i = !1, a = null, o = null;
|
|
1027
1228
|
function s(n, r) {
|
|
1028
1229
|
let i = G(e.item()).length, a = (n + i) % i;
|
|
@@ -1032,7 +1233,7 @@ function jt(e) {
|
|
|
1032
1233
|
r = 0, i = !1, n !== null && clearTimeout(n), n = null;
|
|
1033
1234
|
}
|
|
1034
1235
|
function l() {
|
|
1035
|
-
n !== null && clearTimeout(n), n = setTimeout(c,
|
|
1236
|
+
n !== null && clearTimeout(n), n = setTimeout(c, Ft);
|
|
1036
1237
|
}
|
|
1037
1238
|
function u(e, t, n) {
|
|
1038
1239
|
return t === 1 ? e * 16 : t === 2 ? e * n : e;
|
|
@@ -1040,7 +1241,7 @@ function jt(e) {
|
|
|
1040
1241
|
function d(t) {
|
|
1041
1242
|
if (G(e.item()).length <= 1) return;
|
|
1042
1243
|
let n = t.currentTarget, a = u(t.deltaX, t.deltaMode, n?.clientWidth || 1);
|
|
1043
|
-
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;
|
|
1044
1245
|
let o = Math.sign(r);
|
|
1045
1246
|
r = 0, i = !0, s(e.mediaIndex() + o);
|
|
1046
1247
|
}
|
|
@@ -1052,7 +1253,7 @@ function jt(e) {
|
|
|
1052
1253
|
let n = t.changedTouches[0];
|
|
1053
1254
|
if (a === null || o === null || !n) return;
|
|
1054
1255
|
let r = a - n.clientX, i = o - n.clientY;
|
|
1055
|
-
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)));
|
|
1056
1257
|
}
|
|
1057
1258
|
return S(c), {
|
|
1058
1259
|
change: s,
|
|
@@ -1062,11 +1263,11 @@ function jt(e) {
|
|
|
1062
1263
|
onWheel: d
|
|
1063
1264
|
};
|
|
1064
1265
|
}
|
|
1065
|
-
var
|
|
1066
|
-
function
|
|
1266
|
+
var Rt = /* @__PURE__ */ new Map(), zt = [], Bt = 0, Vt = 0;
|
|
1267
|
+
function Ht(e, t) {
|
|
1067
1268
|
return `${t ? "timed" : "image"}:${e}`;
|
|
1068
1269
|
}
|
|
1069
|
-
function
|
|
1270
|
+
function Ut(e, t, n) {
|
|
1070
1271
|
let r = G(e);
|
|
1071
1272
|
if (r.length < 2) return [];
|
|
1072
1273
|
let i = K(e, t), a = [];
|
|
@@ -1080,7 +1281,7 @@ function Lt(e, t, n) {
|
|
|
1080
1281
|
if (!t) return [];
|
|
1081
1282
|
let i = V(t.type, t.src) === "audio" ? W(t) : te(t, n);
|
|
1082
1283
|
if (!i) return [];
|
|
1083
|
-
let a = H(i.type, i.src), s =
|
|
1284
|
+
let a = H(i.type, i.src), s = Ht(i.src, a);
|
|
1084
1285
|
return o.has(s) ? [] : (o.add(s), [{
|
|
1085
1286
|
key: s,
|
|
1086
1287
|
src: i.src,
|
|
@@ -1088,22 +1289,22 @@ function Lt(e, t, n) {
|
|
|
1088
1289
|
}]);
|
|
1089
1290
|
});
|
|
1090
1291
|
}
|
|
1091
|
-
function
|
|
1292
|
+
function Wt(e) {
|
|
1092
1293
|
let t = e.element;
|
|
1093
1294
|
e.element = null, t && (t instanceof HTMLVideoElement ? (t.pause(), t.removeAttribute("src"), t.load()) : t.removeAttribute("src"));
|
|
1094
1295
|
}
|
|
1095
|
-
function
|
|
1096
|
-
|
|
1097
|
-
let t =
|
|
1098
|
-
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);
|
|
1099
1300
|
}
|
|
1100
|
-
function
|
|
1101
|
-
e.state = "loading",
|
|
1301
|
+
function Kt(e) {
|
|
1302
|
+
e.state = "loading", Bt += 1, e.timed && (Vt += 1);
|
|
1102
1303
|
let t = !1, n = () => void 0, r = (r) => {
|
|
1103
|
-
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());
|
|
1104
1305
|
};
|
|
1105
1306
|
if (e.cancel = () => {
|
|
1106
|
-
t || (t = !0, n(), --
|
|
1307
|
+
t || (t = !0, n(), --Bt, e.timed && --Vt, Wt(e), qt());
|
|
1107
1308
|
}, e.timed) {
|
|
1108
1309
|
let t = document.createElement("video"), i = () => r("ready"), a = () => r("failed");
|
|
1109
1310
|
n = () => {
|
|
@@ -1122,49 +1323,49 @@ function Bt(e) {
|
|
|
1122
1323
|
i.removeEventListener("load", a), i.removeEventListener("error", o);
|
|
1123
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;
|
|
1124
1325
|
}
|
|
1125
|
-
function
|
|
1126
|
-
for (;
|
|
1127
|
-
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));
|
|
1128
1329
|
if (e < 0) return;
|
|
1129
|
-
let [t] =
|
|
1130
|
-
t &&
|
|
1330
|
+
let [t] = zt.splice(e, 1);
|
|
1331
|
+
t && Kt(t);
|
|
1131
1332
|
}
|
|
1132
1333
|
}
|
|
1133
|
-
function
|
|
1134
|
-
let t =
|
|
1334
|
+
function Jt(e) {
|
|
1335
|
+
let t = Rt.get(e.key);
|
|
1135
1336
|
t || (t = {
|
|
1136
1337
|
...e,
|
|
1137
1338
|
cancel: null,
|
|
1138
1339
|
element: null,
|
|
1139
1340
|
refs: 0,
|
|
1140
1341
|
state: "queued"
|
|
1141
|
-
},
|
|
1342
|
+
}, Rt.set(t.key, t), zt.push(t)), t.refs += 1, qt();
|
|
1142
1343
|
let n = !1;
|
|
1143
1344
|
return () => {
|
|
1144
|
-
n || (n = !0, --t.refs, t.refs === 0 &&
|
|
1345
|
+
n || (n = !0, --t.refs, t.refs === 0 && Gt(t));
|
|
1145
1346
|
};
|
|
1146
1347
|
}
|
|
1147
1348
|
//#endregion
|
|
1148
1349
|
//#region src/components/useVisiblePostPreload.ts
|
|
1149
|
-
function
|
|
1150
|
-
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();
|
|
1151
1352
|
function a() {
|
|
1152
1353
|
let e = new Map(n.value.map((e) => [e.key, e]));
|
|
1153
1354
|
i.forEach((t, n) => {
|
|
1154
1355
|
e.has(n) || (t(), i.delete(n));
|
|
1155
1356
|
}), n.value.forEach((e) => {
|
|
1156
|
-
i.has(e.key) || i.set(e.key,
|
|
1357
|
+
i.has(e.key) || i.set(e.key, Jt(e));
|
|
1157
1358
|
});
|
|
1158
1359
|
}
|
|
1159
|
-
|
|
1360
|
+
N(() => n.value.map(({ key: e }) => e).join("\n"), a, { immediate: !0 }), S(() => {
|
|
1160
1361
|
i.forEach((e) => e()), i.clear();
|
|
1161
1362
|
});
|
|
1162
1363
|
}
|
|
1163
1364
|
//#endregion
|
|
1164
1365
|
//#region src/components/useMediaLoading.ts
|
|
1165
|
-
function
|
|
1366
|
+
function Xt(e) {
|
|
1166
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");
|
|
1167
|
-
return
|
|
1368
|
+
return N(i, (t, n) => {
|
|
1168
1369
|
n !== "none" || t === "none" || v(() => e.mediaElement.value?.load());
|
|
1169
1370
|
}), {
|
|
1170
1371
|
imageLoading: n,
|
|
@@ -1174,7 +1375,7 @@ function Wt(e) {
|
|
|
1174
1375
|
}
|
|
1175
1376
|
//#endregion
|
|
1176
1377
|
//#region src/components/useMediaReadiness.ts
|
|
1177
|
-
function
|
|
1378
|
+
function Zt(e) {
|
|
1178
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());
|
|
1179
1380
|
function m() {
|
|
1180
1381
|
l !== null && clearTimeout(l), l = null;
|
|
@@ -1217,7 +1418,7 @@ function Gt(e) {
|
|
|
1217
1418
|
function C(e) {
|
|
1218
1419
|
h(e) && o.value && g();
|
|
1219
1420
|
}
|
|
1220
|
-
return
|
|
1421
|
+
return N(e.identity, () => {
|
|
1221
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);
|
|
1222
1423
|
}, { immediate: !0 }), S(() => {
|
|
1223
1424
|
f = !0, m();
|
|
@@ -1235,30 +1436,30 @@ function Gt(e) {
|
|
|
1235
1436
|
}
|
|
1236
1437
|
//#endregion
|
|
1237
1438
|
//#region src/core/reelAudio.ts
|
|
1238
|
-
var
|
|
1439
|
+
var Qt = {
|
|
1239
1440
|
lastAudibleVolume: 1,
|
|
1240
1441
|
muted: !1,
|
|
1241
1442
|
volume: 1
|
|
1242
1443
|
};
|
|
1243
|
-
function
|
|
1444
|
+
function $t(e, t) {
|
|
1244
1445
|
return typeof e == "number" && Number.isFinite(e) ? Math.min(1, Math.max(0, e)) : t;
|
|
1245
1446
|
}
|
|
1246
|
-
function
|
|
1247
|
-
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);
|
|
1248
1449
|
return {
|
|
1249
|
-
lastAudibleVolume: r > 0 ? r :
|
|
1450
|
+
lastAudibleVolume: r > 0 ? r : Qt.lastAudibleVolume,
|
|
1250
1451
|
muted: typeof e?.muted == "boolean" ? e.muted : n === 0 || t.muted,
|
|
1251
1452
|
volume: n
|
|
1252
1453
|
};
|
|
1253
1454
|
}
|
|
1254
1455
|
//#endregion
|
|
1255
1456
|
//#region src/components/useMediaCardAudio.ts
|
|
1256
|
-
function
|
|
1257
|
-
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;
|
|
1258
1459
|
function o() {
|
|
1259
1460
|
let t = e.mediaElement.value, n = e.reelAudioState();
|
|
1260
1461
|
if (!t || e.layout() !== "reel" || !n) return;
|
|
1261
|
-
let o =
|
|
1462
|
+
let o = en(n);
|
|
1262
1463
|
a = o.lastAudibleVolume, i.value = o.volume, r.value = o.muted, t.volume = o.volume, t.muted = e.active() === !1 ? !0 : o.muted;
|
|
1263
1464
|
}
|
|
1264
1465
|
function s(e, t) {
|
|
@@ -1266,7 +1467,7 @@ function Yt(e) {
|
|
|
1266
1467
|
}
|
|
1267
1468
|
function c(t) {
|
|
1268
1469
|
if (e.layout() !== "reel") return;
|
|
1269
|
-
let n =
|
|
1470
|
+
let n = en({
|
|
1270
1471
|
lastAudibleVolume: a,
|
|
1271
1472
|
muted: t.muted,
|
|
1272
1473
|
volume: t.volume
|
|
@@ -1283,7 +1484,7 @@ function Yt(e) {
|
|
|
1283
1484
|
let t = e.mediaElement.value;
|
|
1284
1485
|
t && (t.muted && t.volume === 0 && (t.volume = a), t.muted = !t.muted, s(t, !0), c(t));
|
|
1285
1486
|
}
|
|
1286
|
-
return
|
|
1487
|
+
return N([
|
|
1287
1488
|
e.active,
|
|
1288
1489
|
e.layout,
|
|
1289
1490
|
() => e.reelAudioState()?.lastAudibleVolume,
|
|
@@ -1301,7 +1502,7 @@ function Yt(e) {
|
|
|
1301
1502
|
}
|
|
1302
1503
|
//#endregion
|
|
1303
1504
|
//#region src/components/useReelVideoActivity.ts
|
|
1304
|
-
function
|
|
1505
|
+
function nn(e) {
|
|
1305
1506
|
let t = r(() => e.layout() === "reel" ? e.active() === !0 : e.inViewport()), n = r(() => t.value ? e.mediaIsMuted.value : !0);
|
|
1306
1507
|
function i() {
|
|
1307
1508
|
if (!t.value) {
|
|
@@ -1310,7 +1511,7 @@ function Xt(e) {
|
|
|
1310
1511
|
}
|
|
1311
1512
|
e.mediaIsPlaying.value = !0;
|
|
1312
1513
|
}
|
|
1313
|
-
return
|
|
1514
|
+
return N(t, (n) => {
|
|
1314
1515
|
let r = e.mediaElement.value;
|
|
1315
1516
|
if (!n) {
|
|
1316
1517
|
r?.pause(), r && (r.muted = !0), e.mediaIsPlaying.value = !1;
|
|
@@ -1335,18 +1536,18 @@ function Xt(e) {
|
|
|
1335
1536
|
}
|
|
1336
1537
|
//#endregion
|
|
1337
1538
|
//#region src/components/useTimedMediaCard.ts
|
|
1338
|
-
function
|
|
1539
|
+
function rn(e) {
|
|
1339
1540
|
return Number.isFinite(e) ? Math.max(0, e) : 0;
|
|
1340
1541
|
}
|
|
1341
|
-
function
|
|
1342
|
-
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({
|
|
1343
1544
|
active: e.active,
|
|
1344
1545
|
layout: e.layout,
|
|
1345
1546
|
mediaCard: e.mediaCard,
|
|
1346
1547
|
mediaElement: e.mediaElement,
|
|
1347
1548
|
onChange: e.onAudioChange,
|
|
1348
1549
|
reelAudioState: e.reelAudioState
|
|
1349
|
-
}), { effectiveMuted: u, onPlaying: d, playbackAllowed: f } =
|
|
1550
|
+
}), { effectiveMuted: u, onPlaying: d, playbackAllowed: f } = nn({
|
|
1350
1551
|
active: e.active,
|
|
1351
1552
|
inViewport: e.inViewport,
|
|
1352
1553
|
layout: e.layout,
|
|
@@ -1356,7 +1557,7 @@ function Qt(e) {
|
|
|
1356
1557
|
});
|
|
1357
1558
|
function p(r) {
|
|
1358
1559
|
let i = r?.currentTarget ?? e.mediaElement.value;
|
|
1359
|
-
i && (t.value =
|
|
1560
|
+
i && (t.value = rn(i.currentTime), n.value = rn(i.duration), o(i, f.value));
|
|
1360
1561
|
}
|
|
1361
1562
|
function m(t) {
|
|
1362
1563
|
i(), p(t), e.onReady(t);
|
|
@@ -1366,7 +1567,7 @@ function Qt(e) {
|
|
|
1366
1567
|
}
|
|
1367
1568
|
function g(n) {
|
|
1368
1569
|
let r = e.mediaElement.value;
|
|
1369
|
-
!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);
|
|
1370
1571
|
}
|
|
1371
1572
|
async function _() {
|
|
1372
1573
|
let t = e.mediaElement.value;
|
|
@@ -1382,7 +1583,7 @@ function Qt(e) {
|
|
|
1382
1583
|
}
|
|
1383
1584
|
}
|
|
1384
1585
|
}
|
|
1385
|
-
return
|
|
1586
|
+
return N(e.mediaElement, () => {
|
|
1386
1587
|
t.value = 0, n.value = 0, r.value = !1;
|
|
1387
1588
|
}, { flush: "sync" }), {
|
|
1388
1589
|
currentTime: t,
|
|
@@ -1404,7 +1605,7 @@ function Qt(e) {
|
|
|
1404
1605
|
}
|
|
1405
1606
|
//#endregion
|
|
1406
1607
|
//#region src/components/MediaCard.vue?vue&type=script&setup=true&lang.ts
|
|
1407
|
-
var
|
|
1608
|
+
var on = [
|
|
1408
1609
|
"data-post-id",
|
|
1409
1610
|
"data-media-index",
|
|
1410
1611
|
"aria-hidden",
|
|
@@ -1412,19 +1613,19 @@ var $t = [
|
|
|
1412
1613
|
"inert",
|
|
1413
1614
|
"role",
|
|
1414
1615
|
"tabindex"
|
|
1415
|
-
],
|
|
1616
|
+
], sn = { class: "media-card-content" }, cn = ["data-media-direction"], ln = ["data-media-index"], un = {
|
|
1416
1617
|
key: 0,
|
|
1417
1618
|
"data-test": "media-loading",
|
|
1418
1619
|
class: "media-loading",
|
|
1419
1620
|
"aria-hidden": "true"
|
|
1420
|
-
},
|
|
1621
|
+
}, dn = [
|
|
1421
1622
|
"data-source-generation",
|
|
1422
1623
|
"src",
|
|
1423
1624
|
"autoplay",
|
|
1424
1625
|
"loop",
|
|
1425
1626
|
"muted",
|
|
1426
1627
|
"preload"
|
|
1427
|
-
],
|
|
1628
|
+
], fn = ["aria-label", "disabled"], pn = [
|
|
1428
1629
|
"data-cover-identity",
|
|
1429
1630
|
"data-source-generation",
|
|
1430
1631
|
"src",
|
|
@@ -1432,11 +1633,11 @@ var $t = [
|
|
|
1432
1633
|
"height",
|
|
1433
1634
|
"fetchpriority",
|
|
1434
1635
|
"loading"
|
|
1435
|
-
],
|
|
1636
|
+
], mn = {
|
|
1436
1637
|
key: 1,
|
|
1437
1638
|
class: "media-audio-fallback",
|
|
1438
1639
|
"aria-hidden": "true"
|
|
1439
|
-
},
|
|
1640
|
+
}, hn = [
|
|
1440
1641
|
"data-source-generation",
|
|
1441
1642
|
"src",
|
|
1442
1643
|
"width",
|
|
@@ -1445,14 +1646,14 @@ var $t = [
|
|
|
1445
1646
|
"loop",
|
|
1446
1647
|
"muted",
|
|
1447
1648
|
"preload"
|
|
1448
|
-
],
|
|
1649
|
+
], gn = [
|
|
1449
1650
|
"data-source-generation",
|
|
1450
1651
|
"src",
|
|
1451
1652
|
"width",
|
|
1452
1653
|
"height",
|
|
1453
1654
|
"fetchpriority",
|
|
1454
1655
|
"loading"
|
|
1455
|
-
],
|
|
1656
|
+
], _n = ["aria-label"], vn = ["aria-label"], yn = ["aria-label"], bn = /* @__PURE__ */ d({
|
|
1456
1657
|
__name: "MediaCard",
|
|
1457
1658
|
props: {
|
|
1458
1659
|
active: { type: Boolean },
|
|
@@ -1468,7 +1669,7 @@ var $t = [
|
|
|
1468
1669
|
interactive: { type: Boolean },
|
|
1469
1670
|
leaving: { type: Boolean },
|
|
1470
1671
|
layout: {},
|
|
1471
|
-
loadedCount: {},
|
|
1672
|
+
loadedCount: { type: [Number, Function] },
|
|
1472
1673
|
mediaIndex: {},
|
|
1473
1674
|
mediaCard: {},
|
|
1474
1675
|
mediaSource: {},
|
|
@@ -1492,7 +1693,7 @@ var $t = [
|
|
|
1492
1693
|
function f(e = !1, t = "pointer") {
|
|
1493
1694
|
e && d("activate", t);
|
|
1494
1695
|
}
|
|
1495
|
-
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 ?? ""}`),
|
|
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({
|
|
1496
1697
|
identity: () => `${l.item.postId}:${m.value}:${l.mediaSource ?? "preview"}:${T.value}:${E.value ?? ""}`,
|
|
1497
1698
|
mediaIndex: () => m.value,
|
|
1498
1699
|
onError: (e, t) => {
|
|
@@ -1507,16 +1708,16 @@ var $t = [
|
|
|
1507
1708
|
onReady: (e) => d("ready", e),
|
|
1508
1709
|
previewState: () => l.previewState
|
|
1509
1710
|
});
|
|
1510
|
-
|
|
1711
|
+
Yt({
|
|
1511
1712
|
inViewport: () => l.inViewport === !0,
|
|
1512
1713
|
item: () => l.item,
|
|
1513
1714
|
layout: () => l.layout,
|
|
1514
1715
|
mediaCard: () => l.mediaCard,
|
|
1515
1716
|
mediaIndex: () => m.value,
|
|
1516
|
-
mediaReady: () =>
|
|
1717
|
+
mediaReady: () => R.value === "ready",
|
|
1517
1718
|
mediaSource: () => l.mediaSource ?? "preview"
|
|
1518
1719
|
});
|
|
1519
|
-
let { currentTime: ae, duration: oe, effectiveMuted: se, isMuted: X, isPlaying: Z, onEnded:
|
|
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({
|
|
1520
1721
|
active: () => l.active,
|
|
1521
1722
|
inViewport: () => l.inViewport === !0,
|
|
1522
1723
|
layout: () => l.layout,
|
|
@@ -1530,35 +1731,35 @@ var $t = [
|
|
|
1530
1731
|
function _e(e) {
|
|
1531
1732
|
return e.detail === 0 ? "keyboard" : "pointer";
|
|
1532
1733
|
}
|
|
1533
|
-
let { change: ve, direction: ye, onTouchEnd: be, onTouchStart: xe, onWheel: Se } =
|
|
1734
|
+
let { change: ve, direction: ye, onTouchEnd: be, onTouchStart: xe, onWheel: Se } = Lt({
|
|
1534
1735
|
item: () => l.item,
|
|
1535
1736
|
layout: () => l.layout,
|
|
1536
1737
|
mediaIndex: () => m.value,
|
|
1537
1738
|
onChange: (e) => d("mediaChange", e)
|
|
1538
|
-
}), { imageLoading: Ce, mediaIsTimed: we, timedMediaPreload: Te } =
|
|
1739
|
+
}), { imageLoading: Ce, mediaIsTimed: we, timedMediaPreload: Te } = Xt({
|
|
1539
1740
|
active: () => l.active,
|
|
1540
1741
|
fetchPriority: () => l.fetchPriority,
|
|
1541
1742
|
layout: () => l.layout,
|
|
1542
1743
|
mediaSource: () => T.value,
|
|
1543
1744
|
mediaType: () => E.value,
|
|
1544
1745
|
mediaElement: Y
|
|
1545
|
-
}), Ee = r(() => l.layout === "reel" && l.stationaryReelControls === !0), De = r(() => we.value && (!b.value || l.layout === "reel") &&
|
|
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}`);
|
|
1546
1747
|
function ke(e) {
|
|
1547
1748
|
l.layout === "reel" && (e.stopPropagation(), me());
|
|
1548
1749
|
}
|
|
1549
1750
|
function Ae(e) {
|
|
1550
|
-
e.currentTarget.dataset.coverIdentity !== j.value ||
|
|
1751
|
+
e.currentTarget.dataset.coverIdentity !== j.value || ee.value || (d("mediaError", {
|
|
1551
1752
|
mediaIndex: m.value,
|
|
1552
1753
|
source: "preview",
|
|
1553
1754
|
src: A.value?.src ?? ""
|
|
1554
|
-
}),
|
|
1755
|
+
}), ee.value = !0, l.layout === "masonry" && H());
|
|
1555
1756
|
}
|
|
1556
|
-
return
|
|
1557
|
-
|
|
1558
|
-
}),
|
|
1757
|
+
return N(j, () => {
|
|
1758
|
+
ee.value = !1;
|
|
1759
|
+
}), N([
|
|
1559
1760
|
b,
|
|
1560
1761
|
() => l.layout,
|
|
1561
|
-
|
|
1762
|
+
L
|
|
1562
1763
|
], ([e, t, n]) => {
|
|
1563
1764
|
e && t === "masonry" && !n && v(() => H());
|
|
1564
1765
|
}, { immediate: !0 }), (r, i) => (w(), s("article", {
|
|
@@ -1567,19 +1768,19 @@ var $t = [
|
|
|
1567
1768
|
class: y(["media-card", {
|
|
1568
1769
|
"media-card--entering": e.entering,
|
|
1569
1770
|
"media-card--leaving": e.leaving,
|
|
1570
|
-
"media-card--error": M(
|
|
1771
|
+
"media-card--error": M(R) === "error",
|
|
1571
1772
|
"media-card--transparent-chrome": e.mediaCard?.header?.background === "transparent" || e.mediaCard?.footer?.background === "transparent" || e.cardHeader?.background === "transparent" || e.cardFooter?.background === "transparent"
|
|
1572
1773
|
}]),
|
|
1573
1774
|
style: x(e.itemStyle),
|
|
1574
1775
|
"aria-hidden": e.leaving || void 0,
|
|
1575
|
-
"aria-busy": M(
|
|
1776
|
+
"aria-busy": M(R) === "loading" || M(ie),
|
|
1576
1777
|
inert: e.leaving || void 0,
|
|
1577
1778
|
role: e.interactive && !e.leaving && !ge.value ? "button" : void 0,
|
|
1578
1779
|
tabindex: e.interactive && !e.leaving && !ge.value ? 0 : void 0,
|
|
1579
1780
|
onClick: i[34] ||= (t) => f(e.interactive && !ge.value, _e(t)),
|
|
1580
|
-
onKeydown: [i[35] ||=
|
|
1581
|
-
}, [c("div",
|
|
1582
|
-
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, {
|
|
1583
1784
|
key: 0,
|
|
1584
1785
|
index: e.index,
|
|
1585
1786
|
item: e.item,
|
|
@@ -1613,17 +1814,17 @@ var $t = [
|
|
|
1613
1814
|
css: !M(ie),
|
|
1614
1815
|
name: `media-slide-${M(ye)}`
|
|
1615
1816
|
}, {
|
|
1616
|
-
default:
|
|
1817
|
+
default: P(() => [(w(), s("div", {
|
|
1617
1818
|
key: `${e.item.postId}:${h.value.src}:${e.mediaSource ?? "preview"}:${M(J)}`,
|
|
1618
1819
|
class: "media-card-frame",
|
|
1619
1820
|
"data-media-index": m.value
|
|
1620
1821
|
}, [
|
|
1621
|
-
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, {
|
|
1622
1823
|
key: 1,
|
|
1623
1824
|
component: e.mediaCard?.error?.component,
|
|
1624
|
-
label: M(
|
|
1825
|
+
label: M(_t)(T.value),
|
|
1625
1826
|
retrying: M(ie),
|
|
1626
|
-
status: M(
|
|
1827
|
+
status: M(gt)(T.value),
|
|
1627
1828
|
onRetry: M(q)
|
|
1628
1829
|
}, null, 8, [
|
|
1629
1830
|
"component",
|
|
@@ -1643,49 +1844,49 @@ var $t = [
|
|
|
1643
1844
|
loop: !e.advanceOnMediaEnd,
|
|
1644
1845
|
muted: M(se),
|
|
1645
1846
|
preload: M(Te),
|
|
1646
|
-
onLoadedmetadata: i[0] ||= (...e) => M(
|
|
1847
|
+
onLoadedmetadata: i[0] ||= (...e) => M(le) && M(le)(...e),
|
|
1647
1848
|
onProgress: i[1] ||= (...e) => M(U) && M(U)(...e),
|
|
1648
1849
|
onLoadeddata: i[2] ||= (...e) => M(U) && M(U)(...e),
|
|
1649
1850
|
onCanplay: i[3] ||= (...e) => M(U) && M(U)(...e),
|
|
1650
1851
|
onDurationchange: i[4] ||= (...e) => M($) && M($)(...e),
|
|
1651
1852
|
onTimeupdate: i[5] ||= (...e) => M($) && M($)(...e),
|
|
1652
1853
|
onVolumechange: i[6] ||= (...e) => M($) && M($)(...e),
|
|
1653
|
-
onPlaying: i[7] ||= (...e) => M(
|
|
1854
|
+
onPlaying: i[7] ||= (...e) => M(Q) && M(Q)(...e),
|
|
1654
1855
|
onPause: i[8] ||= (e) => Z.value = !1,
|
|
1655
|
-
onEnded: i[9] ||= (...e) => M(
|
|
1656
|
-
onError: i[10] ||= (...e) => M(
|
|
1657
|
-
}, null, 40,
|
|
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),
|
|
1658
1859
|
b.value ? (w(), s("button", {
|
|
1659
1860
|
key: 3,
|
|
1660
1861
|
type: "button",
|
|
1661
|
-
class: y(["media-audio-artwork media-preview", { "media-preview--ready": M(
|
|
1862
|
+
class: y(["media-audio-artwork media-preview", { "media-preview--ready": M(R) === "ready" }]),
|
|
1662
1863
|
"aria-label": e.layout === "reel" ? M(Z) ? "Pause audio" : "Play audio" : "Audio",
|
|
1663
1864
|
disabled: e.layout !== "reel",
|
|
1664
1865
|
onClick: ke
|
|
1665
|
-
}, [
|
|
1866
|
+
}, [L.value ? (w(), s("img", {
|
|
1666
1867
|
key: j.value,
|
|
1667
1868
|
"data-cover-identity": j.value,
|
|
1668
1869
|
"data-source-generation": M(J),
|
|
1669
1870
|
class: "media-audio-cover",
|
|
1670
|
-
src:
|
|
1671
|
-
width:
|
|
1672
|
-
height:
|
|
1871
|
+
src: L.value.src,
|
|
1872
|
+
width: L.value.width ?? void 0,
|
|
1873
|
+
height: L.value.height ?? void 0,
|
|
1673
1874
|
fetchpriority: e.fetchPriority,
|
|
1674
1875
|
alt: "",
|
|
1675
1876
|
decoding: "async",
|
|
1676
1877
|
loading: M(Ce),
|
|
1677
1878
|
onLoad: i[11] ||= (t) => e.layout === "masonry" && M(H)(t),
|
|
1678
1879
|
onError: Ae
|
|
1679
|
-
}, null, 40,
|
|
1880
|
+
}, null, 40, pn)) : (w(), s("span", mn, [u(M(ut), {
|
|
1680
1881
|
size: 64,
|
|
1681
1882
|
"stroke-width": 1.5
|
|
1682
|
-
})]))], 10,
|
|
1883
|
+
})]))], 10, fn)) : M(we) ? (w(), s("video", {
|
|
1683
1884
|
key: 4,
|
|
1684
1885
|
ref_key: "mediaElement",
|
|
1685
1886
|
ref: Y,
|
|
1686
1887
|
"data-source-generation": M(J),
|
|
1687
1888
|
class: y(["media-preview", {
|
|
1688
|
-
"media-preview--ready": M(
|
|
1889
|
+
"media-preview--ready": M(R) === "ready",
|
|
1689
1890
|
"media-preview--reel-video": e.layout === "reel"
|
|
1690
1891
|
}]),
|
|
1691
1892
|
src: T.value,
|
|
@@ -1696,24 +1897,24 @@ var $t = [
|
|
|
1696
1897
|
muted: M(se),
|
|
1697
1898
|
playsinline: "",
|
|
1698
1899
|
preload: M(Te),
|
|
1699
|
-
onLoadedmetadata: i[12] ||= (...e) => M(
|
|
1900
|
+
onLoadedmetadata: i[12] ||= (...e) => M(le) && M(le)(...e),
|
|
1700
1901
|
onProgress: i[13] ||= (...e) => M(U) && M(U)(...e),
|
|
1701
1902
|
onLoadeddata: i[14] ||= (...e) => M(U) && M(U)(...e),
|
|
1702
1903
|
onCanplay: i[15] ||= (...e) => M(U) && M(U)(...e),
|
|
1703
1904
|
onDurationchange: i[16] ||= (...e) => M($) && M($)(...e),
|
|
1704
1905
|
onTimeupdate: i[17] ||= (...e) => M($) && M($)(...e),
|
|
1705
1906
|
onVolumechange: i[18] ||= (...e) => M($) && M($)(...e),
|
|
1706
|
-
onPlaying: i[19] ||= (...e) => M(
|
|
1907
|
+
onPlaying: i[19] ||= (...e) => M(Q) && M(Q)(...e),
|
|
1707
1908
|
onPause: i[20] ||= (e) => Z.value = !1,
|
|
1708
|
-
onEnded: i[21] ||= (...e) => M(
|
|
1909
|
+
onEnded: i[21] ||= (...e) => M(ce) && M(ce)(...e),
|
|
1709
1910
|
onClick: ke,
|
|
1710
|
-
onError: i[22] ||= (...e) => M(
|
|
1711
|
-
}, null, 42,
|
|
1911
|
+
onError: i[22] ||= (...e) => M(z) && M(z)(...e)
|
|
1912
|
+
}, null, 42, hn)) : b.value ? o("", !0) : (w(), s("img", {
|
|
1712
1913
|
key: 5,
|
|
1713
1914
|
ref_key: "imageElement",
|
|
1714
|
-
ref:
|
|
1915
|
+
ref: B,
|
|
1715
1916
|
"data-source-generation": M(J),
|
|
1716
|
-
class: y(["media-preview", { "media-preview--ready": M(
|
|
1917
|
+
class: y(["media-preview", { "media-preview--ready": M(R) === "ready" }]),
|
|
1717
1918
|
src: T.value,
|
|
1718
1919
|
width: D.value ?? void 0,
|
|
1719
1920
|
height: O.value ?? void 0,
|
|
@@ -1722,12 +1923,12 @@ var $t = [
|
|
|
1722
1923
|
decoding: "async",
|
|
1723
1924
|
loading: M(Ce),
|
|
1724
1925
|
onLoad: i[23] ||= (...e) => M(H) && M(H)(...e),
|
|
1725
|
-
onError: i[24] ||= (...e) => M(
|
|
1726
|
-
}, null, 42,
|
|
1727
|
-
], 8,
|
|
1926
|
+
onError: i[24] ||= (...e) => M(z) && M(z)(...e)
|
|
1927
|
+
}, null, 42, gn))
|
|
1928
|
+
], 8, ln))]),
|
|
1728
1929
|
_: 1
|
|
1729
1930
|
}, 8, ["css", "name"]),
|
|
1730
|
-
u(
|
|
1931
|
+
u(Nt, {
|
|
1731
1932
|
item: e.item,
|
|
1732
1933
|
"media-card": e.mediaCard,
|
|
1733
1934
|
"media-index": m.value,
|
|
@@ -1747,7 +1948,7 @@ var $t = [
|
|
|
1747
1948
|
name: "vibe-reel-media-controls",
|
|
1748
1949
|
css: Ee.value
|
|
1749
1950
|
}, {
|
|
1750
|
-
default:
|
|
1951
|
+
default: P(() => [De.value ? (w(), a(jt, {
|
|
1751
1952
|
key: Oe.value,
|
|
1752
1953
|
"current-time": M(ae),
|
|
1753
1954
|
"data-control-post-id": Ee.value ? e.item.postId : void 0,
|
|
@@ -1785,25 +1986,25 @@ var $t = [
|
|
|
1785
1986
|
type: "button",
|
|
1786
1987
|
class: "media-carousel-control media-carousel-control--previous",
|
|
1787
1988
|
"aria-label": `Previous media for post ${e.item.postId}`,
|
|
1788
|
-
onClick: i[25] ||=
|
|
1789
|
-
onKeydown: i[26] ||=
|
|
1790
|
-
}, [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", {
|
|
1791
1992
|
type: "button",
|
|
1792
1993
|
class: "media-carousel-control media-carousel-control--next",
|
|
1793
1994
|
"aria-label": `Next media for post ${e.item.postId}`,
|
|
1794
|
-
onClick: i[27] ||=
|
|
1795
|
-
onKeydown: i[28] ||=
|
|
1796
|
-
}, [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),
|
|
1797
1998
|
ge.value ? (w(), s("button", {
|
|
1798
1999
|
key: 1,
|
|
1799
2000
|
class: "media-card-activator",
|
|
1800
2001
|
type: "button",
|
|
1801
2002
|
"aria-label": `Open post ${e.item.postId}`,
|
|
1802
|
-
onClick: i[29] ||=
|
|
1803
|
-
onKeydown: i[30] ||=
|
|
1804
|
-
}, null, 40,
|
|
1805
|
-
], 42,
|
|
1806
|
-
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, {
|
|
1807
2008
|
key: 1,
|
|
1808
2009
|
index: e.index,
|
|
1809
2010
|
item: e.item,
|
|
@@ -1826,12 +2027,12 @@ var $t = [
|
|
|
1826
2027
|
"style",
|
|
1827
2028
|
"total"
|
|
1828
2029
|
])) : o("", !0)
|
|
1829
|
-
])], 46,
|
|
2030
|
+
])], 46, on));
|
|
1830
2031
|
}
|
|
1831
2032
|
});
|
|
1832
2033
|
//#endregion
|
|
1833
2034
|
//#region src/components/useMasonryMediaVisibility.ts
|
|
1834
|
-
function
|
|
2035
|
+
function xn(e) {
|
|
1835
2036
|
function t(t) {
|
|
1836
2037
|
return t.flatMap((t) => {
|
|
1837
2038
|
let n = e.items()[t];
|
|
@@ -1846,7 +2047,7 @@ function hn(e) {
|
|
|
1846
2047
|
}
|
|
1847
2048
|
function n(e, n) {
|
|
1848
2049
|
let r = /* @__PURE__ */ new Set();
|
|
1849
|
-
|
|
2050
|
+
N(() => t(e()), (e) => {
|
|
1850
2051
|
let t = new Set(e.map(({ key: e }) => e));
|
|
1851
2052
|
e.forEach(({ key: e, mediaIndex: t, postId: i }) => {
|
|
1852
2053
|
r.has(e) || n(i, t);
|
|
@@ -1860,14 +2061,14 @@ function hn(e) {
|
|
|
1860
2061
|
}
|
|
1861
2062
|
//#endregion
|
|
1862
2063
|
//#region src/components/useSettledMasonryFeedLayout.ts
|
|
1863
|
-
var
|
|
1864
|
-
function
|
|
2064
|
+
var Sn = 1500;
|
|
2065
|
+
function Cn(e) {
|
|
1865
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;
|
|
1866
2067
|
function p() {
|
|
1867
2068
|
c !== null && (cancelAnimationFrame(c), c = null);
|
|
1868
2069
|
}
|
|
1869
2070
|
function m(e, t, n, r) {
|
|
1870
|
-
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;
|
|
1871
2072
|
}
|
|
1872
2073
|
function h() {
|
|
1873
2074
|
c === null && (c = requestAnimationFrame(() => {
|
|
@@ -1881,7 +2082,7 @@ function _n(e) {
|
|
|
1881
2082
|
minColumnWidth: e.minColumnWidth.value
|
|
1882
2083
|
}, i, o, {
|
|
1883
2084
|
throughIndex: e.packThroughIndex(),
|
|
1884
|
-
untilIndex: o +
|
|
2085
|
+
untilIndex: o + Sn
|
|
1885
2086
|
}), r, o, i), t.value += 1;
|
|
1886
2087
|
}));
|
|
1887
2088
|
}
|
|
@@ -1902,8 +2103,8 @@ function _n(e) {
|
|
|
1902
2103
|
}
|
|
1903
2104
|
p();
|
|
1904
2105
|
let v = Ee(r, c, g);
|
|
1905
|
-
return a = v, u = r, f = c, o = g.gap, i = g.additionalHeight, s = g.minColumnWidth, d =
|
|
1906
|
-
}), _ = 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)));
|
|
1907
2108
|
return S(p), {
|
|
1908
2109
|
ensurePackedThrough(r) {
|
|
1909
2110
|
let i = n.value, o = a;
|
|
@@ -1925,11 +2126,40 @@ function _n(e) {
|
|
|
1925
2126
|
};
|
|
1926
2127
|
}
|
|
1927
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
|
|
1928
2158
|
//#region src/components/MasonryFeed.vue?vue&type=script&setup=true&lang.ts
|
|
1929
|
-
var
|
|
2159
|
+
var Tn = { class: "masonry-feed-shell" }, En = ["aria-hidden", "inert"], Dn = {
|
|
1930
2160
|
key: 0,
|
|
1931
2161
|
class: "masonry-feed-status-overlay"
|
|
1932
|
-
},
|
|
2162
|
+
}, On = 6, kn = 12, An = 250, jn = /* @__PURE__ */ d({
|
|
1933
2163
|
__name: "MasonryFeed",
|
|
1934
2164
|
props: {
|
|
1935
2165
|
enteringPostIds: {},
|
|
@@ -1968,32 +2198,32 @@ var vn = { class: "masonry-feed-shell" }, yn = ["aria-hidden", "inert"], bn = {
|
|
|
1968
2198
|
"visible"
|
|
1969
2199
|
],
|
|
1970
2200
|
setup(t, { expose: n, emit: i }) {
|
|
1971
|
-
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(() => ({
|
|
1972
2202
|
additionalHeight: (d.cardHeader?.height ?? 0) + (d.cardFooter?.height ?? 0),
|
|
1973
2203
|
gap: _.value,
|
|
1974
|
-
minColumnWidth:
|
|
1975
|
-
})),
|
|
1976
|
-
function
|
|
1977
|
-
let e = A - C.value + v.value +
|
|
1978
|
-
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];
|
|
1979
2209
|
return n ? Math.max(e, n.y + n.height) : e;
|
|
1980
2210
|
}, 0);
|
|
1981
2211
|
return Math.max(e, t);
|
|
1982
2212
|
}
|
|
1983
|
-
function
|
|
2213
|
+
function B() {
|
|
1984
2214
|
return O.value.reduce((e, t) => Math.max(e, t), -1);
|
|
1985
2215
|
}
|
|
1986
|
-
let V =
|
|
1987
|
-
additionalHeight: r(() =>
|
|
2216
|
+
let V = Cn({
|
|
2217
|
+
additionalHeight: r(() => L.value.additionalHeight),
|
|
1988
2218
|
gap: _,
|
|
1989
2219
|
items: () => d.items,
|
|
1990
|
-
minColumnWidth: r(() =>
|
|
1991
|
-
packThroughIndex:
|
|
1992
|
-
packUntilBottom:
|
|
2220
|
+
minColumnWidth: r(() => L.value.minColumnWidth),
|
|
2221
|
+
packThroughIndex: B,
|
|
2222
|
+
packUntilBottom: z,
|
|
1993
2223
|
width: g
|
|
1994
|
-
}), H = V.layout, U = V.viewportIndex, te = r(() => d.leavingPostIds.size === 0 ? null : Oe(d.items, g.value,
|
|
1995
|
-
throughIndex:
|
|
1996
|
-
untilBottom:
|
|
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()
|
|
1997
2227
|
})), W = r(() => {
|
|
1998
2228
|
let e = te.value;
|
|
1999
2229
|
return e ? {
|
|
@@ -2003,30 +2233,33 @@ var vn = { class: "masonry-feed-shell" }, yn = ["aria-hidden", "inert"], bn = {
|
|
|
2003
2233
|
} : H.value;
|
|
2004
2234
|
}), ne = r(() => {
|
|
2005
2235
|
let e = te.value;
|
|
2006
|
-
return e ?
|
|
2007
|
-
}), 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 =
|
|
2008
|
-
let
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
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) {
|
|
2016
2249
|
return [...new Set([...e, ...t])].sort((e, t) => e - t);
|
|
2017
2250
|
}
|
|
2018
|
-
function
|
|
2251
|
+
function se(e, t) {
|
|
2019
2252
|
return e.length === t.length && e.every((e, n) => e === t[n]);
|
|
2020
2253
|
}
|
|
2021
|
-
function
|
|
2254
|
+
function X(e) {
|
|
2022
2255
|
let t = {
|
|
2023
2256
|
scrollTop: A - C.value,
|
|
2024
2257
|
viewportHeight: v.value
|
|
2025
|
-
}, n = ne.value, r =
|
|
2258
|
+
}, n = ne.value, r = Le(n ?? U.value, {
|
|
2026
2259
|
...t,
|
|
2027
2260
|
overscan: e
|
|
2028
2261
|
}).indices;
|
|
2029
|
-
return
|
|
2262
|
+
return oe(r, d.leavingPostIds.size === 0 ? [] : Le(U.value, {
|
|
2030
2263
|
...t,
|
|
2031
2264
|
overscan: e
|
|
2032
2265
|
}).indices.filter((e) => {
|
|
@@ -2034,9 +2267,9 @@ var vn = { class: "masonry-feed-shell" }, yn = ["aria-hidden", "inert"], bn = {
|
|
|
2034
2267
|
return t !== void 0 && d.leavingPostIds.has(t.postId);
|
|
2035
2268
|
}));
|
|
2036
2269
|
}
|
|
2037
|
-
function
|
|
2038
|
-
let e =
|
|
2039
|
-
|
|
2270
|
+
function Z() {
|
|
2271
|
+
let e = X(0), t = X(ze(d.masonry, v.value));
|
|
2272
|
+
se(D.value, e) || (D.value = e);
|
|
2040
2273
|
let n = xe(W.value.items, e.filter((e) => {
|
|
2041
2274
|
let t = d.items[e];
|
|
2042
2275
|
return t && !d.leavingPostIds.has(t.postId);
|
|
@@ -2044,17 +2277,17 @@ var vn = { class: "masonry-feed-shell" }, yn = ["aria-hidden", "inert"], bn = {
|
|
|
2044
2277
|
scrollTop: A - C.value,
|
|
2045
2278
|
viewportHeight: v.value
|
|
2046
2279
|
});
|
|
2047
|
-
|
|
2280
|
+
se(T.value, n) || (T.value = n), se(O.value, t) || (O.value = t);
|
|
2048
2281
|
}
|
|
2049
|
-
function
|
|
2050
|
-
if (
|
|
2051
|
-
|
|
2282
|
+
function ce() {
|
|
2283
|
+
if (I !== null) return;
|
|
2284
|
+
I = -1;
|
|
2052
2285
|
let e = requestAnimationFrame(() => {
|
|
2053
|
-
|
|
2286
|
+
I = null, Z();
|
|
2054
2287
|
});
|
|
2055
|
-
|
|
2288
|
+
I !== null && (I = e);
|
|
2056
2289
|
}
|
|
2057
|
-
|
|
2290
|
+
xn({
|
|
2058
2291
|
fullyVisibleIndices: () => T.value,
|
|
2059
2292
|
items: () => d.items,
|
|
2060
2293
|
mediaIndices: () => d.mediaIndices,
|
|
@@ -2063,19 +2296,14 @@ var vn = { class: "masonry-feed-shell" }, yn = ["aria-hidden", "inert"], bn = {
|
|
|
2063
2296
|
previewStates: () => d.previewStates,
|
|
2064
2297
|
visibleIndices: () => D.value
|
|
2065
2298
|
});
|
|
2066
|
-
function
|
|
2299
|
+
function le(e) {
|
|
2067
2300
|
let t = W.value.items[e], n = d.items[e]?.postId;
|
|
2068
2301
|
if (!t || t.width <= 0 || t.height <= 0) return {};
|
|
2069
2302
|
let r = n !== void 0 && d.enteringPostIds.has(n), i = n !== void 0 && d.leavingPostIds.has(n), a = r || i ? ve({
|
|
2070
2303
|
containerHeight: Math.max(b.value, H.value.height),
|
|
2071
2304
|
gap: _.value
|
|
2072
2305
|
}) : 0, o = n === void 0 ? 0 : i ? d.removalDelays.get(n) ?? 0 : r ? d.entryDelays.get(n) ?? 0 : 0;
|
|
2073
|
-
return
|
|
2074
|
-
"--masonry-entry-delay": `${o}ms`,
|
|
2075
|
-
width: `${t.width}px`,
|
|
2076
|
-
height: `${t.height}px`,
|
|
2077
|
-
transform: `translate3d(${t.x}px, ${t.y + a}px, 0)`
|
|
2078
|
-
};
|
|
2306
|
+
return J.get(e, t, a, o);
|
|
2079
2307
|
}
|
|
2080
2308
|
function Q() {
|
|
2081
2309
|
let e = p.value;
|
|
@@ -2084,47 +2312,47 @@ var vn = { class: "masonry-feed-shell" }, yn = ["aria-hidden", "inert"], bn = {
|
|
|
2084
2312
|
let t = e.ownerDocument.defaultView?.getComputedStyle(e), n = (Number.parseFloat(t?.paddingTop ?? "") || 0) + (Number.parseFloat(t?.paddingBottom ?? "") || 0);
|
|
2085
2313
|
b.value = Math.max(0, e.clientHeight - n);
|
|
2086
2314
|
let r = h.value;
|
|
2087
|
-
r && (C.value = r.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop,
|
|
2315
|
+
r && (C.value = r.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop, Z());
|
|
2088
2316
|
}
|
|
2089
|
-
function
|
|
2317
|
+
function ue(e) {
|
|
2090
2318
|
let t = e.ownerDocument.documentElement.clientWidth;
|
|
2091
|
-
g.value = e.clientWidth, _.value = Math.min(
|
|
2319
|
+
g.value = e.clientWidth, _.value = Math.min(kn, Math.max(On, t * .0075)), Q();
|
|
2092
2320
|
}
|
|
2093
|
-
function
|
|
2321
|
+
function de(e) {
|
|
2094
2322
|
let t = e.currentTarget;
|
|
2095
|
-
t && (A = t.scrollTop, V.ensurePackedThrough(
|
|
2323
|
+
t && (A = t.scrollTop, V.ensurePackedThrough(z()), ce(), Date.now() >= l && !d.loadMoreLocked && d.infiniteScroll && he(t, d.masonry?.loadMoreThresholdPx) && f("loadMore"));
|
|
2096
2324
|
}
|
|
2097
|
-
function
|
|
2325
|
+
function $() {
|
|
2098
2326
|
let e = p.value;
|
|
2099
2327
|
Date.now() >= l && !d.loadMoreLocked && e && he(e, d.masonry?.loadMoreThresholdPx) && f("loadMore");
|
|
2100
2328
|
}
|
|
2101
|
-
|
|
2102
|
-
e > 0 && e < t && (l = Date.now() +
|
|
2329
|
+
N(() => d.items.length, (e, t) => {
|
|
2330
|
+
e > 0 && e < t && (l = Date.now() + An);
|
|
2103
2331
|
});
|
|
2104
|
-
function
|
|
2332
|
+
function pe() {
|
|
2105
2333
|
return p.value;
|
|
2106
2334
|
}
|
|
2107
|
-
return
|
|
2108
|
-
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]) => {
|
|
2109
2337
|
let n = t?.contentRect.width ?? e.clientWidth;
|
|
2110
|
-
Math.abs(n - g.value) < .5 || (
|
|
2111
|
-
|
|
2338
|
+
Math.abs(n - g.value) < .5 || (F = requestAnimationFrame(() => {
|
|
2339
|
+
F = null, ue(e);
|
|
2112
2340
|
}));
|
|
2113
2341
|
}), j.observe(e)));
|
|
2114
|
-
}),
|
|
2115
|
-
|
|
2116
|
-
}),
|
|
2117
|
-
|
|
2118
|
-
}, { flush: "sync" }),
|
|
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([
|
|
2119
2347
|
H,
|
|
2120
2348
|
W,
|
|
2121
2349
|
() => d.masonry
|
|
2122
|
-
],
|
|
2123
|
-
j?.disconnect(),
|
|
2350
|
+
], Z, { flush: "post" }), S(() => {
|
|
2351
|
+
j?.disconnect(), P?.disconnect(), F !== null && cancelAnimationFrame(F), I !== null && cancelAnimationFrame(I);
|
|
2124
2352
|
}), n({
|
|
2125
|
-
getScrollElement:
|
|
2126
|
-
loadIfNearBottom:
|
|
2127
|
-
}), (n, r) => (w(), s("div",
|
|
2353
|
+
getScrollElement: pe,
|
|
2354
|
+
loadIfNearBottom: $
|
|
2355
|
+
}), (n, r) => (w(), s("div", Tn, [
|
|
2128
2356
|
c("main", {
|
|
2129
2357
|
id: m,
|
|
2130
2358
|
ref_key: "galleryElement",
|
|
@@ -2133,14 +2361,14 @@ var vn = { class: "masonry-feed-shell" }, yn = ["aria-hidden", "inert"], bn = {
|
|
|
2133
2361
|
"data-layout-mode": "masonry",
|
|
2134
2362
|
"aria-hidden": t.suspended || void 0,
|
|
2135
2363
|
inert: t.suspended || void 0,
|
|
2136
|
-
onScrollPassive:
|
|
2364
|
+
onScrollPassive: de
|
|
2137
2365
|
}, [c("section", {
|
|
2138
2366
|
ref_key: "masonryElement",
|
|
2139
2367
|
ref: h,
|
|
2140
2368
|
class: y(["masonry", { "masonry--ready": g.value > 0 }]),
|
|
2141
2369
|
style: x(K.value),
|
|
2142
2370
|
"aria-label": "Media gallery"
|
|
2143
|
-
}, [(w(!0), s(e, null, E(
|
|
2371
|
+
}, [(w(!0), s(e, null, E(ae.value, ({ fetchPriority: e, item: n, index: r }) => (w(), a(bn, {
|
|
2144
2372
|
key: n.postId,
|
|
2145
2373
|
class: "masonry-item",
|
|
2146
2374
|
entering: t.enteringPostIds.has(n.postId),
|
|
@@ -2152,10 +2380,10 @@ var vn = { class: "masonry-feed-shell" }, yn = ["aria-hidden", "inert"], bn = {
|
|
|
2152
2380
|
"in-viewport": ie.value.has(r),
|
|
2153
2381
|
index: r,
|
|
2154
2382
|
item: n,
|
|
2155
|
-
"item-style":
|
|
2383
|
+
"item-style": le(r),
|
|
2156
2384
|
interactive: "",
|
|
2157
2385
|
layout: "masonry",
|
|
2158
|
-
"loaded-count":
|
|
2386
|
+
"loaded-count": Y,
|
|
2159
2387
|
"media-index": t.mediaIndices.get(n.postId) ?? 0,
|
|
2160
2388
|
"preview-state": t.previewStates.get(M(q)(n.postId, t.mediaIndices.get(n.postId) ?? 0)) ?? "loading",
|
|
2161
2389
|
total: t.total,
|
|
@@ -2175,7 +2403,6 @@ var vn = { class: "masonry-feed-shell" }, yn = ["aria-hidden", "inert"], bn = {
|
|
|
2175
2403
|
"index",
|
|
2176
2404
|
"item",
|
|
2177
2405
|
"item-style",
|
|
2178
|
-
"loaded-count",
|
|
2179
2406
|
"media-index",
|
|
2180
2407
|
"preview-state",
|
|
2181
2408
|
"total",
|
|
@@ -2189,8 +2416,8 @@ var vn = { class: "masonry-feed-shell" }, yn = ["aria-hidden", "inert"], bn = {
|
|
|
2189
2416
|
class: "masonry-bottom-space",
|
|
2190
2417
|
"aria-hidden": "true",
|
|
2191
2418
|
style: x({ flex: `0 0 ${t.masonry.bottomSpacePx}px` })
|
|
2192
|
-
}, null, 4)) : o("", !0)], 42,
|
|
2193
|
-
t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && re.value || !t.hasNext && t.canRetryEnd ? (w(), s("div",
|
|
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, {
|
|
2194
2421
|
actions: t.feedFooterActions,
|
|
2195
2422
|
"can-retry-end": t.canRetryEnd,
|
|
2196
2423
|
"feed-footer": t.feedFooter,
|
|
@@ -2213,7 +2440,7 @@ var vn = { class: "masonry-feed-shell" }, yn = ["aria-hidden", "inert"], bn = {
|
|
|
2213
2440
|
"show-load-more",
|
|
2214
2441
|
"state"
|
|
2215
2442
|
])])) : o("", !0),
|
|
2216
|
-
u(
|
|
2443
|
+
u(Qe, {
|
|
2217
2444
|
"content-size": W.value.height,
|
|
2218
2445
|
"controls-id": m,
|
|
2219
2446
|
"scroll-element": p.value,
|
|
@@ -2225,8 +2452,8 @@ var vn = { class: "masonry-feed-shell" }, yn = ["aria-hidden", "inert"], bn = {
|
|
|
2225
2452
|
])
|
|
2226
2453
|
]));
|
|
2227
2454
|
}
|
|
2228
|
-
}),
|
|
2229
|
-
function
|
|
2455
|
+
}), Mn = 300;
|
|
2456
|
+
function Nn(e, t, n) {
|
|
2230
2457
|
let r = e.scrollTop;
|
|
2231
2458
|
if (n || Math.abs(r - t) <= 1) return e.scrollTop = t, Promise.resolve();
|
|
2232
2459
|
e.setAttribute("data-transitioning", "");
|
|
@@ -2234,7 +2461,7 @@ function En(e, t, n) {
|
|
|
2234
2461
|
return new Promise((n) => {
|
|
2235
2462
|
let o = (s) => {
|
|
2236
2463
|
a += 1;
|
|
2237
|
-
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;
|
|
2238
2465
|
if (e.scrollTop = r + (t - r) * u, l < 1) {
|
|
2239
2466
|
requestAnimationFrame(o);
|
|
2240
2467
|
return;
|
|
@@ -2246,7 +2473,7 @@ function En(e, t, n) {
|
|
|
2246
2473
|
}
|
|
2247
2474
|
//#endregion
|
|
2248
2475
|
//#region src/components/ReelAutoAdvanceProgress.vue?vue&type=script&setup=true&lang.ts
|
|
2249
|
-
var
|
|
2476
|
+
var Pn = ["aria-label"], Fn = /* @__PURE__ */ d({
|
|
2250
2477
|
__name: "ReelAutoAdvanceProgress",
|
|
2251
2478
|
props: {
|
|
2252
2479
|
durationMs: {},
|
|
@@ -2264,9 +2491,9 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2264
2491
|
class: "reel-auto-advance-progress",
|
|
2265
2492
|
style: x(a.value),
|
|
2266
2493
|
onAnimationend: n[0] ||= (e) => i("complete")
|
|
2267
|
-
}, null, 36)], 8,
|
|
2494
|
+
}, null, 36)], 8, Pn));
|
|
2268
2495
|
}
|
|
2269
|
-
}),
|
|
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({
|
|
2270
2497
|
__name: "ReelFeed",
|
|
2271
2498
|
props: {
|
|
2272
2499
|
initialPostId: {},
|
|
@@ -2306,31 +2533,31 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2306
2533
|
"retryForward"
|
|
2307
2534
|
],
|
|
2308
2535
|
setup(t, { expose: n, emit: i }) {
|
|
2309
|
-
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(() => {
|
|
2310
2537
|
let e = Math.max(0, h.value - 2), t = Math.min(u.items.length - 1, h.value + 2);
|
|
2311
2538
|
return u.items.slice(e, t + 1).map((t, n) => ({
|
|
2312
2539
|
fetchPriority: e + n === h.value ? "high" : "low",
|
|
2313
2540
|
index: e + n,
|
|
2314
2541
|
item: t
|
|
2315
2542
|
}));
|
|
2316
|
-
}),
|
|
2317
|
-
let e =
|
|
2543
|
+
}), P = r(() => u.items[h.value]?.postId), F = r(() => u.items[h.value]), I = r(() => {
|
|
2544
|
+
let e = P.value;
|
|
2318
2545
|
return e === void 0 ? 0 : u.mediaIndices.get(e) ?? 0;
|
|
2319
|
-
}),
|
|
2320
|
-
let e =
|
|
2321
|
-
return e === void 0 ? "loading" : u.previewStates.get(q(e,
|
|
2322
|
-
}),
|
|
2323
|
-
|
|
2324
|
-
|
|
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,
|
|
2325
2552
|
u.items.length,
|
|
2326
2553
|
u.loadMoreLocked,
|
|
2327
2554
|
u.reelAutoAdvance.enabled,
|
|
2328
2555
|
u.reelAutoAdvance.includePostItems,
|
|
2329
2556
|
u.reelAutoAdvance.intervalMs
|
|
2330
2557
|
].join(":")), U = r(() => {
|
|
2331
|
-
let e =
|
|
2558
|
+
let e = F.value, t = !!(e && u.reelAutoAdvance.includePostItems && I.value < G(e).length - 1), n = u.reelAutoAdvance.intervalMs / 1e3;
|
|
2332
2559
|
return `Auto advance to the next ${t ? "post item" : "post"} in ${n}s`;
|
|
2333
|
-
}), te = r(() => u.reelAutoAdvance.enabled && u.reelForward.status === "idle" &&
|
|
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.");
|
|
2334
2561
|
function J(e) {
|
|
2335
2562
|
return { gridRow: `${e + 1}` };
|
|
2336
2563
|
}
|
|
@@ -2365,22 +2592,22 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2365
2592
|
function Z(e) {
|
|
2366
2593
|
_.value = e, f.value?.toggleAttribute("data-resizing", e);
|
|
2367
2594
|
}
|
|
2368
|
-
function
|
|
2595
|
+
function ce() {
|
|
2369
2596
|
let e = f.value;
|
|
2370
2597
|
Date.now() >= l && !u.loadMoreLocked && e && he(e) && d("loadMore");
|
|
2371
2598
|
}
|
|
2372
|
-
|
|
2373
|
-
e > 0 && e < t && (l = Date.now() +
|
|
2599
|
+
N(() => u.items.length, (e, t) => {
|
|
2600
|
+
e > 0 && e < t && (l = Date.now() + Vn);
|
|
2374
2601
|
});
|
|
2375
|
-
function
|
|
2376
|
-
let t =
|
|
2602
|
+
function le(e) {
|
|
2603
|
+
let t = F.value;
|
|
2377
2604
|
if (!t) return !1;
|
|
2378
2605
|
let n = G(t).length;
|
|
2379
2606
|
if (n <= 1) return !1;
|
|
2380
|
-
let r = (
|
|
2607
|
+
let r = (I.value + e + n) % n;
|
|
2381
2608
|
return d("mediaChange", t.postId, r), !0;
|
|
2382
2609
|
}
|
|
2383
|
-
function
|
|
2610
|
+
function Q(e) {
|
|
2384
2611
|
let t = h.value + e;
|
|
2385
2612
|
return !f.value || t < 0 || t >= u.items.length ? !1 : (pe(t), !0);
|
|
2386
2613
|
}
|
|
@@ -2395,7 +2622,7 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2395
2622
|
let t = f.value;
|
|
2396
2623
|
if (!t) return Promise.resolve();
|
|
2397
2624
|
let n = e * (b || t.clientHeight);
|
|
2398
|
-
return h.value = e,
|
|
2625
|
+
return h.value = e, Nn(t, n, de());
|
|
2399
2626
|
}
|
|
2400
2627
|
function pe(e) {
|
|
2401
2628
|
$(e);
|
|
@@ -2405,14 +2632,14 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2405
2632
|
return t < 0 || t === h.value ? !1 : (await $(t), !0);
|
|
2406
2633
|
}
|
|
2407
2634
|
async function ge(e) {
|
|
2408
|
-
return
|
|
2635
|
+
return le(e) ? (de() || await new Promise((e) => setTimeout(e, Bn)), !0) : !1;
|
|
2409
2636
|
}
|
|
2410
2637
|
function _e() {
|
|
2411
2638
|
if (!u.reelAutoAdvance.enabled) return;
|
|
2412
|
-
let e =
|
|
2639
|
+
let e = F.value;
|
|
2413
2640
|
if (!e) return;
|
|
2414
|
-
if (u.reelAutoAdvance.includePostItems &&
|
|
2415
|
-
d("mediaChange", e.postId,
|
|
2641
|
+
if (u.reelAutoAdvance.includePostItems && I.value < G(e).length - 1) {
|
|
2642
|
+
d("mediaChange", e.postId, I.value + 1);
|
|
2416
2643
|
return;
|
|
2417
2644
|
}
|
|
2418
2645
|
let t = h.value + 1, n = u.items[t];
|
|
@@ -2423,14 +2650,14 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2423
2650
|
u.reelAutoAdvance.includePostItems && (u.mediaIndices.get(n.postId) ?? 0) !== 0 && d("mediaChange", n.postId, 0), pe(t);
|
|
2424
2651
|
}
|
|
2425
2652
|
function ve(e, t) {
|
|
2426
|
-
!u.reelAutoAdvance.enabled || e !==
|
|
2653
|
+
!u.reelAutoAdvance.enabled || e !== P.value || t !== I.value || !B.value || _e();
|
|
2427
2654
|
}
|
|
2428
|
-
return
|
|
2655
|
+
return N(f, (e) => {
|
|
2429
2656
|
T?.disconnect(), T = null, e && (b = e.clientHeight, !(typeof ResizeObserver > "u") && (T = new ResizeObserver(oe), T.observe(e)));
|
|
2430
|
-
}),
|
|
2657
|
+
}), N(() => u.items.length, async (e) => {
|
|
2431
2658
|
let t = u.initialPostId, n = t == null ? -1 : u.items.findIndex(({ postId: e }) => e === t);
|
|
2432
2659
|
h.value = n >= 0 ? n : Math.min(h.value, Math.max(0, e - 1)), await v(), oe();
|
|
2433
|
-
}), P
|
|
2660
|
+
}), N(P, (e) => {
|
|
2434
2661
|
e !== void 0 && d("activeChange", e);
|
|
2435
2662
|
}, { immediate: !0 }), C(() => {
|
|
2436
2663
|
window.addEventListener("resize", X), window.addEventListener("orientationchange", X), m >= 0 && v(oe);
|
|
@@ -2438,10 +2665,10 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2438
2665
|
window.removeEventListener("resize", X), window.removeEventListener("orientationchange", X), T?.disconnect(), D !== null && cancelAnimationFrame(D), O !== null && clearTimeout(O);
|
|
2439
2666
|
}), n({
|
|
2440
2667
|
activeIndex: h,
|
|
2441
|
-
activePostId:
|
|
2442
|
-
changeActiveMedia:
|
|
2443
|
-
loadIfNearBottom:
|
|
2444
|
-
moveActivePost:
|
|
2668
|
+
activePostId: P,
|
|
2669
|
+
changeActiveMedia: le,
|
|
2670
|
+
loadIfNearBottom: ce,
|
|
2671
|
+
moveActivePost: Q,
|
|
2445
2672
|
navigateToItem: ue,
|
|
2446
2673
|
transitionActiveMedia: ge,
|
|
2447
2674
|
transitionActivePost: me
|
|
@@ -2452,13 +2679,13 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2452
2679
|
}]),
|
|
2453
2680
|
"data-layout-mode": "reel"
|
|
2454
2681
|
}, [
|
|
2455
|
-
t.cardHeader &&
|
|
2682
|
+
t.cardHeader && F.value && t.reelForward.status === "idle" ? (w(), a(vt, {
|
|
2456
2683
|
key: 0,
|
|
2457
2684
|
index: h.value,
|
|
2458
|
-
item:
|
|
2685
|
+
item: F.value,
|
|
2459
2686
|
layout: "reel",
|
|
2460
2687
|
"loaded-count": t.items.length,
|
|
2461
|
-
"media-index":
|
|
2688
|
+
"media-index": I.value,
|
|
2462
2689
|
"media-source": t.mediaSource,
|
|
2463
2690
|
placement: "header",
|
|
2464
2691
|
region: t.cardHeader,
|
|
@@ -2474,19 +2701,19 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2474
2701
|
"style",
|
|
2475
2702
|
"total"
|
|
2476
2703
|
])) : o("", !0),
|
|
2477
|
-
c("div",
|
|
2704
|
+
c("div", In, [c("div", {
|
|
2478
2705
|
ref_key: "galleryElement",
|
|
2479
2706
|
ref: f,
|
|
2480
2707
|
class: "gallery-shell reel-feed",
|
|
2481
|
-
"data-active-post-id":
|
|
2482
|
-
"data-active-media-index":
|
|
2708
|
+
"data-active-post-id": P.value,
|
|
2709
|
+
"data-active-media-index": I.value,
|
|
2483
2710
|
onScrollPassive: ae
|
|
2484
2711
|
}, [t.reelForward.status === "idle" ? (w(), s("section", {
|
|
2485
2712
|
key: 1,
|
|
2486
2713
|
class: "reel-track",
|
|
2487
2714
|
style: x(j.value),
|
|
2488
2715
|
"aria-label": "Media gallery"
|
|
2489
|
-
}, [(w(!0), s(e, null, E(
|
|
2716
|
+
}, [(w(!0), s(e, null, E(ee.value, ({ fetchPriority: e, item: n, index: i }) => (w(), a(bn, {
|
|
2490
2717
|
key: n.postId,
|
|
2491
2718
|
active: i === h.value && !g.value,
|
|
2492
2719
|
"advance-on-media-end": u.reelAutoAdvance.enabled && i === h.value,
|
|
@@ -2543,7 +2770,7 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2543
2770
|
type: "button",
|
|
2544
2771
|
disabled: t.loadMoreLocked,
|
|
2545
2772
|
onClick: r[0] ||= (e) => d("retryForward")
|
|
2546
|
-
}, A(K.value ? "Load more" : "Retry"), 9,
|
|
2773
|
+
}, A(K.value ? "Load more" : "Retry"), 9, zn)) : o("", !0)], 8, Rn)), t.reelForward.status === "idle" ? (w(), a(fe, {
|
|
2547
2774
|
key: 2,
|
|
2548
2775
|
actions: t.feedFooterActions,
|
|
2549
2776
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2566,19 +2793,19 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2566
2793
|
"load-more-locked",
|
|
2567
2794
|
"show-load-more",
|
|
2568
2795
|
"state"
|
|
2569
|
-
])) : o("", !0)], 40,
|
|
2796
|
+
])) : o("", !0)], 40, Ln), c("div", {
|
|
2570
2797
|
ref_key: "reelControlsElement",
|
|
2571
2798
|
ref: p,
|
|
2572
2799
|
class: "reel-media-controls-host",
|
|
2573
2800
|
"data-test": "reel-media-controls-host"
|
|
2574
2801
|
}, null, 512)]),
|
|
2575
|
-
t.cardFooter &&
|
|
2802
|
+
t.cardFooter && F.value && t.reelForward.status === "idle" ? (w(), a(vt, {
|
|
2576
2803
|
key: 1,
|
|
2577
2804
|
index: h.value,
|
|
2578
|
-
item:
|
|
2805
|
+
item: F.value,
|
|
2579
2806
|
layout: "reel",
|
|
2580
2807
|
"loaded-count": t.items.length,
|
|
2581
|
-
"media-index":
|
|
2808
|
+
"media-index": I.value,
|
|
2582
2809
|
"media-source": t.mediaSource,
|
|
2583
2810
|
placement: "footer",
|
|
2584
2811
|
region: t.cardFooter,
|
|
@@ -2594,7 +2821,7 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2594
2821
|
"style",
|
|
2595
2822
|
"total"
|
|
2596
2823
|
])) : o("", !0),
|
|
2597
|
-
te.value ? (w(), a(
|
|
2824
|
+
te.value ? (w(), a(Fn, {
|
|
2598
2825
|
key: V.value,
|
|
2599
2826
|
"duration-ms": t.reelAutoAdvance.intervalMs,
|
|
2600
2827
|
label: U.value,
|
|
@@ -2602,16 +2829,16 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2602
2829
|
}, null, 8, ["duration-ms", "label"])) : o("", !0)
|
|
2603
2830
|
], 2));
|
|
2604
2831
|
}
|
|
2605
|
-
}),
|
|
2832
|
+
}), Un = ["data-info-sheet-open", "data-info-sheet-mode"], Wn = ["aria-hidden", "inert"], Gn = {
|
|
2606
2833
|
key: 0,
|
|
2607
2834
|
class: "reel-info-sheet-layer",
|
|
2608
2835
|
"data-test": "reel-info-sheet"
|
|
2609
|
-
},
|
|
2836
|
+
}, Kn = [
|
|
2610
2837
|
"role",
|
|
2611
2838
|
"aria-modal",
|
|
2612
2839
|
"tabindex",
|
|
2613
2840
|
"data-active-post-id"
|
|
2614
|
-
],
|
|
2841
|
+
], qn = /* @__PURE__ */ d({
|
|
2615
2842
|
__name: "ReelLayout",
|
|
2616
2843
|
props: {
|
|
2617
2844
|
forwardIndex: { default: null },
|
|
@@ -2689,28 +2916,28 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2689
2916
|
function M() {
|
|
2690
2917
|
p.value?.loadIfNearBottom();
|
|
2691
2918
|
}
|
|
2692
|
-
function
|
|
2919
|
+
function ee(e) {
|
|
2693
2920
|
return p.value?.moveActivePost(e) ?? !1;
|
|
2694
2921
|
}
|
|
2695
|
-
function
|
|
2922
|
+
function F(e, t) {
|
|
2696
2923
|
return p.value?.navigateToItem(e, t) ?? !1;
|
|
2697
2924
|
}
|
|
2698
|
-
function
|
|
2925
|
+
function I(e) {
|
|
2699
2926
|
return p.value?.transitionActiveMedia(e) ?? Promise.resolve(!1);
|
|
2700
2927
|
}
|
|
2701
|
-
function
|
|
2928
|
+
function L(e) {
|
|
2702
2929
|
return p.value?.transitionActivePost(e) ?? Promise.resolve(!1);
|
|
2703
2930
|
}
|
|
2704
|
-
function
|
|
2931
|
+
function R(e, t) {
|
|
2705
2932
|
d("error", e, t);
|
|
2706
2933
|
}
|
|
2707
|
-
function
|
|
2934
|
+
function z(e, t) {
|
|
2708
2935
|
d("mediaChange", e, t);
|
|
2709
2936
|
}
|
|
2710
|
-
function
|
|
2937
|
+
function B(e, t) {
|
|
2711
2938
|
d("ready", e, t);
|
|
2712
2939
|
}
|
|
2713
|
-
return
|
|
2940
|
+
return N(() => ({
|
|
2714
2941
|
overlay: l.infoSheetOverlay,
|
|
2715
2942
|
visible: E.value
|
|
2716
2943
|
}), async (e, t) => {
|
|
@@ -2727,10 +2954,10 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2727
2954
|
}), t({
|
|
2728
2955
|
changeActiveMedia: j,
|
|
2729
2956
|
loadIfNearBottom: M,
|
|
2730
|
-
moveActivePost:
|
|
2731
|
-
navigateToItem:
|
|
2732
|
-
transitionActiveMedia:
|
|
2733
|
-
transitionActivePost:
|
|
2957
|
+
moveActivePost: ee,
|
|
2958
|
+
navigateToItem: F,
|
|
2959
|
+
transitionActiveMedia: I,
|
|
2960
|
+
transitionActivePost: L
|
|
2734
2961
|
}), (t, r) => (w(), s("section", {
|
|
2735
2962
|
class: y(["reel-layout", `reel-layout--${e.infoSheetOverlay ? "overlay" : "layout"}`]),
|
|
2736
2963
|
"data-info-sheet-open": E.value || void 0,
|
|
@@ -2739,7 +2966,7 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2739
2966
|
class: "reel-layout-main",
|
|
2740
2967
|
"aria-hidden": e.infoSheetOverlay && E.value || void 0,
|
|
2741
2968
|
inert: e.infoSheetOverlay && E.value || void 0
|
|
2742
|
-
}, [u(
|
|
2969
|
+
}, [u(Hn, {
|
|
2743
2970
|
ref_key: "reelFeed",
|
|
2744
2971
|
ref: p,
|
|
2745
2972
|
"can-retry-end": e.canRetryEnd,
|
|
@@ -2764,11 +2991,11 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2764
2991
|
state: e.state,
|
|
2765
2992
|
total: e.total,
|
|
2766
2993
|
onActiveChange: r[0] ||= (e) => d("activeChange", e),
|
|
2767
|
-
onError:
|
|
2994
|
+
onError: R,
|
|
2768
2995
|
onMediaError: r[1] ||= (e, t) => d("mediaError", e, t),
|
|
2769
2996
|
onLoadMore: r[2] ||= (e) => d("loadMore"),
|
|
2770
|
-
onMediaChange:
|
|
2771
|
-
onReady:
|
|
2997
|
+
onMediaChange: z,
|
|
2998
|
+
onReady: B,
|
|
2772
2999
|
onRetryEnd: r[3] ||= (e) => d("retryEnd"),
|
|
2773
3000
|
onRetryForward: r[4] ||= (e) => d("retryForward"),
|
|
2774
3001
|
onReelAudioChange: r[5] ||= (e) => d("reelAudioChange", e)
|
|
@@ -2794,8 +3021,8 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2794
3021
|
"reel-forward",
|
|
2795
3022
|
"state",
|
|
2796
3023
|
"total"
|
|
2797
|
-
])], 8,
|
|
2798
|
-
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", {
|
|
2799
3026
|
ref_key: "sheetElement",
|
|
2800
3027
|
ref: m,
|
|
2801
3028
|
class: "reel-info-sheet",
|
|
@@ -2804,25 +3031,87 @@ var Dn = ["aria-label"], On = /* @__PURE__ */ d({
|
|
|
2804
3031
|
"aria-modal": e.infoSheetOverlay ? "true" : void 0,
|
|
2805
3032
|
tabindex: e.infoSheetOverlay ? -1 : void 0,
|
|
2806
3033
|
"data-active-post-id": x.value?.postId
|
|
2807
|
-
}, [(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)]),
|
|
2808
3035
|
_: 1
|
|
2809
|
-
})], 10,
|
|
3036
|
+
})], 10, Un));
|
|
2810
3037
|
}
|
|
2811
|
-
}),
|
|
2812
|
-
function
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
return
|
|
3038
|
+
}), Jn = 250, Yn = Array.prototype.forEach, Xn = Array.prototype[Symbol.iterator];
|
|
3039
|
+
function Zn(e) {
|
|
3040
|
+
try {
|
|
3041
|
+
if (!Reflect.has(e, "forEach")) return !1;
|
|
3042
|
+
let t = j(e);
|
|
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;
|
|
3044
|
+
} catch {
|
|
3045
|
+
return !1;
|
|
3046
|
+
}
|
|
3047
|
+
}
|
|
3048
|
+
function Qn(e) {
|
|
3049
|
+
try {
|
|
3050
|
+
if (!m(e) || h(e) || _(e)) return !1;
|
|
3051
|
+
let t = j(e);
|
|
3052
|
+
if (T(t) !== e) return !1;
|
|
3053
|
+
let n = Object.getOwnPropertyDescriptor(t, "postId")?.value;
|
|
3054
|
+
return typeof n == "string" || typeof n == "number";
|
|
3055
|
+
} catch {
|
|
3056
|
+
return !1;
|
|
3057
|
+
}
|
|
3058
|
+
}
|
|
3059
|
+
function $n(e, t) {
|
|
3060
|
+
let n = !1;
|
|
3061
|
+
return {
|
|
3062
|
+
items: e,
|
|
3063
|
+
positions: r(() => {
|
|
3064
|
+
let r = /* @__PURE__ */ new Map();
|
|
3065
|
+
return n = !0, e.forEach((e, i) => {
|
|
3066
|
+
let a = e.postId;
|
|
3067
|
+
r.has(a) || r.set(a, t + i), Qn(e) || (n = !1);
|
|
3068
|
+
}), r;
|
|
3069
|
+
}),
|
|
3070
|
+
canRetain: () => n
|
|
3071
|
+
};
|
|
3072
|
+
}
|
|
3073
|
+
function er(e) {
|
|
3074
|
+
let t = oe(e), n = [], i = [], a = r(() => {
|
|
3075
|
+
let t = /* @__PURE__ */ new Map(), n = e.items;
|
|
3076
|
+
return Reflect.has(n, "forEach"), n.forEach((e, n) => {
|
|
2819
3077
|
let r = e.postId;
|
|
2820
3078
|
t.has(r) || t.set(r, n);
|
|
2821
3079
|
}), t;
|
|
2822
|
-
}),
|
|
3080
|
+
}), o = r(() => {
|
|
3081
|
+
let r = e.items, o = () => (n = [], i = [], [a]);
|
|
3082
|
+
if (!Zn(r)) return o();
|
|
3083
|
+
let s = t.value, c = s.length >= n.length;
|
|
3084
|
+
for (let e = 0; e < s.length; e += 1) {
|
|
3085
|
+
if (s[e] === void 0) return o();
|
|
3086
|
+
c && e < n.length && n[e] !== s[e] && (c = !1);
|
|
3087
|
+
}
|
|
3088
|
+
let l = c ? Math.floor(n.length / Jn) : 0, u = [];
|
|
3089
|
+
for (let e = 0; e < l; e += 1) {
|
|
3090
|
+
let t = i[e];
|
|
3091
|
+
u.push(t.canRetain() ? t : $n(t.items, e * Jn));
|
|
3092
|
+
}
|
|
3093
|
+
for (let e = l * Jn; e < s.length; e += Jn) u.push($n(Object.freeze(s.slice(e, e + Jn)), e));
|
|
3094
|
+
return n = s, i = u, i.map((e) => e.positions);
|
|
3095
|
+
});
|
|
3096
|
+
return (e) => {
|
|
3097
|
+
for (let t of o.value) {
|
|
3098
|
+
let n = t.value.get(e);
|
|
3099
|
+
if (n !== void 0) return n;
|
|
3100
|
+
}
|
|
3101
|
+
return -1;
|
|
3102
|
+
};
|
|
2823
3103
|
}
|
|
2824
|
-
|
|
2825
|
-
|
|
3104
|
+
//#endregion
|
|
3105
|
+
//#region src/core/mediaLifecycle.ts
|
|
3106
|
+
var tr = /* @__PURE__ */ new WeakMap();
|
|
3107
|
+
function nr(e, t) {
|
|
3108
|
+
if (typeof t == "number" && Number.isNaN(t)) return -1;
|
|
3109
|
+
if (!m(e) || !m(e.items)) return e.items.findIndex((e) => e.postId === t);
|
|
3110
|
+
let n = tr.get(e);
|
|
3111
|
+
return n || (n = er(e), tr.set(e, n)), n(t);
|
|
3112
|
+
}
|
|
3113
|
+
function rr(e, t, n, r, i) {
|
|
3114
|
+
let a = nr(e, t), o = e.items[a];
|
|
2826
3115
|
if (!o) return null;
|
|
2827
3116
|
let s = K(o, n), c = re(o, s);
|
|
2828
3117
|
return {
|
|
@@ -2837,8 +3126,8 @@ function Un(e, t, n, r, i) {
|
|
|
2837
3126
|
postIndex: a
|
|
2838
3127
|
};
|
|
2839
3128
|
}
|
|
2840
|
-
function
|
|
2841
|
-
|
|
3129
|
+
function ir(e, t) {
|
|
3130
|
+
N(() => {
|
|
2842
3131
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null;
|
|
2843
3132
|
return {
|
|
2844
3133
|
mediaIndex: t === null ? 0 : e.mediaIndices.get(t) ?? 0,
|
|
@@ -2847,17 +3136,17 @@ function Wn(e, t) {
|
|
|
2847
3136
|
};
|
|
2848
3137
|
}, (n, r) => {
|
|
2849
3138
|
if (n.postId === null || n.postId === r?.postId && n.mediaIndex === r.mediaIndex && n.origin === r.origin) return;
|
|
2850
|
-
let i =
|
|
3139
|
+
let i = rr(e, n.postId, n.mediaIndex, "reel", n.origin);
|
|
2851
3140
|
i && t(i);
|
|
2852
3141
|
}, { flush: "sync" });
|
|
2853
3142
|
}
|
|
2854
3143
|
//#endregion
|
|
2855
3144
|
//#region src/components/useMediaLifecycle.ts
|
|
2856
|
-
function
|
|
3145
|
+
function ar() {
|
|
2857
3146
|
return k(O(/* @__PURE__ */ new Map()));
|
|
2858
3147
|
}
|
|
2859
|
-
function
|
|
2860
|
-
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();
|
|
2861
3150
|
function u() {
|
|
2862
3151
|
n.clear(), l.clear(), i.value = O(/* @__PURE__ */ new Map()), a.value = O(/* @__PURE__ */ new Map()), o.value = O(/* @__PURE__ */ new Map());
|
|
2863
3152
|
}
|
|
@@ -2866,7 +3155,7 @@ function Kn(e, t) {
|
|
|
2866
3155
|
e.value.set(i, r);
|
|
2867
3156
|
}
|
|
2868
3157
|
function f(t, n, r, i) {
|
|
2869
|
-
return
|
|
3158
|
+
return rr(e, t, n, r, i);
|
|
2870
3159
|
}
|
|
2871
3160
|
function p(e, n, r, i) {
|
|
2872
3161
|
let a = f(e, n, r, i);
|
|
@@ -2906,7 +3195,7 @@ function Kn(e, t) {
|
|
|
2906
3195
|
function x(e, t) {
|
|
2907
3196
|
b(e, t, "masonry", null);
|
|
2908
3197
|
}
|
|
2909
|
-
return
|
|
3198
|
+
return ir(e, t.reelChange), N(() => {
|
|
2910
3199
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null, n = t === null ? 0 : e.mediaIndices.get(t) ?? 0;
|
|
2911
3200
|
return {
|
|
2912
3201
|
mediaIndex: n,
|
|
@@ -2932,16 +3221,16 @@ function Kn(e, t) {
|
|
|
2932
3221
|
}
|
|
2933
3222
|
//#endregion
|
|
2934
3223
|
//#region src/core/reelEscapeStack.ts
|
|
2935
|
-
var
|
|
2936
|
-
function
|
|
2937
|
-
return
|
|
2938
|
-
let t =
|
|
2939
|
-
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);
|
|
2940
3229
|
};
|
|
2941
3230
|
}
|
|
2942
|
-
function
|
|
3231
|
+
function lr(e) {
|
|
2943
3232
|
if (!e.isActive()) return !1;
|
|
2944
|
-
let t =
|
|
3233
|
+
let t = sr.filter((e) => e.isActive()), n = e.element();
|
|
2945
3234
|
return n !== null && t.some((t) => {
|
|
2946
3235
|
if (t === e) return !1;
|
|
2947
3236
|
let r = t.element();
|
|
@@ -2957,14 +3246,14 @@ function Yn(e) {
|
|
|
2957
3246
|
}
|
|
2958
3247
|
//#endregion
|
|
2959
3248
|
//#region src/components/useReelKeyboard.ts
|
|
2960
|
-
function
|
|
3249
|
+
function ur(e) {
|
|
2961
3250
|
let t = {
|
|
2962
3251
|
element: e.element,
|
|
2963
3252
|
isActive: () => e.state.layout === "reel" || e.state.reelOrigin === "masonry"
|
|
2964
3253
|
}, n = null;
|
|
2965
3254
|
function r(n) {
|
|
2966
3255
|
let r = t.isActive();
|
|
2967
|
-
if (n.key === "Escape" && r && !
|
|
3256
|
+
if (n.key === "Escape" && r && !lr(t)) return;
|
|
2968
3257
|
if (n.key === "Escape" && e.state.reelOrigin === "masonry") {
|
|
2969
3258
|
n.preventDefault(), e.state.reelInfoSheetOverlay && e.state.reelInfoSheet.enabled && e.setReelInfoSheet(!1), e.closeMasonryReel();
|
|
2970
3259
|
return;
|
|
@@ -2984,14 +3273,14 @@ function Xn(e) {
|
|
|
2984
3273
|
a !== 0 && e.reelRenderer()?.changeActiveMedia?.(a) && n.preventDefault();
|
|
2985
3274
|
}
|
|
2986
3275
|
C(() => {
|
|
2987
|
-
n =
|
|
3276
|
+
n = cr(t), window.addEventListener("keydown", r);
|
|
2988
3277
|
}), S(() => {
|
|
2989
3278
|
window.removeEventListener("keydown", r), n?.(), n = null;
|
|
2990
3279
|
});
|
|
2991
3280
|
}
|
|
2992
3281
|
//#endregion
|
|
2993
3282
|
//#region src/components/VibeSurface.vue?vue&type=script&setup=true&lang.ts
|
|
2994
|
-
var
|
|
3283
|
+
var dr = 35, fr = 420, pr = /* @__PURE__ */ d({
|
|
2995
3284
|
__name: "VibeSurface",
|
|
2996
3285
|
props: {
|
|
2997
3286
|
canRetryEnd: { type: Boolean },
|
|
@@ -3021,13 +3310,13 @@ var Zn = 35, Qn = 420, $n = /* @__PURE__ */ d({
|
|
|
3021
3310
|
"retryForward"
|
|
3022
3311
|
],
|
|
3023
3312
|
setup(t, { expose: i, emit: c }) {
|
|
3024
|
-
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:
|
|
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, {
|
|
3025
3314
|
error: (e) => d("mediaError", e),
|
|
3026
3315
|
fullyVisible: (e) => d("mediaFullyVisible", e),
|
|
3027
3316
|
ready: (e) => d("mediaReady", e),
|
|
3028
3317
|
reelChange: (e) => d("reelMediaChange", e),
|
|
3029
3318
|
visible: (e) => d("mediaVisible", e)
|
|
3030
|
-
}),
|
|
3319
|
+
}), B = new Set(Y(l.state.items)), V = null, H = null, U = !1;
|
|
3031
3320
|
function te() {
|
|
3032
3321
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
3033
3322
|
}
|
|
@@ -3070,20 +3359,20 @@ var Zn = 35, Qn = 420, $n = /* @__PURE__ */ d({
|
|
|
3070
3359
|
let t = h.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [];
|
|
3071
3360
|
return Array.from(t).find((t) => t.dataset.postId === String(e)) ?? null;
|
|
3072
3361
|
}
|
|
3073
|
-
function
|
|
3362
|
+
function ce(e, t) {
|
|
3074
3363
|
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || te()) return 0;
|
|
3075
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)));
|
|
3076
3365
|
if (i.length === 0) return 0;
|
|
3077
|
-
let a = new Map(x.value), o = t?.staggerMs ??
|
|
3366
|
+
let a = new Map(x.value), o = t?.staggerMs ?? dr;
|
|
3078
3367
|
return i.forEach((e, t) => {
|
|
3079
3368
|
a.set(e, t * o);
|
|
3080
|
-
}), _.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;
|
|
3081
3370
|
}
|
|
3082
|
-
function
|
|
3371
|
+
function le() {
|
|
3083
3372
|
b.value = /* @__PURE__ */ new Set(), x.value = /* @__PURE__ */ new Map();
|
|
3084
3373
|
}
|
|
3085
|
-
async function
|
|
3086
|
-
if (t.aborted ||
|
|
3374
|
+
async function Q(e, t) {
|
|
3375
|
+
if (t.aborted || ce(e, { staggerMs: 0 }) === 0 || (await v(), t.aborted)) return;
|
|
3087
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) ?? []));
|
|
3088
3377
|
await new Promise((e) => {
|
|
3089
3378
|
let n = () => {
|
|
@@ -3107,45 +3396,45 @@ var Zn = 35, Qn = 420, $n = /* @__PURE__ */ d({
|
|
|
3107
3396
|
e !== null && ue(e, t);
|
|
3108
3397
|
});
|
|
3109
3398
|
}
|
|
3110
|
-
return
|
|
3399
|
+
return ur({
|
|
3111
3400
|
closeMasonryReel: de,
|
|
3112
3401
|
element: () => h.value,
|
|
3113
3402
|
isReelLeaving: () => g.value,
|
|
3114
3403
|
reelRenderer: () => p.value,
|
|
3115
3404
|
setReelInfoSheet: (e) => d("reelInfoSheetChange", e),
|
|
3116
3405
|
state: l.state
|
|
3117
|
-
}),
|
|
3406
|
+
}), N(() => {
|
|
3118
3407
|
let e = l.state.items;
|
|
3119
3408
|
return [e, e.length];
|
|
3120
3409
|
}, ([e]) => {
|
|
3121
|
-
let t = Y(e), n = t.filter((e) => !
|
|
3122
|
-
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;
|
|
3123
3412
|
let i = /* @__PURE__ */ new Map();
|
|
3124
3413
|
t.forEach((e) => {
|
|
3125
3414
|
let t = y.value.get(e);
|
|
3126
3415
|
t !== void 0 && i.set(e, t);
|
|
3127
3416
|
}), n.forEach((e, t) => {
|
|
3128
|
-
i.set(e, t *
|
|
3417
|
+
i.set(e, t * dr);
|
|
3129
3418
|
}), y.value = i, _.value = new Set([..._.value, ...n]), W();
|
|
3130
3419
|
}, { flush: "sync" }), S(() => {
|
|
3131
3420
|
V !== null && cancelAnimationFrame(V);
|
|
3132
3421
|
}), i({
|
|
3133
|
-
animateItemRemoval:
|
|
3134
|
-
cancelItemRemoval:
|
|
3422
|
+
animateItemRemoval: Q,
|
|
3423
|
+
cancelItemRemoval: le,
|
|
3135
3424
|
changeActiveReelMedia: q,
|
|
3136
3425
|
getAutoScrollElement: ae,
|
|
3137
3426
|
loadIfNearBottom: re,
|
|
3138
3427
|
moveActiveReelPost: ie,
|
|
3139
3428
|
navigateToReelItem: J,
|
|
3140
|
-
resetMediaLifecycle:
|
|
3141
|
-
startItemRemoval:
|
|
3429
|
+
resetMediaLifecycle: z,
|
|
3430
|
+
startItemRemoval: ce,
|
|
3142
3431
|
transitionActiveReelMedia: (e) => p.value?.transitionActiveMedia?.(e) ?? Promise.resolve(!1),
|
|
3143
3432
|
transitionActiveReelPost: (e) => p.value?.transitionActivePost?.(e) ?? Promise.resolve(!1)
|
|
3144
3433
|
}), (r, i) => (w(), s("div", {
|
|
3145
3434
|
ref_key: "surfaceElement",
|
|
3146
3435
|
ref: h,
|
|
3147
3436
|
class: "vibe-surface"
|
|
3148
|
-
}, [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, {
|
|
3149
3438
|
key: 0,
|
|
3150
3439
|
ref_key: "reelRenderer",
|
|
3151
3440
|
ref: p,
|
|
@@ -3170,7 +3459,7 @@ var Zn = 35, Qn = 420, $n = /* @__PURE__ */ d({
|
|
|
3170
3459
|
"info-sheet-overlay": t.state.reelInfoSheetOverlay,
|
|
3171
3460
|
"next-page-error": !!t.state.nextPageError,
|
|
3172
3461
|
origin: "reel",
|
|
3173
|
-
"preview-states": M(
|
|
3462
|
+
"preview-states": M(R),
|
|
3174
3463
|
"reel-auto-advance": t.state.reelAutoAdvance,
|
|
3175
3464
|
"reel-audio-state": t.reelAudioState,
|
|
3176
3465
|
"reel-forward": t.state.reelForward,
|
|
@@ -3178,11 +3467,11 @@ var Zn = 35, Qn = 420, $n = /* @__PURE__ */ d({
|
|
|
3178
3467
|
total: t.state.total,
|
|
3179
3468
|
onActiveChange: i[0] ||= (e) => d("activeReelChange", e),
|
|
3180
3469
|
onCloseInfoSheet: i[1] ||= (e) => d("reelInfoSheetChange", !1),
|
|
3181
|
-
onError: M(
|
|
3470
|
+
onError: M(ee),
|
|
3182
3471
|
onMediaError: i[2] ||= (e, t) => M(E)(e, t, "reel"),
|
|
3183
3472
|
onLoadMore: i[3] ||= (e) => d("loadMore"),
|
|
3184
3473
|
onMediaChange: ne,
|
|
3185
|
-
onReady: M(
|
|
3474
|
+
onReady: M(F),
|
|
3186
3475
|
onRetryEnd: i[4] ||= (e) => d("retryEnd"),
|
|
3187
3476
|
onRetryForward: i[5] ||= (e) => d("retryForward"),
|
|
3188
3477
|
onReelAudioChange: i[6] ||= (e) => d("reelAudioChange", e)
|
|
@@ -3199,7 +3488,7 @@ var Zn = 35, Qn = 420, $n = /* @__PURE__ */ d({
|
|
|
3199
3488
|
"can-retry-end",
|
|
3200
3489
|
"feed-footer",
|
|
3201
3490
|
"state"
|
|
3202
|
-
])) : (w(), s(e, { key: 2 }, [u(
|
|
3491
|
+
])) : (w(), s(e, { key: 2 }, [u(jn, {
|
|
3203
3492
|
ref_key: "masonryRenderer",
|
|
3204
3493
|
ref: f,
|
|
3205
3494
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -3220,7 +3509,7 @@ var Zn = 35, Qn = 420, $n = /* @__PURE__ */ d({
|
|
|
3220
3509
|
"load-more-locked": t.state.loadMoreLocked,
|
|
3221
3510
|
"media-indices": t.state.mediaIndices,
|
|
3222
3511
|
"next-page-error": !!t.state.nextPageError,
|
|
3223
|
-
"preview-states": M(
|
|
3512
|
+
"preview-states": M(L),
|
|
3224
3513
|
suspended: t.state.reelOrigin === "masonry" || g.value,
|
|
3225
3514
|
state: T.value,
|
|
3226
3515
|
total: t.state.total,
|
|
@@ -3237,7 +3526,7 @@ var Zn = 35, Qn = 420, $n = /* @__PURE__ */ d({
|
|
|
3237
3526
|
name: "vibe-reel-viewer",
|
|
3238
3527
|
onAfterLeave: fe
|
|
3239
3528
|
}, {
|
|
3240
|
-
default:
|
|
3529
|
+
default: P(() => [t.state.reelOrigin === "masonry" ? (w(), s("section", {
|
|
3241
3530
|
key: 0,
|
|
3242
3531
|
ref_key: "reelOverlay",
|
|
3243
3532
|
ref: m,
|
|
@@ -3246,7 +3535,7 @@ var Zn = 35, Qn = 420, $n = /* @__PURE__ */ d({
|
|
|
3246
3535
|
"aria-label": "Media viewer",
|
|
3247
3536
|
"aria-modal": "true",
|
|
3248
3537
|
tabindex: "-1"
|
|
3249
|
-
}, [u(
|
|
3538
|
+
}, [u(qn, {
|
|
3250
3539
|
ref_key: "reelRenderer",
|
|
3251
3540
|
ref: p,
|
|
3252
3541
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -3270,7 +3559,7 @@ var Zn = 35, Qn = 420, $n = /* @__PURE__ */ d({
|
|
|
3270
3559
|
"media-source": "original",
|
|
3271
3560
|
"next-page-error": !!t.state.nextPageError,
|
|
3272
3561
|
origin: "masonry",
|
|
3273
|
-
"preview-states": M(
|
|
3562
|
+
"preview-states": M(I),
|
|
3274
3563
|
"reel-auto-advance": t.state.reelAutoAdvance,
|
|
3275
3564
|
"reel-audio-state": t.reelAudioState,
|
|
3276
3565
|
"reel-forward": t.state.reelForward,
|
|
@@ -3278,11 +3567,11 @@ var Zn = 35, Qn = 420, $n = /* @__PURE__ */ d({
|
|
|
3278
3567
|
total: t.state.total,
|
|
3279
3568
|
onActiveChange: i[12] ||= (e) => d("activeReelChange", e),
|
|
3280
3569
|
onCloseInfoSheet: i[13] ||= (e) => d("reelInfoSheetChange", !1),
|
|
3281
|
-
onError: M(
|
|
3570
|
+
onError: M(ee),
|
|
3282
3571
|
onMediaError: i[14] ||= (e, t) => M(E)(e, t, "reel"),
|
|
3283
3572
|
onLoadMore: i[15] ||= (e) => d("loadMore"),
|
|
3284
3573
|
onMediaChange: ne,
|
|
3285
|
-
onReady: M(
|
|
3574
|
+
onReady: M(F),
|
|
3286
3575
|
onRetryEnd: i[16] ||= (e) => d("retryEnd"),
|
|
3287
3576
|
onRetryForward: i[17] ||= (e) => d("retryForward"),
|
|
3288
3577
|
onReelAudioChange: i[18] ||= (e) => d("reelAudioChange", e)
|
|
@@ -3293,41 +3582,41 @@ var Zn = 35, Qn = 420, $n = /* @__PURE__ */ d({
|
|
|
3293
3582
|
});
|
|
3294
3583
|
//#endregion
|
|
3295
3584
|
//#region src/core/page.ts
|
|
3296
|
-
function
|
|
3585
|
+
function mr(e) {
|
|
3297
3586
|
if (!e || typeof e != "object" || !Array.isArray(e.items)) throw TypeError("Vibe loadPage must resolve to a page with an items array.");
|
|
3298
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.");
|
|
3299
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.");
|
|
3300
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.");
|
|
3301
3590
|
return e;
|
|
3302
3591
|
}
|
|
3303
|
-
function
|
|
3592
|
+
function hr(e, t) {
|
|
3304
3593
|
let n = new Set(Y(e));
|
|
3305
|
-
return [...e, ...
|
|
3594
|
+
return [...e, ...gr(n, t)];
|
|
3306
3595
|
}
|
|
3307
|
-
function
|
|
3596
|
+
function gr(e, t) {
|
|
3308
3597
|
return t.filter((t) => e.has(t.postId) ? !1 : (e.add(t.postId), !0));
|
|
3309
3598
|
}
|
|
3310
|
-
function
|
|
3599
|
+
function _r(e, t) {
|
|
3311
3600
|
if (t.length === 0) return e;
|
|
3312
|
-
let n =
|
|
3601
|
+
let n = gr(new Set(Y(e)), t);
|
|
3313
3602
|
return n.length > 0 ? [...e, ...n] : e;
|
|
3314
3603
|
}
|
|
3315
|
-
function
|
|
3604
|
+
function vr(e) {
|
|
3316
3605
|
return `${typeof e}:${String(e)}`;
|
|
3317
3606
|
}
|
|
3318
|
-
function
|
|
3319
|
-
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)}`;
|
|
3320
3609
|
}
|
|
3321
|
-
function
|
|
3322
|
-
let n = [...e], r = new Map(Y(e).map((e, t) => [
|
|
3610
|
+
function br(e, t) {
|
|
3611
|
+
let n = [...e], r = new Map(Y(e).map((e, t) => [vr(e), t]));
|
|
3323
3612
|
return t.forEach((e) => {
|
|
3324
|
-
let t =
|
|
3613
|
+
let t = vr(e.postId), i = r.get(t);
|
|
3325
3614
|
if (i === void 0) {
|
|
3326
3615
|
r.set(t, n.length), n.push(e);
|
|
3327
3616
|
return;
|
|
3328
3617
|
}
|
|
3329
|
-
let a = n[i], o = new Set([a, ...a.items].map(
|
|
3330
|
-
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);
|
|
3331
3620
|
return o.has(t) ? !1 : (o.add(t), !0);
|
|
3332
3621
|
});
|
|
3333
3622
|
s.length > 0 && (n[i] = {
|
|
@@ -3336,14 +3625,14 @@ function or(e, t) {
|
|
|
3336
3625
|
});
|
|
3337
3626
|
}), n;
|
|
3338
3627
|
}
|
|
3339
|
-
function
|
|
3628
|
+
function xr(e) {
|
|
3340
3629
|
return Object.prototype.hasOwnProperty.call(e, "current") ? e.current ?? null : e.next;
|
|
3341
3630
|
}
|
|
3342
3631
|
//#endregion
|
|
3343
3632
|
//#region src/core/appendPage.ts
|
|
3344
|
-
function
|
|
3345
|
-
let i =
|
|
3346
|
-
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([{
|
|
3347
3636
|
contributionIds: a.map(({ postId: e }) => e),
|
|
3348
3637
|
cursor: o,
|
|
3349
3638
|
next: i.next,
|
|
@@ -3352,32 +3641,32 @@ function cr(e, t, n, r) {
|
|
|
3352
3641
|
}
|
|
3353
3642
|
//#endregion
|
|
3354
3643
|
//#region src/core/requestDelay.ts
|
|
3355
|
-
var
|
|
3644
|
+
var Cr = 2e3, wr = 1e4, Tr = 250, Er = {
|
|
3356
3645
|
delayRemainingMs: null,
|
|
3357
3646
|
nextRequestAt: null
|
|
3358
3647
|
};
|
|
3359
|
-
function
|
|
3648
|
+
function Dr(e, t) {
|
|
3360
3649
|
return e === void 0 ? t : Math.floor(e);
|
|
3361
3650
|
}
|
|
3362
|
-
function
|
|
3651
|
+
function Or(e, t) {
|
|
3363
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.`);
|
|
3364
3653
|
}
|
|
3365
|
-
function
|
|
3366
|
-
let n =
|
|
3654
|
+
function kr(e, t = {}) {
|
|
3655
|
+
let n = Dr(t.delayStepMs, Cr), r = Dr(t.delayMaxMs, wr);
|
|
3367
3656
|
return Math.min(Math.max(0, e) * n, r);
|
|
3368
3657
|
}
|
|
3369
|
-
function
|
|
3370
|
-
if (e == null || !Number.isFinite(e)) return { ...
|
|
3658
|
+
function Ar(e) {
|
|
3659
|
+
if (e == null || !Number.isFinite(e)) return { ...Er };
|
|
3371
3660
|
let t = Math.max(0, Math.floor(e - Date.now()));
|
|
3372
3661
|
return t > 0 ? {
|
|
3373
3662
|
delayRemainingMs: t,
|
|
3374
3663
|
nextRequestAt: e
|
|
3375
|
-
} : { ...
|
|
3664
|
+
} : { ...Er };
|
|
3376
3665
|
}
|
|
3377
|
-
async function
|
|
3666
|
+
async function jr({ delayMs: e, onChange: t, signal: n }) {
|
|
3378
3667
|
if (n.aborted) throw new DOMException("Aborted", "AbortError");
|
|
3379
3668
|
if (e <= 0) {
|
|
3380
|
-
t({ ...
|
|
3669
|
+
t({ ...Er });
|
|
3381
3670
|
return;
|
|
3382
3671
|
}
|
|
3383
3672
|
let r = Date.now() + e;
|
|
@@ -3385,9 +3674,9 @@ async function _r({ delayMs: e, onChange: t, signal: n }) {
|
|
|
3385
3674
|
delayRemainingMs: e,
|
|
3386
3675
|
nextRequestAt: r
|
|
3387
3676
|
}), await new Promise((i, a) => {
|
|
3388
|
-
let o = !1, s = setInterval(f,
|
|
3677
|
+
let o = !1, s = setInterval(f, Tr), c = setTimeout(() => u(), e);
|
|
3389
3678
|
function l() {
|
|
3390
|
-
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...
|
|
3679
|
+
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...Er });
|
|
3391
3680
|
}
|
|
3392
3681
|
function u(e) {
|
|
3393
3682
|
o || (o = !0, l(), e ? a(e) : i());
|
|
@@ -3396,42 +3685,42 @@ async function _r({ delayMs: e, onChange: t, signal: n }) {
|
|
|
3396
3685
|
u(new DOMException("Aborted", "AbortError"));
|
|
3397
3686
|
}
|
|
3398
3687
|
function f() {
|
|
3399
|
-
let e =
|
|
3688
|
+
let e = Ar(r);
|
|
3400
3689
|
t(e), e.delayRemainingMs === null && u();
|
|
3401
3690
|
}
|
|
3402
3691
|
n.addEventListener("abort", d, { once: !0 });
|
|
3403
3692
|
});
|
|
3404
3693
|
}
|
|
3405
|
-
var
|
|
3694
|
+
var Mr = class {
|
|
3406
3695
|
interval = null;
|
|
3407
3696
|
constructor(e) {
|
|
3408
3697
|
this.onChange = e;
|
|
3409
3698
|
}
|
|
3410
3699
|
clear() {
|
|
3411
|
-
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...
|
|
3700
|
+
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...Er });
|
|
3412
3701
|
}
|
|
3413
3702
|
sync(e) {
|
|
3414
3703
|
this.clear();
|
|
3415
|
-
let t =
|
|
3704
|
+
let t = Ar(e);
|
|
3416
3705
|
this.onChange(t), t.delayRemainingMs !== null && (this.interval = setInterval(() => {
|
|
3417
|
-
let t =
|
|
3706
|
+
let t = Ar(e);
|
|
3418
3707
|
this.onChange(t), t.delayRemainingMs === null && this.clear();
|
|
3419
|
-
},
|
|
3708
|
+
}, Tr));
|
|
3420
3709
|
}
|
|
3421
3710
|
};
|
|
3422
|
-
function
|
|
3711
|
+
function Nr(e, t = !0) {
|
|
3423
3712
|
return e.maxAdditionalPages === "unlimited" ? Infinity : (e.maxAdditionalPages ?? 10) + (t ? 1 : 0);
|
|
3424
3713
|
}
|
|
3425
|
-
function
|
|
3714
|
+
function Pr(e) {
|
|
3426
3715
|
return `${typeof e}:${String(e)}`;
|
|
3427
3716
|
}
|
|
3428
|
-
function
|
|
3717
|
+
function Fr(e, t) {
|
|
3429
3718
|
if (!Number.isInteger(e) || e <= 0) throw TypeError(`Vibe ${t} must be a positive integer.`);
|
|
3430
3719
|
}
|
|
3431
|
-
function
|
|
3720
|
+
function Ir(e) {
|
|
3432
3721
|
if (!e) return;
|
|
3433
|
-
if (
|
|
3434
|
-
|
|
3722
|
+
if (Fr(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
|
|
3723
|
+
Or(e, "frontend autofill");
|
|
3435
3724
|
let t = e.maxAdditionalPages;
|
|
3436
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\".");
|
|
3437
3726
|
return;
|
|
@@ -3443,7 +3732,7 @@ function Sr(e) {
|
|
|
3443
3732
|
if (t.pageSize !== e.pageSize) throw TypeError("Vibe backend autofill initialSession pageSize must match autofill pageSize.");
|
|
3444
3733
|
}
|
|
3445
3734
|
}
|
|
3446
|
-
function
|
|
3735
|
+
function Lr(e, t, n = !0) {
|
|
3447
3736
|
if (!e) return {
|
|
3448
3737
|
cycleId: null,
|
|
3449
3738
|
delayRemainingMs: null,
|
|
@@ -3460,7 +3749,7 @@ function Cr(e, t, n = !0) {
|
|
|
3460
3749
|
status: "idle",
|
|
3461
3750
|
strategy: null
|
|
3462
3751
|
};
|
|
3463
|
-
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);
|
|
3464
3753
|
return {
|
|
3465
3754
|
cycleId: r?.cycleId ?? null,
|
|
3466
3755
|
...a,
|
|
@@ -3477,7 +3766,7 @@ function Cr(e, t, n = !0) {
|
|
|
3477
3766
|
strategy: e.strategy
|
|
3478
3767
|
};
|
|
3479
3768
|
}
|
|
3480
|
-
function
|
|
3769
|
+
function Rr(e) {
|
|
3481
3770
|
return [
|
|
3482
3771
|
"cancelling",
|
|
3483
3772
|
"filling",
|
|
@@ -3485,9 +3774,9 @@ function wr(e) {
|
|
|
3485
3774
|
"waiting"
|
|
3486
3775
|
].includes(e.status);
|
|
3487
3776
|
}
|
|
3488
|
-
async function
|
|
3777
|
+
async function zr(e, t, n) {
|
|
3489
3778
|
let r = t.autofill;
|
|
3490
|
-
if (!
|
|
3779
|
+
if (!Rr(r) || !r.cycleId) return;
|
|
3491
3780
|
let i = {
|
|
3492
3781
|
cycleId: r.cycleId,
|
|
3493
3782
|
feedKey: r.feedKey ?? "",
|
|
@@ -3500,16 +3789,16 @@ async function Tr(e, t, n) {
|
|
|
3500
3789
|
throw r.error = e, r.status = "error", e;
|
|
3501
3790
|
}
|
|
3502
3791
|
}
|
|
3503
|
-
function
|
|
3792
|
+
function Br(e, t, n) {
|
|
3504
3793
|
return e?.strategy === "backend" && t.feedKey === e.feedKey && t.sessionId === n.sessionId;
|
|
3505
3794
|
}
|
|
3506
|
-
async function
|
|
3507
|
-
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;
|
|
3508
3797
|
for (; y < h;) {
|
|
3509
|
-
let e =
|
|
3798
|
+
let e = Pr(g);
|
|
3510
3799
|
if (m.has(e)) throw Error("Vibe autofill received a repeated cursor.");
|
|
3511
|
-
if (m.add(e), await
|
|
3512
|
-
delayMs:
|
|
3800
|
+
if (m.add(e), await jr({
|
|
3801
|
+
delayMs: kr(l + y, s),
|
|
3513
3802
|
onChange: a,
|
|
3514
3803
|
signal: d
|
|
3515
3804
|
}), y > 0 && u()) return {
|
|
@@ -3523,12 +3812,12 @@ async function Dr({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
3523
3812
|
status: "paused",
|
|
3524
3813
|
total: x
|
|
3525
3814
|
};
|
|
3526
|
-
let t =
|
|
3815
|
+
let t = mr(await n({
|
|
3527
3816
|
cursor: g,
|
|
3528
3817
|
signal: d
|
|
3529
3818
|
}));
|
|
3530
3819
|
y += 1, _ = g;
|
|
3531
|
-
let r =
|
|
3820
|
+
let r = hr(p, t.items).slice(p.length);
|
|
3532
3821
|
b.push({
|
|
3533
3822
|
contributionIds: r.map(({ postId: e }) => e),
|
|
3534
3823
|
cursor: g,
|
|
@@ -3580,12 +3869,12 @@ async function Dr({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
3580
3869
|
}
|
|
3581
3870
|
//#endregion
|
|
3582
3871
|
//#region src/core/autofillController.ts
|
|
3583
|
-
var
|
|
3872
|
+
var Hr = class {
|
|
3584
3873
|
collection = null;
|
|
3585
3874
|
cycle = 0;
|
|
3586
3875
|
delayCountdown;
|
|
3587
3876
|
constructor(e) {
|
|
3588
|
-
this.context = e, this.delayCountdown = new
|
|
3877
|
+
this.context = e, this.delayCountdown = new Mr((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
|
|
3589
3878
|
}
|
|
3590
3879
|
beginCycle() {
|
|
3591
3880
|
let { options: e, state: t } = this.context;
|
|
@@ -3593,14 +3882,14 @@ var Or = class {
|
|
|
3593
3882
|
this.clear();
|
|
3594
3883
|
let n = `vibe-autofill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
3595
3884
|
return t.autofill = {
|
|
3596
|
-
...
|
|
3885
|
+
...Lr(e, void 0, !1),
|
|
3597
3886
|
cycleId: n,
|
|
3598
3887
|
status: "filling"
|
|
3599
3888
|
}, n;
|
|
3600
3889
|
}
|
|
3601
3890
|
async cancel() {
|
|
3602
3891
|
let { cancelRequest: e, options: t, state: n } = this.context;
|
|
3603
|
-
await
|
|
3892
|
+
await zr(t, n, e), this.commitCollection();
|
|
3604
3893
|
}
|
|
3605
3894
|
captureCollection(e, t) {
|
|
3606
3895
|
t && (this.collection = e);
|
|
@@ -3622,36 +3911,36 @@ var Or = class {
|
|
|
3622
3911
|
let { onLastCursor: e, options: t, state: n } = this.context;
|
|
3623
3912
|
if (t?.strategy !== "frontend") return !1;
|
|
3624
3913
|
let r = this.collection;
|
|
3625
|
-
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, {
|
|
3626
3915
|
missing: r.missing,
|
|
3627
3916
|
received: r.received,
|
|
3628
3917
|
requests: r.requests
|
|
3629
3918
|
}), !0) : !1;
|
|
3630
3919
|
}
|
|
3631
|
-
},
|
|
3632
|
-
function
|
|
3920
|
+
}, Ur = 100;
|
|
3921
|
+
function Wr(e, t) {
|
|
3633
3922
|
if (!Number.isFinite(t) || t <= 0) throw TypeError(`Vibe ${e} must be a positive number.`);
|
|
3634
3923
|
}
|
|
3635
|
-
function
|
|
3924
|
+
function Gr(e, t, n) {
|
|
3636
3925
|
return Math.min(n, Math.max(t, e));
|
|
3637
3926
|
}
|
|
3638
|
-
function
|
|
3927
|
+
function Kr(e) {
|
|
3639
3928
|
if (!e) return;
|
|
3640
3929
|
let t = e.minSpeedPxPerSecond ?? 20, n = e.maxSpeedPxPerSecond ?? 240;
|
|
3641
|
-
if (
|
|
3642
|
-
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);
|
|
3643
3932
|
}
|
|
3644
|
-
function
|
|
3933
|
+
function qr(e) {
|
|
3645
3934
|
let t = e?.minSpeedPxPerSecond ?? 20, n = e?.maxSpeedPxPerSecond ?? 240;
|
|
3646
3935
|
return {
|
|
3647
3936
|
enabled: e?.enabled ?? !1,
|
|
3648
3937
|
maxSpeedPxPerSecond: n,
|
|
3649
3938
|
minSpeedPxPerSecond: t,
|
|
3650
3939
|
paused: !1,
|
|
3651
|
-
speedPxPerSecond:
|
|
3940
|
+
speedPxPerSecond: Gr(e?.speedPxPerSecond ?? 80, t, n)
|
|
3652
3941
|
};
|
|
3653
3942
|
}
|
|
3654
|
-
var
|
|
3943
|
+
var Jr = class {
|
|
3655
3944
|
frame = null;
|
|
3656
3945
|
lastTimestamp = null;
|
|
3657
3946
|
mounted = !1;
|
|
@@ -3671,9 +3960,9 @@ var Pr = class {
|
|
|
3671
3960
|
this.options.state.enabled && (this.options.state.paused = e, this.lastTimestamp = null, e ? this.cancelFrame() : this.schedule());
|
|
3672
3961
|
}
|
|
3673
3962
|
setSpeed(e) {
|
|
3674
|
-
|
|
3963
|
+
Wr("auto-scroll speed", e);
|
|
3675
3964
|
let t = this.options.state;
|
|
3676
|
-
t.speedPxPerSecond =
|
|
3965
|
+
t.speedPxPerSecond = Gr(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
|
|
3677
3966
|
}
|
|
3678
3967
|
tick = (e) => {
|
|
3679
3968
|
this.frame = null;
|
|
@@ -3685,7 +3974,7 @@ var Pr = class {
|
|
|
3685
3974
|
return;
|
|
3686
3975
|
}
|
|
3687
3976
|
if (this.lastTimestamp !== null) {
|
|
3688
|
-
let r = Math.min(
|
|
3977
|
+
let r = Math.min(Ur, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
|
|
3689
3978
|
n.scrollTop = Math.min(i, n.scrollTop + t.speedPxPerSecond * r / 1e3);
|
|
3690
3979
|
}
|
|
3691
3980
|
this.lastTimestamp = e, this.schedule();
|
|
@@ -3699,13 +3988,13 @@ var Pr = class {
|
|
|
3699
3988
|
};
|
|
3700
3989
|
//#endregion
|
|
3701
3990
|
//#region src/core/backendAutofill.ts
|
|
3702
|
-
async function
|
|
3991
|
+
async function Yr(e, t, n, r) {
|
|
3703
3992
|
let i = await e.onUnderfilled(n);
|
|
3704
3993
|
if (!r()) return;
|
|
3705
3994
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend autofill requires a sessionId.");
|
|
3706
3995
|
let a = Math.max(n.received, i.received ?? n.received);
|
|
3707
3996
|
Object.assign(t.autofill, {
|
|
3708
|
-
...
|
|
3997
|
+
...Ar(i.nextRequestAt),
|
|
3709
3998
|
missing: Math.max(0, e.pageSize - a),
|
|
3710
3999
|
received: a,
|
|
3711
4000
|
sequence: i.sequence ?? 0,
|
|
@@ -3713,19 +4002,19 @@ async function Fr(e, t, n, r) {
|
|
|
3713
4002
|
status: "waiting"
|
|
3714
4003
|
});
|
|
3715
4004
|
}
|
|
3716
|
-
function
|
|
3717
|
-
["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);
|
|
3718
4007
|
}
|
|
3719
|
-
function
|
|
4008
|
+
function Zr(e, t, n) {
|
|
3720
4009
|
let r = t.autofill;
|
|
3721
|
-
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);
|
|
3722
4011
|
}
|
|
3723
|
-
function
|
|
3724
|
-
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);
|
|
3725
4014
|
}
|
|
3726
4015
|
//#endregion
|
|
3727
4016
|
//#region src/core/backlogRestore.ts
|
|
3728
|
-
async function
|
|
4017
|
+
async function $r(e, t, n) {
|
|
3729
4018
|
if (!e) return;
|
|
3730
4019
|
let r = new AbortController();
|
|
3731
4020
|
n(r);
|
|
@@ -3740,7 +4029,7 @@ async function zr(e, t, n) {
|
|
|
3740
4029
|
}
|
|
3741
4030
|
//#endregion
|
|
3742
4031
|
//#region src/core/initialAutofill.ts
|
|
3743
|
-
async function
|
|
4032
|
+
async function ei({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, onPages: i, options: a, signal: o, state: s }) {
|
|
3744
4033
|
let c = a.autofill;
|
|
3745
4034
|
if (!c) return;
|
|
3746
4035
|
let l = s.items.length;
|
|
@@ -3753,7 +4042,7 @@ async function Br({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3753
4042
|
return;
|
|
3754
4043
|
}
|
|
3755
4044
|
if (c.strategy === "backend") {
|
|
3756
|
-
await
|
|
4045
|
+
await Yr(c, s, {
|
|
3757
4046
|
cycleId: e,
|
|
3758
4047
|
feedKey: c.feedKey,
|
|
3759
4048
|
items: [...s.items],
|
|
@@ -3770,11 +4059,11 @@ async function Br({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3770
4059
|
s.autofill.status = "exhausted";
|
|
3771
4060
|
return;
|
|
3772
4061
|
}
|
|
3773
|
-
let u = await
|
|
4062
|
+
let u = await Vr({
|
|
3774
4063
|
existingItems: s.items,
|
|
3775
4064
|
initialCursor: s.next,
|
|
3776
4065
|
loadPage: a.loadPage,
|
|
3777
|
-
maximumRequests:
|
|
4066
|
+
maximumRequests: Nr(c, !1),
|
|
3778
4067
|
onCollection: n,
|
|
3779
4068
|
onDelayChange: (e) => {
|
|
3780
4069
|
t() && Object.assign(s.autofill, e);
|
|
@@ -3788,7 +4077,7 @@ async function Br({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3788
4077
|
shouldPause: () => s.loadMoreLocked,
|
|
3789
4078
|
signal: o
|
|
3790
4079
|
});
|
|
3791
|
-
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, {
|
|
3792
4081
|
missing: u.missing,
|
|
3793
4082
|
received: u.received,
|
|
3794
4083
|
requests: u.requests,
|
|
@@ -3797,13 +4086,13 @@ async function Br({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3797
4086
|
}
|
|
3798
4087
|
//#endregion
|
|
3799
4088
|
//#region src/core/fill.ts
|
|
3800
|
-
function
|
|
4089
|
+
function ti(e) {
|
|
3801
4090
|
return "items" in e ? { items: e.items } : "pages" in e ? { pages: e.pages } : { until: "end" };
|
|
3802
4091
|
}
|
|
3803
|
-
function
|
|
4092
|
+
function ni(e) {
|
|
3804
4093
|
return `${typeof e}:${String(e)}`;
|
|
3805
4094
|
}
|
|
3806
|
-
function
|
|
4095
|
+
function ri(e) {
|
|
3807
4096
|
if (!e || typeof e != "object") throw TypeError("Vibe fill target must be an object.");
|
|
3808
4097
|
if ("pages" in e) {
|
|
3809
4098
|
if (!Number.isInteger(e.pages) || e.pages <= 0) throw TypeError("Vibe fill pages must be a positive integer.");
|
|
@@ -3816,21 +4105,21 @@ function Ur(e) {
|
|
|
3816
4105
|
if ("until" in e && e.until === "end") return { until: "end" };
|
|
3817
4106
|
throw TypeError("Vibe fill target must be { items }, { pages }, or { until: 'end' }.");
|
|
3818
4107
|
}
|
|
3819
|
-
function
|
|
4108
|
+
function ii(e) {
|
|
3820
4109
|
if (!e) return;
|
|
3821
4110
|
if (e.strategy === "frontend") {
|
|
3822
|
-
|
|
4111
|
+
Or(e, "frontend fill");
|
|
3823
4112
|
return;
|
|
3824
4113
|
}
|
|
3825
4114
|
if (!e.feedKey.trim()) throw TypeError("Vibe backend fill requires a feedKey.");
|
|
3826
4115
|
let t = e.initialSession;
|
|
3827
4116
|
if (t) {
|
|
3828
4117
|
if (t.feedKey !== e.feedKey) throw TypeError("Vibe backend fill initialSession feedKey must match fill feedKey.");
|
|
3829
|
-
|
|
4118
|
+
ri(t.target);
|
|
3830
4119
|
}
|
|
3831
4120
|
}
|
|
3832
|
-
function
|
|
3833
|
-
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);
|
|
3834
4123
|
return {
|
|
3835
4124
|
completedPages: i?.completedPages ?? 0,
|
|
3836
4125
|
cycleId: i?.cycleId ?? null,
|
|
@@ -3843,10 +4132,10 @@ function Gr(e, t, n = !0) {
|
|
|
3843
4132
|
sessionId: i?.sessionId ?? null,
|
|
3844
4133
|
status: i?.status ?? "idle",
|
|
3845
4134
|
strategy: e?.strategy ?? null,
|
|
3846
|
-
target: i ?
|
|
4135
|
+
target: i ? ti(i.target) : null
|
|
3847
4136
|
};
|
|
3848
4137
|
}
|
|
3849
|
-
function
|
|
4138
|
+
function oi(e) {
|
|
3850
4139
|
return [
|
|
3851
4140
|
"cancelling",
|
|
3852
4141
|
"filling",
|
|
@@ -3854,7 +4143,7 @@ function Kr(e) {
|
|
|
3854
4143
|
"waiting"
|
|
3855
4144
|
].includes(e.status);
|
|
3856
4145
|
}
|
|
3857
|
-
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 }) {
|
|
3858
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;
|
|
3859
4148
|
if ("items" in d && C() >= d.items) return {
|
|
3860
4149
|
completedPages: _,
|
|
@@ -3866,10 +4155,10 @@ async function qr({ existingItems: e, getLoadedItemCount: t, initialCursor: n, l
|
|
|
3866
4155
|
status: "complete"
|
|
3867
4156
|
};
|
|
3868
4157
|
for (; b !== null;) {
|
|
3869
|
-
let e =
|
|
4158
|
+
let e = ni(v);
|
|
3870
4159
|
if (g.has(e)) throw Error("Vibe fill received a repeated cursor.");
|
|
3871
|
-
if (g.add(e), await
|
|
3872
|
-
delayMs:
|
|
4160
|
+
if (g.add(e), await jr({
|
|
4161
|
+
delayMs: kr(_, c),
|
|
3873
4162
|
onChange: o,
|
|
3874
4163
|
signal: u
|
|
3875
4164
|
}), _ > 0 && l()) return {
|
|
@@ -3882,12 +4171,12 @@ async function qr({ existingItems: e, getLoadedItemCount: t, initialCursor: n, l
|
|
|
3882
4171
|
status: "paused",
|
|
3883
4172
|
total: S
|
|
3884
4173
|
};
|
|
3885
|
-
let t =
|
|
4174
|
+
let t = mr(await r({
|
|
3886
4175
|
cursor: v,
|
|
3887
4176
|
signal: u
|
|
3888
4177
|
}));
|
|
3889
4178
|
_ += 1, y = v;
|
|
3890
|
-
let n =
|
|
4179
|
+
let n = gr(h, t.items), m = {
|
|
3891
4180
|
contributionIds: n.map(({ postId: e }) => e),
|
|
3892
4181
|
cursor: v,
|
|
3893
4182
|
next: t.next,
|
|
@@ -3958,12 +4247,12 @@ async function qr({ existingItems: e, getLoadedItemCount: t, initialCursor: n, l
|
|
|
3958
4247
|
}
|
|
3959
4248
|
//#endregion
|
|
3960
4249
|
//#region src/core/backendFill.ts
|
|
3961
|
-
async function
|
|
4250
|
+
async function ci(e, t, n, r) {
|
|
3962
4251
|
let i = await e.onStart(n);
|
|
3963
4252
|
if (r()) {
|
|
3964
4253
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend fill requires a sessionId.");
|
|
3965
4254
|
Object.assign(t.fill, {
|
|
3966
|
-
...
|
|
4255
|
+
...Ar(i.nextRequestAt),
|
|
3967
4256
|
completedPages: i.completedPages ?? 0,
|
|
3968
4257
|
received: i.received ?? 0,
|
|
3969
4258
|
sequence: i.sequence ?? 0,
|
|
@@ -3972,23 +4261,23 @@ async function Jr(e, t, n, r) {
|
|
|
3972
4261
|
});
|
|
3973
4262
|
}
|
|
3974
4263
|
}
|
|
3975
|
-
function
|
|
4264
|
+
function li(e, t, n) {
|
|
3976
4265
|
return e?.strategy === "backend" && n.feedKey === e.feedKey && n.sessionId === t.fill.sessionId;
|
|
3977
4266
|
}
|
|
3978
|
-
function
|
|
4267
|
+
function ui(e) {
|
|
3979
4268
|
return Number.isInteger(e.completedPages) && e.completedPages >= 0 && Number.isInteger(e.received) && e.received >= 0 && Number.isInteger(e.sequence) && e.sequence >= 0;
|
|
3980
4269
|
}
|
|
3981
|
-
function
|
|
4270
|
+
function di(e, t) {
|
|
3982
4271
|
if (!["complete", "exhausted"].includes(t.status)) return !0;
|
|
3983
4272
|
let n = e.fill.target;
|
|
3984
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;
|
|
3985
4274
|
}
|
|
3986
|
-
function
|
|
3987
|
-
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));
|
|
3988
4277
|
}
|
|
3989
|
-
function
|
|
3990
|
-
return !
|
|
3991
|
-
...
|
|
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),
|
|
3992
4281
|
completedPages: n.completedPages,
|
|
3993
4282
|
error: n.error ?? null,
|
|
3994
4283
|
received: n.received,
|
|
@@ -3996,45 +4285,45 @@ function $r(e, t, n, r) {
|
|
|
3996
4285
|
status: n.status
|
|
3997
4286
|
}), !0);
|
|
3998
4287
|
}
|
|
3999
|
-
function
|
|
4288
|
+
function mi(e, t, n, r) {
|
|
4000
4289
|
if (e?.strategy !== "backend" || n.feedKey !== e.feedKey) return !1;
|
|
4001
4290
|
let i = t.fill;
|
|
4002
|
-
return t.fill =
|
|
4291
|
+
return t.fill = ai(e, n), !ui(n) || !di(t, n) ? (t.fill = i, !1) : (fi(t, n, r), !0);
|
|
4003
4292
|
}
|
|
4004
4293
|
//#endregion
|
|
4005
4294
|
//#region src/core/fillController.ts
|
|
4006
|
-
var
|
|
4295
|
+
var hi = class {
|
|
4007
4296
|
abortController = null;
|
|
4008
4297
|
cycle = 0;
|
|
4009
4298
|
delayCountdown;
|
|
4010
4299
|
requestVersion = 0;
|
|
4011
4300
|
collection = null;
|
|
4012
4301
|
constructor(e) {
|
|
4013
|
-
this.options = e, this.delayCountdown = new
|
|
4302
|
+
this.options = e, this.delayCountdown = new Mr((e) => {
|
|
4014
4303
|
Object.assign(this.options.state.fill, e);
|
|
4015
4304
|
}), this.syncBackendCountdown();
|
|
4016
4305
|
}
|
|
4017
4306
|
isActive() {
|
|
4018
|
-
return
|
|
4307
|
+
return oi(this.options.state.fill);
|
|
4019
4308
|
}
|
|
4020
4309
|
applyUpdate(e) {
|
|
4021
|
-
let t =
|
|
4310
|
+
let t = pi(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
4022
4311
|
return t && this.syncBackendCountdown(), t;
|
|
4023
4312
|
}
|
|
4024
4313
|
restoreSession(e) {
|
|
4025
|
-
let t =
|
|
4314
|
+
let t = mi(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
4026
4315
|
return t && this.syncBackendCountdown(), t;
|
|
4027
4316
|
}
|
|
4028
4317
|
async start(e, t = {}) {
|
|
4029
4318
|
let n = this.options.fill;
|
|
4030
4319
|
if (!n) throw Error("Vibe fill is not configured.");
|
|
4031
4320
|
if (this.isActive()) throw Error("Vibe fill is already active.");
|
|
4032
|
-
let r =
|
|
4321
|
+
let r = ri(e), i = ri(t.target ?? r), a = t.progressOffset ?? {
|
|
4033
4322
|
completedPages: 0,
|
|
4034
4323
|
received: 0
|
|
4035
4324
|
}, o = t.cycleId ?? `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
4036
4325
|
if (this.options.state.fill = {
|
|
4037
|
-
...
|
|
4326
|
+
...ai(n, void 0, !1),
|
|
4038
4327
|
completedPages: a.completedPages,
|
|
4039
4328
|
cycleId: o,
|
|
4040
4329
|
received: a.received,
|
|
@@ -4047,7 +4336,7 @@ var ti = class {
|
|
|
4047
4336
|
let s = ++this.requestVersion, c = new AbortController();
|
|
4048
4337
|
this.abortController = c;
|
|
4049
4338
|
try {
|
|
4050
|
-
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, {
|
|
4051
4340
|
cycleId: o,
|
|
4052
4341
|
feedKey: n.feedKey,
|
|
4053
4342
|
items: [...this.options.state.items],
|
|
@@ -4065,7 +4354,7 @@ var ti = class {
|
|
|
4065
4354
|
}
|
|
4066
4355
|
async cancel() {
|
|
4067
4356
|
let { fill: e, state: t } = this.options;
|
|
4068
|
-
if (!
|
|
4357
|
+
if (!oi(t.fill) || !t.fill.cycleId) return;
|
|
4069
4358
|
let n = {
|
|
4070
4359
|
cycleId: t.fill.cycleId,
|
|
4071
4360
|
feedKey: t.fill.feedKey ?? "",
|
|
@@ -4109,7 +4398,7 @@ var ti = class {
|
|
|
4109
4398
|
});
|
|
4110
4399
|
}
|
|
4111
4400
|
reset() {
|
|
4112
|
-
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;
|
|
4113
4402
|
}
|
|
4114
4403
|
destroy() {
|
|
4115
4404
|
this.abortLocalRequest(), this.delayCountdown.clear();
|
|
@@ -4144,7 +4433,7 @@ var ti = class {
|
|
|
4144
4433
|
s.fill.status = "until" in t ? "complete" : "exhausted";
|
|
4145
4434
|
return;
|
|
4146
4435
|
}
|
|
4147
|
-
let c = await
|
|
4436
|
+
let c = await si({
|
|
4148
4437
|
existingItems: s.items,
|
|
4149
4438
|
getLoadedItemCount: () => s.items.length,
|
|
4150
4439
|
initialCursor: s.next,
|
|
@@ -4181,7 +4470,7 @@ var ti = class {
|
|
|
4181
4470
|
let e = this.collection;
|
|
4182
4471
|
if (this.collection = null, !e || this.options.fill?.strategy !== "frontend") return;
|
|
4183
4472
|
let t = this.options.state;
|
|
4184
|
-
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, {
|
|
4185
4474
|
completedPages: e.completedPages,
|
|
4186
4475
|
received: e.received
|
|
4187
4476
|
});
|
|
@@ -4196,7 +4485,7 @@ var ti = class {
|
|
|
4196
4485
|
};
|
|
4197
4486
|
//#endregion
|
|
4198
4487
|
//#region src/core/fillReconciliation.ts
|
|
4199
|
-
async function
|
|
4488
|
+
async function gi({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r, pauseWhenManual: i = !1, setLastCursor: a, signal: o, state: s }) {
|
|
4200
4489
|
if (!e.needsReconciliation(s.items)) return "skipped";
|
|
4201
4490
|
let c = await e.reconcile({
|
|
4202
4491
|
existingItems: s.items,
|
|
@@ -4205,11 +4494,11 @@ async function ni({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r,
|
|
|
4205
4494
|
shouldPause: () => s.loadMoreLocked || i && !s.infiniteScroll,
|
|
4206
4495
|
signal: o
|
|
4207
4496
|
});
|
|
4208
|
-
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;
|
|
4209
4498
|
}
|
|
4210
4499
|
//#endregion
|
|
4211
4500
|
//#region src/core/feedFooter.ts
|
|
4212
|
-
function
|
|
4501
|
+
function _i(e) {
|
|
4213
4502
|
return {
|
|
4214
4503
|
cancelAutofill: () => e.cancelAutofill(),
|
|
4215
4504
|
loadMore: () => e.loadNext(),
|
|
@@ -4221,64 +4510,64 @@ function ri(e) {
|
|
|
4221
4510
|
retryFill: () => e.retryFill()
|
|
4222
4511
|
};
|
|
4223
4512
|
}
|
|
4224
|
-
function
|
|
4513
|
+
function vi(e) {
|
|
4225
4514
|
if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
|
|
4226
4515
|
}
|
|
4227
|
-
function
|
|
4228
|
-
e?.intervalMs !== void 0 &&
|
|
4516
|
+
function yi(e) {
|
|
4517
|
+
e?.intervalMs !== void 0 && vi(e.intervalMs);
|
|
4229
4518
|
}
|
|
4230
|
-
function
|
|
4519
|
+
function bi(e) {
|
|
4231
4520
|
return {
|
|
4232
4521
|
enabled: e?.enabled ?? !1,
|
|
4233
4522
|
includePostItems: e?.includePostItems ?? !1,
|
|
4234
4523
|
intervalMs: e?.intervalMs ?? 5e3
|
|
4235
4524
|
};
|
|
4236
4525
|
}
|
|
4237
|
-
function
|
|
4526
|
+
function xi(e, t) {
|
|
4238
4527
|
if (typeof t == "boolean") {
|
|
4239
4528
|
e.enabled = t;
|
|
4240
4529
|
return;
|
|
4241
4530
|
}
|
|
4242
|
-
|
|
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);
|
|
4243
4532
|
}
|
|
4244
4533
|
//#endregion
|
|
4245
4534
|
//#region src/core/reelInfoSheet.ts
|
|
4246
|
-
function
|
|
4535
|
+
function Si(e) {
|
|
4247
4536
|
return { enabled: e?.enabled ?? !1 };
|
|
4248
4537
|
}
|
|
4249
|
-
function
|
|
4538
|
+
function Ci(e, t, n) {
|
|
4250
4539
|
if (n && !t) throw Error("Vibe cannot enable reelInfoSheet without a configured component.");
|
|
4251
4540
|
e.enabled = n;
|
|
4252
4541
|
}
|
|
4253
4542
|
//#endregion
|
|
4254
4543
|
//#region src/core/initialRuntimeState.ts
|
|
4255
|
-
function
|
|
4544
|
+
function wi(e, t) {
|
|
4256
4545
|
let n = e.initialPage;
|
|
4257
4546
|
return {
|
|
4258
4547
|
activeReelPostId: null,
|
|
4259
|
-
autoScroll:
|
|
4260
|
-
autofill:
|
|
4548
|
+
autoScroll: qr(e.autoScroll),
|
|
4549
|
+
autofill: Lr(e.autofill),
|
|
4261
4550
|
current: n?.current ?? null,
|
|
4262
4551
|
error: null,
|
|
4263
|
-
fill:
|
|
4552
|
+
fill: ai(e.fill),
|
|
4264
4553
|
infiniteScroll: e.infiniteScroll ?? !0,
|
|
4265
4554
|
isLoading: !n,
|
|
4266
4555
|
isLoadingMore: !1,
|
|
4267
|
-
items: n ?
|
|
4556
|
+
items: n ? hr([], n.items) : [],
|
|
4268
4557
|
layout: t === "reel" ? "reel" : "masonry",
|
|
4269
4558
|
loadMoreLocked: !1,
|
|
4270
4559
|
mediaIndices: /* @__PURE__ */ new Map(),
|
|
4271
4560
|
next: n?.next ?? null,
|
|
4272
4561
|
nextPageError: null,
|
|
4273
4562
|
phoneMode: !1,
|
|
4274
|
-
reelAutoAdvance:
|
|
4563
|
+
reelAutoAdvance: bi(e.reelAutoAdvance),
|
|
4275
4564
|
reelForward: {
|
|
4276
4565
|
error: null,
|
|
4277
4566
|
status: "idle"
|
|
4278
4567
|
},
|
|
4279
4568
|
reelForwardIndex: null,
|
|
4280
4569
|
reelForwardItem: null,
|
|
4281
|
-
reelInfoSheet:
|
|
4570
|
+
reelInfoSheet: Si(e.reelInfoSheet),
|
|
4282
4571
|
reelInfoSheetOverlay: !1,
|
|
4283
4572
|
reelMediaSource: "original",
|
|
4284
4573
|
reelOrigin: null,
|
|
@@ -4287,21 +4576,21 @@ function ui(e, t) {
|
|
|
4287
4576
|
}
|
|
4288
4577
|
//#endregion
|
|
4289
4578
|
//#region src/core/options.ts
|
|
4290
|
-
function
|
|
4579
|
+
function Ti(e, t) {
|
|
4291
4580
|
if (t) {
|
|
4292
4581
|
if (!Number.isFinite(t.height) || t.height <= 0) throw TypeError(`Vibe ${e} height must be a positive number.`);
|
|
4293
4582
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe ${e} background must be "default" or "transparent".`);
|
|
4294
4583
|
}
|
|
4295
4584
|
}
|
|
4296
|
-
function
|
|
4585
|
+
function Ei(e, t) {
|
|
4297
4586
|
if (t) {
|
|
4298
4587
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe mediaCard ${e} background must be "default" or "transparent".`);
|
|
4299
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.`);
|
|
4300
4589
|
}
|
|
4301
4590
|
}
|
|
4302
|
-
function
|
|
4303
|
-
if (
|
|
4304
|
-
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) {
|
|
4305
4594
|
if (!Number.isInteger(e.removalReconciliation.pageSize) || e.removalReconciliation.pageSize <= 0) throw TypeError("Vibe removalReconciliation pageSize must be a positive integer.");
|
|
4306
4595
|
let t = e.removalReconciliation.maxReplayPages ?? 5;
|
|
4307
4596
|
if (!Number.isInteger(t) || t <= 0) throw TypeError("Vibe removalReconciliation maxReplayPages must be a positive integer.");
|
|
@@ -4316,7 +4605,7 @@ function pi(e) {
|
|
|
4316
4605
|
if (e.fill?.strategy === "frontend" && !e.loadPage) throw TypeError("Vibe frontend fill requires loadPage.");
|
|
4317
4606
|
if (e.fill?.strategy === "backend" && e.fill.initialSession && !e.initialPage) throw TypeError("Vibe backend fill restoration requires initialPage.");
|
|
4318
4607
|
}
|
|
4319
|
-
function
|
|
4608
|
+
function Oi(e) {
|
|
4320
4609
|
if (typeof e != "string") return e;
|
|
4321
4610
|
if (typeof document > "u") throw Error("Vibe cannot resolve a selector without a document.");
|
|
4322
4611
|
let t = document.querySelector(e);
|
|
@@ -4325,7 +4614,7 @@ function mi(e) {
|
|
|
4325
4614
|
}
|
|
4326
4615
|
//#endregion
|
|
4327
4616
|
//#region src/core/pageRequest.ts
|
|
4328
|
-
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 }) {
|
|
4329
4618
|
let u = s.autofill, d = e && u?.strategy === "frontend" && (l.autofill.status === "paused" || l.autofill.status === "error"), f = d ? {
|
|
4330
4619
|
received: l.autofill.received,
|
|
4331
4620
|
requests: l.autofill.requests
|
|
@@ -4337,11 +4626,11 @@ async function hi({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
4337
4626
|
let m = !1;
|
|
4338
4627
|
try {
|
|
4339
4628
|
if (u?.strategy === "frontend") {
|
|
4340
|
-
let s = await
|
|
4629
|
+
let s = await Vr({
|
|
4341
4630
|
existingItems: e ? l.items : [],
|
|
4342
4631
|
initialCursor: n,
|
|
4343
4632
|
loadPage: i,
|
|
4344
|
-
maximumRequests: f ? Math.max(0,
|
|
4633
|
+
maximumRequests: f ? Math.max(0, Nr(u) - f.requests) : void 0,
|
|
4345
4634
|
onCollection: (e) => t.captureCollection(e, r()),
|
|
4346
4635
|
onDelayChange: (e) => {
|
|
4347
4636
|
r() && Object.assign(l.autofill, e);
|
|
@@ -4356,7 +4645,7 @@ async function hi({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
4356
4645
|
signal: c
|
|
4357
4646
|
});
|
|
4358
4647
|
if (!r()) return;
|
|
4359
|
-
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, {
|
|
4360
4649
|
missing: s.missing,
|
|
4361
4650
|
received: s.received,
|
|
4362
4651
|
requests: s.requests,
|
|
@@ -4364,12 +4653,12 @@ async function hi({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
4364
4653
|
}), o(s.pages), t.clearCollection();
|
|
4365
4654
|
return;
|
|
4366
4655
|
}
|
|
4367
|
-
let s =
|
|
4656
|
+
let s = mr(await i({
|
|
4368
4657
|
cursor: n,
|
|
4369
4658
|
signal: c
|
|
4370
4659
|
}));
|
|
4371
4660
|
if (!r()) return;
|
|
4372
|
-
let d = e ? l.items : [], h =
|
|
4661
|
+
let d = e ? l.items : [], h = hr(d, s.items), g = h.length - d.length;
|
|
4373
4662
|
if (l.items = h, a(n), o([{
|
|
4374
4663
|
contributionIds: h.slice(d.length).map(({ postId: e }) => e),
|
|
4375
4664
|
cursor: n,
|
|
@@ -4384,7 +4673,7 @@ async function hi({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
4384
4673
|
l.autofill.status = "complete";
|
|
4385
4674
|
return;
|
|
4386
4675
|
}
|
|
4387
|
-
await
|
|
4676
|
+
await Yr(u, l, {
|
|
4388
4677
|
cycleId: p,
|
|
4389
4678
|
feedKey: u.feedKey,
|
|
4390
4679
|
items: h.slice(d.length),
|
|
@@ -4406,7 +4695,7 @@ async function hi({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
4406
4695
|
}
|
|
4407
4696
|
//#endregion
|
|
4408
4697
|
//#region src/core/pageReplacement.ts
|
|
4409
|
-
var
|
|
4698
|
+
var Ai = class {
|
|
4410
4699
|
controller = null;
|
|
4411
4700
|
constructor(e) {
|
|
4412
4701
|
this.options = e;
|
|
@@ -4418,7 +4707,7 @@ var gi = class {
|
|
|
4418
4707
|
this.controller?.abort(), this.controller = null, this.options.surface()?.cancelItemRemoval();
|
|
4419
4708
|
}
|
|
4420
4709
|
async replace(e, t) {
|
|
4421
|
-
let n =
|
|
4710
|
+
let n = mr(e);
|
|
4422
4711
|
this.cancel();
|
|
4423
4712
|
let r = new AbortController();
|
|
4424
4713
|
this.controller = r;
|
|
@@ -4449,7 +4738,7 @@ var gi = class {
|
|
|
4449
4738
|
};
|
|
4450
4739
|
//#endregion
|
|
4451
4740
|
//#region src/core/loadingLock.ts
|
|
4452
|
-
function
|
|
4741
|
+
function ji(e, t, n) {
|
|
4453
4742
|
if (e.loadMoreLocked !== t && (e.loadMoreLocked = t, !t)) {
|
|
4454
4743
|
if (e.fill.status === "paused" && e.fill.target) {
|
|
4455
4744
|
n.resumeFill();
|
|
@@ -4465,16 +4754,16 @@ function _i(e, t, n) {
|
|
|
4465
4754
|
}
|
|
4466
4755
|
//#endregion
|
|
4467
4756
|
//#region src/core/removalReconciliationController.ts
|
|
4468
|
-
function
|
|
4757
|
+
function Mi(e) {
|
|
4469
4758
|
return `${typeof e}:${String(e)}`;
|
|
4470
4759
|
}
|
|
4471
|
-
function
|
|
4760
|
+
function Ni(e) {
|
|
4472
4761
|
return `${typeof e}:${String(e)}`;
|
|
4473
4762
|
}
|
|
4474
|
-
function
|
|
4763
|
+
function Pi(e) {
|
|
4475
4764
|
return e.map(({ postId: e }) => e);
|
|
4476
4765
|
}
|
|
4477
|
-
var
|
|
4766
|
+
var Fi = class {
|
|
4478
4767
|
delay;
|
|
4479
4768
|
enabled;
|
|
4480
4769
|
maxReplayPages;
|
|
@@ -4493,7 +4782,7 @@ var xi = class {
|
|
|
4493
4782
|
e.status === "complete" && (this.pages = [...this.pages.slice(0, e.replaceFrom), ...e.pages].slice(-this.maxReplayPages), this.pending = null);
|
|
4494
4783
|
}
|
|
4495
4784
|
filterItems(e) {
|
|
4496
|
-
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)));
|
|
4497
4786
|
}
|
|
4498
4787
|
needsReconciliation(e) {
|
|
4499
4788
|
return this.pending !== null || this.findUnderfilledPage(e) >= 0;
|
|
@@ -4506,45 +4795,45 @@ var xi = class {
|
|
|
4506
4795
|
}
|
|
4507
4796
|
recordInitialPage(e) {
|
|
4508
4797
|
e && this.recordPages([{
|
|
4509
|
-
contributionIds:
|
|
4510
|
-
cursor:
|
|
4798
|
+
contributionIds: Pi(e.items),
|
|
4799
|
+
cursor: xr(e),
|
|
4511
4800
|
next: e.next,
|
|
4512
|
-
returnedIds:
|
|
4801
|
+
returnedIds: Pi(e.items)
|
|
4513
4802
|
}]);
|
|
4514
4803
|
}
|
|
4515
4804
|
remove(e) {
|
|
4516
|
-
e.forEach((e) => this.tombstones.add(
|
|
4805
|
+
e.forEach((e) => this.tombstones.add(Mi(e)));
|
|
4517
4806
|
}
|
|
4518
4807
|
reset() {
|
|
4519
4808
|
this.pages = [], this.pending = null, this.tombstones.clear();
|
|
4520
4809
|
}
|
|
4521
4810
|
restore(e) {
|
|
4522
|
-
e.forEach((e) => this.tombstones.delete(
|
|
4811
|
+
e.forEach((e) => this.tombstones.delete(Mi(e)));
|
|
4523
4812
|
}
|
|
4524
4813
|
async reconcile({ existingItems: e, loadPage: t, onDelayChange: n = () => void 0, shouldPause: r = () => !1, signal: i }) {
|
|
4525
4814
|
let a = this.pending ?? this.createSession(e);
|
|
4526
4815
|
for (this.pending = a; a.remainingRequests > 0;) {
|
|
4527
|
-
let e =
|
|
4816
|
+
let e = Ni(a.cursor);
|
|
4528
4817
|
if (a.seenCursors.has(e)) throw Error("Vibe removal reconciliation received a repeated cursor.");
|
|
4529
|
-
if (await
|
|
4530
|
-
delayMs:
|
|
4818
|
+
if (await jr({
|
|
4819
|
+
delayMs: kr(a.pages.length, this.delay),
|
|
4531
4820
|
onChange: n,
|
|
4532
4821
|
signal: i
|
|
4533
4822
|
}), a.pages.length > 0 && r()) return this.result(a, "paused");
|
|
4534
|
-
let o =
|
|
4823
|
+
let o = mr(await t({
|
|
4535
4824
|
cursor: a.cursor,
|
|
4536
4825
|
signal: i
|
|
4537
4826
|
}));
|
|
4538
4827
|
a.seenCursors.add(e);
|
|
4539
4828
|
let s = this.filterItems(o.items), c = [];
|
|
4540
4829
|
if (s.forEach((e) => {
|
|
4541
|
-
let t =
|
|
4830
|
+
let t = Mi(e.postId);
|
|
4542
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));
|
|
4543
4832
|
}), a.pages.push({
|
|
4544
4833
|
contributionIds: c,
|
|
4545
4834
|
cursor: a.cursor,
|
|
4546
4835
|
next: o.next,
|
|
4547
|
-
returnedIds:
|
|
4836
|
+
returnedIds: Pi(s)
|
|
4548
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");
|
|
4549
4838
|
}
|
|
4550
4839
|
return this.result(a, "complete");
|
|
@@ -4552,9 +4841,9 @@ var xi = class {
|
|
|
4552
4841
|
createSession(e) {
|
|
4553
4842
|
let t = this.findUnderfilledPage(e), n = t < 0 ? [] : this.pages.slice(t), r = n[0];
|
|
4554
4843
|
if (!r) throw Error("Vibe has no underfilled provider page to reconcile.");
|
|
4555
|
-
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)));
|
|
4556
4845
|
return {
|
|
4557
|
-
appended: new Set(e.map(({ postId: e }) =>
|
|
4846
|
+
appended: new Set(e.map(({ postId: e }) => Mi(e))),
|
|
4558
4847
|
attributed: new Set(a),
|
|
4559
4848
|
cursor: r.cursor,
|
|
4560
4849
|
items: [],
|
|
@@ -4579,11 +4868,11 @@ var xi = class {
|
|
|
4579
4868
|
}
|
|
4580
4869
|
findUnderfilledPage(e) {
|
|
4581
4870
|
if (!this.enabled || this.pages.length === 0) return -1;
|
|
4582
|
-
let t = new Set(e.map(({ postId: e }) =>
|
|
4583
|
-
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);
|
|
4584
4873
|
}
|
|
4585
4874
|
recordPage(e) {
|
|
4586
|
-
let t =
|
|
4875
|
+
let t = Ni(e.cursor), n = this.pages.findIndex(({ cursor: e }) => Ni(e) === t);
|
|
4587
4876
|
n >= 0 && (this.pages = this.pages.slice(0, n)), this.pages.push({
|
|
4588
4877
|
...e,
|
|
4589
4878
|
contributionIds: [...e.contributionIds],
|
|
@@ -4593,7 +4882,7 @@ var xi = class {
|
|
|
4593
4882
|
};
|
|
4594
4883
|
//#endregion
|
|
4595
4884
|
//#region src/core/activeItemRemoval.ts
|
|
4596
|
-
function
|
|
4885
|
+
function Ii(e, t, n, r, i) {
|
|
4597
4886
|
let a = new Set(t.map(({ item: e }) => e.postId));
|
|
4598
4887
|
if (e.activeReelPostId === null || !a.has(e.activeReelPostId)) return;
|
|
4599
4888
|
let o = e.items[Math.max(n, 0)];
|
|
@@ -4606,7 +4895,7 @@ function Si(e, t, n, r, i) {
|
|
|
4606
4895
|
}
|
|
4607
4896
|
//#endregion
|
|
4608
4897
|
//#region src/core/exactMediaRemovalController.ts
|
|
4609
|
-
function
|
|
4898
|
+
function Li(e, t) {
|
|
4610
4899
|
let [n, ...r] = t;
|
|
4611
4900
|
if (!n) throw Error("Vibe items must contain at least one media asset.");
|
|
4612
4901
|
return {
|
|
@@ -4615,10 +4904,10 @@ function Ci(e, t) {
|
|
|
4615
4904
|
items: r
|
|
4616
4905
|
};
|
|
4617
4906
|
}
|
|
4618
|
-
function
|
|
4907
|
+
function Ri(e) {
|
|
4619
4908
|
if (!Number.isInteger(e.mediaIndex) || e.mediaIndex < 0) throw TypeError("Vibe mediaIndex must be a non-negative integer.");
|
|
4620
4909
|
}
|
|
4621
|
-
var
|
|
4910
|
+
var zi = class {
|
|
4622
4911
|
generation = 0;
|
|
4623
4912
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
4624
4913
|
state;
|
|
@@ -4626,7 +4915,7 @@ var Ti = class {
|
|
|
4626
4915
|
this.options = e, this.state = e.state;
|
|
4627
4916
|
}
|
|
4628
4917
|
remove(e) {
|
|
4629
|
-
|
|
4918
|
+
Ri(e);
|
|
4630
4919
|
let t = this.state.items.findIndex(({ postId: t }) => t === e.postId), n = this.state.items[t];
|
|
4631
4920
|
if (!n) return null;
|
|
4632
4921
|
let r = [...G(n)], i = r[e.mediaIndex];
|
|
@@ -4643,7 +4932,7 @@ var Ti = class {
|
|
|
4643
4932
|
restored: !1
|
|
4644
4933
|
});
|
|
4645
4934
|
let o = this.state.mediaIndices.get(n.postId) ?? 0, s = this.isReelOpen() && this.state.activeReelPostId === n.postId, c = s && o === e.mediaIndex;
|
|
4646
|
-
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);
|
|
4647
4936
|
}
|
|
4648
4937
|
reset() {
|
|
4649
4938
|
this.generation += 1;
|
|
@@ -4669,7 +4958,7 @@ var Ti = class {
|
|
|
4669
4958
|
}
|
|
4670
4959
|
restoreIntoPost(e, t) {
|
|
4671
4960
|
let n = this.state.items[e], r = [...G(n)], i = Math.min(t.mediaIndex, r.length);
|
|
4672
|
-
if (r.splice(i, 0, t.media), this.state.items[e] =
|
|
4961
|
+
if (r.splice(i, 0, t.media), this.state.items[e] = Li(n, r), this.state.activeReelPostId !== t.postId) return;
|
|
4673
4962
|
let a = this.state.mediaIndices.get(t.postId) ?? 0;
|
|
4674
4963
|
a >= i && this.state.mediaIndices.set(t.postId, a + 1);
|
|
4675
4964
|
}
|
|
@@ -4682,18 +4971,18 @@ var Ti = class {
|
|
|
4682
4971
|
};
|
|
4683
4972
|
//#endregion
|
|
4684
4973
|
//#region src/core/itemPlacement.ts
|
|
4685
|
-
function
|
|
4974
|
+
function Bi(e, t) {
|
|
4686
4975
|
let n = new Set(t);
|
|
4687
4976
|
return e.flatMap((e, t) => n.has(e.postId) ? [{
|
|
4688
4977
|
index: t,
|
|
4689
4978
|
item: e
|
|
4690
4979
|
}] : []);
|
|
4691
4980
|
}
|
|
4692
|
-
function
|
|
4981
|
+
function Vi(e, t) {
|
|
4693
4982
|
let n = new Set(t.map(({ item: e }) => e.postId));
|
|
4694
4983
|
return e.filter((e) => !n.has(e.postId));
|
|
4695
4984
|
}
|
|
4696
|
-
function
|
|
4985
|
+
function Hi(e, t) {
|
|
4697
4986
|
t.forEach(({ index: e }) => {
|
|
4698
4987
|
if (!Number.isInteger(e) || e < 0) throw Error("Vibe item restore indexes must be non-negative integers.");
|
|
4699
4988
|
});
|
|
@@ -4704,7 +4993,7 @@ function Oi(e, t) {
|
|
|
4704
4993
|
}
|
|
4705
4994
|
//#endregion
|
|
4706
4995
|
//#region src/core/itemRemovalController.ts
|
|
4707
|
-
var
|
|
4996
|
+
var Ui = 20, Wi = class {
|
|
4708
4997
|
generation = 0;
|
|
4709
4998
|
historyLimit;
|
|
4710
4999
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
@@ -4713,7 +5002,7 @@ var ki = 20, Ai = class {
|
|
|
4713
5002
|
itemOrder;
|
|
4714
5003
|
stopItemsWatcher;
|
|
4715
5004
|
constructor(e) {
|
|
4716
|
-
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" });
|
|
4717
5006
|
}
|
|
4718
5007
|
destroy() {
|
|
4719
5008
|
this.reset(), this.stopItemsWatcher();
|
|
@@ -4727,7 +5016,7 @@ var ki = 20, Ai = class {
|
|
|
4727
5016
|
let a = this.options.startRemoval(i, t);
|
|
4728
5017
|
if (a > 0 && await new Promise((e) => setTimeout(e, a)), this.metadata.get(r)?.generation !== this.generation) return r;
|
|
4729
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);
|
|
4730
|
-
return this.state.items =
|
|
5019
|
+
return this.state.items = Vi(this.state.items, n), this.options.onItemsRemoved(r, n, l), this.record(r), r;
|
|
4731
5020
|
}
|
|
4732
5021
|
reset() {
|
|
4733
5022
|
this.generation += 1, this.history = [], this.itemOrder = [];
|
|
@@ -4738,7 +5027,7 @@ var ki = 20, Ai = class {
|
|
|
4738
5027
|
this.restoreRemoval(t);
|
|
4739
5028
|
return;
|
|
4740
5029
|
}
|
|
4741
|
-
let n = new Set(Y(this.state.items)), r = e.filter(({ item: e }) => n.has(e.postId) ? !1 : (n.add(e.postId), !0)), i =
|
|
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);
|
|
4742
5031
|
this.registerExternalPlacements(r), this.state.items = i, r.length > 0 && this.options.onRemovalRestored(r);
|
|
4743
5032
|
}
|
|
4744
5033
|
restoreRemoval(e) {
|
|
@@ -4764,7 +5053,7 @@ var ki = 20, Ai = class {
|
|
|
4764
5053
|
}
|
|
4765
5054
|
collectOrderedPlacements(e) {
|
|
4766
5055
|
let t = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
4767
|
-
return
|
|
5056
|
+
return Bi(this.state.items, e).map((e) => ({
|
|
4768
5057
|
index: t.get(e.item.postId) ?? e.index,
|
|
4769
5058
|
item: e.item
|
|
4770
5059
|
}));
|
|
@@ -4795,7 +5084,7 @@ var ki = 20, Ai = class {
|
|
|
4795
5084
|
let r = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
4796
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;
|
|
4797
5086
|
}
|
|
4798
|
-
},
|
|
5087
|
+
}, Gi = class {
|
|
4799
5088
|
forward = null;
|
|
4800
5089
|
forwardPromise = null;
|
|
4801
5090
|
forwardVersion = 0;
|
|
@@ -4891,7 +5180,7 @@ var ki = 20, Ai = class {
|
|
|
4891
5180
|
}
|
|
4892
5181
|
}
|
|
4893
5182
|
}
|
|
4894
|
-
},
|
|
5183
|
+
}, Ki = class {
|
|
4895
5184
|
generation = 0;
|
|
4896
5185
|
pending = Promise.resolve();
|
|
4897
5186
|
constructor(e) {
|
|
@@ -4941,24 +5230,24 @@ var ki = 20, Ai = class {
|
|
|
4941
5230
|
};
|
|
4942
5231
|
//#endregion
|
|
4943
5232
|
//#region src/core/removalControllers.ts
|
|
4944
|
-
function
|
|
4945
|
-
let t = new
|
|
5233
|
+
function qi(e) {
|
|
5234
|
+
let t = new Gi(e), n = new Ki({
|
|
4946
5235
|
state: e.state,
|
|
4947
5236
|
transitionMedia: (t) => e.surface()?.transitionActiveReelMedia(t) ?? Promise.resolve(!1),
|
|
4948
5237
|
transitionPost: (t) => e.surface()?.transitionActiveReelPost(t) ?? Promise.resolve(!1)
|
|
4949
5238
|
});
|
|
4950
5239
|
return {
|
|
4951
|
-
exactMediaRemoval: new
|
|
5240
|
+
exactMediaRemoval: new zi({
|
|
4952
5241
|
onActivate: e.onActivate,
|
|
4953
5242
|
onPostRemoved: (t) => e.onItemsRemoved([t]),
|
|
4954
5243
|
onPostRestored: (t) => e.onItemsRestored([t]),
|
|
4955
5244
|
reelForward: t,
|
|
4956
5245
|
state: e.state
|
|
4957
5246
|
}),
|
|
4958
|
-
itemRemoval: new
|
|
5247
|
+
itemRemoval: new Wi({
|
|
4959
5248
|
historyLimit: e.historyLimit,
|
|
4960
5249
|
onItemsRemoved: (n, r, i) => {
|
|
4961
|
-
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));
|
|
4962
5251
|
},
|
|
4963
5252
|
onRemovalRestored: (n) => {
|
|
4964
5253
|
e.onItemsRestored(n.map(({ item: e }) => e.postId));
|
|
@@ -4973,17 +5262,17 @@ function Ni(e) {
|
|
|
4973
5262
|
reelRemoval: n
|
|
4974
5263
|
};
|
|
4975
5264
|
}
|
|
4976
|
-
var
|
|
4977
|
-
function
|
|
5265
|
+
var Ji = 1.5;
|
|
5266
|
+
function Yi(e) {
|
|
4978
5267
|
let t = Math.min(e.screenWidth, e.screenHeight);
|
|
4979
5268
|
if (t > 0 && t < 600) return !0;
|
|
4980
|
-
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n *
|
|
5269
|
+
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * Ji;
|
|
4981
5270
|
return !e.hasHover && n > 0 && n < 600 && r;
|
|
4982
5271
|
}
|
|
4983
|
-
function
|
|
4984
|
-
return
|
|
5272
|
+
function Xi(e) {
|
|
5273
|
+
return Yi(e) ? "reel" : "masonry";
|
|
4985
5274
|
}
|
|
4986
|
-
function
|
|
5275
|
+
function Zi(e) {
|
|
4987
5276
|
let t = e.ownerDocument.defaultView, n = e.ownerDocument.documentElement;
|
|
4988
5277
|
return {
|
|
4989
5278
|
hasHover: typeof t?.matchMedia == "function" && t.matchMedia("(hover: hover)").matches,
|
|
@@ -4993,15 +5282,15 @@ function Li(e) {
|
|
|
4993
5282
|
viewportWidth: n.clientWidth
|
|
4994
5283
|
};
|
|
4995
5284
|
}
|
|
4996
|
-
function
|
|
4997
|
-
return
|
|
5285
|
+
function Qi(e) {
|
|
5286
|
+
return Yi(Zi(e));
|
|
4998
5287
|
}
|
|
4999
|
-
function
|
|
5000
|
-
return
|
|
5288
|
+
function $i(e) {
|
|
5289
|
+
return Xi(Zi(e));
|
|
5001
5290
|
}
|
|
5002
5291
|
//#endregion
|
|
5003
5292
|
//#region src/core/responsiveLayoutController.ts
|
|
5004
|
-
var
|
|
5293
|
+
var ea = class {
|
|
5005
5294
|
layoutMode;
|
|
5006
5295
|
resizeObserver = null;
|
|
5007
5296
|
target = null;
|
|
@@ -5026,13 +5315,13 @@ var Bi = class {
|
|
|
5026
5315
|
}
|
|
5027
5316
|
handleResponsiveLayout = () => {
|
|
5028
5317
|
if (!this.target) return;
|
|
5029
|
-
let e =
|
|
5030
|
-
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);
|
|
5031
5320
|
};
|
|
5032
|
-
},
|
|
5321
|
+
}, ta = class {
|
|
5033
5322
|
state;
|
|
5034
5323
|
constructor(e) {
|
|
5035
|
-
this.options = e, this.state = T(
|
|
5324
|
+
this.options = e, this.state = T(en({
|
|
5036
5325
|
...e.initialReelAudioState,
|
|
5037
5326
|
muted: e.initialReelAudioState?.muted ?? e.mediaCard?.videoMuted ?? !1
|
|
5038
5327
|
}));
|
|
@@ -5041,9 +5330,9 @@ var Bi = class {
|
|
|
5041
5330
|
return { ...this.state };
|
|
5042
5331
|
}
|
|
5043
5332
|
set(e, t = !1) {
|
|
5044
|
-
Object.assign(this.state,
|
|
5333
|
+
Object.assign(this.state, en(e, this.state)), t && this.options.onReelAudioStateChange?.(this.get());
|
|
5045
5334
|
}
|
|
5046
|
-
},
|
|
5335
|
+
}, na = class {
|
|
5047
5336
|
routedReelPostId = null;
|
|
5048
5337
|
reelRouteIsActive = !1;
|
|
5049
5338
|
constructor(e, t) {
|
|
@@ -5073,30 +5362,30 @@ var Bi = class {
|
|
|
5073
5362
|
};
|
|
5074
5363
|
//#endregion
|
|
5075
5364
|
//#region src/core/updateItems.ts
|
|
5076
|
-
function
|
|
5365
|
+
function ra(e) {
|
|
5077
5366
|
return String(e);
|
|
5078
5367
|
}
|
|
5079
|
-
function
|
|
5368
|
+
function ia(e, t) {
|
|
5080
5369
|
let n = G(t).length;
|
|
5081
5370
|
(e.mediaIndices.get(t.postId) ?? 0) >= n && e.mediaIndices.set(t.postId, Math.max(0, n - 1));
|
|
5082
5371
|
}
|
|
5083
|
-
function
|
|
5372
|
+
function aa(e, t) {
|
|
5084
5373
|
let n = /* @__PURE__ */ new Map();
|
|
5085
|
-
if (t.forEach((e) => n.set(
|
|
5374
|
+
if (t.forEach((e) => n.set(ra(e.postId), e)), n.size === 0) return [];
|
|
5086
5375
|
let r = [], i = e.items.map((t) => {
|
|
5087
|
-
let i = n.get(
|
|
5376
|
+
let i = n.get(ra(t.postId));
|
|
5088
5377
|
if (!i) return t;
|
|
5089
5378
|
let a = {
|
|
5090
5379
|
...i,
|
|
5091
5380
|
postId: t.postId
|
|
5092
5381
|
};
|
|
5093
|
-
return
|
|
5382
|
+
return ia(e, a), e.reelForwardItem && ra(e.reelForwardItem.postId) === ra(t.postId) && (e.reelForwardItem = a), r.push(t.postId), a;
|
|
5094
5383
|
});
|
|
5095
5384
|
return r.length > 0 && (e.items = i), r;
|
|
5096
5385
|
}
|
|
5097
5386
|
//#endregion
|
|
5098
5387
|
//#region src/core/createVibe.ts
|
|
5099
|
-
var
|
|
5388
|
+
var oa = class {
|
|
5100
5389
|
app = null;
|
|
5101
5390
|
autoScroll;
|
|
5102
5391
|
autofillController;
|
|
@@ -5120,25 +5409,25 @@ var Ki = class {
|
|
|
5120
5409
|
state;
|
|
5121
5410
|
pageReplacement;
|
|
5122
5411
|
constructor(e) {
|
|
5123
|
-
this.options = e,
|
|
5412
|
+
this.options = e, Di(e);
|
|
5124
5413
|
let t = e.layout ?? "masonry";
|
|
5125
|
-
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({
|
|
5126
5415
|
getScrollElement: () => this.surface?.getAutoScrollElement() ?? null,
|
|
5127
5416
|
state: this.state.autoScroll
|
|
5128
|
-
}), this.autofillController = new
|
|
5417
|
+
}), this.autofillController = new Hr({
|
|
5129
5418
|
cancelRequest: () => this.cancelRequest(!this.pageReplacement?.isActive()),
|
|
5130
5419
|
onLastCursor: (e) => this.setCurrentCursor(e),
|
|
5131
5420
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
5132
5421
|
options: e.autofill,
|
|
5133
5422
|
state: this.state
|
|
5134
|
-
}), this.removalReconciliation = new
|
|
5423
|
+
}), this.removalReconciliation = new Fi(e), this.removalReconciliation.recordInitialPage(e.initialPage), this.fillController = new hi({
|
|
5135
5424
|
filterItems: (e) => this.removalReconciliation.filterItems(e),
|
|
5136
5425
|
fill: e.fill,
|
|
5137
5426
|
loadPage: e.loadPage ? (e) => this.loadFilteredPage(e) : void 0,
|
|
5138
5427
|
needsFrontendPreparation: () => this.removalReconciliation.needsReconciliation(this.state.items),
|
|
5139
5428
|
onLastCursor: (e) => this.setCurrentCursor(e),
|
|
5140
5429
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
5141
|
-
prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) =>
|
|
5430
|
+
prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) => gi({
|
|
5142
5431
|
controller: this.removalReconciliation,
|
|
5143
5432
|
isCurrent: t,
|
|
5144
5433
|
loadPage: e.loadPage,
|
|
@@ -5148,8 +5437,8 @@ var Ki = class {
|
|
|
5148
5437
|
state: this.state
|
|
5149
5438
|
}),
|
|
5150
5439
|
state: this.state
|
|
5151
|
-
}), this.routing = new
|
|
5152
|
-
let n =
|
|
5440
|
+
}), this.routing = new na(e.routing, this.state);
|
|
5441
|
+
let n = qi({
|
|
5153
5442
|
historyLimit: e.removalHistoryLimit,
|
|
5154
5443
|
onActivate: (e) => this.setActiveReelPost(e),
|
|
5155
5444
|
onCloseReel: () => this.closeMasonryReel(),
|
|
@@ -5159,29 +5448,29 @@ var Ki = class {
|
|
|
5159
5448
|
state: this.state,
|
|
5160
5449
|
surface: () => this.surface
|
|
5161
5450
|
});
|
|
5162
|
-
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({
|
|
5163
5452
|
state: this.state,
|
|
5164
5453
|
surface: () => this.surface,
|
|
5165
5454
|
prepare: async () => {
|
|
5166
|
-
this.cancelRequest(!1),
|
|
5455
|
+
this.cancelRequest(!1), Rr(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill();
|
|
5167
5456
|
},
|
|
5168
5457
|
commit: (e) => {
|
|
5169
|
-
this.resetFeedVisit(), this.setCurrentCursor(
|
|
5458
|
+
this.resetFeedVisit(), this.setCurrentCursor(xr(e)), this.removalReconciliation.recordInitialPage(e), this.state.reelOrigin === null && this.routing.syncFeed();
|
|
5170
5459
|
}
|
|
5171
|
-
}), this.responsiveLayout = new
|
|
5460
|
+
}), this.responsiveLayout = new ea(t, this.state, () => {
|
|
5172
5461
|
this.routing.syncFeed();
|
|
5173
5462
|
}), this.startStateNotifications();
|
|
5174
5463
|
}
|
|
5175
5464
|
async mount() {
|
|
5176
5465
|
if (this.app) throw Error("Vibe is already mounted.");
|
|
5177
5466
|
this.startStateNotifications();
|
|
5178
|
-
let e =
|
|
5179
|
-
this.responsiveLayout.mount(e), this.app = i(
|
|
5467
|
+
let e = Oi(this.options.target);
|
|
5468
|
+
this.responsiveLayout.mount(e), this.app = i(pr, {
|
|
5180
5469
|
canRetryEnd: !!this.options.loadPage,
|
|
5181
5470
|
cardFooter: this.options.cardFooter,
|
|
5182
5471
|
cardHeader: this.options.cardHeader,
|
|
5183
5472
|
feedFooter: this.options.feedFooter,
|
|
5184
|
-
feedFooterActions:
|
|
5473
|
+
feedFooterActions: _i(this),
|
|
5185
5474
|
mediaCard: this.options.mediaCard,
|
|
5186
5475
|
masonry: this.options.masonry,
|
|
5187
5476
|
onMediaFullyVisible: this.options.onMediaFullyVisible,
|
|
@@ -5208,7 +5497,7 @@ var Ki = class {
|
|
|
5208
5497
|
onRetryForward: () => {
|
|
5209
5498
|
this.retryReelForward();
|
|
5210
5499
|
}
|
|
5211
|
-
}), 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) => {
|
|
5212
5501
|
this.restoreController = e;
|
|
5213
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();
|
|
5214
5503
|
}
|
|
@@ -5243,7 +5532,7 @@ var Ki = class {
|
|
|
5243
5532
|
return this.itemRemoval.restoreRemoval(e);
|
|
5244
5533
|
}
|
|
5245
5534
|
updateItems(e) {
|
|
5246
|
-
return
|
|
5535
|
+
return aa(this.state, e);
|
|
5247
5536
|
}
|
|
5248
5537
|
retryReelForward() {
|
|
5249
5538
|
return this.reelForward.retry();
|
|
@@ -5282,7 +5571,7 @@ var Ki = class {
|
|
|
5282
5571
|
this.autoScroll.setSpeed(e);
|
|
5283
5572
|
}
|
|
5284
5573
|
applyAutofillUpdate(e) {
|
|
5285
|
-
let t =
|
|
5574
|
+
let t = Zr(this.options.autofill, this.state, e);
|
|
5286
5575
|
return t && this.autofillController.syncCountdown(), t;
|
|
5287
5576
|
}
|
|
5288
5577
|
cancelAutofill() {
|
|
@@ -5293,7 +5582,7 @@ var Ki = class {
|
|
|
5293
5582
|
await this.cancelFill();
|
|
5294
5583
|
return;
|
|
5295
5584
|
}
|
|
5296
|
-
if (
|
|
5585
|
+
if (Rr(this.state.autofill)) {
|
|
5297
5586
|
await this.cancelAutofill();
|
|
5298
5587
|
return;
|
|
5299
5588
|
}
|
|
@@ -5306,12 +5595,12 @@ var Ki = class {
|
|
|
5306
5595
|
}
|
|
5307
5596
|
async fill(e) {
|
|
5308
5597
|
if (!(this.state.loadMoreLocked || this.pageReplacement.isActive())) {
|
|
5309
|
-
if (this.pendingRequest ||
|
|
5598
|
+
if (this.pendingRequest || Rr(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
|
|
5310
5599
|
await this.fillController.start(e);
|
|
5311
5600
|
}
|
|
5312
5601
|
}
|
|
5313
5602
|
restoreAutofillSession(e) {
|
|
5314
|
-
let t =
|
|
5603
|
+
let t = Qr(this.options.autofill, this.state, e);
|
|
5315
5604
|
return t && this.autofillController.syncCountdown(), t;
|
|
5316
5605
|
}
|
|
5317
5606
|
restoreFillSession(e) {
|
|
@@ -5321,7 +5610,7 @@ var Ki = class {
|
|
|
5321
5610
|
return this.startLoadMore(() => this.loadNextSequence());
|
|
5322
5611
|
}
|
|
5323
5612
|
appendPage(e) {
|
|
5324
|
-
|
|
5613
|
+
Sr(e, this.state, this.removalReconciliation, (e) => this.setCurrentCursor(e));
|
|
5325
5614
|
}
|
|
5326
5615
|
replenishAfterRemoval(e = !0) {
|
|
5327
5616
|
return this.startLoadMore(() => this.replenishAfterRemovalSequence(e));
|
|
@@ -5329,7 +5618,7 @@ var Ki = class {
|
|
|
5329
5618
|
async startLoadMore(e) {
|
|
5330
5619
|
if (this.pageReplacement.isActive()) return;
|
|
5331
5620
|
if (this.pendingRequest) return this.pendingRequest;
|
|
5332
|
-
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;
|
|
5333
5622
|
this.state.isLoadingMore = !0, this.state.nextPageError = null;
|
|
5334
5623
|
let t = e();
|
|
5335
5624
|
return this.pendingRequest = t, t.finally(() => {
|
|
@@ -5347,15 +5636,15 @@ var Ki = class {
|
|
|
5347
5636
|
}
|
|
5348
5637
|
async replaceFeed(e, t) {
|
|
5349
5638
|
if (!this.options.loadPage) throw Error(`Vibe cannot ${t} without loadPage.`);
|
|
5350
|
-
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);
|
|
5351
5640
|
}
|
|
5352
5641
|
resetFeedVisit() {
|
|
5353
|
-
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();
|
|
5354
5643
|
}
|
|
5355
5644
|
async loadFilteredPage(e) {
|
|
5356
5645
|
let t = this.options.loadPage;
|
|
5357
5646
|
if (!t) throw Error("Vibe cannot load a page without loadPage.");
|
|
5358
|
-
let n =
|
|
5647
|
+
let n = mr(await t(e));
|
|
5359
5648
|
return {
|
|
5360
5649
|
...n,
|
|
5361
5650
|
items: this.removalReconciliation.filterItems(n.items)
|
|
@@ -5375,7 +5664,7 @@ var Ki = class {
|
|
|
5375
5664
|
let n = ++this.requestVersion, r = new AbortController();
|
|
5376
5665
|
this.abortController = r;
|
|
5377
5666
|
try {
|
|
5378
|
-
let i = await
|
|
5667
|
+
let i = await gi({
|
|
5379
5668
|
controller: this.removalReconciliation,
|
|
5380
5669
|
isCurrent: () => n === this.requestVersion,
|
|
5381
5670
|
loadPage: t,
|
|
@@ -5395,14 +5684,14 @@ var Ki = class {
|
|
|
5395
5684
|
async retryEnd() {
|
|
5396
5685
|
if (!this.pageReplacement.isActive()) {
|
|
5397
5686
|
if (this.pendingRequest) return this.pendingRequest;
|
|
5398
|
-
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);
|
|
5399
5688
|
}
|
|
5400
5689
|
}
|
|
5401
5690
|
setInfiniteScroll(e) {
|
|
5402
5691
|
this.state.infiniteScroll = e, e && v(() => this.surface?.loadIfNearBottom());
|
|
5403
5692
|
}
|
|
5404
5693
|
setLoadMoreLocked(e) {
|
|
5405
|
-
|
|
5694
|
+
ji(this.state, e, {
|
|
5406
5695
|
getPending: () => this.pendingRequest,
|
|
5407
5696
|
hasPendingSession: () => this.removalReconciliation.hasPendingSession(),
|
|
5408
5697
|
loadNext: () => this.loadNext(),
|
|
@@ -5415,10 +5704,10 @@ var Ki = class {
|
|
|
5415
5704
|
this.state.total = e;
|
|
5416
5705
|
}
|
|
5417
5706
|
setReelAutoAdvance(e) {
|
|
5418
|
-
|
|
5707
|
+
xi(this.state.reelAutoAdvance, e);
|
|
5419
5708
|
}
|
|
5420
5709
|
setReelInfoSheet(e) {
|
|
5421
|
-
|
|
5710
|
+
Ci(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
|
|
5422
5711
|
}
|
|
5423
5712
|
setLayout(e) {
|
|
5424
5713
|
this.responsiveLayout.setLayout(e);
|
|
@@ -5438,7 +5727,7 @@ var Ki = class {
|
|
|
5438
5727
|
async fetchPage(e, t) {
|
|
5439
5728
|
if (!this.options.loadPage) return;
|
|
5440
5729
|
let n = ++this.requestVersion, r = new AbortController();
|
|
5441
|
-
this.abortController = r, await
|
|
5730
|
+
this.abortController = r, await ki({
|
|
5442
5731
|
append: t,
|
|
5443
5732
|
autofillController: this.autofillController,
|
|
5444
5733
|
cursor: e,
|
|
@@ -5460,7 +5749,7 @@ var Ki = class {
|
|
|
5460
5749
|
startInitialAutofill() {
|
|
5461
5750
|
let e = ++this.requestVersion, t = new AbortController(), n = this.autofillController.beginCycle();
|
|
5462
5751
|
this.abortController = t, this.state.isLoadingMore = !0;
|
|
5463
|
-
let r =
|
|
5752
|
+
let r = ei({
|
|
5464
5753
|
cycleId: n,
|
|
5465
5754
|
isCurrent: () => e === this.requestVersion,
|
|
5466
5755
|
onCollection: (t) => this.autofillController.captureCollection(t, e === this.requestVersion),
|
|
@@ -5483,6 +5772,6 @@ var Ki = class {
|
|
|
5483
5772
|
setCurrentCursor(e) {
|
|
5484
5773
|
this.lastLoadedCursor = this.state.current = e;
|
|
5485
5774
|
}
|
|
5486
|
-
},
|
|
5775
|
+
}, sa = (e) => new oa(e);
|
|
5487
5776
|
//#endregion
|
|
5488
|
-
export {
|
|
5777
|
+
export { sa as createVibe };
|