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