@wyxos/vibe 5.10.0 → 5.11.0

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
@@ -48,7 +48,7 @@ function B(e) {
48
48
  type: "image"
49
49
  };
50
50
  }
51
- function ee(e, t) {
51
+ function V(e, t) {
52
52
  return I(e.type, e.src) === "audio" ? t === "mobile" && e.mobile && I(e.mobile.type, e.mobile.src) === "audio" ? {
53
53
  ...e.mobile,
54
54
  type: "audio"
@@ -57,14 +57,14 @@ function ee(e, t) {
57
57
  type: "audio"
58
58
  } : z(e, t);
59
59
  }
60
- function V(e) {
60
+ function H(e) {
61
61
  return [e, ...e.items];
62
62
  }
63
- function H(e, t) {
63
+ function U(e, t) {
64
64
  return Math.min(e.items.length, Math.max(0, t));
65
65
  }
66
- function U(e, t) {
67
- return V(e)[H(e, t)] ?? e;
66
+ function ee(e, t) {
67
+ return H(e)[U(e, t)] ?? e;
68
68
  }
69
69
  function W(e, t) {
70
70
  return `${String(e)}:${t}`;
@@ -111,10 +111,10 @@ var K = {
111
111
  key: 0,
112
112
  class: "load-more-status",
113
113
  role: "status"
114
- }, ne = ["disabled"], J = {
114
+ }, ne = ["disabled"], re = {
115
115
  key: 2,
116
116
  class: "end-feed"
117
- }, re = ["disabled"], Y = /* @__PURE__ */ d({
117
+ }, J = ["disabled"], ie = /* @__PURE__ */ d({
118
118
  __name: "GalleryFooter",
119
119
  props: {
120
120
  canRetryEnd: { type: Boolean },
@@ -137,7 +137,7 @@ var K = {
137
137
  type: "button",
138
138
  disabled: e.loadMoreLocked,
139
139
  onClick: i
140
- }, T(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9, ne)) : (b(), s("div", J, [n[1] ||= c("p", {
140
+ }, T(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9, ne)) : (b(), s("div", re, [n[1] ||= c("p", {
141
141
  class: "end-feed-message",
142
142
  role: "status"
143
143
  }, " You've reached the end. ", -1), c("button", {
@@ -146,9 +146,9 @@ var K = {
146
146
  type: "button",
147
147
  disabled: e.loadMoreLocked,
148
148
  onClick: n[0] ||= (e) => t.$emit("retryEnd")
149
- }, " Check for more ", 8, re)]))])) : o("", !0);
149
+ }, " Check for more ", 8, J)]))])) : o("", !0);
150
150
  }
151
- }), ie = /* @__PURE__ */ d({
151
+ }), ae = /* @__PURE__ */ d({
152
152
  __name: "FeedFooter",
153
153
  props: {
154
154
  actions: {},
@@ -185,7 +185,7 @@ var K = {
185
185
  "can-retry-end",
186
186
  "show-load-more",
187
187
  "state"
188
- ])) : (b(), a(Y, {
188
+ ])) : (b(), a(ie, {
189
189
  key: 1,
190
190
  "can-retry-end": e.canRetryEnd,
191
191
  "has-error": e.hasError,
@@ -204,7 +204,7 @@ var K = {
204
204
  "show-load-more"
205
205
  ]));
206
206
  }
207
- }), ae = ["role"], X = { class: "gallery-status" }, oe = /* @__PURE__ */ d({
207
+ }), oe = ["role"], Y = { class: "gallery-status" }, se = /* @__PURE__ */ d({
208
208
  __name: "FeedStatus",
209
209
  props: {
210
210
  actions: {},
@@ -217,8 +217,8 @@ var K = {
217
217
  let r = t, i = n;
218
218
  return (n, u) => (b(), s("main", {
219
219
  class: "gallery-shell",
220
- role: r.state.error ? "alert" : r.state.isLoading ? "status" : void 0
221
- }, [c("p", X, [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(ie, {
220
+ role: r.state.error ? "alert" : r.state.isLoading || r.state.isLoadingMore ? "status" : void 0
221
+ }, [c("p", Y, [r.state.error ? (b(), s(e, { key: 0 }, [l(" Unable to load media. ")], 64)) : r.state.isLoading || r.state.isLoadingMore ? (b(), s(e, { key: 1 }, [l(" Loading media… ")], 64)) : (b(), s(e, { key: 2 }, [l(" No media found. ")], 64))]), t.feedFooter ? (b(), a(ae, {
222
222
  key: 0,
223
223
  actions: t.actions,
224
224
  "can-retry-end": t.canRetryEnd,
@@ -240,32 +240,44 @@ var K = {
240
240
  "is-loading",
241
241
  "load-more-locked",
242
242
  "state"
243
- ])) : o("", !0)], 8, ae));
243
+ ])) : o("", !0)], 8, oe));
244
244
  }
245
245
  });
