@wyxos/vibe 5.0.1 → 5.0.2

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
@@ -86,7 +86,7 @@ var L = {
86
86
  onClick: n[0] ||= (e) => t.$emit("retryEnd")
87
87
  }, " Check for more ", 8, V)]))])) : o("", !0);
88
88
  }
89
- }), U = /* @__PURE__ */ d({
89
+ }), ee = /* @__PURE__ */ d({
90
90
  __name: "FeedFooter",
91
91
  props: {
92
92
  actions: {},
@@ -142,7 +142,7 @@ var L = {
142
142
  "show-load-more"
143
143
  ]));
144
144
  }
145
- }), W = ["role"], G = { class: "gallery-status" }, ee = /* @__PURE__ */ d({
145
+ }), te = ["role"], ne = { class: "gallery-status" }, re = /* @__PURE__ */ d({
146
146
  __name: "FeedStatus",
147
147
  props: {
148
148
  actions: {},
@@ -156,7 +156,7 @@ var L = {
156
156
  return (n, u) => (b(), s("main", {
157
157
  class: "gallery-shell",
158
158
  role: r.state.error ? "alert" : r.state.isLoading ? "status" : void 0
159
- }, [c("p", G, [r.state.error ? (b(), s(e, { key: 0 }, [l(" Unable to load media. ")], 64)) : r.state.isLoading ? (b(), s(e, { key: 1 }, [l(" Loading media… ")], 64)) : (b(), s(e, { key: 2 }, [l(" No media found. ")], 64))]), t.feedFooter ? (b(), a(U, {
159
+ }, [c("p", ne, [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(ee, {
160
160
  key: 0,
161
161
  actions: t.actions,
162
162
  "can-retry-end": t.canRetryEnd,
@@ -178,36 +178,36 @@ var L = {
178
178
  "is-loading",
179
179
  "load-more-locked",
180
180
  "state"
181
- ])) : o("", !0)], 8, W));
181
+ ])) : o("", !0)], 8, te));
182
182
  }
183
183
  });
184
- function K(e) {
184
+ function U(e) {
185
185
  return e.scrollHeight - e.scrollTop - e.clientHeight <= 240;
186
186
  }
187
187
  //#endregion
188
188
  //#region src/core/masonry.ts
189
- function te(e) {
189
+ function W(e) {
190
190
  let t = e.preview.width ?? e.width, n = e.preview.height ?? e.height;
191
191
  return !t || !n || t <= 0 || n <= 0 ? 1 : n / t;
192
192
  }
193
- function ne(e) {
193
+ function ie(e) {
194
194
  return e.reduce((t, n, r) => n < e[t] ? r : t, 0);
195
195
  }
196
- function re(e) {
196
+ function G(e) {
197
197
  return Math.max(0, e.containerHeight) + Math.max(0, e.gap);
198
198
  }
199
- function ie(e, t) {
199
+ function K(e, t) {
200
200
  let n = Math.max(0, t.overscan), r = t.scrollTop - n, i = t.scrollTop + Math.max(0, t.viewportHeight) + n;
201
201
  return e.reduce((e, t, n) => (t.y + t.height >= r && t.y <= i && e.push(n), e), []);
202
202
  }
203
- function ae(e, t, n) {
203
+ function q(e, t, n) {
204
204
  if (t <= 0 || e.length === 0) return {
205
205
  columns: 0,
206
206
  height: 0,
207
207
  items: []
208
208
  };
209
209
  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) => {
210
- let t = ne(c), n = s * te(e) + i, a = {
210
+ let t = ie(c), n = s * W(e) + i, a = {
211
211
  x: t * (s + r),
212
212
  y: c[t],
213
213
  width: s,
@@ -223,10 +223,10 @@ function ae(e, t, n) {
223
223
  }
224
224
  //#endregion
225
225
  //#region src/core/scrollbar.ts
226
- function q(e, t, n) {
226
+ function J(e, t, n) {
227
227
  return Math.min(n, Math.max(t, e));
228
228
  }
229
- function oe({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize: r, viewportSize: i }) {
229
+ function ae({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize: r, viewportSize: i }) {
230
230
  let a = Math.max(0, e), o = Math.max(0, r), s = Math.max(0, i), c = Math.max(0, a - s);
231
231
  if (!(c > 0 && o > 0)) return {
232
232
  maximumScrollPosition: c,
@@ -235,23 +235,23 @@ function oe({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize:
235
235
  thumbSize: o,
236
236
  thumbTravel: 0
237
237
  };
238
- let l = q(s / a * o, Math.min(Math.max(0, t), o), o), u = Math.max(0, o - l);
238
+ let l = J(s / a * o, Math.min(Math.max(0, t), o), o), u = Math.max(0, o - l);
239
239
  return {
240
240
  maximumScrollPosition: c,
241
241
  scrollable: !0,
242
- thumbOffset: u * (q(n, 0, c) / c),
242
+ thumbOffset: u * (J(n, 0, c) / c),
243
243
  thumbSize: l,
244
244
  thumbTravel: u
245
245
  };
246
246
  }
247
247
  //#endregion
248
248
  //#region src/components/GalleryScrollbar.vue?vue&type=script&setup=true&lang.ts
249
- var J = ["aria-hidden"], se = [
249
+ var Y = ["aria-hidden"], oe = [
250
250
  "aria-controls",
251
251
  "aria-valuemax",
252
252
  "aria-valuenow",
253
253
  "tabindex"
254
- ], ce = 32, Y = 40, le = 120, X = /* @__PURE__ */ d({
254
+ ], se = 32, X = 40, ce = 120, le = /* @__PURE__ */ d({
255
255
  __name: "GalleryScrollbar",
256
256
  props: {
257
257
  contentSize: {},
@@ -273,16 +273,16 @@ var J = ["aria-hidden"], se = [
273
273
  function k() {
274
274
  g !== null && clearTimeout(g), g = setTimeout(() => {
275
275
  g = null, o.value || (l.value = !1);
276
- }, le);
276
+ }, ce);
277
277
  }
278
278
  function A() {
279
279
  l.value = !0, k();
280
280
  }
281
281
  function j() {
282
282
  let e = t.scrollElement, r = i.value;
283
- return !e || !r ? n : oe({
283
+ return !e || !r ? n : ae({
284
284
  contentSize: e.scrollHeight,
285
- minimumThumbSize: ce,
285
+ minimumThumbSize: se,
286
286
  scrollPosition: e.scrollTop,
287
287
  trackSize: r.clientHeight,
288
288
  viewportSize: e.clientHeight
@@ -335,7 +335,7 @@ var J = ["aria-hidden"], se = [
335
335
  }
336
336
  function z(e) {
337
337
  if (!E.value) return;
338
- let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r - Y : e.key === "ArrowDown" ? r + Y : e.key === "PageUp" ? r - n : e.key === "PageDown" ? r + n : e.key === "Home" ? 0 : e.key === "End" ? a.value.maximumScrollPosition : null;
338
+ let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r - X : e.key === "ArrowDown" ? r + X : e.key === "PageUp" ? r - n : e.key === "PageDown" ? r + n : e.key === "Home" ? 0 : e.key === "End" ? a.value.maximumScrollPosition : null;
339
339
  i !== null && (e.preventDefault(), A(), P(i));
340
340
  }
341
341
  function B(e) {
@@ -381,12 +381,12 @@ var J = ["aria-hidden"], se = [
381
381
  onPointerdown: I,
382
382
  onPointermove: L,
383
383
  onPointerup: R
384
- }, null, 44, se)], 42, J));
384
+ }, null, 44, oe)], 42, Y));
385
385
  }
386
- }), Z = (e) => {
386
+ }), ue = (e) => {
387
387
  for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
388
388
  return !1;
389
- }, ue = (e) => e === "", de = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), fe = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), pe = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), me = (e) => {
389
+ }, de = (e) => e === "", fe = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), Z = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), pe = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), me = (e) => {
390
390
  let t = pe(e);
391
391
  return t.charAt(0).toUpperCase() + t.slice(1);
392
392
  }, he = {
@@ -405,9 +405,9 @@ var J = ["aria-hidden"], se = [
405
405
  width: o,
406
406
  height: o,
407
407
  stroke: s,
408
- "stroke-width": ue(n) || ue(r) || n === !0 || r === !0 ? Number(i || a || he["stroke-width"]) * 24 / Number(o) : i || a || he["stroke-width"],
409
- class: de("lucide", c.class, ...e ? [`lucide-${fe(me(e))}-icon`, `lucide-${fe(e)}`] : ["lucide-icon"]),
410
- ...!l.default && !Z(c) && { "aria-hidden": "true" }
408
+ "stroke-width": de(n) || de(r) || n === !0 || r === !0 ? Number(i || a || he["stroke-width"]) * 24 / Number(o) : i || a || he["stroke-width"],
409
+ class: fe("lucide", c.class, ...e ? [`lucide-${Z(me(e))}-icon`, `lucide-${Z(e)}`] : ["lucide-icon"]),
410
+ ...!l.default && !ue(c) && { "aria-hidden": "true" }
411
411
  }, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]), _e = (e, t) => (n, { slots: r, attrs: i }) => p(ge, {
412
412
  ...i,
413
413
  ...n,
@@ -642,7 +642,44 @@ var ke = /* @__PURE__ */ d({
642
642
  c("output", Ie, T(u(p.value)) + " / " + T(u(f.value)), 1)
643
643
  ])) : o("", !0)], 34));
644
644
  }
