@wyxos/vibe 5.4.1 → 5.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -56,7 +56,7 @@ var R = {
56
56
  }, B = ["disabled"], V = {
57
57
  key: 2,
58
58
  class: "end-feed"
59
- }, H = ["disabled"], U = /* @__PURE__ */ d({
59
+ }, H = ["disabled"], ee = /* @__PURE__ */ d({
60
60
  __name: "GalleryFooter",
61
61
  props: {
62
62
  canRetryEnd: { type: Boolean },
@@ -90,7 +90,7 @@ var R = {
90
90
  onClick: n[0] ||= (e) => t.$emit("retryEnd")
91
91
  }, " Check for more ", 8, H)]))])) : o("", !0);
92
92
  }
93
- }), W = /* @__PURE__ */ d({
93
+ }), U = /* @__PURE__ */ d({
94
94
  __name: "FeedFooter",
95
95
  props: {
96
96
  actions: {},
@@ -127,7 +127,7 @@ var R = {
127
127
  "can-retry-end",
128
128
  "show-load-more",
129
129
  "state"
130
- ])) : (b(), a(U, {
130
+ ])) : (b(), a(ee, {
131
131
  key: 1,
132
132
  "can-retry-end": e.canRetryEnd,
133
133
  "has-error": e.hasError,
@@ -146,7 +146,7 @@ var R = {
146
146
  "show-load-more"
147
147
  ]));
148
148
  }
149
- }), ee = ["role"], G = { class: "gallery-status" }, te = /* @__PURE__ */ d({
149
+ }), W = ["role"], G = { class: "gallery-status" }, te = /* @__PURE__ */ d({
150
150
  __name: "FeedStatus",
151
151
  props: {
152
152
  actions: {},
@@ -160,7 +160,7 @@ var R = {
160
160
  return (n, u) => (b(), s("main", {
161
161
  class: "gallery-shell",
162
162
  role: r.state.error ? "alert" : r.state.isLoading ? "status" : void 0
163
- }, [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(W, {
163
+ }, [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, {
164
164
  key: 0,
165
165
  actions: t.actions,
166
166
  "can-retry-end": t.canRetryEnd,
@@ -182,7 +182,7 @@ var R = {
182
182
  "is-loading",
183
183
  "load-more-locked",
184
184
  "state"
185
- ])) : o("", !0)], 8, ee));
185
+ ])) : o("", !0)], 8, W));
186
186
  }
187
187
  });
