@wyxos/vibe 4.5.3 → 4.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/MediaCard.vue.d.ts +3 -0
- package/lib/index.cjs +1 -1
- package/lib/index.js +899 -873
- package/lib/style.css +1 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fragment as e,
|
|
1
|
+
import { Fragment as e, Teleport as t, Transition as n, computed as r, createApp as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, guardReactiveProps as f, h as p, nextTick as m, normalizeClass as h, normalizeProps as g, normalizeStyle as _, onBeforeUnmount as ee, onMounted as v, openBlock as y, reactive as b, renderList as x, resolveDynamicComponent as S, shallowRef as C, toDisplayString as w, unref as T, useId as E, watch as D, withCtx as O, withKeys as k, withModifiers as A } from "vue";
|
|
2
2
|
//#region src/core/mediaAsset.ts
|
|
3
3
|
function j(e) {
|
|
4
4
|
return [e, ...e.items];
|
|
@@ -52,7 +52,7 @@ var I = {
|
|
|
52
52
|
}, R = ["disabled"], z = {
|
|
53
53
|
key: 2,
|
|
54
54
|
class: "end-feed"
|
|
55
|
-
}, B = ["disabled"], V = /* @__PURE__ */
|
|
55
|
+
}, B = ["disabled"], V = /* @__PURE__ */ d({
|
|
56
56
|
__name: "GalleryFooter",
|
|
57
57
|
props: {
|
|
58
58
|
canRetryEnd: { type: Boolean },
|
|
@@ -67,25 +67,25 @@ var I = {
|
|
|
67
67
|
function i() {
|
|
68
68
|
n.loadMoreLocked || (n.hasNext ? r("loadMore") : r("retryEnd"));
|
|
69
69
|
}
|
|
70
|
-
return (t, n) => e.hasNext || e.isLoading || e.hasError || e.canRetryEnd ? (y(),
|
|
70
|
+
return (t, n) => e.hasNext || e.isLoading || e.hasError || e.canRetryEnd ? (y(), s("footer", I, [e.isLoading ? (y(), s("p", L, " Loading more… ")) : e.hasError || e.hasNext ? (y(), s("button", {
|
|
71
71
|
key: 1,
|
|
72
72
|
"data-test": "load-more",
|
|
73
73
|
class: "load-more-button",
|
|
74
74
|
type: "button",
|
|
75
75
|
disabled: e.loadMoreLocked,
|
|
76
76
|
onClick: i
|
|
77
|
-
}, w(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9, R)) : (y(),
|
|
77
|
+
}, w(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9, R)) : (y(), s("div", z, [n[1] ||= c("p", {
|
|
78
78
|
class: "end-feed-message",
|
|
79
79
|
role: "status"
|
|
80
|
-
}, " You've reached the end. ", -1),
|
|
80
|
+
}, " You've reached the end. ", -1), c("button", {
|
|
81
81
|
"data-test": "retry-end",
|
|
82
82
|
class: "load-more-button",
|
|
83
83
|
type: "button",
|
|
84
84
|
disabled: e.loadMoreLocked,
|
|
85
85
|
onClick: n[0] ||= (e) => t.$emit("retryEnd")
|
|
86
|
-
}, " Check for more ", 8, B)]))])) :
|
|
86
|
+
}, " Check for more ", 8, B)]))])) : o("", !0);
|
|
87
87
|
}
|
|
88
|
-
}), H = /* @__PURE__ */
|
|
88
|
+
}), H = /* @__PURE__ */ d({
|
|
89
89
|
__name: "FeedFooter",
|
|
90
90
|
props: {
|
|
91
91
|
actions: {},
|
|
@@ -100,18 +100,18 @@ var I = {
|
|
|
100
100
|
emits: ["loadMore", "retryEnd"],
|
|
101
101
|
setup(e, { emit: t }) {
|
|
102
102
|
let n = e, r = t;
|
|
103
|
-
function
|
|
103
|
+
function i() {
|
|
104
104
|
n.actions?.cancelAutofill();
|
|
105
105
|
}
|
|
106
106
|
function o() {
|
|
107
107
|
n.actions?.retry();
|
|
108
108
|
}
|
|
109
|
-
return (t, n) => e.feedFooter && e.actions && e.state ? (y(),
|
|
109
|
+
return (t, n) => e.feedFooter && e.actions && e.state ? (y(), a(S(e.feedFooter.component), {
|
|
110
110
|
key: 0,
|
|
111
111
|
actions: e.actions,
|
|
112
112
|
"can-retry-end": e.canRetryEnd,
|
|
113
113
|
state: e.state,
|
|
114
|
-
onAutofillCancel:
|
|
114
|
+
onAutofillCancel: i,
|
|
115
115
|
onLoadMore: n[0] ||= (e) => r("loadMore"),
|
|
116
116
|
onRetry: o,
|
|
117
117
|
onRetryEnd: n[1] ||= (e) => r("retryEnd")
|
|
@@ -119,7 +119,7 @@ var I = {
|
|
|
119
119
|
"actions",
|
|
120
120
|
"can-retry-end",
|
|
121
121
|
"state"
|
|
122
|
-
])) : (y(),
|
|
122
|
+
])) : (y(), a(V, {
|
|
123
123
|
key: 1,
|
|
124
124
|
"can-retry-end": e.canRetryEnd,
|
|
125
125
|
"has-error": e.hasError,
|
|
@@ -136,7 +136,7 @@ var I = {
|
|
|
136
136
|
"load-more-locked"
|
|
137
137
|
]));
|
|
138
138
|
}
|
|
139
|
-
}), U = ["role"], W = { class: "gallery-status" },
|
|
139
|
+
}), U = ["role"], W = { class: "gallery-status" }, te = /* @__PURE__ */ d({
|
|
140
140
|
__name: "FeedStatus",
|
|
141
141
|
props: {
|
|
142
142
|
actions: {},
|
|
@@ -146,11 +146,11 @@ var I = {
|
|
|
146
146
|
},
|
|
147
147
|
emits: ["loadMore", "retryEnd"],
|
|
148
148
|
setup(t, { emit: n }) {
|
|
149
|
-
let r = t,
|
|
150
|
-
return (n, u) => (y(),
|
|
149
|
+
let r = t, i = n;
|
|
150
|
+
return (n, u) => (y(), s("main", {
|
|
151
151
|
class: "gallery-shell",
|
|
152
152
|
role: r.state.error ? "alert" : r.state.isLoading ? "status" : void 0
|
|
153
|
-
}, [
|
|
153
|
+
}, [c("p", W, [r.state.error ? (y(), s(e, { key: 0 }, [l(" Unable to load media. ")], 64)) : r.state.isLoading ? (y(), s(e, { key: 1 }, [l(" Loading media… ")], 64)) : (y(), s(e, { key: 2 }, [l(" No media found. ")], 64))]), t.feedFooter ? (y(), a(H, {
|
|
154
154
|
key: 0,
|
|
155
155
|
actions: t.actions,
|
|
156
156
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -160,8 +160,8 @@ var I = {
|
|
|
160
160
|
"is-loading": t.state.isLoadingMore,
|
|
161
161
|
"load-more-locked": t.state.loadMoreLocked,
|
|
162
162
|
state: t.state,
|
|
163
|
-
onLoadMore: u[0] ||= (e) =>
|
|
164
|
-
onRetryEnd: u[1] ||= (e) =>
|
|
163
|
+
onLoadMore: u[0] ||= (e) => i("loadMore"),
|
|
164
|
+
onRetryEnd: u[1] ||= (e) => i("retryEnd")
|
|
165
165
|
}, null, 8, [
|
|
166
166
|
"actions",
|
|
167
167
|
"can-retry-end",
|
|
@@ -171,7 +171,7 @@ var I = {
|
|
|
171
171
|
"is-loading",
|
|
172
172
|
"load-more-locked",
|
|
173
173
|
"state"
|
|
174
|
-
])) :
|
|
174
|
+
])) : o("", !0)], 8, U));
|
|
175
175
|
}
|
|
176
176
|
});
|
|
177
177
|
function G(e) {
|
|
@@ -179,14 +179,14 @@ function G(e) {
|
|
|
179
179
|
}
|
|
180
180
|
//#endregion
|
|
181
181
|
//#region src/core/masonry.ts
|
|
182
|
-
function
|
|
182
|
+
function ne(e) {
|
|
183
183
|
let t = e.preview.width ?? e.width, n = e.preview.height ?? e.height;
|
|
184
184
|
return !t || !n || t <= 0 || n <= 0 ? 1 : n / t;
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function re(e) {
|
|
187
187
|
return e.reduce((t, n, r) => n < e[t] ? r : t, 0);
|
|
188
188
|
}
|
|
189
|
-
function
|
|
189
|
+
function ie(e) {
|
|
190
190
|
return Math.max(0, e.containerHeight) + Math.max(0, e.gap);
|
|
191
191
|
}
|
|
192
192
|
function K(e, t) {
|
|
@@ -200,7 +200,7 @@ function q(e, t, n) {
|
|
|
200
200
|
items: []
|
|
201
201
|
};
|
|
202
202
|
let r = Math.max(0, n.gap), i = Number.isFinite(n.additionalHeight) ? Math.max(0, n.additionalHeight ?? 0) : 0, a = Math.max(1, n.minColumnWidth), o = Math.max(1, Math.floor((t + r) / (a + r))), s = (t - r * (o - 1)) / o, c = Array.from({ length: o }, () => 0), l = e.map((e) => {
|
|
203
|
-
let t =
|
|
203
|
+
let t = re(c), n = s * ne(e) + i, a = {
|
|
204
204
|
x: t * (s + r),
|
|
205
205
|
y: c[t],
|
|
206
206
|
width: s,
|
|
@@ -216,10 +216,10 @@ function q(e, t, n) {
|
|
|
216
216
|
}
|
|
217
217
|
//#endregion
|
|
218
218
|
//#region src/core/scrollbar.ts
|
|
219
|
-
function
|
|
219
|
+
function ae(e, t, n) {
|
|
220
220
|
return Math.min(n, Math.max(t, e));
|
|
221
221
|
}
|
|
222
|
-
function
|
|
222
|
+
function J({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize: r, viewportSize: i }) {
|
|
223
223
|
let a = Math.max(0, e), o = Math.max(0, r), s = Math.max(0, i), c = Math.max(0, a - s);
|
|
224
224
|
if (!(c > 0 && o > 0)) return {
|
|
225
225
|
maximumScrollPosition: c,
|
|
@@ -228,23 +228,23 @@ function Y({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize:
|
|
|
228
228
|
thumbSize: o,
|
|
229
229
|
thumbTravel: 0
|
|
230
230
|
};
|
|
231
|
-
let l =
|
|
231
|
+
let l = ae(s / a * o, Math.min(Math.max(0, t), o), o), u = Math.max(0, o - l);
|
|
232
232
|
return {
|
|
233
233
|
maximumScrollPosition: c,
|
|
234
234
|
scrollable: !0,
|
|
235
|
-
thumbOffset: u * (
|
|
235
|
+
thumbOffset: u * (ae(n, 0, c) / c),
|
|
236
236
|
thumbSize: l,
|
|
237
237
|
thumbTravel: u
|
|
238
238
|
};
|
|
239
239
|
}
|
|
240
240
|
//#endregion
|
|
241
241
|
//#region src/components/GalleryScrollbar.vue?vue&type=script&setup=true&lang.ts
|
|
242
|
-
var
|
|
242
|
+
var Y = ["aria-hidden"], oe = [
|
|
243
243
|
"aria-controls",
|
|
244
244
|
"aria-valuemax",
|
|
245
245
|
"aria-valuenow",
|
|
246
246
|
"tabindex"
|
|
247
|
-
],
|
|
247
|
+
], se = 32, X = 40, ce = 120, le = /* @__PURE__ */ d({
|
|
248
248
|
__name: "GalleryScrollbar",
|
|
249
249
|
props: {
|
|
250
250
|
contentSize: {},
|
|
@@ -253,40 +253,40 @@ var ie = ["aria-hidden"], ae = [
|
|
|
253
253
|
suspended: { type: Boolean }
|
|
254
254
|
},
|
|
255
255
|
setup(e) {
|
|
256
|
-
let t = e,
|
|
256
|
+
let t = e, n = {
|
|
257
257
|
maximumScrollPosition: 0,
|
|
258
258
|
scrollable: !1,
|
|
259
259
|
thumbOffset: 0,
|
|
260
260
|
thumbSize: 0,
|
|
261
261
|
thumbTravel: 0
|
|
262
|
-
}, i = C(null), a = C(
|
|
262
|
+
}, i = C(null), a = C(n), o = C(!1), l = C(!1), u = C(!1), d = null, f = 0, p = 0, g = null, v = null, b = null, x = null, S = !1, w = null, T = r(() => a.value.scrollable && !t.suspended), E = r(() => ({
|
|
263
263
|
height: `${a.value.thumbSize}px`,
|
|
264
264
|
transform: `translate3d(0, ${a.value.thumbOffset}px, 0)`
|
|
265
265
|
}));
|
|
266
|
+
function O() {
|
|
267
|
+
g !== null && clearTimeout(g), g = setTimeout(() => {
|
|
268
|
+
g = null, o.value || (l.value = !1);
|
|
269
|
+
}, ce);
|
|
270
|
+
}
|
|
266
271
|
function k() {
|
|
267
|
-
|
|
268
|
-
v = null, c.value || (l.value = !1);
|
|
269
|
-
}, Z);
|
|
272
|
+
l.value = !0, O();
|
|
270
273
|
}
|
|
271
274
|
function A() {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
function j() {
|
|
275
|
-
let e = t.scrollElement, n = i.value;
|
|
276
|
-
return !e || !n ? r : Y({
|
|
275
|
+
let e = t.scrollElement, r = i.value;
|
|
276
|
+
return !e || !r ? n : J({
|
|
277
277
|
contentSize: e.scrollHeight,
|
|
278
|
-
minimumThumbSize:
|
|
278
|
+
minimumThumbSize: se,
|
|
279
279
|
scrollPosition: e.scrollTop,
|
|
280
|
-
trackSize:
|
|
280
|
+
trackSize: r.clientHeight,
|
|
281
281
|
viewportSize: e.clientHeight
|
|
282
282
|
});
|
|
283
283
|
}
|
|
284
|
-
function
|
|
285
|
-
if (
|
|
286
|
-
|
|
284
|
+
function j(e) {
|
|
285
|
+
if (o.value && e !== "scroll") {
|
|
286
|
+
S = !0;
|
|
287
287
|
return;
|
|
288
288
|
}
|
|
289
|
-
if (
|
|
289
|
+
if (o.value) {
|
|
290
290
|
let e = t.scrollElement;
|
|
291
291
|
if (!e || a.value.maximumScrollPosition <= 0) return;
|
|
292
292
|
let n = Math.min(1, Math.max(0, e.scrollTop / a.value.maximumScrollPosition));
|
|
@@ -296,69 +296,69 @@ var ie = ["aria-hidden"], ae = [
|
|
|
296
296
|
};
|
|
297
297
|
return;
|
|
298
298
|
}
|
|
299
|
-
a.value =
|
|
300
|
-
|
|
299
|
+
a.value = A(), !(u.value || v !== null) && (v = requestAnimationFrame(() => {
|
|
300
|
+
v = null, u.value = !0;
|
|
301
301
|
}));
|
|
302
302
|
}
|
|
303
|
-
function
|
|
304
|
-
|
|
303
|
+
function M() {
|
|
304
|
+
k(), j("scroll");
|
|
305
305
|
}
|
|
306
|
-
function
|
|
306
|
+
function N(e) {
|
|
307
307
|
let n = t.scrollElement;
|
|
308
|
-
n && (n.scrollTop = Math.min(a.value.maximumScrollPosition, Math.max(0, e)),
|
|
308
|
+
n && (n.scrollTop = Math.min(a.value.maximumScrollPosition, Math.max(0, e)), j("scroll"));
|
|
309
309
|
}
|
|
310
|
-
function
|
|
311
|
-
if (!
|
|
310
|
+
function P(e) {
|
|
311
|
+
if (!T.value || e.target !== e.currentTarget) return;
|
|
312
312
|
let t = i.value;
|
|
313
313
|
if (!t || a.value.thumbTravel <= 0) return;
|
|
314
|
-
e.preventDefault(),
|
|
314
|
+
e.preventDefault(), k();
|
|
315
315
|
let n = e.clientY - t.getBoundingClientRect().top - a.value.thumbSize / 2;
|
|
316
|
-
|
|
316
|
+
N(Math.min(1, Math.max(0, n / a.value.thumbTravel)) * a.value.maximumScrollPosition);
|
|
317
|
+
}
|
|
318
|
+
function F(e) {
|
|
319
|
+
T.value && (e.preventDefault(), e.stopPropagation(), e.currentTarget.setPointerCapture?.(e.pointerId), d = e.pointerId, f = e.clientY, p = t.scrollElement?.scrollTop ?? 0, o.value = !0, l.value = !0, g !== null && clearTimeout(g), g = null);
|
|
317
320
|
}
|
|
318
321
|
function I(e) {
|
|
319
|
-
|
|
322
|
+
if (!o.value || e.pointerId !== d || (e.preventDefault(), a.value.thumbTravel <= 0)) return;
|
|
323
|
+
let t = (e.clientY - f) / a.value.thumbTravel * a.value.maximumScrollPosition;
|
|
324
|
+
N(p + t);
|
|
320
325
|
}
|
|
321
326
|
function L(e) {
|
|
322
|
-
|
|
323
|
-
let t = (e.clientY - f) / a.value.thumbTravel * a.value.maximumScrollPosition;
|
|
324
|
-
P(h + t);
|
|
327
|
+
!o.value || e.pointerId !== d || (e.currentTarget.releasePointerCapture?.(e.pointerId), d = null, o.value = !1, S && (S = !1, j("content")), O());
|
|
325
328
|
}
|
|
326
329
|
function R(e) {
|
|
327
|
-
|
|
328
|
-
}
|
|
329
|
-
function z(e) {
|
|
330
|
-
if (!E.value) return;
|
|
330
|
+
if (!T.value) return;
|
|
331
331
|
let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r - X : e.key === "ArrowDown" ? r + X : e.key === "PageUp" ? r - n : e.key === "PageDown" ? r + n : e.key === "Home" ? 0 : e.key === "End" ? a.value.maximumScrollPosition : null;
|
|
332
|
-
i !== null && (e.preventDefault(),
|
|
332
|
+
i !== null && (e.preventDefault(), k(), N(i));
|
|
333
333
|
}
|
|
334
|
-
function
|
|
335
|
-
if (
|
|
336
|
-
|
|
337
|
-
for (let t of e.children)
|
|
334
|
+
function z(e) {
|
|
335
|
+
if (x?.disconnect(), !(typeof ResizeObserver > "u")) {
|
|
336
|
+
x = new ResizeObserver(() => j("content"));
|
|
337
|
+
for (let t of e.children) x.observe(t);
|
|
338
338
|
}
|
|
339
339
|
}
|
|
340
340
|
return D(() => t.scrollElement, (e, t) => {
|
|
341
|
-
t?.removeEventListener("scroll",
|
|
342
|
-
|
|
343
|
-
}),
|
|
344
|
-
|
|
345
|
-
}),
|
|
341
|
+
t?.removeEventListener("scroll", M), b?.disconnect(), b = null, x?.disconnect(), x = null, w?.disconnect(), w = null, e?.addEventListener("scroll", M, { passive: !0 }), e && typeof ResizeObserver < "u" && (w = new ResizeObserver(() => {
|
|
342
|
+
k(), j("resize");
|
|
343
|
+
}), w.observe(e), z(e)), e && typeof MutationObserver < "u" && (b = new MutationObserver(() => {
|
|
344
|
+
z(e), j("content");
|
|
345
|
+
}), b.observe(e, { childList: !0 })), m(() => j("resize"));
|
|
346
346
|
}, { immediate: !0 }), D(() => t.contentSize, () => {
|
|
347
|
-
|
|
348
|
-
}),
|
|
349
|
-
t.scrollElement?.removeEventListener("scroll",
|
|
350
|
-
}), (t, n) => (y(),
|
|
347
|
+
m(() => j("content"));
|
|
348
|
+
}), ee(() => {
|
|
349
|
+
t.scrollElement?.removeEventListener("scroll", M), b?.disconnect(), x?.disconnect(), w?.disconnect(), g !== null && clearTimeout(g), v !== null && cancelAnimationFrame(v);
|
|
350
|
+
}), (t, n) => (y(), s("div", {
|
|
351
351
|
ref_key: "trackElement",
|
|
352
352
|
ref: i,
|
|
353
|
-
class:
|
|
354
|
-
"gallery-scrollbar--dragging":
|
|
353
|
+
class: h(["gallery-scrollbar", {
|
|
354
|
+
"gallery-scrollbar--dragging": o.value,
|
|
355
355
|
"gallery-scrollbar--interacting": l.value,
|
|
356
356
|
"gallery-scrollbar--ready": u.value,
|
|
357
|
-
"gallery-scrollbar--visible":
|
|
357
|
+
"gallery-scrollbar--visible": T.value
|
|
358
358
|
}]),
|
|
359
|
-
"aria-hidden": !
|
|
360
|
-
onPointerdown:
|
|
361
|
-
}, [
|
|
359
|
+
"aria-hidden": !T.value || void 0,
|
|
360
|
+
onPointerdown: P
|
|
361
|
+
}, [c("div", {
|
|
362
362
|
class: "gallery-scrollbar-thumb",
|
|
363
363
|
"aria-controls": e.controlsId,
|
|
364
364
|
"aria-label": "Media gallery scroll position",
|
|
@@ -367,22 +367,22 @@ var ie = ["aria-hidden"], ae = [
|
|
|
367
367
|
"aria-valuemin": "0",
|
|
368
368
|
"aria-valuenow": Math.round(e.scrollElement?.scrollTop ?? 0),
|
|
369
369
|
role: "scrollbar",
|
|
370
|
-
style:
|
|
371
|
-
tabindex:
|
|
372
|
-
onKeydown:
|
|
373
|
-
onPointercancel:
|
|
374
|
-
onPointerdown:
|
|
375
|
-
onPointermove:
|
|
376
|
-
onPointerup:
|
|
377
|
-
}, null, 44,
|
|
378
|
-
}
|
|
379
|
-
}),
|
|
370
|
+
style: _(E.value),
|
|
371
|
+
tabindex: T.value ? 0 : -1,
|
|
372
|
+
onKeydown: R,
|
|
373
|
+
onPointercancel: L,
|
|
374
|
+
onPointerdown: F,
|
|
375
|
+
onPointermove: I,
|
|
376
|
+
onPointerup: L
|
|
377
|
+
}, null, 44, oe)], 42, Y));
|
|
378
|
+
}
|
|
379
|
+
}), Z = (e) => {
|
|
380
380
|
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
|
381
381
|
return !1;
|
|
382
|
-
},
|
|
383
|
-
let t =
|
|
382
|
+
}, ue = (e) => e === "", de = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), fe = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), pe = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), me = (e) => {
|
|
383
|
+
let t = pe(e);
|
|
384
384
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
385
|
-
},
|
|
385
|
+
}, he = {
|
|
386
386
|
xmlns: "http://www.w3.org/2000/svg",
|
|
387
387
|
width: 24,
|
|
388
388
|
height: 24,
|
|
@@ -392,27 +392,27 @@ var ie = ["aria-hidden"], ae = [
|
|
|
392
392
|
"stroke-width": 2,
|
|
393
393
|
"stroke-linecap": "round",
|
|
394
394
|
"stroke-linejoin": "round"
|
|
395
|
-
},
|
|
396
|
-
...
|
|
395
|
+
}, ge = ({ name: e, iconNode: t, absoluteStrokeWidth: n, "absolute-stroke-width": r, strokeWidth: i, "stroke-width": a, size: o = he.width, color: s = he.stroke, ...c }, { slots: l }) => p("svg", {
|
|
396
|
+
...he,
|
|
397
397
|
...c,
|
|
398
398
|
width: o,
|
|
399
399
|
height: o,
|
|
400
400
|
stroke: s,
|
|
401
|
-
"stroke-width":
|
|
402
|
-
class:
|
|
403
|
-
...!l.default && !
|
|
404
|
-
}, [...t.map((e) =>
|
|
401
|
+
"stroke-width": ue(n) || ue(r) || n === !0 || r === !0 ? Number(i || a || he["stroke-width"]) * 24 / Number(o) : i || a || he["stroke-width"],
|
|
402
|
+
class: de("lucide", c.class, ...e ? [`lucide-${fe(me(e))}-icon`, `lucide-${fe(e)}`] : ["lucide-icon"]),
|
|
403
|
+
...!l.default && !Z(c) && { "aria-hidden": "true" }
|
|
404
|
+
}, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]), _e = (e, t) => (n, { slots: r, attrs: i }) => p(ge, {
|
|
405
405
|
...i,
|
|
406
406
|
...n,
|
|
407
407
|
iconNode: t,
|
|
408
408
|
name: e
|
|
409
|
-
}, r),
|
|
409
|
+
}, r), ve = _e("chevron-left", [["path", {
|
|
410
410
|
d: "m15 18-6-6 6-6",
|
|
411
411
|
key: "1wnfg3"
|
|
412
|
-
}]]),
|
|
412
|
+
}]]), ye = _e("chevron-right", [["path", {
|
|
413
413
|
d: "m9 18 6-6-6-6",
|
|
414
414
|
key: "mthhwq"
|
|
415
|
-
}]]),
|
|
415
|
+
}]]), be = _e("pause", [["rect", {
|
|
416
416
|
x: "14",
|
|
417
417
|
y: "3",
|
|
418
418
|
width: "5",
|
|
@@ -426,10 +426,10 @@ var ie = ["aria-hidden"], ae = [
|
|
|
426
426
|
height: "18",
|
|
427
427
|
rx: "1",
|
|
428
428
|
key: "1wsw3u"
|
|
429
|
-
}]]),
|
|
429
|
+
}]]), xe = _e("play", [["path", {
|
|
430
430
|
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",
|
|
431
431
|
key: "10ikf1"
|
|
432
|
-
}]]),
|
|
432
|
+
}]]), Se = _e("volume-2", [
|
|
433
433
|
["path", {
|
|
434
434
|
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",
|
|
435
435
|
key: "uqj9uw"
|
|
@@ -442,7 +442,7 @@ var ie = ["aria-hidden"], ae = [
|
|
|
442
442
|
d: "M19.364 18.364a9 9 0 0 0 0-12.728",
|
|
443
443
|
key: "ijwkga"
|
|
444
444
|
}]
|
|
445
|
-
]),
|
|
445
|
+
]), Ce = _e("volume-x", [
|
|
446
446
|
["path", {
|
|
447
447
|
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",
|
|
448
448
|
key: "uqj9uw"
|
|
@@ -461,32 +461,32 @@ var ie = ["aria-hidden"], ae = [
|
|
|
461
461
|
y2: "15",
|
|
462
462
|
key: "5ykzw1"
|
|
463
463
|
}]
|
|
464
|
-
]),
|
|
464
|
+
]), we = {
|
|
465
465
|
401: "Authentication required",
|
|
466
466
|
403: "Access forbidden",
|
|
467
467
|
404: "Preview not found",
|
|
468
468
|
419: "Session expired",
|
|
469
469
|
500: "Server error"
|
|
470
470
|
};
|
|
471
|
-
function
|
|
471
|
+
function Te(e) {
|
|
472
472
|
return e.match(/\/demo-errors\/(401|403|404|419|500)\//)?.[1] ?? "Error";
|
|
473
473
|
}
|
|
474
|
-
function
|
|
475
|
-
return
|
|
474
|
+
function Ee(e) {
|
|
475
|
+
return we[Te(e)] ?? "Preview unavailable";
|
|
476
476
|
}
|
|
477
477
|
//#endregion
|
|
478
478
|
//#region src/core/mediaType.ts
|
|
479
|
-
var
|
|
480
|
-
function
|
|
479
|
+
var De = /\.(aac|flac|m4a|mp3|mp4|mov|ogg|opus|wav|webm)$/i;
|
|
480
|
+
function Oe(e) {
|
|
481
481
|
try {
|
|
482
|
-
return
|
|
482
|
+
return De.test(new URL(e).pathname);
|
|
483
483
|
} catch {
|
|
484
|
-
return
|
|
484
|
+
return De.test(e.split("?")[0] ?? e);
|
|
485
485
|
}
|
|
486
486
|
}
|
|
487
487
|
//#endregion
|
|
488
488
|
//#region src/components/CardRegion.vue
|
|
489
|
-
var
|
|
489
|
+
var ke = /* @__PURE__ */ d({
|
|
490
490
|
__name: "CardRegion",
|
|
491
491
|
props: {
|
|
492
492
|
index: {},
|
|
@@ -501,24 +501,24 @@ var Oe = /* @__PURE__ */ u({
|
|
|
501
501
|
total: {}
|
|
502
502
|
},
|
|
503
503
|
setup(e) {
|
|
504
|
-
let t = e,
|
|
504
|
+
let t = e, n = r(() => M(t.item, t.mediaIndex)), i = r(() => j(t.item)), o = r(() => N(t.item, n.value)), c = r(() => ({
|
|
505
505
|
height: `${t.region.height}px`,
|
|
506
506
|
paddingBlock: t.style?.paddingY === void 0 ? void 0 : `${t.style.paddingY}px`,
|
|
507
507
|
paddingInline: t.style?.paddingX === void 0 ? void 0 : `${t.style.paddingX}px`
|
|
508
|
-
})), l =
|
|
509
|
-
return (t,
|
|
510
|
-
class:
|
|
511
|
-
style:
|
|
512
|
-
onClick:
|
|
513
|
-
onKeydown:
|
|
514
|
-
}, [(y(),
|
|
508
|
+
})), l = r(() => t.style?.background ?? t.region.background);
|
|
509
|
+
return (t, r) => (y(), s("div", {
|
|
510
|
+
class: h(["media-card-region", [`media-card-${e.placement}`, { "media-card-region--transparent": l.value === "transparent" }]]),
|
|
511
|
+
style: _(c.value),
|
|
512
|
+
onClick: r[0] ||= A(() => {}, ["stop"]),
|
|
513
|
+
onKeydown: r[1] ||= A(() => {}, ["stop"])
|
|
514
|
+
}, [(y(), a(S(e.region.component), {
|
|
515
515
|
index: e.index,
|
|
516
516
|
item: e.item,
|
|
517
517
|
layout: e.layout,
|
|
518
518
|
"loaded-count": e.loadedCount,
|
|
519
|
-
"media-count":
|
|
520
|
-
"media-index":
|
|
521
|
-
"media-item":
|
|
519
|
+
"media-count": i.value.length,
|
|
520
|
+
"media-index": n.value,
|
|
521
|
+
"media-item": o.value,
|
|
522
522
|
"media-source": e.mediaSource ?? "preview",
|
|
523
523
|
total: e.total
|
|
524
524
|
}, null, 8, [
|
|
@@ -533,18 +533,18 @@ var Oe = /* @__PURE__ */ u({
|
|
|
533
533
|
"total"
|
|
534
534
|
]))], 38));
|
|
535
535
|
}
|
|
536
|
-
}),
|
|
536
|
+
}), Ae = [
|
|
537
537
|
"max",
|
|
538
538
|
"value",
|
|
539
539
|
"aria-valuetext",
|
|
540
540
|
"disabled"
|
|
541
|
-
],
|
|
541
|
+
], je = {
|
|
542
542
|
key: 0,
|
|
543
543
|
class: "media-controls-row"
|
|
544
|
-
},
|
|
544
|
+
}, Me = ["aria-label", "title"], Ne = { class: "media-controls-audio" }, Pe = ["aria-label", "title"], Fe = ["value", "aria-valuetext"], Ie = {
|
|
545
545
|
class: "media-control-time",
|
|
546
546
|
"aria-live": "off"
|
|
547
|
-
},
|
|
547
|
+
}, Le = /* @__PURE__ */ d({
|
|
548
548
|
__name: "MediaControls",
|
|
549
549
|
props: {
|
|
550
550
|
currentTime: {},
|
|
@@ -561,7 +561,7 @@ var Oe = /* @__PURE__ */ u({
|
|
|
561
561
|
"volumeChange"
|
|
562
562
|
],
|
|
563
563
|
setup(e, { emit: t }) {
|
|
564
|
-
let
|
|
564
|
+
let n = e, i = t;
|
|
565
565
|
function l(e, t = 1) {
|
|
566
566
|
return Number.isFinite(e) ? Math.min(t, Math.max(0, e)) : 0;
|
|
567
567
|
}
|
|
@@ -572,70 +572,70 @@ var Oe = /* @__PURE__ */ u({
|
|
|
572
572
|
function d(e) {
|
|
573
573
|
return Number(e.target.value);
|
|
574
574
|
}
|
|
575
|
-
let f =
|
|
576
|
-
return (t, n) => (y(),
|
|
577
|
-
class:
|
|
575
|
+
let f = r(() => Math.max(0, n.duration)), p = r(() => l(n.currentTime, f.value)), m = r(() => ({ "--media-range-progress": `${f.value > 0 ? p.value / f.value * 100 : 0}%` })), g = r(() => ({ "--media-range-progress": `${l(n.volume) * 100}%` }));
|
|
576
|
+
return (t, n) => (y(), s("div", {
|
|
577
|
+
class: h(["media-controls", `media-controls--${e.layout}`]),
|
|
578
578
|
"aria-label": "Video controls",
|
|
579
579
|
onClick: n[4] ||= A(() => {}, ["stop"]),
|
|
580
580
|
onDblclick: n[5] ||= A(() => {}, ["stop"]),
|
|
581
581
|
onKeydown: n[6] ||= A(() => {}, ["stop"]),
|
|
582
582
|
onWheel: n[7] ||= A(() => {}, ["stop"])
|
|
583
|
-
}, [
|
|
583
|
+
}, [c("input", {
|
|
584
584
|
class: "media-control-range media-control-seek",
|
|
585
585
|
type: "range",
|
|
586
586
|
min: "0",
|
|
587
587
|
max: f.value || 0,
|
|
588
588
|
step: "0.1",
|
|
589
589
|
value: p.value,
|
|
590
|
-
style:
|
|
590
|
+
style: _(m.value),
|
|
591
591
|
"aria-label": "Seek video",
|
|
592
592
|
"aria-valuetext": `${u(p.value)} of ${u(f.value)}`,
|
|
593
593
|
disabled: f.value <= 0,
|
|
594
|
-
onInput: n[0] ||= (e) =>
|
|
595
|
-
}, null, 44,
|
|
596
|
-
|
|
594
|
+
onInput: n[0] ||= (e) => i("seek", d(e))
|
|
595
|
+
}, null, 44, Ae), e.layout === "reel" ? (y(), s("div", je, [
|
|
596
|
+
c("button", {
|
|
597
597
|
type: "button",
|
|
598
598
|
class: "media-control-button media-control-playback",
|
|
599
599
|
"aria-label": e.playing ? "Pause video" : "Play video",
|
|
600
600
|
title: e.playing ? "Pause" : "Play",
|
|
601
|
-
onClick: n[1] ||= (e) =>
|
|
602
|
-
}, [e.playing ? (y(),
|
|
601
|
+
onClick: n[1] ||= (e) => i("togglePlayback")
|
|
602
|
+
}, [e.playing ? (y(), a(T(be), {
|
|
603
603
|
key: 0,
|
|
604
604
|
size: 18,
|
|
605
605
|
fill: "currentColor"
|
|
606
|
-
})) : (y(),
|
|
606
|
+
})) : (y(), a(T(xe), {
|
|
607
607
|
key: 1,
|
|
608
608
|
size: 18,
|
|
609
609
|
fill: "currentColor"
|
|
610
|
-
}))], 8,
|
|
611
|
-
|
|
610
|
+
}))], 8, Me),
|
|
611
|
+
c("div", Ne, [c("button", {
|
|
612
612
|
type: "button",
|
|
613
613
|
class: "media-control-button",
|
|
614
614
|
"aria-label": e.muted ? "Unmute video" : "Mute video",
|
|
615
615
|
title: e.muted ? "Unmute" : "Mute",
|
|
616
|
-
onClick: n[2] ||= (e) =>
|
|
617
|
-
}, [e.muted || e.volume === 0 ? (y(),
|
|
616
|
+
onClick: n[2] ||= (e) => i("toggleMute")
|
|
617
|
+
}, [e.muted || e.volume === 0 ? (y(), a(T(Ce), {
|
|
618
618
|
key: 0,
|
|
619
619
|
size: 18
|
|
620
|
-
})) : (y(),
|
|
620
|
+
})) : (y(), a(T(Se), {
|
|
621
621
|
key: 1,
|
|
622
622
|
size: 18
|
|
623
|
-
}))], 8,
|
|
623
|
+
}))], 8, Pe), c("input", {
|
|
624
624
|
class: "media-control-range media-control-volume",
|
|
625
625
|
type: "range",
|
|
626
626
|
min: "0",
|
|
627
627
|
max: "1",
|
|
628
628
|
step: "0.05",
|
|
629
629
|
value: e.volume,
|
|
630
|
-
style: g
|
|
630
|
+
style: _(g.value),
|
|
631
631
|
"aria-label": "Video volume",
|
|
632
632
|
"aria-valuetext": `${Math.round(e.volume * 100)} percent`,
|
|
633
|
-
onInput: n[3] ||= (e) =>
|
|
634
|
-
}, null, 44,
|
|
635
|
-
|
|
636
|
-
])) :
|
|
633
|
+
onInput: n[3] ||= (e) => i("volumeChange", d(e))
|
|
634
|
+
}, null, 44, Fe)]),
|
|
635
|
+
c("output", Ie, w(u(p.value)) + " / " + w(u(f.value)), 1)
|
|
636
|
+
])) : o("", !0)], 34));
|
|
637
637
|
}
|
|
638
|
-
}),
|
|
638
|
+
}), Re = [
|
|
639
639
|
"data-post-id",
|
|
640
640
|
"data-media-index",
|
|
641
641
|
"aria-hidden",
|
|
@@ -643,26 +643,27 @@ var Oe = /* @__PURE__ */ u({
|
|
|
643
643
|
"inert",
|
|
644
644
|
"role",
|
|
645
645
|
"tabindex"
|
|
646
|
-
],
|
|
646
|
+
], ze = { class: "media-card-content" }, Be = ["data-media-direction"], Ve = ["data-media-index"], He = {
|
|
647
647
|
key: 0,
|
|
648
648
|
"data-test": "media-loading",
|
|
649
649
|
class: "media-loading",
|
|
650
650
|
"aria-hidden": "true"
|
|
651
|
-
},
|
|
651
|
+
}, Ue = ["aria-label"], We = { class: "media-error-code" }, Ge = [
|
|
652
652
|
"src",
|
|
653
653
|
"width",
|
|
654
654
|
"height",
|
|
655
655
|
"loop",
|
|
656
656
|
"muted",
|
|
657
657
|
"preload"
|
|
658
|
-
],
|
|
658
|
+
], Ke = [
|
|
659
659
|
"src",
|
|
660
660
|
"width",
|
|
661
661
|
"height",
|
|
662
662
|
"fetchpriority"
|
|
663
|
-
],
|
|
663
|
+
], qe = ["aria-label"], Je = ["aria-label"], Ye = ["aria-label"], Xe = 40, Ze = 160, Qe = 24, $e = /* @__PURE__ */ d({
|
|
664
664
|
__name: "MediaCard",
|
|
665
665
|
props: {
|
|
666
|
+
active: { type: Boolean },
|
|
666
667
|
advanceOnMediaEnd: { type: Boolean },
|
|
667
668
|
cardFooter: {},
|
|
668
669
|
cardHeader: {},
|
|
@@ -679,6 +680,8 @@ var Oe = /* @__PURE__ */ u({
|
|
|
679
680
|
mediaCard: {},
|
|
680
681
|
mediaSource: {},
|
|
681
682
|
previewState: {},
|
|
683
|
+
reelControlsTarget: {},
|
|
684
|
+
stationaryReelControls: { type: Boolean },
|
|
682
685
|
total: {}
|
|
683
686
|
},
|
|
684
687
|
emits: [
|
|
@@ -688,50 +691,50 @@ var Oe = /* @__PURE__ */ u({
|
|
|
688
691
|
"mediaChange",
|
|
689
692
|
"ready"
|
|
690
693
|
],
|
|
691
|
-
setup(e, { emit:
|
|
692
|
-
let
|
|
694
|
+
setup(e, { emit: i }) {
|
|
695
|
+
let l = e, d = null, f = 0, p = !1, m = null, g = null, v = C("next"), b = i;
|
|
693
696
|
function x(e = !1, t = "pointer") {
|
|
694
697
|
e && b("activate", t);
|
|
695
698
|
}
|
|
696
|
-
let S =
|
|
697
|
-
function
|
|
699
|
+
let S = r(() => j(l.item)), E = r(() => M(l.item, l.mediaIndex)), D = r(() => N(l.item, E.value)), P = r(() => l.mediaSource === "original" ? D.value.src : D.value.preview.src), F = r(() => l.mediaSource === "original" ? D.value.width : D.value.preview.width), I = r(() => l.mediaSource === "original" ? D.value.height : D.value.preview.height), L = C(null), R = C(0), z = C(0), B = C(!0), V = C(!1), H = C(1), U = 1, W = r(() => l.interactive && !!(l.cardHeader || l.cardFooter));
|
|
700
|
+
function te(e) {
|
|
698
701
|
return e.detail === 0 ? "keyboard" : "pointer";
|
|
699
702
|
}
|
|
700
703
|
function G(e, t) {
|
|
701
704
|
let n = S.value.length, r = (e + n) % n;
|
|
702
705
|
r !== E.value && (v.value = e < E.value ? "previous" : "next", b("mediaChange", r), t && t.detail > 0 && t.currentTarget?.blur());
|
|
703
706
|
}
|
|
704
|
-
function
|
|
707
|
+
function ne(e, t, n) {
|
|
705
708
|
return t === 1 ? e * 16 : t === 2 ? e * n : e;
|
|
706
709
|
}
|
|
707
|
-
function ne() {
|
|
708
|
-
d = 0, f = !1, u !== null && clearTimeout(u), u = null;
|
|
709
|
-
}
|
|
710
710
|
function re() {
|
|
711
|
-
|
|
711
|
+
f = 0, p = !1, d !== null && clearTimeout(d), d = null;
|
|
712
|
+
}
|
|
713
|
+
function ie() {
|
|
714
|
+
d !== null && clearTimeout(d), d = setTimeout(re, Ze);
|
|
712
715
|
}
|
|
713
716
|
function K(e) {
|
|
714
717
|
if (S.value.length <= 1) return;
|
|
715
|
-
let t = e.currentTarget?.clientWidth || 1, n =
|
|
716
|
-
if (n === 0 || (e.preventDefault(),
|
|
717
|
-
let r = Math.sign(
|
|
718
|
-
|
|
718
|
+
let t = e.currentTarget?.clientWidth || 1, n = ne(e.deltaX, e.deltaMode, t);
|
|
719
|
+
if (n === 0 || (e.preventDefault(), ie(), p) || (f += n, Math.abs(f) < Qe)) return;
|
|
720
|
+
let r = Math.sign(f);
|
|
721
|
+
f = 0, p = !0, G(E.value + r);
|
|
719
722
|
}
|
|
720
723
|
function q(e) {
|
|
721
724
|
let t = e.touches[0];
|
|
722
|
-
|
|
725
|
+
l.layout !== "reel" || !t || (m = t.clientX, g = t.clientY);
|
|
723
726
|
}
|
|
724
|
-
function
|
|
727
|
+
function ae(e) {
|
|
725
728
|
let t = e.changedTouches[0];
|
|
726
|
-
if (
|
|
727
|
-
let n =
|
|
728
|
-
|
|
729
|
+
if (m === null || g === null || !t) return;
|
|
730
|
+
let n = m - t.clientX, r = g - t.clientY;
|
|
731
|
+
m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) < Xe || G(E.value + Math.sign(n)));
|
|
729
732
|
}
|
|
730
|
-
let Y =
|
|
731
|
-
function
|
|
732
|
-
|
|
733
|
+
let J = r(() => Oe(P.value)), Y = r(() => l.layout === "reel" && l.stationaryReelControls === !0), oe = r(() => J.value && l.previewState === "ready" && (!Y.value || !!(l.active && l.reelControlsTarget))), se = r(() => `${l.item.postId}:${E.value}:${P.value}`);
|
|
734
|
+
function X(e) {
|
|
735
|
+
l.layout === "reel" && (e.stopPropagation(), ce());
|
|
733
736
|
}
|
|
734
|
-
async function
|
|
737
|
+
async function ce() {
|
|
735
738
|
if (L.value) {
|
|
736
739
|
if (V.value) {
|
|
737
740
|
L.value.pause();
|
|
@@ -744,54 +747,54 @@ var Oe = /* @__PURE__ */ u({
|
|
|
744
747
|
}
|
|
745
748
|
}
|
|
746
749
|
}
|
|
747
|
-
function
|
|
750
|
+
function le(e) {
|
|
748
751
|
return Number.isFinite(e) ? Math.max(0, e) : 0;
|
|
749
752
|
}
|
|
750
|
-
function
|
|
753
|
+
function Z(e) {
|
|
751
754
|
let t = e?.currentTarget ?? L.value;
|
|
752
|
-
t && (R.value =
|
|
755
|
+
t && (R.value = le(t.currentTime), z.value = le(t.duration), B.value = t.muted, H.value = t.volume, t.volume > 0 && (U = t.volume));
|
|
753
756
|
}
|
|
754
|
-
function
|
|
755
|
-
|
|
757
|
+
function ue(e) {
|
|
758
|
+
Z(e), b("ready", E.value);
|
|
756
759
|
}
|
|
757
|
-
function
|
|
760
|
+
function de() {
|
|
758
761
|
V.value = !1, b("ended", E.value);
|
|
759
762
|
}
|
|
760
|
-
function
|
|
763
|
+
function fe(e) {
|
|
761
764
|
let t = L.value;
|
|
762
|
-
!t || !Number.isFinite(e) || (t.currentTime = Math.min(
|
|
765
|
+
!t || !Number.isFinite(e) || (t.currentTime = Math.min(le(t.duration), Math.max(0, e)), R.value = t.currentTime);
|
|
763
766
|
}
|
|
764
|
-
function
|
|
767
|
+
function pe(e) {
|
|
765
768
|
let t = L.value;
|
|
766
769
|
if (!t || !Number.isFinite(e)) return;
|
|
767
770
|
let n = Math.min(1, Math.max(0, e));
|
|
768
|
-
t.volume = n, t.muted = n === 0, n > 0 && (U = n),
|
|
771
|
+
t.volume = n, t.muted = n === 0, n > 0 && (U = n), Z();
|
|
769
772
|
}
|
|
770
|
-
function
|
|
773
|
+
function me() {
|
|
771
774
|
let e = L.value;
|
|
772
|
-
e && (e.muted && e.volume === 0 && (e.volume = U), e.muted = !e.muted,
|
|
775
|
+
e && (e.muted && e.volume === 0 && (e.volume = U), e.muted = !e.muted, Z());
|
|
773
776
|
}
|
|
774
|
-
return
|
|
775
|
-
|
|
776
|
-
}), (
|
|
777
|
+
return ee(() => {
|
|
778
|
+
re();
|
|
779
|
+
}), (r, i) => (y(), s("article", {
|
|
777
780
|
"data-post-id": e.item.postId,
|
|
778
781
|
"data-media-index": E.value,
|
|
779
|
-
class:
|
|
782
|
+
class: h(["media-card", {
|
|
780
783
|
"media-card--entering": e.entering,
|
|
781
784
|
"media-card--leaving": e.leaving,
|
|
782
785
|
"media-card--error": e.previewState === "error",
|
|
783
786
|
"media-card--transparent-chrome": e.mediaCard?.header?.background === "transparent" || e.mediaCard?.footer?.background === "transparent" || e.cardHeader?.background === "transparent" || e.cardFooter?.background === "transparent"
|
|
784
787
|
}]),
|
|
785
|
-
style:
|
|
788
|
+
style: _(e.itemStyle),
|
|
786
789
|
"aria-hidden": e.leaving || void 0,
|
|
787
790
|
"aria-busy": e.previewState === "loading",
|
|
788
791
|
inert: e.leaving || void 0,
|
|
789
792
|
role: e.interactive && !e.leaving && !W.value ? "button" : void 0,
|
|
790
793
|
tabindex: e.interactive && !e.leaving && !W.value ? 0 : void 0,
|
|
791
|
-
onClick:
|
|
792
|
-
onKeydown: [
|
|
793
|
-
}, [
|
|
794
|
-
e.cardHeader ? (y(),
|
|
794
|
+
onClick: i[11] ||= (t) => x(e.interactive && !W.value, te(t)),
|
|
795
|
+
onKeydown: [i[12] ||= k((t) => x(e.interactive && !W.value, "keyboard"), ["enter"]), i[13] ||= k(A((t) => x(e.interactive && !W.value, "keyboard"), ["prevent"]), ["space"])]
|
|
796
|
+
}, [c("div", ze, [
|
|
797
|
+
e.cardHeader ? (y(), a(ke, {
|
|
795
798
|
key: 0,
|
|
796
799
|
index: e.index,
|
|
797
800
|
item: e.item,
|
|
@@ -801,7 +804,7 @@ var Oe = /* @__PURE__ */ u({
|
|
|
801
804
|
"media-source": e.mediaSource,
|
|
802
805
|
placement: "header",
|
|
803
806
|
region: e.cardHeader,
|
|
804
|
-
style:
|
|
807
|
+
style: _(e.mediaCard?.header),
|
|
805
808
|
total: e.total
|
|
806
809
|
}, null, 8, [
|
|
807
810
|
"index",
|
|
@@ -813,30 +816,30 @@ var Oe = /* @__PURE__ */ u({
|
|
|
813
816
|
"region",
|
|
814
817
|
"style",
|
|
815
818
|
"total"
|
|
816
|
-
])) :
|
|
817
|
-
|
|
818
|
-
class:
|
|
819
|
+
])) : o("", !0),
|
|
820
|
+
c("div", {
|
|
821
|
+
class: h(["media-card-media", { "media-card-media--carousel": e.layout === "reel" && S.value.length > 1 }]),
|
|
819
822
|
"data-media-direction": v.value,
|
|
820
823
|
onWheel: K,
|
|
821
824
|
onTouchstartPassive: q,
|
|
822
|
-
onTouchendPassive:
|
|
825
|
+
onTouchendPassive: ae
|
|
823
826
|
}, [
|
|
824
|
-
|
|
825
|
-
default: O(() => [(y(),
|
|
827
|
+
u(n, { name: `media-slide-${v.value}` }, {
|
|
828
|
+
default: O(() => [(y(), s("div", {
|
|
826
829
|
key: `${e.item.postId}:${D.value.src}:${e.mediaSource ?? "preview"}`,
|
|
827
830
|
class: "media-card-frame",
|
|
828
831
|
"data-media-index": E.value
|
|
829
|
-
}, [e.previewState === "loading" ? (y(),
|
|
832
|
+
}, [e.previewState === "loading" ? (y(), s("div", He, [...i[14] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : e.previewState === "error" ? (y(), s("div", {
|
|
830
833
|
key: 1,
|
|
831
834
|
"data-test": "media-error",
|
|
832
835
|
class: "media-error",
|
|
833
836
|
role: "img",
|
|
834
|
-
"aria-label": `${T(
|
|
835
|
-
}, [
|
|
837
|
+
"aria-label": `${T(Te)(P.value)} ${T(Ee)(P.value)}`
|
|
838
|
+
}, [c("strong", We, w(T(Te)(P.value)), 1), c("span", null, w(T(Ee)(P.value)), 1)], 8, Ue)) : o("", !0), J.value ? (y(), s("video", {
|
|
836
839
|
key: 2,
|
|
837
840
|
ref_key: "videoElement",
|
|
838
841
|
ref: L,
|
|
839
|
-
class:
|
|
842
|
+
class: h(["media-preview", {
|
|
840
843
|
"media-preview--ready": e.previewState === "ready",
|
|
841
844
|
"media-preview--reel-video": e.layout === "reel"
|
|
842
845
|
}]),
|
|
@@ -848,18 +851,18 @@ var Oe = /* @__PURE__ */ u({
|
|
|
848
851
|
muted: B.value,
|
|
849
852
|
playsinline: "",
|
|
850
853
|
preload: e.fetchPriority === "high" ? "auto" : "metadata",
|
|
851
|
-
onLoadedmetadata:
|
|
852
|
-
onDurationchange:
|
|
853
|
-
onTimeupdate:
|
|
854
|
-
onVolumechange:
|
|
855
|
-
onPlaying:
|
|
856
|
-
onPause:
|
|
857
|
-
onEnded:
|
|
858
|
-
onClick:
|
|
859
|
-
onError:
|
|
860
|
-
}, null, 42,
|
|
854
|
+
onLoadedmetadata: ue,
|
|
855
|
+
onDurationchange: Z,
|
|
856
|
+
onTimeupdate: Z,
|
|
857
|
+
onVolumechange: Z,
|
|
858
|
+
onPlaying: i[0] ||= (e) => V.value = !0,
|
|
859
|
+
onPause: i[1] ||= (e) => V.value = !1,
|
|
860
|
+
onEnded: de,
|
|
861
|
+
onClick: X,
|
|
862
|
+
onError: i[2] ||= (e) => r.$emit("error", E.value)
|
|
863
|
+
}, null, 42, Ge)) : (y(), s("img", {
|
|
861
864
|
key: 3,
|
|
862
|
-
class:
|
|
865
|
+
class: h(["media-preview", { "media-preview--ready": e.previewState === "ready" }]),
|
|
863
866
|
src: P.value,
|
|
864
867
|
width: F.value ?? void 0,
|
|
865
868
|
height: I.value ?? void 0,
|
|
@@ -867,58 +870,69 @@ var Oe = /* @__PURE__ */ u({
|
|
|
867
870
|
alt: "",
|
|
868
871
|
decoding: "async",
|
|
869
872
|
loading: "eager",
|
|
870
|
-
onLoad:
|
|
871
|
-
onError:
|
|
872
|
-
}, null, 42,
|
|
873
|
+
onLoad: i[3] ||= (e) => r.$emit("ready", E.value),
|
|
874
|
+
onError: i[4] ||= (e) => r.$emit("error", E.value)
|
|
875
|
+
}, null, 42, Ke))], 8, Ve))]),
|
|
873
876
|
_: 1
|
|
874
877
|
}, 8, ["name"]),
|
|
875
|
-
|
|
878
|
+
(y(), a(t, {
|
|
879
|
+
disabled: !Y.value || !e.reelControlsTarget,
|
|
880
|
+
to: e.reelControlsTarget ?? "body"
|
|
881
|
+
}, [u(n, {
|
|
882
|
+
name: "vibe-reel-media-controls",
|
|
883
|
+
css: Y.value
|
|
884
|
+
}, {
|
|
885
|
+
default: O(() => [oe.value ? (y(), a(Le, {
|
|
886
|
+
key: se.value,
|
|
887
|
+
"current-time": R.value,
|
|
888
|
+
"data-control-post-id": Y.value ? e.item.postId : void 0,
|
|
889
|
+
duration: z.value,
|
|
890
|
+
layout: e.layout,
|
|
891
|
+
muted: B.value,
|
|
892
|
+
playing: V.value,
|
|
893
|
+
volume: H.value,
|
|
894
|
+
onSeek: fe,
|
|
895
|
+
onToggleMute: me,
|
|
896
|
+
onTogglePlayback: ce,
|
|
897
|
+
onVolumeChange: pe
|
|
898
|
+
}, null, 8, [
|
|
899
|
+
"current-time",
|
|
900
|
+
"data-control-post-id",
|
|
901
|
+
"duration",
|
|
902
|
+
"layout",
|
|
903
|
+
"muted",
|
|
904
|
+
"playing",
|
|
905
|
+
"volume"
|
|
906
|
+
])) : o("", !0)]),
|
|
907
|
+
_: 1
|
|
908
|
+
}, 8, ["css"])], 8, ["disabled", "to"])),
|
|
909
|
+
S.value.length > 1 ? (y(), s("div", {
|
|
876
910
|
key: 0,
|
|
877
|
-
"
|
|
878
|
-
duration: z.value,
|
|
879
|
-
layout: e.layout,
|
|
880
|
-
muted: B.value,
|
|
881
|
-
playing: V.value,
|
|
882
|
-
volume: H.value,
|
|
883
|
-
onSeek: ce,
|
|
884
|
-
onToggleMute: ue,
|
|
885
|
-
onTogglePlayback: ae,
|
|
886
|
-
onVolumeChange: le
|
|
887
|
-
}, null, 8, [
|
|
888
|
-
"current-time",
|
|
889
|
-
"duration",
|
|
890
|
-
"layout",
|
|
891
|
-
"muted",
|
|
892
|
-
"playing",
|
|
893
|
-
"volume"
|
|
894
|
-
])) : a("", !0),
|
|
895
|
-
S.value.length > 1 ? (y(), o("div", {
|
|
896
|
-
key: 1,
|
|
897
|
-
class: m(["media-carousel-controls", { "media-carousel-controls--persistent": e.layout === "reel" }]),
|
|
911
|
+
class: h(["media-carousel-controls", { "media-carousel-controls--persistent": e.layout === "reel" }]),
|
|
898
912
|
"aria-label": "Media navigation"
|
|
899
|
-
}, [
|
|
913
|
+
}, [c("button", {
|
|
900
914
|
type: "button",
|
|
901
915
|
class: "media-carousel-control media-carousel-control--previous",
|
|
902
916
|
"aria-label": `Previous media for post ${e.item.postId}`,
|
|
903
|
-
onClick:
|
|
904
|
-
onKeydown:
|
|
905
|
-
}, [
|
|
917
|
+
onClick: i[5] ||= A((e) => G(E.value - 1, e), ["stop"]),
|
|
918
|
+
onKeydown: i[6] ||= A(() => {}, ["stop"])
|
|
919
|
+
}, [u(T(ve), { size: 20 })], 40, qe), c("button", {
|
|
906
920
|
type: "button",
|
|
907
921
|
class: "media-carousel-control media-carousel-control--next",
|
|
908
922
|
"aria-label": `Next media for post ${e.item.postId}`,
|
|
909
|
-
onClick:
|
|
910
|
-
onKeydown:
|
|
911
|
-
}, [
|
|
912
|
-
W.value ? (y(),
|
|
913
|
-
key:
|
|
923
|
+
onClick: i[7] ||= A((e) => G(E.value + 1, e), ["stop"]),
|
|
924
|
+
onKeydown: i[8] ||= A(() => {}, ["stop"])
|
|
925
|
+
}, [u(T(ye), { size: 20 })], 40, Je)], 2)) : o("", !0),
|
|
926
|
+
W.value ? (y(), s("button", {
|
|
927
|
+
key: 1,
|
|
914
928
|
class: "media-card-activator",
|
|
915
929
|
type: "button",
|
|
916
930
|
"aria-label": `Open post ${e.item.postId}`,
|
|
917
|
-
onClick:
|
|
918
|
-
onKeydown:
|
|
919
|
-
}, null, 40,
|
|
920
|
-
], 42,
|
|
921
|
-
e.cardFooter ? (y(),
|
|
931
|
+
onClick: i[9] ||= A((e) => r.$emit("activate", te(e)), ["stop"]),
|
|
932
|
+
onKeydown: i[10] ||= A(() => {}, ["stop"])
|
|
933
|
+
}, null, 40, Ye)) : o("", !0)
|
|
934
|
+
], 42, Be),
|
|
935
|
+
e.cardFooter ? (y(), a(ke, {
|
|
922
936
|
key: 1,
|
|
923
937
|
index: e.index,
|
|
924
938
|
item: e.item,
|
|
@@ -928,7 +942,7 @@ var Oe = /* @__PURE__ */ u({
|
|
|
928
942
|
"media-source": e.mediaSource,
|
|
929
943
|
placement: "footer",
|
|
930
944
|
region: e.cardFooter,
|
|
931
|
-
style:
|
|
945
|
+
style: _(e.mediaCard?.footer),
|
|
932
946
|
total: e.total
|
|
933
947
|
}, null, 8, [
|
|
934
948
|
"index",
|
|
@@ -940,10 +954,10 @@ var Oe = /* @__PURE__ */ u({
|
|
|
940
954
|
"region",
|
|
941
955
|
"style",
|
|
942
956
|
"total"
|
|
943
|
-
])) :
|
|
944
|
-
])], 46,
|
|
957
|
+
])) : o("", !0)
|
|
958
|
+
])], 46, Re));
|
|
945
959
|
}
|
|
946
|
-
}),
|
|
960
|
+
}), et = { class: "masonry-feed-shell" }, tt = ["aria-hidden", "inert"], nt = 240, rt = 6, it = 12, at = 800, ot = 1.5, st = /* @__PURE__ */ d({
|
|
947
961
|
__name: "MasonryFeed",
|
|
948
962
|
props: {
|
|
949
963
|
enteringPostIds: {},
|
|
@@ -976,115 +990,115 @@ var Oe = /* @__PURE__ */ u({
|
|
|
976
990
|
"ready",
|
|
977
991
|
"retryEnd"
|
|
978
992
|
],
|
|
979
|
-
setup(t, { expose:
|
|
980
|
-
let
|
|
981
|
-
additionalHeight: (
|
|
982
|
-
gap:
|
|
983
|
-
minColumnWidth:
|
|
984
|
-
})),
|
|
985
|
-
let e =
|
|
986
|
-
if (
|
|
987
|
-
let t =
|
|
988
|
-
additionalHeight: (
|
|
989
|
-
gap:
|
|
990
|
-
minColumnWidth:
|
|
993
|
+
setup(t, { expose: n, emit: i }) {
|
|
994
|
+
let o = t, l = i, d = C(null), f = `vibe-masonry-${E()}`, p = C(null), m = C(0), g = C(rt), v = C(0), b = C(0), S = C(0), w = null, O = null, k = null, A = r(() => q(o.items, m.value, {
|
|
995
|
+
additionalHeight: (o.cardHeader?.height ?? 0) + (o.cardFooter?.height ?? 0),
|
|
996
|
+
gap: g.value,
|
|
997
|
+
minColumnWidth: nt
|
|
998
|
+
})), j = r(() => {
|
|
999
|
+
let e = A.value;
|
|
1000
|
+
if (o.leavingPostIds.size === 0) return e;
|
|
1001
|
+
let t = o.items.filter((e) => !o.leavingPostIds.has(e.postId)), n = q(t, m.value, {
|
|
1002
|
+
additionalHeight: (o.cardHeader?.height ?? 0) + (o.cardFooter?.height ?? 0),
|
|
1003
|
+
gap: g.value,
|
|
1004
|
+
minColumnWidth: nt
|
|
991
1005
|
}), r = new Map(t.map((e, t) => [e.postId, n.items[t]]));
|
|
992
1006
|
return {
|
|
993
1007
|
...n,
|
|
994
|
-
items:
|
|
1008
|
+
items: o.items.map((t, n) => o.leavingPostIds.has(t.postId) ? e.items[n] : r.get(t.postId) ?? e.items[n])
|
|
995
1009
|
};
|
|
996
|
-
}),
|
|
997
|
-
let e = Math.max(
|
|
998
|
-
scrollTop:
|
|
999
|
-
viewportHeight:
|
|
1000
|
-
}, n = K(
|
|
1010
|
+
}), M = r(() => ({ height: `${o.leavingPostIds.size === 0 ? j.value.height : A.value.height}px` })), N = r(() => {
|
|
1011
|
+
let e = Math.max(at, b.value * ot), t = {
|
|
1012
|
+
scrollTop: v.value - S.value,
|
|
1013
|
+
viewportHeight: b.value
|
|
1014
|
+
}, n = K(j.value.items, {
|
|
1001
1015
|
...t,
|
|
1002
1016
|
overscan: e
|
|
1003
|
-
}), r =
|
|
1017
|
+
}), r = o.leavingPostIds.size === 0 ? [] : K(A.value.items, {
|
|
1004
1018
|
...t,
|
|
1005
1019
|
overscan: e
|
|
1006
|
-
}), i = [...new Set([...n, ...r])].sort((e, t) => e - t), a = K(
|
|
1020
|
+
}), i = [...new Set([...n, ...r])].sort((e, t) => e - t), a = K(j.value.items, {
|
|
1007
1021
|
...t,
|
|
1008
1022
|
overscan: 0
|
|
1009
|
-
}),
|
|
1023
|
+
}), s = o.leavingPostIds.size === 0 ? [] : K(A.value.items, {
|
|
1010
1024
|
...t,
|
|
1011
1025
|
overscan: 0
|
|
1012
|
-
}),
|
|
1026
|
+
}), c = new Set([...a, ...s]);
|
|
1013
1027
|
return i.flatMap((e) => {
|
|
1014
|
-
let t =
|
|
1028
|
+
let t = o.items[e];
|
|
1015
1029
|
return t ? [{
|
|
1016
|
-
fetchPriority:
|
|
1030
|
+
fetchPriority: c.has(e) ? "high" : "low",
|
|
1017
1031
|
index: e,
|
|
1018
1032
|
item: t
|
|
1019
1033
|
}] : [];
|
|
1020
1034
|
});
|
|
1021
1035
|
});
|
|
1022
|
-
function
|
|
1023
|
-
let t =
|
|
1036
|
+
function F(e) {
|
|
1037
|
+
let t = j.value.items[e], n = o.items[e]?.postId;
|
|
1024
1038
|
if (!t) return {};
|
|
1025
|
-
let r = n !== void 0 &&
|
|
1026
|
-
containerHeight:
|
|
1027
|
-
gap:
|
|
1028
|
-
}) : 0,
|
|
1039
|
+
let r = n !== void 0 && o.enteringPostIds.has(n), i = n !== void 0 && o.leavingPostIds.has(n), a = r || i ? ie({
|
|
1040
|
+
containerHeight: A.value.height,
|
|
1041
|
+
gap: g.value
|
|
1042
|
+
}) : 0, s = n === void 0 ? 0 : i ? o.removalDelays.get(n) ?? 0 : r ? o.entryDelays.get(n) ?? 0 : 0;
|
|
1029
1043
|
return {
|
|
1030
|
-
"--masonry-entry-delay": `${
|
|
1044
|
+
"--masonry-entry-delay": `${s}ms`,
|
|
1031
1045
|
width: `${t.width}px`,
|
|
1032
1046
|
height: `${t.height}px`,
|
|
1033
1047
|
transform: `translate3d(${t.x}px, ${t.y + a}px, 0)`
|
|
1034
1048
|
};
|
|
1035
1049
|
}
|
|
1036
|
-
function
|
|
1050
|
+
function I() {
|
|
1037
1051
|
let e = d.value;
|
|
1038
1052
|
if (!e) return;
|
|
1039
|
-
|
|
1053
|
+
v.value = e.scrollTop, b.value = e.clientHeight;
|
|
1040
1054
|
let t = p.value;
|
|
1041
|
-
t && (
|
|
1055
|
+
t && (S.value = t.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop);
|
|
1042
1056
|
}
|
|
1043
|
-
function
|
|
1057
|
+
function L(e) {
|
|
1044
1058
|
let t = e.ownerDocument.documentElement.clientWidth;
|
|
1045
|
-
|
|
1059
|
+
m.value = e.clientWidth, g.value = Math.min(it, Math.max(rt, t * .0075)), I();
|
|
1046
1060
|
}
|
|
1047
|
-
function
|
|
1061
|
+
function R(e) {
|
|
1048
1062
|
let t = e.currentTarget;
|
|
1049
|
-
t && (
|
|
1063
|
+
t && (v.value = t.scrollTop, !o.loadMoreLocked && o.infiniteScroll && G(t) && l("loadMore"));
|
|
1050
1064
|
}
|
|
1051
|
-
function
|
|
1065
|
+
function z() {
|
|
1052
1066
|
let e = d.value;
|
|
1053
|
-
!
|
|
1067
|
+
!o.loadMoreLocked && e && G(e) && l("loadMore");
|
|
1054
1068
|
}
|
|
1055
|
-
function
|
|
1069
|
+
function B() {
|
|
1056
1070
|
return d.value;
|
|
1057
1071
|
}
|
|
1058
1072
|
return D(p, (e) => {
|
|
1059
|
-
|
|
1073
|
+
w?.disconnect(), w = null, k !== null && cancelAnimationFrame(k), e && (L(e), !(typeof ResizeObserver > "u") && (w = new ResizeObserver(([t]) => {
|
|
1060
1074
|
let n = t?.contentRect.width ?? e.clientWidth;
|
|
1061
|
-
Math.abs(n -
|
|
1062
|
-
|
|
1075
|
+
Math.abs(n - m.value) < .5 || (k = requestAnimationFrame(() => {
|
|
1076
|
+
k = null, L(e);
|
|
1063
1077
|
}));
|
|
1064
|
-
}),
|
|
1078
|
+
}), w.observe(e)));
|
|
1065
1079
|
}), D(d, (e) => {
|
|
1066
|
-
|
|
1067
|
-
}),
|
|
1068
|
-
|
|
1069
|
-
}),
|
|
1070
|
-
getScrollElement:
|
|
1071
|
-
loadIfNearBottom:
|
|
1072
|
-
}), (n, r) => (y(),
|
|
1080
|
+
O?.disconnect(), O = null, e && (I(), !(typeof ResizeObserver > "u") && (O = new ResizeObserver(I), O.observe(e)));
|
|
1081
|
+
}), ee(() => {
|
|
1082
|
+
w?.disconnect(), O?.disconnect(), k !== null && cancelAnimationFrame(k);
|
|
1083
|
+
}), n({
|
|
1084
|
+
getScrollElement: B,
|
|
1085
|
+
loadIfNearBottom: z
|
|
1086
|
+
}), (n, r) => (y(), s("div", et, [c("main", {
|
|
1073
1087
|
id: f,
|
|
1074
1088
|
ref_key: "galleryElement",
|
|
1075
1089
|
ref: d,
|
|
1076
|
-
class:
|
|
1090
|
+
class: h(["gallery-shell masonry-feed", { "masonry-feed--suspended": t.suspended }]),
|
|
1077
1091
|
"data-layout-mode": "masonry",
|
|
1078
1092
|
"aria-hidden": t.suspended || void 0,
|
|
1079
1093
|
inert: t.suspended || void 0,
|
|
1080
|
-
onScrollPassive:
|
|
1081
|
-
}, [
|
|
1094
|
+
onScrollPassive: R
|
|
1095
|
+
}, [c("section", {
|
|
1082
1096
|
ref_key: "masonryElement",
|
|
1083
1097
|
ref: p,
|
|
1084
|
-
class:
|
|
1085
|
-
style:
|
|
1098
|
+
class: h(["masonry", { "masonry--ready": m.value > 0 }]),
|
|
1099
|
+
style: _(M.value),
|
|
1086
1100
|
"aria-label": "Media gallery"
|
|
1087
|
-
}, [(y(!0),
|
|
1101
|
+
}, [(y(!0), s(e, null, x(N.value, ({ fetchPriority: e, item: n, index: r }) => (y(), a($e, {
|
|
1088
1102
|
key: n.postId,
|
|
1089
1103
|
class: "masonry-item",
|
|
1090
1104
|
entering: t.enteringPostIds.has(n.postId),
|
|
@@ -1095,17 +1109,17 @@ var Oe = /* @__PURE__ */ u({
|
|
|
1095
1109
|
"media-card": t.mediaCard,
|
|
1096
1110
|
index: r,
|
|
1097
1111
|
item: n,
|
|
1098
|
-
"item-style":
|
|
1112
|
+
"item-style": F(r),
|
|
1099
1113
|
interactive: "",
|
|
1100
1114
|
layout: "masonry",
|
|
1101
1115
|
"loaded-count": t.items.length,
|
|
1102
1116
|
"media-index": t.mediaIndices.get(n.postId) ?? 0,
|
|
1103
1117
|
"preview-state": t.previewStates.get(T(P)(n.postId, t.mediaIndices.get(n.postId) ?? 0)) ?? "loading",
|
|
1104
1118
|
total: t.total,
|
|
1105
|
-
onActivate: (e) =>
|
|
1106
|
-
onMediaChange: (e) =>
|
|
1107
|
-
onReady: (e) =>
|
|
1108
|
-
onError: (e) =>
|
|
1119
|
+
onActivate: (e) => l("activate", n.postId, e),
|
|
1120
|
+
onMediaChange: (e) => l("mediaChange", n.postId, e),
|
|
1121
|
+
onReady: (e) => l("ready", n.postId, e),
|
|
1122
|
+
onError: (e) => l("error", n.postId, e)
|
|
1109
1123
|
}, null, 8, [
|
|
1110
1124
|
"entering",
|
|
1111
1125
|
"leaving",
|
|
@@ -1124,7 +1138,7 @@ var Oe = /* @__PURE__ */ u({
|
|
|
1124
1138
|
"onMediaChange",
|
|
1125
1139
|
"onReady",
|
|
1126
1140
|
"onError"
|
|
1127
|
-
]))), 128))], 6),
|
|
1141
|
+
]))), 128))], 6), u(H, {
|
|
1128
1142
|
actions: t.feedFooterActions,
|
|
1129
1143
|
"can-retry-end": t.canRetryEnd,
|
|
1130
1144
|
"feed-footer": t.feedFooter,
|
|
@@ -1133,8 +1147,8 @@ var Oe = /* @__PURE__ */ u({
|
|
|
1133
1147
|
"is-loading": t.isLoadingMore,
|
|
1134
1148
|
"load-more-locked": t.loadMoreLocked,
|
|
1135
1149
|
state: t.state,
|
|
1136
|
-
onLoadMore: r[0] ||= (e) =>
|
|
1137
|
-
onRetryEnd: r[1] ||= (e) =>
|
|
1150
|
+
onLoadMore: r[0] ||= (e) => l("loadMore"),
|
|
1151
|
+
onRetryEnd: r[1] ||= (e) => l("retryEnd")
|
|
1138
1152
|
}, null, 8, [
|
|
1139
1153
|
"actions",
|
|
1140
1154
|
"can-retry-end",
|
|
@@ -1144,8 +1158,8 @@ var Oe = /* @__PURE__ */ u({
|
|
|
1144
1158
|
"is-loading",
|
|
1145
1159
|
"load-more-locked",
|
|
1146
1160
|
"state"
|
|
1147
|
-
])], 42,
|
|
1148
|
-
"content-size":
|
|
1161
|
+
])], 42, tt), u(le, {
|
|
1162
|
+
"content-size": j.value.height,
|
|
1149
1163
|
"controls-id": f,
|
|
1150
1164
|
"scroll-element": d.value,
|
|
1151
1165
|
suspended: t.suspended
|
|
@@ -1155,8 +1169,8 @@ var Oe = /* @__PURE__ */ u({
|
|
|
1155
1169
|
"suspended"
|
|
1156
1170
|
])]));
|
|
1157
1171
|
}
|
|
1158
|
-
}),
|
|
1159
|
-
function
|
|
1172
|
+
}), ct = 300;
|
|
1173
|
+
function lt(e, t, n) {
|
|
1160
1174
|
let r = e.scrollTop;
|
|
1161
1175
|
if (n || Math.abs(r - t) <= 1) return e.scrollTop = t, Promise.resolve();
|
|
1162
1176
|
e.setAttribute("data-transitioning", "");
|
|
@@ -1164,7 +1178,7 @@ function ct(e, t, n) {
|
|
|
1164
1178
|
return new Promise((n) => {
|
|
1165
1179
|
let o = (s) => {
|
|
1166
1180
|
a += 1;
|
|
1167
|
-
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c /
|
|
1181
|
+
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / ct), u = 1 - (1 - l) ** 3;
|
|
1168
1182
|
if (e.scrollTop = r + (t - r) * u, l < 1) {
|
|
1169
1183
|
requestAnimationFrame(o);
|
|
1170
1184
|
return;
|
|
@@ -1176,7 +1190,7 @@ function ct(e, t, n) {
|
|
|
1176
1190
|
}
|
|
1177
1191
|
//#endregion
|
|
1178
1192
|
//#region src/components/ReelAutoAdvanceProgress.vue?vue&type=script&setup=true&lang.ts
|
|
1179
|
-
var
|
|
1193
|
+
var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
1180
1194
|
__name: "ReelAutoAdvanceProgress",
|
|
1181
1195
|
props: {
|
|
1182
1196
|
durationMs: {},
|
|
@@ -1184,19 +1198,19 @@ var lt = ["aria-label"], ut = /* @__PURE__ */ u({
|
|
|
1184
1198
|
},
|
|
1185
1199
|
emits: ["complete"],
|
|
1186
1200
|
setup(e, { emit: t }) {
|
|
1187
|
-
let
|
|
1188
|
-
return (t, n) => (y(),
|
|
1201
|
+
let n = e, i = t, a = r(() => ({ "--vibe-reel-auto-advance-duration": `${n.durationMs}ms` }));
|
|
1202
|
+
return (t, n) => (y(), s("div", {
|
|
1189
1203
|
class: "reel-auto-advance",
|
|
1190
1204
|
"data-test": "reel-auto-advance",
|
|
1191
1205
|
role: "timer",
|
|
1192
1206
|
"aria-label": e.label
|
|
1193
|
-
}, [
|
|
1207
|
+
}, [c("span", {
|
|
1194
1208
|
class: "reel-auto-advance-progress",
|
|
1195
|
-
style:
|
|
1209
|
+
style: _(a.value),
|
|
1196
1210
|
onAnimationend: n[0] ||= (e) => i("complete")
|
|
1197
|
-
}, null, 36)], 8,
|
|
1211
|
+
}, null, 36)], 8, ut));
|
|
1198
1212
|
}
|
|
1199
|
-
}),
|
|
1213
|
+
}), ft = { class: "reel-viewport" }, pt = ["data-active-post-id", "data-active-media-index"], mt = ["role", "data-status"], ht = 2, gt = 300, _t = /* @__PURE__ */ d({
|
|
1200
1214
|
__name: "ReelFeed",
|
|
1201
1215
|
props: {
|
|
1202
1216
|
initialPostId: {},
|
|
@@ -1232,159 +1246,161 @@ var lt = ["aria-label"], ut = /* @__PURE__ */ u({
|
|
|
1232
1246
|
"retryEnd",
|
|
1233
1247
|
"retryForward"
|
|
1234
1248
|
],
|
|
1235
|
-
setup(t, { expose:
|
|
1236
|
-
let l = t, u =
|
|
1237
|
-
let e = Math.max(0,
|
|
1249
|
+
setup(t, { expose: n, emit: i }) {
|
|
1250
|
+
let l = t, u = i, d = C(null), f = C(null), p = l.initialPostId === null || l.initialPostId === void 0 ? -1 : l.items.findIndex((e) => e.postId === l.initialPostId), g = C(Math.max(0, p)), b = C(!1), S = C(!1), E = 0, O = null, k = null, A = null, M = r(() => ({ gridTemplateRows: `repeat(${l.items.length}, 100cqh)` })), F = r(() => {
|
|
1251
|
+
let e = Math.max(0, g.value - ht), t = Math.min(l.items.length - 1, g.value + ht);
|
|
1238
1252
|
return l.items.slice(e, t + 1).map((t, n) => ({
|
|
1239
|
-
fetchPriority: e + n ===
|
|
1253
|
+
fetchPriority: e + n === g.value ? "high" : "low",
|
|
1240
1254
|
index: e + n,
|
|
1241
1255
|
item: t
|
|
1242
1256
|
}));
|
|
1243
|
-
}),
|
|
1244
|
-
let e =
|
|
1257
|
+
}), I = r(() => l.items[g.value]?.postId), L = r(() => l.items[g.value]), R = r(() => {
|
|
1258
|
+
let e = I.value;
|
|
1245
1259
|
return e === void 0 ? 0 : l.mediaIndices.get(e) ?? 0;
|
|
1246
|
-
}),
|
|
1247
|
-
let e = F.value;
|
|
1248
|
-
return e === void 0 ? "loading" : l.previewStates.get(P(e, L.value)) ?? "loading";
|
|
1249
|
-
}), z = n(() => {
|
|
1260
|
+
}), z = r(() => {
|
|
1250
1261
|
let e = I.value;
|
|
1262
|
+
return e === void 0 ? "loading" : l.previewStates.get(P(e, R.value)) ?? "loading";
|
|
1263
|
+
}), B = r(() => {
|
|
1264
|
+
let e = L.value;
|
|
1251
1265
|
if (!e) return "";
|
|
1252
|
-
let t = N(e,
|
|
1266
|
+
let t = N(e, R.value);
|
|
1253
1267
|
return l.mediaSource === "original" ? t.src : t.preview.src;
|
|
1254
|
-
}),
|
|
1255
|
-
|
|
1256
|
-
|
|
1268
|
+
}), V = r(() => z.value === "ready" && Oe(B.value)), U = r(() => [
|
|
1269
|
+
I.value,
|
|
1270
|
+
R.value,
|
|
1257
1271
|
l.items.length,
|
|
1258
1272
|
l.loadMoreLocked,
|
|
1259
1273
|
l.reelAutoAdvance.enabled,
|
|
1260
1274
|
l.reelAutoAdvance.includePostItems,
|
|
1261
1275
|
l.reelAutoAdvance.intervalMs
|
|
1262
|
-
].join(":")),
|
|
1263
|
-
let e =
|
|
1276
|
+
].join(":")), W = r(() => {
|
|
1277
|
+
let e = L.value, t = !!(e && l.reelAutoAdvance.includePostItems && R.value < j(e).length - 1), n = l.reelAutoAdvance.intervalMs / 1e3;
|
|
1264
1278
|
return `Auto advance to the next ${t ? "post item" : "post"} in ${n}s`;
|
|
1265
|
-
}),
|
|
1266
|
-
function
|
|
1279
|
+
}), te = r(() => l.reelAutoAdvance.enabled && l.reelForward.status === "idle" && L.value !== void 0 && z.value !== "loading" && !V.value), ne = r(() => l.reelForward.status === "loading" ? "Loading the next media…" : l.reelForward.status === "error" ? "Unable to load the next media." : "You reached the end of this feed.");
|
|
1280
|
+
function re(e) {
|
|
1267
1281
|
return { gridRow: `${e + 1}` };
|
|
1268
1282
|
}
|
|
1269
|
-
function
|
|
1270
|
-
let t =
|
|
1283
|
+
function ie(e) {
|
|
1284
|
+
let t = E || e.clientHeight;
|
|
1271
1285
|
return t <= 0 || l.items.length === 0 ? 0 : Math.min(l.items.length - 1, Math.max(0, Math.round(e.scrollTop / t)));
|
|
1272
1286
|
}
|
|
1273
|
-
function
|
|
1287
|
+
function K(e) {
|
|
1274
1288
|
let t = e.currentTarget;
|
|
1275
|
-
|
|
1289
|
+
if (!t) return;
|
|
1290
|
+
let n = E || t.clientHeight, r = Math.max(0, l.items.length - 1) * n;
|
|
1291
|
+
b.value = l.items.length > 0 && t.scrollTop > r + 1, S.value || (g.value = ie(t)), !l.loadMoreLocked && l.infiniteScroll && G(t) && u("loadMore");
|
|
1276
1292
|
}
|
|
1277
|
-
function
|
|
1293
|
+
function q() {
|
|
1278
1294
|
let e = d.value;
|
|
1279
|
-
e && (Y(!0),
|
|
1280
|
-
e.scrollTop =
|
|
1281
|
-
}),
|
|
1295
|
+
e && (b.value = !1, Y(!0), E = e.clientHeight, e.scrollTop = g.value * E, k !== null && cancelAnimationFrame(k), k = requestAnimationFrame(() => {
|
|
1296
|
+
e.scrollTop = g.value * e.clientHeight, E = e.clientHeight, k = null;
|
|
1297
|
+
}), ae());
|
|
1282
1298
|
}
|
|
1283
|
-
function
|
|
1284
|
-
|
|
1285
|
-
|
|
1299
|
+
function ae() {
|
|
1300
|
+
A !== null && clearTimeout(A), A = setTimeout(() => {
|
|
1301
|
+
A = null;
|
|
1286
1302
|
let e = d.value;
|
|
1287
|
-
e && (
|
|
1303
|
+
e && (E = e.clientHeight, e.scrollTop = g.value * E), Y(!1);
|
|
1288
1304
|
}, 120);
|
|
1289
1305
|
}
|
|
1290
1306
|
function J() {
|
|
1291
1307
|
Y(!0);
|
|
1292
1308
|
let e = d.value;
|
|
1293
|
-
e && (
|
|
1309
|
+
e && (E = e.clientHeight, e.scrollTop = g.value * E), ae();
|
|
1294
1310
|
}
|
|
1295
1311
|
function Y(e) {
|
|
1296
|
-
|
|
1312
|
+
S.value = e, d.value?.toggleAttribute("data-resizing", e);
|
|
1297
1313
|
}
|
|
1298
|
-
function
|
|
1314
|
+
function oe() {
|
|
1299
1315
|
let e = d.value;
|
|
1300
1316
|
!l.loadMoreLocked && e && G(e) && u("loadMore");
|
|
1301
1317
|
}
|
|
1302
|
-
function
|
|
1303
|
-
let t =
|
|
1318
|
+
function se(e) {
|
|
1319
|
+
let t = L.value;
|
|
1304
1320
|
if (!t) return !1;
|
|
1305
1321
|
let n = j(t).length;
|
|
1306
1322
|
if (n <= 1) return !1;
|
|
1307
|
-
let r = (
|
|
1323
|
+
let r = (R.value + e + n) % n;
|
|
1308
1324
|
return u("mediaChange", t.postId, r), !0;
|
|
1309
1325
|
}
|
|
1310
|
-
function
|
|
1311
|
-
let t =
|
|
1312
|
-
return !d.value || t < 0 || t >= l.items.length ? !1 : (
|
|
1326
|
+
function X(e) {
|
|
1327
|
+
let t = g.value + e;
|
|
1328
|
+
return !d.value || t < 0 || t >= l.items.length ? !1 : (Z(t), !0);
|
|
1313
1329
|
}
|
|
1314
|
-
function
|
|
1330
|
+
function ce() {
|
|
1315
1331
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
1316
1332
|
}
|
|
1317
|
-
function
|
|
1333
|
+
function le(e) {
|
|
1318
1334
|
let t = d.value;
|
|
1319
1335
|
if (!t) return Promise.resolve();
|
|
1320
|
-
let n = e * (
|
|
1321
|
-
return
|
|
1336
|
+
let n = e * (E || t.clientHeight);
|
|
1337
|
+
return g.value = e, lt(t, n, ce());
|
|
1322
1338
|
}
|
|
1323
|
-
function
|
|
1324
|
-
|
|
1339
|
+
function Z(e) {
|
|
1340
|
+
le(e);
|
|
1325
1341
|
}
|
|
1326
|
-
async function
|
|
1342
|
+
async function ue(e) {
|
|
1327
1343
|
let t = l.items.findIndex((t) => t.postId === e);
|
|
1328
|
-
return t < 0 || t ===
|
|
1344
|
+
return t < 0 || t === g.value ? !1 : (await le(t), !0);
|
|
1329
1345
|
}
|
|
1330
|
-
async function
|
|
1331
|
-
return
|
|
1346
|
+
async function de(e) {
|
|
1347
|
+
return se(e) ? (ce() || await new Promise((e) => setTimeout(e, gt)), !0) : !1;
|
|
1332
1348
|
}
|
|
1333
|
-
function
|
|
1349
|
+
function fe() {
|
|
1334
1350
|
if (!l.reelAutoAdvance.enabled) return;
|
|
1335
|
-
let e =
|
|
1351
|
+
let e = L.value;
|
|
1336
1352
|
if (!e) return;
|
|
1337
|
-
if (l.reelAutoAdvance.includePostItems &&
|
|
1338
|
-
u("mediaChange", e.postId,
|
|
1353
|
+
if (l.reelAutoAdvance.includePostItems && R.value < j(e).length - 1) {
|
|
1354
|
+
u("mediaChange", e.postId, R.value + 1);
|
|
1339
1355
|
return;
|
|
1340
1356
|
}
|
|
1341
|
-
let t =
|
|
1357
|
+
let t = g.value + 1, n = l.items[t];
|
|
1342
1358
|
if (!n) {
|
|
1343
1359
|
l.hasNext && !l.loadMoreLocked && u("loadMore");
|
|
1344
1360
|
return;
|
|
1345
1361
|
}
|
|
1346
|
-
l.reelAutoAdvance.includePostItems && (l.mediaIndices.get(n.postId) ?? 0) !== 0 && u("mediaChange", n.postId, 0),
|
|
1362
|
+
l.reelAutoAdvance.includePostItems && (l.mediaIndices.get(n.postId) ?? 0) !== 0 && u("mediaChange", n.postId, 0), Z(t);
|
|
1347
1363
|
}
|
|
1348
|
-
function
|
|
1349
|
-
!l.reelAutoAdvance.enabled || e !==
|
|
1364
|
+
function pe(e, t) {
|
|
1365
|
+
!l.reelAutoAdvance.enabled || e !== I.value || t !== R.value || !V.value || fe();
|
|
1350
1366
|
}
|
|
1351
1367
|
return D(d, (e) => {
|
|
1352
|
-
|
|
1353
|
-
}), D(
|
|
1354
|
-
let n = t == null ? -1 : l.items.findIndex(({ postId: e }) => e === t);
|
|
1355
|
-
|
|
1356
|
-
}), D(
|
|
1368
|
+
O?.disconnect(), O = null, e && (E = e.clientHeight, !(typeof ResizeObserver > "u") && (O = new ResizeObserver(q), O.observe(e)));
|
|
1369
|
+
}), D(() => l.items.length, async (e) => {
|
|
1370
|
+
let t = l.initialPostId, n = t == null ? -1 : l.items.findIndex(({ postId: e }) => e === t);
|
|
1371
|
+
g.value = n >= 0 ? n : Math.min(g.value, Math.max(0, e - 1)), await m(), q();
|
|
1372
|
+
}), D(I, (e) => {
|
|
1357
1373
|
e !== void 0 && u("activeChange", e);
|
|
1358
1374
|
}, { immediate: !0 }), v(() => {
|
|
1359
|
-
window.addEventListener("resize", J), window.addEventListener("orientationchange", J),
|
|
1360
|
-
}),
|
|
1361
|
-
window.removeEventListener("resize", J), window.removeEventListener("orientationchange", J),
|
|
1362
|
-
}),
|
|
1363
|
-
activeIndex:
|
|
1364
|
-
activePostId:
|
|
1365
|
-
changeActiveMedia:
|
|
1366
|
-
loadIfNearBottom:
|
|
1367
|
-
moveActivePost:
|
|
1368
|
-
transitionActiveMedia:
|
|
1369
|
-
transitionActivePost:
|
|
1370
|
-
}), (n, r) => (y(),
|
|
1371
|
-
class:
|
|
1375
|
+
window.addEventListener("resize", J), window.addEventListener("orientationchange", J), p >= 0 && m(q);
|
|
1376
|
+
}), ee(() => {
|
|
1377
|
+
window.removeEventListener("resize", J), window.removeEventListener("orientationchange", J), O?.disconnect(), k !== null && cancelAnimationFrame(k), A !== null && clearTimeout(A);
|
|
1378
|
+
}), n({
|
|
1379
|
+
activeIndex: g,
|
|
1380
|
+
activePostId: I,
|
|
1381
|
+
changeActiveMedia: se,
|
|
1382
|
+
loadIfNearBottom: oe,
|
|
1383
|
+
moveActivePost: X,
|
|
1384
|
+
transitionActiveMedia: de,
|
|
1385
|
+
transitionActivePost: ue
|
|
1386
|
+
}), (n, r) => (y(), s("main", {
|
|
1387
|
+
class: h(["reel-shell", {
|
|
1372
1388
|
"reel-shell--has-footer": !!t.cardFooter,
|
|
1373
1389
|
"reel-shell--has-header": !!t.cardHeader
|
|
1374
1390
|
}]),
|
|
1375
1391
|
"data-layout-mode": "reel"
|
|
1376
1392
|
}, [
|
|
1377
|
-
t.cardHeader &&
|
|
1393
|
+
t.cardHeader && L.value && t.reelForward.status === "idle" ? (y(), a(ke, {
|
|
1378
1394
|
key: 0,
|
|
1379
|
-
index:
|
|
1380
|
-
item:
|
|
1395
|
+
index: g.value,
|
|
1396
|
+
item: L.value,
|
|
1381
1397
|
layout: "reel",
|
|
1382
1398
|
"loaded-count": t.items.length,
|
|
1383
|
-
"media-index":
|
|
1399
|
+
"media-index": R.value,
|
|
1384
1400
|
"media-source": t.mediaSource,
|
|
1385
1401
|
placement: "header",
|
|
1386
1402
|
region: t.cardHeader,
|
|
1387
|
-
style:
|
|
1403
|
+
style: _(t.mediaCard?.header),
|
|
1388
1404
|
total: t.total
|
|
1389
1405
|
}, null, 8, [
|
|
1390
1406
|
"index",
|
|
@@ -1395,40 +1411,44 @@ var lt = ["aria-label"], ut = /* @__PURE__ */ u({
|
|
|
1395
1411
|
"region",
|
|
1396
1412
|
"style",
|
|
1397
1413
|
"total"
|
|
1398
|
-
])) :
|
|
1399
|
-
|
|
1414
|
+
])) : o("", !0),
|
|
1415
|
+
c("div", ft, [c("div", {
|
|
1400
1416
|
ref_key: "galleryElement",
|
|
1401
1417
|
ref: d,
|
|
1402
1418
|
class: "gallery-shell reel-feed",
|
|
1403
|
-
"data-active-post-id":
|
|
1404
|
-
"data-active-media-index":
|
|
1405
|
-
onScrollPassive:
|
|
1406
|
-
}, [t.reelForward.status === "idle" ? (y(),
|
|
1419
|
+
"data-active-post-id": I.value,
|
|
1420
|
+
"data-active-media-index": R.value,
|
|
1421
|
+
onScrollPassive: K
|
|
1422
|
+
}, [t.reelForward.status === "idle" ? (y(), s("section", {
|
|
1407
1423
|
key: 1,
|
|
1408
1424
|
class: "reel-track",
|
|
1409
|
-
style:
|
|
1425
|
+
style: _(M.value),
|
|
1410
1426
|
"aria-label": "Media gallery"
|
|
1411
|
-
}, [(y(!0),
|
|
1427
|
+
}, [(y(!0), s(e, null, x(F.value, ({ fetchPriority: e, item: n, index: r }) => (y(), a($e, {
|
|
1412
1428
|
key: n.postId,
|
|
1413
|
-
|
|
1429
|
+
active: r === g.value && !b.value,
|
|
1430
|
+
"advance-on-media-end": l.reelAutoAdvance.enabled && r === g.value,
|
|
1414
1431
|
class: "reel-item",
|
|
1415
1432
|
entering: !1,
|
|
1416
1433
|
"fetch-priority": e,
|
|
1417
1434
|
index: r,
|
|
1418
1435
|
item: n,
|
|
1419
|
-
"item-style":
|
|
1436
|
+
"item-style": re(r),
|
|
1420
1437
|
"media-card": t.mediaCard,
|
|
1421
1438
|
layout: "reel",
|
|
1422
1439
|
"loaded-count": t.items.length,
|
|
1423
1440
|
"media-index": t.mediaIndices.get(n.postId) ?? 0,
|
|
1424
1441
|
"media-source": t.mediaSource,
|
|
1425
1442
|
"preview-state": t.previewStates.get(T(P)(n.postId, t.mediaIndices.get(n.postId) ?? 0)) ?? "loading",
|
|
1443
|
+
"reel-controls-target": f.value,
|
|
1444
|
+
"stationary-reel-controls": "",
|
|
1426
1445
|
total: t.total,
|
|
1427
1446
|
onMediaChange: (e) => u("mediaChange", n.postId, e),
|
|
1428
|
-
onEnded: (e) =>
|
|
1447
|
+
onEnded: (e) => pe(n.postId, e),
|
|
1429
1448
|
onReady: (e) => u("ready", n.postId, e),
|
|
1430
1449
|
onError: (e) => u("error", n.postId, e)
|
|
1431
1450
|
}, null, 8, [
|
|
1451
|
+
"active",
|
|
1432
1452
|
"advance-on-media-end",
|
|
1433
1453
|
"fetch-priority",
|
|
1434
1454
|
"index",
|
|
@@ -1439,22 +1459,23 @@ var lt = ["aria-label"], ut = /* @__PURE__ */ u({
|
|
|
1439
1459
|
"media-index",
|
|
1440
1460
|
"media-source",
|
|
1441
1461
|
"preview-state",
|
|
1462
|
+
"reel-controls-target",
|
|
1442
1463
|
"total",
|
|
1443
1464
|
"onMediaChange",
|
|
1444
1465
|
"onEnded",
|
|
1445
1466
|
"onReady",
|
|
1446
1467
|
"onError"
|
|
1447
|
-
]))), 128))], 4)) : (y(),
|
|
1468
|
+
]))), 128))], 4)) : (y(), s("div", {
|
|
1448
1469
|
key: 0,
|
|
1449
1470
|
class: "reel-forward-status",
|
|
1450
1471
|
role: t.reelForward.status === "error" ? "alert" : "status",
|
|
1451
1472
|
"data-status": t.reelForward.status
|
|
1452
|
-
}, [
|
|
1473
|
+
}, [c("p", null, w(ne.value), 1), t.reelForward.status === "error" || t.reelForward.status === "end" ? (y(), s("button", {
|
|
1453
1474
|
key: 0,
|
|
1454
1475
|
class: "reel-forward-retry",
|
|
1455
1476
|
type: "button",
|
|
1456
1477
|
onClick: r[0] ||= (e) => u("retryForward")
|
|
1457
|
-
}, " Retry ")) :
|
|
1478
|
+
}, " Retry ")) : o("", !0)], 8, mt)), t.reelForward.status === "idle" ? (y(), a(H, {
|
|
1458
1479
|
key: 2,
|
|
1459
1480
|
actions: t.feedFooterActions,
|
|
1460
1481
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -1475,18 +1496,23 @@ var lt = ["aria-label"], ut = /* @__PURE__ */ u({
|
|
|
1475
1496
|
"is-loading",
|
|
1476
1497
|
"load-more-locked",
|
|
1477
1498
|
"state"
|
|
1478
|
-
])) :
|
|
1479
|
-
|
|
1499
|
+
])) : o("", !0)], 40, pt), c("div", {
|
|
1500
|
+
ref_key: "reelControlsElement",
|
|
1501
|
+
ref: f,
|
|
1502
|
+
class: "reel-media-controls-host",
|
|
1503
|
+
"data-test": "reel-media-controls-host"
|
|
1504
|
+
}, null, 512)]),
|
|
1505
|
+
t.cardFooter && L.value && t.reelForward.status === "idle" ? (y(), a(ke, {
|
|
1480
1506
|
key: 1,
|
|
1481
|
-
index:
|
|
1482
|
-
item:
|
|
1507
|
+
index: g.value,
|
|
1508
|
+
item: L.value,
|
|
1483
1509
|
layout: "reel",
|
|
1484
1510
|
"loaded-count": t.items.length,
|
|
1485
|
-
"media-index":
|
|
1511
|
+
"media-index": R.value,
|
|
1486
1512
|
"media-source": t.mediaSource,
|
|
1487
1513
|
placement: "footer",
|
|
1488
1514
|
region: t.cardFooter,
|
|
1489
|
-
style:
|
|
1515
|
+
style: _(t.mediaCard?.footer),
|
|
1490
1516
|
total: t.total
|
|
1491
1517
|
}, null, 8, [
|
|
1492
1518
|
"index",
|
|
@@ -1497,25 +1523,25 @@ var lt = ["aria-label"], ut = /* @__PURE__ */ u({
|
|
|
1497
1523
|
"region",
|
|
1498
1524
|
"style",
|
|
1499
1525
|
"total"
|
|
1500
|
-
])) :
|
|
1501
|
-
|
|
1502
|
-
key:
|
|
1526
|
+
])) : o("", !0),
|
|
1527
|
+
te.value ? (y(), a(dt, {
|
|
1528
|
+
key: U.value,
|
|
1503
1529
|
"duration-ms": t.reelAutoAdvance.intervalMs,
|
|
1504
|
-
label:
|
|
1505
|
-
onComplete:
|
|
1506
|
-
}, null, 8, ["duration-ms", "label"])) :
|
|
1530
|
+
label: W.value,
|
|
1531
|
+
onComplete: fe
|
|
1532
|
+
}, null, 8, ["duration-ms", "label"])) : o("", !0)
|
|
1507
1533
|
], 2));
|
|
1508
1534
|
}
|
|
1509
|
-
}),
|
|
1535
|
+
}), vt = ["data-info-sheet-open", "data-info-sheet-mode"], yt = ["aria-hidden", "inert"], bt = {
|
|
1510
1536
|
key: 0,
|
|
1511
1537
|
class: "reel-info-sheet-layer",
|
|
1512
1538
|
"data-test": "reel-info-sheet"
|
|
1513
|
-
},
|
|
1539
|
+
}, xt = [
|
|
1514
1540
|
"role",
|
|
1515
1541
|
"aria-modal",
|
|
1516
1542
|
"tabindex",
|
|
1517
1543
|
"data-active-post-id"
|
|
1518
|
-
],
|
|
1544
|
+
], St = /* @__PURE__ */ d({
|
|
1519
1545
|
__name: "ReelLayout",
|
|
1520
1546
|
props: {
|
|
1521
1547
|
forwardIndex: { default: null },
|
|
@@ -1558,87 +1584,87 @@ var lt = ["aria-label"], ut = /* @__PURE__ */ u({
|
|
|
1558
1584
|
"retryEnd",
|
|
1559
1585
|
"retryForward"
|
|
1560
1586
|
],
|
|
1561
|
-
setup(e, { expose:
|
|
1562
|
-
let
|
|
1563
|
-
let e =
|
|
1587
|
+
setup(e, { expose: t, emit: i }) {
|
|
1588
|
+
let l = e, d = i, p = C(null), _ = C(null), v = null, b = r(() => {
|
|
1589
|
+
let e = l.initialPostId === null || l.initialPostId === void 0 ? -1 : l.items.findIndex((e) => e.postId === l.initialPostId);
|
|
1564
1590
|
return Math.max(0, e);
|
|
1565
|
-
}),
|
|
1566
|
-
let e =
|
|
1567
|
-
return e === void 0 ? 0 :
|
|
1568
|
-
}),
|
|
1569
|
-
let e =
|
|
1591
|
+
}), x = r(() => l.items[b.value]), w = r(() => x.value ?? (l.reelForward.status === "idle" ? void 0 : l.forwardItem ?? void 0)), T = r(() => x.value ? b.value : l.forwardIndex ?? 0), E = r(() => {
|
|
1592
|
+
let e = w.value?.postId;
|
|
1593
|
+
return e === void 0 ? 0 : l.mediaIndices.get(e) ?? 0;
|
|
1594
|
+
}), k = r(() => !!(l.infoSheet && l.infoSheetEnabled && w.value)), A = r(() => {
|
|
1595
|
+
let e = w.value;
|
|
1570
1596
|
return e ? {
|
|
1571
|
-
close:
|
|
1572
|
-
index:
|
|
1597
|
+
close: M,
|
|
1598
|
+
index: T.value,
|
|
1573
1599
|
item: e,
|
|
1574
1600
|
layout: "reel",
|
|
1575
|
-
loadedCount:
|
|
1601
|
+
loadedCount: l.items.length,
|
|
1576
1602
|
mediaCount: j(e).length,
|
|
1577
|
-
mediaIndex:
|
|
1578
|
-
mediaItem: N(e,
|
|
1579
|
-
mediaSource:
|
|
1580
|
-
origin:
|
|
1581
|
-
total:
|
|
1603
|
+
mediaIndex: E.value,
|
|
1604
|
+
mediaItem: N(e, E.value),
|
|
1605
|
+
mediaSource: l.mediaSource ?? "preview",
|
|
1606
|
+
origin: l.origin,
|
|
1607
|
+
total: l.total
|
|
1582
1608
|
} : null;
|
|
1583
1609
|
});
|
|
1584
|
-
function
|
|
1585
|
-
|
|
1610
|
+
function M() {
|
|
1611
|
+
d("closeInfoSheet");
|
|
1586
1612
|
}
|
|
1587
|
-
function
|
|
1588
|
-
return
|
|
1613
|
+
function P(e) {
|
|
1614
|
+
return p.value?.changeActiveMedia(e) ?? !1;
|
|
1589
1615
|
}
|
|
1590
|
-
function
|
|
1591
|
-
|
|
1616
|
+
function F() {
|
|
1617
|
+
p.value?.loadIfNearBottom();
|
|
1618
|
+
}
|
|
1619
|
+
function I(e) {
|
|
1620
|
+
return p.value?.moveActivePost(e) ?? !1;
|
|
1592
1621
|
}
|
|
1593
1622
|
function L(e) {
|
|
1594
|
-
return
|
|
1623
|
+
return p.value?.transitionActiveMedia(e) ?? Promise.resolve(!1);
|
|
1595
1624
|
}
|
|
1596
1625
|
function R(e) {
|
|
1597
|
-
return
|
|
1626
|
+
return p.value?.transitionActivePost(e) ?? Promise.resolve(!1);
|
|
1598
1627
|
}
|
|
1599
|
-
function z(e) {
|
|
1600
|
-
|
|
1628
|
+
function z(e, t) {
|
|
1629
|
+
d("error", e, t);
|
|
1601
1630
|
}
|
|
1602
1631
|
function B(e, t) {
|
|
1603
|
-
|
|
1632
|
+
d("mediaChange", e, t);
|
|
1604
1633
|
}
|
|
1605
1634
|
function V(e, t) {
|
|
1606
|
-
|
|
1607
|
-
}
|
|
1608
|
-
function H(e, t) {
|
|
1609
|
-
f("ready", e, t);
|
|
1635
|
+
d("ready", e, t);
|
|
1610
1636
|
}
|
|
1611
1637
|
return D(() => ({
|
|
1612
|
-
overlay:
|
|
1613
|
-
visible:
|
|
1638
|
+
overlay: l.infoSheetOverlay,
|
|
1639
|
+
visible: k.value
|
|
1614
1640
|
}), async (e, t) => {
|
|
1615
1641
|
if (e.visible && !t?.visible) {
|
|
1616
|
-
|
|
1642
|
+
v = document.activeElement instanceof HTMLElement ? document.activeElement : null, e.overlay && (await m(), _.value?.focus({ preventScroll: !0 }));
|
|
1617
1643
|
return;
|
|
1618
1644
|
}
|
|
1619
|
-
if (!e.visible && t?.visible &&
|
|
1620
|
-
let e =
|
|
1621
|
-
|
|
1645
|
+
if (!e.visible && t?.visible && v?.isConnected) {
|
|
1646
|
+
let e = v;
|
|
1647
|
+
v = null, await m(), e.focus({ preventScroll: !0 });
|
|
1622
1648
|
}
|
|
1623
|
-
}),
|
|
1624
|
-
|
|
1625
|
-
}),
|
|
1626
|
-
changeActiveMedia:
|
|
1627
|
-
loadIfNearBottom:
|
|
1628
|
-
moveActivePost:
|
|
1629
|
-
transitionActiveMedia:
|
|
1630
|
-
transitionActivePost:
|
|
1631
|
-
}), (
|
|
1632
|
-
class:
|
|
1633
|
-
"data-info-sheet-open":
|
|
1649
|
+
}), ee(() => {
|
|
1650
|
+
v = null;
|
|
1651
|
+
}), t({
|
|
1652
|
+
changeActiveMedia: P,
|
|
1653
|
+
loadIfNearBottom: F,
|
|
1654
|
+
moveActivePost: I,
|
|
1655
|
+
transitionActiveMedia: L,
|
|
1656
|
+
transitionActivePost: R
|
|
1657
|
+
}), (t, r) => (y(), s("section", {
|
|
1658
|
+
class: h(["reel-layout", `reel-layout--${e.infoSheetOverlay ? "overlay" : "layout"}`]),
|
|
1659
|
+
"data-info-sheet-open": k.value || void 0,
|
|
1634
1660
|
"data-info-sheet-mode": e.infoSheetOverlay ? "overlay" : "layout"
|
|
1635
|
-
}, [
|
|
1661
|
+
}, [c("div", {
|
|
1636
1662
|
class: "reel-layout-main",
|
|
1637
|
-
"aria-hidden": e.infoSheetOverlay &&
|
|
1638
|
-
inert: e.infoSheetOverlay &&
|
|
1639
|
-
}, [
|
|
1663
|
+
"aria-hidden": e.infoSheetOverlay && k.value || void 0,
|
|
1664
|
+
inert: e.infoSheetOverlay && k.value || void 0
|
|
1665
|
+
}, [u(_t, {
|
|
1640
1666
|
ref_key: "reelFeed",
|
|
1641
|
-
ref:
|
|
1667
|
+
ref: p,
|
|
1642
1668
|
"can-retry-end": e.canRetryEnd,
|
|
1643
1669
|
"card-footer": e.cardFooter,
|
|
1644
1670
|
"card-header": e.cardHeader,
|
|
@@ -1659,13 +1685,13 @@ var lt = ["aria-label"], ut = /* @__PURE__ */ u({
|
|
|
1659
1685
|
"reel-forward": e.reelForward,
|
|
1660
1686
|
state: e.state,
|
|
1661
1687
|
total: e.total,
|
|
1662
|
-
onActiveChange: r[0] ||= (e) =>
|
|
1663
|
-
onError:
|
|
1664
|
-
onLoadMore: r[1] ||= (e) =>
|
|
1665
|
-
onMediaChange:
|
|
1666
|
-
onReady:
|
|
1667
|
-
onRetryEnd: r[2] ||= (e) =>
|
|
1668
|
-
onRetryForward: r[3] ||= (e) =>
|
|
1688
|
+
onActiveChange: r[0] ||= (e) => d("activeChange", e),
|
|
1689
|
+
onError: z,
|
|
1690
|
+
onLoadMore: r[1] ||= (e) => d("loadMore"),
|
|
1691
|
+
onMediaChange: B,
|
|
1692
|
+
onReady: V,
|
|
1693
|
+
onRetryEnd: r[2] ||= (e) => d("retryEnd"),
|
|
1694
|
+
onRetryForward: r[3] ||= (e) => d("retryForward")
|
|
1669
1695
|
}, null, 8, [
|
|
1670
1696
|
"can-retry-end",
|
|
1671
1697
|
"card-footer",
|
|
@@ -1687,21 +1713,21 @@ var lt = ["aria-label"], ut = /* @__PURE__ */ u({
|
|
|
1687
1713
|
"reel-forward",
|
|
1688
1714
|
"state",
|
|
1689
1715
|
"total"
|
|
1690
|
-
])], 8,
|
|
1691
|
-
default: O(() => [
|
|
1716
|
+
])], 8, yt), u(n, { name: "vibe-info-sheet" }, {
|
|
1717
|
+
default: O(() => [k.value && e.infoSheet && A.value ? (y(), s("div", bt, [c("aside", {
|
|
1692
1718
|
ref_key: "sheetElement",
|
|
1693
|
-
ref:
|
|
1719
|
+
ref: _,
|
|
1694
1720
|
class: "reel-info-sheet",
|
|
1695
1721
|
role: e.infoSheetOverlay ? "dialog" : "complementary",
|
|
1696
1722
|
"aria-label": "Reel information",
|
|
1697
1723
|
"aria-modal": e.infoSheetOverlay ? "true" : void 0,
|
|
1698
1724
|
tabindex: e.infoSheetOverlay ? -1 : void 0,
|
|
1699
|
-
"data-active-post-id":
|
|
1700
|
-
}, [(y(),
|
|
1725
|
+
"data-active-post-id": w.value?.postId
|
|
1726
|
+
}, [(y(), a(S(e.infoSheet.component), g(f(A.value)), null, 16))], 8, xt)])) : o("", !0)]),
|
|
1701
1727
|
_: 1
|
|
1702
|
-
})], 10,
|
|
1728
|
+
})], 10, vt));
|
|
1703
1729
|
}
|
|
1704
|
-
}),
|
|
1730
|
+
}), Ct = 35, wt = 420, Tt = /* @__PURE__ */ d({
|
|
1705
1731
|
__name: "VibeSurface",
|
|
1706
1732
|
props: {
|
|
1707
1733
|
canRetryEnd: { type: Boolean },
|
|
@@ -1722,94 +1748,94 @@ var lt = ["aria-label"], ut = /* @__PURE__ */ u({
|
|
|
1722
1748
|
"retryEnd",
|
|
1723
1749
|
"retryForward"
|
|
1724
1750
|
],
|
|
1725
|
-
setup(
|
|
1726
|
-
let
|
|
1727
|
-
function
|
|
1751
|
+
setup(t, { expose: i, emit: c }) {
|
|
1752
|
+
let l = t, d = c, f = C(null), p = C(null), h = C(null), g = C(null), b = C({}), x = C(!1), S = C(/* @__PURE__ */ new Set()), w = C(/* @__PURE__ */ new Map()), T = C(/* @__PURE__ */ new Set()), E = C(/* @__PURE__ */ new Map()), k = C(/* @__PURE__ */ new Map()), A = C(/* @__PURE__ */ new Map()), j = r(() => F(l.state)), N = r(() => l.state.reelMediaSource === "original" ? A.value : k.value), I = new Set(l.state.items.map((e) => e.postId)), L = null, R = null, z = !1;
|
|
1753
|
+
function B() {
|
|
1728
1754
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
1729
1755
|
}
|
|
1730
|
-
function
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1756
|
+
function V() {
|
|
1757
|
+
L !== null && cancelAnimationFrame(L), L = requestAnimationFrame(() => {
|
|
1758
|
+
L = requestAnimationFrame(() => {
|
|
1759
|
+
L = null, S.value = /* @__PURE__ */ new Set();
|
|
1734
1760
|
});
|
|
1735
1761
|
});
|
|
1736
1762
|
}
|
|
1763
|
+
function H(e, t, n) {
|
|
1764
|
+
let r = P(e, t);
|
|
1765
|
+
k.value.get(r) !== n && (k.value = new Map(k.value).set(r, n));
|
|
1766
|
+
}
|
|
1737
1767
|
function U(e, t, n) {
|
|
1738
1768
|
let r = P(e, t);
|
|
1739
1769
|
A.value.get(r) !== n && (A.value = new Map(A.value).set(r, n));
|
|
1740
1770
|
}
|
|
1741
|
-
function W(e, t
|
|
1742
|
-
|
|
1743
|
-
j.value.get(r) !== n && (j.value = new Map(j.value).set(r, n));
|
|
1771
|
+
function W(e, t) {
|
|
1772
|
+
H(e, t, "error");
|
|
1744
1773
|
}
|
|
1745
1774
|
function G(e, t) {
|
|
1746
|
-
|
|
1747
|
-
}
|
|
1748
|
-
function te(e, t) {
|
|
1749
|
-
U(e, t, "ready");
|
|
1775
|
+
H(e, t, "ready");
|
|
1750
1776
|
}
|
|
1751
1777
|
function ne(e, t) {
|
|
1752
|
-
|
|
1778
|
+
U(e, t, "error");
|
|
1753
1779
|
}
|
|
1754
1780
|
function re(e, t) {
|
|
1755
|
-
|
|
1781
|
+
U(e, t, "ready");
|
|
1756
1782
|
}
|
|
1757
|
-
function
|
|
1758
|
-
if (
|
|
1783
|
+
function ie(e, t) {
|
|
1784
|
+
if (l.state.reelMediaSource === "original") {
|
|
1759
1785
|
ne(e, t);
|
|
1760
1786
|
return;
|
|
1761
1787
|
}
|
|
1762
|
-
|
|
1788
|
+
W(e, t);
|
|
1763
1789
|
}
|
|
1764
|
-
function
|
|
1765
|
-
if (
|
|
1790
|
+
function K(e, t) {
|
|
1791
|
+
if (l.state.reelMediaSource === "original") {
|
|
1766
1792
|
re(e, t);
|
|
1767
1793
|
return;
|
|
1768
1794
|
}
|
|
1769
|
-
|
|
1795
|
+
G(e, t);
|
|
1770
1796
|
}
|
|
1771
|
-
function
|
|
1772
|
-
let n =
|
|
1797
|
+
function q(e, t) {
|
|
1798
|
+
let n = l.state.items.find((t) => t.postId === e);
|
|
1773
1799
|
if (!n) return;
|
|
1774
1800
|
let r = M(n, t);
|
|
1775
|
-
(
|
|
1801
|
+
(l.state.mediaIndices.get(e) ?? 0) !== r && (l.state.mediaIndices = new Map(l.state.mediaIndices).set(e, r));
|
|
1776
1802
|
}
|
|
1777
|
-
async function
|
|
1778
|
-
await
|
|
1803
|
+
async function ae() {
|
|
1804
|
+
await m(), (l.state.layout === "reel" || l.state.reelOrigin === "masonry" ? p.value : f.value)?.loadIfNearBottom();
|
|
1779
1805
|
}
|
|
1780
|
-
function
|
|
1781
|
-
return
|
|
1806
|
+
function J(e) {
|
|
1807
|
+
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.changeActiveMedia?.(e) ?? !1;
|
|
1782
1808
|
}
|
|
1783
|
-
function
|
|
1784
|
-
return
|
|
1809
|
+
function Y(e) {
|
|
1810
|
+
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.moveActivePost?.(e) ?? !1;
|
|
1785
1811
|
}
|
|
1786
1812
|
function oe() {
|
|
1787
|
-
return
|
|
1813
|
+
return l.state.layout !== "masonry" || l.state.reelOrigin === "masonry" ? null : f.value?.getScrollElement?.() ?? null;
|
|
1788
1814
|
}
|
|
1789
|
-
function
|
|
1790
|
-
|
|
1815
|
+
function se(e, t) {
|
|
1816
|
+
R = e, z = t === "keyboard", b.value = Z(e), d("openReel", e), m(() => h.value?.focus());
|
|
1791
1817
|
}
|
|
1792
|
-
function
|
|
1793
|
-
let t =
|
|
1818
|
+
function X(e) {
|
|
1819
|
+
let t = g.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [];
|
|
1794
1820
|
return Array.from(t).find((t) => t.dataset.postId === String(e)) ?? null;
|
|
1795
1821
|
}
|
|
1796
|
-
function
|
|
1797
|
-
if (
|
|
1798
|
-
let t = [...new Set(e)], n = t.filter(
|
|
1822
|
+
function ce(e) {
|
|
1823
|
+
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || B()) return 0;
|
|
1824
|
+
let t = [...new Set(e)], n = t.filter(X);
|
|
1799
1825
|
if (n.length === 0) return 0;
|
|
1800
|
-
let r = new Map(
|
|
1826
|
+
let r = new Map(E.value);
|
|
1801
1827
|
return n.forEach((e, t) => {
|
|
1802
|
-
r.set(e, t *
|
|
1803
|
-
}),
|
|
1828
|
+
r.set(e, t * Ct);
|
|
1829
|
+
}), S.value = new Set([...S.value].filter((e) => !n.includes(e))), T.value = new Set([...T.value, ...t]), E.value = r, wt + (n.length - 1) * Ct;
|
|
1804
1830
|
}
|
|
1805
|
-
function
|
|
1806
|
-
let n =
|
|
1831
|
+
function le(e, t) {
|
|
1832
|
+
let n = X(e), r = n?.querySelector(".media-card-activator") ?? n;
|
|
1807
1833
|
r && (r.classList.toggle("media-card-focus-silent", !t), t || r.addEventListener("blur", () => {
|
|
1808
1834
|
r.classList.remove("media-card-focus-silent");
|
|
1809
1835
|
}, { once: !0 }), r?.focus({ preventScroll: !0 }));
|
|
1810
1836
|
}
|
|
1811
|
-
function
|
|
1812
|
-
let t =
|
|
1837
|
+
function Z(e) {
|
|
1838
|
+
let t = g.value, n = X(e);
|
|
1813
1839
|
if (t === null || n === null) return {};
|
|
1814
1840
|
let r = t.getBoundingClientRect(), i = n.getBoundingClientRect();
|
|
1815
1841
|
return {
|
|
@@ -1820,25 +1846,25 @@ var lt = ["aria-label"], ut = /* @__PURE__ */ u({
|
|
|
1820
1846
|
};
|
|
1821
1847
|
}
|
|
1822
1848
|
function ue() {
|
|
1823
|
-
|
|
1849
|
+
l.state.reelOrigin === "masonry" && (R ??= l.state.activeReelPostId, x.value = !0, d("closeReel"));
|
|
1824
1850
|
}
|
|
1825
1851
|
function de() {
|
|
1826
|
-
let e =
|
|
1827
|
-
|
|
1828
|
-
e !== null &&
|
|
1852
|
+
let e = R, t = z;
|
|
1853
|
+
x.value = !1, R = null, z = !1, b.value = {}, m(() => {
|
|
1854
|
+
e !== null && le(e, t);
|
|
1829
1855
|
});
|
|
1830
1856
|
}
|
|
1831
1857
|
function fe(e) {
|
|
1832
|
-
let t =
|
|
1833
|
-
if (e.key === "Escape" &&
|
|
1834
|
-
e.preventDefault(),
|
|
1858
|
+
let t = l.state.layout === "reel" || l.state.reelOrigin === "masonry";
|
|
1859
|
+
if (e.key === "Escape" && l.state.reelOrigin === "masonry") {
|
|
1860
|
+
e.preventDefault(), l.state.reelInfoSheetOverlay && l.state.reelInfoSheet.enabled && d("reelInfoSheetChange", !1), ue();
|
|
1835
1861
|
return;
|
|
1836
1862
|
}
|
|
1837
|
-
if (e.key === "Escape" && t &&
|
|
1863
|
+
if (e.key === "Escape" && t && l.state.reelInfoSheet.enabled) {
|
|
1838
1864
|
e.preventDefault(), d("reelInfoSheetChange", !1);
|
|
1839
1865
|
return;
|
|
1840
1866
|
}
|
|
1841
|
-
if (e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey || e.shiftKey ||
|
|
1867
|
+
if (e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey || e.shiftKey || x.value || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry") return;
|
|
1842
1868
|
let n = e.target;
|
|
1843
1869
|
if (n instanceof HTMLElement && (n.isContentEditable || [
|
|
1844
1870
|
"INPUT",
|
|
@@ -1846,70 +1872,70 @@ var lt = ["aria-label"], ut = /* @__PURE__ */ u({
|
|
|
1846
1872
|
"TEXTAREA"
|
|
1847
1873
|
].includes(n.tagName))) return;
|
|
1848
1874
|
let r = e.key === "ArrowLeft" ? -1 : e.key === "ArrowRight" ? 1 : 0;
|
|
1849
|
-
r !== 0 &&
|
|
1875
|
+
r !== 0 && p.value?.changeActiveMedia?.(r) && e.preventDefault();
|
|
1850
1876
|
}
|
|
1851
|
-
return D(() =>
|
|
1852
|
-
let t = e.filter((e) => !
|
|
1853
|
-
if (
|
|
1877
|
+
return D(() => l.state.items.map((e) => e.postId), (e) => {
|
|
1878
|
+
let t = e.filter((e) => !I.has(e)), n = new Set(e);
|
|
1879
|
+
if (I = new Set(e), T.value = new Set([...T.value].filter((e) => n.has(e))), E.value = new Map([...E.value].filter(([e]) => n.has(e))), t.length === 0 || B()) return;
|
|
1854
1880
|
let r = /* @__PURE__ */ new Map();
|
|
1855
1881
|
e.forEach((e) => {
|
|
1856
|
-
let t =
|
|
1882
|
+
let t = w.value.get(e);
|
|
1857
1883
|
t !== void 0 && r.set(e, t);
|
|
1858
1884
|
}), t.forEach((e, t) => {
|
|
1859
|
-
r.set(e, t *
|
|
1860
|
-
}),
|
|
1861
|
-
}, { flush: "sync" }), v(() => window.addEventListener("keydown", fe)),
|
|
1862
|
-
window.removeEventListener("keydown", fe),
|
|
1863
|
-
}),
|
|
1864
|
-
changeActiveReelMedia:
|
|
1885
|
+
r.set(e, t * Ct);
|
|
1886
|
+
}), w.value = r, S.value = new Set([...S.value, ...t]), V();
|
|
1887
|
+
}, { flush: "sync" }), v(() => window.addEventListener("keydown", fe)), ee(() => {
|
|
1888
|
+
window.removeEventListener("keydown", fe), L !== null && cancelAnimationFrame(L);
|
|
1889
|
+
}), i({
|
|
1890
|
+
changeActiveReelMedia: J,
|
|
1865
1891
|
getAutoScrollElement: oe,
|
|
1866
|
-
loadIfNearBottom:
|
|
1867
|
-
moveActiveReelPost:
|
|
1868
|
-
startItemRemoval:
|
|
1869
|
-
transitionActiveReelMedia: (e) =>
|
|
1870
|
-
transitionActiveReelPost: (e) =>
|
|
1871
|
-
}), (
|
|
1892
|
+
loadIfNearBottom: ae,
|
|
1893
|
+
moveActiveReelPost: Y,
|
|
1894
|
+
startItemRemoval: ce,
|
|
1895
|
+
transitionActiveReelMedia: (e) => p.value?.transitionActiveMedia?.(e) ?? Promise.resolve(!1),
|
|
1896
|
+
transitionActiveReelPost: (e) => p.value?.transitionActivePost?.(e) ?? Promise.resolve(!1)
|
|
1897
|
+
}), (r, i) => (y(), s("div", {
|
|
1872
1898
|
ref_key: "surfaceElement",
|
|
1873
|
-
ref:
|
|
1899
|
+
ref: g,
|
|
1874
1900
|
class: "vibe-surface"
|
|
1875
|
-
}, [
|
|
1901
|
+
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (y(), a(St, {
|
|
1876
1902
|
key: 0,
|
|
1877
1903
|
ref_key: "reelRenderer",
|
|
1878
|
-
ref:
|
|
1879
|
-
"can-retry-end":
|
|
1880
|
-
"has-next":
|
|
1881
|
-
"card-footer":
|
|
1882
|
-
"card-header":
|
|
1883
|
-
"feed-footer":
|
|
1884
|
-
"feed-footer-actions":
|
|
1885
|
-
"forward-index":
|
|
1886
|
-
"forward-item":
|
|
1887
|
-
"media-card":
|
|
1888
|
-
"infinite-scroll":
|
|
1889
|
-
"is-loading-more":
|
|
1890
|
-
items:
|
|
1891
|
-
"load-more-locked":
|
|
1892
|
-
"media-source":
|
|
1893
|
-
"media-indices":
|
|
1894
|
-
"initial-post-id":
|
|
1895
|
-
"info-sheet":
|
|
1896
|
-
"info-sheet-enabled":
|
|
1897
|
-
"info-sheet-overlay":
|
|
1898
|
-
"next-page-error": !!
|
|
1904
|
+
ref: p,
|
|
1905
|
+
"can-retry-end": t.canRetryEnd,
|
|
1906
|
+
"has-next": t.state.next !== null,
|
|
1907
|
+
"card-footer": t.cardFooter,
|
|
1908
|
+
"card-header": t.cardHeader,
|
|
1909
|
+
"feed-footer": t.feedFooter,
|
|
1910
|
+
"feed-footer-actions": t.feedFooterActions,
|
|
1911
|
+
"forward-index": t.state.reelForwardIndex,
|
|
1912
|
+
"forward-item": t.state.reelForwardItem,
|
|
1913
|
+
"media-card": t.mediaCard,
|
|
1914
|
+
"infinite-scroll": t.state.infiniteScroll,
|
|
1915
|
+
"is-loading-more": t.state.isLoadingMore,
|
|
1916
|
+
items: t.state.items,
|
|
1917
|
+
"load-more-locked": t.state.loadMoreLocked,
|
|
1918
|
+
"media-source": t.state.reelMediaSource,
|
|
1919
|
+
"media-indices": t.state.mediaIndices,
|
|
1920
|
+
"initial-post-id": t.state.activeReelPostId,
|
|
1921
|
+
"info-sheet": t.reelInfoSheet,
|
|
1922
|
+
"info-sheet-enabled": t.state.reelInfoSheet.enabled,
|
|
1923
|
+
"info-sheet-overlay": t.state.reelInfoSheetOverlay,
|
|
1924
|
+
"next-page-error": !!t.state.nextPageError,
|
|
1899
1925
|
origin: "reel",
|
|
1900
|
-
"preview-states":
|
|
1901
|
-
"reel-auto-advance":
|
|
1902
|
-
"reel-forward":
|
|
1903
|
-
state:
|
|
1904
|
-
total:
|
|
1905
|
-
onActiveChange:
|
|
1906
|
-
onCloseInfoSheet:
|
|
1907
|
-
onError:
|
|
1908
|
-
onLoadMore:
|
|
1909
|
-
onMediaChange:
|
|
1910
|
-
onReady:
|
|
1911
|
-
onRetryEnd:
|
|
1912
|
-
onRetryForward:
|
|
1926
|
+
"preview-states": N.value,
|
|
1927
|
+
"reel-auto-advance": t.state.reelAutoAdvance,
|
|
1928
|
+
"reel-forward": t.state.reelForward,
|
|
1929
|
+
state: j.value,
|
|
1930
|
+
total: t.state.total,
|
|
1931
|
+
onActiveChange: i[0] ||= (e) => d("activeReelChange", e),
|
|
1932
|
+
onCloseInfoSheet: i[1] ||= (e) => d("reelInfoSheetChange", !1),
|
|
1933
|
+
onError: ie,
|
|
1934
|
+
onLoadMore: i[2] ||= (e) => d("loadMore"),
|
|
1935
|
+
onMediaChange: q,
|
|
1936
|
+
onReady: K,
|
|
1937
|
+
onRetryEnd: i[3] ||= (e) => d("retryEnd"),
|
|
1938
|
+
onRetryForward: i[4] ||= (e) => d("retryForward")
|
|
1913
1939
|
}, null, 8, [
|
|
1914
1940
|
"can-retry-end",
|
|
1915
1941
|
"has-next",
|
|
@@ -1936,49 +1962,49 @@ var lt = ["aria-label"], ut = /* @__PURE__ */ u({
|
|
|
1936
1962
|
"reel-forward",
|
|
1937
1963
|
"state",
|
|
1938
1964
|
"total"
|
|
1939
|
-
])) :
|
|
1965
|
+
])) : t.state.error || t.state.isLoading || t.state.items.length === 0 && t.state.reelForward.status === "idle" ? (y(), a(te, {
|
|
1940
1966
|
key: 1,
|
|
1941
|
-
actions:
|
|
1942
|
-
"can-retry-end":
|
|
1943
|
-
"feed-footer":
|
|
1944
|
-
state:
|
|
1945
|
-
onLoadMore:
|
|
1946
|
-
onRetryEnd:
|
|
1967
|
+
actions: t.feedFooterActions,
|
|
1968
|
+
"can-retry-end": t.canRetryEnd,
|
|
1969
|
+
"feed-footer": t.feedFooter,
|
|
1970
|
+
state: j.value,
|
|
1971
|
+
onLoadMore: i[5] ||= (e) => d("loadMore"),
|
|
1972
|
+
onRetryEnd: i[6] ||= (e) => d("retryEnd")
|
|
1947
1973
|
}, null, 8, [
|
|
1948
1974
|
"actions",
|
|
1949
1975
|
"can-retry-end",
|
|
1950
1976
|
"feed-footer",
|
|
1951
1977
|
"state"
|
|
1952
|
-
])) : (y(),
|
|
1978
|
+
])) : (y(), s(e, { key: 2 }, [u(st, {
|
|
1953
1979
|
ref_key: "masonryRenderer",
|
|
1954
1980
|
ref: f,
|
|
1955
|
-
"can-retry-end":
|
|
1956
|
-
"entering-post-ids":
|
|
1957
|
-
"entry-delays":
|
|
1958
|
-
"leaving-post-ids":
|
|
1959
|
-
"removal-delays":
|
|
1960
|
-
"card-footer":
|
|
1961
|
-
"card-header":
|
|
1962
|
-
"feed-footer":
|
|
1963
|
-
"feed-footer-actions":
|
|
1964
|
-
"media-card":
|
|
1965
|
-
"has-next":
|
|
1966
|
-
"infinite-scroll":
|
|
1967
|
-
"is-loading-more":
|
|
1968
|
-
items:
|
|
1969
|
-
"load-more-locked":
|
|
1970
|
-
"media-indices":
|
|
1971
|
-
"next-page-error": !!
|
|
1972
|
-
"preview-states":
|
|
1973
|
-
suspended:
|
|
1974
|
-
state:
|
|
1975
|
-
total:
|
|
1976
|
-
onActivate:
|
|
1977
|
-
onError:
|
|
1978
|
-
onLoadMore:
|
|
1979
|
-
onMediaChange:
|
|
1980
|
-
onReady:
|
|
1981
|
-
onRetryEnd:
|
|
1981
|
+
"can-retry-end": t.canRetryEnd,
|
|
1982
|
+
"entering-post-ids": S.value,
|
|
1983
|
+
"entry-delays": w.value,
|
|
1984
|
+
"leaving-post-ids": T.value,
|
|
1985
|
+
"removal-delays": E.value,
|
|
1986
|
+
"card-footer": t.cardFooter,
|
|
1987
|
+
"card-header": t.cardHeader,
|
|
1988
|
+
"feed-footer": t.feedFooter,
|
|
1989
|
+
"feed-footer-actions": t.feedFooterActions,
|
|
1990
|
+
"media-card": t.mediaCard,
|
|
1991
|
+
"has-next": t.state.next !== null,
|
|
1992
|
+
"infinite-scroll": t.state.infiniteScroll,
|
|
1993
|
+
"is-loading-more": t.state.isLoadingMore,
|
|
1994
|
+
items: t.state.items,
|
|
1995
|
+
"load-more-locked": t.state.loadMoreLocked,
|
|
1996
|
+
"media-indices": t.state.mediaIndices,
|
|
1997
|
+
"next-page-error": !!t.state.nextPageError,
|
|
1998
|
+
"preview-states": k.value,
|
|
1999
|
+
suspended: t.state.reelOrigin === "masonry" || x.value,
|
|
2000
|
+
state: j.value,
|
|
2001
|
+
total: t.state.total,
|
|
2002
|
+
onActivate: se,
|
|
2003
|
+
onError: W,
|
|
2004
|
+
onLoadMore: i[7] ||= (e) => d("loadMore"),
|
|
2005
|
+
onMediaChange: q,
|
|
2006
|
+
onReady: G,
|
|
2007
|
+
onRetryEnd: i[8] ||= (e) => d("retryEnd")
|
|
1982
2008
|
}, null, 8, [
|
|
1983
2009
|
"can-retry-end",
|
|
1984
2010
|
"entering-post-ids",
|
|
@@ -2001,11 +2027,11 @@ var lt = ["aria-label"], ut = /* @__PURE__ */ u({
|
|
|
2001
2027
|
"suspended",
|
|
2002
2028
|
"state",
|
|
2003
2029
|
"total"
|
|
2004
|
-
]),
|
|
2030
|
+
]), u(n, {
|
|
2005
2031
|
name: "vibe-reel-viewer",
|
|
2006
2032
|
onAfterLeave: de
|
|
2007
2033
|
}, {
|
|
2008
|
-
default: O(() => [
|
|
2034
|
+
default: O(() => [t.state.reelOrigin === "masonry" ? (y(), s("section", {
|
|
2009
2035
|
key: 0,
|
|
2010
2036
|
ref_key: "reelOverlay",
|
|
2011
2037
|
ref: h,
|
|
@@ -2014,44 +2040,44 @@ var lt = ["aria-label"], ut = /* @__PURE__ */ u({
|
|
|
2014
2040
|
"aria-label": "Media viewer",
|
|
2015
2041
|
"aria-modal": "true",
|
|
2016
2042
|
tabindex: "-1",
|
|
2017
|
-
style:
|
|
2018
|
-
}, [
|
|
2043
|
+
style: _(b.value)
|
|
2044
|
+
}, [u(St, {
|
|
2019
2045
|
ref_key: "reelRenderer",
|
|
2020
|
-
ref:
|
|
2021
|
-
"can-retry-end":
|
|
2022
|
-
"card-footer":
|
|
2023
|
-
"card-header":
|
|
2024
|
-
"feed-footer":
|
|
2025
|
-
"feed-footer-actions":
|
|
2026
|
-
"forward-index":
|
|
2027
|
-
"forward-item":
|
|
2028
|
-
"media-card":
|
|
2029
|
-
"has-next":
|
|
2030
|
-
"infinite-scroll":
|
|
2031
|
-
"initial-post-id":
|
|
2032
|
-
"info-sheet":
|
|
2033
|
-
"info-sheet-enabled":
|
|
2034
|
-
"info-sheet-overlay":
|
|
2035
|
-
"is-loading-more":
|
|
2036
|
-
items:
|
|
2037
|
-
"load-more-locked":
|
|
2038
|
-
"media-indices":
|
|
2046
|
+
ref: p,
|
|
2047
|
+
"can-retry-end": t.canRetryEnd,
|
|
2048
|
+
"card-footer": t.cardFooter,
|
|
2049
|
+
"card-header": t.cardHeader,
|
|
2050
|
+
"feed-footer": t.feedFooter,
|
|
2051
|
+
"feed-footer-actions": t.feedFooterActions,
|
|
2052
|
+
"forward-index": t.state.reelForwardIndex,
|
|
2053
|
+
"forward-item": t.state.reelForwardItem,
|
|
2054
|
+
"media-card": t.mediaCard,
|
|
2055
|
+
"has-next": t.state.next !== null,
|
|
2056
|
+
"infinite-scroll": t.state.infiniteScroll,
|
|
2057
|
+
"initial-post-id": t.state.activeReelPostId,
|
|
2058
|
+
"info-sheet": t.reelInfoSheet,
|
|
2059
|
+
"info-sheet-enabled": t.state.reelInfoSheet.enabled,
|
|
2060
|
+
"info-sheet-overlay": t.state.reelInfoSheetOverlay,
|
|
2061
|
+
"is-loading-more": t.state.isLoadingMore,
|
|
2062
|
+
items: t.state.items,
|
|
2063
|
+
"load-more-locked": t.state.loadMoreLocked,
|
|
2064
|
+
"media-indices": t.state.mediaIndices,
|
|
2039
2065
|
"media-source": "original",
|
|
2040
|
-
"next-page-error": !!
|
|
2066
|
+
"next-page-error": !!t.state.nextPageError,
|
|
2041
2067
|
origin: "masonry",
|
|
2042
|
-
"preview-states":
|
|
2043
|
-
"reel-auto-advance":
|
|
2044
|
-
"reel-forward":
|
|
2045
|
-
state:
|
|
2046
|
-
total:
|
|
2047
|
-
onActiveChange:
|
|
2048
|
-
onCloseInfoSheet:
|
|
2068
|
+
"preview-states": A.value,
|
|
2069
|
+
"reel-auto-advance": t.state.reelAutoAdvance,
|
|
2070
|
+
"reel-forward": t.state.reelForward,
|
|
2071
|
+
state: j.value,
|
|
2072
|
+
total: t.state.total,
|
|
2073
|
+
onActiveChange: i[9] ||= (e) => d("activeReelChange", e),
|
|
2074
|
+
onCloseInfoSheet: i[10] ||= (e) => d("reelInfoSheetChange", !1),
|
|
2049
2075
|
onError: ne,
|
|
2050
|
-
onLoadMore:
|
|
2051
|
-
onMediaChange:
|
|
2076
|
+
onLoadMore: i[11] ||= (e) => d("loadMore"),
|
|
2077
|
+
onMediaChange: q,
|
|
2052
2078
|
onReady: re,
|
|
2053
|
-
onRetryEnd:
|
|
2054
|
-
onRetryForward:
|
|
2079
|
+
onRetryEnd: i[12] ||= (e) => d("retryEnd"),
|
|
2080
|
+
onRetryForward: i[13] ||= (e) => d("retryForward")
|
|
2055
2081
|
}, null, 8, [
|
|
2056
2082
|
"can-retry-end",
|
|
2057
2083
|
"card-footer",
|
|
@@ -2077,14 +2103,14 @@ var lt = ["aria-label"], ut = /* @__PURE__ */ u({
|
|
|
2077
2103
|
"reel-forward",
|
|
2078
2104
|
"state",
|
|
2079
2105
|
"total"
|
|
2080
|
-
])], 4)) :
|
|
2106
|
+
])], 4)) : o("", !0)]),
|
|
2081
2107
|
_: 1
|
|
2082
2108
|
})], 64))], 512));
|
|
2083
2109
|
}
|
|
2084
2110
|
});
|
|
2085
2111
|
//#endregion
|
|
2086
2112
|
//#region src/core/page.ts
|
|
2087
|
-
function
|
|
2113
|
+
function Et(e) {
|
|
2088
2114
|
if (!e || typeof e != "object" || !Array.isArray(e.items)) throw TypeError("Vibe loadPage must resolve to a page with an items array.");
|
|
2089
2115
|
if (e.next !== null && typeof e.next != "string" && typeof e.next != "number") throw TypeError("Vibe page next must be a string, number, or null.");
|
|
2090
2116
|
if (e.total !== void 0 && (!Number.isFinite(e.total) || e.total < 0)) throw TypeError("Vibe page total must be a non-negative number when provided.");
|
|
@@ -2096,32 +2122,32 @@ function Q(e, t) {
|
|
|
2096
2122
|
}
|
|
2097
2123
|
//#endregion
|
|
2098
2124
|
//#region src/core/requestDelay.ts
|
|
2099
|
-
var
|
|
2125
|
+
var Dt = 2e3, Ot = 1e4, kt = 250, At = {
|
|
2100
2126
|
delayRemainingMs: null,
|
|
2101
2127
|
nextRequestAt: null
|
|
2102
2128
|
};
|
|
2103
|
-
function
|
|
2129
|
+
function jt(e, t) {
|
|
2104
2130
|
return e === void 0 ? t : Math.floor(e);
|
|
2105
2131
|
}
|
|
2106
|
-
function
|
|
2132
|
+
function Mt(e, t) {
|
|
2107
2133
|
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.`);
|
|
2108
2134
|
}
|
|
2109
|
-
function
|
|
2110
|
-
let n =
|
|
2135
|
+
function Nt(e, t = {}) {
|
|
2136
|
+
let n = jt(t.delayStepMs, Dt), r = jt(t.delayMaxMs, Ot);
|
|
2111
2137
|
return Math.min(Math.max(0, e) * n, r);
|
|
2112
2138
|
}
|
|
2113
2139
|
function $(e) {
|
|
2114
|
-
if (e == null || !Number.isFinite(e)) return { ...
|
|
2140
|
+
if (e == null || !Number.isFinite(e)) return { ...At };
|
|
2115
2141
|
let t = Math.max(0, Math.floor(e - Date.now()));
|
|
2116
2142
|
return t > 0 ? {
|
|
2117
2143
|
delayRemainingMs: t,
|
|
2118
2144
|
nextRequestAt: e
|
|
2119
|
-
} : { ...
|
|
2145
|
+
} : { ...At };
|
|
2120
2146
|
}
|
|
2121
|
-
async function
|
|
2147
|
+
async function Pt({ delayMs: e, onChange: t, signal: n }) {
|
|
2122
2148
|
if (n.aborted) throw new DOMException("Aborted", "AbortError");
|
|
2123
2149
|
if (e <= 0) {
|
|
2124
|
-
t({ ...
|
|
2150
|
+
t({ ...At });
|
|
2125
2151
|
return;
|
|
2126
2152
|
}
|
|
2127
2153
|
let r = Date.now() + e;
|
|
@@ -2129,9 +2155,9 @@ async function Mt({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2129
2155
|
delayRemainingMs: e,
|
|
2130
2156
|
nextRequestAt: r
|
|
2131
2157
|
}), await new Promise((i, a) => {
|
|
2132
|
-
let o = !1, s = setInterval(f,
|
|
2158
|
+
let o = !1, s = setInterval(f, kt), c = setTimeout(() => u(), e);
|
|
2133
2159
|
function l() {
|
|
2134
|
-
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...
|
|
2160
|
+
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...At });
|
|
2135
2161
|
}
|
|
2136
2162
|
function u(e) {
|
|
2137
2163
|
o || (o = !0, l(), e ? a(e) : i());
|
|
@@ -2146,13 +2172,13 @@ async function Mt({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2146
2172
|
n.addEventListener("abort", d, { once: !0 });
|
|
2147
2173
|
});
|
|
2148
2174
|
}
|
|
2149
|
-
var
|
|
2175
|
+
var Ft = class {
|
|
2150
2176
|
interval = null;
|
|
2151
2177
|
constructor(e) {
|
|
2152
2178
|
this.onChange = e;
|
|
2153
2179
|
}
|
|
2154
2180
|
clear() {
|
|
2155
|
-
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...
|
|
2181
|
+
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...At });
|
|
2156
2182
|
}
|
|
2157
2183
|
sync(e) {
|
|
2158
2184
|
this.clear();
|
|
@@ -2160,22 +2186,22 @@ var Nt = class {
|
|
|
2160
2186
|
this.onChange(t), t.delayRemainingMs !== null && (this.interval = setInterval(() => {
|
|
2161
2187
|
let t = $(e);
|
|
2162
2188
|
this.onChange(t), t.delayRemainingMs === null && this.clear();
|
|
2163
|
-
},
|
|
2189
|
+
}, kt));
|
|
2164
2190
|
}
|
|
2165
2191
|
};
|
|
2166
|
-
function
|
|
2192
|
+
function It(e, t = !0) {
|
|
2167
2193
|
return e.maxAdditionalPages === "unlimited" ? Infinity : (e.maxAdditionalPages ?? 10) + (t ? 1 : 0);
|
|
2168
2194
|
}
|
|
2169
|
-
function
|
|
2195
|
+
function Lt(e) {
|
|
2170
2196
|
return `${typeof e}:${String(e)}`;
|
|
2171
2197
|
}
|
|
2172
|
-
function
|
|
2198
|
+
function Rt(e, t) {
|
|
2173
2199
|
if (!Number.isInteger(e) || e <= 0) throw TypeError(`Vibe ${t} must be a positive integer.`);
|
|
2174
2200
|
}
|
|
2175
|
-
function
|
|
2201
|
+
function zt(e) {
|
|
2176
2202
|
if (!e) return;
|
|
2177
|
-
if (
|
|
2178
|
-
|
|
2203
|
+
if (Rt(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
|
|
2204
|
+
Mt(e, "frontend autofill");
|
|
2179
2205
|
let t = e.maxAdditionalPages;
|
|
2180
2206
|
if (t !== void 0 && t !== "unlimited" && (!Number.isInteger(t) || t < 0)) throw TypeError("Vibe autofill maxAdditionalPages must be a non-negative integer or \"unlimited\".");
|
|
2181
2207
|
return;
|
|
@@ -2187,7 +2213,7 @@ function Lt(e) {
|
|
|
2187
2213
|
if (t.pageSize !== e.pageSize) throw TypeError("Vibe backend autofill initialSession pageSize must match autofill pageSize.");
|
|
2188
2214
|
}
|
|
2189
2215
|
}
|
|
2190
|
-
function
|
|
2216
|
+
function Bt(e, t, n = !0) {
|
|
2191
2217
|
if (!e) return {
|
|
2192
2218
|
cycleId: null,
|
|
2193
2219
|
delayRemainingMs: null,
|
|
@@ -2221,7 +2247,7 @@ function Rt(e, t, n = !0) {
|
|
|
2221
2247
|
strategy: e.strategy
|
|
2222
2248
|
};
|
|
2223
2249
|
}
|
|
2224
|
-
function
|
|
2250
|
+
function Vt(e) {
|
|
2225
2251
|
return [
|
|
2226
2252
|
"cancelling",
|
|
2227
2253
|
"filling",
|
|
@@ -2229,9 +2255,9 @@ function zt(e) {
|
|
|
2229
2255
|
"waiting"
|
|
2230
2256
|
].includes(e.status);
|
|
2231
2257
|
}
|
|
2232
|
-
async function
|
|
2258
|
+
async function Ht(e, t, n) {
|
|
2233
2259
|
let r = t.autofill;
|
|
2234
|
-
if (!
|
|
2260
|
+
if (!Vt(r) || !r.cycleId) return;
|
|
2235
2261
|
let i = {
|
|
2236
2262
|
cycleId: r.cycleId,
|
|
2237
2263
|
feedKey: r.feedKey ?? "",
|
|
@@ -2244,20 +2270,20 @@ async function Bt(e, t, n) {
|
|
|
2244
2270
|
throw r.error = e, r.status = "error", e;
|
|
2245
2271
|
}
|
|
2246
2272
|
}
|
|
2247
|
-
function
|
|
2273
|
+
function Ut(e, t, n) {
|
|
2248
2274
|
return e?.strategy === "backend" && t.feedKey === e.feedKey && t.sessionId === n.sessionId;
|
|
2249
2275
|
}
|
|
2250
|
-
async function
|
|
2251
|
-
let u = [], d = [...e], f = /* @__PURE__ */ new Set(), p = r ??
|
|
2276
|
+
async function Wt({ existingItems: e, initialCursor: t, loadPage: n, maximumRequests: r, onDelayChange: i, onProgress: a, options: o, receivedOffset: s = 0, requestOffset: c = 0, signal: l }) {
|
|
2277
|
+
let u = [], d = [...e], f = /* @__PURE__ */ new Set(), p = r ?? It(o), m = t, h = t, g = 0, _;
|
|
2252
2278
|
for (; g < p;) {
|
|
2253
|
-
let e =
|
|
2279
|
+
let e = Lt(m);
|
|
2254
2280
|
if (f.has(e)) throw Error("Vibe autofill received a repeated cursor.");
|
|
2255
|
-
f.add(e), await
|
|
2256
|
-
delayMs:
|
|
2281
|
+
f.add(e), await Pt({
|
|
2282
|
+
delayMs: Nt(c + g, o),
|
|
2257
2283
|
onChange: i,
|
|
2258
2284
|
signal: l
|
|
2259
2285
|
});
|
|
2260
|
-
let t =
|
|
2286
|
+
let t = Et(await n({
|
|
2261
2287
|
cursor: m,
|
|
2262
2288
|
signal: l
|
|
2263
2289
|
}));
|
|
@@ -2297,30 +2323,30 @@ async function Ht({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
2297
2323
|
total: _
|
|
2298
2324
|
};
|
|
2299
2325
|
}
|
|
2300
|
-
var
|
|
2301
|
-
function
|
|
2326
|
+
var Gt = 100;
|
|
2327
|
+
function Kt(e, t) {
|
|
2302
2328
|
if (!Number.isFinite(t) || t <= 0) throw TypeError(`Vibe ${e} must be a positive number.`);
|
|
2303
2329
|
}
|
|
2304
|
-
function
|
|
2330
|
+
function qt(e, t, n) {
|
|
2305
2331
|
return Math.min(n, Math.max(t, e));
|
|
2306
2332
|
}
|
|
2307
|
-
function
|
|
2333
|
+
function Jt(e) {
|
|
2308
2334
|
if (!e) return;
|
|
2309
2335
|
let t = e.minSpeedPxPerSecond ?? 20, n = e.maxSpeedPxPerSecond ?? 240;
|
|
2310
|
-
if (
|
|
2311
|
-
e.speedPxPerSecond !== void 0 &&
|
|
2336
|
+
if (Kt("autoScroll.minSpeedPxPerSecond", t), Kt("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
|
|
2337
|
+
e.speedPxPerSecond !== void 0 && Kt("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
|
|
2312
2338
|
}
|
|
2313
|
-
function
|
|
2339
|
+
function Yt(e) {
|
|
2314
2340
|
let t = e?.minSpeedPxPerSecond ?? 20, n = e?.maxSpeedPxPerSecond ?? 240;
|
|
2315
2341
|
return {
|
|
2316
2342
|
enabled: e?.enabled ?? !1,
|
|
2317
2343
|
maxSpeedPxPerSecond: n,
|
|
2318
2344
|
minSpeedPxPerSecond: t,
|
|
2319
2345
|
paused: !1,
|
|
2320
|
-
speedPxPerSecond:
|
|
2346
|
+
speedPxPerSecond: qt(e?.speedPxPerSecond ?? 80, t, n)
|
|
2321
2347
|
};
|
|
2322
2348
|
}
|
|
2323
|
-
var
|
|
2349
|
+
var Xt = class {
|
|
2324
2350
|
frame = null;
|
|
2325
2351
|
lastTimestamp = null;
|
|
2326
2352
|
mounted = !1;
|
|
@@ -2340,9 +2366,9 @@ var Jt = class {
|
|
|
2340
2366
|
this.options.state.enabled && (this.options.state.paused = e, this.lastTimestamp = null, e ? this.cancelFrame() : this.schedule());
|
|
2341
2367
|
}
|
|
2342
2368
|
setSpeed(e) {
|
|
2343
|
-
|
|
2369
|
+
Kt("auto-scroll speed", e);
|
|
2344
2370
|
let t = this.options.state;
|
|
2345
|
-
t.speedPxPerSecond =
|
|
2371
|
+
t.speedPxPerSecond = qt(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
|
|
2346
2372
|
}
|
|
2347
2373
|
tick = (e) => {
|
|
2348
2374
|
this.frame = null;
|
|
@@ -2354,7 +2380,7 @@ var Jt = class {
|
|
|
2354
2380
|
return;
|
|
2355
2381
|
}
|
|
2356
2382
|
if (this.lastTimestamp !== null) {
|
|
2357
|
-
let r = Math.min(
|
|
2383
|
+
let r = Math.min(Gt, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
|
|
2358
2384
|
n.scrollTop = Math.min(i, n.scrollTop + t.speedPxPerSecond * r / 1e3);
|
|
2359
2385
|
}
|
|
2360
2386
|
this.lastTimestamp = e, this.schedule();
|
|
@@ -2368,7 +2394,7 @@ var Jt = class {
|
|
|
2368
2394
|
};
|
|
2369
2395
|
//#endregion
|
|
2370
2396
|
//#region src/core/backendAutofill.ts
|
|
2371
|
-
async function
|
|
2397
|
+
async function Zt(e, t, n, r) {
|
|
2372
2398
|
let i = await e.onUnderfilled(n);
|
|
2373
2399
|
if (!r()) return;
|
|
2374
2400
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend autofill requires a sessionId.");
|
|
@@ -2382,19 +2408,19 @@ async function Yt(e, t, n, r) {
|
|
|
2382
2408
|
status: "waiting"
|
|
2383
2409
|
});
|
|
2384
2410
|
}
|
|
2385
|
-
function
|
|
2411
|
+
function Qt(e, t) {
|
|
2386
2412
|
["complete", "exhausted"].includes(t.status) && t.items && (e.items = Q(e.items, t.items)), t.next !== void 0 && (e.next = t.next), t.total !== void 0 && (e.total = t.total);
|
|
2387
2413
|
}
|
|
2388
|
-
function
|
|
2414
|
+
function $t(e, t, n) {
|
|
2389
2415
|
let r = t.autofill;
|
|
2390
|
-
return !
|
|
2416
|
+
return !Ut(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (Qt(t, n), Object.assign(r, $(n.status === "waiting" ? n.nextRequestAt : null)), r.error = n.error ?? null, r.missing = Math.max(0, (r.pageSize ?? 0) - n.received), r.received = n.received, n.requests !== void 0 && (r.requests = n.requests), r.sequence = n.sequence, r.status = n.status, !0);
|
|
2391
2417
|
}
|
|
2392
|
-
function
|
|
2393
|
-
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill =
|
|
2418
|
+
function en(e, t, n) {
|
|
2419
|
+
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = Bt(e, n), Qt(t, n), !0);
|
|
2394
2420
|
}
|
|
2395
2421
|
//#endregion
|
|
2396
2422
|
//#region src/core/initialAutofill.ts
|
|
2397
|
-
async function
|
|
2423
|
+
async function tn({ cycleId: e, isCurrent: t, onLastCursor: n, options: r, signal: i, state: a }) {
|
|
2398
2424
|
let o = r.autofill;
|
|
2399
2425
|
if (!o) return;
|
|
2400
2426
|
let s = a.items.length;
|
|
@@ -2407,7 +2433,7 @@ async function $t({ cycleId: e, isCurrent: t, onLastCursor: n, options: r, signa
|
|
|
2407
2433
|
return;
|
|
2408
2434
|
}
|
|
2409
2435
|
if (o.strategy === "backend") {
|
|
2410
|
-
await
|
|
2436
|
+
await Zt(o, a, {
|
|
2411
2437
|
cycleId: e,
|
|
2412
2438
|
feedKey: o.feedKey,
|
|
2413
2439
|
items: [...a.items],
|
|
@@ -2424,11 +2450,11 @@ async function $t({ cycleId: e, isCurrent: t, onLastCursor: n, options: r, signa
|
|
|
2424
2450
|
a.autofill.status = "exhausted";
|
|
2425
2451
|
return;
|
|
2426
2452
|
}
|
|
2427
|
-
let c = await
|
|
2453
|
+
let c = await Wt({
|
|
2428
2454
|
existingItems: a.items,
|
|
2429
2455
|
initialCursor: a.next,
|
|
2430
2456
|
loadPage: r.loadPage,
|
|
2431
|
-
maximumRequests:
|
|
2457
|
+
maximumRequests: It(o, !1),
|
|
2432
2458
|
onDelayChange: (e) => {
|
|
2433
2459
|
t() && Object.assign(a.autofill, e);
|
|
2434
2460
|
},
|
|
@@ -2449,13 +2475,13 @@ async function $t({ cycleId: e, isCurrent: t, onLastCursor: n, options: r, signa
|
|
|
2449
2475
|
}
|
|
2450
2476
|
//#endregion
|
|
2451
2477
|
//#region src/core/fill.ts
|
|
2452
|
-
function
|
|
2478
|
+
function nn(e) {
|
|
2453
2479
|
return "pages" in e ? { pages: e.pages } : { until: "end" };
|
|
2454
2480
|
}
|
|
2455
|
-
function
|
|
2481
|
+
function rn(e) {
|
|
2456
2482
|
return `${typeof e}:${String(e)}`;
|
|
2457
2483
|
}
|
|
2458
|
-
function
|
|
2484
|
+
function an(e) {
|
|
2459
2485
|
if (!e || typeof e != "object") throw TypeError("Vibe fill target must be an object.");
|
|
2460
2486
|
if ("pages" in e) {
|
|
2461
2487
|
if (!Number.isInteger(e.pages) || e.pages <= 0) throw TypeError("Vibe fill pages must be a positive integer.");
|
|
@@ -2464,20 +2490,20 @@ function nn(e) {
|
|
|
2464
2490
|
if ("until" in e && e.until === "end") return { until: "end" };
|
|
2465
2491
|
throw TypeError("Vibe fill target must be { pages } or { until: 'end' }.");
|
|
2466
2492
|
}
|
|
2467
|
-
function
|
|
2493
|
+
function on(e) {
|
|
2468
2494
|
if (!e) return;
|
|
2469
2495
|
if (e.strategy === "frontend") {
|
|
2470
|
-
|
|
2496
|
+
Mt(e, "frontend fill");
|
|
2471
2497
|
return;
|
|
2472
2498
|
}
|
|
2473
2499
|
if (!e.feedKey.trim()) throw TypeError("Vibe backend fill requires a feedKey.");
|
|
2474
2500
|
let t = e.initialSession;
|
|
2475
2501
|
if (t) {
|
|
2476
2502
|
if (t.feedKey !== e.feedKey) throw TypeError("Vibe backend fill initialSession feedKey must match fill feedKey.");
|
|
2477
|
-
|
|
2503
|
+
an(t.target);
|
|
2478
2504
|
}
|
|
2479
2505
|
}
|
|
2480
|
-
function
|
|
2506
|
+
function sn(e, t, n = !0) {
|
|
2481
2507
|
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a = $(i?.nextRequestAt);
|
|
2482
2508
|
return {
|
|
2483
2509
|
completedPages: i?.completedPages ?? 0,
|
|
@@ -2491,10 +2517,10 @@ function an(e, t, n = !0) {
|
|
|
2491
2517
|
sessionId: i?.sessionId ?? null,
|
|
2492
2518
|
status: i?.status ?? "idle",
|
|
2493
2519
|
strategy: e?.strategy ?? null,
|
|
2494
|
-
target: i ?
|
|
2520
|
+
target: i ? nn(i.target) : null
|
|
2495
2521
|
};
|
|
2496
2522
|
}
|
|
2497
|
-
function
|
|
2523
|
+
function cn(e) {
|
|
2498
2524
|
return [
|
|
2499
2525
|
"cancelling",
|
|
2500
2526
|
"filling",
|
|
@@ -2502,17 +2528,17 @@ function on(e) {
|
|
|
2502
2528
|
"waiting"
|
|
2503
2529
|
].includes(e.status);
|
|
2504
2530
|
}
|
|
2505
|
-
async function
|
|
2531
|
+
async function ln({ existingItems: e, initialCursor: t, loadPage: n, onDelayChange: r, onProgress: i, options: a, signal: o, target: s }) {
|
|
2506
2532
|
let c = [], l = [...e], u = /* @__PURE__ */ new Set(), d = 0, f = t, p = t, m = 0, h;
|
|
2507
2533
|
for (; p !== null;) {
|
|
2508
|
-
let e =
|
|
2534
|
+
let e = rn(f);
|
|
2509
2535
|
if (u.has(e)) throw Error("Vibe fill received a repeated cursor.");
|
|
2510
|
-
u.add(e), await
|
|
2511
|
-
delayMs:
|
|
2536
|
+
u.add(e), await Pt({
|
|
2537
|
+
delayMs: Nt(d, a),
|
|
2512
2538
|
onChange: r,
|
|
2513
2539
|
signal: o
|
|
2514
2540
|
});
|
|
2515
|
-
let t =
|
|
2541
|
+
let t = Et(await n({
|
|
2516
2542
|
cursor: f,
|
|
2517
2543
|
signal: o
|
|
2518
2544
|
}));
|
|
@@ -2554,7 +2580,7 @@ async function sn({ existingItems: e, initialCursor: t, loadPage: n, onDelayChan
|
|
|
2554
2580
|
}
|
|
2555
2581
|
//#endregion
|
|
2556
2582
|
//#region src/core/backendFill.ts
|
|
2557
|
-
async function
|
|
2583
|
+
async function un(e, t, n, r) {
|
|
2558
2584
|
let i = await e.onStart(n);
|
|
2559
2585
|
if (r()) {
|
|
2560
2586
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend fill requires a sessionId.");
|
|
@@ -2568,22 +2594,22 @@ async function cn(e, t, n, r) {
|
|
|
2568
2594
|
});
|
|
2569
2595
|
}
|
|
2570
2596
|
}
|
|
2571
|
-
function
|
|
2597
|
+
function dn(e, t, n) {
|
|
2572
2598
|
return e?.strategy === "backend" && n.feedKey === e.feedKey && n.sessionId === t.fill.sessionId;
|
|
2573
2599
|
}
|
|
2574
|
-
function
|
|
2600
|
+
function fn(e) {
|
|
2575
2601
|
return Number.isInteger(e.completedPages) && e.completedPages >= 0 && Number.isInteger(e.received) && e.received >= 0 && Number.isInteger(e.sequence) && e.sequence >= 0;
|
|
2576
2602
|
}
|
|
2577
|
-
function
|
|
2603
|
+
function pn(e, t) {
|
|
2578
2604
|
if (!["complete", "exhausted"].includes(t.status)) return !0;
|
|
2579
2605
|
let n = e.fill.target;
|
|
2580
2606
|
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;
|
|
2581
2607
|
}
|
|
2582
|
-
function
|
|
2608
|
+
function mn(e, t, n) {
|
|
2583
2609
|
t.total !== void 0 && (e.total = t.total), ["complete", "exhausted"].includes(t.status) && (e.items = Q(e.items, t.items ?? []), e.next = t.next ?? null, n(t.lastCursor ?? null));
|
|
2584
2610
|
}
|
|
2585
|
-
function
|
|
2586
|
-
return !
|
|
2611
|
+
function hn(e, t, n, r) {
|
|
2612
|
+
return !dn(e, t, n) || !fn(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !pn(t, n) ? !1 : (mn(t, n, r), Object.assign(t.fill, {
|
|
2587
2613
|
...$(n.status === "waiting" ? n.nextRequestAt : null),
|
|
2588
2614
|
completedPages: n.completedPages,
|
|
2589
2615
|
error: n.error ?? null,
|
|
@@ -2592,41 +2618,41 @@ function pn(e, t, n, r) {
|
|
|
2592
2618
|
status: n.status
|
|
2593
2619
|
}), !0);
|
|
2594
2620
|
}
|
|
2595
|
-
function
|
|
2621
|
+
function gn(e, t, n, r) {
|
|
2596
2622
|
if (e?.strategy !== "backend" || n.feedKey !== e.feedKey) return !1;
|
|
2597
2623
|
let i = t.fill;
|
|
2598
|
-
return t.fill =
|
|
2624
|
+
return t.fill = sn(e, n), !fn(n) || !pn(t, n) ? (t.fill = i, !1) : (mn(t, n, r), !0);
|
|
2599
2625
|
}
|
|
2600
2626
|
//#endregion
|
|
2601
2627
|
//#region src/core/fillController.ts
|
|
2602
|
-
var
|
|
2628
|
+
var _n = class {
|
|
2603
2629
|
abortController = null;
|
|
2604
2630
|
cycle = 0;
|
|
2605
2631
|
delayCountdown;
|
|
2606
2632
|
requestVersion = 0;
|
|
2607
2633
|
constructor(e) {
|
|
2608
|
-
this.options = e, this.delayCountdown = new
|
|
2634
|
+
this.options = e, this.delayCountdown = new Ft((e) => {
|
|
2609
2635
|
Object.assign(this.options.state.fill, e);
|
|
2610
2636
|
}), this.syncBackendCountdown();
|
|
2611
2637
|
}
|
|
2612
2638
|
isActive() {
|
|
2613
|
-
return
|
|
2639
|
+
return cn(this.options.state.fill);
|
|
2614
2640
|
}
|
|
2615
2641
|
applyUpdate(e) {
|
|
2616
|
-
let t =
|
|
2642
|
+
let t = hn(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
2617
2643
|
return t && this.syncBackendCountdown(), t;
|
|
2618
2644
|
}
|
|
2619
2645
|
restoreSession(e) {
|
|
2620
|
-
let t =
|
|
2646
|
+
let t = gn(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
2621
2647
|
return t && this.syncBackendCountdown(), t;
|
|
2622
2648
|
}
|
|
2623
2649
|
async start(e) {
|
|
2624
2650
|
let t = this.options.fill;
|
|
2625
2651
|
if (!t) throw Error("Vibe fill is not configured.");
|
|
2626
2652
|
if (this.isActive()) throw Error("Vibe fill is already active.");
|
|
2627
|
-
let n =
|
|
2653
|
+
let n = an(e), r = `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
2628
2654
|
if (this.options.state.fill = {
|
|
2629
|
-
...
|
|
2655
|
+
...sn(t, void 0, !1),
|
|
2630
2656
|
cycleId: r,
|
|
2631
2657
|
status: "filling",
|
|
2632
2658
|
target: n
|
|
@@ -2637,7 +2663,7 @@ var hn = class {
|
|
|
2637
2663
|
let i = ++this.requestVersion, a = new AbortController();
|
|
2638
2664
|
this.abortController = a;
|
|
2639
2665
|
try {
|
|
2640
|
-
t.strategy === "frontend" ? await this.startFrontend(t, n, a, i) : (await
|
|
2666
|
+
t.strategy === "frontend" ? await this.startFrontend(t, n, a, i) : (await un(t, this.options.state, {
|
|
2641
2667
|
cycleId: r,
|
|
2642
2668
|
feedKey: t.feedKey,
|
|
2643
2669
|
items: [...this.options.state.items],
|
|
@@ -2655,7 +2681,7 @@ var hn = class {
|
|
|
2655
2681
|
}
|
|
2656
2682
|
async cancel() {
|
|
2657
2683
|
let { fill: e, state: t } = this.options;
|
|
2658
|
-
if (!
|
|
2684
|
+
if (!cn(t.fill) || !t.fill.cycleId) return;
|
|
2659
2685
|
let n = {
|
|
2660
2686
|
cycleId: t.fill.cycleId,
|
|
2661
2687
|
feedKey: t.fill.feedKey ?? "",
|
|
@@ -2669,7 +2695,7 @@ var hn = class {
|
|
|
2669
2695
|
}
|
|
2670
2696
|
}
|
|
2671
2697
|
reset() {
|
|
2672
|
-
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill =
|
|
2698
|
+
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = sn(this.options.fill, void 0, !1);
|
|
2673
2699
|
}
|
|
2674
2700
|
destroy() {
|
|
2675
2701
|
this.abortLocalRequest(), this.delayCountdown.clear();
|
|
@@ -2685,7 +2711,7 @@ var hn = class {
|
|
|
2685
2711
|
if (!i) throw Error("Vibe frontend fill requires loadPage.");
|
|
2686
2712
|
let a = this.options.state;
|
|
2687
2713
|
a.isLoadingMore = !0;
|
|
2688
|
-
let o = await
|
|
2714
|
+
let o = await ln({
|
|
2689
2715
|
existingItems: a.items,
|
|
2690
2716
|
initialCursor: a.next,
|
|
2691
2717
|
loadPage: i,
|
|
@@ -2712,7 +2738,7 @@ var hn = class {
|
|
|
2712
2738
|
};
|
|
2713
2739
|
//#endregion
|
|
2714
2740
|
//#region src/core/feedFooter.ts
|
|
2715
|
-
function
|
|
2741
|
+
function vn(e) {
|
|
2716
2742
|
return {
|
|
2717
2743
|
cancelAutofill: () => e.cancelAutofill(),
|
|
2718
2744
|
loadMore: () => e.loadNext(),
|
|
@@ -2720,45 +2746,45 @@ function gn(e) {
|
|
|
2720
2746
|
retryEnd: () => e.retryEnd()
|
|
2721
2747
|
};
|
|
2722
2748
|
}
|
|
2723
|
-
function
|
|
2749
|
+
function yn(e) {
|
|
2724
2750
|
if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
|
|
2725
2751
|
}
|
|
2726
|
-
function
|
|
2727
|
-
e?.intervalMs !== void 0 &&
|
|
2752
|
+
function bn(e) {
|
|
2753
|
+
e?.intervalMs !== void 0 && yn(e.intervalMs);
|
|
2728
2754
|
}
|
|
2729
|
-
function
|
|
2755
|
+
function xn(e) {
|
|
2730
2756
|
return {
|
|
2731
2757
|
enabled: e?.enabled ?? !1,
|
|
2732
2758
|
includePostItems: e?.includePostItems ?? !1,
|
|
2733
2759
|
intervalMs: e?.intervalMs ?? 5e3
|
|
2734
2760
|
};
|
|
2735
2761
|
}
|
|
2736
|
-
function
|
|
2762
|
+
function Sn(e, t) {
|
|
2737
2763
|
if (typeof t == "boolean") {
|
|
2738
2764
|
e.enabled = t;
|
|
2739
2765
|
return;
|
|
2740
2766
|
}
|
|
2741
|
-
|
|
2767
|
+
bn(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);
|
|
2742
2768
|
}
|
|
2743
2769
|
//#endregion
|
|
2744
2770
|
//#region src/core/reelInfoSheet.ts
|
|
2745
|
-
function
|
|
2771
|
+
function Cn(e) {
|
|
2746
2772
|
return { enabled: e?.enabled ?? !1 };
|
|
2747
2773
|
}
|
|
2748
|
-
function
|
|
2774
|
+
function wn(e, t, n) {
|
|
2749
2775
|
if (n && !t) throw Error("Vibe cannot enable reelInfoSheet without a configured component.");
|
|
2750
2776
|
e.enabled = n;
|
|
2751
2777
|
}
|
|
2752
2778
|
//#endregion
|
|
2753
2779
|
//#region src/core/initialRuntimeState.ts
|
|
2754
|
-
function
|
|
2780
|
+
function Tn(e, t) {
|
|
2755
2781
|
let n = e.initialPage;
|
|
2756
2782
|
return {
|
|
2757
2783
|
activeReelPostId: null,
|
|
2758
|
-
autoScroll:
|
|
2759
|
-
autofill:
|
|
2784
|
+
autoScroll: Yt(e.autoScroll),
|
|
2785
|
+
autofill: Bt(e.autofill),
|
|
2760
2786
|
error: null,
|
|
2761
|
-
fill:
|
|
2787
|
+
fill: sn(e.fill),
|
|
2762
2788
|
infiniteScroll: e.infiniteScroll ?? !0,
|
|
2763
2789
|
isLoading: !n,
|
|
2764
2790
|
isLoadingMore: !1,
|
|
@@ -2768,14 +2794,14 @@ function Cn(e, t) {
|
|
|
2768
2794
|
mediaIndices: /* @__PURE__ */ new Map(),
|
|
2769
2795
|
next: n?.next ?? null,
|
|
2770
2796
|
nextPageError: null,
|
|
2771
|
-
reelAutoAdvance:
|
|
2797
|
+
reelAutoAdvance: xn(e.reelAutoAdvance),
|
|
2772
2798
|
reelForward: {
|
|
2773
2799
|
error: null,
|
|
2774
2800
|
status: "idle"
|
|
2775
2801
|
},
|
|
2776
2802
|
reelForwardIndex: null,
|
|
2777
2803
|
reelForwardItem: null,
|
|
2778
|
-
reelInfoSheet:
|
|
2804
|
+
reelInfoSheet: Cn(e.reelInfoSheet),
|
|
2779
2805
|
reelInfoSheetOverlay: !1,
|
|
2780
2806
|
reelMediaSource: "original",
|
|
2781
2807
|
reelOrigin: null,
|
|
@@ -2784,26 +2810,26 @@ function Cn(e, t) {
|
|
|
2784
2810
|
}
|
|
2785
2811
|
//#endregion
|
|
2786
2812
|
//#region src/core/options.ts
|
|
2787
|
-
function
|
|
2813
|
+
function En(e, t) {
|
|
2788
2814
|
if (t) {
|
|
2789
2815
|
if (!Number.isFinite(t.height) || t.height <= 0) throw TypeError(`Vibe ${e} height must be a positive number.`);
|
|
2790
2816
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe ${e} background must be "default" or "transparent".`);
|
|
2791
2817
|
}
|
|
2792
2818
|
}
|
|
2793
|
-
function
|
|
2819
|
+
function Dn(e, t) {
|
|
2794
2820
|
if (t) {
|
|
2795
2821
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe mediaCard ${e} background must be "default" or "transparent".`);
|
|
2796
2822
|
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.`);
|
|
2797
2823
|
}
|
|
2798
2824
|
}
|
|
2799
|
-
function
|
|
2800
|
-
if (
|
|
2825
|
+
function On(e) {
|
|
2826
|
+
if (Jt(e.autoScroll), En("cardHeader", e.cardHeader), En("cardFooter", e.cardFooter), Dn("header", e.mediaCard?.header), Dn("footer", e.mediaCard?.footer), zt(e.autofill), on(e.fill), bn(e.reelAutoAdvance), e.removalHistoryLimit !== void 0 && (!Number.isInteger(e.removalHistoryLimit) || e.removalHistoryLimit < 0)) throw TypeError("Vibe removalHistoryLimit must be a non-negative integer.");
|
|
2801
2827
|
if (!e.initialPage && !e.loadPage) throw TypeError("Vibe requires either initialPage or loadPage.");
|
|
2802
2828
|
if (e.initialPage?.next !== null && !e.loadPage) throw TypeError("Vibe requires loadPage when initialPage has a next cursor.");
|
|
2803
2829
|
if (e.fill?.strategy === "frontend" && !e.loadPage) throw TypeError("Vibe frontend fill requires loadPage.");
|
|
2804
2830
|
if (e.fill?.strategy === "backend" && e.fill.initialSession && !e.initialPage) throw TypeError("Vibe backend fill restoration requires initialPage.");
|
|
2805
2831
|
}
|
|
2806
|
-
function
|
|
2832
|
+
function kn(e) {
|
|
2807
2833
|
if (typeof e != "string") return e;
|
|
2808
2834
|
if (typeof document > "u") throw Error("Vibe cannot resolve a selector without a document.");
|
|
2809
2835
|
let t = document.querySelector(e);
|
|
@@ -2812,7 +2838,7 @@ function Dn(e) {
|
|
|
2812
2838
|
}
|
|
2813
2839
|
//#endregion
|
|
2814
2840
|
//#region src/core/activeItemRemoval.ts
|
|
2815
|
-
function
|
|
2841
|
+
function An(e, t, n, r, i) {
|
|
2816
2842
|
let a = new Set(t.map(({ item: e }) => e.postId));
|
|
2817
2843
|
if (e.activeReelPostId === null || !a.has(e.activeReelPostId)) return;
|
|
2818
2844
|
let o = e.items[Math.max(n, 0)];
|
|
@@ -2825,7 +2851,7 @@ function On(e, t, n, r, i) {
|
|
|
2825
2851
|
}
|
|
2826
2852
|
//#endregion
|
|
2827
2853
|
//#region src/core/exactMediaRemovalController.ts
|
|
2828
|
-
function
|
|
2854
|
+
function jn(e, t) {
|
|
2829
2855
|
let [n, ...r] = t;
|
|
2830
2856
|
if (!n) throw Error("Vibe items must contain at least one media asset.");
|
|
2831
2857
|
return {
|
|
@@ -2834,10 +2860,10 @@ function kn(e, t) {
|
|
|
2834
2860
|
items: r
|
|
2835
2861
|
};
|
|
2836
2862
|
}
|
|
2837
|
-
function
|
|
2863
|
+
function Mn(e) {
|
|
2838
2864
|
if (!Number.isInteger(e.mediaIndex) || e.mediaIndex < 0) throw TypeError("Vibe mediaIndex must be a non-negative integer.");
|
|
2839
2865
|
}
|
|
2840
|
-
var
|
|
2866
|
+
var Nn = class {
|
|
2841
2867
|
generation = 0;
|
|
2842
2868
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
2843
2869
|
state;
|
|
@@ -2845,7 +2871,7 @@ var jn = class {
|
|
|
2845
2871
|
this.options = e, this.state = e.state;
|
|
2846
2872
|
}
|
|
2847
2873
|
remove(e) {
|
|
2848
|
-
|
|
2874
|
+
Mn(e);
|
|
2849
2875
|
let t = this.state.items.findIndex(({ postId: t }) => t === e.postId), n = this.state.items[t];
|
|
2850
2876
|
if (!n) return null;
|
|
2851
2877
|
let r = [...j(n)], i = r[e.mediaIndex];
|
|
@@ -2862,7 +2888,7 @@ var jn = class {
|
|
|
2862
2888
|
restored: !1
|
|
2863
2889
|
});
|
|
2864
2890
|
let o = this.state.mediaIndices.get(n.postId) ?? 0, s = this.isReelOpen() && this.state.activeReelPostId === n.postId, c = s && o === e.mediaIndex;
|
|
2865
|
-
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] =
|
|
2891
|
+
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = jn(n, r), this.updateMediaIndexAfterRemoval(n.postId, e.mediaIndex, c), a) : (this.state.items.splice(t, 1), this.state.mediaIndices.delete(n.postId), s && this.advanceFromRemovedPost(a, n), a);
|
|
2866
2892
|
}
|
|
2867
2893
|
reset() {
|
|
2868
2894
|
this.generation += 1;
|
|
@@ -2888,7 +2914,7 @@ var jn = class {
|
|
|
2888
2914
|
}
|
|
2889
2915
|
restoreIntoPost(e, t) {
|
|
2890
2916
|
let n = this.state.items[e], r = [...j(n)], i = Math.min(t.mediaIndex, r.length);
|
|
2891
|
-
if (r.splice(i, 0, t.media), this.state.items[e] =
|
|
2917
|
+
if (r.splice(i, 0, t.media), this.state.items[e] = jn(n, r), this.state.activeReelPostId !== t.postId) return;
|
|
2892
2918
|
let a = this.state.mediaIndices.get(t.postId) ?? 0;
|
|
2893
2919
|
a >= i && this.state.mediaIndices.set(t.postId, a + 1);
|
|
2894
2920
|
}
|
|
@@ -2901,18 +2927,18 @@ var jn = class {
|
|
|
2901
2927
|
};
|
|
2902
2928
|
//#endregion
|
|
2903
2929
|
//#region src/core/itemPlacement.ts
|
|
2904
|
-
function
|
|
2930
|
+
function Pn(e, t) {
|
|
2905
2931
|
let n = new Set(t);
|
|
2906
2932
|
return e.flatMap((e, t) => n.has(e.postId) ? [{
|
|
2907
2933
|
index: t,
|
|
2908
2934
|
item: e
|
|
2909
2935
|
}] : []);
|
|
2910
2936
|
}
|
|
2911
|
-
function
|
|
2937
|
+
function Fn(e, t) {
|
|
2912
2938
|
let n = new Set(t.map(({ item: e }) => e.postId));
|
|
2913
2939
|
return e.filter((e) => !n.has(e.postId));
|
|
2914
2940
|
}
|
|
2915
|
-
function
|
|
2941
|
+
function In(e, t) {
|
|
2916
2942
|
t.forEach(({ index: e }) => {
|
|
2917
2943
|
if (!Number.isInteger(e) || e < 0) throw Error("Vibe item restore indexes must be non-negative integers.");
|
|
2918
2944
|
});
|
|
@@ -2923,7 +2949,7 @@ function Pn(e, t) {
|
|
|
2923
2949
|
}
|
|
2924
2950
|
//#endregion
|
|
2925
2951
|
//#region src/core/itemRemovalController.ts
|
|
2926
|
-
var
|
|
2952
|
+
var Ln = 20, Rn = class {
|
|
2927
2953
|
generation = 0;
|
|
2928
2954
|
historyLimit;
|
|
2929
2955
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
@@ -2932,7 +2958,7 @@ var Fn = 20, In = class {
|
|
|
2932
2958
|
itemOrder;
|
|
2933
2959
|
stopItemsWatcher;
|
|
2934
2960
|
constructor(e) {
|
|
2935
|
-
this.options = e, this.historyLimit = e.historyLimit ??
|
|
2961
|
+
this.options = e, this.historyLimit = e.historyLimit ?? Ln, this.state = e.state, this.itemOrder = this.state.items.map(({ postId: e }) => e), this.stopItemsWatcher = D(() => this.state.items, (e) => this.appendUnknownItems(e), { flush: "sync" });
|
|
2936
2962
|
}
|
|
2937
2963
|
destroy() {
|
|
2938
2964
|
this.reset(), this.stopItemsWatcher();
|
|
@@ -2945,7 +2971,7 @@ var Fn = 20, In = class {
|
|
|
2945
2971
|
let i = this.options.startRemoval(r);
|
|
2946
2972
|
if (i > 0 && await new Promise((e) => setTimeout(e, i)), this.metadata.get(n)?.generation !== this.generation) return n;
|
|
2947
2973
|
let a = this.state.items.findIndex((e) => e.postId === this.state.activeReelPostId), o = new Set(t.map(({ item: e }) => e.postId)), s = a < 0 ? 0 : this.state.items.slice(0, a).filter(({ postId: e }) => o.has(e)).length, c = Math.max(a - s, 0);
|
|
2948
|
-
return this.state.items =
|
|
2974
|
+
return this.state.items = Fn(this.state.items, t), this.options.onItemsRemoved(n, t, c), this.record(n), n;
|
|
2949
2975
|
}
|
|
2950
2976
|
reset() {
|
|
2951
2977
|
this.generation += 1, this.history = [], this.itemOrder = [];
|
|
@@ -2956,7 +2982,7 @@ var Fn = 20, In = class {
|
|
|
2956
2982
|
this.restoreRemoval(t);
|
|
2957
2983
|
return;
|
|
2958
2984
|
}
|
|
2959
|
-
let n =
|
|
2985
|
+
let n = In(this.state.items, e);
|
|
2960
2986
|
this.registerExternalPlacements(e), this.state.items = n;
|
|
2961
2987
|
}
|
|
2962
2988
|
restoreRemoval(e) {
|
|
@@ -2982,7 +3008,7 @@ var Fn = 20, In = class {
|
|
|
2982
3008
|
}
|
|
2983
3009
|
collectOrderedPlacements(e) {
|
|
2984
3010
|
let t = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
2985
|
-
return
|
|
3011
|
+
return Pn(this.state.items, e).map((e) => ({
|
|
2986
3012
|
index: t.get(e.item.postId) ?? e.index,
|
|
2987
3013
|
item: e.item
|
|
2988
3014
|
}));
|
|
@@ -3013,7 +3039,7 @@ var Fn = 20, In = class {
|
|
|
3013
3039
|
let r = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
3014
3040
|
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;
|
|
3015
3041
|
}
|
|
3016
|
-
},
|
|
3042
|
+
}, zn = class {
|
|
3017
3043
|
forward = null;
|
|
3018
3044
|
forwardPromise = null;
|
|
3019
3045
|
forwardVersion = 0;
|
|
@@ -3091,7 +3117,7 @@ var Fn = 20, In = class {
|
|
|
3091
3117
|
}
|
|
3092
3118
|
}
|
|
3093
3119
|
}
|
|
3094
|
-
},
|
|
3120
|
+
}, Bn = class {
|
|
3095
3121
|
generation = 0;
|
|
3096
3122
|
pending = Promise.resolve();
|
|
3097
3123
|
constructor(e) {
|
|
@@ -3141,22 +3167,22 @@ var Fn = 20, In = class {
|
|
|
3141
3167
|
};
|
|
3142
3168
|
//#endregion
|
|
3143
3169
|
//#region src/core/removalControllers.ts
|
|
3144
|
-
function
|
|
3145
|
-
let t = new
|
|
3170
|
+
function Vn(e) {
|
|
3171
|
+
let t = new zn(e), n = new Bn({
|
|
3146
3172
|
state: e.state,
|
|
3147
3173
|
transitionMedia: (t) => e.surface()?.transitionActiveReelMedia(t) ?? Promise.resolve(!1),
|
|
3148
3174
|
transitionPost: (t) => e.surface()?.transitionActiveReelPost(t) ?? Promise.resolve(!1)
|
|
3149
3175
|
});
|
|
3150
3176
|
return {
|
|
3151
|
-
exactMediaRemoval: new
|
|
3177
|
+
exactMediaRemoval: new Nn({
|
|
3152
3178
|
onActivate: e.onActivate,
|
|
3153
3179
|
reelForward: t,
|
|
3154
3180
|
state: e.state
|
|
3155
3181
|
}),
|
|
3156
|
-
itemRemoval: new
|
|
3182
|
+
itemRemoval: new Rn({
|
|
3157
3183
|
historyLimit: e.historyLimit,
|
|
3158
3184
|
onItemsRemoved: (n, r, i) => {
|
|
3159
|
-
|
|
3185
|
+
An(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
|
|
3160
3186
|
},
|
|
3161
3187
|
onRemovalRestored: (n) => {
|
|
3162
3188
|
let r = t.cancel(n);
|
|
@@ -3170,17 +3196,17 @@ function zn(e) {
|
|
|
3170
3196
|
reelRemoval: n
|
|
3171
3197
|
};
|
|
3172
3198
|
}
|
|
3173
|
-
var
|
|
3174
|
-
function
|
|
3199
|
+
var Hn = 1.5;
|
|
3200
|
+
function Un(e) {
|
|
3175
3201
|
let t = Math.min(e.screenWidth, e.screenHeight);
|
|
3176
3202
|
if (t > 0 && t < 600) return !0;
|
|
3177
|
-
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n *
|
|
3203
|
+
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * Hn;
|
|
3178
3204
|
return !e.hasHover && n > 0 && n < 600 && r;
|
|
3179
3205
|
}
|
|
3180
|
-
function
|
|
3181
|
-
return
|
|
3206
|
+
function Wn(e) {
|
|
3207
|
+
return Un(e) ? "reel" : "masonry";
|
|
3182
3208
|
}
|
|
3183
|
-
function
|
|
3209
|
+
function Gn(e) {
|
|
3184
3210
|
let t = e.ownerDocument.defaultView, n = e.ownerDocument.documentElement;
|
|
3185
3211
|
return {
|
|
3186
3212
|
hasHover: typeof t?.matchMedia == "function" && t.matchMedia("(hover: hover)").matches,
|
|
@@ -3190,15 +3216,15 @@ function Un(e) {
|
|
|
3190
3216
|
viewportWidth: n.clientWidth
|
|
3191
3217
|
};
|
|
3192
3218
|
}
|
|
3193
|
-
function
|
|
3194
|
-
return
|
|
3219
|
+
function Kn(e) {
|
|
3220
|
+
return Un(Gn(e));
|
|
3195
3221
|
}
|
|
3196
|
-
function
|
|
3197
|
-
return
|
|
3222
|
+
function qn(e) {
|
|
3223
|
+
return Wn(Gn(e));
|
|
3198
3224
|
}
|
|
3199
3225
|
//#endregion
|
|
3200
3226
|
//#region src/core/responsiveLayoutController.ts
|
|
3201
|
-
var
|
|
3227
|
+
var Jn = class {
|
|
3202
3228
|
layoutMode;
|
|
3203
3229
|
resizeObserver = null;
|
|
3204
3230
|
target = null;
|
|
@@ -3223,10 +3249,10 @@ var Kn = class {
|
|
|
3223
3249
|
}
|
|
3224
3250
|
handleResponsiveLayout = () => {
|
|
3225
3251
|
if (!this.target) return;
|
|
3226
|
-
let e =
|
|
3227
|
-
this.state.reelInfoSheetOverlay =
|
|
3252
|
+
let e = qn(this.target);
|
|
3253
|
+
this.state.reelInfoSheetOverlay = Kn(this.target), this.state.reelMediaSource = e === "reel" ? "preview" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
|
|
3228
3254
|
};
|
|
3229
|
-
},
|
|
3255
|
+
}, Yn = class {
|
|
3230
3256
|
routedReelPostId = null;
|
|
3231
3257
|
reelRouteIsActive = !1;
|
|
3232
3258
|
constructor(e, t) {
|
|
@@ -3253,7 +3279,7 @@ var Kn = class {
|
|
|
3253
3279
|
let i = this.reelRouteIsActive ? "replace" : "push";
|
|
3254
3280
|
this.reelRouteIsActive = !0, this.routedReelPostId = e, this.options.router[i](r);
|
|
3255
3281
|
}
|
|
3256
|
-
},
|
|
3282
|
+
}, Xn = class {
|
|
3257
3283
|
app = null;
|
|
3258
3284
|
autoScroll;
|
|
3259
3285
|
autofillDelayCountdown;
|
|
@@ -3273,20 +3299,20 @@ var Kn = class {
|
|
|
3273
3299
|
lastLoadedCursor = null;
|
|
3274
3300
|
state;
|
|
3275
3301
|
constructor(e) {
|
|
3276
|
-
this.options = e,
|
|
3302
|
+
this.options = e, On(e);
|
|
3277
3303
|
let t = e.layout ?? "masonry";
|
|
3278
|
-
this.state = b(
|
|
3304
|
+
this.state = b(Tn(e, t)), this.autoScroll = new Xt({
|
|
3279
3305
|
getScrollElement: () => this.surface?.getAutoScrollElement() ?? null,
|
|
3280
3306
|
state: this.state.autoScroll
|
|
3281
|
-
}), this.autofillDelayCountdown = new
|
|
3307
|
+
}), this.autofillDelayCountdown = new Ft((e) => Object.assign(this.state.autofill, e)), this.syncAutofillCountdown(), this.fillController = new _n({
|
|
3282
3308
|
fill: e.fill,
|
|
3283
3309
|
loadPage: e.loadPage,
|
|
3284
3310
|
onLastCursor: (e) => {
|
|
3285
3311
|
this.lastLoadedCursor = e;
|
|
3286
3312
|
},
|
|
3287
3313
|
state: this.state
|
|
3288
|
-
}), this.routing = new
|
|
3289
|
-
let n =
|
|
3314
|
+
}), this.routing = new Yn(e.routing, this.state);
|
|
3315
|
+
let n = Vn({
|
|
3290
3316
|
historyLimit: e.removalHistoryLimit,
|
|
3291
3317
|
loadNext: () => this.loadNext(),
|
|
3292
3318
|
onActivate: (e) => this.setActiveReelPost(e),
|
|
@@ -3294,20 +3320,20 @@ var Kn = class {
|
|
|
3294
3320
|
state: this.state,
|
|
3295
3321
|
surface: () => this.surface
|
|
3296
3322
|
});
|
|
3297
|
-
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new
|
|
3323
|
+
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new Jn(t, this.state, () => {
|
|
3298
3324
|
this.routing.syncFeed();
|
|
3299
3325
|
}), this.startStateNotifications();
|
|
3300
3326
|
}
|
|
3301
3327
|
async mount() {
|
|
3302
3328
|
if (this.app) throw Error("Vibe is already mounted.");
|
|
3303
3329
|
this.startStateNotifications();
|
|
3304
|
-
let e =
|
|
3305
|
-
this.responsiveLayout.mount(e), this.app =
|
|
3330
|
+
let e = kn(this.options.target);
|
|
3331
|
+
this.responsiveLayout.mount(e), this.app = i(Tt, {
|
|
3306
3332
|
canRetryEnd: !!this.options.loadPage,
|
|
3307
3333
|
cardFooter: this.options.cardFooter,
|
|
3308
3334
|
cardHeader: this.options.cardHeader,
|
|
3309
3335
|
feedFooter: this.options.feedFooter,
|
|
3310
|
-
feedFooterActions:
|
|
3336
|
+
feedFooterActions: vn(this),
|
|
3311
3337
|
mediaCard: this.options.mediaCard,
|
|
3312
3338
|
reelInfoSheet: this.options.reelInfoSheet,
|
|
3313
3339
|
state: this.state,
|
|
@@ -3383,11 +3409,11 @@ var Kn = class {
|
|
|
3383
3409
|
this.autoScroll.setSpeed(e);
|
|
3384
3410
|
}
|
|
3385
3411
|
applyAutofillUpdate(e) {
|
|
3386
|
-
let t =
|
|
3412
|
+
let t = $t(this.options.autofill, this.state, e);
|
|
3387
3413
|
return t && this.syncAutofillCountdown(), t;
|
|
3388
3414
|
}
|
|
3389
3415
|
async cancelAutofill() {
|
|
3390
|
-
await
|
|
3416
|
+
await Ht(this.options.autofill, this.state, () => this.cancelRequest());
|
|
3391
3417
|
}
|
|
3392
3418
|
applyFillUpdate(e) {
|
|
3393
3419
|
return this.fillController.applyUpdate(e);
|
|
@@ -3396,11 +3422,11 @@ var Kn = class {
|
|
|
3396
3422
|
return this.fillController.cancel();
|
|
3397
3423
|
}
|
|
3398
3424
|
async fill(e) {
|
|
3399
|
-
if (this.pendingRequest ||
|
|
3425
|
+
if (this.pendingRequest || Vt(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
|
|
3400
3426
|
await this.fillController.start(e);
|
|
3401
3427
|
}
|
|
3402
3428
|
restoreAutofillSession(e) {
|
|
3403
|
-
let t =
|
|
3429
|
+
let t = en(this.options.autofill, this.state, e);
|
|
3404
3430
|
return t && this.syncAutofillCountdown(), t;
|
|
3405
3431
|
}
|
|
3406
3432
|
restoreFillSession(e) {
|
|
@@ -3408,7 +3434,7 @@ var Kn = class {
|
|
|
3408
3434
|
}
|
|
3409
3435
|
async loadNext() {
|
|
3410
3436
|
if (this.pendingRequest) return this.pendingRequest;
|
|
3411
|
-
if (!this.state.loadMoreLocked && !(
|
|
3437
|
+
if (!this.state.loadMoreLocked && !(Vt(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.state.next, !0);
|
|
3412
3438
|
}
|
|
3413
3439
|
async refresh() {
|
|
3414
3440
|
return this.replaceFeed(this.state.next ?? this.lastLoadedCursor, "refresh");
|
|
@@ -3418,23 +3444,23 @@ var Kn = class {
|
|
|
3418
3444
|
}
|
|
3419
3445
|
async replaceFeed(e, t) {
|
|
3420
3446
|
if (!this.options.loadPage) throw Error(`Vibe cannot ${t} without loadPage.`);
|
|
3421
|
-
return
|
|
3447
|
+
return Vt(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.state.autofill = Bt(this.options.autofill, void 0, !1), this.fillController.reset(), this.reelForward.reset(), this.reelRemoval.reset(), this.exactMediaRemoval.reset(), this.itemRemoval.reset(), this.state.error = null, this.state.isLoading = !0, this.state.items = [], this.state.next = null, this.state.nextPageError = null, this.state.total = null, this.startRequest(e, !1);
|
|
3422
3448
|
}
|
|
3423
3449
|
async retryEnd() {
|
|
3424
3450
|
if (this.pendingRequest) return this.pendingRequest;
|
|
3425
|
-
if (!this.state.loadMoreLocked && !(
|
|
3451
|
+
if (!this.state.loadMoreLocked && !(Vt(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);
|
|
3426
3452
|
}
|
|
3427
3453
|
setInfiniteScroll(e) {
|
|
3428
|
-
this.state.infiniteScroll = e, e &&
|
|
3454
|
+
this.state.infiniteScroll = e, e && m(() => this.surface?.loadIfNearBottom());
|
|
3429
3455
|
}
|
|
3430
3456
|
setLoadMoreLocked(e) {
|
|
3431
|
-
this.state.loadMoreLocked !== e && (this.state.loadMoreLocked = e, !e && this.state.infiniteScroll &&
|
|
3457
|
+
this.state.loadMoreLocked !== e && (this.state.loadMoreLocked = e, !e && this.state.infiniteScroll && m(() => this.surface?.loadIfNearBottom()));
|
|
3432
3458
|
}
|
|
3433
3459
|
setReelAutoAdvance(e) {
|
|
3434
|
-
|
|
3460
|
+
Sn(this.state.reelAutoAdvance, e);
|
|
3435
3461
|
}
|
|
3436
3462
|
setReelInfoSheet(e) {
|
|
3437
|
-
|
|
3463
|
+
wn(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
|
|
3438
3464
|
}
|
|
3439
3465
|
setLayout(e) {
|
|
3440
3466
|
this.responsiveLayout.setLayout(e);
|
|
@@ -3458,7 +3484,7 @@ var Kn = class {
|
|
|
3458
3484
|
this.abortController = i;
|
|
3459
3485
|
try {
|
|
3460
3486
|
if (a?.strategy === "frontend") {
|
|
3461
|
-
let o = await
|
|
3487
|
+
let o = await Wt({
|
|
3462
3488
|
existingItems: t ? this.state.items : [],
|
|
3463
3489
|
initialCursor: e,
|
|
3464
3490
|
loadPage: n,
|
|
@@ -3480,7 +3506,7 @@ var Kn = class {
|
|
|
3480
3506
|
});
|
|
3481
3507
|
return;
|
|
3482
3508
|
}
|
|
3483
|
-
let c =
|
|
3509
|
+
let c = Et(await n({
|
|
3484
3510
|
cursor: e,
|
|
3485
3511
|
signal: i.signal
|
|
3486
3512
|
}));
|
|
@@ -3495,7 +3521,7 @@ var Kn = class {
|
|
|
3495
3521
|
this.state.autofill.status = "complete";
|
|
3496
3522
|
return;
|
|
3497
3523
|
}
|
|
3498
|
-
await
|
|
3524
|
+
await Zt(a, this.state, {
|
|
3499
3525
|
cycleId: o,
|
|
3500
3526
|
feedKey: a.feedKey,
|
|
3501
3527
|
items: u.slice(l.length),
|
|
@@ -3520,7 +3546,7 @@ var Kn = class {
|
|
|
3520
3546
|
this.autofillDelayCountdown.clear();
|
|
3521
3547
|
let t = `vibe-autofill-${Date.now().toString(36)}-${++this.autofillCycle}`;
|
|
3522
3548
|
return this.state.autofill = {
|
|
3523
|
-
...
|
|
3549
|
+
...Bt(e, void 0, !1),
|
|
3524
3550
|
cycleId: t,
|
|
3525
3551
|
status: "filling"
|
|
3526
3552
|
}, t;
|
|
@@ -3538,7 +3564,7 @@ var Kn = class {
|
|
|
3538
3564
|
startInitialAutofill() {
|
|
3539
3565
|
let e = ++this.requestVersion, t = new AbortController(), n = this.beginAutofillCycle();
|
|
3540
3566
|
this.abortController = t, this.state.isLoadingMore = !0;
|
|
3541
|
-
let r =
|
|
3567
|
+
let r = tn({
|
|
3542
3568
|
cycleId: n,
|
|
3543
3569
|
isCurrent: () => e === this.requestVersion,
|
|
3544
3570
|
onLastCursor: (e) => {
|
|
@@ -3562,8 +3588,8 @@ var Kn = class {
|
|
|
3562
3588
|
}));
|
|
3563
3589
|
}
|
|
3564
3590
|
};
|
|
3565
|
-
function
|
|
3566
|
-
return new
|
|
3591
|
+
function Zn(e) {
|
|
3592
|
+
return new Xn(e);
|
|
3567
3593
|
}
|
|
3568
3594
|
//#endregion
|
|
3569
|
-
export {
|
|
3595
|
+
export { Zn as createVibe };
|