@wyxos/vibe 5.8.1 → 5.8.3

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
@@ -832,41 +832,105 @@ function et(e) {
832
832
  function tt(e, t) {
833
833
  return e === void 0 ? et(t) : e === "video";
834
834
  }
835
- //#endregion
836
- //#region src/core/feedReplacementPreload.ts
837
- function nt(e, t, n) {
835
+ var nt = /* @__PURE__ */ new Map(), rt = [], it = 0, at = 0;
836
+ function ot(e, t) {
837
+ return `${t ? "timed" : "image"}:${e}`;
838
+ }
839
+ function st(e, t, n) {
838
840
  let r = P(e);
839
- if (r.length < 2) return null;
840
- let i = F(e, t), a = r[i < r.length - 1 ? i + 1 : i - 1];
841
- return a ? N(a, n) : null;
841
+ if (r.length < 2) return [];
842
+ let i = F(e, t), a = [];
843
+ for (let e = 1; e < r.length; e += 1) {
844
+ let t = i + e, n = i - e;
845
+ t < r.length && a.push(t), n >= 0 && a.push(n);
846
+ }
847
+ let o = /* @__PURE__ */ new Set();
848
+ return a.flatMap((e) => {
849
+ let t = r[e];
850
+ if (!t) return [];
851
+ let i = N(t, n), a = tt(i.type, i.src), s = ot(i.src, a);
852
+ return o.has(s) ? [] : (o.add(s), [{
853
+ key: s,
854
+ src: i.src,
855
+ timed: a
856
+ }]);
857
+ });
842
858
  }
843
- function rt(e) {
844
- if (tt(e.type, e.src)) {
845
- let t = document.createElement("video");
846
- return t.muted = !0, t.playsInline = !0, t.preload = "auto", t.src = e.src, t.load(), () => {
847
- t.pause(), t.removeAttribute("src"), t.load();
848
- };
859
+ function ct(e) {
860
+ let t = e.element;
861
+ e.element = null, t && (t instanceof HTMLVideoElement ? (t.pause(), t.removeAttribute("src"), t.load()) : t.removeAttribute("src"));
862
+ }
863
+ function lt(e) {
864
+ nt.delete(e.key);
865
+ let t = rt.indexOf(e);
866
+ t >= 0 && rt.splice(t, 1), e.cancel?.(), e.cancel = null, ct(e);
867
+ }
868
+ function ut(e) {
869
+ e.state = "loading", it += 1, e.timed && (at += 1);
870
+ let t = !1, n = () => void 0, r = (r) => {
871
+ t || (t = !0, n(), --it, e.timed && --at, e.cancel = null, e.state = r, r === "failed" && ct(e), e.refs === 0 && lt(e), dt());
872
+ };
873
+ if (e.cancel = () => {
874
+ t || (t = !0, n(), --it, e.timed && --at, ct(e), dt());
875
+ }, e.timed) {
876
+ let t = document.createElement("video"), i = () => r("ready"), a = () => r("failed");
877
+ n = () => {
878
+ t.removeEventListener("loadedmetadata", i), t.removeEventListener("error", a);
879
+ }, t.addEventListener("loadedmetadata", i, { once: !0 }), t.addEventListener("error", a, { once: !0 }), t.muted = !0, t.playsInline = !0, t.preload = "metadata", t.src = e.src, e.element = t, t.load();
880
+ return;
849
881
  }
850
- let t = document.createElement("img");
851
- return t.decoding = "async", t.fetchPriority = "low", t.src = e.src, t.decode?.().catch(() => void 0), () => {
852
- t.onload = null, t.onerror = null;
882
+ let i = document.createElement("img"), a = () => {
883
+ if (typeof i.decode != "function") {
884
+ r("ready");
885
+ return;
886
+ }
887
+ i.decode().then(() => r("ready"), () => r("failed"));
888
+ }, o = () => r("failed");
889
+ n = () => {
890
+ i.removeEventListener("load", a), i.removeEventListener("error", o);
891
+ }, 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;
892
+ }
893
+ function dt() {
894
+ for (; it < 6;) {
895
+ let e = rt.findIndex((e) => e.refs > 0 && e.state === "queued" && (!e.timed || at < 2));
896
+ if (e < 0) return;
897
+ let [t] = rt.splice(e, 1);
898
+ t && ut(t);
899
+ }
900
+ }
901
+ function ft(e) {
902
+ let t = nt.get(e.key);
903
+ t || (t = {
904
+ ...e,
905
+ cancel: null,
906
+ element: null,
907
+ refs: 0,
908
+ state: "queued"
909
+ }, nt.set(t.key, t), rt.push(t)), t.refs += 1, dt();
910
+ let n = !1;
911
+ return () => {
912
+ n || (n = !0, --t.refs, t.refs === 0 && lt(t));
853
913
  };
854
914
  }
855
915
  //#endregion
856
- //#region src/components/useFeedReplacementPreload.ts
857
- function it(e) {
858
- let t = r(() => e.layout() === "masonry" && e.mediaCard()?.feedPreload === "replacement"), n = r(() => !t.value || !e.mediaReady() ? null : nt(e.item(), e.mediaIndex(), e.mediaSource())), i = null;
859
- O([
860
- t,
861
- () => e.mediaReady(),
862
- () => n.value && `${n.value.type ?? ""}:${n.value.src}`
863
- ], ([e, t]) => {
864
- e && !t || (i?.(), i = e && n.value ? rt(n.value) : null);
865
- }, { immediate: !0 }), v(() => i?.());
916
+ //#region src/components/useVisiblePostPreload.ts
917
+ function pt(e) {
918
+ let t = r(() => e.layout() === "masonry" && e.inViewport() && e.mediaReady() && e.mediaCard()?.feedPreload === "visible-post"), n = r(() => t.value ? st(e.item(), e.mediaIndex(), e.mediaSource()) : []), i = /* @__PURE__ */ new Map();
919
+ function a() {
920
+ let e = new Map(n.value.map((e) => [e.key, e]));
921
+ i.forEach((t, n) => {
922
+ e.has(n) || (t(), i.delete(n));
923
+ }), n.value.forEach((e) => {
924
+ i.has(e.key) || i.set(e.key, ft(e));
925
+ });
926
+ }
927
+ O(() => n.value.map(({ key: e }) => e).join("\n"), a, { immediate: !0 }), v(() => {
928
+ i.forEach((e) => e()), i.clear();
929
+ });
866
930
  }
867
931
  //#endregion
868
932
  //#region src/components/useReelVideoActivity.ts
869
- function at(e) {
933
+ function mt(e) {
870
934
  let t = r(() => e.layout() !== "reel" || e.active() === !0), n = r(() => t.value ? e.videoIsMuted.value : !0);
871
935
  function i() {
872
936
  if (!t.value) {
@@ -900,7 +964,7 @@ function at(e) {
900
964
  }
901
965
  //#endregion
902
966
  //#region src/components/useMediaLoading.ts
903
- function ot(e) {
967
+ function ht(e) {
904
968
  let t = r(() => tt(e.mediaType(), e.mediaSource())), n = r(() => e.layout() === "masonry" && e.fetchPriority() === "low" ? "lazy" : "eager"), i = r(() => e.layout() === "reel" && !e.active() ? "none" : e.fetchPriority() === "high" ? "auto" : e.layout() === "masonry" ? "none" : "metadata");
905
969
  return O(i, (t, n) => {
906
970
  n !== "none" || t === "none" || m(() => e.videoElement.value?.load());
@@ -912,7 +976,7 @@ function ot(e) {
912
976
  }
913
977
  //#endregion
914
978
  //#region src/components/useMediaReadiness.ts
915
- function st(e) {
979
+ function gt(e) {
916
980
  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());
917
981
  function f() {
918
982
  l !== null && clearTimeout(l), l = null;
@@ -970,7 +1034,7 @@ function st(e) {
970
1034
  }
971
1035
  //#endregion
972
1036
  //#region src/components/MediaCard.vue?vue&type=script&setup=true&lang.ts
973
- var ct = [
1037
+ var _t = [
974
1038
  "data-post-id",
975
1039
  "data-media-index",
976
1040
  "aria-hidden",
@@ -978,12 +1042,12 @@ var ct = [
978
1042
  "inert",
979
1043
  "role",
980
1044
  "tabindex"
981
- ], lt = { class: "media-card-content" }, ut = ["data-media-direction"], dt = ["data-media-index"], ft = {
1045
+ ], vt = { class: "media-card-content" }, yt = ["data-media-direction"], bt = ["data-media-index"], xt = {
982
1046
  key: 0,
983
1047
  "data-test": "media-loading",
984
1048
  class: "media-loading",
985
1049
  "aria-hidden": "true"
986
- }, pt = [
1050
+ }, St = [
987
1051
  "data-source-generation",
988
1052
  "src",
989
1053
  "width",
@@ -992,14 +1056,14 @@ var ct = [
992
1056
  "loop",
993
1057
  "muted",
994
1058
  "preload"
995
- ], mt = [
1059
+ ], Ct = [
996
1060
  "data-source-generation",
997
1061
  "src",
998
1062
  "width",
999
1063
  "height",
1000
1064
  "fetchpriority",
1001
1065
  "loading"
1002
- ], ht = ["aria-label"], gt = ["aria-label"], _t = ["aria-label"], vt = 40, yt = 160, bt = 24, xt = /* @__PURE__ */ d({
1066
+ ], wt = ["aria-label"], Tt = ["aria-label"], Et = ["aria-label"], Dt = 40, Ot = 160, kt = 24, At = /* @__PURE__ */ d({
1003
1067
  __name: "MediaCard",
1004
1068
  props: {
1005
1069
  active: { type: Boolean },
@@ -1008,6 +1072,7 @@ var ct = [
1008
1072
  cardHeader: {},
1009
1073
  entering: { type: Boolean },
1010
1074
  fetchPriority: {},
1075
+ inViewport: { type: Boolean },
1011
1076
  index: {},
1012
1077
  item: {},
1013
1078
  itemStyle: {},
@@ -1037,14 +1102,15 @@ var ct = [
1037
1102
  function S(e = !1, t = "pointer") {
1038
1103
  e && x("activate", t);
1039
1104
  }
1040
- let C = r(() => P(l.item)), T = r(() => F(l.item, l.mediaIndex)), D = r(() => I(l.item, T.value)), O = r(() => N(D.value, l.mediaSource ?? "preview")), M = r(() => O.value.src), L = r(() => O.value.type), R = r(() => O.value.width), z = r(() => O.value.height), { effectivePreviewState: B, failSourceAttempt: V, imageElement: H, markSourceReady: U, noteSourceActivity: W, retrySource: ee, retrying: te, sourceGeneration: G, videoElement: K } = st({
1105
+ let C = r(() => P(l.item)), T = r(() => F(l.item, l.mediaIndex)), D = r(() => I(l.item, T.value)), O = r(() => N(D.value, l.mediaSource ?? "preview")), M = r(() => O.value.src), L = r(() => O.value.type), R = r(() => O.value.width), z = r(() => O.value.height), { effectivePreviewState: B, failSourceAttempt: V, imageElement: H, markSourceReady: U, noteSourceActivity: W, retrySource: ee, retrying: te, sourceGeneration: G, videoElement: K } = gt({
1041
1106
  identity: () => `${l.item.postId}:${T.value}:${l.mediaSource ?? "preview"}:${M.value}:${L.value ?? ""}`,
1042
1107
  mediaIndex: () => T.value,
1043
1108
  onError: (e) => x("error", e),
1044
1109
  onReady: (e) => x("ready", e),
1045
1110
  previewState: () => l.previewState
1046
1111
  });
1047
- it({
1112
+ pt({
1113
+ inViewport: () => l.inViewport === !0,
1048
1114
  item: () => l.item,
1049
1115
  layout: () => l.layout,
1050
1116
  mediaCard: () => l.mediaCard,
@@ -1059,7 +1125,7 @@ var ct = [
1059
1125
  onChange: (e) => x("reelAudioChange", e),
1060
1126
  reelAudioState: () => l.reelAudioState,
1061
1127
  videoElement: K
1062
- }), { effectiveMuted: le, onPlaying: ue, playbackAllowed: de } = at({
1128
+ }), { effectiveMuted: le, onPlaying: ue, playbackAllowed: de } = mt({
1063
1129
  active: () => l.active,
1064
1130
  layout: () => l.layout,
1065
1131
  videoElement: K,
@@ -1080,12 +1146,12 @@ var ct = [
1080
1146
  f = 0, p = !1, d !== null && clearTimeout(d), d = null;
1081
1147
  }
1082
1148
  function he() {
1083
- d !== null && clearTimeout(d), d = setTimeout(me, yt);
1149
+ d !== null && clearTimeout(d), d = setTimeout(me, Ot);
1084
1150
  }
1085
1151
  function ge(e) {
1086
1152
  if (C.value.length <= 1) return;
1087
1153
  let t = e.currentTarget?.clientWidth || 1, n = pe(e.deltaX, e.deltaMode, t);
1088
- if (n === 0 || (e.preventDefault(), he(), p) || (f += n, Math.abs(f) < bt)) return;
1154
+ if (n === 0 || (e.preventDefault(), he(), p) || (f += n, Math.abs(f) < kt)) return;
1089
1155
  let r = Math.sign(f);
1090
1156
  f = 0, p = !0, X(T.value + r);
1091
1157
  }
@@ -1097,9 +1163,9 @@ var ct = [
1097
1163
  let t = e.changedTouches[0];
1098
1164
  if (m === null || g === null || !t) return;
1099
1165
  let n = m - t.clientX, r = g - t.clientY;
1100
- m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) < vt || X(T.value + Math.sign(n)));
1166
+ m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) < Dt || X(T.value + Math.sign(n)));
1101
1167
  }
1102
- let { imageLoading: ye, mediaIsTimed: be, videoPreload: xe } = ot({
1168
+ let { imageLoading: ye, mediaIsTimed: be, videoPreload: xe } = ht({
1103
1169
  active: () => l.active,
1104
1170
  fetchPriority: () => l.fetchPriority,
1105
1171
  layout: () => l.layout,
@@ -1159,7 +1225,7 @@ var ct = [
1159
1225
  tabindex: e.interactive && !e.leaving && !Y.value ? 0 : void 0,
1160
1226
  onClick: i[14] ||= (t) => S(e.interactive && !Y.value, fe(t)),
1161
1227
  onKeydown: [i[15] ||= A((t) => S(e.interactive && !Y.value, "keyboard"), ["enter"]), i[16] ||= A(j((t) => S(e.interactive && !Y.value, "keyboard"), ["prevent"]), ["space"])]
1162
- }, [c("div", lt, [
1228
+ }, [c("div", vt, [
1163
1229
  e.cardHeader ? (b(), a(Ie, {
1164
1230
  key: 0,
1165
1231
  index: e.index,
@@ -1198,7 +1264,7 @@ var ct = [
1198
1264
  key: `${e.item.postId}:${D.value.src}:${e.mediaSource ?? "preview"}:${E(G)}`,
1199
1265
  class: "media-card-frame",
1200
1266
  "data-media-index": T.value
1201
- }, [E(B) === "loading" ? (b(), s("div", ft, [...i[17] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : E(B) === "error" ? (b(), a(Be, {
1267
+ }, [E(B) === "loading" ? (b(), s("div", xt, [...i[17] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : E(B) === "error" ? (b(), a(Be, {
1202
1268
  key: 1,
1203
1269
  component: e.mediaCard?.error?.component,
1204
1270
  label: E(Fe)(M.value),
@@ -1240,7 +1306,7 @@ var ct = [
1240
1306
  onEnded: Me,
1241
1307
  onClick: Te,
1242
1308
  onError: i[5] ||= (...e) => E(V) && E(V)(...e)
1243
- }, null, 42, pt)) : (b(), s("img", {
1309
+ }, null, 42, St)) : (b(), s("img", {
1244
1310
  key: 3,
1245
1311
  ref_key: "imageElement",
1246
1312
  ref: H,
@@ -1255,7 +1321,7 @@ var ct = [
1255
1321
  loading: E(ye),
1256
1322
  onLoad: i[6] ||= (...e) => E(U) && E(U)(...e),
1257
1323
  onError: i[7] ||= (...e) => E(V) && E(V)(...e)
1258
- }, null, 42, mt))], 8, dt))]),
1324
+ }, null, 42, Ct))], 8, bt))]),
1259
1325
  _: 1
1260
1326
  }, 8, ["css", "name"]),
1261
1327
  (b(), a(t, {
@@ -1301,13 +1367,13 @@ var ct = [
1301
1367
  "aria-label": `Previous media for post ${e.item.postId}`,
1302
1368
  onClick: i[8] ||= j((e) => X(T.value - 1, e), ["stop"]),
1303
1369
  onKeydown: i[9] ||= j(() => {}, ["stop"])
1304
- }, [u(E(De), { size: 20 })], 40, ht), c("button", {
1370
+ }, [u(E(De), { size: 20 })], 40, wt), c("button", {
1305
1371
  type: "button",
1306
1372
  class: "media-carousel-control media-carousel-control--next",
1307
1373
  "aria-label": `Next media for post ${e.item.postId}`,
1308
1374
  onClick: i[10] ||= j((e) => X(T.value + 1, e), ["stop"]),
1309
1375
  onKeydown: i[11] ||= j(() => {}, ["stop"])
1310
- }, [u(E(Oe), { size: 20 })], 40, gt)], 2)) : o("", !0),
1376
+ }, [u(E(Oe), { size: 20 })], 40, Tt)], 2)) : o("", !0),
1311
1377
  Y.value ? (b(), s("button", {
1312
1378
  key: 1,
1313
1379
  class: "media-card-activator",
@@ -1315,8 +1381,8 @@ var ct = [
1315
1381
  "aria-label": `Open post ${e.item.postId}`,
1316
1382
  onClick: i[12] ||= j((e) => r.$emit("activate", fe(e)), ["stop"]),
1317
1383
  onKeydown: i[13] ||= j(() => {}, ["stop"])
1318
- }, null, 40, _t)) : o("", !0)
1319
- ], 42, ut),
1384
+ }, null, 40, Et)) : o("", !0)
1385
+ ], 42, yt),
1320
1386
  e.cardFooter ? (b(), a(Ie, {
1321
1387
  key: 1,
1322
1388
  index: e.index,
@@ -1340,12 +1406,12 @@ var ct = [
1340
1406
  "style",
1341
1407
  "total"
1342
1408
  ])) : o("", !0)
1343
- ])], 46, ct));
1409
+ ])], 46, _t));
1344
1410
  }
1345
- }), St = { class: "masonry-feed-shell" }, Ct = ["aria-hidden", "inert"], wt = {
1411
+ }), jt = { class: "masonry-feed-shell" }, Mt = ["aria-hidden", "inert"], Nt = {
1346
1412
  key: 0,
1347
1413
  class: "masonry-feed-status-overlay"
1348
- }, Tt = 6, Et = 12, Dt = 250, Ot = /* @__PURE__ */ d({
1414
+ }, Pt = 6, Ft = 12, It = 250, Lt = /* @__PURE__ */ d({
1349
1415
  __name: "MasonryFeed",
1350
1416
  props: {
1351
1417
  enteringPostIds: {},
@@ -1382,7 +1448,7 @@ var ct = [
1382
1448
  "visible"
1383
1449
  ],
1384
1450
  setup(t, { expose: n, emit: i }) {
1385
- let l = 0, d = t, f = i, p = w(null), m = `vibe-masonry-${D()}`, g = w(null), y = w(0), x = w(Tt), C = w(0), T = w(0), k = w(0), A = w([]), j = w([]), M = 0, N = null, P = null, F = null, I = null, R = r(() => oe(d.items, y.value, {
1451
+ let l = 0, d = t, f = i, p = w(null), m = `vibe-masonry-${D()}`, g = w(null), y = w(0), x = w(Pt), C = w(0), T = w(0), k = w(0), A = w([]), j = w([]), M = 0, N = null, P = null, F = null, I = null, R = r(() => oe(d.items, y.value, {
1386
1452
  additionalHeight: (d.cardHeader?.height ?? 0) + (d.cardFooter?.height ?? 0),
1387
1453
  gap: x.value,
1388
1454
  minColumnWidth: le(d.masonry)
@@ -1493,7 +1559,7 @@ var ct = [
1493
1559
  }
1494
1560
  function pe(e) {
1495
1561
  let t = e.ownerDocument.documentElement.clientWidth;
1496
- y.value = e.clientWidth, x.value = Math.min(Et, Math.max(Tt, t * .0075)), X();
1562
+ y.value = e.clientWidth, x.value = Math.min(Ft, Math.max(Pt, t * .0075)), X();
1497
1563
  }
1498
1564
  function me(e) {
1499
1565
  let t = e.currentTarget;
@@ -1504,7 +1570,7 @@ var ct = [
1504
1570
  Date.now() >= l && !d.loadMoreLocked && e && re(e) && f("loadMore");
1505
1571
  }
1506
1572
  O(() => d.items.length, (e, t) => {
1507
- e > 0 && e < t && (l = Date.now() + Dt);
1573
+ e > 0 && e < t && (l = Date.now() + It);
1508
1574
  });
1509
1575
  function ge() {
1510
1576
  return p.value;
@@ -1527,7 +1593,7 @@ var ct = [
1527
1593
  }), n({
1528
1594
  getScrollElement: ge,
1529
1595
  loadIfNearBottom: he
1530
- }), (n, r) => (b(), s("div", St, [
1596
+ }), (n, r) => (b(), s("div", jt, [
1531
1597
  c("main", {
1532
1598
  id: m,
1533
1599
  ref_key: "galleryElement",
@@ -1543,7 +1609,7 @@ var ct = [
1543
1609
  class: h(["masonry", { "masonry--ready": y.value > 0 }]),
1544
1610
  style: _(W.value),
1545
1611
  "aria-label": "Media gallery"
1546
- }, [(b(!0), s(e, null, S(K.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(xt, {
1612
+ }, [(b(!0), s(e, null, S(K.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(At, {
1547
1613
  key: n.postId,
1548
1614
  class: "masonry-item",
1549
1615
  entering: t.enteringPostIds.has(n.postId),
@@ -1552,6 +1618,7 @@ var ct = [
1552
1618
  "card-footer": t.cardFooter,
1553
1619
  "card-header": t.cardHeader,
1554
1620
  "media-card": t.mediaCard,
1621
+ "in-viewport": G.value.has(r),
1555
1622
  index: r,
1556
1623
  item: n,
1557
1624
  "item-style": fe(r),
@@ -1572,6 +1639,7 @@ var ct = [
1572
1639
  "card-footer",
1573
1640
  "card-header",
1574
1641
  "media-card",
1642
+ "in-viewport",
1575
1643
  "index",
1576
1644
  "item",
1577
1645
  "item-style",
@@ -1583,8 +1651,8 @@ var ct = [
1583
1651
  "onMediaChange",
1584
1652
  "onReady",
1585
1653
  "onError"
1586
- ]))), 128))], 6)], 42, Ct),
1587
- t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && ee.value || !t.hasNext && t.canRetryEnd ? (b(), s("div", wt, [u(te, {
1654
+ ]))), 128))], 6)], 42, Mt),
1655
+ t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && ee.value || !t.hasNext && t.canRetryEnd ? (b(), s("div", Nt, [u(te, {
1588
1656
  actions: t.feedFooterActions,
1589
1657
  "can-retry-end": t.canRetryEnd,
1590
1658
  "feed-footer": t.feedFooter,
@@ -1619,8 +1687,8 @@ var ct = [
1619
1687
  ])
1620
1688
  ]));
1621
1689
  }
1622
- }), kt = 300;
1623
- function At(e, t, n) {
1690
+ }), Rt = 300;
1691
+ function zt(e, t, n) {
1624
1692
  let r = e.scrollTop;
1625
1693
  if (n || Math.abs(r - t) <= 1) return e.scrollTop = t, Promise.resolve();
1626
1694
  e.setAttribute("data-transitioning", "");
@@ -1628,7 +1696,7 @@ function At(e, t, n) {
1628
1696
  return new Promise((n) => {
1629
1697
  let o = (s) => {
1630
1698
  a += 1;
1631
- let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / kt), u = 1 - (1 - l) ** 3;
1699
+ let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / Rt), u = 1 - (1 - l) ** 3;
1632
1700
  if (e.scrollTop = r + (t - r) * u, l < 1) {
1633
1701
  requestAnimationFrame(o);
1634
1702
  return;
@@ -1640,7 +1708,7 @@ function At(e, t, n) {
1640
1708
  }
1641
1709
  //#endregion
1642
1710
  //#region src/components/ReelAutoAdvanceProgress.vue?vue&type=script&setup=true&lang.ts
1643
- var jt = ["aria-label"], Mt = /* @__PURE__ */ d({
1711
+ var Bt = ["aria-label"], Vt = /* @__PURE__ */ d({
1644
1712
  __name: "ReelAutoAdvanceProgress",
1645
1713
  props: {
1646
1714
  durationMs: {},
@@ -1658,9 +1726,9 @@ var jt = ["aria-label"], Mt = /* @__PURE__ */ d({
1658
1726
  class: "reel-auto-advance-progress",
1659
1727
  style: _(a.value),
1660
1728
  onAnimationend: n[0] ||= (e) => i("complete")
1661
- }, null, 36)], 8, jt));
1729
+ }, null, 36)], 8, Bt));
1662
1730
  }
1663
- }), Nt = { class: "reel-viewport" }, Pt = ["data-active-post-id", "data-active-media-index"], Ft = ["role", "data-status"], It = 300, Lt = 250, Rt = /* @__PURE__ */ d({
1731
+ }), Ht = { class: "reel-viewport" }, Ut = ["data-active-post-id", "data-active-media-index"], Wt = ["role", "data-status"], Gt = 300, Kt = 250, qt = /* @__PURE__ */ d({
1664
1732
  __name: "ReelFeed",
1665
1733
  props: {
1666
1734
  initialPostId: {},
@@ -1763,7 +1831,7 @@ var jt = ["aria-label"], Mt = /* @__PURE__ */ d({
1763
1831
  Date.now() >= l && !u.loadMoreLocked && e && re(e) && d("loadMore");
1764
1832
  }
1765
1833
  O(() => u.items.length, (e, t) => {
1766
- e > 0 && e < t && (l = Date.now() + Lt);
1834
+ e > 0 && e < t && (l = Date.now() + Kt);
1767
1835
  });
1768
1836
  function Y(e) {
1769
1837
  let t = B.value;
@@ -1788,7 +1856,7 @@ var jt = ["aria-label"], Mt = /* @__PURE__ */ d({
1788
1856
  let t = f.value;
1789
1857
  if (!t) return Promise.resolve();
1790
1858
  let n = e * (k || t.clientHeight);
1791
- return x.value = e, At(t, n, pe());
1859
+ return x.value = e, zt(t, n, pe());
1792
1860
  }
1793
1861
  function he(e) {
1794
1862
  me(e);
@@ -1798,7 +1866,7 @@ var jt = ["aria-label"], Mt = /* @__PURE__ */ d({
1798
1866
  return t < 0 || t === x.value ? !1 : (await me(t), !0);
1799
1867
  }
1800
1868
  async function _e(e) {
1801
- return Y(e) ? (pe() || await new Promise((e) => setTimeout(e, It)), !0) : !1;
1869
+ return Y(e) ? (pe() || await new Promise((e) => setTimeout(e, Gt)), !0) : !1;
1802
1870
  }
1803
1871
  function ve() {
1804
1872
  if (!u.reelAutoAdvance.enabled) return;
@@ -1867,7 +1935,7 @@ var jt = ["aria-label"], Mt = /* @__PURE__ */ d({
1867
1935
  "style",
1868
1936
  "total"
1869
1937
  ])) : o("", !0),
1870
- c("div", Nt, [c("div", {
1938
+ c("div", Ht, [c("div", {
1871
1939
  ref_key: "galleryElement",
1872
1940
  ref: f,
1873
1941
  class: "gallery-shell reel-feed",
@@ -1879,7 +1947,7 @@ var jt = ["aria-label"], Mt = /* @__PURE__ */ d({
1879
1947
  class: "reel-track",
1880
1948
  style: _(F.value),
1881
1949
  "aria-label": "Media gallery"
1882
- }, [(b(!0), s(e, null, S(R.value, ({ fetchPriority: e, item: n, index: i }) => (b(), a(xt, {
1950
+ }, [(b(!0), s(e, null, S(R.value, ({ fetchPriority: e, item: n, index: i }) => (b(), a(At, {
1883
1951
  key: n.postId,
1884
1952
  active: i === x.value && !C.value,
1885
1953
  "advance-on-media-end": u.reelAutoAdvance.enabled && i === x.value,
@@ -1933,7 +2001,7 @@ var jt = ["aria-label"], Mt = /* @__PURE__ */ d({
1933
2001
  class: "reel-forward-retry",
1934
2002
  type: "button",
1935
2003
  onClick: r[0] ||= (e) => d("retryForward")
1936
- }, " Retry ")) : o("", !0)], 8, Ft)), t.reelForward.status === "idle" ? (b(), a(te, {
2004
+ }, " Retry ")) : o("", !0)], 8, Wt)), t.reelForward.status === "idle" ? (b(), a(te, {
1937
2005
  key: 2,
1938
2006
  actions: t.feedFooterActions,
1939
2007
  "can-retry-end": t.canRetryEnd,
@@ -1956,7 +2024,7 @@ var jt = ["aria-label"], Mt = /* @__PURE__ */ d({
1956
2024
  "load-more-locked",
1957
2025
  "show-load-more",
1958
2026
  "state"
1959
- ])) : o("", !0)], 40, Pt), c("div", {
2027
+ ])) : o("", !0)], 40, Ut), c("div", {
1960
2028
  ref_key: "reelControlsElement",
1961
2029
  ref: p,
1962
2030
  class: "reel-media-controls-host",
@@ -1984,7 +2052,7 @@ var jt = ["aria-label"], Mt = /* @__PURE__ */ d({
1984
2052
  "style",
1985
2053
  "total"
1986
2054
  ])) : o("", !0),
1987
- ne.value ? (b(), a(Mt, {
2055
+ ne.value ? (b(), a(Vt, {
1988
2056
  key: G.value,
1989
2057
  "duration-ms": t.reelAutoAdvance.intervalMs,
1990
2058
  label: K.value,
@@ -1992,16 +2060,16 @@ var jt = ["aria-label"], Mt = /* @__PURE__ */ d({
1992
2060
  }, null, 8, ["duration-ms", "label"])) : o("", !0)
1993
2061
  ], 2));
1994
2062
  }
1995
- }), zt = ["data-info-sheet-open", "data-info-sheet-mode"], Bt = ["aria-hidden", "inert"], Vt = {
2063
+ }), Jt = ["data-info-sheet-open", "data-info-sheet-mode"], Yt = ["aria-hidden", "inert"], Xt = {
1996
2064
  key: 0,
1997
2065
  class: "reel-info-sheet-layer",
1998
2066
  "data-test": "reel-info-sheet"
1999
- }, Ht = [
2067
+ }, Zt = [
2000
2068
  "role",
2001
2069
  "aria-modal",
2002
2070
  "tabindex",
2003
2071
  "data-active-post-id"
2004
- ], Ut = /* @__PURE__ */ d({
2072
+ ], Qt = /* @__PURE__ */ d({
2005
2073
  __name: "ReelLayout",
2006
2074
  props: {
2007
2075
  forwardIndex: { default: null },
@@ -2128,7 +2196,7 @@ var jt = ["aria-label"], Mt = /* @__PURE__ */ d({
2128
2196
  class: "reel-layout-main",
2129
2197
  "aria-hidden": e.infoSheetOverlay && A.value || void 0,
2130
2198
  inert: e.infoSheetOverlay && A.value || void 0
2131
- }, [u(Rt, {
2199
+ }, [u(qt, {
2132
2200
  ref_key: "reelFeed",
2133
2201
  ref: p,
2134
2202
  "can-retry-end": e.canRetryEnd,
@@ -2182,8 +2250,8 @@ var jt = ["aria-label"], Mt = /* @__PURE__ */ d({
2182
2250
  "reel-forward",
2183
2251
  "state",
2184
2252
  "total"
2185
- ])], 8, Bt), u(n, { name: "vibe-info-sheet" }, {
2186
- default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", Vt, [c("aside", {
2253
+ ])], 8, Yt), u(n, { name: "vibe-info-sheet" }, {
2254
+ default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", Xt, [c("aside", {
2187
2255
  ref_key: "sheetElement",
2188
2256
  ref: _,
2189
2257
  class: "reel-info-sheet",
@@ -2192,14 +2260,14 @@ var jt = ["aria-label"], Mt = /* @__PURE__ */ d({
2192
2260
  "aria-modal": e.infoSheetOverlay ? "true" : void 0,
2193
2261
  tabindex: e.infoSheetOverlay ? -1 : void 0,
2194
2262
  "data-active-post-id": T.value?.postId
2195
- }, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8, Ht)])) : o("", !0)]),
2263
+ }, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8, Zt)])) : o("", !0)]),
2196
2264
  _: 1
2197
- })], 10, zt));
2265
+ })], 10, Jt));
2198
2266
  }
2199
2267
  });
2200
2268
  //#endregion
2201
2269
  //#region src/core/mediaLifecycle.ts
2202
- function Wt(e, t, n, r, i) {
2270
+ function $t(e, t, n, r, i) {
2203
2271
  let a = e.items.findIndex((e) => e.postId === t), o = e.items[a];
2204
2272
  if (!o) return null;
2205
2273
  let s = F(o, n), c = I(o, s);
@@ -2215,7 +2283,7 @@ function Wt(e, t, n, r, i) {
2215
2283
  postIndex: a
2216
2284
  };
2217
2285
  }
2218
- function Gt(e, t) {
2286
+ function en(e, t) {
2219
2287
  O(() => {
2220
2288
  let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null;
2221
2289
  return {
@@ -2225,20 +2293,20 @@ function Gt(e, t) {
2225
2293
  };
2226
2294
  }, (n, r) => {
2227
2295
  if (n.postId === null || n.postId === r?.postId && n.mediaIndex === r.mediaIndex && n.origin === r.origin) return;
2228
- let i = Wt(e, n.postId, n.mediaIndex, "reel", n.origin);
2296
+ let i = $t(e, n.postId, n.mediaIndex, "reel", n.origin);
2229
2297
  i && t(i);
2230
2298
  }, { flush: "sync" });
2231
2299
  }
2232
2300
  //#endregion
2233
2301
  //#region src/components/useMediaLifecycle.ts
2234
- function Kt(e, t) {
2302
+ function tn(e, t) {
2235
2303
  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);
2236
2304
  function c(e, t, n, r) {
2237
2305
  let i = L(t, n);
2238
2306
  e.value.get(i) !== r && (e.value = new Map(e.value).set(i, r));
2239
2307
  }
2240
2308
  function l(t, n, r, i) {
2241
- return Wt(e, t, n, r, i);
2309
+ return $t(e, t, n, r, i);
2242
2310
  }
2243
2311
  function u(e, n, r, i) {
2244
2312
  let a = l(e, n, r, i);
@@ -2260,7 +2328,7 @@ function Kt(e, t) {
2260
2328
  let r = l(e, n, "masonry", null);
2261
2329
  r && t.visible(r);
2262
2330
  }
2263
- return Gt(e, t.reelChange), O(() => {
2331
+ return en(e, t.reelChange), O(() => {
2264
2332
  let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null, n = t === null ? 0 : e.mediaIndices.get(t) ?? 0;
2265
2333
  return {
2266
2334
  mediaIndex: n,
@@ -2285,16 +2353,16 @@ function Kt(e, t) {
2285
2353
  }
2286
2354
  //#endregion
2287
2355
  //#region src/core/reelEscapeStack.ts
2288
- var qt = [];
2289
- function Jt(e) {
2290
- return qt.push(e), () => {
2291
- let t = qt.indexOf(e);
2292
- t >= 0 && qt.splice(t, 1);
2356
+ var nn = [];
2357
+ function rn(e) {
2358
+ return nn.push(e), () => {
2359
+ let t = nn.indexOf(e);
2360
+ t >= 0 && nn.splice(t, 1);
2293
2361
  };
2294
2362
  }
2295
- function Yt(e) {
2363
+ function an(e) {
2296
2364
  if (!e.isActive()) return !1;
2297
- let t = qt.filter((e) => e.isActive()), n = e.element();
2365
+ let t = nn.filter((e) => e.isActive()), n = e.element();
2298
2366
  return n !== null && t.some((t) => {
2299
2367
  if (t === e) return !1;
2300
2368
  let r = t.element();
@@ -2310,14 +2378,14 @@ function Yt(e) {
2310
2378
  }
2311
2379
  //#endregion
2312
2380
  //#region src/components/useReelKeyboard.ts
2313
- function Xt(e) {
2381
+ function on(e) {
2314
2382
  let t = {
2315
2383
  element: e.element,
2316
2384
  isActive: () => e.state.layout === "reel" || e.state.reelOrigin === "masonry"
2317
2385
  }, n = null;
2318
2386
  function r(n) {
2319
2387
  let r = t.isActive();
2320
- if (n.key === "Escape" && r && !Yt(t)) return;
2388
+ if (n.key === "Escape" && r && !an(t)) return;
2321
2389
  if (n.key === "Escape" && e.state.reelOrigin === "masonry") {
2322
2390
  n.preventDefault(), e.state.reelInfoSheetOverlay && e.state.reelInfoSheet.enabled && e.setReelInfoSheet(!1), e.closeMasonryReel();
2323
2391
  return;
@@ -2337,14 +2405,14 @@ function Xt(e) {
2337
2405
  a !== 0 && e.reelRenderer()?.changeActiveMedia?.(a) && n.preventDefault();
2338
2406
  }
2339
2407
  y(() => {
2340
- n = Jt(t), window.addEventListener("keydown", r);
2408
+ n = rn(t), window.addEventListener("keydown", r);
2341
2409
  }), v(() => {
2342
2410
  window.removeEventListener("keydown", r), n?.(), n = null;
2343
2411
  });
2344
2412
  }
2345
2413
  //#endregion
2346
2414
  //#region src/components/VibeSurface.vue?vue&type=script&setup=true&lang.ts
2347
- var Zt = 35, Qt = 420, $t = /* @__PURE__ */ d({
2415
+ var sn = 35, cn = 420, ln = /* @__PURE__ */ d({
2348
2416
  __name: "VibeSurface",
2349
2417
  props: {
2350
2418
  canRetryEnd: { type: Boolean },
@@ -2372,7 +2440,7 @@ var Zt = 35, Qt = 420, $t = /* @__PURE__ */ d({
2372
2440
  "retryForward"
2373
2441
  ],
2374
2442
  setup(t, { expose: i, emit: c }) {
2375
- let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), _ = w(!1), y = w(/* @__PURE__ */ new Set()), x = w(/* @__PURE__ */ new Map()), S = w(/* @__PURE__ */ new Set()), C = w(/* @__PURE__ */ new Map()), T = r(() => Object.freeze([...l.state.items])), D = r(() => z(l.state, T.value)), { markMasonryVisible: A, markPreviewError: j, markPreviewReady: M, markReelError: N, markReelReady: I, originalStates: L, previewStates: R, reelStates: B } = Kt(l.state, {
2443
+ let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), _ = w(!1), y = w(/* @__PURE__ */ new Set()), x = w(/* @__PURE__ */ new Map()), S = w(/* @__PURE__ */ new Set()), C = w(/* @__PURE__ */ new Map()), T = r(() => Object.freeze([...l.state.items])), D = r(() => z(l.state, T.value)), { markMasonryVisible: A, markPreviewError: j, markPreviewReady: M, markReelError: N, markReelReady: I, originalStates: L, previewStates: R, reelStates: B } = tn(l.state, {
2376
2444
  ready: (e) => d("mediaReady", e),
2377
2445
  reelChange: (e) => d("reelMediaChange", e),
2378
2446
  visible: (e) => d("mediaVisible", e)
@@ -2423,10 +2491,10 @@ var Zt = 35, Qt = 420, $t = /* @__PURE__ */ d({
2423
2491
  if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || ee()) return 0;
2424
2492
  let n = [...new Set(e)], r = n.filter(se);
2425
2493
  if (r.length === 0) return 0;
2426
- let i = new Map(C.value), a = t?.staggerMs ?? Zt;
2494
+ let i = new Map(C.value), a = t?.staggerMs ?? sn;
2427
2495
  return r.forEach((e, t) => {
2428
2496
  i.set(e, t * a);
2429
- }), y.value = new Set([...y.value].filter((e) => !r.includes(e))), S.value = new Set([...S.value, ...n]), C.value = i, Qt + (r.length - 1) * a;
2497
+ }), y.value = new Set([...y.value].filter((e) => !r.includes(e))), S.value = new Set([...S.value, ...n]), C.value = i, cn + (r.length - 1) * a;
2430
2498
  }
2431
2499
  function ce(e, t) {
2432
2500
  let n = se(e), r = n?.querySelector(".media-card-activator") ?? n;
@@ -2443,7 +2511,7 @@ var Zt = 35, Qt = 420, $t = /* @__PURE__ */ d({
2443
2511
  e !== null && ce(e, t);
2444
2512
  });
2445
2513
  }
2446
- return Xt({
2514
+ return on({
2447
2515
  closeMasonryReel: le,
2448
2516
  element: () => g.value,
2449
2517
  isReelLeaving: () => _.value,
@@ -2458,7 +2526,7 @@ var Zt = 35, Qt = 420, $t = /* @__PURE__ */ d({
2458
2526
  let t = x.value.get(e);
2459
2527
  t !== void 0 && r.set(e, t);
2460
2528
  }), t.forEach((e, t) => {
2461
- r.set(e, t * Zt);
2529
+ r.set(e, t * sn);
2462
2530
  }), x.value = r, y.value = new Set([...y.value, ...t]), te();
2463
2531
  }, { flush: "sync" }), v(() => {
2464
2532
  H !== null && cancelAnimationFrame(H);
@@ -2475,7 +2543,7 @@ var Zt = 35, Qt = 420, $t = /* @__PURE__ */ d({
2475
2543
  ref_key: "surfaceElement",
2476
2544
  ref: g,
2477
2545
  class: "vibe-surface"
2478
- }, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(Ut, {
2546
+ }, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(Qt, {
2479
2547
  key: 0,
2480
2548
  ref_key: "reelRenderer",
2481
2549
  ref: p,
@@ -2528,7 +2596,7 @@ var Zt = 35, Qt = 420, $t = /* @__PURE__ */ d({
2528
2596
  "can-retry-end",
2529
2597
  "feed-footer",
2530
2598
  "state"
2531
- ])) : (b(), s(e, { key: 2 }, [u(Ot, {
2599
+ ])) : (b(), s(e, { key: 2 }, [u(Lt, {
2532
2600
  ref_key: "masonryRenderer",
2533
2601
  ref: f,
2534
2602
  "can-retry-end": t.canRetryEnd,
@@ -2599,7 +2667,7 @@ var Zt = 35, Qt = 420, $t = /* @__PURE__ */ d({
2599
2667
  "aria-label": "Media viewer",
2600
2668
  "aria-modal": "true",
2601
2669
  tabindex: "-1"
2602
- }, [u(Ut, {
2670
+ }, [u(Qt, {
2603
2671
  ref_key: "reelRenderer",
2604
2672
  ref: p,
2605
2673
  "can-retry-end": t.canRetryEnd,
@@ -2645,7 +2713,7 @@ var Zt = 35, Qt = 420, $t = /* @__PURE__ */ d({
2645
2713
  });
2646
2714
  //#endregion
2647
2715
  //#region src/core/page.ts
2648
- function en(e) {
2716
+ function un(e) {
2649
2717
  if (!e || typeof e != "object" || !Array.isArray(e.items)) throw TypeError("Vibe loadPage must resolve to a page with an items array.");
2650
2718
  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.");
2651
2719
  if (e.next !== null && typeof e.next != "string" && typeof e.next != "number") throw TypeError("Vibe page next must be a string, number, or null.");
@@ -2656,22 +2724,22 @@ function Z(e, t) {
2656
2724
  let n = new Set(e.map((e) => e.postId));
2657
2725
  return [...e, ...t.filter((e) => n.has(e.postId) ? !1 : (n.add(e.postId), !0))];
2658
2726
  }
2659
- function tn(e) {
2727
+ function dn(e) {
2660
2728
  return `${typeof e}:${String(e)}`;
2661
2729
  }
2662
- function nn(e) {
2663
- return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview.src}` : `id:${tn(e.mediaId)}`;
2730
+ function fn(e) {
2731
+ return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview.src}` : `id:${dn(e.mediaId)}`;
2664
2732
  }
2665
- function rn(e, t) {
2666
- let n = [...e], r = new Map(e.map((e, t) => [tn(e.postId), t]));
2733
+ function pn(e, t) {
2734
+ let n = [...e], r = new Map(e.map((e, t) => [dn(e.postId), t]));
2667
2735
  return t.forEach((e) => {
2668
- let t = tn(e.postId), i = r.get(t);
2736
+ let t = dn(e.postId), i = r.get(t);
2669
2737
  if (i === void 0) {
2670
2738
  r.set(t, n.length), n.push(e);
2671
2739
  return;
2672
2740
  }
2673
- let a = n[i], o = new Set([a, ...a.items].map(nn)), s = [e, ...e.items].filter((e) => {
2674
- let t = nn(e);
2741
+ let a = n[i], o = new Set([a, ...a.items].map(fn)), s = [e, ...e.items].filter((e) => {
2742
+ let t = fn(e);
2675
2743
  return o.has(t) ? !1 : (o.add(t), !0);
2676
2744
  });
2677
2745
  s.length > 0 && (n[i] = {
@@ -2680,14 +2748,14 @@ function rn(e, t) {
2680
2748
  });
2681
2749
  }), n;
2682
2750
  }
2683
- function an(e) {
2751
+ function mn(e) {
2684
2752
  return Object.prototype.hasOwnProperty.call(e, "current") ? e.current ?? null : e.next;
2685
2753
  }
2686
2754
  //#endregion
2687
2755
  //#region src/core/appendPage.ts
2688
- function on(e, t, n, r) {
2689
- let i = en(e), a = n.filterItems(i.items), o = an(i);
2690
- t.items = rn(t.items, a), t.next = i.next, i.total !== void 0 && (t.total = i.total), r(o), n.recordPages([{
2756
+ function hn(e, t, n, r) {
2757
+ let i = un(e), a = n.filterItems(i.items), o = mn(i);
2758
+ t.items = pn(t.items, a), t.next = i.next, i.total !== void 0 && (t.total = i.total), r(o), n.recordPages([{
2691
2759
  contributionIds: a.map(({ postId: e }) => e),
2692
2760
  cursor: o,
2693
2761
  next: i.next,
@@ -2696,32 +2764,32 @@ function on(e, t, n, r) {
2696
2764
  }
2697
2765
  //#endregion
2698
2766
  //#region src/core/requestDelay.ts
2699
- var sn = 2e3, cn = 1e4, ln = 250, un = {
2767
+ var gn = 2e3, _n = 1e4, vn = 250, yn = {
2700
2768
  delayRemainingMs: null,
2701
2769
  nextRequestAt: null
2702
2770
  };
2703
- function dn(e, t) {
2771
+ function bn(e, t) {
2704
2772
  return e === void 0 ? t : Math.floor(e);
2705
2773
  }
2706
- function fn(e, t) {
2774
+ function xn(e, t) {
2707
2775
  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.`);
2708
2776
  }
2709
- function pn(e, t = {}) {
2710
- let n = dn(t.delayStepMs, sn), r = dn(t.delayMaxMs, cn);
2777
+ function Sn(e, t = {}) {
2778
+ let n = bn(t.delayStepMs, gn), r = bn(t.delayMaxMs, _n);
2711
2779
  return Math.min(Math.max(0, e) * n, r);
2712
2780
  }
2713
2781
  function Q(e) {
2714
- if (e == null || !Number.isFinite(e)) return { ...un };
2782
+ if (e == null || !Number.isFinite(e)) return { ...yn };
2715
2783
  let t = Math.max(0, Math.floor(e - Date.now()));
2716
2784
  return t > 0 ? {
2717
2785
  delayRemainingMs: t,
2718
2786
  nextRequestAt: e
2719
- } : { ...un };
2787
+ } : { ...yn };
2720
2788
  }
2721
- async function mn({ delayMs: e, onChange: t, signal: n }) {
2789
+ async function Cn({ delayMs: e, onChange: t, signal: n }) {
2722
2790
  if (n.aborted) throw new DOMException("Aborted", "AbortError");
2723
2791
  if (e <= 0) {
2724
- t({ ...un });
2792
+ t({ ...yn });
2725
2793
  return;
2726
2794
  }
2727
2795
  let r = Date.now() + e;
@@ -2729,9 +2797,9 @@ async function mn({ delayMs: e, onChange: t, signal: n }) {
2729
2797
  delayRemainingMs: e,
2730
2798
  nextRequestAt: r
2731
2799
  }), await new Promise((i, a) => {
2732
- let o = !1, s = setInterval(f, ln), c = setTimeout(() => u(), e);
2800
+ let o = !1, s = setInterval(f, vn), c = setTimeout(() => u(), e);
2733
2801
  function l() {
2734
- clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...un });
2802
+ clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...yn });
2735
2803
  }
2736
2804
  function u(e) {
2737
2805
  o || (o = !0, l(), e ? a(e) : i());
@@ -2746,13 +2814,13 @@ async function mn({ delayMs: e, onChange: t, signal: n }) {
2746
2814
  n.addEventListener("abort", d, { once: !0 });
2747
2815
  });
2748
2816
  }
2749
- var hn = class {
2817
+ var wn = class {
2750
2818
  interval = null;
2751
2819
  constructor(e) {
2752
2820
  this.onChange = e;
2753
2821
  }
2754
2822
  clear() {
2755
- this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...un });
2823
+ this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...yn });
2756
2824
  }
2757
2825
  sync(e) {
2758
2826
  this.clear();
@@ -2760,22 +2828,22 @@ var hn = class {
2760
2828
  this.onChange(t), t.delayRemainingMs !== null && (this.interval = setInterval(() => {
2761
2829
  let t = Q(e);
2762
2830
  this.onChange(t), t.delayRemainingMs === null && this.clear();
2763
- }, ln));
2831
+ }, vn));
2764
2832
  }
2765
2833
  };
2766
- function gn(e, t = !0) {
2834
+ function Tn(e, t = !0) {
2767
2835
  return e.maxAdditionalPages === "unlimited" ? Infinity : (e.maxAdditionalPages ?? 10) + (t ? 1 : 0);
2768
2836
  }
2769
- function _n(e) {
2837
+ function En(e) {
2770
2838
  return `${typeof e}:${String(e)}`;
2771
2839
  }
2772
- function vn(e, t) {
2840
+ function Dn(e, t) {
2773
2841
  if (!Number.isInteger(e) || e <= 0) throw TypeError(`Vibe ${t} must be a positive integer.`);
2774
2842
  }
2775
- function yn(e) {
2843
+ function On(e) {
2776
2844
  if (!e) return;
2777
- if (vn(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
2778
- fn(e, "frontend autofill");
2845
+ if (Dn(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
2846
+ xn(e, "frontend autofill");
2779
2847
  let t = e.maxAdditionalPages;
2780
2848
  if (t !== void 0 && t !== "unlimited" && (!Number.isInteger(t) || t < 0)) throw TypeError("Vibe autofill maxAdditionalPages must be a non-negative integer or \"unlimited\".");
2781
2849
  return;
@@ -2787,7 +2855,7 @@ function yn(e) {
2787
2855
  if (t.pageSize !== e.pageSize) throw TypeError("Vibe backend autofill initialSession pageSize must match autofill pageSize.");
2788
2856
  }
2789
2857
  }
2790
- function bn(e, t, n = !0) {
2858
+ function kn(e, t, n = !0) {
2791
2859
  if (!e) return {
2792
2860
  cycleId: null,
2793
2861
  delayRemainingMs: null,
@@ -2821,7 +2889,7 @@ function bn(e, t, n = !0) {
2821
2889
  strategy: e.strategy
2822
2890
  };
2823
2891
  }
2824
- function xn(e) {
2892
+ function An(e) {
2825
2893
  return [
2826
2894
  "cancelling",
2827
2895
  "filling",
@@ -2829,9 +2897,9 @@ function xn(e) {
2829
2897
  "waiting"
2830
2898
  ].includes(e.status);
2831
2899
  }
2832
- async function Sn(e, t, n) {
2900
+ async function jn(e, t, n) {
2833
2901
  let r = t.autofill;
2834
- if (!xn(r) || !r.cycleId) return;
2902
+ if (!An(r) || !r.cycleId) return;
2835
2903
  let i = {
2836
2904
  cycleId: r.cycleId,
2837
2905
  feedKey: r.feedKey ?? "",
@@ -2844,16 +2912,16 @@ async function Sn(e, t, n) {
2844
2912
  throw r.error = e, r.status = "error", e;
2845
2913
  }
2846
2914
  }
2847
- function Cn(e, t, n) {
2915
+ function Mn(e, t, n) {
2848
2916
  return e?.strategy === "backend" && t.feedKey === e.feedKey && t.sessionId === n.sessionId;
2849
2917
  }
2850
- async function wn({ existingItems: e, initialCursor: t, loadPage: n, maximumRequests: r, onCollection: i, onDelayChange: a, onProgress: o, options: s, receivedOffset: c = 0, requestOffset: l = 0, shouldPause: u = () => !1, signal: d }) {
2851
- let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ?? gn(s), g = t, _ = t, v = t, y = 0, b = [], x;
2918
+ async function Nn({ existingItems: e, initialCursor: t, loadPage: n, maximumRequests: r, onCollection: i, onDelayChange: a, onProgress: o, options: s, receivedOffset: c = 0, requestOffset: l = 0, shouldPause: u = () => !1, signal: d }) {
2919
+ let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ?? Tn(s), g = t, _ = t, v = t, y = 0, b = [], x;
2852
2920
  for (; y < h;) {
2853
- let e = _n(g);
2921
+ let e = En(g);
2854
2922
  if (m.has(e)) throw Error("Vibe autofill received a repeated cursor.");
2855
- if (m.add(e), await mn({
2856
- delayMs: pn(l + y, s),
2923
+ if (m.add(e), await Cn({
2924
+ delayMs: Sn(l + y, s),
2857
2925
  onChange: a,
2858
2926
  signal: d
2859
2927
  }), y > 0 && u()) return {
@@ -2867,7 +2935,7 @@ async function wn({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
2867
2935
  status: "paused",
2868
2936
  total: x
2869
2937
  };
2870
- let t = en(await n({
2938
+ let t = un(await n({
2871
2939
  cursor: g,
2872
2940
  signal: d
2873
2941
  }));
@@ -2924,12 +2992,12 @@ async function wn({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
2924
2992
  }
2925
2993
  //#endregion
2926
2994
  //#region src/core/autofillController.ts
2927
- var Tn = class {
2995
+ var Pn = class {
2928
2996
  collection = null;
2929
2997
  cycle = 0;
2930
2998
  delayCountdown;
2931
2999
  constructor(e) {
2932
- this.context = e, this.delayCountdown = new hn((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
3000
+ this.context = e, this.delayCountdown = new wn((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
2933
3001
  }
2934
3002
  beginCycle() {
2935
3003
  let { options: e, state: t } = this.context;
@@ -2937,14 +3005,14 @@ var Tn = class {
2937
3005
  this.clear();
2938
3006
  let n = `vibe-autofill-${Date.now().toString(36)}-${++this.cycle}`;
2939
3007
  return t.autofill = {
2940
- ...bn(e, void 0, !1),
3008
+ ...kn(e, void 0, !1),
2941
3009
  cycleId: n,
2942
3010
  status: "filling"
2943
3011
  }, n;
2944
3012
  }
2945
3013
  async cancel() {
2946
3014
  let { cancelRequest: e, options: t, state: n } = this.context;
2947
- await Sn(t, n, e), this.commitCollection();
3015
+ await jn(t, n, e), this.commitCollection();
2948
3016
  }
2949
3017
  captureCollection(e, t) {
2950
3018
  t && (this.collection = e);
@@ -2972,30 +3040,30 @@ var Tn = class {
2972
3040
  requests: r.requests
2973
3041
  }), !0) : !1;
2974
3042
  }
2975
- }, En = 100;
2976
- function Dn(e, t) {
3043
+ }, Fn = 100;
3044
+ function In(e, t) {
2977
3045
  if (!Number.isFinite(t) || t <= 0) throw TypeError(`Vibe ${e} must be a positive number.`);
2978
3046
  }
2979
- function On(e, t, n) {
3047
+ function Ln(e, t, n) {
2980
3048
  return Math.min(n, Math.max(t, e));
2981
3049
  }
2982
- function kn(e) {
3050
+ function Rn(e) {
2983
3051
  if (!e) return;
2984
3052
  let t = e.minSpeedPxPerSecond ?? 20, n = e.maxSpeedPxPerSecond ?? 240;
2985
- if (Dn("autoScroll.minSpeedPxPerSecond", t), Dn("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
2986
- e.speedPxPerSecond !== void 0 && Dn("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
3053
+ if (In("autoScroll.minSpeedPxPerSecond", t), In("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
3054
+ e.speedPxPerSecond !== void 0 && In("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
2987
3055
  }
2988
- function An(e) {
3056
+ function zn(e) {
2989
3057
  let t = e?.minSpeedPxPerSecond ?? 20, n = e?.maxSpeedPxPerSecond ?? 240;
2990
3058
  return {
2991
3059
  enabled: e?.enabled ?? !1,
2992
3060
  maxSpeedPxPerSecond: n,
2993
3061
  minSpeedPxPerSecond: t,
2994
3062
  paused: !1,
2995
- speedPxPerSecond: On(e?.speedPxPerSecond ?? 80, t, n)
3063
+ speedPxPerSecond: Ln(e?.speedPxPerSecond ?? 80, t, n)
2996
3064
  };
2997
3065
  }
2998
- var jn = class {
3066
+ var Bn = class {
2999
3067
  frame = null;
3000
3068
  lastTimestamp = null;
3001
3069
  mounted = !1;
@@ -3015,9 +3083,9 @@ var jn = class {
3015
3083
  this.options.state.enabled && (this.options.state.paused = e, this.lastTimestamp = null, e ? this.cancelFrame() : this.schedule());
3016
3084
  }
3017
3085
  setSpeed(e) {
3018
- Dn("auto-scroll speed", e);
3086
+ In("auto-scroll speed", e);
3019
3087
  let t = this.options.state;
3020
- t.speedPxPerSecond = On(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
3088
+ t.speedPxPerSecond = Ln(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
3021
3089
  }
3022
3090
  tick = (e) => {
3023
3091
  this.frame = null;
@@ -3029,7 +3097,7 @@ var jn = class {
3029
3097
  return;
3030
3098
  }
3031
3099
  if (this.lastTimestamp !== null) {
3032
- let r = Math.min(En, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
3100
+ let r = Math.min(Fn, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
3033
3101
  n.scrollTop = Math.min(i, n.scrollTop + t.speedPxPerSecond * r / 1e3);
3034
3102
  }
3035
3103
  this.lastTimestamp = e, this.schedule();
@@ -3043,7 +3111,7 @@ var jn = class {
3043
3111
  };
3044
3112
  //#endregion
3045
3113
  //#region src/core/backendAutofill.ts
3046
- async function Mn(e, t, n, r) {
3114
+ async function Vn(e, t, n, r) {
3047
3115
  let i = await e.onUnderfilled(n);
3048
3116
  if (!r()) return;
3049
3117
  if (!i.sessionId.trim()) throw TypeError("Vibe backend autofill requires a sessionId.");
@@ -3057,19 +3125,19 @@ async function Mn(e, t, n, r) {
3057
3125
  status: "waiting"
3058
3126
  });
3059
3127
  }
3060
- function Nn(e, t) {
3128
+ function Hn(e, t) {
3061
3129
  ["complete", "exhausted"].includes(t.status) && t.items && (e.items = Z(e.items, t.items)), t.next !== void 0 && (e.next = t.next), t.total !== void 0 && (e.total = t.total);
3062
3130
  }
3063
- function Pn(e, t, n) {
3131
+ function Un(e, t, n) {
3064
3132
  let r = t.autofill;
3065
- return !Cn(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (Nn(t, n), Object.assign(r, Q(n.status === "waiting" ? n.nextRequestAt : null)), r.error = n.error ?? null, r.missing = Math.max(0, (r.pageSize ?? 0) - n.received), r.received = n.received, n.requests !== void 0 && (r.requests = n.requests), r.sequence = n.sequence, r.status = n.status, !0);
3133
+ return !Mn(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (Hn(t, n), Object.assign(r, Q(n.status === "waiting" ? n.nextRequestAt : null)), r.error = n.error ?? null, r.missing = Math.max(0, (r.pageSize ?? 0) - n.received), r.received = n.received, n.requests !== void 0 && (r.requests = n.requests), r.sequence = n.sequence, r.status = n.status, !0);
3066
3134
  }
3067
- function Fn(e, t, n) {
3068
- return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = bn(e, n), Nn(t, n), !0);
3135
+ function Wn(e, t, n) {
3136
+ return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = kn(e, n), Hn(t, n), !0);
3069
3137
  }
3070
3138
  //#endregion
3071
3139
  //#region src/core/backlogRestore.ts
3072
- async function In(e, t, n) {
3140
+ async function Gn(e, t, n) {
3073
3141
  if (!e) return;
3074
3142
  let r = new AbortController();
3075
3143
  n(r);
@@ -3084,7 +3152,7 @@ async function In(e, t, n) {
3084
3152
  }
3085
3153
  //#endregion
3086
3154
  //#region src/core/initialAutofill.ts
3087
- async function Ln({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, onPages: i, options: a, signal: o, state: s }) {
3155
+ async function Kn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, onPages: i, options: a, signal: o, state: s }) {
3088
3156
  let c = a.autofill;
3089
3157
  if (!c) return;
3090
3158
  let l = s.items.length;
@@ -3097,7 +3165,7 @@ async function Ln({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
3097
3165
  return;
3098
3166
  }
3099
3167
  if (c.strategy === "backend") {
3100
- await Mn(c, s, {
3168
+ await Vn(c, s, {
3101
3169
  cycleId: e,
3102
3170
  feedKey: c.feedKey,
3103
3171
  items: [...s.items],
@@ -3114,11 +3182,11 @@ async function Ln({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
3114
3182
  s.autofill.status = "exhausted";
3115
3183
  return;
3116
3184
  }
3117
- let u = await wn({
3185
+ let u = await Nn({
3118
3186
  existingItems: s.items,
3119
3187
  initialCursor: s.next,
3120
3188
  loadPage: a.loadPage,
3121
- maximumRequests: gn(c, !1),
3189
+ maximumRequests: Tn(c, !1),
3122
3190
  onCollection: n,
3123
3191
  onDelayChange: (e) => {
3124
3192
  t() && Object.assign(s.autofill, e);
@@ -3141,13 +3209,13 @@ async function Ln({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
3141
3209
  }
3142
3210
  //#endregion
3143
3211
  //#region src/core/fill.ts
3144
- function Rn(e) {
3212
+ function qn(e) {
3145
3213
  return "items" in e ? { items: e.items } : "pages" in e ? { pages: e.pages } : { until: "end" };
3146
3214
  }
3147
- function zn(e) {
3215
+ function Jn(e) {
3148
3216
  return `${typeof e}:${String(e)}`;
3149
3217
  }
3150
- function Bn(e) {
3218
+ function Yn(e) {
3151
3219
  if (!e || typeof e != "object") throw TypeError("Vibe fill target must be an object.");
3152
3220
  if ("pages" in e) {
3153
3221
  if (!Number.isInteger(e.pages) || e.pages <= 0) throw TypeError("Vibe fill pages must be a positive integer.");
@@ -3160,20 +3228,20 @@ function Bn(e) {
3160
3228
  if ("until" in e && e.until === "end") return { until: "end" };
3161
3229
  throw TypeError("Vibe fill target must be { items }, { pages }, or { until: 'end' }.");
3162
3230
  }
3163
- function Vn(e) {
3231
+ function Xn(e) {
3164
3232
  if (!e) return;
3165
3233
  if (e.strategy === "frontend") {
3166
- fn(e, "frontend fill");
3234
+ xn(e, "frontend fill");
3167
3235
  return;
3168
3236
  }
3169
3237
  if (!e.feedKey.trim()) throw TypeError("Vibe backend fill requires a feedKey.");
3170
3238
  let t = e.initialSession;
3171
3239
  if (t) {
3172
3240
  if (t.feedKey !== e.feedKey) throw TypeError("Vibe backend fill initialSession feedKey must match fill feedKey.");
3173
- Bn(t.target);
3241
+ Yn(t.target);
3174
3242
  }
3175
3243
  }
3176
- function Hn(e, t, n = !0) {
3244
+ function Zn(e, t, n = !0) {
3177
3245
  let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a = Q(i?.nextRequestAt);
3178
3246
  return {
3179
3247
  completedPages: i?.completedPages ?? 0,
@@ -3187,10 +3255,10 @@ function Hn(e, t, n = !0) {
3187
3255
  sessionId: i?.sessionId ?? null,
3188
3256
  status: i?.status ?? "idle",
3189
3257
  strategy: e?.strategy ?? null,
3190
- target: i ? Rn(i.target) : null
3258
+ target: i ? qn(i.target) : null
3191
3259
  };
3192
3260
  }
3193
- function Un(e) {
3261
+ function Qn(e) {
3194
3262
  return [
3195
3263
  "cancelling",
3196
3264
  "filling",
@@ -3198,7 +3266,7 @@ function Un(e) {
3198
3266
  "waiting"
3199
3267
  ].includes(e.status);
3200
3268
  }
3201
- async function Wn({ existingItems: e, initialCursor: t, loadPage: n, onCollection: r = () => void 0, onDelayChange: i, onProgress: a, options: o, shouldPause: s = () => !1, signal: c, target: l }) {
3269
+ async function $n({ existingItems: e, initialCursor: t, loadPage: n, onCollection: r = () => void 0, onDelayChange: i, onProgress: a, options: o, shouldPause: s = () => !1, signal: c, target: l }) {
3202
3270
  let u = [], d = [], f = [...e], p = /* @__PURE__ */ new Set(), m = 0, h = t, g = t, _ = t, v = 0, y;
3203
3271
  if ("items" in l && f.length >= l.items) return {
3204
3272
  completedPages: m,
@@ -3210,10 +3278,10 @@ async function Wn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
3210
3278
  status: "complete"
3211
3279
  };
3212
3280
  for (; _ !== null;) {
3213
- let e = zn(h);
3281
+ let e = Jn(h);
3214
3282
  if (p.has(e)) throw Error("Vibe fill received a repeated cursor.");
3215
- if (p.add(e), await mn({
3216
- delayMs: pn(m, o),
3283
+ if (p.add(e), await Cn({
3284
+ delayMs: Sn(m, o),
3217
3285
  onChange: i,
3218
3286
  signal: c
3219
3287
  }), m > 0 && s()) return {
@@ -3226,7 +3294,7 @@ async function Wn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
3226
3294
  status: "paused",
3227
3295
  total: y
3228
3296
  };
3229
- let t = en(await n({
3297
+ let t = un(await n({
3230
3298
  cursor: h,
3231
3299
  signal: c
3232
3300
  }));
@@ -3294,7 +3362,7 @@ async function Wn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
3294
3362
  }
3295
3363
  //#endregion
3296
3364
  //#region src/core/backendFill.ts
3297
- async function Gn(e, t, n, r) {
3365
+ async function er(e, t, n, r) {
3298
3366
  let i = await e.onStart(n);
3299
3367
  if (r()) {
3300
3368
  if (!i.sessionId.trim()) throw TypeError("Vibe backend fill requires a sessionId.");
@@ -3308,22 +3376,22 @@ async function Gn(e, t, n, r) {
3308
3376
  });
3309
3377
  }
3310
3378
  }
3311
- function Kn(e, t, n) {
3379
+ function tr(e, t, n) {
3312
3380
  return e?.strategy === "backend" && n.feedKey === e.feedKey && n.sessionId === t.fill.sessionId;
3313
3381
  }
3314
- function qn(e) {
3382
+ function nr(e) {
3315
3383
  return Number.isInteger(e.completedPages) && e.completedPages >= 0 && Number.isInteger(e.received) && e.received >= 0 && Number.isInteger(e.sequence) && e.sequence >= 0;
3316
3384
  }
3317
- function Jn(e, t) {
3385
+ function rr(e, t) {
3318
3386
  if (!["complete", "exhausted"].includes(t.status)) return !0;
3319
3387
  let n = e.fill.target;
3320
3388
  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;
3321
3389
  }
3322
- function Yn(e, t, n) {
3390
+ function ir(e, t, n) {
3323
3391
  t.total !== void 0 && (e.total = t.total), ["complete", "exhausted"].includes(t.status) && (e.items = Z(e.items, t.items ?? []), e.next = t.next ?? null, n(t.lastCursor ?? null));
3324
3392
  }
3325
- function Xn(e, t, n, r) {
3326
- return !Kn(e, t, n) || !qn(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !Jn(t, n) ? !1 : (Yn(t, n, r), Object.assign(t.fill, {
3393
+ function ar(e, t, n, r) {
3394
+ return !tr(e, t, n) || !nr(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !rr(t, n) ? !1 : (ir(t, n, r), Object.assign(t.fill, {
3327
3395
  ...Q(n.status === "waiting" ? n.nextRequestAt : null),
3328
3396
  completedPages: n.completedPages,
3329
3397
  error: n.error ?? null,
@@ -3332,45 +3400,45 @@ function Xn(e, t, n, r) {
3332
3400
  status: n.status
3333
3401
  }), !0);
3334
3402
  }
3335
- function Zn(e, t, n, r) {
3403
+ function or(e, t, n, r) {
3336
3404
  if (e?.strategy !== "backend" || n.feedKey !== e.feedKey) return !1;
3337
3405
  let i = t.fill;
3338
- return t.fill = Hn(e, n), !qn(n) || !Jn(t, n) ? (t.fill = i, !1) : (Yn(t, n, r), !0);
3406
+ return t.fill = Zn(e, n), !nr(n) || !rr(t, n) ? (t.fill = i, !1) : (ir(t, n, r), !0);
3339
3407
  }
3340
3408
  //#endregion
3341
3409
  //#region src/core/fillController.ts
3342
- var Qn = class {
3410
+ var sr = class {
3343
3411
  abortController = null;
3344
3412
  cycle = 0;
3345
3413
  delayCountdown;
3346
3414
  requestVersion = 0;
3347
3415
  collection = null;
3348
3416
  constructor(e) {
3349
- this.options = e, this.delayCountdown = new hn((e) => {
3417
+ this.options = e, this.delayCountdown = new wn((e) => {
3350
3418
  Object.assign(this.options.state.fill, e);
3351
3419
  }), this.syncBackendCountdown();
3352
3420
  }
3353
3421
  isActive() {
3354
- return Un(this.options.state.fill);
3422
+ return Qn(this.options.state.fill);
3355
3423
  }
3356
3424
  applyUpdate(e) {
3357
- let t = Xn(this.options.fill, this.options.state, e, this.options.onLastCursor);
3425
+ let t = ar(this.options.fill, this.options.state, e, this.options.onLastCursor);
3358
3426
  return t && this.syncBackendCountdown(), t;
3359
3427
  }
3360
3428
  restoreSession(e) {
3361
- let t = Zn(this.options.fill, this.options.state, e, this.options.onLastCursor);
3429
+ let t = or(this.options.fill, this.options.state, e, this.options.onLastCursor);
3362
3430
  return t && this.syncBackendCountdown(), t;
3363
3431
  }
3364
3432
  async start(e, t = {}) {
3365
3433
  let n = this.options.fill;
3366
3434
  if (!n) throw Error("Vibe fill is not configured.");
3367
3435
  if (this.isActive()) throw Error("Vibe fill is already active.");
3368
- let r = Bn(e), i = Bn(t.target ?? r), a = t.progressOffset ?? {
3436
+ let r = Yn(e), i = Yn(t.target ?? r), a = t.progressOffset ?? {
3369
3437
  completedPages: 0,
3370
3438
  received: 0
3371
3439
  }, o = t.cycleId ?? `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
3372
3440
  if (this.options.state.fill = {
3373
- ...Hn(n, void 0, !1),
3441
+ ...Zn(n, void 0, !1),
3374
3442
  completedPages: a.completedPages,
3375
3443
  cycleId: o,
3376
3444
  received: a.received,
@@ -3383,7 +3451,7 @@ var Qn = class {
3383
3451
  let s = ++this.requestVersion, c = new AbortController();
3384
3452
  this.abortController = c;
3385
3453
  try {
3386
- n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await Gn(n, this.options.state, {
3454
+ n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await er(n, this.options.state, {
3387
3455
  cycleId: o,
3388
3456
  feedKey: n.feedKey,
3389
3457
  items: [...this.options.state.items],
@@ -3401,7 +3469,7 @@ var Qn = class {
3401
3469
  }
3402
3470
  async cancel() {
3403
3471
  let { fill: e, state: t } = this.options;
3404
- if (!Un(t.fill) || !t.fill.cycleId) return;
3472
+ if (!Qn(t.fill) || !t.fill.cycleId) return;
3405
3473
  let n = {
3406
3474
  cycleId: t.fill.cycleId,
3407
3475
  feedKey: t.fill.feedKey ?? "",
@@ -3445,7 +3513,7 @@ var Qn = class {
3445
3513
  });
3446
3514
  }
3447
3515
  reset() {
3448
- this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = Hn(this.options.fill, void 0, !1), this.collection = null;
3516
+ this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = Zn(this.options.fill, void 0, !1), this.collection = null;
3449
3517
  }
3450
3518
  destroy() {
3451
3519
  this.abortLocalRequest(), this.delayCountdown.clear();
@@ -3480,7 +3548,7 @@ var Qn = class {
3480
3548
  s.fill.status = "until" in t ? "complete" : "exhausted";
3481
3549
  return;
3482
3550
  }
3483
- let c = await Wn({
3551
+ let c = await $n({
3484
3552
  existingItems: s.items,
3485
3553
  initialCursor: s.next,
3486
3554
  loadPage: o,
@@ -3528,7 +3596,7 @@ var Qn = class {
3528
3596
  };
3529
3597
  //#endregion
3530
3598
  //#region src/core/fillReconciliation.ts
3531
- async function $n({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r, setLastCursor: i, signal: a, state: o }) {
3599
+ async function cr({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r, setLastCursor: i, signal: a, state: o }) {
3532
3600
  if (!e.needsReconciliation(o.items)) return "skipped";
3533
3601
  let s = await e.reconcile({
3534
3602
  existingItems: o.items,
@@ -3541,7 +3609,7 @@ async function $n({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r,
3541
3609
  }
3542
3610
  //#endregion
3543
3611
  //#region src/core/feedFooter.ts
3544
- function er(e) {
3612
+ function lr(e) {
3545
3613
  return {
3546
3614
  cancelAutofill: () => e.cancelAutofill(),
3547
3615
  loadMore: () => e.loadNext(),
@@ -3553,46 +3621,46 @@ function er(e) {
3553
3621
  retryFill: () => e.retryFill()
3554
3622
  };
3555
3623
  }
3556
- function tr(e) {
3624
+ function ur(e) {
3557
3625
  if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
3558
3626
  }
3559
- function nr(e) {
3560
- e?.intervalMs !== void 0 && tr(e.intervalMs);
3627
+ function dr(e) {
3628
+ e?.intervalMs !== void 0 && ur(e.intervalMs);
3561
3629
  }
3562
- function rr(e) {
3630
+ function fr(e) {
3563
3631
  return {
3564
3632
  enabled: e?.enabled ?? !1,
3565
3633
  includePostItems: e?.includePostItems ?? !1,
3566
3634
  intervalMs: e?.intervalMs ?? 5e3
3567
3635
  };
3568
3636
  }
3569
- function ir(e, t) {
3637
+ function pr(e, t) {
3570
3638
  if (typeof t == "boolean") {
3571
3639
  e.enabled = t;
3572
3640
  return;
3573
3641
  }
3574
- nr(t), t.enabled !== void 0 && (e.enabled = t.enabled), t.includePostItems !== void 0 && (e.includePostItems = t.includePostItems), t.intervalMs !== void 0 && (e.intervalMs = t.intervalMs);
3642
+ dr(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);
3575
3643
  }
3576
3644
  //#endregion
3577
3645
  //#region src/core/reelInfoSheet.ts
3578
- function ar(e) {
3646
+ function mr(e) {
3579
3647
  return { enabled: e?.enabled ?? !1 };
3580
3648
  }
3581
- function or(e, t, n) {
3649
+ function hr(e, t, n) {
3582
3650
  if (n && !t) throw Error("Vibe cannot enable reelInfoSheet without a configured component.");
3583
3651
  e.enabled = n;
3584
3652
  }
3585
3653
  //#endregion
3586
3654
  //#region src/core/initialRuntimeState.ts
3587
- function sr(e, t) {
3655
+ function gr(e, t) {
3588
3656
  let n = e.initialPage;
3589
3657
  return {
3590
3658
  activeReelPostId: null,
3591
- autoScroll: An(e.autoScroll),
3592
- autofill: bn(e.autofill),
3659
+ autoScroll: zn(e.autoScroll),
3660
+ autofill: kn(e.autofill),
3593
3661
  current: n?.current ?? null,
3594
3662
  error: null,
3595
- fill: Hn(e.fill),
3663
+ fill: Zn(e.fill),
3596
3664
  infiniteScroll: e.infiniteScroll ?? !0,
3597
3665
  isLoading: !n,
3598
3666
  isLoadingMore: !1,
@@ -3603,14 +3671,14 @@ function sr(e, t) {
3603
3671
  next: n?.next ?? null,
3604
3672
  nextPageError: null,
3605
3673
  phoneMode: !1,
3606
- reelAutoAdvance: rr(e.reelAutoAdvance),
3674
+ reelAutoAdvance: fr(e.reelAutoAdvance),
3607
3675
  reelForward: {
3608
3676
  error: null,
3609
3677
  status: "idle"
3610
3678
  },
3611
3679
  reelForwardIndex: null,
3612
3680
  reelForwardItem: null,
3613
- reelInfoSheet: ar(e.reelInfoSheet),
3681
+ reelInfoSheet: mr(e.reelInfoSheet),
3614
3682
  reelInfoSheetOverlay: !1,
3615
3683
  reelMediaSource: "original",
3616
3684
  reelOrigin: null,
@@ -3619,21 +3687,21 @@ function sr(e, t) {
3619
3687
  }
3620
3688
  //#endregion
3621
3689
  //#region src/core/options.ts
3622
- function cr(e, t) {
3690
+ function _r(e, t) {
3623
3691
  if (t) {
3624
3692
  if (!Number.isFinite(t.height) || t.height <= 0) throw TypeError(`Vibe ${e} height must be a positive number.`);
3625
3693
  if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe ${e} background must be "default" or "transparent".`);
3626
3694
  }
3627
3695
  }
3628
- function lr(e, t) {
3696
+ function vr(e, t) {
3629
3697
  if (t) {
3630
3698
  if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe mediaCard ${e} background must be "default" or "transparent".`);
3631
3699
  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.`);
3632
3700
  }
3633
3701
  }
3634
- function ur(e) {
3635
- if (kn(e.autoScroll), cr("cardHeader", e.cardHeader), cr("cardFooter", e.cardFooter), lr("header", e.mediaCard?.header), lr("footer", e.mediaCard?.footer), e.mediaCard?.feedPreload !== void 0 && e.mediaCard.feedPreload !== "none" && e.mediaCard.feedPreload !== "replacement") throw TypeError("Vibe mediaCard feedPreload must be \"none\" or \"replacement\".");
3636
- if (yn(e.autofill), Vn(e.fill), de(e.masonry), nr(e.reelAutoAdvance), e.removalReconciliation) {
3702
+ function yr(e) {
3703
+ if (Rn(e.autoScroll), _r("cardHeader", e.cardHeader), _r("cardFooter", e.cardFooter), vr("header", e.mediaCard?.header), vr("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\".");
3704
+ if (On(e.autofill), Xn(e.fill), de(e.masonry), dr(e.reelAutoAdvance), e.removalReconciliation) {
3637
3705
  if (!Number.isInteger(e.removalReconciliation.pageSize) || e.removalReconciliation.pageSize <= 0) throw TypeError("Vibe removalReconciliation pageSize must be a positive integer.");
3638
3706
  let t = e.removalReconciliation.maxReplayPages ?? 5;
3639
3707
  if (!Number.isInteger(t) || t <= 0) throw TypeError("Vibe removalReconciliation maxReplayPages must be a positive integer.");
@@ -3648,7 +3716,7 @@ function ur(e) {
3648
3716
  if (e.fill?.strategy === "frontend" && !e.loadPage) throw TypeError("Vibe frontend fill requires loadPage.");
3649
3717
  if (e.fill?.strategy === "backend" && e.fill.initialSession && !e.initialPage) throw TypeError("Vibe backend fill restoration requires initialPage.");
3650
3718
  }
3651
- function dr(e) {
3719
+ function br(e) {
3652
3720
  if (typeof e != "string") return e;
3653
3721
  if (typeof document > "u") throw Error("Vibe cannot resolve a selector without a document.");
3654
3722
  let t = document.querySelector(e);
@@ -3657,7 +3725,7 @@ function dr(e) {
3657
3725
  }
3658
3726
  //#endregion
3659
3727
  //#region src/core/pageRequest.ts
3660
- async function fr({ append: e, autofillController: t, cursor: n, isCurrent: r, loadPage: i, onLastCursor: a, onPages: o, options: s, signal: c, state: l }) {
3728
+ async function xr({ append: e, autofillController: t, cursor: n, isCurrent: r, loadPage: i, onLastCursor: a, onPages: o, options: s, signal: c, state: l }) {
3661
3729
  let u = s.autofill, d = e && u?.strategy === "frontend" && (l.autofill.status === "paused" || l.autofill.status === "error"), f = d ? {
3662
3730
  received: l.autofill.received,
3663
3731
  requests: l.autofill.requests
@@ -3669,11 +3737,11 @@ async function fr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
3669
3737
  let m = !1;
3670
3738
  try {
3671
3739
  if (u?.strategy === "frontend") {
3672
- let s = await wn({
3740
+ let s = await Nn({
3673
3741
  existingItems: e ? l.items : [],
3674
3742
  initialCursor: n,
3675
3743
  loadPage: i,
3676
- maximumRequests: f ? Math.max(0, gn(u) - f.requests) : void 0,
3744
+ maximumRequests: f ? Math.max(0, Tn(u) - f.requests) : void 0,
3677
3745
  onCollection: (e) => t.captureCollection(e, r()),
3678
3746
  onDelayChange: (e) => {
3679
3747
  r() && Object.assign(l.autofill, e);
@@ -3696,7 +3764,7 @@ async function fr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
3696
3764
  }), o(s.pages), t.clearCollection();
3697
3765
  return;
3698
3766
  }
3699
- let s = en(await i({
3767
+ let s = un(await i({
3700
3768
  cursor: n,
3701
3769
  signal: c
3702
3770
  }));
@@ -3716,7 +3784,7 @@ async function fr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
3716
3784
  l.autofill.status = "complete";
3717
3785
  return;
3718
3786
  }
3719
- await Mn(u, l, {
3787
+ await Vn(u, l, {
3720
3788
  cycleId: p,
3721
3789
  feedKey: u.feedKey,
3722
3790
  items: h.slice(d.length),
@@ -3741,13 +3809,13 @@ async function fr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
3741
3809
  function $(e) {
3742
3810
  return `${typeof e}:${String(e)}`;
3743
3811
  }
3744
- function pr(e) {
3812
+ function Sr(e) {
3745
3813
  return `${typeof e}:${String(e)}`;
3746
3814
  }
3747
- function mr(e) {
3815
+ function Cr(e) {
3748
3816
  return e.map(({ postId: e }) => e);
3749
3817
  }
3750
- var hr = class {
3818
+ var wr = class {
3751
3819
  delay;
3752
3820
  enabled;
3753
3821
  maxReplayPages;
@@ -3779,10 +3847,10 @@ var hr = class {
3779
3847
  }
3780
3848
  recordInitialPage(e) {
3781
3849
  e && this.recordPages([{
3782
- contributionIds: mr(e.items),
3783
- cursor: an(e),
3850
+ contributionIds: Cr(e.items),
3851
+ cursor: mn(e),
3784
3852
  next: e.next,
3785
- returnedIds: mr(e.items)
3853
+ returnedIds: Cr(e.items)
3786
3854
  }]);
3787
3855
  }
3788
3856
  remove(e) {
@@ -3797,14 +3865,14 @@ var hr = class {
3797
3865
  async reconcile({ existingItems: e, loadPage: t, onDelayChange: n = () => void 0, shouldPause: r = () => !1, signal: i }) {
3798
3866
  let a = this.pending ?? this.createSession(e);
3799
3867
  for (this.pending = a; a.remainingRequests > 0;) {
3800
- let e = pr(a.cursor);
3868
+ let e = Sr(a.cursor);
3801
3869
  if (a.seenCursors.has(e)) throw Error("Vibe removal reconciliation received a repeated cursor.");
3802
- if (await mn({
3803
- delayMs: pn(a.pages.length, this.delay),
3870
+ if (await Cn({
3871
+ delayMs: Sn(a.pages.length, this.delay),
3804
3872
  onChange: n,
3805
3873
  signal: i
3806
3874
  }), a.pages.length > 0 && r()) return this.result(a, "paused");
3807
- let o = en(await t({
3875
+ let o = un(await t({
3808
3876
  cursor: a.cursor,
3809
3877
  signal: i
3810
3878
  }));
@@ -3817,7 +3885,7 @@ var hr = class {
3817
3885
  contributionIds: c,
3818
3886
  cursor: a.cursor,
3819
3887
  next: o.next,
3820
- returnedIds: mr(s)
3888
+ returnedIds: Cr(s)
3821
3889
  }), 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");
3822
3890
  }
3823
3891
  return this.result(a, "complete");
@@ -3856,7 +3924,7 @@ var hr = class {
3856
3924
  return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has($(e))).length < this.pageSize);
3857
3925
  }
3858
3926
  recordPage(e) {
3859
- let t = pr(e.cursor), n = this.pages.findIndex(({ cursor: e }) => pr(e) === t);
3927
+ let t = Sr(e.cursor), n = this.pages.findIndex(({ cursor: e }) => Sr(e) === t);
3860
3928
  n >= 0 && (this.pages = this.pages.slice(0, n)), this.pages.push({
3861
3929
  ...e,
3862
3930
  contributionIds: [...e.contributionIds],
@@ -3866,7 +3934,7 @@ var hr = class {
3866
3934
  };
3867
3935
  //#endregion
3868
3936
  //#region src/core/activeItemRemoval.ts
3869
- function gr(e, t, n, r, i) {
3937
+ function Tr(e, t, n, r, i) {
3870
3938
  let a = new Set(t.map(({ item: e }) => e.postId));
3871
3939
  if (e.activeReelPostId === null || !a.has(e.activeReelPostId)) return;
3872
3940
  let o = e.items[Math.max(n, 0)];
@@ -3879,7 +3947,7 @@ function gr(e, t, n, r, i) {
3879
3947
  }
3880
3948
  //#endregion
3881
3949
  //#region src/core/exactMediaRemovalController.ts
3882
- function _r(e, t) {
3950
+ function Er(e, t) {
3883
3951
  let [n, ...r] = t;
3884
3952
  if (!n) throw Error("Vibe items must contain at least one media asset.");
3885
3953
  return {
@@ -3888,10 +3956,10 @@ function _r(e, t) {
3888
3956
  items: r
3889
3957
  };
3890
3958
  }
3891
- function vr(e) {
3959
+ function Dr(e) {
3892
3960
  if (!Number.isInteger(e.mediaIndex) || e.mediaIndex < 0) throw TypeError("Vibe mediaIndex must be a non-negative integer.");
3893
3961
  }
3894
- var yr = class {
3962
+ var Or = class {
3895
3963
  generation = 0;
3896
3964
  metadata = /* @__PURE__ */ new WeakMap();
3897
3965
  state;
@@ -3899,7 +3967,7 @@ var yr = class {
3899
3967
  this.options = e, this.state = e.state;
3900
3968
  }
3901
3969
  remove(e) {
3902
- vr(e);
3970
+ Dr(e);
3903
3971
  let t = this.state.items.findIndex(({ postId: t }) => t === e.postId), n = this.state.items[t];
3904
3972
  if (!n) return null;
3905
3973
  let r = [...P(n)], i = r[e.mediaIndex];
@@ -3916,7 +3984,7 @@ var yr = class {
3916
3984
  restored: !1
3917
3985
  });
3918
3986
  let o = this.state.mediaIndices.get(n.postId) ?? 0, s = this.isReelOpen() && this.state.activeReelPostId === n.postId, c = s && o === e.mediaIndex;
3919
- return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = _r(n, r), this.updateMediaIndexAfterRemoval(n.postId, e.mediaIndex, c), a) : (this.state.items.splice(t, 1), this.options.onPostRemoved(n.postId), this.state.mediaIndices.delete(n.postId), s && this.advanceFromRemovedPost(a, n), a);
3987
+ return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = Er(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);
3920
3988
  }
3921
3989
  reset() {
3922
3990
  this.generation += 1;
@@ -3942,7 +4010,7 @@ var yr = class {
3942
4010
  }
3943
4011
  restoreIntoPost(e, t) {
3944
4012
  let n = this.state.items[e], r = [...P(n)], i = Math.min(t.mediaIndex, r.length);
3945
- if (r.splice(i, 0, t.media), this.state.items[e] = _r(n, r), this.state.activeReelPostId !== t.postId) return;
4013
+ if (r.splice(i, 0, t.media), this.state.items[e] = Er(n, r), this.state.activeReelPostId !== t.postId) return;
3946
4014
  let a = this.state.mediaIndices.get(t.postId) ?? 0;
3947
4015
  a >= i && this.state.mediaIndices.set(t.postId, a + 1);
3948
4016
  }
@@ -3955,18 +4023,18 @@ var yr = class {
3955
4023
  };
3956
4024
  //#endregion
3957
4025
  //#region src/core/itemPlacement.ts
3958
- function br(e, t) {
4026
+ function kr(e, t) {
3959
4027
  let n = new Set(t);
3960
4028
  return e.flatMap((e, t) => n.has(e.postId) ? [{
3961
4029
  index: t,
3962
4030
  item: e
3963
4031
  }] : []);
3964
4032
  }
3965
- function xr(e, t) {
4033
+ function Ar(e, t) {
3966
4034
  let n = new Set(t.map(({ item: e }) => e.postId));
3967
4035
  return e.filter((e) => !n.has(e.postId));
3968
4036
  }
3969
- function Sr(e, t) {
4037
+ function jr(e, t) {
3970
4038
  t.forEach(({ index: e }) => {
3971
4039
  if (!Number.isInteger(e) || e < 0) throw Error("Vibe item restore indexes must be non-negative integers.");
3972
4040
  });
@@ -3977,7 +4045,7 @@ function Sr(e, t) {
3977
4045
  }
3978
4046
  //#endregion
3979
4047
  //#region src/core/itemRemovalController.ts
3980
- var Cr = 20, wr = class {
4048
+ var Mr = 20, Nr = class {
3981
4049
  generation = 0;
3982
4050
  historyLimit;
3983
4051
  metadata = /* @__PURE__ */ new WeakMap();
@@ -3986,7 +4054,7 @@ var Cr = 20, wr = class {
3986
4054
  itemOrder;
3987
4055
  stopItemsWatcher;
3988
4056
  constructor(e) {
3989
- this.options = e, this.historyLimit = e.historyLimit ?? Cr, this.state = e.state, this.itemOrder = this.state.items.map(({ postId: e }) => e), this.stopItemsWatcher = O(() => this.state.items, (e) => this.appendUnknownItems(e), { flush: "sync" });
4057
+ this.options = e, this.historyLimit = e.historyLimit ?? Mr, 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" });
3990
4058
  }
3991
4059
  destroy() {
3992
4060
  this.reset(), this.stopItemsWatcher();
@@ -4000,7 +4068,7 @@ var Cr = 20, wr = class {
4000
4068
  let a = this.options.startRemoval(i, t);
4001
4069
  if (a > 0 && await new Promise((e) => setTimeout(e, a)), this.metadata.get(r)?.generation !== this.generation) return r;
4002
4070
  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);
4003
- return this.state.items = xr(this.state.items, n), this.options.onItemsRemoved(r, n, l), this.record(r), r;
4071
+ return this.state.items = Ar(this.state.items, n), this.options.onItemsRemoved(r, n, l), this.record(r), r;
4004
4072
  }
4005
4073
  reset() {
4006
4074
  this.generation += 1, this.history = [], this.itemOrder = [];
@@ -4011,7 +4079,7 @@ var Cr = 20, wr = class {
4011
4079
  this.restoreRemoval(t);
4012
4080
  return;
4013
4081
  }
4014
- let n = new Set(this.state.items.map(({ postId: e }) => e)), r = e.filter(({ item: e }) => n.has(e.postId) ? !1 : (n.add(e.postId), !0)), i = Sr(this.state.items, r);
4082
+ 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 = jr(this.state.items, r);
4015
4083
  this.registerExternalPlacements(r), this.state.items = i, r.length > 0 && this.options.onRemovalRestored(r);
4016
4084
  }
4017
4085
  restoreRemoval(e) {
@@ -4037,7 +4105,7 @@ var Cr = 20, wr = class {
4037
4105
  }
4038
4106
  collectOrderedPlacements(e) {
4039
4107
  let t = new Map(this.itemOrder.map((e, t) => [e, t]));
4040
- return br(this.state.items, e).map((e) => ({
4108
+ return kr(this.state.items, e).map((e) => ({
4041
4109
  index: t.get(e.item.postId) ?? e.index,
4042
4110
  item: e.item
4043
4111
  }));
@@ -4068,7 +4136,7 @@ var Cr = 20, wr = class {
4068
4136
  let r = new Map(this.itemOrder.map((e, t) => [e, t]));
4069
4137
  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;
4070
4138
  }
4071
- }, Tr = class {
4139
+ }, Pr = class {
4072
4140
  forward = null;
4073
4141
  forwardPromise = null;
4074
4142
  forwardVersion = 0;
@@ -4155,7 +4223,7 @@ var Cr = 20, wr = class {
4155
4223
  }
4156
4224
  }
4157
4225
  }
4158
- }, Er = class {
4226
+ }, Fr = class {
4159
4227
  generation = 0;
4160
4228
  pending = Promise.resolve();
4161
4229
  constructor(e) {
@@ -4205,24 +4273,24 @@ var Cr = 20, wr = class {
4205
4273
  };
4206
4274
  //#endregion
4207
4275
  //#region src/core/removalControllers.ts
4208
- function Dr(e) {
4209
- let t = new Tr(e), n = new Er({
4276
+ function Ir(e) {
4277
+ let t = new Pr(e), n = new Fr({
4210
4278
  state: e.state,
4211
4279
  transitionMedia: (t) => e.surface()?.transitionActiveReelMedia(t) ?? Promise.resolve(!1),
4212
4280
  transitionPost: (t) => e.surface()?.transitionActiveReelPost(t) ?? Promise.resolve(!1)
4213
4281
  });
4214
4282
  return {
4215
- exactMediaRemoval: new yr({
4283
+ exactMediaRemoval: new Or({
4216
4284
  onActivate: e.onActivate,
4217
4285
  onPostRemoved: (t) => e.onItemsRemoved([t]),
4218
4286
  onPostRestored: (t) => e.onItemsRestored([t]),
4219
4287
  reelForward: t,
4220
4288
  state: e.state
4221
4289
  }),
4222
- itemRemoval: new wr({
4290
+ itemRemoval: new Nr({
4223
4291
  historyLimit: e.historyLimit,
4224
4292
  onItemsRemoved: (n, r, i) => {
4225
- e.onItemsRemoved(r.map(({ item: e }) => e.postId)), gr(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
4293
+ e.onItemsRemoved(r.map(({ item: e }) => e.postId)), Tr(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
4226
4294
  },
4227
4295
  onRemovalRestored: (n) => {
4228
4296
  e.onItemsRestored(n.map(({ item: e }) => e.postId));
@@ -4237,17 +4305,17 @@ function Dr(e) {
4237
4305
  reelRemoval: n
4238
4306
  };
4239
4307
  }
4240
- var Or = 1.5;
4241
- function kr(e) {
4308
+ var Lr = 1.5;
4309
+ function Rr(e) {
4242
4310
  let t = Math.min(e.screenWidth, e.screenHeight);
4243
4311
  if (t > 0 && t < 600) return !0;
4244
- let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * Or;
4312
+ let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * Lr;
4245
4313
  return !e.hasHover && n > 0 && n < 600 && r;
4246
4314
  }
4247
- function Ar(e) {
4248
- return kr(e) ? "reel" : "masonry";
4315
+ function zr(e) {
4316
+ return Rr(e) ? "reel" : "masonry";
4249
4317
  }
4250
- function jr(e) {
4318
+ function Br(e) {
4251
4319
  let t = e.ownerDocument.defaultView, n = e.ownerDocument.documentElement;
4252
4320
  return {
4253
4321
  hasHover: typeof t?.matchMedia == "function" && t.matchMedia("(hover: hover)").matches,
@@ -4257,15 +4325,15 @@ function jr(e) {
4257
4325
  viewportWidth: n.clientWidth
4258
4326
  };
4259
4327
  }
4260
- function Mr(e) {
4261
- return kr(jr(e));
4328
+ function Vr(e) {
4329
+ return Rr(Br(e));
4262
4330
  }
4263
- function Nr(e) {
4264
- return Ar(jr(e));
4331
+ function Hr(e) {
4332
+ return zr(Br(e));
4265
4333
  }
4266
4334
  //#endregion
4267
4335
  //#region src/core/responsiveLayoutController.ts
4268
- var Pr = class {
4336
+ var Ur = class {
4269
4337
  layoutMode;
4270
4338
  resizeObserver = null;
4271
4339
  target = null;
@@ -4290,10 +4358,10 @@ var Pr = class {
4290
4358
  }
4291
4359
  handleResponsiveLayout = () => {
4292
4360
  if (!this.target) return;
4293
- let e = Nr(this.target);
4294
- this.state.phoneMode = Mr(this.target), this.state.reelInfoSheetOverlay = this.state.phoneMode, this.state.reelMediaSource = this.state.phoneMode ? "mobile" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
4361
+ let e = Hr(this.target);
4362
+ this.state.phoneMode = Vr(this.target), this.state.reelInfoSheetOverlay = this.state.phoneMode, this.state.reelMediaSource = this.state.phoneMode ? "mobile" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
4295
4363
  };
4296
- }, Fr = class {
4364
+ }, Wr = class {
4297
4365
  state;
4298
4366
  constructor(e) {
4299
4367
  this.options = e, this.state = x(Ze({
@@ -4307,7 +4375,7 @@ var Pr = class {
4307
4375
  set(e, t = !1) {
4308
4376
  Object.assign(this.state, Ze(e, this.state)), t && this.options.onReelAudioStateChange?.(this.get());
4309
4377
  }
4310
- }, Ir = class {
4378
+ }, Gr = class {
4311
4379
  routedReelPostId = null;
4312
4380
  reelRouteIsActive = !1;
4313
4381
  constructor(e, t) {
@@ -4334,7 +4402,7 @@ var Pr = class {
4334
4402
  let i = this.reelRouteIsActive ? "replace" : "push";
4335
4403
  this.reelRouteIsActive = !0, this.routedReelPostId = e, this.options.router[i](r);
4336
4404
  }
4337
- }, Lr = class {
4405
+ }, Kr = class {
4338
4406
  app = null;
4339
4407
  autoScroll;
4340
4408
  autofillController;
@@ -4357,24 +4425,24 @@ var Pr = class {
4357
4425
  reelAudio;
4358
4426
  state;
4359
4427
  constructor(e) {
4360
- this.options = e, ur(e);
4428
+ this.options = e, yr(e);
4361
4429
  let t = e.layout ?? "masonry";
4362
- this.state = x(sr(e, t)), this.reelAudio = new Fr(e), this.lastLoadedCursor = e.initialPage ? an(e.initialPage) : null, this.notificationItems = R(this.state), this.autoScroll = new jn({
4430
+ this.state = x(gr(e, t)), this.reelAudio = new Wr(e), this.lastLoadedCursor = e.initialPage ? mn(e.initialPage) : null, this.notificationItems = R(this.state), this.autoScroll = new Bn({
4363
4431
  getScrollElement: () => this.surface?.getAutoScrollElement() ?? null,
4364
4432
  state: this.state.autoScroll
4365
- }), this.autofillController = new Tn({
4433
+ }), this.autofillController = new Pn({
4366
4434
  cancelRequest: () => this.cancelRequest(),
4367
4435
  onLastCursor: (e) => this.setCurrentCursor(e),
4368
4436
  onPages: (e) => this.removalReconciliation.recordPages(e),
4369
4437
  options: e.autofill,
4370
4438
  state: this.state
4371
- }), this.removalReconciliation = new hr(e), this.removalReconciliation.recordInitialPage(e.initialPage), this.fillController = new Qn({
4439
+ }), this.removalReconciliation = new wr(e), this.removalReconciliation.recordInitialPage(e.initialPage), this.fillController = new sr({
4372
4440
  fill: e.fill,
4373
4441
  loadPage: e.loadPage ? (e) => this.loadFilteredPage(e) : void 0,
4374
4442
  needsFrontendPreparation: () => this.removalReconciliation.needsReconciliation(this.state.items),
4375
4443
  onLastCursor: (e) => this.setCurrentCursor(e),
4376
4444
  onPages: (e) => this.removalReconciliation.recordPages(e),
4377
- prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) => $n({
4445
+ prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) => cr({
4378
4446
  controller: this.removalReconciliation,
4379
4447
  isCurrent: t,
4380
4448
  loadPage: e.loadPage,
@@ -4384,8 +4452,8 @@ var Pr = class {
4384
4452
  state: this.state
4385
4453
  }),
4386
4454
  state: this.state
4387
- }), this.routing = new Ir(e.routing, this.state);
4388
- let n = Dr({
4455
+ }), this.routing = new Gr(e.routing, this.state);
4456
+ let n = Ir({
4389
4457
  historyLimit: e.removalHistoryLimit,
4390
4458
  onActivate: (e) => this.setActiveReelPost(e),
4391
4459
  onItemsRemoved: (e) => this.removalReconciliation.remove(e),
@@ -4394,20 +4462,20 @@ var Pr = class {
4394
4462
  state: this.state,
4395
4463
  surface: () => this.surface
4396
4464
  });
4397
- this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new Pr(t, this.state, () => {
4465
+ this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new Ur(t, this.state, () => {
4398
4466
  this.routing.syncFeed();
4399
4467
  }), this.startStateNotifications();
4400
4468
  }
4401
4469
  async mount() {
4402
4470
  if (this.app) throw Error("Vibe is already mounted.");
4403
4471
  this.startStateNotifications();
4404
- let e = dr(this.options.target);
4405
- this.responsiveLayout.mount(e), this.app = i($t, {
4472
+ let e = br(this.options.target);
4473
+ this.responsiveLayout.mount(e), this.app = i(ln, {
4406
4474
  canRetryEnd: !!this.options.loadPage,
4407
4475
  cardFooter: this.options.cardFooter,
4408
4476
  cardHeader: this.options.cardHeader,
4409
4477
  feedFooter: this.options.feedFooter,
4410
- feedFooterActions: er(this),
4478
+ feedFooterActions: lr(this),
4411
4479
  mediaCard: this.options.mediaCard,
4412
4480
  masonry: this.options.masonry,
4413
4481
  onMediaReady: this.options.onMediaReady,
@@ -4432,7 +4500,7 @@ var Pr = class {
4432
4500
  onRetryForward: () => {
4433
4501
  this.retryReelForward();
4434
4502
  }
4435
- }), this.surface = this.app.mount(e), this.autoScroll.mount(), await In(this.options.restoreBacklog, (e) => this.appendPage(e), (e) => {
4503
+ }), this.surface = this.app.mount(e), this.autoScroll.mount(), await Gn(this.options.restoreBacklog, (e) => this.appendPage(e), (e) => {
4436
4504
  this.restoreController = e;
4437
4505
  }), !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();
4438
4506
  }
@@ -4503,7 +4571,7 @@ var Pr = class {
4503
4571
  this.autoScroll.setSpeed(e);
4504
4572
  }
4505
4573
  applyAutofillUpdate(e) {
4506
- let t = Pn(this.options.autofill, this.state, e);
4574
+ let t = Un(this.options.autofill, this.state, e);
4507
4575
  return t && this.autofillController.syncCountdown(), t;
4508
4576
  }
4509
4577
  cancelAutofill() {
@@ -4514,7 +4582,7 @@ var Pr = class {
4514
4582
  await this.cancelFill();
4515
4583
  return;
4516
4584
  }
4517
- if (xn(this.state.autofill)) {
4585
+ if (An(this.state.autofill)) {
4518
4586
  await this.cancelAutofill();
4519
4587
  return;
4520
4588
  }
@@ -4528,12 +4596,12 @@ var Pr = class {
4528
4596
  }
4529
4597
  async fill(e) {
4530
4598
  if (!this.state.loadMoreLocked) {
4531
- if (this.pendingRequest || xn(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
4599
+ if (this.pendingRequest || An(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
4532
4600
  await this.fillController.start(e);
4533
4601
  }
4534
4602
  }
4535
4603
  restoreAutofillSession(e) {
4536
- let t = Fn(this.options.autofill, this.state, e);
4604
+ let t = Wn(this.options.autofill, this.state, e);
4537
4605
  return t && this.autofillController.syncCountdown(), t;
4538
4606
  }
4539
4607
  restoreFillSession(e) {
@@ -4543,14 +4611,14 @@ var Pr = class {
4543
4611
  return this.startLoadMore(() => this.loadNextSequence());
4544
4612
  }
4545
4613
  appendPage(e) {
4546
- on(e, this.state, this.removalReconciliation, (e) => this.setCurrentCursor(e));
4614
+ hn(e, this.state, this.removalReconciliation, (e) => this.setCurrentCursor(e));
4547
4615
  }
4548
4616
  replenishAfterRemoval() {
4549
4617
  return this.startLoadMore(() => this.replenishAfterRemovalSequence());
4550
4618
  }
4551
4619
  async startLoadMore(e) {
4552
4620
  if (this.pendingRequest) return this.pendingRequest;
4553
- if (this.state.loadMoreLocked || xn(this.state.autofill) || this.fillController.isActive() || !this.options.loadPage || this.state.next === null && !this.removalReconciliation.needsReconciliation(this.state.items)) return;
4621
+ if (this.state.loadMoreLocked || An(this.state.autofill) || this.fillController.isActive() || !this.options.loadPage || this.state.next === null && !this.removalReconciliation.needsReconciliation(this.state.items)) return;
4554
4622
  this.state.isLoadingMore = !0, this.state.nextPageError = null;
4555
4623
  let t = e();
4556
4624
  return this.pendingRequest = t, t.finally(() => {
@@ -4565,12 +4633,12 @@ var Pr = class {
4565
4633
  }
4566
4634
  async replaceFeed(e, t) {
4567
4635
  if (!this.options.loadPage) throw Error(`Vibe cannot ${t} without loadPage.`);
4568
- return xn(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.state.autofill = bn(this.options.autofill, void 0, !1), this.fillController.reset(), this.reelForward.reset(), this.reelRemoval.reset(), this.exactMediaRemoval.reset(), this.itemRemoval.reset(), this.removalReconciliation.reset(), this.state.error = null, this.state.current = null, this.state.isLoading = !0, this.state.items = [], this.state.next = null, this.state.nextPageError = null, this.state.total = null, this.startRequest(e, !1);
4636
+ return An(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.state.autofill = kn(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);
4569
4637
  }
4570
4638
  async loadFilteredPage(e) {
4571
4639
  let t = this.options.loadPage;
4572
4640
  if (!t) throw Error("Vibe cannot load a page without loadPage.");
4573
- let n = en(await t(e));
4641
+ let n = un(await t(e));
4574
4642
  return {
4575
4643
  ...n,
4576
4644
  items: this.removalReconciliation.filterItems(n.items)
@@ -4589,7 +4657,7 @@ var Pr = class {
4589
4657
  let t = ++this.requestVersion, n = new AbortController();
4590
4658
  this.abortController = n;
4591
4659
  try {
4592
- let r = await $n({
4660
+ let r = await cr({
4593
4661
  controller: this.removalReconciliation,
4594
4662
  isCurrent: () => t === this.requestVersion,
4595
4663
  loadPage: e,
@@ -4607,7 +4675,7 @@ var Pr = class {
4607
4675
  }
4608
4676
  async retryEnd() {
4609
4677
  if (this.pendingRequest) return this.pendingRequest;
4610
- if (!this.state.loadMoreLocked && !(xn(this.state.autofill) || this.fillController.isActive()) && !(this.state.next !== null || !this.options.loadPage)) return this.state.isLoadingMore = !0, this.state.nextPageError = null, this.startRequest(this.lastLoadedCursor, !0);
4678
+ if (!this.state.loadMoreLocked && !(An(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);
4611
4679
  }
4612
4680
  setInfiniteScroll(e) {
4613
4681
  this.state.infiniteScroll = e, e && m(() => this.surface?.loadIfNearBottom());
@@ -4631,10 +4699,10 @@ var Pr = class {
4631
4699
  this.state.total = e;
4632
4700
  }
4633
4701
  setReelAutoAdvance(e) {
4634
- ir(this.state.reelAutoAdvance, e);
4702
+ pr(this.state.reelAutoAdvance, e);
4635
4703
  }
4636
4704
  setReelInfoSheet(e) {
4637
- or(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
4705
+ hr(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
4638
4706
  }
4639
4707
  setLayout(e) {
4640
4708
  this.responsiveLayout.setLayout(e);
@@ -4654,7 +4722,7 @@ var Pr = class {
4654
4722
  async fetchPage(e, t) {
4655
4723
  if (!this.options.loadPage) return;
4656
4724
  let n = ++this.requestVersion, r = new AbortController();
4657
- this.abortController = r, await fr({
4725
+ this.abortController = r, await xr({
4658
4726
  append: t,
4659
4727
  autofillController: this.autofillController,
4660
4728
  cursor: e,
@@ -4676,7 +4744,7 @@ var Pr = class {
4676
4744
  startInitialAutofill() {
4677
4745
  let e = ++this.requestVersion, t = new AbortController(), n = this.autofillController.beginCycle();
4678
4746
  this.abortController = t, this.state.isLoadingMore = !0;
4679
- let r = Ln({
4747
+ let r = Kn({
4680
4748
  cycleId: n,
4681
4749
  isCurrent: () => e === this.requestVersion,
4682
4750
  onCollection: (t) => this.autofillController.captureCollection(t, e === this.requestVersion),
@@ -4703,8 +4771,8 @@ var Pr = class {
4703
4771
  this.lastLoadedCursor = e, this.state.current = e;
4704
4772
  }
4705
4773
  };
4706
- function Rr(e) {
4707
- return new Lr(e);
4774
+ function qr(e) {
4775
+ return new Kr(e);
4708
4776
  }
4709
4777
  //#endregion
4710
- export { Rr as createVibe };
4778
+ export { qr as createVibe };