@wyxos/vibe 5.6.0 → 5.7.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/lib/index.js CHANGED
@@ -1,23 +1,40 @@
1
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 v, onMounted as y, openBlock as b, reactive as x, renderList as S, resolveDynamicComponent as C, shallowRef as w, toDisplayString as T, unref as E, useId as D, watch as O, withCtx as k, withKeys as A, withModifiers as j } from "vue";
2
2
  //#region src/core/mediaAsset.ts
3
3
  function M(e) {
4
- return [e, ...e.items];
4
+ return {
5
+ height: e.height,
6
+ src: e.src,
7
+ type: e.type,
8
+ width: e.width
9
+ };
5
10
  }
6
11
  function N(e, t) {
7
- return Math.min(e.items.length, Math.max(0, t));
12
+ return t === "preview" ? {
13
+ ...e.preview,
14
+ type: e.preview.type ?? e.type
15
+ } : t === "mobile" && e.mobile ? {
16
+ ...e.mobile,
17
+ type: e.mobile.type ?? e.type
18
+ } : M(e);
8
19
  }
9
- function P(e, t) {
10
- return M(e)[N(e, t)] ?? e;
20
+ function P(e) {
21
+ return [e, ...e.items];
11
22
  }
12
23
  function F(e, t) {
24
+ return Math.min(e.items.length, Math.max(0, t));
25
+ }
26
+ function I(e, t) {
27
+ return P(e)[F(e, t)] ?? e;
28
+ }
29
+ function L(e, t) {
13
30
  return `${String(e)}:${t}`;
14
31
  }
15
32
  //#endregion
16
33
  //#region src/core/runtime.ts
17
- function I(e) {
34
+ function R(e) {
18
35
  return r(() => Object.freeze([...e.items]));
19
36
  }
20
- function L(e, t = [...e.items]) {
37
+ function z(e, t = [...e.items]) {
21
38
  return {
22
39
  activeReelPostId: e.activeReelPostId,
23
40
  autoScroll: { ...e.autoScroll },
@@ -47,17 +64,17 @@ function L(e, t = [...e.items]) {
47
64
  }
48
65
  //#endregion
49
66
  //#region src/components/GalleryFooter.vue?vue&type=script&setup=true&lang.ts
50
- var R = {
67
+ var B = {
51
68
  key: 0,
52
69
  class: "gallery-footer"
53
- }, z = {
70
+ }, V = {
54
71
  key: 0,
55
72
  class: "load-more-status",
56
73
  role: "status"
57
- }, B = ["disabled"], ee = {
74
+ }, H = ["disabled"], ee = {
58
75
  key: 2,
59
76
  class: "end-feed"
60
- }, V = ["disabled"], H = /* @__PURE__ */ d({
77
+ }, U = ["disabled"], W = /* @__PURE__ */ d({
61
78
  __name: "GalleryFooter",
62
79
  props: {
63
80
  canRetryEnd: { type: Boolean },
@@ -73,14 +90,14 @@ var R = {
73
90
  function i() {
74
91
  n.loadMoreLocked || (n.hasNext ? r("loadMore") : r("retryEnd"));
75
92
  }
76
- return (t, n) => e.isLoading || e.hasError || e.hasNext && e.showLoadMore || !e.hasNext && e.canRetryEnd ? (b(), s("footer", R, [e.isLoading ? (b(), s("p", z, " Loading more… ")) : e.hasError || e.hasNext && e.showLoadMore ? (b(), s("button", {
93
+ return (t, n) => e.isLoading || e.hasError || e.hasNext && e.showLoadMore || !e.hasNext && e.canRetryEnd ? (b(), s("footer", B, [e.isLoading ? (b(), s("p", V, " Loading more… ")) : e.hasError || e.hasNext && e.showLoadMore ? (b(), s("button", {
77
94
  key: 1,
78
95
  "data-test": "load-more",
79
96
  class: "load-more-button",
80
97
  type: "button",
81
98
  disabled: e.loadMoreLocked,
82
99
  onClick: i
83
- }, T(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9, B)) : (b(), s("div", ee, [n[1] ||= c("p", {
100
+ }, T(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9, H)) : (b(), s("div", ee, [n[1] ||= c("p", {
84
101
  class: "end-feed-message",
85
102
  role: "status"
86
103
  }, " You've reached the end. ", -1), c("button", {
@@ -89,9 +106,9 @@ var R = {
89
106
  type: "button",
90
107
  disabled: e.loadMoreLocked,
91
108
  onClick: n[0] ||= (e) => t.$emit("retryEnd")
92
- }, " Check for more ", 8, V)]))])) : o("", !0);
109
+ }, " Check for more ", 8, U)]))])) : o("", !0);
93
110
  }
94
- }), U = /* @__PURE__ */ d({
111
+ }), te = /* @__PURE__ */ d({
95
112
  __name: "FeedFooter",
96
113
  props: {
97
114
  actions: {},
@@ -128,7 +145,7 @@ var R = {
128
145
  "can-retry-end",
129
146
  "show-load-more",
130
147
  "state"
131
- ])) : (b(), a(H, {
148
+ ])) : (b(), a(W, {
132
149
  key: 1,
133
150
  "can-retry-end": e.canRetryEnd,
134
151
  "has-error": e.hasError,
@@ -147,7 +164,7 @@ var R = {
147
164
  "show-load-more"
148
165
  ]));
149
166
  }
150
- }), W = ["role"], G = { class: "gallery-status" }, te = /* @__PURE__ */ d({
167
+ }), G = ["role"], K = { class: "gallery-status" }, ne = /* @__PURE__ */ d({
151
168
  __name: "FeedStatus",
152
169
  props: {
153
170
  actions: {},
@@ -161,7 +178,7 @@ var R = {
161
178
  return (n, u) => (b(), s("main", {
162
179
  class: "gallery-shell",
163
180
  role: r.state.error ? "alert" : r.state.isLoading ? "status" : void 0
164
- }, [c("p", G, [r.state.error ? (b(), s(e, { key: 0 }, [l(" Unable to load media. ")], 64)) : r.state.isLoading ? (b(), s(e, { key: 1 }, [l(" Loading media… ")], 64)) : (b(), s(e, { key: 2 }, [l(" No media found. ")], 64))]), t.feedFooter ? (b(), a(U, {
181
+ }, [c("p", K, [r.state.error ? (b(), s(e, { key: 0 }, [l(" Unable to load media. ")], 64)) : r.state.isLoading ? (b(), s(e, { key: 1 }, [l(" Loading media… ")], 64)) : (b(), s(e, { key: 2 }, [l(" No media found. ")], 64))]), t.feedFooter ? (b(), a(te, {
165
182
  key: 0,
166
183
  actions: t.actions,
167
184
  "can-retry-end": t.canRetryEnd,
@@ -183,10 +200,10 @@ var R = {
183
200
  "is-loading",
184
201
  "load-more-locked",
185
202
  "state"
186
- ])) : o("", !0)], 8, W));
203
+ ])) : o("", !0)], 8, G));
187
204
  }
188
205
  });
189
- function ne(e) {
206
+ function q(e) {
190
207
  return e.scrollHeight - e.scrollTop - e.clientHeight <= 240;
191
208
  }
192
209
  //#endregion
@@ -195,7 +212,7 @@ function re(e) {
195
212
  let t = e.preview.width ?? e.width, n = e.preview.height ?? e.height;
196
213
  return !t || !n || t <= 0 || n <= 0 ? 1 : n / t;
197
214
  }
198
- function K(e) {
215
+ function J(e) {
199
216
  return e.reduce((t, n, r) => n < e[t] ? r : t, 0);
200
217
  }
201
218
  function ie(e) {
@@ -208,7 +225,7 @@ function ae(e, t, n) {
208
225
  items: []
209
226
  };
210
227
  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) => {
211
- let t = K(c), n = s * re(e) + i, a = {
228
+ let t = J(c), n = s * re(e) + i, a = {
212
229
  x: t * (s + r),
213
230
  y: c[t],
214
231
  width: s,
@@ -235,7 +252,7 @@ function oe(e, t) {
235
252
  }), n.set(e.x, i);
236
253
  }), { columns: [...n.entries()].sort(([e], [t]) => e - t).map(([, e]) => e.sort((e, t) => e.top - t.top || e.index - t.index)) };
237
254
  }
238
- function q(e, t) {
255
+ function Y(e, t) {
239
256
  let n = 0, r = 0, i = e.length;
240
257
  for (; r < i;) {
241
258
  let a = Math.floor((r + i) / 2);
@@ -246,10 +263,10 @@ function q(e, t) {
246
263
  inspected: n
247
264
  };
248
265
  }
249
- function se(e, t) {
266
+ function X(e, t) {
250
267
  let n = Math.max(0, t.overscan), r = t.scrollTop - n, i = t.scrollTop + Math.max(0, t.viewportHeight) + n, a = [], o = 0;
251
268
  return e.columns.forEach((e) => {
252
- let t = q(e, r);
269
+ let t = Y(e, r);
253
270
  o += t.inspected;
254
271
  for (let n = t.index; n < e.length; n += 1) {
255
272
  let t = e[n];
@@ -261,14 +278,14 @@ function se(e, t) {
261
278
  inspected: o
262
279
  };
263
280
  }
264
- function J(e) {
281
+ function Z(e) {
265
282
  return e?.minColumnWidth ?? 240;
266
283
  }
267
- function Y(e, t) {
284
+ function se(e, t) {
268
285
  let n = e?.overscan?.minimumPx ?? 800, r = e?.overscan?.viewportMultiplier ?? 1.5, i = Math.max(n, t * r), a = e?.overscan?.maximumPx;
269
286
  return a === void 0 ? i : Math.min(i, a);
270
287
  }
271
- function X(e) {
288
+ function ce(e) {
272
289
  if (e?.minColumnWidth !== void 0 && (!Number.isFinite(e.minColumnWidth) || e.minColumnWidth <= 0)) throw TypeError("Vibe masonry minColumnWidth must be a positive number.");
273
290
  let t = e?.overscan;
274
291
  if (t) {
@@ -282,10 +299,10 @@ function X(e) {
282
299
  }
283
300
  //#endregion
284
301
  //#region src/core/scrollbar.ts
285
- function Z(e, t, n) {
302
+ function le(e, t, n) {
286
303
  return Math.min(n, Math.max(t, e));
287
304
  }
288
- function ce({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize: r, viewportSize: i }) {
305
+ function ue({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize: r, viewportSize: i }) {
289
306
  let a = Math.max(0, e), o = Math.max(0, r), s = Math.max(0, i), c = Math.max(0, a - s);
290
307
  if (!(c > 0 && o > 0)) return {
291
308
  maximumScrollPosition: c,
@@ -294,23 +311,23 @@ function ce({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize:
294
311
  thumbSize: o,
295
312
  thumbTravel: 0
296
313
  };
297
- let l = Z(s / a * o, Math.min(Math.max(0, t), o), o), u = Math.max(0, o - l);
314
+ let l = le(s / a * o, Math.min(Math.max(0, t), o), o), u = Math.max(0, o - l);
298
315
  return {
299
316
  maximumScrollPosition: c,
300
317
  scrollable: !0,
301
- thumbOffset: u * (Z(n, 0, c) / c),
318
+ thumbOffset: u * (le(n, 0, c) / c),
302
319
  thumbSize: l,
303
320
  thumbTravel: u
304
321
  };
305
322
  }
306
323
  //#endregion
307
324
  //#region src/components/GalleryScrollbar.vue?vue&type=script&setup=true&lang.ts
308
- var le = ["aria-hidden"], ue = [
325
+ var de = ["aria-hidden"], fe = [
309
326
  "aria-controls",
310
327
  "aria-valuemax",
311
328
  "aria-valuenow",
312
329
  "tabindex"
313
- ], de = 32, fe = 40, pe = 120, me = /* @__PURE__ */ d({
330
+ ], pe = 32, me = 40, he = 120, ge = /* @__PURE__ */ d({
314
331
  __name: "GalleryScrollbar",
315
332
  props: {
316
333
  contentSize: {},
@@ -332,16 +349,16 @@ var le = ["aria-hidden"], ue = [
332
349
  function k() {
333
350
  g !== null && clearTimeout(g), g = setTimeout(() => {
334
351
  g = null, o.value || (l.value = !1);
335
- }, pe);
352
+ }, he);
336
353
  }
337
354
  function A() {
338
355
  l.value = !0, k();
339
356
  }
340
357
  function j() {
341
358
  let e = t.scrollElement, r = i.value;
342
- return !e || !r ? n : ce({
359
+ return !e || !r ? n : ue({
343
360
  contentSize: e.scrollHeight,
344
- minimumThumbSize: de,
361
+ minimumThumbSize: pe,
345
362
  scrollPosition: e.scrollTop,
346
363
  trackSize: r.clientHeight,
347
364
  viewportSize: e.clientHeight
@@ -394,7 +411,7 @@ var le = ["aria-hidden"], ue = [
394
411
  }
395
412
  function z(e) {
396
413
  if (!E.value) return;
397
- let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r - fe : e.key === "ArrowDown" ? r + fe : e.key === "PageUp" ? r - n : e.key === "PageDown" ? r + n : e.key === "Home" ? 0 : e.key === "End" ? a.value.maximumScrollPosition : null;
414
+ let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r - me : e.key === "ArrowDown" ? r + me : e.key === "PageUp" ? r - n : e.key === "PageDown" ? r + n : e.key === "Home" ? 0 : e.key === "End" ? a.value.maximumScrollPosition : null;
398
415
  i !== null && (e.preventDefault(), A(), P(i));
399
416
  }
400
417
  function B(e) {
@@ -440,15 +457,15 @@ var le = ["aria-hidden"], ue = [
440
457
  onPointerdown: I,
441
458
  onPointermove: L,
442
459
  onPointerup: R
443
- }, null, 44, ue)], 42, le));
460
+ }, null, 44, fe)], 42, de));
444
461
  }
445
- }), he = (e) => {
462
+ }), _e = (e) => {
446
463
  for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
447
464
  return !1;
448
- }, ge = (e) => e === "", _e = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), ve = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), ye = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), be = (e) => {
449
- let t = ye(e);
465
+ }, ve = (e) => e === "", ye = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), be = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), xe = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), Se = (e) => {
466
+ let t = xe(e);
450
467
  return t.charAt(0).toUpperCase() + t.slice(1);
451
- }, xe = {
468
+ }, Ce = {
452
469
  xmlns: "http://www.w3.org/2000/svg",
453
470
  width: 24,
454
471
  height: 24,
@@ -458,27 +475,27 @@ var le = ["aria-hidden"], ue = [
458
475
  "stroke-width": 2,
459
476
  "stroke-linecap": "round",
460
477
  "stroke-linejoin": "round"
461
- }, Se = ({ name: e, iconNode: t, absoluteStrokeWidth: n, "absolute-stroke-width": r, strokeWidth: i, "stroke-width": a, size: o = xe.width, color: s = xe.stroke, ...c }, { slots: l }) => p("svg", {
462
- ...xe,
478
+ }, we = ({ name: e, iconNode: t, absoluteStrokeWidth: n, "absolute-stroke-width": r, strokeWidth: i, "stroke-width": a, size: o = Ce.width, color: s = Ce.stroke, ...c }, { slots: l }) => p("svg", {
479
+ ...Ce,
463
480
  ...c,
464
481
  width: o,
465
482
  height: o,
466
483
  stroke: s,
467
- "stroke-width": ge(n) || ge(r) || n === !0 || r === !0 ? Number(i || a || xe["stroke-width"]) * 24 / Number(o) : i || a || xe["stroke-width"],
468
- class: _e("lucide", c.class, ...e ? [`lucide-${ve(be(e))}-icon`, `lucide-${ve(e)}`] : ["lucide-icon"]),
469
- ...!l.default && !he(c) && { "aria-hidden": "true" }
470
- }, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]), Ce = (e, t) => (n, { slots: r, attrs: i }) => p(Se, {
484
+ "stroke-width": ve(n) || ve(r) || n === !0 || r === !0 ? Number(i || a || Ce["stroke-width"]) * 24 / Number(o) : i || a || Ce["stroke-width"],
485
+ class: ye("lucide", c.class, ...e ? [`lucide-${be(Se(e))}-icon`, `lucide-${be(e)}`] : ["lucide-icon"]),
486
+ ...!l.default && !_e(c) && { "aria-hidden": "true" }
487
+ }, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]), Te = (e, t) => (n, { slots: r, attrs: i }) => p(we, {
471
488
  ...i,
472
489
  ...n,
473
490
  iconNode: t,
474
491
  name: e
475
- }, r), we = Ce("chevron-left", [["path", {
492
+ }, r), Ee = Te("chevron-left", [["path", {
476
493
  d: "m15 18-6-6 6-6",
477
494
  key: "1wnfg3"
478
- }]]), Te = Ce("chevron-right", [["path", {
495
+ }]]), De = Te("chevron-right", [["path", {
479
496
  d: "m9 18 6-6-6-6",
480
497
  key: "mthhwq"
481
- }]]), Ee = Ce("pause", [["rect", {
498
+ }]]), Oe = Te("pause", [["rect", {
482
499
  x: "14",
483
500
  y: "3",
484
501
  width: "5",
@@ -492,10 +509,10 @@ var le = ["aria-hidden"], ue = [
492
509
  height: "18",
493
510
  rx: "1",
494
511
  key: "1wsw3u"
495
- }]]), De = Ce("play", [["path", {
512
+ }]]), ke = Te("play", [["path", {
496
513
  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",
497
514
  key: "10ikf1"
498
- }]]), Oe = Ce("volume-2", [
515
+ }]]), Ae = Te("volume-2", [
499
516
  ["path", {
500
517
  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",
501
518
  key: "uqj9uw"
@@ -508,7 +525,7 @@ var le = ["aria-hidden"], ue = [
508
525
  d: "M19.364 18.364a9 9 0 0 0 0-12.728",
509
526
  key: "ijwkga"
510
527
  }]
511
- ]), ke = Ce("volume-x", [
528
+ ]), je = Te("volume-x", [
512
529
  ["path", {
513
530
  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",
514
531
  key: "uqj9uw"
@@ -527,22 +544,22 @@ var le = ["aria-hidden"], ue = [
527
544
  y2: "15",
528
545
  key: "5ykzw1"
529
546
  }]
530
- ]), Ae = {
547
+ ]), Me = {
531
548
  401: "Authentication required",
532
549
  403: "Access forbidden",
533
550
  404: "Preview not found",
534
551
  419: "Session expired",
535
552
  500: "Server error"
536
553
  };
537
- function je(e) {
554
+ function Ne(e) {
538
555
  return e.match(/\/demo-errors\/(401|403|404|419|500)\//)?.[1] ?? "Error";
539
556
  }
540
- function Me(e) {
541
- return Ae[je(e)] ?? "Preview unavailable";
557
+ function Pe(e) {
558
+ return Me[Ne(e)] ?? "Preview unavailable";
542
559
  }
543
560
  //#endregion
544
561
  //#region src/components/CardRegion.vue
545
- var Ne = /* @__PURE__ */ d({
562
+ var Fe = /* @__PURE__ */ d({
546
563
  __name: "CardRegion",
547
564
  props: {
548
565
  index: {},
@@ -557,7 +574,7 @@ var Ne = /* @__PURE__ */ d({
557
574
  total: {}
558
575
  },
559
576
  setup(e) {
560
- let t = e, n = r(() => N(t.item, t.mediaIndex)), i = r(() => M(t.item)), o = r(() => P(t.item, n.value)), c = r(() => ({
577
+ let t = e, n = r(() => F(t.item, t.mediaIndex)), i = r(() => P(t.item)), o = r(() => I(t.item, n.value)), c = r(() => ({
561
578
  height: `${t.region.height}px`,
562
579
  paddingBlock: t.style?.paddingY === void 0 ? void 0 : `${t.style.paddingY}px`,
563
580
  paddingInline: t.style?.paddingX === void 0 ? void 0 : `${t.style.paddingX}px`
@@ -589,18 +606,18 @@ var Ne = /* @__PURE__ */ d({
589
606
  "total"
590
607
  ]))], 38));
591
608
  }
592
- }), Pe = [
609
+ }), Ie = [
593
610
  "max",
594
611
  "value",
595
612
  "aria-valuetext",
596
613
  "disabled"
597
- ], Fe = {
614
+ ], Le = {
598
615
  key: 0,
599
616
  class: "media-controls-row"
600
- }, Ie = ["aria-label", "title"], Le = { class: "media-controls-audio" }, Re = ["aria-label", "title"], ze = ["value", "aria-valuetext"], Be = {
617
+ }, Re = ["aria-label", "title"], ze = { class: "media-controls-audio" }, Be = ["aria-label", "title"], Ve = ["value", "aria-valuetext"], He = {
601
618
  class: "media-control-time",
602
619
  "aria-live": "off"
603
- }, Ve = /* @__PURE__ */ d({
620
+ }, Ue = /* @__PURE__ */ d({
604
621
  __name: "MediaControls",
605
622
  props: {
606
623
  currentTime: {},
@@ -648,35 +665,35 @@ var Ne = /* @__PURE__ */ d({
648
665
  "aria-valuetext": `${u(p.value)} of ${u(f.value)}`,
649
666
  disabled: f.value <= 0,
650
667
  onInput: n[0] ||= (e) => i("seek", d(e))
651
- }, null, 44, Pe), e.layout === "reel" ? (b(), s("div", Fe, [
668
+ }, null, 44, Ie), e.layout === "reel" ? (b(), s("div", Le, [
652
669
  c("button", {
653
670
  type: "button",
654
671
  class: "media-control-button media-control-playback",
655
672
  "aria-label": e.playing ? "Pause video" : "Play video",
656
673
  title: e.playing ? "Pause" : "Play",
657
674
  onClick: n[1] ||= (e) => i("togglePlayback")
658
- }, [e.playing ? (b(), a(E(Ee), {
675
+ }, [e.playing ? (b(), a(E(Oe), {
659
676
  key: 0,
660
677
  size: 18,
661
678
  fill: "currentColor"
662
- })) : (b(), a(E(De), {
679
+ })) : (b(), a(E(ke), {
663
680
  key: 1,
664
681
  size: 18,
665
682
  fill: "currentColor"
666
- }))], 8, Ie),
667
- c("div", Le, [c("button", {
683
+ }))], 8, Re),
684
+ c("div", ze, [c("button", {
668
685
  type: "button",
669
686
  class: "media-control-button",
670
687
  "aria-label": e.muted ? "Unmute video" : "Mute video",
671
688
  title: e.muted ? "Unmute" : "Mute",
672
689
  onClick: n[2] ||= (e) => i("toggleMute")
673
- }, [e.muted || e.volume === 0 ? (b(), a(E(ke), {
690
+ }, [e.muted || e.volume === 0 ? (b(), a(E(je), {
674
691
  key: 0,
675
692
  size: 18
676
- })) : (b(), a(E(Oe), {
693
+ })) : (b(), a(E(Ae), {
677
694
  key: 1,
678
695
  size: 18
679
- }))], 8, Re), c("input", {
696
+ }))], 8, Be), c("input", {
680
697
  class: "media-control-range media-control-volume",
681
698
  type: "range",
682
699
  min: "0",
@@ -687,14 +704,14 @@ var Ne = /* @__PURE__ */ d({
687
704
  "aria-label": "Video volume",
688
705
  "aria-valuetext": `${Math.round(e.volume * 100)} percent`,
689
706
  onInput: n[3] ||= (e) => i("volumeChange", d(e))
690
- }, null, 44, ze)]),
691
- c("output", Be, T(u(p.value)) + " / " + T(u(f.value)), 1)
707
+ }, null, 44, Ve)]),
708
+ c("output", He, T(u(p.value)) + " / " + T(u(f.value)), 1)
692
709
  ])) : o("", !0)], 34));
693
710
  }
694
711
  });
695
712
  //#endregion
696
713
  //#region src/components/useReelVideoActivity.ts
697
- function He(e) {
714
+ function We(e) {
698
715
  let t = r(() => e.layout() !== "reel" || e.active() === !0), n = r(() => t.value ? e.videoIsMuted.value : !0);
699
716
  function i() {
700
717
  if (!t.value) {
@@ -728,21 +745,21 @@ function He(e) {
728
745
  }
729
746
  //#endregion
730
747
  //#region src/core/mediaType.ts
731
- var Ue = /\.(aac|flac|m4a|mp3|mp4|mov|ogg|opus|wav|webm)$/i;
732
- function We(e) {
748
+ var Ge = /\.(aac|flac|m4a|mp3|mp4|mov|ogg|opus|wav|webm)$/i;
749
+ function Ke(e) {
733
750
  try {
734
- return Ue.test(new URL(e).pathname);
751
+ return Ge.test(new URL(e).pathname);
735
752
  } catch {
736
- return Ue.test(e.split("?")[0] ?? e);
753
+ return Ge.test(e.split("?")[0] ?? e);
737
754
  }
738
755
  }
739
- function Ge(e, t) {
740
- return e === void 0 ? We(t) : e === "video";
756
+ function qe(e, t) {
757
+ return e === void 0 ? Ke(t) : e === "video";
741
758
  }
742
759
  //#endregion
743
760
  //#region src/components/useMediaLoading.ts
744
- function Ke(e) {
745
- let t = r(() => Ge(e.mediaType(), e.mediaSource())), n = r(() => e.layout() === "masonry" && e.fetchPriority() === "low" ? "lazy" : "eager"), i = r(() => e.layout() === "reel" && !e.active() ? "none" : e.fetchPriority() === "high" ? "auto" : e.layout() === "masonry" ? "none" : "metadata");
761
+ function Je(e) {
762
+ let t = r(() => qe(e.mediaType(), e.mediaSource())), n = r(() => e.layout() === "masonry" && e.fetchPriority() === "low" ? "lazy" : "eager"), i = r(() => e.layout() === "reel" && !e.active() ? "none" : e.fetchPriority() === "high" ? "auto" : e.layout() === "masonry" ? "none" : "metadata");
746
763
  return O(i, (t, n) => {
747
764
  n !== "none" || t === "none" || m(() => e.videoElement.value?.load());
748
765
  }), {
@@ -753,7 +770,7 @@ function Ke(e) {
753
770
  }
754
771
  //#endregion
755
772
  //#region src/components/useMediaReadiness.ts
756
- function qe(e) {
773
+ function Ye(e) {
757
774
  let t = w(null), n = w(null), i = w(0), a = w(0), o = w(!0), s = w(!1), c = null, l = !1, u = r(() => s.value ? "error" : o.value ? "loading" : e.previewState());
758
775
  function d() {
759
776
  c !== null && clearTimeout(c), c = null;
@@ -810,7 +827,7 @@ function qe(e) {
810
827
  }
811
828
  //#endregion
812
829
  //#region src/components/MediaCard.vue?vue&type=script&setup=true&lang.ts
813
- var Je = [
830
+ var Xe = [
814
831
  "data-post-id",
815
832
  "data-media-index",
816
833
  "aria-hidden",
@@ -818,12 +835,12 @@ var Je = [
818
835
  "inert",
819
836
  "role",
820
837
  "tabindex"
821
- ], Ye = { class: "media-card-content" }, Xe = ["data-media-direction"], Ze = ["data-media-index"], Qe = {
838
+ ], Ze = { class: "media-card-content" }, Qe = ["data-media-direction"], $e = ["data-media-index"], et = {
822
839
  key: 0,
823
840
  "data-test": "media-loading",
824
841
  class: "media-loading",
825
842
  "aria-hidden": "true"
826
- }, $e = ["aria-label"], et = { class: "media-error-code" }, tt = [
843
+ }, tt = ["aria-label"], nt = { class: "media-error-code" }, rt = [
827
844
  "data-source-generation",
828
845
  "src",
829
846
  "width",
@@ -832,14 +849,14 @@ var Je = [
832
849
  "loop",
833
850
  "muted",
834
851
  "preload"
835
- ], nt = [
852
+ ], it = [
836
853
  "data-source-generation",
837
854
  "src",
838
855
  "width",
839
856
  "height",
840
857
  "fetchpriority",
841
858
  "loading"
842
- ], rt = ["aria-label"], it = ["aria-label"], at = ["aria-label"], ot = 40, st = 160, ct = 24, lt = /* @__PURE__ */ d({
859
+ ], at = ["aria-label"], ot = ["aria-label"], st = ["aria-label"], ct = 40, lt = 160, ut = 24, dt = /* @__PURE__ */ d({
843
860
  __name: "MediaCard",
844
861
  props: {
845
862
  active: { type: Boolean },
@@ -875,124 +892,124 @@ var Je = [
875
892
  function S(e = !1, t = "pointer") {
876
893
  e && x("activate", t);
877
894
  }
878
- let C = r(() => M(l.item)), D = r(() => N(l.item, l.mediaIndex)), O = r(() => P(l.item, D.value)), F = r(() => l.mediaSource === "original" ? O.value.src : O.value.preview.src), I = r(() => l.mediaSource === "original" ? O.value.type : O.value.preview.type ?? O.value.type), L = r(() => l.mediaSource === "original" ? O.value.width : O.value.preview.width), R = r(() => l.mediaSource === "original" ? O.value.height : O.value.preview.height), { effectivePreviewState: z, failSourceAttempt: B, imageElement: ee, markSourceReady: V, noteSourceActivity: H, retrySource: U, sourceGeneration: W, videoElement: G } = qe({
879
- identity: () => `${l.item.postId}:${D.value}:${l.mediaSource ?? "preview"}:${F.value}:${I.value ?? ""}`,
895
+ let C = r(() => P(l.item)), D = r(() => F(l.item, l.mediaIndex)), O = r(() => I(l.item, D.value)), M = r(() => N(O.value, l.mediaSource ?? "preview")), L = r(() => M.value.src), R = r(() => M.value.type), z = r(() => M.value.width), B = r(() => M.value.height), { effectivePreviewState: V, failSourceAttempt: H, imageElement: ee, markSourceReady: U, noteSourceActivity: W, retrySource: te, sourceGeneration: G, videoElement: K } = Ye({
896
+ identity: () => `${l.item.postId}:${D.value}:${l.mediaSource ?? "preview"}:${L.value}:${R.value ?? ""}`,
880
897
  mediaIndex: () => D.value,
881
898
  onError: (e) => x("error", e),
882
899
  onReady: (e) => x("ready", e),
883
900
  previewState: () => l.previewState
884
- }), te = w(0), ne = w(0), re = w(l.mediaCard?.videoMuted ?? l.layout === "masonry"), K = w(!1), ie = w(1), ae = 1, { effectiveMuted: oe, onPlaying: q, playbackAllowed: se } = He({
901
+ }), ne = w(0), q = w(0), re = w(l.mediaCard?.videoMuted ?? l.layout === "masonry"), J = w(!1), ie = w(1), ae = 1, { effectiveMuted: oe, onPlaying: Y, playbackAllowed: X } = We({
885
902
  active: () => l.active,
886
903
  layout: () => l.layout,
887
- videoElement: G,
904
+ videoElement: K,
888
905
  videoIsMuted: re,
889
- videoIsPlaying: K
890
- }), J = r(() => l.interactive && !!(l.cardHeader || l.cardFooter));
891
- function Y(e) {
906
+ videoIsPlaying: J
907
+ }), Z = r(() => l.interactive && !!(l.cardHeader || l.cardFooter));
908
+ function se(e) {
892
909
  return e.detail === 0 ? "keyboard" : "pointer";
893
910
  }
894
- function X(e, t) {
911
+ function ce(e, t) {
895
912
  let n = C.value.length, r = (e + n) % n;
896
913
  r !== D.value && (y.value = e < D.value ? "previous" : "next", x("mediaChange", r), t && t.detail > 0 && t.currentTarget?.blur());
897
914
  }
898
- function Z(e, t, n) {
915
+ function le(e, t, n) {
899
916
  return t === 1 ? e * 16 : t === 2 ? e * n : e;
900
917
  }
901
- function ce() {
918
+ function ue() {
902
919
  f = 0, p = !1, d !== null && clearTimeout(d), d = null;
903
920
  }
904
- function le() {
905
- d !== null && clearTimeout(d), d = setTimeout(ce, st);
921
+ function de() {
922
+ d !== null && clearTimeout(d), d = setTimeout(ue, lt);
906
923
  }
907
- function ue(e) {
924
+ function fe(e) {
908
925
  if (C.value.length <= 1) return;
909
- let t = e.currentTarget?.clientWidth || 1, n = Z(e.deltaX, e.deltaMode, t);
910
- if (n === 0 || (e.preventDefault(), le(), p) || (f += n, Math.abs(f) < ct)) return;
926
+ let t = e.currentTarget?.clientWidth || 1, n = le(e.deltaX, e.deltaMode, t);
927
+ if (n === 0 || (e.preventDefault(), de(), p) || (f += n, Math.abs(f) < ut)) return;
911
928
  let r = Math.sign(f);
912
- f = 0, p = !0, X(D.value + r);
929
+ f = 0, p = !0, ce(D.value + r);
913
930
  }
914
- function de(e) {
931
+ function pe(e) {
915
932
  let t = e.touches[0];
916
933
  l.layout !== "reel" || !t || (m = t.clientX, g = t.clientY);
917
934
  }
918
- function fe(e) {
935
+ function me(e) {
919
936
  let t = e.changedTouches[0];
920
937
  if (m === null || g === null || !t) return;
921
938
  let n = m - t.clientX, r = g - t.clientY;
922
- m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) < ot || X(D.value + Math.sign(n)));
939
+ m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) < ct || ce(D.value + Math.sign(n)));
923
940
  }
924
- let { imageLoading: pe, mediaIsTimed: me, videoPreload: he } = Ke({
941
+ let { imageLoading: he, mediaIsTimed: ge, videoPreload: _e } = Je({
925
942
  active: () => l.active,
926
943
  fetchPriority: () => l.fetchPriority,
927
944
  layout: () => l.layout,
928
- mediaSource: () => F.value,
929
- mediaType: () => I.value,
930
- videoElement: G
931
- }), ge = r(() => l.layout === "reel" && l.stationaryReelControls === !0), _e = r(() => me.value && z.value === "ready" && (!ge.value || !!(l.active && l.reelControlsTarget))), ve = r(() => `${l.item.postId}:${D.value}:${F.value}`);
932
- function ye(e) {
933
- l.layout === "reel" && (e.stopPropagation(), be());
945
+ mediaSource: () => L.value,
946
+ mediaType: () => R.value,
947
+ videoElement: K
948
+ }), ve = r(() => l.layout === "reel" && l.stationaryReelControls === !0), ye = r(() => ge.value && V.value === "ready" && (!ve.value || !!(l.active && l.reelControlsTarget))), be = r(() => `${l.item.postId}:${D.value}:${L.value}`);
949
+ function xe(e) {
950
+ l.layout === "reel" && (e.stopPropagation(), Se());
934
951
  }
935
- async function be() {
936
- if (!(!G.value || !se.value)) {
937
- if (K.value) {
938
- G.value.pause();
952
+ async function Se() {
953
+ if (!(!K.value || !X.value)) {
954
+ if (J.value) {
955
+ K.value.pause();
939
956
  return;
940
957
  }
941
958
  try {
942
- await G.value.play();
959
+ await K.value.play();
943
960
  } catch {
944
- K.value = !1;
961
+ J.value = !1;
945
962
  }
946
963
  }
947
964
  }
948
- function xe(e) {
965
+ function Ce(e) {
949
966
  return Number.isFinite(e) ? Math.max(0, e) : 0;
950
967
  }
951
- function Se(e) {
952
- let t = e?.currentTarget ?? G.value;
953
- t && (te.value = xe(t.currentTime), ne.value = xe(t.duration), se.value && (re.value = t.muted), ie.value = t.volume, t.volume > 0 && (ae = t.volume));
968
+ function we(e) {
969
+ let t = e?.currentTarget ?? K.value;
970
+ t && (ne.value = Ce(t.currentTime), q.value = Ce(t.duration), X.value && (re.value = t.muted), ie.value = t.volume, t.volume > 0 && (ae = t.volume));
954
971
  }
955
- function Ce(e) {
956
- Se(e), V(e);
972
+ function Te(e) {
973
+ we(e), U(e);
957
974
  }
958
- function Ee() {
959
- K.value = !1, x("ended", D.value);
975
+ function Oe() {
976
+ J.value = !1, x("ended", D.value);
960
977
  }
961
- function De(e) {
962
- let t = G.value;
963
- !t || !Number.isFinite(e) || (t.currentTime = Math.min(xe(t.duration), Math.max(0, e)), te.value = t.currentTime);
978
+ function ke(e) {
979
+ let t = K.value;
980
+ !t || !Number.isFinite(e) || (t.currentTime = Math.min(Ce(t.duration), Math.max(0, e)), ne.value = t.currentTime);
964
981
  }
965
- function Oe(e) {
966
- let t = G.value;
982
+ function Ae(e) {
983
+ let t = K.value;
967
984
  if (!t || !Number.isFinite(e)) return;
968
985
  let n = Math.min(1, Math.max(0, e));
969
- t.volume = n, t.muted = n === 0, n > 0 && (ae = n), Se();
986
+ t.volume = n, t.muted = n === 0, n > 0 && (ae = n), we();
970
987
  }
971
- function ke() {
972
- let e = G.value;
973
- e && (e.muted && e.volume === 0 && (e.volume = ae), e.muted = !e.muted, Se());
988
+ function je() {
989
+ let e = K.value;
990
+ e && (e.muted && e.volume === 0 && (e.volume = ae), e.muted = !e.muted, we());
974
991
  }
975
992
  return v(() => {
976
- ce();
993
+ ue();
977
994
  }), (r, i) => (b(), s("article", {
978
995
  "data-post-id": e.item.postId,
979
996
  "data-media-index": D.value,
980
997
  class: h(["media-card", {
981
998
  "media-card--entering": e.entering,
982
999
  "media-card--leaving": e.leaving,
983
- "media-card--error": E(z) === "error",
1000
+ "media-card--error": E(V) === "error",
984
1001
  "media-card--transparent-chrome": e.mediaCard?.header?.background === "transparent" || e.mediaCard?.footer?.background === "transparent" || e.cardHeader?.background === "transparent" || e.cardFooter?.background === "transparent"
985
1002
  }]),
986
1003
  style: _(e.itemStyle),
987
1004
  "aria-hidden": e.leaving || void 0,
988
- "aria-busy": E(z) === "loading",
1005
+ "aria-busy": E(V) === "loading",
989
1006
  inert: e.leaving || void 0,
990
- role: e.interactive && !e.leaving && !J.value ? "button" : void 0,
991
- tabindex: e.interactive && !e.leaving && !J.value ? 0 : void 0,
992
- onClick: i[15] ||= (t) => S(e.interactive && !J.value, Y(t)),
993
- onKeydown: [i[16] ||= A((t) => S(e.interactive && !J.value, "keyboard"), ["enter"]), i[17] ||= A(j((t) => S(e.interactive && !J.value, "keyboard"), ["prevent"]), ["space"])]
994
- }, [c("div", Ye, [
995
- e.cardHeader ? (b(), a(Ne, {
1007
+ role: e.interactive && !e.leaving && !Z.value ? "button" : void 0,
1008
+ tabindex: e.interactive && !e.leaving && !Z.value ? 0 : void 0,
1009
+ onClick: i[15] ||= (t) => S(e.interactive && !Z.value, se(t)),
1010
+ onKeydown: [i[16] ||= A((t) => S(e.interactive && !Z.value, "keyboard"), ["enter"]), i[17] ||= A(j((t) => S(e.interactive && !Z.value, "keyboard"), ["prevent"]), ["space"])]
1011
+ }, [c("div", Ze, [
1012
+ e.cardHeader ? (b(), a(Fe, {
996
1013
  key: 0,
997
1014
  index: e.index,
998
1015
  item: e.item,
@@ -1018,96 +1035,96 @@ var Je = [
1018
1035
  c("div", {
1019
1036
  class: h(["media-card-media", { "media-card-media--carousel": e.layout === "reel" && C.value.length > 1 }]),
1020
1037
  "data-media-direction": y.value,
1021
- onWheel: ue,
1022
- onTouchstartPassive: de,
1023
- onTouchendPassive: fe
1038
+ onWheel: fe,
1039
+ onTouchstartPassive: pe,
1040
+ onTouchendPassive: me
1024
1041
  }, [
1025
1042
  u(n, { name: `media-slide-${y.value}` }, {
1026
1043
  default: k(() => [(b(), s("div", {
1027
- key: `${e.item.postId}:${O.value.src}:${e.mediaSource ?? "preview"}:${E(W)}`,
1044
+ key: `${e.item.postId}:${O.value.src}:${e.mediaSource ?? "preview"}:${E(G)}`,
1028
1045
  class: "media-card-frame",
1029
1046
  "data-media-index": D.value
1030
- }, [E(z) === "loading" ? (b(), s("div", Qe, [...i[18] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : E(z) === "error" ? (b(), s("div", {
1047
+ }, [E(V) === "loading" ? (b(), s("div", et, [...i[18] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : E(V) === "error" ? (b(), s("div", {
1031
1048
  key: 1,
1032
1049
  "data-test": "media-error",
1033
1050
  class: "media-error",
1034
1051
  role: "img",
1035
- "aria-label": `${E(je)(F.value)} ${E(Me)(F.value)}`
1052
+ "aria-label": `${E(Ne)(L.value)} ${E(Pe)(L.value)}`
1036
1053
  }, [
1037
- c("strong", et, T(E(je)(F.value)), 1),
1038
- c("span", null, T(E(Me)(F.value)), 1),
1054
+ c("strong", nt, T(E(Ne)(L.value)), 1),
1055
+ c("span", null, T(E(Pe)(L.value)), 1),
1039
1056
  c("button", {
1040
1057
  type: "button",
1041
1058
  "data-test": "media-retry",
1042
- onClick: i[0] ||= j((...e) => E(U) && E(U)(...e), ["stop"])
1059
+ onClick: i[0] ||= j((...e) => E(te) && E(te)(...e), ["stop"])
1043
1060
  }, "Retry")
1044
- ], 8, $e)) : o("", !0), E(me) ? (b(), s("video", {
1061
+ ], 8, tt)) : o("", !0), E(ge) ? (b(), s("video", {
1045
1062
  key: 2,
1046
1063
  ref_key: "videoElement",
1047
- ref: G,
1048
- "data-source-generation": E(W),
1064
+ ref: K,
1065
+ "data-source-generation": E(G),
1049
1066
  class: h(["media-preview", {
1050
- "media-preview--ready": E(z) === "ready",
1067
+ "media-preview--ready": E(V) === "ready",
1051
1068
  "media-preview--reel-video": e.layout === "reel"
1052
1069
  }]),
1053
- src: F.value,
1054
- width: L.value ?? void 0,
1055
- height: R.value ?? void 0,
1056
- autoplay: E(se),
1070
+ src: L.value,
1071
+ width: z.value ?? void 0,
1072
+ height: B.value ?? void 0,
1073
+ autoplay: E(X),
1057
1074
  loop: !e.advanceOnMediaEnd,
1058
1075
  muted: E(oe),
1059
1076
  playsinline: "",
1060
- preload: E(he),
1061
- onLoadedmetadata: Ce,
1062
- onProgress: i[1] ||= (...e) => E(H) && E(H)(...e),
1063
- onLoadeddata: i[2] ||= (...e) => E(H) && E(H)(...e),
1064
- onCanplay: i[3] ||= (...e) => E(H) && E(H)(...e),
1065
- onDurationchange: Se,
1066
- onTimeupdate: Se,
1067
- onVolumechange: Se,
1068
- onPlaying: i[4] ||= (...e) => E(q) && E(q)(...e),
1069
- onPause: i[5] ||= (e) => K.value = !1,
1070
- onEnded: Ee,
1071
- onClick: ye,
1072
- onError: i[6] ||= (...e) => E(B) && E(B)(...e)
1073
- }, null, 42, tt)) : (b(), s("img", {
1077
+ preload: E(_e),
1078
+ onLoadedmetadata: Te,
1079
+ onProgress: i[1] ||= (...e) => E(W) && E(W)(...e),
1080
+ onLoadeddata: i[2] ||= (...e) => E(W) && E(W)(...e),
1081
+ onCanplay: i[3] ||= (...e) => E(W) && E(W)(...e),
1082
+ onDurationchange: we,
1083
+ onTimeupdate: we,
1084
+ onVolumechange: we,
1085
+ onPlaying: i[4] ||= (...e) => E(Y) && E(Y)(...e),
1086
+ onPause: i[5] ||= (e) => J.value = !1,
1087
+ onEnded: Oe,
1088
+ onClick: xe,
1089
+ onError: i[6] ||= (...e) => E(H) && E(H)(...e)
1090
+ }, null, 42, rt)) : (b(), s("img", {
1074
1091
  key: 3,
1075
1092
  ref_key: "imageElement",
1076
1093
  ref: ee,
1077
- "data-source-generation": E(W),
1078
- class: h(["media-preview", { "media-preview--ready": E(z) === "ready" }]),
1079
- src: F.value,
1080
- width: L.value ?? void 0,
1081
- height: R.value ?? void 0,
1094
+ "data-source-generation": E(G),
1095
+ class: h(["media-preview", { "media-preview--ready": E(V) === "ready" }]),
1096
+ src: L.value,
1097
+ width: z.value ?? void 0,
1098
+ height: B.value ?? void 0,
1082
1099
  fetchpriority: e.fetchPriority,
1083
1100
  alt: "",
1084
1101
  decoding: "async",
1085
- loading: E(pe),
1086
- onLoad: i[7] ||= (...e) => E(V) && E(V)(...e),
1087
- onError: i[8] ||= (...e) => E(B) && E(B)(...e)
1088
- }, null, 42, nt))], 8, Ze))]),
1102
+ loading: E(he),
1103
+ onLoad: i[7] ||= (...e) => E(U) && E(U)(...e),
1104
+ onError: i[8] ||= (...e) => E(H) && E(H)(...e)
1105
+ }, null, 42, it))], 8, $e))]),
1089
1106
  _: 1
1090
1107
  }, 8, ["name"]),
1091
1108
  (b(), a(t, {
1092
- disabled: !ge.value || !e.reelControlsTarget,
1109
+ disabled: !ve.value || !e.reelControlsTarget,
1093
1110
  to: e.reelControlsTarget ?? "body"
1094
1111
  }, [u(n, {
1095
1112
  name: "vibe-reel-media-controls",
1096
- css: ge.value
1113
+ css: ve.value
1097
1114
  }, {
1098
- default: k(() => [_e.value ? (b(), a(Ve, {
1099
- key: ve.value,
1100
- "current-time": te.value,
1101
- "data-control-post-id": ge.value ? e.item.postId : void 0,
1102
- duration: ne.value,
1115
+ default: k(() => [ye.value ? (b(), a(Ue, {
1116
+ key: be.value,
1117
+ "current-time": ne.value,
1118
+ "data-control-post-id": ve.value ? e.item.postId : void 0,
1119
+ duration: q.value,
1103
1120
  layout: e.layout,
1104
1121
  muted: re.value,
1105
- playing: K.value,
1122
+ playing: J.value,
1106
1123
  volume: ie.value,
1107
- onSeek: De,
1108
- onToggleMute: ke,
1109
- onTogglePlayback: be,
1110
- onVolumeChange: Oe
1124
+ onSeek: ke,
1125
+ onToggleMute: je,
1126
+ onTogglePlayback: Se,
1127
+ onVolumeChange: Ae
1111
1128
  }, null, 8, [
1112
1129
  "current-time",
1113
1130
  "data-control-post-id",
@@ -1127,25 +1144,25 @@ var Je = [
1127
1144
  type: "button",
1128
1145
  class: "media-carousel-control media-carousel-control--previous",
1129
1146
  "aria-label": `Previous media for post ${e.item.postId}`,
1130
- onClick: i[9] ||= j((e) => X(D.value - 1, e), ["stop"]),
1147
+ onClick: i[9] ||= j((e) => ce(D.value - 1, e), ["stop"]),
1131
1148
  onKeydown: i[10] ||= j(() => {}, ["stop"])
1132
- }, [u(E(we), { size: 20 })], 40, rt), c("button", {
1149
+ }, [u(E(Ee), { size: 20 })], 40, at), c("button", {
1133
1150
  type: "button",
1134
1151
  class: "media-carousel-control media-carousel-control--next",
1135
1152
  "aria-label": `Next media for post ${e.item.postId}`,
1136
- onClick: i[11] ||= j((e) => X(D.value + 1, e), ["stop"]),
1153
+ onClick: i[11] ||= j((e) => ce(D.value + 1, e), ["stop"]),
1137
1154
  onKeydown: i[12] ||= j(() => {}, ["stop"])
1138
- }, [u(E(Te), { size: 20 })], 40, it)], 2)) : o("", !0),
1139
- J.value ? (b(), s("button", {
1155
+ }, [u(E(De), { size: 20 })], 40, ot)], 2)) : o("", !0),
1156
+ Z.value ? (b(), s("button", {
1140
1157
  key: 1,
1141
1158
  class: "media-card-activator",
1142
1159
  type: "button",
1143
1160
  "aria-label": `Open post ${e.item.postId}`,
1144
- onClick: i[13] ||= j((e) => r.$emit("activate", Y(e)), ["stop"]),
1161
+ onClick: i[13] ||= j((e) => r.$emit("activate", se(e)), ["stop"]),
1145
1162
  onKeydown: i[14] ||= j(() => {}, ["stop"])
1146
- }, null, 40, at)) : o("", !0)
1147
- ], 42, Xe),
1148
- e.cardFooter ? (b(), a(Ne, {
1163
+ }, null, 40, st)) : o("", !0)
1164
+ ], 42, Qe),
1165
+ e.cardFooter ? (b(), a(Fe, {
1149
1166
  key: 1,
1150
1167
  index: e.index,
1151
1168
  item: e.item,
@@ -1168,12 +1185,12 @@ var Je = [
1168
1185
  "style",
1169
1186
  "total"
1170
1187
  ])) : o("", !0)
1171
- ])], 46, Je));
1188
+ ])], 46, Xe));
1172
1189
  }
1173
- }), ut = { class: "masonry-feed-shell" }, dt = ["aria-hidden", "inert"], ft = {
1190
+ }), ft = { class: "masonry-feed-shell" }, pt = ["aria-hidden", "inert"], mt = {
1174
1191
  key: 0,
1175
1192
  class: "masonry-feed-status-overlay"
1176
- }, pt = 6, mt = 12, ht = 250, gt = /* @__PURE__ */ d({
1193
+ }, ht = 6, gt = 12, _t = 250, vt = /* @__PURE__ */ d({
1177
1194
  __name: "MasonryFeed",
1178
1195
  props: {
1179
1196
  enteringPostIds: {},
@@ -1209,10 +1226,10 @@ var Je = [
1209
1226
  "visible"
1210
1227
  ],
1211
1228
  setup(t, { expose: n, emit: i }) {
1212
- let l = 0, d = t, f = i, p = w(null), m = `vibe-masonry-${D()}`, g = w(null), y = w(0), x = w(pt), C = w(0), T = w(0), k = w(0), A = w([]), j = w([]), M = 0, N = null, P = null, I = null, L = null, R = r(() => ae(d.items, y.value, {
1229
+ let l = 0, d = t, f = i, p = w(null), m = `vibe-masonry-${D()}`, g = w(null), y = w(0), x = w(ht), C = w(0), T = w(0), k = w(0), A = w([]), j = w([]), M = 0, N = null, P = null, F = null, I = null, R = r(() => ae(d.items, y.value, {
1213
1230
  additionalHeight: (d.cardHeader?.height ?? 0) + (d.cardFooter?.height ?? 0),
1214
1231
  gap: x.value,
1215
- minColumnWidth: J(d.masonry)
1232
+ minColumnWidth: Z(d.masonry)
1216
1233
  })), z = r(() => {
1217
1234
  if (d.leavingPostIds.size === 0) return null;
1218
1235
  let e = d.items.flatMap((e, t) => d.leavingPostIds.has(e.postId) ? [] : [{
@@ -1221,7 +1238,7 @@ var Je = [
1221
1238
  }]), t = ae(e.map(({ item: e }) => e), y.value, {
1222
1239
  additionalHeight: (d.cardHeader?.height ?? 0) + (d.cardFooter?.height ?? 0),
1223
1240
  gap: x.value,
1224
- minColumnWidth: J(d.masonry)
1241
+ minColumnWidth: Z(d.masonry)
1225
1242
  });
1226
1243
  return {
1227
1244
  indices: e.map(({ index: e }) => e),
@@ -1234,53 +1251,53 @@ var Je = [
1234
1251
  ...t.layout,
1235
1252
  items: d.items.map((n, r) => d.leavingPostIds.has(n.postId) ? e.items[r] : t.positions.get(n.postId) ?? e.items[r])
1236
1253
  } : e;
1237
- }), ee = r(() => oe(R.value.items)), V = r(() => {
1254
+ }), V = r(() => oe(R.value.items)), H = r(() => {
1238
1255
  let e = z.value;
1239
1256
  return e ? oe(e.layout.items, e.indices) : null;
1240
- }), H = r(() => Math.max(T.value, d.leavingPostIds.size === 0 ? B.value.height : R.value.height)), W = r(() => ({ height: `${H.value}px` })), G = r(() => !d.infiniteScroll || C.value > 0 && k.value + B.value.height <= C.value + 1), te = r(() => new Set(A.value)), re = r(() => j.value.flatMap((e) => {
1257
+ }), ee = r(() => Math.max(T.value, d.leavingPostIds.size === 0 ? B.value.height : R.value.height)), U = r(() => ({ height: `${ee.value}px` })), W = r(() => !d.infiniteScroll || C.value > 0 && k.value + B.value.height <= C.value + 1), G = r(() => new Set(A.value)), K = r(() => j.value.flatMap((e) => {
1241
1258
  let t = d.items[e];
1242
1259
  return t ? [{
1243
- fetchPriority: te.value.has(e) ? "high" : "low",
1260
+ fetchPriority: G.value.has(e) ? "high" : "low",
1244
1261
  index: e,
1245
1262
  item: t
1246
1263
  }] : [];
1247
1264
  }));
1248
- function K(e, t) {
1265
+ function ne(e, t) {
1249
1266
  return [...new Set([...e, ...t])].sort((e, t) => e - t);
1250
1267
  }
1251
- function q(e, t) {
1268
+ function re(e, t) {
1252
1269
  return e.length === t.length && e.every((e, n) => e === t[n]);
1253
1270
  }
1254
- function X(e) {
1271
+ function J(e) {
1255
1272
  let t = {
1256
1273
  scrollTop: M - k.value,
1257
1274
  viewportHeight: C.value
1258
- }, n = V.value, r = se(n ?? ee.value, {
1275
+ }, n = H.value, r = X(n ?? V.value, {
1259
1276
  ...t,
1260
1277
  overscan: e
1261
1278
  }).indices;
1262
- return K(r, d.leavingPostIds.size === 0 ? [] : se(ee.value, {
1279
+ return ne(r, d.leavingPostIds.size === 0 ? [] : X(V.value, {
1263
1280
  ...t,
1264
1281
  overscan: e
1265
1282
  }).indices);
1266
1283
  }
1267
- function Z() {
1268
- let e = d.suspended ? [] : X(0), t = X(Y(d.masonry, C.value));
1269
- q(A.value, e) || (A.value = e), q(j.value, t) || (j.value = t);
1284
+ function Y() {
1285
+ let e = J(0), t = J(se(d.masonry, C.value));
1286
+ re(A.value, e) || (A.value = e), re(j.value, t) || (j.value = t);
1270
1287
  }
1271
1288
  function ce() {
1272
- if (L !== null) return;
1273
- L = -1;
1289
+ if (I !== null) return;
1290
+ I = -1;
1274
1291
  let e = requestAnimationFrame(() => {
1275
- L = null, Z();
1292
+ I = null, Y();
1276
1293
  });
1277
- L !== null && (L = e);
1294
+ I !== null && (I = e);
1278
1295
  }
1279
1296
  let le = /* @__PURE__ */ new Set();
1280
- O(() => [...te.value].flatMap((e) => {
1297
+ O(() => [...G.value].flatMap((e) => {
1281
1298
  let t = d.items[e];
1282
1299
  if (!t) return [];
1283
- let n = d.mediaIndices.get(t.postId) ?? 0, r = F(t.postId, n);
1300
+ let n = d.mediaIndices.get(t.postId) ?? 0, r = L(t.postId, n);
1284
1301
  return d.previewStates.get(r) === "ready" ? [{
1285
1302
  key: r,
1286
1303
  mediaIndex: n,
@@ -1316,31 +1333,31 @@ var Je = [
1316
1333
  let t = e.ownerDocument.defaultView?.getComputedStyle(e), n = (Number.parseFloat(t?.paddingTop ?? "") || 0) + (Number.parseFloat(t?.paddingBottom ?? "") || 0);
1317
1334
  T.value = Math.max(0, e.clientHeight - n);
1318
1335
  let r = g.value;
1319
- r && (k.value = r.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop, Z());
1336
+ r && (k.value = r.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop, Y());
1320
1337
  }
1321
1338
  function fe(e) {
1322
1339
  let t = e.ownerDocument.documentElement.clientWidth;
1323
- y.value = e.clientWidth, x.value = Math.min(mt, Math.max(pt, t * .0075)), de();
1340
+ y.value = e.clientWidth, x.value = Math.min(gt, Math.max(ht, t * .0075)), de();
1324
1341
  }
1325
1342
  function pe(e) {
1326
1343
  let t = e.currentTarget;
1327
- t && (M = t.scrollTop, ce(), Date.now() >= l && !d.loadMoreLocked && d.infiniteScroll && ne(t) && f("loadMore"));
1344
+ t && (M = t.scrollTop, ce(), Date.now() >= l && !d.loadMoreLocked && d.infiniteScroll && q(t) && f("loadMore"));
1328
1345
  }
1329
- function he() {
1346
+ function me() {
1330
1347
  let e = p.value;
1331
- Date.now() >= l && !d.loadMoreLocked && e && ne(e) && f("loadMore");
1348
+ Date.now() >= l && !d.loadMoreLocked && e && q(e) && f("loadMore");
1332
1349
  }
1333
1350
  O(() => d.items.length, (e, t) => {
1334
- e > 0 && e < t && (l = Date.now() + ht);
1351
+ e > 0 && e < t && (l = Date.now() + _t);
1335
1352
  });
1336
- function ge() {
1353
+ function he() {
1337
1354
  return p.value;
1338
1355
  }
1339
1356
  return O(g, (e) => {
1340
- N?.disconnect(), N = null, I !== null && cancelAnimationFrame(I), e && (fe(e), !(typeof ResizeObserver > "u") && (N = new ResizeObserver(([t]) => {
1357
+ N?.disconnect(), N = null, F !== null && cancelAnimationFrame(F), e && (fe(e), !(typeof ResizeObserver > "u") && (N = new ResizeObserver(([t]) => {
1341
1358
  let n = t?.contentRect.width ?? e.clientWidth;
1342
- Math.abs(n - y.value) < .5 || (I = requestAnimationFrame(() => {
1343
- I = null, fe(e);
1359
+ Math.abs(n - y.value) < .5 || (F = requestAnimationFrame(() => {
1360
+ F = null, fe(e);
1344
1361
  }));
1345
1362
  }), N.observe(e)));
1346
1363
  }), O(p, (e) => {
@@ -1348,14 +1365,13 @@ var Je = [
1348
1365
  }), O([
1349
1366
  R,
1350
1367
  B,
1351
- () => d.suspended,
1352
1368
  () => d.masonry
1353
- ], Z, { flush: "post" }), v(() => {
1354
- N?.disconnect(), P?.disconnect(), I !== null && cancelAnimationFrame(I), L !== null && cancelAnimationFrame(L);
1369
+ ], Y, { flush: "post" }), v(() => {
1370
+ N?.disconnect(), P?.disconnect(), F !== null && cancelAnimationFrame(F), I !== null && cancelAnimationFrame(I);
1355
1371
  }), n({
1356
- getScrollElement: ge,
1357
- loadIfNearBottom: he
1358
- }), (n, r) => (b(), s("div", ut, [
1372
+ getScrollElement: he,
1373
+ loadIfNearBottom: me
1374
+ }), (n, r) => (b(), s("div", ft, [
1359
1375
  c("main", {
1360
1376
  id: m,
1361
1377
  ref_key: "galleryElement",
@@ -1369,9 +1385,9 @@ var Je = [
1369
1385
  ref_key: "masonryElement",
1370
1386
  ref: g,
1371
1387
  class: h(["masonry", { "masonry--ready": y.value > 0 }]),
1372
- style: _(W.value),
1388
+ style: _(U.value),
1373
1389
  "aria-label": "Media gallery"
1374
- }, [(b(!0), s(e, null, S(re.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(lt, {
1390
+ }, [(b(!0), s(e, null, S(K.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(dt, {
1375
1391
  key: n.postId,
1376
1392
  class: "masonry-item",
1377
1393
  entering: t.enteringPostIds.has(n.postId),
@@ -1387,7 +1403,7 @@ var Je = [
1387
1403
  layout: "masonry",
1388
1404
  "loaded-count": t.items.length,
1389
1405
  "media-index": t.mediaIndices.get(n.postId) ?? 0,
1390
- "preview-state": t.previewStates.get(E(F)(n.postId, t.mediaIndices.get(n.postId) ?? 0)) ?? "loading",
1406
+ "preview-state": t.previewStates.get(E(L)(n.postId, t.mediaIndices.get(n.postId) ?? 0)) ?? "loading",
1391
1407
  total: t.total,
1392
1408
  onActivate: (e) => f("activate", n.postId, e),
1393
1409
  onMediaChange: (e) => f("mediaChange", n.postId, e),
@@ -1411,8 +1427,8 @@ var Je = [
1411
1427
  "onMediaChange",
1412
1428
  "onReady",
1413
1429
  "onError"
1414
- ]))), 128))], 6)], 42, dt),
1415
- t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && G.value || !t.hasNext && t.canRetryEnd ? (b(), s("div", ft, [u(U, {
1430
+ ]))), 128))], 6)], 42, pt),
1431
+ t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && W.value || !t.hasNext && t.canRetryEnd ? (b(), s("div", mt, [u(te, {
1416
1432
  actions: t.feedFooterActions,
1417
1433
  "can-retry-end": t.canRetryEnd,
1418
1434
  "feed-footer": t.feedFooter,
@@ -1420,7 +1436,7 @@ var Je = [
1420
1436
  "has-next": t.hasNext,
1421
1437
  "is-loading": t.isLoadingMore,
1422
1438
  "load-more-locked": t.loadMoreLocked,
1423
- "show-load-more": G.value,
1439
+ "show-load-more": W.value,
1424
1440
  state: t.state,
1425
1441
  onLoadMore: r[0] ||= (e) => f("loadMore"),
1426
1442
  onRetryEnd: r[1] ||= (e) => f("retryEnd")
@@ -1435,7 +1451,7 @@ var Je = [
1435
1451
  "show-load-more",
1436
1452
  "state"
1437
1453
  ])])) : o("", !0),
1438
- u(me, {
1454
+ u(ge, {
1439
1455
  "content-size": B.value.height,
1440
1456
  "controls-id": m,
1441
1457
  "scroll-element": p.value,
@@ -1447,8 +1463,8 @@ var Je = [
1447
1463
  ])
1448
1464
  ]));
1449
1465
  }
1450
- }), _t = 300;
1451
- function vt(e, t, n) {
1466
+ }), yt = 300;
1467
+ function bt(e, t, n) {
1452
1468
  let r = e.scrollTop;
1453
1469
  if (n || Math.abs(r - t) <= 1) return e.scrollTop = t, Promise.resolve();
1454
1470
  e.setAttribute("data-transitioning", "");
@@ -1456,7 +1472,7 @@ function vt(e, t, n) {
1456
1472
  return new Promise((n) => {
1457
1473
  let o = (s) => {
1458
1474
  a += 1;
1459
- let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / _t), u = 1 - (1 - l) ** 3;
1475
+ let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / yt), u = 1 - (1 - l) ** 3;
1460
1476
  if (e.scrollTop = r + (t - r) * u, l < 1) {
1461
1477
  requestAnimationFrame(o);
1462
1478
  return;
@@ -1468,7 +1484,7 @@ function vt(e, t, n) {
1468
1484
  }
1469
1485
  //#endregion
1470
1486
  //#region src/components/ReelAutoAdvanceProgress.vue?vue&type=script&setup=true&lang.ts
1471
- var yt = ["aria-label"], bt = /* @__PURE__ */ d({
1487
+ var xt = ["aria-label"], St = /* @__PURE__ */ d({
1472
1488
  __name: "ReelAutoAdvanceProgress",
1473
1489
  props: {
1474
1490
  durationMs: {},
@@ -1486,9 +1502,9 @@ var yt = ["aria-label"], bt = /* @__PURE__ */ d({
1486
1502
  class: "reel-auto-advance-progress",
1487
1503
  style: _(a.value),
1488
1504
  onAnimationend: n[0] ||= (e) => i("complete")
1489
- }, null, 36)], 8, yt));
1505
+ }, null, 36)], 8, xt));
1490
1506
  }
1491
- }), xt = { class: "reel-viewport" }, St = ["data-active-post-id", "data-active-media-index"], Ct = ["role", "data-status"], wt = 2, Tt = 300, Et = 250, Dt = /* @__PURE__ */ d({
1507
+ }), Ct = { class: "reel-viewport" }, wt = ["data-active-post-id", "data-active-media-index"], Tt = ["role", "data-status"], Et = 2, Dt = 300, Ot = 250, kt = /* @__PURE__ */ d({
1492
1508
  __name: "ReelFeed",
1493
1509
  props: {
1494
1510
  initialPostId: {},
@@ -1525,31 +1541,31 @@ var yt = ["aria-label"], bt = /* @__PURE__ */ d({
1525
1541
  "retryForward"
1526
1542
  ],
1527
1543
  setup(t, { expose: n, emit: i }) {
1528
- let l = 0, u = t, d = i, f = w(null), p = w(null), g = u.initialPostId === null || u.initialPostId === void 0 ? -1 : u.items.findIndex((e) => e.postId === u.initialPostId), x = w(Math.max(0, g)), C = w(!1), D = w(!1), k = 0, A = null, j = null, N = null, I = r(() => ({ gridTemplateRows: `repeat(${u.items.length}, 100cqh)` })), L = r(() => {
1529
- let e = Math.max(0, x.value - wt), t = Math.min(u.items.length - 1, x.value + wt);
1544
+ let l = 0, u = t, d = i, f = w(null), p = w(null), g = u.initialPostId === null || u.initialPostId === void 0 ? -1 : u.items.findIndex((e) => e.postId === u.initialPostId), x = w(Math.max(0, g)), C = w(!1), D = w(!1), k = 0, A = null, j = null, M = null, F = r(() => ({ gridTemplateRows: `repeat(${u.items.length}, 100cqh)` })), R = r(() => {
1545
+ let e = Math.max(0, x.value - Et), t = Math.min(u.items.length - 1, x.value + Et);
1530
1546
  return u.items.slice(e, t + 1).map((t, n) => ({
1531
1547
  fetchPriority: e + n === x.value ? "high" : "low",
1532
1548
  index: e + n,
1533
1549
  item: t
1534
1550
  }));
1535
- }), R = r(() => u.items[x.value]?.postId), z = r(() => u.items[x.value]), B = r(() => {
1536
- let e = R.value;
1551
+ }), z = r(() => u.items[x.value]?.postId), B = r(() => u.items[x.value]), V = r(() => {
1552
+ let e = z.value;
1537
1553
  return e === void 0 ? 0 : u.mediaIndices.get(e) ?? 0;
1538
- }), ee = r(() => {
1539
- let e = R.value;
1540
- return e === void 0 ? "loading" : u.previewStates.get(F(e, B.value)) ?? "loading";
1541
- }), V = r(() => z.value ? P(z.value, B.value) : null), H = r(() => ee.value === "ready" && !!(V.value && Ge(u.mediaSource === "original" ? V.value.type : V.value.preview.type ?? V.value.type, u.mediaSource === "original" ? V.value.src : V.value.preview.src))), W = r(() => [
1542
- R.value,
1543
- B.value,
1554
+ }), H = r(() => {
1555
+ let e = z.value;
1556
+ return e === void 0 ? "loading" : u.previewStates.get(L(e, V.value)) ?? "loading";
1557
+ }), ee = r(() => B.value ? I(B.value, V.value) : null), U = r(() => ee.value ? N(ee.value, u.mediaSource ?? "preview") : null), W = r(() => H.value === "ready" && !!(U.value && qe(U.value.type, U.value.src))), G = r(() => [
1558
+ z.value,
1559
+ V.value,
1544
1560
  u.items.length,
1545
1561
  u.loadMoreLocked,
1546
1562
  u.reelAutoAdvance.enabled,
1547
1563
  u.reelAutoAdvance.includePostItems,
1548
1564
  u.reelAutoAdvance.intervalMs
1549
- ].join(":")), G = r(() => {
1550
- let e = z.value, t = !!(e && u.reelAutoAdvance.includePostItems && B.value < M(e).length - 1), n = u.reelAutoAdvance.intervalMs / 1e3;
1565
+ ].join(":")), K = r(() => {
1566
+ let e = B.value, t = !!(e && u.reelAutoAdvance.includePostItems && V.value < P(e).length - 1), n = u.reelAutoAdvance.intervalMs / 1e3;
1551
1567
  return `Auto advance to the next ${t ? "post item" : "post"} in ${n}s`;
1552
- }), te = r(() => u.reelAutoAdvance.enabled && u.reelForward.status === "idle" && z.value !== void 0 && ee.value !== "loading" && !H.value), re = r(() => !u.infiniteScroll || u.items.length <= 1), K = r(() => u.reelForward.status === "loading" ? "Loading the next media…" : u.reelForward.status === "error" ? "Unable to load the next media." : "You reached the end of this feed.");
1568
+ }), ne = r(() => u.reelAutoAdvance.enabled && u.reelForward.status === "idle" && B.value !== void 0 && H.value !== "loading" && !W.value), re = r(() => !u.infiniteScroll || u.items.length <= 1), J = r(() => u.reelForward.status === "loading" ? "Loading the next media…" : u.reelForward.status === "error" ? "Unable to load the next media." : "You reached the end of this feed.");
1553
1569
  function ie(e) {
1554
1570
  return { gridRow: `${e + 1}` };
1555
1571
  }
@@ -1561,77 +1577,77 @@ var yt = ["aria-label"], bt = /* @__PURE__ */ d({
1561
1577
  let t = e.currentTarget;
1562
1578
  if (!t) return;
1563
1579
  let n = k || t.clientHeight, r = Math.max(0, u.items.length - 1) * n;
1564
- C.value = u.items.length > 0 && t.scrollTop > r + 1, D.value || (x.value = ae(t)), Date.now() >= l && !u.loadMoreLocked && u.infiniteScroll && ne(t) && d("loadMore");
1580
+ C.value = u.items.length > 0 && t.scrollTop > r + 1, D.value || (x.value = ae(t)), Date.now() >= l && !u.loadMoreLocked && u.infiniteScroll && q(t) && d("loadMore");
1565
1581
  }
1566
- function q() {
1582
+ function Y() {
1567
1583
  let e = f.value;
1568
- e && (C.value = !1, Y(!0), k = e.clientHeight, e.scrollTop = x.value * k, j !== null && cancelAnimationFrame(j), j = requestAnimationFrame(() => {
1584
+ e && (C.value = !1, se(!0), k = e.clientHeight, e.scrollTop = x.value * k, j !== null && cancelAnimationFrame(j), j = requestAnimationFrame(() => {
1569
1585
  e.scrollTop = x.value * e.clientHeight, k = e.clientHeight, j = null;
1570
- }), se());
1586
+ }), X());
1571
1587
  }
1572
- function se() {
1573
- N !== null && clearTimeout(N), N = setTimeout(() => {
1574
- N = null;
1588
+ function X() {
1589
+ M !== null && clearTimeout(M), M = setTimeout(() => {
1590
+ M = null;
1575
1591
  let e = f.value;
1576
- e && (k = e.clientHeight, e.scrollTop = x.value * k), Y(!1);
1592
+ e && (k = e.clientHeight, e.scrollTop = x.value * k), se(!1);
1577
1593
  }, 120);
1578
1594
  }
1579
- function J() {
1580
- Y(!0);
1595
+ function Z() {
1596
+ se(!0);
1581
1597
  let e = f.value;
1582
- e && (k = e.clientHeight, e.scrollTop = x.value * k), se();
1598
+ e && (k = e.clientHeight, e.scrollTop = x.value * k), X();
1583
1599
  }
1584
- function Y(e) {
1600
+ function se(e) {
1585
1601
  D.value = e, f.value?.toggleAttribute("data-resizing", e);
1586
1602
  }
1587
- function X() {
1603
+ function ce() {
1588
1604
  let e = f.value;
1589
- Date.now() >= l && !u.loadMoreLocked && e && ne(e) && d("loadMore");
1605
+ Date.now() >= l && !u.loadMoreLocked && e && q(e) && d("loadMore");
1590
1606
  }
1591
1607
  O(() => u.items.length, (e, t) => {
1592
- e > 0 && e < t && (l = Date.now() + Et);
1608
+ e > 0 && e < t && (l = Date.now() + Ot);
1593
1609
  });
1594
- function Z(e) {
1595
- let t = z.value;
1610
+ function le(e) {
1611
+ let t = B.value;
1596
1612
  if (!t) return !1;
1597
- let n = M(t).length;
1613
+ let n = P(t).length;
1598
1614
  if (n <= 1) return !1;
1599
- let r = (B.value + e + n) % n;
1615
+ let r = (V.value + e + n) % n;
1600
1616
  return d("mediaChange", t.postId, r), !0;
1601
1617
  }
1602
- function ce(e) {
1618
+ function ue(e) {
1603
1619
  let t = x.value + e;
1604
- return !f.value || t < 0 || t >= u.items.length ? !1 : (fe(t), !0);
1620
+ return !f.value || t < 0 || t >= u.items.length ? !1 : (me(t), !0);
1605
1621
  }
1606
- function le(e, t) {
1622
+ function de(e, t) {
1607
1623
  let n = u.items.findIndex((t) => t.postId === e), r = u.items[n];
1608
- return !f.value || !r || t < 0 || t > r.items.length ? !1 : ((u.mediaIndices.get(e) ?? 0) !== t && d("mediaChange", e, t), n !== x.value && fe(n), !0);
1624
+ return !f.value || !r || t < 0 || t > r.items.length ? !1 : ((u.mediaIndices.get(e) ?? 0) !== t && d("mediaChange", e, t), n !== x.value && me(n), !0);
1609
1625
  }
1610
- function ue() {
1626
+ function fe() {
1611
1627
  return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
1612
1628
  }
1613
- function de(e) {
1629
+ function pe(e) {
1614
1630
  let t = f.value;
1615
1631
  if (!t) return Promise.resolve();
1616
1632
  let n = e * (k || t.clientHeight);
1617
- return x.value = e, vt(t, n, ue());
1633
+ return x.value = e, bt(t, n, fe());
1618
1634
  }
1619
- function fe(e) {
1620
- de(e);
1635
+ function me(e) {
1636
+ pe(e);
1621
1637
  }
1622
- async function pe(e) {
1638
+ async function he(e) {
1623
1639
  let t = u.items.findIndex((t) => t.postId === e);
1624
- return t < 0 || t === x.value ? !1 : (await de(t), !0);
1640
+ return t < 0 || t === x.value ? !1 : (await pe(t), !0);
1625
1641
  }
1626
- async function me(e) {
1627
- return Z(e) ? (ue() || await new Promise((e) => setTimeout(e, Tt)), !0) : !1;
1642
+ async function ge(e) {
1643
+ return le(e) ? (fe() || await new Promise((e) => setTimeout(e, Dt)), !0) : !1;
1628
1644
  }
1629
- function he() {
1645
+ function _e() {
1630
1646
  if (!u.reelAutoAdvance.enabled) return;
1631
- let e = z.value;
1647
+ let e = B.value;
1632
1648
  if (!e) return;
1633
- if (u.reelAutoAdvance.includePostItems && B.value < M(e).length - 1) {
1634
- d("mediaChange", e.postId, B.value + 1);
1649
+ if (u.reelAutoAdvance.includePostItems && V.value < P(e).length - 1) {
1650
+ d("mediaChange", e.postId, V.value + 1);
1635
1651
  return;
1636
1652
  }
1637
1653
  let t = x.value + 1, n = u.items[t];
@@ -1639,31 +1655,31 @@ var yt = ["aria-label"], bt = /* @__PURE__ */ d({
1639
1655
  u.hasNext && !u.loadMoreLocked && d("loadMore");
1640
1656
  return;
1641
1657
  }
1642
- u.reelAutoAdvance.includePostItems && (u.mediaIndices.get(n.postId) ?? 0) !== 0 && d("mediaChange", n.postId, 0), fe(t);
1658
+ u.reelAutoAdvance.includePostItems && (u.mediaIndices.get(n.postId) ?? 0) !== 0 && d("mediaChange", n.postId, 0), me(t);
1643
1659
  }
1644
- function ge(e, t) {
1645
- !u.reelAutoAdvance.enabled || e !== R.value || t !== B.value || !H.value || he();
1660
+ function ve(e, t) {
1661
+ !u.reelAutoAdvance.enabled || e !== z.value || t !== V.value || !W.value || _e();
1646
1662
  }
1647
1663
  return O(f, (e) => {
1648
- A?.disconnect(), A = null, e && (k = e.clientHeight, !(typeof ResizeObserver > "u") && (A = new ResizeObserver(q), A.observe(e)));
1664
+ A?.disconnect(), A = null, e && (k = e.clientHeight, !(typeof ResizeObserver > "u") && (A = new ResizeObserver(Y), A.observe(e)));
1649
1665
  }), O(() => u.items.length, async (e) => {
1650
1666
  let t = u.initialPostId, n = t == null ? -1 : u.items.findIndex(({ postId: e }) => e === t);
1651
- x.value = n >= 0 ? n : Math.min(x.value, Math.max(0, e - 1)), await m(), q();
1652
- }), O(R, (e) => {
1667
+ x.value = n >= 0 ? n : Math.min(x.value, Math.max(0, e - 1)), await m(), Y();
1668
+ }), O(z, (e) => {
1653
1669
  e !== void 0 && d("activeChange", e);
1654
1670
  }, { immediate: !0 }), y(() => {
1655
- window.addEventListener("resize", J), window.addEventListener("orientationchange", J), g >= 0 && m(q);
1671
+ window.addEventListener("resize", Z), window.addEventListener("orientationchange", Z), g >= 0 && m(Y);
1656
1672
  }), v(() => {
1657
- window.removeEventListener("resize", J), window.removeEventListener("orientationchange", J), A?.disconnect(), j !== null && cancelAnimationFrame(j), N !== null && clearTimeout(N);
1673
+ window.removeEventListener("resize", Z), window.removeEventListener("orientationchange", Z), A?.disconnect(), j !== null && cancelAnimationFrame(j), M !== null && clearTimeout(M);
1658
1674
  }), n({
1659
1675
  activeIndex: x,
1660
- activePostId: R,
1661
- changeActiveMedia: Z,
1662
- loadIfNearBottom: X,
1663
- moveActivePost: ce,
1664
- navigateToItem: le,
1665
- transitionActiveMedia: me,
1666
- transitionActivePost: pe
1676
+ activePostId: z,
1677
+ changeActiveMedia: le,
1678
+ loadIfNearBottom: ce,
1679
+ moveActivePost: ue,
1680
+ navigateToItem: de,
1681
+ transitionActiveMedia: ge,
1682
+ transitionActivePost: he
1667
1683
  }), (n, r) => (b(), s("main", {
1668
1684
  class: h(["reel-shell", {
1669
1685
  "reel-shell--has-footer": !!t.cardFooter,
@@ -1671,13 +1687,13 @@ var yt = ["aria-label"], bt = /* @__PURE__ */ d({
1671
1687
  }]),
1672
1688
  "data-layout-mode": "reel"
1673
1689
  }, [
1674
- t.cardHeader && z.value && t.reelForward.status === "idle" ? (b(), a(Ne, {
1690
+ t.cardHeader && B.value && t.reelForward.status === "idle" ? (b(), a(Fe, {
1675
1691
  key: 0,
1676
1692
  index: x.value,
1677
- item: z.value,
1693
+ item: B.value,
1678
1694
  layout: "reel",
1679
1695
  "loaded-count": t.items.length,
1680
- "media-index": B.value,
1696
+ "media-index": V.value,
1681
1697
  "media-source": t.mediaSource,
1682
1698
  placement: "header",
1683
1699
  region: t.cardHeader,
@@ -1693,19 +1709,19 @@ var yt = ["aria-label"], bt = /* @__PURE__ */ d({
1693
1709
  "style",
1694
1710
  "total"
1695
1711
  ])) : o("", !0),
1696
- c("div", xt, [c("div", {
1712
+ c("div", Ct, [c("div", {
1697
1713
  ref_key: "galleryElement",
1698
1714
  ref: f,
1699
1715
  class: "gallery-shell reel-feed",
1700
- "data-active-post-id": R.value,
1701
- "data-active-media-index": B.value,
1716
+ "data-active-post-id": z.value,
1717
+ "data-active-media-index": V.value,
1702
1718
  onScrollPassive: oe
1703
1719
  }, [t.reelForward.status === "idle" ? (b(), s("section", {
1704
1720
  key: 1,
1705
1721
  class: "reel-track",
1706
- style: _(I.value),
1722
+ style: _(F.value),
1707
1723
  "aria-label": "Media gallery"
1708
- }, [(b(!0), s(e, null, S(L.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(lt, {
1724
+ }, [(b(!0), s(e, null, S(R.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(dt, {
1709
1725
  key: n.postId,
1710
1726
  active: r === x.value && !C.value,
1711
1727
  "advance-on-media-end": u.reelAutoAdvance.enabled && r === x.value,
@@ -1720,12 +1736,12 @@ var yt = ["aria-label"], bt = /* @__PURE__ */ d({
1720
1736
  "loaded-count": t.items.length,
1721
1737
  "media-index": t.mediaIndices.get(n.postId) ?? 0,
1722
1738
  "media-source": t.mediaSource,
1723
- "preview-state": t.previewStates.get(E(F)(n.postId, t.mediaIndices.get(n.postId) ?? 0)) ?? "loading",
1739
+ "preview-state": t.previewStates.get(E(L)(n.postId, t.mediaIndices.get(n.postId) ?? 0)) ?? "loading",
1724
1740
  "reel-controls-target": p.value,
1725
1741
  "stationary-reel-controls": "",
1726
1742
  total: t.total,
1727
1743
  onMediaChange: (e) => d("mediaChange", n.postId, e),
1728
- onEnded: (e) => ge(n.postId, e),
1744
+ onEnded: (e) => ve(n.postId, e),
1729
1745
  onReady: (e) => d("ready", n.postId, e),
1730
1746
  onError: (e) => d("error", n.postId, e)
1731
1747
  }, null, 8, [
@@ -1751,12 +1767,12 @@ var yt = ["aria-label"], bt = /* @__PURE__ */ d({
1751
1767
  class: "reel-forward-status",
1752
1768
  role: t.reelForward.status === "error" ? "alert" : "status",
1753
1769
  "data-status": t.reelForward.status
1754
- }, [c("p", null, T(K.value), 1), t.reelForward.status === "error" || t.reelForward.status === "end" ? (b(), s("button", {
1770
+ }, [c("p", null, T(J.value), 1), t.reelForward.status === "error" || t.reelForward.status === "end" ? (b(), s("button", {
1755
1771
  key: 0,
1756
1772
  class: "reel-forward-retry",
1757
1773
  type: "button",
1758
1774
  onClick: r[0] ||= (e) => d("retryForward")
1759
- }, " Retry ")) : o("", !0)], 8, Ct)), t.reelForward.status === "idle" ? (b(), a(U, {
1775
+ }, " Retry ")) : o("", !0)], 8, Tt)), t.reelForward.status === "idle" ? (b(), a(te, {
1760
1776
  key: 2,
1761
1777
  actions: t.feedFooterActions,
1762
1778
  "can-retry-end": t.canRetryEnd,
@@ -1779,19 +1795,19 @@ var yt = ["aria-label"], bt = /* @__PURE__ */ d({
1779
1795
  "load-more-locked",
1780
1796
  "show-load-more",
1781
1797
  "state"
1782
- ])) : o("", !0)], 40, St), c("div", {
1798
+ ])) : o("", !0)], 40, wt), c("div", {
1783
1799
  ref_key: "reelControlsElement",
1784
1800
  ref: p,
1785
1801
  class: "reel-media-controls-host",
1786
1802
  "data-test": "reel-media-controls-host"
1787
1803
  }, null, 512)]),
1788
- t.cardFooter && z.value && t.reelForward.status === "idle" ? (b(), a(Ne, {
1804
+ t.cardFooter && B.value && t.reelForward.status === "idle" ? (b(), a(Fe, {
1789
1805
  key: 1,
1790
1806
  index: x.value,
1791
- item: z.value,
1807
+ item: B.value,
1792
1808
  layout: "reel",
1793
1809
  "loaded-count": t.items.length,
1794
- "media-index": B.value,
1810
+ "media-index": V.value,
1795
1811
  "media-source": t.mediaSource,
1796
1812
  placement: "footer",
1797
1813
  region: t.cardFooter,
@@ -1807,24 +1823,24 @@ var yt = ["aria-label"], bt = /* @__PURE__ */ d({
1807
1823
  "style",
1808
1824
  "total"
1809
1825
  ])) : o("", !0),
1810
- te.value ? (b(), a(bt, {
1811
- key: W.value,
1826
+ ne.value ? (b(), a(St, {
1827
+ key: G.value,
1812
1828
  "duration-ms": t.reelAutoAdvance.intervalMs,
1813
- label: G.value,
1814
- onComplete: he
1829
+ label: K.value,
1830
+ onComplete: _e
1815
1831
  }, null, 8, ["duration-ms", "label"])) : o("", !0)
1816
1832
  ], 2));
1817
1833
  }
1818
- }), Ot = ["data-info-sheet-open", "data-info-sheet-mode"], kt = ["aria-hidden", "inert"], At = {
1834
+ }), At = ["data-info-sheet-open", "data-info-sheet-mode"], jt = ["aria-hidden", "inert"], Mt = {
1819
1835
  key: 0,
1820
1836
  class: "reel-info-sheet-layer",
1821
1837
  "data-test": "reel-info-sheet"
1822
- }, jt = [
1838
+ }, Nt = [
1823
1839
  "role",
1824
1840
  "aria-modal",
1825
1841
  "tabindex",
1826
1842
  "data-active-post-id"
1827
- ], Mt = /* @__PURE__ */ d({
1843
+ ], Pt = /* @__PURE__ */ d({
1828
1844
  __name: "ReelLayout",
1829
1845
  props: {
1830
1846
  forwardIndex: { default: null },
@@ -1877,26 +1893,26 @@ var yt = ["aria-label"], bt = /* @__PURE__ */ d({
1877
1893
  }), A = r(() => !!(l.infoSheet && l.infoSheetEnabled && T.value)), j = r(() => {
1878
1894
  let e = T.value;
1879
1895
  return e ? {
1880
- close: N,
1896
+ close: M,
1881
1897
  index: E.value,
1882
1898
  item: e,
1883
1899
  layout: "reel",
1884
1900
  loadedCount: l.items.length,
1885
- mediaCount: M(e).length,
1901
+ mediaCount: P(e).length,
1886
1902
  mediaIndex: D.value,
1887
- mediaItem: P(e, D.value),
1903
+ mediaItem: I(e, D.value),
1888
1904
  mediaSource: l.mediaSource ?? "preview",
1889
1905
  origin: l.origin,
1890
1906
  total: l.total
1891
1907
  } : null;
1892
1908
  });
1893
- function N() {
1909
+ function M() {
1894
1910
  d("closeInfoSheet");
1895
1911
  }
1896
- function F(e) {
1912
+ function N(e) {
1897
1913
  return p.value?.changeActiveMedia(e) ?? !1;
1898
1914
  }
1899
- function I() {
1915
+ function F() {
1900
1916
  p.value?.loadIfNearBottom();
1901
1917
  }
1902
1918
  function L(e) {
@@ -1911,13 +1927,13 @@ var yt = ["aria-label"], bt = /* @__PURE__ */ d({
1911
1927
  function B(e) {
1912
1928
  return p.value?.transitionActivePost(e) ?? Promise.resolve(!1);
1913
1929
  }
1914
- function ee(e, t) {
1930
+ function V(e, t) {
1915
1931
  d("error", e, t);
1916
1932
  }
1917
- function V(e, t) {
1933
+ function H(e, t) {
1918
1934
  d("mediaChange", e, t);
1919
1935
  }
1920
- function H(e, t) {
1936
+ function ee(e, t) {
1921
1937
  d("ready", e, t);
1922
1938
  }
1923
1939
  return O(() => ({
@@ -1935,8 +1951,8 @@ var yt = ["aria-label"], bt = /* @__PURE__ */ d({
1935
1951
  }), v(() => {
1936
1952
  y = null;
1937
1953
  }), t({
1938
- changeActiveMedia: F,
1939
- loadIfNearBottom: I,
1954
+ changeActiveMedia: N,
1955
+ loadIfNearBottom: F,
1940
1956
  moveActivePost: L,
1941
1957
  navigateToItem: R,
1942
1958
  transitionActiveMedia: z,
@@ -1949,7 +1965,7 @@ var yt = ["aria-label"], bt = /* @__PURE__ */ d({
1949
1965
  class: "reel-layout-main",
1950
1966
  "aria-hidden": e.infoSheetOverlay && A.value || void 0,
1951
1967
  inert: e.infoSheetOverlay && A.value || void 0
1952
- }, [u(Dt, {
1968
+ }, [u(kt, {
1953
1969
  ref_key: "reelFeed",
1954
1970
  ref: p,
1955
1971
  "can-retry-end": e.canRetryEnd,
@@ -1973,10 +1989,10 @@ var yt = ["aria-label"], bt = /* @__PURE__ */ d({
1973
1989
  state: e.state,
1974
1990
  total: e.total,
1975
1991
  onActiveChange: r[0] ||= (e) => d("activeChange", e),
1976
- onError: ee,
1992
+ onError: V,
1977
1993
  onLoadMore: r[1] ||= (e) => d("loadMore"),
1978
- onMediaChange: V,
1979
- onReady: H,
1994
+ onMediaChange: H,
1995
+ onReady: ee,
1980
1996
  onRetryEnd: r[2] ||= (e) => d("retryEnd"),
1981
1997
  onRetryForward: r[3] ||= (e) => d("retryForward")
1982
1998
  }, null, 8, [
@@ -2000,8 +2016,8 @@ var yt = ["aria-label"], bt = /* @__PURE__ */ d({
2000
2016
  "reel-forward",
2001
2017
  "state",
2002
2018
  "total"
2003
- ])], 8, kt), u(n, { name: "vibe-info-sheet" }, {
2004
- default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", At, [c("aside", {
2019
+ ])], 8, jt), u(n, { name: "vibe-info-sheet" }, {
2020
+ default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", Mt, [c("aside", {
2005
2021
  ref_key: "sheetElement",
2006
2022
  ref: _,
2007
2023
  class: "reel-info-sheet",
@@ -2010,17 +2026,17 @@ var yt = ["aria-label"], bt = /* @__PURE__ */ d({
2010
2026
  "aria-modal": e.infoSheetOverlay ? "true" : void 0,
2011
2027
  tabindex: e.infoSheetOverlay ? -1 : void 0,
2012
2028
  "data-active-post-id": T.value?.postId
2013
- }, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8, jt)])) : o("", !0)]),
2029
+ }, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8, Nt)])) : o("", !0)]),
2014
2030
  _: 1
2015
- })], 10, Ot));
2031
+ })], 10, At));
2016
2032
  }
2017
2033
  });
2018
2034
  //#endregion
2019
2035
  //#region src/core/mediaLifecycle.ts
2020
- function Nt(e, t, n, r, i) {
2036
+ function Ft(e, t, n, r, i) {
2021
2037
  let a = e.items.findIndex((e) => e.postId === t), o = e.items[a];
2022
2038
  if (!o) return null;
2023
- let s = N(o, n), c = P(o, s);
2039
+ let s = F(o, n), c = I(o, s);
2024
2040
  return {
2025
2041
  item: o,
2026
2042
  layout: r,
@@ -2033,7 +2049,7 @@ function Nt(e, t, n, r, i) {
2033
2049
  postIndex: a
2034
2050
  };
2035
2051
  }
2036
- function Pt(e, t) {
2052
+ function It(e, t) {
2037
2053
  O(() => {
2038
2054
  let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null;
2039
2055
  return {
@@ -2043,76 +2059,76 @@ function Pt(e, t) {
2043
2059
  };
2044
2060
  }, (n, r) => {
2045
2061
  if (n.postId === null || n.postId === r?.postId && n.mediaIndex === r.mediaIndex && n.origin === r.origin) return;
2046
- let i = Nt(e, n.postId, n.mediaIndex, "reel", n.origin);
2062
+ let i = Ft(e, n.postId, n.mediaIndex, "reel", n.origin);
2047
2063
  i && t(i);
2048
2064
  }, { flush: "sync" });
2049
2065
  }
2050
2066
  //#endregion
2051
2067
  //#region src/components/useMediaLifecycle.ts
2052
- function Ft(e, t) {
2053
- let n = w(/* @__PURE__ */ new Map()), i = w(/* @__PURE__ */ new Map()), a = r(() => e.reelMediaSource === "original" ? i.value : n.value);
2054
- function o(e, t, n, r) {
2055
- let i = F(t, n);
2068
+ function Lt(e, t) {
2069
+ let n = w(/* @__PURE__ */ new Map()), i = w(/* @__PURE__ */ new Map()), a = w(/* @__PURE__ */ new Map()), o = () => e.reelMediaSource === "preview" ? n : e.reelMediaSource === "mobile" ? a : i, s = r(() => o().value);
2070
+ function c(e, t, n, r) {
2071
+ let i = L(t, n);
2056
2072
  e.value.get(i) !== r && (e.value = new Map(e.value).set(i, r));
2057
2073
  }
2058
- function s(t, n, r, i) {
2059
- return Nt(e, t, n, r, i);
2074
+ function l(t, n, r, i) {
2075
+ return Ft(e, t, n, r, i);
2060
2076
  }
2061
- function c(e, n, r, i) {
2062
- let a = s(e, n, r, i);
2077
+ function u(e, n, r, i) {
2078
+ let a = l(e, n, r, i);
2063
2079
  a && t.ready(a);
2064
2080
  }
2065
- function l(e, t) {
2066
- o(n, e, t, "error");
2081
+ function d(e, t) {
2082
+ c(n, e, t, "error");
2067
2083
  }
2068
- function u(e, t) {
2069
- o(n, e, t, "ready"), c(e, t, "masonry", null);
2084
+ function f(e, t) {
2085
+ c(n, e, t, "ready"), u(e, t, "masonry", null);
2070
2086
  }
2071
- function d(t, r) {
2072
- o(e.reelMediaSource === "original" ? i : n, t, r, "error");
2087
+ function p(e, t) {
2088
+ c(o(), e, t, "error");
2073
2089
  }
2074
- function f(t, r) {
2075
- o(e.reelMediaSource === "original" ? i : n, t, r, "ready"), c(t, r, "reel", e.reelOrigin ?? "reel");
2090
+ function m(t, n) {
2091
+ c(o(), t, n, "ready"), u(t, n, "reel", e.reelOrigin ?? "reel");
2076
2092
  }
2077
- function p(e, n) {
2078
- let r = s(e, n, "masonry", null);
2093
+ function h(e, n) {
2094
+ let r = l(e, n, "masonry", null);
2079
2095
  r && t.visible(r);
2080
2096
  }
2081
- return Pt(e, t.reelChange), O(() => {
2097
+ return It(e, t.reelChange), O(() => {
2082
2098
  let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null, n = t === null ? 0 : e.mediaIndices.get(t) ?? 0;
2083
2099
  return {
2084
2100
  mediaIndex: n,
2085
2101
  origin: e.reelOrigin ?? "reel",
2086
2102
  postId: t,
2087
- ready: t !== null && a.value.get(F(t, n)) === "ready"
2103
+ ready: t !== null && s.value.get(L(t, n)) === "ready"
2088
2104
  };
2089
2105
  }, (e, n) => {
2090
2106
  if (e.postId === null || !e.ready || n?.ready && n.postId === e.postId && n.mediaIndex === e.mediaIndex && n.origin === e.origin) return;
2091
- let r = s(e.postId, e.mediaIndex, "reel", e.origin);
2107
+ let r = l(e.postId, e.mediaIndex, "reel", e.origin);
2092
2108
  r && t.visible(r);
2093
2109
  }, { flush: "post" }), {
2094
- markMasonryVisible: p,
2095
- markPreviewError: l,
2096
- markPreviewReady: u,
2097
- markReelError: d,
2098
- markReelReady: f,
2110
+ markMasonryVisible: h,
2111
+ markPreviewError: d,
2112
+ markPreviewReady: f,
2113
+ markReelError: p,
2114
+ markReelReady: m,
2099
2115
  originalStates: i,
2100
2116
  previewStates: n,
2101
- reelStates: a
2117
+ reelStates: s
2102
2118
  };
2103
2119
  }
2104
2120
  //#endregion
2105
2121
  //#region src/core/reelEscapeStack.ts
2106
- var It = [];
2107
- function Lt(e) {
2108
- return It.push(e), () => {
2109
- let t = It.indexOf(e);
2110
- t >= 0 && It.splice(t, 1);
2122
+ var Rt = [];
2123
+ function zt(e) {
2124
+ return Rt.push(e), () => {
2125
+ let t = Rt.indexOf(e);
2126
+ t >= 0 && Rt.splice(t, 1);
2111
2127
  };
2112
2128
  }
2113
- function Rt(e) {
2129
+ function Bt(e) {
2114
2130
  if (!e.isActive()) return !1;
2115
- let t = It.filter((e) => e.isActive()), n = e.element();
2131
+ let t = Rt.filter((e) => e.isActive()), n = e.element();
2116
2132
  return n !== null && t.some((t) => {
2117
2133
  if (t === e) return !1;
2118
2134
  let r = t.element();
@@ -2128,14 +2144,14 @@ function Rt(e) {
2128
2144
  }
2129
2145
  //#endregion
2130
2146
  //#region src/components/useReelKeyboard.ts
2131
- function zt(e) {
2147
+ function Vt(e) {
2132
2148
  let t = {
2133
2149
  element: e.element,
2134
2150
  isActive: () => e.state.layout === "reel" || e.state.reelOrigin === "masonry"
2135
2151
  }, n = null;
2136
2152
  function r(n) {
2137
2153
  let r = t.isActive();
2138
- if (n.key === "Escape" && r && !Rt(t)) return;
2154
+ if (n.key === "Escape" && r && !Bt(t)) return;
2139
2155
  if (n.key === "Escape" && e.state.reelOrigin === "masonry") {
2140
2156
  n.preventDefault(), e.state.reelInfoSheetOverlay && e.state.reelInfoSheet.enabled && e.setReelInfoSheet(!1), e.closeMasonryReel();
2141
2157
  return;
@@ -2155,14 +2171,14 @@ function zt(e) {
2155
2171
  a !== 0 && e.reelRenderer()?.changeActiveMedia?.(a) && n.preventDefault();
2156
2172
  }
2157
2173
  y(() => {
2158
- n = Lt(t), window.addEventListener("keydown", r);
2174
+ n = zt(t), window.addEventListener("keydown", r);
2159
2175
  }), v(() => {
2160
2176
  window.removeEventListener("keydown", r), n?.(), n = null;
2161
2177
  });
2162
2178
  }
2163
2179
  //#endregion
2164
2180
  //#region src/components/VibeSurface.vue?vue&type=script&setup=true&lang.ts
2165
- var Bt = 35, Vt = 420, Ht = /* @__PURE__ */ d({
2181
+ var Ht = 35, Ut = 420, Wt = /* @__PURE__ */ d({
2166
2182
  __name: "VibeSurface",
2167
2183
  props: {
2168
2184
  canRetryEnd: { type: Boolean },
@@ -2188,70 +2204,70 @@ var Bt = 35, Vt = 420, Ht = /* @__PURE__ */ d({
2188
2204
  "retryForward"
2189
2205
  ],
2190
2206
  setup(t, { expose: i, emit: c }) {
2191
- let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), y = w({}), x = w(!1), S = w(/* @__PURE__ */ new Set()), C = w(/* @__PURE__ */ new Map()), T = w(/* @__PURE__ */ new Set()), D = w(/* @__PURE__ */ new Map()), A = r(() => Object.freeze([...l.state.items])), j = r(() => L(l.state, A.value)), { markMasonryVisible: P, markPreviewError: F, markPreviewReady: I, markReelError: R, markReelReady: z, originalStates: B, previewStates: ee, reelStates: V } = Ft(l.state, {
2207
+ let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), y = w({}), x = w(!1), S = w(/* @__PURE__ */ new Set()), C = w(/* @__PURE__ */ new Map()), T = w(/* @__PURE__ */ new Set()), D = w(/* @__PURE__ */ new Map()), A = r(() => Object.freeze([...l.state.items])), j = r(() => z(l.state, A.value)), { markMasonryVisible: M, markPreviewError: N, markPreviewReady: I, markReelError: L, markReelReady: R, originalStates: B, previewStates: V, reelStates: H } = Lt(l.state, {
2192
2208
  ready: (e) => d("mediaReady", e),
2193
2209
  reelChange: (e) => d("reelMediaChange", e),
2194
2210
  visible: (e) => d("mediaVisible", e)
2195
- }), H = new Set(l.state.items.map((e) => e.postId)), U = null, W = null, G = !1;
2196
- function ne() {
2211
+ }), ee = new Set(l.state.items.map((e) => e.postId)), U = null, W = null, te = !1;
2212
+ function G() {
2197
2213
  return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
2198
2214
  }
2199
- function re() {
2215
+ function K() {
2200
2216
  U !== null && cancelAnimationFrame(U), U = requestAnimationFrame(() => {
2201
2217
  U = requestAnimationFrame(() => {
2202
2218
  U = null, S.value = /* @__PURE__ */ new Set();
2203
2219
  });
2204
2220
  });
2205
2221
  }
2206
- function K(e, t) {
2222
+ function q(e, t) {
2207
2223
  let n = l.state.items.find((t) => t.postId === e);
2208
2224
  if (!n) return;
2209
- let r = N(n, t);
2225
+ let r = F(n, t);
2210
2226
  (l.state.mediaIndices.get(e) ?? 0) !== r && (l.state.mediaIndices = new Map(l.state.mediaIndices).set(e, r));
2211
2227
  }
2212
- async function ie() {
2228
+ async function re() {
2213
2229
  await m(), (l.state.layout === "reel" || l.state.reelOrigin === "masonry" ? p.value : f.value)?.loadIfNearBottom();
2214
2230
  }
2215
- function ae(e) {
2231
+ function J(e) {
2216
2232
  return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.changeActiveMedia?.(e) ?? !1;
2217
2233
  }
2218
- function oe(e) {
2234
+ function ie(e) {
2219
2235
  return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.moveActivePost?.(e) ?? !1;
2220
2236
  }
2221
- function q(e) {
2237
+ function ae(e) {
2222
2238
  if (!(l.state.layout === "reel" || l.state.reelOrigin === "masonry") || l.state.isLoading) return "reel-inactive";
2223
2239
  let t = l.state.items.find((t) => t.postId === e.postId);
2224
2240
  if (!t) return "not-found";
2225
- let n = M(t).findIndex((t) => t.mediaId === e.mediaId);
2241
+ let n = P(t).findIndex((t) => t.mediaId === e.mediaId);
2226
2242
  return n < 0 ? "not-found" : p.value?.navigateToItem?.(e.postId, n) ? "navigated" : "reel-inactive";
2227
2243
  }
2228
- function se() {
2244
+ function oe() {
2229
2245
  return l.state.layout !== "masonry" || l.state.reelOrigin === "masonry" ? null : f.value?.getScrollElement?.() ?? null;
2230
2246
  }
2231
- function J(e, t) {
2232
- W = e, G = t === "keyboard", y.value = ce(e), d("openReel", e), m(() => h.value?.focus());
2247
+ function Y(e, t) {
2248
+ W = e, te = t === "keyboard", y.value = ce(e), d("openReel", e), m(() => h.value?.focus());
2233
2249
  }
2234
- function Y(e) {
2250
+ function X(e) {
2235
2251
  let t = g.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [];
2236
2252
  return Array.from(t).find((t) => t.dataset.postId === String(e)) ?? null;
2237
2253
  }
2238
- function X(e, t) {
2239
- if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || ne()) return 0;
2240
- let n = [...new Set(e)], r = n.filter(Y);
2254
+ function Z(e, t) {
2255
+ if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || G()) return 0;
2256
+ let n = [...new Set(e)], r = n.filter(X);
2241
2257
  if (r.length === 0) return 0;
2242
- let i = new Map(D.value), a = t?.staggerMs ?? Bt;
2258
+ let i = new Map(D.value), a = t?.staggerMs ?? Ht;
2243
2259
  return r.forEach((e, t) => {
2244
2260
  i.set(e, t * a);
2245
- }), S.value = new Set([...S.value].filter((e) => !r.includes(e))), T.value = new Set([...T.value, ...n]), D.value = i, Vt + (r.length - 1) * a;
2261
+ }), S.value = new Set([...S.value].filter((e) => !r.includes(e))), T.value = new Set([...T.value, ...n]), D.value = i, Ut + (r.length - 1) * a;
2246
2262
  }
2247
- function Z(e, t) {
2248
- let n = Y(e), r = n?.querySelector(".media-card-activator") ?? n;
2263
+ function se(e, t) {
2264
+ let n = X(e), r = n?.querySelector(".media-card-activator") ?? n;
2249
2265
  r && (r.classList.toggle("media-card-focus-silent", !t), t || r.addEventListener("blur", () => {
2250
2266
  r.classList.remove("media-card-focus-silent");
2251
2267
  }, { once: !0 }), r?.focus({ preventScroll: !0 }));
2252
2268
  }
2253
2269
  function ce(e) {
2254
- let t = g.value, n = Y(e);
2270
+ let t = g.value, n = X(e);
2255
2271
  if (t === null || n === null) return {};
2256
2272
  let r = t.getBoundingClientRect(), i = n.getBoundingClientRect();
2257
2273
  return {
@@ -2265,12 +2281,12 @@ var Bt = 35, Vt = 420, Ht = /* @__PURE__ */ d({
2265
2281
  l.state.reelOrigin === "masonry" && (W ??= l.state.activeReelPostId, x.value = !0, d("closeReel"));
2266
2282
  }
2267
2283
  function ue() {
2268
- let e = W, t = G;
2269
- x.value = !1, W = null, G = !1, y.value = {}, m(() => {
2270
- e !== null && Z(e, t);
2284
+ let e = W, t = te;
2285
+ x.value = !1, W = null, te = !1, y.value = {}, m(() => {
2286
+ e !== null && se(e, t);
2271
2287
  });
2272
2288
  }
2273
- return zt({
2289
+ return Vt({
2274
2290
  closeMasonryReel: le,
2275
2291
  element: () => g.value,
2276
2292
  isReelLeaving: () => x.value,
@@ -2278,31 +2294,31 @@ var Bt = 35, Vt = 420, Ht = /* @__PURE__ */ d({
2278
2294
  setReelInfoSheet: (e) => d("reelInfoSheetChange", e),
2279
2295
  state: l.state
2280
2296
  }), O(() => l.state.items.map((e) => e.postId), (e) => {
2281
- let t = e.filter((e) => !H.has(e)), n = new Set(e);
2282
- if (H = new Set(e), T.value = new Set([...T.value].filter((e) => n.has(e))), D.value = new Map([...D.value].filter(([e]) => n.has(e))), t.length === 0 || ne()) return;
2297
+ let t = e.filter((e) => !ee.has(e)), n = new Set(e);
2298
+ if (ee = new Set(e), T.value = new Set([...T.value].filter((e) => n.has(e))), D.value = new Map([...D.value].filter(([e]) => n.has(e))), t.length === 0 || G()) return;
2283
2299
  let r = /* @__PURE__ */ new Map();
2284
2300
  e.forEach((e) => {
2285
2301
  let t = C.value.get(e);
2286
2302
  t !== void 0 && r.set(e, t);
2287
2303
  }), t.forEach((e, t) => {
2288
- r.set(e, t * Bt);
2289
- }), C.value = r, S.value = new Set([...S.value, ...t]), re();
2304
+ r.set(e, t * Ht);
2305
+ }), C.value = r, S.value = new Set([...S.value, ...t]), K();
2290
2306
  }, { flush: "sync" }), v(() => {
2291
2307
  U !== null && cancelAnimationFrame(U);
2292
2308
  }), i({
2293
- changeActiveReelMedia: ae,
2294
- getAutoScrollElement: se,
2295
- loadIfNearBottom: ie,
2296
- moveActiveReelPost: oe,
2297
- navigateToReelItem: q,
2298
- startItemRemoval: X,
2309
+ changeActiveReelMedia: J,
2310
+ getAutoScrollElement: oe,
2311
+ loadIfNearBottom: re,
2312
+ moveActiveReelPost: ie,
2313
+ navigateToReelItem: ae,
2314
+ startItemRemoval: Z,
2299
2315
  transitionActiveReelMedia: (e) => p.value?.transitionActiveMedia?.(e) ?? Promise.resolve(!1),
2300
2316
  transitionActiveReelPost: (e) => p.value?.transitionActivePost?.(e) ?? Promise.resolve(!1)
2301
2317
  }), (r, i) => (b(), s("div", {
2302
2318
  ref_key: "surfaceElement",
2303
2319
  ref: g,
2304
2320
  class: "vibe-surface"
2305
- }, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(Mt, {
2321
+ }, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(Pt, {
2306
2322
  key: 0,
2307
2323
  ref_key: "reelRenderer",
2308
2324
  ref: p,
@@ -2327,20 +2343,20 @@ var Bt = 35, Vt = 420, Ht = /* @__PURE__ */ d({
2327
2343
  "info-sheet-overlay": t.state.reelInfoSheetOverlay,
2328
2344
  "next-page-error": !!t.state.nextPageError,
2329
2345
  origin: "reel",
2330
- "preview-states": E(V),
2346
+ "preview-states": E(H),
2331
2347
  "reel-auto-advance": t.state.reelAutoAdvance,
2332
2348
  "reel-forward": t.state.reelForward,
2333
2349
  state: j.value,
2334
2350
  total: t.state.total,
2335
2351
  onActiveChange: i[0] ||= (e) => d("activeReelChange", e),
2336
2352
  onCloseInfoSheet: i[1] ||= (e) => d("reelInfoSheetChange", !1),
2337
- onError: E(R),
2353
+ onError: E(L),
2338
2354
  onLoadMore: i[2] ||= (e) => d("loadMore"),
2339
- onMediaChange: K,
2340
- onReady: E(z),
2355
+ onMediaChange: q,
2356
+ onReady: E(R),
2341
2357
  onRetryEnd: i[3] ||= (e) => d("retryEnd"),
2342
2358
  onRetryForward: i[4] ||= (e) => d("retryForward")
2343
- }, null, 8, /* @__PURE__ */ "can-retry-end.has-next.card-footer.card-header.feed-footer.feed-footer-actions.forward-index.forward-item.media-card.infinite-scroll.is-loading-more.items.load-more-locked.media-source.media-indices.initial-post-id.info-sheet.info-sheet-enabled.info-sheet-overlay.next-page-error.preview-states.reel-auto-advance.reel-forward.state.total.onError.onReady".split("."))) : t.state.error || t.state.isLoading || t.state.items.length === 0 && t.state.reelForward.status === "idle" ? (b(), a(te, {
2359
+ }, null, 8, /* @__PURE__ */ "can-retry-end.has-next.card-footer.card-header.feed-footer.feed-footer-actions.forward-index.forward-item.media-card.infinite-scroll.is-loading-more.items.load-more-locked.media-source.media-indices.initial-post-id.info-sheet.info-sheet-enabled.info-sheet-overlay.next-page-error.preview-states.reel-auto-advance.reel-forward.state.total.onError.onReady".split("."))) : t.state.error || t.state.isLoading || t.state.items.length === 0 && t.state.reelForward.status === "idle" ? (b(), a(ne, {
2344
2360
  key: 1,
2345
2361
  actions: t.feedFooterActions,
2346
2362
  "can-retry-end": t.canRetryEnd,
@@ -2353,7 +2369,7 @@ var Bt = 35, Vt = 420, Ht = /* @__PURE__ */ d({
2353
2369
  "can-retry-end",
2354
2370
  "feed-footer",
2355
2371
  "state"
2356
- ])) : (b(), s(e, { key: 2 }, [u(gt, {
2372
+ ])) : (b(), s(e, { key: 2 }, [u(vt, {
2357
2373
  ref_key: "masonryRenderer",
2358
2374
  ref: f,
2359
2375
  "can-retry-end": t.canRetryEnd,
@@ -2374,17 +2390,17 @@ var Bt = 35, Vt = 420, Ht = /* @__PURE__ */ d({
2374
2390
  "load-more-locked": t.state.loadMoreLocked,
2375
2391
  "media-indices": t.state.mediaIndices,
2376
2392
  "next-page-error": !!t.state.nextPageError,
2377
- "preview-states": E(ee),
2393
+ "preview-states": E(V),
2378
2394
  suspended: t.state.reelOrigin === "masonry" || x.value,
2379
2395
  state: j.value,
2380
2396
  total: t.state.total,
2381
- onActivate: J,
2382
- onError: E(F),
2397
+ onActivate: Y,
2398
+ onError: E(N),
2383
2399
  onLoadMore: i[7] ||= (e) => d("loadMore"),
2384
- onMediaChange: K,
2400
+ onMediaChange: q,
2385
2401
  onReady: E(I),
2386
2402
  onRetryEnd: i[8] ||= (e) => d("retryEnd"),
2387
- onVisible: E(P)
2403
+ onVisible: E(M)
2388
2404
  }, null, 8, [
2389
2405
  "can-retry-end",
2390
2406
  "entering-post-ids",
@@ -2425,7 +2441,7 @@ var Bt = 35, Vt = 420, Ht = /* @__PURE__ */ d({
2425
2441
  "aria-modal": "true",
2426
2442
  tabindex: "-1",
2427
2443
  style: _(y.value)
2428
- }, [u(Mt, {
2444
+ }, [u(Pt, {
2429
2445
  ref_key: "reelRenderer",
2430
2446
  ref: p,
2431
2447
  "can-retry-end": t.canRetryEnd,
@@ -2456,10 +2472,10 @@ var Bt = 35, Vt = 420, Ht = /* @__PURE__ */ d({
2456
2472
  total: t.state.total,
2457
2473
  onActiveChange: i[9] ||= (e) => d("activeReelChange", e),
2458
2474
  onCloseInfoSheet: i[10] ||= (e) => d("reelInfoSheetChange", !1),
2459
- onError: E(R),
2475
+ onError: E(L),
2460
2476
  onLoadMore: i[11] ||= (e) => d("loadMore"),
2461
- onMediaChange: K,
2462
- onReady: E(z),
2477
+ onMediaChange: q,
2478
+ onReady: E(R),
2463
2479
  onRetryEnd: i[12] ||= (e) => d("retryEnd"),
2464
2480
  onRetryForward: i[13] ||= (e) => d("retryForward")
2465
2481
  }, null, 8, /* @__PURE__ */ "can-retry-end.card-footer.card-header.feed-footer.feed-footer-actions.forward-index.forward-item.media-card.has-next.infinite-scroll.initial-post-id.info-sheet.info-sheet-enabled.info-sheet-overlay.is-loading-more.items.load-more-locked.media-indices.next-page-error.preview-states.reel-auto-advance.reel-forward.state.total.onError.onReady".split("."))], 4)) : o("", !0)]),
@@ -2469,7 +2485,7 @@ var Bt = 35, Vt = 420, Ht = /* @__PURE__ */ d({
2469
2485
  });
2470
2486
  //#endregion
2471
2487
  //#region src/core/page.ts
2472
- function Ut(e) {
2488
+ function Gt(e) {
2473
2489
  if (!e || typeof e != "object" || !Array.isArray(e.items)) throw TypeError("Vibe loadPage must resolve to a page with an items array.");
2474
2490
  if (e.current !== void 0 && e.current !== null && typeof e.current != "string" && typeof e.current != "number") throw TypeError("Vibe page current must be a string, number, null, or undefined.");
2475
2491
  if (e.next !== null && typeof e.next != "string" && typeof e.next != "number") throw TypeError("Vibe page next must be a string, number, or null.");
@@ -2480,22 +2496,22 @@ function Q(e, t) {
2480
2496
  let n = new Set(e.map((e) => e.postId));
2481
2497
  return [...e, ...t.filter((e) => n.has(e.postId) ? !1 : (n.add(e.postId), !0))];
2482
2498
  }
2483
- function Wt(e) {
2499
+ function Kt(e) {
2484
2500
  return `${typeof e}:${String(e)}`;
2485
2501
  }
2486
- function Gt(e) {
2487
- return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview.src}` : `id:${Wt(e.mediaId)}`;
2502
+ function qt(e) {
2503
+ return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview.src}` : `id:${Kt(e.mediaId)}`;
2488
2504
  }
2489
- function Kt(e, t) {
2490
- let n = [...e], r = new Map(e.map((e, t) => [Wt(e.postId), t]));
2505
+ function Jt(e, t) {
2506
+ let n = [...e], r = new Map(e.map((e, t) => [Kt(e.postId), t]));
2491
2507
  return t.forEach((e) => {
2492
- let t = Wt(e.postId), i = r.get(t);
2508
+ let t = Kt(e.postId), i = r.get(t);
2493
2509
  if (i === void 0) {
2494
2510
  r.set(t, n.length), n.push(e);
2495
2511
  return;
2496
2512
  }
2497
- let a = n[i], o = new Set([a, ...a.items].map(Gt)), s = [e, ...e.items].filter((e) => {
2498
- let t = Gt(e);
2513
+ let a = n[i], o = new Set([a, ...a.items].map(qt)), s = [e, ...e.items].filter((e) => {
2514
+ let t = qt(e);
2499
2515
  return o.has(t) ? !1 : (o.add(t), !0);
2500
2516
  });
2501
2517
  s.length > 0 && (n[i] = {
@@ -2504,14 +2520,14 @@ function Kt(e, t) {
2504
2520
  });
2505
2521
  }), n;
2506
2522
  }
2507
- function qt(e) {
2523
+ function Yt(e) {
2508
2524
  return Object.prototype.hasOwnProperty.call(e, "current") ? e.current ?? null : e.next;
2509
2525
  }
2510
2526
  //#endregion
2511
2527
  //#region src/core/appendPage.ts
2512
- function Jt(e, t, n, r) {
2513
- let i = Ut(e), a = n.filterItems(i.items), o = qt(i);
2514
- t.items = Kt(t.items, a), t.next = i.next, i.total !== void 0 && (t.total = i.total), r(o), n.recordPages([{
2528
+ function Xt(e, t, n, r) {
2529
+ let i = Gt(e), a = n.filterItems(i.items), o = Yt(i);
2530
+ t.items = Jt(t.items, a), t.next = i.next, i.total !== void 0 && (t.total = i.total), r(o), n.recordPages([{
2515
2531
  contributionIds: a.map(({ postId: e }) => e),
2516
2532
  cursor: o,
2517
2533
  next: i.next,
@@ -2520,32 +2536,32 @@ function Jt(e, t, n, r) {
2520
2536
  }
2521
2537
  //#endregion
2522
2538
  //#region src/core/requestDelay.ts
2523
- var Yt = 2e3, Xt = 1e4, Zt = 250, Qt = {
2539
+ var Zt = 2e3, Qt = 1e4, $t = 250, en = {
2524
2540
  delayRemainingMs: null,
2525
2541
  nextRequestAt: null
2526
2542
  };
2527
- function $t(e, t) {
2543
+ function tn(e, t) {
2528
2544
  return e === void 0 ? t : Math.floor(e);
2529
2545
  }
2530
- function en(e, t) {
2546
+ function nn(e, t) {
2531
2547
  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.`);
2532
2548
  }
2533
- function tn(e, t = {}) {
2534
- let n = $t(t.delayStepMs, Yt), r = $t(t.delayMaxMs, Xt);
2549
+ function rn(e, t = {}) {
2550
+ let n = tn(t.delayStepMs, Zt), r = tn(t.delayMaxMs, Qt);
2535
2551
  return Math.min(Math.max(0, e) * n, r);
2536
2552
  }
2537
2553
  function $(e) {
2538
- if (e == null || !Number.isFinite(e)) return { ...Qt };
2554
+ if (e == null || !Number.isFinite(e)) return { ...en };
2539
2555
  let t = Math.max(0, Math.floor(e - Date.now()));
2540
2556
  return t > 0 ? {
2541
2557
  delayRemainingMs: t,
2542
2558
  nextRequestAt: e
2543
- } : { ...Qt };
2559
+ } : { ...en };
2544
2560
  }
2545
- async function nn({ delayMs: e, onChange: t, signal: n }) {
2561
+ async function an({ delayMs: e, onChange: t, signal: n }) {
2546
2562
  if (n.aborted) throw new DOMException("Aborted", "AbortError");
2547
2563
  if (e <= 0) {
2548
- t({ ...Qt });
2564
+ t({ ...en });
2549
2565
  return;
2550
2566
  }
2551
2567
  let r = Date.now() + e;
@@ -2553,9 +2569,9 @@ async function nn({ delayMs: e, onChange: t, signal: n }) {
2553
2569
  delayRemainingMs: e,
2554
2570
  nextRequestAt: r
2555
2571
  }), await new Promise((i, a) => {
2556
- let o = !1, s = setInterval(f, Zt), c = setTimeout(() => u(), e);
2572
+ let o = !1, s = setInterval(f, $t), c = setTimeout(() => u(), e);
2557
2573
  function l() {
2558
- clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...Qt });
2574
+ clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...en });
2559
2575
  }
2560
2576
  function u(e) {
2561
2577
  o || (o = !0, l(), e ? a(e) : i());
@@ -2570,13 +2586,13 @@ async function nn({ delayMs: e, onChange: t, signal: n }) {
2570
2586
  n.addEventListener("abort", d, { once: !0 });
2571
2587
  });
2572
2588
  }
2573
- var rn = class {
2589
+ var on = class {
2574
2590
  interval = null;
2575
2591
  constructor(e) {
2576
2592
  this.onChange = e;
2577
2593
  }
2578
2594
  clear() {
2579
- this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...Qt });
2595
+ this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...en });
2580
2596
  }
2581
2597
  sync(e) {
2582
2598
  this.clear();
@@ -2584,22 +2600,22 @@ var rn = class {
2584
2600
  this.onChange(t), t.delayRemainingMs !== null && (this.interval = setInterval(() => {
2585
2601
  let t = $(e);
2586
2602
  this.onChange(t), t.delayRemainingMs === null && this.clear();
2587
- }, Zt));
2603
+ }, $t));
2588
2604
  }
2589
2605
  };
2590
- function an(e, t = !0) {
2606
+ function sn(e, t = !0) {
2591
2607
  return e.maxAdditionalPages === "unlimited" ? Infinity : (e.maxAdditionalPages ?? 10) + (t ? 1 : 0);
2592
2608
  }
2593
- function on(e) {
2609
+ function cn(e) {
2594
2610
  return `${typeof e}:${String(e)}`;
2595
2611
  }
2596
- function sn(e, t) {
2612
+ function ln(e, t) {
2597
2613
  if (!Number.isInteger(e) || e <= 0) throw TypeError(`Vibe ${t} must be a positive integer.`);
2598
2614
  }
2599
- function cn(e) {
2615
+ function un(e) {
2600
2616
  if (!e) return;
2601
- if (sn(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
2602
- en(e, "frontend autofill");
2617
+ if (ln(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
2618
+ nn(e, "frontend autofill");
2603
2619
  let t = e.maxAdditionalPages;
2604
2620
  if (t !== void 0 && t !== "unlimited" && (!Number.isInteger(t) || t < 0)) throw TypeError("Vibe autofill maxAdditionalPages must be a non-negative integer or \"unlimited\".");
2605
2621
  return;
@@ -2611,7 +2627,7 @@ function cn(e) {
2611
2627
  if (t.pageSize !== e.pageSize) throw TypeError("Vibe backend autofill initialSession pageSize must match autofill pageSize.");
2612
2628
  }
2613
2629
  }
2614
- function ln(e, t, n = !0) {
2630
+ function dn(e, t, n = !0) {
2615
2631
  if (!e) return {
2616
2632
  cycleId: null,
2617
2633
  delayRemainingMs: null,
@@ -2645,7 +2661,7 @@ function ln(e, t, n = !0) {
2645
2661
  strategy: e.strategy
2646
2662
  };
2647
2663
  }
2648
- function un(e) {
2664
+ function fn(e) {
2649
2665
  return [
2650
2666
  "cancelling",
2651
2667
  "filling",
@@ -2653,9 +2669,9 @@ function un(e) {
2653
2669
  "waiting"
2654
2670
  ].includes(e.status);
2655
2671
  }
2656
- async function dn(e, t, n) {
2672
+ async function pn(e, t, n) {
2657
2673
  let r = t.autofill;
2658
- if (!un(r) || !r.cycleId) return;
2674
+ if (!fn(r) || !r.cycleId) return;
2659
2675
  let i = {
2660
2676
  cycleId: r.cycleId,
2661
2677
  feedKey: r.feedKey ?? "",
@@ -2668,16 +2684,16 @@ async function dn(e, t, n) {
2668
2684
  throw r.error = e, r.status = "error", e;
2669
2685
  }
2670
2686
  }
2671
- function fn(e, t, n) {
2687
+ function mn(e, t, n) {
2672
2688
  return e?.strategy === "backend" && t.feedKey === e.feedKey && t.sessionId === n.sessionId;
2673
2689
  }
2674
- async function pn({ existingItems: e, initialCursor: t, loadPage: n, maximumRequests: r, onCollection: i, onDelayChange: a, onProgress: o, options: s, receivedOffset: c = 0, requestOffset: l = 0, shouldPause: u = () => !1, signal: d }) {
2675
- let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ?? an(s), g = t, _ = t, v = t, y = 0, b = [], x;
2690
+ async function hn({ existingItems: e, initialCursor: t, loadPage: n, maximumRequests: r, onCollection: i, onDelayChange: a, onProgress: o, options: s, receivedOffset: c = 0, requestOffset: l = 0, shouldPause: u = () => !1, signal: d }) {
2691
+ let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ?? sn(s), g = t, _ = t, v = t, y = 0, b = [], x;
2676
2692
  for (; y < h;) {
2677
- let e = on(g);
2693
+ let e = cn(g);
2678
2694
  if (m.has(e)) throw Error("Vibe autofill received a repeated cursor.");
2679
- if (m.add(e), await nn({
2680
- delayMs: tn(l + y, s),
2695
+ if (m.add(e), await an({
2696
+ delayMs: rn(l + y, s),
2681
2697
  onChange: a,
2682
2698
  signal: d
2683
2699
  }), y > 0 && u()) return {
@@ -2691,7 +2707,7 @@ async function pn({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
2691
2707
  status: "paused",
2692
2708
  total: x
2693
2709
  };
2694
- let t = Ut(await n({
2710
+ let t = Gt(await n({
2695
2711
  cursor: g,
2696
2712
  signal: d
2697
2713
  }));
@@ -2748,12 +2764,12 @@ async function pn({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
2748
2764
  }
2749
2765
  //#endregion
2750
2766
  //#region src/core/autofillController.ts
2751
- var mn = class {
2767
+ var gn = class {
2752
2768
  collection = null;
2753
2769
  cycle = 0;
2754
2770
  delayCountdown;
2755
2771
  constructor(e) {
2756
- this.context = e, this.delayCountdown = new rn((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
2772
+ this.context = e, this.delayCountdown = new on((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
2757
2773
  }
2758
2774
  beginCycle() {
2759
2775
  let { options: e, state: t } = this.context;
@@ -2761,14 +2777,14 @@ var mn = class {
2761
2777
  this.clear();
2762
2778
  let n = `vibe-autofill-${Date.now().toString(36)}-${++this.cycle}`;
2763
2779
  return t.autofill = {
2764
- ...ln(e, void 0, !1),
2780
+ ...dn(e, void 0, !1),
2765
2781
  cycleId: n,
2766
2782
  status: "filling"
2767
2783
  }, n;
2768
2784
  }
2769
2785
  async cancel() {
2770
2786
  let { cancelRequest: e, options: t, state: n } = this.context;
2771
- await dn(t, n, e), this.commitCollection();
2787
+ await pn(t, n, e), this.commitCollection();
2772
2788
  }
2773
2789
  captureCollection(e, t) {
2774
2790
  t && (this.collection = e);
@@ -2796,30 +2812,30 @@ var mn = class {
2796
2812
  requests: r.requests
2797
2813
  }), !0) : !1;
2798
2814
  }
2799
- }, hn = 100;
2800
- function gn(e, t) {
2815
+ }, _n = 100;
2816
+ function vn(e, t) {
2801
2817
  if (!Number.isFinite(t) || t <= 0) throw TypeError(`Vibe ${e} must be a positive number.`);
2802
2818
  }
2803
- function _n(e, t, n) {
2819
+ function yn(e, t, n) {
2804
2820
  return Math.min(n, Math.max(t, e));
2805
2821
  }
2806
- function vn(e) {
2822
+ function bn(e) {
2807
2823
  if (!e) return;
2808
2824
  let t = e.minSpeedPxPerSecond ?? 20, n = e.maxSpeedPxPerSecond ?? 240;
2809
- if (gn("autoScroll.minSpeedPxPerSecond", t), gn("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
2810
- e.speedPxPerSecond !== void 0 && gn("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
2825
+ if (vn("autoScroll.minSpeedPxPerSecond", t), vn("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
2826
+ e.speedPxPerSecond !== void 0 && vn("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
2811
2827
  }
2812
- function yn(e) {
2828
+ function xn(e) {
2813
2829
  let t = e?.minSpeedPxPerSecond ?? 20, n = e?.maxSpeedPxPerSecond ?? 240;
2814
2830
  return {
2815
2831
  enabled: e?.enabled ?? !1,
2816
2832
  maxSpeedPxPerSecond: n,
2817
2833
  minSpeedPxPerSecond: t,
2818
2834
  paused: !1,
2819
- speedPxPerSecond: _n(e?.speedPxPerSecond ?? 80, t, n)
2835
+ speedPxPerSecond: yn(e?.speedPxPerSecond ?? 80, t, n)
2820
2836
  };
2821
2837
  }
2822
- var bn = class {
2838
+ var Sn = class {
2823
2839
  frame = null;
2824
2840
  lastTimestamp = null;
2825
2841
  mounted = !1;
@@ -2839,9 +2855,9 @@ var bn = class {
2839
2855
  this.options.state.enabled && (this.options.state.paused = e, this.lastTimestamp = null, e ? this.cancelFrame() : this.schedule());
2840
2856
  }
2841
2857
  setSpeed(e) {
2842
- gn("auto-scroll speed", e);
2858
+ vn("auto-scroll speed", e);
2843
2859
  let t = this.options.state;
2844
- t.speedPxPerSecond = _n(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
2860
+ t.speedPxPerSecond = yn(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
2845
2861
  }
2846
2862
  tick = (e) => {
2847
2863
  this.frame = null;
@@ -2853,7 +2869,7 @@ var bn = class {
2853
2869
  return;
2854
2870
  }
2855
2871
  if (this.lastTimestamp !== null) {
2856
- let r = Math.min(hn, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
2872
+ let r = Math.min(_n, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
2857
2873
  n.scrollTop = Math.min(i, n.scrollTop + t.speedPxPerSecond * r / 1e3);
2858
2874
  }
2859
2875
  this.lastTimestamp = e, this.schedule();
@@ -2867,7 +2883,7 @@ var bn = class {
2867
2883
  };
2868
2884
  //#endregion
2869
2885
  //#region src/core/backendAutofill.ts
2870
- async function xn(e, t, n, r) {
2886
+ async function Cn(e, t, n, r) {
2871
2887
  let i = await e.onUnderfilled(n);
2872
2888
  if (!r()) return;
2873
2889
  if (!i.sessionId.trim()) throw TypeError("Vibe backend autofill requires a sessionId.");
@@ -2881,19 +2897,19 @@ async function xn(e, t, n, r) {
2881
2897
  status: "waiting"
2882
2898
  });
2883
2899
  }
2884
- function Sn(e, t) {
2900
+ function wn(e, t) {
2885
2901
  ["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);
2886
2902
  }
2887
- function Cn(e, t, n) {
2903
+ function Tn(e, t, n) {
2888
2904
  let r = t.autofill;
2889
- return !fn(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (Sn(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);
2905
+ return !mn(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (wn(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);
2890
2906
  }
2891
- function wn(e, t, n) {
2892
- return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = ln(e, n), Sn(t, n), !0);
2907
+ function En(e, t, n) {
2908
+ return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = dn(e, n), wn(t, n), !0);
2893
2909
  }
2894
2910
  //#endregion
2895
2911
  //#region src/core/backlogRestore.ts
2896
- async function Tn(e, t, n) {
2912
+ async function Dn(e, t, n) {
2897
2913
  if (!e) return;
2898
2914
  let r = new AbortController();
2899
2915
  n(r);
@@ -2908,7 +2924,7 @@ async function Tn(e, t, n) {
2908
2924
  }
2909
2925
  //#endregion
2910
2926
  //#region src/core/initialAutofill.ts
2911
- async function En({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, onPages: i, options: a, signal: o, state: s }) {
2927
+ async function On({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, onPages: i, options: a, signal: o, state: s }) {
2912
2928
  let c = a.autofill;
2913
2929
  if (!c) return;
2914
2930
  let l = s.items.length;
@@ -2921,7 +2937,7 @@ async function En({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
2921
2937
  return;
2922
2938
  }
2923
2939
  if (c.strategy === "backend") {
2924
- await xn(c, s, {
2940
+ await Cn(c, s, {
2925
2941
  cycleId: e,
2926
2942
  feedKey: c.feedKey,
2927
2943
  items: [...s.items],
@@ -2938,11 +2954,11 @@ async function En({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
2938
2954
  s.autofill.status = "exhausted";
2939
2955
  return;
2940
2956
  }
2941
- let u = await pn({
2957
+ let u = await hn({
2942
2958
  existingItems: s.items,
2943
2959
  initialCursor: s.next,
2944
2960
  loadPage: a.loadPage,
2945
- maximumRequests: an(c, !1),
2961
+ maximumRequests: sn(c, !1),
2946
2962
  onCollection: n,
2947
2963
  onDelayChange: (e) => {
2948
2964
  t() && Object.assign(s.autofill, e);
@@ -2965,13 +2981,13 @@ async function En({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
2965
2981
  }
2966
2982
  //#endregion
2967
2983
  //#region src/core/fill.ts
2968
- function Dn(e) {
2984
+ function kn(e) {
2969
2985
  return "items" in e ? { items: e.items } : "pages" in e ? { pages: e.pages } : { until: "end" };
2970
2986
  }
2971
- function On(e) {
2987
+ function An(e) {
2972
2988
  return `${typeof e}:${String(e)}`;
2973
2989
  }
2974
- function kn(e) {
2990
+ function jn(e) {
2975
2991
  if (!e || typeof e != "object") throw TypeError("Vibe fill target must be an object.");
2976
2992
  if ("pages" in e) {
2977
2993
  if (!Number.isInteger(e.pages) || e.pages <= 0) throw TypeError("Vibe fill pages must be a positive integer.");
@@ -2984,20 +3000,20 @@ function kn(e) {
2984
3000
  if ("until" in e && e.until === "end") return { until: "end" };
2985
3001
  throw TypeError("Vibe fill target must be { items }, { pages }, or { until: 'end' }.");
2986
3002
  }
2987
- function An(e) {
3003
+ function Mn(e) {
2988
3004
  if (!e) return;
2989
3005
  if (e.strategy === "frontend") {
2990
- en(e, "frontend fill");
3006
+ nn(e, "frontend fill");
2991
3007
  return;
2992
3008
  }
2993
3009
  if (!e.feedKey.trim()) throw TypeError("Vibe backend fill requires a feedKey.");
2994
3010
  let t = e.initialSession;
2995
3011
  if (t) {
2996
3012
  if (t.feedKey !== e.feedKey) throw TypeError("Vibe backend fill initialSession feedKey must match fill feedKey.");
2997
- kn(t.target);
3013
+ jn(t.target);
2998
3014
  }
2999
3015
  }
3000
- function jn(e, t, n = !0) {
3016
+ function Nn(e, t, n = !0) {
3001
3017
  let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a = $(i?.nextRequestAt);
3002
3018
  return {
3003
3019
  completedPages: i?.completedPages ?? 0,
@@ -3011,10 +3027,10 @@ function jn(e, t, n = !0) {
3011
3027
  sessionId: i?.sessionId ?? null,
3012
3028
  status: i?.status ?? "idle",
3013
3029
  strategy: e?.strategy ?? null,
3014
- target: i ? Dn(i.target) : null
3030
+ target: i ? kn(i.target) : null
3015
3031
  };
3016
3032
  }
3017
- function Mn(e) {
3033
+ function Pn(e) {
3018
3034
  return [
3019
3035
  "cancelling",
3020
3036
  "filling",
@@ -3022,7 +3038,7 @@ function Mn(e) {
3022
3038
  "waiting"
3023
3039
  ].includes(e.status);
3024
3040
  }
3025
- async function Nn({ existingItems: e, initialCursor: t, loadPage: n, onCollection: r = () => void 0, onDelayChange: i, onProgress: a, options: o, shouldPause: s = () => !1, signal: c, target: l }) {
3041
+ async function Fn({ existingItems: e, initialCursor: t, loadPage: n, onCollection: r = () => void 0, onDelayChange: i, onProgress: a, options: o, shouldPause: s = () => !1, signal: c, target: l }) {
3026
3042
  let u = [], d = [], f = [...e], p = /* @__PURE__ */ new Set(), m = 0, h = t, g = t, _ = t, v = 0, y;
3027
3043
  if ("items" in l && f.length >= l.items) return {
3028
3044
  completedPages: m,
@@ -3034,10 +3050,10 @@ async function Nn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
3034
3050
  status: "complete"
3035
3051
  };
3036
3052
  for (; _ !== null;) {
3037
- let e = On(h);
3053
+ let e = An(h);
3038
3054
  if (p.has(e)) throw Error("Vibe fill received a repeated cursor.");
3039
- if (p.add(e), await nn({
3040
- delayMs: tn(m, o),
3055
+ if (p.add(e), await an({
3056
+ delayMs: rn(m, o),
3041
3057
  onChange: i,
3042
3058
  signal: c
3043
3059
  }), m > 0 && s()) return {
@@ -3050,7 +3066,7 @@ async function Nn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
3050
3066
  status: "paused",
3051
3067
  total: y
3052
3068
  };
3053
- let t = Ut(await n({
3069
+ let t = Gt(await n({
3054
3070
  cursor: h,
3055
3071
  signal: c
3056
3072
  }));
@@ -3118,7 +3134,7 @@ async function Nn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
3118
3134
  }
3119
3135
  //#endregion
3120
3136
  //#region src/core/backendFill.ts
3121
- async function Pn(e, t, n, r) {
3137
+ async function In(e, t, n, r) {
3122
3138
  let i = await e.onStart(n);
3123
3139
  if (r()) {
3124
3140
  if (!i.sessionId.trim()) throw TypeError("Vibe backend fill requires a sessionId.");
@@ -3132,22 +3148,22 @@ async function Pn(e, t, n, r) {
3132
3148
  });
3133
3149
  }
3134
3150
  }
3135
- function Fn(e, t, n) {
3151
+ function Ln(e, t, n) {
3136
3152
  return e?.strategy === "backend" && n.feedKey === e.feedKey && n.sessionId === t.fill.sessionId;
3137
3153
  }
3138
- function In(e) {
3154
+ function Rn(e) {
3139
3155
  return Number.isInteger(e.completedPages) && e.completedPages >= 0 && Number.isInteger(e.received) && e.received >= 0 && Number.isInteger(e.sequence) && e.sequence >= 0;
3140
3156
  }
3141
- function Ln(e, t) {
3157
+ function zn(e, t) {
3142
3158
  if (!["complete", "exhausted"].includes(t.status)) return !0;
3143
3159
  let n = e.fill.target;
3144
3160
  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;
3145
3161
  }
3146
- function Rn(e, t, n) {
3162
+ function Bn(e, t, n) {
3147
3163
  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));
3148
3164
  }
3149
- function zn(e, t, n, r) {
3150
- return !Fn(e, t, n) || !In(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !Ln(t, n) ? !1 : (Rn(t, n, r), Object.assign(t.fill, {
3165
+ function Vn(e, t, n, r) {
3166
+ return !Ln(e, t, n) || !Rn(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !zn(t, n) ? !1 : (Bn(t, n, r), Object.assign(t.fill, {
3151
3167
  ...$(n.status === "waiting" ? n.nextRequestAt : null),
3152
3168
  completedPages: n.completedPages,
3153
3169
  error: n.error ?? null,
@@ -3156,45 +3172,45 @@ function zn(e, t, n, r) {
3156
3172
  status: n.status
3157
3173
  }), !0);
3158
3174
  }
3159
- function Bn(e, t, n, r) {
3175
+ function Hn(e, t, n, r) {
3160
3176
  if (e?.strategy !== "backend" || n.feedKey !== e.feedKey) return !1;
3161
3177
  let i = t.fill;
3162
- return t.fill = jn(e, n), !In(n) || !Ln(t, n) ? (t.fill = i, !1) : (Rn(t, n, r), !0);
3178
+ return t.fill = Nn(e, n), !Rn(n) || !zn(t, n) ? (t.fill = i, !1) : (Bn(t, n, r), !0);
3163
3179
  }
3164
3180
  //#endregion
3165
3181
  //#region src/core/fillController.ts
3166
- var Vn = class {
3182
+ var Un = class {
3167
3183
  abortController = null;
3168
3184
  cycle = 0;
3169
3185
  delayCountdown;
3170
3186
  requestVersion = 0;
3171
3187
  collection = null;
3172
3188
  constructor(e) {
3173
- this.options = e, this.delayCountdown = new rn((e) => {
3189
+ this.options = e, this.delayCountdown = new on((e) => {
3174
3190
  Object.assign(this.options.state.fill, e);
3175
3191
  }), this.syncBackendCountdown();
3176
3192
  }
3177
3193
  isActive() {
3178
- return Mn(this.options.state.fill);
3194
+ return Pn(this.options.state.fill);
3179
3195
  }
3180
3196
  applyUpdate(e) {
3181
- let t = zn(this.options.fill, this.options.state, e, this.options.onLastCursor);
3197
+ let t = Vn(this.options.fill, this.options.state, e, this.options.onLastCursor);
3182
3198
  return t && this.syncBackendCountdown(), t;
3183
3199
  }
3184
3200
  restoreSession(e) {
3185
- let t = Bn(this.options.fill, this.options.state, e, this.options.onLastCursor);
3201
+ let t = Hn(this.options.fill, this.options.state, e, this.options.onLastCursor);
3186
3202
  return t && this.syncBackendCountdown(), t;
3187
3203
  }
3188
3204
  async start(e, t = {}) {
3189
3205
  let n = this.options.fill;
3190
3206
  if (!n) throw Error("Vibe fill is not configured.");
3191
3207
  if (this.isActive()) throw Error("Vibe fill is already active.");
3192
- let r = kn(e), i = kn(t.target ?? r), a = t.progressOffset ?? {
3208
+ let r = jn(e), i = jn(t.target ?? r), a = t.progressOffset ?? {
3193
3209
  completedPages: 0,
3194
3210
  received: 0
3195
3211
  }, o = t.cycleId ?? `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
3196
3212
  if (this.options.state.fill = {
3197
- ...jn(n, void 0, !1),
3213
+ ...Nn(n, void 0, !1),
3198
3214
  completedPages: a.completedPages,
3199
3215
  cycleId: o,
3200
3216
  received: a.received,
@@ -3207,7 +3223,7 @@ var Vn = class {
3207
3223
  let s = ++this.requestVersion, c = new AbortController();
3208
3224
  this.abortController = c;
3209
3225
  try {
3210
- n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await Pn(n, this.options.state, {
3226
+ n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await In(n, this.options.state, {
3211
3227
  cycleId: o,
3212
3228
  feedKey: n.feedKey,
3213
3229
  items: [...this.options.state.items],
@@ -3225,7 +3241,7 @@ var Vn = class {
3225
3241
  }
3226
3242
  async cancel() {
3227
3243
  let { fill: e, state: t } = this.options;
3228
- if (!Mn(t.fill) || !t.fill.cycleId) return;
3244
+ if (!Pn(t.fill) || !t.fill.cycleId) return;
3229
3245
  let n = {
3230
3246
  cycleId: t.fill.cycleId,
3231
3247
  feedKey: t.fill.feedKey ?? "",
@@ -3269,7 +3285,7 @@ var Vn = class {
3269
3285
  });
3270
3286
  }
3271
3287
  reset() {
3272
- this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = jn(this.options.fill, void 0, !1), this.collection = null;
3288
+ this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = Nn(this.options.fill, void 0, !1), this.collection = null;
3273
3289
  }
3274
3290
  destroy() {
3275
3291
  this.abortLocalRequest(), this.delayCountdown.clear();
@@ -3304,7 +3320,7 @@ var Vn = class {
3304
3320
  s.fill.status = "until" in t ? "complete" : "exhausted";
3305
3321
  return;
3306
3322
  }
3307
- let c = await Nn({
3323
+ let c = await Fn({
3308
3324
  existingItems: s.items,
3309
3325
  initialCursor: s.next,
3310
3326
  loadPage: o,
@@ -3352,7 +3368,7 @@ var Vn = class {
3352
3368
  };
3353
3369
  //#endregion
3354
3370
  //#region src/core/fillReconciliation.ts
3355
- async function Hn({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r, setLastCursor: i, signal: a, state: o }) {
3371
+ async function Wn({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r, setLastCursor: i, signal: a, state: o }) {
3356
3372
  if (!e.needsReconciliation(o.items)) return "skipped";
3357
3373
  let s = await e.reconcile({
3358
3374
  existingItems: o.items,
@@ -3365,7 +3381,7 @@ async function Hn({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r,
3365
3381
  }
3366
3382
  //#endregion
3367
3383
  //#region src/core/feedFooter.ts
3368
- function Un(e) {
3384
+ function Gn(e) {
3369
3385
  return {
3370
3386
  cancelAutofill: () => e.cancelAutofill(),
3371
3387
  loadMore: () => e.loadNext(),
@@ -3377,46 +3393,46 @@ function Un(e) {
3377
3393
  retryFill: () => e.retryFill()
3378
3394
  };
3379
3395
  }
3380
- function Wn(e) {
3396
+ function Kn(e) {
3381
3397
  if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
3382
3398
  }
3383
- function Gn(e) {
3384
- e?.intervalMs !== void 0 && Wn(e.intervalMs);
3399
+ function qn(e) {
3400
+ e?.intervalMs !== void 0 && Kn(e.intervalMs);
3385
3401
  }
3386
- function Kn(e) {
3402
+ function Jn(e) {
3387
3403
  return {
3388
3404
  enabled: e?.enabled ?? !1,
3389
3405
  includePostItems: e?.includePostItems ?? !1,
3390
3406
  intervalMs: e?.intervalMs ?? 5e3
3391
3407
  };
3392
3408
  }
3393
- function qn(e, t) {
3409
+ function Yn(e, t) {
3394
3410
  if (typeof t == "boolean") {
3395
3411
  e.enabled = t;
3396
3412
  return;
3397
3413
  }
3398
- Gn(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);
3414
+ qn(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);
3399
3415
  }
3400
3416
  //#endregion
3401
3417
  //#region src/core/reelInfoSheet.ts
3402
- function Jn(e) {
3418
+ function Xn(e) {
3403
3419
  return { enabled: e?.enabled ?? !1 };
3404
3420
  }
3405
- function Yn(e, t, n) {
3421
+ function Zn(e, t, n) {
3406
3422
  if (n && !t) throw Error("Vibe cannot enable reelInfoSheet without a configured component.");
3407
3423
  e.enabled = n;
3408
3424
  }
3409
3425
  //#endregion
3410
3426
  //#region src/core/initialRuntimeState.ts
3411
- function Xn(e, t) {
3427
+ function Qn(e, t) {
3412
3428
  let n = e.initialPage;
3413
3429
  return {
3414
3430
  activeReelPostId: null,
3415
- autoScroll: yn(e.autoScroll),
3416
- autofill: ln(e.autofill),
3431
+ autoScroll: xn(e.autoScroll),
3432
+ autofill: dn(e.autofill),
3417
3433
  current: n?.current ?? null,
3418
3434
  error: null,
3419
- fill: jn(e.fill),
3435
+ fill: Nn(e.fill),
3420
3436
  infiniteScroll: e.infiniteScroll ?? !0,
3421
3437
  isLoading: !n,
3422
3438
  isLoadingMore: !1,
@@ -3427,14 +3443,14 @@ function Xn(e, t) {
3427
3443
  next: n?.next ?? null,
3428
3444
  nextPageError: null,
3429
3445
  phoneMode: !1,
3430
- reelAutoAdvance: Kn(e.reelAutoAdvance),
3446
+ reelAutoAdvance: Jn(e.reelAutoAdvance),
3431
3447
  reelForward: {
3432
3448
  error: null,
3433
3449
  status: "idle"
3434
3450
  },
3435
3451
  reelForwardIndex: null,
3436
3452
  reelForwardItem: null,
3437
- reelInfoSheet: Jn(e.reelInfoSheet),
3453
+ reelInfoSheet: Xn(e.reelInfoSheet),
3438
3454
  reelInfoSheetOverlay: !1,
3439
3455
  reelMediaSource: "original",
3440
3456
  reelOrigin: null,
@@ -3443,20 +3459,20 @@ function Xn(e, t) {
3443
3459
  }
3444
3460
  //#endregion
3445
3461
  //#region src/core/options.ts
3446
- function Zn(e, t) {
3462
+ function $n(e, t) {
3447
3463
  if (t) {
3448
3464
  if (!Number.isFinite(t.height) || t.height <= 0) throw TypeError(`Vibe ${e} height must be a positive number.`);
3449
3465
  if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe ${e} background must be "default" or "transparent".`);
3450
3466
  }
3451
3467
  }
3452
- function Qn(e, t) {
3468
+ function er(e, t) {
3453
3469
  if (t) {
3454
3470
  if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe mediaCard ${e} background must be "default" or "transparent".`);
3455
3471
  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.`);
3456
3472
  }
3457
3473
  }
3458
- function $n(e) {
3459
- if (vn(e.autoScroll), Zn("cardHeader", e.cardHeader), Zn("cardFooter", e.cardFooter), Qn("header", e.mediaCard?.header), Qn("footer", e.mediaCard?.footer), cn(e.autofill), An(e.fill), X(e.masonry), Gn(e.reelAutoAdvance), e.removalReconciliation) {
3474
+ function tr(e) {
3475
+ if (bn(e.autoScroll), $n("cardHeader", e.cardHeader), $n("cardFooter", e.cardFooter), er("header", e.mediaCard?.header), er("footer", e.mediaCard?.footer), un(e.autofill), Mn(e.fill), ce(e.masonry), qn(e.reelAutoAdvance), e.removalReconciliation) {
3460
3476
  if (!Number.isInteger(e.removalReconciliation.pageSize) || e.removalReconciliation.pageSize <= 0) throw TypeError("Vibe removalReconciliation pageSize must be a positive integer.");
3461
3477
  let t = e.removalReconciliation.maxReplayPages ?? 5;
3462
3478
  if (!Number.isInteger(t) || t <= 0) throw TypeError("Vibe removalReconciliation maxReplayPages must be a positive integer.");
@@ -3471,7 +3487,7 @@ function $n(e) {
3471
3487
  if (e.fill?.strategy === "frontend" && !e.loadPage) throw TypeError("Vibe frontend fill requires loadPage.");
3472
3488
  if (e.fill?.strategy === "backend" && e.fill.initialSession && !e.initialPage) throw TypeError("Vibe backend fill restoration requires initialPage.");
3473
3489
  }
3474
- function er(e) {
3490
+ function nr(e) {
3475
3491
  if (typeof e != "string") return e;
3476
3492
  if (typeof document > "u") throw Error("Vibe cannot resolve a selector without a document.");
3477
3493
  let t = document.querySelector(e);
@@ -3480,7 +3496,7 @@ function er(e) {
3480
3496
  }
3481
3497
  //#endregion
3482
3498
  //#region src/core/pageRequest.ts
3483
- async function tr({ append: e, autofillController: t, cursor: n, isCurrent: r, loadPage: i, onLastCursor: a, onPages: o, options: s, signal: c, state: l }) {
3499
+ async function rr({ append: e, autofillController: t, cursor: n, isCurrent: r, loadPage: i, onLastCursor: a, onPages: o, options: s, signal: c, state: l }) {
3484
3500
  let u = s.autofill, d = e && u?.strategy === "frontend" && (l.autofill.status === "paused" || l.autofill.status === "error"), f = d ? {
3485
3501
  received: l.autofill.received,
3486
3502
  requests: l.autofill.requests
@@ -3492,11 +3508,11 @@ async function tr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
3492
3508
  let m = !1;
3493
3509
  try {
3494
3510
  if (u?.strategy === "frontend") {
3495
- let s = await pn({
3511
+ let s = await hn({
3496
3512
  existingItems: e ? l.items : [],
3497
3513
  initialCursor: n,
3498
3514
  loadPage: i,
3499
- maximumRequests: f ? Math.max(0, an(u) - f.requests) : void 0,
3515
+ maximumRequests: f ? Math.max(0, sn(u) - f.requests) : void 0,
3500
3516
  onCollection: (e) => t.captureCollection(e, r()),
3501
3517
  onDelayChange: (e) => {
3502
3518
  r() && Object.assign(l.autofill, e);
@@ -3519,7 +3535,7 @@ async function tr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
3519
3535
  }), o(s.pages), t.clearCollection();
3520
3536
  return;
3521
3537
  }
3522
- let s = Ut(await i({
3538
+ let s = Gt(await i({
3523
3539
  cursor: n,
3524
3540
  signal: c
3525
3541
  }));
@@ -3539,7 +3555,7 @@ async function tr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
3539
3555
  l.autofill.status = "complete";
3540
3556
  return;
3541
3557
  }
3542
- await xn(u, l, {
3558
+ await Cn(u, l, {
3543
3559
  cycleId: p,
3544
3560
  feedKey: u.feedKey,
3545
3561
  items: h.slice(d.length),
@@ -3561,16 +3577,16 @@ async function tr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
3561
3577
  }
3562
3578
  //#endregion
3563
3579
  //#region src/core/removalReconciliationController.ts
3564
- function nr(e) {
3580
+ function ir(e) {
3565
3581
  return `${typeof e}:${String(e)}`;
3566
3582
  }
3567
- function rr(e) {
3583
+ function ar(e) {
3568
3584
  return `${typeof e}:${String(e)}`;
3569
3585
  }
3570
- function ir(e) {
3586
+ function or(e) {
3571
3587
  return e.map(({ postId: e }) => e);
3572
3588
  }
3573
- var ar = class {
3589
+ var sr = class {
3574
3590
  delay;
3575
3591
  enabled;
3576
3592
  maxReplayPages;
@@ -3589,7 +3605,7 @@ var ar = class {
3589
3605
  e.status === "complete" && (this.pages = [...this.pages.slice(0, e.replaceFrom), ...e.pages].slice(-this.maxReplayPages), this.pending = null);
3590
3606
  }
3591
3607
  filterItems(e) {
3592
- return this.tombstones.size === 0 ? [...e] : e.filter(({ postId: e }) => !this.tombstones.has(nr(e)));
3608
+ return this.tombstones.size === 0 ? [...e] : e.filter(({ postId: e }) => !this.tombstones.has(ir(e)));
3593
3609
  }
3594
3610
  needsReconciliation(e) {
3595
3611
  return this.pending !== null || this.findUnderfilledPage(e) >= 0;
@@ -3602,45 +3618,45 @@ var ar = class {
3602
3618
  }
3603
3619
  recordInitialPage(e) {
3604
3620
  e && this.recordPages([{
3605
- contributionIds: ir(e.items),
3606
- cursor: qt(e),
3621
+ contributionIds: or(e.items),
3622
+ cursor: Yt(e),
3607
3623
  next: e.next,
3608
- returnedIds: ir(e.items)
3624
+ returnedIds: or(e.items)
3609
3625
  }]);
3610
3626
  }
3611
3627
  remove(e) {
3612
- e.forEach((e) => this.tombstones.add(nr(e)));
3628
+ e.forEach((e) => this.tombstones.add(ir(e)));
3613
3629
  }
3614
3630
  reset() {
3615
3631
  this.pages = [], this.pending = null, this.tombstones.clear();
3616
3632
  }
3617
3633
  restore(e) {
3618
- e.forEach((e) => this.tombstones.delete(nr(e)));
3634
+ e.forEach((e) => this.tombstones.delete(ir(e)));
3619
3635
  }
3620
3636
  async reconcile({ existingItems: e, loadPage: t, onDelayChange: n = () => void 0, shouldPause: r = () => !1, signal: i }) {
3621
3637
  let a = this.pending ?? this.createSession(e);
3622
3638
  for (this.pending = a; a.remainingRequests > 0;) {
3623
- let e = rr(a.cursor);
3639
+ let e = ar(a.cursor);
3624
3640
  if (a.seenCursors.has(e)) throw Error("Vibe removal reconciliation received a repeated cursor.");
3625
- if (await nn({
3626
- delayMs: tn(a.pages.length, this.delay),
3641
+ if (await an({
3642
+ delayMs: rn(a.pages.length, this.delay),
3627
3643
  onChange: n,
3628
3644
  signal: i
3629
3645
  }), a.pages.length > 0 && r()) return this.result(a, "paused");
3630
- let o = Ut(await t({
3646
+ let o = Gt(await t({
3631
3647
  cursor: a.cursor,
3632
3648
  signal: i
3633
3649
  }));
3634
3650
  a.seenCursors.add(e);
3635
3651
  let s = this.filterItems(o.items), c = [];
3636
3652
  if (s.forEach((e) => {
3637
- let t = nr(e.postId);
3653
+ let t = ir(e.postId);
3638
3654
  a.attributed.has(t) || (a.attributed.add(t), c.push(e.postId)), a.appended.has(t) || (a.appended.add(t), a.items.push(e));
3639
3655
  }), a.pages.push({
3640
3656
  contributionIds: c,
3641
3657
  cursor: a.cursor,
3642
3658
  next: o.next,
3643
- returnedIds: ir(s)
3659
+ returnedIds: or(s)
3644
3660
  }), a.lastCursor = a.cursor, a.next = o.next, --a.remainingRequests, o.total !== void 0 && (a.total = o.total), a.next === null ? a.remainingRequests = 0 : a.cursor = a.next, a.remainingRequests > 0 && r()) return this.result(a, "paused");
3645
3661
  }
3646
3662
  return this.result(a, "complete");
@@ -3648,9 +3664,9 @@ var ar = class {
3648
3664
  createSession(e) {
3649
3665
  let t = this.findUnderfilledPage(e), n = t < 0 ? [] : this.pages.slice(t), r = n[0];
3650
3666
  if (!r) throw Error("Vibe has no underfilled provider page to reconcile.");
3651
- let i = new Set(n.flatMap(({ contributionIds: e }) => e.map(nr))), a = new Set(e.map(({ postId: e }) => nr(e)).filter((e) => !i.has(e)));
3667
+ let i = new Set(n.flatMap(({ contributionIds: e }) => e.map(ir))), a = new Set(e.map(({ postId: e }) => ir(e)).filter((e) => !i.has(e)));
3652
3668
  return {
3653
- appended: new Set(e.map(({ postId: e }) => nr(e))),
3669
+ appended: new Set(e.map(({ postId: e }) => ir(e))),
3654
3670
  attributed: new Set(a),
3655
3671
  cursor: r.cursor,
3656
3672
  items: [],
@@ -3675,11 +3691,11 @@ var ar = class {
3675
3691
  }
3676
3692
  findUnderfilledPage(e) {
3677
3693
  if (!this.enabled || this.pages.length === 0) return -1;
3678
- let t = new Set(e.map(({ postId: e }) => nr(e)));
3679
- return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has(nr(e))).length < this.pageSize);
3694
+ let t = new Set(e.map(({ postId: e }) => ir(e)));
3695
+ return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has(ir(e))).length < this.pageSize);
3680
3696
  }
3681
3697
  recordPage(e) {
3682
- let t = rr(e.cursor), n = this.pages.findIndex(({ cursor: e }) => rr(e) === t);
3698
+ let t = ar(e.cursor), n = this.pages.findIndex(({ cursor: e }) => ar(e) === t);
3683
3699
  n >= 0 && (this.pages = this.pages.slice(0, n)), this.pages.push({
3684
3700
  ...e,
3685
3701
  contributionIds: [...e.contributionIds],
@@ -3689,7 +3705,7 @@ var ar = class {
3689
3705
  };
3690
3706
  //#endregion
3691
3707
  //#region src/core/activeItemRemoval.ts
3692
- function or(e, t, n, r, i) {
3708
+ function cr(e, t, n, r, i) {
3693
3709
  let a = new Set(t.map(({ item: e }) => e.postId));
3694
3710
  if (e.activeReelPostId === null || !a.has(e.activeReelPostId)) return;
3695
3711
  let o = e.items[Math.max(n, 0)];
@@ -3702,7 +3718,7 @@ function or(e, t, n, r, i) {
3702
3718
  }
3703
3719
  //#endregion
3704
3720
  //#region src/core/exactMediaRemovalController.ts
3705
- function sr(e, t) {
3721
+ function lr(e, t) {
3706
3722
  let [n, ...r] = t;
3707
3723
  if (!n) throw Error("Vibe items must contain at least one media asset.");
3708
3724
  return {
@@ -3711,10 +3727,10 @@ function sr(e, t) {
3711
3727
  items: r
3712
3728
  };
3713
3729
  }
3714
- function cr(e) {
3730
+ function ur(e) {
3715
3731
  if (!Number.isInteger(e.mediaIndex) || e.mediaIndex < 0) throw TypeError("Vibe mediaIndex must be a non-negative integer.");
3716
3732
  }
3717
- var lr = class {
3733
+ var dr = class {
3718
3734
  generation = 0;
3719
3735
  metadata = /* @__PURE__ */ new WeakMap();
3720
3736
  state;
@@ -3722,10 +3738,10 @@ var lr = class {
3722
3738
  this.options = e, this.state = e.state;
3723
3739
  }
3724
3740
  remove(e) {
3725
- cr(e);
3741
+ ur(e);
3726
3742
  let t = this.state.items.findIndex(({ postId: t }) => t === e.postId), n = this.state.items[t];
3727
3743
  if (!n) return null;
3728
- let r = [...M(n)], i = r[e.mediaIndex];
3744
+ let r = [...P(n)], i = r[e.mediaIndex];
3729
3745
  if (!i) return null;
3730
3746
  let a = Object.freeze({
3731
3747
  media: i,
@@ -3739,7 +3755,7 @@ var lr = class {
3739
3755
  restored: !1
3740
3756
  });
3741
3757
  let o = this.state.mediaIndices.get(n.postId) ?? 0, s = this.isReelOpen() && this.state.activeReelPostId === n.postId, c = s && o === e.mediaIndex;
3742
- return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = sr(n, r), this.updateMediaIndexAfterRemoval(n.postId, e.mediaIndex, c), a) : (this.state.items.splice(t, 1), this.options.onPostRemoved(n.postId), this.state.mediaIndices.delete(n.postId), s && this.advanceFromRemovedPost(a, n), a);
3758
+ return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = lr(n, r), this.updateMediaIndexAfterRemoval(n.postId, e.mediaIndex, c), a) : (this.state.items.splice(t, 1), this.options.onPostRemoved(n.postId), this.state.mediaIndices.delete(n.postId), s && this.advanceFromRemovedPost(a, n), a);
3743
3759
  }
3744
3760
  reset() {
3745
3761
  this.generation += 1;
@@ -3764,32 +3780,32 @@ var lr = class {
3764
3780
  return this.state.layout === "reel" || this.state.reelOrigin === "masonry";
3765
3781
  }
3766
3782
  restoreIntoPost(e, t) {
3767
- let n = this.state.items[e], r = [...M(n)], i = Math.min(t.mediaIndex, r.length);
3768
- if (r.splice(i, 0, t.media), this.state.items[e] = sr(n, r), this.state.activeReelPostId !== t.postId) return;
3783
+ let n = this.state.items[e], r = [...P(n)], i = Math.min(t.mediaIndex, r.length);
3784
+ if (r.splice(i, 0, t.media), this.state.items[e] = lr(n, r), this.state.activeReelPostId !== t.postId) return;
3769
3785
  let a = this.state.mediaIndices.get(t.postId) ?? 0;
3770
3786
  a >= i && this.state.mediaIndices.set(t.postId, a + 1);
3771
3787
  }
3772
3788
  updateMediaIndexAfterRemoval(e, t, n) {
3773
3789
  let r = this.state.items.find((t) => t.postId === e);
3774
3790
  if (!r) return;
3775
- let i = M(r).length, a = this.state.mediaIndices.get(e) ?? 0, o = a;
3791
+ let i = P(r).length, a = this.state.mediaIndices.get(e) ?? 0, o = a;
3776
3792
  n ? o = t < i ? t : 0 : t < a && (o = a - 1), this.state.mediaIndices.set(e, Math.min(o, i - 1));
3777
3793
  }
3778
3794
  };
3779
3795
  //#endregion
3780
3796
  //#region src/core/itemPlacement.ts
3781
- function ur(e, t) {
3797
+ function fr(e, t) {
3782
3798
  let n = new Set(t);
3783
3799
  return e.flatMap((e, t) => n.has(e.postId) ? [{
3784
3800
  index: t,
3785
3801
  item: e
3786
3802
  }] : []);
3787
3803
  }
3788
- function dr(e, t) {
3804
+ function pr(e, t) {
3789
3805
  let n = new Set(t.map(({ item: e }) => e.postId));
3790
3806
  return e.filter((e) => !n.has(e.postId));
3791
3807
  }
3792
- function fr(e, t) {
3808
+ function mr(e, t) {
3793
3809
  t.forEach(({ index: e }) => {
3794
3810
  if (!Number.isInteger(e) || e < 0) throw Error("Vibe item restore indexes must be non-negative integers.");
3795
3811
  });
@@ -3800,7 +3816,7 @@ function fr(e, t) {
3800
3816
  }
3801
3817
  //#endregion
3802
3818
  //#region src/core/itemRemovalController.ts
3803
- var pr = 20, mr = class {
3819
+ var hr = 20, gr = class {
3804
3820
  generation = 0;
3805
3821
  historyLimit;
3806
3822
  metadata = /* @__PURE__ */ new WeakMap();
@@ -3809,7 +3825,7 @@ var pr = 20, mr = class {
3809
3825
  itemOrder;
3810
3826
  stopItemsWatcher;
3811
3827
  constructor(e) {
3812
- this.options = e, this.historyLimit = e.historyLimit ?? pr, this.state = e.state, this.itemOrder = this.state.items.map(({ postId: e }) => e), this.stopItemsWatcher = O(() => this.state.items, (e) => this.appendUnknownItems(e), { flush: "sync" });
3828
+ this.options = e, this.historyLimit = e.historyLimit ?? hr, this.state = e.state, this.itemOrder = this.state.items.map(({ postId: e }) => e), this.stopItemsWatcher = O(() => this.state.items, (e) => this.appendUnknownItems(e), { flush: "sync" });
3813
3829
  }
3814
3830
  destroy() {
3815
3831
  this.reset(), this.stopItemsWatcher();
@@ -3823,7 +3839,7 @@ var pr = 20, mr = class {
3823
3839
  let a = this.options.startRemoval(i, t);
3824
3840
  if (a > 0 && await new Promise((e) => setTimeout(e, a)), this.metadata.get(r)?.generation !== this.generation) return r;
3825
3841
  let o = this.state.items.findIndex((e) => e.postId === this.state.activeReelPostId), s = new Set(n.map(({ item: e }) => e.postId)), c = o < 0 ? 0 : this.state.items.slice(0, o).filter(({ postId: e }) => s.has(e)).length, l = Math.max(o - c, 0);
3826
- return this.state.items = dr(this.state.items, n), this.options.onItemsRemoved(r, n, l), this.record(r), r;
3842
+ return this.state.items = pr(this.state.items, n), this.options.onItemsRemoved(r, n, l), this.record(r), r;
3827
3843
  }
3828
3844
  reset() {
3829
3845
  this.generation += 1, this.history = [], this.itemOrder = [];
@@ -3834,7 +3850,7 @@ var pr = 20, mr = class {
3834
3850
  this.restoreRemoval(t);
3835
3851
  return;
3836
3852
  }
3837
- let n = new Set(this.state.items.map(({ postId: e }) => e)), r = e.filter(({ item: e }) => n.has(e.postId) ? !1 : (n.add(e.postId), !0)), i = fr(this.state.items, r);
3853
+ let n = new Set(this.state.items.map(({ postId: e }) => e)), r = e.filter(({ item: e }) => n.has(e.postId) ? !1 : (n.add(e.postId), !0)), i = mr(this.state.items, r);
3838
3854
  this.registerExternalPlacements(r), this.state.items = i, r.length > 0 && this.options.onRemovalRestored(r);
3839
3855
  }
3840
3856
  restoreRemoval(e) {
@@ -3860,7 +3876,7 @@ var pr = 20, mr = class {
3860
3876
  }
3861
3877
  collectOrderedPlacements(e) {
3862
3878
  let t = new Map(this.itemOrder.map((e, t) => [e, t]));
3863
- return ur(this.state.items, e).map((e) => ({
3879
+ return fr(this.state.items, e).map((e) => ({
3864
3880
  index: t.get(e.item.postId) ?? e.index,
3865
3881
  item: e.item
3866
3882
  }));
@@ -3891,7 +3907,7 @@ var pr = 20, mr = class {
3891
3907
  let r = new Map(this.itemOrder.map((e, t) => [e, t]));
3892
3908
  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;
3893
3909
  }
3894
- }, hr = class {
3910
+ }, _r = class {
3895
3911
  forward = null;
3896
3912
  forwardPromise = null;
3897
3913
  forwardVersion = 0;
@@ -3978,7 +3994,7 @@ var pr = 20, mr = class {
3978
3994
  }
3979
3995
  }
3980
3996
  }
3981
- }, gr = class {
3997
+ }, vr = class {
3982
3998
  generation = 0;
3983
3999
  pending = Promise.resolve();
3984
4000
  constructor(e) {
@@ -3995,7 +4011,7 @@ var pr = 20, mr = class {
3995
4011
  if (!n) return;
3996
4012
  let r = t.mediaIndices.get(e.postId) ?? 0;
3997
4013
  if (e.mediaIndex === r) {
3998
- if (M(n).length > 1) {
4014
+ if (P(n).length > 1) {
3999
4015
  await this.options.transitionMedia(1);
4000
4016
  return;
4001
4017
  }
@@ -4028,24 +4044,24 @@ var pr = 20, mr = class {
4028
4044
  };
4029
4045
  //#endregion
4030
4046
  //#region src/core/removalControllers.ts
4031
- function _r(e) {
4032
- let t = new hr(e), n = new gr({
4047
+ function yr(e) {
4048
+ let t = new _r(e), n = new vr({
4033
4049
  state: e.state,
4034
4050
  transitionMedia: (t) => e.surface()?.transitionActiveReelMedia(t) ?? Promise.resolve(!1),
4035
4051
  transitionPost: (t) => e.surface()?.transitionActiveReelPost(t) ?? Promise.resolve(!1)
4036
4052
  });
4037
4053
  return {
4038
- exactMediaRemoval: new lr({
4054
+ exactMediaRemoval: new dr({
4039
4055
  onActivate: e.onActivate,
4040
4056
  onPostRemoved: (t) => e.onItemsRemoved([t]),
4041
4057
  onPostRestored: (t) => e.onItemsRestored([t]),
4042
4058
  reelForward: t,
4043
4059
  state: e.state
4044
4060
  }),
4045
- itemRemoval: new mr({
4061
+ itemRemoval: new gr({
4046
4062
  historyLimit: e.historyLimit,
4047
4063
  onItemsRemoved: (n, r, i) => {
4048
- e.onItemsRemoved(r.map(({ item: e }) => e.postId)), or(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
4064
+ e.onItemsRemoved(r.map(({ item: e }) => e.postId)), cr(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
4049
4065
  },
4050
4066
  onRemovalRestored: (n) => {
4051
4067
  e.onItemsRestored(n.map(({ item: e }) => e.postId));
@@ -4060,17 +4076,17 @@ function _r(e) {
4060
4076
  reelRemoval: n
4061
4077
  };
4062
4078
  }
4063
- var vr = 1.5;
4064
- function yr(e) {
4079
+ var br = 1.5;
4080
+ function xr(e) {
4065
4081
  let t = Math.min(e.screenWidth, e.screenHeight);
4066
4082
  if (t > 0 && t < 600) return !0;
4067
- let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * vr;
4083
+ let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * br;
4068
4084
  return !e.hasHover && n > 0 && n < 600 && r;
4069
4085
  }
4070
- function br(e) {
4071
- return yr(e) ? "reel" : "masonry";
4086
+ function Sr(e) {
4087
+ return xr(e) ? "reel" : "masonry";
4072
4088
  }
4073
- function xr(e) {
4089
+ function Cr(e) {
4074
4090
  let t = e.ownerDocument.defaultView, n = e.ownerDocument.documentElement;
4075
4091
  return {
4076
4092
  hasHover: typeof t?.matchMedia == "function" && t.matchMedia("(hover: hover)").matches,
@@ -4080,15 +4096,15 @@ function xr(e) {
4080
4096
  viewportWidth: n.clientWidth
4081
4097
  };
4082
4098
  }
4083
- function Sr(e) {
4084
- return yr(xr(e));
4099
+ function wr(e) {
4100
+ return xr(Cr(e));
4085
4101
  }
4086
- function Cr(e) {
4087
- return br(xr(e));
4102
+ function Tr(e) {
4103
+ return Sr(Cr(e));
4088
4104
  }
4089
4105
  //#endregion
4090
4106
  //#region src/core/responsiveLayoutController.ts
4091
- var wr = class {
4107
+ var Er = class {
4092
4108
  layoutMode;
4093
4109
  resizeObserver = null;
4094
4110
  target = null;
@@ -4113,10 +4129,10 @@ var wr = class {
4113
4129
  }
4114
4130
  handleResponsiveLayout = () => {
4115
4131
  if (!this.target) return;
4116
- let e = Cr(this.target);
4117
- this.state.phoneMode = Sr(this.target), this.state.reelInfoSheetOverlay = this.state.phoneMode, this.state.reelMediaSource = e === "reel" ? "preview" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
4132
+ let e = Tr(this.target);
4133
+ this.state.phoneMode = wr(this.target), this.state.reelInfoSheetOverlay = this.state.phoneMode, this.state.reelMediaSource = this.state.phoneMode ? "mobile" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
4118
4134
  };
4119
- }, Tr = class {
4135
+ }, Dr = class {
4120
4136
  routedReelPostId = null;
4121
4137
  reelRouteIsActive = !1;
4122
4138
  constructor(e, t) {
@@ -4143,7 +4159,7 @@ var wr = class {
4143
4159
  let i = this.reelRouteIsActive ? "replace" : "push";
4144
4160
  this.reelRouteIsActive = !0, this.routedReelPostId = e, this.options.router[i](r);
4145
4161
  }
4146
- }, Er = class {
4162
+ }, Or = class {
4147
4163
  app = null;
4148
4164
  autoScroll;
4149
4165
  autofillController;
@@ -4165,24 +4181,24 @@ var wr = class {
4165
4181
  notificationItems;
4166
4182
  state;
4167
4183
  constructor(e) {
4168
- this.options = e, $n(e);
4184
+ this.options = e, tr(e);
4169
4185
  let t = e.layout ?? "masonry";
4170
- this.state = x(Xn(e, t)), this.lastLoadedCursor = e.initialPage ? qt(e.initialPage) : null, this.notificationItems = I(this.state), this.autoScroll = new bn({
4186
+ this.state = x(Qn(e, t)), this.lastLoadedCursor = e.initialPage ? Yt(e.initialPage) : null, this.notificationItems = R(this.state), this.autoScroll = new Sn({
4171
4187
  getScrollElement: () => this.surface?.getAutoScrollElement() ?? null,
4172
4188
  state: this.state.autoScroll
4173
- }), this.autofillController = new mn({
4189
+ }), this.autofillController = new gn({
4174
4190
  cancelRequest: () => this.cancelRequest(),
4175
4191
  onLastCursor: (e) => this.setCurrentCursor(e),
4176
4192
  onPages: (e) => this.removalReconciliation.recordPages(e),
4177
4193
  options: e.autofill,
4178
4194
  state: this.state
4179
- }), this.removalReconciliation = new ar(e), this.removalReconciliation.recordInitialPage(e.initialPage), this.fillController = new Vn({
4195
+ }), this.removalReconciliation = new sr(e), this.removalReconciliation.recordInitialPage(e.initialPage), this.fillController = new Un({
4180
4196
  fill: e.fill,
4181
4197
  loadPage: e.loadPage ? (e) => this.loadFilteredPage(e) : void 0,
4182
4198
  needsFrontendPreparation: () => this.removalReconciliation.needsReconciliation(this.state.items),
4183
4199
  onLastCursor: (e) => this.setCurrentCursor(e),
4184
4200
  onPages: (e) => this.removalReconciliation.recordPages(e),
4185
- prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) => Hn({
4201
+ prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) => Wn({
4186
4202
  controller: this.removalReconciliation,
4187
4203
  isCurrent: t,
4188
4204
  loadPage: e.loadPage,
@@ -4192,8 +4208,8 @@ var wr = class {
4192
4208
  state: this.state
4193
4209
  }),
4194
4210
  state: this.state
4195
- }), this.routing = new Tr(e.routing, this.state);
4196
- let n = _r({
4211
+ }), this.routing = new Dr(e.routing, this.state);
4212
+ let n = yr({
4197
4213
  historyLimit: e.removalHistoryLimit,
4198
4214
  onActivate: (e) => this.setActiveReelPost(e),
4199
4215
  onItemsRemoved: (e) => this.removalReconciliation.remove(e),
@@ -4202,20 +4218,20 @@ var wr = class {
4202
4218
  state: this.state,
4203
4219
  surface: () => this.surface
4204
4220
  });
4205
- this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new wr(t, this.state, () => {
4221
+ this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new Er(t, this.state, () => {
4206
4222
  this.routing.syncFeed();
4207
4223
  }), this.startStateNotifications();
4208
4224
  }
4209
4225
  async mount() {
4210
4226
  if (this.app) throw Error("Vibe is already mounted.");
4211
4227
  this.startStateNotifications();
4212
- let e = er(this.options.target);
4213
- this.responsiveLayout.mount(e), this.app = i(Ht, {
4228
+ let e = nr(this.options.target);
4229
+ this.responsiveLayout.mount(e), this.app = i(Wt, {
4214
4230
  canRetryEnd: !!this.options.loadPage,
4215
4231
  cardFooter: this.options.cardFooter,
4216
4232
  cardHeader: this.options.cardHeader,
4217
4233
  feedFooter: this.options.feedFooter,
4218
- feedFooterActions: Un(this),
4234
+ feedFooterActions: Gn(this),
4219
4235
  mediaCard: this.options.mediaCard,
4220
4236
  masonry: this.options.masonry,
4221
4237
  onMediaReady: this.options.onMediaReady,
@@ -4238,7 +4254,7 @@ var wr = class {
4238
4254
  onRetryForward: () => {
4239
4255
  this.retryReelForward();
4240
4256
  }
4241
- }), this.surface = this.app.mount(e), this.autoScroll.mount(), await Tn(this.options.restoreBacklog, (e) => this.appendPage(e), (e) => {
4257
+ }), this.surface = this.app.mount(e), this.autoScroll.mount(), await Dn(this.options.restoreBacklog, (e) => this.appendPage(e), (e) => {
4242
4258
  this.restoreController = e;
4243
4259
  }), !this.options.initialPage && this.state.items.length === 0 ? await this.reload() : this.options.autofill && this.state.autofill.status === "idle" && !this.fillController.isActive() && !this.state.loadMoreLocked && await this.startInitialAutofill();
4244
4260
  }
@@ -4246,7 +4262,7 @@ var wr = class {
4246
4262
  this.restoreController?.abort(), this.restoreController = null, this.autoScroll.destroy(), this.fillController.destroy(), this.cancelRequest(), this.reelForward.reset(), this.reelRemoval.reset(), this.exactMediaRemoval.reset(), this.itemRemoval.destroy(), this.removalReconciliation.reset(), this.responsiveLayout.destroy(), this.stopStateWatcher?.(), this.stopStateWatcher = null, this.app?.unmount(), this.app = null, this.surface = null;
4247
4263
  }
4248
4264
  getState() {
4249
- return L(this.state);
4265
+ return z(this.state);
4250
4266
  }
4251
4267
  removeMedia(e) {
4252
4268
  return this.exactMediaRemoval.remove(e);
@@ -4303,7 +4319,7 @@ var wr = class {
4303
4319
  this.autoScroll.setSpeed(e);
4304
4320
  }
4305
4321
  applyAutofillUpdate(e) {
4306
- let t = Cn(this.options.autofill, this.state, e);
4322
+ let t = Tn(this.options.autofill, this.state, e);
4307
4323
  return t && this.autofillController.syncCountdown(), t;
4308
4324
  }
4309
4325
  cancelAutofill() {
@@ -4314,7 +4330,7 @@ var wr = class {
4314
4330
  await this.cancelFill();
4315
4331
  return;
4316
4332
  }
4317
- if (un(this.state.autofill)) {
4333
+ if (fn(this.state.autofill)) {
4318
4334
  await this.cancelAutofill();
4319
4335
  return;
4320
4336
  }
@@ -4328,12 +4344,12 @@ var wr = class {
4328
4344
  }
4329
4345
  async fill(e) {
4330
4346
  if (!this.state.loadMoreLocked) {
4331
- if (this.pendingRequest || un(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
4347
+ if (this.pendingRequest || fn(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
4332
4348
  await this.fillController.start(e);
4333
4349
  }
4334
4350
  }
4335
4351
  restoreAutofillSession(e) {
4336
- let t = wn(this.options.autofill, this.state, e);
4352
+ let t = En(this.options.autofill, this.state, e);
4337
4353
  return t && this.autofillController.syncCountdown(), t;
4338
4354
  }
4339
4355
  restoreFillSession(e) {
@@ -4343,14 +4359,14 @@ var wr = class {
4343
4359
  return this.startLoadMore(() => this.loadNextSequence());
4344
4360
  }
4345
4361
  appendPage(e) {
4346
- Jt(e, this.state, this.removalReconciliation, (e) => this.setCurrentCursor(e));
4362
+ Xt(e, this.state, this.removalReconciliation, (e) => this.setCurrentCursor(e));
4347
4363
  }
4348
4364
  replenishAfterRemoval() {
4349
4365
  return this.startLoadMore(() => this.replenishAfterRemovalSequence());
4350
4366
  }
4351
4367
  async startLoadMore(e) {
4352
4368
  if (this.pendingRequest) return this.pendingRequest;
4353
- if (this.state.loadMoreLocked || un(this.state.autofill) || this.fillController.isActive() || !this.options.loadPage || this.state.next === null && !this.removalReconciliation.needsReconciliation(this.state.items)) return;
4369
+ if (this.state.loadMoreLocked || fn(this.state.autofill) || this.fillController.isActive() || !this.options.loadPage || this.state.next === null && !this.removalReconciliation.needsReconciliation(this.state.items)) return;
4354
4370
  this.state.isLoadingMore = !0, this.state.nextPageError = null;
4355
4371
  let t = e();
4356
4372
  return this.pendingRequest = t, t.finally(() => {
@@ -4365,12 +4381,12 @@ var wr = class {
4365
4381
  }
4366
4382
  async replaceFeed(e, t) {
4367
4383
  if (!this.options.loadPage) throw Error(`Vibe cannot ${t} without loadPage.`);
4368
- return un(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.state.autofill = ln(this.options.autofill, void 0, !1), this.fillController.reset(), this.reelForward.reset(), this.reelRemoval.reset(), this.exactMediaRemoval.reset(), this.itemRemoval.reset(), this.removalReconciliation.reset(), this.state.error = null, this.state.current = null, this.state.isLoading = !0, this.state.items = [], this.state.next = null, this.state.nextPageError = null, this.state.total = null, this.startRequest(e, !1);
4384
+ return fn(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.state.autofill = dn(this.options.autofill, void 0, !1), this.fillController.reset(), this.reelForward.reset(), this.reelRemoval.reset(), this.exactMediaRemoval.reset(), this.itemRemoval.reset(), this.removalReconciliation.reset(), this.state.error = null, this.state.current = null, this.state.isLoading = !0, this.state.items = [], this.state.next = null, this.state.nextPageError = null, this.state.total = null, this.startRequest(e, !1);
4369
4385
  }
4370
4386
  async loadFilteredPage(e) {
4371
4387
  let t = this.options.loadPage;
4372
4388
  if (!t) throw Error("Vibe cannot load a page without loadPage.");
4373
- let n = Ut(await t(e));
4389
+ let n = Gt(await t(e));
4374
4390
  return {
4375
4391
  ...n,
4376
4392
  items: this.removalReconciliation.filterItems(n.items)
@@ -4389,7 +4405,7 @@ var wr = class {
4389
4405
  let t = ++this.requestVersion, n = new AbortController();
4390
4406
  this.abortController = n;
4391
4407
  try {
4392
- let r = await Hn({
4408
+ let r = await Wn({
4393
4409
  controller: this.removalReconciliation,
4394
4410
  isCurrent: () => t === this.requestVersion,
4395
4411
  loadPage: e,
@@ -4407,7 +4423,7 @@ var wr = class {
4407
4423
  }
4408
4424
  async retryEnd() {
4409
4425
  if (this.pendingRequest) return this.pendingRequest;
4410
- if (!this.state.loadMoreLocked && !(un(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);
4426
+ if (!this.state.loadMoreLocked && !(fn(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);
4411
4427
  }
4412
4428
  setInfiniteScroll(e) {
4413
4429
  this.state.infiniteScroll = e, e && m(() => this.surface?.loadIfNearBottom());
@@ -4431,10 +4447,10 @@ var wr = class {
4431
4447
  this.state.total = e;
4432
4448
  }
4433
4449
  setReelAutoAdvance(e) {
4434
- qn(this.state.reelAutoAdvance, e);
4450
+ Yn(this.state.reelAutoAdvance, e);
4435
4451
  }
4436
4452
  setReelInfoSheet(e) {
4437
- Yn(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
4453
+ Zn(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
4438
4454
  }
4439
4455
  setLayout(e) {
4440
4456
  this.responsiveLayout.setLayout(e);
@@ -4454,7 +4470,7 @@ var wr = class {
4454
4470
  async fetchPage(e, t) {
4455
4471
  if (!this.options.loadPage) return;
4456
4472
  let n = ++this.requestVersion, r = new AbortController();
4457
- this.abortController = r, await tr({
4473
+ this.abortController = r, await rr({
4458
4474
  append: t,
4459
4475
  autofillController: this.autofillController,
4460
4476
  cursor: e,
@@ -4476,7 +4492,7 @@ var wr = class {
4476
4492
  startInitialAutofill() {
4477
4493
  let e = ++this.requestVersion, t = new AbortController(), n = this.autofillController.beginCycle();
4478
4494
  this.abortController = t, this.state.isLoadingMore = !0;
4479
- let r = En({
4495
+ let r = On({
4480
4496
  cycleId: n,
4481
4497
  isCurrent: () => e === this.requestVersion,
4482
4498
  onCollection: (t) => this.autofillController.captureCollection(t, e === this.requestVersion),
@@ -4494,7 +4510,7 @@ var wr = class {
4494
4510
  }
4495
4511
  startStateNotifications() {
4496
4512
  let e = this.options.onStateChange;
4497
- !e || this.stopStateWatcher || (e(L(this.state, this.notificationItems.value)), this.stopStateWatcher = O(this.state, () => e(L(this.state, this.notificationItems.value)), {
4513
+ !e || this.stopStateWatcher || (e(z(this.state, this.notificationItems.value)), this.stopStateWatcher = O(this.state, () => e(z(this.state, this.notificationItems.value)), {
4498
4514
  deep: !0,
4499
4515
  flush: "post"
4500
4516
  }));
@@ -4503,8 +4519,8 @@ var wr = class {
4503
4519
  this.lastLoadedCursor = e, this.state.current = e;
4504
4520
  }
4505
4521
  };
4506
- function Dr(e) {
4507
- return new Er(e);
4522
+ function kr(e) {
4523
+ return new Or(e);
4508
4524
  }
4509
4525
  //#endregion
4510
- export { Dr as createVibe };
4526
+ export { kr as createVibe };