@wyxos/vibe 1.6.17 → 1.6.18

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,23 +1,23 @@
1
- import { nextTick as Y, defineComponent as et, ref as T, computed as K, onMounted as tt, onUnmounted as at, watch as oe, createElementBlock as j, openBlock as C, createCommentVNode as ie, createElementVNode as V, normalizeStyle as ye, renderSlot as le, normalizeClass as se, withModifiers as Ye, toDisplayString as bt, Fragment as Ue, renderList as Ge, createVNode as ke, withCtx as he, mergeProps as pe, TransitionGroup as xt, unref as Mt } from "vue";
1
+ import { nextTick as J, defineComponent as tt, ref as T, computed as Z, onMounted as at, onUnmounted as nt, watch as re, createElementBlock as D, openBlock as F, createCommentVNode as ne, createElementVNode as O, normalizeStyle as we, renderSlot as Q, normalizeClass as ue, withModifiers as _e, toDisplayString as He, Fragment as Ue, renderList as Ge, createVNode as $e, withCtx as ge, mergeProps as pe, TransitionGroup as Tt, unref as Lt } from "vue";
2
2
  let Se = null;
3
- function Tt() {
3
+ function kt() {
4
4
  if (Se != null) return Se;
5
5
  const t = document.createElement("div");
6
6
  t.style.visibility = "hidden", t.style.overflow = "scroll", t.style.msOverflowStyle = "scrollbar", t.style.width = "100px", t.style.height = "100px", document.body.appendChild(t);
7
- const c = document.createElement("div");
8
- c.style.width = "100%", t.appendChild(c);
9
- const v = t.offsetWidth - c.offsetWidth;
10
- return document.body.removeChild(t), Se = v, v;
7
+ const v = document.createElement("div");
8
+ v.style.width = "100%", t.appendChild(v);
9
+ const c = t.offsetWidth - v.offsetWidth;
10
+ return document.body.removeChild(t), Se = c, c;
11
11
  }
12
- function Xe(t, c, v, l = {}) {
12
+ function Xe(t, v, c, r = {}) {
13
13
  const {
14
- gutterX: M = 0,
15
- gutterY: h = 0,
16
- header: o = 0,
14
+ gutterX: L = 0,
15
+ gutterY: p = 0,
16
+ header: l = 0,
17
17
  footer: s = 0,
18
- paddingLeft: g = 0,
19
- paddingRight: b = 0,
20
- sizes: k = {
18
+ paddingLeft: b = 0,
19
+ paddingRight: E = 0,
20
+ sizes: S = {
21
21
  base: 1,
22
22
  sm: 2,
23
23
  md: 3,
@@ -25,195 +25,195 @@ function Xe(t, c, v, l = {}) {
25
25
  xl: 5,
26
26
  "2xl": 6
27
27
  },
28
- placement: E = "masonry"
29
- } = l;
30
- let f = 0, D = 0;
28
+ placement: I = "masonry"
29
+ } = r;
30
+ let d = 0, W = 0;
31
31
  try {
32
- if (c && c.nodeType === 1 && typeof window < "u" && window.getComputedStyle) {
33
- const H = window.getComputedStyle(c);
34
- f = parseFloat(H.paddingLeft) || 0, D = parseFloat(H.paddingRight) || 0;
32
+ if (v && v.nodeType === 1 && typeof window < "u" && window.getComputedStyle) {
33
+ const w = window.getComputedStyle(v);
34
+ d = parseFloat(w.paddingLeft) || 0, W = parseFloat(w.paddingRight) || 0;
35
35
  }
36
36
  } catch {
37
37
  }
38
- const A = (g || 0) + f, O = (b || 0) + D, m = c.offsetWidth - c.clientWidth, r = m > 0 ? m + 2 : Tt() + 2, L = c.offsetWidth - r - A - O, y = M * (v - 1), x = Math.floor((L - y) / v), N = t.map((H) => {
39
- const I = H.width, S = H.height;
40
- return Math.round(x * S / I) + s + o;
38
+ const R = (b || 0) + d, q = (E || 0) + W, g = v.offsetWidth - v.clientWidth, o = g > 0 ? g + 2 : kt() + 2, $ = v.offsetWidth - o - R - q, y = L * (c - 1), x = Math.floor(($ - y) / c), H = t.map((w) => {
39
+ const M = w.width, j = w.height;
40
+ return Math.round(x * j / M) + s + l;
41
41
  });
42
- if (E === "sequential-balanced") {
43
- const H = N.length;
44
- if (H === 0) return [];
45
- const I = (P, B, G) => P + (B > 0 ? h : 0) + G;
46
- let S = Math.max(...N), n = N.reduce((P, B) => P + B, 0) + h * Math.max(0, H - 1);
47
- const w = (P) => {
48
- let B = 1, G = 0, X = 0;
49
- for (let J = 0; J < H; J++) {
50
- const ue = N[J], Z = I(G, X, ue);
51
- if (Z <= P)
52
- G = Z, X++;
53
- else if (B++, G = ue, X = 1, ue > P || B > v) return !1;
42
+ if (I === "sequential-balanced") {
43
+ const w = H.length;
44
+ if (w === 0) return [];
45
+ const M = (k, z, K) => k + (z > 0 ? p : 0) + K;
46
+ let j = Math.max(...H), n = H.reduce((k, z) => k + z, 0) + p * Math.max(0, w - 1);
47
+ const f = (k) => {
48
+ let z = 1, K = 0, G = 0;
49
+ for (let X = 0; X < w; X++) {
50
+ const ee = H[X], te = M(K, G, ee);
51
+ if (te <= k)
52
+ K = te, G++;
53
+ else if (z++, K = ee, G = 1, ee > k || z > c) return !1;
54
54
  }
55
- return B <= v;
55
+ return z <= c;
56
56
  };
57
- for (; S < n; ) {
58
- const P = Math.floor((S + n) / 2);
59
- w(P) ? n = P : S = P + 1;
57
+ for (; j < n; ) {
58
+ const k = Math.floor((j + n) / 2);
59
+ f(k) ? n = k : j = k + 1;
60
60
  }
61
- const F = n, $ = new Array(v).fill(0);
62
- let ae = v - 1, Q = 0, W = 0;
63
- for (let P = H - 1; P >= 0; P--) {
64
- const B = N[P], G = P < ae;
65
- !(I(Q, W, B) <= F) || G ? ($[ae] = P + 1, ae--, Q = B, W = 1) : (Q = I(Q, W, B), W++);
61
+ const P = n, A = new Array(c).fill(0);
62
+ let U = c - 1, C = 0, N = 0;
63
+ for (let k = w - 1; k >= 0; k--) {
64
+ const z = H[k], K = k < U;
65
+ !(M(C, N, z) <= P) || K ? (A[U] = k + 1, U--, C = z, N = 1) : (C = M(C, N, z), N++);
66
66
  }
67
- $[0] = 0;
68
- const U = [], _ = new Array(v).fill(0);
69
- for (let P = 0; P < v; P++) {
70
- const B = $[P], G = P + 1 < v ? $[P + 1] : H, X = P * (x + M);
71
- for (let J = B; J < G; J++) {
72
- const Z = {
73
- ...t[J],
67
+ A[0] = 0;
68
+ const oe = [], ie = new Array(c).fill(0);
69
+ for (let k = 0; k < c; k++) {
70
+ const z = A[k], K = k + 1 < c ? A[k + 1] : w, G = k * (x + L);
71
+ for (let X = z; X < K; X++) {
72
+ const te = {
73
+ ...t[X],
74
74
  columnWidth: x,
75
75
  imageHeight: 0,
76
76
  columnHeight: 0,
77
77
  left: 0,
78
78
  top: 0
79
79
  };
80
- Z.imageHeight = N[J] - (s + o), Z.columnHeight = N[J], Z.left = X, Z.top = _[P], _[P] += Z.columnHeight + (J + 1 < G ? h : 0), U.push(Z);
80
+ te.imageHeight = H[X] - (s + l), te.columnHeight = H[X], te.left = G, te.top = ie[k], ie[k] += te.columnHeight + (X + 1 < K ? p : 0), oe.push(te);
81
81
  }
82
82
  }
83
- return U;
83
+ return oe;
84
84
  }
85
- const p = new Array(v).fill(0), z = [];
86
- for (let H = 0; H < t.length; H++) {
87
- const I = t[H], S = {
88
- ...I,
85
+ const h = new Array(c).fill(0), B = [];
86
+ for (let w = 0; w < t.length; w++) {
87
+ const M = t[w], j = {
88
+ ...M,
89
89
  columnWidth: 0,
90
90
  imageHeight: 0,
91
91
  columnHeight: 0,
92
92
  left: 0,
93
93
  top: 0
94
- }, n = p.indexOf(Math.min(...p)), w = I.width, F = I.height;
95
- S.columnWidth = x, S.left = n * (x + M), S.imageHeight = Math.round(x * F / w), S.columnHeight = S.imageHeight + s + o, S.top = p[n], p[n] += S.columnHeight + h, z.push(S);
94
+ }, n = h.indexOf(Math.min(...h)), f = M.width, P = M.height;
95
+ j.columnWidth = x, j.left = n * (x + L), j.imageHeight = Math.round(x * P / f), j.columnHeight = j.imageHeight + s + l, j.top = h[n], h[n] += j.columnHeight + p, B.push(j);
96
96
  }
97
- return z;
97
+ return B;
98
98
  }
99
- var Et = typeof global == "object" && global && global.Object === Object && global, Lt = typeof self == "object" && self && self.Object === Object && self, nt = Et || Lt || Function("return this")(), xe = nt.Symbol, ot = Object.prototype, It = ot.hasOwnProperty, kt = ot.toString, ge = xe ? xe.toStringTag : void 0;
100
- function St(t) {
101
- var c = It.call(t, ge), v = t[ge];
99
+ var It = typeof global == "object" && global && global.Object === Object && global, $t = typeof self == "object" && self && self.Object === Object && self, lt = It || $t || Function("return this")(), xe = lt.Symbol, rt = Object.prototype, St = rt.hasOwnProperty, Pt = rt.toString, ye = xe ? xe.toStringTag : void 0;
100
+ function Ht(t) {
101
+ var v = St.call(t, ye), c = t[ye];
102
102
  try {
103
- t[ge] = void 0;
104
- var l = !0;
103
+ t[ye] = void 0;
104
+ var r = !0;
105
105
  } catch {
106
106
  }
107
- var M = kt.call(t);
108
- return l && (c ? t[ge] = v : delete t[ge]), M;
107
+ var L = Pt.call(t);
108
+ return r && (v ? t[ye] = c : delete t[ye]), L;
109
109
  }
110
- var Pt = Object.prototype, Ht = Pt.toString;
111
- function $t(t) {
112
- return Ht.call(t);
113
- }
114
- var Nt = "[object Null]", Wt = "[object Undefined]", _e = xe ? xe.toStringTag : void 0;
110
+ var Nt = Object.prototype, Wt = Nt.toString;
115
111
  function Dt(t) {
116
- return t == null ? t === void 0 ? Wt : Nt : _e && _e in Object(t) ? St(t) : $t(t);
112
+ return Wt.call(t);
113
+ }
114
+ var Ft = "[object Null]", Bt = "[object Undefined]", Je = xe ? xe.toStringTag : void 0;
115
+ function zt(t) {
116
+ return t == null ? t === void 0 ? Bt : Ft : Je && Je in Object(t) ? Ht(t) : Dt(t);
117
117
  }
118
- function Bt(t) {
118
+ function At(t) {
119
119
  return t != null && typeof t == "object";
120
120
  }
121
- var zt = "[object Symbol]";
122
- function Ft(t) {
123
- return typeof t == "symbol" || Bt(t) && Dt(t) == zt;
121
+ var Ot = "[object Symbol]";
122
+ function Rt(t) {
123
+ return typeof t == "symbol" || At(t) && zt(t) == Ot;
124
124
  }
125
- var At = /\s/;
126
- function Ot(t) {
127
- for (var c = t.length; c-- && At.test(t.charAt(c)); )
125
+ var jt = /\s/;
126
+ function Ct(t) {
127
+ for (var v = t.length; v-- && jt.test(t.charAt(v)); )
128
128
  ;
129
- return c;
129
+ return v;
130
130
  }
131
- var Rt = /^\s+/;
132
- function jt(t) {
133
- return t && t.slice(0, Ot(t) + 1).replace(Rt, "");
131
+ var Yt = /^\s+/;
132
+ function qt(t) {
133
+ return t && t.slice(0, Ct(t) + 1).replace(Yt, "");
134
134
  }
135
- function He(t) {
136
- var c = typeof t;
137
- return t != null && (c == "object" || c == "function");
135
+ function Ne(t) {
136
+ var v = typeof t;
137
+ return t != null && (v == "object" || v == "function");
138
138
  }
139
- var Je = NaN, Ct = /^[-+]0x[0-9a-f]+$/i, qt = /^0b[01]+$/i, Vt = /^0o[0-7]+$/i, Yt = parseInt;
140
- function Ke(t) {
139
+ var Ke = NaN, Vt = /^[-+]0x[0-9a-f]+$/i, _t = /^0b[01]+$/i, Ut = /^0o[0-7]+$/i, Gt = parseInt;
140
+ function Qe(t) {
141
141
  if (typeof t == "number")
142
142
  return t;
143
- if (Ft(t))
144
- return Je;
145
- if (He(t)) {
146
- var c = typeof t.valueOf == "function" ? t.valueOf() : t;
147
- t = He(c) ? c + "" : c;
143
+ if (Rt(t))
144
+ return Ke;
145
+ if (Ne(t)) {
146
+ var v = typeof t.valueOf == "function" ? t.valueOf() : t;
147
+ t = Ne(v) ? v + "" : v;
148
148
  }
149
149
  if (typeof t != "string")
150
150
  return t === 0 ? t : +t;
151
- t = jt(t);
152
- var v = qt.test(t);
153
- return v || Vt.test(t) ? Yt(t.slice(2), v ? 2 : 8) : Ct.test(t) ? Je : +t;
151
+ t = qt(t);
152
+ var c = _t.test(t);
153
+ return c || Ut.test(t) ? Gt(t.slice(2), c ? 2 : 8) : Vt.test(t) ? Ke : +t;
154
154
  }
155
155
  var Pe = function() {
156
- return nt.Date.now();
157
- }, Ut = "Expected a function", Gt = Math.max, Xt = Math.min;
158
- function Qe(t, c, v) {
159
- var l, M, h, o, s, g, b = 0, k = !1, E = !1, f = !0;
156
+ return lt.Date.now();
157
+ }, Xt = "Expected a function", Jt = Math.max, Kt = Math.min;
158
+ function Ze(t, v, c) {
159
+ var r, L, p, l, s, b, E = 0, S = !1, I = !1, d = !0;
160
160
  if (typeof t != "function")
161
- throw new TypeError(Ut);
162
- c = Ke(c) || 0, He(v) && (k = !!v.leading, E = "maxWait" in v, h = E ? Gt(Ke(v.maxWait) || 0, c) : h, f = "trailing" in v ? !!v.trailing : f);
163
- function D(p) {
164
- var z = l, H = M;
165
- return l = M = void 0, b = p, o = t.apply(H, z), o;
161
+ throw new TypeError(Xt);
162
+ v = Qe(v) || 0, Ne(c) && (S = !!c.leading, I = "maxWait" in c, p = I ? Jt(Qe(c.maxWait) || 0, v) : p, d = "trailing" in c ? !!c.trailing : d);
163
+ function W(h) {
164
+ var B = r, w = L;
165
+ return r = L = void 0, E = h, l = t.apply(w, B), l;
166
166
  }
167
- function A(p) {
168
- return b = p, s = setTimeout(r, c), k ? D(p) : o;
167
+ function R(h) {
168
+ return E = h, s = setTimeout(o, v), S ? W(h) : l;
169
169
  }
170
- function O(p) {
171
- var z = p - g, H = p - b, I = c - z;
172
- return E ? Xt(I, h - H) : I;
170
+ function q(h) {
171
+ var B = h - b, w = h - E, M = v - B;
172
+ return I ? Kt(M, p - w) : M;
173
173
  }
174
- function m(p) {
175
- var z = p - g, H = p - b;
176
- return g === void 0 || z >= c || z < 0 || E && H >= h;
174
+ function g(h) {
175
+ var B = h - b, w = h - E;
176
+ return b === void 0 || B >= v || B < 0 || I && w >= p;
177
177
  }
178
- function r() {
179
- var p = Pe();
180
- if (m(p))
181
- return L(p);
182
- s = setTimeout(r, O(p));
178
+ function o() {
179
+ var h = Pe();
180
+ if (g(h))
181
+ return $(h);
182
+ s = setTimeout(o, q(h));
183
183
  }
184
- function L(p) {
185
- return s = void 0, f && l ? D(p) : (l = M = void 0, o);
184
+ function $(h) {
185
+ return s = void 0, d && r ? W(h) : (r = L = void 0, l);
186
186
  }
187
187
  function y() {
188
- s !== void 0 && clearTimeout(s), b = 0, l = g = M = s = void 0;
188
+ s !== void 0 && clearTimeout(s), E = 0, r = b = L = s = void 0;
189
189
  }
190
190
  function x() {
191
- return s === void 0 ? o : L(Pe());
191
+ return s === void 0 ? l : $(Pe());
192
192
  }
193
- function N() {
194
- var p = Pe(), z = m(p);
195
- if (l = arguments, M = this, g = p, z) {
193
+ function H() {
194
+ var h = Pe(), B = g(h);
195
+ if (r = arguments, L = this, b = h, B) {
196
196
  if (s === void 0)
197
- return A(g);
198
- if (E)
199
- return clearTimeout(s), s = setTimeout(r, c), D(g);
197
+ return R(b);
198
+ if (I)
199
+ return clearTimeout(s), s = setTimeout(o, v), W(b);
200
200
  }
201
- return s === void 0 && (s = setTimeout(r, c)), o;
201
+ return s === void 0 && (s = setTimeout(o, v)), l;
202
202
  }
203
- return N.cancel = y, N.flush = x, N;
203
+ return H.cancel = y, H.flush = x, H;
204
204
  }
205
- function fe(t, c) {
206
- const v = c ?? (typeof window < "u" ? window.innerWidth : 1024), l = t.sizes;
207
- return v >= 1536 && l["2xl"] ? l["2xl"] : v >= 1280 && l.xl ? l.xl : v >= 1024 && l.lg ? l.lg : v >= 768 && l.md ? l.md : v >= 640 && l.sm ? l.sm : l.base;
205
+ function fe(t, v) {
206
+ const c = v ?? (typeof window < "u" ? window.innerWidth : 1024), r = t.sizes;
207
+ return c >= 1536 && r["2xl"] ? r["2xl"] : c >= 1280 && r.xl ? r.xl : c >= 1024 && r.lg ? r.lg : c >= 768 && r.md ? r.md : c >= 640 && r.sm ? r.sm : r.base;
208
208
  }
209
- function _t(t) {
210
- const c = t ?? (typeof window < "u" ? window.innerWidth : 1024);
211
- return c >= 1536 ? "2xl" : c >= 1280 ? "xl" : c >= 1024 ? "lg" : c >= 768 ? "md" : c >= 640 ? "sm" : "base";
209
+ function Qt(t) {
210
+ const v = t ?? (typeof window < "u" ? window.innerWidth : 1024);
211
+ return v >= 1536 ? "2xl" : v >= 1280 ? "xl" : v >= 1024 ? "lg" : v >= 768 ? "md" : v >= 640 ? "sm" : "base";
212
212
  }
213
- function Jt(t) {
214
- return t.reduce((v, l) => Math.max(v, l.top + l.columnHeight), 0) + 500;
213
+ function Zt(t) {
214
+ return t.reduce((c, r) => Math.max(c, r.top + r.columnHeight), 0) + 500;
215
215
  }
216
- function Kt(t) {
216
+ function ea(t) {
217
217
  return {
218
218
  transform: `translate3d(${t.left}px, ${t.top}px, 0)`,
219
219
  top: "0px",
@@ -222,114 +222,114 @@ function Kt(t) {
222
222
  height: `${t.columnHeight}px`
223
223
  };
224
224
  }
225
- function Qt(t, c = 0) {
225
+ function ta(t, v = 0) {
226
226
  return {
227
- style: Kt(t),
227
+ style: ea(t),
228
228
  "data-top": t.top,
229
229
  "data-left": t.left,
230
230
  "data-id": `${t.page}-${t.id}`,
231
- "data-index": c
231
+ "data-index": v
232
232
  };
233
233
  }
234
- function $e(t, c) {
235
- if (!t.length || c <= 0)
236
- return new Array(Math.max(1, c)).fill(0);
237
- const l = Array.from(new Set(t.map((o) => o.left))).sort((o, s) => o - s).slice(0, c), M = /* @__PURE__ */ new Map();
238
- for (let o = 0; o < l.length; o++) M.set(l[o], o);
239
- const h = new Array(l.length).fill(0);
240
- for (const o of t) {
241
- const s = M.get(o.left);
242
- s != null && (h[s] = Math.max(h[s], o.top + o.columnHeight));
234
+ function We(t, v) {
235
+ if (!t.length || v <= 0)
236
+ return new Array(Math.max(1, v)).fill(0);
237
+ const r = Array.from(new Set(t.map((l) => l.left))).sort((l, s) => l - s).slice(0, v), L = /* @__PURE__ */ new Map();
238
+ for (let l = 0; l < r.length; l++) L.set(r[l], l);
239
+ const p = new Array(r.length).fill(0);
240
+ for (const l of t) {
241
+ const s = L.get(l.left);
242
+ s != null && (p[s] = Math.max(p[s], l.top + l.columnHeight));
243
243
  }
244
- for (; h.length < c; ) h.push(0);
245
- return h;
244
+ for (; p.length < v; ) p.push(0);
245
+ return p;
246
246
  }
247
- function Zt(t, c) {
248
- function v(o, s) {
249
- const g = parseInt(o.dataset.left || "0", 10), b = parseInt(o.dataset.top || "0", 10), k = parseInt(o.dataset.index || "0", 10), E = Math.min(k * 20, 160), f = o.style.getPropertyValue("--masonry-opacity-delay");
250
- o.style.setProperty("--masonry-opacity-delay", `${E}ms`), requestAnimationFrame(() => {
251
- o.style.opacity = "1", o.style.transform = `translate3d(${g}px, ${b}px, 0) scale(1)`;
252
- const D = () => {
253
- f ? o.style.setProperty("--masonry-opacity-delay", f) : o.style.removeProperty("--masonry-opacity-delay"), o.removeEventListener("transitionend", D), s();
247
+ function aa(t, v) {
248
+ function c(l, s) {
249
+ const b = parseInt(l.dataset.left || "0", 10), E = parseInt(l.dataset.top || "0", 10), S = parseInt(l.dataset.index || "0", 10), I = Math.min(S * 20, 160), d = l.style.getPropertyValue("--masonry-opacity-delay");
250
+ l.style.setProperty("--masonry-opacity-delay", `${I}ms`), requestAnimationFrame(() => {
251
+ l.style.opacity = "1", l.style.transform = `translate3d(${b}px, ${E}px, 0) scale(1)`;
252
+ const W = () => {
253
+ d ? l.style.setProperty("--masonry-opacity-delay", d) : l.style.removeProperty("--masonry-opacity-delay"), l.removeEventListener("transitionend", W), s();
254
254
  };
255
- o.addEventListener("transitionend", D);
255
+ l.addEventListener("transitionend", W);
256
256
  });
257
257
  }
258
- function l(o) {
259
- const s = parseInt(o.dataset.left || "0", 10), g = parseInt(o.dataset.top || "0", 10);
260
- o.style.opacity = "0", o.style.transform = `translate3d(${s}px, ${g + 10}px, 0) scale(0.985)`;
258
+ function r(l) {
259
+ const s = parseInt(l.dataset.left || "0", 10), b = parseInt(l.dataset.top || "0", 10);
260
+ l.style.opacity = "0", l.style.transform = `translate3d(${s}px, ${b + 10}px, 0) scale(0.985)`;
261
261
  }
262
- function M(o) {
263
- const s = parseInt(o.dataset.left || "0", 10), g = parseInt(o.dataset.top || "0", 10);
264
- o.style.transition = "none", o.style.opacity = "1", o.style.transform = `translate3d(${s}px, ${g}px, 0) scale(1)`, o.style.removeProperty("--masonry-opacity-delay"), requestAnimationFrame(() => {
265
- o.style.transition = "";
262
+ function L(l) {
263
+ const s = parseInt(l.dataset.left || "0", 10), b = parseInt(l.dataset.top || "0", 10);
264
+ l.style.transition = "none", l.style.opacity = "1", l.style.transform = `translate3d(${s}px, ${b}px, 0) scale(1)`, l.style.removeProperty("--masonry-opacity-delay"), requestAnimationFrame(() => {
265
+ l.style.transition = "";
266
266
  });
267
267
  }
268
- function h(o, s) {
269
- const g = parseInt(o.dataset.left || "0", 10), b = parseInt(o.dataset.top || "0", 10), k = typeof (c == null ? void 0 : c.leaveDurationMs) == "number" ? c.leaveDurationMs : NaN;
270
- let E = Number.isFinite(k) && k > 0 ? k : NaN;
271
- if (!Number.isFinite(E)) {
272
- const r = getComputedStyle(o).getPropertyValue("--masonry-leave-duration") || "", L = parseFloat(r);
273
- E = Number.isFinite(L) && L > 0 ? L : 200;
268
+ function p(l, s) {
269
+ const b = parseInt(l.dataset.left || "0", 10), E = parseInt(l.dataset.top || "0", 10), S = typeof (v == null ? void 0 : v.leaveDurationMs) == "number" ? v.leaveDurationMs : NaN;
270
+ let I = Number.isFinite(S) && S > 0 ? S : NaN;
271
+ if (!Number.isFinite(I)) {
272
+ const o = getComputedStyle(l).getPropertyValue("--masonry-leave-duration") || "", $ = parseFloat(o);
273
+ I = Number.isFinite($) && $ > 0 ? $ : 200;
274
274
  }
275
- const f = o.style.transitionDuration, D = () => {
276
- o.removeEventListener("transitionend", A), clearTimeout(O), o.style.transitionDuration = f || "";
277
- }, A = (m) => {
278
- (!m || m.target === o) && (D(), s());
279
- }, O = setTimeout(() => {
280
- D(), s();
281
- }, E + 100);
275
+ const d = l.style.transitionDuration, W = () => {
276
+ l.removeEventListener("transitionend", R), clearTimeout(q), l.style.transitionDuration = d || "";
277
+ }, R = (g) => {
278
+ (!g || g.target === l) && (W(), s());
279
+ }, q = setTimeout(() => {
280
+ W(), s();
281
+ }, I + 100);
282
282
  requestAnimationFrame(() => {
283
- o.style.transitionDuration = `${E}ms`, o.style.opacity = "0", o.style.transform = `translate3d(${g}px, ${b + 10}px, 0) scale(0.985)`, o.addEventListener("transitionend", A);
283
+ l.style.transitionDuration = `${I}ms`, l.style.opacity = "0", l.style.transform = `translate3d(${b}px, ${E + 10}px, 0) scale(0.985)`, l.addEventListener("transitionend", R);
284
284
  });
285
285
  }
286
286
  return {
287
- onEnter: v,
288
- onBeforeEnter: l,
289
- onBeforeLeave: M,
290
- onLeave: h
287
+ onEnter: c,
288
+ onBeforeEnter: r,
289
+ onBeforeLeave: L,
290
+ onLeave: p
291
291
  };
292
292
  }
293
- function ea({
293
+ function na({
294
294
  container: t,
295
- masonry: c,
296
- columns: v,
297
- containerHeight: l,
298
- isLoading: M,
299
- pageSize: h,
300
- refreshLayout: o,
295
+ masonry: v,
296
+ columns: c,
297
+ containerHeight: r,
298
+ isLoading: L,
299
+ pageSize: p,
300
+ refreshLayout: l,
301
301
  setItemsRaw: s,
302
- loadNext: g,
303
- loadThresholdPx: b
302
+ loadNext: b,
303
+ loadThresholdPx: E
304
304
  }) {
305
- let k = 0;
306
- async function E(f) {
305
+ let S = 0;
306
+ async function I(d) {
307
307
  if (!t.value) return;
308
- const D = f ?? $e(c.value, v.value), A = D.length ? Math.max(...D) : 0, O = t.value.scrollTop + t.value.clientHeight, m = t.value.scrollTop > k + 1;
309
- k = t.value.scrollTop;
310
- const r = typeof b == "number" ? b : 200, L = r >= 0 ? Math.max(0, A - r) : Math.max(0, A + r);
311
- if (O >= L && m && !M.value) {
312
- await g(), await Y();
308
+ const W = d ?? We(v.value, c.value), R = W.length ? Math.max(...W) : 0, q = t.value.scrollTop + t.value.clientHeight, g = t.value.scrollTop > S + 1;
309
+ S = t.value.scrollTop;
310
+ const o = typeof E == "number" ? E : 200, $ = o >= 0 ? Math.max(0, R - o) : Math.max(0, R + o);
311
+ if (q >= $ && g && !L.value) {
312
+ await b(), await J();
313
313
  return;
314
314
  }
315
315
  }
316
316
  return {
317
- handleScroll: E
317
+ handleScroll: I
318
318
  };
319
319
  }
320
- const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm transition-all duration-300 bg-white relative" }, na = {
320
+ const la = { 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" }, oa = {
321
321
  key: 0,
322
322
  class: "absolute inset-0 flex flex-col items-center justify-center bg-slate-100 text-slate-400 text-sm p-4 text-center"
323
- }, oa = {
323
+ }, ia = {
324
324
  key: 1,
325
325
  class: "relative w-full h-full"
326
- }, la = ["src"], ra = ["src", "autoplay", "controls"], ia = { class: "w-12 h-12 rounded-full bg-white/80 backdrop-blur-sm flex items-center justify-center shadow-sm" }, sa = {
326
+ }, sa = ["src"], ua = ["src", "autoplay", "controls"], va = { class: "w-12 h-12 rounded-full bg-white/80 backdrop-blur-sm flex items-center justify-center shadow-sm" }, ca = {
327
327
  key: 3,
328
328
  class: "absolute bottom-2 left-1/2 transform -translate-x-1/2 flex items-center justify-center z-10"
329
- }, ua = {
329
+ }, fa = {
330
330
  key: 4,
331
331
  class: "absolute inset-0 flex flex-col items-center justify-center bg-slate-50 text-slate-400 text-sm p-4 text-center"
332
- }, Me = /* @__PURE__ */ et({
332
+ }, Me = /* @__PURE__ */ tt({
333
333
  __name: "MasonryItem",
334
334
  props: {
335
335
  item: {},
@@ -342,264 +342,276 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
342
342
  inSwipeMode: { type: Boolean, default: !1 }
343
343
  },
344
344
  emits: ["preload:success", "preload:error", "mouse-enter", "mouse-leave"],
345
- setup(t, { emit: c }) {
346
- const v = t, l = c, M = T(!1), h = T(!1), o = T(null), s = T(!1), g = T(!1), b = T(null), k = T(!1), E = T(!1), f = T(!1), D = T(null), A = T(null);
347
- let O = null;
348
- const m = K(() => {
345
+ setup(t, { emit: v }) {
346
+ const c = t, r = v, L = T(!1), p = T(!1), l = T(null), s = T(!1), b = T(!1), E = T(null), S = T(!1), I = T(!1), d = T(!1), W = T(null), R = T(null);
347
+ let q = null;
348
+ const g = Z(() => {
349
349
  var n;
350
- return v.type ?? ((n = v.item) == null ? void 0 : n.type) ?? "image";
351
- }), r = K(() => {
350
+ return c.type ?? ((n = c.item) == null ? void 0 : n.type) ?? "image";
351
+ }), o = Z(() => {
352
352
  var n;
353
- return v.notFound ?? ((n = v.item) == null ? void 0 : n.notFound) ?? !1;
354
- }), L = K(() => !!v.inSwipeMode);
353
+ return c.notFound ?? ((n = c.item) == null ? void 0 : n.notFound) ?? !1;
354
+ }), $ = Z(() => !!c.inSwipeMode);
355
355
  function y(n) {
356
- l("mouse-enter", { item: v.item, type: n });
356
+ r("mouse-enter", { item: c.item, type: n });
357
357
  }
358
358
  function x(n) {
359
- l("mouse-leave", { item: v.item, type: n });
359
+ r("mouse-leave", { item: c.item, type: n });
360
360
  }
361
- function N(n) {
362
- if (L.value) return;
363
- const w = n.target;
364
- w && (w.paused ? w.play() : w.pause());
361
+ function H(n) {
362
+ if ($.value) return;
363
+ const f = n.target;
364
+ f && (f.paused ? f.play() : f.pause());
365
365
  }
366
- function p(n) {
367
- const w = n.target;
368
- w && (L.value || w.play(), y("video"));
366
+ function h(n) {
367
+ const f = n.target;
368
+ f && ($.value || f.play(), y("video"));
369
369
  }
370
- function z(n) {
371
- const w = n.target;
372
- w && (L.value || w.pause(), x("video"));
370
+ function B(n) {
371
+ const f = n.target;
372
+ f && ($.value || f.pause(), x("video"));
373
373
  }
374
- function H(n) {
375
- return new Promise((w, F) => {
374
+ function w(n) {
375
+ return new Promise((f, P) => {
376
376
  if (!n) {
377
- const W = new Error("No image source provided");
378
- l("preload:error", { item: v.item, type: "image", src: n, error: W }), F(W);
377
+ const N = new Error("No image source provided");
378
+ r("preload:error", { item: c.item, type: "image", src: n, error: N }), P(N);
379
379
  return;
380
380
  }
381
- const $ = new Image(), ae = Date.now(), Q = 300;
382
- $.onload = () => {
383
- const W = Date.now() - ae, U = Math.max(0, Q - W);
381
+ const A = new Image(), U = Date.now(), C = 300;
382
+ A.onload = () => {
383
+ const N = Date.now() - U, oe = Math.max(0, C - N);
384
384
  setTimeout(async () => {
385
- M.value = !0, h.value = !1, E.value = !1, await Y(), await new Promise((_) => setTimeout(_, 100)), f.value = !0, l("preload:success", { item: v.item, type: "image", src: n }), w();
386
- }, U);
387
- }, $.onerror = () => {
388
- h.value = !0, M.value = !1, E.value = !1;
389
- const W = new Error("Failed to load image");
390
- l("preload:error", { item: v.item, type: "image", src: n, error: W }), F(W);
391
- }, $.src = n;
385
+ L.value = !0, p.value = !1, I.value = !1, await J(), await new Promise((ie) => setTimeout(ie, 100)), d.value = !0, r("preload:success", { item: c.item, type: "image", src: n }), f();
386
+ }, oe);
387
+ }, A.onerror = () => {
388
+ p.value = !0, L.value = !1, I.value = !1;
389
+ const N = new Error("Failed to load image");
390
+ r("preload:error", { item: c.item, type: "image", src: n, error: N }), P(N);
391
+ }, A.src = n;
392
392
  });
393
393
  }
394
- function I(n) {
395
- return new Promise((w, F) => {
394
+ function M(n) {
395
+ return new Promise((f, P) => {
396
396
  if (!n) {
397
- const W = new Error("No video source provided");
398
- l("preload:error", { item: v.item, type: "video", src: n, error: W }), F(W);
397
+ const N = new Error("No video source provided");
398
+ r("preload:error", { item: c.item, type: "video", src: n, error: N }), P(N);
399
399
  return;
400
400
  }
401
- const $ = document.createElement("video"), ae = Date.now(), Q = 300;
402
- $.preload = "metadata", $.muted = !0, $.onloadedmetadata = () => {
403
- const W = Date.now() - ae, U = Math.max(0, Q - W);
401
+ const A = document.createElement("video"), U = Date.now(), C = 300;
402
+ A.preload = "metadata", A.muted = !0, A.onloadedmetadata = () => {
403
+ const N = Date.now() - U, oe = Math.max(0, C - N);
404
404
  setTimeout(async () => {
405
- s.value = !0, g.value = !1, E.value = !1, await Y(), await new Promise((_) => setTimeout(_, 100)), f.value = !0, l("preload:success", { item: v.item, type: "video", src: n }), w();
406
- }, U);
407
- }, $.onerror = () => {
408
- g.value = !0, s.value = !1, E.value = !1;
409
- const W = new Error("Failed to load video");
410
- l("preload:error", { item: v.item, type: "video", src: n, error: W }), F(W);
411
- }, $.src = n;
405
+ s.value = !0, b.value = !1, I.value = !1, await J(), await new Promise((ie) => setTimeout(ie, 100)), d.value = !0, r("preload:success", { item: c.item, type: "video", src: n }), f();
406
+ }, oe);
407
+ }, A.onerror = () => {
408
+ b.value = !0, s.value = !1, I.value = !1;
409
+ const N = new Error("Failed to load video");
410
+ r("preload:error", { item: c.item, type: "video", src: n, error: N }), P(N);
411
+ }, A.src = n;
412
412
  });
413
413
  }
414
- async function S() {
415
- var w;
416
- if (!k.value || E.value || r.value || m.value === "video" && s.value || m.value === "image" && M.value)
414
+ async function j() {
415
+ var f;
416
+ if (!S.value || I.value || o.value || g.value === "video" && s.value || g.value === "image" && L.value)
417
417
  return;
418
- const n = (w = v.item) == null ? void 0 : w.src;
418
+ const n = (f = c.item) == null ? void 0 : f.src;
419
419
  if (n)
420
- if (E.value = !0, f.value = !1, m.value === "video") {
421
- b.value = n, s.value = !1, g.value = !1;
420
+ if (I.value = !0, d.value = !1, g.value === "video") {
421
+ E.value = n, s.value = !1, b.value = !1;
422
422
  try {
423
- await I(n);
423
+ await M(n);
424
424
  } catch {
425
425
  }
426
426
  } else {
427
- o.value = n, M.value = !1, h.value = !1;
427
+ l.value = n, L.value = !1, p.value = !1;
428
428
  try {
429
- await H(n);
429
+ await w(n);
430
430
  } catch {
431
431
  }
432
432
  }
433
433
  }
434
- return tt(() => {
435
- D.value && (O = new IntersectionObserver(
434
+ return at(() => {
435
+ W.value && (q = new IntersectionObserver(
436
436
  (n) => {
437
- n.forEach((w) => {
438
- w.isIntersecting && w.intersectionRatio >= 1 ? k.value || (k.value = !0, S()) : w.isIntersecting;
437
+ n.forEach((f) => {
438
+ f.isIntersecting && f.intersectionRatio >= 1 ? S.value || (S.value = !0, j()) : f.isIntersecting;
439
439
  });
440
440
  },
441
441
  {
442
442
  // Only trigger when item is 100% visible (full height in view)
443
443
  threshold: [1]
444
444
  }
445
- ), O.observe(D.value));
446
- }), at(() => {
447
- O && (O.disconnect(), O = null);
448
- }), oe(
445
+ ), q.observe(W.value));
446
+ }), nt(() => {
447
+ q && (q.disconnect(), q = null);
448
+ }), re(
449
449
  () => {
450
450
  var n;
451
- return (n = v.item) == null ? void 0 : n.src;
451
+ return (n = c.item) == null ? void 0 : n.src;
452
452
  },
453
453
  async (n) => {
454
- if (!(!n || r.value)) {
455
- if (m.value === "video") {
456
- if (n !== b.value && (s.value = !1, g.value = !1, b.value = n, k.value)) {
457
- E.value = !0;
454
+ if (!(!n || o.value)) {
455
+ if (g.value === "video") {
456
+ if (n !== E.value && (s.value = !1, b.value = !1, E.value = n, S.value)) {
457
+ I.value = !0;
458
458
  try {
459
- await I(n);
459
+ await M(n);
460
460
  } catch {
461
461
  }
462
462
  }
463
- } else if (n !== o.value && (M.value = !1, h.value = !1, o.value = n, k.value)) {
464
- E.value = !0;
463
+ } else if (n !== l.value && (L.value = !1, p.value = !1, l.value = n, S.value)) {
464
+ I.value = !0;
465
465
  try {
466
- await H(n);
466
+ await w(n);
467
467
  } catch {
468
468
  }
469
469
  }
470
470
  }
471
471
  }
472
- ), oe(
473
- () => v.isActive,
472
+ ), re(
473
+ () => c.isActive,
474
474
  (n) => {
475
- !L.value || !A.value || (n ? A.value.play() : A.value.pause());
475
+ !$.value || !R.value || (n ? R.value.play() : R.value.pause());
476
476
  }
477
- ), (n, w) => (C(), j("div", {
477
+ ), (n, f) => (F(), D("div", {
478
478
  ref_key: "containerRef",
479
- ref: D,
479
+ ref: W,
480
480
  class: "relative w-full h-full flex flex-col"
481
481
  }, [
482
- n.headerHeight > 0 ? (C(), j("div", {
482
+ n.headerHeight > 0 ? (F(), D("div", {
483
483
  key: 0,
484
484
  class: "relative z-10",
485
- style: ye({ height: `${n.headerHeight}px` })
485
+ style: we({ height: `${n.headerHeight}px` })
486
486
  }, [
487
- le(n.$slots, "header", {
487
+ Q(n.$slots, "header", {
488
488
  item: n.item,
489
489
  remove: n.remove,
490
- imageLoaded: M.value,
491
- imageError: h.value,
490
+ imageLoaded: L.value,
491
+ imageError: p.value,
492
492
  videoLoaded: s.value,
493
- videoError: g.value,
494
- showNotFound: r.value,
495
- isLoading: E.value,
496
- mediaType: m.value
493
+ videoError: b.value,
494
+ showNotFound: o.value,
495
+ isLoading: I.value,
496
+ mediaType: g.value
497
497
  })
498
- ], 4)) : ie("", !0),
499
- V("div", ta, [
500
- le(n.$slots, "default", {
498
+ ], 4)) : ne("", !0),
499
+ O("div", la, [
500
+ Q(n.$slots, "default", {
501
501
  item: n.item,
502
502
  remove: n.remove,
503
- imageLoaded: M.value,
504
- imageError: h.value,
503
+ imageLoaded: L.value,
504
+ imageError: p.value,
505
505
  videoLoaded: s.value,
506
- videoError: g.value,
507
- showNotFound: r.value,
508
- isLoading: E.value,
509
- mediaType: m.value,
510
- imageSrc: o.value,
511
- videoSrc: b.value,
512
- showMedia: f.value
506
+ videoError: b.value,
507
+ showNotFound: o.value,
508
+ isLoading: I.value,
509
+ mediaType: g.value,
510
+ imageSrc: l.value,
511
+ videoSrc: E.value,
512
+ showMedia: d.value
513
513
  }, () => [
514
- V("div", aa, [
515
- r.value ? (C(), j("div", na, w[3] || (w[3] = [
516
- V("i", { class: "fas fa-search text-3xl mb-3 opacity-50" }, null, -1),
517
- V("span", { class: "font-medium" }, "Not Found", -1),
518
- V("span", { class: "text-xs mt-1 opacity-75" }, "This item could not be located", -1)
519
- ]))) : (C(), j("div", oa, [
520
- m.value === "image" && o.value ? (C(), j("img", {
514
+ O("div", ra, [
515
+ o.value ? (F(), D("div", oa, f[3] || (f[3] = [
516
+ O("i", { class: "fas fa-search text-3xl mb-3 opacity-50" }, null, -1),
517
+ O("span", { class: "font-medium" }, "Not Found", -1),
518
+ O("span", { class: "text-xs mt-1 opacity-75" }, "This item could not be located", -1)
519
+ ]))) : (F(), D("div", ia, [
520
+ g.value === "image" && l.value ? (F(), D("img", {
521
521
  key: 0,
522
- src: o.value,
523
- class: se([
522
+ src: l.value,
523
+ class: ue([
524
524
  "w-full h-full object-cover transition-opacity duration-700 ease-in-out",
525
- M.value && f.value ? "opacity-100" : "opacity-0"
525
+ L.value && d.value ? "opacity-100" : "opacity-0"
526
526
  ]),
527
527
  style: { position: "absolute", top: "0", left: "0" },
528
528
  loading: "lazy",
529
529
  decoding: "async",
530
530
  alt: "",
531
- onMouseenter: w[0] || (w[0] = (F) => y("image")),
532
- onMouseleave: w[1] || (w[1] = (F) => x("image"))
533
- }, null, 42, la)) : ie("", !0),
534
- m.value === "video" && b.value ? (C(), j("video", {
531
+ onMouseenter: f[0] || (f[0] = (P) => y("image")),
532
+ onMouseleave: f[1] || (f[1] = (P) => x("image"))
533
+ }, null, 42, sa)) : ne("", !0),
534
+ g.value === "video" && E.value ? (F(), D("video", {
535
535
  key: 1,
536
536
  ref_key: "videoEl",
537
- ref: A,
538
- src: b.value,
539
- class: se([
537
+ ref: R,
538
+ src: E.value,
539
+ class: ue([
540
540
  "w-full h-full object-cover transition-opacity duration-700 ease-in-out",
541
- s.value && f.value ? "opacity-100" : "opacity-0"
541
+ s.value && d.value ? "opacity-100" : "opacity-0"
542
542
  ]),
543
543
  style: { position: "absolute", top: "0", left: "0" },
544
544
  muted: "",
545
545
  loop: "",
546
546
  playsinline: "",
547
- autoplay: L.value && v.isActive,
548
- controls: L.value,
549
- onClick: Ye(N, ["stop"]),
550
- onTouchend: Ye(N, ["stop", "prevent"]),
551
- onMouseenter: p,
552
- onMouseleave: z,
553
- onError: w[2] || (w[2] = (F) => g.value = !0)
554
- }, null, 42, ra)) : ie("", !0),
555
- !M.value && !s.value && !h.value && !g.value ? (C(), j("div", {
547
+ autoplay: $.value && c.isActive,
548
+ controls: $.value,
549
+ onClick: _e(H, ["stop"]),
550
+ onTouchend: _e(H, ["stop", "prevent"]),
551
+ onMouseenter: h,
552
+ onMouseleave: B,
553
+ onError: f[2] || (f[2] = (P) => b.value = !0)
554
+ }, null, 42, ua)) : ne("", !0),
555
+ !L.value && !s.value && !p.value && !b.value ? (F(), D("div", {
556
556
  key: 2,
557
- class: se([
557
+ class: ue([
558
558
  "absolute inset-0 bg-slate-100 flex items-center justify-center transition-opacity duration-500",
559
- f.value ? "opacity-0 pointer-events-none" : "opacity-100"
559
+ d.value ? "opacity-0 pointer-events-none" : "opacity-100"
560
560
  ])
561
561
  }, [
562
- V("div", ia, [
563
- V("i", {
564
- class: se(m.value === "video" ? "fas fa-video text-xl text-slate-400" : "fas fa-image text-xl text-slate-400")
562
+ O("div", va, [
563
+ O("i", {
564
+ class: ue(g.value === "video" ? "fas fa-video text-xl text-slate-400" : "fas fa-image text-xl text-slate-400")
565
565
  }, null, 2)
566
566
  ])
567
- ], 2)) : ie("", !0),
568
- E.value ? (C(), j("div", sa, w[4] || (w[4] = [
569
- V("div", { class: "bg-white/90 backdrop-blur-sm rounded-full px-3 py-1.5 shadow-sm" }, [
570
- V("div", { class: "animate-spin rounded-full h-4 w-4 border-b-2 border-blue-500" })
567
+ ], 2)) : ne("", !0),
568
+ I.value ? (F(), D("div", ca, f[4] || (f[4] = [
569
+ O("div", { class: "bg-white/90 backdrop-blur-sm rounded-full px-3 py-1.5 shadow-sm" }, [
570
+ O("div", { class: "animate-spin rounded-full h-4 w-4 border-b-2 border-blue-500" })
571
571
  ], -1)
572
- ]))) : ie("", !0),
573
- m.value === "image" && h.value || m.value === "video" && g.value ? (C(), j("div", ua, [
574
- V("i", {
575
- class: se(m.value === "video" ? "fas fa-video text-2xl mb-2 opacity-50" : "fas fa-image text-2xl mb-2 opacity-50")
572
+ ]))) : ne("", !0),
573
+ g.value === "image" && p.value || g.value === "video" && b.value ? (F(), D("div", fa, [
574
+ O("i", {
575
+ class: ue(g.value === "video" ? "fas fa-video text-2xl mb-2 opacity-50" : "fas fa-image text-2xl mb-2 opacity-50")
576
576
  }, null, 2),
577
- V("span", null, "Failed to load " + bt(m.value), 1)
578
- ])) : ie("", !0)
577
+ O("span", null, "Failed to load " + He(g.value), 1)
578
+ ])) : ne("", !0)
579
579
  ]))
580
580
  ])
581
581
  ])
582
582
  ]),
583
- n.footerHeight > 0 ? (C(), j("div", {
583
+ n.footerHeight > 0 ? (F(), D("div", {
584
584
  key: 1,
585
585
  class: "relative z-10",
586
- style: ye({ height: `${n.footerHeight}px` })
586
+ style: we({ height: `${n.footerHeight}px` })
587
587
  }, [
588
- le(n.$slots, "footer", {
588
+ Q(n.$slots, "footer", {
589
589
  item: n.item,
590
590
  remove: n.remove,
591
- imageLoaded: M.value,
592
- imageError: h.value,
591
+ imageLoaded: L.value,
592
+ imageError: p.value,
593
593
  videoLoaded: s.value,
594
- videoError: g.value,
595
- showNotFound: r.value,
596
- isLoading: E.value,
597
- mediaType: m.value
594
+ videoError: b.value,
595
+ showNotFound: o.value,
596
+ isLoading: I.value,
597
+ mediaType: g.value
598
598
  })
599
- ], 4)) : ie("", !0)
599
+ ], 4)) : ne("", !0)
600
600
  ], 512));
601
601
  }
602
- }), ca = { class: "w-full h-full flex items-center justify-center p-4" }, va = { class: "w-full h-full max-w-full max-h-full relative" }, fa = /* @__PURE__ */ et({
602
+ }), da = { class: "w-full h-full flex items-center justify-center p-4" }, ma = { class: "w-full h-full max-w-full max-h-full relative" }, ha = {
603
+ key: 0,
604
+ class: "w-full py-8 text-center"
605
+ }, ga = {
606
+ key: 1,
607
+ class: "w-full py-8 text-center"
608
+ }, pa = { class: "text-red-500 dark:text-red-400" }, ya = {
609
+ key: 0,
610
+ class: "w-full py-8 text-center"
611
+ }, wa = {
612
+ key: 1,
613
+ class: "w-full py-8 text-center"
614
+ }, ba = { class: "text-red-500 dark:text-red-400" }, xa = /* @__PURE__ */ tt({
603
615
  __name: "Masonry",
604
616
  props: {
605
617
  getNextPage: {
@@ -717,8 +729,8 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
717
729
  "item:mouse-enter",
718
730
  "item:mouse-leave"
719
731
  ],
720
- setup(t, { expose: c, emit: v }) {
721
- const l = t, M = {
732
+ setup(t, { expose: v, emit: c }) {
733
+ const r = t, L = {
722
734
  sizes: { base: 1, sm: 2, md: 3, lg: 4, xl: 5, "2xl": 6 },
723
735
  gutterX: 10,
724
736
  gutterY: 10,
@@ -727,19 +739,19 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
727
739
  paddingLeft: 0,
728
740
  paddingRight: 0,
729
741
  placement: "masonry"
730
- }, h = K(() => {
742
+ }, p = Z(() => {
731
743
  var e;
732
744
  return {
733
- ...M,
734
- ...l.layout,
745
+ ...L,
746
+ ...r.layout,
735
747
  sizes: {
736
- ...M.sizes,
737
- ...((e = l.layout) == null ? void 0 : e.sizes) || {}
748
+ ...L.sizes,
749
+ ...((e = r.layout) == null ? void 0 : e.sizes) || {}
738
750
  }
739
751
  };
740
- }), o = T(null), s = T(typeof window < "u" ? window.innerWidth : 1024), g = T(typeof window < "u" ? window.innerHeight : 768), b = T(null);
741
- let k = null;
742
- function E(e) {
752
+ }), l = T(null), s = T(typeof window < "u" ? window.innerWidth : 1024), b = T(typeof window < "u" ? window.innerHeight : 768), E = T(null);
753
+ let S = null;
754
+ function I(e) {
743
755
  return {
744
756
  sm: 640,
745
757
  md: 768,
@@ -748,47 +760,47 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
748
760
  "2xl": 1536
749
761
  }[e] || 768;
750
762
  }
751
- const f = K(() => {
752
- if (l.layoutMode === "masonry") return !1;
753
- if (l.layoutMode === "swipe") return !0;
754
- const e = typeof l.mobileBreakpoint == "string" ? E(l.mobileBreakpoint) : l.mobileBreakpoint;
763
+ const d = Z(() => {
764
+ if (r.layoutMode === "masonry") return !1;
765
+ if (r.layoutMode === "swipe") return !0;
766
+ const e = typeof r.mobileBreakpoint == "string" ? I(r.mobileBreakpoint) : r.mobileBreakpoint;
755
767
  return s.value < e;
756
- }), D = K(() => {
757
- if (!f.value || r.value.length === 0) return null;
758
- const e = Math.max(0, Math.min(I.value, r.value.length - 1));
759
- return r.value[e] || null;
760
- }), A = K(() => {
761
- if (!f.value || !D.value) return null;
762
- const e = I.value + 1;
763
- return e >= r.value.length ? null : r.value[e] || null;
764
- }), O = K(() => {
765
- if (!f.value || !D.value) return null;
766
- const e = I.value - 1;
767
- return e < 0 ? null : r.value[e] || null;
768
- }), m = v, r = K({
769
- get: () => l.items,
770
- set: (e) => m("update:items", e)
771
- }), L = T(7), y = T(null), x = T([]), N = T(null), p = T(!1), z = T(0), H = K(() => _t(s.value)), I = T(0), S = T(0), n = T(!1), w = T(0), F = T(0), $ = T(null), ae = T(/* @__PURE__ */ new Set());
772
- function Q(e) {
768
+ }), W = Z(() => {
769
+ if (!d.value || o.value.length === 0) return null;
770
+ const e = Math.max(0, Math.min(n.value, o.value.length - 1));
771
+ return o.value[e] || null;
772
+ }), R = Z(() => {
773
+ if (!d.value || !W.value) return null;
774
+ const e = n.value + 1;
775
+ return e >= o.value.length ? null : o.value[e] || null;
776
+ }), q = Z(() => {
777
+ if (!d.value || !W.value) return null;
778
+ const e = n.value - 1;
779
+ return e < 0 ? null : o.value[e] || null;
780
+ }), g = c, o = Z({
781
+ get: () => r.items,
782
+ set: (e) => g("update:items", e)
783
+ }), $ = T(7), y = T(null), x = T([]), H = T(null), h = T(!1), B = T(0), w = T(!1), M = T(null), j = Z(() => Qt(s.value)), n = T(0), f = T(0), P = T(!1), A = T(0), U = T(0), C = T(null), N = T(/* @__PURE__ */ new Set());
784
+ function oe(e) {
773
785
  return typeof e == "number" && Number.isFinite(e) && e > 0;
774
786
  }
775
- function W(e, a) {
787
+ function ie(e, a) {
776
788
  try {
777
789
  if (!Array.isArray(e) || e.length === 0) return;
778
- const i = e.filter((u) => !Q(u == null ? void 0 : u.width) || !Q(u == null ? void 0 : u.height));
790
+ const i = e.filter((u) => !oe(u == null ? void 0 : u.width) || !oe(u == null ? void 0 : u.height));
779
791
  if (i.length === 0) return;
780
- const d = [];
792
+ const m = [];
781
793
  for (const u of i) {
782
- const R = (u == null ? void 0 : u.id) ?? `idx:${e.indexOf(u)}`;
783
- ae.value.has(R) || (ae.value.add(R), d.push(R));
794
+ const Y = (u == null ? void 0 : u.id) ?? `idx:${e.indexOf(u)}`;
795
+ N.value.has(Y) || (N.value.add(Y), m.push(Y));
784
796
  }
785
- if (d.length > 0) {
786
- const u = d.slice(0, 10);
797
+ if (m.length > 0) {
798
+ const u = m.slice(0, 10);
787
799
  console.warn(
788
800
  "[Masonry] Items missing width/height detected:",
789
801
  {
790
802
  context: a,
791
- count: d.length,
803
+ count: m.length,
792
804
  sampleIds: u,
793
805
  hint: "Ensure each item has positive width and height. Consider providing fallbacks (e.g., 512x512) at the data layer."
794
806
  }
@@ -797,451 +809,482 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
797
809
  } catch {
798
810
  }
799
811
  }
800
- const U = T(0), _ = T(0), P = l.virtualBufferPx, B = T(!1), G = T({
812
+ const k = T(0), z = T(0), K = r.virtualBufferPx, G = T(!1), X = T({
801
813
  distanceToTrigger: 0,
802
814
  isNearTrigger: !1
803
- }), X = (e) => {
815
+ }), ee = (e) => {
804
816
  if (!y.value) return;
805
- const { scrollTop: a, clientHeight: i } = y.value, d = a + i, u = e ?? $e(r.value, L.value), R = u.length ? Math.max(...u) : 0, te = typeof l.loadThresholdPx == "number" ? l.loadThresholdPx : 200, ve = te >= 0 ? Math.max(0, R - te) : Math.max(0, R + te), Ve = Math.max(0, ve - d), wt = Ve <= 100;
806
- G.value = {
817
+ const { scrollTop: a, clientHeight: i } = y.value, m = a + i, u = e ?? We(o.value, $.value), Y = u.length ? Math.max(...u) : 0, _ = typeof r.loadThresholdPx == "number" ? r.loadThresholdPx : 200, ce = _ >= 0 ? Math.max(0, Y - _) : Math.max(0, Y + _), Ve = Math.max(0, ce - m), Et = Ve <= 100;
818
+ X.value = {
807
819
  distanceToTrigger: Math.round(Ve),
808
- isNearTrigger: wt
820
+ isNearTrigger: Et
809
821
  };
810
- }, { onEnter: J, onBeforeEnter: ue, onBeforeLeave: Z, onLeave: lt } = Zt(r, { leaveDurationMs: l.leaveDurationMs });
811
- function rt(e, a) {
812
- if (B.value) {
813
- const i = parseInt(e.dataset.left || "0", 10), d = parseInt(e.dataset.top || "0", 10);
814
- e.style.transition = "none", e.style.opacity = "1", e.style.transform = `translate3d(${i}px, ${d}px, 0) scale(1)`, e.style.removeProperty("--masonry-opacity-delay"), requestAnimationFrame(() => {
822
+ }, { onEnter: te, onBeforeEnter: ot, onBeforeLeave: it, onLeave: st } = aa(o, { leaveDurationMs: r.leaveDurationMs });
823
+ function ut(e, a) {
824
+ if (G.value) {
825
+ const i = parseInt(e.dataset.left || "0", 10), m = parseInt(e.dataset.top || "0", 10);
826
+ e.style.transition = "none", e.style.opacity = "1", e.style.transform = `translate3d(${i}px, ${m}px, 0) scale(1)`, e.style.removeProperty("--masonry-opacity-delay"), requestAnimationFrame(() => {
815
827
  e.style.transition = "", a();
816
828
  });
817
829
  } else
818
- J(e, a);
830
+ te(e, a);
819
831
  }
820
- function it(e) {
821
- if (B.value) {
832
+ function vt(e) {
833
+ if (G.value) {
822
834
  const a = parseInt(e.dataset.left || "0", 10), i = parseInt(e.dataset.top || "0", 10);
823
835
  e.style.transition = "none", e.style.opacity = "1", e.style.transform = `translate3d(${a}px, ${i}px, 0) scale(1)`, e.style.removeProperty("--masonry-opacity-delay");
824
836
  } else
825
- ue(e);
837
+ ot(e);
826
838
  }
827
- function st(e) {
828
- B.value || Z(e);
839
+ function ct(e) {
840
+ G.value || it(e);
829
841
  }
830
- function ut(e, a) {
831
- B.value ? a() : lt(e, a);
842
+ function ft(e, a) {
843
+ G.value ? a() : st(e, a);
832
844
  }
833
- const ct = K(() => {
834
- const e = U.value - P, a = U.value + _.value + P, i = r.value;
835
- return !i || i.length === 0 ? [] : i.filter((d) => {
836
- const u = d.top;
837
- return d.top + d.columnHeight >= e && u <= a;
845
+ const dt = Z(() => {
846
+ const e = k.value - K, a = k.value + z.value + K, i = o.value;
847
+ return !i || i.length === 0 ? [] : i.filter((m) => {
848
+ const u = m.top;
849
+ return m.top + m.columnHeight >= e && u <= a;
838
850
  });
839
- }), { handleScroll: vt } = ea({
851
+ }), { handleScroll: mt } = na({
840
852
  container: y,
841
- masonry: r,
842
- columns: L,
843
- containerHeight: z,
844
- isLoading: p,
845
- pageSize: l.pageSize,
846
- refreshLayout: ee,
853
+ masonry: o,
854
+ columns: $,
855
+ containerHeight: B,
856
+ isLoading: h,
857
+ pageSize: r.pageSize,
858
+ refreshLayout: ae,
847
859
  setItemsRaw: (e) => {
848
- r.value = e;
860
+ o.value = e;
849
861
  },
850
- loadNext: ce,
851
- loadThresholdPx: l.loadThresholdPx
862
+ loadNext: ve,
863
+ loadThresholdPx: r.loadThresholdPx
852
864
  });
853
- function ft(e) {
854
- b.value = e, e ? (e.width !== void 0 && (s.value = e.width), e.height !== void 0 && (g.value = e.height), !f.value && y.value && r.value.length > 0 && Y(() => {
855
- L.value = fe(h.value, s.value), ee(r.value), X();
856
- })) : o.value && (s.value = o.value.clientWidth, g.value = o.value.clientHeight);
865
+ function ht(e) {
866
+ E.value = e, e ? (e.width !== void 0 && (s.value = e.width), e.height !== void 0 && (b.value = e.height), !d.value && y.value && o.value.length > 0 && J(() => {
867
+ $.value = fe(p.value, s.value), ae(o.value), ee();
868
+ })) : l.value && (s.value = l.value.clientWidth, b.value = l.value.clientHeight);
857
869
  }
858
- c({
859
- isLoading: p,
860
- refreshLayout: ee,
870
+ v({
871
+ isLoading: h,
872
+ refreshLayout: ae,
861
873
  // Container dimensions (wrapper element)
862
874
  containerWidth: s,
863
- containerHeight: g,
875
+ containerHeight: b,
864
876
  // Masonry content height (for backward compatibility, old containerHeight)
865
- contentHeight: z,
877
+ contentHeight: B,
866
878
  // Current page
867
- currentPage: N,
879
+ currentPage: H,
880
+ // End of list tracking
881
+ hasReachedEnd: w,
882
+ // Load error tracking
883
+ loadError: M,
868
884
  // Set fixed dimensions (overrides ResizeObserver)
869
- setFixedDimensions: ft,
885
+ setFixedDimensions: ht,
870
886
  remove: de,
871
- removeMany: mt,
872
- removeAll: ht,
873
- loadNext: ce,
874
- loadPage: Te,
875
- refreshCurrentPage: Ee,
876
- reset: gt,
877
- init: yt,
887
+ removeMany: pt,
888
+ removeAll: yt,
889
+ loadNext: ve,
890
+ loadPage: Ee,
891
+ refreshCurrentPage: Te,
892
+ reset: bt,
893
+ destroy: xt,
894
+ init: Mt,
878
895
  paginationHistory: x,
879
- cancelLoad: Be,
880
- scrollToTop: De,
881
- totalItems: K(() => r.value.length),
882
- currentBreakpoint: H
896
+ cancelLoad: Le,
897
+ scrollToTop: Be,
898
+ totalItems: Z(() => o.value.length),
899
+ currentBreakpoint: j
883
900
  });
884
- function Ne(e) {
885
- const a = Jt(e);
901
+ function De(e) {
902
+ const a = Zt(e);
886
903
  let i = 0;
887
904
  if (y.value) {
888
- const { scrollTop: d, clientHeight: u } = y.value;
889
- i = d + u + 100;
905
+ const { scrollTop: m, clientHeight: u } = y.value;
906
+ i = m + u + 100;
890
907
  }
891
- z.value = Math.max(a, i);
908
+ B.value = Math.max(a, i);
892
909
  }
893
- function ee(e) {
894
- if (f.value) {
895
- r.value = e;
910
+ function ae(e) {
911
+ if (d.value) {
912
+ o.value = e;
896
913
  return;
897
914
  }
898
915
  if (!y.value) return;
899
- W(e, "refreshLayout");
900
- const a = e.map((d, u) => ({
901
- ...d,
902
- originalIndex: d.originalIndex ?? u
916
+ ie(e, "refreshLayout");
917
+ const a = e.map((m, u) => ({
918
+ ...m,
919
+ originalIndex: m.originalIndex ?? u
903
920
  })), i = y.value;
904
- if (b.value && b.value.width !== void 0) {
905
- const d = i.style.width, u = i.style.boxSizing;
906
- i.style.boxSizing = "border-box", i.style.width = `${b.value.width}px`, i.offsetWidth;
907
- const R = Xe(a, i, L.value, h.value);
908
- i.style.width = d, i.style.boxSizing = u, Ne(R), r.value = R;
921
+ if (E.value && E.value.width !== void 0) {
922
+ const m = i.style.width, u = i.style.boxSizing;
923
+ i.style.boxSizing = "border-box", i.style.width = `${E.value.width}px`, i.offsetWidth;
924
+ const Y = Xe(a, i, $.value, p.value);
925
+ i.style.width = m, i.style.boxSizing = u, De(Y), o.value = Y;
909
926
  } else {
910
- const d = Xe(a, i, L.value, h.value);
911
- Ne(d), r.value = d;
927
+ const m = Xe(a, i, $.value, p.value);
928
+ De(m), o.value = m;
912
929
  }
913
930
  }
914
- function We(e, a) {
931
+ function Fe(e, a) {
915
932
  return new Promise((i) => {
916
- const d = Math.max(0, e | 0), u = Date.now();
917
- a(d, d);
918
- const R = setInterval(() => {
919
- if (q.value) {
920
- clearInterval(R), i();
933
+ const m = Math.max(0, e | 0), u = Date.now();
934
+ a(m, m);
935
+ const Y = setInterval(() => {
936
+ if (V.value) {
937
+ clearInterval(Y), i();
921
938
  return;
922
939
  }
923
- const te = Date.now() - u, ve = Math.max(0, d - te);
924
- a(ve, d), ve <= 0 && (clearInterval(R), i());
940
+ const _ = Date.now() - u, ce = Math.max(0, m - _);
941
+ a(ce, m), ce <= 0 && (clearInterval(Y), i());
925
942
  }, 100);
926
943
  });
927
944
  }
928
- async function we(e) {
945
+ async function be(e) {
929
946
  try {
930
- const a = await dt(() => l.getNextPage(e));
931
- return ee([...r.value, ...a.items]), a;
947
+ const a = await gt(() => r.getNextPage(e));
948
+ return ae([...o.value, ...a.items]), a;
932
949
  } catch (a) {
933
950
  throw console.error("Error in getContent:", a), a;
934
951
  }
935
952
  }
936
- async function dt(e) {
953
+ async function gt(e) {
937
954
  let a = 0;
938
- const i = l.retryMaxAttempts;
939
- let d = l.retryInitialDelayMs;
955
+ const i = r.retryMaxAttempts;
956
+ let m = r.retryInitialDelayMs;
940
957
  for (; ; )
941
958
  try {
942
959
  const u = await e();
943
- return a > 0 && m("retry:stop", { attempt: a, success: !0 }), u;
960
+ return a > 0 && g("retry:stop", { attempt: a, success: !0 }), u;
944
961
  } catch (u) {
945
962
  if (a++, a > i)
946
- throw m("retry:stop", { attempt: a - 1, success: !1 }), u;
947
- m("retry:start", { attempt: a, max: i, totalMs: d }), await We(d, (R, te) => {
948
- m("retry:tick", { attempt: a, remainingMs: R, totalMs: te });
949
- }), d += l.retryBackoffStepMs;
963
+ throw g("retry:stop", { attempt: a - 1, success: !1 }), u;
964
+ g("retry:start", { attempt: a, max: i, totalMs: m }), await Fe(m, (Y, _) => {
965
+ g("retry:tick", { attempt: a, remainingMs: Y, totalMs: _ });
966
+ }), m += r.retryBackoffStepMs;
950
967
  }
951
968
  }
952
- async function Te(e) {
953
- if (!p.value) {
954
- q.value = !1, p.value = !0;
969
+ async function Ee(e) {
970
+ if (!h.value) {
971
+ V.value = !1, h.value = !0, w.value = !1, M.value = null;
955
972
  try {
956
- const a = r.value.length;
957
- if (q.value) return;
958
- const i = await we(e);
959
- return q.value ? void 0 : (N.value = e, x.value.push(i.nextPage), await me(a), i);
973
+ const a = o.value.length;
974
+ if (V.value) return;
975
+ const i = await be(e);
976
+ return V.value ? void 0 : (M.value = null, H.value = e, x.value.push(i.nextPage), i.nextPage == null && (w.value = !0), await he(a), i);
960
977
  } catch (a) {
961
- throw console.error("Error loading page:", a), a;
978
+ throw console.error("Error loading page:", a), M.value = a instanceof Error ? a : new Error(String(a)), a;
962
979
  } finally {
963
- p.value = !1;
980
+ h.value = !1;
964
981
  }
965
982
  }
966
983
  }
967
- async function ce() {
968
- if (!p.value) {
969
- q.value = !1, p.value = !0;
984
+ async function ve() {
985
+ if (!h.value && !w.value) {
986
+ V.value = !1, h.value = !0, M.value = null;
970
987
  try {
971
- const e = r.value.length;
972
- if (q.value) return;
973
- const a = x.value[x.value.length - 1], i = await we(a);
974
- return q.value ? void 0 : (N.value = a, x.value.push(i.nextPage), await me(e), i);
988
+ const e = o.value.length;
989
+ if (V.value) return;
990
+ const a = x.value[x.value.length - 1];
991
+ if (a == null) {
992
+ w.value = !0, h.value = !1;
993
+ return;
994
+ }
995
+ const i = await be(a);
996
+ return V.value ? void 0 : (M.value = null, H.value = a, x.value.push(i.nextPage), i.nextPage == null && (w.value = !0), await he(e), i);
975
997
  } catch (e) {
976
- throw console.error("Error loading next page:", e), e;
998
+ throw console.error("Error loading next page:", e), M.value = e instanceof Error ? e : new Error(String(e)), e;
977
999
  } finally {
978
- p.value = !1;
1000
+ h.value = !1;
979
1001
  }
980
1002
  }
981
1003
  }
982
- async function Ee() {
983
- if (!p.value) {
984
- q.value = !1, p.value = !0;
1004
+ async function Te() {
1005
+ if (!h.value) {
1006
+ V.value = !1, h.value = !0;
985
1007
  try {
986
- const e = N.value;
1008
+ const e = H.value;
987
1009
  if (e == null) {
988
- console.warn("[Masonry] No current page to refresh - currentPage:", N.value, "paginationHistory:", x.value);
1010
+ console.warn("[Masonry] No current page to refresh - currentPage:", H.value, "paginationHistory:", x.value);
989
1011
  return;
990
1012
  }
991
- r.value = [], z.value = 0, x.value = [e], await Y();
992
- const a = await we(e);
993
- if (q.value) return;
994
- N.value = e, x.value.push(a.nextPage);
995
- const i = r.value.length;
996
- return await me(i), a;
1013
+ o.value = [], B.value = 0, w.value = !1, M.value = null, x.value = [e], await J();
1014
+ const a = await be(e);
1015
+ if (V.value) return;
1016
+ M.value = null, H.value = e, x.value.push(a.nextPage), a.nextPage == null && (w.value = !0);
1017
+ const i = o.value.length;
1018
+ return await he(i), a;
997
1019
  } catch (e) {
998
- throw console.error("[Masonry] Error refreshing current page:", e), e;
1020
+ throw console.error("[Masonry] Error refreshing current page:", e), M.value = e instanceof Error ? e : new Error(String(e)), e;
999
1021
  } finally {
1000
- p.value = !1;
1022
+ h.value = !1;
1001
1023
  }
1002
1024
  }
1003
1025
  }
1004
1026
  async function de(e) {
1005
- const a = r.value.filter((i) => i.id !== e.id);
1006
- if (r.value = a, await Y(), a.length === 0 && x.value.length > 0) {
1007
- if (l.autoRefreshOnEmpty)
1008
- await Ee();
1027
+ const a = o.value.filter((i) => i.id !== e.id);
1028
+ if (o.value = a, await J(), a.length === 0 && x.value.length > 0) {
1029
+ if (r.autoRefreshOnEmpty)
1030
+ await Te();
1009
1031
  else
1010
1032
  try {
1011
- await ce(), await me(0, !0);
1033
+ await ve(), await he(0, !0);
1012
1034
  } catch {
1013
1035
  }
1014
1036
  return;
1015
1037
  }
1016
1038
  await new Promise((i) => requestAnimationFrame(() => i())), requestAnimationFrame(() => {
1017
- ee(a);
1039
+ ae(a);
1018
1040
  });
1019
1041
  }
1020
- async function mt(e) {
1042
+ async function pt(e) {
1021
1043
  if (!e || e.length === 0) return;
1022
- const a = new Set(e.map((d) => d.id)), i = r.value.filter((d) => !a.has(d.id));
1023
- if (r.value = i, await Y(), i.length === 0 && x.value.length > 0) {
1024
- if (l.autoRefreshOnEmpty)
1025
- await Ee();
1044
+ const a = new Set(e.map((m) => m.id)), i = o.value.filter((m) => !a.has(m.id));
1045
+ if (o.value = i, await J(), i.length === 0 && x.value.length > 0) {
1046
+ if (r.autoRefreshOnEmpty)
1047
+ await Te();
1026
1048
  else
1027
1049
  try {
1028
- await ce(), await me(0, !0);
1050
+ await ve(), await he(0, !0);
1029
1051
  } catch {
1030
1052
  }
1031
1053
  return;
1032
1054
  }
1033
- await new Promise((d) => requestAnimationFrame(() => d())), requestAnimationFrame(() => {
1034
- ee(i);
1055
+ await new Promise((m) => requestAnimationFrame(() => m())), requestAnimationFrame(() => {
1056
+ ae(i);
1035
1057
  });
1036
1058
  }
1037
- function De(e) {
1059
+ function Be(e) {
1038
1060
  y.value && y.value.scrollTo({
1039
1061
  top: 0,
1040
1062
  behavior: (e == null ? void 0 : e.behavior) ?? "smooth",
1041
1063
  ...e
1042
1064
  });
1043
1065
  }
1044
- async function ht() {
1045
- De({ behavior: "smooth" }), r.value = [], g.value = 0, await Y(), m("remove-all:complete");
1066
+ async function yt() {
1067
+ Be({ behavior: "smooth" }), o.value = [], b.value = 0, await J(), g("remove-all:complete");
1046
1068
  }
1047
- function pt() {
1048
- L.value = fe(h.value, s.value), ee(r.value), y.value && (U.value = y.value.scrollTop, _.value = y.value.clientHeight);
1069
+ function wt() {
1070
+ $.value = fe(p.value, s.value), ae(o.value), y.value && (k.value = y.value.scrollTop, z.value = y.value.clientHeight);
1049
1071
  }
1050
- let be = !1;
1051
- const q = T(!1);
1052
- async function me(e, a = !1) {
1053
- if (!a && !l.backfillEnabled || be || q.value) return;
1054
- const i = (e || 0) + (l.pageSize || 0);
1055
- if (!(!l.pageSize || l.pageSize <= 0 || x.value[x.value.length - 1] == null) && !(r.value.length >= i)) {
1056
- be = !0;
1072
+ let me = !1;
1073
+ const V = T(!1);
1074
+ async function he(e, a = !1) {
1075
+ if (!a && !r.backfillEnabled || me || V.value || w.value) return;
1076
+ const i = (e || 0) + (r.pageSize || 0);
1077
+ if (!r.pageSize || r.pageSize <= 0) return;
1078
+ if (x.value[x.value.length - 1] == null) {
1079
+ w.value = !0;
1080
+ return;
1081
+ }
1082
+ if (!(o.value.length >= i)) {
1083
+ me = !0;
1057
1084
  try {
1058
1085
  let u = 0;
1059
- for (m("backfill:start", { target: i, fetched: r.value.length, calls: u }); r.value.length < i && u < l.backfillMaxCalls && x.value[x.value.length - 1] != null && !q.value && (await We(l.backfillDelayMs, (te, ve) => {
1060
- m("backfill:tick", {
1061
- fetched: r.value.length,
1086
+ for (g("backfill:start", { target: i, fetched: o.value.length, calls: u }); o.value.length < i && u < r.backfillMaxCalls && x.value[x.value.length - 1] != null && !V.value && !w.value && (await Fe(r.backfillDelayMs, (_, ce) => {
1087
+ g("backfill:tick", {
1088
+ fetched: o.value.length,
1062
1089
  target: i,
1063
1090
  calls: u,
1064
- remainingMs: te,
1065
- totalMs: ve
1091
+ remainingMs: _,
1092
+ totalMs: ce
1066
1093
  });
1067
- }), !q.value); ) {
1068
- const R = x.value[x.value.length - 1];
1094
+ }), !V.value); ) {
1095
+ const Y = x.value[x.value.length - 1];
1096
+ if (Y == null) {
1097
+ w.value = !0;
1098
+ break;
1099
+ }
1069
1100
  try {
1070
- p.value = !0;
1071
- const te = await we(R);
1072
- if (q.value) break;
1073
- x.value.push(te.nextPage);
1101
+ h.value = !0;
1102
+ const _ = await be(Y);
1103
+ if (V.value) break;
1104
+ M.value = null, x.value.push(_.nextPage), _.nextPage == null && (w.value = !0);
1105
+ } catch (_) {
1106
+ M.value = _ instanceof Error ? _ : new Error(String(_));
1074
1107
  } finally {
1075
- p.value = !1;
1108
+ h.value = !1;
1076
1109
  }
1077
1110
  u++;
1078
1111
  }
1079
- m("backfill:stop", { fetched: r.value.length, calls: u });
1112
+ g("backfill:stop", { fetched: o.value.length, calls: u });
1080
1113
  } finally {
1081
- be = !1;
1114
+ me = !1;
1082
1115
  }
1083
1116
  }
1084
1117
  }
1085
- function Be() {
1086
- q.value = !0, p.value = !1, be = !1;
1118
+ function Le() {
1119
+ V.value = !0, h.value = !1, me = !1;
1087
1120
  }
1088
- function gt() {
1089
- Be(), q.value = !1, y.value && y.value.scrollTo({
1121
+ function bt() {
1122
+ Le(), V.value = !1, y.value && y.value.scrollTo({
1090
1123
  top: 0,
1091
1124
  behavior: "smooth"
1092
- }), r.value = [], g.value = 0, N.value = l.loadAtPage, x.value = [l.loadAtPage], G.value = {
1125
+ }), o.value = [], b.value = 0, H.value = r.loadAtPage, x.value = [r.loadAtPage], w.value = !1, M.value = null, X.value = {
1093
1126
  distanceToTrigger: 0,
1094
1127
  isNearTrigger: !1
1095
1128
  };
1096
1129
  }
1097
- const re = Qe(async () => {
1098
- if (f.value) return;
1099
- y.value && (U.value = y.value.scrollTop, _.value = y.value.clientHeight), B.value = !0, await Y(), await new Promise((a) => requestAnimationFrame(() => a())), B.value = !1;
1100
- const e = $e(r.value, L.value);
1101
- vt(e), X(e);
1102
- }, 200), ze = Qe(pt, 200);
1103
- function Fe(e) {
1104
- f.value && (n.value = !0, w.value = e.touches[0].clientY, F.value = S.value, e.preventDefault());
1130
+ function xt() {
1131
+ Le(), o.value = [], B.value = 0, H.value = null, x.value = [], w.value = !1, M.value = null, h.value = !1, me = !1, V.value = !1, n.value = 0, f.value = 0, P.value = !1, k.value = 0, z.value = 0, G.value = !1, X.value = {
1132
+ distanceToTrigger: 0,
1133
+ isNearTrigger: !1
1134
+ }, N.value.clear(), y.value && y.value.scrollTo({
1135
+ top: 0,
1136
+ behavior: "auto"
1137
+ // Instant scroll for destroy
1138
+ });
1105
1139
  }
1140
+ const se = Ze(async () => {
1141
+ if (d.value) return;
1142
+ y.value && (k.value = y.value.scrollTop, z.value = y.value.clientHeight), G.value = !0, await J(), await new Promise((a) => requestAnimationFrame(() => a())), G.value = !1;
1143
+ const e = We(o.value, $.value);
1144
+ mt(e), ee(e);
1145
+ }, 200), ze = Ze(wt, 200);
1106
1146
  function Ae(e) {
1107
- if (!f.value || !n.value) return;
1108
- const a = e.touches[0].clientY - w.value;
1109
- S.value = F.value + a, e.preventDefault();
1147
+ d.value && (P.value = !0, A.value = e.touches[0].clientY, U.value = f.value, e.preventDefault());
1110
1148
  }
1111
1149
  function Oe(e) {
1112
- if (!f.value || !n.value) return;
1113
- n.value = !1;
1114
- const a = S.value - F.value;
1115
- Math.abs(a) > 100 ? a > 0 && O.value ? Ce() : a < 0 && A.value ? je() : ne() : ne(), e.preventDefault();
1150
+ if (!d.value || !P.value) return;
1151
+ const a = e.touches[0].clientY - A.value;
1152
+ f.value = U.value + a, e.preventDefault();
1116
1153
  }
1117
1154
  function Re(e) {
1118
- f.value && (n.value = !0, w.value = e.clientY, F.value = S.value, e.preventDefault());
1155
+ if (!d.value || !P.value) return;
1156
+ P.value = !1;
1157
+ const a = f.value - U.value;
1158
+ Math.abs(a) > 100 ? a > 0 && q.value ? Ye() : a < 0 && R.value ? Ce() : le() : le(), e.preventDefault();
1119
1159
  }
1120
- function Le(e) {
1121
- if (!f.value || !n.value) return;
1122
- const a = e.clientY - w.value;
1123
- S.value = F.value + a, e.preventDefault();
1160
+ function je(e) {
1161
+ d.value && (P.value = !0, A.value = e.clientY, U.value = f.value, e.preventDefault());
1162
+ }
1163
+ function ke(e) {
1164
+ if (!d.value || !P.value) return;
1165
+ const a = e.clientY - A.value;
1166
+ f.value = U.value + a, e.preventDefault();
1124
1167
  }
1125
1168
  function Ie(e) {
1126
- if (!f.value || !n.value) return;
1127
- n.value = !1;
1128
- const a = S.value - F.value;
1129
- Math.abs(a) > 100 ? a > 0 && O.value ? Ce() : a < 0 && A.value ? je() : ne() : ne(), e.preventDefault();
1169
+ if (!d.value || !P.value) return;
1170
+ P.value = !1;
1171
+ const a = f.value - U.value;
1172
+ Math.abs(a) > 100 ? a > 0 && q.value ? Ye() : a < 0 && R.value ? Ce() : le() : le(), e.preventDefault();
1130
1173
  }
1131
- function je() {
1132
- if (!A.value) {
1133
- ce();
1174
+ function Ce() {
1175
+ if (!R.value) {
1176
+ ve();
1134
1177
  return;
1135
1178
  }
1136
- I.value++, ne(), I.value >= r.value.length - 5 && ce();
1179
+ n.value++, le(), n.value >= o.value.length - 5 && ve();
1137
1180
  }
1138
- function Ce() {
1139
- O.value && (I.value--, ne());
1181
+ function Ye() {
1182
+ q.value && (n.value--, le());
1140
1183
  }
1141
- function ne() {
1142
- if (!$.value) return;
1143
- const e = $.value.clientHeight;
1144
- S.value = -I.value * e;
1184
+ function le() {
1185
+ if (!C.value) return;
1186
+ const e = C.value.clientHeight;
1187
+ f.value = -n.value * e;
1145
1188
  }
1146
1189
  function qe() {
1147
- !f.value && I.value > 0 && (I.value = 0, S.value = 0), f.value && r.value.length === 0 && !p.value && Te(x.value[0]), f.value && ne();
1190
+ !d.value && n.value > 0 && (n.value = 0, f.value = 0), d.value && o.value.length === 0 && !h.value && Ee(x.value[0]), d.value && le();
1148
1191
  }
1149
- function yt(e, a, i) {
1150
- N.value = a, x.value = [a], x.value.push(i), W(e, "init"), f.value ? (r.value = [...r.value, ...e], I.value === 0 && r.value.length > 0 && (S.value = 0)) : (ee([...r.value, ...e]), X());
1192
+ function Mt(e, a, i) {
1193
+ H.value = a, x.value = [a], x.value.push(i), w.value = i == null, ie(e, "init"), d.value ? (o.value = [...o.value, ...e], n.value === 0 && o.value.length > 0 && (f.value = 0)) : (ae([...o.value, ...e]), ee());
1151
1194
  }
1152
- return oe(
1153
- h,
1195
+ return re(
1196
+ p,
1154
1197
  () => {
1155
- f.value || y.value && (L.value = fe(h.value, s.value), ee(r.value));
1198
+ d.value || y.value && ($.value = fe(p.value, s.value), ae(o.value));
1156
1199
  },
1157
1200
  { deep: !0 }
1158
- ), oe(() => l.layoutMode, () => {
1159
- b.value && b.value.width !== void 0 ? s.value = b.value.width : o.value && (s.value = o.value.clientWidth);
1160
- }), oe(y, (e) => {
1161
- e && !f.value ? (e.removeEventListener("scroll", re), e.addEventListener("scroll", re, { passive: !0 })) : e && e.removeEventListener("scroll", re);
1162
- }, { immediate: !0 }), oe(f, (e, a) => {
1163
- a === void 0 && e === !1 || Y(() => {
1164
- e ? (document.addEventListener("mousemove", Le), document.addEventListener("mouseup", Ie), y.value && y.value.removeEventListener("scroll", re), I.value = 0, S.value = 0, r.value.length > 0 && ne()) : (document.removeEventListener("mousemove", Le), document.removeEventListener("mouseup", Ie), y.value && o.value && (b.value && b.value.width !== void 0 ? s.value = b.value.width : s.value = o.value.clientWidth, y.value.removeEventListener("scroll", re), y.value.addEventListener("scroll", re, { passive: !0 }), r.value.length > 0 && (L.value = fe(h.value, s.value), ee(r.value), U.value = y.value.scrollTop, _.value = y.value.clientHeight, X())));
1201
+ ), re(() => r.layoutMode, () => {
1202
+ E.value && E.value.width !== void 0 ? s.value = E.value.width : l.value && (s.value = l.value.clientWidth);
1203
+ }), re(y, (e) => {
1204
+ e && !d.value ? (e.removeEventListener("scroll", se), e.addEventListener("scroll", se, { passive: !0 })) : e && e.removeEventListener("scroll", se);
1205
+ }, { immediate: !0 }), re(d, (e, a) => {
1206
+ a === void 0 && e === !1 || J(() => {
1207
+ e ? (document.addEventListener("mousemove", ke), document.addEventListener("mouseup", Ie), y.value && y.value.removeEventListener("scroll", se), n.value = 0, f.value = 0, o.value.length > 0 && le()) : (document.removeEventListener("mousemove", ke), document.removeEventListener("mouseup", Ie), y.value && l.value && (E.value && E.value.width !== void 0 ? s.value = E.value.width : s.value = l.value.clientWidth, y.value.removeEventListener("scroll", se), y.value.addEventListener("scroll", se, { passive: !0 }), o.value.length > 0 && ($.value = fe(p.value, s.value), ae(o.value), k.value = y.value.scrollTop, z.value = y.value.clientHeight, ee())));
1165
1208
  });
1166
- }, { immediate: !0 }), oe($, (e) => {
1167
- e && (e.addEventListener("touchstart", Fe, { passive: !1 }), e.addEventListener("touchmove", Ae, { passive: !1 }), e.addEventListener("touchend", Oe), e.addEventListener("mousedown", Re));
1168
- }), oe(() => r.value.length, (e, a) => {
1169
- f.value && e > 0 && a === 0 && (I.value = 0, Y(() => ne()));
1170
- }), oe(o, (e) => {
1171
- k && (k.disconnect(), k = null), e && typeof ResizeObserver < "u" ? (k = new ResizeObserver((a) => {
1172
- if (!b.value)
1209
+ }, { immediate: !0 }), re(C, (e) => {
1210
+ e && (e.addEventListener("touchstart", Ae, { passive: !1 }), e.addEventListener("touchmove", Oe, { passive: !1 }), e.addEventListener("touchend", Re), e.addEventListener("mousedown", je));
1211
+ }), re(() => o.value.length, (e, a) => {
1212
+ d.value && e > 0 && a === 0 && (n.value = 0, J(() => le()));
1213
+ }), re(l, (e) => {
1214
+ S && (S.disconnect(), S = null), e && typeof ResizeObserver < "u" ? (S = new ResizeObserver((a) => {
1215
+ if (!E.value)
1173
1216
  for (const i of a) {
1174
- const d = i.contentRect.width, u = i.contentRect.height;
1175
- s.value !== d && (s.value = d), g.value !== u && (g.value = u);
1217
+ const m = i.contentRect.width, u = i.contentRect.height;
1218
+ s.value !== m && (s.value = m), b.value !== u && (b.value = u);
1176
1219
  }
1177
- }), k.observe(e), b.value || (s.value = e.clientWidth, g.value = e.clientHeight)) : e && (b.value || (s.value = e.clientWidth, g.value = e.clientHeight));
1178
- }, { immediate: !0 }), oe(s, (e, a) => {
1179
- e !== a && e > 0 && !f.value && y.value && r.value.length > 0 && Y(() => {
1180
- L.value = fe(h.value, e), ee(r.value), X();
1220
+ }), S.observe(e), E.value || (s.value = e.clientWidth, b.value = e.clientHeight)) : e && (E.value || (s.value = e.clientWidth, b.value = e.clientHeight));
1221
+ }, { immediate: !0 }), re(s, (e, a) => {
1222
+ e !== a && e > 0 && !d.value && y.value && o.value.length > 0 && J(() => {
1223
+ $.value = fe(p.value, e), ae(o.value), ee();
1181
1224
  });
1182
- }), tt(async () => {
1225
+ }), at(async () => {
1183
1226
  try {
1184
- await Y(), o.value && !k && (s.value = o.value.clientWidth, g.value = o.value.clientHeight), f.value || (L.value = fe(h.value, s.value), y.value && (U.value = y.value.scrollTop, _.value = y.value.clientHeight));
1185
- const e = l.loadAtPage;
1186
- x.value = [e], l.skipInitialLoad || await Te(x.value[0]), f.value ? Y(() => ne()) : X();
1227
+ await J(), l.value && !S && (s.value = l.value.clientWidth, b.value = l.value.clientHeight), d.value || ($.value = fe(p.value, s.value), y.value && (k.value = y.value.scrollTop, z.value = y.value.clientHeight));
1228
+ const e = r.loadAtPage;
1229
+ x.value = [e], r.skipInitialLoad || await Ee(x.value[0]), d.value ? J(() => le()) : ee();
1187
1230
  } catch (e) {
1188
- console.error("Error during component initialization:", e), p.value = !1;
1231
+ console.error("Error during component initialization:", e), h.value = !1;
1189
1232
  }
1190
1233
  window.addEventListener("resize", ze), window.addEventListener("resize", qe);
1191
- }), at(() => {
1234
+ }), nt(() => {
1192
1235
  var e;
1193
- k && (k.disconnect(), k = null), (e = y.value) == null || e.removeEventListener("scroll", re), window.removeEventListener("resize", ze), window.removeEventListener("resize", qe), $.value && ($.value.removeEventListener("touchstart", Fe), $.value.removeEventListener("touchmove", Ae), $.value.removeEventListener("touchend", Oe), $.value.removeEventListener("mousedown", Re)), document.removeEventListener("mousemove", Le), document.removeEventListener("mouseup", Ie);
1194
- }), (e, a) => (C(), j("div", {
1236
+ S && (S.disconnect(), S = null), (e = y.value) == null || e.removeEventListener("scroll", se), window.removeEventListener("resize", ze), window.removeEventListener("resize", qe), C.value && (C.value.removeEventListener("touchstart", Ae), C.value.removeEventListener("touchmove", Oe), C.value.removeEventListener("touchend", Re), C.value.removeEventListener("mousedown", je)), document.removeEventListener("mousemove", ke), document.removeEventListener("mouseup", Ie);
1237
+ }), (e, a) => (F(), D("div", {
1195
1238
  ref_key: "wrapper",
1196
- ref: o,
1239
+ ref: l,
1197
1240
  class: "w-full h-full flex flex-col relative"
1198
1241
  }, [
1199
- f.value ? (C(), j("div", {
1242
+ d.value ? (F(), D("div", {
1200
1243
  key: 0,
1201
- class: se(["overflow-hidden w-full flex-1 swipe-container touch-none select-none", { "force-motion": l.forceMotion, "cursor-grab": !n.value, "cursor-grabbing": n.value }]),
1244
+ class: ue(["overflow-hidden w-full flex-1 swipe-container touch-none select-none", { "force-motion": r.forceMotion, "cursor-grab": !P.value, "cursor-grabbing": P.value }]),
1202
1245
  ref_key: "swipeContainer",
1203
- ref: $,
1246
+ ref: C,
1204
1247
  style: { height: "100%", "max-height": "100%", position: "relative" }
1205
1248
  }, [
1206
- V("div", {
1249
+ O("div", {
1207
1250
  class: "relative w-full",
1208
- style: ye({
1209
- transform: `translateY(${S.value}px)`,
1210
- transition: n.value ? "none" : `transform ${t.transitionDurationMs}ms ${t.transitionEasing}`,
1211
- height: `${r.value.length * 100}%`
1251
+ style: we({
1252
+ transform: `translateY(${f.value}px)`,
1253
+ transition: P.value ? "none" : `transform ${t.transitionDurationMs}ms ${t.transitionEasing}`,
1254
+ height: `${o.value.length * 100}%`
1212
1255
  })
1213
1256
  }, [
1214
- (C(!0), j(Ue, null, Ge(r.value, (i, d) => (C(), j("div", {
1257
+ (F(!0), D(Ue, null, Ge(o.value, (i, m) => (F(), D("div", {
1215
1258
  key: `${i.page}-${i.id}`,
1216
1259
  class: "absolute top-0 left-0 w-full",
1217
- style: ye({
1218
- top: `${d * (100 / r.value.length)}%`,
1219
- height: `${100 / r.value.length}%`
1260
+ style: we({
1261
+ top: `${m * (100 / o.value.length)}%`,
1262
+ height: `${100 / o.value.length}%`
1220
1263
  })
1221
1264
  }, [
1222
- V("div", ca, [
1223
- V("div", va, [
1224
- le(e.$slots, "default", {
1265
+ O("div", da, [
1266
+ O("div", ma, [
1267
+ Q(e.$slots, "default", {
1225
1268
  item: i,
1226
1269
  remove: de
1227
1270
  }, () => [
1228
- ke(Me, {
1271
+ $e(Me, {
1229
1272
  item: i,
1230
1273
  remove: de,
1231
- "header-height": h.value.header,
1232
- "footer-height": h.value.footer,
1274
+ "header-height": p.value.header,
1275
+ "footer-height": p.value.footer,
1233
1276
  "in-swipe-mode": !0,
1234
- "is-active": d === I.value,
1235
- "onPreload:success": a[0] || (a[0] = (u) => m("item:preload:success", u)),
1236
- "onPreload:error": a[1] || (a[1] = (u) => m("item:preload:error", u)),
1237
- onMouseEnter: a[2] || (a[2] = (u) => m("item:mouse-enter", u)),
1238
- onMouseLeave: a[3] || (a[3] = (u) => m("item:mouse-leave", u))
1277
+ "is-active": m === n.value,
1278
+ "onPreload:success": a[0] || (a[0] = (u) => g("item:preload:success", u)),
1279
+ "onPreload:error": a[1] || (a[1] = (u) => g("item:preload:error", u)),
1280
+ onMouseEnter: a[2] || (a[2] = (u) => g("item:mouse-enter", u)),
1281
+ onMouseLeave: a[3] || (a[3] = (u) => g("item:mouse-leave", u))
1239
1282
  }, {
1240
- header: he((u) => [
1241
- le(e.$slots, "item-header", pe({ ref_for: !0 }, u), void 0, !0)
1283
+ header: ge((u) => [
1284
+ Q(e.$slots, "item-header", pe({ ref_for: !0 }, u), void 0, !0)
1242
1285
  ]),
1243
- footer: he((u) => [
1244
- le(e.$slots, "item-footer", pe({ ref_for: !0 }, u), void 0, !0)
1286
+ footer: ge((u) => [
1287
+ Q(e.$slots, "item-footer", pe({ ref_for: !0 }, u), void 0, !0)
1245
1288
  ]),
1246
1289
  _: 2
1247
1290
  }, 1032, ["item", "header-height", "footer-height", "is-active"])
@@ -1249,52 +1292,62 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
1249
1292
  ])
1250
1293
  ])
1251
1294
  ], 4))), 128))
1252
- ], 4)
1253
- ], 2)) : (C(), j("div", {
1295
+ ], 4),
1296
+ w.value && o.value.length > 0 ? (F(), D("div", ha, [
1297
+ Q(e.$slots, "end-message", {}, () => [
1298
+ a[8] || (a[8] = O("p", { class: "text-gray-500 dark:text-gray-400" }, "You've reached the end", -1))
1299
+ ], !0)
1300
+ ])) : ne("", !0),
1301
+ M.value && o.value.length > 0 ? (F(), D("div", ga, [
1302
+ Q(e.$slots, "error-message", { error: M.value }, () => [
1303
+ O("p", pa, "Failed to load content: " + He(M.value.message), 1)
1304
+ ], !0)
1305
+ ])) : ne("", !0)
1306
+ ], 2)) : (F(), D("div", {
1254
1307
  key: 1,
1255
- class: se(["overflow-auto w-full flex-1 masonry-container", { "force-motion": l.forceMotion }]),
1308
+ class: ue(["overflow-auto w-full flex-1 masonry-container", { "force-motion": r.forceMotion }]),
1256
1309
  ref_key: "container",
1257
1310
  ref: y
1258
1311
  }, [
1259
- V("div", {
1312
+ O("div", {
1260
1313
  class: "relative",
1261
- style: ye({ height: `${z.value}px`, "--masonry-duration": `${t.transitionDurationMs}ms`, "--masonry-leave-duration": `${t.leaveDurationMs}ms`, "--masonry-ease": t.transitionEasing })
1314
+ style: we({ height: `${B.value}px`, "--masonry-duration": `${t.transitionDurationMs}ms`, "--masonry-leave-duration": `${t.leaveDurationMs}ms`, "--masonry-ease": t.transitionEasing })
1262
1315
  }, [
1263
- ke(xt, {
1316
+ $e(Tt, {
1264
1317
  name: "masonry",
1265
1318
  css: !1,
1266
- onEnter: rt,
1267
- onBeforeEnter: it,
1268
- onLeave: ut,
1269
- onBeforeLeave: st
1319
+ onEnter: ut,
1320
+ onBeforeEnter: vt,
1321
+ onLeave: ft,
1322
+ onBeforeLeave: ct
1270
1323
  }, {
1271
- default: he(() => [
1272
- (C(!0), j(Ue, null, Ge(ct.value, (i, d) => (C(), j("div", pe({
1324
+ default: ge(() => [
1325
+ (F(!0), D(Ue, null, Ge(dt.value, (i, m) => (F(), D("div", pe({
1273
1326
  key: `${i.page}-${i.id}`,
1274
1327
  class: "absolute masonry-item",
1275
1328
  ref_for: !0
1276
- }, Mt(Qt)(i, d)), [
1277
- le(e.$slots, "default", {
1329
+ }, Lt(ta)(i, m)), [
1330
+ Q(e.$slots, "default", {
1278
1331
  item: i,
1279
1332
  remove: de
1280
1333
  }, () => [
1281
- ke(Me, {
1334
+ $e(Me, {
1282
1335
  item: i,
1283
1336
  remove: de,
1284
- "header-height": h.value.header,
1285
- "footer-height": h.value.footer,
1337
+ "header-height": p.value.header,
1338
+ "footer-height": p.value.footer,
1286
1339
  "in-swipe-mode": !1,
1287
1340
  "is-active": !1,
1288
- "onPreload:success": a[4] || (a[4] = (u) => m("item:preload:success", u)),
1289
- "onPreload:error": a[5] || (a[5] = (u) => m("item:preload:error", u)),
1290
- onMouseEnter: a[6] || (a[6] = (u) => m("item:mouse-enter", u)),
1291
- onMouseLeave: a[7] || (a[7] = (u) => m("item:mouse-leave", u))
1341
+ "onPreload:success": a[4] || (a[4] = (u) => g("item:preload:success", u)),
1342
+ "onPreload:error": a[5] || (a[5] = (u) => g("item:preload:error", u)),
1343
+ onMouseEnter: a[6] || (a[6] = (u) => g("item:mouse-enter", u)),
1344
+ onMouseLeave: a[7] || (a[7] = (u) => g("item:mouse-leave", u))
1292
1345
  }, {
1293
- header: he((u) => [
1294
- le(e.$slots, "item-header", pe({ ref_for: !0 }, u), void 0, !0)
1346
+ header: ge((u) => [
1347
+ Q(e.$slots, "item-header", pe({ ref_for: !0 }, u), void 0, !0)
1295
1348
  ]),
1296
- footer: he((u) => [
1297
- le(e.$slots, "item-footer", pe({ ref_for: !0 }, u), void 0, !0)
1349
+ footer: ge((u) => [
1350
+ Q(e.$slots, "item-footer", pe({ ref_for: !0 }, u), void 0, !0)
1298
1351
  ]),
1299
1352
  _: 2
1300
1353
  }, 1032, ["item", "header-height", "footer-height"])
@@ -1303,22 +1356,32 @@ const ta = { class: "flex-1 relative min-h-0" }, aa = { class: "w-full h-full ro
1303
1356
  ]),
1304
1357
  _: 3
1305
1358
  })
1306
- ], 4)
1359
+ ], 4),
1360
+ w.value && o.value.length > 0 ? (F(), D("div", ya, [
1361
+ Q(e.$slots, "end-message", {}, () => [
1362
+ a[9] || (a[9] = O("p", { class: "text-gray-500 dark:text-gray-400" }, "You've reached the end", -1))
1363
+ ], !0)
1364
+ ])) : ne("", !0),
1365
+ M.value && o.value.length > 0 ? (F(), D("div", wa, [
1366
+ Q(e.$slots, "error-message", { error: M.value }, () => [
1367
+ O("p", ba, "Failed to load content: " + He(M.value.message), 1)
1368
+ ], !0)
1369
+ ])) : ne("", !0)
1307
1370
  ], 2))
1308
1371
  ], 512));
1309
1372
  }
1310
- }), da = (t, c) => {
1311
- const v = t.__vccOpts || t;
1312
- for (const [l, M] of c)
1313
- v[l] = M;
1314
- return v;
1315
- }, Ze = /* @__PURE__ */ da(fa, [["__scopeId", "data-v-ce6222b3"]]), ha = {
1373
+ }), Ma = (t, v) => {
1374
+ const c = t.__vccOpts || t;
1375
+ for (const [r, L] of v)
1376
+ c[r] = L;
1377
+ return c;
1378
+ }, et = /* @__PURE__ */ Ma(xa, [["__scopeId", "data-v-01598521"]]), Ta = {
1316
1379
  install(t) {
1317
- t.component("WyxosMasonry", Ze), t.component("WMasonry", Ze), t.component("WyxosMasonryItem", Me), t.component("WMasonryItem", Me);
1380
+ t.component("WyxosMasonry", et), t.component("WMasonry", et), t.component("WyxosMasonryItem", Me), t.component("WMasonryItem", Me);
1318
1381
  }
1319
1382
  };
1320
1383
  export {
1321
- Ze as Masonry,
1384
+ et as Masonry,
1322
1385
  Me as MasonryItem,
1323
- ha as default
1386
+ Ta as default
1324
1387
  };