vue-virtual-flow 0.0.6 → 0.0.7

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.
@@ -1,51 +1,51 @@
1
- import { watch as ee, defineComponent as xe, ref as W, computed as n, nextTick as O, onMounted as Se, onUpdated as Ce, onBeforeUnmount as Ie, openBlock as S, createElementBlock as I, normalizeStyle as C, createElementVNode as De, renderSlot as ne, createTextVNode as Me, createCommentVNode as me, Fragment as we, renderList as ze, unref as u, normalizeClass as Ee, toDisplayString as Ve } from "vue";
2
- function Ae(l) {
3
- return typeof l == "string" || typeof l == "number" || typeof l == "symbol";
1
+ import { watch as le, defineComponent as $e, ref as P, computed as i, nextTick as O, onMounted as ke, onUpdated as Ae, onBeforeUnmount as Le, openBlock as x, createElementBlock as T, normalizeStyle as C, createElementVNode as De, renderSlot as ie, createTextVNode as Ie, createCommentVNode as xe, Fragment as ze, renderList as Ee, unref as c, normalizeClass as Be, toDisplayString as Oe } from "vue";
2
+ function Ye(a) {
3
+ return typeof a == "string" || typeof a == "number" || typeof a == "symbol";
4
4
  }
5
- function Ke(l, _) {
6
- const V = l[_];
7
- return Ae(V) ? V : void 0;
5
+ function Pe(a, _) {
6
+ const E = a[_];
7
+ return Ye(E) ? E : void 0;
8
8
  }
9
- function Fe(l) {
10
- return Ke(l, "id") ?? Ke(l, "key");
9
+ function _e(a) {
10
+ return Pe(a, "id") ?? Pe(a, "key");
11
11
  }
12
- function $e(l) {
13
- function _(e, x) {
14
- const h = l.itemKey();
15
- if (typeof h == "function")
16
- return h(e, x);
12
+ function He(a) {
13
+ function _(e, y) {
14
+ const f = a.itemKey();
15
+ if (typeof f == "function")
16
+ return f(e, y);
17
17
  if (e !== null && typeof e == "object") {
18
- if (h !== void 0) {
19
- const s = Ke(e, h);
20
- if (s !== void 0) return s;
18
+ if (f !== void 0) {
19
+ const r = Pe(e, f);
20
+ if (r !== void 0) return r;
21
21
  }
22
- const z = Fe(e);
23
- if (z !== void 0) return z;
22
+ const S = _e(e);
23
+ if (S !== void 0) return S;
24
24
  }
25
- return x;
25
+ return y;
26
26
  }
27
- function V() {
27
+ function E() {
28
28
  }
29
- return ee(
30
- () => [l.itemKey(), l.items()],
31
- V,
29
+ return le(
30
+ () => [a.itemKey(), a.items()],
31
+ E,
32
32
  { immediate: !0 }
33
33
  ), { getItemKey: _ };
34
34
  }
35
- function He(l) {
36
- return l === "fill" ? "100%" : typeof l == "number" ? `${l}px` : l;
35
+ function Ve(a) {
36
+ return a === "fill" ? "100%" : typeof a == "number" ? `${a}px` : a;
37
37
  }
38
- function Re(l) {
39
- return (_, V) => {
40
- typeof V == "string" && (V === "fill" || V.trim().endsWith("%"));
38
+ function Ce(a) {
39
+ return (_, E) => {
40
+ typeof E == "string" && (E === "fill" || E.trim().endsWith("%"));
41
41
  };
42
42
  }
43
- const We = ["aria-label"], Ne = {
43
+ const Ge = ["aria-label"], je = {
44
44
  key: 0,
45
45
  class: "vue-chat-virtual-scroll__loading-older",
46
46
  role: "status",
47
47
  "aria-live": "polite"
48
- }, Ye = ["aria-posinset", "aria-setsize"], _e = /* @__PURE__ */ xe({
48
+ }, Ue = ["aria-posinset", "aria-setsize"], Ze = /* @__PURE__ */ $e({
49
49
  name: "ChatVirtualScroll",
50
50
  __name: "ChatVirtualScroll",
51
51
  props: {
@@ -64,302 +64,343 @@ const We = ["aria-label"], Ne = {
64
64
  loadOlderThreshold: { default: 120 }
65
65
  },
66
66
  emits: ["scroll", "loadOlder", "bottomChange"],
67
- setup(l, { expose: _, emit: V }) {
68
- const e = l, x = V, h = W(), z = W(0), s = W(0), R = W(0), N = W(!0), A = /* @__PURE__ */ new Map(), Y = /* @__PURE__ */ new Map();
69
- let j, T, E = -1, L = !1;
70
- const B = Re(), { getItemKey: D } = $e({
67
+ setup(a, { expose: _, emit: E }) {
68
+ const e = a, y = E, f = P(), S = P(0), r = P(0), H = P(0), U = P(0), F = P(!0), W = /* @__PURE__ */ new Map(), Z = /* @__PURE__ */ new Map();
69
+ let L, p, I = -1, w = !1, A = !1, V = !1, N, K = 0, ee = !1, $ = 0;
70
+ const X = Ce(), { getItemKey: B } = He({
71
71
  componentName: "ChatVirtualScroll",
72
72
  items: () => e.items,
73
73
  itemKey: () => e.itemKey
74
- }), P = n(
74
+ }), q = i(
75
75
  () => Math.max(1, e.estimatedItemSize)
76
- ), G = n(() => Math.max(0, Math.floor(e.overscan))), te = n(
76
+ ), ae = i(() => Math.max(0, Math.floor(e.overscan))), he = i(
77
77
  () => e.size !== void 0 && Number.isFinite(e.size) && e.size > 0 ? Math.max(1, Math.floor(e.size)) : void 0
78
- ), le = n(() => s.value > 0 ? s.value : typeof e.height == "number" ? Math.max(0, e.height) : P.value), w = n(() => {
79
- R.value;
80
- const i = new Array(e.items.length + 1), d = new Array(e.items.length);
81
- i[0] = 0;
82
- for (let r = 0; r < e.items.length; r += 1) {
83
- const M = D(e.items[r], r), g = A.get(M) ?? P.value;
84
- d[r] = g, i[r + 1] = i[r] + g;
78
+ ), oe = i(() => H.value > 0 ? H.value : typeof e.height == "number" ? Math.max(0, e.height) : q.value), v = i(() => {
79
+ U.value;
80
+ const t = new Array(e.items.length + 1), n = new Array(e.items.length);
81
+ t[0] = 0;
82
+ for (let u = 0; u < e.items.length; u += 1) {
83
+ const g = B(e.items[u], u), R = W.get(g) ?? q.value;
84
+ n[u] = R, t[u + 1] = t[u] + R;
85
85
  }
86
86
  return {
87
- offsets: i,
88
- sizes: d,
89
- total: i[e.items.length] ?? 0
87
+ offsets: t,
88
+ sizes: n,
89
+ total: t[e.items.length] ?? 0
90
90
  };
91
- }), q = n(() => {
92
- const i = /* @__PURE__ */ new Map();
93
- return e.items.forEach((d, r) => {
94
- i.set(D(d, r), r);
95
- }), i;
91
+ }), M = i(() => {
92
+ const t = /* @__PURE__ */ new Map();
93
+ return e.items.forEach((n, u) => {
94
+ t.set(B(n, u), u);
95
+ }), t;
96
96
  });
97
- function K(i) {
97
+ function D(t) {
98
98
  if (e.items.length === 0) return 0;
99
- const d = w.value.offsets;
100
- let r = 0, M = e.items.length;
101
- for (; r < M; ) {
102
- const g = Math.floor((r + M) / 2);
103
- d[g + 1] <= i ? r = g + 1 : M = g;
99
+ const n = v.value.offsets;
100
+ let u = 0, g = e.items.length;
101
+ for (; u < g; ) {
102
+ const R = Math.floor((u + g) / 2);
103
+ n[R + 1] <= t ? u = R + 1 : g = R;
104
104
  }
105
- return Math.min(r, e.items.length - 1);
105
+ return Math.min(u, e.items.length - 1);
106
106
  }
107
- const J = n(() => {
107
+ const ve = i(() => {
108
108
  if (e.items.length === 0) return { start: 0, end: 0 };
109
- const i = K(z.value), d = K(z.value + le.value) + 1, r = Math.max(0, i - G.value), M = Math.min(
109
+ const t = D(S.value), n = D(S.value + oe.value) + 1, u = Math.max(0, t - ae.value), g = Math.min(
110
110
  e.items.length,
111
- d + G.value
112
- ), g = te.value;
113
- if (g === void 0 || M - r <= g) return { start: r, end: M };
114
- const o = Math.max(0, g - (d - i)), t = i - r, a = M - d;
115
- let c = Math.min(t, Math.ceil(o / 2));
116
- const m = Math.min(a, o - c);
117
- return c = Math.min(t, o - m), { start: i - c, end: d + m };
118
- }), X = n(() => J.value.start), se = n(() => J.value.end), ae = n(
119
- () => e.items.slice(X.value, se.value).map((i, d) => {
120
- const r = X.value + d;
111
+ n + ae.value
112
+ ), R = he.value;
113
+ if (R === void 0 || g - u <= R) return { start: u, end: g };
114
+ const Q = Math.max(0, R - (n - t)), re = t - u, ce = g - n;
115
+ let de = Math.min(re, Math.ceil(Q / 2));
116
+ const Se = Math.min(ce, Q - de);
117
+ return de = Math.min(re, Q - Se), { start: t - de, end: n + Se };
118
+ }), te = i(() => ve.value.start), ye = i(() => ve.value.end), ne = i(
119
+ () => e.items.slice(te.value, ye.value).map((t, n) => {
120
+ const u = te.value + n;
121
121
  return {
122
- item: i,
123
- index: r,
124
- key: D(i, r),
125
- top: w.value.offsets[r]
122
+ item: t,
123
+ index: u,
124
+ key: B(t, u),
125
+ top: v.value.offsets[u] - r.value
126
126
  };
127
127
  })
128
- ), p = n(() => ({
129
- height: He(e.height)
128
+ ), fe = i(() => ({
129
+ height: Ve(e.height)
130
130
  }));
131
- function f() {
132
- const i = h.value;
133
- if (!i) return;
134
- const r = Math.max(
131
+ function J() {
132
+ var t;
133
+ return (((t = f.value) == null ? void 0 : t.scrollTop) ?? 0) + K;
134
+ }
135
+ function me() {
136
+ ee || (ee = !0, O(() => {
137
+ ee = !1;
138
+ const t = f.value;
139
+ !t || V || K === 0 || (K = 0, t.scrollTop = S.value, S.value = t.scrollTop, ue(), s());
140
+ }));
141
+ }
142
+ function m(t) {
143
+ !f.value || t === 0 || (K += t, S.value = J(), V ? r.value = K : me());
144
+ }
145
+ function b() {
146
+ clearTimeout(N), N = void 0;
147
+ }
148
+ function z() {
149
+ A || (b(), V = !1, S.value = J(), r.value = 0, me());
150
+ }
151
+ function G() {
152
+ b(), V && !A && (N = setTimeout(z, 150));
153
+ }
154
+ function Me() {
155
+ b(), A = !0, V = !0, r.value = K;
156
+ }
157
+ function se(t) {
158
+ A = t.touches.length > 0, G();
159
+ }
160
+ function ue() {
161
+ const t = f.value;
162
+ if (!t) return;
163
+ const u = Math.max(
135
164
  0,
136
- w.value.total - i.scrollTop - i.clientHeight
165
+ v.value.total - J() - t.clientHeight
137
166
  ) <= Math.max(0, e.bottomThreshold);
138
- r !== N.value && (N.value = r, L && x("bottomChange", r));
167
+ u !== F.value && (F.value = u, w && y("bottomChange", u));
139
168
  }
140
- function F() {
141
- var i;
142
- s.value = ((i = h.value) == null ? void 0 : i.clientHeight) ?? 0, B(h.value, e.height), O(() => {
143
- f(), Z();
169
+ function Y() {
170
+ var t;
171
+ H.value = ((t = f.value) == null ? void 0 : t.clientHeight) ?? 0, X(f.value, e.height), O(() => {
172
+ ue(), s();
144
173
  });
145
174
  }
146
- function re(i) {
147
- z.value = i.currentTarget.scrollTop, f(), x("scroll", {
148
- scrollTop: z.value,
149
- startIndex: X.value,
150
- endIndex: se.value
151
- }), Z();
152
- }
153
- function Z() {
154
- const i = h.value;
155
- !L || !i || !e.hasOlder || e.loadingOlder || E === e.items.length || i.scrollTop <= Math.max(0, e.loadOlderThreshold) && (E = e.items.length, x("loadOlder"));
156
- }
157
- function he(i) {
158
- const d = i.borderBoxSize;
159
- if (d) {
160
- const r = Array.isArray(d) ? d[0] : d;
161
- if (r != null && r.blockSize) return r.blockSize;
175
+ function j() {
176
+ var t;
177
+ K < 0 && J() < 0 && (K = -Math.max(0, ((t = f.value) == null ? void 0 : t.scrollTop) ?? 0), V && (r.value = K)), S.value = J(), G(), ue(), y("scroll", {
178
+ scrollTop: S.value,
179
+ startIndex: te.value,
180
+ endIndex: ye.value
181
+ }), s();
182
+ }
183
+ function s() {
184
+ const t = f.value;
185
+ !w || !t || !e.hasOlder || e.loadingOlder || I === e.items.length || J() <= Math.max(0, e.loadOlderThreshold) && (I = e.items.length, y("loadOlder"));
186
+ }
187
+ function l(t) {
188
+ const n = t.borderBoxSize;
189
+ if (n) {
190
+ const u = Array.isArray(n) ? n[0] : n;
191
+ if (u != null && u.blockSize) return u.blockSize;
162
192
  }
163
- return i.contentRect.height;
164
- }
165
- function oe(i) {
166
- const d = w.value, r = N.value && e.stickToBottom;
167
- let M = 0, g = !1;
168
- for (const o of i) {
169
- const t = o.target, a = Y.get(t), c = he(o);
170
- if (a === void 0 || c <= 0) continue;
171
- const m = A.get(a) ?? P.value;
172
- if (Math.abs(m - c) < 0.5) continue;
173
- const ce = q.value.get(a);
174
- ce !== void 0 && d.offsets[ce + 1] <= z.value && (M += c - m), A.set(a, c), g = !0;
193
+ return t.contentRect.height;
194
+ }
195
+ function o(t) {
196
+ const n = v.value, u = J(), g = !V && F.value && e.stickToBottom;
197
+ let R = 0, Q = !1;
198
+ for (const ce of t) {
199
+ const de = ce.target, Se = Z.get(de), Re = l(ce);
200
+ if (Se === void 0 || Re <= 0) continue;
201
+ const Fe = W.get(Se) ?? q.value;
202
+ if (Math.abs(Fe - Re) < 0.5) continue;
203
+ const We = M.value.get(Se);
204
+ We !== void 0 && n.offsets[We + 1] <= u && (R += Re - Fe), W.set(Se, Re), Q = !0;
175
205
  }
176
- g && (R.value += 1, O(() => {
177
- const o = h.value;
178
- o && (r ? $("auto") : M !== 0 && (o.scrollTop += M, z.value = o.scrollTop, f()));
179
- }));
180
- }
181
- function ie(i, d) {
182
- i instanceof HTMLElement && (Y.set(i, d), T == null || T.observe(i));
206
+ if (!Q) return;
207
+ U.value += 1;
208
+ const re = f.value;
209
+ re && (m(g ? Math.max(0, v.value.total - re.clientHeight) - u : R), O(ue));
210
+ }
211
+ function h(t, n) {
212
+ t instanceof HTMLElement && Z.get(t) !== n && (Z.set(t, n), p == null || p.observe(t));
213
+ }
214
+ function k() {
215
+ for (const [t] of Z)
216
+ t.isConnected || (p == null || p.unobserve(t), Z.delete(t));
217
+ }
218
+ function ge(t, n, u = !1) {
219
+ const g = f.value;
220
+ if (!g) return;
221
+ const R = J(), Q = r.value !== 0, re = ++$, ce = n.behavior ?? "auto";
222
+ K = 0, r.value = 0, V = !1, b(), ce === "auto" && (S.value = t);
223
+ const de = () => {
224
+ f.value !== g || re !== $ || (Q && ce !== "auto" && (g.scrollTop = R), u && ce === "auto" ? g.scrollTop = t : g.scrollTo({ ...n, top: t, behavior: ce }), O(ue));
225
+ };
226
+ Q ? O(de) : de();
227
+ }
228
+ function pe(t, n = {}) {
229
+ const u = f.value;
230
+ if (!u) return;
231
+ const g = Math.max(0, v.value.total - u.clientHeight), R = Math.min(
232
+ Math.max(0, Number.isFinite(t) ? t : 0),
233
+ g
234
+ );
235
+ ge(R, n);
183
236
  }
184
- function ue() {
185
- for (const [i] of Y)
186
- i.isConnected || (T == null || T.unobserve(i), Y.delete(i));
187
- }
188
- function ve(i, d = {}) {
189
- const r = h.value;
190
- if (!r) return;
191
- const M = Math.max(0, w.value.total - r.clientHeight), g = Math.min(
192
- Math.max(0, Number.isFinite(i) ? i : 0),
193
- M
194
- ), o = d.behavior ?? "auto";
195
- o === "auto" && (z.value = g), r.scrollTo({ ...d, top: g, behavior: o }), O(f);
196
- }
197
- function y(i, d = {}) {
198
- const r = h.value;
199
- if (!r || e.items.length === 0) return;
200
- const M = Math.min(
237
+ function we(t, n = {}) {
238
+ const u = f.value;
239
+ if (!u || e.items.length === 0) return;
240
+ const g = Math.min(
201
241
  e.items.length - 1,
202
- Math.max(0, Math.floor(i))
203
- ), { align: g = "start", ...o } = d, t = w.value.sizes[M];
204
- let a = w.value.offsets[M];
205
- g === "center" ? a -= (r.clientHeight - t) / 2 : g === "end" && (a -= r.clientHeight - t);
206
- const c = Math.max(
242
+ Math.max(0, Math.floor(t))
243
+ ), { align: R = "start", ...Q } = n, re = v.value.sizes[g];
244
+ let ce = v.value.offsets[g];
245
+ R === "center" ? ce -= (u.clientHeight - re) / 2 : R === "end" && (ce -= u.clientHeight - re);
246
+ const de = Math.max(
207
247
  0,
208
- Math.min(a, w.value.total - r.clientHeight)
209
- ), m = o.behavior ?? "auto";
210
- m === "auto" && (z.value = c), r.scrollTo({
211
- ...o,
212
- top: c,
213
- behavior: m
214
- }), O(f);
215
- }
216
- function H(i = "auto") {
217
- const d = h.value;
218
- d && (i === "auto" && (z.value = 0), d.scrollTo({ top: 0, behavior: i }), O(f));
219
- }
220
- function $(i = "auto") {
221
- const d = h.value;
222
- if (!d) return;
223
- const r = Math.max(0, w.value.total - d.clientHeight);
224
- i === "auto" ? (d.scrollTop = r, z.value = r) : d.scrollTo({ top: r, behavior: i }), O(f);
225
- }
226
- let U = e.items.map((i, d) => D(i, d));
227
- return ee(
228
- () => e.items.map((i, d) => D(i, d)),
229
- async (i) => {
230
- const d = U;
231
- U = i;
232
- const r = h.value, M = (r == null ? void 0 : r.scrollTop) ?? 0, g = N.value && e.stickToBottom, o = d[0], t = o === void 0 ? 0 : i.indexOf(o), a = t > 0 ? i.slice(0, t).reduce(
233
- (m, ce) => m + (A.get(ce) ?? P.value),
248
+ Math.min(ce, v.value.total - u.clientHeight)
249
+ );
250
+ ge(de, Q);
251
+ }
252
+ function be(t = "auto") {
253
+ ge(0, { behavior: t });
254
+ }
255
+ function Te(t = "auto") {
256
+ const n = f.value;
257
+ if (!n) return;
258
+ const u = Math.max(0, v.value.total - n.clientHeight);
259
+ ge(u, { behavior: t }, !0);
260
+ }
261
+ let d = e.items.map((t, n) => B(t, n));
262
+ return le(
263
+ () => e.items.map((t, n) => B(t, n)),
264
+ async (t) => {
265
+ const n = d;
266
+ d = t;
267
+ const u = f.value, g = !V && F.value && e.stickToBottom, R = n[0], Q = R === void 0 ? 0 : t.indexOf(R), re = Q > 0 ? t.slice(0, Q).reduce(
268
+ (de, Se) => de + (W.get(Se) ?? q.value),
234
269
  0
235
- ) : 0, c = new Set(i);
236
- for (const m of A.keys())
237
- c.has(m) || A.delete(m);
238
- R.value += 1, await O(), r && (a > 0 ? (r.scrollTop = M + a, z.value = r.scrollTop) : i.length > d.length && g && $("auto"), f(), Z());
270
+ ) : 0, ce = new Set(t);
271
+ for (const de of W.keys())
272
+ ce.has(de) || W.delete(de);
273
+ U.value += 1, re > 0 ? m(re) : u && t.length > n.length && g ? m(
274
+ Math.max(0, v.value.total - u.clientHeight) - J()
275
+ ) : (t.length === 0 || Q < 0) && (K = 0, r.value = 0), await O(), f.value && (S.value = J(), ue(), s());
239
276
  }
240
- ), ee(
277
+ ), le(
241
278
  () => [e.hasOlder, e.loadingOlder],
242
- async ([i]) => {
243
- i || (E = -1), await O(), Z();
279
+ async ([t]) => {
280
+ t || (I = -1), await O(), s();
244
281
  }
245
- ), Se(() => {
246
- if (F(), typeof ResizeObserver < "u") {
247
- j = new ResizeObserver(F), T = new ResizeObserver(oe), h.value && j.observe(h.value);
248
- for (const [i] of Y)
249
- T.observe(i);
282
+ ), ke(() => {
283
+ if (Y(), typeof ResizeObserver < "u") {
284
+ L = new ResizeObserver(Y), p = new ResizeObserver(o), f.value && L.observe(f.value);
285
+ for (const [t] of Z)
286
+ p.observe(t);
250
287
  }
251
288
  O(() => {
252
- e.initialScroll === "bottom" && $("auto"), L = !0, f(), Z();
289
+ e.initialScroll === "bottom" && Te("auto"), w = !0, ue(), s();
253
290
  });
254
- }), Ce(ue), Ie(() => {
255
- j && (j.disconnect(), j = void 0), T && (T.disconnect(), T = void 0), Y.clear();
291
+ }), Ae(k), Le(() => {
292
+ w = !1, b(), K = 0, $ += 1, L && (L.disconnect(), L = void 0), p && (p.disconnect(), p = void 0), Z.clear();
256
293
  }), _({
257
- isAtBottom: N,
258
- scrollTo: ve,
259
- scrollToIndex: y,
260
- scrollToTop: H,
261
- scrollToBottom: $
262
- }), (i, d) => (S(), I("div", {
294
+ isAtBottom: F,
295
+ scrollTo: pe,
296
+ scrollToIndex: we,
297
+ scrollToTop: be,
298
+ scrollToBottom: Te
299
+ }), (t, n) => (x(), T("div", {
263
300
  ref_key: "viewport",
264
- ref: h,
301
+ ref: f,
265
302
  class: "vue-chat-virtual-scroll",
266
- style: C(p.value),
303
+ style: C(fe.value),
267
304
  role: "log",
268
- "aria-label": l.ariaLabel,
305
+ "aria-label": a.ariaLabel,
269
306
  "aria-live": "polite",
270
307
  tabindex: "0",
271
- onScrollPassive: re
308
+ onScrollPassive: j,
309
+ onScrollendPassive: z,
310
+ onTouchstartPassive: Me,
311
+ onTouchendPassive: se,
312
+ onTouchcancelPassive: se
272
313
  }, [
273
- l.loadingOlder ? (S(), I("div", Ne, [
314
+ a.loadingOlder ? (x(), T("div", je, [
274
315
  De("div", null, [
275
- ne(i.$slots, "loadingOlder", {}, () => [
276
- d[0] || (d[0] = Me("Loading older messages…", -1))
316
+ ie(t.$slots, "loadingOlder", {}, () => [
317
+ n[0] || (n[0] = Ie("Loading older messages…", -1))
277
318
  ])
278
319
  ])
279
- ])) : me("", !0),
280
- l.items.length ? (S(), I("div", {
320
+ ])) : xe("", !0),
321
+ a.items.length ? (x(), T("div", {
281
322
  key: 1,
282
323
  class: "vue-chat-virtual-scroll__spacer",
283
- style: C({ height: `${w.value.total}px` })
324
+ style: C({ height: `${Math.max(0, v.value.total - r.value)}px` })
284
325
  }, [
285
- (S(!0), I(we, null, ze(ae.value, ({ item: r, index: M, key: g, top: o }) => (S(), I("div", {
286
- key: g,
326
+ (x(!0), T(ze, null, Ee(ne.value, ({ item: u, index: g, key: R, top: Q }) => (x(), T("div", {
327
+ key: R,
287
328
  ref_for: !0,
288
- ref: (t) => ie(t, g),
329
+ ref: (re) => h(re, R),
289
330
  class: "vue-chat-virtual-scroll__item",
290
- style: C({ transform: `translateY(${o}px)` }),
331
+ style: C({ transform: `translateY(${Q}px)` }),
291
332
  role: "article",
292
- "aria-posinset": M + 1,
293
- "aria-setsize": l.items.length
333
+ "aria-posinset": g + 1,
334
+ "aria-setsize": a.items.length
294
335
  }, [
295
- ne(i.$slots, "default", {
296
- item: r,
297
- index: M
336
+ ie(t.$slots, "default", {
337
+ item: u,
338
+ index: g
298
339
  })
299
- ], 12, Ye))), 128))
300
- ], 4)) : ne(i.$slots, "empty", {}, void 0, void 0, 2)
301
- ], 44, We));
340
+ ], 12, Ue))), 128))
341
+ ], 4)) : ie(t.$slots, "empty", {}, void 0, void 0, 2)
342
+ ], 44, Ge));
302
343
  }
303
344
  });
304
- function Oe(l) {
305
- const _ = W(), V = W(0), e = W(!1), x = W(!1), h = n(() => Math.max(1, l.threshold())), z = n(
306
- () => l.refreshing() || x.value ? h.value : V.value
307
- ), s = n(
308
- () => Math.min(1, V.value / h.value)
309
- ), R = n(() => l.refreshing() || x.value ? "Refreshing…" : s.value >= 1 ? "Release to refresh" : "Pull to refresh");
310
- function N() {
311
- _.value = void 0, e.value = !1, V.value = 0;
345
+ function Ke(a) {
346
+ const _ = P(), E = P(0), e = P(!1), y = P(!1), f = i(() => Math.max(1, a.threshold())), S = i(
347
+ () => a.refreshing() || y.value ? f.value : E.value
348
+ ), r = i(
349
+ () => Math.min(1, E.value / f.value)
350
+ ), H = i(() => a.refreshing() || y.value ? "Refreshing…" : r.value >= 1 ? "Release to refresh" : "Pull to refresh");
351
+ function U() {
352
+ _.value = void 0, e.value = !1, E.value = 0;
312
353
  }
313
- function A(T) {
314
- var B;
315
- const E = T.currentTarget, L = ((B = l.scrollTop) == null ? void 0 : B.call(l)) ?? E.scrollTop;
316
- !l.enabled() || l.refreshing() || L > 0 || T.touches.length !== 1 || (_.value = T.touches[0].clientY, e.value = !0);
354
+ function F(L) {
355
+ var w;
356
+ const p = L.currentTarget, I = ((w = a.scrollTop) == null ? void 0 : w.call(a)) ?? p.scrollTop;
357
+ !a.enabled() || a.refreshing() || I > 0 || L.touches.length !== 1 || (_.value = L.touches[0].clientY, e.value = !0);
317
358
  }
318
- function Y(T) {
319
- var D;
359
+ function W(L) {
360
+ var A;
320
361
  if (_.value === void 0 || !e.value) return;
321
- const E = T.currentTarget;
322
- if ((((D = l.scrollTop) == null ? void 0 : D.call(l)) ?? E.scrollTop) > 0 || T.touches.length !== 1) {
323
- N();
362
+ const p = L.currentTarget;
363
+ if ((((A = a.scrollTop) == null ? void 0 : A.call(a)) ?? p.scrollTop) > 0 || L.touches.length !== 1) {
364
+ U();
324
365
  return;
325
366
  }
326
- const B = T.touches[0].clientY - _.value;
327
- if (B <= 0) {
328
- V.value = 0;
367
+ const w = L.touches[0].clientY - _.value;
368
+ if (w <= 0) {
369
+ E.value = 0;
329
370
  return;
330
371
  }
331
- T.preventDefault(), V.value = Math.min(B * 0.5, h.value * 2);
372
+ L.preventDefault(), E.value = Math.min(w * 0.5, f.value * 2);
332
373
  }
333
- function j() {
374
+ function Z() {
334
375
  if (_.value === void 0) return;
335
- const T = V.value >= h.value && l.enabled() && !l.refreshing();
336
- if (_.value = void 0, e.value = !1, !T) {
337
- V.value = 0;
376
+ const L = E.value >= f.value && a.enabled() && !a.refreshing();
377
+ if (_.value = void 0, e.value = !1, !L) {
378
+ E.value = 0;
338
379
  return;
339
380
  }
340
- V.value = h.value, x.value = !0, l.onRefresh(), O(() => {
341
- l.refreshing() || (x.value = !1, V.value = 0);
381
+ E.value = f.value, y.value = !0, a.onRefresh(), O(() => {
382
+ a.refreshing() || (y.value = !1, E.value = 0);
342
383
  });
343
384
  }
344
- return ee(
345
- () => l.refreshing(),
346
- (T, E) => {
347
- T ? (x.value = !1, V.value = h.value) : E && (x.value = !1, V.value = 0);
385
+ return le(
386
+ () => a.refreshing(),
387
+ (L, p) => {
388
+ L ? (y.value = !1, E.value = f.value) : p && (y.value = !1, E.value = 0);
348
389
  }
349
390
  ), {
350
391
  pulling: e,
351
- pullDistance: V,
352
- pullOffset: z,
353
- pullProgress: s,
354
- refreshMessage: R,
355
- refreshThreshold: h,
356
- handleTouchStart: A,
357
- handleTouchMove: Y,
358
- handleTouchEnd: j,
359
- handleTouchCancel: N
392
+ pullDistance: E,
393
+ pullOffset: S,
394
+ pullProgress: r,
395
+ refreshMessage: H,
396
+ refreshThreshold: f,
397
+ handleTouchStart: F,
398
+ handleTouchMove: W,
399
+ handleTouchEnd: Z,
400
+ handleTouchCancel: U
360
401
  };
361
402
  }
362
- const Ge = ["aria-label"], Ue = ["aria-posinset", "aria-setsize"], Pe = /* @__PURE__ */ xe({
403
+ const qe = ["aria-label"], Je = ["aria-posinset", "aria-setsize"], Ne = /* @__PURE__ */ $e({
363
404
  name: "DynamicVirtualScroll",
364
405
  __name: "DynamicVirtualScroll",
365
406
  props: {
@@ -378,294 +419,294 @@ const Ge = ["aria-label"], Ue = ["aria-posinset", "aria-setsize"], Pe = /* @__PU
378
419
  pullRefreshThreshold: { default: 64 }
379
420
  },
380
421
  emits: ["scroll", "loadMore", "refresh"],
381
- setup(l, { expose: _, emit: V }) {
382
- const e = l, x = V, {
383
- pulling: h,
384
- pullDistance: z,
385
- pullOffset: s,
386
- pullProgress: R,
387
- refreshMessage: N,
388
- refreshThreshold: A,
389
- handleTouchStart: Y,
390
- handleTouchMove: j,
391
- handleTouchEnd: T,
392
- handleTouchCancel: E
393
- } = Oe({
422
+ setup(a, { expose: _, emit: E }) {
423
+ const e = a, y = E, {
424
+ pulling: f,
425
+ pullDistance: S,
426
+ pullOffset: r,
427
+ pullProgress: H,
428
+ refreshMessage: U,
429
+ refreshThreshold: F,
430
+ handleTouchStart: W,
431
+ handleTouchMove: Z,
432
+ handleTouchEnd: L,
433
+ handleTouchCancel: p
434
+ } = Ke({
394
435
  enabled: () => e.pullToRefresh,
395
436
  refreshing: () => e.refreshing,
396
437
  threshold: () => e.pullRefreshThreshold,
397
- onRefresh: () => x("refresh")
398
- }), L = W(), B = W(0), D = W(0), P = W(0), G = /* @__PURE__ */ new Map(), te = /* @__PURE__ */ new Map();
399
- let le, w, q = -1;
400
- const K = Re(), { getItemKey: J } = $e({
438
+ onRefresh: () => y("refresh")
439
+ }), I = P(), w = P(0), A = P(0), V = P(0), N = /* @__PURE__ */ new Map(), K = /* @__PURE__ */ new Map();
440
+ let ee, $, X = -1;
441
+ const B = Ce(), { getItemKey: q } = He({
401
442
  componentName: "DynamicVirtualScroll",
402
443
  items: () => e.items,
403
444
  itemKey: () => e.itemKey
404
- }), X = n(
445
+ }), ae = i(
405
446
  () => Math.max(1, e.estimatedItemSize)
406
- ), se = n(
407
- () => Math.max(1, e.loadingItemSize ?? X.value)
408
- ), ae = n(() => Math.max(0, Math.floor(e.overscan))), p = n(() => D.value > 0 ? D.value : typeof e.height == "number" ? Math.max(0, e.height) : X.value), f = n(() => {
409
- P.value;
410
- const o = new Array(e.items.length + 1), t = new Array(e.items.length);
411
- o[0] = 0;
412
- for (let a = 0; a < e.items.length; a += 1) {
413
- const c = J(e.items[a], a), m = G.get(c) ?? X.value;
414
- t[a] = m, o[a + 1] = o[a] + m;
447
+ ), he = i(
448
+ () => Math.max(1, e.loadingItemSize ?? ae.value)
449
+ ), oe = i(() => Math.max(0, Math.floor(e.overscan))), v = i(() => A.value > 0 ? A.value : typeof e.height == "number" ? Math.max(0, e.height) : ae.value), M = i(() => {
450
+ V.value;
451
+ const s = new Array(e.items.length + 1), l = new Array(e.items.length);
452
+ s[0] = 0;
453
+ for (let o = 0; o < e.items.length; o += 1) {
454
+ const h = q(e.items[o], o), k = N.get(h) ?? ae.value;
455
+ l[o] = k, s[o + 1] = s[o] + k;
415
456
  }
416
457
  return {
417
- offsets: o,
418
- sizes: t,
419
- total: o[e.items.length] ?? 0
458
+ offsets: s,
459
+ sizes: l,
460
+ total: s[e.items.length] ?? 0
420
461
  };
421
- }), F = n(
422
- () => f.value.total + (e.loading ? se.value : 0)
423
- ), re = n(() => {
424
- const o = /* @__PURE__ */ new Map();
425
- return e.items.forEach((t, a) => {
426
- o.set(J(t, a), a);
427
- }), o;
462
+ }), D = i(
463
+ () => M.value.total + (e.loading ? he.value : 0)
464
+ ), ve = i(() => {
465
+ const s = /* @__PURE__ */ new Map();
466
+ return e.items.forEach((l, o) => {
467
+ s.set(q(l, o), o);
468
+ }), s;
428
469
  });
429
- function Z(o) {
470
+ function te(s) {
430
471
  if (e.items.length === 0) return 0;
431
- const t = f.value.offsets;
432
- let a = 0, c = e.items.length;
433
- for (; a < c; ) {
434
- const m = Math.floor((a + c) / 2);
435
- t[m + 1] <= o ? a = m + 1 : c = m;
472
+ const l = M.value.offsets;
473
+ let o = 0, h = e.items.length;
474
+ for (; o < h; ) {
475
+ const k = Math.floor((o + h) / 2);
476
+ l[k + 1] <= s ? o = k + 1 : h = k;
436
477
  }
437
- return Math.min(a, e.items.length - 1);
478
+ return Math.min(o, e.items.length - 1);
438
479
  }
439
- const he = n(
480
+ const ye = i(
440
481
  () => Math.max(
441
482
  0,
442
- Z(B.value) - ae.value
483
+ te(w.value) - oe.value
443
484
  )
444
- ), oe = n(() => {
485
+ ), ne = i(() => {
445
486
  if (e.items.length === 0) return 0;
446
- const o = Z(B.value + p.value) + 1;
487
+ const s = te(w.value + v.value) + 1;
447
488
  return Math.min(
448
489
  e.items.length,
449
- o + ae.value
490
+ s + oe.value
450
491
  );
451
- }), ie = n(
452
- () => e.items.slice(he.value, oe.value).map((o, t) => {
453
- const a = he.value + t;
492
+ }), fe = i(
493
+ () => e.items.slice(ye.value, ne.value).map((s, l) => {
494
+ const o = ye.value + l;
454
495
  return {
455
- item: o,
456
- index: a,
457
- key: J(o, a),
458
- top: f.value.offsets[a]
496
+ item: s,
497
+ index: o,
498
+ key: q(s, o),
499
+ top: M.value.offsets[o]
459
500
  };
460
501
  })
461
- ), ue = n(() => ({
462
- height: He(e.height)
502
+ ), J = i(() => ({
503
+ height: Ve(e.height)
463
504
  }));
464
- function ve() {
465
- var o;
466
- D.value = ((o = L.value) == null ? void 0 : o.clientHeight) ?? 0, K(L.value, e.height), O(H);
467
- }
468
- function y(o) {
469
- B.value = o.currentTarget.scrollTop, x("scroll", {
470
- scrollTop: B.value,
471
- startIndex: he.value,
472
- endIndex: oe.value
473
- }), H();
474
- }
475
- function H() {
476
- const o = L.value;
477
- if (!o || !e.hasMore || e.loading || q === e.items.length)
505
+ function me() {
506
+ var s;
507
+ A.value = ((s = I.value) == null ? void 0 : s.clientHeight) ?? 0, B(I.value, e.height), O(b);
508
+ }
509
+ function m(s) {
510
+ w.value = s.currentTarget.scrollTop, y("scroll", {
511
+ scrollTop: w.value,
512
+ startIndex: ye.value,
513
+ endIndex: ne.value
514
+ }), b();
515
+ }
516
+ function b() {
517
+ const s = I.value;
518
+ if (!s || !e.hasMore || e.loading || X === e.items.length)
478
519
  return;
479
- const t = Math.max(0, e.loadMoreThreshold);
480
- F.value - o.scrollTop - o.clientHeight <= t && (q = e.items.length, x("loadMore"));
481
- }
482
- function $(o) {
483
- const t = o.borderBoxSize;
484
- if (t) {
485
- const a = Array.isArray(t) ? t[0] : t;
486
- if (a != null && a.blockSize) return a.blockSize;
520
+ const l = Math.max(0, e.loadMoreThreshold);
521
+ D.value - s.scrollTop - s.clientHeight <= l && (X = e.items.length, y("loadMore"));
522
+ }
523
+ function z(s) {
524
+ const l = s.borderBoxSize;
525
+ if (l) {
526
+ const o = Array.isArray(l) ? l[0] : l;
527
+ if (o != null && o.blockSize) return o.blockSize;
487
528
  }
488
- return o.contentRect.height;
489
- }
490
- function U(o) {
491
- const t = f.value;
492
- let a = 0, c = !1;
493
- for (const m of o) {
494
- const ce = m.target, fe = te.get(ce), ge = $(m);
495
- if (fe === void 0 || ge <= 0) continue;
496
- const Te = G.get(fe) ?? X.value;
497
- if (Math.abs(Te - ge) < 0.5) continue;
498
- const be = re.value.get(fe);
499
- be !== void 0 && t.offsets[be + 1] <= B.value && (a += ge - Te), G.set(fe, ge), c = !0;
529
+ return s.contentRect.height;
530
+ }
531
+ function G(s) {
532
+ const l = M.value;
533
+ let o = 0, h = !1;
534
+ for (const k of s) {
535
+ const ge = k.target, pe = K.get(ge), we = z(k);
536
+ if (pe === void 0 || we <= 0) continue;
537
+ const be = N.get(pe) ?? ae.value;
538
+ if (Math.abs(be - we) < 0.5) continue;
539
+ const Te = ve.value.get(pe);
540
+ Te !== void 0 && l.offsets[Te + 1] <= w.value && (o += we - be), N.set(pe, we), h = !0;
500
541
  }
501
- c && (P.value += 1, O(H), a !== 0 && O(() => {
502
- const m = L.value;
503
- m && (m.scrollTop += a, B.value = m.scrollTop);
542
+ h && (V.value += 1, O(b), o !== 0 && O(() => {
543
+ const k = I.value;
544
+ k && (k.scrollTop += o, w.value = k.scrollTop);
504
545
  }));
505
546
  }
506
- function i(o, t) {
507
- o instanceof HTMLElement && (te.set(o, t), w == null || w.observe(o));
508
- }
509
- function d() {
510
- for (const [o] of te)
511
- o.isConnected || (w == null || w.unobserve(o), te.delete(o));
512
- }
513
- function r(o, t = {}) {
514
- const a = L.value;
515
- if (!a) return;
516
- const c = Math.max(0, F.value - a.clientHeight), m = Math.min(
517
- Math.max(0, Number.isFinite(o) ? o : 0),
518
- c
519
- ), ce = t.behavior ?? "auto";
520
- ce === "auto" && (B.value = m), a.scrollTo({ ...t, top: m, behavior: ce });
521
- }
522
- function M(o, t = {}) {
523
- const a = L.value;
524
- if (!a || e.items.length === 0) return;
525
- const c = Math.min(
547
+ function Me(s, l) {
548
+ s instanceof HTMLElement && (K.set(s, l), $ == null || $.observe(s));
549
+ }
550
+ function se() {
551
+ for (const [s] of K)
552
+ s.isConnected || ($ == null || $.unobserve(s), K.delete(s));
553
+ }
554
+ function ue(s, l = {}) {
555
+ const o = I.value;
556
+ if (!o) return;
557
+ const h = Math.max(0, D.value - o.clientHeight), k = Math.min(
558
+ Math.max(0, Number.isFinite(s) ? s : 0),
559
+ h
560
+ ), ge = l.behavior ?? "auto";
561
+ ge === "auto" && (w.value = k), o.scrollTo({ ...l, top: k, behavior: ge });
562
+ }
563
+ function Y(s, l = {}) {
564
+ const o = I.value;
565
+ if (!o || e.items.length === 0) return;
566
+ const h = Math.min(
526
567
  e.items.length - 1,
527
- Math.max(0, Math.floor(o))
528
- ), { align: m = "start", ...ce } = t;
529
- let fe = f.value.offsets[c];
530
- const ge = f.value.sizes[c];
531
- m === "center" ? fe -= (a.clientHeight - ge) / 2 : m === "end" && (fe -= a.clientHeight - ge);
532
- const Te = Math.max(
568
+ Math.max(0, Math.floor(s))
569
+ ), { align: k = "start", ...ge } = l;
570
+ let pe = M.value.offsets[h];
571
+ const we = M.value.sizes[h];
572
+ k === "center" ? pe -= (o.clientHeight - we) / 2 : k === "end" && (pe -= o.clientHeight - we);
573
+ const be = Math.max(
533
574
  0,
534
- Math.min(fe, F.value - a.clientHeight)
535
- ), be = ce.behavior ?? "auto";
536
- be === "auto" && (B.value = Te), a.scrollTo({
537
- ...ce,
538
- top: Te,
539
- behavior: be
575
+ Math.min(pe, D.value - o.clientHeight)
576
+ ), Te = ge.behavior ?? "auto";
577
+ Te === "auto" && (w.value = be), o.scrollTo({
578
+ ...ge,
579
+ top: be,
580
+ behavior: Te
540
581
  });
541
582
  }
542
- function g(o = "auto") {
543
- var t;
544
- (t = L.value) == null || t.scrollTo({ top: 0, behavior: o });
583
+ function j(s = "auto") {
584
+ var l;
585
+ (l = I.value) == null || l.scrollTo({ top: 0, behavior: s });
545
586
  }
546
- return ee(
587
+ return le(
547
588
  () => e.itemKey,
548
589
  () => {
549
- G.clear(), P.value += 1;
590
+ N.clear(), V.value += 1;
550
591
  }
551
- ), ee(
592
+ ), le(
552
593
  () => e.items.length,
553
594
  async () => {
554
- const o = new Set(
555
- e.items.map((c, m) => J(c, m))
595
+ const s = new Set(
596
+ e.items.map((h, k) => q(h, k))
556
597
  );
557
- for (const c of G.keys())
558
- o.has(c) || G.delete(c);
559
- P.value += 1, await O();
560
- const t = L.value;
561
- if (!t) return;
562
- const a = Math.max(0, F.value - t.clientHeight);
563
- t.scrollTop > a && (t.scrollTop = a, B.value = a), H();
598
+ for (const h of N.keys())
599
+ s.has(h) || N.delete(h);
600
+ V.value += 1, await O();
601
+ const l = I.value;
602
+ if (!l) return;
603
+ const o = Math.max(0, D.value - l.clientHeight);
604
+ l.scrollTop > o && (l.scrollTop = o, w.value = o), b();
564
605
  }
565
- ), ee(
606
+ ), le(
566
607
  () => [e.hasMore, e.loading],
567
- async ([o]) => {
568
- o || (q = -1), await O(), H();
608
+ async ([s]) => {
609
+ s || (X = -1), await O(), b();
569
610
  }
570
- ), Se(() => {
571
- if (ve(), typeof ResizeObserver < "u") {
572
- le = new ResizeObserver(ve), w = new ResizeObserver(U), L.value && le.observe(L.value);
573
- for (const [o] of te)
574
- w.observe(o);
611
+ ), ke(() => {
612
+ if (me(), typeof ResizeObserver < "u") {
613
+ ee = new ResizeObserver(me), $ = new ResizeObserver(G), I.value && ee.observe(I.value);
614
+ for (const [s] of K)
615
+ $.observe(s);
575
616
  }
576
- O(H);
577
- }), Ce(d), Ie(() => {
578
- le && (le.disconnect(), le = void 0), w && (w.disconnect(), w = void 0), te.clear();
617
+ O(b);
618
+ }), Ae(se), Le(() => {
619
+ ee && (ee.disconnect(), ee = void 0), $ && ($.disconnect(), $ = void 0), K.clear();
579
620
  }), _({
580
- scrollTo: r,
581
- scrollToIndex: M,
582
- scrollToTop: g
583
- }), (o, t) => (S(), I("div", {
621
+ scrollTo: ue,
622
+ scrollToIndex: Y,
623
+ scrollToTop: j
624
+ }), (s, l) => (x(), T("div", {
584
625
  ref_key: "viewport",
585
- ref: L,
586
- class: Ee(["vue-dynamic-virtual-scroll", { "vue-dynamic-virtual-scroll--pulling": u(h) }]),
587
- style: C(ue.value),
626
+ ref: I,
627
+ class: Be(["vue-dynamic-virtual-scroll", { "vue-dynamic-virtual-scroll--pulling": c(f) }]),
628
+ style: C(J.value),
588
629
  role: "list",
589
- "aria-label": l.ariaLabel,
630
+ "aria-label": a.ariaLabel,
590
631
  tabindex: "0",
591
- onScrollPassive: y,
592
- onTouchstartPassive: t[0] || (t[0] = //@ts-ignore
593
- (...a) => u(Y) && u(Y)(...a)),
594
- onTouchmove: t[1] || (t[1] = //@ts-ignore
595
- (...a) => u(j) && u(j)(...a)),
596
- onTouchend: t[2] || (t[2] = //@ts-ignore
597
- (...a) => u(T) && u(T)(...a)),
598
- onTouchcancel: t[3] || (t[3] = //@ts-ignore
599
- (...a) => u(E) && u(E)(...a))
632
+ onScrollPassive: m,
633
+ onTouchstartPassive: l[0] || (l[0] = //@ts-ignore
634
+ (...o) => c(W) && c(W)(...o)),
635
+ onTouchmove: l[1] || (l[1] = //@ts-ignore
636
+ (...o) => c(Z) && c(Z)(...o)),
637
+ onTouchend: l[2] || (l[2] = //@ts-ignore
638
+ (...o) => c(L) && c(L)(...o)),
639
+ onTouchcancel: l[3] || (l[3] = //@ts-ignore
640
+ (...o) => c(p) && c(p)(...o))
600
641
  }, [
601
- l.pullToRefresh || l.refreshing ? (S(), I("div", {
642
+ a.pullToRefresh || a.refreshing ? (x(), T("div", {
602
643
  key: 0,
603
644
  class: "vue-dynamic-virtual-scroll__refresh",
604
645
  style: C({
605
- height: `${u(A)}px`,
606
- transform: `translateY(${u(s) - u(A)}px)`
646
+ height: `${c(F)}px`,
647
+ transform: `translateY(${c(r) - c(F)}px)`
607
648
  }),
608
649
  role: "status",
609
650
  "aria-live": "polite"
610
651
  }, [
611
- ne(o.$slots, "refresh", {
612
- pullDistance: u(z),
613
- progress: u(R),
614
- refreshing: l.refreshing
652
+ ie(s.$slots, "refresh", {
653
+ pullDistance: c(S),
654
+ progress: c(H),
655
+ refreshing: a.refreshing
615
656
  }, () => [
616
- Me(Ve(u(N)), 1)
657
+ Ie(Oe(c(U)), 1)
617
658
  ])
618
- ], 4)) : me("", !0),
619
- l.items.length || l.loading ? (S(), I("div", {
659
+ ], 4)) : xe("", !0),
660
+ a.items.length || a.loading ? (x(), T("div", {
620
661
  key: 1,
621
662
  class: "vue-dynamic-virtual-scroll__spacer",
622
663
  style: C({
623
- height: `${F.value}px`,
624
- transform: `translateY(${u(s)}px)`
664
+ height: `${D.value}px`,
665
+ transform: `translateY(${c(r)}px)`
625
666
  })
626
667
  }, [
627
- (S(!0), I(we, null, ze(ie.value, ({ item: a, index: c, key: m, top: ce }) => (S(), I("div", {
628
- key: m,
668
+ (x(!0), T(ze, null, Ee(fe.value, ({ item: o, index: h, key: k, top: ge }) => (x(), T("div", {
669
+ key: k,
629
670
  ref_for: !0,
630
- ref: (fe) => i(fe, m),
671
+ ref: (pe) => Me(pe, k),
631
672
  class: "vue-dynamic-virtual-scroll__item",
632
- style: C({ transform: `translateY(${ce}px)` }),
673
+ style: C({ transform: `translateY(${ge}px)` }),
633
674
  role: "listitem",
634
- "aria-posinset": c + 1,
635
- "aria-setsize": l.items.length
675
+ "aria-posinset": h + 1,
676
+ "aria-setsize": a.items.length
636
677
  }, [
637
- ne(o.$slots, "default", {
638
- item: a,
639
- index: c
678
+ ie(s.$slots, "default", {
679
+ item: o,
680
+ index: h
640
681
  })
641
- ], 12, Ue))), 128)),
642
- l.loading ? (S(), I("div", {
682
+ ], 12, Je))), 128)),
683
+ a.loading ? (x(), T("div", {
643
684
  key: 0,
644
685
  class: "vue-dynamic-virtual-scroll__loading",
645
686
  style: C({
646
- height: `${se.value}px`,
647
- transform: `translateY(${f.value.total}px)`
687
+ height: `${he.value}px`,
688
+ transform: `translateY(${M.value.total}px)`
648
689
  }),
649
690
  role: "status",
650
691
  "aria-live": "polite"
651
692
  }, [
652
- ne(o.$slots, "loading", {}, () => [
653
- t[4] || (t[4] = Me("Loading more…", -1))
693
+ ie(s.$slots, "loading", {}, () => [
694
+ l[4] || (l[4] = Ie("Loading more…", -1))
654
695
  ])
655
- ], 4)) : me("", !0)
656
- ], 4)) : (S(), I("div", {
696
+ ], 4)) : xe("", !0)
697
+ ], 4)) : (x(), T("div", {
657
698
  key: 2,
658
699
  class: "vue-dynamic-virtual-scroll__empty",
659
- style: C({ transform: `translateY(${u(s)}px)` })
700
+ style: C({ transform: `translateY(${c(r)}px)` })
660
701
  }, [
661
- ne(o.$slots, "empty")
702
+ ie(s.$slots, "empty")
662
703
  ], 4))
663
- ], 46, Ge));
704
+ ], 46, qe));
664
705
  }
665
- }), je = ["aria-label"], Ze = ["aria-current", "aria-posinset", "aria-setsize"], qe = {
706
+ }), Qe = ["aria-label"], Xe = ["aria-current", "aria-posinset", "aria-setsize"], et = {
666
707
  key: 1,
667
708
  class: "vue-short-media-feed__empty"
668
- }, Je = /* @__PURE__ */ xe({
709
+ }, tt = /* @__PURE__ */ $e({
669
710
  name: "ShortMediaFeed",
670
711
  __name: "ShortMediaFeed",
671
712
  props: {
@@ -680,155 +721,155 @@ const Ge = ["aria-label"], Ue = ["aria-posinset", "aria-setsize"], Pe = /* @__PU
680
721
  loadMoreThreshold: { default: 2 }
681
722
  },
682
723
  emits: ["update:activeIndex", "change", "reachStart", "reachEnd", "loadMore"],
683
- setup(l, { expose: _, emit: V }) {
684
- const e = l, x = V, h = W(), z = W(0), s = W(le(e.activeIndex));
685
- let R, N = -1;
686
- const A = Re(), { getItemKey: Y } = $e({
724
+ setup(a, { expose: _, emit: E }) {
725
+ const e = a, y = E, f = P(), S = P(0), r = P(ee(e.activeIndex));
726
+ let H, U = -1;
727
+ const F = Ce(), { getItemKey: W } = He({
687
728
  componentName: "ShortMediaFeed",
688
729
  items: () => e.items,
689
730
  itemKey: () => e.itemKey
690
- }), j = n(
731
+ }), Z = i(
691
732
  () => Math.max(0, Math.floor(e.buffer))
692
- ), T = n(
733
+ ), L = i(
693
734
  () => Math.max(
694
735
  0,
695
736
  Math.floor(
696
737
  Number.isFinite(e.loadMoreThreshold) ? e.loadMoreThreshold : 0
697
738
  )
698
739
  )
699
- ), E = n(() => z.value > 0 ? z.value : typeof e.height == "number" ? Math.max(1, e.height) : 0), L = n(
700
- () => Math.max(0, s.value - j.value)
701
- ), B = n(
740
+ ), p = i(() => S.value > 0 ? S.value : typeof e.height == "number" ? Math.max(1, e.height) : 0), I = i(
741
+ () => Math.max(0, r.value - Z.value)
742
+ ), w = i(
702
743
  () => Math.min(
703
744
  e.items.length,
704
- s.value + j.value + 1
745
+ r.value + Z.value + 1
705
746
  )
706
- ), D = n(
707
- () => e.items.slice(L.value, B.value).map((p, f) => ({
708
- item: p,
709
- index: L.value + f
747
+ ), A = i(
748
+ () => e.items.slice(I.value, w.value).map((v, M) => ({
749
+ item: v,
750
+ index: I.value + M
710
751
  }))
711
- ), P = n(() => L.value * E.value), G = n(
712
- () => (e.items.length - B.value) * E.value
713
- ), te = n(() => ({
714
- height: He(e.height)
752
+ ), V = i(() => I.value * p.value), N = i(
753
+ () => (e.items.length - w.value) * p.value
754
+ ), K = i(() => ({
755
+ height: Ve(e.height)
715
756
  }));
716
- function le(p) {
757
+ function ee(v) {
717
758
  return e.items.length === 0 ? 0 : Math.min(
718
759
  e.items.length - 1,
719
- Math.max(0, Math.floor(Number.isFinite(p) ? p : 0))
760
+ Math.max(0, Math.floor(Number.isFinite(v) ? v : 0))
720
761
  );
721
762
  }
722
- function w() {
723
- if (!e.hasMore || e.loading || N === e.items.length)
763
+ function $() {
764
+ if (!e.hasMore || e.loading || U === e.items.length)
724
765
  return;
725
- (e.items.length === 0 ? 0 : e.items.length - 1 - s.value) <= T.value && (N = e.items.length, x("loadMore"));
766
+ (e.items.length === 0 ? 0 : e.items.length - 1 - r.value) <= L.value && (U = e.items.length, y("loadMore"));
726
767
  }
727
- function q(p) {
728
- const f = le(p);
729
- f === s.value || e.items.length === 0 || (s.value = f, x("update:activeIndex", f), x("change", {
730
- index: f,
731
- item: e.items[f]
732
- }), f === 0 && x("reachStart"), f === e.items.length - 1 && x("reachEnd"), w());
768
+ function X(v) {
769
+ const M = ee(v);
770
+ M === r.value || e.items.length === 0 || (r.value = M, y("update:activeIndex", M), y("change", {
771
+ index: M,
772
+ item: e.items[M]
773
+ }), M === 0 && y("reachStart"), M === e.items.length - 1 && y("reachEnd"), $());
733
774
  }
734
- function K(p, f = {}) {
735
- const F = h.value;
736
- F && (typeof F.scrollTo == "function" ? F.scrollTo({ ...f, top: p }) : F.scrollTop = p);
775
+ function B(v, M = {}) {
776
+ const D = f.value;
777
+ D && (typeof D.scrollTo == "function" ? D.scrollTo({ ...M, top: v }) : D.scrollTop = v);
737
778
  }
738
- function J(p, f = {}) {
779
+ function q(v, M = {}) {
739
780
  if (e.items.length === 0) return;
740
- const F = le(p);
741
- q(F), K(F * E.value, f);
742
- }
743
- function X(p) {
744
- if (E.value <= 0) return;
745
- const f = p.currentTarget.scrollTop;
746
- q(Math.round(f / E.value));
747
- }
748
- function se(p) {
749
- let f;
750
- p.key === "ArrowDown" || p.key === "PageDown" ? f = s.value + 1 : p.key === "ArrowUp" || p.key === "PageUp" ? f = s.value - 1 : p.key === "Home" ? f = 0 : p.key === "End" && (f = e.items.length - 1), f !== void 0 && (p.preventDefault(), J(f, { behavior: "smooth" }));
751
- }
752
- function ae() {
753
- var f;
754
- const p = ((f = h.value) == null ? void 0 : f.clientHeight) ?? 0;
755
- A(h.value, e.height), !(p <= 0 || p === z.value) && (z.value = p, O(() => {
756
- K(s.value * p);
781
+ const D = ee(v);
782
+ X(D), B(D * p.value, M);
783
+ }
784
+ function ae(v) {
785
+ if (p.value <= 0) return;
786
+ const M = v.currentTarget.scrollTop;
787
+ X(Math.round(M / p.value));
788
+ }
789
+ function he(v) {
790
+ let M;
791
+ v.key === "ArrowDown" || v.key === "PageDown" ? M = r.value + 1 : v.key === "ArrowUp" || v.key === "PageUp" ? M = r.value - 1 : v.key === "Home" ? M = 0 : v.key === "End" && (M = e.items.length - 1), M !== void 0 && (v.preventDefault(), q(M, { behavior: "smooth" }));
792
+ }
793
+ function oe() {
794
+ var M;
795
+ const v = ((M = f.value) == null ? void 0 : M.clientHeight) ?? 0;
796
+ F(f.value, e.height), !(v <= 0 || v === S.value) && (S.value = v, O(() => {
797
+ B(r.value * v);
757
798
  }));
758
799
  }
759
- return ee(
800
+ return le(
760
801
  () => e.activeIndex,
761
- async (p) => {
762
- const f = le(p);
763
- f !== s.value && (s.value = f, await O(), K(f * E.value), w());
802
+ async (v) => {
803
+ const M = ee(v);
804
+ M !== r.value && (r.value = M, await O(), B(M * p.value), $());
764
805
  }
765
- ), ee(
806
+ ), le(
766
807
  () => [
767
808
  e.hasMore,
768
809
  e.loading,
769
810
  e.loadMoreThreshold
770
811
  ],
771
- async ([p]) => {
772
- p || (N = -1), await O(), w();
812
+ async ([v]) => {
813
+ v || (U = -1), await O(), $();
773
814
  }
774
- ), ee(
815
+ ), le(
775
816
  () => e.items.length,
776
817
  async () => {
777
- const p = le(s.value);
778
- e.items.length === 0 ? s.value !== 0 && (s.value = 0, x("update:activeIndex", 0)) : q(p), await O(), K(p * E.value), w();
818
+ const v = ee(r.value);
819
+ e.items.length === 0 ? r.value !== 0 && (r.value = 0, y("update:activeIndex", 0)) : X(v), await O(), B(v * p.value), $();
779
820
  }
780
- ), Se(async () => {
781
- ae(), typeof ResizeObserver < "u" && h.value && (R = new ResizeObserver(ae), R.observe(h.value)), await O(), K(s.value * E.value), w();
782
- }), Ie(() => {
783
- R && (R.disconnect(), R = void 0);
821
+ ), ke(async () => {
822
+ oe(), typeof ResizeObserver < "u" && f.value && (H = new ResizeObserver(oe), H.observe(f.value)), await O(), B(r.value * p.value), $();
823
+ }), Le(() => {
824
+ H && (H.disconnect(), H = void 0);
784
825
  }), _({
785
- scrollToIndex: J
786
- }), (p, f) => (S(), I("div", {
826
+ scrollToIndex: q
827
+ }), (v, M) => (x(), T("div", {
787
828
  ref_key: "viewport",
788
- ref: h,
829
+ ref: f,
789
830
  class: "vue-short-media-feed",
790
- style: C(te.value),
831
+ style: C(K.value),
791
832
  role: "list",
792
833
  "aria-orientation": "vertical",
793
- "aria-label": l.ariaLabel,
834
+ "aria-label": a.ariaLabel,
794
835
  tabindex: "0",
795
- onScrollPassive: X,
796
- onKeydown: se
836
+ onScrollPassive: ae,
837
+ onKeydown: he
797
838
  }, [
798
- l.items.length ? (S(), I(we, { key: 0 }, [
799
- P.value > 0 ? (S(), I("div", {
839
+ a.items.length ? (x(), T(ze, { key: 0 }, [
840
+ V.value > 0 ? (x(), T("div", {
800
841
  key: 0,
801
842
  class: "vue-short-media-feed__spacer",
802
- style: C({ height: `${P.value}px` }),
843
+ style: C({ height: `${V.value}px` }),
803
844
  "aria-hidden": "true"
804
- }, null, 4)) : me("", !0),
805
- (S(!0), I(we, null, ze(D.value, ({ item: F, index: re }) => (S(), I("div", {
806
- key: u(Y)(F, re),
845
+ }, null, 4)) : xe("", !0),
846
+ (x(!0), T(ze, null, Ee(A.value, ({ item: D, index: ve }) => (x(), T("div", {
847
+ key: c(W)(D, ve),
807
848
  class: "vue-short-media-feed__item",
808
- style: C({ height: `${E.value}px` }),
849
+ style: C({ height: `${p.value}px` }),
809
850
  role: "listitem",
810
- "aria-current": re === s.value ? "true" : void 0,
811
- "aria-posinset": re + 1,
812
- "aria-setsize": l.items.length
851
+ "aria-current": ve === r.value ? "true" : void 0,
852
+ "aria-posinset": ve + 1,
853
+ "aria-setsize": a.items.length
813
854
  }, [
814
- ne(p.$slots, "default", {
815
- item: F,
816
- index: re,
817
- active: re === s.value
855
+ ie(v.$slots, "default", {
856
+ item: D,
857
+ index: ve,
858
+ active: ve === r.value
818
859
  })
819
- ], 12, Ze))), 128)),
820
- G.value > 0 ? (S(), I("div", {
860
+ ], 12, Xe))), 128)),
861
+ N.value > 0 ? (x(), T("div", {
821
862
  key: 1,
822
863
  class: "vue-short-media-feed__spacer",
823
- style: C({ height: `${G.value}px` }),
864
+ style: C({ height: `${N.value}px` }),
824
865
  "aria-hidden": "true"
825
- }, null, 4)) : me("", !0)
826
- ], 64)) : (S(), I("div", qe, [
827
- ne(p.$slots, "empty")
866
+ }, null, 4)) : xe("", !0)
867
+ ], 64)) : (x(), T("div", et, [
868
+ ie(v.$slots, "empty")
828
869
  ]))
829
- ], 44, je));
870
+ ], 44, Qe));
830
871
  }
831
- }), Qe = ["aria-label"], Xe = /* @__PURE__ */ xe({
872
+ }), lt = ["aria-label"], at = /* @__PURE__ */ $e({
832
873
  __name: "SkeletonLoader",
833
874
  props: {
834
875
  width: { default: "100%" },
@@ -837,38 +878,38 @@ const Ge = ["aria-label"], Ue = ["aria-posinset", "aria-setsize"], Pe = /* @__PU
837
878
  animated: { type: Boolean, default: !0 },
838
879
  ariaLabel: { default: "Loading…" }
839
880
  },
840
- setup(l) {
841
- const _ = l;
842
- function V(x) {
843
- return typeof x == "number" ? `${Math.max(0, x)}px` : x;
844
- }
845
- const e = n(() => ({
846
- width: V(_.width),
847
- height: V(_.height)
881
+ setup(a) {
882
+ const _ = a;
883
+ function E(y) {
884
+ return typeof y == "number" ? `${Math.max(0, y)}px` : y;
885
+ }
886
+ const e = i(() => ({
887
+ width: E(_.width),
888
+ height: E(_.height)
848
889
  }));
849
- return (x, h) => (S(), I("div", {
850
- class: Ee(["vue-skeleton-loader", [
851
- `vue-skeleton-loader--${l.variant}`,
852
- { "vue-skeleton-loader--animated": l.animated }
890
+ return (y, f) => (x(), T("div", {
891
+ class: Be(["vue-skeleton-loader", [
892
+ `vue-skeleton-loader--${a.variant}`,
893
+ { "vue-skeleton-loader--animated": a.animated }
853
894
  ]]),
854
895
  style: C(e.value),
855
896
  role: "status",
856
- "aria-label": l.ariaLabel
857
- }, null, 14, Qe));
897
+ "aria-label": a.ariaLabel
898
+ }, null, 14, lt));
858
899
  }
859
- }), et = (l, _) => {
860
- const V = l.__vccOpts || l;
861
- for (const [e, x] of _)
862
- V[e] = x;
863
- return V;
864
- }, tt = /* @__PURE__ */ et(Xe, [["__scopeId", "data-v-fc92f61f"]]), lt = ["aria-label"], at = {
900
+ }), ot = (a, _) => {
901
+ const E = a.__vccOpts || a;
902
+ for (const [e, y] of _)
903
+ E[e] = y;
904
+ return E;
905
+ }, nt = /* @__PURE__ */ ot(at, [["__scopeId", "data-v-fc92f61f"]]), it = ["aria-label"], st = {
865
906
  key: 0,
866
907
  class: "vue-virtual-carousel__track",
867
908
  role: "list"
868
- }, ot = ["aria-label", "aria-current"], nt = {
909
+ }, rt = ["aria-label", "aria-current"], ut = {
869
910
  key: 1,
870
911
  class: "vue-virtual-carousel__empty"
871
- }, it = /* @__PURE__ */ xe({
912
+ }, ct = /* @__PURE__ */ $e({
872
913
  name: "VirtualCarousel",
873
914
  __name: "VirtualCarousel",
874
915
  props: {
@@ -891,307 +932,307 @@ const Ge = ["aria-label"], Ue = ["aria-posinset", "aria-setsize"], Pe = /* @__PU
891
932
  responsive: { default: void 0 }
892
933
  },
893
934
  emits: ["update:activeIndex", "change", "reachStart", "reachEnd", "loadMore"],
894
- setup(l, { expose: _, emit: V }) {
895
- const e = l, x = V, h = W(), z = W(0), s = W(0);
896
- let R, N = -1, A, Y, j = !1;
897
- const T = W(!1), { getItemKey: E } = $e({
935
+ setup(a, { expose: _, emit: E }) {
936
+ const e = a, y = E, f = P(), S = P(0), r = P(0);
937
+ let H, U = -1, F, W, Z = !1;
938
+ const L = P(!1), { getItemKey: p } = He({
898
939
  componentName: "VirtualCarousel",
899
940
  items: () => e.items,
900
941
  itemKey: () => e.itemKey
901
- }), L = n(() => Math.max(0, z.value)), B = n(() => {
942
+ }), I = i(() => Math.max(0, S.value)), w = i(() => {
902
943
  if (!e.responsive || e.responsive.length === 0)
903
944
  return {
904
945
  slidesPerView: e.slidesPerView,
905
946
  slidesToScroll: e.slidesToScroll,
906
947
  gap: e.gap
907
948
  };
908
- const t = L.value, a = [...e.responsive].sort(
909
- (c, m) => m.breakpoint - c.breakpoint
949
+ const l = I.value, o = [...e.responsive].sort(
950
+ (h, k) => k.breakpoint - h.breakpoint
910
951
  );
911
- for (const c of a)
912
- if (t >= c.breakpoint)
952
+ for (const h of o)
953
+ if (l >= h.breakpoint)
913
954
  return {
914
- slidesPerView: c.slidesPerView ?? e.slidesPerView,
915
- slidesToScroll: c.slidesToScroll ?? e.slidesToScroll,
916
- gap: c.gap ?? e.gap
955
+ slidesPerView: h.slidesPerView ?? e.slidesPerView,
956
+ slidesToScroll: h.slidesToScroll ?? e.slidesToScroll,
957
+ gap: h.gap ?? e.gap
917
958
  };
918
959
  return {
919
960
  slidesPerView: e.slidesPerView,
920
961
  slidesToScroll: e.slidesToScroll,
921
962
  gap: e.gap
922
963
  };
923
- }), D = n(
964
+ }), A = i(
924
965
  () => Math.max(
925
966
  1,
926
967
  Math.floor(
927
- Number.isFinite(B.value.slidesPerView) ? B.value.slidesPerView : 1
968
+ Number.isFinite(w.value.slidesPerView) ? w.value.slidesPerView : 1
928
969
  )
929
970
  )
930
- ), P = n(
971
+ ), V = i(
931
972
  () => Math.max(
932
973
  1,
933
974
  Math.floor(
934
- Number.isFinite(B.value.slidesToScroll) ? B.value.slidesToScroll : 1
975
+ Number.isFinite(w.value.slidesToScroll) ? w.value.slidesToScroll : 1
935
976
  )
936
977
  )
937
- ), G = n(
938
- () => Math.max(0, Number.isFinite(B.value.gap) ? B.value.gap : 0)
939
- ), te = n(
978
+ ), N = i(
979
+ () => Math.max(0, Number.isFinite(w.value.gap) ? w.value.gap : 0)
980
+ ), K = i(
940
981
  () => Math.max(
941
982
  0,
942
983
  Math.floor(Number.isFinite(e.buffer) ? e.buffer : 0)
943
984
  )
944
- ), le = n(
985
+ ), ee = i(
945
986
  () => Math.max(
946
987
  0,
947
988
  Math.floor(
948
989
  Number.isFinite(e.loadMoreThreshold) ? e.loadMoreThreshold : 0
949
990
  )
950
991
  )
951
- ), w = n(() => Number.isFinite(e.autoplayDelay) ? Math.max(1, e.autoplayDelay) : 3e3), q = n(() => {
952
- if (L.value <= 0) return 0;
953
- const t = (D.value - 1) * G.value;
992
+ ), $ = i(() => Number.isFinite(e.autoplayDelay) ? Math.max(1, e.autoplayDelay) : 3e3), X = i(() => {
993
+ if (I.value <= 0) return 0;
994
+ const l = (A.value - 1) * N.value;
954
995
  return Math.max(
955
996
  1,
956
- (L.value - t) / D.value
997
+ (I.value - l) / A.value
957
998
  );
958
- }), K = n(() => q.value + G.value), J = n(
999
+ }), B = i(() => X.value + N.value), q = i(
959
1000
  () => Math.max(
960
1001
  0,
961
- e.items.length - D.value
1002
+ e.items.length - A.value
962
1003
  )
963
- ), X = n(
964
- () => Math.max(0, s.value - te.value)
965
- ), se = n(
1004
+ ), ae = i(
1005
+ () => Math.max(0, r.value - K.value)
1006
+ ), he = i(
966
1007
  () => Math.min(
967
1008
  e.items.length,
968
- s.value + D.value + te.value
1009
+ r.value + A.value + K.value
969
1010
  )
970
- ), ae = n(
971
- () => e.items.slice(X.value, se.value).map((t, a) => ({
972
- item: t,
973
- index: X.value + a
1011
+ ), oe = i(
1012
+ () => e.items.slice(ae.value, he.value).map((l, o) => ({
1013
+ item: l,
1014
+ index: ae.value + o
974
1015
  }))
975
- ), p = n(() => e.items.length === 0 ? 0 : e.items.length * q.value + (e.items.length - 1) * G.value), f = n(
976
- () => X.value * K.value
977
- ), F = n(
1016
+ ), v = i(() => e.items.length === 0 ? 0 : e.items.length * X.value + (e.items.length - 1) * N.value), M = i(
1017
+ () => ae.value * B.value
1018
+ ), D = i(
978
1019
  () => Math.max(
979
1020
  0,
980
- p.value - se.value * K.value
1021
+ v.value - he.value * B.value
981
1022
  )
982
- ), re = n(() => ({
983
- height: He(e.height)
1023
+ ), ve = i(() => ({
1024
+ height: Ve(e.height)
984
1025
  }));
985
- function Z(t) {
1026
+ function te(l) {
986
1027
  return Math.min(
987
- J.value,
988
- Math.max(0, Math.floor(Number.isFinite(t) ? t : 0))
1028
+ q.value,
1029
+ Math.max(0, Math.floor(Number.isFinite(l) ? l : 0))
989
1030
  );
990
1031
  }
991
- s.value = Z(e.activeIndex);
992
- function he(t) {
993
- return t >= s.value && t < Math.min(
1032
+ r.value = te(e.activeIndex);
1033
+ function ye(l) {
1034
+ return l >= r.value && l < Math.min(
994
1035
  e.items.length,
995
- s.value + D.value
1036
+ r.value + A.value
996
1037
  );
997
1038
  }
998
- function oe() {
999
- if (!e.hasMore || e.loading || N === e.items.length)
1039
+ function ne() {
1040
+ if (!e.hasMore || e.loading || U === e.items.length)
1000
1041
  return;
1001
- const t = e.items.length === 0 ? -1 : Math.min(
1042
+ const l = e.items.length === 0 ? -1 : Math.min(
1002
1043
  e.items.length - 1,
1003
- s.value + D.value - 1
1044
+ r.value + A.value - 1
1004
1045
  );
1005
- e.items.length - 1 - t <= le.value && (N = e.items.length, x("loadMore"));
1006
- }
1007
- function ie(t) {
1008
- const a = Z(t);
1009
- a === s.value || e.items.length === 0 || (s.value = a, x("update:activeIndex", a), x("change", {
1010
- index: a,
1011
- item: e.items[a]
1012
- }), a === 0 && x("reachStart"), a === J.value && x("reachEnd"), oe(), e.autoplay && !T.value && $());
1013
- }
1014
- function ue(t, a = {}) {
1015
- const c = h.value;
1016
- c && (typeof c.scrollTo == "function" ? c.scrollTo({ ...a, left: t }) : c.scrollLeft = t);
1017
- }
1018
- function ve(t, a = {}) {
1019
- if (e.items.length === 0 || K.value <= 0) return;
1020
- const c = Z(t);
1021
- Y = a.behavior === "smooth" ? c : void 0, ie(c), ue(c * K.value, {
1022
- ...a,
1023
- behavior: a.behavior
1046
+ e.items.length - 1 - l <= ee.value && (U = e.items.length, y("loadMore"));
1047
+ }
1048
+ function fe(l) {
1049
+ const o = te(l);
1050
+ o === r.value || e.items.length === 0 || (r.value = o, y("update:activeIndex", o), y("change", {
1051
+ index: o,
1052
+ item: e.items[o]
1053
+ }), o === 0 && y("reachStart"), o === q.value && y("reachEnd"), ne(), e.autoplay && !L.value && z());
1054
+ }
1055
+ function J(l, o = {}) {
1056
+ const h = f.value;
1057
+ h && (typeof h.scrollTo == "function" ? h.scrollTo({ ...o, left: l }) : h.scrollLeft = l);
1058
+ }
1059
+ function me(l, o = {}) {
1060
+ if (e.items.length === 0 || B.value <= 0) return;
1061
+ const h = te(l);
1062
+ W = o.behavior === "smooth" ? h : void 0, fe(h), J(h * B.value, {
1063
+ ...o,
1064
+ behavior: o.behavior
1024
1065
  });
1025
1066
  }
1026
- function y(t = "smooth") {
1027
- ve(
1028
- s.value + P.value,
1029
- { behavior: t }
1067
+ function m(l = "smooth") {
1068
+ me(
1069
+ r.value + V.value,
1070
+ { behavior: l }
1030
1071
  );
1031
1072
  }
1032
- function H(t = "smooth") {
1033
- ve(
1034
- s.value - P.value,
1035
- { behavior: t }
1073
+ function b(l = "smooth") {
1074
+ me(
1075
+ r.value - V.value,
1076
+ { behavior: l }
1036
1077
  );
1037
1078
  }
1038
- function $() {
1039
- U(), !(!e.autoplay || e.items.length === 0) && (A = setTimeout(() => {
1040
- s.value >= J.value ? e.autoplayLoop ? ve(0, { behavior: "smooth" }) : U() : y("smooth");
1041
- }, w.value));
1079
+ function z() {
1080
+ G(), !(!e.autoplay || e.items.length === 0) && (F = setTimeout(() => {
1081
+ r.value >= q.value ? e.autoplayLoop ? me(0, { behavior: "smooth" }) : G() : m("smooth");
1082
+ }, $.value));
1042
1083
  }
1043
- function U() {
1044
- A !== void 0 && (clearTimeout(A), A = void 0);
1084
+ function G() {
1085
+ F !== void 0 && (clearTimeout(F), F = void 0);
1045
1086
  }
1046
- function i() {
1047
- T.value = !0, e.pauseOnHover && U();
1087
+ function Me() {
1088
+ L.value = !0, e.pauseOnHover && G();
1048
1089
  }
1049
- function d() {
1050
- T.value = !1, e.autoplay && $();
1090
+ function se() {
1091
+ L.value = !1, e.autoplay && z();
1051
1092
  }
1052
- function r() {
1053
- Y = void 0;
1054
- }
1055
- function M(t) {
1056
- if (K.value <= 0 || j) return;
1057
- const a = t.currentTarget.scrollLeft;
1058
- if (Y !== void 0) {
1059
- const c = Y * K.value;
1060
- if (Math.abs(a - c) > 1) return;
1061
- Y = void 0;
1093
+ function ue() {
1094
+ W = void 0;
1095
+ }
1096
+ function Y(l) {
1097
+ if (B.value <= 0 || Z) return;
1098
+ const o = l.currentTarget.scrollLeft;
1099
+ if (W !== void 0) {
1100
+ const h = W * B.value;
1101
+ if (Math.abs(o - h) > 1) return;
1102
+ W = void 0;
1062
1103
  }
1063
- ie(Math.round(a / K.value));
1104
+ fe(Math.round(o / B.value));
1064
1105
  }
1065
- function g(t) {
1066
- t.key === "ArrowRight" || t.key === "PageDown" ? (t.preventDefault(), y()) : t.key === "ArrowLeft" || t.key === "PageUp" ? (t.preventDefault(), H()) : t.key === "Home" ? (t.preventDefault(), ve(0, { behavior: "smooth" })) : t.key === "End" && (t.preventDefault(), ve(J.value, { behavior: "auto" }));
1106
+ function j(l) {
1107
+ l.key === "ArrowRight" || l.key === "PageDown" ? (l.preventDefault(), m()) : l.key === "ArrowLeft" || l.key === "PageUp" ? (l.preventDefault(), b()) : l.key === "Home" ? (l.preventDefault(), me(0, { behavior: "smooth" })) : l.key === "End" && (l.preventDefault(), me(q.value, { behavior: "auto" }));
1067
1108
  }
1068
- function o() {
1069
- var a;
1070
- const t = ((a = h.value) == null ? void 0 : a.clientWidth) ?? 0;
1071
- t <= 0 || t === z.value || (j = !0, z.value = t, O(() => {
1072
- const c = Z(s.value);
1073
- ue(c * K.value), j = !1;
1109
+ function s() {
1110
+ var o;
1111
+ const l = ((o = f.value) == null ? void 0 : o.clientWidth) ?? 0;
1112
+ l <= 0 || l === S.value || (Z = !0, S.value = l, O(() => {
1113
+ const h = te(r.value);
1114
+ J(h * B.value), Z = !1;
1074
1115
  }));
1075
1116
  }
1076
- return ee(
1117
+ return le(
1077
1118
  () => e.activeIndex,
1078
- async (t) => {
1079
- const a = Z(t);
1080
- a !== s.value && (r(), s.value = a, await O(), ue(a * K.value), oe());
1119
+ async (l) => {
1120
+ const o = te(l);
1121
+ o !== r.value && (ue(), r.value = o, await O(), J(o * B.value), ne());
1081
1122
  }
1082
- ), ee(
1123
+ ), le(
1083
1124
  () => [
1084
1125
  e.items.length,
1085
- B.value.slidesPerView,
1086
- B.value.gap,
1087
- B.value.slidesToScroll
1126
+ w.value.slidesPerView,
1127
+ w.value.gap,
1128
+ w.value.slidesToScroll
1088
1129
  ],
1089
1130
  async () => {
1090
- const t = Z(s.value);
1091
- e.items.length === 0 ? s.value !== 0 && (s.value = 0, x("update:activeIndex", 0)) : ie(t), await O(), ue(t * K.value), oe(), e.autoplay && e.items.length > 0 && !T.value && $();
1131
+ const l = te(r.value);
1132
+ e.items.length === 0 ? r.value !== 0 && (r.value = 0, y("update:activeIndex", 0)) : fe(l), await O(), J(l * B.value), ne(), e.autoplay && e.items.length > 0 && !L.value && z();
1092
1133
  }
1093
- ), ee(
1134
+ ), le(
1094
1135
  () => e.responsive,
1095
1136
  () => {
1096
1137
  O(() => {
1097
- const t = Z(s.value);
1098
- ue(t * K.value);
1138
+ const l = te(r.value);
1139
+ J(l * B.value);
1099
1140
  });
1100
1141
  },
1101
1142
  { deep: !0 }
1102
- ), ee(
1143
+ ), le(
1103
1144
  () => [
1104
1145
  e.hasMore,
1105
1146
  e.loading,
1106
1147
  e.loadMoreThreshold
1107
1148
  ],
1108
- async ([t]) => {
1109
- t || (N = -1), await O(), oe();
1149
+ async ([l]) => {
1150
+ l || (U = -1), await O(), ne();
1110
1151
  }
1111
- ), ee(
1152
+ ), le(
1112
1153
  () => e.autoplay,
1113
- (t) => {
1114
- t && !T.value ? $() : U();
1154
+ (l) => {
1155
+ l && !L.value ? z() : G();
1115
1156
  }
1116
- ), ee(
1157
+ ), le(
1117
1158
  () => e.autoplayDelay,
1118
1159
  () => {
1119
- e.autoplay && !T.value && $();
1160
+ e.autoplay && !L.value && z();
1120
1161
  }
1121
- ), ee(
1162
+ ), le(
1122
1163
  () => e.autoplayLoop,
1123
- (t) => {
1124
- !e.autoplay || T.value || (!t && s.value >= J.value ? U() : $());
1164
+ (l) => {
1165
+ !e.autoplay || L.value || (!l && r.value >= q.value ? G() : z());
1125
1166
  }
1126
- ), ee(
1167
+ ), le(
1127
1168
  () => e.pauseOnHover,
1128
- (t) => {
1129
- t && T.value ? U() : !t && e.autoplay && $();
1169
+ (l) => {
1170
+ l && L.value ? G() : !l && e.autoplay && z();
1130
1171
  }
1131
- ), Se(async () => {
1132
- o(), typeof ResizeObserver < "u" && h.value && (R = new ResizeObserver(o), R.observe(h.value)), await O(), ue(s.value * K.value), oe(), e.autoplay && $();
1133
- }), Ie(() => {
1134
- R && (R.disconnect(), R = void 0), U();
1172
+ ), ke(async () => {
1173
+ s(), typeof ResizeObserver < "u" && f.value && (H = new ResizeObserver(s), H.observe(f.value)), await O(), J(r.value * B.value), ne(), e.autoplay && z();
1174
+ }), Le(() => {
1175
+ H && (H.disconnect(), H = void 0), G();
1135
1176
  }), _({
1136
- next: y,
1137
- previous: H,
1138
- scrollToIndex: ve,
1139
- startAutoplay: $,
1140
- stopAutoplay: U
1141
- }), (t, a) => (S(), I("div", {
1177
+ next: m,
1178
+ previous: b,
1179
+ scrollToIndex: me,
1180
+ startAutoplay: z,
1181
+ stopAutoplay: G
1182
+ }), (l, o) => (x(), T("div", {
1142
1183
  ref_key: "viewport",
1143
- ref: h,
1184
+ ref: f,
1144
1185
  class: "vue-virtual-carousel",
1145
- style: C(re.value),
1186
+ style: C(ve.value),
1146
1187
  role: "region",
1147
1188
  "aria-roledescription": "carousel",
1148
- "aria-label": l.ariaLabel,
1189
+ "aria-label": a.ariaLabel,
1149
1190
  tabindex: "0",
1150
- onScrollPassive: M,
1151
- onPointerdown: r,
1152
- onWheelPassive: r,
1153
- onKeydown: g,
1154
- onMouseenter: i,
1155
- onMouseleave: d
1191
+ onScrollPassive: Y,
1192
+ onPointerdown: ue,
1193
+ onWheelPassive: ue,
1194
+ onKeydown: j,
1195
+ onMouseenter: Me,
1196
+ onMouseleave: se
1156
1197
  }, [
1157
- l.items.length ? (S(), I("div", at, [
1158
- f.value > 0 ? (S(), I("div", {
1198
+ a.items.length ? (x(), T("div", st, [
1199
+ M.value > 0 ? (x(), T("div", {
1159
1200
  key: 0,
1160
1201
  class: "vue-virtual-carousel__spacer",
1161
- style: C({ flexBasis: `${f.value}px` }),
1202
+ style: C({ flexBasis: `${M.value}px` }),
1162
1203
  "aria-hidden": "true"
1163
- }, null, 4)) : me("", !0),
1164
- (S(!0), I(we, null, ze(ae.value, ({ item: c, index: m }) => (S(), I("div", {
1165
- key: u(E)(c, m),
1204
+ }, null, 4)) : xe("", !0),
1205
+ (x(!0), T(ze, null, Ee(oe.value, ({ item: h, index: k }) => (x(), T("div", {
1206
+ key: c(p)(h, k),
1166
1207
  class: "vue-virtual-carousel__item",
1167
1208
  style: C({
1168
- flexBasis: `${q.value}px`,
1169
- marginRight: m < l.items.length - 1 ? `${G.value}px` : "0px"
1209
+ flexBasis: `${X.value}px`,
1210
+ marginRight: k < a.items.length - 1 ? `${N.value}px` : "0px"
1170
1211
  }),
1171
1212
  role: "listitem",
1172
1213
  "aria-roledescription": "slide",
1173
- "aria-label": `${m + 1} of ${l.items.length}`,
1174
- "aria-current": m === s.value ? "true" : void 0
1214
+ "aria-label": `${k + 1} of ${a.items.length}`,
1215
+ "aria-current": k === r.value ? "true" : void 0
1175
1216
  }, [
1176
- ne(t.$slots, "default", {
1177
- item: c,
1178
- index: m,
1179
- active: m === s.value,
1180
- visible: he(m)
1217
+ ie(l.$slots, "default", {
1218
+ item: h,
1219
+ index: k,
1220
+ active: k === r.value,
1221
+ visible: ye(k)
1181
1222
  })
1182
- ], 12, ot))), 128)),
1183
- F.value > 0 ? (S(), I("div", {
1223
+ ], 12, rt))), 128)),
1224
+ D.value > 0 ? (x(), T("div", {
1184
1225
  key: 1,
1185
1226
  class: "vue-virtual-carousel__spacer",
1186
- style: C({ flexBasis: `${F.value}px` }),
1227
+ style: C({ flexBasis: `${D.value}px` }),
1187
1228
  "aria-hidden": "true"
1188
- }, null, 4)) : me("", !0)
1189
- ])) : (S(), I("div", nt, [
1190
- ne(t.$slots, "empty")
1229
+ }, null, 4)) : xe("", !0)
1230
+ ])) : (x(), T("div", ut, [
1231
+ ie(l.$slots, "empty")
1191
1232
  ]))
1192
- ], 44, lt));
1233
+ ], 44, it));
1193
1234
  }
1194
- }), st = ["aria-label"], rt = ["aria-posinset", "aria-setsize"], ut = /* @__PURE__ */ xe({
1235
+ }), dt = ["aria-label"], vt = ["aria-posinset", "aria-setsize"], ft = /* @__PURE__ */ $e({
1195
1236
  name: "VirtualScroll",
1196
1237
  __name: "VirtualScroll",
1197
1238
  props: {
@@ -1210,210 +1251,210 @@ const Ge = ["aria-label"], Ue = ["aria-posinset", "aria-setsize"], Pe = /* @__PU
1210
1251
  pullRefreshThreshold: { default: 64 }
1211
1252
  },
1212
1253
  emits: ["scroll", "loadMore", "refresh"],
1213
- setup(l, { expose: _, emit: V }) {
1214
- const e = l, x = V, {
1215
- pulling: h,
1216
- pullDistance: z,
1217
- pullOffset: s,
1218
- pullProgress: R,
1219
- refreshMessage: N,
1220
- refreshThreshold: A,
1221
- handleTouchStart: Y,
1222
- handleTouchMove: j,
1223
- handleTouchEnd: T,
1224
- handleTouchCancel: E
1225
- } = Oe({
1254
+ setup(a, { expose: _, emit: E }) {
1255
+ const e = a, y = E, {
1256
+ pulling: f,
1257
+ pullDistance: S,
1258
+ pullOffset: r,
1259
+ pullProgress: H,
1260
+ refreshMessage: U,
1261
+ refreshThreshold: F,
1262
+ handleTouchStart: W,
1263
+ handleTouchMove: Z,
1264
+ handleTouchEnd: L,
1265
+ handleTouchCancel: p
1266
+ } = Ke({
1226
1267
  enabled: () => e.pullToRefresh,
1227
1268
  refreshing: () => e.refreshing,
1228
1269
  threshold: () => e.pullRefreshThreshold,
1229
- onRefresh: () => x("refresh")
1230
- }), L = W(), B = W(0), D = W(0);
1231
- let P, G = -1;
1232
- const te = Re(), { getItemKey: le } = $e({
1270
+ onRefresh: () => y("refresh")
1271
+ }), I = P(), w = P(0), A = P(0);
1272
+ let V, N = -1;
1273
+ const K = Ce(), { getItemKey: ee } = He({
1233
1274
  componentName: "VirtualScroll",
1234
1275
  items: () => e.items,
1235
1276
  itemKey: () => e.itemKey
1236
- }), w = n(() => Math.max(1, e.itemSize)), q = n(() => Math.max(0, Math.floor(e.overscan))), K = n(
1237
- () => e.items.length * w.value
1238
- ), J = n(
1239
- () => Math.max(1, e.loadingItemSize ?? w.value)
1240
- ), X = n(
1241
- () => K.value + (e.loading ? J.value : 0)
1242
- ), se = n(() => D.value > 0 ? D.value : typeof e.height == "number" ? e.height : 0), ae = n(
1277
+ }), $ = i(() => Math.max(1, e.itemSize)), X = i(() => Math.max(0, Math.floor(e.overscan))), B = i(
1278
+ () => e.items.length * $.value
1279
+ ), q = i(
1280
+ () => Math.max(1, e.loadingItemSize ?? $.value)
1281
+ ), ae = i(
1282
+ () => B.value + (e.loading ? q.value : 0)
1283
+ ), he = i(() => A.value > 0 ? A.value : typeof e.height == "number" ? e.height : 0), oe = i(
1243
1284
  () => Math.max(
1244
1285
  0,
1245
- Math.floor(B.value / w.value) - q.value
1286
+ Math.floor(w.value / $.value) - X.value
1246
1287
  )
1247
- ), p = n(() => {
1248
- const y = Math.ceil(
1249
- (B.value + se.value) / w.value
1288
+ ), v = i(() => {
1289
+ const m = Math.ceil(
1290
+ (w.value + he.value) / $.value
1250
1291
  );
1251
1292
  return Math.min(
1252
1293
  e.items.length,
1253
- y + q.value
1294
+ m + X.value
1254
1295
  );
1255
- }), f = n(
1256
- () => e.items.slice(ae.value, p.value).map((y, H) => ({
1257
- item: y,
1258
- index: ae.value + H
1296
+ }), M = i(
1297
+ () => e.items.slice(oe.value, v.value).map((m, b) => ({
1298
+ item: m,
1299
+ index: oe.value + b
1259
1300
  }))
1260
- ), F = n(() => ({
1261
- height: He(e.height)
1262
- })), re = n(() => ({
1263
- transform: `translateY(${ae.value * w.value}px)`
1301
+ ), D = i(() => ({
1302
+ height: Ve(e.height)
1303
+ })), ve = i(() => ({
1304
+ transform: `translateY(${oe.value * $.value}px)`
1264
1305
  }));
1265
- function Z() {
1266
- var y;
1267
- D.value = ((y = L.value) == null ? void 0 : y.clientHeight) ?? 0, te(L.value, e.height), O(oe);
1306
+ function te() {
1307
+ var m;
1308
+ A.value = ((m = I.value) == null ? void 0 : m.clientHeight) ?? 0, K(I.value, e.height), O(ne);
1268
1309
  }
1269
- function he(y) {
1270
- B.value = y.currentTarget.scrollTop, x("scroll", {
1271
- scrollTop: B.value,
1272
- startIndex: ae.value,
1273
- endIndex: p.value
1274
- }), oe();
1310
+ function ye(m) {
1311
+ w.value = m.currentTarget.scrollTop, y("scroll", {
1312
+ scrollTop: w.value,
1313
+ startIndex: oe.value,
1314
+ endIndex: v.value
1315
+ }), ne();
1275
1316
  }
1276
- function oe() {
1277
- const y = L.value;
1278
- if (!y || !e.hasMore || e.loading || G === e.items.length)
1317
+ function ne() {
1318
+ const m = I.value;
1319
+ if (!m || !e.hasMore || e.loading || N === e.items.length)
1279
1320
  return;
1280
- const H = Math.max(0, e.loadMoreThreshold);
1281
- X.value - y.scrollTop - y.clientHeight <= H && (G = e.items.length, x("loadMore"));
1282
- }
1283
- function ie(y, H = {}) {
1284
- const $ = L.value;
1285
- if (!$) return;
1286
- const U = Math.max(0, X.value - $.clientHeight), i = Math.min(
1287
- Math.max(0, Number.isFinite(y) ? y : 0),
1288
- U
1289
- ), d = H.behavior ?? "auto";
1290
- d === "auto" && (B.value = i), $.scrollTo({ ...H, top: i, behavior: d });
1291
- }
1292
- function ue(y, H = {}) {
1293
- const $ = L.value;
1294
- if (!$ || e.items.length === 0) return;
1295
- const U = Math.min(
1321
+ const b = Math.max(0, e.loadMoreThreshold);
1322
+ ae.value - m.scrollTop - m.clientHeight <= b && (N = e.items.length, y("loadMore"));
1323
+ }
1324
+ function fe(m, b = {}) {
1325
+ const z = I.value;
1326
+ if (!z) return;
1327
+ const G = Math.max(0, ae.value - z.clientHeight), Me = Math.min(
1328
+ Math.max(0, Number.isFinite(m) ? m : 0),
1329
+ G
1330
+ ), se = b.behavior ?? "auto";
1331
+ se === "auto" && (w.value = Me), z.scrollTo({ ...b, top: Me, behavior: se });
1332
+ }
1333
+ function J(m, b = {}) {
1334
+ const z = I.value;
1335
+ if (!z || e.items.length === 0) return;
1336
+ const G = Math.min(
1296
1337
  e.items.length - 1,
1297
- Math.max(0, Math.floor(y))
1298
- ), { align: i = "start", ...d } = H;
1299
- let r = U * w.value;
1300
- i === "center" ? r -= ($.clientHeight - w.value) / 2 : i === "end" && (r -= $.clientHeight - w.value), $.scrollTo({
1301
- ...d,
1302
- top: Math.max(0, Math.min(r, X.value - $.clientHeight))
1338
+ Math.max(0, Math.floor(m))
1339
+ ), { align: Me = "start", ...se } = b;
1340
+ let ue = G * $.value;
1341
+ Me === "center" ? ue -= (z.clientHeight - $.value) / 2 : Me === "end" && (ue -= z.clientHeight - $.value), z.scrollTo({
1342
+ ...se,
1343
+ top: Math.max(0, Math.min(ue, ae.value - z.clientHeight))
1303
1344
  });
1304
1345
  }
1305
- function ve(y = "auto") {
1306
- var H;
1307
- (H = L.value) == null || H.scrollTo({ top: 0, behavior: y });
1346
+ function me(m = "auto") {
1347
+ var b;
1348
+ (b = I.value) == null || b.scrollTo({ top: 0, behavior: m });
1308
1349
  }
1309
- return ee(
1350
+ return le(
1310
1351
  () => [e.items.length, e.itemSize],
1311
1352
  async () => {
1312
1353
  await O();
1313
- const y = L.value;
1314
- if (!y) return;
1315
- const H = Math.max(0, X.value - y.clientHeight);
1316
- y.scrollTop > H && (y.scrollTop = H, B.value = H), oe();
1354
+ const m = I.value;
1355
+ if (!m) return;
1356
+ const b = Math.max(0, ae.value - m.clientHeight);
1357
+ m.scrollTop > b && (m.scrollTop = b, w.value = b), ne();
1317
1358
  }
1318
- ), ee(
1359
+ ), le(
1319
1360
  () => [e.hasMore, e.loading],
1320
- async ([y]) => {
1321
- y || (G = -1), await O(), oe();
1361
+ async ([m]) => {
1362
+ m || (N = -1), await O(), ne();
1322
1363
  }
1323
- ), Se(() => {
1324
- Z(), typeof ResizeObserver < "u" && L.value && (P = new ResizeObserver(Z), P.observe(L.value)), O(oe);
1325
- }), Ie(() => {
1326
- P && (P.disconnect(), P = void 0);
1364
+ ), ke(() => {
1365
+ te(), typeof ResizeObserver < "u" && I.value && (V = new ResizeObserver(te), V.observe(I.value)), O(ne);
1366
+ }), Le(() => {
1367
+ V && (V.disconnect(), V = void 0);
1327
1368
  }), _({
1328
- scrollTo: ie,
1329
- scrollToIndex: ue,
1330
- scrollToTop: ve
1331
- }), (y, H) => (S(), I("div", {
1369
+ scrollTo: fe,
1370
+ scrollToIndex: J,
1371
+ scrollToTop: me
1372
+ }), (m, b) => (x(), T("div", {
1332
1373
  ref_key: "viewport",
1333
- ref: L,
1334
- class: Ee(["vue-virtual-scroll", { "vue-virtual-scroll--pulling": u(h) }]),
1335
- style: C(F.value),
1374
+ ref: I,
1375
+ class: Be(["vue-virtual-scroll", { "vue-virtual-scroll--pulling": c(f) }]),
1376
+ style: C(D.value),
1336
1377
  role: "list",
1337
- "aria-label": l.ariaLabel,
1378
+ "aria-label": a.ariaLabel,
1338
1379
  tabindex: "0",
1339
- onScrollPassive: he,
1340
- onTouchstartPassive: H[0] || (H[0] = //@ts-ignore
1341
- (...$) => u(Y) && u(Y)(...$)),
1342
- onTouchmove: H[1] || (H[1] = //@ts-ignore
1343
- (...$) => u(j) && u(j)(...$)),
1344
- onTouchend: H[2] || (H[2] = //@ts-ignore
1345
- (...$) => u(T) && u(T)(...$)),
1346
- onTouchcancel: H[3] || (H[3] = //@ts-ignore
1347
- (...$) => u(E) && u(E)(...$))
1380
+ onScrollPassive: ye,
1381
+ onTouchstartPassive: b[0] || (b[0] = //@ts-ignore
1382
+ (...z) => c(W) && c(W)(...z)),
1383
+ onTouchmove: b[1] || (b[1] = //@ts-ignore
1384
+ (...z) => c(Z) && c(Z)(...z)),
1385
+ onTouchend: b[2] || (b[2] = //@ts-ignore
1386
+ (...z) => c(L) && c(L)(...z)),
1387
+ onTouchcancel: b[3] || (b[3] = //@ts-ignore
1388
+ (...z) => c(p) && c(p)(...z))
1348
1389
  }, [
1349
- l.pullToRefresh || l.refreshing ? (S(), I("div", {
1390
+ a.pullToRefresh || a.refreshing ? (x(), T("div", {
1350
1391
  key: 0,
1351
1392
  class: "vue-virtual-scroll__refresh",
1352
1393
  style: C({
1353
- height: `${u(A)}px`,
1354
- transform: `translateY(${u(s) - u(A)}px)`
1394
+ height: `${c(F)}px`,
1395
+ transform: `translateY(${c(r) - c(F)}px)`
1355
1396
  }),
1356
1397
  role: "status",
1357
1398
  "aria-live": "polite"
1358
1399
  }, [
1359
- ne(y.$slots, "refresh", {
1360
- pullDistance: u(z),
1361
- progress: u(R),
1362
- refreshing: l.refreshing
1400
+ ie(m.$slots, "refresh", {
1401
+ pullDistance: c(S),
1402
+ progress: c(H),
1403
+ refreshing: a.refreshing
1363
1404
  }, () => [
1364
- Me(Ve(u(N)), 1)
1405
+ Ie(Oe(c(U)), 1)
1365
1406
  ])
1366
- ], 4)) : me("", !0),
1367
- l.items.length || l.loading ? (S(), I("div", {
1407
+ ], 4)) : xe("", !0),
1408
+ a.items.length || a.loading ? (x(), T("div", {
1368
1409
  key: 1,
1369
1410
  class: "vue-virtual-scroll__spacer",
1370
1411
  style: C({
1371
- height: `${X.value}px`,
1372
- transform: `translateY(${u(s)}px)`
1412
+ height: `${ae.value}px`,
1413
+ transform: `translateY(${c(r)}px)`
1373
1414
  })
1374
1415
  }, [
1375
1416
  De("div", {
1376
1417
  class: "vue-virtual-scroll__content",
1377
- style: C(re.value)
1418
+ style: C(ve.value)
1378
1419
  }, [
1379
- (S(!0), I(we, null, ze(f.value, ({ item: $, index: U }) => (S(), I("div", {
1380
- key: u(le)($, U),
1420
+ (x(!0), T(ze, null, Ee(M.value, ({ item: z, index: G }) => (x(), T("div", {
1421
+ key: c(ee)(z, G),
1381
1422
  class: "vue-virtual-scroll__item",
1382
- style: C({ height: `${w.value}px` }),
1423
+ style: C({ height: `${$.value}px` }),
1383
1424
  role: "listitem",
1384
- "aria-posinset": U + 1,
1385
- "aria-setsize": l.items.length
1425
+ "aria-posinset": G + 1,
1426
+ "aria-setsize": a.items.length
1386
1427
  }, [
1387
- ne(y.$slots, "default", {
1388
- item: $,
1389
- index: U
1428
+ ie(m.$slots, "default", {
1429
+ item: z,
1430
+ index: G
1390
1431
  })
1391
- ], 12, rt))), 128))
1432
+ ], 12, vt))), 128))
1392
1433
  ], 4),
1393
- l.loading ? (S(), I("div", {
1434
+ a.loading ? (x(), T("div", {
1394
1435
  key: 0,
1395
1436
  class: "vue-virtual-scroll__loading",
1396
1437
  style: C({
1397
- height: `${J.value}px`,
1398
- transform: `translateY(${K.value}px)`
1438
+ height: `${q.value}px`,
1439
+ transform: `translateY(${B.value}px)`
1399
1440
  }),
1400
1441
  role: "status",
1401
1442
  "aria-live": "polite"
1402
1443
  }, [
1403
- ne(y.$slots, "loading", {}, () => [
1404
- H[4] || (H[4] = Me("Loading more…", -1))
1444
+ ie(m.$slots, "loading", {}, () => [
1445
+ b[4] || (b[4] = Ie("Loading more…", -1))
1405
1446
  ])
1406
- ], 4)) : me("", !0)
1407
- ], 4)) : (S(), I("div", {
1447
+ ], 4)) : xe("", !0)
1448
+ ], 4)) : (x(), T("div", {
1408
1449
  key: 2,
1409
1450
  class: "vue-virtual-scroll__empty",
1410
- style: C({ transform: `translateY(${u(s)}px)` })
1451
+ style: C({ transform: `translateY(${c(r)}px)` })
1411
1452
  }, [
1412
- ne(y.$slots, "empty")
1453
+ ie(m.$slots, "empty")
1413
1454
  ], 4))
1414
- ], 46, st));
1455
+ ], 46, dt));
1415
1456
  }
1416
- }), ct = ["aria-label"], dt = ["aria-posinset", "aria-setsize"], vt = /* @__PURE__ */ xe({
1457
+ }), ht = ["aria-label"], mt = ["aria-posinset", "aria-setsize"], gt = /* @__PURE__ */ $e({
1417
1458
  name: "WindowDynamicVirtualScroll",
1418
1459
  __name: "WindowDynamicVirtualScroll",
1419
1460
  props: {
@@ -1431,329 +1472,329 @@ const Ge = ["aria-label"], Ue = ["aria-posinset", "aria-setsize"], Pe = /* @__PU
1431
1472
  pullRefreshThreshold: { default: 64 }
1432
1473
  },
1433
1474
  emits: ["scroll", "loadMore", "refresh"],
1434
- setup(l, { expose: _, emit: V }) {
1435
- const e = l, x = V, h = W(), z = W(0), s = W(0), R = W(0), N = W(0), A = /* @__PURE__ */ new Map(), Y = /* @__PURE__ */ new Map(), j = /* @__PURE__ */ new Map();
1436
- let T, E, L, B, D = !1, P = !1, G = -1;
1437
- const { getItemKey: te } = $e({
1475
+ setup(a, { expose: _, emit: E }) {
1476
+ const e = a, y = E, f = P(), S = P(0), r = P(0), H = P(0), U = P(0), F = /* @__PURE__ */ new Map(), W = /* @__PURE__ */ new Map(), Z = /* @__PURE__ */ new Map();
1477
+ let L, p, I, w, A = !1, V = !1, N = -1;
1478
+ const { getItemKey: K } = He({
1438
1479
  componentName: "WindowDynamicVirtualScroll",
1439
1480
  items: () => e.items,
1440
1481
  itemKey: () => e.itemKey
1441
1482
  });
1442
- function le(v) {
1483
+ function ee(d) {
1443
1484
  return typeof window.requestAnimationFrame == "function" ? {
1444
- id: window.requestAnimationFrame(v),
1485
+ id: window.requestAnimationFrame(d),
1445
1486
  type: "animation"
1446
1487
  } : {
1447
- id: window.setTimeout(v, 0),
1488
+ id: window.setTimeout(d, 0),
1448
1489
  type: "timeout"
1449
1490
  };
1450
1491
  }
1451
- function w(v) {
1452
- v && (v.type === "animation" ? window.cancelAnimationFrame(v.id) : window.clearTimeout(v.id));
1492
+ function $(d) {
1493
+ d && (d.type === "animation" ? window.cancelAnimationFrame(d.id) : window.clearTimeout(d.id));
1453
1494
  }
1454
1495
  const {
1455
- pulling: q,
1456
- pullDistance: K,
1457
- pullOffset: J,
1458
- pullProgress: X,
1459
- refreshMessage: se,
1460
- refreshThreshold: ae,
1461
- handleTouchStart: p,
1462
- handleTouchMove: f,
1463
- handleTouchEnd: F,
1464
- handleTouchCancel: re
1465
- } = Oe({
1496
+ pulling: X,
1497
+ pullDistance: B,
1498
+ pullOffset: q,
1499
+ pullProgress: ae,
1500
+ refreshMessage: he,
1501
+ refreshThreshold: oe,
1502
+ handleTouchStart: v,
1503
+ handleTouchMove: M,
1504
+ handleTouchEnd: D,
1505
+ handleTouchCancel: ve
1506
+ } = Ke({
1466
1507
  enabled: () => e.pullToRefresh,
1467
1508
  refreshing: () => e.refreshing,
1468
1509
  threshold: () => e.pullRefreshThreshold,
1469
- onRefresh: () => x("refresh"),
1510
+ onRefresh: () => y("refresh"),
1470
1511
  scrollTop: () => typeof window > "u" ? 0 : Math.max(0, window.scrollY)
1471
- }), Z = n(
1512
+ }), te = i(
1472
1513
  () => Math.max(1, e.estimatedItemSize)
1473
- ), he = n(
1474
- () => Math.max(1, e.loadingItemSize ?? Z.value)
1475
- ), oe = n(() => Math.max(0, Math.floor(e.overscan))), ie = n(() => {
1476
- N.value;
1477
- const v = new Array(e.items.length + 1), k = new Array(e.items.length);
1478
- v[0] = 0;
1479
- for (let b = 0; b < e.items.length; b += 1) {
1480
- const de = te(e.items[b], b), Q = A.get(de) ?? Z.value;
1481
- k[b] = Q, v[b + 1] = v[b] + Q;
1514
+ ), ye = i(
1515
+ () => Math.max(1, e.loadingItemSize ?? te.value)
1516
+ ), ne = i(() => Math.max(0, Math.floor(e.overscan))), fe = i(() => {
1517
+ U.value;
1518
+ const d = new Array(e.items.length + 1), t = new Array(e.items.length);
1519
+ d[0] = 0;
1520
+ for (let n = 0; n < e.items.length; n += 1) {
1521
+ const u = K(e.items[n], n), g = F.get(u) ?? te.value;
1522
+ t[n] = g, d[n + 1] = d[n] + g;
1482
1523
  }
1483
1524
  return {
1484
- offsets: v,
1485
- sizes: k,
1486
- total: v[e.items.length] ?? 0
1525
+ offsets: d,
1526
+ sizes: t,
1527
+ total: d[e.items.length] ?? 0
1487
1528
  };
1488
- }), ue = n(
1489
- () => ie.value.total + (e.loading ? he.value : 0)
1490
- ), ve = n(() => {
1491
- const v = /* @__PURE__ */ new Map();
1492
- return e.items.forEach((k, b) => {
1493
- v.set(te(k, b), b);
1494
- }), v;
1495
- }), y = n(
1496
- () => Math.max(0, z.value - R.value)
1529
+ }), J = i(
1530
+ () => fe.value.total + (e.loading ? ye.value : 0)
1531
+ ), me = i(() => {
1532
+ const d = /* @__PURE__ */ new Map();
1533
+ return e.items.forEach((t, n) => {
1534
+ d.set(K(t, n), n);
1535
+ }), d;
1536
+ }), m = i(
1537
+ () => Math.max(0, S.value - H.value)
1497
1538
  );
1498
- function H(v) {
1539
+ function b(d) {
1499
1540
  if (e.items.length === 0) return 0;
1500
- const k = ie.value.offsets;
1501
- let b = 0, de = e.items.length;
1502
- for (; b < de; ) {
1503
- const Q = Math.floor((b + de) / 2);
1504
- k[Q + 1] <= v ? b = Q + 1 : de = Q;
1541
+ const t = fe.value.offsets;
1542
+ let n = 0, u = e.items.length;
1543
+ for (; n < u; ) {
1544
+ const g = Math.floor((n + u) / 2);
1545
+ t[g + 1] <= d ? n = g + 1 : u = g;
1505
1546
  }
1506
- return Math.min(b, e.items.length - 1);
1547
+ return Math.min(n, e.items.length - 1);
1507
1548
  }
1508
- const $ = n(
1549
+ const z = i(
1509
1550
  () => Math.max(
1510
1551
  0,
1511
- H(y.value) - oe.value
1552
+ b(m.value) - ne.value
1512
1553
  )
1513
- ), U = n(() => {
1554
+ ), G = i(() => {
1514
1555
  if (e.items.length === 0) return 0;
1515
- const v = z.value + s.value - R.value, k = Math.max(
1516
- Z.value,
1517
- v
1518
- ), b = H(k) + 1;
1556
+ const d = S.value + r.value - H.value, t = Math.max(
1557
+ te.value,
1558
+ d
1559
+ ), n = b(t) + 1;
1519
1560
  return Math.min(
1520
1561
  e.items.length,
1521
- b + oe.value
1562
+ n + ne.value
1522
1563
  );
1523
- }), i = n(
1524
- () => e.items.slice($.value, U.value).map((v, k) => {
1525
- const b = $.value + k;
1564
+ }), Me = i(
1565
+ () => e.items.slice(z.value, G.value).map((d, t) => {
1566
+ const n = z.value + t;
1526
1567
  return {
1527
- item: v,
1528
- index: b,
1529
- key: te(v, b),
1530
- top: ie.value.offsets[b]
1568
+ item: d,
1569
+ index: n,
1570
+ key: K(d, n),
1571
+ top: fe.value.offsets[n]
1531
1572
  };
1532
1573
  })
1533
1574
  );
1534
- function d() {
1535
- typeof window > "u" || (z.value = Math.max(0, window.scrollY), s.value = window.innerHeight, h.value && (R.value = h.value.getBoundingClientRect().top + z.value));
1536
- }
1537
- function r() {
1538
- x("scroll", {
1539
- scrollTop: y.value,
1540
- startIndex: $.value,
1541
- endIndex: U.value
1575
+ function se() {
1576
+ typeof window > "u" || (S.value = Math.max(0, window.scrollY), r.value = window.innerHeight, f.value && (H.value = f.value.getBoundingClientRect().top + S.value));
1577
+ }
1578
+ function ue() {
1579
+ y("scroll", {
1580
+ scrollTop: m.value,
1581
+ startIndex: z.value,
1582
+ endIndex: G.value
1542
1583
  });
1543
1584
  }
1544
- function M(v = !1) {
1545
- P && (D || (D = v), !L && (L = le(() => {
1546
- L = void 0, d(), D && (D = !1, r()), t();
1585
+ function Y(d = !1) {
1586
+ V && (A || (A = d), !I && (I = ee(() => {
1587
+ I = void 0, se(), A && (A = !1, ue()), l();
1547
1588
  })));
1548
1589
  }
1549
- function g() {
1550
- M(!0);
1590
+ function j() {
1591
+ Y(!0);
1551
1592
  }
1552
- function o() {
1553
- M();
1593
+ function s() {
1594
+ Y();
1554
1595
  }
1555
- function t() {
1556
- if (typeof window > "u" || !e.hasMore || e.loading || G === e.items.length)
1596
+ function l() {
1597
+ if (typeof window > "u" || !e.hasMore || e.loading || N === e.items.length)
1557
1598
  return;
1558
- const v = Math.max(0, e.loadMoreThreshold), k = R.value + ue.value, b = z.value + s.value;
1559
- k - b <= v && (G = e.items.length, x("loadMore"));
1560
- }
1561
- function a(v) {
1562
- const k = v.borderBoxSize;
1563
- if (k) {
1564
- const b = Array.isArray(k) ? k[0] : k;
1565
- if (b != null && b.blockSize) return b.blockSize;
1599
+ const d = Math.max(0, e.loadMoreThreshold), t = H.value + J.value, n = S.value + r.value;
1600
+ t - n <= d && (N = e.items.length, y("loadMore"));
1601
+ }
1602
+ function o(d) {
1603
+ const t = d.borderBoxSize;
1604
+ if (t) {
1605
+ const n = Array.isArray(t) ? t[0] : t;
1606
+ if (n != null && n.blockSize) return n.blockSize;
1566
1607
  }
1567
- return v.contentRect.height;
1568
- }
1569
- function c(v) {
1570
- const k = ie.value;
1571
- let b = 0, de = !1;
1572
- for (const Q of v) {
1573
- const pe = Q.target, ye = Y.get(pe), ke = a(Q);
1574
- if (ye === void 0 || ke <= 0) continue;
1575
- const Le = A.get(ye) ?? Z.value;
1576
- if (Math.abs(Le - ke) < 0.5) continue;
1577
- const Be = ve.value.get(ye);
1578
- Be !== void 0 && k.offsets[Be + 1] <= y.value && (b += ke - Le), A.set(ye, ke), de = !0;
1608
+ return d.contentRect.height;
1609
+ }
1610
+ function h(d) {
1611
+ const t = fe.value;
1612
+ let n = 0, u = !1;
1613
+ for (const g of d) {
1614
+ const R = g.target, Q = W.get(R), re = o(g);
1615
+ if (Q === void 0 || re <= 0) continue;
1616
+ const ce = F.get(Q) ?? te.value;
1617
+ if (Math.abs(ce - re) < 0.5) continue;
1618
+ const de = me.value.get(Q);
1619
+ de !== void 0 && t.offsets[de + 1] <= m.value && (n += re - ce), F.set(Q, re), u = !0;
1579
1620
  }
1580
- de && (N.value += 1, O(() => {
1581
- if (P) {
1582
- if (b !== 0 && typeof window < "u") {
1583
- const Q = Math.max(
1621
+ u && (U.value += 1, O(() => {
1622
+ if (V) {
1623
+ if (n !== 0 && typeof window < "u") {
1624
+ const g = Math.max(
1584
1625
  0,
1585
- z.value + b
1626
+ S.value + n
1586
1627
  );
1587
- z.value = Q, window.scrollTo({ top: Q, behavior: "auto" });
1628
+ S.value = g, window.scrollTo({ top: g, behavior: "auto" });
1588
1629
  }
1589
- d(), t();
1630
+ se(), l();
1590
1631
  }
1591
1632
  }));
1592
1633
  }
1593
- function m(v) {
1594
- if (P) {
1595
- for (const k of v)
1596
- j.set(k.target, k);
1597
- B || (B = le(() => {
1598
- B = void 0;
1599
- const k = Array.from(j.values());
1600
- j.clear(), c(k);
1634
+ function k(d) {
1635
+ if (V) {
1636
+ for (const t of d)
1637
+ Z.set(t.target, t);
1638
+ w || (w = ee(() => {
1639
+ w = void 0;
1640
+ const t = Array.from(Z.values());
1641
+ Z.clear(), h(t);
1601
1642
  }));
1602
1643
  }
1603
1644
  }
1604
- function ce(v, k) {
1605
- v instanceof HTMLElement && (Y.set(v, k), E == null || E.observe(v));
1645
+ function ge(d, t) {
1646
+ d instanceof HTMLElement && (W.set(d, t), p == null || p.observe(d));
1606
1647
  }
1607
- function fe() {
1608
- for (const [v] of Y)
1609
- v.isConnected || (E == null || E.unobserve(v), Y.delete(v));
1648
+ function pe() {
1649
+ for (const [d] of W)
1650
+ d.isConnected || (p == null || p.unobserve(d), W.delete(d));
1610
1651
  }
1611
- function ge(v, k = {}) {
1652
+ function we(d, t = {}) {
1612
1653
  if (typeof window > "u") return;
1613
- d();
1614
- const b = Math.max(0, ue.value - s.value), de = Math.min(
1615
- Math.max(0, Number.isFinite(v) ? v : 0),
1616
- b
1617
- ), Q = Math.max(0, R.value + de), pe = k.behavior ?? "auto";
1618
- pe === "auto" && (z.value = Q), window.scrollTo({ ...k, top: Q, behavior: pe });
1619
- }
1620
- function Te(v, k = {}) {
1654
+ se();
1655
+ const n = Math.max(0, J.value - r.value), u = Math.min(
1656
+ Math.max(0, Number.isFinite(d) ? d : 0),
1657
+ n
1658
+ ), g = Math.max(0, H.value + u), R = t.behavior ?? "auto";
1659
+ R === "auto" && (S.value = g), window.scrollTo({ ...t, top: g, behavior: R });
1660
+ }
1661
+ function be(d, t = {}) {
1621
1662
  if (typeof window > "u" || e.items.length === 0) return;
1622
- d();
1623
- const b = Math.min(
1663
+ se();
1664
+ const n = Math.min(
1624
1665
  e.items.length - 1,
1625
- Math.max(0, Math.floor(v))
1626
- ), { align: de = "start", ...Q } = k, pe = ie.value.sizes[b];
1627
- let ye = R.value + ie.value.offsets[b];
1628
- de === "center" ? ye -= (s.value - pe) / 2 : de === "end" && (ye -= s.value - pe);
1629
- const ke = Math.max(
1630
- R.value,
1631
- R.value + ue.value - s.value
1632
- ), Le = Math.max(0, Math.min(ye, ke)), Be = Q.behavior ?? "auto";
1633
- Be === "auto" && (z.value = Le), window.scrollTo({
1634
- ...Q,
1635
- top: Le,
1636
- behavior: Be
1666
+ Math.max(0, Math.floor(d))
1667
+ ), { align: u = "start", ...g } = t, R = fe.value.sizes[n];
1668
+ let Q = H.value + fe.value.offsets[n];
1669
+ u === "center" ? Q -= (r.value - R) / 2 : u === "end" && (Q -= r.value - R);
1670
+ const re = Math.max(
1671
+ H.value,
1672
+ H.value + J.value - r.value
1673
+ ), ce = Math.max(0, Math.min(Q, re)), de = g.behavior ?? "auto";
1674
+ de === "auto" && (S.value = ce), window.scrollTo({
1675
+ ...g,
1676
+ top: ce,
1677
+ behavior: de
1637
1678
  });
1638
1679
  }
1639
- function be(v = "auto") {
1640
- typeof window > "u" || (d(), window.scrollTo({ top: Math.max(0, R.value), behavior: v }));
1680
+ function Te(d = "auto") {
1681
+ typeof window > "u" || (se(), window.scrollTo({ top: Math.max(0, H.value), behavior: d }));
1641
1682
  }
1642
- return ee(
1683
+ return le(
1643
1684
  () => e.itemKey,
1644
1685
  () => {
1645
- A.clear(), N.value += 1, G = -1;
1686
+ F.clear(), U.value += 1, N = -1;
1646
1687
  }
1647
- ), ee(
1648
- () => e.items.map((v, k) => te(v, k)),
1649
- async (v, k) => {
1650
- const b = v.length !== k.length || v.some((Q, pe) => Q !== k[pe]), de = new Set(v);
1651
- for (const Q of A.keys())
1652
- de.has(Q) || A.delete(Q);
1653
- b && (G = -1), N.value += 1, await O(), P && (d(), t());
1688
+ ), le(
1689
+ () => e.items.map((d, t) => K(d, t)),
1690
+ async (d, t) => {
1691
+ const n = d.length !== t.length || d.some((g, R) => g !== t[R]), u = new Set(d);
1692
+ for (const g of F.keys())
1693
+ u.has(g) || F.delete(g);
1694
+ n && (N = -1), U.value += 1, await O(), V && (se(), l());
1654
1695
  }
1655
- ), ee(
1696
+ ), le(
1656
1697
  () => [e.hasMore, e.loading],
1657
- async ([v]) => {
1658
- v || (G = -1), await O(), P && (d(), t());
1698
+ async ([d]) => {
1699
+ d || (N = -1), await O(), V && (se(), l());
1659
1700
  }
1660
- ), Se(() => {
1661
- if (P = !0, d(), window.addEventListener("scroll", g, { passive: !0 }), window.addEventListener("resize", o, { passive: !0 }), typeof ResizeObserver < "u") {
1662
- T = new ResizeObserver(() => {
1663
- M();
1664
- }), E = new ResizeObserver(m), h.value && T.observe(h.value);
1665
- for (const [v] of Y)
1666
- E.observe(v);
1701
+ ), ke(() => {
1702
+ if (V = !0, se(), window.addEventListener("scroll", j, { passive: !0 }), window.addEventListener("resize", s, { passive: !0 }), typeof ResizeObserver < "u") {
1703
+ L = new ResizeObserver(() => {
1704
+ Y();
1705
+ }), p = new ResizeObserver(k), f.value && L.observe(f.value);
1706
+ for (const [d] of W)
1707
+ p.observe(d);
1667
1708
  }
1668
1709
  O(() => {
1669
- P && t();
1710
+ V && l();
1670
1711
  });
1671
- }), Ce(fe), Ie(() => {
1672
- P = !1, window.removeEventListener("scroll", g), window.removeEventListener("resize", o), w(L), w(B), L = void 0, B = void 0, D = !1, j.clear(), T && (T.disconnect(), T = void 0), E && (E.disconnect(), E = void 0), Y.clear();
1712
+ }), Ae(pe), Le(() => {
1713
+ V = !1, window.removeEventListener("scroll", j), window.removeEventListener("resize", s), $(I), $(w), I = void 0, w = void 0, A = !1, Z.clear(), L && (L.disconnect(), L = void 0), p && (p.disconnect(), p = void 0), W.clear();
1673
1714
  }), _({
1674
- scrollTo: ge,
1675
- scrollToIndex: Te,
1676
- scrollToTop: be
1677
- }), (v, k) => (S(), I("div", {
1715
+ scrollTo: we,
1716
+ scrollToIndex: be,
1717
+ scrollToTop: Te
1718
+ }), (d, t) => (x(), T("div", {
1678
1719
  ref_key: "root",
1679
- ref: h,
1680
- class: Ee(["vue-window-dynamic-virtual-scroll", { "vue-window-dynamic-virtual-scroll--pulling": u(q) }]),
1720
+ ref: f,
1721
+ class: Be(["vue-window-dynamic-virtual-scroll", { "vue-window-dynamic-virtual-scroll--pulling": c(X) }]),
1681
1722
  role: "list",
1682
- "aria-label": l.ariaLabel,
1683
- onTouchstartPassive: k[0] || (k[0] = //@ts-ignore
1684
- (...b) => u(p) && u(p)(...b)),
1685
- onTouchmove: k[1] || (k[1] = //@ts-ignore
1686
- (...b) => u(f) && u(f)(...b)),
1687
- onTouchend: k[2] || (k[2] = //@ts-ignore
1688
- (...b) => u(F) && u(F)(...b)),
1689
- onTouchcancel: k[3] || (k[3] = //@ts-ignore
1690
- (...b) => u(re) && u(re)(...b))
1723
+ "aria-label": a.ariaLabel,
1724
+ onTouchstartPassive: t[0] || (t[0] = //@ts-ignore
1725
+ (...n) => c(v) && c(v)(...n)),
1726
+ onTouchmove: t[1] || (t[1] = //@ts-ignore
1727
+ (...n) => c(M) && c(M)(...n)),
1728
+ onTouchend: t[2] || (t[2] = //@ts-ignore
1729
+ (...n) => c(D) && c(D)(...n)),
1730
+ onTouchcancel: t[3] || (t[3] = //@ts-ignore
1731
+ (...n) => c(ve) && c(ve)(...n))
1691
1732
  }, [
1692
- l.pullToRefresh || l.refreshing ? (S(), I("div", {
1733
+ a.pullToRefresh || a.refreshing ? (x(), T("div", {
1693
1734
  key: 0,
1694
1735
  class: "vue-window-dynamic-virtual-scroll__refresh",
1695
1736
  style: C({
1696
- height: `${u(ae)}px`,
1697
- transform: `translateY(${u(J) - u(ae)}px)`
1737
+ height: `${c(oe)}px`,
1738
+ transform: `translateY(${c(q) - c(oe)}px)`
1698
1739
  }),
1699
1740
  role: "status",
1700
1741
  "aria-live": "polite"
1701
1742
  }, [
1702
- ne(v.$slots, "refresh", {
1703
- pullDistance: u(K),
1704
- progress: u(X),
1705
- refreshing: l.refreshing
1743
+ ie(d.$slots, "refresh", {
1744
+ pullDistance: c(B),
1745
+ progress: c(ae),
1746
+ refreshing: a.refreshing
1706
1747
  }, () => [
1707
- Me(Ve(u(se)), 1)
1748
+ Ie(Oe(c(he)), 1)
1708
1749
  ])
1709
- ], 4)) : me("", !0),
1710
- l.items.length || l.loading ? (S(), I("div", {
1750
+ ], 4)) : xe("", !0),
1751
+ a.items.length || a.loading ? (x(), T("div", {
1711
1752
  key: 1,
1712
1753
  class: "vue-window-dynamic-virtual-scroll__spacer",
1713
1754
  style: C({
1714
- height: `${ue.value}px`,
1715
- transform: `translateY(${u(J)}px)`
1755
+ height: `${J.value}px`,
1756
+ transform: `translateY(${c(q)}px)`
1716
1757
  })
1717
1758
  }, [
1718
- (S(!0), I(we, null, ze(i.value, ({ item: b, index: de, key: Q, top: pe }) => (S(), I("div", {
1719
- key: Q,
1759
+ (x(!0), T(ze, null, Ee(Me.value, ({ item: n, index: u, key: g, top: R }) => (x(), T("div", {
1760
+ key: g,
1720
1761
  ref_for: !0,
1721
- ref: (ye) => ce(ye, Q),
1762
+ ref: (Q) => ge(Q, g),
1722
1763
  class: "vue-window-dynamic-virtual-scroll__item",
1723
- style: C({ transform: `translateY(${pe}px)` }),
1764
+ style: C({ transform: `translateY(${R}px)` }),
1724
1765
  role: "listitem",
1725
- "aria-posinset": de + 1,
1726
- "aria-setsize": l.items.length
1766
+ "aria-posinset": u + 1,
1767
+ "aria-setsize": a.items.length
1727
1768
  }, [
1728
- ne(v.$slots, "default", {
1729
- item: b,
1730
- index: de
1769
+ ie(d.$slots, "default", {
1770
+ item: n,
1771
+ index: u
1731
1772
  })
1732
- ], 12, dt))), 128)),
1733
- l.loading ? (S(), I("div", {
1773
+ ], 12, mt))), 128)),
1774
+ a.loading ? (x(), T("div", {
1734
1775
  key: 0,
1735
1776
  class: "vue-window-dynamic-virtual-scroll__loading",
1736
1777
  style: C({
1737
- height: `${he.value}px`,
1738
- transform: `translateY(${ie.value.total}px)`
1778
+ height: `${ye.value}px`,
1779
+ transform: `translateY(${fe.value.total}px)`
1739
1780
  }),
1740
1781
  role: "status",
1741
1782
  "aria-live": "polite"
1742
1783
  }, [
1743
- ne(v.$slots, "loading", {}, () => [
1744
- k[4] || (k[4] = Me("Loading more…", -1))
1784
+ ie(d.$slots, "loading", {}, () => [
1785
+ t[4] || (t[4] = Ie("Loading more…", -1))
1745
1786
  ])
1746
- ], 4)) : me("", !0)
1747
- ], 4)) : (S(), I("div", {
1787
+ ], 4)) : xe("", !0)
1788
+ ], 4)) : (x(), T("div", {
1748
1789
  key: 2,
1749
1790
  class: "vue-window-dynamic-virtual-scroll__empty",
1750
- style: C({ transform: `translateY(${u(J)}px)` })
1791
+ style: C({ transform: `translateY(${c(q)}px)` })
1751
1792
  }, [
1752
- ne(v.$slots, "empty")
1793
+ ie(d.$slots, "empty")
1753
1794
  ], 4))
1754
- ], 42, ct));
1795
+ ], 42, ht));
1755
1796
  }
1756
- }), ft = ["aria-label"], ht = ["aria-posinset", "aria-setsize"], mt = /* @__PURE__ */ xe({
1797
+ }), pt = ["aria-label"], yt = ["aria-posinset", "aria-setsize"], Mt = /* @__PURE__ */ $e({
1757
1798
  name: "WindowGirdVirtualScroll",
1758
1799
  __name: "WindowGirdVirtualScroll",
1759
1800
  props: {
@@ -1773,133 +1814,133 @@ const Ge = ["aria-label"], Ue = ["aria-posinset", "aria-setsize"], Pe = /* @__PU
1773
1814
  pullRefreshThreshold: { default: 64 }
1774
1815
  },
1775
1816
  emits: ["scroll", "loadMore", "refresh"],
1776
- setup(l, { expose: _, emit: V }) {
1777
- const e = l, x = V, h = W(), z = W(0), s = W(0), R = W(0);
1778
- let N, A = -1;
1779
- const { getItemKey: Y } = $e({
1817
+ setup(a, { expose: _, emit: E }) {
1818
+ const e = a, y = E, f = P(), S = P(0), r = P(0), H = P(0);
1819
+ let U, F = -1;
1820
+ const { getItemKey: W } = He({
1780
1821
  componentName: "WindowGirdVirtualScroll",
1781
1822
  items: () => e.items,
1782
1823
  itemKey: () => e.itemKey
1783
1824
  }), {
1784
- pulling: j,
1785
- pullDistance: T,
1786
- pullOffset: E,
1787
- pullProgress: L,
1788
- refreshMessage: B,
1789
- refreshThreshold: D,
1790
- handleTouchStart: P,
1791
- handleTouchMove: G,
1792
- handleTouchEnd: te,
1793
- handleTouchCancel: le
1794
- } = Oe({
1825
+ pulling: Z,
1826
+ pullDistance: L,
1827
+ pullOffset: p,
1828
+ pullProgress: I,
1829
+ refreshMessage: w,
1830
+ refreshThreshold: A,
1831
+ handleTouchStart: V,
1832
+ handleTouchMove: N,
1833
+ handleTouchEnd: K,
1834
+ handleTouchCancel: ee
1835
+ } = Ke({
1795
1836
  enabled: () => e.pullToRefresh,
1796
1837
  refreshing: () => e.refreshing,
1797
1838
  threshold: () => e.pullRefreshThreshold,
1798
- onRefresh: () => x("refresh"),
1839
+ onRefresh: () => y("refresh"),
1799
1840
  scrollTop: () => typeof window > "u" ? 0 : Math.max(0, window.scrollY)
1800
- }), w = n(() => Math.max(1, e.itemSize)), q = n(
1841
+ }), $ = i(() => Math.max(1, e.itemSize)), X = i(
1801
1842
  () => Math.max(1, Math.floor(e.columns))
1802
- ), K = n(() => Math.max(0, e.gap)), J = n(() => Math.max(0, Math.floor(e.overscan))), X = n(
1803
- () => Math.max(1, e.loadingItemSize ?? w.value)
1804
- ), se = n(
1805
- () => w.value + K.value
1806
- ), ae = n(
1807
- () => Math.ceil(e.items.length / q.value)
1808
- ), p = n(() => ae.value === 0 ? 0 : ae.value * w.value + (ae.value - 1) * K.value), f = n(
1809
- () => p.value + (e.items.length ? K.value : 0)
1810
- ), F = n(
1811
- () => p.value + (e.loading ? X.value + (e.items.length ? K.value : 0) : 0)
1812
- ), re = n(
1813
- () => Math.max(0, z.value - R.value)
1814
- ), Z = n(
1843
+ ), B = i(() => Math.max(0, e.gap)), q = i(() => Math.max(0, Math.floor(e.overscan))), ae = i(
1844
+ () => Math.max(1, e.loadingItemSize ?? $.value)
1845
+ ), he = i(
1846
+ () => $.value + B.value
1847
+ ), oe = i(
1848
+ () => Math.ceil(e.items.length / X.value)
1849
+ ), v = i(() => oe.value === 0 ? 0 : oe.value * $.value + (oe.value - 1) * B.value), M = i(
1850
+ () => v.value + (e.items.length ? B.value : 0)
1851
+ ), D = i(
1852
+ () => v.value + (e.loading ? ae.value + (e.items.length ? B.value : 0) : 0)
1853
+ ), ve = i(
1854
+ () => Math.max(0, S.value - H.value)
1855
+ ), te = i(
1815
1856
  () => Math.max(
1816
1857
  0,
1817
- Math.floor(re.value / se.value) - J.value
1858
+ Math.floor(ve.value / he.value) - q.value
1818
1859
  )
1819
- ), he = n(() => {
1820
- if (ae.value === 0) return 0;
1821
- const M = Math.max(
1822
- w.value,
1823
- z.value + s.value - R.value
1824
- ), g = Math.ceil(
1825
- (M + K.value) / se.value
1860
+ ), ye = i(() => {
1861
+ if (oe.value === 0) return 0;
1862
+ const Y = Math.max(
1863
+ $.value,
1864
+ S.value + r.value - H.value
1865
+ ), j = Math.ceil(
1866
+ (Y + B.value) / he.value
1826
1867
  );
1827
1868
  return Math.min(
1828
- ae.value,
1829
- g + J.value
1869
+ oe.value,
1870
+ j + q.value
1830
1871
  );
1831
- }), oe = n(
1832
- () => Math.min(e.items.length, Z.value * q.value)
1833
- ), ie = n(
1834
- () => Math.min(e.items.length, he.value * q.value)
1835
- ), ue = n(
1836
- () => e.items.slice(oe.value, ie.value).map((M, g) => {
1837
- const o = oe.value + g;
1872
+ }), ne = i(
1873
+ () => Math.min(e.items.length, te.value * X.value)
1874
+ ), fe = i(
1875
+ () => Math.min(e.items.length, ye.value * X.value)
1876
+ ), J = i(
1877
+ () => e.items.slice(ne.value, fe.value).map((Y, j) => {
1878
+ const s = ne.value + j;
1838
1879
  return {
1839
- item: M,
1840
- index: o,
1841
- key: Y(M, o),
1842
- rowIndex: Math.floor(o / q.value),
1843
- columnIndex: o % q.value
1880
+ item: Y,
1881
+ index: s,
1882
+ key: W(Y, s),
1883
+ rowIndex: Math.floor(s / X.value),
1884
+ columnIndex: s % X.value
1844
1885
  };
1845
1886
  })
1846
- ), ve = n(() => ({
1847
- gridTemplateColumns: `repeat(${q.value}, minmax(0, 1fr))`,
1848
- columnGap: `${K.value}px`,
1849
- rowGap: `${K.value}px`,
1850
- transform: `translateY(${Z.value * se.value}px)`
1887
+ ), me = i(() => ({
1888
+ gridTemplateColumns: `repeat(${X.value}, minmax(0, 1fr))`,
1889
+ columnGap: `${B.value}px`,
1890
+ rowGap: `${B.value}px`,
1891
+ transform: `translateY(${te.value * he.value}px)`
1851
1892
  }));
1852
- function y() {
1853
- typeof window > "u" || (z.value = Math.max(0, window.scrollY), s.value = window.innerHeight, h.value && (R.value = h.value.getBoundingClientRect().top + z.value));
1854
- }
1855
- function H() {
1856
- x("scroll", {
1857
- scrollTop: re.value,
1858
- startIndex: oe.value,
1859
- endIndex: ie.value
1893
+ function m() {
1894
+ typeof window > "u" || (S.value = Math.max(0, window.scrollY), r.value = window.innerHeight, f.value && (H.value = f.value.getBoundingClientRect().top + S.value));
1895
+ }
1896
+ function b() {
1897
+ y("scroll", {
1898
+ scrollTop: ve.value,
1899
+ startIndex: ne.value,
1900
+ endIndex: fe.value
1860
1901
  });
1861
1902
  }
1862
- function $() {
1863
- y(), H(), U();
1903
+ function z() {
1904
+ m(), b(), G();
1864
1905
  }
1865
- function U() {
1866
- if (typeof window > "u" || !e.hasMore || e.loading || A === e.items.length)
1906
+ function G() {
1907
+ if (typeof window > "u" || !e.hasMore || e.loading || F === e.items.length)
1867
1908
  return;
1868
- const M = Math.max(0, e.loadMoreThreshold), g = R.value + F.value, o = z.value + s.value;
1869
- g - o <= M && (A = e.items.length, x("loadMore"));
1909
+ const Y = Math.max(0, e.loadMoreThreshold), j = H.value + D.value, s = S.value + r.value;
1910
+ j - s <= Y && (F = e.items.length, y("loadMore"));
1870
1911
  }
1871
- function i(M, g = {}) {
1912
+ function Me(Y, j = {}) {
1872
1913
  if (typeof window > "u") return;
1873
- y();
1874
- const o = Math.max(0, F.value - s.value), t = Math.min(
1875
- Math.max(0, Number.isFinite(M) ? M : 0),
1876
- o
1877
- ), a = Math.max(0, R.value + t), c = g.behavior ?? "auto";
1878
- c === "auto" && (z.value = a), window.scrollTo({ ...g, top: a, behavior: c });
1879
- }
1880
- function d(M, g = {}) {
1914
+ m();
1915
+ const s = Math.max(0, D.value - r.value), l = Math.min(
1916
+ Math.max(0, Number.isFinite(Y) ? Y : 0),
1917
+ s
1918
+ ), o = Math.max(0, H.value + l), h = j.behavior ?? "auto";
1919
+ h === "auto" && (S.value = o), window.scrollTo({ ...j, top: o, behavior: h });
1920
+ }
1921
+ function se(Y, j = {}) {
1881
1922
  if (typeof window > "u" || e.items.length === 0) return;
1882
- y();
1883
- const o = Math.min(
1923
+ m();
1924
+ const s = Math.min(
1884
1925
  e.items.length - 1,
1885
- Math.max(0, Math.floor(M))
1886
- ), t = Math.floor(o / q.value), { align: a = "start", ...c } = g;
1887
- let m = R.value + t * se.value;
1888
- a === "center" ? m -= (s.value - w.value) / 2 : a === "end" && (m -= s.value - w.value);
1889
- const ce = Math.max(
1890
- R.value,
1891
- R.value + F.value - s.value
1892
- ), fe = Math.max(0, Math.min(m, ce)), ge = c.behavior ?? "auto";
1893
- ge === "auto" && (z.value = fe), window.scrollTo({
1894
- ...c,
1895
- top: fe,
1896
- behavior: ge
1926
+ Math.max(0, Math.floor(Y))
1927
+ ), l = Math.floor(s / X.value), { align: o = "start", ...h } = j;
1928
+ let k = H.value + l * he.value;
1929
+ o === "center" ? k -= (r.value - $.value) / 2 : o === "end" && (k -= r.value - $.value);
1930
+ const ge = Math.max(
1931
+ H.value,
1932
+ H.value + D.value - r.value
1933
+ ), pe = Math.max(0, Math.min(k, ge)), we = h.behavior ?? "auto";
1934
+ we === "auto" && (S.value = pe), window.scrollTo({
1935
+ ...h,
1936
+ top: pe,
1937
+ behavior: we
1897
1938
  });
1898
1939
  }
1899
- function r(M = "auto") {
1900
- typeof window > "u" || (y(), window.scrollTo({ top: Math.max(0, R.value), behavior: M }));
1940
+ function ue(Y = "auto") {
1941
+ typeof window > "u" || (m(), window.scrollTo({ top: Math.max(0, H.value), behavior: Y }));
1901
1942
  }
1902
- return ee(
1943
+ return le(
1903
1944
  () => [
1904
1945
  e.items.length,
1905
1946
  e.itemSize,
@@ -1907,128 +1948,128 @@ const Ge = ["aria-label"], Ue = ["aria-posinset", "aria-setsize"], Pe = /* @__PU
1907
1948
  e.gap
1908
1949
  ],
1909
1950
  async () => {
1910
- await O(), y(), U();
1951
+ await O(), m(), G();
1911
1952
  }
1912
- ), ee(
1953
+ ), le(
1913
1954
  () => [e.hasMore, e.loading],
1914
- async ([M]) => {
1915
- M || (A = -1), await O(), y(), U();
1955
+ async ([Y]) => {
1956
+ Y || (F = -1), await O(), m(), G();
1916
1957
  }
1917
- ), Se(() => {
1918
- y(), window.addEventListener("scroll", $, { passive: !0 }), window.addEventListener("resize", $, { passive: !0 }), typeof ResizeObserver < "u" && (N = new ResizeObserver(() => {
1919
- y(), U();
1920
- }), h.value && N.observe(h.value)), O(U);
1921
- }), Ie(() => {
1922
- window.removeEventListener("scroll", $), window.removeEventListener("resize", $), N && (N.disconnect(), N = void 0);
1958
+ ), ke(() => {
1959
+ m(), window.addEventListener("scroll", z, { passive: !0 }), window.addEventListener("resize", z, { passive: !0 }), typeof ResizeObserver < "u" && (U = new ResizeObserver(() => {
1960
+ m(), G();
1961
+ }), f.value && U.observe(f.value)), O(G);
1962
+ }), Le(() => {
1963
+ window.removeEventListener("scroll", z), window.removeEventListener("resize", z), U && (U.disconnect(), U = void 0);
1923
1964
  }), _({
1924
- scrollTo: i,
1925
- scrollToIndex: d,
1926
- scrollToTop: r
1927
- }), (M, g) => (S(), I("div", {
1965
+ scrollTo: Me,
1966
+ scrollToIndex: se,
1967
+ scrollToTop: ue
1968
+ }), (Y, j) => (x(), T("div", {
1928
1969
  ref_key: "root",
1929
- ref: h,
1930
- class: Ee(["vue-window-gird-virtual-scroll", { "vue-window-gird-virtual-scroll--pulling": u(j) }]),
1970
+ ref: f,
1971
+ class: Be(["vue-window-gird-virtual-scroll", { "vue-window-gird-virtual-scroll--pulling": c(Z) }]),
1931
1972
  role: "list",
1932
- "aria-label": l.ariaLabel,
1933
- onTouchstartPassive: g[0] || (g[0] = //@ts-ignore
1934
- (...o) => u(P) && u(P)(...o)),
1935
- onTouchmove: g[1] || (g[1] = //@ts-ignore
1936
- (...o) => u(G) && u(G)(...o)),
1937
- onTouchend: g[2] || (g[2] = //@ts-ignore
1938
- (...o) => u(te) && u(te)(...o)),
1939
- onTouchcancel: g[3] || (g[3] = //@ts-ignore
1940
- (...o) => u(le) && u(le)(...o))
1973
+ "aria-label": a.ariaLabel,
1974
+ onTouchstartPassive: j[0] || (j[0] = //@ts-ignore
1975
+ (...s) => c(V) && c(V)(...s)),
1976
+ onTouchmove: j[1] || (j[1] = //@ts-ignore
1977
+ (...s) => c(N) && c(N)(...s)),
1978
+ onTouchend: j[2] || (j[2] = //@ts-ignore
1979
+ (...s) => c(K) && c(K)(...s)),
1980
+ onTouchcancel: j[3] || (j[3] = //@ts-ignore
1981
+ (...s) => c(ee) && c(ee)(...s))
1941
1982
  }, [
1942
- l.pullToRefresh || l.refreshing ? (S(), I("div", {
1983
+ a.pullToRefresh || a.refreshing ? (x(), T("div", {
1943
1984
  key: 0,
1944
1985
  class: "vue-window-gird-virtual-scroll__refresh",
1945
1986
  style: C({
1946
- height: `${u(D)}px`,
1947
- transform: `translateY(${u(E) - u(D)}px)`
1987
+ height: `${c(A)}px`,
1988
+ transform: `translateY(${c(p) - c(A)}px)`
1948
1989
  }),
1949
1990
  role: "status",
1950
1991
  "aria-live": "polite"
1951
1992
  }, [
1952
- ne(M.$slots, "refresh", {
1953
- pullDistance: u(T),
1954
- progress: u(L),
1955
- refreshing: l.refreshing
1993
+ ie(Y.$slots, "refresh", {
1994
+ pullDistance: c(L),
1995
+ progress: c(I),
1996
+ refreshing: a.refreshing
1956
1997
  }, () => [
1957
- Me(Ve(u(B)), 1)
1998
+ Ie(Oe(c(w)), 1)
1958
1999
  ])
1959
- ], 4)) : me("", !0),
1960
- l.items.length || l.loading ? (S(), I("div", {
2000
+ ], 4)) : xe("", !0),
2001
+ a.items.length || a.loading ? (x(), T("div", {
1961
2002
  key: 1,
1962
2003
  class: "vue-window-gird-virtual-scroll__spacer",
1963
2004
  style: C({
1964
- height: `${F.value}px`,
1965
- transform: `translateY(${u(E)}px)`
2005
+ height: `${D.value}px`,
2006
+ transform: `translateY(${c(p)}px)`
1966
2007
  })
1967
2008
  }, [
1968
2009
  De("div", {
1969
2010
  class: "vue-window-gird-virtual-scroll__content",
1970
- style: C(ve.value)
2011
+ style: C(me.value)
1971
2012
  }, [
1972
- (S(!0), I(we, null, ze(ue.value, ({ item: o, index: t, key: a, rowIndex: c, columnIndex: m }) => (S(), I("div", {
1973
- key: a,
2013
+ (x(!0), T(ze, null, Ee(J.value, ({ item: s, index: l, key: o, rowIndex: h, columnIndex: k }) => (x(), T("div", {
2014
+ key: o,
1974
2015
  class: "vue-window-gird-virtual-scroll__item",
1975
- style: C({ height: `${w.value}px` }),
2016
+ style: C({ height: `${$.value}px` }),
1976
2017
  role: "listitem",
1977
- "aria-posinset": t + 1,
1978
- "aria-setsize": l.items.length
2018
+ "aria-posinset": l + 1,
2019
+ "aria-setsize": a.items.length
1979
2020
  }, [
1980
- ne(M.$slots, "default", {
1981
- item: o,
1982
- index: t,
1983
- rowIndex: c,
1984
- columnIndex: m
2021
+ ie(Y.$slots, "default", {
2022
+ item: s,
2023
+ index: l,
2024
+ rowIndex: h,
2025
+ columnIndex: k
1985
2026
  })
1986
- ], 12, ht))), 128))
2027
+ ], 12, yt))), 128))
1987
2028
  ], 4),
1988
- l.loading ? (S(), I("div", {
2029
+ a.loading ? (x(), T("div", {
1989
2030
  key: 0,
1990
2031
  class: "vue-window-gird-virtual-scroll__loading",
1991
2032
  style: C({
1992
- height: `${X.value}px`,
1993
- transform: `translateY(${f.value}px)`
2033
+ height: `${ae.value}px`,
2034
+ transform: `translateY(${M.value}px)`
1994
2035
  }),
1995
2036
  role: "status",
1996
2037
  "aria-live": "polite"
1997
2038
  }, [
1998
- ne(M.$slots, "loading", {}, () => [
1999
- g[4] || (g[4] = Me("Loading more…", -1))
2039
+ ie(Y.$slots, "loading", {}, () => [
2040
+ j[4] || (j[4] = Ie("Loading more…", -1))
2000
2041
  ])
2001
- ], 4)) : me("", !0)
2002
- ], 4)) : (S(), I("div", {
2042
+ ], 4)) : xe("", !0)
2043
+ ], 4)) : (x(), T("div", {
2003
2044
  key: 2,
2004
2045
  class: "vue-window-gird-virtual-scroll__empty",
2005
- style: C({ transform: `translateY(${u(E)}px)` })
2046
+ style: C({ transform: `translateY(${c(p)}px)` })
2006
2047
  }, [
2007
- ne(M.$slots, "empty")
2048
+ ie(Y.$slots, "empty")
2008
2049
  ], 4))
2009
- ], 42, ft));
2050
+ ], 42, pt));
2010
2051
  }
2011
- }), gt = Pe, yt = {
2012
- install(l) {
2013
- l.component("ChatVirtualScroll", _e), l.component("DynamicVirtualScroll", Pe), l.component("ShortMediaFeed", Je), l.component("SkeletonLoader", tt), l.component("VirtualCarousel", it), l.component("VirtualList", gt), l.component("VirtualScroll", ut), l.component(
2052
+ }), wt = Ne, Tt = {
2053
+ install(a) {
2054
+ a.component("ChatVirtualScroll", Ze), a.component("DynamicVirtualScroll", Ne), a.component("ShortMediaFeed", tt), a.component("SkeletonLoader", nt), a.component("VirtualCarousel", ct), a.component("VirtualList", wt), a.component("VirtualScroll", ft), a.component(
2014
2055
  "WindowDynamicVirtualScroll",
2015
- vt
2016
- ), l.component(
2056
+ gt
2057
+ ), a.component(
2017
2058
  "WindowGirdVirtualScroll",
2018
- mt
2059
+ Mt
2019
2060
  );
2020
2061
  }
2021
2062
  };
2022
2063
  export {
2023
- _e as ChatVirtualScroll,
2024
- Pe as DynamicVirtualScroll,
2025
- Je as ShortMediaFeed,
2026
- tt as SkeletonLoader,
2027
- it as VirtualCarousel,
2028
- gt as VirtualList,
2029
- ut as VirtualScroll,
2030
- yt as VueVirtualScroll,
2031
- vt as WindowDynamicVirtualScroll,
2032
- mt as WindowGirdVirtualScroll,
2033
- yt as default
2064
+ Ze as ChatVirtualScroll,
2065
+ Ne as DynamicVirtualScroll,
2066
+ tt as ShortMediaFeed,
2067
+ nt as SkeletonLoader,
2068
+ ct as VirtualCarousel,
2069
+ wt as VirtualList,
2070
+ ft as VirtualScroll,
2071
+ Tt as VueVirtualScroll,
2072
+ gt as WindowDynamicVirtualScroll,
2073
+ Mt as WindowGirdVirtualScroll,
2074
+ Tt as default
2034
2075
  };