@wyxos/vibe 5.8.0 → 5.8.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
@@ -71,10 +71,10 @@ var B = {
71
71
  key: 0,
72
72
  class: "load-more-status",
73
73
  role: "status"
74
- }, ee = ["disabled"], H = {
74
+ }, H = ["disabled"], U = {
75
75
  key: 2,
76
76
  class: "end-feed"
77
- }, U = ["disabled"], W = /* @__PURE__ */ d({
77
+ }, W = ["disabled"], ee = /* @__PURE__ */ d({
78
78
  __name: "GalleryFooter",
79
79
  props: {
80
80
  canRetryEnd: { type: Boolean },
@@ -97,7 +97,7 @@ var B = {
97
97
  type: "button",
98
98
  disabled: e.loadMoreLocked,
99
99
  onClick: i
100
- }, T(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9, ee)) : (b(), s("div", H, [n[1] ||= c("p", {
100
+ }, T(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9, H)) : (b(), s("div", U, [n[1] ||= c("p", {
101
101
  class: "end-feed-message",
102
102
  role: "status"
103
103
  }, " You've reached the end. ", -1), c("button", {
@@ -106,9 +106,9 @@ var B = {
106
106
  type: "button",
107
107
  disabled: e.loadMoreLocked,
108
108
  onClick: n[0] ||= (e) => t.$emit("retryEnd")
109
- }, " Check for more ", 8, U)]))])) : o("", !0);
109
+ }, " Check for more ", 8, W)]))])) : o("", !0);
110
110
  }
111
- }), G = /* @__PURE__ */ d({
111
+ }), te = /* @__PURE__ */ d({
112
112
  __name: "FeedFooter",
113
113
  props: {
114
114
  actions: {},
@@ -145,7 +145,7 @@ var B = {
145
145
  "can-retry-end",
146
146
  "show-load-more",
147
147
  "state"
148
- ])) : (b(), a(W, {
148
+ ])) : (b(), a(ee, {
149
149
  key: 1,
150
150
  "can-retry-end": e.canRetryEnd,
151
151
  "has-error": e.hasError,
@@ -164,7 +164,7 @@ var B = {
164
164
  "show-load-more"
165
165
  ]));
166
166
  }
167
- }), K = ["role"], q = { class: "gallery-status" }, te = /* @__PURE__ */ d({
167
+ }), G = ["role"], K = { class: "gallery-status" }, ne = /* @__PURE__ */ d({
168
168
  __name: "FeedStatus",
169
169
  props: {
170
170
  actions: {},
@@ -178,7 +178,7 @@ var B = {
178
178
  return (n, u) => (b(), s("main", {
179
179
  class: "gallery-shell",
180
180
  role: r.state.error ? "alert" : r.state.isLoading ? "status" : void 0
181
- }, [c("p", q, [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(G, {
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, {
182
182
  key: 0,
183
183
  actions: t.actions,
184
184
  "can-retry-end": t.canRetryEnd,
@@ -200,32 +200,32 @@ var B = {
200
200
  "is-loading",
201
201
  "load-more-locked",
202
202
  "state"
203
- ])) : o("", !0)], 8, K));
203
+ ])) : o("", !0)], 8, G));
204
204
  }
205
205
  });
