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