645
- }), Re = [
645
+ });
646
+ //#endregion
647
+ //#region src/components/useReelVideoActivity.ts
648
+ function Re(e) {
649
+ let t = r(() => e.layout() !== "reel" || e.active() === !0), n = r(() => t.value ? e.videoIsMuted.value : !0);
650
+ function i() {
651
+ if (!t.value) {
652
+ e.videoElement.value?.pause(), e.videoIsPlaying.value = !1;
653
+ return;
654
+ }
655
+ e.videoIsPlaying.value = !0;
656
+ }
657
+ return O(t, (n) => {
658
+ let r = e.videoElement.value;
659
+ if (!n) {
660
+ r?.pause(), r && (r.muted = !0), e.videoIsPlaying.value = !1;
661
+ return;
662
+ }
663
+ m().then(async () => {
664
+ let n = e.videoElement.value;
665
+ if (!(!n || !t.value)) {
666
+ n.muted = e.videoIsMuted.value;
667
+ try {
668
+ await n.play();
669
+ } catch {
670
+ e.videoIsPlaying.value = !1;
671
+ }
672
+ }
673
+ });
674
+ }), {
675
+ effectiveMuted: n,
676
+ onPlaying: i,
677
+ playbackAllowed: t
678
+ };
679
+ }
680
+ //#endregion
681
+ //#region src/components/MediaCard.vue?vue&type=script&setup=true&lang.ts
682
+ var ze = [
646
683
  "data-post-id",
647
684
  "data-media-index",
648
685
  "aria-hidden",
@@ -650,24 +687,25 @@ var ke = /* @__PURE__ */ d({
650
687
  "inert",
651
688
  "role",
652
689
  "tabindex"
653
- ], ze = { class: "media-card-content" }, Be = ["data-media-direction"], Ve = ["data-media-index"], He = {
690
+ ], Be = { class: "media-card-content" }, Ve = ["data-media-direction"], He = ["data-media-index"], Ue = {
654
691
  key: 0,
655
692
  "data-test": "media-loading",
656
693
  class: "media-loading",
657
694
  "aria-hidden": "true"
658
- }, Ue = ["aria-label"], We = { class: "media-error-code" }, Ge = [
695
+ }, We = ["aria-label"], Ge = { class: "media-error-code" }, Ke = [
659
696
  "src",
660
697
  "width",
661
698
  "height",
699
+ "autoplay",
662
700
  "loop",
663
701
  "muted",
664
702
  "preload"
665
- ], Ke = [
703
+ ], qe = [
666
704
  "src",
667
705
  "width",
668
706
  "height",
669
707
  "fetchpriority"
670
- ], qe = ["aria-label"], Je = ["aria-label"], Ye = ["aria-label"], Xe = 40, Ze = 160, Qe = 24, $e = /* @__PURE__ */ d({
708
+ ], Je = ["aria-label"], Ye = ["aria-label"], Xe = ["aria-label"], Ze = 40, Qe = 160, $e = 24, et = /* @__PURE__ */ d({
671
709
  __name: "MediaCard",
672
710
  props: {
673
711
  active: { type: Boolean },
@@ -703,46 +741,52 @@ var ke = /* @__PURE__ */ d({
703
741
  function S(e = !1, t = "pointer") {
704
742
  e && x("activate", t);
705
743
  }
706
- let C = r(() => M(l.item)), D = r(() => N(l.item, l.mediaIndex)), O = r(() => P(l.item, D.value)), F = r(() => l.mediaSource === "original" ? O.value.src : O.value.preview.src), I = r(() => l.mediaSource === "original" ? O.value.width : O.value.preview.width), L = r(() => l.mediaSource === "original" ? O.value.height : O.value.preview.height), R = w(null), z = w(0), B = w(0), V = w(l.mediaCard?.videoMuted ?? l.layout === "masonry"), H = w(!1), U = w(1), W = 1, G = r(() => l.interactive && !!(l.cardHeader || l.cardFooter));
707
- function ee(e) {
744
+ let C = r(() => M(l.item)), D = r(() => N(l.item, l.mediaIndex)), O = r(() => P(l.item, D.value)), F = r(() => l.mediaSource === "original" ? O.value.src : O.value.preview.src), I = r(() => l.mediaSource === "original" ? O.value.width : O.value.preview.width), L = r(() => l.mediaSource === "original" ? O.value.height : O.value.preview.height), R = w(null), z = w(0), B = w(0), V = w(l.mediaCard?.videoMuted ?? l.layout === "masonry"), H = w(!1), ee = w(1), te = 1, { effectiveMuted: ne, onPlaying: re, playbackAllowed: U } = Re({
745
+ active: () => l.active,
746
+ layout: () => l.layout,
747
+ videoElement: R,
748
+ videoIsMuted: V,
749
+ videoIsPlaying: H
750
+ }), W = r(() => l.interactive && !!(l.cardHeader || l.cardFooter));
751
+ function ie(e) {
708
752
  return e.detail === 0 ? "keyboard" : "pointer";
709
753
  }
710
- function K(e, t) {
754
+ function G(e, t) {
711
755
  let n = C.value.length, r = (e + n) % n;
712
756
  r !== D.value && (y.value = e < D.value ? "previous" : "next", x("mediaChange", r), t && t.detail > 0 && t.currentTarget?.blur());
713
757
  }
714
- function te(e, t, n) {
758
+ function K(e, t, n) {
715
759
  return t === 1 ? e * 16 : t === 2 ? e * n : e;
716
760
  }
717
- function ne() {
761
+ function q() {
718
762
  f = 0, p = !1, d !== null && clearTimeout(d), d = null;
719
763
  }
720
- function re() {
721
- d !== null && clearTimeout(d), d = setTimeout(ne, Ze);
764
+ function J() {
765
+ d !== null && clearTimeout(d), d = setTimeout(q, Qe);
722
766
  }
723
- function ie(e) {
767
+ function ae(e) {
724
768
  if (C.value.length <= 1) return;
725
- let t = e.currentTarget?.clientWidth || 1, n = te(e.deltaX, e.deltaMode, t);
726
- if (n === 0 || (e.preventDefault(), re(), p) || (f += n, Math.abs(f) < Qe)) return;
769
+ let t = e.currentTarget?.clientWidth || 1, n = K(e.deltaX, e.deltaMode, t);
770
+ if (n === 0 || (e.preventDefault(), J(), p) || (f += n, Math.abs(f) < $e)) return;
727
771
  let r = Math.sign(f);
728
- f = 0, p = !0, K(D.value + r);
772
+ f = 0, p = !0, G(D.value + r);
729
773
  }
730
- function ae(e) {
774
+ function Y(e) {
731
775
  let t = e.touches[0];
732
776
  l.layout !== "reel" || !t || (m = t.clientX, g = t.clientY);
733
777
  }
734
- function q(e) {
778
+ function oe(e) {
735
779
  let t = e.changedTouches[0];
736
780
  if (m === null || g === null || !t) return;
737
781
  let n = m - t.clientX, r = g - t.clientY;
738
- m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) < Xe || K(D.value + Math.sign(n)));
782
+ m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) < Ze || G(D.value + Math.sign(n)));
739
783
  }
740
- let oe = r(() => Oe(F.value)), J = r(() => l.layout === "reel" && l.stationaryReelControls === !0), se = r(() => oe.value && l.previewState === "ready" && (!J.value || !!(l.active && l.reelControlsTarget))), ce = r(() => `${l.item.postId}:${D.value}:${F.value}`);
741
- function Y(e) {
742
- l.layout === "reel" && (e.stopPropagation(), le());
784
+ let se = r(() => Oe(F.value)), X = r(() => l.layout === "reel" && l.stationaryReelControls === !0), ce = r(() => se.value && l.previewState === "ready" && (!X.value || !!(l.active && l.reelControlsTarget))), le = r(() => `${l.item.postId}:${D.value}:${F.value}`);
785
+ function ue(e) {
786
+ l.layout === "reel" && (e.stopPropagation(), de());
743
787
  }
744
- async function le() {
745
- if (R.value) {
788
+ async function de() {
789
+ if (!(!R.value || !U.value)) {
746
790
  if (H.value) {
747
791
  R.value.pause();
748
792
  return;
@@ -754,35 +798,35 @@ var ke = /* @__PURE__ */ d({
754
798
  }
755
799
  }
756
800
  }
757
- function X(e) {
801
+ function fe(e) {
758
802
  return Number.isFinite(e) ? Math.max(0, e) : 0;
759
803
  }
760
804
  function Z(e) {
761
805
  let t = e?.currentTarget ?? R.value;
762
- t && (z.value = X(t.currentTime), B.value = X(t.duration), V.value = t.muted, U.value = t.volume, t.volume > 0 && (W = t.volume));
806
+ t && (z.value = fe(t.currentTime), B.value = fe(t.duration), U.value && (V.value = t.muted), ee.value = t.volume, t.volume > 0 && (te = t.volume));
763
807
  }
764
- function ue(e) {
808
+ function pe(e) {
765
809
  Z(e), x("ready", D.value);
766
810
  }
767
- function de() {
811
+ function me() {
768
812
  H.value = !1, x("ended", D.value);
769
813
  }
770
- function fe(e) {
814
+ function he(e) {
771
815
  let t = R.value;
772
- !t || !Number.isFinite(e) || (t.currentTime = Math.min(X(t.duration), Math.max(0, e)), z.value = t.currentTime);
816
+ !t || !Number.isFinite(e) || (t.currentTime = Math.min(fe(t.duration), Math.max(0, e)), z.value = t.currentTime);
773
817
  }
774
- function pe(e) {
818
+ function ge(e) {
775
819
  let t = R.value;
776
820
  if (!t || !Number.isFinite(e)) return;
777
821
  let n = Math.min(1, Math.max(0, e));
778
- t.volume = n, t.muted = n === 0, n > 0 && (W = n), Z();
822
+ t.volume = n, t.muted = n === 0, n > 0 && (te = n), Z();
779
823
  }
780
- function me() {
824
+ function _e() {
781
825
  let e = R.value;
782
- e && (e.muted && e.volume === 0 && (e.volume = W), e.muted = !e.muted, Z());
826
+ e && (e.muted && e.volume === 0 && (e.volume = te), e.muted = !e.muted, Z());
783
827
  }
784
828
  return v(() => {
785
- ne();
829
+ q();
786
830
  }), (r, i) => (b(), s("article", {
787
831
  "data-post-id": e.item.postId,
788
832
  "data-media-index": D.value,
@@ -796,11 +840,11 @@ var ke = /* @__PURE__ */ d({
796
840
  "aria-hidden": e.leaving || void 0,
797
841
  "aria-busy": e.previewState === "loading",
798
842
  inert: e.leaving || void 0,
799
- role: e.interactive && !e.leaving && !G.value ? "button" : void 0,
800
- tabindex: e.interactive && !e.leaving && !G.value ? 0 : void 0,
801
- onClick: i[11] ||= (t) => S(e.interactive && !G.value, ee(t)),
802
- onKeydown: [i[12] ||= A((t) => S(e.interactive && !G.value, "keyboard"), ["enter"]), i[13] ||= A(j((t) => S(e.interactive && !G.value, "keyboard"), ["prevent"]), ["space"])]
803
- }, [c("div", ze, [
843
+ role: e.interactive && !e.leaving && !W.value ? "button" : void 0,
844
+ tabindex: e.interactive && !e.leaving && !W.value ? 0 : void 0,
845
+ onClick: i[11] ||= (t) => S(e.interactive && !W.value, ie(t)),
846
+ onKeydown: [i[12] ||= A((t) => S(e.interactive && !W.value, "keyboard"), ["enter"]), i[13] ||= A(j((t) => S(e.interactive && !W.value, "keyboard"), ["prevent"]), ["space"])]
847
+ }, [c("div", Be, [
804
848
  e.cardHeader ? (b(), a(ke, {
805
849
  key: 0,
806
850
  index: e.index,
@@ -827,22 +871,22 @@ var ke = /* @__PURE__ */ d({
827
871
  c("div", {
828
872
  class: h(["media-card-media", { "media-card-media--carousel": e.layout === "reel" && C.value.length > 1 }]),
829
873
  "data-media-direction": y.value,
830
- onWheel: ie,
831
- onTouchstartPassive: ae,
832
- onTouchendPassive: q
874
+ onWheel: ae,
875
+ onTouchstartPassive: Y,
876
+ onTouchendPassive: oe
833
877
  }, [
834
878
  u(n, { name: `media-slide-${y.value}` }, {
835
879
  default: k(() => [(b(), s("div", {
836
880
  key: `${e.item.postId}:${O.value.src}:${e.mediaSource ?? "preview"}`,
837
881
  class: "media-card-frame",
838
882
  "data-media-index": D.value
839
- }, [e.previewState === "loading" ? (b(), s("div", He, [...i[14] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : e.previewState === "error" ? (b(), s("div", {
883
+ }, [e.previewState === "loading" ? (b(), s("div", Ue, [...i[14] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : e.previewState === "error" ? (b(), s("div", {
840
884
  key: 1,
841
885
  "data-test": "media-error",
842
886
  class: "media-error",
843
887
  role: "img",
844
888
  "aria-label": `${E(Te)(F.value)} ${E(Ee)(F.value)}`
845
- }, [c("strong", We, T(E(Te)(F.value)), 1), c("span", null, T(E(Ee)(F.value)), 1)], 8, Ue)) : o("", !0), oe.value ? (b(), s("video", {
889
+ }, [c("strong", Ge, T(E(Te)(F.value)), 1), c("span", null, T(E(Ee)(F.value)), 1)], 8, We)) : o("", !0), se.value ? (b(), s("video", {
846
890
  key: 2,
847
891
  ref_key: "videoElement",
848
892
  ref: R,
@@ -853,21 +897,21 @@ var ke = /* @__PURE__ */ d({
853
897
  src: F.value,
854
898
  width: I.value ?? void 0,
855
899
  height: L.value ?? void 0,
856
- autoplay: "",
900
+ autoplay: E(U),
857
901
  loop: !e.advanceOnMediaEnd,
858
- muted: V.value,
902
+ muted: E(ne),
859
903
  playsinline: "",
860
904
  preload: e.fetchPriority === "high" ? "auto" : "metadata",
861
- onLoadedmetadata: ue,
905
+ onLoadedmetadata: pe,
862
906
  onDurationchange: Z,
863
907
  onTimeupdate: Z,
864
908
  onVolumechange: Z,
865
- onPlaying: i[0] ||= (e) => H.value = !0,
909
+ onPlaying: i[0] ||= (...e) => E(re) && E(re)(...e),
866
910
  onPause: i[1] ||= (e) => H.value = !1,
867
- onEnded: de,
868
- onClick: Y,
911
+ onEnded: me,
912
+ onClick: ue,
869
913
  onError: i[2] ||= (e) => r.$emit("error", D.value)
870
- }, null, 42, Ge)) : (b(), s("img", {
914
+ }, null, 42, Ke)) : (b(), s("img", {
871
915
  key: 3,
872
916
  class: h(["media-preview", { "media-preview--ready": e.previewState === "ready" }]),
873
917
  src: F.value,
@@ -879,29 +923,29 @@ var ke = /* @__PURE__ */ d({
879
923
  loading: "eager",
880
924
  onLoad: i[3] ||= (e) => r.$emit("ready", D.value),
881
925
  onError: i[4] ||= (e) => r.$emit("error", D.value)
882
- }, null, 42, Ke))], 8, Ve))]),
926
+ }, null, 42, qe))], 8, He))]),
883
927
  _: 1
884
928
  }, 8, ["name"]),
885
929
  (b(), a(t, {
886
- disabled: !J.value || !e.reelControlsTarget,
930
+ disabled: !X.value || !e.reelControlsTarget,
887
931
  to: e.reelControlsTarget ?? "body"
888
932
  }, [u(n, {
889
933
  name: "vibe-reel-media-controls",
890
- css: J.value
934
+ css: X.value
891
935
  }, {
892
- default: k(() => [se.value ? (b(), a(Le, {
893
- key: ce.value,
936
+ default: k(() => [ce.value ? (b(), a(Le, {
937
+ key: le.value,
894
938
  "current-time": z.value,
895
- "data-control-post-id": J.value ? e.item.postId : void 0,
939
+ "data-control-post-id": X.value ? e.item.postId : void 0,
896
940
  duration: B.value,
897
941
  layout: e.layout,
898
942
  muted: V.value,
899
943
  playing: H.value,
900
- volume: U.value,
901
- onSeek: fe,
902
- onToggleMute: me,
903
- onTogglePlayback: le,
904
- onVolumeChange: pe
944
+ volume: ee.value,
945
+ onSeek: he,
946
+ onToggleMute: _e,
947
+ onTogglePlayback: de,
948
+ onVolumeChange: ge
905
949
  }, null, 8, [
906
950
  "current-time",
907
951
  "data-control-post-id",
@@ -921,24 +965,24 @@ var ke = /* @__PURE__ */ d({
921
965
  type: "button",
922
966
  class: "media-carousel-control media-carousel-control--previous",
923
967
  "aria-label": `Previous media for post ${e.item.postId}`,
924
- onClick: i[5] ||= j((e) => K(D.value - 1, e), ["stop"]),
968
+ onClick: i[5] ||= j((e) => G(D.value - 1, e), ["stop"]),
925
969
  onKeydown: i[6] ||= j(() => {}, ["stop"])
926
- }, [u(E(ve), { size: 20 })], 40, qe), c("button", {
970
+ }, [u(E(ve), { size: 20 })], 40, Je), c("button", {
927
971
  type: "button",
928
972
  class: "media-carousel-control media-carousel-control--next",
929
973
  "aria-label": `Next media for post ${e.item.postId}`,
930
- onClick: i[7] ||= j((e) => K(D.value + 1, e), ["stop"]),
974
+ onClick: i[7] ||= j((e) => G(D.value + 1, e), ["stop"]),
931
975
  onKeydown: i[8] ||= j(() => {}, ["stop"])
932
- }, [u(E(ye), { size: 20 })], 40, Je)], 2)) : o("", !0),
933
- G.value ? (b(), s("button", {
976
+ }, [u(E(ye), { size: 20 })], 40, Ye)], 2)) : o("", !0),
977
+ W.value ? (b(), s("button", {
934
978
  key: 1,
935
979
  class: "media-card-activator",
936
980
  type: "button",
937
981
  "aria-label": `Open post ${e.item.postId}`,
938
- onClick: i[9] ||= j((e) => r.$emit("activate", ee(e)), ["stop"]),
982
+ onClick: i[9] ||= j((e) => r.$emit("activate", ie(e)), ["stop"]),
939
983
  onKeydown: i[10] ||= j(() => {}, ["stop"])
940
- }, null, 40, Ye)) : o("", !0)
941
- ], 42, Be),
984
+ }, null, 40, Xe)) : o("", !0)
985
+ ], 42, Ve),
942
986
  e.cardFooter ? (b(), a(ke, {
943
987
  key: 1,
944
988
  index: e.index,
@@ -962,9 +1006,9 @@ var ke = /* @__PURE__ */ d({
962
1006
  "style",
963
1007
  "total"
964
1008
  ])) : o("", !0)
965
- ])], 46, Re));
1009
+ ])], 46, ze));
966
1010
  }
967
- }), et = { class: "masonry-feed-shell" }, tt = ["aria-hidden", "inert"], nt = 240, rt = 6, it = 12, at = 800, ot = 1.5, st = /* @__PURE__ */ d({
1011
+ }), tt = { class: "masonry-feed-shell" }, nt = ["aria-hidden", "inert"], rt = 240, it = 6, at = 12, ot = 800, st = 1.5, ct = /* @__PURE__ */ d({
968
1012
  __name: "MasonryFeed",
969
1013
  props: {
970
1014
  enteringPostIds: {},
@@ -998,36 +1042,36 @@ var ke = /* @__PURE__ */ d({
998
1042
  "retryEnd"
999
1043
  ],
1000
1044
  setup(t, { expose: n, emit: i }) {
1001
- let o = t, l = i, d = w(null), f = `vibe-masonry-${D()}`, p = w(null), m = w(0), g = w(rt), y = w(0), x = w(0), C = w(0), T = null, k = null, A = null, j = r(() => ae(o.items, m.value, {
1045
+ let o = t, l = i, d = w(null), f = `vibe-masonry-${D()}`, p = w(null), m = w(0), g = w(it), y = w(0), x = w(0), C = w(0), T = null, k = null, A = null, j = r(() => q(o.items, m.value, {
1002
1046
  additionalHeight: (o.cardHeader?.height ?? 0) + (o.cardFooter?.height ?? 0),
1003
1047
  gap: g.value,
1004
- minColumnWidth: nt
1048
+ minColumnWidth: rt
1005
1049
  })), M = r(() => {
1006
1050
  let e = j.value;
1007
1051
  if (o.leavingPostIds.size === 0) return e;
1008
- let t = o.items.filter((e) => !o.leavingPostIds.has(e.postId)), n = ae(t, m.value, {
1052
+ let t = o.items.filter((e) => !o.leavingPostIds.has(e.postId)), n = q(t, m.value, {
1009
1053
  additionalHeight: (o.cardHeader?.height ?? 0) + (o.cardFooter?.height ?? 0),
1010
1054
  gap: g.value,
1011
- minColumnWidth: nt
1055
+ minColumnWidth: rt
1012
1056
  }), r = new Map(t.map((e, t) => [e.postId, n.items[t]]));
1013
1057
  return {
1014
1058
  ...n,
1015
1059
  items: o.items.map((t, n) => o.leavingPostIds.has(t.postId) ? e.items[n] : r.get(t.postId) ?? e.items[n])
1016
1060
  };
1017
1061
  }), N = r(() => ({ height: `${o.leavingPostIds.size === 0 ? M.value.height : j.value.height}px` })), P = r(() => !o.infiniteScroll || x.value > 0 && C.value + M.value.height <= x.value + 1), I = r(() => {
1018
- let e = Math.max(at, x.value * ot), t = {
1062
+ let e = Math.max(ot, x.value * st), t = {
1019
1063
  scrollTop: y.value - C.value,
1020
1064
  viewportHeight: x.value
1021
- }, n = ie(M.value.items, {
1065
+ }, n = K(M.value.items, {
1022
1066
  ...t,
1023
1067
  overscan: e
1024
- }), r = o.leavingPostIds.size === 0 ? [] : ie(j.value.items, {
1068
+ }), r = o.leavingPostIds.size === 0 ? [] : K(j.value.items, {
1025
1069
  ...t,
1026
1070
  overscan: e
1027
- }), i = [...new Set([...n, ...r])].sort((e, t) => e - t), a = ie(M.value.items, {
1071
+ }), i = [...new Set([...n, ...r])].sort((e, t) => e - t), a = K(M.value.items, {
1028
1072
  ...t,
1029
1073
  overscan: 0
1030
- }), s = o.leavingPostIds.size === 0 ? [] : ie(j.value.items, {
1074
+ }), s = o.leavingPostIds.size === 0 ? [] : K(j.value.items, {
1031
1075
  ...t,
1032
1076
  overscan: 0
1033
1077
  }), c = new Set([...a, ...s]);
@@ -1043,7 +1087,7 @@ var ke = /* @__PURE__ */ d({
1043
1087
  function L(e) {
1044
1088
  let t = M.value.items[e], n = o.items[e]?.postId;
1045
1089
  if (!t) return {};
1046
- let r = n !== void 0 && o.enteringPostIds.has(n), i = n !== void 0 && o.leavingPostIds.has(n), a = r || i ? re({
1090
+ let r = n !== void 0 && o.enteringPostIds.has(n), i = n !== void 0 && o.leavingPostIds.has(n), a = r || i ? G({
1047
1091
  containerHeight: j.value.height,
1048
1092
  gap: g.value
1049
1093
  }) : 0, s = n === void 0 ? 0 : i ? o.removalDelays.get(n) ?? 0 : r ? o.entryDelays.get(n) ?? 0 : 0;
@@ -1063,15 +1107,15 @@ var ke = /* @__PURE__ */ d({
1063
1107
  }
1064
1108
  function z(e) {
1065
1109
  let t = e.ownerDocument.documentElement.clientWidth;
1066
- m.value = e.clientWidth, g.value = Math.min(it, Math.max(rt, t * .0075)), R();
1110
+ m.value = e.clientWidth, g.value = Math.min(at, Math.max(it, t * .0075)), R();
1067
1111
  }
1068
1112
  function B(e) {
1069
1113
  let t = e.currentTarget;
1070
- t && (y.value = t.scrollTop, !o.loadMoreLocked && o.infiniteScroll && K(t) && l("loadMore"));
1114
+ t && (y.value = t.scrollTop, !o.loadMoreLocked && o.infiniteScroll && U(t) && l("loadMore"));
1071
1115
  }
1072
1116
  function V() {
1073
1117
  let e = d.value;
1074
- !o.loadMoreLocked && e && K(e) && l("loadMore");
1118
+ !o.loadMoreLocked && e && U(e) && l("loadMore");
1075
1119
  }
1076
1120
  function H() {
1077
1121
  return d.value;
@@ -1090,7 +1134,7 @@ var ke = /* @__PURE__ */ d({
1090
1134
  }), n({
1091
1135
  getScrollElement: H,
1092
1136
  loadIfNearBottom: V
1093
- }), (n, r) => (b(), s("div", et, [c("main", {
1137
+ }), (n, r) => (b(), s("div", tt, [c("main", {
1094
1138
  id: f,
1095
1139
  ref_key: "galleryElement",
1096
1140
  ref: d,
@@ -1105,7 +1149,7 @@ var ke = /* @__PURE__ */ d({
1105
1149
  class: h(["masonry", { "masonry--ready": m.value > 0 }]),
1106
1150
  style: _(N.value),
1107
1151
  "aria-label": "Media gallery"
1108
- }, [(b(!0), s(e, null, S(I.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a($e, {
1152
+ }, [(b(!0), s(e, null, S(I.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(et, {
1109
1153
  key: n.postId,
1110
1154
  class: "masonry-item",
1111
1155
  entering: t.enteringPostIds.has(n.postId),
@@ -1145,7 +1189,7 @@ var ke = /* @__PURE__ */ d({
1145
1189
  "onMediaChange",
1146
1190
  "onReady",
1147
1191
  "onError"
1148
- ]))), 128))], 6), u(U, {
1192
+ ]))), 128))], 6), u(ee, {
1149
1193
  actions: t.feedFooterActions,
1150
1194
  "can-retry-end": t.canRetryEnd,
1151
1195
  "feed-footer": t.feedFooter,
@@ -1167,7 +1211,7 @@ var ke = /* @__PURE__ */ d({
1167
1211
  "load-more-locked",
1168
1212
  "show-load-more",
1169
1213
  "state"
1170
- ])], 42, tt), u(X, {
1214
+ ])], 42, nt), u(le, {
1171
1215
  "content-size": M.value.height,
1172
1216
  "controls-id": f,
1173
1217
  "scroll-element": d.value,
@@ -1178,8 +1222,8 @@ var ke = /* @__PURE__ */ d({
1178
1222
  "suspended"
1179
1223
  ])]));
1180
1224
  }
1181
- }), ct = 300;
1182
- function lt(e, t, n) {
1225
+ }), lt = 300;
1226
+ function ut(e, t, n) {
1183
1227
  let r = e.scrollTop;
1184
1228
  if (n || Math.abs(r - t) <= 1) return e.scrollTop = t, Promise.resolve();
1185
1229
  e.setAttribute("data-transitioning", "");
@@ -1187,7 +1231,7 @@ function lt(e, t, n) {
1187
1231
  return new Promise((n) => {
1188
1232
  let o = (s) => {
1189
1233
  a += 1;
1190
- let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / ct), u = 1 - (1 - l) ** 3;
1234
+ let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / lt), u = 1 - (1 - l) ** 3;
1191
1235
  if (e.scrollTop = r + (t - r) * u, l < 1) {
1192
1236
  requestAnimationFrame(o);
1193
1237
  return;
@@ -1199,7 +1243,7 @@ function lt(e, t, n) {
1199
1243
  }
1200
1244
  //#endregion
1201
1245
  //#region src/components/ReelAutoAdvanceProgress.vue?vue&type=script&setup=true&lang.ts
1202
- var ut = ["aria-label"], dt = /* @__PURE__ */ d({
1246
+ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
1203
1247
  __name: "ReelAutoAdvanceProgress",
1204
1248
  props: {
1205
1249
  durationMs: {},
@@ -1217,9 +1261,9 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
1217
1261
  class: "reel-auto-advance-progress",
1218
1262
  style: _(a.value),
1219
1263
  onAnimationend: n[0] ||= (e) => i("complete")
1220
- }, null, 36)], 8, ut));
1264
+ }, null, 36)], 8, dt));
1221
1265
  }
1222
- }), ft = { class: "reel-viewport" }, pt = ["data-active-post-id", "data-active-media-index"], mt = ["role", "data-status"], ht = 2, gt = 300, _t = /* @__PURE__ */ d({
1266
+ }), pt = { class: "reel-viewport" }, mt = ["data-active-post-id", "data-active-media-index"], ht = ["role", "data-status"], gt = 2, _t = 300, vt = /* @__PURE__ */ d({
1223
1267
  __name: "ReelFeed",
1224
1268
  props: {
1225
1269
  initialPostId: {},
@@ -1257,7 +1301,7 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
1257
1301
  ],
1258
1302
  setup(t, { expose: n, emit: i }) {
1259
1303
  let l = t, u = i, d = w(null), f = w(null), p = l.initialPostId === null || l.initialPostId === void 0 ? -1 : l.items.findIndex((e) => e.postId === l.initialPostId), g = w(Math.max(0, p)), x = w(!1), C = w(!1), D = 0, k = null, A = null, j = null, N = r(() => ({ gridTemplateRows: `repeat(${l.items.length}, 100cqh)` })), I = r(() => {
1260
- let e = Math.max(0, g.value - ht), t = Math.min(l.items.length - 1, g.value + ht);
1304
+ let e = Math.max(0, g.value - gt), t = Math.min(l.items.length - 1, g.value + gt);
1261
1305
  return l.items.slice(e, t + 1).map((t, n) => ({
1262
1306
  fetchPriority: e + n === g.value ? "high" : "low",
1263
1307
  index: e + n,
@@ -1274,7 +1318,7 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
1274
1318
  if (!e) return "";
1275
1319
  let t = P(e, z.value);
1276
1320
  return l.mediaSource === "original" ? t.src : t.preview.src;
1277
- }), H = r(() => B.value === "ready" && Oe(V.value)), W = r(() => [
1321
+ }), H = r(() => B.value === "ready" && Oe(V.value)), te = r(() => [
1278
1322
  L.value,
1279
1323
  z.value,
1280
1324
  l.items.length,
@@ -1282,49 +1326,49 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
1282
1326
  l.reelAutoAdvance.enabled,
1283
1327
  l.reelAutoAdvance.includePostItems,
1284
1328
  l.reelAutoAdvance.intervalMs
1285
- ].join(":")), G = r(() => {
1329
+ ].join(":")), ne = r(() => {
1286
1330
  let e = R.value, t = !!(e && l.reelAutoAdvance.includePostItems && z.value < M(e).length - 1), n = l.reelAutoAdvance.intervalMs / 1e3;
1287
1331
  return `Auto advance to the next ${t ? "post item" : "post"} in ${n}s`;
1288
- }), ee = r(() => l.reelAutoAdvance.enabled && l.reelForward.status === "idle" && R.value !== void 0 && B.value !== "loading" && !H.value), te = r(() => !l.infiniteScroll || l.items.length <= 1), ne = r(() => l.reelForward.status === "loading" ? "Loading the next media…" : l.reelForward.status === "error" ? "Unable to load the next media." : "You reached the end of this feed.");
1289
- function re(e) {
1332
+ }), re = r(() => l.reelAutoAdvance.enabled && l.reelForward.status === "idle" && R.value !== void 0 && B.value !== "loading" && !H.value), W = r(() => !l.infiniteScroll || l.items.length <= 1), ie = r(() => l.reelForward.status === "loading" ? "Loading the next media…" : l.reelForward.status === "error" ? "Unable to load the next media." : "You reached the end of this feed.");
1333
+ function G(e) {
1290
1334
  return { gridRow: `${e + 1}` };
1291
1335
  }
1292
- function ie(e) {
1336
+ function K(e) {
1293
1337
  let t = D || e.clientHeight;
1294
1338
  return t <= 0 || l.items.length === 0 ? 0 : Math.min(l.items.length - 1, Math.max(0, Math.round(e.scrollTop / t)));
1295
1339
  }
1296
- function ae(e) {
1340
+ function q(e) {
1297
1341
  let t = e.currentTarget;
1298
1342
  if (!t) return;
1299
1343
  let n = D || t.clientHeight, r = Math.max(0, l.items.length - 1) * n;
1300
- x.value = l.items.length > 0 && t.scrollTop > r + 1, C.value || (g.value = ie(t)), !l.loadMoreLocked && l.infiniteScroll && K(t) && u("loadMore");
1344
+ x.value = l.items.length > 0 && t.scrollTop > r + 1, C.value || (g.value = K(t)), !l.loadMoreLocked && l.infiniteScroll && U(t) && u("loadMore");
1301
1345
  }
1302
- function q() {
1346
+ function J() {
1303
1347
  let e = d.value;
1304
- e && (x.value = !1, se(!0), D = e.clientHeight, e.scrollTop = g.value * D, A !== null && cancelAnimationFrame(A), A = requestAnimationFrame(() => {
1348
+ e && (x.value = !1, oe(!0), D = e.clientHeight, e.scrollTop = g.value * D, A !== null && cancelAnimationFrame(A), A = requestAnimationFrame(() => {
1305
1349
  e.scrollTop = g.value * e.clientHeight, D = e.clientHeight, A = null;
1306
- }), oe());
1350
+ }), ae());
1307
1351
  }
1308
- function oe() {
1352
+ function ae() {
1309
1353
  j !== null && clearTimeout(j), j = setTimeout(() => {
1310
1354
  j = null;
1311
1355
  let e = d.value;
1312
- e && (D = e.clientHeight, e.scrollTop = g.value * D), se(!1);
1356
+ e && (D = e.clientHeight, e.scrollTop = g.value * D), oe(!1);
1313
1357
  }, 120);
1314
1358
  }
1315
- function J() {
1316
- se(!0);
1359
+ function Y() {
1360
+ oe(!0);
1317
1361
  let e = d.value;
1318
- e && (D = e.clientHeight, e.scrollTop = g.value * D), oe();
1362
+ e && (D = e.clientHeight, e.scrollTop = g.value * D), ae();
1319
1363
  }
1320
- function se(e) {
1364
+ function oe(e) {
1321
1365
  C.value = e, d.value?.toggleAttribute("data-resizing", e);
1322
1366
  }
1323
- function ce() {
1367
+ function se() {
1324
1368
  let e = d.value;
1325
- !l.loadMoreLocked && e && K(e) && u("loadMore");
1369
+ !l.loadMoreLocked && e && U(e) && u("loadMore");
1326
1370
  }
1327
- function Y(e) {
1371
+ function X(e) {
1328
1372
  let t = R.value;
1329
1373
  if (!t) return !1;
1330
1374
  let n = M(t).length;
@@ -1332,28 +1376,28 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
1332
1376
  let r = (z.value + e + n) % n;
1333
1377
  return u("mediaChange", t.postId, r), !0;
1334
1378
  }
1335
- function le(e) {
1379
+ function ce(e) {
1336
1380
  let t = g.value + e;
1337
- return !d.value || t < 0 || t >= l.items.length ? !1 : (ue(t), !0);
1381
+ return !d.value || t < 0 || t >= l.items.length ? !1 : (de(t), !0);
1338
1382
  }
1339
- function X() {
1383
+ function le() {
1340
1384
  return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
1341
1385
  }
1342
- function Z(e) {
1386
+ function ue(e) {
1343
1387
  let t = d.value;
1344
1388
  if (!t) return Promise.resolve();
1345
1389
  let n = e * (D || t.clientHeight);
1346
- return g.value = e, lt(t, n, X());
1390
+ return g.value = e, ut(t, n, le());
1347
1391
  }
1348
- function ue(e) {
1349
- Z(e);
1392
+ function de(e) {
1393
+ ue(e);
1350
1394
  }
1351
- async function de(e) {
1395
+ async function fe(e) {
1352
1396
  let t = l.items.findIndex((t) => t.postId === e);
1353
- return t < 0 || t === g.value ? !1 : (await Z(t), !0);
1397
+ return t < 0 || t === g.value ? !1 : (await ue(t), !0);
1354
1398
  }
1355
- async function fe(e) {
1356
- return Y(e) ? (X() || await new Promise((e) => setTimeout(e, gt)), !0) : !1;
1399
+ async function Z(e) {
1400
+ return X(e) ? (le() || await new Promise((e) => setTimeout(e, _t)), !0) : !1;
1357
1401
  }
1358
1402
  function pe() {
1359
1403
  if (!l.reelAutoAdvance.enabled) return;
@@ -1368,30 +1412,30 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
1368
1412
  l.hasNext && !l.loadMoreLocked && u("loadMore");
1369
1413
  return;
1370
1414
  }
1371
- l.reelAutoAdvance.includePostItems && (l.mediaIndices.get(n.postId) ?? 0) !== 0 && u("mediaChange", n.postId, 0), ue(t);
1415
+ l.reelAutoAdvance.includePostItems && (l.mediaIndices.get(n.postId) ?? 0) !== 0 && u("mediaChange", n.postId, 0), de(t);
1372
1416
  }
1373
1417
  function me(e, t) {
1374
1418
  !l.reelAutoAdvance.enabled || e !== L.value || t !== z.value || !H.value || pe();
1375
1419
  }
1376
1420
  return O(d, (e) => {
1377
- k?.disconnect(), k = null, e && (D = e.clientHeight, !(typeof ResizeObserver > "u") && (k = new ResizeObserver(q), k.observe(e)));
1421
+ k?.disconnect(), k = null, e && (D = e.clientHeight, !(typeof ResizeObserver > "u") && (k = new ResizeObserver(J), k.observe(e)));
1378
1422
  }), O(() => l.items.length, async (e) => {
1379
1423
  let t = l.initialPostId, n = t == null ? -1 : l.items.findIndex(({ postId: e }) => e === t);
1380
- g.value = n >= 0 ? n : Math.min(g.value, Math.max(0, e - 1)), await m(), q();
1424
+ g.value = n >= 0 ? n : Math.min(g.value, Math.max(0, e - 1)), await m(), J();
1381
1425
  }), O(L, (e) => {
1382
1426
  e !== void 0 && u("activeChange", e);
1383
1427
  }, { immediate: !0 }), y(() => {
1384
- window.addEventListener("resize", J), window.addEventListener("orientationchange", J), p >= 0 && m(q);
1428
+ window.addEventListener("resize", Y), window.addEventListener("orientationchange", Y), p >= 0 && m(J);
1385
1429
  }), v(() => {
1386
- window.removeEventListener("resize", J), window.removeEventListener("orientationchange", J), k?.disconnect(), A !== null && cancelAnimationFrame(A), j !== null && clearTimeout(j);
1430
+ window.removeEventListener("resize", Y), window.removeEventListener("orientationchange", Y), k?.disconnect(), A !== null && cancelAnimationFrame(A), j !== null && clearTimeout(j);
1387
1431
  }), n({
1388
1432
  activeIndex: g,
1389
1433
  activePostId: L,
1390
- changeActiveMedia: Y,
1391
- loadIfNearBottom: ce,
1392
- moveActivePost: le,
1393
- transitionActiveMedia: fe,
1394
- transitionActivePost: de
1434
+ changeActiveMedia: X,
1435
+ loadIfNearBottom: se,
1436
+ moveActivePost: ce,
1437
+ transitionActiveMedia: Z,
1438
+ transitionActivePost: fe
1395
1439
  }), (n, r) => (b(), s("main", {
1396
1440
  class: h(["reel-shell", {
1397
1441
  "reel-shell--has-footer": !!t.cardFooter,
@@ -1421,19 +1465,19 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
1421
1465
  "style",
1422
1466
  "total"
1423
1467
  ])) : o("", !0),
1424
- c("div", ft, [c("div", {
1468
+ c("div", pt, [c("div", {
1425
1469
  ref_key: "galleryElement",
1426
1470
  ref: d,
1427
1471
  class: "gallery-shell reel-feed",
1428
1472
  "data-active-post-id": L.value,
1429
1473
  "data-active-media-index": z.value,
1430
- onScrollPassive: ae
1474
+ onScrollPassive: q
1431
1475
  }, [t.reelForward.status === "idle" ? (b(), s("section", {
1432
1476
  key: 1,
1433
1477
  class: "reel-track",
1434
1478
  style: _(N.value),
1435
1479
  "aria-label": "Media gallery"
1436
- }, [(b(!0), s(e, null, S(I.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a($e, {
1480
+ }, [(b(!0), s(e, null, S(I.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(et, {
1437
1481
  key: n.postId,
1438
1482
  active: r === g.value && !x.value,
1439
1483
  "advance-on-media-end": l.reelAutoAdvance.enabled && r === g.value,
@@ -1442,7 +1486,7 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
1442
1486
  "fetch-priority": e,
1443
1487
  index: r,
1444
1488
  item: n,
1445
- "item-style": re(r),
1489
+ "item-style": G(r),
1446
1490
  "media-card": t.mediaCard,
1447
1491
  layout: "reel",
1448
1492
  "loaded-count": t.items.length,
@@ -1479,12 +1523,12 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
1479
1523
  class: "reel-forward-status",
1480
1524
  role: t.reelForward.status === "error" ? "alert" : "status",
1481
1525
  "data-status": t.reelForward.status
1482
- }, [c("p", null, T(ne.value), 1), t.reelForward.status === "error" || t.reelForward.status === "end" ? (b(), s("button", {
1526
+ }, [c("p", null, T(ie.value), 1), t.reelForward.status === "error" || t.reelForward.status === "end" ? (b(), s("button", {
1483
1527
  key: 0,
1484
1528
  class: "reel-forward-retry",
1485
1529
  type: "button",
1486
1530
  onClick: r[0] ||= (e) => u("retryForward")
1487
- }, " Retry ")) : o("", !0)], 8, mt)), t.reelForward.status === "idle" ? (b(), a(U, {
1531
+ }, " Retry ")) : o("", !0)], 8, ht)), t.reelForward.status === "idle" ? (b(), a(ee, {
1488
1532
  key: 2,
1489
1533
  actions: t.feedFooterActions,
1490
1534
  "can-retry-end": t.canRetryEnd,
@@ -1493,7 +1537,7 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
1493
1537
  "has-next": t.hasNext,
1494
1538
  "is-loading": t.isLoadingMore,
1495
1539
  "load-more-locked": t.loadMoreLocked,
1496
- "show-load-more": te.value,
1540
+ "show-load-more": W.value,
1497
1541
  state: t.state,
1498
1542
  onLoadMore: r[1] ||= (e) => u("loadMore"),
1499
1543
  onRetryEnd: r[2] ||= (e) => u("retryEnd")
@@ -1507,7 +1551,7 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
1507
1551
  "load-more-locked",
1508
1552
  "show-load-more",
1509
1553
  "state"
1510
- ])) : o("", !0)], 40, pt), c("div", {
1554
+ ])) : o("", !0)], 40, mt), c("div", {
1511
1555
  ref_key: "reelControlsElement",
1512
1556
  ref: f,
1513
1557
  class: "reel-media-controls-host",
@@ -1535,24 +1579,24 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
1535
1579
  "style",
1536
1580
  "total"
1537
1581
  ])) : o("", !0),
1538
- ee.value ? (b(), a(dt, {
1539
- key: W.value,
1582
+ re.value ? (b(), a(ft, {
1583
+ key: te.value,
1540
1584
  "duration-ms": t.reelAutoAdvance.intervalMs,
1541
- label: G.value,
1585
+ label: ne.value,
1542
1586
  onComplete: pe
1543
1587
  }, null, 8, ["duration-ms", "label"])) : o("", !0)
1544
1588
  ], 2));
1545
1589
  }
1546
- }), vt = ["data-info-sheet-open", "data-info-sheet-mode"], yt = ["aria-hidden", "inert"], bt = {
1590
+ }), yt = ["data-info-sheet-open", "data-info-sheet-mode"], bt = ["aria-hidden", "inert"], xt = {
1547
1591
  key: 0,
1548
1592
  class: "reel-info-sheet-layer",
1549
1593
  "data-test": "reel-info-sheet"
1550
- }, xt = [
1594
+ }, St = [
1551
1595
  "role",
1552
1596
  "aria-modal",
1553
1597
  "tabindex",
1554
1598
  "data-active-post-id"
1555
- ], St = /* @__PURE__ */ d({
1599
+ ], Ct = /* @__PURE__ */ d({
1556
1600
  __name: "ReelLayout",
1557
1601
  props: {
1558
1602
  forwardIndex: { default: null },
@@ -1673,7 +1717,7 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
1673
1717
  class: "reel-layout-main",
1674
1718
  "aria-hidden": e.infoSheetOverlay && A.value || void 0,
1675
1719
  inert: e.infoSheetOverlay && A.value || void 0
1676
- }, [u(_t, {
1720
+ }, [u(vt, {
1677
1721
  ref_key: "reelFeed",
1678
1722
  ref: p,
1679
1723
  "can-retry-end": e.canRetryEnd,
@@ -1724,8 +1768,8 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
1724
1768
  "reel-forward",
1725
1769
  "state",
1726
1770
  "total"
1727
- ])], 8, yt), u(n, { name: "vibe-info-sheet" }, {
1728
- default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", bt, [c("aside", {
1771
+ ])], 8, bt), u(n, { name: "vibe-info-sheet" }, {
1772
+ default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", xt, [c("aside", {
1729
1773
  ref_key: "sheetElement",
1730
1774
  ref: _,
1731
1775
  class: "reel-info-sheet",
@@ -1734,11 +1778,11 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
1734
1778
  "aria-modal": e.infoSheetOverlay ? "true" : void 0,
1735
1779
  tabindex: e.infoSheetOverlay ? -1 : void 0,
1736
1780
  "data-active-post-id": T.value?.postId
1737
- }, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8, xt)])) : o("", !0)]),
1781
+ }, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8, St)])) : o("", !0)]),
1738
1782
  _: 1
1739
- })], 10, vt));
1783
+ })], 10, yt));
1740
1784
  }
1741
- }), Ct = 35, wt = 420, Tt = /* @__PURE__ */ d({
1785
+ }), wt = 35, Tt = 420, Et = /* @__PURE__ */ d({
1742
1786
  __name: "VibeSurface",
1743
1787
  props: {
1744
1788
  canRetryEnd: { type: Boolean },
@@ -1771,82 +1815,82 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
1771
1815
  });
1772
1816
  });
1773
1817
  }
1774
- function U(e, t, n) {
1818
+ function ee(e, t, n) {
1775
1819
  let r = F(e, t);
1776
1820
  A.value.get(r) !== n && (A.value = new Map(A.value).set(r, n));
1777
1821
  }
1778
- function W(e, t, n) {
1822
+ function te(e, t, n) {
1779
1823
  let r = F(e, t);
1780
1824
  j.value.get(r) !== n && (j.value = new Map(j.value).set(r, n));
1781
1825
  }
1782
- function G(e, t) {
1783
- U(e, t, "error");
1826
+ function ne(e, t) {
1827
+ ee(e, t, "error");
1784
1828
  }
1785
- function K(e, t) {
1786
- U(e, t, "ready");
1829
+ function U(e, t) {
1830
+ ee(e, t, "ready");
1787
1831
  }
1788
- function te(e, t) {
1789
- W(e, t, "error");
1832
+ function W(e, t) {
1833
+ te(e, t, "error");
1790
1834
  }
1791
- function ne(e, t) {
1792
- W(e, t, "ready");
1835
+ function ie(e, t) {
1836
+ te(e, t, "ready");
1793
1837
  }
1794
- function re(e, t) {
1838
+ function G(e, t) {
1795
1839
  if (l.state.reelMediaSource === "original") {
1796
- te(e, t);
1840
+ W(e, t);
1797
1841
  return;
1798
1842
  }
1799
- G(e, t);
1843
+ ne(e, t);
1800
1844
  }
1801
- function ie(e, t) {
1845
+ function K(e, t) {
1802
1846
  if (l.state.reelMediaSource === "original") {
1803
- ne(e, t);
1847
+ ie(e, t);
1804
1848
  return;
1805
1849
  }
1806
- K(e, t);
1850
+ U(e, t);
1807
1851
  }
1808
- function ae(e, t) {
1852
+ function q(e, t) {
1809
1853
  let n = l.state.items.find((t) => t.postId === e);
1810
1854
  if (!n) return;
1811
1855
  let r = N(n, t);
1812
1856
  (l.state.mediaIndices.get(e) ?? 0) !== r && (l.state.mediaIndices = new Map(l.state.mediaIndices).set(e, r));
1813
1857
  }
1814
- async function q() {
1858
+ async function J() {
1815
1859
  await m(), (l.state.layout === "reel" || l.state.reelOrigin === "masonry" ? p.value : f.value)?.loadIfNearBottom();
1816
1860
  }
1817
- function oe(e) {
1861
+ function ae(e) {
1818
1862
  return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.changeActiveMedia?.(e) ?? !1;
1819
1863
  }
1820
- function J(e) {
1864
+ function Y(e) {
1821
1865
  return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.moveActivePost?.(e) ?? !1;
1822
1866
  }
1823
- function se() {
1867
+ function oe() {
1824
1868
  return l.state.layout !== "masonry" || l.state.reelOrigin === "masonry" ? null : f.value?.getScrollElement?.() ?? null;
1825
1869
  }
1826
- function ce(e, t) {
1827
- z = e, B = t === "keyboard", x.value = Z(e), d("openReel", e), m(() => h.value?.focus());
1870
+ function se(e, t) {
1871
+ z = e, B = t === "keyboard", x.value = ue(e), d("openReel", e), m(() => h.value?.focus());
1828
1872
  }
1829
- function Y(e) {
1873
+ function X(e) {
1830
1874
  let t = g.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [];
1831
1875
  return Array.from(t).find((t) => t.dataset.postId === String(e)) ?? null;
1832
1876
  }
1833
- function le(e) {
1877
+ function ce(e) {
1834
1878
  if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || V()) return 0;
1835
- let t = [...new Set(e)], n = t.filter(Y);
1879
+ let t = [...new Set(e)], n = t.filter(X);
1836
1880
  if (n.length === 0) return 0;
1837
1881
  let r = new Map(D.value);
1838
1882
  return n.forEach((e, t) => {
1839
- r.set(e, t * Ct);
1840
- }), C.value = new Set([...C.value].filter((e) => !n.includes(e))), E.value = new Set([...E.value, ...t]), D.value = r, wt + (n.length - 1) * Ct;
1883
+ r.set(e, t * wt);
1884
+ }), C.value = new Set([...C.value].filter((e) => !n.includes(e))), E.value = new Set([...E.value, ...t]), D.value = r, Tt + (n.length - 1) * wt;
1841
1885
  }
1842
- function X(e, t) {
1843
- let n = Y(e), r = n?.querySelector(".media-card-activator") ?? n;
1886
+ function le(e, t) {
1887
+ let n = X(e), r = n?.querySelector(".media-card-activator") ?? n;
1844
1888
  r && (r.classList.toggle("media-card-focus-silent", !t), t || r.addEventListener("blur", () => {
1845
1889
  r.classList.remove("media-card-focus-silent");
1846
1890
  }, { once: !0 }), r?.focus({ preventScroll: !0 }));
1847
1891
  }
1848
- function Z(e) {
1849
- let t = g.value, n = Y(e);
1892
+ function ue(e) {
1893
+ let t = g.value, n = X(e);
1850
1894
  if (t === null || n === null) return {};
1851
1895
  let r = t.getBoundingClientRect(), i = n.getBoundingClientRect();
1852
1896
  return {
@@ -1856,19 +1900,19 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
1856
1900
  "--vibe-reel-origin-left": `${Math.max(0, i.left - r.left)}px`
1857
1901
  };
1858
1902
  }
1859
- function ue() {
1903
+ function de() {
1860
1904
  l.state.reelOrigin === "masonry" && (z ??= l.state.activeReelPostId, S.value = !0, d("closeReel"));
1861
1905
  }
1862
- function de() {
1906
+ function fe() {
1863
1907
  let e = z, t = B;
1864
1908
  S.value = !1, z = null, B = !1, x.value = {}, m(() => {
1865
- e !== null && X(e, t);
1909
+ e !== null && le(e, t);
1866
1910
  });
1867
1911
  }
1868
- function fe(e) {
1912
+ function Z(e) {
1869
1913
  let t = l.state.layout === "reel" || l.state.reelOrigin === "masonry";
1870
1914
  if (e.key === "Escape" && l.state.reelOrigin === "masonry") {
1871
- e.preventDefault(), l.state.reelInfoSheetOverlay && l.state.reelInfoSheet.enabled && d("reelInfoSheetChange", !1), ue();
1915
+ e.preventDefault(), l.state.reelInfoSheetOverlay && l.state.reelInfoSheet.enabled && d("reelInfoSheetChange", !1), de();
1872
1916
  return;
1873
1917
  }
1874
1918
  if (e.key === "Escape" && t && l.state.reelInfoSheet.enabled) {
@@ -1893,23 +1937,23 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
1893
1937
  let t = T.value.get(e);
1894
1938
  t !== void 0 && r.set(e, t);
1895
1939
  }), t.forEach((e, t) => {
1896
- r.set(e, t * Ct);
1940
+ r.set(e, t * wt);
1897
1941
  }), T.value = r, C.value = new Set([...C.value, ...t]), H();
1898
- }, { flush: "sync" }), y(() => window.addEventListener("keydown", fe)), v(() => {
1899
- window.removeEventListener("keydown", fe), R !== null && cancelAnimationFrame(R);
1942
+ }, { flush: "sync" }), y(() => window.addEventListener("keydown", Z)), v(() => {
1943
+ window.removeEventListener("keydown", Z), R !== null && cancelAnimationFrame(R);
1900
1944
  }), i({
1901
- changeActiveReelMedia: oe,
1902
- getAutoScrollElement: se,
1903
- loadIfNearBottom: q,
1904
- moveActiveReelPost: J,
1905
- startItemRemoval: le,
1945
+ changeActiveReelMedia: ae,
1946
+ getAutoScrollElement: oe,
1947
+ loadIfNearBottom: J,
1948
+ moveActiveReelPost: Y,
1949
+ startItemRemoval: ce,
1906
1950
  transitionActiveReelMedia: (e) => p.value?.transitionActiveMedia?.(e) ?? Promise.resolve(!1),
1907
1951
  transitionActiveReelPost: (e) => p.value?.transitionActivePost?.(e) ?? Promise.resolve(!1)
1908
1952
  }), (r, i) => (b(), s("div", {
1909
1953
  ref_key: "surfaceElement",
1910
1954
  ref: g,
1911
1955
  class: "vibe-surface"
1912
- }, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(St, {
1956
+ }, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(Ct, {
1913
1957
  key: 0,
1914
1958
  ref_key: "reelRenderer",
1915
1959
  ref: p,
@@ -1941,10 +1985,10 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
1941
1985
  total: t.state.total,
1942
1986
  onActiveChange: i[0] ||= (e) => d("activeReelChange", e),
1943
1987
  onCloseInfoSheet: i[1] ||= (e) => d("reelInfoSheetChange", !1),
1944
- onError: re,
1988
+ onError: G,
1945
1989
  onLoadMore: i[2] ||= (e) => d("loadMore"),
1946
- onMediaChange: ae,
1947
- onReady: ie,
1990
+ onMediaChange: q,
1991
+ onReady: K,
1948
1992
  onRetryEnd: i[3] ||= (e) => d("retryEnd"),
1949
1993
  onRetryForward: i[4] ||= (e) => d("retryForward")
1950
1994
  }, null, 8, [
@@ -1973,7 +2017,7 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
1973
2017
  "reel-forward",
1974
2018
  "state",
1975
2019
  "total"
1976
- ])) : t.state.error || t.state.isLoading || t.state.items.length === 0 && t.state.reelForward.status === "idle" ? (b(), a(ee, {
2020
+ ])) : t.state.error || t.state.isLoading || t.state.items.length === 0 && t.state.reelForward.status === "idle" ? (b(), a(re, {
1977
2021
  key: 1,
1978
2022
  actions: t.feedFooterActions,
1979
2023
  "can-retry-end": t.canRetryEnd,
@@ -1986,7 +2030,7 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
1986
2030
  "can-retry-end",
1987
2031
  "feed-footer",
1988
2032
  "state"
1989
- ])) : (b(), s(e, { key: 2 }, [u(st, {
2033
+ ])) : (b(), s(e, { key: 2 }, [u(ct, {
1990
2034
  ref_key: "masonryRenderer",
1991
2035
  ref: f,
1992
2036
  "can-retry-end": t.canRetryEnd,
@@ -2010,11 +2054,11 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
2010
2054
  suspended: t.state.reelOrigin === "masonry" || S.value,
2011
2055
  state: M.value,
2012
2056
  total: t.state.total,
2013
- onActivate: ce,
2014
- onError: G,
2057
+ onActivate: se,
2058
+ onError: ne,
2015
2059
  onLoadMore: i[7] ||= (e) => d("loadMore"),
2016
- onMediaChange: ae,
2017
- onReady: K,
2060
+ onMediaChange: q,
2061
+ onReady: U,
2018
2062
  onRetryEnd: i[8] ||= (e) => d("retryEnd")
2019
2063
  }, null, 8, [
2020
2064
  "can-retry-end",
@@ -2040,7 +2084,7 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
2040
2084
  "total"
2041
2085
  ]), u(n, {
2042
2086
  name: "vibe-reel-viewer",
2043
- onAfterLeave: de
2087
+ onAfterLeave: fe
2044
2088
  }, {
2045
2089
  default: k(() => [t.state.reelOrigin === "masonry" ? (b(), s("section", {
2046
2090
  key: 0,
@@ -2052,7 +2096,7 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
2052
2096
  "aria-modal": "true",
2053
2097
  tabindex: "-1",
2054
2098
  style: _(x.value)
2055
- }, [u(St, {
2099
+ }, [u(Ct, {
2056
2100
  ref_key: "reelRenderer",
2057
2101
  ref: p,
2058
2102
  "can-retry-end": t.canRetryEnd,
@@ -2083,10 +2127,10 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
2083
2127
  total: t.state.total,
2084
2128
  onActiveChange: i[9] ||= (e) => d("activeReelChange", e),
2085
2129
  onCloseInfoSheet: i[10] ||= (e) => d("reelInfoSheetChange", !1),
2086
- onError: te,
2130
+ onError: W,
2087
2131
  onLoadMore: i[11] ||= (e) => d("loadMore"),
2088
- onMediaChange: ae,
2089
- onReady: ne,
2132
+ onMediaChange: q,
2133
+ onReady: ie,
2090
2134
  onRetryEnd: i[12] ||= (e) => d("retryEnd"),
2091
2135
  onRetryForward: i[13] ||= (e) => d("retryForward")
2092
2136
  }, null, 8, [
@@ -2121,7 +2165,7 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
2121
2165
  });
2122
2166
  //#endregion
2123
2167
  //#region src/core/page.ts
2124
- function Et(e) {
2168
+ function Dt(e) {
2125
2169
  if (!e || typeof e != "object" || !Array.isArray(e.items)) throw TypeError("Vibe loadPage must resolve to a page with an items array.");
2126
2170
  if (e.next !== null && typeof e.next != "string" && typeof e.next != "number") throw TypeError("Vibe page next must be a string, number, or null.");
2127
2171
  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.");
@@ -2133,32 +2177,32 @@ function Q(e, t) {
2133
2177
  }
2134
2178
  //#endregion
2135
2179
  //#region src/core/requestDelay.ts
2136
- var Dt = 2e3, Ot = 1e4, kt = 250, At = {
2180
+ var Ot = 2e3, kt = 1e4, At = 250, jt = {
2137
2181
  delayRemainingMs: null,
2138
2182
  nextRequestAt: null
2139
2183
  };
2140
- function jt(e, t) {
2184
+ function Mt(e, t) {
2141
2185
  return e === void 0 ? t : Math.floor(e);
2142
2186
  }
2143
- function Mt(e, t) {
2187
+ function Nt(e, t) {
2144
2188
  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.`);
2145
2189
  }
2146
- function Nt(e, t = {}) {
2147
- let n = jt(t.delayStepMs, Dt), r = jt(t.delayMaxMs, Ot);
2190
+ function Pt(e, t = {}) {
2191
+ let n = Mt(t.delayStepMs, Ot), r = Mt(t.delayMaxMs, kt);
2148
2192
  return Math.min(Math.max(0, e) * n, r);
2149
2193
  }
2150
2194
  function $(e) {
2151
- if (e == null || !Number.isFinite(e)) return { ...At };
2195
+ if (e == null || !Number.isFinite(e)) return { ...jt };
2152
2196
  let t = Math.max(0, Math.floor(e - Date.now()));
2153
2197
  return t > 0 ? {
2154
2198
  delayRemainingMs: t,
2155
2199
  nextRequestAt: e
2156
- } : { ...At };
2200
+ } : { ...jt };
2157
2201
  }
2158
- async function Pt({ delayMs: e, onChange: t, signal: n }) {
2202
+ async function Ft({ delayMs: e, onChange: t, signal: n }) {
2159
2203
  if (n.aborted) throw new DOMException("Aborted", "AbortError");
2160
2204
  if (e <= 0) {
2161
- t({ ...At });
2205
+ t({ ...jt });
2162
2206
  return;
2163
2207
  }
2164
2208
  let r = Date.now() + e;
@@ -2166,9 +2210,9 @@ async function Pt({ delayMs: e, onChange: t, signal: n }) {
2166
2210
  delayRemainingMs: e,
2167
2211
  nextRequestAt: r
2168
2212
  }), await new Promise((i, a) => {
2169
- let o = !1, s = setInterval(f, kt), c = setTimeout(() => u(), e);
2213
+ let o = !1, s = setInterval(f, At), c = setTimeout(() => u(), e);
2170
2214
  function l() {
2171
- clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...At });
2215
+ clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...jt });
2172
2216
  }
2173
2217
  function u(e) {
2174
2218
  o || (o = !0, l(), e ? a(e) : i());
@@ -2183,13 +2227,13 @@ async function Pt({ delayMs: e, onChange: t, signal: n }) {
2183
2227
  n.addEventListener("abort", d, { once: !0 });
2184
2228
  });
2185
2229
  }
2186
- var Ft = class {
2230
+ var It = class {
2187
2231
  interval = null;
2188
2232
  constructor(e) {
2189
2233
  this.onChange = e;
2190
2234
  }
2191
2235
  clear() {
2192
- this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...At });
2236
+ this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...jt });
2193
2237
  }
2194
2238
  sync(e) {
2195
2239
  this.clear();
@@ -2197,22 +2241,22 @@ var Ft = class {
2197
2241
  this.onChange(t), t.delayRemainingMs !== null && (this.interval = setInterval(() => {
2198
2242
  let t = $(e);
2199
2243
  this.onChange(t), t.delayRemainingMs === null && this.clear();
2200
- }, kt));
2244
+ }, At));
2201
2245
  }
2202
2246
  };
2203
- function It(e, t = !0) {
2247
+ function Lt(e, t = !0) {
2204
2248
  return e.maxAdditionalPages === "unlimited" ? Infinity : (e.maxAdditionalPages ?? 10) + (t ? 1 : 0);
2205
2249
  }
2206
- function Lt(e) {
2250
+ function Rt(e) {
2207
2251
  return `${typeof e}:${String(e)}`;
2208
2252
  }
2209
- function Rt(e, t) {
2253
+ function zt(e, t) {
2210
2254
  if (!Number.isInteger(e) || e <= 0) throw TypeError(`Vibe ${t} must be a positive integer.`);
2211
2255
  }
2212
- function zt(e) {
2256
+ function Bt(e) {
2213
2257
  if (!e) return;
2214
- if (Rt(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
2215
- Mt(e, "frontend autofill");
2258
+ if (zt(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
2259
+ Nt(e, "frontend autofill");
2216
2260
  let t = e.maxAdditionalPages;
2217
2261
  if (t !== void 0 && t !== "unlimited" && (!Number.isInteger(t) || t < 0)) throw TypeError("Vibe autofill maxAdditionalPages must be a non-negative integer or \"unlimited\".");
2218
2262
  return;
@@ -2224,7 +2268,7 @@ function zt(e) {
2224
2268
  if (t.pageSize !== e.pageSize) throw TypeError("Vibe backend autofill initialSession pageSize must match autofill pageSize.");
2225
2269
  }
2226
2270
  }
2227
- function Bt(e, t, n = !0) {
2271
+ function Vt(e, t, n = !0) {
2228
2272
  if (!e) return {
2229
2273
  cycleId: null,
2230
2274
  delayRemainingMs: null,
@@ -2258,7 +2302,7 @@ function Bt(e, t, n = !0) {
2258
2302
  strategy: e.strategy
2259
2303
  };
2260
2304
  }
2261
- function Vt(e) {
2305
+ function Ht(e) {
2262
2306
  return [
2263
2307
  "cancelling",
2264
2308
  "filling",
@@ -2266,9 +2310,9 @@ function Vt(e) {
2266
2310
  "waiting"
2267
2311
  ].includes(e.status);
2268
2312
  }
2269
- async function Ht(e, t, n) {
2313
+ async function Ut(e, t, n) {
2270
2314
  let r = t.autofill;
2271
- if (!Vt(r) || !r.cycleId) return;
2315
+ if (!Ht(r) || !r.cycleId) return;
2272
2316
  let i = {
2273
2317
  cycleId: r.cycleId,
2274
2318
  feedKey: r.feedKey ?? "",
@@ -2281,20 +2325,20 @@ async function Ht(e, t, n) {
2281
2325
  throw r.error = e, r.status = "error", e;
2282
2326
  }
2283
2327
  }
2284
- function Ut(e, t, n) {
2328
+ function Wt(e, t, n) {
2285
2329
  return e?.strategy === "backend" && t.feedKey === e.feedKey && t.sessionId === n.sessionId;
2286
2330
  }
2287
- async function Wt({ existingItems: e, initialCursor: t, loadPage: n, maximumRequests: r, onCollection: i, onDelayChange: a, onProgress: o, options: s, receivedOffset: c = 0, requestOffset: l = 0, signal: u }) {
2288
- let d = [], f = [...e], p = /* @__PURE__ */ new Set(), m = r ?? It(s), h = t, g = t, _ = 0, v;
2331
+ async function Gt({ existingItems: e, initialCursor: t, loadPage: n, maximumRequests: r, onCollection: i, onDelayChange: a, onProgress: o, options: s, receivedOffset: c = 0, requestOffset: l = 0, signal: u }) {
2332
+ let d = [], f = [...e], p = /* @__PURE__ */ new Set(), m = r ?? Lt(s), h = t, g = t, _ = 0, v;
2289
2333
  for (; _ < m;) {
2290
- let e = Lt(h);
2334
+ let e = Rt(h);
2291
2335
  if (p.has(e)) throw Error("Vibe autofill received a repeated cursor.");
2292
- p.add(e), await Pt({
2293
- delayMs: Nt(l + _, s),
2336
+ p.add(e), await Ft({
2337
+ delayMs: Pt(l + _, s),
2294
2338
  onChange: a,
2295
2339
  signal: u
2296
2340
  });
2297
- let t = Et(await n({
2341
+ let t = Dt(await n({
2298
2342
  cursor: h,
2299
2343
  signal: u
2300
2344
  }));
@@ -2337,12 +2381,12 @@ async function Wt({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
2337
2381
  }
2338
2382
  //#endregion
2339
2383
  //#region src/core/autofillController.ts
2340
- var Gt = class {
2384
+ var Kt = class {
2341
2385
  collection = null;
2342
2386
  cycle = 0;
2343
2387
  delayCountdown;
2344
2388
  constructor(e) {
2345
- this.context = e, this.delayCountdown = new Ft((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
2389
+ this.context = e, this.delayCountdown = new It((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
2346
2390
  }
2347
2391
  beginCycle() {
2348
2392
  let { options: e, state: t } = this.context;
@@ -2350,14 +2394,14 @@ var Gt = class {
2350
2394
  this.clear();
2351
2395
  let n = `vibe-autofill-${Date.now().toString(36)}-${++this.cycle}`;
2352
2396
  return t.autofill = {
2353
- ...Bt(e, void 0, !1),
2397
+ ...Vt(e, void 0, !1),
2354
2398
  cycleId: n,
2355
2399
  status: "filling"
2356
2400
  }, n;
2357
2401
  }
2358
2402
  async cancel() {
2359
2403
  let { cancelRequest: e, options: t, state: n } = this.context;
2360
- await Ht(t, n, e), this.commitCollection();
2404
+ await Ut(t, n, e), this.commitCollection();
2361
2405
  }
2362
2406
  captureCollection(e, t) {
2363
2407
  t && (this.collection = e);
@@ -2385,30 +2429,30 @@ var Gt = class {
2385
2429
  requests: r.requests
2386
2430
  }));
2387
2431
  }
2388
- }, Kt = 100;
2389
- function qt(e, t) {
2432
+ }, qt = 100;
2433
+ function Jt(e, t) {
2390
2434
  if (!Number.isFinite(t) || t <= 0) throw TypeError(`Vibe ${e} must be a positive number.`);
2391
2435
  }
2392
- function Jt(e, t, n) {
2436
+ function Yt(e, t, n) {
2393
2437
  return Math.min(n, Math.max(t, e));
2394
2438
  }
2395
- function Yt(e) {
2439
+ function Xt(e) {
2396
2440
  if (!e) return;
2397
2441
  let t = e.minSpeedPxPerSecond ?? 20, n = e.maxSpeedPxPerSecond ?? 240;
2398
- if (qt("autoScroll.minSpeedPxPerSecond", t), qt("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
2399
- e.speedPxPerSecond !== void 0 && qt("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
2442
+ if (Jt("autoScroll.minSpeedPxPerSecond", t), Jt("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
2443
+ e.speedPxPerSecond !== void 0 && Jt("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
2400
2444
  }
2401
- function Xt(e) {
2445
+ function Zt(e) {
2402
2446
  let t = e?.minSpeedPxPerSecond ?? 20, n = e?.maxSpeedPxPerSecond ?? 240;
2403
2447
  return {
2404
2448
  enabled: e?.enabled ?? !1,
2405
2449
  maxSpeedPxPerSecond: n,
2406
2450
  minSpeedPxPerSecond: t,
2407
2451
  paused: !1,
2408
- speedPxPerSecond: Jt(e?.speedPxPerSecond ?? 80, t, n)
2452
+ speedPxPerSecond: Yt(e?.speedPxPerSecond ?? 80, t, n)
2409
2453
  };
2410
2454
  }
2411
- var Zt = class {
2455
+ var Qt = class {
2412
2456
  frame = null;
2413
2457
  lastTimestamp = null;
2414
2458
  mounted = !1;
@@ -2428,9 +2472,9 @@ var Zt = class {
2428
2472
  this.options.state.enabled && (this.options.state.paused = e, this.lastTimestamp = null, e ? this.cancelFrame() : this.schedule());
2429
2473
  }
2430
2474
  setSpeed(e) {
2431
- qt("auto-scroll speed", e);
2475
+ Jt("auto-scroll speed", e);
2432
2476
  let t = this.options.state;
2433
- t.speedPxPerSecond = Jt(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
2477
+ t.speedPxPerSecond = Yt(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
2434
2478
  }
2435
2479
  tick = (e) => {
2436
2480
  this.frame = null;
@@ -2442,7 +2486,7 @@ var Zt = class {
2442
2486
  return;
2443
2487
  }
2444
2488
  if (this.lastTimestamp !== null) {
2445
- let r = Math.min(Kt, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
2489
+ let r = Math.min(qt, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
2446
2490
  n.scrollTop = Math.min(i, n.scrollTop + t.speedPxPerSecond * r / 1e3);
2447
2491
  }
2448
2492
  this.lastTimestamp = e, this.schedule();
@@ -2456,7 +2500,7 @@ var Zt = class {
2456
2500
  };
2457
2501
  //#endregion
2458
2502
  //#region src/core/backendAutofill.ts
2459
- async function Qt(e, t, n, r) {
2503
+ async function $t(e, t, n, r) {
2460
2504
  let i = await e.onUnderfilled(n);
2461
2505
  if (!r()) return;
2462
2506
  if (!i.sessionId.trim()) throw TypeError("Vibe backend autofill requires a sessionId.");
@@ -2470,19 +2514,19 @@ async function Qt(e, t, n, r) {
2470
2514
  status: "waiting"
2471
2515
  });
2472
2516
  }
2473
- function $t(e, t) {
2517
+ function en(e, t) {
2474
2518
  ["complete", "exhausted"].includes(t.status) && t.items && (e.items = Q(e.items, t.items)), t.next !== void 0 && (e.next = t.next), t.total !== void 0 && (e.total = t.total);
2475
2519
  }
2476
- function en(e, t, n) {
2520
+ function tn(e, t, n) {
2477
2521
  let r = t.autofill;
2478
- return !Ut(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : ($t(t, n), Object.assign(r, $(n.status === "waiting" ? n.nextRequestAt : null)), r.error = n.error ?? null, r.missing = Math.max(0, (r.pageSize ?? 0) - n.received), r.received = n.received, n.requests !== void 0 && (r.requests = n.requests), r.sequence = n.sequence, r.status = n.status, !0);
2522
+ return !Wt(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (en(t, n), Object.assign(r, $(n.status === "waiting" ? n.nextRequestAt : null)), r.error = n.error ?? null, r.missing = Math.max(0, (r.pageSize ?? 0) - n.received), r.received = n.received, n.requests !== void 0 && (r.requests = n.requests), r.sequence = n.sequence, r.status = n.status, !0);
2479
2523
  }
2480
- function tn(e, t, n) {
2481
- return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = Bt(e, n), $t(t, n), !0);
2524
+ function nn(e, t, n) {
2525
+ return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = Vt(e, n), en(t, n), !0);
2482
2526
  }
2483
2527
  //#endregion
2484
2528
  //#region src/core/initialAutofill.ts
2485
- async function nn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, options: i, signal: a, state: o }) {
2529
+ async function rn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, options: i, signal: a, state: o }) {
2486
2530
  let s = i.autofill;
2487
2531
  if (!s) return;
2488
2532
  let c = o.items.length;
@@ -2495,7 +2539,7 @@ async function nn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
2495
2539
  return;
2496
2540
  }
2497
2541
  if (s.strategy === "backend") {
2498
- await Qt(s, o, {
2542
+ await $t(s, o, {
2499
2543
  cycleId: e,
2500
2544
  feedKey: s.feedKey,
2501
2545
  items: [...o.items],
@@ -2512,11 +2556,11 @@ async function nn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
2512
2556
  o.autofill.status = "exhausted";
2513
2557
  return;
2514
2558
  }
2515
- let l = await Wt({
2559
+ let l = await Gt({
2516
2560
  existingItems: o.items,
2517
2561
  initialCursor: o.next,
2518
2562
  loadPage: i.loadPage,
2519
- maximumRequests: It(s, !1),
2563
+ maximumRequests: Lt(s, !1),
2520
2564
  onCollection: n,
2521
2565
  onDelayChange: (e) => {
2522
2566
  t() && Object.assign(o.autofill, e);
@@ -2538,13 +2582,13 @@ async function nn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
2538
2582
  }
2539
2583
  //#endregion
2540
2584
  //#region src/core/fill.ts
2541
- function rn(e) {
2585
+ function an(e) {
2542
2586
  return "pages" in e ? { pages: e.pages } : { until: "end" };
2543
2587
  }
2544
- function an(e) {
2588
+ function on(e) {
2545
2589
  return `${typeof e}:${String(e)}`;
2546
2590
  }
2547
- function on(e) {
2591
+ function sn(e) {
2548
2592
  if (!e || typeof e != "object") throw TypeError("Vibe fill target must be an object.");
2549
2593
  if ("pages" in e) {
2550
2594
  if (!Number.isInteger(e.pages) || e.pages <= 0) throw TypeError("Vibe fill pages must be a positive integer.");
@@ -2553,20 +2597,20 @@ function on(e) {
2553
2597
  if ("until" in e && e.until === "end") return { until: "end" };
2554
2598
  throw TypeError("Vibe fill target must be { pages } or { until: 'end' }.");
2555
2599
  }
2556
- function sn(e) {
2600
+ function cn(e) {
2557
2601
  if (!e) return;
2558
2602
  if (e.strategy === "frontend") {
2559
- Mt(e, "frontend fill");
2603
+ Nt(e, "frontend fill");
2560
2604
  return;
2561
2605
  }
2562
2606
  if (!e.feedKey.trim()) throw TypeError("Vibe backend fill requires a feedKey.");
2563
2607
  let t = e.initialSession;
2564
2608
  if (t) {
2565
2609
  if (t.feedKey !== e.feedKey) throw TypeError("Vibe backend fill initialSession feedKey must match fill feedKey.");
2566
- on(t.target);
2610
+ sn(t.target);
2567
2611
  }
2568
2612
  }
2569
- function cn(e, t, n = !0) {
2613
+ function ln(e, t, n = !0) {
2570
2614
  let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a = $(i?.nextRequestAt);
2571
2615
  return {
2572
2616
  completedPages: i?.completedPages ?? 0,
@@ -2580,10 +2624,10 @@ function cn(e, t, n = !0) {
2580
2624
  sessionId: i?.sessionId ?? null,
2581
2625
  status: i?.status ?? "idle",
2582
2626
  strategy: e?.strategy ?? null,
2583
- target: i ? rn(i.target) : null
2627
+ target: i ? an(i.target) : null
2584
2628
  };
2585
2629
  }
2586
- function ln(e) {
2630
+ function un(e) {
2587
2631
  return [
2588
2632
  "cancelling",
2589
2633
  "filling",
@@ -2591,17 +2635,17 @@ function ln(e) {
2591
2635
  "waiting"
2592
2636
  ].includes(e.status);
2593
2637
  }
2594
- async function un({ existingItems: e, initialCursor: t, loadPage: n, onDelayChange: r, onProgress: i, options: a, signal: o, target: s }) {
2638
+ async function dn({ existingItems: e, initialCursor: t, loadPage: n, onDelayChange: r, onProgress: i, options: a, signal: o, target: s }) {
2595
2639
  let c = [], l = [...e], u = /* @__PURE__ */ new Set(), d = 0, f = t, p = t, m = 0, h;
2596
2640
  for (; p !== null;) {
2597
- let e = an(f);
2641
+ let e = on(f);
2598
2642
  if (u.has(e)) throw Error("Vibe fill received a repeated cursor.");
2599
- u.add(e), await Pt({
2600
- delayMs: Nt(d, a),
2643
+ u.add(e), await Ft({
2644
+ delayMs: Pt(d, a),
2601
2645
  onChange: r,
2602
2646
  signal: o
2603
2647
  });
2604
- let t = Et(await n({
2648
+ let t = Dt(await n({
2605
2649
  cursor: f,
2606
2650
  signal: o
2607
2651
  }));
@@ -2643,7 +2687,7 @@ async function un({ existingItems: e, initialCursor: t, loadPage: n, onDelayChan
2643
2687
  }
2644
2688
  //#endregion
2645
2689
  //#region src/core/backendFill.ts
2646
- async function dn(e, t, n, r) {
2690
+ async function fn(e, t, n, r) {
2647
2691
  let i = await e.onStart(n);
2648
2692
  if (r()) {
2649
2693
  if (!i.sessionId.trim()) throw TypeError("Vibe backend fill requires a sessionId.");
@@ -2657,22 +2701,22 @@ async function dn(e, t, n, r) {
2657
2701
  });
2658
2702
  }
2659
2703
  }
2660
- function fn(e, t, n) {
2704
+ function pn(e, t, n) {
2661
2705
  return e?.strategy === "backend" && n.feedKey === e.feedKey && n.sessionId === t.fill.sessionId;
2662
2706
  }
2663
- function pn(e) {
2707
+ function mn(e) {
2664
2708
  return Number.isInteger(e.completedPages) && e.completedPages >= 0 && Number.isInteger(e.received) && e.received >= 0 && Number.isInteger(e.sequence) && e.sequence >= 0;
2665
2709
  }
2666
- function mn(e, t) {
2710
+ function hn(e, t) {
2667
2711
  if (!["complete", "exhausted"].includes(t.status)) return !0;
2668
2712
  let n = e.fill.target;
2669
2713
  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;
2670
2714
  }
2671
- function hn(e, t, n) {
2715
+ function gn(e, t, n) {
2672
2716
  t.total !== void 0 && (e.total = t.total), ["complete", "exhausted"].includes(t.status) && (e.items = Q(e.items, t.items ?? []), e.next = t.next ?? null, n(t.lastCursor ?? null));
2673
2717
  }
2674
- function gn(e, t, n, r) {
2675
- return !fn(e, t, n) || !pn(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !mn(t, n) ? !1 : (hn(t, n, r), Object.assign(t.fill, {
2718
+ function _n(e, t, n, r) {
2719
+ return !pn(e, t, n) || !mn(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !hn(t, n) ? !1 : (gn(t, n, r), Object.assign(t.fill, {
2676
2720
  ...$(n.status === "waiting" ? n.nextRequestAt : null),
2677
2721
  completedPages: n.completedPages,
2678
2722
  error: n.error ?? null,
@@ -2681,41 +2725,41 @@ function gn(e, t, n, r) {
2681
2725
  status: n.status
2682
2726
  }), !0);
2683
2727
  }
2684
- function _n(e, t, n, r) {
2728
+ function vn(e, t, n, r) {
2685
2729
  if (e?.strategy !== "backend" || n.feedKey !== e.feedKey) return !1;
2686
2730
  let i = t.fill;
2687
- return t.fill = cn(e, n), !pn(n) || !mn(t, n) ? (t.fill = i, !1) : (hn(t, n, r), !0);
2731
+ return t.fill = ln(e, n), !mn(n) || !hn(t, n) ? (t.fill = i, !1) : (gn(t, n, r), !0);
2688
2732
  }
2689
2733
  //#endregion
2690
2734
  //#region src/core/fillController.ts
2691
- var vn = class {
2735
+ var yn = class {
2692
2736
  abortController = null;
2693
2737
  cycle = 0;
2694
2738
  delayCountdown;
2695
2739
  requestVersion = 0;
2696
2740
  constructor(e) {
2697
- this.options = e, this.delayCountdown = new Ft((e) => {
2741
+ this.options = e, this.delayCountdown = new It((e) => {
2698
2742
  Object.assign(this.options.state.fill, e);
2699
2743
  }), this.syncBackendCountdown();
2700
2744
  }
2701
2745
  isActive() {
2702
- return ln(this.options.state.fill);
2746
+ return un(this.options.state.fill);
2703
2747
  }
2704
2748
  applyUpdate(e) {
2705
- let t = gn(this.options.fill, this.options.state, e, this.options.onLastCursor);
2749
+ let t = _n(this.options.fill, this.options.state, e, this.options.onLastCursor);
2706
2750
  return t && this.syncBackendCountdown(), t;
2707
2751
  }
2708
2752
  restoreSession(e) {
2709
- let t = _n(this.options.fill, this.options.state, e, this.options.onLastCursor);
2753
+ let t = vn(this.options.fill, this.options.state, e, this.options.onLastCursor);
2710
2754
  return t && this.syncBackendCountdown(), t;
2711
2755
  }
2712
2756
  async start(e) {
2713
2757
  let t = this.options.fill;
2714
2758
  if (!t) throw Error("Vibe fill is not configured.");
2715
2759
  if (this.isActive()) throw Error("Vibe fill is already active.");
2716
- let n = on(e), r = `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
2760
+ let n = sn(e), r = `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
2717
2761
  if (this.options.state.fill = {
2718
- ...cn(t, void 0, !1),
2762
+ ...ln(t, void 0, !1),
2719
2763
  cycleId: r,
2720
2764
  status: "filling",
2721
2765
  target: n
@@ -2726,7 +2770,7 @@ var vn = class {
2726
2770
  let i = ++this.requestVersion, a = new AbortController();
2727
2771
  this.abortController = a;
2728
2772
  try {
2729
- t.strategy === "frontend" ? await this.startFrontend(t, n, a, i) : (await dn(t, this.options.state, {
2773
+ t.strategy === "frontend" ? await this.startFrontend(t, n, a, i) : (await fn(t, this.options.state, {
2730
2774
  cycleId: r,
2731
2775
  feedKey: t.feedKey,
2732
2776
  items: [...this.options.state.items],
@@ -2744,7 +2788,7 @@ var vn = class {
2744
2788
  }
2745
2789
  async cancel() {
2746
2790
  let { fill: e, state: t } = this.options;
2747
- if (!ln(t.fill) || !t.fill.cycleId) return;
2791
+ if (!un(t.fill) || !t.fill.cycleId) return;
2748
2792
  let n = {
2749
2793
  cycleId: t.fill.cycleId,
2750
2794
  feedKey: t.fill.feedKey ?? "",
@@ -2758,7 +2802,7 @@ var vn = class {
2758
2802
  }
2759
2803
  }
2760
2804
  reset() {
2761
- this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = cn(this.options.fill, void 0, !1);
2805
+ this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = ln(this.options.fill, void 0, !1);
2762
2806
  }
2763
2807
  destroy() {
2764
2808
  this.abortLocalRequest(), this.delayCountdown.clear();
@@ -2774,7 +2818,7 @@ var vn = class {
2774
2818
  if (!i) throw Error("Vibe frontend fill requires loadPage.");
2775
2819
  let a = this.options.state;
2776
2820
  a.isLoadingMore = !0;
2777
- let o = await un({
2821
+ let o = await dn({
2778
2822
  existingItems: a.items,
2779
2823
  initialCursor: a.next,
2780
2824
  loadPage: i,
@@ -2801,7 +2845,7 @@ var vn = class {
2801
2845
  };
2802
2846
  //#endregion
2803
2847
  //#region src/core/feedFooter.ts
2804
- function yn(e) {
2848
+ function bn(e) {
2805
2849
  return {
2806
2850
  cancelAutofill: () => e.cancelAutofill(),
2807
2851
  loadMore: () => e.loadNext(),
@@ -2809,45 +2853,45 @@ function yn(e) {
2809
2853
  retryEnd: () => e.retryEnd()
2810
2854
  };
2811
2855
  }
2812
- function bn(e) {
2813
- if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
2814
- }
2815
2856
  function xn(e) {
2816
- e?.intervalMs !== void 0 && bn(e.intervalMs);
2857
+ if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
2817
2858
  }
2818
2859
  function Sn(e) {
2860
+ e?.intervalMs !== void 0 && xn(e.intervalMs);
2861
+ }
2862
+ function Cn(e) {
2819
2863
  return {
2820
2864
  enabled: e?.enabled ?? !1,
2821
2865
  includePostItems: e?.includePostItems ?? !1,
2822
2866
  intervalMs: e?.intervalMs ?? 5e3
2823
2867
  };
2824
2868
  }
2825
- function Cn(e, t) {
2869
+ function wn(e, t) {
2826
2870
  if (typeof t == "boolean") {
2827
2871
  e.enabled = t;
2828
2872
  return;
2829
2873
  }
2830
- xn(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);
2874
+ Sn(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);
2831
2875
  }
2832
2876
  //#endregion
2833
2877
  //#region src/core/reelInfoSheet.ts
2834
- function wn(e) {
2878
+ function Tn(e) {
2835
2879
  return { enabled: e?.enabled ?? !1 };
2836
2880
  }
2837
- function Tn(e, t, n) {
2881
+ function En(e, t, n) {
2838
2882
  if (n && !t) throw Error("Vibe cannot enable reelInfoSheet without a configured component.");
2839
2883
  e.enabled = n;
2840
2884
  }
2841
2885
  //#endregion
2842
2886
  //#region src/core/initialRuntimeState.ts
2843
- function En(e, t) {
2887
+ function Dn(e, t) {
2844
2888
  let n = e.initialPage;
2845
2889
  return {
2846
2890
  activeReelPostId: null,
2847
- autoScroll: Xt(e.autoScroll),
2848
- autofill: Bt(e.autofill),
2891
+ autoScroll: Zt(e.autoScroll),
2892
+ autofill: Vt(e.autofill),
2849
2893
  error: null,
2850
- fill: cn(e.fill),
2894
+ fill: ln(e.fill),
2851
2895
  infiniteScroll: e.infiniteScroll ?? !0,
2852
2896
  isLoading: !n,
2853
2897
  isLoadingMore: !1,
@@ -2857,14 +2901,14 @@ function En(e, t) {
2857
2901
  mediaIndices: /* @__PURE__ */ new Map(),
2858
2902
  next: n?.next ?? null,
2859
2903
  nextPageError: null,
2860
- reelAutoAdvance: Sn(e.reelAutoAdvance),
2904
+ reelAutoAdvance: Cn(e.reelAutoAdvance),
2861
2905
  reelForward: {
2862
2906
  error: null,
2863
2907
  status: "idle"
2864
2908
  },
2865
2909
  reelForwardIndex: null,
2866
2910
  reelForwardItem: null,
2867
- reelInfoSheet: wn(e.reelInfoSheet),
2911
+ reelInfoSheet: Tn(e.reelInfoSheet),
2868
2912
  reelInfoSheetOverlay: !1,
2869
2913
  reelMediaSource: "original",
2870
2914
  reelOrigin: null,
@@ -2873,26 +2917,26 @@ function En(e, t) {
2873
2917
  }
2874
2918
  //#endregion
2875
2919
  //#region src/core/options.ts
2876
- function Dn(e, t) {
2920
+ function On(e, t) {
2877
2921
  if (t) {
2878
2922
  if (!Number.isFinite(t.height) || t.height <= 0) throw TypeError(`Vibe ${e} height must be a positive number.`);
2879
2923
  if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe ${e} background must be "default" or "transparent".`);
2880
2924
  }
2881
2925
  }
2882
- function On(e, t) {
2926
+ function kn(e, t) {
2883
2927
  if (t) {
2884
2928
  if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe mediaCard ${e} background must be "default" or "transparent".`);
2885
2929
  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.`);
2886
2930
  }
2887
2931
  }
2888
- function kn(e) {
2889
- if (Yt(e.autoScroll), Dn("cardHeader", e.cardHeader), Dn("cardFooter", e.cardFooter), On("header", e.mediaCard?.header), On("footer", e.mediaCard?.footer), zt(e.autofill), sn(e.fill), xn(e.reelAutoAdvance), e.removalHistoryLimit !== void 0 && (!Number.isInteger(e.removalHistoryLimit) || e.removalHistoryLimit < 0)) throw TypeError("Vibe removalHistoryLimit must be a non-negative integer.");
2932
+ function An(e) {
2933
+ if (Xt(e.autoScroll), On("cardHeader", e.cardHeader), On("cardFooter", e.cardFooter), kn("header", e.mediaCard?.header), kn("footer", e.mediaCard?.footer), Bt(e.autofill), cn(e.fill), Sn(e.reelAutoAdvance), e.removalHistoryLimit !== void 0 && (!Number.isInteger(e.removalHistoryLimit) || e.removalHistoryLimit < 0)) throw TypeError("Vibe removalHistoryLimit must be a non-negative integer.");
2890
2934
  if (!e.initialPage && !e.loadPage) throw TypeError("Vibe requires either initialPage or loadPage.");
2891
2935
  if (e.initialPage?.next !== null && !e.loadPage) throw TypeError("Vibe requires loadPage when initialPage has a next cursor.");
2892
2936
  if (e.fill?.strategy === "frontend" && !e.loadPage) throw TypeError("Vibe frontend fill requires loadPage.");
2893
2937
  if (e.fill?.strategy === "backend" && e.fill.initialSession && !e.initialPage) throw TypeError("Vibe backend fill restoration requires initialPage.");
2894
2938
  }
2895
- function An(e) {
2939
+ function jn(e) {
2896
2940
  if (typeof e != "string") return e;
2897
2941
  if (typeof document > "u") throw Error("Vibe cannot resolve a selector without a document.");
2898
2942
  let t = document.querySelector(e);
@@ -2901,7 +2945,7 @@ function An(e) {
2901
2945
  }
2902
2946
  //#endregion
2903
2947
  //#region src/core/activeItemRemoval.ts
2904
- function jn(e, t, n, r, i) {
2948
+ function Mn(e, t, n, r, i) {
2905
2949
  let a = new Set(t.map(({ item: e }) => e.postId));
2906
2950
  if (e.activeReelPostId === null || !a.has(e.activeReelPostId)) return;
2907
2951
  let o = e.items[Math.max(n, 0)];
@@ -2914,7 +2958,7 @@ function jn(e, t, n, r, i) {
2914
2958
  }
2915
2959
  //#endregion
2916
2960
  //#region src/core/exactMediaRemovalController.ts
2917
- function Mn(e, t) {
2961
+ function Nn(e, t) {
2918
2962
  let [n, ...r] = t;
2919
2963
  if (!n) throw Error("Vibe items must contain at least one media asset.");
2920
2964
  return {
@@ -2923,10 +2967,10 @@ function Mn(e, t) {
2923
2967
  items: r
2924
2968
  };
2925
2969
  }
2926
- function Nn(e) {
2970
+ function Pn(e) {
2927
2971
  if (!Number.isInteger(e.mediaIndex) || e.mediaIndex < 0) throw TypeError("Vibe mediaIndex must be a non-negative integer.");
2928
2972
  }
2929
- var Pn = class {
2973
+ var Fn = class {
2930
2974
  generation = 0;
2931
2975
  metadata = /* @__PURE__ */ new WeakMap();
2932
2976
  state;
@@ -2934,7 +2978,7 @@ var Pn = class {
2934
2978
  this.options = e, this.state = e.state;
2935
2979
  }
2936
2980
  remove(e) {
2937
- Nn(e);
2981
+ Pn(e);
2938
2982
  let t = this.state.items.findIndex(({ postId: t }) => t === e.postId), n = this.state.items[t];
2939
2983
  if (!n) return null;
2940
2984
  let r = [...M(n)], i = r[e.mediaIndex];
@@ -2951,7 +2995,7 @@ var Pn = class {
2951
2995
  restored: !1
2952
2996
  });
2953
2997
  let o = this.state.mediaIndices.get(n.postId) ?? 0, s = this.isReelOpen() && this.state.activeReelPostId === n.postId, c = s && o === e.mediaIndex;
2954
- return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = Mn(n, r), this.updateMediaIndexAfterRemoval(n.postId, e.mediaIndex, c), a) : (this.state.items.splice(t, 1), this.state.mediaIndices.delete(n.postId), s && this.advanceFromRemovedPost(a, n), a);
2998
+ return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = Nn(n, r), this.updateMediaIndexAfterRemoval(n.postId, e.mediaIndex, c), a) : (this.state.items.splice(t, 1), this.state.mediaIndices.delete(n.postId), s && this.advanceFromRemovedPost(a, n), a);
2955
2999
  }
2956
3000
  reset() {
2957
3001
  this.generation += 1;
@@ -2977,7 +3021,7 @@ var Pn = class {
2977
3021
  }
2978
3022
  restoreIntoPost(e, t) {
2979
3023
  let n = this.state.items[e], r = [...M(n)], i = Math.min(t.mediaIndex, r.length);
2980
- if (r.splice(i, 0, t.media), this.state.items[e] = Mn(n, r), this.state.activeReelPostId !== t.postId) return;
3024
+ if (r.splice(i, 0, t.media), this.state.items[e] = Nn(n, r), this.state.activeReelPostId !== t.postId) return;
2981
3025
  let a = this.state.mediaIndices.get(t.postId) ?? 0;
2982
3026
  a >= i && this.state.mediaIndices.set(t.postId, a + 1);
2983
3027
  }
@@ -2990,18 +3034,18 @@ var Pn = class {
2990
3034
  };
2991
3035
  //#endregion
2992
3036
  //#region src/core/itemPlacement.ts
2993
- function Fn(e, t) {
3037
+ function In(e, t) {
2994
3038
  let n = new Set(t);
2995
3039
  return e.flatMap((e, t) => n.has(e.postId) ? [{
2996
3040
  index: t,
2997
3041
  item: e
2998
3042
  }] : []);
2999
3043
  }
3000
- function In(e, t) {
3044
+ function Ln(e, t) {
3001
3045
  let n = new Set(t.map(({ item: e }) => e.postId));
3002
3046
  return e.filter((e) => !n.has(e.postId));
3003
3047
  }
3004
- function Ln(e, t) {
3048
+ function Rn(e, t) {
3005
3049
  t.forEach(({ index: e }) => {
3006
3050
  if (!Number.isInteger(e) || e < 0) throw Error("Vibe item restore indexes must be non-negative integers.");
3007
3051
  });
@@ -3012,7 +3056,7 @@ function Ln(e, t) {
3012
3056
  }
3013
3057
  //#endregion
3014
3058
  //#region src/core/itemRemovalController.ts
3015
- var Rn = 20, zn = class {
3059
+ var zn = 20, Bn = class {
3016
3060
  generation = 0;
3017
3061
  historyLimit;
3018
3062
  metadata = /* @__PURE__ */ new WeakMap();
@@ -3021,7 +3065,7 @@ var Rn = 20, zn = class {
3021
3065
  itemOrder;
3022
3066
  stopItemsWatcher;
3023
3067
  constructor(e) {
3024
- this.options = e, this.historyLimit = e.historyLimit ?? Rn, 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" });
3068
+ this.options = e, this.historyLimit = e.historyLimit ?? zn, 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" });
3025
3069
  }
3026
3070
  destroy() {
3027
3071
  this.reset(), this.stopItemsWatcher();
@@ -3034,7 +3078,7 @@ var Rn = 20, zn = class {
3034
3078
  let i = this.options.startRemoval(r);
3035
3079
  if (i > 0 && await new Promise((e) => setTimeout(e, i)), this.metadata.get(n)?.generation !== this.generation) return n;
3036
3080
  let a = this.state.items.findIndex((e) => e.postId === this.state.activeReelPostId), o = new Set(t.map(({ item: e }) => e.postId)), s = a < 0 ? 0 : this.state.items.slice(0, a).filter(({ postId: e }) => o.has(e)).length, c = Math.max(a - s, 0);
3037
- return this.state.items = In(this.state.items, t), this.options.onItemsRemoved(n, t, c), this.record(n), n;
3081
+ return this.state.items = Ln(this.state.items, t), this.options.onItemsRemoved(n, t, c), this.record(n), n;
3038
3082
  }
3039
3083
  reset() {
3040
3084
  this.generation += 1, this.history = [], this.itemOrder = [];
@@ -3045,7 +3089,7 @@ var Rn = 20, zn = class {
3045
3089
  this.restoreRemoval(t);
3046
3090
  return;
3047
3091
  }
3048
- let n = Ln(this.state.items, e);
3092
+ let n = Rn(this.state.items, e);
3049
3093
  this.registerExternalPlacements(e), this.state.items = n;
3050
3094
  }
3051
3095
  restoreRemoval(e) {
@@ -3071,7 +3115,7 @@ var Rn = 20, zn = class {
3071
3115
  }
3072
3116
  collectOrderedPlacements(e) {
3073
3117
  let t = new Map(this.itemOrder.map((e, t) => [e, t]));
3074
- return Fn(this.state.items, e).map((e) => ({
3118
+ return In(this.state.items, e).map((e) => ({
3075
3119
  index: t.get(e.item.postId) ?? e.index,
3076
3120
  item: e.item
3077
3121
  }));
@@ -3102,7 +3146,7 @@ var Rn = 20, zn = class {
3102
3146
  let r = new Map(this.itemOrder.map((e, t) => [e, t]));
3103
3147
  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;
3104
3148
  }
3105
- }, Bn = class {
3149
+ }, Vn = class {
3106
3150
  forward = null;
3107
3151
  forwardPromise = null;
3108
3152
  forwardVersion = 0;
@@ -3180,7 +3224,7 @@ var Rn = 20, zn = class {
3180
3224
  }
3181
3225
  }
3182
3226
  }
3183
- }, Vn = class {
3227
+ }, Hn = class {
3184
3228
  generation = 0;
3185
3229
  pending = Promise.resolve();
3186
3230
  constructor(e) {
@@ -3230,22 +3274,22 @@ var Rn = 20, zn = class {
3230
3274
  };
3231
3275
  //#endregion
3232
3276
  //#region src/core/removalControllers.ts
3233
- function Hn(e) {
3234
- let t = new Bn(e), n = new Vn({
3277
+ function Un(e) {
3278
+ let t = new Vn(e), n = new Hn({
3235
3279
  state: e.state,
3236
3280
  transitionMedia: (t) => e.surface()?.transitionActiveReelMedia(t) ?? Promise.resolve(!1),
3237
3281
  transitionPost: (t) => e.surface()?.transitionActiveReelPost(t) ?? Promise.resolve(!1)
3238
3282
  });
3239
3283
  return {
3240
- exactMediaRemoval: new Pn({
3284
+ exactMediaRemoval: new Fn({
3241
3285
  onActivate: e.onActivate,
3242
3286
  reelForward: t,
3243
3287
  state: e.state
3244
3288
  }),
3245
- itemRemoval: new zn({
3289
+ itemRemoval: new Bn({
3246
3290
  historyLimit: e.historyLimit,
3247
3291
  onItemsRemoved: (n, r, i) => {
3248
- jn(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
3292
+ Mn(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
3249
3293
  },
3250
3294
  onRemovalRestored: (n) => {
3251
3295
  let r = t.cancel(n);
@@ -3259,17 +3303,17 @@ function Hn(e) {
3259
3303
  reelRemoval: n
3260
3304
  };
3261
3305
  }
3262
- var Un = 1.5;
3263
- function Wn(e) {
3306
+ var Wn = 1.5;
3307
+ function Gn(e) {
3264
3308
  let t = Math.min(e.screenWidth, e.screenHeight);
3265
3309
  if (t > 0 && t < 600) return !0;
3266
- let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * Un;
3310
+ let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * Wn;
3267
3311
  return !e.hasHover && n > 0 && n < 600 && r;
3268
3312
  }
3269
- function Gn(e) {
3270
- return Wn(e) ? "reel" : "masonry";
3271
- }
3272
3313
  function Kn(e) {
3314
+ return Gn(e) ? "reel" : "masonry";
3315
+ }
3316
+ function qn(e) {
3273
3317
  let t = e.ownerDocument.defaultView, n = e.ownerDocument.documentElement;
3274
3318
  return {
3275
3319
  hasHover: typeof t?.matchMedia == "function" && t.matchMedia("(hover: hover)").matches,
@@ -3279,15 +3323,15 @@ function Kn(e) {
3279
3323
  viewportWidth: n.clientWidth
3280
3324
  };
3281
3325
  }
3282
- function qn(e) {
3283
- return Wn(Kn(e));
3284
- }
3285
3326
  function Jn(e) {
3286
- return Gn(Kn(e));
3327
+ return Gn(qn(e));
3328
+ }
3329
+ function Yn(e) {
3330
+ return Kn(qn(e));
3287
3331
  }
3288
3332
  //#endregion
3289
3333
  //#region src/core/responsiveLayoutController.ts
3290
- var Yn = class {
3334
+ var Xn = class {
3291
3335
  layoutMode;
3292
3336
  resizeObserver = null;
3293
3337
  target = null;
@@ -3312,10 +3356,10 @@ var Yn = class {
3312
3356
  }
3313
3357
  handleResponsiveLayout = () => {
3314
3358
  if (!this.target) return;
3315
- let e = Jn(this.target);
3316
- this.state.reelInfoSheetOverlay = qn(this.target), this.state.reelMediaSource = e === "reel" ? "preview" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
3359
+ let e = Yn(this.target);
3360
+ this.state.reelInfoSheetOverlay = Jn(this.target), this.state.reelMediaSource = e === "reel" ? "preview" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
3317
3361
  };
3318
- }, Xn = class {
3362
+ }, Zn = class {
3319
3363
  routedReelPostId = null;
3320
3364
  reelRouteIsActive = !1;
3321
3365
  constructor(e, t) {
@@ -3342,7 +3386,7 @@ var Yn = class {
3342
3386
  let i = this.reelRouteIsActive ? "replace" : "push";
3343
3387
  this.reelRouteIsActive = !0, this.routedReelPostId = e, this.options.router[i](r);
3344
3388
  }
3345
- }, Zn = class {
3389
+ }, Qn = class {
3346
3390
  app = null;
3347
3391
  autoScroll;
3348
3392
  autofillController;
@@ -3361,27 +3405,27 @@ var Yn = class {
3361
3405
  lastLoadedCursor = null;
3362
3406
  state;
3363
3407
  constructor(e) {
3364
- this.options = e, kn(e);
3408
+ this.options = e, An(e);
3365
3409
  let t = e.layout ?? "masonry";
3366
- this.state = x(En(e, t)), this.autoScroll = new Zt({
3410
+ this.state = x(Dn(e, t)), this.autoScroll = new Qt({
3367
3411
  getScrollElement: () => this.surface?.getAutoScrollElement() ?? null,
3368
3412
  state: this.state.autoScroll
3369
- }), this.autofillController = new Gt({
3413
+ }), this.autofillController = new Kt({
3370
3414
  cancelRequest: () => this.cancelRequest(),
3371
3415
  onLastCursor: (e) => {
3372
3416
  this.lastLoadedCursor = e;
3373
3417
  },
3374
3418
  options: e.autofill,
3375
3419
  state: this.state
3376
- }), this.fillController = new vn({
3420
+ }), this.fillController = new yn({
3377
3421
  fill: e.fill,
3378
3422
  loadPage: e.loadPage,
3379
3423
  onLastCursor: (e) => {
3380
3424
  this.lastLoadedCursor = e;
3381
3425
  },
3382
3426
  state: this.state
3383
- }), this.routing = new Xn(e.routing, this.state);
3384
- let n = Hn({
3427
+ }), this.routing = new Zn(e.routing, this.state);
3428
+ let n = Un({
3385
3429
  historyLimit: e.removalHistoryLimit,
3386
3430
  loadNext: () => this.loadNext(),
3387
3431
  onActivate: (e) => this.setActiveReelPost(e),
@@ -3389,20 +3433,20 @@ var Yn = class {
3389
3433
  state: this.state,
3390
3434
  surface: () => this.surface
3391
3435
  });
3392
- this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new Yn(t, this.state, () => {
3436
+ this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new Xn(t, this.state, () => {
3393
3437
  this.routing.syncFeed();
3394
3438
  }), this.startStateNotifications();
3395
3439
  }
3396
3440
  async mount() {
3397
3441
  if (this.app) throw Error("Vibe is already mounted.");
3398
3442
  this.startStateNotifications();
3399
- let e = An(this.options.target);
3400
- this.responsiveLayout.mount(e), this.app = i(Tt, {
3443
+ let e = jn(this.options.target);
3444
+ this.responsiveLayout.mount(e), this.app = i(Et, {
3401
3445
  canRetryEnd: !!this.options.loadPage,
3402
3446
  cardFooter: this.options.cardFooter,
3403
3447
  cardHeader: this.options.cardHeader,
3404
3448
  feedFooter: this.options.feedFooter,
3405
- feedFooterActions: yn(this),
3449
+ feedFooterActions: bn(this),
3406
3450
  mediaCard: this.options.mediaCard,
3407
3451
  reelInfoSheet: this.options.reelInfoSheet,
3408
3452
  state: this.state,
@@ -3478,7 +3522,7 @@ var Yn = class {
3478
3522
  this.autoScroll.setSpeed(e);
3479
3523
  }
3480
3524
  applyAutofillUpdate(e) {
3481
- let t = en(this.options.autofill, this.state, e);
3525
+ let t = tn(this.options.autofill, this.state, e);
3482
3526
  return t && this.autofillController.syncCountdown(), t;
3483
3527
  }
3484
3528
  cancelAutofill() {
@@ -3491,11 +3535,11 @@ var Yn = class {
3491
3535
  return this.fillController.cancel();
3492
3536
  }
3493
3537
  async fill(e) {
3494
- if (this.pendingRequest || Vt(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
3538
+ if (this.pendingRequest || Ht(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
3495
3539
  await this.fillController.start(e);
3496
3540
  }
3497
3541
  restoreAutofillSession(e) {
3498
- let t = tn(this.options.autofill, this.state, e);
3542
+ let t = nn(this.options.autofill, this.state, e);
3499
3543
  return t && this.autofillController.syncCountdown(), t;
3500
3544
  }
3501
3545
  restoreFillSession(e) {
@@ -3503,7 +3547,7 @@ var Yn = class {
3503
3547
  }
3504
3548
  async loadNext() {
3505
3549
  if (this.pendingRequest) return this.pendingRequest;
3506
- if (!this.state.loadMoreLocked && !(Vt(this.state.autofill) || this.fillController.isActive()) && !(this.state.next === null || !this.options.loadPage)) return this.state.isLoadingMore = !0, this.state.nextPageError = null, this.startRequest(this.state.next, !0);
3550
+ if (!this.state.loadMoreLocked && !(Ht(this.state.autofill) || this.fillController.isActive()) && !(this.state.next === null || !this.options.loadPage)) return this.state.isLoadingMore = !0, this.state.nextPageError = null, this.startRequest(this.state.next, !0);
3507
3551
  }
3508
3552
  async refresh() {
3509
3553
  return this.replaceFeed(this.state.next ?? this.lastLoadedCursor, "refresh");
@@ -3513,11 +3557,11 @@ var Yn = class {
3513
3557
  }
3514
3558
  async replaceFeed(e, t) {
3515
3559
  if (!this.options.loadPage) throw Error(`Vibe cannot ${t} without loadPage.`);
3516
- return Vt(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.state.autofill = Bt(this.options.autofill, void 0, !1), this.fillController.reset(), this.reelForward.reset(), this.reelRemoval.reset(), this.exactMediaRemoval.reset(), this.itemRemoval.reset(), this.state.error = null, this.state.isLoading = !0, this.state.items = [], this.state.next = null, this.state.nextPageError = null, this.state.total = null, this.startRequest(e, !1);
3560
+ return Ht(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.state.autofill = Vt(this.options.autofill, void 0, !1), this.fillController.reset(), this.reelForward.reset(), this.reelRemoval.reset(), this.exactMediaRemoval.reset(), this.itemRemoval.reset(), this.state.error = null, this.state.isLoading = !0, this.state.items = [], this.state.next = null, this.state.nextPageError = null, this.state.total = null, this.startRequest(e, !1);
3517
3561
  }
3518
3562
  async retryEnd() {
3519
3563
  if (this.pendingRequest) return this.pendingRequest;
3520
- if (!this.state.loadMoreLocked && !(Vt(this.state.autofill) || this.fillController.isActive()) && !(this.state.next !== null || !this.options.loadPage)) return this.state.isLoadingMore = !0, this.state.nextPageError = null, this.startRequest(this.lastLoadedCursor, !0);
3564
+ if (!this.state.loadMoreLocked && !(Ht(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);
3521
3565
  }
3522
3566
  setInfiniteScroll(e) {
3523
3567
  this.state.infiniteScroll = e, e && m(() => this.surface?.loadIfNearBottom());
@@ -3526,10 +3570,10 @@ var Yn = class {
3526
3570
  this.state.loadMoreLocked !== e && (this.state.loadMoreLocked = e, !e && this.state.infiniteScroll && m(() => this.surface?.loadIfNearBottom()));
3527
3571
  }
3528
3572
  setReelAutoAdvance(e) {
3529
- Cn(this.state.reelAutoAdvance, e);
3573
+ wn(this.state.reelAutoAdvance, e);
3530
3574
  }
3531
3575
  setReelInfoSheet(e) {
3532
- Tn(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
3576
+ En(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
3533
3577
  }
3534
3578
  setLayout(e) {
3535
3579
  this.responsiveLayout.setLayout(e);
@@ -3553,7 +3597,7 @@ var Yn = class {
3553
3597
  this.abortController = i;
3554
3598
  try {
3555
3599
  if (a?.strategy === "frontend") {
3556
- let o = await Wt({
3600
+ let o = await Gt({
3557
3601
  existingItems: t ? this.state.items : [],
3558
3602
  initialCursor: e,
3559
3603
  loadPage: n,
@@ -3576,7 +3620,7 @@ var Yn = class {
3576
3620
  }), this.autofillController.clearCollection();
3577
3621
  return;
3578
3622
  }
3579
- let c = Et(await n({
3623
+ let c = Dt(await n({
3580
3624
  cursor: e,
3581
3625
  signal: i.signal
3582
3626
  }));
@@ -3591,7 +3635,7 @@ var Yn = class {
3591
3635
  this.state.autofill.status = "complete";
3592
3636
  return;
3593
3637
  }
3594
- await Qt(a, this.state, {
3638
+ await $t(a, this.state, {
3595
3639
  cycleId: o,
3596
3640
  feedKey: a.feedKey,
3597
3641
  items: u.slice(l.length),
@@ -3619,7 +3663,7 @@ var Yn = class {
3619
3663
  startInitialAutofill() {
3620
3664
  let e = ++this.requestVersion, t = new AbortController(), n = this.autofillController.beginCycle();
3621
3665
  this.abortController = t, this.state.isLoadingMore = !0;
3622
- let r = nn({
3666
+ let r = rn({
3623
3667
  cycleId: n,
3624
3668
  isCurrent: () => e === this.requestVersion,
3625
3669
  onCollection: (t) => this.autofillController.captureCollection(t, e === this.requestVersion),
@@ -3644,8 +3688,8 @@ var Yn = class {
3644
3688
  }));
3645
3689
  }
3646
3690
  };
3647
- function Qn(e) {
3648
- return new Zn(e);
3691
+ function $n(e) {
3692
+ return new Qn(e);
3649
3693
  }
3650
3694
  //#endregion
3651
- export { Qn as createVibe };
3695
+ export { $n as createVibe };