246
- function se(e) {
246
+ function ce(e) {
247
247
  return e.scrollHeight - e.scrollTop - e.clientHeight <= 240;
248
248
  }
249
249
  //#endregion
250
250
  //#region src/core/masonry.ts
251
- function Z(e) {
251
+ function X(e) {
252
252
  let t = e.preview?.width ?? e.width, n = e.preview?.height ?? e.height;
253
253
  return !t || !n || t <= 0 || n <= 0 ? 1 : n / t;
254
254
  }
255
- function ce(e) {
255
+ function Z(e) {
256
256
  return e.reduce((t, n, r) => n < e[t] ? r : t, 0);
257
257
  }
258
258
  function le(e) {
259
259
  return Math.max(0, e.containerHeight) + Math.max(0, e.gap);
260
260
  }
261
- function ue(e, t, n) {
261
+ var ue = .8, de = .5;
262
+ function fe(e, t, n) {
263
+ let r = Math.max(0, n.viewportHeight);
264
+ if (r === 0) return [];
265
+ let i = n.scrollTop, a = i + r;
266
+ return t.filter((t) => {
267
+ let n = e[t];
268
+ if (!n || n.height <= 0) return !1;
269
+ let o = Math.max(0, Math.min(n.y + n.height, a) - Math.max(n.y, i)), s = n.height <= r ? n.height : r * ue;
270
+ return o + de >= s;
271
+ });
272
+ }
273
+ function Q(e, t, n) {
262
274
  if (t <= 0 || e.length === 0) return {
263
275
  columns: 0,
264
276
  height: 0,
265
277
  items: []
266
278
  };
267
279
  let r = Math.max(0, n.gap), i = Number.isFinite(n.additionalHeight) ? Math.max(0, n.additionalHeight ?? 0) : 0, a = Math.max(1, n.minColumnWidth), o = Math.max(1, Math.floor((t + r) / (a + r))), s = (t - r * (o - 1)) / o, c = Array.from({ length: o }, () => 0), l = e.map((e) => {
268
- let t = ce(c), n = s * Z(e) + i, a = {
280
+ let t = Z(c), n = s * X(e) + i, a = {
269
281
  x: t * (s + r),
270
282
  y: c[t],
271
283
  width: s,
@@ -281,7 +293,7 @@ function ue(e, t, n) {
281
293
  }
282
294
  //#endregion
283
295
  //#region src/core/masonryViewportIndex.ts
284
- function de(e, t) {
296
+ function pe(e, t) {
285
297
  let n = /* @__PURE__ */ new Map();
286
298
  return e.forEach((e, r) => {
287
299
  let i = n.get(e.x) ?? [];
@@ -292,25 +304,25 @@ function de(e, t) {
292
304
  }), n.set(e.x, i);
293
305
  }), { columns: [...n.entries()].sort(([e], [t]) => e - t).map(([, e]) => e.sort((e, t) => e.top - t.top || e.index - t.index)) };
294
306
  }
295
- function fe(e, t) {
307
+ function me(e, t) {
296
308
  let n = 0, r = 0, i = e.length;
297
309
  for (; r < i;) {
298
310
  let a = Math.floor((r + i) / 2);
299
- n += 1, e[a].bottom < t ? r = a + 1 : i = a;
311
+ n += 1, e[a].bottom <= t ? r = a + 1 : i = a;
300
312
  }
301
313
  return {
302
314
  index: r,
303
315
  inspected: n
304
316
  };
305
317
  }
306
- function Q(e, t) {
318
+ function he(e, t) {
307
319
  let n = Math.max(0, t.overscan), r = t.scrollTop - n, i = t.scrollTop + Math.max(0, t.viewportHeight) + n, a = [], o = 0;
308
320
  return e.columns.forEach((e) => {
309
- let t = fe(e, r);
321
+ let t = me(e, r);
310
322
  o += t.inspected;
311
323
  for (let n = t.index; n < e.length; n += 1) {
312
324
  let t = e[n];
313
- if (o += 1, t.top > i) break;
325
+ if (o += 1, t.top >= i) break;
314
326
  a.push(t.index);
315
327
  }
316
328
  }), {
@@ -318,14 +330,14 @@ function Q(e, t) {
318
330
  inspected: o
319
331
  };
320
332
  }
321
- function pe(e) {
333
+ function ge(e) {
322
334
  return e?.minColumnWidth ?? 240;
323
335
  }
324
- function me(e, t) {
336
+ function _e(e, t) {
325
337
  let n = e?.overscan?.minimumPx ?? 800, r = e?.overscan?.viewportMultiplier ?? 1.5, i = Math.max(n, t * r), a = e?.overscan?.maximumPx;
326
338
  return a === void 0 ? i : Math.min(i, a);
327
339
  }
328
- function he(e) {
340
+ function ve(e) {
329
341
  if (e?.minColumnWidth !== void 0 && (!Number.isFinite(e.minColumnWidth) || e.minColumnWidth <= 0)) throw TypeError("Vibe masonry minColumnWidth must be a positive number.");
330
342
  let t = e?.overscan;
331
343
  if (t) {
@@ -339,10 +351,10 @@ function he(e) {
339
351
  }
340
352
  //#endregion
341
353
  //#region src/core/scrollbar.ts
342
- function ge(e, t, n) {
354
+ function ye(e, t, n) {
343
355
  return Math.min(n, Math.max(t, e));
344
356
  }
345
- function _e({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize: r, viewportSize: i }) {
357
+ function be({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize: r, viewportSize: i }) {
346
358
  let a = Math.max(0, e), o = Math.max(0, r), s = Math.max(0, i), c = Math.max(0, a - s);
347
359
  if (!(c > 0 && o > 0)) return {
348
360
  maximumScrollPosition: c,
@@ -351,23 +363,23 @@ function _e({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize:
351
363
  thumbSize: o,
352
364
  thumbTravel: 0
353
365
  };
354
- let l = ge(s / a * o, Math.min(Math.max(0, t), o), o), u = Math.max(0, o - l);
366
+ let l = ye(s / a * o, Math.min(Math.max(0, t), o), o), u = Math.max(0, o - l);
355
367
  return {
356
368
  maximumScrollPosition: c,
357
369
  scrollable: !0,
358
- thumbOffset: u * (ge(n, 0, c) / c),
370
+ thumbOffset: u * (ye(n, 0, c) / c),
359
371
  thumbSize: l,
360
372
  thumbTravel: u
361
373
  };
362
374
  }
363
375
  //#endregion
364
376
  //#region src/components/GalleryScrollbar.vue?vue&type=script&setup=true&lang.ts
365
- var ve = ["aria-hidden"], ye = [
377
+ var xe = ["aria-hidden"], Se = [
366
378
  "aria-controls",
367
379
  "aria-valuemax",
368
380
  "aria-valuenow",
369
381
  "tabindex"
370
- ], be = 32, xe = 40, Se = 120, Ce = /* @__PURE__ */ d({
382
+ ], Ce = 32, we = 40, Te = 120, Ee = /* @__PURE__ */ d({
371
383
  __name: "GalleryScrollbar",
372
384
  props: {
373
385
  contentSize: {},
@@ -389,16 +401,16 @@ var ve = ["aria-hidden"], ye = [
389
401
  function k() {
390
402
  g !== null && clearTimeout(g), g = setTimeout(() => {
391
403
  g = null, o.value || (l.value = !1);
392
- }, Se);
404
+ }, Te);
393
405
  }
394
406
  function A() {
395
407
  l.value = !0, k();
396
408
  }
397
409
  function j() {
398
410
  let e = t.scrollElement, r = i.value;
399
- return !e || !r ? n : _e({
411
+ return !e || !r ? n : be({
400
412
  contentSize: e.scrollHeight,
401
- minimumThumbSize: be,
413
+ minimumThumbSize: Ce,
402
414
  scrollPosition: e.scrollTop,
403
415
  trackSize: r.clientHeight,
404
416
  viewportSize: e.clientHeight
@@ -451,7 +463,7 @@ var ve = ["aria-hidden"], ye = [
451
463
  }
452
464
  function z(e) {
453
465
  if (!E.value) return;
454
- let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r - xe : e.key === "ArrowDown" ? r + xe : e.key === "PageUp" ? r - n : e.key === "PageDown" ? r + n : e.key === "Home" ? 0 : e.key === "End" ? a.value.maximumScrollPosition : null;
466
+ let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r - we : e.key === "ArrowDown" ? r + we : e.key === "PageUp" ? r - n : e.key === "PageDown" ? r + n : e.key === "Home" ? 0 : e.key === "End" ? a.value.maximumScrollPosition : null;
455
467
  i !== null && (e.preventDefault(), A(), P(i));
456
468
  }
457
469
  function B(e) {
@@ -497,15 +509,15 @@ var ve = ["aria-hidden"], ye = [
497
509
  onPointerdown: I,
498
510
  onPointermove: L,
499
511
  onPointerup: R
500
- }, null, 44, ye)], 42, ve));
512
+ }, null, 44, Se)], 42, xe));
501
513
  }
502
- }), we = (e) => {
514
+ }), De = (e) => {
503
515
  for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
504
516
  return !1;
505
- }, Te = (e) => e === "", Ee = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), De = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Oe = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), ke = (e) => {
506
- let t = Oe(e);
517
+ }, Oe = (e) => e === "", ke = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), Ae = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), je = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), Me = (e) => {
518
+ let t = je(e);
507
519
  return t.charAt(0).toUpperCase() + t.slice(1);
508
- }, Ae = {
520
+ }, Ne = {
509
521
  xmlns: "http://www.w3.org/2000/svg",
510
522
  width: 24,
511
523
  height: 24,
@@ -515,27 +527,27 @@ var ve = ["aria-hidden"], ye = [
515
527
  "stroke-width": 2,
516
528
  "stroke-linecap": "round",
517
529
  "stroke-linejoin": "round"
518
- }, je = ({ name: e, iconNode: t, absoluteStrokeWidth: n, "absolute-stroke-width": r, strokeWidth: i, "stroke-width": a, size: o = Ae.width, color: s = Ae.stroke, ...c }, { slots: l }) => p("svg", {
519
- ...Ae,
530
+ }, Pe = ({ name: e, iconNode: t, absoluteStrokeWidth: n, "absolute-stroke-width": r, strokeWidth: i, "stroke-width": a, size: o = Ne.width, color: s = Ne.stroke, ...c }, { slots: l }) => p("svg", {
531
+ ...Ne,
520
532
  ...c,
521
533
  width: o,
522
534
  height: o,
523
535
  stroke: s,
524
- "stroke-width": Te(n) || Te(r) || n === !0 || r === !0 ? Number(i || a || Ae["stroke-width"]) * 24 / Number(o) : i || a || Ae["stroke-width"],
525
- class: Ee("lucide", c.class, ...e ? [`lucide-${De(ke(e))}-icon`, `lucide-${De(e)}`] : ["lucide-icon"]),
526
- ...!l.default && !we(c) && { "aria-hidden": "true" }
527
- }, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]), Me = (e, t) => (n, { slots: r, attrs: i }) => p(je, {
536
+ "stroke-width": Oe(n) || Oe(r) || n === !0 || r === !0 ? Number(i || a || Ne["stroke-width"]) * 24 / Number(o) : i || a || Ne["stroke-width"],
537
+ class: ke("lucide", c.class, ...e ? [`lucide-${Ae(Me(e))}-icon`, `lucide-${Ae(e)}`] : ["lucide-icon"]),
538
+ ...!l.default && !De(c) && { "aria-hidden": "true" }
539
+ }, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]), Fe = (e, t) => (n, { slots: r, attrs: i }) => p(Pe, {
528
540
  ...i,
529
541
  ...n,
530
542
  iconNode: t,
531
543
  name: e
532
- }, r), Ne = Me("chevron-left", [["path", {
544
+ }, r), Ie = Fe("chevron-left", [["path", {
533
545
  d: "m15 18-6-6 6-6",
534
546
  key: "1wnfg3"
535
- }]]), Pe = Me("chevron-right", [["path", {
547
+ }]]), Le = Fe("chevron-right", [["path", {
536
548
  d: "m9 18 6-6-6-6",
537
549
  key: "mthhwq"
538
- }]]), Fe = Me("disc-3", [
550
+ }]]), Re = Fe("disc-3", [
539
551
  ["circle", {
540
552
  cx: "12",
541
553
  cy: "12",
@@ -556,7 +568,7 @@ var ve = ["aria-hidden"], ye = [
556
568
  d: "M18 12c0 1.7-.7 3.2-1.8 4.2",
557
569
  key: "1eah9h"
558
570
  }]
559
- ]), Ie = Me("pause", [["rect", {
571
+ ]), ze = Fe("pause", [["rect", {
560
572
  x: "14",
561
573
  y: "3",
562
574
  width: "5",
@@ -570,10 +582,10 @@ var ve = ["aria-hidden"], ye = [
570
582
  height: "18",
571
583
  rx: "1",
572
584
  key: "1wsw3u"
573
- }]]), Le = Me("play", [["path", {
585
+ }]]), Be = Fe("play", [["path", {
574
586
  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",
575
587
  key: "10ikf1"
576
- }]]), Re = Me("volume-2", [
588
+ }]]), Ve = Fe("volume-2", [
577
589
  ["path", {
578
590
  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",
579
591
  key: "uqj9uw"
@@ -586,7 +598,7 @@ var ve = ["aria-hidden"], ye = [
586
598
  d: "M19.364 18.364a9 9 0 0 0 0-12.728",
587
599
  key: "ijwkga"
588
600
  }]
589
- ]), ze = Me("volume-x", [
601
+ ]), He = Fe("volume-x", [
590
602
  ["path", {
591
603
  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",
592
604
  key: "uqj9uw"
@@ -605,22 +617,22 @@ var ve = ["aria-hidden"], ye = [
605
617
  y2: "15",
606
618
  key: "5ykzw1"
607
619
  }]
608
- ]), Be = {
620
+ ]), Ue = {
609
621
  401: "Authentication required",
610
622
  403: "Access forbidden",
611
623
  404: "Preview not found",
612
624
  419: "Session expired",
613
625
  500: "Server error"
614
626
  };
615
- function Ve(e) {
627
+ function We(e) {
616
628
  return e.match(/\/demo-errors\/(401|403|404|419|500)\//)?.[1] ?? "Error";
617
629
  }
618
- function He(e) {
619
- return Be[Ve(e)] ?? "Preview unavailable";
630
+ function Ge(e) {
631
+ return Ue[We(e)] ?? "Preview unavailable";
620
632
  }
621
633
  //#endregion
622
634
  //#region src/components/CardRegion.vue
623
- var Ue = /* @__PURE__ */ d({
635
+ var Ke = /* @__PURE__ */ d({
624
636
  __name: "CardRegion",
625
637
  props: {
626
638
  index: {},
@@ -635,7 +647,7 @@ var Ue = /* @__PURE__ */ d({
635
647
  total: {}
636
648
  },
637
649
  setup(e) {
638
- let t = e, n = r(() => H(t.item, t.mediaIndex)), i = r(() => V(t.item)), o = r(() => U(t.item, n.value)), c = r(() => ({
650
+ let t = e, n = r(() => U(t.item, t.mediaIndex)), i = r(() => H(t.item)), o = r(() => ee(t.item, n.value)), c = r(() => ({
639
651
  height: `${t.region.height}px`,
640
652
  paddingBlock: t.style?.paddingY === void 0 ? void 0 : `${t.style.paddingY}px`,
641
653
  paddingInline: t.style?.paddingX === void 0 ? void 0 : `${t.style.paddingX}px`
@@ -667,7 +679,7 @@ var Ue = /* @__PURE__ */ d({
667
679
  "total"
668
680
  ]))], 38));
669
681
  }
670
- }), We = ["aria-busy", "aria-label"], Ge = { class: "media-error-code" }, Ke = ["disabled"], qe = /* @__PURE__ */ d({
682
+ }), qe = ["aria-busy", "aria-label"], Je = { class: "media-error-code" }, Ye = ["disabled"], Xe = /* @__PURE__ */ d({
671
683
  __name: "MediaError",
672
684
  props: {
673
685
  component: {},
@@ -702,7 +714,7 @@ var Ue = /* @__PURE__ */ d({
702
714
  "retrying",
703
715
  "status"
704
716
  ]))], 32)) : (b(), s(e, { key: 1 }, [
705
- c("strong", Ge, T(t.status), 1),
717
+ c("strong", Je, T(t.status), 1),
706
718
  c("span", null, T(t.label), 1),
707
719
  c("button", {
708
720
  "data-test": "media-retry",
@@ -711,26 +723,26 @@ var Ue = /* @__PURE__ */ d({
711
723
  disabled: t.retrying,
712
724
  onClick: j(o, ["stop"]),
713
725
  onKeydown: r[2] ||= j(() => {}, ["stop"])
714
- }, T(t.retrying ? "Retrying…" : "Retry"), 41, Ke)
715
- ], 64))], 8, We));
726
+ }, T(t.retrying ? "Retrying…" : "Retry"), 41, Ye)
727
+ ], 64))], 8, qe));
716
728
  }
717
- }), Je = ["aria-label"], Ye = [
729
+ }), Ze = ["aria-label"], Qe = [
718
730
  "max",
719
731
  "value",
720
732
  "aria-label",
721
733
  "aria-valuetext",
722
734
  "disabled"
723
- ], Xe = {
735
+ ], $e = {
724
736
  key: 0,
725
737
  class: "media-controls-row"
726
- }, Ze = ["aria-label", "title"], Qe = { class: "media-controls-audio" }, $e = ["aria-label", "title"], et = [
738
+ }, et = ["aria-label", "title"], tt = { class: "media-controls-audio" }, nt = ["aria-label", "title"], rt = [
727
739
  "value",
728
740
  "aria-label",
729
741
  "aria-valuetext"
730
- ], tt = {
742
+ ], it = {
731
743
  class: "media-control-time",
732
744
  "aria-live": "off"
733
- }, nt = /* @__PURE__ */ d({
745
+ }, at = /* @__PURE__ */ d({
734
746
  __name: "MediaControls",
735
747
  props: {
736
748
  currentTime: {},
@@ -780,35 +792,35 @@ var Ue = /* @__PURE__ */ d({
780
792
  "aria-valuetext": `${u(g.value)} of ${u(f.value)}`,
781
793
  disabled: f.value <= 0,
782
794
  onInput: n[0] ||= (e) => i("seek", d(e))
783
- }, null, 44, Ye), e.layout === "reel" ? (b(), s("div", Xe, [
795
+ }, null, 44, Qe), e.layout === "reel" ? (b(), s("div", $e, [
784
796
  c("button", {
785
797
  type: "button",
786
798
  class: "media-control-button media-control-playback",
787
799
  "aria-label": e.playing ? `Pause ${p.value}` : `Play ${p.value}`,
788
800
  title: e.playing ? "Pause" : "Play",
789
801
  onClick: n[1] ||= (e) => i("togglePlayback")
790
- }, [e.playing ? (b(), a(E(Ie), {
802
+ }, [e.playing ? (b(), a(E(ze), {
791
803
  key: 0,
792
804
  size: 18,
793
805
  fill: "currentColor"
794
- })) : (b(), a(E(Le), {
806
+ })) : (b(), a(E(Be), {
795
807
  key: 1,
796
808
  size: 18,
797
809
  fill: "currentColor"
798
- }))], 8, Ze),
799
- c("div", Qe, [c("button", {
810
+ }))], 8, et),
811
+ c("div", tt, [c("button", {
800
812
  type: "button",
801
813
  class: "media-control-button",
802
814
  "aria-label": e.muted ? `Unmute ${p.value}` : `Mute ${p.value}`,
803
815
  title: e.muted ? "Unmute" : "Mute",
804
816
  onClick: n[2] ||= (e) => i("toggleMute")
805
- }, [e.muted || e.volume === 0 ? (b(), a(E(ze), {
817
+ }, [e.muted || e.volume === 0 ? (b(), a(E(He), {
806
818
  key: 0,
807
819
  size: 18
808
- })) : (b(), a(E(Re), {
820
+ })) : (b(), a(E(Ve), {
809
821
  key: 1,
810
822
  size: 18
811
- }))], 8, $e), c("input", {
823
+ }))], 8, nt), c("input", {
812
824
  class: "media-control-range media-control-volume",
813
825
  type: "range",
814
826
  min: "0",
@@ -819,15 +831,15 @@ var Ue = /* @__PURE__ */ d({
819
831
  "aria-label": `${m.value} volume`,
820
832
  "aria-valuetext": `${Math.round(e.volume * 100)} percent`,
821
833
  onInput: n[3] ||= (e) => i("volumeChange", d(e))
822
- }, null, 44, et)]),
823
- c("output", tt, T(u(g.value)) + " / " + T(u(f.value)), 1)
824
- ])) : o("", !0)], 42, Je));
834
+ }, null, 44, rt)]),
835
+ c("output", it, T(u(g.value)) + " / " + T(u(f.value)), 1)
836
+ ])) : o("", !0)], 42, Ze));
825
837
  }
826
- }), rt = {
838
+ }), ot = {
827
839
  key: 0,
828
840
  class: "media-card-overlay-host",
829
841
  "data-test": "media-card-overlay"
830
- }, it = /* @__PURE__ */ d({
842
+ }, st = /* @__PURE__ */ d({
831
843
  __name: "MediaContextOverlay",
832
844
  props: {
833
845
  item: {},
@@ -837,7 +849,7 @@ var Ue = /* @__PURE__ */ d({
837
849
  mediaSource: {}
838
850
  },
839
851
  setup(e) {
840
- return (t, n) => e.mediaCard?.overlay?.component ? (b(), s("div", rt, [(b(), a(C(e.mediaCard.overlay.component), {
852
+ return (t, n) => e.mediaCard?.overlay?.component ? (b(), s("div", ot, [(b(), a(C(e.mediaCard.overlay.component), {
841
853
  item: e.item,
842
854
  "media-index": e.mediaIndex,
843
855
  "media-item": e.mediaItem,
@@ -849,26 +861,26 @@ var Ue = /* @__PURE__ */ d({
849
861
  "media-source"
850
862
  ]))])) : o("", !0);
851
863
  }
852
- }), at = 40, ot = 160, st = 24;
853
- function ct(e) {
864
+ }), ct = 40, lt = 160, ut = 24;
865
+ function dt(e) {
854
866
  let t = w("next"), n = null, r = 0, i = !1, a = null, o = null;
855
867
  function s(n, r) {
856
- let i = V(e.item()).length, a = (n + i) % i;
868
+ let i = H(e.item()).length, a = (n + i) % i;
857
869
  a !== e.mediaIndex() && (t.value = n < e.mediaIndex() ? "previous" : "next", e.onChange(a), r?.detail && r.detail > 0 && r.currentTarget?.blur());
858
870
  }
859
871
  function c() {
860
872
  r = 0, i = !1, n !== null && clearTimeout(n), n = null;
861
873
  }
862
874
  function l() {
863
- n !== null && clearTimeout(n), n = setTimeout(c, ot);
875
+ n !== null && clearTimeout(n), n = setTimeout(c, lt);
864
876
  }
865
877
  function u(e, t, n) {
866
878
  return t === 1 ? e * 16 : t === 2 ? e * n : e;
867
879
  }
868
880
  function d(t) {
869
- if (V(e.item()).length <= 1) return;
881
+ if (H(e.item()).length <= 1) return;
870
882
  let n = t.currentTarget, a = u(t.deltaX, t.deltaMode, n?.clientWidth || 1);
871
- if (a === 0 || (t.preventDefault(), l(), i) || (r += a, Math.abs(r) < st)) return;
883
+ if (a === 0 || (t.preventDefault(), l(), i) || (r += a, Math.abs(r) < ut)) return;
872
884
  let o = Math.sign(r);
873
885
  r = 0, i = !0, s(e.mediaIndex() + o);
874
886
  }
@@ -880,7 +892,7 @@ function ct(e) {
880
892
  let n = t.changedTouches[0];
881
893
  if (a === null || o === null || !n) return;
882
894
  let r = a - n.clientX, i = o - n.clientY;
883
- a = null, o = null, !(Math.abs(r) <= Math.abs(i)) && (Math.abs(r) < at || s(e.mediaIndex() + Math.sign(r)));
895
+ a = null, o = null, !(Math.abs(r) <= Math.abs(i)) && (Math.abs(r) < ct || s(e.mediaIndex() + Math.sign(r)));
884
896
  }
885
897
  return v(c), {
886
898
  change: s,
@@ -890,14 +902,14 @@ function ct(e) {
890
902
  onWheel: d
891
903
  };
892
904
  }
893
- var lt = /* @__PURE__ */ new Map(), ut = [], dt = 0, ft = 0;
894
- function pt(e, t) {
905
+ var ft = /* @__PURE__ */ new Map(), pt = [], mt = 0, ht = 0;
906
+ function gt(e, t) {
895
907
  return `${t ? "timed" : "image"}:${e}`;
896
908
  }
897
- function mt(e, t, n) {
898
- let r = V(e);
909
+ function _t(e, t, n) {
910
+ let r = H(e);
899
911
  if (r.length < 2) return [];
900
- let i = H(e, t), a = [];
912
+ let i = U(e, t), a = [];
901
913
  for (let e = 1; e < r.length; e += 1) {
902
914
  let t = i + e, n = i - e;
903
915
  t < r.length && a.push(t), n >= 0 && a.push(n);
@@ -908,7 +920,7 @@ function mt(e, t, n) {
908
920
  if (!t) return [];
909
921
  let i = I(t.type, t.src) === "audio" ? B(t) : z(t, n);
910
922
  if (!i) return [];
911
- let a = L(i.type, i.src), s = pt(i.src, a);
923
+ let a = L(i.type, i.src), s = gt(i.src, a);
912
924
  return o.has(s) ? [] : (o.add(s), [{
913
925
  key: s,
914
926
  src: i.src,
@@ -916,22 +928,22 @@ function mt(e, t, n) {
916
928
  }]);
917
929
  });
918
930
  }
919
- function ht(e) {
931
+ function vt(e) {
920
932
  let t = e.element;
921
933
  e.element = null, t && (t instanceof HTMLVideoElement ? (t.pause(), t.removeAttribute("src"), t.load()) : t.removeAttribute("src"));
922
934
  }
923
- function gt(e) {
924
- lt.delete(e.key);
925
- let t = ut.indexOf(e);
926
- t >= 0 && ut.splice(t, 1), e.cancel?.(), e.cancel = null, ht(e);
935
+ function yt(e) {
936
+ ft.delete(e.key);
937
+ let t = pt.indexOf(e);
938
+ t >= 0 && pt.splice(t, 1), e.cancel?.(), e.cancel = null, vt(e);
927
939
  }
928
- function _t(e) {
929
- e.state = "loading", dt += 1, e.timed && (ft += 1);
940
+ function bt(e) {
941
+ e.state = "loading", mt += 1, e.timed && (ht += 1);
930
942
  let t = !1, n = () => void 0, r = (r) => {
931
- t || (t = !0, n(), --dt, e.timed && --ft, e.cancel = null, e.state = r, r === "failed" && ht(e), e.refs === 0 && gt(e), vt());
943
+ t || (t = !0, n(), --mt, e.timed && --ht, e.cancel = null, e.state = r, r === "failed" && vt(e), e.refs === 0 && yt(e), xt());
932
944
  };
933
945
  if (e.cancel = () => {
934
- t || (t = !0, n(), --dt, e.timed && --ft, ht(e), vt());
946
+ t || (t = !0, n(), --mt, e.timed && --ht, vt(e), xt());
935
947
  }, e.timed) {
936
948
  let t = document.createElement("video"), i = () => r("ready"), a = () => r("failed");
937
949
  n = () => {
@@ -950,38 +962,38 @@ function _t(e) {
950
962
  i.removeEventListener("load", a), i.removeEventListener("error", o);
951
963
  }, i.addEventListener("load", a, { once: !0 }), i.addEventListener("error", o, { once: !0 }), i.decoding = "async", i.fetchPriority = "low", i.src = e.src, e.element = i;
952
964
  }
953
- function vt() {
954
- for (; dt < 6;) {
955
- let e = ut.findIndex((e) => e.refs > 0 && e.state === "queued" && (!e.timed || ft < 2));
965
+ function xt() {
966
+ for (; mt < 6;) {
967
+ let e = pt.findIndex((e) => e.refs > 0 && e.state === "queued" && (!e.timed || ht < 2));
956
968
  if (e < 0) return;
957
- let [t] = ut.splice(e, 1);
958
- t && _t(t);
969
+ let [t] = pt.splice(e, 1);
970
+ t && bt(t);
959
971
  }
960
972
  }
961
- function yt(e) {
962
- let t = lt.get(e.key);
973
+ function St(e) {
974
+ let t = ft.get(e.key);
963
975
  t || (t = {
964
976
  ...e,
965
977
  cancel: null,
966
978
  element: null,
967
979
  refs: 0,
968
980
  state: "queued"
969
- }, lt.set(t.key, t), ut.push(t)), t.refs += 1, vt();
981
+ }, ft.set(t.key, t), pt.push(t)), t.refs += 1, xt();
970
982
  let n = !1;
971
983
  return () => {
972
- n || (n = !0, --t.refs, t.refs === 0 && gt(t));
984
+ n || (n = !0, --t.refs, t.refs === 0 && yt(t));
973
985
  };
974
986
  }
975
987
  //#endregion
976
988
  //#region src/components/useVisiblePostPreload.ts
977
- function bt(e) {
978
- let t = r(() => e.layout() === "masonry" && e.inViewport() && e.mediaReady() && e.mediaCard()?.feedPreload === "visible-post"), n = r(() => t.value ? mt(e.item(), e.mediaIndex(), e.mediaSource()) : []), i = /* @__PURE__ */ new Map();
989
+ function Ct(e) {
990
+ let t = r(() => e.layout() === "masonry" && e.inViewport() && e.mediaReady() && e.mediaCard()?.feedPreload === "visible-post"), n = r(() => t.value ? _t(e.item(), e.mediaIndex(), e.mediaSource()) : []), i = /* @__PURE__ */ new Map();
979
991
  function a() {
980
992
  let e = new Map(n.value.map((e) => [e.key, e]));
981
993
  i.forEach((t, n) => {
982
994
  e.has(n) || (t(), i.delete(n));
983
995
  }), n.value.forEach((e) => {
984
- i.has(e.key) || i.set(e.key, yt(e));
996
+ i.has(e.key) || i.set(e.key, St(e));
985
997
  });
986
998
  }
987
999
  O(() => n.value.map(({ key: e }) => e).join("\n"), a, { immediate: !0 }), v(() => {
@@ -990,7 +1002,7 @@ function bt(e) {
990
1002
  }
991
1003
  //#endregion
992
1004
  //#region src/components/useMediaLoading.ts
993
- function xt(e) {
1005
+ function wt(e) {
994
1006
  let t = r(() => L(e.mediaType(), e.mediaSource())), n = r(() => e.layout() === "masonry" && e.fetchPriority() === "low" ? "lazy" : "eager"), i = r(() => e.layout() === "reel" && !e.active() ? "none" : e.fetchPriority() === "high" ? "auto" : e.layout() === "masonry" ? "none" : "metadata");
995
1007
  return O(i, (t, n) => {
996
1008
  n !== "none" || t === "none" || m(() => e.mediaElement.value?.load());
@@ -1002,7 +1014,7 @@ function xt(e) {
1002
1014
  }
1003
1015
  //#endregion
1004
1016
  //#region src/components/useMediaReadiness.ts
1005
- function St(e) {
1017
+ function Tt(e) {
1006
1018
  let t = w(null), n = w(null), i = w(0), a = w(0), o = w(!0), s = w(!1), c = w(!1), l = null, u = !1, d = r(() => c.value || s.value ? "error" : o.value ? "loading" : e.previewState());
1007
1019
  function f() {
1008
1020
  l !== null && clearTimeout(l), l = null;
@@ -1060,30 +1072,30 @@ function St(e) {
1060
1072
  }
1061
1073
  //#endregion
1062
1074
  //#region src/core/reelAudio.ts
1063
- var Ct = {
1075
+ var Et = {
1064
1076
  lastAudibleVolume: 1,
1065
1077
  muted: !1,
1066
1078
  volume: 1
1067
1079
  };
1068
- function wt(e, t) {
1080
+ function Dt(e, t) {
1069
1081
  return typeof e == "number" && Number.isFinite(e) ? Math.min(1, Math.max(0, e)) : t;
1070
1082
  }
1071
- function Tt(e, t = Ct) {
1072
- let n = wt(e?.volume, t.volume), r = wt(e?.lastAudibleVolume, n > 0 ? n : t.lastAudibleVolume);
1083
+ function Ot(e, t = Et) {
1084
+ let n = Dt(e?.volume, t.volume), r = Dt(e?.lastAudibleVolume, n > 0 ? n : t.lastAudibleVolume);
1073
1085
  return {
1074
- lastAudibleVolume: r > 0 ? r : Ct.lastAudibleVolume,
1086
+ lastAudibleVolume: r > 0 ? r : Et.lastAudibleVolume,
1075
1087
  muted: typeof e?.muted == "boolean" ? e.muted : n === 0 || t.muted,
1076
1088
  volume: n
1077
1089
  };
1078
1090
  }
1079
1091
  //#endregion
1080
1092
  //#region src/components/useMediaCardAudio.ts
1081
- function Et(e) {
1082
- let t = Tt(e.reelAudioState()), n = e.layout() === "reel" && e.reelAudioState(), r = w(n ? t.muted : e.mediaCard()?.videoMuted ?? e.layout() === "masonry"), i = w(n ? t.volume : 1), a = n ? t.lastAudibleVolume : 1;
1093
+ function kt(e) {
1094
+ let t = Ot(e.reelAudioState()), n = e.layout() === "reel" && e.reelAudioState(), r = w(n ? t.muted : e.mediaCard()?.videoMuted ?? e.layout() === "masonry"), i = w(n ? t.volume : 1), a = n ? t.lastAudibleVolume : 1;
1083
1095
  function o() {
1084
1096
  let t = e.mediaElement.value, n = e.reelAudioState();
1085
1097
  if (!t || e.layout() !== "reel" || !n) return;
1086
- let o = Tt(n);
1098
+ let o = Ot(n);
1087
1099
  a = o.lastAudibleVolume, i.value = o.volume, r.value = o.muted, t.volume = o.volume, t.muted = e.active() === !1 ? !0 : o.muted;
1088
1100
  }
1089
1101
  function s(e, t) {
@@ -1091,7 +1103,7 @@ function Et(e) {
1091
1103
  }
1092
1104
  function c(t) {
1093
1105
  if (e.layout() !== "reel") return;
1094
- let n = Tt({
1106
+ let n = Ot({
1095
1107
  lastAudibleVolume: a,
1096
1108
  muted: t.muted,
1097
1109
  volume: t.volume
@@ -1126,8 +1138,8 @@ function Et(e) {
1126
1138
  }
1127
1139
  //#endregion
1128
1140
  //#region src/components/useReelVideoActivity.ts
1129
- function Dt(e) {
1130
- let t = r(() => e.layout() !== "reel" || e.active() === !0), n = r(() => t.value ? e.mediaIsMuted.value : !0);
1141
+ function At(e) {
1142
+ let t = r(() => e.layout() === "reel" ? e.active() === !0 : e.inViewport()), n = r(() => t.value ? e.mediaIsMuted.value : !0);
1131
1143
  function i() {
1132
1144
  if (!t.value) {
1133
1145
  e.mediaElement.value?.pause(), e.mediaIsPlaying.value = !1;
@@ -1160,19 +1172,20 @@ function Dt(e) {
1160
1172
  }
1161
1173
  //#endregion
1162
1174
  //#region src/components/useTimedMediaCard.ts
1163
- function Ot(e) {
1175
+ function jt(e) {
1164
1176
  return Number.isFinite(e) ? Math.max(0, e) : 0;
1165
1177
  }
1166
- function kt(e) {
1167
- let t = w(0), n = w(0), r = w(!1), { apply: i, setVolume: a, sync: o, toggleMute: s, videoIsMuted: c, videoVolume: l } = Et({
1178
+ function Mt(e) {
1179
+ let t = w(0), n = w(0), r = w(!1), { apply: i, setVolume: a, sync: o, toggleMute: s, videoIsMuted: c, videoVolume: l } = kt({
1168
1180
  active: e.active,
1169
1181
  layout: e.layout,
1170
1182
  mediaCard: e.mediaCard,
1171
1183
  mediaElement: e.mediaElement,
1172
1184
  onChange: e.onAudioChange,
1173
1185
  reelAudioState: e.reelAudioState
1174
- }), { effectiveMuted: u, onPlaying: d, playbackAllowed: f } = Dt({
1186
+ }), { effectiveMuted: u, onPlaying: d, playbackAllowed: f } = At({
1175
1187
  active: e.active,
1188
+ inViewport: e.inViewport,
1176
1189
  layout: e.layout,
1177
1190
  mediaElement: e.mediaElement,
1178
1191
  mediaIsMuted: c,
@@ -1180,7 +1193,7 @@ function kt(e) {
1180
1193
  });
1181
1194
  function p(r) {
1182
1195
  let i = r?.currentTarget ?? e.mediaElement.value;
1183
- i && (t.value = Ot(i.currentTime), n.value = Ot(i.duration), o(i, f.value));
1196
+ i && (t.value = jt(i.currentTime), n.value = jt(i.duration), o(i, f.value));
1184
1197
  }
1185
1198
  function m(t) {
1186
1199
  i(), p(t), e.onReady(t);
@@ -1190,7 +1203,7 @@ function kt(e) {
1190
1203
  }
1191
1204
  function g(n) {
1192
1205
  let r = e.mediaElement.value;
1193
- !r || !Number.isFinite(n) || (r.currentTime = Math.min(Ot(r.duration), Math.max(0, n)), t.value = r.currentTime);
1206
+ !r || !Number.isFinite(n) || (r.currentTime = Math.min(jt(r.duration), Math.max(0, n)), t.value = r.currentTime);
1194
1207
  }
1195
1208
  async function _() {
1196
1209
  let t = e.mediaElement.value;
@@ -1228,7 +1241,7 @@ function kt(e) {
1228
1241
  }
1229
1242
  //#endregion
1230
1243
  //#region src/components/MediaCard.vue?vue&type=script&setup=true&lang.ts
1231
- var At = [
1244
+ var Nt = [
1232
1245
  "data-post-id",
1233
1246
  "data-media-index",
1234
1247
  "aria-hidden",
@@ -1236,29 +1249,29 @@ var At = [
1236
1249
  "inert",
1237
1250
  "role",
1238
1251
  "tabindex"
1239
- ], jt = { class: "media-card-content" }, Mt = ["data-media-direction"], Nt = ["data-media-index"], Pt = {
1252
+ ], Pt = { class: "media-card-content" }, Ft = ["data-media-direction"], It = ["data-media-index"], Lt = {
1240
1253
  key: 0,
1241
1254
  "data-test": "media-loading",
1242
1255
  class: "media-loading",
1243
1256
  "aria-hidden": "true"
1244
- }, Ft = [
1257
+ }, Rt = [
1245
1258
  "data-source-generation",
1246
1259
  "src",
1247
1260
  "autoplay",
1248
1261
  "loop",
1249
1262
  "muted",
1250
1263
  "preload"
1251
- ], It = ["aria-label", "disabled"], Lt = [
1264
+ ], zt = ["aria-label", "disabled"], Bt = [
1252
1265
  "src",
1253
1266
  "width",
1254
1267
  "height",
1255
1268
  "fetchpriority",
1256
1269
  "loading"
1257
- ], Rt = {
1270
+ ], Vt = {
1258
1271
  key: 1,
1259
1272
  class: "media-audio-fallback",
1260
1273
  "aria-hidden": "true"
1261
- }, zt = [
1274
+ }, Ht = [
1262
1275
  "data-source-generation",
1263
1276
  "src",
1264
1277
  "width",
@@ -1267,14 +1280,14 @@ var At = [
1267
1280
  "loop",
1268
1281
  "muted",
1269
1282
  "preload"
1270
- ], Bt = [
1283
+ ], Ut = [
1271
1284
  "data-source-generation",
1272
1285
  "src",
1273
1286
  "width",
1274
1287
  "height",
1275
1288
  "fetchpriority",
1276
1289
  "loading"
1277
- ], Vt = ["aria-label"], Ht = ["aria-label"], Ut = ["aria-label"], Wt = /* @__PURE__ */ d({
1290
+ ], Wt = ["aria-label"], Gt = ["aria-label"], Kt = ["aria-label"], qt = /* @__PURE__ */ d({
1278
1291
  __name: "MediaCard",
1279
1292
  props: {
1280
1293
  active: { type: Boolean },
@@ -1313,14 +1326,14 @@ var At = [
1313
1326
  function f(e = !1, t = "pointer") {
1314
1327
  e && d("activate", t);
1315
1328
  }
1316
- let p = r(() => V(l.item)), g = r(() => H(l.item, l.mediaIndex)), v = r(() => U(l.item, g.value)), y = r(() => z(v.value, l.mediaSource ?? "preview")), x = r(() => I(v.value.type, v.value.src)), S = r(() => x.value === "audio"), C = r(() => ee(v.value, l.mediaSource ?? "preview")), T = r(() => S.value ? C.value : y.value), D = r(() => T.value.src), M = r(() => I(T.value.type, T.value.src)), N = r(() => y.value.width), P = r(() => y.value.height), F = r(() => B(v.value)), L = w(!1), R = r(() => L.value ? null : F.value), { effectivePreviewState: W, failSourceAttempt: G, imageElement: te, markSourceReady: K, noteSourceActivity: q, retrySource: ne, retrying: J, sourceGeneration: re, mediaElement: Y } = St({
1329
+ let p = r(() => H(l.item)), g = r(() => U(l.item, l.mediaIndex)), v = r(() => ee(l.item, g.value)), y = r(() => z(v.value, l.mediaSource ?? "preview")), x = r(() => I(v.value.type, v.value.src)), S = r(() => x.value === "audio"), C = r(() => V(v.value, l.mediaSource ?? "preview")), T = r(() => S.value ? C.value : y.value), D = r(() => T.value.src), M = r(() => I(T.value.type, T.value.src)), N = r(() => y.value.width), P = r(() => y.value.height), F = r(() => B(v.value)), L = w(!1), R = r(() => L.value ? null : F.value), { effectivePreviewState: W, failSourceAttempt: G, imageElement: te, markSourceReady: K, noteSourceActivity: q, retrySource: ne, retrying: re, sourceGeneration: J, mediaElement: ie } = Tt({
1317
1330
  identity: () => `${l.item.postId}:${g.value}:${l.mediaSource ?? "preview"}:${D.value}:${M.value ?? ""}`,
1318
1331
  mediaIndex: () => g.value,
1319
1332
  onError: (e) => d("error", e),
1320
1333
  onReady: (e) => d("ready", e),
1321
1334
  previewState: () => l.previewState
1322
1335
  });
1323
- bt({
1336
+ Ct({
1324
1337
  inViewport: () => l.inViewport === !0,
1325
1338
  item: () => l.item,
1326
1339
  layout: () => l.layout,
@@ -1329,11 +1342,12 @@ var At = [
1329
1342
  mediaReady: () => W.value === "ready",
1330
1343
  mediaSource: () => l.mediaSource ?? "preview"
1331
1344
  });
1332
- let { currentTime: ie, duration: ae, effectiveMuted: X, isMuted: oe, isPlaying: se, onEnded: Z, onLoadedMetadata: ce, onPlaying: le, playbackAllowed: ue, seek: de, setVolume: fe, sync: Q, toggleMute: pe, togglePlayback: me, volume: he } = kt({
1345
+ let { currentTime: ae, duration: oe, effectiveMuted: Y, isMuted: se, isPlaying: ce, onEnded: X, onLoadedMetadata: Z, onPlaying: le, playbackAllowed: ue, seek: de, setVolume: fe, sync: Q, toggleMute: pe, togglePlayback: me, volume: he } = Mt({
1333
1346
  active: () => l.active,
1347
+ inViewport: () => l.inViewport === !0,
1334
1348
  layout: () => l.layout,
1335
1349
  mediaCard: () => l.mediaCard,
1336
- mediaElement: Y,
1350
+ mediaElement: ie,
1337
1351
  onAudioChange: (e) => d("reelAudioChange", e),
1338
1352
  onEnded: () => d("ended", g.value),
1339
1353
  onReady: K,
@@ -1342,18 +1356,18 @@ var At = [
1342
1356
  function _e(e) {
1343
1357
  return e.detail === 0 ? "keyboard" : "pointer";
1344
1358
  }
1345
- let { change: ve, direction: ye, onTouchEnd: be, onTouchStart: xe, onWheel: Se } = ct({
1359
+ let { change: ve, direction: ye, onTouchEnd: be, onTouchStart: xe, onWheel: Se } = dt({
1346
1360
  item: () => l.item,
1347
1361
  layout: () => l.layout,
1348
1362
  mediaIndex: () => g.value,
1349
1363
  onChange: (e) => d("mediaChange", e)
1350
- }), { imageLoading: Ce, mediaIsTimed: we, timedMediaPreload: Te } = xt({
1364
+ }), { imageLoading: Ce, mediaIsTimed: we, timedMediaPreload: Te } = wt({
1351
1365
  active: () => l.active,
1352
1366
  fetchPriority: () => l.fetchPriority,
1353
1367
  layout: () => l.layout,
1354
1368
  mediaSource: () => D.value,
1355
1369
  mediaType: () => M.value,
1356
- mediaElement: Y
1370
+ mediaElement: ie
1357
1371
  }), Ee = r(() => l.layout === "reel" && l.stationaryReelControls === !0), De = r(() => we.value && (!S.value || l.layout === "reel") && W.value === "ready" && (!Ee.value || !!(l.active && l.reelControlsTarget))), Oe = r(() => `${l.item.postId}:${g.value}:${D.value}`);
1358
1372
  function ke(e) {
1359
1373
  l.layout === "reel" && (e.stopPropagation(), me());
@@ -1380,14 +1394,14 @@ var At = [
1380
1394
  }]),
1381
1395
  style: _(e.itemStyle),
1382
1396
  "aria-hidden": e.leaving || void 0,
1383
- "aria-busy": E(W) === "loading" || E(J),
1397
+ "aria-busy": E(W) === "loading" || E(re),
1384
1398
  inert: e.leaving || void 0,
1385
1399
  role: e.interactive && !e.leaving && !ge.value ? "button" : void 0,
1386
1400
  tabindex: e.interactive && !e.leaving && !ge.value ? 0 : void 0,
1387
1401
  onClick: i[34] ||= (t) => f(e.interactive && !ge.value, _e(t)),
1388
1402
  onKeydown: [i[35] ||= A((t) => f(e.interactive && !ge.value, "keyboard"), ["enter"]), i[36] ||= A(j((t) => f(e.interactive && !ge.value, "keyboard"), ["prevent"]), ["space"])]
1389
- }, [c("div", jt, [
1390
- e.cardHeader ? (b(), a(Ue, {
1403
+ }, [c("div", Pt, [
1404
+ e.cardHeader ? (b(), a(Ke, {
1391
1405
  key: 0,
1392
1406
  index: e.index,
1393
1407
  item: e.item,
@@ -1418,20 +1432,20 @@ var At = [
1418
1432
  onTouchendPassive: i[33] ||= (...e) => E(be) && E(be)(...e)
1419
1433
  }, [
1420
1434
  u(n, {
1421
- css: !E(J),
1435
+ css: !E(re),
1422
1436
  name: `media-slide-${E(ye)}`
1423
1437
  }, {
1424
1438
  default: k(() => [(b(), s("div", {
1425
- key: `${e.item.postId}:${v.value.src}:${e.mediaSource ?? "preview"}:${E(re)}`,
1439
+ key: `${e.item.postId}:${v.value.src}:${e.mediaSource ?? "preview"}:${E(J)}`,
1426
1440
  class: "media-card-frame",
1427
1441
  "data-media-index": g.value
1428
1442
  }, [
1429
- E(W) === "loading" ? (b(), s("div", Pt, [...i[37] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : E(W) === "error" ? (b(), a(qe, {
1443
+ E(W) === "loading" ? (b(), s("div", Lt, [...i[37] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : E(W) === "error" ? (b(), a(Xe, {
1430
1444
  key: 1,
1431
1445
  component: e.mediaCard?.error?.component,
1432
- label: E(He)(D.value),
1433
- retrying: E(J),
1434
- status: E(Ve)(D.value),
1446
+ label: E(Ge)(D.value),
1447
+ retrying: E(re),
1448
+ status: E(We)(D.value),
1435
1449
  onRetry: E(ne)
1436
1450
  }, null, 8, [
1437
1451
  "component",
@@ -1443,15 +1457,15 @@ var At = [
1443
1457
  S.value && e.layout === "reel" ? (b(), s("audio", {
1444
1458
  key: 2,
1445
1459
  ref_key: "mediaElement",
1446
- ref: Y,
1447
- "data-source-generation": E(re),
1460
+ ref: ie,
1461
+ "data-source-generation": E(J),
1448
1462
  class: "media-audio-element",
1449
1463
  src: D.value,
1450
1464
  autoplay: E(ue),
1451
1465
  loop: !e.advanceOnMediaEnd,
1452
- muted: E(X),
1466
+ muted: E(Y),
1453
1467
  preload: E(Te),
1454
- onLoadedmetadata: i[0] ||= (...e) => E(ce) && E(ce)(...e),
1468
+ onLoadedmetadata: i[0] ||= (...e) => E(Z) && E(Z)(...e),
1455
1469
  onProgress: i[1] ||= (...e) => E(q) && E(q)(...e),
1456
1470
  onLoadeddata: i[2] ||= (...e) => E(q) && E(q)(...e),
1457
1471
  onCanplay: i[3] ||= (...e) => E(q) && E(q)(...e),
@@ -1459,15 +1473,15 @@ var At = [
1459
1473
  onTimeupdate: i[5] ||= (...e) => E(Q) && E(Q)(...e),
1460
1474
  onVolumechange: i[6] ||= (...e) => E(Q) && E(Q)(...e),
1461
1475
  onPlaying: i[7] ||= (...e) => E(le) && E(le)(...e),
1462
- onPause: i[8] ||= (e) => se.value = !1,
1463
- onEnded: i[9] ||= (...e) => E(Z) && E(Z)(...e),
1476
+ onPause: i[8] ||= (e) => ce.value = !1,
1477
+ onEnded: i[9] ||= (...e) => E(X) && E(X)(...e),
1464
1478
  onError: i[10] ||= (...e) => E(G) && E(G)(...e)
1465
- }, null, 40, Ft)) : o("", !0),
1479
+ }, null, 40, Rt)) : o("", !0),
1466
1480
  S.value ? (b(), s("button", {
1467
1481
  key: 3,
1468
1482
  type: "button",
1469
1483
  class: h(["media-audio-artwork media-preview", { "media-preview--ready": E(W) === "ready" }]),
1470
- "aria-label": e.layout === "reel" ? E(se) ? "Pause audio" : "Play audio" : "Audio",
1484
+ "aria-label": e.layout === "reel" ? E(ce) ? "Pause audio" : "Play audio" : "Audio",
1471
1485
  disabled: e.layout !== "reel",
1472
1486
  onClick: ke
1473
1487
  }, [R.value ? (b(), s("img", {
@@ -1482,14 +1496,14 @@ var At = [
1482
1496
  loading: E(Ce),
1483
1497
  onLoad: i[11] ||= (t) => e.layout === "masonry" && E(K)(t),
1484
1498
  onError: Ae
1485
- }, null, 40, Lt)) : (b(), s("span", Rt, [u(E(Fe), {
1499
+ }, null, 40, Bt)) : (b(), s("span", Vt, [u(E(Re), {
1486
1500
  size: 64,
1487
1501
  "stroke-width": 1.5
1488
- })]))], 10, It)) : E(we) ? (b(), s("video", {
1502
+ })]))], 10, zt)) : E(we) ? (b(), s("video", {
1489
1503
  key: 4,
1490
1504
  ref_key: "mediaElement",
1491
- ref: Y,
1492
- "data-source-generation": E(re),
1505
+ ref: ie,
1506
+ "data-source-generation": E(J),
1493
1507
  class: h(["media-preview", {
1494
1508
  "media-preview--ready": E(W) === "ready",
1495
1509
  "media-preview--reel-video": e.layout === "reel"
@@ -1499,10 +1513,10 @@ var At = [
1499
1513
  height: P.value ?? void 0,
1500
1514
  autoplay: E(ue),
1501
1515
  loop: !e.advanceOnMediaEnd,
1502
- muted: E(X),
1516
+ muted: E(Y),
1503
1517
  playsinline: "",
1504
1518
  preload: E(Te),
1505
- onLoadedmetadata: i[12] ||= (...e) => E(ce) && E(ce)(...e),
1519
+ onLoadedmetadata: i[12] ||= (...e) => E(Z) && E(Z)(...e),
1506
1520
  onProgress: i[13] ||= (...e) => E(q) && E(q)(...e),
1507
1521
  onLoadeddata: i[14] ||= (...e) => E(q) && E(q)(...e),
1508
1522
  onCanplay: i[15] ||= (...e) => E(q) && E(q)(...e),
@@ -1510,15 +1524,15 @@ var At = [
1510
1524
  onTimeupdate: i[17] ||= (...e) => E(Q) && E(Q)(...e),
1511
1525
  onVolumechange: i[18] ||= (...e) => E(Q) && E(Q)(...e),
1512
1526
  onPlaying: i[19] ||= (...e) => E(le) && E(le)(...e),
1513
- onPause: i[20] ||= (e) => se.value = !1,
1514
- onEnded: i[21] ||= (...e) => E(Z) && E(Z)(...e),
1527
+ onPause: i[20] ||= (e) => ce.value = !1,
1528
+ onEnded: i[21] ||= (...e) => E(X) && E(X)(...e),
1515
1529
  onClick: ke,
1516
1530
  onError: i[22] ||= (...e) => E(G) && E(G)(...e)
1517
- }, null, 42, zt)) : S.value ? o("", !0) : (b(), s("img", {
1531
+ }, null, 42, Ht)) : S.value ? o("", !0) : (b(), s("img", {
1518
1532
  key: 5,
1519
1533
  ref_key: "imageElement",
1520
1534
  ref: te,
1521
- "data-source-generation": E(re),
1535
+ "data-source-generation": E(J),
1522
1536
  class: h(["media-preview", { "media-preview--ready": E(W) === "ready" }]),
1523
1537
  src: D.value,
1524
1538
  width: N.value ?? void 0,
@@ -1529,11 +1543,11 @@ var At = [
1529
1543
  loading: E(Ce),
1530
1544
  onLoad: i[23] ||= (...e) => E(K) && E(K)(...e),
1531
1545
  onError: i[24] ||= (...e) => E(G) && E(G)(...e)
1532
- }, null, 42, Bt))
1533
- ], 8, Nt))]),
1546
+ }, null, 42, Ut))
1547
+ ], 8, It))]),
1534
1548
  _: 1
1535
1549
  }, 8, ["css", "name"]),
1536
- u(it, {
1550
+ u(st, {
1537
1551
  item: e.item,
1538
1552
  "media-card": e.mediaCard,
1539
1553
  "media-index": g.value,
@@ -1553,15 +1567,15 @@ var At = [
1553
1567
  name: "vibe-reel-media-controls",
1554
1568
  css: Ee.value
1555
1569
  }, {
1556
- default: k(() => [De.value ? (b(), a(nt, {
1570
+ default: k(() => [De.value ? (b(), a(at, {
1557
1571
  key: Oe.value,
1558
- "current-time": E(ie),
1572
+ "current-time": E(ae),
1559
1573
  "data-control-post-id": Ee.value ? e.item.postId : void 0,
1560
- duration: E(ae),
1574
+ duration: E(oe),
1561
1575
  layout: e.layout,
1562
1576
  "media-type": S.value ? "audio" : "video",
1563
- muted: E(oe),
1564
- playing: E(se),
1577
+ muted: E(se),
1578
+ playing: E(ce),
1565
1579
  volume: E(he),
1566
1580
  onSeek: E(de),
1567
1581
  onToggleMute: E(pe),
@@ -1593,13 +1607,13 @@ var At = [
1593
1607
  "aria-label": `Previous media for post ${e.item.postId}`,
1594
1608
  onClick: i[25] ||= j((e) => E(ve)(g.value - 1, e), ["stop"]),
1595
1609
  onKeydown: i[26] ||= j(() => {}, ["stop"])
1596
- }, [u(E(Ne), { size: 20 })], 40, Vt), c("button", {
1610
+ }, [u(E(Ie), { size: 20 })], 40, Wt), c("button", {
1597
1611
  type: "button",
1598
1612
  class: "media-carousel-control media-carousel-control--next",
1599
1613
  "aria-label": `Next media for post ${e.item.postId}`,
1600
1614
  onClick: i[27] ||= j((e) => E(ve)(g.value + 1, e), ["stop"]),
1601
1615
  onKeydown: i[28] ||= j(() => {}, ["stop"])
1602
- }, [u(E(Pe), { size: 20 })], 40, Ht)], 2)) : o("", !0),
1616
+ }, [u(E(Le), { size: 20 })], 40, Gt)], 2)) : o("", !0),
1603
1617
  ge.value ? (b(), s("button", {
1604
1618
  key: 1,
1605
1619
  class: "media-card-activator",
@@ -1607,9 +1621,9 @@ var At = [
1607
1621
  "aria-label": `Open post ${e.item.postId}`,
1608
1622
  onClick: i[29] ||= j((e) => r.$emit("activate", _e(e)), ["stop"]),
1609
1623
  onKeydown: i[30] ||= j(() => {}, ["stop"])
1610
- }, null, 40, Ut)) : o("", !0)
1611
- ], 42, Mt),
1612
- e.cardFooter ? (b(), a(Ue, {
1624
+ }, null, 40, Kt)) : o("", !0)
1625
+ ], 42, Ft),
1626
+ e.cardFooter ? (b(), a(Ke, {
1613
1627
  key: 1,
1614
1628
  index: e.index,
1615
1629
  item: e.item,
@@ -1632,12 +1646,44 @@ var At = [
1632
1646
  "style",
1633
1647
  "total"
1634
1648
  ])) : o("", !0)
1635
- ])], 46, At));
1649
+ ])], 46, Nt));
1650
+ }
1651
+ });
1652
+ //#endregion
1653
+ //#region src/components/useMasonryMediaVisibility.ts
1654
+ function Jt(e) {
1655
+ function t(t) {
1656
+ return t.flatMap((t) => {
1657
+ let n = e.items()[t];
1658
+ if (!n) return [];
1659
+ let r = e.mediaIndices().get(n.postId) ?? 0, i = W(n.postId, r);
1660
+ return e.previewStates().get(i) === "ready" ? [{
1661
+ key: i,
1662
+ mediaIndex: r,
1663
+ postId: n.postId
1664
+ }] : [];
1665
+ });
1666
+ }
1667
+ function n(e, n) {
1668
+ let r = /* @__PURE__ */ new Set();
1669
+ O(() => t(e()), (e) => {
1670
+ let t = new Set(e.map(({ key: e }) => e));
1671
+ e.forEach(({ key: e, mediaIndex: t, postId: i }) => {
1672
+ r.has(e) || n(i, t);
1673
+ }), r = t;
1674
+ }, {
1675
+ immediate: !0,
1676
+ flush: "post"
1677
+ });
1636
1678
  }
1637
- }), Gt = { class: "masonry-feed-shell" }, Kt = ["aria-hidden", "inert"], qt = {
1679
+ n(e.visibleIndices, e.onVisible), n(e.fullyVisibleIndices, e.onFullyVisible);
1680
+ }
1681
+ //#endregion
1682
+ //#region src/components/MasonryFeed.vue?vue&type=script&setup=true&lang.ts
1683
+ var Yt = { class: "masonry-feed-shell" }, Xt = ["aria-hidden", "inert"], Zt = {
1638
1684
  key: 0,
1639
1685
  class: "masonry-feed-status-overlay"
1640
- }, Jt = 6, Yt = 12, Xt = 250, Zt = /* @__PURE__ */ d({
1686
+ }, Qt = 6, $t = 12, en = 250, tn = /* @__PURE__ */ d({
1641
1687
  __name: "MasonryFeed",
1642
1688
  props: {
1643
1689
  enteringPostIds: {},
@@ -1667,6 +1713,7 @@ var At = [
1667
1713
  emits: [
1668
1714
  "activate",
1669
1715
  "error",
1716
+ "fullyVisible",
1670
1717
  "loadMore",
1671
1718
  "mediaChange",
1672
1719
  "ready",
@@ -1674,97 +1721,95 @@ var At = [
1674
1721
  "visible"
1675
1722
  ],
1676
1723
  setup(t, { expose: n, emit: i }) {
1677
- let l = 0, d = t, f = i, p = w(null), m = `vibe-masonry-${D()}`, g = w(null), y = w(0), x = w(Jt), C = w(0), T = w(0), k = w(0), A = w([]), j = w([]), M = 0, N = null, P = null, F = null, I = null, L = r(() => ue(d.items, y.value, {
1724
+ let l = 0, d = t, f = i, p = w(null), m = `vibe-masonry-${D()}`, g = w(null), y = w(0), x = w(Qt), C = w(0), T = w(0), k = w(0), A = w([]), j = w([]), M = w([]), N = 0, P = null, F = null, I = null, L = null, R = r(() => Q(d.items, y.value, {
1678
1725
  additionalHeight: (d.cardHeader?.height ?? 0) + (d.cardFooter?.height ?? 0),
1679
1726
  gap: x.value,
1680
- minColumnWidth: pe(d.masonry)
1681
- })), R = r(() => {
1727
+ minColumnWidth: ge(d.masonry)
1728
+ })), z = r(() => {
1682
1729
  if (d.leavingPostIds.size === 0) return null;
1683
1730
  let e = d.items.flatMap((e, t) => d.leavingPostIds.has(e.postId) ? [] : [{
1684
1731
  index: t,
1685
1732
  item: e
1686
- }]), t = ue(e.map(({ item: e }) => e), y.value, {
1733
+ }]), t = Q(e.map(({ item: e }) => e), y.value, {
1687
1734
  additionalHeight: (d.cardHeader?.height ?? 0) + (d.cardFooter?.height ?? 0),
1688
1735
  gap: x.value,
1689
- minColumnWidth: pe(d.masonry)
1736
+ minColumnWidth: ge(d.masonry)
1690
1737
  });
1691
1738
  return {
1692
1739
  indices: e.map(({ index: e }) => e),
1693
1740
  layout: t,
1694
1741
  positions: new Map(e.map(({ item: e }, n) => [e.postId, t.items[n]]))
1695
1742
  };
1696
- }), z = r(() => {
1697
- let e = L.value, t = R.value;
1743
+ }), B = r(() => {
1744
+ let e = R.value, t = z.value;
1698
1745
  return t ? {
1699
1746
  ...t.layout,
1700
1747
  items: d.items.map((n, r) => d.leavingPostIds.has(n.postId) ? e.items[r] : t.positions.get(n.postId) ?? e.items[r])
1701
1748
  } : e;
1702
- }), B = r(() => de(L.value.items)), ee = r(() => {
1703
- let e = R.value;
1704
- return e ? de(e.layout.items, e.indices) : null;
1705
- }), V = r(() => Math.max(T.value, d.leavingPostIds.size === 0 ? z.value.height : L.value.height)), H = r(() => ({ height: `${V.value}px` })), U = r(() => !d.infiniteScroll || C.value > 0 && k.value + z.value.height <= C.value + 1), G = r(() => new Set(A.value)), te = r(() => j.value.flatMap((e) => {
1749
+ }), V = r(() => pe(R.value.items)), H = r(() => {
1750
+ let e = z.value;
1751
+ return e ? pe(e.layout.items, e.indices) : null;
1752
+ }), U = r(() => Math.max(T.value, d.leavingPostIds.size === 0 ? B.value.height : R.value.height)), ee = r(() => ({ height: `${U.value}px` })), G = r(() => !d.infiniteScroll || C.value > 0 && k.value + B.value.height <= C.value + 1), te = r(() => new Set(j.value)), K = r(() => M.value.flatMap((e) => {
1706
1753
  let t = d.items[e];
1707
1754
  return t ? [{
1708
- fetchPriority: G.value.has(e) ? "high" : "low",
1755
+ fetchPriority: te.value.has(e) ? "high" : "low",
1709
1756
  index: e,
1710
1757
  item: t
1711
1758
  }] : [];
1712
1759
  }));
1713
- function K(e, t) {
1760
+ function q(e, t) {
1714
1761
  return [...new Set([...e, ...t])].sort((e, t) => e - t);
1715
1762
  }
1716
- function q(e, t) {
1763
+ function ne(e, t) {
1717
1764
  return e.length === t.length && e.every((e, n) => e === t[n]);
1718
1765
  }
1719
- function ne(e) {
1766
+ function re(e) {
1720
1767
  let t = {
1721
- scrollTop: M - k.value,
1768
+ scrollTop: N - k.value,
1722
1769
  viewportHeight: C.value
1723
- }, n = ee.value, r = Q(n ?? B.value, {
1770
+ }, n = H.value, r = he(n ?? V.value, {
1724
1771
  ...t,
1725
1772
  overscan: e
1726
1773
  }).indices;
1727
- return K(r, d.leavingPostIds.size === 0 ? [] : Q(B.value, {
1774
+ return q(r, d.leavingPostIds.size === 0 ? [] : he(V.value, {
1728
1775
  ...t,
1729
1776
  overscan: e
1730
1777
  }).indices);
1731
1778
  }
1732
1779
  function J() {
1733
- let e = ne(0), t = ne(me(d.masonry, C.value));
1734
- q(A.value, e) || (A.value = e), q(j.value, t) || (j.value = t);
1780
+ let e = re(0), t = re(_e(d.masonry, C.value));
1781
+ ne(j.value, e) || (j.value = e);
1782
+ let n = fe(B.value.items, e.filter((e) => {
1783
+ let t = d.items[e];
1784
+ return t && !d.leavingPostIds.has(t.postId);
1785
+ }), {
1786
+ scrollTop: N - k.value,
1787
+ viewportHeight: C.value
1788
+ });
1789
+ ne(A.value, n) || (A.value = n), ne(M.value, t) || (M.value = t);
1735
1790
  }
1736
- function re() {
1737
- if (I !== null) return;
1738
- I = -1;
1791
+ function ie() {
1792
+ if (L !== null) return;
1793
+ L = -1;
1739
1794
  let e = requestAnimationFrame(() => {
1740
- I = null, J();
1795
+ L = null, J();
1741
1796
  });
1742
- I !== null && (I = e);
1797
+ L !== null && (L = e);
1743
1798
  }
1744
- let Y = /* @__PURE__ */ new Set();
1745
- O(() => [...G.value].flatMap((e) => {
1746
- let t = d.items[e];
1747
- if (!t) return [];
1748
- let n = d.mediaIndices.get(t.postId) ?? 0, r = W(t.postId, n);
1749
- return d.previewStates.get(r) === "ready" ? [{
1750
- key: r,
1751
- mediaIndex: n,
1752
- postId: t.postId
1753
- }] : [];
1754
- }), (e) => {
1755
- let t = new Set(e.map(({ key: e }) => e));
1756
- e.forEach(({ key: e, mediaIndex: t, postId: n }) => {
1757
- Y.has(e) || f("visible", n, t);
1758
- }), Y = t;
1759
- }, {
1760
- immediate: !0,
1761
- flush: "post"
1799
+ Jt({
1800
+ fullyVisibleIndices: () => A.value,
1801
+ items: () => d.items,
1802
+ mediaIndices: () => d.mediaIndices,
1803
+ onFullyVisible: (e, t) => f("fullyVisible", e, t),
1804
+ onVisible: (e, t) => f("visible", e, t),
1805
+ previewStates: () => d.previewStates,
1806
+ visibleIndices: () => j.value
1762
1807
  });
1763
- function ae(e) {
1764
- let t = z.value.items[e], n = d.items[e]?.postId;
1808
+ function oe(e) {
1809
+ let t = B.value.items[e], n = d.items[e]?.postId;
1765
1810
  if (!t) return {};
1766
1811
  let r = n !== void 0 && d.enteringPostIds.has(n), i = n !== void 0 && d.leavingPostIds.has(n), a = r || i ? le({
1767
- containerHeight: Math.max(T.value, L.value.height),
1812
+ containerHeight: Math.max(T.value, R.value.height),
1768
1813
  gap: x.value
1769
1814
  }) : 0, o = n === void 0 ? 0 : i ? d.removalDelays.get(n) ?? 0 : r ? d.entryDelays.get(n) ?? 0 : 0;
1770
1815
  return {
@@ -1774,52 +1819,52 @@ var At = [
1774
1819
  transform: `translate3d(${t.x}px, ${t.y + a}px, 0)`
1775
1820
  };
1776
1821
  }
1777
- function X() {
1822
+ function Y() {
1778
1823
  let e = p.value;
1779
1824
  if (!e) return;
1780
- M = e.scrollTop, C.value = e.clientHeight;
1825
+ N = e.scrollTop, C.value = e.clientHeight;
1781
1826
  let t = e.ownerDocument.defaultView?.getComputedStyle(e), n = (Number.parseFloat(t?.paddingTop ?? "") || 0) + (Number.parseFloat(t?.paddingBottom ?? "") || 0);
1782
1827
  T.value = Math.max(0, e.clientHeight - n);
1783
1828
  let r = g.value;
1784
1829
  r && (k.value = r.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop, J());
1785
1830
  }
1786
- function oe(e) {
1831
+ function se(e) {
1787
1832
  let t = e.ownerDocument.documentElement.clientWidth;
1788
- y.value = e.clientWidth, x.value = Math.min(Yt, Math.max(Jt, t * .0075)), X();
1833
+ y.value = e.clientWidth, x.value = Math.min($t, Math.max(Qt, t * .0075)), Y();
1789
1834
  }
1790
- function Z(e) {
1835
+ function X(e) {
1791
1836
  let t = e.currentTarget;
1792
- t && (M = t.scrollTop, re(), Date.now() >= l && !d.loadMoreLocked && d.infiniteScroll && se(t) && f("loadMore"));
1837
+ t && (N = t.scrollTop, ie(), Date.now() >= l && !d.loadMoreLocked && d.infiniteScroll && ce(t) && f("loadMore"));
1793
1838
  }
1794
- function ce() {
1839
+ function Z() {
1795
1840
  let e = p.value;
1796
- Date.now() >= l && !d.loadMoreLocked && e && se(e) && f("loadMore");
1841
+ Date.now() >= l && !d.loadMoreLocked && e && ce(e) && f("loadMore");
1797
1842
  }
1798
1843
  O(() => d.items.length, (e, t) => {
1799
- e > 0 && e < t && (l = Date.now() + Xt);
1844
+ e > 0 && e < t && (l = Date.now() + en);
1800
1845
  });
1801
- function fe() {
1846
+ function ue() {
1802
1847
  return p.value;
1803
1848
  }
1804
1849
  return O(g, (e) => {
1805
- N?.disconnect(), N = null, F !== null && cancelAnimationFrame(F), e && (oe(e), !(typeof ResizeObserver > "u") && (N = new ResizeObserver(([t]) => {
1850
+ P?.disconnect(), P = null, I !== null && cancelAnimationFrame(I), e && (se(e), !(typeof ResizeObserver > "u") && (P = new ResizeObserver(([t]) => {
1806
1851
  let n = t?.contentRect.width ?? e.clientWidth;
1807
- Math.abs(n - y.value) < .5 || (F = requestAnimationFrame(() => {
1808
- F = null, oe(e);
1852
+ Math.abs(n - y.value) < .5 || (I = requestAnimationFrame(() => {
1853
+ I = null, se(e);
1809
1854
  }));
1810
- }), N.observe(e)));
1855
+ }), P.observe(e)));
1811
1856
  }), O(p, (e) => {
1812
- P?.disconnect(), P = null, e && (X(), !(typeof ResizeObserver > "u") && (P = new ResizeObserver(X), P.observe(e)));
1857
+ F?.disconnect(), F = null, e && (Y(), !(typeof ResizeObserver > "u") && (F = new ResizeObserver(Y), F.observe(e)));
1813
1858
  }), O([
1814
- L,
1815
- z,
1859
+ R,
1860
+ B,
1816
1861
  () => d.masonry
1817
1862
  ], J, { flush: "post" }), v(() => {
1818
- N?.disconnect(), P?.disconnect(), F !== null && cancelAnimationFrame(F), I !== null && cancelAnimationFrame(I);
1863
+ P?.disconnect(), F?.disconnect(), I !== null && cancelAnimationFrame(I), L !== null && cancelAnimationFrame(L);
1819
1864
  }), n({
1820
- getScrollElement: fe,
1821
- loadIfNearBottom: ce
1822
- }), (n, r) => (b(), s("div", Gt, [
1865
+ getScrollElement: ue,
1866
+ loadIfNearBottom: Z
1867
+ }), (n, r) => (b(), s("div", Yt, [
1823
1868
  c("main", {
1824
1869
  id: m,
1825
1870
  ref_key: "galleryElement",
@@ -1828,14 +1873,14 @@ var At = [
1828
1873
  "data-layout-mode": "masonry",
1829
1874
  "aria-hidden": t.suspended || void 0,
1830
1875
  inert: t.suspended || void 0,
1831
- onScrollPassive: Z
1876
+ onScrollPassive: X
1832
1877
  }, [c("section", {
1833
1878
  ref_key: "masonryElement",
1834
1879
  ref: g,
1835
1880
  class: h(["masonry", { "masonry--ready": y.value > 0 }]),
1836
- style: _(H.value),
1881
+ style: _(ee.value),
1837
1882
  "aria-label": "Media gallery"
1838
- }, [(b(!0), s(e, null, S(te.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(Wt, {
1883
+ }, [(b(!0), s(e, null, S(K.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(qt, {
1839
1884
  key: n.postId,
1840
1885
  class: "masonry-item",
1841
1886
  entering: t.enteringPostIds.has(n.postId),
@@ -1844,10 +1889,10 @@ var At = [
1844
1889
  "card-footer": t.cardFooter,
1845
1890
  "card-header": t.cardHeader,
1846
1891
  "media-card": t.mediaCard,
1847
- "in-viewport": G.value.has(r),
1892
+ "in-viewport": te.value.has(r),
1848
1893
  index: r,
1849
1894
  item: n,
1850
- "item-style": ae(r),
1895
+ "item-style": oe(r),
1851
1896
  interactive: "",
1852
1897
  layout: "masonry",
1853
1898
  "loaded-count": t.items.length,
@@ -1877,8 +1922,8 @@ var At = [
1877
1922
  "onMediaChange",
1878
1923
  "onReady",
1879
1924
  "onError"
1880
- ]))), 128))], 6)], 42, Kt),
1881
- t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && U.value || !t.hasNext && t.canRetryEnd ? (b(), s("div", qt, [u(ie, {
1925
+ ]))), 128))], 6)], 42, Xt),
1926
+ t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && G.value || !t.hasNext && t.canRetryEnd ? (b(), s("div", Zt, [u(ae, {
1882
1927
  actions: t.feedFooterActions,
1883
1928
  "can-retry-end": t.canRetryEnd,
1884
1929
  "feed-footer": t.feedFooter,
@@ -1886,7 +1931,7 @@ var At = [
1886
1931
  "has-next": t.hasNext,
1887
1932
  "is-loading": t.isLoadingMore,
1888
1933
  "load-more-locked": t.loadMoreLocked,
1889
- "show-load-more": U.value,
1934
+ "show-load-more": G.value,
1890
1935
  state: t.state,
1891
1936
  onLoadMore: r[0] ||= (e) => f("loadMore"),
1892
1937
  onRetryEnd: r[1] ||= (e) => f("retryEnd")
@@ -1901,8 +1946,8 @@ var At = [
1901
1946
  "show-load-more",
1902
1947
  "state"
1903
1948
  ])])) : o("", !0),
1904
- u(Ce, {
1905
- "content-size": z.value.height,
1949
+ u(Ee, {
1950
+ "content-size": B.value.height,
1906
1951
  "controls-id": m,
1907
1952
  "scroll-element": p.value,
1908
1953
  suspended: t.suspended
@@ -1913,8 +1958,8 @@ var At = [
1913
1958
  ])
1914
1959
  ]));
1915
1960
  }
1916
- }), Qt = 300;
1917
- function $t(e, t, n) {
1961
+ }), nn = 300;
1962
+ function rn(e, t, n) {
1918
1963
  let r = e.scrollTop;
1919
1964
  if (n || Math.abs(r - t) <= 1) return e.scrollTop = t, Promise.resolve();
1920
1965
  e.setAttribute("data-transitioning", "");
@@ -1922,7 +1967,7 @@ function $t(e, t, n) {
1922
1967
  return new Promise((n) => {
1923
1968
  let o = (s) => {
1924
1969
  a += 1;
1925
- let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / Qt), u = 1 - (1 - l) ** 3;
1970
+ let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / nn), u = 1 - (1 - l) ** 3;
1926
1971
  if (e.scrollTop = r + (t - r) * u, l < 1) {
1927
1972
  requestAnimationFrame(o);
1928
1973
  return;
@@ -1934,7 +1979,7 @@ function $t(e, t, n) {
1934
1979
  }
1935
1980
  //#endregion
1936
1981
  //#region src/components/ReelAutoAdvanceProgress.vue?vue&type=script&setup=true&lang.ts
1937
- var en = ["aria-label"], tn = /* @__PURE__ */ d({
1982
+ var an = ["aria-label"], on = /* @__PURE__ */ d({
1938
1983
  __name: "ReelAutoAdvanceProgress",
1939
1984
  props: {
1940
1985
  durationMs: {},
@@ -1952,9 +1997,9 @@ var en = ["aria-label"], tn = /* @__PURE__ */ d({
1952
1997
  class: "reel-auto-advance-progress",
1953
1998
  style: _(a.value),
1954
1999
  onAnimationend: n[0] ||= (e) => i("complete")
1955
- }, null, 36)], 8, en));
2000
+ }, null, 36)], 8, an));
1956
2001
  }
1957
- }), nn = { class: "reel-viewport" }, rn = ["data-active-post-id", "data-active-media-index"], an = ["role", "data-status"], on = 300, sn = 250, cn = /* @__PURE__ */ d({
2002
+ }), sn = { class: "reel-viewport" }, cn = ["data-active-post-id", "data-active-media-index"], ln = ["role", "data-status"], un = 300, dn = 250, fn = /* @__PURE__ */ d({
1958
2003
  __name: "ReelFeed",
1959
2004
  props: {
1960
2005
  initialPostId: {},
@@ -2006,7 +2051,7 @@ var en = ["aria-label"], tn = /* @__PURE__ */ d({
2006
2051
  }), z = r(() => {
2007
2052
  let e = F.value;
2008
2053
  return e === void 0 ? "loading" : u.previewStates.get(W(e, R.value)) ?? "loading";
2009
- }), B = r(() => I.value ? U(I.value, R.value) : null), H = r(() => B.value ? ee(B.value, u.mediaSource ?? "preview") : null), G = r(() => z.value === "ready" && !!(H.value && L(H.value.type, H.value.src))), te = r(() => [
2054
+ }), B = r(() => I.value ? ee(I.value, R.value) : null), U = r(() => B.value ? V(B.value, u.mediaSource ?? "preview") : null), G = r(() => z.value === "ready" && !!(U.value && L(U.value.type, U.value.src))), te = r(() => [
2010
2055
  F.value,
2011
2056
  R.value,
2012
2057
  u.items.length,
@@ -2015,54 +2060,54 @@ var en = ["aria-label"], tn = /* @__PURE__ */ d({
2015
2060
  u.reelAutoAdvance.includePostItems,
2016
2061
  u.reelAutoAdvance.intervalMs
2017
2062
  ].join(":")), K = r(() => {
2018
- let e = I.value, t = !!(e && u.reelAutoAdvance.includePostItems && R.value < V(e).length - 1), n = u.reelAutoAdvance.intervalMs / 1e3;
2063
+ let e = I.value, t = !!(e && u.reelAutoAdvance.includePostItems && R.value < H(e).length - 1), n = u.reelAutoAdvance.intervalMs / 1e3;
2019
2064
  return `Auto advance to the next ${t ? "post item" : "post"} in ${n}s`;
2020
- }), q = r(() => u.reelAutoAdvance.enabled && u.reelForward.status === "idle" && I.value !== void 0 && z.value !== "loading" && !G.value), ne = r(() => !u.infiniteScroll || u.items.length <= 1), J = r(() => u.reelForward.status === "loading" ? "Loading the next media…" : u.reelForward.status === "error" ? "Unable to load the next media." : "You reached the end of this feed.");
2021
- function re(e) {
2065
+ }), q = r(() => u.reelAutoAdvance.enabled && u.reelForward.status === "idle" && I.value !== void 0 && z.value !== "loading" && !G.value), ne = r(() => !u.infiniteScroll || u.items.length <= 1), re = r(() => u.reelForward.status === "loading" ? "Loading the next media…" : u.reelForward.status === "error" ? "Unable to load the next media." : "You reached the end of this feed.");
2066
+ function J(e) {
2022
2067
  return { gridRow: `${e + 1}` };
2023
2068
  }
2024
- function Y(e) {
2069
+ function ie(e) {
2025
2070
  let t = k || e.clientHeight;
2026
2071
  return t <= 0 || u.items.length === 0 ? 0 : Math.min(u.items.length - 1, Math.max(0, Math.round(e.scrollTop / t)));
2027
2072
  }
2028
- function ae(e) {
2073
+ function oe(e) {
2029
2074
  let t = e.currentTarget;
2030
2075
  if (!t) return;
2031
2076
  let n = k || t.clientHeight, r = Math.max(0, u.items.length - 1) * n;
2032
- C.value = u.items.length > 0 && t.scrollTop > r + 1, D.value || (x.value = Y(t)), Date.now() >= l && !u.loadMoreLocked && u.infiniteScroll && se(t) && d("loadMore");
2077
+ C.value = u.items.length > 0 && t.scrollTop > r + 1, D.value || (x.value = ie(t)), Date.now() >= l && !u.loadMoreLocked && u.infiniteScroll && ce(t) && d("loadMore");
2033
2078
  }
2034
- function X() {
2079
+ function Y() {
2035
2080
  let e = f.value;
2036
- e && (C.value = !1, ce(!0), k = e.clientHeight, e.scrollTop = x.value * k, j !== null && cancelAnimationFrame(j), j = requestAnimationFrame(() => {
2081
+ e && (C.value = !1, Z(!0), k = e.clientHeight, e.scrollTop = x.value * k, j !== null && cancelAnimationFrame(j), j = requestAnimationFrame(() => {
2037
2082
  e.scrollTop = x.value * e.clientHeight, k = e.clientHeight, j = null;
2038
- }), oe());
2083
+ }), se());
2039
2084
  }
2040
- function oe() {
2085
+ function se() {
2041
2086
  M !== null && clearTimeout(M), M = setTimeout(() => {
2042
2087
  M = null;
2043
2088
  let e = f.value;
2044
- e && (k = e.clientHeight, e.scrollTop = x.value * k), ce(!1);
2089
+ e && (k = e.clientHeight, e.scrollTop = x.value * k), Z(!1);
2045
2090
  }, 120);
2046
2091
  }
2047
- function Z() {
2048
- ce(!0);
2092
+ function X() {
2093
+ Z(!0);
2049
2094
  let e = f.value;
2050
- e && (k = e.clientHeight, e.scrollTop = x.value * k), oe();
2095
+ e && (k = e.clientHeight, e.scrollTop = x.value * k), se();
2051
2096
  }
2052
- function ce(e) {
2097
+ function Z(e) {
2053
2098
  D.value = e, f.value?.toggleAttribute("data-resizing", e);
2054
2099
  }
2055
2100
  function le() {
2056
2101
  let e = f.value;
2057
- Date.now() >= l && !u.loadMoreLocked && e && se(e) && d("loadMore");
2102
+ Date.now() >= l && !u.loadMoreLocked && e && ce(e) && d("loadMore");
2058
2103
  }
2059
2104
  O(() => u.items.length, (e, t) => {
2060
- e > 0 && e < t && (l = Date.now() + sn);
2105
+ e > 0 && e < t && (l = Date.now() + dn);
2061
2106
  });
2062
2107
  function ue(e) {
2063
2108
  let t = I.value;
2064
2109
  if (!t) return !1;
2065
- let n = V(t).length;
2110
+ let n = H(t).length;
2066
2111
  if (n <= 1) return !1;
2067
2112
  let r = (R.value + e + n) % n;
2068
2113
  return d("mediaChange", t.postId, r), !0;
@@ -2082,7 +2127,7 @@ var en = ["aria-label"], tn = /* @__PURE__ */ d({
2082
2127
  let t = f.value;
2083
2128
  if (!t) return Promise.resolve();
2084
2129
  let n = e * (k || t.clientHeight);
2085
- return x.value = e, $t(t, n, Q());
2130
+ return x.value = e, rn(t, n, Q());
2086
2131
  }
2087
2132
  function me(e) {
2088
2133
  pe(e);
@@ -2092,13 +2137,13 @@ var en = ["aria-label"], tn = /* @__PURE__ */ d({
2092
2137
  return t < 0 || t === x.value ? !1 : (await pe(t), !0);
2093
2138
  }
2094
2139
  async function ge(e) {
2095
- return ue(e) ? (Q() || await new Promise((e) => setTimeout(e, on)), !0) : !1;
2140
+ return ue(e) ? (Q() || await new Promise((e) => setTimeout(e, un)), !0) : !1;
2096
2141
  }
2097
2142
  function _e() {
2098
2143
  if (!u.reelAutoAdvance.enabled) return;
2099
2144
  let e = I.value;
2100
2145
  if (!e) return;
2101
- if (u.reelAutoAdvance.includePostItems && R.value < V(e).length - 1) {
2146
+ if (u.reelAutoAdvance.includePostItems && R.value < H(e).length - 1) {
2102
2147
  d("mediaChange", e.postId, R.value + 1);
2103
2148
  return;
2104
2149
  }
@@ -2113,16 +2158,16 @@ var en = ["aria-label"], tn = /* @__PURE__ */ d({
2113
2158
  !u.reelAutoAdvance.enabled || e !== F.value || t !== R.value || !G.value || _e();
2114
2159
  }
2115
2160
  return O(f, (e) => {
2116
- A?.disconnect(), A = null, e && (k = e.clientHeight, !(typeof ResizeObserver > "u") && (A = new ResizeObserver(X), A.observe(e)));
2161
+ A?.disconnect(), A = null, e && (k = e.clientHeight, !(typeof ResizeObserver > "u") && (A = new ResizeObserver(Y), A.observe(e)));
2117
2162
  }), O(() => u.items.length, async (e) => {
2118
2163
  let t = u.initialPostId, n = t == null ? -1 : u.items.findIndex(({ postId: e }) => e === t);
2119
- x.value = n >= 0 ? n : Math.min(x.value, Math.max(0, e - 1)), await m(), X();
2164
+ x.value = n >= 0 ? n : Math.min(x.value, Math.max(0, e - 1)), await m(), Y();
2120
2165
  }), O(F, (e) => {
2121
2166
  e !== void 0 && d("activeChange", e);
2122
2167
  }, { immediate: !0 }), y(() => {
2123
- window.addEventListener("resize", Z), window.addEventListener("orientationchange", Z), g >= 0 && m(X);
2168
+ window.addEventListener("resize", X), window.addEventListener("orientationchange", X), g >= 0 && m(Y);
2124
2169
  }), v(() => {
2125
- window.removeEventListener("resize", Z), window.removeEventListener("orientationchange", Z), A?.disconnect(), j !== null && cancelAnimationFrame(j), M !== null && clearTimeout(M);
2170
+ window.removeEventListener("resize", X), window.removeEventListener("orientationchange", X), A?.disconnect(), j !== null && cancelAnimationFrame(j), M !== null && clearTimeout(M);
2126
2171
  }), n({
2127
2172
  activeIndex: x,
2128
2173
  activePostId: F,
@@ -2139,7 +2184,7 @@ var en = ["aria-label"], tn = /* @__PURE__ */ d({
2139
2184
  }]),
2140
2185
  "data-layout-mode": "reel"
2141
2186
  }, [
2142
- t.cardHeader && I.value && t.reelForward.status === "idle" ? (b(), a(Ue, {
2187
+ t.cardHeader && I.value && t.reelForward.status === "idle" ? (b(), a(Ke, {
2143
2188
  key: 0,
2144
2189
  index: x.value,
2145
2190
  item: I.value,
@@ -2161,19 +2206,19 @@ var en = ["aria-label"], tn = /* @__PURE__ */ d({
2161
2206
  "style",
2162
2207
  "total"
2163
2208
  ])) : o("", !0),
2164
- c("div", nn, [c("div", {
2209
+ c("div", sn, [c("div", {
2165
2210
  ref_key: "galleryElement",
2166
2211
  ref: f,
2167
2212
  class: "gallery-shell reel-feed",
2168
2213
  "data-active-post-id": F.value,
2169
2214
  "data-active-media-index": R.value,
2170
- onScrollPassive: ae
2215
+ onScrollPassive: oe
2171
2216
  }, [t.reelForward.status === "idle" ? (b(), s("section", {
2172
2217
  key: 1,
2173
2218
  class: "reel-track",
2174
2219
  style: _(N.value),
2175
2220
  "aria-label": "Media gallery"
2176
- }, [(b(!0), s(e, null, S(P.value, ({ fetchPriority: e, item: n, index: i }) => (b(), a(Wt, {
2221
+ }, [(b(!0), s(e, null, S(P.value, ({ fetchPriority: e, item: n, index: i }) => (b(), a(qt, {
2177
2222
  key: n.postId,
2178
2223
  active: i === x.value && !C.value,
2179
2224
  "advance-on-media-end": u.reelAutoAdvance.enabled && i === x.value,
@@ -2182,7 +2227,7 @@ var en = ["aria-label"], tn = /* @__PURE__ */ d({
2182
2227
  "fetch-priority": e,
2183
2228
  index: i,
2184
2229
  item: n,
2185
- "item-style": re(i),
2230
+ "item-style": J(i),
2186
2231
  "media-card": t.mediaCard,
2187
2232
  layout: "reel",
2188
2233
  "loaded-count": t.items.length,
@@ -2222,12 +2267,12 @@ var en = ["aria-label"], tn = /* @__PURE__ */ d({
2222
2267
  class: "reel-forward-status",
2223
2268
  role: t.reelForward.status === "error" ? "alert" : "status",
2224
2269
  "data-status": t.reelForward.status
2225
- }, [c("p", null, T(J.value), 1), t.reelForward.status === "error" || t.reelForward.status === "end" ? (b(), s("button", {
2270
+ }, [c("p", null, T(re.value), 1), t.reelForward.status === "error" || t.reelForward.status === "end" ? (b(), s("button", {
2226
2271
  key: 0,
2227
2272
  class: "reel-forward-retry",
2228
2273
  type: "button",
2229
2274
  onClick: r[0] ||= (e) => d("retryForward")
2230
- }, " Retry ")) : o("", !0)], 8, an)), t.reelForward.status === "idle" ? (b(), a(ie, {
2275
+ }, " Retry ")) : o("", !0)], 8, ln)), t.reelForward.status === "idle" ? (b(), a(ae, {
2231
2276
  key: 2,
2232
2277
  actions: t.feedFooterActions,
2233
2278
  "can-retry-end": t.canRetryEnd,
@@ -2250,13 +2295,13 @@ var en = ["aria-label"], tn = /* @__PURE__ */ d({
2250
2295
  "load-more-locked",
2251
2296
  "show-load-more",
2252
2297
  "state"
2253
- ])) : o("", !0)], 40, rn), c("div", {
2298
+ ])) : o("", !0)], 40, cn), c("div", {
2254
2299
  ref_key: "reelControlsElement",
2255
2300
  ref: p,
2256
2301
  class: "reel-media-controls-host",
2257
2302
  "data-test": "reel-media-controls-host"
2258
2303
  }, null, 512)]),
2259
- t.cardFooter && I.value && t.reelForward.status === "idle" ? (b(), a(Ue, {
2304
+ t.cardFooter && I.value && t.reelForward.status === "idle" ? (b(), a(Ke, {
2260
2305
  key: 1,
2261
2306
  index: x.value,
2262
2307
  item: I.value,
@@ -2278,7 +2323,7 @@ var en = ["aria-label"], tn = /* @__PURE__ */ d({
2278
2323
  "style",
2279
2324
  "total"
2280
2325
  ])) : o("", !0),
2281
- q.value ? (b(), a(tn, {
2326
+ q.value ? (b(), a(on, {
2282
2327
  key: te.value,
2283
2328
  "duration-ms": t.reelAutoAdvance.intervalMs,
2284
2329
  label: K.value,
@@ -2286,16 +2331,16 @@ var en = ["aria-label"], tn = /* @__PURE__ */ d({
2286
2331
  }, null, 8, ["duration-ms", "label"])) : o("", !0)
2287
2332
  ], 2));
2288
2333
  }
2289
- }), ln = ["data-info-sheet-open", "data-info-sheet-mode"], un = ["aria-hidden", "inert"], dn = {
2334
+ }), pn = ["data-info-sheet-open", "data-info-sheet-mode"], mn = ["aria-hidden", "inert"], hn = {
2290
2335
  key: 0,
2291
2336
  class: "reel-info-sheet-layer",
2292
2337
  "data-test": "reel-info-sheet"
2293
- }, fn = [
2338
+ }, gn = [
2294
2339
  "role",
2295
2340
  "aria-modal",
2296
2341
  "tabindex",
2297
2342
  "data-active-post-id"
2298
- ], pn = /* @__PURE__ */ d({
2343
+ ], _n = /* @__PURE__ */ d({
2299
2344
  __name: "ReelLayout",
2300
2345
  props: {
2301
2346
  forwardIndex: { default: null },
@@ -2355,9 +2400,9 @@ var en = ["aria-label"], tn = /* @__PURE__ */ d({
2355
2400
  item: e,
2356
2401
  layout: "reel",
2357
2402
  loadedCount: l.items.length,
2358
- mediaCount: V(e).length,
2403
+ mediaCount: H(e).length,
2359
2404
  mediaIndex: D.value,
2360
- mediaItem: U(e, D.value),
2405
+ mediaItem: ee(e, D.value),
2361
2406
  mediaSource: l.mediaSource ?? "preview",
2362
2407
  origin: l.origin,
2363
2408
  total: l.total
@@ -2390,7 +2435,7 @@ var en = ["aria-label"], tn = /* @__PURE__ */ d({
2390
2435
  function B(e, t) {
2391
2436
  d("mediaChange", e, t);
2392
2437
  }
2393
- function ee(e, t) {
2438
+ function V(e, t) {
2394
2439
  d("ready", e, t);
2395
2440
  }
2396
2441
  return O(() => ({
@@ -2422,7 +2467,7 @@ var en = ["aria-label"], tn = /* @__PURE__ */ d({
2422
2467
  class: "reel-layout-main",
2423
2468
  "aria-hidden": e.infoSheetOverlay && A.value || void 0,
2424
2469
  inert: e.infoSheetOverlay && A.value || void 0
2425
- }, [u(cn, {
2470
+ }, [u(fn, {
2426
2471
  ref_key: "reelFeed",
2427
2472
  ref: p,
2428
2473
  "can-retry-end": e.canRetryEnd,
@@ -2450,7 +2495,7 @@ var en = ["aria-label"], tn = /* @__PURE__ */ d({
2450
2495
  onError: z,
2451
2496
  onLoadMore: r[1] ||= (e) => d("loadMore"),
2452
2497
  onMediaChange: B,
2453
- onReady: ee,
2498
+ onReady: V,
2454
2499
  onRetryEnd: r[2] ||= (e) => d("retryEnd"),
2455
2500
  onRetryForward: r[3] ||= (e) => d("retryForward"),
2456
2501
  onReelAudioChange: r[4] ||= (e) => d("reelAudioChange", e)
@@ -2476,8 +2521,8 @@ var en = ["aria-label"], tn = /* @__PURE__ */ d({
2476
2521
  "reel-forward",
2477
2522
  "state",
2478
2523
  "total"
2479
- ])], 8, un), u(n, { name: "vibe-info-sheet" }, {
2480
- default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", dn, [c("aside", {
2524
+ ])], 8, mn), u(n, { name: "vibe-info-sheet" }, {
2525
+ default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", hn, [c("aside", {
2481
2526
  ref_key: "sheetElement",
2482
2527
  ref: _,
2483
2528
  class: "reel-info-sheet",
@@ -2486,17 +2531,17 @@ var en = ["aria-label"], tn = /* @__PURE__ */ d({
2486
2531
  "aria-modal": e.infoSheetOverlay ? "true" : void 0,
2487
2532
  tabindex: e.infoSheetOverlay ? -1 : void 0,
2488
2533
  "data-active-post-id": T.value?.postId
2489
- }, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8, fn)])) : o("", !0)]),
2534
+ }, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8, gn)])) : o("", !0)]),
2490
2535
  _: 1
2491
- })], 10, ln));
2536
+ })], 10, pn));
2492
2537
  }
2493
2538
  });
2494
2539
  //#endregion
2495
2540
  //#region src/core/mediaLifecycle.ts
2496
- function mn(e, t, n, r, i) {
2541
+ function vn(e, t, n, r, i) {
2497
2542
  let a = e.items.findIndex((e) => e.postId === t), o = e.items[a];
2498
2543
  if (!o) return null;
2499
- let s = H(o, n), c = U(o, s);
2544
+ let s = U(o, n), c = ee(o, s);
2500
2545
  return {
2501
2546
  item: o,
2502
2547
  layout: r,
@@ -2509,7 +2554,7 @@ function mn(e, t, n, r, i) {
2509
2554
  postIndex: a
2510
2555
  };
2511
2556
  }
2512
- function hn(e, t) {
2557
+ function yn(e, t) {
2513
2558
  O(() => {
2514
2559
  let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null;
2515
2560
  return {
@@ -2519,76 +2564,86 @@ function hn(e, t) {
2519
2564
  };
2520
2565
  }, (n, r) => {
2521
2566
  if (n.postId === null || n.postId === r?.postId && n.mediaIndex === r.mediaIndex && n.origin === r.origin) return;
2522
- let i = mn(e, n.postId, n.mediaIndex, "reel", n.origin);
2567
+ let i = vn(e, n.postId, n.mediaIndex, "reel", n.origin);
2523
2568
  i && t(i);
2524
2569
  }, { flush: "sync" });
2525
2570
  }
2526
2571
  //#endregion
2527
2572
  //#region src/components/useMediaLifecycle.ts
2528
- function gn(e, t) {
2529
- let n = w(/* @__PURE__ */ new Map()), i = w(/* @__PURE__ */ new Map()), a = w(/* @__PURE__ */ new Map()), o = () => e.reelMediaSource === "preview" ? n : e.reelMediaSource === "mobile" ? a : i, s = r(() => o().value);
2530
- function c(e, t, n, r) {
2573
+ function bn(e, t) {
2574
+ let n = /* @__PURE__ */ new Set(), i = w(/* @__PURE__ */ new Map()), a = w(/* @__PURE__ */ new Map()), o = w(/* @__PURE__ */ new Map()), s = () => e.reelMediaSource === "preview" ? i : e.reelMediaSource === "mobile" ? o : a, c = r(() => s().value), l = /* @__PURE__ */ new Set();
2575
+ function u(e, t, n, r) {
2531
2576
  let i = W(t, n);
2532
2577
  e.value.get(i) !== r && (e.value = new Map(e.value).set(i, r));
2533
2578
  }
2534
- function l(t, n, r, i) {
2535
- return mn(e, t, n, r, i);
2579
+ function d(t, n, r, i) {
2580
+ return vn(e, t, n, r, i);
2536
2581
  }
2537
- function u(e, n, r, i) {
2538
- let a = l(e, n, r, i);
2582
+ function f(e, n, r, i) {
2583
+ let a = d(e, n, r, i);
2539
2584
  a && t.ready(a);
2540
2585
  }
2541
- function d(e, t) {
2542
- c(n, e, t, "error");
2586
+ function p(e, t) {
2587
+ u(i, e, t, "error");
2543
2588
  }
2544
- function f(e, t) {
2545
- c(n, e, t, "ready"), u(e, t, "masonry", null);
2589
+ function m(e, t) {
2590
+ u(i, e, t, "ready"), f(e, t, "masonry", null);
2546
2591
  }
2547
- function p(e, t) {
2548
- c(o(), e, t, "error");
2592
+ function h(e, t) {
2593
+ u(s(), e, t, "error");
2594
+ }
2595
+ function g(t, n) {
2596
+ u(s(), t, n, "ready"), f(t, n, "reel", e.reelOrigin ?? "reel");
2597
+ }
2598
+ function _(e, n) {
2599
+ let r = W(e, n);
2600
+ if (l.has(r)) return;
2601
+ let i = d(e, n, "masonry", null);
2602
+ i && (l.add(r), t.visible(i));
2549
2603
  }
2550
- function m(t, n) {
2551
- c(o(), t, n, "ready"), u(t, n, "reel", e.reelOrigin ?? "reel");
2604
+ function v(e, r, i, a) {
2605
+ let o = [i, W(e, r)].join(":");
2606
+ if (n.has(o)) return;
2607
+ let s = d(e, r, i, a);
2608
+ s && (n.add(o), t.fullyVisible(s));
2552
2609
  }
2553
- function h(e, n) {
2554
- let r = l(e, n, "masonry", null);
2555
- r && t.visible(r);
2610
+ function y(e, t) {
2611
+ v(e, t, "masonry", null);
2556
2612
  }
2557
- return hn(e, t.reelChange), O(() => {
2613
+ return yn(e, t.reelChange), O(() => {
2558
2614
  let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null, n = t === null ? 0 : e.mediaIndices.get(t) ?? 0;
2559
2615
  return {
2560
2616
  mediaIndex: n,
2561
2617
  origin: e.reelOrigin ?? "reel",
2562
2618
  postId: t,
2563
- ready: t !== null && s.value.get(W(t, n)) === "ready"
2619
+ ready: t !== null && c.value.get(W(t, n)) === "ready"
2564
2620
  };
2565
- }, (e, n) => {
2566
- if (e.postId === null || !e.ready || n?.ready && n.postId === e.postId && n.mediaIndex === e.mediaIndex && n.origin === e.origin) return;
2567
- let r = l(e.postId, e.mediaIndex, "reel", e.origin);
2568
- r && t.visible(r);
2621
+ }, (e, t) => {
2622
+ e.postId === null || !e.ready || t?.ready && t.postId === e.postId && t.mediaIndex === e.mediaIndex && t.origin === e.origin || v(e.postId, e.mediaIndex, "reel", e.origin);
2569
2623
  }, { flush: "post" }), {
2570
- markMasonryVisible: h,
2571
- markPreviewError: d,
2572
- markPreviewReady: f,
2573
- markReelError: p,
2574
- markReelReady: m,
2575
- originalStates: i,
2576
- previewStates: n,
2577
- reelStates: s
2624
+ markMasonryFullyVisible: y,
2625
+ markMasonryVisible: _,
2626
+ markPreviewError: p,
2627
+ markPreviewReady: m,
2628
+ markReelError: h,
2629
+ markReelReady: g,
2630
+ originalStates: a,
2631
+ previewStates: i,
2632
+ reelStates: c
2578
2633
  };
2579
2634
  }
2580
2635
  //#endregion
2581
2636
  //#region src/core/reelEscapeStack.ts
2582
- var _n = [];
2583
- function vn(e) {
2584
- return _n.push(e), () => {
2585
- let t = _n.indexOf(e);
2586
- t >= 0 && _n.splice(t, 1);
2637
+ var xn = [];
2638
+ function Sn(e) {
2639
+ return xn.push(e), () => {
2640
+ let t = xn.indexOf(e);
2641
+ t >= 0 && xn.splice(t, 1);
2587
2642
  };
2588
2643
  }
2589
- function yn(e) {
2644
+ function Cn(e) {
2590
2645
  if (!e.isActive()) return !1;
2591
- let t = _n.filter((e) => e.isActive()), n = e.element();
2646
+ let t = xn.filter((e) => e.isActive()), n = e.element();
2592
2647
  return n !== null && t.some((t) => {
2593
2648
  if (t === e) return !1;
2594
2649
  let r = t.element();
@@ -2604,14 +2659,14 @@ function yn(e) {
2604
2659
  }
2605
2660
  //#endregion
2606
2661
  //#region src/components/useReelKeyboard.ts
2607
- function bn(e) {
2662
+ function wn(e) {
2608
2663
  let t = {
2609
2664
  element: e.element,
2610
2665
  isActive: () => e.state.layout === "reel" || e.state.reelOrigin === "masonry"
2611
2666
  }, n = null;
2612
2667
  function r(n) {
2613
2668
  let r = t.isActive();
2614
- if (n.key === "Escape" && r && !yn(t)) return;
2669
+ if (n.key === "Escape" && r && !Cn(t)) return;
2615
2670
  if (n.key === "Escape" && e.state.reelOrigin === "masonry") {
2616
2671
  n.preventDefault(), e.state.reelInfoSheetOverlay && e.state.reelInfoSheet.enabled && e.setReelInfoSheet(!1), e.closeMasonryReel();
2617
2672
  return;
@@ -2631,14 +2686,14 @@ function bn(e) {
2631
2686
  a !== 0 && e.reelRenderer()?.changeActiveMedia?.(a) && n.preventDefault();
2632
2687
  }
2633
2688
  y(() => {
2634
- n = vn(t), window.addEventListener("keydown", r);
2689
+ n = Sn(t), window.addEventListener("keydown", r);
2635
2690
  }), v(() => {
2636
2691
  window.removeEventListener("keydown", r), n?.(), n = null;
2637
2692
  });
2638
2693
  }
2639
2694
  //#endregion
2640
2695
  //#region src/components/VibeSurface.vue?vue&type=script&setup=true&lang.ts
2641
- var xn = 35, Sn = 420, Cn = /* @__PURE__ */ d({
2696
+ var Tn = 35, En = 420, Dn = /* @__PURE__ */ d({
2642
2697
  __name: "VibeSurface",
2643
2698
  props: {
2644
2699
  canRetryEnd: { type: Boolean },
@@ -2656,6 +2711,7 @@ var xn = 35, Sn = 420, Cn = /* @__PURE__ */ d({
2656
2711
  "activeReelChange",
2657
2712
  "closeReel",
2658
2713
  "loadMore",
2714
+ "mediaFullyVisible",
2659
2715
  "mediaReady",
2660
2716
  "mediaVisible",
2661
2717
  "openReel",
@@ -2666,110 +2722,111 @@ var xn = 35, Sn = 420, Cn = /* @__PURE__ */ d({
2666
2722
  "retryForward"
2667
2723
  ],
2668
2724
  setup(t, { expose: i, emit: c }) {
2669
- let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), _ = w(!1), y = w(/* @__PURE__ */ new Set()), x = w(/* @__PURE__ */ new Map()), S = w(/* @__PURE__ */ new Set()), C = w(/* @__PURE__ */ new Map()), T = r(() => Object.freeze([...l.state.items])), D = r(() => te(l.state, T.value)), { markMasonryVisible: A, markPreviewError: j, markPreviewReady: M, markReelError: N, markReelReady: P, originalStates: F, previewStates: I, reelStates: L } = gn(l.state, {
2725
+ let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), _ = w(!1), y = w(/* @__PURE__ */ new Set()), x = w(/* @__PURE__ */ new Map()), S = w(/* @__PURE__ */ new Set()), C = w(/* @__PURE__ */ new Map()), T = r(() => Object.freeze([...l.state.items])), D = r(() => te(l.state, T.value)), { markMasonryFullyVisible: A, markMasonryVisible: j, markPreviewError: M, markPreviewReady: N, markReelError: P, markReelReady: F, originalStates: I, previewStates: L, reelStates: R } = bn(l.state, {
2726
+ fullyVisible: (e) => d("mediaFullyVisible", e),
2670
2727
  ready: (e) => d("mediaReady", e),
2671
2728
  reelChange: (e) => d("reelMediaChange", e),
2672
2729
  visible: (e) => d("mediaVisible", e)
2673
- }), R = new Set(l.state.items.map((e) => e.postId)), z = null, B = null, ee = !1;
2674
- function U() {
2730
+ }), z = new Set(l.state.items.map((e) => e.postId)), B = null, V = null, ee = !1;
2731
+ function W() {
2675
2732
  return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
2676
2733
  }
2677
- function W() {
2678
- z !== null && cancelAnimationFrame(z), z = requestAnimationFrame(() => {
2679
- z = requestAnimationFrame(() => {
2680
- z = null, y.value = /* @__PURE__ */ new Set();
2734
+ function G() {
2735
+ B !== null && cancelAnimationFrame(B), B = requestAnimationFrame(() => {
2736
+ B = requestAnimationFrame(() => {
2737
+ B = null, y.value = /* @__PURE__ */ new Set();
2681
2738
  });
2682
2739
  });
2683
2740
  }
2684
- function G(e, t) {
2741
+ function K(e, t) {
2685
2742
  let n = l.state.items.find((t) => t.postId === e);
2686
2743
  if (!n) return;
2687
- let r = H(n, t);
2744
+ let r = U(n, t);
2688
2745
  (l.state.mediaIndices.get(e) ?? 0) !== r && (l.state.mediaIndices = new Map(l.state.mediaIndices).set(e, r));
2689
2746
  }
2690
- async function K() {
2747
+ async function q() {
2691
2748
  await m(), (l.state.layout === "reel" || l.state.reelOrigin === "masonry" ? p.value : f.value)?.loadIfNearBottom();
2692
2749
  }
2693
- function q(e) {
2750
+ function ne(e) {
2694
2751
  return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.changeActiveMedia?.(e) ?? !1;
2695
2752
  }
2696
- function ne(e) {
2753
+ function re(e) {
2697
2754
  return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.moveActivePost?.(e) ?? !1;
2698
2755
  }
2699
2756
  function J(e) {
2700
2757
  if (!(l.state.layout === "reel" || l.state.reelOrigin === "masonry") || l.state.isLoading) return "reel-inactive";
2701
2758
  let t = l.state.items.find((t) => t.postId === e.postId);
2702
2759
  if (!t) return "not-found";
2703
- let n = V(t).findIndex((t) => t.mediaId === e.mediaId);
2760
+ let n = H(t).findIndex((t) => t.mediaId === e.mediaId);
2704
2761
  return n < 0 ? "not-found" : p.value?.navigateToItem?.(e.postId, n) ? "navigated" : "reel-inactive";
2705
2762
  }
2706
- function re() {
2763
+ function ie() {
2707
2764
  return l.state.layout !== "masonry" || l.state.reelOrigin === "masonry" ? null : f.value?.getScrollElement?.() ?? null;
2708
2765
  }
2709
- function Y(e, t) {
2710
- B = e, ee = t === "keyboard", d("openReel", e), m(() => h.value?.focus());
2766
+ function ae(e, t) {
2767
+ V = e, ee = t === "keyboard", d("openReel", e), m(() => h.value?.focus());
2711
2768
  }
2712
- function ie(e) {
2769
+ function oe(e) {
2713
2770
  let t = g.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [];
2714
2771
  return Array.from(t).find((t) => t.dataset.postId === String(e)) ?? null;
2715
2772
  }
2716
- function ae(e, t) {
2717
- if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || U()) return 0;
2718
- let n = [...new Set(e)], r = n.filter(ie);
2773
+ function Y(e, t) {
2774
+ if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || W()) return 0;
2775
+ let n = [...new Set(e)], r = n.filter(oe);
2719
2776
  if (r.length === 0) return 0;
2720
- let i = new Map(C.value), a = t?.staggerMs ?? xn;
2777
+ let i = new Map(C.value), a = t?.staggerMs ?? Tn;
2721
2778
  return r.forEach((e, t) => {
2722
2779
  i.set(e, t * a);
2723
- }), y.value = new Set([...y.value].filter((e) => !r.includes(e))), S.value = new Set([...S.value, ...n]), C.value = i, Sn + (r.length - 1) * a;
2780
+ }), y.value = new Set([...y.value].filter((e) => !r.includes(e))), S.value = new Set([...S.value, ...n]), C.value = i, En + (r.length - 1) * a;
2724
2781
  }
2725
- function X(e, t) {
2726
- let n = ie(e), r = n?.querySelector(".media-card-activator") ?? n;
2782
+ function ce(e, t) {
2783
+ let n = oe(e), r = n?.querySelector(".media-card-activator") ?? n;
2727
2784
  r && (r.classList.toggle("media-card-focus-silent", !t), t || r.addEventListener("blur", () => {
2728
2785
  r.classList.remove("media-card-focus-silent");
2729
2786
  }, { once: !0 }), r?.focus({ preventScroll: !0 }));
2730
2787
  }
2731
- function se() {
2732
- l.state.reelOrigin === "masonry" && (B ??= l.state.activeReelPostId, _.value = !0, d("closeReel"));
2788
+ function X() {
2789
+ l.state.reelOrigin === "masonry" && (V ??= l.state.activeReelPostId, _.value = !0, d("closeReel"));
2733
2790
  }
2734
2791
  function Z() {
2735
- let e = B, t = ee;
2736
- _.value = !1, B = null, ee = !1, m(() => {
2737
- e !== null && X(e, t);
2792
+ let e = V, t = ee;
2793
+ _.value = !1, V = null, ee = !1, m(() => {
2794
+ e !== null && ce(e, t);
2738
2795
  });
2739
2796
  }
2740
- return bn({
2741
- closeMasonryReel: se,
2797
+ return wn({
2798
+ closeMasonryReel: X,
2742
2799
  element: () => g.value,
2743
2800
  isReelLeaving: () => _.value,
2744
2801
  reelRenderer: () => p.value,
2745
2802
  setReelInfoSheet: (e) => d("reelInfoSheetChange", e),
2746
2803
  state: l.state
2747
2804
  }), O(() => l.state.items.map((e) => e.postId), (e) => {
2748
- let t = e.filter((e) => !R.has(e)), n = new Set(e);
2749
- if (R = new Set(e), S.value = new Set([...S.value].filter((e) => n.has(e))), C.value = new Map([...C.value].filter(([e]) => n.has(e))), t.length === 0 || U()) return;
2805
+ let t = e.filter((e) => !z.has(e)), n = new Set(e);
2806
+ if (z = new Set(e), S.value = new Set([...S.value].filter((e) => n.has(e))), C.value = new Map([...C.value].filter(([e]) => n.has(e))), t.length === 0 || W()) return;
2750
2807
  let r = /* @__PURE__ */ new Map();
2751
2808
  e.forEach((e) => {
2752
2809
  let t = x.value.get(e);
2753
2810
  t !== void 0 && r.set(e, t);
2754
2811
  }), t.forEach((e, t) => {
2755
- r.set(e, t * xn);
2756
- }), x.value = r, y.value = new Set([...y.value, ...t]), W();
2812
+ r.set(e, t * Tn);
2813
+ }), x.value = r, y.value = new Set([...y.value, ...t]), G();
2757
2814
  }, { flush: "sync" }), v(() => {
2758
- z !== null && cancelAnimationFrame(z);
2815
+ B !== null && cancelAnimationFrame(B);
2759
2816
  }), i({
2760
- changeActiveReelMedia: q,
2761
- getAutoScrollElement: re,
2762
- loadIfNearBottom: K,
2763
- moveActiveReelPost: ne,
2817
+ changeActiveReelMedia: ne,
2818
+ getAutoScrollElement: ie,
2819
+ loadIfNearBottom: q,
2820
+ moveActiveReelPost: re,
2764
2821
  navigateToReelItem: J,
2765
- startItemRemoval: ae,
2822
+ startItemRemoval: Y,
2766
2823
  transitionActiveReelMedia: (e) => p.value?.transitionActiveMedia?.(e) ?? Promise.resolve(!1),
2767
2824
  transitionActiveReelPost: (e) => p.value?.transitionActivePost?.(e) ?? Promise.resolve(!1)
2768
2825
  }), (r, i) => (b(), s("div", {
2769
2826
  ref_key: "surfaceElement",
2770
2827
  ref: g,
2771
2828
  class: "vibe-surface"
2772
- }, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(pn, {
2829
+ }, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(_n, {
2773
2830
  key: 0,
2774
2831
  ref_key: "reelRenderer",
2775
2832
  ref: p,
@@ -2794,7 +2851,7 @@ var xn = 35, Sn = 420, Cn = /* @__PURE__ */ d({
2794
2851
  "info-sheet-overlay": t.state.reelInfoSheetOverlay,
2795
2852
  "next-page-error": !!t.state.nextPageError,
2796
2853
  origin: "reel",
2797
- "preview-states": E(L),
2854
+ "preview-states": E(R),
2798
2855
  "reel-auto-advance": t.state.reelAutoAdvance,
2799
2856
  "reel-audio-state": t.reelAudioState,
2800
2857
  "reel-forward": t.state.reelForward,
@@ -2802,14 +2859,14 @@ var xn = 35, Sn = 420, Cn = /* @__PURE__ */ d({
2802
2859
  total: t.state.total,
2803
2860
  onActiveChange: i[0] ||= (e) => d("activeReelChange", e),
2804
2861
  onCloseInfoSheet: i[1] ||= (e) => d("reelInfoSheetChange", !1),
2805
- onError: E(N),
2862
+ onError: E(P),
2806
2863
  onLoadMore: i[2] ||= (e) => d("loadMore"),
2807
- onMediaChange: G,
2808
- onReady: E(P),
2864
+ onMediaChange: K,
2865
+ onReady: E(F),
2809
2866
  onRetryEnd: i[3] ||= (e) => d("retryEnd"),
2810
2867
  onRetryForward: i[4] ||= (e) => d("retryForward"),
2811
2868
  onReelAudioChange: i[5] ||= (e) => d("reelAudioChange", e)
2812
- }, null, 8, /* @__PURE__ */ "can-retry-end.has-next.card-footer.card-header.feed-footer.feed-footer-actions.forward-index.forward-item.media-card.infinite-scroll.is-loading-more.items.load-more-locked.media-source.media-indices.initial-post-id.info-sheet.info-sheet-enabled.info-sheet-overlay.next-page-error.preview-states.reel-auto-advance.reel-audio-state.reel-forward.state.total.onError.onReady".split("."))) : t.state.error || t.state.isLoading || t.state.items.length === 0 && t.state.reelForward.status === "idle" ? (b(), a(oe, {
2869
+ }, null, 8, /* @__PURE__ */ "can-retry-end.has-next.card-footer.card-header.feed-footer.feed-footer-actions.forward-index.forward-item.media-card.infinite-scroll.is-loading-more.items.load-more-locked.media-source.media-indices.initial-post-id.info-sheet.info-sheet-enabled.info-sheet-overlay.next-page-error.preview-states.reel-auto-advance.reel-audio-state.reel-forward.state.total.onError.onReady".split("."))) : t.state.error || t.state.isLoading || t.state.items.length === 0 && t.state.reelForward.status === "idle" ? (b(), a(se, {
2813
2870
  key: 1,
2814
2871
  actions: t.feedFooterActions,
2815
2872
  "can-retry-end": t.canRetryEnd,
@@ -2822,7 +2879,7 @@ var xn = 35, Sn = 420, Cn = /* @__PURE__ */ d({
2822
2879
  "can-retry-end",
2823
2880
  "feed-footer",
2824
2881
  "state"
2825
- ])) : (b(), s(e, { key: 2 }, [u(Zt, {
2882
+ ])) : (b(), s(e, { key: 2 }, [u(tn, {
2826
2883
  ref_key: "masonryRenderer",
2827
2884
  ref: f,
2828
2885
  "can-retry-end": t.canRetryEnd,
@@ -2843,44 +2900,19 @@ var xn = 35, Sn = 420, Cn = /* @__PURE__ */ d({
2843
2900
  "load-more-locked": t.state.loadMoreLocked,
2844
2901
  "media-indices": t.state.mediaIndices,
2845
2902
  "next-page-error": !!t.state.nextPageError,
2846
- "preview-states": E(I),
2903
+ "preview-states": E(L),
2847
2904
  suspended: t.state.reelOrigin === "masonry" || _.value,
2848
2905
  state: D.value,
2849
2906
  total: t.state.total,
2850
- onActivate: Y,
2851
- onError: E(j),
2907
+ onActivate: ae,
2908
+ onError: E(M),
2909
+ onFullyVisible: E(A),
2852
2910
  onLoadMore: i[8] ||= (e) => d("loadMore"),
2853
- onMediaChange: G,
2854
- onReady: E(M),
2911
+ onMediaChange: K,
2912
+ onReady: E(N),
2855
2913
  onRetryEnd: i[9] ||= (e) => d("retryEnd"),
2856
- onVisible: E(A)
2857
- }, null, 8, [
2858
- "can-retry-end",
2859
- "entering-post-ids",
2860
- "entry-delays",
2861
- "leaving-post-ids",
2862
- "removal-delays",
2863
- "card-footer",
2864
- "card-header",
2865
- "feed-footer",
2866
- "feed-footer-actions",
2867
- "media-card",
2868
- "masonry",
2869
- "has-next",
2870
- "infinite-scroll",
2871
- "is-loading-more",
2872
- "items",
2873
- "load-more-locked",
2874
- "media-indices",
2875
- "next-page-error",
2876
- "preview-states",
2877
- "suspended",
2878
- "state",
2879
- "total",
2880
- "onError",
2881
- "onReady",
2882
- "onVisible"
2883
- ]), u(n, {
2914
+ onVisible: E(j)
2915
+ }, null, 8, /* @__PURE__ */ "can-retry-end.entering-post-ids.entry-delays.leaving-post-ids.removal-delays.card-footer.card-header.feed-footer.feed-footer-actions.media-card.masonry.has-next.infinite-scroll.is-loading-more.items.load-more-locked.media-indices.next-page-error.preview-states.suspended.state.total.onError.onFullyVisible.onReady.onVisible".split(".")), u(n, {
2884
2916
  name: "vibe-reel-viewer",
2885
2917
  onAfterLeave: Z
2886
2918
  }, {
@@ -2893,7 +2925,7 @@ var xn = 35, Sn = 420, Cn = /* @__PURE__ */ d({
2893
2925
  "aria-label": "Media viewer",
2894
2926
  "aria-modal": "true",
2895
2927
  tabindex: "-1"
2896
- }, [u(pn, {
2928
+ }, [u(_n, {
2897
2929
  ref_key: "reelRenderer",
2898
2930
  ref: p,
2899
2931
  "can-retry-end": t.canRetryEnd,
@@ -2917,7 +2949,7 @@ var xn = 35, Sn = 420, Cn = /* @__PURE__ */ d({
2917
2949
  "media-source": "original",
2918
2950
  "next-page-error": !!t.state.nextPageError,
2919
2951
  origin: "masonry",
2920
- "preview-states": E(F),
2952
+ "preview-states": E(I),
2921
2953
  "reel-auto-advance": t.state.reelAutoAdvance,
2922
2954
  "reel-audio-state": t.reelAudioState,
2923
2955
  "reel-forward": t.state.reelForward,
@@ -2925,10 +2957,10 @@ var xn = 35, Sn = 420, Cn = /* @__PURE__ */ d({
2925
2957
  total: t.state.total,
2926
2958
  onActiveChange: i[10] ||= (e) => d("activeReelChange", e),
2927
2959
  onCloseInfoSheet: i[11] ||= (e) => d("reelInfoSheetChange", !1),
2928
- onError: E(N),
2960
+ onError: E(P),
2929
2961
  onLoadMore: i[12] ||= (e) => d("loadMore"),
2930
- onMediaChange: G,
2931
- onReady: E(P),
2962
+ onMediaChange: K,
2963
+ onReady: E(F),
2932
2964
  onRetryEnd: i[13] ||= (e) => d("retryEnd"),
2933
2965
  onRetryForward: i[14] ||= (e) => d("retryForward"),
2934
2966
  onReelAudioChange: i[15] ||= (e) => d("reelAudioChange", e)
@@ -2939,7 +2971,7 @@ var xn = 35, Sn = 420, Cn = /* @__PURE__ */ d({
2939
2971
  });
2940
2972
  //#endregion
2941
2973
  //#region src/core/page.ts
2942
- function wn(e) {
2974
+ function On(e) {
2943
2975
  if (!e || typeof e != "object" || !Array.isArray(e.items)) throw TypeError("Vibe loadPage must resolve to a page with an items array.");
2944
2976
  if (e.current !== void 0 && e.current !== null && typeof e.current != "string" && typeof e.current != "number") throw TypeError("Vibe page current must be a string, number, null, or undefined.");
2945
2977
  if (e.next !== null && typeof e.next != "string" && typeof e.next != "number") throw TypeError("Vibe page next must be a string, number, or null.");
@@ -2950,22 +2982,22 @@ function $(e, t) {
2950
2982
  let n = new Set(e.map((e) => e.postId));
2951
2983
  return [...e, ...t.filter((e) => n.has(e.postId) ? !1 : (n.add(e.postId), !0))];
2952
2984
  }
2953
- function Tn(e) {
2985
+ function kn(e) {
2954
2986
  return `${typeof e}:${String(e)}`;
2955
2987
  }
2956
- function En(e) {
2957
- return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview?.src ?? ""}` : `id:${Tn(e.mediaId)}`;
2988
+ function An(e) {
2989
+ return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview?.src ?? ""}` : `id:${kn(e.mediaId)}`;
2958
2990
  }
2959
- function Dn(e, t) {
2960
- let n = [...e], r = new Map(e.map((e, t) => [Tn(e.postId), t]));
2991
+ function jn(e, t) {
2992
+ let n = [...e], r = new Map(e.map((e, t) => [kn(e.postId), t]));
2961
2993
  return t.forEach((e) => {
2962
- let t = Tn(e.postId), i = r.get(t);
2994
+ let t = kn(e.postId), i = r.get(t);
2963
2995
  if (i === void 0) {
2964
2996
  r.set(t, n.length), n.push(e);
2965
2997
  return;
2966
2998
  }
2967
- let a = n[i], o = new Set([a, ...a.items].map(En)), s = [e, ...e.items].filter((e) => {
2968
- let t = En(e);
2999
+ let a = n[i], o = new Set([a, ...a.items].map(An)), s = [e, ...e.items].filter((e) => {
3000
+ let t = An(e);
2969
3001
  return o.has(t) ? !1 : (o.add(t), !0);
2970
3002
  });
2971
3003
  s.length > 0 && (n[i] = {
@@ -2974,14 +3006,14 @@ function Dn(e, t) {
2974
3006
  });
2975
3007
  }), n;
2976
3008
  }
2977
- function On(e) {
3009
+ function Mn(e) {
2978
3010
  return Object.prototype.hasOwnProperty.call(e, "current") ? e.current ?? null : e.next;
2979
3011
  }
2980
3012
  //#endregion
2981
3013
  //#region src/core/appendPage.ts
2982
- function kn(e, t, n, r) {
2983
- let i = wn(e), a = n.filterItems(i.items), o = On(i);
2984
- t.items = Dn(t.items, a), t.next = i.next, i.total !== void 0 && (t.total = i.total), r(o), n.recordPages([{
3014
+ function Nn(e, t, n, r) {
3015
+ let i = On(e), a = n.filterItems(i.items), o = Mn(i);
3016
+ t.items = jn(t.items, a), t.next = i.next, i.total !== void 0 && (t.total = i.total), r(o), n.recordPages([{
2985
3017
  contributionIds: a.map(({ postId: e }) => e),
2986
3018
  cursor: o,
2987
3019
  next: i.next,
@@ -2990,32 +3022,32 @@ function kn(e, t, n, r) {
2990
3022
  }
2991
3023
  //#endregion
2992
3024
  //#region src/core/requestDelay.ts
2993
- var An = 2e3, jn = 1e4, Mn = 250, Nn = {
3025
+ var Pn = 2e3, Fn = 1e4, In = 250, Ln = {
2994
3026
  delayRemainingMs: null,
2995
3027
  nextRequestAt: null
2996
3028
  };
2997
- function Pn(e, t) {
3029
+ function Rn(e, t) {
2998
3030
  return e === void 0 ? t : Math.floor(e);
2999
3031
  }
3000
- function Fn(e, t) {
3032
+ function zn(e, t) {
3001
3033
  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.`);
3002
3034
  }
3003
- function In(e, t = {}) {
3004
- let n = Pn(t.delayStepMs, An), r = Pn(t.delayMaxMs, jn);
3035
+ function Bn(e, t = {}) {
3036
+ let n = Rn(t.delayStepMs, Pn), r = Rn(t.delayMaxMs, Fn);
3005
3037
  return Math.min(Math.max(0, e) * n, r);
3006
3038
  }
3007
- function Ln(e) {
3008
- if (e == null || !Number.isFinite(e)) return { ...Nn };
3039
+ function Vn(e) {
3040
+ if (e == null || !Number.isFinite(e)) return { ...Ln };
3009
3041
  let t = Math.max(0, Math.floor(e - Date.now()));
3010
3042
  return t > 0 ? {
3011
3043
  delayRemainingMs: t,
3012
3044
  nextRequestAt: e
3013
- } : { ...Nn };
3045
+ } : { ...Ln };
3014
3046
  }
3015
- async function Rn({ delayMs: e, onChange: t, signal: n }) {
3047
+ async function Hn({ delayMs: e, onChange: t, signal: n }) {
3016
3048
  if (n.aborted) throw new DOMException("Aborted", "AbortError");
3017
3049
  if (e <= 0) {
3018
- t({ ...Nn });
3050
+ t({ ...Ln });
3019
3051
  return;
3020
3052
  }
3021
3053
  let r = Date.now() + e;
@@ -3023,9 +3055,9 @@ async function Rn({ delayMs: e, onChange: t, signal: n }) {
3023
3055
  delayRemainingMs: e,
3024
3056
  nextRequestAt: r
3025
3057
  }), await new Promise((i, a) => {
3026
- let o = !1, s = setInterval(f, Mn), c = setTimeout(() => u(), e);
3058
+ let o = !1, s = setInterval(f, In), c = setTimeout(() => u(), e);
3027
3059
  function l() {
3028
- clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...Nn });
3060
+ clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...Ln });
3029
3061
  }
3030
3062
  function u(e) {
3031
3063
  o || (o = !0, l(), e ? a(e) : i());
@@ -3034,42 +3066,42 @@ async function Rn({ delayMs: e, onChange: t, signal: n }) {
3034
3066
  u(new DOMException("Aborted", "AbortError"));
3035
3067
  }
3036
3068
  function f() {
3037
- let e = Ln(r);
3069
+ let e = Vn(r);
3038
3070
  t(e), e.delayRemainingMs === null && u();
3039
3071
  }
3040
3072
  n.addEventListener("abort", d, { once: !0 });
3041
3073
  });
3042
3074
  }
3043
- var zn = class {
3075
+ var Un = class {
3044
3076
  interval = null;
3045
3077
  constructor(e) {
3046
3078
  this.onChange = e;
3047
3079
  }
3048
3080
  clear() {
3049
- this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...Nn });
3081
+ this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...Ln });
3050
3082
  }
3051
3083
  sync(e) {
3052
3084
  this.clear();
3053
- let t = Ln(e);
3085
+ let t = Vn(e);
3054
3086
  this.onChange(t), t.delayRemainingMs !== null && (this.interval = setInterval(() => {
3055
- let t = Ln(e);
3087
+ let t = Vn(e);
3056
3088
  this.onChange(t), t.delayRemainingMs === null && this.clear();
3057
- }, Mn));
3089
+ }, In));
3058
3090
  }
3059
3091
  };
3060
- function Bn(e, t = !0) {
3092
+ function Wn(e, t = !0) {
3061
3093
  return e.maxAdditionalPages === "unlimited" ? Infinity : (e.maxAdditionalPages ?? 10) + (t ? 1 : 0);
3062
3094
  }
3063
- function Vn(e) {
3095
+ function Gn(e) {
3064
3096
  return `${typeof e}:${String(e)}`;
3065
3097
  }
3066
- function Hn(e, t) {
3098
+ function Kn(e, t) {
3067
3099
  if (!Number.isInteger(e) || e <= 0) throw TypeError(`Vibe ${t} must be a positive integer.`);
3068
3100
  }
3069
- function Un(e) {
3101
+ function qn(e) {
3070
3102
  if (!e) return;
3071
- if (Hn(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
3072
- Fn(e, "frontend autofill");
3103
+ if (Kn(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
3104
+ zn(e, "frontend autofill");
3073
3105
  let t = e.maxAdditionalPages;
3074
3106
  if (t !== void 0 && t !== "unlimited" && (!Number.isInteger(t) || t < 0)) throw TypeError("Vibe autofill maxAdditionalPages must be a non-negative integer or \"unlimited\".");
3075
3107
  return;
@@ -3081,7 +3113,7 @@ function Un(e) {
3081
3113
  if (t.pageSize !== e.pageSize) throw TypeError("Vibe backend autofill initialSession pageSize must match autofill pageSize.");
3082
3114
  }
3083
3115
  }
3084
- function Wn(e, t, n = !0) {
3116
+ function Jn(e, t, n = !0) {
3085
3117
  if (!e) return {
3086
3118
  cycleId: null,
3087
3119
  delayRemainingMs: null,
@@ -3098,7 +3130,7 @@ function Wn(e, t, n = !0) {
3098
3130
  status: "idle",
3099
3131
  strategy: null
3100
3132
  };
3101
- let r = e.strategy === "backend" ? t ?? (n ? e.initialSession : void 0) : void 0, i = r?.received ?? 0, a = Ln(r?.nextRequestAt);
3133
+ let r = e.strategy === "backend" ? t ?? (n ? e.initialSession : void 0) : void 0, i = r?.received ?? 0, a = Vn(r?.nextRequestAt);
3102
3134
  return {
3103
3135
  cycleId: r?.cycleId ?? null,
3104
3136
  ...a,
@@ -3115,7 +3147,7 @@ function Wn(e, t, n = !0) {
3115
3147
  strategy: e.strategy
3116
3148
  };
3117
3149
  }
3118
- function Gn(e) {
3150
+ function Yn(e) {
3119
3151
  return [
3120
3152
  "cancelling",
3121
3153
  "filling",
@@ -3123,9 +3155,9 @@ function Gn(e) {
3123
3155
  "waiting"
3124
3156
  ].includes(e.status);
3125
3157
  }
3126
- async function Kn(e, t, n) {
3158
+ async function Xn(e, t, n) {
3127
3159
  let r = t.autofill;
3128
- if (!Gn(r) || !r.cycleId) return;
3160
+ if (!Yn(r) || !r.cycleId) return;
3129
3161
  let i = {
3130
3162
  cycleId: r.cycleId,
3131
3163
  feedKey: r.feedKey ?? "",
@@ -3138,16 +3170,16 @@ async function Kn(e, t, n) {
3138
3170
  throw r.error = e, r.status = "error", e;
3139
3171
  }
3140
3172
  }
3141
- function qn(e, t, n) {
3173
+ function Zn(e, t, n) {
3142
3174
  return e?.strategy === "backend" && t.feedKey === e.feedKey && t.sessionId === n.sessionId;
3143
3175
  }
3144
- async function Jn({ 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 }) {
3145
- let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ?? Bn(s), g = t, _ = t, v = t, y = 0, b = [], x;
3176
+ async function Qn({ 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 }) {
3177
+ let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ?? Wn(s), g = t, _ = t, v = t, y = 0, b = [], x;
3146
3178
  for (; y < h;) {
3147
- let e = Vn(g);
3179
+ let e = Gn(g);
3148
3180
  if (m.has(e)) throw Error("Vibe autofill received a repeated cursor.");
3149
- if (m.add(e), await Rn({
3150
- delayMs: In(l + y, s),
3181
+ if (m.add(e), await Hn({
3182
+ delayMs: Bn(l + y, s),
3151
3183
  onChange: a,
3152
3184
  signal: d
3153
3185
  }), y > 0 && u()) return {
@@ -3161,7 +3193,7 @@ async function Jn({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
3161
3193
  status: "paused",
3162
3194
  total: x
3163
3195
  };
3164
- let t = wn(await n({
3196
+ let t = On(await n({
3165
3197
  cursor: g,
3166
3198
  signal: d
3167
3199
  }));
@@ -3218,12 +3250,12 @@ async function Jn({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
3218
3250
  }
3219
3251
  //#endregion
3220
3252
  //#region src/core/autofillController.ts
3221
- var Yn = class {
3253
+ var $n = class {
3222
3254
  collection = null;
3223
3255
  cycle = 0;
3224
3256
  delayCountdown;
3225
3257
  constructor(e) {
3226
- this.context = e, this.delayCountdown = new zn((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
3258
+ this.context = e, this.delayCountdown = new Un((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
3227
3259
  }
3228
3260
  beginCycle() {
3229
3261
  let { options: e, state: t } = this.context;
@@ -3231,14 +3263,14 @@ var Yn = class {
3231
3263
  this.clear();
3232
3264
  let n = `vibe-autofill-${Date.now().toString(36)}-${++this.cycle}`;
3233
3265
  return t.autofill = {
3234
- ...Wn(e, void 0, !1),
3266
+ ...Jn(e, void 0, !1),
3235
3267
  cycleId: n,
3236
3268
  status: "filling"
3237
3269
  }, n;
3238
3270
  }
3239
3271
  async cancel() {
3240
3272
  let { cancelRequest: e, options: t, state: n } = this.context;
3241
- await Kn(t, n, e), this.commitCollection();
3273
+ await Xn(t, n, e), this.commitCollection();
3242
3274
  }
3243
3275
  captureCollection(e, t) {
3244
3276
  t && (this.collection = e);
@@ -3266,30 +3298,30 @@ var Yn = class {
3266
3298
  requests: r.requests
3267
3299
  }), !0) : !1;
3268
3300
  }
3269
- }, Xn = 100;
3270
- function Zn(e, t) {
3301
+ }, er = 100;
3302
+ function tr(e, t) {
3271
3303
  if (!Number.isFinite(t) || t <= 0) throw TypeError(`Vibe ${e} must be a positive number.`);
3272
3304
  }
3273
- function Qn(e, t, n) {
3305
+ function nr(e, t, n) {
3274
3306
  return Math.min(n, Math.max(t, e));
3275
3307
  }
3276
- function $n(e) {
3308
+ function rr(e) {
3277
3309
  if (!e) return;
3278
3310
  let t = e.minSpeedPxPerSecond ?? 20, n = e.maxSpeedPxPerSecond ?? 240;
3279
- if (Zn("autoScroll.minSpeedPxPerSecond", t), Zn("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
3280
- e.speedPxPerSecond !== void 0 && Zn("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
3311
+ if (tr("autoScroll.minSpeedPxPerSecond", t), tr("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
3312
+ e.speedPxPerSecond !== void 0 && tr("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
3281
3313
  }
3282
- function er(e) {
3314
+ function ir(e) {
3283
3315
  let t = e?.minSpeedPxPerSecond ?? 20, n = e?.maxSpeedPxPerSecond ?? 240;
3284
3316
  return {
3285
3317
  enabled: e?.enabled ?? !1,
3286
3318
  maxSpeedPxPerSecond: n,
3287
3319
  minSpeedPxPerSecond: t,
3288
3320
  paused: !1,
3289
- speedPxPerSecond: Qn(e?.speedPxPerSecond ?? 80, t, n)
3321
+ speedPxPerSecond: nr(e?.speedPxPerSecond ?? 80, t, n)
3290
3322
  };
3291
3323
  }
3292
- var tr = class {
3324
+ var ar = class {
3293
3325
  frame = null;
3294
3326
  lastTimestamp = null;
3295
3327
  mounted = !1;
@@ -3309,9 +3341,9 @@ var tr = class {
3309
3341
  this.options.state.enabled && (this.options.state.paused = e, this.lastTimestamp = null, e ? this.cancelFrame() : this.schedule());
3310
3342
  }
3311
3343
  setSpeed(e) {
3312
- Zn("auto-scroll speed", e);
3344
+ tr("auto-scroll speed", e);
3313
3345
  let t = this.options.state;
3314
- t.speedPxPerSecond = Qn(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
3346
+ t.speedPxPerSecond = nr(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
3315
3347
  }
3316
3348
  tick = (e) => {
3317
3349
  this.frame = null;
@@ -3323,7 +3355,7 @@ var tr = class {
3323
3355
  return;
3324
3356
  }
3325
3357
  if (this.lastTimestamp !== null) {
3326
- let r = Math.min(Xn, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
3358
+ let r = Math.min(er, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
3327
3359
  n.scrollTop = Math.min(i, n.scrollTop + t.speedPxPerSecond * r / 1e3);
3328
3360
  }
3329
3361
  this.lastTimestamp = e, this.schedule();
@@ -3337,13 +3369,13 @@ var tr = class {
3337
3369
  };
3338
3370
  //#endregion
3339
3371
  //#region src/core/backendAutofill.ts
3340
- async function nr(e, t, n, r) {
3372
+ async function or(e, t, n, r) {
3341
3373
  let i = await e.onUnderfilled(n);
3342
3374
  if (!r()) return;
3343
3375
  if (!i.sessionId.trim()) throw TypeError("Vibe backend autofill requires a sessionId.");
3344
3376
  let a = Math.max(n.received, i.received ?? n.received);
3345
3377
  Object.assign(t.autofill, {
3346
- ...Ln(i.nextRequestAt),
3378
+ ...Vn(i.nextRequestAt),
3347
3379
  missing: Math.max(0, e.pageSize - a),
3348
3380
  received: a,
3349
3381
  sequence: i.sequence ?? 0,
@@ -3351,19 +3383,19 @@ async function nr(e, t, n, r) {
3351
3383
  status: "waiting"
3352
3384
  });
3353
3385
  }
3354
- function rr(e, t) {
3386
+ function sr(e, t) {
3355
3387
  ["complete", "exhausted"].includes(t.status) && t.items && (e.items = $(e.items, t.items)), t.next !== void 0 && (e.next = t.next), t.total !== void 0 && (e.total = t.total);
3356
3388
  }
3357
- function ir(e, t, n) {
3389
+ function cr(e, t, n) {
3358
3390
  let r = t.autofill;
3359
- return !qn(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (rr(t, n), Object.assign(r, Ln(n.status === "waiting" ? n.nextRequestAt : null)), r.error = n.error ?? null, r.missing = Math.max(0, (r.pageSize ?? 0) - n.received), r.received = n.received, n.requests !== void 0 && (r.requests = n.requests), r.sequence = n.sequence, r.status = n.status, !0);
3391
+ return !Zn(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (sr(t, n), Object.assign(r, Vn(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);
3360
3392
  }
3361
- function ar(e, t, n) {
3362
- return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = Wn(e, n), rr(t, n), !0);
3393
+ function lr(e, t, n) {
3394
+ return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = Jn(e, n), sr(t, n), !0);
3363
3395
  }
3364
3396
  //#endregion
3365
3397
  //#region src/core/backlogRestore.ts
3366
- async function or(e, t, n) {
3398
+ async function ur(e, t, n) {
3367
3399
  if (!e) return;
3368
3400
  let r = new AbortController();
3369
3401
  n(r);
@@ -3378,7 +3410,7 @@ async function or(e, t, n) {
3378
3410
  }
3379
3411
  //#endregion
3380
3412
  //#region src/core/initialAutofill.ts
3381
- async function sr({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, onPages: i, options: a, signal: o, state: s }) {
3413
+ async function dr({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, onPages: i, options: a, signal: o, state: s }) {
3382
3414
  let c = a.autofill;
3383
3415
  if (!c) return;
3384
3416
  let l = s.items.length;
@@ -3391,7 +3423,7 @@ async function sr({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
3391
3423
  return;
3392
3424
  }
3393
3425
  if (c.strategy === "backend") {
3394
- await nr(c, s, {
3426
+ await or(c, s, {
3395
3427
  cycleId: e,
3396
3428
  feedKey: c.feedKey,
3397
3429
  items: [...s.items],
@@ -3408,11 +3440,11 @@ async function sr({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
3408
3440
  s.autofill.status = "exhausted";
3409
3441
  return;
3410
3442
  }
3411
- let u = await Jn({
3443
+ let u = await Qn({
3412
3444
  existingItems: s.items,
3413
3445
  initialCursor: s.next,
3414
3446
  loadPage: a.loadPage,
3415
- maximumRequests: Bn(c, !1),
3447
+ maximumRequests: Wn(c, !1),
3416
3448
  onCollection: n,
3417
3449
  onDelayChange: (e) => {
3418
3450
  t() && Object.assign(s.autofill, e);
@@ -3435,13 +3467,13 @@ async function sr({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
3435
3467
  }
3436
3468
  //#endregion
3437
3469
  //#region src/core/fill.ts
3438
- function cr(e) {
3470
+ function fr(e) {
3439
3471
  return "items" in e ? { items: e.items } : "pages" in e ? { pages: e.pages } : { until: "end" };
3440
3472
  }
3441
- function lr(e) {
3473
+ function pr(e) {
3442
3474
  return `${typeof e}:${String(e)}`;
3443
3475
  }
3444
- function ur(e) {
3476
+ function mr(e) {
3445
3477
  if (!e || typeof e != "object") throw TypeError("Vibe fill target must be an object.");
3446
3478
  if ("pages" in e) {
3447
3479
  if (!Number.isInteger(e.pages) || e.pages <= 0) throw TypeError("Vibe fill pages must be a positive integer.");
@@ -3454,21 +3486,21 @@ function ur(e) {
3454
3486
  if ("until" in e && e.until === "end") return { until: "end" };
3455
3487
  throw TypeError("Vibe fill target must be { items }, { pages }, or { until: 'end' }.");
3456
3488
  }
3457
- function dr(e) {
3489
+ function hr(e) {
3458
3490
  if (!e) return;
3459
3491
  if (e.strategy === "frontend") {
3460
- Fn(e, "frontend fill");
3492
+ zn(e, "frontend fill");
3461
3493
  return;
3462
3494
  }
3463
3495
  if (!e.feedKey.trim()) throw TypeError("Vibe backend fill requires a feedKey.");
3464
3496
  let t = e.initialSession;
3465
3497
  if (t) {
3466
3498
  if (t.feedKey !== e.feedKey) throw TypeError("Vibe backend fill initialSession feedKey must match fill feedKey.");
3467
- ur(t.target);
3499
+ mr(t.target);
3468
3500
  }
3469
3501
  }
3470
- function fr(e, t, n = !0) {
3471
- let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a = Ln(i?.nextRequestAt);
3502
+ function gr(e, t, n = !0) {
3503
+ let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a = Vn(i?.nextRequestAt);
3472
3504
  return {
3473
3505
  completedPages: i?.completedPages ?? 0,
3474
3506
  cycleId: i?.cycleId ?? null,
@@ -3481,10 +3513,10 @@ function fr(e, t, n = !0) {
3481
3513
  sessionId: i?.sessionId ?? null,
3482
3514
  status: i?.status ?? "idle",
3483
3515
  strategy: e?.strategy ?? null,
3484
- target: i ? cr(i.target) : null
3516
+ target: i ? fr(i.target) : null
3485
3517
  };
3486
3518
  }
3487
- function pr(e) {
3519
+ function _r(e) {
3488
3520
  return [
3489
3521
  "cancelling",
3490
3522
  "filling",
@@ -3492,7 +3524,7 @@ function pr(e) {
3492
3524
  "waiting"
3493
3525
  ].includes(e.status);
3494
3526
  }
3495
- async function mr({ existingItems: e, initialCursor: t, loadPage: n, onCollection: r = () => void 0, onDelayChange: i, onProgress: a, options: o, shouldPause: s = () => !1, signal: c, target: l }) {
3527
+ async function vr({ existingItems: e, initialCursor: t, loadPage: n, onCollection: r = () => void 0, onDelayChange: i, onProgress: a, options: o, shouldPause: s = () => !1, signal: c, target: l }) {
3496
3528
  let u = [], d = [], f = [...e], p = /* @__PURE__ */ new Set(), m = 0, h = t, g = t, _ = t, v = 0, y;
3497
3529
  if ("items" in l && f.length >= l.items) return {
3498
3530
  completedPages: m,
@@ -3504,10 +3536,10 @@ async function mr({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
3504
3536
  status: "complete"
3505
3537
  };
3506
3538
  for (; _ !== null;) {
3507
- let e = lr(h);
3539
+ let e = pr(h);
3508
3540
  if (p.has(e)) throw Error("Vibe fill received a repeated cursor.");
3509
- if (p.add(e), await Rn({
3510
- delayMs: In(m, o),
3541
+ if (p.add(e), await Hn({
3542
+ delayMs: Bn(m, o),
3511
3543
  onChange: i,
3512
3544
  signal: c
3513
3545
  }), m > 0 && s()) return {
@@ -3520,7 +3552,7 @@ async function mr({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
3520
3552
  status: "paused",
3521
3553
  total: y
3522
3554
  };
3523
- let t = wn(await n({
3555
+ let t = On(await n({
3524
3556
  cursor: h,
3525
3557
  signal: c
3526
3558
  }));
@@ -3588,12 +3620,12 @@ async function mr({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
3588
3620
  }
3589
3621
  //#endregion
3590
3622
  //#region src/core/backendFill.ts
3591
- async function hr(e, t, n, r) {
3623
+ async function yr(e, t, n, r) {
3592
3624
  let i = await e.onStart(n);
3593
3625
  if (r()) {
3594
3626
  if (!i.sessionId.trim()) throw TypeError("Vibe backend fill requires a sessionId.");
3595
3627
  Object.assign(t.fill, {
3596
- ...Ln(i.nextRequestAt),
3628
+ ...Vn(i.nextRequestAt),
3597
3629
  completedPages: i.completedPages ?? 0,
3598
3630
  received: i.received ?? 0,
3599
3631
  sequence: i.sequence ?? 0,
@@ -3602,23 +3634,23 @@ async function hr(e, t, n, r) {
3602
3634
  });
3603
3635
  }
3604
3636
  }
3605
- function gr(e, t, n) {
3637
+ function br(e, t, n) {
3606
3638
  return e?.strategy === "backend" && n.feedKey === e.feedKey && n.sessionId === t.fill.sessionId;
3607
3639
  }
3608
- function _r(e) {
3640
+ function xr(e) {
3609
3641
  return Number.isInteger(e.completedPages) && e.completedPages >= 0 && Number.isInteger(e.received) && e.received >= 0 && Number.isInteger(e.sequence) && e.sequence >= 0;
3610
3642
  }
3611
- function vr(e, t) {
3643
+ function Sr(e, t) {
3612
3644
  if (!["complete", "exhausted"].includes(t.status)) return !0;
3613
3645
  let n = e.fill.target;
3614
3646
  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;
3615
3647
  }
3616
- function yr(e, t, n) {
3648
+ function Cr(e, t, n) {
3617
3649
  t.total !== void 0 && (e.total = t.total), ["complete", "exhausted"].includes(t.status) && (e.items = $(e.items, t.items ?? []), e.next = t.next ?? null, n(t.lastCursor ?? null));
3618
3650
  }
3619
- function br(e, t, n, r) {
3620
- return !gr(e, t, n) || !_r(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !vr(t, n) ? !1 : (yr(t, n, r), Object.assign(t.fill, {
3621
- ...Ln(n.status === "waiting" ? n.nextRequestAt : null),
3651
+ function wr(e, t, n, r) {
3652
+ return !br(e, t, n) || !xr(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !Sr(t, n) ? !1 : (Cr(t, n, r), Object.assign(t.fill, {
3653
+ ...Vn(n.status === "waiting" ? n.nextRequestAt : null),
3622
3654
  completedPages: n.completedPages,
3623
3655
  error: n.error ?? null,
3624
3656
  received: n.received,
@@ -3626,45 +3658,45 @@ function br(e, t, n, r) {
3626
3658
  status: n.status
3627
3659
  }), !0);
3628
3660
  }
3629
- function xr(e, t, n, r) {
3661
+ function Tr(e, t, n, r) {
3630
3662
  if (e?.strategy !== "backend" || n.feedKey !== e.feedKey) return !1;
3631
3663
  let i = t.fill;
3632
- return t.fill = fr(e, n), !_r(n) || !vr(t, n) ? (t.fill = i, !1) : (yr(t, n, r), !0);
3664
+ return t.fill = gr(e, n), !xr(n) || !Sr(t, n) ? (t.fill = i, !1) : (Cr(t, n, r), !0);
3633
3665
  }
3634
3666
  //#endregion
3635
3667
  //#region src/core/fillController.ts
3636
- var Sr = class {
3668
+ var Er = class {
3637
3669
  abortController = null;
3638
3670
  cycle = 0;
3639
3671
  delayCountdown;
3640
3672
  requestVersion = 0;
3641
3673
  collection = null;
3642
3674
  constructor(e) {
3643
- this.options = e, this.delayCountdown = new zn((e) => {
3675
+ this.options = e, this.delayCountdown = new Un((e) => {
3644
3676
  Object.assign(this.options.state.fill, e);
3645
3677
  }), this.syncBackendCountdown();
3646
3678
  }
3647
3679
  isActive() {
3648
- return pr(this.options.state.fill);
3680
+ return _r(this.options.state.fill);
3649
3681
  }
3650
3682
  applyUpdate(e) {
3651
- let t = br(this.options.fill, this.options.state, e, this.options.onLastCursor);
3683
+ let t = wr(this.options.fill, this.options.state, e, this.options.onLastCursor);
3652
3684
  return t && this.syncBackendCountdown(), t;
3653
3685
  }
3654
3686
  restoreSession(e) {
3655
- let t = xr(this.options.fill, this.options.state, e, this.options.onLastCursor);
3687
+ let t = Tr(this.options.fill, this.options.state, e, this.options.onLastCursor);
3656
3688
  return t && this.syncBackendCountdown(), t;
3657
3689
  }
3658
3690
  async start(e, t = {}) {
3659
3691
  let n = this.options.fill;
3660
3692
  if (!n) throw Error("Vibe fill is not configured.");
3661
3693
  if (this.isActive()) throw Error("Vibe fill is already active.");
3662
- let r = ur(e), i = ur(t.target ?? r), a = t.progressOffset ?? {
3694
+ let r = mr(e), i = mr(t.target ?? r), a = t.progressOffset ?? {
3663
3695
  completedPages: 0,
3664
3696
  received: 0
3665
3697
  }, o = t.cycleId ?? `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
3666
3698
  if (this.options.state.fill = {
3667
- ...fr(n, void 0, !1),
3699
+ ...gr(n, void 0, !1),
3668
3700
  completedPages: a.completedPages,
3669
3701
  cycleId: o,
3670
3702
  received: a.received,
@@ -3677,7 +3709,7 @@ var Sr = class {
3677
3709
  let s = ++this.requestVersion, c = new AbortController();
3678
3710
  this.abortController = c;
3679
3711
  try {
3680
- n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await hr(n, this.options.state, {
3712
+ n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await yr(n, this.options.state, {
3681
3713
  cycleId: o,
3682
3714
  feedKey: n.feedKey,
3683
3715
  items: [...this.options.state.items],
@@ -3695,7 +3727,7 @@ var Sr = class {
3695
3727
  }
3696
3728
  async cancel() {
3697
3729
  let { fill: e, state: t } = this.options;
3698
- if (!pr(t.fill) || !t.fill.cycleId) return;
3730
+ if (!_r(t.fill) || !t.fill.cycleId) return;
3699
3731
  let n = {
3700
3732
  cycleId: t.fill.cycleId,
3701
3733
  feedKey: t.fill.feedKey ?? "",
@@ -3739,7 +3771,7 @@ var Sr = class {
3739
3771
  });
3740
3772
  }
3741
3773
  reset() {
3742
- this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = fr(this.options.fill, void 0, !1), this.collection = null;
3774
+ this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = gr(this.options.fill, void 0, !1), this.collection = null;
3743
3775
  }
3744
3776
  destroy() {
3745
3777
  this.abortLocalRequest(), this.delayCountdown.clear();
@@ -3774,7 +3806,7 @@ var Sr = class {
3774
3806
  s.fill.status = "until" in t ? "complete" : "exhausted";
3775
3807
  return;
3776
3808
  }
3777
- let c = await mr({
3809
+ let c = await vr({
3778
3810
  existingItems: s.items,
3779
3811
  initialCursor: s.next,
3780
3812
  loadPage: o,
@@ -3822,7 +3854,7 @@ var Sr = class {
3822
3854
  };
3823
3855
  //#endregion
3824
3856
  //#region src/core/fillReconciliation.ts
3825
- async function Cr({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r, setLastCursor: i, signal: a, state: o }) {
3857
+ async function Dr({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r, setLastCursor: i, signal: a, state: o }) {
3826
3858
  if (!e.needsReconciliation(o.items)) return "skipped";
3827
3859
  let s = await e.reconcile({
3828
3860
  existingItems: o.items,
@@ -3835,7 +3867,7 @@ async function Cr({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r,
3835
3867
  }
3836
3868
  //#endregion
3837
3869
  //#region src/core/feedFooter.ts
3838
- function wr(e) {
3870
+ function Or(e) {
3839
3871
  return {
3840
3872
  cancelAutofill: () => e.cancelAutofill(),
3841
3873
  loadMore: () => e.loadNext(),
@@ -3847,46 +3879,46 @@ function wr(e) {
3847
3879
  retryFill: () => e.retryFill()
3848
3880
  };
3849
3881
  }
3850
- function Tr(e) {
3882
+ function kr(e) {
3851
3883
  if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
3852
3884
  }
3853
- function Er(e) {
3854
- e?.intervalMs !== void 0 && Tr(e.intervalMs);
3885
+ function Ar(e) {
3886
+ e?.intervalMs !== void 0 && kr(e.intervalMs);
3855
3887
  }
3856
- function Dr(e) {
3888
+ function jr(e) {
3857
3889
  return {
3858
3890
  enabled: e?.enabled ?? !1,
3859
3891
  includePostItems: e?.includePostItems ?? !1,
3860
3892
  intervalMs: e?.intervalMs ?? 5e3
3861
3893
  };
3862
3894
  }
3863
- function Or(e, t) {
3895
+ function Mr(e, t) {
3864
3896
  if (typeof t == "boolean") {
3865
3897
  e.enabled = t;
3866
3898
  return;
3867
3899
  }
3868
- Er(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);
3900
+ Ar(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);
3869
3901
  }
3870
3902
  //#endregion
3871
3903
  //#region src/core/reelInfoSheet.ts
3872
- function kr(e) {
3904
+ function Nr(e) {
3873
3905
  return { enabled: e?.enabled ?? !1 };
3874
3906
  }
3875
- function Ar(e, t, n) {
3907
+ function Pr(e, t, n) {
3876
3908
  if (n && !t) throw Error("Vibe cannot enable reelInfoSheet without a configured component.");
3877
3909
  e.enabled = n;
3878
3910
  }
3879
3911
  //#endregion
3880
3912
  //#region src/core/initialRuntimeState.ts
3881
- function jr(e, t) {
3913
+ function Fr(e, t) {
3882
3914
  let n = e.initialPage;
3883
3915
  return {
3884
3916
  activeReelPostId: null,
3885
- autoScroll: er(e.autoScroll),
3886
- autofill: Wn(e.autofill),
3917
+ autoScroll: ir(e.autoScroll),
3918
+ autofill: Jn(e.autofill),
3887
3919
  current: n?.current ?? null,
3888
3920
  error: null,
3889
- fill: fr(e.fill),
3921
+ fill: gr(e.fill),
3890
3922
  infiniteScroll: e.infiniteScroll ?? !0,
3891
3923
  isLoading: !n,
3892
3924
  isLoadingMore: !1,
@@ -3897,14 +3929,14 @@ function jr(e, t) {
3897
3929
  next: n?.next ?? null,
3898
3930
  nextPageError: null,
3899
3931
  phoneMode: !1,
3900
- reelAutoAdvance: Dr(e.reelAutoAdvance),
3932
+ reelAutoAdvance: jr(e.reelAutoAdvance),
3901
3933
  reelForward: {
3902
3934
  error: null,
3903
3935
  status: "idle"
3904
3936
  },
3905
3937
  reelForwardIndex: null,
3906
3938
  reelForwardItem: null,
3907
- reelInfoSheet: kr(e.reelInfoSheet),
3939
+ reelInfoSheet: Nr(e.reelInfoSheet),
3908
3940
  reelInfoSheetOverlay: !1,
3909
3941
  reelMediaSource: "original",
3910
3942
  reelOrigin: null,
@@ -3913,21 +3945,21 @@ function jr(e, t) {
3913
3945
  }
3914
3946
  //#endregion
3915
3947
  //#region src/core/options.ts
3916
- function Mr(e, t) {
3948
+ function Ir(e, t) {
3917
3949
  if (t) {
3918
3950
  if (!Number.isFinite(t.height) || t.height <= 0) throw TypeError(`Vibe ${e} height must be a positive number.`);
3919
3951
  if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe ${e} background must be "default" or "transparent".`);
3920
3952
  }
3921
3953
  }
3922
- function Nr(e, t) {
3954
+ function Lr(e, t) {
3923
3955
  if (t) {
3924
3956
  if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe mediaCard ${e} background must be "default" or "transparent".`);
3925
3957
  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.`);
3926
3958
  }
3927
3959
  }
3928
- function Pr(e) {
3929
- if ($n(e.autoScroll), Mr("cardHeader", e.cardHeader), Mr("cardFooter", e.cardFooter), Nr("header", e.mediaCard?.header), Nr("footer", e.mediaCard?.footer), e.mediaCard?.feedPreload !== void 0 && e.mediaCard.feedPreload !== "none" && e.mediaCard.feedPreload !== "visible-post") throw TypeError("Vibe mediaCard feedPreload must be \"none\" or \"visible-post\".");
3930
- if (Un(e.autofill), dr(e.fill), he(e.masonry), Er(e.reelAutoAdvance), e.removalReconciliation) {
3960
+ function Rr(e) {
3961
+ if (rr(e.autoScroll), Ir("cardHeader", e.cardHeader), Ir("cardFooter", e.cardFooter), Lr("header", e.mediaCard?.header), Lr("footer", e.mediaCard?.footer), e.mediaCard?.feedPreload !== void 0 && e.mediaCard.feedPreload !== "none" && e.mediaCard.feedPreload !== "visible-post") throw TypeError("Vibe mediaCard feedPreload must be \"none\" or \"visible-post\".");
3962
+ if (qn(e.autofill), hr(e.fill), ve(e.masonry), Ar(e.reelAutoAdvance), e.removalReconciliation) {
3931
3963
  if (!Number.isInteger(e.removalReconciliation.pageSize) || e.removalReconciliation.pageSize <= 0) throw TypeError("Vibe removalReconciliation pageSize must be a positive integer.");
3932
3964
  let t = e.removalReconciliation.maxReplayPages ?? 5;
3933
3965
  if (!Number.isInteger(t) || t <= 0) throw TypeError("Vibe removalReconciliation maxReplayPages must be a positive integer.");
@@ -3942,7 +3974,7 @@ function Pr(e) {
3942
3974
  if (e.fill?.strategy === "frontend" && !e.loadPage) throw TypeError("Vibe frontend fill requires loadPage.");
3943
3975
  if (e.fill?.strategy === "backend" && e.fill.initialSession && !e.initialPage) throw TypeError("Vibe backend fill restoration requires initialPage.");
3944
3976
  }
3945
- function Fr(e) {
3977
+ function zr(e) {
3946
3978
  if (typeof e != "string") return e;
3947
3979
  if (typeof document > "u") throw Error("Vibe cannot resolve a selector without a document.");
3948
3980
  let t = document.querySelector(e);
@@ -3951,7 +3983,7 @@ function Fr(e) {
3951
3983
  }
3952
3984
  //#endregion
3953
3985
  //#region src/core/pageRequest.ts
3954
- async function Ir({ append: e, autofillController: t, cursor: n, isCurrent: r, loadPage: i, onLastCursor: a, onPages: o, options: s, signal: c, state: l }) {
3986
+ async function Br({ append: e, autofillController: t, cursor: n, isCurrent: r, loadPage: i, onLastCursor: a, onPages: o, options: s, signal: c, state: l }) {
3955
3987
  let u = s.autofill, d = e && u?.strategy === "frontend" && (l.autofill.status === "paused" || l.autofill.status === "error"), f = d ? {
3956
3988
  received: l.autofill.received,
3957
3989
  requests: l.autofill.requests
@@ -3963,11 +3995,11 @@ async function Ir({ append: e, autofillController: t, cursor: n, isCurrent: r, l
3963
3995
  let m = !1;
3964
3996
  try {
3965
3997
  if (u?.strategy === "frontend") {
3966
- let s = await Jn({
3998
+ let s = await Qn({
3967
3999
  existingItems: e ? l.items : [],
3968
4000
  initialCursor: n,
3969
4001
  loadPage: i,
3970
- maximumRequests: f ? Math.max(0, Bn(u) - f.requests) : void 0,
4002
+ maximumRequests: f ? Math.max(0, Wn(u) - f.requests) : void 0,
3971
4003
  onCollection: (e) => t.captureCollection(e, r()),
3972
4004
  onDelayChange: (e) => {
3973
4005
  r() && Object.assign(l.autofill, e);
@@ -3990,7 +4022,7 @@ async function Ir({ append: e, autofillController: t, cursor: n, isCurrent: r, l
3990
4022
  }), o(s.pages), t.clearCollection();
3991
4023
  return;
3992
4024
  }
3993
- let s = wn(await i({
4025
+ let s = On(await i({
3994
4026
  cursor: n,
3995
4027
  signal: c
3996
4028
  }));
@@ -4010,7 +4042,7 @@ async function Ir({ append: e, autofillController: t, cursor: n, isCurrent: r, l
4010
4042
  l.autofill.status = "complete";
4011
4043
  return;
4012
4044
  }
4013
- await nr(u, l, {
4045
+ await or(u, l, {
4014
4046
  cycleId: p,
4015
4047
  feedKey: u.feedKey,
4016
4048
  items: h.slice(d.length),
@@ -4032,16 +4064,16 @@ async function Ir({ append: e, autofillController: t, cursor: n, isCurrent: r, l
4032
4064
  }
4033
4065
  //#endregion
4034
4066
  //#region src/core/removalReconciliationController.ts
4035
- function Lr(e) {
4067
+ function Vr(e) {
4036
4068
  return `${typeof e}:${String(e)}`;
4037
4069
  }
4038
- function Rr(e) {
4070
+ function Hr(e) {
4039
4071
  return `${typeof e}:${String(e)}`;
4040
4072
  }
4041
- function zr(e) {
4073
+ function Ur(e) {
4042
4074
  return e.map(({ postId: e }) => e);
4043
4075
  }
4044
- var Br = class {
4076
+ var Wr = class {
4045
4077
  delay;
4046
4078
  enabled;
4047
4079
  maxReplayPages;
@@ -4060,7 +4092,7 @@ var Br = class {
4060
4092
  e.status === "complete" && (this.pages = [...this.pages.slice(0, e.replaceFrom), ...e.pages].slice(-this.maxReplayPages), this.pending = null);
4061
4093
  }
4062
4094
  filterItems(e) {
4063
- return this.tombstones.size === 0 ? [...e] : e.filter(({ postId: e }) => !this.tombstones.has(Lr(e)));
4095
+ return this.tombstones.size === 0 ? [...e] : e.filter(({ postId: e }) => !this.tombstones.has(Vr(e)));
4064
4096
  }
4065
4097
  needsReconciliation(e) {
4066
4098
  return this.pending !== null || this.findUnderfilledPage(e) >= 0;
@@ -4073,45 +4105,45 @@ var Br = class {
4073
4105
  }
4074
4106
  recordInitialPage(e) {
4075
4107
  e && this.recordPages([{
4076
- contributionIds: zr(e.items),
4077
- cursor: On(e),
4108
+ contributionIds: Ur(e.items),
4109
+ cursor: Mn(e),
4078
4110
  next: e.next,
4079
- returnedIds: zr(e.items)
4111
+ returnedIds: Ur(e.items)
4080
4112
  }]);
4081
4113
  }
4082
4114
  remove(e) {
4083
- e.forEach((e) => this.tombstones.add(Lr(e)));
4115
+ e.forEach((e) => this.tombstones.add(Vr(e)));
4084
4116
  }
4085
4117
  reset() {
4086
4118
  this.pages = [], this.pending = null, this.tombstones.clear();
4087
4119
  }
4088
4120
  restore(e) {
4089
- e.forEach((e) => this.tombstones.delete(Lr(e)));
4121
+ e.forEach((e) => this.tombstones.delete(Vr(e)));
4090
4122
  }
4091
4123
  async reconcile({ existingItems: e, loadPage: t, onDelayChange: n = () => void 0, shouldPause: r = () => !1, signal: i }) {
4092
4124
  let a = this.pending ?? this.createSession(e);
4093
4125
  for (this.pending = a; a.remainingRequests > 0;) {
4094
- let e = Rr(a.cursor);
4126
+ let e = Hr(a.cursor);
4095
4127
  if (a.seenCursors.has(e)) throw Error("Vibe removal reconciliation received a repeated cursor.");
4096
- if (await Rn({
4097
- delayMs: In(a.pages.length, this.delay),
4128
+ if (await Hn({
4129
+ delayMs: Bn(a.pages.length, this.delay),
4098
4130
  onChange: n,
4099
4131
  signal: i
4100
4132
  }), a.pages.length > 0 && r()) return this.result(a, "paused");
4101
- let o = wn(await t({
4133
+ let o = On(await t({
4102
4134
  cursor: a.cursor,
4103
4135
  signal: i
4104
4136
  }));
4105
4137
  a.seenCursors.add(e);
4106
4138
  let s = this.filterItems(o.items), c = [];
4107
4139
  if (s.forEach((e) => {
4108
- let t = Lr(e.postId);
4140
+ let t = Vr(e.postId);
4109
4141
  a.attributed.has(t) || (a.attributed.add(t), c.push(e.postId)), a.appended.has(t) || (a.appended.add(t), a.items.push(e));
4110
4142
  }), a.pages.push({
4111
4143
  contributionIds: c,
4112
4144
  cursor: a.cursor,
4113
4145
  next: o.next,
4114
- returnedIds: zr(s)
4146
+ returnedIds: Ur(s)
4115
4147
  }), a.lastCursor = a.cursor, a.next = o.next, --a.remainingRequests, o.total !== void 0 && (a.total = o.total), a.next === null ? a.remainingRequests = 0 : a.cursor = a.next, a.remainingRequests > 0 && r()) return this.result(a, "paused");
4116
4148
  }
4117
4149
  return this.result(a, "complete");
@@ -4119,9 +4151,9 @@ var Br = class {
4119
4151
  createSession(e) {
4120
4152
  let t = this.findUnderfilledPage(e), n = t < 0 ? [] : this.pages.slice(t), r = n[0];
4121
4153
  if (!r) throw Error("Vibe has no underfilled provider page to reconcile.");
4122
- let i = new Set(n.flatMap(({ contributionIds: e }) => e.map(Lr))), a = new Set(e.map(({ postId: e }) => Lr(e)).filter((e) => !i.has(e)));
4154
+ let i = new Set(n.flatMap(({ contributionIds: e }) => e.map(Vr))), a = new Set(e.map(({ postId: e }) => Vr(e)).filter((e) => !i.has(e)));
4123
4155
  return {
4124
- appended: new Set(e.map(({ postId: e }) => Lr(e))),
4156
+ appended: new Set(e.map(({ postId: e }) => Vr(e))),
4125
4157
  attributed: new Set(a),
4126
4158
  cursor: r.cursor,
4127
4159
  items: [],
@@ -4146,11 +4178,11 @@ var Br = class {
4146
4178
  }
4147
4179
  findUnderfilledPage(e) {
4148
4180
  if (!this.enabled || this.pages.length === 0) return -1;
4149
- let t = new Set(e.map(({ postId: e }) => Lr(e)));
4150
- return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has(Lr(e))).length < this.pageSize);
4181
+ let t = new Set(e.map(({ postId: e }) => Vr(e)));
4182
+ return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has(Vr(e))).length < this.pageSize);
4151
4183
  }
4152
4184
  recordPage(e) {
4153
- let t = Rr(e.cursor), n = this.pages.findIndex(({ cursor: e }) => Rr(e) === t);
4185
+ let t = Hr(e.cursor), n = this.pages.findIndex(({ cursor: e }) => Hr(e) === t);
4154
4186
  n >= 0 && (this.pages = this.pages.slice(0, n)), this.pages.push({
4155
4187
  ...e,
4156
4188
  contributionIds: [...e.contributionIds],
@@ -4160,7 +4192,7 @@ var Br = class {
4160
4192
  };
4161
4193
  //#endregion
4162
4194
  //#region src/core/activeItemRemoval.ts
4163
- function Vr(e, t, n, r, i) {
4195
+ function Gr(e, t, n, r, i) {
4164
4196
  let a = new Set(t.map(({ item: e }) => e.postId));
4165
4197
  if (e.activeReelPostId === null || !a.has(e.activeReelPostId)) return;
4166
4198
  let o = e.items[Math.max(n, 0)];
@@ -4173,7 +4205,7 @@ function Vr(e, t, n, r, i) {
4173
4205
  }
4174
4206
  //#endregion
4175
4207
  //#region src/core/exactMediaRemovalController.ts
4176
- function Hr(e, t) {
4208
+ function Kr(e, t) {
4177
4209
  let [n, ...r] = t;
4178
4210
  if (!n) throw Error("Vibe items must contain at least one media asset.");
4179
4211
  return {
@@ -4182,10 +4214,10 @@ function Hr(e, t) {
4182
4214
  items: r
4183
4215
  };
4184
4216
  }
4185
- function Ur(e) {
4217
+ function qr(e) {
4186
4218
  if (!Number.isInteger(e.mediaIndex) || e.mediaIndex < 0) throw TypeError("Vibe mediaIndex must be a non-negative integer.");
4187
4219
  }
4188
- var Wr = class {
4220
+ var Jr = class {
4189
4221
  generation = 0;
4190
4222
  metadata = /* @__PURE__ */ new WeakMap();
4191
4223
  state;
@@ -4193,10 +4225,10 @@ var Wr = class {
4193
4225
  this.options = e, this.state = e.state;
4194
4226
  }
4195
4227
  remove(e) {
4196
- Ur(e);
4228
+ qr(e);
4197
4229
  let t = this.state.items.findIndex(({ postId: t }) => t === e.postId), n = this.state.items[t];
4198
4230
  if (!n) return null;
4199
- let r = [...V(n)], i = r[e.mediaIndex];
4231
+ let r = [...H(n)], i = r[e.mediaIndex];
4200
4232
  if (!i) return null;
4201
4233
  let a = Object.freeze({
4202
4234
  media: i,
@@ -4210,7 +4242,7 @@ var Wr = class {
4210
4242
  restored: !1
4211
4243
  });
4212
4244
  let o = this.state.mediaIndices.get(n.postId) ?? 0, s = this.isReelOpen() && this.state.activeReelPostId === n.postId, c = s && o === e.mediaIndex;
4213
- return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = Hr(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);
4245
+ return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = Kr(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);
4214
4246
  }
4215
4247
  reset() {
4216
4248
  this.generation += 1;
@@ -4235,32 +4267,32 @@ var Wr = class {
4235
4267
  return this.state.layout === "reel" || this.state.reelOrigin === "masonry";
4236
4268
  }
4237
4269
  restoreIntoPost(e, t) {
4238
- let n = this.state.items[e], r = [...V(n)], i = Math.min(t.mediaIndex, r.length);
4239
- if (r.splice(i, 0, t.media), this.state.items[e] = Hr(n, r), this.state.activeReelPostId !== t.postId) return;
4270
+ let n = this.state.items[e], r = [...H(n)], i = Math.min(t.mediaIndex, r.length);
4271
+ if (r.splice(i, 0, t.media), this.state.items[e] = Kr(n, r), this.state.activeReelPostId !== t.postId) return;
4240
4272
  let a = this.state.mediaIndices.get(t.postId) ?? 0;
4241
4273
  a >= i && this.state.mediaIndices.set(t.postId, a + 1);
4242
4274
  }
4243
4275
  updateMediaIndexAfterRemoval(e, t, n) {
4244
4276
  let r = this.state.items.find((t) => t.postId === e);
4245
4277
  if (!r) return;
4246
- let i = V(r).length, a = this.state.mediaIndices.get(e) ?? 0, o = a;
4278
+ let i = H(r).length, a = this.state.mediaIndices.get(e) ?? 0, o = a;
4247
4279
  n ? o = t < i ? t : 0 : t < a && (o = a - 1), this.state.mediaIndices.set(e, Math.min(o, i - 1));
4248
4280
  }
4249
4281
  };
4250
4282
  //#endregion
4251
4283
  //#region src/core/itemPlacement.ts
4252
- function Gr(e, t) {
4284
+ function Yr(e, t) {
4253
4285
  let n = new Set(t);
4254
4286
  return e.flatMap((e, t) => n.has(e.postId) ? [{
4255
4287
  index: t,
4256
4288
  item: e
4257
4289
  }] : []);
4258
4290
  }
4259
- function Kr(e, t) {
4291
+ function Xr(e, t) {
4260
4292
  let n = new Set(t.map(({ item: e }) => e.postId));
4261
4293
  return e.filter((e) => !n.has(e.postId));
4262
4294
  }
4263
- function qr(e, t) {
4295
+ function Zr(e, t) {
4264
4296
  t.forEach(({ index: e }) => {
4265
4297
  if (!Number.isInteger(e) || e < 0) throw Error("Vibe item restore indexes must be non-negative integers.");
4266
4298
  });
@@ -4271,7 +4303,7 @@ function qr(e, t) {
4271
4303
  }
4272
4304
  //#endregion
4273
4305
  //#region src/core/itemRemovalController.ts
4274
- var Jr = 20, Yr = class {
4306
+ var Qr = 20, $r = class {
4275
4307
  generation = 0;
4276
4308
  historyLimit;
4277
4309
  metadata = /* @__PURE__ */ new WeakMap();
@@ -4280,7 +4312,7 @@ var Jr = 20, Yr = class {
4280
4312
  itemOrder;
4281
4313
  stopItemsWatcher;
4282
4314
  constructor(e) {
4283
- this.options = e, this.historyLimit = e.historyLimit ?? Jr, 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" });
4315
+ this.options = e, this.historyLimit = e.historyLimit ?? Qr, 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" });
4284
4316
  }
4285
4317
  destroy() {
4286
4318
  this.reset(), this.stopItemsWatcher();
@@ -4294,7 +4326,7 @@ var Jr = 20, Yr = class {
4294
4326
  let a = this.options.startRemoval(i, t);
4295
4327
  if (a > 0 && await new Promise((e) => setTimeout(e, a)), this.metadata.get(r)?.generation !== this.generation) return r;
4296
4328
  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);
4297
- return this.state.items = Kr(this.state.items, n), this.options.onItemsRemoved(r, n, l), this.record(r), r;
4329
+ return this.state.items = Xr(this.state.items, n), this.options.onItemsRemoved(r, n, l), this.record(r), r;
4298
4330
  }
4299
4331
  reset() {
4300
4332
  this.generation += 1, this.history = [], this.itemOrder = [];
@@ -4305,7 +4337,7 @@ var Jr = 20, Yr = class {
4305
4337
  this.restoreRemoval(t);
4306
4338
  return;
4307
4339
  }
4308
- 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 = qr(this.state.items, r);
4340
+ 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 = Zr(this.state.items, r);
4309
4341
  this.registerExternalPlacements(r), this.state.items = i, r.length > 0 && this.options.onRemovalRestored(r);
4310
4342
  }
4311
4343
  restoreRemoval(e) {
@@ -4331,7 +4363,7 @@ var Jr = 20, Yr = class {
4331
4363
  }
4332
4364
  collectOrderedPlacements(e) {
4333
4365
  let t = new Map(this.itemOrder.map((e, t) => [e, t]));
4334
- return Gr(this.state.items, e).map((e) => ({
4366
+ return Yr(this.state.items, e).map((e) => ({
4335
4367
  index: t.get(e.item.postId) ?? e.index,
4336
4368
  item: e.item
4337
4369
  }));
@@ -4362,7 +4394,7 @@ var Jr = 20, Yr = class {
4362
4394
  let r = new Map(this.itemOrder.map((e, t) => [e, t]));
4363
4395
  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;
4364
4396
  }
4365
- }, Xr = class {
4397
+ }, ei = class {
4366
4398
  forward = null;
4367
4399
  forwardPromise = null;
4368
4400
  forwardVersion = 0;
@@ -4449,7 +4481,7 @@ var Jr = 20, Yr = class {
4449
4481
  }
4450
4482
  }
4451
4483
  }
4452
- }, Zr = class {
4484
+ }, ti = class {
4453
4485
  generation = 0;
4454
4486
  pending = Promise.resolve();
4455
4487
  constructor(e) {
@@ -4466,7 +4498,7 @@ var Jr = 20, Yr = class {
4466
4498
  if (!n) return;
4467
4499
  let r = t.mediaIndices.get(e.postId) ?? 0;
4468
4500
  if (e.mediaIndex === r) {
4469
- if (V(n).length > 1) {
4501
+ if (H(n).length > 1) {
4470
4502
  await this.options.transitionMedia(1);
4471
4503
  return;
4472
4504
  }
@@ -4499,24 +4531,24 @@ var Jr = 20, Yr = class {
4499
4531
  };
4500
4532
  //#endregion
4501
4533
  //#region src/core/removalControllers.ts
4502
- function Qr(e) {
4503
- let t = new Xr(e), n = new Zr({
4534
+ function ni(e) {
4535
+ let t = new ei(e), n = new ti({
4504
4536
  state: e.state,
4505
4537
  transitionMedia: (t) => e.surface()?.transitionActiveReelMedia(t) ?? Promise.resolve(!1),
4506
4538
  transitionPost: (t) => e.surface()?.transitionActiveReelPost(t) ?? Promise.resolve(!1)
4507
4539
  });
4508
4540
  return {
4509
- exactMediaRemoval: new Wr({
4541
+ exactMediaRemoval: new Jr({
4510
4542
  onActivate: e.onActivate,
4511
4543
  onPostRemoved: (t) => e.onItemsRemoved([t]),
4512
4544
  onPostRestored: (t) => e.onItemsRestored([t]),
4513
4545
  reelForward: t,
4514
4546
  state: e.state
4515
4547
  }),
4516
- itemRemoval: new Yr({
4548
+ itemRemoval: new $r({
4517
4549
  historyLimit: e.historyLimit,
4518
4550
  onItemsRemoved: (n, r, i) => {
4519
- e.onItemsRemoved(r.map(({ item: e }) => e.postId)), Vr(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
4551
+ e.onItemsRemoved(r.map(({ item: e }) => e.postId)), Gr(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
4520
4552
  },
4521
4553
  onRemovalRestored: (n) => {
4522
4554
  e.onItemsRestored(n.map(({ item: e }) => e.postId));
@@ -4531,17 +4563,17 @@ function Qr(e) {
4531
4563
  reelRemoval: n
4532
4564
  };
4533
4565
  }
4534
- var $r = 1.5;
4535
- function ei(e) {
4566
+ var ri = 1.5;
4567
+ function ii(e) {
4536
4568
  let t = Math.min(e.screenWidth, e.screenHeight);
4537
4569
  if (t > 0 && t < 600) return !0;
4538
- let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * $r;
4570
+ let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * ri;
4539
4571
  return !e.hasHover && n > 0 && n < 600 && r;
4540
4572
  }
4541
- function ti(e) {
4542
- return ei(e) ? "reel" : "masonry";
4573
+ function ai(e) {
4574
+ return ii(e) ? "reel" : "masonry";
4543
4575
  }
4544
- function ni(e) {
4576
+ function oi(e) {
4545
4577
  let t = e.ownerDocument.defaultView, n = e.ownerDocument.documentElement;
4546
4578
  return {
4547
4579
  hasHover: typeof t?.matchMedia == "function" && t.matchMedia("(hover: hover)").matches,
@@ -4551,15 +4583,15 @@ function ni(e) {
4551
4583
  viewportWidth: n.clientWidth
4552
4584
  };
4553
4585
  }
4554
- function ri(e) {
4555
- return ei(ni(e));
4586
+ function si(e) {
4587
+ return ii(oi(e));
4556
4588
  }
4557
- function ii(e) {
4558
- return ti(ni(e));
4589
+ function ci(e) {
4590
+ return ai(oi(e));
4559
4591
  }
4560
4592
  //#endregion
4561
4593
  //#region src/core/responsiveLayoutController.ts
4562
- var ai = class {
4594
+ var li = class {
4563
4595
  layoutMode;
4564
4596
  resizeObserver = null;
4565
4597
  target = null;
@@ -4584,13 +4616,13 @@ var ai = class {
4584
4616
  }
4585
4617
  handleResponsiveLayout = () => {
4586
4618
  if (!this.target) return;
4587
- let e = ii(this.target);
4588
- this.state.phoneMode = ri(this.target), this.state.reelInfoSheetOverlay = this.state.phoneMode, this.state.reelMediaSource = this.state.phoneMode ? "mobile" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
4619
+ let e = ci(this.target);
4620
+ this.state.phoneMode = si(this.target), this.state.reelInfoSheetOverlay = this.state.phoneMode, this.state.reelMediaSource = this.state.phoneMode ? "mobile" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
4589
4621
  };
4590
- }, oi = class {
4622
+ }, ui = class {
4591
4623
  state;
4592
4624
  constructor(e) {
4593
- this.options = e, this.state = x(Tt({
4625
+ this.options = e, this.state = x(Ot({
4594
4626
  ...e.initialReelAudioState,
4595
4627
  muted: e.initialReelAudioState?.muted ?? e.mediaCard?.videoMuted ?? !1
4596
4628
  }));
@@ -4599,9 +4631,9 @@ var ai = class {
4599
4631
  return { ...this.state };
4600
4632
  }
4601
4633
  set(e, t = !1) {
4602
- Object.assign(this.state, Tt(e, this.state)), t && this.options.onReelAudioStateChange?.(this.get());
4634
+ Object.assign(this.state, Ot(e, this.state)), t && this.options.onReelAudioStateChange?.(this.get());
4603
4635
  }
4604
- }, si = class {
4636
+ }, di = class {
4605
4637
  routedReelPostId = null;
4606
4638
  reelRouteIsActive = !1;
4607
4639
  constructor(e, t) {
@@ -4631,30 +4663,30 @@ var ai = class {
4631
4663
  };
4632
4664
  //#endregion
4633
4665
  //#region src/core/updateItems.ts
4634
- function ci(e) {
4666
+ function fi(e) {
4635
4667
  return String(e);
4636
4668
  }
4637
- function li(e, t) {
4638
- let n = V(t).length;
4669
+ function pi(e, t) {
4670
+ let n = H(t).length;
4639
4671
  (e.mediaIndices.get(t.postId) ?? 0) >= n && e.mediaIndices.set(t.postId, Math.max(0, n - 1));
4640
4672
  }
4641
- function ui(e, t) {
4673
+ function mi(e, t) {
4642
4674
  let n = /* @__PURE__ */ new Map();
4643
- if (t.forEach((e) => n.set(ci(e.postId), e)), n.size === 0) return [];
4675
+ if (t.forEach((e) => n.set(fi(e.postId), e)), n.size === 0) return [];
4644
4676
  let r = [], i = e.items.map((t) => {
4645
- let i = n.get(ci(t.postId));
4677
+ let i = n.get(fi(t.postId));
4646
4678
  if (!i) return t;
4647
4679
  let a = {
4648
4680
  ...i,
4649
4681
  postId: t.postId
4650
4682
  };
4651
- return li(e, a), e.reelForwardItem && ci(e.reelForwardItem.postId) === ci(t.postId) && (e.reelForwardItem = a), r.push(t.postId), a;
4683
+ return pi(e, a), e.reelForwardItem && fi(e.reelForwardItem.postId) === fi(t.postId) && (e.reelForwardItem = a), r.push(t.postId), a;
4652
4684
  });
4653
4685
  return r.length > 0 && (e.items = i), r;
4654
4686
  }
4655
4687
  //#endregion
4656
4688
  //#region src/core/createVibe.ts
4657
- var di = class {
4689
+ var hi = class {
4658
4690
  app = null;
4659
4691
  autoScroll;
4660
4692
  autofillController;
@@ -4677,24 +4709,24 @@ var di = class {
4677
4709
  reelAudio;
4678
4710
  state;
4679
4711
  constructor(e) {
4680
- this.options = e, Pr(e);
4712
+ this.options = e, Rr(e);
4681
4713
  let t = e.layout ?? "masonry";
4682
- this.state = x(jr(e, t)), this.reelAudio = new oi(e), this.lastLoadedCursor = e.initialPage ? On(e.initialPage) : null, this.notificationItems = G(this.state), this.autoScroll = new tr({
4714
+ this.state = x(Fr(e, t)), this.reelAudio = new ui(e), this.lastLoadedCursor = e.initialPage ? Mn(e.initialPage) : null, this.notificationItems = G(this.state), this.autoScroll = new ar({
4683
4715
  getScrollElement: () => this.surface?.getAutoScrollElement() ?? null,
4684
4716
  state: this.state.autoScroll
4685
- }), this.autofillController = new Yn({
4717
+ }), this.autofillController = new $n({
4686
4718
  cancelRequest: () => this.cancelRequest(),
4687
4719
  onLastCursor: (e) => this.setCurrentCursor(e),
4688
4720
  onPages: (e) => this.removalReconciliation.recordPages(e),
4689
4721
  options: e.autofill,
4690
4722
  state: this.state
4691
- }), this.removalReconciliation = new Br(e), this.removalReconciliation.recordInitialPage(e.initialPage), this.fillController = new Sr({
4723
+ }), this.removalReconciliation = new Wr(e), this.removalReconciliation.recordInitialPage(e.initialPage), this.fillController = new Er({
4692
4724
  fill: e.fill,
4693
4725
  loadPage: e.loadPage ? (e) => this.loadFilteredPage(e) : void 0,
4694
4726
  needsFrontendPreparation: () => this.removalReconciliation.needsReconciliation(this.state.items),
4695
4727
  onLastCursor: (e) => this.setCurrentCursor(e),
4696
4728
  onPages: (e) => this.removalReconciliation.recordPages(e),
4697
- prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) => Cr({
4729
+ prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) => Dr({
4698
4730
  controller: this.removalReconciliation,
4699
4731
  isCurrent: t,
4700
4732
  loadPage: e.loadPage,
@@ -4704,8 +4736,8 @@ var di = class {
4704
4736
  state: this.state
4705
4737
  }),
4706
4738
  state: this.state
4707
- }), this.routing = new si(e.routing, this.state);
4708
- let n = Qr({
4739
+ }), this.routing = new di(e.routing, this.state);
4740
+ let n = ni({
4709
4741
  historyLimit: e.removalHistoryLimit,
4710
4742
  onActivate: (e) => this.setActiveReelPost(e),
4711
4743
  onItemsRemoved: (e) => this.removalReconciliation.remove(e),
@@ -4714,22 +4746,23 @@ var di = class {
4714
4746
  state: this.state,
4715
4747
  surface: () => this.surface
4716
4748
  });
4717
- this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new ai(t, this.state, () => {
4749
+ this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new li(t, this.state, () => {
4718
4750
  this.routing.syncFeed();
4719
4751
  }), this.startStateNotifications();
4720
4752
  }
4721
4753
  async mount() {
4722
4754
  if (this.app) throw Error("Vibe is already mounted.");
4723
4755
  this.startStateNotifications();
4724
- let e = Fr(this.options.target);
4725
- this.responsiveLayout.mount(e), this.app = i(Cn, {
4756
+ let e = zr(this.options.target);
4757
+ this.responsiveLayout.mount(e), this.app = i(Dn, {
4726
4758
  canRetryEnd: !!this.options.loadPage,
4727
4759
  cardFooter: this.options.cardFooter,
4728
4760
  cardHeader: this.options.cardHeader,
4729
4761
  feedFooter: this.options.feedFooter,
4730
- feedFooterActions: wr(this),
4762
+ feedFooterActions: Or(this),
4731
4763
  mediaCard: this.options.mediaCard,
4732
4764
  masonry: this.options.masonry,
4765
+ onMediaFullyVisible: this.options.onMediaFullyVisible,
4733
4766
  onMediaReady: this.options.onMediaReady,
4734
4767
  onMediaVisible: this.options.onMediaVisible,
4735
4768
  onReelMediaChange: this.options.onReelMediaChange,
@@ -4752,7 +4785,7 @@ var di = class {
4752
4785
  onRetryForward: () => {
4753
4786
  this.retryReelForward();
4754
4787
  }
4755
- }), this.surface = this.app.mount(e), this.autoScroll.mount(), await or(this.options.restoreBacklog, (e) => this.appendPage(e), (e) => {
4788
+ }), this.surface = this.app.mount(e), this.autoScroll.mount(), await ur(this.options.restoreBacklog, (e) => this.appendPage(e), (e) => {
4756
4789
  this.restoreController = e;
4757
4790
  }), !this.options.initialPage && this.state.items.length === 0 ? await this.reload() : this.options.autofill && this.state.autofill.status === "idle" && !this.fillController.isActive() && !this.state.loadMoreLocked && await this.startInitialAutofill();
4758
4791
  }
@@ -4787,7 +4820,7 @@ var di = class {
4787
4820
  return this.itemRemoval.restoreRemoval(e);
4788
4821
  }
4789
4822
  updateItems(e) {
4790
- return ui(this.state, e);
4823
+ return mi(this.state, e);
4791
4824
  }
4792
4825
  retryReelForward() {
4793
4826
  return this.reelForward.retry();
@@ -4826,7 +4859,7 @@ var di = class {
4826
4859
  this.autoScroll.setSpeed(e);
4827
4860
  }
4828
4861
  applyAutofillUpdate(e) {
4829
- let t = ir(this.options.autofill, this.state, e);
4862
+ let t = cr(this.options.autofill, this.state, e);
4830
4863
  return t && this.autofillController.syncCountdown(), t;
4831
4864
  }
4832
4865
  cancelAutofill() {
@@ -4837,7 +4870,7 @@ var di = class {
4837
4870
  await this.cancelFill();
4838
4871
  return;
4839
4872
  }
4840
- if (Gn(this.state.autofill)) {
4873
+ if (Yn(this.state.autofill)) {
4841
4874
  await this.cancelAutofill();
4842
4875
  return;
4843
4876
  }
@@ -4851,12 +4884,12 @@ var di = class {
4851
4884
  }
4852
4885
  async fill(e) {
4853
4886
  if (!this.state.loadMoreLocked) {
4854
- if (this.pendingRequest || Gn(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
4887
+ if (this.pendingRequest || Yn(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
4855
4888
  await this.fillController.start(e);
4856
4889
  }
4857
4890
  }
4858
4891
  restoreAutofillSession(e) {
4859
- let t = ar(this.options.autofill, this.state, e);
4892
+ let t = lr(this.options.autofill, this.state, e);
4860
4893
  return t && this.autofillController.syncCountdown(), t;
4861
4894
  }
4862
4895
  restoreFillSession(e) {
@@ -4866,14 +4899,14 @@ var di = class {
4866
4899
  return this.startLoadMore(() => this.loadNextSequence());
4867
4900
  }
4868
4901
  appendPage(e) {
4869
- kn(e, this.state, this.removalReconciliation, (e) => this.setCurrentCursor(e));
4902
+ Nn(e, this.state, this.removalReconciliation, (e) => this.setCurrentCursor(e));
4870
4903
  }
4871
4904
  replenishAfterRemoval() {
4872
4905
  return this.startLoadMore(() => this.replenishAfterRemovalSequence());
4873
4906
  }
4874
4907
  async startLoadMore(e) {
4875
4908
  if (this.pendingRequest) return this.pendingRequest;
4876
- if (this.state.loadMoreLocked || Gn(this.state.autofill) || this.fillController.isActive() || !this.options.loadPage || this.state.next === null && !this.removalReconciliation.needsReconciliation(this.state.items)) return;
4909
+ if (this.state.loadMoreLocked || Yn(this.state.autofill) || this.fillController.isActive() || !this.options.loadPage || this.state.next === null && !this.removalReconciliation.needsReconciliation(this.state.items)) return;
4877
4910
  this.state.isLoadingMore = !0, this.state.nextPageError = null;
4878
4911
  let t = e();
4879
4912
  return this.pendingRequest = t, t.finally(() => {
@@ -4888,12 +4921,12 @@ var di = class {
4888
4921
  }
4889
4922
  async replaceFeed(e, t) {
4890
4923
  if (!this.options.loadPage) throw Error(`Vibe cannot ${t} without loadPage.`);
4891
- return Gn(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.state.autofill = Wn(this.options.autofill, void 0, !1), this.fillController.reset(), this.reelForward.reset(), this.reelRemoval.reset(), this.exactMediaRemoval.reset(), this.itemRemoval.reset(), this.removalReconciliation.reset(), this.state.error = null, this.state.current = null, this.state.isLoading = !0, this.state.items = [], this.state.next = null, this.state.nextPageError = null, this.state.total = null, this.startRequest(e, !1);
4924
+ return Yn(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.state.autofill = Jn(this.options.autofill, void 0, !1), this.fillController.reset(), this.reelForward.reset(), this.reelRemoval.reset(), this.exactMediaRemoval.reset(), this.itemRemoval.reset(), this.removalReconciliation.reset(), this.state.error = null, this.state.current = null, this.state.isLoading = !0, this.state.items = [], this.state.next = null, this.state.nextPageError = null, this.state.total = null, this.startRequest(e, !1);
4892
4925
  }
4893
4926
  async loadFilteredPage(e) {
4894
4927
  let t = this.options.loadPage;
4895
4928
  if (!t) throw Error("Vibe cannot load a page without loadPage.");
4896
- let n = wn(await t(e));
4929
+ let n = On(await t(e));
4897
4930
  return {
4898
4931
  ...n,
4899
4932
  items: this.removalReconciliation.filterItems(n.items)
@@ -4912,7 +4945,7 @@ var di = class {
4912
4945
  let t = ++this.requestVersion, n = new AbortController();
4913
4946
  this.abortController = n;
4914
4947
  try {
4915
- let r = await Cr({
4948
+ let r = await Dr({
4916
4949
  controller: this.removalReconciliation,
4917
4950
  isCurrent: () => t === this.requestVersion,
4918
4951
  loadPage: e,
@@ -4921,7 +4954,7 @@ var di = class {
4921
4954
  signal: n.signal,
4922
4955
  state: this.state
4923
4956
  });
4924
- return t === this.requestVersion && r === "complete";
4957
+ return t === this.requestVersion && r === "complete" && (this.state.nextPageError = null), t === this.requestVersion && r === "complete";
4925
4958
  } catch (e) {
4926
4959
  return !n.signal.aborted && t === this.requestVersion && (this.state.nextPageError = e), !1;
4927
4960
  } finally {
@@ -4930,7 +4963,7 @@ var di = class {
4930
4963
  }
4931
4964
  async retryEnd() {
4932
4965
  if (this.pendingRequest) return this.pendingRequest;
4933
- if (!this.state.loadMoreLocked && !(Gn(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);
4966
+ if (!this.state.loadMoreLocked && !(Yn(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);
4934
4967
  }
4935
4968
  setInfiniteScroll(e) {
4936
4969
  this.state.infiniteScroll = e, e && m(() => this.surface?.loadIfNearBottom());
@@ -4954,10 +4987,10 @@ var di = class {
4954
4987
  this.state.total = e;
4955
4988
  }
4956
4989
  setReelAutoAdvance(e) {
4957
- Or(this.state.reelAutoAdvance, e);
4990
+ Mr(this.state.reelAutoAdvance, e);
4958
4991
  }
4959
4992
  setReelInfoSheet(e) {
4960
- Ar(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
4993
+ Pr(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
4961
4994
  }
4962
4995
  setLayout(e) {
4963
4996
  this.responsiveLayout.setLayout(e);
@@ -4977,7 +5010,7 @@ var di = class {
4977
5010
  async fetchPage(e, t) {
4978
5011
  if (!this.options.loadPage) return;
4979
5012
  let n = ++this.requestVersion, r = new AbortController();
4980
- this.abortController = r, await Ir({
5013
+ this.abortController = r, await Br({
4981
5014
  append: t,
4982
5015
  autofillController: this.autofillController,
4983
5016
  cursor: e,
@@ -4999,7 +5032,7 @@ var di = class {
4999
5032
  startInitialAutofill() {
5000
5033
  let e = ++this.requestVersion, t = new AbortController(), n = this.autofillController.beginCycle();
5001
5034
  this.abortController = t, this.state.isLoadingMore = !0;
5002
- let r = sr({
5035
+ let r = dr({
5003
5036
  cycleId: n,
5004
5037
  isCurrent: () => e === this.requestVersion,
5005
5038
  onCollection: (t) => this.autofillController.captureCollection(t, e === this.requestVersion),
@@ -5026,8 +5059,8 @@ var di = class {
5026
5059
  this.lastLoadedCursor = e, this.state.current = e;
5027
5060
  }
5028
5061
  };
5029
- function fi(e) {
5030
- return new di(e);
5062
+ function gi(e) {
5063
+ return new hi(e);
5031
5064
  }
5032
5065
  //#endregion
5033
- export { fi as createVibe };
5066
+ export { gi as createVibe };