@wyxos/vibe 5.13.4 → 5.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/MasonryFeed.vue.d.ts +3 -0
- package/lib/components/MediaCard.vue.d.ts +3 -0
- package/lib/components/ReelFeed.vue.d.ts +3 -0
- package/lib/components/ReelLayout.vue.d.ts +3 -0
- package/lib/components/VibeSurface.vue.d.ts +7 -1
- package/lib/components/useMediaLifecycle.d.ts +4 -1
- package/lib/components/useMediaReadiness.d.ts +2 -2
- package/lib/core/feed.d.ts +2 -0
- package/lib/core/loadingLock.d.ts +10 -0
- package/lib/core/mediaFailure.d.ts +6 -0
- package/lib/core/pageReplacement.d.ts +22 -0
- package/lib/core/runtime.d.ts +2 -1
- package/lib/index.cjs +2 -2
- package/lib/index.d.ts +2 -1
- package/lib/index.js +963 -831
- package/lib/types.d.ts +4 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -48,7 +48,7 @@ function B(e) {
|
|
|
48
48
|
type: "image"
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function ee(e, t) {
|
|
52
52
|
return I(e.type, e.src) === "audio" ? t === "mobile" && e.mobile && I(e.mobile.type, e.mobile.src) === "audio" ? {
|
|
53
53
|
...e.mobile,
|
|
54
54
|
type: "audio"
|
|
@@ -57,24 +57,27 @@ function V(e, t) {
|
|
|
57
57
|
type: "audio"
|
|
58
58
|
} : z(e, t);
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function V(e) {
|
|
61
61
|
return [e, ...e.items];
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function H(e, t) {
|
|
64
64
|
return Math.min(e.items.length, Math.max(0, t));
|
|
65
65
|
}
|
|
66
|
-
function
|
|
67
|
-
return
|
|
66
|
+
function U(e, t) {
|
|
67
|
+
return V(e)[H(e, t)] ?? e;
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function W(e, t) {
|
|
70
70
|
return `${String(e)}:${t}`;
|
|
71
71
|
}
|
|
72
72
|
//#endregion
|
|
73
73
|
//#region src/core/runtime.ts
|
|
74
|
-
function
|
|
74
|
+
function G(e) {
|
|
75
75
|
return r(() => Object.freeze([...e.items]));
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function K(e, t, n) {
|
|
78
|
+
return n(te(e, t.value)), O(() => te(e, t.value), n, { flush: "post" });
|
|
79
|
+
}
|
|
80
|
+
function te(e, t = [...e.items]) {
|
|
78
81
|
return {
|
|
79
82
|
activeReelPostId: e.activeReelPostId,
|
|
80
83
|
autoScroll: { ...e.autoScroll },
|
|
@@ -104,17 +107,17 @@ function q(e, t = [...e.items]) {
|
|
|
104
107
|
}
|
|
105
108
|
//#endregion
|
|
106
109
|
//#region src/components/GalleryFooter.vue?vue&type=script&setup=true&lang.ts
|
|
107
|
-
var
|
|
110
|
+
var q = {
|
|
108
111
|
key: 0,
|
|
109
112
|
class: "gallery-footer"
|
|
110
|
-
},
|
|
113
|
+
}, J = {
|
|
111
114
|
key: 0,
|
|
112
115
|
class: "load-more-status",
|
|
113
116
|
role: "status"
|
|
114
|
-
},
|
|
117
|
+
}, ne = ["disabled"], re = {
|
|
115
118
|
key: 2,
|
|
116
119
|
class: "end-feed"
|
|
117
|
-
},
|
|
120
|
+
}, ie = ["disabled"], ae = /* @__PURE__ */ d({
|
|
118
121
|
__name: "GalleryFooter",
|
|
119
122
|
props: {
|
|
120
123
|
canRetryEnd: { type: Boolean },
|
|
@@ -130,14 +133,14 @@ var J = {
|
|
|
130
133
|
function i() {
|
|
131
134
|
n.loadMoreLocked || (n.hasNext ? r("loadMore") : r("retryEnd"));
|
|
132
135
|
}
|
|
133
|
-
return (t, n) => e.isLoading || e.hasError || e.hasNext && e.showLoadMore || !e.hasNext && e.canRetryEnd ? (b(), s("footer",
|
|
136
|
+
return (t, n) => e.isLoading || e.hasError || e.hasNext && e.showLoadMore || !e.hasNext && e.canRetryEnd ? (b(), s("footer", q, [e.isLoading ? (b(), s("p", J, " Loading more… ")) : e.hasError || e.hasNext && e.showLoadMore ? (b(), s("button", {
|
|
134
137
|
key: 1,
|
|
135
138
|
"data-test": "load-more",
|
|
136
139
|
class: "load-more-button",
|
|
137
140
|
type: "button",
|
|
138
141
|
disabled: e.loadMoreLocked,
|
|
139
142
|
onClick: i
|
|
140
|
-
}, T(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9,
|
|
143
|
+
}, T(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9, ne)) : (b(), s("div", re, [n[1] ||= c("p", {
|
|
141
144
|
class: "end-feed-message",
|
|
142
145
|
role: "status"
|
|
143
146
|
}, " You've reached the end. ", -1), c("button", {
|
|
@@ -146,9 +149,9 @@ var J = {
|
|
|
146
149
|
type: "button",
|
|
147
150
|
disabled: e.loadMoreLocked,
|
|
148
151
|
onClick: n[0] ||= (e) => t.$emit("retryEnd")
|
|
149
|
-
}, " Check for more ", 8,
|
|
152
|
+
}, " Check for more ", 8, ie)]))])) : o("", !0);
|
|
150
153
|
}
|
|
151
|
-
}),
|
|
154
|
+
}), oe = /* @__PURE__ */ d({
|
|
152
155
|
__name: "FeedFooter",
|
|
153
156
|
props: {
|
|
154
157
|
actions: {},
|
|
@@ -185,7 +188,7 @@ var J = {
|
|
|
185
188
|
"can-retry-end",
|
|
186
189
|
"show-load-more",
|
|
187
190
|
"state"
|
|
188
|
-
])) : (b(), a(
|
|
191
|
+
])) : (b(), a(ae, {
|
|
189
192
|
key: 1,
|
|
190
193
|
"can-retry-end": e.canRetryEnd,
|
|
191
194
|
"has-error": e.hasError,
|
|
@@ -204,7 +207,7 @@ var J = {
|
|
|
204
207
|
"show-load-more"
|
|
205
208
|
]));
|
|
206
209
|
}
|
|
207
|
-
}),
|
|
210
|
+
}), se = ["role"], ce = { class: "gallery-status" }, le = /* @__PURE__ */ d({
|
|
208
211
|
__name: "FeedStatus",
|
|
209
212
|
props: {
|
|
210
213
|
actions: {},
|
|
@@ -218,7 +221,7 @@ var J = {
|
|
|
218
221
|
return (n, u) => (b(), s("main", {
|
|
219
222
|
class: "gallery-shell",
|
|
220
223
|
role: r.state.error ? "alert" : r.state.isLoading || r.state.isLoadingMore ? "status" : void 0
|
|
221
|
-
}, [c("p",
|
|
224
|
+
}, [c("p", ce, [r.state.error ? (b(), s(e, { key: 0 }, [l(" Unable to load media. ")], 64)) : r.state.isLoading || r.state.isLoadingMore ? (b(), s(e, { key: 1 }, [l(" Loading media… ")], 64)) : (b(), s(e, { key: 2 }, [l(" No media found. ")], 64))]), t.feedFooter ? (b(), a(oe, {
|
|
222
225
|
key: 0,
|
|
223
226
|
actions: t.actions,
|
|
224
227
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -240,10 +243,10 @@ var J = {
|
|
|
240
243
|
"is-loading",
|
|
241
244
|
"load-more-locked",
|
|
242
245
|
"state"
|
|
243
|
-
])) : o("", !0)], 8,
|
|
246
|
+
])) : o("", !0)], 8, se));
|
|
244
247
|
}
|
|
245
248
|
});
|
|
246
|
-
function
|
|
249
|
+
function Y(e) {
|
|
247
250
|
return e.scrollHeight - e.scrollTop - e.clientHeight <= 240;
|
|
248
251
|
}
|
|
249
252
|
//#endregion
|
|
@@ -255,19 +258,19 @@ function X(e) {
|
|
|
255
258
|
function Z(e) {
|
|
256
259
|
return e.reduce((t, n, r) => n < e[t] ? r : t, 0);
|
|
257
260
|
}
|
|
258
|
-
function
|
|
261
|
+
function ue(e) {
|
|
259
262
|
return Math.max(0, e.containerHeight) + Math.max(0, e.gap);
|
|
260
263
|
}
|
|
261
|
-
var
|
|
262
|
-
function
|
|
264
|
+
var de = .8, fe = .5;
|
|
265
|
+
function pe(e, t, n) {
|
|
263
266
|
let r = Math.max(0, n.viewportHeight);
|
|
264
267
|
if (r === 0) return [];
|
|
265
268
|
let i = n.scrollTop, a = i + r;
|
|
266
269
|
return t.filter((t) => {
|
|
267
270
|
let n = e[t];
|
|
268
271
|
if (!n || n.height <= 0) return !1;
|
|
269
|
-
let o = Math.max(0, Math.min(n.y + n.height, a) - Math.max(n.y, i)), s = n.height <= r ? n.height : r *
|
|
270
|
-
return o +
|
|
272
|
+
let o = Math.max(0, Math.min(n.y + n.height, a) - Math.max(n.y, i)), s = n.height <= r ? n.height : r * de;
|
|
273
|
+
return o + fe >= s;
|
|
271
274
|
});
|
|
272
275
|
}
|
|
273
276
|
function Q(e, t) {
|
|
@@ -280,7 +283,7 @@ function Q(e, t) {
|
|
|
280
283
|
itemWidth: (e - n * (a - 1)) / a
|
|
281
284
|
};
|
|
282
285
|
}
|
|
283
|
-
function
|
|
286
|
+
function me(e, t, n) {
|
|
284
287
|
let r = Z(t), i = n.itemWidth * X(e) + n.additionalHeight, a = {
|
|
285
288
|
x: r * (n.itemWidth + n.gap),
|
|
286
289
|
y: t[r],
|
|
@@ -289,47 +292,47 @@ function pe(e, t, n) {
|
|
|
289
292
|
};
|
|
290
293
|
return t[r] += i + n.gap, a;
|
|
291
294
|
}
|
|
292
|
-
function
|
|
295
|
+
function he(e, t) {
|
|
293
296
|
let n = Array.from({ length: t.columns }, () => 0), r = t.itemWidth + t.gap;
|
|
294
297
|
return e.forEach((e) => {
|
|
295
298
|
let i = r === 0 ? 0 : Math.round(e.x / r);
|
|
296
299
|
i < 0 || i >= t.columns || (n[i] = Math.max(n[i], e.y + e.height + t.gap));
|
|
297
300
|
}), n;
|
|
298
301
|
}
|
|
299
|
-
function
|
|
302
|
+
function ge(e, t) {
|
|
300
303
|
return e.length === 0 ? 0 : Math.max(0, Math.max(...e) - t);
|
|
301
304
|
}
|
|
302
|
-
function
|
|
305
|
+
function _e(e, t, n) {
|
|
303
306
|
let r = Q(t, n);
|
|
304
307
|
if (!r || e.length === 0) return {
|
|
305
308
|
columns: 0,
|
|
306
309
|
height: 0,
|
|
307
310
|
items: []
|
|
308
311
|
};
|
|
309
|
-
let i = Array.from({ length: r.columns }, () => 0), a = e.map((e) =>
|
|
312
|
+
let i = Array.from({ length: r.columns }, () => 0), a = e.map((e) => me(e, i, r));
|
|
310
313
|
return {
|
|
311
314
|
columns: r.columns,
|
|
312
|
-
height:
|
|
315
|
+
height: ge(i, r.gap),
|
|
313
316
|
items: a
|
|
314
317
|
};
|
|
315
318
|
}
|
|
316
|
-
function
|
|
319
|
+
function ve(e, t, n, r, i, a) {
|
|
317
320
|
let o = Q(t, n);
|
|
318
321
|
if (!o || e.length === 0) return {
|
|
319
322
|
columns: 0,
|
|
320
323
|
height: 0,
|
|
321
324
|
items: []
|
|
322
325
|
};
|
|
323
|
-
if (r.columns !== o.columns || i > 0 && r.items.length < i) return
|
|
324
|
-
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) :
|
|
325
|
-
for (let t = s; t < e.length && t < c && !(l !== void 0 && t > s && t > u && f.every((e) => e >= l)); t += 1) d.push(
|
|
326
|
+
if (r.columns !== o.columns || i > 0 && r.items.length < i) return _e(e, t, n);
|
|
327
|
+
let s = Math.max(0, i), c = a?.untilIndex ?? e.length, l = a?.untilBottom, u = a?.throughIndex ?? s, d = s === 0 ? [] : r.items.slice(0, s), f = s === 0 ? Array.from({ length: o.columns }, () => 0) : he(d, o);
|
|
328
|
+
for (let t = s; t < e.length && t < c && !(l !== void 0 && t > s && t > u && f.every((e) => e >= l)); t += 1) d.push(me(e[t], f, o));
|
|
326
329
|
return {
|
|
327
330
|
columns: o.columns,
|
|
328
|
-
height:
|
|
331
|
+
height: ge(f, o.gap),
|
|
329
332
|
items: d
|
|
330
333
|
};
|
|
331
334
|
}
|
|
332
|
-
function
|
|
335
|
+
function ye(e, t, n, r, i, a) {
|
|
333
336
|
let o = Q(t, n);
|
|
334
337
|
if (!o || e.length === 0) return {
|
|
335
338
|
columns: 0,
|
|
@@ -339,7 +342,7 @@ function ve(e, t, n, r, i, a) {
|
|
|
339
342
|
retainedIndices: []
|
|
340
343
|
};
|
|
341
344
|
if (r.items.length !== e.length || r.columns !== o.columns) {
|
|
342
|
-
let a = e.map((e, t) => t).filter((e) => !i(e)), o =
|
|
345
|
+
let a = e.map((e, t) => t).filter((e) => !i(e)), o = _e(a.map((t) => e[t]), t, n), s = e.map((e, t) => r.items[t] ?? {
|
|
343
346
|
height: 0,
|
|
344
347
|
width: 0,
|
|
345
348
|
x: 0,
|
|
@@ -364,10 +367,10 @@ function ve(e, t, n, r, i, a) {
|
|
|
364
367
|
};
|
|
365
368
|
let c = r.items.slice(), l = [];
|
|
366
369
|
for (let e = 0; e < s; e += 1) l.push(e);
|
|
367
|
-
let u = a?.untilBottom, d = a?.throughIndex ?? s, f =
|
|
370
|
+
let u = a?.untilBottom, d = a?.throughIndex ?? s, f = he(c.slice(0, s), o);
|
|
368
371
|
for (let t = s; t < e.length; t += 1) if (!i(t)) {
|
|
369
372
|
if (u !== void 0 && l.length > s && t > d && f.every((e) => e >= u)) break;
|
|
370
|
-
c[t] =
|
|
373
|
+
c[t] = me(e[t], f, o), l.push(t);
|
|
371
374
|
}
|
|
372
375
|
let p = new Set(l);
|
|
373
376
|
for (let t = s; t < e.length; t += 1) i(t) || p.has(t) || (c[t] = {
|
|
@@ -379,17 +382,17 @@ function ve(e, t, n, r, i, a) {
|
|
|
379
382
|
return {
|
|
380
383
|
columns: o.columns,
|
|
381
384
|
fromIndex: s,
|
|
382
|
-
height:
|
|
385
|
+
height: ge(f, o.gap),
|
|
383
386
|
items: c,
|
|
384
387
|
retainedIndices: l
|
|
385
388
|
};
|
|
386
389
|
}
|
|
387
390
|
//#endregion
|
|
388
391
|
//#region src/core/masonryViewportIndex.ts
|
|
389
|
-
function
|
|
392
|
+
function be(e) {
|
|
390
393
|
return { columns: [...e.entries()].sort(([e], [t]) => e - t).map(([, e]) => e.sort((e, t) => e.top - t.top || e.index - t.index)) };
|
|
391
394
|
}
|
|
392
|
-
function
|
|
395
|
+
function xe(e, t, n) {
|
|
393
396
|
let r = e.get(t.x) ?? [];
|
|
394
397
|
r.push({
|
|
395
398
|
bottom: t.y + t.height,
|
|
@@ -397,14 +400,14 @@ function be(e, t, n) {
|
|
|
397
400
|
top: t.y
|
|
398
401
|
}), e.set(t.x, r);
|
|
399
402
|
}
|
|
400
|
-
function
|
|
403
|
+
function Se(e, t) {
|
|
401
404
|
let n = /* @__PURE__ */ new Map();
|
|
402
405
|
return e.forEach((e, r) => {
|
|
403
|
-
|
|
404
|
-
}),
|
|
406
|
+
xe(n, e, t?.[r] ?? r);
|
|
407
|
+
}), be(n);
|
|
405
408
|
}
|
|
406
|
-
function
|
|
407
|
-
if (n <= 0) return
|
|
409
|
+
function Ce(e, t, n, r) {
|
|
410
|
+
if (n <= 0) return Se(e, r);
|
|
408
411
|
let i = /* @__PURE__ */ new Map();
|
|
409
412
|
t.columns.forEach((t) => {
|
|
410
413
|
t.forEach((t) => {
|
|
@@ -415,11 +418,11 @@ function Se(e, t, n, r) {
|
|
|
415
418
|
a.push(t), i.set(r.x, a);
|
|
416
419
|
});
|
|
417
420
|
});
|
|
418
|
-
for (let t = n; t < e.length; t += 1)
|
|
419
|
-
return
|
|
421
|
+
for (let t = n; t < e.length; t += 1) xe(i, e[t], r?.[t] ?? t);
|
|
422
|
+
return be(i);
|
|
420
423
|
}
|
|
421
|
-
function
|
|
422
|
-
if (r <= 0) return
|
|
424
|
+
function we(e, t, n, r) {
|
|
425
|
+
if (r <= 0) return Se(t.map((t) => e[t]), t);
|
|
423
426
|
let i = /* @__PURE__ */ new Map();
|
|
424
427
|
return n.columns.forEach((t) => {
|
|
425
428
|
t.forEach((t) => {
|
|
@@ -430,10 +433,10 @@ function Ce(e, t, n, r) {
|
|
|
430
433
|
a.push(t), i.set(n.x, a);
|
|
431
434
|
});
|
|
432
435
|
}), t.forEach((t) => {
|
|
433
|
-
t < r ||
|
|
434
|
-
}),
|
|
436
|
+
t < r || xe(i, e[t], t);
|
|
437
|
+
}), be(i);
|
|
435
438
|
}
|
|
436
|
-
function
|
|
439
|
+
function Te(e, t) {
|
|
437
440
|
let n = 0, r = 0, i = e.length;
|
|
438
441
|
for (; r < i;) {
|
|
439
442
|
let a = Math.floor((r + i) / 2);
|
|
@@ -444,10 +447,10 @@ function we(e, t) {
|
|
|
444
447
|
inspected: n
|
|
445
448
|
};
|
|
446
449
|
}
|
|
447
|
-
function
|
|
450
|
+
function Ee(e, t) {
|
|
448
451
|
let n = Math.max(0, t.overscan), r = t.scrollTop - n, i = t.scrollTop + Math.max(0, t.viewportHeight) + n, a = [], o = 0;
|
|
449
452
|
return e.columns.forEach((e) => {
|
|
450
|
-
let t =
|
|
453
|
+
let t = Te(e, r);
|
|
451
454
|
o += t.inspected;
|
|
452
455
|
for (let n = t.index; n < e.length; n += 1) {
|
|
453
456
|
let t = e[n];
|
|
@@ -459,14 +462,14 @@ function Te(e, t) {
|
|
|
459
462
|
inspected: o
|
|
460
463
|
};
|
|
461
464
|
}
|
|
462
|
-
function
|
|
465
|
+
function De(e) {
|
|
463
466
|
return e?.minColumnWidth ?? 240;
|
|
464
467
|
}
|
|
465
|
-
function
|
|
468
|
+
function Oe(e, t) {
|
|
466
469
|
let n = e?.overscan?.minimumPx ?? 800, r = e?.overscan?.viewportMultiplier ?? 1.5, i = Math.max(n, t * r), a = e?.overscan?.maximumPx;
|
|
467
470
|
return a === void 0 ? i : Math.min(i, a);
|
|
468
471
|
}
|
|
469
|
-
function
|
|
472
|
+
function ke(e) {
|
|
470
473
|
if (e?.minColumnWidth !== void 0 && (!Number.isFinite(e.minColumnWidth) || e.minColumnWidth <= 0)) throw TypeError("Vibe masonry minColumnWidth must be a positive number.");
|
|
471
474
|
let t = e?.overscan;
|
|
472
475
|
if (t) {
|
|
@@ -480,10 +483,10 @@ function Oe(e) {
|
|
|
480
483
|
}
|
|
481
484
|
//#endregion
|
|
482
485
|
//#region src/core/scrollbar.ts
|
|
483
|
-
function
|
|
486
|
+
function Ae(e, t, n) {
|
|
484
487
|
return Math.min(n, Math.max(t, e));
|
|
485
488
|
}
|
|
486
|
-
function
|
|
489
|
+
function je({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize: r, viewportSize: i }) {
|
|
487
490
|
let a = Math.max(0, e), o = Math.max(0, r), s = Math.max(0, i), c = Math.max(0, a - s);
|
|
488
491
|
if (!(c > 0 && o > 0)) return {
|
|
489
492
|
maximumScrollPosition: c,
|
|
@@ -492,23 +495,23 @@ function Ae({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize:
|
|
|
492
495
|
thumbSize: o,
|
|
493
496
|
thumbTravel: 0
|
|
494
497
|
};
|
|
495
|
-
let l =
|
|
498
|
+
let l = Ae(s / a * o, Math.min(Math.max(0, t), o), o), u = Math.max(0, o - l);
|
|
496
499
|
return {
|
|
497
500
|
maximumScrollPosition: c,
|
|
498
501
|
scrollable: !0,
|
|
499
|
-
thumbOffset: u * (
|
|
502
|
+
thumbOffset: u * (Ae(n, 0, c) / c),
|
|
500
503
|
thumbSize: l,
|
|
501
504
|
thumbTravel: u
|
|
502
505
|
};
|
|
503
506
|
}
|
|
504
507
|
//#endregion
|
|
505
508
|
//#region src/components/GalleryScrollbar.vue?vue&type=script&setup=true&lang.ts
|
|
506
|
-
var
|
|
509
|
+
var Me = ["aria-hidden"], Ne = [
|
|
507
510
|
"aria-controls",
|
|
508
511
|
"aria-valuemax",
|
|
509
512
|
"aria-valuenow",
|
|
510
513
|
"tabindex"
|
|
511
|
-
],
|
|
514
|
+
], Pe = 32, Fe = 40, Ie = 120, Le = /* @__PURE__ */ d({
|
|
512
515
|
__name: "GalleryScrollbar",
|
|
513
516
|
props: {
|
|
514
517
|
contentSize: {},
|
|
@@ -530,16 +533,16 @@ var je = ["aria-hidden"], Me = [
|
|
|
530
533
|
function k() {
|
|
531
534
|
g !== null && clearTimeout(g), g = setTimeout(() => {
|
|
532
535
|
g = null, o.value || (l.value = !1);
|
|
533
|
-
},
|
|
536
|
+
}, Ie);
|
|
534
537
|
}
|
|
535
538
|
function A() {
|
|
536
539
|
l.value = !0, k();
|
|
537
540
|
}
|
|
538
541
|
function j() {
|
|
539
542
|
let e = t.scrollElement, r = i.value;
|
|
540
|
-
return !e || !r ? n :
|
|
543
|
+
return !e || !r ? n : je({
|
|
541
544
|
contentSize: e.scrollHeight,
|
|
542
|
-
minimumThumbSize:
|
|
545
|
+
minimumThumbSize: Pe,
|
|
543
546
|
scrollPosition: e.scrollTop,
|
|
544
547
|
trackSize: r.clientHeight,
|
|
545
548
|
viewportSize: e.clientHeight
|
|
@@ -592,7 +595,7 @@ var je = ["aria-hidden"], Me = [
|
|
|
592
595
|
}
|
|
593
596
|
function z(e) {
|
|
594
597
|
if (!E.value) return;
|
|
595
|
-
let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r -
|
|
598
|
+
let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r - Fe : e.key === "ArrowDown" ? r + Fe : e.key === "PageUp" ? r - n : e.key === "PageDown" ? r + n : e.key === "Home" ? 0 : e.key === "End" ? a.value.maximumScrollPosition : null;
|
|
596
599
|
i !== null && (e.preventDefault(), A(), P(i));
|
|
597
600
|
}
|
|
598
601
|
function B(e) {
|
|
@@ -638,15 +641,15 @@ var je = ["aria-hidden"], Me = [
|
|
|
638
641
|
onPointerdown: I,
|
|
639
642
|
onPointermove: L,
|
|
640
643
|
onPointerup: R
|
|
641
|
-
}, null, 44,
|
|
644
|
+
}, null, 44, Ne)], 42, Me));
|
|
642
645
|
}
|
|
643
|
-
}),
|
|
646
|
+
}), Re = (e) => {
|
|
644
647
|
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
|
645
648
|
return !1;
|
|
646
|
-
},
|
|
647
|
-
let t =
|
|
649
|
+
}, ze = (e) => e === "", Be = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), Ve = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), He = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), Ue = (e) => {
|
|
650
|
+
let t = He(e);
|
|
648
651
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
649
|
-
},
|
|
652
|
+
}, We = {
|
|
650
653
|
xmlns: "http://www.w3.org/2000/svg",
|
|
651
654
|
width: 24,
|
|
652
655
|
height: 24,
|
|
@@ -656,27 +659,27 @@ var je = ["aria-hidden"], Me = [
|
|
|
656
659
|
"stroke-width": 2,
|
|
657
660
|
"stroke-linecap": "round",
|
|
658
661
|
"stroke-linejoin": "round"
|
|
659
|
-
},
|
|
660
|
-
...
|
|
662
|
+
}, Ge = ({ name: e, iconNode: t, absoluteStrokeWidth: n, "absolute-stroke-width": r, strokeWidth: i, "stroke-width": a, size: o = We.width, color: s = We.stroke, ...c }, { slots: l }) => p("svg", {
|
|
663
|
+
...We,
|
|
661
664
|
...c,
|
|
662
665
|
width: o,
|
|
663
666
|
height: o,
|
|
664
667
|
stroke: s,
|
|
665
|
-
"stroke-width":
|
|
666
|
-
class:
|
|
667
|
-
...!l.default && !
|
|
668
|
-
}, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]),
|
|
668
|
+
"stroke-width": ze(n) || ze(r) || n === !0 || r === !0 ? Number(i || a || We["stroke-width"]) * 24 / Number(o) : i || a || We["stroke-width"],
|
|
669
|
+
class: Be("lucide", c.class, ...e ? [`lucide-${Ve(Ue(e))}-icon`, `lucide-${Ve(e)}`] : ["lucide-icon"]),
|
|
670
|
+
...!l.default && !Re(c) && { "aria-hidden": "true" }
|
|
671
|
+
}, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]), Ke = (e, t) => (n, { slots: r, attrs: i }) => p(Ge, {
|
|
669
672
|
...i,
|
|
670
673
|
...n,
|
|
671
674
|
iconNode: t,
|
|
672
675
|
name: e
|
|
673
|
-
}, r),
|
|
676
|
+
}, r), qe = Ke("chevron-left", [["path", {
|
|
674
677
|
d: "m15 18-6-6 6-6",
|
|
675
678
|
key: "1wnfg3"
|
|
676
|
-
}]]),
|
|
679
|
+
}]]), Je = Ke("chevron-right", [["path", {
|
|
677
680
|
d: "m9 18 6-6-6-6",
|
|
678
681
|
key: "mthhwq"
|
|
679
|
-
}]]),
|
|
682
|
+
}]]), Ye = Ke("disc-3", [
|
|
680
683
|
["circle", {
|
|
681
684
|
cx: "12",
|
|
682
685
|
cy: "12",
|
|
@@ -697,7 +700,7 @@ var je = ["aria-hidden"], Me = [
|
|
|
697
700
|
d: "M18 12c0 1.7-.7 3.2-1.8 4.2",
|
|
698
701
|
key: "1eah9h"
|
|
699
702
|
}]
|
|
700
|
-
]),
|
|
703
|
+
]), Xe = Ke("pause", [["rect", {
|
|
701
704
|
x: "14",
|
|
702
705
|
y: "3",
|
|
703
706
|
width: "5",
|
|
@@ -711,10 +714,10 @@ var je = ["aria-hidden"], Me = [
|
|
|
711
714
|
height: "18",
|
|
712
715
|
rx: "1",
|
|
713
716
|
key: "1wsw3u"
|
|
714
|
-
}]]),
|
|
717
|
+
}]]), Ze = Ke("play", [["path", {
|
|
715
718
|
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",
|
|
716
719
|
key: "10ikf1"
|
|
717
|
-
}]]),
|
|
720
|
+
}]]), Qe = Ke("volume-2", [
|
|
718
721
|
["path", {
|
|
719
722
|
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",
|
|
720
723
|
key: "uqj9uw"
|
|
@@ -727,7 +730,7 @@ var je = ["aria-hidden"], Me = [
|
|
|
727
730
|
d: "M19.364 18.364a9 9 0 0 0 0-12.728",
|
|
728
731
|
key: "ijwkga"
|
|
729
732
|
}]
|
|
730
|
-
]),
|
|
733
|
+
]), $e = Ke("volume-x", [
|
|
731
734
|
["path", {
|
|
732
735
|
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",
|
|
733
736
|
key: "uqj9uw"
|
|
@@ -746,22 +749,22 @@ var je = ["aria-hidden"], Me = [
|
|
|
746
749
|
y2: "15",
|
|
747
750
|
key: "5ykzw1"
|
|
748
751
|
}]
|
|
749
|
-
]),
|
|
752
|
+
]), et = {
|
|
750
753
|
401: "Authentication required",
|
|
751
754
|
403: "Access forbidden",
|
|
752
755
|
404: "Preview not found",
|
|
753
756
|
419: "Session expired",
|
|
754
757
|
500: "Server error"
|
|
755
758
|
};
|
|
756
|
-
function
|
|
759
|
+
function tt(e) {
|
|
757
760
|
return e.match(/\/demo-errors\/(401|403|404|419|500)\//)?.[1] ?? "Error";
|
|
758
761
|
}
|
|
759
|
-
function
|
|
760
|
-
return
|
|
762
|
+
function nt(e) {
|
|
763
|
+
return et[tt(e)] ?? "Preview unavailable";
|
|
761
764
|
}
|
|
762
765
|
//#endregion
|
|
763
766
|
//#region src/components/CardRegion.vue
|
|
764
|
-
var
|
|
767
|
+
var rt = /* @__PURE__ */ d({
|
|
765
768
|
__name: "CardRegion",
|
|
766
769
|
props: {
|
|
767
770
|
index: {},
|
|
@@ -776,7 +779,7 @@ var nt = /* @__PURE__ */ d({
|
|
|
776
779
|
total: {}
|
|
777
780
|
},
|
|
778
781
|
setup(e) {
|
|
779
|
-
let t = e, n = r(() =>
|
|
782
|
+
let t = e, n = r(() => H(t.item, t.mediaIndex)), i = r(() => V(t.item)), o = r(() => U(t.item, n.value)), c = r(() => ({
|
|
780
783
|
height: `${t.region.height}px`,
|
|
781
784
|
paddingBlock: t.style?.paddingY === void 0 ? void 0 : `${t.style.paddingY}px`,
|
|
782
785
|
paddingInline: t.style?.paddingX === void 0 ? void 0 : `${t.style.paddingX}px`
|
|
@@ -808,7 +811,7 @@ var nt = /* @__PURE__ */ d({
|
|
|
808
811
|
"total"
|
|
809
812
|
]))], 38));
|
|
810
813
|
}
|
|
811
|
-
}),
|
|
814
|
+
}), it = ["aria-busy", "aria-label"], at = { class: "media-error-code" }, ot = ["disabled"], st = /* @__PURE__ */ d({
|
|
812
815
|
__name: "MediaError",
|
|
813
816
|
props: {
|
|
814
817
|
component: {},
|
|
@@ -843,7 +846,7 @@ var nt = /* @__PURE__ */ d({
|
|
|
843
846
|
"retrying",
|
|
844
847
|
"status"
|
|
845
848
|
]))], 32)) : (b(), s(e, { key: 1 }, [
|
|
846
|
-
c("strong",
|
|
849
|
+
c("strong", at, T(t.status), 1),
|
|
847
850
|
c("span", null, T(t.label), 1),
|
|
848
851
|
c("button", {
|
|
849
852
|
"data-test": "media-retry",
|
|
@@ -852,26 +855,26 @@ var nt = /* @__PURE__ */ d({
|
|
|
852
855
|
disabled: t.retrying,
|
|
853
856
|
onClick: j(o, ["stop"]),
|
|
854
857
|
onKeydown: r[2] ||= j(() => {}, ["stop"])
|
|
855
|
-
}, T(t.retrying ? "Retrying…" : "Retry"), 41,
|
|
856
|
-
], 64))], 8,
|
|
858
|
+
}, T(t.retrying ? "Retrying…" : "Retry"), 41, ot)
|
|
859
|
+
], 64))], 8, it));
|
|
857
860
|
}
|
|
858
|
-
}),
|
|
861
|
+
}), ct = ["aria-label"], lt = [
|
|
859
862
|
"max",
|
|
860
863
|
"value",
|
|
861
864
|
"aria-label",
|
|
862
865
|
"aria-valuetext",
|
|
863
866
|
"disabled"
|
|
864
|
-
],
|
|
867
|
+
], ut = {
|
|
865
868
|
key: 0,
|
|
866
869
|
class: "media-controls-row"
|
|
867
|
-
},
|
|
870
|
+
}, dt = ["aria-label", "title"], ft = { class: "media-controls-audio" }, pt = ["aria-label", "title"], mt = [
|
|
868
871
|
"value",
|
|
869
872
|
"aria-label",
|
|
870
873
|
"aria-valuetext"
|
|
871
|
-
],
|
|
874
|
+
], ht = {
|
|
872
875
|
class: "media-control-time",
|
|
873
876
|
"aria-live": "off"
|
|
874
|
-
},
|
|
877
|
+
}, gt = /* @__PURE__ */ d({
|
|
875
878
|
__name: "MediaControls",
|
|
876
879
|
props: {
|
|
877
880
|
currentTime: {},
|
|
@@ -921,35 +924,35 @@ var nt = /* @__PURE__ */ d({
|
|
|
921
924
|
"aria-valuetext": `${u(g.value)} of ${u(f.value)}`,
|
|
922
925
|
disabled: f.value <= 0,
|
|
923
926
|
onInput: n[0] ||= (e) => i("seek", d(e))
|
|
924
|
-
}, null, 44,
|
|
927
|
+
}, null, 44, lt), e.layout === "reel" ? (b(), s("div", ut, [
|
|
925
928
|
c("button", {
|
|
926
929
|
type: "button",
|
|
927
930
|
class: "media-control-button media-control-playback",
|
|
928
931
|
"aria-label": e.playing ? `Pause ${p.value}` : `Play ${p.value}`,
|
|
929
932
|
title: e.playing ? "Pause" : "Play",
|
|
930
933
|
onClick: n[1] ||= (e) => i("togglePlayback")
|
|
931
|
-
}, [e.playing ? (b(), a(E(
|
|
934
|
+
}, [e.playing ? (b(), a(E(Xe), {
|
|
932
935
|
key: 0,
|
|
933
936
|
size: 18,
|
|
934
937
|
fill: "currentColor"
|
|
935
|
-
})) : (b(), a(E(
|
|
938
|
+
})) : (b(), a(E(Ze), {
|
|
936
939
|
key: 1,
|
|
937
940
|
size: 18,
|
|
938
941
|
fill: "currentColor"
|
|
939
|
-
}))], 8,
|
|
940
|
-
c("div",
|
|
942
|
+
}))], 8, dt),
|
|
943
|
+
c("div", ft, [c("button", {
|
|
941
944
|
type: "button",
|
|
942
945
|
class: "media-control-button",
|
|
943
946
|
"aria-label": e.muted ? `Unmute ${p.value}` : `Mute ${p.value}`,
|
|
944
947
|
title: e.muted ? "Unmute" : "Mute",
|
|
945
948
|
onClick: n[2] ||= (e) => i("toggleMute")
|
|
946
|
-
}, [e.muted || e.volume === 0 ? (b(), a(E(
|
|
949
|
+
}, [e.muted || e.volume === 0 ? (b(), a(E($e), {
|
|
947
950
|
key: 0,
|
|
948
951
|
size: 18
|
|
949
|
-
})) : (b(), a(E(
|
|
952
|
+
})) : (b(), a(E(Qe), {
|
|
950
953
|
key: 1,
|
|
951
954
|
size: 18
|
|
952
|
-
}))], 8,
|
|
955
|
+
}))], 8, pt), c("input", {
|
|
953
956
|
class: "media-control-range media-control-volume",
|
|
954
957
|
type: "range",
|
|
955
958
|
min: "0",
|
|
@@ -960,15 +963,15 @@ var nt = /* @__PURE__ */ d({
|
|
|
960
963
|
"aria-label": `${m.value} volume`,
|
|
961
964
|
"aria-valuetext": `${Math.round(e.volume * 100)} percent`,
|
|
962
965
|
onInput: n[3] ||= (e) => i("volumeChange", d(e))
|
|
963
|
-
}, null, 44,
|
|
964
|
-
c("output",
|
|
965
|
-
])) : o("", !0)], 42,
|
|
966
|
+
}, null, 44, mt)]),
|
|
967
|
+
c("output", ht, T(u(g.value)) + " / " + T(u(f.value)), 1)
|
|
968
|
+
])) : o("", !0)], 42, ct));
|
|
966
969
|
}
|
|
967
|
-
}),
|
|
970
|
+
}), _t = {
|
|
968
971
|
key: 0,
|
|
969
972
|
class: "media-card-overlay-host",
|
|
970
973
|
"data-test": "media-card-overlay"
|
|
971
|
-
},
|
|
974
|
+
}, vt = /* @__PURE__ */ d({
|
|
972
975
|
__name: "MediaContextOverlay",
|
|
973
976
|
props: {
|
|
974
977
|
item: {},
|
|
@@ -978,7 +981,7 @@ var nt = /* @__PURE__ */ d({
|
|
|
978
981
|
mediaSource: {}
|
|
979
982
|
},
|
|
980
983
|
setup(e) {
|
|
981
|
-
return (t, n) => e.mediaCard?.overlay?.component ? (b(), s("div",
|
|
984
|
+
return (t, n) => e.mediaCard?.overlay?.component ? (b(), s("div", _t, [(b(), a(C(e.mediaCard.overlay.component), {
|
|
982
985
|
item: e.item,
|
|
983
986
|
"media-index": e.mediaIndex,
|
|
984
987
|
"media-item": e.mediaItem,
|
|
@@ -990,26 +993,26 @@ var nt = /* @__PURE__ */ d({
|
|
|
990
993
|
"media-source"
|
|
991
994
|
]))])) : o("", !0);
|
|
992
995
|
}
|
|
993
|
-
}),
|
|
994
|
-
function
|
|
996
|
+
}), yt = 40, bt = 160, xt = 24;
|
|
997
|
+
function St(e) {
|
|
995
998
|
let t = w("next"), n = null, r = 0, i = !1, a = null, o = null;
|
|
996
999
|
function s(n, r) {
|
|
997
|
-
let i =
|
|
1000
|
+
let i = V(e.item()).length, a = (n + i) % i;
|
|
998
1001
|
a !== e.mediaIndex() && (t.value = n < e.mediaIndex() ? "previous" : "next", e.onChange(a), r?.detail && r.detail > 0 && r.currentTarget?.blur());
|
|
999
1002
|
}
|
|
1000
1003
|
function c() {
|
|
1001
1004
|
r = 0, i = !1, n !== null && clearTimeout(n), n = null;
|
|
1002
1005
|
}
|
|
1003
1006
|
function l() {
|
|
1004
|
-
n !== null && clearTimeout(n), n = setTimeout(c,
|
|
1007
|
+
n !== null && clearTimeout(n), n = setTimeout(c, bt);
|
|
1005
1008
|
}
|
|
1006
1009
|
function u(e, t, n) {
|
|
1007
1010
|
return t === 1 ? e * 16 : t === 2 ? e * n : e;
|
|
1008
1011
|
}
|
|
1009
1012
|
function d(t) {
|
|
1010
|
-
if (
|
|
1013
|
+
if (V(e.item()).length <= 1) return;
|
|
1011
1014
|
let n = t.currentTarget, a = u(t.deltaX, t.deltaMode, n?.clientWidth || 1);
|
|
1012
|
-
if (a === 0 || (t.preventDefault(), l(), i) || (r += a, Math.abs(r) <
|
|
1015
|
+
if (a === 0 || (t.preventDefault(), l(), i) || (r += a, Math.abs(r) < xt)) return;
|
|
1013
1016
|
let o = Math.sign(r);
|
|
1014
1017
|
r = 0, i = !0, s(e.mediaIndex() + o);
|
|
1015
1018
|
}
|
|
@@ -1021,7 +1024,7 @@ function xt(e) {
|
|
|
1021
1024
|
let n = t.changedTouches[0];
|
|
1022
1025
|
if (a === null || o === null || !n) return;
|
|
1023
1026
|
let r = a - n.clientX, i = o - n.clientY;
|
|
1024
|
-
a = null, o = null, !(Math.abs(r) <= Math.abs(i)) && (Math.abs(r) <
|
|
1027
|
+
a = null, o = null, !(Math.abs(r) <= Math.abs(i)) && (Math.abs(r) < yt || s(e.mediaIndex() + Math.sign(r)));
|
|
1025
1028
|
}
|
|
1026
1029
|
return v(c), {
|
|
1027
1030
|
change: s,
|
|
@@ -1031,14 +1034,14 @@ function xt(e) {
|
|
|
1031
1034
|
onWheel: d
|
|
1032
1035
|
};
|
|
1033
1036
|
}
|
|
1034
|
-
var
|
|
1035
|
-
function
|
|
1037
|
+
var Ct = /* @__PURE__ */ new Map(), wt = [], Tt = 0, Et = 0;
|
|
1038
|
+
function Dt(e, t) {
|
|
1036
1039
|
return `${t ? "timed" : "image"}:${e}`;
|
|
1037
1040
|
}
|
|
1038
|
-
function
|
|
1039
|
-
let r =
|
|
1041
|
+
function Ot(e, t, n) {
|
|
1042
|
+
let r = V(e);
|
|
1040
1043
|
if (r.length < 2) return [];
|
|
1041
|
-
let i =
|
|
1044
|
+
let i = H(e, t), a = [];
|
|
1042
1045
|
for (let e = 1; e < r.length; e += 1) {
|
|
1043
1046
|
let t = i + e, n = i - e;
|
|
1044
1047
|
t < r.length && a.push(t), n >= 0 && a.push(n);
|
|
@@ -1049,7 +1052,7 @@ function Dt(e, t, n) {
|
|
|
1049
1052
|
if (!t) return [];
|
|
1050
1053
|
let i = I(t.type, t.src) === "audio" ? B(t) : z(t, n);
|
|
1051
1054
|
if (!i) return [];
|
|
1052
|
-
let a = L(i.type, i.src), s =
|
|
1055
|
+
let a = L(i.type, i.src), s = Dt(i.src, a);
|
|
1053
1056
|
return o.has(s) ? [] : (o.add(s), [{
|
|
1054
1057
|
key: s,
|
|
1055
1058
|
src: i.src,
|
|
@@ -1057,22 +1060,22 @@ function Dt(e, t, n) {
|
|
|
1057
1060
|
}]);
|
|
1058
1061
|
});
|
|
1059
1062
|
}
|
|
1060
|
-
function
|
|
1063
|
+
function kt(e) {
|
|
1061
1064
|
let t = e.element;
|
|
1062
1065
|
e.element = null, t && (t instanceof HTMLVideoElement ? (t.pause(), t.removeAttribute("src"), t.load()) : t.removeAttribute("src"));
|
|
1063
1066
|
}
|
|
1064
|
-
function kt(e) {
|
|
1065
|
-
St.delete(e.key);
|
|
1066
|
-
let t = Ct.indexOf(e);
|
|
1067
|
-
t >= 0 && Ct.splice(t, 1), e.cancel?.(), e.cancel = null, Ot(e);
|
|
1068
|
-
}
|
|
1069
1067
|
function At(e) {
|
|
1070
|
-
|
|
1068
|
+
Ct.delete(e.key);
|
|
1069
|
+
let t = wt.indexOf(e);
|
|
1070
|
+
t >= 0 && wt.splice(t, 1), e.cancel?.(), e.cancel = null, kt(e);
|
|
1071
|
+
}
|
|
1072
|
+
function jt(e) {
|
|
1073
|
+
e.state = "loading", Tt += 1, e.timed && (Et += 1);
|
|
1071
1074
|
let t = !1, n = () => void 0, r = (r) => {
|
|
1072
|
-
t || (t = !0, n(), --
|
|
1075
|
+
t || (t = !0, n(), --Tt, e.timed && --Et, e.cancel = null, e.state = r, r === "failed" && kt(e), e.refs === 0 && At(e), Mt());
|
|
1073
1076
|
};
|
|
1074
1077
|
if (e.cancel = () => {
|
|
1075
|
-
t || (t = !0, n(), --
|
|
1078
|
+
t || (t = !0, n(), --Tt, e.timed && --Et, kt(e), Mt());
|
|
1076
1079
|
}, e.timed) {
|
|
1077
1080
|
let t = document.createElement("video"), i = () => r("ready"), a = () => r("failed");
|
|
1078
1081
|
n = () => {
|
|
@@ -1091,38 +1094,38 @@ function At(e) {
|
|
|
1091
1094
|
i.removeEventListener("load", a), i.removeEventListener("error", o);
|
|
1092
1095
|
}, 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;
|
|
1093
1096
|
}
|
|
1094
|
-
function
|
|
1095
|
-
for (;
|
|
1096
|
-
let e =
|
|
1097
|
+
function Mt() {
|
|
1098
|
+
for (; Tt < 6;) {
|
|
1099
|
+
let e = wt.findIndex((e) => e.refs > 0 && e.state === "queued" && (!e.timed || Et < 2));
|
|
1097
1100
|
if (e < 0) return;
|
|
1098
|
-
let [t] =
|
|
1099
|
-
t &&
|
|
1101
|
+
let [t] = wt.splice(e, 1);
|
|
1102
|
+
t && jt(t);
|
|
1100
1103
|
}
|
|
1101
1104
|
}
|
|
1102
|
-
function
|
|
1103
|
-
let t =
|
|
1105
|
+
function Nt(e) {
|
|
1106
|
+
let t = Ct.get(e.key);
|
|
1104
1107
|
t || (t = {
|
|
1105
1108
|
...e,
|
|
1106
1109
|
cancel: null,
|
|
1107
1110
|
element: null,
|
|
1108
1111
|
refs: 0,
|
|
1109
1112
|
state: "queued"
|
|
1110
|
-
},
|
|
1113
|
+
}, Ct.set(t.key, t), wt.push(t)), t.refs += 1, Mt();
|
|
1111
1114
|
let n = !1;
|
|
1112
1115
|
return () => {
|
|
1113
|
-
n || (n = !0, --t.refs, t.refs === 0 &&
|
|
1116
|
+
n || (n = !0, --t.refs, t.refs === 0 && At(t));
|
|
1114
1117
|
};
|
|
1115
1118
|
}
|
|
1116
1119
|
//#endregion
|
|
1117
1120
|
//#region src/components/useVisiblePostPreload.ts
|
|
1118
|
-
function
|
|
1119
|
-
let t = r(() => e.layout() === "masonry" && e.inViewport() && e.mediaReady() && e.mediaCard()?.feedPreload === "visible-post"), n = r(() => t.value ?
|
|
1121
|
+
function Pt(e) {
|
|
1122
|
+
let t = r(() => e.layout() === "masonry" && e.inViewport() && e.mediaReady() && e.mediaCard()?.feedPreload === "visible-post"), n = r(() => t.value ? Ot(e.item(), e.mediaIndex(), e.mediaSource()) : []), i = /* @__PURE__ */ new Map();
|
|
1120
1123
|
function a() {
|
|
1121
1124
|
let e = new Map(n.value.map((e) => [e.key, e]));
|
|
1122
1125
|
i.forEach((t, n) => {
|
|
1123
1126
|
e.has(n) || (t(), i.delete(n));
|
|
1124
1127
|
}), n.value.forEach((e) => {
|
|
1125
|
-
i.has(e.key) || i.set(e.key,
|
|
1128
|
+
i.has(e.key) || i.set(e.key, Nt(e));
|
|
1126
1129
|
});
|
|
1127
1130
|
}
|
|
1128
1131
|
O(() => n.value.map(({ key: e }) => e).join("\n"), a, { immediate: !0 }), v(() => {
|
|
@@ -1131,7 +1134,7 @@ function Nt(e) {
|
|
|
1131
1134
|
}
|
|
1132
1135
|
//#endregion
|
|
1133
1136
|
//#region src/components/useMediaLoading.ts
|
|
1134
|
-
function
|
|
1137
|
+
function Ft(e) {
|
|
1135
1138
|
let t = r(() => L(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");
|
|
1136
1139
|
return O(i, (t, n) => {
|
|
1137
1140
|
n !== "none" || t === "none" || m(() => e.mediaElement.value?.load());
|
|
@@ -1143,57 +1146,60 @@ function Pt(e) {
|
|
|
1143
1146
|
}
|
|
1144
1147
|
//#endregion
|
|
1145
1148
|
//#region src/components/useMediaReadiness.ts
|
|
1146
|
-
function
|
|
1147
|
-
let t = w(null), n = w(null), i = w(0), a = w(0), o = w(!0), s = w(!1), c = w(!1), l = null, u = !1, d = r(() => c.value || s.value ? "error" : o.value ? "loading" : e.previewState());
|
|
1148
|
-
function
|
|
1149
|
+
function It(e) {
|
|
1150
|
+
let t = w(null), n = w(null), i = w(0), a = w(0), o = w(!0), s = w(!1), c = w(!1), l = null, u = !1, d = !1, f = !1, p = r(() => c.value || s.value ? "error" : o.value ? "loading" : e.previewState());
|
|
1151
|
+
function h() {
|
|
1149
1152
|
l !== null && clearTimeout(l), l = null;
|
|
1150
1153
|
}
|
|
1151
|
-
function
|
|
1154
|
+
function g(e) {
|
|
1152
1155
|
return Number(e.currentTarget.dataset.sourceGeneration) === i.value;
|
|
1153
1156
|
}
|
|
1154
|
-
function
|
|
1155
|
-
|
|
1157
|
+
function _() {
|
|
1158
|
+
h(), l = setTimeout(() => x(), 15e3);
|
|
1156
1159
|
}
|
|
1157
|
-
function
|
|
1158
|
-
t && !
|
|
1160
|
+
function y(t) {
|
|
1161
|
+
t && !g(t) || (h(), o.value = !1, s.value = !1, c.value = !1, e.onReady(e.mediaIndex()));
|
|
1159
1162
|
}
|
|
1160
|
-
function
|
|
1163
|
+
function b() {
|
|
1164
|
+
if (f) return;
|
|
1161
1165
|
let e = t.value;
|
|
1162
1166
|
if (e?.complete) {
|
|
1163
|
-
e.naturalWidth > 0 ?
|
|
1167
|
+
e.naturalWidth > 0 ? y() : x(void 0, !0);
|
|
1164
1168
|
return;
|
|
1165
1169
|
}
|
|
1166
1170
|
let r = n.value;
|
|
1167
1171
|
if (r && r.readyState >= HTMLMediaElement.HAVE_METADATA) {
|
|
1168
|
-
|
|
1172
|
+
y();
|
|
1169
1173
|
return;
|
|
1170
1174
|
}
|
|
1171
|
-
|
|
1175
|
+
_();
|
|
1172
1176
|
}
|
|
1173
|
-
function
|
|
1174
|
-
if (!(t && !
|
|
1175
|
-
if (
|
|
1176
|
-
a.value = 1, i.value += 1, o.value = !0, m(
|
|
1177
|
+
function x(t, n = !1) {
|
|
1178
|
+
if (!f && !(t && !g(t)) && !(s.value && !c.value && (!t || d))) {
|
|
1179
|
+
if (h(), !t && a.value === 0) {
|
|
1180
|
+
a.value = 1, i.value += 1, o.value = !0, m(b);
|
|
1177
1181
|
return;
|
|
1178
1182
|
}
|
|
1179
|
-
o.value = !1, s.value = !0, c.value = !1, e.onError(e.mediaIndex());
|
|
1183
|
+
o.value = !1, s.value = !0, c.value = !1, d = !!t || n, e.onError(e.mediaIndex(), d);
|
|
1180
1184
|
}
|
|
1181
1185
|
}
|
|
1182
|
-
function
|
|
1183
|
-
c.value ||
|
|
1186
|
+
function S() {
|
|
1187
|
+
c.value || p.value !== "error" || (d = !1, a.value = 0, s.value = !0, o.value = !0, c.value = !0, i.value += 1, m(b));
|
|
1184
1188
|
}
|
|
1185
|
-
function
|
|
1186
|
-
|
|
1189
|
+
function C(e) {
|
|
1190
|
+
g(e) && o.value && _();
|
|
1187
1191
|
}
|
|
1188
1192
|
return O(e.identity, () => {
|
|
1189
|
-
|
|
1190
|
-
}, { immediate: !0 }), v(
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
+
h(), i.value += 1, d = !1, a.value = 0, o.value = u || e.previewState() === "loading", s.value = !1, c.value = !1, u = !0, m(b);
|
|
1194
|
+
}, { immediate: !0 }), v(() => {
|
|
1195
|
+
f = !0, h();
|
|
1196
|
+
}), {
|
|
1197
|
+
effectivePreviewState: p,
|
|
1198
|
+
failSourceAttempt: x,
|
|
1193
1199
|
imageElement: t,
|
|
1194
|
-
markSourceReady:
|
|
1195
|
-
noteSourceActivity:
|
|
1196
|
-
retrySource:
|
|
1200
|
+
markSourceReady: y,
|
|
1201
|
+
noteSourceActivity: C,
|
|
1202
|
+
retrySource: S,
|
|
1197
1203
|
retrying: c,
|
|
1198
1204
|
sourceGeneration: i,
|
|
1199
1205
|
mediaElement: n
|
|
@@ -1201,30 +1207,30 @@ function Ft(e) {
|
|
|
1201
1207
|
}
|
|
1202
1208
|
//#endregion
|
|
1203
1209
|
//#region src/core/reelAudio.ts
|
|
1204
|
-
var
|
|
1210
|
+
var Lt = {
|
|
1205
1211
|
lastAudibleVolume: 1,
|
|
1206
1212
|
muted: !1,
|
|
1207
1213
|
volume: 1
|
|
1208
1214
|
};
|
|
1209
|
-
function
|
|
1215
|
+
function Rt(e, t) {
|
|
1210
1216
|
return typeof e == "number" && Number.isFinite(e) ? Math.min(1, Math.max(0, e)) : t;
|
|
1211
1217
|
}
|
|
1212
|
-
function
|
|
1213
|
-
let n =
|
|
1218
|
+
function zt(e, t = Lt) {
|
|
1219
|
+
let n = Rt(e?.volume, t.volume), r = Rt(e?.lastAudibleVolume, n > 0 ? n : t.lastAudibleVolume);
|
|
1214
1220
|
return {
|
|
1215
|
-
lastAudibleVolume: r > 0 ? r :
|
|
1221
|
+
lastAudibleVolume: r > 0 ? r : Lt.lastAudibleVolume,
|
|
1216
1222
|
muted: typeof e?.muted == "boolean" ? e.muted : n === 0 || t.muted,
|
|
1217
1223
|
volume: n
|
|
1218
1224
|
};
|
|
1219
1225
|
}
|
|
1220
1226
|
//#endregion
|
|
1221
1227
|
//#region src/components/useMediaCardAudio.ts
|
|
1222
|
-
function
|
|
1223
|
-
let t =
|
|
1228
|
+
function Bt(e) {
|
|
1229
|
+
let t = zt(e.reelAudioState()), n = e.layout() === "reel" && e.reelAudioState(), r = w(n ? t.muted : e.mediaCard()?.videoMuted ?? e.layout() === "masonry"), i = w(n ? t.volume : 1), a = n ? t.lastAudibleVolume : 1;
|
|
1224
1230
|
function o() {
|
|
1225
1231
|
let t = e.mediaElement.value, n = e.reelAudioState();
|
|
1226
1232
|
if (!t || e.layout() !== "reel" || !n) return;
|
|
1227
|
-
let o =
|
|
1233
|
+
let o = zt(n);
|
|
1228
1234
|
a = o.lastAudibleVolume, i.value = o.volume, r.value = o.muted, t.volume = o.volume, t.muted = e.active() === !1 ? !0 : o.muted;
|
|
1229
1235
|
}
|
|
1230
1236
|
function s(e, t) {
|
|
@@ -1232,7 +1238,7 @@ function zt(e) {
|
|
|
1232
1238
|
}
|
|
1233
1239
|
function c(t) {
|
|
1234
1240
|
if (e.layout() !== "reel") return;
|
|
1235
|
-
let n =
|
|
1241
|
+
let n = zt({
|
|
1236
1242
|
lastAudibleVolume: a,
|
|
1237
1243
|
muted: t.muted,
|
|
1238
1244
|
volume: t.volume
|
|
@@ -1267,7 +1273,7 @@ function zt(e) {
|
|
|
1267
1273
|
}
|
|
1268
1274
|
//#endregion
|
|
1269
1275
|
//#region src/components/useReelVideoActivity.ts
|
|
1270
|
-
function
|
|
1276
|
+
function Vt(e) {
|
|
1271
1277
|
let t = r(() => e.layout() === "reel" ? e.active() === !0 : e.inViewport()), n = r(() => t.value ? e.mediaIsMuted.value : !0);
|
|
1272
1278
|
function i() {
|
|
1273
1279
|
if (!t.value) {
|
|
@@ -1301,18 +1307,18 @@ function Bt(e) {
|
|
|
1301
1307
|
}
|
|
1302
1308
|
//#endregion
|
|
1303
1309
|
//#region src/components/useTimedMediaCard.ts
|
|
1304
|
-
function
|
|
1310
|
+
function Ht(e) {
|
|
1305
1311
|
return Number.isFinite(e) ? Math.max(0, e) : 0;
|
|
1306
1312
|
}
|
|
1307
|
-
function
|
|
1308
|
-
let t = w(0), n = w(0), r = w(!1), { apply: i, setVolume: a, sync: o, toggleMute: s, videoIsMuted: c, videoVolume: l } =
|
|
1313
|
+
function Ut(e) {
|
|
1314
|
+
let t = w(0), n = w(0), r = w(!1), { apply: i, setVolume: a, sync: o, toggleMute: s, videoIsMuted: c, videoVolume: l } = Bt({
|
|
1309
1315
|
active: e.active,
|
|
1310
1316
|
layout: e.layout,
|
|
1311
1317
|
mediaCard: e.mediaCard,
|
|
1312
1318
|
mediaElement: e.mediaElement,
|
|
1313
1319
|
onChange: e.onAudioChange,
|
|
1314
1320
|
reelAudioState: e.reelAudioState
|
|
1315
|
-
}), { effectiveMuted: u, onPlaying: d, playbackAllowed: f } =
|
|
1321
|
+
}), { effectiveMuted: u, onPlaying: d, playbackAllowed: f } = Vt({
|
|
1316
1322
|
active: e.active,
|
|
1317
1323
|
inViewport: e.inViewport,
|
|
1318
1324
|
layout: e.layout,
|
|
@@ -1322,7 +1328,7 @@ function Ht(e) {
|
|
|
1322
1328
|
});
|
|
1323
1329
|
function p(r) {
|
|
1324
1330
|
let i = r?.currentTarget ?? e.mediaElement.value;
|
|
1325
|
-
i && (t.value =
|
|
1331
|
+
i && (t.value = Ht(i.currentTime), n.value = Ht(i.duration), o(i, f.value));
|
|
1326
1332
|
}
|
|
1327
1333
|
function m(t) {
|
|
1328
1334
|
i(), p(t), e.onReady(t);
|
|
@@ -1332,7 +1338,7 @@ function Ht(e) {
|
|
|
1332
1338
|
}
|
|
1333
1339
|
function g(n) {
|
|
1334
1340
|
let r = e.mediaElement.value;
|
|
1335
|
-
!r || !Number.isFinite(n) || (r.currentTime = Math.min(
|
|
1341
|
+
!r || !Number.isFinite(n) || (r.currentTime = Math.min(Ht(r.duration), Math.max(0, n)), t.value = r.currentTime);
|
|
1336
1342
|
}
|
|
1337
1343
|
async function _() {
|
|
1338
1344
|
let t = e.mediaElement.value;
|
|
@@ -1370,7 +1376,7 @@ function Ht(e) {
|
|
|
1370
1376
|
}
|
|
1371
1377
|
//#endregion
|
|
1372
1378
|
//#region src/components/MediaCard.vue?vue&type=script&setup=true&lang.ts
|
|
1373
|
-
var
|
|
1379
|
+
var Wt = [
|
|
1374
1380
|
"data-post-id",
|
|
1375
1381
|
"data-media-index",
|
|
1376
1382
|
"aria-hidden",
|
|
@@ -1378,29 +1384,31 @@ var Ut = [
|
|
|
1378
1384
|
"inert",
|
|
1379
1385
|
"role",
|
|
1380
1386
|
"tabindex"
|
|
1381
|
-
],
|
|
1387
|
+
], Gt = { class: "media-card-content" }, Kt = ["data-media-direction"], qt = ["data-media-index"], Jt = {
|
|
1382
1388
|
key: 0,
|
|
1383
1389
|
"data-test": "media-loading",
|
|
1384
1390
|
class: "media-loading",
|
|
1385
1391
|
"aria-hidden": "true"
|
|
1386
|
-
},
|
|
1392
|
+
}, Yt = [
|
|
1387
1393
|
"data-source-generation",
|
|
1388
1394
|
"src",
|
|
1389
1395
|
"autoplay",
|
|
1390
1396
|
"loop",
|
|
1391
1397
|
"muted",
|
|
1392
1398
|
"preload"
|
|
1393
|
-
],
|
|
1399
|
+
], Xt = ["aria-label", "disabled"], Zt = [
|
|
1400
|
+
"data-cover-identity",
|
|
1401
|
+
"data-source-generation",
|
|
1394
1402
|
"src",
|
|
1395
1403
|
"width",
|
|
1396
1404
|
"height",
|
|
1397
1405
|
"fetchpriority",
|
|
1398
1406
|
"loading"
|
|
1399
|
-
],
|
|
1407
|
+
], Qt = {
|
|
1400
1408
|
key: 1,
|
|
1401
1409
|
class: "media-audio-fallback",
|
|
1402
1410
|
"aria-hidden": "true"
|
|
1403
|
-
},
|
|
1411
|
+
}, $t = [
|
|
1404
1412
|
"data-source-generation",
|
|
1405
1413
|
"src",
|
|
1406
1414
|
"width",
|
|
@@ -1409,14 +1417,14 @@ var Ut = [
|
|
|
1409
1417
|
"loop",
|
|
1410
1418
|
"muted",
|
|
1411
1419
|
"preload"
|
|
1412
|
-
],
|
|
1420
|
+
], en = [
|
|
1413
1421
|
"data-source-generation",
|
|
1414
1422
|
"src",
|
|
1415
1423
|
"width",
|
|
1416
1424
|
"height",
|
|
1417
1425
|
"fetchpriority",
|
|
1418
1426
|
"loading"
|
|
1419
|
-
],
|
|
1427
|
+
], tn = ["aria-label"], nn = ["aria-label"], rn = ["aria-label"], an = /* @__PURE__ */ d({
|
|
1420
1428
|
__name: "MediaCard",
|
|
1421
1429
|
props: {
|
|
1422
1430
|
active: { type: Boolean },
|
|
@@ -1446,6 +1454,7 @@ var Ut = [
|
|
|
1446
1454
|
"activate",
|
|
1447
1455
|
"ended",
|
|
1448
1456
|
"error",
|
|
1457
|
+
"mediaError",
|
|
1449
1458
|
"mediaChange",
|
|
1450
1459
|
"ready",
|
|
1451
1460
|
"reelAudioChange"
|
|
@@ -1455,14 +1464,22 @@ var Ut = [
|
|
|
1455
1464
|
function f(e = !1, t = "pointer") {
|
|
1456
1465
|
e && d("activate", t);
|
|
1457
1466
|
}
|
|
1458
|
-
let p = r(() =>
|
|
1467
|
+
let p = r(() => V(l.item)), g = r(() => H(l.item, l.mediaIndex)), v = r(() => U(l.item, g.value)), y = r(() => z(v.value, l.mediaSource ?? "preview")), x = r(() => I(v.value.type, v.value.src)), S = r(() => x.value === "audio"), C = r(() => ee(v.value, l.mediaSource ?? "preview")), T = r(() => S.value ? C.value : y.value), D = r(() => T.value.src), M = r(() => I(T.value.type, T.value.src)), N = r(() => y.value.width), P = r(() => y.value.height), F = r(() => B(v.value)), L = r(() => `${l.item.postId}:${g.value}:${F.value?.src ?? ""}`), R = w(!1), W = r(() => R.value ? null : F.value), { effectivePreviewState: G, failSourceAttempt: K, imageElement: te, markSourceReady: q, noteSourceActivity: J, retrySource: ne, retrying: re, sourceGeneration: ie, mediaElement: ae } = It({
|
|
1459
1468
|
identity: () => `${l.item.postId}:${g.value}:${l.mediaSource ?? "preview"}:${D.value}:${M.value ?? ""}`,
|
|
1460
1469
|
mediaIndex: () => g.value,
|
|
1461
|
-
onError: (e) =>
|
|
1470
|
+
onError: (e, t) => {
|
|
1471
|
+
if (d("error", e), !t) return;
|
|
1472
|
+
let n = l.mediaSource ?? "preview";
|
|
1473
|
+
d("mediaError", {
|
|
1474
|
+
mediaIndex: e,
|
|
1475
|
+
source: n === "preview" && !S.value && v.value.preview ? "preview" : n === "mobile" && D.value === v.value.mobile?.src ? "mobile" : "original",
|
|
1476
|
+
src: D.value
|
|
1477
|
+
});
|
|
1478
|
+
},
|
|
1462
1479
|
onReady: (e) => d("ready", e),
|
|
1463
1480
|
previewState: () => l.previewState
|
|
1464
1481
|
});
|
|
1465
|
-
|
|
1482
|
+
Pt({
|
|
1466
1483
|
inViewport: () => l.inViewport === !0,
|
|
1467
1484
|
item: () => l.item,
|
|
1468
1485
|
layout: () => l.layout,
|
|
@@ -1471,47 +1488,51 @@ var Ut = [
|
|
|
1471
1488
|
mediaReady: () => G.value === "ready",
|
|
1472
1489
|
mediaSource: () => l.mediaSource ?? "preview"
|
|
1473
1490
|
});
|
|
1474
|
-
let { currentTime:
|
|
1491
|
+
let { currentTime: oe, duration: se, effectiveMuted: ce, isMuted: le, isPlaying: Y, onEnded: X, onLoadedMetadata: Z, onPlaying: ue, playbackAllowed: de, seek: fe, setVolume: pe, sync: Q, toggleMute: me, togglePlayback: he, volume: ge } = Ut({
|
|
1475
1492
|
active: () => l.active,
|
|
1476
1493
|
inViewport: () => l.inViewport === !0,
|
|
1477
1494
|
layout: () => l.layout,
|
|
1478
1495
|
mediaCard: () => l.mediaCard,
|
|
1479
|
-
mediaElement:
|
|
1496
|
+
mediaElement: ae,
|
|
1480
1497
|
onAudioChange: (e) => d("reelAudioChange", e),
|
|
1481
1498
|
onEnded: () => d("ended", g.value),
|
|
1482
|
-
onReady:
|
|
1499
|
+
onReady: q,
|
|
1483
1500
|
reelAudioState: () => l.reelAudioState
|
|
1484
|
-
}),
|
|
1485
|
-
function
|
|
1501
|
+
}), _e = r(() => l.interactive && !!(l.cardHeader || l.cardFooter));
|
|
1502
|
+
function ve(e) {
|
|
1486
1503
|
return e.detail === 0 ? "keyboard" : "pointer";
|
|
1487
1504
|
}
|
|
1488
|
-
let { change:
|
|
1505
|
+
let { change: ye, direction: be, onTouchEnd: xe, onTouchStart: Se, onWheel: Ce } = St({
|
|
1489
1506
|
item: () => l.item,
|
|
1490
1507
|
layout: () => l.layout,
|
|
1491
1508
|
mediaIndex: () => g.value,
|
|
1492
1509
|
onChange: (e) => d("mediaChange", e)
|
|
1493
|
-
}), { imageLoading:
|
|
1510
|
+
}), { imageLoading: we, mediaIsTimed: Te, timedMediaPreload: Ee } = Ft({
|
|
1494
1511
|
active: () => l.active,
|
|
1495
1512
|
fetchPriority: () => l.fetchPriority,
|
|
1496
1513
|
layout: () => l.layout,
|
|
1497
1514
|
mediaSource: () => D.value,
|
|
1498
1515
|
mediaType: () => M.value,
|
|
1499
|
-
mediaElement:
|
|
1500
|
-
}),
|
|
1501
|
-
function
|
|
1502
|
-
l.layout === "reel" && (e.stopPropagation(),
|
|
1516
|
+
mediaElement: ae
|
|
1517
|
+
}), De = r(() => l.layout === "reel" && l.stationaryReelControls === !0), Oe = r(() => Te.value && (!S.value || l.layout === "reel") && G.value === "ready" && (!De.value || !!(l.active && l.reelControlsTarget))), ke = r(() => `${l.item.postId}:${g.value}:${D.value}`);
|
|
1518
|
+
function Ae(e) {
|
|
1519
|
+
l.layout === "reel" && (e.stopPropagation(), he());
|
|
1503
1520
|
}
|
|
1504
|
-
function
|
|
1505
|
-
L.value
|
|
1521
|
+
function je(e) {
|
|
1522
|
+
e.currentTarget.dataset.coverIdentity !== L.value || R.value || (d("mediaError", {
|
|
1523
|
+
mediaIndex: g.value,
|
|
1524
|
+
source: "preview",
|
|
1525
|
+
src: F.value?.src ?? ""
|
|
1526
|
+
}), R.value = !0, l.layout === "masonry" && q());
|
|
1506
1527
|
}
|
|
1507
|
-
return O(
|
|
1508
|
-
|
|
1528
|
+
return O(L, () => {
|
|
1529
|
+
R.value = !1;
|
|
1509
1530
|
}), O([
|
|
1510
1531
|
S,
|
|
1511
1532
|
() => l.layout,
|
|
1512
|
-
|
|
1533
|
+
W
|
|
1513
1534
|
], ([e, t, n]) => {
|
|
1514
|
-
e && t === "masonry" && !n && m(() =>
|
|
1535
|
+
e && t === "masonry" && !n && m(() => q());
|
|
1515
1536
|
}, { immediate: !0 }), (r, i) => (b(), s("article", {
|
|
1516
1537
|
"data-post-id": e.item.postId,
|
|
1517
1538
|
"data-media-index": g.value,
|
|
@@ -1523,14 +1544,14 @@ var Ut = [
|
|
|
1523
1544
|
}]),
|
|
1524
1545
|
style: _(e.itemStyle),
|
|
1525
1546
|
"aria-hidden": e.leaving || void 0,
|
|
1526
|
-
"aria-busy": E(G) === "loading" || E(
|
|
1547
|
+
"aria-busy": E(G) === "loading" || E(re),
|
|
1527
1548
|
inert: e.leaving || void 0,
|
|
1528
|
-
role: e.interactive && !e.leaving && !
|
|
1529
|
-
tabindex: e.interactive && !e.leaving && !
|
|
1530
|
-
onClick: i[34] ||= (t) => f(e.interactive && !
|
|
1531
|
-
onKeydown: [i[35] ||= A((t) => f(e.interactive && !
|
|
1532
|
-
}, [c("div",
|
|
1533
|
-
e.cardHeader ? (b(), a(
|
|
1549
|
+
role: e.interactive && !e.leaving && !_e.value ? "button" : void 0,
|
|
1550
|
+
tabindex: e.interactive && !e.leaving && !_e.value ? 0 : void 0,
|
|
1551
|
+
onClick: i[34] ||= (t) => f(e.interactive && !_e.value, ve(t)),
|
|
1552
|
+
onKeydown: [i[35] ||= A((t) => f(e.interactive && !_e.value, "keyboard"), ["enter"]), i[36] ||= A(j((t) => f(e.interactive && !_e.value, "keyboard"), ["prevent"]), ["space"])]
|
|
1553
|
+
}, [c("div", Gt, [
|
|
1554
|
+
e.cardHeader ? (b(), a(rt, {
|
|
1534
1555
|
key: 0,
|
|
1535
1556
|
index: e.index,
|
|
1536
1557
|
item: e.item,
|
|
@@ -1555,27 +1576,27 @@ var Ut = [
|
|
|
1555
1576
|
])) : o("", !0),
|
|
1556
1577
|
c("div", {
|
|
1557
1578
|
class: h(["media-card-media", { "media-card-media--carousel": e.layout === "reel" && p.value.length > 1 }]),
|
|
1558
|
-
"data-media-direction": E(
|
|
1559
|
-
onWheel: i[31] ||= (...e) => E(
|
|
1560
|
-
onTouchstartPassive: i[32] ||= (...e) => E(
|
|
1561
|
-
onTouchendPassive: i[33] ||= (...e) => E(
|
|
1579
|
+
"data-media-direction": E(be),
|
|
1580
|
+
onWheel: i[31] ||= (...e) => E(Ce) && E(Ce)(...e),
|
|
1581
|
+
onTouchstartPassive: i[32] ||= (...e) => E(Se) && E(Se)(...e),
|
|
1582
|
+
onTouchendPassive: i[33] ||= (...e) => E(xe) && E(xe)(...e)
|
|
1562
1583
|
}, [
|
|
1563
1584
|
u(n, {
|
|
1564
|
-
css: !E(
|
|
1565
|
-
name: `media-slide-${E(
|
|
1585
|
+
css: !E(re),
|
|
1586
|
+
name: `media-slide-${E(be)}`
|
|
1566
1587
|
}, {
|
|
1567
1588
|
default: k(() => [(b(), s("div", {
|
|
1568
|
-
key: `${e.item.postId}:${v.value.src}:${e.mediaSource ?? "preview"}:${E(
|
|
1589
|
+
key: `${e.item.postId}:${v.value.src}:${e.mediaSource ?? "preview"}:${E(ie)}`,
|
|
1569
1590
|
class: "media-card-frame",
|
|
1570
1591
|
"data-media-index": g.value
|
|
1571
1592
|
}, [
|
|
1572
|
-
E(G) === "loading" ? (b(), s("div",
|
|
1593
|
+
E(G) === "loading" ? (b(), s("div", Jt, [...i[37] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : E(G) === "error" ? (b(), a(st, {
|
|
1573
1594
|
key: 1,
|
|
1574
1595
|
component: e.mediaCard?.error?.component,
|
|
1575
|
-
label: E(
|
|
1576
|
-
retrying: E(
|
|
1577
|
-
status: E(
|
|
1578
|
-
onRetry: E(
|
|
1596
|
+
label: E(nt)(D.value),
|
|
1597
|
+
retrying: E(re),
|
|
1598
|
+
status: E(tt)(D.value),
|
|
1599
|
+
onRetry: E(ne)
|
|
1579
1600
|
}, null, 8, [
|
|
1580
1601
|
"component",
|
|
1581
1602
|
"label",
|
|
@@ -1586,53 +1607,55 @@ var Ut = [
|
|
|
1586
1607
|
S.value && e.layout === "reel" ? (b(), s("audio", {
|
|
1587
1608
|
key: 2,
|
|
1588
1609
|
ref_key: "mediaElement",
|
|
1589
|
-
ref:
|
|
1590
|
-
"data-source-generation": E(
|
|
1610
|
+
ref: ae,
|
|
1611
|
+
"data-source-generation": E(ie),
|
|
1591
1612
|
class: "media-audio-element",
|
|
1592
1613
|
src: D.value,
|
|
1593
|
-
autoplay: E(
|
|
1614
|
+
autoplay: E(de),
|
|
1594
1615
|
loop: !e.advanceOnMediaEnd,
|
|
1595
|
-
muted: E(
|
|
1596
|
-
preload: E(
|
|
1616
|
+
muted: E(ce),
|
|
1617
|
+
preload: E(Ee),
|
|
1597
1618
|
onLoadedmetadata: i[0] ||= (...e) => E(Z) && E(Z)(...e),
|
|
1598
|
-
onProgress: i[1] ||= (...e) => E(
|
|
1599
|
-
onLoadeddata: i[2] ||= (...e) => E(
|
|
1600
|
-
onCanplay: i[3] ||= (...e) => E(
|
|
1619
|
+
onProgress: i[1] ||= (...e) => E(J) && E(J)(...e),
|
|
1620
|
+
onLoadeddata: i[2] ||= (...e) => E(J) && E(J)(...e),
|
|
1621
|
+
onCanplay: i[3] ||= (...e) => E(J) && E(J)(...e),
|
|
1601
1622
|
onDurationchange: i[4] ||= (...e) => E(Q) && E(Q)(...e),
|
|
1602
1623
|
onTimeupdate: i[5] ||= (...e) => E(Q) && E(Q)(...e),
|
|
1603
1624
|
onVolumechange: i[6] ||= (...e) => E(Q) && E(Q)(...e),
|
|
1604
|
-
onPlaying: i[7] ||= (...e) => E(
|
|
1605
|
-
onPause: i[8] ||= (e) =>
|
|
1625
|
+
onPlaying: i[7] ||= (...e) => E(ue) && E(ue)(...e),
|
|
1626
|
+
onPause: i[8] ||= (e) => Y.value = !1,
|
|
1606
1627
|
onEnded: i[9] ||= (...e) => E(X) && E(X)(...e),
|
|
1607
1628
|
onError: i[10] ||= (...e) => E(K) && E(K)(...e)
|
|
1608
|
-
}, null, 40,
|
|
1629
|
+
}, null, 40, Yt)) : o("", !0),
|
|
1609
1630
|
S.value ? (b(), s("button", {
|
|
1610
1631
|
key: 3,
|
|
1611
1632
|
type: "button",
|
|
1612
1633
|
class: h(["media-audio-artwork media-preview", { "media-preview--ready": E(G) === "ready" }]),
|
|
1613
|
-
"aria-label": e.layout === "reel" ? E(
|
|
1634
|
+
"aria-label": e.layout === "reel" ? E(Y) ? "Pause audio" : "Play audio" : "Audio",
|
|
1614
1635
|
disabled: e.layout !== "reel",
|
|
1615
|
-
onClick:
|
|
1616
|
-
}, [
|
|
1617
|
-
key:
|
|
1636
|
+
onClick: Ae
|
|
1637
|
+
}, [W.value ? (b(), s("img", {
|
|
1638
|
+
key: L.value,
|
|
1639
|
+
"data-cover-identity": L.value,
|
|
1640
|
+
"data-source-generation": E(ie),
|
|
1618
1641
|
class: "media-audio-cover",
|
|
1619
|
-
src:
|
|
1620
|
-
width:
|
|
1621
|
-
height:
|
|
1642
|
+
src: W.value.src,
|
|
1643
|
+
width: W.value.width ?? void 0,
|
|
1644
|
+
height: W.value.height ?? void 0,
|
|
1622
1645
|
fetchpriority: e.fetchPriority,
|
|
1623
1646
|
alt: "",
|
|
1624
1647
|
decoding: "async",
|
|
1625
|
-
loading: E(
|
|
1626
|
-
onLoad: i[11] ||= (t) => e.layout === "masonry" && E(
|
|
1627
|
-
onError:
|
|
1628
|
-
}, null, 40,
|
|
1648
|
+
loading: E(we),
|
|
1649
|
+
onLoad: i[11] ||= (t) => e.layout === "masonry" && E(q)(t),
|
|
1650
|
+
onError: je
|
|
1651
|
+
}, null, 40, Zt)) : (b(), s("span", Qt, [u(E(Ye), {
|
|
1629
1652
|
size: 64,
|
|
1630
1653
|
"stroke-width": 1.5
|
|
1631
|
-
})]))], 10,
|
|
1654
|
+
})]))], 10, Xt)) : E(Te) ? (b(), s("video", {
|
|
1632
1655
|
key: 4,
|
|
1633
1656
|
ref_key: "mediaElement",
|
|
1634
|
-
ref:
|
|
1635
|
-
"data-source-generation": E(
|
|
1657
|
+
ref: ae,
|
|
1658
|
+
"data-source-generation": E(ie),
|
|
1636
1659
|
class: h(["media-preview", {
|
|
1637
1660
|
"media-preview--ready": E(G) === "ready",
|
|
1638
1661
|
"media-preview--reel-video": e.layout === "reel"
|
|
@@ -1640,28 +1663,28 @@ var Ut = [
|
|
|
1640
1663
|
src: D.value,
|
|
1641
1664
|
width: N.value ?? void 0,
|
|
1642
1665
|
height: P.value ?? void 0,
|
|
1643
|
-
autoplay: E(
|
|
1666
|
+
autoplay: E(de),
|
|
1644
1667
|
loop: !e.advanceOnMediaEnd,
|
|
1645
|
-
muted: E(
|
|
1668
|
+
muted: E(ce),
|
|
1646
1669
|
playsinline: "",
|
|
1647
|
-
preload: E(
|
|
1670
|
+
preload: E(Ee),
|
|
1648
1671
|
onLoadedmetadata: i[12] ||= (...e) => E(Z) && E(Z)(...e),
|
|
1649
|
-
onProgress: i[13] ||= (...e) => E(
|
|
1650
|
-
onLoadeddata: i[14] ||= (...e) => E(
|
|
1651
|
-
onCanplay: i[15] ||= (...e) => E(
|
|
1672
|
+
onProgress: i[13] ||= (...e) => E(J) && E(J)(...e),
|
|
1673
|
+
onLoadeddata: i[14] ||= (...e) => E(J) && E(J)(...e),
|
|
1674
|
+
onCanplay: i[15] ||= (...e) => E(J) && E(J)(...e),
|
|
1652
1675
|
onDurationchange: i[16] ||= (...e) => E(Q) && E(Q)(...e),
|
|
1653
1676
|
onTimeupdate: i[17] ||= (...e) => E(Q) && E(Q)(...e),
|
|
1654
1677
|
onVolumechange: i[18] ||= (...e) => E(Q) && E(Q)(...e),
|
|
1655
|
-
onPlaying: i[19] ||= (...e) => E(
|
|
1656
|
-
onPause: i[20] ||= (e) =>
|
|
1678
|
+
onPlaying: i[19] ||= (...e) => E(ue) && E(ue)(...e),
|
|
1679
|
+
onPause: i[20] ||= (e) => Y.value = !1,
|
|
1657
1680
|
onEnded: i[21] ||= (...e) => E(X) && E(X)(...e),
|
|
1658
|
-
onClick:
|
|
1681
|
+
onClick: Ae,
|
|
1659
1682
|
onError: i[22] ||= (...e) => E(K) && E(K)(...e)
|
|
1660
|
-
}, null, 42,
|
|
1683
|
+
}, null, 42, $t)) : S.value ? o("", !0) : (b(), s("img", {
|
|
1661
1684
|
key: 5,
|
|
1662
1685
|
ref_key: "imageElement",
|
|
1663
|
-
ref:
|
|
1664
|
-
"data-source-generation": E(
|
|
1686
|
+
ref: te,
|
|
1687
|
+
"data-source-generation": E(ie),
|
|
1665
1688
|
class: h(["media-preview", { "media-preview--ready": E(G) === "ready" }]),
|
|
1666
1689
|
src: D.value,
|
|
1667
1690
|
width: N.value ?? void 0,
|
|
@@ -1669,14 +1692,14 @@ var Ut = [
|
|
|
1669
1692
|
fetchpriority: e.fetchPriority,
|
|
1670
1693
|
alt: "",
|
|
1671
1694
|
decoding: "async",
|
|
1672
|
-
loading: E(
|
|
1673
|
-
onLoad: i[23] ||= (...e) => E(
|
|
1695
|
+
loading: E(we),
|
|
1696
|
+
onLoad: i[23] ||= (...e) => E(q) && E(q)(...e),
|
|
1674
1697
|
onError: i[24] ||= (...e) => E(K) && E(K)(...e)
|
|
1675
|
-
}, null, 42,
|
|
1676
|
-
], 8,
|
|
1698
|
+
}, null, 42, en))
|
|
1699
|
+
], 8, qt))]),
|
|
1677
1700
|
_: 1
|
|
1678
1701
|
}, 8, ["css", "name"]),
|
|
1679
|
-
u(
|
|
1702
|
+
u(vt, {
|
|
1680
1703
|
item: e.item,
|
|
1681
1704
|
"media-card": e.mediaCard,
|
|
1682
1705
|
"media-index": g.value,
|
|
@@ -1690,26 +1713,26 @@ var Ut = [
|
|
|
1690
1713
|
"media-source"
|
|
1691
1714
|
]),
|
|
1692
1715
|
(b(), a(t, {
|
|
1693
|
-
disabled: !
|
|
1716
|
+
disabled: !De.value || !e.reelControlsTarget,
|
|
1694
1717
|
to: e.reelControlsTarget ?? "body"
|
|
1695
1718
|
}, [u(n, {
|
|
1696
1719
|
name: "vibe-reel-media-controls",
|
|
1697
|
-
css:
|
|
1720
|
+
css: De.value
|
|
1698
1721
|
}, {
|
|
1699
|
-
default: k(() => [
|
|
1700
|
-
key:
|
|
1701
|
-
"current-time": E(
|
|
1702
|
-
"data-control-post-id":
|
|
1703
|
-
duration: E(
|
|
1722
|
+
default: k(() => [Oe.value ? (b(), a(gt, {
|
|
1723
|
+
key: ke.value,
|
|
1724
|
+
"current-time": E(oe),
|
|
1725
|
+
"data-control-post-id": De.value ? e.item.postId : void 0,
|
|
1726
|
+
duration: E(se),
|
|
1704
1727
|
layout: e.layout,
|
|
1705
1728
|
"media-type": S.value ? "audio" : "video",
|
|
1706
|
-
muted: E(
|
|
1707
|
-
playing: E(
|
|
1708
|
-
volume: E(
|
|
1709
|
-
onSeek: E(
|
|
1710
|
-
onToggleMute: E(
|
|
1711
|
-
onTogglePlayback: E(
|
|
1712
|
-
onVolumeChange: E(
|
|
1729
|
+
muted: E(le),
|
|
1730
|
+
playing: E(Y),
|
|
1731
|
+
volume: E(ge),
|
|
1732
|
+
onSeek: E(fe),
|
|
1733
|
+
onToggleMute: E(me),
|
|
1734
|
+
onTogglePlayback: E(he),
|
|
1735
|
+
onVolumeChange: E(pe)
|
|
1713
1736
|
}, null, 8, [
|
|
1714
1737
|
"current-time",
|
|
1715
1738
|
"data-control-post-id",
|
|
@@ -1734,25 +1757,25 @@ var Ut = [
|
|
|
1734
1757
|
type: "button",
|
|
1735
1758
|
class: "media-carousel-control media-carousel-control--previous",
|
|
1736
1759
|
"aria-label": `Previous media for post ${e.item.postId}`,
|
|
1737
|
-
onClick: i[25] ||= j((e) => E(
|
|
1760
|
+
onClick: i[25] ||= j((e) => E(ye)(g.value - 1, e), ["stop"]),
|
|
1738
1761
|
onKeydown: i[26] ||= j(() => {}, ["stop"])
|
|
1739
|
-
}, [u(E(
|
|
1762
|
+
}, [u(E(qe), { size: 20 })], 40, tn), c("button", {
|
|
1740
1763
|
type: "button",
|
|
1741
1764
|
class: "media-carousel-control media-carousel-control--next",
|
|
1742
1765
|
"aria-label": `Next media for post ${e.item.postId}`,
|
|
1743
|
-
onClick: i[27] ||= j((e) => E(
|
|
1766
|
+
onClick: i[27] ||= j((e) => E(ye)(g.value + 1, e), ["stop"]),
|
|
1744
1767
|
onKeydown: i[28] ||= j(() => {}, ["stop"])
|
|
1745
|
-
}, [u(E(
|
|
1746
|
-
|
|
1768
|
+
}, [u(E(Je), { size: 20 })], 40, nn)], 2)) : o("", !0),
|
|
1769
|
+
_e.value ? (b(), s("button", {
|
|
1747
1770
|
key: 1,
|
|
1748
1771
|
class: "media-card-activator",
|
|
1749
1772
|
type: "button",
|
|
1750
1773
|
"aria-label": `Open post ${e.item.postId}`,
|
|
1751
|
-
onClick: i[29] ||= j((e) => r.$emit("activate",
|
|
1774
|
+
onClick: i[29] ||= j((e) => r.$emit("activate", ve(e)), ["stop"]),
|
|
1752
1775
|
onKeydown: i[30] ||= j(() => {}, ["stop"])
|
|
1753
|
-
}, null, 40,
|
|
1754
|
-
], 42,
|
|
1755
|
-
e.cardFooter ? (b(), a(
|
|
1776
|
+
}, null, 40, rn)) : o("", !0)
|
|
1777
|
+
], 42, Kt),
|
|
1778
|
+
e.cardFooter ? (b(), a(rt, {
|
|
1756
1779
|
key: 1,
|
|
1757
1780
|
index: e.index,
|
|
1758
1781
|
item: e.item,
|
|
@@ -1775,17 +1798,17 @@ var Ut = [
|
|
|
1775
1798
|
"style",
|
|
1776
1799
|
"total"
|
|
1777
1800
|
])) : o("", !0)
|
|
1778
|
-
])], 46,
|
|
1801
|
+
])], 46, Wt));
|
|
1779
1802
|
}
|
|
1780
1803
|
});
|
|
1781
1804
|
//#endregion
|
|
1782
1805
|
//#region src/components/useMasonryMediaVisibility.ts
|
|
1783
|
-
function
|
|
1806
|
+
function on(e) {
|
|
1784
1807
|
function t(t) {
|
|
1785
1808
|
return t.flatMap((t) => {
|
|
1786
1809
|
let n = e.items()[t];
|
|
1787
1810
|
if (!n) return [];
|
|
1788
|
-
let r = e.mediaIndices().get(n.postId) ?? 0, i =
|
|
1811
|
+
let r = e.mediaIndices().get(n.postId) ?? 0, i = W(n.postId, r);
|
|
1789
1812
|
return e.previewStates().get(i) === "ready" ? [{
|
|
1790
1813
|
key: i,
|
|
1791
1814
|
mediaIndex: r,
|
|
@@ -1809,14 +1832,14 @@ function an(e) {
|
|
|
1809
1832
|
}
|
|
1810
1833
|
//#endregion
|
|
1811
1834
|
//#region src/components/useSettledMasonryFeedLayout.ts
|
|
1812
|
-
var
|
|
1813
|
-
function
|
|
1835
|
+
var sn = 1500;
|
|
1836
|
+
function cn(e) {
|
|
1814
1837
|
let t = w(0), n = 0, i = null, a = 0, o = 0, s = null, c = 0, l = null, u = null, d = 0;
|
|
1815
1838
|
function f() {
|
|
1816
1839
|
s !== null && (cancelAnimationFrame(s), s = null);
|
|
1817
1840
|
}
|
|
1818
1841
|
function p(e, t, n, r) {
|
|
1819
|
-
return i = e, l = t.slice(), u =
|
|
1842
|
+
return i = e, l = t.slice(), u = Ce(e.items, u ?? Se(r.items), n), c = e.items.length < t.length ? Math.max(c, r.height, e.height) : 0, e.items.length < t.length && e.items.length > n && m(), e;
|
|
1820
1843
|
}
|
|
1821
1844
|
function m() {
|
|
1822
1845
|
s === null && (s = requestAnimationFrame(() => {
|
|
@@ -1824,13 +1847,13 @@ function sn(e) {
|
|
|
1824
1847
|
let n = e.items(), r = i;
|
|
1825
1848
|
if (!r || r.items.length >= n.length) return;
|
|
1826
1849
|
let a = r.items.length;
|
|
1827
|
-
p(
|
|
1850
|
+
p(ve(n, e.width.value, {
|
|
1828
1851
|
additionalHeight: e.additionalHeight.value,
|
|
1829
1852
|
gap: e.gap.value,
|
|
1830
1853
|
minColumnWidth: e.minColumnWidth.value
|
|
1831
1854
|
}, r, a, {
|
|
1832
1855
|
throughIndex: e.packThroughIndex(),
|
|
1833
|
-
untilIndex: a +
|
|
1856
|
+
untilIndex: a + sn
|
|
1834
1857
|
}), n, a, r), t.value += 1;
|
|
1835
1858
|
}));
|
|
1836
1859
|
}
|
|
@@ -1844,22 +1867,22 @@ function sn(e) {
|
|
|
1844
1867
|
if (g && l && d === s && a === h.gap && n === h.additionalHeight && o === h.minColumnWidth) {
|
|
1845
1868
|
let t = 0, n = l, i = Math.min(n.length, r.length);
|
|
1846
1869
|
for (; t < i && n[t] === r[t];) t += 1;
|
|
1847
|
-
return t === r.length && t === n.length ? (g.items.length > 0 && g.items.length < r.length && m(), g) : (f(), p(
|
|
1870
|
+
return t === r.length && t === n.length ? (g.items.length > 0 && g.items.length < r.length && m(), g) : (f(), p(ve(r, s, h, g, t, {
|
|
1848
1871
|
throughIndex: e.packThroughIndex(),
|
|
1849
1872
|
untilBottom: e.packUntilBottom()
|
|
1850
1873
|
}), r, t, g));
|
|
1851
1874
|
}
|
|
1852
1875
|
f();
|
|
1853
|
-
let _ =
|
|
1854
|
-
return i = _, l = r.slice(), d = s, a = h.gap, n = h.additionalHeight, o = h.minColumnWidth, u =
|
|
1855
|
-
}), g = r(() => (h.value, u ??
|
|
1876
|
+
let _ = _e(r, s, h);
|
|
1877
|
+
return i = _, l = r.slice(), d = s, a = h.gap, n = h.additionalHeight, o = h.minColumnWidth, u = Se(_.items), c = 0, _;
|
|
1878
|
+
}), g = r(() => (h.value, u ?? Se(h.value.items)));
|
|
1856
1879
|
return v(f), {
|
|
1857
1880
|
ensurePackedThrough(n) {
|
|
1858
1881
|
let r = e.items(), a = i;
|
|
1859
1882
|
if (!a || a.items.length >= r.length || a.height >= n) return;
|
|
1860
1883
|
f();
|
|
1861
1884
|
let o = a.items.length;
|
|
1862
|
-
p(
|
|
1885
|
+
p(ve(r, e.width.value, {
|
|
1863
1886
|
additionalHeight: e.additionalHeight.value,
|
|
1864
1887
|
gap: e.gap.value,
|
|
1865
1888
|
minColumnWidth: e.minColumnWidth.value
|
|
@@ -1875,10 +1898,10 @@ function sn(e) {
|
|
|
1875
1898
|
}
|
|
1876
1899
|
//#endregion
|
|
1877
1900
|
//#region src/components/MasonryFeed.vue?vue&type=script&setup=true&lang.ts
|
|
1878
|
-
var
|
|
1901
|
+
var ln = { class: "masonry-feed-shell" }, un = ["aria-hidden", "inert"], dn = {
|
|
1879
1902
|
key: 0,
|
|
1880
1903
|
class: "masonry-feed-status-overlay"
|
|
1881
|
-
},
|
|
1904
|
+
}, fn = 6, pn = 12, mn = 250, hn = /* @__PURE__ */ d({
|
|
1882
1905
|
__name: "MasonryFeed",
|
|
1883
1906
|
props: {
|
|
1884
1907
|
enteringPostIds: {},
|
|
@@ -1908,6 +1931,7 @@ var cn = { class: "masonry-feed-shell" }, ln = ["aria-hidden", "inert"], un = {
|
|
|
1908
1931
|
emits: [
|
|
1909
1932
|
"activate",
|
|
1910
1933
|
"error",
|
|
1934
|
+
"mediaError",
|
|
1911
1935
|
"fullyVisible",
|
|
1912
1936
|
"loadMore",
|
|
1913
1937
|
"mediaChange",
|
|
@@ -1916,46 +1940,46 @@ var cn = { class: "masonry-feed-shell" }, ln = ["aria-hidden", "inert"], un = {
|
|
|
1916
1940
|
"visible"
|
|
1917
1941
|
],
|
|
1918
1942
|
setup(t, { expose: n, emit: i }) {
|
|
1919
|
-
let l = 0, d = t, f = i, p = w(null), m = `vibe-masonry-${D()}`, g = w(null), y = w(0), x = w(
|
|
1943
|
+
let l = 0, d = t, f = i, p = w(null), m = `vibe-masonry-${D()}`, g = w(null), y = w(0), x = w(fn), C = w(0), T = w(0), k = w(0), A = w([]), j = w([]), M = w([]), N = 0, P = null, F = null, I = null, L = null, R = r(() => ({
|
|
1920
1944
|
additionalHeight: (d.cardHeader?.height ?? 0) + (d.cardFooter?.height ?? 0),
|
|
1921
1945
|
gap: x.value,
|
|
1922
|
-
minColumnWidth:
|
|
1946
|
+
minColumnWidth: De(d.masonry)
|
|
1923
1947
|
})), z = [];
|
|
1924
1948
|
function B() {
|
|
1925
|
-
let e = N - k.value + C.value +
|
|
1949
|
+
let e = N - k.value + C.value + Oe(d.masonry, C.value), t = M.value.reduce((e, t) => {
|
|
1926
1950
|
let n = z[t];
|
|
1927
1951
|
return n ? Math.max(e, n.y + n.height) : e;
|
|
1928
1952
|
}, 0);
|
|
1929
1953
|
return Math.max(e, t);
|
|
1930
1954
|
}
|
|
1931
|
-
function
|
|
1955
|
+
function ee() {
|
|
1932
1956
|
return M.value.reduce((e, t) => Math.max(e, t), -1);
|
|
1933
1957
|
}
|
|
1934
|
-
let
|
|
1958
|
+
let V = cn({
|
|
1935
1959
|
additionalHeight: r(() => R.value.additionalHeight),
|
|
1936
1960
|
gap: x,
|
|
1937
1961
|
items: () => d.items,
|
|
1938
1962
|
minColumnWidth: r(() => R.value.minColumnWidth),
|
|
1939
|
-
packThroughIndex:
|
|
1963
|
+
packThroughIndex: ee,
|
|
1940
1964
|
packUntilBottom: B,
|
|
1941
1965
|
width: y
|
|
1942
|
-
}),
|
|
1943
|
-
throughIndex:
|
|
1966
|
+
}), H = V.layout, U = V.viewportIndex, G = r(() => d.leavingPostIds.size === 0 ? null : ye(d.items, y.value, R.value, H.value, (e) => d.leavingPostIds.has(d.items[e].postId), {
|
|
1967
|
+
throughIndex: ee(),
|
|
1944
1968
|
untilBottom: B()
|
|
1945
|
-
})),
|
|
1946
|
-
let e =
|
|
1969
|
+
})), K = r(() => {
|
|
1970
|
+
let e = G.value;
|
|
1947
1971
|
return e ? {
|
|
1948
1972
|
columns: e.columns,
|
|
1949
1973
|
height: e.height,
|
|
1950
1974
|
items: e.items
|
|
1951
|
-
} :
|
|
1952
|
-
}),
|
|
1953
|
-
let e =
|
|
1954
|
-
return e ?
|
|
1955
|
-
}),
|
|
1956
|
-
let t = d.items[e], n =
|
|
1975
|
+
} : H.value;
|
|
1976
|
+
}), te = r(() => {
|
|
1977
|
+
let e = G.value;
|
|
1978
|
+
return e ? we(e.items, e.retainedIndices, U.value, e.fromIndex) : null;
|
|
1979
|
+
}), q = r(() => (H.value, Math.max(T.value, V.reservedHeight(), d.leavingPostIds.size === 0 ? K.value.height : H.value.height))), J = r(() => ({ height: `${q.value}px` })), ne = r(() => !d.infiniteScroll || C.value > 0 && k.value + K.value.height <= C.value + 1), re = r(() => new Set(j.value)), ie = r(() => M.value.flatMap((e) => {
|
|
1980
|
+
let t = d.items[e], n = K.value.items[e];
|
|
1957
1981
|
return !t || !n || n.width <= 0 || n.height <= 0 ? [] : [{
|
|
1958
|
-
fetchPriority:
|
|
1982
|
+
fetchPriority: re.value.has(e) ? "high" : "low",
|
|
1959
1983
|
index: e,
|
|
1960
1984
|
item: t
|
|
1961
1985
|
}];
|
|
@@ -1963,18 +1987,18 @@ var cn = { class: "masonry-feed-shell" }, ln = ["aria-hidden", "inert"], un = {
|
|
|
1963
1987
|
function ae(e, t) {
|
|
1964
1988
|
return [...new Set([...e, ...t])].sort((e, t) => e - t);
|
|
1965
1989
|
}
|
|
1966
|
-
function
|
|
1990
|
+
function se(e, t) {
|
|
1967
1991
|
return e.length === t.length && e.every((e, n) => e === t[n]);
|
|
1968
1992
|
}
|
|
1969
|
-
function
|
|
1993
|
+
function ce(e) {
|
|
1970
1994
|
let t = {
|
|
1971
1995
|
scrollTop: N - k.value,
|
|
1972
1996
|
viewportHeight: C.value
|
|
1973
|
-
}, n =
|
|
1997
|
+
}, n = te.value, r = Ee(n ?? U.value, {
|
|
1974
1998
|
...t,
|
|
1975
1999
|
overscan: e
|
|
1976
2000
|
}).indices;
|
|
1977
|
-
return ae(r, d.leavingPostIds.size === 0 ? [] :
|
|
2001
|
+
return ae(r, d.leavingPostIds.size === 0 ? [] : Ee(U.value, {
|
|
1978
2002
|
...t,
|
|
1979
2003
|
overscan: e
|
|
1980
2004
|
}).indices.filter((e) => {
|
|
@@ -1982,27 +2006,27 @@ var cn = { class: "masonry-feed-shell" }, ln = ["aria-hidden", "inert"], un = {
|
|
|
1982
2006
|
return t !== void 0 && d.leavingPostIds.has(t.postId);
|
|
1983
2007
|
}));
|
|
1984
2008
|
}
|
|
1985
|
-
function
|
|
1986
|
-
let e =
|
|
1987
|
-
|
|
1988
|
-
let n =
|
|
2009
|
+
function le() {
|
|
2010
|
+
let e = ce(0), t = ce(Oe(d.masonry, C.value));
|
|
2011
|
+
se(j.value, e) || (j.value = e);
|
|
2012
|
+
let n = pe(K.value.items, e.filter((e) => {
|
|
1989
2013
|
let t = d.items[e];
|
|
1990
2014
|
return t && !d.leavingPostIds.has(t.postId);
|
|
1991
2015
|
}), {
|
|
1992
2016
|
scrollTop: N - k.value,
|
|
1993
2017
|
viewportHeight: C.value
|
|
1994
2018
|
});
|
|
1995
|
-
|
|
2019
|
+
se(A.value, n) || (A.value = n), se(M.value, t) || (M.value = t);
|
|
1996
2020
|
}
|
|
1997
|
-
function
|
|
2021
|
+
function X() {
|
|
1998
2022
|
if (L !== null) return;
|
|
1999
2023
|
L = -1;
|
|
2000
2024
|
let e = requestAnimationFrame(() => {
|
|
2001
|
-
L = null,
|
|
2025
|
+
L = null, le();
|
|
2002
2026
|
});
|
|
2003
2027
|
L !== null && (L = e);
|
|
2004
2028
|
}
|
|
2005
|
-
|
|
2029
|
+
on({
|
|
2006
2030
|
fullyVisibleIndices: () => A.value,
|
|
2007
2031
|
items: () => d.items,
|
|
2008
2032
|
mediaIndices: () => d.mediaIndices,
|
|
@@ -2011,11 +2035,11 @@ var cn = { class: "masonry-feed-shell" }, ln = ["aria-hidden", "inert"], un = {
|
|
|
2011
2035
|
previewStates: () => d.previewStates,
|
|
2012
2036
|
visibleIndices: () => j.value
|
|
2013
2037
|
});
|
|
2014
|
-
function
|
|
2015
|
-
let t =
|
|
2038
|
+
function Z(e) {
|
|
2039
|
+
let t = K.value.items[e], n = d.items[e]?.postId;
|
|
2016
2040
|
if (!t || t.width <= 0 || t.height <= 0) return {};
|
|
2017
|
-
let r = n !== void 0 && d.enteringPostIds.has(n), i = n !== void 0 && d.leavingPostIds.has(n), a = r || i ?
|
|
2018
|
-
containerHeight: Math.max(T.value,
|
|
2041
|
+
let r = n !== void 0 && d.enteringPostIds.has(n), i = n !== void 0 && d.leavingPostIds.has(n), a = r || i ? ue({
|
|
2042
|
+
containerHeight: Math.max(T.value, H.value.height),
|
|
2019
2043
|
gap: x.value
|
|
2020
2044
|
}) : 0, o = n === void 0 ? 0 : i ? d.removalDelays.get(n) ?? 0 : r ? d.entryDelays.get(n) ?? 0 : 0;
|
|
2021
2045
|
return {
|
|
@@ -2032,47 +2056,47 @@ var cn = { class: "masonry-feed-shell" }, ln = ["aria-hidden", "inert"], un = {
|
|
|
2032
2056
|
let t = e.ownerDocument.defaultView?.getComputedStyle(e), n = (Number.parseFloat(t?.paddingTop ?? "") || 0) + (Number.parseFloat(t?.paddingBottom ?? "") || 0);
|
|
2033
2057
|
T.value = Math.max(0, e.clientHeight - n);
|
|
2034
2058
|
let r = g.value;
|
|
2035
|
-
r && (k.value = r.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop,
|
|
2059
|
+
r && (k.value = r.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop, le());
|
|
2036
2060
|
}
|
|
2037
|
-
function
|
|
2061
|
+
function fe(e) {
|
|
2038
2062
|
let t = e.ownerDocument.documentElement.clientWidth;
|
|
2039
|
-
y.value = e.clientWidth, x.value = Math.min(
|
|
2063
|
+
y.value = e.clientWidth, x.value = Math.min(pn, Math.max(fn, t * .0075)), de();
|
|
2040
2064
|
}
|
|
2041
|
-
function
|
|
2065
|
+
function Q(e) {
|
|
2042
2066
|
let t = e.currentTarget;
|
|
2043
|
-
t && (N = t.scrollTop,
|
|
2067
|
+
t && (N = t.scrollTop, V.ensurePackedThrough(B()), X(), Date.now() >= l && !d.loadMoreLocked && d.infiniteScroll && Y(t) && f("loadMore"));
|
|
2044
2068
|
}
|
|
2045
2069
|
function me() {
|
|
2046
2070
|
let e = p.value;
|
|
2047
|
-
Date.now() >= l && !d.loadMoreLocked && e &&
|
|
2071
|
+
Date.now() >= l && !d.loadMoreLocked && e && Y(e) && f("loadMore");
|
|
2048
2072
|
}
|
|
2049
2073
|
O(() => d.items.length, (e, t) => {
|
|
2050
|
-
e > 0 && e < t && (l = Date.now() +
|
|
2074
|
+
e > 0 && e < t && (l = Date.now() + mn);
|
|
2051
2075
|
});
|
|
2052
2076
|
function he() {
|
|
2053
2077
|
return p.value;
|
|
2054
2078
|
}
|
|
2055
2079
|
return O(g, (e) => {
|
|
2056
|
-
P?.disconnect(), P = null, I !== null && cancelAnimationFrame(I), e && (
|
|
2080
|
+
P?.disconnect(), P = null, I !== null && cancelAnimationFrame(I), e && (fe(e), !(typeof ResizeObserver > "u") && (P = new ResizeObserver(([t]) => {
|
|
2057
2081
|
let n = t?.contentRect.width ?? e.clientWidth;
|
|
2058
2082
|
Math.abs(n - y.value) < .5 || (I = requestAnimationFrame(() => {
|
|
2059
|
-
I = null,
|
|
2083
|
+
I = null, fe(e);
|
|
2060
2084
|
}));
|
|
2061
2085
|
}), P.observe(e)));
|
|
2062
2086
|
}), O(p, (e) => {
|
|
2063
2087
|
F?.disconnect(), F = null, e && (de(), !(typeof ResizeObserver > "u") && (F = new ResizeObserver(de), F.observe(e)));
|
|
2064
|
-
}), O(
|
|
2088
|
+
}), O(K, (e) => {
|
|
2065
2089
|
z = e.items;
|
|
2066
2090
|
}, { flush: "sync" }), O([
|
|
2067
|
-
|
|
2068
|
-
|
|
2091
|
+
H,
|
|
2092
|
+
K,
|
|
2069
2093
|
() => d.masonry
|
|
2070
|
-
],
|
|
2094
|
+
], le, { flush: "post" }), v(() => {
|
|
2071
2095
|
P?.disconnect(), F?.disconnect(), I !== null && cancelAnimationFrame(I), L !== null && cancelAnimationFrame(L);
|
|
2072
2096
|
}), n({
|
|
2073
2097
|
getScrollElement: he,
|
|
2074
2098
|
loadIfNearBottom: me
|
|
2075
|
-
}), (n, r) => (b(), s("div",
|
|
2099
|
+
}), (n, r) => (b(), s("div", ln, [
|
|
2076
2100
|
c("main", {
|
|
2077
2101
|
id: m,
|
|
2078
2102
|
ref_key: "galleryElement",
|
|
@@ -2081,14 +2105,14 @@ var cn = { class: "masonry-feed-shell" }, ln = ["aria-hidden", "inert"], un = {
|
|
|
2081
2105
|
"data-layout-mode": "masonry",
|
|
2082
2106
|
"aria-hidden": t.suspended || void 0,
|
|
2083
2107
|
inert: t.suspended || void 0,
|
|
2084
|
-
onScrollPassive:
|
|
2108
|
+
onScrollPassive: Q
|
|
2085
2109
|
}, [c("section", {
|
|
2086
2110
|
ref_key: "masonryElement",
|
|
2087
2111
|
ref: g,
|
|
2088
2112
|
class: h(["masonry", { "masonry--ready": y.value > 0 }]),
|
|
2089
|
-
style: _(
|
|
2113
|
+
style: _(J.value),
|
|
2090
2114
|
"aria-label": "Media gallery"
|
|
2091
|
-
}, [(b(!0), s(e, null, S(
|
|
2115
|
+
}, [(b(!0), s(e, null, S(ie.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(an, {
|
|
2092
2116
|
key: n.postId,
|
|
2093
2117
|
class: "masonry-item",
|
|
2094
2118
|
entering: t.enteringPostIds.has(n.postId),
|
|
@@ -2097,20 +2121,21 @@ var cn = { class: "masonry-feed-shell" }, ln = ["aria-hidden", "inert"], un = {
|
|
|
2097
2121
|
"card-footer": t.cardFooter,
|
|
2098
2122
|
"card-header": t.cardHeader,
|
|
2099
2123
|
"media-card": t.mediaCard,
|
|
2100
|
-
"in-viewport":
|
|
2124
|
+
"in-viewport": re.value.has(r),
|
|
2101
2125
|
index: r,
|
|
2102
2126
|
item: n,
|
|
2103
|
-
"item-style":
|
|
2127
|
+
"item-style": Z(r),
|
|
2104
2128
|
interactive: "",
|
|
2105
2129
|
layout: "masonry",
|
|
2106
2130
|
"loaded-count": t.items.length,
|
|
2107
2131
|
"media-index": t.mediaIndices.get(n.postId) ?? 0,
|
|
2108
|
-
"preview-state": t.previewStates.get(E(
|
|
2132
|
+
"preview-state": t.previewStates.get(E(W)(n.postId, t.mediaIndices.get(n.postId) ?? 0)) ?? "loading",
|
|
2109
2133
|
total: t.total,
|
|
2110
2134
|
onActivate: (e) => f("activate", n.postId, e),
|
|
2111
2135
|
onMediaChange: (e) => f("mediaChange", n.postId, e),
|
|
2112
2136
|
onReady: (e) => f("ready", n.postId, e),
|
|
2113
|
-
onError: (e) => f("error", n.postId, e)
|
|
2137
|
+
onError: (e) => f("error", n.postId, e),
|
|
2138
|
+
onMediaError: (e) => f("mediaError", n.postId, e)
|
|
2114
2139
|
}, null, 8, [
|
|
2115
2140
|
"entering",
|
|
2116
2141
|
"leaving",
|
|
@@ -2129,9 +2154,10 @@ var cn = { class: "masonry-feed-shell" }, ln = ["aria-hidden", "inert"], un = {
|
|
|
2129
2154
|
"onActivate",
|
|
2130
2155
|
"onMediaChange",
|
|
2131
2156
|
"onReady",
|
|
2132
|
-
"onError"
|
|
2133
|
-
|
|
2134
|
-
|
|
2157
|
+
"onError",
|
|
2158
|
+
"onMediaError"
|
|
2159
|
+
]))), 128))], 6)], 42, un),
|
|
2160
|
+
t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && ne.value || !t.hasNext && t.canRetryEnd ? (b(), s("div", dn, [u(oe, {
|
|
2135
2161
|
actions: t.feedFooterActions,
|
|
2136
2162
|
"can-retry-end": t.canRetryEnd,
|
|
2137
2163
|
"feed-footer": t.feedFooter,
|
|
@@ -2139,7 +2165,7 @@ var cn = { class: "masonry-feed-shell" }, ln = ["aria-hidden", "inert"], un = {
|
|
|
2139
2165
|
"has-next": t.hasNext,
|
|
2140
2166
|
"is-loading": t.isLoadingMore,
|
|
2141
2167
|
"load-more-locked": t.loadMoreLocked,
|
|
2142
|
-
"show-load-more":
|
|
2168
|
+
"show-load-more": ne.value,
|
|
2143
2169
|
state: t.state,
|
|
2144
2170
|
onLoadMore: r[0] ||= (e) => f("loadMore"),
|
|
2145
2171
|
onRetryEnd: r[1] ||= (e) => f("retryEnd")
|
|
@@ -2154,8 +2180,8 @@ var cn = { class: "masonry-feed-shell" }, ln = ["aria-hidden", "inert"], un = {
|
|
|
2154
2180
|
"show-load-more",
|
|
2155
2181
|
"state"
|
|
2156
2182
|
])])) : o("", !0),
|
|
2157
|
-
u(
|
|
2158
|
-
"content-size":
|
|
2183
|
+
u(Le, {
|
|
2184
|
+
"content-size": K.value.height,
|
|
2159
2185
|
"controls-id": m,
|
|
2160
2186
|
"scroll-element": p.value,
|
|
2161
2187
|
suspended: t.suspended
|
|
@@ -2166,8 +2192,8 @@ var cn = { class: "masonry-feed-shell" }, ln = ["aria-hidden", "inert"], un = {
|
|
|
2166
2192
|
])
|
|
2167
2193
|
]));
|
|
2168
2194
|
}
|
|
2169
|
-
}),
|
|
2170
|
-
function
|
|
2195
|
+
}), gn = 300;
|
|
2196
|
+
function _n(e, t, n) {
|
|
2171
2197
|
let r = e.scrollTop;
|
|
2172
2198
|
if (n || Math.abs(r - t) <= 1) return e.scrollTop = t, Promise.resolve();
|
|
2173
2199
|
e.setAttribute("data-transitioning", "");
|
|
@@ -2175,7 +2201,7 @@ function gn(e, t, n) {
|
|
|
2175
2201
|
return new Promise((n) => {
|
|
2176
2202
|
let o = (s) => {
|
|
2177
2203
|
a += 1;
|
|
2178
|
-
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c /
|
|
2204
|
+
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / gn), u = 1 - (1 - l) ** 3;
|
|
2179
2205
|
if (e.scrollTop = r + (t - r) * u, l < 1) {
|
|
2180
2206
|
requestAnimationFrame(o);
|
|
2181
2207
|
return;
|
|
@@ -2187,7 +2213,7 @@ function gn(e, t, n) {
|
|
|
2187
2213
|
}
|
|
2188
2214
|
//#endregion
|
|
2189
2215
|
//#region src/components/ReelAutoAdvanceProgress.vue?vue&type=script&setup=true&lang.ts
|
|
2190
|
-
var
|
|
2216
|
+
var vn = ["aria-label"], yn = /* @__PURE__ */ d({
|
|
2191
2217
|
__name: "ReelAutoAdvanceProgress",
|
|
2192
2218
|
props: {
|
|
2193
2219
|
durationMs: {},
|
|
@@ -2205,9 +2231,9 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2205
2231
|
class: "reel-auto-advance-progress",
|
|
2206
2232
|
style: _(a.value),
|
|
2207
2233
|
onAnimationend: n[0] ||= (e) => i("complete")
|
|
2208
|
-
}, null, 36)], 8,
|
|
2234
|
+
}, null, 36)], 8, vn));
|
|
2209
2235
|
}
|
|
2210
|
-
}),
|
|
2236
|
+
}), bn = { class: "reel-viewport" }, xn = ["data-active-post-id", "data-active-media-index"], Sn = ["role", "data-status"], Cn = ["disabled"], wn = 300, Tn = 250, En = /* @__PURE__ */ d({
|
|
2211
2237
|
__name: "ReelFeed",
|
|
2212
2238
|
props: {
|
|
2213
2239
|
initialPostId: {},
|
|
@@ -2238,6 +2264,7 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2238
2264
|
emits: [
|
|
2239
2265
|
"activeChange",
|
|
2240
2266
|
"error",
|
|
2267
|
+
"mediaError",
|
|
2241
2268
|
"loadMore",
|
|
2242
2269
|
"mediaChange",
|
|
2243
2270
|
"ready",
|
|
@@ -2258,8 +2285,8 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2258
2285
|
return e === void 0 ? 0 : u.mediaIndices.get(e) ?? 0;
|
|
2259
2286
|
}), z = r(() => {
|
|
2260
2287
|
let e = F.value;
|
|
2261
|
-
return e === void 0 ? "loading" : u.previewStates.get(
|
|
2262
|
-
}), B = r(() => I.value ?
|
|
2288
|
+
return e === void 0 ? "loading" : u.previewStates.get(W(e, R.value)) ?? "loading";
|
|
2289
|
+
}), B = r(() => I.value ? U(I.value, R.value) : null), H = r(() => B.value ? ee(B.value, u.mediaSource ?? "preview") : null), G = r(() => z.value === "ready" && !!(H.value && L(H.value.type, H.value.src))), K = r(() => [
|
|
2263
2290
|
F.value,
|
|
2264
2291
|
R.value,
|
|
2265
2292
|
u.items.length,
|
|
@@ -2267,55 +2294,55 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2267
2294
|
u.reelAutoAdvance.enabled,
|
|
2268
2295
|
u.reelAutoAdvance.includePostItems,
|
|
2269
2296
|
u.reelAutoAdvance.intervalMs
|
|
2270
|
-
].join(":")),
|
|
2271
|
-
let e = I.value, t = !!(e && u.reelAutoAdvance.includePostItems && R.value <
|
|
2297
|
+
].join(":")), te = r(() => {
|
|
2298
|
+
let e = I.value, t = !!(e && u.reelAutoAdvance.includePostItems && R.value < V(e).length - 1), n = u.reelAutoAdvance.intervalMs / 1e3;
|
|
2272
2299
|
return `Auto advance to the next ${t ? "post item" : "post"} in ${n}s`;
|
|
2273
|
-
}),
|
|
2274
|
-
function
|
|
2300
|
+
}), q = r(() => u.reelAutoAdvance.enabled && u.reelForward.status === "idle" && I.value !== void 0 && z.value !== "loading" && !G.value), J = r(() => !u.infiniteScroll || u.items.length <= 1), ne = r(() => u.reelForward.status === "end" && u.hasNext && !u.infiniteScroll && !u.loadMoreLocked), re = r(() => u.reelForward.status === "loading" ? "Loading the next media…" : u.reelForward.status === "error" ? "Unable to load the next media." : ne.value ? "Load the next page to continue." : "You reached the end of this feed.");
|
|
2301
|
+
function ie(e) {
|
|
2275
2302
|
return { gridRow: `${e + 1}` };
|
|
2276
2303
|
}
|
|
2277
2304
|
function ae(e) {
|
|
2278
2305
|
let t = k || e.clientHeight;
|
|
2279
2306
|
return t <= 0 || u.items.length === 0 ? 0 : Math.min(u.items.length - 1, Math.max(0, Math.round(e.scrollTop / t)));
|
|
2280
2307
|
}
|
|
2281
|
-
function
|
|
2308
|
+
function se(e) {
|
|
2282
2309
|
let t = e.currentTarget;
|
|
2283
2310
|
if (!t) return;
|
|
2284
2311
|
let n = k || t.clientHeight, r = Math.max(0, u.items.length - 1) * n;
|
|
2285
|
-
C.value = u.items.length > 0 && t.scrollTop > r + 1, D.value || (x.value = ae(t)), Date.now() >= l && !u.loadMoreLocked && u.infiniteScroll &&
|
|
2312
|
+
C.value = u.items.length > 0 && t.scrollTop > r + 1, D.value || (x.value = ae(t)), Date.now() >= l && !u.loadMoreLocked && u.infiniteScroll && Y(t) && d("loadMore");
|
|
2286
2313
|
}
|
|
2287
|
-
function
|
|
2314
|
+
function ce() {
|
|
2288
2315
|
let e = f.value;
|
|
2289
|
-
e && (C.value = !1,
|
|
2316
|
+
e && (C.value = !1, Z(!0), k = e.clientHeight, e.scrollTop = x.value * k, j !== null && cancelAnimationFrame(j), j = requestAnimationFrame(() => {
|
|
2290
2317
|
e.scrollTop = x.value * e.clientHeight, k = e.clientHeight, j = null;
|
|
2291
|
-
}),
|
|
2318
|
+
}), le());
|
|
2292
2319
|
}
|
|
2293
|
-
function
|
|
2320
|
+
function le() {
|
|
2294
2321
|
M !== null && clearTimeout(M), M = setTimeout(() => {
|
|
2295
2322
|
M = null;
|
|
2296
2323
|
let e = f.value;
|
|
2297
|
-
e && (k = e.clientHeight, e.scrollTop = x.value * k),
|
|
2324
|
+
e && (k = e.clientHeight, e.scrollTop = x.value * k), Z(!1);
|
|
2298
2325
|
}, 120);
|
|
2299
2326
|
}
|
|
2300
|
-
function
|
|
2301
|
-
|
|
2327
|
+
function X() {
|
|
2328
|
+
Z(!0);
|
|
2302
2329
|
let e = f.value;
|
|
2303
|
-
e && (k = e.clientHeight, e.scrollTop = x.value * k),
|
|
2330
|
+
e && (k = e.clientHeight, e.scrollTop = x.value * k), le();
|
|
2304
2331
|
}
|
|
2305
|
-
function
|
|
2332
|
+
function Z(e) {
|
|
2306
2333
|
D.value = e, f.value?.toggleAttribute("data-resizing", e);
|
|
2307
2334
|
}
|
|
2308
2335
|
function ue() {
|
|
2309
2336
|
let e = f.value;
|
|
2310
|
-
Date.now() >= l && !u.loadMoreLocked && e &&
|
|
2337
|
+
Date.now() >= l && !u.loadMoreLocked && e && Y(e) && d("loadMore");
|
|
2311
2338
|
}
|
|
2312
2339
|
O(() => u.items.length, (e, t) => {
|
|
2313
|
-
e > 0 && e < t && (l = Date.now() +
|
|
2340
|
+
e > 0 && e < t && (l = Date.now() + Tn);
|
|
2314
2341
|
});
|
|
2315
2342
|
function de(e) {
|
|
2316
2343
|
let t = I.value;
|
|
2317
2344
|
if (!t) return !1;
|
|
2318
|
-
let n =
|
|
2345
|
+
let n = V(t).length;
|
|
2319
2346
|
if (n <= 1) return !1;
|
|
2320
2347
|
let r = (R.value + e + n) % n;
|
|
2321
2348
|
return d("mediaChange", t.postId, r), !0;
|
|
@@ -2324,18 +2351,18 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2324
2351
|
let t = x.value + e;
|
|
2325
2352
|
return !f.value || t < 0 || t >= u.items.length ? !1 : (he(t), !0);
|
|
2326
2353
|
}
|
|
2327
|
-
function
|
|
2354
|
+
function pe(e, t) {
|
|
2328
2355
|
let n = u.items.findIndex((t) => t.postId === e), r = u.items[n];
|
|
2329
2356
|
return !f.value || !r || t < 0 || t > r.items.length ? !1 : ((u.mediaIndices.get(e) ?? 0) !== t && d("mediaChange", e, t), n !== x.value && he(n), !0);
|
|
2330
2357
|
}
|
|
2331
|
-
function
|
|
2358
|
+
function Q() {
|
|
2332
2359
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
2333
2360
|
}
|
|
2334
2361
|
function me(e) {
|
|
2335
2362
|
let t = f.value;
|
|
2336
2363
|
if (!t) return Promise.resolve();
|
|
2337
2364
|
let n = e * (k || t.clientHeight);
|
|
2338
|
-
return x.value = e,
|
|
2365
|
+
return x.value = e, _n(t, n, Q());
|
|
2339
2366
|
}
|
|
2340
2367
|
function he(e) {
|
|
2341
2368
|
me(e);
|
|
@@ -2345,13 +2372,13 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2345
2372
|
return t < 0 || t === x.value ? !1 : (await me(t), !0);
|
|
2346
2373
|
}
|
|
2347
2374
|
async function _e(e) {
|
|
2348
|
-
return de(e) ? (
|
|
2375
|
+
return de(e) ? (Q() || await new Promise((e) => setTimeout(e, wn)), !0) : !1;
|
|
2349
2376
|
}
|
|
2350
2377
|
function ve() {
|
|
2351
2378
|
if (!u.reelAutoAdvance.enabled) return;
|
|
2352
2379
|
let e = I.value;
|
|
2353
2380
|
if (!e) return;
|
|
2354
|
-
if (u.reelAutoAdvance.includePostItems && R.value <
|
|
2381
|
+
if (u.reelAutoAdvance.includePostItems && R.value < V(e).length - 1) {
|
|
2355
2382
|
d("mediaChange", e.postId, R.value + 1);
|
|
2356
2383
|
return;
|
|
2357
2384
|
}
|
|
@@ -2363,26 +2390,26 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2363
2390
|
u.reelAutoAdvance.includePostItems && (u.mediaIndices.get(n.postId) ?? 0) !== 0 && d("mediaChange", n.postId, 0), he(t);
|
|
2364
2391
|
}
|
|
2365
2392
|
function ye(e, t) {
|
|
2366
|
-
!u.reelAutoAdvance.enabled || e !== F.value || t !== R.value || !
|
|
2393
|
+
!u.reelAutoAdvance.enabled || e !== F.value || t !== R.value || !G.value || ve();
|
|
2367
2394
|
}
|
|
2368
2395
|
return O(f, (e) => {
|
|
2369
|
-
A?.disconnect(), A = null, e && (k = e.clientHeight, !(typeof ResizeObserver > "u") && (A = new ResizeObserver(
|
|
2396
|
+
A?.disconnect(), A = null, e && (k = e.clientHeight, !(typeof ResizeObserver > "u") && (A = new ResizeObserver(ce), A.observe(e)));
|
|
2370
2397
|
}), O(() => u.items.length, async (e) => {
|
|
2371
2398
|
let t = u.initialPostId, n = t == null ? -1 : u.items.findIndex(({ postId: e }) => e === t);
|
|
2372
|
-
x.value = n >= 0 ? n : Math.min(x.value, Math.max(0, e - 1)), await m(),
|
|
2399
|
+
x.value = n >= 0 ? n : Math.min(x.value, Math.max(0, e - 1)), await m(), ce();
|
|
2373
2400
|
}), O(F, (e) => {
|
|
2374
2401
|
e !== void 0 && d("activeChange", e);
|
|
2375
2402
|
}, { immediate: !0 }), y(() => {
|
|
2376
|
-
window.addEventListener("resize",
|
|
2403
|
+
window.addEventListener("resize", X), window.addEventListener("orientationchange", X), g >= 0 && m(ce);
|
|
2377
2404
|
}), v(() => {
|
|
2378
|
-
window.removeEventListener("resize",
|
|
2405
|
+
window.removeEventListener("resize", X), window.removeEventListener("orientationchange", X), A?.disconnect(), j !== null && cancelAnimationFrame(j), M !== null && clearTimeout(M);
|
|
2379
2406
|
}), n({
|
|
2380
2407
|
activeIndex: x,
|
|
2381
2408
|
activePostId: F,
|
|
2382
2409
|
changeActiveMedia: de,
|
|
2383
2410
|
loadIfNearBottom: ue,
|
|
2384
2411
|
moveActivePost: fe,
|
|
2385
|
-
navigateToItem:
|
|
2412
|
+
navigateToItem: pe,
|
|
2386
2413
|
transitionActiveMedia: _e,
|
|
2387
2414
|
transitionActivePost: ge
|
|
2388
2415
|
}), (n, r) => (b(), s("main", {
|
|
@@ -2392,7 +2419,7 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2392
2419
|
}]),
|
|
2393
2420
|
"data-layout-mode": "reel"
|
|
2394
2421
|
}, [
|
|
2395
|
-
t.cardHeader && I.value && t.reelForward.status === "idle" ? (b(), a(
|
|
2422
|
+
t.cardHeader && I.value && t.reelForward.status === "idle" ? (b(), a(rt, {
|
|
2396
2423
|
key: 0,
|
|
2397
2424
|
index: x.value,
|
|
2398
2425
|
item: I.value,
|
|
@@ -2414,19 +2441,19 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2414
2441
|
"style",
|
|
2415
2442
|
"total"
|
|
2416
2443
|
])) : o("", !0),
|
|
2417
|
-
c("div",
|
|
2444
|
+
c("div", bn, [c("div", {
|
|
2418
2445
|
ref_key: "galleryElement",
|
|
2419
2446
|
ref: f,
|
|
2420
2447
|
class: "gallery-shell reel-feed",
|
|
2421
2448
|
"data-active-post-id": F.value,
|
|
2422
2449
|
"data-active-media-index": R.value,
|
|
2423
|
-
onScrollPassive:
|
|
2450
|
+
onScrollPassive: se
|
|
2424
2451
|
}, [t.reelForward.status === "idle" ? (b(), s("section", {
|
|
2425
2452
|
key: 1,
|
|
2426
2453
|
class: "reel-track",
|
|
2427
2454
|
style: _(N.value),
|
|
2428
2455
|
"aria-label": "Media gallery"
|
|
2429
|
-
}, [(b(!0), s(e, null, S(P.value, ({ fetchPriority: e, item: n, index: i }) => (b(), a(
|
|
2456
|
+
}, [(b(!0), s(e, null, S(P.value, ({ fetchPriority: e, item: n, index: i }) => (b(), a(an, {
|
|
2430
2457
|
key: n.postId,
|
|
2431
2458
|
active: i === x.value && !C.value,
|
|
2432
2459
|
"advance-on-media-end": u.reelAutoAdvance.enabled && i === x.value,
|
|
@@ -2435,13 +2462,13 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2435
2462
|
"fetch-priority": e,
|
|
2436
2463
|
index: i,
|
|
2437
2464
|
item: n,
|
|
2438
|
-
"item-style":
|
|
2465
|
+
"item-style": ie(i),
|
|
2439
2466
|
"media-card": t.mediaCard,
|
|
2440
2467
|
layout: "reel",
|
|
2441
2468
|
"loaded-count": t.items.length,
|
|
2442
2469
|
"media-index": t.mediaIndices.get(n.postId) ?? 0,
|
|
2443
2470
|
"media-source": t.mediaSource,
|
|
2444
|
-
"preview-state": t.previewStates.get(E(
|
|
2471
|
+
"preview-state": t.previewStates.get(E(W)(n.postId, t.mediaIndices.get(n.postId) ?? 0)) ?? "loading",
|
|
2445
2472
|
"reel-controls-target": p.value,
|
|
2446
2473
|
"reel-audio-state": t.reelAudioState,
|
|
2447
2474
|
"stationary-reel-controls": "",
|
|
@@ -2450,7 +2477,8 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2450
2477
|
onEnded: (e) => ye(n.postId, e),
|
|
2451
2478
|
onReady: (e) => d("ready", n.postId, e),
|
|
2452
2479
|
onReelAudioChange: r[1] ||= (e) => d("reelAudioChange", e),
|
|
2453
|
-
onError: (e) => d("error", n.postId, e)
|
|
2480
|
+
onError: (e) => d("error", n.postId, e),
|
|
2481
|
+
onMediaError: (e) => d("mediaError", n.postId, e)
|
|
2454
2482
|
}, null, 8, [
|
|
2455
2483
|
"active",
|
|
2456
2484
|
"advance-on-media-end",
|
|
@@ -2469,19 +2497,20 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2469
2497
|
"onMediaChange",
|
|
2470
2498
|
"onEnded",
|
|
2471
2499
|
"onReady",
|
|
2472
|
-
"onError"
|
|
2500
|
+
"onError",
|
|
2501
|
+
"onMediaError"
|
|
2473
2502
|
]))), 128))], 4)) : (b(), s("div", {
|
|
2474
2503
|
key: 0,
|
|
2475
2504
|
class: "reel-forward-status",
|
|
2476
2505
|
role: t.reelForward.status === "error" ? "alert" : "status",
|
|
2477
2506
|
"data-status": t.reelForward.status
|
|
2478
|
-
}, [c("p", null, T(
|
|
2507
|
+
}, [c("p", null, T(re.value), 1), t.reelForward.status === "error" || t.reelForward.status === "end" ? (b(), s("button", {
|
|
2479
2508
|
key: 0,
|
|
2480
2509
|
class: "reel-forward-retry",
|
|
2481
2510
|
type: "button",
|
|
2482
2511
|
disabled: t.loadMoreLocked,
|
|
2483
2512
|
onClick: r[0] ||= (e) => d("retryForward")
|
|
2484
|
-
}, T(
|
|
2513
|
+
}, T(ne.value ? "Load more" : "Retry"), 9, Cn)) : o("", !0)], 8, Sn)), t.reelForward.status === "idle" ? (b(), a(oe, {
|
|
2485
2514
|
key: 2,
|
|
2486
2515
|
actions: t.feedFooterActions,
|
|
2487
2516
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2490,7 +2519,7 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2490
2519
|
"has-next": t.hasNext,
|
|
2491
2520
|
"is-loading": t.isLoadingMore,
|
|
2492
2521
|
"load-more-locked": t.loadMoreLocked,
|
|
2493
|
-
"show-load-more":
|
|
2522
|
+
"show-load-more": J.value,
|
|
2494
2523
|
state: t.state,
|
|
2495
2524
|
onLoadMore: r[2] ||= (e) => d("loadMore"),
|
|
2496
2525
|
onRetryEnd: r[3] ||= (e) => d("retryEnd")
|
|
@@ -2504,13 +2533,13 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2504
2533
|
"load-more-locked",
|
|
2505
2534
|
"show-load-more",
|
|
2506
2535
|
"state"
|
|
2507
|
-
])) : o("", !0)], 40,
|
|
2536
|
+
])) : o("", !0)], 40, xn), c("div", {
|
|
2508
2537
|
ref_key: "reelControlsElement",
|
|
2509
2538
|
ref: p,
|
|
2510
2539
|
class: "reel-media-controls-host",
|
|
2511
2540
|
"data-test": "reel-media-controls-host"
|
|
2512
2541
|
}, null, 512)]),
|
|
2513
|
-
t.cardFooter && I.value && t.reelForward.status === "idle" ? (b(), a(
|
|
2542
|
+
t.cardFooter && I.value && t.reelForward.status === "idle" ? (b(), a(rt, {
|
|
2514
2543
|
key: 1,
|
|
2515
2544
|
index: x.value,
|
|
2516
2545
|
item: I.value,
|
|
@@ -2532,24 +2561,24 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2532
2561
|
"style",
|
|
2533
2562
|
"total"
|
|
2534
2563
|
])) : o("", !0),
|
|
2535
|
-
|
|
2536
|
-
key:
|
|
2564
|
+
q.value ? (b(), a(yn, {
|
|
2565
|
+
key: K.value,
|
|
2537
2566
|
"duration-ms": t.reelAutoAdvance.intervalMs,
|
|
2538
|
-
label:
|
|
2567
|
+
label: te.value,
|
|
2539
2568
|
onComplete: ve
|
|
2540
2569
|
}, null, 8, ["duration-ms", "label"])) : o("", !0)
|
|
2541
2570
|
], 2));
|
|
2542
2571
|
}
|
|
2543
|
-
}),
|
|
2572
|
+
}), Dn = ["data-info-sheet-open", "data-info-sheet-mode"], On = ["aria-hidden", "inert"], kn = {
|
|
2544
2573
|
key: 0,
|
|
2545
2574
|
class: "reel-info-sheet-layer",
|
|
2546
2575
|
"data-test": "reel-info-sheet"
|
|
2547
|
-
},
|
|
2576
|
+
}, An = [
|
|
2548
2577
|
"role",
|
|
2549
2578
|
"aria-modal",
|
|
2550
2579
|
"tabindex",
|
|
2551
2580
|
"data-active-post-id"
|
|
2552
|
-
],
|
|
2581
|
+
], jn = /* @__PURE__ */ d({
|
|
2553
2582
|
__name: "ReelLayout",
|
|
2554
2583
|
props: {
|
|
2555
2584
|
forwardIndex: { default: null },
|
|
@@ -2587,6 +2616,7 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2587
2616
|
"activeChange",
|
|
2588
2617
|
"closeInfoSheet",
|
|
2589
2618
|
"error",
|
|
2619
|
+
"mediaError",
|
|
2590
2620
|
"loadMore",
|
|
2591
2621
|
"mediaChange",
|
|
2592
2622
|
"ready",
|
|
@@ -2609,9 +2639,9 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2609
2639
|
item: e,
|
|
2610
2640
|
layout: "reel",
|
|
2611
2641
|
loadedCount: l.items.length,
|
|
2612
|
-
mediaCount:
|
|
2642
|
+
mediaCount: V(e).length,
|
|
2613
2643
|
mediaIndex: D.value,
|
|
2614
|
-
mediaItem:
|
|
2644
|
+
mediaItem: U(e, D.value),
|
|
2615
2645
|
mediaSource: l.mediaSource ?? "preview",
|
|
2616
2646
|
origin: l.origin,
|
|
2617
2647
|
total: l.total
|
|
@@ -2644,7 +2674,7 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2644
2674
|
function B(e, t) {
|
|
2645
2675
|
d("mediaChange", e, t);
|
|
2646
2676
|
}
|
|
2647
|
-
function
|
|
2677
|
+
function ee(e, t) {
|
|
2648
2678
|
d("ready", e, t);
|
|
2649
2679
|
}
|
|
2650
2680
|
return O(() => ({
|
|
@@ -2676,7 +2706,7 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2676
2706
|
class: "reel-layout-main",
|
|
2677
2707
|
"aria-hidden": e.infoSheetOverlay && A.value || void 0,
|
|
2678
2708
|
inert: e.infoSheetOverlay && A.value || void 0
|
|
2679
|
-
}, [u(
|
|
2709
|
+
}, [u(En, {
|
|
2680
2710
|
ref_key: "reelFeed",
|
|
2681
2711
|
ref: p,
|
|
2682
2712
|
"can-retry-end": e.canRetryEnd,
|
|
@@ -2702,12 +2732,13 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2702
2732
|
total: e.total,
|
|
2703
2733
|
onActiveChange: r[0] ||= (e) => d("activeChange", e),
|
|
2704
2734
|
onError: z,
|
|
2705
|
-
|
|
2735
|
+
onMediaError: r[1] ||= (e, t) => d("mediaError", e, t),
|
|
2736
|
+
onLoadMore: r[2] ||= (e) => d("loadMore"),
|
|
2706
2737
|
onMediaChange: B,
|
|
2707
|
-
onReady:
|
|
2708
|
-
onRetryEnd: r[
|
|
2709
|
-
onRetryForward: r[
|
|
2710
|
-
onReelAudioChange: r[
|
|
2738
|
+
onReady: ee,
|
|
2739
|
+
onRetryEnd: r[3] ||= (e) => d("retryEnd"),
|
|
2740
|
+
onRetryForward: r[4] ||= (e) => d("retryForward"),
|
|
2741
|
+
onReelAudioChange: r[5] ||= (e) => d("reelAudioChange", e)
|
|
2711
2742
|
}, null, 8, [
|
|
2712
2743
|
"can-retry-end",
|
|
2713
2744
|
"card-footer",
|
|
@@ -2730,8 +2761,8 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2730
2761
|
"reel-forward",
|
|
2731
2762
|
"state",
|
|
2732
2763
|
"total"
|
|
2733
|
-
])], 8,
|
|
2734
|
-
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div",
|
|
2764
|
+
])], 8, On), u(n, { name: "vibe-info-sheet" }, {
|
|
2765
|
+
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", kn, [c("aside", {
|
|
2735
2766
|
ref_key: "sheetElement",
|
|
2736
2767
|
ref: _,
|
|
2737
2768
|
class: "reel-info-sheet",
|
|
@@ -2740,17 +2771,17 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2740
2771
|
"aria-modal": e.infoSheetOverlay ? "true" : void 0,
|
|
2741
2772
|
tabindex: e.infoSheetOverlay ? -1 : void 0,
|
|
2742
2773
|
"data-active-post-id": T.value?.postId
|
|
2743
|
-
}, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8,
|
|
2774
|
+
}, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8, An)])) : o("", !0)]),
|
|
2744
2775
|
_: 1
|
|
2745
|
-
})], 10,
|
|
2776
|
+
})], 10, Dn));
|
|
2746
2777
|
}
|
|
2747
2778
|
});
|
|
2748
2779
|
//#endregion
|
|
2749
2780
|
//#region src/core/mediaLifecycle.ts
|
|
2750
|
-
function
|
|
2781
|
+
function Mn(e, t, n, r, i) {
|
|
2751
2782
|
let a = e.items.findIndex((e) => e.postId === t), o = e.items[a];
|
|
2752
2783
|
if (!o) return null;
|
|
2753
|
-
let s =
|
|
2784
|
+
let s = H(o, n), c = U(o, s);
|
|
2754
2785
|
return {
|
|
2755
2786
|
item: o,
|
|
2756
2787
|
layout: r,
|
|
@@ -2763,7 +2794,7 @@ function jn(e, t, n, r, i) {
|
|
|
2763
2794
|
postIndex: a
|
|
2764
2795
|
};
|
|
2765
2796
|
}
|
|
2766
|
-
function
|
|
2797
|
+
function Nn(e, t) {
|
|
2767
2798
|
O(() => {
|
|
2768
2799
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null;
|
|
2769
2800
|
return {
|
|
@@ -2773,72 +2804,80 @@ function Mn(e, t) {
|
|
|
2773
2804
|
};
|
|
2774
2805
|
}, (n, r) => {
|
|
2775
2806
|
if (n.postId === null || n.postId === r?.postId && n.mediaIndex === r.mediaIndex && n.origin === r.origin) return;
|
|
2776
|
-
let i =
|
|
2807
|
+
let i = Mn(e, n.postId, n.mediaIndex, "reel", n.origin);
|
|
2777
2808
|
i && t(i);
|
|
2778
2809
|
}, { flush: "sync" });
|
|
2779
2810
|
}
|
|
2780
2811
|
//#endregion
|
|
2781
2812
|
//#region src/components/useMediaLifecycle.ts
|
|
2782
|
-
function
|
|
2813
|
+
function Pn(e, t) {
|
|
2783
2814
|
let n = /* @__PURE__ */ new Set(), i = w(/* @__PURE__ */ new Map()), a = w(/* @__PURE__ */ new Map()), o = w(/* @__PURE__ */ new Map()), s = () => e.reelMediaSource === "preview" ? i : e.reelMediaSource === "mobile" ? o : a, c = r(() => s().value), l = /* @__PURE__ */ new Set();
|
|
2784
2815
|
function u() {
|
|
2785
2816
|
n.clear(), l.clear(), i.value = /* @__PURE__ */ new Map(), a.value = /* @__PURE__ */ new Map(), o.value = /* @__PURE__ */ new Map();
|
|
2786
2817
|
}
|
|
2787
2818
|
function d(e, t, n, r) {
|
|
2788
|
-
let i =
|
|
2819
|
+
let i = W(t, n);
|
|
2789
2820
|
e.value.get(i) !== r && (e.value = new Map(e.value).set(i, r));
|
|
2790
2821
|
}
|
|
2791
2822
|
function f(t, n, r, i) {
|
|
2792
|
-
return
|
|
2823
|
+
return Mn(e, t, n, r, i);
|
|
2793
2824
|
}
|
|
2794
2825
|
function p(e, n, r, i) {
|
|
2795
2826
|
let a = f(e, n, r, i);
|
|
2796
2827
|
a && t.ready(a);
|
|
2797
2828
|
}
|
|
2798
|
-
function m(
|
|
2799
|
-
|
|
2829
|
+
function m(n, r, i) {
|
|
2830
|
+
let a = f(n, r.mediaIndex, i, i === "reel" ? e.reelOrigin ?? "reel" : null);
|
|
2831
|
+
a && r.src && t.error({
|
|
2832
|
+
...a,
|
|
2833
|
+
...r
|
|
2834
|
+
});
|
|
2800
2835
|
}
|
|
2801
2836
|
function h(e, t) {
|
|
2802
|
-
d(i, e, t, "
|
|
2837
|
+
d(i, e, t, "error");
|
|
2803
2838
|
}
|
|
2804
2839
|
function g(e, t) {
|
|
2840
|
+
d(i, e, t, "ready"), p(e, t, "masonry", null);
|
|
2841
|
+
}
|
|
2842
|
+
function _(e, t) {
|
|
2805
2843
|
d(s(), e, t, "error");
|
|
2806
2844
|
}
|
|
2807
|
-
function
|
|
2845
|
+
function v(t, n) {
|
|
2808
2846
|
d(s(), t, n, "ready"), p(t, n, "reel", e.reelOrigin ?? "reel");
|
|
2809
2847
|
}
|
|
2810
|
-
function
|
|
2811
|
-
let r =
|
|
2848
|
+
function y(e, n) {
|
|
2849
|
+
let r = W(e, n);
|
|
2812
2850
|
if (l.has(r)) return;
|
|
2813
2851
|
let i = f(e, n, "masonry", null);
|
|
2814
2852
|
i && (l.add(r), t.visible(i));
|
|
2815
2853
|
}
|
|
2816
|
-
function
|
|
2817
|
-
let o = [i,
|
|
2854
|
+
function b(e, r, i, a) {
|
|
2855
|
+
let o = [i, W(e, r)].join(":");
|
|
2818
2856
|
if (n.has(o)) return;
|
|
2819
2857
|
let s = f(e, r, i, a);
|
|
2820
2858
|
s && (n.add(o), t.fullyVisible(s));
|
|
2821
2859
|
}
|
|
2822
|
-
function
|
|
2823
|
-
|
|
2860
|
+
function x(e, t) {
|
|
2861
|
+
b(e, t, "masonry", null);
|
|
2824
2862
|
}
|
|
2825
|
-
return
|
|
2863
|
+
return Nn(e, t.reelChange), O(() => {
|
|
2826
2864
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null, n = t === null ? 0 : e.mediaIndices.get(t) ?? 0;
|
|
2827
2865
|
return {
|
|
2828
2866
|
mediaIndex: n,
|
|
2829
2867
|
origin: e.reelOrigin ?? "reel",
|
|
2830
2868
|
postId: t,
|
|
2831
|
-
ready: t !== null && c.value.get(
|
|
2869
|
+
ready: t !== null && c.value.get(W(t, n)) === "ready"
|
|
2832
2870
|
};
|
|
2833
2871
|
}, (e, t) => {
|
|
2834
|
-
e.postId === null || !e.ready || t?.ready && t.postId === e.postId && t.mediaIndex === e.mediaIndex && t.origin === e.origin ||
|
|
2872
|
+
e.postId === null || !e.ready || t?.ready && t.postId === e.postId && t.mediaIndex === e.mediaIndex && t.origin === e.origin || b(e.postId, e.mediaIndex, "reel", e.origin);
|
|
2835
2873
|
}, { flush: "post" }), {
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2874
|
+
markMediaError: m,
|
|
2875
|
+
markMasonryFullyVisible: x,
|
|
2876
|
+
markMasonryVisible: y,
|
|
2877
|
+
markPreviewError: h,
|
|
2878
|
+
markPreviewReady: g,
|
|
2879
|
+
markReelError: _,
|
|
2880
|
+
markReelReady: v,
|
|
2842
2881
|
originalStates: a,
|
|
2843
2882
|
previewStates: i,
|
|
2844
2883
|
reelStates: c,
|
|
@@ -2847,16 +2886,16 @@ function Nn(e, t) {
|
|
|
2847
2886
|
}
|
|
2848
2887
|
//#endregion
|
|
2849
2888
|
//#region src/core/reelEscapeStack.ts
|
|
2850
|
-
var
|
|
2851
|
-
function
|
|
2852
|
-
return
|
|
2853
|
-
let t =
|
|
2854
|
-
t >= 0 &&
|
|
2889
|
+
var Fn = [];
|
|
2890
|
+
function In(e) {
|
|
2891
|
+
return Fn.push(e), () => {
|
|
2892
|
+
let t = Fn.indexOf(e);
|
|
2893
|
+
t >= 0 && Fn.splice(t, 1);
|
|
2855
2894
|
};
|
|
2856
2895
|
}
|
|
2857
|
-
function
|
|
2896
|
+
function Ln(e) {
|
|
2858
2897
|
if (!e.isActive()) return !1;
|
|
2859
|
-
let t =
|
|
2898
|
+
let t = Fn.filter((e) => e.isActive()), n = e.element();
|
|
2860
2899
|
return n !== null && t.some((t) => {
|
|
2861
2900
|
if (t === e) return !1;
|
|
2862
2901
|
let r = t.element();
|
|
@@ -2872,14 +2911,14 @@ function In(e) {
|
|
|
2872
2911
|
}
|
|
2873
2912
|
//#endregion
|
|
2874
2913
|
//#region src/components/useReelKeyboard.ts
|
|
2875
|
-
function
|
|
2914
|
+
function Rn(e) {
|
|
2876
2915
|
let t = {
|
|
2877
2916
|
element: e.element,
|
|
2878
2917
|
isActive: () => e.state.layout === "reel" || e.state.reelOrigin === "masonry"
|
|
2879
2918
|
}, n = null;
|
|
2880
2919
|
function r(n) {
|
|
2881
2920
|
let r = t.isActive();
|
|
2882
|
-
if (n.key === "Escape" && r && !
|
|
2921
|
+
if (n.key === "Escape" && r && !Ln(t)) return;
|
|
2883
2922
|
if (n.key === "Escape" && e.state.reelOrigin === "masonry") {
|
|
2884
2923
|
n.preventDefault(), e.state.reelInfoSheetOverlay && e.state.reelInfoSheet.enabled && e.setReelInfoSheet(!1), e.closeMasonryReel();
|
|
2885
2924
|
return;
|
|
@@ -2899,14 +2938,14 @@ function Ln(e) {
|
|
|
2899
2938
|
a !== 0 && e.reelRenderer()?.changeActiveMedia?.(a) && n.preventDefault();
|
|
2900
2939
|
}
|
|
2901
2940
|
y(() => {
|
|
2902
|
-
n =
|
|
2941
|
+
n = In(t), window.addEventListener("keydown", r);
|
|
2903
2942
|
}), v(() => {
|
|
2904
2943
|
window.removeEventListener("keydown", r), n?.(), n = null;
|
|
2905
2944
|
});
|
|
2906
2945
|
}
|
|
2907
2946
|
//#endregion
|
|
2908
2947
|
//#region src/components/VibeSurface.vue?vue&type=script&setup=true&lang.ts
|
|
2909
|
-
var
|
|
2948
|
+
var zn = 35, Bn = 420, Vn = /* @__PURE__ */ d({
|
|
2910
2949
|
__name: "VibeSurface",
|
|
2911
2950
|
props: {
|
|
2912
2951
|
canRetryEnd: { type: Boolean },
|
|
@@ -2925,6 +2964,7 @@ var Rn = 35, zn = 420, Bn = /* @__PURE__ */ d({
|
|
|
2925
2964
|
"closeReel",
|
|
2926
2965
|
"loadMore",
|
|
2927
2966
|
"mediaFullyVisible",
|
|
2967
|
+
"mediaError",
|
|
2928
2968
|
"mediaReady",
|
|
2929
2969
|
"mediaVisible",
|
|
2930
2970
|
"openReel",
|
|
@@ -2935,80 +2975,94 @@ var Rn = 35, zn = 420, Bn = /* @__PURE__ */ d({
|
|
|
2935
2975
|
"retryForward"
|
|
2936
2976
|
],
|
|
2937
2977
|
setup(t, { expose: i, emit: c }) {
|
|
2938
|
-
let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), _ = w(!1), y = w(/* @__PURE__ */ new Set()), x = w(/* @__PURE__ */ new Map()), S = w(/* @__PURE__ */ new Set()), C = w(/* @__PURE__ */ new Map()), T = r(() => Object.freeze([...l.state.items])), D = r(() =>
|
|
2978
|
+
let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), _ = w(!1), y = w(/* @__PURE__ */ new Set()), x = w(/* @__PURE__ */ new Map()), S = w(/* @__PURE__ */ new Set()), C = w(/* @__PURE__ */ new Map()), T = r(() => Object.freeze([...l.state.items])), D = r(() => te(l.state, T.value)), { markMediaError: A, markMasonryFullyVisible: j, markMasonryVisible: M, markPreviewError: N, markPreviewReady: P, markReelError: F, markReelReady: I, originalStates: L, previewStates: R, reelStates: z, resetMediaLifecycle: B } = Pn(l.state, {
|
|
2979
|
+
error: (e) => d("mediaError", e),
|
|
2939
2980
|
fullyVisible: (e) => d("mediaFullyVisible", e),
|
|
2940
2981
|
ready: (e) => d("mediaReady", e),
|
|
2941
2982
|
reelChange: (e) => d("reelMediaChange", e),
|
|
2942
2983
|
visible: (e) => d("mediaVisible", e)
|
|
2943
|
-
}),
|
|
2984
|
+
}), ee = new Set(l.state.items.map((e) => e.postId)), U = null, W = null, G = !1;
|
|
2944
2985
|
function K() {
|
|
2945
2986
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
2946
2987
|
}
|
|
2947
|
-
function
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2988
|
+
function q() {
|
|
2989
|
+
U !== null && cancelAnimationFrame(U), U = requestAnimationFrame(() => {
|
|
2990
|
+
U = requestAnimationFrame(() => {
|
|
2991
|
+
U = null, y.value = /* @__PURE__ */ new Set();
|
|
2951
2992
|
});
|
|
2952
2993
|
});
|
|
2953
2994
|
}
|
|
2954
|
-
function
|
|
2995
|
+
function J(e, t) {
|
|
2955
2996
|
let n = l.state.items.find((t) => t.postId === e);
|
|
2956
2997
|
if (!n) return;
|
|
2957
|
-
let r =
|
|
2998
|
+
let r = H(n, t);
|
|
2958
2999
|
(l.state.mediaIndices.get(e) ?? 0) !== r && (l.state.mediaIndices = new Map(l.state.mediaIndices).set(e, r));
|
|
2959
3000
|
}
|
|
2960
|
-
async function
|
|
3001
|
+
async function ne() {
|
|
2961
3002
|
await m(), (l.state.layout === "reel" || l.state.reelOrigin === "masonry" ? p.value : f.value)?.loadIfNearBottom();
|
|
2962
3003
|
}
|
|
2963
|
-
function
|
|
3004
|
+
function re(e) {
|
|
2964
3005
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.changeActiveMedia?.(e) ?? !1;
|
|
2965
3006
|
}
|
|
2966
|
-
function
|
|
3007
|
+
function ie(e) {
|
|
2967
3008
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.moveActivePost?.(e) ?? !1;
|
|
2968
3009
|
}
|
|
2969
|
-
function
|
|
3010
|
+
function ae(e) {
|
|
2970
3011
|
if (!(l.state.layout === "reel" || l.state.reelOrigin === "masonry") || l.state.isLoading) return "reel-inactive";
|
|
2971
3012
|
let t = l.state.items.find((t) => t.postId === e.postId);
|
|
2972
3013
|
if (!t) return "not-found";
|
|
2973
|
-
let n =
|
|
3014
|
+
let n = V(t).findIndex((t) => t.mediaId === e.mediaId);
|
|
2974
3015
|
return n < 0 ? "not-found" : p.value?.navigateToItem?.(e.postId, n) ? "navigated" : "reel-inactive";
|
|
2975
3016
|
}
|
|
2976
|
-
function
|
|
3017
|
+
function oe() {
|
|
2977
3018
|
return l.state.layout !== "masonry" || l.state.reelOrigin === "masonry" ? null : f.value?.getScrollElement?.() ?? null;
|
|
2978
3019
|
}
|
|
2979
|
-
function
|
|
3020
|
+
function se(e, t) {
|
|
2980
3021
|
W = e, G = t === "keyboard", d("openReel", e), m(() => h.value?.focus());
|
|
2981
3022
|
}
|
|
2982
|
-
function
|
|
3023
|
+
function ce(e) {
|
|
2983
3024
|
let t = g.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [];
|
|
2984
3025
|
return Array.from(t).find((t) => t.dataset.postId === String(e)) ?? null;
|
|
2985
3026
|
}
|
|
2986
|
-
function
|
|
3027
|
+
function Y(e, t) {
|
|
2987
3028
|
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || K()) return 0;
|
|
2988
|
-
let n = [...new Set(e)], r = n.filter(
|
|
2989
|
-
if (
|
|
2990
|
-
let
|
|
2991
|
-
return
|
|
2992
|
-
|
|
2993
|
-
}), y.value = new Set([...y.value].filter((e) => !
|
|
3029
|
+
let n = [...new Set(e)], r = new Set(Array.from(g.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [], (e) => e.dataset.postId)), i = n.filter((e) => r.has(String(e)));
|
|
3030
|
+
if (i.length === 0) return 0;
|
|
3031
|
+
let a = new Map(C.value), o = t?.staggerMs ?? zn;
|
|
3032
|
+
return i.forEach((e, t) => {
|
|
3033
|
+
a.set(e, t * o);
|
|
3034
|
+
}), y.value = new Set([...y.value].filter((e) => !i.includes(e))), S.value = new Set([...S.value, ...n]), C.value = a, Bn + (i.length - 1) * o;
|
|
2994
3035
|
}
|
|
2995
|
-
function X(
|
|
2996
|
-
|
|
3036
|
+
function X() {
|
|
3037
|
+
S.value = /* @__PURE__ */ new Set(), C.value = /* @__PURE__ */ new Map();
|
|
3038
|
+
}
|
|
3039
|
+
async function Z(e, t) {
|
|
3040
|
+
if (t.aborted || Y(e, { staggerMs: 0 }) === 0 || (await m(), t.aborted)) return;
|
|
3041
|
+
let n = g.value?.querySelectorAll(".masonry-feed .media-card--leaving") ?? [], r = Array.from(n).flatMap((e) => (getComputedStyle(e).opacity, e.getAnimations?.().filter((e) => e.effect?.getTiming().iterations !== Infinity) ?? []));
|
|
3042
|
+
await new Promise((e) => {
|
|
3043
|
+
let n = () => {
|
|
3044
|
+
t.removeEventListener("abort", n), e();
|
|
3045
|
+
};
|
|
3046
|
+
t.addEventListener("abort", n, { once: !0 }), t.aborted ? n() : Promise.allSettled(r.map((e) => e.finished)).then(n);
|
|
3047
|
+
});
|
|
3048
|
+
}
|
|
3049
|
+
function ue(e, t) {
|
|
3050
|
+
let n = ce(e), r = n?.querySelector(".media-card-activator") ?? n;
|
|
2997
3051
|
r && (r.classList.toggle("media-card-focus-silent", !t), t || r.addEventListener("blur", () => {
|
|
2998
3052
|
r.classList.remove("media-card-focus-silent");
|
|
2999
3053
|
}, { once: !0 }), r?.focus({ preventScroll: !0 }));
|
|
3000
3054
|
}
|
|
3001
|
-
function
|
|
3055
|
+
function de() {
|
|
3002
3056
|
l.state.reelOrigin === "masonry" && (W ??= l.state.activeReelPostId, _.value = !0, d("closeReel"));
|
|
3003
3057
|
}
|
|
3004
|
-
function
|
|
3058
|
+
function fe() {
|
|
3005
3059
|
let e = W, t = G;
|
|
3006
3060
|
_.value = !1, W = null, G = !1, m(() => {
|
|
3007
|
-
e !== null &&
|
|
3061
|
+
e !== null && ue(e, t);
|
|
3008
3062
|
});
|
|
3009
3063
|
}
|
|
3010
|
-
return
|
|
3011
|
-
closeMasonryReel:
|
|
3064
|
+
return Rn({
|
|
3065
|
+
closeMasonryReel: de,
|
|
3012
3066
|
element: () => g.value,
|
|
3013
3067
|
isReelLeaving: () => _.value,
|
|
3014
3068
|
reelRenderer: () => p.value,
|
|
@@ -3018,32 +3072,34 @@ var Rn = 35, zn = 420, Bn = /* @__PURE__ */ d({
|
|
|
3018
3072
|
let e = l.state.items;
|
|
3019
3073
|
return [e, e.length];
|
|
3020
3074
|
}, ([e]) => {
|
|
3021
|
-
let t = e.map((e) => e.postId), n = t.filter((e) => !
|
|
3022
|
-
if (
|
|
3075
|
+
let t = e.map((e) => e.postId), n = t.filter((e) => !ee.has(e)), r = new Set(t);
|
|
3076
|
+
if (ee = new Set(t), S.value = new Set([...S.value].filter((e) => r.has(e))), C.value = new Map([...C.value].filter(([e]) => r.has(e))), n.length === 0 || K()) return;
|
|
3023
3077
|
let i = /* @__PURE__ */ new Map();
|
|
3024
3078
|
t.forEach((e) => {
|
|
3025
3079
|
let t = x.value.get(e);
|
|
3026
3080
|
t !== void 0 && i.set(e, t);
|
|
3027
3081
|
}), n.forEach((e, t) => {
|
|
3028
|
-
i.set(e, t *
|
|
3029
|
-
}), x.value = i, y.value = new Set([...y.value, ...n]),
|
|
3082
|
+
i.set(e, t * zn);
|
|
3083
|
+
}), x.value = i, y.value = new Set([...y.value, ...n]), q();
|
|
3030
3084
|
}, { flush: "sync" }), v(() => {
|
|
3031
|
-
|
|
3085
|
+
U !== null && cancelAnimationFrame(U);
|
|
3032
3086
|
}), i({
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3087
|
+
animateItemRemoval: Z,
|
|
3088
|
+
cancelItemRemoval: X,
|
|
3089
|
+
changeActiveReelMedia: re,
|
|
3090
|
+
getAutoScrollElement: oe,
|
|
3091
|
+
loadIfNearBottom: ne,
|
|
3092
|
+
moveActiveReelPost: ie,
|
|
3093
|
+
navigateToReelItem: ae,
|
|
3094
|
+
resetMediaLifecycle: B,
|
|
3095
|
+
startItemRemoval: Y,
|
|
3040
3096
|
transitionActiveReelMedia: (e) => p.value?.transitionActiveMedia?.(e) ?? Promise.resolve(!1),
|
|
3041
3097
|
transitionActiveReelPost: (e) => p.value?.transitionActivePost?.(e) ?? Promise.resolve(!1)
|
|
3042
3098
|
}), (r, i) => (b(), s("div", {
|
|
3043
3099
|
ref_key: "surfaceElement",
|
|
3044
3100
|
ref: g,
|
|
3045
3101
|
class: "vibe-surface"
|
|
3046
|
-
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(
|
|
3102
|
+
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(jn, {
|
|
3047
3103
|
key: 0,
|
|
3048
3104
|
ref_key: "reelRenderer",
|
|
3049
3105
|
ref: p,
|
|
@@ -3068,7 +3124,7 @@ var Rn = 35, zn = 420, Bn = /* @__PURE__ */ d({
|
|
|
3068
3124
|
"info-sheet-overlay": t.state.reelInfoSheetOverlay,
|
|
3069
3125
|
"next-page-error": !!t.state.nextPageError,
|
|
3070
3126
|
origin: "reel",
|
|
3071
|
-
"preview-states": E(
|
|
3127
|
+
"preview-states": E(z),
|
|
3072
3128
|
"reel-auto-advance": t.state.reelAutoAdvance,
|
|
3073
3129
|
"reel-audio-state": t.reelAudioState,
|
|
3074
3130
|
"reel-forward": t.state.reelForward,
|
|
@@ -3076,27 +3132,28 @@ var Rn = 35, zn = 420, Bn = /* @__PURE__ */ d({
|
|
|
3076
3132
|
total: t.state.total,
|
|
3077
3133
|
onActiveChange: i[0] ||= (e) => d("activeReelChange", e),
|
|
3078
3134
|
onCloseInfoSheet: i[1] ||= (e) => d("reelInfoSheetChange", !1),
|
|
3079
|
-
onError: E(
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3135
|
+
onError: E(F),
|
|
3136
|
+
onMediaError: i[2] ||= (e, t) => E(A)(e, t, "reel"),
|
|
3137
|
+
onLoadMore: i[3] ||= (e) => d("loadMore"),
|
|
3138
|
+
onMediaChange: J,
|
|
3139
|
+
onReady: E(I),
|
|
3140
|
+
onRetryEnd: i[4] ||= (e) => d("retryEnd"),
|
|
3141
|
+
onRetryForward: i[5] ||= (e) => d("retryForward"),
|
|
3142
|
+
onReelAudioChange: i[6] ||= (e) => d("reelAudioChange", e)
|
|
3143
|
+
}, 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" ? (b(), a(le, {
|
|
3087
3144
|
key: 1,
|
|
3088
3145
|
actions: t.feedFooterActions,
|
|
3089
3146
|
"can-retry-end": t.canRetryEnd,
|
|
3090
3147
|
"feed-footer": t.feedFooter,
|
|
3091
3148
|
state: D.value,
|
|
3092
|
-
onLoadMore: i[
|
|
3093
|
-
onRetryEnd: i[
|
|
3149
|
+
onLoadMore: i[7] ||= (e) => d("loadMore"),
|
|
3150
|
+
onRetryEnd: i[8] ||= (e) => d("retryEnd")
|
|
3094
3151
|
}, null, 8, [
|
|
3095
3152
|
"actions",
|
|
3096
3153
|
"can-retry-end",
|
|
3097
3154
|
"feed-footer",
|
|
3098
3155
|
"state"
|
|
3099
|
-
])) : (b(), s(e, { key: 2 }, [u(
|
|
3156
|
+
])) : (b(), s(e, { key: 2 }, [u(hn, {
|
|
3100
3157
|
ref_key: "masonryRenderer",
|
|
3101
3158
|
ref: f,
|
|
3102
3159
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -3117,21 +3174,22 @@ var Rn = 35, zn = 420, Bn = /* @__PURE__ */ d({
|
|
|
3117
3174
|
"load-more-locked": t.state.loadMoreLocked,
|
|
3118
3175
|
"media-indices": t.state.mediaIndices,
|
|
3119
3176
|
"next-page-error": !!t.state.nextPageError,
|
|
3120
|
-
"preview-states": E(
|
|
3177
|
+
"preview-states": E(R),
|
|
3121
3178
|
suspended: t.state.reelOrigin === "masonry" || _.value,
|
|
3122
3179
|
state: D.value,
|
|
3123
3180
|
total: t.state.total,
|
|
3124
|
-
onActivate:
|
|
3125
|
-
onError: E(
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3181
|
+
onActivate: se,
|
|
3182
|
+
onError: E(N),
|
|
3183
|
+
onMediaError: i[9] ||= (e, t) => E(A)(e, t, "masonry"),
|
|
3184
|
+
onFullyVisible: E(j),
|
|
3185
|
+
onLoadMore: i[10] ||= (e) => d("loadMore"),
|
|
3186
|
+
onMediaChange: J,
|
|
3187
|
+
onReady: E(P),
|
|
3188
|
+
onRetryEnd: i[11] ||= (e) => d("retryEnd"),
|
|
3189
|
+
onVisible: E(M)
|
|
3132
3190
|
}, 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, {
|
|
3133
3191
|
name: "vibe-reel-viewer",
|
|
3134
|
-
onAfterLeave:
|
|
3192
|
+
onAfterLeave: fe
|
|
3135
3193
|
}, {
|
|
3136
3194
|
default: k(() => [t.state.reelOrigin === "masonry" ? (b(), s("section", {
|
|
3137
3195
|
key: 0,
|
|
@@ -3142,7 +3200,7 @@ var Rn = 35, zn = 420, Bn = /* @__PURE__ */ d({
|
|
|
3142
3200
|
"aria-label": "Media viewer",
|
|
3143
3201
|
"aria-modal": "true",
|
|
3144
3202
|
tabindex: "-1"
|
|
3145
|
-
}, [u(
|
|
3203
|
+
}, [u(jn, {
|
|
3146
3204
|
ref_key: "reelRenderer",
|
|
3147
3205
|
ref: p,
|
|
3148
3206
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -3166,21 +3224,22 @@ var Rn = 35, zn = 420, Bn = /* @__PURE__ */ d({
|
|
|
3166
3224
|
"media-source": "original",
|
|
3167
3225
|
"next-page-error": !!t.state.nextPageError,
|
|
3168
3226
|
origin: "masonry",
|
|
3169
|
-
"preview-states": E(
|
|
3227
|
+
"preview-states": E(L),
|
|
3170
3228
|
"reel-auto-advance": t.state.reelAutoAdvance,
|
|
3171
3229
|
"reel-audio-state": t.reelAudioState,
|
|
3172
3230
|
"reel-forward": t.state.reelForward,
|
|
3173
3231
|
state: D.value,
|
|
3174
3232
|
total: t.state.total,
|
|
3175
|
-
onActiveChange: i[
|
|
3176
|
-
onCloseInfoSheet: i[
|
|
3177
|
-
onError: E(
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3233
|
+
onActiveChange: i[12] ||= (e) => d("activeReelChange", e),
|
|
3234
|
+
onCloseInfoSheet: i[13] ||= (e) => d("reelInfoSheetChange", !1),
|
|
3235
|
+
onError: E(F),
|
|
3236
|
+
onMediaError: i[14] ||= (e, t) => E(A)(e, t, "reel"),
|
|
3237
|
+
onLoadMore: i[15] ||= (e) => d("loadMore"),
|
|
3238
|
+
onMediaChange: J,
|
|
3239
|
+
onReady: E(I),
|
|
3240
|
+
onRetryEnd: i[16] ||= (e) => d("retryEnd"),
|
|
3241
|
+
onRetryForward: i[17] ||= (e) => d("retryForward"),
|
|
3242
|
+
onReelAudioChange: i[18] ||= (e) => d("reelAudioChange", e)
|
|
3184
3243
|
}, null, 8, /* @__PURE__ */ "can-retry-end.card-footer.card-header.feed-footer.feed-footer-actions.forward-index.forward-item.media-card.has-next.infinite-scroll.initial-post-id.info-sheet.info-sheet-enabled.info-sheet-overlay.is-loading-more.items.load-more-locked.media-indices.next-page-error.preview-states.reel-auto-advance.reel-audio-state.reel-forward.state.total.onError.onReady".split("."))], 512)) : o("", !0)]),
|
|
3185
3244
|
_: 1
|
|
3186
3245
|
})], 64))], 512));
|
|
@@ -3188,7 +3247,7 @@ var Rn = 35, zn = 420, Bn = /* @__PURE__ */ d({
|
|
|
3188
3247
|
});
|
|
3189
3248
|
//#endregion
|
|
3190
3249
|
//#region src/core/page.ts
|
|
3191
|
-
function
|
|
3250
|
+
function Hn(e) {
|
|
3192
3251
|
if (!e || typeof e != "object" || !Array.isArray(e.items)) throw TypeError("Vibe loadPage must resolve to a page with an items array.");
|
|
3193
3252
|
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.");
|
|
3194
3253
|
if (e.next !== null && typeof e.next != "string" && typeof e.next != "number") throw TypeError("Vibe page next must be a string, number, or null.");
|
|
@@ -3199,22 +3258,22 @@ function $(e, t) {
|
|
|
3199
3258
|
let n = new Set(e.map((e) => e.postId));
|
|
3200
3259
|
return [...e, ...t.filter((e) => n.has(e.postId) ? !1 : (n.add(e.postId), !0))];
|
|
3201
3260
|
}
|
|
3202
|
-
function
|
|
3261
|
+
function Un(e) {
|
|
3203
3262
|
return `${typeof e}:${String(e)}`;
|
|
3204
3263
|
}
|
|
3205
|
-
function
|
|
3206
|
-
return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview?.src ?? ""}` : `id:${
|
|
3264
|
+
function Wn(e) {
|
|
3265
|
+
return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview?.src ?? ""}` : `id:${Un(e.mediaId)}`;
|
|
3207
3266
|
}
|
|
3208
|
-
function
|
|
3209
|
-
let n = [...e], r = new Map(e.map((e, t) => [
|
|
3267
|
+
function Gn(e, t) {
|
|
3268
|
+
let n = [...e], r = new Map(e.map((e, t) => [Un(e.postId), t]));
|
|
3210
3269
|
return t.forEach((e) => {
|
|
3211
|
-
let t =
|
|
3270
|
+
let t = Un(e.postId), i = r.get(t);
|
|
3212
3271
|
if (i === void 0) {
|
|
3213
3272
|
r.set(t, n.length), n.push(e);
|
|
3214
3273
|
return;
|
|
3215
3274
|
}
|
|
3216
|
-
let a = n[i], o = new Set([a, ...a.items].map(
|
|
3217
|
-
let t =
|
|
3275
|
+
let a = n[i], o = new Set([a, ...a.items].map(Wn)), s = [e, ...e.items].filter((e) => {
|
|
3276
|
+
let t = Wn(e);
|
|
3218
3277
|
return o.has(t) ? !1 : (o.add(t), !0);
|
|
3219
3278
|
});
|
|
3220
3279
|
s.length > 0 && (n[i] = {
|
|
@@ -3223,14 +3282,14 @@ function Wn(e, t) {
|
|
|
3223
3282
|
});
|
|
3224
3283
|
}), n;
|
|
3225
3284
|
}
|
|
3226
|
-
function
|
|
3285
|
+
function Kn(e) {
|
|
3227
3286
|
return Object.prototype.hasOwnProperty.call(e, "current") ? e.current ?? null : e.next;
|
|
3228
3287
|
}
|
|
3229
3288
|
//#endregion
|
|
3230
3289
|
//#region src/core/appendPage.ts
|
|
3231
|
-
function
|
|
3232
|
-
let i =
|
|
3233
|
-
t.items =
|
|
3290
|
+
function qn(e, t, n, r) {
|
|
3291
|
+
let i = Hn(e), a = n.filterItems(i.items), o = Kn(i);
|
|
3292
|
+
t.items = Gn(t.items, a), t.next = i.next, i.total !== void 0 && (t.total = i.total), r(o), n.recordPages([{
|
|
3234
3293
|
contributionIds: a.map(({ postId: e }) => e),
|
|
3235
3294
|
cursor: o,
|
|
3236
3295
|
next: i.next,
|
|
@@ -3239,32 +3298,32 @@ function Kn(e, t, n, r) {
|
|
|
3239
3298
|
}
|
|
3240
3299
|
//#endregion
|
|
3241
3300
|
//#region src/core/requestDelay.ts
|
|
3242
|
-
var
|
|
3301
|
+
var Jn = 2e3, Yn = 1e4, Xn = 250, Zn = {
|
|
3243
3302
|
delayRemainingMs: null,
|
|
3244
3303
|
nextRequestAt: null
|
|
3245
3304
|
};
|
|
3246
|
-
function
|
|
3305
|
+
function Qn(e, t) {
|
|
3247
3306
|
return e === void 0 ? t : Math.floor(e);
|
|
3248
3307
|
}
|
|
3249
|
-
function
|
|
3308
|
+
function $n(e, t) {
|
|
3250
3309
|
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.`);
|
|
3251
3310
|
}
|
|
3252
|
-
function
|
|
3253
|
-
let n =
|
|
3311
|
+
function er(e, t = {}) {
|
|
3312
|
+
let n = Qn(t.delayStepMs, Jn), r = Qn(t.delayMaxMs, Yn);
|
|
3254
3313
|
return Math.min(Math.max(0, e) * n, r);
|
|
3255
3314
|
}
|
|
3256
|
-
function
|
|
3257
|
-
if (e == null || !Number.isFinite(e)) return { ...
|
|
3315
|
+
function tr(e) {
|
|
3316
|
+
if (e == null || !Number.isFinite(e)) return { ...Zn };
|
|
3258
3317
|
let t = Math.max(0, Math.floor(e - Date.now()));
|
|
3259
3318
|
return t > 0 ? {
|
|
3260
3319
|
delayRemainingMs: t,
|
|
3261
3320
|
nextRequestAt: e
|
|
3262
|
-
} : { ...
|
|
3321
|
+
} : { ...Zn };
|
|
3263
3322
|
}
|
|
3264
|
-
async function
|
|
3323
|
+
async function nr({ delayMs: e, onChange: t, signal: n }) {
|
|
3265
3324
|
if (n.aborted) throw new DOMException("Aborted", "AbortError");
|
|
3266
3325
|
if (e <= 0) {
|
|
3267
|
-
t({ ...
|
|
3326
|
+
t({ ...Zn });
|
|
3268
3327
|
return;
|
|
3269
3328
|
}
|
|
3270
3329
|
let r = Date.now() + e;
|
|
@@ -3272,9 +3331,9 @@ async function tr({ delayMs: e, onChange: t, signal: n }) {
|
|
|
3272
3331
|
delayRemainingMs: e,
|
|
3273
3332
|
nextRequestAt: r
|
|
3274
3333
|
}), await new Promise((i, a) => {
|
|
3275
|
-
let o = !1, s = setInterval(f,
|
|
3334
|
+
let o = !1, s = setInterval(f, Xn), c = setTimeout(() => u(), e);
|
|
3276
3335
|
function l() {
|
|
3277
|
-
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...
|
|
3336
|
+
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...Zn });
|
|
3278
3337
|
}
|
|
3279
3338
|
function u(e) {
|
|
3280
3339
|
o || (o = !0, l(), e ? a(e) : i());
|
|
@@ -3283,42 +3342,42 @@ async function tr({ delayMs: e, onChange: t, signal: n }) {
|
|
|
3283
3342
|
u(new DOMException("Aborted", "AbortError"));
|
|
3284
3343
|
}
|
|
3285
3344
|
function f() {
|
|
3286
|
-
let e =
|
|
3345
|
+
let e = tr(r);
|
|
3287
3346
|
t(e), e.delayRemainingMs === null && u();
|
|
3288
3347
|
}
|
|
3289
3348
|
n.addEventListener("abort", d, { once: !0 });
|
|
3290
3349
|
});
|
|
3291
3350
|
}
|
|
3292
|
-
var
|
|
3351
|
+
var rr = class {
|
|
3293
3352
|
interval = null;
|
|
3294
3353
|
constructor(e) {
|
|
3295
3354
|
this.onChange = e;
|
|
3296
3355
|
}
|
|
3297
3356
|
clear() {
|
|
3298
|
-
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...
|
|
3357
|
+
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...Zn });
|
|
3299
3358
|
}
|
|
3300
3359
|
sync(e) {
|
|
3301
3360
|
this.clear();
|
|
3302
|
-
let t =
|
|
3361
|
+
let t = tr(e);
|
|
3303
3362
|
this.onChange(t), t.delayRemainingMs !== null && (this.interval = setInterval(() => {
|
|
3304
|
-
let t =
|
|
3363
|
+
let t = tr(e);
|
|
3305
3364
|
this.onChange(t), t.delayRemainingMs === null && this.clear();
|
|
3306
|
-
},
|
|
3365
|
+
}, Xn));
|
|
3307
3366
|
}
|
|
3308
3367
|
};
|
|
3309
|
-
function
|
|
3368
|
+
function ir(e, t = !0) {
|
|
3310
3369
|
return e.maxAdditionalPages === "unlimited" ? Infinity : (e.maxAdditionalPages ?? 10) + (t ? 1 : 0);
|
|
3311
3370
|
}
|
|
3312
|
-
function
|
|
3371
|
+
function ar(e) {
|
|
3313
3372
|
return `${typeof e}:${String(e)}`;
|
|
3314
3373
|
}
|
|
3315
|
-
function
|
|
3374
|
+
function or(e, t) {
|
|
3316
3375
|
if (!Number.isInteger(e) || e <= 0) throw TypeError(`Vibe ${t} must be a positive integer.`);
|
|
3317
3376
|
}
|
|
3318
|
-
function
|
|
3377
|
+
function sr(e) {
|
|
3319
3378
|
if (!e) return;
|
|
3320
|
-
if (
|
|
3321
|
-
|
|
3379
|
+
if (or(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
|
|
3380
|
+
$n(e, "frontend autofill");
|
|
3322
3381
|
let t = e.maxAdditionalPages;
|
|
3323
3382
|
if (t !== void 0 && t !== "unlimited" && (!Number.isInteger(t) || t < 0)) throw TypeError("Vibe autofill maxAdditionalPages must be a non-negative integer or \"unlimited\".");
|
|
3324
3383
|
return;
|
|
@@ -3330,7 +3389,7 @@ function or(e) {
|
|
|
3330
3389
|
if (t.pageSize !== e.pageSize) throw TypeError("Vibe backend autofill initialSession pageSize must match autofill pageSize.");
|
|
3331
3390
|
}
|
|
3332
3391
|
}
|
|
3333
|
-
function
|
|
3392
|
+
function cr(e, t, n = !0) {
|
|
3334
3393
|
if (!e) return {
|
|
3335
3394
|
cycleId: null,
|
|
3336
3395
|
delayRemainingMs: null,
|
|
@@ -3347,7 +3406,7 @@ function sr(e, t, n = !0) {
|
|
|
3347
3406
|
status: "idle",
|
|
3348
3407
|
strategy: null
|
|
3349
3408
|
};
|
|
3350
|
-
let r = e.strategy === "backend" ? t ?? (n ? e.initialSession : void 0) : void 0, i = r?.received ?? 0, a =
|
|
3409
|
+
let r = e.strategy === "backend" ? t ?? (n ? e.initialSession : void 0) : void 0, i = r?.received ?? 0, a = tr(r?.nextRequestAt);
|
|
3351
3410
|
return {
|
|
3352
3411
|
cycleId: r?.cycleId ?? null,
|
|
3353
3412
|
...a,
|
|
@@ -3364,7 +3423,7 @@ function sr(e, t, n = !0) {
|
|
|
3364
3423
|
strategy: e.strategy
|
|
3365
3424
|
};
|
|
3366
3425
|
}
|
|
3367
|
-
function
|
|
3426
|
+
function lr(e) {
|
|
3368
3427
|
return [
|
|
3369
3428
|
"cancelling",
|
|
3370
3429
|
"filling",
|
|
@@ -3372,9 +3431,9 @@ function cr(e) {
|
|
|
3372
3431
|
"waiting"
|
|
3373
3432
|
].includes(e.status);
|
|
3374
3433
|
}
|
|
3375
|
-
async function
|
|
3434
|
+
async function ur(e, t, n) {
|
|
3376
3435
|
let r = t.autofill;
|
|
3377
|
-
if (!
|
|
3436
|
+
if (!lr(r) || !r.cycleId) return;
|
|
3378
3437
|
let i = {
|
|
3379
3438
|
cycleId: r.cycleId,
|
|
3380
3439
|
feedKey: r.feedKey ?? "",
|
|
@@ -3387,16 +3446,16 @@ async function lr(e, t, n) {
|
|
|
3387
3446
|
throw r.error = e, r.status = "error", e;
|
|
3388
3447
|
}
|
|
3389
3448
|
}
|
|
3390
|
-
function
|
|
3449
|
+
function dr(e, t, n) {
|
|
3391
3450
|
return e?.strategy === "backend" && t.feedKey === e.feedKey && t.sessionId === n.sessionId;
|
|
3392
3451
|
}
|
|
3393
|
-
async function
|
|
3394
|
-
let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ??
|
|
3452
|
+
async function fr({ 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 }) {
|
|
3453
|
+
let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ?? ir(s), g = t, _ = t, v = t, y = 0, b = [], x;
|
|
3395
3454
|
for (; y < h;) {
|
|
3396
|
-
let e =
|
|
3455
|
+
let e = ar(g);
|
|
3397
3456
|
if (m.has(e)) throw Error("Vibe autofill received a repeated cursor.");
|
|
3398
|
-
if (m.add(e), await
|
|
3399
|
-
delayMs:
|
|
3457
|
+
if (m.add(e), await nr({
|
|
3458
|
+
delayMs: er(l + y, s),
|
|
3400
3459
|
onChange: a,
|
|
3401
3460
|
signal: d
|
|
3402
3461
|
}), y > 0 && u()) return {
|
|
@@ -3410,7 +3469,7 @@ async function dr({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
3410
3469
|
status: "paused",
|
|
3411
3470
|
total: x
|
|
3412
3471
|
};
|
|
3413
|
-
let t =
|
|
3472
|
+
let t = Hn(await n({
|
|
3414
3473
|
cursor: g,
|
|
3415
3474
|
signal: d
|
|
3416
3475
|
}));
|
|
@@ -3467,12 +3526,12 @@ async function dr({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
3467
3526
|
}
|
|
3468
3527
|
//#endregion
|
|
3469
3528
|
//#region src/core/autofillController.ts
|
|
3470
|
-
var
|
|
3529
|
+
var pr = class {
|
|
3471
3530
|
collection = null;
|
|
3472
3531
|
cycle = 0;
|
|
3473
3532
|
delayCountdown;
|
|
3474
3533
|
constructor(e) {
|
|
3475
|
-
this.context = e, this.delayCountdown = new
|
|
3534
|
+
this.context = e, this.delayCountdown = new rr((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
|
|
3476
3535
|
}
|
|
3477
3536
|
beginCycle() {
|
|
3478
3537
|
let { options: e, state: t } = this.context;
|
|
@@ -3480,14 +3539,14 @@ var fr = class {
|
|
|
3480
3539
|
this.clear();
|
|
3481
3540
|
let n = `vibe-autofill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
3482
3541
|
return t.autofill = {
|
|
3483
|
-
...
|
|
3542
|
+
...cr(e, void 0, !1),
|
|
3484
3543
|
cycleId: n,
|
|
3485
3544
|
status: "filling"
|
|
3486
3545
|
}, n;
|
|
3487
3546
|
}
|
|
3488
3547
|
async cancel() {
|
|
3489
3548
|
let { cancelRequest: e, options: t, state: n } = this.context;
|
|
3490
|
-
await
|
|
3549
|
+
await ur(t, n, e), this.commitCollection();
|
|
3491
3550
|
}
|
|
3492
3551
|
captureCollection(e, t) {
|
|
3493
3552
|
t && (this.collection = e);
|
|
@@ -3515,30 +3574,30 @@ var fr = class {
|
|
|
3515
3574
|
requests: r.requests
|
|
3516
3575
|
}), !0) : !1;
|
|
3517
3576
|
}
|
|
3518
|
-
},
|
|
3519
|
-
function
|
|
3577
|
+
}, mr = 100;
|
|
3578
|
+
function hr(e, t) {
|
|
3520
3579
|
if (!Number.isFinite(t) || t <= 0) throw TypeError(`Vibe ${e} must be a positive number.`);
|
|
3521
3580
|
}
|
|
3522
|
-
function
|
|
3581
|
+
function gr(e, t, n) {
|
|
3523
3582
|
return Math.min(n, Math.max(t, e));
|
|
3524
3583
|
}
|
|
3525
|
-
function
|
|
3584
|
+
function _r(e) {
|
|
3526
3585
|
if (!e) return;
|
|
3527
3586
|
let t = e.minSpeedPxPerSecond ?? 20, n = e.maxSpeedPxPerSecond ?? 240;
|
|
3528
|
-
if (
|
|
3529
|
-
e.speedPxPerSecond !== void 0 &&
|
|
3587
|
+
if (hr("autoScroll.minSpeedPxPerSecond", t), hr("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
|
|
3588
|
+
e.speedPxPerSecond !== void 0 && hr("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
|
|
3530
3589
|
}
|
|
3531
|
-
function
|
|
3590
|
+
function vr(e) {
|
|
3532
3591
|
let t = e?.minSpeedPxPerSecond ?? 20, n = e?.maxSpeedPxPerSecond ?? 240;
|
|
3533
3592
|
return {
|
|
3534
3593
|
enabled: e?.enabled ?? !1,
|
|
3535
3594
|
maxSpeedPxPerSecond: n,
|
|
3536
3595
|
minSpeedPxPerSecond: t,
|
|
3537
3596
|
paused: !1,
|
|
3538
|
-
speedPxPerSecond:
|
|
3597
|
+
speedPxPerSecond: gr(e?.speedPxPerSecond ?? 80, t, n)
|
|
3539
3598
|
};
|
|
3540
3599
|
}
|
|
3541
|
-
var
|
|
3600
|
+
var yr = class {
|
|
3542
3601
|
frame = null;
|
|
3543
3602
|
lastTimestamp = null;
|
|
3544
3603
|
mounted = !1;
|
|
@@ -3558,9 +3617,9 @@ var vr = class {
|
|
|
3558
3617
|
this.options.state.enabled && (this.options.state.paused = e, this.lastTimestamp = null, e ? this.cancelFrame() : this.schedule());
|
|
3559
3618
|
}
|
|
3560
3619
|
setSpeed(e) {
|
|
3561
|
-
|
|
3620
|
+
hr("auto-scroll speed", e);
|
|
3562
3621
|
let t = this.options.state;
|
|
3563
|
-
t.speedPxPerSecond =
|
|
3622
|
+
t.speedPxPerSecond = gr(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
|
|
3564
3623
|
}
|
|
3565
3624
|
tick = (e) => {
|
|
3566
3625
|
this.frame = null;
|
|
@@ -3572,7 +3631,7 @@ var vr = class {
|
|
|
3572
3631
|
return;
|
|
3573
3632
|
}
|
|
3574
3633
|
if (this.lastTimestamp !== null) {
|
|
3575
|
-
let r = Math.min(
|
|
3634
|
+
let r = Math.min(mr, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
|
|
3576
3635
|
n.scrollTop = Math.min(i, n.scrollTop + t.speedPxPerSecond * r / 1e3);
|
|
3577
3636
|
}
|
|
3578
3637
|
this.lastTimestamp = e, this.schedule();
|
|
@@ -3586,13 +3645,13 @@ var vr = class {
|
|
|
3586
3645
|
};
|
|
3587
3646
|
//#endregion
|
|
3588
3647
|
//#region src/core/backendAutofill.ts
|
|
3589
|
-
async function
|
|
3648
|
+
async function br(e, t, n, r) {
|
|
3590
3649
|
let i = await e.onUnderfilled(n);
|
|
3591
3650
|
if (!r()) return;
|
|
3592
3651
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend autofill requires a sessionId.");
|
|
3593
3652
|
let a = Math.max(n.received, i.received ?? n.received);
|
|
3594
3653
|
Object.assign(t.autofill, {
|
|
3595
|
-
...
|
|
3654
|
+
...tr(i.nextRequestAt),
|
|
3596
3655
|
missing: Math.max(0, e.pageSize - a),
|
|
3597
3656
|
received: a,
|
|
3598
3657
|
sequence: i.sequence ?? 0,
|
|
@@ -3600,19 +3659,19 @@ async function yr(e, t, n, r) {
|
|
|
3600
3659
|
status: "waiting"
|
|
3601
3660
|
});
|
|
3602
3661
|
}
|
|
3603
|
-
function
|
|
3662
|
+
function xr(e, t) {
|
|
3604
3663
|
["complete", "exhausted"].includes(t.status) && t.items && (e.items = $(e.items, t.items)), t.next !== void 0 && (e.next = t.next), t.total !== void 0 && (e.total = t.total);
|
|
3605
3664
|
}
|
|
3606
|
-
function
|
|
3665
|
+
function Sr(e, t, n) {
|
|
3607
3666
|
let r = t.autofill;
|
|
3608
|
-
return !
|
|
3667
|
+
return !dr(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (xr(t, n), Object.assign(r, tr(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);
|
|
3609
3668
|
}
|
|
3610
|
-
function
|
|
3611
|
-
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill =
|
|
3669
|
+
function Cr(e, t, n) {
|
|
3670
|
+
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = cr(e, n), xr(t, n), !0);
|
|
3612
3671
|
}
|
|
3613
3672
|
//#endregion
|
|
3614
3673
|
//#region src/core/backlogRestore.ts
|
|
3615
|
-
async function
|
|
3674
|
+
async function wr(e, t, n) {
|
|
3616
3675
|
if (!e) return;
|
|
3617
3676
|
let r = new AbortController();
|
|
3618
3677
|
n(r);
|
|
@@ -3627,7 +3686,7 @@ async function Cr(e, t, n) {
|
|
|
3627
3686
|
}
|
|
3628
3687
|
//#endregion
|
|
3629
3688
|
//#region src/core/initialAutofill.ts
|
|
3630
|
-
async function
|
|
3689
|
+
async function Tr({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, onPages: i, options: a, signal: o, state: s }) {
|
|
3631
3690
|
let c = a.autofill;
|
|
3632
3691
|
if (!c) return;
|
|
3633
3692
|
let l = s.items.length;
|
|
@@ -3640,7 +3699,7 @@ async function wr({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3640
3699
|
return;
|
|
3641
3700
|
}
|
|
3642
3701
|
if (c.strategy === "backend") {
|
|
3643
|
-
await
|
|
3702
|
+
await br(c, s, {
|
|
3644
3703
|
cycleId: e,
|
|
3645
3704
|
feedKey: c.feedKey,
|
|
3646
3705
|
items: [...s.items],
|
|
@@ -3657,11 +3716,11 @@ async function wr({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3657
3716
|
s.autofill.status = "exhausted";
|
|
3658
3717
|
return;
|
|
3659
3718
|
}
|
|
3660
|
-
let u = await
|
|
3719
|
+
let u = await fr({
|
|
3661
3720
|
existingItems: s.items,
|
|
3662
3721
|
initialCursor: s.next,
|
|
3663
3722
|
loadPage: a.loadPage,
|
|
3664
|
-
maximumRequests:
|
|
3723
|
+
maximumRequests: ir(c, !1),
|
|
3665
3724
|
onCollection: n,
|
|
3666
3725
|
onDelayChange: (e) => {
|
|
3667
3726
|
t() && Object.assign(s.autofill, e);
|
|
@@ -3684,13 +3743,13 @@ async function wr({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3684
3743
|
}
|
|
3685
3744
|
//#endregion
|
|
3686
3745
|
//#region src/core/fill.ts
|
|
3687
|
-
function
|
|
3746
|
+
function Er(e) {
|
|
3688
3747
|
return "items" in e ? { items: e.items } : "pages" in e ? { pages: e.pages } : { until: "end" };
|
|
3689
3748
|
}
|
|
3690
|
-
function
|
|
3749
|
+
function Dr(e) {
|
|
3691
3750
|
return `${typeof e}:${String(e)}`;
|
|
3692
3751
|
}
|
|
3693
|
-
function
|
|
3752
|
+
function Or(e) {
|
|
3694
3753
|
if (!e || typeof e != "object") throw TypeError("Vibe fill target must be an object.");
|
|
3695
3754
|
if ("pages" in e) {
|
|
3696
3755
|
if (!Number.isInteger(e.pages) || e.pages <= 0) throw TypeError("Vibe fill pages must be a positive integer.");
|
|
@@ -3703,21 +3762,21 @@ function Dr(e) {
|
|
|
3703
3762
|
if ("until" in e && e.until === "end") return { until: "end" };
|
|
3704
3763
|
throw TypeError("Vibe fill target must be { items }, { pages }, or { until: 'end' }.");
|
|
3705
3764
|
}
|
|
3706
|
-
function
|
|
3765
|
+
function kr(e) {
|
|
3707
3766
|
if (!e) return;
|
|
3708
3767
|
if (e.strategy === "frontend") {
|
|
3709
|
-
|
|
3768
|
+
$n(e, "frontend fill");
|
|
3710
3769
|
return;
|
|
3711
3770
|
}
|
|
3712
3771
|
if (!e.feedKey.trim()) throw TypeError("Vibe backend fill requires a feedKey.");
|
|
3713
3772
|
let t = e.initialSession;
|
|
3714
3773
|
if (t) {
|
|
3715
3774
|
if (t.feedKey !== e.feedKey) throw TypeError("Vibe backend fill initialSession feedKey must match fill feedKey.");
|
|
3716
|
-
|
|
3775
|
+
Or(t.target);
|
|
3717
3776
|
}
|
|
3718
3777
|
}
|
|
3719
|
-
function
|
|
3720
|
-
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a =
|
|
3778
|
+
function Ar(e, t, n = !0) {
|
|
3779
|
+
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a = tr(i?.nextRequestAt);
|
|
3721
3780
|
return {
|
|
3722
3781
|
completedPages: i?.completedPages ?? 0,
|
|
3723
3782
|
cycleId: i?.cycleId ?? null,
|
|
@@ -3730,10 +3789,10 @@ function kr(e, t, n = !0) {
|
|
|
3730
3789
|
sessionId: i?.sessionId ?? null,
|
|
3731
3790
|
status: i?.status ?? "idle",
|
|
3732
3791
|
strategy: e?.strategy ?? null,
|
|
3733
|
-
target: i ?
|
|
3792
|
+
target: i ? Er(i.target) : null
|
|
3734
3793
|
};
|
|
3735
3794
|
}
|
|
3736
|
-
function
|
|
3795
|
+
function jr(e) {
|
|
3737
3796
|
return [
|
|
3738
3797
|
"cancelling",
|
|
3739
3798
|
"filling",
|
|
@@ -3741,7 +3800,7 @@ function Ar(e) {
|
|
|
3741
3800
|
"waiting"
|
|
3742
3801
|
].includes(e.status);
|
|
3743
3802
|
}
|
|
3744
|
-
async function
|
|
3803
|
+
async function Mr({ existingItems: e, initialCursor: t, loadPage: n, onCollection: r = () => void 0, onDelayChange: i, onProgress: a, options: o, shouldPause: s = () => !1, signal: c, target: l }) {
|
|
3745
3804
|
let u = [], d = [], f = [...e], p = /* @__PURE__ */ new Set(), m = 0, h = t, g = t, _ = t, v = 0, y;
|
|
3746
3805
|
if ("items" in l && f.length >= l.items) return {
|
|
3747
3806
|
completedPages: m,
|
|
@@ -3753,10 +3812,10 @@ async function jr({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
3753
3812
|
status: "complete"
|
|
3754
3813
|
};
|
|
3755
3814
|
for (; _ !== null;) {
|
|
3756
|
-
let e =
|
|
3815
|
+
let e = Dr(h);
|
|
3757
3816
|
if (p.has(e)) throw Error("Vibe fill received a repeated cursor.");
|
|
3758
|
-
if (p.add(e), await
|
|
3759
|
-
delayMs:
|
|
3817
|
+
if (p.add(e), await nr({
|
|
3818
|
+
delayMs: er(m, o),
|
|
3760
3819
|
onChange: i,
|
|
3761
3820
|
signal: c
|
|
3762
3821
|
}), m > 0 && s()) return {
|
|
@@ -3769,7 +3828,7 @@ async function jr({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
3769
3828
|
status: "paused",
|
|
3770
3829
|
total: y
|
|
3771
3830
|
};
|
|
3772
|
-
let t =
|
|
3831
|
+
let t = Hn(await n({
|
|
3773
3832
|
cursor: h,
|
|
3774
3833
|
signal: c
|
|
3775
3834
|
}));
|
|
@@ -3837,12 +3896,12 @@ async function jr({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
3837
3896
|
}
|
|
3838
3897
|
//#endregion
|
|
3839
3898
|
//#region src/core/backendFill.ts
|
|
3840
|
-
async function
|
|
3899
|
+
async function Nr(e, t, n, r) {
|
|
3841
3900
|
let i = await e.onStart(n);
|
|
3842
3901
|
if (r()) {
|
|
3843
3902
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend fill requires a sessionId.");
|
|
3844
3903
|
Object.assign(t.fill, {
|
|
3845
|
-
...
|
|
3904
|
+
...tr(i.nextRequestAt),
|
|
3846
3905
|
completedPages: i.completedPages ?? 0,
|
|
3847
3906
|
received: i.received ?? 0,
|
|
3848
3907
|
sequence: i.sequence ?? 0,
|
|
@@ -3851,23 +3910,23 @@ async function Mr(e, t, n, r) {
|
|
|
3851
3910
|
});
|
|
3852
3911
|
}
|
|
3853
3912
|
}
|
|
3854
|
-
function
|
|
3913
|
+
function Pr(e, t, n) {
|
|
3855
3914
|
return e?.strategy === "backend" && n.feedKey === e.feedKey && n.sessionId === t.fill.sessionId;
|
|
3856
3915
|
}
|
|
3857
|
-
function
|
|
3916
|
+
function Fr(e) {
|
|
3858
3917
|
return Number.isInteger(e.completedPages) && e.completedPages >= 0 && Number.isInteger(e.received) && e.received >= 0 && Number.isInteger(e.sequence) && e.sequence >= 0;
|
|
3859
3918
|
}
|
|
3860
|
-
function
|
|
3919
|
+
function Ir(e, t) {
|
|
3861
3920
|
if (!["complete", "exhausted"].includes(t.status)) return !0;
|
|
3862
3921
|
let n = e.fill.target;
|
|
3863
3922
|
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;
|
|
3864
3923
|
}
|
|
3865
|
-
function
|
|
3924
|
+
function Lr(e, t, n) {
|
|
3866
3925
|
t.total !== void 0 && (e.total = t.total), ["complete", "exhausted"].includes(t.status) && (e.items = $(e.items, t.items ?? []), e.next = t.next ?? null, n(t.lastCursor ?? null));
|
|
3867
3926
|
}
|
|
3868
|
-
function
|
|
3869
|
-
return !
|
|
3870
|
-
...
|
|
3927
|
+
function Rr(e, t, n, r) {
|
|
3928
|
+
return !Pr(e, t, n) || !Fr(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !Ir(t, n) ? !1 : (Lr(t, n, r), Object.assign(t.fill, {
|
|
3929
|
+
...tr(n.status === "waiting" ? n.nextRequestAt : null),
|
|
3871
3930
|
completedPages: n.completedPages,
|
|
3872
3931
|
error: n.error ?? null,
|
|
3873
3932
|
received: n.received,
|
|
@@ -3875,45 +3934,45 @@ function Lr(e, t, n, r) {
|
|
|
3875
3934
|
status: n.status
|
|
3876
3935
|
}), !0);
|
|
3877
3936
|
}
|
|
3878
|
-
function
|
|
3937
|
+
function zr(e, t, n, r) {
|
|
3879
3938
|
if (e?.strategy !== "backend" || n.feedKey !== e.feedKey) return !1;
|
|
3880
3939
|
let i = t.fill;
|
|
3881
|
-
return t.fill =
|
|
3940
|
+
return t.fill = Ar(e, n), !Fr(n) || !Ir(t, n) ? (t.fill = i, !1) : (Lr(t, n, r), !0);
|
|
3882
3941
|
}
|
|
3883
3942
|
//#endregion
|
|
3884
3943
|
//#region src/core/fillController.ts
|
|
3885
|
-
var
|
|
3944
|
+
var Br = class {
|
|
3886
3945
|
abortController = null;
|
|
3887
3946
|
cycle = 0;
|
|
3888
3947
|
delayCountdown;
|
|
3889
3948
|
requestVersion = 0;
|
|
3890
3949
|
collection = null;
|
|
3891
3950
|
constructor(e) {
|
|
3892
|
-
this.options = e, this.delayCountdown = new
|
|
3951
|
+
this.options = e, this.delayCountdown = new rr((e) => {
|
|
3893
3952
|
Object.assign(this.options.state.fill, e);
|
|
3894
3953
|
}), this.syncBackendCountdown();
|
|
3895
3954
|
}
|
|
3896
3955
|
isActive() {
|
|
3897
|
-
return
|
|
3956
|
+
return jr(this.options.state.fill);
|
|
3898
3957
|
}
|
|
3899
3958
|
applyUpdate(e) {
|
|
3900
|
-
let t =
|
|
3959
|
+
let t = Rr(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
3901
3960
|
return t && this.syncBackendCountdown(), t;
|
|
3902
3961
|
}
|
|
3903
3962
|
restoreSession(e) {
|
|
3904
|
-
let t =
|
|
3963
|
+
let t = zr(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
3905
3964
|
return t && this.syncBackendCountdown(), t;
|
|
3906
3965
|
}
|
|
3907
3966
|
async start(e, t = {}) {
|
|
3908
3967
|
let n = this.options.fill;
|
|
3909
3968
|
if (!n) throw Error("Vibe fill is not configured.");
|
|
3910
3969
|
if (this.isActive()) throw Error("Vibe fill is already active.");
|
|
3911
|
-
let r =
|
|
3970
|
+
let r = Or(e), i = Or(t.target ?? r), a = t.progressOffset ?? {
|
|
3912
3971
|
completedPages: 0,
|
|
3913
3972
|
received: 0
|
|
3914
3973
|
}, o = t.cycleId ?? `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
3915
3974
|
if (this.options.state.fill = {
|
|
3916
|
-
...
|
|
3975
|
+
...Ar(n, void 0, !1),
|
|
3917
3976
|
completedPages: a.completedPages,
|
|
3918
3977
|
cycleId: o,
|
|
3919
3978
|
received: a.received,
|
|
@@ -3926,7 +3985,7 @@ var zr = class {
|
|
|
3926
3985
|
let s = ++this.requestVersion, c = new AbortController();
|
|
3927
3986
|
this.abortController = c;
|
|
3928
3987
|
try {
|
|
3929
|
-
n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await
|
|
3988
|
+
n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await Nr(n, this.options.state, {
|
|
3930
3989
|
cycleId: o,
|
|
3931
3990
|
feedKey: n.feedKey,
|
|
3932
3991
|
items: [...this.options.state.items],
|
|
@@ -3944,7 +4003,7 @@ var zr = class {
|
|
|
3944
4003
|
}
|
|
3945
4004
|
async cancel() {
|
|
3946
4005
|
let { fill: e, state: t } = this.options;
|
|
3947
|
-
if (!
|
|
4006
|
+
if (!jr(t.fill) || !t.fill.cycleId) return;
|
|
3948
4007
|
let n = {
|
|
3949
4008
|
cycleId: t.fill.cycleId,
|
|
3950
4009
|
feedKey: t.fill.feedKey ?? "",
|
|
@@ -3988,7 +4047,7 @@ var zr = class {
|
|
|
3988
4047
|
});
|
|
3989
4048
|
}
|
|
3990
4049
|
reset() {
|
|
3991
|
-
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill =
|
|
4050
|
+
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = Ar(this.options.fill, void 0, !1), this.collection = null;
|
|
3992
4051
|
}
|
|
3993
4052
|
destroy() {
|
|
3994
4053
|
this.abortLocalRequest(), this.delayCountdown.clear();
|
|
@@ -4023,7 +4082,7 @@ var zr = class {
|
|
|
4023
4082
|
s.fill.status = "until" in t ? "complete" : "exhausted";
|
|
4024
4083
|
return;
|
|
4025
4084
|
}
|
|
4026
|
-
let c = await
|
|
4085
|
+
let c = await Mr({
|
|
4027
4086
|
existingItems: s.items,
|
|
4028
4087
|
initialCursor: s.next,
|
|
4029
4088
|
loadPage: o,
|
|
@@ -4071,7 +4130,7 @@ var zr = class {
|
|
|
4071
4130
|
};
|
|
4072
4131
|
//#endregion
|
|
4073
4132
|
//#region src/core/fillReconciliation.ts
|
|
4074
|
-
async function
|
|
4133
|
+
async function Vr({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r, pauseWhenManual: i = !1, setLastCursor: a, signal: o, state: s }) {
|
|
4075
4134
|
if (!e.needsReconciliation(s.items)) return "skipped";
|
|
4076
4135
|
let c = await e.reconcile({
|
|
4077
4136
|
existingItems: s.items,
|
|
@@ -4084,7 +4143,7 @@ async function Br({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r,
|
|
|
4084
4143
|
}
|
|
4085
4144
|
//#endregion
|
|
4086
4145
|
//#region src/core/feedFooter.ts
|
|
4087
|
-
function
|
|
4146
|
+
function Hr(e) {
|
|
4088
4147
|
return {
|
|
4089
4148
|
cancelAutofill: () => e.cancelAutofill(),
|
|
4090
4149
|
loadMore: () => e.loadNext(),
|
|
@@ -4096,46 +4155,46 @@ function Vr(e) {
|
|
|
4096
4155
|
retryFill: () => e.retryFill()
|
|
4097
4156
|
};
|
|
4098
4157
|
}
|
|
4099
|
-
function Hr(e) {
|
|
4100
|
-
if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
|
|
4101
|
-
}
|
|
4102
4158
|
function Ur(e) {
|
|
4103
|
-
e
|
|
4159
|
+
if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
|
|
4104
4160
|
}
|
|
4105
4161
|
function Wr(e) {
|
|
4162
|
+
e?.intervalMs !== void 0 && Ur(e.intervalMs);
|
|
4163
|
+
}
|
|
4164
|
+
function Gr(e) {
|
|
4106
4165
|
return {
|
|
4107
4166
|
enabled: e?.enabled ?? !1,
|
|
4108
4167
|
includePostItems: e?.includePostItems ?? !1,
|
|
4109
4168
|
intervalMs: e?.intervalMs ?? 5e3
|
|
4110
4169
|
};
|
|
4111
4170
|
}
|
|
4112
|
-
function
|
|
4171
|
+
function Kr(e, t) {
|
|
4113
4172
|
if (typeof t == "boolean") {
|
|
4114
4173
|
e.enabled = t;
|
|
4115
4174
|
return;
|
|
4116
4175
|
}
|
|
4117
|
-
|
|
4176
|
+
Wr(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);
|
|
4118
4177
|
}
|
|
4119
4178
|
//#endregion
|
|
4120
4179
|
//#region src/core/reelInfoSheet.ts
|
|
4121
|
-
function
|
|
4180
|
+
function qr(e) {
|
|
4122
4181
|
return { enabled: e?.enabled ?? !1 };
|
|
4123
4182
|
}
|
|
4124
|
-
function
|
|
4183
|
+
function Jr(e, t, n) {
|
|
4125
4184
|
if (n && !t) throw Error("Vibe cannot enable reelInfoSheet without a configured component.");
|
|
4126
4185
|
e.enabled = n;
|
|
4127
4186
|
}
|
|
4128
4187
|
//#endregion
|
|
4129
4188
|
//#region src/core/initialRuntimeState.ts
|
|
4130
|
-
function
|
|
4189
|
+
function Yr(e, t) {
|
|
4131
4190
|
let n = e.initialPage;
|
|
4132
4191
|
return {
|
|
4133
4192
|
activeReelPostId: null,
|
|
4134
|
-
autoScroll:
|
|
4135
|
-
autofill:
|
|
4193
|
+
autoScroll: vr(e.autoScroll),
|
|
4194
|
+
autofill: cr(e.autofill),
|
|
4136
4195
|
current: n?.current ?? null,
|
|
4137
4196
|
error: null,
|
|
4138
|
-
fill:
|
|
4197
|
+
fill: Ar(e.fill),
|
|
4139
4198
|
infiniteScroll: e.infiniteScroll ?? !0,
|
|
4140
4199
|
isLoading: !n,
|
|
4141
4200
|
isLoadingMore: !1,
|
|
@@ -4146,14 +4205,14 @@ function Jr(e, t) {
|
|
|
4146
4205
|
next: n?.next ?? null,
|
|
4147
4206
|
nextPageError: null,
|
|
4148
4207
|
phoneMode: !1,
|
|
4149
|
-
reelAutoAdvance:
|
|
4208
|
+
reelAutoAdvance: Gr(e.reelAutoAdvance),
|
|
4150
4209
|
reelForward: {
|
|
4151
4210
|
error: null,
|
|
4152
4211
|
status: "idle"
|
|
4153
4212
|
},
|
|
4154
4213
|
reelForwardIndex: null,
|
|
4155
4214
|
reelForwardItem: null,
|
|
4156
|
-
reelInfoSheet:
|
|
4215
|
+
reelInfoSheet: qr(e.reelInfoSheet),
|
|
4157
4216
|
reelInfoSheetOverlay: !1,
|
|
4158
4217
|
reelMediaSource: "original",
|
|
4159
4218
|
reelOrigin: null,
|
|
@@ -4162,21 +4221,21 @@ function Jr(e, t) {
|
|
|
4162
4221
|
}
|
|
4163
4222
|
//#endregion
|
|
4164
4223
|
//#region src/core/options.ts
|
|
4165
|
-
function
|
|
4224
|
+
function Xr(e, t) {
|
|
4166
4225
|
if (t) {
|
|
4167
4226
|
if (!Number.isFinite(t.height) || t.height <= 0) throw TypeError(`Vibe ${e} height must be a positive number.`);
|
|
4168
4227
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe ${e} background must be "default" or "transparent".`);
|
|
4169
4228
|
}
|
|
4170
4229
|
}
|
|
4171
|
-
function
|
|
4230
|
+
function Zr(e, t) {
|
|
4172
4231
|
if (t) {
|
|
4173
4232
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe mediaCard ${e} background must be "default" or "transparent".`);
|
|
4174
4233
|
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.`);
|
|
4175
4234
|
}
|
|
4176
4235
|
}
|
|
4177
|
-
function
|
|
4178
|
-
if (
|
|
4179
|
-
if (
|
|
4236
|
+
function Qr(e) {
|
|
4237
|
+
if (_r(e.autoScroll), Xr("cardHeader", e.cardHeader), Xr("cardFooter", e.cardFooter), Zr("header", e.mediaCard?.header), Zr("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\".");
|
|
4238
|
+
if (sr(e.autofill), kr(e.fill), ke(e.masonry), Wr(e.reelAutoAdvance), e.removalReconciliation) {
|
|
4180
4239
|
if (!Number.isInteger(e.removalReconciliation.pageSize) || e.removalReconciliation.pageSize <= 0) throw TypeError("Vibe removalReconciliation pageSize must be a positive integer.");
|
|
4181
4240
|
let t = e.removalReconciliation.maxReplayPages ?? 5;
|
|
4182
4241
|
if (!Number.isInteger(t) || t <= 0) throw TypeError("Vibe removalReconciliation maxReplayPages must be a positive integer.");
|
|
@@ -4191,7 +4250,7 @@ function Zr(e) {
|
|
|
4191
4250
|
if (e.fill?.strategy === "frontend" && !e.loadPage) throw TypeError("Vibe frontend fill requires loadPage.");
|
|
4192
4251
|
if (e.fill?.strategy === "backend" && e.fill.initialSession && !e.initialPage) throw TypeError("Vibe backend fill restoration requires initialPage.");
|
|
4193
4252
|
}
|
|
4194
|
-
function
|
|
4253
|
+
function $r(e) {
|
|
4195
4254
|
if (typeof e != "string") return e;
|
|
4196
4255
|
if (typeof document > "u") throw Error("Vibe cannot resolve a selector without a document.");
|
|
4197
4256
|
let t = document.querySelector(e);
|
|
@@ -4200,7 +4259,7 @@ function Qr(e) {
|
|
|
4200
4259
|
}
|
|
4201
4260
|
//#endregion
|
|
4202
4261
|
//#region src/core/pageRequest.ts
|
|
4203
|
-
async function
|
|
4262
|
+
async function ei({ append: e, autofillController: t, cursor: n, isCurrent: r, loadPage: i, onLastCursor: a, onPages: o, options: s, signal: c, state: l }) {
|
|
4204
4263
|
let u = s.autofill, d = e && u?.strategy === "frontend" && (l.autofill.status === "paused" || l.autofill.status === "error"), f = d ? {
|
|
4205
4264
|
received: l.autofill.received,
|
|
4206
4265
|
requests: l.autofill.requests
|
|
@@ -4212,11 +4271,11 @@ async function $r({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
4212
4271
|
let m = !1;
|
|
4213
4272
|
try {
|
|
4214
4273
|
if (u?.strategy === "frontend") {
|
|
4215
|
-
let s = await
|
|
4274
|
+
let s = await fr({
|
|
4216
4275
|
existingItems: e ? l.items : [],
|
|
4217
4276
|
initialCursor: n,
|
|
4218
4277
|
loadPage: i,
|
|
4219
|
-
maximumRequests: f ? Math.max(0,
|
|
4278
|
+
maximumRequests: f ? Math.max(0, ir(u) - f.requests) : void 0,
|
|
4220
4279
|
onCollection: (e) => t.captureCollection(e, r()),
|
|
4221
4280
|
onDelayChange: (e) => {
|
|
4222
4281
|
r() && Object.assign(l.autofill, e);
|
|
@@ -4239,7 +4298,7 @@ async function $r({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
4239
4298
|
}), o(s.pages), t.clearCollection();
|
|
4240
4299
|
return;
|
|
4241
4300
|
}
|
|
4242
|
-
let s =
|
|
4301
|
+
let s = Hn(await i({
|
|
4243
4302
|
cursor: n,
|
|
4244
4303
|
signal: c
|
|
4245
4304
|
}));
|
|
@@ -4259,7 +4318,7 @@ async function $r({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
4259
4318
|
l.autofill.status = "complete";
|
|
4260
4319
|
return;
|
|
4261
4320
|
}
|
|
4262
|
-
await
|
|
4321
|
+
await br(u, l, {
|
|
4263
4322
|
cycleId: p,
|
|
4264
4323
|
feedKey: u.feedKey,
|
|
4265
4324
|
items: h.slice(d.length),
|
|
@@ -4280,17 +4339,76 @@ async function $r({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
4280
4339
|
}
|
|
4281
4340
|
}
|
|
4282
4341
|
//#endregion
|
|
4342
|
+
//#region src/core/pageReplacement.ts
|
|
4343
|
+
var ti = class {
|
|
4344
|
+
controller = null;
|
|
4345
|
+
constructor(e) {
|
|
4346
|
+
this.options = e;
|
|
4347
|
+
}
|
|
4348
|
+
isActive() {
|
|
4349
|
+
return this.controller !== null;
|
|
4350
|
+
}
|
|
4351
|
+
cancel() {
|
|
4352
|
+
this.controller?.abort(), this.controller = null, this.options.surface()?.cancelItemRemoval();
|
|
4353
|
+
}
|
|
4354
|
+
async replace(e, t) {
|
|
4355
|
+
let n = Hn(e);
|
|
4356
|
+
this.cancel();
|
|
4357
|
+
let r = new AbortController();
|
|
4358
|
+
this.controller = r;
|
|
4359
|
+
try {
|
|
4360
|
+
if (await this.options.prepare(), r.signal.aborted) return;
|
|
4361
|
+
let e = this.options.state, i = new Map(e.items.map((e) => [String(e.postId), e])), a = [], o = /* @__PURE__ */ new Set();
|
|
4362
|
+
for (let e of n.items) {
|
|
4363
|
+
let t = String(e.postId);
|
|
4364
|
+
o.has(t) || (o.add(t), a.push({
|
|
4365
|
+
...e,
|
|
4366
|
+
postId: i.get(t)?.postId ?? e.postId
|
|
4367
|
+
}));
|
|
4368
|
+
}
|
|
4369
|
+
let s = e.items.filter((e) => !o.has(String(e.postId))).map((e) => e.postId);
|
|
4370
|
+
if (await this.options.surface()?.animateItemRemoval(s, r.signal), r.signal.aborted) return;
|
|
4371
|
+
if (t?.resetScroll) {
|
|
4372
|
+
let e = this.options.surface()?.getAutoScrollElement();
|
|
4373
|
+
e && (e.scrollTop = 0);
|
|
4374
|
+
}
|
|
4375
|
+
e.mediaIndices = new Map(a.map((t) => [t.postId, H(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({
|
|
4376
|
+
...n,
|
|
4377
|
+
items: a
|
|
4378
|
+
});
|
|
4379
|
+
} finally {
|
|
4380
|
+
this.controller === r && (this.controller = null, this.options.surface()?.cancelItemRemoval());
|
|
4381
|
+
}
|
|
4382
|
+
}
|
|
4383
|
+
};
|
|
4384
|
+
//#endregion
|
|
4385
|
+
//#region src/core/loadingLock.ts
|
|
4386
|
+
function ni(e, t, n) {
|
|
4387
|
+
if (e.loadMoreLocked !== t && (e.loadMoreLocked = t, !t)) {
|
|
4388
|
+
if (e.fill.status === "paused" && e.fill.target) {
|
|
4389
|
+
n.resumeFill();
|
|
4390
|
+
return;
|
|
4391
|
+
}
|
|
4392
|
+
if (e.autofill.status === "paused" || n.hasPendingSession()) {
|
|
4393
|
+
let e = n.getPending();
|
|
4394
|
+
e ? e.finally(() => {
|
|
4395
|
+
n.loadNext();
|
|
4396
|
+
}) : n.loadNext();
|
|
4397
|
+
} else e.infiniteScroll && m(n.loadIfNearBottom);
|
|
4398
|
+
}
|
|
4399
|
+
}
|
|
4400
|
+
//#endregion
|
|
4283
4401
|
//#region src/core/removalReconciliationController.ts
|
|
4284
|
-
function
|
|
4402
|
+
function ri(e) {
|
|
4285
4403
|
return `${typeof e}:${String(e)}`;
|
|
4286
4404
|
}
|
|
4287
|
-
function
|
|
4405
|
+
function ii(e) {
|
|
4288
4406
|
return `${typeof e}:${String(e)}`;
|
|
4289
4407
|
}
|
|
4290
|
-
function
|
|
4408
|
+
function ai(e) {
|
|
4291
4409
|
return e.map(({ postId: e }) => e);
|
|
4292
4410
|
}
|
|
4293
|
-
var
|
|
4411
|
+
var oi = class {
|
|
4294
4412
|
delay;
|
|
4295
4413
|
enabled;
|
|
4296
4414
|
maxReplayPages;
|
|
@@ -4309,7 +4427,7 @@ var ri = class {
|
|
|
4309
4427
|
e.status === "complete" && (this.pages = [...this.pages.slice(0, e.replaceFrom), ...e.pages].slice(-this.maxReplayPages), this.pending = null);
|
|
4310
4428
|
}
|
|
4311
4429
|
filterItems(e) {
|
|
4312
|
-
return this.tombstones.size === 0 ? [...e] : e.filter(({ postId: e }) => !this.tombstones.has(
|
|
4430
|
+
return this.tombstones.size === 0 ? [...e] : e.filter(({ postId: e }) => !this.tombstones.has(ri(e)));
|
|
4313
4431
|
}
|
|
4314
4432
|
needsReconciliation(e) {
|
|
4315
4433
|
return this.pending !== null || this.findUnderfilledPage(e) >= 0;
|
|
@@ -4322,45 +4440,45 @@ var ri = class {
|
|
|
4322
4440
|
}
|
|
4323
4441
|
recordInitialPage(e) {
|
|
4324
4442
|
e && this.recordPages([{
|
|
4325
|
-
contributionIds:
|
|
4326
|
-
cursor:
|
|
4443
|
+
contributionIds: ai(e.items),
|
|
4444
|
+
cursor: Kn(e),
|
|
4327
4445
|
next: e.next,
|
|
4328
|
-
returnedIds:
|
|
4446
|
+
returnedIds: ai(e.items)
|
|
4329
4447
|
}]);
|
|
4330
4448
|
}
|
|
4331
4449
|
remove(e) {
|
|
4332
|
-
e.forEach((e) => this.tombstones.add(
|
|
4450
|
+
e.forEach((e) => this.tombstones.add(ri(e)));
|
|
4333
4451
|
}
|
|
4334
4452
|
reset() {
|
|
4335
4453
|
this.pages = [], this.pending = null, this.tombstones.clear();
|
|
4336
4454
|
}
|
|
4337
4455
|
restore(e) {
|
|
4338
|
-
e.forEach((e) => this.tombstones.delete(
|
|
4456
|
+
e.forEach((e) => this.tombstones.delete(ri(e)));
|
|
4339
4457
|
}
|
|
4340
4458
|
async reconcile({ existingItems: e, loadPage: t, onDelayChange: n = () => void 0, shouldPause: r = () => !1, signal: i }) {
|
|
4341
4459
|
let a = this.pending ?? this.createSession(e);
|
|
4342
4460
|
for (this.pending = a; a.remainingRequests > 0;) {
|
|
4343
|
-
let e =
|
|
4461
|
+
let e = ii(a.cursor);
|
|
4344
4462
|
if (a.seenCursors.has(e)) throw Error("Vibe removal reconciliation received a repeated cursor.");
|
|
4345
|
-
if (await
|
|
4346
|
-
delayMs:
|
|
4463
|
+
if (await nr({
|
|
4464
|
+
delayMs: er(a.pages.length, this.delay),
|
|
4347
4465
|
onChange: n,
|
|
4348
4466
|
signal: i
|
|
4349
4467
|
}), a.pages.length > 0 && r()) return this.result(a, "paused");
|
|
4350
|
-
let o =
|
|
4468
|
+
let o = Hn(await t({
|
|
4351
4469
|
cursor: a.cursor,
|
|
4352
4470
|
signal: i
|
|
4353
4471
|
}));
|
|
4354
4472
|
a.seenCursors.add(e);
|
|
4355
4473
|
let s = this.filterItems(o.items), c = [];
|
|
4356
4474
|
if (s.forEach((e) => {
|
|
4357
|
-
let t =
|
|
4475
|
+
let t = ri(e.postId);
|
|
4358
4476
|
a.attributed.has(t) || (a.attributed.add(t), c.push(e.postId)), a.appended.has(t) || (a.appended.add(t), a.items.push(e));
|
|
4359
4477
|
}), a.pages.push({
|
|
4360
4478
|
contributionIds: c,
|
|
4361
4479
|
cursor: a.cursor,
|
|
4362
4480
|
next: o.next,
|
|
4363
|
-
returnedIds:
|
|
4481
|
+
returnedIds: ai(s)
|
|
4364
4482
|
}), 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");
|
|
4365
4483
|
}
|
|
4366
4484
|
return this.result(a, "complete");
|
|
@@ -4368,9 +4486,9 @@ var ri = class {
|
|
|
4368
4486
|
createSession(e) {
|
|
4369
4487
|
let t = this.findUnderfilledPage(e), n = t < 0 ? [] : this.pages.slice(t), r = n[0];
|
|
4370
4488
|
if (!r) throw Error("Vibe has no underfilled provider page to reconcile.");
|
|
4371
|
-
let i = new Set(n.flatMap(({ contributionIds: e }) => e.map(
|
|
4489
|
+
let i = new Set(n.flatMap(({ contributionIds: e }) => e.map(ri))), a = new Set(e.map(({ postId: e }) => ri(e)).filter((e) => !i.has(e)));
|
|
4372
4490
|
return {
|
|
4373
|
-
appended: new Set(e.map(({ postId: e }) =>
|
|
4491
|
+
appended: new Set(e.map(({ postId: e }) => ri(e))),
|
|
4374
4492
|
attributed: new Set(a),
|
|
4375
4493
|
cursor: r.cursor,
|
|
4376
4494
|
items: [],
|
|
@@ -4395,11 +4513,11 @@ var ri = class {
|
|
|
4395
4513
|
}
|
|
4396
4514
|
findUnderfilledPage(e) {
|
|
4397
4515
|
if (!this.enabled || this.pages.length === 0) return -1;
|
|
4398
|
-
let t = new Set(e.map(({ postId: e }) =>
|
|
4399
|
-
return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has(
|
|
4516
|
+
let t = new Set(e.map(({ postId: e }) => ri(e)));
|
|
4517
|
+
return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has(ri(e))).length < this.pageSize);
|
|
4400
4518
|
}
|
|
4401
4519
|
recordPage(e) {
|
|
4402
|
-
let t =
|
|
4520
|
+
let t = ii(e.cursor), n = this.pages.findIndex(({ cursor: e }) => ii(e) === t);
|
|
4403
4521
|
n >= 0 && (this.pages = this.pages.slice(0, n)), this.pages.push({
|
|
4404
4522
|
...e,
|
|
4405
4523
|
contributionIds: [...e.contributionIds],
|
|
@@ -4409,7 +4527,7 @@ var ri = class {
|
|
|
4409
4527
|
};
|
|
4410
4528
|
//#endregion
|
|
4411
4529
|
//#region src/core/activeItemRemoval.ts
|
|
4412
|
-
function
|
|
4530
|
+
function si(e, t, n, r, i) {
|
|
4413
4531
|
let a = new Set(t.map(({ item: e }) => e.postId));
|
|
4414
4532
|
if (e.activeReelPostId === null || !a.has(e.activeReelPostId)) return;
|
|
4415
4533
|
let o = e.items[Math.max(n, 0)];
|
|
@@ -4422,7 +4540,7 @@ function ii(e, t, n, r, i) {
|
|
|
4422
4540
|
}
|
|
4423
4541
|
//#endregion
|
|
4424
4542
|
//#region src/core/exactMediaRemovalController.ts
|
|
4425
|
-
function
|
|
4543
|
+
function ci(e, t) {
|
|
4426
4544
|
let [n, ...r] = t;
|
|
4427
4545
|
if (!n) throw Error("Vibe items must contain at least one media asset.");
|
|
4428
4546
|
return {
|
|
@@ -4431,10 +4549,10 @@ function ai(e, t) {
|
|
|
4431
4549
|
items: r
|
|
4432
4550
|
};
|
|
4433
4551
|
}
|
|
4434
|
-
function
|
|
4552
|
+
function li(e) {
|
|
4435
4553
|
if (!Number.isInteger(e.mediaIndex) || e.mediaIndex < 0) throw TypeError("Vibe mediaIndex must be a non-negative integer.");
|
|
4436
4554
|
}
|
|
4437
|
-
var
|
|
4555
|
+
var ui = class {
|
|
4438
4556
|
generation = 0;
|
|
4439
4557
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
4440
4558
|
state;
|
|
@@ -4442,10 +4560,10 @@ var si = class {
|
|
|
4442
4560
|
this.options = e, this.state = e.state;
|
|
4443
4561
|
}
|
|
4444
4562
|
remove(e) {
|
|
4445
|
-
|
|
4563
|
+
li(e);
|
|
4446
4564
|
let t = this.state.items.findIndex(({ postId: t }) => t === e.postId), n = this.state.items[t];
|
|
4447
4565
|
if (!n) return null;
|
|
4448
|
-
let r = [...
|
|
4566
|
+
let r = [...V(n)], i = r[e.mediaIndex];
|
|
4449
4567
|
if (!i) return null;
|
|
4450
4568
|
let a = Object.freeze({
|
|
4451
4569
|
media: i,
|
|
@@ -4459,7 +4577,7 @@ var si = class {
|
|
|
4459
4577
|
restored: !1
|
|
4460
4578
|
});
|
|
4461
4579
|
let o = this.state.mediaIndices.get(n.postId) ?? 0, s = this.isReelOpen() && this.state.activeReelPostId === n.postId, c = s && o === e.mediaIndex;
|
|
4462
|
-
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] =
|
|
4580
|
+
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);
|
|
4463
4581
|
}
|
|
4464
4582
|
reset() {
|
|
4465
4583
|
this.generation += 1;
|
|
@@ -4484,32 +4602,32 @@ var si = class {
|
|
|
4484
4602
|
return this.state.layout === "reel" || this.state.reelOrigin === "masonry";
|
|
4485
4603
|
}
|
|
4486
4604
|
restoreIntoPost(e, t) {
|
|
4487
|
-
let n = this.state.items[e], r = [...
|
|
4488
|
-
if (r.splice(i, 0, t.media), this.state.items[e] =
|
|
4605
|
+
let n = this.state.items[e], r = [...V(n)], i = Math.min(t.mediaIndex, r.length);
|
|
4606
|
+
if (r.splice(i, 0, t.media), this.state.items[e] = ci(n, r), this.state.activeReelPostId !== t.postId) return;
|
|
4489
4607
|
let a = this.state.mediaIndices.get(t.postId) ?? 0;
|
|
4490
4608
|
a >= i && this.state.mediaIndices.set(t.postId, a + 1);
|
|
4491
4609
|
}
|
|
4492
4610
|
updateMediaIndexAfterRemoval(e, t, n) {
|
|
4493
4611
|
let r = this.state.items.find((t) => t.postId === e);
|
|
4494
4612
|
if (!r) return;
|
|
4495
|
-
let i =
|
|
4613
|
+
let i = V(r).length, a = this.state.mediaIndices.get(e) ?? 0, o = a;
|
|
4496
4614
|
n ? o = t < i ? t : 0 : t < a && (o = a - 1), this.state.mediaIndices.set(e, Math.min(o, i - 1));
|
|
4497
4615
|
}
|
|
4498
4616
|
};
|
|
4499
4617
|
//#endregion
|
|
4500
4618
|
//#region src/core/itemPlacement.ts
|
|
4501
|
-
function
|
|
4619
|
+
function di(e, t) {
|
|
4502
4620
|
let n = new Set(t);
|
|
4503
4621
|
return e.flatMap((e, t) => n.has(e.postId) ? [{
|
|
4504
4622
|
index: t,
|
|
4505
4623
|
item: e
|
|
4506
4624
|
}] : []);
|
|
4507
4625
|
}
|
|
4508
|
-
function
|
|
4626
|
+
function fi(e, t) {
|
|
4509
4627
|
let n = new Set(t.map(({ item: e }) => e.postId));
|
|
4510
4628
|
return e.filter((e) => !n.has(e.postId));
|
|
4511
4629
|
}
|
|
4512
|
-
function
|
|
4630
|
+
function pi(e, t) {
|
|
4513
4631
|
t.forEach(({ index: e }) => {
|
|
4514
4632
|
if (!Number.isInteger(e) || e < 0) throw Error("Vibe item restore indexes must be non-negative integers.");
|
|
4515
4633
|
});
|
|
@@ -4520,7 +4638,7 @@ function ui(e, t) {
|
|
|
4520
4638
|
}
|
|
4521
4639
|
//#endregion
|
|
4522
4640
|
//#region src/core/itemRemovalController.ts
|
|
4523
|
-
var
|
|
4641
|
+
var mi = 20, hi = class {
|
|
4524
4642
|
generation = 0;
|
|
4525
4643
|
historyLimit;
|
|
4526
4644
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
@@ -4529,7 +4647,7 @@ var di = 20, fi = class {
|
|
|
4529
4647
|
itemOrder;
|
|
4530
4648
|
stopItemsWatcher;
|
|
4531
4649
|
constructor(e) {
|
|
4532
|
-
this.options = e, this.historyLimit = e.historyLimit ??
|
|
4650
|
+
this.options = e, this.historyLimit = e.historyLimit ?? mi, this.state = e.state, this.itemOrder = this.state.items.map(({ postId: e }) => e), this.stopItemsWatcher = O(() => this.state.items, (e) => this.appendUnknownItems(e), { flush: "sync" });
|
|
4533
4651
|
}
|
|
4534
4652
|
destroy() {
|
|
4535
4653
|
this.reset(), this.stopItemsWatcher();
|
|
@@ -4543,7 +4661,7 @@ var di = 20, fi = class {
|
|
|
4543
4661
|
let a = this.options.startRemoval(i, t);
|
|
4544
4662
|
if (a > 0 && await new Promise((e) => setTimeout(e, a)), this.metadata.get(r)?.generation !== this.generation) return r;
|
|
4545
4663
|
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);
|
|
4546
|
-
return this.state.items =
|
|
4664
|
+
return this.state.items = fi(this.state.items, n), this.options.onItemsRemoved(r, n, l), this.record(r), r;
|
|
4547
4665
|
}
|
|
4548
4666
|
reset() {
|
|
4549
4667
|
this.generation += 1, this.history = [], this.itemOrder = [];
|
|
@@ -4554,7 +4672,7 @@ var di = 20, fi = class {
|
|
|
4554
4672
|
this.restoreRemoval(t);
|
|
4555
4673
|
return;
|
|
4556
4674
|
}
|
|
4557
|
-
let n = new Set(this.state.items.map(({ postId: e }) => e)), r = e.filter(({ item: e }) => n.has(e.postId) ? !1 : (n.add(e.postId), !0)), i =
|
|
4675
|
+
let n = new Set(this.state.items.map(({ postId: e }) => e)), r = e.filter(({ item: e }) => n.has(e.postId) ? !1 : (n.add(e.postId), !0)), i = pi(this.state.items, r);
|
|
4558
4676
|
this.registerExternalPlacements(r), this.state.items = i, r.length > 0 && this.options.onRemovalRestored(r);
|
|
4559
4677
|
}
|
|
4560
4678
|
restoreRemoval(e) {
|
|
@@ -4580,7 +4698,7 @@ var di = 20, fi = class {
|
|
|
4580
4698
|
}
|
|
4581
4699
|
collectOrderedPlacements(e) {
|
|
4582
4700
|
let t = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
4583
|
-
return
|
|
4701
|
+
return di(this.state.items, e).map((e) => ({
|
|
4584
4702
|
index: t.get(e.item.postId) ?? e.index,
|
|
4585
4703
|
item: e.item
|
|
4586
4704
|
}));
|
|
@@ -4611,7 +4729,7 @@ var di = 20, fi = class {
|
|
|
4611
4729
|
let r = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
4612
4730
|
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;
|
|
4613
4731
|
}
|
|
4614
|
-
},
|
|
4732
|
+
}, gi = class {
|
|
4615
4733
|
forward = null;
|
|
4616
4734
|
forwardPromise = null;
|
|
4617
4735
|
forwardVersion = 0;
|
|
@@ -4707,7 +4825,7 @@ var di = 20, fi = class {
|
|
|
4707
4825
|
}
|
|
4708
4826
|
}
|
|
4709
4827
|
}
|
|
4710
|
-
},
|
|
4828
|
+
}, _i = class {
|
|
4711
4829
|
generation = 0;
|
|
4712
4830
|
pending = Promise.resolve();
|
|
4713
4831
|
constructor(e) {
|
|
@@ -4724,7 +4842,7 @@ var di = 20, fi = class {
|
|
|
4724
4842
|
if (!n) return;
|
|
4725
4843
|
let r = t.mediaIndices.get(e.postId) ?? 0;
|
|
4726
4844
|
if (e.mediaIndex === r) {
|
|
4727
|
-
if (
|
|
4845
|
+
if (V(n).length > 1) {
|
|
4728
4846
|
await this.options.transitionMedia(1);
|
|
4729
4847
|
return;
|
|
4730
4848
|
}
|
|
@@ -4757,24 +4875,24 @@ var di = 20, fi = class {
|
|
|
4757
4875
|
};
|
|
4758
4876
|
//#endregion
|
|
4759
4877
|
//#region src/core/removalControllers.ts
|
|
4760
|
-
function
|
|
4761
|
-
let t = new
|
|
4878
|
+
function vi(e) {
|
|
4879
|
+
let t = new gi(e), n = new _i({
|
|
4762
4880
|
state: e.state,
|
|
4763
4881
|
transitionMedia: (t) => e.surface()?.transitionActiveReelMedia(t) ?? Promise.resolve(!1),
|
|
4764
4882
|
transitionPost: (t) => e.surface()?.transitionActiveReelPost(t) ?? Promise.resolve(!1)
|
|
4765
4883
|
});
|
|
4766
4884
|
return {
|
|
4767
|
-
exactMediaRemoval: new
|
|
4885
|
+
exactMediaRemoval: new ui({
|
|
4768
4886
|
onActivate: e.onActivate,
|
|
4769
4887
|
onPostRemoved: (t) => e.onItemsRemoved([t]),
|
|
4770
4888
|
onPostRestored: (t) => e.onItemsRestored([t]),
|
|
4771
4889
|
reelForward: t,
|
|
4772
4890
|
state: e.state
|
|
4773
4891
|
}),
|
|
4774
|
-
itemRemoval: new
|
|
4892
|
+
itemRemoval: new hi({
|
|
4775
4893
|
historyLimit: e.historyLimit,
|
|
4776
4894
|
onItemsRemoved: (n, r, i) => {
|
|
4777
|
-
e.onItemsRemoved(r.map(({ item: e }) => e.postId)),
|
|
4895
|
+
e.onItemsRemoved(r.map(({ item: e }) => e.postId)), si(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
|
|
4778
4896
|
},
|
|
4779
4897
|
onRemovalRestored: (n) => {
|
|
4780
4898
|
e.onItemsRestored(n.map(({ item: e }) => e.postId));
|
|
@@ -4789,17 +4907,17 @@ function hi(e) {
|
|
|
4789
4907
|
reelRemoval: n
|
|
4790
4908
|
};
|
|
4791
4909
|
}
|
|
4792
|
-
var
|
|
4793
|
-
function
|
|
4910
|
+
var yi = 1.5;
|
|
4911
|
+
function bi(e) {
|
|
4794
4912
|
let t = Math.min(e.screenWidth, e.screenHeight);
|
|
4795
4913
|
if (t > 0 && t < 600) return !0;
|
|
4796
|
-
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n *
|
|
4914
|
+
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * yi;
|
|
4797
4915
|
return !e.hasHover && n > 0 && n < 600 && r;
|
|
4798
4916
|
}
|
|
4799
|
-
function
|
|
4800
|
-
return
|
|
4917
|
+
function xi(e) {
|
|
4918
|
+
return bi(e) ? "reel" : "masonry";
|
|
4801
4919
|
}
|
|
4802
|
-
function
|
|
4920
|
+
function Si(e) {
|
|
4803
4921
|
let t = e.ownerDocument.defaultView, n = e.ownerDocument.documentElement;
|
|
4804
4922
|
return {
|
|
4805
4923
|
hasHover: typeof t?.matchMedia == "function" && t.matchMedia("(hover: hover)").matches,
|
|
@@ -4809,15 +4927,15 @@ function yi(e) {
|
|
|
4809
4927
|
viewportWidth: n.clientWidth
|
|
4810
4928
|
};
|
|
4811
4929
|
}
|
|
4812
|
-
function
|
|
4813
|
-
return
|
|
4930
|
+
function Ci(e) {
|
|
4931
|
+
return bi(Si(e));
|
|
4814
4932
|
}
|
|
4815
|
-
function
|
|
4816
|
-
return
|
|
4933
|
+
function wi(e) {
|
|
4934
|
+
return xi(Si(e));
|
|
4817
4935
|
}
|
|
4818
4936
|
//#endregion
|
|
4819
4937
|
//#region src/core/responsiveLayoutController.ts
|
|
4820
|
-
var
|
|
4938
|
+
var Ti = class {
|
|
4821
4939
|
layoutMode;
|
|
4822
4940
|
resizeObserver = null;
|
|
4823
4941
|
target = null;
|
|
@@ -4842,13 +4960,13 @@ var Si = class {
|
|
|
4842
4960
|
}
|
|
4843
4961
|
handleResponsiveLayout = () => {
|
|
4844
4962
|
if (!this.target) return;
|
|
4845
|
-
let e =
|
|
4846
|
-
this.state.phoneMode =
|
|
4963
|
+
let e = wi(this.target);
|
|
4964
|
+
this.state.phoneMode = Ci(this.target), this.state.reelInfoSheetOverlay = this.state.phoneMode, this.state.reelMediaSource = this.state.phoneMode ? "mobile" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
|
|
4847
4965
|
};
|
|
4848
|
-
},
|
|
4966
|
+
}, Ei = class {
|
|
4849
4967
|
state;
|
|
4850
4968
|
constructor(e) {
|
|
4851
|
-
this.options = e, this.state = x(
|
|
4969
|
+
this.options = e, this.state = x(zt({
|
|
4852
4970
|
...e.initialReelAudioState,
|
|
4853
4971
|
muted: e.initialReelAudioState?.muted ?? e.mediaCard?.videoMuted ?? !1
|
|
4854
4972
|
}));
|
|
@@ -4857,9 +4975,9 @@ var Si = class {
|
|
|
4857
4975
|
return { ...this.state };
|
|
4858
4976
|
}
|
|
4859
4977
|
set(e, t = !1) {
|
|
4860
|
-
Object.assign(this.state,
|
|
4978
|
+
Object.assign(this.state, zt(e, this.state)), t && this.options.onReelAudioStateChange?.(this.get());
|
|
4861
4979
|
}
|
|
4862
|
-
},
|
|
4980
|
+
}, Di = class {
|
|
4863
4981
|
routedReelPostId = null;
|
|
4864
4982
|
reelRouteIsActive = !1;
|
|
4865
4983
|
constructor(e, t) {
|
|
@@ -4889,30 +5007,30 @@ var Si = class {
|
|
|
4889
5007
|
};
|
|
4890
5008
|
//#endregion
|
|
4891
5009
|
//#region src/core/updateItems.ts
|
|
4892
|
-
function
|
|
5010
|
+
function Oi(e) {
|
|
4893
5011
|
return String(e);
|
|
4894
5012
|
}
|
|
4895
|
-
function
|
|
4896
|
-
let n =
|
|
5013
|
+
function ki(e, t) {
|
|
5014
|
+
let n = V(t).length;
|
|
4897
5015
|
(e.mediaIndices.get(t.postId) ?? 0) >= n && e.mediaIndices.set(t.postId, Math.max(0, n - 1));
|
|
4898
5016
|
}
|
|
4899
|
-
function
|
|
5017
|
+
function Ai(e, t) {
|
|
4900
5018
|
let n = /* @__PURE__ */ new Map();
|
|
4901
|
-
if (t.forEach((e) => n.set(
|
|
5019
|
+
if (t.forEach((e) => n.set(Oi(e.postId), e)), n.size === 0) return [];
|
|
4902
5020
|
let r = [], i = e.items.map((t) => {
|
|
4903
|
-
let i = n.get(
|
|
5021
|
+
let i = n.get(Oi(t.postId));
|
|
4904
5022
|
if (!i) return t;
|
|
4905
5023
|
let a = {
|
|
4906
5024
|
...i,
|
|
4907
5025
|
postId: t.postId
|
|
4908
5026
|
};
|
|
4909
|
-
return
|
|
5027
|
+
return ki(e, a), e.reelForwardItem && Oi(e.reelForwardItem.postId) === Oi(t.postId) && (e.reelForwardItem = a), r.push(t.postId), a;
|
|
4910
5028
|
});
|
|
4911
5029
|
return r.length > 0 && (e.items = i), r;
|
|
4912
5030
|
}
|
|
4913
5031
|
//#endregion
|
|
4914
5032
|
//#region src/core/createVibe.ts
|
|
4915
|
-
var
|
|
5033
|
+
var ji = class {
|
|
4916
5034
|
app = null;
|
|
4917
5035
|
autoScroll;
|
|
4918
5036
|
autofillController;
|
|
@@ -4934,25 +5052,26 @@ var Oi = class {
|
|
|
4934
5052
|
notificationItems;
|
|
4935
5053
|
reelAudio;
|
|
4936
5054
|
state;
|
|
5055
|
+
pageReplacement;
|
|
4937
5056
|
constructor(e) {
|
|
4938
|
-
this.options = e,
|
|
5057
|
+
this.options = e, Qr(e);
|
|
4939
5058
|
let t = e.layout ?? "masonry";
|
|
4940
|
-
this.state = x(
|
|
5059
|
+
this.state = x(Yr(e, t)), this.reelAudio = new Ei(e), this.lastLoadedCursor = e.initialPage ? Kn(e.initialPage) : null, this.notificationItems = G(this.state), this.autoScroll = new yr({
|
|
4941
5060
|
getScrollElement: () => this.surface?.getAutoScrollElement() ?? null,
|
|
4942
5061
|
state: this.state.autoScroll
|
|
4943
|
-
}), this.autofillController = new
|
|
4944
|
-
cancelRequest: () => this.cancelRequest(),
|
|
5062
|
+
}), this.autofillController = new pr({
|
|
5063
|
+
cancelRequest: () => this.cancelRequest(!this.pageReplacement?.isActive()),
|
|
4945
5064
|
onLastCursor: (e) => this.setCurrentCursor(e),
|
|
4946
5065
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
4947
5066
|
options: e.autofill,
|
|
4948
5067
|
state: this.state
|
|
4949
|
-
}), this.removalReconciliation = new
|
|
5068
|
+
}), this.removalReconciliation = new oi(e), this.removalReconciliation.recordInitialPage(e.initialPage), this.fillController = new Br({
|
|
4950
5069
|
fill: e.fill,
|
|
4951
5070
|
loadPage: e.loadPage ? (e) => this.loadFilteredPage(e) : void 0,
|
|
4952
5071
|
needsFrontendPreparation: () => this.removalReconciliation.needsReconciliation(this.state.items),
|
|
4953
5072
|
onLastCursor: (e) => this.setCurrentCursor(e),
|
|
4954
5073
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
4955
|
-
prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) =>
|
|
5074
|
+
prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) => Vr({
|
|
4956
5075
|
controller: this.removalReconciliation,
|
|
4957
5076
|
isCurrent: t,
|
|
4958
5077
|
loadPage: e.loadPage,
|
|
@@ -4962,8 +5081,8 @@ var Oi = class {
|
|
|
4962
5081
|
state: this.state
|
|
4963
5082
|
}),
|
|
4964
5083
|
state: this.state
|
|
4965
|
-
}), this.routing = new
|
|
4966
|
-
let n =
|
|
5084
|
+
}), this.routing = new Di(e.routing, this.state);
|
|
5085
|
+
let n = vi({
|
|
4967
5086
|
historyLimit: e.removalHistoryLimit,
|
|
4968
5087
|
onActivate: (e) => this.setActiveReelPost(e),
|
|
4969
5088
|
onCloseReel: () => this.closeMasonryReel(),
|
|
@@ -4973,23 +5092,33 @@ var Oi = class {
|
|
|
4973
5092
|
state: this.state,
|
|
4974
5093
|
surface: () => this.surface
|
|
4975
5094
|
});
|
|
4976
|
-
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.
|
|
5095
|
+
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.pageReplacement = new ti({
|
|
5096
|
+
state: this.state,
|
|
5097
|
+
surface: () => this.surface,
|
|
5098
|
+
prepare: async () => {
|
|
5099
|
+
this.cancelRequest(!1), lr(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill();
|
|
5100
|
+
},
|
|
5101
|
+
commit: (e) => {
|
|
5102
|
+
this.resetFeedVisit(), this.setCurrentCursor(Kn(e)), this.removalReconciliation.recordInitialPage(e), this.state.reelOrigin === null && this.routing.syncFeed();
|
|
5103
|
+
}
|
|
5104
|
+
}), this.responsiveLayout = new Ti(t, this.state, () => {
|
|
4977
5105
|
this.routing.syncFeed();
|
|
4978
5106
|
}), this.startStateNotifications();
|
|
4979
5107
|
}
|
|
4980
5108
|
async mount() {
|
|
4981
5109
|
if (this.app) throw Error("Vibe is already mounted.");
|
|
4982
5110
|
this.startStateNotifications();
|
|
4983
|
-
let e =
|
|
4984
|
-
this.responsiveLayout.mount(e), this.app = i(
|
|
5111
|
+
let e = $r(this.options.target);
|
|
5112
|
+
this.responsiveLayout.mount(e), this.app = i(Vn, {
|
|
4985
5113
|
canRetryEnd: !!this.options.loadPage,
|
|
4986
5114
|
cardFooter: this.options.cardFooter,
|
|
4987
5115
|
cardHeader: this.options.cardHeader,
|
|
4988
5116
|
feedFooter: this.options.feedFooter,
|
|
4989
|
-
feedFooterActions:
|
|
5117
|
+
feedFooterActions: Hr(this),
|
|
4990
5118
|
mediaCard: this.options.mediaCard,
|
|
4991
5119
|
masonry: this.options.masonry,
|
|
4992
5120
|
onMediaFullyVisible: this.options.onMediaFullyVisible,
|
|
5121
|
+
onMediaError: this.options.onMediaError,
|
|
4993
5122
|
onMediaReady: this.options.onMediaReady,
|
|
4994
5123
|
onMediaVisible: this.options.onMediaVisible,
|
|
4995
5124
|
onReelMediaChange: this.options.onReelMediaChange,
|
|
@@ -5012,7 +5141,7 @@ var Oi = class {
|
|
|
5012
5141
|
onRetryForward: () => {
|
|
5013
5142
|
this.retryReelForward();
|
|
5014
5143
|
}
|
|
5015
|
-
}), this.surface = this.app.mount(e), this.autoScroll.mount(), await
|
|
5144
|
+
}), this.surface = this.app.mount(e), this.autoScroll.mount(), await wr(this.options.restoreBacklog, (e) => this.appendPage(e), (e) => {
|
|
5016
5145
|
this.restoreController = e;
|
|
5017
5146
|
}), !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();
|
|
5018
5147
|
}
|
|
@@ -5020,7 +5149,7 @@ var Oi = class {
|
|
|
5020
5149
|
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;
|
|
5021
5150
|
}
|
|
5022
5151
|
getState() {
|
|
5023
|
-
return
|
|
5152
|
+
return te(this.state);
|
|
5024
5153
|
}
|
|
5025
5154
|
getReelAudioState() {
|
|
5026
5155
|
return this.reelAudio.get();
|
|
@@ -5047,7 +5176,7 @@ var Oi = class {
|
|
|
5047
5176
|
return this.itemRemoval.restoreRemoval(e);
|
|
5048
5177
|
}
|
|
5049
5178
|
updateItems(e) {
|
|
5050
|
-
return
|
|
5179
|
+
return Ai(this.state, e);
|
|
5051
5180
|
}
|
|
5052
5181
|
retryReelForward() {
|
|
5053
5182
|
return this.reelForward.retry();
|
|
@@ -5086,22 +5215,21 @@ var Oi = class {
|
|
|
5086
5215
|
this.autoScroll.setSpeed(e);
|
|
5087
5216
|
}
|
|
5088
5217
|
applyAutofillUpdate(e) {
|
|
5089
|
-
let t =
|
|
5218
|
+
let t = Sr(this.options.autofill, this.state, e);
|
|
5090
5219
|
return t && this.autofillController.syncCountdown(), t;
|
|
5091
5220
|
}
|
|
5092
5221
|
cancelAutofill() {
|
|
5093
5222
|
return this.autofillController.cancel();
|
|
5094
5223
|
}
|
|
5095
5224
|
async cancelLoading() {
|
|
5096
|
-
if (this.state.loadMoreLocked = !1, this.fillController.isActive()) {
|
|
5225
|
+
if (this.state.loadMoreLocked = !1, this.cancelRequest(), this.fillController.isActive()) {
|
|
5097
5226
|
await this.cancelFill();
|
|
5098
5227
|
return;
|
|
5099
5228
|
}
|
|
5100
|
-
if (
|
|
5229
|
+
if (lr(this.state.autofill)) {
|
|
5101
5230
|
await this.cancelAutofill();
|
|
5102
5231
|
return;
|
|
5103
5232
|
}
|
|
5104
|
-
this.cancelRequest();
|
|
5105
5233
|
}
|
|
5106
5234
|
applyFillUpdate(e) {
|
|
5107
5235
|
return this.fillController.applyUpdate(e);
|
|
@@ -5110,13 +5238,13 @@ var Oi = class {
|
|
|
5110
5238
|
return this.fillController.cancel();
|
|
5111
5239
|
}
|
|
5112
5240
|
async fill(e) {
|
|
5113
|
-
if (!this.state.loadMoreLocked) {
|
|
5114
|
-
if (this.pendingRequest ||
|
|
5241
|
+
if (!(this.state.loadMoreLocked || this.pageReplacement.isActive())) {
|
|
5242
|
+
if (this.pendingRequest || lr(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
|
|
5115
5243
|
await this.fillController.start(e);
|
|
5116
5244
|
}
|
|
5117
5245
|
}
|
|
5118
5246
|
restoreAutofillSession(e) {
|
|
5119
|
-
let t =
|
|
5247
|
+
let t = Cr(this.options.autofill, this.state, e);
|
|
5120
5248
|
return t && this.autofillController.syncCountdown(), t;
|
|
5121
5249
|
}
|
|
5122
5250
|
restoreFillSession(e) {
|
|
@@ -5126,18 +5254,19 @@ var Oi = class {
|
|
|
5126
5254
|
return this.startLoadMore(() => this.loadNextSequence());
|
|
5127
5255
|
}
|
|
5128
5256
|
appendPage(e) {
|
|
5129
|
-
|
|
5257
|
+
qn(e, this.state, this.removalReconciliation, (e) => this.setCurrentCursor(e));
|
|
5130
5258
|
}
|
|
5131
5259
|
replenishAfterRemoval(e = !0) {
|
|
5132
5260
|
return this.startLoadMore(() => this.replenishAfterRemovalSequence(e));
|
|
5133
5261
|
}
|
|
5134
5262
|
async startLoadMore(e) {
|
|
5263
|
+
if (this.pageReplacement.isActive()) return;
|
|
5135
5264
|
if (this.pendingRequest) return this.pendingRequest;
|
|
5136
|
-
if (this.state.loadMoreLocked ||
|
|
5265
|
+
if (this.state.loadMoreLocked || lr(this.state.autofill) || this.fillController.isActive() || !this.options.loadPage || this.state.next === null && !this.removalReconciliation.needsReconciliation(this.state.items)) return;
|
|
5137
5266
|
this.state.isLoadingMore = !0, this.state.nextPageError = null;
|
|
5138
5267
|
let t = e();
|
|
5139
5268
|
return this.pendingRequest = t, t.finally(() => {
|
|
5140
|
-
this.pendingRequest === t && (this.pendingRequest = null
|
|
5269
|
+
this.pendingRequest === t && (this.pendingRequest = null, this.state.isLoadingMore = !1);
|
|
5141
5270
|
});
|
|
5142
5271
|
}
|
|
5143
5272
|
async refresh() {
|
|
@@ -5146,14 +5275,20 @@ var Oi = class {
|
|
|
5146
5275
|
async reload() {
|
|
5147
5276
|
return this.replaceFeed(null, "reload");
|
|
5148
5277
|
}
|
|
5278
|
+
replacePage(e, t) {
|
|
5279
|
+
return this.pageReplacement.replace(e, t);
|
|
5280
|
+
}
|
|
5149
5281
|
async replaceFeed(e, t) {
|
|
5150
5282
|
if (!this.options.loadPage) throw Error(`Vibe cannot ${t} without loadPage.`);
|
|
5151
|
-
return
|
|
5283
|
+
return lr(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);
|
|
5284
|
+
}
|
|
5285
|
+
resetFeedVisit() {
|
|
5286
|
+
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();
|
|
5152
5287
|
}
|
|
5153
5288
|
async loadFilteredPage(e) {
|
|
5154
5289
|
let t = this.options.loadPage;
|
|
5155
5290
|
if (!t) throw Error("Vibe cannot load a page without loadPage.");
|
|
5156
|
-
let n =
|
|
5291
|
+
let n = Hn(await t(e));
|
|
5157
5292
|
return {
|
|
5158
5293
|
...n,
|
|
5159
5294
|
items: this.removalReconciliation.filterItems(n.items)
|
|
@@ -5173,7 +5308,7 @@ var Oi = class {
|
|
|
5173
5308
|
let n = ++this.requestVersion, r = new AbortController();
|
|
5174
5309
|
this.abortController = r;
|
|
5175
5310
|
try {
|
|
5176
|
-
let i = await
|
|
5311
|
+
let i = await Vr({
|
|
5177
5312
|
controller: this.removalReconciliation,
|
|
5178
5313
|
isCurrent: () => n === this.requestVersion,
|
|
5179
5314
|
loadPage: t,
|
|
@@ -5191,35 +5326,32 @@ var Oi = class {
|
|
|
5191
5326
|
}
|
|
5192
5327
|
}
|
|
5193
5328
|
async retryEnd() {
|
|
5194
|
-
if (this.
|
|
5195
|
-
|
|
5329
|
+
if (!this.pageReplacement.isActive()) {
|
|
5330
|
+
if (this.pendingRequest) return this.pendingRequest;
|
|
5331
|
+
if (!this.state.loadMoreLocked && !(lr(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);
|
|
5332
|
+
}
|
|
5196
5333
|
}
|
|
5197
5334
|
setInfiniteScroll(e) {
|
|
5198
5335
|
this.state.infiniteScroll = e, e && m(() => this.surface?.loadIfNearBottom());
|
|
5199
5336
|
}
|
|
5200
5337
|
setLoadMoreLocked(e) {
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
e ? e.finally(() => {
|
|
5209
|
-
this.loadNext();
|
|
5210
|
-
}) : this.loadNext();
|
|
5211
|
-
} else this.state.infiniteScroll && m(() => this.surface?.loadIfNearBottom());
|
|
5212
|
-
}
|
|
5338
|
+
ni(this.state, e, {
|
|
5339
|
+
getPending: () => this.pendingRequest,
|
|
5340
|
+
hasPendingSession: () => this.removalReconciliation.hasPendingSession(),
|
|
5341
|
+
loadNext: () => this.loadNext(),
|
|
5342
|
+
resumeFill: () => this.fillController.resume(this.removalReconciliation.hasPendingSession()),
|
|
5343
|
+
loadIfNearBottom: () => this.surface?.loadIfNearBottom()
|
|
5344
|
+
});
|
|
5213
5345
|
}
|
|
5214
5346
|
setTotal(e) {
|
|
5215
5347
|
if (e !== null && (!Number.isInteger(e) || e < 0)) throw TypeError("Vibe total must be a non-negative integer or null.");
|
|
5216
5348
|
this.state.total = e;
|
|
5217
5349
|
}
|
|
5218
5350
|
setReelAutoAdvance(e) {
|
|
5219
|
-
|
|
5351
|
+
Kr(this.state.reelAutoAdvance, e);
|
|
5220
5352
|
}
|
|
5221
5353
|
setReelInfoSheet(e) {
|
|
5222
|
-
|
|
5354
|
+
Jr(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
|
|
5223
5355
|
}
|
|
5224
5356
|
setLayout(e) {
|
|
5225
5357
|
this.responsiveLayout.setLayout(e);
|
|
@@ -5233,13 +5365,13 @@ var Oi = class {
|
|
|
5233
5365
|
setActiveReelPost(e) {
|
|
5234
5366
|
this.state.layout !== "reel" && this.state.reelOrigin !== "masonry" || (this.state.activeReelPostId = e, this.routing.syncReel(e));
|
|
5235
5367
|
}
|
|
5236
|
-
cancelRequest() {
|
|
5237
|
-
this.autofillController.clearCountdown(), this.requestVersion += 1, this.abortController?.abort(), this.abortController = null, this.pendingRequest = null, this.state.isLoading = !1, this.state.isLoadingMore = !1;
|
|
5368
|
+
cancelRequest(e = !0) {
|
|
5369
|
+
e && this.pageReplacement.cancel(), this.autofillController.clearCountdown(), this.requestVersion += 1, this.abortController?.abort(), this.abortController = null, this.pendingRequest = null, this.state.isLoading = !1, this.state.isLoadingMore = !1;
|
|
5238
5370
|
}
|
|
5239
5371
|
async fetchPage(e, t) {
|
|
5240
5372
|
if (!this.options.loadPage) return;
|
|
5241
5373
|
let n = ++this.requestVersion, r = new AbortController();
|
|
5242
|
-
this.abortController = r, await
|
|
5374
|
+
this.abortController = r, await ei({
|
|
5243
5375
|
append: t,
|
|
5244
5376
|
autofillController: this.autofillController,
|
|
5245
5377
|
cursor: e,
|
|
@@ -5261,7 +5393,7 @@ var Oi = class {
|
|
|
5261
5393
|
startInitialAutofill() {
|
|
5262
5394
|
let e = ++this.requestVersion, t = new AbortController(), n = this.autofillController.beginCycle();
|
|
5263
5395
|
this.abortController = t, this.state.isLoadingMore = !0;
|
|
5264
|
-
let r =
|
|
5396
|
+
let r = Tr({
|
|
5265
5397
|
cycleId: n,
|
|
5266
5398
|
isCurrent: () => e === this.requestVersion,
|
|
5267
5399
|
onCollection: (t) => this.autofillController.captureCollection(t, e === this.requestVersion),
|
|
@@ -5279,11 +5411,11 @@ var Oi = class {
|
|
|
5279
5411
|
}
|
|
5280
5412
|
startStateNotifications() {
|
|
5281
5413
|
let e = this.options.onStateChange;
|
|
5282
|
-
!e || this.stopStateWatcher || (
|
|
5414
|
+
!e || this.stopStateWatcher || (this.stopStateWatcher = K(this.state, this.notificationItems, e));
|
|
5283
5415
|
}
|
|
5284
5416
|
setCurrentCursor(e) {
|
|
5285
|
-
this.lastLoadedCursor =
|
|
5417
|
+
this.lastLoadedCursor = this.state.current = e;
|
|
5286
5418
|
}
|
|
5287
|
-
},
|
|
5419
|
+
}, Mi = (e) => new ji(e);
|
|
5288
5420
|
//#endregion
|
|
5289
|
-
export {
|
|
5421
|
+
export { Mi as createVibe };
|