vue-virtual-flow 0.0.6 → 0.0.8

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