@wyxos/vibe 2.1.18 → 2.2.4

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
@@ -1,5 +1,5 @@
1
- import { defineComponent as be, ref as m, computed as M, createElementBlock as F, openBlock as I, createElementVNode as A, normalizeStyle as Y, watch as ne, onMounted as Ge, onUnmounted as Nt, createCommentVNode as K, createBlock as kt, unref as oe, toDisplayString as Ke, normalizeClass as St, createVNode as G, mergeDefaults as sn, useAttrs as un, shallowRef as It, provide as cn, mergeProps as fn, renderSlot as dn, Fragment as Ft, renderList as _t, nextTick as Pt, inject as vn } from "vue";
2
- const mn = {
1
+ import { defineComponent as xe, ref as v, computed as k, createElementBlock as P, openBlock as _, createElementVNode as N, normalizeStyle as U, watch as Z, onMounted as Ze, onUnmounted as Vt, createCommentVNode as ee, createBlock as Ft, unref as ae, toDisplayString as et, normalizeClass as _t, createVNode as Q, mergeDefaults as fn, useAttrs as dn, shallowRef as Pt, provide as vn, mergeProps as mn, renderSlot as hn, Fragment as Tt, renderList as Et, nextTick as Bt, inject as gn } from "vue";
2
+ const pn = {
3
3
  mode: "default",
4
4
  pageSize: 20,
5
5
  backfillRequestDelayMs: 2e3,
@@ -12,7 +12,7 @@ const mn = {
12
12
  headerHeight: 0,
13
13
  footerHeight: 0,
14
14
  overscanPx: 600
15
- }, hn = ["aria-label", "aria-valuemax", "aria-valuenow"], Ht = /* @__PURE__ */ be({
15
+ }, yn = ["aria-label", "aria-valuemax", "aria-valuenow"], zt = /* @__PURE__ */ xe({
16
16
  __name: "MasonryVideoControls",
17
17
  props: {
18
18
  currentTime: {},
@@ -22,141 +22,141 @@ const mn = {
22
22
  keyboardStep: { default: 5 }
23
23
  },
24
24
  emits: ["seek"],
25
- setup(l, { expose: k, emit: i }) {
26
- const r = l, f = i, w = m(null), b = m(null), u = m(null), d = m(!1), g = M(
27
- () => Number.isFinite(r.step) ? Math.max(0, r.step) : 0
28
- ), p = M(
29
- () => Number.isFinite(r.duration) ? Math.max(0, r.duration) : 0
30
- ), T = M(() => {
31
- const c = Number.isFinite(r.currentTime) ? r.currentTime : 0;
32
- return N(c, 0, p.value);
33
- }), P = M(
34
- () => p.value > 0 ? T.value / p.value : 0
25
+ setup(o, { expose: M, emit: i }) {
26
+ const a = o, d = i, b = v(null), y = v(null), h = v(null), u = v(!1), g = k(
27
+ () => Number.isFinite(a.step) ? Math.max(0, a.step) : 0
28
+ ), w = k(
29
+ () => Number.isFinite(a.duration) ? Math.max(0, a.duration) : 0
30
+ ), S = k(() => {
31
+ const c = Number.isFinite(a.currentTime) ? a.currentTime : 0;
32
+ return T(c, 0, w.value);
33
+ }), B = k(
34
+ () => w.value > 0 ? S.value / w.value : 0
35
35
  );
36
- function N(c, S, B) {
37
- return Math.min(B, Math.max(S, c));
36
+ function T(c, F, R) {
37
+ return Math.min(R, Math.max(F, c));
38
38
  }
39
- function E(c) {
39
+ function I(c) {
40
40
  return g.value <= 0 ? c : Math.round(c / g.value) * g.value;
41
41
  }
42
- function L(c) {
43
- const S = N(c, 0, p.value);
44
- f("seek", E(S));
42
+ function z(c) {
43
+ const F = T(c, 0, w.value);
44
+ d("seek", I(F));
45
45
  }
46
- function H(c) {
47
- const S = b.value;
48
- if (!S) return;
49
- const B = S.getBoundingClientRect();
50
- if (!B.width) return;
51
- const O = N((c - B.left) / B.width, 0, 1);
52
- L(O * p.value);
46
+ function A(c) {
47
+ const F = y.value;
48
+ if (!F) return;
49
+ const R = F.getBoundingClientRect();
50
+ if (!R.width) return;
51
+ const j = T((c - R.left) / R.width, 0, 1);
52
+ z(j * w.value);
53
+ }
54
+ function X(c) {
55
+ const F = y.value;
56
+ F && (u.value = !0, F.setPointerCapture && F.setPointerCapture(c.pointerId), A(c.clientX));
53
57
  }
54
- function J(c) {
55
- const S = b.value;
56
- S && (d.value = !0, S.setPointerCapture && S.setPointerCapture(c.pointerId), H(c.clientX));
58
+ function $(c) {
59
+ u.value && A(c.clientX);
60
+ }
61
+ function H(c) {
62
+ if (!u.value) return;
63
+ u.value = !1;
64
+ const F = y.value;
65
+ F?.releasePointerCapture && F.releasePointerCapture(c.pointerId);
57
66
  }
58
67
  function q(c) {
59
- d.value && H(c.clientX);
60
- }
61
- function D(c) {
62
- if (!d.value) return;
63
- d.value = !1;
64
- const S = b.value;
65
- S?.releasePointerCapture && S.releasePointerCapture(c.pointerId);
66
- }
67
- function le(c) {
68
- if (p.value <= 0) return;
69
- const S = Number.isFinite(r.keyboardStep) ? r.keyboardStep : 1;
70
- let B = T.value;
68
+ if (w.value <= 0) return;
69
+ const F = Number.isFinite(a.keyboardStep) ? a.keyboardStep : 1;
70
+ let R = S.value;
71
71
  switch (c.key) {
72
72
  case "ArrowLeft":
73
73
  case "ArrowDown":
74
- B -= S;
74
+ R -= F;
75
75
  break;
76
76
  case "ArrowRight":
77
77
  case "ArrowUp":
78
- B += S;
78
+ R += F;
79
79
  break;
80
80
  case "Home":
81
- B = 0;
81
+ R = 0;
82
82
  break;
83
83
  case "End":
84
- B = p.value;
84
+ R = w.value;
85
85
  break;
86
86
  default:
87
87
  return;
88
88
  }
89
- c.preventDefault(), L(B);
90
- }
91
- function ae() {
92
- w.value?.focus();
93
- }
94
- return k({
95
- focus: ae,
96
- seekTo: L,
97
- percent: P,
98
- currentValue: T,
99
- maxValue: p,
100
- isDragging: d,
101
- rootEl: w,
102
- trackEl: b,
103
- thumbEl: u
104
- }), (c, S) => (I(), F("div", {
89
+ c.preventDefault(), z(R);
90
+ }
91
+ function te() {
92
+ b.value?.focus();
93
+ }
94
+ return M({
95
+ focus: te,
96
+ seekTo: z,
97
+ percent: B,
98
+ currentValue: S,
99
+ maxValue: w,
100
+ isDragging: u,
101
+ rootEl: b,
102
+ trackEl: y,
103
+ thumbEl: h
104
+ }), (c, F) => (_(), P("div", {
105
105
  ref_key: "rootEl",
106
- ref: w,
106
+ ref: b,
107
107
  class: "w-full select-none",
108
108
  role: "slider",
109
109
  tabindex: "0",
110
- "aria-label": r.ariaLabel,
110
+ "aria-label": a.ariaLabel,
111
111
  "aria-valuemin": 0,
112
- "aria-valuemax": p.value,
113
- "aria-valuenow": T.value,
114
- onKeydown: le
112
+ "aria-valuemax": w.value,
113
+ "aria-valuenow": S.value,
114
+ onKeydown: q
115
115
  }, [
116
- A("div", {
116
+ N("div", {
117
117
  ref_key: "trackEl",
118
- ref: b,
118
+ ref: y,
119
119
  class: "relative h-2 w-full cursor-pointer rounded-full bg-slate-200",
120
- onPointerdown: J,
121
- onPointermove: q,
122
- onPointerup: D,
123
- onPointercancel: D,
124
- onPointerleave: D
120
+ onPointerdown: X,
121
+ onPointermove: $,
122
+ onPointerup: H,
123
+ onPointercancel: H,
124
+ onPointerleave: H
125
125
  }, [
126
- A("div", {
126
+ N("div", {
127
127
  class: "absolute inset-y-0 left-0 rounded-full bg-slate-500",
128
- style: Y({ width: `${P.value * 100}%` })
128
+ style: U({ width: `${B.value * 100}%` })
129
129
  }, null, 4),
130
- A("div", {
130
+ N("div", {
131
131
  ref_key: "thumbEl",
132
- ref: u,
132
+ ref: h,
133
133
  class: "absolute top-1/2 h-3 w-3 -translate-x-1/2 -translate-y-1/2 rounded-full bg-slate-700 shadow",
134
- style: Y({ left: `${P.value * 100}%` }),
134
+ style: U({ left: `${B.value * 100}%` }),
135
135
  "aria-hidden": "true"
136
136
  }, null, 4)
137
137
  ], 544)
138
- ], 40, hn));
138
+ ], 40, yn));
139
139
  }
140
- }), gn = {
140
+ }), wn = {
141
141
  key: 0,
142
142
  "data-testid": "masonry-loader-spinner",
143
143
  class: "absolute inset-0 z-10 flex flex-col items-center justify-center gap-1"
144
- }, pn = {
144
+ }, bn = {
145
145
  key: 1,
146
146
  class: "h-5 w-5 animate-spin text-slate-500",
147
147
  viewBox: "0 0 24 24",
148
148
  "aria-hidden": "true"
149
- }, yn = {
149
+ }, xn = {
150
150
  key: 1,
151
151
  "data-testid": "masonry-loader-error",
152
152
  class: "absolute inset-0 z-20 grid place-items-center p-3 pointer-events-none"
153
- }, wn = { class: "pointer-events-auto flex flex-col items-center justify-center gap-2" }, bn = {
153
+ }, kn = { class: "pointer-events-auto flex flex-col items-center justify-center gap-2" }, Mn = {
154
154
  key: 1,
155
155
  class: "text-center text-xs font-medium text-red-700"
156
- }, xn = ["src", "width", "height", "alt"], Mn = ["poster"], kn = ["src"], Sn = {
156
+ }, Sn = ["src", "width", "height", "alt"], In = ["poster"], Fn = ["src"], _n = {
157
157
  key: 4,
158
158
  class: "pointer-events-none absolute inset-x-0 bottom-0 z-20 px-2 pb-2 opacity-0 transition-opacity duration-200 group-hover:pointer-events-auto group-hover:opacity-100"
159
- }, Tt = /* @__PURE__ */ be({
159
+ }, Rt = /* @__PURE__ */ xe({
160
160
  __name: "MasonryLoader",
161
161
  props: {
162
162
  item: {},
@@ -166,8 +166,8 @@ const mn = {
166
166
  hovered: { type: Boolean, default: !1 }
167
167
  },
168
168
  emits: ["success", "error"],
169
- setup(l, { emit: k }) {
170
- const i = l, r = k, f = be({
169
+ setup(o, { emit: M }) {
170
+ const i = o, a = M, d = xe({
171
171
  name: "SlotRenderer",
172
172
  props: {
173
173
  slotFn: {
@@ -185,124 +185,145 @@ const mn = {
185
185
  return x ? x(s.slotProps) : null;
186
186
  };
187
187
  }
188
- }), w = m(null), b = m(null), u = m(null), d = m(!1), g = m(!1), p = m(!1), T = m(null), P = M(() => i.item?.type === "video"), N = M(() => {
189
- if (!P.value) return;
188
+ }), b = v(null), y = v(null), h = v(null), u = v(!1), g = v(!1), w = v(!1), S = v(null), B = k(() => i.item?.type === "video"), T = k(() => {
189
+ if (!B.value) return;
190
190
  const s = i.item?.preview, x = i.item?.original;
191
- if (!(typeof s != "string" || !s) && !(typeof x == "string" && s === x) && !/\.(mp4|webm)(\?|#|$)/i.test(s))
191
+ if (!(typeof s != "string" || !s) && !(typeof x == "string" && s === x) && !/\.(mp4|webm)(\?|#|$)/i.test(s) && /\.(png|jpe?g|gif|webp)(\?|#|$)/i.test(s))
192
192
  return s;
193
- }), E = M(() => {
194
- if (!P.value) return;
193
+ }), I = k(() => {
194
+ if (!B.value) return;
195
195
  const s = i.item?.preview;
196
- if (typeof s == "string" && s && /\.(mp4|webm)(\?|#|$)/i.test(s))
196
+ if (typeof s == "string" && s && !/\.(png|jpe?g|gif|webp)(\?|#|$)/i.test(s))
197
197
  return s;
198
198
  const x = i.item?.original;
199
199
  if (typeof x == "string" && x) return x;
200
- }), L = m(!1), H = M(() => !!i.hovered), J = m(0), q = m(0);
201
- function D() {
200
+ }), z = v(!1), A = k(() => !!i.hovered), X = v(0), $ = v(0);
201
+ function H() {
202
202
  i.remove?.();
203
203
  }
204
- const le = M(() => {
204
+ const q = k(() => {
205
205
  const s = i.item?.width, x = i.item?.height;
206
206
  return { aspectRatio: `${s} / ${x}` };
207
- }), ae = M(() => i.item?.type === "image");
208
- let c = null, S = null;
209
- function B() {
210
- d.value || (d.value = !0, g.value = !1, p.value = !1, T.value = null);
207
+ }), te = k(() => !B.value);
208
+ let c = null, F = null;
209
+ function R() {
210
+ u.value || (u.value = !0, g.value = !1, w.value = !1, S.value = null);
211
211
  }
212
- function O(s) {
213
- J.value = Number.isFinite(s.duration) ? s.duration : 0, q.value = Number.isFinite(s.currentTime) ? s.currentTime : 0;
212
+ function j(s) {
213
+ X.value = Number.isFinite(s.duration) ? s.duration : 0, $.value = Number.isFinite(s.currentTime) ? s.currentTime : 0;
214
214
  }
215
215
  async function re() {
216
- if (!P.value || !H.value || !d.value || !g.value || !L.value) return;
217
- const s = u.value;
216
+ if (!B.value || !A.value || !u.value || !g.value || !z.value) return;
217
+ const s = h.value;
218
218
  if (s)
219
219
  try {
220
220
  s.muted = !0, await s.play();
221
221
  } catch {
222
222
  }
223
223
  }
224
- function Q() {
225
- const s = u.value;
224
+ function ne() {
225
+ const s = h.value;
226
226
  s && (s.paused || s.pause());
227
227
  }
228
- function _e() {
229
- const s = u.value;
228
+ function Ee() {
229
+ const s = h.value;
230
230
  s && (s.paused || s.pause());
231
231
  }
232
- ne(
232
+ Z(
233
233
  () => i.hovered,
234
234
  (s) => {
235
235
  if (s) {
236
- B(), re();
236
+ R(), re();
237
237
  return;
238
238
  }
239
- Q();
239
+ ne();
240
240
  }
241
241
  );
242
- function Pe(s) {
243
- const x = u.value;
244
- x && Number.isFinite(s) && (x.currentTime = Math.max(0, Math.min(s, Number.isFinite(x.duration) ? x.duration : s)), O(x));
242
+ function Be(s) {
243
+ const x = h.value;
244
+ x && Number.isFinite(s) && (x.currentTime = Math.max(0, Math.min(s, Number.isFinite(x.duration) ? x.duration : s)), j(x));
245
245
  }
246
- Ge(() => {
246
+ Ze(() => {
247
247
  if (typeof IntersectionObserver > "u") {
248
- B();
248
+ R();
249
249
  return;
250
250
  }
251
251
  if (c = new IntersectionObserver(
252
252
  (s) => {
253
253
  for (const x of s)
254
254
  if (x.isIntersecting && !((x.intersectionRatio ?? 0) < 0.5)) {
255
- B(), c?.disconnect(), c = null;
255
+ R(), c?.disconnect(), c = null;
256
256
  return;
257
257
  }
258
258
  },
259
259
  { threshold: [0, 0.5, 1] }
260
- ), w.value && c.observe(w.value), P.value && w.value) {
261
- const s = w.value.closest('[data-testid="items-scroll-container"]');
262
- S = new IntersectionObserver(
260
+ ), b.value && c.observe(b.value), B.value && b.value) {
261
+ const s = b.value.closest('[data-testid="items-scroll-container"]');
262
+ F = new IntersectionObserver(
263
263
  (x) => {
264
- for (const W of x) {
265
- const Te = W.intersectionRatio ?? 0, Me = !!W.isIntersecting && Te >= 0.5;
266
- L.value = Me, Me ? H.value && re() : _e();
264
+ for (const J of x) {
265
+ const Re = J.intersectionRatio ?? 0, Se = !!J.isIntersecting && Re >= 0.5;
266
+ z.value = Se, Se ? A.value && re() : Ee();
267
267
  }
268
268
  },
269
269
  {
270
270
  root: s ?? void 0,
271
271
  threshold: [0, 0.25, 0.5, 0.75, 1]
272
272
  }
273
- ), S.observe(w.value);
273
+ ), F.observe(b.value);
274
274
  }
275
- }), Nt(() => {
276
- c?.disconnect(), c = null, S?.disconnect(), S = null;
275
+ }), Vt(() => {
276
+ c?.disconnect(), c = null, F?.disconnect(), F = null;
277
277
  });
278
- function j() {
279
- g.value || (g.value = !0, p.value = !1, T.value = null, r("success", i.item));
280
- }
281
- function U(s) {
282
- p.value || (g.value = !1, p.value = !0, T.value = s, r("error", { item: i.item, error: s }));
278
+ function W() {
279
+ g.value || (g.value = !0, w.value = !1, S.value = null, a("success", i.item));
280
+ }
281
+ function K(s) {
282
+ w.value || (g.value = !1, w.value = !0, S.value = s, a("error", { item: i.item, error: s }));
283
+ }
284
+ function ke() {
285
+ if (u.value && !g.value && !w.value) {
286
+ if (te.value) {
287
+ const s = y.value;
288
+ if (!s || !s.complete) return;
289
+ s.naturalWidth > 0 && W();
290
+ return;
291
+ }
292
+ if (B.value) {
293
+ const s = h.value;
294
+ s && (s.readyState ?? 0) >= 1 && Me();
295
+ }
296
+ }
283
297
  }
284
- function xe() {
285
- j();
286
- const s = u.value;
287
- s && O(s), re();
298
+ Z(
299
+ [u, () => i.item.preview, () => I.value],
300
+ () => {
301
+ u.value && Promise.resolve().then(ke);
302
+ },
303
+ { flush: "post" }
304
+ );
305
+ function Me() {
306
+ W();
307
+ const s = h.value;
308
+ s && j(s), re();
288
309
  }
289
- function he() {
290
- const s = u.value;
291
- s && O(s);
310
+ function se() {
311
+ const s = h.value;
312
+ s && j(s);
292
313
  }
293
- return (s, x) => (I(), F("div", {
314
+ return (s, x) => (_(), P("div", {
294
315
  ref_key: "rootEl",
295
- ref: w,
316
+ ref: b,
296
317
  class: "relative bg-slate-100",
297
- style: Y(le.value)
318
+ style: U(q.value)
298
319
  }, [
299
- d.value && !g.value && !p.value ? (I(), F("div", gn, [
300
- i.loaderSlotFn ? (I(), kt(oe(f), {
320
+ u.value && !g.value && !w.value ? (_(), P("div", wn, [
321
+ i.loaderSlotFn ? (_(), Ft(ae(d), {
301
322
  key: 0,
302
323
  "slot-fn": i.loaderSlotFn,
303
- "slot-props": { item: i.item, remove: D }
304
- }, null, 8, ["slot-fn", "slot-props"])) : (I(), F("svg", pn, x[2] || (x[2] = [
305
- A("circle", {
324
+ "slot-props": { item: i.item, remove: H }
325
+ }, null, 8, ["slot-fn", "slot-props"])) : (_(), P("svg", bn, x[2] || (x[2] = [
326
+ N("circle", {
306
327
  class: "opacity-25",
307
328
  cx: "12",
308
329
  cy: "12",
@@ -311,26 +332,26 @@ const mn = {
311
332
  stroke: "currentColor",
312
333
  "stroke-width": "4"
313
334
  }, null, -1),
314
- A("path", {
335
+ N("path", {
315
336
  class: "opacity-75",
316
337
  fill: "currentColor",
317
338
  d: "M4 12a8 8 0 0 1 8-8v4a4 4 0 0 0-4 4H4z"
318
339
  }, null, -1)
319
340
  ])))
320
- ])) : d.value && p.value ? (I(), F("div", yn, [
321
- A("div", wn, [
322
- i.errorSlotFn ? (I(), kt(oe(f), {
341
+ ])) : u.value && w.value ? (_(), P("div", xn, [
342
+ N("div", kn, [
343
+ i.errorSlotFn ? (_(), Ft(ae(d), {
323
344
  key: 0,
324
345
  "slot-fn": i.errorSlotFn,
325
- "slot-props": { item: i.item, remove: D, error: T.value }
326
- }, null, 8, ["slot-fn", "slot-props"])) : (I(), F("p", bn, "Error " + Ke(T.value), 1))
346
+ "slot-props": { item: i.item, remove: H, error: S.value }
347
+ }, null, 8, ["slot-fn", "slot-props"])) : (_(), P("p", Mn, "Error " + et(S.value), 1))
327
348
  ])
328
- ])) : K("", !0),
329
- d.value && ae.value && !p.value ? (I(), F("img", {
349
+ ])) : ee("", !0),
350
+ u.value && te.value && !w.value ? (_(), P("img", {
330
351
  key: i.item.id + ":img",
331
352
  ref_key: "imgEl",
332
- ref: b,
333
- class: St([
353
+ ref: y,
354
+ class: _t([
334
355
  "h-full w-full object-cover transition-opacity duration-300",
335
356
  g.value ? "opacity-100" : "opacity-0"
336
357
  ]),
@@ -339,229 +360,243 @@ const mn = {
339
360
  height: i.item.height,
340
361
  loading: "lazy",
341
362
  alt: i.item.id,
342
- onLoad: j,
343
- onError: x[0] || (x[0] = (W) => U(W))
344
- }, null, 42, xn)) : d.value && !p.value ? (I(), F("video", {
363
+ onLoad: W,
364
+ onError: x[0] || (x[0] = (J) => K(J))
365
+ }, null, 42, Sn)) : u.value && !w.value ? (_(), P("video", {
345
366
  key: i.item.id + ":vid",
346
- class: St([
367
+ class: _t([
347
368
  "h-full w-full object-cover transition-opacity duration-300",
348
369
  g.value ? "opacity-100" : "opacity-0"
349
370
  ]),
350
- poster: N.value,
371
+ poster: T.value,
351
372
  ref_key: "videoEl",
352
- ref: u,
373
+ ref: h,
353
374
  playsinline: "",
354
375
  loop: "",
355
376
  preload: "metadata",
356
- onLoadedmetadata: xe,
357
- onTimeupdate: he,
358
- onDurationchange: he,
359
- onLoadeddata: he,
360
- onError: x[1] || (x[1] = (W) => U(W))
377
+ onLoadedmetadata: Me,
378
+ onTimeupdate: se,
379
+ onDurationchange: se,
380
+ onLoadeddata: se,
381
+ onError: x[1] || (x[1] = (J) => K(J))
361
382
  }, [
362
- A("source", {
363
- src: E.value,
383
+ N("source", {
384
+ src: I.value,
364
385
  type: "video/mp4"
365
- }, null, 8, kn)
366
- ], 42, Mn)) : K("", !0),
367
- d.value && P.value && !p.value ? (I(), F("div", Sn, [
368
- G(Ht, {
369
- duration: J.value,
370
- "current-time": q.value,
371
- onSeek: Pe
386
+ }, null, 8, Fn)
387
+ ], 42, In)) : ee("", !0),
388
+ u.value && B.value && !w.value ? (_(), P("div", _n, [
389
+ Q(zt, {
390
+ duration: X.value,
391
+ "current-time": $.value,
392
+ onSeek: Be
372
393
  }, null, 8, ["duration", "current-time"])
373
- ])) : K("", !0)
394
+ ])) : ee("", !0)
374
395
  ], 4));
375
396
  }
376
- }), Vt = Symbol("masonryItemRegistry");
377
- function In(l, k) {
378
- return !l || l <= 0 || !k || k <= 0 ? 1 : Math.max(1, Math.floor(l / k));
397
+ }), $t = Symbol("masonryItemRegistry");
398
+ function Pn(o, M) {
399
+ return !o || o <= 0 || !M || M <= 0 ? 1 : Math.max(1, Math.floor(o / M));
400
+ }
401
+ function Tn(o, M, i, a = 0) {
402
+ if (!o || o <= 0 || !M || M <= 0) return i;
403
+ const d = typeof a == "number" && a > 0 ? a : 0, b = Math.max(0, M - 1) * d, y = o - b;
404
+ return !y || y <= 0 ? i : y / M;
379
405
  }
380
- function Fn(l, k, i, r = 0) {
381
- if (!l || l <= 0 || !k || k <= 0) return i;
382
- const f = typeof r == "number" && r > 0 ? r : 0, w = Math.max(0, k - 1) * f, b = l - w;
383
- return !b || b <= 0 ? i : b / k;
406
+ function En(o, M) {
407
+ const i = o?.width, a = o?.height;
408
+ return typeof i == "number" && typeof a == "number" && i > 0 && a > 0 ? a / i * M : M;
384
409
  }
385
- function _n(l, k) {
386
- const i = l?.width, r = l?.height;
387
- return typeof i == "number" && typeof r == "number" && i > 0 && r > 0 ? r / i * k : k;
410
+ function Dt(o) {
411
+ return Number.isFinite(o) && o > 0 ? Math.floor(o) : 1;
388
412
  }
389
- function zt(l) {
390
- return Number.isFinite(l) && l > 0 ? Math.floor(l) : 1;
413
+ function tt(o) {
414
+ return Number.isFinite(o) && o > 0 ? Math.floor(o) : 0;
391
415
  }
392
- function Je(l) {
393
- return Number.isFinite(l) && l > 0 ? Math.floor(l) : 0;
416
+ function Bn() {
417
+ const o = new Error("aborted");
418
+ return o.name = "AbortError", o;
394
419
  }
395
- function Pn(l) {
396
- async function k(r) {
397
- const f = Je(r);
398
- if (f <= 0) return;
399
- l.stats.value = {
400
- ...l.stats.value,
401
- cooldownMsTotal: f,
402
- cooldownMsRemaining: f
420
+ function Rn(o) {
421
+ async function M(a) {
422
+ const d = tt(a);
423
+ if (d <= 0) return;
424
+ o.stats.value = {
425
+ ...o.stats.value,
426
+ cooldownMsTotal: d,
427
+ cooldownMsRemaining: d
403
428
  };
404
- const w = Date.now(), b = 100;
405
- await new Promise((u) => {
406
- const d = setInterval(() => {
407
- const g = Date.now() - w, p = Math.max(0, f - g);
408
- l.stats.value = {
409
- ...l.stats.value,
410
- cooldownMsTotal: f,
411
- cooldownMsRemaining: p
412
- }, p <= 0 && (clearInterval(d), u());
413
- }, b);
429
+ const b = Date.now(), y = 100;
430
+ await new Promise((h) => {
431
+ const u = setInterval(() => {
432
+ const g = Date.now() - b, w = Math.max(0, d - g);
433
+ o.stats.value = {
434
+ ...o.stats.value,
435
+ cooldownMsTotal: d,
436
+ cooldownMsRemaining: w
437
+ }, w <= 0 && (clearInterval(u), h());
438
+ }, y);
414
439
  });
415
440
  }
416
- async function i(r) {
417
- const f = zt(l.getPageSize()), w = l.isEnabled(), b = Je(l.getRequestDelayMs()), u = [];
418
- let d = 0;
419
- l.buffer.value.length && (d = l.buffer.value.length, u.push(...l.buffer.value), l.buffer.value = []), l.stats.value = {
420
- ...l.stats.value,
421
- enabled: w,
441
+ async function i(a) {
442
+ const d = Dt(o.getPageSize()), b = o.isEnabled(), y = tt(o.getRequestDelayMs()), h = o.stats.value.page ?? null, u = o.getCancelToken?.() ?? null, g = () => u !== null && o.getCancelToken && o.getCancelToken() !== u, w = () => {
443
+ if (g()) throw Bn();
444
+ }, S = [];
445
+ let B = 0;
446
+ o.buffer.value.length && (B = o.buffer.value.length, S.push(...o.buffer.value), o.buffer.value = []), o.stats.value = {
447
+ ...o.stats.value,
448
+ enabled: b,
422
449
  isBackfillActive: !1,
423
450
  isRequestInFlight: !1,
424
- requestPage: null,
425
- cooldownMsTotal: b,
451
+ page: h ?? a,
452
+ next: a,
453
+ cooldownMsTotal: y,
426
454
  cooldownMsRemaining: 0,
427
455
  progress: {
428
456
  collected: 0,
429
457
  target: 0
430
458
  },
431
- pageSize: f,
459
+ pageSize: d,
432
460
  bufferSize: 0
433
461
  };
434
- const g = [];
435
- let p = r, T = 0, P = !1;
436
- for (; u.length < f && p != null; ) {
437
- const L = p;
438
- P && (l.stats.value = {
439
- ...l.stats.value,
440
- enabled: w,
462
+ const T = [];
463
+ let I = a, z = 0, A = !1;
464
+ for (; S.length < d && I != null; ) {
465
+ w();
466
+ const H = I;
467
+ A && (o.stats.value = {
468
+ ...o.stats.value,
469
+ enabled: b,
441
470
  isBackfillActive: !0,
442
471
  isRequestInFlight: !0,
443
- requestPage: L,
472
+ page: H,
473
+ next: null,
444
474
  progress: {
445
- collected: Math.min(u.length, f),
446
- target: f
475
+ collected: Math.min(S.length, d),
476
+ target: d
447
477
  },
448
- cooldownMsTotal: b,
478
+ cooldownMsTotal: y,
449
479
  cooldownMsRemaining: 0,
450
- pageSize: f
480
+ pageSize: d
451
481
  });
452
- const H = await l.getContent(L);
453
- g.push(L), P && (l.stats.value = {
454
- ...l.stats.value,
455
- enabled: w,
482
+ const q = await o.getContent(H);
483
+ w(), T.push(H), A && (o.stats.value = {
484
+ ...o.stats.value,
485
+ enabled: b,
456
486
  isBackfillActive: !0,
457
487
  isRequestInFlight: !1,
458
- requestPage: null
459
- }), T += H.items.length, l.markEnterFromLeft(H.items), u.push(...H.items), p = H.nextPage, !P && u.length < f && p != null ? (P = !0, l.stats.value = {
460
- ...l.stats.value,
461
- enabled: w,
488
+ page: H,
489
+ next: q.nextPage
490
+ }), z += q.items.length, o.markEnterFromLeft(q.items), S.push(...q.items), I = q.nextPage, !A && S.length < d && I != null ? (A = !0, o.stats.value = {
491
+ ...o.stats.value,
492
+ enabled: b,
462
493
  isBackfillActive: !0,
463
494
  isRequestInFlight: !1,
464
- requestPage: null,
495
+ page: H,
496
+ next: I,
465
497
  progress: {
466
- collected: Math.min(u.length, f),
467
- target: f
498
+ collected: Math.min(S.length, d),
499
+ target: d
468
500
  },
469
- cooldownMsTotal: b,
501
+ cooldownMsTotal: y,
470
502
  cooldownMsRemaining: 0,
471
- pageSize: f
472
- }) : P && (l.stats.value = {
473
- ...l.stats.value,
474
- enabled: w,
503
+ pageSize: d
504
+ }) : A && (o.stats.value = {
505
+ ...o.stats.value,
506
+ enabled: b,
475
507
  isBackfillActive: !0,
508
+ page: H,
509
+ next: I,
476
510
  progress: {
477
- collected: Math.min(u.length, f),
478
- target: f
511
+ collected: Math.min(S.length, d),
512
+ target: d
479
513
  }
480
- }), P && u.length < f && p != null && await k(b);
514
+ }), A && S.length < d && I != null && (await M(y), w());
481
515
  }
482
- const N = u.slice(0, f), E = u.slice(f);
483
- return l.buffer.value = E, l.stats.value = {
484
- ...l.stats.value,
485
- enabled: w,
516
+ const X = S.slice(0, d), $ = S.slice(d);
517
+ return o.buffer.value = $, o.stats.value = {
518
+ ...o.stats.value,
519
+ enabled: b,
486
520
  isBackfillActive: !1,
487
521
  isRequestInFlight: !1,
488
- requestPage: null,
522
+ page: T.length ? T[T.length - 1] : h ?? a,
523
+ next: I,
489
524
  progress: {
490
525
  collected: 0,
491
526
  target: 0
492
527
  },
493
- cooldownMsTotal: b,
528
+ cooldownMsTotal: y,
494
529
  cooldownMsRemaining: 0,
495
- pageSize: f,
496
- bufferSize: E.length,
530
+ pageSize: d,
531
+ bufferSize: $.length,
497
532
  lastBatch: {
498
- startPage: r,
499
- pages: g,
500
- usedFromBuffer: d,
501
- fetchedFromNetwork: T,
502
- collectedTotal: u.length,
503
- emitted: N.length,
504
- carried: E.length
533
+ startPage: a,
534
+ pages: T,
535
+ usedFromBuffer: B,
536
+ fetchedFromNetwork: z,
537
+ collectedTotal: S.length,
538
+ emitted: X.length,
539
+ carried: $.length
505
540
  },
506
541
  totals: {
507
- pagesFetched: l.stats.value.totals.pagesFetched + g.length,
508
- itemsFetchedFromNetwork: l.stats.value.totals.itemsFetchedFromNetwork + T
542
+ pagesFetched: o.stats.value.totals.pagesFetched + T.length,
543
+ itemsFetchedFromNetwork: o.stats.value.totals.itemsFetchedFromNetwork + z
509
544
  }
510
- }, { batchItems: N, pages: g, nextPage: p };
545
+ }, { batchItems: X, pages: T, nextPage: I };
511
546
  }
512
547
  return { loadBackfillBatch: i };
513
548
  }
514
- function Tn(l) {
515
- const k = l.columnCount, i = l.columnWidth, r = l.gapX, f = l.gapY, w = l.headerHeight, b = l.footerHeight, u = l.bucketPx, d = Array.from({ length: k }, () => 0), g = new Array(l.items.length), p = new Array(l.items.length), T = /* @__PURE__ */ new Map(), P = /* @__PURE__ */ new Map();
516
- let N = 0;
517
- for (let E = 0; E < l.items.length; E += 1) {
518
- const L = l.items[E];
519
- L?.id && P.set(L.id, E);
520
- let H = 0;
521
- for (let c = 1; c < d.length; c += 1)
522
- d[c] < d[H] && (H = c);
523
- const J = H * (i + r), q = d[H], D = _n(L, i) + w + b;
524
- g[E] = { x: J, y: q }, p[E] = D, d[H] = q + D + f, N = Math.max(N, q + D);
525
- const le = Math.floor(q / u), ae = Math.floor((q + D) / u);
526
- for (let c = le; c <= ae; c += 1) {
527
- const S = T.get(c);
528
- S ? S.push(E) : T.set(c, [E]);
549
+ function An(o) {
550
+ const M = o.columnCount, i = o.columnWidth, a = o.gapX, d = o.gapY, b = o.headerHeight, y = o.footerHeight, h = o.bucketPx, u = Array.from({ length: M }, () => 0), g = new Array(o.items.length), w = new Array(o.items.length), S = /* @__PURE__ */ new Map(), B = /* @__PURE__ */ new Map();
551
+ let T = 0;
552
+ for (let I = 0; I < o.items.length; I += 1) {
553
+ const z = o.items[I];
554
+ z?.id && B.set(z.id, I);
555
+ let A = 0;
556
+ for (let c = 1; c < u.length; c += 1)
557
+ u[c] < u[A] && (A = c);
558
+ const X = A * (i + a), $ = u[A], H = En(z, i) + b + y;
559
+ g[I] = { x: X, y: $ }, w[I] = H, u[A] = $ + H + d, T = Math.max(T, $ + H);
560
+ const q = Math.floor($ / h), te = Math.floor(($ + H) / h);
561
+ for (let c = q; c <= te; c += 1) {
562
+ const F = S.get(c);
563
+ F ? F.push(I) : S.set(c, [I]);
529
564
  }
530
565
  }
531
- return { positions: g, heights: p, buckets: T, contentHeight: N, indexById: P };
566
+ return { positions: g, heights: w, buckets: S, contentHeight: T, indexById: B };
532
567
  }
533
- function En(l) {
534
- const k = l.itemCount;
535
- if (!k) return [];
536
- if (l.viewportHeight <= 0) return Array.from({ length: k }, (d, g) => g);
537
- const i = Math.max(0, l.scrollTop - l.overscanPx), r = l.scrollTop + l.viewportHeight + l.overscanPx, f = Math.floor(i / l.bucketPx), w = Math.floor(r / l.bucketPx), b = /* @__PURE__ */ new Set();
538
- for (let d = f; d <= w; d += 1) {
539
- const g = l.buckets.get(d);
568
+ function Cn(o) {
569
+ const M = o.itemCount;
570
+ if (!M) return [];
571
+ if (o.viewportHeight <= 0) return Array.from({ length: M }, (u, g) => g);
572
+ const i = Math.max(0, o.scrollTop - o.overscanPx), a = o.scrollTop + o.viewportHeight + o.overscanPx, d = Math.floor(i / o.bucketPx), b = Math.floor(a / o.bucketPx), y = /* @__PURE__ */ new Set();
573
+ for (let u = d; u <= b; u += 1) {
574
+ const g = o.buckets.get(u);
540
575
  if (g)
541
- for (const p of g) b.add(p);
576
+ for (const w of g) y.add(w);
542
577
  }
543
- const u = Array.from(b);
544
- return u.sort((d, g) => d - g), u;
578
+ const h = Array.from(y);
579
+ return h.sort((u, g) => u - g), h;
545
580
  }
546
- const Bn = { class: "hidden" }, Rn = {
581
+ const Nn = { class: "hidden" }, Hn = {
547
582
  key: 0,
548
583
  class: "flex h-full items-center justify-center"
549
- }, An = {
584
+ }, Ln = {
550
585
  key: 1,
551
586
  class: "text-sm font-medium text-red-700"
552
- }, Cn = ["onMouseenter", "onMouseleave"], Nn = {
587
+ }, Vn = ["onMouseenter", "onMouseleave"], zn = {
553
588
  key: 0,
554
589
  class: "pointer-events-auto absolute inset-0 z-10"
555
- }, Hn = { class: "relative" }, Vn = {
590
+ }, $n = { class: "relative" }, Dn = {
556
591
  key: 0,
557
592
  class: "pointer-events-auto absolute inset-0 z-10"
558
- }, zn = { class: "mt-4 pb-2 text-center text-xs text-slate-600" }, Ln = {
593
+ }, On = { class: "mt-4 pb-2 text-center text-xs text-slate-600" }, Yn = {
559
594
  key: 0,
560
595
  class: "inline-flex items-center justify-center gap-2"
561
- }, $n = { key: 1 }, Dn = { key: 2 }, Et = 100, qn = 200, Bt = 600, Rt = 300, At = 600, Ct = 600, On = 400, Yn = 5, Xn = 1e3, jn = /* @__PURE__ */ be({
596
+ }, qn = { key: 1 }, Xn = { key: 2 }, At = 100, jn = 200, Ct = 600, Nt = 300, Ht = 600, Lt = 600, Un = 400, Wn = 5, Gn = 1e3, Kn = /* @__PURE__ */ xe({
562
597
  inheritAttrs: !1,
563
598
  __name: "Masonry",
564
- props: /* @__PURE__ */ sn({
599
+ props: /* @__PURE__ */ fn({
565
600
  getContent: {},
566
601
  mode: {},
567
602
  pageSize: {},
@@ -577,10 +612,10 @@ const Bn = { class: "hidden" }, Rn = {
577
612
  headerHeight: {},
578
613
  footerHeight: {},
579
614
  overscanPx: {}
580
- }, mn),
581
- emits: ["update:items", "preloaded", "failures"],
582
- setup(l, { expose: k, emit: i }) {
583
- const r = l, f = i, w = un(), b = be({
615
+ }, pn),
616
+ emits: ["update:items", "preloaded", "failures", "removed"],
617
+ setup(o, { expose: M, emit: i }) {
618
+ const a = o, d = i, b = dn(), y = xe({
584
619
  name: "SlotRenderer",
585
620
  props: {
586
621
  slotFn: {
@@ -598,281 +633,282 @@ const Bn = { class: "hidden" }, Rn = {
598
633
  return n ? n(e.slotProps) : null;
599
634
  };
600
635
  }
601
- }), u = It(null), d = m(null);
636
+ }), h = Pt(null), u = v(null);
602
637
  function g(e) {
603
- d.value = e;
638
+ u.value = e;
604
639
  }
605
- function p(e) {
606
- d.value === e && (d.value = null);
640
+ function w(e) {
641
+ u.value === e && (u.value = null);
607
642
  }
608
- cn(Vt, (e) => {
609
- u.value || (u.value = e);
643
+ vn($t, (e) => {
644
+ h.value || (h.value = e);
610
645
  });
611
- const T = [], P = [];
612
- let N = null, E = null;
613
- function L() {
614
- if (!T.length) return;
615
- const e = T.splice(0, T.length);
616
- f("preloaded", e);
617
- }
618
- function H() {
619
- if (!P.length) return;
620
- const e = P.splice(0, P.length);
621
- f("failures", e);
622
- }
623
- function J() {
624
- N || (N = setTimeout(() => {
625
- N = null, L();
626
- }, Et));
627
- }
628
- function q() {
629
- E || (E = setTimeout(() => {
630
- E = null, H();
631
- }, Et));
632
- }
633
- function D(e) {
634
- u.value?.onPreloaded?.(e), T.push(e), J();
635
- }
636
- function le(e) {
637
- u.value?.onFailed?.(e), P.push(e), q();
638
- }
639
- Ge(() => {
640
- if (!u.value)
646
+ const S = [], B = [];
647
+ let T = null, I = null;
648
+ function z() {
649
+ if (!S.length) return;
650
+ const e = S.splice(0, S.length);
651
+ d("preloaded", e);
652
+ }
653
+ function A() {
654
+ if (!B.length) return;
655
+ const e = B.splice(0, B.length);
656
+ d("failures", e);
657
+ }
658
+ function X() {
659
+ T || (T = setTimeout(() => {
660
+ T = null, z();
661
+ }, At));
662
+ }
663
+ function $() {
664
+ I || (I = setTimeout(() => {
665
+ I = null, A();
666
+ }, At));
667
+ }
668
+ function H(e) {
669
+ h.value?.onPreloaded?.(e), S.push(e), X();
670
+ }
671
+ function q(e) {
672
+ h.value?.onFailed?.(e), B.push(e), $();
673
+ }
674
+ Ze(() => {
675
+ if (!h.value)
641
676
  throw new Error("[Masonry] Missing <MasonryItem> definition. Add <MasonryItem> as a child of <Masonry>.");
642
677
  });
643
- const ae = M(() => {
644
- const { class: e, ...n } = w;
678
+ const te = k(() => {
679
+ const { class: e, ...n } = b;
645
680
  return n;
646
- }), c = m(null), S = m(0), B = m(0), O = m(0);
681
+ }), c = v(null), F = v(0), R = v(0), j = v(0);
647
682
  let re;
648
- const Q = M(() => r.gapX), _e = M(() => r.gapY);
649
- function Pe(e) {
683
+ const ne = k(() => a.gapX), Ee = k(() => a.gapY);
684
+ function Be(e) {
650
685
  if (!e) return 0;
651
- const n = Math.max(0, Q.value);
686
+ const n = Math.max(0, ne.value);
652
687
  return Math.max(0, e.clientWidth - n);
653
688
  }
654
- const j = M(() => r.headerHeight), U = M(() => r.footerHeight), xe = M(() => u.value?.header), he = M(() => u.value?.loader), s = M(() => u.value?.footer), x = M(() => u.value?.overlay), W = M(() => u.value?.error), Te = M(() => !!xe.value), Me = M(() => !!s.value), Qe = M(() => !!x.value), Ze = M(() => {
655
- if (j.value > 0) return { height: `${j.value}px` };
656
- }), et = M(() => {
657
- if (U.value > 0) return { height: `${U.value}px` };
658
- }), ke = m([]), Le = m([]), tt = m(/* @__PURE__ */ new Map()), nt = m(0), Ee = m(/* @__PURE__ */ new Map());
659
- function Lt(e) {
689
+ const W = k(() => a.headerHeight), K = k(() => a.footerHeight), ke = k(() => h.value?.header), Me = k(() => h.value?.loader), se = k(() => h.value?.footer), s = k(() => h.value?.overlay), x = k(() => h.value?.error), J = k(() => !!ke.value), Re = k(() => !!se.value), Se = k(() => !!s.value), nt = k(() => {
690
+ if (W.value > 0) return { height: `${W.value}px` };
691
+ }), ot = k(() => {
692
+ if (K.value > 0) return { height: `${K.value}px` };
693
+ }), Ie = v([]), Ye = v([]), lt = v(/* @__PURE__ */ new Map()), at = v(0), Ae = v(/* @__PURE__ */ new Map());
694
+ function Ot(e) {
660
695
  const n = typeof e == "number" && Number.isFinite(e) ? e : 0;
661
- return O.value + B.value + Math.max(0, n);
696
+ return j.value + R.value + Math.max(0, n);
662
697
  }
663
- const se = m(/* @__PURE__ */ new Set()), ie = m(/* @__PURE__ */ new Set()), Be = /* @__PURE__ */ new Set(), Se = m(/* @__PURE__ */ new Map());
664
- function $t(e) {
698
+ const ie = v(/* @__PURE__ */ new Set()), ue = v(/* @__PURE__ */ new Set()), Ce = /* @__PURE__ */ new Set(), Fe = v(/* @__PURE__ */ new Map());
699
+ function Yt(e) {
665
700
  return Number.isFinite(e) ? Math.max(0, Math.min(250, e)) : 0;
666
701
  }
667
- function Dt(e) {
668
- if (!ie.value.has(e)) return;
669
- const n = Se.value.get(e) ?? 0;
702
+ function qt(e) {
703
+ if (!ue.value.has(e)) return;
704
+ const n = Fe.value.get(e) ?? 0;
670
705
  if (!(n <= 0))
671
706
  return `${n}ms`;
672
707
  }
673
- const Re = m(/* @__PURE__ */ new Map()), Z = m(/* @__PURE__ */ new Set()), ee = m([]);
674
- function qt(e) {
675
- const n = Re.value.get(e);
708
+ const Ne = v(/* @__PURE__ */ new Map()), oe = v(/* @__PURE__ */ new Set()), le = v([]);
709
+ function Xt(e) {
710
+ const n = Ne.value.get(e);
676
711
  return n || { dx: 0, dy: 0 };
677
712
  }
678
- function Ot(e) {
679
- if (ie.value.has(e)) return `transform ${At}ms ease-out`;
680
- if (Z.value.has(e)) return `transform ${Rt}ms ease-out`;
713
+ function jt(e) {
714
+ if (ue.value.has(e)) return `transform ${Ht}ms ease-out`;
715
+ if (oe.value.has(e)) return `transform ${Nt}ms ease-out`;
681
716
  }
682
- function Yt(e) {
683
- const t = h.value[e]?.id, o = ke.value[e] ?? { x: 0, y: 0 }, a = Le.value[e] ?? 0, v = a > 0 ? a : Fe.value, y = o.x, R = t && se.value.has(t) ? Lt(v) : o.y, V = t ? qt(t) : { dx: 0, dy: 0 };
684
- return `translate3d(${y + V.dx}px,${R + V.dy}px,0)`;
717
+ function Ut(e) {
718
+ const t = m.value[e]?.id, l = Ie.value[e] ?? { x: 0, y: 0 }, r = Ye.value[e] ?? 0, f = r > 0 ? r : Te.value, p = l.x, E = t && ie.value.has(t) ? Ot(f) : l.y, O = t ? Xt(t) : { dx: 0, dy: 0 };
719
+ return `translate3d(${p + O.dx}px,${E + O.dy}px,0)`;
685
720
  }
686
- function ge(e) {
721
+ function pe(e) {
687
722
  (typeof requestAnimationFrame == "function" ? requestAnimationFrame : (t) => setTimeout(() => t(0), 0))(() => e());
688
723
  }
689
- function Xt(e) {
690
- ge(() => ge(e));
724
+ function Wt(e) {
725
+ pe(() => pe(e));
691
726
  }
692
- const ot = /* @__PURE__ */ new Set();
693
- function lt(e) {
727
+ const rt = /* @__PURE__ */ new Set();
728
+ function st(e) {
694
729
  return typeof e == "number" && Number.isFinite(e) && e > 0;
695
730
  }
696
- function Ae(e) {
731
+ function He(e) {
697
732
  if (!Array.isArray(e) || e.length === 0) return;
698
- const n = new Set(se.value);
733
+ const n = new Set(ie.value);
699
734
  let t = !1;
700
- for (const o of e) {
701
- const a = o?.id;
702
- if (a) {
703
- if (!ot.has(a)) {
704
- const v = o?.width, y = o?.height;
705
- (!lt(v) || !lt(y)) && (ot.add(a), console.warn(
706
- `[Masonry] Item "${a}" has invalid dimensions (width=${String(v)}, height=${String(
707
- y
735
+ for (const l of e) {
736
+ const r = l?.id;
737
+ if (r) {
738
+ if (!rt.has(r)) {
739
+ const f = l?.width, p = l?.height;
740
+ (!st(f) || !st(p)) && (rt.add(r), console.warn(
741
+ `[Masonry] Item "${r}" has invalid dimensions (width=${String(f)}, height=${String(
742
+ p
708
743
  )}); layout expects { id, width, height }.`
709
744
  ));
710
745
  }
711
- n.has(a) || (n.add(a), t = !0);
746
+ n.has(r) || (n.add(r), t = !0);
712
747
  }
713
748
  }
714
- t && (se.value = n);
749
+ t && (ie.value = n);
715
750
  }
716
- function at() {
751
+ function it() {
717
752
  const e = /* @__PURE__ */ new Map();
718
- for (const n of je.value) {
719
- const o = h.value[n]?.id;
720
- if (!o) continue;
721
- const a = ke.value[n];
722
- a && e.set(o, { x: a.x, y: a.y });
753
+ for (const n of Ge.value) {
754
+ const l = m.value[n]?.id;
755
+ if (!l) continue;
756
+ const r = Ie.value[n];
757
+ r && e.set(l, { x: r.x, y: r.y });
723
758
  }
724
759
  return e;
725
760
  }
726
- function rt(e, n) {
761
+ function ut(e, n) {
727
762
  if (!e.size) return;
728
- const t = /* @__PURE__ */ new Map(), o = [];
729
- for (const [v, y] of e.entries()) {
730
- if (n?.has(v)) continue;
731
- const R = Ee.value.get(v);
732
- if (R == null) continue;
733
- const V = ke.value[R];
734
- if (!V) continue;
735
- const C = y.x - V.x, _ = y.y - V.y;
736
- (C || _) && (t.set(v, { dx: C, dy: _ }), o.push(v));
763
+ const t = /* @__PURE__ */ new Map(), l = [];
764
+ for (const [f, p] of e.entries()) {
765
+ if (n?.has(f)) continue;
766
+ const E = Ae.value.get(f);
767
+ if (E == null) continue;
768
+ const O = Ie.value[E];
769
+ if (!O) continue;
770
+ const Y = p.x - O.x, V = p.y - O.y;
771
+ (Y || V) && (t.set(f, { dx: Y, dy: V }), l.push(f));
737
772
  }
738
773
  if (!t.size) return;
739
- Re.value = t;
740
- const a = new Set(Z.value);
741
- for (const v of o) a.delete(v);
742
- Z.value = a, ge(() => {
743
- Z.value = /* @__PURE__ */ new Set([...Z.value, ...o]), ge(() => {
744
- Re.value = /* @__PURE__ */ new Map();
774
+ Ne.value = t;
775
+ const r = new Set(oe.value);
776
+ for (const f of l) r.delete(f);
777
+ oe.value = r, pe(() => {
778
+ oe.value = /* @__PURE__ */ new Set([...oe.value, ...l]), pe(() => {
779
+ Ne.value = /* @__PURE__ */ new Map();
745
780
  });
746
781
  }), setTimeout(() => {
747
- const v = new Set(Z.value);
748
- for (const y of o) v.delete(y);
749
- Z.value = v;
750
- }, Rt);
751
- }
752
- const ue = m(!0), ce = m(!1), pe = m("");
753
- let $ = 0, $e = 0, De = 0;
754
- function st(e) {
782
+ const f = new Set(oe.value);
783
+ for (const p of l) f.delete(p);
784
+ oe.value = f;
785
+ }, Nt);
786
+ }
787
+ const ce = v(!0), fe = v(!1), ye = v("");
788
+ let D = 0, qe = 0, Le = 0, Ve = 0, _e = !1;
789
+ function ct(e) {
755
790
  return e instanceof Error && e.name === "AbortError";
756
791
  }
757
- function it() {
792
+ function ft() {
758
793
  const e = new Error("aborted");
759
794
  return e.name = "AbortError", e;
760
795
  }
761
- function jt(e) {
796
+ function Gt(e) {
762
797
  return new Promise((n) => setTimeout(n, e));
763
798
  }
764
- async function ut(e, n) {
799
+ async function dt(e, n) {
765
800
  let t = 0;
766
801
  for (; ; ) {
767
- if (n !== $) throw it();
802
+ if (n !== D) throw ft();
768
803
  try {
769
- return await r.getContent(e);
770
- } catch (o) {
771
- if (n !== $) throw it();
772
- if (t >= Yn) throw o;
773
- t += 1, await jt(t * Xn);
804
+ return await a.getContent(e);
805
+ } catch (l) {
806
+ if (n !== D) throw ft();
807
+ if (t >= Wn) throw l;
808
+ t += 1, await Gt(t * Gn);
774
809
  }
775
810
  }
776
811
  }
777
- const X = m([]), ct = m([]), qe = m([]), z = m(r.page), Ce = m([]);
778
- let fe = null, de = null, Ne = 0;
779
- function Ut(e) {
812
+ const G = v([]), vt = v([]), Xe = v([]), L = v(a.page), ze = v([]);
813
+ let de = null, ve = null, $e = 0;
814
+ function Kt(e) {
780
815
  let n = -1;
781
816
  for (const t of e) {
782
- const o = t?.originalIndex;
783
- Ie(o) && o > n && (n = o);
817
+ const l = t?.originalIndex;
818
+ Pe(l) && l > n && (n = l);
784
819
  }
785
- Ne = n + 1;
820
+ $e = n + 1;
786
821
  }
787
- function ye(e) {
822
+ function we(e) {
788
823
  for (const n of e)
789
- !n || typeof n != "object" || n.id && n.originalIndex == null && (n.originalIndex = Ne, Ne += 1);
824
+ !n || typeof n != "object" || n.id && n.originalIndex == null && (n.originalIndex = $e, $e += 1);
790
825
  }
791
- const ve = /* @__PURE__ */ new Map(), me = [];
792
- function Ie(e) {
826
+ const me = /* @__PURE__ */ new Map(), he = [];
827
+ function Pe(e) {
793
828
  return typeof e == "number" && Number.isFinite(e);
794
829
  }
795
- function Wt(e, n) {
830
+ function Jt(e, n) {
796
831
  if (!n.length) return e;
797
832
  const t = /* @__PURE__ */ new Set();
798
- for (const y of e) {
799
- const R = y?.id;
800
- R && t.add(R);
833
+ for (const p of e) {
834
+ const E = p?.id;
835
+ E && t.add(E);
801
836
  }
802
- const o = [];
803
- for (const y of n) {
804
- const R = y?.id;
805
- R && (t.has(R) || (o.push(y), t.add(R)));
837
+ const l = [];
838
+ for (const p of n) {
839
+ const E = p?.id;
840
+ E && (t.has(E) || (l.push(p), t.add(E)));
806
841
  }
807
- if (!o.length) return e;
808
- const a = o.slice().sort((y, R) => {
809
- const V = Ie(y.originalIndex) ? y.originalIndex : Number.POSITIVE_INFINITY, C = Ie(R.originalIndex) ? R.originalIndex : Number.POSITIVE_INFINITY;
810
- return V - C;
811
- }), v = e.slice();
812
- for (const y of a) {
813
- const R = y.originalIndex;
814
- if (!Ie(R)) {
815
- v.push(y);
842
+ if (!l.length) return e;
843
+ const r = l.slice().sort((p, E) => {
844
+ const O = Pe(p.originalIndex) ? p.originalIndex : Number.POSITIVE_INFINITY, Y = Pe(E.originalIndex) ? E.originalIndex : Number.POSITIVE_INFINITY;
845
+ return O - Y;
846
+ }), f = e.slice();
847
+ for (const p of r) {
848
+ const E = p.originalIndex;
849
+ if (!Pe(E)) {
850
+ f.push(p);
816
851
  continue;
817
852
  }
818
- let V = 0, C = v.length;
819
- for (; V < C; ) {
820
- const _ = V + C >> 1, te = v[_]?.originalIndex;
821
- (Ie(te) ? te : Number.POSITIVE_INFINITY) <= R ? V = _ + 1 : C = _;
853
+ let O = 0, Y = f.length;
854
+ for (; O < Y; ) {
855
+ const V = O + Y >> 1, C = f[V]?.originalIndex;
856
+ (Pe(C) ? C : Number.POSITIVE_INFINITY) <= E ? O = V + 1 : Y = V;
822
857
  }
823
- v.splice(V, 0, y);
858
+ f.splice(O, 0, p);
824
859
  }
825
- return v;
860
+ return f;
826
861
  }
827
- async function ft(e) {
862
+ async function mt(e) {
828
863
  if (!e.length) return;
829
- Ae(e);
830
- const n = at();
831
- h.value = Wt(h.value, e), await Pt(), rt(n);
864
+ _e = !0, He(e);
865
+ const n = it();
866
+ m.value = Jt(m.value, e), await Bt(), ut(n);
832
867
  }
833
- async function Gt(e) {
834
- const t = (Array.isArray(e) ? e : [e]).map(Xe).filter(Boolean);
868
+ async function Qt(e) {
869
+ const t = (Array.isArray(e) ? e : [e]).map(We).filter(Boolean);
835
870
  if (!t.length) return;
836
- const o = [];
837
- for (const a of t) {
838
- const v = ve.get(a);
839
- v && o.push(v);
871
+ const l = [];
872
+ for (const r of t) {
873
+ const f = me.get(r);
874
+ f && l.push(f);
840
875
  }
841
- if (o.length) {
842
- await ft(o);
843
- for (const a of o)
844
- a?.id && ve.delete(a.id);
876
+ if (l.length) {
877
+ await mt(l);
878
+ for (const r of l)
879
+ r?.id && me.delete(r.id);
845
880
  }
846
881
  }
847
- async function Kt() {
848
- const e = me.pop();
882
+ async function Zt() {
883
+ const e = he.pop();
849
884
  if (!e?.length) return;
850
885
  const n = [];
851
886
  for (const t of e) {
852
- const o = ve.get(t);
853
- o && n.push(o);
887
+ const l = me.get(t);
888
+ l && n.push(l);
854
889
  }
855
890
  if (n.length) {
856
- await ft(n);
891
+ await mt(n);
857
892
  for (const t of n)
858
- t?.id && ve.delete(t.id);
893
+ t?.id && me.delete(t.id);
859
894
  }
860
895
  }
861
- function Jt(e) {
862
- const t = (Array.isArray(e) ? e : [e]).map(Xe).filter(Boolean);
896
+ function en(e) {
897
+ const t = (Array.isArray(e) ? e : [e]).map(We).filter(Boolean);
863
898
  if (!t.length) return;
864
- const o = new Set(t);
865
- for (const a of o) ve.delete(a);
866
- for (let a = me.length - 1; a >= 0; a -= 1) {
867
- const y = me[a].filter((R) => !o.has(R));
868
- y.length ? me[a] = y : me.splice(a, 1);
899
+ const l = new Set(t);
900
+ for (const r of l) me.delete(r);
901
+ for (let r = he.length - 1; r >= 0; r -= 1) {
902
+ const p = he[r].filter((E) => !l.has(E));
903
+ p.length ? he[r] = p : he.splice(r, 1);
869
904
  }
870
905
  }
871
- const Oe = It({
906
+ const je = Pt({
872
907
  enabled: !1,
873
908
  isBackfillActive: !1,
874
909
  isRequestInFlight: !1,
875
- requestPage: null,
910
+ page: a.page,
911
+ next: a.page,
876
912
  progress: {
877
913
  collected: 0,
878
914
  target: 0
@@ -886,241 +922,248 @@ const Bn = { class: "hidden" }, Rn = {
886
922
  pagesFetched: 0,
887
923
  itemsFetchedFromNetwork: 0
888
924
  }
889
- }), dt = Pn({
890
- getContent: (e) => ut(e, $),
891
- markEnterFromLeft: Ae,
892
- buffer: Ce,
893
- stats: Oe,
894
- isEnabled: () => r.mode === "backfill",
895
- getPageSize: () => r.pageSize,
896
- getRequestDelayMs: () => r.backfillRequestDelayMs
897
- }), He = M(() => r.items !== void 0);
898
- ne(
899
- () => r.items,
925
+ }), ht = Rn({
926
+ getContent: (e) => dt(e, D),
927
+ markEnterFromLeft: He,
928
+ buffer: ze,
929
+ stats: je,
930
+ isEnabled: () => a.mode === "backfill",
931
+ getPageSize: () => a.pageSize,
932
+ getRequestDelayMs: () => a.backfillRequestDelayMs,
933
+ getCancelToken: () => qe
934
+ }), De = k(() => a.items !== void 0);
935
+ Z(
936
+ () => a.items,
900
937
  (e) => {
901
- He.value && (qe.value = Array.isArray(e) ? e : []);
938
+ De.value && (Xe.value = Array.isArray(e) ? e : []);
902
939
  },
903
940
  { immediate: !0 }
904
941
  );
905
- const h = M({
942
+ const m = k({
906
943
  get() {
907
- return He.value ? qe.value : ct.value;
944
+ return De.value ? Xe.value : vt.value;
908
945
  },
909
946
  set(e) {
910
- He.value ? (qe.value = e, f("update:items", e)) : ct.value = e;
947
+ De.value ? (Xe.value = e, d("update:items", e)) : vt.value = e;
911
948
  }
912
- }), we = m(!1), Ye = m(!1);
913
- async function vt(e) {
914
- const n = await ut(e, $);
915
- return ye(n.items), Ae(n.items), { items: n.items, nextPage: n.nextPage };
949
+ }), be = v(!1), Ue = v(!1);
950
+ async function gt(e) {
951
+ const n = await dt(e, D);
952
+ return we(n.items), He(n.items), { items: n.items, nextPage: n.nextPage };
916
953
  }
917
- function Xe(e) {
954
+ function We(e) {
918
955
  return e ? typeof e == "string" ? e : e?.id : null;
919
956
  }
920
- async function mt(e) {
921
- const t = (Array.isArray(e) ? e : [e]).map(Xe).filter(Boolean);
957
+ async function pt(e) {
958
+ const t = (Array.isArray(e) ? e : [e]).map(We).filter(Boolean);
922
959
  if (!t.length) return;
923
- const o = new Set(t), a = [];
924
- for (const C of o) {
925
- const _ = Ee.value.get(C);
926
- if (_ == null) continue;
927
- const te = h.value[_];
928
- te && (ve.set(C, te), a.push(C));
960
+ const l = new Set(t), r = [], f = [];
961
+ for (const V of l) {
962
+ const C = Ae.value.get(V);
963
+ if (C == null) continue;
964
+ const ge = m.value[C];
965
+ ge && (me.set(V, ge), f.push(V), r.push(ge));
929
966
  }
930
- a.length && me.push(a);
931
- const v = at(), y = Fe.value, R = O.value + B.value, V = [];
932
- for (const C of o) {
933
- const _ = Ee.value.get(C);
934
- if (_ == null) continue;
935
- const te = h.value[_];
936
- if (!te) continue;
937
- const ze = ke.value[_] ?? { x: 0, y: 0 }, Mt = Le.value[_] ?? y, rn = Math.max(ze.y, R);
938
- V.push({
939
- id: C,
940
- item: te,
941
- fromX: ze.x,
942
- fromY: ze.y,
943
- toY: rn + Math.max(0, Mt),
944
- width: y,
945
- height: Mt,
967
+ f.length && (he.push(f), _e = !0);
968
+ const p = it(), E = Te.value, O = j.value + R.value, Y = [];
969
+ for (const V of l) {
970
+ const C = Ae.value.get(V);
971
+ if (C == null) continue;
972
+ const ge = m.value[C];
973
+ if (!ge) continue;
974
+ const Qe = Ie.value[C] ?? { x: 0, y: 0 }, It = Ye.value[C] ?? E, cn = Math.max(Qe.y, O);
975
+ Y.push({
976
+ id: V,
977
+ item: ge,
978
+ fromX: Qe.x,
979
+ fromY: Qe.y,
980
+ toY: cn + Math.max(0, It),
981
+ width: E,
982
+ height: It,
946
983
  leaving: !0
947
984
  });
948
985
  }
949
- if (V.length && (ee.value = [...ee.value, ...V]), h.value = h.value.filter((C) => {
950
- const _ = C?.id;
951
- return !_ || !o.has(_);
952
- }), await Pt(), rt(v, o), V.length) {
953
- const C = new Set(V.map((_) => _.id));
954
- ge(() => {
955
- ee.value = ee.value.map(
956
- (_) => C.has(_.id) ? { ..._, leaving: !1 } : _
986
+ if (Y.length && (le.value = [...le.value, ...Y]), m.value = m.value.filter((V) => {
987
+ const C = V?.id;
988
+ return !C || !l.has(C);
989
+ }), await Bt(), ut(p, l), Y.length) {
990
+ const V = new Set(Y.map((C) => C.id));
991
+ pe(() => {
992
+ le.value = le.value.map(
993
+ (C) => V.has(C.id) ? { ...C, leaving: !1 } : C
957
994
  ), setTimeout(() => {
958
- ee.value = ee.value.filter((_) => !C.has(_.id));
959
- }, Ct);
995
+ le.value = le.value.filter((C) => !V.has(C.id));
996
+ }, Lt);
960
997
  });
961
998
  }
999
+ r.length && d("removed", { items: r, ids: f });
962
1000
  }
963
- async function Ve(e) {
964
- return mt(e);
965
- }
966
- function Qt() {
967
- $ += 1, fe = null, de = null, ue.value = !1, ce.value = !1;
1001
+ async function Oe(e) {
1002
+ return pt(e);
968
1003
  }
969
- k({
970
- remove: mt,
971
- restore: Gt,
972
- undo: Kt,
973
- forget: Jt,
974
- loadNextPage: gt,
975
- cancel: Qt,
1004
+ function tn() {
1005
+ D += 1, qe += 1, de = null, ve = null, ce.value = !1, fe.value = !1;
1006
+ }
1007
+ M({
1008
+ remove: pt,
1009
+ restore: Qt,
1010
+ undo: Zt,
1011
+ forget: en,
1012
+ loadNextPage: wt,
1013
+ cancel: tn,
976
1014
  get pagesLoaded() {
977
- return X.value;
1015
+ return G.value;
978
1016
  },
979
1017
  set pagesLoaded(e) {
980
- X.value = e;
1018
+ G.value = e;
981
1019
  },
982
1020
  get nextPage() {
983
- return z.value;
1021
+ return L.value;
984
1022
  },
985
1023
  set nextPage(e) {
986
- z.value = e;
1024
+ L.value = e;
987
1025
  },
988
1026
  get isLoading() {
989
- return ue.value || ce.value;
1027
+ return ce.value || fe.value;
990
1028
  },
991
1029
  get hasReachedEnd() {
992
- return r.mode !== "backfill" ? z.value == null : z.value == null && Ce.value.length === 0;
1030
+ return a.mode !== "backfill" ? L.value == null : L.value == null && ze.value.length === 0;
993
1031
  },
994
1032
  get backfillStats() {
995
- return Oe.value;
1033
+ return je.value;
996
1034
  }
997
1035
  });
998
- function ht() {
999
- const e = Tn({
1000
- items: h.value,
1001
- columnCount: We.value,
1002
- columnWidth: Fe.value,
1003
- gapX: Q.value,
1004
- gapY: _e.value,
1005
- headerHeight: j.value,
1006
- footerHeight: U.value,
1007
- bucketPx: Bt
1036
+ function yt() {
1037
+ const e = An({
1038
+ items: m.value,
1039
+ columnCount: Je.value,
1040
+ columnWidth: Te.value,
1041
+ gapX: ne.value,
1042
+ gapY: Ee.value,
1043
+ headerHeight: W.value,
1044
+ footerHeight: K.value,
1045
+ bucketPx: Ct
1008
1046
  });
1009
- ke.value = e.positions, Le.value = e.heights, tt.value = e.buckets, nt.value = e.contentHeight, Ee.value = e.indexById;
1010
- }
1011
- const Zt = M(() => Math.max(nt.value, B.value) + qn), je = M(() => En({
1012
- itemCount: h.value.length,
1013
- viewportHeight: B.value,
1014
- scrollTop: O.value,
1015
- overscanPx: r.overscanPx,
1016
- bucketPx: Bt,
1017
- buckets: tt.value
1047
+ Ie.value = e.positions, Ye.value = e.heights, lt.value = e.buckets, at.value = e.contentHeight, Ae.value = e.indexById;
1048
+ }
1049
+ const nn = k(() => Math.max(at.value, R.value) + jn), Ge = k(() => Cn({
1050
+ itemCount: m.value.length,
1051
+ viewportHeight: R.value,
1052
+ scrollTop: j.value,
1053
+ overscanPx: a.overscanPx,
1054
+ bucketPx: Ct,
1055
+ buckets: lt.value
1018
1056
  }));
1019
- ne(
1020
- je,
1057
+ Z(
1058
+ Ge,
1021
1059
  (e) => {
1022
1060
  if (!e?.length) return;
1023
- if (we.value && !Ye.value) {
1024
- const o = [];
1025
- for (const a of e) {
1026
- const v = h.value[a];
1027
- v && o.push(v);
1061
+ if (be.value && !Ue.value) {
1062
+ const l = [];
1063
+ for (const r of e) {
1064
+ const f = m.value[r];
1065
+ f && l.push(f);
1028
1066
  }
1029
- o.length && Ae(o), Ye.value = !0;
1067
+ l.length && He(l), Ue.value = !0;
1030
1068
  }
1031
1069
  const n = [];
1032
- for (const o of e) {
1033
- const a = h.value[o]?.id;
1034
- a && se.value.has(a) && (Be.has(a) || (Be.add(a), n.push(a)));
1070
+ for (const l of e) {
1071
+ const r = m.value[l]?.id;
1072
+ r && ie.value.has(r) && (Ce.has(r) || (Ce.add(r), n.push(r)));
1035
1073
  }
1036
1074
  if (!n.length) return;
1037
- const t = n.length > 1 ? $t(r.enterStaggerMs) : 0;
1075
+ const t = n.length > 1 ? Yt(a.enterStaggerMs) : 0;
1038
1076
  if (t > 0) {
1039
- const o = new Map(Se.value);
1040
- for (let a = 0; a < n.length; a += 1) {
1041
- const v = n[a], y = Math.min(a * t, On);
1042
- o.set(v, y);
1077
+ const l = new Map(Fe.value);
1078
+ for (let r = 0; r < n.length; r += 1) {
1079
+ const f = n[r], p = Math.min(r * t, Un);
1080
+ l.set(f, p);
1043
1081
  }
1044
- Se.value = o;
1082
+ Fe.value = l;
1045
1083
  }
1046
- ge(() => {
1047
- const o = new Set(ie.value);
1048
- for (const a of n) o.add(a);
1049
- ie.value = o;
1050
- }), Xt(() => {
1051
- const o = new Set(se.value);
1052
- for (const a of n) o.delete(a);
1053
- se.value = o, setTimeout(() => {
1054
- const a = new Set(ie.value), v = new Map(Se.value);
1055
- for (const y of n)
1056
- a.delete(y), Be.delete(y), v.delete(y);
1057
- ie.value = a, Se.value = v;
1058
- }, At);
1084
+ pe(() => {
1085
+ const l = new Set(ue.value);
1086
+ for (const r of n) l.add(r);
1087
+ ue.value = l;
1088
+ }), Wt(() => {
1089
+ const l = new Set(ie.value);
1090
+ for (const r of n) l.delete(r);
1091
+ ie.value = l, setTimeout(() => {
1092
+ const r = new Set(ue.value), f = new Map(Fe.value);
1093
+ for (const p of n)
1094
+ r.delete(p), Ce.delete(p), f.delete(p);
1095
+ ue.value = r, Fe.value = f;
1096
+ }, Ht);
1059
1097
  });
1060
1098
  },
1061
1099
  { flush: "post" }
1062
1100
  );
1063
- async function gt() {
1064
- if (fe) return fe;
1065
- if (ue.value || ce.value || r.mode !== "backfill" && z.value == null || r.mode === "backfill" && z.value == null && Ce.value.length === 0)
1101
+ async function wt() {
1102
+ if (de) return de;
1103
+ if (ce.value || fe.value || a.mode !== "backfill" && L.value == null || a.mode === "backfill" && L.value == null && ze.value.length === 0)
1066
1104
  return;
1067
- const e = $;
1105
+ const e = D;
1068
1106
  let n = null;
1069
1107
  return n = (async () => {
1070
1108
  try {
1071
- if (ce.value = !0, pe.value = "", r.mode === "backfill") {
1072
- const a = await dt.loadBackfillBatch(z.value);
1073
- if (e !== $) return;
1074
- a.pages.length && (X.value = [...X.value, ...a.pages]), ye(a.batchItems), h.value = [...h.value, ...a.batchItems], z.value = a.nextPage;
1109
+ if (fe.value = !0, ye.value = "", a.mode === "backfill") {
1110
+ const r = await ht.loadBackfillBatch(L.value);
1111
+ if (e !== D) return;
1112
+ r.pages.length && (G.value = [...G.value, ...r.pages]), we(r.batchItems), m.value = [...m.value, ...r.batchItems], L.value = r.nextPage;
1075
1113
  return;
1076
1114
  }
1077
- const t = z.value;
1115
+ const t = L.value;
1078
1116
  if (t == null) return;
1079
- const o = await vt(t);
1080
- if (e !== $) return;
1081
- X.value = [...X.value, t], ye(o.items), h.value = [...h.value, ...o.items], z.value = o.nextPage;
1117
+ const l = await gt(t);
1118
+ if (e !== D) return;
1119
+ G.value = [...G.value, t], we(l.items), m.value = [...m.value, ...l.items], L.value = l.nextPage;
1082
1120
  } catch (t) {
1083
- if (e !== $ || st(t)) return;
1084
- pe.value = t instanceof Error ? t.message : String(t);
1121
+ if (e !== D || ct(t)) return;
1122
+ ye.value = t instanceof Error ? t.message : String(t);
1085
1123
  } finally {
1086
- e === $ && (ce.value = !1), fe === n && (fe = null);
1124
+ e === D && (fe.value = !1), de === n && (de = null);
1087
1125
  }
1088
- })(), fe = n, n;
1126
+ })(), de = n, n;
1089
1127
  }
1090
- function en() {
1128
+ function on() {
1091
1129
  const e = c.value;
1092
1130
  if (!e) return;
1093
- const n = e.scrollTop, t = e.clientHeight, o = e.scrollHeight;
1094
- O.value = n, B.value = t;
1095
- const a = $e, v = De, y = v > 0 && o < v;
1096
- if ($e = n, De = o, y && n <= a) return;
1097
- o - (n + t) <= r.prefetchThresholdPx && gt();
1131
+ const n = e.scrollTop, t = e.clientHeight, l = e.scrollHeight;
1132
+ j.value = n, R.value = t;
1133
+ const r = Le, f = Ve, p = n > r, E = f > 0 && l < f;
1134
+ if (Le = n, Ve = l, _e) {
1135
+ if (!p) return;
1136
+ _e = !1;
1137
+ }
1138
+ if (E && !p) return;
1139
+ l - (n + t) <= a.prefetchThresholdPx && wt();
1098
1140
  }
1099
- function pt() {
1141
+ function bt() {
1100
1142
  return c.value;
1101
1143
  }
1102
- function yt(e) {
1103
- S.value = Pe(e), B.value = e.clientHeight;
1144
+ function xt(e) {
1145
+ F.value = Be(e), R.value = e.clientHeight;
1104
1146
  }
1105
- function tn() {
1147
+ function ln() {
1106
1148
  typeof ResizeObserver > "u" || (re = new ResizeObserver(() => {
1107
- const e = pt();
1108
- e && yt(e);
1149
+ const e = bt();
1150
+ e && xt(e);
1109
1151
  }));
1110
1152
  }
1111
- function nn() {
1153
+ function an() {
1112
1154
  return {
1113
- enabled: r.mode === "backfill",
1155
+ enabled: a.mode === "backfill",
1114
1156
  isBackfillActive: !1,
1115
1157
  isRequestInFlight: !1,
1116
- requestPage: null,
1158
+ page: a.page,
1159
+ next: a.page,
1117
1160
  progress: {
1118
1161
  collected: 0,
1119
1162
  target: 0
1120
1163
  },
1121
1164
  cooldownMsRemaining: 0,
1122
- cooldownMsTotal: Je(r.backfillRequestDelayMs),
1123
- pageSize: zt(r.pageSize),
1165
+ cooldownMsTotal: tt(a.backfillRequestDelayMs),
1166
+ pageSize: Dt(a.pageSize),
1124
1167
  bufferSize: 0,
1125
1168
  lastBatch: null,
1126
1169
  totals: {
@@ -1129,127 +1172,127 @@ const Bn = { class: "hidden" }, Rn = {
1129
1172
  }
1130
1173
  };
1131
1174
  }
1132
- function wt() {
1133
- $ += 1, fe = null, de = null, $e = 0, De = 0, Ne = 0, ve.clear(), me.length = 0, se.value = /* @__PURE__ */ new Set(), ie.value = /* @__PURE__ */ new Set(), Be.clear(), Re.value = /* @__PURE__ */ new Map(), Z.value = /* @__PURE__ */ new Set(), ee.value = [], X.value = [], z.value = null, Ce.value = [], Oe.value = nn(), ue.value = !0, ce.value = !1, pe.value = "", Ye.value = !1;
1175
+ function kt() {
1176
+ D += 1, qe += 1, de = null, ve = null, Le = 0, Ve = 0, _e = !1, $e = 0, me.clear(), he.length = 0, ie.value = /* @__PURE__ */ new Set(), ue.value = /* @__PURE__ */ new Set(), Ce.clear(), Ne.value = /* @__PURE__ */ new Map(), oe.value = /* @__PURE__ */ new Set(), le.value = [], G.value = [], L.value = null, ze.value = [], je.value = an(), ce.value = !0, fe.value = !1, ye.value = "", Ue.value = !1;
1134
1177
  }
1135
- function bt(e) {
1136
- wt(), h.value = [], z.value = e;
1178
+ function Mt(e) {
1179
+ kt(), m.value = [], L.value = e;
1137
1180
  }
1138
- function on(e) {
1139
- const n = Array.isArray(e) ? e : [e], t = [], o = /* @__PURE__ */ new Set();
1140
- for (const a of n) {
1141
- if (a == null) continue;
1142
- const v = typeof a == "string" ? `s:${a}` : `n:${String(a)}`;
1143
- o.has(v) || (o.add(v), t.push(a));
1181
+ function rn(e) {
1182
+ const n = Array.isArray(e) ? e : [e], t = [], l = /* @__PURE__ */ new Set();
1183
+ for (const r of n) {
1184
+ if (r == null) continue;
1185
+ const f = typeof r == "string" ? `s:${r}` : `n:${String(r)}`;
1186
+ l.has(f) || (l.add(f), t.push(r));
1144
1187
  }
1145
1188
  return t;
1146
1189
  }
1147
- function Ue(e) {
1148
- wt(), X.value = e ? on(e) : [], z.value = r.page, ue.value = !1, Ut(h.value), ye(h.value);
1190
+ function Ke(e) {
1191
+ kt(), G.value = e ? rn(e) : [], L.value = a.page, ce.value = !1, Kt(m.value), we(m.value);
1149
1192
  }
1150
- async function xt(e) {
1151
- if (de) return de;
1152
- const n = $;
1193
+ async function St(e) {
1194
+ if (ve) return ve;
1195
+ const n = D;
1153
1196
  let t = null;
1154
1197
  return t = (async () => {
1155
1198
  try {
1156
- if (r.mode === "backfill") {
1157
- const o = await dt.loadBackfillBatch(e);
1158
- if (n !== $) return;
1159
- X.value = o.pages.length ? o.pages : [e], ye(o.batchItems), h.value = o.batchItems, z.value = o.nextPage;
1199
+ if (a.mode === "backfill") {
1200
+ const l = await ht.loadBackfillBatch(e);
1201
+ if (n !== D) return;
1202
+ G.value = l.pages.length ? l.pages : [e], we(l.batchItems), m.value = l.batchItems, L.value = l.nextPage;
1160
1203
  } else {
1161
- const o = await vt(e);
1162
- if (n !== $) return;
1163
- X.value = [e], ye(o.items), h.value = o.items, z.value = o.nextPage;
1204
+ const l = await gt(e);
1205
+ if (n !== D) return;
1206
+ G.value = [e], we(l.items), m.value = l.items, L.value = l.nextPage;
1164
1207
  }
1165
- } catch (o) {
1166
- if (n !== $ || st(o)) return;
1167
- pe.value = o instanceof Error ? o.message : String(o);
1208
+ } catch (l) {
1209
+ if (n !== D || ct(l)) return;
1210
+ ye.value = l instanceof Error ? l.message : String(l);
1168
1211
  } finally {
1169
- n === $ && (ue.value = !1), de === t && (de = null);
1212
+ n === D && (ce.value = !1), ve === t && (ve = null);
1170
1213
  }
1171
- })(), de = t, t;
1214
+ })(), ve = t, t;
1172
1215
  }
1173
- function ln() {
1174
- const e = pt();
1175
- e && (yt(e), O.value = e.scrollTop, re?.observe(e));
1216
+ function sn() {
1217
+ const e = bt();
1218
+ e && (xt(e), j.value = e.scrollTop, Le = e.scrollTop, Ve = e.scrollHeight, re?.observe(e));
1176
1219
  }
1177
- Ge(async () => {
1178
- if (tn(), ln(), r.restoredPages != null) {
1179
- we.value = !0, Ue(r.restoredPages);
1220
+ Ze(async () => {
1221
+ if (ln(), sn(), a.restoredPages != null) {
1222
+ be.value = !0, Ke(a.restoredPages);
1180
1223
  return;
1181
1224
  }
1182
- if (He.value && h.value.length > 0) {
1183
- we.value = !0, Ue();
1225
+ if (De.value && m.value.length > 0) {
1226
+ be.value = !0, Ke();
1184
1227
  return;
1185
1228
  }
1186
- we.value = !1, bt(r.page), await xt(r.page);
1187
- }), Nt(() => {
1188
- re?.disconnect(), N && (clearTimeout(N), N = null), E && (clearTimeout(E), E = null), L(), H();
1189
- }), ne(
1190
- () => r.page,
1229
+ be.value = !1, Mt(a.page), await St(a.page);
1230
+ }), Vt(() => {
1231
+ re?.disconnect(), T && (clearTimeout(T), T = null), I && (clearTimeout(I), I = null), z(), A();
1232
+ }), Z(
1233
+ () => a.page,
1191
1234
  async (e) => {
1192
- if (we.value) {
1193
- z.value = e;
1235
+ if (be.value) {
1236
+ L.value = e;
1194
1237
  return;
1195
1238
  }
1196
- bt(e), await xt(e);
1239
+ Mt(e), await St(e);
1197
1240
  }
1198
- ), ne(
1199
- () => r.restoredPages,
1241
+ ), Z(
1242
+ () => a.restoredPages,
1200
1243
  (e) => {
1201
- e && (we.value = !0, Ue(e));
1244
+ e && (be.value = !0, Ke(e));
1202
1245
  }
1203
- ), ne(
1204
- Q,
1246
+ ), Z(
1247
+ ne,
1205
1248
  () => {
1206
1249
  const e = c.value;
1207
- e && (S.value = Pe(e));
1250
+ e && (F.value = Be(e));
1208
1251
  },
1209
1252
  { immediate: !1 }
1210
1253
  );
1211
- const We = M(() => In(S.value, r.itemWidth)), Fe = M(
1212
- () => Fn(S.value, We.value, r.itemWidth, Q.value)
1254
+ const Je = k(() => Pn(F.value, a.itemWidth)), Te = k(
1255
+ () => Tn(F.value, Je.value, a.itemWidth, ne.value)
1213
1256
  );
1214
- ne(
1215
- [We, Fe, Q, _e, j, U],
1257
+ Z(
1258
+ [Je, Te, ne, Ee, W, K],
1216
1259
  () => {
1217
- ht();
1260
+ yt();
1218
1261
  },
1219
1262
  { immediate: !0 }
1220
- ), ne(
1263
+ ), Z(
1221
1264
  // Performance note: this component targets very large arrays (e.g. 10k items).
1222
1265
  // Avoid deep watchers over items; rebuild layout only when the list structure
1223
1266
  // changes (new array reference or length change). This keeps metadata-only
1224
1267
  // updates (e.g. reactions) cheap.
1225
- () => [h.value, h.value.length],
1226
- () => ht(),
1268
+ () => [m.value, m.value.length],
1269
+ () => yt(),
1227
1270
  { immediate: !0 }
1228
1271
  );
1229
- const an = M(() => [
1272
+ const un = k(() => [
1230
1273
  "mt-8 flex min-h-0 flex-1 flex-col rounded-2xl border border-slate-200/70 bg-white/70 p-5 shadow-sm backdrop-blur",
1231
- w.class
1274
+ b.class
1232
1275
  ]);
1233
- return (e, n) => (I(), F("section", fn(ae.value, { class: an.value }), [
1234
- A("div", Bn, [
1235
- dn(e.$slots, "default")
1276
+ return (e, n) => (_(), P("section", mn(te.value, { class: un.value }), [
1277
+ N("div", Nn, [
1278
+ hn(e.$slots, "default")
1236
1279
  ]),
1237
- A("div", {
1280
+ N("div", {
1238
1281
  ref_key: "scrollViewportRef",
1239
1282
  ref: c,
1240
1283
  "data-testid": "items-scroll-container",
1241
1284
  class: "mt-4 min-h-0 flex-1 overflow-auto",
1242
- style: Y({ paddingRight: Q.value + "px" }),
1243
- onScroll: en
1285
+ style: U({ paddingRight: ne.value + "px" }),
1286
+ onScroll: on
1244
1287
  }, [
1245
- ue.value ? (I(), F("div", Rn, n[0] || (n[0] = [
1246
- A("div", { class: "inline-flex items-center gap-3 text-sm text-slate-600" }, [
1247
- A("svg", {
1288
+ ce.value ? (_(), P("div", Hn, n[0] || (n[0] = [
1289
+ N("div", { class: "inline-flex items-center gap-3 text-sm text-slate-600" }, [
1290
+ N("svg", {
1248
1291
  class: "h-5 w-5 animate-spin text-slate-500",
1249
1292
  viewBox: "0 0 24 24",
1250
1293
  "aria-hidden": "true"
1251
1294
  }, [
1252
- A("circle", {
1295
+ N("circle", {
1253
1296
  class: "opacity-25",
1254
1297
  cx: "12",
1255
1298
  cy: "12",
@@ -1258,135 +1301,135 @@ const Bn = { class: "hidden" }, Rn = {
1258
1301
  stroke: "currentColor",
1259
1302
  "stroke-width": "4"
1260
1303
  }),
1261
- A("path", {
1304
+ N("path", {
1262
1305
  class: "opacity-75",
1263
1306
  fill: "currentColor",
1264
1307
  d: "M4 12a8 8 0 0 1 8-8v4a4 4 0 0 0-4 4H4z"
1265
1308
  })
1266
1309
  ]),
1267
- A("span", null, "Loading…")
1310
+ N("span", null, "Loading…")
1268
1311
  ], -1)
1269
- ]))) : pe.value ? (I(), F("p", An, "Error: " + Ke(pe.value), 1)) : (I(), F("div", {
1312
+ ]))) : ye.value ? (_(), P("p", Ln, "Error: " + et(ye.value), 1)) : (_(), P("div", {
1270
1313
  key: 2,
1271
1314
  class: "relative",
1272
- style: Y({ height: Zt.value + "px" })
1315
+ style: U({ height: nn.value + "px" })
1273
1316
  }, [
1274
- (I(!0), F(Ft, null, _t(je.value, (t) => (I(), F("article", {
1275
- key: h.value[t].id,
1317
+ (_(!0), P(Tt, null, Et(Ge.value, (t) => (_(), P("article", {
1318
+ key: m.value[t].id,
1276
1319
  "data-testid": "item-card",
1277
1320
  class: "absolute overflow-hidden rounded-xl border border-slate-200/60 bg-white shadow-sm",
1278
- style: Y({
1279
- width: Fe.value + "px",
1280
- transition: Ot(h.value[t].id),
1281
- transitionDelay: Dt(h.value[t].id),
1282
- transform: Yt(t)
1321
+ style: U({
1322
+ width: Te.value + "px",
1323
+ transition: jt(m.value[t].id),
1324
+ transitionDelay: qt(m.value[t].id),
1325
+ transform: Ut(t)
1283
1326
  })
1284
1327
  }, [
1285
- Te.value || j.value > 0 ? (I(), F("div", {
1328
+ J.value || W.value > 0 ? (_(), P("div", {
1286
1329
  key: 0,
1287
1330
  "data-testid": "item-header-container",
1288
1331
  class: "w-full",
1289
- style: Y(Ze.value)
1332
+ style: U(nt.value)
1290
1333
  }, [
1291
- G(oe(b), {
1292
- "slot-fn": xe.value,
1293
- "slot-props": { item: h.value[t], remove: () => Ve(h.value[t]) }
1334
+ Q(ae(y), {
1335
+ "slot-fn": ke.value,
1336
+ "slot-props": { item: m.value[t], remove: () => Oe(m.value[t]) }
1294
1337
  }, null, 8, ["slot-fn", "slot-props"])
1295
- ], 4)) : K("", !0),
1296
- A("div", {
1338
+ ], 4)) : ee("", !0),
1339
+ N("div", {
1297
1340
  class: "group relative",
1298
- onMouseenter: (o) => g(h.value[t].id),
1299
- onMouseleave: (o) => p(h.value[t].id)
1341
+ onMouseenter: (l) => g(m.value[t].id),
1342
+ onMouseleave: (l) => w(m.value[t].id)
1300
1343
  }, [
1301
- G(Tt, {
1302
- item: h.value[t],
1303
- remove: () => Ve(h.value[t]),
1304
- "loader-slot-fn": he.value,
1305
- "error-slot-fn": W.value,
1306
- hovered: d.value === h.value[t].id,
1307
- onSuccess: D,
1308
- onError: le
1344
+ Q(Rt, {
1345
+ item: m.value[t],
1346
+ remove: () => Oe(m.value[t]),
1347
+ "loader-slot-fn": Me.value,
1348
+ "error-slot-fn": x.value,
1349
+ hovered: u.value === m.value[t].id,
1350
+ onSuccess: H,
1351
+ onError: q
1309
1352
  }, null, 8, ["item", "remove", "loader-slot-fn", "error-slot-fn", "hovered"]),
1310
- Qe.value ? (I(), F("div", Nn, [
1311
- G(oe(b), {
1312
- "slot-fn": x.value,
1313
- "slot-props": { item: h.value[t], remove: () => Ve(h.value[t]) }
1353
+ Se.value ? (_(), P("div", zn, [
1354
+ Q(ae(y), {
1355
+ "slot-fn": s.value,
1356
+ "slot-props": { item: m.value[t], remove: () => Oe(m.value[t]) }
1314
1357
  }, null, 8, ["slot-fn", "slot-props"])
1315
- ])) : K("", !0)
1316
- ], 40, Cn),
1317
- Me.value || U.value > 0 ? (I(), F("div", {
1358
+ ])) : ee("", !0)
1359
+ ], 40, Vn),
1360
+ Re.value || K.value > 0 ? (_(), P("div", {
1318
1361
  key: 1,
1319
1362
  "data-testid": "item-footer-container",
1320
1363
  class: "w-full",
1321
- style: Y(et.value)
1364
+ style: U(ot.value)
1322
1365
  }, [
1323
- G(oe(b), {
1324
- "slot-fn": s.value,
1325
- "slot-props": { item: h.value[t], remove: () => Ve(h.value[t]) }
1366
+ Q(ae(y), {
1367
+ "slot-fn": se.value,
1368
+ "slot-props": { item: m.value[t], remove: () => Oe(m.value[t]) }
1326
1369
  }, null, 8, ["slot-fn", "slot-props"])
1327
- ], 4)) : K("", !0)
1370
+ ], 4)) : ee("", !0)
1328
1371
  ], 4))), 128)),
1329
- (I(!0), F(Ft, null, _t(ee.value, (t) => (I(), F("article", {
1372
+ (_(!0), P(Tt, null, Et(le.value, (t) => (_(), P("article", {
1330
1373
  key: t.id + ":leaving",
1331
1374
  "data-testid": "item-card-leaving",
1332
1375
  class: "pointer-events-none absolute overflow-hidden rounded-xl border border-slate-200/60 bg-white shadow-sm",
1333
- style: Y({
1376
+ style: U({
1334
1377
  width: t.width + "px",
1335
- transition: "transform " + Ct + "ms ease-out",
1378
+ transition: "transform " + Lt + "ms ease-out",
1336
1379
  transform: t.leaving ? "translate3d(" + t.fromX + "px," + t.fromY + "px,0)" : "translate3d(" + t.fromX + "px," + t.toY + "px,0)"
1337
1380
  })
1338
1381
  }, [
1339
- Te.value || j.value > 0 ? (I(), F("div", {
1382
+ J.value || W.value > 0 ? (_(), P("div", {
1340
1383
  key: 0,
1341
1384
  "data-testid": "item-header-container",
1342
1385
  class: "w-full",
1343
- style: Y(Ze.value)
1386
+ style: U(nt.value)
1344
1387
  }, [
1345
- G(oe(b), {
1346
- "slot-fn": xe.value,
1388
+ Q(ae(y), {
1389
+ "slot-fn": ke.value,
1347
1390
  "slot-props": { item: t.item, remove: () => {
1348
1391
  } }
1349
1392
  }, null, 8, ["slot-fn", "slot-props"])
1350
- ], 4)) : K("", !0),
1351
- A("div", Hn, [
1352
- G(Tt, {
1393
+ ], 4)) : ee("", !0),
1394
+ N("div", $n, [
1395
+ Q(Rt, {
1353
1396
  item: t.item,
1354
1397
  remove: () => {
1355
1398
  },
1356
- "loader-slot-fn": he.value,
1357
- "error-slot-fn": W.value,
1399
+ "loader-slot-fn": Me.value,
1400
+ "error-slot-fn": x.value,
1358
1401
  hovered: !1
1359
1402
  }, null, 8, ["item", "loader-slot-fn", "error-slot-fn"]),
1360
- Qe.value ? (I(), F("div", Vn, [
1361
- G(oe(b), {
1362
- "slot-fn": x.value,
1403
+ Se.value ? (_(), P("div", Dn, [
1404
+ Q(ae(y), {
1405
+ "slot-fn": s.value,
1363
1406
  "slot-props": { item: t.item, remove: () => {
1364
1407
  } }
1365
1408
  }, null, 8, ["slot-fn", "slot-props"])
1366
- ])) : K("", !0)
1409
+ ])) : ee("", !0)
1367
1410
  ]),
1368
- Me.value || U.value > 0 ? (I(), F("div", {
1411
+ Re.value || K.value > 0 ? (_(), P("div", {
1369
1412
  key: 1,
1370
1413
  "data-testid": "item-footer-container",
1371
1414
  class: "w-full",
1372
- style: Y(et.value)
1415
+ style: U(ot.value)
1373
1416
  }, [
1374
- G(oe(b), {
1375
- "slot-fn": s.value,
1417
+ Q(ae(y), {
1418
+ "slot-fn": se.value,
1376
1419
  "slot-props": { item: t.item, remove: () => {
1377
1420
  } }
1378
1421
  }, null, 8, ["slot-fn", "slot-props"])
1379
- ], 4)) : K("", !0)
1422
+ ], 4)) : ee("", !0)
1380
1423
  ], 4))), 128))
1381
1424
  ], 4)),
1382
- A("div", zn, [
1383
- ce.value ? (I(), F("span", Ln, n[1] || (n[1] = [
1384
- A("svg", {
1425
+ N("div", On, [
1426
+ fe.value ? (_(), P("span", Yn, n[1] || (n[1] = [
1427
+ N("svg", {
1385
1428
  class: "h-4 w-4 animate-spin text-slate-500",
1386
1429
  viewBox: "0 0 24 24",
1387
1430
  "aria-hidden": "true"
1388
1431
  }, [
1389
- A("circle", {
1432
+ N("circle", {
1390
1433
  class: "opacity-25",
1391
1434
  cx: "12",
1392
1435
  cy: "12",
@@ -1395,50 +1438,50 @@ const Bn = { class: "hidden" }, Rn = {
1395
1438
  stroke: "currentColor",
1396
1439
  "stroke-width": "4"
1397
1440
  }),
1398
- A("path", {
1441
+ N("path", {
1399
1442
  class: "opacity-75",
1400
1443
  fill: "currentColor",
1401
1444
  d: "M4 12a8 8 0 0 1 8-8v4a4 4 0 0 0-4 4H4z"
1402
1445
  })
1403
1446
  ], -1),
1404
- A("span", null, "Loading more…", -1)
1405
- ]))) : z.value == null ? (I(), F("span", $n, "End of list")) : (I(), F("span", Dn, "Scroll to load page " + Ke(z.value), 1))
1447
+ N("span", null, "Loading more…", -1)
1448
+ ]))) : L.value == null ? (_(), P("span", qn, "End of list")) : (_(), P("span", Xn, "Scroll to load page " + et(L.value), 1))
1406
1449
  ])
1407
1450
  ], 36)
1408
1451
  ], 16));
1409
1452
  }
1410
- }), Un = be({
1453
+ }), Jn = xe({
1411
1454
  name: "MasonryItem",
1412
- setup(l, { slots: k, attrs: i }) {
1413
- const r = vn(Vt, null);
1414
- if (!r)
1455
+ setup(o, { slots: M, attrs: i }) {
1456
+ const a = gn($t, null);
1457
+ if (!a)
1415
1458
  return () => null;
1416
- const f = i.onPreloaded, w = i.onFailed, b = k.overlay, u = k.default;
1417
- return r({
1418
- header: k.header,
1419
- loader: k.loader,
1420
- overlay: b ?? u,
1421
- error: k.error,
1422
- footer: k.footer,
1423
- onPreloaded: typeof f == "function" ? f : Array.isArray(f) ? (d) => {
1424
- for (const g of f)
1425
- typeof g == "function" && g(d);
1459
+ const d = i.onPreloaded, b = i.onFailed, y = M.overlay, h = M.default;
1460
+ return a({
1461
+ header: M.header,
1462
+ loader: M.loader,
1463
+ overlay: y ?? h,
1464
+ error: M.error,
1465
+ footer: M.footer,
1466
+ onPreloaded: typeof d == "function" ? d : Array.isArray(d) ? (u) => {
1467
+ for (const g of d)
1468
+ typeof g == "function" && g(u);
1426
1469
  } : void 0,
1427
- onFailed: typeof w == "function" ? w : Array.isArray(w) ? (d) => {
1428
- for (const g of w)
1429
- typeof g == "function" && g(d);
1470
+ onFailed: typeof b == "function" ? b : Array.isArray(b) ? (u) => {
1471
+ for (const g of b)
1472
+ typeof g == "function" && g(u);
1430
1473
  } : void 0
1431
1474
  }), () => null;
1432
1475
  }
1433
- }), Gn = {
1434
- install(l) {
1435
- l.component("Masonry", jn), l.component("MasonryItem", Un), l.component("MasonryVideoControls", Ht);
1476
+ }), Zn = {
1477
+ install(o) {
1478
+ o.component("Masonry", Kn), o.component("MasonryItem", Jn), o.component("MasonryVideoControls", zt);
1436
1479
  }
1437
1480
  };
1438
1481
  export {
1439
- jn as Masonry,
1440
- Un as MasonryItem,
1441
- Ht as MasonryVideoControls,
1442
- Gn as VibePlugin,
1443
- mn as masonryDefaults
1482
+ Kn as Masonry,
1483
+ Jn as MasonryItem,
1484
+ zt as MasonryVideoControls,
1485
+ Zn as VibePlugin,
1486
+ pn as masonryDefaults
1444
1487
  };