@wyxos/vibe 4.4.0 → 4.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/lib/components/FeedFooter.vue.d.ts +0 -1
- package/lib/components/GalleryFooter.vue.d.ts +0 -1
- package/lib/index.cjs +1 -1
- package/lib/index.js +301 -315
- package/lib/style.css +1 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -50,18 +50,13 @@ var I = {
|
|
|
50
50
|
role: "status"
|
|
51
51
|
}, R = ["disabled"], z = {
|
|
52
52
|
key: 2,
|
|
53
|
-
class: "gallery-sentinel",
|
|
54
|
-
"aria-hidden": "true"
|
|
55
|
-
}, B = {
|
|
56
|
-
key: 3,
|
|
57
53
|
class: "end-feed"
|
|
58
|
-
},
|
|
54
|
+
}, B = ["disabled"], V = /* @__PURE__ */ u({
|
|
59
55
|
__name: "GalleryFooter",
|
|
60
56
|
props: {
|
|
61
57
|
canRetryEnd: { type: Boolean },
|
|
62
58
|
hasError: { type: Boolean },
|
|
63
59
|
hasNext: { type: Boolean },
|
|
64
|
-
infiniteScroll: { type: Boolean },
|
|
65
60
|
isLoading: { type: Boolean },
|
|
66
61
|
loadMoreLocked: { type: Boolean }
|
|
67
62
|
},
|
|
@@ -71,14 +66,14 @@ var I = {
|
|
|
71
66
|
function i() {
|
|
72
67
|
n.loadMoreLocked || (n.hasNext ? r("loadMore") : r("retryEnd"));
|
|
73
68
|
}
|
|
74
|
-
return (t, n) => e.hasNext || e.isLoading || e.hasError || e.canRetryEnd ? (y(), o("footer", I, [e.isLoading ? (y(), o("p", L, " Loading more… ")) : e.hasError || e.hasNext
|
|
69
|
+
return (t, n) => e.hasNext || e.isLoading || e.hasError || e.canRetryEnd ? (y(), o("footer", I, [e.isLoading ? (y(), o("p", L, " Loading more… ")) : e.hasError || e.hasNext ? (y(), o("button", {
|
|
75
70
|
key: 1,
|
|
76
71
|
"data-test": "load-more",
|
|
77
72
|
class: "load-more-button",
|
|
78
73
|
type: "button",
|
|
79
74
|
disabled: e.loadMoreLocked,
|
|
80
75
|
onClick: i
|
|
81
|
-
}, w(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9, R)) :
|
|
76
|
+
}, w(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9, R)) : (y(), o("div", z, [n[1] ||= s("p", {
|
|
82
77
|
class: "end-feed-message",
|
|
83
78
|
role: "status"
|
|
84
79
|
}, " You've reached the end. ", -1), s("button", {
|
|
@@ -87,9 +82,9 @@ var I = {
|
|
|
87
82
|
type: "button",
|
|
88
83
|
disabled: e.loadMoreLocked,
|
|
89
84
|
onClick: n[0] ||= (e) => t.$emit("retryEnd")
|
|
90
|
-
}, " Check for more ", 8,
|
|
85
|
+
}, " Check for more ", 8, B)]))])) : a("", !0);
|
|
91
86
|
}
|
|
92
|
-
}),
|
|
87
|
+
}), H = /* @__PURE__ */ u({
|
|
93
88
|
__name: "FeedFooter",
|
|
94
89
|
props: {
|
|
95
90
|
actions: {},
|
|
@@ -97,7 +92,6 @@ var I = {
|
|
|
97
92
|
feedFooter: {},
|
|
98
93
|
hasError: { type: Boolean },
|
|
99
94
|
hasNext: { type: Boolean },
|
|
100
|
-
infiniteScroll: { type: Boolean },
|
|
101
95
|
isLoading: { type: Boolean },
|
|
102
96
|
loadMoreLocked: { type: Boolean },
|
|
103
97
|
state: {}
|
|
@@ -124,12 +118,11 @@ var I = {
|
|
|
124
118
|
"actions",
|
|
125
119
|
"can-retry-end",
|
|
126
120
|
"state"
|
|
127
|
-
])) : (y(), i(
|
|
121
|
+
])) : (y(), i(V, {
|
|
128
122
|
key: 1,
|
|
129
123
|
"can-retry-end": e.canRetryEnd,
|
|
130
124
|
"has-error": e.hasError,
|
|
131
125
|
"has-next": e.hasNext,
|
|
132
|
-
"infinite-scroll": e.infiniteScroll,
|
|
133
126
|
"is-loading": e.isLoading,
|
|
134
127
|
"load-more-locked": e.loadMoreLocked,
|
|
135
128
|
onLoadMore: n[2] ||= (e) => r("loadMore"),
|
|
@@ -138,12 +131,11 @@ var I = {
|
|
|
138
131
|
"can-retry-end",
|
|
139
132
|
"has-error",
|
|
140
133
|
"has-next",
|
|
141
|
-
"infinite-scroll",
|
|
142
134
|
"is-loading",
|
|
143
135
|
"load-more-locked"
|
|
144
136
|
]));
|
|
145
137
|
}
|
|
146
|
-
}),
|
|
138
|
+
}), U = ["role"], W = { class: "gallery-status" }, ee = /* @__PURE__ */ u({
|
|
147
139
|
__name: "FeedStatus",
|
|
148
140
|
props: {
|
|
149
141
|
actions: {},
|
|
@@ -157,14 +149,13 @@ var I = {
|
|
|
157
149
|
return (n, u) => (y(), o("main", {
|
|
158
150
|
class: "gallery-shell",
|
|
159
151
|
role: r.state.error ? "alert" : r.state.isLoading ? "status" : void 0
|
|
160
|
-
}, [s("p",
|
|
152
|
+
}, [s("p", W, [r.state.error ? (y(), o(e, { key: 0 }, [c(" Unable to load media. ")], 64)) : r.state.isLoading ? (y(), o(e, { key: 1 }, [c(" Loading media… ")], 64)) : (y(), o(e, { key: 2 }, [c(" No media found. ")], 64))]), t.feedFooter ? (y(), i(H, {
|
|
161
153
|
key: 0,
|
|
162
154
|
actions: t.actions,
|
|
163
155
|
"can-retry-end": t.canRetryEnd,
|
|
164
156
|
"feed-footer": t.feedFooter,
|
|
165
157
|
"has-error": !!t.state.nextPageError,
|
|
166
158
|
"has-next": t.state.next !== null,
|
|
167
|
-
"infinite-scroll": t.state.infiniteScroll,
|
|
168
159
|
"is-loading": t.state.isLoadingMore,
|
|
169
160
|
"load-more-locked": t.state.loadMoreLocked,
|
|
170
161
|
state: t.state,
|
|
@@ -176,11 +167,10 @@ var I = {
|
|
|
176
167
|
"feed-footer",
|
|
177
168
|
"has-error",
|
|
178
169
|
"has-next",
|
|
179
|
-
"infinite-scroll",
|
|
180
170
|
"is-loading",
|
|
181
171
|
"load-more-locked",
|
|
182
172
|
"state"
|
|
183
|
-
])) : a("", !0)], 8,
|
|
173
|
+
])) : a("", !0)], 8, U));
|
|
184
174
|
}
|
|
185
175
|
});
|
|
186
176
|
function G(e) {
|
|
@@ -188,28 +178,28 @@ function G(e) {
|
|
|
188
178
|
}
|
|
189
179
|
//#endregion
|
|
190
180
|
//#region src/core/masonry.ts
|
|
191
|
-
function
|
|
181
|
+
function te(e) {
|
|
192
182
|
let t = e.preview.width ?? e.width, n = e.preview.height ?? e.height;
|
|
193
183
|
return !t || !n || t <= 0 || n <= 0 ? 1 : n / t;
|
|
194
184
|
}
|
|
195
|
-
function
|
|
185
|
+
function ne(e) {
|
|
196
186
|
return e.reduce((t, n, r) => n < e[t] ? r : t, 0);
|
|
197
187
|
}
|
|
198
|
-
function
|
|
188
|
+
function K(e) {
|
|
199
189
|
return Math.max(0, e.containerHeight) + Math.max(0, e.gap);
|
|
200
190
|
}
|
|
201
|
-
function
|
|
191
|
+
function q(e, t) {
|
|
202
192
|
let n = Math.max(0, t.overscan), r = t.scrollTop - n, i = t.scrollTop + Math.max(0, t.viewportHeight) + n;
|
|
203
193
|
return e.reduce((e, t, n) => (t.y + t.height >= r && t.y <= i && e.push(n), e), []);
|
|
204
194
|
}
|
|
205
|
-
function
|
|
195
|
+
function J(e, t, n) {
|
|
206
196
|
if (t <= 0 || e.length === 0) return {
|
|
207
197
|
columns: 0,
|
|
208
198
|
height: 0,
|
|
209
199
|
items: []
|
|
210
200
|
};
|
|
211
201
|
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) => {
|
|
212
|
-
let t =
|
|
202
|
+
let t = ne(c), n = s * te(e) + i, a = {
|
|
213
203
|
x: t * (s + r),
|
|
214
204
|
y: c[t],
|
|
215
205
|
width: s,
|
|
@@ -225,10 +215,10 @@ function Y(e, t, n) {
|
|
|
225
215
|
}
|
|
226
216
|
//#endregion
|
|
227
217
|
//#region src/core/scrollbar.ts
|
|
228
|
-
function
|
|
218
|
+
function Y(e, t, n) {
|
|
229
219
|
return Math.min(n, Math.max(t, e));
|
|
230
220
|
}
|
|
231
|
-
function
|
|
221
|
+
function X({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize: r, viewportSize: i }) {
|
|
232
222
|
let a = Math.max(0, e), o = Math.max(0, r), s = Math.max(0, i), c = Math.max(0, a - s);
|
|
233
223
|
if (!(c > 0 && o > 0)) return {
|
|
234
224
|
maximumScrollPosition: c,
|
|
@@ -237,23 +227,23 @@ function re({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize:
|
|
|
237
227
|
thumbSize: o,
|
|
238
228
|
thumbTravel: 0
|
|
239
229
|
};
|
|
240
|
-
let l =
|
|
230
|
+
let l = Y(s / a * o, Math.min(Math.max(0, t), o), o), u = Math.max(0, o - l);
|
|
241
231
|
return {
|
|
242
232
|
maximumScrollPosition: c,
|
|
243
233
|
scrollable: !0,
|
|
244
|
-
thumbOffset: u * (
|
|
234
|
+
thumbOffset: u * (Y(n, 0, c) / c),
|
|
245
235
|
thumbSize: l,
|
|
246
236
|
thumbTravel: u
|
|
247
237
|
};
|
|
248
238
|
}
|
|
249
239
|
//#endregion
|
|
250
240
|
//#region src/components/GalleryScrollbar.vue?vue&type=script&setup=true&lang.ts
|
|
251
|
-
var
|
|
241
|
+
var re = ["aria-hidden"], ie = [
|
|
252
242
|
"aria-controls",
|
|
253
243
|
"aria-valuemax",
|
|
254
244
|
"aria-valuenow",
|
|
255
245
|
"tabindex"
|
|
256
|
-
],
|
|
246
|
+
], ae = 32, Z = 40, oe = 120, se = /* @__PURE__ */ u({
|
|
257
247
|
__name: "GalleryScrollbar",
|
|
258
248
|
props: {
|
|
259
249
|
contentSize: {},
|
|
@@ -275,16 +265,16 @@ var ie = ["aria-hidden"], ae = [
|
|
|
275
265
|
function k() {
|
|
276
266
|
v !== null && clearTimeout(v), v = setTimeout(() => {
|
|
277
267
|
v = null, c.value || (l.value = !1);
|
|
278
|
-
},
|
|
268
|
+
}, oe);
|
|
279
269
|
}
|
|
280
270
|
function A() {
|
|
281
271
|
l.value = !0, k();
|
|
282
272
|
}
|
|
283
273
|
function j() {
|
|
284
274
|
let e = t.scrollElement, n = i.value;
|
|
285
|
-
return !e || !n ? r :
|
|
275
|
+
return !e || !n ? r : X({
|
|
286
276
|
contentSize: e.scrollHeight,
|
|
287
|
-
minimumThumbSize:
|
|
277
|
+
minimumThumbSize: ae,
|
|
288
278
|
scrollPosition: e.scrollTop,
|
|
289
279
|
trackSize: n.clientHeight,
|
|
290
280
|
viewportSize: e.clientHeight
|
|
@@ -337,7 +327,7 @@ var ie = ["aria-hidden"], ae = [
|
|
|
337
327
|
}
|
|
338
328
|
function z(e) {
|
|
339
329
|
if (!E.value) return;
|
|
340
|
-
let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r -
|
|
330
|
+
let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r - Z : e.key === "ArrowDown" ? r + Z : e.key === "PageUp" ? r - n : e.key === "PageDown" ? r + n : e.key === "Home" ? 0 : e.key === "End" ? a.value.maximumScrollPosition : null;
|
|
341
331
|
i !== null && (e.preventDefault(), A(), P(i));
|
|
342
332
|
}
|
|
343
333
|
function B(e) {
|
|
@@ -383,15 +373,15 @@ var ie = ["aria-hidden"], ae = [
|
|
|
383
373
|
onPointerdown: I,
|
|
384
374
|
onPointermove: L,
|
|
385
375
|
onPointerup: R
|
|
386
|
-
}, null, 44,
|
|
376
|
+
}, null, 44, ie)], 42, re));
|
|
387
377
|
}
|
|
388
|
-
}),
|
|
378
|
+
}), ce = (e) => {
|
|
389
379
|
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
|
390
380
|
return !1;
|
|
391
|
-
},
|
|
392
|
-
let t =
|
|
381
|
+
}, le = (e) => e === "", ue = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), de = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), fe = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), pe = (e) => {
|
|
382
|
+
let t = fe(e);
|
|
393
383
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
394
|
-
},
|
|
384
|
+
}, me = {
|
|
395
385
|
xmlns: "http://www.w3.org/2000/svg",
|
|
396
386
|
width: 24,
|
|
397
387
|
height: 24,
|
|
@@ -401,27 +391,27 @@ var ie = ["aria-hidden"], ae = [
|
|
|
401
391
|
"stroke-width": 2,
|
|
402
392
|
"stroke-linecap": "round",
|
|
403
393
|
"stroke-linejoin": "round"
|
|
404
|
-
},
|
|
405
|
-
...
|
|
394
|
+
}, he = ({ name: e, iconNode: t, absoluteStrokeWidth: n, "absolute-stroke-width": r, strokeWidth: i, "stroke-width": a, size: o = me.width, color: s = me.stroke, ...c }, { slots: l }) => f("svg", {
|
|
395
|
+
...me,
|
|
406
396
|
...c,
|
|
407
397
|
width: o,
|
|
408
398
|
height: o,
|
|
409
399
|
stroke: s,
|
|
410
|
-
"stroke-width":
|
|
411
|
-
class:
|
|
412
|
-
...!l.default && !
|
|
413
|
-
}, [...t.map((e) => f(...e)), ...l.default ? [l.default()] : []]),
|
|
400
|
+
"stroke-width": le(n) || le(r) || n === !0 || r === !0 ? Number(i || a || me["stroke-width"]) * 24 / Number(o) : i || a || me["stroke-width"],
|
|
401
|
+
class: ue("lucide", c.class, ...e ? [`lucide-${de(pe(e))}-icon`, `lucide-${de(e)}`] : ["lucide-icon"]),
|
|
402
|
+
...!l.default && !ce(c) && { "aria-hidden": "true" }
|
|
403
|
+
}, [...t.map((e) => f(...e)), ...l.default ? [l.default()] : []]), ge = (e, t) => (n, { slots: r, attrs: i }) => f(he, {
|
|
414
404
|
...i,
|
|
415
405
|
...n,
|
|
416
406
|
iconNode: t,
|
|
417
407
|
name: e
|
|
418
|
-
}, r),
|
|
408
|
+
}, r), _e = ge("chevron-left", [["path", {
|
|
419
409
|
d: "m15 18-6-6 6-6",
|
|
420
410
|
key: "1wnfg3"
|
|
421
|
-
}]]),
|
|
411
|
+
}]]), ve = ge("chevron-right", [["path", {
|
|
422
412
|
d: "m9 18 6-6-6-6",
|
|
423
413
|
key: "mthhwq"
|
|
424
|
-
}]]),
|
|
414
|
+
}]]), ye = ge("pause", [["rect", {
|
|
425
415
|
x: "14",
|
|
426
416
|
y: "3",
|
|
427
417
|
width: "5",
|
|
@@ -435,10 +425,10 @@ var ie = ["aria-hidden"], ae = [
|
|
|
435
425
|
height: "18",
|
|
436
426
|
rx: "1",
|
|
437
427
|
key: "1wsw3u"
|
|
438
|
-
}]]),
|
|
428
|
+
}]]), be = ge("play", [["path", {
|
|
439
429
|
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",
|
|
440
430
|
key: "10ikf1"
|
|
441
|
-
}]]),
|
|
431
|
+
}]]), xe = ge("volume-2", [
|
|
442
432
|
["path", {
|
|
443
433
|
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",
|
|
444
434
|
key: "uqj9uw"
|
|
@@ -451,7 +441,7 @@ var ie = ["aria-hidden"], ae = [
|
|
|
451
441
|
d: "M19.364 18.364a9 9 0 0 0 0-12.728",
|
|
452
442
|
key: "ijwkga"
|
|
453
443
|
}]
|
|
454
|
-
]),
|
|
444
|
+
]), Se = ge("volume-x", [
|
|
455
445
|
["path", {
|
|
456
446
|
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",
|
|
457
447
|
key: "uqj9uw"
|
|
@@ -470,32 +460,32 @@ var ie = ["aria-hidden"], ae = [
|
|
|
470
460
|
y2: "15",
|
|
471
461
|
key: "5ykzw1"
|
|
472
462
|
}]
|
|
473
|
-
]),
|
|
463
|
+
]), Ce = {
|
|
474
464
|
401: "Authentication required",
|
|
475
465
|
403: "Access forbidden",
|
|
476
466
|
404: "Preview not found",
|
|
477
467
|
419: "Session expired",
|
|
478
468
|
500: "Server error"
|
|
479
469
|
};
|
|
480
|
-
function
|
|
470
|
+
function we(e) {
|
|
481
471
|
return e.match(/\/demo-errors\/(401|403|404|419|500)\//)?.[1] ?? "Error";
|
|
482
472
|
}
|
|
483
|
-
function
|
|
484
|
-
return we
|
|
473
|
+
function Te(e) {
|
|
474
|
+
return Ce[we(e)] ?? "Preview unavailable";
|
|
485
475
|
}
|
|
486
476
|
//#endregion
|
|
487
477
|
//#region src/core/mediaType.ts
|
|
488
|
-
var
|
|
489
|
-
function
|
|
478
|
+
var Ee = /\.(aac|flac|m4a|mp3|mp4|mov|ogg|opus|wav|webm)$/i;
|
|
479
|
+
function De(e) {
|
|
490
480
|
try {
|
|
491
|
-
return
|
|
481
|
+
return Ee.test(new URL(e).pathname);
|
|
492
482
|
} catch {
|
|
493
|
-
return
|
|
483
|
+
return Ee.test(e.split("?")[0] ?? e);
|
|
494
484
|
}
|
|
495
485
|
}
|
|
496
486
|
//#endregion
|
|
497
487
|
//#region src/components/CardRegion.vue
|
|
498
|
-
var
|
|
488
|
+
var Oe = /* @__PURE__ */ u({
|
|
499
489
|
__name: "CardRegion",
|
|
500
490
|
props: {
|
|
501
491
|
index: {},
|
|
@@ -542,18 +532,18 @@ var ke = /* @__PURE__ */ u({
|
|
|
542
532
|
"total"
|
|
543
533
|
]))], 38));
|
|
544
534
|
}
|
|
545
|
-
}),
|
|
535
|
+
}), ke = [
|
|
546
536
|
"max",
|
|
547
537
|
"value",
|
|
548
538
|
"aria-valuetext",
|
|
549
539
|
"disabled"
|
|
550
|
-
],
|
|
540
|
+
], Ae = {
|
|
551
541
|
key: 0,
|
|
552
542
|
class: "media-controls-row"
|
|
553
|
-
},
|
|
543
|
+
}, je = ["aria-label", "title"], Me = { class: "media-controls-audio" }, Ne = ["aria-label", "title"], Pe = ["value", "aria-valuetext"], Fe = {
|
|
554
544
|
class: "media-control-time",
|
|
555
545
|
"aria-live": "off"
|
|
556
|
-
},
|
|
546
|
+
}, Ie = /* @__PURE__ */ u({
|
|
557
547
|
__name: "MediaControls",
|
|
558
548
|
props: {
|
|
559
549
|
currentTime: {},
|
|
@@ -601,35 +591,35 @@ var ke = /* @__PURE__ */ u({
|
|
|
601
591
|
"aria-valuetext": `${u(p.value)} of ${u(f.value)}`,
|
|
602
592
|
disabled: f.value <= 0,
|
|
603
593
|
onInput: n[0] ||= (e) => c("seek", d(e))
|
|
604
|
-
}, null, 44,
|
|
594
|
+
}, null, 44, ke), e.layout === "reel" ? (y(), o("div", Ae, [
|
|
605
595
|
s("button", {
|
|
606
596
|
type: "button",
|
|
607
597
|
class: "media-control-button media-control-playback",
|
|
608
598
|
"aria-label": e.playing ? "Pause video" : "Play video",
|
|
609
599
|
title: e.playing ? "Pause" : "Play",
|
|
610
600
|
onClick: n[1] ||= (e) => c("togglePlayback")
|
|
611
|
-
}, [e.playing ? (y(), i(T(
|
|
601
|
+
}, [e.playing ? (y(), i(T(ye), {
|
|
612
602
|
key: 0,
|
|
613
603
|
size: 18,
|
|
614
604
|
fill: "currentColor"
|
|
615
|
-
})) : (y(), i(T(
|
|
605
|
+
})) : (y(), i(T(be), {
|
|
616
606
|
key: 1,
|
|
617
607
|
size: 18,
|
|
618
608
|
fill: "currentColor"
|
|
619
|
-
}))], 8,
|
|
620
|
-
s("div",
|
|
609
|
+
}))], 8, je),
|
|
610
|
+
s("div", Me, [s("button", {
|
|
621
611
|
type: "button",
|
|
622
612
|
class: "media-control-button",
|
|
623
613
|
"aria-label": e.muted ? "Unmute video" : "Mute video",
|
|
624
614
|
title: e.muted ? "Unmute" : "Mute",
|
|
625
615
|
onClick: n[2] ||= (e) => c("toggleMute")
|
|
626
|
-
}, [e.muted || e.volume === 0 ? (y(), i(T(
|
|
616
|
+
}, [e.muted || e.volume === 0 ? (y(), i(T(Se), {
|
|
627
617
|
key: 0,
|
|
628
618
|
size: 18
|
|
629
|
-
})) : (y(), i(T(
|
|
619
|
+
})) : (y(), i(T(xe), {
|
|
630
620
|
key: 1,
|
|
631
621
|
size: 18
|
|
632
|
-
}))], 8,
|
|
622
|
+
}))], 8, Ne), s("input", {
|
|
633
623
|
class: "media-control-range media-control-volume",
|
|
634
624
|
type: "range",
|
|
635
625
|
min: "0",
|
|
@@ -640,11 +630,11 @@ var ke = /* @__PURE__ */ u({
|
|
|
640
630
|
"aria-label": "Video volume",
|
|
641
631
|
"aria-valuetext": `${Math.round(e.volume * 100)} percent`,
|
|
642
632
|
onInput: n[3] ||= (e) => c("volumeChange", d(e))
|
|
643
|
-
}, null, 44,
|
|
644
|
-
s("output",
|
|
633
|
+
}, null, 44, Pe)]),
|
|
634
|
+
s("output", Fe, w(u(p.value)) + " / " + w(u(f.value)), 1)
|
|
645
635
|
])) : a("", !0)], 34));
|
|
646
636
|
}
|
|
647
|
-
}),
|
|
637
|
+
}), Le = [
|
|
648
638
|
"data-post-id",
|
|
649
639
|
"data-media-index",
|
|
650
640
|
"aria-hidden",
|
|
@@ -652,24 +642,24 @@ var ke = /* @__PURE__ */ u({
|
|
|
652
642
|
"inert",
|
|
653
643
|
"role",
|
|
654
644
|
"tabindex"
|
|
655
|
-
],
|
|
645
|
+
], Re = { class: "media-card-content" }, ze = ["data-media-direction"], Be = ["data-media-index"], Ve = {
|
|
656
646
|
key: 0,
|
|
657
647
|
"data-test": "media-loading",
|
|
658
648
|
class: "media-loading",
|
|
659
649
|
"aria-hidden": "true"
|
|
660
|
-
},
|
|
650
|
+
}, He = ["aria-label"], Ue = { class: "media-error-code" }, We = [
|
|
661
651
|
"src",
|
|
662
652
|
"width",
|
|
663
653
|
"height",
|
|
664
654
|
"loop",
|
|
665
655
|
"muted",
|
|
666
656
|
"preload"
|
|
667
|
-
],
|
|
657
|
+
], Ge = [
|
|
668
658
|
"src",
|
|
669
659
|
"width",
|
|
670
660
|
"height",
|
|
671
661
|
"fetchpriority"
|
|
672
|
-
],
|
|
662
|
+
], Ke = ["aria-label"], qe = ["aria-label"], Je = ["aria-label"], Ye = 40, Xe = 160, Ze = 24, Qe = /* @__PURE__ */ u({
|
|
673
663
|
__name: "MediaCard",
|
|
674
664
|
props: {
|
|
675
665
|
advanceOnMediaEnd: { type: Boolean },
|
|
@@ -706,25 +696,25 @@ var ke = /* @__PURE__ */ u({
|
|
|
706
696
|
function ee(e) {
|
|
707
697
|
return e.detail === 0 ? "keyboard" : "pointer";
|
|
708
698
|
}
|
|
709
|
-
function
|
|
699
|
+
function G(e, t) {
|
|
710
700
|
let n = S.value.length, r = (e + n) % n;
|
|
711
701
|
r !== E.value && (v.value = e < E.value ? "previous" : "next", b("mediaChange", r), t && t.detail > 0 && t.currentTarget?.blur());
|
|
712
702
|
}
|
|
713
|
-
function
|
|
703
|
+
function te(e, t, n) {
|
|
714
704
|
return t === 1 ? e * 16 : t === 2 ? e * n : e;
|
|
715
705
|
}
|
|
716
706
|
function ne() {
|
|
717
707
|
d = 0, f = !1, u !== null && clearTimeout(u), u = null;
|
|
718
708
|
}
|
|
719
709
|
function K() {
|
|
720
|
-
u !== null && clearTimeout(u), u = setTimeout(ne,
|
|
710
|
+
u !== null && clearTimeout(u), u = setTimeout(ne, Xe);
|
|
721
711
|
}
|
|
722
712
|
function q(e) {
|
|
723
713
|
if (S.value.length <= 1) return;
|
|
724
|
-
let t = e.currentTarget?.clientWidth || 1, n =
|
|
725
|
-
if (n === 0 || (e.preventDefault(), K(), f) || (d += n, Math.abs(d) <
|
|
714
|
+
let t = e.currentTarget?.clientWidth || 1, n = te(e.deltaX, e.deltaMode, t);
|
|
715
|
+
if (n === 0 || (e.preventDefault(), K(), f) || (d += n, Math.abs(d) < Ze)) return;
|
|
726
716
|
let r = Math.sign(d);
|
|
727
|
-
d = 0, f = !0,
|
|
717
|
+
d = 0, f = !0, G(E.value + r);
|
|
728
718
|
}
|
|
729
719
|
function J(e) {
|
|
730
720
|
let t = e.touches[0];
|
|
@@ -734,9 +724,9 @@ var ke = /* @__PURE__ */ u({
|
|
|
734
724
|
let t = e.changedTouches[0];
|
|
735
725
|
if (p === null || h === null || !t) return;
|
|
736
726
|
let n = p - t.clientX, r = h - t.clientY;
|
|
737
|
-
p = null, h = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) <
|
|
727
|
+
p = null, h = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) < Ye || G(E.value + Math.sign(n)));
|
|
738
728
|
}
|
|
739
|
-
let X = n(() =>
|
|
729
|
+
let X = n(() => De(P.value));
|
|
740
730
|
function re(e) {
|
|
741
731
|
c.layout === "reel" && (e.stopPropagation(), ie());
|
|
742
732
|
}
|
|
@@ -799,8 +789,8 @@ var ke = /* @__PURE__ */ u({
|
|
|
799
789
|
tabindex: e.interactive && !e.leaving && !W.value ? 0 : void 0,
|
|
800
790
|
onClick: r[11] ||= (t) => x(e.interactive && !W.value, ee(t)),
|
|
801
791
|
onKeydown: [r[12] ||= k((t) => x(e.interactive && !W.value, "keyboard"), ["enter"]), r[13] ||= k(A((t) => x(e.interactive && !W.value, "keyboard"), ["prevent"]), ["space"])]
|
|
802
|
-
}, [s("div",
|
|
803
|
-
e.cardHeader ? (y(), i(
|
|
792
|
+
}, [s("div", Re, [
|
|
793
|
+
e.cardHeader ? (y(), i(Oe, {
|
|
804
794
|
key: 0,
|
|
805
795
|
index: e.index,
|
|
806
796
|
item: e.item,
|
|
@@ -835,13 +825,13 @@ var ke = /* @__PURE__ */ u({
|
|
|
835
825
|
key: `${e.item.postId}:${E.value}:${e.mediaSource ?? "preview"}`,
|
|
836
826
|
class: "media-card-frame",
|
|
837
827
|
"data-media-index": E.value
|
|
838
|
-
}, [e.previewState === "loading" ? (y(), o("div",
|
|
828
|
+
}, [e.previewState === "loading" ? (y(), o("div", Ve, [...r[14] ||= [s("span", { class: "media-loading-shimmer" }, null, -1)]])) : e.previewState === "error" ? (y(), o("div", {
|
|
839
829
|
key: 1,
|
|
840
830
|
"data-test": "media-error",
|
|
841
831
|
class: "media-error",
|
|
842
832
|
role: "img",
|
|
843
|
-
"aria-label": `${T(
|
|
844
|
-
}, [s("strong",
|
|
833
|
+
"aria-label": `${T(we)(P.value)} ${T(Te)(P.value)}`
|
|
834
|
+
}, [s("strong", Ue, w(T(we)(P.value)), 1), s("span", null, w(T(Te)(P.value)), 1)], 8, He)) : a("", !0), X.value ? (y(), o("video", {
|
|
845
835
|
key: 2,
|
|
846
836
|
ref_key: "videoElement",
|
|
847
837
|
ref: L,
|
|
@@ -866,7 +856,7 @@ var ke = /* @__PURE__ */ u({
|
|
|
866
856
|
onEnded: se,
|
|
867
857
|
onClick: re,
|
|
868
858
|
onError: r[2] ||= (e) => n.$emit("error", E.value)
|
|
869
|
-
}, null, 42,
|
|
859
|
+
}, null, 42, We)) : (y(), o("img", {
|
|
870
860
|
key: 3,
|
|
871
861
|
class: m(["media-preview", { "media-preview--ready": e.previewState === "ready" }]),
|
|
872
862
|
src: P.value,
|
|
@@ -878,10 +868,10 @@ var ke = /* @__PURE__ */ u({
|
|
|
878
868
|
loading: "eager",
|
|
879
869
|
onLoad: r[3] ||= (e) => n.$emit("ready", E.value),
|
|
880
870
|
onError: r[4] ||= (e) => n.$emit("error", E.value)
|
|
881
|
-
}, null, 42,
|
|
871
|
+
}, null, 42, Ge))], 8, Be))]),
|
|
882
872
|
_: 1
|
|
883
873
|
}, 8, ["name"]),
|
|
884
|
-
X.value && e.previewState === "ready" ? (y(), i(
|
|
874
|
+
X.value && e.previewState === "ready" ? (y(), i(Ie, {
|
|
885
875
|
key: 0,
|
|
886
876
|
"current-time": R.value,
|
|
887
877
|
duration: z.value,
|
|
@@ -909,15 +899,15 @@ var ke = /* @__PURE__ */ u({
|
|
|
909
899
|
type: "button",
|
|
910
900
|
class: "media-carousel-control media-carousel-control--previous",
|
|
911
901
|
"aria-label": `Previous media for post ${e.item.postId}`,
|
|
912
|
-
onClick: r[5] ||= A((e) =>
|
|
902
|
+
onClick: r[5] ||= A((e) => G(E.value - 1, e), ["stop"]),
|
|
913
903
|
onKeydown: r[6] ||= A(() => {}, ["stop"])
|
|
914
|
-
}, [l(T(
|
|
904
|
+
}, [l(T(_e), { size: 20 })], 40, Ke), s("button", {
|
|
915
905
|
type: "button",
|
|
916
906
|
class: "media-carousel-control media-carousel-control--next",
|
|
917
907
|
"aria-label": `Next media for post ${e.item.postId}`,
|
|
918
|
-
onClick: r[7] ||= A((e) =>
|
|
908
|
+
onClick: r[7] ||= A((e) => G(E.value + 1, e), ["stop"]),
|
|
919
909
|
onKeydown: r[8] ||= A(() => {}, ["stop"])
|
|
920
|
-
}, [l(T(
|
|
910
|
+
}, [l(T(ve), { size: 20 })], 40, qe)], 2)) : a("", !0),
|
|
921
911
|
W.value ? (y(), o("button", {
|
|
922
912
|
key: 2,
|
|
923
913
|
class: "media-card-activator",
|
|
@@ -925,9 +915,9 @@ var ke = /* @__PURE__ */ u({
|
|
|
925
915
|
"aria-label": `Open post ${e.item.postId}`,
|
|
926
916
|
onClick: r[9] ||= A((e) => n.$emit("activate", ee(e)), ["stop"]),
|
|
927
917
|
onKeydown: r[10] ||= A(() => {}, ["stop"])
|
|
928
|
-
}, null, 40,
|
|
929
|
-
], 42,
|
|
930
|
-
e.cardFooter ? (y(), i(
|
|
918
|
+
}, null, 40, Je)) : a("", !0)
|
|
919
|
+
], 42, ze),
|
|
920
|
+
e.cardFooter ? (y(), i(Oe, {
|
|
931
921
|
key: 1,
|
|
932
922
|
index: e.index,
|
|
933
923
|
item: e.item,
|
|
@@ -950,9 +940,9 @@ var ke = /* @__PURE__ */ u({
|
|
|
950
940
|
"style",
|
|
951
941
|
"total"
|
|
952
942
|
])) : a("", !0)
|
|
953
|
-
])], 46,
|
|
943
|
+
])], 46, Le));
|
|
954
944
|
}
|
|
955
|
-
}),
|
|
945
|
+
}), $e = { class: "masonry-feed-shell" }, et = ["aria-hidden", "inert"], tt = 240, nt = 6, rt = 12, it = 800, at = 1.5, ot = /* @__PURE__ */ u({
|
|
956
946
|
__name: "MasonryFeed",
|
|
957
947
|
props: {
|
|
958
948
|
enteringPostIds: {},
|
|
@@ -986,36 +976,36 @@ var ke = /* @__PURE__ */ u({
|
|
|
986
976
|
"retryEnd"
|
|
987
977
|
],
|
|
988
978
|
setup(t, { expose: r, emit: a }) {
|
|
989
|
-
let c = t, u = a, d = C(null), f = `vibe-masonry-${E()}`, p = C(null), h = C(0), v = C(
|
|
979
|
+
let c = t, u = a, d = C(null), f = `vibe-masonry-${E()}`, p = C(null), h = C(0), v = C(nt), b = C(0), S = C(0), w = C(0), O = null, k = null, A = null, j = n(() => J(c.items, h.value, {
|
|
990
980
|
additionalHeight: (c.cardHeader?.height ?? 0) + (c.cardFooter?.height ?? 0),
|
|
991
981
|
gap: v.value,
|
|
992
|
-
minColumnWidth:
|
|
982
|
+
minColumnWidth: tt
|
|
993
983
|
})), M = n(() => {
|
|
994
984
|
let e = j.value;
|
|
995
985
|
if (c.leavingPostIds.size === 0) return e;
|
|
996
|
-
let t = c.items.filter((e) => !c.leavingPostIds.has(e.postId)), n =
|
|
986
|
+
let t = c.items.filter((e) => !c.leavingPostIds.has(e.postId)), n = J(t, h.value, {
|
|
997
987
|
additionalHeight: (c.cardHeader?.height ?? 0) + (c.cardFooter?.height ?? 0),
|
|
998
988
|
gap: v.value,
|
|
999
|
-
minColumnWidth:
|
|
989
|
+
minColumnWidth: tt
|
|
1000
990
|
}), r = new Map(t.map((e, t) => [e.postId, n.items[t]]));
|
|
1001
991
|
return {
|
|
1002
992
|
...n,
|
|
1003
993
|
items: c.items.map((t, n) => c.leavingPostIds.has(t.postId) ? e.items[n] : r.get(t.postId) ?? e.items[n])
|
|
1004
994
|
};
|
|
1005
995
|
}), N = n(() => ({ height: `${c.leavingPostIds.size === 0 ? M.value.height : j.value.height}px` })), F = n(() => {
|
|
1006
|
-
let e = Math.max(
|
|
996
|
+
let e = Math.max(it, S.value * at), t = {
|
|
1007
997
|
scrollTop: b.value - w.value,
|
|
1008
998
|
viewportHeight: S.value
|
|
1009
|
-
}, n =
|
|
999
|
+
}, n = q(M.value.items, {
|
|
1010
1000
|
...t,
|
|
1011
1001
|
overscan: e
|
|
1012
|
-
}), r = c.leavingPostIds.size === 0 ? [] :
|
|
1002
|
+
}), r = c.leavingPostIds.size === 0 ? [] : q(j.value.items, {
|
|
1013
1003
|
...t,
|
|
1014
1004
|
overscan: e
|
|
1015
|
-
}), i = [...new Set([...n, ...r])].sort((e, t) => e - t), a =
|
|
1005
|
+
}), i = [...new Set([...n, ...r])].sort((e, t) => e - t), a = q(M.value.items, {
|
|
1016
1006
|
...t,
|
|
1017
1007
|
overscan: 0
|
|
1018
|
-
}), o = c.leavingPostIds.size === 0 ? [] :
|
|
1008
|
+
}), o = c.leavingPostIds.size === 0 ? [] : q(j.value.items, {
|
|
1019
1009
|
...t,
|
|
1020
1010
|
overscan: 0
|
|
1021
1011
|
}), s = new Set([...a, ...o]);
|
|
@@ -1031,7 +1021,7 @@ var ke = /* @__PURE__ */ u({
|
|
|
1031
1021
|
function I(e) {
|
|
1032
1022
|
let t = M.value.items[e], n = c.items[e]?.postId;
|
|
1033
1023
|
if (!t) return {};
|
|
1034
|
-
let r = n !== void 0 && c.enteringPostIds.has(n), i = n !== void 0 && c.leavingPostIds.has(n), a = r || i ?
|
|
1024
|
+
let r = n !== void 0 && c.enteringPostIds.has(n), i = n !== void 0 && c.leavingPostIds.has(n), a = r || i ? K({
|
|
1035
1025
|
containerHeight: j.value.height,
|
|
1036
1026
|
gap: v.value
|
|
1037
1027
|
}) : 0, o = n === void 0 ? 0 : i ? c.removalDelays.get(n) ?? 0 : r ? c.entryDelays.get(n) ?? 0 : 0;
|
|
@@ -1051,7 +1041,7 @@ var ke = /* @__PURE__ */ u({
|
|
|
1051
1041
|
}
|
|
1052
1042
|
function R(e) {
|
|
1053
1043
|
let t = e.ownerDocument.documentElement.clientWidth;
|
|
1054
|
-
h.value = e.clientWidth, v.value = Math.min(
|
|
1044
|
+
h.value = e.clientWidth, v.value = Math.min(rt, Math.max(nt, t * .0075)), L();
|
|
1055
1045
|
}
|
|
1056
1046
|
function z(e) {
|
|
1057
1047
|
let t = e.currentTarget;
|
|
@@ -1078,7 +1068,7 @@ var ke = /* @__PURE__ */ u({
|
|
|
1078
1068
|
}), r({
|
|
1079
1069
|
getScrollElement: V,
|
|
1080
1070
|
loadIfNearBottom: B
|
|
1081
|
-
}), (n, r) => (y(), o("div",
|
|
1071
|
+
}), (n, r) => (y(), o("div", $e, [s("main", {
|
|
1082
1072
|
id: f,
|
|
1083
1073
|
ref_key: "galleryElement",
|
|
1084
1074
|
ref: d,
|
|
@@ -1093,7 +1083,7 @@ var ke = /* @__PURE__ */ u({
|
|
|
1093
1083
|
class: m(["masonry", { "masonry--ready": h.value > 0 }]),
|
|
1094
1084
|
style: g(N.value),
|
|
1095
1085
|
"aria-label": "Media gallery"
|
|
1096
|
-
}, [(y(!0), o(e, null, x(F.value, ({ fetchPriority: e, item: n, index: r }) => (y(), i(
|
|
1086
|
+
}, [(y(!0), o(e, null, x(F.value, ({ fetchPriority: e, item: n, index: r }) => (y(), i(Qe, {
|
|
1097
1087
|
key: n.postId,
|
|
1098
1088
|
class: "masonry-item",
|
|
1099
1089
|
entering: t.enteringPostIds.has(n.postId),
|
|
@@ -1133,13 +1123,12 @@ var ke = /* @__PURE__ */ u({
|
|
|
1133
1123
|
"onMediaChange",
|
|
1134
1124
|
"onReady",
|
|
1135
1125
|
"onError"
|
|
1136
|
-
]))), 128))], 6), l(
|
|
1126
|
+
]))), 128))], 6), l(H, {
|
|
1137
1127
|
actions: t.feedFooterActions,
|
|
1138
1128
|
"can-retry-end": t.canRetryEnd,
|
|
1139
1129
|
"feed-footer": t.feedFooter,
|
|
1140
1130
|
"has-error": t.nextPageError,
|
|
1141
1131
|
"has-next": t.hasNext,
|
|
1142
|
-
"infinite-scroll": t.infiniteScroll,
|
|
1143
1132
|
"is-loading": t.isLoadingMore,
|
|
1144
1133
|
"load-more-locked": t.loadMoreLocked,
|
|
1145
1134
|
state: t.state,
|
|
@@ -1151,11 +1140,10 @@ var ke = /* @__PURE__ */ u({
|
|
|
1151
1140
|
"feed-footer",
|
|
1152
1141
|
"has-error",
|
|
1153
1142
|
"has-next",
|
|
1154
|
-
"infinite-scroll",
|
|
1155
1143
|
"is-loading",
|
|
1156
1144
|
"load-more-locked",
|
|
1157
1145
|
"state"
|
|
1158
|
-
])], 42,
|
|
1146
|
+
])], 42, et), l(se, {
|
|
1159
1147
|
"content-size": M.value.height,
|
|
1160
1148
|
"controls-id": f,
|
|
1161
1149
|
"scroll-element": d.value,
|
|
@@ -1166,7 +1154,7 @@ var ke = /* @__PURE__ */ u({
|
|
|
1166
1154
|
"suspended"
|
|
1167
1155
|
])]));
|
|
1168
1156
|
}
|
|
1169
|
-
}),
|
|
1157
|
+
}), st = ["aria-label"], ct = /* @__PURE__ */ u({
|
|
1170
1158
|
__name: "ReelAutoAdvanceProgress",
|
|
1171
1159
|
props: {
|
|
1172
1160
|
durationMs: {},
|
|
@@ -1184,9 +1172,9 @@ var ke = /* @__PURE__ */ u({
|
|
|
1184
1172
|
class: "reel-auto-advance-progress",
|
|
1185
1173
|
style: g(a.value),
|
|
1186
1174
|
onAnimationend: n[0] ||= (e) => i("complete")
|
|
1187
|
-
}, null, 36)], 8,
|
|
1175
|
+
}, null, 36)], 8, st));
|
|
1188
1176
|
}
|
|
1189
|
-
}),
|
|
1177
|
+
}), lt = ["data-active-post-id", "data-active-media-index"], ut = 2, dt = /* @__PURE__ */ u({
|
|
1190
1178
|
__name: "ReelFeed",
|
|
1191
1179
|
props: {
|
|
1192
1180
|
initialPostId: {},
|
|
@@ -1219,7 +1207,7 @@ var ke = /* @__PURE__ */ u({
|
|
|
1219
1207
|
],
|
|
1220
1208
|
setup(t, { expose: r, emit: c }) {
|
|
1221
1209
|
let u = t, d = c, f = C(null), h = u.initialPostId === null || u.initialPostId === void 0 ? -1 : u.items.findIndex((e) => e.postId === u.initialPostId), b = C(Math.max(0, h)), S = C(!1), w = 0, E = null, O = null, k = null, A = n(() => ({ gridTemplateRows: `repeat(${u.items.length}, 100cqh)` })), M = n(() => {
|
|
1222
|
-
let e = Math.max(0, b.value -
|
|
1210
|
+
let e = Math.max(0, b.value - ut), t = Math.min(u.items.length - 1, b.value + ut);
|
|
1223
1211
|
return u.items.slice(e, t + 1).map((t, n) => ({
|
|
1224
1212
|
fetchPriority: e + n === b.value ? "high" : "low",
|
|
1225
1213
|
index: e + n,
|
|
@@ -1236,7 +1224,7 @@ var ke = /* @__PURE__ */ u({
|
|
|
1236
1224
|
if (!e) return "";
|
|
1237
1225
|
let t = N(e, L.value);
|
|
1238
1226
|
return u.mediaSource === "original" ? t.src : t.preview.src;
|
|
1239
|
-
}), B = n(() => R.value === "ready" &&
|
|
1227
|
+
}), B = n(() => R.value === "ready" && De(z.value)), V = n(() => [
|
|
1240
1228
|
F.value,
|
|
1241
1229
|
L.value,
|
|
1242
1230
|
u.items.length,
|
|
@@ -1244,7 +1232,7 @@ var ke = /* @__PURE__ */ u({
|
|
|
1244
1232
|
u.reelAutoAdvance.enabled,
|
|
1245
1233
|
u.reelAutoAdvance.includePostItems,
|
|
1246
1234
|
u.reelAutoAdvance.intervalMs
|
|
1247
|
-
].join(":")),
|
|
1235
|
+
].join(":")), U = n(() => {
|
|
1248
1236
|
let e = I.value, t = !!(e && u.reelAutoAdvance.includePostItems && L.value < j(e).length - 1), n = u.reelAutoAdvance.intervalMs / 1e3;
|
|
1249
1237
|
return `Auto advance to the next ${t ? "post item" : "post"} in ${n}s`;
|
|
1250
1238
|
}), W = n(() => u.reelAutoAdvance.enabled && I.value !== void 0 && R.value !== "loading" && !B.value);
|
|
@@ -1353,7 +1341,7 @@ var ke = /* @__PURE__ */ u({
|
|
|
1353
1341
|
}]),
|
|
1354
1342
|
"data-layout-mode": "reel"
|
|
1355
1343
|
}, [
|
|
1356
|
-
t.cardHeader && I.value ? (y(), i(
|
|
1344
|
+
t.cardHeader && I.value ? (y(), i(Oe, {
|
|
1357
1345
|
key: 0,
|
|
1358
1346
|
index: b.value,
|
|
1359
1347
|
item: I.value,
|
|
@@ -1386,7 +1374,7 @@ var ke = /* @__PURE__ */ u({
|
|
|
1386
1374
|
class: "reel-track",
|
|
1387
1375
|
style: g(A.value),
|
|
1388
1376
|
"aria-label": "Media gallery"
|
|
1389
|
-
}, [(y(!0), o(e, null, x(M.value, ({ fetchPriority: e, item: n, index: r }) => (y(), i(
|
|
1377
|
+
}, [(y(!0), o(e, null, x(M.value, ({ fetchPriority: e, item: n, index: r }) => (y(), i(Qe, {
|
|
1390
1378
|
key: n.postId,
|
|
1391
1379
|
"advance-on-media-end": u.reelAutoAdvance.enabled && r === b.value,
|
|
1392
1380
|
class: "reel-item",
|
|
@@ -1422,13 +1410,12 @@ var ke = /* @__PURE__ */ u({
|
|
|
1422
1410
|
"onEnded",
|
|
1423
1411
|
"onReady",
|
|
1424
1412
|
"onError"
|
|
1425
|
-
]))), 128))], 4), l(
|
|
1413
|
+
]))), 128))], 4), l(H, {
|
|
1426
1414
|
actions: t.feedFooterActions,
|
|
1427
1415
|
"can-retry-end": t.canRetryEnd,
|
|
1428
1416
|
"feed-footer": t.feedFooter,
|
|
1429
1417
|
"has-error": t.nextPageError,
|
|
1430
1418
|
"has-next": t.hasNext,
|
|
1431
|
-
"infinite-scroll": t.infiniteScroll,
|
|
1432
1419
|
"is-loading": t.isLoadingMore,
|
|
1433
1420
|
"load-more-locked": t.loadMoreLocked,
|
|
1434
1421
|
state: t.state,
|
|
@@ -1440,12 +1427,11 @@ var ke = /* @__PURE__ */ u({
|
|
|
1440
1427
|
"feed-footer",
|
|
1441
1428
|
"has-error",
|
|
1442
1429
|
"has-next",
|
|
1443
|
-
"infinite-scroll",
|
|
1444
1430
|
"is-loading",
|
|
1445
1431
|
"load-more-locked",
|
|
1446
1432
|
"state"
|
|
1447
|
-
])], 40,
|
|
1448
|
-
t.cardFooter && I.value ? (y(), i(
|
|
1433
|
+
])], 40, lt),
|
|
1434
|
+
t.cardFooter && I.value ? (y(), i(Oe, {
|
|
1449
1435
|
key: 1,
|
|
1450
1436
|
index: b.value,
|
|
1451
1437
|
item: I.value,
|
|
@@ -1467,24 +1453,24 @@ var ke = /* @__PURE__ */ u({
|
|
|
1467
1453
|
"style",
|
|
1468
1454
|
"total"
|
|
1469
1455
|
])) : a("", !0),
|
|
1470
|
-
W.value ? (y(), i(
|
|
1456
|
+
W.value ? (y(), i(ct, {
|
|
1471
1457
|
key: V.value,
|
|
1472
1458
|
"duration-ms": t.reelAutoAdvance.intervalMs,
|
|
1473
|
-
label:
|
|
1459
|
+
label: U.value,
|
|
1474
1460
|
onComplete: oe
|
|
1475
1461
|
}, null, 8, ["duration-ms", "label"])) : a("", !0)
|
|
1476
1462
|
], 2));
|
|
1477
1463
|
}
|
|
1478
|
-
}),
|
|
1464
|
+
}), ft = ["data-info-sheet-open", "data-info-sheet-mode"], pt = ["aria-hidden", "inert"], mt = {
|
|
1479
1465
|
key: 0,
|
|
1480
1466
|
class: "reel-info-sheet-layer",
|
|
1481
1467
|
"data-test": "reel-info-sheet"
|
|
1482
|
-
},
|
|
1468
|
+
}, ht = [
|
|
1483
1469
|
"role",
|
|
1484
1470
|
"aria-modal",
|
|
1485
1471
|
"tabindex",
|
|
1486
1472
|
"data-active-post-id"
|
|
1487
|
-
],
|
|
1473
|
+
], gt = /* @__PURE__ */ u({
|
|
1488
1474
|
__name: "ReelLayout",
|
|
1489
1475
|
props: {
|
|
1490
1476
|
infoSheet: {},
|
|
@@ -1590,7 +1576,7 @@ var ke = /* @__PURE__ */ u({
|
|
|
1590
1576
|
class: "reel-layout-main",
|
|
1591
1577
|
"aria-hidden": e.infoSheetOverlay && E.value || void 0,
|
|
1592
1578
|
inert: e.infoSheetOverlay && E.value || void 0
|
|
1593
|
-
}, [l(
|
|
1579
|
+
}, [l(dt, {
|
|
1594
1580
|
ref_key: "reelFeed",
|
|
1595
1581
|
ref: g,
|
|
1596
1582
|
"can-retry-end": e.canRetryEnd,
|
|
@@ -1638,8 +1624,8 @@ var ke = /* @__PURE__ */ u({
|
|
|
1638
1624
|
"reel-auto-advance",
|
|
1639
1625
|
"state",
|
|
1640
1626
|
"total"
|
|
1641
|
-
])], 8,
|
|
1642
|
-
default: O(() => [E.value && e.infoSheet && k.value ? (y(), o("div",
|
|
1627
|
+
])], 8, pt), l(t, { name: "vibe-info-sheet" }, {
|
|
1628
|
+
default: O(() => [E.value && e.infoSheet && k.value ? (y(), o("div", mt, [s("aside", {
|
|
1643
1629
|
ref_key: "sheetElement",
|
|
1644
1630
|
ref: v,
|
|
1645
1631
|
class: "reel-info-sheet",
|
|
@@ -1648,11 +1634,11 @@ var ke = /* @__PURE__ */ u({
|
|
|
1648
1634
|
"aria-modal": e.infoSheetOverlay ? "true" : void 0,
|
|
1649
1635
|
tabindex: e.infoSheetOverlay ? -1 : void 0,
|
|
1650
1636
|
"data-active-post-id": w.value?.postId
|
|
1651
|
-
}, [(y(), i(S(e.infoSheet.component), h(d(k.value)), null, 16))], 8,
|
|
1637
|
+
}, [(y(), i(S(e.infoSheet.component), h(d(k.value)), null, 16))], 8, ht)])) : a("", !0)]),
|
|
1652
1638
|
_: 1
|
|
1653
|
-
})], 10,
|
|
1639
|
+
})], 10, ft));
|
|
1654
1640
|
}
|
|
1655
|
-
}),
|
|
1641
|
+
}), _t = 35, vt = 420, yt = /* @__PURE__ */ u({
|
|
1656
1642
|
__name: "VibeSurface",
|
|
1657
1643
|
props: {
|
|
1658
1644
|
canRetryEnd: { type: Boolean },
|
|
@@ -1688,28 +1674,28 @@ var ke = /* @__PURE__ */ u({
|
|
|
1688
1674
|
let r = P(e, t);
|
|
1689
1675
|
j.value.get(r) !== n && (j.value = new Map(j.value).set(r, n));
|
|
1690
1676
|
}
|
|
1691
|
-
function
|
|
1677
|
+
function G(e, t, n) {
|
|
1692
1678
|
let r = P(e, t);
|
|
1693
1679
|
N.value.get(r) !== n && (N.value = new Map(N.value).set(r, n));
|
|
1694
1680
|
}
|
|
1695
|
-
function
|
|
1681
|
+
function te(e, t) {
|
|
1696
1682
|
W(e, t, "error");
|
|
1697
1683
|
}
|
|
1698
1684
|
function ne(e, t) {
|
|
1699
1685
|
W(e, t, "ready");
|
|
1700
1686
|
}
|
|
1701
1687
|
function K(e, t) {
|
|
1702
|
-
|
|
1688
|
+
G(e, t, "error");
|
|
1703
1689
|
}
|
|
1704
1690
|
function q(e, t) {
|
|
1705
|
-
|
|
1691
|
+
G(e, t, "ready");
|
|
1706
1692
|
}
|
|
1707
1693
|
function J(e, t) {
|
|
1708
1694
|
if (u.state.reelMediaSource === "original") {
|
|
1709
1695
|
K(e, t);
|
|
1710
1696
|
return;
|
|
1711
1697
|
}
|
|
1712
|
-
|
|
1698
|
+
te(e, t);
|
|
1713
1699
|
}
|
|
1714
1700
|
function Y(e, t) {
|
|
1715
1701
|
if (u.state.reelMediaSource === "original") {
|
|
@@ -1749,8 +1735,8 @@ var ke = /* @__PURE__ */ u({
|
|
|
1749
1735
|
if (n.length === 0) return 0;
|
|
1750
1736
|
let r = new Map(k.value);
|
|
1751
1737
|
return n.forEach((e, t) => {
|
|
1752
|
-
r.set(e, t *
|
|
1753
|
-
}), w.value = new Set([...w.value].filter((e) => !n.includes(e))), E.value = new Set([...E.value, ...t]), k.value = r,
|
|
1738
|
+
r.set(e, t * _t);
|
|
1739
|
+
}), w.value = new Set([...w.value].filter((e) => !n.includes(e))), E.value = new Set([...E.value, ...t]), k.value = r, vt + (n.length - 1) * _t;
|
|
1754
1740
|
}
|
|
1755
1741
|
function le(e, t) {
|
|
1756
1742
|
let n = se(e), r = n?.querySelector(".media-card-activator") ?? n;
|
|
@@ -1806,7 +1792,7 @@ var ke = /* @__PURE__ */ u({
|
|
|
1806
1792
|
let t = T.value.get(e);
|
|
1807
1793
|
t !== void 0 && r.set(e, t);
|
|
1808
1794
|
}), t.forEach((e, t) => {
|
|
1809
|
-
r.set(e, t *
|
|
1795
|
+
r.set(e, t * _t);
|
|
1810
1796
|
}), T.value = r, w.value = new Set([...w.value, ...t]), U();
|
|
1811
1797
|
}, { flush: "sync" }), v(() => window.addEventListener("keydown", pe)), _(() => {
|
|
1812
1798
|
window.removeEventListener("keydown", pe), z !== null && cancelAnimationFrame(z);
|
|
@@ -1820,7 +1806,7 @@ var ke = /* @__PURE__ */ u({
|
|
|
1820
1806
|
ref_key: "surfaceElement",
|
|
1821
1807
|
ref: b,
|
|
1822
1808
|
class: "vibe-surface"
|
|
1823
|
-
}, [r.state.error || r.state.isLoading || r.state.items.length === 0 ? (y(), i(
|
|
1809
|
+
}, [r.state.error || r.state.isLoading || r.state.items.length === 0 ? (y(), i(ee, {
|
|
1824
1810
|
key: 0,
|
|
1825
1811
|
actions: r.feedFooterActions,
|
|
1826
1812
|
"can-retry-end": r.canRetryEnd,
|
|
@@ -1833,7 +1819,7 @@ var ke = /* @__PURE__ */ u({
|
|
|
1833
1819
|
"can-retry-end",
|
|
1834
1820
|
"feed-footer",
|
|
1835
1821
|
"state"
|
|
1836
|
-
])) : r.state.layout === "reel" ? (y(), i(
|
|
1822
|
+
])) : r.state.layout === "reel" ? (y(), i(gt, {
|
|
1837
1823
|
key: 1,
|
|
1838
1824
|
ref_key: "reelRenderer",
|
|
1839
1825
|
ref: m,
|
|
@@ -1890,7 +1876,7 @@ var ke = /* @__PURE__ */ u({
|
|
|
1890
1876
|
"reel-auto-advance",
|
|
1891
1877
|
"state",
|
|
1892
1878
|
"total"
|
|
1893
|
-
])) : (y(), o(e, { key: 2 }, [l(
|
|
1879
|
+
])) : (y(), o(e, { key: 2 }, [l(ot, {
|
|
1894
1880
|
ref_key: "masonryRenderer",
|
|
1895
1881
|
ref: f,
|
|
1896
1882
|
"can-retry-end": r.canRetryEnd,
|
|
@@ -1915,7 +1901,7 @@ var ke = /* @__PURE__ */ u({
|
|
|
1915
1901
|
state: I.value,
|
|
1916
1902
|
total: r.state.total,
|
|
1917
1903
|
onActivate: oe,
|
|
1918
|
-
onError:
|
|
1904
|
+
onError: te,
|
|
1919
1905
|
onLoadMore: s[6] ||= (e) => d("loadMore"),
|
|
1920
1906
|
onMediaChange: X,
|
|
1921
1907
|
onReady: ne,
|
|
@@ -1956,7 +1942,7 @@ var ke = /* @__PURE__ */ u({
|
|
|
1956
1942
|
"aria-modal": "true",
|
|
1957
1943
|
tabindex: "-1",
|
|
1958
1944
|
style: g(x.value)
|
|
1959
|
-
}, [l(
|
|
1945
|
+
}, [l(gt, {
|
|
1960
1946
|
ref_key: "reelRenderer",
|
|
1961
1947
|
ref: m,
|
|
1962
1948
|
"can-retry-end": r.canRetryEnd,
|
|
@@ -2018,7 +2004,7 @@ var ke = /* @__PURE__ */ u({
|
|
|
2018
2004
|
});
|
|
2019
2005
|
//#endregion
|
|
2020
2006
|
//#region src/core/page.ts
|
|
2021
|
-
function
|
|
2007
|
+
function bt(e) {
|
|
2022
2008
|
if (!e || typeof e != "object" || !Array.isArray(e.items)) throw TypeError("Vibe loadPage must resolve to a page with an items array.");
|
|
2023
2009
|
if (e.next !== null && typeof e.next != "string" && typeof e.next != "number") throw TypeError("Vibe page next must be a string, number, or null.");
|
|
2024
2010
|
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.");
|
|
@@ -2030,32 +2016,32 @@ function Q(e, t) {
|
|
|
2030
2016
|
}
|
|
2031
2017
|
//#endregion
|
|
2032
2018
|
//#region src/core/requestDelay.ts
|
|
2033
|
-
var
|
|
2019
|
+
var xt = 2e3, St = 1e4, Ct = 250, wt = {
|
|
2034
2020
|
delayRemainingMs: null,
|
|
2035
2021
|
nextRequestAt: null
|
|
2036
2022
|
};
|
|
2037
|
-
function
|
|
2023
|
+
function Tt(e, t) {
|
|
2038
2024
|
return e === void 0 ? t : Math.floor(e);
|
|
2039
2025
|
}
|
|
2040
|
-
function
|
|
2026
|
+
function Et(e, t) {
|
|
2041
2027
|
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.`);
|
|
2042
2028
|
}
|
|
2043
|
-
function
|
|
2044
|
-
let n =
|
|
2029
|
+
function Dt(e, t = {}) {
|
|
2030
|
+
let n = Tt(t.delayStepMs, xt), r = Tt(t.delayMaxMs, St);
|
|
2045
2031
|
return Math.min(Math.max(0, e) * n, r);
|
|
2046
2032
|
}
|
|
2047
2033
|
function $(e) {
|
|
2048
|
-
if (e == null || !Number.isFinite(e)) return { ...
|
|
2034
|
+
if (e == null || !Number.isFinite(e)) return { ...wt };
|
|
2049
2035
|
let t = Math.max(0, Math.floor(e - Date.now()));
|
|
2050
2036
|
return t > 0 ? {
|
|
2051
2037
|
delayRemainingMs: t,
|
|
2052
2038
|
nextRequestAt: e
|
|
2053
|
-
} : { ...
|
|
2039
|
+
} : { ...wt };
|
|
2054
2040
|
}
|
|
2055
|
-
async function
|
|
2041
|
+
async function Ot({ delayMs: e, onChange: t, signal: n }) {
|
|
2056
2042
|
if (n.aborted) throw new DOMException("Aborted", "AbortError");
|
|
2057
2043
|
if (e <= 0) {
|
|
2058
|
-
t({ ...
|
|
2044
|
+
t({ ...wt });
|
|
2059
2045
|
return;
|
|
2060
2046
|
}
|
|
2061
2047
|
let r = Date.now() + e;
|
|
@@ -2063,9 +2049,9 @@ async function kt({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2063
2049
|
delayRemainingMs: e,
|
|
2064
2050
|
nextRequestAt: r
|
|
2065
2051
|
}), await new Promise((i, a) => {
|
|
2066
|
-
let o = !1, s = setInterval(f,
|
|
2052
|
+
let o = !1, s = setInterval(f, Ct), c = setTimeout(() => u(), e);
|
|
2067
2053
|
function l() {
|
|
2068
|
-
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...
|
|
2054
|
+
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...wt });
|
|
2069
2055
|
}
|
|
2070
2056
|
function u(e) {
|
|
2071
2057
|
o || (o = !0, l(), e ? a(e) : i());
|
|
@@ -2080,13 +2066,13 @@ async function kt({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2080
2066
|
n.addEventListener("abort", d, { once: !0 });
|
|
2081
2067
|
});
|
|
2082
2068
|
}
|
|
2083
|
-
var
|
|
2069
|
+
var kt = class {
|
|
2084
2070
|
interval = null;
|
|
2085
2071
|
constructor(e) {
|
|
2086
2072
|
this.onChange = e;
|
|
2087
2073
|
}
|
|
2088
2074
|
clear() {
|
|
2089
|
-
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...
|
|
2075
|
+
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...wt });
|
|
2090
2076
|
}
|
|
2091
2077
|
sync(e) {
|
|
2092
2078
|
this.clear();
|
|
@@ -2094,22 +2080,22 @@ var At = class {
|
|
|
2094
2080
|
this.onChange(t), t.delayRemainingMs !== null && (this.interval = setInterval(() => {
|
|
2095
2081
|
let t = $(e);
|
|
2096
2082
|
this.onChange(t), t.delayRemainingMs === null && this.clear();
|
|
2097
|
-
},
|
|
2083
|
+
}, Ct));
|
|
2098
2084
|
}
|
|
2099
2085
|
};
|
|
2100
|
-
function
|
|
2086
|
+
function At(e, t = !0) {
|
|
2101
2087
|
return e.maxAdditionalPages === "unlimited" ? Infinity : (e.maxAdditionalPages ?? 10) + (t ? 1 : 0);
|
|
2102
2088
|
}
|
|
2103
|
-
function
|
|
2089
|
+
function jt(e) {
|
|
2104
2090
|
return `${typeof e}:${String(e)}`;
|
|
2105
2091
|
}
|
|
2106
|
-
function
|
|
2092
|
+
function Mt(e, t) {
|
|
2107
2093
|
if (!Number.isInteger(e) || e <= 0) throw TypeError(`Vibe ${t} must be a positive integer.`);
|
|
2108
2094
|
}
|
|
2109
|
-
function
|
|
2095
|
+
function Nt(e) {
|
|
2110
2096
|
if (!e) return;
|
|
2111
|
-
if (
|
|
2112
|
-
|
|
2097
|
+
if (Mt(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
|
|
2098
|
+
Et(e, "frontend autofill");
|
|
2113
2099
|
let t = e.maxAdditionalPages;
|
|
2114
2100
|
if (t !== void 0 && t !== "unlimited" && (!Number.isInteger(t) || t < 0)) throw TypeError("Vibe autofill maxAdditionalPages must be a non-negative integer or \"unlimited\".");
|
|
2115
2101
|
return;
|
|
@@ -2121,7 +2107,7 @@ function Pt(e) {
|
|
|
2121
2107
|
if (t.pageSize !== e.pageSize) throw TypeError("Vibe backend autofill initialSession pageSize must match autofill pageSize.");
|
|
2122
2108
|
}
|
|
2123
2109
|
}
|
|
2124
|
-
function
|
|
2110
|
+
function Pt(e, t, n = !0) {
|
|
2125
2111
|
if (!e) return {
|
|
2126
2112
|
cycleId: null,
|
|
2127
2113
|
delayRemainingMs: null,
|
|
@@ -2155,7 +2141,7 @@ function Ft(e, t, n = !0) {
|
|
|
2155
2141
|
strategy: e.strategy
|
|
2156
2142
|
};
|
|
2157
2143
|
}
|
|
2158
|
-
function
|
|
2144
|
+
function Ft(e) {
|
|
2159
2145
|
return [
|
|
2160
2146
|
"cancelling",
|
|
2161
2147
|
"filling",
|
|
@@ -2163,9 +2149,9 @@ function It(e) {
|
|
|
2163
2149
|
"waiting"
|
|
2164
2150
|
].includes(e.status);
|
|
2165
2151
|
}
|
|
2166
|
-
async function
|
|
2152
|
+
async function It(e, t, n) {
|
|
2167
2153
|
let r = t.autofill;
|
|
2168
|
-
if (!
|
|
2154
|
+
if (!Ft(r) || !r.cycleId) return;
|
|
2169
2155
|
let i = {
|
|
2170
2156
|
cycleId: r.cycleId,
|
|
2171
2157
|
feedKey: r.feedKey ?? "",
|
|
@@ -2178,20 +2164,20 @@ async function Lt(e, t, n) {
|
|
|
2178
2164
|
throw r.error = e, r.status = "error", e;
|
|
2179
2165
|
}
|
|
2180
2166
|
}
|
|
2181
|
-
function
|
|
2167
|
+
function Lt(e, t, n) {
|
|
2182
2168
|
return e?.strategy === "backend" && t.feedKey === e.feedKey && t.sessionId === n.sessionId;
|
|
2183
2169
|
}
|
|
2184
|
-
async function
|
|
2185
|
-
let u = [], d = [...e], f = /* @__PURE__ */ new Set(), p = r ??
|
|
2170
|
+
async function Rt({ existingItems: e, initialCursor: t, loadPage: n, maximumRequests: r, onDelayChange: i, onProgress: a, options: o, receivedOffset: s = 0, requestOffset: c = 0, signal: l }) {
|
|
2171
|
+
let u = [], d = [...e], f = /* @__PURE__ */ new Set(), p = r ?? At(o), m = t, h = t, g = 0, _;
|
|
2186
2172
|
for (; g < p;) {
|
|
2187
|
-
let e =
|
|
2173
|
+
let e = jt(m);
|
|
2188
2174
|
if (f.has(e)) throw Error("Vibe autofill received a repeated cursor.");
|
|
2189
|
-
f.add(e), await
|
|
2190
|
-
delayMs:
|
|
2175
|
+
f.add(e), await Ot({
|
|
2176
|
+
delayMs: Dt(c + g, o),
|
|
2191
2177
|
onChange: i,
|
|
2192
2178
|
signal: l
|
|
2193
2179
|
});
|
|
2194
|
-
let t =
|
|
2180
|
+
let t = bt(await n({
|
|
2195
2181
|
cursor: m,
|
|
2196
2182
|
signal: l
|
|
2197
2183
|
}));
|
|
@@ -2231,30 +2217,30 @@ async function zt({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
2231
2217
|
total: _
|
|
2232
2218
|
};
|
|
2233
2219
|
}
|
|
2234
|
-
var
|
|
2235
|
-
function
|
|
2220
|
+
var zt = 100;
|
|
2221
|
+
function Bt(e, t) {
|
|
2236
2222
|
if (!Number.isFinite(t) || t <= 0) throw TypeError(`Vibe ${e} must be a positive number.`);
|
|
2237
2223
|
}
|
|
2238
|
-
function
|
|
2224
|
+
function Vt(e, t, n) {
|
|
2239
2225
|
return Math.min(n, Math.max(t, e));
|
|
2240
2226
|
}
|
|
2241
|
-
function
|
|
2227
|
+
function Ht(e) {
|
|
2242
2228
|
if (!e) return;
|
|
2243
2229
|
let t = e.minSpeedPxPerSecond ?? 20, n = e.maxSpeedPxPerSecond ?? 240;
|
|
2244
|
-
if (
|
|
2245
|
-
e.speedPxPerSecond !== void 0 &&
|
|
2230
|
+
if (Bt("autoScroll.minSpeedPxPerSecond", t), Bt("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
|
|
2231
|
+
e.speedPxPerSecond !== void 0 && Bt("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
|
|
2246
2232
|
}
|
|
2247
|
-
function
|
|
2233
|
+
function Ut(e) {
|
|
2248
2234
|
let t = e?.minSpeedPxPerSecond ?? 20, n = e?.maxSpeedPxPerSecond ?? 240;
|
|
2249
2235
|
return {
|
|
2250
2236
|
enabled: e?.enabled ?? !1,
|
|
2251
2237
|
maxSpeedPxPerSecond: n,
|
|
2252
2238
|
minSpeedPxPerSecond: t,
|
|
2253
2239
|
paused: !1,
|
|
2254
|
-
speedPxPerSecond:
|
|
2240
|
+
speedPxPerSecond: Vt(e?.speedPxPerSecond ?? 80, t, n)
|
|
2255
2241
|
};
|
|
2256
2242
|
}
|
|
2257
|
-
var
|
|
2243
|
+
var Wt = class {
|
|
2258
2244
|
frame = null;
|
|
2259
2245
|
lastTimestamp = null;
|
|
2260
2246
|
mounted = !1;
|
|
@@ -2274,9 +2260,9 @@ var Gt = class {
|
|
|
2274
2260
|
this.options.state.enabled && (this.options.state.paused = e, this.lastTimestamp = null, e ? this.cancelFrame() : this.schedule());
|
|
2275
2261
|
}
|
|
2276
2262
|
setSpeed(e) {
|
|
2277
|
-
|
|
2263
|
+
Bt("auto-scroll speed", e);
|
|
2278
2264
|
let t = this.options.state;
|
|
2279
|
-
t.speedPxPerSecond =
|
|
2265
|
+
t.speedPxPerSecond = Vt(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
|
|
2280
2266
|
}
|
|
2281
2267
|
tick = (e) => {
|
|
2282
2268
|
this.frame = null;
|
|
@@ -2288,7 +2274,7 @@ var Gt = class {
|
|
|
2288
2274
|
return;
|
|
2289
2275
|
}
|
|
2290
2276
|
if (this.lastTimestamp !== null) {
|
|
2291
|
-
let r = Math.min(
|
|
2277
|
+
let r = Math.min(zt, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
|
|
2292
2278
|
n.scrollTop = Math.min(i, n.scrollTop + t.speedPxPerSecond * r / 1e3);
|
|
2293
2279
|
}
|
|
2294
2280
|
this.lastTimestamp = e, this.schedule();
|
|
@@ -2302,7 +2288,7 @@ var Gt = class {
|
|
|
2302
2288
|
};
|
|
2303
2289
|
//#endregion
|
|
2304
2290
|
//#region src/core/backendAutofill.ts
|
|
2305
|
-
async function
|
|
2291
|
+
async function Gt(e, t, n, r) {
|
|
2306
2292
|
let i = await e.onUnderfilled(n);
|
|
2307
2293
|
if (!r()) return;
|
|
2308
2294
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend autofill requires a sessionId.");
|
|
@@ -2316,19 +2302,19 @@ async function Kt(e, t, n, r) {
|
|
|
2316
2302
|
status: "waiting"
|
|
2317
2303
|
});
|
|
2318
2304
|
}
|
|
2319
|
-
function
|
|
2305
|
+
function Kt(e, t) {
|
|
2320
2306
|
["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);
|
|
2321
2307
|
}
|
|
2322
|
-
function
|
|
2308
|
+
function qt(e, t, n) {
|
|
2323
2309
|
let r = t.autofill;
|
|
2324
|
-
return !
|
|
2310
|
+
return !Lt(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (Kt(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);
|
|
2325
2311
|
}
|
|
2326
|
-
function
|
|
2327
|
-
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill =
|
|
2312
|
+
function Jt(e, t, n) {
|
|
2313
|
+
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = Pt(e, n), Kt(t, n), !0);
|
|
2328
2314
|
}
|
|
2329
2315
|
//#endregion
|
|
2330
2316
|
//#region src/core/initialAutofill.ts
|
|
2331
|
-
async function
|
|
2317
|
+
async function Yt({ cycleId: e, isCurrent: t, onLastCursor: n, options: r, signal: i, state: a }) {
|
|
2332
2318
|
let o = r.autofill;
|
|
2333
2319
|
if (!o) return;
|
|
2334
2320
|
let s = a.items.length;
|
|
@@ -2341,7 +2327,7 @@ async function Xt({ cycleId: e, isCurrent: t, onLastCursor: n, options: r, signa
|
|
|
2341
2327
|
return;
|
|
2342
2328
|
}
|
|
2343
2329
|
if (o.strategy === "backend") {
|
|
2344
|
-
await
|
|
2330
|
+
await Gt(o, a, {
|
|
2345
2331
|
cycleId: e,
|
|
2346
2332
|
feedKey: o.feedKey,
|
|
2347
2333
|
items: [...a.items],
|
|
@@ -2358,11 +2344,11 @@ async function Xt({ cycleId: e, isCurrent: t, onLastCursor: n, options: r, signa
|
|
|
2358
2344
|
a.autofill.status = "exhausted";
|
|
2359
2345
|
return;
|
|
2360
2346
|
}
|
|
2361
|
-
let c = await
|
|
2347
|
+
let c = await Rt({
|
|
2362
2348
|
existingItems: a.items,
|
|
2363
2349
|
initialCursor: a.next,
|
|
2364
2350
|
loadPage: r.loadPage,
|
|
2365
|
-
maximumRequests:
|
|
2351
|
+
maximumRequests: At(o, !1),
|
|
2366
2352
|
onDelayChange: (e) => {
|
|
2367
2353
|
t() && Object.assign(a.autofill, e);
|
|
2368
2354
|
},
|
|
@@ -2383,13 +2369,13 @@ async function Xt({ cycleId: e, isCurrent: t, onLastCursor: n, options: r, signa
|
|
|
2383
2369
|
}
|
|
2384
2370
|
//#endregion
|
|
2385
2371
|
//#region src/core/fill.ts
|
|
2386
|
-
function
|
|
2372
|
+
function Xt(e) {
|
|
2387
2373
|
return "pages" in e ? { pages: e.pages } : { until: "end" };
|
|
2388
2374
|
}
|
|
2389
|
-
function
|
|
2375
|
+
function Zt(e) {
|
|
2390
2376
|
return `${typeof e}:${String(e)}`;
|
|
2391
2377
|
}
|
|
2392
|
-
function
|
|
2378
|
+
function Qt(e) {
|
|
2393
2379
|
if (!e || typeof e != "object") throw TypeError("Vibe fill target must be an object.");
|
|
2394
2380
|
if ("pages" in e) {
|
|
2395
2381
|
if (!Number.isInteger(e.pages) || e.pages <= 0) throw TypeError("Vibe fill pages must be a positive integer.");
|
|
@@ -2398,20 +2384,20 @@ function $t(e) {
|
|
|
2398
2384
|
if ("until" in e && e.until === "end") return { until: "end" };
|
|
2399
2385
|
throw TypeError("Vibe fill target must be { pages } or { until: 'end' }.");
|
|
2400
2386
|
}
|
|
2401
|
-
function
|
|
2387
|
+
function $t(e) {
|
|
2402
2388
|
if (!e) return;
|
|
2403
2389
|
if (e.strategy === "frontend") {
|
|
2404
|
-
|
|
2390
|
+
Et(e, "frontend fill");
|
|
2405
2391
|
return;
|
|
2406
2392
|
}
|
|
2407
2393
|
if (!e.feedKey.trim()) throw TypeError("Vibe backend fill requires a feedKey.");
|
|
2408
2394
|
let t = e.initialSession;
|
|
2409
2395
|
if (t) {
|
|
2410
2396
|
if (t.feedKey !== e.feedKey) throw TypeError("Vibe backend fill initialSession feedKey must match fill feedKey.");
|
|
2411
|
-
|
|
2397
|
+
Qt(t.target);
|
|
2412
2398
|
}
|
|
2413
2399
|
}
|
|
2414
|
-
function
|
|
2400
|
+
function en(e, t, n = !0) {
|
|
2415
2401
|
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a = $(i?.nextRequestAt);
|
|
2416
2402
|
return {
|
|
2417
2403
|
completedPages: i?.completedPages ?? 0,
|
|
@@ -2425,10 +2411,10 @@ function tn(e, t, n = !0) {
|
|
|
2425
2411
|
sessionId: i?.sessionId ?? null,
|
|
2426
2412
|
status: i?.status ?? "idle",
|
|
2427
2413
|
strategy: e?.strategy ?? null,
|
|
2428
|
-
target: i ?
|
|
2414
|
+
target: i ? Xt(i.target) : null
|
|
2429
2415
|
};
|
|
2430
2416
|
}
|
|
2431
|
-
function
|
|
2417
|
+
function tn(e) {
|
|
2432
2418
|
return [
|
|
2433
2419
|
"cancelling",
|
|
2434
2420
|
"filling",
|
|
@@ -2436,17 +2422,17 @@ function nn(e) {
|
|
|
2436
2422
|
"waiting"
|
|
2437
2423
|
].includes(e.status);
|
|
2438
2424
|
}
|
|
2439
|
-
async function
|
|
2425
|
+
async function nn({ existingItems: e, initialCursor: t, loadPage: n, onDelayChange: r, onProgress: i, options: a, signal: o, target: s }) {
|
|
2440
2426
|
let c = [], l = [...e], u = /* @__PURE__ */ new Set(), d = 0, f = t, p = t, m = 0, h;
|
|
2441
2427
|
for (; p !== null;) {
|
|
2442
|
-
let e =
|
|
2428
|
+
let e = Zt(f);
|
|
2443
2429
|
if (u.has(e)) throw Error("Vibe fill received a repeated cursor.");
|
|
2444
|
-
u.add(e), await
|
|
2445
|
-
delayMs:
|
|
2430
|
+
u.add(e), await Ot({
|
|
2431
|
+
delayMs: Dt(d, a),
|
|
2446
2432
|
onChange: r,
|
|
2447
2433
|
signal: o
|
|
2448
2434
|
});
|
|
2449
|
-
let t =
|
|
2435
|
+
let t = bt(await n({
|
|
2450
2436
|
cursor: f,
|
|
2451
2437
|
signal: o
|
|
2452
2438
|
}));
|
|
@@ -2488,7 +2474,7 @@ async function rn({ existingItems: e, initialCursor: t, loadPage: n, onDelayChan
|
|
|
2488
2474
|
}
|
|
2489
2475
|
//#endregion
|
|
2490
2476
|
//#region src/core/backendFill.ts
|
|
2491
|
-
async function
|
|
2477
|
+
async function rn(e, t, n, r) {
|
|
2492
2478
|
let i = await e.onStart(n);
|
|
2493
2479
|
if (r()) {
|
|
2494
2480
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend fill requires a sessionId.");
|
|
@@ -2502,22 +2488,22 @@ async function an(e, t, n, r) {
|
|
|
2502
2488
|
});
|
|
2503
2489
|
}
|
|
2504
2490
|
}
|
|
2505
|
-
function
|
|
2491
|
+
function an(e, t, n) {
|
|
2506
2492
|
return e?.strategy === "backend" && n.feedKey === e.feedKey && n.sessionId === t.fill.sessionId;
|
|
2507
2493
|
}
|
|
2508
|
-
function
|
|
2494
|
+
function on(e) {
|
|
2509
2495
|
return Number.isInteger(e.completedPages) && e.completedPages >= 0 && Number.isInteger(e.received) && e.received >= 0 && Number.isInteger(e.sequence) && e.sequence >= 0;
|
|
2510
2496
|
}
|
|
2511
|
-
function
|
|
2497
|
+
function sn(e, t) {
|
|
2512
2498
|
if (!["complete", "exhausted"].includes(t.status)) return !0;
|
|
2513
2499
|
let n = e.fill.target;
|
|
2514
2500
|
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;
|
|
2515
2501
|
}
|
|
2516
|
-
function
|
|
2502
|
+
function cn(e, t, n) {
|
|
2517
2503
|
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));
|
|
2518
2504
|
}
|
|
2519
|
-
function
|
|
2520
|
-
return !
|
|
2505
|
+
function ln(e, t, n, r) {
|
|
2506
|
+
return !an(e, t, n) || !on(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !sn(t, n) ? !1 : (cn(t, n, r), Object.assign(t.fill, {
|
|
2521
2507
|
...$(n.status === "waiting" ? n.nextRequestAt : null),
|
|
2522
2508
|
completedPages: n.completedPages,
|
|
2523
2509
|
error: n.error ?? null,
|
|
@@ -2526,41 +2512,41 @@ function un(e, t, n, r) {
|
|
|
2526
2512
|
status: n.status
|
|
2527
2513
|
}), !0);
|
|
2528
2514
|
}
|
|
2529
|
-
function
|
|
2515
|
+
function un(e, t, n, r) {
|
|
2530
2516
|
if (e?.strategy !== "backend" || n.feedKey !== e.feedKey) return !1;
|
|
2531
2517
|
let i = t.fill;
|
|
2532
|
-
return t.fill =
|
|
2518
|
+
return t.fill = en(e, n), !on(n) || !sn(t, n) ? (t.fill = i, !1) : (cn(t, n, r), !0);
|
|
2533
2519
|
}
|
|
2534
2520
|
//#endregion
|
|
2535
2521
|
//#region src/core/fillController.ts
|
|
2536
|
-
var
|
|
2522
|
+
var dn = class {
|
|
2537
2523
|
abortController = null;
|
|
2538
2524
|
cycle = 0;
|
|
2539
2525
|
delayCountdown;
|
|
2540
2526
|
requestVersion = 0;
|
|
2541
2527
|
constructor(e) {
|
|
2542
|
-
this.options = e, this.delayCountdown = new
|
|
2528
|
+
this.options = e, this.delayCountdown = new kt((e) => {
|
|
2543
2529
|
Object.assign(this.options.state.fill, e);
|
|
2544
2530
|
}), this.syncBackendCountdown();
|
|
2545
2531
|
}
|
|
2546
2532
|
isActive() {
|
|
2547
|
-
return
|
|
2533
|
+
return tn(this.options.state.fill);
|
|
2548
2534
|
}
|
|
2549
2535
|
applyUpdate(e) {
|
|
2550
|
-
let t =
|
|
2536
|
+
let t = ln(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
2551
2537
|
return t && this.syncBackendCountdown(), t;
|
|
2552
2538
|
}
|
|
2553
2539
|
restoreSession(e) {
|
|
2554
|
-
let t =
|
|
2540
|
+
let t = un(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
2555
2541
|
return t && this.syncBackendCountdown(), t;
|
|
2556
2542
|
}
|
|
2557
2543
|
async start(e) {
|
|
2558
2544
|
let t = this.options.fill;
|
|
2559
2545
|
if (!t) throw Error("Vibe fill is not configured.");
|
|
2560
2546
|
if (this.isActive()) throw Error("Vibe fill is already active.");
|
|
2561
|
-
let n =
|
|
2547
|
+
let n = Qt(e), r = `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
2562
2548
|
if (this.options.state.fill = {
|
|
2563
|
-
...
|
|
2549
|
+
...en(t, void 0, !1),
|
|
2564
2550
|
cycleId: r,
|
|
2565
2551
|
status: "filling",
|
|
2566
2552
|
target: n
|
|
@@ -2571,7 +2557,7 @@ var fn = class {
|
|
|
2571
2557
|
let i = ++this.requestVersion, a = new AbortController();
|
|
2572
2558
|
this.abortController = a;
|
|
2573
2559
|
try {
|
|
2574
|
-
t.strategy === "frontend" ? await this.startFrontend(t, n, a, i) : (await
|
|
2560
|
+
t.strategy === "frontend" ? await this.startFrontend(t, n, a, i) : (await rn(t, this.options.state, {
|
|
2575
2561
|
cycleId: r,
|
|
2576
2562
|
feedKey: t.feedKey,
|
|
2577
2563
|
items: [...this.options.state.items],
|
|
@@ -2589,7 +2575,7 @@ var fn = class {
|
|
|
2589
2575
|
}
|
|
2590
2576
|
async cancel() {
|
|
2591
2577
|
let { fill: e, state: t } = this.options;
|
|
2592
|
-
if (!
|
|
2578
|
+
if (!tn(t.fill) || !t.fill.cycleId) return;
|
|
2593
2579
|
let n = {
|
|
2594
2580
|
cycleId: t.fill.cycleId,
|
|
2595
2581
|
feedKey: t.fill.feedKey ?? "",
|
|
@@ -2603,7 +2589,7 @@ var fn = class {
|
|
|
2603
2589
|
}
|
|
2604
2590
|
}
|
|
2605
2591
|
reset() {
|
|
2606
|
-
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill =
|
|
2592
|
+
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = en(this.options.fill, void 0, !1);
|
|
2607
2593
|
}
|
|
2608
2594
|
destroy() {
|
|
2609
2595
|
this.abortLocalRequest(), this.delayCountdown.clear();
|
|
@@ -2619,7 +2605,7 @@ var fn = class {
|
|
|
2619
2605
|
if (!i) throw Error("Vibe frontend fill requires loadPage.");
|
|
2620
2606
|
let a = this.options.state;
|
|
2621
2607
|
a.isLoadingMore = !0;
|
|
2622
|
-
let o = await
|
|
2608
|
+
let o = await nn({
|
|
2623
2609
|
existingItems: a.items,
|
|
2624
2610
|
initialCursor: a.next,
|
|
2625
2611
|
loadPage: i,
|
|
@@ -2646,7 +2632,7 @@ var fn = class {
|
|
|
2646
2632
|
};
|
|
2647
2633
|
//#endregion
|
|
2648
2634
|
//#region src/core/feedFooter.ts
|
|
2649
|
-
function
|
|
2635
|
+
function fn(e) {
|
|
2650
2636
|
return {
|
|
2651
2637
|
cancelAutofill: () => e.cancelAutofill(),
|
|
2652
2638
|
loadMore: () => e.loadNext(),
|
|
@@ -2654,45 +2640,45 @@ function pn(e) {
|
|
|
2654
2640
|
retryEnd: () => e.retryEnd()
|
|
2655
2641
|
};
|
|
2656
2642
|
}
|
|
2657
|
-
function
|
|
2643
|
+
function pn(e) {
|
|
2658
2644
|
if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
|
|
2659
2645
|
}
|
|
2660
|
-
function
|
|
2661
|
-
e?.intervalMs !== void 0 &&
|
|
2646
|
+
function mn(e) {
|
|
2647
|
+
e?.intervalMs !== void 0 && pn(e.intervalMs);
|
|
2662
2648
|
}
|
|
2663
|
-
function
|
|
2649
|
+
function hn(e) {
|
|
2664
2650
|
return {
|
|
2665
2651
|
enabled: e?.enabled ?? !1,
|
|
2666
2652
|
includePostItems: e?.includePostItems ?? !1,
|
|
2667
2653
|
intervalMs: e?.intervalMs ?? 5e3
|
|
2668
2654
|
};
|
|
2669
2655
|
}
|
|
2670
|
-
function
|
|
2656
|
+
function gn(e, t) {
|
|
2671
2657
|
if (typeof t == "boolean") {
|
|
2672
2658
|
e.enabled = t;
|
|
2673
2659
|
return;
|
|
2674
2660
|
}
|
|
2675
|
-
|
|
2661
|
+
mn(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);
|
|
2676
2662
|
}
|
|
2677
2663
|
//#endregion
|
|
2678
2664
|
//#region src/core/reelInfoSheet.ts
|
|
2679
|
-
function
|
|
2665
|
+
function _n(e) {
|
|
2680
2666
|
return { enabled: e?.enabled ?? !1 };
|
|
2681
2667
|
}
|
|
2682
|
-
function
|
|
2668
|
+
function vn(e, t, n) {
|
|
2683
2669
|
if (n && !t) throw Error("Vibe cannot enable reelInfoSheet without a configured component.");
|
|
2684
2670
|
e.enabled = n;
|
|
2685
2671
|
}
|
|
2686
2672
|
//#endregion
|
|
2687
2673
|
//#region src/core/initialRuntimeState.ts
|
|
2688
|
-
function
|
|
2674
|
+
function yn(e, t) {
|
|
2689
2675
|
let n = e.initialPage;
|
|
2690
2676
|
return {
|
|
2691
2677
|
activeReelPostId: null,
|
|
2692
|
-
autoScroll:
|
|
2693
|
-
autofill:
|
|
2678
|
+
autoScroll: Ut(e.autoScroll),
|
|
2679
|
+
autofill: Pt(e.autofill),
|
|
2694
2680
|
error: null,
|
|
2695
|
-
fill:
|
|
2681
|
+
fill: en(e.fill),
|
|
2696
2682
|
infiniteScroll: e.infiniteScroll ?? !0,
|
|
2697
2683
|
isLoading: !n,
|
|
2698
2684
|
isLoadingMore: !1,
|
|
@@ -2701,8 +2687,8 @@ function bn(e, t) {
|
|
|
2701
2687
|
loadMoreLocked: !1,
|
|
2702
2688
|
next: n?.next ?? null,
|
|
2703
2689
|
nextPageError: null,
|
|
2704
|
-
reelAutoAdvance:
|
|
2705
|
-
reelInfoSheet:
|
|
2690
|
+
reelAutoAdvance: hn(e.reelAutoAdvance),
|
|
2691
|
+
reelInfoSheet: _n(e.reelInfoSheet),
|
|
2706
2692
|
reelInfoSheetOverlay: !1,
|
|
2707
2693
|
reelMediaSource: "original",
|
|
2708
2694
|
reelOrigin: null,
|
|
@@ -2711,18 +2697,18 @@ function bn(e, t) {
|
|
|
2711
2697
|
}
|
|
2712
2698
|
//#endregion
|
|
2713
2699
|
//#region src/core/itemPlacement.ts
|
|
2714
|
-
function
|
|
2700
|
+
function bn(e, t) {
|
|
2715
2701
|
let n = new Set(t);
|
|
2716
2702
|
return e.flatMap((e, t) => n.has(e.postId) ? [{
|
|
2717
2703
|
index: t,
|
|
2718
2704
|
item: e
|
|
2719
2705
|
}] : []);
|
|
2720
2706
|
}
|
|
2721
|
-
function
|
|
2707
|
+
function xn(e, t) {
|
|
2722
2708
|
let n = new Set(t.map(({ item: e }) => e.postId));
|
|
2723
2709
|
return e.filter((e) => !n.has(e.postId));
|
|
2724
2710
|
}
|
|
2725
|
-
function
|
|
2711
|
+
function Sn(e, t) {
|
|
2726
2712
|
t.forEach(({ index: e }) => {
|
|
2727
2713
|
if (!Number.isInteger(e) || e < 0) throw Error("Vibe item restore indexes must be non-negative integers.");
|
|
2728
2714
|
});
|
|
@@ -2733,7 +2719,7 @@ function Cn(e, t) {
|
|
|
2733
2719
|
}
|
|
2734
2720
|
//#endregion
|
|
2735
2721
|
//#region src/core/itemRemovalController.ts
|
|
2736
|
-
var
|
|
2722
|
+
var Cn = 20, wn = class {
|
|
2737
2723
|
generation = 0;
|
|
2738
2724
|
historyLimit;
|
|
2739
2725
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
@@ -2742,7 +2728,7 @@ var wn = 20, Tn = class {
|
|
|
2742
2728
|
itemOrder;
|
|
2743
2729
|
stopItemsWatcher;
|
|
2744
2730
|
constructor(e) {
|
|
2745
|
-
this.options = e, this.historyLimit = e.historyLimit ??
|
|
2731
|
+
this.options = e, this.historyLimit = e.historyLimit ?? Cn, 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" });
|
|
2746
2732
|
}
|
|
2747
2733
|
destroy() {
|
|
2748
2734
|
this.reset(), this.stopItemsWatcher();
|
|
@@ -2753,7 +2739,7 @@ var wn = 20, Tn = class {
|
|
|
2753
2739
|
let r = t.map(({ item: e }) => e.postId), i = this.options.startRemoval(r);
|
|
2754
2740
|
if (i > 0 && await new Promise((e) => setTimeout(e, i)), this.metadata.get(n)?.generation !== this.generation) return n;
|
|
2755
2741
|
let a = this.state.items.findIndex((e) => e.postId === this.state.activeReelPostId);
|
|
2756
|
-
return this.state.items =
|
|
2742
|
+
return this.state.items = xn(this.state.items, t), this.options.onItemsRemoved(t, a), this.record(n), n;
|
|
2757
2743
|
}
|
|
2758
2744
|
reset() {
|
|
2759
2745
|
this.generation += 1, this.history = [], this.itemOrder = [];
|
|
@@ -2764,7 +2750,7 @@ var wn = 20, Tn = class {
|
|
|
2764
2750
|
this.restoreRemoval(t);
|
|
2765
2751
|
return;
|
|
2766
2752
|
}
|
|
2767
|
-
let n =
|
|
2753
|
+
let n = Sn(this.state.items, e);
|
|
2768
2754
|
this.registerExternalPlacements(e), this.state.items = n;
|
|
2769
2755
|
}
|
|
2770
2756
|
restoreRemoval(e) {
|
|
@@ -2787,7 +2773,7 @@ var wn = 20, Tn = class {
|
|
|
2787
2773
|
}
|
|
2788
2774
|
collectOrderedPlacements(e) {
|
|
2789
2775
|
let t = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
2790
|
-
return
|
|
2776
|
+
return bn(this.state.items, e).map((e) => ({
|
|
2791
2777
|
index: t.get(e.item.postId) ?? e.index,
|
|
2792
2778
|
item: e.item
|
|
2793
2779
|
}));
|
|
@@ -2821,43 +2807,43 @@ var wn = 20, Tn = class {
|
|
|
2821
2807
|
};
|
|
2822
2808
|
//#endregion
|
|
2823
2809
|
//#region src/core/options.ts
|
|
2824
|
-
function
|
|
2810
|
+
function Tn(e, t) {
|
|
2825
2811
|
if (t) {
|
|
2826
2812
|
if (!Number.isFinite(t.height) || t.height <= 0) throw TypeError(`Vibe ${e} height must be a positive number.`);
|
|
2827
2813
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe ${e} background must be "default" or "transparent".`);
|
|
2828
2814
|
}
|
|
2829
2815
|
}
|
|
2830
|
-
function
|
|
2816
|
+
function En(e, t) {
|
|
2831
2817
|
if (t) {
|
|
2832
2818
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe mediaCard ${e} background must be "default" or "transparent".`);
|
|
2833
2819
|
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.`);
|
|
2834
2820
|
}
|
|
2835
2821
|
}
|
|
2836
|
-
function
|
|
2837
|
-
if (
|
|
2822
|
+
function Dn(e) {
|
|
2823
|
+
if (Ht(e.autoScroll), Tn("cardHeader", e.cardHeader), Tn("cardFooter", e.cardFooter), En("header", e.mediaCard?.header), En("footer", e.mediaCard?.footer), Nt(e.autofill), $t(e.fill), mn(e.reelAutoAdvance), e.removalHistoryLimit !== void 0 && (!Number.isInteger(e.removalHistoryLimit) || e.removalHistoryLimit < 0)) throw TypeError("Vibe removalHistoryLimit must be a non-negative integer.");
|
|
2838
2824
|
if (!e.initialPage && !e.loadPage) throw TypeError("Vibe requires either initialPage or loadPage.");
|
|
2839
2825
|
if (e.initialPage?.next !== null && !e.loadPage) throw TypeError("Vibe requires loadPage when initialPage has a next cursor.");
|
|
2840
2826
|
if (e.fill?.strategy === "frontend" && !e.loadPage) throw TypeError("Vibe frontend fill requires loadPage.");
|
|
2841
2827
|
if (e.fill?.strategy === "backend" && e.fill.initialSession && !e.initialPage) throw TypeError("Vibe backend fill restoration requires initialPage.");
|
|
2842
2828
|
}
|
|
2843
|
-
function
|
|
2829
|
+
function On(e) {
|
|
2844
2830
|
if (typeof e != "string") return e;
|
|
2845
2831
|
if (typeof document > "u") throw Error("Vibe cannot resolve a selector without a document.");
|
|
2846
2832
|
let t = document.querySelector(e);
|
|
2847
2833
|
if (!t) throw Error(`Vibe target not found: ${e}`);
|
|
2848
2834
|
return t;
|
|
2849
2835
|
}
|
|
2850
|
-
var
|
|
2851
|
-
function
|
|
2836
|
+
var kn = 1.5;
|
|
2837
|
+
function An(e) {
|
|
2852
2838
|
let t = Math.min(e.screenWidth, e.screenHeight);
|
|
2853
2839
|
if (t > 0 && t < 600) return !0;
|
|
2854
|
-
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n *
|
|
2840
|
+
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * kn;
|
|
2855
2841
|
return !e.hasHover && n > 0 && n < 600 && r;
|
|
2856
2842
|
}
|
|
2857
|
-
function
|
|
2858
|
-
return
|
|
2843
|
+
function jn(e) {
|
|
2844
|
+
return An(e) ? "reel" : "masonry";
|
|
2859
2845
|
}
|
|
2860
|
-
function
|
|
2846
|
+
function Mn(e) {
|
|
2861
2847
|
let t = e.ownerDocument.defaultView, n = e.ownerDocument.documentElement;
|
|
2862
2848
|
return {
|
|
2863
2849
|
hasHover: typeof t?.matchMedia == "function" && t.matchMedia("(hover: hover)").matches,
|
|
@@ -2867,15 +2853,15 @@ function Nn(e) {
|
|
|
2867
2853
|
viewportWidth: n.clientWidth
|
|
2868
2854
|
};
|
|
2869
2855
|
}
|
|
2870
|
-
function
|
|
2871
|
-
return
|
|
2856
|
+
function Nn(e) {
|
|
2857
|
+
return An(Mn(e));
|
|
2872
2858
|
}
|
|
2873
|
-
function
|
|
2874
|
-
return Mn(
|
|
2859
|
+
function Pn(e) {
|
|
2860
|
+
return jn(Mn(e));
|
|
2875
2861
|
}
|
|
2876
2862
|
//#endregion
|
|
2877
2863
|
//#region src/core/responsiveLayoutController.ts
|
|
2878
|
-
var
|
|
2864
|
+
var Fn = class {
|
|
2879
2865
|
layoutMode;
|
|
2880
2866
|
resizeObserver = null;
|
|
2881
2867
|
target = null;
|
|
@@ -2900,10 +2886,10 @@ var In = class {
|
|
|
2900
2886
|
}
|
|
2901
2887
|
handleResponsiveLayout = () => {
|
|
2902
2888
|
if (!this.target) return;
|
|
2903
|
-
let e =
|
|
2904
|
-
this.state.reelInfoSheetOverlay =
|
|
2889
|
+
let e = Pn(this.target);
|
|
2890
|
+
this.state.reelInfoSheetOverlay = Nn(this.target), this.state.reelMediaSource = e === "reel" ? "preview" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
|
|
2905
2891
|
};
|
|
2906
|
-
},
|
|
2892
|
+
}, In = class {
|
|
2907
2893
|
routedReelPostId = null;
|
|
2908
2894
|
reelRouteIsActive = !1;
|
|
2909
2895
|
constructor(e, t) {
|
|
@@ -2930,7 +2916,7 @@ var In = class {
|
|
|
2930
2916
|
let i = this.reelRouteIsActive ? "replace" : "push";
|
|
2931
2917
|
this.reelRouteIsActive = !0, this.routedReelPostId = e, this.options.router[i](r);
|
|
2932
2918
|
}
|
|
2933
|
-
},
|
|
2919
|
+
}, Ln = class {
|
|
2934
2920
|
app = null;
|
|
2935
2921
|
autoScroll;
|
|
2936
2922
|
autofillDelayCountdown;
|
|
@@ -2947,39 +2933,39 @@ var In = class {
|
|
|
2947
2933
|
lastLoadedCursor = null;
|
|
2948
2934
|
state;
|
|
2949
2935
|
constructor(e) {
|
|
2950
|
-
this.options = e,
|
|
2936
|
+
this.options = e, Dn(e);
|
|
2951
2937
|
let t = e.layout ?? "masonry";
|
|
2952
|
-
this.state = b(
|
|
2938
|
+
this.state = b(yn(e, t)), this.autoScroll = new Wt({
|
|
2953
2939
|
getScrollElement: () => this.surface?.getAutoScrollElement() ?? null,
|
|
2954
2940
|
state: this.state.autoScroll
|
|
2955
|
-
}), this.autofillDelayCountdown = new
|
|
2941
|
+
}), this.autofillDelayCountdown = new kt((e) => Object.assign(this.state.autofill, e)), this.syncAutofillCountdown(), this.fillController = new dn({
|
|
2956
2942
|
fill: e.fill,
|
|
2957
2943
|
loadPage: e.loadPage,
|
|
2958
2944
|
onLastCursor: (e) => {
|
|
2959
2945
|
this.lastLoadedCursor = e;
|
|
2960
2946
|
},
|
|
2961
2947
|
state: this.state
|
|
2962
|
-
}), this.routing = new
|
|
2948
|
+
}), this.routing = new In(e.routing, this.state), this.itemRemoval = new wn({
|
|
2963
2949
|
historyLimit: e.removalHistoryLimit,
|
|
2964
2950
|
onItemsRemoved: (e, t) => {
|
|
2965
2951
|
this.restoreActiveItemAfterRemoval(e, t);
|
|
2966
2952
|
},
|
|
2967
2953
|
startRemoval: (e) => this.surface?.startItemRemoval(e) ?? 0,
|
|
2968
2954
|
state: this.state
|
|
2969
|
-
}), this.responsiveLayout = new
|
|
2955
|
+
}), this.responsiveLayout = new Fn(t, this.state, () => {
|
|
2970
2956
|
this.routing.syncFeed();
|
|
2971
2957
|
}), this.startStateNotifications();
|
|
2972
2958
|
}
|
|
2973
2959
|
async mount() {
|
|
2974
2960
|
if (this.app) throw Error("Vibe is already mounted.");
|
|
2975
2961
|
this.startStateNotifications();
|
|
2976
|
-
let e =
|
|
2977
|
-
this.responsiveLayout.mount(e), this.app = r(
|
|
2962
|
+
let e = On(this.options.target);
|
|
2963
|
+
this.responsiveLayout.mount(e), this.app = r(yt, {
|
|
2978
2964
|
canRetryEnd: !!this.options.loadPage,
|
|
2979
2965
|
cardFooter: this.options.cardFooter,
|
|
2980
2966
|
cardHeader: this.options.cardHeader,
|
|
2981
2967
|
feedFooter: this.options.feedFooter,
|
|
2982
|
-
feedFooterActions:
|
|
2968
|
+
feedFooterActions: fn(this),
|
|
2983
2969
|
mediaCard: this.options.mediaCard,
|
|
2984
2970
|
reelInfoSheet: this.options.reelInfoSheet,
|
|
2985
2971
|
state: this.state,
|
|
@@ -3038,11 +3024,11 @@ var In = class {
|
|
|
3038
3024
|
this.autoScroll.setSpeed(e);
|
|
3039
3025
|
}
|
|
3040
3026
|
applyAutofillUpdate(e) {
|
|
3041
|
-
let t =
|
|
3027
|
+
let t = qt(this.options.autofill, this.state, e);
|
|
3042
3028
|
return t && this.syncAutofillCountdown(), t;
|
|
3043
3029
|
}
|
|
3044
3030
|
async cancelAutofill() {
|
|
3045
|
-
await
|
|
3031
|
+
await It(this.options.autofill, this.state, () => this.cancelRequest());
|
|
3046
3032
|
}
|
|
3047
3033
|
applyFillUpdate(e) {
|
|
3048
3034
|
return this.fillController.applyUpdate(e);
|
|
@@ -3051,11 +3037,11 @@ var In = class {
|
|
|
3051
3037
|
return this.fillController.cancel();
|
|
3052
3038
|
}
|
|
3053
3039
|
async fill(e) {
|
|
3054
|
-
if (this.pendingRequest ||
|
|
3040
|
+
if (this.pendingRequest || Ft(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
|
|
3055
3041
|
await this.fillController.start(e);
|
|
3056
3042
|
}
|
|
3057
3043
|
restoreAutofillSession(e) {
|
|
3058
|
-
let t =
|
|
3044
|
+
let t = Jt(this.options.autofill, this.state, e);
|
|
3059
3045
|
return t && this.syncAutofillCountdown(), t;
|
|
3060
3046
|
}
|
|
3061
3047
|
restoreFillSession(e) {
|
|
@@ -3063,15 +3049,15 @@ var In = class {
|
|
|
3063
3049
|
}
|
|
3064
3050
|
async loadNext() {
|
|
3065
3051
|
if (this.pendingRequest) return this.pendingRequest;
|
|
3066
|
-
if (!this.state.loadMoreLocked && !(
|
|
3052
|
+
if (!this.state.loadMoreLocked && !(Ft(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);
|
|
3067
3053
|
}
|
|
3068
3054
|
async reload() {
|
|
3069
3055
|
if (!this.options.loadPage) throw Error("Vibe cannot reload without loadPage.");
|
|
3070
|
-
return
|
|
3056
|
+
return Ft(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.state.autofill = Pt(this.options.autofill, void 0, !1), this.fillController.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(null, !1);
|
|
3071
3057
|
}
|
|
3072
3058
|
async retryEnd() {
|
|
3073
3059
|
if (this.pendingRequest) return this.pendingRequest;
|
|
3074
|
-
if (!this.state.loadMoreLocked && !(
|
|
3060
|
+
if (!this.state.loadMoreLocked && !(Ft(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);
|
|
3075
3061
|
}
|
|
3076
3062
|
setInfiniteScroll(e) {
|
|
3077
3063
|
this.state.infiniteScroll = e, e && p(() => this.surface?.loadIfNearBottom());
|
|
@@ -3080,10 +3066,10 @@ var In = class {
|
|
|
3080
3066
|
this.state.loadMoreLocked !== e && (this.state.loadMoreLocked = e, !e && this.state.infiniteScroll && p(() => this.surface?.loadIfNearBottom()));
|
|
3081
3067
|
}
|
|
3082
3068
|
setReelAutoAdvance(e) {
|
|
3083
|
-
|
|
3069
|
+
gn(this.state.reelAutoAdvance, e);
|
|
3084
3070
|
}
|
|
3085
3071
|
setReelInfoSheet(e) {
|
|
3086
|
-
|
|
3072
|
+
vn(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
|
|
3087
3073
|
}
|
|
3088
3074
|
setLayout(e) {
|
|
3089
3075
|
this.responsiveLayout.setLayout(e);
|
|
@@ -3117,7 +3103,7 @@ var In = class {
|
|
|
3117
3103
|
this.abortController = i;
|
|
3118
3104
|
try {
|
|
3119
3105
|
if (a?.strategy === "frontend") {
|
|
3120
|
-
let o = await
|
|
3106
|
+
let o = await Rt({
|
|
3121
3107
|
existingItems: t ? this.state.items : [],
|
|
3122
3108
|
initialCursor: e,
|
|
3123
3109
|
loadPage: n,
|
|
@@ -3139,7 +3125,7 @@ var In = class {
|
|
|
3139
3125
|
});
|
|
3140
3126
|
return;
|
|
3141
3127
|
}
|
|
3142
|
-
let c =
|
|
3128
|
+
let c = bt(await n({
|
|
3143
3129
|
cursor: e,
|
|
3144
3130
|
signal: i.signal
|
|
3145
3131
|
}));
|
|
@@ -3154,7 +3140,7 @@ var In = class {
|
|
|
3154
3140
|
this.state.autofill.status = "complete";
|
|
3155
3141
|
return;
|
|
3156
3142
|
}
|
|
3157
|
-
await
|
|
3143
|
+
await Gt(a, this.state, {
|
|
3158
3144
|
cycleId: o,
|
|
3159
3145
|
feedKey: a.feedKey,
|
|
3160
3146
|
items: u.slice(l.length),
|
|
@@ -3179,7 +3165,7 @@ var In = class {
|
|
|
3179
3165
|
this.autofillDelayCountdown.clear();
|
|
3180
3166
|
let t = `vibe-autofill-${Date.now().toString(36)}-${++this.autofillCycle}`;
|
|
3181
3167
|
return this.state.autofill = {
|
|
3182
|
-
...
|
|
3168
|
+
...Pt(e, void 0, !1),
|
|
3183
3169
|
cycleId: t,
|
|
3184
3170
|
status: "filling"
|
|
3185
3171
|
}, t;
|
|
@@ -3197,7 +3183,7 @@ var In = class {
|
|
|
3197
3183
|
startInitialAutofill() {
|
|
3198
3184
|
let e = ++this.requestVersion, t = new AbortController(), n = this.beginAutofillCycle();
|
|
3199
3185
|
this.abortController = t, this.state.isLoadingMore = !0;
|
|
3200
|
-
let r =
|
|
3186
|
+
let r = Yt({
|
|
3201
3187
|
cycleId: n,
|
|
3202
3188
|
isCurrent: () => e === this.requestVersion,
|
|
3203
3189
|
onLastCursor: (e) => {
|
|
@@ -3221,8 +3207,8 @@ var In = class {
|
|
|
3221
3207
|
}));
|
|
3222
3208
|
}
|
|
3223
3209
|
};
|
|
3224
|
-
function
|
|
3225
|
-
return new
|
|
3210
|
+
function Rn(e) {
|
|
3211
|
+
return new Ln(e);
|
|
3226
3212
|
}
|
|
3227
3213
|
//#endregion
|
|
3228
|
-
export {
|
|
3214
|
+
export { Rn as createVibe };
|