206
- function J(e) {
206
+ function re(e) {
207
207
  return e.scrollHeight - e.scrollTop - e.clientHeight <= 240;
208
208
  }
209
209
  //#endregion
210
210
  //#region src/core/masonry.ts
211
- function Y(e) {
211
+ function q(e) {
212
212
  let t = e.preview.width ?? e.width, n = e.preview.height ?? e.height;
213
213
  return !t || !n || t <= 0 || n <= 0 ? 1 : n / t;
214
214
  }
215
- function ne(e) {
215
+ function ie(e) {
216
216
  return e.reduce((t, n, r) => n < e[t] ? r : t, 0);
217
217
  }
218
- function re(e) {
218
+ function ae(e) {
219
219
  return Math.max(0, e.containerHeight) + Math.max(0, e.gap);
220
220
  }
221
- function ie(e, t, n) {
221
+ function oe(e, t, n) {
222
222
  if (t <= 0 || e.length === 0) return {
223
223
  columns: 0,
224
224
  height: 0,
225
225
  items: []
226
226
  };
227
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) => {
228
- let t = ne(c), n = s * Y(e) + i, a = {
228
+ let t = ie(c), n = s * q(e) + i, a = {
229
229
  x: t * (s + r),
230
230
  y: c[t],
231
231
  width: s,
@@ -241,7 +241,7 @@ function ie(e, t, n) {
241
241
  }
242
242
  //#endregion
243
243
  //#region src/core/masonryViewportIndex.ts
244
- function ae(e, t) {
244
+ function se(e, t) {
245
245
  let n = /* @__PURE__ */ new Map();
246
246
  return e.forEach((e, r) => {
247
247
  let i = n.get(e.x) ?? [];
@@ -252,7 +252,7 @@ function ae(e, t) {
252
252
  }), n.set(e.x, i);
253
253
  }), { columns: [...n.entries()].sort(([e], [t]) => e - t).map(([, e]) => e.sort((e, t) => e.top - t.top || e.index - t.index)) };
254
254
  }
255
- function X(e, t) {
255
+ function J(e, t) {
256
256
  let n = 0, r = 0, i = e.length;
257
257
  for (; r < i;) {
258
258
  let a = Math.floor((r + i) / 2);
@@ -263,10 +263,10 @@ function X(e, t) {
263
263
  inspected: n
264
264
  };
265
265
  }
266
- function oe(e, t) {
266
+ function ce(e, t) {
267
267
  let n = Math.max(0, t.overscan), r = t.scrollTop - n, i = t.scrollTop + Math.max(0, t.viewportHeight) + n, a = [], o = 0;
268
268
  return e.columns.forEach((e) => {
269
- let t = X(e, r);
269
+ let t = J(e, r);
270
270
  o += t.inspected;
271
271
  for (let n = t.index; n < e.length; n += 1) {
272
272
  let t = e[n];
@@ -278,14 +278,14 @@ function oe(e, t) {
278
278
  inspected: o
279
279
  };
280
280
  }
281
- function se(e) {
281
+ function le(e) {
282
282
  return e?.minColumnWidth ?? 240;
283
283
  }
284
- function ce(e, t) {
284
+ function ue(e, t) {
285
285
  let n = e?.overscan?.minimumPx ?? 800, r = e?.overscan?.viewportMultiplier ?? 1.5, i = Math.max(n, t * r), a = e?.overscan?.maximumPx;
286
286
  return a === void 0 ? i : Math.min(i, a);
287
287
  }
288
- function le(e) {
288
+ function de(e) {
289
289
  if (e?.minColumnWidth !== void 0 && (!Number.isFinite(e.minColumnWidth) || e.minColumnWidth <= 0)) throw TypeError("Vibe masonry minColumnWidth must be a positive number.");
290
290
  let t = e?.overscan;
291
291
  if (t) {
@@ -299,10 +299,10 @@ function le(e) {
299
299
  }
300
300
  //#endregion
301
301
  //#region src/core/scrollbar.ts
302
- function Z(e, t, n) {
302
+ function Y(e, t, n) {
303
303
  return Math.min(n, Math.max(t, e));
304
304
  }
305
- function ue({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize: r, viewportSize: i }) {
305
+ function fe({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize: r, viewportSize: i }) {
306
306
  let a = Math.max(0, e), o = Math.max(0, r), s = Math.max(0, i), c = Math.max(0, a - s);
307
307
  if (!(c > 0 && o > 0)) return {
308
308
  maximumScrollPosition: c,
@@ -311,23 +311,23 @@ function ue({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize:
311
311
  thumbSize: o,
312
312
  thumbTravel: 0
313
313
  };
314
- let l = Z(s / a * o, Math.min(Math.max(0, t), o), o), u = Math.max(0, o - l);
314
+ let l = Y(s / a * o, Math.min(Math.max(0, t), o), o), u = Math.max(0, o - l);
315
315
  return {
316
316
  maximumScrollPosition: c,
317
317
  scrollable: !0,
318
- thumbOffset: u * (Z(n, 0, c) / c),
318
+ thumbOffset: u * (Y(n, 0, c) / c),
319
319
  thumbSize: l,
320
320
  thumbTravel: u
321
321
  };
322
322
  }
323
323
  //#endregion
324
324
  //#region src/components/GalleryScrollbar.vue?vue&type=script&setup=true&lang.ts
325
- var Q = ["aria-hidden"], de = [
325
+ var X = ["aria-hidden"], pe = [
326
326
  "aria-controls",
327
327
  "aria-valuemax",
328
328
  "aria-valuenow",
329
329
  "tabindex"
330
- ], fe = 32, pe = 40, me = 120, he = /* @__PURE__ */ d({
330
+ ], me = 32, he = 40, ge = 120, _e = /* @__PURE__ */ d({
331
331
  __name: "GalleryScrollbar",
332
332
  props: {
333
333
  contentSize: {},
@@ -349,16 +349,16 @@ var Q = ["aria-hidden"], de = [
349
349
  function k() {
350
350
  g !== null && clearTimeout(g), g = setTimeout(() => {
351
351
  g = null, o.value || (l.value = !1);
352
- }, me);
352
+ }, ge);
353
353
  }
354
354
  function A() {
355
355
  l.value = !0, k();
356
356
  }
357
357
  function j() {
358
358
  let e = t.scrollElement, r = i.value;
359
- return !e || !r ? n : ue({
359
+ return !e || !r ? n : fe({
360
360
  contentSize: e.scrollHeight,
361
- minimumThumbSize: fe,
361
+ minimumThumbSize: me,
362
362
  scrollPosition: e.scrollTop,
363
363
  trackSize: r.clientHeight,
364
364
  viewportSize: e.clientHeight
@@ -411,7 +411,7 @@ var Q = ["aria-hidden"], de = [
411
411
  }
412
412
  function z(e) {
413
413
  if (!E.value) return;
414
- let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r - pe : e.key === "ArrowDown" ? r + pe : 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 - he : e.key === "ArrowDown" ? r + he : e.key === "PageUp" ? r - n : e.key === "PageDown" ? r + n : e.key === "Home" ? 0 : e.key === "End" ? a.value.maximumScrollPosition : null;
415
415
  i !== null && (e.preventDefault(), A(), P(i));
416
416
  }
417
417
  function B(e) {
@@ -457,15 +457,15 @@ var Q = ["aria-hidden"], de = [
457
457
  onPointerdown: I,
458
458
  onPointermove: L,
459
459
  onPointerup: R
460
- }, null, 44, de)], 42, Q));
460
+ }, null, 44, pe)], 42, X));
461
461
  }
462
- }), ge = (e) => {
462
+ }), ve = (e) => {
463
463
  for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
464
464
  return !1;
465
- }, _e = (e) => e === "", ve = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), ye = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), be = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), xe = (e) => {
466
- let t = be(e);
465
+ }, ye = (e) => e === "", be = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), xe = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Se = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), Ce = (e) => {
466
+ let t = Se(e);
467
467
  return t.charAt(0).toUpperCase() + t.slice(1);
468
- }, Se = {
468
+ }, we = {
469
469
  xmlns: "http://www.w3.org/2000/svg",
470
470
  width: 24,
471
471
  height: 24,
@@ -475,27 +475,27 @@ var Q = ["aria-hidden"], de = [
475
475
  "stroke-width": 2,
476
476
  "stroke-linecap": "round",
477
477
  "stroke-linejoin": "round"
478
- }, Ce = ({ name: e, iconNode: t, absoluteStrokeWidth: n, "absolute-stroke-width": r, strokeWidth: i, "stroke-width": a, size: o = Se.width, color: s = Se.stroke, ...c }, { slots: l }) => p("svg", {
479
- ...Se,
478
+ }, Te = ({ name: e, iconNode: t, absoluteStrokeWidth: n, "absolute-stroke-width": r, strokeWidth: i, "stroke-width": a, size: o = we.width, color: s = we.stroke, ...c }, { slots: l }) => p("svg", {
479
+ ...we,
480
480
  ...c,
481
481
  width: o,
482
482
  height: o,
483
483
  stroke: s,
484
- "stroke-width": _e(n) || _e(r) || n === !0 || r === !0 ? Number(i || a || Se["stroke-width"]) * 24 / Number(o) : i || a || Se["stroke-width"],
485
- class: ve("lucide", c.class, ...e ? [`lucide-${ye(xe(e))}-icon`, `lucide-${ye(e)}`] : ["lucide-icon"]),
486
- ...!l.default && !ge(c) && { "aria-hidden": "true" }
487
- }, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]), we = (e, t) => (n, { slots: r, attrs: i }) => p(Ce, {
484
+ "stroke-width": ye(n) || ye(r) || n === !0 || r === !0 ? Number(i || a || we["stroke-width"]) * 24 / Number(o) : i || a || we["stroke-width"],
485
+ class: be("lucide", c.class, ...e ? [`lucide-${xe(Ce(e))}-icon`, `lucide-${xe(e)}`] : ["lucide-icon"]),
486
+ ...!l.default && !ve(c) && { "aria-hidden": "true" }
487
+ }, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]), Ee = (e, t) => (n, { slots: r, attrs: i }) => p(Te, {
488
488
  ...i,
489
489
  ...n,
490
490
  iconNode: t,
491
491
  name: e
492
- }, r), Te = we("chevron-left", [["path", {
492
+ }, r), De = Ee("chevron-left", [["path", {
493
493
  d: "m15 18-6-6 6-6",
494
494
  key: "1wnfg3"
495
- }]]), Ee = we("chevron-right", [["path", {
495
+ }]]), Oe = Ee("chevron-right", [["path", {
496
496
  d: "m9 18 6-6-6-6",
497
497
  key: "mthhwq"
498
- }]]), De = we("pause", [["rect", {
498
+ }]]), ke = Ee("pause", [["rect", {
499
499
  x: "14",
500
500
  y: "3",
501
501
  width: "5",
@@ -509,10 +509,10 @@ var Q = ["aria-hidden"], de = [
509
509
  height: "18",
510
510
  rx: "1",
511
511
  key: "1wsw3u"
512
- }]]), Oe = we("play", [["path", {
512
+ }]]), Ae = Ee("play", [["path", {
513
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",
514
514
  key: "10ikf1"
515
- }]]), ke = we("volume-2", [
515
+ }]]), je = Ee("volume-2", [
516
516
  ["path", {
517
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",
518
518
  key: "uqj9uw"
@@ -525,7 +525,7 @@ var Q = ["aria-hidden"], de = [
525
525
  d: "M19.364 18.364a9 9 0 0 0 0-12.728",
526
526
  key: "ijwkga"
527
527
  }]
528
- ]), Ae = we("volume-x", [
528
+ ]), Me = Ee("volume-x", [
529
529
  ["path", {
530
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",
531
531
  key: "uqj9uw"
@@ -544,22 +544,22 @@ var Q = ["aria-hidden"], de = [
544
544
  y2: "15",
545
545
  key: "5ykzw1"
546
546
  }]
547
- ]), je = {
547
+ ]), Ne = {
548
548
  401: "Authentication required",
549
549
  403: "Access forbidden",
550
550
  404: "Preview not found",
551
551
  419: "Session expired",
552
552
  500: "Server error"
553
553
  };
554
- function Me(e) {
554
+ function Pe(e) {
555
555
  return e.match(/\/demo-errors\/(401|403|404|419|500)\//)?.[1] ?? "Error";
556
556
  }
557
- function Ne(e) {
558
- return je[Me(e)] ?? "Preview unavailable";
557
+ function Fe(e) {
558
+ return Ne[Pe(e)] ?? "Preview unavailable";
559
559
  }
560
560
  //#endregion
561
561
  //#region src/components/CardRegion.vue
562
- var Pe = /* @__PURE__ */ d({
562
+ var Ie = /* @__PURE__ */ d({
563
563
  __name: "CardRegion",
564
564
  props: {
565
565
  index: {},
@@ -606,7 +606,7 @@ var Pe = /* @__PURE__ */ d({
606
606
  "total"
607
607
  ]))], 38));
608
608
  }
609
- }), Fe = ["aria-busy", "aria-label"], Ie = { class: "media-error-code" }, Le = ["disabled"], Re = /* @__PURE__ */ d({
609
+ }), Le = ["aria-busy", "aria-label"], Re = { class: "media-error-code" }, ze = ["disabled"], Be = /* @__PURE__ */ d({
610
610
  __name: "MediaError",
611
611
  props: {
612
612
  component: {},
@@ -641,7 +641,7 @@ var Pe = /* @__PURE__ */ d({
641
641
  "retrying",
642
642
  "status"
643
643
  ]))], 32)) : (b(), s(e, { key: 1 }, [
644
- c("strong", Ie, T(t.status), 1),
644
+ c("strong", Re, T(t.status), 1),
645
645
  c("span", null, T(t.label), 1),
646
646
  c("button", {
647
647
  "data-test": "media-retry",
@@ -650,21 +650,21 @@ var Pe = /* @__PURE__ */ d({
650
650
  disabled: t.retrying,
651
651
  onClick: j(o, ["stop"]),
652
652
  onKeydown: r[2] ||= j(() => {}, ["stop"])
653
- }, T(t.retrying ? "Retrying…" : "Retry"), 41, Le)
654
- ], 64))], 8, Fe));
653
+ }, T(t.retrying ? "Retrying…" : "Retry"), 41, ze)
654
+ ], 64))], 8, Le));
655
655
  }
656
- }), ze = [
656
+ }), Ve = [
657
657
  "max",
658
658
  "value",
659
659
  "aria-valuetext",
660
660
  "disabled"
661
- ], Be = {
661
+ ], He = {
662
662
  key: 0,
663
663
  class: "media-controls-row"
664
- }, Ve = ["aria-label", "title"], He = { class: "media-controls-audio" }, Ue = ["aria-label", "title"], We = ["value", "aria-valuetext"], Ge = {
664
+ }, Ue = ["aria-label", "title"], We = { class: "media-controls-audio" }, Ge = ["aria-label", "title"], Ke = ["value", "aria-valuetext"], qe = {
665
665
  class: "media-control-time",
666
666
  "aria-live": "off"
667
- }, Ke = /* @__PURE__ */ d({
667
+ }, Je = /* @__PURE__ */ d({
668
668
  __name: "MediaControls",
669
669
  props: {
670
670
  currentTime: {},
@@ -712,35 +712,35 @@ var Pe = /* @__PURE__ */ d({
712
712
  "aria-valuetext": `${u(p.value)} of ${u(f.value)}`,
713
713
  disabled: f.value <= 0,
714
714
  onInput: n[0] ||= (e) => i("seek", d(e))
715
- }, null, 44, ze), e.layout === "reel" ? (b(), s("div", Be, [
715
+ }, null, 44, Ve), e.layout === "reel" ? (b(), s("div", He, [
716
716
  c("button", {
717
717
  type: "button",
718
718
  class: "media-control-button media-control-playback",
719
719
  "aria-label": e.playing ? "Pause video" : "Play video",
720
720
  title: e.playing ? "Pause" : "Play",
721
721
  onClick: n[1] ||= (e) => i("togglePlayback")
722
- }, [e.playing ? (b(), a(E(De), {
722
+ }, [e.playing ? (b(), a(E(ke), {
723
723
  key: 0,
724
724
  size: 18,
725
725
  fill: "currentColor"
726
- })) : (b(), a(E(Oe), {
726
+ })) : (b(), a(E(Ae), {
727
727
  key: 1,
728
728
  size: 18,
729
729
  fill: "currentColor"
730
- }))], 8, Ve),
731
- c("div", He, [c("button", {
730
+ }))], 8, Ue),
731
+ c("div", We, [c("button", {
732
732
  type: "button",
733
733
  class: "media-control-button",
734
734
  "aria-label": e.muted ? "Unmute video" : "Mute video",
735
735
  title: e.muted ? "Unmute" : "Mute",
736
736
  onClick: n[2] ||= (e) => i("toggleMute")
737
- }, [e.muted || e.volume === 0 ? (b(), a(E(Ae), {
737
+ }, [e.muted || e.volume === 0 ? (b(), a(E(Me), {
738
738
  key: 0,
739
739
  size: 18
740
- })) : (b(), a(E(ke), {
740
+ })) : (b(), a(E(je), {
741
741
  key: 1,
742
742
  size: 18
743
- }))], 8, Ue), c("input", {
743
+ }))], 8, Ge), c("input", {
744
744
  class: "media-control-range media-control-volume",
745
745
  type: "range",
746
746
  min: "0",
@@ -751,34 +751,34 @@ var Pe = /* @__PURE__ */ d({
751
751
  "aria-label": "Video volume",
752
752
  "aria-valuetext": `${Math.round(e.volume * 100)} percent`,
753
753
  onInput: n[3] ||= (e) => i("volumeChange", d(e))
754
- }, null, 44, We)]),
755
- c("output", Ge, T(u(p.value)) + " / " + T(u(f.value)), 1)
754
+ }, null, 44, Ke)]),
755
+ c("output", qe, T(u(p.value)) + " / " + T(u(f.value)), 1)
756
756
  ])) : o("", !0)], 34));
757
757
  }
758
- }), qe = {
758
+ }), Ye = {
759
759
  lastAudibleVolume: 1,
760
760
  muted: !1,
761
761
  volume: 1
762
762
  };
763
- function Je(e, t) {
763
+ function Xe(e, t) {
764
764
  return typeof e == "number" && Number.isFinite(e) ? Math.min(1, Math.max(0, e)) : t;
765
765
  }
766
- function Ye(e, t = qe) {
767
- let n = Je(e?.volume, t.volume), r = Je(e?.lastAudibleVolume, n > 0 ? n : t.lastAudibleVolume);
766
+ function Ze(e, t = Ye) {
767
+ let n = Xe(e?.volume, t.volume), r = Xe(e?.lastAudibleVolume, n > 0 ? n : t.lastAudibleVolume);
768
768
  return {
769
- lastAudibleVolume: r > 0 ? r : qe.lastAudibleVolume,
769
+ lastAudibleVolume: r > 0 ? r : Ye.lastAudibleVolume,
770
770
  muted: typeof e?.muted == "boolean" ? e.muted : n === 0 || t.muted,
771
771
  volume: n
772
772
  };
773
773
  }
774
774
  //#endregion
775
775
  //#region src/components/useMediaCardAudio.ts
776
- function Xe(e) {
777
- let t = Ye(e.reelAudioState()), n = e.layout() === "reel" && e.reelAudioState(), r = w(n ? t.muted : e.mediaCard()?.videoMuted ?? e.layout() === "masonry"), i = w(n ? t.volume : 1), a = n ? t.lastAudibleVolume : 1;
776
+ function Qe(e) {
777
+ let t = Ze(e.reelAudioState()), n = e.layout() === "reel" && e.reelAudioState(), r = w(n ? t.muted : e.mediaCard()?.videoMuted ?? e.layout() === "masonry"), i = w(n ? t.volume : 1), a = n ? t.lastAudibleVolume : 1;
778
778
  function o() {
779
779
  let t = e.videoElement.value, n = e.reelAudioState();
780
780
  if (!t || e.layout() !== "reel" || !n) return;
781
- let o = Ye(n);
781
+ let o = Ze(n);
782
782
  a = o.lastAudibleVolume, i.value = o.volume, r.value = o.muted, t.volume = o.volume, t.muted = e.active() === !1 ? !0 : o.muted;
783
783
  }
784
784
  function s(e, t) {
@@ -786,7 +786,7 @@ function Xe(e) {
786
786
  }
787
787
  function c(t) {
788
788
  if (e.layout() !== "reel") return;
789
- let n = Ye({
789
+ let n = Ze({
790
790
  lastAudibleVolume: a,
791
791
  muted: t.muted,
792
792
  volume: t.volume
@@ -820,8 +820,53 @@ function Xe(e) {
820
820
  };
821
821
  }
822
822
  //#endregion
823
+ //#region src/core/mediaType.ts
824
+ var $e = /\.(aac|flac|m4a|mp3|mp4|mov|ogg|opus|wav|webm)$/i;
825
+ function et(e) {
826
+ try {
827
+ return $e.test(new URL(e).pathname);
828
+ } catch {
829
+ return $e.test(e.split("?")[0] ?? e);
830
+ }
831
+ }
832
+ function tt(e, t) {
833
+ return e === void 0 ? et(t) : e === "video";
834
+ }
835
+ //#endregion
836
+ //#region src/core/feedReplacementPreload.ts
837
+ function nt(e, t, n) {
838
+ let r = P(e);
839
+ if (r.length < 2) return null;
840
+ let i = F(e, t), a = r[i < r.length - 1 ? i + 1 : i - 1];
841
+ return a ? N(a, n) : null;
842
+ }
843
+ function rt(e) {
844
+ if (tt(e.type, e.src)) {
845
+ let t = document.createElement("video");
846
+ return t.muted = !0, t.playsInline = !0, t.preload = "auto", t.src = e.src, t.load(), () => {
847
+ t.pause(), t.removeAttribute("src"), t.load();
848
+ };
849
+ }
850
+ let t = document.createElement("img");
851
+ return t.decoding = "async", t.fetchPriority = "low", t.src = e.src, t.decode?.().catch(() => void 0), () => {
852
+ t.onload = null, t.onerror = null;
853
+ };
854
+ }
855
+ //#endregion
856
+ //#region src/components/useFeedReplacementPreload.ts
857
+ function it(e) {
858
+ let t = r(() => e.layout() === "masonry" && e.mediaCard()?.feedPreload === "replacement"), n = r(() => !t.value || !e.mediaReady() ? null : nt(e.item(), e.mediaIndex(), e.mediaSource())), i = null;
859
+ O([
860
+ t,
861
+ () => e.mediaReady(),
862
+ () => n.value && `${n.value.type ?? ""}:${n.value.src}`
863
+ ], ([e, t]) => {
864
+ e && !t || (i?.(), i = e && n.value ? rt(n.value) : null);
865
+ }, { immediate: !0 }), v(() => i?.());
866
+ }
867
+ //#endregion
823
868
  //#region src/components/useReelVideoActivity.ts
824
- function Ze(e) {
869
+ function at(e) {
825
870
  let t = r(() => e.layout() !== "reel" || e.active() === !0), n = r(() => t.value ? e.videoIsMuted.value : !0);
826
871
  function i() {
827
872
  if (!t.value) {
@@ -854,22 +899,9 @@ function Ze(e) {
854
899
  };
855
900
  }
856
901
  //#endregion
857
- //#region src/core/mediaType.ts
858
- var Qe = /\.(aac|flac|m4a|mp3|mp4|mov|ogg|opus|wav|webm)$/i;
859
- function $e(e) {
860
- try {
861
- return Qe.test(new URL(e).pathname);
862
- } catch {
863
- return Qe.test(e.split("?")[0] ?? e);
864
- }
865
- }
866
- function et(e, t) {
867
- return e === void 0 ? $e(t) : e === "video";
868
- }
869
- //#endregion
870
902
  //#region src/components/useMediaLoading.ts
871
- function tt(e) {
872
- let t = r(() => et(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");
903
+ function ot(e) {
904
+ let t = r(() => tt(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");
873
905
  return O(i, (t, n) => {
874
906
  n !== "none" || t === "none" || m(() => e.videoElement.value?.load());
875
907
  }), {
@@ -880,7 +912,7 @@ function tt(e) {
880
912
  }
881
913
  //#endregion
882
914
  //#region src/components/useMediaReadiness.ts
883
- function nt(e) {
915
+ function st(e) {
884
916
  let t = w(null), n = w(null), i = w(0), a = w(0), o = w(!0), s = w(!1), c = w(!1), l = null, u = !1, d = r(() => c.value || s.value ? "error" : o.value ? "loading" : e.previewState());
885
917
  function f() {
886
918
  l !== null && clearTimeout(l), l = null;
@@ -938,7 +970,7 @@ function nt(e) {
938
970
  }
939
971
  //#endregion
940
972
  //#region src/components/MediaCard.vue?vue&type=script&setup=true&lang.ts
941
- var rt = [
973
+ var ct = [
942
974
  "data-post-id",
943
975
  "data-media-index",
944
976
  "aria-hidden",
@@ -946,12 +978,12 @@ var rt = [
946
978
  "inert",
947
979
  "role",
948
980
  "tabindex"
949
- ], it = { class: "media-card-content" }, at = ["data-media-direction"], ot = ["data-media-index"], st = {
981
+ ], lt = { class: "media-card-content" }, ut = ["data-media-direction"], dt = ["data-media-index"], ft = {
950
982
  key: 0,
951
983
  "data-test": "media-loading",
952
984
  class: "media-loading",
953
985
  "aria-hidden": "true"
954
- }, ct = [
986
+ }, pt = [
955
987
  "data-source-generation",
956
988
  "src",
957
989
  "width",
@@ -960,14 +992,14 @@ var rt = [
960
992
  "loop",
961
993
  "muted",
962
994
  "preload"
963
- ], lt = [
995
+ ], mt = [
964
996
  "data-source-generation",
965
997
  "src",
966
998
  "width",
967
999
  "height",
968
1000
  "fetchpriority",
969
1001
  "loading"
970
- ], ut = ["aria-label"], dt = ["aria-label"], ft = ["aria-label"], pt = 40, mt = 160, ht = 24, gt = /* @__PURE__ */ d({
1002
+ ], ht = ["aria-label"], gt = ["aria-label"], _t = ["aria-label"], vt = 40, yt = 160, bt = 24, xt = /* @__PURE__ */ d({
971
1003
  __name: "MediaCard",
972
1004
  props: {
973
1005
  active: { type: Boolean },
@@ -1005,102 +1037,111 @@ var rt = [
1005
1037
  function S(e = !1, t = "pointer") {
1006
1038
  e && x("activate", t);
1007
1039
  }
1008
- let C = r(() => P(l.item)), T = r(() => F(l.item, l.mediaIndex)), D = r(() => I(l.item, T.value)), O = r(() => N(D.value, l.mediaSource ?? "preview")), M = r(() => O.value.src), L = r(() => O.value.type), R = r(() => O.value.width), z = r(() => O.value.height), { effectivePreviewState: B, failSourceAttempt: V, imageElement: ee, markSourceReady: H, noteSourceActivity: U, retrySource: W, retrying: G, sourceGeneration: K, videoElement: q } = nt({
1040
+ let C = r(() => P(l.item)), T = r(() => F(l.item, l.mediaIndex)), D = r(() => I(l.item, T.value)), O = r(() => N(D.value, l.mediaSource ?? "preview")), M = r(() => O.value.src), L = r(() => O.value.type), R = r(() => O.value.width), z = r(() => O.value.height), { effectivePreviewState: B, failSourceAttempt: V, imageElement: H, markSourceReady: U, noteSourceActivity: W, retrySource: ee, retrying: te, sourceGeneration: G, videoElement: K } = st({
1009
1041
  identity: () => `${l.item.postId}:${T.value}:${l.mediaSource ?? "preview"}:${M.value}:${L.value ?? ""}`,
1010
1042
  mediaIndex: () => T.value,
1011
1043
  onError: (e) => x("error", e),
1012
1044
  onReady: (e) => x("ready", e),
1013
1045
  previewState: () => l.previewState
1014
- }), te = w(0), J = w(0), Y = w(!1), { apply: ne, setVolume: re, sync: ie, toggleMute: ae, videoIsMuted: X, videoVolume: oe } = Xe({
1046
+ });
1047
+ it({
1048
+ item: () => l.item,
1049
+ layout: () => l.layout,
1050
+ mediaCard: () => l.mediaCard,
1051
+ mediaIndex: () => T.value,
1052
+ mediaReady: () => B.value === "ready",
1053
+ mediaSource: () => l.mediaSource ?? "preview"
1054
+ });
1055
+ let ne = w(0), re = w(0), q = w(!1), { apply: ie, setVolume: ae, sync: oe, toggleMute: se, videoIsMuted: J, videoVolume: ce } = Qe({
1015
1056
  active: () => l.active,
1016
1057
  layout: () => l.layout,
1017
1058
  mediaCard: () => l.mediaCard,
1018
1059
  onChange: (e) => x("reelAudioChange", e),
1019
1060
  reelAudioState: () => l.reelAudioState,
1020
- videoElement: q
1021
- }), { effectiveMuted: se, onPlaying: ce, playbackAllowed: le } = Ze({
1061
+ videoElement: K
1062
+ }), { effectiveMuted: le, onPlaying: ue, playbackAllowed: de } = at({
1022
1063
  active: () => l.active,
1023
1064
  layout: () => l.layout,
1024
- videoElement: q,
1025
- videoIsMuted: X,
1026
- videoIsPlaying: Y
1027
- }), Z = r(() => l.interactive && !!(l.cardHeader || l.cardFooter));
1028
- function ue(e) {
1065
+ videoElement: K,
1066
+ videoIsMuted: J,
1067
+ videoIsPlaying: q
1068
+ }), Y = r(() => l.interactive && !!(l.cardHeader || l.cardFooter));
1069
+ function fe(e) {
1029
1070
  return e.detail === 0 ? "keyboard" : "pointer";
1030
1071
  }
1031
- function Q(e, t) {
1072
+ function X(e, t) {
1032
1073
  let n = C.value.length, r = (e + n) % n;
1033
1074
  r !== T.value && (y.value = e < T.value ? "previous" : "next", x("mediaChange", r), t && t.detail > 0 && t.currentTarget?.blur());
1034
1075
  }
1035
- function de(e, t, n) {
1076
+ function pe(e, t, n) {
1036
1077
  return t === 1 ? e * 16 : t === 2 ? e * n : e;
1037
1078
  }
1038
- function fe() {
1079
+ function me() {
1039
1080
  f = 0, p = !1, d !== null && clearTimeout(d), d = null;
1040
1081
  }
1041
- function pe() {
1042
- d !== null && clearTimeout(d), d = setTimeout(fe, mt);
1082
+ function he() {
1083
+ d !== null && clearTimeout(d), d = setTimeout(me, yt);
1043
1084
  }
1044
- function me(e) {
1085
+ function ge(e) {
1045
1086
  if (C.value.length <= 1) return;
1046
- let t = e.currentTarget?.clientWidth || 1, n = de(e.deltaX, e.deltaMode, t);
1047
- if (n === 0 || (e.preventDefault(), pe(), p) || (f += n, Math.abs(f) < ht)) return;
1087
+ let t = e.currentTarget?.clientWidth || 1, n = pe(e.deltaX, e.deltaMode, t);
1088
+ if (n === 0 || (e.preventDefault(), he(), p) || (f += n, Math.abs(f) < bt)) return;
1048
1089
  let r = Math.sign(f);
1049
- f = 0, p = !0, Q(T.value + r);
1090
+ f = 0, p = !0, X(T.value + r);
1050
1091
  }
1051
- function he(e) {
1092
+ function _e(e) {
1052
1093
  let t = e.touches[0];
1053
1094
  l.layout !== "reel" || !t || (m = t.clientX, g = t.clientY);
1054
1095
  }
1055
- function ge(e) {
1096
+ function ve(e) {
1056
1097
  let t = e.changedTouches[0];
1057
1098
  if (m === null || g === null || !t) return;
1058
1099
  let n = m - t.clientX, r = g - t.clientY;
1059
- m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) < pt || Q(T.value + Math.sign(n)));
1100
+ m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) < vt || X(T.value + Math.sign(n)));
1060
1101
  }
1061
- let { imageLoading: _e, mediaIsTimed: ve, videoPreload: ye } = tt({
1102
+ let { imageLoading: ye, mediaIsTimed: be, videoPreload: xe } = ot({
1062
1103
  active: () => l.active,
1063
1104
  fetchPriority: () => l.fetchPriority,
1064
1105
  layout: () => l.layout,
1065
1106
  mediaSource: () => M.value,
1066
1107
  mediaType: () => L.value,
1067
- videoElement: q
1068
- }), be = r(() => l.layout === "reel" && l.stationaryReelControls === !0), xe = r(() => ve.value && B.value === "ready" && (!be.value || !!(l.active && l.reelControlsTarget))), Se = r(() => `${l.item.postId}:${T.value}:${M.value}`);
1069
- function Ce(e) {
1070
- l.layout === "reel" && (e.stopPropagation(), we());
1108
+ videoElement: K
1109
+ }), Se = r(() => l.layout === "reel" && l.stationaryReelControls === !0), Ce = r(() => be.value && B.value === "ready" && (!Se.value || !!(l.active && l.reelControlsTarget))), we = r(() => `${l.item.postId}:${T.value}:${M.value}`);
1110
+ function Te(e) {
1111
+ l.layout === "reel" && (e.stopPropagation(), Ee());
1071
1112
  }
1072
- async function we() {
1073
- if (!(!q.value || !le.value)) {
1074
- if (Y.value) {
1075
- q.value.pause();
1113
+ async function Ee() {
1114
+ if (!(!K.value || !de.value)) {
1115
+ if (q.value) {
1116
+ K.value.pause();
1076
1117
  return;
1077
1118
  }
1078
1119
  try {
1079
- await q.value.play();
1120
+ await K.value.play();
1080
1121
  } catch {
1081
- Y.value = !1;
1122
+ q.value = !1;
1082
1123
  }
1083
1124
  }
1084
1125
  }
1085
- function De(e) {
1126
+ function ke(e) {
1086
1127
  return Number.isFinite(e) ? Math.max(0, e) : 0;
1087
1128
  }
1088
- function Oe(e) {
1089
- let t = e?.currentTarget ?? q.value;
1090
- t && (te.value = De(t.currentTime), J.value = De(t.duration), ie(t, le.value));
1129
+ function Ae(e) {
1130
+ let t = e?.currentTarget ?? K.value;
1131
+ t && (ne.value = ke(t.currentTime), re.value = ke(t.duration), oe(t, de.value));
1091
1132
  }
1092
- function ke(e) {
1093
- ne(), Oe(e), H(e);
1133
+ function je(e) {
1134
+ ie(), Ae(e), U(e);
1094
1135
  }
1095
- function Ae() {
1096
- Y.value = !1, x("ended", T.value);
1136
+ function Me() {
1137
+ q.value = !1, x("ended", T.value);
1097
1138
  }
1098
- function je(e) {
1099
- let t = q.value;
1100
- !t || !Number.isFinite(e) || (t.currentTime = Math.min(De(t.duration), Math.max(0, e)), te.value = t.currentTime);
1139
+ function Ne(e) {
1140
+ let t = K.value;
1141
+ !t || !Number.isFinite(e) || (t.currentTime = Math.min(ke(t.duration), Math.max(0, e)), ne.value = t.currentTime);
1101
1142
  }
1102
1143
  return v(() => {
1103
- fe();
1144
+ me();
1104
1145
  }), (r, i) => (b(), s("article", {
1105
1146
  "data-post-id": e.item.postId,
1106
1147
  "data-media-index": T.value,
@@ -1112,14 +1153,14 @@ var rt = [
1112
1153
  }]),
1113
1154
  style: _(e.itemStyle),
1114
1155
  "aria-hidden": e.leaving || void 0,
1115
- "aria-busy": E(B) === "loading" || E(G),
1156
+ "aria-busy": E(B) === "loading" || E(te),
1116
1157
  inert: e.leaving || void 0,
1117
- role: e.interactive && !e.leaving && !Z.value ? "button" : void 0,
1118
- tabindex: e.interactive && !e.leaving && !Z.value ? 0 : void 0,
1119
- onClick: i[14] ||= (t) => S(e.interactive && !Z.value, ue(t)),
1120
- onKeydown: [i[15] ||= A((t) => S(e.interactive && !Z.value, "keyboard"), ["enter"]), i[16] ||= A(j((t) => S(e.interactive && !Z.value, "keyboard"), ["prevent"]), ["space"])]
1121
- }, [c("div", it, [
1122
- e.cardHeader ? (b(), a(Pe, {
1158
+ role: e.interactive && !e.leaving && !Y.value ? "button" : void 0,
1159
+ tabindex: e.interactive && !e.leaving && !Y.value ? 0 : void 0,
1160
+ onClick: i[14] ||= (t) => S(e.interactive && !Y.value, fe(t)),
1161
+ onKeydown: [i[15] ||= A((t) => S(e.interactive && !Y.value, "keyboard"), ["enter"]), i[16] ||= A(j((t) => S(e.interactive && !Y.value, "keyboard"), ["prevent"]), ["space"])]
1162
+ }, [c("div", lt, [
1163
+ e.cardHeader ? (b(), a(Ie, {
1123
1164
  key: 0,
1124
1165
  index: e.index,
1125
1166
  item: e.item,
@@ -1145,36 +1186,36 @@ var rt = [
1145
1186
  c("div", {
1146
1187
  class: h(["media-card-media", { "media-card-media--carousel": e.layout === "reel" && C.value.length > 1 }]),
1147
1188
  "data-media-direction": y.value,
1148
- onWheel: me,
1149
- onTouchstartPassive: he,
1150
- onTouchendPassive: ge
1189
+ onWheel: ge,
1190
+ onTouchstartPassive: _e,
1191
+ onTouchendPassive: ve
1151
1192
  }, [
1152
1193
  u(n, {
1153
- css: !E(G),
1194
+ css: !E(te),
1154
1195
  name: `media-slide-${y.value}`
1155
1196
  }, {
1156
1197
  default: k(() => [(b(), s("div", {
1157
- key: `${e.item.postId}:${D.value.src}:${e.mediaSource ?? "preview"}:${E(K)}`,
1198
+ key: `${e.item.postId}:${D.value.src}:${e.mediaSource ?? "preview"}:${E(G)}`,
1158
1199
  class: "media-card-frame",
1159
1200
  "data-media-index": T.value
1160
- }, [E(B) === "loading" ? (b(), s("div", st, [...i[17] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : E(B) === "error" ? (b(), a(Re, {
1201
+ }, [E(B) === "loading" ? (b(), s("div", ft, [...i[17] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : E(B) === "error" ? (b(), a(Be, {
1161
1202
  key: 1,
1162
1203
  component: e.mediaCard?.error?.component,
1163
- label: E(Ne)(M.value),
1164
- retrying: E(G),
1165
- status: E(Me)(M.value),
1166
- onRetry: E(W)
1204
+ label: E(Fe)(M.value),
1205
+ retrying: E(te),
1206
+ status: E(Pe)(M.value),
1207
+ onRetry: E(ee)
1167
1208
  }, null, 8, [
1168
1209
  "component",
1169
1210
  "label",
1170
1211
  "retrying",
1171
1212
  "status",
1172
1213
  "onRetry"
1173
- ])) : o("", !0), E(ve) ? (b(), s("video", {
1214
+ ])) : o("", !0), E(be) ? (b(), s("video", {
1174
1215
  key: 2,
1175
1216
  ref_key: "videoElement",
1176
- ref: q,
1177
- "data-source-generation": E(K),
1217
+ ref: K,
1218
+ "data-source-generation": E(G),
1178
1219
  class: h(["media-preview", {
1179
1220
  "media-preview--ready": E(B) === "ready",
1180
1221
  "media-preview--reel-video": e.layout === "reel"
@@ -1182,28 +1223,28 @@ var rt = [
1182
1223
  src: M.value,
1183
1224
  width: R.value ?? void 0,
1184
1225
  height: z.value ?? void 0,
1185
- autoplay: E(le),
1226
+ autoplay: E(de),
1186
1227
  loop: !e.advanceOnMediaEnd,
1187
- muted: E(se),
1228
+ muted: E(le),
1188
1229
  playsinline: "",
1189
- preload: E(ye),
1190
- onLoadedmetadata: ke,
1191
- onProgress: i[0] ||= (...e) => E(U) && E(U)(...e),
1192
- onLoadeddata: i[1] ||= (...e) => E(U) && E(U)(...e),
1193
- onCanplay: i[2] ||= (...e) => E(U) && E(U)(...e),
1194
- onDurationchange: Oe,
1195
- onTimeupdate: Oe,
1196
- onVolumechange: Oe,
1197
- onPlaying: i[3] ||= (...e) => E(ce) && E(ce)(...e),
1198
- onPause: i[4] ||= (e) => Y.value = !1,
1199
- onEnded: Ae,
1200
- onClick: Ce,
1230
+ preload: E(xe),
1231
+ onLoadedmetadata: je,
1232
+ onProgress: i[0] ||= (...e) => E(W) && E(W)(...e),
1233
+ onLoadeddata: i[1] ||= (...e) => E(W) && E(W)(...e),
1234
+ onCanplay: i[2] ||= (...e) => E(W) && E(W)(...e),
1235
+ onDurationchange: Ae,
1236
+ onTimeupdate: Ae,
1237
+ onVolumechange: Ae,
1238
+ onPlaying: i[3] ||= (...e) => E(ue) && E(ue)(...e),
1239
+ onPause: i[4] ||= (e) => q.value = !1,
1240
+ onEnded: Me,
1241
+ onClick: Te,
1201
1242
  onError: i[5] ||= (...e) => E(V) && E(V)(...e)
1202
- }, null, 42, ct)) : (b(), s("img", {
1243
+ }, null, 42, pt)) : (b(), s("img", {
1203
1244
  key: 3,
1204
1245
  ref_key: "imageElement",
1205
- ref: ee,
1206
- "data-source-generation": E(K),
1246
+ ref: H,
1247
+ "data-source-generation": E(G),
1207
1248
  class: h(["media-preview", { "media-preview--ready": E(B) === "ready" }]),
1208
1249
  src: M.value,
1209
1250
  width: R.value ?? void 0,
@@ -1211,32 +1252,32 @@ var rt = [
1211
1252
  fetchpriority: e.fetchPriority,
1212
1253
  alt: "",
1213
1254
  decoding: "async",
1214
- loading: E(_e),
1215
- onLoad: i[6] ||= (...e) => E(H) && E(H)(...e),
1255
+ loading: E(ye),
1256
+ onLoad: i[6] ||= (...e) => E(U) && E(U)(...e),
1216
1257
  onError: i[7] ||= (...e) => E(V) && E(V)(...e)
1217
- }, null, 42, lt))], 8, ot))]),
1258
+ }, null, 42, mt))], 8, dt))]),
1218
1259
  _: 1
1219
1260
  }, 8, ["css", "name"]),
1220
1261
  (b(), a(t, {
1221
- disabled: !be.value || !e.reelControlsTarget,
1262
+ disabled: !Se.value || !e.reelControlsTarget,
1222
1263
  to: e.reelControlsTarget ?? "body"
1223
1264
  }, [u(n, {
1224
1265
  name: "vibe-reel-media-controls",
1225
- css: be.value
1266
+ css: Se.value
1226
1267
  }, {
1227
- default: k(() => [xe.value ? (b(), a(Ke, {
1228
- key: Se.value,
1229
- "current-time": te.value,
1230
- "data-control-post-id": be.value ? e.item.postId : void 0,
1231
- duration: J.value,
1268
+ default: k(() => [Ce.value ? (b(), a(Je, {
1269
+ key: we.value,
1270
+ "current-time": ne.value,
1271
+ "data-control-post-id": Se.value ? e.item.postId : void 0,
1272
+ duration: re.value,
1232
1273
  layout: e.layout,
1233
- muted: E(X),
1234
- playing: Y.value,
1235
- volume: E(oe),
1236
- onSeek: je,
1237
- onToggleMute: E(ae),
1238
- onTogglePlayback: we,
1239
- onVolumeChange: E(re)
1274
+ muted: E(J),
1275
+ playing: q.value,
1276
+ volume: E(ce),
1277
+ onSeek: Ne,
1278
+ onToggleMute: E(se),
1279
+ onTogglePlayback: Ee,
1280
+ onVolumeChange: E(ae)
1240
1281
  }, null, 8, [
1241
1282
  "current-time",
1242
1283
  "data-control-post-id",
@@ -1258,25 +1299,25 @@ var rt = [
1258
1299
  type: "button",
1259
1300
  class: "media-carousel-control media-carousel-control--previous",
1260
1301
  "aria-label": `Previous media for post ${e.item.postId}`,
1261
- onClick: i[8] ||= j((e) => Q(T.value - 1, e), ["stop"]),
1302
+ onClick: i[8] ||= j((e) => X(T.value - 1, e), ["stop"]),
1262
1303
  onKeydown: i[9] ||= j(() => {}, ["stop"])
1263
- }, [u(E(Te), { size: 20 })], 40, ut), c("button", {
1304
+ }, [u(E(De), { size: 20 })], 40, ht), c("button", {
1264
1305
  type: "button",
1265
1306
  class: "media-carousel-control media-carousel-control--next",
1266
1307
  "aria-label": `Next media for post ${e.item.postId}`,
1267
- onClick: i[10] ||= j((e) => Q(T.value + 1, e), ["stop"]),
1308
+ onClick: i[10] ||= j((e) => X(T.value + 1, e), ["stop"]),
1268
1309
  onKeydown: i[11] ||= j(() => {}, ["stop"])
1269
- }, [u(E(Ee), { size: 20 })], 40, dt)], 2)) : o("", !0),
1270
- Z.value ? (b(), s("button", {
1310
+ }, [u(E(Oe), { size: 20 })], 40, gt)], 2)) : o("", !0),
1311
+ Y.value ? (b(), s("button", {
1271
1312
  key: 1,
1272
1313
  class: "media-card-activator",
1273
1314
  type: "button",
1274
1315
  "aria-label": `Open post ${e.item.postId}`,
1275
- onClick: i[12] ||= j((e) => r.$emit("activate", ue(e)), ["stop"]),
1316
+ onClick: i[12] ||= j((e) => r.$emit("activate", fe(e)), ["stop"]),
1276
1317
  onKeydown: i[13] ||= j(() => {}, ["stop"])
1277
- }, null, 40, ft)) : o("", !0)
1278
- ], 42, at),
1279
- e.cardFooter ? (b(), a(Pe, {
1318
+ }, null, 40, _t)) : o("", !0)
1319
+ ], 42, ut),
1320
+ e.cardFooter ? (b(), a(Ie, {
1280
1321
  key: 1,
1281
1322
  index: e.index,
1282
1323
  item: e.item,
@@ -1299,12 +1340,12 @@ var rt = [
1299
1340
  "style",
1300
1341
  "total"
1301
1342
  ])) : o("", !0)
1302
- ])], 46, rt));
1343
+ ])], 46, ct));
1303
1344
  }
1304
- }), _t = { class: "masonry-feed-shell" }, vt = ["aria-hidden", "inert"], yt = {
1345
+ }), St = { class: "masonry-feed-shell" }, Ct = ["aria-hidden", "inert"], wt = {
1305
1346
  key: 0,
1306
1347
  class: "masonry-feed-status-overlay"
1307
- }, bt = 6, xt = 12, St = 250, Ct = /* @__PURE__ */ d({
1348
+ }, Tt = 6, Et = 12, Dt = 250, Ot = /* @__PURE__ */ d({
1308
1349
  __name: "MasonryFeed",
1309
1350
  props: {
1310
1351
  enteringPostIds: {},
@@ -1341,19 +1382,19 @@ var rt = [
1341
1382
  "visible"
1342
1383
  ],
1343
1384
  setup(t, { expose: n, emit: i }) {
1344
- let l = 0, d = t, f = i, p = w(null), m = `vibe-masonry-${D()}`, g = w(null), y = w(0), x = w(bt), 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(() => ie(d.items, y.value, {
1385
+ let l = 0, d = t, f = i, p = w(null), m = `vibe-masonry-${D()}`, g = w(null), y = w(0), x = w(Tt), 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(() => oe(d.items, y.value, {
1345
1386
  additionalHeight: (d.cardHeader?.height ?? 0) + (d.cardFooter?.height ?? 0),
1346
1387
  gap: x.value,
1347
- minColumnWidth: se(d.masonry)
1388
+ minColumnWidth: le(d.masonry)
1348
1389
  })), z = r(() => {
1349
1390
  if (d.leavingPostIds.size === 0) return null;
1350
1391
  let e = d.items.flatMap((e, t) => d.leavingPostIds.has(e.postId) ? [] : [{
1351
1392
  index: t,
1352
1393
  item: e
1353
- }]), t = ie(e.map(({ item: e }) => e), y.value, {
1394
+ }]), t = oe(e.map(({ item: e }) => e), y.value, {
1354
1395
  additionalHeight: (d.cardHeader?.height ?? 0) + (d.cardFooter?.height ?? 0),
1355
1396
  gap: x.value,
1356
- minColumnWidth: se(d.masonry)
1397
+ minColumnWidth: le(d.masonry)
1357
1398
  });
1358
1399
  return {
1359
1400
  indices: e.map(({ index: e }) => e),
@@ -1366,50 +1407,50 @@ var rt = [
1366
1407
  ...t.layout,
1367
1408
  items: d.items.map((n, r) => d.leavingPostIds.has(n.postId) ? e.items[r] : t.positions.get(n.postId) ?? e.items[r])
1368
1409
  } : e;
1369
- }), V = r(() => ae(R.value.items)), ee = r(() => {
1410
+ }), V = r(() => se(R.value.items)), H = r(() => {
1370
1411
  let e = z.value;
1371
- return e ? ae(e.layout.items, e.indices) : null;
1372
- }), H = r(() => Math.max(T.value, d.leavingPostIds.size === 0 ? B.value.height : R.value.height)), U = r(() => ({ height: `${H.value}px` })), W = r(() => !d.infiniteScroll || C.value > 0 && k.value + B.value.height <= C.value + 1), K = r(() => new Set(A.value)), q = r(() => j.value.flatMap((e) => {
1412
+ return e ? se(e.layout.items, e.indices) : null;
1413
+ }), U = r(() => Math.max(T.value, d.leavingPostIds.size === 0 ? B.value.height : R.value.height)), W = r(() => ({ height: `${U.value}px` })), ee = 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) => {
1373
1414
  let t = d.items[e];
1374
1415
  return t ? [{
1375
- fetchPriority: K.value.has(e) ? "high" : "low",
1416
+ fetchPriority: G.value.has(e) ? "high" : "low",
1376
1417
  index: e,
1377
1418
  item: t
1378
1419
  }] : [];
1379
1420
  }));
1380
- function te(e, t) {
1421
+ function ne(e, t) {
1381
1422
  return [...new Set([...e, ...t])].sort((e, t) => e - t);
1382
1423
  }
1383
- function Y(e, t) {
1424
+ function q(e, t) {
1384
1425
  return e.length === t.length && e.every((e, n) => e === t[n]);
1385
1426
  }
1386
- function ne(e) {
1427
+ function ie(e) {
1387
1428
  let t = {
1388
1429
  scrollTop: M - k.value,
1389
1430
  viewportHeight: C.value
1390
- }, n = ee.value, r = oe(n ?? V.value, {
1431
+ }, n = H.value, r = ce(n ?? V.value, {
1391
1432
  ...t,
1392
1433
  overscan: e
1393
1434
  }).indices;
1394
- return te(r, d.leavingPostIds.size === 0 ? [] : oe(V.value, {
1435
+ return ne(r, d.leavingPostIds.size === 0 ? [] : ce(V.value, {
1395
1436
  ...t,
1396
1437
  overscan: e
1397
1438
  }).indices);
1398
1439
  }
1399
- function X() {
1400
- let e = ne(0), t = ne(ce(d.masonry, C.value));
1401
- Y(A.value, e) || (A.value = e), Y(j.value, t) || (j.value = t);
1440
+ function J() {
1441
+ let e = ie(0), t = ie(ue(d.masonry, C.value));
1442
+ q(A.value, e) || (A.value = e), q(j.value, t) || (j.value = t);
1402
1443
  }
1403
- function le() {
1444
+ function de() {
1404
1445
  if (I !== null) return;
1405
1446
  I = -1;
1406
1447
  let e = requestAnimationFrame(() => {
1407
- I = null, X();
1448
+ I = null, J();
1408
1449
  });
1409
1450
  I !== null && (I = e);
1410
1451
  }
1411
- let Z = /* @__PURE__ */ new Set();
1412
- O(() => [...K.value].flatMap((e) => {
1452
+ let Y = /* @__PURE__ */ new Set();
1453
+ O(() => [...G.value].flatMap((e) => {
1413
1454
  let t = d.items[e];
1414
1455
  if (!t) return [];
1415
1456
  let n = d.mediaIndices.get(t.postId) ?? 0, r = L(t.postId, n);
@@ -1421,16 +1462,16 @@ var rt = [
1421
1462
  }), (e) => {
1422
1463
  let t = new Set(e.map(({ key: e }) => e));
1423
1464
  e.forEach(({ key: e, mediaIndex: t, postId: n }) => {
1424
- Z.has(e) || f("visible", n, t);
1425
- }), Z = t;
1465
+ Y.has(e) || f("visible", n, t);
1466
+ }), Y = t;
1426
1467
  }, {
1427
1468
  immediate: !0,
1428
1469
  flush: "post"
1429
1470
  });
1430
- function ue(e) {
1471
+ function fe(e) {
1431
1472
  let t = B.value.items[e], n = d.items[e]?.postId;
1432
1473
  if (!t) return {};
1433
- let r = n !== void 0 && d.enteringPostIds.has(n), i = n !== void 0 && d.leavingPostIds.has(n), a = r || i ? re({
1474
+ let r = n !== void 0 && d.enteringPostIds.has(n), i = n !== void 0 && d.leavingPostIds.has(n), a = r || i ? ae({
1434
1475
  containerHeight: Math.max(T.value, R.value.height),
1435
1476
  gap: x.value
1436
1477
  }) : 0, o = n === void 0 ? 0 : i ? d.removalDelays.get(n) ?? 0 : r ? d.entryDelays.get(n) ?? 0 : 0;
@@ -1441,52 +1482,52 @@ var rt = [
1441
1482
  transform: `translate3d(${t.x}px, ${t.y + a}px, 0)`
1442
1483
  };
1443
1484
  }
1444
- function Q() {
1485
+ function X() {
1445
1486
  let e = p.value;
1446
1487
  if (!e) return;
1447
1488
  M = e.scrollTop, C.value = e.clientHeight;
1448
1489
  let t = e.ownerDocument.defaultView?.getComputedStyle(e), n = (Number.parseFloat(t?.paddingTop ?? "") || 0) + (Number.parseFloat(t?.paddingBottom ?? "") || 0);
1449
1490
  T.value = Math.max(0, e.clientHeight - n);
1450
1491
  let r = g.value;
1451
- r && (k.value = r.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop, X());
1492
+ r && (k.value = r.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop, J());
1452
1493
  }
1453
- function de(e) {
1494
+ function pe(e) {
1454
1495
  let t = e.ownerDocument.documentElement.clientWidth;
1455
- y.value = e.clientWidth, x.value = Math.min(xt, Math.max(bt, t * .0075)), Q();
1496
+ y.value = e.clientWidth, x.value = Math.min(Et, Math.max(Tt, t * .0075)), X();
1456
1497
  }
1457
- function fe(e) {
1498
+ function me(e) {
1458
1499
  let t = e.currentTarget;
1459
- t && (M = t.scrollTop, le(), Date.now() >= l && !d.loadMoreLocked && d.infiniteScroll && J(t) && f("loadMore"));
1500
+ t && (M = t.scrollTop, de(), Date.now() >= l && !d.loadMoreLocked && d.infiniteScroll && re(t) && f("loadMore"));
1460
1501
  }
1461
- function pe() {
1502
+ function he() {
1462
1503
  let e = p.value;
1463
- Date.now() >= l && !d.loadMoreLocked && e && J(e) && f("loadMore");
1504
+ Date.now() >= l && !d.loadMoreLocked && e && re(e) && f("loadMore");
1464
1505
  }
1465
1506
  O(() => d.items.length, (e, t) => {
1466
- e > 0 && e < t && (l = Date.now() + St);
1507
+ e > 0 && e < t && (l = Date.now() + Dt);
1467
1508
  });
1468
- function me() {
1509
+ function ge() {
1469
1510
  return p.value;
1470
1511
  }
1471
1512
  return O(g, (e) => {
1472
- N?.disconnect(), N = null, F !== null && cancelAnimationFrame(F), e && (de(e), !(typeof ResizeObserver > "u") && (N = new ResizeObserver(([t]) => {
1513
+ N?.disconnect(), N = null, F !== null && cancelAnimationFrame(F), e && (pe(e), !(typeof ResizeObserver > "u") && (N = new ResizeObserver(([t]) => {
1473
1514
  let n = t?.contentRect.width ?? e.clientWidth;
1474
1515
  Math.abs(n - y.value) < .5 || (F = requestAnimationFrame(() => {
1475
- F = null, de(e);
1516
+ F = null, pe(e);
1476
1517
  }));
1477
1518
  }), N.observe(e)));
1478
1519
  }), O(p, (e) => {
1479
- P?.disconnect(), P = null, e && (Q(), !(typeof ResizeObserver > "u") && (P = new ResizeObserver(Q), P.observe(e)));
1520
+ P?.disconnect(), P = null, e && (X(), !(typeof ResizeObserver > "u") && (P = new ResizeObserver(X), P.observe(e)));
1480
1521
  }), O([
1481
1522
  R,
1482
1523
  B,
1483
1524
  () => d.masonry
1484
- ], X, { flush: "post" }), v(() => {
1525
+ ], J, { flush: "post" }), v(() => {
1485
1526
  N?.disconnect(), P?.disconnect(), F !== null && cancelAnimationFrame(F), I !== null && cancelAnimationFrame(I);
1486
1527
  }), n({
1487
- getScrollElement: me,
1488
- loadIfNearBottom: pe
1489
- }), (n, r) => (b(), s("div", _t, [
1528
+ getScrollElement: ge,
1529
+ loadIfNearBottom: he
1530
+ }), (n, r) => (b(), s("div", St, [
1490
1531
  c("main", {
1491
1532
  id: m,
1492
1533
  ref_key: "galleryElement",
@@ -1495,14 +1536,14 @@ var rt = [
1495
1536
  "data-layout-mode": "masonry",
1496
1537
  "aria-hidden": t.suspended || void 0,
1497
1538
  inert: t.suspended || void 0,
1498
- onScrollPassive: fe
1539
+ onScrollPassive: me
1499
1540
  }, [c("section", {
1500
1541
  ref_key: "masonryElement",
1501
1542
  ref: g,
1502
1543
  class: h(["masonry", { "masonry--ready": y.value > 0 }]),
1503
- style: _(U.value),
1544
+ style: _(W.value),
1504
1545
  "aria-label": "Media gallery"
1505
- }, [(b(!0), s(e, null, S(q.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(gt, {
1546
+ }, [(b(!0), s(e, null, S(K.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(xt, {
1506
1547
  key: n.postId,
1507
1548
  class: "masonry-item",
1508
1549
  entering: t.enteringPostIds.has(n.postId),
@@ -1513,7 +1554,7 @@ var rt = [
1513
1554
  "media-card": t.mediaCard,
1514
1555
  index: r,
1515
1556
  item: n,
1516
- "item-style": ue(r),
1557
+ "item-style": fe(r),
1517
1558
  interactive: "",
1518
1559
  layout: "masonry",
1519
1560
  "loaded-count": t.items.length,
@@ -1542,8 +1583,8 @@ var rt = [
1542
1583
  "onMediaChange",
1543
1584
  "onReady",
1544
1585
  "onError"
1545
- ]))), 128))], 6)], 42, vt),
1546
- t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && W.value || !t.hasNext && t.canRetryEnd ? (b(), s("div", yt, [u(G, {
1586
+ ]))), 128))], 6)], 42, Ct),
1587
+ t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && ee.value || !t.hasNext && t.canRetryEnd ? (b(), s("div", wt, [u(te, {
1547
1588
  actions: t.feedFooterActions,
1548
1589
  "can-retry-end": t.canRetryEnd,
1549
1590
  "feed-footer": t.feedFooter,
@@ -1551,7 +1592,7 @@ var rt = [
1551
1592
  "has-next": t.hasNext,
1552
1593
  "is-loading": t.isLoadingMore,
1553
1594
  "load-more-locked": t.loadMoreLocked,
1554
- "show-load-more": W.value,
1595
+ "show-load-more": ee.value,
1555
1596
  state: t.state,
1556
1597
  onLoadMore: r[0] ||= (e) => f("loadMore"),
1557
1598
  onRetryEnd: r[1] ||= (e) => f("retryEnd")
@@ -1566,7 +1607,7 @@ var rt = [
1566
1607
  "show-load-more",
1567
1608
  "state"
1568
1609
  ])])) : o("", !0),
1569
- u(he, {
1610
+ u(_e, {
1570
1611
  "content-size": B.value.height,
1571
1612
  "controls-id": m,
1572
1613
  "scroll-element": p.value,
@@ -1578,8 +1619,8 @@ var rt = [
1578
1619
  ])
1579
1620
  ]));
1580
1621
  }
1581
- }), wt = 300;
1582
- function Tt(e, t, n) {
1622
+ }), kt = 300;
1623
+ function At(e, t, n) {
1583
1624
  let r = e.scrollTop;
1584
1625
  if (n || Math.abs(r - t) <= 1) return e.scrollTop = t, Promise.resolve();
1585
1626
  e.setAttribute("data-transitioning", "");
@@ -1587,7 +1628,7 @@ function Tt(e, t, n) {
1587
1628
  return new Promise((n) => {
1588
1629
  let o = (s) => {
1589
1630
  a += 1;
1590
- let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / wt), u = 1 - (1 - l) ** 3;
1631
+ let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / kt), u = 1 - (1 - l) ** 3;
1591
1632
  if (e.scrollTop = r + (t - r) * u, l < 1) {
1592
1633
  requestAnimationFrame(o);
1593
1634
  return;
@@ -1599,7 +1640,7 @@ function Tt(e, t, n) {
1599
1640
  }
1600
1641
  //#endregion
1601
1642
  //#region src/components/ReelAutoAdvanceProgress.vue?vue&type=script&setup=true&lang.ts
1602
- var Et = ["aria-label"], Dt = /* @__PURE__ */ d({
1643
+ var jt = ["aria-label"], Mt = /* @__PURE__ */ d({
1603
1644
  __name: "ReelAutoAdvanceProgress",
1604
1645
  props: {
1605
1646
  durationMs: {},
@@ -1617,9 +1658,9 @@ var Et = ["aria-label"], Dt = /* @__PURE__ */ d({
1617
1658
  class: "reel-auto-advance-progress",
1618
1659
  style: _(a.value),
1619
1660
  onAnimationend: n[0] ||= (e) => i("complete")
1620
- }, null, 36)], 8, Et));
1661
+ }, null, 36)], 8, jt));
1621
1662
  }
1622
- }), Ot = { class: "reel-viewport" }, kt = ["data-active-post-id", "data-active-media-index"], At = ["role", "data-status"], jt = 300, Mt = 250, Nt = /* @__PURE__ */ d({
1663
+ }), Nt = { class: "reel-viewport" }, Pt = ["data-active-post-id", "data-active-media-index"], Ft = ["role", "data-status"], It = 300, Lt = 250, Rt = /* @__PURE__ */ d({
1623
1664
  __name: "ReelFeed",
1624
1665
  props: {
1625
1666
  initialPostId: {},
@@ -1668,10 +1709,10 @@ var Et = ["aria-label"], Dt = /* @__PURE__ */ d({
1668
1709
  }), z = r(() => u.items[x.value]?.postId), B = r(() => u.items[x.value]), V = r(() => {
1669
1710
  let e = z.value;
1670
1711
  return e === void 0 ? 0 : u.mediaIndices.get(e) ?? 0;
1671
- }), ee = r(() => {
1712
+ }), H = r(() => {
1672
1713
  let e = z.value;
1673
1714
  return e === void 0 ? "loading" : u.previewStates.get(L(e, V.value)) ?? "loading";
1674
- }), H = r(() => B.value ? I(B.value, V.value) : null), U = r(() => H.value ? N(H.value, u.mediaSource ?? "preview") : null), W = r(() => ee.value === "ready" && !!(U.value && et(U.value.type, U.value.src))), K = r(() => [
1715
+ }), U = r(() => B.value ? I(B.value, V.value) : null), W = r(() => U.value ? N(U.value, u.mediaSource ?? "preview") : null), ee = r(() => H.value === "ready" && !!(W.value && tt(W.value.type, W.value.src))), G = r(() => [
1675
1716
  z.value,
1676
1717
  V.value,
1677
1718
  u.items.length,
@@ -1679,52 +1720,52 @@ var Et = ["aria-label"], Dt = /* @__PURE__ */ d({
1679
1720
  u.reelAutoAdvance.enabled,
1680
1721
  u.reelAutoAdvance.includePostItems,
1681
1722
  u.reelAutoAdvance.intervalMs
1682
- ].join(":")), q = r(() => {
1723
+ ].join(":")), K = r(() => {
1683
1724
  let e = B.value, t = !!(e && u.reelAutoAdvance.includePostItems && V.value < P(e).length - 1), n = u.reelAutoAdvance.intervalMs / 1e3;
1684
1725
  return `Auto advance to the next ${t ? "post item" : "post"} in ${n}s`;
1685
- }), te = r(() => u.reelAutoAdvance.enabled && u.reelForward.status === "idle" && B.value !== void 0 && ee.value !== "loading" && !W.value), Y = r(() => !u.infiniteScroll || u.items.length <= 1), ne = 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.");
1686
- function re(e) {
1726
+ }), ne = r(() => u.reelAutoAdvance.enabled && u.reelForward.status === "idle" && B.value !== void 0 && H.value !== "loading" && !ee.value), q = r(() => !u.infiniteScroll || u.items.length <= 1), ie = 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.");
1727
+ function ae(e) {
1687
1728
  return { gridRow: `${e + 1}` };
1688
1729
  }
1689
- function ie(e) {
1730
+ function oe(e) {
1690
1731
  let t = k || e.clientHeight;
1691
1732
  return t <= 0 || u.items.length === 0 ? 0 : Math.min(u.items.length - 1, Math.max(0, Math.round(e.scrollTop / t)));
1692
1733
  }
1693
- function ae(e) {
1734
+ function se(e) {
1694
1735
  let t = e.currentTarget;
1695
1736
  if (!t) return;
1696
1737
  let n = k || t.clientHeight, r = Math.max(0, u.items.length - 1) * n;
1697
- C.value = u.items.length > 0 && t.scrollTop > r + 1, D.value || (x.value = ie(t)), Date.now() >= l && !u.loadMoreLocked && u.infiniteScroll && J(t) && d("loadMore");
1738
+ C.value = u.items.length > 0 && t.scrollTop > r + 1, D.value || (x.value = oe(t)), Date.now() >= l && !u.loadMoreLocked && u.infiniteScroll && re(t) && d("loadMore");
1698
1739
  }
1699
- function X() {
1740
+ function J() {
1700
1741
  let e = f.value;
1701
- e && (C.value = !1, ce(!0), k = e.clientHeight, e.scrollTop = x.value * k, j !== null && cancelAnimationFrame(j), j = requestAnimationFrame(() => {
1742
+ e && (C.value = !1, ue(!0), k = e.clientHeight, e.scrollTop = x.value * k, j !== null && cancelAnimationFrame(j), j = requestAnimationFrame(() => {
1702
1743
  e.scrollTop = x.value * e.clientHeight, k = e.clientHeight, j = null;
1703
- }), oe());
1744
+ }), ce());
1704
1745
  }
1705
- function oe() {
1746
+ function ce() {
1706
1747
  M !== null && clearTimeout(M), M = setTimeout(() => {
1707
1748
  M = null;
1708
1749
  let e = f.value;
1709
- e && (k = e.clientHeight, e.scrollTop = x.value * k), ce(!1);
1750
+ e && (k = e.clientHeight, e.scrollTop = x.value * k), ue(!1);
1710
1751
  }, 120);
1711
1752
  }
1712
- function se() {
1713
- ce(!0);
1753
+ function le() {
1754
+ ue(!0);
1714
1755
  let e = f.value;
1715
- e && (k = e.clientHeight, e.scrollTop = x.value * k), oe();
1756
+ e && (k = e.clientHeight, e.scrollTop = x.value * k), ce();
1716
1757
  }
1717
- function ce(e) {
1758
+ function ue(e) {
1718
1759
  D.value = e, f.value?.toggleAttribute("data-resizing", e);
1719
1760
  }
1720
- function le() {
1761
+ function de() {
1721
1762
  let e = f.value;
1722
- Date.now() >= l && !u.loadMoreLocked && e && J(e) && d("loadMore");
1763
+ Date.now() >= l && !u.loadMoreLocked && e && re(e) && d("loadMore");
1723
1764
  }
1724
1765
  O(() => u.items.length, (e, t) => {
1725
- e > 0 && e < t && (l = Date.now() + Mt);
1766
+ e > 0 && e < t && (l = Date.now() + Lt);
1726
1767
  });
1727
- function Z(e) {
1768
+ function Y(e) {
1728
1769
  let t = B.value;
1729
1770
  if (!t) return !1;
1730
1771
  let n = P(t).length;
@@ -1732,34 +1773,34 @@ var Et = ["aria-label"], Dt = /* @__PURE__ */ d({
1732
1773
  let r = (V.value + e + n) % n;
1733
1774
  return d("mediaChange", t.postId, r), !0;
1734
1775
  }
1735
- function ue(e) {
1776
+ function fe(e) {
1736
1777
  let t = x.value + e;
1737
- return !f.value || t < 0 || t >= u.items.length ? !1 : (pe(t), !0);
1778
+ return !f.value || t < 0 || t >= u.items.length ? !1 : (he(t), !0);
1738
1779
  }
1739
- function Q(e, t) {
1780
+ function X(e, t) {
1740
1781
  let n = u.items.findIndex((t) => t.postId === e), r = u.items[n];
1741
- return !f.value || !r || t < 0 || t > r.items.length ? !1 : ((u.mediaIndices.get(e) ?? 0) !== t && d("mediaChange", e, t), n !== x.value && pe(n), !0);
1782
+ return !f.value || !r || t < 0 || t > r.items.length ? !1 : ((u.mediaIndices.get(e) ?? 0) !== t && d("mediaChange", e, t), n !== x.value && he(n), !0);
1742
1783
  }
1743
- function de() {
1784
+ function pe() {
1744
1785
  return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
1745
1786
  }
1746
- function fe(e) {
1787
+ function me(e) {
1747
1788
  let t = f.value;
1748
1789
  if (!t) return Promise.resolve();
1749
1790
  let n = e * (k || t.clientHeight);
1750
- return x.value = e, Tt(t, n, de());
1791
+ return x.value = e, At(t, n, pe());
1751
1792
  }
1752
- function pe(e) {
1753
- fe(e);
1793
+ function he(e) {
1794
+ me(e);
1754
1795
  }
1755
- async function me(e) {
1796
+ async function ge(e) {
1756
1797
  let t = u.items.findIndex((t) => t.postId === e);
1757
- return t < 0 || t === x.value ? !1 : (await fe(t), !0);
1798
+ return t < 0 || t === x.value ? !1 : (await me(t), !0);
1758
1799
  }
1759
- async function he(e) {
1760
- return Z(e) ? (de() || await new Promise((e) => setTimeout(e, jt)), !0) : !1;
1800
+ async function _e(e) {
1801
+ return Y(e) ? (pe() || await new Promise((e) => setTimeout(e, It)), !0) : !1;
1761
1802
  }
1762
- function ge() {
1803
+ function ve() {
1763
1804
  if (!u.reelAutoAdvance.enabled) return;
1764
1805
  let e = B.value;
1765
1806
  if (!e) return;
@@ -1772,31 +1813,31 @@ var Et = ["aria-label"], Dt = /* @__PURE__ */ d({
1772
1813
  u.hasNext && !u.loadMoreLocked && d("loadMore");
1773
1814
  return;
1774
1815
  }
1775
- u.reelAutoAdvance.includePostItems && (u.mediaIndices.get(n.postId) ?? 0) !== 0 && d("mediaChange", n.postId, 0), pe(t);
1816
+ u.reelAutoAdvance.includePostItems && (u.mediaIndices.get(n.postId) ?? 0) !== 0 && d("mediaChange", n.postId, 0), he(t);
1776
1817
  }
1777
- function _e(e, t) {
1778
- !u.reelAutoAdvance.enabled || e !== z.value || t !== V.value || !W.value || ge();
1818
+ function ye(e, t) {
1819
+ !u.reelAutoAdvance.enabled || e !== z.value || t !== V.value || !ee.value || ve();
1779
1820
  }
1780
1821
  return O(f, (e) => {
1781
- A?.disconnect(), A = null, e && (k = e.clientHeight, !(typeof ResizeObserver > "u") && (A = new ResizeObserver(X), A.observe(e)));
1822
+ A?.disconnect(), A = null, e && (k = e.clientHeight, !(typeof ResizeObserver > "u") && (A = new ResizeObserver(J), A.observe(e)));
1782
1823
  }), O(() => u.items.length, async (e) => {
1783
1824
  let t = u.initialPostId, n = t == null ? -1 : u.items.findIndex(({ postId: e }) => e === t);
1784
- x.value = n >= 0 ? n : Math.min(x.value, Math.max(0, e - 1)), await m(), X();
1825
+ x.value = n >= 0 ? n : Math.min(x.value, Math.max(0, e - 1)), await m(), J();
1785
1826
  }), O(z, (e) => {
1786
1827
  e !== void 0 && d("activeChange", e);
1787
1828
  }, { immediate: !0 }), y(() => {
1788
- window.addEventListener("resize", se), window.addEventListener("orientationchange", se), g >= 0 && m(X);
1829
+ window.addEventListener("resize", le), window.addEventListener("orientationchange", le), g >= 0 && m(J);
1789
1830
  }), v(() => {
1790
- window.removeEventListener("resize", se), window.removeEventListener("orientationchange", se), A?.disconnect(), j !== null && cancelAnimationFrame(j), M !== null && clearTimeout(M);
1831
+ window.removeEventListener("resize", le), window.removeEventListener("orientationchange", le), A?.disconnect(), j !== null && cancelAnimationFrame(j), M !== null && clearTimeout(M);
1791
1832
  }), n({
1792
1833
  activeIndex: x,
1793
1834
  activePostId: z,
1794
- changeActiveMedia: Z,
1795
- loadIfNearBottom: le,
1796
- moveActivePost: ue,
1797
- navigateToItem: Q,
1798
- transitionActiveMedia: he,
1799
- transitionActivePost: me
1835
+ changeActiveMedia: Y,
1836
+ loadIfNearBottom: de,
1837
+ moveActivePost: fe,
1838
+ navigateToItem: X,
1839
+ transitionActiveMedia: _e,
1840
+ transitionActivePost: ge
1800
1841
  }), (n, r) => (b(), s("main", {
1801
1842
  class: h(["reel-shell", {
1802
1843
  "reel-shell--has-footer": !!t.cardFooter,
@@ -1804,7 +1845,7 @@ var Et = ["aria-label"], Dt = /* @__PURE__ */ d({
1804
1845
  }]),
1805
1846
  "data-layout-mode": "reel"
1806
1847
  }, [
1807
- t.cardHeader && B.value && t.reelForward.status === "idle" ? (b(), a(Pe, {
1848
+ t.cardHeader && B.value && t.reelForward.status === "idle" ? (b(), a(Ie, {
1808
1849
  key: 0,
1809
1850
  index: x.value,
1810
1851
  item: B.value,
@@ -1826,19 +1867,19 @@ var Et = ["aria-label"], Dt = /* @__PURE__ */ d({
1826
1867
  "style",
1827
1868
  "total"
1828
1869
  ])) : o("", !0),
1829
- c("div", Ot, [c("div", {
1870
+ c("div", Nt, [c("div", {
1830
1871
  ref_key: "galleryElement",
1831
1872
  ref: f,
1832
1873
  class: "gallery-shell reel-feed",
1833
1874
  "data-active-post-id": z.value,
1834
1875
  "data-active-media-index": V.value,
1835
- onScrollPassive: ae
1876
+ onScrollPassive: se
1836
1877
  }, [t.reelForward.status === "idle" ? (b(), s("section", {
1837
1878
  key: 1,
1838
1879
  class: "reel-track",
1839
1880
  style: _(F.value),
1840
1881
  "aria-label": "Media gallery"
1841
- }, [(b(!0), s(e, null, S(R.value, ({ fetchPriority: e, item: n, index: i }) => (b(), a(gt, {
1882
+ }, [(b(!0), s(e, null, S(R.value, ({ fetchPriority: e, item: n, index: i }) => (b(), a(xt, {
1842
1883
  key: n.postId,
1843
1884
  active: i === x.value && !C.value,
1844
1885
  "advance-on-media-end": u.reelAutoAdvance.enabled && i === x.value,
@@ -1847,7 +1888,7 @@ var Et = ["aria-label"], Dt = /* @__PURE__ */ d({
1847
1888
  "fetch-priority": e,
1848
1889
  index: i,
1849
1890
  item: n,
1850
- "item-style": re(i),
1891
+ "item-style": ae(i),
1851
1892
  "media-card": t.mediaCard,
1852
1893
  layout: "reel",
1853
1894
  "loaded-count": t.items.length,
@@ -1859,7 +1900,7 @@ var Et = ["aria-label"], Dt = /* @__PURE__ */ d({
1859
1900
  "stationary-reel-controls": "",
1860
1901
  total: t.total,
1861
1902
  onMediaChange: (e) => d("mediaChange", n.postId, e),
1862
- onEnded: (e) => _e(n.postId, e),
1903
+ onEnded: (e) => ye(n.postId, e),
1863
1904
  onReady: (e) => d("ready", n.postId, e),
1864
1905
  onReelAudioChange: r[1] ||= (e) => d("reelAudioChange", e),
1865
1906
  onError: (e) => d("error", n.postId, e)
@@ -1887,12 +1928,12 @@ var Et = ["aria-label"], Dt = /* @__PURE__ */ d({
1887
1928
  class: "reel-forward-status",
1888
1929
  role: t.reelForward.status === "error" ? "alert" : "status",
1889
1930
  "data-status": t.reelForward.status
1890
- }, [c("p", null, T(ne.value), 1), t.reelForward.status === "error" || t.reelForward.status === "end" ? (b(), s("button", {
1931
+ }, [c("p", null, T(ie.value), 1), t.reelForward.status === "error" || t.reelForward.status === "end" ? (b(), s("button", {
1891
1932
  key: 0,
1892
1933
  class: "reel-forward-retry",
1893
1934
  type: "button",
1894
1935
  onClick: r[0] ||= (e) => d("retryForward")
1895
- }, " Retry ")) : o("", !0)], 8, At)), t.reelForward.status === "idle" ? (b(), a(G, {
1936
+ }, " Retry ")) : o("", !0)], 8, Ft)), t.reelForward.status === "idle" ? (b(), a(te, {
1896
1937
  key: 2,
1897
1938
  actions: t.feedFooterActions,
1898
1939
  "can-retry-end": t.canRetryEnd,
@@ -1901,7 +1942,7 @@ var Et = ["aria-label"], Dt = /* @__PURE__ */ d({
1901
1942
  "has-next": t.hasNext,
1902
1943
  "is-loading": t.isLoadingMore,
1903
1944
  "load-more-locked": t.loadMoreLocked,
1904
- "show-load-more": Y.value,
1945
+ "show-load-more": q.value,
1905
1946
  state: t.state,
1906
1947
  onLoadMore: r[2] ||= (e) => d("loadMore"),
1907
1948
  onRetryEnd: r[3] ||= (e) => d("retryEnd")
@@ -1915,13 +1956,13 @@ var Et = ["aria-label"], Dt = /* @__PURE__ */ d({
1915
1956
  "load-more-locked",
1916
1957
  "show-load-more",
1917
1958
  "state"
1918
- ])) : o("", !0)], 40, kt), c("div", {
1959
+ ])) : o("", !0)], 40, Pt), c("div", {
1919
1960
  ref_key: "reelControlsElement",
1920
1961
  ref: p,
1921
1962
  class: "reel-media-controls-host",
1922
1963
  "data-test": "reel-media-controls-host"
1923
1964
  }, null, 512)]),
1924
- t.cardFooter && B.value && t.reelForward.status === "idle" ? (b(), a(Pe, {
1965
+ t.cardFooter && B.value && t.reelForward.status === "idle" ? (b(), a(Ie, {
1925
1966
  key: 1,
1926
1967
  index: x.value,
1927
1968
  item: B.value,
@@ -1943,24 +1984,24 @@ var Et = ["aria-label"], Dt = /* @__PURE__ */ d({
1943
1984
  "style",
1944
1985
  "total"
1945
1986
  ])) : o("", !0),
1946
- te.value ? (b(), a(Dt, {
1947
- key: K.value,
1987
+ ne.value ? (b(), a(Mt, {
1988
+ key: G.value,
1948
1989
  "duration-ms": t.reelAutoAdvance.intervalMs,
1949
- label: q.value,
1950
- onComplete: ge
1990
+ label: K.value,
1991
+ onComplete: ve
1951
1992
  }, null, 8, ["duration-ms", "label"])) : o("", !0)
1952
1993
  ], 2));
1953
1994
  }
1954
- }), Pt = ["data-info-sheet-open", "data-info-sheet-mode"], Ft = ["aria-hidden", "inert"], It = {
1995
+ }), zt = ["data-info-sheet-open", "data-info-sheet-mode"], Bt = ["aria-hidden", "inert"], Vt = {
1955
1996
  key: 0,
1956
1997
  class: "reel-info-sheet-layer",
1957
1998
  "data-test": "reel-info-sheet"
1958
- }, Lt = [
1999
+ }, Ht = [
1959
2000
  "role",
1960
2001
  "aria-modal",
1961
2002
  "tabindex",
1962
2003
  "data-active-post-id"
1963
- ], Rt = /* @__PURE__ */ d({
2004
+ ], Ut = /* @__PURE__ */ d({
1964
2005
  __name: "ReelLayout",
1965
2006
  props: {
1966
2007
  forwardIndex: { default: null },
@@ -2052,10 +2093,10 @@ var Et = ["aria-label"], Dt = /* @__PURE__ */ d({
2052
2093
  function V(e, t) {
2053
2094
  d("error", e, t);
2054
2095
  }
2055
- function ee(e, t) {
2096
+ function H(e, t) {
2056
2097
  d("mediaChange", e, t);
2057
2098
  }
2058
- function H(e, t) {
2099
+ function U(e, t) {
2059
2100
  d("ready", e, t);
2060
2101
  }
2061
2102
  return O(() => ({
@@ -2087,7 +2128,7 @@ var Et = ["aria-label"], Dt = /* @__PURE__ */ d({
2087
2128
  class: "reel-layout-main",
2088
2129
  "aria-hidden": e.infoSheetOverlay && A.value || void 0,
2089
2130
  inert: e.infoSheetOverlay && A.value || void 0
2090
- }, [u(Nt, {
2131
+ }, [u(Rt, {
2091
2132
  ref_key: "reelFeed",
2092
2133
  ref: p,
2093
2134
  "can-retry-end": e.canRetryEnd,
@@ -2114,8 +2155,8 @@ var Et = ["aria-label"], Dt = /* @__PURE__ */ d({
2114
2155
  onActiveChange: r[0] ||= (e) => d("activeChange", e),
2115
2156
  onError: V,
2116
2157
  onLoadMore: r[1] ||= (e) => d("loadMore"),
2117
- onMediaChange: ee,
2118
- onReady: H,
2158
+ onMediaChange: H,
2159
+ onReady: U,
2119
2160
  onRetryEnd: r[2] ||= (e) => d("retryEnd"),
2120
2161
  onRetryForward: r[3] ||= (e) => d("retryForward"),
2121
2162
  onReelAudioChange: r[4] ||= (e) => d("reelAudioChange", e)
@@ -2141,8 +2182,8 @@ var Et = ["aria-label"], Dt = /* @__PURE__ */ d({
2141
2182
  "reel-forward",
2142
2183
  "state",
2143
2184
  "total"
2144
- ])], 8, Ft), u(n, { name: "vibe-info-sheet" }, {
2145
- default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", It, [c("aside", {
2185
+ ])], 8, Bt), u(n, { name: "vibe-info-sheet" }, {
2186
+ default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", Vt, [c("aside", {
2146
2187
  ref_key: "sheetElement",
2147
2188
  ref: _,
2148
2189
  class: "reel-info-sheet",
@@ -2151,14 +2192,14 @@ var Et = ["aria-label"], Dt = /* @__PURE__ */ d({
2151
2192
  "aria-modal": e.infoSheetOverlay ? "true" : void 0,
2152
2193
  tabindex: e.infoSheetOverlay ? -1 : void 0,
2153
2194
  "data-active-post-id": T.value?.postId
2154
- }, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8, Lt)])) : o("", !0)]),
2195
+ }, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8, Ht)])) : o("", !0)]),
2155
2196
  _: 1
2156
- })], 10, Pt));
2197
+ })], 10, zt));
2157
2198
  }
2158
2199
  });
2159
2200
  //#endregion
2160
2201
  //#region src/core/mediaLifecycle.ts
2161
- function zt(e, t, n, r, i) {
2202
+ function Wt(e, t, n, r, i) {
2162
2203
  let a = e.items.findIndex((e) => e.postId === t), o = e.items[a];
2163
2204
  if (!o) return null;
2164
2205
  let s = F(o, n), c = I(o, s);
@@ -2174,7 +2215,7 @@ function zt(e, t, n, r, i) {
2174
2215
  postIndex: a
2175
2216
  };
2176
2217
  }
2177
- function Bt(e, t) {
2218
+ function Gt(e, t) {
2178
2219
  O(() => {
2179
2220
  let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null;
2180
2221
  return {
@@ -2184,20 +2225,20 @@ function Bt(e, t) {
2184
2225
  };
2185
2226
  }, (n, r) => {
2186
2227
  if (n.postId === null || n.postId === r?.postId && n.mediaIndex === r.mediaIndex && n.origin === r.origin) return;
2187
- let i = zt(e, n.postId, n.mediaIndex, "reel", n.origin);
2228
+ let i = Wt(e, n.postId, n.mediaIndex, "reel", n.origin);
2188
2229
  i && t(i);
2189
2230
  }, { flush: "sync" });
2190
2231
  }
2191
2232
  //#endregion
2192
2233
  //#region src/components/useMediaLifecycle.ts
2193
- function Vt(e, t) {
2234
+ function Kt(e, t) {
2194
2235
  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);
2195
2236
  function c(e, t, n, r) {
2196
2237
  let i = L(t, n);
2197
2238
  e.value.get(i) !== r && (e.value = new Map(e.value).set(i, r));
2198
2239
  }
2199
2240
  function l(t, n, r, i) {
2200
- return zt(e, t, n, r, i);
2241
+ return Wt(e, t, n, r, i);
2201
2242
  }
2202
2243
  function u(e, n, r, i) {
2203
2244
  let a = l(e, n, r, i);
@@ -2219,7 +2260,7 @@ function Vt(e, t) {
2219
2260
  let r = l(e, n, "masonry", null);
2220
2261
  r && t.visible(r);
2221
2262
  }
2222
- return Bt(e, t.reelChange), O(() => {
2263
+ return Gt(e, t.reelChange), O(() => {
2223
2264
  let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null, n = t === null ? 0 : e.mediaIndices.get(t) ?? 0;
2224
2265
  return {
2225
2266
  mediaIndex: n,
@@ -2244,16 +2285,16 @@ function Vt(e, t) {
2244
2285
  }
2245
2286
  //#endregion
2246
2287
  //#region src/core/reelEscapeStack.ts
2247
- var Ht = [];
2248
- function Ut(e) {
2249
- return Ht.push(e), () => {
2250
- let t = Ht.indexOf(e);
2251
- t >= 0 && Ht.splice(t, 1);
2288
+ var qt = [];
2289
+ function Jt(e) {
2290
+ return qt.push(e), () => {
2291
+ let t = qt.indexOf(e);
2292
+ t >= 0 && qt.splice(t, 1);
2252
2293
  };
2253
2294
  }
2254
- function Wt(e) {
2295
+ function Yt(e) {
2255
2296
  if (!e.isActive()) return !1;
2256
- let t = Ht.filter((e) => e.isActive()), n = e.element();
2297
+ let t = qt.filter((e) => e.isActive()), n = e.element();
2257
2298
  return n !== null && t.some((t) => {
2258
2299
  if (t === e) return !1;
2259
2300
  let r = t.element();
@@ -2269,14 +2310,14 @@ function Wt(e) {
2269
2310
  }
2270
2311
  //#endregion
2271
2312
  //#region src/components/useReelKeyboard.ts
2272
- function Gt(e) {
2313
+ function Xt(e) {
2273
2314
  let t = {
2274
2315
  element: e.element,
2275
2316
  isActive: () => e.state.layout === "reel" || e.state.reelOrigin === "masonry"
2276
2317
  }, n = null;
2277
2318
  function r(n) {
2278
2319
  let r = t.isActive();
2279
- if (n.key === "Escape" && r && !Wt(t)) return;
2320
+ if (n.key === "Escape" && r && !Yt(t)) return;
2280
2321
  if (n.key === "Escape" && e.state.reelOrigin === "masonry") {
2281
2322
  n.preventDefault(), e.state.reelInfoSheetOverlay && e.state.reelInfoSheet.enabled && e.setReelInfoSheet(!1), e.closeMasonryReel();
2282
2323
  return;
@@ -2296,14 +2337,14 @@ function Gt(e) {
2296
2337
  a !== 0 && e.reelRenderer()?.changeActiveMedia?.(a) && n.preventDefault();
2297
2338
  }
2298
2339
  y(() => {
2299
- n = Ut(t), window.addEventListener("keydown", r);
2340
+ n = Jt(t), window.addEventListener("keydown", r);
2300
2341
  }), v(() => {
2301
2342
  window.removeEventListener("keydown", r), n?.(), n = null;
2302
2343
  });
2303
2344
  }
2304
2345
  //#endregion
2305
2346
  //#region src/components/VibeSurface.vue?vue&type=script&setup=true&lang.ts
2306
- var Kt = 35, qt = 420, Jt = /* @__PURE__ */ d({
2347
+ var Zt = 35, Qt = 420, $t = /* @__PURE__ */ d({
2307
2348
  __name: "VibeSurface",
2308
2349
  props: {
2309
2350
  canRetryEnd: { type: Boolean },
@@ -2331,34 +2372,34 @@ var Kt = 35, qt = 420, Jt = /* @__PURE__ */ d({
2331
2372
  "retryForward"
2332
2373
  ],
2333
2374
  setup(t, { expose: i, emit: c }) {
2334
- 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: ee } = Vt(l.state, {
2375
+ let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), _ = w(!1), y = w(/* @__PURE__ */ new Set()), x = w(/* @__PURE__ */ new Map()), S = w(/* @__PURE__ */ new Set()), C = w(/* @__PURE__ */ new Map()), T = r(() => Object.freeze([...l.state.items])), D = r(() => z(l.state, T.value)), { markMasonryVisible: A, markPreviewError: j, markPreviewReady: M, markReelError: N, markReelReady: I, originalStates: L, previewStates: R, reelStates: B } = Kt(l.state, {
2335
2376
  ready: (e) => d("mediaReady", e),
2336
2377
  reelChange: (e) => d("reelMediaChange", e),
2337
2378
  visible: (e) => d("mediaVisible", e)
2338
- }), H = new Set(l.state.items.map((e) => e.postId)), U = null, W = null, G = !1;
2339
- function K() {
2379
+ }), V = new Set(l.state.items.map((e) => e.postId)), H = null, U = null, W = !1;
2380
+ function ee() {
2340
2381
  return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
2341
2382
  }
2342
- function q() {
2343
- U !== null && cancelAnimationFrame(U), U = requestAnimationFrame(() => {
2344
- U = requestAnimationFrame(() => {
2345
- U = null, S.value = /* @__PURE__ */ new Set();
2383
+ function te() {
2384
+ H !== null && cancelAnimationFrame(H), H = requestAnimationFrame(() => {
2385
+ H = requestAnimationFrame(() => {
2386
+ H = null, y.value = /* @__PURE__ */ new Set();
2346
2387
  });
2347
2388
  });
2348
2389
  }
2349
- function J(e, t) {
2390
+ function G(e, t) {
2350
2391
  let n = l.state.items.find((t) => t.postId === e);
2351
2392
  if (!n) return;
2352
2393
  let r = F(n, t);
2353
2394
  (l.state.mediaIndices.get(e) ?? 0) !== r && (l.state.mediaIndices = new Map(l.state.mediaIndices).set(e, r));
2354
2395
  }
2355
- async function Y() {
2396
+ async function K() {
2356
2397
  await m(), (l.state.layout === "reel" || l.state.reelOrigin === "masonry" ? p.value : f.value)?.loadIfNearBottom();
2357
2398
  }
2358
- function ne(e) {
2399
+ function re(e) {
2359
2400
  return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.changeActiveMedia?.(e) ?? !1;
2360
2401
  }
2361
- function re(e) {
2402
+ function q(e) {
2362
2403
  return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.moveActivePost?.(e) ?? !1;
2363
2404
  }
2364
2405
  function ie(e) {
@@ -2371,81 +2412,70 @@ var Kt = 35, qt = 420, Jt = /* @__PURE__ */ d({
2371
2412
  function ae() {
2372
2413
  return l.state.layout !== "masonry" || l.state.reelOrigin === "masonry" ? null : f.value?.getScrollElement?.() ?? null;
2373
2414
  }
2374
- function X(e, t) {
2375
- W = e, G = t === "keyboard", y.value = le(e), d("openReel", e), m(() => h.value?.focus());
2415
+ function oe(e, t) {
2416
+ U = e, W = t === "keyboard", d("openReel", e), m(() => h.value?.focus());
2376
2417
  }
2377
- function oe(e) {
2418
+ function se(e) {
2378
2419
  let t = g.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [];
2379
2420
  return Array.from(t).find((t) => t.dataset.postId === String(e)) ?? null;
2380
2421
  }
2381
- function se(e, t) {
2382
- if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || K()) return 0;
2383
- let n = [...new Set(e)], r = n.filter(oe);
2422
+ function J(e, t) {
2423
+ if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || ee()) return 0;
2424
+ let n = [...new Set(e)], r = n.filter(se);
2384
2425
  if (r.length === 0) return 0;
2385
- let i = new Map(D.value), a = t?.staggerMs ?? Kt;
2426
+ let i = new Map(C.value), a = t?.staggerMs ?? Zt;
2386
2427
  return r.forEach((e, t) => {
2387
2428
  i.set(e, t * a);
2388
- }), S.value = new Set([...S.value].filter((e) => !r.includes(e))), T.value = new Set([...T.value, ...n]), D.value = i, qt + (r.length - 1) * a;
2429
+ }), y.value = new Set([...y.value].filter((e) => !r.includes(e))), S.value = new Set([...S.value, ...n]), C.value = i, Qt + (r.length - 1) * a;
2389
2430
  }
2390
2431
  function ce(e, t) {
2391
- let n = oe(e), r = n?.querySelector(".media-card-activator") ?? n;
2432
+ let n = se(e), r = n?.querySelector(".media-card-activator") ?? n;
2392
2433
  r && (r.classList.toggle("media-card-focus-silent", !t), t || r.addEventListener("blur", () => {
2393
2434
  r.classList.remove("media-card-focus-silent");
2394
2435
  }, { once: !0 }), r?.focus({ preventScroll: !0 }));
2395
2436
  }
2396
- function le(e) {
2397
- let t = g.value, n = oe(e);
2398
- if (t === null || n === null) return {};
2399
- let r = t.getBoundingClientRect(), i = n.getBoundingClientRect();
2400
- return {
2401
- "--vibe-reel-origin-top": `${Math.max(0, i.top - r.top)}px`,
2402
- "--vibe-reel-origin-right": `${Math.max(0, r.right - i.right)}px`,
2403
- "--vibe-reel-origin-bottom": `${Math.max(0, r.bottom - i.bottom)}px`,
2404
- "--vibe-reel-origin-left": `${Math.max(0, i.left - r.left)}px`
2405
- };
2406
- }
2407
- function Z() {
2408
- l.state.reelOrigin === "masonry" && (W ??= l.state.activeReelPostId, x.value = !0, d("closeReel"));
2437
+ function le() {
2438
+ l.state.reelOrigin === "masonry" && (U ??= l.state.activeReelPostId, _.value = !0, d("closeReel"));
2409
2439
  }
2410
2440
  function ue() {
2411
- let e = W, t = G;
2412
- x.value = !1, W = null, G = !1, y.value = {}, m(() => {
2441
+ let e = U, t = W;
2442
+ _.value = !1, U = null, W = !1, m(() => {
2413
2443
  e !== null && ce(e, t);
2414
2444
  });
2415
2445
  }
2416
- return Gt({
2417
- closeMasonryReel: Z,
2446
+ return Xt({
2447
+ closeMasonryReel: le,
2418
2448
  element: () => g.value,
2419
- isReelLeaving: () => x.value,
2449
+ isReelLeaving: () => _.value,
2420
2450
  reelRenderer: () => p.value,
2421
2451
  setReelInfoSheet: (e) => d("reelInfoSheetChange", e),
2422
2452
  state: l.state
2423
2453
  }), O(() => l.state.items.map((e) => e.postId), (e) => {
2424
- let t = e.filter((e) => !H.has(e)), n = new Set(e);
2425
- 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 || K()) return;
2454
+ let t = e.filter((e) => !V.has(e)), n = new Set(e);
2455
+ if (V = new Set(e), S.value = new Set([...S.value].filter((e) => n.has(e))), C.value = new Map([...C.value].filter(([e]) => n.has(e))), t.length === 0 || ee()) return;
2426
2456
  let r = /* @__PURE__ */ new Map();
2427
2457
  e.forEach((e) => {
2428
- let t = C.value.get(e);
2458
+ let t = x.value.get(e);
2429
2459
  t !== void 0 && r.set(e, t);
2430
2460
  }), t.forEach((e, t) => {
2431
- r.set(e, t * Kt);
2432
- }), C.value = r, S.value = new Set([...S.value, ...t]), q();
2461
+ r.set(e, t * Zt);
2462
+ }), x.value = r, y.value = new Set([...y.value, ...t]), te();
2433
2463
  }, { flush: "sync" }), v(() => {
2434
- U !== null && cancelAnimationFrame(U);
2464
+ H !== null && cancelAnimationFrame(H);
2435
2465
  }), i({
2436
- changeActiveReelMedia: ne,
2466
+ changeActiveReelMedia: re,
2437
2467
  getAutoScrollElement: ae,
2438
- loadIfNearBottom: Y,
2439
- moveActiveReelPost: re,
2468
+ loadIfNearBottom: K,
2469
+ moveActiveReelPost: q,
2440
2470
  navigateToReelItem: ie,
2441
- startItemRemoval: se,
2471
+ startItemRemoval: J,
2442
2472
  transitionActiveReelMedia: (e) => p.value?.transitionActiveMedia?.(e) ?? Promise.resolve(!1),
2443
2473
  transitionActiveReelPost: (e) => p.value?.transitionActivePost?.(e) ?? Promise.resolve(!1)
2444
2474
  }), (r, i) => (b(), s("div", {
2445
2475
  ref_key: "surfaceElement",
2446
2476
  ref: g,
2447
2477
  class: "vibe-surface"
2448
- }, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(Rt, {
2478
+ }, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(Ut, {
2449
2479
  key: 0,
2450
2480
  ref_key: "reelRenderer",
2451
2481
  ref: p,
@@ -2470,27 +2500,27 @@ var Kt = 35, qt = 420, Jt = /* @__PURE__ */ d({
2470
2500
  "info-sheet-overlay": t.state.reelInfoSheetOverlay,
2471
2501
  "next-page-error": !!t.state.nextPageError,
2472
2502
  origin: "reel",
2473
- "preview-states": E(ee),
2503
+ "preview-states": E(B),
2474
2504
  "reel-auto-advance": t.state.reelAutoAdvance,
2475
2505
  "reel-audio-state": t.reelAudioState,
2476
2506
  "reel-forward": t.state.reelForward,
2477
- state: j.value,
2507
+ state: D.value,
2478
2508
  total: t.state.total,
2479
2509
  onActiveChange: i[0] ||= (e) => d("activeReelChange", e),
2480
2510
  onCloseInfoSheet: i[1] ||= (e) => d("reelInfoSheetChange", !1),
2481
- onError: E(L),
2511
+ onError: E(N),
2482
2512
  onLoadMore: i[2] ||= (e) => d("loadMore"),
2483
- onMediaChange: J,
2484
- onReady: E(R),
2513
+ onMediaChange: G,
2514
+ onReady: E(I),
2485
2515
  onRetryEnd: i[3] ||= (e) => d("retryEnd"),
2486
2516
  onRetryForward: i[4] ||= (e) => d("retryForward"),
2487
2517
  onReelAudioChange: i[5] ||= (e) => d("reelAudioChange", e)
2488
- }, null, 8, /* @__PURE__ */ "can-retry-end.has-next.card-footer.card-header.feed-footer.feed-footer-actions.forward-index.forward-item.media-card.infinite-scroll.is-loading-more.items.load-more-locked.media-source.media-indices.initial-post-id.info-sheet.info-sheet-enabled.info-sheet-overlay.next-page-error.preview-states.reel-auto-advance.reel-audio-state.reel-forward.state.total.onError.onReady".split("."))) : t.state.error || t.state.isLoading || t.state.items.length === 0 && t.state.reelForward.status === "idle" ? (b(), a(te, {
2518
+ }, null, 8, /* @__PURE__ */ "can-retry-end.has-next.card-footer.card-header.feed-footer.feed-footer-actions.forward-index.forward-item.media-card.infinite-scroll.is-loading-more.items.load-more-locked.media-source.media-indices.initial-post-id.info-sheet.info-sheet-enabled.info-sheet-overlay.next-page-error.preview-states.reel-auto-advance.reel-audio-state.reel-forward.state.total.onError.onReady".split("."))) : t.state.error || t.state.isLoading || t.state.items.length === 0 && t.state.reelForward.status === "idle" ? (b(), a(ne, {
2489
2519
  key: 1,
2490
2520
  actions: t.feedFooterActions,
2491
2521
  "can-retry-end": t.canRetryEnd,
2492
2522
  "feed-footer": t.feedFooter,
2493
- state: j.value,
2523
+ state: D.value,
2494
2524
  onLoadMore: i[6] ||= (e) => d("loadMore"),
2495
2525
  onRetryEnd: i[7] ||= (e) => d("retryEnd")
2496
2526
  }, null, 8, [
@@ -2498,14 +2528,14 @@ var Kt = 35, qt = 420, Jt = /* @__PURE__ */ d({
2498
2528
  "can-retry-end",
2499
2529
  "feed-footer",
2500
2530
  "state"
2501
- ])) : (b(), s(e, { key: 2 }, [u(Ct, {
2531
+ ])) : (b(), s(e, { key: 2 }, [u(Ot, {
2502
2532
  ref_key: "masonryRenderer",
2503
2533
  ref: f,
2504
2534
  "can-retry-end": t.canRetryEnd,
2505
- "entering-post-ids": S.value,
2506
- "entry-delays": C.value,
2507
- "leaving-post-ids": T.value,
2508
- "removal-delays": D.value,
2535
+ "entering-post-ids": y.value,
2536
+ "entry-delays": x.value,
2537
+ "leaving-post-ids": S.value,
2538
+ "removal-delays": C.value,
2509
2539
  "card-footer": t.cardFooter,
2510
2540
  "card-header": t.cardHeader,
2511
2541
  "feed-footer": t.feedFooter,
@@ -2519,17 +2549,17 @@ var Kt = 35, qt = 420, Jt = /* @__PURE__ */ d({
2519
2549
  "load-more-locked": t.state.loadMoreLocked,
2520
2550
  "media-indices": t.state.mediaIndices,
2521
2551
  "next-page-error": !!t.state.nextPageError,
2522
- "preview-states": E(V),
2523
- suspended: t.state.reelOrigin === "masonry" || x.value,
2524
- state: j.value,
2552
+ "preview-states": E(R),
2553
+ suspended: t.state.reelOrigin === "masonry" || _.value,
2554
+ state: D.value,
2525
2555
  total: t.state.total,
2526
- onActivate: X,
2527
- onError: E(N),
2556
+ onActivate: oe,
2557
+ onError: E(j),
2528
2558
  onLoadMore: i[8] ||= (e) => d("loadMore"),
2529
- onMediaChange: J,
2530
- onReady: E(I),
2559
+ onMediaChange: G,
2560
+ onReady: E(M),
2531
2561
  onRetryEnd: i[9] ||= (e) => d("retryEnd"),
2532
- onVisible: E(M)
2562
+ onVisible: E(A)
2533
2563
  }, null, 8, [
2534
2564
  "can-retry-end",
2535
2565
  "entering-post-ids",
@@ -2568,9 +2598,8 @@ var Kt = 35, qt = 420, Jt = /* @__PURE__ */ d({
2568
2598
  role: "dialog",
2569
2599
  "aria-label": "Media viewer",
2570
2600
  "aria-modal": "true",
2571
- tabindex: "-1",
2572
- style: _(y.value)
2573
- }, [u(Rt, {
2601
+ tabindex: "-1"
2602
+ }, [u(Ut, {
2574
2603
  ref_key: "reelRenderer",
2575
2604
  ref: p,
2576
2605
  "can-retry-end": t.canRetryEnd,
@@ -2594,55 +2623,55 @@ var Kt = 35, qt = 420, Jt = /* @__PURE__ */ d({
2594
2623
  "media-source": "original",
2595
2624
  "next-page-error": !!t.state.nextPageError,
2596
2625
  origin: "masonry",
2597
- "preview-states": E(B),
2626
+ "preview-states": E(L),
2598
2627
  "reel-auto-advance": t.state.reelAutoAdvance,
2599
2628
  "reel-audio-state": t.reelAudioState,
2600
2629
  "reel-forward": t.state.reelForward,
2601
- state: j.value,
2630
+ state: D.value,
2602
2631
  total: t.state.total,
2603
2632
  onActiveChange: i[10] ||= (e) => d("activeReelChange", e),
2604
2633
  onCloseInfoSheet: i[11] ||= (e) => d("reelInfoSheetChange", !1),
2605
- onError: E(L),
2634
+ onError: E(N),
2606
2635
  onLoadMore: i[12] ||= (e) => d("loadMore"),
2607
- onMediaChange: J,
2608
- onReady: E(R),
2636
+ onMediaChange: G,
2637
+ onReady: E(I),
2609
2638
  onRetryEnd: i[13] ||= (e) => d("retryEnd"),
2610
2639
  onRetryForward: i[14] ||= (e) => d("retryForward"),
2611
2640
  onReelAudioChange: i[15] ||= (e) => d("reelAudioChange", e)
2612
- }, null, 8, /* @__PURE__ */ "can-retry-end.card-footer.card-header.feed-footer.feed-footer-actions.forward-index.forward-item.media-card.has-next.infinite-scroll.initial-post-id.info-sheet.info-sheet-enabled.info-sheet-overlay.is-loading-more.items.load-more-locked.media-indices.next-page-error.preview-states.reel-auto-advance.reel-audio-state.reel-forward.state.total.onError.onReady".split("."))], 4)) : o("", !0)]),
2641
+ }, null, 8, /* @__PURE__ */ "can-retry-end.card-footer.card-header.feed-footer.feed-footer-actions.forward-index.forward-item.media-card.has-next.infinite-scroll.initial-post-id.info-sheet.info-sheet-enabled.info-sheet-overlay.is-loading-more.items.load-more-locked.media-indices.next-page-error.preview-states.reel-auto-advance.reel-audio-state.reel-forward.state.total.onError.onReady".split("."))], 512)) : o("", !0)]),
2613
2642
  _: 1
2614
2643
  })], 64))], 512));
2615
2644
  }
2616
2645
  });
2617
2646
  //#endregion
2618
2647
  //#region src/core/page.ts
2619
- function Yt(e) {
2648
+ function en(e) {
2620
2649
  if (!e || typeof e != "object" || !Array.isArray(e.items)) throw TypeError("Vibe loadPage must resolve to a page with an items array.");
2621
2650
  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.");
2622
2651
  if (e.next !== null && typeof e.next != "string" && typeof e.next != "number") throw TypeError("Vibe page next must be a string, number, or null.");
2623
2652
  if (e.total !== void 0 && (!Number.isFinite(e.total) || e.total < 0)) throw TypeError("Vibe page total must be a non-negative number when provided.");
2624
2653
  return e;
2625
2654
  }
2626
- function $(e, t) {
2655
+ function Z(e, t) {
2627
2656
  let n = new Set(e.map((e) => e.postId));
2628
2657
  return [...e, ...t.filter((e) => n.has(e.postId) ? !1 : (n.add(e.postId), !0))];
2629
2658
  }
2630
- function Xt(e) {
2659
+ function tn(e) {
2631
2660
  return `${typeof e}:${String(e)}`;
2632
2661
  }
2633
- function Zt(e) {
2634
- return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview.src}` : `id:${Xt(e.mediaId)}`;
2662
+ function nn(e) {
2663
+ return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview.src}` : `id:${tn(e.mediaId)}`;
2635
2664
  }
2636
- function Qt(e, t) {
2637
- let n = [...e], r = new Map(e.map((e, t) => [Xt(e.postId), t]));
2665
+ function rn(e, t) {
2666
+ let n = [...e], r = new Map(e.map((e, t) => [tn(e.postId), t]));
2638
2667
  return t.forEach((e) => {
2639
- let t = Xt(e.postId), i = r.get(t);
2668
+ let t = tn(e.postId), i = r.get(t);
2640
2669
  if (i === void 0) {
2641
2670
  r.set(t, n.length), n.push(e);
2642
2671
  return;
2643
2672
  }
2644
- let a = n[i], o = new Set([a, ...a.items].map(Zt)), s = [e, ...e.items].filter((e) => {
2645
- let t = Zt(e);
2673
+ let a = n[i], o = new Set([a, ...a.items].map(nn)), s = [e, ...e.items].filter((e) => {
2674
+ let t = nn(e);
2646
2675
  return o.has(t) ? !1 : (o.add(t), !0);
2647
2676
  });
2648
2677
  s.length > 0 && (n[i] = {
@@ -2651,14 +2680,14 @@ function Qt(e, t) {
2651
2680
  });
2652
2681
  }), n;
2653
2682
  }
2654
- function $t(e) {
2683
+ function an(e) {
2655
2684
  return Object.prototype.hasOwnProperty.call(e, "current") ? e.current ?? null : e.next;
2656
2685
  }
2657
2686
  //#endregion
2658
2687
  //#region src/core/appendPage.ts
2659
- function en(e, t, n, r) {
2660
- let i = Yt(e), a = n.filterItems(i.items), o = $t(i);
2661
- t.items = Qt(t.items, a), t.next = i.next, i.total !== void 0 && (t.total = i.total), r(o), n.recordPages([{
2688
+ function on(e, t, n, r) {
2689
+ let i = en(e), a = n.filterItems(i.items), o = an(i);
2690
+ t.items = rn(t.items, a), t.next = i.next, i.total !== void 0 && (t.total = i.total), r(o), n.recordPages([{
2662
2691
  contributionIds: a.map(({ postId: e }) => e),
2663
2692
  cursor: o,
2664
2693
  next: i.next,
@@ -2667,32 +2696,32 @@ function en(e, t, n, r) {
2667
2696
  }
2668
2697
  //#endregion
2669
2698
  //#region src/core/requestDelay.ts
2670
- var tn = 2e3, nn = 1e4, rn = 250, an = {
2699
+ var sn = 2e3, cn = 1e4, ln = 250, un = {
2671
2700
  delayRemainingMs: null,
2672
2701
  nextRequestAt: null
2673
2702
  };
2674
- function on(e, t) {
2703
+ function dn(e, t) {
2675
2704
  return e === void 0 ? t : Math.floor(e);
2676
2705
  }
2677
- function sn(e, t) {
2706
+ function fn(e, t) {
2678
2707
  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.`);
2679
2708
  }
2680
- function cn(e, t = {}) {
2681
- let n = on(t.delayStepMs, tn), r = on(t.delayMaxMs, nn);
2709
+ function pn(e, t = {}) {
2710
+ let n = dn(t.delayStepMs, sn), r = dn(t.delayMaxMs, cn);
2682
2711
  return Math.min(Math.max(0, e) * n, r);
2683
2712
  }
2684
- function ln(e) {
2685
- if (e == null || !Number.isFinite(e)) return { ...an };
2713
+ function Q(e) {
2714
+ if (e == null || !Number.isFinite(e)) return { ...un };
2686
2715
  let t = Math.max(0, Math.floor(e - Date.now()));
2687
2716
  return t > 0 ? {
2688
2717
  delayRemainingMs: t,
2689
2718
  nextRequestAt: e
2690
- } : { ...an };
2719
+ } : { ...un };
2691
2720
  }
2692
- async function un({ delayMs: e, onChange: t, signal: n }) {
2721
+ async function mn({ delayMs: e, onChange: t, signal: n }) {
2693
2722
  if (n.aborted) throw new DOMException("Aborted", "AbortError");
2694
2723
  if (e <= 0) {
2695
- t({ ...an });
2724
+ t({ ...un });
2696
2725
  return;
2697
2726
  }
2698
2727
  let r = Date.now() + e;
@@ -2700,9 +2729,9 @@ async function un({ delayMs: e, onChange: t, signal: n }) {
2700
2729
  delayRemainingMs: e,
2701
2730
  nextRequestAt: r
2702
2731
  }), await new Promise((i, a) => {
2703
- let o = !1, s = setInterval(f, rn), c = setTimeout(() => u(), e);
2732
+ let o = !1, s = setInterval(f, ln), c = setTimeout(() => u(), e);
2704
2733
  function l() {
2705
- clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...an });
2734
+ clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...un });
2706
2735
  }
2707
2736
  function u(e) {
2708
2737
  o || (o = !0, l(), e ? a(e) : i());
@@ -2711,42 +2740,42 @@ async function un({ delayMs: e, onChange: t, signal: n }) {
2711
2740
  u(new DOMException("Aborted", "AbortError"));
2712
2741
  }
2713
2742
  function f() {
2714
- let e = ln(r);
2743
+ let e = Q(r);
2715
2744
  t(e), e.delayRemainingMs === null && u();
2716
2745
  }
2717
2746
  n.addEventListener("abort", d, { once: !0 });
2718
2747
  });
2719
2748
  }
2720
- var dn = class {
2749
+ var hn = class {
2721
2750
  interval = null;
2722
2751
  constructor(e) {
2723
2752
  this.onChange = e;
2724
2753
  }
2725
2754
  clear() {
2726
- this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...an });
2755
+ this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...un });
2727
2756
  }
2728
2757
  sync(e) {
2729
2758
  this.clear();
2730
- let t = ln(e);
2759
+ let t = Q(e);
2731
2760
  this.onChange(t), t.delayRemainingMs !== null && (this.interval = setInterval(() => {
2732
- let t = ln(e);
2761
+ let t = Q(e);
2733
2762
  this.onChange(t), t.delayRemainingMs === null && this.clear();
2734
- }, rn));
2763
+ }, ln));
2735
2764
  }
2736
2765
  };
2737
- function fn(e, t = !0) {
2766
+ function gn(e, t = !0) {
2738
2767
  return e.maxAdditionalPages === "unlimited" ? Infinity : (e.maxAdditionalPages ?? 10) + (t ? 1 : 0);
2739
2768
  }
2740
- function pn(e) {
2769
+ function _n(e) {
2741
2770
  return `${typeof e}:${String(e)}`;
2742
2771
  }
2743
- function mn(e, t) {
2772
+ function vn(e, t) {
2744
2773
  if (!Number.isInteger(e) || e <= 0) throw TypeError(`Vibe ${t} must be a positive integer.`);
2745
2774
  }
2746
- function hn(e) {
2775
+ function yn(e) {
2747
2776
  if (!e) return;
2748
- if (mn(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
2749
- sn(e, "frontend autofill");
2777
+ if (vn(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
2778
+ fn(e, "frontend autofill");
2750
2779
  let t = e.maxAdditionalPages;
2751
2780
  if (t !== void 0 && t !== "unlimited" && (!Number.isInteger(t) || t < 0)) throw TypeError("Vibe autofill maxAdditionalPages must be a non-negative integer or \"unlimited\".");
2752
2781
  return;
@@ -2758,7 +2787,7 @@ function hn(e) {
2758
2787
  if (t.pageSize !== e.pageSize) throw TypeError("Vibe backend autofill initialSession pageSize must match autofill pageSize.");
2759
2788
  }
2760
2789
  }
2761
- function gn(e, t, n = !0) {
2790
+ function bn(e, t, n = !0) {
2762
2791
  if (!e) return {
2763
2792
  cycleId: null,
2764
2793
  delayRemainingMs: null,
@@ -2775,7 +2804,7 @@ function gn(e, t, n = !0) {
2775
2804
  status: "idle",
2776
2805
  strategy: null
2777
2806
  };
2778
- let r = e.strategy === "backend" ? t ?? (n ? e.initialSession : void 0) : void 0, i = r?.received ?? 0, a = ln(r?.nextRequestAt);
2807
+ let r = e.strategy === "backend" ? t ?? (n ? e.initialSession : void 0) : void 0, i = r?.received ?? 0, a = Q(r?.nextRequestAt);
2779
2808
  return {
2780
2809
  cycleId: r?.cycleId ?? null,
2781
2810
  ...a,
@@ -2792,7 +2821,7 @@ function gn(e, t, n = !0) {
2792
2821
  strategy: e.strategy
2793
2822
  };
2794
2823
  }
2795
- function _n(e) {
2824
+ function xn(e) {
2796
2825
  return [
2797
2826
  "cancelling",
2798
2827
  "filling",
@@ -2800,9 +2829,9 @@ function _n(e) {
2800
2829
  "waiting"
2801
2830
  ].includes(e.status);
2802
2831
  }
2803
- async function vn(e, t, n) {
2832
+ async function Sn(e, t, n) {
2804
2833
  let r = t.autofill;
2805
- if (!_n(r) || !r.cycleId) return;
2834
+ if (!xn(r) || !r.cycleId) return;
2806
2835
  let i = {
2807
2836
  cycleId: r.cycleId,
2808
2837
  feedKey: r.feedKey ?? "",
@@ -2815,16 +2844,16 @@ async function vn(e, t, n) {
2815
2844
  throw r.error = e, r.status = "error", e;
2816
2845
  }
2817
2846
  }
2818
- function yn(e, t, n) {
2847
+ function Cn(e, t, n) {
2819
2848
  return e?.strategy === "backend" && t.feedKey === e.feedKey && t.sessionId === n.sessionId;
2820
2849
  }
2821
- async function bn({ 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 }) {
2822
- let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ?? fn(s), g = t, _ = t, v = t, y = 0, b = [], x;
2850
+ async function wn({ 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 }) {
2851
+ let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ?? gn(s), g = t, _ = t, v = t, y = 0, b = [], x;
2823
2852
  for (; y < h;) {
2824
- let e = pn(g);
2853
+ let e = _n(g);
2825
2854
  if (m.has(e)) throw Error("Vibe autofill received a repeated cursor.");
2826
- if (m.add(e), await un({
2827
- delayMs: cn(l + y, s),
2855
+ if (m.add(e), await mn({
2856
+ delayMs: pn(l + y, s),
2828
2857
  onChange: a,
2829
2858
  signal: d
2830
2859
  }), y > 0 && u()) return {
@@ -2838,12 +2867,12 @@ async function bn({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
2838
2867
  status: "paused",
2839
2868
  total: x
2840
2869
  };
2841
- let t = Yt(await n({
2870
+ let t = en(await n({
2842
2871
  cursor: g,
2843
2872
  signal: d
2844
2873
  }));
2845
2874
  y += 1, _ = g;
2846
- let r = $(p, t.items).slice(p.length);
2875
+ let r = Z(p, t.items).slice(p.length);
2847
2876
  b.push({
2848
2877
  contributionIds: r.map(({ postId: e }) => e),
2849
2878
  cursor: g,
@@ -2895,12 +2924,12 @@ async function bn({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
2895
2924
  }
2896
2925
  //#endregion
2897
2926
  //#region src/core/autofillController.ts
2898
- var xn = class {
2927
+ var Tn = class {
2899
2928
  collection = null;
2900
2929
  cycle = 0;
2901
2930
  delayCountdown;
2902
2931
  constructor(e) {
2903
- this.context = e, this.delayCountdown = new dn((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
2932
+ this.context = e, this.delayCountdown = new hn((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
2904
2933
  }
2905
2934
  beginCycle() {
2906
2935
  let { options: e, state: t } = this.context;
@@ -2908,14 +2937,14 @@ var xn = class {
2908
2937
  this.clear();
2909
2938
  let n = `vibe-autofill-${Date.now().toString(36)}-${++this.cycle}`;
2910
2939
  return t.autofill = {
2911
- ...gn(e, void 0, !1),
2940
+ ...bn(e, void 0, !1),
2912
2941
  cycleId: n,
2913
2942
  status: "filling"
2914
2943
  }, n;
2915
2944
  }
2916
2945
  async cancel() {
2917
2946
  let { cancelRequest: e, options: t, state: n } = this.context;
2918
- await vn(t, n, e), this.commitCollection();
2947
+ await Sn(t, n, e), this.commitCollection();
2919
2948
  }
2920
2949
  captureCollection(e, t) {
2921
2950
  t && (this.collection = e);
@@ -2937,36 +2966,36 @@ var xn = class {
2937
2966
  let { onLastCursor: e, options: t, state: n } = this.context;
2938
2967
  if (t?.strategy !== "frontend") return !1;
2939
2968
  let r = this.collection;
2940
- return this.collection = null, r ? (n.items = $(n.items, r.items), e(r.lastCursor), this.context.onPages(r.pages), n.next = r.next, r.total !== void 0 && (n.total = r.total), Object.assign(n.autofill, {
2969
+ return this.collection = null, r ? (n.items = Z(n.items, r.items), e(r.lastCursor), this.context.onPages(r.pages), n.next = r.next, r.total !== void 0 && (n.total = r.total), Object.assign(n.autofill, {
2941
2970
  missing: r.missing,
2942
2971
  received: r.received,
2943
2972
  requests: r.requests
2944
2973
  }), !0) : !1;
2945
2974
  }
2946
- }, Sn = 100;
2947
- function Cn(e, t) {
2975
+ }, En = 100;
2976
+ function Dn(e, t) {
2948
2977
  if (!Number.isFinite(t) || t <= 0) throw TypeError(`Vibe ${e} must be a positive number.`);
2949
2978
  }
2950
- function wn(e, t, n) {
2979
+ function On(e, t, n) {
2951
2980
  return Math.min(n, Math.max(t, e));
2952
2981
  }
2953
- function Tn(e) {
2982
+ function kn(e) {
2954
2983
  if (!e) return;
2955
2984
  let t = e.minSpeedPxPerSecond ?? 20, n = e.maxSpeedPxPerSecond ?? 240;
2956
- if (Cn("autoScroll.minSpeedPxPerSecond", t), Cn("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
2957
- e.speedPxPerSecond !== void 0 && Cn("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
2985
+ if (Dn("autoScroll.minSpeedPxPerSecond", t), Dn("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
2986
+ e.speedPxPerSecond !== void 0 && Dn("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
2958
2987
  }
2959
- function En(e) {
2988
+ function An(e) {
2960
2989
  let t = e?.minSpeedPxPerSecond ?? 20, n = e?.maxSpeedPxPerSecond ?? 240;
2961
2990
  return {
2962
2991
  enabled: e?.enabled ?? !1,
2963
2992
  maxSpeedPxPerSecond: n,
2964
2993
  minSpeedPxPerSecond: t,
2965
2994
  paused: !1,
2966
- speedPxPerSecond: wn(e?.speedPxPerSecond ?? 80, t, n)
2995
+ speedPxPerSecond: On(e?.speedPxPerSecond ?? 80, t, n)
2967
2996
  };
2968
2997
  }
2969
- var Dn = class {
2998
+ var jn = class {
2970
2999
  frame = null;
2971
3000
  lastTimestamp = null;
2972
3001
  mounted = !1;
@@ -2986,9 +3015,9 @@ var Dn = class {
2986
3015
  this.options.state.enabled && (this.options.state.paused = e, this.lastTimestamp = null, e ? this.cancelFrame() : this.schedule());
2987
3016
  }
2988
3017
  setSpeed(e) {
2989
- Cn("auto-scroll speed", e);
3018
+ Dn("auto-scroll speed", e);
2990
3019
  let t = this.options.state;
2991
- t.speedPxPerSecond = wn(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
3020
+ t.speedPxPerSecond = On(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
2992
3021
  }
2993
3022
  tick = (e) => {
2994
3023
  this.frame = null;
@@ -3000,7 +3029,7 @@ var Dn = class {
3000
3029
  return;
3001
3030
  }
3002
3031
  if (this.lastTimestamp !== null) {
3003
- let r = Math.min(Sn, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
3032
+ let r = Math.min(En, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
3004
3033
  n.scrollTop = Math.min(i, n.scrollTop + t.speedPxPerSecond * r / 1e3);
3005
3034
  }
3006
3035
  this.lastTimestamp = e, this.schedule();
@@ -3014,13 +3043,13 @@ var Dn = class {
3014
3043
  };
3015
3044
  //#endregion
3016
3045
  //#region src/core/backendAutofill.ts
3017
- async function On(e, t, n, r) {
3046
+ async function Mn(e, t, n, r) {
3018
3047
  let i = await e.onUnderfilled(n);
3019
3048
  if (!r()) return;
3020
3049
  if (!i.sessionId.trim()) throw TypeError("Vibe backend autofill requires a sessionId.");
3021
3050
  let a = Math.max(n.received, i.received ?? n.received);
3022
3051
  Object.assign(t.autofill, {
3023
- ...ln(i.nextRequestAt),
3052
+ ...Q(i.nextRequestAt),
3024
3053
  missing: Math.max(0, e.pageSize - a),
3025
3054
  received: a,
3026
3055
  sequence: i.sequence ?? 0,
@@ -3028,19 +3057,19 @@ async function On(e, t, n, r) {
3028
3057
  status: "waiting"
3029
3058
  });
3030
3059
  }
3031
- function kn(e, t) {
3032
- ["complete", "exhausted"].includes(t.status) && t.items && (e.items = $(e.items, t.items)), t.next !== void 0 && (e.next = t.next), t.total !== void 0 && (e.total = t.total);
3060
+ function Nn(e, t) {
3061
+ ["complete", "exhausted"].includes(t.status) && t.items && (e.items = Z(e.items, t.items)), t.next !== void 0 && (e.next = t.next), t.total !== void 0 && (e.total = t.total);
3033
3062
  }
3034
- function An(e, t, n) {
3063
+ function Pn(e, t, n) {
3035
3064
  let r = t.autofill;
3036
- return !yn(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (kn(t, n), Object.assign(r, ln(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);
3065
+ return !Cn(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (Nn(t, n), Object.assign(r, Q(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);
3037
3066
  }
3038
- function jn(e, t, n) {
3039
- return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = gn(e, n), kn(t, n), !0);
3067
+ function Fn(e, t, n) {
3068
+ return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = bn(e, n), Nn(t, n), !0);
3040
3069
  }
3041
3070
  //#endregion
3042
3071
  //#region src/core/backlogRestore.ts
3043
- async function Mn(e, t, n) {
3072
+ async function In(e, t, n) {
3044
3073
  if (!e) return;
3045
3074
  let r = new AbortController();
3046
3075
  n(r);
@@ -3055,7 +3084,7 @@ async function Mn(e, t, n) {
3055
3084
  }
3056
3085
  //#endregion
3057
3086
  //#region src/core/initialAutofill.ts
3058
- async function Nn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, onPages: i, options: a, signal: o, state: s }) {
3087
+ async function Ln({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, onPages: i, options: a, signal: o, state: s }) {
3059
3088
  let c = a.autofill;
3060
3089
  if (!c) return;
3061
3090
  let l = s.items.length;
@@ -3068,7 +3097,7 @@ async function Nn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
3068
3097
  return;
3069
3098
  }
3070
3099
  if (c.strategy === "backend") {
3071
- await On(c, s, {
3100
+ await Mn(c, s, {
3072
3101
  cycleId: e,
3073
3102
  feedKey: c.feedKey,
3074
3103
  items: [...s.items],
@@ -3085,11 +3114,11 @@ async function Nn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
3085
3114
  s.autofill.status = "exhausted";
3086
3115
  return;
3087
3116
  }
3088
- let u = await bn({
3117
+ let u = await wn({
3089
3118
  existingItems: s.items,
3090
3119
  initialCursor: s.next,
3091
3120
  loadPage: a.loadPage,
3092
- maximumRequests: fn(c, !1),
3121
+ maximumRequests: gn(c, !1),
3093
3122
  onCollection: n,
3094
3123
  onDelayChange: (e) => {
3095
3124
  t() && Object.assign(s.autofill, e);
@@ -3103,7 +3132,7 @@ async function Nn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
3103
3132
  shouldPause: () => s.loadMoreLocked,
3104
3133
  signal: o
3105
3134
  });
3106
- t() && (s.items = $(s.items, u.items), s.next = u.next, u.total !== void 0 && (s.total = u.total), r(u.lastCursor), i(u.pages), Object.assign(s.autofill, {
3135
+ t() && (s.items = Z(s.items, u.items), s.next = u.next, u.total !== void 0 && (s.total = u.total), r(u.lastCursor), i(u.pages), Object.assign(s.autofill, {
3107
3136
  missing: u.missing,
3108
3137
  received: u.received,
3109
3138
  requests: u.requests,
@@ -3112,13 +3141,13 @@ async function Nn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
3112
3141
  }
3113
3142
  //#endregion
3114
3143
  //#region src/core/fill.ts
3115
- function Pn(e) {
3144
+ function Rn(e) {
3116
3145
  return "items" in e ? { items: e.items } : "pages" in e ? { pages: e.pages } : { until: "end" };
3117
3146
  }
3118
- function Fn(e) {
3147
+ function zn(e) {
3119
3148
  return `${typeof e}:${String(e)}`;
3120
3149
  }
3121
- function In(e) {
3150
+ function Bn(e) {
3122
3151
  if (!e || typeof e != "object") throw TypeError("Vibe fill target must be an object.");
3123
3152
  if ("pages" in e) {
3124
3153
  if (!Number.isInteger(e.pages) || e.pages <= 0) throw TypeError("Vibe fill pages must be a positive integer.");
@@ -3131,21 +3160,21 @@ function In(e) {
3131
3160
  if ("until" in e && e.until === "end") return { until: "end" };
3132
3161
  throw TypeError("Vibe fill target must be { items }, { pages }, or { until: 'end' }.");
3133
3162
  }
3134
- function Ln(e) {
3163
+ function Vn(e) {
3135
3164
  if (!e) return;
3136
3165
  if (e.strategy === "frontend") {
3137
- sn(e, "frontend fill");
3166
+ fn(e, "frontend fill");
3138
3167
  return;
3139
3168
  }
3140
3169
  if (!e.feedKey.trim()) throw TypeError("Vibe backend fill requires a feedKey.");
3141
3170
  let t = e.initialSession;
3142
3171
  if (t) {
3143
3172
  if (t.feedKey !== e.feedKey) throw TypeError("Vibe backend fill initialSession feedKey must match fill feedKey.");
3144
- In(t.target);
3173
+ Bn(t.target);
3145
3174
  }
3146
3175
  }
3147
- function Rn(e, t, n = !0) {
3148
- let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a = ln(i?.nextRequestAt);
3176
+ function Hn(e, t, n = !0) {
3177
+ let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a = Q(i?.nextRequestAt);
3149
3178
  return {
3150
3179
  completedPages: i?.completedPages ?? 0,
3151
3180
  cycleId: i?.cycleId ?? null,
@@ -3158,10 +3187,10 @@ function Rn(e, t, n = !0) {
3158
3187
  sessionId: i?.sessionId ?? null,
3159
3188
  status: i?.status ?? "idle",
3160
3189
  strategy: e?.strategy ?? null,
3161
- target: i ? Pn(i.target) : null
3190
+ target: i ? Rn(i.target) : null
3162
3191
  };
3163
3192
  }
3164
- function zn(e) {
3193
+ function Un(e) {
3165
3194
  return [
3166
3195
  "cancelling",
3167
3196
  "filling",
@@ -3169,7 +3198,7 @@ function zn(e) {
3169
3198
  "waiting"
3170
3199
  ].includes(e.status);
3171
3200
  }
3172
- async function Bn({ existingItems: e, initialCursor: t, loadPage: n, onCollection: r = () => void 0, onDelayChange: i, onProgress: a, options: o, shouldPause: s = () => !1, signal: c, target: l }) {
3201
+ async function Wn({ existingItems: e, initialCursor: t, loadPage: n, onCollection: r = () => void 0, onDelayChange: i, onProgress: a, options: o, shouldPause: s = () => !1, signal: c, target: l }) {
3173
3202
  let u = [], d = [], f = [...e], p = /* @__PURE__ */ new Set(), m = 0, h = t, g = t, _ = t, v = 0, y;
3174
3203
  if ("items" in l && f.length >= l.items) return {
3175
3204
  completedPages: m,
@@ -3181,10 +3210,10 @@ async function Bn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
3181
3210
  status: "complete"
3182
3211
  };
3183
3212
  for (; _ !== null;) {
3184
- let e = Fn(h);
3213
+ let e = zn(h);
3185
3214
  if (p.has(e)) throw Error("Vibe fill received a repeated cursor.");
3186
- if (p.add(e), await un({
3187
- delayMs: cn(m, o),
3215
+ if (p.add(e), await mn({
3216
+ delayMs: pn(m, o),
3188
3217
  onChange: i,
3189
3218
  signal: c
3190
3219
  }), m > 0 && s()) return {
@@ -3197,12 +3226,12 @@ async function Bn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
3197
3226
  status: "paused",
3198
3227
  total: y
3199
3228
  };
3200
- let t = Yt(await n({
3229
+ let t = en(await n({
3201
3230
  cursor: h,
3202
3231
  signal: c
3203
3232
  }));
3204
3233
  m += 1, g = h;
3205
- let b = $(f, t.items).slice(f.length);
3234
+ let b = Z(f, t.items).slice(f.length);
3206
3235
  if (d.push({
3207
3236
  contributionIds: b.map(({ postId: e }) => e),
3208
3237
  cursor: h,
@@ -3265,12 +3294,12 @@ async function Bn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
3265
3294
  }
3266
3295
  //#endregion
3267
3296
  //#region src/core/backendFill.ts
3268
- async function Vn(e, t, n, r) {
3297
+ async function Gn(e, t, n, r) {
3269
3298
  let i = await e.onStart(n);
3270
3299
  if (r()) {
3271
3300
  if (!i.sessionId.trim()) throw TypeError("Vibe backend fill requires a sessionId.");
3272
3301
  Object.assign(t.fill, {
3273
- ...ln(i.nextRequestAt),
3302
+ ...Q(i.nextRequestAt),
3274
3303
  completedPages: i.completedPages ?? 0,
3275
3304
  received: i.received ?? 0,
3276
3305
  sequence: i.sequence ?? 0,
@@ -3279,23 +3308,23 @@ async function Vn(e, t, n, r) {
3279
3308
  });
3280
3309
  }
3281
3310
  }
3282
- function Hn(e, t, n) {
3311
+ function Kn(e, t, n) {
3283
3312
  return e?.strategy === "backend" && n.feedKey === e.feedKey && n.sessionId === t.fill.sessionId;
3284
3313
  }
3285
- function Un(e) {
3314
+ function qn(e) {
3286
3315
  return Number.isInteger(e.completedPages) && e.completedPages >= 0 && Number.isInteger(e.received) && e.received >= 0 && Number.isInteger(e.sequence) && e.sequence >= 0;
3287
3316
  }
3288
- function Wn(e, t) {
3317
+ function Jn(e, t) {
3289
3318
  if (!["complete", "exhausted"].includes(t.status)) return !0;
3290
3319
  let n = e.fill.target;
3291
3320
  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;
3292
3321
  }
3293
- function Gn(e, t, n) {
3294
- t.total !== void 0 && (e.total = t.total), ["complete", "exhausted"].includes(t.status) && (e.items = $(e.items, t.items ?? []), e.next = t.next ?? null, n(t.lastCursor ?? null));
3322
+ function Yn(e, t, n) {
3323
+ t.total !== void 0 && (e.total = t.total), ["complete", "exhausted"].includes(t.status) && (e.items = Z(e.items, t.items ?? []), e.next = t.next ?? null, n(t.lastCursor ?? null));
3295
3324
  }
3296
- function Kn(e, t, n, r) {
3297
- return !Hn(e, t, n) || !Un(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !Wn(t, n) ? !1 : (Gn(t, n, r), Object.assign(t.fill, {
3298
- ...ln(n.status === "waiting" ? n.nextRequestAt : null),
3325
+ function Xn(e, t, n, r) {
3326
+ return !Kn(e, t, n) || !qn(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !Jn(t, n) ? !1 : (Yn(t, n, r), Object.assign(t.fill, {
3327
+ ...Q(n.status === "waiting" ? n.nextRequestAt : null),
3299
3328
  completedPages: n.completedPages,
3300
3329
  error: n.error ?? null,
3301
3330
  received: n.received,
@@ -3303,45 +3332,45 @@ function Kn(e, t, n, r) {
3303
3332
  status: n.status
3304
3333
  }), !0);
3305
3334
  }
3306
- function qn(e, t, n, r) {
3335
+ function Zn(e, t, n, r) {
3307
3336
  if (e?.strategy !== "backend" || n.feedKey !== e.feedKey) return !1;
3308
3337
  let i = t.fill;
3309
- return t.fill = Rn(e, n), !Un(n) || !Wn(t, n) ? (t.fill = i, !1) : (Gn(t, n, r), !0);
3338
+ return t.fill = Hn(e, n), !qn(n) || !Jn(t, n) ? (t.fill = i, !1) : (Yn(t, n, r), !0);
3310
3339
  }
3311
3340
  //#endregion
3312
3341
  //#region src/core/fillController.ts
3313
- var Jn = class {
3342
+ var Qn = class {
3314
3343
  abortController = null;
3315
3344
  cycle = 0;
3316
3345
  delayCountdown;
3317
3346
  requestVersion = 0;
3318
3347
  collection = null;
3319
3348
  constructor(e) {
3320
- this.options = e, this.delayCountdown = new dn((e) => {
3349
+ this.options = e, this.delayCountdown = new hn((e) => {
3321
3350
  Object.assign(this.options.state.fill, e);
3322
3351
  }), this.syncBackendCountdown();
3323
3352
  }
3324
3353
  isActive() {
3325
- return zn(this.options.state.fill);
3354
+ return Un(this.options.state.fill);
3326
3355
  }
3327
3356
  applyUpdate(e) {
3328
- let t = Kn(this.options.fill, this.options.state, e, this.options.onLastCursor);
3357
+ let t = Xn(this.options.fill, this.options.state, e, this.options.onLastCursor);
3329
3358
  return t && this.syncBackendCountdown(), t;
3330
3359
  }
3331
3360
  restoreSession(e) {
3332
- let t = qn(this.options.fill, this.options.state, e, this.options.onLastCursor);
3361
+ let t = Zn(this.options.fill, this.options.state, e, this.options.onLastCursor);
3333
3362
  return t && this.syncBackendCountdown(), t;
3334
3363
  }
3335
3364
  async start(e, t = {}) {
3336
3365
  let n = this.options.fill;
3337
3366
  if (!n) throw Error("Vibe fill is not configured.");
3338
3367
  if (this.isActive()) throw Error("Vibe fill is already active.");
3339
- let r = In(e), i = In(t.target ?? r), a = t.progressOffset ?? {
3368
+ let r = Bn(e), i = Bn(t.target ?? r), a = t.progressOffset ?? {
3340
3369
  completedPages: 0,
3341
3370
  received: 0
3342
3371
  }, o = t.cycleId ?? `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
3343
3372
  if (this.options.state.fill = {
3344
- ...Rn(n, void 0, !1),
3373
+ ...Hn(n, void 0, !1),
3345
3374
  completedPages: a.completedPages,
3346
3375
  cycleId: o,
3347
3376
  received: a.received,
@@ -3354,7 +3383,7 @@ var Jn = class {
3354
3383
  let s = ++this.requestVersion, c = new AbortController();
3355
3384
  this.abortController = c;
3356
3385
  try {
3357
- n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await Vn(n, this.options.state, {
3386
+ n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await Gn(n, this.options.state, {
3358
3387
  cycleId: o,
3359
3388
  feedKey: n.feedKey,
3360
3389
  items: [...this.options.state.items],
@@ -3372,7 +3401,7 @@ var Jn = class {
3372
3401
  }
3373
3402
  async cancel() {
3374
3403
  let { fill: e, state: t } = this.options;
3375
- if (!zn(t.fill) || !t.fill.cycleId) return;
3404
+ if (!Un(t.fill) || !t.fill.cycleId) return;
3376
3405
  let n = {
3377
3406
  cycleId: t.fill.cycleId,
3378
3407
  feedKey: t.fill.feedKey ?? "",
@@ -3416,7 +3445,7 @@ var Jn = class {
3416
3445
  });
3417
3446
  }
3418
3447
  reset() {
3419
- this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = Rn(this.options.fill, void 0, !1), this.collection = null;
3448
+ this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = Hn(this.options.fill, void 0, !1), this.collection = null;
3420
3449
  }
3421
3450
  destroy() {
3422
3451
  this.abortLocalRequest(), this.delayCountdown.clear();
@@ -3451,7 +3480,7 @@ var Jn = class {
3451
3480
  s.fill.status = "until" in t ? "complete" : "exhausted";
3452
3481
  return;
3453
3482
  }
3454
- let c = await Bn({
3483
+ let c = await Wn({
3455
3484
  existingItems: s.items,
3456
3485
  initialCursor: s.next,
3457
3486
  loadPage: o,
@@ -3477,7 +3506,7 @@ var Jn = class {
3477
3506
  signal: n.signal,
3478
3507
  target: t
3479
3508
  });
3480
- this.isCurrent(r) && (s.items = $(s.items, c.items), s.next = c.next, c.total !== void 0 && (s.total = c.total), this.options.onLastCursor(c.lastCursor), Object.assign(s.fill, {
3509
+ this.isCurrent(r) && (s.items = Z(s.items, c.items), s.next = c.next, c.total !== void 0 && (s.total = c.total), this.options.onLastCursor(c.lastCursor), Object.assign(s.fill, {
3481
3510
  completedPages: a.completedPages + c.completedPages,
3482
3511
  received: a.received + c.received,
3483
3512
  status: c.status
@@ -3487,7 +3516,7 @@ var Jn = class {
3487
3516
  let e = this.collection;
3488
3517
  if (this.collection = null, !e || this.options.fill?.strategy !== "frontend") return;
3489
3518
  let t = this.options.state;
3490
- t.items = $(t.items, e.items), t.next = e.next, e.total !== void 0 && (t.total = e.total), this.options.onLastCursor(e.lastCursor), this.options.onPages(e.pages), Object.assign(t.fill, {
3519
+ t.items = Z(t.items, e.items), t.next = e.next, e.total !== void 0 && (t.total = e.total), this.options.onLastCursor(e.lastCursor), this.options.onPages(e.pages), Object.assign(t.fill, {
3491
3520
  completedPages: e.completedPages,
3492
3521
  received: e.received
3493
3522
  });
@@ -3499,7 +3528,7 @@ var Jn = class {
3499
3528
  };
3500
3529
  //#endregion
3501
3530
  //#region src/core/fillReconciliation.ts
3502
- async function Yn({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r, setLastCursor: i, signal: a, state: o }) {
3531
+ async function $n({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r, setLastCursor: i, signal: a, state: o }) {
3503
3532
  if (!e.needsReconciliation(o.items)) return "skipped";
3504
3533
  let s = await e.reconcile({
3505
3534
  existingItems: o.items,
@@ -3508,11 +3537,11 @@ async function Yn({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r,
3508
3537
  shouldPause: () => o.loadMoreLocked,
3509
3538
  signal: a
3510
3539
  });
3511
- return t() ? (o.items = $(o.items, s.items), o.next = s.next, i(s.lastCursor), s.total !== void 0 && (o.total = s.total), e.completeReconciliation(s), s.status) : s.status;
3540
+ return t() ? (o.items = Z(o.items, s.items), o.next = s.next, i(s.lastCursor), s.total !== void 0 && (o.total = s.total), e.completeReconciliation(s), s.status) : s.status;
3512
3541
  }
3513
3542
  //#endregion
3514
3543
  //#region src/core/feedFooter.ts
3515
- function Xn(e) {
3544
+ function er(e) {
3516
3545
  return {
3517
3546
  cancelAutofill: () => e.cancelAutofill(),
3518
3547
  loadMore: () => e.loadNext(),
@@ -3524,64 +3553,64 @@ function Xn(e) {
3524
3553
  retryFill: () => e.retryFill()
3525
3554
  };
3526
3555
  }
3527
- function Zn(e) {
3556
+ function tr(e) {
3528
3557
  if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
3529
3558
  }
3530
- function Qn(e) {
3531
- e?.intervalMs !== void 0 && Zn(e.intervalMs);
3559
+ function nr(e) {
3560
+ e?.intervalMs !== void 0 && tr(e.intervalMs);
3532
3561
  }
3533
- function $n(e) {
3562
+ function rr(e) {
3534
3563
  return {
3535
3564
  enabled: e?.enabled ?? !1,
3536
3565
  includePostItems: e?.includePostItems ?? !1,
3537
3566
  intervalMs: e?.intervalMs ?? 5e3
3538
3567
  };
3539
3568
  }
3540
- function er(e, t) {
3569
+ function ir(e, t) {
3541
3570
  if (typeof t == "boolean") {
3542
3571
  e.enabled = t;
3543
3572
  return;
3544
3573
  }
3545
- 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);
3574
+ nr(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);
3546
3575
  }
3547
3576
  //#endregion
3548
3577
  //#region src/core/reelInfoSheet.ts
3549
- function tr(e) {
3578
+ function ar(e) {
3550
3579
  return { enabled: e?.enabled ?? !1 };
3551
3580
  }
3552
- function nr(e, t, n) {
3581
+ function or(e, t, n) {
3553
3582
  if (n && !t) throw Error("Vibe cannot enable reelInfoSheet without a configured component.");
3554
3583
  e.enabled = n;
3555
3584
  }
3556
3585
  //#endregion
3557
3586
  //#region src/core/initialRuntimeState.ts
3558
- function rr(e, t) {
3587
+ function sr(e, t) {
3559
3588
  let n = e.initialPage;
3560
3589
  return {
3561
3590
  activeReelPostId: null,
3562
- autoScroll: En(e.autoScroll),
3563
- autofill: gn(e.autofill),
3591
+ autoScroll: An(e.autoScroll),
3592
+ autofill: bn(e.autofill),
3564
3593
  current: n?.current ?? null,
3565
3594
  error: null,
3566
- fill: Rn(e.fill),
3595
+ fill: Hn(e.fill),
3567
3596
  infiniteScroll: e.infiniteScroll ?? !0,
3568
3597
  isLoading: !n,
3569
3598
  isLoadingMore: !1,
3570
- items: n ? $([], n.items) : [],
3599
+ items: n ? Z([], n.items) : [],
3571
3600
  layout: t === "reel" ? "reel" : "masonry",
3572
3601
  loadMoreLocked: !1,
3573
3602
  mediaIndices: /* @__PURE__ */ new Map(),
3574
3603
  next: n?.next ?? null,
3575
3604
  nextPageError: null,
3576
3605
  phoneMode: !1,
3577
- reelAutoAdvance: $n(e.reelAutoAdvance),
3606
+ reelAutoAdvance: rr(e.reelAutoAdvance),
3578
3607
  reelForward: {
3579
3608
  error: null,
3580
3609
  status: "idle"
3581
3610
  },
3582
3611
  reelForwardIndex: null,
3583
3612
  reelForwardItem: null,
3584
- reelInfoSheet: tr(e.reelInfoSheet),
3613
+ reelInfoSheet: ar(e.reelInfoSheet),
3585
3614
  reelInfoSheetOverlay: !1,
3586
3615
  reelMediaSource: "original",
3587
3616
  reelOrigin: null,
@@ -3590,20 +3619,21 @@ function rr(e, t) {
3590
3619
  }
3591
3620
  //#endregion
3592
3621
  //#region src/core/options.ts
3593
- function ir(e, t) {
3622
+ function cr(e, t) {
3594
3623
  if (t) {
3595
3624
  if (!Number.isFinite(t.height) || t.height <= 0) throw TypeError(`Vibe ${e} height must be a positive number.`);
3596
3625
  if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe ${e} background must be "default" or "transparent".`);
3597
3626
  }
3598
3627
  }
3599
- function ar(e, t) {
3628
+ function lr(e, t) {
3600
3629
  if (t) {
3601
3630
  if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe mediaCard ${e} background must be "default" or "transparent".`);
3602
3631
  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.`);
3603
3632
  }
3604
3633
  }
3605
- function or(e) {
3606
- if (Tn(e.autoScroll), ir("cardHeader", e.cardHeader), ir("cardFooter", e.cardFooter), ar("header", e.mediaCard?.header), ar("footer", e.mediaCard?.footer), hn(e.autofill), Ln(e.fill), le(e.masonry), Qn(e.reelAutoAdvance), e.removalReconciliation) {
3634
+ function ur(e) {
3635
+ if (kn(e.autoScroll), cr("cardHeader", e.cardHeader), cr("cardFooter", e.cardFooter), lr("header", e.mediaCard?.header), lr("footer", e.mediaCard?.footer), e.mediaCard?.feedPreload !== void 0 && e.mediaCard.feedPreload !== "none" && e.mediaCard.feedPreload !== "replacement") throw TypeError("Vibe mediaCard feedPreload must be \"none\" or \"replacement\".");
3636
+ if (yn(e.autofill), Vn(e.fill), de(e.masonry), nr(e.reelAutoAdvance), e.removalReconciliation) {
3607
3637
  if (!Number.isInteger(e.removalReconciliation.pageSize) || e.removalReconciliation.pageSize <= 0) throw TypeError("Vibe removalReconciliation pageSize must be a positive integer.");
3608
3638
  let t = e.removalReconciliation.maxReplayPages ?? 5;
3609
3639
  if (!Number.isInteger(t) || t <= 0) throw TypeError("Vibe removalReconciliation maxReplayPages must be a positive integer.");
@@ -3618,7 +3648,7 @@ function or(e) {
3618
3648
  if (e.fill?.strategy === "frontend" && !e.loadPage) throw TypeError("Vibe frontend fill requires loadPage.");
3619
3649
  if (e.fill?.strategy === "backend" && e.fill.initialSession && !e.initialPage) throw TypeError("Vibe backend fill restoration requires initialPage.");
3620
3650
  }
3621
- function sr(e) {
3651
+ function dr(e) {
3622
3652
  if (typeof e != "string") return e;
3623
3653
  if (typeof document > "u") throw Error("Vibe cannot resolve a selector without a document.");
3624
3654
  let t = document.querySelector(e);
@@ -3627,7 +3657,7 @@ function sr(e) {
3627
3657
  }
3628
3658
  //#endregion
3629
3659
  //#region src/core/pageRequest.ts
3630
- async function cr({ append: e, autofillController: t, cursor: n, isCurrent: r, loadPage: i, onLastCursor: a, onPages: o, options: s, signal: c, state: l }) {
3660
+ async function fr({ append: e, autofillController: t, cursor: n, isCurrent: r, loadPage: i, onLastCursor: a, onPages: o, options: s, signal: c, state: l }) {
3631
3661
  let u = s.autofill, d = e && u?.strategy === "frontend" && (l.autofill.status === "paused" || l.autofill.status === "error"), f = d ? {
3632
3662
  received: l.autofill.received,
3633
3663
  requests: l.autofill.requests
@@ -3639,11 +3669,11 @@ async function cr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
3639
3669
  let m = !1;
3640
3670
  try {
3641
3671
  if (u?.strategy === "frontend") {
3642
- let s = await bn({
3672
+ let s = await wn({
3643
3673
  existingItems: e ? l.items : [],
3644
3674
  initialCursor: n,
3645
3675
  loadPage: i,
3646
- maximumRequests: f ? Math.max(0, fn(u) - f.requests) : void 0,
3676
+ maximumRequests: f ? Math.max(0, gn(u) - f.requests) : void 0,
3647
3677
  onCollection: (e) => t.captureCollection(e, r()),
3648
3678
  onDelayChange: (e) => {
3649
3679
  r() && Object.assign(l.autofill, e);
@@ -3658,7 +3688,7 @@ async function cr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
3658
3688
  signal: c
3659
3689
  });
3660
3690
  if (!r()) return;
3661
- l.items = e ? $(l.items, s.items) : [...s.items], a(s.lastCursor), l.next = s.next, s.total !== void 0 && (l.total = s.total), Object.assign(l.autofill, {
3691
+ l.items = e ? Z(l.items, s.items) : [...s.items], a(s.lastCursor), l.next = s.next, s.total !== void 0 && (l.total = s.total), Object.assign(l.autofill, {
3662
3692
  missing: s.missing,
3663
3693
  received: s.received,
3664
3694
  requests: s.requests,
@@ -3666,12 +3696,12 @@ async function cr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
3666
3696
  }), o(s.pages), t.clearCollection();
3667
3697
  return;
3668
3698
  }
3669
- let s = Yt(await i({
3699
+ let s = en(await i({
3670
3700
  cursor: n,
3671
3701
  signal: c
3672
3702
  }));
3673
3703
  if (!r()) return;
3674
- let d = e ? l.items : [], h = $(d, s.items), g = h.length - d.length;
3704
+ let d = e ? l.items : [], h = Z(d, s.items), g = h.length - d.length;
3675
3705
  if (l.items = h, a(n), o([{
3676
3706
  contributionIds: h.slice(d.length).map(({ postId: e }) => e),
3677
3707
  cursor: n,
@@ -3686,7 +3716,7 @@ async function cr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
3686
3716
  l.autofill.status = "complete";
3687
3717
  return;
3688
3718
  }
3689
- await On(u, l, {
3719
+ await Mn(u, l, {
3690
3720
  cycleId: p,
3691
3721
  feedKey: u.feedKey,
3692
3722
  items: h.slice(d.length),
@@ -3708,16 +3738,16 @@ async function cr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
3708
3738
  }
3709
3739
  //#endregion
3710
3740
  //#region src/core/removalReconciliationController.ts
3711
- function lr(e) {
3741
+ function $(e) {
3712
3742
  return `${typeof e}:${String(e)}`;
3713
3743
  }
3714
- function ur(e) {
3744
+ function pr(e) {
3715
3745
  return `${typeof e}:${String(e)}`;
3716
3746
  }
3717
- function dr(e) {
3747
+ function mr(e) {
3718
3748
  return e.map(({ postId: e }) => e);
3719
3749
  }
3720
- var fr = class {
3750
+ var hr = class {
3721
3751
  delay;
3722
3752
  enabled;
3723
3753
  maxReplayPages;
@@ -3736,7 +3766,7 @@ var fr = class {
3736
3766
  e.status === "complete" && (this.pages = [...this.pages.slice(0, e.replaceFrom), ...e.pages].slice(-this.maxReplayPages), this.pending = null);
3737
3767
  }
3738
3768
  filterItems(e) {
3739
- return this.tombstones.size === 0 ? [...e] : e.filter(({ postId: e }) => !this.tombstones.has(lr(e)));
3769
+ return this.tombstones.size === 0 ? [...e] : e.filter(({ postId: e }) => !this.tombstones.has($(e)));
3740
3770
  }
3741
3771
  needsReconciliation(e) {
3742
3772
  return this.pending !== null || this.findUnderfilledPage(e) >= 0;
@@ -3749,45 +3779,45 @@ var fr = class {
3749
3779
  }
3750
3780
  recordInitialPage(e) {
3751
3781
  e && this.recordPages([{
3752
- contributionIds: dr(e.items),
3753
- cursor: $t(e),
3782
+ contributionIds: mr(e.items),
3783
+ cursor: an(e),
3754
3784
  next: e.next,
3755
- returnedIds: dr(e.items)
3785
+ returnedIds: mr(e.items)
3756
3786
  }]);
3757
3787
  }
3758
3788
  remove(e) {
3759
- e.forEach((e) => this.tombstones.add(lr(e)));
3789
+ e.forEach((e) => this.tombstones.add($(e)));
3760
3790
  }
3761
3791
  reset() {
3762
3792
  this.pages = [], this.pending = null, this.tombstones.clear();
3763
3793
  }
3764
3794
  restore(e) {
3765
- e.forEach((e) => this.tombstones.delete(lr(e)));
3795
+ e.forEach((e) => this.tombstones.delete($(e)));
3766
3796
  }
3767
3797
  async reconcile({ existingItems: e, loadPage: t, onDelayChange: n = () => void 0, shouldPause: r = () => !1, signal: i }) {
3768
3798
  let a = this.pending ?? this.createSession(e);
3769
3799
  for (this.pending = a; a.remainingRequests > 0;) {
3770
- let e = ur(a.cursor);
3800
+ let e = pr(a.cursor);
3771
3801
  if (a.seenCursors.has(e)) throw Error("Vibe removal reconciliation received a repeated cursor.");
3772
- if (await un({
3773
- delayMs: cn(a.pages.length, this.delay),
3802
+ if (await mn({
3803
+ delayMs: pn(a.pages.length, this.delay),
3774
3804
  onChange: n,
3775
3805
  signal: i
3776
3806
  }), a.pages.length > 0 && r()) return this.result(a, "paused");
3777
- let o = Yt(await t({
3807
+ let o = en(await t({
3778
3808
  cursor: a.cursor,
3779
3809
  signal: i
3780
3810
  }));
3781
3811
  a.seenCursors.add(e);
3782
3812
  let s = this.filterItems(o.items), c = [];
3783
3813
  if (s.forEach((e) => {
3784
- let t = lr(e.postId);
3814
+ let t = $(e.postId);
3785
3815
  a.attributed.has(t) || (a.attributed.add(t), c.push(e.postId)), a.appended.has(t) || (a.appended.add(t), a.items.push(e));
3786
3816
  }), a.pages.push({
3787
3817
  contributionIds: c,
3788
3818
  cursor: a.cursor,
3789
3819
  next: o.next,
3790
- returnedIds: dr(s)
3820
+ returnedIds: mr(s)
3791
3821
  }), 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");
3792
3822
  }
3793
3823
  return this.result(a, "complete");
@@ -3795,9 +3825,9 @@ var fr = class {
3795
3825
  createSession(e) {
3796
3826
  let t = this.findUnderfilledPage(e), n = t < 0 ? [] : this.pages.slice(t), r = n[0];
3797
3827
  if (!r) throw Error("Vibe has no underfilled provider page to reconcile.");
3798
- let i = new Set(n.flatMap(({ contributionIds: e }) => e.map(lr))), a = new Set(e.map(({ postId: e }) => lr(e)).filter((e) => !i.has(e)));
3828
+ let i = new Set(n.flatMap(({ contributionIds: e }) => e.map($))), a = new Set(e.map(({ postId: e }) => $(e)).filter((e) => !i.has(e)));
3799
3829
  return {
3800
- appended: new Set(e.map(({ postId: e }) => lr(e))),
3830
+ appended: new Set(e.map(({ postId: e }) => $(e))),
3801
3831
  attributed: new Set(a),
3802
3832
  cursor: r.cursor,
3803
3833
  items: [],
@@ -3822,11 +3852,11 @@ var fr = class {
3822
3852
  }
3823
3853
  findUnderfilledPage(e) {
3824
3854
  if (!this.enabled || this.pages.length === 0) return -1;
3825
- let t = new Set(e.map(({ postId: e }) => lr(e)));
3826
- return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has(lr(e))).length < this.pageSize);
3855
+ let t = new Set(e.map(({ postId: e }) => $(e)));
3856
+ return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has($(e))).length < this.pageSize);
3827
3857
  }
3828
3858
  recordPage(e) {
3829
- let t = ur(e.cursor), n = this.pages.findIndex(({ cursor: e }) => ur(e) === t);
3859
+ let t = pr(e.cursor), n = this.pages.findIndex(({ cursor: e }) => pr(e) === t);
3830
3860
  n >= 0 && (this.pages = this.pages.slice(0, n)), this.pages.push({
3831
3861
  ...e,
3832
3862
  contributionIds: [...e.contributionIds],
@@ -3836,7 +3866,7 @@ var fr = class {
3836
3866
  };
3837
3867
  //#endregion
3838
3868
  //#region src/core/activeItemRemoval.ts
3839
- function pr(e, t, n, r, i) {
3869
+ function gr(e, t, n, r, i) {
3840
3870
  let a = new Set(t.map(({ item: e }) => e.postId));
3841
3871
  if (e.activeReelPostId === null || !a.has(e.activeReelPostId)) return;
3842
3872
  let o = e.items[Math.max(n, 0)];
@@ -3849,7 +3879,7 @@ function pr(e, t, n, r, i) {
3849
3879
  }
3850
3880
  //#endregion
3851
3881
  //#region src/core/exactMediaRemovalController.ts
3852
- function mr(e, t) {
3882
+ function _r(e, t) {
3853
3883
  let [n, ...r] = t;
3854
3884
  if (!n) throw Error("Vibe items must contain at least one media asset.");
3855
3885
  return {
@@ -3858,10 +3888,10 @@ function mr(e, t) {
3858
3888
  items: r
3859
3889
  };
3860
3890
  }
3861
- function hr(e) {
3891
+ function vr(e) {
3862
3892
  if (!Number.isInteger(e.mediaIndex) || e.mediaIndex < 0) throw TypeError("Vibe mediaIndex must be a non-negative integer.");
3863
3893
  }
3864
- var gr = class {
3894
+ var yr = class {
3865
3895
  generation = 0;
3866
3896
  metadata = /* @__PURE__ */ new WeakMap();
3867
3897
  state;
@@ -3869,7 +3899,7 @@ var gr = class {
3869
3899
  this.options = e, this.state = e.state;
3870
3900
  }
3871
3901
  remove(e) {
3872
- hr(e);
3902
+ vr(e);
3873
3903
  let t = this.state.items.findIndex(({ postId: t }) => t === e.postId), n = this.state.items[t];
3874
3904
  if (!n) return null;
3875
3905
  let r = [...P(n)], i = r[e.mediaIndex];
@@ -3886,7 +3916,7 @@ var gr = class {
3886
3916
  restored: !1
3887
3917
  });
3888
3918
  let o = this.state.mediaIndices.get(n.postId) ?? 0, s = this.isReelOpen() && this.state.activeReelPostId === n.postId, c = s && o === e.mediaIndex;
3889
- return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = mr(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);
3919
+ return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = _r(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);
3890
3920
  }
3891
3921
  reset() {
3892
3922
  this.generation += 1;
@@ -3912,7 +3942,7 @@ var gr = class {
3912
3942
  }
3913
3943
  restoreIntoPost(e, t) {
3914
3944
  let n = this.state.items[e], r = [...P(n)], i = Math.min(t.mediaIndex, r.length);
3915
- if (r.splice(i, 0, t.media), this.state.items[e] = mr(n, r), this.state.activeReelPostId !== t.postId) return;
3945
+ if (r.splice(i, 0, t.media), this.state.items[e] = _r(n, r), this.state.activeReelPostId !== t.postId) return;
3916
3946
  let a = this.state.mediaIndices.get(t.postId) ?? 0;
3917
3947
  a >= i && this.state.mediaIndices.set(t.postId, a + 1);
3918
3948
  }
@@ -3925,18 +3955,18 @@ var gr = class {
3925
3955
  };
3926
3956
  //#endregion
3927
3957
  //#region src/core/itemPlacement.ts
3928
- function _r(e, t) {
3958
+ function br(e, t) {
3929
3959
  let n = new Set(t);
3930
3960
  return e.flatMap((e, t) => n.has(e.postId) ? [{
3931
3961
  index: t,
3932
3962
  item: e
3933
3963
  }] : []);
3934
3964
  }
3935
- function vr(e, t) {
3965
+ function xr(e, t) {
3936
3966
  let n = new Set(t.map(({ item: e }) => e.postId));
3937
3967
  return e.filter((e) => !n.has(e.postId));
3938
3968
  }
3939
- function yr(e, t) {
3969
+ function Sr(e, t) {
3940
3970
  t.forEach(({ index: e }) => {
3941
3971
  if (!Number.isInteger(e) || e < 0) throw Error("Vibe item restore indexes must be non-negative integers.");
3942
3972
  });
@@ -3947,7 +3977,7 @@ function yr(e, t) {
3947
3977
  }
3948
3978
  //#endregion
3949
3979
  //#region src/core/itemRemovalController.ts
3950
- var br = 20, xr = class {
3980
+ var Cr = 20, wr = class {
3951
3981
  generation = 0;
3952
3982
  historyLimit;
3953
3983
  metadata = /* @__PURE__ */ new WeakMap();
@@ -3956,7 +3986,7 @@ var br = 20, xr = class {
3956
3986
  itemOrder;
3957
3987
  stopItemsWatcher;
3958
3988
  constructor(e) {
3959
- this.options = e, this.historyLimit = e.historyLimit ?? br, 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" });
3989
+ this.options = e, this.historyLimit = e.historyLimit ?? Cr, 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" });
3960
3990
  }
3961
3991
  destroy() {
3962
3992
  this.reset(), this.stopItemsWatcher();
@@ -3970,7 +4000,7 @@ var br = 20, xr = class {
3970
4000
  let a = this.options.startRemoval(i, t);
3971
4001
  if (a > 0 && await new Promise((e) => setTimeout(e, a)), this.metadata.get(r)?.generation !== this.generation) return r;
3972
4002
  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);
3973
- return this.state.items = vr(this.state.items, n), this.options.onItemsRemoved(r, n, l), this.record(r), r;
4003
+ return this.state.items = xr(this.state.items, n), this.options.onItemsRemoved(r, n, l), this.record(r), r;
3974
4004
  }
3975
4005
  reset() {
3976
4006
  this.generation += 1, this.history = [], this.itemOrder = [];
@@ -3981,7 +4011,7 @@ var br = 20, xr = class {
3981
4011
  this.restoreRemoval(t);
3982
4012
  return;
3983
4013
  }
3984
- 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 = yr(this.state.items, r);
4014
+ 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 = Sr(this.state.items, r);
3985
4015
  this.registerExternalPlacements(r), this.state.items = i, r.length > 0 && this.options.onRemovalRestored(r);
3986
4016
  }
3987
4017
  restoreRemoval(e) {
@@ -4007,7 +4037,7 @@ var br = 20, xr = class {
4007
4037
  }
4008
4038
  collectOrderedPlacements(e) {
4009
4039
  let t = new Map(this.itemOrder.map((e, t) => [e, t]));
4010
- return _r(this.state.items, e).map((e) => ({
4040
+ return br(this.state.items, e).map((e) => ({
4011
4041
  index: t.get(e.item.postId) ?? e.index,
4012
4042
  item: e.item
4013
4043
  }));
@@ -4038,7 +4068,7 @@ var br = 20, xr = class {
4038
4068
  let r = new Map(this.itemOrder.map((e, t) => [e, t]));
4039
4069
  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;
4040
4070
  }
4041
- }, Sr = class {
4071
+ }, Tr = class {
4042
4072
  forward = null;
4043
4073
  forwardPromise = null;
4044
4074
  forwardVersion = 0;
@@ -4125,7 +4155,7 @@ var br = 20, xr = class {
4125
4155
  }
4126
4156
  }
4127
4157
  }
4128
- }, Cr = class {
4158
+ }, Er = class {
4129
4159
  generation = 0;
4130
4160
  pending = Promise.resolve();
4131
4161
  constructor(e) {
@@ -4175,24 +4205,24 @@ var br = 20, xr = class {
4175
4205
  };
4176
4206
  //#endregion
4177
4207
  //#region src/core/removalControllers.ts
4178
- function wr(e) {
4179
- let t = new Sr(e), n = new Cr({
4208
+ function Dr(e) {
4209
+ let t = new Tr(e), n = new Er({
4180
4210
  state: e.state,
4181
4211
  transitionMedia: (t) => e.surface()?.transitionActiveReelMedia(t) ?? Promise.resolve(!1),
4182
4212
  transitionPost: (t) => e.surface()?.transitionActiveReelPost(t) ?? Promise.resolve(!1)
4183
4213
  });
4184
4214
  return {
4185
- exactMediaRemoval: new gr({
4215
+ exactMediaRemoval: new yr({
4186
4216
  onActivate: e.onActivate,
4187
4217
  onPostRemoved: (t) => e.onItemsRemoved([t]),
4188
4218
  onPostRestored: (t) => e.onItemsRestored([t]),
4189
4219
  reelForward: t,
4190
4220
  state: e.state
4191
4221
  }),
4192
- itemRemoval: new xr({
4222
+ itemRemoval: new wr({
4193
4223
  historyLimit: e.historyLimit,
4194
4224
  onItemsRemoved: (n, r, i) => {
4195
- e.onItemsRemoved(r.map(({ item: e }) => e.postId)), pr(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
4225
+ e.onItemsRemoved(r.map(({ item: e }) => e.postId)), gr(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
4196
4226
  },
4197
4227
  onRemovalRestored: (n) => {
4198
4228
  e.onItemsRestored(n.map(({ item: e }) => e.postId));
@@ -4207,17 +4237,17 @@ function wr(e) {
4207
4237
  reelRemoval: n
4208
4238
  };
4209
4239
  }
4210
- var Tr = 1.5;
4211
- function Er(e) {
4240
+ var Or = 1.5;
4241
+ function kr(e) {
4212
4242
  let t = Math.min(e.screenWidth, e.screenHeight);
4213
4243
  if (t > 0 && t < 600) return !0;
4214
- let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * Tr;
4244
+ let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * Or;
4215
4245
  return !e.hasHover && n > 0 && n < 600 && r;
4216
4246
  }
4217
- function Dr(e) {
4218
- return Er(e) ? "reel" : "masonry";
4247
+ function Ar(e) {
4248
+ return kr(e) ? "reel" : "masonry";
4219
4249
  }
4220
- function Or(e) {
4250
+ function jr(e) {
4221
4251
  let t = e.ownerDocument.defaultView, n = e.ownerDocument.documentElement;
4222
4252
  return {
4223
4253
  hasHover: typeof t?.matchMedia == "function" && t.matchMedia("(hover: hover)").matches,
@@ -4227,15 +4257,15 @@ function Or(e) {
4227
4257
  viewportWidth: n.clientWidth
4228
4258
  };
4229
4259
  }
4230
- function kr(e) {
4231
- return Er(Or(e));
4260
+ function Mr(e) {
4261
+ return kr(jr(e));
4232
4262
  }
4233
- function Ar(e) {
4234
- return Dr(Or(e));
4263
+ function Nr(e) {
4264
+ return Ar(jr(e));
4235
4265
  }
4236
4266
  //#endregion
4237
4267
  //#region src/core/responsiveLayoutController.ts
4238
- var jr = class {
4268
+ var Pr = class {
4239
4269
  layoutMode;
4240
4270
  resizeObserver = null;
4241
4271
  target = null;
@@ -4260,13 +4290,13 @@ var jr = class {
4260
4290
  }
4261
4291
  handleResponsiveLayout = () => {
4262
4292
  if (!this.target) return;
4263
- let e = Ar(this.target);
4264
- this.state.phoneMode = kr(this.target), this.state.reelInfoSheetOverlay = this.state.phoneMode, this.state.reelMediaSource = this.state.phoneMode ? "mobile" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
4293
+ let e = Nr(this.target);
4294
+ this.state.phoneMode = Mr(this.target), this.state.reelInfoSheetOverlay = this.state.phoneMode, this.state.reelMediaSource = this.state.phoneMode ? "mobile" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
4265
4295
  };
4266
- }, Mr = class {
4296
+ }, Fr = class {
4267
4297
  state;
4268
4298
  constructor(e) {
4269
- this.options = e, this.state = x(Ye({
4299
+ this.options = e, this.state = x(Ze({
4270
4300
  ...e.initialReelAudioState,
4271
4301
  muted: e.initialReelAudioState?.muted ?? e.mediaCard?.videoMuted ?? !1
4272
4302
  }));
@@ -4275,9 +4305,9 @@ var jr = class {
4275
4305
  return { ...this.state };
4276
4306
  }
4277
4307
  set(e, t = !1) {
4278
- Object.assign(this.state, Ye(e, this.state)), t && this.options.onReelAudioStateChange?.(this.get());
4308
+ Object.assign(this.state, Ze(e, this.state)), t && this.options.onReelAudioStateChange?.(this.get());
4279
4309
  }
4280
- }, Nr = class {
4310
+ }, Ir = class {
4281
4311
  routedReelPostId = null;
4282
4312
  reelRouteIsActive = !1;
4283
4313
  constructor(e, t) {
@@ -4304,7 +4334,7 @@ var jr = class {
4304
4334
  let i = this.reelRouteIsActive ? "replace" : "push";
4305
4335
  this.reelRouteIsActive = !0, this.routedReelPostId = e, this.options.router[i](r);
4306
4336
  }
4307
- }, Pr = class {
4337
+ }, Lr = class {
4308
4338
  app = null;
4309
4339
  autoScroll;
4310
4340
  autofillController;
@@ -4327,24 +4357,24 @@ var jr = class {
4327
4357
  reelAudio;
4328
4358
  state;
4329
4359
  constructor(e) {
4330
- this.options = e, or(e);
4360
+ this.options = e, ur(e);
4331
4361
  let t = e.layout ?? "masonry";
4332
- this.state = x(rr(e, t)), this.reelAudio = new Mr(e), this.lastLoadedCursor = e.initialPage ? $t(e.initialPage) : null, this.notificationItems = R(this.state), this.autoScroll = new Dn({
4362
+ this.state = x(sr(e, t)), this.reelAudio = new Fr(e), this.lastLoadedCursor = e.initialPage ? an(e.initialPage) : null, this.notificationItems = R(this.state), this.autoScroll = new jn({
4333
4363
  getScrollElement: () => this.surface?.getAutoScrollElement() ?? null,
4334
4364
  state: this.state.autoScroll
4335
- }), this.autofillController = new xn({
4365
+ }), this.autofillController = new Tn({
4336
4366
  cancelRequest: () => this.cancelRequest(),
4337
4367
  onLastCursor: (e) => this.setCurrentCursor(e),
4338
4368
  onPages: (e) => this.removalReconciliation.recordPages(e),
4339
4369
  options: e.autofill,
4340
4370
  state: this.state
4341
- }), this.removalReconciliation = new fr(e), this.removalReconciliation.recordInitialPage(e.initialPage), this.fillController = new Jn({
4371
+ }), this.removalReconciliation = new hr(e), this.removalReconciliation.recordInitialPage(e.initialPage), this.fillController = new Qn({
4342
4372
  fill: e.fill,
4343
4373
  loadPage: e.loadPage ? (e) => this.loadFilteredPage(e) : void 0,
4344
4374
  needsFrontendPreparation: () => this.removalReconciliation.needsReconciliation(this.state.items),
4345
4375
  onLastCursor: (e) => this.setCurrentCursor(e),
4346
4376
  onPages: (e) => this.removalReconciliation.recordPages(e),
4347
- prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) => Yn({
4377
+ prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) => $n({
4348
4378
  controller: this.removalReconciliation,
4349
4379
  isCurrent: t,
4350
4380
  loadPage: e.loadPage,
@@ -4354,8 +4384,8 @@ var jr = class {
4354
4384
  state: this.state
4355
4385
  }),
4356
4386
  state: this.state
4357
- }), this.routing = new Nr(e.routing, this.state);
4358
- let n = wr({
4387
+ }), this.routing = new Ir(e.routing, this.state);
4388
+ let n = Dr({
4359
4389
  historyLimit: e.removalHistoryLimit,
4360
4390
  onActivate: (e) => this.setActiveReelPost(e),
4361
4391
  onItemsRemoved: (e) => this.removalReconciliation.remove(e),
@@ -4364,20 +4394,20 @@ var jr = class {
4364
4394
  state: this.state,
4365
4395
  surface: () => this.surface
4366
4396
  });
4367
- this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new jr(t, this.state, () => {
4397
+ this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new Pr(t, this.state, () => {
4368
4398
  this.routing.syncFeed();
4369
4399
  }), this.startStateNotifications();
4370
4400
  }
4371
4401
  async mount() {
4372
4402
  if (this.app) throw Error("Vibe is already mounted.");
4373
4403
  this.startStateNotifications();
4374
- let e = sr(this.options.target);
4375
- this.responsiveLayout.mount(e), this.app = i(Jt, {
4404
+ let e = dr(this.options.target);
4405
+ this.responsiveLayout.mount(e), this.app = i($t, {
4376
4406
  canRetryEnd: !!this.options.loadPage,
4377
4407
  cardFooter: this.options.cardFooter,
4378
4408
  cardHeader: this.options.cardHeader,
4379
4409
  feedFooter: this.options.feedFooter,
4380
- feedFooterActions: Xn(this),
4410
+ feedFooterActions: er(this),
4381
4411
  mediaCard: this.options.mediaCard,
4382
4412
  masonry: this.options.masonry,
4383
4413
  onMediaReady: this.options.onMediaReady,
@@ -4402,7 +4432,7 @@ var jr = class {
4402
4432
  onRetryForward: () => {
4403
4433
  this.retryReelForward();
4404
4434
  }
4405
- }), this.surface = this.app.mount(e), this.autoScroll.mount(), await Mn(this.options.restoreBacklog, (e) => this.appendPage(e), (e) => {
4435
+ }), this.surface = this.app.mount(e), this.autoScroll.mount(), await In(this.options.restoreBacklog, (e) => this.appendPage(e), (e) => {
4406
4436
  this.restoreController = e;
4407
4437
  }), !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();
4408
4438
  }
@@ -4473,7 +4503,7 @@ var jr = class {
4473
4503
  this.autoScroll.setSpeed(e);
4474
4504
  }
4475
4505
  applyAutofillUpdate(e) {
4476
- let t = An(this.options.autofill, this.state, e);
4506
+ let t = Pn(this.options.autofill, this.state, e);
4477
4507
  return t && this.autofillController.syncCountdown(), t;
4478
4508
  }
4479
4509
  cancelAutofill() {
@@ -4484,7 +4514,7 @@ var jr = class {
4484
4514
  await this.cancelFill();
4485
4515
  return;
4486
4516
  }
4487
- if (_n(this.state.autofill)) {
4517
+ if (xn(this.state.autofill)) {
4488
4518
  await this.cancelAutofill();
4489
4519
  return;
4490
4520
  }
@@ -4498,12 +4528,12 @@ var jr = class {
4498
4528
  }
4499
4529
  async fill(e) {
4500
4530
  if (!this.state.loadMoreLocked) {
4501
- if (this.pendingRequest || _n(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
4531
+ if (this.pendingRequest || xn(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
4502
4532
  await this.fillController.start(e);
4503
4533
  }
4504
4534
  }
4505
4535
  restoreAutofillSession(e) {
4506
- let t = jn(this.options.autofill, this.state, e);
4536
+ let t = Fn(this.options.autofill, this.state, e);
4507
4537
  return t && this.autofillController.syncCountdown(), t;
4508
4538
  }
4509
4539
  restoreFillSession(e) {
@@ -4513,14 +4543,14 @@ var jr = class {
4513
4543
  return this.startLoadMore(() => this.loadNextSequence());
4514
4544
  }
4515
4545
  appendPage(e) {
4516
- en(e, this.state, this.removalReconciliation, (e) => this.setCurrentCursor(e));
4546
+ on(e, this.state, this.removalReconciliation, (e) => this.setCurrentCursor(e));
4517
4547
  }
4518
4548
  replenishAfterRemoval() {
4519
4549
  return this.startLoadMore(() => this.replenishAfterRemovalSequence());
4520
4550
  }
4521
4551
  async startLoadMore(e) {
4522
4552
  if (this.pendingRequest) return this.pendingRequest;
4523
- if (this.state.loadMoreLocked || _n(this.state.autofill) || this.fillController.isActive() || !this.options.loadPage || this.state.next === null && !this.removalReconciliation.needsReconciliation(this.state.items)) return;
4553
+ if (this.state.loadMoreLocked || xn(this.state.autofill) || this.fillController.isActive() || !this.options.loadPage || this.state.next === null && !this.removalReconciliation.needsReconciliation(this.state.items)) return;
4524
4554
  this.state.isLoadingMore = !0, this.state.nextPageError = null;
4525
4555
  let t = e();
4526
4556
  return this.pendingRequest = t, t.finally(() => {
@@ -4535,12 +4565,12 @@ var jr = class {
4535
4565
  }
4536
4566
  async replaceFeed(e, t) {
4537
4567
  if (!this.options.loadPage) throw Error(`Vibe cannot ${t} without loadPage.`);
4538
- return _n(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.state.autofill = gn(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);
4568
+ return xn(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.state.autofill = bn(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);
4539
4569
  }
4540
4570
  async loadFilteredPage(e) {
4541
4571
  let t = this.options.loadPage;
4542
4572
  if (!t) throw Error("Vibe cannot load a page without loadPage.");
4543
- let n = Yt(await t(e));
4573
+ let n = en(await t(e));
4544
4574
  return {
4545
4575
  ...n,
4546
4576
  items: this.removalReconciliation.filterItems(n.items)
@@ -4559,7 +4589,7 @@ var jr = class {
4559
4589
  let t = ++this.requestVersion, n = new AbortController();
4560
4590
  this.abortController = n;
4561
4591
  try {
4562
- let r = await Yn({
4592
+ let r = await $n({
4563
4593
  controller: this.removalReconciliation,
4564
4594
  isCurrent: () => t === this.requestVersion,
4565
4595
  loadPage: e,
@@ -4577,7 +4607,7 @@ var jr = class {
4577
4607
  }
4578
4608
  async retryEnd() {
4579
4609
  if (this.pendingRequest) return this.pendingRequest;
4580
- if (!this.state.loadMoreLocked && !(_n(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);
4610
+ if (!this.state.loadMoreLocked && !(xn(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);
4581
4611
  }
4582
4612
  setInfiniteScroll(e) {
4583
4613
  this.state.infiniteScroll = e, e && m(() => this.surface?.loadIfNearBottom());
@@ -4601,10 +4631,10 @@ var jr = class {
4601
4631
  this.state.total = e;
4602
4632
  }
4603
4633
  setReelAutoAdvance(e) {
4604
- er(this.state.reelAutoAdvance, e);
4634
+ ir(this.state.reelAutoAdvance, e);
4605
4635
  }
4606
4636
  setReelInfoSheet(e) {
4607
- nr(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
4637
+ or(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
4608
4638
  }
4609
4639
  setLayout(e) {
4610
4640
  this.responsiveLayout.setLayout(e);
@@ -4624,7 +4654,7 @@ var jr = class {
4624
4654
  async fetchPage(e, t) {
4625
4655
  if (!this.options.loadPage) return;
4626
4656
  let n = ++this.requestVersion, r = new AbortController();
4627
- this.abortController = r, await cr({
4657
+ this.abortController = r, await fr({
4628
4658
  append: t,
4629
4659
  autofillController: this.autofillController,
4630
4660
  cursor: e,
@@ -4646,7 +4676,7 @@ var jr = class {
4646
4676
  startInitialAutofill() {
4647
4677
  let e = ++this.requestVersion, t = new AbortController(), n = this.autofillController.beginCycle();
4648
4678
  this.abortController = t, this.state.isLoadingMore = !0;
4649
- let r = Nn({
4679
+ let r = Ln({
4650
4680
  cycleId: n,
4651
4681
  isCurrent: () => e === this.requestVersion,
4652
4682
  onCollection: (t) => this.autofillController.captureCollection(t, e === this.requestVersion),
@@ -4673,8 +4703,8 @@ var jr = class {
4673
4703
  this.lastLoadedCursor = e, this.state.current = e;
4674
4704
  }
4675
4705
  };
4676
- function Fr(e) {
4677
- return new Pr(e);
4706
+ function Rr(e) {
4707
+ return new Lr(e);
4678
4708
  }
4679
4709
  //#endregion
4680
- export { Fr as createVibe };
4710
+ export { Rr as createVibe };