@wyxos/vibe 5.16.3 → 5.16.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/useMediaLifecycle.d.ts +3 -3
- package/lib/core/fill.d.ts +2 -1
- package/lib/core/page.d.ts +2 -0
- package/lib/index.cjs +2 -2
- package/lib/index.js +1122 -1093
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { Fragment as e, Teleport as t, Transition as n, computed as r, createApp as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, guardReactiveProps as f, h as p,
|
|
1
|
+
import { Fragment as e, Teleport as t, Transition as n, computed as r, createApp as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, guardReactiveProps as f, h as p, isReactive as m, nextTick as h, normalizeClass as g, normalizeProps as _, normalizeStyle as v, onBeforeUnmount as y, onMounted as b, openBlock as x, reactive as S, renderList as C, resolveDynamicComponent as w, shallowReactive as T, shallowRef as E, toDisplayString as D, unref as O, useId as k, watch as A, withCtx as j, withKeys as M, withModifiers as N } from "vue";
|
|
2
2
|
//#region src/core/mediaType.ts
|
|
3
|
-
var
|
|
4
|
-
function
|
|
3
|
+
var P = /\.(aac|flac|m4a|mp3|oga|ogg|opus|wav)$/i, F = /\.(m4v|mkv|mov|mp4|ogv|webm)$/i;
|
|
4
|
+
function I(e) {
|
|
5
5
|
try {
|
|
6
6
|
return new URL(e).pathname;
|
|
7
7
|
} catch {
|
|
8
8
|
return e.split(/[?#]/)[0] ?? e;
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
let t =
|
|
13
|
-
return
|
|
11
|
+
function L(e) {
|
|
12
|
+
let t = I(e);
|
|
13
|
+
return P.test(t) ? "audio" : F.test(t) ? "video" : "image";
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
return e ??
|
|
15
|
+
function R(e, t) {
|
|
16
|
+
return e ?? L(t);
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
return
|
|
18
|
+
function z(e, t) {
|
|
19
|
+
return R(e, t) !== "image";
|
|
20
20
|
}
|
|
21
21
|
//#endregion
|
|
22
22
|
//#region src/core/mediaAsset.ts
|
|
23
|
-
function
|
|
23
|
+
function B(e) {
|
|
24
24
|
return {
|
|
25
25
|
height: e.height,
|
|
26
26
|
src: e.src,
|
|
@@ -28,9 +28,9 @@ function R(e) {
|
|
|
28
28
|
width: e.width
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function V(e, t) {
|
|
32
32
|
if (t === "preview" && e.preview) {
|
|
33
|
-
let t =
|
|
33
|
+
let t = R(e.type, e.src) === "audio" ? R(e.preview.type, e.preview.src) : e.preview.type ?? e.type;
|
|
34
34
|
return {
|
|
35
35
|
...e.preview,
|
|
36
36
|
type: t
|
|
@@ -39,45 +39,45 @@ function z(e, t) {
|
|
|
39
39
|
return t === "mobile" && e.mobile ? {
|
|
40
40
|
...e.mobile,
|
|
41
41
|
type: e.mobile.type ?? e.type
|
|
42
|
-
} :
|
|
42
|
+
} : B(e);
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function H(e) {
|
|
45
45
|
let t = e.preview;
|
|
46
|
-
return !t?.src || t.src === e.src ||
|
|
46
|
+
return !t?.src || t.src === e.src || R(t.type, t.src) !== "image" ? null : {
|
|
47
47
|
...t,
|
|
48
48
|
type: "image"
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
|
-
function
|
|
52
|
-
return
|
|
51
|
+
function U(e, t) {
|
|
52
|
+
return R(e.type, e.src) === "audio" ? t === "mobile" && e.mobile && R(e.mobile.type, e.mobile.src) === "audio" ? {
|
|
53
53
|
...e.mobile,
|
|
54
54
|
type: "audio"
|
|
55
55
|
} : {
|
|
56
|
-
...
|
|
56
|
+
...B(e),
|
|
57
57
|
type: "audio"
|
|
58
|
-
} :
|
|
58
|
+
} : V(e, t);
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function W(e) {
|
|
61
61
|
return [e, ...e.items];
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function G(e, t) {
|
|
64
64
|
return Math.min(e.items.length, Math.max(0, t));
|
|
65
65
|
}
|
|
66
|
-
function
|
|
67
|
-
return
|
|
66
|
+
function K(e, t) {
|
|
67
|
+
return W(e)[G(e, t)] ?? e;
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function q(e, t) {
|
|
70
70
|
return `${String(e)}:${t}`;
|
|
71
71
|
}
|
|
72
72
|
//#endregion
|
|
73
73
|
//#region src/core/runtime.ts
|
|
74
|
-
function
|
|
74
|
+
function ee(e) {
|
|
75
75
|
return r(() => Object.freeze([...e.items]));
|
|
76
76
|
}
|
|
77
|
-
function
|
|
78
|
-
return n(
|
|
77
|
+
function J(e, t, n) {
|
|
78
|
+
return n(Y(e, t.value)), A(() => Y(e, t.value), n, { flush: "post" });
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function Y(e, t = [...e.items]) {
|
|
81
81
|
return {
|
|
82
82
|
activeReelPostId: e.activeReelPostId,
|
|
83
83
|
autoScroll: { ...e.autoScroll },
|
|
@@ -107,17 +107,17 @@ function te(e, t = [...e.items]) {
|
|
|
107
107
|
}
|
|
108
108
|
//#endregion
|
|
109
109
|
//#region src/components/GalleryFooter.vue?vue&type=script&setup=true&lang.ts
|
|
110
|
-
var
|
|
110
|
+
var te = {
|
|
111
111
|
key: 0,
|
|
112
112
|
class: "gallery-footer"
|
|
113
|
-
},
|
|
113
|
+
}, ne = {
|
|
114
114
|
key: 0,
|
|
115
115
|
class: "load-more-status",
|
|
116
116
|
role: "status"
|
|
117
|
-
},
|
|
117
|
+
}, re = ["disabled"], ie = {
|
|
118
118
|
key: 2,
|
|
119
119
|
class: "end-feed"
|
|
120
|
-
},
|
|
120
|
+
}, ae = ["disabled"], oe = /* @__PURE__ */ d({
|
|
121
121
|
__name: "GalleryFooter",
|
|
122
122
|
props: {
|
|
123
123
|
canRetryEnd: { type: Boolean },
|
|
@@ -133,14 +133,14 @@ var q = {
|
|
|
133
133
|
function i() {
|
|
134
134
|
n.loadMoreLocked || (n.hasNext ? r("loadMore") : r("retryEnd"));
|
|
135
135
|
}
|
|
136
|
-
return (t, n) => e.isLoading || e.hasError || e.hasNext && e.showLoadMore || !e.hasNext && e.canRetryEnd ? (
|
|
136
|
+
return (t, n) => e.isLoading || e.hasError || e.hasNext && e.showLoadMore || !e.hasNext && e.canRetryEnd ? (x(), s("footer", te, [e.isLoading ? (x(), s("p", ne, " Loading more… ")) : e.hasError || e.hasNext && e.showLoadMore ? (x(), s("button", {
|
|
137
137
|
key: 1,
|
|
138
138
|
"data-test": "load-more",
|
|
139
139
|
class: "load-more-button",
|
|
140
140
|
type: "button",
|
|
141
141
|
disabled: e.loadMoreLocked,
|
|
142
142
|
onClick: i
|
|
143
|
-
},
|
|
143
|
+
}, D(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9, re)) : (x(), s("div", ie, [n[1] ||= c("p", {
|
|
144
144
|
class: "end-feed-message",
|
|
145
145
|
role: "status"
|
|
146
146
|
}, " You've reached the end. ", -1), c("button", {
|
|
@@ -149,9 +149,9 @@ var q = {
|
|
|
149
149
|
type: "button",
|
|
150
150
|
disabled: e.loadMoreLocked,
|
|
151
151
|
onClick: n[0] ||= (e) => t.$emit("retryEnd")
|
|
152
|
-
}, " Check for more ", 8,
|
|
152
|
+
}, " Check for more ", 8, ae)]))])) : o("", !0);
|
|
153
153
|
}
|
|
154
|
-
}),
|
|
154
|
+
}), se = /* @__PURE__ */ d({
|
|
155
155
|
__name: "FeedFooter",
|
|
156
156
|
props: {
|
|
157
157
|
actions: {},
|
|
@@ -173,7 +173,7 @@ var q = {
|
|
|
173
173
|
function o() {
|
|
174
174
|
n.actions?.retry();
|
|
175
175
|
}
|
|
176
|
-
return (t, n) => e.feedFooter && e.actions && e.state ? (
|
|
176
|
+
return (t, n) => e.feedFooter && e.actions && e.state ? (x(), a(w(e.feedFooter.component), {
|
|
177
177
|
key: 0,
|
|
178
178
|
actions: e.actions,
|
|
179
179
|
"can-retry-end": e.canRetryEnd,
|
|
@@ -188,7 +188,7 @@ var q = {
|
|
|
188
188
|
"can-retry-end",
|
|
189
189
|
"show-load-more",
|
|
190
190
|
"state"
|
|
191
|
-
])) : (
|
|
191
|
+
])) : (x(), a(oe, {
|
|
192
192
|
key: 1,
|
|
193
193
|
"can-retry-end": e.canRetryEnd,
|
|
194
194
|
"has-error": e.hasError,
|
|
@@ -207,7 +207,7 @@ var q = {
|
|
|
207
207
|
"show-load-more"
|
|
208
208
|
]));
|
|
209
209
|
}
|
|
210
|
-
}),
|
|
210
|
+
}), ce = ["role"], X = { class: "gallery-status" }, le = /* @__PURE__ */ d({
|
|
211
211
|
__name: "FeedStatus",
|
|
212
212
|
props: {
|
|
213
213
|
actions: {},
|
|
@@ -218,10 +218,10 @@ var q = {
|
|
|
218
218
|
emits: ["loadMore", "retryEnd"],
|
|
219
219
|
setup(t, { emit: n }) {
|
|
220
220
|
let r = t, i = n;
|
|
221
|
-
return (n, u) => (
|
|
221
|
+
return (n, u) => (x(), s("main", {
|
|
222
222
|
class: "gallery-shell",
|
|
223
223
|
role: r.state.error ? "alert" : r.state.isLoading || r.state.isLoadingMore ? "status" : void 0
|
|
224
|
-
}, [c("p",
|
|
224
|
+
}, [c("p", X, [r.state.error ? (x(), s(e, { key: 0 }, [l(" Unable to load media. ")], 64)) : r.state.isLoading || r.state.isLoadingMore ? (x(), s(e, { key: 1 }, [l(" Loading media… ")], 64)) : (x(), s(e, { key: 2 }, [l(" No media found. ")], 64))]), t.feedFooter ? (x(), a(se, {
|
|
225
225
|
key: 0,
|
|
226
226
|
actions: t.actions,
|
|
227
227
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -243,37 +243,37 @@ var q = {
|
|
|
243
243
|
"is-loading",
|
|
244
244
|
"load-more-locked",
|
|
245
245
|
"state"
|
|
246
|
-
])) : o("", !0)], 8,
|
|
246
|
+
])) : o("", !0)], 8, ce));
|
|
247
247
|
}
|
|
248
248
|
});
|
|
249
|
-
function
|
|
249
|
+
function ue(e, t = 240) {
|
|
250
250
|
return e.scrollHeight - e.scrollTop - e.clientHeight <= t;
|
|
251
251
|
}
|
|
252
252
|
//#endregion
|
|
253
253
|
//#region src/core/masonry.ts
|
|
254
|
-
function
|
|
254
|
+
function Z(e) {
|
|
255
255
|
let t = e.preview?.width ?? e.width, n = e.preview?.height ?? e.height;
|
|
256
256
|
return !t || !n || t <= 0 || n <= 0 ? 1 : n / t;
|
|
257
257
|
}
|
|
258
|
-
function
|
|
258
|
+
function de(e) {
|
|
259
259
|
return e.reduce((t, n, r) => n < e[t] ? r : t, 0);
|
|
260
260
|
}
|
|
261
|
-
function
|
|
261
|
+
function fe(e) {
|
|
262
262
|
return Math.max(0, e.containerHeight) + Math.max(0, e.gap);
|
|
263
263
|
}
|
|
264
|
-
var
|
|
265
|
-
function
|
|
264
|
+
var pe = .8, Q = .5;
|
|
265
|
+
function me(e, t, n) {
|
|
266
266
|
let r = Math.max(0, n.viewportHeight);
|
|
267
267
|
if (r === 0) return [];
|
|
268
268
|
let i = n.scrollTop, a = i + r;
|
|
269
269
|
return t.filter((t) => {
|
|
270
270
|
let n = e[t];
|
|
271
271
|
if (!n || n.height <= 0) return !1;
|
|
272
|
-
let o = Math.max(0, Math.min(n.y + n.height, a) - Math.max(n.y, i)), s = n.height <= r ? n.height : r *
|
|
273
|
-
return o +
|
|
272
|
+
let o = Math.max(0, Math.min(n.y + n.height, a) - Math.max(n.y, i)), s = n.height <= r ? n.height : r * pe;
|
|
273
|
+
return o + Q >= s;
|
|
274
274
|
});
|
|
275
275
|
}
|
|
276
|
-
function
|
|
276
|
+
function he(e, t) {
|
|
277
277
|
if (e <= 0) return null;
|
|
278
278
|
let n = Math.max(0, t.gap), r = Number.isFinite(t.additionalHeight) ? Math.max(0, t.additionalHeight ?? 0) : 0, i = Math.max(1, t.minColumnWidth), a = Math.max(1, Math.floor((e + n) / (i + n)));
|
|
279
279
|
return {
|
|
@@ -283,8 +283,8 @@ function Q(e, t) {
|
|
|
283
283
|
itemWidth: (e - n * (a - 1)) / a
|
|
284
284
|
};
|
|
285
285
|
}
|
|
286
|
-
function
|
|
287
|
-
let r =
|
|
286
|
+
function ge(e, t, n) {
|
|
287
|
+
let r = de(t), i = n.itemWidth * Z(e) + n.additionalHeight, a = {
|
|
288
288
|
x: r * (n.itemWidth + n.gap),
|
|
289
289
|
y: t[r],
|
|
290
290
|
width: n.itemWidth,
|
|
@@ -292,48 +292,48 @@ function me(e, t, n) {
|
|
|
292
292
|
};
|
|
293
293
|
return t[r] += i + n.gap, a;
|
|
294
294
|
}
|
|
295
|
-
function
|
|
295
|
+
function _e(e, t) {
|
|
296
296
|
let n = Array.from({ length: t.columns }, () => 0), r = t.itemWidth + t.gap;
|
|
297
297
|
return e.forEach((e) => {
|
|
298
298
|
let i = r === 0 ? 0 : Math.round(e.x / r);
|
|
299
299
|
i < 0 || i >= t.columns || (n[i] = Math.max(n[i], e.y + e.height + t.gap));
|
|
300
300
|
}), n;
|
|
301
301
|
}
|
|
302
|
-
function
|
|
302
|
+
function ve(e, t) {
|
|
303
303
|
return e.length === 0 ? 0 : Math.max(0, Math.max(...e) - t);
|
|
304
304
|
}
|
|
305
|
-
function
|
|
306
|
-
let r =
|
|
305
|
+
function ye(e, t, n) {
|
|
306
|
+
let r = he(t, n);
|
|
307
307
|
if (!r || e.length === 0) return {
|
|
308
308
|
columns: 0,
|
|
309
309
|
height: 0,
|
|
310
310
|
items: []
|
|
311
311
|
};
|
|
312
|
-
let i = Array.from({ length: r.columns }, () => 0), a = e.map((e) =>
|
|
312
|
+
let i = Array.from({ length: r.columns }, () => 0), a = e.map((e) => ge(e, i, r));
|
|
313
313
|
return {
|
|
314
314
|
columns: r.columns,
|
|
315
|
-
height:
|
|
315
|
+
height: ve(i, r.gap),
|
|
316
316
|
items: a
|
|
317
317
|
};
|
|
318
318
|
}
|
|
319
|
-
function
|
|
320
|
-
let o =
|
|
319
|
+
function be(e, t, n, r, i, a) {
|
|
320
|
+
let o = he(t, n);
|
|
321
321
|
if (!o || e.length === 0) return {
|
|
322
322
|
columns: 0,
|
|
323
323
|
height: 0,
|
|
324
324
|
items: []
|
|
325
325
|
};
|
|
326
|
-
if (r.columns !== o.columns || i > 0 && r.items.length < i) return
|
|
327
|
-
let s = Math.max(0, i), c = a?.untilIndex ?? e.length, l = a?.untilBottom, u = a?.throughIndex ?? s, d = s === 0 ? [] : r.items.slice(0, s), f = s === 0 ? Array.from({ length: o.columns }, () => 0) :
|
|
328
|
-
for (let t = s; t < e.length && t < c && !(l !== void 0 && t > s && t > u && f.every((e) => e >= l)); t += 1) d.push(
|
|
326
|
+
if (r.columns !== o.columns || i > 0 && r.items.length < i) return ye(e, t, n);
|
|
327
|
+
let s = Math.max(0, i), c = a?.untilIndex ?? e.length, l = a?.untilBottom, u = a?.throughIndex ?? s, d = s === 0 ? [] : r.items.slice(0, s), f = s === 0 ? Array.from({ length: o.columns }, () => 0) : _e(d, o);
|
|
328
|
+
for (let t = s; t < e.length && t < c && !(l !== void 0 && t > s && t > u && f.every((e) => e >= l)); t += 1) d.push(ge(e[t], f, o));
|
|
329
329
|
return {
|
|
330
330
|
columns: o.columns,
|
|
331
|
-
height:
|
|
331
|
+
height: ve(f, o.gap),
|
|
332
332
|
items: d
|
|
333
333
|
};
|
|
334
334
|
}
|
|
335
|
-
function
|
|
336
|
-
let o =
|
|
335
|
+
function xe(e, t, n, r, i, a) {
|
|
336
|
+
let o = he(t, n);
|
|
337
337
|
if (!o || e.length === 0) return {
|
|
338
338
|
columns: 0,
|
|
339
339
|
fromIndex: 0,
|
|
@@ -342,7 +342,7 @@ function ye(e, t, n, r, i, a) {
|
|
|
342
342
|
retainedIndices: []
|
|
343
343
|
};
|
|
344
344
|
if (r.items.length !== e.length || r.columns !== o.columns) {
|
|
345
|
-
let a = e.map((e, t) => t).filter((e) => !i(e)), o =
|
|
345
|
+
let a = e.map((e, t) => t).filter((e) => !i(e)), o = ye(a.map((t) => e[t]), t, n), s = e.map((e, t) => r.items[t] ?? {
|
|
346
346
|
height: 0,
|
|
347
347
|
width: 0,
|
|
348
348
|
x: 0,
|
|
@@ -367,10 +367,10 @@ function ye(e, t, n, r, i, a) {
|
|
|
367
367
|
};
|
|
368
368
|
let c = r.items.slice(), l = [];
|
|
369
369
|
for (let e = 0; e < s; e += 1) l.push(e);
|
|
370
|
-
let u = a?.untilBottom, d = a?.throughIndex ?? s, f =
|
|
370
|
+
let u = a?.untilBottom, d = a?.throughIndex ?? s, f = _e(c.slice(0, s), o);
|
|
371
371
|
for (let t = s; t < e.length; t += 1) if (!i(t)) {
|
|
372
372
|
if (u !== void 0 && l.length > s && t > d && f.every((e) => e >= u)) break;
|
|
373
|
-
c[t] =
|
|
373
|
+
c[t] = ge(e[t], f, o), l.push(t);
|
|
374
374
|
}
|
|
375
375
|
let p = new Set(l);
|
|
376
376
|
for (let t = s; t < e.length; t += 1) i(t) || p.has(t) || (c[t] = {
|
|
@@ -382,17 +382,17 @@ function ye(e, t, n, r, i, a) {
|
|
|
382
382
|
return {
|
|
383
383
|
columns: o.columns,
|
|
384
384
|
fromIndex: s,
|
|
385
|
-
height:
|
|
385
|
+
height: ve(f, o.gap),
|
|
386
386
|
items: c,
|
|
387
387
|
retainedIndices: l
|
|
388
388
|
};
|
|
389
389
|
}
|
|
390
390
|
//#endregion
|
|
391
391
|
//#region src/core/masonryViewportIndex.ts
|
|
392
|
-
function
|
|
392
|
+
function Se(e) {
|
|
393
393
|
return { columns: [...e.entries()].sort(([e], [t]) => e - t).map(([, e]) => e.sort((e, t) => e.top - t.top || e.index - t.index)) };
|
|
394
394
|
}
|
|
395
|
-
function
|
|
395
|
+
function Ce(e, t, n) {
|
|
396
396
|
let r = e.get(t.x) ?? [];
|
|
397
397
|
r.push({
|
|
398
398
|
bottom: t.y + t.height,
|
|
@@ -400,14 +400,14 @@ function xe(e, t, n) {
|
|
|
400
400
|
top: t.y
|
|
401
401
|
}), e.set(t.x, r);
|
|
402
402
|
}
|
|
403
|
-
function
|
|
403
|
+
function we(e, t) {
|
|
404
404
|
let n = /* @__PURE__ */ new Map();
|
|
405
405
|
return e.forEach((e, r) => {
|
|
406
|
-
|
|
407
|
-
}),
|
|
406
|
+
Ce(n, e, t?.[r] ?? r);
|
|
407
|
+
}), Se(n);
|
|
408
408
|
}
|
|
409
|
-
function
|
|
410
|
-
if (n <= 0) return
|
|
409
|
+
function Te(e, t, n, r) {
|
|
410
|
+
if (n <= 0) return we(e, r);
|
|
411
411
|
let i = /* @__PURE__ */ new Map();
|
|
412
412
|
t.columns.forEach((t) => {
|
|
413
413
|
t.forEach((t) => {
|
|
@@ -418,11 +418,11 @@ function Ce(e, t, n, r) {
|
|
|
418
418
|
a.push(t), i.set(r.x, a);
|
|
419
419
|
});
|
|
420
420
|
});
|
|
421
|
-
for (let t = n; t < e.length; t += 1)
|
|
422
|
-
return
|
|
421
|
+
for (let t = n; t < e.length; t += 1) Ce(i, e[t], r?.[t] ?? t);
|
|
422
|
+
return Se(i);
|
|
423
423
|
}
|
|
424
|
-
function
|
|
425
|
-
if (r <= 0) return
|
|
424
|
+
function Ee(e, t, n, r) {
|
|
425
|
+
if (r <= 0) return we(t.map((t) => e[t]), t);
|
|
426
426
|
let i = /* @__PURE__ */ new Map();
|
|
427
427
|
return n.columns.forEach((t) => {
|
|
428
428
|
t.forEach((t) => {
|
|
@@ -433,10 +433,10 @@ function we(e, t, n, r) {
|
|
|
433
433
|
a.push(t), i.set(n.x, a);
|
|
434
434
|
});
|
|
435
435
|
}), t.forEach((t) => {
|
|
436
|
-
t < r ||
|
|
437
|
-
}),
|
|
436
|
+
t < r || Ce(i, e[t], t);
|
|
437
|
+
}), Se(i);
|
|
438
438
|
}
|
|
439
|
-
function
|
|
439
|
+
function De(e, t) {
|
|
440
440
|
let n = 0, r = 0, i = e.length;
|
|
441
441
|
for (; r < i;) {
|
|
442
442
|
let a = Math.floor((r + i) / 2);
|
|
@@ -447,10 +447,10 @@ function Te(e, t) {
|
|
|
447
447
|
inspected: n
|
|
448
448
|
};
|
|
449
449
|
}
|
|
450
|
-
function
|
|
450
|
+
function Oe(e, t) {
|
|
451
451
|
let n = Math.max(0, t.overscan), r = t.scrollTop - n, i = t.scrollTop + Math.max(0, t.viewportHeight) + n, a = [], o = 0;
|
|
452
452
|
return e.columns.forEach((e) => {
|
|
453
|
-
let t =
|
|
453
|
+
let t = De(e, r);
|
|
454
454
|
o += t.inspected;
|
|
455
455
|
for (let n = t.index; n < e.length; n += 1) {
|
|
456
456
|
let t = e[n];
|
|
@@ -462,14 +462,14 @@ function Ee(e, t) {
|
|
|
462
462
|
inspected: o
|
|
463
463
|
};
|
|
464
464
|
}
|
|
465
|
-
function
|
|
465
|
+
function ke(e) {
|
|
466
466
|
return e?.minColumnWidth ?? 240;
|
|
467
467
|
}
|
|
468
|
-
function
|
|
468
|
+
function Ae(e, t) {
|
|
469
469
|
let n = e?.overscan?.minimumPx ?? 800, r = e?.overscan?.viewportMultiplier ?? 1.5, i = Math.max(n, t * r), a = e?.overscan?.maximumPx;
|
|
470
470
|
return a === void 0 ? i : Math.min(i, a);
|
|
471
471
|
}
|
|
472
|
-
function
|
|
472
|
+
function je(e) {
|
|
473
473
|
for (let t of ["bottomSpacePx", "loadMoreThresholdPx"]) {
|
|
474
474
|
let n = e?.[t];
|
|
475
475
|
if (n !== void 0 && (!Number.isFinite(n) || n < 0)) throw TypeError(`Vibe masonry ${t} must be a finite non-negative number.`);
|
|
@@ -487,10 +487,10 @@ function ke(e) {
|
|
|
487
487
|
}
|
|
488
488
|
//#endregion
|
|
489
489
|
//#region src/core/scrollbar.ts
|
|
490
|
-
function
|
|
490
|
+
function Me(e, t, n) {
|
|
491
491
|
return Math.min(n, Math.max(t, e));
|
|
492
492
|
}
|
|
493
|
-
function
|
|
493
|
+
function Ne({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize: r, viewportSize: i }) {
|
|
494
494
|
let a = Math.max(0, e), o = Math.max(0, r), s = Math.max(0, i), c = Math.max(0, a - s);
|
|
495
495
|
if (!(c > 0 && o > 0)) return {
|
|
496
496
|
maximumScrollPosition: c,
|
|
@@ -499,23 +499,23 @@ function je({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize:
|
|
|
499
499
|
thumbSize: o,
|
|
500
500
|
thumbTravel: 0
|
|
501
501
|
};
|
|
502
|
-
let l =
|
|
502
|
+
let l = Me(s / a * o, Math.min(Math.max(0, t), o), o), u = Math.max(0, o - l);
|
|
503
503
|
return {
|
|
504
504
|
maximumScrollPosition: c,
|
|
505
505
|
scrollable: !0,
|
|
506
|
-
thumbOffset: u * (
|
|
506
|
+
thumbOffset: u * (Me(n, 0, c) / c),
|
|
507
507
|
thumbSize: l,
|
|
508
508
|
thumbTravel: u
|
|
509
509
|
};
|
|
510
510
|
}
|
|
511
511
|
//#endregion
|
|
512
512
|
//#region src/components/GalleryScrollbar.vue?vue&type=script&setup=true&lang.ts
|
|
513
|
-
var
|
|
513
|
+
var Pe = ["aria-hidden"], Fe = [
|
|
514
514
|
"aria-controls",
|
|
515
515
|
"aria-valuemax",
|
|
516
516
|
"aria-valuenow",
|
|
517
517
|
"tabindex"
|
|
518
|
-
],
|
|
518
|
+
], Ie = 32, Le = 40, Re = 120, ze = /* @__PURE__ */ d({
|
|
519
519
|
__name: "GalleryScrollbar",
|
|
520
520
|
props: {
|
|
521
521
|
contentSize: {},
|
|
@@ -530,23 +530,23 @@ var Me = ["aria-hidden"], Ne = [
|
|
|
530
530
|
thumbOffset: 0,
|
|
531
531
|
thumbSize: 0,
|
|
532
532
|
thumbTravel: 0
|
|
533
|
-
}, i =
|
|
533
|
+
}, i = E(null), a = E(n), o = E(!1), l = E(!1), u = E(!1), d = null, f = 0, p = 0, m = null, _ = null, b = null, S = null, C = !1, w = null, T = r(() => a.value.scrollable && !t.suspended), D = r(() => ({
|
|
534
534
|
height: `${a.value.thumbSize}px`,
|
|
535
535
|
transform: `translate3d(0, ${a.value.thumbOffset}px, 0)`
|
|
536
536
|
}));
|
|
537
|
-
function
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
},
|
|
537
|
+
function O() {
|
|
538
|
+
m !== null && clearTimeout(m), m = setTimeout(() => {
|
|
539
|
+
m = null, o.value || (l.value = !1);
|
|
540
|
+
}, Re);
|
|
541
541
|
}
|
|
542
|
-
function
|
|
543
|
-
l.value = !0,
|
|
542
|
+
function k() {
|
|
543
|
+
l.value = !0, O();
|
|
544
544
|
}
|
|
545
545
|
function j() {
|
|
546
546
|
let e = t.scrollElement, r = i.value;
|
|
547
|
-
return !e || !r ? n :
|
|
547
|
+
return !e || !r ? n : Ne({
|
|
548
548
|
contentSize: e.scrollHeight,
|
|
549
|
-
minimumThumbSize:
|
|
549
|
+
minimumThumbSize: Ie,
|
|
550
550
|
scrollPosition: e.scrollTop,
|
|
551
551
|
trackSize: r.clientHeight,
|
|
552
552
|
viewportSize: e.clientHeight
|
|
@@ -567,27 +567,27 @@ var Me = ["aria-hidden"], Ne = [
|
|
|
567
567
|
};
|
|
568
568
|
return;
|
|
569
569
|
}
|
|
570
|
-
a.value = j(), !(u.value ||
|
|
571
|
-
|
|
570
|
+
a.value = j(), !(u.value || _ !== null) && (_ = requestAnimationFrame(() => {
|
|
571
|
+
_ = null, u.value = !0;
|
|
572
572
|
}));
|
|
573
573
|
}
|
|
574
574
|
function N() {
|
|
575
|
-
|
|
575
|
+
k(), M("scroll");
|
|
576
576
|
}
|
|
577
577
|
function P(e) {
|
|
578
578
|
let n = t.scrollElement;
|
|
579
579
|
n && (n.scrollTop = Math.min(a.value.maximumScrollPosition, Math.max(0, e)), M("scroll"));
|
|
580
580
|
}
|
|
581
581
|
function F(e) {
|
|
582
|
-
if (!
|
|
582
|
+
if (!T.value || e.target !== e.currentTarget) return;
|
|
583
583
|
let t = i.value;
|
|
584
584
|
if (!t || a.value.thumbTravel <= 0) return;
|
|
585
|
-
e.preventDefault(),
|
|
585
|
+
e.preventDefault(), k();
|
|
586
586
|
let n = e.clientY - t.getBoundingClientRect().top - a.value.thumbSize / 2;
|
|
587
587
|
P(Math.min(1, Math.max(0, n / a.value.thumbTravel)) * a.value.maximumScrollPosition);
|
|
588
588
|
}
|
|
589
589
|
function I(e) {
|
|
590
|
-
|
|
590
|
+
T.value && (e.preventDefault(), e.stopPropagation(), e.currentTarget.setPointerCapture?.(e.pointerId), d = e.pointerId, f = e.clientY, p = t.scrollElement?.scrollTop ?? 0, o.value = !0, l.value = !0, m !== null && clearTimeout(m), m = null);
|
|
591
591
|
}
|
|
592
592
|
function L(e) {
|
|
593
593
|
if (!o.value || e.pointerId !== d || (e.preventDefault(), a.value.thumbTravel <= 0)) return;
|
|
@@ -595,12 +595,12 @@ var Me = ["aria-hidden"], Ne = [
|
|
|
595
595
|
P(p + t);
|
|
596
596
|
}
|
|
597
597
|
function R(e) {
|
|
598
|
-
!o.value || e.pointerId !== d || (e.currentTarget.releasePointerCapture?.(e.pointerId), d = null, o.value = !1, C && (C = !1, M("content")),
|
|
598
|
+
!o.value || e.pointerId !== d || (e.currentTarget.releasePointerCapture?.(e.pointerId), d = null, o.value = !1, C && (C = !1, M("content")), O());
|
|
599
599
|
}
|
|
600
600
|
function z(e) {
|
|
601
|
-
if (!
|
|
602
|
-
let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r -
|
|
603
|
-
i !== null && (e.preventDefault(),
|
|
601
|
+
if (!T.value) return;
|
|
602
|
+
let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r - Le : e.key === "ArrowDown" ? r + Le : e.key === "PageUp" ? r - n : e.key === "PageDown" ? r + n : e.key === "Home" ? 0 : e.key === "End" ? a.value.maximumScrollPosition : null;
|
|
603
|
+
i !== null && (e.preventDefault(), k(), P(i));
|
|
604
604
|
}
|
|
605
605
|
function B(e) {
|
|
606
606
|
if (S?.disconnect(), !(typeof ResizeObserver > "u")) {
|
|
@@ -608,26 +608,26 @@ var Me = ["aria-hidden"], Ne = [
|
|
|
608
608
|
for (let t of e.children) S.observe(t);
|
|
609
609
|
}
|
|
610
610
|
}
|
|
611
|
-
return
|
|
612
|
-
t?.removeEventListener("scroll", N),
|
|
613
|
-
|
|
614
|
-
}),
|
|
611
|
+
return A(() => t.scrollElement, (e, t) => {
|
|
612
|
+
t?.removeEventListener("scroll", N), b?.disconnect(), b = null, S?.disconnect(), S = null, w?.disconnect(), w = null, e?.addEventListener("scroll", N, { passive: !0 }), e && typeof ResizeObserver < "u" && (w = new ResizeObserver(() => {
|
|
613
|
+
k(), M("resize");
|
|
614
|
+
}), w.observe(e), B(e)), e && typeof MutationObserver < "u" && (b = new MutationObserver(() => {
|
|
615
615
|
B(e), M("content");
|
|
616
|
-
}),
|
|
617
|
-
}, { immediate: !0 }),
|
|
618
|
-
|
|
619
|
-
}),
|
|
620
|
-
t.scrollElement?.removeEventListener("scroll", N),
|
|
621
|
-
}), (t, n) => (
|
|
616
|
+
}), b.observe(e, { childList: !0 })), h(() => M("resize"));
|
|
617
|
+
}, { immediate: !0 }), A(() => t.contentSize, () => {
|
|
618
|
+
h(() => M("content"));
|
|
619
|
+
}), y(() => {
|
|
620
|
+
t.scrollElement?.removeEventListener("scroll", N), b?.disconnect(), S?.disconnect(), w?.disconnect(), m !== null && clearTimeout(m), _ !== null && cancelAnimationFrame(_);
|
|
621
|
+
}), (t, n) => (x(), s("div", {
|
|
622
622
|
ref_key: "trackElement",
|
|
623
623
|
ref: i,
|
|
624
|
-
class:
|
|
624
|
+
class: g(["gallery-scrollbar", {
|
|
625
625
|
"gallery-scrollbar--dragging": o.value,
|
|
626
626
|
"gallery-scrollbar--interacting": l.value,
|
|
627
627
|
"gallery-scrollbar--ready": u.value,
|
|
628
|
-
"gallery-scrollbar--visible":
|
|
628
|
+
"gallery-scrollbar--visible": T.value
|
|
629
629
|
}]),
|
|
630
|
-
"aria-hidden": !
|
|
630
|
+
"aria-hidden": !T.value || void 0,
|
|
631
631
|
onPointerdown: F
|
|
632
632
|
}, [c("div", {
|
|
633
633
|
class: "gallery-scrollbar-thumb",
|
|
@@ -638,22 +638,22 @@ var Me = ["aria-hidden"], Ne = [
|
|
|
638
638
|
"aria-valuemin": "0",
|
|
639
639
|
"aria-valuenow": Math.round(e.scrollElement?.scrollTop ?? 0),
|
|
640
640
|
role: "scrollbar",
|
|
641
|
-
style:
|
|
642
|
-
tabindex:
|
|
641
|
+
style: v(D.value),
|
|
642
|
+
tabindex: T.value ? 0 : -1,
|
|
643
643
|
onKeydown: z,
|
|
644
644
|
onPointercancel: R,
|
|
645
645
|
onPointerdown: I,
|
|
646
646
|
onPointermove: L,
|
|
647
647
|
onPointerup: R
|
|
648
|
-
}, null, 44,
|
|
648
|
+
}, null, 44, Fe)], 42, Pe));
|
|
649
649
|
}
|
|
650
|
-
}),
|
|
650
|
+
}), Be = (e) => {
|
|
651
651
|
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
|
652
652
|
return !1;
|
|
653
|
-
},
|
|
654
|
-
let t =
|
|
653
|
+
}, Ve = (e) => e === "", He = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), Ue = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), We = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), Ge = (e) => {
|
|
654
|
+
let t = We(e);
|
|
655
655
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
656
|
-
},
|
|
656
|
+
}, Ke = {
|
|
657
657
|
xmlns: "http://www.w3.org/2000/svg",
|
|
658
658
|
width: 24,
|
|
659
659
|
height: 24,
|
|
@@ -663,27 +663,27 @@ var Me = ["aria-hidden"], Ne = [
|
|
|
663
663
|
"stroke-width": 2,
|
|
664
664
|
"stroke-linecap": "round",
|
|
665
665
|
"stroke-linejoin": "round"
|
|
666
|
-
},
|
|
667
|
-
...
|
|
666
|
+
}, qe = ({ name: e, iconNode: t, absoluteStrokeWidth: n, "absolute-stroke-width": r, strokeWidth: i, "stroke-width": a, size: o = Ke.width, color: s = Ke.stroke, ...c }, { slots: l }) => p("svg", {
|
|
667
|
+
...Ke,
|
|
668
668
|
...c,
|
|
669
669
|
width: o,
|
|
670
670
|
height: o,
|
|
671
671
|
stroke: s,
|
|
672
|
-
"stroke-width":
|
|
673
|
-
class:
|
|
674
|
-
...!l.default && !
|
|
675
|
-
}, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]),
|
|
672
|
+
"stroke-width": Ve(n) || Ve(r) || n === !0 || r === !0 ? Number(i || a || Ke["stroke-width"]) * 24 / Number(o) : i || a || Ke["stroke-width"],
|
|
673
|
+
class: He("lucide", c.class, ...e ? [`lucide-${Ue(Ge(e))}-icon`, `lucide-${Ue(e)}`] : ["lucide-icon"]),
|
|
674
|
+
...!l.default && !Be(c) && { "aria-hidden": "true" }
|
|
675
|
+
}, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]), Je = (e, t) => (n, { slots: r, attrs: i }) => p(qe, {
|
|
676
676
|
...i,
|
|
677
677
|
...n,
|
|
678
678
|
iconNode: t,
|
|
679
679
|
name: e
|
|
680
|
-
}, r),
|
|
680
|
+
}, r), Ye = Je("chevron-left", [["path", {
|
|
681
681
|
d: "m15 18-6-6 6-6",
|
|
682
682
|
key: "1wnfg3"
|
|
683
|
-
}]]),
|
|
683
|
+
}]]), Xe = Je("chevron-right", [["path", {
|
|
684
684
|
d: "m9 18 6-6-6-6",
|
|
685
685
|
key: "mthhwq"
|
|
686
|
-
}]]),
|
|
686
|
+
}]]), Ze = Je("disc-3", [
|
|
687
687
|
["circle", {
|
|
688
688
|
cx: "12",
|
|
689
689
|
cy: "12",
|
|
@@ -704,7 +704,7 @@ var Me = ["aria-hidden"], Ne = [
|
|
|
704
704
|
d: "M18 12c0 1.7-.7 3.2-1.8 4.2",
|
|
705
705
|
key: "1eah9h"
|
|
706
706
|
}]
|
|
707
|
-
]),
|
|
707
|
+
]), Qe = Je("pause", [["rect", {
|
|
708
708
|
x: "14",
|
|
709
709
|
y: "3",
|
|
710
710
|
width: "5",
|
|
@@ -718,10 +718,10 @@ var Me = ["aria-hidden"], Ne = [
|
|
|
718
718
|
height: "18",
|
|
719
719
|
rx: "1",
|
|
720
720
|
key: "1wsw3u"
|
|
721
|
-
}]]),
|
|
721
|
+
}]]), $e = Je("play", [["path", {
|
|
722
722
|
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",
|
|
723
723
|
key: "10ikf1"
|
|
724
|
-
}]]),
|
|
724
|
+
}]]), et = Je("volume-2", [
|
|
725
725
|
["path", {
|
|
726
726
|
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",
|
|
727
727
|
key: "uqj9uw"
|
|
@@ -734,7 +734,7 @@ var Me = ["aria-hidden"], Ne = [
|
|
|
734
734
|
d: "M19.364 18.364a9 9 0 0 0 0-12.728",
|
|
735
735
|
key: "ijwkga"
|
|
736
736
|
}]
|
|
737
|
-
]),
|
|
737
|
+
]), tt = Je("volume-x", [
|
|
738
738
|
["path", {
|
|
739
739
|
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",
|
|
740
740
|
key: "uqj9uw"
|
|
@@ -753,22 +753,22 @@ var Me = ["aria-hidden"], Ne = [
|
|
|
753
753
|
y2: "15",
|
|
754
754
|
key: "5ykzw1"
|
|
755
755
|
}]
|
|
756
|
-
]),
|
|
756
|
+
]), nt = {
|
|
757
757
|
401: "Authentication required",
|
|
758
758
|
403: "Access forbidden",
|
|
759
759
|
404: "Preview not found",
|
|
760
760
|
419: "Session expired",
|
|
761
761
|
500: "Server error"
|
|
762
762
|
};
|
|
763
|
-
function
|
|
763
|
+
function rt(e) {
|
|
764
764
|
return e.match(/\/demo-errors\/(401|403|404|419|500)\//)?.[1] ?? "Error";
|
|
765
765
|
}
|
|
766
|
-
function
|
|
767
|
-
return
|
|
766
|
+
function it(e) {
|
|
767
|
+
return nt[rt(e)] ?? "Preview unavailable";
|
|
768
768
|
}
|
|
769
769
|
//#endregion
|
|
770
770
|
//#region src/components/CardRegion.vue
|
|
771
|
-
var
|
|
771
|
+
var at = /* @__PURE__ */ d({
|
|
772
772
|
__name: "CardRegion",
|
|
773
773
|
props: {
|
|
774
774
|
index: {},
|
|
@@ -783,17 +783,17 @@ var rt = /* @__PURE__ */ d({
|
|
|
783
783
|
total: {}
|
|
784
784
|
},
|
|
785
785
|
setup(e) {
|
|
786
|
-
let t = e, n = r(() =>
|
|
786
|
+
let t = e, n = r(() => G(t.item, t.mediaIndex)), i = r(() => W(t.item)), o = r(() => K(t.item, n.value)), c = r(() => ({
|
|
787
787
|
height: `${t.region.height}px`,
|
|
788
788
|
paddingBlock: t.style?.paddingY === void 0 ? void 0 : `${t.style.paddingY}px`,
|
|
789
789
|
paddingInline: t.style?.paddingX === void 0 ? void 0 : `${t.style.paddingX}px`
|
|
790
790
|
})), l = r(() => t.style?.background ?? t.region.background);
|
|
791
|
-
return (t, r) => (
|
|
792
|
-
class:
|
|
793
|
-
style:
|
|
794
|
-
onClick: r[0] ||=
|
|
795
|
-
onKeydown: r[1] ||=
|
|
796
|
-
}, [(
|
|
791
|
+
return (t, r) => (x(), s("div", {
|
|
792
|
+
class: g(["media-card-region", [`media-card-${e.placement}`, { "media-card-region--transparent": l.value === "transparent" }]]),
|
|
793
|
+
style: v(c.value),
|
|
794
|
+
onClick: r[0] ||= N(() => {}, ["stop"]),
|
|
795
|
+
onKeydown: r[1] ||= N(() => {}, ["stop"])
|
|
796
|
+
}, [(x(), a(w(e.region.component), {
|
|
797
797
|
index: e.index,
|
|
798
798
|
item: e.item,
|
|
799
799
|
layout: e.layout,
|
|
@@ -815,7 +815,7 @@ var rt = /* @__PURE__ */ d({
|
|
|
815
815
|
"total"
|
|
816
816
|
]))], 38));
|
|
817
817
|
}
|
|
818
|
-
}),
|
|
818
|
+
}), ot = ["aria-busy", "aria-label"], st = { class: "media-error-code" }, ct = ["disabled"], lt = /* @__PURE__ */ d({
|
|
819
819
|
__name: "MediaError",
|
|
820
820
|
props: {
|
|
821
821
|
component: {},
|
|
@@ -829,18 +829,18 @@ var rt = /* @__PURE__ */ d({
|
|
|
829
829
|
function o() {
|
|
830
830
|
r.retrying || i("retry");
|
|
831
831
|
}
|
|
832
|
-
return (n, r) => (
|
|
832
|
+
return (n, r) => (x(), s("div", {
|
|
833
833
|
"data-test": "media-error",
|
|
834
834
|
class: "media-error",
|
|
835
835
|
role: "group",
|
|
836
836
|
"aria-busy": t.retrying,
|
|
837
837
|
"aria-label": `${t.status} ${t.label}`
|
|
838
|
-
}, [t.component ? (
|
|
838
|
+
}, [t.component ? (x(), s("div", {
|
|
839
839
|
key: 0,
|
|
840
840
|
class: "media-error-component",
|
|
841
|
-
onClick: r[0] ||=
|
|
842
|
-
onKeydown: r[1] ||=
|
|
843
|
-
}, [(
|
|
841
|
+
onClick: r[0] ||= N(() => {}, ["stop"]),
|
|
842
|
+
onKeydown: r[1] ||= N(() => {}, ["stop"])
|
|
843
|
+
}, [(x(), a(w(t.component), {
|
|
844
844
|
label: t.label,
|
|
845
845
|
retry: o,
|
|
846
846
|
retrying: t.retrying,
|
|
@@ -849,36 +849,36 @@ var rt = /* @__PURE__ */ d({
|
|
|
849
849
|
"label",
|
|
850
850
|
"retrying",
|
|
851
851
|
"status"
|
|
852
|
-
]))], 32)) : (
|
|
853
|
-
c("strong",
|
|
854
|
-
c("span", null,
|
|
852
|
+
]))], 32)) : (x(), s(e, { key: 1 }, [
|
|
853
|
+
c("strong", st, D(t.status), 1),
|
|
854
|
+
c("span", null, D(t.label), 1),
|
|
855
855
|
c("button", {
|
|
856
856
|
"data-test": "media-retry",
|
|
857
857
|
class: "media-error-retry",
|
|
858
858
|
type: "button",
|
|
859
859
|
disabled: t.retrying,
|
|
860
|
-
onClick:
|
|
861
|
-
onKeydown: r[2] ||=
|
|
862
|
-
},
|
|
863
|
-
], 64))], 8,
|
|
860
|
+
onClick: N(o, ["stop"]),
|
|
861
|
+
onKeydown: r[2] ||= N(() => {}, ["stop"])
|
|
862
|
+
}, D(t.retrying ? "Retrying…" : "Retry"), 41, ct)
|
|
863
|
+
], 64))], 8, ot));
|
|
864
864
|
}
|
|
865
|
-
}),
|
|
865
|
+
}), ut = ["aria-label"], dt = [
|
|
866
866
|
"max",
|
|
867
867
|
"value",
|
|
868
868
|
"aria-label",
|
|
869
869
|
"aria-valuetext",
|
|
870
870
|
"disabled"
|
|
871
|
-
],
|
|
871
|
+
], ft = {
|
|
872
872
|
key: 0,
|
|
873
873
|
class: "media-controls-row"
|
|
874
|
-
},
|
|
874
|
+
}, pt = ["aria-label", "title"], mt = { class: "media-controls-audio" }, ht = ["aria-label", "title"], gt = [
|
|
875
875
|
"value",
|
|
876
876
|
"aria-label",
|
|
877
877
|
"aria-valuetext"
|
|
878
|
-
],
|
|
878
|
+
], _t = {
|
|
879
879
|
class: "media-control-time",
|
|
880
880
|
"aria-live": "off"
|
|
881
|
-
},
|
|
881
|
+
}, vt = /* @__PURE__ */ d({
|
|
882
882
|
__name: "MediaControls",
|
|
883
883
|
props: {
|
|
884
884
|
currentTime: {},
|
|
@@ -910,75 +910,75 @@ var rt = /* @__PURE__ */ d({
|
|
|
910
910
|
function f(e) {
|
|
911
911
|
e.key !== "Escape" && e.stopPropagation();
|
|
912
912
|
}
|
|
913
|
-
let p = r(() => Math.max(0, n.duration)), m = r(() => n.mediaType === "audio" ? "audio" : "video"),
|
|
914
|
-
return (t, n) => (
|
|
915
|
-
class:
|
|
913
|
+
let p = r(() => Math.max(0, n.duration)), m = r(() => n.mediaType === "audio" ? "audio" : "video"), h = r(() => n.mediaType === "audio" ? "Audio" : "Video"), _ = r(() => l(n.currentTime, p.value)), y = r(() => ({ "--media-range-progress": `${p.value > 0 ? _.value / p.value * 100 : 0}%` })), b = r(() => ({ "--media-range-progress": `${l(n.volume) * 100}%` }));
|
|
914
|
+
return (t, n) => (x(), s("div", {
|
|
915
|
+
class: g(["media-controls", `media-controls--${e.layout}`]),
|
|
916
916
|
role: "group",
|
|
917
|
-
"aria-label": `${
|
|
918
|
-
onClick: n[4] ||=
|
|
919
|
-
onDblclick: n[5] ||=
|
|
917
|
+
"aria-label": `${h.value} controls`,
|
|
918
|
+
onClick: n[4] ||= N(() => {}, ["stop"]),
|
|
919
|
+
onDblclick: n[5] ||= N(() => {}, ["stop"]),
|
|
920
920
|
onKeydown: f,
|
|
921
|
-
onWheel: n[6] ||=
|
|
921
|
+
onWheel: n[6] ||= N(() => {}, ["stop"])
|
|
922
922
|
}, [c("input", {
|
|
923
923
|
class: "media-control-range media-control-seek",
|
|
924
924
|
type: "range",
|
|
925
925
|
min: "0",
|
|
926
926
|
max: p.value || 0,
|
|
927
927
|
step: "0.1",
|
|
928
|
-
value:
|
|
929
|
-
style:
|
|
928
|
+
value: _.value,
|
|
929
|
+
style: v(y.value),
|
|
930
930
|
"aria-label": `Seek ${m.value}`,
|
|
931
|
-
"aria-valuetext": `${u(
|
|
931
|
+
"aria-valuetext": `${u(_.value)} of ${u(p.value)}`,
|
|
932
932
|
disabled: p.value <= 0,
|
|
933
933
|
onInput: n[0] ||= (e) => i("seek", d(e))
|
|
934
|
-
}, null, 44,
|
|
934
|
+
}, null, 44, dt), e.layout === "reel" ? (x(), s("div", ft, [
|
|
935
935
|
c("button", {
|
|
936
936
|
type: "button",
|
|
937
937
|
class: "media-control-button media-control-playback",
|
|
938
938
|
"aria-label": e.playing ? `Pause ${m.value}` : `Play ${m.value}`,
|
|
939
939
|
title: e.playing ? "Pause" : "Play",
|
|
940
940
|
onClick: n[1] ||= (e) => i("togglePlayback")
|
|
941
|
-
}, [e.playing ? (
|
|
941
|
+
}, [e.playing ? (x(), a(O(Qe), {
|
|
942
942
|
key: 0,
|
|
943
943
|
size: 18,
|
|
944
944
|
fill: "currentColor"
|
|
945
|
-
})) : (
|
|
945
|
+
})) : (x(), a(O($e), {
|
|
946
946
|
key: 1,
|
|
947
947
|
size: 18,
|
|
948
948
|
fill: "currentColor"
|
|
949
|
-
}))], 8,
|
|
950
|
-
c("div",
|
|
949
|
+
}))], 8, pt),
|
|
950
|
+
c("div", mt, [c("button", {
|
|
951
951
|
type: "button",
|
|
952
952
|
class: "media-control-button",
|
|
953
953
|
"aria-label": e.muted ? `Unmute ${m.value}` : `Mute ${m.value}`,
|
|
954
954
|
title: e.muted ? "Unmute" : "Mute",
|
|
955
955
|
onClick: n[2] ||= (e) => i("toggleMute")
|
|
956
|
-
}, [e.muted || e.volume === 0 ? (
|
|
956
|
+
}, [e.muted || e.volume === 0 ? (x(), a(O(tt), {
|
|
957
957
|
key: 0,
|
|
958
958
|
size: 18
|
|
959
|
-
})) : (
|
|
959
|
+
})) : (x(), a(O(et), {
|
|
960
960
|
key: 1,
|
|
961
961
|
size: 18
|
|
962
|
-
}))], 8,
|
|
962
|
+
}))], 8, ht), c("input", {
|
|
963
963
|
class: "media-control-range media-control-volume",
|
|
964
964
|
type: "range",
|
|
965
965
|
min: "0",
|
|
966
966
|
max: "1",
|
|
967
967
|
step: "0.05",
|
|
968
968
|
value: e.volume,
|
|
969
|
-
style:
|
|
970
|
-
"aria-label": `${
|
|
969
|
+
style: v(b.value),
|
|
970
|
+
"aria-label": `${h.value} volume`,
|
|
971
971
|
"aria-valuetext": `${Math.round(e.volume * 100)} percent`,
|
|
972
972
|
onInput: n[3] ||= (e) => i("volumeChange", d(e))
|
|
973
|
-
}, null, 44,
|
|
974
|
-
c("output",
|
|
975
|
-
])) : o("", !0)], 42,
|
|
973
|
+
}, null, 44, gt)]),
|
|
974
|
+
c("output", _t, D(u(_.value)) + " / " + D(u(p.value)), 1)
|
|
975
|
+
])) : o("", !0)], 42, ut));
|
|
976
976
|
}
|
|
977
|
-
}),
|
|
977
|
+
}), yt = {
|
|
978
978
|
key: 0,
|
|
979
979
|
class: "media-card-overlay-host",
|
|
980
980
|
"data-test": "media-card-overlay"
|
|
981
|
-
},
|
|
981
|
+
}, bt = /* @__PURE__ */ d({
|
|
982
982
|
__name: "MediaContextOverlay",
|
|
983
983
|
props: {
|
|
984
984
|
item: {},
|
|
@@ -988,7 +988,7 @@ var rt = /* @__PURE__ */ d({
|
|
|
988
988
|
mediaSource: {}
|
|
989
989
|
},
|
|
990
990
|
setup(e) {
|
|
991
|
-
return (t, n) => e.mediaCard?.overlay?.component ? (
|
|
991
|
+
return (t, n) => e.mediaCard?.overlay?.component ? (x(), s("div", yt, [(x(), a(w(e.mediaCard.overlay.component), {
|
|
992
992
|
item: e.item,
|
|
993
993
|
"media-index": e.mediaIndex,
|
|
994
994
|
"media-item": e.mediaItem,
|
|
@@ -1000,26 +1000,26 @@ var rt = /* @__PURE__ */ d({
|
|
|
1000
1000
|
"media-source"
|
|
1001
1001
|
]))])) : o("", !0);
|
|
1002
1002
|
}
|
|
1003
|
-
}),
|
|
1004
|
-
function
|
|
1005
|
-
let t =
|
|
1003
|
+
}), xt = 40, St = 160, Ct = 24;
|
|
1004
|
+
function wt(e) {
|
|
1005
|
+
let t = E("next"), n = null, r = 0, i = !1, a = null, o = null;
|
|
1006
1006
|
function s(n, r) {
|
|
1007
|
-
let i =
|
|
1007
|
+
let i = W(e.item()).length, a = (n + i) % i;
|
|
1008
1008
|
a !== e.mediaIndex() && (t.value = n < e.mediaIndex() ? "previous" : "next", e.onChange(a), r?.detail && r.detail > 0 && r.currentTarget?.blur());
|
|
1009
1009
|
}
|
|
1010
1010
|
function c() {
|
|
1011
1011
|
r = 0, i = !1, n !== null && clearTimeout(n), n = null;
|
|
1012
1012
|
}
|
|
1013
1013
|
function l() {
|
|
1014
|
-
n !== null && clearTimeout(n), n = setTimeout(c,
|
|
1014
|
+
n !== null && clearTimeout(n), n = setTimeout(c, St);
|
|
1015
1015
|
}
|
|
1016
1016
|
function u(e, t, n) {
|
|
1017
1017
|
return t === 1 ? e * 16 : t === 2 ? e * n : e;
|
|
1018
1018
|
}
|
|
1019
1019
|
function d(t) {
|
|
1020
|
-
if (
|
|
1020
|
+
if (W(e.item()).length <= 1) return;
|
|
1021
1021
|
let n = t.currentTarget, a = u(t.deltaX, t.deltaMode, n?.clientWidth || 1);
|
|
1022
|
-
if (a === 0 || (t.preventDefault(), l(), i) || (r += a, Math.abs(r) <
|
|
1022
|
+
if (a === 0 || (t.preventDefault(), l(), i) || (r += a, Math.abs(r) < Ct)) return;
|
|
1023
1023
|
let o = Math.sign(r);
|
|
1024
1024
|
r = 0, i = !0, s(e.mediaIndex() + o);
|
|
1025
1025
|
}
|
|
@@ -1031,9 +1031,9 @@ function St(e) {
|
|
|
1031
1031
|
let n = t.changedTouches[0];
|
|
1032
1032
|
if (a === null || o === null || !n) return;
|
|
1033
1033
|
let r = a - n.clientX, i = o - n.clientY;
|
|
1034
|
-
a = null, o = null, !(Math.abs(r) <= Math.abs(i)) && (Math.abs(r) <
|
|
1034
|
+
a = null, o = null, !(Math.abs(r) <= Math.abs(i)) && (Math.abs(r) < xt || s(e.mediaIndex() + Math.sign(r)));
|
|
1035
1035
|
}
|
|
1036
|
-
return
|
|
1036
|
+
return y(c), {
|
|
1037
1037
|
change: s,
|
|
1038
1038
|
direction: t,
|
|
1039
1039
|
onTouchEnd: p,
|
|
@@ -1041,14 +1041,14 @@ function St(e) {
|
|
|
1041
1041
|
onWheel: d
|
|
1042
1042
|
};
|
|
1043
1043
|
}
|
|
1044
|
-
var
|
|
1045
|
-
function
|
|
1044
|
+
var Tt = /* @__PURE__ */ new Map(), Et = [], Dt = 0, Ot = 0;
|
|
1045
|
+
function kt(e, t) {
|
|
1046
1046
|
return `${t ? "timed" : "image"}:${e}`;
|
|
1047
1047
|
}
|
|
1048
|
-
function
|
|
1049
|
-
let r =
|
|
1048
|
+
function At(e, t, n) {
|
|
1049
|
+
let r = W(e);
|
|
1050
1050
|
if (r.length < 2) return [];
|
|
1051
|
-
let i =
|
|
1051
|
+
let i = G(e, t), a = [];
|
|
1052
1052
|
for (let e = 1; e < r.length; e += 1) {
|
|
1053
1053
|
let t = i + e, n = i - e;
|
|
1054
1054
|
t < r.length && a.push(t), n >= 0 && a.push(n);
|
|
@@ -1057,9 +1057,9 @@ function Ot(e, t, n) {
|
|
|
1057
1057
|
return a.flatMap((e) => {
|
|
1058
1058
|
let t = r[e];
|
|
1059
1059
|
if (!t) return [];
|
|
1060
|
-
let i =
|
|
1060
|
+
let i = R(t.type, t.src) === "audio" ? H(t) : V(t, n);
|
|
1061
1061
|
if (!i) return [];
|
|
1062
|
-
let a =
|
|
1062
|
+
let a = z(i.type, i.src), s = kt(i.src, a);
|
|
1063
1063
|
return o.has(s) ? [] : (o.add(s), [{
|
|
1064
1064
|
key: s,
|
|
1065
1065
|
src: i.src,
|
|
@@ -1067,22 +1067,22 @@ function Ot(e, t, n) {
|
|
|
1067
1067
|
}]);
|
|
1068
1068
|
});
|
|
1069
1069
|
}
|
|
1070
|
-
function
|
|
1070
|
+
function jt(e) {
|
|
1071
1071
|
let t = e.element;
|
|
1072
1072
|
e.element = null, t && (t instanceof HTMLVideoElement ? (t.pause(), t.removeAttribute("src"), t.load()) : t.removeAttribute("src"));
|
|
1073
1073
|
}
|
|
1074
|
-
function
|
|
1075
|
-
|
|
1076
|
-
let t =
|
|
1077
|
-
t >= 0 &&
|
|
1074
|
+
function Mt(e) {
|
|
1075
|
+
Tt.delete(e.key);
|
|
1076
|
+
let t = Et.indexOf(e);
|
|
1077
|
+
t >= 0 && Et.splice(t, 1), e.cancel?.(), e.cancel = null, jt(e);
|
|
1078
1078
|
}
|
|
1079
|
-
function
|
|
1080
|
-
e.state = "loading",
|
|
1079
|
+
function Nt(e) {
|
|
1080
|
+
e.state = "loading", Dt += 1, e.timed && (Ot += 1);
|
|
1081
1081
|
let t = !1, n = () => void 0, r = (r) => {
|
|
1082
|
-
t || (t = !0, n(), --
|
|
1082
|
+
t || (t = !0, n(), --Dt, e.timed && --Ot, e.cancel = null, e.state = r, r === "failed" && jt(e), e.refs === 0 && Mt(e), Pt());
|
|
1083
1083
|
};
|
|
1084
1084
|
if (e.cancel = () => {
|
|
1085
|
-
t || (t = !0, n(), --
|
|
1085
|
+
t || (t = !0, n(), --Dt, e.timed && --Ot, jt(e), Pt());
|
|
1086
1086
|
}, e.timed) {
|
|
1087
1087
|
let t = document.createElement("video"), i = () => r("ready"), a = () => r("failed");
|
|
1088
1088
|
n = () => {
|
|
@@ -1101,50 +1101,50 @@ function jt(e) {
|
|
|
1101
1101
|
i.removeEventListener("load", a), i.removeEventListener("error", o);
|
|
1102
1102
|
}, i.addEventListener("load", a, { once: !0 }), i.addEventListener("error", o, { once: !0 }), i.decoding = "async", i.fetchPriority = "low", i.src = e.src, e.element = i;
|
|
1103
1103
|
}
|
|
1104
|
-
function
|
|
1105
|
-
for (;
|
|
1106
|
-
let e =
|
|
1104
|
+
function Pt() {
|
|
1105
|
+
for (; Dt < 6;) {
|
|
1106
|
+
let e = Et.findIndex((e) => e.refs > 0 && e.state === "queued" && (!e.timed || Ot < 2));
|
|
1107
1107
|
if (e < 0) return;
|
|
1108
|
-
let [t] =
|
|
1109
|
-
t &&
|
|
1108
|
+
let [t] = Et.splice(e, 1);
|
|
1109
|
+
t && Nt(t);
|
|
1110
1110
|
}
|
|
1111
1111
|
}
|
|
1112
|
-
function
|
|
1113
|
-
let t =
|
|
1112
|
+
function Ft(e) {
|
|
1113
|
+
let t = Tt.get(e.key);
|
|
1114
1114
|
t || (t = {
|
|
1115
1115
|
...e,
|
|
1116
1116
|
cancel: null,
|
|
1117
1117
|
element: null,
|
|
1118
1118
|
refs: 0,
|
|
1119
1119
|
state: "queued"
|
|
1120
|
-
},
|
|
1120
|
+
}, Tt.set(t.key, t), Et.push(t)), t.refs += 1, Pt();
|
|
1121
1121
|
let n = !1;
|
|
1122
1122
|
return () => {
|
|
1123
|
-
n || (n = !0, --t.refs, t.refs === 0 &&
|
|
1123
|
+
n || (n = !0, --t.refs, t.refs === 0 && Mt(t));
|
|
1124
1124
|
};
|
|
1125
1125
|
}
|
|
1126
1126
|
//#endregion
|
|
1127
1127
|
//#region src/components/useVisiblePostPreload.ts
|
|
1128
|
-
function
|
|
1129
|
-
let t = r(() => e.layout() === "masonry" && e.inViewport() && e.mediaReady() && e.mediaCard()?.feedPreload === "visible-post"), n = r(() => t.value ?
|
|
1128
|
+
function It(e) {
|
|
1129
|
+
let t = r(() => e.layout() === "masonry" && e.inViewport() && e.mediaReady() && e.mediaCard()?.feedPreload === "visible-post"), n = r(() => t.value ? At(e.item(), e.mediaIndex(), e.mediaSource()) : []), i = /* @__PURE__ */ new Map();
|
|
1130
1130
|
function a() {
|
|
1131
1131
|
let e = new Map(n.value.map((e) => [e.key, e]));
|
|
1132
1132
|
i.forEach((t, n) => {
|
|
1133
1133
|
e.has(n) || (t(), i.delete(n));
|
|
1134
1134
|
}), n.value.forEach((e) => {
|
|
1135
|
-
i.has(e.key) || i.set(e.key,
|
|
1135
|
+
i.has(e.key) || i.set(e.key, Ft(e));
|
|
1136
1136
|
});
|
|
1137
1137
|
}
|
|
1138
|
-
|
|
1138
|
+
A(() => n.value.map(({ key: e }) => e).join("\n"), a, { immediate: !0 }), y(() => {
|
|
1139
1139
|
i.forEach((e) => e()), i.clear();
|
|
1140
1140
|
});
|
|
1141
1141
|
}
|
|
1142
1142
|
//#endregion
|
|
1143
1143
|
//#region src/components/useMediaLoading.ts
|
|
1144
|
-
function
|
|
1145
|
-
let t = r(() =>
|
|
1146
|
-
return
|
|
1147
|
-
n !== "none" || t === "none" ||
|
|
1144
|
+
function Lt(e) {
|
|
1145
|
+
let t = r(() => z(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");
|
|
1146
|
+
return A(i, (t, n) => {
|
|
1147
|
+
n !== "none" || t === "none" || h(() => e.mediaElement.value?.load());
|
|
1148
1148
|
}), {
|
|
1149
1149
|
imageLoading: n,
|
|
1150
1150
|
mediaIsTimed: t,
|
|
@@ -1153,58 +1153,58 @@ function Ft(e) {
|
|
|
1153
1153
|
}
|
|
1154
1154
|
//#endregion
|
|
1155
1155
|
//#region src/components/useMediaReadiness.ts
|
|
1156
|
-
function
|
|
1157
|
-
let t =
|
|
1158
|
-
function
|
|
1156
|
+
function Rt(e) {
|
|
1157
|
+
let t = E(null), n = E(null), i = E(0), a = E(0), o = E(!0), s = E(!1), c = E(!1), l = null, u = !1, d = !1, f = !1, p = r(() => c.value || s.value ? "error" : o.value ? "loading" : e.previewState());
|
|
1158
|
+
function m() {
|
|
1159
1159
|
l !== null && clearTimeout(l), l = null;
|
|
1160
1160
|
}
|
|
1161
1161
|
function g(e) {
|
|
1162
1162
|
return Number(e.currentTarget.dataset.sourceGeneration) === i.value;
|
|
1163
1163
|
}
|
|
1164
1164
|
function _() {
|
|
1165
|
-
|
|
1165
|
+
m(), l = setTimeout(() => x(), 15e3);
|
|
1166
1166
|
}
|
|
1167
|
-
function
|
|
1168
|
-
t && !g(t) || (
|
|
1167
|
+
function v(t) {
|
|
1168
|
+
t && !g(t) || (m(), o.value = !1, s.value = !1, c.value = !1, e.onReady(e.mediaIndex()));
|
|
1169
1169
|
}
|
|
1170
1170
|
function b() {
|
|
1171
1171
|
if (f) return;
|
|
1172
1172
|
let e = t.value;
|
|
1173
1173
|
if (e?.complete) {
|
|
1174
|
-
e.naturalWidth > 0 ?
|
|
1174
|
+
e.naturalWidth > 0 ? v() : x(void 0, !0);
|
|
1175
1175
|
return;
|
|
1176
1176
|
}
|
|
1177
1177
|
let r = n.value;
|
|
1178
1178
|
if (r && r.readyState >= HTMLMediaElement.HAVE_METADATA) {
|
|
1179
|
-
|
|
1179
|
+
v();
|
|
1180
1180
|
return;
|
|
1181
1181
|
}
|
|
1182
1182
|
_();
|
|
1183
1183
|
}
|
|
1184
1184
|
function x(t, n = !1) {
|
|
1185
1185
|
if (!f && !(t && !g(t)) && !(s.value && !c.value && (!t || d))) {
|
|
1186
|
-
if (
|
|
1187
|
-
a.value = 1, i.value += 1, o.value = !0,
|
|
1186
|
+
if (m(), !t && a.value === 0) {
|
|
1187
|
+
a.value = 1, i.value += 1, o.value = !0, h(b);
|
|
1188
1188
|
return;
|
|
1189
1189
|
}
|
|
1190
1190
|
o.value = !1, s.value = !0, c.value = !1, d = !!t || n, e.onError(e.mediaIndex(), d);
|
|
1191
1191
|
}
|
|
1192
1192
|
}
|
|
1193
1193
|
function S() {
|
|
1194
|
-
c.value || p.value !== "error" || (d = !1, a.value = 0, s.value = !0, o.value = !0, c.value = !0, i.value += 1,
|
|
1194
|
+
c.value || p.value !== "error" || (d = !1, a.value = 0, s.value = !0, o.value = !0, c.value = !0, i.value += 1, h(b));
|
|
1195
1195
|
}
|
|
1196
1196
|
function C(e) {
|
|
1197
1197
|
g(e) && o.value && _();
|
|
1198
1198
|
}
|
|
1199
|
-
return
|
|
1200
|
-
|
|
1201
|
-
}, { immediate: !0 }),
|
|
1202
|
-
f = !0,
|
|
1199
|
+
return A(e.identity, () => {
|
|
1200
|
+
m(), i.value += 1, d = !1, a.value = 0, o.value = u || e.previewState() === "loading", s.value = !1, c.value = !1, u = !0, h(b);
|
|
1201
|
+
}, { immediate: !0 }), y(() => {
|
|
1202
|
+
f = !0, m();
|
|
1203
1203
|
}), {
|
|
1204
1204
|
effectivePreviewState: p,
|
|
1205
1205
|
failSourceAttempt: x,
|
|
1206
1206
|
imageElement: t,
|
|
1207
|
-
markSourceReady:
|
|
1207
|
+
markSourceReady: v,
|
|
1208
1208
|
noteSourceActivity: C,
|
|
1209
1209
|
retrySource: S,
|
|
1210
1210
|
retrying: c,
|
|
@@ -1214,30 +1214,30 @@ function It(e) {
|
|
|
1214
1214
|
}
|
|
1215
1215
|
//#endregion
|
|
1216
1216
|
//#region src/core/reelAudio.ts
|
|
1217
|
-
var
|
|
1217
|
+
var zt = {
|
|
1218
1218
|
lastAudibleVolume: 1,
|
|
1219
1219
|
muted: !1,
|
|
1220
1220
|
volume: 1
|
|
1221
1221
|
};
|
|
1222
|
-
function
|
|
1222
|
+
function Bt(e, t) {
|
|
1223
1223
|
return typeof e == "number" && Number.isFinite(e) ? Math.min(1, Math.max(0, e)) : t;
|
|
1224
1224
|
}
|
|
1225
|
-
function
|
|
1226
|
-
let n =
|
|
1225
|
+
function Vt(e, t = zt) {
|
|
1226
|
+
let n = Bt(e?.volume, t.volume), r = Bt(e?.lastAudibleVolume, n > 0 ? n : t.lastAudibleVolume);
|
|
1227
1227
|
return {
|
|
1228
|
-
lastAudibleVolume: r > 0 ? r :
|
|
1228
|
+
lastAudibleVolume: r > 0 ? r : zt.lastAudibleVolume,
|
|
1229
1229
|
muted: typeof e?.muted == "boolean" ? e.muted : n === 0 || t.muted,
|
|
1230
1230
|
volume: n
|
|
1231
1231
|
};
|
|
1232
1232
|
}
|
|
1233
1233
|
//#endregion
|
|
1234
1234
|
//#region src/components/useMediaCardAudio.ts
|
|
1235
|
-
function
|
|
1236
|
-
let t =
|
|
1235
|
+
function Ht(e) {
|
|
1236
|
+
let t = Vt(e.reelAudioState()), n = e.layout() === "reel" && e.reelAudioState(), r = E(n ? t.muted : e.mediaCard()?.videoMuted ?? e.layout() === "masonry"), i = E(n ? t.volume : 1), a = n ? t.lastAudibleVolume : 1;
|
|
1237
1237
|
function o() {
|
|
1238
1238
|
let t = e.mediaElement.value, n = e.reelAudioState();
|
|
1239
1239
|
if (!t || e.layout() !== "reel" || !n) return;
|
|
1240
|
-
let o =
|
|
1240
|
+
let o = Vt(n);
|
|
1241
1241
|
a = o.lastAudibleVolume, i.value = o.volume, r.value = o.muted, t.volume = o.volume, t.muted = e.active() === !1 ? !0 : o.muted;
|
|
1242
1242
|
}
|
|
1243
1243
|
function s(e, t) {
|
|
@@ -1245,7 +1245,7 @@ function Bt(e) {
|
|
|
1245
1245
|
}
|
|
1246
1246
|
function c(t) {
|
|
1247
1247
|
if (e.layout() !== "reel") return;
|
|
1248
|
-
let n =
|
|
1248
|
+
let n = Vt({
|
|
1249
1249
|
lastAudibleVolume: a,
|
|
1250
1250
|
muted: t.muted,
|
|
1251
1251
|
volume: t.volume
|
|
@@ -1262,7 +1262,7 @@ function Bt(e) {
|
|
|
1262
1262
|
let t = e.mediaElement.value;
|
|
1263
1263
|
t && (t.muted && t.volume === 0 && (t.volume = a), t.muted = !t.muted, s(t, !0), c(t));
|
|
1264
1264
|
}
|
|
1265
|
-
return
|
|
1265
|
+
return A([
|
|
1266
1266
|
e.active,
|
|
1267
1267
|
e.layout,
|
|
1268
1268
|
() => e.reelAudioState()?.lastAudibleVolume,
|
|
@@ -1280,7 +1280,7 @@ function Bt(e) {
|
|
|
1280
1280
|
}
|
|
1281
1281
|
//#endregion
|
|
1282
1282
|
//#region src/components/useReelVideoActivity.ts
|
|
1283
|
-
function
|
|
1283
|
+
function Ut(e) {
|
|
1284
1284
|
let t = r(() => e.layout() === "reel" ? e.active() === !0 : e.inViewport()), n = r(() => t.value ? e.mediaIsMuted.value : !0);
|
|
1285
1285
|
function i() {
|
|
1286
1286
|
if (!t.value) {
|
|
@@ -1289,13 +1289,13 @@ function Vt(e) {
|
|
|
1289
1289
|
}
|
|
1290
1290
|
e.mediaIsPlaying.value = !0;
|
|
1291
1291
|
}
|
|
1292
|
-
return
|
|
1292
|
+
return A(t, (n) => {
|
|
1293
1293
|
let r = e.mediaElement.value;
|
|
1294
1294
|
if (!n) {
|
|
1295
1295
|
r?.pause(), r && (r.muted = !0), e.mediaIsPlaying.value = !1;
|
|
1296
1296
|
return;
|
|
1297
1297
|
}
|
|
1298
|
-
|
|
1298
|
+
h().then(async () => {
|
|
1299
1299
|
let n = e.mediaElement.value;
|
|
1300
1300
|
if (!(!n || !t.value)) {
|
|
1301
1301
|
n.muted = e.mediaIsMuted.value;
|
|
@@ -1314,18 +1314,18 @@ function Vt(e) {
|
|
|
1314
1314
|
}
|
|
1315
1315
|
//#endregion
|
|
1316
1316
|
//#region src/components/useTimedMediaCard.ts
|
|
1317
|
-
function
|
|
1317
|
+
function Wt(e) {
|
|
1318
1318
|
return Number.isFinite(e) ? Math.max(0, e) : 0;
|
|
1319
1319
|
}
|
|
1320
|
-
function
|
|
1321
|
-
let t =
|
|
1320
|
+
function Gt(e) {
|
|
1321
|
+
let t = E(0), n = E(0), r = E(!1), { apply: i, setVolume: a, sync: o, toggleMute: s, videoIsMuted: c, videoVolume: l } = Ht({
|
|
1322
1322
|
active: e.active,
|
|
1323
1323
|
layout: e.layout,
|
|
1324
1324
|
mediaCard: e.mediaCard,
|
|
1325
1325
|
mediaElement: e.mediaElement,
|
|
1326
1326
|
onChange: e.onAudioChange,
|
|
1327
1327
|
reelAudioState: e.reelAudioState
|
|
1328
|
-
}), { effectiveMuted: u, onPlaying: d, playbackAllowed: f } =
|
|
1328
|
+
}), { effectiveMuted: u, onPlaying: d, playbackAllowed: f } = Ut({
|
|
1329
1329
|
active: e.active,
|
|
1330
1330
|
inViewport: e.inViewport,
|
|
1331
1331
|
layout: e.layout,
|
|
@@ -1335,7 +1335,7 @@ function Ut(e) {
|
|
|
1335
1335
|
});
|
|
1336
1336
|
function p(r) {
|
|
1337
1337
|
let i = r?.currentTarget ?? e.mediaElement.value;
|
|
1338
|
-
i && (t.value =
|
|
1338
|
+
i && (t.value = Wt(i.currentTime), n.value = Wt(i.duration), o(i, f.value));
|
|
1339
1339
|
}
|
|
1340
1340
|
function m(t) {
|
|
1341
1341
|
i(), p(t), e.onReady(t);
|
|
@@ -1345,7 +1345,7 @@ function Ut(e) {
|
|
|
1345
1345
|
}
|
|
1346
1346
|
function g(n) {
|
|
1347
1347
|
let r = e.mediaElement.value;
|
|
1348
|
-
!r || !Number.isFinite(n) || (r.currentTime = Math.min(
|
|
1348
|
+
!r || !Number.isFinite(n) || (r.currentTime = Math.min(Wt(r.duration), Math.max(0, n)), t.value = r.currentTime);
|
|
1349
1349
|
}
|
|
1350
1350
|
async function _() {
|
|
1351
1351
|
let t = e.mediaElement.value;
|
|
@@ -1361,7 +1361,7 @@ function Ut(e) {
|
|
|
1361
1361
|
}
|
|
1362
1362
|
}
|
|
1363
1363
|
}
|
|
1364
|
-
return
|
|
1364
|
+
return A(e.mediaElement, () => {
|
|
1365
1365
|
t.value = 0, n.value = 0, r.value = !1;
|
|
1366
1366
|
}, { flush: "sync" }), {
|
|
1367
1367
|
currentTime: t,
|
|
@@ -1383,7 +1383,7 @@ function Ut(e) {
|
|
|
1383
1383
|
}
|
|
1384
1384
|
//#endregion
|
|
1385
1385
|
//#region src/components/MediaCard.vue?vue&type=script&setup=true&lang.ts
|
|
1386
|
-
var
|
|
1386
|
+
var Kt = [
|
|
1387
1387
|
"data-post-id",
|
|
1388
1388
|
"data-media-index",
|
|
1389
1389
|
"aria-hidden",
|
|
@@ -1391,19 +1391,19 @@ var Wt = [
|
|
|
1391
1391
|
"inert",
|
|
1392
1392
|
"role",
|
|
1393
1393
|
"tabindex"
|
|
1394
|
-
],
|
|
1394
|
+
], qt = { class: "media-card-content" }, Jt = ["data-media-direction"], Yt = ["data-media-index"], Xt = {
|
|
1395
1395
|
key: 0,
|
|
1396
1396
|
"data-test": "media-loading",
|
|
1397
1397
|
class: "media-loading",
|
|
1398
1398
|
"aria-hidden": "true"
|
|
1399
|
-
},
|
|
1399
|
+
}, Zt = [
|
|
1400
1400
|
"data-source-generation",
|
|
1401
1401
|
"src",
|
|
1402
1402
|
"autoplay",
|
|
1403
1403
|
"loop",
|
|
1404
1404
|
"muted",
|
|
1405
1405
|
"preload"
|
|
1406
|
-
],
|
|
1406
|
+
], Qt = ["aria-label", "disabled"], $t = [
|
|
1407
1407
|
"data-cover-identity",
|
|
1408
1408
|
"data-source-generation",
|
|
1409
1409
|
"src",
|
|
@@ -1411,11 +1411,11 @@ var Wt = [
|
|
|
1411
1411
|
"height",
|
|
1412
1412
|
"fetchpriority",
|
|
1413
1413
|
"loading"
|
|
1414
|
-
],
|
|
1414
|
+
], en = {
|
|
1415
1415
|
key: 1,
|
|
1416
1416
|
class: "media-audio-fallback",
|
|
1417
1417
|
"aria-hidden": "true"
|
|
1418
|
-
},
|
|
1418
|
+
}, tn = [
|
|
1419
1419
|
"data-source-generation",
|
|
1420
1420
|
"src",
|
|
1421
1421
|
"width",
|
|
@@ -1424,14 +1424,14 @@ var Wt = [
|
|
|
1424
1424
|
"loop",
|
|
1425
1425
|
"muted",
|
|
1426
1426
|
"preload"
|
|
1427
|
-
],
|
|
1427
|
+
], nn = [
|
|
1428
1428
|
"data-source-generation",
|
|
1429
1429
|
"src",
|
|
1430
1430
|
"width",
|
|
1431
1431
|
"height",
|
|
1432
1432
|
"fetchpriority",
|
|
1433
1433
|
"loading"
|
|
1434
|
-
],
|
|
1434
|
+
], rn = ["aria-label"], an = ["aria-label"], on = ["aria-label"], sn = /* @__PURE__ */ d({
|
|
1435
1435
|
__name: "MediaCard",
|
|
1436
1436
|
props: {
|
|
1437
1437
|
active: { type: Boolean },
|
|
@@ -1471,104 +1471,104 @@ var Wt = [
|
|
|
1471
1471
|
function f(e = !1, t = "pointer") {
|
|
1472
1472
|
e && d("activate", t);
|
|
1473
1473
|
}
|
|
1474
|
-
let p = r(() =>
|
|
1475
|
-
identity: () => `${l.item.postId}:${
|
|
1476
|
-
mediaIndex: () =>
|
|
1474
|
+
let p = r(() => W(l.item)), m = r(() => G(l.item, l.mediaIndex)), _ = r(() => K(l.item, m.value)), y = r(() => V(_.value, l.mediaSource ?? "preview")), b = r(() => R(_.value.type, _.value.src)), S = r(() => b.value === "audio"), C = r(() => U(_.value, l.mediaSource ?? "preview")), w = r(() => S.value ? C.value : y.value), T = r(() => w.value.src), D = r(() => R(w.value.type, w.value.src)), k = r(() => y.value.width), P = r(() => y.value.height), F = r(() => H(_.value)), I = r(() => `${l.item.postId}:${m.value}:${F.value?.src ?? ""}`), L = E(!1), z = r(() => L.value ? null : F.value), { effectivePreviewState: B, failSourceAttempt: q, imageElement: ee, markSourceReady: J, noteSourceActivity: Y, retrySource: te, retrying: ne, sourceGeneration: re, mediaElement: ie } = Rt({
|
|
1475
|
+
identity: () => `${l.item.postId}:${m.value}:${l.mediaSource ?? "preview"}:${T.value}:${D.value ?? ""}`,
|
|
1476
|
+
mediaIndex: () => m.value,
|
|
1477
1477
|
onError: (e, t) => {
|
|
1478
1478
|
if (d("error", e), !t) return;
|
|
1479
1479
|
let n = l.mediaSource ?? "preview";
|
|
1480
1480
|
d("mediaError", {
|
|
1481
1481
|
mediaIndex: e,
|
|
1482
|
-
source: n === "preview" && !S.value &&
|
|
1483
|
-
src:
|
|
1482
|
+
source: n === "preview" && !S.value && _.value.preview ? "preview" : n === "mobile" && T.value === _.value.mobile?.src ? "mobile" : "original",
|
|
1483
|
+
src: T.value
|
|
1484
1484
|
});
|
|
1485
1485
|
},
|
|
1486
1486
|
onReady: (e) => d("ready", e),
|
|
1487
1487
|
previewState: () => l.previewState
|
|
1488
1488
|
});
|
|
1489
|
-
|
|
1489
|
+
It({
|
|
1490
1490
|
inViewport: () => l.inViewport === !0,
|
|
1491
1491
|
item: () => l.item,
|
|
1492
1492
|
layout: () => l.layout,
|
|
1493
1493
|
mediaCard: () => l.mediaCard,
|
|
1494
|
-
mediaIndex: () =>
|
|
1495
|
-
mediaReady: () =>
|
|
1494
|
+
mediaIndex: () => m.value,
|
|
1495
|
+
mediaReady: () => B.value === "ready",
|
|
1496
1496
|
mediaSource: () => l.mediaSource ?? "preview"
|
|
1497
1497
|
});
|
|
1498
|
-
let { currentTime:
|
|
1498
|
+
let { currentTime: ae, duration: oe, effectiveMuted: se, isMuted: ce, isPlaying: X, onEnded: le, onLoadedMetadata: ue, onPlaying: Z, playbackAllowed: de, seek: fe, setVolume: pe, sync: Q, toggleMute: me, togglePlayback: he, volume: ge } = Gt({
|
|
1499
1499
|
active: () => l.active,
|
|
1500
1500
|
inViewport: () => l.inViewport === !0,
|
|
1501
1501
|
layout: () => l.layout,
|
|
1502
1502
|
mediaCard: () => l.mediaCard,
|
|
1503
|
-
mediaElement:
|
|
1503
|
+
mediaElement: ie,
|
|
1504
1504
|
onAudioChange: (e) => d("reelAudioChange", e),
|
|
1505
|
-
onEnded: () => d("ended",
|
|
1506
|
-
onReady:
|
|
1505
|
+
onEnded: () => d("ended", m.value),
|
|
1506
|
+
onReady: J,
|
|
1507
1507
|
reelAudioState: () => l.reelAudioState
|
|
1508
1508
|
}), _e = r(() => l.interactive && !!(l.cardHeader || l.cardFooter));
|
|
1509
1509
|
function ve(e) {
|
|
1510
1510
|
return e.detail === 0 ? "keyboard" : "pointer";
|
|
1511
1511
|
}
|
|
1512
|
-
let { change: ye, direction: be, onTouchEnd: xe, onTouchStart: Se, onWheel: Ce } =
|
|
1512
|
+
let { change: ye, direction: be, onTouchEnd: xe, onTouchStart: Se, onWheel: Ce } = wt({
|
|
1513
1513
|
item: () => l.item,
|
|
1514
1514
|
layout: () => l.layout,
|
|
1515
|
-
mediaIndex: () =>
|
|
1515
|
+
mediaIndex: () => m.value,
|
|
1516
1516
|
onChange: (e) => d("mediaChange", e)
|
|
1517
|
-
}), { imageLoading: we, mediaIsTimed: Te, timedMediaPreload: Ee } =
|
|
1517
|
+
}), { imageLoading: we, mediaIsTimed: Te, timedMediaPreload: Ee } = Lt({
|
|
1518
1518
|
active: () => l.active,
|
|
1519
1519
|
fetchPriority: () => l.fetchPriority,
|
|
1520
1520
|
layout: () => l.layout,
|
|
1521
|
-
mediaSource: () =>
|
|
1522
|
-
mediaType: () =>
|
|
1523
|
-
mediaElement:
|
|
1524
|
-
}), De = r(() => l.layout === "reel" && l.stationaryReelControls === !0), Oe = r(() => Te.value && (!S.value || l.layout === "reel") &&
|
|
1521
|
+
mediaSource: () => T.value,
|
|
1522
|
+
mediaType: () => D.value,
|
|
1523
|
+
mediaElement: ie
|
|
1524
|
+
}), De = r(() => l.layout === "reel" && l.stationaryReelControls === !0), Oe = r(() => Te.value && (!S.value || l.layout === "reel") && B.value === "ready" && (!De.value || !!(l.active && l.reelControlsTarget))), ke = r(() => `${l.item.postId}:${m.value}:${T.value}`);
|
|
1525
1525
|
function Ae(e) {
|
|
1526
1526
|
l.layout === "reel" && (e.stopPropagation(), he());
|
|
1527
1527
|
}
|
|
1528
1528
|
function je(e) {
|
|
1529
|
-
e.currentTarget.dataset.coverIdentity !==
|
|
1530
|
-
mediaIndex:
|
|
1529
|
+
e.currentTarget.dataset.coverIdentity !== I.value || L.value || (d("mediaError", {
|
|
1530
|
+
mediaIndex: m.value,
|
|
1531
1531
|
source: "preview",
|
|
1532
1532
|
src: F.value?.src ?? ""
|
|
1533
|
-
}),
|
|
1533
|
+
}), L.value = !0, l.layout === "masonry" && J());
|
|
1534
1534
|
}
|
|
1535
|
-
return
|
|
1536
|
-
|
|
1537
|
-
}),
|
|
1535
|
+
return A(I, () => {
|
|
1536
|
+
L.value = !1;
|
|
1537
|
+
}), A([
|
|
1538
1538
|
S,
|
|
1539
1539
|
() => l.layout,
|
|
1540
|
-
|
|
1540
|
+
z
|
|
1541
1541
|
], ([e, t, n]) => {
|
|
1542
|
-
e && t === "masonry" && !n &&
|
|
1543
|
-
}, { immediate: !0 }), (r, i) => (
|
|
1542
|
+
e && t === "masonry" && !n && h(() => J());
|
|
1543
|
+
}, { immediate: !0 }), (r, i) => (x(), s("article", {
|
|
1544
1544
|
"data-post-id": e.item.postId,
|
|
1545
|
-
"data-media-index":
|
|
1546
|
-
class:
|
|
1545
|
+
"data-media-index": m.value,
|
|
1546
|
+
class: g(["media-card", {
|
|
1547
1547
|
"media-card--entering": e.entering,
|
|
1548
1548
|
"media-card--leaving": e.leaving,
|
|
1549
|
-
"media-card--error":
|
|
1549
|
+
"media-card--error": O(B) === "error",
|
|
1550
1550
|
"media-card--transparent-chrome": e.mediaCard?.header?.background === "transparent" || e.mediaCard?.footer?.background === "transparent" || e.cardHeader?.background === "transparent" || e.cardFooter?.background === "transparent"
|
|
1551
1551
|
}]),
|
|
1552
|
-
style:
|
|
1552
|
+
style: v(e.itemStyle),
|
|
1553
1553
|
"aria-hidden": e.leaving || void 0,
|
|
1554
|
-
"aria-busy":
|
|
1554
|
+
"aria-busy": O(B) === "loading" || O(ne),
|
|
1555
1555
|
inert: e.leaving || void 0,
|
|
1556
1556
|
role: e.interactive && !e.leaving && !_e.value ? "button" : void 0,
|
|
1557
1557
|
tabindex: e.interactive && !e.leaving && !_e.value ? 0 : void 0,
|
|
1558
1558
|
onClick: i[34] ||= (t) => f(e.interactive && !_e.value, ve(t)),
|
|
1559
|
-
onKeydown: [i[35] ||=
|
|
1560
|
-
}, [c("div",
|
|
1561
|
-
e.cardHeader ? (
|
|
1559
|
+
onKeydown: [i[35] ||= M((t) => f(e.interactive && !_e.value, "keyboard"), ["enter"]), i[36] ||= M(N((t) => f(e.interactive && !_e.value, "keyboard"), ["prevent"]), ["space"])]
|
|
1560
|
+
}, [c("div", qt, [
|
|
1561
|
+
e.cardHeader ? (x(), a(at, {
|
|
1562
1562
|
key: 0,
|
|
1563
1563
|
index: e.index,
|
|
1564
1564
|
item: e.item,
|
|
1565
1565
|
layout: e.layout,
|
|
1566
1566
|
"loaded-count": e.loadedCount,
|
|
1567
|
-
"media-index":
|
|
1567
|
+
"media-index": m.value,
|
|
1568
1568
|
"media-source": e.mediaSource,
|
|
1569
1569
|
placement: "header",
|
|
1570
1570
|
region: e.cardHeader,
|
|
1571
|
-
style:
|
|
1571
|
+
style: v(e.mediaCard?.header),
|
|
1572
1572
|
total: e.total
|
|
1573
1573
|
}, null, 8, [
|
|
1574
1574
|
"index",
|
|
@@ -1582,28 +1582,28 @@ var Wt = [
|
|
|
1582
1582
|
"total"
|
|
1583
1583
|
])) : o("", !0),
|
|
1584
1584
|
c("div", {
|
|
1585
|
-
class:
|
|
1586
|
-
"data-media-direction":
|
|
1587
|
-
onWheel: i[31] ||= (...e) =>
|
|
1588
|
-
onTouchstartPassive: i[32] ||= (...e) =>
|
|
1589
|
-
onTouchendPassive: i[33] ||= (...e) =>
|
|
1585
|
+
class: g(["media-card-media", { "media-card-media--carousel": e.layout === "reel" && p.value.length > 1 }]),
|
|
1586
|
+
"data-media-direction": O(be),
|
|
1587
|
+
onWheel: i[31] ||= (...e) => O(Ce) && O(Ce)(...e),
|
|
1588
|
+
onTouchstartPassive: i[32] ||= (...e) => O(Se) && O(Se)(...e),
|
|
1589
|
+
onTouchendPassive: i[33] ||= (...e) => O(xe) && O(xe)(...e)
|
|
1590
1590
|
}, [
|
|
1591
1591
|
u(n, {
|
|
1592
|
-
css: !
|
|
1593
|
-
name: `media-slide-${
|
|
1592
|
+
css: !O(ne),
|
|
1593
|
+
name: `media-slide-${O(be)}`
|
|
1594
1594
|
}, {
|
|
1595
|
-
default:
|
|
1596
|
-
key: `${e.item.postId}:${
|
|
1595
|
+
default: j(() => [(x(), s("div", {
|
|
1596
|
+
key: `${e.item.postId}:${_.value.src}:${e.mediaSource ?? "preview"}:${O(re)}`,
|
|
1597
1597
|
class: "media-card-frame",
|
|
1598
|
-
"data-media-index":
|
|
1598
|
+
"data-media-index": m.value
|
|
1599
1599
|
}, [
|
|
1600
|
-
|
|
1600
|
+
O(B) === "loading" ? (x(), s("div", Xt, [...i[37] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : O(B) === "error" ? (x(), a(lt, {
|
|
1601
1601
|
key: 1,
|
|
1602
1602
|
component: e.mediaCard?.error?.component,
|
|
1603
|
-
label:
|
|
1604
|
-
retrying:
|
|
1605
|
-
status:
|
|
1606
|
-
onRetry:
|
|
1603
|
+
label: O(it)(T.value),
|
|
1604
|
+
retrying: O(ne),
|
|
1605
|
+
status: O(rt)(T.value),
|
|
1606
|
+
onRetry: O(te)
|
|
1607
1607
|
}, null, 8, [
|
|
1608
1608
|
"component",
|
|
1609
1609
|
"label",
|
|
@@ -1611,106 +1611,106 @@ var Wt = [
|
|
|
1611
1611
|
"status",
|
|
1612
1612
|
"onRetry"
|
|
1613
1613
|
])) : o("", !0),
|
|
1614
|
-
S.value && e.layout === "reel" ? (
|
|
1614
|
+
S.value && e.layout === "reel" ? (x(), s("audio", {
|
|
1615
1615
|
key: 2,
|
|
1616
1616
|
ref_key: "mediaElement",
|
|
1617
|
-
ref:
|
|
1618
|
-
"data-source-generation":
|
|
1617
|
+
ref: ie,
|
|
1618
|
+
"data-source-generation": O(re),
|
|
1619
1619
|
class: "media-audio-element",
|
|
1620
|
-
src:
|
|
1621
|
-
autoplay:
|
|
1620
|
+
src: T.value,
|
|
1621
|
+
autoplay: O(de),
|
|
1622
1622
|
loop: !e.advanceOnMediaEnd,
|
|
1623
|
-
muted:
|
|
1624
|
-
preload:
|
|
1625
|
-
onLoadedmetadata: i[0] ||= (...e) =>
|
|
1626
|
-
onProgress: i[1] ||= (...e) =>
|
|
1627
|
-
onLoadeddata: i[2] ||= (...e) =>
|
|
1628
|
-
onCanplay: i[3] ||= (...e) =>
|
|
1629
|
-
onDurationchange: i[4] ||= (...e) =>
|
|
1630
|
-
onTimeupdate: i[5] ||= (...e) =>
|
|
1631
|
-
onVolumechange: i[6] ||= (...e) =>
|
|
1632
|
-
onPlaying: i[7] ||= (...e) =>
|
|
1633
|
-
onPause: i[8] ||= (e) =>
|
|
1634
|
-
onEnded: i[9] ||= (...e) =>
|
|
1635
|
-
onError: i[10] ||= (...e) =>
|
|
1636
|
-
}, null, 40,
|
|
1637
|
-
S.value ? (
|
|
1623
|
+
muted: O(se),
|
|
1624
|
+
preload: O(Ee),
|
|
1625
|
+
onLoadedmetadata: i[0] ||= (...e) => O(ue) && O(ue)(...e),
|
|
1626
|
+
onProgress: i[1] ||= (...e) => O(Y) && O(Y)(...e),
|
|
1627
|
+
onLoadeddata: i[2] ||= (...e) => O(Y) && O(Y)(...e),
|
|
1628
|
+
onCanplay: i[3] ||= (...e) => O(Y) && O(Y)(...e),
|
|
1629
|
+
onDurationchange: i[4] ||= (...e) => O(Q) && O(Q)(...e),
|
|
1630
|
+
onTimeupdate: i[5] ||= (...e) => O(Q) && O(Q)(...e),
|
|
1631
|
+
onVolumechange: i[6] ||= (...e) => O(Q) && O(Q)(...e),
|
|
1632
|
+
onPlaying: i[7] ||= (...e) => O(Z) && O(Z)(...e),
|
|
1633
|
+
onPause: i[8] ||= (e) => X.value = !1,
|
|
1634
|
+
onEnded: i[9] ||= (...e) => O(le) && O(le)(...e),
|
|
1635
|
+
onError: i[10] ||= (...e) => O(q) && O(q)(...e)
|
|
1636
|
+
}, null, 40, Zt)) : o("", !0),
|
|
1637
|
+
S.value ? (x(), s("button", {
|
|
1638
1638
|
key: 3,
|
|
1639
1639
|
type: "button",
|
|
1640
|
-
class:
|
|
1641
|
-
"aria-label": e.layout === "reel" ?
|
|
1640
|
+
class: g(["media-audio-artwork media-preview", { "media-preview--ready": O(B) === "ready" }]),
|
|
1641
|
+
"aria-label": e.layout === "reel" ? O(X) ? "Pause audio" : "Play audio" : "Audio",
|
|
1642
1642
|
disabled: e.layout !== "reel",
|
|
1643
1643
|
onClick: Ae
|
|
1644
|
-
}, [
|
|
1645
|
-
key:
|
|
1646
|
-
"data-cover-identity":
|
|
1647
|
-
"data-source-generation":
|
|
1644
|
+
}, [z.value ? (x(), s("img", {
|
|
1645
|
+
key: I.value,
|
|
1646
|
+
"data-cover-identity": I.value,
|
|
1647
|
+
"data-source-generation": O(re),
|
|
1648
1648
|
class: "media-audio-cover",
|
|
1649
|
-
src:
|
|
1650
|
-
width:
|
|
1651
|
-
height:
|
|
1649
|
+
src: z.value.src,
|
|
1650
|
+
width: z.value.width ?? void 0,
|
|
1651
|
+
height: z.value.height ?? void 0,
|
|
1652
1652
|
fetchpriority: e.fetchPriority,
|
|
1653
1653
|
alt: "",
|
|
1654
1654
|
decoding: "async",
|
|
1655
|
-
loading:
|
|
1656
|
-
onLoad: i[11] ||= (t) => e.layout === "masonry" &&
|
|
1655
|
+
loading: O(we),
|
|
1656
|
+
onLoad: i[11] ||= (t) => e.layout === "masonry" && O(J)(t),
|
|
1657
1657
|
onError: je
|
|
1658
|
-
}, null, 40,
|
|
1658
|
+
}, null, 40, $t)) : (x(), s("span", en, [u(O(Ze), {
|
|
1659
1659
|
size: 64,
|
|
1660
1660
|
"stroke-width": 1.5
|
|
1661
|
-
})]))], 10,
|
|
1661
|
+
})]))], 10, Qt)) : O(Te) ? (x(), s("video", {
|
|
1662
1662
|
key: 4,
|
|
1663
1663
|
ref_key: "mediaElement",
|
|
1664
|
-
ref:
|
|
1665
|
-
"data-source-generation":
|
|
1666
|
-
class:
|
|
1667
|
-
"media-preview--ready":
|
|
1664
|
+
ref: ie,
|
|
1665
|
+
"data-source-generation": O(re),
|
|
1666
|
+
class: g(["media-preview", {
|
|
1667
|
+
"media-preview--ready": O(B) === "ready",
|
|
1668
1668
|
"media-preview--reel-video": e.layout === "reel"
|
|
1669
1669
|
}]),
|
|
1670
|
-
src:
|
|
1671
|
-
width:
|
|
1670
|
+
src: T.value,
|
|
1671
|
+
width: k.value ?? void 0,
|
|
1672
1672
|
height: P.value ?? void 0,
|
|
1673
|
-
autoplay:
|
|
1673
|
+
autoplay: O(de),
|
|
1674
1674
|
loop: !e.advanceOnMediaEnd,
|
|
1675
|
-
muted:
|
|
1675
|
+
muted: O(se),
|
|
1676
1676
|
playsinline: "",
|
|
1677
|
-
preload:
|
|
1678
|
-
onLoadedmetadata: i[12] ||= (...e) =>
|
|
1679
|
-
onProgress: i[13] ||= (...e) =>
|
|
1680
|
-
onLoadeddata: i[14] ||= (...e) =>
|
|
1681
|
-
onCanplay: i[15] ||= (...e) =>
|
|
1682
|
-
onDurationchange: i[16] ||= (...e) =>
|
|
1683
|
-
onTimeupdate: i[17] ||= (...e) =>
|
|
1684
|
-
onVolumechange: i[18] ||= (...e) =>
|
|
1685
|
-
onPlaying: i[19] ||= (...e) =>
|
|
1686
|
-
onPause: i[20] ||= (e) =>
|
|
1687
|
-
onEnded: i[21] ||= (...e) =>
|
|
1677
|
+
preload: O(Ee),
|
|
1678
|
+
onLoadedmetadata: i[12] ||= (...e) => O(ue) && O(ue)(...e),
|
|
1679
|
+
onProgress: i[13] ||= (...e) => O(Y) && O(Y)(...e),
|
|
1680
|
+
onLoadeddata: i[14] ||= (...e) => O(Y) && O(Y)(...e),
|
|
1681
|
+
onCanplay: i[15] ||= (...e) => O(Y) && O(Y)(...e),
|
|
1682
|
+
onDurationchange: i[16] ||= (...e) => O(Q) && O(Q)(...e),
|
|
1683
|
+
onTimeupdate: i[17] ||= (...e) => O(Q) && O(Q)(...e),
|
|
1684
|
+
onVolumechange: i[18] ||= (...e) => O(Q) && O(Q)(...e),
|
|
1685
|
+
onPlaying: i[19] ||= (...e) => O(Z) && O(Z)(...e),
|
|
1686
|
+
onPause: i[20] ||= (e) => X.value = !1,
|
|
1687
|
+
onEnded: i[21] ||= (...e) => O(le) && O(le)(...e),
|
|
1688
1688
|
onClick: Ae,
|
|
1689
|
-
onError: i[22] ||= (...e) =>
|
|
1690
|
-
}, null, 42,
|
|
1689
|
+
onError: i[22] ||= (...e) => O(q) && O(q)(...e)
|
|
1690
|
+
}, null, 42, tn)) : S.value ? o("", !0) : (x(), s("img", {
|
|
1691
1691
|
key: 5,
|
|
1692
1692
|
ref_key: "imageElement",
|
|
1693
|
-
ref:
|
|
1694
|
-
"data-source-generation":
|
|
1695
|
-
class:
|
|
1696
|
-
src:
|
|
1697
|
-
width:
|
|
1693
|
+
ref: ee,
|
|
1694
|
+
"data-source-generation": O(re),
|
|
1695
|
+
class: g(["media-preview", { "media-preview--ready": O(B) === "ready" }]),
|
|
1696
|
+
src: T.value,
|
|
1697
|
+
width: k.value ?? void 0,
|
|
1698
1698
|
height: P.value ?? void 0,
|
|
1699
1699
|
fetchpriority: e.fetchPriority,
|
|
1700
1700
|
alt: "",
|
|
1701
1701
|
decoding: "async",
|
|
1702
|
-
loading:
|
|
1703
|
-
onLoad: i[23] ||= (...e) =>
|
|
1704
|
-
onError: i[24] ||= (...e) =>
|
|
1705
|
-
}, null, 42,
|
|
1706
|
-
], 8,
|
|
1702
|
+
loading: O(we),
|
|
1703
|
+
onLoad: i[23] ||= (...e) => O(J) && O(J)(...e),
|
|
1704
|
+
onError: i[24] ||= (...e) => O(q) && O(q)(...e)
|
|
1705
|
+
}, null, 42, nn))
|
|
1706
|
+
], 8, Yt))]),
|
|
1707
1707
|
_: 1
|
|
1708
1708
|
}, 8, ["css", "name"]),
|
|
1709
|
-
u(
|
|
1709
|
+
u(bt, {
|
|
1710
1710
|
item: e.item,
|
|
1711
1711
|
"media-card": e.mediaCard,
|
|
1712
|
-
"media-index":
|
|
1713
|
-
"media-item":
|
|
1712
|
+
"media-index": m.value,
|
|
1713
|
+
"media-item": _.value,
|
|
1714
1714
|
"media-source": e.mediaSource ?? "preview"
|
|
1715
1715
|
}, null, 8, [
|
|
1716
1716
|
"item",
|
|
@@ -1719,27 +1719,27 @@ var Wt = [
|
|
|
1719
1719
|
"media-item",
|
|
1720
1720
|
"media-source"
|
|
1721
1721
|
]),
|
|
1722
|
-
(
|
|
1722
|
+
(x(), a(t, {
|
|
1723
1723
|
disabled: !De.value || !e.reelControlsTarget,
|
|
1724
1724
|
to: e.reelControlsTarget ?? "body"
|
|
1725
1725
|
}, [u(n, {
|
|
1726
1726
|
name: "vibe-reel-media-controls",
|
|
1727
1727
|
css: De.value
|
|
1728
1728
|
}, {
|
|
1729
|
-
default:
|
|
1729
|
+
default: j(() => [Oe.value ? (x(), a(vt, {
|
|
1730
1730
|
key: ke.value,
|
|
1731
|
-
"current-time":
|
|
1731
|
+
"current-time": O(ae),
|
|
1732
1732
|
"data-control-post-id": De.value ? e.item.postId : void 0,
|
|
1733
|
-
duration:
|
|
1733
|
+
duration: O(oe),
|
|
1734
1734
|
layout: e.layout,
|
|
1735
1735
|
"media-type": S.value ? "audio" : "video",
|
|
1736
|
-
muted:
|
|
1737
|
-
playing:
|
|
1738
|
-
volume:
|
|
1739
|
-
onSeek:
|
|
1740
|
-
onToggleMute:
|
|
1741
|
-
onTogglePlayback:
|
|
1742
|
-
onVolumeChange:
|
|
1736
|
+
muted: O(ce),
|
|
1737
|
+
playing: O(X),
|
|
1738
|
+
volume: O(ge),
|
|
1739
|
+
onSeek: O(fe),
|
|
1740
|
+
onToggleMute: O(me),
|
|
1741
|
+
onTogglePlayback: O(he),
|
|
1742
|
+
onVolumeChange: O(pe)
|
|
1743
1743
|
}, null, 8, [
|
|
1744
1744
|
"current-time",
|
|
1745
1745
|
"data-control-post-id",
|
|
@@ -1756,43 +1756,43 @@ var Wt = [
|
|
|
1756
1756
|
])) : o("", !0)]),
|
|
1757
1757
|
_: 1
|
|
1758
1758
|
}, 8, ["css"])], 8, ["disabled", "to"])),
|
|
1759
|
-
p.value.length > 1 ? (
|
|
1759
|
+
p.value.length > 1 ? (x(), s("div", {
|
|
1760
1760
|
key: 0,
|
|
1761
|
-
class:
|
|
1761
|
+
class: g(["media-carousel-controls", { "media-carousel-controls--persistent": e.layout === "reel" }]),
|
|
1762
1762
|
"aria-label": "Media navigation"
|
|
1763
1763
|
}, [c("button", {
|
|
1764
1764
|
type: "button",
|
|
1765
1765
|
class: "media-carousel-control media-carousel-control--previous",
|
|
1766
1766
|
"aria-label": `Previous media for post ${e.item.postId}`,
|
|
1767
|
-
onClick: i[25] ||=
|
|
1768
|
-
onKeydown: i[26] ||=
|
|
1769
|
-
}, [u(
|
|
1767
|
+
onClick: i[25] ||= N((e) => O(ye)(m.value - 1, e), ["stop"]),
|
|
1768
|
+
onKeydown: i[26] ||= N(() => {}, ["stop"])
|
|
1769
|
+
}, [u(O(Ye), { size: 20 })], 40, rn), c("button", {
|
|
1770
1770
|
type: "button",
|
|
1771
1771
|
class: "media-carousel-control media-carousel-control--next",
|
|
1772
1772
|
"aria-label": `Next media for post ${e.item.postId}`,
|
|
1773
|
-
onClick: i[27] ||=
|
|
1774
|
-
onKeydown: i[28] ||=
|
|
1775
|
-
}, [u(
|
|
1776
|
-
_e.value ? (
|
|
1773
|
+
onClick: i[27] ||= N((e) => O(ye)(m.value + 1, e), ["stop"]),
|
|
1774
|
+
onKeydown: i[28] ||= N(() => {}, ["stop"])
|
|
1775
|
+
}, [u(O(Xe), { size: 20 })], 40, an)], 2)) : o("", !0),
|
|
1776
|
+
_e.value ? (x(), s("button", {
|
|
1777
1777
|
key: 1,
|
|
1778
1778
|
class: "media-card-activator",
|
|
1779
1779
|
type: "button",
|
|
1780
1780
|
"aria-label": `Open post ${e.item.postId}`,
|
|
1781
|
-
onClick: i[29] ||=
|
|
1782
|
-
onKeydown: i[30] ||=
|
|
1783
|
-
}, null, 40,
|
|
1784
|
-
], 42,
|
|
1785
|
-
e.cardFooter ? (
|
|
1781
|
+
onClick: i[29] ||= N((e) => r.$emit("activate", ve(e)), ["stop"]),
|
|
1782
|
+
onKeydown: i[30] ||= N(() => {}, ["stop"])
|
|
1783
|
+
}, null, 40, on)) : o("", !0)
|
|
1784
|
+
], 42, Jt),
|
|
1785
|
+
e.cardFooter ? (x(), a(at, {
|
|
1786
1786
|
key: 1,
|
|
1787
1787
|
index: e.index,
|
|
1788
1788
|
item: e.item,
|
|
1789
1789
|
layout: e.layout,
|
|
1790
1790
|
"loaded-count": e.loadedCount,
|
|
1791
|
-
"media-index":
|
|
1791
|
+
"media-index": m.value,
|
|
1792
1792
|
"media-source": e.mediaSource,
|
|
1793
1793
|
placement: "footer",
|
|
1794
1794
|
region: e.cardFooter,
|
|
1795
|
-
style:
|
|
1795
|
+
style: v(e.mediaCard?.footer),
|
|
1796
1796
|
total: e.total
|
|
1797
1797
|
}, null, 8, [
|
|
1798
1798
|
"index",
|
|
@@ -1805,17 +1805,17 @@ var Wt = [
|
|
|
1805
1805
|
"style",
|
|
1806
1806
|
"total"
|
|
1807
1807
|
])) : o("", !0)
|
|
1808
|
-
])], 46,
|
|
1808
|
+
])], 46, Kt));
|
|
1809
1809
|
}
|
|
1810
1810
|
});
|
|
1811
1811
|
//#endregion
|
|
1812
1812
|
//#region src/components/useMasonryMediaVisibility.ts
|
|
1813
|
-
function
|
|
1813
|
+
function cn(e) {
|
|
1814
1814
|
function t(t) {
|
|
1815
1815
|
return t.flatMap((t) => {
|
|
1816
1816
|
let n = e.items()[t];
|
|
1817
1817
|
if (!n) return [];
|
|
1818
|
-
let r = e.mediaIndices().get(n.postId) ?? 0, i =
|
|
1818
|
+
let r = e.mediaIndices().get(n.postId) ?? 0, i = q(n.postId, r);
|
|
1819
1819
|
return e.previewStates().get(i) === "ready" ? [{
|
|
1820
1820
|
key: i,
|
|
1821
1821
|
mediaIndex: r,
|
|
@@ -1825,7 +1825,7 @@ function on(e) {
|
|
|
1825
1825
|
}
|
|
1826
1826
|
function n(e, n) {
|
|
1827
1827
|
let r = /* @__PURE__ */ new Set();
|
|
1828
|
-
|
|
1828
|
+
A(() => t(e()), (e) => {
|
|
1829
1829
|
let t = new Set(e.map(({ key: e }) => e));
|
|
1830
1830
|
e.forEach(({ key: e, mediaIndex: t, postId: i }) => {
|
|
1831
1831
|
r.has(e) || n(i, t);
|
|
@@ -1839,14 +1839,14 @@ function on(e) {
|
|
|
1839
1839
|
}
|
|
1840
1840
|
//#endregion
|
|
1841
1841
|
//#region src/components/useSettledMasonryFeedLayout.ts
|
|
1842
|
-
var
|
|
1843
|
-
function
|
|
1844
|
-
let t =
|
|
1842
|
+
var ln = 1500;
|
|
1843
|
+
function un(e) {
|
|
1844
|
+
let t = E(0), n = 0, i = null, a = 0, o = 0, s = null, c = 0, l = null, u = null, d = 0;
|
|
1845
1845
|
function f() {
|
|
1846
1846
|
s !== null && (cancelAnimationFrame(s), s = null);
|
|
1847
1847
|
}
|
|
1848
1848
|
function p(e, t, n, r) {
|
|
1849
|
-
return i = e, l = t.slice(), u =
|
|
1849
|
+
return i = e, l = t.slice(), u = Te(e.items, u ?? we(r.items), n), c = e.items.length < t.length ? Math.max(c, r.height, e.height) : 0, e.items.length < t.length && e.items.length > n && m(), e;
|
|
1850
1850
|
}
|
|
1851
1851
|
function m() {
|
|
1852
1852
|
s === null && (s = requestAnimationFrame(() => {
|
|
@@ -1854,13 +1854,13 @@ function cn(e) {
|
|
|
1854
1854
|
let n = e.items(), r = i;
|
|
1855
1855
|
if (!r || r.items.length >= n.length) return;
|
|
1856
1856
|
let a = r.items.length;
|
|
1857
|
-
p(
|
|
1857
|
+
p(be(n, e.width.value, {
|
|
1858
1858
|
additionalHeight: e.additionalHeight.value,
|
|
1859
1859
|
gap: e.gap.value,
|
|
1860
1860
|
minColumnWidth: e.minColumnWidth.value
|
|
1861
1861
|
}, r, a, {
|
|
1862
1862
|
throughIndex: e.packThroughIndex(),
|
|
1863
|
-
untilIndex: a +
|
|
1863
|
+
untilIndex: a + ln
|
|
1864
1864
|
}), n, a, r), t.value += 1;
|
|
1865
1865
|
}));
|
|
1866
1866
|
}
|
|
@@ -1874,22 +1874,22 @@ function cn(e) {
|
|
|
1874
1874
|
if (g && l && d === s && a === h.gap && n === h.additionalHeight && o === h.minColumnWidth) {
|
|
1875
1875
|
let t = 0, n = l, i = Math.min(n.length, r.length);
|
|
1876
1876
|
for (; t < i && n[t] === r[t];) t += 1;
|
|
1877
|
-
return t === r.length && t === n.length ? (g.items.length > 0 && g.items.length < r.length && m(), g) : (f(), p(
|
|
1877
|
+
return t === r.length && t === n.length ? (g.items.length > 0 && g.items.length < r.length && m(), g) : (f(), p(be(r, s, h, g, t, {
|
|
1878
1878
|
throughIndex: e.packThroughIndex(),
|
|
1879
1879
|
untilBottom: e.packUntilBottom()
|
|
1880
1880
|
}), r, t, g));
|
|
1881
1881
|
}
|
|
1882
1882
|
f();
|
|
1883
|
-
let _ =
|
|
1884
|
-
return i = _, l = r.slice(), d = s, a = h.gap, n = h.additionalHeight, o = h.minColumnWidth, u =
|
|
1885
|
-
}), g = r(() => (h.value, u ??
|
|
1886
|
-
return
|
|
1883
|
+
let _ = ye(r, s, h);
|
|
1884
|
+
return i = _, l = r.slice(), d = s, a = h.gap, n = h.additionalHeight, o = h.minColumnWidth, u = we(_.items), c = 0, _;
|
|
1885
|
+
}), g = r(() => (h.value, u ?? we(h.value.items)));
|
|
1886
|
+
return y(f), {
|
|
1887
1887
|
ensurePackedThrough(n) {
|
|
1888
1888
|
let r = e.items(), a = i;
|
|
1889
1889
|
if (!a || a.items.length >= r.length || a.height >= n) return;
|
|
1890
1890
|
f();
|
|
1891
1891
|
let o = a.items.length;
|
|
1892
|
-
p(
|
|
1892
|
+
p(be(r, e.width.value, {
|
|
1893
1893
|
additionalHeight: e.additionalHeight.value,
|
|
1894
1894
|
gap: e.gap.value,
|
|
1895
1895
|
minColumnWidth: e.minColumnWidth.value
|
|
@@ -1905,10 +1905,10 @@ function cn(e) {
|
|
|
1905
1905
|
}
|
|
1906
1906
|
//#endregion
|
|
1907
1907
|
//#region src/components/MasonryFeed.vue?vue&type=script&setup=true&lang.ts
|
|
1908
|
-
var
|
|
1908
|
+
var dn = { class: "masonry-feed-shell" }, fn = ["aria-hidden", "inert"], pn = {
|
|
1909
1909
|
key: 0,
|
|
1910
1910
|
class: "masonry-feed-status-overlay"
|
|
1911
|
-
},
|
|
1911
|
+
}, mn = 6, hn = 12, gn = 250, _n = /* @__PURE__ */ d({
|
|
1912
1912
|
__name: "MasonryFeed",
|
|
1913
1913
|
props: {
|
|
1914
1914
|
enteringPostIds: {},
|
|
@@ -1947,31 +1947,31 @@ var ln = { class: "masonry-feed-shell" }, un = ["aria-hidden", "inert"], dn = {
|
|
|
1947
1947
|
"visible"
|
|
1948
1948
|
],
|
|
1949
1949
|
setup(t, { expose: n, emit: i }) {
|
|
1950
|
-
let l = 0, d = t, f = i, p =
|
|
1950
|
+
let l = 0, d = t, f = i, p = E(null), m = `vibe-masonry-${k()}`, h = E(null), _ = E(0), b = E(mn), S = E(0), w = E(0), T = E(0), D = E([]), j = E([]), M = E([]), N = 0, P = null, F = null, I = null, L = null, R = r(() => ({
|
|
1951
1951
|
additionalHeight: (d.cardHeader?.height ?? 0) + (d.cardFooter?.height ?? 0),
|
|
1952
|
-
gap:
|
|
1953
|
-
minColumnWidth:
|
|
1952
|
+
gap: b.value,
|
|
1953
|
+
minColumnWidth: ke(d.masonry)
|
|
1954
1954
|
})), z = [];
|
|
1955
1955
|
function B() {
|
|
1956
|
-
let e = N -
|
|
1956
|
+
let e = N - T.value + S.value + Ae(d.masonry, S.value), t = M.value.reduce((e, t) => {
|
|
1957
1957
|
let n = z[t];
|
|
1958
1958
|
return n ? Math.max(e, n.y + n.height) : e;
|
|
1959
1959
|
}, 0);
|
|
1960
1960
|
return Math.max(e, t);
|
|
1961
1961
|
}
|
|
1962
|
-
function
|
|
1962
|
+
function V() {
|
|
1963
1963
|
return M.value.reduce((e, t) => Math.max(e, t), -1);
|
|
1964
1964
|
}
|
|
1965
|
-
let
|
|
1965
|
+
let H = un({
|
|
1966
1966
|
additionalHeight: r(() => R.value.additionalHeight),
|
|
1967
|
-
gap:
|
|
1967
|
+
gap: b,
|
|
1968
1968
|
items: () => d.items,
|
|
1969
1969
|
minColumnWidth: r(() => R.value.minColumnWidth),
|
|
1970
|
-
packThroughIndex:
|
|
1970
|
+
packThroughIndex: V,
|
|
1971
1971
|
packUntilBottom: B,
|
|
1972
|
-
width:
|
|
1973
|
-
}),
|
|
1974
|
-
throughIndex:
|
|
1972
|
+
width: _
|
|
1973
|
+
}), U = H.layout, W = H.viewportIndex, G = r(() => d.leavingPostIds.size === 0 ? null : xe(d.items, _.value, R.value, U.value, (e) => d.leavingPostIds.has(d.items[e].postId), {
|
|
1974
|
+
throughIndex: V(),
|
|
1975
1975
|
untilBottom: B()
|
|
1976
1976
|
})), K = r(() => {
|
|
1977
1977
|
let e = G.value;
|
|
@@ -1979,33 +1979,33 @@ var ln = { class: "masonry-feed-shell" }, un = ["aria-hidden", "inert"], dn = {
|
|
|
1979
1979
|
columns: e.columns,
|
|
1980
1980
|
height: e.height,
|
|
1981
1981
|
items: e.items
|
|
1982
|
-
} :
|
|
1983
|
-
}),
|
|
1982
|
+
} : U.value;
|
|
1983
|
+
}), ee = r(() => {
|
|
1984
1984
|
let e = G.value;
|
|
1985
|
-
return e ?
|
|
1986
|
-
}),
|
|
1985
|
+
return e ? Ee(e.items, e.retainedIndices, W.value, e.fromIndex) : null;
|
|
1986
|
+
}), J = r(() => (U.value, Math.max(w.value, H.reservedHeight(), d.leavingPostIds.size === 0 ? K.value.height : U.value.height))), Y = r(() => ({ height: `${J.value}px` })), te = r(() => !d.infiniteScroll || S.value > 0 && T.value + K.value.height <= S.value + 1), ne = r(() => new Set(j.value)), re = r(() => M.value.flatMap((e) => {
|
|
1987
1987
|
let t = d.items[e], n = K.value.items[e];
|
|
1988
1988
|
return !t || !n || n.width <= 0 || n.height <= 0 ? [] : [{
|
|
1989
|
-
fetchPriority:
|
|
1989
|
+
fetchPriority: ne.value.has(e) ? "high" : "low",
|
|
1990
1990
|
index: e,
|
|
1991
1991
|
item: t
|
|
1992
1992
|
}];
|
|
1993
1993
|
}));
|
|
1994
|
-
function
|
|
1994
|
+
function ie(e, t) {
|
|
1995
1995
|
return [...new Set([...e, ...t])].sort((e, t) => e - t);
|
|
1996
1996
|
}
|
|
1997
|
-
function
|
|
1997
|
+
function ae(e, t) {
|
|
1998
1998
|
return e.length === t.length && e.every((e, n) => e === t[n]);
|
|
1999
1999
|
}
|
|
2000
|
-
function
|
|
2000
|
+
function oe(e) {
|
|
2001
2001
|
let t = {
|
|
2002
|
-
scrollTop: N -
|
|
2003
|
-
viewportHeight:
|
|
2004
|
-
}, n =
|
|
2002
|
+
scrollTop: N - T.value,
|
|
2003
|
+
viewportHeight: S.value
|
|
2004
|
+
}, n = ee.value, r = Oe(n ?? W.value, {
|
|
2005
2005
|
...t,
|
|
2006
2006
|
overscan: e
|
|
2007
2007
|
}).indices;
|
|
2008
|
-
return
|
|
2008
|
+
return ie(r, d.leavingPostIds.size === 0 ? [] : Oe(W.value, {
|
|
2009
2009
|
...t,
|
|
2010
2010
|
overscan: e
|
|
2011
2011
|
}).indices.filter((e) => {
|
|
@@ -2013,28 +2013,28 @@ var ln = { class: "masonry-feed-shell" }, un = ["aria-hidden", "inert"], dn = {
|
|
|
2013
2013
|
return t !== void 0 && d.leavingPostIds.has(t.postId);
|
|
2014
2014
|
}));
|
|
2015
2015
|
}
|
|
2016
|
-
function
|
|
2017
|
-
let e =
|
|
2018
|
-
|
|
2019
|
-
let n =
|
|
2016
|
+
function ce() {
|
|
2017
|
+
let e = oe(0), t = oe(Ae(d.masonry, S.value));
|
|
2018
|
+
ae(j.value, e) || (j.value = e);
|
|
2019
|
+
let n = me(K.value.items, e.filter((e) => {
|
|
2020
2020
|
let t = d.items[e];
|
|
2021
2021
|
return t && !d.leavingPostIds.has(t.postId);
|
|
2022
2022
|
}), {
|
|
2023
|
-
scrollTop: N -
|
|
2024
|
-
viewportHeight:
|
|
2023
|
+
scrollTop: N - T.value,
|
|
2024
|
+
viewportHeight: S.value
|
|
2025
2025
|
});
|
|
2026
|
-
|
|
2026
|
+
ae(D.value, n) || (D.value = n), ae(M.value, t) || (M.value = t);
|
|
2027
2027
|
}
|
|
2028
2028
|
function X() {
|
|
2029
2029
|
if (L !== null) return;
|
|
2030
2030
|
L = -1;
|
|
2031
2031
|
let e = requestAnimationFrame(() => {
|
|
2032
|
-
L = null,
|
|
2032
|
+
L = null, ce();
|
|
2033
2033
|
});
|
|
2034
2034
|
L !== null && (L = e);
|
|
2035
2035
|
}
|
|
2036
|
-
|
|
2037
|
-
fullyVisibleIndices: () =>
|
|
2036
|
+
cn({
|
|
2037
|
+
fullyVisibleIndices: () => D.value,
|
|
2038
2038
|
items: () => d.items,
|
|
2039
2039
|
mediaIndices: () => d.mediaIndices,
|
|
2040
2040
|
onFullyVisible: (e, t) => f("fullyVisible", e, t),
|
|
@@ -2042,12 +2042,12 @@ var ln = { class: "masonry-feed-shell" }, un = ["aria-hidden", "inert"], dn = {
|
|
|
2042
2042
|
previewStates: () => d.previewStates,
|
|
2043
2043
|
visibleIndices: () => j.value
|
|
2044
2044
|
});
|
|
2045
|
-
function
|
|
2045
|
+
function le(e) {
|
|
2046
2046
|
let t = K.value.items[e], n = d.items[e]?.postId;
|
|
2047
2047
|
if (!t || t.width <= 0 || t.height <= 0) return {};
|
|
2048
|
-
let r = n !== void 0 && d.enteringPostIds.has(n), i = n !== void 0 && d.leavingPostIds.has(n), a = r || i ?
|
|
2049
|
-
containerHeight: Math.max(
|
|
2050
|
-
gap:
|
|
2048
|
+
let r = n !== void 0 && d.enteringPostIds.has(n), i = n !== void 0 && d.leavingPostIds.has(n), a = r || i ? fe({
|
|
2049
|
+
containerHeight: Math.max(w.value, U.value.height),
|
|
2050
|
+
gap: b.value
|
|
2051
2051
|
}) : 0, o = n === void 0 ? 0 : i ? d.removalDelays.get(n) ?? 0 : r ? d.entryDelays.get(n) ?? 0 : 0;
|
|
2052
2052
|
return {
|
|
2053
2053
|
"--masonry-entry-delay": `${o}ms`,
|
|
@@ -2056,70 +2056,70 @@ var ln = { class: "masonry-feed-shell" }, un = ["aria-hidden", "inert"], dn = {
|
|
|
2056
2056
|
transform: `translate3d(${t.x}px, ${t.y + a}px, 0)`
|
|
2057
2057
|
};
|
|
2058
2058
|
}
|
|
2059
|
-
function
|
|
2059
|
+
function Z() {
|
|
2060
2060
|
let e = p.value;
|
|
2061
2061
|
if (!e) return;
|
|
2062
|
-
N = e.scrollTop,
|
|
2062
|
+
N = e.scrollTop, S.value = e.clientHeight;
|
|
2063
2063
|
let t = e.ownerDocument.defaultView?.getComputedStyle(e), n = (Number.parseFloat(t?.paddingTop ?? "") || 0) + (Number.parseFloat(t?.paddingBottom ?? "") || 0);
|
|
2064
|
-
|
|
2065
|
-
let r =
|
|
2066
|
-
r && (
|
|
2064
|
+
w.value = Math.max(0, e.clientHeight - n);
|
|
2065
|
+
let r = h.value;
|
|
2066
|
+
r && (T.value = r.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop, ce());
|
|
2067
2067
|
}
|
|
2068
|
-
function
|
|
2068
|
+
function de(e) {
|
|
2069
2069
|
let t = e.ownerDocument.documentElement.clientWidth;
|
|
2070
|
-
|
|
2070
|
+
_.value = e.clientWidth, b.value = Math.min(hn, Math.max(mn, t * .0075)), Z();
|
|
2071
2071
|
}
|
|
2072
|
-
function
|
|
2072
|
+
function pe(e) {
|
|
2073
2073
|
let t = e.currentTarget;
|
|
2074
|
-
t && (N = t.scrollTop,
|
|
2074
|
+
t && (N = t.scrollTop, H.ensurePackedThrough(B()), X(), Date.now() >= l && !d.loadMoreLocked && d.infiniteScroll && ue(t, d.masonry?.loadMoreThresholdPx) && f("loadMore"));
|
|
2075
2075
|
}
|
|
2076
|
-
function
|
|
2076
|
+
function Q() {
|
|
2077
2077
|
let e = p.value;
|
|
2078
|
-
Date.now() >= l && !d.loadMoreLocked && e &&
|
|
2078
|
+
Date.now() >= l && !d.loadMoreLocked && e && ue(e, d.masonry?.loadMoreThresholdPx) && f("loadMore");
|
|
2079
2079
|
}
|
|
2080
|
-
|
|
2081
|
-
e > 0 && e < t && (l = Date.now() +
|
|
2080
|
+
A(() => d.items.length, (e, t) => {
|
|
2081
|
+
e > 0 && e < t && (l = Date.now() + gn);
|
|
2082
2082
|
});
|
|
2083
2083
|
function he() {
|
|
2084
2084
|
return p.value;
|
|
2085
2085
|
}
|
|
2086
|
-
return
|
|
2087
|
-
P?.disconnect(), P = null, I !== null && cancelAnimationFrame(I), e && (
|
|
2086
|
+
return A(h, (e) => {
|
|
2087
|
+
P?.disconnect(), P = null, I !== null && cancelAnimationFrame(I), e && (de(e), !(typeof ResizeObserver > "u") && (P = new ResizeObserver(([t]) => {
|
|
2088
2088
|
let n = t?.contentRect.width ?? e.clientWidth;
|
|
2089
|
-
Math.abs(n -
|
|
2090
|
-
I = null,
|
|
2089
|
+
Math.abs(n - _.value) < .5 || (I = requestAnimationFrame(() => {
|
|
2090
|
+
I = null, de(e);
|
|
2091
2091
|
}));
|
|
2092
2092
|
}), P.observe(e)));
|
|
2093
|
-
}),
|
|
2094
|
-
F?.disconnect(), F = null, e && (
|
|
2095
|
-
}),
|
|
2093
|
+
}), A(p, (e) => {
|
|
2094
|
+
F?.disconnect(), F = null, e && (Z(), !(typeof ResizeObserver > "u") && (F = new ResizeObserver(Z), F.observe(e)));
|
|
2095
|
+
}), A(K, (e) => {
|
|
2096
2096
|
z = e.items;
|
|
2097
|
-
}, { flush: "sync" }),
|
|
2098
|
-
|
|
2097
|
+
}, { flush: "sync" }), A([
|
|
2098
|
+
U,
|
|
2099
2099
|
K,
|
|
2100
2100
|
() => d.masonry
|
|
2101
|
-
],
|
|
2101
|
+
], ce, { flush: "post" }), y(() => {
|
|
2102
2102
|
P?.disconnect(), F?.disconnect(), I !== null && cancelAnimationFrame(I), L !== null && cancelAnimationFrame(L);
|
|
2103
2103
|
}), n({
|
|
2104
2104
|
getScrollElement: he,
|
|
2105
|
-
loadIfNearBottom:
|
|
2106
|
-
}), (n, r) => (
|
|
2105
|
+
loadIfNearBottom: Q
|
|
2106
|
+
}), (n, r) => (x(), s("div", dn, [
|
|
2107
2107
|
c("main", {
|
|
2108
2108
|
id: m,
|
|
2109
2109
|
ref_key: "galleryElement",
|
|
2110
2110
|
ref: p,
|
|
2111
|
-
class:
|
|
2111
|
+
class: g(["gallery-shell masonry-feed", { "masonry-feed--suspended": t.suspended }]),
|
|
2112
2112
|
"data-layout-mode": "masonry",
|
|
2113
2113
|
"aria-hidden": t.suspended || void 0,
|
|
2114
2114
|
inert: t.suspended || void 0,
|
|
2115
|
-
onScrollPassive:
|
|
2115
|
+
onScrollPassive: pe
|
|
2116
2116
|
}, [c("section", {
|
|
2117
2117
|
ref_key: "masonryElement",
|
|
2118
|
-
ref:
|
|
2119
|
-
class:
|
|
2120
|
-
style:
|
|
2118
|
+
ref: h,
|
|
2119
|
+
class: g(["masonry", { "masonry--ready": _.value > 0 }]),
|
|
2120
|
+
style: v(Y.value),
|
|
2121
2121
|
"aria-label": "Media gallery"
|
|
2122
|
-
}, [(
|
|
2122
|
+
}, [(x(!0), s(e, null, C(re.value, ({ fetchPriority: e, item: n, index: r }) => (x(), a(sn, {
|
|
2123
2123
|
key: n.postId,
|
|
2124
2124
|
class: "masonry-item",
|
|
2125
2125
|
entering: t.enteringPostIds.has(n.postId),
|
|
@@ -2128,15 +2128,15 @@ var ln = { class: "masonry-feed-shell" }, un = ["aria-hidden", "inert"], dn = {
|
|
|
2128
2128
|
"card-footer": t.cardFooter,
|
|
2129
2129
|
"card-header": t.cardHeader,
|
|
2130
2130
|
"media-card": t.mediaCard,
|
|
2131
|
-
"in-viewport":
|
|
2131
|
+
"in-viewport": ne.value.has(r),
|
|
2132
2132
|
index: r,
|
|
2133
2133
|
item: n,
|
|
2134
|
-
"item-style":
|
|
2134
|
+
"item-style": le(r),
|
|
2135
2135
|
interactive: "",
|
|
2136
2136
|
layout: "masonry",
|
|
2137
2137
|
"loaded-count": t.items.length,
|
|
2138
2138
|
"media-index": t.mediaIndices.get(n.postId) ?? 0,
|
|
2139
|
-
"preview-state": t.previewStates.get(
|
|
2139
|
+
"preview-state": t.previewStates.get(O(q)(n.postId, t.mediaIndices.get(n.postId) ?? 0)) ?? "loading",
|
|
2140
2140
|
total: t.total,
|
|
2141
2141
|
onActivate: (e) => f("activate", n.postId, e),
|
|
2142
2142
|
onMediaChange: (e) => f("mediaChange", n.postId, e),
|
|
@@ -2163,13 +2163,13 @@ var ln = { class: "masonry-feed-shell" }, un = ["aria-hidden", "inert"], dn = {
|
|
|
2163
2163
|
"onReady",
|
|
2164
2164
|
"onError",
|
|
2165
2165
|
"onMediaError"
|
|
2166
|
-
]))), 128))], 6), t.masonry?.bottomSpacePx ? (
|
|
2166
|
+
]))), 128))], 6), t.masonry?.bottomSpacePx ? (x(), s("div", {
|
|
2167
2167
|
key: 0,
|
|
2168
2168
|
class: "masonry-bottom-space",
|
|
2169
2169
|
"aria-hidden": "true",
|
|
2170
|
-
style:
|
|
2171
|
-
}, null, 4)) : o("", !0)], 42,
|
|
2172
|
-
t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext &&
|
|
2170
|
+
style: v({ flex: `0 0 ${t.masonry.bottomSpacePx}px` })
|
|
2171
|
+
}, null, 4)) : o("", !0)], 42, fn),
|
|
2172
|
+
t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && te.value || !t.hasNext && t.canRetryEnd ? (x(), s("div", pn, [u(se, {
|
|
2173
2173
|
actions: t.feedFooterActions,
|
|
2174
2174
|
"can-retry-end": t.canRetryEnd,
|
|
2175
2175
|
"feed-footer": t.feedFooter,
|
|
@@ -2177,7 +2177,7 @@ var ln = { class: "masonry-feed-shell" }, un = ["aria-hidden", "inert"], dn = {
|
|
|
2177
2177
|
"has-next": t.hasNext,
|
|
2178
2178
|
"is-loading": t.isLoadingMore,
|
|
2179
2179
|
"load-more-locked": t.loadMoreLocked,
|
|
2180
|
-
"show-load-more":
|
|
2180
|
+
"show-load-more": te.value,
|
|
2181
2181
|
state: t.state,
|
|
2182
2182
|
onLoadMore: r[0] ||= (e) => f("loadMore"),
|
|
2183
2183
|
onRetryEnd: r[1] ||= (e) => f("retryEnd")
|
|
@@ -2192,7 +2192,7 @@ var ln = { class: "masonry-feed-shell" }, un = ["aria-hidden", "inert"], dn = {
|
|
|
2192
2192
|
"show-load-more",
|
|
2193
2193
|
"state"
|
|
2194
2194
|
])])) : o("", !0),
|
|
2195
|
-
u(
|
|
2195
|
+
u(ze, {
|
|
2196
2196
|
"content-size": K.value.height,
|
|
2197
2197
|
"controls-id": m,
|
|
2198
2198
|
"scroll-element": p.value,
|
|
@@ -2204,8 +2204,8 @@ var ln = { class: "masonry-feed-shell" }, un = ["aria-hidden", "inert"], dn = {
|
|
|
2204
2204
|
])
|
|
2205
2205
|
]));
|
|
2206
2206
|
}
|
|
2207
|
-
}),
|
|
2208
|
-
function
|
|
2207
|
+
}), vn = 300;
|
|
2208
|
+
function yn(e, t, n) {
|
|
2209
2209
|
let r = e.scrollTop;
|
|
2210
2210
|
if (n || Math.abs(r - t) <= 1) return e.scrollTop = t, Promise.resolve();
|
|
2211
2211
|
e.setAttribute("data-transitioning", "");
|
|
@@ -2213,7 +2213,7 @@ function _n(e, t, n) {
|
|
|
2213
2213
|
return new Promise((n) => {
|
|
2214
2214
|
let o = (s) => {
|
|
2215
2215
|
a += 1;
|
|
2216
|
-
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c /
|
|
2216
|
+
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / vn), u = 1 - (1 - l) ** 3;
|
|
2217
2217
|
if (e.scrollTop = r + (t - r) * u, l < 1) {
|
|
2218
2218
|
requestAnimationFrame(o);
|
|
2219
2219
|
return;
|
|
@@ -2225,7 +2225,7 @@ function _n(e, t, n) {
|
|
|
2225
2225
|
}
|
|
2226
2226
|
//#endregion
|
|
2227
2227
|
//#region src/components/ReelAutoAdvanceProgress.vue?vue&type=script&setup=true&lang.ts
|
|
2228
|
-
var
|
|
2228
|
+
var bn = ["aria-label"], xn = /* @__PURE__ */ d({
|
|
2229
2229
|
__name: "ReelAutoAdvanceProgress",
|
|
2230
2230
|
props: {
|
|
2231
2231
|
durationMs: {},
|
|
@@ -2234,18 +2234,18 @@ var vn = ["aria-label"], yn = /* @__PURE__ */ d({
|
|
|
2234
2234
|
emits: ["complete"],
|
|
2235
2235
|
setup(e, { emit: t }) {
|
|
2236
2236
|
let n = e, i = t, a = r(() => ({ "--vibe-reel-auto-advance-duration": `${n.durationMs}ms` }));
|
|
2237
|
-
return (t, n) => (
|
|
2237
|
+
return (t, n) => (x(), s("div", {
|
|
2238
2238
|
class: "reel-auto-advance",
|
|
2239
2239
|
"data-test": "reel-auto-advance",
|
|
2240
2240
|
role: "timer",
|
|
2241
2241
|
"aria-label": e.label
|
|
2242
2242
|
}, [c("span", {
|
|
2243
2243
|
class: "reel-auto-advance-progress",
|
|
2244
|
-
style:
|
|
2244
|
+
style: v(a.value),
|
|
2245
2245
|
onAnimationend: n[0] ||= (e) => i("complete")
|
|
2246
|
-
}, null, 36)], 8,
|
|
2246
|
+
}, null, 36)], 8, bn));
|
|
2247
2247
|
}
|
|
2248
|
-
}),
|
|
2248
|
+
}), Sn = { class: "reel-viewport" }, Cn = ["data-active-post-id", "data-active-media-index"], wn = ["role", "data-status"], Tn = ["disabled"], En = 300, Dn = 250, On = /* @__PURE__ */ d({
|
|
2249
2249
|
__name: "ReelFeed",
|
|
2250
2250
|
props: {
|
|
2251
2251
|
initialPostId: {},
|
|
@@ -2285,87 +2285,87 @@ var vn = ["aria-label"], yn = /* @__PURE__ */ d({
|
|
|
2285
2285
|
"retryForward"
|
|
2286
2286
|
],
|
|
2287
2287
|
setup(t, { expose: n, emit: i }) {
|
|
2288
|
-
let l = 0, u = t, d = i, f =
|
|
2289
|
-
let e = Math.max(0,
|
|
2288
|
+
let l = 0, u = t, d = i, f = E(null), p = E(null), m = u.initialPostId === null || u.initialPostId === void 0 ? -1 : u.items.findIndex((e) => e.postId === u.initialPostId), _ = E(Math.max(0, m)), S = E(!1), w = E(!1), T = 0, k = null, j = null, M = null, N = r(() => ({ gridTemplateRows: `repeat(${u.items.length}, 100cqh)` })), P = r(() => {
|
|
2289
|
+
let e = Math.max(0, _.value - 2), t = Math.min(u.items.length - 1, _.value + 2);
|
|
2290
2290
|
return u.items.slice(e, t + 1).map((t, n) => ({
|
|
2291
|
-
fetchPriority: e + n ===
|
|
2291
|
+
fetchPriority: e + n === _.value ? "high" : "low",
|
|
2292
2292
|
index: e + n,
|
|
2293
2293
|
item: t
|
|
2294
2294
|
}));
|
|
2295
|
-
}), F = r(() => u.items[
|
|
2295
|
+
}), F = r(() => u.items[_.value]?.postId), I = r(() => u.items[_.value]), L = r(() => {
|
|
2296
2296
|
let e = F.value;
|
|
2297
2297
|
return e === void 0 ? 0 : u.mediaIndices.get(e) ?? 0;
|
|
2298
|
-
}),
|
|
2298
|
+
}), R = r(() => {
|
|
2299
2299
|
let e = F.value;
|
|
2300
|
-
return e === void 0 ? "loading" : u.previewStates.get(
|
|
2301
|
-
}), B = r(() => I.value ?
|
|
2300
|
+
return e === void 0 ? "loading" : u.previewStates.get(q(e, L.value)) ?? "loading";
|
|
2301
|
+
}), B = r(() => I.value ? K(I.value, L.value) : null), V = r(() => B.value ? U(B.value, u.mediaSource ?? "preview") : null), H = r(() => R.value === "ready" && !!(V.value && z(V.value.type, V.value.src))), G = r(() => [
|
|
2302
2302
|
F.value,
|
|
2303
|
-
|
|
2303
|
+
L.value,
|
|
2304
2304
|
u.items.length,
|
|
2305
2305
|
u.loadMoreLocked,
|
|
2306
2306
|
u.reelAutoAdvance.enabled,
|
|
2307
2307
|
u.reelAutoAdvance.includePostItems,
|
|
2308
2308
|
u.reelAutoAdvance.intervalMs
|
|
2309
|
-
].join(":")),
|
|
2310
|
-
let e = I.value, t = !!(e && u.reelAutoAdvance.includePostItems &&
|
|
2309
|
+
].join(":")), ee = r(() => {
|
|
2310
|
+
let e = I.value, t = !!(e && u.reelAutoAdvance.includePostItems && L.value < W(e).length - 1), n = u.reelAutoAdvance.intervalMs / 1e3;
|
|
2311
2311
|
return `Auto advance to the next ${t ? "post item" : "post"} in ${n}s`;
|
|
2312
|
-
}),
|
|
2313
|
-
function
|
|
2312
|
+
}), J = r(() => u.reelAutoAdvance.enabled && u.reelForward.status === "idle" && I.value !== void 0 && R.value !== "loading" && !H.value), Y = r(() => !u.infiniteScroll || u.items.length <= 1), te = r(() => u.reelForward.status === "end" && u.hasNext && !u.infiniteScroll && !u.loadMoreLocked), ne = r(() => u.reelForward.status === "loading" ? "Loading the next media…" : u.reelForward.status === "error" ? "Unable to load the next media." : te.value ? "Load the next page to continue." : "You reached the end of this feed.");
|
|
2313
|
+
function re(e) {
|
|
2314
2314
|
return { gridRow: `${e + 1}` };
|
|
2315
2315
|
}
|
|
2316
|
-
function
|
|
2317
|
-
let t =
|
|
2316
|
+
function ie(e) {
|
|
2317
|
+
let t = T || e.clientHeight;
|
|
2318
2318
|
return t <= 0 || u.items.length === 0 ? 0 : Math.min(u.items.length - 1, Math.max(0, Math.round(e.scrollTop / t)));
|
|
2319
2319
|
}
|
|
2320
|
-
function
|
|
2320
|
+
function ae(e) {
|
|
2321
2321
|
let t = e.currentTarget;
|
|
2322
2322
|
if (!t) return;
|
|
2323
|
-
let n =
|
|
2324
|
-
|
|
2323
|
+
let n = T || t.clientHeight, r = Math.max(0, u.items.length - 1) * n;
|
|
2324
|
+
S.value = u.items.length > 0 && t.scrollTop > r + 1, w.value || (_.value = ie(t)), Date.now() >= l && !u.loadMoreLocked && u.infiniteScroll && ue(t) && d("loadMore");
|
|
2325
2325
|
}
|
|
2326
|
-
function
|
|
2326
|
+
function oe() {
|
|
2327
2327
|
let e = f.value;
|
|
2328
|
-
e && (
|
|
2329
|
-
e.scrollTop =
|
|
2330
|
-
}),
|
|
2328
|
+
e && (S.value = !1, le(!0), T = e.clientHeight, e.scrollTop = _.value * T, j !== null && cancelAnimationFrame(j), j = requestAnimationFrame(() => {
|
|
2329
|
+
e.scrollTop = _.value * e.clientHeight, T = e.clientHeight, j = null;
|
|
2330
|
+
}), ce());
|
|
2331
2331
|
}
|
|
2332
|
-
function
|
|
2332
|
+
function ce() {
|
|
2333
2333
|
M !== null && clearTimeout(M), M = setTimeout(() => {
|
|
2334
2334
|
M = null;
|
|
2335
2335
|
let e = f.value;
|
|
2336
|
-
e && (
|
|
2336
|
+
e && (T = e.clientHeight, e.scrollTop = _.value * T), le(!1);
|
|
2337
2337
|
}, 120);
|
|
2338
2338
|
}
|
|
2339
2339
|
function X() {
|
|
2340
|
-
|
|
2340
|
+
le(!0);
|
|
2341
2341
|
let e = f.value;
|
|
2342
|
-
e && (
|
|
2342
|
+
e && (T = e.clientHeight, e.scrollTop = _.value * T), ce();
|
|
2343
2343
|
}
|
|
2344
|
-
function
|
|
2345
|
-
|
|
2344
|
+
function le(e) {
|
|
2345
|
+
w.value = e, f.value?.toggleAttribute("data-resizing", e);
|
|
2346
2346
|
}
|
|
2347
|
-
function
|
|
2347
|
+
function Z() {
|
|
2348
2348
|
let e = f.value;
|
|
2349
|
-
Date.now() >= l && !u.loadMoreLocked && e &&
|
|
2349
|
+
Date.now() >= l && !u.loadMoreLocked && e && ue(e) && d("loadMore");
|
|
2350
2350
|
}
|
|
2351
|
-
|
|
2352
|
-
e > 0 && e < t && (l = Date.now() +
|
|
2351
|
+
A(() => u.items.length, (e, t) => {
|
|
2352
|
+
e > 0 && e < t && (l = Date.now() + Dn);
|
|
2353
2353
|
});
|
|
2354
2354
|
function de(e) {
|
|
2355
2355
|
let t = I.value;
|
|
2356
2356
|
if (!t) return !1;
|
|
2357
|
-
let n =
|
|
2357
|
+
let n = W(t).length;
|
|
2358
2358
|
if (n <= 1) return !1;
|
|
2359
|
-
let r = (
|
|
2359
|
+
let r = (L.value + e + n) % n;
|
|
2360
2360
|
return d("mediaChange", t.postId, r), !0;
|
|
2361
2361
|
}
|
|
2362
2362
|
function fe(e) {
|
|
2363
|
-
let t =
|
|
2363
|
+
let t = _.value + e;
|
|
2364
2364
|
return !f.value || t < 0 || t >= u.items.length ? !1 : (he(t), !0);
|
|
2365
2365
|
}
|
|
2366
2366
|
function pe(e, t) {
|
|
2367
2367
|
let n = u.items.findIndex((t) => t.postId === e), r = u.items[n];
|
|
2368
|
-
return !f.value || !r || t < 0 || t > r.items.length ? !1 : ((u.mediaIndices.get(e) ?? 0) !== t && d("mediaChange", e, t), n !==
|
|
2368
|
+
return !f.value || !r || t < 0 || t > r.items.length ? !1 : ((u.mediaIndices.get(e) ?? 0) !== t && d("mediaChange", e, t), n !== _.value && he(n), !0);
|
|
2369
2369
|
}
|
|
2370
2370
|
function Q() {
|
|
2371
2371
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
@@ -2373,28 +2373,28 @@ var vn = ["aria-label"], yn = /* @__PURE__ */ d({
|
|
|
2373
2373
|
function me(e) {
|
|
2374
2374
|
let t = f.value;
|
|
2375
2375
|
if (!t) return Promise.resolve();
|
|
2376
|
-
let n = e * (
|
|
2377
|
-
return
|
|
2376
|
+
let n = e * (T || t.clientHeight);
|
|
2377
|
+
return _.value = e, yn(t, n, Q());
|
|
2378
2378
|
}
|
|
2379
2379
|
function he(e) {
|
|
2380
2380
|
me(e);
|
|
2381
2381
|
}
|
|
2382
2382
|
async function ge(e) {
|
|
2383
2383
|
let t = u.items.findIndex((t) => t.postId === e);
|
|
2384
|
-
return t < 0 || t ===
|
|
2384
|
+
return t < 0 || t === _.value ? !1 : (await me(t), !0);
|
|
2385
2385
|
}
|
|
2386
2386
|
async function _e(e) {
|
|
2387
|
-
return de(e) ? (Q() || await new Promise((e) => setTimeout(e,
|
|
2387
|
+
return de(e) ? (Q() || await new Promise((e) => setTimeout(e, En)), !0) : !1;
|
|
2388
2388
|
}
|
|
2389
2389
|
function ve() {
|
|
2390
2390
|
if (!u.reelAutoAdvance.enabled) return;
|
|
2391
2391
|
let e = I.value;
|
|
2392
2392
|
if (!e) return;
|
|
2393
|
-
if (u.reelAutoAdvance.includePostItems &&
|
|
2394
|
-
d("mediaChange", e.postId,
|
|
2393
|
+
if (u.reelAutoAdvance.includePostItems && L.value < W(e).length - 1) {
|
|
2394
|
+
d("mediaChange", e.postId, L.value + 1);
|
|
2395
2395
|
return;
|
|
2396
2396
|
}
|
|
2397
|
-
let t =
|
|
2397
|
+
let t = _.value + 1, n = u.items[t];
|
|
2398
2398
|
if (!n) {
|
|
2399
2399
|
u.hasNext && u.infiniteScroll && !u.loadMoreLocked && d("loadMore");
|
|
2400
2400
|
return;
|
|
@@ -2402,46 +2402,46 @@ var vn = ["aria-label"], yn = /* @__PURE__ */ d({
|
|
|
2402
2402
|
u.reelAutoAdvance.includePostItems && (u.mediaIndices.get(n.postId) ?? 0) !== 0 && d("mediaChange", n.postId, 0), he(t);
|
|
2403
2403
|
}
|
|
2404
2404
|
function ye(e, t) {
|
|
2405
|
-
!u.reelAutoAdvance.enabled || e !== F.value || t !==
|
|
2405
|
+
!u.reelAutoAdvance.enabled || e !== F.value || t !== L.value || !H.value || ve();
|
|
2406
2406
|
}
|
|
2407
|
-
return
|
|
2408
|
-
|
|
2409
|
-
}),
|
|
2407
|
+
return A(f, (e) => {
|
|
2408
|
+
k?.disconnect(), k = null, e && (T = e.clientHeight, !(typeof ResizeObserver > "u") && (k = new ResizeObserver(oe), k.observe(e)));
|
|
2409
|
+
}), A(() => u.items.length, async (e) => {
|
|
2410
2410
|
let t = u.initialPostId, n = t == null ? -1 : u.items.findIndex(({ postId: e }) => e === t);
|
|
2411
|
-
|
|
2412
|
-
}),
|
|
2411
|
+
_.value = n >= 0 ? n : Math.min(_.value, Math.max(0, e - 1)), await h(), oe();
|
|
2412
|
+
}), A(F, (e) => {
|
|
2413
2413
|
e !== void 0 && d("activeChange", e);
|
|
2414
|
-
}, { immediate: !0 }),
|
|
2415
|
-
window.addEventListener("resize", X), window.addEventListener("orientationchange", X),
|
|
2416
|
-
}),
|
|
2417
|
-
window.removeEventListener("resize", X), window.removeEventListener("orientationchange", X),
|
|
2414
|
+
}, { immediate: !0 }), b(() => {
|
|
2415
|
+
window.addEventListener("resize", X), window.addEventListener("orientationchange", X), m >= 0 && h(oe);
|
|
2416
|
+
}), y(() => {
|
|
2417
|
+
window.removeEventListener("resize", X), window.removeEventListener("orientationchange", X), k?.disconnect(), j !== null && cancelAnimationFrame(j), M !== null && clearTimeout(M);
|
|
2418
2418
|
}), n({
|
|
2419
|
-
activeIndex:
|
|
2419
|
+
activeIndex: _,
|
|
2420
2420
|
activePostId: F,
|
|
2421
2421
|
changeActiveMedia: de,
|
|
2422
|
-
loadIfNearBottom:
|
|
2422
|
+
loadIfNearBottom: Z,
|
|
2423
2423
|
moveActivePost: fe,
|
|
2424
2424
|
navigateToItem: pe,
|
|
2425
2425
|
transitionActiveMedia: _e,
|
|
2426
2426
|
transitionActivePost: ge
|
|
2427
|
-
}), (n, r) => (
|
|
2428
|
-
class:
|
|
2427
|
+
}), (n, r) => (x(), s("main", {
|
|
2428
|
+
class: g(["reel-shell", {
|
|
2429
2429
|
"reel-shell--has-footer": !!t.cardFooter,
|
|
2430
2430
|
"reel-shell--has-header": !!t.cardHeader
|
|
2431
2431
|
}]),
|
|
2432
2432
|
"data-layout-mode": "reel"
|
|
2433
2433
|
}, [
|
|
2434
|
-
t.cardHeader && I.value && t.reelForward.status === "idle" ? (
|
|
2434
|
+
t.cardHeader && I.value && t.reelForward.status === "idle" ? (x(), a(at, {
|
|
2435
2435
|
key: 0,
|
|
2436
|
-
index:
|
|
2436
|
+
index: _.value,
|
|
2437
2437
|
item: I.value,
|
|
2438
2438
|
layout: "reel",
|
|
2439
2439
|
"loaded-count": t.items.length,
|
|
2440
|
-
"media-index":
|
|
2440
|
+
"media-index": L.value,
|
|
2441
2441
|
"media-source": t.mediaSource,
|
|
2442
2442
|
placement: "header",
|
|
2443
2443
|
region: t.cardHeader,
|
|
2444
|
-
style:
|
|
2444
|
+
style: v(t.mediaCard?.header),
|
|
2445
2445
|
total: t.total
|
|
2446
2446
|
}, null, 8, [
|
|
2447
2447
|
"index",
|
|
@@ -2453,34 +2453,34 @@ var vn = ["aria-label"], yn = /* @__PURE__ */ d({
|
|
|
2453
2453
|
"style",
|
|
2454
2454
|
"total"
|
|
2455
2455
|
])) : o("", !0),
|
|
2456
|
-
c("div",
|
|
2456
|
+
c("div", Sn, [c("div", {
|
|
2457
2457
|
ref_key: "galleryElement",
|
|
2458
2458
|
ref: f,
|
|
2459
2459
|
class: "gallery-shell reel-feed",
|
|
2460
2460
|
"data-active-post-id": F.value,
|
|
2461
|
-
"data-active-media-index":
|
|
2462
|
-
onScrollPassive:
|
|
2463
|
-
}, [t.reelForward.status === "idle" ? (
|
|
2461
|
+
"data-active-media-index": L.value,
|
|
2462
|
+
onScrollPassive: ae
|
|
2463
|
+
}, [t.reelForward.status === "idle" ? (x(), s("section", {
|
|
2464
2464
|
key: 1,
|
|
2465
2465
|
class: "reel-track",
|
|
2466
|
-
style:
|
|
2466
|
+
style: v(N.value),
|
|
2467
2467
|
"aria-label": "Media gallery"
|
|
2468
|
-
}, [(
|
|
2468
|
+
}, [(x(!0), s(e, null, C(P.value, ({ fetchPriority: e, item: n, index: i }) => (x(), a(sn, {
|
|
2469
2469
|
key: n.postId,
|
|
2470
|
-
active: i ===
|
|
2471
|
-
"advance-on-media-end": u.reelAutoAdvance.enabled && i ===
|
|
2470
|
+
active: i === _.value && !S.value,
|
|
2471
|
+
"advance-on-media-end": u.reelAutoAdvance.enabled && i === _.value,
|
|
2472
2472
|
class: "reel-item",
|
|
2473
2473
|
entering: !1,
|
|
2474
2474
|
"fetch-priority": e,
|
|
2475
2475
|
index: i,
|
|
2476
2476
|
item: n,
|
|
2477
|
-
"item-style":
|
|
2477
|
+
"item-style": re(i),
|
|
2478
2478
|
"media-card": t.mediaCard,
|
|
2479
2479
|
layout: "reel",
|
|
2480
2480
|
"loaded-count": t.items.length,
|
|
2481
2481
|
"media-index": t.mediaIndices.get(n.postId) ?? 0,
|
|
2482
2482
|
"media-source": t.mediaSource,
|
|
2483
|
-
"preview-state": t.previewStates.get(
|
|
2483
|
+
"preview-state": t.previewStates.get(O(q)(n.postId, t.mediaIndices.get(n.postId) ?? 0)) ?? "loading",
|
|
2484
2484
|
"reel-controls-target": p.value,
|
|
2485
2485
|
"reel-audio-state": t.reelAudioState,
|
|
2486
2486
|
"stationary-reel-controls": "",
|
|
@@ -2511,18 +2511,18 @@ var vn = ["aria-label"], yn = /* @__PURE__ */ d({
|
|
|
2511
2511
|
"onReady",
|
|
2512
2512
|
"onError",
|
|
2513
2513
|
"onMediaError"
|
|
2514
|
-
]))), 128))], 4)) : (
|
|
2514
|
+
]))), 128))], 4)) : (x(), s("div", {
|
|
2515
2515
|
key: 0,
|
|
2516
2516
|
class: "reel-forward-status",
|
|
2517
2517
|
role: t.reelForward.status === "error" ? "alert" : "status",
|
|
2518
2518
|
"data-status": t.reelForward.status
|
|
2519
|
-
}, [c("p", null,
|
|
2519
|
+
}, [c("p", null, D(ne.value), 1), t.reelForward.status === "error" || t.reelForward.status === "end" ? (x(), s("button", {
|
|
2520
2520
|
key: 0,
|
|
2521
2521
|
class: "reel-forward-retry",
|
|
2522
2522
|
type: "button",
|
|
2523
2523
|
disabled: t.loadMoreLocked,
|
|
2524
2524
|
onClick: r[0] ||= (e) => d("retryForward")
|
|
2525
|
-
},
|
|
2525
|
+
}, D(te.value ? "Load more" : "Retry"), 9, Tn)) : o("", !0)], 8, wn)), t.reelForward.status === "idle" ? (x(), a(se, {
|
|
2526
2526
|
key: 2,
|
|
2527
2527
|
actions: t.feedFooterActions,
|
|
2528
2528
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2531,7 +2531,7 @@ var vn = ["aria-label"], yn = /* @__PURE__ */ d({
|
|
|
2531
2531
|
"has-next": t.hasNext,
|
|
2532
2532
|
"is-loading": t.isLoadingMore,
|
|
2533
2533
|
"load-more-locked": t.loadMoreLocked,
|
|
2534
|
-
"show-load-more":
|
|
2534
|
+
"show-load-more": Y.value,
|
|
2535
2535
|
state: t.state,
|
|
2536
2536
|
onLoadMore: r[2] ||= (e) => d("loadMore"),
|
|
2537
2537
|
onRetryEnd: r[3] ||= (e) => d("retryEnd")
|
|
@@ -2545,23 +2545,23 @@ var vn = ["aria-label"], yn = /* @__PURE__ */ d({
|
|
|
2545
2545
|
"load-more-locked",
|
|
2546
2546
|
"show-load-more",
|
|
2547
2547
|
"state"
|
|
2548
|
-
])) : o("", !0)], 40,
|
|
2548
|
+
])) : o("", !0)], 40, Cn), c("div", {
|
|
2549
2549
|
ref_key: "reelControlsElement",
|
|
2550
2550
|
ref: p,
|
|
2551
2551
|
class: "reel-media-controls-host",
|
|
2552
2552
|
"data-test": "reel-media-controls-host"
|
|
2553
2553
|
}, null, 512)]),
|
|
2554
|
-
t.cardFooter && I.value && t.reelForward.status === "idle" ? (
|
|
2554
|
+
t.cardFooter && I.value && t.reelForward.status === "idle" ? (x(), a(at, {
|
|
2555
2555
|
key: 1,
|
|
2556
|
-
index:
|
|
2556
|
+
index: _.value,
|
|
2557
2557
|
item: I.value,
|
|
2558
2558
|
layout: "reel",
|
|
2559
2559
|
"loaded-count": t.items.length,
|
|
2560
|
-
"media-index":
|
|
2560
|
+
"media-index": L.value,
|
|
2561
2561
|
"media-source": t.mediaSource,
|
|
2562
2562
|
placement: "footer",
|
|
2563
2563
|
region: t.cardFooter,
|
|
2564
|
-
style:
|
|
2564
|
+
style: v(t.mediaCard?.footer),
|
|
2565
2565
|
total: t.total
|
|
2566
2566
|
}, null, 8, [
|
|
2567
2567
|
"index",
|
|
@@ -2573,24 +2573,24 @@ var vn = ["aria-label"], yn = /* @__PURE__ */ d({
|
|
|
2573
2573
|
"style",
|
|
2574
2574
|
"total"
|
|
2575
2575
|
])) : o("", !0),
|
|
2576
|
-
|
|
2577
|
-
key:
|
|
2576
|
+
J.value ? (x(), a(xn, {
|
|
2577
|
+
key: G.value,
|
|
2578
2578
|
"duration-ms": t.reelAutoAdvance.intervalMs,
|
|
2579
|
-
label:
|
|
2579
|
+
label: ee.value,
|
|
2580
2580
|
onComplete: ve
|
|
2581
2581
|
}, null, 8, ["duration-ms", "label"])) : o("", !0)
|
|
2582
2582
|
], 2));
|
|
2583
2583
|
}
|
|
2584
|
-
}),
|
|
2584
|
+
}), kn = ["data-info-sheet-open", "data-info-sheet-mode"], An = ["aria-hidden", "inert"], jn = {
|
|
2585
2585
|
key: 0,
|
|
2586
2586
|
class: "reel-info-sheet-layer",
|
|
2587
2587
|
"data-test": "reel-info-sheet"
|
|
2588
|
-
},
|
|
2588
|
+
}, Mn = [
|
|
2589
2589
|
"role",
|
|
2590
2590
|
"aria-modal",
|
|
2591
2591
|
"tabindex",
|
|
2592
2592
|
"data-active-post-id"
|
|
2593
|
-
],
|
|
2593
|
+
], Nn = /* @__PURE__ */ d({
|
|
2594
2594
|
__name: "ReelLayout",
|
|
2595
2595
|
props: {
|
|
2596
2596
|
forwardIndex: { default: null },
|
|
@@ -2637,23 +2637,23 @@ var vn = ["aria-label"], yn = /* @__PURE__ */ d({
|
|
|
2637
2637
|
"retryForward"
|
|
2638
2638
|
],
|
|
2639
2639
|
setup(e, { expose: t, emit: i }) {
|
|
2640
|
-
let l = e, d = i, p =
|
|
2640
|
+
let l = e, d = i, p = E(null), m = E(null), v = null, b = r(() => {
|
|
2641
2641
|
let e = l.initialPostId === null || l.initialPostId === void 0 ? -1 : l.items.findIndex((e) => e.postId === l.initialPostId);
|
|
2642
2642
|
return Math.max(0, e);
|
|
2643
|
-
}), S = r(() => l.items[
|
|
2644
|
-
let e =
|
|
2643
|
+
}), S = r(() => l.items[b.value]), C = r(() => S.value ?? (l.reelForward.status === "idle" ? void 0 : l.forwardItem ?? void 0)), T = r(() => S.value ? b.value : l.forwardIndex ?? 0), D = r(() => {
|
|
2644
|
+
let e = C.value?.postId;
|
|
2645
2645
|
return e === void 0 ? 0 : l.mediaIndices.get(e) ?? 0;
|
|
2646
|
-
}),
|
|
2647
|
-
let e =
|
|
2646
|
+
}), O = r(() => !!(l.infoSheet && l.infoSheetEnabled && C.value)), k = r(() => {
|
|
2647
|
+
let e = C.value;
|
|
2648
2648
|
return e ? {
|
|
2649
2649
|
close: M,
|
|
2650
|
-
index:
|
|
2650
|
+
index: T.value,
|
|
2651
2651
|
item: e,
|
|
2652
2652
|
layout: "reel",
|
|
2653
2653
|
loadedCount: l.items.length,
|
|
2654
|
-
mediaCount:
|
|
2654
|
+
mediaCount: W(e).length,
|
|
2655
2655
|
mediaIndex: D.value,
|
|
2656
|
-
mediaItem:
|
|
2656
|
+
mediaItem: K(e, D.value),
|
|
2657
2657
|
mediaSource: l.mediaSource ?? "preview",
|
|
2658
2658
|
origin: l.origin,
|
|
2659
2659
|
total: l.total
|
|
@@ -2686,23 +2686,23 @@ var vn = ["aria-label"], yn = /* @__PURE__ */ d({
|
|
|
2686
2686
|
function B(e, t) {
|
|
2687
2687
|
d("mediaChange", e, t);
|
|
2688
2688
|
}
|
|
2689
|
-
function
|
|
2689
|
+
function V(e, t) {
|
|
2690
2690
|
d("ready", e, t);
|
|
2691
2691
|
}
|
|
2692
|
-
return
|
|
2692
|
+
return A(() => ({
|
|
2693
2693
|
overlay: l.infoSheetOverlay,
|
|
2694
|
-
visible:
|
|
2694
|
+
visible: O.value
|
|
2695
2695
|
}), async (e, t) => {
|
|
2696
2696
|
if (e.visible && !t?.visible) {
|
|
2697
|
-
|
|
2697
|
+
v = document.activeElement instanceof HTMLElement ? document.activeElement : null, e.overlay && (await h(), m.value?.focus({ preventScroll: !0 }));
|
|
2698
2698
|
return;
|
|
2699
2699
|
}
|
|
2700
|
-
if (!e.visible && t?.visible &&
|
|
2701
|
-
let e =
|
|
2702
|
-
|
|
2700
|
+
if (!e.visible && t?.visible && v?.isConnected) {
|
|
2701
|
+
let e = v;
|
|
2702
|
+
v = null, await h(), e.focus({ preventScroll: !0 });
|
|
2703
2703
|
}
|
|
2704
|
-
}),
|
|
2705
|
-
|
|
2704
|
+
}), y(() => {
|
|
2705
|
+
v = null;
|
|
2706
2706
|
}), t({
|
|
2707
2707
|
changeActiveMedia: N,
|
|
2708
2708
|
loadIfNearBottom: P,
|
|
@@ -2710,15 +2710,15 @@ var vn = ["aria-label"], yn = /* @__PURE__ */ d({
|
|
|
2710
2710
|
navigateToItem: I,
|
|
2711
2711
|
transitionActiveMedia: L,
|
|
2712
2712
|
transitionActivePost: R
|
|
2713
|
-
}), (t, r) => (
|
|
2714
|
-
class:
|
|
2715
|
-
"data-info-sheet-open":
|
|
2713
|
+
}), (t, r) => (x(), s("section", {
|
|
2714
|
+
class: g(["reel-layout", `reel-layout--${e.infoSheetOverlay ? "overlay" : "layout"}`]),
|
|
2715
|
+
"data-info-sheet-open": O.value || void 0,
|
|
2716
2716
|
"data-info-sheet-mode": e.infoSheetOverlay ? "overlay" : "layout"
|
|
2717
2717
|
}, [c("div", {
|
|
2718
2718
|
class: "reel-layout-main",
|
|
2719
|
-
"aria-hidden": e.infoSheetOverlay &&
|
|
2720
|
-
inert: e.infoSheetOverlay &&
|
|
2721
|
-
}, [u(
|
|
2719
|
+
"aria-hidden": e.infoSheetOverlay && O.value || void 0,
|
|
2720
|
+
inert: e.infoSheetOverlay && O.value || void 0
|
|
2721
|
+
}, [u(On, {
|
|
2722
2722
|
ref_key: "reelFeed",
|
|
2723
2723
|
ref: p,
|
|
2724
2724
|
"can-retry-end": e.canRetryEnd,
|
|
@@ -2747,7 +2747,7 @@ var vn = ["aria-label"], yn = /* @__PURE__ */ d({
|
|
|
2747
2747
|
onMediaError: r[1] ||= (e, t) => d("mediaError", e, t),
|
|
2748
2748
|
onLoadMore: r[2] ||= (e) => d("loadMore"),
|
|
2749
2749
|
onMediaChange: B,
|
|
2750
|
-
onReady:
|
|
2750
|
+
onReady: V,
|
|
2751
2751
|
onRetryEnd: r[3] ||= (e) => d("retryEnd"),
|
|
2752
2752
|
onRetryForward: r[4] ||= (e) => d("retryForward"),
|
|
2753
2753
|
onReelAudioChange: r[5] ||= (e) => d("reelAudioChange", e)
|
|
@@ -2773,27 +2773,37 @@ var vn = ["aria-label"], yn = /* @__PURE__ */ d({
|
|
|
2773
2773
|
"reel-forward",
|
|
2774
2774
|
"state",
|
|
2775
2775
|
"total"
|
|
2776
|
-
])], 8,
|
|
2777
|
-
default:
|
|
2776
|
+
])], 8, An), u(n, { name: "vibe-info-sheet" }, {
|
|
2777
|
+
default: j(() => [O.value && e.infoSheet && k.value ? (x(), s("div", jn, [c("aside", {
|
|
2778
2778
|
ref_key: "sheetElement",
|
|
2779
|
-
ref:
|
|
2779
|
+
ref: m,
|
|
2780
2780
|
class: "reel-info-sheet",
|
|
2781
2781
|
role: e.infoSheetOverlay ? "dialog" : "complementary",
|
|
2782
2782
|
"aria-label": "Reel information",
|
|
2783
2783
|
"aria-modal": e.infoSheetOverlay ? "true" : void 0,
|
|
2784
2784
|
tabindex: e.infoSheetOverlay ? -1 : void 0,
|
|
2785
|
-
"data-active-post-id":
|
|
2786
|
-
}, [(
|
|
2785
|
+
"data-active-post-id": C.value?.postId
|
|
2786
|
+
}, [(x(), a(w(e.infoSheet.component), _(f(k.value)), null, 16))], 8, Mn)])) : o("", !0)]),
|
|
2787
2787
|
_: 1
|
|
2788
|
-
})], 10,
|
|
2789
|
-
}
|
|
2790
|
-
});
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
let
|
|
2788
|
+
})], 10, kn));
|
|
2789
|
+
}
|
|
2790
|
+
}), Pn = /* @__PURE__ */ new WeakMap();
|
|
2791
|
+
function Fn(e, t) {
|
|
2792
|
+
if (typeof t == "number" && Number.isNaN(t)) return -1;
|
|
2793
|
+
if (!m(e) || !m(e.items)) return e.items.findIndex((e) => e.postId === t);
|
|
2794
|
+
let n = Pn.get(e);
|
|
2795
|
+
return n || (n = r(() => {
|
|
2796
|
+
let t = /* @__PURE__ */ new Map();
|
|
2797
|
+
return e.items.forEach((e, n) => {
|
|
2798
|
+
let r = e.postId;
|
|
2799
|
+
t.has(r) || t.set(r, n);
|
|
2800
|
+
}), t;
|
|
2801
|
+
}), Pn.set(e, n)), n.value.get(t) ?? -1;
|
|
2802
|
+
}
|
|
2803
|
+
function In(e, t, n, r, i) {
|
|
2804
|
+
let a = Fn(e, t), o = e.items[a];
|
|
2795
2805
|
if (!o) return null;
|
|
2796
|
-
let s =
|
|
2806
|
+
let s = G(o, n), c = K(o, s);
|
|
2797
2807
|
return {
|
|
2798
2808
|
item: o,
|
|
2799
2809
|
layout: r,
|
|
@@ -2806,8 +2816,8 @@ function Mn(e, t, n, r, i) {
|
|
|
2806
2816
|
postIndex: a
|
|
2807
2817
|
};
|
|
2808
2818
|
}
|
|
2809
|
-
function
|
|
2810
|
-
|
|
2819
|
+
function Ln(e, t) {
|
|
2820
|
+
A(() => {
|
|
2811
2821
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null;
|
|
2812
2822
|
return {
|
|
2813
2823
|
mediaIndex: t === null ? 0 : e.mediaIndices.get(t) ?? 0,
|
|
@@ -2816,23 +2826,26 @@ function Nn(e, t) {
|
|
|
2816
2826
|
};
|
|
2817
2827
|
}, (n, r) => {
|
|
2818
2828
|
if (n.postId === null || n.postId === r?.postId && n.mediaIndex === r.mediaIndex && n.origin === r.origin) return;
|
|
2819
|
-
let i =
|
|
2829
|
+
let i = In(e, n.postId, n.mediaIndex, "reel", n.origin);
|
|
2820
2830
|
i && t(i);
|
|
2821
2831
|
}, { flush: "sync" });
|
|
2822
2832
|
}
|
|
2823
2833
|
//#endregion
|
|
2824
2834
|
//#region src/components/useMediaLifecycle.ts
|
|
2825
|
-
function
|
|
2826
|
-
|
|
2835
|
+
function Rn() {
|
|
2836
|
+
return E(T(/* @__PURE__ */ new Map()));
|
|
2837
|
+
}
|
|
2838
|
+
function zn(e, t) {
|
|
2839
|
+
let n = /* @__PURE__ */ new Set(), i = Rn(), a = Rn(), o = Rn(), s = () => e.reelMediaSource === "preview" ? i : e.reelMediaSource === "mobile" ? o : a, c = r(() => s().value), l = /* @__PURE__ */ new Set();
|
|
2827
2840
|
function u() {
|
|
2828
|
-
n.clear(), l.clear(), i.value = /* @__PURE__ */ new Map(), a.value = /* @__PURE__ */ new Map(), o.value = /* @__PURE__ */ new Map();
|
|
2841
|
+
n.clear(), l.clear(), i.value = T(/* @__PURE__ */ new Map()), a.value = T(/* @__PURE__ */ new Map()), o.value = T(/* @__PURE__ */ new Map());
|
|
2829
2842
|
}
|
|
2830
2843
|
function d(e, t, n, r) {
|
|
2831
|
-
let i =
|
|
2832
|
-
e.value.
|
|
2844
|
+
let i = q(t, n);
|
|
2845
|
+
e.value.set(i, r);
|
|
2833
2846
|
}
|
|
2834
2847
|
function f(t, n, r, i) {
|
|
2835
|
-
return
|
|
2848
|
+
return In(e, t, n, r, i);
|
|
2836
2849
|
}
|
|
2837
2850
|
function p(e, n, r, i) {
|
|
2838
2851
|
let a = f(e, n, r, i);
|
|
@@ -2858,13 +2871,13 @@ function Pn(e, t) {
|
|
|
2858
2871
|
d(s(), t, n, "ready"), p(t, n, "reel", e.reelOrigin ?? "reel");
|
|
2859
2872
|
}
|
|
2860
2873
|
function y(e, n) {
|
|
2861
|
-
let r =
|
|
2874
|
+
let r = q(e, n);
|
|
2862
2875
|
if (l.has(r)) return;
|
|
2863
2876
|
let i = f(e, n, "masonry", null);
|
|
2864
2877
|
i && (l.add(r), t.visible(i));
|
|
2865
2878
|
}
|
|
2866
2879
|
function b(e, r, i, a) {
|
|
2867
|
-
let o = [i,
|
|
2880
|
+
let o = [i, q(e, r)].join(":");
|
|
2868
2881
|
if (n.has(o)) return;
|
|
2869
2882
|
let s = f(e, r, i, a);
|
|
2870
2883
|
s && (n.add(o), t.fullyVisible(s));
|
|
@@ -2872,13 +2885,13 @@ function Pn(e, t) {
|
|
|
2872
2885
|
function x(e, t) {
|
|
2873
2886
|
b(e, t, "masonry", null);
|
|
2874
2887
|
}
|
|
2875
|
-
return
|
|
2888
|
+
return Ln(e, t.reelChange), A(() => {
|
|
2876
2889
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null, n = t === null ? 0 : e.mediaIndices.get(t) ?? 0;
|
|
2877
2890
|
return {
|
|
2878
2891
|
mediaIndex: n,
|
|
2879
2892
|
origin: e.reelOrigin ?? "reel",
|
|
2880
2893
|
postId: t,
|
|
2881
|
-
ready: t !== null && c.value.get(
|
|
2894
|
+
ready: t !== null && c.value.get(q(t, n)) === "ready"
|
|
2882
2895
|
};
|
|
2883
2896
|
}, (e, t) => {
|
|
2884
2897
|
e.postId === null || !e.ready || t?.ready && t.postId === e.postId && t.mediaIndex === e.mediaIndex && t.origin === e.origin || b(e.postId, e.mediaIndex, "reel", e.origin);
|
|
@@ -2898,16 +2911,16 @@ function Pn(e, t) {
|
|
|
2898
2911
|
}
|
|
2899
2912
|
//#endregion
|
|
2900
2913
|
//#region src/core/reelEscapeStack.ts
|
|
2901
|
-
var
|
|
2902
|
-
function
|
|
2903
|
-
return
|
|
2904
|
-
let t =
|
|
2905
|
-
t >= 0 &&
|
|
2914
|
+
var Bn = [];
|
|
2915
|
+
function Vn(e) {
|
|
2916
|
+
return Bn.push(e), () => {
|
|
2917
|
+
let t = Bn.indexOf(e);
|
|
2918
|
+
t >= 0 && Bn.splice(t, 1);
|
|
2906
2919
|
};
|
|
2907
2920
|
}
|
|
2908
|
-
function
|
|
2921
|
+
function Hn(e) {
|
|
2909
2922
|
if (!e.isActive()) return !1;
|
|
2910
|
-
let t =
|
|
2923
|
+
let t = Bn.filter((e) => e.isActive()), n = e.element();
|
|
2911
2924
|
return n !== null && t.some((t) => {
|
|
2912
2925
|
if (t === e) return !1;
|
|
2913
2926
|
let r = t.element();
|
|
@@ -2923,14 +2936,14 @@ function Ln(e) {
|
|
|
2923
2936
|
}
|
|
2924
2937
|
//#endregion
|
|
2925
2938
|
//#region src/components/useReelKeyboard.ts
|
|
2926
|
-
function
|
|
2939
|
+
function Un(e) {
|
|
2927
2940
|
let t = {
|
|
2928
2941
|
element: e.element,
|
|
2929
2942
|
isActive: () => e.state.layout === "reel" || e.state.reelOrigin === "masonry"
|
|
2930
2943
|
}, n = null;
|
|
2931
2944
|
function r(n) {
|
|
2932
2945
|
let r = t.isActive();
|
|
2933
|
-
if (n.key === "Escape" && r && !
|
|
2946
|
+
if (n.key === "Escape" && r && !Hn(t)) return;
|
|
2934
2947
|
if (n.key === "Escape" && e.state.reelOrigin === "masonry") {
|
|
2935
2948
|
n.preventDefault(), e.state.reelInfoSheetOverlay && e.state.reelInfoSheet.enabled && e.setReelInfoSheet(!1), e.closeMasonryReel();
|
|
2936
2949
|
return;
|
|
@@ -2949,15 +2962,15 @@ function Rn(e) {
|
|
|
2949
2962
|
let a = n.key === "ArrowLeft" ? -1 : n.key === "ArrowRight" ? 1 : 0;
|
|
2950
2963
|
a !== 0 && e.reelRenderer()?.changeActiveMedia?.(a) && n.preventDefault();
|
|
2951
2964
|
}
|
|
2952
|
-
|
|
2953
|
-
n =
|
|
2954
|
-
}),
|
|
2965
|
+
b(() => {
|
|
2966
|
+
n = Vn(t), window.addEventListener("keydown", r);
|
|
2967
|
+
}), y(() => {
|
|
2955
2968
|
window.removeEventListener("keydown", r), n?.(), n = null;
|
|
2956
2969
|
});
|
|
2957
2970
|
}
|
|
2958
2971
|
//#endregion
|
|
2959
2972
|
//#region src/components/VibeSurface.vue?vue&type=script&setup=true&lang.ts
|
|
2960
|
-
var
|
|
2973
|
+
var Wn = 35, Gn = 420, Kn = /* @__PURE__ */ d({
|
|
2961
2974
|
__name: "VibeSurface",
|
|
2962
2975
|
props: {
|
|
2963
2976
|
canRetryEnd: { type: Boolean },
|
|
@@ -2987,69 +3000,69 @@ var zn = 35, Bn = 420, Vn = /* @__PURE__ */ d({
|
|
|
2987
3000
|
"retryForward"
|
|
2988
3001
|
],
|
|
2989
3002
|
setup(t, { expose: i, emit: c }) {
|
|
2990
|
-
let l = t, d = c, f =
|
|
3003
|
+
let l = t, d = c, f = E(null), p = E(null), m = E(null), g = E(null), _ = E(!1), v = E(/* @__PURE__ */ new Set()), b = E(/* @__PURE__ */ new Map()), S = E(/* @__PURE__ */ new Set()), C = E(/* @__PURE__ */ new Map()), w = r(() => Object.freeze([...l.state.items])), T = r(() => Y(l.state, w.value)), { markMediaError: D, markMasonryFullyVisible: k, markMasonryVisible: M, markPreviewError: N, markPreviewReady: P, markReelError: F, markReelReady: I, originalStates: L, previewStates: R, reelStates: z, resetMediaLifecycle: B } = zn(l.state, {
|
|
2991
3004
|
error: (e) => d("mediaError", e),
|
|
2992
3005
|
fullyVisible: (e) => d("mediaFullyVisible", e),
|
|
2993
3006
|
ready: (e) => d("mediaReady", e),
|
|
2994
3007
|
reelChange: (e) => d("reelMediaChange", e),
|
|
2995
3008
|
visible: (e) => d("mediaVisible", e)
|
|
2996
|
-
}),
|
|
2997
|
-
function
|
|
3009
|
+
}), V = new Set(l.state.items.map((e) => e.postId)), H = null, U = null, K = !1;
|
|
3010
|
+
function q() {
|
|
2998
3011
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
2999
3012
|
}
|
|
3000
|
-
function
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3013
|
+
function ee() {
|
|
3014
|
+
H !== null && cancelAnimationFrame(H), H = requestAnimationFrame(() => {
|
|
3015
|
+
H = requestAnimationFrame(() => {
|
|
3016
|
+
H = null, v.value = /* @__PURE__ */ new Set();
|
|
3004
3017
|
});
|
|
3005
3018
|
});
|
|
3006
3019
|
}
|
|
3007
3020
|
function J(e, t) {
|
|
3008
3021
|
let n = l.state.items.find((t) => t.postId === e);
|
|
3009
3022
|
if (!n) return;
|
|
3010
|
-
let r =
|
|
3023
|
+
let r = G(n, t);
|
|
3011
3024
|
(l.state.mediaIndices.get(e) ?? 0) !== r && (l.state.mediaIndices = new Map(l.state.mediaIndices).set(e, r));
|
|
3012
3025
|
}
|
|
3013
|
-
async function
|
|
3014
|
-
await
|
|
3026
|
+
async function te() {
|
|
3027
|
+
await h(), (l.state.layout === "reel" || l.state.reelOrigin === "masonry" ? p.value : f.value)?.loadIfNearBottom();
|
|
3015
3028
|
}
|
|
3016
|
-
function
|
|
3029
|
+
function ne(e) {
|
|
3017
3030
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.changeActiveMedia?.(e) ?? !1;
|
|
3018
3031
|
}
|
|
3019
|
-
function
|
|
3032
|
+
function re(e) {
|
|
3020
3033
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.moveActivePost?.(e) ?? !1;
|
|
3021
3034
|
}
|
|
3022
|
-
function
|
|
3035
|
+
function ie(e) {
|
|
3023
3036
|
if (!(l.state.layout === "reel" || l.state.reelOrigin === "masonry") || l.state.isLoading) return "reel-inactive";
|
|
3024
3037
|
let t = l.state.items.find((t) => t.postId === e.postId);
|
|
3025
3038
|
if (!t) return "not-found";
|
|
3026
|
-
let n =
|
|
3039
|
+
let n = W(t).findIndex((t) => t.mediaId === e.mediaId);
|
|
3027
3040
|
return n < 0 ? "not-found" : p.value?.navigateToItem?.(e.postId, n) ? "navigated" : "reel-inactive";
|
|
3028
3041
|
}
|
|
3029
|
-
function
|
|
3042
|
+
function ae() {
|
|
3030
3043
|
return l.state.layout !== "masonry" || l.state.reelOrigin === "masonry" ? null : f.value?.getScrollElement?.() ?? null;
|
|
3031
3044
|
}
|
|
3032
|
-
function
|
|
3033
|
-
|
|
3045
|
+
function oe(e, t) {
|
|
3046
|
+
U = e, K = t === "keyboard", d("openReel", e), h(() => m.value?.focus());
|
|
3034
3047
|
}
|
|
3035
|
-
function
|
|
3048
|
+
function se(e) {
|
|
3036
3049
|
let t = g.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [];
|
|
3037
3050
|
return Array.from(t).find((t) => t.dataset.postId === String(e)) ?? null;
|
|
3038
3051
|
}
|
|
3039
|
-
function
|
|
3040
|
-
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null ||
|
|
3052
|
+
function ce(e, t) {
|
|
3053
|
+
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || q()) return 0;
|
|
3041
3054
|
let n = [...new Set(e)], r = new Set(Array.from(g.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [], (e) => e.dataset.postId)), i = n.filter((e) => r.has(String(e)));
|
|
3042
3055
|
if (i.length === 0) return 0;
|
|
3043
|
-
let a = new Map(C.value), o = t?.staggerMs ??
|
|
3056
|
+
let a = new Map(C.value), o = t?.staggerMs ?? Wn;
|
|
3044
3057
|
return i.forEach((e, t) => {
|
|
3045
3058
|
a.set(e, t * o);
|
|
3046
|
-
}),
|
|
3059
|
+
}), v.value = new Set([...v.value].filter((e) => !i.includes(e))), S.value = new Set([...S.value, ...n]), C.value = a, Gn + (i.length - 1) * o;
|
|
3047
3060
|
}
|
|
3048
3061
|
function X() {
|
|
3049
3062
|
S.value = /* @__PURE__ */ new Set(), C.value = /* @__PURE__ */ new Map();
|
|
3050
3063
|
}
|
|
3051
|
-
async function
|
|
3052
|
-
if (t.aborted ||
|
|
3064
|
+
async function ue(e, t) {
|
|
3065
|
+
if (t.aborted || ce(e, { staggerMs: 0 }) === 0 || (await h(), t.aborted)) return;
|
|
3053
3066
|
let n = g.value?.querySelectorAll(".masonry-feed .media-card--leaving") ?? [], r = Array.from(n).flatMap((e) => (getComputedStyle(e).opacity, e.getAnimations?.().filter((e) => e.effect?.getTiming().iterations !== Infinity) ?? []));
|
|
3054
3067
|
await new Promise((e) => {
|
|
3055
3068
|
let n = () => {
|
|
@@ -3058,60 +3071,60 @@ var zn = 35, Bn = 420, Vn = /* @__PURE__ */ d({
|
|
|
3058
3071
|
t.addEventListener("abort", n, { once: !0 }), t.aborted ? n() : Promise.allSettled(r.map((e) => e.finished)).then(n);
|
|
3059
3072
|
});
|
|
3060
3073
|
}
|
|
3061
|
-
function
|
|
3062
|
-
let n =
|
|
3074
|
+
function Z(e, t) {
|
|
3075
|
+
let n = se(e), r = n?.querySelector(".media-card-activator") ?? n;
|
|
3063
3076
|
r && (r.classList.toggle("media-card-focus-silent", !t), t || r.addEventListener("blur", () => {
|
|
3064
3077
|
r.classList.remove("media-card-focus-silent");
|
|
3065
3078
|
}, { once: !0 }), r?.focus({ preventScroll: !0 }));
|
|
3066
3079
|
}
|
|
3067
3080
|
function de() {
|
|
3068
|
-
l.state.reelOrigin === "masonry" && (
|
|
3081
|
+
l.state.reelOrigin === "masonry" && (U ??= l.state.activeReelPostId, _.value = !0, d("closeReel"));
|
|
3069
3082
|
}
|
|
3070
3083
|
function fe() {
|
|
3071
|
-
let e =
|
|
3072
|
-
_.value = !1,
|
|
3073
|
-
e !== null &&
|
|
3084
|
+
let e = U, t = K;
|
|
3085
|
+
_.value = !1, U = null, K = !1, h(() => {
|
|
3086
|
+
e !== null && Z(e, t);
|
|
3074
3087
|
});
|
|
3075
3088
|
}
|
|
3076
|
-
return
|
|
3089
|
+
return Un({
|
|
3077
3090
|
closeMasonryReel: de,
|
|
3078
3091
|
element: () => g.value,
|
|
3079
3092
|
isReelLeaving: () => _.value,
|
|
3080
3093
|
reelRenderer: () => p.value,
|
|
3081
3094
|
setReelInfoSheet: (e) => d("reelInfoSheetChange", e),
|
|
3082
3095
|
state: l.state
|
|
3083
|
-
}),
|
|
3096
|
+
}), A(() => {
|
|
3084
3097
|
let e = l.state.items;
|
|
3085
3098
|
return [e, e.length];
|
|
3086
3099
|
}, ([e]) => {
|
|
3087
|
-
let t = e.map((e) => e.postId), n = t.filter((e) => !
|
|
3088
|
-
if (
|
|
3100
|
+
let t = e.map((e) => e.postId), n = t.filter((e) => !V.has(e)), r = new Set(t);
|
|
3101
|
+
if (V = new Set(t), S.value = new Set([...S.value].filter((e) => r.has(e))), C.value = new Map([...C.value].filter(([e]) => r.has(e))), n.length === 0 || q()) return;
|
|
3089
3102
|
let i = /* @__PURE__ */ new Map();
|
|
3090
3103
|
t.forEach((e) => {
|
|
3091
|
-
let t =
|
|
3104
|
+
let t = b.value.get(e);
|
|
3092
3105
|
t !== void 0 && i.set(e, t);
|
|
3093
3106
|
}), n.forEach((e, t) => {
|
|
3094
|
-
i.set(e, t *
|
|
3095
|
-
}),
|
|
3096
|
-
}, { flush: "sync" }),
|
|
3097
|
-
|
|
3107
|
+
i.set(e, t * Wn);
|
|
3108
|
+
}), b.value = i, v.value = new Set([...v.value, ...n]), ee();
|
|
3109
|
+
}, { flush: "sync" }), y(() => {
|
|
3110
|
+
H !== null && cancelAnimationFrame(H);
|
|
3098
3111
|
}), i({
|
|
3099
|
-
animateItemRemoval:
|
|
3112
|
+
animateItemRemoval: ue,
|
|
3100
3113
|
cancelItemRemoval: X,
|
|
3101
|
-
changeActiveReelMedia:
|
|
3102
|
-
getAutoScrollElement:
|
|
3103
|
-
loadIfNearBottom:
|
|
3104
|
-
moveActiveReelPost:
|
|
3105
|
-
navigateToReelItem:
|
|
3114
|
+
changeActiveReelMedia: ne,
|
|
3115
|
+
getAutoScrollElement: ae,
|
|
3116
|
+
loadIfNearBottom: te,
|
|
3117
|
+
moveActiveReelPost: re,
|
|
3118
|
+
navigateToReelItem: ie,
|
|
3106
3119
|
resetMediaLifecycle: B,
|
|
3107
|
-
startItemRemoval:
|
|
3120
|
+
startItemRemoval: ce,
|
|
3108
3121
|
transitionActiveReelMedia: (e) => p.value?.transitionActiveMedia?.(e) ?? Promise.resolve(!1),
|
|
3109
3122
|
transitionActiveReelPost: (e) => p.value?.transitionActivePost?.(e) ?? Promise.resolve(!1)
|
|
3110
|
-
}), (r, i) => (
|
|
3123
|
+
}), (r, i) => (x(), s("div", {
|
|
3111
3124
|
ref_key: "surfaceElement",
|
|
3112
3125
|
ref: g,
|
|
3113
3126
|
class: "vibe-surface"
|
|
3114
|
-
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (
|
|
3127
|
+
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (x(), a(Nn, {
|
|
3115
3128
|
key: 0,
|
|
3116
3129
|
ref_key: "reelRenderer",
|
|
3117
3130
|
ref: p,
|
|
@@ -3136,28 +3149,28 @@ var zn = 35, Bn = 420, Vn = /* @__PURE__ */ d({
|
|
|
3136
3149
|
"info-sheet-overlay": t.state.reelInfoSheetOverlay,
|
|
3137
3150
|
"next-page-error": !!t.state.nextPageError,
|
|
3138
3151
|
origin: "reel",
|
|
3139
|
-
"preview-states":
|
|
3152
|
+
"preview-states": O(z),
|
|
3140
3153
|
"reel-auto-advance": t.state.reelAutoAdvance,
|
|
3141
3154
|
"reel-audio-state": t.reelAudioState,
|
|
3142
3155
|
"reel-forward": t.state.reelForward,
|
|
3143
|
-
state:
|
|
3156
|
+
state: T.value,
|
|
3144
3157
|
total: t.state.total,
|
|
3145
3158
|
onActiveChange: i[0] ||= (e) => d("activeReelChange", e),
|
|
3146
3159
|
onCloseInfoSheet: i[1] ||= (e) => d("reelInfoSheetChange", !1),
|
|
3147
|
-
onError:
|
|
3148
|
-
onMediaError: i[2] ||= (e, t) =>
|
|
3160
|
+
onError: O(F),
|
|
3161
|
+
onMediaError: i[2] ||= (e, t) => O(D)(e, t, "reel"),
|
|
3149
3162
|
onLoadMore: i[3] ||= (e) => d("loadMore"),
|
|
3150
3163
|
onMediaChange: J,
|
|
3151
|
-
onReady:
|
|
3164
|
+
onReady: O(I),
|
|
3152
3165
|
onRetryEnd: i[4] ||= (e) => d("retryEnd"),
|
|
3153
3166
|
onRetryForward: i[5] ||= (e) => d("retryForward"),
|
|
3154
3167
|
onReelAudioChange: i[6] ||= (e) => d("reelAudioChange", e)
|
|
3155
|
-
}, null, 8, /* @__PURE__ */ "can-retry-end.has-next.card-footer.card-header.feed-footer.feed-footer-actions.forward-index.forward-item.media-card.infinite-scroll.is-loading-more.items.load-more-locked.media-source.media-indices.initial-post-id.info-sheet.info-sheet-enabled.info-sheet-overlay.next-page-error.preview-states.reel-auto-advance.reel-audio-state.reel-forward.state.total.onError.onReady".split("."))) : t.state.error || t.state.isLoading || t.state.items.length === 0 && t.state.reelForward.status === "idle" ? (
|
|
3168
|
+
}, null, 8, /* @__PURE__ */ "can-retry-end.has-next.card-footer.card-header.feed-footer.feed-footer-actions.forward-index.forward-item.media-card.infinite-scroll.is-loading-more.items.load-more-locked.media-source.media-indices.initial-post-id.info-sheet.info-sheet-enabled.info-sheet-overlay.next-page-error.preview-states.reel-auto-advance.reel-audio-state.reel-forward.state.total.onError.onReady".split("."))) : t.state.error || t.state.isLoading || t.state.items.length === 0 && t.state.reelForward.status === "idle" ? (x(), a(le, {
|
|
3156
3169
|
key: 1,
|
|
3157
3170
|
actions: t.feedFooterActions,
|
|
3158
3171
|
"can-retry-end": t.canRetryEnd,
|
|
3159
3172
|
"feed-footer": t.feedFooter,
|
|
3160
|
-
state:
|
|
3173
|
+
state: T.value,
|
|
3161
3174
|
onLoadMore: i[7] ||= (e) => d("loadMore"),
|
|
3162
3175
|
onRetryEnd: i[8] ||= (e) => d("retryEnd")
|
|
3163
3176
|
}, null, 8, [
|
|
@@ -3165,12 +3178,12 @@ var zn = 35, Bn = 420, Vn = /* @__PURE__ */ d({
|
|
|
3165
3178
|
"can-retry-end",
|
|
3166
3179
|
"feed-footer",
|
|
3167
3180
|
"state"
|
|
3168
|
-
])) : (
|
|
3181
|
+
])) : (x(), s(e, { key: 2 }, [u(_n, {
|
|
3169
3182
|
ref_key: "masonryRenderer",
|
|
3170
3183
|
ref: f,
|
|
3171
3184
|
"can-retry-end": t.canRetryEnd,
|
|
3172
|
-
"entering-post-ids":
|
|
3173
|
-
"entry-delays":
|
|
3185
|
+
"entering-post-ids": v.value,
|
|
3186
|
+
"entry-delays": b.value,
|
|
3174
3187
|
"leaving-post-ids": S.value,
|
|
3175
3188
|
"removal-delays": C.value,
|
|
3176
3189
|
"card-footer": t.cardFooter,
|
|
@@ -3186,33 +3199,33 @@ var zn = 35, Bn = 420, Vn = /* @__PURE__ */ d({
|
|
|
3186
3199
|
"load-more-locked": t.state.loadMoreLocked,
|
|
3187
3200
|
"media-indices": t.state.mediaIndices,
|
|
3188
3201
|
"next-page-error": !!t.state.nextPageError,
|
|
3189
|
-
"preview-states":
|
|
3202
|
+
"preview-states": O(R),
|
|
3190
3203
|
suspended: t.state.reelOrigin === "masonry" || _.value,
|
|
3191
|
-
state:
|
|
3204
|
+
state: T.value,
|
|
3192
3205
|
total: t.state.total,
|
|
3193
|
-
onActivate:
|
|
3194
|
-
onError:
|
|
3195
|
-
onMediaError: i[9] ||= (e, t) =>
|
|
3196
|
-
onFullyVisible:
|
|
3206
|
+
onActivate: oe,
|
|
3207
|
+
onError: O(N),
|
|
3208
|
+
onMediaError: i[9] ||= (e, t) => O(D)(e, t, "masonry"),
|
|
3209
|
+
onFullyVisible: O(k),
|
|
3197
3210
|
onLoadMore: i[10] ||= (e) => d("loadMore"),
|
|
3198
3211
|
onMediaChange: J,
|
|
3199
|
-
onReady:
|
|
3212
|
+
onReady: O(P),
|
|
3200
3213
|
onRetryEnd: i[11] ||= (e) => d("retryEnd"),
|
|
3201
|
-
onVisible:
|
|
3214
|
+
onVisible: O(M)
|
|
3202
3215
|
}, null, 8, /* @__PURE__ */ "can-retry-end.entering-post-ids.entry-delays.leaving-post-ids.removal-delays.card-footer.card-header.feed-footer.feed-footer-actions.media-card.masonry.has-next.infinite-scroll.is-loading-more.items.load-more-locked.media-indices.next-page-error.preview-states.suspended.state.total.onError.onFullyVisible.onReady.onVisible".split(".")), u(n, {
|
|
3203
3216
|
name: "vibe-reel-viewer",
|
|
3204
3217
|
onAfterLeave: fe
|
|
3205
3218
|
}, {
|
|
3206
|
-
default:
|
|
3219
|
+
default: j(() => [t.state.reelOrigin === "masonry" ? (x(), s("section", {
|
|
3207
3220
|
key: 0,
|
|
3208
3221
|
ref_key: "reelOverlay",
|
|
3209
|
-
ref:
|
|
3222
|
+
ref: m,
|
|
3210
3223
|
class: "vibe-reel-overlay",
|
|
3211
3224
|
role: "dialog",
|
|
3212
3225
|
"aria-label": "Media viewer",
|
|
3213
3226
|
"aria-modal": "true",
|
|
3214
3227
|
tabindex: "-1"
|
|
3215
|
-
}, [u(
|
|
3228
|
+
}, [u(Nn, {
|
|
3216
3229
|
ref_key: "reelRenderer",
|
|
3217
3230
|
ref: p,
|
|
3218
3231
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -3236,19 +3249,19 @@ var zn = 35, Bn = 420, Vn = /* @__PURE__ */ d({
|
|
|
3236
3249
|
"media-source": "original",
|
|
3237
3250
|
"next-page-error": !!t.state.nextPageError,
|
|
3238
3251
|
origin: "masonry",
|
|
3239
|
-
"preview-states":
|
|
3252
|
+
"preview-states": O(L),
|
|
3240
3253
|
"reel-auto-advance": t.state.reelAutoAdvance,
|
|
3241
3254
|
"reel-audio-state": t.reelAudioState,
|
|
3242
3255
|
"reel-forward": t.state.reelForward,
|
|
3243
|
-
state:
|
|
3256
|
+
state: T.value,
|
|
3244
3257
|
total: t.state.total,
|
|
3245
3258
|
onActiveChange: i[12] ||= (e) => d("activeReelChange", e),
|
|
3246
3259
|
onCloseInfoSheet: i[13] ||= (e) => d("reelInfoSheetChange", !1),
|
|
3247
|
-
onError:
|
|
3248
|
-
onMediaError: i[14] ||= (e, t) =>
|
|
3260
|
+
onError: O(F),
|
|
3261
|
+
onMediaError: i[14] ||= (e, t) => O(D)(e, t, "reel"),
|
|
3249
3262
|
onLoadMore: i[15] ||= (e) => d("loadMore"),
|
|
3250
3263
|
onMediaChange: J,
|
|
3251
|
-
onReady:
|
|
3264
|
+
onReady: O(I),
|
|
3252
3265
|
onRetryEnd: i[16] ||= (e) => d("retryEnd"),
|
|
3253
3266
|
onRetryForward: i[17] ||= (e) => d("retryForward"),
|
|
3254
3267
|
onReelAudioChange: i[18] ||= (e) => d("reelAudioChange", e)
|
|
@@ -3259,7 +3272,7 @@ var zn = 35, Bn = 420, Vn = /* @__PURE__ */ d({
|
|
|
3259
3272
|
});
|
|
3260
3273
|
//#endregion
|
|
3261
3274
|
//#region src/core/page.ts
|
|
3262
|
-
function
|
|
3275
|
+
function qn(e) {
|
|
3263
3276
|
if (!e || typeof e != "object" || !Array.isArray(e.items)) throw TypeError("Vibe loadPage must resolve to a page with an items array.");
|
|
3264
3277
|
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.");
|
|
3265
3278
|
if (e.next !== null && typeof e.next != "string" && typeof e.next != "number") throw TypeError("Vibe page next must be a string, number, or null.");
|
|
@@ -3268,24 +3281,32 @@ function Hn(e) {
|
|
|
3268
3281
|
}
|
|
3269
3282
|
function $(e, t) {
|
|
3270
3283
|
let n = new Set(e.map((e) => e.postId));
|
|
3271
|
-
return [...e, ...
|
|
3284
|
+
return [...e, ...Jn(n, t)];
|
|
3272
3285
|
}
|
|
3273
|
-
function
|
|
3286
|
+
function Jn(e, t) {
|
|
3287
|
+
return t.filter((t) => e.has(t.postId) ? !1 : (e.add(t.postId), !0));
|
|
3288
|
+
}
|
|
3289
|
+
function Yn(e, t) {
|
|
3290
|
+
if (t.length === 0) return e;
|
|
3291
|
+
let n = Jn(new Set(e.map((e) => e.postId)), t);
|
|
3292
|
+
return n.length > 0 ? [...e, ...n] : e;
|
|
3293
|
+
}
|
|
3294
|
+
function Xn(e) {
|
|
3274
3295
|
return `${typeof e}:${String(e)}`;
|
|
3275
3296
|
}
|
|
3276
|
-
function
|
|
3277
|
-
return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview?.src ?? ""}` : `id:${
|
|
3297
|
+
function Zn(e) {
|
|
3298
|
+
return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview?.src ?? ""}` : `id:${Xn(e.mediaId)}`;
|
|
3278
3299
|
}
|
|
3279
|
-
function
|
|
3280
|
-
let n = [...e], r = new Map(e.map((e, t) => [
|
|
3300
|
+
function Qn(e, t) {
|
|
3301
|
+
let n = [...e], r = new Map(e.map((e, t) => [Xn(e.postId), t]));
|
|
3281
3302
|
return t.forEach((e) => {
|
|
3282
|
-
let t =
|
|
3303
|
+
let t = Xn(e.postId), i = r.get(t);
|
|
3283
3304
|
if (i === void 0) {
|
|
3284
3305
|
r.set(t, n.length), n.push(e);
|
|
3285
3306
|
return;
|
|
3286
3307
|
}
|
|
3287
|
-
let a = n[i], o = new Set([a, ...a.items].map(
|
|
3288
|
-
let t =
|
|
3308
|
+
let a = n[i], o = new Set([a, ...a.items].map(Zn)), s = [e, ...e.items].filter((e) => {
|
|
3309
|
+
let t = Zn(e);
|
|
3289
3310
|
return o.has(t) ? !1 : (o.add(t), !0);
|
|
3290
3311
|
});
|
|
3291
3312
|
s.length > 0 && (n[i] = {
|
|
@@ -3294,14 +3315,14 @@ function Gn(e, t) {
|
|
|
3294
3315
|
});
|
|
3295
3316
|
}), n;
|
|
3296
3317
|
}
|
|
3297
|
-
function
|
|
3318
|
+
function $n(e) {
|
|
3298
3319
|
return Object.prototype.hasOwnProperty.call(e, "current") ? e.current ?? null : e.next;
|
|
3299
3320
|
}
|
|
3300
3321
|
//#endregion
|
|
3301
3322
|
//#region src/core/appendPage.ts
|
|
3302
|
-
function
|
|
3303
|
-
let i =
|
|
3304
|
-
t.items =
|
|
3323
|
+
function er(e, t, n, r) {
|
|
3324
|
+
let i = qn(e), a = n.filterItems(i.items), o = $n(i);
|
|
3325
|
+
t.items = Qn(t.items, a), t.next = i.next, i.total !== void 0 && (t.total = i.total), r(o), n.recordPages([{
|
|
3305
3326
|
contributionIds: a.map(({ postId: e }) => e),
|
|
3306
3327
|
cursor: o,
|
|
3307
3328
|
next: i.next,
|
|
@@ -3310,32 +3331,32 @@ function qn(e, t, n, r) {
|
|
|
3310
3331
|
}
|
|
3311
3332
|
//#endregion
|
|
3312
3333
|
//#region src/core/requestDelay.ts
|
|
3313
|
-
var
|
|
3334
|
+
var tr = 2e3, nr = 1e4, rr = 250, ir = {
|
|
3314
3335
|
delayRemainingMs: null,
|
|
3315
3336
|
nextRequestAt: null
|
|
3316
3337
|
};
|
|
3317
|
-
function
|
|
3338
|
+
function ar(e, t) {
|
|
3318
3339
|
return e === void 0 ? t : Math.floor(e);
|
|
3319
3340
|
}
|
|
3320
|
-
function
|
|
3341
|
+
function or(e, t) {
|
|
3321
3342
|
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.`);
|
|
3322
3343
|
}
|
|
3323
|
-
function
|
|
3324
|
-
let n =
|
|
3344
|
+
function sr(e, t = {}) {
|
|
3345
|
+
let n = ar(t.delayStepMs, tr), r = ar(t.delayMaxMs, nr);
|
|
3325
3346
|
return Math.min(Math.max(0, e) * n, r);
|
|
3326
3347
|
}
|
|
3327
|
-
function
|
|
3328
|
-
if (e == null || !Number.isFinite(e)) return { ...
|
|
3348
|
+
function cr(e) {
|
|
3349
|
+
if (e == null || !Number.isFinite(e)) return { ...ir };
|
|
3329
3350
|
let t = Math.max(0, Math.floor(e - Date.now()));
|
|
3330
3351
|
return t > 0 ? {
|
|
3331
3352
|
delayRemainingMs: t,
|
|
3332
3353
|
nextRequestAt: e
|
|
3333
|
-
} : { ...
|
|
3354
|
+
} : { ...ir };
|
|
3334
3355
|
}
|
|
3335
|
-
async function
|
|
3356
|
+
async function lr({ delayMs: e, onChange: t, signal: n }) {
|
|
3336
3357
|
if (n.aborted) throw new DOMException("Aborted", "AbortError");
|
|
3337
3358
|
if (e <= 0) {
|
|
3338
|
-
t({ ...
|
|
3359
|
+
t({ ...ir });
|
|
3339
3360
|
return;
|
|
3340
3361
|
}
|
|
3341
3362
|
let r = Date.now() + e;
|
|
@@ -3343,9 +3364,9 @@ async function nr({ delayMs: e, onChange: t, signal: n }) {
|
|
|
3343
3364
|
delayRemainingMs: e,
|
|
3344
3365
|
nextRequestAt: r
|
|
3345
3366
|
}), await new Promise((i, a) => {
|
|
3346
|
-
let o = !1, s = setInterval(f,
|
|
3367
|
+
let o = !1, s = setInterval(f, rr), c = setTimeout(() => u(), e);
|
|
3347
3368
|
function l() {
|
|
3348
|
-
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...
|
|
3369
|
+
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...ir });
|
|
3349
3370
|
}
|
|
3350
3371
|
function u(e) {
|
|
3351
3372
|
o || (o = !0, l(), e ? a(e) : i());
|
|
@@ -3354,42 +3375,42 @@ async function nr({ delayMs: e, onChange: t, signal: n }) {
|
|
|
3354
3375
|
u(new DOMException("Aborted", "AbortError"));
|
|
3355
3376
|
}
|
|
3356
3377
|
function f() {
|
|
3357
|
-
let e =
|
|
3378
|
+
let e = cr(r);
|
|
3358
3379
|
t(e), e.delayRemainingMs === null && u();
|
|
3359
3380
|
}
|
|
3360
3381
|
n.addEventListener("abort", d, { once: !0 });
|
|
3361
3382
|
});
|
|
3362
3383
|
}
|
|
3363
|
-
var
|
|
3384
|
+
var ur = class {
|
|
3364
3385
|
interval = null;
|
|
3365
3386
|
constructor(e) {
|
|
3366
3387
|
this.onChange = e;
|
|
3367
3388
|
}
|
|
3368
3389
|
clear() {
|
|
3369
|
-
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...
|
|
3390
|
+
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...ir });
|
|
3370
3391
|
}
|
|
3371
3392
|
sync(e) {
|
|
3372
3393
|
this.clear();
|
|
3373
|
-
let t =
|
|
3394
|
+
let t = cr(e);
|
|
3374
3395
|
this.onChange(t), t.delayRemainingMs !== null && (this.interval = setInterval(() => {
|
|
3375
|
-
let t =
|
|
3396
|
+
let t = cr(e);
|
|
3376
3397
|
this.onChange(t), t.delayRemainingMs === null && this.clear();
|
|
3377
|
-
},
|
|
3398
|
+
}, rr));
|
|
3378
3399
|
}
|
|
3379
3400
|
};
|
|
3380
|
-
function
|
|
3401
|
+
function dr(e, t = !0) {
|
|
3381
3402
|
return e.maxAdditionalPages === "unlimited" ? Infinity : (e.maxAdditionalPages ?? 10) + (t ? 1 : 0);
|
|
3382
3403
|
}
|
|
3383
|
-
function
|
|
3404
|
+
function fr(e) {
|
|
3384
3405
|
return `${typeof e}:${String(e)}`;
|
|
3385
3406
|
}
|
|
3386
|
-
function
|
|
3407
|
+
function pr(e, t) {
|
|
3387
3408
|
if (!Number.isInteger(e) || e <= 0) throw TypeError(`Vibe ${t} must be a positive integer.`);
|
|
3388
3409
|
}
|
|
3389
|
-
function
|
|
3410
|
+
function mr(e) {
|
|
3390
3411
|
if (!e) return;
|
|
3391
|
-
if (
|
|
3392
|
-
|
|
3412
|
+
if (pr(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
|
|
3413
|
+
or(e, "frontend autofill");
|
|
3393
3414
|
let t = e.maxAdditionalPages;
|
|
3394
3415
|
if (t !== void 0 && t !== "unlimited" && (!Number.isInteger(t) || t < 0)) throw TypeError("Vibe autofill maxAdditionalPages must be a non-negative integer or \"unlimited\".");
|
|
3395
3416
|
return;
|
|
@@ -3401,7 +3422,7 @@ function sr(e) {
|
|
|
3401
3422
|
if (t.pageSize !== e.pageSize) throw TypeError("Vibe backend autofill initialSession pageSize must match autofill pageSize.");
|
|
3402
3423
|
}
|
|
3403
3424
|
}
|
|
3404
|
-
function
|
|
3425
|
+
function hr(e, t, n = !0) {
|
|
3405
3426
|
if (!e) return {
|
|
3406
3427
|
cycleId: null,
|
|
3407
3428
|
delayRemainingMs: null,
|
|
@@ -3418,7 +3439,7 @@ function cr(e, t, n = !0) {
|
|
|
3418
3439
|
status: "idle",
|
|
3419
3440
|
strategy: null
|
|
3420
3441
|
};
|
|
3421
|
-
let r = e.strategy === "backend" ? t ?? (n ? e.initialSession : void 0) : void 0, i = r?.received ?? 0, a =
|
|
3442
|
+
let r = e.strategy === "backend" ? t ?? (n ? e.initialSession : void 0) : void 0, i = r?.received ?? 0, a = cr(r?.nextRequestAt);
|
|
3422
3443
|
return {
|
|
3423
3444
|
cycleId: r?.cycleId ?? null,
|
|
3424
3445
|
...a,
|
|
@@ -3435,7 +3456,7 @@ function cr(e, t, n = !0) {
|
|
|
3435
3456
|
strategy: e.strategy
|
|
3436
3457
|
};
|
|
3437
3458
|
}
|
|
3438
|
-
function
|
|
3459
|
+
function gr(e) {
|
|
3439
3460
|
return [
|
|
3440
3461
|
"cancelling",
|
|
3441
3462
|
"filling",
|
|
@@ -3443,9 +3464,9 @@ function lr(e) {
|
|
|
3443
3464
|
"waiting"
|
|
3444
3465
|
].includes(e.status);
|
|
3445
3466
|
}
|
|
3446
|
-
async function
|
|
3467
|
+
async function _r(e, t, n) {
|
|
3447
3468
|
let r = t.autofill;
|
|
3448
|
-
if (!
|
|
3469
|
+
if (!gr(r) || !r.cycleId) return;
|
|
3449
3470
|
let i = {
|
|
3450
3471
|
cycleId: r.cycleId,
|
|
3451
3472
|
feedKey: r.feedKey ?? "",
|
|
@@ -3458,16 +3479,16 @@ async function ur(e, t, n) {
|
|
|
3458
3479
|
throw r.error = e, r.status = "error", e;
|
|
3459
3480
|
}
|
|
3460
3481
|
}
|
|
3461
|
-
function
|
|
3482
|
+
function vr(e, t, n) {
|
|
3462
3483
|
return e?.strategy === "backend" && t.feedKey === e.feedKey && t.sessionId === n.sessionId;
|
|
3463
3484
|
}
|
|
3464
|
-
async function
|
|
3465
|
-
let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ??
|
|
3485
|
+
async function yr({ 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 }) {
|
|
3486
|
+
let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ?? dr(s), g = t, _ = t, v = t, y = 0, b = [], x;
|
|
3466
3487
|
for (; y < h;) {
|
|
3467
|
-
let e =
|
|
3488
|
+
let e = fr(g);
|
|
3468
3489
|
if (m.has(e)) throw Error("Vibe autofill received a repeated cursor.");
|
|
3469
|
-
if (m.add(e), await
|
|
3470
|
-
delayMs:
|
|
3490
|
+
if (m.add(e), await lr({
|
|
3491
|
+
delayMs: sr(l + y, s),
|
|
3471
3492
|
onChange: a,
|
|
3472
3493
|
signal: d
|
|
3473
3494
|
}), y > 0 && u()) return {
|
|
@@ -3481,7 +3502,7 @@ async function fr({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
3481
3502
|
status: "paused",
|
|
3482
3503
|
total: x
|
|
3483
3504
|
};
|
|
3484
|
-
let t =
|
|
3505
|
+
let t = qn(await n({
|
|
3485
3506
|
cursor: g,
|
|
3486
3507
|
signal: d
|
|
3487
3508
|
}));
|
|
@@ -3538,12 +3559,12 @@ async function fr({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
3538
3559
|
}
|
|
3539
3560
|
//#endregion
|
|
3540
3561
|
//#region src/core/autofillController.ts
|
|
3541
|
-
var
|
|
3562
|
+
var br = class {
|
|
3542
3563
|
collection = null;
|
|
3543
3564
|
cycle = 0;
|
|
3544
3565
|
delayCountdown;
|
|
3545
3566
|
constructor(e) {
|
|
3546
|
-
this.context = e, this.delayCountdown = new
|
|
3567
|
+
this.context = e, this.delayCountdown = new ur((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
|
|
3547
3568
|
}
|
|
3548
3569
|
beginCycle() {
|
|
3549
3570
|
let { options: e, state: t } = this.context;
|
|
@@ -3551,14 +3572,14 @@ var pr = class {
|
|
|
3551
3572
|
this.clear();
|
|
3552
3573
|
let n = `vibe-autofill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
3553
3574
|
return t.autofill = {
|
|
3554
|
-
...
|
|
3575
|
+
...hr(e, void 0, !1),
|
|
3555
3576
|
cycleId: n,
|
|
3556
3577
|
status: "filling"
|
|
3557
3578
|
}, n;
|
|
3558
3579
|
}
|
|
3559
3580
|
async cancel() {
|
|
3560
3581
|
let { cancelRequest: e, options: t, state: n } = this.context;
|
|
3561
|
-
await
|
|
3582
|
+
await _r(t, n, e), this.commitCollection();
|
|
3562
3583
|
}
|
|
3563
3584
|
captureCollection(e, t) {
|
|
3564
3585
|
t && (this.collection = e);
|
|
@@ -3586,30 +3607,30 @@ var pr = class {
|
|
|
3586
3607
|
requests: r.requests
|
|
3587
3608
|
}), !0) : !1;
|
|
3588
3609
|
}
|
|
3589
|
-
},
|
|
3590
|
-
function
|
|
3610
|
+
}, xr = 100;
|
|
3611
|
+
function Sr(e, t) {
|
|
3591
3612
|
if (!Number.isFinite(t) || t <= 0) throw TypeError(`Vibe ${e} must be a positive number.`);
|
|
3592
3613
|
}
|
|
3593
|
-
function
|
|
3614
|
+
function Cr(e, t, n) {
|
|
3594
3615
|
return Math.min(n, Math.max(t, e));
|
|
3595
3616
|
}
|
|
3596
|
-
function
|
|
3617
|
+
function wr(e) {
|
|
3597
3618
|
if (!e) return;
|
|
3598
3619
|
let t = e.minSpeedPxPerSecond ?? 20, n = e.maxSpeedPxPerSecond ?? 240;
|
|
3599
|
-
if (
|
|
3600
|
-
e.speedPxPerSecond !== void 0 &&
|
|
3620
|
+
if (Sr("autoScroll.minSpeedPxPerSecond", t), Sr("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
|
|
3621
|
+
e.speedPxPerSecond !== void 0 && Sr("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
|
|
3601
3622
|
}
|
|
3602
|
-
function
|
|
3623
|
+
function Tr(e) {
|
|
3603
3624
|
let t = e?.minSpeedPxPerSecond ?? 20, n = e?.maxSpeedPxPerSecond ?? 240;
|
|
3604
3625
|
return {
|
|
3605
3626
|
enabled: e?.enabled ?? !1,
|
|
3606
3627
|
maxSpeedPxPerSecond: n,
|
|
3607
3628
|
minSpeedPxPerSecond: t,
|
|
3608
3629
|
paused: !1,
|
|
3609
|
-
speedPxPerSecond:
|
|
3630
|
+
speedPxPerSecond: Cr(e?.speedPxPerSecond ?? 80, t, n)
|
|
3610
3631
|
};
|
|
3611
3632
|
}
|
|
3612
|
-
var
|
|
3633
|
+
var Er = class {
|
|
3613
3634
|
frame = null;
|
|
3614
3635
|
lastTimestamp = null;
|
|
3615
3636
|
mounted = !1;
|
|
@@ -3629,9 +3650,9 @@ var yr = class {
|
|
|
3629
3650
|
this.options.state.enabled && (this.options.state.paused = e, this.lastTimestamp = null, e ? this.cancelFrame() : this.schedule());
|
|
3630
3651
|
}
|
|
3631
3652
|
setSpeed(e) {
|
|
3632
|
-
|
|
3653
|
+
Sr("auto-scroll speed", e);
|
|
3633
3654
|
let t = this.options.state;
|
|
3634
|
-
t.speedPxPerSecond =
|
|
3655
|
+
t.speedPxPerSecond = Cr(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
|
|
3635
3656
|
}
|
|
3636
3657
|
tick = (e) => {
|
|
3637
3658
|
this.frame = null;
|
|
@@ -3643,7 +3664,7 @@ var yr = class {
|
|
|
3643
3664
|
return;
|
|
3644
3665
|
}
|
|
3645
3666
|
if (this.lastTimestamp !== null) {
|
|
3646
|
-
let r = Math.min(
|
|
3667
|
+
let r = Math.min(xr, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
|
|
3647
3668
|
n.scrollTop = Math.min(i, n.scrollTop + t.speedPxPerSecond * r / 1e3);
|
|
3648
3669
|
}
|
|
3649
3670
|
this.lastTimestamp = e, this.schedule();
|
|
@@ -3657,13 +3678,13 @@ var yr = class {
|
|
|
3657
3678
|
};
|
|
3658
3679
|
//#endregion
|
|
3659
3680
|
//#region src/core/backendAutofill.ts
|
|
3660
|
-
async function
|
|
3681
|
+
async function Dr(e, t, n, r) {
|
|
3661
3682
|
let i = await e.onUnderfilled(n);
|
|
3662
3683
|
if (!r()) return;
|
|
3663
3684
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend autofill requires a sessionId.");
|
|
3664
3685
|
let a = Math.max(n.received, i.received ?? n.received);
|
|
3665
3686
|
Object.assign(t.autofill, {
|
|
3666
|
-
...
|
|
3687
|
+
...cr(i.nextRequestAt),
|
|
3667
3688
|
missing: Math.max(0, e.pageSize - a),
|
|
3668
3689
|
received: a,
|
|
3669
3690
|
sequence: i.sequence ?? 0,
|
|
@@ -3671,19 +3692,19 @@ async function br(e, t, n, r) {
|
|
|
3671
3692
|
status: "waiting"
|
|
3672
3693
|
});
|
|
3673
3694
|
}
|
|
3674
|
-
function
|
|
3695
|
+
function Or(e, t) {
|
|
3675
3696
|
["complete", "exhausted"].includes(t.status) && t.items && (e.items = $(e.items, t.items)), t.next !== void 0 && (e.next = t.next), t.total !== void 0 && (e.total = t.total);
|
|
3676
3697
|
}
|
|
3677
|
-
function
|
|
3698
|
+
function kr(e, t, n) {
|
|
3678
3699
|
let r = t.autofill;
|
|
3679
|
-
return !
|
|
3700
|
+
return !vr(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (Or(t, n), Object.assign(r, cr(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);
|
|
3680
3701
|
}
|
|
3681
|
-
function
|
|
3682
|
-
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill =
|
|
3702
|
+
function Ar(e, t, n) {
|
|
3703
|
+
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = hr(e, n), Or(t, n), !0);
|
|
3683
3704
|
}
|
|
3684
3705
|
//#endregion
|
|
3685
3706
|
//#region src/core/backlogRestore.ts
|
|
3686
|
-
async function
|
|
3707
|
+
async function jr(e, t, n) {
|
|
3687
3708
|
if (!e) return;
|
|
3688
3709
|
let r = new AbortController();
|
|
3689
3710
|
n(r);
|
|
@@ -3698,7 +3719,7 @@ async function wr(e, t, n) {
|
|
|
3698
3719
|
}
|
|
3699
3720
|
//#endregion
|
|
3700
3721
|
//#region src/core/initialAutofill.ts
|
|
3701
|
-
async function
|
|
3722
|
+
async function Mr({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, onPages: i, options: a, signal: o, state: s }) {
|
|
3702
3723
|
let c = a.autofill;
|
|
3703
3724
|
if (!c) return;
|
|
3704
3725
|
let l = s.items.length;
|
|
@@ -3711,7 +3732,7 @@ async function Tr({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3711
3732
|
return;
|
|
3712
3733
|
}
|
|
3713
3734
|
if (c.strategy === "backend") {
|
|
3714
|
-
await
|
|
3735
|
+
await Dr(c, s, {
|
|
3715
3736
|
cycleId: e,
|
|
3716
3737
|
feedKey: c.feedKey,
|
|
3717
3738
|
items: [...s.items],
|
|
@@ -3728,11 +3749,11 @@ async function Tr({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3728
3749
|
s.autofill.status = "exhausted";
|
|
3729
3750
|
return;
|
|
3730
3751
|
}
|
|
3731
|
-
let u = await
|
|
3752
|
+
let u = await yr({
|
|
3732
3753
|
existingItems: s.items,
|
|
3733
3754
|
initialCursor: s.next,
|
|
3734
3755
|
loadPage: a.loadPage,
|
|
3735
|
-
maximumRequests:
|
|
3756
|
+
maximumRequests: dr(c, !1),
|
|
3736
3757
|
onCollection: n,
|
|
3737
3758
|
onDelayChange: (e) => {
|
|
3738
3759
|
t() && Object.assign(s.autofill, e);
|
|
@@ -3755,13 +3776,13 @@ async function Tr({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3755
3776
|
}
|
|
3756
3777
|
//#endregion
|
|
3757
3778
|
//#region src/core/fill.ts
|
|
3758
|
-
function
|
|
3779
|
+
function Nr(e) {
|
|
3759
3780
|
return "items" in e ? { items: e.items } : "pages" in e ? { pages: e.pages } : { until: "end" };
|
|
3760
3781
|
}
|
|
3761
|
-
function
|
|
3782
|
+
function Pr(e) {
|
|
3762
3783
|
return `${typeof e}:${String(e)}`;
|
|
3763
3784
|
}
|
|
3764
|
-
function
|
|
3785
|
+
function Fr(e) {
|
|
3765
3786
|
if (!e || typeof e != "object") throw TypeError("Vibe fill target must be an object.");
|
|
3766
3787
|
if ("pages" in e) {
|
|
3767
3788
|
if (!Number.isInteger(e.pages) || e.pages <= 0) throw TypeError("Vibe fill pages must be a positive integer.");
|
|
@@ -3774,21 +3795,21 @@ function Or(e) {
|
|
|
3774
3795
|
if ("until" in e && e.until === "end") return { until: "end" };
|
|
3775
3796
|
throw TypeError("Vibe fill target must be { items }, { pages }, or { until: 'end' }.");
|
|
3776
3797
|
}
|
|
3777
|
-
function
|
|
3798
|
+
function Ir(e) {
|
|
3778
3799
|
if (!e) return;
|
|
3779
3800
|
if (e.strategy === "frontend") {
|
|
3780
|
-
|
|
3801
|
+
or(e, "frontend fill");
|
|
3781
3802
|
return;
|
|
3782
3803
|
}
|
|
3783
3804
|
if (!e.feedKey.trim()) throw TypeError("Vibe backend fill requires a feedKey.");
|
|
3784
3805
|
let t = e.initialSession;
|
|
3785
3806
|
if (t) {
|
|
3786
3807
|
if (t.feedKey !== e.feedKey) throw TypeError("Vibe backend fill initialSession feedKey must match fill feedKey.");
|
|
3787
|
-
|
|
3808
|
+
Fr(t.target);
|
|
3788
3809
|
}
|
|
3789
3810
|
}
|
|
3790
|
-
function
|
|
3791
|
-
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a =
|
|
3811
|
+
function Lr(e, t, n = !0) {
|
|
3812
|
+
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a = cr(i?.nextRequestAt);
|
|
3792
3813
|
return {
|
|
3793
3814
|
completedPages: i?.completedPages ?? 0,
|
|
3794
3815
|
cycleId: i?.cycleId ?? null,
|
|
@@ -3801,10 +3822,10 @@ function Ar(e, t, n = !0) {
|
|
|
3801
3822
|
sessionId: i?.sessionId ?? null,
|
|
3802
3823
|
status: i?.status ?? "idle",
|
|
3803
3824
|
strategy: e?.strategy ?? null,
|
|
3804
|
-
target: i ?
|
|
3825
|
+
target: i ? Nr(i.target) : null
|
|
3805
3826
|
};
|
|
3806
3827
|
}
|
|
3807
|
-
function
|
|
3828
|
+
function Rr(e) {
|
|
3808
3829
|
return [
|
|
3809
3830
|
"cancelling",
|
|
3810
3831
|
"filling",
|
|
@@ -3812,108 +3833,116 @@ function jr(e) {
|
|
|
3812
3833
|
"waiting"
|
|
3813
3834
|
].includes(e.status);
|
|
3814
3835
|
}
|
|
3815
|
-
async function
|
|
3816
|
-
let
|
|
3817
|
-
if ("items" in
|
|
3818
|
-
completedPages:
|
|
3819
|
-
items:
|
|
3820
|
-
lastCursor:
|
|
3821
|
-
next:
|
|
3822
|
-
pages:
|
|
3823
|
-
received:
|
|
3836
|
+
async function zr({ existingItems: e, getLoadedItemCount: t, initialCursor: n, loadPage: r, onCollection: i, onPage: a, onDelayChange: o, onProgress: s, options: c, shouldPause: l = () => !1, signal: u, target: d }) {
|
|
3837
|
+
let f = [], p = [], m = e.length, h = new Set(e.map(({ postId: e }) => e)), g = /* @__PURE__ */ new Set(), _ = 0, v = n, y = n, b = n, x = 0, S, C = () => t?.() ?? m + f.length;
|
|
3838
|
+
if ("items" in d && C() >= d.items) return {
|
|
3839
|
+
completedPages: _,
|
|
3840
|
+
items: f,
|
|
3841
|
+
lastCursor: y,
|
|
3842
|
+
next: b,
|
|
3843
|
+
pages: p,
|
|
3844
|
+
received: x,
|
|
3824
3845
|
status: "complete"
|
|
3825
3846
|
};
|
|
3826
|
-
for (;
|
|
3827
|
-
let e =
|
|
3828
|
-
if (
|
|
3829
|
-
if (
|
|
3830
|
-
delayMs:
|
|
3831
|
-
onChange:
|
|
3832
|
-
signal:
|
|
3833
|
-
}),
|
|
3834
|
-
completedPages:
|
|
3835
|
-
items:
|
|
3836
|
-
lastCursor:
|
|
3837
|
-
next:
|
|
3838
|
-
pages:
|
|
3839
|
-
received:
|
|
3847
|
+
for (; b !== null;) {
|
|
3848
|
+
let e = Pr(v);
|
|
3849
|
+
if (g.has(e)) throw Error("Vibe fill received a repeated cursor.");
|
|
3850
|
+
if (g.add(e), await lr({
|
|
3851
|
+
delayMs: sr(_, c),
|
|
3852
|
+
onChange: o,
|
|
3853
|
+
signal: u
|
|
3854
|
+
}), _ > 0 && l()) return {
|
|
3855
|
+
completedPages: _,
|
|
3856
|
+
items: f,
|
|
3857
|
+
lastCursor: y,
|
|
3858
|
+
next: b,
|
|
3859
|
+
pages: p,
|
|
3860
|
+
received: x,
|
|
3840
3861
|
status: "paused",
|
|
3841
|
-
total:
|
|
3862
|
+
total: S
|
|
3842
3863
|
};
|
|
3843
|
-
let t =
|
|
3844
|
-
cursor:
|
|
3845
|
-
signal:
|
|
3864
|
+
let t = qn(await r({
|
|
3865
|
+
cursor: v,
|
|
3866
|
+
signal: u
|
|
3846
3867
|
}));
|
|
3847
|
-
|
|
3848
|
-
let n =
|
|
3849
|
-
if (f.push({
|
|
3868
|
+
_ += 1, y = v;
|
|
3869
|
+
let n = Jn(h, t.items), m = {
|
|
3850
3870
|
contributionIds: n.map(({ postId: e }) => e),
|
|
3851
|
-
cursor:
|
|
3871
|
+
cursor: v,
|
|
3852
3872
|
next: t.next,
|
|
3853
3873
|
returnedIds: t.items.map(({ postId: e }) => e)
|
|
3854
|
-
}
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
received:
|
|
3865
|
-
total:
|
|
3866
|
-
}
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3874
|
+
};
|
|
3875
|
+
p.push(m), f.push(...n), x = f.length, b = t.next, t.total !== void 0 && (S = t.total), s({
|
|
3876
|
+
completedPages: _,
|
|
3877
|
+
next: b,
|
|
3878
|
+
received: x
|
|
3879
|
+
});
|
|
3880
|
+
let w = {
|
|
3881
|
+
completedPages: _,
|
|
3882
|
+
lastCursor: v,
|
|
3883
|
+
next: b,
|
|
3884
|
+
received: x,
|
|
3885
|
+
total: S
|
|
3886
|
+
};
|
|
3887
|
+
if (a?.({
|
|
3888
|
+
...w,
|
|
3889
|
+
items: n,
|
|
3890
|
+
pages: [m]
|
|
3891
|
+
}), i?.({
|
|
3892
|
+
...w,
|
|
3893
|
+
items: [...f],
|
|
3894
|
+
pages: [...p]
|
|
3895
|
+
}), "items" in d && C() >= d.items || "pages" in d && _ >= d.pages) return {
|
|
3896
|
+
completedPages: _,
|
|
3897
|
+
items: f,
|
|
3898
|
+
lastCursor: v,
|
|
3899
|
+
next: b,
|
|
3900
|
+
pages: p,
|
|
3901
|
+
received: x,
|
|
3873
3902
|
status: "complete",
|
|
3874
|
-
total:
|
|
3903
|
+
total: S
|
|
3875
3904
|
};
|
|
3876
|
-
if (
|
|
3877
|
-
completedPages:
|
|
3878
|
-
items:
|
|
3879
|
-
lastCursor:
|
|
3880
|
-
next:
|
|
3881
|
-
pages:
|
|
3882
|
-
received:
|
|
3883
|
-
status: "until" in
|
|
3884
|
-
total:
|
|
3905
|
+
if (b === null) return {
|
|
3906
|
+
completedPages: _,
|
|
3907
|
+
items: f,
|
|
3908
|
+
lastCursor: v,
|
|
3909
|
+
next: b,
|
|
3910
|
+
pages: p,
|
|
3911
|
+
received: x,
|
|
3912
|
+
status: "until" in d ? "complete" : "exhausted",
|
|
3913
|
+
total: S
|
|
3885
3914
|
};
|
|
3886
|
-
if (
|
|
3887
|
-
completedPages:
|
|
3888
|
-
items:
|
|
3889
|
-
lastCursor:
|
|
3890
|
-
next:
|
|
3891
|
-
pages:
|
|
3892
|
-
received:
|
|
3915
|
+
if (l()) return {
|
|
3916
|
+
completedPages: _,
|
|
3917
|
+
items: f,
|
|
3918
|
+
lastCursor: v,
|
|
3919
|
+
next: b,
|
|
3920
|
+
pages: p,
|
|
3921
|
+
received: x,
|
|
3893
3922
|
status: "paused",
|
|
3894
|
-
total:
|
|
3923
|
+
total: S
|
|
3895
3924
|
};
|
|
3896
|
-
|
|
3925
|
+
v = b;
|
|
3897
3926
|
}
|
|
3898
3927
|
return {
|
|
3899
|
-
completedPages:
|
|
3900
|
-
items:
|
|
3901
|
-
lastCursor:
|
|
3928
|
+
completedPages: _,
|
|
3929
|
+
items: f,
|
|
3930
|
+
lastCursor: v,
|
|
3902
3931
|
next: null,
|
|
3903
|
-
pages:
|
|
3904
|
-
received:
|
|
3905
|
-
status: "until" in
|
|
3906
|
-
total:
|
|
3932
|
+
pages: p,
|
|
3933
|
+
received: x,
|
|
3934
|
+
status: "until" in d ? "complete" : "exhausted",
|
|
3935
|
+
total: S
|
|
3907
3936
|
};
|
|
3908
3937
|
}
|
|
3909
3938
|
//#endregion
|
|
3910
3939
|
//#region src/core/backendFill.ts
|
|
3911
|
-
async function
|
|
3940
|
+
async function Br(e, t, n, r) {
|
|
3912
3941
|
let i = await e.onStart(n);
|
|
3913
3942
|
if (r()) {
|
|
3914
3943
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend fill requires a sessionId.");
|
|
3915
3944
|
Object.assign(t.fill, {
|
|
3916
|
-
...
|
|
3945
|
+
...cr(i.nextRequestAt),
|
|
3917
3946
|
completedPages: i.completedPages ?? 0,
|
|
3918
3947
|
received: i.received ?? 0,
|
|
3919
3948
|
sequence: i.sequence ?? 0,
|
|
@@ -3922,23 +3951,23 @@ async function Nr(e, t, n, r) {
|
|
|
3922
3951
|
});
|
|
3923
3952
|
}
|
|
3924
3953
|
}
|
|
3925
|
-
function
|
|
3954
|
+
function Vr(e, t, n) {
|
|
3926
3955
|
return e?.strategy === "backend" && n.feedKey === e.feedKey && n.sessionId === t.fill.sessionId;
|
|
3927
3956
|
}
|
|
3928
|
-
function
|
|
3957
|
+
function Hr(e) {
|
|
3929
3958
|
return Number.isInteger(e.completedPages) && e.completedPages >= 0 && Number.isInteger(e.received) && e.received >= 0 && Number.isInteger(e.sequence) && e.sequence >= 0;
|
|
3930
3959
|
}
|
|
3931
|
-
function
|
|
3960
|
+
function Ur(e, t) {
|
|
3932
3961
|
if (!["complete", "exhausted"].includes(t.status)) return !0;
|
|
3933
3962
|
let n = e.fill.target;
|
|
3934
3963
|
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;
|
|
3935
3964
|
}
|
|
3936
|
-
function
|
|
3965
|
+
function Wr(e, t, n) {
|
|
3937
3966
|
t.total !== void 0 && (e.total = t.total), ["complete", "exhausted"].includes(t.status) && (e.items = $(e.items, t.items ?? []), e.next = t.next ?? null, n(t.lastCursor ?? null));
|
|
3938
3967
|
}
|
|
3939
|
-
function
|
|
3940
|
-
return !
|
|
3941
|
-
...
|
|
3968
|
+
function Gr(e, t, n, r) {
|
|
3969
|
+
return !Vr(e, t, n) || !Hr(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !Ur(t, n) ? !1 : (Wr(t, n, r), Object.assign(t.fill, {
|
|
3970
|
+
...cr(n.status === "waiting" ? n.nextRequestAt : null),
|
|
3942
3971
|
completedPages: n.completedPages,
|
|
3943
3972
|
error: n.error ?? null,
|
|
3944
3973
|
received: n.received,
|
|
@@ -3946,45 +3975,45 @@ function Rr(e, t, n, r) {
|
|
|
3946
3975
|
status: n.status
|
|
3947
3976
|
}), !0);
|
|
3948
3977
|
}
|
|
3949
|
-
function
|
|
3978
|
+
function Kr(e, t, n, r) {
|
|
3950
3979
|
if (e?.strategy !== "backend" || n.feedKey !== e.feedKey) return !1;
|
|
3951
3980
|
let i = t.fill;
|
|
3952
|
-
return t.fill =
|
|
3981
|
+
return t.fill = Lr(e, n), !Hr(n) || !Ur(t, n) ? (t.fill = i, !1) : (Wr(t, n, r), !0);
|
|
3953
3982
|
}
|
|
3954
3983
|
//#endregion
|
|
3955
3984
|
//#region src/core/fillController.ts
|
|
3956
|
-
var
|
|
3985
|
+
var qr = class {
|
|
3957
3986
|
abortController = null;
|
|
3958
3987
|
cycle = 0;
|
|
3959
3988
|
delayCountdown;
|
|
3960
3989
|
requestVersion = 0;
|
|
3961
3990
|
collection = null;
|
|
3962
3991
|
constructor(e) {
|
|
3963
|
-
this.options = e, this.delayCountdown = new
|
|
3992
|
+
this.options = e, this.delayCountdown = new ur((e) => {
|
|
3964
3993
|
Object.assign(this.options.state.fill, e);
|
|
3965
3994
|
}), this.syncBackendCountdown();
|
|
3966
3995
|
}
|
|
3967
3996
|
isActive() {
|
|
3968
|
-
return
|
|
3997
|
+
return Rr(this.options.state.fill);
|
|
3969
3998
|
}
|
|
3970
3999
|
applyUpdate(e) {
|
|
3971
|
-
let t =
|
|
4000
|
+
let t = Gr(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
3972
4001
|
return t && this.syncBackendCountdown(), t;
|
|
3973
4002
|
}
|
|
3974
4003
|
restoreSession(e) {
|
|
3975
|
-
let t =
|
|
4004
|
+
let t = Kr(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
3976
4005
|
return t && this.syncBackendCountdown(), t;
|
|
3977
4006
|
}
|
|
3978
4007
|
async start(e, t = {}) {
|
|
3979
4008
|
let n = this.options.fill;
|
|
3980
4009
|
if (!n) throw Error("Vibe fill is not configured.");
|
|
3981
4010
|
if (this.isActive()) throw Error("Vibe fill is already active.");
|
|
3982
|
-
let r =
|
|
4011
|
+
let r = Fr(e), i = Fr(t.target ?? r), a = t.progressOffset ?? {
|
|
3983
4012
|
completedPages: 0,
|
|
3984
4013
|
received: 0
|
|
3985
4014
|
}, o = t.cycleId ?? `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
3986
4015
|
if (this.options.state.fill = {
|
|
3987
|
-
...
|
|
4016
|
+
...Lr(n, void 0, !1),
|
|
3988
4017
|
completedPages: a.completedPages,
|
|
3989
4018
|
cycleId: o,
|
|
3990
4019
|
received: a.received,
|
|
@@ -3997,7 +4026,7 @@ var Br = class {
|
|
|
3997
4026
|
let s = ++this.requestVersion, c = new AbortController();
|
|
3998
4027
|
this.abortController = c;
|
|
3999
4028
|
try {
|
|
4000
|
-
n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await
|
|
4029
|
+
n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await Br(n, this.options.state, {
|
|
4001
4030
|
cycleId: o,
|
|
4002
4031
|
feedKey: n.feedKey,
|
|
4003
4032
|
items: [...this.options.state.items],
|
|
@@ -4015,7 +4044,7 @@ var Br = class {
|
|
|
4015
4044
|
}
|
|
4016
4045
|
async cancel() {
|
|
4017
4046
|
let { fill: e, state: t } = this.options;
|
|
4018
|
-
if (!
|
|
4047
|
+
if (!Rr(t.fill) || !t.fill.cycleId) return;
|
|
4019
4048
|
let n = {
|
|
4020
4049
|
cycleId: t.fill.cycleId,
|
|
4021
4050
|
feedKey: t.fill.feedKey ?? "",
|
|
@@ -4059,7 +4088,7 @@ var Br = class {
|
|
|
4059
4088
|
});
|
|
4060
4089
|
}
|
|
4061
4090
|
reset() {
|
|
4062
|
-
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill =
|
|
4091
|
+
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = Lr(this.options.fill, void 0, !1), this.collection = null;
|
|
4063
4092
|
}
|
|
4064
4093
|
destroy() {
|
|
4065
4094
|
this.abortLocalRequest(), this.delayCountdown.clear();
|
|
@@ -4094,12 +4123,12 @@ var Br = class {
|
|
|
4094
4123
|
s.fill.status = "until" in t ? "complete" : "exhausted";
|
|
4095
4124
|
return;
|
|
4096
4125
|
}
|
|
4097
|
-
let c = await
|
|
4126
|
+
let c = await zr({
|
|
4098
4127
|
existingItems: s.items,
|
|
4099
4128
|
getLoadedItemCount: () => s.items.length,
|
|
4100
4129
|
initialCursor: s.next,
|
|
4101
4130
|
loadPage: o,
|
|
4102
|
-
|
|
4131
|
+
onPage: (e) => {
|
|
4103
4132
|
this.isCurrent(r) && (this.collection = {
|
|
4104
4133
|
...e,
|
|
4105
4134
|
completedPages: a.completedPages + e.completedPages,
|
|
@@ -4121,7 +4150,7 @@ var Br = class {
|
|
|
4121
4150
|
signal: n.signal,
|
|
4122
4151
|
target: t
|
|
4123
4152
|
});
|
|
4124
|
-
this.isCurrent(r) && (s.
|
|
4153
|
+
this.isCurrent(r) && (s.next = c.next, c.total !== void 0 && (s.total = c.total), this.options.onLastCursor(c.lastCursor), Object.assign(s.fill, {
|
|
4125
4154
|
completedPages: a.completedPages + c.completedPages,
|
|
4126
4155
|
received: a.received + c.received,
|
|
4127
4156
|
status: c.status
|
|
@@ -4131,7 +4160,7 @@ var Br = class {
|
|
|
4131
4160
|
let e = this.collection;
|
|
4132
4161
|
if (this.collection = null, !e || this.options.fill?.strategy !== "frontend") return;
|
|
4133
4162
|
let t = this.options.state;
|
|
4134
|
-
t.items =
|
|
4163
|
+
t.items = Yn(t.items, this.filterItems(e.items)), t.next = e.next, e.total !== void 0 && (t.total = e.total), this.options.onLastCursor(e.lastCursor), this.options.onPages(e.pages), Object.assign(t.fill, {
|
|
4135
4164
|
completedPages: e.completedPages,
|
|
4136
4165
|
received: e.received
|
|
4137
4166
|
});
|
|
@@ -4146,7 +4175,7 @@ var Br = class {
|
|
|
4146
4175
|
};
|
|
4147
4176
|
//#endregion
|
|
4148
4177
|
//#region src/core/fillReconciliation.ts
|
|
4149
|
-
async function
|
|
4178
|
+
async function Jr({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r, pauseWhenManual: i = !1, setLastCursor: a, signal: o, state: s }) {
|
|
4150
4179
|
if (!e.needsReconciliation(s.items)) return "skipped";
|
|
4151
4180
|
let c = await e.reconcile({
|
|
4152
4181
|
existingItems: s.items,
|
|
@@ -4159,7 +4188,7 @@ async function Vr({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r,
|
|
|
4159
4188
|
}
|
|
4160
4189
|
//#endregion
|
|
4161
4190
|
//#region src/core/feedFooter.ts
|
|
4162
|
-
function
|
|
4191
|
+
function Yr(e) {
|
|
4163
4192
|
return {
|
|
4164
4193
|
cancelAutofill: () => e.cancelAutofill(),
|
|
4165
4194
|
loadMore: () => e.loadNext(),
|
|
@@ -4171,46 +4200,46 @@ function Hr(e) {
|
|
|
4171
4200
|
retryFill: () => e.retryFill()
|
|
4172
4201
|
};
|
|
4173
4202
|
}
|
|
4174
|
-
function
|
|
4203
|
+
function Xr(e) {
|
|
4175
4204
|
if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
|
|
4176
4205
|
}
|
|
4177
|
-
function
|
|
4178
|
-
e?.intervalMs !== void 0 &&
|
|
4206
|
+
function Zr(e) {
|
|
4207
|
+
e?.intervalMs !== void 0 && Xr(e.intervalMs);
|
|
4179
4208
|
}
|
|
4180
|
-
function
|
|
4209
|
+
function Qr(e) {
|
|
4181
4210
|
return {
|
|
4182
4211
|
enabled: e?.enabled ?? !1,
|
|
4183
4212
|
includePostItems: e?.includePostItems ?? !1,
|
|
4184
4213
|
intervalMs: e?.intervalMs ?? 5e3
|
|
4185
4214
|
};
|
|
4186
4215
|
}
|
|
4187
|
-
function
|
|
4216
|
+
function $r(e, t) {
|
|
4188
4217
|
if (typeof t == "boolean") {
|
|
4189
4218
|
e.enabled = t;
|
|
4190
4219
|
return;
|
|
4191
4220
|
}
|
|
4192
|
-
|
|
4221
|
+
Zr(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);
|
|
4193
4222
|
}
|
|
4194
4223
|
//#endregion
|
|
4195
4224
|
//#region src/core/reelInfoSheet.ts
|
|
4196
|
-
function
|
|
4225
|
+
function ei(e) {
|
|
4197
4226
|
return { enabled: e?.enabled ?? !1 };
|
|
4198
4227
|
}
|
|
4199
|
-
function
|
|
4228
|
+
function ti(e, t, n) {
|
|
4200
4229
|
if (n && !t) throw Error("Vibe cannot enable reelInfoSheet without a configured component.");
|
|
4201
4230
|
e.enabled = n;
|
|
4202
4231
|
}
|
|
4203
4232
|
//#endregion
|
|
4204
4233
|
//#region src/core/initialRuntimeState.ts
|
|
4205
|
-
function
|
|
4234
|
+
function ni(e, t) {
|
|
4206
4235
|
let n = e.initialPage;
|
|
4207
4236
|
return {
|
|
4208
4237
|
activeReelPostId: null,
|
|
4209
|
-
autoScroll:
|
|
4210
|
-
autofill:
|
|
4238
|
+
autoScroll: Tr(e.autoScroll),
|
|
4239
|
+
autofill: hr(e.autofill),
|
|
4211
4240
|
current: n?.current ?? null,
|
|
4212
4241
|
error: null,
|
|
4213
|
-
fill:
|
|
4242
|
+
fill: Lr(e.fill),
|
|
4214
4243
|
infiniteScroll: e.infiniteScroll ?? !0,
|
|
4215
4244
|
isLoading: !n,
|
|
4216
4245
|
isLoadingMore: !1,
|
|
@@ -4221,14 +4250,14 @@ function Yr(e, t) {
|
|
|
4221
4250
|
next: n?.next ?? null,
|
|
4222
4251
|
nextPageError: null,
|
|
4223
4252
|
phoneMode: !1,
|
|
4224
|
-
reelAutoAdvance:
|
|
4253
|
+
reelAutoAdvance: Qr(e.reelAutoAdvance),
|
|
4225
4254
|
reelForward: {
|
|
4226
4255
|
error: null,
|
|
4227
4256
|
status: "idle"
|
|
4228
4257
|
},
|
|
4229
4258
|
reelForwardIndex: null,
|
|
4230
4259
|
reelForwardItem: null,
|
|
4231
|
-
reelInfoSheet:
|
|
4260
|
+
reelInfoSheet: ei(e.reelInfoSheet),
|
|
4232
4261
|
reelInfoSheetOverlay: !1,
|
|
4233
4262
|
reelMediaSource: "original",
|
|
4234
4263
|
reelOrigin: null,
|
|
@@ -4237,21 +4266,21 @@ function Yr(e, t) {
|
|
|
4237
4266
|
}
|
|
4238
4267
|
//#endregion
|
|
4239
4268
|
//#region src/core/options.ts
|
|
4240
|
-
function
|
|
4269
|
+
function ri(e, t) {
|
|
4241
4270
|
if (t) {
|
|
4242
4271
|
if (!Number.isFinite(t.height) || t.height <= 0) throw TypeError(`Vibe ${e} height must be a positive number.`);
|
|
4243
4272
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe ${e} background must be "default" or "transparent".`);
|
|
4244
4273
|
}
|
|
4245
4274
|
}
|
|
4246
|
-
function
|
|
4275
|
+
function ii(e, t) {
|
|
4247
4276
|
if (t) {
|
|
4248
4277
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe mediaCard ${e} background must be "default" or "transparent".`);
|
|
4249
4278
|
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.`);
|
|
4250
4279
|
}
|
|
4251
4280
|
}
|
|
4252
|
-
function
|
|
4253
|
-
if (
|
|
4254
|
-
if (
|
|
4281
|
+
function ai(e) {
|
|
4282
|
+
if (wr(e.autoScroll), ri("cardHeader", e.cardHeader), ri("cardFooter", e.cardFooter), ii("header", e.mediaCard?.header), ii("footer", e.mediaCard?.footer), e.mediaCard?.feedPreload !== void 0 && e.mediaCard.feedPreload !== "none" && e.mediaCard.feedPreload !== "visible-post") throw TypeError("Vibe mediaCard feedPreload must be \"none\" or \"visible-post\".");
|
|
4283
|
+
if (mr(e.autofill), Ir(e.fill), je(e.masonry), Zr(e.reelAutoAdvance), e.removalReconciliation) {
|
|
4255
4284
|
if (!Number.isInteger(e.removalReconciliation.pageSize) || e.removalReconciliation.pageSize <= 0) throw TypeError("Vibe removalReconciliation pageSize must be a positive integer.");
|
|
4256
4285
|
let t = e.removalReconciliation.maxReplayPages ?? 5;
|
|
4257
4286
|
if (!Number.isInteger(t) || t <= 0) throw TypeError("Vibe removalReconciliation maxReplayPages must be a positive integer.");
|
|
@@ -4266,7 +4295,7 @@ function Qr(e) {
|
|
|
4266
4295
|
if (e.fill?.strategy === "frontend" && !e.loadPage) throw TypeError("Vibe frontend fill requires loadPage.");
|
|
4267
4296
|
if (e.fill?.strategy === "backend" && e.fill.initialSession && !e.initialPage) throw TypeError("Vibe backend fill restoration requires initialPage.");
|
|
4268
4297
|
}
|
|
4269
|
-
function
|
|
4298
|
+
function oi(e) {
|
|
4270
4299
|
if (typeof e != "string") return e;
|
|
4271
4300
|
if (typeof document > "u") throw Error("Vibe cannot resolve a selector without a document.");
|
|
4272
4301
|
let t = document.querySelector(e);
|
|
@@ -4275,7 +4304,7 @@ function $r(e) {
|
|
|
4275
4304
|
}
|
|
4276
4305
|
//#endregion
|
|
4277
4306
|
//#region src/core/pageRequest.ts
|
|
4278
|
-
async function
|
|
4307
|
+
async function si({ append: e, autofillController: t, cursor: n, isCurrent: r, loadPage: i, onLastCursor: a, onPages: o, options: s, signal: c, state: l }) {
|
|
4279
4308
|
let u = s.autofill, d = e && u?.strategy === "frontend" && (l.autofill.status === "paused" || l.autofill.status === "error"), f = d ? {
|
|
4280
4309
|
received: l.autofill.received,
|
|
4281
4310
|
requests: l.autofill.requests
|
|
@@ -4287,11 +4316,11 @@ async function ei({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
4287
4316
|
let m = !1;
|
|
4288
4317
|
try {
|
|
4289
4318
|
if (u?.strategy === "frontend") {
|
|
4290
|
-
let s = await
|
|
4319
|
+
let s = await yr({
|
|
4291
4320
|
existingItems: e ? l.items : [],
|
|
4292
4321
|
initialCursor: n,
|
|
4293
4322
|
loadPage: i,
|
|
4294
|
-
maximumRequests: f ? Math.max(0,
|
|
4323
|
+
maximumRequests: f ? Math.max(0, dr(u) - f.requests) : void 0,
|
|
4295
4324
|
onCollection: (e) => t.captureCollection(e, r()),
|
|
4296
4325
|
onDelayChange: (e) => {
|
|
4297
4326
|
r() && Object.assign(l.autofill, e);
|
|
@@ -4314,7 +4343,7 @@ async function ei({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
4314
4343
|
}), o(s.pages), t.clearCollection();
|
|
4315
4344
|
return;
|
|
4316
4345
|
}
|
|
4317
|
-
let s =
|
|
4346
|
+
let s = qn(await i({
|
|
4318
4347
|
cursor: n,
|
|
4319
4348
|
signal: c
|
|
4320
4349
|
}));
|
|
@@ -4334,7 +4363,7 @@ async function ei({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
4334
4363
|
l.autofill.status = "complete";
|
|
4335
4364
|
return;
|
|
4336
4365
|
}
|
|
4337
|
-
await
|
|
4366
|
+
await Dr(u, l, {
|
|
4338
4367
|
cycleId: p,
|
|
4339
4368
|
feedKey: u.feedKey,
|
|
4340
4369
|
items: h.slice(d.length),
|
|
@@ -4356,7 +4385,7 @@ async function ei({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
4356
4385
|
}
|
|
4357
4386
|
//#endregion
|
|
4358
4387
|
//#region src/core/pageReplacement.ts
|
|
4359
|
-
var
|
|
4388
|
+
var ci = class {
|
|
4360
4389
|
controller = null;
|
|
4361
4390
|
constructor(e) {
|
|
4362
4391
|
this.options = e;
|
|
@@ -4368,7 +4397,7 @@ var ti = class {
|
|
|
4368
4397
|
this.controller?.abort(), this.controller = null, this.options.surface()?.cancelItemRemoval();
|
|
4369
4398
|
}
|
|
4370
4399
|
async replace(e, t) {
|
|
4371
|
-
let n =
|
|
4400
|
+
let n = qn(e);
|
|
4372
4401
|
this.cancel();
|
|
4373
4402
|
let r = new AbortController();
|
|
4374
4403
|
this.controller = r;
|
|
@@ -4388,7 +4417,7 @@ var ti = class {
|
|
|
4388
4417
|
let e = this.options.surface()?.getAutoScrollElement();
|
|
4389
4418
|
e && (e.scrollTop = 0);
|
|
4390
4419
|
}
|
|
4391
|
-
e.mediaIndices = new Map(a.map((t) => [t.postId,
|
|
4420
|
+
e.mediaIndices = new Map(a.map((t) => [t.postId, G(t, e.mediaIndices.get(t.postId) ?? 0)])), e.activeReelPostId !== null && !o.has(String(e.activeReelPostId)) && (e.activeReelPostId = null, e.reelOrigin = null), e.items = a, e.next = n.next, e.total = n.total ?? null, e.error = null, e.nextPageError = null, this.options.commit({
|
|
4392
4421
|
...n,
|
|
4393
4422
|
items: a
|
|
4394
4423
|
});
|
|
@@ -4399,7 +4428,7 @@ var ti = class {
|
|
|
4399
4428
|
};
|
|
4400
4429
|
//#endregion
|
|
4401
4430
|
//#region src/core/loadingLock.ts
|
|
4402
|
-
function
|
|
4431
|
+
function li(e, t, n) {
|
|
4403
4432
|
if (e.loadMoreLocked !== t && (e.loadMoreLocked = t, !t)) {
|
|
4404
4433
|
if (e.fill.status === "paused" && e.fill.target) {
|
|
4405
4434
|
n.resumeFill();
|
|
@@ -4410,21 +4439,21 @@ function ni(e, t, n) {
|
|
|
4410
4439
|
e ? e.finally(() => {
|
|
4411
4440
|
n.loadNext();
|
|
4412
4441
|
}) : n.loadNext();
|
|
4413
|
-
} else e.infiniteScroll &&
|
|
4442
|
+
} else e.infiniteScroll && h(n.loadIfNearBottom);
|
|
4414
4443
|
}
|
|
4415
4444
|
}
|
|
4416
4445
|
//#endregion
|
|
4417
4446
|
//#region src/core/removalReconciliationController.ts
|
|
4418
|
-
function
|
|
4447
|
+
function ui(e) {
|
|
4419
4448
|
return `${typeof e}:${String(e)}`;
|
|
4420
4449
|
}
|
|
4421
|
-
function
|
|
4450
|
+
function di(e) {
|
|
4422
4451
|
return `${typeof e}:${String(e)}`;
|
|
4423
4452
|
}
|
|
4424
|
-
function
|
|
4453
|
+
function fi(e) {
|
|
4425
4454
|
return e.map(({ postId: e }) => e);
|
|
4426
4455
|
}
|
|
4427
|
-
var
|
|
4456
|
+
var pi = class {
|
|
4428
4457
|
delay;
|
|
4429
4458
|
enabled;
|
|
4430
4459
|
maxReplayPages;
|
|
@@ -4443,7 +4472,7 @@ var oi = class {
|
|
|
4443
4472
|
e.status === "complete" && (this.pages = [...this.pages.slice(0, e.replaceFrom), ...e.pages].slice(-this.maxReplayPages), this.pending = null);
|
|
4444
4473
|
}
|
|
4445
4474
|
filterItems(e) {
|
|
4446
|
-
return this.tombstones.size === 0 ? [...e] : e.filter(({ postId: e }) => !this.tombstones.has(
|
|
4475
|
+
return this.tombstones.size === 0 ? [...e] : e.filter(({ postId: e }) => !this.tombstones.has(ui(e)));
|
|
4447
4476
|
}
|
|
4448
4477
|
needsReconciliation(e) {
|
|
4449
4478
|
return this.pending !== null || this.findUnderfilledPage(e) >= 0;
|
|
@@ -4456,45 +4485,45 @@ var oi = class {
|
|
|
4456
4485
|
}
|
|
4457
4486
|
recordInitialPage(e) {
|
|
4458
4487
|
e && this.recordPages([{
|
|
4459
|
-
contributionIds:
|
|
4460
|
-
cursor:
|
|
4488
|
+
contributionIds: fi(e.items),
|
|
4489
|
+
cursor: $n(e),
|
|
4461
4490
|
next: e.next,
|
|
4462
|
-
returnedIds:
|
|
4491
|
+
returnedIds: fi(e.items)
|
|
4463
4492
|
}]);
|
|
4464
4493
|
}
|
|
4465
4494
|
remove(e) {
|
|
4466
|
-
e.forEach((e) => this.tombstones.add(
|
|
4495
|
+
e.forEach((e) => this.tombstones.add(ui(e)));
|
|
4467
4496
|
}
|
|
4468
4497
|
reset() {
|
|
4469
4498
|
this.pages = [], this.pending = null, this.tombstones.clear();
|
|
4470
4499
|
}
|
|
4471
4500
|
restore(e) {
|
|
4472
|
-
e.forEach((e) => this.tombstones.delete(
|
|
4501
|
+
e.forEach((e) => this.tombstones.delete(ui(e)));
|
|
4473
4502
|
}
|
|
4474
4503
|
async reconcile({ existingItems: e, loadPage: t, onDelayChange: n = () => void 0, shouldPause: r = () => !1, signal: i }) {
|
|
4475
4504
|
let a = this.pending ?? this.createSession(e);
|
|
4476
4505
|
for (this.pending = a; a.remainingRequests > 0;) {
|
|
4477
|
-
let e =
|
|
4506
|
+
let e = di(a.cursor);
|
|
4478
4507
|
if (a.seenCursors.has(e)) throw Error("Vibe removal reconciliation received a repeated cursor.");
|
|
4479
|
-
if (await
|
|
4480
|
-
delayMs:
|
|
4508
|
+
if (await lr({
|
|
4509
|
+
delayMs: sr(a.pages.length, this.delay),
|
|
4481
4510
|
onChange: n,
|
|
4482
4511
|
signal: i
|
|
4483
4512
|
}), a.pages.length > 0 && r()) return this.result(a, "paused");
|
|
4484
|
-
let o =
|
|
4513
|
+
let o = qn(await t({
|
|
4485
4514
|
cursor: a.cursor,
|
|
4486
4515
|
signal: i
|
|
4487
4516
|
}));
|
|
4488
4517
|
a.seenCursors.add(e);
|
|
4489
4518
|
let s = this.filterItems(o.items), c = [];
|
|
4490
4519
|
if (s.forEach((e) => {
|
|
4491
|
-
let t =
|
|
4520
|
+
let t = ui(e.postId);
|
|
4492
4521
|
a.attributed.has(t) || (a.attributed.add(t), c.push(e.postId)), a.appended.has(t) || (a.appended.add(t), a.items.push(e));
|
|
4493
4522
|
}), a.pages.push({
|
|
4494
4523
|
contributionIds: c,
|
|
4495
4524
|
cursor: a.cursor,
|
|
4496
4525
|
next: o.next,
|
|
4497
|
-
returnedIds:
|
|
4526
|
+
returnedIds: fi(s)
|
|
4498
4527
|
}), 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");
|
|
4499
4528
|
}
|
|
4500
4529
|
return this.result(a, "complete");
|
|
@@ -4502,9 +4531,9 @@ var oi = class {
|
|
|
4502
4531
|
createSession(e) {
|
|
4503
4532
|
let t = this.findUnderfilledPage(e), n = t < 0 ? [] : this.pages.slice(t), r = n[0];
|
|
4504
4533
|
if (!r) throw Error("Vibe has no underfilled provider page to reconcile.");
|
|
4505
|
-
let i = new Set(n.flatMap(({ contributionIds: e }) => e.map(
|
|
4534
|
+
let i = new Set(n.flatMap(({ contributionIds: e }) => e.map(ui))), a = new Set(e.map(({ postId: e }) => ui(e)).filter((e) => !i.has(e)));
|
|
4506
4535
|
return {
|
|
4507
|
-
appended: new Set(e.map(({ postId: e }) =>
|
|
4536
|
+
appended: new Set(e.map(({ postId: e }) => ui(e))),
|
|
4508
4537
|
attributed: new Set(a),
|
|
4509
4538
|
cursor: r.cursor,
|
|
4510
4539
|
items: [],
|
|
@@ -4529,11 +4558,11 @@ var oi = class {
|
|
|
4529
4558
|
}
|
|
4530
4559
|
findUnderfilledPage(e) {
|
|
4531
4560
|
if (!this.enabled || this.pages.length === 0) return -1;
|
|
4532
|
-
let t = new Set(e.map(({ postId: e }) =>
|
|
4533
|
-
return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has(
|
|
4561
|
+
let t = new Set(e.map(({ postId: e }) => ui(e)));
|
|
4562
|
+
return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has(ui(e))).length < this.pageSize);
|
|
4534
4563
|
}
|
|
4535
4564
|
recordPage(e) {
|
|
4536
|
-
let t =
|
|
4565
|
+
let t = di(e.cursor), n = this.pages.findIndex(({ cursor: e }) => di(e) === t);
|
|
4537
4566
|
n >= 0 && (this.pages = this.pages.slice(0, n)), this.pages.push({
|
|
4538
4567
|
...e,
|
|
4539
4568
|
contributionIds: [...e.contributionIds],
|
|
@@ -4543,7 +4572,7 @@ var oi = class {
|
|
|
4543
4572
|
};
|
|
4544
4573
|
//#endregion
|
|
4545
4574
|
//#region src/core/activeItemRemoval.ts
|
|
4546
|
-
function
|
|
4575
|
+
function mi(e, t, n, r, i) {
|
|
4547
4576
|
let a = new Set(t.map(({ item: e }) => e.postId));
|
|
4548
4577
|
if (e.activeReelPostId === null || !a.has(e.activeReelPostId)) return;
|
|
4549
4578
|
let o = e.items[Math.max(n, 0)];
|
|
@@ -4556,7 +4585,7 @@ function si(e, t, n, r, i) {
|
|
|
4556
4585
|
}
|
|
4557
4586
|
//#endregion
|
|
4558
4587
|
//#region src/core/exactMediaRemovalController.ts
|
|
4559
|
-
function
|
|
4588
|
+
function hi(e, t) {
|
|
4560
4589
|
let [n, ...r] = t;
|
|
4561
4590
|
if (!n) throw Error("Vibe items must contain at least one media asset.");
|
|
4562
4591
|
return {
|
|
@@ -4565,10 +4594,10 @@ function ci(e, t) {
|
|
|
4565
4594
|
items: r
|
|
4566
4595
|
};
|
|
4567
4596
|
}
|
|
4568
|
-
function
|
|
4597
|
+
function gi(e) {
|
|
4569
4598
|
if (!Number.isInteger(e.mediaIndex) || e.mediaIndex < 0) throw TypeError("Vibe mediaIndex must be a non-negative integer.");
|
|
4570
4599
|
}
|
|
4571
|
-
var
|
|
4600
|
+
var _i = class {
|
|
4572
4601
|
generation = 0;
|
|
4573
4602
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
4574
4603
|
state;
|
|
@@ -4576,10 +4605,10 @@ var ui = class {
|
|
|
4576
4605
|
this.options = e, this.state = e.state;
|
|
4577
4606
|
}
|
|
4578
4607
|
remove(e) {
|
|
4579
|
-
|
|
4608
|
+
gi(e);
|
|
4580
4609
|
let t = this.state.items.findIndex(({ postId: t }) => t === e.postId), n = this.state.items[t];
|
|
4581
4610
|
if (!n) return null;
|
|
4582
|
-
let r = [...
|
|
4611
|
+
let r = [...W(n)], i = r[e.mediaIndex];
|
|
4583
4612
|
if (!i) return null;
|
|
4584
4613
|
let a = Object.freeze({
|
|
4585
4614
|
media: i,
|
|
@@ -4593,7 +4622,7 @@ var ui = class {
|
|
|
4593
4622
|
restored: !1
|
|
4594
4623
|
});
|
|
4595
4624
|
let o = this.state.mediaIndices.get(n.postId) ?? 0, s = this.isReelOpen() && this.state.activeReelPostId === n.postId, c = s && o === e.mediaIndex;
|
|
4596
|
-
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] =
|
|
4625
|
+
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = hi(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);
|
|
4597
4626
|
}
|
|
4598
4627
|
reset() {
|
|
4599
4628
|
this.generation += 1;
|
|
@@ -4618,32 +4647,32 @@ var ui = class {
|
|
|
4618
4647
|
return this.state.layout === "reel" || this.state.reelOrigin === "masonry";
|
|
4619
4648
|
}
|
|
4620
4649
|
restoreIntoPost(e, t) {
|
|
4621
|
-
let n = this.state.items[e], r = [...
|
|
4622
|
-
if (r.splice(i, 0, t.media), this.state.items[e] =
|
|
4650
|
+
let n = this.state.items[e], r = [...W(n)], i = Math.min(t.mediaIndex, r.length);
|
|
4651
|
+
if (r.splice(i, 0, t.media), this.state.items[e] = hi(n, r), this.state.activeReelPostId !== t.postId) return;
|
|
4623
4652
|
let a = this.state.mediaIndices.get(t.postId) ?? 0;
|
|
4624
4653
|
a >= i && this.state.mediaIndices.set(t.postId, a + 1);
|
|
4625
4654
|
}
|
|
4626
4655
|
updateMediaIndexAfterRemoval(e, t, n) {
|
|
4627
4656
|
let r = this.state.items.find((t) => t.postId === e);
|
|
4628
4657
|
if (!r) return;
|
|
4629
|
-
let i =
|
|
4658
|
+
let i = W(r).length, a = this.state.mediaIndices.get(e) ?? 0, o = a;
|
|
4630
4659
|
n ? o = t < i ? t : 0 : t < a && (o = a - 1), this.state.mediaIndices.set(e, Math.min(o, i - 1));
|
|
4631
4660
|
}
|
|
4632
4661
|
};
|
|
4633
4662
|
//#endregion
|
|
4634
4663
|
//#region src/core/itemPlacement.ts
|
|
4635
|
-
function
|
|
4664
|
+
function vi(e, t) {
|
|
4636
4665
|
let n = new Set(t);
|
|
4637
4666
|
return e.flatMap((e, t) => n.has(e.postId) ? [{
|
|
4638
4667
|
index: t,
|
|
4639
4668
|
item: e
|
|
4640
4669
|
}] : []);
|
|
4641
4670
|
}
|
|
4642
|
-
function
|
|
4671
|
+
function yi(e, t) {
|
|
4643
4672
|
let n = new Set(t.map(({ item: e }) => e.postId));
|
|
4644
4673
|
return e.filter((e) => !n.has(e.postId));
|
|
4645
4674
|
}
|
|
4646
|
-
function
|
|
4675
|
+
function bi(e, t) {
|
|
4647
4676
|
t.forEach(({ index: e }) => {
|
|
4648
4677
|
if (!Number.isInteger(e) || e < 0) throw Error("Vibe item restore indexes must be non-negative integers.");
|
|
4649
4678
|
});
|
|
@@ -4654,7 +4683,7 @@ function pi(e, t) {
|
|
|
4654
4683
|
}
|
|
4655
4684
|
//#endregion
|
|
4656
4685
|
//#region src/core/itemRemovalController.ts
|
|
4657
|
-
var
|
|
4686
|
+
var xi = 20, Si = class {
|
|
4658
4687
|
generation = 0;
|
|
4659
4688
|
historyLimit;
|
|
4660
4689
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
@@ -4663,7 +4692,7 @@ var mi = 20, hi = class {
|
|
|
4663
4692
|
itemOrder;
|
|
4664
4693
|
stopItemsWatcher;
|
|
4665
4694
|
constructor(e) {
|
|
4666
|
-
this.options = e, this.historyLimit = e.historyLimit ??
|
|
4695
|
+
this.options = e, this.historyLimit = e.historyLimit ?? xi, this.state = e.state, this.itemOrder = this.state.items.map(({ postId: e }) => e), this.stopItemsWatcher = A(() => this.state.items, (e) => this.appendUnknownItems(e), { flush: "sync" });
|
|
4667
4696
|
}
|
|
4668
4697
|
destroy() {
|
|
4669
4698
|
this.reset(), this.stopItemsWatcher();
|
|
@@ -4677,7 +4706,7 @@ var mi = 20, hi = class {
|
|
|
4677
4706
|
let a = this.options.startRemoval(i, t);
|
|
4678
4707
|
if (a > 0 && await new Promise((e) => setTimeout(e, a)), this.metadata.get(r)?.generation !== this.generation) return r;
|
|
4679
4708
|
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);
|
|
4680
|
-
return this.state.items =
|
|
4709
|
+
return this.state.items = yi(this.state.items, n), this.options.onItemsRemoved(r, n, l), this.record(r), r;
|
|
4681
4710
|
}
|
|
4682
4711
|
reset() {
|
|
4683
4712
|
this.generation += 1, this.history = [], this.itemOrder = [];
|
|
@@ -4688,7 +4717,7 @@ var mi = 20, hi = class {
|
|
|
4688
4717
|
this.restoreRemoval(t);
|
|
4689
4718
|
return;
|
|
4690
4719
|
}
|
|
4691
|
-
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 =
|
|
4720
|
+
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 = bi(this.state.items, r);
|
|
4692
4721
|
this.registerExternalPlacements(r), this.state.items = i, r.length > 0 && this.options.onRemovalRestored(r);
|
|
4693
4722
|
}
|
|
4694
4723
|
restoreRemoval(e) {
|
|
@@ -4714,7 +4743,7 @@ var mi = 20, hi = class {
|
|
|
4714
4743
|
}
|
|
4715
4744
|
collectOrderedPlacements(e) {
|
|
4716
4745
|
let t = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
4717
|
-
return
|
|
4746
|
+
return vi(this.state.items, e).map((e) => ({
|
|
4718
4747
|
index: t.get(e.item.postId) ?? e.index,
|
|
4719
4748
|
item: e.item
|
|
4720
4749
|
}));
|
|
@@ -4745,7 +4774,7 @@ var mi = 20, hi = class {
|
|
|
4745
4774
|
let r = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
4746
4775
|
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;
|
|
4747
4776
|
}
|
|
4748
|
-
},
|
|
4777
|
+
}, Ci = class {
|
|
4749
4778
|
forward = null;
|
|
4750
4779
|
forwardPromise = null;
|
|
4751
4780
|
forwardVersion = 0;
|
|
@@ -4841,7 +4870,7 @@ var mi = 20, hi = class {
|
|
|
4841
4870
|
}
|
|
4842
4871
|
}
|
|
4843
4872
|
}
|
|
4844
|
-
},
|
|
4873
|
+
}, wi = class {
|
|
4845
4874
|
generation = 0;
|
|
4846
4875
|
pending = Promise.resolve();
|
|
4847
4876
|
constructor(e) {
|
|
@@ -4858,7 +4887,7 @@ var mi = 20, hi = class {
|
|
|
4858
4887
|
if (!n) return;
|
|
4859
4888
|
let r = t.mediaIndices.get(e.postId) ?? 0;
|
|
4860
4889
|
if (e.mediaIndex === r) {
|
|
4861
|
-
if (
|
|
4890
|
+
if (W(n).length > 1) {
|
|
4862
4891
|
await this.options.transitionMedia(1);
|
|
4863
4892
|
return;
|
|
4864
4893
|
}
|
|
@@ -4891,24 +4920,24 @@ var mi = 20, hi = class {
|
|
|
4891
4920
|
};
|
|
4892
4921
|
//#endregion
|
|
4893
4922
|
//#region src/core/removalControllers.ts
|
|
4894
|
-
function
|
|
4895
|
-
let t = new
|
|
4923
|
+
function Ti(e) {
|
|
4924
|
+
let t = new Ci(e), n = new wi({
|
|
4896
4925
|
state: e.state,
|
|
4897
4926
|
transitionMedia: (t) => e.surface()?.transitionActiveReelMedia(t) ?? Promise.resolve(!1),
|
|
4898
4927
|
transitionPost: (t) => e.surface()?.transitionActiveReelPost(t) ?? Promise.resolve(!1)
|
|
4899
4928
|
});
|
|
4900
4929
|
return {
|
|
4901
|
-
exactMediaRemoval: new
|
|
4930
|
+
exactMediaRemoval: new _i({
|
|
4902
4931
|
onActivate: e.onActivate,
|
|
4903
4932
|
onPostRemoved: (t) => e.onItemsRemoved([t]),
|
|
4904
4933
|
onPostRestored: (t) => e.onItemsRestored([t]),
|
|
4905
4934
|
reelForward: t,
|
|
4906
4935
|
state: e.state
|
|
4907
4936
|
}),
|
|
4908
|
-
itemRemoval: new
|
|
4937
|
+
itemRemoval: new Si({
|
|
4909
4938
|
historyLimit: e.historyLimit,
|
|
4910
4939
|
onItemsRemoved: (n, r, i) => {
|
|
4911
|
-
e.onItemsRemoved(r.map(({ item: e }) => e.postId)),
|
|
4940
|
+
e.onItemsRemoved(r.map(({ item: e }) => e.postId)), mi(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
|
|
4912
4941
|
},
|
|
4913
4942
|
onRemovalRestored: (n) => {
|
|
4914
4943
|
e.onItemsRestored(n.map(({ item: e }) => e.postId));
|
|
@@ -4923,17 +4952,17 @@ function vi(e) {
|
|
|
4923
4952
|
reelRemoval: n
|
|
4924
4953
|
};
|
|
4925
4954
|
}
|
|
4926
|
-
var
|
|
4927
|
-
function
|
|
4955
|
+
var Ei = 1.5;
|
|
4956
|
+
function Di(e) {
|
|
4928
4957
|
let t = Math.min(e.screenWidth, e.screenHeight);
|
|
4929
4958
|
if (t > 0 && t < 600) return !0;
|
|
4930
|
-
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n *
|
|
4959
|
+
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * Ei;
|
|
4931
4960
|
return !e.hasHover && n > 0 && n < 600 && r;
|
|
4932
4961
|
}
|
|
4933
|
-
function
|
|
4934
|
-
return
|
|
4962
|
+
function Oi(e) {
|
|
4963
|
+
return Di(e) ? "reel" : "masonry";
|
|
4935
4964
|
}
|
|
4936
|
-
function
|
|
4965
|
+
function ki(e) {
|
|
4937
4966
|
let t = e.ownerDocument.defaultView, n = e.ownerDocument.documentElement;
|
|
4938
4967
|
return {
|
|
4939
4968
|
hasHover: typeof t?.matchMedia == "function" && t.matchMedia("(hover: hover)").matches,
|
|
@@ -4943,15 +4972,15 @@ function Si(e) {
|
|
|
4943
4972
|
viewportWidth: n.clientWidth
|
|
4944
4973
|
};
|
|
4945
4974
|
}
|
|
4946
|
-
function
|
|
4947
|
-
return
|
|
4975
|
+
function Ai(e) {
|
|
4976
|
+
return Di(ki(e));
|
|
4948
4977
|
}
|
|
4949
|
-
function
|
|
4950
|
-
return
|
|
4978
|
+
function ji(e) {
|
|
4979
|
+
return Oi(ki(e));
|
|
4951
4980
|
}
|
|
4952
4981
|
//#endregion
|
|
4953
4982
|
//#region src/core/responsiveLayoutController.ts
|
|
4954
|
-
var
|
|
4983
|
+
var Mi = class {
|
|
4955
4984
|
layoutMode;
|
|
4956
4985
|
resizeObserver = null;
|
|
4957
4986
|
target = null;
|
|
@@ -4976,13 +5005,13 @@ var Ti = class {
|
|
|
4976
5005
|
}
|
|
4977
5006
|
handleResponsiveLayout = () => {
|
|
4978
5007
|
if (!this.target) return;
|
|
4979
|
-
let e =
|
|
4980
|
-
this.state.phoneMode =
|
|
5008
|
+
let e = ji(this.target);
|
|
5009
|
+
this.state.phoneMode = Ai(this.target), this.state.reelInfoSheetOverlay = this.state.phoneMode, this.state.reelMediaSource = this.state.phoneMode ? "mobile" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
|
|
4981
5010
|
};
|
|
4982
|
-
},
|
|
5011
|
+
}, Ni = class {
|
|
4983
5012
|
state;
|
|
4984
5013
|
constructor(e) {
|
|
4985
|
-
this.options = e, this.state =
|
|
5014
|
+
this.options = e, this.state = S(Vt({
|
|
4986
5015
|
...e.initialReelAudioState,
|
|
4987
5016
|
muted: e.initialReelAudioState?.muted ?? e.mediaCard?.videoMuted ?? !1
|
|
4988
5017
|
}));
|
|
@@ -4991,9 +5020,9 @@ var Ti = class {
|
|
|
4991
5020
|
return { ...this.state };
|
|
4992
5021
|
}
|
|
4993
5022
|
set(e, t = !1) {
|
|
4994
|
-
Object.assign(this.state,
|
|
5023
|
+
Object.assign(this.state, Vt(e, this.state)), t && this.options.onReelAudioStateChange?.(this.get());
|
|
4995
5024
|
}
|
|
4996
|
-
},
|
|
5025
|
+
}, Pi = class {
|
|
4997
5026
|
routedReelPostId = null;
|
|
4998
5027
|
reelRouteIsActive = !1;
|
|
4999
5028
|
constructor(e, t) {
|
|
@@ -5023,30 +5052,30 @@ var Ti = class {
|
|
|
5023
5052
|
};
|
|
5024
5053
|
//#endregion
|
|
5025
5054
|
//#region src/core/updateItems.ts
|
|
5026
|
-
function
|
|
5055
|
+
function Fi(e) {
|
|
5027
5056
|
return String(e);
|
|
5028
5057
|
}
|
|
5029
|
-
function
|
|
5030
|
-
let n =
|
|
5058
|
+
function Ii(e, t) {
|
|
5059
|
+
let n = W(t).length;
|
|
5031
5060
|
(e.mediaIndices.get(t.postId) ?? 0) >= n && e.mediaIndices.set(t.postId, Math.max(0, n - 1));
|
|
5032
5061
|
}
|
|
5033
|
-
function
|
|
5062
|
+
function Li(e, t) {
|
|
5034
5063
|
let n = /* @__PURE__ */ new Map();
|
|
5035
|
-
if (t.forEach((e) => n.set(
|
|
5064
|
+
if (t.forEach((e) => n.set(Fi(e.postId), e)), n.size === 0) return [];
|
|
5036
5065
|
let r = [], i = e.items.map((t) => {
|
|
5037
|
-
let i = n.get(
|
|
5066
|
+
let i = n.get(Fi(t.postId));
|
|
5038
5067
|
if (!i) return t;
|
|
5039
5068
|
let a = {
|
|
5040
5069
|
...i,
|
|
5041
5070
|
postId: t.postId
|
|
5042
5071
|
};
|
|
5043
|
-
return
|
|
5072
|
+
return Ii(e, a), e.reelForwardItem && Fi(e.reelForwardItem.postId) === Fi(t.postId) && (e.reelForwardItem = a), r.push(t.postId), a;
|
|
5044
5073
|
});
|
|
5045
5074
|
return r.length > 0 && (e.items = i), r;
|
|
5046
5075
|
}
|
|
5047
5076
|
//#endregion
|
|
5048
5077
|
//#region src/core/createVibe.ts
|
|
5049
|
-
var
|
|
5078
|
+
var Ri = class {
|
|
5050
5079
|
app = null;
|
|
5051
5080
|
autoScroll;
|
|
5052
5081
|
autofillController;
|
|
@@ -5070,25 +5099,25 @@ var ji = class {
|
|
|
5070
5099
|
state;
|
|
5071
5100
|
pageReplacement;
|
|
5072
5101
|
constructor(e) {
|
|
5073
|
-
this.options = e,
|
|
5102
|
+
this.options = e, ai(e);
|
|
5074
5103
|
let t = e.layout ?? "masonry";
|
|
5075
|
-
this.state =
|
|
5104
|
+
this.state = S(ni(e, t)), this.reelAudio = new Ni(e), this.lastLoadedCursor = e.initialPage ? $n(e.initialPage) : null, this.notificationItems = ee(this.state), this.autoScroll = new Er({
|
|
5076
5105
|
getScrollElement: () => this.surface?.getAutoScrollElement() ?? null,
|
|
5077
5106
|
state: this.state.autoScroll
|
|
5078
|
-
}), this.autofillController = new
|
|
5107
|
+
}), this.autofillController = new br({
|
|
5079
5108
|
cancelRequest: () => this.cancelRequest(!this.pageReplacement?.isActive()),
|
|
5080
5109
|
onLastCursor: (e) => this.setCurrentCursor(e),
|
|
5081
5110
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
5082
5111
|
options: e.autofill,
|
|
5083
5112
|
state: this.state
|
|
5084
|
-
}), this.removalReconciliation = new
|
|
5113
|
+
}), this.removalReconciliation = new pi(e), this.removalReconciliation.recordInitialPage(e.initialPage), this.fillController = new qr({
|
|
5085
5114
|
filterItems: (e) => this.removalReconciliation.filterItems(e),
|
|
5086
5115
|
fill: e.fill,
|
|
5087
5116
|
loadPage: e.loadPage ? (e) => this.loadFilteredPage(e) : void 0,
|
|
5088
5117
|
needsFrontendPreparation: () => this.removalReconciliation.needsReconciliation(this.state.items),
|
|
5089
5118
|
onLastCursor: (e) => this.setCurrentCursor(e),
|
|
5090
5119
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
5091
|
-
prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) =>
|
|
5120
|
+
prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) => Jr({
|
|
5092
5121
|
controller: this.removalReconciliation,
|
|
5093
5122
|
isCurrent: t,
|
|
5094
5123
|
loadPage: e.loadPage,
|
|
@@ -5098,8 +5127,8 @@ var ji = class {
|
|
|
5098
5127
|
state: this.state
|
|
5099
5128
|
}),
|
|
5100
5129
|
state: this.state
|
|
5101
|
-
}), this.routing = new
|
|
5102
|
-
let n =
|
|
5130
|
+
}), this.routing = new Pi(e.routing, this.state);
|
|
5131
|
+
let n = Ti({
|
|
5103
5132
|
historyLimit: e.removalHistoryLimit,
|
|
5104
5133
|
onActivate: (e) => this.setActiveReelPost(e),
|
|
5105
5134
|
onCloseReel: () => this.closeMasonryReel(),
|
|
@@ -5109,29 +5138,29 @@ var ji = class {
|
|
|
5109
5138
|
state: this.state,
|
|
5110
5139
|
surface: () => this.surface
|
|
5111
5140
|
});
|
|
5112
|
-
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.pageReplacement = new
|
|
5141
|
+
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.pageReplacement = new ci({
|
|
5113
5142
|
state: this.state,
|
|
5114
5143
|
surface: () => this.surface,
|
|
5115
5144
|
prepare: async () => {
|
|
5116
|
-
this.cancelRequest(!1),
|
|
5145
|
+
this.cancelRequest(!1), gr(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill();
|
|
5117
5146
|
},
|
|
5118
5147
|
commit: (e) => {
|
|
5119
|
-
this.resetFeedVisit(), this.setCurrentCursor(
|
|
5148
|
+
this.resetFeedVisit(), this.setCurrentCursor($n(e)), this.removalReconciliation.recordInitialPage(e), this.state.reelOrigin === null && this.routing.syncFeed();
|
|
5120
5149
|
}
|
|
5121
|
-
}), this.responsiveLayout = new
|
|
5150
|
+
}), this.responsiveLayout = new Mi(t, this.state, () => {
|
|
5122
5151
|
this.routing.syncFeed();
|
|
5123
5152
|
}), this.startStateNotifications();
|
|
5124
5153
|
}
|
|
5125
5154
|
async mount() {
|
|
5126
5155
|
if (this.app) throw Error("Vibe is already mounted.");
|
|
5127
5156
|
this.startStateNotifications();
|
|
5128
|
-
let e =
|
|
5129
|
-
this.responsiveLayout.mount(e), this.app = i(
|
|
5157
|
+
let e = oi(this.options.target);
|
|
5158
|
+
this.responsiveLayout.mount(e), this.app = i(Kn, {
|
|
5130
5159
|
canRetryEnd: !!this.options.loadPage,
|
|
5131
5160
|
cardFooter: this.options.cardFooter,
|
|
5132
5161
|
cardHeader: this.options.cardHeader,
|
|
5133
5162
|
feedFooter: this.options.feedFooter,
|
|
5134
|
-
feedFooterActions:
|
|
5163
|
+
feedFooterActions: Yr(this),
|
|
5135
5164
|
mediaCard: this.options.mediaCard,
|
|
5136
5165
|
masonry: this.options.masonry,
|
|
5137
5166
|
onMediaFullyVisible: this.options.onMediaFullyVisible,
|
|
@@ -5158,7 +5187,7 @@ var ji = class {
|
|
|
5158
5187
|
onRetryForward: () => {
|
|
5159
5188
|
this.retryReelForward();
|
|
5160
5189
|
}
|
|
5161
|
-
}), this.surface = this.app.mount(e), this.autoScroll.mount(), await
|
|
5190
|
+
}), this.surface = this.app.mount(e), this.autoScroll.mount(), await jr(this.options.restoreBacklog, (e) => this.appendPage(e), (e) => {
|
|
5162
5191
|
this.restoreController = e;
|
|
5163
5192
|
}), !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();
|
|
5164
5193
|
}
|
|
@@ -5166,7 +5195,7 @@ var ji = class {
|
|
|
5166
5195
|
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;
|
|
5167
5196
|
}
|
|
5168
5197
|
getState() {
|
|
5169
|
-
return
|
|
5198
|
+
return Y(this.state, this.notificationItems.value);
|
|
5170
5199
|
}
|
|
5171
5200
|
getReelAudioState() {
|
|
5172
5201
|
return this.reelAudio.get();
|
|
@@ -5193,7 +5222,7 @@ var ji = class {
|
|
|
5193
5222
|
return this.itemRemoval.restoreRemoval(e);
|
|
5194
5223
|
}
|
|
5195
5224
|
updateItems(e) {
|
|
5196
|
-
return
|
|
5225
|
+
return Li(this.state, e);
|
|
5197
5226
|
}
|
|
5198
5227
|
retryReelForward() {
|
|
5199
5228
|
return this.reelForward.retry();
|
|
@@ -5232,7 +5261,7 @@ var ji = class {
|
|
|
5232
5261
|
this.autoScroll.setSpeed(e);
|
|
5233
5262
|
}
|
|
5234
5263
|
applyAutofillUpdate(e) {
|
|
5235
|
-
let t =
|
|
5264
|
+
let t = kr(this.options.autofill, this.state, e);
|
|
5236
5265
|
return t && this.autofillController.syncCountdown(), t;
|
|
5237
5266
|
}
|
|
5238
5267
|
cancelAutofill() {
|
|
@@ -5243,7 +5272,7 @@ var ji = class {
|
|
|
5243
5272
|
await this.cancelFill();
|
|
5244
5273
|
return;
|
|
5245
5274
|
}
|
|
5246
|
-
if (
|
|
5275
|
+
if (gr(this.state.autofill)) {
|
|
5247
5276
|
await this.cancelAutofill();
|
|
5248
5277
|
return;
|
|
5249
5278
|
}
|
|
@@ -5256,12 +5285,12 @@ var ji = class {
|
|
|
5256
5285
|
}
|
|
5257
5286
|
async fill(e) {
|
|
5258
5287
|
if (!(this.state.loadMoreLocked || this.pageReplacement.isActive())) {
|
|
5259
|
-
if (this.pendingRequest ||
|
|
5288
|
+
if (this.pendingRequest || gr(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
|
|
5260
5289
|
await this.fillController.start(e);
|
|
5261
5290
|
}
|
|
5262
5291
|
}
|
|
5263
5292
|
restoreAutofillSession(e) {
|
|
5264
|
-
let t =
|
|
5293
|
+
let t = Ar(this.options.autofill, this.state, e);
|
|
5265
5294
|
return t && this.autofillController.syncCountdown(), t;
|
|
5266
5295
|
}
|
|
5267
5296
|
restoreFillSession(e) {
|
|
@@ -5271,7 +5300,7 @@ var ji = class {
|
|
|
5271
5300
|
return this.startLoadMore(() => this.loadNextSequence());
|
|
5272
5301
|
}
|
|
5273
5302
|
appendPage(e) {
|
|
5274
|
-
|
|
5303
|
+
er(e, this.state, this.removalReconciliation, (e) => this.setCurrentCursor(e));
|
|
5275
5304
|
}
|
|
5276
5305
|
replenishAfterRemoval(e = !0) {
|
|
5277
5306
|
return this.startLoadMore(() => this.replenishAfterRemovalSequence(e));
|
|
@@ -5279,7 +5308,7 @@ var ji = class {
|
|
|
5279
5308
|
async startLoadMore(e) {
|
|
5280
5309
|
if (this.pageReplacement.isActive()) return;
|
|
5281
5310
|
if (this.pendingRequest) return this.pendingRequest;
|
|
5282
|
-
if (this.state.loadMoreLocked ||
|
|
5311
|
+
if (this.state.loadMoreLocked || gr(this.state.autofill) || this.fillController.isActive() || !this.options.loadPage || this.state.next === null && !this.removalReconciliation.needsReconciliation(this.state.items)) return;
|
|
5283
5312
|
this.state.isLoadingMore = !0, this.state.nextPageError = null;
|
|
5284
5313
|
let t = e();
|
|
5285
5314
|
return this.pendingRequest = t, t.finally(() => {
|
|
@@ -5297,15 +5326,15 @@ var ji = class {
|
|
|
5297
5326
|
}
|
|
5298
5327
|
async replaceFeed(e, t) {
|
|
5299
5328
|
if (!this.options.loadPage) throw Error(`Vibe cannot ${t} without loadPage.`);
|
|
5300
|
-
return
|
|
5329
|
+
return gr(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.resetFeedVisit(), this.surface?.resetMediaLifecycle(), this.state.error = null, this.state.current = null, this.state.isLoading = !0, this.state.items = [], this.state.next = null, this.state.nextPageError = null, this.state.total = null, this.startRequest(e, !1);
|
|
5301
5330
|
}
|
|
5302
5331
|
resetFeedVisit() {
|
|
5303
|
-
this.state.autofill =
|
|
5332
|
+
this.state.autofill = hr(this.options.autofill, void 0, !1), this.fillController.reset(), this.reelForward.reset(), this.reelRemoval.reset(), this.exactMediaRemoval.reset(), this.itemRemoval.reset(), this.removalReconciliation.reset();
|
|
5304
5333
|
}
|
|
5305
5334
|
async loadFilteredPage(e) {
|
|
5306
5335
|
let t = this.options.loadPage;
|
|
5307
5336
|
if (!t) throw Error("Vibe cannot load a page without loadPage.");
|
|
5308
|
-
let n =
|
|
5337
|
+
let n = qn(await t(e));
|
|
5309
5338
|
return {
|
|
5310
5339
|
...n,
|
|
5311
5340
|
items: this.removalReconciliation.filterItems(n.items)
|
|
@@ -5325,7 +5354,7 @@ var ji = class {
|
|
|
5325
5354
|
let n = ++this.requestVersion, r = new AbortController();
|
|
5326
5355
|
this.abortController = r;
|
|
5327
5356
|
try {
|
|
5328
|
-
let i = await
|
|
5357
|
+
let i = await Jr({
|
|
5329
5358
|
controller: this.removalReconciliation,
|
|
5330
5359
|
isCurrent: () => n === this.requestVersion,
|
|
5331
5360
|
loadPage: t,
|
|
@@ -5345,14 +5374,14 @@ var ji = class {
|
|
|
5345
5374
|
async retryEnd() {
|
|
5346
5375
|
if (!this.pageReplacement.isActive()) {
|
|
5347
5376
|
if (this.pendingRequest) return this.pendingRequest;
|
|
5348
|
-
if (!this.state.loadMoreLocked && !(
|
|
5377
|
+
if (!this.state.loadMoreLocked && !(gr(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);
|
|
5349
5378
|
}
|
|
5350
5379
|
}
|
|
5351
5380
|
setInfiniteScroll(e) {
|
|
5352
|
-
this.state.infiniteScroll = e, e &&
|
|
5381
|
+
this.state.infiniteScroll = e, e && h(() => this.surface?.loadIfNearBottom());
|
|
5353
5382
|
}
|
|
5354
5383
|
setLoadMoreLocked(e) {
|
|
5355
|
-
|
|
5384
|
+
li(this.state, e, {
|
|
5356
5385
|
getPending: () => this.pendingRequest,
|
|
5357
5386
|
hasPendingSession: () => this.removalReconciliation.hasPendingSession(),
|
|
5358
5387
|
loadNext: () => this.loadNext(),
|
|
@@ -5365,10 +5394,10 @@ var ji = class {
|
|
|
5365
5394
|
this.state.total = e;
|
|
5366
5395
|
}
|
|
5367
5396
|
setReelAutoAdvance(e) {
|
|
5368
|
-
|
|
5397
|
+
$r(this.state.reelAutoAdvance, e);
|
|
5369
5398
|
}
|
|
5370
5399
|
setReelInfoSheet(e) {
|
|
5371
|
-
|
|
5400
|
+
ti(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
|
|
5372
5401
|
}
|
|
5373
5402
|
setLayout(e) {
|
|
5374
5403
|
this.responsiveLayout.setLayout(e);
|
|
@@ -5388,7 +5417,7 @@ var ji = class {
|
|
|
5388
5417
|
async fetchPage(e, t) {
|
|
5389
5418
|
if (!this.options.loadPage) return;
|
|
5390
5419
|
let n = ++this.requestVersion, r = new AbortController();
|
|
5391
|
-
this.abortController = r, await
|
|
5420
|
+
this.abortController = r, await si({
|
|
5392
5421
|
append: t,
|
|
5393
5422
|
autofillController: this.autofillController,
|
|
5394
5423
|
cursor: e,
|
|
@@ -5410,7 +5439,7 @@ var ji = class {
|
|
|
5410
5439
|
startInitialAutofill() {
|
|
5411
5440
|
let e = ++this.requestVersion, t = new AbortController(), n = this.autofillController.beginCycle();
|
|
5412
5441
|
this.abortController = t, this.state.isLoadingMore = !0;
|
|
5413
|
-
let r =
|
|
5442
|
+
let r = Mr({
|
|
5414
5443
|
cycleId: n,
|
|
5415
5444
|
isCurrent: () => e === this.requestVersion,
|
|
5416
5445
|
onCollection: (t) => this.autofillController.captureCollection(t, e === this.requestVersion),
|
|
@@ -5428,11 +5457,11 @@ var ji = class {
|
|
|
5428
5457
|
}
|
|
5429
5458
|
startStateNotifications() {
|
|
5430
5459
|
let e = this.options.onStateChange;
|
|
5431
|
-
!e || this.stopStateWatcher || (this.stopStateWatcher =
|
|
5460
|
+
!e || this.stopStateWatcher || (this.stopStateWatcher = J(this.state, this.notificationItems, e));
|
|
5432
5461
|
}
|
|
5433
5462
|
setCurrentCursor(e) {
|
|
5434
5463
|
this.lastLoadedCursor = this.state.current = e;
|
|
5435
5464
|
}
|
|
5436
|
-
},
|
|
5465
|
+
}, zi = (e) => new Ri(e);
|
|
5437
5466
|
//#endregion
|
|
5438
|
-
export {
|
|
5467
|
+
export { zi as createVibe };
|