@wyxos/vibe 1.6.14 → 1.6.16

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