188
188
  function K(e) {
@@ -200,11 +200,7 @@ function q(e) {
200
200
  function re(e) {
201
201
  return Math.max(0, e.containerHeight) + Math.max(0, e.gap);
202
202
  }
203
- function ie(e, t) {
204
- let n = Math.max(0, t.overscan), r = t.scrollTop - n, i = t.scrollTop + Math.max(0, t.viewportHeight) + n;
205
- return e.reduce((e, t, n) => (t.y + t.height >= r && t.y <= i && e.push(n), e), []);
206
- }
207
- function ae(e, t, n) {
203
+ function ie(e, t, n) {
208
204
  if (t <= 0 || e.length === 0) return {
209
205
  columns: 0,
210
206
  height: 0,
@@ -225,11 +221,54 @@ function ae(e, t, n) {
225
221
  items: l
226
222
  };
227
223
  }
224
+ //#endregion
225
+ //#region src/core/masonryViewportIndex.ts
226
+ function ae(e, t) {
227
+ let n = /* @__PURE__ */ new Map();
228
+ return e.forEach((e, r) => {
229
+ let i = n.get(e.x) ?? [];
230
+ i.push({
231
+ bottom: e.y + e.height,
232
+ index: t?.[r] ?? r,
233
+ top: e.y
234
+ }), n.set(e.x, i);
235
+ }), { columns: [...n.entries()].sort(([e], [t]) => e - t).map(([, e]) => e.sort((e, t) => e.top - t.top || e.index - t.index)) };
236
+ }
228
237
  function oe(e, t) {
238
+ let n = 0, r = 0, i = e.length;
239
+ for (; r < i;) {
240
+ let a = Math.floor((r + i) / 2);
241
+ n += 1, e[a].bottom < t ? r = a + 1 : i = a;
242
+ }
243
+ return {
244
+ index: r,
245
+ inspected: n
246
+ };
247
+ }
248
+ function se(e, t) {
249
+ let n = Math.max(0, t.overscan), r = t.scrollTop - n, i = t.scrollTop + Math.max(0, t.viewportHeight) + n, a = [], o = 0;
250
+ return e.columns.forEach((e) => {
251
+ let t = oe(e, r);
252
+ o += t.inspected;
253
+ for (let n = t.index; n < e.length; n += 1) {
254
+ let t = e[n];
255
+ if (o += 1, t.top > i) break;
256
+ a.push(t.index);
257
+ }
258
+ }), {
259
+ indices: a.sort((e, t) => e - t),
260
+ inspected: o
261
+ };
262
+ }
263
+ function ce(e) {
264
+ return e?.minColumnWidth ?? 240;
265
+ }
266
+ function le(e, t) {
229
267
  let n = e?.overscan?.minimumPx ?? 800, r = e?.overscan?.viewportMultiplier ?? 1.5, i = Math.max(n, t * r), a = e?.overscan?.maximumPx;
230
268
  return a === void 0 ? i : Math.min(i, a);
231
269
  }
232
270
  function J(e) {
271
+ if (e?.minColumnWidth !== void 0 && (!Number.isFinite(e.minColumnWidth) || e.minColumnWidth <= 0)) throw TypeError("Vibe masonry minColumnWidth must be a positive number.");
233
272
  let t = e?.overscan;
234
273
  if (t) {
235
274
  for (let [e, n] of [
@@ -242,7 +281,7 @@ function J(e) {
242
281
  }
243
282
  //#endregion
244
283
  //#region src/core/scrollbar.ts
245
- function se(e, t, n) {
284
+ function ue(e, t, n) {
246
285
  return Math.min(n, Math.max(t, e));
247
286
  }
248
287
  function Y({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize: r, viewportSize: i }) {
@@ -254,23 +293,23 @@ function Y({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize:
254
293
  thumbSize: o,
255
294
  thumbTravel: 0
256
295
  };
257
- let l = se(s / a * o, Math.min(Math.max(0, t), o), o), u = Math.max(0, o - l);
296
+ let l = ue(s / a * o, Math.min(Math.max(0, t), o), o), u = Math.max(0, o - l);
258
297
  return {
259
298
  maximumScrollPosition: c,
260
299
  scrollable: !0,
261
- thumbOffset: u * (se(n, 0, c) / c),
300
+ thumbOffset: u * (ue(n, 0, c) / c),
262
301
  thumbSize: l,
263
302
  thumbTravel: u
264
303
  };
265
304
  }
266
305
  //#endregion
267
306
  //#region src/components/GalleryScrollbar.vue?vue&type=script&setup=true&lang.ts
268
- var ce = ["aria-hidden"], le = [
307
+ var de = ["aria-hidden"], fe = [
269
308
  "aria-controls",
270
309
  "aria-valuemax",
271
310
  "aria-valuenow",
272
311
  "tabindex"
273
- ], ue = 32, de = 40, fe = 120, pe = /* @__PURE__ */ d({
312
+ ], pe = 32, me = 40, he = 120, X = /* @__PURE__ */ d({
274
313
  __name: "GalleryScrollbar",
275
314
  props: {
276
315
  contentSize: {},
@@ -292,7 +331,7 @@ var ce = ["aria-hidden"], le = [
292
331
  function k() {
293
332
  g !== null && clearTimeout(g), g = setTimeout(() => {
294
333
  g = null, o.value || (l.value = !1);
295
- }, fe);
334
+ }, he);
296
335
  }
297
336
  function A() {
298
337
  l.value = !0, k();
@@ -301,7 +340,7 @@ var ce = ["aria-hidden"], le = [
301
340
  let e = t.scrollElement, r = i.value;
302
341
  return !e || !r ? n : Y({
303
342
  contentSize: e.scrollHeight,
304
- minimumThumbSize: ue,
343
+ minimumThumbSize: pe,
305
344
  scrollPosition: e.scrollTop,
306
345
  trackSize: r.clientHeight,
307
346
  viewportSize: e.clientHeight
@@ -354,7 +393,7 @@ var ce = ["aria-hidden"], le = [
354
393
  }
355
394
  function z(e) {
356
395
  if (!E.value) return;
357
- let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r - de : e.key === "ArrowDown" ? r + de : e.key === "PageUp" ? r - n : e.key === "PageDown" ? r + n : e.key === "Home" ? 0 : e.key === "End" ? a.value.maximumScrollPosition : null;
396
+ let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r - me : e.key === "ArrowDown" ? r + me : e.key === "PageUp" ? r - n : e.key === "PageDown" ? r + n : e.key === "Home" ? 0 : e.key === "End" ? a.value.maximumScrollPosition : null;
358
397
  i !== null && (e.preventDefault(), A(), P(i));
359
398
  }
360
399
  function B(e) {
@@ -400,15 +439,15 @@ var ce = ["aria-hidden"], le = [
400
439
  onPointerdown: I,
401
440
  onPointermove: L,
402
441
  onPointerup: R
403
- }, null, 44, le)], 42, ce));
442
+ }, null, 44, fe)], 42, de));
404
443
  }
405
- }), me = (e) => {
444
+ }), ge = (e) => {
406
445
  for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
407
446
  return !1;
408
- }, he = (e) => e === "", X = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), ge = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), _e = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), ve = (e) => {
409
- let t = _e(e);
447
+ }, _e = (e) => e === "", ve = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), ye = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), be = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), xe = (e) => {
448
+ let t = be(e);
410
449
  return t.charAt(0).toUpperCase() + t.slice(1);
411
- }, ye = {
450
+ }, Se = {
412
451
  xmlns: "http://www.w3.org/2000/svg",
413
452
  width: 24,
414
453
  height: 24,
@@ -418,27 +457,27 @@ var ce = ["aria-hidden"], le = [
418
457
  "stroke-width": 2,
419
458
  "stroke-linecap": "round",
420
459
  "stroke-linejoin": "round"
421
- }, be = ({ name: e, iconNode: t, absoluteStrokeWidth: n, "absolute-stroke-width": r, strokeWidth: i, "stroke-width": a, size: o = ye.width, color: s = ye.stroke, ...c }, { slots: l }) => p("svg", {
422
- ...ye,
460
+ }, Ce = ({ name: e, iconNode: t, absoluteStrokeWidth: n, "absolute-stroke-width": r, strokeWidth: i, "stroke-width": a, size: o = Se.width, color: s = Se.stroke, ...c }, { slots: l }) => p("svg", {
461
+ ...Se,
423
462
  ...c,
424
463
  width: o,
425
464
  height: o,
426
465
  stroke: s,
427
- "stroke-width": he(n) || he(r) || n === !0 || r === !0 ? Number(i || a || ye["stroke-width"]) * 24 / Number(o) : i || a || ye["stroke-width"],
428
- class: X("lucide", c.class, ...e ? [`lucide-${ge(ve(e))}-icon`, `lucide-${ge(e)}`] : ["lucide-icon"]),
429
- ...!l.default && !me(c) && { "aria-hidden": "true" }
430
- }, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]), xe = (e, t) => (n, { slots: r, attrs: i }) => p(be, {
466
+ "stroke-width": _e(n) || _e(r) || n === !0 || r === !0 ? Number(i || a || Se["stroke-width"]) * 24 / Number(o) : i || a || Se["stroke-width"],
467
+ class: ve("lucide", c.class, ...e ? [`lucide-${ye(xe(e))}-icon`, `lucide-${ye(e)}`] : ["lucide-icon"]),
468
+ ...!l.default && !ge(c) && { "aria-hidden": "true" }
469
+ }, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]), we = (e, t) => (n, { slots: r, attrs: i }) => p(Ce, {
431
470
  ...i,
432
471
  ...n,
433
472
  iconNode: t,
434
473
  name: e
435
- }, r), Se = xe("chevron-left", [["path", {
474
+ }, r), Te = we("chevron-left", [["path", {
436
475
  d: "m15 18-6-6 6-6",
437
476
  key: "1wnfg3"
438
- }]]), Ce = xe("chevron-right", [["path", {
477
+ }]]), Ee = we("chevron-right", [["path", {
439
478
  d: "m9 18 6-6-6-6",
440
479
  key: "mthhwq"
441
- }]]), we = xe("pause", [["rect", {
480
+ }]]), De = we("pause", [["rect", {
442
481
  x: "14",
443
482
  y: "3",
444
483
  width: "5",
@@ -452,10 +491,10 @@ var ce = ["aria-hidden"], le = [
452
491
  height: "18",
453
492
  rx: "1",
454
493
  key: "1wsw3u"
455
- }]]), Te = xe("play", [["path", {
494
+ }]]), Oe = we("play", [["path", {
456
495
  d: "M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",
457
496
  key: "10ikf1"
458
- }]]), Ee = xe("volume-2", [
497
+ }]]), ke = we("volume-2", [
459
498
  ["path", {
460
499
  d: "M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",
461
500
  key: "uqj9uw"
@@ -468,7 +507,7 @@ var ce = ["aria-hidden"], le = [
468
507
  d: "M19.364 18.364a9 9 0 0 0 0-12.728",
469
508
  key: "ijwkga"
470
509
  }]
471
- ]), De = xe("volume-x", [
510
+ ]), Ae = we("volume-x", [
472
511
  ["path", {
473
512
  d: "M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",
474
513
  key: "uqj9uw"
@@ -487,22 +526,22 @@ var ce = ["aria-hidden"], le = [
487
526
  y2: "15",
488
527
  key: "5ykzw1"
489
528
  }]
490
- ]), Oe = {
529
+ ]), je = {
491
530
  401: "Authentication required",
492
531
  403: "Access forbidden",
493
532
  404: "Preview not found",
494
533
  419: "Session expired",
495
534
  500: "Server error"
496
535
  };
497
- function ke(e) {
536
+ function Me(e) {
498
537
  return e.match(/\/demo-errors\/(401|403|404|419|500)\//)?.[1] ?? "Error";
499
538
  }
500
- function Ae(e) {
501
- return Oe[ke(e)] ?? "Preview unavailable";
539
+ function Ne(e) {
540
+ return je[Me(e)] ?? "Preview unavailable";
502
541
  }
503
542
  //#endregion
504
543
  //#region src/components/CardRegion.vue
505
- var je = /* @__PURE__ */ d({
544
+ var Pe = /* @__PURE__ */ d({
506
545
  __name: "CardRegion",
507
546
  props: {
508
547
  index: {},
@@ -549,18 +588,18 @@ var je = /* @__PURE__ */ d({
549
588
  "total"
550
589
  ]))], 38));
551
590
  }
552
- }), Me = [
591
+ }), Fe = [
553
592
  "max",
554
593
  "value",
555
594
  "aria-valuetext",
556
595
  "disabled"
557
- ], Ne = {
596
+ ], Ie = {
558
597
  key: 0,
559
598
  class: "media-controls-row"
560
- }, Pe = ["aria-label", "title"], Fe = { class: "media-controls-audio" }, Ie = ["aria-label", "title"], Le = ["value", "aria-valuetext"], Re = {
599
+ }, Le = ["aria-label", "title"], Re = { class: "media-controls-audio" }, ze = ["aria-label", "title"], Be = ["value", "aria-valuetext"], Ve = {
561
600
  class: "media-control-time",
562
601
  "aria-live": "off"
563
- }, ze = /* @__PURE__ */ d({
602
+ }, He = /* @__PURE__ */ d({
564
603
  __name: "MediaControls",
565
604
  props: {
566
605
  currentTime: {},
@@ -608,35 +647,35 @@ var je = /* @__PURE__ */ d({
608
647
  "aria-valuetext": `${u(p.value)} of ${u(f.value)}`,
609
648
  disabled: f.value <= 0,
610
649
  onInput: n[0] ||= (e) => i("seek", d(e))
611
- }, null, 44, Me), e.layout === "reel" ? (b(), s("div", Ne, [
650
+ }, null, 44, Fe), e.layout === "reel" ? (b(), s("div", Ie, [
612
651
  c("button", {
613
652
  type: "button",
614
653
  class: "media-control-button media-control-playback",
615
654
  "aria-label": e.playing ? "Pause video" : "Play video",
616
655
  title: e.playing ? "Pause" : "Play",
617
656
  onClick: n[1] ||= (e) => i("togglePlayback")
618
- }, [e.playing ? (b(), a(E(we), {
657
+ }, [e.playing ? (b(), a(E(De), {
619
658
  key: 0,
620
659
  size: 18,
621
660
  fill: "currentColor"
622
- })) : (b(), a(E(Te), {
661
+ })) : (b(), a(E(Oe), {
623
662
  key: 1,
624
663
  size: 18,
625
664
  fill: "currentColor"
626
- }))], 8, Pe),
627
- c("div", Fe, [c("button", {
665
+ }))], 8, Le),
666
+ c("div", Re, [c("button", {
628
667
  type: "button",
629
668
  class: "media-control-button",
630
669
  "aria-label": e.muted ? "Unmute video" : "Mute video",
631
670
  title: e.muted ? "Unmute" : "Mute",
632
671
  onClick: n[2] ||= (e) => i("toggleMute")
633
- }, [e.muted || e.volume === 0 ? (b(), a(E(De), {
672
+ }, [e.muted || e.volume === 0 ? (b(), a(E(Ae), {
634
673
  key: 0,
635
674
  size: 18
636
- })) : (b(), a(E(Ee), {
675
+ })) : (b(), a(E(ke), {
637
676
  key: 1,
638
677
  size: 18
639
- }))], 8, Ie), c("input", {
678
+ }))], 8, ze), c("input", {
640
679
  class: "media-control-range media-control-volume",
641
680
  type: "range",
642
681
  min: "0",
@@ -647,14 +686,14 @@ var je = /* @__PURE__ */ d({
647
686
  "aria-label": "Video volume",
648
687
  "aria-valuetext": `${Math.round(e.volume * 100)} percent`,
649
688
  onInput: n[3] ||= (e) => i("volumeChange", d(e))
650
- }, null, 44, Le)]),
651
- c("output", Re, T(u(p.value)) + " / " + T(u(f.value)), 1)
689
+ }, null, 44, Be)]),
690
+ c("output", Ve, T(u(p.value)) + " / " + T(u(f.value)), 1)
652
691
  ])) : o("", !0)], 34));
653
692
  }
654
693
  });
655
694
  //#endregion
656
695
  //#region src/components/useReelVideoActivity.ts
657
- function Be(e) {
696
+ function Ue(e) {
658
697
  let t = r(() => e.layout() !== "reel" || e.active() === !0), n = r(() => t.value ? e.videoIsMuted.value : !0);
659
698
  function i() {
660
699
  if (!t.value) {
@@ -688,18 +727,18 @@ function Be(e) {
688
727
  }
689
728
  //#endregion
690
729
  //#region src/core/mediaType.ts
691
- var Ve = /\.(aac|flac|m4a|mp3|mp4|mov|ogg|opus|wav|webm)$/i;
692
- function He(e) {
730
+ var We = /\.(aac|flac|m4a|mp3|mp4|mov|ogg|opus|wav|webm)$/i;
731
+ function Ge(e) {
693
732
  try {
694
- return Ve.test(new URL(e).pathname);
733
+ return We.test(new URL(e).pathname);
695
734
  } catch {
696
- return Ve.test(e.split("?")[0] ?? e);
735
+ return We.test(e.split("?")[0] ?? e);
697
736
  }
698
737
  }
699
738
  //#endregion
700
739
  //#region src/components/useMediaLoading.ts
701
- function Ue(e) {
702
- let t = r(() => He(e.mediaSource())), n = r(() => e.layout() === "masonry" && e.fetchPriority() === "low" ? "lazy" : "eager"), i = r(() => e.fetchPriority() === "high" ? "auto" : e.layout() === "masonry" ? "none" : "metadata");
740
+ function Ke(e) {
741
+ let t = r(() => Ge(e.mediaSource())), n = r(() => e.layout() === "masonry" && e.fetchPriority() === "low" ? "lazy" : "eager"), i = r(() => e.fetchPriority() === "high" ? "auto" : e.layout() === "masonry" ? "none" : "metadata");
703
742
  return O(i, (t, n) => {
704
743
  n !== "none" || t === "none" || m(() => e.videoElement.value?.load());
705
744
  }), {
@@ -710,7 +749,7 @@ function Ue(e) {
710
749
  }
711
750
  //#endregion
712
751
  //#region src/components/MediaCard.vue?vue&type=script&setup=true&lang.ts
713
- var We = [
752
+ var qe = [
714
753
  "data-post-id",
715
754
  "data-media-index",
716
755
  "aria-hidden",
@@ -718,12 +757,12 @@ var We = [
718
757
  "inert",
719
758
  "role",
720
759
  "tabindex"
721
- ], Ge = { class: "media-card-content" }, Ke = ["data-media-direction"], qe = ["data-media-index"], Je = {
760
+ ], Je = { class: "media-card-content" }, Ye = ["data-media-direction"], Xe = ["data-media-index"], Ze = {
722
761
  key: 0,
723
762
  "data-test": "media-loading",
724
763
  class: "media-loading",
725
764
  "aria-hidden": "true"
726
- }, Ye = ["aria-label"], Xe = { class: "media-error-code" }, Ze = [
765
+ }, Qe = ["aria-label"], $e = { class: "media-error-code" }, et = [
727
766
  "src",
728
767
  "width",
729
768
  "height",
@@ -731,13 +770,13 @@ var We = [
731
770
  "loop",
732
771
  "muted",
733
772
  "preload"
734
- ], Qe = [
773
+ ], tt = [
735
774
  "src",
736
775
  "width",
737
776
  "height",
738
777
  "fetchpriority",
739
778
  "loading"
740
- ], $e = ["aria-label"], et = ["aria-label"], tt = ["aria-label"], nt = 40, rt = 160, it = 24, at = /* @__PURE__ */ d({
779
+ ], nt = ["aria-label"], rt = ["aria-label"], it = ["aria-label"], at = 40, ot = 160, st = 24, ct = /* @__PURE__ */ d({
741
780
  __name: "MediaCard",
742
781
  props: {
743
782
  active: { type: Boolean },
@@ -773,7 +812,7 @@ var We = [
773
812
  function S(e = !1, t = "pointer") {
774
813
  e && x("activate", t);
775
814
  }
776
- 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, { effectiveMuted: ee, onPlaying: G, playbackAllowed: te } = Be({
815
+ 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), U = 1, { effectiveMuted: W, onPlaying: G, playbackAllowed: te } = Ue({
777
816
  active: () => l.active,
778
817
  layout: () => l.layout,
779
818
  videoElement: R,
@@ -794,31 +833,31 @@ var We = [
794
833
  f = 0, p = !1, d !== null && clearTimeout(d), d = null;
795
834
  }
796
835
  function ae() {
797
- d !== null && clearTimeout(d), d = setTimeout(ie, rt);
836
+ d !== null && clearTimeout(d), d = setTimeout(ie, ot);
798
837
  }
799
838
  function oe(e) {
800
839
  if (C.value.length <= 1) return;
801
840
  let t = e.currentTarget?.clientWidth || 1, n = re(e.deltaX, e.deltaMode, t);
802
- if (n === 0 || (e.preventDefault(), ae(), p) || (f += n, Math.abs(f) < it)) return;
841
+ if (n === 0 || (e.preventDefault(), ae(), p) || (f += n, Math.abs(f) < st)) return;
803
842
  let r = Math.sign(f);
804
843
  f = 0, p = !0, q(D.value + r);
805
844
  }
806
- function J(e) {
845
+ function se(e) {
807
846
  let t = e.touches[0];
808
847
  l.layout !== "reel" || !t || (m = t.clientX, g = t.clientY);
809
848
  }
810
- function se(e) {
849
+ function ce(e) {
811
850
  let t = e.changedTouches[0];
812
851
  if (m === null || g === null || !t) return;
813
852
  let n = m - t.clientX, r = g - t.clientY;
814
- m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) < nt || q(D.value + Math.sign(n)));
853
+ m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) < at || q(D.value + Math.sign(n)));
815
854
  }
816
- let { imageLoading: Y, mediaIsTimed: ce, videoPreload: le } = Ue({
855
+ let { imageLoading: le, mediaIsTimed: J, videoPreload: ue } = Ke({
817
856
  fetchPriority: () => l.fetchPriority,
818
857
  layout: () => l.layout,
819
858
  mediaSource: () => F.value,
820
859
  videoElement: R
821
- }), ue = r(() => l.layout === "reel" && l.stationaryReelControls === !0), de = r(() => ce.value && l.previewState === "ready" && (!ue.value || !!(l.active && l.reelControlsTarget))), fe = r(() => `${l.item.postId}:${D.value}:${F.value}`);
860
+ }), Y = r(() => l.layout === "reel" && l.stationaryReelControls === !0), de = r(() => J.value && l.previewState === "ready" && (!Y.value || !!(l.active && l.reelControlsTarget))), fe = r(() => `${l.item.postId}:${D.value}:${F.value}`);
822
861
  function pe(e) {
823
862
  l.layout === "reel" && (e.stopPropagation(), me());
824
863
  }
@@ -840,7 +879,7 @@ var We = [
840
879
  }
841
880
  function X(e) {
842
881
  let t = e?.currentTarget ?? R.value;
843
- t && (z.value = he(t.currentTime), B.value = he(t.duration), te.value && (V.value = t.muted), U.value = t.volume, t.volume > 0 && (W = t.volume));
882
+ t && (z.value = he(t.currentTime), B.value = he(t.duration), te.value && (V.value = t.muted), ee.value = t.volume, t.volume > 0 && (U = t.volume));
844
883
  }
845
884
  function ge(e) {
846
885
  X(e), x("ready", D.value);
@@ -856,11 +895,11 @@ var We = [
856
895
  let t = R.value;
857
896
  if (!t || !Number.isFinite(e)) return;
858
897
  let n = Math.min(1, Math.max(0, e));
859
- t.volume = n, t.muted = n === 0, n > 0 && (W = n), X();
898
+ t.volume = n, t.muted = n === 0, n > 0 && (U = n), X();
860
899
  }
861
900
  function be() {
862
901
  let e = R.value;
863
- e && (e.muted && e.volume === 0 && (e.volume = W), e.muted = !e.muted, X());
902
+ e && (e.muted && e.volume === 0 && (e.volume = U), e.muted = !e.muted, X());
864
903
  }
865
904
  return v(() => {
866
905
  ie();
@@ -881,8 +920,8 @@ var We = [
881
920
  tabindex: e.interactive && !e.leaving && !K.value ? 0 : void 0,
882
921
  onClick: i[11] ||= (t) => S(e.interactive && !K.value, ne(t)),
883
922
  onKeydown: [i[12] ||= A((t) => S(e.interactive && !K.value, "keyboard"), ["enter"]), i[13] ||= A(j((t) => S(e.interactive && !K.value, "keyboard"), ["prevent"]), ["space"])]
884
- }, [c("div", Ge, [
885
- e.cardHeader ? (b(), a(je, {
923
+ }, [c("div", Je, [
924
+ e.cardHeader ? (b(), a(Pe, {
886
925
  key: 0,
887
926
  index: e.index,
888
927
  item: e.item,
@@ -909,21 +948,21 @@ var We = [
909
948
  class: h(["media-card-media", { "media-card-media--carousel": e.layout === "reel" && C.value.length > 1 }]),
910
949
  "data-media-direction": y.value,
911
950
  onWheel: oe,
912
- onTouchstartPassive: J,
913
- onTouchendPassive: se
951
+ onTouchstartPassive: se,
952
+ onTouchendPassive: ce
914
953
  }, [
915
954
  u(n, { name: `media-slide-${y.value}` }, {
916
955
  default: k(() => [(b(), s("div", {
917
956
  key: `${e.item.postId}:${O.value.src}:${e.mediaSource ?? "preview"}`,
918
957
  class: "media-card-frame",
919
958
  "data-media-index": D.value
920
- }, [e.previewState === "loading" ? (b(), s("div", Je, [...i[14] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : e.previewState === "error" ? (b(), s("div", {
959
+ }, [e.previewState === "loading" ? (b(), s("div", Ze, [...i[14] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : e.previewState === "error" ? (b(), s("div", {
921
960
  key: 1,
922
961
  "data-test": "media-error",
923
962
  class: "media-error",
924
963
  role: "img",
925
- "aria-label": `${E(ke)(F.value)} ${E(Ae)(F.value)}`
926
- }, [c("strong", Xe, T(E(ke)(F.value)), 1), c("span", null, T(E(Ae)(F.value)), 1)], 8, Ye)) : o("", !0), E(ce) ? (b(), s("video", {
964
+ "aria-label": `${E(Me)(F.value)} ${E(Ne)(F.value)}`
965
+ }, [c("strong", $e, T(E(Me)(F.value)), 1), c("span", null, T(E(Ne)(F.value)), 1)], 8, Qe)) : o("", !0), E(J) ? (b(), s("video", {
927
966
  key: 2,
928
967
  ref_key: "videoElement",
929
968
  ref: R,
@@ -936,9 +975,9 @@ var We = [
936
975
  height: L.value ?? void 0,
937
976
  autoplay: E(te),
938
977
  loop: !e.advanceOnMediaEnd,
939
- muted: E(ee),
978
+ muted: E(W),
940
979
  playsinline: "",
941
- preload: E(le),
980
+ preload: E(ue),
942
981
  onLoadedmetadata: ge,
943
982
  onDurationchange: X,
944
983
  onTimeupdate: X,
@@ -948,7 +987,7 @@ var We = [
948
987
  onEnded: _e,
949
988
  onClick: pe,
950
989
  onError: i[2] ||= (e) => r.$emit("error", D.value)
951
- }, null, 42, Ze)) : (b(), s("img", {
990
+ }, null, 42, et)) : (b(), s("img", {
952
991
  key: 3,
953
992
  class: h(["media-preview", { "media-preview--ready": e.previewState === "ready" }]),
954
993
  src: F.value,
@@ -957,28 +996,28 @@ var We = [
957
996
  fetchpriority: e.fetchPriority,
958
997
  alt: "",
959
998
  decoding: "async",
960
- loading: E(Y),
999
+ loading: E(le),
961
1000
  onLoad: i[3] ||= (e) => r.$emit("ready", D.value),
962
1001
  onError: i[4] ||= (e) => r.$emit("error", D.value)
963
- }, null, 42, Qe))], 8, qe))]),
1002
+ }, null, 42, tt))], 8, Xe))]),
964
1003
  _: 1
965
1004
  }, 8, ["name"]),
966
1005
  (b(), a(t, {
967
- disabled: !ue.value || !e.reelControlsTarget,
1006
+ disabled: !Y.value || !e.reelControlsTarget,
968
1007
  to: e.reelControlsTarget ?? "body"
969
1008
  }, [u(n, {
970
1009
  name: "vibe-reel-media-controls",
971
- css: ue.value
1010
+ css: Y.value
972
1011
  }, {
973
- default: k(() => [de.value ? (b(), a(ze, {
1012
+ default: k(() => [de.value ? (b(), a(He, {
974
1013
  key: fe.value,
975
1014
  "current-time": z.value,
976
- "data-control-post-id": ue.value ? e.item.postId : void 0,
1015
+ "data-control-post-id": Y.value ? e.item.postId : void 0,
977
1016
  duration: B.value,
978
1017
  layout: e.layout,
979
1018
  muted: V.value,
980
1019
  playing: H.value,
981
- volume: U.value,
1020
+ volume: ee.value,
982
1021
  onSeek: ve,
983
1022
  onToggleMute: be,
984
1023
  onTogglePlayback: me,
@@ -1004,13 +1043,13 @@ var We = [
1004
1043
  "aria-label": `Previous media for post ${e.item.postId}`,
1005
1044
  onClick: i[5] ||= j((e) => q(D.value - 1, e), ["stop"]),
1006
1045
  onKeydown: i[6] ||= j(() => {}, ["stop"])
1007
- }, [u(E(Se), { size: 20 })], 40, $e), c("button", {
1046
+ }, [u(E(Te), { size: 20 })], 40, nt), c("button", {
1008
1047
  type: "button",
1009
1048
  class: "media-carousel-control media-carousel-control--next",
1010
1049
  "aria-label": `Next media for post ${e.item.postId}`,
1011
1050
  onClick: i[7] ||= j((e) => q(D.value + 1, e), ["stop"]),
1012
1051
  onKeydown: i[8] ||= j(() => {}, ["stop"])
1013
- }, [u(E(Ce), { size: 20 })], 40, et)], 2)) : o("", !0),
1052
+ }, [u(E(Ee), { size: 20 })], 40, rt)], 2)) : o("", !0),
1014
1053
  K.value ? (b(), s("button", {
1015
1054
  key: 1,
1016
1055
  class: "media-card-activator",
@@ -1018,9 +1057,9 @@ var We = [
1018
1057
  "aria-label": `Open post ${e.item.postId}`,
1019
1058
  onClick: i[9] ||= j((e) => r.$emit("activate", ne(e)), ["stop"]),
1020
1059
  onKeydown: i[10] ||= j(() => {}, ["stop"])
1021
- }, null, 40, tt)) : o("", !0)
1022
- ], 42, Ke),
1023
- e.cardFooter ? (b(), a(je, {
1060
+ }, null, 40, it)) : o("", !0)
1061
+ ], 42, Ye),
1062
+ e.cardFooter ? (b(), a(Pe, {
1024
1063
  key: 1,
1025
1064
  index: e.index,
1026
1065
  item: e.item,
@@ -1043,12 +1082,12 @@ var We = [
1043
1082
  "style",
1044
1083
  "total"
1045
1084
  ])) : o("", !0)
1046
- ])], 46, We));
1085
+ ])], 46, qe));
1047
1086
  }
1048
- }), ot = { class: "masonry-feed-shell" }, st = ["aria-hidden", "inert"], ct = {
1087
+ }), lt = { class: "masonry-feed-shell" }, ut = ["aria-hidden", "inert"], dt = {
1049
1088
  key: 0,
1050
1089
  class: "masonry-feed-status-overlay"
1051
- }, lt = 240, ut = 6, dt = 12, ft = /* @__PURE__ */ d({
1090
+ }, ft = 6, pt = 12, mt = /* @__PURE__ */ d({
1052
1091
  __name: "MasonryFeed",
1053
1092
  props: {
1054
1093
  enteringPostIds: {},
@@ -1084,63 +1123,75 @@ var We = [
1084
1123
  "visible"
1085
1124
  ],
1086
1125
  setup(t, { expose: n, emit: i }) {
1087
- let l = t, d = i, f = w(null), p = `vibe-masonry-${D()}`, m = w(null), g = w(0), y = w(ut), x = w(0), C = w(0), T = w(0), k = w([]), A = w([]), j = 0, M = null, N = null, P = null, I = null, L = r(() => ae(l.items, g.value, {
1126
+ let l = t, d = i, f = w(null), p = `vibe-masonry-${D()}`, m = w(null), g = w(0), y = w(ft), x = w(0), C = w(0), T = w(0), k = w([]), A = w([]), j = 0, M = null, N = null, P = null, I = null, L = r(() => ie(l.items, g.value, {
1088
1127
  additionalHeight: (l.cardHeader?.height ?? 0) + (l.cardFooter?.height ?? 0),
1089
1128
  gap: y.value,
1090
- minColumnWidth: lt
1129
+ minColumnWidth: ce(l.masonry)
1091
1130
  })), R = r(() => {
1092
- let e = L.value;
1093
- if (l.leavingPostIds.size === 0) return e;
1094
- let t = l.items.filter((e) => !l.leavingPostIds.has(e.postId)), n = ae(t, g.value, {
1131
+ if (l.leavingPostIds.size === 0) return null;
1132
+ let e = l.items.flatMap((e, t) => l.leavingPostIds.has(e.postId) ? [] : [{
1133
+ index: t,
1134
+ item: e
1135
+ }]), t = ie(e.map(({ item: e }) => e), g.value, {
1095
1136
  additionalHeight: (l.cardHeader?.height ?? 0) + (l.cardFooter?.height ?? 0),
1096
1137
  gap: y.value,
1097
- minColumnWidth: lt
1098
- }), r = new Map(t.map((e, t) => [e.postId, n.items[t]]));
1138
+ minColumnWidth: ce(l.masonry)
1139
+ });
1099
1140
  return {
1100
- ...n,
1101
- items: l.items.map((t, n) => l.leavingPostIds.has(t.postId) ? e.items[n] : r.get(t.postId) ?? e.items[n])
1141
+ indices: e.map(({ index: e }) => e),
1142
+ layout: t,
1143
+ positions: new Map(e.map(({ item: e }, n) => [e.postId, t.items[n]]))
1102
1144
  };
1103
- }), z = r(() => Math.max(C.value, l.leavingPostIds.size === 0 ? R.value.height : L.value.height)), B = r(() => ({ height: `${z.value}px` })), V = r(() => !l.infiniteScroll || x.value > 0 && T.value + R.value.height <= x.value + 1), H = r(() => new Set(k.value)), U = r(() => A.value.flatMap((e) => {
1145
+ }), z = r(() => {
1146
+ let e = L.value, t = R.value;
1147
+ return t ? {
1148
+ ...t.layout,
1149
+ items: l.items.map((n, r) => l.leavingPostIds.has(n.postId) ? e.items[r] : t.positions.get(n.postId) ?? e.items[r])
1150
+ } : e;
1151
+ }), B = r(() => ae(L.value.items)), V = r(() => {
1152
+ let e = R.value;
1153
+ return e ? ae(e.layout.items, e.indices) : null;
1154
+ }), H = r(() => Math.max(C.value, l.leavingPostIds.size === 0 ? z.value.height : L.value.height)), ee = r(() => ({ height: `${H.value}px` })), W = r(() => !l.infiniteScroll || x.value > 0 && T.value + z.value.height <= x.value + 1), G = r(() => new Set(k.value)), te = r(() => A.value.flatMap((e) => {
1104
1155
  let t = l.items[e];
1105
1156
  return t ? [{
1106
- fetchPriority: H.value.has(e) ? "high" : "low",
1157
+ fetchPriority: G.value.has(e) ? "high" : "low",
1107
1158
  index: e,
1108
1159
  item: t
1109
1160
  }] : [];
1110
1161
  }));
1111
- function ee(e, t) {
1162
+ function ne(e, t) {
1112
1163
  return [...new Set([...e, ...t])].sort((e, t) => e - t);
1113
1164
  }
1114
- function G(e, t) {
1165
+ function q(e, t) {
1115
1166
  return e.length === t.length && e.every((e, n) => e === t[n]);
1116
1167
  }
1117
- function te(e) {
1168
+ function oe(e) {
1118
1169
  let t = {
1119
1170
  scrollTop: j - T.value,
1120
1171
  viewportHeight: x.value
1121
- };
1122
- return ee(ie(R.value.items, {
1172
+ }, n = V.value, r = se(n ?? B.value, {
1123
1173
  ...t,
1124
1174
  overscan: e
1125
- }), l.leavingPostIds.size === 0 ? [] : ie(L.value.items, {
1175
+ }).indices;
1176
+ return ne(r, l.leavingPostIds.size === 0 ? [] : se(B.value, {
1126
1177
  ...t,
1127
1178
  overscan: e
1128
- }));
1179
+ }).indices);
1129
1180
  }
1130
- function ne() {
1131
- let e = l.suspended ? [] : te(0), t = te(oe(l.masonry, x.value));
1132
- G(k.value, e) || (k.value = e), G(A.value, t) || (A.value = t);
1181
+ function J() {
1182
+ let e = l.suspended ? [] : oe(0), t = oe(le(l.masonry, x.value));
1183
+ q(k.value, e) || (k.value = e), q(A.value, t) || (A.value = t);
1133
1184
  }
1134
- function q() {
1185
+ function ue() {
1135
1186
  if (I !== null) return;
1136
1187
  I = -1;
1137
1188
  let e = requestAnimationFrame(() => {
1138
- I = null, ne();
1189
+ I = null, J();
1139
1190
  });
1140
1191
  I !== null && (I = e);
1141
1192
  }
1142
- let J = /* @__PURE__ */ new Set();
1143
- O(() => [...H.value].flatMap((e) => {
1193
+ let Y = /* @__PURE__ */ new Set();
1194
+ O(() => [...G.value].flatMap((e) => {
1144
1195
  let t = l.items[e];
1145
1196
  if (!t) return [];
1146
1197
  let n = l.mediaIndices.get(t.postId) ?? 0, r = F(t.postId, n);
@@ -1152,14 +1203,14 @@ var We = [
1152
1203
  }), (e) => {
1153
1204
  let t = new Set(e.map(({ key: e }) => e));
1154
1205
  e.forEach(({ key: e, mediaIndex: t, postId: n }) => {
1155
- J.has(e) || d("visible", n, t);
1156
- }), J = t;
1206
+ Y.has(e) || d("visible", n, t);
1207
+ }), Y = t;
1157
1208
  }, {
1158
1209
  immediate: !0,
1159
1210
  flush: "post"
1160
1211
  });
1161
- function se(e) {
1162
- let t = R.value.items[e], n = l.items[e]?.postId;
1212
+ function de(e) {
1213
+ let t = z.value.items[e], n = l.items[e]?.postId;
1163
1214
  if (!t) return {};
1164
1215
  let r = n !== void 0 && l.enteringPostIds.has(n), i = n !== void 0 && l.leavingPostIds.has(n), a = r || i ? re({
1165
1216
  containerHeight: Math.max(C.value, L.value.height),
@@ -1172,50 +1223,50 @@ var We = [
1172
1223
  transform: `translate3d(${t.x}px, ${t.y + a}px, 0)`
1173
1224
  };
1174
1225
  }
1175
- function Y() {
1226
+ function fe() {
1176
1227
  let e = f.value;
1177
1228
  if (!e) return;
1178
1229
  j = e.scrollTop, x.value = e.clientHeight;
1179
1230
  let t = e.ownerDocument.defaultView?.getComputedStyle(e), n = (Number.parseFloat(t?.paddingTop ?? "") || 0) + (Number.parseFloat(t?.paddingBottom ?? "") || 0);
1180
1231
  C.value = Math.max(0, e.clientHeight - n);
1181
1232
  let r = m.value;
1182
- r && (T.value = r.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop, ne());
1233
+ r && (T.value = r.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop, J());
1183
1234
  }
1184
- function ce(e) {
1235
+ function pe(e) {
1185
1236
  let t = e.ownerDocument.documentElement.clientWidth;
1186
- g.value = e.clientWidth, y.value = Math.min(dt, Math.max(ut, t * .0075)), Y();
1237
+ g.value = e.clientWidth, y.value = Math.min(pt, Math.max(ft, t * .0075)), fe();
1187
1238
  }
1188
- function le(e) {
1239
+ function me(e) {
1189
1240
  let t = e.currentTarget;
1190
- t && (j = t.scrollTop, q(), !l.loadMoreLocked && l.infiniteScroll && K(t) && d("loadMore"));
1241
+ t && (j = t.scrollTop, ue(), !l.loadMoreLocked && l.infiniteScroll && K(t) && d("loadMore"));
1191
1242
  }
1192
- function ue() {
1243
+ function he() {
1193
1244
  let e = f.value;
1194
1245
  !l.loadMoreLocked && e && K(e) && d("loadMore");
1195
1246
  }
1196
- function de() {
1247
+ function ge() {
1197
1248
  return f.value;
1198
1249
  }
1199
1250
  return O(m, (e) => {
1200
- M?.disconnect(), M = null, P !== null && cancelAnimationFrame(P), e && (ce(e), !(typeof ResizeObserver > "u") && (M = new ResizeObserver(([t]) => {
1251
+ M?.disconnect(), M = null, P !== null && cancelAnimationFrame(P), e && (pe(e), !(typeof ResizeObserver > "u") && (M = new ResizeObserver(([t]) => {
1201
1252
  let n = t?.contentRect.width ?? e.clientWidth;
1202
1253
  Math.abs(n - g.value) < .5 || (P = requestAnimationFrame(() => {
1203
- P = null, ce(e);
1254
+ P = null, pe(e);
1204
1255
  }));
1205
1256
  }), M.observe(e)));
1206
1257
  }), O(f, (e) => {
1207
- N?.disconnect(), N = null, e && (Y(), !(typeof ResizeObserver > "u") && (N = new ResizeObserver(Y), N.observe(e)));
1258
+ N?.disconnect(), N = null, e && (fe(), !(typeof ResizeObserver > "u") && (N = new ResizeObserver(fe), N.observe(e)));
1208
1259
  }), O([
1209
1260
  L,
1210
- R,
1261
+ z,
1211
1262
  () => l.suspended,
1212
1263
  () => l.masonry
1213
- ], ne, { flush: "post" }), v(() => {
1264
+ ], J, { flush: "post" }), v(() => {
1214
1265
  M?.disconnect(), N?.disconnect(), P !== null && cancelAnimationFrame(P), I !== null && cancelAnimationFrame(I);
1215
1266
  }), n({
1216
- getScrollElement: de,
1217
- loadIfNearBottom: ue
1218
- }), (n, r) => (b(), s("div", ot, [
1267
+ getScrollElement: ge,
1268
+ loadIfNearBottom: he
1269
+ }), (n, r) => (b(), s("div", lt, [
1219
1270
  c("main", {
1220
1271
  id: p,
1221
1272
  ref_key: "galleryElement",
@@ -1224,14 +1275,14 @@ var We = [
1224
1275
  "data-layout-mode": "masonry",
1225
1276
  "aria-hidden": t.suspended || void 0,
1226
1277
  inert: t.suspended || void 0,
1227
- onScrollPassive: le
1278
+ onScrollPassive: me
1228
1279
  }, [c("section", {
1229
1280
  ref_key: "masonryElement",
1230
1281
  ref: m,
1231
1282
  class: h(["masonry", { "masonry--ready": g.value > 0 }]),
1232
- style: _(B.value),
1283
+ style: _(ee.value),
1233
1284
  "aria-label": "Media gallery"
1234
- }, [(b(!0), s(e, null, S(U.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(at, {
1285
+ }, [(b(!0), s(e, null, S(te.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(ct, {
1235
1286
  key: n.postId,
1236
1287
  class: "masonry-item",
1237
1288
  entering: t.enteringPostIds.has(n.postId),
@@ -1242,7 +1293,7 @@ var We = [
1242
1293
  "media-card": t.mediaCard,
1243
1294
  index: r,
1244
1295
  item: n,
1245
- "item-style": se(r),
1296
+ "item-style": de(r),
1246
1297
  interactive: "",
1247
1298
  layout: "masonry",
1248
1299
  "loaded-count": t.items.length,
@@ -1271,8 +1322,8 @@ var We = [
1271
1322
  "onMediaChange",
1272
1323
  "onReady",
1273
1324
  "onError"
1274
- ]))), 128))], 6)], 42, st),
1275
- t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && V.value || !t.hasNext && t.canRetryEnd ? (b(), s("div", ct, [u(W, {
1325
+ ]))), 128))], 6)], 42, ut),
1326
+ t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && W.value || !t.hasNext && t.canRetryEnd ? (b(), s("div", dt, [u(U, {
1276
1327
  actions: t.feedFooterActions,
1277
1328
  "can-retry-end": t.canRetryEnd,
1278
1329
  "feed-footer": t.feedFooter,
@@ -1280,7 +1331,7 @@ var We = [
1280
1331
  "has-next": t.hasNext,
1281
1332
  "is-loading": t.isLoadingMore,
1282
1333
  "load-more-locked": t.loadMoreLocked,
1283
- "show-load-more": V.value,
1334
+ "show-load-more": W.value,
1284
1335
  state: t.state,
1285
1336
  onLoadMore: r[0] ||= (e) => d("loadMore"),
1286
1337
  onRetryEnd: r[1] ||= (e) => d("retryEnd")
@@ -1295,8 +1346,8 @@ var We = [
1295
1346
  "show-load-more",
1296
1347
  "state"
1297
1348
  ])])) : o("", !0),
1298
- u(pe, {
1299
- "content-size": R.value.height,
1349
+ u(X, {
1350
+ "content-size": z.value.height,
1300
1351
  "controls-id": p,
1301
1352
  "scroll-element": f.value,
1302
1353
  suspended: t.suspended
@@ -1307,8 +1358,8 @@ var We = [
1307
1358
  ])
1308
1359
  ]));
1309
1360
  }
1310
- }), pt = 300;
1311
- function mt(e, t, n) {
1361
+ }), ht = 300;
1362
+ function gt(e, t, n) {
1312
1363
  let r = e.scrollTop;
1313
1364
  if (n || Math.abs(r - t) <= 1) return e.scrollTop = t, Promise.resolve();
1314
1365
  e.setAttribute("data-transitioning", "");
@@ -1316,7 +1367,7 @@ function mt(e, t, n) {
1316
1367
  return new Promise((n) => {
1317
1368
  let o = (s) => {
1318
1369
  a += 1;
1319
- let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / pt), u = 1 - (1 - l) ** 3;
1370
+ let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / ht), u = 1 - (1 - l) ** 3;
1320
1371
  if (e.scrollTop = r + (t - r) * u, l < 1) {
1321
1372
  requestAnimationFrame(o);
1322
1373
  return;
@@ -1328,7 +1379,7 @@ function mt(e, t, n) {
1328
1379
  }
1329
1380
  //#endregion
1330
1381
  //#region src/components/ReelAutoAdvanceProgress.vue?vue&type=script&setup=true&lang.ts
1331
- var ht = ["aria-label"], gt = /* @__PURE__ */ d({
1382
+ var _t = ["aria-label"], vt = /* @__PURE__ */ d({
1332
1383
  __name: "ReelAutoAdvanceProgress",
1333
1384
  props: {
1334
1385
  durationMs: {},
@@ -1346,9 +1397,9 @@ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
1346
1397
  class: "reel-auto-advance-progress",
1347
1398
  style: _(a.value),
1348
1399
  onAnimationend: n[0] ||= (e) => i("complete")
1349
- }, null, 36)], 8, ht));
1400
+ }, null, 36)], 8, _t));
1350
1401
  }
1351
- }), _t = { class: "reel-viewport" }, vt = ["data-active-post-id", "data-active-media-index"], yt = ["role", "data-status"], bt = 2, xt = 300, St = /* @__PURE__ */ d({
1402
+ }), yt = { class: "reel-viewport" }, bt = ["data-active-post-id", "data-active-media-index"], xt = ["role", "data-status"], St = 2, Ct = 300, wt = /* @__PURE__ */ d({
1352
1403
  __name: "ReelFeed",
1353
1404
  props: {
1354
1405
  initialPostId: {},
@@ -1386,7 +1437,7 @@ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
1386
1437
  ],
1387
1438
  setup(t, { expose: n, emit: i }) {
1388
1439
  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(() => {
1389
- let e = Math.max(0, g.value - bt), t = Math.min(l.items.length - 1, g.value + bt);
1440
+ let e = Math.max(0, g.value - St), t = Math.min(l.items.length - 1, g.value + St);
1390
1441
  return l.items.slice(e, t + 1).map((t, n) => ({
1391
1442
  fetchPriority: e + n === g.value ? "high" : "low",
1392
1443
  index: e + n,
@@ -1403,7 +1454,7 @@ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
1403
1454
  if (!e) return "";
1404
1455
  let t = P(e, z.value);
1405
1456
  return l.mediaSource === "original" ? t.src : t.preview.src;
1406
- }), H = r(() => B.value === "ready" && He(V.value)), U = r(() => [
1457
+ }), H = r(() => B.value === "ready" && Ge(V.value)), ee = r(() => [
1407
1458
  L.value,
1408
1459
  z.value,
1409
1460
  l.items.length,
@@ -1411,7 +1462,7 @@ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
1411
1462
  l.reelAutoAdvance.enabled,
1412
1463
  l.reelAutoAdvance.includePostItems,
1413
1464
  l.reelAutoAdvance.intervalMs
1414
- ].join(":")), ee = r(() => {
1465
+ ].join(":")), W = r(() => {
1415
1466
  let e = R.value, t = !!(e && l.reelAutoAdvance.includePostItems && z.value < M(e).length - 1), n = l.reelAutoAdvance.intervalMs / 1e3;
1416
1467
  return `Auto advance to the next ${t ? "post item" : "post"} in ${n}s`;
1417
1468
  }), G = 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.");
@@ -1430,7 +1481,7 @@ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
1430
1481
  }
1431
1482
  function ae() {
1432
1483
  let e = d.value;
1433
- e && (x.value = !1, se(!0), D = e.clientHeight, e.scrollTop = g.value * D, A !== null && cancelAnimationFrame(A), A = requestAnimationFrame(() => {
1484
+ e && (x.value = !1, ce(!0), D = e.clientHeight, e.scrollTop = g.value * D, A !== null && cancelAnimationFrame(A), A = requestAnimationFrame(() => {
1434
1485
  e.scrollTop = g.value * e.clientHeight, D = e.clientHeight, A = null;
1435
1486
  }), oe());
1436
1487
  }
@@ -1438,22 +1489,22 @@ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
1438
1489
  j !== null && clearTimeout(j), j = setTimeout(() => {
1439
1490
  j = null;
1440
1491
  let e = d.value;
1441
- e && (D = e.clientHeight, e.scrollTop = g.value * D), se(!1);
1492
+ e && (D = e.clientHeight, e.scrollTop = g.value * D), ce(!1);
1442
1493
  }, 120);
1443
1494
  }
1444
- function J() {
1445
- se(!0);
1495
+ function se() {
1496
+ ce(!0);
1446
1497
  let e = d.value;
1447
1498
  e && (D = e.clientHeight, e.scrollTop = g.value * D), oe();
1448
1499
  }
1449
- function se(e) {
1500
+ function ce(e) {
1450
1501
  C.value = e, d.value?.toggleAttribute("data-resizing", e);
1451
1502
  }
1452
- function Y() {
1503
+ function le() {
1453
1504
  let e = d.value;
1454
1505
  !l.loadMoreLocked && e && K(e) && u("loadMore");
1455
1506
  }
1456
- function ce(e) {
1507
+ function J(e) {
1457
1508
  let t = R.value;
1458
1509
  if (!t) return !1;
1459
1510
  let n = M(t).length;
@@ -1461,11 +1512,11 @@ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
1461
1512
  let r = (z.value + e + n) % n;
1462
1513
  return u("mediaChange", t.postId, r), !0;
1463
1514
  }
1464
- function le(e) {
1515
+ function ue(e) {
1465
1516
  let t = g.value + e;
1466
1517
  return !d.value || t < 0 || t >= l.items.length ? !1 : (pe(t), !0);
1467
1518
  }
1468
- function ue(e, t) {
1519
+ function Y(e, t) {
1469
1520
  let n = l.items.findIndex((t) => t.postId === e), r = l.items[n];
1470
1521
  return !d.value || !r || t < 0 || t > r.items.length ? !1 : ((l.mediaIndices.get(e) ?? 0) !== t && u("mediaChange", e, t), n !== g.value && pe(n), !0);
1471
1522
  }
@@ -1476,7 +1527,7 @@ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
1476
1527
  let t = d.value;
1477
1528
  if (!t) return Promise.resolve();
1478
1529
  let n = e * (D || t.clientHeight);
1479
- return g.value = e, mt(t, n, de());
1530
+ return g.value = e, gt(t, n, de());
1480
1531
  }
1481
1532
  function pe(e) {
1482
1533
  fe(e);
@@ -1486,7 +1537,7 @@ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
1486
1537
  return t < 0 || t === g.value ? !1 : (await fe(t), !0);
1487
1538
  }
1488
1539
  async function he(e) {
1489
- return ce(e) ? (de() || await new Promise((e) => setTimeout(e, xt)), !0) : !1;
1540
+ return J(e) ? (de() || await new Promise((e) => setTimeout(e, Ct)), !0) : !1;
1490
1541
  }
1491
1542
  function X() {
1492
1543
  if (!l.reelAutoAdvance.enabled) return;
@@ -1514,16 +1565,16 @@ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
1514
1565
  }), O(L, (e) => {
1515
1566
  e !== void 0 && u("activeChange", e);
1516
1567
  }, { immediate: !0 }), y(() => {
1517
- window.addEventListener("resize", J), window.addEventListener("orientationchange", J), p >= 0 && m(ae);
1568
+ window.addEventListener("resize", se), window.addEventListener("orientationchange", se), p >= 0 && m(ae);
1518
1569
  }), v(() => {
1519
- window.removeEventListener("resize", J), window.removeEventListener("orientationchange", J), k?.disconnect(), A !== null && cancelAnimationFrame(A), j !== null && clearTimeout(j);
1570
+ window.removeEventListener("resize", se), window.removeEventListener("orientationchange", se), k?.disconnect(), A !== null && cancelAnimationFrame(A), j !== null && clearTimeout(j);
1520
1571
  }), n({
1521
1572
  activeIndex: g,
1522
1573
  activePostId: L,
1523
- changeActiveMedia: ce,
1524
- loadIfNearBottom: Y,
1525
- moveActivePost: le,
1526
- navigateToItem: ue,
1574
+ changeActiveMedia: J,
1575
+ loadIfNearBottom: le,
1576
+ moveActivePost: ue,
1577
+ navigateToItem: Y,
1527
1578
  transitionActiveMedia: he,
1528
1579
  transitionActivePost: me
1529
1580
  }), (n, r) => (b(), s("main", {
@@ -1533,7 +1584,7 @@ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
1533
1584
  }]),
1534
1585
  "data-layout-mode": "reel"
1535
1586
  }, [
1536
- t.cardHeader && R.value && t.reelForward.status === "idle" ? (b(), a(je, {
1587
+ t.cardHeader && R.value && t.reelForward.status === "idle" ? (b(), a(Pe, {
1537
1588
  key: 0,
1538
1589
  index: g.value,
1539
1590
  item: R.value,
@@ -1555,7 +1606,7 @@ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
1555
1606
  "style",
1556
1607
  "total"
1557
1608
  ])) : o("", !0),
1558
- c("div", _t, [c("div", {
1609
+ c("div", yt, [c("div", {
1559
1610
  ref_key: "galleryElement",
1560
1611
  ref: d,
1561
1612
  class: "gallery-shell reel-feed",
@@ -1567,7 +1618,7 @@ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
1567
1618
  class: "reel-track",
1568
1619
  style: _(N.value),
1569
1620
  "aria-label": "Media gallery"
1570
- }, [(b(!0), s(e, null, S(I.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(at, {
1621
+ }, [(b(!0), s(e, null, S(I.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(ct, {
1571
1622
  key: n.postId,
1572
1623
  active: r === g.value && !x.value,
1573
1624
  "advance-on-media-end": l.reelAutoAdvance.enabled && r === g.value,
@@ -1618,7 +1669,7 @@ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
1618
1669
  class: "reel-forward-retry",
1619
1670
  type: "button",
1620
1671
  onClick: r[0] ||= (e) => u("retryForward")
1621
- }, " Retry ")) : o("", !0)], 8, yt)), t.reelForward.status === "idle" ? (b(), a(W, {
1672
+ }, " Retry ")) : o("", !0)], 8, xt)), t.reelForward.status === "idle" ? (b(), a(U, {
1622
1673
  key: 2,
1623
1674
  actions: t.feedFooterActions,
1624
1675
  "can-retry-end": t.canRetryEnd,
@@ -1641,13 +1692,13 @@ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
1641
1692
  "load-more-locked",
1642
1693
  "show-load-more",
1643
1694
  "state"
1644
- ])) : o("", !0)], 40, vt), c("div", {
1695
+ ])) : o("", !0)], 40, bt), c("div", {
1645
1696
  ref_key: "reelControlsElement",
1646
1697
  ref: f,
1647
1698
  class: "reel-media-controls-host",
1648
1699
  "data-test": "reel-media-controls-host"
1649
1700
  }, null, 512)]),
1650
- t.cardFooter && R.value && t.reelForward.status === "idle" ? (b(), a(je, {
1701
+ t.cardFooter && R.value && t.reelForward.status === "idle" ? (b(), a(Pe, {
1651
1702
  key: 1,
1652
1703
  index: g.value,
1653
1704
  item: R.value,
@@ -1669,24 +1720,24 @@ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
1669
1720
  "style",
1670
1721
  "total"
1671
1722
  ])) : o("", !0),
1672
- G.value ? (b(), a(gt, {
1673
- key: U.value,
1723
+ G.value ? (b(), a(vt, {
1724
+ key: ee.value,
1674
1725
  "duration-ms": t.reelAutoAdvance.intervalMs,
1675
- label: ee.value,
1726
+ label: W.value,
1676
1727
  onComplete: X
1677
1728
  }, null, 8, ["duration-ms", "label"])) : o("", !0)
1678
1729
  ], 2));
1679
1730
  }
1680
- }), Ct = ["data-info-sheet-open", "data-info-sheet-mode"], wt = ["aria-hidden", "inert"], Tt = {
1731
+ }), Tt = ["data-info-sheet-open", "data-info-sheet-mode"], Et = ["aria-hidden", "inert"], Dt = {
1681
1732
  key: 0,
1682
1733
  class: "reel-info-sheet-layer",
1683
1734
  "data-test": "reel-info-sheet"
1684
- }, Et = [
1735
+ }, Ot = [
1685
1736
  "role",
1686
1737
  "aria-modal",
1687
1738
  "tabindex",
1688
1739
  "data-active-post-id"
1689
- ], Dt = /* @__PURE__ */ d({
1740
+ ], kt = /* @__PURE__ */ d({
1690
1741
  __name: "ReelLayout",
1691
1742
  props: {
1692
1743
  forwardIndex: { default: null },
@@ -1779,7 +1830,7 @@ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
1779
1830
  function H(e, t) {
1780
1831
  d("mediaChange", e, t);
1781
1832
  }
1782
- function U(e, t) {
1833
+ function ee(e, t) {
1783
1834
  d("ready", e, t);
1784
1835
  }
1785
1836
  return O(() => ({
@@ -1811,7 +1862,7 @@ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
1811
1862
  class: "reel-layout-main",
1812
1863
  "aria-hidden": e.infoSheetOverlay && A.value || void 0,
1813
1864
  inert: e.infoSheetOverlay && A.value || void 0
1814
- }, [u(St, {
1865
+ }, [u(wt, {
1815
1866
  ref_key: "reelFeed",
1816
1867
  ref: p,
1817
1868
  "can-retry-end": e.canRetryEnd,
@@ -1838,7 +1889,7 @@ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
1838
1889
  onError: V,
1839
1890
  onLoadMore: r[1] ||= (e) => d("loadMore"),
1840
1891
  onMediaChange: H,
1841
- onReady: U,
1892
+ onReady: ee,
1842
1893
  onRetryEnd: r[2] ||= (e) => d("retryEnd"),
1843
1894
  onRetryForward: r[3] ||= (e) => d("retryForward")
1844
1895
  }, null, 8, [
@@ -1862,8 +1913,8 @@ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
1862
1913
  "reel-forward",
1863
1914
  "state",
1864
1915
  "total"
1865
- ])], 8, wt), u(n, { name: "vibe-info-sheet" }, {
1866
- default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", Tt, [c("aside", {
1916
+ ])], 8, Et), u(n, { name: "vibe-info-sheet" }, {
1917
+ default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", Dt, [c("aside", {
1867
1918
  ref_key: "sheetElement",
1868
1919
  ref: _,
1869
1920
  class: "reel-info-sheet",
@@ -1872,14 +1923,14 @@ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
1872
1923
  "aria-modal": e.infoSheetOverlay ? "true" : void 0,
1873
1924
  tabindex: e.infoSheetOverlay ? -1 : void 0,
1874
1925
  "data-active-post-id": T.value?.postId
1875
- }, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8, Et)])) : o("", !0)]),
1926
+ }, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8, Ot)])) : o("", !0)]),
1876
1927
  _: 1
1877
- })], 10, Ct));
1928
+ })], 10, Tt));
1878
1929
  }
1879
1930
  });
1880
1931
  //#endregion
1881
1932
  //#region src/core/mediaLifecycle.ts
1882
- function Ot(e, t, n, r, i) {
1933
+ function At(e, t, n, r, i) {
1883
1934
  let a = e.items.findIndex((e) => e.postId === t), o = e.items[a];
1884
1935
  if (!o) return null;
1885
1936
  let s = N(o, n), c = P(o, s);
@@ -1895,7 +1946,7 @@ function Ot(e, t, n, r, i) {
1895
1946
  postIndex: a
1896
1947
  };
1897
1948
  }
1898
- function kt(e, t) {
1949
+ function jt(e, t) {
1899
1950
  O(() => {
1900
1951
  let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null;
1901
1952
  return {
@@ -1905,20 +1956,20 @@ function kt(e, t) {
1905
1956
  };
1906
1957
  }, (n, r) => {
1907
1958
  if (n.postId === null || n.postId === r?.postId && n.mediaIndex === r.mediaIndex && n.origin === r.origin) return;
1908
- let i = Ot(e, n.postId, n.mediaIndex, "reel", n.origin);
1959
+ let i = At(e, n.postId, n.mediaIndex, "reel", n.origin);
1909
1960
  i && t(i);
1910
1961
  }, { flush: "sync" });
1911
1962
  }
1912
1963
  //#endregion
1913
1964
  //#region src/components/useMediaLifecycle.ts
1914
- function At(e, t) {
1965
+ function Mt(e, t) {
1915
1966
  let n = w(/* @__PURE__ */ new Map()), i = w(/* @__PURE__ */ new Map()), a = r(() => e.reelMediaSource === "original" ? i.value : n.value);
1916
1967
  function o(e, t, n, r) {
1917
1968
  let i = F(t, n);
1918
1969
  e.value.get(i) !== r && (e.value = new Map(e.value).set(i, r));
1919
1970
  }
1920
1971
  function s(t, n, r, i) {
1921
- return Ot(e, t, n, r, i);
1972
+ return At(e, t, n, r, i);
1922
1973
  }
1923
1974
  function c(e, n, r, i) {
1924
1975
  let a = s(e, n, r, i);
@@ -1940,7 +1991,7 @@ function At(e, t) {
1940
1991
  let r = s(e, n, "masonry", null);
1941
1992
  r && t.visible(r);
1942
1993
  }
1943
- return kt(e, t.reelChange), O(() => {
1994
+ return jt(e, t.reelChange), O(() => {
1944
1995
  let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null, n = t === null ? 0 : e.mediaIndices.get(t) ?? 0;
1945
1996
  return {
1946
1997
  mediaIndex: n,
@@ -1965,16 +2016,16 @@ function At(e, t) {
1965
2016
  }
1966
2017
  //#endregion
1967
2018
  //#region src/core/reelEscapeStack.ts
1968
- var jt = [];
1969
- function Mt(e) {
1970
- return jt.push(e), () => {
1971
- let t = jt.indexOf(e);
1972
- t >= 0 && jt.splice(t, 1);
2019
+ var Nt = [];
2020
+ function Pt(e) {
2021
+ return Nt.push(e), () => {
2022
+ let t = Nt.indexOf(e);
2023
+ t >= 0 && Nt.splice(t, 1);
1973
2024
  };
1974
2025
  }
1975
- function Nt(e) {
2026
+ function Ft(e) {
1976
2027
  if (!e.isActive()) return !1;
1977
- let t = jt.filter((e) => e.isActive()), n = e.element();
2028
+ let t = Nt.filter((e) => e.isActive()), n = e.element();
1978
2029
  return n !== null && t.some((t) => {
1979
2030
  if (t === e) return !1;
1980
2031
  let r = t.element();
@@ -1990,14 +2041,14 @@ function Nt(e) {
1990
2041
  }
1991
2042
  //#endregion
1992
2043
  //#region src/components/useReelKeyboard.ts
1993
- function Pt(e) {
2044
+ function It(e) {
1994
2045
  let t = {
1995
2046
  element: e.element,
1996
2047
  isActive: () => e.state.layout === "reel" || e.state.reelOrigin === "masonry"
1997
2048
  }, n = null;
1998
2049
  function r(n) {
1999
2050
  let r = t.isActive();
2000
- if (n.key === "Escape" && r && !Nt(t)) return;
2051
+ if (n.key === "Escape" && r && !Ft(t)) return;
2001
2052
  if (n.key === "Escape" && e.state.reelOrigin === "masonry") {
2002
2053
  n.preventDefault(), e.state.reelInfoSheetOverlay && e.state.reelInfoSheet.enabled && e.setReelInfoSheet(!1), e.closeMasonryReel();
2003
2054
  return;
@@ -2017,14 +2068,14 @@ function Pt(e) {
2017
2068
  a !== 0 && e.reelRenderer()?.changeActiveMedia?.(a) && n.preventDefault();
2018
2069
  }
2019
2070
  y(() => {
2020
- n = Mt(t), window.addEventListener("keydown", r);
2071
+ n = Pt(t), window.addEventListener("keydown", r);
2021
2072
  }), v(() => {
2022
2073
  window.removeEventListener("keydown", r), n?.(), n = null;
2023
2074
  });
2024
2075
  }
2025
2076
  //#endregion
2026
2077
  //#region src/components/VibeSurface.vue?vue&type=script&setup=true&lang.ts
2027
- var Ft = 35, It = 420, Lt = /* @__PURE__ */ d({
2078
+ var Lt = 35, Rt = 420, zt = /* @__PURE__ */ d({
2028
2079
  __name: "VibeSurface",
2029
2080
  props: {
2030
2081
  canRetryEnd: { type: Boolean },
@@ -2050,18 +2101,18 @@ var Ft = 35, It = 420, Lt = /* @__PURE__ */ d({
2050
2101
  "retryForward"
2051
2102
  ],
2052
2103
  setup(t, { expose: i, emit: c }) {
2053
- let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), y = w({}), x = w(!1), S = w(/* @__PURE__ */ new Set()), C = w(/* @__PURE__ */ new Map()), T = w(/* @__PURE__ */ new Set()), D = w(/* @__PURE__ */ new Map()), A = r(() => Object.freeze([...l.state.items])), j = r(() => L(l.state, A.value)), { markMasonryVisible: P, markPreviewError: F, markPreviewReady: I, markReelError: R, markReelReady: z, originalStates: B, previewStates: V, reelStates: H } = At(l.state, {
2104
+ let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), y = w({}), x = w(!1), S = w(/* @__PURE__ */ new Set()), C = w(/* @__PURE__ */ new Map()), T = w(/* @__PURE__ */ new Set()), D = w(/* @__PURE__ */ new Map()), A = r(() => Object.freeze([...l.state.items])), j = r(() => L(l.state, A.value)), { markMasonryVisible: P, markPreviewError: F, markPreviewReady: I, markReelError: R, markReelReady: z, originalStates: B, previewStates: V, reelStates: H } = Mt(l.state, {
2054
2105
  ready: (e) => d("mediaReady", e),
2055
2106
  reelChange: (e) => d("reelMediaChange", e),
2056
2107
  visible: (e) => d("mediaVisible", e)
2057
- }), U = new Set(l.state.items.map((e) => e.postId)), W = null, ee = null, G = !1;
2108
+ }), ee = new Set(l.state.items.map((e) => e.postId)), U = null, W = null, G = !1;
2058
2109
  function K() {
2059
2110
  return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
2060
2111
  }
2061
2112
  function ne() {
2062
- W !== null && cancelAnimationFrame(W), W = requestAnimationFrame(() => {
2063
- W = requestAnimationFrame(() => {
2064
- W = null, S.value = /* @__PURE__ */ new Set();
2113
+ U !== null && cancelAnimationFrame(U), U = requestAnimationFrame(() => {
2114
+ U = requestAnimationFrame(() => {
2115
+ U = null, S.value = /* @__PURE__ */ new Set();
2065
2116
  });
2066
2117
  });
2067
2118
  }
@@ -2087,33 +2138,33 @@ var Ft = 35, It = 420, Lt = /* @__PURE__ */ d({
2087
2138
  let n = M(t).findIndex((t) => t.mediaId === e.mediaId);
2088
2139
  return n < 0 ? "not-found" : p.value?.navigateToItem?.(e.postId, n) ? "navigated" : "reel-inactive";
2089
2140
  }
2090
- function J() {
2141
+ function se() {
2091
2142
  return l.state.layout !== "masonry" || l.state.reelOrigin === "masonry" ? null : f.value?.getScrollElement?.() ?? null;
2092
2143
  }
2093
- function se(e, t) {
2094
- ee = e, G = t === "keyboard", y.value = ue(e), d("openReel", e), m(() => h.value?.focus());
2144
+ function ce(e, t) {
2145
+ W = e, G = t === "keyboard", y.value = Y(e), d("openReel", e), m(() => h.value?.focus());
2095
2146
  }
2096
- function Y(e) {
2147
+ function le(e) {
2097
2148
  let t = g.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [];
2098
2149
  return Array.from(t).find((t) => t.dataset.postId === String(e)) ?? null;
2099
2150
  }
2100
- function ce(e) {
2151
+ function J(e, t) {
2101
2152
  if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || K()) return 0;
2102
- let t = [...new Set(e)], n = t.filter(Y);
2103
- if (n.length === 0) return 0;
2104
- let r = new Map(D.value);
2105
- return n.forEach((e, t) => {
2106
- r.set(e, t * Ft);
2107
- }), S.value = new Set([...S.value].filter((e) => !n.includes(e))), T.value = new Set([...T.value, ...t]), D.value = r, It + (n.length - 1) * Ft;
2153
+ let n = [...new Set(e)], r = n.filter(le);
2154
+ if (r.length === 0) return 0;
2155
+ let i = new Map(D.value), a = t?.staggerMs ?? Lt;
2156
+ return r.forEach((e, t) => {
2157
+ i.set(e, t * a);
2158
+ }), S.value = new Set([...S.value].filter((e) => !r.includes(e))), T.value = new Set([...T.value, ...n]), D.value = i, Rt + (r.length - 1) * a;
2108
2159
  }
2109
- function le(e, t) {
2110
- let n = Y(e), r = n?.querySelector(".media-card-activator") ?? n;
2160
+ function ue(e, t) {
2161
+ let n = le(e), r = n?.querySelector(".media-card-activator") ?? n;
2111
2162
  r && (r.classList.toggle("media-card-focus-silent", !t), t || r.addEventListener("blur", () => {
2112
2163
  r.classList.remove("media-card-focus-silent");
2113
2164
  }, { once: !0 }), r?.focus({ preventScroll: !0 }));
2114
2165
  }
2115
- function ue(e) {
2116
- let t = g.value, n = Y(e);
2166
+ function Y(e) {
2167
+ let t = g.value, n = le(e);
2117
2168
  if (t === null || n === null) return {};
2118
2169
  let r = t.getBoundingClientRect(), i = n.getBoundingClientRect();
2119
2170
  return {
@@ -2124,15 +2175,15 @@ var Ft = 35, It = 420, Lt = /* @__PURE__ */ d({
2124
2175
  };
2125
2176
  }
2126
2177
  function de() {
2127
- l.state.reelOrigin === "masonry" && (ee ??= l.state.activeReelPostId, x.value = !0, d("closeReel"));
2178
+ l.state.reelOrigin === "masonry" && (W ??= l.state.activeReelPostId, x.value = !0, d("closeReel"));
2128
2179
  }
2129
2180
  function fe() {
2130
- let e = ee, t = G;
2131
- x.value = !1, ee = null, G = !1, y.value = {}, m(() => {
2132
- e !== null && le(e, t);
2181
+ let e = W, t = G;
2182
+ x.value = !1, W = null, G = !1, y.value = {}, m(() => {
2183
+ e !== null && ue(e, t);
2133
2184
  });
2134
2185
  }
2135
- return Pt({
2186
+ return It({
2136
2187
  closeMasonryReel: de,
2137
2188
  element: () => g.value,
2138
2189
  isReelLeaving: () => x.value,
@@ -2140,31 +2191,31 @@ var Ft = 35, It = 420, Lt = /* @__PURE__ */ d({
2140
2191
  setReelInfoSheet: (e) => d("reelInfoSheetChange", e),
2141
2192
  state: l.state
2142
2193
  }), O(() => l.state.items.map((e) => e.postId), (e) => {
2143
- let t = e.filter((e) => !U.has(e)), n = new Set(e);
2144
- if (U = new Set(e), T.value = new Set([...T.value].filter((e) => n.has(e))), D.value = new Map([...D.value].filter(([e]) => n.has(e))), t.length === 0 || K()) return;
2194
+ let t = e.filter((e) => !ee.has(e)), n = new Set(e);
2195
+ if (ee = new Set(e), T.value = new Set([...T.value].filter((e) => n.has(e))), D.value = new Map([...D.value].filter(([e]) => n.has(e))), t.length === 0 || K()) return;
2145
2196
  let r = /* @__PURE__ */ new Map();
2146
2197
  e.forEach((e) => {
2147
2198
  let t = C.value.get(e);
2148
2199
  t !== void 0 && r.set(e, t);
2149
2200
  }), t.forEach((e, t) => {
2150
- r.set(e, t * Ft);
2201
+ r.set(e, t * Lt);
2151
2202
  }), C.value = r, S.value = new Set([...S.value, ...t]), ne();
2152
2203
  }, { flush: "sync" }), v(() => {
2153
- W !== null && cancelAnimationFrame(W);
2204
+ U !== null && cancelAnimationFrame(U);
2154
2205
  }), i({
2155
2206
  changeActiveReelMedia: ie,
2156
- getAutoScrollElement: J,
2207
+ getAutoScrollElement: se,
2157
2208
  loadIfNearBottom: re,
2158
2209
  moveActiveReelPost: ae,
2159
2210
  navigateToReelItem: oe,
2160
- startItemRemoval: ce,
2211
+ startItemRemoval: J,
2161
2212
  transitionActiveReelMedia: (e) => p.value?.transitionActiveMedia?.(e) ?? Promise.resolve(!1),
2162
2213
  transitionActiveReelPost: (e) => p.value?.transitionActivePost?.(e) ?? Promise.resolve(!1)
2163
2214
  }), (r, i) => (b(), s("div", {
2164
2215
  ref_key: "surfaceElement",
2165
2216
  ref: g,
2166
2217
  class: "vibe-surface"
2167
- }, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(Dt, {
2218
+ }, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(kt, {
2168
2219
  key: 0,
2169
2220
  ref_key: "reelRenderer",
2170
2221
  ref: p,
@@ -2215,7 +2266,7 @@ var Ft = 35, It = 420, Lt = /* @__PURE__ */ d({
2215
2266
  "can-retry-end",
2216
2267
  "feed-footer",
2217
2268
  "state"
2218
- ])) : (b(), s(e, { key: 2 }, [u(ft, {
2269
+ ])) : (b(), s(e, { key: 2 }, [u(mt, {
2219
2270
  ref_key: "masonryRenderer",
2220
2271
  ref: f,
2221
2272
  "can-retry-end": t.canRetryEnd,
@@ -2240,7 +2291,7 @@ var Ft = 35, It = 420, Lt = /* @__PURE__ */ d({
2240
2291
  suspended: t.state.reelOrigin === "masonry" || x.value,
2241
2292
  state: j.value,
2242
2293
  total: t.state.total,
2243
- onActivate: se,
2294
+ onActivate: ce,
2244
2295
  onError: E(F),
2245
2296
  onLoadMore: i[7] ||= (e) => d("loadMore"),
2246
2297
  onMediaChange: q,
@@ -2287,7 +2338,7 @@ var Ft = 35, It = 420, Lt = /* @__PURE__ */ d({
2287
2338
  "aria-modal": "true",
2288
2339
  tabindex: "-1",
2289
2340
  style: _(y.value)
2290
- }, [u(Dt, {
2341
+ }, [u(kt, {
2291
2342
  ref_key: "reelRenderer",
2292
2343
  ref: p,
2293
2344
  "can-retry-end": t.canRetryEnd,
@@ -2331,7 +2382,7 @@ var Ft = 35, It = 420, Lt = /* @__PURE__ */ d({
2331
2382
  });
2332
2383
  //#endregion
2333
2384
  //#region src/core/page.ts
2334
- function Rt(e) {
2385
+ function Bt(e) {
2335
2386
  if (!e || typeof e != "object" || !Array.isArray(e.items)) throw TypeError("Vibe loadPage must resolve to a page with an items array.");
2336
2387
  if (e.next !== null && typeof e.next != "string" && typeof e.next != "number") throw TypeError("Vibe page next must be a string, number, or null.");
2337
2388
  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.");
@@ -2343,32 +2394,32 @@ function Z(e, t) {
2343
2394
  }
2344
2395
  //#endregion
2345
2396
  //#region src/core/requestDelay.ts
2346
- var zt = 2e3, Bt = 1e4, Vt = 250, Ht = {
2397
+ var Vt = 2e3, Ht = 1e4, Ut = 250, Wt = {
2347
2398
  delayRemainingMs: null,
2348
2399
  nextRequestAt: null
2349
2400
  };
2350
- function Ut(e, t) {
2401
+ function Gt(e, t) {
2351
2402
  return e === void 0 ? t : Math.floor(e);
2352
2403
  }
2353
- function Wt(e, t) {
2404
+ function Kt(e, t) {
2354
2405
  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.`);
2355
2406
  }
2356
- function Gt(e, t = {}) {
2357
- let n = Ut(t.delayStepMs, zt), r = Ut(t.delayMaxMs, Bt);
2407
+ function qt(e, t = {}) {
2408
+ let n = Gt(t.delayStepMs, Vt), r = Gt(t.delayMaxMs, Ht);
2358
2409
  return Math.min(Math.max(0, e) * n, r);
2359
2410
  }
2360
2411
  function Q(e) {
2361
- if (e == null || !Number.isFinite(e)) return { ...Ht };
2412
+ if (e == null || !Number.isFinite(e)) return { ...Wt };
2362
2413
  let t = Math.max(0, Math.floor(e - Date.now()));
2363
2414
  return t > 0 ? {
2364
2415
  delayRemainingMs: t,
2365
2416
  nextRequestAt: e
2366
- } : { ...Ht };
2417
+ } : { ...Wt };
2367
2418
  }
2368
- async function Kt({ delayMs: e, onChange: t, signal: n }) {
2419
+ async function Jt({ delayMs: e, onChange: t, signal: n }) {
2369
2420
  if (n.aborted) throw new DOMException("Aborted", "AbortError");
2370
2421
  if (e <= 0) {
2371
- t({ ...Ht });
2422
+ t({ ...Wt });
2372
2423
  return;
2373
2424
  }
2374
2425
  let r = Date.now() + e;
@@ -2376,9 +2427,9 @@ async function Kt({ delayMs: e, onChange: t, signal: n }) {
2376
2427
  delayRemainingMs: e,
2377
2428
  nextRequestAt: r
2378
2429
  }), await new Promise((i, a) => {
2379
- let o = !1, s = setInterval(f, Vt), c = setTimeout(() => u(), e);
2430
+ let o = !1, s = setInterval(f, Ut), c = setTimeout(() => u(), e);
2380
2431
  function l() {
2381
- clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...Ht });
2432
+ clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...Wt });
2382
2433
  }
2383
2434
  function u(e) {
2384
2435
  o || (o = !0, l(), e ? a(e) : i());
@@ -2393,13 +2444,13 @@ async function Kt({ delayMs: e, onChange: t, signal: n }) {
2393
2444
  n.addEventListener("abort", d, { once: !0 });
2394
2445
  });
2395
2446
  }
2396
- var qt = class {
2447
+ var Yt = class {
2397
2448
  interval = null;
2398
2449
  constructor(e) {
2399
2450
  this.onChange = e;
2400
2451
  }
2401
2452
  clear() {
2402
- this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...Ht });
2453
+ this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...Wt });
2403
2454
  }
2404
2455
  sync(e) {
2405
2456
  this.clear();
@@ -2407,22 +2458,22 @@ var qt = class {
2407
2458
  this.onChange(t), t.delayRemainingMs !== null && (this.interval = setInterval(() => {
2408
2459
  let t = Q(e);
2409
2460
  this.onChange(t), t.delayRemainingMs === null && this.clear();
2410
- }, Vt));
2461
+ }, Ut));
2411
2462
  }
2412
2463
  };
2413
- function Jt(e, t = !0) {
2464
+ function Xt(e, t = !0) {
2414
2465
  return e.maxAdditionalPages === "unlimited" ? Infinity : (e.maxAdditionalPages ?? 10) + (t ? 1 : 0);
2415
2466
  }
2416
- function Yt(e) {
2467
+ function Zt(e) {
2417
2468
  return `${typeof e}:${String(e)}`;
2418
2469
  }
2419
- function Xt(e, t) {
2470
+ function Qt(e, t) {
2420
2471
  if (!Number.isInteger(e) || e <= 0) throw TypeError(`Vibe ${t} must be a positive integer.`);
2421
2472
  }
2422
- function Zt(e) {
2473
+ function $t(e) {
2423
2474
  if (!e) return;
2424
- if (Xt(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
2425
- Wt(e, "frontend autofill");
2475
+ if (Qt(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
2476
+ Kt(e, "frontend autofill");
2426
2477
  let t = e.maxAdditionalPages;
2427
2478
  if (t !== void 0 && t !== "unlimited" && (!Number.isInteger(t) || t < 0)) throw TypeError("Vibe autofill maxAdditionalPages must be a non-negative integer or \"unlimited\".");
2428
2479
  return;
@@ -2434,7 +2485,7 @@ function Zt(e) {
2434
2485
  if (t.pageSize !== e.pageSize) throw TypeError("Vibe backend autofill initialSession pageSize must match autofill pageSize.");
2435
2486
  }
2436
2487
  }
2437
- function Qt(e, t, n = !0) {
2488
+ function en(e, t, n = !0) {
2438
2489
  if (!e) return {
2439
2490
  cycleId: null,
2440
2491
  delayRemainingMs: null,
@@ -2468,7 +2519,7 @@ function Qt(e, t, n = !0) {
2468
2519
  strategy: e.strategy
2469
2520
  };
2470
2521
  }
2471
- function $t(e) {
2522
+ function tn(e) {
2472
2523
  return [
2473
2524
  "cancelling",
2474
2525
  "filling",
@@ -2476,9 +2527,9 @@ function $t(e) {
2476
2527
  "waiting"
2477
2528
  ].includes(e.status);
2478
2529
  }
2479
- async function en(e, t, n) {
2530
+ async function nn(e, t, n) {
2480
2531
  let r = t.autofill;
2481
- if (!$t(r) || !r.cycleId) return;
2532
+ if (!tn(r) || !r.cycleId) return;
2482
2533
  let i = {
2483
2534
  cycleId: r.cycleId,
2484
2535
  feedKey: r.feedKey ?? "",
@@ -2491,16 +2542,16 @@ async function en(e, t, n) {
2491
2542
  throw r.error = e, r.status = "error", e;
2492
2543
  }
2493
2544
  }
2494
- function tn(e, t, n) {
2545
+ function rn(e, t, n) {
2495
2546
  return e?.strategy === "backend" && t.feedKey === e.feedKey && t.sessionId === n.sessionId;
2496
2547
  }
2497
- async function nn({ existingItems: e, initialCursor: t, loadPage: n, maximumRequests: r, onCollection: i, onDelayChange: a, onProgress: o, options: s, receivedOffset: c = 0, requestOffset: l = 0, shouldPause: u = () => !1, signal: d }) {
2498
- let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ?? Jt(s), g = t, _ = t, v = t, y = 0, b = [], x;
2548
+ async function an({ existingItems: e, initialCursor: t, loadPage: n, maximumRequests: r, onCollection: i, onDelayChange: a, onProgress: o, options: s, receivedOffset: c = 0, requestOffset: l = 0, shouldPause: u = () => !1, signal: d }) {
2549
+ let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ?? Xt(s), g = t, _ = t, v = t, y = 0, b = [], x;
2499
2550
  for (; y < h;) {
2500
- let e = Yt(g);
2551
+ let e = Zt(g);
2501
2552
  if (m.has(e)) throw Error("Vibe autofill received a repeated cursor.");
2502
- if (m.add(e), await Kt({
2503
- delayMs: Gt(l + y, s),
2553
+ if (m.add(e), await Jt({
2554
+ delayMs: qt(l + y, s),
2504
2555
  onChange: a,
2505
2556
  signal: d
2506
2557
  }), y > 0 && u()) return {
@@ -2514,7 +2565,7 @@ async function nn({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
2514
2565
  status: "paused",
2515
2566
  total: x
2516
2567
  };
2517
- let t = Rt(await n({
2568
+ let t = Bt(await n({
2518
2569
  cursor: g,
2519
2570
  signal: d
2520
2571
  }));
@@ -2571,12 +2622,12 @@ async function nn({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
2571
2622
  }
2572
2623
  //#endregion
2573
2624
  //#region src/core/autofillController.ts
2574
- var rn = class {
2625
+ var on = class {
2575
2626
  collection = null;
2576
2627
  cycle = 0;
2577
2628
  delayCountdown;
2578
2629
  constructor(e) {
2579
- this.context = e, this.delayCountdown = new qt((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
2630
+ this.context = e, this.delayCountdown = new Yt((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
2580
2631
  }
2581
2632
  beginCycle() {
2582
2633
  let { options: e, state: t } = this.context;
@@ -2584,14 +2635,14 @@ var rn = class {
2584
2635
  this.clear();
2585
2636
  let n = `vibe-autofill-${Date.now().toString(36)}-${++this.cycle}`;
2586
2637
  return t.autofill = {
2587
- ...Qt(e, void 0, !1),
2638
+ ...en(e, void 0, !1),
2588
2639
  cycleId: n,
2589
2640
  status: "filling"
2590
2641
  }, n;
2591
2642
  }
2592
2643
  async cancel() {
2593
2644
  let { cancelRequest: e, options: t, state: n } = this.context;
2594
- await en(t, n, e), this.commitCollection();
2645
+ await nn(t, n, e), this.commitCollection();
2595
2646
  }
2596
2647
  captureCollection(e, t) {
2597
2648
  t && (this.collection = e);
@@ -2619,30 +2670,30 @@ var rn = class {
2619
2670
  requests: r.requests
2620
2671
  }));
2621
2672
  }
2622
- }, an = 100;
2623
- function on(e, t) {
2673
+ }, sn = 100;
2674
+ function cn(e, t) {
2624
2675
  if (!Number.isFinite(t) || t <= 0) throw TypeError(`Vibe ${e} must be a positive number.`);
2625
2676
  }
2626
- function sn(e, t, n) {
2677
+ function ln(e, t, n) {
2627
2678
  return Math.min(n, Math.max(t, e));
2628
2679
  }
2629
- function cn(e) {
2680
+ function un(e) {
2630
2681
  if (!e) return;
2631
2682
  let t = e.minSpeedPxPerSecond ?? 20, n = e.maxSpeedPxPerSecond ?? 240;
2632
- if (on("autoScroll.minSpeedPxPerSecond", t), on("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
2633
- e.speedPxPerSecond !== void 0 && on("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
2683
+ if (cn("autoScroll.minSpeedPxPerSecond", t), cn("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
2684
+ e.speedPxPerSecond !== void 0 && cn("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
2634
2685
  }
2635
- function ln(e) {
2686
+ function dn(e) {
2636
2687
  let t = e?.minSpeedPxPerSecond ?? 20, n = e?.maxSpeedPxPerSecond ?? 240;
2637
2688
  return {
2638
2689
  enabled: e?.enabled ?? !1,
2639
2690
  maxSpeedPxPerSecond: n,
2640
2691
  minSpeedPxPerSecond: t,
2641
2692
  paused: !1,
2642
- speedPxPerSecond: sn(e?.speedPxPerSecond ?? 80, t, n)
2693
+ speedPxPerSecond: ln(e?.speedPxPerSecond ?? 80, t, n)
2643
2694
  };
2644
2695
  }
2645
- var un = class {
2696
+ var fn = class {
2646
2697
  frame = null;
2647
2698
  lastTimestamp = null;
2648
2699
  mounted = !1;
@@ -2662,9 +2713,9 @@ var un = class {
2662
2713
  this.options.state.enabled && (this.options.state.paused = e, this.lastTimestamp = null, e ? this.cancelFrame() : this.schedule());
2663
2714
  }
2664
2715
  setSpeed(e) {
2665
- on("auto-scroll speed", e);
2716
+ cn("auto-scroll speed", e);
2666
2717
  let t = this.options.state;
2667
- t.speedPxPerSecond = sn(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
2718
+ t.speedPxPerSecond = ln(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
2668
2719
  }
2669
2720
  tick = (e) => {
2670
2721
  this.frame = null;
@@ -2676,7 +2727,7 @@ var un = class {
2676
2727
  return;
2677
2728
  }
2678
2729
  if (this.lastTimestamp !== null) {
2679
- let r = Math.min(an, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
2730
+ let r = Math.min(sn, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
2680
2731
  n.scrollTop = Math.min(i, n.scrollTop + t.speedPxPerSecond * r / 1e3);
2681
2732
  }
2682
2733
  this.lastTimestamp = e, this.schedule();
@@ -2690,7 +2741,7 @@ var un = class {
2690
2741
  };
2691
2742
  //#endregion
2692
2743
  //#region src/core/backendAutofill.ts
2693
- async function dn(e, t, n, r) {
2744
+ async function pn(e, t, n, r) {
2694
2745
  let i = await e.onUnderfilled(n);
2695
2746
  if (!r()) return;
2696
2747
  if (!i.sessionId.trim()) throw TypeError("Vibe backend autofill requires a sessionId.");
@@ -2704,19 +2755,19 @@ async function dn(e, t, n, r) {
2704
2755
  status: "waiting"
2705
2756
  });
2706
2757
  }
2707
- function fn(e, t) {
2758
+ function mn(e, t) {
2708
2759
  ["complete", "exhausted"].includes(t.status) && t.items && (e.items = Z(e.items, t.items)), t.next !== void 0 && (e.next = t.next), t.total !== void 0 && (e.total = t.total);
2709
2760
  }
2710
- function pn(e, t, n) {
2761
+ function hn(e, t, n) {
2711
2762
  let r = t.autofill;
2712
- return !tn(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (fn(t, n), Object.assign(r, Q(n.status === "waiting" ? n.nextRequestAt : null)), r.error = n.error ?? null, r.missing = Math.max(0, (r.pageSize ?? 0) - n.received), r.received = n.received, n.requests !== void 0 && (r.requests = n.requests), r.sequence = n.sequence, r.status = n.status, !0);
2763
+ return !rn(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (mn(t, n), Object.assign(r, Q(n.status === "waiting" ? n.nextRequestAt : null)), r.error = n.error ?? null, r.missing = Math.max(0, (r.pageSize ?? 0) - n.received), r.received = n.received, n.requests !== void 0 && (r.requests = n.requests), r.sequence = n.sequence, r.status = n.status, !0);
2713
2764
  }
2714
- function mn(e, t, n) {
2715
- return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = Qt(e, n), fn(t, n), !0);
2765
+ function gn(e, t, n) {
2766
+ return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = en(e, n), mn(t, n), !0);
2716
2767
  }
2717
2768
  //#endregion
2718
2769
  //#region src/core/initialAutofill.ts
2719
- async function hn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, onPages: i, options: a, signal: o, state: s }) {
2770
+ async function _n({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, onPages: i, options: a, signal: o, state: s }) {
2720
2771
  let c = a.autofill;
2721
2772
  if (!c) return;
2722
2773
  let l = s.items.length;
@@ -2729,7 +2780,7 @@ async function hn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
2729
2780
  return;
2730
2781
  }
2731
2782
  if (c.strategy === "backend") {
2732
- await dn(c, s, {
2783
+ await pn(c, s, {
2733
2784
  cycleId: e,
2734
2785
  feedKey: c.feedKey,
2735
2786
  items: [...s.items],
@@ -2746,11 +2797,11 @@ async function hn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
2746
2797
  s.autofill.status = "exhausted";
2747
2798
  return;
2748
2799
  }
2749
- let u = await nn({
2800
+ let u = await an({
2750
2801
  existingItems: s.items,
2751
2802
  initialCursor: s.next,
2752
2803
  loadPage: a.loadPage,
2753
- maximumRequests: Jt(c, !1),
2804
+ maximumRequests: Xt(c, !1),
2754
2805
  onCollection: n,
2755
2806
  onDelayChange: (e) => {
2756
2807
  t() && Object.assign(s.autofill, e);
@@ -2773,13 +2824,13 @@ async function hn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
2773
2824
  }
2774
2825
  //#endregion
2775
2826
  //#region src/core/fill.ts
2776
- function gn(e) {
2827
+ function vn(e) {
2777
2828
  return "pages" in e ? { pages: e.pages } : { until: "end" };
2778
2829
  }
2779
- function _n(e) {
2830
+ function yn(e) {
2780
2831
  return `${typeof e}:${String(e)}`;
2781
2832
  }
2782
- function vn(e) {
2833
+ function bn(e) {
2783
2834
  if (!e || typeof e != "object") throw TypeError("Vibe fill target must be an object.");
2784
2835
  if ("pages" in e) {
2785
2836
  if (!Number.isInteger(e.pages) || e.pages <= 0) throw TypeError("Vibe fill pages must be a positive integer.");
@@ -2788,20 +2839,20 @@ function vn(e) {
2788
2839
  if ("until" in e && e.until === "end") return { until: "end" };
2789
2840
  throw TypeError("Vibe fill target must be { pages } or { until: 'end' }.");
2790
2841
  }
2791
- function yn(e) {
2842
+ function xn(e) {
2792
2843
  if (!e) return;
2793
2844
  if (e.strategy === "frontend") {
2794
- Wt(e, "frontend fill");
2845
+ Kt(e, "frontend fill");
2795
2846
  return;
2796
2847
  }
2797
2848
  if (!e.feedKey.trim()) throw TypeError("Vibe backend fill requires a feedKey.");
2798
2849
  let t = e.initialSession;
2799
2850
  if (t) {
2800
2851
  if (t.feedKey !== e.feedKey) throw TypeError("Vibe backend fill initialSession feedKey must match fill feedKey.");
2801
- vn(t.target);
2852
+ bn(t.target);
2802
2853
  }
2803
2854
  }
2804
- function bn(e, t, n = !0) {
2855
+ function Sn(e, t, n = !0) {
2805
2856
  let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a = Q(i?.nextRequestAt);
2806
2857
  return {
2807
2858
  completedPages: i?.completedPages ?? 0,
@@ -2815,10 +2866,10 @@ function bn(e, t, n = !0) {
2815
2866
  sessionId: i?.sessionId ?? null,
2816
2867
  status: i?.status ?? "idle",
2817
2868
  strategy: e?.strategy ?? null,
2818
- target: i ? gn(i.target) : null
2869
+ target: i ? vn(i.target) : null
2819
2870
  };
2820
2871
  }
2821
- function xn(e) {
2872
+ function Cn(e) {
2822
2873
  return [
2823
2874
  "cancelling",
2824
2875
  "filling",
@@ -2826,13 +2877,13 @@ function xn(e) {
2826
2877
  "waiting"
2827
2878
  ].includes(e.status);
2828
2879
  }
2829
- async function Sn({ existingItems: e, initialCursor: t, loadPage: n, onCollection: r = () => void 0, onDelayChange: i, onProgress: a, options: o, shouldPause: s = () => !1, signal: c, target: l }) {
2880
+ async function wn({ existingItems: e, initialCursor: t, loadPage: n, onCollection: r = () => void 0, onDelayChange: i, onProgress: a, options: o, shouldPause: s = () => !1, signal: c, target: l }) {
2830
2881
  let u = [], d = [], f = [...e], p = /* @__PURE__ */ new Set(), m = 0, h = t, g = t, _ = t, v = 0, y;
2831
2882
  for (; _ !== null;) {
2832
- let e = _n(h);
2883
+ let e = yn(h);
2833
2884
  if (p.has(e)) throw Error("Vibe fill received a repeated cursor.");
2834
- if (p.add(e), await Kt({
2835
- delayMs: Gt(m, o),
2885
+ if (p.add(e), await Jt({
2886
+ delayMs: qt(m, o),
2836
2887
  onChange: i,
2837
2888
  signal: c
2838
2889
  }), m > 0 && s()) return {
@@ -2845,7 +2896,7 @@ async function Sn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
2845
2896
  status: "paused",
2846
2897
  total: y
2847
2898
  };
2848
- let t = Rt(await n({
2899
+ let t = Bt(await n({
2849
2900
  cursor: h,
2850
2901
  signal: c
2851
2902
  }));
@@ -2913,7 +2964,7 @@ async function Sn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
2913
2964
  }
2914
2965
  //#endregion
2915
2966
  //#region src/core/backendFill.ts
2916
- async function Cn(e, t, n, r) {
2967
+ async function Tn(e, t, n, r) {
2917
2968
  let i = await e.onStart(n);
2918
2969
  if (r()) {
2919
2970
  if (!i.sessionId.trim()) throw TypeError("Vibe backend fill requires a sessionId.");
@@ -2927,22 +2978,22 @@ async function Cn(e, t, n, r) {
2927
2978
  });
2928
2979
  }
2929
2980
  }
2930
- function wn(e, t, n) {
2981
+ function En(e, t, n) {
2931
2982
  return e?.strategy === "backend" && n.feedKey === e.feedKey && n.sessionId === t.fill.sessionId;
2932
2983
  }
2933
- function Tn(e) {
2984
+ function Dn(e) {
2934
2985
  return Number.isInteger(e.completedPages) && e.completedPages >= 0 && Number.isInteger(e.received) && e.received >= 0 && Number.isInteger(e.sequence) && e.sequence >= 0;
2935
2986
  }
2936
- function En(e, t) {
2987
+ function On(e, t) {
2937
2988
  if (!["complete", "exhausted"].includes(t.status)) return !0;
2938
2989
  let n = e.fill.target;
2939
2990
  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;
2940
2991
  }
2941
- function Dn(e, t, n) {
2992
+ function kn(e, t, n) {
2942
2993
  t.total !== void 0 && (e.total = t.total), ["complete", "exhausted"].includes(t.status) && (e.items = Z(e.items, t.items ?? []), e.next = t.next ?? null, n(t.lastCursor ?? null));
2943
2994
  }
2944
- function On(e, t, n, r) {
2945
- return !wn(e, t, n) || !Tn(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !En(t, n) ? !1 : (Dn(t, n, r), Object.assign(t.fill, {
2995
+ function An(e, t, n, r) {
2996
+ return !En(e, t, n) || !Dn(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !On(t, n) ? !1 : (kn(t, n, r), Object.assign(t.fill, {
2946
2997
  ...Q(n.status === "waiting" ? n.nextRequestAt : null),
2947
2998
  completedPages: n.completedPages,
2948
2999
  error: n.error ?? null,
@@ -2951,42 +3002,42 @@ function On(e, t, n, r) {
2951
3002
  status: n.status
2952
3003
  }), !0);
2953
3004
  }
2954
- function kn(e, t, n, r) {
3005
+ function jn(e, t, n, r) {
2955
3006
  if (e?.strategy !== "backend" || n.feedKey !== e.feedKey) return !1;
2956
3007
  let i = t.fill;
2957
- return t.fill = bn(e, n), !Tn(n) || !En(t, n) ? (t.fill = i, !1) : (Dn(t, n, r), !0);
3008
+ return t.fill = Sn(e, n), !Dn(n) || !On(t, n) ? (t.fill = i, !1) : (kn(t, n, r), !0);
2958
3009
  }
2959
3010
  //#endregion
2960
3011
  //#region src/core/fillController.ts
2961
- var An = class {
3012
+ var Mn = class {
2962
3013
  abortController = null;
2963
3014
  cycle = 0;
2964
3015
  delayCountdown;
2965
3016
  requestVersion = 0;
2966
3017
  collection = null;
2967
3018
  constructor(e) {
2968
- this.options = e, this.delayCountdown = new qt((e) => {
3019
+ this.options = e, this.delayCountdown = new Yt((e) => {
2969
3020
  Object.assign(this.options.state.fill, e);
2970
3021
  }), this.syncBackendCountdown();
2971
3022
  }
2972
3023
  isActive() {
2973
- return xn(this.options.state.fill);
3024
+ return Cn(this.options.state.fill);
2974
3025
  }
2975
3026
  applyUpdate(e) {
2976
- let t = On(this.options.fill, this.options.state, e, this.options.onLastCursor);
3027
+ let t = An(this.options.fill, this.options.state, e, this.options.onLastCursor);
2977
3028
  return t && this.syncBackendCountdown(), t;
2978
3029
  }
2979
3030
  restoreSession(e) {
2980
- let t = kn(this.options.fill, this.options.state, e, this.options.onLastCursor);
3031
+ let t = jn(this.options.fill, this.options.state, e, this.options.onLastCursor);
2981
3032
  return t && this.syncBackendCountdown(), t;
2982
3033
  }
2983
3034
  async start(e) {
2984
3035
  let t = this.options.fill;
2985
3036
  if (!t) throw Error("Vibe fill is not configured.");
2986
3037
  if (this.isActive()) throw Error("Vibe fill is already active.");
2987
- let n = vn(e), r = `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
3038
+ let n = bn(e), r = `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
2988
3039
  if (this.options.state.fill = {
2989
- ...bn(t, void 0, !1),
3040
+ ...Sn(t, void 0, !1),
2990
3041
  cycleId: r,
2991
3042
  status: "filling",
2992
3043
  target: n
@@ -2997,7 +3048,7 @@ var An = class {
2997
3048
  let i = ++this.requestVersion, a = new AbortController();
2998
3049
  this.abortController = a;
2999
3050
  try {
3000
- t.strategy === "frontend" ? await this.startFrontend(t, n, a, i) : (await Cn(t, this.options.state, {
3051
+ t.strategy === "frontend" ? await this.startFrontend(t, n, a, i) : (await Tn(t, this.options.state, {
3001
3052
  cycleId: r,
3002
3053
  feedKey: t.feedKey,
3003
3054
  items: [...this.options.state.items],
@@ -3015,7 +3066,7 @@ var An = class {
3015
3066
  }
3016
3067
  async cancel() {
3017
3068
  let { fill: e, state: t } = this.options;
3018
- if (!xn(t.fill) || !t.fill.cycleId) return;
3069
+ if (!Cn(t.fill) || !t.fill.cycleId) return;
3019
3070
  let n = {
3020
3071
  cycleId: t.fill.cycleId,
3021
3072
  feedKey: t.fill.feedKey ?? "",
@@ -3029,7 +3080,7 @@ var An = class {
3029
3080
  }
3030
3081
  }
3031
3082
  reset() {
3032
- this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = bn(this.options.fill, void 0, !1), this.collection = null;
3083
+ this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = Sn(this.options.fill, void 0, !1), this.collection = null;
3033
3084
  }
3034
3085
  destroy() {
3035
3086
  this.abortLocalRequest(), this.delayCountdown.clear();
@@ -3045,7 +3096,7 @@ var An = class {
3045
3096
  if (!i) throw Error("Vibe frontend fill requires loadPage.");
3046
3097
  let a = this.options.state;
3047
3098
  a.isLoadingMore = !0;
3048
- let o = await Sn({
3099
+ let o = await wn({
3049
3100
  existingItems: a.items,
3050
3101
  initialCursor: a.next,
3051
3102
  loadPage: i,
@@ -3085,7 +3136,7 @@ var An = class {
3085
3136
  };
3086
3137
  //#endregion
3087
3138
  //#region src/core/feedFooter.ts
3088
- function jn(e) {
3139
+ function Nn(e) {
3089
3140
  return {
3090
3141
  cancelAutofill: () => e.cancelAutofill(),
3091
3142
  loadMore: () => e.loadNext(),
@@ -3093,45 +3144,45 @@ function jn(e) {
3093
3144
  retryEnd: () => e.retryEnd()
3094
3145
  };
3095
3146
  }
3096
- function Mn(e) {
3147
+ function Pn(e) {
3097
3148
  if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
3098
3149
  }
3099
- function Nn(e) {
3100
- e?.intervalMs !== void 0 && Mn(e.intervalMs);
3150
+ function Fn(e) {
3151
+ e?.intervalMs !== void 0 && Pn(e.intervalMs);
3101
3152
  }
3102
- function Pn(e) {
3153
+ function In(e) {
3103
3154
  return {
3104
3155
  enabled: e?.enabled ?? !1,
3105
3156
  includePostItems: e?.includePostItems ?? !1,
3106
3157
  intervalMs: e?.intervalMs ?? 5e3
3107
3158
  };
3108
3159
  }
3109
- function Fn(e, t) {
3160
+ function Ln(e, t) {
3110
3161
  if (typeof t == "boolean") {
3111
3162
  e.enabled = t;
3112
3163
  return;
3113
3164
  }
3114
- Nn(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);
3165
+ Fn(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);
3115
3166
  }
3116
3167
  //#endregion
3117
3168
  //#region src/core/reelInfoSheet.ts
3118
- function In(e) {
3169
+ function Rn(e) {
3119
3170
  return { enabled: e?.enabled ?? !1 };
3120
3171
  }
3121
- function Ln(e, t, n) {
3172
+ function zn(e, t, n) {
3122
3173
  if (n && !t) throw Error("Vibe cannot enable reelInfoSheet without a configured component.");
3123
3174
  e.enabled = n;
3124
3175
  }
3125
3176
  //#endregion
3126
3177
  //#region src/core/initialRuntimeState.ts
3127
- function Rn(e, t) {
3178
+ function Bn(e, t) {
3128
3179
  let n = e.initialPage;
3129
3180
  return {
3130
3181
  activeReelPostId: null,
3131
- autoScroll: ln(e.autoScroll),
3132
- autofill: Qt(e.autofill),
3182
+ autoScroll: dn(e.autoScroll),
3183
+ autofill: en(e.autofill),
3133
3184
  error: null,
3134
- fill: bn(e.fill),
3185
+ fill: Sn(e.fill),
3135
3186
  infiniteScroll: e.infiniteScroll ?? !0,
3136
3187
  isLoading: !n,
3137
3188
  isLoadingMore: !1,
@@ -3142,14 +3193,14 @@ function Rn(e, t) {
3142
3193
  next: n?.next ?? null,
3143
3194
  nextPageError: null,
3144
3195
  phoneMode: !1,
3145
- reelAutoAdvance: Pn(e.reelAutoAdvance),
3196
+ reelAutoAdvance: In(e.reelAutoAdvance),
3146
3197
  reelForward: {
3147
3198
  error: null,
3148
3199
  status: "idle"
3149
3200
  },
3150
3201
  reelForwardIndex: null,
3151
3202
  reelForwardItem: null,
3152
- reelInfoSheet: In(e.reelInfoSheet),
3203
+ reelInfoSheet: Rn(e.reelInfoSheet),
3153
3204
  reelInfoSheetOverlay: !1,
3154
3205
  reelMediaSource: "original",
3155
3206
  reelOrigin: null,
@@ -3158,20 +3209,20 @@ function Rn(e, t) {
3158
3209
  }
3159
3210
  //#endregion
3160
3211
  //#region src/core/options.ts
3161
- function zn(e, t) {
3212
+ function Vn(e, t) {
3162
3213
  if (t) {
3163
3214
  if (!Number.isFinite(t.height) || t.height <= 0) throw TypeError(`Vibe ${e} height must be a positive number.`);
3164
3215
  if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe ${e} background must be "default" or "transparent".`);
3165
3216
  }
3166
3217
  }
3167
- function Bn(e, t) {
3218
+ function Hn(e, t) {
3168
3219
  if (t) {
3169
3220
  if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe mediaCard ${e} background must be "default" or "transparent".`);
3170
3221
  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.`);
3171
3222
  }
3172
3223
  }
3173
- function Vn(e) {
3174
- if (cn(e.autoScroll), zn("cardHeader", e.cardHeader), zn("cardFooter", e.cardFooter), Bn("header", e.mediaCard?.header), Bn("footer", e.mediaCard?.footer), Zt(e.autofill), yn(e.fill), J(e.masonry), Nn(e.reelAutoAdvance), e.removalReconciliation) {
3224
+ function Un(e) {
3225
+ if (un(e.autoScroll), Vn("cardHeader", e.cardHeader), Vn("cardFooter", e.cardFooter), Hn("header", e.mediaCard?.header), Hn("footer", e.mediaCard?.footer), $t(e.autofill), xn(e.fill), J(e.masonry), Fn(e.reelAutoAdvance), e.removalReconciliation) {
3175
3226
  if (!Number.isInteger(e.removalReconciliation.pageSize) || e.removalReconciliation.pageSize <= 0) throw TypeError("Vibe removalReconciliation pageSize must be a positive integer.");
3176
3227
  let t = e.removalReconciliation.maxReplayPages ?? 5;
3177
3228
  if (!Number.isInteger(t) || t <= 0) throw TypeError("Vibe removalReconciliation maxReplayPages must be a positive integer.");
@@ -3185,7 +3236,7 @@ function Vn(e) {
3185
3236
  if (e.fill?.strategy === "frontend" && !e.loadPage) throw TypeError("Vibe frontend fill requires loadPage.");
3186
3237
  if (e.fill?.strategy === "backend" && e.fill.initialSession && !e.initialPage) throw TypeError("Vibe backend fill restoration requires initialPage.");
3187
3238
  }
3188
- function Hn(e) {
3239
+ function Wn(e) {
3189
3240
  if (typeof e != "string") return e;
3190
3241
  if (typeof document > "u") throw Error("Vibe cannot resolve a selector without a document.");
3191
3242
  let t = document.querySelector(e);
@@ -3194,7 +3245,7 @@ function Hn(e) {
3194
3245
  }
3195
3246
  //#endregion
3196
3247
  //#region src/core/pageRequest.ts
3197
- async function Un({ append: e, autofillController: t, cursor: n, isCurrent: r, loadPage: i, onLastCursor: a, onPages: o, options: s, signal: c, state: l }) {
3248
+ async function Gn({ append: e, autofillController: t, cursor: n, isCurrent: r, loadPage: i, onLastCursor: a, onPages: o, options: s, signal: c, state: l }) {
3198
3249
  let u = s.autofill, d = e && u?.strategy === "frontend" && l.autofill.status === "paused", f = d ? {
3199
3250
  received: l.autofill.received,
3200
3251
  requests: l.autofill.requests
@@ -3206,11 +3257,11 @@ async function Un({ append: e, autofillController: t, cursor: n, isCurrent: r, l
3206
3257
  let m = !1;
3207
3258
  try {
3208
3259
  if (u?.strategy === "frontend") {
3209
- let s = await nn({
3260
+ let s = await an({
3210
3261
  existingItems: e ? l.items : [],
3211
3262
  initialCursor: n,
3212
3263
  loadPage: i,
3213
- maximumRequests: f ? Math.max(0, Jt(u) - f.requests) : void 0,
3264
+ maximumRequests: f ? Math.max(0, Xt(u) - f.requests) : void 0,
3214
3265
  onCollection: (e) => t.captureCollection(e, r()),
3215
3266
  onDelayChange: (e) => {
3216
3267
  r() && Object.assign(l.autofill, e);
@@ -3233,7 +3284,7 @@ async function Un({ append: e, autofillController: t, cursor: n, isCurrent: r, l
3233
3284
  }), o(s.pages), t.clearCollection();
3234
3285
  return;
3235
3286
  }
3236
- let s = Rt(await i({
3287
+ let s = Bt(await i({
3237
3288
  cursor: n,
3238
3289
  signal: c
3239
3290
  }));
@@ -3253,7 +3304,7 @@ async function Un({ append: e, autofillController: t, cursor: n, isCurrent: r, l
3253
3304
  l.autofill.status = "complete";
3254
3305
  return;
3255
3306
  }
3256
- await dn(u, l, {
3307
+ await pn(u, l, {
3257
3308
  cycleId: p,
3258
3309
  feedKey: u.feedKey,
3259
3310
  items: h.slice(d.length),
@@ -3277,13 +3328,13 @@ async function Un({ append: e, autofillController: t, cursor: n, isCurrent: r, l
3277
3328
  function $(e) {
3278
3329
  return `${typeof e}:${String(e)}`;
3279
3330
  }
3280
- function Wn(e) {
3331
+ function Kn(e) {
3281
3332
  return `${typeof e}:${String(e)}`;
3282
3333
  }
3283
- function Gn(e) {
3334
+ function qn(e) {
3284
3335
  return e.map(({ postId: e }) => e);
3285
3336
  }
3286
- var Kn = class {
3337
+ var Jn = class {
3287
3338
  delay;
3288
3339
  enabled;
3289
3340
  maxReplayPages;
@@ -3325,14 +3376,14 @@ var Kn = class {
3325
3376
  async reconcile({ existingItems: e, loadPage: t, shouldPause: n = () => !1, signal: r }) {
3326
3377
  let i = this.pending ?? this.createSession(e);
3327
3378
  for (this.pending = i; i.remainingRequests > 0;) {
3328
- let e = Wn(i.cursor);
3379
+ let e = Kn(i.cursor);
3329
3380
  if (i.seenCursors.has(e)) throw Error("Vibe removal reconciliation received a repeated cursor.");
3330
- if (await Kt({
3331
- delayMs: Gt(i.pages.length, this.delay),
3381
+ if (await Jt({
3382
+ delayMs: qt(i.pages.length, this.delay),
3332
3383
  onChange: () => void 0,
3333
3384
  signal: r
3334
3385
  }), i.pages.length > 0 && n()) return this.result(i, "paused");
3335
- let a = Rt(await t({
3386
+ let a = Bt(await t({
3336
3387
  cursor: i.cursor,
3337
3388
  signal: r
3338
3389
  }));
@@ -3345,7 +3396,7 @@ var Kn = class {
3345
3396
  contributionIds: s,
3346
3397
  cursor: i.cursor,
3347
3398
  next: a.next,
3348
- returnedIds: Gn(o)
3399
+ returnedIds: qn(o)
3349
3400
  }), i.lastCursor = i.cursor, i.next = a.next, --i.remainingRequests, a.total !== void 0 && (i.total = a.total), i.next === null ? i.remainingRequests = 0 : i.cursor = i.next, i.remainingRequests > 0 && n()) return this.result(i, "paused");
3350
3401
  }
3351
3402
  return this.result(i, "complete");
@@ -3384,7 +3435,7 @@ var Kn = class {
3384
3435
  return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has($(e))).length < this.pageSize);
3385
3436
  }
3386
3437
  recordPage(e) {
3387
- let t = Wn(e.cursor), n = this.pages.findIndex(({ cursor: e }) => Wn(e) === t);
3438
+ let t = Kn(e.cursor), n = this.pages.findIndex(({ cursor: e }) => Kn(e) === t);
3388
3439
  n >= 0 && (this.pages = this.pages.slice(0, n)), this.pages.push({
3389
3440
  ...e,
3390
3441
  contributionIds: [...e.contributionIds],
@@ -3394,7 +3445,7 @@ var Kn = class {
3394
3445
  };
3395
3446
  //#endregion
3396
3447
  //#region src/core/activeItemRemoval.ts
3397
- function qn(e, t, n, r, i) {
3448
+ function Yn(e, t, n, r, i) {
3398
3449
  let a = new Set(t.map(({ item: e }) => e.postId));
3399
3450
  if (e.activeReelPostId === null || !a.has(e.activeReelPostId)) return;
3400
3451
  let o = e.items[Math.max(n, 0)];
@@ -3407,7 +3458,7 @@ function qn(e, t, n, r, i) {
3407
3458
  }
3408
3459
  //#endregion
3409
3460
  //#region src/core/exactMediaRemovalController.ts
3410
- function Jn(e, t) {
3461
+ function Xn(e, t) {
3411
3462
  let [n, ...r] = t;
3412
3463
  if (!n) throw Error("Vibe items must contain at least one media asset.");
3413
3464
  return {
@@ -3416,10 +3467,10 @@ function Jn(e, t) {
3416
3467
  items: r
3417
3468
  };
3418
3469
  }
3419
- function Yn(e) {
3470
+ function Zn(e) {
3420
3471
  if (!Number.isInteger(e.mediaIndex) || e.mediaIndex < 0) throw TypeError("Vibe mediaIndex must be a non-negative integer.");
3421
3472
  }
3422
- var Xn = class {
3473
+ var Qn = class {
3423
3474
  generation = 0;
3424
3475
  metadata = /* @__PURE__ */ new WeakMap();
3425
3476
  state;
@@ -3427,7 +3478,7 @@ var Xn = class {
3427
3478
  this.options = e, this.state = e.state;
3428
3479
  }
3429
3480
  remove(e) {
3430
- Yn(e);
3481
+ Zn(e);
3431
3482
  let t = this.state.items.findIndex(({ postId: t }) => t === e.postId), n = this.state.items[t];
3432
3483
  if (!n) return null;
3433
3484
  let r = [...M(n)], i = r[e.mediaIndex];
@@ -3444,7 +3495,7 @@ var Xn = class {
3444
3495
  restored: !1
3445
3496
  });
3446
3497
  let o = this.state.mediaIndices.get(n.postId) ?? 0, s = this.isReelOpen() && this.state.activeReelPostId === n.postId, c = s && o === e.mediaIndex;
3447
- return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = Jn(n, r), this.updateMediaIndexAfterRemoval(n.postId, e.mediaIndex, c), a) : (this.state.items.splice(t, 1), this.options.onPostRemoved(n.postId), this.state.mediaIndices.delete(n.postId), s && this.advanceFromRemovedPost(a, n), a);
3498
+ return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = Xn(n, r), this.updateMediaIndexAfterRemoval(n.postId, e.mediaIndex, c), a) : (this.state.items.splice(t, 1), this.options.onPostRemoved(n.postId), this.state.mediaIndices.delete(n.postId), s && this.advanceFromRemovedPost(a, n), a);
3448
3499
  }
3449
3500
  reset() {
3450
3501
  this.generation += 1;
@@ -3470,7 +3521,7 @@ var Xn = class {
3470
3521
  }
3471
3522
  restoreIntoPost(e, t) {
3472
3523
  let n = this.state.items[e], r = [...M(n)], i = Math.min(t.mediaIndex, r.length);
3473
- if (r.splice(i, 0, t.media), this.state.items[e] = Jn(n, r), this.state.activeReelPostId !== t.postId) return;
3524
+ if (r.splice(i, 0, t.media), this.state.items[e] = Xn(n, r), this.state.activeReelPostId !== t.postId) return;
3474
3525
  let a = this.state.mediaIndices.get(t.postId) ?? 0;
3475
3526
  a >= i && this.state.mediaIndices.set(t.postId, a + 1);
3476
3527
  }
@@ -3483,18 +3534,18 @@ var Xn = class {
3483
3534
  };
3484
3535
  //#endregion
3485
3536
  //#region src/core/itemPlacement.ts
3486
- function Zn(e, t) {
3537
+ function $n(e, t) {
3487
3538
  let n = new Set(t);
3488
3539
  return e.flatMap((e, t) => n.has(e.postId) ? [{
3489
3540
  index: t,
3490
3541
  item: e
3491
3542
  }] : []);
3492
3543
  }
3493
- function Qn(e, t) {
3544
+ function er(e, t) {
3494
3545
  let n = new Set(t.map(({ item: e }) => e.postId));
3495
3546
  return e.filter((e) => !n.has(e.postId));
3496
3547
  }
3497
- function $n(e, t) {
3548
+ function tr(e, t) {
3498
3549
  t.forEach(({ index: e }) => {
3499
3550
  if (!Number.isInteger(e) || e < 0) throw Error("Vibe item restore indexes must be non-negative integers.");
3500
3551
  });
@@ -3505,7 +3556,7 @@ function $n(e, t) {
3505
3556
  }
3506
3557
  //#endregion
3507
3558
  //#region src/core/itemRemovalController.ts
3508
- var er = 20, tr = class {
3559
+ var nr = 20, rr = class {
3509
3560
  generation = 0;
3510
3561
  historyLimit;
3511
3562
  metadata = /* @__PURE__ */ new WeakMap();
@@ -3514,20 +3565,21 @@ var er = 20, tr = class {
3514
3565
  itemOrder;
3515
3566
  stopItemsWatcher;
3516
3567
  constructor(e) {
3517
- this.options = e, this.historyLimit = e.historyLimit ?? er, 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" });
3568
+ this.options = e, this.historyLimit = e.historyLimit ?? nr, 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" });
3518
3569
  }
3519
3570
  destroy() {
3520
3571
  this.reset(), this.stopItemsWatcher();
3521
3572
  }
3522
- async remove(e) {
3523
- let t = this.collectOrderedPlacements(e), n = this.createRemoval(t);
3524
- if (t.length === 0) return n;
3525
- let r = t.map(({ item: e }) => e.postId);
3526
- if (await this.options.prepareRemoval(r), this.metadata.get(n)?.generation !== this.generation) return n;
3527
- let i = this.options.startRemoval(r);
3528
- if (i > 0 && await new Promise((e) => setTimeout(e, i)), this.metadata.get(n)?.generation !== this.generation) return n;
3529
- 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);
3530
- return this.state.items = Qn(this.state.items, t), this.options.onItemsRemoved(n, t, c), this.record(n), n;
3573
+ async remove(e, t) {
3574
+ if (t?.staggerMs !== void 0 && (!Number.isFinite(t.staggerMs) || t.staggerMs < 0)) throw TypeError("Vibe item removal staggerMs must be a non-negative number.");
3575
+ let n = this.collectOrderedPlacements(e), r = this.createRemoval(n);
3576
+ if (n.length === 0) return r;
3577
+ let i = n.map(({ item: e }) => e.postId);
3578
+ if (await this.options.prepareRemoval(i), this.metadata.get(r)?.generation !== this.generation) return r;
3579
+ let a = this.options.startRemoval(i, t);
3580
+ if (a > 0 && await new Promise((e) => setTimeout(e, a)), this.metadata.get(r)?.generation !== this.generation) return r;
3581
+ let o = this.state.items.findIndex((e) => e.postId === this.state.activeReelPostId), s = new Set(n.map(({ item: e }) => e.postId)), c = o < 0 ? 0 : this.state.items.slice(0, o).filter(({ postId: e }) => s.has(e)).length, l = Math.max(o - c, 0);
3582
+ return this.state.items = er(this.state.items, n), this.options.onItemsRemoved(r, n, l), this.record(r), r;
3531
3583
  }
3532
3584
  reset() {
3533
3585
  this.generation += 1, this.history = [], this.itemOrder = [];
@@ -3538,8 +3590,8 @@ var er = 20, tr = class {
3538
3590
  this.restoreRemoval(t);
3539
3591
  return;
3540
3592
  }
3541
- let n = $n(this.state.items, e);
3542
- this.registerExternalPlacements(e), this.state.items = n;
3593
+ let n = new Set(this.state.items.map(({ postId: e }) => e)), r = e.filter(({ item: e }) => n.has(e.postId) ? !1 : (n.add(e.postId), !0)), i = tr(this.state.items, r);
3594
+ this.registerExternalPlacements(r), this.state.items = i, r.length > 0 && this.options.onRemovalRestored(r);
3543
3595
  }
3544
3596
  restoreRemoval(e) {
3545
3597
  let t = this.metadata.get(e);
@@ -3564,7 +3616,7 @@ var er = 20, tr = class {
3564
3616
  }
3565
3617
  collectOrderedPlacements(e) {
3566
3618
  let t = new Map(this.itemOrder.map((e, t) => [e, t]));
3567
- return Zn(this.state.items, e).map((e) => ({
3619
+ return $n(this.state.items, e).map((e) => ({
3568
3620
  index: t.get(e.item.postId) ?? e.index,
3569
3621
  item: e.item
3570
3622
  }));
@@ -3595,7 +3647,7 @@ var er = 20, tr = class {
3595
3647
  let r = new Map(this.itemOrder.map((e, t) => [e, t]));
3596
3648
  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;
3597
3649
  }
3598
- }, nr = class {
3650
+ }, ir = class {
3599
3651
  forward = null;
3600
3652
  forwardPromise = null;
3601
3653
  forwardVersion = 0;
@@ -3673,7 +3725,7 @@ var er = 20, tr = class {
3673
3725
  }
3674
3726
  }
3675
3727
  }
3676
- }, rr = class {
3728
+ }, ar = class {
3677
3729
  generation = 0;
3678
3730
  pending = Promise.resolve();
3679
3731
  constructor(e) {
@@ -3723,24 +3775,24 @@ var er = 20, tr = class {
3723
3775
  };
3724
3776
  //#endregion
3725
3777
  //#region src/core/removalControllers.ts
3726
- function ir(e) {
3727
- let t = new nr(e), n = new rr({
3778
+ function or(e) {
3779
+ let t = new ir(e), n = new ar({
3728
3780
  state: e.state,
3729
3781
  transitionMedia: (t) => e.surface()?.transitionActiveReelMedia(t) ?? Promise.resolve(!1),
3730
3782
  transitionPost: (t) => e.surface()?.transitionActiveReelPost(t) ?? Promise.resolve(!1)
3731
3783
  });
3732
3784
  return {
3733
- exactMediaRemoval: new Xn({
3785
+ exactMediaRemoval: new Qn({
3734
3786
  onActivate: e.onActivate,
3735
3787
  onPostRemoved: (t) => e.onItemsRemoved([t]),
3736
3788
  onPostRestored: (t) => e.onItemsRestored([t]),
3737
3789
  reelForward: t,
3738
3790
  state: e.state
3739
3791
  }),
3740
- itemRemoval: new tr({
3792
+ itemRemoval: new rr({
3741
3793
  historyLimit: e.historyLimit,
3742
3794
  onItemsRemoved: (n, r, i) => {
3743
- e.onItemsRemoved(r.map(({ item: e }) => e.postId)), qn(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
3795
+ e.onItemsRemoved(r.map(({ item: e }) => e.postId)), Yn(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
3744
3796
  },
3745
3797
  onRemovalRestored: (n) => {
3746
3798
  e.onItemsRestored(n.map(({ item: e }) => e.postId));
@@ -3748,24 +3800,24 @@ function ir(e) {
3748
3800
  r && e.onActivate(r.postId);
3749
3801
  },
3750
3802
  prepareRemoval: (e) => n.prepareItems(e),
3751
- startRemoval: (t) => e.surface()?.startItemRemoval(t) ?? 0,
3803
+ startRemoval: (t, n) => e.surface()?.startItemRemoval(t, n) ?? 0,
3752
3804
  state: e.state
3753
3805
  }),
3754
3806
  reelForward: t,
3755
3807
  reelRemoval: n
3756
3808
  };
3757
3809
  }
3758
- var ar = 1.5;
3759
- function or(e) {
3810
+ var sr = 1.5;
3811
+ function cr(e) {
3760
3812
  let t = Math.min(e.screenWidth, e.screenHeight);
3761
3813
  if (t > 0 && t < 600) return !0;
3762
- let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * ar;
3814
+ let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * sr;
3763
3815
  return !e.hasHover && n > 0 && n < 600 && r;
3764
3816
  }
3765
- function sr(e) {
3766
- return or(e) ? "reel" : "masonry";
3817
+ function lr(e) {
3818
+ return cr(e) ? "reel" : "masonry";
3767
3819
  }
3768
- function cr(e) {
3820
+ function ur(e) {
3769
3821
  let t = e.ownerDocument.defaultView, n = e.ownerDocument.documentElement;
3770
3822
  return {
3771
3823
  hasHover: typeof t?.matchMedia == "function" && t.matchMedia("(hover: hover)").matches,
@@ -3775,15 +3827,15 @@ function cr(e) {
3775
3827
  viewportWidth: n.clientWidth
3776
3828
  };
3777
3829
  }
3778
- function lr(e) {
3779
- return or(cr(e));
3830
+ function dr(e) {
3831
+ return cr(ur(e));
3780
3832
  }
3781
- function ur(e) {
3782
- return sr(cr(e));
3833
+ function fr(e) {
3834
+ return lr(ur(e));
3783
3835
  }
3784
3836
  //#endregion
3785
3837
  //#region src/core/responsiveLayoutController.ts
3786
- var dr = class {
3838
+ var pr = class {
3787
3839
  layoutMode;
3788
3840
  resizeObserver = null;
3789
3841
  target = null;
@@ -3808,10 +3860,10 @@ var dr = class {
3808
3860
  }
3809
3861
  handleResponsiveLayout = () => {
3810
3862
  if (!this.target) return;
3811
- let e = ur(this.target);
3812
- this.state.phoneMode = lr(this.target), this.state.reelInfoSheetOverlay = this.state.phoneMode, this.state.reelMediaSource = e === "reel" ? "preview" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
3863
+ let e = fr(this.target);
3864
+ this.state.phoneMode = dr(this.target), this.state.reelInfoSheetOverlay = this.state.phoneMode, this.state.reelMediaSource = e === "reel" ? "preview" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
3813
3865
  };
3814
- }, fr = class {
3866
+ }, mr = class {
3815
3867
  routedReelPostId = null;
3816
3868
  reelRouteIsActive = !1;
3817
3869
  constructor(e, t) {
@@ -3838,7 +3890,7 @@ var dr = class {
3838
3890
  let i = this.reelRouteIsActive ? "replace" : "push";
3839
3891
  this.reelRouteIsActive = !0, this.routedReelPostId = e, this.options.router[i](r);
3840
3892
  }
3841
- }, pr = class {
3893
+ }, hr = class {
3842
3894
  app = null;
3843
3895
  autoScroll;
3844
3896
  autofillController;
@@ -3859,12 +3911,12 @@ var dr = class {
3859
3911
  notificationItems;
3860
3912
  state;
3861
3913
  constructor(e) {
3862
- this.options = e, Vn(e);
3914
+ this.options = e, Un(e);
3863
3915
  let t = e.layout ?? "masonry";
3864
- this.state = x(Rn(e, t)), this.notificationItems = I(this.state), this.autoScroll = new un({
3916
+ this.state = x(Bn(e, t)), this.notificationItems = I(this.state), this.autoScroll = new fn({
3865
3917
  getScrollElement: () => this.surface?.getAutoScrollElement() ?? null,
3866
3918
  state: this.state.autoScroll
3867
- }), this.autofillController = new rn({
3919
+ }), this.autofillController = new on({
3868
3920
  cancelRequest: () => this.cancelRequest(),
3869
3921
  onLastCursor: (e) => {
3870
3922
  this.lastLoadedCursor = e;
@@ -3872,7 +3924,7 @@ var dr = class {
3872
3924
  onPages: (e) => this.removalReconciliation.recordPages(e),
3873
3925
  options: e.autofill,
3874
3926
  state: this.state
3875
- }), this.removalReconciliation = new Kn(e), this.fillController = new An({
3927
+ }), this.removalReconciliation = new Jn(e), this.fillController = new Mn({
3876
3928
  fill: e.fill,
3877
3929
  loadPage: e.loadPage ? (e) => this.loadFilteredPage(e) : void 0,
3878
3930
  onLastCursor: (e) => {
@@ -3880,8 +3932,8 @@ var dr = class {
3880
3932
  },
3881
3933
  onPages: (e) => this.removalReconciliation.recordPages(e),
3882
3934
  state: this.state
3883
- }), this.routing = new fr(e.routing, this.state);
3884
- let n = ir({
3935
+ }), this.routing = new mr(e.routing, this.state);
3936
+ let n = or({
3885
3937
  historyLimit: e.removalHistoryLimit,
3886
3938
  loadNext: () => this.loadNext(),
3887
3939
  onActivate: (e) => this.setActiveReelPost(e),
@@ -3891,20 +3943,20 @@ var dr = class {
3891
3943
  state: this.state,
3892
3944
  surface: () => this.surface
3893
3945
  });
3894
- this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new dr(t, this.state, () => {
3946
+ this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new pr(t, this.state, () => {
3895
3947
  this.routing.syncFeed();
3896
3948
  }), this.startStateNotifications();
3897
3949
  }
3898
3950
  async mount() {
3899
3951
  if (this.app) throw Error("Vibe is already mounted.");
3900
3952
  this.startStateNotifications();
3901
- let e = Hn(this.options.target);
3902
- this.responsiveLayout.mount(e), this.app = i(Lt, {
3953
+ let e = Wn(this.options.target);
3954
+ this.responsiveLayout.mount(e), this.app = i(zt, {
3903
3955
  canRetryEnd: !!this.options.loadPage,
3904
3956
  cardFooter: this.options.cardFooter,
3905
3957
  cardHeader: this.options.cardHeader,
3906
3958
  feedFooter: this.options.feedFooter,
3907
- feedFooterActions: jn(this),
3959
+ feedFooterActions: Nn(this),
3908
3960
  mediaCard: this.options.mediaCard,
3909
3961
  masonry: this.options.masonry,
3910
3962
  onMediaReady: this.options.onMediaReady,
@@ -3941,8 +3993,8 @@ var dr = class {
3941
3993
  removeMediaAnimated(e) {
3942
3994
  return this.reelRemoval.prepareMedia(e).then(() => this.exactMediaRemoval.remove(e));
3943
3995
  }
3944
- removeItems(e) {
3945
- return this.itemRemoval.remove(e);
3996
+ removeItems(e, t) {
3997
+ return this.itemRemoval.remove(e, t);
3946
3998
  }
3947
3999
  restoreItems(e) {
3948
4000
  this.itemRemoval.restoreItems(e);
@@ -3987,7 +4039,7 @@ var dr = class {
3987
4039
  this.autoScroll.setSpeed(e);
3988
4040
  }
3989
4041
  applyAutofillUpdate(e) {
3990
- let t = pn(this.options.autofill, this.state, e);
4042
+ let t = hn(this.options.autofill, this.state, e);
3991
4043
  return t && this.autofillController.syncCountdown(), t;
3992
4044
  }
3993
4045
  cancelAutofill() {
@@ -3998,7 +4050,7 @@ var dr = class {
3998
4050
  await this.cancelFill();
3999
4051
  return;
4000
4052
  }
4001
- if ($t(this.state.autofill)) {
4053
+ if (tn(this.state.autofill)) {
4002
4054
  await this.cancelAutofill();
4003
4055
  return;
4004
4056
  }
@@ -4012,12 +4064,12 @@ var dr = class {
4012
4064
  }
4013
4065
  async fill(e) {
4014
4066
  if (!this.state.loadMoreLocked) {
4015
- if (this.pendingRequest || $t(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
4067
+ if (this.pendingRequest || tn(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
4016
4068
  await this.fillController.start(e);
4017
4069
  }
4018
4070
  }
4019
4071
  restoreAutofillSession(e) {
4020
- let t = mn(this.options.autofill, this.state, e);
4072
+ let t = gn(this.options.autofill, this.state, e);
4021
4073
  return t && this.autofillController.syncCountdown(), t;
4022
4074
  }
4023
4075
  restoreFillSession(e) {
@@ -4025,7 +4077,7 @@ var dr = class {
4025
4077
  }
4026
4078
  async loadNext() {
4027
4079
  if (this.pendingRequest) return this.pendingRequest;
4028
- if (this.state.loadMoreLocked || $t(this.state.autofill) || this.fillController.isActive() || !this.options.loadPage || this.state.next === null && !this.removalReconciliation.needsReconciliation(this.state.items)) return;
4080
+ if (this.state.loadMoreLocked || tn(this.state.autofill) || this.fillController.isActive() || !this.options.loadPage || this.state.next === null && !this.removalReconciliation.needsReconciliation(this.state.items)) return;
4029
4081
  this.state.isLoadingMore = !0, this.state.nextPageError = null;
4030
4082
  let e = this.loadNextSequence();
4031
4083
  return this.pendingRequest = e, e.finally(() => {
@@ -4040,12 +4092,12 @@ var dr = class {
4040
4092
  }
4041
4093
  async replaceFeed(e, t) {
4042
4094
  if (!this.options.loadPage) throw Error(`Vibe cannot ${t} without loadPage.`);
4043
- return $t(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.state.autofill = Qt(this.options.autofill, void 0, !1), this.fillController.reset(), this.reelForward.reset(), this.reelRemoval.reset(), this.exactMediaRemoval.reset(), this.itemRemoval.reset(), this.removalReconciliation.reset(), this.state.error = null, this.state.isLoading = !0, this.state.items = [], this.state.next = null, this.state.nextPageError = null, this.state.total = null, this.startRequest(e, !1);
4095
+ return tn(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.state.autofill = en(this.options.autofill, void 0, !1), this.fillController.reset(), this.reelForward.reset(), this.reelRemoval.reset(), this.exactMediaRemoval.reset(), this.itemRemoval.reset(), this.removalReconciliation.reset(), this.state.error = null, this.state.isLoading = !0, this.state.items = [], this.state.next = null, this.state.nextPageError = null, this.state.total = null, this.startRequest(e, !1);
4044
4096
  }
4045
4097
  async loadFilteredPage(e) {
4046
4098
  let t = this.options.loadPage;
4047
4099
  if (!t) throw Error("Vibe cannot load a page without loadPage.");
4048
- let n = Rt(await t(e));
4100
+ let n = Bt(await t(e));
4049
4101
  return {
4050
4102
  ...n,
4051
4103
  items: this.removalReconciliation.filterItems(n.items)
@@ -4075,7 +4127,7 @@ var dr = class {
4075
4127
  }
4076
4128
  async retryEnd() {
4077
4129
  if (this.pendingRequest) return this.pendingRequest;
4078
- if (!this.state.loadMoreLocked && !($t(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);
4130
+ if (!this.state.loadMoreLocked && !(tn(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);
4079
4131
  }
4080
4132
  setInfiniteScroll(e) {
4081
4133
  this.state.infiniteScroll = e, e && m(() => this.surface?.loadIfNearBottom());
@@ -4103,10 +4155,10 @@ var dr = class {
4103
4155
  this.state.total = e;
4104
4156
  }
4105
4157
  setReelAutoAdvance(e) {
4106
- Fn(this.state.reelAutoAdvance, e);
4158
+ Ln(this.state.reelAutoAdvance, e);
4107
4159
  }
4108
4160
  setReelInfoSheet(e) {
4109
- Ln(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
4161
+ zn(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
4110
4162
  }
4111
4163
  setLayout(e) {
4112
4164
  this.responsiveLayout.setLayout(e);
@@ -4126,7 +4178,7 @@ var dr = class {
4126
4178
  async fetchPage(e, t) {
4127
4179
  if (!this.options.loadPage) return;
4128
4180
  let n = ++this.requestVersion, r = new AbortController();
4129
- this.abortController = r, await Un({
4181
+ this.abortController = r, await Gn({
4130
4182
  append: t,
4131
4183
  autofillController: this.autofillController,
4132
4184
  cursor: e,
@@ -4150,7 +4202,7 @@ var dr = class {
4150
4202
  startInitialAutofill() {
4151
4203
  let e = ++this.requestVersion, t = new AbortController(), n = this.autofillController.beginCycle();
4152
4204
  this.abortController = t, this.state.isLoadingMore = !0;
4153
- let r = hn({
4205
+ let r = _n({
4154
4206
  cycleId: n,
4155
4207
  isCurrent: () => e === this.requestVersion,
4156
4208
  onCollection: (t) => this.autofillController.captureCollection(t, e === this.requestVersion),
@@ -4176,8 +4228,8 @@ var dr = class {
4176
4228
  }));
4177
4229
  }
4178
4230
  };
4179
- function mr(e) {
4180
- return new pr(e);
4231
+ function gr(e) {
4232
+ return new hr(e);
4181
4233
  }
4182
4234
  //#endregion
4183
- export { mr as createVibe };
4235
+ export { gr as createVibe };