@wyxos/vibe 1.6.24 → 1.6.26

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,22 +1,22 @@
1
- import { nextTick as q, ref as D, computed as Q, defineComponent as Ke, onMounted as Qe, onUnmounted as Ze, watch as ee, createElementBlock as R, openBlock as O, createCommentVNode as te, createElementVNode as V, normalizeStyle as ge, renderSlot as _, normalizeClass as re, withModifiers as je, toDisplayString as $e, unref as U, Fragment as Ve, renderList as qe, createVNode as Pe, withCtx as fe, mergeProps as de, TransitionGroup as xt } from "vue";
2
- let Se = null;
3
- function bt() {
4
- if (Se != null) return Se;
1
+ import { nextTick as _, ref as D, computed as Z, defineComponent as et, onMounted as tt, onUnmounted as at, watch as te, createElementBlock as q, openBlock as Y, createCommentVNode as ae, createElementVNode as U, normalizeStyle as ge, renderSlot as J, normalizeClass as ie, withModifiers as Ye, toDisplayString as Ne, unref as X, Fragment as Ue, renderList as _e, createVNode as He, withCtx as fe, mergeProps as de, TransitionGroup as Tt } from "vue";
2
+ let $e = null;
3
+ function It() {
4
+ if ($e != null) return $e;
5
5
  const e = document.createElement("div");
6
6
  e.style.visibility = "hidden", e.style.overflow = "scroll", e.style.msOverflowStyle = "scrollbar", e.style.width = "100px", e.style.height = "100px", document.body.appendChild(e);
7
7
  const l = document.createElement("div");
8
8
  l.style.width = "100%", e.appendChild(l);
9
- const r = e.offsetWidth - l.offsetWidth;
10
- return document.body.removeChild(e), Se = r, r;
9
+ const o = e.offsetWidth - l.offsetWidth;
10
+ return document.body.removeChild(e), $e = o, o;
11
11
  }
12
- function Ye(e, l, r, t = {}) {
12
+ function Xe(e, l, o, a = {}) {
13
13
  const {
14
- gutterX: y = 0,
14
+ gutterX: m = 0,
15
15
  gutterY: h = 0,
16
- header: m = 0,
16
+ header: c = 0,
17
17
  footer: i = 0,
18
- paddingLeft: w = 0,
19
- paddingRight: b = 0,
18
+ paddingLeft: x = 0,
19
+ paddingRight: M = 0,
20
20
  sizes: n = {
21
21
  base: 1,
22
22
  sm: 2,
@@ -25,195 +25,195 @@ function Ye(e, l, r, t = {}) {
25
25
  xl: 5,
26
26
  "2xl": 6
27
27
  },
28
- placement: p = "masonry"
29
- } = t;
30
- let x = 0, M = 0;
28
+ placement: b = "masonry"
29
+ } = a;
30
+ let P = 0, T = 0;
31
31
  try {
32
32
  if (l && l.nodeType === 1 && typeof window < "u" && window.getComputedStyle) {
33
- const L = window.getComputedStyle(l);
34
- x = parseFloat(L.paddingLeft) || 0, M = parseFloat(L.paddingRight) || 0;
33
+ const E = window.getComputedStyle(l);
34
+ P = parseFloat(E.paddingLeft) || 0, T = parseFloat(E.paddingRight) || 0;
35
35
  }
36
36
  } catch {
37
37
  }
38
- const s = (w || 0) + x, g = (b || 0) + M, a = l.offsetWidth - l.clientWidth, d = a > 0 ? a + 2 : bt() + 2, v = l.offsetWidth - d - s - g, T = y * (r - 1), P = Math.floor((v - T) / r), I = e.map((L) => {
39
- const k = L.width, W = L.height;
40
- return Math.round(P * W / k) + i + m;
38
+ const f = (x || 0) + P, y = (M || 0) + T, r = l.offsetWidth - l.clientWidth, g = r > 0 ? r + 2 : It() + 2, s = l.offsetWidth - g - f - y, d = m * (o - 1), L = Math.floor((s - d) / o), p = e.map((E) => {
39
+ const O = E.width, j = E.height;
40
+ return Math.round(L * j / O) + i + c;
41
41
  });
42
- if (p === "sequential-balanced") {
43
- const L = I.length;
44
- if (L === 0) return [];
45
- const k = (z, Y, G) => z + (Y > 0 ? h : 0) + G;
46
- let W = Math.max(...I), o = I.reduce((z, Y) => z + Y, 0) + h * Math.max(0, L - 1);
47
- const u = (z) => {
48
- let Y = 1, G = 0, ne = 0;
49
- for (let J = 0; J < L; J++) {
50
- const ie = I[J], Z = k(G, ne, ie);
51
- if (Z <= z)
52
- G = Z, ne++;
53
- else if (Y++, G = ie, ne = 1, ie > z || Y > r) return !1;
42
+ if (b === "sequential-balanced") {
43
+ const E = p.length;
44
+ if (E === 0) return [];
45
+ const O = (I, N, A) => I + (N > 0 ? h : 0) + A;
46
+ let j = Math.max(...p), k = p.reduce((I, N) => I + N, 0) + h * Math.max(0, E - 1);
47
+ const z = (I) => {
48
+ let N = 1, A = 0, ne = 0;
49
+ for (let K = 0; K < E; K++) {
50
+ const re = p[K], ee = O(A, ne, re);
51
+ if (ee <= I)
52
+ A = ee, ne++;
53
+ else if (N++, A = re, ne = 1, re > I || N > o) return !1;
54
54
  }
55
- return Y <= r;
55
+ return N <= o;
56
56
  };
57
- for (; W < o; ) {
58
- const z = Math.floor((W + o) / 2);
59
- u(z) ? o = z : W = z + 1;
57
+ for (; j < k; ) {
58
+ const I = Math.floor((j + k) / 2);
59
+ z(I) ? k = I : j = I + 1;
60
60
  }
61
- const E = o, $ = new Array(r).fill(0);
62
- let C = r - 1, F = 0, N = 0;
63
- for (let z = L - 1; z >= 0; z--) {
64
- const Y = I[z], G = z < C;
65
- !(k(F, N, Y) <= E) || G ? ($[C] = z + 1, C--, F = Y, N = 1) : (F = k(F, N, Y), N++);
61
+ const F = k, t = new Array(o).fill(0);
62
+ let w = o - 1, S = 0, H = 0;
63
+ for (let I = E - 1; I >= 0; I--) {
64
+ const N = p[I], A = I < w;
65
+ !(O(S, H, N) <= F) || A ? (t[w] = I + 1, w--, S = N, H = 1) : (S = O(S, H, N), H++);
66
66
  }
67
- $[0] = 0;
68
- const j = [], X = new Array(r).fill(0);
69
- for (let z = 0; z < r; z++) {
70
- const Y = $[z], G = z + 1 < r ? $[z + 1] : L, ne = z * (P + y);
71
- for (let J = Y; J < G; J++) {
72
- const Z = {
73
- ...e[J],
74
- columnWidth: P,
67
+ t[0] = 0;
68
+ const V = [], C = new Array(o).fill(0);
69
+ for (let I = 0; I < o; I++) {
70
+ const N = t[I], A = I + 1 < o ? t[I + 1] : E, ne = I * (L + m);
71
+ for (let K = N; K < A; K++) {
72
+ const ee = {
73
+ ...e[K],
74
+ columnWidth: L,
75
75
  imageHeight: 0,
76
76
  columnHeight: 0,
77
77
  left: 0,
78
78
  top: 0
79
79
  };
80
- Z.imageHeight = I[J] - (i + m), Z.columnHeight = I[J], Z.left = ne, Z.top = X[z], X[z] += Z.columnHeight + (J + 1 < G ? h : 0), j.push(Z);
80
+ ee.imageHeight = p[K] - (i + c), ee.columnHeight = p[K], ee.left = ne, ee.top = C[I], C[I] += ee.columnHeight + (K + 1 < A ? h : 0), V.push(ee);
81
81
  }
82
82
  }
83
- return j;
83
+ return V;
84
84
  }
85
- const f = new Array(r).fill(0), H = [];
86
- for (let L = 0; L < e.length; L++) {
87
- const k = e[L], W = {
88
- ...k,
85
+ const v = new Array(o).fill(0), $ = [];
86
+ for (let E = 0; E < e.length; E++) {
87
+ const O = e[E], j = {
88
+ ...O,
89
89
  columnWidth: 0,
90
90
  imageHeight: 0,
91
91
  columnHeight: 0,
92
92
  left: 0,
93
93
  top: 0
94
- }, o = f.indexOf(Math.min(...f)), u = k.width, E = k.height;
95
- W.columnWidth = P, W.left = o * (P + y), W.imageHeight = Math.round(P * E / u), W.columnHeight = W.imageHeight + i + m, W.top = f[o], f[o] += W.columnHeight + h, H.push(W);
94
+ }, k = v.indexOf(Math.min(...v)), z = O.width, F = O.height;
95
+ j.columnWidth = L, j.left = k * (L + m), j.imageHeight = Math.round(L * F / z), j.columnHeight = j.imageHeight + i + c, j.top = v[k], v[k] += j.columnHeight + h, $.push(j);
96
96
  }
97
- return H;
97
+ return $;
98
98
  }
99
- var Mt = typeof global == "object" && global && global.Object === Object && global, Tt = typeof self == "object" && self && self.Object === Object && self, et = Mt || Tt || Function("return this")(), xe = et.Symbol, tt = Object.prototype, It = tt.hasOwnProperty, Et = tt.toString, me = xe ? xe.toStringTag : void 0;
100
- function kt(e) {
101
- var l = It.call(e, me), r = e[me];
99
+ var Pt = typeof global == "object" && global && global.Object === Object && global, Lt = typeof self == "object" && self && self.Object === Object && self, nt = Pt || Lt || Function("return this")(), xe = nt.Symbol, lt = Object.prototype, Et = lt.hasOwnProperty, kt = lt.toString, he = xe ? xe.toStringTag : void 0;
100
+ function St(e) {
101
+ var l = Et.call(e, he), o = e[he];
102
102
  try {
103
- e[me] = void 0;
104
- var t = !0;
103
+ e[he] = void 0;
104
+ var a = !0;
105
105
  } catch {
106
106
  }
107
- var y = Et.call(e);
108
- return t && (l ? e[me] = r : delete e[me]), y;
109
- }
110
- var Lt = Object.prototype, Pt = Lt.toString;
111
- function St(e) {
112
- return Pt.call(e);
107
+ var m = kt.call(e);
108
+ return a && (l ? e[he] = o : delete e[he]), m;
113
109
  }
114
- var Ht = "[object Null]", $t = "[object Undefined]", Ue = xe ? xe.toStringTag : void 0;
115
- function Nt(e) {
116
- return e == null ? e === void 0 ? $t : Ht : Ue && Ue in Object(e) ? kt(e) : St(e);
110
+ var Ht = Object.prototype, $t = Ht.toString;
111
+ function Ft(e) {
112
+ return $t.call(e);
117
113
  }
114
+ var Nt = "[object Null]", Bt = "[object Undefined]", Ge = xe ? xe.toStringTag : void 0;
118
115
  function Dt(e) {
116
+ return e == null ? e === void 0 ? Bt : Nt : Ge && Ge in Object(e) ? St(e) : Ft(e);
117
+ }
118
+ function zt(e) {
119
119
  return e != null && typeof e == "object";
120
120
  }
121
- var zt = "[object Symbol]";
122
- function Bt(e) {
123
- return typeof e == "symbol" || Dt(e) && Nt(e) == zt;
121
+ var At = "[object Symbol]";
122
+ function Rt(e) {
123
+ return typeof e == "symbol" || zt(e) && Dt(e) == At;
124
124
  }
125
- var Ft = /\s/;
126
- function At(e) {
127
- for (var l = e.length; l-- && Ft.test(e.charAt(l)); )
125
+ var Wt = /\s/;
126
+ function Ot(e) {
127
+ for (var l = e.length; l-- && Wt.test(e.charAt(l)); )
128
128
  ;
129
129
  return l;
130
130
  }
131
- var Wt = /^\s+/;
132
- function Rt(e) {
133
- return e && e.slice(0, At(e) + 1).replace(Wt, "");
131
+ var Ct = /^\s+/;
132
+ function Vt(e) {
133
+ return e && e.slice(0, Ot(e) + 1).replace(Ct, "");
134
134
  }
135
- function Ne(e) {
135
+ function Be(e) {
136
136
  var l = typeof e;
137
137
  return e != null && (l == "object" || l == "function");
138
138
  }
139
- var _e = NaN, Ot = /^[-+]0x[0-9a-f]+$/i, Ct = /^0b[01]+$/i, jt = /^0o[0-7]+$/i, Vt = parseInt;
140
- function Xe(e) {
139
+ var Je = NaN, jt = /^[-+]0x[0-9a-f]+$/i, qt = /^0b[01]+$/i, Yt = /^0o[0-7]+$/i, Ut = parseInt;
140
+ function Ke(e) {
141
141
  if (typeof e == "number")
142
142
  return e;
143
- if (Bt(e))
144
- return _e;
145
- if (Ne(e)) {
143
+ if (Rt(e))
144
+ return Je;
145
+ if (Be(e)) {
146
146
  var l = typeof e.valueOf == "function" ? e.valueOf() : e;
147
- e = Ne(l) ? l + "" : l;
147
+ e = Be(l) ? l + "" : l;
148
148
  }
149
149
  if (typeof e != "string")
150
150
  return e === 0 ? e : +e;
151
- e = Rt(e);
152
- var r = Ct.test(e);
153
- return r || jt.test(e) ? Vt(e.slice(2), r ? 2 : 8) : Ot.test(e) ? _e : +e;
151
+ e = Vt(e);
152
+ var o = qt.test(e);
153
+ return o || Yt.test(e) ? Ut(e.slice(2), o ? 2 : 8) : jt.test(e) ? Je : +e;
154
154
  }
155
- var He = function() {
156
- return et.Date.now();
157
- }, qt = "Expected a function", Yt = Math.max, Ut = Math.min;
158
- function Ge(e, l, r) {
159
- var t, y, h, m, i, w, b = 0, n = !1, p = !1, x = !0;
155
+ var Fe = function() {
156
+ return nt.Date.now();
157
+ }, _t = "Expected a function", Xt = Math.max, Gt = Math.min;
158
+ function Qe(e, l, o) {
159
+ var a, m, h, c, i, x, M = 0, n = !1, b = !1, P = !0;
160
160
  if (typeof e != "function")
161
- throw new TypeError(qt);
162
- l = Xe(l) || 0, Ne(r) && (n = !!r.leading, p = "maxWait" in r, h = p ? Yt(Xe(r.maxWait) || 0, l) : h, x = "trailing" in r ? !!r.trailing : x);
163
- function M(f) {
164
- var H = t, L = y;
165
- return t = y = void 0, b = f, m = e.apply(L, H), m;
161
+ throw new TypeError(_t);
162
+ l = Ke(l) || 0, Be(o) && (n = !!o.leading, b = "maxWait" in o, h = b ? Xt(Ke(o.maxWait) || 0, l) : h, P = "trailing" in o ? !!o.trailing : P);
163
+ function T(v) {
164
+ var $ = a, E = m;
165
+ return a = m = void 0, M = v, c = e.apply(E, $), c;
166
166
  }
167
- function s(f) {
168
- return b = f, i = setTimeout(d, l), n ? M(f) : m;
167
+ function f(v) {
168
+ return M = v, i = setTimeout(g, l), n ? T(v) : c;
169
169
  }
170
- function g(f) {
171
- var H = f - w, L = f - b, k = l - H;
172
- return p ? Ut(k, h - L) : k;
170
+ function y(v) {
171
+ var $ = v - x, E = v - M, O = l - $;
172
+ return b ? Gt(O, h - E) : O;
173
173
  }
174
- function a(f) {
175
- var H = f - w, L = f - b;
176
- return w === void 0 || H >= l || H < 0 || p && L >= h;
174
+ function r(v) {
175
+ var $ = v - x, E = v - M;
176
+ return x === void 0 || $ >= l || $ < 0 || b && E >= h;
177
177
  }
178
- function d() {
179
- var f = He();
180
- if (a(f))
181
- return v(f);
182
- i = setTimeout(d, g(f));
178
+ function g() {
179
+ var v = Fe();
180
+ if (r(v))
181
+ return s(v);
182
+ i = setTimeout(g, y(v));
183
183
  }
184
- function v(f) {
185
- return i = void 0, x && t ? M(f) : (t = y = void 0, m);
184
+ function s(v) {
185
+ return i = void 0, P && a ? T(v) : (a = m = void 0, c);
186
186
  }
187
- function T() {
188
- i !== void 0 && clearTimeout(i), b = 0, t = w = y = i = void 0;
187
+ function d() {
188
+ i !== void 0 && clearTimeout(i), M = 0, a = x = m = i = void 0;
189
189
  }
190
- function P() {
191
- return i === void 0 ? m : v(He());
190
+ function L() {
191
+ return i === void 0 ? c : s(Fe());
192
192
  }
193
- function I() {
194
- var f = He(), H = a(f);
195
- if (t = arguments, y = this, w = f, H) {
193
+ function p() {
194
+ var v = Fe(), $ = r(v);
195
+ if (a = arguments, m = this, x = v, $) {
196
196
  if (i === void 0)
197
- return s(w);
198
- if (p)
199
- return clearTimeout(i), i = setTimeout(d, l), M(w);
197
+ return f(x);
198
+ if (b)
199
+ return clearTimeout(i), i = setTimeout(g, l), T(x);
200
200
  }
201
- return i === void 0 && (i = setTimeout(d, l)), m;
201
+ return i === void 0 && (i = setTimeout(g, l)), c;
202
202
  }
203
- return I.cancel = T, I.flush = P, I;
203
+ return p.cancel = d, p.flush = L, p;
204
204
  }
205
205
  function ue(e, l) {
206
- const r = l ?? (typeof window < "u" ? window.innerWidth : 1024), t = e.sizes;
207
- return r >= 1536 && t["2xl"] ? t["2xl"] : r >= 1280 && t.xl ? t.xl : r >= 1024 && t.lg ? t.lg : r >= 768 && t.md ? t.md : r >= 640 && t.sm ? t.sm : t.base;
206
+ const o = l ?? (typeof window < "u" ? window.innerWidth : 1024), a = e.sizes;
207
+ return o >= 1536 && a["2xl"] ? a["2xl"] : o >= 1280 && a.xl ? a.xl : o >= 1024 && a.lg ? a.lg : o >= 768 && a.md ? a.md : o >= 640 && a.sm ? a.sm : a.base;
208
208
  }
209
- function _t(e) {
209
+ function Jt(e) {
210
210
  const l = e ?? (typeof window < "u" ? window.innerWidth : 1024);
211
211
  return l >= 1536 ? "2xl" : l >= 1280 ? "xl" : l >= 1024 ? "lg" : l >= 768 ? "md" : l >= 640 ? "sm" : "base";
212
212
  }
213
- function Xt(e) {
214
- return e.reduce((r, t) => Math.max(r, t.top + t.columnHeight), 0) + 500;
213
+ function Kt(e) {
214
+ return e.reduce((o, a) => Math.max(o, a.top + a.columnHeight), 0) + 500;
215
215
  }
216
- function Gt(e) {
216
+ function Qt(e) {
217
217
  return {
218
218
  transform: `translate3d(${e.left}px, ${e.top}px, 0)`,
219
219
  top: "0px",
@@ -222,646 +222,678 @@ function Gt(e) {
222
222
  height: `${e.columnHeight}px`
223
223
  };
224
224
  }
225
- function Jt(e, l = 0) {
225
+ function Zt(e, l = 0) {
226
226
  return {
227
- style: Gt(e),
227
+ style: Qt(e),
228
228
  "data-top": e.top,
229
229
  "data-left": e.left,
230
230
  "data-id": `${e.page}-${e.id}`,
231
231
  "data-index": l
232
232
  };
233
233
  }
234
- function De(e, l) {
234
+ function be(e, l) {
235
235
  if (!e.length || l <= 0)
236
236
  return new Array(Math.max(1, l)).fill(0);
237
- const t = Array.from(new Set(e.map((m) => m.left))).sort((m, i) => m - i).slice(0, l), y = /* @__PURE__ */ new Map();
238
- for (let m = 0; m < t.length; m++) y.set(t[m], m);
239
- const h = new Array(t.length).fill(0);
240
- for (const m of e) {
241
- const i = y.get(m.left);
242
- i != null && (h[i] = Math.max(h[i], m.top + m.columnHeight));
237
+ const a = Array.from(new Set(e.map((c) => c.left))).sort((c, i) => c - i).slice(0, l), m = /* @__PURE__ */ new Map();
238
+ for (let c = 0; c < a.length; c++) m.set(a[c], c);
239
+ const h = new Array(a.length).fill(0);
240
+ for (const c of e) {
241
+ const i = m.get(c.left);
242
+ i != null && (h[i] = Math.max(h[i], c.top + c.columnHeight));
243
243
  }
244
244
  for (; h.length < l; ) h.push(0);
245
245
  return h;
246
246
  }
247
- function Kt(e, l) {
248
- let r = 0, t = 0;
249
- const y = 1e3;
250
- function h(n, p) {
251
- var s;
252
- const x = (s = e.container) == null ? void 0 : s.value;
253
- if (x) {
254
- const g = x.scrollTop, a = x.clientHeight;
255
- r = g - y, t = g + a + y;
247
+ function ea(e, l) {
248
+ let o = 0, a = 0;
249
+ const m = 1e3;
250
+ function h(n, b) {
251
+ var f;
252
+ const P = (f = e.container) == null ? void 0 : f.value;
253
+ if (P) {
254
+ const y = P.scrollTop, r = P.clientHeight;
255
+ o = y - m, a = y + r + m;
256
256
  }
257
- return n + p >= r && n <= t;
257
+ return n + b >= o && n <= a;
258
258
  }
259
- function m(n, p) {
260
- var v;
261
- const x = parseInt(n.dataset.left || "0", 10), M = parseInt(n.dataset.top || "0", 10), s = parseInt(n.dataset.index || "0", 10), g = n.offsetHeight || parseInt(getComputedStyle(n).height || "200", 10) || 200;
262
- if ((v = l == null ? void 0 : l.virtualizing) != null && v.value) {
263
- n.style.transition = "none", n.style.opacity = "1", n.style.transform = `translate3d(${x}px, ${M}px, 0) scale(1)`, n.style.removeProperty("--masonry-opacity-delay"), requestAnimationFrame(() => {
264
- n.style.transition = "", p();
259
+ function c(n, b) {
260
+ var s;
261
+ const P = parseInt(n.dataset.left || "0", 10), T = parseInt(n.dataset.top || "0", 10), f = parseInt(n.dataset.index || "0", 10), y = n.offsetHeight || parseInt(getComputedStyle(n).height || "200", 10) || 200;
262
+ if ((s = l == null ? void 0 : l.virtualizing) != null && s.value) {
263
+ n.style.transition = "none", n.style.opacity = "1", n.style.transform = `translate3d(${P}px, ${T}px, 0) scale(1)`, n.style.removeProperty("--masonry-opacity-delay"), requestAnimationFrame(() => {
264
+ n.style.transition = "", b();
265
265
  });
266
266
  return;
267
267
  }
268
- if (!h(M, g)) {
269
- n.style.opacity = "1", n.style.transform = `translate3d(${x}px, ${M}px, 0) scale(1)`, n.style.transition = "none", p();
268
+ if (!h(T, y)) {
269
+ n.style.opacity = "1", n.style.transform = `translate3d(${P}px, ${T}px, 0) scale(1)`, n.style.transition = "none", b();
270
270
  return;
271
271
  }
272
- const a = Math.min(s * 20, 160), d = n.style.getPropertyValue("--masonry-opacity-delay");
273
- n.style.setProperty("--masonry-opacity-delay", `${a}ms`), requestAnimationFrame(() => {
274
- n.style.opacity = "1", n.style.transform = `translate3d(${x}px, ${M}px, 0) scale(1)`;
275
- const T = () => {
276
- d ? n.style.setProperty("--masonry-opacity-delay", d) : n.style.removeProperty("--masonry-opacity-delay"), n.removeEventListener("transitionend", T), p();
272
+ const r = Math.min(f * 20, 160), g = n.style.getPropertyValue("--masonry-opacity-delay");
273
+ n.style.setProperty("--masonry-opacity-delay", `${r}ms`), requestAnimationFrame(() => {
274
+ n.style.opacity = "1", n.style.transform = `translate3d(${P}px, ${T}px, 0) scale(1)`;
275
+ const d = () => {
276
+ g ? n.style.setProperty("--masonry-opacity-delay", g) : n.style.removeProperty("--masonry-opacity-delay"), n.removeEventListener("transitionend", d), b();
277
277
  };
278
- n.addEventListener("transitionend", T);
278
+ n.addEventListener("transitionend", d);
279
279
  });
280
280
  }
281
281
  function i(n) {
282
- var M;
283
- const p = parseInt(n.dataset.left || "0", 10), x = parseInt(n.dataset.top || "0", 10);
284
- if ((M = l == null ? void 0 : l.virtualizing) != null && M.value) {
285
- n.style.transition = "none", n.style.opacity = "1", n.style.transform = `translate3d(${p}px, ${x}px, 0) scale(1)`, n.style.removeProperty("--masonry-opacity-delay");
282
+ var T;
283
+ const b = parseInt(n.dataset.left || "0", 10), P = parseInt(n.dataset.top || "0", 10);
284
+ if ((T = l == null ? void 0 : l.virtualizing) != null && T.value) {
285
+ n.style.transition = "none", n.style.opacity = "1", n.style.transform = `translate3d(${b}px, ${P}px, 0) scale(1)`, n.style.removeProperty("--masonry-opacity-delay");
286
286
  return;
287
287
  }
288
- n.style.opacity = "0", n.style.transform = `translate3d(${p}px, ${x + 10}px, 0) scale(0.985)`;
288
+ n.style.opacity = "0", n.style.transform = `translate3d(${b}px, ${P + 10}px, 0) scale(0.985)`;
289
289
  }
290
- function w(n) {
291
- var s;
292
- const p = parseInt(n.dataset.left || "0", 10), x = parseInt(n.dataset.top || "0", 10), M = n.offsetHeight || parseInt(getComputedStyle(n).height || "200", 10) || 200;
293
- if (!((s = l == null ? void 0 : l.virtualizing) != null && s.value)) {
294
- if (!h(x, M)) {
290
+ function x(n) {
291
+ var f;
292
+ const b = parseInt(n.dataset.left || "0", 10), P = parseInt(n.dataset.top || "0", 10), T = n.offsetHeight || parseInt(getComputedStyle(n).height || "200", 10) || 200;
293
+ if (!((f = l == null ? void 0 : l.virtualizing) != null && f.value)) {
294
+ if (!h(P, T)) {
295
295
  n.style.transition = "none";
296
296
  return;
297
297
  }
298
- n.style.transition = "none", n.style.opacity = "1", n.style.transform = `translate3d(${p}px, ${x}px, 0) scale(1)`, n.style.removeProperty("--masonry-opacity-delay"), requestAnimationFrame(() => {
298
+ n.style.transition = "none", n.style.opacity = "1", n.style.transform = `translate3d(${b}px, ${P}px, 0) scale(1)`, n.style.removeProperty("--masonry-opacity-delay"), requestAnimationFrame(() => {
299
299
  n.style.transition = "";
300
300
  });
301
301
  }
302
302
  }
303
- function b(n, p) {
304
- var I;
305
- const x = parseInt(n.dataset.left || "0", 10), M = parseInt(n.dataset.top || "0", 10), s = n.offsetHeight || parseInt(getComputedStyle(n).height || "200", 10) || 200;
306
- if ((I = l == null ? void 0 : l.virtualizing) != null && I.value) {
307
- p();
303
+ function M(n, b) {
304
+ var p;
305
+ const P = parseInt(n.dataset.left || "0", 10), T = parseInt(n.dataset.top || "0", 10), f = n.offsetHeight || parseInt(getComputedStyle(n).height || "200", 10) || 200;
306
+ if ((p = l == null ? void 0 : l.virtualizing) != null && p.value) {
307
+ b();
308
308
  return;
309
309
  }
310
- if (!h(M, s)) {
311
- n.style.transition = "none", n.style.opacity = "0", p();
310
+ if (!h(T, f)) {
311
+ n.style.transition = "none", n.style.opacity = "0", b();
312
312
  return;
313
313
  }
314
- const g = typeof (l == null ? void 0 : l.leaveDurationMs) == "number" ? l.leaveDurationMs : NaN;
315
- let a = Number.isFinite(g) && g > 0 ? g : NaN;
316
- if (!Number.isFinite(a)) {
317
- const H = getComputedStyle(n).getPropertyValue("--masonry-leave-duration") || "", L = parseFloat(H);
318
- a = Number.isFinite(L) && L > 0 ? L : 200;
314
+ const y = typeof (l == null ? void 0 : l.leaveDurationMs) == "number" ? l.leaveDurationMs : NaN;
315
+ let r = Number.isFinite(y) && y > 0 ? y : NaN;
316
+ if (!Number.isFinite(r)) {
317
+ const $ = getComputedStyle(n).getPropertyValue("--masonry-leave-duration") || "", E = parseFloat($);
318
+ r = Number.isFinite(E) && E > 0 ? E : 200;
319
319
  }
320
- const d = n.style.transitionDuration, v = () => {
321
- n.removeEventListener("transitionend", T), clearTimeout(P), n.style.transitionDuration = d || "";
322
- }, T = (f) => {
323
- (!f || f.target === n) && (v(), p());
324
- }, P = setTimeout(() => {
325
- v(), p();
326
- }, a + 100);
320
+ const g = n.style.transitionDuration, s = () => {
321
+ n.removeEventListener("transitionend", d), clearTimeout(L), n.style.transitionDuration = g || "";
322
+ }, d = (v) => {
323
+ (!v || v.target === n) && (s(), b());
324
+ }, L = setTimeout(() => {
325
+ s(), b();
326
+ }, r + 100);
327
327
  requestAnimationFrame(() => {
328
- n.style.transitionDuration = `${a}ms`, n.style.opacity = "0", n.style.transform = `translate3d(${x}px, ${M + 10}px, 0) scale(0.985)`, n.addEventListener("transitionend", T);
328
+ n.style.transitionDuration = `${r}ms`, n.style.opacity = "0", n.style.transform = `translate3d(${P}px, ${T + 10}px, 0) scale(0.985)`, n.addEventListener("transitionend", d);
329
329
  });
330
330
  }
331
331
  return {
332
- onEnter: m,
332
+ onEnter: c,
333
333
  onBeforeEnter: i,
334
- onBeforeLeave: w,
335
- onLeave: b
334
+ onBeforeLeave: x,
335
+ onLeave: M
336
336
  };
337
337
  }
338
- function Qt({
338
+ function ta({
339
339
  container: e,
340
340
  masonry: l,
341
- columns: r,
342
- containerHeight: t,
343
- isLoading: y,
341
+ columns: o,
342
+ containerHeight: a,
343
+ isLoading: m,
344
344
  pageSize: h,
345
- refreshLayout: m,
345
+ refreshLayout: c,
346
346
  setItemsRaw: i,
347
- loadNext: w,
348
- loadThresholdPx: b
347
+ loadNext: x,
348
+ loadThresholdPx: M
349
349
  }) {
350
350
  let n = 0;
351
- async function p(x) {
351
+ async function b(P, T = !1) {
352
352
  if (!e.value) return;
353
- const M = x ?? De(l.value, r.value), s = M.length ? Math.max(...M) : 0, g = e.value.scrollTop + e.value.clientHeight, a = e.value.scrollTop > n + 1;
353
+ const f = P ?? be(l.value, o.value), y = f.length ? Math.max(...f) : 0, r = e.value.scrollTop + e.value.clientHeight, g = e.value.scrollTop > n + 1;
354
354
  n = e.value.scrollTop;
355
- const d = typeof b == "number" ? b : 200, v = d >= 0 ? Math.max(0, s - d) : Math.max(0, s + d);
356
- if (g >= v && a && !y.value) {
357
- await w(), await q();
355
+ const s = typeof M == "number" ? M : 200, d = s >= 0 ? Math.max(0, y - s) : Math.max(0, y + s);
356
+ if (r >= d && (g || T) && !m.value) {
357
+ await x(), await _();
358
358
  return;
359
359
  }
360
360
  }
361
361
  return {
362
- handleScroll: p
362
+ handleScroll: b
363
363
  };
364
364
  }
365
- function Zt(e) {
366
- const { useSwipeMode: l, masonry: r, isLoading: t, loadNext: y, loadPage: h, paginationHistory: m } = e, i = D(0), w = D(0), b = D(!1), n = D(0), p = D(0), x = D(null), M = Q(() => {
367
- if (!l.value || r.value.length === 0) return null;
368
- const o = Math.max(0, Math.min(i.value, r.value.length - 1));
369
- return r.value[o] || null;
370
- }), s = Q(() => {
371
- if (!l.value || !M.value) return null;
372
- const o = i.value + 1;
373
- return o >= r.value.length ? null : r.value[o] || null;
374
- }), g = Q(() => {
375
- if (!l.value || !M.value) return null;
376
- const o = i.value - 1;
377
- return o < 0 ? null : r.value[o] || null;
365
+ function aa(e) {
366
+ const { useSwipeMode: l, masonry: o, isLoading: a, loadNext: m, loadPage: h, paginationHistory: c } = e, i = D(0), x = D(0), M = D(!1), n = D(0), b = D(0), P = D(null), T = Z(() => {
367
+ if (!l.value || o.value.length === 0) return null;
368
+ const k = Math.max(0, Math.min(i.value, o.value.length - 1));
369
+ return o.value[k] || null;
370
+ }), f = Z(() => {
371
+ if (!l.value || !T.value) return null;
372
+ const k = i.value + 1;
373
+ return k >= o.value.length ? null : o.value[k] || null;
374
+ }), y = Z(() => {
375
+ if (!l.value || !T.value) return null;
376
+ const k = i.value - 1;
377
+ return k < 0 ? null : o.value[k] || null;
378
378
  });
379
- function a() {
380
- if (!x.value) return;
381
- const o = x.value.clientHeight;
382
- w.value = -i.value * o;
379
+ function r() {
380
+ if (!P.value) return;
381
+ const k = P.value.clientHeight;
382
+ x.value = -i.value * k;
383
383
  }
384
- function d() {
385
- if (!s.value) {
386
- y();
384
+ function g() {
385
+ if (!f.value) {
386
+ m();
387
387
  return;
388
388
  }
389
- i.value++, a(), i.value >= r.value.length - 5 && y();
389
+ i.value++, r(), i.value >= o.value.length - 5 && m();
390
390
  }
391
- function v() {
392
- g.value && (i.value--, a());
391
+ function s() {
392
+ y.value && (i.value--, r());
393
393
  }
394
- function T(o) {
395
- l.value && (b.value = !0, n.value = o.touches[0].clientY, p.value = w.value, o.preventDefault());
394
+ function d(k) {
395
+ l.value && (M.value = !0, n.value = k.touches[0].clientY, b.value = x.value, k.preventDefault());
396
396
  }
397
- function P(o) {
398
- if (!l.value || !b.value) return;
399
- const u = o.touches[0].clientY - n.value;
400
- w.value = p.value + u, o.preventDefault();
397
+ function L(k) {
398
+ if (!l.value || !M.value) return;
399
+ const z = k.touches[0].clientY - n.value;
400
+ x.value = b.value + z, k.preventDefault();
401
401
  }
402
- function I(o) {
403
- if (!l.value || !b.value) return;
404
- b.value = !1;
405
- const u = w.value - p.value;
406
- Math.abs(u) > 100 ? u > 0 && g.value ? v() : u < 0 && s.value ? d() : a() : a(), o.preventDefault();
402
+ function p(k) {
403
+ if (!l.value || !M.value) return;
404
+ M.value = !1;
405
+ const z = x.value - b.value;
406
+ Math.abs(z) > 100 ? z > 0 && y.value ? s() : z < 0 && f.value ? g() : r() : r(), k.preventDefault();
407
407
  }
408
- function f(o) {
409
- l.value && (b.value = !0, n.value = o.clientY, p.value = w.value, o.preventDefault());
408
+ function v(k) {
409
+ l.value && (M.value = !0, n.value = k.clientY, b.value = x.value, k.preventDefault());
410
410
  }
411
- function H(o) {
412
- if (!l.value || !b.value) return;
413
- const u = o.clientY - n.value;
414
- w.value = p.value + u, o.preventDefault();
411
+ function $(k) {
412
+ if (!l.value || !M.value) return;
413
+ const z = k.clientY - n.value;
414
+ x.value = b.value + z, k.preventDefault();
415
415
  }
416
- function L(o) {
417
- if (!l.value || !b.value) return;
418
- b.value = !1;
419
- const u = w.value - p.value;
420
- Math.abs(u) > 100 ? u > 0 && g.value ? v() : u < 0 && s.value ? d() : a() : a(), o.preventDefault();
416
+ function E(k) {
417
+ if (!l.value || !M.value) return;
418
+ M.value = !1;
419
+ const z = x.value - b.value;
420
+ Math.abs(z) > 100 ? z > 0 && y.value ? s() : z < 0 && f.value ? g() : r() : r(), k.preventDefault();
421
421
  }
422
- function k() {
423
- !l.value && i.value > 0 && (i.value = 0, w.value = 0), l.value && r.value.length === 0 && !t.value && h(m.value[0]), l.value && a();
422
+ function O() {
423
+ !l.value && i.value > 0 && (i.value = 0, x.value = 0), l.value && o.value.length === 0 && !a.value && h(c.value[0]), l.value && r();
424
424
  }
425
- function W() {
426
- i.value = 0, w.value = 0, b.value = !1;
425
+ function j() {
426
+ i.value = 0, x.value = 0, M.value = !1;
427
427
  }
428
428
  return {
429
429
  // State
430
430
  currentSwipeIndex: i,
431
- swipeOffset: w,
432
- isDragging: b,
433
- swipeContainer: x,
431
+ swipeOffset: x,
432
+ isDragging: M,
433
+ swipeContainer: P,
434
434
  // Computed
435
- currentItem: M,
436
- nextItem: s,
437
- previousItem: g,
435
+ currentItem: T,
436
+ nextItem: f,
437
+ previousItem: y,
438
438
  // Functions
439
- handleTouchStart: T,
440
- handleTouchMove: P,
441
- handleTouchEnd: I,
442
- handleMouseDown: f,
443
- handleMouseMove: H,
444
- handleMouseUp: L,
445
- goToNextItem: d,
446
- goToPreviousItem: v,
447
- snapToCurrentItem: a,
448
- handleWindowResize: k,
449
- reset: W
439
+ handleTouchStart: d,
440
+ handleTouchMove: L,
441
+ handleTouchEnd: p,
442
+ handleMouseDown: v,
443
+ handleMouseMove: $,
444
+ handleMouseUp: E,
445
+ goToNextItem: g,
446
+ goToPreviousItem: s,
447
+ snapToCurrentItem: r,
448
+ handleWindowResize: O,
449
+ reset: j
450
450
  };
451
451
  }
452
- function he(e) {
452
+ function me(e) {
453
453
  return e instanceof Error ? e : new Error(String(e));
454
454
  }
455
- function ea(e) {
455
+ function na(e) {
456
456
  const {
457
457
  getNextPage: l,
458
- masonry: r,
459
- isLoading: t,
460
- hasReachedEnd: y,
458
+ masonry: o,
459
+ isLoading: a,
460
+ hasReachedEnd: m,
461
461
  loadError: h,
462
- currentPage: m,
462
+ currentPage: c,
463
463
  paginationHistory: i,
464
- refreshLayout: w,
465
- retryMaxAttempts: b,
464
+ refreshLayout: x,
465
+ retryMaxAttempts: M,
466
466
  retryInitialDelayMs: n,
467
- retryBackoffStepMs: p,
468
- backfillEnabled: x,
469
- backfillDelayMs: M,
470
- backfillMaxCalls: s,
471
- pageSize: g,
472
- autoRefreshOnEmpty: a,
473
- emits: d
474
- } = e, v = D(!1);
475
- let T = !1;
476
- function P(u, E) {
477
- return new Promise(($) => {
478
- const C = Math.max(0, u | 0), F = Date.now();
479
- E(C, C);
480
- const N = setInterval(() => {
481
- if (v.value) {
482
- clearInterval(N), $();
467
+ retryBackoffStepMs: b,
468
+ mode: P,
469
+ backfillDelayMs: T,
470
+ backfillMaxCalls: f,
471
+ pageSize: y,
472
+ autoRefreshOnEmpty: r,
473
+ emits: g
474
+ } = e, s = D(!1);
475
+ let d = !1;
476
+ function L(F) {
477
+ return o.value.filter((t) => t.page === F).length;
478
+ }
479
+ function p(F, t) {
480
+ return new Promise((w) => {
481
+ const S = Math.max(0, F | 0), H = Date.now();
482
+ t(S, S);
483
+ const V = setInterval(() => {
484
+ if (s.value) {
485
+ clearInterval(V), w();
483
486
  return;
484
487
  }
485
- const j = Date.now() - F, X = Math.max(0, C - j);
486
- E(X, C), X <= 0 && (clearInterval(N), $());
488
+ const C = Date.now() - H, I = Math.max(0, S - C);
489
+ t(I, S), I <= 0 && (clearInterval(V), w());
487
490
  }, 100);
488
491
  });
489
492
  }
490
- async function I(u) {
491
- let E = 0;
492
- const $ = b;
493
- let C = n;
493
+ async function v(F) {
494
+ let t = 0;
495
+ const w = M;
496
+ let S = n;
494
497
  for (; ; )
495
498
  try {
496
- const F = await u();
497
- return E > 0 && d("retry:stop", { attempt: E, success: !0 }), F;
498
- } catch (F) {
499
- if (E++, E > $)
500
- throw d("retry:stop", { attempt: E - 1, success: !1 }), F;
501
- d("retry:start", { attempt: E, max: $, totalMs: C }), await P(C, (N, j) => {
502
- d("retry:tick", { attempt: E, remainingMs: N, totalMs: j });
503
- }), C += p;
499
+ const H = await F();
500
+ return t > 0 && g("retry:stop", { attempt: t, success: !0 }), H;
501
+ } catch (H) {
502
+ if (t++, t > w)
503
+ throw g("retry:stop", { attempt: t - 1, success: !1 }), H;
504
+ g("retry:start", { attempt: t, max: w, totalMs: S }), await p(S, (V, C) => {
505
+ g("retry:tick", { attempt: t, remainingMs: V, totalMs: C });
506
+ }), S += b;
504
507
  }
505
508
  }
506
- async function f(u) {
509
+ async function $(F) {
507
510
  try {
508
- const E = await I(() => l(u));
509
- return w([...r.value, ...E.items]), E;
510
- } catch (E) {
511
- throw E;
511
+ const t = await v(() => l(F));
512
+ return x([...o.value, ...t.items]), t;
513
+ } catch (t) {
514
+ throw t;
512
515
  }
513
516
  }
514
- async function H(u, E = !1) {
515
- if (!E && !x || T || v.value || y.value) return;
516
- const $ = (u || 0) + (g || 0);
517
- if (!g || g <= 0) return;
517
+ async function E(F, t = !1) {
518
+ if (!t && P !== "backfill" || d || s.value || m.value) return;
519
+ const w = (F || 0) + (y || 0);
520
+ if (!y || y <= 0) return;
518
521
  if (i.value[i.value.length - 1] == null) {
519
- y.value = !0;
522
+ m.value = !0;
520
523
  return;
521
524
  }
522
- if (!(r.value.length >= $)) {
523
- T = !0, t.value = !0;
525
+ if (!(o.value.length >= w)) {
526
+ d = !0, a.value = !0;
524
527
  try {
525
- let F = 0;
526
- for (d("backfill:start", { target: $, fetched: r.value.length, calls: F }); r.value.length < $ && F < s && i.value[i.value.length - 1] != null && !v.value && !y.value && T && (await P(M, (j, X) => {
527
- d("backfill:tick", {
528
- fetched: r.value.length,
529
- target: $,
530
- calls: F,
531
- remainingMs: j,
532
- totalMs: X
528
+ let H = 0;
529
+ for (g("backfill:start", { target: w, fetched: o.value.length, calls: H }); o.value.length < w && H < f && i.value[i.value.length - 1] != null && !s.value && !m.value && d && (await p(T, (C, I) => {
530
+ g("backfill:tick", {
531
+ fetched: o.value.length,
532
+ target: w,
533
+ calls: H,
534
+ remainingMs: C,
535
+ totalMs: I
533
536
  });
534
- }), !(v.value || !T)); ) {
535
- const N = i.value[i.value.length - 1];
536
- if (N == null) {
537
- y.value = !0;
537
+ }), !(s.value || !d)); ) {
538
+ const V = i.value[i.value.length - 1];
539
+ if (V == null) {
540
+ m.value = !0;
538
541
  break;
539
542
  }
540
543
  try {
541
- if (v.value || !T) break;
542
- const j = await f(N);
543
- if (v.value || !T) break;
544
- h.value = null, i.value.push(j.nextPage), j.nextPage == null && (y.value = !0);
545
- } catch (j) {
546
- if (v.value || !T) break;
547
- h.value = he(j);
544
+ if (s.value || !d) break;
545
+ const C = await $(V);
546
+ if (s.value || !d) break;
547
+ h.value = null, i.value.push(C.nextPage), C.nextPage == null && (m.value = !0);
548
+ } catch (C) {
549
+ if (s.value || !d) break;
550
+ h.value = me(C);
548
551
  }
549
- F++;
552
+ H++;
550
553
  }
551
- d("backfill:stop", { fetched: r.value.length, calls: F });
554
+ g("backfill:stop", { fetched: o.value.length, calls: H });
552
555
  } finally {
553
- T = !1, t.value = !1;
556
+ d = !1, a.value = !1, g("loading:stop", { fetched: o.value.length });
554
557
  }
555
558
  }
556
559
  }
557
- async function L(u) {
558
- if (!t.value) {
559
- v.value = !1, t.value = !0, y.value = !1, h.value = null;
560
+ async function O(F) {
561
+ if (!a.value) {
562
+ s.value = !1, a.value = !0, m.value = !1, h.value = null;
560
563
  try {
561
- const E = r.value.length;
562
- if (v.value) return;
563
- const $ = await f(u);
564
- return v.value ? void 0 : (h.value = null, m.value = u, i.value.push($.nextPage), $.nextPage == null && (y.value = !0), await H(E), $);
565
- } catch (E) {
566
- throw h.value = he(E), E;
564
+ const t = o.value.length;
565
+ if (s.value) return;
566
+ const w = await $(F);
567
+ return s.value ? void 0 : (h.value = null, c.value = F, i.value.push(w.nextPage), w.nextPage == null && (m.value = !0), await E(t), w);
568
+ } catch (t) {
569
+ throw h.value = me(t), t;
567
570
  } finally {
568
- t.value = !1;
571
+ a.value = !1;
569
572
  }
570
573
  }
571
574
  }
572
- async function k() {
573
- if (!t.value && !y.value) {
574
- v.value = !1, t.value = !0, h.value = null;
575
+ async function j() {
576
+ if (!a.value && !m.value) {
577
+ s.value = !1, a.value = !0, h.value = null;
575
578
  try {
576
- const u = r.value.length;
577
- if (v.value) return;
578
- const E = i.value[i.value.length - 1];
579
- if (E == null) {
580
- y.value = !0, t.value = !1;
579
+ const F = o.value.length;
580
+ if (s.value) return;
581
+ if (P === "refresh" && c.value != null && L(c.value) < y) {
582
+ const H = await v(() => l(c.value));
583
+ if (s.value) return;
584
+ const V = [...o.value], C = H.items.filter((N) => !N || N.id == null || N.page == null ? !1 : !V.some((A) => A && A.id === N.id && A.page === N.page));
585
+ if (C.length > 0) {
586
+ const N = [...o.value, ...C];
587
+ x(N), await new Promise((A) => setTimeout(A, 0));
588
+ }
589
+ if (h.value = null, C.length === 0) {
590
+ const N = i.value[i.value.length - 1];
591
+ if (N == null) {
592
+ m.value = !0;
593
+ return;
594
+ }
595
+ const A = await $(N);
596
+ return s.value ? void 0 : (h.value = null, c.value = N, i.value.push(A.nextPage), A.nextPage == null && (m.value = !0), await E(F), A);
597
+ }
598
+ if (L(c.value) >= y) {
599
+ const N = i.value[i.value.length - 1];
600
+ if (N == null) {
601
+ m.value = !0;
602
+ return;
603
+ }
604
+ const A = await $(N);
605
+ return s.value ? void 0 : (h.value = null, c.value = N, i.value.push(A.nextPage), A.nextPage == null && (m.value = !0), await E(F), A);
606
+ } else
607
+ return H;
608
+ }
609
+ const t = i.value[i.value.length - 1];
610
+ if (t == null) {
611
+ m.value = !0;
581
612
  return;
582
613
  }
583
- const $ = await f(E);
584
- return v.value ? void 0 : (h.value = null, m.value = E, i.value.push($.nextPage), $.nextPage == null && (y.value = !0), await H(u), $);
585
- } catch (u) {
586
- throw h.value = he(u), u;
614
+ const w = await $(t);
615
+ return s.value ? void 0 : (h.value = null, c.value = t, i.value.push(w.nextPage), w.nextPage == null && (m.value = !0), await E(F), w);
616
+ } catch (F) {
617
+ throw h.value = me(F), F;
587
618
  } finally {
588
- t.value = !1;
619
+ a.value = !1, g("loading:stop", { fetched: o.value.length });
589
620
  }
590
621
  }
591
622
  }
592
- async function W() {
593
- if (!t.value) {
594
- v.value = !1, t.value = !0;
623
+ async function k() {
624
+ if (!a.value) {
625
+ s.value = !1, a.value = !0;
595
626
  try {
596
- const u = m.value;
597
- if (u == null) {
598
- console.warn("[Masonry] No current page to refresh - currentPage:", m.value, "paginationHistory:", i.value);
627
+ const F = c.value;
628
+ if (F == null) {
629
+ console.warn("[Masonry] No current page to refresh - currentPage:", c.value, "paginationHistory:", i.value);
599
630
  return;
600
631
  }
601
- r.value = [], y.value = !1, h.value = null, i.value = [u];
602
- const E = await f(u);
603
- if (v.value) return;
604
- h.value = null, m.value = u, i.value.push(E.nextPage), E.nextPage == null && (y.value = !0);
605
- const $ = r.value.length;
606
- return await H($), E;
607
- } catch (u) {
608
- throw h.value = he(u), u;
632
+ o.value = [], m.value = !1, h.value = null, i.value = [F];
633
+ const t = await $(F);
634
+ if (s.value) return;
635
+ h.value = null, c.value = F, i.value.push(t.nextPage), t.nextPage == null && (m.value = !0);
636
+ const w = o.value.length;
637
+ return await E(w), t;
638
+ } catch (F) {
639
+ throw h.value = me(F), F;
609
640
  } finally {
610
- t.value = !1;
641
+ a.value = !1, g("loading:stop", { fetched: o.value.length });
611
642
  }
612
643
  }
613
644
  }
614
- function o() {
615
- const u = T;
616
- v.value = !0, t.value = !1, T = !1, u && d("backfill:stop", { fetched: r.value.length, calls: 0, cancelled: !0 });
645
+ function z() {
646
+ const F = d;
647
+ s.value = !0, a.value = !1, d = !1, F && g("backfill:stop", { fetched: o.value.length, calls: 0, cancelled: !0 }), g("loading:stop", { fetched: o.value.length });
617
648
  }
618
649
  return {
619
- loadPage: L,
620
- loadNext: k,
621
- refreshCurrentPage: W,
622
- cancelLoad: o,
623
- maybeBackfillToTarget: H,
624
- getContent: f
650
+ loadPage: O,
651
+ loadNext: j,
652
+ refreshCurrentPage: k,
653
+ cancelLoad: z,
654
+ maybeBackfillToTarget: E,
655
+ getContent: $
625
656
  };
626
657
  }
627
- function ta(e) {
658
+ function la(e) {
628
659
  const {
629
660
  masonry: l,
630
- useSwipeMode: r,
631
- refreshLayout: t,
632
- refreshCurrentPage: y,
661
+ useSwipeMode: o,
662
+ refreshLayout: a,
663
+ refreshCurrentPage: m,
633
664
  loadNext: h,
634
- maybeBackfillToTarget: m,
665
+ maybeBackfillToTarget: c,
635
666
  autoRefreshOnEmpty: i,
636
- paginationHistory: w
667
+ paginationHistory: x
637
668
  } = e;
638
- async function b(s) {
639
- const g = l.value.filter((a) => a.id !== s.id);
640
- if (l.value = g, await q(), g.length === 0 && w.value.length > 0) {
641
- if (i)
642
- await y();
643
- else
644
- try {
645
- await h(), await m(0, !0);
646
- } catch {
647
- }
648
- return;
649
- }
650
- await new Promise((a) => requestAnimationFrame(() => a())), requestAnimationFrame(() => {
651
- t(g);
652
- });
669
+ let M = /* @__PURE__ */ new Set(), n = null, b = !1;
670
+ async function P() {
671
+ if (M.size === 0 || b) return;
672
+ b = !0;
673
+ const d = Array.from(M);
674
+ M.clear(), n = null, await f(d), b = !1;
653
675
  }
654
- async function n(s) {
655
- if (!s || s.length === 0) return;
656
- const g = new Set(s.map((d) => d.id)), a = l.value.filter((d) => !g.has(d.id));
657
- if (l.value = a, await q(), a.length === 0 && w.value.length > 0) {
676
+ async function T(d) {
677
+ M.add(d), n && clearTimeout(n), n = setTimeout(() => {
678
+ P();
679
+ }, 16);
680
+ }
681
+ async function f(d) {
682
+ if (!d || d.length === 0) return;
683
+ const L = new Set(d.map((v) => v.id)), p = l.value.filter((v) => !L.has(v.id));
684
+ if (l.value = p, await _(), p.length === 0 && x.value.length > 0) {
658
685
  if (i)
659
- await y();
686
+ await m();
660
687
  else
661
688
  try {
662
- await h(), await m(0, !0);
689
+ await h(), await c(0, !0);
663
690
  } catch {
664
691
  }
665
692
  return;
666
693
  }
667
- await new Promise((d) => requestAnimationFrame(() => d())), requestAnimationFrame(() => {
668
- t(a);
694
+ await new Promise((v) => requestAnimationFrame(() => v())), requestAnimationFrame(() => {
695
+ a(p);
669
696
  });
670
697
  }
671
- async function p(s, g) {
672
- if (!s) return;
673
- const a = l.value;
674
- if (a.findIndex((P) => P.id === s.id) !== -1) return;
675
- const v = [...a], T = Math.min(g, v.length);
676
- v.splice(T, 0, s), l.value = v, await q(), r.value || (await new Promise((P) => requestAnimationFrame(() => P())), requestAnimationFrame(() => {
677
- t(v);
698
+ async function y(d) {
699
+ !d || d.length === 0 || (d.forEach((L) => M.add(L)), n && clearTimeout(n), n = setTimeout(() => {
700
+ P();
701
+ }, 16));
702
+ }
703
+ async function r(d, L) {
704
+ if (!d) return;
705
+ const p = l.value;
706
+ if (p.findIndex((O) => O.id === d.id) !== -1) return;
707
+ const $ = [...p], E = Math.min(L, $.length);
708
+ $.splice(E, 0, d), l.value = $, await _(), o.value || (await new Promise((O) => requestAnimationFrame(() => O())), requestAnimationFrame(() => {
709
+ a($);
678
710
  }));
679
711
  }
680
- async function x(s, g) {
681
- var L;
682
- if (!s || s.length === 0) return;
683
- if (!g || g.length !== s.length) {
712
+ async function g(d, L) {
713
+ var F;
714
+ if (!d || d.length === 0) return;
715
+ if (!L || L.length !== d.length) {
684
716
  console.warn("[Masonry] restoreMany: items and indices arrays must have the same length");
685
717
  return;
686
718
  }
687
- const a = l.value, d = new Set(a.map((k) => k.id)), v = [];
688
- for (let k = 0; k < s.length; k++)
689
- d.has((L = s[k]) == null ? void 0 : L.id) || v.push({ item: s[k], index: g[k] });
690
- if (v.length === 0) return;
691
- const T = /* @__PURE__ */ new Map();
692
- for (const { item: k, index: W } of v)
693
- T.set(W, k);
694
- const P = v.length > 0 ? Math.max(...v.map(({ index: k }) => k)) : -1, I = Math.max(a.length - 1, P), f = [];
695
- let H = 0;
696
- for (let k = 0; k <= I; k++)
697
- T.has(k) ? f.push(T.get(k)) : H < a.length && (f.push(a[H]), H++);
698
- for (; H < a.length; )
699
- f.push(a[H]), H++;
700
- l.value = f, await q(), r.value || (await new Promise((k) => requestAnimationFrame(() => k())), requestAnimationFrame(() => {
701
- t(f);
719
+ const p = l.value, v = new Set(p.map((t) => t.id)), $ = [];
720
+ for (let t = 0; t < d.length; t++)
721
+ v.has((F = d[t]) == null ? void 0 : F.id) || $.push({ item: d[t], index: L[t] });
722
+ if ($.length === 0) return;
723
+ const E = /* @__PURE__ */ new Map();
724
+ for (const { item: t, index: w } of $)
725
+ E.set(w, t);
726
+ const O = $.length > 0 ? Math.max(...$.map(({ index: t }) => t)) : -1, j = Math.max(p.length - 1, O), k = [];
727
+ let z = 0;
728
+ for (let t = 0; t <= j; t++)
729
+ E.has(t) ? k.push(E.get(t)) : z < p.length && (k.push(p[z]), z++);
730
+ for (; z < p.length; )
731
+ k.push(p[z]), z++;
732
+ l.value = k, await _(), o.value || (await new Promise((t) => requestAnimationFrame(() => t())), requestAnimationFrame(() => {
733
+ a(k);
702
734
  }));
703
735
  }
704
- async function M() {
736
+ async function s() {
705
737
  l.value = [];
706
738
  }
707
739
  return {
708
- remove: b,
709
- removeMany: n,
710
- restore: p,
711
- restoreMany: x,
712
- removeAll: M
740
+ remove: T,
741
+ removeMany: y,
742
+ restore: r,
743
+ restoreMany: g,
744
+ removeAll: s
713
745
  };
714
746
  }
715
- function aa(e) {
747
+ function oa(e) {
716
748
  const {
717
749
  masonry: l,
718
- useSwipeMode: r,
719
- container: t,
720
- columns: y,
750
+ useSwipeMode: o,
751
+ container: a,
752
+ columns: m,
721
753
  containerWidth: h,
722
- masonryContentHeight: m,
754
+ masonryContentHeight: c,
723
755
  layout: i,
724
- fixedDimensions: w,
725
- checkItemDimensions: b
756
+ fixedDimensions: x,
757
+ checkItemDimensions: M
726
758
  } = e;
727
759
  let n = [];
728
- function p(g) {
729
- const a = Xt(g);
730
- let d = 0;
731
- if (t.value) {
732
- const { scrollTop: v, clientHeight: T } = t.value;
733
- d = v + T + 100;
760
+ function b(y) {
761
+ const r = Kt(y);
762
+ let g = 0;
763
+ if (a.value) {
764
+ const { scrollTop: s, clientHeight: d } = a.value;
765
+ g = s + d + 100;
734
766
  }
735
- m.value = Math.max(a, d);
767
+ c.value = Math.max(r, g);
736
768
  }
737
- function x(g) {
738
- var T, P;
739
- if (r.value) {
740
- l.value = g;
769
+ function P(y) {
770
+ var d, L;
771
+ if (o.value) {
772
+ l.value = y;
741
773
  return;
742
774
  }
743
- if (!t.value) return;
744
- if (b(g, "refreshLayout"), g.length > 1e3 && n.length > g.length && n.length - g.length < 100) {
745
- let I = !0;
746
- for (let f = 0; f < g.length; f++)
747
- if (((T = g[f]) == null ? void 0 : T.id) !== ((P = n[f]) == null ? void 0 : P.id)) {
748
- I = !1;
775
+ if (l.value = y, !a.value) return;
776
+ if (M(y, "refreshLayout"), y.length > 1e3 && n.length > y.length && n.length - y.length < 100) {
777
+ let p = !0;
778
+ for (let v = 0; v < y.length; v++)
779
+ if (((d = y[v]) == null ? void 0 : d.id) !== ((L = n[v]) == null ? void 0 : L.id)) {
780
+ p = !1;
749
781
  break;
750
782
  }
751
- if (I) {
752
- const f = g.map((H, L) => ({
753
- ...n[L],
754
- originalIndex: L
783
+ if (p) {
784
+ const v = y.map(($, E) => ({
785
+ ...n[E],
786
+ originalIndex: E
755
787
  }));
756
- p(f), l.value = f, n = f;
788
+ b(v), l.value = v, n = v;
757
789
  return;
758
790
  }
759
791
  }
760
- const d = g.map((I, f) => ({
761
- ...I,
762
- originalIndex: f
763
- })), v = t.value;
764
- if (w.value && w.value.width !== void 0) {
765
- const I = v.style.width, f = v.style.boxSizing;
766
- v.style.boxSizing = "border-box", v.style.width = `${w.value.width}px`, v.offsetWidth;
767
- const H = Ye(d, v, y.value, i.value);
768
- v.style.width = I, v.style.boxSizing = f, p(H), l.value = H, n = H;
792
+ const g = y.map((p, v) => ({
793
+ ...p,
794
+ originalIndex: v
795
+ })), s = a.value;
796
+ if (x.value && x.value.width !== void 0) {
797
+ const p = s.style.width, v = s.style.boxSizing;
798
+ s.style.boxSizing = "border-box", s.style.width = `${x.value.width}px`, s.offsetWidth;
799
+ const $ = Xe(g, s, m.value, i.value);
800
+ s.style.width = p, s.style.boxSizing = v, b($), l.value = $, n = $;
769
801
  } else {
770
- const I = Ye(d, v, y.value, i.value);
771
- p(I), l.value = I, n = I;
802
+ const p = Xe(g, s, m.value, i.value);
803
+ b(p), l.value = p, n = p;
772
804
  }
773
805
  }
774
- function M(g, a) {
775
- w.value = g, g && (g.width !== void 0 && (h.value = g.width), !r.value && t.value && l.value.length > 0 && q(() => {
776
- y.value = ue(i.value, h.value), x(l.value), a && a();
806
+ function T(y, r) {
807
+ x.value = y, y && (y.width !== void 0 && (h.value = y.width), !o.value && a.value && l.value.length > 0 && _(() => {
808
+ m.value = ue(i.value, h.value), P(l.value), r && r();
777
809
  }));
778
810
  }
779
- function s() {
780
- y.value = ue(i.value, h.value), x(l.value);
811
+ function f() {
812
+ m.value = ue(i.value, h.value), P(l.value);
781
813
  }
782
814
  return {
783
- refreshLayout: x,
784
- setFixedDimensions: M,
785
- onResize: s,
786
- calculateHeight: p
815
+ refreshLayout: P,
816
+ setFixedDimensions: T,
817
+ onResize: f,
818
+ calculateHeight: b
787
819
  };
788
820
  }
789
- function na(e) {
821
+ function ia(e) {
790
822
  const {
791
823
  masonry: l,
792
- container: r,
793
- columns: t,
794
- virtualBufferPx: y,
824
+ container: o,
825
+ columns: a,
826
+ virtualBufferPx: m,
795
827
  loadThresholdPx: h
796
- } = e, m = D(e.handleScroll), i = D(0), w = D(0), b = y, n = D(!1), p = D({
828
+ } = e, c = D(e.handleScroll), i = D(0), x = D(0), M = m, n = D(!1), b = D({
797
829
  distanceToTrigger: 0,
798
830
  isNearTrigger: !1
799
- }), x = Q(() => {
800
- const a = i.value - b, d = i.value + w.value + b, v = l.value;
801
- return !v || v.length === 0 ? [] : v.filter((P) => {
802
- if (typeof P.top != "number" || typeof P.columnHeight != "number")
831
+ }), P = Z(() => {
832
+ const r = i.value - M, g = i.value + x.value + M, s = l.value;
833
+ return !s || s.length === 0 ? [] : s.filter((L) => {
834
+ if (typeof L.top != "number" || typeof L.columnHeight != "number")
803
835
  return !0;
804
- const I = P.top;
805
- return P.top + P.columnHeight >= a && I <= d;
836
+ const p = L.top;
837
+ return L.top + L.columnHeight >= r && p <= g;
806
838
  });
807
839
  });
808
- function M(a) {
809
- if (!r.value) return;
810
- const { scrollTop: d, clientHeight: v } = r.value, T = d + v, P = a ?? De(l.value, t.value), I = P.length ? Math.max(...P) : 0, f = typeof h == "number" ? h : 200, H = f >= 0 ? Math.max(0, I - f) : Math.max(0, I + f), L = Math.max(0, H - T), k = L <= 100;
811
- p.value = {
812
- distanceToTrigger: Math.round(L),
813
- isNearTrigger: k
840
+ function T(r) {
841
+ if (!o.value) return;
842
+ const { scrollTop: g, clientHeight: s } = o.value, d = g + s, L = r ?? be(l.value, a.value), p = L.length ? Math.max(...L) : 0, v = typeof h == "number" ? h : 200, $ = v >= 0 ? Math.max(0, p - v) : Math.max(0, p + v), E = Math.max(0, $ - d), O = E <= 100;
843
+ b.value = {
844
+ distanceToTrigger: Math.round(E),
845
+ isNearTrigger: O
814
846
  };
815
847
  }
816
- async function s() {
817
- if (r.value) {
818
- const d = r.value.scrollTop, v = r.value.clientHeight || window.innerHeight, T = v > 0 ? v : window.innerHeight;
819
- i.value = d, w.value = T;
848
+ async function f() {
849
+ if (o.value) {
850
+ const g = o.value.scrollTop, s = o.value.clientHeight || window.innerHeight, d = s > 0 ? s : window.innerHeight;
851
+ i.value = g, x.value = d;
820
852
  }
821
- n.value = !0, await q(), await new Promise((d) => requestAnimationFrame(() => d())), n.value = !1;
822
- const a = De(l.value, t.value);
823
- m.value(a), M(a);
853
+ n.value = !0, await _(), await new Promise((g) => requestAnimationFrame(() => g())), n.value = !1;
854
+ const r = be(l.value, a.value);
855
+ c.value(r), T(r);
824
856
  }
825
- function g() {
826
- i.value = 0, w.value = 0, n.value = !1, p.value = {
857
+ function y() {
858
+ i.value = 0, x.value = 0, n.value = !1, b.value = {
827
859
  distanceToTrigger: 0,
828
860
  isNearTrigger: !1
829
861
  };
830
862
  }
831
863
  return {
832
864
  viewportTop: i,
833
- viewportHeight: w,
865
+ viewportHeight: x,
834
866
  virtualizing: n,
835
- scrollProgress: p,
836
- visibleMasonry: x,
837
- updateScrollProgress: M,
838
- updateViewport: s,
839
- reset: g,
840
- handleScroll: m
867
+ scrollProgress: b,
868
+ visibleMasonry: P,
869
+ updateScrollProgress: T,
870
+ updateViewport: f,
871
+ reset: y,
872
+ handleScroll: c
841
873
  };
842
874
  }
843
- function la(e) {
844
- const { masonry: l } = e, r = D(/* @__PURE__ */ new Set());
845
- function t(m) {
846
- return typeof m == "number" && m > 0 && Number.isFinite(m);
875
+ function ra(e) {
876
+ const { masonry: l } = e, o = D(/* @__PURE__ */ new Set());
877
+ function a(c) {
878
+ return typeof c == "number" && c > 0 && Number.isFinite(c);
847
879
  }
848
- function y(m, i) {
880
+ function m(c, i) {
849
881
  try {
850
- if (!Array.isArray(m) || m.length === 0) return;
851
- const w = m.filter((n) => !t(n == null ? void 0 : n.width) || !t(n == null ? void 0 : n.height));
852
- if (w.length === 0) return;
853
- const b = [];
854
- for (const n of w) {
855
- const p = (n == null ? void 0 : n.id) ?? `idx:${l.value.indexOf(n)}`;
856
- r.value.has(p) || (r.value.add(p), b.push(p));
882
+ if (!Array.isArray(c) || c.length === 0) return;
883
+ const x = c.filter((n) => !a(n == null ? void 0 : n.width) || !a(n == null ? void 0 : n.height));
884
+ if (x.length === 0) return;
885
+ const M = [];
886
+ for (const n of x) {
887
+ const b = (n == null ? void 0 : n.id) ?? `idx:${l.value.indexOf(n)}`;
888
+ o.value.has(b) || (o.value.add(b), M.push(b));
857
889
  }
858
- if (b.length > 0) {
859
- const n = b.slice(0, 10);
890
+ if (M.length > 0) {
891
+ const n = M.slice(0, 10);
860
892
  console.warn(
861
893
  "[Masonry] Items missing width/height detected:",
862
894
  {
863
895
  context: i,
864
- count: b.length,
896
+ count: M.length,
865
897
  sampleIds: n,
866
898
  hint: "Ensure each item has positive width and height. Consider providing fallbacks (e.g., 512x512) at the data layer."
867
899
  }
@@ -871,27 +903,27 @@ function la(e) {
871
903
  }
872
904
  }
873
905
  function h() {
874
- r.value.clear();
906
+ o.value.clear();
875
907
  }
876
908
  return {
877
- checkItemDimensions: y,
878
- invalidDimensionIds: r,
909
+ checkItemDimensions: m,
910
+ invalidDimensionIds: o,
879
911
  reset: h
880
912
  };
881
913
  }
882
- const oa = { class: "flex-1 relative min-h-0" }, ra = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm transition-all duration-300 bg-white relative" }, ia = {
914
+ const sa = { class: "flex-1 relative min-h-0" }, ua = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm transition-all duration-300 bg-white relative" }, ca = {
883
915
  key: 0,
884
916
  class: "absolute inset-0 flex flex-col items-center justify-center bg-slate-100 text-slate-400 text-sm p-4 text-center"
885
- }, sa = {
917
+ }, va = {
886
918
  key: 1,
887
919
  class: "relative w-full h-full"
888
- }, ua = ["src"], ca = ["src", "autoplay", "controls"], va = { class: "w-12 h-12 rounded-full bg-white/80 backdrop-blur-sm flex items-center justify-center shadow-sm" }, fa = {
920
+ }, fa = ["src"], da = ["src", "autoplay", "controls"], ha = { class: "w-12 h-12 rounded-full bg-white/80 backdrop-blur-sm flex items-center justify-center shadow-sm" }, ma = {
889
921
  key: 3,
890
922
  class: "absolute bottom-2 left-1/2 transform -translate-x-1/2 flex items-center justify-center z-10"
891
- }, da = {
923
+ }, ga = {
892
924
  key: 4,
893
925
  class: "absolute inset-0 flex flex-col items-center justify-center bg-slate-50 text-slate-400 text-sm p-4 text-center"
894
- }, be = /* @__PURE__ */ Ke({
926
+ }, Me = /* @__PURE__ */ et({
895
927
  __name: "MasonryItem",
896
928
  props: {
897
929
  item: {},
@@ -901,281 +933,312 @@ const oa = { class: "flex-1 relative min-h-0" }, ra = { class: "w-full h-full ro
901
933
  headerHeight: { default: 0 },
902
934
  footerHeight: { default: 0 },
903
935
  isActive: { type: Boolean, default: !1 },
904
- inSwipeMode: { type: Boolean, default: !1 }
936
+ inSwipeMode: { type: Boolean, default: !1 },
937
+ preloadThreshold: { default: 1 }
905
938
  },
906
- emits: ["preload:success", "preload:error", "mouse-enter", "mouse-leave"],
939
+ emits: ["preload:success", "preload:error", "mouse-enter", "mouse-leave", "in-view", "in-view-and-loaded"],
907
940
  setup(e, { emit: l }) {
908
- const r = e, t = l, y = D(!1), h = D(!1), m = D(null), i = D(!1), w = D(!1), b = D(null), n = D(!1), p = D(!1), x = D(!1), M = D(null), s = D(null);
941
+ const o = e, a = l, m = D(!1), h = D(!1), c = D(null), i = D(!1), x = D(!1), M = D(null), n = D(!1), b = D(!1), P = D(!1), T = D(!1), f = D(!1), y = D(null), r = D(null);
909
942
  let g = null;
910
- const a = Q(() => {
911
- var o;
912
- return r.type ?? ((o = r.item) == null ? void 0 : o.type) ?? "image";
913
- }), d = Q(() => {
914
- var o;
915
- return r.notFound ?? ((o = r.item) == null ? void 0 : o.notFound) ?? !1;
916
- }), v = Q(() => !!r.inSwipeMode);
917
- function T(o) {
918
- t("mouse-enter", { item: r.item, type: o });
943
+ const s = Z(() => {
944
+ var t;
945
+ return o.type ?? ((t = o.item) == null ? void 0 : t.type) ?? "image";
946
+ }), d = Z(() => {
947
+ var t;
948
+ return o.notFound ?? ((t = o.item) == null ? void 0 : t.notFound) ?? !1;
949
+ }), L = Z(() => !!o.inSwipeMode);
950
+ function p(t, w) {
951
+ const S = t === "image" ? m.value : i.value;
952
+ b.value && S && !P.value && (P.value = !0, a("in-view-and-loaded", { item: o.item, type: t, src: w }));
919
953
  }
920
- function P(o) {
921
- t("mouse-leave", { item: r.item, type: o });
954
+ function v(t) {
955
+ a("mouse-enter", { item: o.item, type: t });
922
956
  }
923
- function I(o) {
924
- if (v.value) return;
925
- const u = o.target;
926
- u && (u.paused ? u.play() : u.pause());
957
+ function $(t) {
958
+ a("mouse-leave", { item: o.item, type: t });
927
959
  }
928
- function f(o) {
929
- const u = o.target;
930
- u && (v.value || u.play(), T("video"));
960
+ function E(t) {
961
+ if (L.value) return;
962
+ const w = t.target;
963
+ w && (w.paused ? w.play() : w.pause());
931
964
  }
932
- function H(o) {
933
- const u = o.target;
934
- u && (v.value || u.pause(), P("video"));
965
+ function O(t) {
966
+ const w = t.target;
967
+ w && (L.value || w.play(), v("video"));
935
968
  }
936
- function L(o) {
937
- return new Promise((u, E) => {
938
- if (!o) {
939
- const N = new Error("No image source provided");
940
- t("preload:error", { item: r.item, type: "image", src: o, error: N }), E(N);
969
+ function j(t) {
970
+ const w = t.target;
971
+ w && (L.value || w.pause(), $("video"));
972
+ }
973
+ function k(t) {
974
+ return new Promise((w, S) => {
975
+ if (!t) {
976
+ const I = new Error("No image source provided");
977
+ a("preload:error", { item: o.item, type: "image", src: t, error: I }), S(I);
941
978
  return;
942
979
  }
943
- const $ = new Image(), C = Date.now(), F = 300;
944
- $.onload = () => {
945
- const N = Date.now() - C, j = Math.max(0, F - N);
980
+ const H = new Image(), V = Date.now(), C = 300;
981
+ H.onload = () => {
982
+ const I = Date.now() - V, N = Math.max(0, C - I);
946
983
  setTimeout(async () => {
947
- y.value = !0, h.value = !1, p.value = !1, await q(), await new Promise((X) => setTimeout(X, 100)), x.value = !0, t("preload:success", { item: r.item, type: "image", src: o }), u();
948
- }, j);
949
- }, $.onerror = () => {
950
- h.value = !0, y.value = !1, p.value = !1;
951
- const N = new Error("Failed to load image");
952
- t("preload:error", { item: r.item, type: "image", src: o, error: N }), E(N);
953
- }, $.src = o;
984
+ m.value = !0, h.value = !1, T.value = !1, await _(), await new Promise((A) => setTimeout(A, 100)), f.value = !0, a("preload:success", { item: o.item, type: "image", src: t }), p("image", t), w();
985
+ }, N);
986
+ }, H.onerror = () => {
987
+ h.value = !0, m.value = !1, T.value = !1;
988
+ const I = new Error("Failed to load image");
989
+ a("preload:error", { item: o.item, type: "image", src: t, error: I }), S(I);
990
+ }, H.src = t;
954
991
  });
955
992
  }
956
- function k(o) {
957
- return new Promise((u, E) => {
958
- if (!o) {
959
- const N = new Error("No video source provided");
960
- t("preload:error", { item: r.item, type: "video", src: o, error: N }), E(N);
993
+ function z(t) {
994
+ return new Promise((w, S) => {
995
+ if (!t) {
996
+ const I = new Error("No video source provided");
997
+ a("preload:error", { item: o.item, type: "video", src: t, error: I }), S(I);
961
998
  return;
962
999
  }
963
- const $ = document.createElement("video"), C = Date.now(), F = 300;
964
- $.preload = "metadata", $.muted = !0, $.onloadedmetadata = () => {
965
- const N = Date.now() - C, j = Math.max(0, F - N);
1000
+ const H = document.createElement("video"), V = Date.now(), C = 300;
1001
+ H.preload = "metadata", H.muted = !0, H.onloadedmetadata = () => {
1002
+ const I = Date.now() - V, N = Math.max(0, C - I);
966
1003
  setTimeout(async () => {
967
- i.value = !0, w.value = !1, p.value = !1, await q(), await new Promise((X) => setTimeout(X, 100)), x.value = !0, t("preload:success", { item: r.item, type: "video", src: o }), u();
968
- }, j);
969
- }, $.onerror = () => {
970
- w.value = !0, i.value = !1, p.value = !1;
971
- const N = new Error("Failed to load video");
972
- t("preload:error", { item: r.item, type: "video", src: o, error: N }), E(N);
973
- }, $.src = o;
1004
+ i.value = !0, x.value = !1, T.value = !1, await _(), await new Promise((A) => setTimeout(A, 100)), f.value = !0, a("preload:success", { item: o.item, type: "video", src: t }), p("video", t), w();
1005
+ }, N);
1006
+ }, H.onerror = () => {
1007
+ x.value = !0, i.value = !1, T.value = !1;
1008
+ const I = new Error("Failed to load video");
1009
+ a("preload:error", { item: o.item, type: "video", src: t, error: I }), S(I);
1010
+ }, H.src = t;
974
1011
  });
975
1012
  }
976
- async function W() {
977
- var u;
978
- if (!n.value || p.value || d.value || a.value === "video" && i.value || a.value === "image" && y.value)
1013
+ async function F() {
1014
+ var w;
1015
+ if (!n.value || T.value || d.value || s.value === "video" && i.value || s.value === "image" && m.value)
979
1016
  return;
980
- const o = (u = r.item) == null ? void 0 : u.src;
981
- if (o)
982
- if (p.value = !0, x.value = !1, a.value === "video") {
983
- b.value = o, i.value = !1, w.value = !1;
1017
+ const t = (w = o.item) == null ? void 0 : w.src;
1018
+ if (t)
1019
+ if (T.value = !0, f.value = !1, s.value === "video") {
1020
+ M.value = t, i.value = !1, x.value = !1;
984
1021
  try {
985
- await k(o);
1022
+ await z(t);
986
1023
  } catch {
987
1024
  }
988
1025
  } else {
989
- m.value = o, y.value = !1, h.value = !1;
1026
+ c.value = t, m.value = !1, h.value = !1;
990
1027
  try {
991
- await L(o);
1028
+ await k(t);
992
1029
  } catch {
993
1030
  }
994
1031
  }
995
1032
  }
996
- return Qe(() => {
997
- M.value && (g = new IntersectionObserver(
998
- (o) => {
999
- o.forEach((u) => {
1000
- u.isIntersecting && u.intersectionRatio >= 1 ? n.value || (n.value = !0, W()) : u.isIntersecting;
1033
+ return tt(async () => {
1034
+ if (!y.value) return;
1035
+ const t = [o.preloadThreshold, 1].filter((S, H, V) => V.indexOf(S) === H).sort((S, H) => S - H);
1036
+ g = new IntersectionObserver(
1037
+ (S) => {
1038
+ S.forEach((H) => {
1039
+ const V = H.intersectionRatio, C = V >= 1, I = V >= o.preloadThreshold;
1040
+ if (C && !b.value) {
1041
+ b.value = !0, a("in-view", { item: o.item, type: s.value });
1042
+ const N = s.value === "image" ? c.value : M.value, A = s.value === "image" ? m.value : i.value;
1043
+ N && A && p(s.value, N);
1044
+ }
1045
+ I && !n.value ? (n.value = !0, F()) : H.isIntersecting;
1001
1046
  });
1002
1047
  },
1003
1048
  {
1004
- // Only trigger when item is 100% visible (full height in view)
1005
- threshold: [1]
1049
+ // Trigger at both preloadThreshold and 1.0 (fully in view)
1050
+ threshold: t
1051
+ }
1052
+ ), g.observe(y.value), await _(), requestAnimationFrame(() => {
1053
+ requestAnimationFrame(() => {
1054
+ w();
1055
+ });
1056
+ }), setTimeout(() => {
1057
+ w();
1058
+ }, 100);
1059
+ function w() {
1060
+ if (!y.value || b.value) return;
1061
+ const S = y.value.getBoundingClientRect(), H = window.innerHeight, V = window.innerWidth;
1062
+ if (S.top >= 0 && S.bottom <= H && S.left >= 0 && S.right <= V && S.height > 0 && S.width > 0) {
1063
+ b.value = !0, a("in-view", { item: o.item, type: s.value });
1064
+ const I = s.value === "image" ? c.value : M.value, N = s.value === "image" ? m.value : i.value;
1065
+ I && N && p(s.value, I);
1006
1066
  }
1007
- ), g.observe(M.value));
1008
- }), Ze(() => {
1067
+ }
1068
+ }), at(() => {
1009
1069
  g && (g.disconnect(), g = null);
1010
- }), ee(
1070
+ }), te(
1011
1071
  () => {
1012
- var o;
1013
- return (o = r.item) == null ? void 0 : o.src;
1072
+ var t;
1073
+ return (t = o.item) == null ? void 0 : t.src;
1014
1074
  },
1015
- async (o) => {
1016
- if (!(!o || d.value)) {
1017
- if (a.value === "video") {
1018
- if (o !== b.value && (i.value = !1, w.value = !1, b.value = o, n.value)) {
1019
- p.value = !0;
1075
+ async (t) => {
1076
+ if (!(!t || d.value)) {
1077
+ if (s.value === "video") {
1078
+ if (t !== M.value && (i.value = !1, x.value = !1, M.value = t, n.value)) {
1079
+ T.value = !0;
1020
1080
  try {
1021
- await k(o);
1081
+ await z(t);
1022
1082
  } catch {
1023
1083
  }
1024
1084
  }
1025
- } else if (o !== m.value && (y.value = !1, h.value = !1, m.value = o, n.value)) {
1026
- p.value = !0;
1085
+ } else if (t !== c.value && (m.value = !1, h.value = !1, c.value = t, n.value)) {
1086
+ T.value = !0;
1027
1087
  try {
1028
- await L(o);
1088
+ await k(t);
1029
1089
  } catch {
1030
1090
  }
1031
1091
  }
1032
1092
  }
1033
1093
  }
1034
- ), ee(
1035
- () => r.isActive,
1036
- (o) => {
1037
- !v.value || !s.value || (o ? s.value.play() : s.value.pause());
1094
+ ), te(
1095
+ () => o.isActive,
1096
+ (t) => {
1097
+ !L.value || !r.value || (t ? r.value.play() : r.value.pause());
1038
1098
  }
1039
- ), (o, u) => (O(), R("div", {
1099
+ ), (t, w) => (Y(), q("div", {
1040
1100
  ref_key: "containerRef",
1041
- ref: M,
1101
+ ref: y,
1042
1102
  class: "relative w-full h-full flex flex-col"
1043
1103
  }, [
1044
- o.headerHeight > 0 ? (O(), R("div", {
1104
+ t.headerHeight > 0 ? (Y(), q("div", {
1045
1105
  key: 0,
1046
1106
  class: "relative z-10",
1047
- style: ge({ height: `${o.headerHeight}px` })
1107
+ style: ge({ height: `${t.headerHeight}px` })
1048
1108
  }, [
1049
- _(o.$slots, "header", {
1050
- item: o.item,
1051
- remove: o.remove,
1052
- imageLoaded: y.value,
1109
+ J(t.$slots, "header", {
1110
+ item: t.item,
1111
+ remove: t.remove,
1112
+ imageLoaded: m.value,
1053
1113
  imageError: h.value,
1054
1114
  videoLoaded: i.value,
1055
- videoError: w.value,
1115
+ videoError: x.value,
1056
1116
  showNotFound: d.value,
1057
- isLoading: p.value,
1058
- mediaType: a.value
1117
+ isLoading: T.value,
1118
+ mediaType: s.value,
1119
+ isFullyInView: b.value
1059
1120
  })
1060
- ], 4)) : te("", !0),
1061
- V("div", oa, [
1062
- _(o.$slots, "default", {
1063
- item: o.item,
1064
- remove: o.remove,
1065
- imageLoaded: y.value,
1121
+ ], 4)) : ae("", !0),
1122
+ U("div", sa, [
1123
+ J(t.$slots, "default", {
1124
+ item: t.item,
1125
+ remove: t.remove,
1126
+ imageLoaded: m.value,
1066
1127
  imageError: h.value,
1067
1128
  videoLoaded: i.value,
1068
- videoError: w.value,
1129
+ videoError: x.value,
1069
1130
  showNotFound: d.value,
1070
- isLoading: p.value,
1071
- mediaType: a.value,
1072
- imageSrc: m.value,
1073
- videoSrc: b.value,
1074
- showMedia: x.value
1131
+ isLoading: T.value,
1132
+ mediaType: s.value,
1133
+ imageSrc: c.value,
1134
+ videoSrc: M.value,
1135
+ showMedia: f.value,
1136
+ isFullyInView: b.value
1075
1137
  }, () => [
1076
- V("div", ra, [
1077
- d.value ? (O(), R("div", ia, u[3] || (u[3] = [
1078
- V("i", { class: "fas fa-search text-3xl mb-3 opacity-50" }, null, -1),
1079
- V("span", { class: "font-medium" }, "Not Found", -1),
1080
- V("span", { class: "text-xs mt-1 opacity-75" }, "This item could not be located", -1)
1081
- ]))) : (O(), R("div", sa, [
1082
- a.value === "image" && m.value ? (O(), R("img", {
1138
+ U("div", ua, [
1139
+ d.value ? (Y(), q("div", ca, w[3] || (w[3] = [
1140
+ U("i", { class: "fas fa-search text-3xl mb-3 opacity-50" }, null, -1),
1141
+ U("span", { class: "font-medium" }, "Not Found", -1),
1142
+ U("span", { class: "text-xs mt-1 opacity-75" }, "This item could not be located", -1)
1143
+ ]))) : (Y(), q("div", va, [
1144
+ s.value === "image" && c.value ? (Y(), q("img", {
1083
1145
  key: 0,
1084
- src: m.value,
1085
- class: re([
1146
+ src: c.value,
1147
+ class: ie([
1086
1148
  "w-full h-full object-cover transition-opacity duration-700 ease-in-out",
1087
- y.value && x.value ? "opacity-100" : "opacity-0"
1149
+ m.value && f.value ? "opacity-100" : "opacity-0"
1088
1150
  ]),
1089
1151
  style: { position: "absolute", top: "0", left: "0" },
1090
1152
  loading: "lazy",
1091
1153
  decoding: "async",
1092
1154
  alt: "",
1093
- onMouseenter: u[0] || (u[0] = (E) => T("image")),
1094
- onMouseleave: u[1] || (u[1] = (E) => P("image"))
1095
- }, null, 42, ua)) : te("", !0),
1096
- a.value === "video" && b.value ? (O(), R("video", {
1155
+ onMouseenter: w[0] || (w[0] = (S) => v("image")),
1156
+ onMouseleave: w[1] || (w[1] = (S) => $("image"))
1157
+ }, null, 42, fa)) : ae("", !0),
1158
+ s.value === "video" && M.value ? (Y(), q("video", {
1097
1159
  key: 1,
1098
1160
  ref_key: "videoEl",
1099
- ref: s,
1100
- src: b.value,
1101
- class: re([
1161
+ ref: r,
1162
+ src: M.value,
1163
+ class: ie([
1102
1164
  "w-full h-full object-cover transition-opacity duration-700 ease-in-out",
1103
- i.value && x.value ? "opacity-100" : "opacity-0"
1165
+ i.value && f.value ? "opacity-100" : "opacity-0"
1104
1166
  ]),
1105
1167
  style: { position: "absolute", top: "0", left: "0" },
1106
1168
  muted: "",
1107
1169
  loop: "",
1108
1170
  playsinline: "",
1109
- autoplay: v.value && r.isActive,
1110
- controls: v.value,
1111
- onClick: je(I, ["stop"]),
1112
- onTouchend: je(I, ["stop", "prevent"]),
1113
- onMouseenter: f,
1114
- onMouseleave: H,
1115
- onError: u[2] || (u[2] = (E) => w.value = !0)
1116
- }, null, 42, ca)) : te("", !0),
1117
- !y.value && !i.value && !h.value && !w.value ? (O(), R("div", {
1171
+ autoplay: L.value && o.isActive,
1172
+ controls: L.value,
1173
+ onClick: Ye(E, ["stop"]),
1174
+ onTouchend: Ye(E, ["stop", "prevent"]),
1175
+ onMouseenter: O,
1176
+ onMouseleave: j,
1177
+ onError: w[2] || (w[2] = (S) => x.value = !0)
1178
+ }, null, 42, da)) : ae("", !0),
1179
+ !m.value && !i.value && !h.value && !x.value ? (Y(), q("div", {
1118
1180
  key: 2,
1119
- class: re([
1181
+ class: ie([
1120
1182
  "absolute inset-0 bg-slate-100 flex items-center justify-center transition-opacity duration-500",
1121
- x.value ? "opacity-0 pointer-events-none" : "opacity-100"
1183
+ f.value ? "opacity-0 pointer-events-none" : "opacity-100"
1122
1184
  ])
1123
1185
  }, [
1124
- V("div", va, [
1125
- _(o.$slots, "placeholder-icon", { mediaType: a.value }, () => [
1126
- V("i", {
1127
- class: re(a.value === "video" ? "fas fa-video text-xl text-slate-400" : "fas fa-image text-xl text-slate-400")
1186
+ U("div", ha, [
1187
+ J(t.$slots, "placeholder-icon", { mediaType: s.value }, () => [
1188
+ U("i", {
1189
+ class: ie(s.value === "video" ? "fas fa-video text-xl text-slate-400" : "fas fa-image text-xl text-slate-400")
1128
1190
  }, null, 2)
1129
1191
  ])
1130
1192
  ])
1131
- ], 2)) : te("", !0),
1132
- p.value ? (O(), R("div", fa, u[4] || (u[4] = [
1133
- V("div", { class: "bg-white/90 backdrop-blur-sm rounded-full px-3 py-1.5 shadow-sm" }, [
1134
- V("div", { class: "animate-spin rounded-full h-4 w-4 border-b-2 border-blue-500" })
1193
+ ], 2)) : ae("", !0),
1194
+ T.value ? (Y(), q("div", ma, w[4] || (w[4] = [
1195
+ U("div", { class: "bg-white/90 backdrop-blur-sm rounded-full px-3 py-1.5 shadow-sm" }, [
1196
+ U("div", { class: "animate-spin rounded-full h-4 w-4 border-b-2 border-blue-500" })
1135
1197
  ], -1)
1136
- ]))) : te("", !0),
1137
- a.value === "image" && h.value || a.value === "video" && w.value ? (O(), R("div", da, [
1138
- V("i", {
1139
- class: re(a.value === "video" ? "fas fa-video text-2xl mb-2 opacity-50" : "fas fa-image text-2xl mb-2 opacity-50")
1198
+ ]))) : ae("", !0),
1199
+ s.value === "image" && h.value || s.value === "video" && x.value ? (Y(), q("div", ga, [
1200
+ U("i", {
1201
+ class: ie(s.value === "video" ? "fas fa-video text-2xl mb-2 opacity-50" : "fas fa-image text-2xl mb-2 opacity-50")
1140
1202
  }, null, 2),
1141
- V("span", null, "Failed to load " + $e(a.value), 1)
1142
- ])) : te("", !0)
1203
+ U("span", null, "Failed to load " + Ne(s.value), 1)
1204
+ ])) : ae("", !0)
1143
1205
  ]))
1144
1206
  ])
1145
1207
  ])
1146
1208
  ]),
1147
- o.footerHeight > 0 ? (O(), R("div", {
1209
+ t.footerHeight > 0 ? (Y(), q("div", {
1148
1210
  key: 1,
1149
1211
  class: "relative z-10",
1150
- style: ge({ height: `${o.footerHeight}px` })
1212
+ style: ge({ height: `${t.footerHeight}px` })
1151
1213
  }, [
1152
- _(o.$slots, "footer", {
1153
- item: o.item,
1154
- remove: o.remove,
1155
- imageLoaded: y.value,
1214
+ J(t.$slots, "footer", {
1215
+ item: t.item,
1216
+ remove: t.remove,
1217
+ imageLoaded: m.value,
1156
1218
  imageError: h.value,
1157
1219
  videoLoaded: i.value,
1158
- videoError: w.value,
1220
+ videoError: x.value,
1159
1221
  showNotFound: d.value,
1160
- isLoading: p.value,
1161
- mediaType: a.value
1222
+ isLoading: T.value,
1223
+ mediaType: s.value,
1224
+ isFullyInView: b.value
1162
1225
  })
1163
- ], 4)) : te("", !0)
1226
+ ], 4)) : ae("", !0)
1164
1227
  ], 512));
1165
1228
  }
1166
- }), ma = { class: "w-full h-full flex items-center justify-center p-4" }, ha = { class: "w-full h-full max-w-full max-h-full relative" }, ga = {
1229
+ }), pa = { class: "w-full h-full flex items-center justify-center p-4" }, ya = { class: "w-full h-full max-w-full max-h-full relative" }, wa = {
1167
1230
  key: 0,
1168
1231
  class: "w-full py-8 text-center"
1169
- }, pa = {
1232
+ }, xa = {
1170
1233
  key: 1,
1171
1234
  class: "w-full py-8 text-center"
1172
- }, ya = { class: "text-red-500 dark:text-red-400" }, wa = {
1235
+ }, ba = { class: "text-red-500 dark:text-red-400" }, Ma = {
1173
1236
  key: 0,
1174
1237
  class: "w-full py-8 text-center"
1175
- }, xa = {
1238
+ }, Ta = {
1176
1239
  key: 1,
1177
1240
  class: "w-full py-8 text-center"
1178
- }, ba = { class: "text-red-500 dark:text-red-400" }, Ma = /* @__PURE__ */ Ke({
1241
+ }, Ia = { class: "text-red-500 dark:text-red-400" }, Pa = /* @__PURE__ */ et({
1179
1242
  __name: "Masonry",
1180
1243
  props: {
1181
1244
  getNextPage: {
@@ -1218,9 +1281,10 @@ const oa = { class: "flex-1 relative min-h-0" }, ra = { class: "w-full h-full ro
1218
1281
  default: 40
1219
1282
  },
1220
1283
  // Backfill configuration
1221
- backfillEnabled: {
1222
- type: Boolean,
1223
- default: !0
1284
+ mode: {
1285
+ type: String,
1286
+ default: "backfill",
1287
+ validator: (e) => ["backfill", "none", "refresh"].includes(e)
1224
1288
  },
1225
1289
  backfillDelayMs: {
1226
1290
  type: Number,
@@ -1294,6 +1358,7 @@ const oa = { class: "flex-1 relative min-h-0" }, ra = { class: "w-full h-full ro
1294
1358
  "retry:start",
1295
1359
  "retry:tick",
1296
1360
  "retry:stop",
1361
+ "loading:stop",
1297
1362
  "remove-all:complete",
1298
1363
  // Re-emit item-level preload events from the default MasonryItem
1299
1364
  "item:preload:success",
@@ -1302,8 +1367,8 @@ const oa = { class: "flex-1 relative min-h-0" }, ra = { class: "w-full h-full ro
1302
1367
  "item:mouse-enter",
1303
1368
  "item:mouse-leave"
1304
1369
  ],
1305
- setup(e, { expose: l, emit: r }) {
1306
- const t = e, y = {
1370
+ setup(e, { expose: l, emit: o }) {
1371
+ const a = e, m = {
1307
1372
  sizes: { base: 1, sm: 2, md: 3, lg: 4, xl: 5, "2xl": 6 },
1308
1373
  gutterX: 10,
1309
1374
  gutterY: 10,
@@ -1312,308 +1377,314 @@ const oa = { class: "flex-1 relative min-h-0" }, ra = { class: "w-full h-full ro
1312
1377
  paddingLeft: 0,
1313
1378
  paddingRight: 0,
1314
1379
  placement: "masonry"
1315
- }, h = Q(() => {
1316
- var c;
1380
+ }, h = Z(() => {
1381
+ var u;
1317
1382
  return {
1318
- ...y,
1319
- ...t.layout,
1383
+ ...m,
1384
+ ...a.layout,
1320
1385
  sizes: {
1321
- ...y.sizes,
1322
- ...((c = t.layout) == null ? void 0 : c.sizes) || {}
1386
+ ...m.sizes,
1387
+ ...((u = a.layout) == null ? void 0 : u.sizes) || {}
1323
1388
  }
1324
1389
  };
1325
- }), m = D(null), i = D(typeof window < "u" ? window.innerWidth : 1024), w = D(typeof window < "u" ? window.innerHeight : 768), b = D(null);
1390
+ }), c = D(null), i = D(typeof window < "u" ? window.innerWidth : 1024), x = D(typeof window < "u" ? window.innerHeight : 768), M = D(null);
1326
1391
  let n = null;
1327
- function p(c) {
1392
+ function b(u) {
1328
1393
  return {
1329
1394
  sm: 640,
1330
1395
  md: 768,
1331
1396
  lg: 1024,
1332
1397
  xl: 1280,
1333
1398
  "2xl": 1536
1334
- }[c] || 768;
1399
+ }[u] || 768;
1335
1400
  }
1336
- const x = Q(() => {
1337
- if (t.layoutMode === "masonry") return !1;
1338
- if (t.layoutMode === "swipe") return !0;
1339
- const c = typeof t.mobileBreakpoint == "string" ? p(t.mobileBreakpoint) : t.mobileBreakpoint;
1340
- return i.value < c;
1341
- }), M = r, s = Q({
1342
- get: () => t.items,
1343
- set: (c) => M("update:items", c)
1344
- }), g = D(7), a = D(null), d = D([]), v = D(null), T = D(!1), P = D(0), I = D(!1), f = D(null), H = Q(() => _t(i.value)), L = la({
1345
- masonry: s
1346
- }), { checkItemDimensions: k, reset: W } = L, o = aa({
1347
- masonry: s,
1348
- useSwipeMode: x,
1349
- container: a,
1350
- columns: g,
1401
+ const P = Z(() => {
1402
+ if (a.layoutMode === "masonry") return !1;
1403
+ if (a.layoutMode === "swipe") return !0;
1404
+ const u = typeof a.mobileBreakpoint == "string" ? b(a.mobileBreakpoint) : a.mobileBreakpoint;
1405
+ return i.value < u;
1406
+ }), T = o, f = Z({
1407
+ get: () => a.items,
1408
+ set: (u) => T("update:items", u)
1409
+ }), y = D(7), r = D(null), g = D([]), s = D(null), d = D(!1), L = D(0), p = D(!1), v = D(null), $ = Z(() => Jt(i.value)), E = ra({
1410
+ masonry: f
1411
+ }), { checkItemDimensions: O, reset: j } = E, k = oa({
1412
+ masonry: f,
1413
+ useSwipeMode: P,
1414
+ container: r,
1415
+ columns: y,
1351
1416
  containerWidth: i,
1352
- masonryContentHeight: P,
1417
+ masonryContentHeight: L,
1353
1418
  layout: h,
1354
- fixedDimensions: b,
1355
- checkItemDimensions: k
1356
- }), { refreshLayout: u, setFixedDimensions: E, onResize: $ } = o, C = na({
1357
- masonry: s,
1358
- container: a,
1359
- columns: g,
1360
- virtualBufferPx: t.virtualBufferPx,
1361
- loadThresholdPx: t.loadThresholdPx,
1419
+ fixedDimensions: M,
1420
+ checkItemDimensions: O
1421
+ }), { refreshLayout: z, setFixedDimensions: F, onResize: t } = k, w = ia({
1422
+ masonry: f,
1423
+ container: r,
1424
+ columns: y,
1425
+ virtualBufferPx: a.virtualBufferPx,
1426
+ loadThresholdPx: a.loadThresholdPx,
1362
1427
  handleScroll: () => {
1363
1428
  }
1364
1429
  // Will be set after pagination is initialized
1365
- }), { viewportTop: F, viewportHeight: N, virtualizing: j, visibleMasonry: X, updateScrollProgress: z, updateViewport: Y, reset: G } = C, { onEnter: ne, onBeforeEnter: J, onBeforeLeave: ie, onLeave: Z } = Kt(
1366
- { container: a },
1367
- { leaveDurationMs: t.leaveDurationMs, virtualizing: j }
1368
- ), at = ne, nt = J, lt = ie, ot = Z, rt = ea({
1369
- getNextPage: t.getNextPage,
1370
- masonry: s,
1371
- isLoading: T,
1372
- hasReachedEnd: I,
1373
- loadError: f,
1374
- currentPage: v,
1375
- paginationHistory: d,
1376
- refreshLayout: u,
1377
- retryMaxAttempts: t.retryMaxAttempts,
1378
- retryInitialDelayMs: t.retryInitialDelayMs,
1379
- retryBackoffStepMs: t.retryBackoffStepMs,
1380
- backfillEnabled: t.backfillEnabled,
1381
- backfillDelayMs: t.backfillDelayMs,
1382
- backfillMaxCalls: t.backfillMaxCalls,
1383
- pageSize: t.pageSize,
1384
- autoRefreshOnEmpty: t.autoRefreshOnEmpty,
1385
- emits: M
1386
- }), { loadPage: Me, loadNext: pe, refreshCurrentPage: ze, cancelLoad: Te, maybeBackfillToTarget: it } = rt, K = Zt({
1387
- useSwipeMode: x,
1388
- masonry: s,
1389
- isLoading: T,
1430
+ }), { viewportTop: S, viewportHeight: H, virtualizing: V, visibleMasonry: C, updateScrollProgress: I, updateViewport: N, reset: A } = w, { onEnter: ne, onBeforeEnter: K, onBeforeLeave: re, onLeave: ee } = ea(
1431
+ { container: r },
1432
+ { leaveDurationMs: a.leaveDurationMs, virtualizing: V }
1433
+ ), ot = ne, it = K, rt = re, st = ee, ut = na({
1434
+ getNextPage: a.getNextPage,
1435
+ masonry: f,
1436
+ isLoading: d,
1437
+ hasReachedEnd: p,
1438
+ loadError: v,
1439
+ currentPage: s,
1440
+ paginationHistory: g,
1441
+ refreshLayout: z,
1442
+ retryMaxAttempts: a.retryMaxAttempts,
1443
+ retryInitialDelayMs: a.retryInitialDelayMs,
1444
+ retryBackoffStepMs: a.retryBackoffStepMs,
1445
+ mode: a.mode,
1446
+ backfillDelayMs: a.backfillDelayMs,
1447
+ backfillMaxCalls: a.backfillMaxCalls,
1448
+ pageSize: a.pageSize,
1449
+ autoRefreshOnEmpty: a.autoRefreshOnEmpty,
1450
+ emits: T
1451
+ }), { loadPage: Te, loadNext: pe, refreshCurrentPage: De, cancelLoad: Ie, maybeBackfillToTarget: ct } = ut, Q = aa({
1452
+ useSwipeMode: P,
1453
+ masonry: f,
1454
+ isLoading: d,
1390
1455
  loadNext: pe,
1391
- loadPage: Me,
1392
- paginationHistory: d
1393
- }), { handleScroll: st } = Qt({
1394
- container: a,
1395
- masonry: s,
1396
- columns: g,
1397
- containerHeight: P,
1398
- isLoading: T,
1399
- pageSize: t.pageSize,
1400
- refreshLayout: u,
1401
- setItemsRaw: (c) => {
1402
- s.value = c;
1456
+ loadPage: Te,
1457
+ paginationHistory: g
1458
+ }), { handleScroll: ze } = ta({
1459
+ container: r,
1460
+ masonry: f,
1461
+ columns: y,
1462
+ containerHeight: L,
1463
+ isLoading: d,
1464
+ pageSize: a.pageSize,
1465
+ refreshLayout: z,
1466
+ setItemsRaw: (u) => {
1467
+ f.value = u;
1403
1468
  },
1404
1469
  loadNext: pe,
1405
- loadThresholdPx: t.loadThresholdPx
1470
+ loadThresholdPx: a.loadThresholdPx
1406
1471
  });
1407
- C.handleScroll.value = st;
1408
- const ut = ta({
1409
- masonry: s,
1410
- useSwipeMode: x,
1411
- refreshLayout: u,
1412
- refreshCurrentPage: ze,
1472
+ w.handleScroll.value = ze;
1473
+ const vt = la({
1474
+ masonry: f,
1475
+ useSwipeMode: P,
1476
+ refreshLayout: z,
1477
+ refreshCurrentPage: De,
1413
1478
  loadNext: pe,
1414
- maybeBackfillToTarget: it,
1415
- autoRefreshOnEmpty: t.autoRefreshOnEmpty,
1416
- paginationHistory: d
1417
- }), { remove: ce, removeMany: ct, restore: vt, restoreMany: ft, removeAll: dt } = ut;
1418
- function mt(c) {
1419
- E(c, z), !c && m.value && (i.value = m.value.clientWidth, w.value = m.value.clientHeight);
1479
+ maybeBackfillToTarget: ct,
1480
+ autoRefreshOnEmpty: a.autoRefreshOnEmpty,
1481
+ paginationHistory: g
1482
+ }), { remove: ce, removeMany: ft, restore: dt, restoreMany: ht, removeAll: mt } = vt;
1483
+ function gt(u) {
1484
+ F(u, I), !u && c.value && (i.value = c.value.clientWidth, x.value = c.value.clientHeight);
1420
1485
  }
1421
1486
  l({
1422
- isLoading: T,
1423
- refreshLayout: u,
1487
+ isLoading: d,
1488
+ refreshLayout: z,
1424
1489
  // Container dimensions (wrapper element)
1425
1490
  containerWidth: i,
1426
- containerHeight: w,
1491
+ containerHeight: x,
1427
1492
  // Masonry content height (for backward compatibility, old containerHeight)
1428
- contentHeight: P,
1493
+ contentHeight: L,
1429
1494
  // Current page
1430
- currentPage: v,
1495
+ currentPage: s,
1431
1496
  // End of list tracking
1432
- hasReachedEnd: I,
1497
+ hasReachedEnd: p,
1433
1498
  // Load error tracking
1434
- loadError: f,
1499
+ loadError: v,
1435
1500
  // Set fixed dimensions (overrides ResizeObserver)
1436
- setFixedDimensions: mt,
1501
+ setFixedDimensions: gt,
1437
1502
  remove: ce,
1438
- removeMany: ct,
1439
- removeAll: dt,
1440
- restore: vt,
1441
- restoreMany: ft,
1503
+ removeMany: ft,
1504
+ removeAll: mt,
1505
+ restore: dt,
1506
+ restoreMany: ht,
1442
1507
  loadNext: pe,
1443
- loadPage: Me,
1444
- refreshCurrentPage: ze,
1445
- reset: yt,
1446
- destroy: wt,
1447
- init: Ce,
1448
- restoreItems: Le,
1449
- paginationHistory: d,
1450
- cancelLoad: Te,
1451
- scrollToTop: ht,
1452
- scrollTo: gt,
1453
- totalItems: Q(() => s.value.length),
1454
- currentBreakpoint: H
1508
+ loadPage: Te,
1509
+ refreshCurrentPage: De,
1510
+ reset: xt,
1511
+ destroy: bt,
1512
+ init: je,
1513
+ restoreItems: ke,
1514
+ paginationHistory: g,
1515
+ cancelLoad: Ie,
1516
+ scrollToTop: pt,
1517
+ scrollTo: yt,
1518
+ totalItems: Z(() => f.value.length),
1519
+ currentBreakpoint: $
1455
1520
  });
1456
- const se = K.currentSwipeIndex, ve = K.swipeOffset, ye = K.isDragging, le = K.swipeContainer, Be = K.handleTouchStart, Fe = K.handleTouchMove, Ae = K.handleTouchEnd, We = K.handleMouseDown, Ie = K.handleMouseMove, Ee = K.handleMouseUp, ke = K.snapToCurrentItem;
1457
- function ht(c) {
1458
- a.value && a.value.scrollTo({
1521
+ const se = Q.currentSwipeIndex, ve = Q.swipeOffset, ye = Q.isDragging, le = Q.swipeContainer, Ae = Q.handleTouchStart, Re = Q.handleTouchMove, We = Q.handleTouchEnd, Oe = Q.handleMouseDown, Pe = Q.handleMouseMove, Le = Q.handleMouseUp, Ee = Q.snapToCurrentItem;
1522
+ function pt(u) {
1523
+ r.value && r.value.scrollTo({
1459
1524
  top: 0,
1460
- behavior: (c == null ? void 0 : c.behavior) ?? "smooth",
1461
- ...c
1525
+ behavior: (u == null ? void 0 : u.behavior) ?? "smooth",
1526
+ ...u
1462
1527
  });
1463
1528
  }
1464
- function gt(c) {
1465
- a.value && (a.value.scrollTo({
1466
- top: c.top ?? a.value.scrollTop,
1467
- left: c.left ?? a.value.scrollLeft,
1468
- behavior: c.behavior ?? "auto"
1469
- }), a.value && (F.value = a.value.scrollTop, N.value = a.value.clientHeight || window.innerHeight));
1529
+ function yt(u) {
1530
+ r.value && (r.value.scrollTo({
1531
+ top: u.top ?? r.value.scrollTop,
1532
+ left: u.left ?? r.value.scrollLeft,
1533
+ behavior: u.behavior ?? "auto"
1534
+ }), r.value && (S.value = r.value.scrollTop, H.value = r.value.clientHeight || window.innerHeight));
1470
1535
  }
1471
- function pt() {
1472
- $(), a.value && (F.value = a.value.scrollTop, N.value = a.value.clientHeight);
1536
+ function wt() {
1537
+ t(), r.value && (S.value = r.value.scrollTop, H.value = r.value.clientHeight);
1473
1538
  }
1474
- function yt() {
1475
- Te(), a.value && a.value.scrollTo({
1539
+ function xt() {
1540
+ Ie(), r.value && r.value.scrollTo({
1476
1541
  top: 0,
1477
1542
  behavior: "smooth"
1478
- }), s.value = [], w.value = 0, v.value = t.loadAtPage, d.value = [t.loadAtPage], I.value = !1, f.value = null, G(), we = !1;
1543
+ }), f.value = [], x.value = 0, s.value = a.loadAtPage, g.value = [a.loadAtPage], p.value = !1, v.value = null, A(), we = !1;
1479
1544
  }
1480
- function wt() {
1481
- Te(), s.value = [], P.value = 0, v.value = null, d.value = [], I.value = !1, f.value = null, T.value = !1, se.value = 0, ve.value = 0, ye.value = !1, G(), W(), a.value && a.value.scrollTo({
1545
+ function bt() {
1546
+ Ie(), f.value = [], L.value = 0, s.value = null, g.value = [], p.value = !1, v.value = null, d.value = !1, se.value = 0, ve.value = 0, ye.value = !1, A(), j(), r.value && r.value.scrollTo({
1482
1547
  top: 0,
1483
1548
  behavior: "auto"
1484
1549
  // Instant scroll for destroy
1485
1550
  });
1486
1551
  }
1487
- const oe = Ge(async () => {
1488
- x.value || await Y();
1489
- }, 200), Re = Ge(pt, 200);
1490
- function Oe() {
1491
- K.handleWindowResize();
1552
+ const oe = Qe(async () => {
1553
+ P.value || await N();
1554
+ }, 200), Ce = Qe(wt, 200);
1555
+ function Ve() {
1556
+ Q.handleWindowResize();
1492
1557
  }
1493
- function Ce(c, S, B) {
1494
- v.value = S, d.value = [S], d.value.push(B), I.value = B == null, k(c, "init"), x.value ? (s.value = [...s.value, ...c], se.value === 0 && s.value.length > 0 && (ve.value = 0)) : (u([...s.value, ...c]), a.value && (F.value = a.value.scrollTop, N.value = a.value.clientHeight || window.innerHeight), q(() => {
1495
- a.value && (F.value = a.value.scrollTop, N.value = a.value.clientHeight || window.innerHeight, z());
1558
+ function je(u, B, R) {
1559
+ s.value = B, g.value = [B], g.value.push(R), p.value = R == null, O(u, "init"), P.value ? (f.value = [...f.value, ...u], se.value === 0 && f.value.length > 0 && (ve.value = 0)) : (z([...f.value, ...u]), r.value && (S.value = r.value.scrollTop, H.value = r.value.clientHeight || window.innerHeight), _(() => {
1560
+ r.value && (S.value = r.value.scrollTop, H.value = r.value.clientHeight || window.innerHeight, I());
1496
1561
  }));
1497
1562
  }
1498
- async function Le(c, S, B) {
1499
- if (!t.skipInitialLoad) {
1500
- Ce(c, S, B);
1563
+ async function ke(u, B, R) {
1564
+ if (!a.skipInitialLoad) {
1565
+ je(u, B, R);
1501
1566
  return;
1502
1567
  }
1503
- v.value = S, d.value = [S], B != null && d.value.push(B), I.value = B === null, f.value = null, k(c, "restoreItems"), x.value ? (s.value = c, se.value === 0 && s.value.length > 0 && (ve.value = 0)) : (u(c), a.value && (F.value = a.value.scrollTop, N.value = a.value.clientHeight || window.innerHeight), await q(), a.value && (F.value = a.value.scrollTop, N.value = a.value.clientHeight || window.innerHeight, z()));
1568
+ if (s.value = B, g.value = [B], R != null && g.value.push(R), p.value = R === null, v.value = null, O(u, "restoreItems"), P.value)
1569
+ f.value = u, se.value === 0 && f.value.length > 0 && (ve.value = 0);
1570
+ else if (z(u), r.value && (S.value = r.value.scrollTop, H.value = r.value.clientHeight || window.innerHeight), await _(), r.value) {
1571
+ S.value = r.value.scrollTop, H.value = r.value.clientHeight || window.innerHeight, I(), await _();
1572
+ const G = be(f.value, y.value), W = G.length ? Math.max(...G) : 0, qe = r.value.scrollTop + r.value.clientHeight, Se = typeof a.loadThresholdPx == "number" ? a.loadThresholdPx : 200, Mt = Se >= 0 ? Math.max(0, W - Se) : Math.max(0, W + Se);
1573
+ qe >= Mt && !p.value && !d.value && g.value.length > 0 && g.value[g.value.length - 1] != null && await ze(G, !0);
1574
+ }
1504
1575
  }
1505
- ee(
1576
+ te(
1506
1577
  h,
1507
1578
  () => {
1508
- x.value || a.value && (g.value = ue(h.value, i.value), u(s.value));
1579
+ P.value || r.value && (y.value = ue(h.value, i.value), z(f.value));
1509
1580
  },
1510
1581
  { deep: !0 }
1511
- ), ee(() => t.layoutMode, () => {
1512
- b.value && b.value.width !== void 0 ? i.value = b.value.width : m.value && (i.value = m.value.clientWidth);
1513
- }), ee(a, (c) => {
1514
- c && !x.value ? (c.removeEventListener("scroll", oe), c.addEventListener("scroll", oe, { passive: !0 })) : c && c.removeEventListener("scroll", oe);
1582
+ ), te(() => a.layoutMode, () => {
1583
+ M.value && M.value.width !== void 0 ? i.value = M.value.width : c.value && (i.value = c.value.clientWidth);
1584
+ }), te(r, (u) => {
1585
+ u && !P.value ? (u.removeEventListener("scroll", oe), u.addEventListener("scroll", oe, { passive: !0 })) : u && u.removeEventListener("scroll", oe);
1515
1586
  }, { immediate: !0 });
1516
1587
  let we = !1;
1517
- return ee(
1518
- () => [t.items, t.skipInitialLoad, t.initialPage, t.initialNextPage],
1519
- ([c, S, B, ae]) => {
1520
- if (S && c && c.length > 0 && !we) {
1588
+ return te(
1589
+ () => [a.items, a.skipInitialLoad, a.initialPage, a.initialNextPage],
1590
+ ([u, B, R, G]) => {
1591
+ if (B && u && u.length > 0 && !we) {
1521
1592
  we = !0;
1522
- const A = B ?? t.loadAtPage;
1523
- Le(c, A, ae !== void 0 ? ae : void 0);
1593
+ const W = R ?? a.loadAtPage;
1594
+ ke(u, W, G !== void 0 ? G : void 0);
1524
1595
  }
1525
1596
  },
1526
1597
  { immediate: !1 }
1527
- ), ee(x, (c, S) => {
1528
- S === void 0 && c === !1 || q(() => {
1529
- c ? (document.addEventListener("mousemove", Ie), document.addEventListener("mouseup", Ee), a.value && a.value.removeEventListener("scroll", oe), se.value = 0, ve.value = 0, s.value.length > 0 && ke()) : (document.removeEventListener("mousemove", Ie), document.removeEventListener("mouseup", Ee), a.value && m.value && (b.value && b.value.width !== void 0 ? i.value = b.value.width : i.value = m.value.clientWidth, a.value.removeEventListener("scroll", oe), a.value.addEventListener("scroll", oe, { passive: !0 }), s.value.length > 0 && (g.value = ue(h.value, i.value), u(s.value), F.value = a.value.scrollTop, N.value = a.value.clientHeight, z())));
1598
+ ), te(P, (u, B) => {
1599
+ B === void 0 && u === !1 || _(() => {
1600
+ u ? (document.addEventListener("mousemove", Pe), document.addEventListener("mouseup", Le), r.value && r.value.removeEventListener("scroll", oe), se.value = 0, ve.value = 0, f.value.length > 0 && Ee()) : (document.removeEventListener("mousemove", Pe), document.removeEventListener("mouseup", Le), r.value && c.value && (M.value && M.value.width !== void 0 ? i.value = M.value.width : i.value = c.value.clientWidth, r.value.removeEventListener("scroll", oe), r.value.addEventListener("scroll", oe, { passive: !0 }), f.value.length > 0 && (y.value = ue(h.value, i.value), z(f.value), S.value = r.value.scrollTop, H.value = r.value.clientHeight, I())));
1530
1601
  });
1531
- }, { immediate: !0 }), ee(le, (c) => {
1532
- c && (c.addEventListener("touchstart", Be, { passive: !1 }), c.addEventListener("touchmove", Fe, { passive: !1 }), c.addEventListener("touchend", Ae), c.addEventListener("mousedown", We));
1533
- }), ee(() => s.value.length, (c, S) => {
1534
- x.value && c > 0 && S === 0 && (se.value = 0, q(() => ke()));
1535
- }), ee(m, (c) => {
1536
- n && (n.disconnect(), n = null), c && typeof ResizeObserver < "u" ? (n = new ResizeObserver((S) => {
1537
- if (!b.value)
1538
- for (const B of S) {
1539
- const ae = B.contentRect.width, A = B.contentRect.height;
1540
- i.value !== ae && (i.value = ae), w.value !== A && (w.value = A);
1602
+ }, { immediate: !0 }), te(le, (u) => {
1603
+ u && (u.addEventListener("touchstart", Ae, { passive: !1 }), u.addEventListener("touchmove", Re, { passive: !1 }), u.addEventListener("touchend", We), u.addEventListener("mousedown", Oe));
1604
+ }), te(() => f.value.length, (u, B) => {
1605
+ P.value && u > 0 && B === 0 && (se.value = 0, _(() => Ee()));
1606
+ }), te(c, (u) => {
1607
+ n && (n.disconnect(), n = null), u && typeof ResizeObserver < "u" ? (n = new ResizeObserver((B) => {
1608
+ if (!M.value)
1609
+ for (const R of B) {
1610
+ const G = R.contentRect.width, W = R.contentRect.height;
1611
+ i.value !== G && (i.value = G), x.value !== W && (x.value = W);
1541
1612
  }
1542
- }), n.observe(c), b.value || (i.value = c.clientWidth, w.value = c.clientHeight)) : c && (b.value || (i.value = c.clientWidth, w.value = c.clientHeight));
1543
- }, { immediate: !0 }), ee(i, (c, S) => {
1544
- c !== S && c > 0 && !x.value && a.value && s.value.length > 0 && q(() => {
1545
- g.value = ue(h.value, c), u(s.value), z();
1613
+ }), n.observe(u), M.value || (i.value = u.clientWidth, x.value = u.clientHeight)) : u && (M.value || (i.value = u.clientWidth, x.value = u.clientHeight));
1614
+ }, { immediate: !0 }), te(i, (u, B) => {
1615
+ u !== B && u > 0 && !P.value && r.value && f.value.length > 0 && _(() => {
1616
+ y.value = ue(h.value, u), z(f.value), I();
1546
1617
  });
1547
- }), Qe(async () => {
1618
+ }), tt(async () => {
1548
1619
  try {
1549
- await q(), m.value && !n && (i.value = m.value.clientWidth, w.value = m.value.clientHeight), x.value || (g.value = ue(h.value, i.value), a.value && (F.value = a.value.scrollTop, N.value = a.value.clientHeight));
1550
- const c = t.loadAtPage;
1551
- if (d.value = [c], !t.skipInitialLoad)
1552
- await Me(d.value[0]);
1553
- else if (t.items && t.items.length > 0) {
1554
- const S = t.initialPage !== null && t.initialPage !== void 0 ? t.initialPage : t.loadAtPage, B = t.initialNextPage !== void 0 ? t.initialNextPage : void 0;
1555
- await Le(t.items, S, B), we = !0;
1620
+ await _(), c.value && !n && (i.value = c.value.clientWidth, x.value = c.value.clientHeight), P.value || (y.value = ue(h.value, i.value), r.value && (S.value = r.value.scrollTop, H.value = r.value.clientHeight));
1621
+ const u = a.loadAtPage;
1622
+ if (g.value = [u], !a.skipInitialLoad)
1623
+ await _(), await Te(g.value[0]);
1624
+ else if (a.items && a.items.length > 0) {
1625
+ const B = a.initialPage !== null && a.initialPage !== void 0 ? a.initialPage : a.loadAtPage, R = a.initialNextPage !== void 0 ? a.initialNextPage : void 0;
1626
+ await ke(a.items, B, R), we = !0;
1556
1627
  }
1557
- x.value ? q(() => ke()) : z();
1558
- } catch (c) {
1559
- f.value || (console.error("Error during component initialization:", c), f.value = he(c)), T.value = !1;
1628
+ P.value ? _(() => Ee()) : I();
1629
+ } catch (u) {
1630
+ v.value || (console.error("Error during component initialization:", u), v.value = me(u)), d.value = !1;
1560
1631
  }
1561
- window.addEventListener("resize", Re), window.addEventListener("resize", Oe);
1562
- }), Ze(() => {
1563
- var c;
1564
- n && (n.disconnect(), n = null), (c = a.value) == null || c.removeEventListener("scroll", oe), window.removeEventListener("resize", Re), window.removeEventListener("resize", Oe), le.value && (le.value.removeEventListener("touchstart", Be), le.value.removeEventListener("touchmove", Fe), le.value.removeEventListener("touchend", Ae), le.value.removeEventListener("mousedown", We)), document.removeEventListener("mousemove", Ie), document.removeEventListener("mouseup", Ee);
1565
- }), (c, S) => (O(), R("div", {
1632
+ window.addEventListener("resize", Ce), window.addEventListener("resize", Ve);
1633
+ }), at(() => {
1634
+ var u;
1635
+ n && (n.disconnect(), n = null), (u = r.value) == null || u.removeEventListener("scroll", oe), window.removeEventListener("resize", Ce), window.removeEventListener("resize", Ve), le.value && (le.value.removeEventListener("touchstart", Ae), le.value.removeEventListener("touchmove", Re), le.value.removeEventListener("touchend", We), le.value.removeEventListener("mousedown", Oe)), document.removeEventListener("mousemove", Pe), document.removeEventListener("mouseup", Le);
1636
+ }), (u, B) => (Y(), q("div", {
1566
1637
  ref_key: "wrapper",
1567
- ref: m,
1638
+ ref: c,
1568
1639
  class: "w-full h-full flex flex-col relative"
1569
1640
  }, [
1570
- x.value ? (O(), R("div", {
1641
+ P.value ? (Y(), q("div", {
1571
1642
  key: 0,
1572
- class: re(["overflow-hidden w-full flex-1 swipe-container touch-none select-none", { "force-motion": t.forceMotion, "cursor-grab": !U(ye), "cursor-grabbing": U(ye) }]),
1643
+ class: ie(["overflow-hidden w-full flex-1 swipe-container touch-none select-none", { "force-motion": a.forceMotion, "cursor-grab": !X(ye), "cursor-grabbing": X(ye) }]),
1573
1644
  ref_key: "swipeContainer",
1574
1645
  ref: le,
1575
1646
  style: { height: "100%", "max-height": "100%", position: "relative" }
1576
1647
  }, [
1577
- V("div", {
1648
+ U("div", {
1578
1649
  class: "relative w-full",
1579
1650
  style: ge({
1580
- transform: `translateY(${U(ve)}px)`,
1581
- transition: U(ye) ? "none" : `transform ${e.transitionDurationMs}ms ${e.transitionEasing}`,
1582
- height: `${s.value.length * 100}%`
1651
+ transform: `translateY(${X(ve)}px)`,
1652
+ transition: X(ye) ? "none" : `transform ${e.transitionDurationMs}ms ${e.transitionEasing}`,
1653
+ height: `${f.value.length * 100}%`
1583
1654
  })
1584
1655
  }, [
1585
- (O(!0), R(Ve, null, qe(s.value, (B, ae) => (O(), R("div", {
1586
- key: `${B.page}-${B.id}`,
1656
+ (Y(!0), q(Ue, null, _e(f.value, (R, G) => (Y(), q("div", {
1657
+ key: `${R.page}-${R.id}`,
1587
1658
  class: "absolute top-0 left-0 w-full",
1588
1659
  style: ge({
1589
- top: `${ae * (100 / s.value.length)}%`,
1590
- height: `${100 / s.value.length}%`
1660
+ top: `${G * (100 / f.value.length)}%`,
1661
+ height: `${100 / f.value.length}%`
1591
1662
  })
1592
1663
  }, [
1593
- V("div", ma, [
1594
- V("div", ha, [
1595
- _(c.$slots, "default", {
1596
- item: B,
1597
- remove: U(ce),
1598
- index: B.originalIndex ?? s.value.indexOf(B)
1664
+ U("div", pa, [
1665
+ U("div", ya, [
1666
+ J(u.$slots, "default", {
1667
+ item: R,
1668
+ remove: X(ce),
1669
+ index: R.originalIndex ?? f.value.indexOf(R)
1599
1670
  }, () => [
1600
- Pe(be, {
1601
- item: B,
1602
- remove: U(ce),
1671
+ He(Me, {
1672
+ item: R,
1673
+ remove: X(ce),
1603
1674
  "header-height": h.value.header,
1604
1675
  "footer-height": h.value.footer,
1605
1676
  "in-swipe-mode": !0,
1606
- "is-active": ae === U(se),
1607
- "onPreload:success": S[0] || (S[0] = (A) => M("item:preload:success", A)),
1608
- "onPreload:error": S[1] || (S[1] = (A) => M("item:preload:error", A)),
1609
- onMouseEnter: S[2] || (S[2] = (A) => M("item:mouse-enter", A)),
1610
- onMouseLeave: S[3] || (S[3] = (A) => M("item:mouse-leave", A))
1677
+ "is-active": G === X(se),
1678
+ "onPreload:success": B[0] || (B[0] = (W) => T("item:preload:success", W)),
1679
+ "onPreload:error": B[1] || (B[1] = (W) => T("item:preload:error", W)),
1680
+ onMouseEnter: B[2] || (B[2] = (W) => T("item:mouse-enter", W)),
1681
+ onMouseLeave: B[3] || (B[3] = (W) => T("item:mouse-leave", W))
1611
1682
  }, {
1612
- header: fe((A) => [
1613
- _(c.$slots, "item-header", de({ ref_for: !0 }, A), void 0, !0)
1683
+ header: fe((W) => [
1684
+ J(u.$slots, "item-header", de({ ref_for: !0 }, W), void 0, !0)
1614
1685
  ]),
1615
- footer: fe((A) => [
1616
- _(c.$slots, "item-footer", de({ ref_for: !0 }, A), void 0, !0)
1686
+ footer: fe((W) => [
1687
+ J(u.$slots, "item-footer", de({ ref_for: !0 }, W), void 0, !0)
1617
1688
  ]),
1618
1689
  _: 2
1619
1690
  }, 1032, ["item", "remove", "header-height", "footer-height", "is-active"])
@@ -1622,62 +1693,62 @@ const oa = { class: "flex-1 relative min-h-0" }, ra = { class: "w-full h-full ro
1622
1693
  ])
1623
1694
  ], 4))), 128))
1624
1695
  ], 4),
1625
- I.value && s.value.length > 0 ? (O(), R("div", ga, [
1626
- _(c.$slots, "end-message", {}, () => [
1627
- S[8] || (S[8] = V("p", { class: "text-gray-500 dark:text-gray-400" }, "You've reached the end", -1))
1696
+ p.value && f.value.length > 0 ? (Y(), q("div", wa, [
1697
+ J(u.$slots, "end-message", {}, () => [
1698
+ B[8] || (B[8] = U("p", { class: "text-gray-500 dark:text-gray-400" }, "You've reached the end", -1))
1628
1699
  ], !0)
1629
- ])) : te("", !0),
1630
- f.value && s.value.length > 0 ? (O(), R("div", pa, [
1631
- _(c.$slots, "error-message", { error: f.value }, () => [
1632
- V("p", ya, "Failed to load content: " + $e(f.value.message), 1)
1700
+ ])) : ae("", !0),
1701
+ v.value && f.value.length > 0 ? (Y(), q("div", xa, [
1702
+ J(u.$slots, "error-message", { error: v.value }, () => [
1703
+ U("p", ba, "Failed to load content: " + Ne(v.value.message), 1)
1633
1704
  ], !0)
1634
- ])) : te("", !0)
1635
- ], 2)) : (O(), R("div", {
1705
+ ])) : ae("", !0)
1706
+ ], 2)) : (Y(), q("div", {
1636
1707
  key: 1,
1637
- class: re(["overflow-auto w-full flex-1 masonry-container", { "force-motion": t.forceMotion }]),
1708
+ class: ie(["overflow-auto w-full flex-1 masonry-container", { "force-motion": a.forceMotion }]),
1638
1709
  ref_key: "container",
1639
- ref: a
1710
+ ref: r
1640
1711
  }, [
1641
- V("div", {
1712
+ U("div", {
1642
1713
  class: "relative",
1643
- style: ge({ height: `${P.value}px`, "--masonry-duration": `${e.transitionDurationMs}ms`, "--masonry-leave-duration": `${e.leaveDurationMs}ms`, "--masonry-ease": e.transitionEasing })
1714
+ style: ge({ height: `${L.value}px`, "--masonry-duration": `${e.transitionDurationMs}ms`, "--masonry-leave-duration": `${e.leaveDurationMs}ms`, "--masonry-ease": e.transitionEasing })
1644
1715
  }, [
1645
- Pe(xt, {
1716
+ He(Tt, {
1646
1717
  name: "masonry",
1647
1718
  css: !1,
1648
- onEnter: U(at),
1649
- onBeforeEnter: U(nt),
1650
- onLeave: U(ot),
1651
- onBeforeLeave: U(lt)
1719
+ onEnter: X(ot),
1720
+ onBeforeEnter: X(it),
1721
+ onLeave: X(st),
1722
+ onBeforeLeave: X(rt)
1652
1723
  }, {
1653
1724
  default: fe(() => [
1654
- (O(!0), R(Ve, null, qe(U(X), (B, ae) => (O(), R("div", de({
1655
- key: `${B.page}-${B.id}`,
1725
+ (Y(!0), q(Ue, null, _e(X(C), (R, G) => (Y(), q("div", de({
1726
+ key: `${R.page}-${R.id}`,
1656
1727
  class: "absolute masonry-item",
1657
1728
  ref_for: !0
1658
- }, U(Jt)(B, ae)), [
1659
- _(c.$slots, "default", {
1660
- item: B,
1661
- remove: U(ce),
1662
- index: B.originalIndex ?? s.value.indexOf(B)
1729
+ }, X(Zt)(R, G)), [
1730
+ J(u.$slots, "default", {
1731
+ item: R,
1732
+ remove: X(ce),
1733
+ index: R.originalIndex ?? f.value.indexOf(R)
1663
1734
  }, () => [
1664
- Pe(be, {
1665
- item: B,
1666
- remove: U(ce),
1735
+ He(Me, {
1736
+ item: R,
1737
+ remove: X(ce),
1667
1738
  "header-height": h.value.header,
1668
1739
  "footer-height": h.value.footer,
1669
1740
  "in-swipe-mode": !1,
1670
1741
  "is-active": !1,
1671
- "onPreload:success": S[4] || (S[4] = (A) => M("item:preload:success", A)),
1672
- "onPreload:error": S[5] || (S[5] = (A) => M("item:preload:error", A)),
1673
- onMouseEnter: S[6] || (S[6] = (A) => M("item:mouse-enter", A)),
1674
- onMouseLeave: S[7] || (S[7] = (A) => M("item:mouse-leave", A))
1742
+ "onPreload:success": B[4] || (B[4] = (W) => T("item:preload:success", W)),
1743
+ "onPreload:error": B[5] || (B[5] = (W) => T("item:preload:error", W)),
1744
+ onMouseEnter: B[6] || (B[6] = (W) => T("item:mouse-enter", W)),
1745
+ onMouseLeave: B[7] || (B[7] = (W) => T("item:mouse-leave", W))
1675
1746
  }, {
1676
- header: fe((A) => [
1677
- _(c.$slots, "item-header", de({ ref_for: !0 }, A), void 0, !0)
1747
+ header: fe((W) => [
1748
+ J(u.$slots, "item-header", de({ ref_for: !0 }, W), void 0, !0)
1678
1749
  ]),
1679
- footer: fe((A) => [
1680
- _(c.$slots, "item-footer", de({ ref_for: !0 }, A), void 0, !0)
1750
+ footer: fe((W) => [
1751
+ J(u.$slots, "item-footer", de({ ref_for: !0 }, W), void 0, !0)
1681
1752
  ]),
1682
1753
  _: 2
1683
1754
  }, 1032, ["item", "remove", "header-height", "footer-height"])
@@ -1687,31 +1758,31 @@ const oa = { class: "flex-1 relative min-h-0" }, ra = { class: "w-full h-full ro
1687
1758
  _: 3
1688
1759
  }, 8, ["onEnter", "onBeforeEnter", "onLeave", "onBeforeLeave"])
1689
1760
  ], 4),
1690
- I.value && s.value.length > 0 ? (O(), R("div", wa, [
1691
- _(c.$slots, "end-message", {}, () => [
1692
- S[9] || (S[9] = V("p", { class: "text-gray-500 dark:text-gray-400" }, "You've reached the end", -1))
1761
+ p.value && f.value.length > 0 ? (Y(), q("div", Ma, [
1762
+ J(u.$slots, "end-message", {}, () => [
1763
+ B[9] || (B[9] = U("p", { class: "text-gray-500 dark:text-gray-400" }, "You've reached the end", -1))
1693
1764
  ], !0)
1694
- ])) : te("", !0),
1695
- f.value && s.value.length > 0 ? (O(), R("div", xa, [
1696
- _(c.$slots, "error-message", { error: f.value }, () => [
1697
- V("p", ba, "Failed to load content: " + $e(f.value.message), 1)
1765
+ ])) : ae("", !0),
1766
+ v.value && f.value.length > 0 ? (Y(), q("div", Ta, [
1767
+ J(u.$slots, "error-message", { error: v.value }, () => [
1768
+ U("p", Ia, "Failed to load content: " + Ne(v.value.message), 1)
1698
1769
  ], !0)
1699
- ])) : te("", !0)
1770
+ ])) : ae("", !0)
1700
1771
  ], 2))
1701
1772
  ], 512));
1702
1773
  }
1703
- }), Ta = (e, l) => {
1704
- const r = e.__vccOpts || e;
1705
- for (const [t, y] of l)
1706
- r[t] = y;
1707
- return r;
1708
- }, Je = /* @__PURE__ */ Ta(Ma, [["__scopeId", "data-v-c6a3147d"]]), ka = {
1774
+ }), La = (e, l) => {
1775
+ const o = e.__vccOpts || e;
1776
+ for (const [a, m] of l)
1777
+ o[a] = m;
1778
+ return o;
1779
+ }, Ze = /* @__PURE__ */ La(Pa, [["__scopeId", "data-v-84ab92bd"]]), Ha = {
1709
1780
  install(e) {
1710
- e.component("WyxosMasonry", Je), e.component("WMasonry", Je), e.component("WyxosMasonryItem", be), e.component("WMasonryItem", be);
1781
+ e.component("WyxosMasonry", Ze), e.component("WMasonry", Ze), e.component("WyxosMasonryItem", Me), e.component("WMasonryItem", Me);
1711
1782
  }
1712
1783
  };
1713
1784
  export {
1714
- Je as Masonry,
1715
- be as MasonryItem,
1716
- ka as default
1785
+ Ze as Masonry,
1786
+ Me as MasonryItem,
1787
+ Ha as default
1717
1788
  };