vue-virtual-flow 0.1.0 → 0.1.1

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,4 +1,4 @@
1
- import { watch as we, ref as ee, defineComponent as Qe, computed as m, shallowRef as ct, nextTick as Z, onMounted as _e, onUpdated as $t, onBeforeUnmount as qe, openBlock as j, createElementBlock as U, normalizeStyle as ue, createElementVNode as lt, mergeProps as Ot, unref as f, renderSlot as Se, createTextVNode as Ue, createCommentVNode as Ve, Fragment as Je, renderList as et, toDisplayString as vt, normalizeClass as ot } from "vue";
1
+ import { watch as ye, ref as X, defineComponent as tt, computed as h, shallowRef as ft, nextTick as Z, onMounted as at, onUpdated as $t, onBeforeUnmount as Xe, openBlock as j, createElementBlock as U, normalizeStyle as re, createElementVNode as rt, mergeProps as Ot, unref as f, renderSlot as Se, createTextVNode as Ge, createCommentVNode as Re, Fragment as et, renderList as nt, toDisplayString as ht, normalizeClass as st } from "vue";
2
2
  function At(t) {
3
3
  return typeof t == "string" || typeof t == "number" || typeof t == "symbol";
4
4
  }
@@ -9,38 +9,38 @@ function zt(t, s) {
9
9
  function Ft(t) {
10
10
  return zt(t, "id") ?? zt(t, "key");
11
11
  }
12
- function tt(t) {
12
+ function lt(t) {
13
13
  const s = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new Map();
14
- function e(M) {
15
- if (At(M)) return M;
16
- if (M !== null && typeof M == "object") {
17
- let c = s.get(M);
18
- return c || (c = Symbol(`${t.componentName} item`), s.set(M, c)), c;
19
- }
20
- let d = I.get(M);
21
- return d || (d = Symbol(`${t.componentName} primitive`), I.set(M, d)), d;
14
+ function e(y) {
15
+ if (At(y)) return y;
16
+ if (y !== null && typeof y == "object") {
17
+ let u = s.get(y);
18
+ return u || (u = Symbol(`${t.componentName} item`), s.set(y, u)), u;
19
+ }
20
+ let r = I.get(y);
21
+ return r || (r = Symbol(`${t.componentName} primitive`), I.set(y, r)), r;
22
22
  }
23
- function x(M, d) {
24
- const c = t.itemKey();
25
- if (typeof c == "function")
26
- return c(M, d);
27
- if (M !== null && typeof M == "object") {
28
- if (c !== void 0) {
29
- const h = zt(M, c);
30
- if (h !== void 0) return h;
23
+ function z(y, r) {
24
+ const u = t.itemKey();
25
+ if (typeof u == "function")
26
+ return u(y, r);
27
+ if (y !== null && typeof y == "object") {
28
+ if (u !== void 0) {
29
+ const M = zt(y, u);
30
+ if (M !== void 0) return M;
31
31
  }
32
- const n = Ft(M);
32
+ const n = Ft(y);
33
33
  if (n !== void 0) return n;
34
34
  }
35
- return e(M);
35
+ return e(y);
36
36
  }
37
- function y() {
37
+ function x() {
38
38
  }
39
- return we(
39
+ return ye(
40
40
  () => [t.itemKey(), t.items(), t.items().length],
41
- y,
41
+ x,
42
42
  { immediate: !0 }
43
- ), { getItemKey: x };
43
+ ), { getItemKey: z };
44
44
  }
45
45
  const Nt = /* @__PURE__ */ new Set([
46
46
  "ArrowDown",
@@ -52,59 +52,59 @@ const Nt = /* @__PURE__ */ new Set([
52
52
  " "
53
53
  ]);
54
54
  function Yt(t) {
55
- const s = ee(!1);
56
- let I = !1, e = !1, x;
57
- function y() {
58
- clearTimeout(x), x = void 0;
55
+ const s = X(!1);
56
+ let I = !1, e = !1, z;
57
+ function x() {
58
+ clearTimeout(z), z = void 0;
59
59
  }
60
- function M(S) {
61
- S !== s.value && (s.value = S, t.onChange(S));
60
+ function y($) {
61
+ $ !== s.value && (s.value = $, t.onChange($));
62
62
  }
63
- function d() {
64
- I || e || (y(), M(!1), t.onSettled());
63
+ function r() {
64
+ I || e || (x(), y(!1), t.onSettled());
65
65
  }
66
- function c() {
67
- y(), (s.value || t.hasProgrammaticScroll()) && !I && !e && (x = setTimeout(d, t.delay()));
66
+ function u() {
67
+ x(), (s.value || t.hasProgrammaticScroll()) && !I && !e && (z = setTimeout(r, t.delay()));
68
68
  }
69
69
  function n() {
70
- t.onInterrupt(), y(), M(!0), t.onStart();
70
+ t.onInterrupt(), x(), y(!0), t.onStart();
71
71
  }
72
- function h() {
72
+ function M() {
73
73
  I = !0, n();
74
74
  }
75
- function $(S) {
76
- I = S.touches.length > 0, c();
75
+ function R($) {
76
+ I = $.touches.length > 0, u();
77
77
  }
78
- function Y() {
79
- n(), c();
78
+ function D() {
79
+ n(), u();
80
80
  }
81
- function A(S) {
82
- t.onInterrupt(), Nt.has(S.key) && (n(), c());
81
+ function b($) {
82
+ t.onInterrupt(), Nt.has($.key) && (n(), u());
83
83
  }
84
- function P(S) {
85
- t.onInterrupt(), S.pointerType === "mouse" && S.target === t.viewport() && (e = !0, n());
84
+ function A($) {
85
+ t.onInterrupt(), $.pointerType === "mouse" && $.target === t.viewport() && (e = !0, n());
86
86
  }
87
- function E() {
88
- e && (e = !1, c());
87
+ function C() {
88
+ e && (e = !1, u());
89
89
  }
90
90
  return {
91
91
  isScrolling: s,
92
- setScrolling: M,
93
- scheduleScrollEnd: c,
94
- handleScrollEnd: d,
95
- handleTouchStart: h,
96
- handleTouchEnd: $,
97
- handleWheel: Y,
98
- handleKeyDown: A,
99
- handlePointerDown: P,
100
- handlePointerUp: E,
101
- dispose: y
92
+ setScrolling: y,
93
+ scheduleScrollEnd: u,
94
+ handleScrollEnd: r,
95
+ handleTouchStart: M,
96
+ handleTouchEnd: R,
97
+ handleWheel: D,
98
+ handleKeyDown: b,
99
+ handlePointerDown: A,
100
+ handlePointerUp: C,
101
+ dispose: x
102
102
  };
103
103
  }
104
- function mt(t) {
104
+ function gt(t) {
105
105
  return t === "fill" ? "100%" : typeof t == "number" ? `${t}px` : t;
106
106
  }
107
- function wt(t) {
107
+ function Mt(t) {
108
108
  return (s, I) => {
109
109
  typeof I == "string" && (I === "fill" || I.trim().endsWith("%"));
110
110
  };
@@ -112,122 +112,122 @@ function wt(t) {
112
112
  function Ne(t) {
113
113
  return (t == null ? void 0 : t.count) ?? 0;
114
114
  }
115
- function dt(t) {
115
+ function vt(t) {
116
116
  return (t == null ? void 0 : t.total) ?? 0;
117
117
  }
118
118
  function kt(t) {
119
- t.count = 1 + Ne(t.left) + Ne(t.right), t.total = t.size + dt(t.left) + dt(t.right), t.left && (t.left.parent = t), t.right && (t.right.parent = t);
119
+ t.count = 1 + Ne(t.left) + Ne(t.right), t.total = t.size + vt(t.left) + vt(t.right), t.left && (t.left.parent = t), t.right && (t.right.parent = t);
120
120
  }
121
- function ft(t, s) {
122
- return t ? s ? t.priority < s.priority ? (t.right = ft(t.right, s), kt(t), t) : (s.left = ft(t, s.left), kt(s), s) : t : s;
121
+ function mt(t, s) {
122
+ return t ? s ? t.priority < s.priority ? (t.right = mt(t.right, s), kt(t), t) : (s.left = mt(t, s.left), kt(s), s) : t : s;
123
123
  }
124
124
  function jt(t) {
125
125
  let s, I = 0;
126
126
  const e = /* @__PURE__ */ new Map();
127
- function x(c) {
127
+ function z(u) {
128
128
  const n = /* @__PURE__ */ new Set();
129
- for (const h of c) {
130
- if (e.has(h.key) || n.has(h.key))
129
+ for (const M of u) {
130
+ if (e.has(M.key) || n.has(M.key))
131
131
  throw new Error(
132
- `[vue-virtual-flow] Duplicate item key \`${String(h.key)}\`. ChatVirtualScroll requires a unique stable key for every message.`
132
+ `[vue-virtual-flow] Duplicate item key \`${String(M.key)}\`. ChatVirtualScroll requires a unique stable key for every message.`
133
133
  );
134
- n.add(h.key);
134
+ n.add(M.key);
135
135
  }
136
136
  }
137
- function y(c) {
137
+ function x(u) {
138
138
  I += 1;
139
139
  let n = Math.imul(I ^ 2654435769, 2246822507);
140
140
  n ^= n >>> 13, n = Math.imul(n, 3266489909) ^ n >>> 16;
141
- const h = {
142
- key: c.key,
143
- size: c.size,
141
+ const M = {
142
+ key: u.key,
143
+ size: u.size,
144
144
  priority: n >>> 0,
145
145
  count: 1,
146
- total: c.size
146
+ total: u.size
147
147
  };
148
- return e.set(c.key, h), h;
148
+ return e.set(u.key, M), M;
149
149
  }
150
- function M(c) {
150
+ function y(u) {
151
151
  let n;
152
- for (const h of c) n = ft(n, y(h));
152
+ for (const M of u) n = mt(n, x(M));
153
153
  return n && (n.parent = void 0), n;
154
154
  }
155
- function d(c) {
156
- let n = s, h = c;
155
+ function r(u) {
156
+ let n = s, M = u;
157
157
  for (; n; ) {
158
- const $ = Ne(n.left);
159
- if (h < $) n = n.left;
158
+ const R = Ne(n.left);
159
+ if (M < R) n = n.left;
160
160
  else {
161
- if (h === $) return n;
162
- h -= $ + 1, n = n.right;
161
+ if (M === R) return n;
162
+ M -= R + 1, n = n.right;
163
163
  }
164
164
  }
165
165
  }
166
- return x(t), s = M(t), {
166
+ return z(t), s = y(t), {
167
167
  get length() {
168
168
  return Ne(s);
169
169
  },
170
170
  get total() {
171
- return dt(s);
171
+ return vt(s);
172
172
  },
173
- getSize(c) {
173
+ getSize(u) {
174
174
  var n;
175
- return ((n = d(c)) == null ? void 0 : n.size) ?? 0;
175
+ return ((n = r(u)) == null ? void 0 : n.size) ?? 0;
176
176
  },
177
- getOffset(c) {
178
- let n = s, h = Math.max(0, Math.min(c, Ne(s))), $ = 0;
179
- for (; n && h > 0; ) {
180
- const Y = Ne(n.left);
181
- h <= Y ? n = n.left : ($ += dt(n.left) + n.size, h -= Y + 1, n = n.right);
177
+ getOffset(u) {
178
+ let n = s, M = Math.max(0, Math.min(u, Ne(s))), R = 0;
179
+ for (; n && M > 0; ) {
180
+ const D = Ne(n.left);
181
+ M <= D ? n = n.left : (R += vt(n.left) + n.size, M -= D + 1, n = n.right);
182
182
  }
183
- return $;
183
+ return R;
184
184
  },
185
- setSize(c, n) {
186
- let h = d(c);
187
- if (!(!h || h.size === n))
188
- for (h.size = n; h; )
189
- kt(h), h = h.parent;
185
+ setSize(u, n) {
186
+ let M = r(u);
187
+ if (!(!M || M.size === n))
188
+ for (M.size = n; M; )
189
+ kt(M), M = M.parent;
190
190
  },
191
- findIndex(c) {
192
- if (!s || c <= 0) return 0;
193
- if (c >= s.total) return s.count - 1;
194
- let n = s, h = 0, $ = c;
191
+ findIndex(u) {
192
+ if (!s || u <= 0) return 0;
193
+ if (u >= s.total) return s.count - 1;
194
+ let n = s, M = 0, R = u;
195
195
  for (; n; ) {
196
- const Y = dt(n.left), A = Ne(n.left);
197
- if ($ < Y)
196
+ const D = vt(n.left), b = Ne(n.left);
197
+ if (R < D)
198
198
  n = n.left;
199
199
  else {
200
- if ($ < Y + n.size)
201
- return h + A;
202
- $ -= Y + n.size, h += A + 1, n = n.right;
200
+ if (R < D + n.size)
201
+ return M + b;
202
+ R -= D + n.size, M += b + 1, n = n.right;
203
203
  }
204
204
  }
205
205
  return Math.max(0, Ne(s) - 1);
206
206
  },
207
- getKey(c) {
207
+ getKey(u) {
208
208
  var n;
209
- return (n = d(c)) == null ? void 0 : n.key;
209
+ return (n = r(u)) == null ? void 0 : n.key;
210
210
  },
211
- getIndex(c) {
212
- let n = e.get(c);
211
+ getIndex(u) {
212
+ let n = e.get(u);
213
213
  if (!n) return;
214
- let h = Ne(n.left);
214
+ let M = Ne(n.left);
215
215
  for (; n.parent; )
216
- n === n.parent.right && (h += Ne(n.parent.left) + 1), n = n.parent;
217
- return n === s ? h : void 0;
216
+ n === n.parent.right && (M += Ne(n.parent.left) + 1), n = n.parent;
217
+ return n === s ? M : void 0;
218
218
  },
219
- getSizeByKey(c) {
219
+ getSizeByKey(u) {
220
220
  var n;
221
- return (n = e.get(c)) == null ? void 0 : n.size;
221
+ return (n = e.get(u)) == null ? void 0 : n.size;
222
222
  },
223
- hasKey(c) {
224
- return e.has(c);
223
+ hasKey(u) {
224
+ return e.has(u);
225
225
  },
226
- append(c) {
227
- c.length !== 0 && (x(c), s = ft(s, M(c)), s && (s.parent = void 0));
226
+ append(u) {
227
+ u.length !== 0 && (z(u), s = mt(s, y(u)), s && (s.parent = void 0));
228
228
  },
229
- prepend(c) {
230
- c.length !== 0 && (x(c), s = ft(M(c), s), s && (s.parent = void 0));
229
+ prepend(u) {
230
+ u.length !== 0 && (z(u), s = mt(y(u), s), s && (s.parent = void 0));
231
231
  }
232
232
  };
233
233
  }
@@ -240,7 +240,7 @@ const Ut = ["aria-label", "aria-live"], qt = {
240
240
  key: 0,
241
241
  class: "vue-chat-virtual-scroll__new-items",
242
242
  role: "status"
243
- }, Zt = /* @__PURE__ */ Qe({
243
+ }, Zt = /* @__PURE__ */ tt({
244
244
  name: "ChatVirtualScroll",
245
245
  inheritAttrs: !1,
246
246
  __name: "ChatVirtualScroll",
@@ -272,320 +272,320 @@ const Ut = ["aria-label", "aria-live"], qt = {
272
272
  },
273
273
  emits: ["scroll", "loadOlder", "bottomChange", "scrollingChange", "newItemsChange", "visibleChange"],
274
274
  setup(t, { expose: s, emit: I }) {
275
- const e = t, x = I, y = ee(), M = ee(0), d = ee(0), c = ee(0), n = ee(0), h = ee(!0), $ = ee(0), Y = ee(), A = /* @__PURE__ */ new Set(), P = /* @__PURE__ */ new Map(), E = /* @__PURE__ */ new Set();
276
- let S, B, K = -1, G = !1, te = 0, ce = !1, R = 0, fe, ne, oe, ie = 0;
277
- const H = wt(), { getItemKey: le } = tt({
275
+ const e = t, z = I, x = X(), y = X(0), r = X(0), u = X(0), n = X(0), M = X(!0), R = X(0), D = X(), b = /* @__PURE__ */ new Set(), A = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new Set();
276
+ let $, B, V = -1, G = !1, Y = 0, se = !1, H = 0, ae, ne, le, ie = 0;
277
+ const te = Mt(), { getItemKey: ue } = lt({
278
278
  componentName: "ChatVirtualScroll",
279
279
  items: () => e.items,
280
280
  itemKey: () => e.itemKey
281
- }), pe = m(
281
+ }), fe = h(
282
282
  () => Number.isFinite(e.estimatedItemSize) ? Math.max(1, e.estimatedItemSize) : 48
283
- ), xe = m(() => Math.max(0, Math.floor(e.overscan))), he = m(
283
+ ), he = h(() => Math.max(0, Math.floor(e.overscan))), ve = h(
284
284
  () => Number.isFinite(e.scrollEndDelay) ? Math.max(0, e.scrollEndDelay) : 150
285
285
  ), {
286
- isScrolling: ae,
287
- setScrolling: F,
288
- scheduleScrollEnd: b,
289
- handleScrollEnd: C,
290
- handleTouchStart: se,
291
- handleTouchEnd: ve,
292
- handleWheel: ke,
293
- handleKeyDown: L,
294
- handlePointerDown: N,
295
- handlePointerUp: J,
296
- dispose: Me
286
+ isScrolling: J,
287
+ setScrolling: O,
288
+ scheduleScrollEnd: S,
289
+ handleScrollEnd: P,
290
+ handleTouchStart: oe,
291
+ handleTouchEnd: me,
292
+ handleWheel: Ae,
293
+ handleKeyDown: E,
294
+ handlePointerDown: F,
295
+ handlePointerUp: _,
296
+ dispose: pe
297
297
  } = Yt({
298
- delay: () => he.value,
299
- viewport: () => y.value,
300
- hasProgrammaticScroll: () => oe !== void 0,
301
- onInterrupt: Le,
298
+ delay: () => ve.value,
299
+ viewport: () => x.value,
300
+ hasProgrammaticScroll: () => le !== void 0,
301
+ onInterrupt: $e,
302
302
  onStart: () => {
303
- d.value = te;
303
+ r.value = Y;
304
304
  },
305
305
  onSettled: () => {
306
- const o = oe;
307
- if (oe = void 0, o) {
306
+ const o = le;
307
+ if (le = void 0, o) {
308
308
  o();
309
309
  return;
310
310
  }
311
- M.value = W(), Ie();
311
+ y.value = L(), xe();
312
312
  },
313
313
  onChange: (o) => {
314
- G && x("scrollingChange", o);
314
+ G && z("scrollingChange", o);
315
315
  }
316
- }), $e = m(
316
+ }), ze = h(
317
317
  () => Number.isFinite(e.maxPinnedItems) ? Math.max(0, Math.floor(e.maxPinnedItems)) : 20
318
- ), be = m(
318
+ ), be = h(
319
319
  () => e.size !== void 0 && Number.isFinite(e.size) && e.size > 0 ? Math.max(1, Math.floor(e.size)) : void 0
320
- ), ye = m(() => c.value > 0 ? c.value : typeof e.height == "number" ? Math.max(0, e.height) : pe.value);
321
- function re(o, u) {
322
- var O;
323
- const w = (O = e.estimateItemSize) == null ? void 0 : O.call(e, o, u);
324
- return Number.isFinite(w) && (w ?? 0) > 0 ? w : pe.value;
320
+ ), Me = h(() => u.value > 0 ? u.value : typeof e.height == "number" ? Math.max(0, e.height) : fe.value);
321
+ function ce(o, c) {
322
+ var N;
323
+ const p = (N = e.estimateItemSize) == null ? void 0 : N.call(e, o, c);
324
+ return Number.isFinite(p) && (p ?? 0) > 0 ? p : fe.value;
325
325
  }
326
326
  function de(o) {
327
- return jt(e.items.map((u, w) => {
328
- const O = le(u, w);
327
+ return jt(e.items.map((c, p) => {
328
+ const N = ue(c, p);
329
329
  return {
330
- key: O,
331
- size: A.has(O) ? (o == null ? void 0 : o.getSizeByKey(O)) ?? re(u, w) : re(u, w)
330
+ key: N,
331
+ size: b.has(N) ? (o == null ? void 0 : o.getSizeByKey(N)) ?? ce(c, p) : ce(c, p)
332
332
  };
333
333
  }));
334
334
  }
335
- const v = ct({ sizes: de() }), T = m(() => (n.value, { sizes: v.value.sizes, total: v.value.sizes.total }));
336
- function r(o = T.value.total) {
337
- return Math.max(0, o - ye.value);
335
+ const v = ft({ sizes: de() }), T = h(() => (n.value, { sizes: v.value.sizes, total: v.value.sizes.total }));
336
+ function i(o = T.value.total) {
337
+ return Math.max(0, o - Me.value);
338
338
  }
339
339
  function q(o) {
340
340
  return T.value.sizes.findIndex(o);
341
341
  }
342
- M.value = e.initialScroll === "bottom" ? r() : 0;
343
- const Q = m(() => {
342
+ y.value = e.initialScroll === "bottom" ? i() : 0;
343
+ const Q = h(() => {
344
344
  if (e.items.length === 0) return { start: 0, end: 0 };
345
- const o = q(M.value), u = q(M.value + ye.value) + 1;
345
+ const o = q(y.value), c = q(y.value + Me.value) + 1;
346
346
  return {
347
347
  start: o,
348
- end: Math.min(e.items.length, u)
348
+ end: Math.min(e.items.length, c)
349
349
  };
350
- }), ze = m(() => {
350
+ }), ke = h(() => {
351
351
  if (e.items.length === 0) return { start: 0, end: 0 };
352
- const o = Q.value.start, u = Q.value.end, w = Math.max(0, o - xe.value), O = Math.min(
352
+ const o = Q.value.start, c = Q.value.end, p = Math.max(0, o - he.value), N = Math.min(
353
353
  e.items.length,
354
- u + xe.value
354
+ c + he.value
355
355
  ), Pe = be.value;
356
- if (Pe === void 0 || O - w <= Pe) return { start: w, end: O };
357
- const Ee = Math.max(0, Pe - (u - o)), De = o - w, Re = O - u;
358
- let Fe = Math.min(De, Math.ceil(Ee / 2));
359
- const Ge = Math.min(Re, Ee - Fe);
360
- return Fe = Math.min(De, Ee - Ge), { start: o - Fe, end: u + Ge };
361
- }), i = m(() => ze.value.start), D = m(() => ze.value.end), _ = m(() => {
356
+ if (Pe === void 0 || N - p <= Pe) return { start: p, end: N };
357
+ const Ce = Math.max(0, Pe - (c - o)), Ve = o - p, Oe = N - c;
358
+ let Fe = Math.min(Ve, Math.ceil(Ce / 2));
359
+ const Je = Math.min(Oe, Ce - Fe);
360
+ return Fe = Math.min(Ve, Ce - Je), { start: o - Fe, end: c + Je };
361
+ }), ge = h(() => ke.value.start), Ee = h(() => ke.value.end), d = h(() => {
362
362
  const o = /* @__PURE__ */ new Set();
363
- for (let u = i.value; u < D.value; u += 1)
364
- o.add(u);
365
- for (const u of e.pinnedKeys.slice(0, $e.value)) {
366
- const w = v.value.sizes.getIndex(u);
367
- w !== void 0 && o.add(w);
363
+ for (let c = ge.value; c < Ee.value; c += 1)
364
+ o.add(c);
365
+ for (const c of e.pinnedKeys.slice(0, ze.value)) {
366
+ const p = v.value.sizes.getIndex(c);
367
+ p !== void 0 && o.add(p);
368
368
  }
369
- if (e.keepFocusedItem && Y.value !== void 0) {
370
- const u = v.value.sizes.getIndex(Y.value);
371
- u !== void 0 && o.add(u);
369
+ if (e.keepFocusedItem && D.value !== void 0) {
370
+ const c = v.value.sizes.getIndex(D.value);
371
+ c !== void 0 && o.add(c);
372
372
  }
373
- return [...o].sort((u, w) => u - w);
374
- }), X = m(() => _.value.map((o) => {
375
- const u = e.items[o];
373
+ return [...o].sort((c, p) => c - p);
374
+ }), K = h(() => d.value.map((o) => {
375
+ const c = e.items[o];
376
376
  return {
377
- item: u,
377
+ item: c,
378
378
  index: o,
379
- key: le(u, o),
380
- bottom: Math.max(T.value.total, ye.value) - T.value.sizes.getOffset(o + 1) + d.value
379
+ key: ue(c, o),
380
+ bottom: Math.max(T.value.total, Me.value) - T.value.sizes.getOffset(o + 1) + r.value
381
381
  };
382
- })), p = m(() => ({
383
- height: mt(e.height)
384
- })), z = m(() => ({
382
+ })), m = h(() => ({
383
+ height: gt(e.height)
384
+ })), w = h(() => ({
385
385
  "vue-chat-virtual-scroll--contained": e.contain
386
- })), k = m(() => h.value && !ae.value ? "polite" : "off");
387
- function me(o) {
388
- var u;
389
- return ((u = e.newItemsLabel) == null ? void 0 : u.call(e, o)) ?? `${o} new ${o === 1 ? "message" : "messages"}`;
390
- }
391
- function W(o = T.value.total) {
392
- var O;
393
- const u = r(o), w = Math.min(0, ((O = y.value) == null ? void 0 : O.scrollTop) ?? 0);
394
- return Math.max(0, Math.min(u, u + w + te));
395
- }
396
- function Ie(o = !1) {
397
- if (ce || (ae.value || oe) && !o || te === 0) return;
398
- ce = !0;
399
- const u = ie, w = ++R;
400
- d.value = 0, Z(() => {
401
- if (w !== R) return;
402
- ce = !1;
403
- const O = y.value;
404
- !O || u !== ie || te === 0 || (te = 0, O.scrollTop = Math.min(0, M.value - r()), ne = O.scrollTop, M.value = W(), a(), V());
386
+ })), k = h(() => M.value && !J.value ? "polite" : "off");
387
+ function ee(o) {
388
+ var c;
389
+ return ((c = e.newItemsLabel) == null ? void 0 : c.call(e, o)) ?? `${o} new ${o === 1 ? "message" : "messages"}`;
390
+ }
391
+ function L(o = T.value.total) {
392
+ var N;
393
+ const c = i(o), p = Math.min(0, ((N = x.value) == null ? void 0 : N.scrollTop) ?? 0);
394
+ return Math.max(0, Math.min(c, c + p + Y));
395
+ }
396
+ function xe(o = !1) {
397
+ if (se || (J.value || le) && !o || Y === 0) return;
398
+ se = !0;
399
+ const c = ie, p = ++H;
400
+ r.value = 0, Z(() => {
401
+ if (p !== H) return;
402
+ se = !1;
403
+ const N = x.value;
404
+ !N || c !== ie || Y === 0 || (Y = 0, N.scrollTop = Math.min(0, y.value - i()), ne = N.scrollTop, y.value = L(), a(), W());
405
405
  });
406
406
  }
407
- function ge(o) {
408
- const u = y.value;
409
- if (u) {
410
- if (te += o, M.value = W(), te === 0 || r() === 0) {
411
- te = 0, d.value = 0;
407
+ function we(o) {
408
+ const c = x.value;
409
+ if (c) {
410
+ if (Y += o, y.value = L(), Y === 0 || i() === 0) {
411
+ Y = 0, r.value = 0;
412
412
  return;
413
413
  }
414
- (ae.value || oe) && !ce ? (d.value = te, u.scrollTop >= -1 && Ie(!0)) : Ie();
414
+ (J.value || le) && !se ? (r.value = Y, c.scrollTop >= -1 && xe(!0)) : xe();
415
415
  }
416
416
  }
417
- function Le() {
418
- fe = void 0, oe = void 0;
417
+ function $e() {
418
+ ae = void 0, le = void 0;
419
419
  }
420
- function He() {
420
+ function De() {
421
421
  if (!e.keepFocusedItem) {
422
- Y.value = void 0;
422
+ D.value = void 0;
423
423
  return;
424
424
  }
425
- const o = document.activeElement, u = o instanceof Element ? o.closest(".vue-chat-virtual-scroll__item") : null;
426
- Y.value = u ? P.get(u) : void 0;
425
+ const o = document.activeElement, c = o instanceof Element ? o.closest(".vue-chat-virtual-scroll__item") : null;
426
+ D.value = c ? A.get(c) : void 0;
427
427
  }
428
- function Oe() {
429
- He();
428
+ function Ie() {
429
+ De();
430
430
  }
431
- function Mt() {
432
- Z(He);
431
+ function Ye() {
432
+ Z(De);
433
433
  }
434
- function ht(o) {
435
- const u = Math.max(0, Math.floor(o));
436
- u !== $.value && ($.value = u, G && x("newItemsChange", u));
434
+ function je(o) {
435
+ const c = Math.max(0, Math.floor(o));
436
+ c !== R.value && (R.value = c, G && z("newItemsChange", c));
437
437
  }
438
- function it() {
439
- ht(0);
438
+ function Ze() {
439
+ je(0);
440
440
  }
441
- function rt() {
442
- x("visibleChange", {
443
- scrollTop: W(),
441
+ function ut() {
442
+ z("visibleChange", {
443
+ scrollTop: L(),
444
444
  startIndex: Q.value.start,
445
445
  endIndex: Q.value.end
446
446
  });
447
447
  }
448
448
  function a() {
449
- const o = y.value;
449
+ const o = x.value;
450
450
  if (!o) return;
451
- const w = Math.max(
451
+ const p = Math.max(
452
452
  0,
453
- T.value.total - W() - o.clientHeight
453
+ T.value.total - L() - o.clientHeight
454
454
  ) <= Math.max(0, e.bottomThreshold);
455
- w !== h.value && (h.value = w, G && x("bottomChange", w)), w && it();
455
+ p !== M.value && (M.value = p, G && z("bottomChange", p)), p && Ze();
456
456
  }
457
457
  function l() {
458
458
  var o;
459
- c.value = ((o = y.value) == null ? void 0 : o.clientHeight) ?? 0, G && (M.value = W()), H(y.value, e.height), Z(() => {
460
- a(), V();
459
+ u.value = ((o = x.value) == null ? void 0 : o.clientHeight) ?? 0, G && (y.value = L()), te(x.value, e.height), Z(() => {
460
+ a(), W();
461
461
  });
462
462
  }
463
463
  function g() {
464
- var o, u;
465
- fe && ne !== void 0 && Math.abs((((o = y.value) == null ? void 0 : o.scrollTop) ?? 0) - ne) > 1 && Le(), M.value = W(), te !== 0 && (((u = y.value) == null ? void 0 : u.scrollTop) ?? 0) >= -1 && Ie(!0), b(), a(), x("scroll", {
466
- scrollTop: M.value,
467
- startIndex: i.value,
468
- endIndex: D.value
469
- }), V();
464
+ var o, c;
465
+ ae && ne !== void 0 && Math.abs((((o = x.value) == null ? void 0 : o.scrollTop) ?? 0) - ne) > 1 && $e(), y.value = L(), Y !== 0 && (((c = x.value) == null ? void 0 : c.scrollTop) ?? 0) >= -1 && xe(!0), S(), a(), z("scroll", {
466
+ scrollTop: y.value,
467
+ startIndex: ge.value,
468
+ endIndex: Ee.value
469
+ }), W();
470
470
  }
471
- function V() {
472
- const o = y.value;
473
- !G || !o || !e.hasOlder || e.loadingOlder || K === e.items.length || W() <= Math.max(0, e.loadOlderThreshold) && (K = e.items.length, x("loadOlder"));
471
+ function W() {
472
+ const o = x.value;
473
+ !G || !o || !e.hasOlder || e.loadingOlder || V === e.items.length || L() <= Math.max(0, e.loadOlderThreshold) && (V = e.items.length, z("loadOlder"));
474
474
  }
475
475
  function Te(o) {
476
- const u = o.borderBoxSize;
477
- if (u) {
478
- const w = Array.isArray(u) ? u[0] : u;
479
- if (w != null && w.blockSize) return w.blockSize;
476
+ const c = o.borderBoxSize;
477
+ if (c) {
478
+ const p = Array.isArray(c) ? c[0] : c;
479
+ if (p != null && p.blockSize) return p.blockSize;
480
480
  }
481
481
  return o.contentRect.height;
482
482
  }
483
- function Be(o) {
484
- const u = T.value.total, w = W(), O = !ae.value && !oe && h.value && e.stickToBottom && (G || e.initialScroll === "bottom"), Pe = q(w + ye.value - 1), Ee = !O && w <= 0;
485
- let De = 0, Re = !1;
486
- for (const { key: pt, height: Xe } of o) {
487
- if (!Number.isFinite(Xe) || Xe <= 0) continue;
488
- const Ye = v.value.sizes.getIndex(pt);
489
- if (Ye === void 0) continue;
490
- const Ze = T.value.sizes.getSize(Ye);
491
- A.add(pt), !(Math.abs(Ze - Xe) < 0.5) && (Ye <= Pe && (De += Xe - Ze), T.value.sizes.setSize(Ye, Xe), Re = !0);
483
+ function Ke(o) {
484
+ const c = T.value.total, p = L(), N = !J.value && !le && M.value && e.stickToBottom && (G || e.initialScroll === "bottom"), Pe = q(p + Me.value - 1), Ce = !N && p <= 0;
485
+ let Ve = 0, Oe = !1;
486
+ for (const { key: yt, height: Qe } of o) {
487
+ if (!Number.isFinite(Qe) || Qe <= 0) continue;
488
+ const Ue = v.value.sizes.getIndex(yt);
489
+ if (Ue === void 0) continue;
490
+ const _e = T.value.sizes.getSize(Ue);
491
+ b.add(yt), !(Math.abs(_e - Qe) < 0.5) && (Ue <= Pe && (Ve += Qe - _e), T.value.sizes.setSize(Ue, Qe), Oe = !0);
492
492
  }
493
- if (!Re) return;
493
+ if (!Oe) return;
494
494
  n.value += 1;
495
- const Fe = r() - r(u), Ge = fe && v.value.sizes.getIndex(fe.key), bt = Ge !== void 0 && fe ? Ct(Ge, fe.align) : O ? r() : Ee ? 0 : w + De;
496
- ge(bt - w - Fe), Z(a);
497
- }
498
- function Ae(o) {
499
- const u = [];
500
- for (const w of o) {
501
- const O = P.get(w.target);
502
- O !== void 0 && u.push({ key: O, height: Te(w) });
495
+ const Fe = i() - i(c), Je = ae && v.value.sizes.getIndex(ae.key), bt = Je !== void 0 && ae ? Ct(Je, ae.align) : N ? i() : Ce ? 0 : p + Ve;
496
+ we(bt - p - Fe), Z(a);
497
+ }
498
+ function Be(o) {
499
+ const c = [];
500
+ for (const p of o) {
501
+ const N = A.get(p.target);
502
+ N !== void 0 && c.push({ key: N, height: Te(p) });
503
503
  }
504
- Be(u);
504
+ Ke(c);
505
505
  }
506
- function We() {
506
+ function He() {
507
507
  const o = [];
508
- for (const u of E) {
509
- const w = P.get(u);
510
- w !== void 0 && u.isConnected && o.push({ key: w, height: u.getBoundingClientRect().height });
508
+ for (const c of C) {
509
+ const p = A.get(c);
510
+ p !== void 0 && c.isConnected && o.push({ key: p, height: c.getBoundingClientRect().height });
511
511
  }
512
- E.clear(), Be(o);
513
- }
514
- function at(o, u) {
515
- o instanceof HTMLElement && P.get(o) !== u && (P.set(o, u), e.syncMeasurement && !A.has(u) && E.add(o), B == null || B.observe(o));
516
- }
517
- function Dt() {
518
- for (const [o] of P)
519
- o.isConnected || (B == null || B.unobserve(o), P.delete(o), E.delete(o));
520
- }
521
- function st(o, u, w = !1) {
522
- const O = y.value;
523
- if (!O) return;
524
- const Pe = W(), Ee = d.value !== 0, De = ++ie;
525
- R += 1, ce = !1, fe = void 0;
526
- const Re = u.behavior ?? "auto";
527
- oe = Re === "smooth" ? () => Et(o) : void 0, te = 0, d.value = 0, F(!1), Me(), Re === "auto" && (M.value = o);
512
+ C.clear(), Ke(o);
513
+ }
514
+ function ot(o, c) {
515
+ o instanceof HTMLElement && A.get(o) !== c && (A.set(o, c), e.syncMeasurement && !b.has(c) && C.add(o), B == null || B.observe(o));
516
+ }
517
+ function Bt() {
518
+ for (const [o] of A)
519
+ o.isConnected || (B == null || B.unobserve(o), A.delete(o), C.delete(o));
520
+ }
521
+ function ct(o, c, p = !1) {
522
+ const N = x.value;
523
+ if (!N) return;
524
+ const Pe = L(), Ce = r.value !== 0, Ve = ++ie;
525
+ H += 1, se = !1, ae = void 0;
526
+ const Oe = c.behavior ?? "auto";
527
+ le = Oe === "smooth" ? () => Et(o) : void 0, Y = 0, r.value = 0, O(!1), pe(), Oe === "auto" && (y.value = o);
528
528
  const Fe = () => {
529
- y.value !== O || De !== ie || (Ee && Re !== "auto" && (O.scrollTop = Pe - r()), w && Re === "auto" ? O.scrollTop = o - r() : O.scrollTo({ ...u, top: o - r(), behavior: Re }), ne = O.scrollTop, Re === "auto" ? M.value = W() : b(), Z(a));
529
+ x.value !== N || Ve !== ie || (Ce && Oe !== "auto" && (N.scrollTop = Pe - i()), p && Oe === "auto" ? N.scrollTop = o - i() : N.scrollTo({ ...c, top: o - i(), behavior: Oe }), ne = N.scrollTop, Oe === "auto" ? y.value = L() : S(), Z(a));
530
530
  };
531
- Ee ? Z(Fe) : Fe();
531
+ Ce ? Z(Fe) : Fe();
532
532
  }
533
- function Et(o, u = {}) {
534
- const w = y.value;
535
- if (!w) return;
536
- const O = Math.max(0, T.value.total - w.clientHeight), Pe = Math.min(
533
+ function Et(o, c = {}) {
534
+ const p = x.value;
535
+ if (!p) return;
536
+ const N = Math.max(0, T.value.total - p.clientHeight), Pe = Math.min(
537
537
  Math.max(0, Number.isFinite(o) ? o : 0),
538
- O
538
+ N
539
539
  );
540
- st(Pe, u);
540
+ ct(Pe, c);
541
541
  }
542
- function Ct(o, u) {
543
- const w = T.value.sizes.getSize(o);
544
- let O = T.value.sizes.getOffset(o);
545
- return u === "center" ? O -= (ye.value - w) / 2 : u === "end" && (O -= ye.value - w), Math.max(0, Math.min(O, r()));
542
+ function Ct(o, c) {
543
+ const p = T.value.sizes.getSize(o);
544
+ let N = T.value.sizes.getOffset(o);
545
+ return c === "center" ? N -= (Me.value - p) / 2 : c === "end" && (N -= Me.value - p), Math.max(0, Math.min(N, i()));
546
546
  }
547
- function Tt(o, u = {}) {
548
- if (!y.value || e.items.length === 0) return;
549
- const w = Math.min(
547
+ function Tt(o, c = {}) {
548
+ if (!x.value || e.items.length === 0) return;
549
+ const p = Math.min(
550
550
  e.items.length - 1,
551
551
  Math.max(0, Math.floor(Number.isFinite(o) ? o : 0))
552
- ), { align: O = "start", ...Pe } = u;
553
- st(Ct(w, O), Pe);
554
- const Ee = v.value.sizes.getKey(w);
555
- u.behavior === "smooth" ? oe = () => {
556
- const De = v.value.sizes.getIndex(Ee);
557
- De !== void 0 && Tt(De, { align: O });
558
- } : fe = { key: Ee, align: O };
559
- }
560
- function Kt(o, u = {}) {
561
- const w = v.value.sizes.getIndex(o);
562
- w !== void 0 && Tt(w, u);
552
+ ), { align: N = "start", ...Pe } = c;
553
+ ct(Ct(p, N), Pe);
554
+ const Ce = v.value.sizes.getKey(p);
555
+ c.behavior === "smooth" ? le = () => {
556
+ const Ve = v.value.sizes.getIndex(Ce);
557
+ Ve !== void 0 && Tt(Ve, { align: N });
558
+ } : ae = { key: Ce, align: N };
559
+ }
560
+ function Kt(o, c = {}) {
561
+ const p = v.value.sizes.getIndex(o);
562
+ p !== void 0 && Tt(p, c);
563
563
  }
564
564
  function Vt() {
565
- return W();
565
+ return L();
566
566
  }
567
567
  function Wt(o = "auto") {
568
- st(0, { behavior: o });
568
+ ct(0, { behavior: o });
569
569
  }
570
- function gt(o = "auto") {
571
- const u = y.value;
572
- if (!u) return;
573
- const w = Math.max(0, T.value.total - u.clientHeight);
574
- st(w, { behavior: o }, !0), o === "smooth" && (oe = () => gt());
570
+ function pt(o = "auto") {
571
+ const c = x.value;
572
+ if (!c) return;
573
+ const p = Math.max(0, T.value.total - c.clientHeight);
574
+ ct(p, { behavior: o }, !0), o === "smooth" && (le = () => pt());
575
575
  }
576
- const Lt = ee(0);
576
+ const Lt = X(0);
577
577
  function Rt() {
578
578
  Lt.value += 1;
579
579
  }
580
- return we(
580
+ return ye(
581
581
  () => {
582
582
  const o = e.items.length;
583
583
  return [
584
584
  e.items,
585
585
  o,
586
- o > 0 ? le(e.items[0], 0) : void 0,
587
- o > 0 ? le(e.items[Math.floor(o / 2)], Math.floor(o / 2)) : void 0,
588
- o > 0 ? le(e.items[o - 1], o - 1) : void 0,
586
+ o > 0 ? ue(e.items[0], 0) : void 0,
587
+ o > 0 ? ue(e.items[Math.floor(o / 2)], Math.floor(o / 2)) : void 0,
588
+ o > 0 ? ue(e.items[o - 1], o - 1) : void 0,
589
589
  e.itemKey,
590
590
  e.estimatedItemSize,
591
591
  e.estimateItemSize,
@@ -593,99 +593,99 @@ const Ut = ["aria-label", "aria-live"], qt = {
593
593
  Lt.value
594
594
  ];
595
595
  },
596
- async (o, u) => {
597
- const w = v.value.sizes, O = w.length, Pe = w.total, Ee = W(Pe), De = w.findIndex(Ee + ye.value - 1), Re = w.getKey(De), Fe = w.getOffset(De + 1), Ge = e.items.length, bt = o[5] !== u[5] || o[6] !== u[6] || o[7] !== u[7], pt = o[8] !== u[8] || o[9] !== u[9];
598
- function Xe(Ce) {
599
- if (O === 0) return !0;
600
- const Ke = /* @__PURE__ */ new Set([0, Math.floor(O / 2), O - 1]);
601
- for (const nt of Ke) {
602
- const yt = Ce + nt;
603
- if (yt >= Ge || w.getKey(nt) !== le(e.items[yt], yt))
596
+ async (o, c) => {
597
+ const p = v.value.sizes, N = p.length, Pe = p.total, Ce = L(Pe), Ve = p.findIndex(Ce + Me.value - 1), Oe = p.getKey(Ve), Fe = p.getOffset(Ve + 1), Je = e.items.length, bt = o[5] !== c[5] || o[6] !== c[6] || o[7] !== c[7], yt = o[8] !== c[8] || o[9] !== c[9];
598
+ function Qe(Le) {
599
+ if (N === 0) return !0;
600
+ const We = /* @__PURE__ */ new Set([0, Math.floor(N / 2), N - 1]);
601
+ for (const it of We) {
602
+ const wt = Le + it;
603
+ if (wt >= Je || p.getKey(it) !== ue(e.items[wt], wt))
604
604
  return !1;
605
605
  }
606
606
  return !0;
607
607
  }
608
- const Ye = Ge - O;
609
- let Ze = "rebuild";
610
- !bt && !pt && Ye > 0 && (Xe(0) ? Ze = "append" : Xe(Ye) && (Ze = "prepend"));
611
- let je = w;
612
- Ze === "append" ? je.append(e.items.slice(O).map((Ce, Ke) => {
613
- const nt = O + Ke;
614
- return { key: le(Ce, nt), size: re(Ce, nt) };
615
- })) : Ze === "prepend" ? je.prepend(e.items.slice(0, Ye).map((Ce, Ke) => ({ key: le(Ce, Ke), size: re(Ce, Ke) }))) : je = de(w), v.value = { sizes: je };
616
- const St = Ze === "append" ? Array.from({ length: Ye }, (Ce, Ke) => O + Ke) : [], It = St.some(
617
- (Ce) => {
618
- var Ke;
619
- return ((Ke = e.forceStickToBottom) == null ? void 0 : Ke.call(e, e.items[Ce], Ce)) === !0;
608
+ const Ue = Je - N;
609
+ let _e = "rebuild";
610
+ !bt && !yt && Ue > 0 && (Qe(0) ? _e = "append" : Qe(Ue) && (_e = "prepend"));
611
+ let qe = p;
612
+ _e === "append" ? qe.append(e.items.slice(N).map((Le, We) => {
613
+ const it = N + We;
614
+ return { key: ue(Le, it), size: ce(Le, it) };
615
+ })) : _e === "prepend" ? qe.prepend(e.items.slice(0, Ue).map((Le, We) => ({ key: ue(Le, We), size: ce(Le, We) }))) : qe = de(p), v.value = { sizes: qe };
616
+ const St = _e === "append" ? Array.from({ length: Ue }, (Le, We) => N + We) : [], It = St.some(
617
+ (Le) => {
618
+ var We;
619
+ return ((We = e.forceStickToBottom) == null ? void 0 : We.call(e, e.items[Le], Le)) === !0;
620
620
  }
621
- ) || !ae.value && !oe && h.value && e.stickToBottom;
622
- St.length > 0 && !It && ht($.value + St.length);
623
- const Pt = Re === void 0 ? void 0 : je.getIndex(Re), Ht = r() - r(Pe);
624
- for (const Ce of A)
625
- je.hasKey(Ce) || A.delete(Ce);
626
- if (je.length === 0 || Pt === void 0) {
627
- te = 0, d.value = 0, M.value = It ? r() : Math.min(Ee, r());
628
- const Ce = M.value, Ke = ie;
629
- await Z(), Ke === ie && v.value.sizes === je && st(Ce, {}, !0);
621
+ ) || !J.value && !le && M.value && e.stickToBottom;
622
+ St.length > 0 && !It && je(R.value + St.length);
623
+ const Pt = Oe === void 0 ? void 0 : qe.getIndex(Oe), Ht = i() - i(Pe);
624
+ for (const Le of b)
625
+ qe.hasKey(Le) || b.delete(Le);
626
+ if (qe.length === 0 || Pt === void 0) {
627
+ Y = 0, r.value = 0, y.value = It ? i() : Math.min(Ce, i());
628
+ const Le = y.value, We = ie;
629
+ await Z(), We === ie && v.value.sizes === qe && ct(Le, {}, !0);
630
630
  } else {
631
- const Ce = je.getOffset(Pt + 1) - Fe, Ke = It ? r() : Ee + Ce;
632
- ge(Ke - Ee - Ht), await Z();
631
+ const Le = qe.getOffset(Pt + 1) - Fe, We = It ? i() : Ce + Le;
632
+ we(We - Ce - Ht), await Z();
633
633
  }
634
- y.value && (M.value = W(), a(), V());
634
+ x.value && (y.value = L(), a(), W());
635
635
  }
636
- ), we(
636
+ ), ye(
637
637
  () => [e.hasOlder, e.loadingOlder],
638
638
  async ([o]) => {
639
- o || (K = -1), await Z(), V();
639
+ o || (V = -1), await Z(), W();
640
640
  }
641
- ), we(
641
+ ), ye(
642
642
  () => e.syncMeasurement,
643
643
  (o) => {
644
- if (E.clear(), !!o) {
645
- for (const [u, w] of P)
646
- A.has(w) || E.add(u);
647
- Z(We);
644
+ if (C.clear(), !!o) {
645
+ for (const [c, p] of A)
646
+ b.has(p) || C.add(c);
647
+ Z(He);
648
648
  }
649
649
  }
650
- ), we(
650
+ ), ye(
651
651
  Q,
652
652
  () => {
653
- G && rt();
653
+ G && ut();
654
654
  },
655
655
  { flush: "post" }
656
- ), _e(() => {
657
- if (window.addEventListener("pointerup", J, { passive: !0 }), window.addEventListener("pointercancel", J, { passive: !0 }), l(), y.value && (y.value.scrollTop = e.initialScroll === "bottom" ? 0 : -r(), M.value = W()), We(), typeof ResizeObserver < "u") {
658
- S = new ResizeObserver(l), B = new ResizeObserver(Ae), y.value && S.observe(y.value);
659
- for (const [o] of P)
656
+ ), at(() => {
657
+ if (window.addEventListener("pointerup", _, { passive: !0 }), window.addEventListener("pointercancel", _, { passive: !0 }), l(), x.value && (x.value.scrollTop = e.initialScroll === "bottom" ? 0 : -i(), y.value = L()), He(), typeof ResizeObserver < "u") {
658
+ $ = new ResizeObserver(l), B = new ResizeObserver(Be), x.value && $.observe(x.value);
659
+ for (const [o] of A)
660
660
  B.observe(o);
661
661
  }
662
662
  Z(() => {
663
- G = !0, a(), V(), rt();
663
+ G = !0, a(), W(), ut();
664
664
  });
665
665
  }), $t(() => {
666
- Dt(), We();
667
- }), qe(() => {
668
- G = !1, window.removeEventListener("pointerup", J), window.removeEventListener("pointercancel", J), Me(), Le(), te = 0, ie += 1, R += 1, S && (S.disconnect(), S = void 0), B && (B.disconnect(), B = void 0), P.clear(), E.clear();
666
+ Bt(), He();
667
+ }), Xe(() => {
668
+ G = !1, window.removeEventListener("pointerup", _), window.removeEventListener("pointercancel", _), pe(), $e(), Y = 0, ie += 1, H += 1, $ && ($.disconnect(), $ = void 0), B && (B.disconnect(), B = void 0), A.clear(), C.clear();
669
669
  }), s({
670
- isAtBottom: h,
671
- isScrolling: ae,
672
- newItemsCount: $,
673
- clearNewItems: it,
670
+ isAtBottom: M,
671
+ isScrolling: J,
672
+ newItemsCount: R,
673
+ clearNewItems: Ze,
674
674
  refresh: Rt,
675
675
  getScrollPosition: Vt,
676
676
  scrollTo: Et,
677
677
  scrollToIndex: Tt,
678
678
  scrollToKey: Kt,
679
679
  scrollToTop: Wt,
680
- scrollToBottom: gt
681
- }), (o, u) => (j(), U("div", {
680
+ scrollToBottom: pt
681
+ }), (o, c) => (j(), U("div", {
682
682
  class: "vue-chat-virtual-scroll__root",
683
- style: ue(p.value)
683
+ style: re(m.value)
684
684
  }, [
685
- lt("div", Ot(o.$attrs, {
685
+ rt("div", Ot(o.$attrs, {
686
686
  ref_key: "viewport",
687
- ref: y,
688
- class: ["vue-chat-virtual-scroll", z.value],
687
+ ref: x,
688
+ class: ["vue-chat-virtual-scroll", w.value],
689
689
  role: "log",
690
690
  "aria-label": t.ariaLabel,
691
691
  "aria-live": k.value,
@@ -693,125 +693,125 @@ const Ut = ["aria-label", "aria-live"], qt = {
693
693
  "aria-atomic": "false",
694
694
  tabindex: "0",
695
695
  onScrollPassive: g,
696
- onScrollendPassive: u[0] || (u[0] = //@ts-ignore
697
- (...w) => f(C) && f(C)(...w)),
698
- onPointerdownPassive: u[1] || (u[1] = //@ts-ignore
699
- (...w) => f(N) && f(N)(...w)),
700
- onWheelPassive: u[2] || (u[2] = //@ts-ignore
701
- (...w) => f(ke) && f(ke)(...w)),
702
- onKeydown: u[3] || (u[3] = //@ts-ignore
703
- (...w) => f(L) && f(L)(...w)),
704
- onFocusin: Oe,
705
- onFocusout: Mt,
706
- onTouchstartPassive: u[4] || (u[4] = //@ts-ignore
707
- (...w) => f(se) && f(se)(...w)),
708
- onTouchendPassive: u[5] || (u[5] = //@ts-ignore
709
- (...w) => f(ve) && f(ve)(...w)),
710
- onTouchcancelPassive: u[6] || (u[6] = //@ts-ignore
711
- (...w) => f(ve) && f(ve)(...w))
696
+ onScrollendPassive: c[0] || (c[0] = //@ts-ignore
697
+ (...p) => f(P) && f(P)(...p)),
698
+ onPointerdownPassive: c[1] || (c[1] = //@ts-ignore
699
+ (...p) => f(F) && f(F)(...p)),
700
+ onWheelPassive: c[2] || (c[2] = //@ts-ignore
701
+ (...p) => f(Ae) && f(Ae)(...p)),
702
+ onKeydown: c[3] || (c[3] = //@ts-ignore
703
+ (...p) => f(E) && f(E)(...p)),
704
+ onFocusin: Ie,
705
+ onFocusout: Ye,
706
+ onTouchstartPassive: c[4] || (c[4] = //@ts-ignore
707
+ (...p) => f(oe) && f(oe)(...p)),
708
+ onTouchendPassive: c[5] || (c[5] = //@ts-ignore
709
+ (...p) => f(me) && f(me)(...p)),
710
+ onTouchcancelPassive: c[6] || (c[6] = //@ts-ignore
711
+ (...p) => f(me) && f(me)(...p))
712
712
  }), [
713
- lt("div", {
713
+ rt("div", {
714
714
  class: "vue-chat-virtual-scroll__spacer",
715
- style: ue({ height: `${Math.max(ye.value, T.value.total + d.value)}px` })
715
+ style: re({ height: `${Math.max(Me.value, T.value.total + r.value)}px` })
716
716
  }, [
717
717
  t.loadingOlder ? (j(), U("div", qt, [
718
- lt("div", null, [
718
+ rt("div", null, [
719
719
  Se(o.$slots, "loadingOlder", {}, () => [
720
- u[8] || (u[8] = Ue("Loading older messages…", -1))
720
+ c[8] || (c[8] = Ge("Loading older messages…", -1))
721
721
  ])
722
722
  ])
723
- ])) : Ve("", !0),
724
- (j(!0), U(Je, null, et(X.value, ({ item: w, index: O, key: Pe, bottom: Ee }) => (j(), U("div", {
723
+ ])) : Re("", !0),
724
+ (j(!0), U(et, null, nt(K.value, ({ item: p, index: N, key: Pe, bottom: Ce }) => (j(), U("div", {
725
725
  key: Pe,
726
726
  ref_for: !0,
727
- ref: (De) => at(De, Pe),
727
+ ref: (Ve) => ot(Ve, Pe),
728
728
  class: "vue-chat-virtual-scroll__item",
729
- style: ue({ transform: `translateY(${-Ee}px)` }),
729
+ style: re({ transform: `translateY(${-Ce}px)` }),
730
730
  role: "article",
731
- "aria-posinset": O + 1,
731
+ "aria-posinset": N + 1,
732
732
  "aria-setsize": t.items.length
733
733
  }, [
734
734
  Se(o.$slots, "default", {
735
- item: w,
736
- index: O
735
+ item: p,
736
+ index: N
737
737
  })
738
738
  ], 12, Gt))), 128)),
739
- t.items.length ? Ve("", !0) : Se(o.$slots, "empty", {}, void 0, void 0, 1)
739
+ t.items.length ? Re("", !0) : Se(o.$slots, "empty", {}, void 0, void 0, 1)
740
740
  ], 4)
741
741
  ], 16, Ut),
742
- t.showNewItemsIndicator && $.value > 0 ? (j(), U("div", Xt, [
742
+ t.showNewItemsIndicator && R.value > 0 ? (j(), U("div", Xt, [
743
743
  Se(o.$slots, "newItems", {
744
- count: $.value,
745
- scrollToBottom: gt
744
+ count: R.value,
745
+ scrollToBottom: pt
746
746
  }, () => [
747
- lt("button", {
747
+ rt("button", {
748
748
  type: "button",
749
- onClick: u[7] || (u[7] = (w) => gt("smooth"))
750
- }, vt(me($.value)), 1)
749
+ onClick: c[7] || (c[7] = (p) => pt("smooth"))
750
+ }, ht(ee(R.value)), 1)
751
751
  ])
752
- ])) : Ve("", !0)
752
+ ])) : Re("", !0)
753
753
  ], 4));
754
754
  }
755
755
  });
756
756
  function xt(t) {
757
- const s = ee(), I = ee(0), e = ee(!1), x = ee(!1), y = m(() => Math.max(1, t.threshold())), M = m(
758
- () => t.refreshing() || x.value ? y.value : I.value
759
- ), d = m(
760
- () => Math.min(1, I.value / y.value)
761
- ), c = m(() => t.refreshing() || x.value ? "Refreshing…" : d.value >= 1 ? "Release to refresh" : "Pull to refresh");
757
+ const s = X(), I = X(0), e = X(!1), z = X(!1), x = h(() => Math.max(1, t.threshold())), y = h(
758
+ () => t.refreshing() || z.value ? x.value : I.value
759
+ ), r = h(
760
+ () => Math.min(1, I.value / x.value)
761
+ ), u = h(() => t.refreshing() || z.value ? "Refreshing…" : r.value >= 1 ? "Release to refresh" : "Pull to refresh");
762
762
  function n() {
763
763
  s.value = void 0, e.value = !1, I.value = 0;
764
764
  }
765
- function h(A) {
766
- var S;
767
- const P = A.currentTarget, E = ((S = t.scrollTop) == null ? void 0 : S.call(t)) ?? P.scrollTop;
768
- !t.enabled() || t.refreshing() || E > 0 || A.touches.length !== 1 || (s.value = A.touches[0].clientY, e.value = !0);
765
+ function M(b) {
766
+ var $;
767
+ const A = b.currentTarget, C = (($ = t.scrollTop) == null ? void 0 : $.call(t)) ?? A.scrollTop;
768
+ !t.enabled() || t.refreshing() || C > 0 || b.touches.length !== 1 || (s.value = b.touches[0].clientY, e.value = !0);
769
769
  }
770
- function $(A) {
770
+ function R(b) {
771
771
  var B;
772
772
  if (s.value === void 0 || !e.value) return;
773
- const P = A.currentTarget;
774
- if ((((B = t.scrollTop) == null ? void 0 : B.call(t)) ?? P.scrollTop) > 0 || A.touches.length !== 1) {
773
+ const A = b.currentTarget;
774
+ if ((((B = t.scrollTop) == null ? void 0 : B.call(t)) ?? A.scrollTop) > 0 || b.touches.length !== 1) {
775
775
  n();
776
776
  return;
777
777
  }
778
- const S = A.touches[0].clientY - s.value;
779
- if (S <= 0) {
778
+ const $ = b.touches[0].clientY - s.value;
779
+ if ($ <= 0) {
780
780
  I.value = 0;
781
781
  return;
782
782
  }
783
- A.preventDefault(), I.value = Math.min(S * 0.5, y.value * 2);
783
+ b.preventDefault(), I.value = Math.min($ * 0.5, x.value * 2);
784
784
  }
785
- function Y() {
785
+ function D() {
786
786
  if (s.value === void 0) return;
787
- const A = I.value >= y.value && t.enabled() && !t.refreshing();
788
- if (s.value = void 0, e.value = !1, !A) {
787
+ const b = I.value >= x.value && t.enabled() && !t.refreshing();
788
+ if (s.value = void 0, e.value = !1, !b) {
789
789
  I.value = 0;
790
790
  return;
791
791
  }
792
- I.value = y.value, x.value = !0, t.onRefresh(), Z(() => {
793
- t.refreshing() || (x.value = !1, I.value = 0);
792
+ I.value = x.value, z.value = !0, t.onRefresh(), Z(() => {
793
+ t.refreshing() || (z.value = !1, I.value = 0);
794
794
  });
795
795
  }
796
- return we(
796
+ return ye(
797
797
  () => t.refreshing(),
798
- (A, P) => {
799
- A ? (x.value = !1, I.value = y.value) : P && (x.value = !1, I.value = 0);
798
+ (b, A) => {
799
+ b ? (z.value = !1, I.value = x.value) : A && (z.value = !1, I.value = 0);
800
800
  }
801
801
  ), {
802
802
  pulling: e,
803
803
  pullDistance: I,
804
- pullOffset: M,
805
- pullProgress: d,
806
- refreshMessage: c,
807
- refreshThreshold: y,
808
- handleTouchStart: h,
809
- handleTouchMove: $,
810
- handleTouchEnd: Y,
804
+ pullOffset: y,
805
+ pullProgress: r,
806
+ refreshMessage: u,
807
+ refreshThreshold: x,
808
+ handleTouchStart: M,
809
+ handleTouchMove: R,
810
+ handleTouchEnd: D,
811
811
  handleTouchCancel: n
812
812
  };
813
813
  }
814
- const Jt = ["aria-label"], Qt = ["aria-posinset", "aria-setsize"], Bt = /* @__PURE__ */ Qe({
814
+ const Jt = ["aria-label"], Qt = ["aria-posinset", "aria-setsize"], Dt = /* @__PURE__ */ tt({
815
815
  name: "DynamicVirtualScroll",
816
816
  __name: "DynamicVirtualScroll",
817
817
  props: {
@@ -831,284 +831,284 @@ const Jt = ["aria-label"], Qt = ["aria-posinset", "aria-setsize"], Bt = /* @__PU
831
831
  },
832
832
  emits: ["scroll", "loadMore", "refresh"],
833
833
  setup(t, { expose: s, emit: I }) {
834
- const e = t, x = I, {
835
- pulling: y,
836
- pullDistance: M,
837
- pullOffset: d,
838
- pullProgress: c,
834
+ const e = t, z = I, {
835
+ pulling: x,
836
+ pullDistance: y,
837
+ pullOffset: r,
838
+ pullProgress: u,
839
839
  refreshMessage: n,
840
- refreshThreshold: h,
841
- handleTouchStart: $,
842
- handleTouchMove: Y,
843
- handleTouchEnd: A,
844
- handleTouchCancel: P
840
+ refreshThreshold: M,
841
+ handleTouchStart: R,
842
+ handleTouchMove: D,
843
+ handleTouchEnd: b,
844
+ handleTouchCancel: A
845
845
  } = xt({
846
846
  enabled: () => e.pullToRefresh,
847
847
  refreshing: () => e.refreshing,
848
848
  threshold: () => e.pullRefreshThreshold,
849
- onRefresh: () => x("refresh")
850
- }), E = ee(), S = ee(0), B = ee(0), K = ee(0), G = /* @__PURE__ */ new Map(), te = /* @__PURE__ */ new Map();
851
- let ce, R, fe = -1;
852
- const ne = wt(), { getItemKey: oe } = tt({
849
+ onRefresh: () => z("refresh")
850
+ }), C = X(), $ = X(0), B = X(0), V = X(0), G = /* @__PURE__ */ new Map(), Y = /* @__PURE__ */ new Map();
851
+ let se, H, ae = -1;
852
+ const ne = Mt(), { getItemKey: le } = lt({
853
853
  componentName: "DynamicVirtualScroll",
854
854
  items: () => e.items,
855
855
  itemKey: () => e.itemKey
856
- }), ie = m(
856
+ }), ie = h(
857
857
  () => Math.max(1, e.estimatedItemSize)
858
- ), H = m(
858
+ ), te = h(
859
859
  () => Math.max(1, e.loadingItemSize ?? ie.value)
860
- ), le = m(() => Math.max(0, Math.floor(e.overscan))), pe = m(() => B.value > 0 ? B.value : typeof e.height == "number" ? Math.max(0, e.height) : ie.value), xe = m(() => {
861
- K.value;
860
+ ), ue = h(() => Math.max(0, Math.floor(e.overscan))), fe = h(() => B.value > 0 ? B.value : typeof e.height == "number" ? Math.max(0, e.height) : ie.value), he = h(() => {
861
+ V.value;
862
862
  const v = new Array(e.items.length + 1), T = new Array(e.items.length);
863
863
  v[0] = 0;
864
- for (let r = 0; r < e.items.length; r += 1) {
865
- const q = oe(e.items[r], r), Q = G.get(q) ?? ie.value;
866
- T[r] = Q, v[r + 1] = v[r] + Q;
864
+ for (let i = 0; i < e.items.length; i += 1) {
865
+ const q = le(e.items[i], i), Q = G.get(q) ?? ie.value;
866
+ T[i] = Q, v[i + 1] = v[i] + Q;
867
867
  }
868
868
  return {
869
869
  offsets: v,
870
870
  sizes: T,
871
871
  total: v[e.items.length] ?? 0
872
872
  };
873
- }), he = m(
874
- () => xe.value.total + (e.loading ? H.value : 0)
875
- ), ae = m(() => {
873
+ }), ve = h(
874
+ () => he.value.total + (e.loading ? te.value : 0)
875
+ ), J = h(() => {
876
876
  const v = /* @__PURE__ */ new Map();
877
- return e.items.forEach((T, r) => {
878
- v.set(oe(T, r), r);
877
+ return e.items.forEach((T, i) => {
878
+ v.set(le(T, i), i);
879
879
  }), v;
880
880
  });
881
- function F(v) {
881
+ function O(v) {
882
882
  if (e.items.length === 0) return 0;
883
- const T = xe.value.offsets;
884
- let r = 0, q = e.items.length;
885
- for (; r < q; ) {
886
- const Q = Math.floor((r + q) / 2);
887
- T[Q + 1] <= v ? r = Q + 1 : q = Q;
883
+ const T = he.value.offsets;
884
+ let i = 0, q = e.items.length;
885
+ for (; i < q; ) {
886
+ const Q = Math.floor((i + q) / 2);
887
+ T[Q + 1] <= v ? i = Q + 1 : q = Q;
888
888
  }
889
- return Math.min(r, e.items.length - 1);
889
+ return Math.min(i, e.items.length - 1);
890
890
  }
891
- const b = m(
891
+ const S = h(
892
892
  () => Math.max(
893
893
  0,
894
- F(S.value) - le.value
894
+ O($.value) - ue.value
895
895
  )
896
- ), C = m(() => {
896
+ ), P = h(() => {
897
897
  if (e.items.length === 0) return 0;
898
- const v = F(S.value + pe.value) + 1;
898
+ const v = O($.value + fe.value) + 1;
899
899
  return Math.min(
900
900
  e.items.length,
901
- v + le.value
901
+ v + ue.value
902
902
  );
903
- }), se = m(
904
- () => e.items.slice(b.value, C.value).map((v, T) => {
905
- const r = b.value + T;
903
+ }), oe = h(
904
+ () => e.items.slice(S.value, P.value).map((v, T) => {
905
+ const i = S.value + T;
906
906
  return {
907
907
  item: v,
908
- index: r,
909
- key: oe(v, r),
910
- top: xe.value.offsets[r]
908
+ index: i,
909
+ key: le(v, i),
910
+ top: he.value.offsets[i]
911
911
  };
912
912
  })
913
- ), ve = m(() => ({
914
- height: mt(e.height)
913
+ ), me = h(() => ({
914
+ height: gt(e.height)
915
915
  }));
916
- function ke() {
916
+ function Ae() {
917
917
  var v;
918
- B.value = ((v = E.value) == null ? void 0 : v.clientHeight) ?? 0, ne(E.value, e.height), Z(N);
919
- }
920
- function L(v) {
921
- S.value = v.currentTarget.scrollTop, x("scroll", {
922
- scrollTop: S.value,
923
- startIndex: b.value,
924
- endIndex: C.value
925
- }), N();
926
- }
927
- function N() {
928
- const v = E.value;
929
- if (!v || !e.hasMore || e.loading || fe === e.items.length)
918
+ B.value = ((v = C.value) == null ? void 0 : v.clientHeight) ?? 0, ne(C.value, e.height), Z(F);
919
+ }
920
+ function E(v) {
921
+ $.value = v.currentTarget.scrollTop, z("scroll", {
922
+ scrollTop: $.value,
923
+ startIndex: S.value,
924
+ endIndex: P.value
925
+ }), F();
926
+ }
927
+ function F() {
928
+ const v = C.value;
929
+ if (!v || !e.hasMore || e.loading || ae === e.items.length)
930
930
  return;
931
931
  const T = Math.max(0, e.loadMoreThreshold);
932
- he.value - v.scrollTop - v.clientHeight <= T && (fe = e.items.length, x("loadMore"));
932
+ ve.value - v.scrollTop - v.clientHeight <= T && (ae = e.items.length, z("loadMore"));
933
933
  }
934
- function J(v) {
934
+ function _(v) {
935
935
  const T = v.borderBoxSize;
936
936
  if (T) {
937
- const r = Array.isArray(T) ? T[0] : T;
938
- if (r != null && r.blockSize) return r.blockSize;
937
+ const i = Array.isArray(T) ? T[0] : T;
938
+ if (i != null && i.blockSize) return i.blockSize;
939
939
  }
940
940
  return v.contentRect.height;
941
941
  }
942
- function Me(v) {
943
- const T = xe.value;
944
- let r = 0, q = !1;
942
+ function pe(v) {
943
+ const T = he.value;
944
+ let i = 0, q = !1;
945
945
  for (const Q of v) {
946
- const ze = Q.target, i = te.get(ze), D = J(Q);
947
- if (i === void 0 || D <= 0) continue;
948
- const _ = G.get(i) ?? ie.value;
949
- if (Math.abs(_ - D) < 0.5) continue;
950
- const X = ae.value.get(i);
951
- X !== void 0 && T.offsets[X + 1] <= S.value && (r += D - _), G.set(i, D), q = !0;
946
+ const ke = Q.target, ge = Y.get(ke), Ee = _(Q);
947
+ if (ge === void 0 || Ee <= 0) continue;
948
+ const d = G.get(ge) ?? ie.value;
949
+ if (Math.abs(d - Ee) < 0.5) continue;
950
+ const K = J.value.get(ge);
951
+ K !== void 0 && T.offsets[K + 1] <= $.value && (i += Ee - d), G.set(ge, Ee), q = !0;
952
952
  }
953
- q && (K.value += 1, Z(N), r !== 0 && Z(() => {
954
- const Q = E.value;
955
- Q && (Q.scrollTop += r, S.value = Q.scrollTop);
953
+ q && (V.value += 1, Z(F), i !== 0 && Z(() => {
954
+ const Q = C.value;
955
+ Q && (Q.scrollTop += i, $.value = Q.scrollTop);
956
956
  }));
957
957
  }
958
- function $e(v, T) {
959
- v instanceof HTMLElement && (te.set(v, T), R == null || R.observe(v));
958
+ function ze(v, T) {
959
+ v instanceof HTMLElement && (Y.set(v, T), H == null || H.observe(v));
960
960
  }
961
961
  function be() {
962
- for (const [v] of te)
963
- v.isConnected || (R == null || R.unobserve(v), te.delete(v));
962
+ for (const [v] of Y)
963
+ v.isConnected || (H == null || H.unobserve(v), Y.delete(v));
964
964
  }
965
- function ye(v, T = {}) {
966
- const r = E.value;
967
- if (!r) return;
968
- const q = Math.max(0, he.value - r.clientHeight), Q = Math.min(
965
+ function Me(v, T = {}) {
966
+ const i = C.value;
967
+ if (!i) return;
968
+ const q = Math.max(0, ve.value - i.clientHeight), Q = Math.min(
969
969
  Math.max(0, Number.isFinite(v) ? v : 0),
970
970
  q
971
- ), ze = T.behavior ?? "auto";
972
- ze === "auto" && (S.value = Q), r.scrollTo({ ...T, top: Q, behavior: ze });
971
+ ), ke = T.behavior ?? "auto";
972
+ ke === "auto" && ($.value = Q), i.scrollTo({ ...T, top: Q, behavior: ke });
973
973
  }
974
- function re(v, T = {}) {
975
- const r = E.value;
976
- if (!r || e.items.length === 0) return;
974
+ function ce(v, T = {}) {
975
+ const i = C.value;
976
+ if (!i || e.items.length === 0) return;
977
977
  const q = Math.min(
978
978
  e.items.length - 1,
979
979
  Math.max(0, Math.floor(v))
980
- ), { align: Q = "start", ...ze } = T;
981
- let i = xe.value.offsets[q];
982
- const D = xe.value.sizes[q];
983
- Q === "center" ? i -= (r.clientHeight - D) / 2 : Q === "end" && (i -= r.clientHeight - D);
984
- const _ = Math.max(
980
+ ), { align: Q = "start", ...ke } = T;
981
+ let ge = he.value.offsets[q];
982
+ const Ee = he.value.sizes[q];
983
+ Q === "center" ? ge -= (i.clientHeight - Ee) / 2 : Q === "end" && (ge -= i.clientHeight - Ee);
984
+ const d = Math.max(
985
985
  0,
986
- Math.min(i, he.value - r.clientHeight)
987
- ), X = ze.behavior ?? "auto";
988
- X === "auto" && (S.value = _), r.scrollTo({
989
- ...ze,
990
- top: _,
991
- behavior: X
986
+ Math.min(ge, ve.value - i.clientHeight)
987
+ ), K = ke.behavior ?? "auto";
988
+ K === "auto" && ($.value = d), i.scrollTo({
989
+ ...ke,
990
+ top: d,
991
+ behavior: K
992
992
  });
993
993
  }
994
994
  function de(v = "auto") {
995
995
  var T;
996
- (T = E.value) == null || T.scrollTo({ top: 0, behavior: v });
996
+ (T = C.value) == null || T.scrollTo({ top: 0, behavior: v });
997
997
  }
998
- return we(
998
+ return ye(
999
999
  () => e.itemKey,
1000
1000
  () => {
1001
- G.clear(), K.value += 1;
1001
+ G.clear(), V.value += 1;
1002
1002
  }
1003
- ), we(
1003
+ ), ye(
1004
1004
  () => e.items.length,
1005
1005
  async () => {
1006
1006
  const v = new Set(
1007
- e.items.map((q, Q) => oe(q, Q))
1007
+ e.items.map((q, Q) => le(q, Q))
1008
1008
  );
1009
1009
  for (const q of G.keys())
1010
1010
  v.has(q) || G.delete(q);
1011
- K.value += 1, await Z();
1012
- const T = E.value;
1011
+ V.value += 1, await Z();
1012
+ const T = C.value;
1013
1013
  if (!T) return;
1014
- const r = Math.max(0, he.value - T.clientHeight);
1015
- T.scrollTop > r && (T.scrollTop = r, S.value = r), N();
1014
+ const i = Math.max(0, ve.value - T.clientHeight);
1015
+ T.scrollTop > i && (T.scrollTop = i, $.value = i), F();
1016
1016
  }
1017
- ), we(
1017
+ ), ye(
1018
1018
  () => [e.hasMore, e.loading],
1019
1019
  async ([v]) => {
1020
- v || (fe = -1), await Z(), N();
1020
+ v || (ae = -1), await Z(), F();
1021
1021
  }
1022
- ), _e(() => {
1023
- if (ke(), typeof ResizeObserver < "u") {
1024
- ce = new ResizeObserver(ke), R = new ResizeObserver(Me), E.value && ce.observe(E.value);
1025
- for (const [v] of te)
1026
- R.observe(v);
1022
+ ), at(() => {
1023
+ if (Ae(), typeof ResizeObserver < "u") {
1024
+ se = new ResizeObserver(Ae), H = new ResizeObserver(pe), C.value && se.observe(C.value);
1025
+ for (const [v] of Y)
1026
+ H.observe(v);
1027
1027
  }
1028
- Z(N);
1029
- }), $t(be), qe(() => {
1030
- ce && (ce.disconnect(), ce = void 0), R && (R.disconnect(), R = void 0), te.clear();
1028
+ Z(F);
1029
+ }), $t(be), Xe(() => {
1030
+ se && (se.disconnect(), se = void 0), H && (H.disconnect(), H = void 0), Y.clear();
1031
1031
  }), s({
1032
- scrollTo: ye,
1033
- scrollToIndex: re,
1032
+ scrollTo: Me,
1033
+ scrollToIndex: ce,
1034
1034
  scrollToTop: de
1035
1035
  }), (v, T) => (j(), U("div", {
1036
1036
  ref_key: "viewport",
1037
- ref: E,
1038
- class: ot(["vue-dynamic-virtual-scroll", { "vue-dynamic-virtual-scroll--pulling": f(y) }]),
1039
- style: ue(ve.value),
1037
+ ref: C,
1038
+ class: st(["vue-dynamic-virtual-scroll", { "vue-dynamic-virtual-scroll--pulling": f(x) }]),
1039
+ style: re(me.value),
1040
1040
  role: "list",
1041
1041
  "aria-label": t.ariaLabel,
1042
1042
  tabindex: "0",
1043
- onScrollPassive: L,
1043
+ onScrollPassive: E,
1044
1044
  onTouchstartPassive: T[0] || (T[0] = //@ts-ignore
1045
- (...r) => f($) && f($)(...r)),
1045
+ (...i) => f(R) && f(R)(...i)),
1046
1046
  onTouchmove: T[1] || (T[1] = //@ts-ignore
1047
- (...r) => f(Y) && f(Y)(...r)),
1047
+ (...i) => f(D) && f(D)(...i)),
1048
1048
  onTouchend: T[2] || (T[2] = //@ts-ignore
1049
- (...r) => f(A) && f(A)(...r)),
1049
+ (...i) => f(b) && f(b)(...i)),
1050
1050
  onTouchcancel: T[3] || (T[3] = //@ts-ignore
1051
- (...r) => f(P) && f(P)(...r))
1051
+ (...i) => f(A) && f(A)(...i))
1052
1052
  }, [
1053
1053
  t.pullToRefresh || t.refreshing ? (j(), U("div", {
1054
1054
  key: 0,
1055
1055
  class: "vue-dynamic-virtual-scroll__refresh",
1056
- style: ue({
1057
- height: `${f(h)}px`,
1058
- transform: `translateY(${f(d) - f(h)}px)`
1056
+ style: re({
1057
+ height: `${f(M)}px`,
1058
+ transform: `translateY(${f(r) - f(M)}px)`
1059
1059
  }),
1060
1060
  role: "status",
1061
1061
  "aria-live": "polite"
1062
1062
  }, [
1063
1063
  Se(v.$slots, "refresh", {
1064
- pullDistance: f(M),
1065
- progress: f(c),
1064
+ pullDistance: f(y),
1065
+ progress: f(u),
1066
1066
  refreshing: t.refreshing
1067
1067
  }, () => [
1068
- Ue(vt(f(n)), 1)
1068
+ Ge(ht(f(n)), 1)
1069
1069
  ])
1070
- ], 4)) : Ve("", !0),
1070
+ ], 4)) : Re("", !0),
1071
1071
  t.items.length || t.loading ? (j(), U("div", {
1072
1072
  key: 1,
1073
1073
  class: "vue-dynamic-virtual-scroll__spacer",
1074
- style: ue({
1075
- height: `${he.value}px`,
1076
- transform: `translateY(${f(d)}px)`
1074
+ style: re({
1075
+ height: `${ve.value}px`,
1076
+ transform: `translateY(${f(r)}px)`
1077
1077
  })
1078
1078
  }, [
1079
- (j(!0), U(Je, null, et(se.value, ({ item: r, index: q, key: Q, top: ze }) => (j(), U("div", {
1079
+ (j(!0), U(et, null, nt(oe.value, ({ item: i, index: q, key: Q, top: ke }) => (j(), U("div", {
1080
1080
  key: Q,
1081
1081
  ref_for: !0,
1082
- ref: (i) => $e(i, Q),
1082
+ ref: (ge) => ze(ge, Q),
1083
1083
  class: "vue-dynamic-virtual-scroll__item",
1084
- style: ue({ transform: `translateY(${ze}px)` }),
1084
+ style: re({ transform: `translateY(${ke}px)` }),
1085
1085
  role: "listitem",
1086
1086
  "aria-posinset": q + 1,
1087
1087
  "aria-setsize": t.items.length
1088
1088
  }, [
1089
1089
  Se(v.$slots, "default", {
1090
- item: r,
1090
+ item: i,
1091
1091
  index: q
1092
1092
  })
1093
1093
  ], 12, Qt))), 128)),
1094
1094
  t.loading ? (j(), U("div", {
1095
1095
  key: 0,
1096
1096
  class: "vue-dynamic-virtual-scroll__loading",
1097
- style: ue({
1098
- height: `${H.value}px`,
1099
- transform: `translateY(${xe.value.total}px)`
1097
+ style: re({
1098
+ height: `${te.value}px`,
1099
+ transform: `translateY(${he.value.total}px)`
1100
1100
  }),
1101
1101
  role: "status",
1102
1102
  "aria-live": "polite"
1103
1103
  }, [
1104
1104
  Se(v.$slots, "loading", {}, () => [
1105
- T[4] || (T[4] = Ue("Loading more…", -1))
1105
+ T[4] || (T[4] = Ge("Loading more…", -1))
1106
1106
  ])
1107
- ], 4)) : Ve("", !0)
1107
+ ], 4)) : Re("", !0)
1108
1108
  ], 4)) : (j(), U("div", {
1109
1109
  key: 2,
1110
1110
  class: "vue-dynamic-virtual-scroll__empty",
1111
- style: ue({ transform: `translateY(${f(d)}px)` })
1111
+ style: re({ transform: `translateY(${f(r)}px)` })
1112
1112
  }, [
1113
1113
  Se(v.$slots, "empty")
1114
1114
  ], 4))
@@ -1117,7 +1117,7 @@ const Jt = ["aria-label"], Qt = ["aria-posinset", "aria-setsize"], Bt = /* @__PU
1117
1117
  }), _t = ["aria-label"], ea = ["aria-current", "aria-posinset", "aria-setsize"], ta = {
1118
1118
  key: 1,
1119
1119
  class: "vue-short-media-feed__empty"
1120
- }, aa = 36, na = 700, la = /* @__PURE__ */ Qe({
1120
+ }, aa = 36, na = 700, la = /* @__PURE__ */ tt({
1121
1121
  name: "ShortMediaFeed",
1122
1122
  __name: "ShortMediaFeed",
1123
1123
  props: {
@@ -1133,173 +1133,173 @@ const Jt = ["aria-label"], Qt = ["aria-posinset", "aria-setsize"], Bt = /* @__PU
1133
1133
  },
1134
1134
  emits: ["update:activeIndex", "change", "reachStart", "reachEnd", "loadMore"],
1135
1135
  setup(t, { expose: s, emit: I }) {
1136
- const e = t, x = I, y = ee(), M = ee(0), d = ee(ne(e.activeIndex));
1137
- let c, n = -1, h = 0, $ = !1, Y;
1138
- const A = wt(), { getItemKey: P } = tt({
1136
+ const e = t, z = I, x = X(), y = X(0), r = X(ne(e.activeIndex));
1137
+ let u, n = -1, M = 0, R = !1, D;
1138
+ const b = Mt(), { getItemKey: A } = lt({
1139
1139
  componentName: "ShortMediaFeed",
1140
1140
  items: () => e.items,
1141
1141
  itemKey: () => e.itemKey
1142
- }), E = m(
1142
+ }), C = h(
1143
1143
  () => Math.max(0, Math.floor(e.buffer))
1144
- ), S = m(
1144
+ ), $ = h(
1145
1145
  () => Math.max(
1146
1146
  0,
1147
1147
  Math.floor(
1148
1148
  Number.isFinite(e.loadMoreThreshold) ? e.loadMoreThreshold : 0
1149
1149
  )
1150
1150
  )
1151
- ), B = m(() => M.value > 0 ? M.value : typeof e.height == "number" ? Math.max(1, e.height) : 0), K = m(
1152
- () => Math.max(0, d.value - E.value)
1153
- ), G = m(
1151
+ ), B = h(() => y.value > 0 ? y.value : typeof e.height == "number" ? Math.max(1, e.height) : 0), V = h(
1152
+ () => Math.max(0, r.value - C.value)
1153
+ ), G = h(
1154
1154
  () => Math.min(
1155
1155
  e.items.length,
1156
- d.value + E.value + 1
1156
+ r.value + C.value + 1
1157
1157
  )
1158
- ), te = m(
1158
+ ), Y = h(
1159
1159
  () => (
1160
1160
  // Do not register zero-sized snap targets before a CSS height is measured.
1161
1161
  // WebKit can retain the second target at scrollTop=0 and jump to it on resize.
1162
- (B.value > 0 ? e.items : []).slice(K.value, G.value).map((b, C) => ({
1163
- item: b,
1164
- index: K.value + C
1162
+ (B.value > 0 ? e.items : []).slice(V.value, G.value).map((S, P) => ({
1163
+ item: S,
1164
+ index: V.value + P
1165
1165
  }))
1166
1166
  )
1167
- ), ce = m(() => K.value * B.value), R = m(
1167
+ ), se = h(() => V.value * B.value), H = h(
1168
1168
  () => (e.items.length - G.value) * B.value
1169
- ), fe = m(() => ({
1170
- height: mt(e.height)
1169
+ ), ae = h(() => ({
1170
+ height: gt(e.height)
1171
1171
  }));
1172
- function ne(b) {
1172
+ function ne(S) {
1173
1173
  return e.items.length === 0 ? 0 : Math.min(
1174
1174
  e.items.length - 1,
1175
- Math.max(0, Math.floor(Number.isFinite(b) ? b : 0))
1175
+ Math.max(0, Math.floor(Number.isFinite(S) ? S : 0))
1176
1176
  );
1177
1177
  }
1178
- function oe() {
1178
+ function le() {
1179
1179
  if (!e.hasMore || e.loading || n === e.items.length)
1180
1180
  return;
1181
- (e.items.length === 0 ? 0 : e.items.length - 1 - d.value) <= S.value && (n = e.items.length, x("loadMore"));
1181
+ (e.items.length === 0 ? 0 : e.items.length - 1 - r.value) <= $.value && (n = e.items.length, z("loadMore"));
1182
1182
  }
1183
- function ie(b) {
1184
- const C = ne(b);
1185
- C === d.value || e.items.length === 0 || (d.value = C, x("update:activeIndex", C), x("change", {
1186
- index: C,
1187
- item: e.items[C]
1188
- }), C === 0 && x("reachStart"), C === e.items.length - 1 && x("reachEnd"), oe());
1183
+ function ie(S) {
1184
+ const P = ne(S);
1185
+ P === r.value || e.items.length === 0 || (r.value = P, z("update:activeIndex", P), z("change", {
1186
+ index: P,
1187
+ item: e.items[P]
1188
+ }), P === 0 && z("reachStart"), P === e.items.length - 1 && z("reachEnd"), le());
1189
1189
  }
1190
- function H(b, C = {}) {
1191
- const se = y.value;
1192
- se && (typeof se.scrollTo == "function" ? se.scrollTo({ ...C, top: b }) : se.scrollTop = b);
1190
+ function te(S, P = {}) {
1191
+ const oe = x.value;
1192
+ oe && (typeof oe.scrollTo == "function" ? oe.scrollTo({ ...P, top: S }) : oe.scrollTop = S);
1193
1193
  }
1194
- function le(b, C = {}) {
1194
+ function ue(S, P = {}) {
1195
1195
  if (e.items.length === 0) return;
1196
- const se = ne(b);
1197
- ie(se), H(se * B.value, C);
1196
+ const oe = ne(S);
1197
+ ie(oe), te(oe * B.value, P);
1198
1198
  }
1199
- function pe(b) {
1199
+ function fe(S) {
1200
1200
  if (B.value <= 0) return;
1201
- const C = b.currentTarget.scrollTop;
1202
- ie(Math.round(C / B.value));
1203
- }
1204
- function xe(b) {
1205
- let C;
1206
- b.key === "ArrowDown" || b.key === "PageDown" ? C = d.value + 1 : b.key === "ArrowUp" || b.key === "PageUp" ? C = d.value - 1 : b.key === "Home" ? C = 0 : b.key === "End" && (C = e.items.length - 1), C !== void 0 && (b.preventDefault(), le(C, { behavior: "smooth" }));
1207
- }
1208
- function he(b) {
1209
- return b.deltaMode === WheelEvent.DOM_DELTA_LINE ? b.deltaY * 16 : b.deltaMode === WheelEvent.DOM_DELTA_PAGE ? b.deltaY * (B.value || 1) : b.deltaY;
1210
- }
1211
- function ae(b) {
1212
- if (b.ctrlKey || Math.abs(b.deltaX) > Math.abs(b.deltaY) || e.items.length === 0 || B.value <= 0 || (b.preventDefault(), $)) return;
1213
- const C = he(b);
1214
- if (C * h < 0 && (h = 0), h += C, Math.abs(h) < aa) return;
1215
- const se = h > 0 ? 1 : -1;
1216
- h = 0;
1217
- const ve = d.value + se;
1218
- ve < 0 || ve >= e.items.length || ($ = !0, le(ve, { behavior: "smooth" }), Y = setTimeout(() => {
1219
- $ = !1;
1201
+ const P = S.currentTarget.scrollTop;
1202
+ ie(Math.round(P / B.value));
1203
+ }
1204
+ function he(S) {
1205
+ let P;
1206
+ S.key === "ArrowDown" || S.key === "PageDown" ? P = r.value + 1 : S.key === "ArrowUp" || S.key === "PageUp" ? P = r.value - 1 : S.key === "Home" ? P = 0 : S.key === "End" && (P = e.items.length - 1), P !== void 0 && (S.preventDefault(), ue(P, { behavior: "smooth" }));
1207
+ }
1208
+ function ve(S) {
1209
+ return S.deltaMode === WheelEvent.DOM_DELTA_LINE ? S.deltaY * 16 : S.deltaMode === WheelEvent.DOM_DELTA_PAGE ? S.deltaY * (B.value || 1) : S.deltaY;
1210
+ }
1211
+ function J(S) {
1212
+ if (S.ctrlKey || Math.abs(S.deltaX) > Math.abs(S.deltaY) || e.items.length === 0 || B.value <= 0 || (S.preventDefault(), R)) return;
1213
+ const P = ve(S);
1214
+ if (P * M < 0 && (M = 0), M += P, Math.abs(M) < aa) return;
1215
+ const oe = M > 0 ? 1 : -1;
1216
+ M = 0;
1217
+ const me = r.value + oe;
1218
+ me < 0 || me >= e.items.length || (R = !0, ue(me, { behavior: "smooth" }), D = setTimeout(() => {
1219
+ R = !1;
1220
1220
  }, na));
1221
1221
  }
1222
- function F() {
1223
- var C;
1224
- const b = ((C = y.value) == null ? void 0 : C.clientHeight) ?? 0;
1225
- A(y.value, e.height), !(b <= 0 || b === M.value) && (M.value = b, Z(() => {
1226
- H(d.value * b);
1222
+ function O() {
1223
+ var P;
1224
+ const S = ((P = x.value) == null ? void 0 : P.clientHeight) ?? 0;
1225
+ b(x.value, e.height), !(S <= 0 || S === y.value) && (y.value = S, Z(() => {
1226
+ te(r.value * S);
1227
1227
  }));
1228
1228
  }
1229
- return we(
1229
+ return ye(
1230
1230
  () => e.activeIndex,
1231
- async (b) => {
1232
- const C = ne(b);
1233
- C !== d.value && (d.value = C, await Z(), H(C * B.value), oe());
1231
+ async (S) => {
1232
+ const P = ne(S);
1233
+ P !== r.value && (r.value = P, await Z(), te(P * B.value), le());
1234
1234
  }
1235
- ), we(
1235
+ ), ye(
1236
1236
  () => [
1237
1237
  e.hasMore,
1238
1238
  e.loading,
1239
1239
  e.loadMoreThreshold
1240
1240
  ],
1241
- async ([b]) => {
1242
- b || (n = -1), await Z(), oe();
1241
+ async ([S]) => {
1242
+ S || (n = -1), await Z(), le();
1243
1243
  }
1244
- ), we(
1244
+ ), ye(
1245
1245
  () => e.items.length,
1246
1246
  async () => {
1247
- const b = ne(d.value);
1248
- e.items.length === 0 ? d.value !== 0 && (d.value = 0, x("update:activeIndex", 0)) : ie(b), await Z(), H(b * B.value), oe();
1247
+ const S = ne(r.value);
1248
+ e.items.length === 0 ? r.value !== 0 && (r.value = 0, z("update:activeIndex", 0)) : ie(S), await Z(), te(S * B.value), le();
1249
1249
  }
1250
- ), _e(async () => {
1251
- F(), typeof ResizeObserver < "u" && y.value && (c = new ResizeObserver(F), c.observe(y.value)), await Z(), H(d.value * B.value), oe();
1252
- }), qe(() => {
1253
- c && (c.disconnect(), c = void 0), Y && (clearTimeout(Y), Y = void 0);
1250
+ ), at(async () => {
1251
+ O(), typeof ResizeObserver < "u" && x.value && (u = new ResizeObserver(O), u.observe(x.value)), await Z(), te(r.value * B.value), le();
1252
+ }), Xe(() => {
1253
+ u && (u.disconnect(), u = void 0), D && (clearTimeout(D), D = void 0);
1254
1254
  }), s({
1255
- scrollToIndex: le
1256
- }), (b, C) => (j(), U("div", {
1255
+ scrollToIndex: ue
1256
+ }), (S, P) => (j(), U("div", {
1257
1257
  ref_key: "viewport",
1258
- ref: y,
1258
+ ref: x,
1259
1259
  class: "vue-short-media-feed",
1260
- style: ue(fe.value),
1260
+ style: re(ae.value),
1261
1261
  role: "list",
1262
1262
  "aria-orientation": "vertical",
1263
1263
  "aria-label": t.ariaLabel,
1264
1264
  tabindex: "0",
1265
- onScrollPassive: pe,
1266
- onWheel: ae,
1267
- onKeydown: xe
1265
+ onScrollPassive: fe,
1266
+ onWheel: J,
1267
+ onKeydown: he
1268
1268
  }, [
1269
- t.items.length ? (j(), U(Je, { key: 0 }, [
1270
- ce.value > 0 ? (j(), U("div", {
1269
+ t.items.length ? (j(), U(et, { key: 0 }, [
1270
+ se.value > 0 ? (j(), U("div", {
1271
1271
  key: 0,
1272
1272
  class: "vue-short-media-feed__spacer",
1273
- style: ue({ height: `${ce.value}px` }),
1273
+ style: re({ height: `${se.value}px` }),
1274
1274
  "aria-hidden": "true"
1275
- }, null, 4)) : Ve("", !0),
1276
- (j(!0), U(Je, null, et(te.value, ({ item: se, index: ve }) => (j(), U("div", {
1277
- key: f(P)(se, ve),
1275
+ }, null, 4)) : Re("", !0),
1276
+ (j(!0), U(et, null, nt(Y.value, ({ item: oe, index: me }) => (j(), U("div", {
1277
+ key: f(A)(oe, me),
1278
1278
  class: "vue-short-media-feed__item",
1279
- style: ue({ height: `${B.value}px` }),
1279
+ style: re({ height: `${B.value}px` }),
1280
1280
  role: "listitem",
1281
- "aria-current": ve === d.value ? "true" : void 0,
1282
- "aria-posinset": ve + 1,
1281
+ "aria-current": me === r.value ? "true" : void 0,
1282
+ "aria-posinset": me + 1,
1283
1283
  "aria-setsize": t.items.length
1284
1284
  }, [
1285
- Se(b.$slots, "default", {
1286
- item: se,
1287
- index: ve,
1288
- active: ve === d.value
1285
+ Se(S.$slots, "default", {
1286
+ item: oe,
1287
+ index: me,
1288
+ active: me === r.value
1289
1289
  })
1290
1290
  ], 12, ea))), 128)),
1291
- R.value > 0 ? (j(), U("div", {
1291
+ H.value > 0 ? (j(), U("div", {
1292
1292
  key: 1,
1293
1293
  class: "vue-short-media-feed__spacer",
1294
- style: ue({ height: `${R.value}px` }),
1294
+ style: re({ height: `${H.value}px` }),
1295
1295
  "aria-hidden": "true"
1296
- }, null, 4)) : Ve("", !0)
1296
+ }, null, 4)) : Re("", !0)
1297
1297
  ], 64)) : (j(), U("div", ta, [
1298
- Se(b.$slots, "empty")
1298
+ Se(S.$slots, "empty")
1299
1299
  ]))
1300
1300
  ], 44, _t));
1301
1301
  }
1302
- }), oa = ["aria-label"], ia = /* @__PURE__ */ Qe({
1302
+ }), oa = ["aria-label"], ia = /* @__PURE__ */ tt({
1303
1303
  __name: "SkeletonLoader",
1304
1304
  props: {
1305
1305
  width: { default: "100%" },
@@ -1310,27 +1310,27 @@ const Jt = ["aria-label"], Qt = ["aria-posinset", "aria-setsize"], Bt = /* @__PU
1310
1310
  },
1311
1311
  setup(t) {
1312
1312
  const s = t;
1313
- function I(x) {
1314
- return typeof x == "number" ? `${Math.max(0, x)}px` : x;
1313
+ function I(z) {
1314
+ return typeof z == "number" ? `${Math.max(0, z)}px` : z;
1315
1315
  }
1316
- const e = m(() => ({
1316
+ const e = h(() => ({
1317
1317
  width: I(s.width),
1318
1318
  height: I(s.height)
1319
1319
  }));
1320
- return (x, y) => (j(), U("div", {
1321
- class: ot(["vue-skeleton-loader", [
1320
+ return (z, x) => (j(), U("div", {
1321
+ class: st(["vue-skeleton-loader", [
1322
1322
  `vue-skeleton-loader--${t.variant}`,
1323
1323
  { "vue-skeleton-loader--animated": t.animated }
1324
1324
  ]]),
1325
- style: ue(e.value),
1325
+ style: re(e.value),
1326
1326
  role: "status",
1327
1327
  "aria-label": t.ariaLabel
1328
1328
  }, null, 14, oa));
1329
1329
  }
1330
1330
  }), ra = (t, s) => {
1331
1331
  const I = t.__vccOpts || t;
1332
- for (const [e, x] of s)
1333
- I[e] = x;
1332
+ for (const [e, z] of s)
1333
+ I[e] = z;
1334
1334
  return I;
1335
1335
  }, sa = /* @__PURE__ */ ra(ia, [["__scopeId", "data-v-fc92f61f"]]), ua = 6e-3;
1336
1336
  function ca(t, s) {
@@ -1338,8 +1338,8 @@ function ca(t, s) {
1338
1338
  return Math.max(-e, Math.min(e, I));
1339
1339
  }
1340
1340
  function da(t, s, I, e = 250) {
1341
- const x = s - t, y = Math.abs(I);
1342
- if (!(y >= 0.1 && x * I > 0))
1341
+ const z = s - t, x = Math.abs(I);
1342
+ if (!(x >= 0.1 && z * I > 0))
1343
1343
  return {
1344
1344
  keyframes: [
1345
1345
  { transform: `translate3d(${t}px, 0, 0)` },
@@ -1347,221 +1347,236 @@ function da(t, s, I, e = 250) {
1347
1347
  ],
1348
1348
  options: {
1349
1349
  duration: Math.round(
1350
- Math.max(120, Math.min(650, (190 + Math.abs(x) * 0.35) * e / 250))
1350
+ Math.max(120, Math.min(650, (190 + Math.abs(z) * 0.35) * e / 250))
1351
1351
  ),
1352
1352
  easing: "cubic-bezier(0.22, 1, 0.36, 1)",
1353
1353
  fill: "forwards"
1354
1354
  }
1355
1355
  };
1356
- const d = Math.round(
1357
- Math.max(180, Math.min(650, 2 * Math.abs(x) / y * e / 250))
1358
- ), c = Math.min(3, y * d / Math.abs(x)), n = Math.ceil(d / 8);
1356
+ const r = Math.round(
1357
+ Math.max(180, Math.min(650, 2 * Math.abs(z) / x * e / 250))
1358
+ ), u = Math.min(3, x * r / Math.abs(z)), n = Math.ceil(r / 8);
1359
1359
  return {
1360
- keyframes: Array.from({ length: n + 1 }, ($, Y) => {
1361
- const A = Y / n, P = A * A, E = P * A, S = c * (E - 2 * P + A) + (-2 * E + 3 * P), B = t + x * S;
1360
+ keyframes: Array.from({ length: n + 1 }, (R, D) => {
1361
+ const b = D / n, A = b * b, C = A * b, $ = u * (C - 2 * A + b) + (-2 * C + 3 * A), B = t + z * $;
1362
1362
  return {
1363
- offset: A,
1363
+ offset: b,
1364
1364
  transform: `translate3d(${B}px, 0, 0)`
1365
1365
  };
1366
1366
  }),
1367
- options: { duration: d, easing: "linear", fill: "forwards" }
1367
+ options: { duration: r, easing: "linear", fill: "forwards" }
1368
1368
  };
1369
1369
  }
1370
1370
  function fa(t) {
1371
- const s = ee("idle"), I = m(() => s.value !== "idle"), e = m(() => s.value === "dragging"), x = ee(!1);
1372
- let y, M = "", d = 0, c = 0, n = 0, h = 0, $ = 0, Y = 0, A = 0, P = 0, E = 0, S, B, K, G = 0, te = !1, ce, R, fe = "", ne = !1, oe, ie = !1;
1373
- const H = () => t.rtl() ? -1 : 1, le = () => {
1374
- var i;
1375
- return (((i = t.viewport()) == null ? void 0 : i.scrollLeft) ?? 0) * H();
1371
+ const s = X("idle"), I = X(!1), e = X(!1), z = h(() => s.value !== "idle" || I.value), x = h(() => s.value === "dragging" || e.value), y = X(!1);
1372
+ let r, u = "", n = 0, M = 0, R = 0, D = 0, b = 0, A = 0, C = 0, $ = 0, B = 0, V, G, Y, se = 0, H = !1, ae, ne, le = "", ie = !1, te, ue = !1;
1373
+ const fe = () => t.rtl() ? -1 : 1, he = () => {
1374
+ var d;
1375
+ return (((d = t.viewport()) == null ? void 0 : d.scrollLeft) ?? 0) * fe();
1376
1376
  };
1377
- function pe(i, D) {
1378
- const _ = t.viewport();
1379
- if (!_) return;
1380
- const X = i * H();
1381
- _.scrollTo ? _.scrollTo(D === void 0 ? { left: X } : { left: X, behavior: D }) : _.scrollLeft = X;
1377
+ function ve(d, K) {
1378
+ const m = t.viewport();
1379
+ if (!m) return;
1380
+ const w = d * fe();
1381
+ m.scrollTo ? m.scrollTo(K === void 0 ? { left: w } : { left: w, behavior: K }) : m.scrollLeft = w;
1382
1382
  }
1383
- function xe() {
1384
- const i = t.viewport();
1385
- i && (ne || (fe = i.style.scrollSnapType), ne = !0, i.style.scrollSnapType = "none");
1383
+ function J() {
1384
+ const d = t.viewport();
1385
+ d && (ie || (le = d.style.scrollSnapType), ie = !0, d.style.scrollSnapType = "none");
1386
1386
  }
1387
- function he() {
1388
- const i = G;
1387
+ function O() {
1388
+ const d = se;
1389
1389
  Z(() => {
1390
- ie || i !== G || s.value !== "idle" || (t.viewport() && (t.viewport().style.scrollSnapType = fe), ne = !1);
1390
+ ue || d !== se || s.value !== "idle" || (t.viewport() && (t.viewport().style.scrollSnapType = le), ie = !1);
1391
1391
  });
1392
1392
  }
1393
- function ae() {
1394
- const i = t.track();
1395
- i && (i.style.transform = "", i.style.willChange = "");
1393
+ function S() {
1394
+ const d = t.track();
1395
+ d && (d.style.transform = "", d.style.willChange = "");
1396
1396
  }
1397
- function F() {
1398
- const i = t.track();
1399
- if (!i || !S) return $;
1400
- const D = getComputedStyle(i).transform, _ = D.slice(D.indexOf("(") + 1, -1).split(",").map(Number), X = D.startsWith("matrix3d") ? _[12] : _[4];
1401
- return Number.isFinite(X) ? X : $;
1397
+ function P() {
1398
+ const d = t.track();
1399
+ if (!d || !V) return b;
1400
+ const K = getComputedStyle(d).transform, m = K.slice(K.indexOf("(") + 1, -1).split(",").map(Number), w = K.startsWith("matrix3d") ? m[12] : m[4];
1401
+ return Number.isFinite(w) ? w : b;
1402
1402
  }
1403
- function b() {
1404
- return S ? h - F() * H() : x.value ? h - $ * H() : le();
1403
+ function oe() {
1404
+ return V ? D - P() * fe() : y.value ? D - b * fe() : he();
1405
1405
  }
1406
- function C() {
1407
- const i = S;
1408
- S = void 0, i && (i.onfinish = null, i.oncancel = null, i.cancel()), K !== void 0 && cancelAnimationFrame(K), K = void 0;
1406
+ function me() {
1407
+ const d = V;
1408
+ V = void 0, d && (d.onfinish = null, d.oncancel = null, d.cancel()), Y !== void 0 && cancelAnimationFrame(Y), Y = void 0;
1409
1409
  }
1410
- function se() {
1411
- var _;
1412
- const i = y;
1413
- y = void 0;
1414
- const D = t.viewport();
1415
- i !== void 0 && ((_ = D == null ? void 0 : D.hasPointerCapture) != null && _.call(D, i)) && D.releasePointerCapture(i), window.removeEventListener("pointermove", ye), window.removeEventListener("pointerup", de), window.removeEventListener("pointercancel", v), window.removeEventListener("blur", T);
1410
+ function Ae() {
1411
+ var m;
1412
+ const d = r;
1413
+ r = void 0, I.value = !1, e.value = !1;
1414
+ const K = t.viewport();
1415
+ d !== void 0 && ((m = K == null ? void 0 : K.hasPointerCapture) != null && m.call(K, d)) && K.releasePointerCapture(d), window.removeEventListener("pointermove", de), window.removeEventListener("pointerup", T), window.removeEventListener("pointercancel", i), window.removeEventListener("blur", q);
1416
1416
  }
1417
- function ve(i, D) {
1418
- const _ = ++G;
1419
- xe(), s.value = "committing", C(), ae(), x.value = !1, $ = 0;
1420
- const X = t.canonical(i);
1421
- pe(X, D), t.onPosition(X), t.onCommit(i), Z(() => {
1422
- ie || _ !== G || (pe(X), s.value = "idle", he());
1417
+ function E(d, K) {
1418
+ const m = ++se;
1419
+ J(), s.value = "committing", me(), S(), y.value = !1, b = 0;
1420
+ const w = t.canonical(d);
1421
+ ve(w, K), t.onPosition(w), t.onCommit(d), Z(() => {
1422
+ ue || m !== se || (ve(w), s.value = "idle", O());
1423
1423
  });
1424
1424
  }
1425
- function ke(i = !0) {
1426
- R !== void 0 && clearTimeout(R), R = void 0;
1427
- const D = S !== void 0 || $ !== 0, _ = i ? b() : le();
1428
- return ++G, xe(), se(), C(), ae(), x.value = !1, B = void 0, $ = 0, s.value = "idle", i && (D && pe(_), t.onPosition(_)), he(), _;
1425
+ function F(d = !0) {
1426
+ ne !== void 0 && clearTimeout(ne), ne = void 0;
1427
+ const K = V !== void 0 || b !== 0, m = d ? oe() : he();
1428
+ return ++se, J(), Ae(), me(), S(), y.value = !1, G = void 0, b = 0, s.value = "idle", d && (K && ve(m), t.onPosition(m)), O(), m;
1429
1429
  }
1430
- function L() {
1431
- S && (t.onPosition(b()), K = requestAnimationFrame(L));
1430
+ function _() {
1431
+ V && (t.onPosition(oe()), Y = requestAnimationFrame(_));
1432
1432
  }
1433
- function N() {
1433
+ function pe() {
1434
1434
  return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
1435
1435
  }
1436
- function J(i, D, _) {
1437
- const X = t.track(), p = (h - D) * H();
1438
- if (!(X != null && X.animate) || N() || t.settleDuration() === 0 || Math.abs(p - $) < 1) {
1439
- ae(), x.value = !1, $ = 0, s.value = "idle", !(X != null && X.animate) && !N() && t.settleDuration() !== 0 ? (t.onCommit(i), B = D, pe(D, "smooth"), he()) : ve(i);
1436
+ function ze(d, K, m) {
1437
+ const w = t.track(), k = (D - K) * fe();
1438
+ if (!(w != null && w.animate) || pe() || t.settleDuration() === 0 || Math.abs(k - b) < 1) {
1439
+ S(), y.value = !1, b = 0, s.value = "idle", !(w != null && w.animate) && !pe() && t.settleDuration() !== 0 ? (t.onCommit(d), G = K, ve(K, "smooth"), O()) : E(d);
1440
1440
  return;
1441
1441
  }
1442
- ++G, xe(), s.value = "settling", x.value = !0;
1443
- const z = da($, p, _, t.settleDuration()), k = X.animate(z.keyframes, z.options);
1444
- S = k, k.onfinish = () => {
1445
- S === k && ve(i);
1446
- }, k.oncancel = () => {
1447
- S === k && ke();
1448
- }, K = requestAnimationFrame(L);
1442
+ ++se, J(), s.value = "settling", y.value = !0;
1443
+ const ee = da(b, k, m, t.settleDuration()), L = w.animate(ee.keyframes, ee.options);
1444
+ V = L, L.onfinish = () => {
1445
+ V === L && E(d);
1446
+ }, L.oncancel = () => {
1447
+ V === L && F();
1448
+ }, Y = requestAnimationFrame(_);
1449
1449
  }
1450
- function Me(i, D = "smooth", _ = 0, X = !1) {
1451
- const p = ke(), z = t.target(i, p, _);
1452
- t.onCommit(i), Math.abs(z - p) < 0.5 || D !== "smooth" || N() ? ve(i, D) : X ? (h = le(), $ = (h - p) * H(), J(i, z, 0)) : (s.value = "settling", B = z, pe(z, D), t.viewport() && (t.viewport().style.scrollSnapType = fe), ne = !1);
1450
+ function be(d, K = "smooth", m = 0, w = !1) {
1451
+ const k = F(), ee = t.target(d, k, m);
1452
+ t.onCommit(d), Math.abs(ee - k) < 0.5 || K !== "smooth" || pe() ? E(d, K) : w ? (D = he(), b = (D - k) * fe(), ze(d, ee, 0)) : (s.value = "settling", G = ee, ve(ee, K), t.viewport() && (t.viewport().style.scrollSnapType = le), ie = !1);
1453
1453
  }
1454
- function $e(i) {
1455
- const D = i.currentTarget.scrollLeft * H();
1456
- if (!(S || s.value === "dragging" || s.value === "committing")) {
1457
- if (t.onPosition(D), B !== void 0) {
1458
- if (Math.abs(D - B) > 1) return;
1459
- B = void 0, s.value = "idle";
1454
+ function Me(d) {
1455
+ const K = d.currentTarget.scrollLeft * fe();
1456
+ if (!(V || s.value === "dragging" || s.value === "committing")) {
1457
+ if (t.onPosition(K), G !== void 0) {
1458
+ if (Math.abs(K - G) > 1) return;
1459
+ G = void 0, s.value = "idle";
1460
1460
  }
1461
- t.onCommit(t.indexAt(D));
1461
+ t.onCommit(t.indexAt(K));
1462
1462
  }
1463
1463
  }
1464
- function be(i) {
1465
- var X, p;
1466
- if (y !== void 0 || i.isPrimary === !1 || i.pointerType === "mouse" && (!t.mouseDrag() || i.button !== 0) || !["mouse", "touch", "pen"].includes(i.pointerType) || (p = (X = i.target) == null ? void 0 : X.closest) != null && p.call(X, 'input, textarea, select, [contenteditable="true"], [data-carousel-no-drag]')) return;
1467
- B !== void 0 && pe(le(), "auto");
1468
- const D = b();
1469
- S !== void 0 ? ($ = F(), C(), t.track().style.transform = `translate3d(${$}px, 0, 0)`, x.value = !0) : ($ = 0, h = le()), ++G, B = void 0, s.value = "pending", y = i.pointerId, M = i.pointerType, d = Y = i.clientX, c = i.clientY, n = D, A = i.timeStamp, P = 0, E = 0, te = !1, ce !== void 0 && clearTimeout(ce), window.addEventListener("pointermove", ye), window.addEventListener("pointerup", de), window.addEventListener("pointercancel", v), window.addEventListener("blur", T);
1464
+ function ce(d) {
1465
+ var w, k;
1466
+ if (r !== void 0 || d.isPrimary === !1 || d.pointerType === "mouse" && (!t.mouseDrag() || d.button !== 0) || !["mouse", "touch", "pen"].includes(d.pointerType) || (k = (w = d.target) == null ? void 0 : w.closest) != null && k.call(w, 'input, textarea, select, [contenteditable="true"], [data-carousel-no-drag]')) return;
1467
+ G !== void 0 && ve(he(), "auto");
1468
+ const K = oe();
1469
+ V !== void 0 ? (b = P(), me(), t.track().style.transform = `translate3d(${b}px, 0, 0)`, y.value = !0) : (b = 0, D = he()), ++se, G = void 0, s.value = "pending", r = d.pointerId, I.value = !0, u = d.pointerType, n = A = d.clientX, M = d.clientY, R = K, C = d.timeStamp, $ = 0, B = 0, H = !1, ae !== void 0 && clearTimeout(ae), window.addEventListener("pointermove", de), window.addEventListener("pointerup", T), window.addEventListener("pointercancel", i), window.addEventListener("blur", q);
1470
1470
  }
1471
- function ye(i) {
1472
- var W, Ie;
1473
- if (y !== i.pointerId || i === oe) return;
1474
- oe = i;
1475
- const D = i.clientX - d, _ = i.clientY - c, X = Number.isFinite(t.dragThreshold()) ? Math.max(1, t.dragThreshold()) : 8;
1471
+ function de(d) {
1472
+ var $e, De;
1473
+ if (r !== d.pointerId || d === te) return;
1474
+ if (te = d, e.value) {
1475
+ d.cancelable && d.preventDefault();
1476
+ return;
1477
+ }
1478
+ const K = d.clientX - n, m = d.clientY - M, w = Number.isFinite(t.dragThreshold()) ? Math.max(1, t.dragThreshold()) : 8, k = u === "mouse" && t.mouseDragMode() === "snap";
1476
1479
  if (s.value === "pending") {
1477
- if (Math.max(Math.abs(D), Math.abs(_)) < X) return;
1478
- if (M !== "mouse" && Math.abs(_) >= Math.abs(D)) {
1479
- ke();
1480
+ if (Math.max(Math.abs(K), Math.abs(m)) < w || k && Math.abs(K) < w) return;
1481
+ if (u !== "mouse" && Math.abs(m) >= Math.abs(K)) {
1482
+ F();
1480
1483
  return;
1481
1484
  }
1482
- xe(), s.value = "dragging", (Ie = (W = t.viewport()) == null ? void 0 : W.setPointerCapture) == null || Ie.call(W, i.pointerId);
1485
+ J(), s.value = "dragging", (De = ($e = t.viewport()) == null ? void 0 : $e.setPointerCapture) == null || De.call($e, d.pointerId);
1483
1486
  }
1484
1487
  if (s.value !== "dragging") return;
1485
- i.cancelable && i.preventDefault(), te = !0;
1486
- const p = i.timeStamp - A;
1487
- if (p > 0 && p <= 80) {
1488
- const ge = Math.max(-2.5, Math.min(2.5, (i.clientX - Y) / p));
1489
- P = E === 0 ? ge : P * 0.25 + ge * 0.75, E += 1;
1490
- } else p > 80 && (P = 0, E = 0);
1491
- Y = i.clientX, A = i.timeStamp;
1492
- let z = n - D * H();
1493
- const [k, me] = t.limits();
1494
- z < k && (z = k + (z - k) * 0.35), z > me && (z = me + (z - me) * 0.35), $ = (h - z) * H(), K === void 0 && (K = requestAnimationFrame(() => {
1495
- K = void 0;
1496
- const ge = t.track();
1497
- !ge || s.value !== "dragging" || (ge.style.willChange = "transform", ge.style.transform = `translate3d(${$}px, 0, 0)`, t.onPosition(h - $ * H()));
1488
+ if (d.cancelable && d.preventDefault(), H = !0, k) {
1489
+ e.value = !0;
1490
+ const Ie = -Math.sign(K) * fe(), Ye = t.target(t.indexAt(R) + Ie, R, Ie), je = t.indexAt(Ye);
1491
+ t.onCommit(je), ze(je, Ye, 0);
1492
+ return;
1493
+ }
1494
+ const ee = d.timeStamp - C;
1495
+ if (ee > 0 && ee <= 80) {
1496
+ const Ie = Math.max(-2.5, Math.min(2.5, (d.clientX - A) / ee));
1497
+ $ = B === 0 ? Ie : $ * 0.25 + Ie * 0.75, B += 1;
1498
+ } else ee > 80 && ($ = 0, B = 0);
1499
+ A = d.clientX, C = d.timeStamp;
1500
+ let L = R - K * fe();
1501
+ const [xe, we] = t.limits();
1502
+ L < xe && (L = xe + (L - xe) * 0.35), L > we && (L = we + (L - we) * 0.35), b = (D - L) * fe(), Y === void 0 && (Y = requestAnimationFrame(() => {
1503
+ Y = void 0;
1504
+ const Ie = t.track();
1505
+ !Ie || s.value !== "dragging" || (Ie.style.willChange = "transform", Ie.style.transform = `translate3d(${b}px, 0, 0)`, t.onPosition(D - b * fe()));
1498
1506
  }));
1499
1507
  }
1500
- function re(i, D = !1) {
1501
- if (y === void 0 || i && y !== i.pointerId) return;
1502
- const _ = s.value === "dragging", X = $ !== 0;
1503
- if (se(), K !== void 0 && cancelAnimationFrame(K), K = void 0, !_ && !X) {
1504
- s.value = "idle", he();
1508
+ function v(d, K = !1) {
1509
+ if (r === void 0 || d && r !== d.pointerId) return;
1510
+ const m = s.value === "dragging", w = e.value, k = b !== 0;
1511
+ if (Ae(), w) {
1512
+ ae !== void 0 && clearTimeout(ae), ae = setTimeout(() => {
1513
+ H = !1;
1514
+ }, 0);
1505
1515
  return;
1506
1516
  }
1507
- const p = h - $ * H(), z = i ? Math.max(0, i.timeStamp - A) : 101, k = !D && t.momentum() && z <= 100 ? P * Math.exp(-z / 80) : 0, me = p - n, W = Math.min(80, Math.max(40, t.step() * 0.12)), Ie = E >= 2 && Math.abs(me) >= W ? ca(-k * H(), t.step()) : 0;
1508
- let ge = t.indexAt(p + Ie);
1509
- const Le = t.indexAt(n), He = Math.max(1, t.dragThreshold());
1510
- !D && _ && ge === Le && Math.abs(me) >= He && (ge = Le + Math.sign(me));
1511
- const Oe = t.target(ge, p);
1512
- t.onPosition(p), J(t.indexAt(Oe), Oe, k), ce !== void 0 && clearTimeout(ce), ce = setTimeout(() => {
1513
- te = !1;
1517
+ if (Y !== void 0 && cancelAnimationFrame(Y), Y = void 0, !m && !k) {
1518
+ s.value = "idle", O();
1519
+ return;
1520
+ }
1521
+ const ee = D - b * fe(), L = d ? Math.max(0, d.timeStamp - C) : 101, xe = !K && t.momentum() && L <= 100 ? $ * Math.exp(-L / 80) : 0, we = ee - R, $e = Math.min(80, Math.max(40, t.step() * 0.12)), De = B >= 2 && Math.abs(we) >= $e ? ca(-xe * fe(), t.step()) : 0;
1522
+ let Ie = t.indexAt(ee + De);
1523
+ const Ye = t.indexAt(R), je = Math.max(1, t.dragThreshold());
1524
+ !K && m && Ie === Ye && Math.abs(we) >= je && (Ie = Ye + Math.sign(we));
1525
+ const Ze = t.target(Ie, ee);
1526
+ t.onPosition(ee), ze(t.indexAt(Ze), Ze, xe), ae !== void 0 && clearTimeout(ae), ae = setTimeout(() => {
1527
+ H = !1;
1514
1528
  }, 0);
1515
1529
  }
1516
- function de(i) {
1517
- re(i);
1530
+ function T(d) {
1531
+ v(d);
1518
1532
  }
1519
- function v(i) {
1520
- re(i, !0);
1533
+ function i(d) {
1534
+ v(d, !0);
1521
1535
  }
1522
- function T() {
1523
- re(void 0, !0);
1536
+ function q() {
1537
+ v(void 0, !0);
1524
1538
  }
1525
- function r(i) {
1526
- i.target === t.viewport() && y === i.pointerId && s.value === "dragging" && re(i, !0);
1539
+ function Q(d) {
1540
+ d.target === t.viewport() && r === d.pointerId && s.value === "dragging" && v(d, !0);
1527
1541
  }
1528
- function q(i) {
1529
- !te || i.detail === 0 || (i.preventDefault(), i.stopPropagation(), te = !1);
1542
+ function ke(d) {
1543
+ !H || d.detail === 0 || (d.preventDefault(), d.stopPropagation(), H = !1);
1530
1544
  }
1531
- function Q() {
1532
- const i = S !== void 0 || s.value === "dragging", D = ke();
1533
- i && t.onCommit(t.indexAt(D)), t.nativeSnap() || (R = setTimeout(() => {
1534
- if (R = void 0, ie || s.value !== "idle") return;
1535
- h = le(), $ = 0;
1536
- const _ = t.indexAt(h);
1537
- J(_, t.target(_, h), 0);
1545
+ function ge() {
1546
+ const d = V !== void 0 || s.value === "dragging", K = F();
1547
+ d && t.onCommit(t.indexAt(K)), t.nativeSnap() || (ne = setTimeout(() => {
1548
+ if (ne = void 0, ue || s.value !== "idle") return;
1549
+ D = he(), b = 0;
1550
+ const m = t.indexAt(D);
1551
+ ze(m, t.target(m, D), 0);
1538
1552
  }, 120));
1539
1553
  }
1540
- function ze(i) {
1541
- y !== void 0 && i.preventDefault();
1554
+ function Ee(d) {
1555
+ r !== void 0 && d.preventDefault();
1542
1556
  }
1543
- return qe(() => {
1544
- ke(!1), ie = !0, ce !== void 0 && clearTimeout(ce), t.viewport() && (t.viewport().style.scrollSnapType = fe);
1557
+ return Xe(() => {
1558
+ F(!1), ue = !0, ae !== void 0 && clearTimeout(ae), t.viewport() && (t.viewport().style.scrollSnapType = le);
1545
1559
  }), {
1546
1560
  phase: s,
1547
- busy: I,
1548
- dragging: e,
1549
- transformed: x,
1550
- read: le,
1551
- write: pe,
1552
- cancel: ke,
1553
- commit: ve,
1554
- navigate: Me,
1555
- displayedPosition: b,
1556
- handleScroll: $e,
1557
- handlePointerDown: be,
1558
- handlePointerMove: ye,
1559
- handlePointerUp: de,
1560
- handlePointerCancel: v,
1561
- handleLostPointerCapture: r,
1562
- handleClick: q,
1563
- handleWheel: Q,
1564
- handleDragStart: ze
1561
+ busy: z,
1562
+ dragging: x,
1563
+ pointerActive: I,
1564
+ transformed: y,
1565
+ read: he,
1566
+ write: ve,
1567
+ cancel: F,
1568
+ commit: E,
1569
+ navigate: be,
1570
+ displayedPosition: oe,
1571
+ handleScroll: Me,
1572
+ handlePointerDown: ce,
1573
+ handlePointerMove: de,
1574
+ handlePointerUp: T,
1575
+ handlePointerCancel: i,
1576
+ handleLostPointerCapture: Q,
1577
+ handleClick: ke,
1578
+ handleWheel: ge,
1579
+ handleDragStart: Ee
1565
1580
  };
1566
1581
  }
1567
1582
  function va(t) {
@@ -1571,45 +1586,45 @@ function va(t) {
1571
1586
  }
1572
1587
  function e() {
1573
1588
  if (I(), !t.enabled() || t.paused() || t.count() < 2 || t.atEnd() && !t.loop()) return;
1574
- const x = Number.isFinite(t.delay()) ? Math.max(1, t.delay()) : 3e3;
1589
+ const z = Number.isFinite(t.delay()) ? Math.max(1, t.delay()) : 3e3;
1575
1590
  s = setTimeout(() => {
1576
1591
  s = void 0, !t.paused() && (t.atEnd() ? t.rewind() : t.advance(), e());
1577
- }, x);
1592
+ }, z);
1578
1593
  }
1579
- return we(
1594
+ return ye(
1580
1595
  () => [t.enabled(), t.paused(), t.delay(), t.count(), t.loop(), t.atEnd()],
1581
1596
  e,
1582
1597
  { immediate: !0 }
1583
- ), qe(I), { start: e, stop: I };
1598
+ ), Xe(I), { start: e, stop: I };
1584
1599
  }
1585
- function ut(t, s) {
1600
+ function dt(t, s) {
1586
1601
  return s > 0 ? (t % s + s) % s : 0;
1587
1602
  }
1588
1603
  function ma(t, s) {
1589
1604
  const I = new Array(t.length + 1);
1590
1605
  I[0] = 0;
1591
- for (let d = 0; d < t.length; d += 1)
1592
- I[d + 1] = I[d] + t[d] + s;
1593
- const e = I[t.length], x = Math.max(0, e - (t.length ? s : 0));
1594
- function y(d) {
1606
+ for (let r = 0; r < t.length; r += 1)
1607
+ I[r + 1] = I[r] + t[r] + s;
1608
+ const e = I[t.length], z = Math.max(0, e - (t.length ? s : 0));
1609
+ function x(r) {
1595
1610
  if (!t.length) return 0;
1596
- let c = 0, n = t.length - 1;
1597
- for (; c < n; ) {
1598
- const h = Math.ceil((c + n) / 2);
1599
- I[h] <= d ? c = h : n = h - 1;
1611
+ let u = 0, n = t.length - 1;
1612
+ for (; u < n; ) {
1613
+ const M = Math.ceil((u + n) / 2);
1614
+ I[M] <= r ? u = M : n = M - 1;
1600
1615
  }
1601
- return c;
1616
+ return u;
1602
1617
  }
1603
- function M(d) {
1604
- const c = y(d), n = Math.min(t.length - 1, c + 1);
1605
- return d - I[c] <= I[n] - d ? c : n;
1618
+ function y(r) {
1619
+ const u = x(r), n = Math.min(t.length - 1, u + 1);
1620
+ return r - I[u] <= I[n] - r ? u : n;
1606
1621
  }
1607
- return { offsets: I, cycleWidth: e, totalWidth: x, indexAt: y, nearestIndex: M };
1622
+ return { offsets: I, cycleWidth: e, totalWidth: z, indexAt: x, nearestIndex: y };
1608
1623
  }
1609
1624
  const ha = ["dir", "aria-label"], ga = ["data-carousel-index", "aria-label", "aria-current", "aria-hidden", "inert"], pa = {
1610
1625
  key: 1,
1611
1626
  class: "vue-virtual-carousel__empty"
1612
- }, ya = /* @__PURE__ */ Qe({
1627
+ }, ya = /* @__PURE__ */ tt({
1613
1628
  name: "VirtualCarousel",
1614
1629
  __name: "VirtualCarousel",
1615
1630
  props: {
@@ -1630,6 +1645,7 @@ const ha = ["dir", "aria-label"], ga = ["data-carousel-index", "aria-label", "ar
1630
1645
  autoplayLoop: { type: Boolean, default: !0 },
1631
1646
  pauseOnHover: { type: Boolean, default: !0 },
1632
1647
  mouseDrag: { type: Boolean, default: !0 },
1648
+ mouseDragMode: { default: "drag" },
1633
1649
  dragThreshold: { default: 8 },
1634
1650
  momentum: { type: Boolean, default: !0 },
1635
1651
  settleDuration: { default: 250 },
@@ -1645,328 +1661,329 @@ const ha = ["dir", "aria-label"], ga = ["data-carousel-index", "aria-label", "ar
1645
1661
  },
1646
1662
  emits: ["update:activeIndex", "change", "reachStart", "reachEnd", "loadMore"],
1647
1663
  setup(t, { expose: s, emit: I }) {
1648
- const e = t, x = I, y = ee(), M = ee(), d = ee(0), c = ee(0), n = ee(0), h = ee(!1), $ = ee(!1), Y = ee(), A = ct([]), P = ct([0, 1]), E = ct(/* @__PURE__ */ new Map()), S = ct([]);
1649
- let B, K, G = -1, te = !1;
1650
- const ce = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new Map(), { getItemKey: fe } = tt({
1664
+ const e = t, z = I, x = X(), y = X(), r = X(0), u = X(0), n = X(0), M = X(!1), R = X(!1), D = X(), b = ft([]), A = ft([0, 1]), C = ft(/* @__PURE__ */ new Map()), $ = ft([]);
1665
+ let B, V, G = -1, Y = !1;
1666
+ const se = /* @__PURE__ */ new Map(), H = /* @__PURE__ */ new Map(), { getItemKey: ae } = lt({
1651
1667
  componentName: "VirtualCarousel",
1652
1668
  items: () => e.items,
1653
1669
  itemKey: () => e.itemKey
1654
- }), ne = m(() => e.items.map((a, l) => fe(a, l))), oe = m(() => new Map(ne.value.map((a, l) => [a, l]))), ie = (a, l, g) => Math.max(l, Math.floor(Number.isFinite(a) ? a : g)), H = m(() => {
1655
- const a = [...e.responsive ?? []].sort((l, g) => g.breakpoint - l.breakpoint).find((l) => d.value >= l.breakpoint);
1670
+ }), ne = h(() => e.items.map((a, l) => ae(a, l))), le = h(() => new Map(ne.value.map((a, l) => [a, l]))), ie = (a, l, g) => Math.max(l, Math.floor(Number.isFinite(a) ? a : g)), te = h(() => {
1671
+ const a = [...e.responsive ?? []].sort((l, g) => g.breakpoint - l.breakpoint).find((l) => r.value >= l.breakpoint);
1656
1672
  return {
1657
1673
  slidesPerView: ie((a == null ? void 0 : a.slidesPerView) ?? e.slidesPerView, 1, 1),
1658
1674
  slidesToScroll: ie((a == null ? void 0 : a.slidesToScroll) ?? e.slidesToScroll, 1, 1),
1659
1675
  gap: Math.max(0, Number.isFinite((a == null ? void 0 : a.gap) ?? e.gap) ? (a == null ? void 0 : a.gap) ?? e.gap : 0)
1660
1676
  };
1661
- }), le = m(() => ie(e.buffer, 0, 1)), pe = m(() => ie(e.maxCachedItems, 0, 20)), xe = m(() => d.value > 0 ? Math.max(
1677
+ }), ue = h(() => ie(e.buffer, 0, 1)), fe = h(() => ie(e.maxCachedItems, 0, 20)), he = h(() => r.value > 0 ? Math.max(
1662
1678
  1,
1663
- (d.value - (H.value.slidesPerView - 1) * H.value.gap) / H.value.slidesPerView
1664
- ) : 0), he = m(() => e.items.map((a, l) => e.autoWidth ? E.value.get(ne.value[l]) ?? Math.max(1, Number.isFinite(e.estimatedItemWidth) ? e.estimatedItemWidth : 240) : xe.value)), ae = m(() => ma(he.value, H.value.gap)), F = m(() => e.loop && e.items.length > 1 && ae.value.totalWidth > d.value), b = m(() => Math.max(0, ae.value.totalWidth - d.value)), C = m(() => {
1665
- if (F.value) return e.items.length - 1;
1666
- if (!e.autoWidth) return Math.max(0, e.items.length - H.value.slidesPerView);
1667
- if (b.value <= 0) return 0;
1668
- const a = ae.value.indexAt(b.value), l = ae.value.offsets[a] < b.value - 0.01 ? a + 1 : a;
1679
+ (r.value - (te.value.slidesPerView - 1) * te.value.gap) / te.value.slidesPerView
1680
+ ) : 0), ve = h(() => e.items.map((a, l) => e.autoWidth ? C.value.get(ne.value[l]) ?? Math.max(1, Number.isFinite(e.estimatedItemWidth) ? e.estimatedItemWidth : 240) : he.value)), J = h(() => ma(ve.value, te.value.gap)), O = h(() => e.loop && e.items.length > 1 && J.value.totalWidth > r.value), S = h(() => Math.max(0, J.value.totalWidth - r.value)), P = h(() => {
1681
+ if (O.value) return e.items.length - 1;
1682
+ if (!e.autoWidth) return Math.max(0, e.items.length - te.value.slidesPerView);
1683
+ if (S.value <= 0) return 0;
1684
+ const a = J.value.indexAt(S.value), l = J.value.offsets[a] < S.value - 0.01 ? a + 1 : a;
1669
1685
  return Math.min(e.items.length - 1, l);
1670
- }), se = m(() => F.value ? ae.value.cycleWidth * 3 : ae.value.totalWidth), ve = m(() => ({ height: mt(e.height) })), ke = m(() => ({
1671
- width: `${se.value}px`,
1672
- height: e.height === "auto" ? `${Math.max(1, c.value)}px` : "100%"
1686
+ }), oe = h(() => O.value ? J.value.cycleWidth * 3 : J.value.totalWidth), me = h(() => ({ height: gt(e.height) })), Ae = h(() => ({
1687
+ width: `${oe.value}px`,
1688
+ height: e.height === "auto" ? `${Math.max(1, u.value)}px` : "100%"
1673
1689
  }));
1674
- function L(a) {
1690
+ function E(a) {
1675
1691
  const l = Math.floor(Number.isFinite(a) ? a : 0);
1676
- return F.value ? ut(l, e.items.length) : Math.max(0, Math.min(C.value, l));
1692
+ return O.value ? dt(l, e.items.length) : Math.max(0, Math.min(P.value, l));
1677
1693
  }
1678
- n.value = L(e.activeIndex);
1679
- function N(a) {
1680
- const l = ae.value.offsets[L(a)] ?? 0;
1681
- return F.value ? ae.value.cycleWidth + l : Math.min(b.value, l);
1694
+ n.value = E(e.activeIndex);
1695
+ function F(a) {
1696
+ const l = J.value.offsets[E(a)] ?? 0;
1697
+ return O.value ? J.value.cycleWidth + l : Math.min(S.value, l);
1682
1698
  }
1683
- function J(a) {
1684
- const l = ae.value.cycleWidth;
1685
- return F.value && l > 0 ? (a % l + l) % l : Math.max(0, a);
1699
+ function _(a) {
1700
+ const l = J.value.cycleWidth;
1701
+ return O.value && l > 0 ? (a % l + l) % l : Math.max(0, a);
1686
1702
  }
1687
- function Me(a) {
1688
- if (!F.value && a >= b.value - 1 && b.value > 0) return C.value;
1689
- const l = J(a);
1690
- return F.value && l > (ae.value.offsets[e.items.length - 1] + ae.value.cycleWidth) / 2 ? 0 : L(ae.value.nearestIndex(l));
1703
+ function pe(a) {
1704
+ if (!O.value && a >= S.value - 1 && S.value > 0) return P.value;
1705
+ const l = _(a);
1706
+ return O.value && l > (J.value.offsets[e.items.length - 1] + J.value.cycleWidth) / 2 ? 0 : E(J.value.nearestIndex(l));
1691
1707
  }
1692
- function $e(a, l, g = 0) {
1693
- const V = N(a);
1694
- if (!F.value) return V;
1695
- const Te = ae.value.cycleWidth, Be = [V - Te, V, V + Te], Ae = Be.filter((We) => g > 0 ? We > l + 0.5 : g < 0 ? We < l - 0.5 : !0);
1696
- return (Ae.length ? Ae : Be).sort((We, at) => Math.abs(We - l) - Math.abs(at - l))[0];
1708
+ function ze(a, l, g = 0) {
1709
+ const W = F(a);
1710
+ if (!O.value) return W;
1711
+ const Te = J.value.cycleWidth, Ke = [W - Te, W, W + Te], Be = Ke.filter((He) => g > 0 ? He > l + 0.5 : g < 0 ? He < l - 0.5 : !0);
1712
+ return (Be.length ? Be : Ke).sort((He, ot) => Math.abs(He - l) - Math.abs(ot - l))[0];
1697
1713
  }
1698
1714
  function be(a) {
1699
- if (!F.value) return ae.value.indexAt(Math.max(0, a));
1700
- const l = ae.value.cycleWidth, g = Math.floor(a / l);
1701
- return g * e.items.length + ae.value.indexAt(a - g * l);
1715
+ if (!O.value) return J.value.indexAt(Math.max(0, a));
1716
+ const l = J.value.cycleWidth, g = Math.floor(a / l);
1717
+ return g * e.items.length + J.value.indexAt(a - g * l);
1702
1718
  }
1703
- function ye(a) {
1704
- return F.value ? Math.floor(a / e.items.length) * ae.value.cycleWidth + ae.value.offsets[ut(a, e.items.length)] : ae.value.offsets[a] ?? 0;
1719
+ function Me(a) {
1720
+ return O.value ? Math.floor(a / e.items.length) * J.value.cycleWidth + J.value.offsets[dt(a, e.items.length)] : J.value.offsets[a] ?? 0;
1705
1721
  }
1706
- function re(a) {
1722
+ function ce(a) {
1707
1723
  if (e.items.length === 0) {
1708
- A.value = [], P.value = [0, 0];
1724
+ b.value = [], A.value = [0, 0];
1709
1725
  return;
1710
1726
  }
1711
- if (d.value <= 0) return;
1712
- const l = be(a), g = be(a + d.value - 0.01);
1713
- (P.value[0] !== l || P.value[1] !== g + 1) && (P.value = [l, g + 1]);
1714
- const V = [];
1727
+ if (r.value <= 0) return;
1728
+ const l = be(a), g = be(a + r.value - 0.01);
1729
+ (A.value[0] !== l || A.value[1] !== g + 1) && (A.value = [l, g + 1]);
1730
+ const W = [];
1715
1731
  for (let Te = l; Te <= g; Te += 1) {
1716
- const Be = F.value ? ut(Te, e.items.length) : Te;
1717
- if (Be < 0 || Be >= e.items.length) continue;
1718
- const Ae = ye(Te);
1719
- Ae + he.value[Be] > a + 0.01 && Ae < a + d.value - 0.01 && !V.includes(Be) && V.push(Be);
1732
+ const Ke = O.value ? dt(Te, e.items.length) : Te;
1733
+ if (Ke < 0 || Ke >= e.items.length) continue;
1734
+ const Be = Me(Te);
1735
+ Be + ve.value[Ke] > a + 0.01 && Be < a + r.value - 0.01 && !W.includes(Ke) && W.push(Ke);
1720
1736
  }
1721
- V.join(",") !== A.value.join(",") && (A.value = V);
1737
+ W.join(",") !== b.value.join(",") && (b.value = W);
1722
1738
  }
1723
1739
  function de(a) {
1724
1740
  if (e.autoWidth) {
1725
- const l = N(n.value), g = $e(a, l);
1726
- return g + he.value[a] > l && g < l + d.value;
1741
+ const l = F(n.value), g = ze(a, l);
1742
+ return g + ve.value[a] > l && g < l + r.value;
1727
1743
  }
1728
- return F.value ? ut(a - n.value, e.items.length) < H.value.slidesPerView : a >= n.value && a < n.value + H.value.slidesPerView;
1744
+ return O.value ? dt(a - n.value, e.items.length) < te.value.slidesPerView : a >= n.value && a < n.value + te.value.slidesPerView;
1729
1745
  }
1730
1746
  function v() {
1731
1747
  if (!e.hasMore || e.loading || G === e.items.length) return;
1732
- const a = e.autoWidth ? A.value.length : H.value.slidesPerView;
1733
- e.items.length - n.value - Math.max(1, a) <= ie(e.loadMoreThreshold, 0, 2) && (G = e.items.length, x("loadMore"));
1748
+ const a = e.autoWidth ? b.value.length : te.value.slidesPerView;
1749
+ e.items.length - n.value - Math.max(1, a) <= ie(e.loadMoreThreshold, 0, 2) && (G = e.items.length, z("loadMore"));
1734
1750
  }
1735
1751
  function T(a) {
1736
- const l = L(a);
1737
- !e.items.length || l === n.value || (n.value = l, x("update:activeIndex", l), x("change", { index: l, item: e.items[l] }), l === 0 && x("reachStart"), l === C.value && x("reachEnd"), v());
1752
+ const l = E(a);
1753
+ !e.items.length || l === n.value || (n.value = l, z("update:activeIndex", l), z("change", { index: l, item: e.items[l] }), l === 0 && z("reachStart"), l === P.value && z("reachEnd"), v());
1738
1754
  }
1739
- const r = fa({
1740
- viewport: () => y.value,
1741
- track: () => M.value,
1755
+ const i = fa({
1756
+ viewport: () => x.value,
1757
+ track: () => y.value,
1742
1758
  rtl: () => e.rtl,
1743
1759
  mouseDrag: () => e.mouseDrag,
1744
- nativeSnap: () => e.nativeSnap && !F.value,
1760
+ mouseDragMode: () => e.mouseDragMode,
1761
+ nativeSnap: () => e.nativeSnap && !O.value,
1745
1762
  dragThreshold: () => Math.max(1, Number.isFinite(e.dragThreshold) ? e.dragThreshold : 8),
1746
1763
  momentum: () => e.momentum,
1747
1764
  settleDuration: () => Math.max(0, Number.isFinite(e.settleDuration) ? e.settleDuration : 250),
1748
- limits: () => [0, F.value ? Math.max(0, se.value - d.value) : b.value],
1749
- step: () => he.value[n.value] + H.value.gap || 1,
1750
- indexAt: Me,
1751
- target: $e,
1752
- canonical: N,
1753
- onPosition: re,
1765
+ limits: () => [0, O.value ? Math.max(0, oe.value - r.value) : S.value],
1766
+ step: () => ve.value[n.value] + te.value.gap || 1,
1767
+ indexAt: pe,
1768
+ target: ze,
1769
+ canonical: F,
1770
+ onPosition: ce,
1754
1771
  onCommit: T
1755
- }), { phase: q, dragging: Q } = r, ze = va({
1756
- enabled: () => $.value && e.autoplay,
1757
- paused: () => q.value === "pending" || q.value === "dragging" || q.value === "committing" || F.value && q.value === "settling" || h.value && e.pauseOnHover,
1772
+ }), { phase: q, dragging: Q } = i, ke = va({
1773
+ enabled: () => R.value && e.autoplay,
1774
+ paused: () => i.pointerActive.value || q.value === "pending" || q.value === "dragging" || q.value === "committing" || O.value && q.value === "settling" || M.value && e.pauseOnHover,
1758
1775
  delay: () => e.autoplayDelay,
1759
1776
  count: () => e.items.length,
1760
- atEnd: () => !F.value && n.value >= C.value,
1761
- loop: () => F.value || e.autoplayLoop,
1762
- advance: () => Le(),
1763
- rewind: () => ge(0, { behavior: "smooth" })
1764
- }), i = m(() => {
1765
- const a = Q.value || r.transformed.value, l = le.value + (a ? H.value.slidesPerView + 2 : 0);
1766
- let g, V;
1767
- !e.autoWidth && !F.value && !a ? (g = Math.max(0, n.value - l), V = Math.min(e.items.length, n.value + H.value.slidesPerView + l)) : (g = Math.max(0, P.value[0] - l), V = Math.min(F.value ? e.items.length * 3 : e.items.length, P.value[1] + l));
1768
- const Te = (P.value[0] + P.value[1] - 1) / 2, Be = /* @__PURE__ */ new Map();
1769
- for (let Ae = g; Ae < V; Ae += 1) {
1770
- const We = F.value ? ut(Ae, e.items.length) : Ae, at = Be.get(We);
1771
- (!at || Math.abs(Ae - Te) < Math.abs(at.virtual - Te)) && Be.set(We, { index: We, virtual: Ae, cached: !1 });
1777
+ atEnd: () => !O.value && n.value >= P.value,
1778
+ loop: () => O.value || e.autoplayLoop,
1779
+ advance: () => $e(),
1780
+ rewind: () => we(0, { behavior: "smooth" })
1781
+ }), ge = h(() => {
1782
+ const a = Q.value || i.transformed.value, l = ue.value + (a ? te.value.slidesPerView + 2 : 0);
1783
+ let g, W;
1784
+ !e.autoWidth && !O.value && !a ? (g = Math.max(0, n.value - l), W = Math.min(e.items.length, n.value + te.value.slidesPerView + l)) : (g = Math.max(0, A.value[0] - l), W = Math.min(O.value ? e.items.length * 3 : e.items.length, A.value[1] + l));
1785
+ const Te = (A.value[0] + A.value[1] - 1) / 2, Ke = /* @__PURE__ */ new Map();
1786
+ for (let Be = g; Be < W; Be += 1) {
1787
+ const He = O.value ? dt(Be, e.items.length) : Be, ot = Ke.get(He);
1788
+ (!ot || Math.abs(Be - Te) < Math.abs(ot.virtual - Te)) && Ke.set(He, { index: He, virtual: Be, cached: !1 });
1772
1789
  }
1773
- return [...Be.values()].sort((Ae, We) => Ae.virtual - We.virtual);
1790
+ return [...Ke.values()].sort((Be, He) => Be.virtual - He.virtual);
1774
1791
  });
1775
- we([A, q, ne], () => {
1792
+ ye([b, q, ne], () => {
1776
1793
  if (q.value !== "idle") return;
1777
- const a = A.value.filter((g) => g < e.items.length).map((g) => ne.value[g]);
1794
+ const a = b.value.filter((g) => g < e.items.length).map((g) => ne.value[g]);
1778
1795
  if (!e.keepAlive) {
1779
- S.value = [];
1796
+ $.value = [];
1780
1797
  return;
1781
1798
  }
1782
- const l = S.value.filter((g) => oe.value.has(g) && !a.includes(g));
1783
- S.value = [...l, ...a].slice(-(pe.value + a.length));
1799
+ const l = $.value.filter((g) => le.value.has(g) && !a.includes(g));
1800
+ $.value = [...l, ...a].slice(-(fe.value + a.length));
1784
1801
  }, { immediate: !0 });
1785
- const D = m(() => {
1786
- const a = [...i.value], l = new Set(a.map((V) => V.index)), g = /* @__PURE__ */ new Set();
1787
- for (const V of e.pinnedIndexes.slice(0, pe.value))
1788
- Number.isInteger(V) && V >= 0 && V < e.items.length && g.add(V);
1789
- if (Y.value !== void 0 && Y.value < e.items.length && g.add(Y.value), e.keepAlive)
1790
- for (const V of [...S.value].reverse()) {
1791
- const Te = oe.value.get(V);
1792
- Te !== void 0 && !l.has(Te) && g.size < pe.value && g.add(Te);
1802
+ const Ee = h(() => {
1803
+ const a = [...ge.value], l = new Set(a.map((W) => W.index)), g = /* @__PURE__ */ new Set();
1804
+ for (const W of e.pinnedIndexes.slice(0, fe.value))
1805
+ Number.isInteger(W) && W >= 0 && W < e.items.length && g.add(W);
1806
+ if (D.value !== void 0 && D.value < e.items.length && g.add(D.value), e.keepAlive)
1807
+ for (const W of [...$.value].reverse()) {
1808
+ const Te = le.value.get(W);
1809
+ Te !== void 0 && !l.has(Te) && g.size < fe.value && g.add(Te);
1793
1810
  }
1794
- for (const V of g)
1795
- l.has(V) || a.push({ index: V, virtual: F.value ? e.items.length + V : V, cached: V !== Y.value });
1796
- return a.sort((V, Te) => V.virtual - Te.virtual).map((V) => ({
1797
- ...V,
1798
- item: e.items[V.index],
1799
- key: ne.value[V.index]
1811
+ for (const W of g)
1812
+ l.has(W) || a.push({ index: W, virtual: O.value ? e.items.length + W : W, cached: W !== D.value });
1813
+ return a.sort((W, Te) => W.virtual - Te.virtual).map((W) => ({
1814
+ ...W,
1815
+ item: e.items[W.index],
1816
+ key: ne.value[W.index]
1800
1817
  }));
1801
- }), _ = m(() => i.value.length ? ye(i.value[0].virtual) : 0), X = m(() => !e.autoWidth && !F.value && !e.keepAlive && !e.pinnedIndexes.length && (Y.value === void 0 || i.value.some((a) => a.index === Y.value))), p = m(() => {
1802
- const a = i.value[i.value.length - 1];
1803
- return a ? Math.max(0, se.value - ye(a.virtual) - he.value[a.index] - H.value.gap) : 0;
1818
+ }), d = h(() => ge.value.length ? Me(ge.value[0].virtual) : 0), K = h(() => !e.autoWidth && !O.value && !e.keepAlive && !e.pinnedIndexes.length && (D.value === void 0 || ge.value.some((a) => a.index === D.value))), m = h(() => {
1819
+ const a = ge.value[ge.value.length - 1];
1820
+ return a ? Math.max(0, oe.value - Me(a.virtual) - ve.value[a.index] - te.value.gap) : 0;
1804
1821
  });
1805
- function z(a) {
1806
- const l = he.value[a.index];
1822
+ function w(a) {
1823
+ const l = ve.value[a.index];
1807
1824
  return {
1808
- position: X.value ? "relative" : "absolute",
1809
- [e.rtl ? "right" : "left"]: X.value ? void 0 : `${ye(a.virtual)}px`,
1825
+ position: K.value ? "relative" : "absolute",
1826
+ [e.rtl ? "right" : "left"]: K.value ? void 0 : `${Me(a.virtual)}px`,
1810
1827
  width: e.autoWidth ? "max-content" : `${l}px`,
1811
1828
  flexBasis: e.autoWidth ? "auto" : `${l}px`,
1812
- marginRight: !e.rtl && a.index < e.items.length - 1 ? `${H.value.gap}px` : "0px",
1813
- marginLeft: e.rtl && a.index < e.items.length - 1 ? `${H.value.gap}px` : "0px",
1829
+ marginRight: !e.rtl && a.index < e.items.length - 1 ? `${te.value.gap}px` : "0px",
1830
+ marginLeft: e.rtl && a.index < e.items.length - 1 ? `${te.value.gap}px` : "0px",
1814
1831
  height: e.height === "auto" ? "auto" : "100%",
1815
1832
  visibility: a.cached ? "hidden" : void 0,
1816
- scrollSnapAlign: e.nativeSnap && !F.value && d.value > 0 ? "start" : "none"
1833
+ scrollSnapAlign: e.nativeSnap && !O.value && r.value > 0 ? "start" : "none"
1817
1834
  };
1818
1835
  }
1819
1836
  function k() {
1820
- if (!R.size || q.value !== "idle") return;
1821
- const a = new Map(E.value);
1822
- for (const [l, g] of R) a.set(l, g);
1823
- R.clear(), E.value = a;
1837
+ if (!H.size || q.value !== "idle") return;
1838
+ const a = new Map(C.value);
1839
+ for (const [l, g] of H) a.set(l, g);
1840
+ H.clear(), C.value = a;
1824
1841
  }
1825
- function me(a, l) {
1842
+ function ee(a, l) {
1826
1843
  if (l < 0 || l >= e.items.length) return;
1827
- const { width: g, height: V } = a.getBoundingClientRect();
1828
- V > c.value && (c.value = V);
1844
+ const { width: g, height: W } = a.getBoundingClientRect();
1845
+ W > u.value && (u.value = W);
1829
1846
  const Te = ne.value[l];
1830
- e.autoWidth && g > 0 && Math.abs((E.value.get(Te) ?? 0) - g) > 0.5 && R.set(Te, g);
1847
+ e.autoWidth && g > 0 && Math.abs((C.value.get(Te) ?? 0) - g) > 0.5 && H.set(Te, g);
1831
1848
  }
1832
- function W() {
1849
+ function L() {
1833
1850
  var l;
1834
- if (te || e.height !== "auto") return;
1851
+ if (Y || e.height !== "auto") return;
1835
1852
  let a = 0;
1836
- for (const g of i.value)
1837
- a = Math.max(a, ((l = ce.get(g.index)) == null ? void 0 : l.getBoundingClientRect().height) ?? 0);
1838
- Math.abs(c.value - a) > 0.5 && (c.value = a);
1839
- }
1840
- function Ie(a, l) {
1841
- const g = ce.get(l);
1842
- if (g && (K == null || K.unobserve(g)), !(a instanceof HTMLElement)) {
1843
- ce.delete(l);
1853
+ for (const g of ge.value)
1854
+ a = Math.max(a, ((l = se.get(g.index)) == null ? void 0 : l.getBoundingClientRect().height) ?? 0);
1855
+ Math.abs(u.value - a) > 0.5 && (u.value = a);
1856
+ }
1857
+ function xe(a, l) {
1858
+ const g = se.get(l);
1859
+ if (g && (V == null || V.unobserve(g)), !(a instanceof HTMLElement)) {
1860
+ se.delete(l);
1844
1861
  return;
1845
1862
  }
1846
- ce.set(l, a), (e.autoWidth || e.height === "auto") && (K == null || K.observe(a), me(a, l), Z(k), Z(W));
1863
+ se.set(l, a), (e.autoWidth || e.height === "auto") && (V == null || V.observe(a), ee(a, l), Z(k), Z(L));
1847
1864
  }
1848
- function ge(a, l = {}) {
1849
- !e.items.length || d.value <= 0 || r.navigate(L(a), l.behavior ?? "auto", 0, F.value || !e.nativeSnap);
1865
+ function we(a, l = {}) {
1866
+ !e.items.length || r.value <= 0 || i.navigate(E(a), l.behavior ?? "auto", 0, O.value || !e.nativeSnap);
1850
1867
  }
1851
- function Le(a = "smooth") {
1852
- !e.items.length || d.value <= 0 || r.navigate(L(n.value + H.value.slidesToScroll), a, 1, F.value || !e.nativeSnap);
1868
+ function $e(a = "smooth") {
1869
+ !e.items.length || r.value <= 0 || i.navigate(E(n.value + te.value.slidesToScroll), a, 1, O.value || !e.nativeSnap);
1853
1870
  }
1854
- function He(a = "smooth") {
1855
- !e.items.length || d.value <= 0 || r.navigate(L(n.value - H.value.slidesToScroll), a, -1, F.value || !e.nativeSnap);
1871
+ function De(a = "smooth") {
1872
+ !e.items.length || r.value <= 0 || i.navigate(E(n.value - te.value.slidesToScroll), a, -1, O.value || !e.nativeSnap);
1856
1873
  }
1857
- function Oe(a) {
1858
- var V, Te;
1859
- if ((Te = (V = a.target) == null ? void 0 : V.closest) != null && Te.call(V, 'input, textarea, select, [contenteditable="true"]')) return;
1874
+ function Ie(a) {
1875
+ var W, Te;
1876
+ if ((Te = (W = a.target) == null ? void 0 : W.closest) != null && Te.call(W, 'input, textarea, select, [contenteditable="true"]')) return;
1860
1877
  const l = e.rtl ? "ArrowLeft" : "ArrowRight", g = e.rtl ? "ArrowRight" : "ArrowLeft";
1861
- a.key === l || a.key === "PageDown" ? (a.preventDefault(), Le()) : a.key === g || a.key === "PageUp" ? (a.preventDefault(), He()) : a.key === "Home" ? (a.preventDefault(), ge(0, { behavior: "smooth" })) : a.key === "End" && (a.preventDefault(), ge(C.value));
1878
+ a.key === l || a.key === "PageDown" ? (a.preventDefault(), $e()) : a.key === g || a.key === "PageUp" ? (a.preventDefault(), De()) : a.key === "Home" ? (a.preventDefault(), we(0, { behavior: "smooth" })) : a.key === "End" && (a.preventDefault(), we(P.value));
1862
1879
  }
1863
- function Mt(a) {
1864
- var g, V;
1865
- const l = (V = (g = a.target) == null ? void 0 : g.closest) == null ? void 0 : V.call(g, "[data-carousel-index]");
1866
- Y.value = l ? Number(l.getAttribute("data-carousel-index")) : void 0;
1880
+ function Ye(a) {
1881
+ var g, W;
1882
+ const l = (W = (g = a.target) == null ? void 0 : g.closest) == null ? void 0 : W.call(g, "[data-carousel-index]");
1883
+ D.value = l ? Number(l.getAttribute("data-carousel-index")) : void 0;
1867
1884
  }
1868
- function ht() {
1885
+ function je() {
1869
1886
  Z(() => {
1870
1887
  var a;
1871
- (a = y.value) != null && a.contains(document.activeElement) || (Y.value = void 0);
1888
+ (a = x.value) != null && a.contains(document.activeElement) || (D.value = void 0);
1872
1889
  });
1873
1890
  }
1874
- function it() {
1875
- r.cancel(!1), e.items.length ? T(L(n.value)) : n.value !== 0 && (n.value = 0, x("update:activeIndex", 0)), te || r.commit(n.value), Z(v);
1891
+ function Ze() {
1892
+ i.cancel(!1), e.items.length ? T(E(n.value)) : n.value !== 0 && (n.value = 0, z("update:activeIndex", 0)), Y || i.commit(n.value), Z(v);
1876
1893
  }
1877
- function rt() {
1894
+ function ut() {
1878
1895
  var l;
1879
- const a = ((l = y.value) == null ? void 0 : l.clientWidth) ?? 0;
1880
- a <= 0 || a === d.value || (d.value = a);
1896
+ const a = ((l = x.value) == null ? void 0 : l.clientWidth) ?? 0;
1897
+ a <= 0 || a === r.value || (r.value = a);
1881
1898
  }
1882
- return we(() => [
1899
+ return ye(() => [
1883
1900
  e.items.length,
1884
- d.value,
1885
- H.value.slidesPerView,
1886
- H.value.gap,
1901
+ r.value,
1902
+ te.value.slidesPerView,
1903
+ te.value.gap,
1887
1904
  e.rtl,
1888
- F.value,
1905
+ O.value,
1889
1906
  e.autoWidth,
1890
1907
  e.nativeSnap,
1891
- E.value
1892
- ], it), we(() => e.activeIndex, (a) => {
1893
- const l = L(a);
1894
- l !== n.value && (r.cancel(!1), n.value = l, r.commit(l), Z(v));
1895
- }), we(() => [e.hasMore, e.loading, e.loadMoreThreshold], () => {
1908
+ C.value
1909
+ ], Ze), ye(() => e.activeIndex, (a) => {
1910
+ const l = E(a);
1911
+ l !== n.value && (i.cancel(!1), n.value = l, i.commit(l), Z(v));
1912
+ }), ye(() => [e.hasMore, e.loading, e.loadMoreThreshold], () => {
1896
1913
  e.hasMore || (G = -1), Z(v);
1897
- }), we(() => ne.value, (a) => {
1914
+ }), ye(() => ne.value, (a) => {
1898
1915
  const l = new Set(a);
1899
- E.value = new Map([...E.value].filter(([g]) => l.has(g))), S.value = S.value.filter((g) => l.has(g));
1900
- }), we(q, (a) => {
1916
+ C.value = new Map([...C.value].filter(([g]) => l.has(g))), $.value = $.value.filter((g) => l.has(g));
1917
+ }), ye(q, (a) => {
1901
1918
  a === "idle" && Z(k);
1902
- }), we(() => [e.keepAlive, e.maxCachedItems], () => {
1903
- const a = A.value.map((l) => ne.value[l]);
1904
- S.value = e.keepAlive ? [...S.value.filter((l) => !a.includes(l)), ...a].slice(-(pe.value + a.length)) : [];
1905
- }), _e(async () => {
1906
- if (rt(), typeof ResizeObserver < "u" && (B = new ResizeObserver(rt), y.value && B.observe(y.value), K = new ResizeObserver((a) => {
1907
- for (const l of a) me(l.target, Number(l.target.dataset.carouselIndex));
1908
- k(), W();
1919
+ }), ye(() => [e.keepAlive, e.maxCachedItems], () => {
1920
+ const a = b.value.map((l) => ne.value[l]);
1921
+ $.value = e.keepAlive ? [...$.value.filter((l) => !a.includes(l)), ...a].slice(-(fe.value + a.length)) : [];
1922
+ }), at(async () => {
1923
+ if (ut(), typeof ResizeObserver < "u" && (B = new ResizeObserver(ut), x.value && B.observe(x.value), V = new ResizeObserver((a) => {
1924
+ for (const l of a) ee(l.target, Number(l.target.dataset.carouselIndex));
1925
+ k(), L();
1909
1926
  }), e.autoWidth || e.height === "auto"))
1910
- for (const [a, l] of ce)
1911
- K.observe(l), me(l, a);
1912
- await Z(), it(), $.value = !0;
1913
- }), qe(() => {
1914
- te = !0, B == null || B.disconnect(), K == null || K.disconnect();
1915
- }), s({ next: Le, previous: He, scrollToIndex: ge, startAutoplay: ze.start, stopAutoplay: ze.stop }), (a, l) => (j(), U("div", {
1927
+ for (const [a, l] of se)
1928
+ V.observe(l), ee(l, a);
1929
+ await Z(), Ze(), R.value = !0;
1930
+ }), Xe(() => {
1931
+ Y = !0, B == null || B.disconnect(), V == null || V.disconnect();
1932
+ }), s({ next: $e, previous: De, scrollToIndex: we, startAutoplay: ke.start, stopAutoplay: ke.stop }), (a, l) => (j(), U("div", {
1916
1933
  ref_key: "viewport",
1917
- ref: y,
1918
- class: ot(["vue-virtual-carousel", { "vue-virtual-carousel--mouse-drag": t.mouseDrag, "vue-virtual-carousel--dragging": f(Q), "vue-virtual-carousel--controlled": F.value || !t.nativeSnap }]),
1919
- style: ue(ve.value),
1934
+ ref: x,
1935
+ class: st(["vue-virtual-carousel", { "vue-virtual-carousel--mouse-drag": t.mouseDrag, "vue-virtual-carousel--dragging": f(Q), "vue-virtual-carousel--controlled": O.value || !t.nativeSnap }]),
1936
+ style: re(me.value),
1920
1937
  dir: t.rtl ? "rtl" : "ltr",
1921
1938
  role: "region",
1922
1939
  "aria-roledescription": "carousel",
1923
1940
  "aria-label": t.ariaLabel,
1924
1941
  tabindex: "0",
1925
1942
  onScrollPassive: l[0] || (l[0] = //@ts-ignore
1926
- (...g) => f(r).handleScroll && f(r).handleScroll(...g)),
1943
+ (...g) => f(i).handleScroll && f(i).handleScroll(...g)),
1927
1944
  onPointerdown: l[1] || (l[1] = //@ts-ignore
1928
- (...g) => f(r).handlePointerDown && f(r).handlePointerDown(...g)),
1945
+ (...g) => f(i).handlePointerDown && f(i).handlePointerDown(...g)),
1929
1946
  onPointermove: l[2] || (l[2] = //@ts-ignore
1930
- (...g) => f(r).handlePointerMove && f(r).handlePointerMove(...g)),
1947
+ (...g) => f(i).handlePointerMove && f(i).handlePointerMove(...g)),
1931
1948
  onPointerup: l[3] || (l[3] = //@ts-ignore
1932
- (...g) => f(r).handlePointerUp && f(r).handlePointerUp(...g)),
1949
+ (...g) => f(i).handlePointerUp && f(i).handlePointerUp(...g)),
1933
1950
  onPointercancel: l[4] || (l[4] = //@ts-ignore
1934
- (...g) => f(r).handlePointerCancel && f(r).handlePointerCancel(...g)),
1951
+ (...g) => f(i).handlePointerCancel && f(i).handlePointerCancel(...g)),
1935
1952
  onLostpointercapture: l[5] || (l[5] = //@ts-ignore
1936
- (...g) => f(r).handleLostPointerCapture && f(r).handleLostPointerCapture(...g)),
1953
+ (...g) => f(i).handleLostPointerCapture && f(i).handleLostPointerCapture(...g)),
1937
1954
  onClickCapture: l[6] || (l[6] = //@ts-ignore
1938
- (...g) => f(r).handleClick && f(r).handleClick(...g)),
1955
+ (...g) => f(i).handleClick && f(i).handleClick(...g)),
1939
1956
  onDragstart: l[7] || (l[7] = //@ts-ignore
1940
- (...g) => f(r).handleDragStart && f(r).handleDragStart(...g)),
1957
+ (...g) => f(i).handleDragStart && f(i).handleDragStart(...g)),
1941
1958
  onWheelPassive: l[8] || (l[8] = //@ts-ignore
1942
- (...g) => f(r).handleWheel && f(r).handleWheel(...g)),
1943
- onKeydown: Oe,
1944
- onMouseenter: l[9] || (l[9] = (g) => h.value = !0),
1945
- onMouseleave: l[10] || (l[10] = (g) => h.value = !1),
1946
- onFocusin: Mt,
1947
- onFocusout: ht
1959
+ (...g) => f(i).handleWheel && f(i).handleWheel(...g)),
1960
+ onKeydown: Ie,
1961
+ onMouseenter: l[9] || (l[9] = (g) => M.value = !0),
1962
+ onMouseleave: l[10] || (l[10] = (g) => M.value = !1),
1963
+ onFocusin: Ye,
1964
+ onFocusout: je
1948
1965
  }, [
1949
1966
  t.items.length ? (j(), U("div", {
1950
1967
  key: 0,
1951
1968
  ref_key: "track",
1952
- ref: M,
1969
+ ref: y,
1953
1970
  class: "vue-virtual-carousel__track",
1954
- style: ue(ke.value),
1971
+ style: re(Ae.value),
1955
1972
  role: "list"
1956
1973
  }, [
1957
- _.value > 0 ? (j(), U("div", {
1974
+ d.value > 0 ? (j(), U("div", {
1958
1975
  key: 0,
1959
1976
  class: "vue-virtual-carousel__spacer",
1960
- style: ue({ flexBasis: `${_.value}px`, position: X.value ? "relative" : "absolute" }),
1977
+ style: re({ flexBasis: `${d.value}px`, position: K.value ? "relative" : "absolute" }),
1961
1978
  "aria-hidden": "true"
1962
- }, null, 4)) : Ve("", !0),
1963
- (j(!0), U(Je, null, et(D.value, (g) => (j(), U("div", {
1979
+ }, null, 4)) : Re("", !0),
1980
+ (j(!0), U(et, null, nt(Ee.value, (g) => (j(), U("div", {
1964
1981
  key: g.key,
1965
1982
  ref_for: !0,
1966
- ref: (V) => Ie(V, g.index),
1983
+ ref: (W) => xe(W, g.index),
1967
1984
  class: "vue-virtual-carousel__item",
1968
1985
  "data-carousel-index": g.index,
1969
- style: ue(z(g)),
1986
+ style: re(w(g)),
1970
1987
  role: "listitem",
1971
1988
  "aria-roledescription": "slide",
1972
1989
  "aria-label": `${g.index + 1} of ${t.items.length}`,
@@ -1979,21 +1996,21 @@ const ha = ["dir", "aria-label"], ga = ["data-carousel-index", "aria-label", "ar
1979
1996
  index: g.index,
1980
1997
  active: g.index === n.value,
1981
1998
  visible: de(g.index),
1982
- inViewport: A.value.includes(g.index)
1999
+ inViewport: b.value.includes(g.index)
1983
2000
  })
1984
2001
  ], 12, ga))), 128)),
1985
- p.value > 0 ? (j(), U("div", {
2002
+ m.value > 0 ? (j(), U("div", {
1986
2003
  key: 1,
1987
2004
  class: "vue-virtual-carousel__spacer",
1988
- style: ue({ flexBasis: `${p.value}px`, position: X.value ? "relative" : "absolute" }),
2005
+ style: re({ flexBasis: `${m.value}px`, position: K.value ? "relative" : "absolute" }),
1989
2006
  "aria-hidden": "true"
1990
- }, null, 4)) : Ve("", !0)
2007
+ }, null, 4)) : Re("", !0)
1991
2008
  ], 4)) : (j(), U("div", pa, [
1992
2009
  Se(a.$slots, "empty")
1993
2010
  ]))
1994
2011
  ], 46, ha));
1995
2012
  }
1996
- }), wa = ["aria-label"], xa = ["aria-posinset", "aria-setsize"], Ma = /* @__PURE__ */ Qe({
2013
+ }), wa = ["aria-label"], Ma = ["aria-posinset", "aria-setsize"], xa = /* @__PURE__ */ tt({
1997
2014
  name: "VirtualScroll",
1998
2015
  __name: "VirtualScroll",
1999
2016
  props: {
@@ -2013,209 +2030,209 @@ const ha = ["dir", "aria-label"], ga = ["data-carousel-index", "aria-label", "ar
2013
2030
  },
2014
2031
  emits: ["scroll", "loadMore", "refresh"],
2015
2032
  setup(t, { expose: s, emit: I }) {
2016
- const e = t, x = I, {
2017
- pulling: y,
2018
- pullDistance: M,
2019
- pullOffset: d,
2020
- pullProgress: c,
2033
+ const e = t, z = I, {
2034
+ pulling: x,
2035
+ pullDistance: y,
2036
+ pullOffset: r,
2037
+ pullProgress: u,
2021
2038
  refreshMessage: n,
2022
- refreshThreshold: h,
2023
- handleTouchStart: $,
2024
- handleTouchMove: Y,
2025
- handleTouchEnd: A,
2026
- handleTouchCancel: P
2039
+ refreshThreshold: M,
2040
+ handleTouchStart: R,
2041
+ handleTouchMove: D,
2042
+ handleTouchEnd: b,
2043
+ handleTouchCancel: A
2027
2044
  } = xt({
2028
2045
  enabled: () => e.pullToRefresh,
2029
2046
  refreshing: () => e.refreshing,
2030
2047
  threshold: () => e.pullRefreshThreshold,
2031
- onRefresh: () => x("refresh")
2032
- }), E = ee(), S = ee(0), B = ee(0);
2033
- let K, G = -1;
2034
- const te = wt(), { getItemKey: ce } = tt({
2048
+ onRefresh: () => z("refresh")
2049
+ }), C = X(), $ = X(0), B = X(0);
2050
+ let V, G = -1;
2051
+ const Y = Mt(), { getItemKey: se } = lt({
2035
2052
  componentName: "VirtualScroll",
2036
2053
  items: () => e.items,
2037
2054
  itemKey: () => e.itemKey
2038
- }), R = m(() => Math.max(1, e.itemSize)), fe = m(() => Math.max(0, Math.floor(e.overscan))), ne = m(
2039
- () => e.items.length * R.value
2040
- ), oe = m(
2041
- () => Math.max(1, e.loadingItemSize ?? R.value)
2042
- ), ie = m(
2043
- () => ne.value + (e.loading ? oe.value : 0)
2044
- ), H = m(() => B.value > 0 ? B.value : typeof e.height == "number" ? e.height : 0), le = m(
2055
+ }), H = h(() => Math.max(1, e.itemSize)), ae = h(() => Math.max(0, Math.floor(e.overscan))), ne = h(
2056
+ () => e.items.length * H.value
2057
+ ), le = h(
2058
+ () => Math.max(1, e.loadingItemSize ?? H.value)
2059
+ ), ie = h(
2060
+ () => ne.value + (e.loading ? le.value : 0)
2061
+ ), te = h(() => B.value > 0 ? B.value : typeof e.height == "number" ? e.height : 0), ue = h(
2045
2062
  () => Math.max(
2046
2063
  0,
2047
- Math.floor(S.value / R.value) - fe.value
2064
+ Math.floor($.value / H.value) - ae.value
2048
2065
  )
2049
- ), pe = m(() => {
2050
- const L = Math.ceil(
2051
- (S.value + H.value) / R.value
2066
+ ), fe = h(() => {
2067
+ const E = Math.ceil(
2068
+ ($.value + te.value) / H.value
2052
2069
  );
2053
2070
  return Math.min(
2054
2071
  e.items.length,
2055
- L + fe.value
2072
+ E + ae.value
2056
2073
  );
2057
- }), xe = m(
2058
- () => e.items.slice(le.value, pe.value).map((L, N) => ({
2059
- item: L,
2060
- index: le.value + N
2074
+ }), he = h(
2075
+ () => e.items.slice(ue.value, fe.value).map((E, F) => ({
2076
+ item: E,
2077
+ index: ue.value + F
2061
2078
  }))
2062
- ), he = m(() => ({
2063
- height: mt(e.height)
2064
- })), ae = m(() => ({
2065
- transform: `translateY(${le.value * R.value}px)`
2079
+ ), ve = h(() => ({
2080
+ height: gt(e.height)
2081
+ })), J = h(() => ({
2082
+ transform: `translateY(${ue.value * H.value}px)`
2066
2083
  }));
2067
- function F() {
2068
- var L;
2069
- B.value = ((L = E.value) == null ? void 0 : L.clientHeight) ?? 0, te(E.value, e.height), Z(C);
2070
- }
2071
- function b(L) {
2072
- S.value = L.currentTarget.scrollTop, x("scroll", {
2073
- scrollTop: S.value,
2074
- startIndex: le.value,
2075
- endIndex: pe.value
2076
- }), C();
2077
- }
2078
- function C() {
2079
- const L = E.value;
2080
- if (!L || !e.hasMore || e.loading || G === e.items.length)
2084
+ function O() {
2085
+ var E;
2086
+ B.value = ((E = C.value) == null ? void 0 : E.clientHeight) ?? 0, Y(C.value, e.height), Z(P);
2087
+ }
2088
+ function S(E) {
2089
+ $.value = E.currentTarget.scrollTop, z("scroll", {
2090
+ scrollTop: $.value,
2091
+ startIndex: ue.value,
2092
+ endIndex: fe.value
2093
+ }), P();
2094
+ }
2095
+ function P() {
2096
+ const E = C.value;
2097
+ if (!E || !e.hasMore || e.loading || G === e.items.length)
2081
2098
  return;
2082
- const N = Math.max(0, e.loadMoreThreshold);
2083
- ie.value - L.scrollTop - L.clientHeight <= N && (G = e.items.length, x("loadMore"));
2084
- }
2085
- function se(L, N = {}) {
2086
- const J = E.value;
2087
- if (!J) return;
2088
- const Me = Math.max(0, ie.value - J.clientHeight), $e = Math.min(
2089
- Math.max(0, Number.isFinite(L) ? L : 0),
2090
- Me
2091
- ), be = N.behavior ?? "auto";
2092
- be === "auto" && (S.value = $e), J.scrollTo({ ...N, top: $e, behavior: be });
2093
- }
2094
- function ve(L, N = {}) {
2095
- const J = E.value;
2096
- if (!J || e.items.length === 0) return;
2097
- const Me = Math.min(
2099
+ const F = Math.max(0, e.loadMoreThreshold);
2100
+ ie.value - E.scrollTop - E.clientHeight <= F && (G = e.items.length, z("loadMore"));
2101
+ }
2102
+ function oe(E, F = {}) {
2103
+ const _ = C.value;
2104
+ if (!_) return;
2105
+ const pe = Math.max(0, ie.value - _.clientHeight), ze = Math.min(
2106
+ Math.max(0, Number.isFinite(E) ? E : 0),
2107
+ pe
2108
+ ), be = F.behavior ?? "auto";
2109
+ be === "auto" && ($.value = ze), _.scrollTo({ ...F, top: ze, behavior: be });
2110
+ }
2111
+ function me(E, F = {}) {
2112
+ const _ = C.value;
2113
+ if (!_ || e.items.length === 0) return;
2114
+ const pe = Math.min(
2098
2115
  e.items.length - 1,
2099
- Math.max(0, Math.floor(L))
2100
- ), { align: $e = "start", ...be } = N;
2101
- let ye = Me * R.value;
2102
- $e === "center" ? ye -= (J.clientHeight - R.value) / 2 : $e === "end" && (ye -= J.clientHeight - R.value), J.scrollTo({
2116
+ Math.max(0, Math.floor(E))
2117
+ ), { align: ze = "start", ...be } = F;
2118
+ let Me = pe * H.value;
2119
+ ze === "center" ? Me -= (_.clientHeight - H.value) / 2 : ze === "end" && (Me -= _.clientHeight - H.value), _.scrollTo({
2103
2120
  ...be,
2104
- top: Math.max(0, Math.min(ye, ie.value - J.clientHeight))
2121
+ top: Math.max(0, Math.min(Me, ie.value - _.clientHeight))
2105
2122
  });
2106
2123
  }
2107
- function ke(L = "auto") {
2108
- var N;
2109
- (N = E.value) == null || N.scrollTo({ top: 0, behavior: L });
2124
+ function Ae(E = "auto") {
2125
+ var F;
2126
+ (F = C.value) == null || F.scrollTo({ top: 0, behavior: E });
2110
2127
  }
2111
- return we(
2128
+ return ye(
2112
2129
  () => [e.items.length, e.itemSize],
2113
2130
  async () => {
2114
2131
  await Z();
2115
- const L = E.value;
2116
- if (!L) return;
2117
- const N = Math.max(0, ie.value - L.clientHeight);
2118
- L.scrollTop > N && (L.scrollTop = N, S.value = N), C();
2132
+ const E = C.value;
2133
+ if (!E) return;
2134
+ const F = Math.max(0, ie.value - E.clientHeight);
2135
+ E.scrollTop > F && (E.scrollTop = F, $.value = F), P();
2119
2136
  }
2120
- ), we(
2137
+ ), ye(
2121
2138
  () => [e.hasMore, e.loading],
2122
- async ([L]) => {
2123
- L || (G = -1), await Z(), C();
2139
+ async ([E]) => {
2140
+ E || (G = -1), await Z(), P();
2124
2141
  }
2125
- ), _e(() => {
2126
- F(), typeof ResizeObserver < "u" && E.value && (K = new ResizeObserver(F), K.observe(E.value)), Z(C);
2127
- }), qe(() => {
2128
- K && (K.disconnect(), K = void 0);
2142
+ ), at(() => {
2143
+ O(), typeof ResizeObserver < "u" && C.value && (V = new ResizeObserver(O), V.observe(C.value)), Z(P);
2144
+ }), Xe(() => {
2145
+ V && (V.disconnect(), V = void 0);
2129
2146
  }), s({
2130
- scrollTo: se,
2131
- scrollToIndex: ve,
2132
- scrollToTop: ke
2133
- }), (L, N) => (j(), U("div", {
2147
+ scrollTo: oe,
2148
+ scrollToIndex: me,
2149
+ scrollToTop: Ae
2150
+ }), (E, F) => (j(), U("div", {
2134
2151
  ref_key: "viewport",
2135
- ref: E,
2136
- class: ot(["vue-virtual-scroll", { "vue-virtual-scroll--pulling": f(y) }]),
2137
- style: ue(he.value),
2152
+ ref: C,
2153
+ class: st(["vue-virtual-scroll", { "vue-virtual-scroll--pulling": f(x) }]),
2154
+ style: re(ve.value),
2138
2155
  role: "list",
2139
2156
  "aria-label": t.ariaLabel,
2140
2157
  tabindex: "0",
2141
- onScrollPassive: b,
2142
- onTouchstartPassive: N[0] || (N[0] = //@ts-ignore
2143
- (...J) => f($) && f($)(...J)),
2144
- onTouchmove: N[1] || (N[1] = //@ts-ignore
2145
- (...J) => f(Y) && f(Y)(...J)),
2146
- onTouchend: N[2] || (N[2] = //@ts-ignore
2147
- (...J) => f(A) && f(A)(...J)),
2148
- onTouchcancel: N[3] || (N[3] = //@ts-ignore
2149
- (...J) => f(P) && f(P)(...J))
2158
+ onScrollPassive: S,
2159
+ onTouchstartPassive: F[0] || (F[0] = //@ts-ignore
2160
+ (..._) => f(R) && f(R)(..._)),
2161
+ onTouchmove: F[1] || (F[1] = //@ts-ignore
2162
+ (..._) => f(D) && f(D)(..._)),
2163
+ onTouchend: F[2] || (F[2] = //@ts-ignore
2164
+ (..._) => f(b) && f(b)(..._)),
2165
+ onTouchcancel: F[3] || (F[3] = //@ts-ignore
2166
+ (..._) => f(A) && f(A)(..._))
2150
2167
  }, [
2151
2168
  t.pullToRefresh || t.refreshing ? (j(), U("div", {
2152
2169
  key: 0,
2153
2170
  class: "vue-virtual-scroll__refresh",
2154
- style: ue({
2155
- height: `${f(h)}px`,
2156
- transform: `translateY(${f(d) - f(h)}px)`
2171
+ style: re({
2172
+ height: `${f(M)}px`,
2173
+ transform: `translateY(${f(r) - f(M)}px)`
2157
2174
  }),
2158
2175
  role: "status",
2159
2176
  "aria-live": "polite"
2160
2177
  }, [
2161
- Se(L.$slots, "refresh", {
2162
- pullDistance: f(M),
2163
- progress: f(c),
2178
+ Se(E.$slots, "refresh", {
2179
+ pullDistance: f(y),
2180
+ progress: f(u),
2164
2181
  refreshing: t.refreshing
2165
2182
  }, () => [
2166
- Ue(vt(f(n)), 1)
2183
+ Ge(ht(f(n)), 1)
2167
2184
  ])
2168
- ], 4)) : Ve("", !0),
2185
+ ], 4)) : Re("", !0),
2169
2186
  t.items.length || t.loading ? (j(), U("div", {
2170
2187
  key: 1,
2171
2188
  class: "vue-virtual-scroll__spacer",
2172
- style: ue({
2189
+ style: re({
2173
2190
  height: `${ie.value}px`,
2174
- transform: `translateY(${f(d)}px)`
2191
+ transform: `translateY(${f(r)}px)`
2175
2192
  })
2176
2193
  }, [
2177
- lt("div", {
2194
+ rt("div", {
2178
2195
  class: "vue-virtual-scroll__content",
2179
- style: ue(ae.value)
2196
+ style: re(J.value)
2180
2197
  }, [
2181
- (j(!0), U(Je, null, et(xe.value, ({ item: J, index: Me }) => (j(), U("div", {
2182
- key: f(ce)(J, Me),
2198
+ (j(!0), U(et, null, nt(he.value, ({ item: _, index: pe }) => (j(), U("div", {
2199
+ key: f(se)(_, pe),
2183
2200
  class: "vue-virtual-scroll__item",
2184
- style: ue({ height: `${R.value}px` }),
2201
+ style: re({ height: `${H.value}px` }),
2185
2202
  role: "listitem",
2186
- "aria-posinset": Me + 1,
2203
+ "aria-posinset": pe + 1,
2187
2204
  "aria-setsize": t.items.length
2188
2205
  }, [
2189
- Se(L.$slots, "default", {
2190
- item: J,
2191
- index: Me
2206
+ Se(E.$slots, "default", {
2207
+ item: _,
2208
+ index: pe
2192
2209
  })
2193
- ], 12, xa))), 128))
2210
+ ], 12, Ma))), 128))
2194
2211
  ], 4),
2195
2212
  t.loading ? (j(), U("div", {
2196
2213
  key: 0,
2197
2214
  class: "vue-virtual-scroll__loading",
2198
- style: ue({
2199
- height: `${oe.value}px`,
2215
+ style: re({
2216
+ height: `${le.value}px`,
2200
2217
  transform: `translateY(${ne.value}px)`
2201
2218
  }),
2202
2219
  role: "status",
2203
2220
  "aria-live": "polite"
2204
2221
  }, [
2205
- Se(L.$slots, "loading", {}, () => [
2206
- N[4] || (N[4] = Ue("Loading more…", -1))
2222
+ Se(E.$slots, "loading", {}, () => [
2223
+ F[4] || (F[4] = Ge("Loading more…", -1))
2207
2224
  ])
2208
- ], 4)) : Ve("", !0)
2225
+ ], 4)) : Re("", !0)
2209
2226
  ], 4)) : (j(), U("div", {
2210
2227
  key: 2,
2211
2228
  class: "vue-virtual-scroll__empty",
2212
- style: ue({ transform: `translateY(${f(d)}px)` })
2229
+ style: re({ transform: `translateY(${f(r)}px)` })
2213
2230
  }, [
2214
- Se(L.$slots, "empty")
2231
+ Se(E.$slots, "empty")
2215
2232
  ], 4))
2216
2233
  ], 46, wa));
2217
2234
  }
2218
- }), Ta = ["aria-label"], ba = ["aria-posinset", "aria-setsize"], Sa = /* @__PURE__ */ Qe({
2235
+ }), Ta = ["aria-label"], ba = ["aria-posinset", "aria-setsize"], Sa = /* @__PURE__ */ tt({
2219
2236
  name: "WindowDynamicVirtualScroll",
2220
2237
  __name: "WindowDynamicVirtualScroll",
2221
2238
  props: {
@@ -2234,328 +2251,328 @@ const ha = ["dir", "aria-label"], ga = ["data-carousel-index", "aria-label", "ar
2234
2251
  },
2235
2252
  emits: ["scroll", "loadMore", "refresh"],
2236
2253
  setup(t, { expose: s, emit: I }) {
2237
- const e = t, x = I, y = ee(), M = ee(0), d = ee(0), c = ee(0), n = ee(0), h = /* @__PURE__ */ new Map(), $ = /* @__PURE__ */ new Map(), Y = /* @__PURE__ */ new Map();
2238
- let A, P, E, S, B = !1, K = !1, G = -1;
2239
- const { getItemKey: te } = tt({
2254
+ const e = t, z = I, x = X(), y = X(0), r = X(0), u = X(0), n = X(0), M = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new Map();
2255
+ let b, A, C, $, B = !1, V = !1, G = -1;
2256
+ const { getItemKey: Y } = lt({
2240
2257
  componentName: "WindowDynamicVirtualScroll",
2241
2258
  items: () => e.items,
2242
2259
  itemKey: () => e.itemKey
2243
2260
  });
2244
- function ce(p) {
2261
+ function se(m) {
2245
2262
  return typeof window.requestAnimationFrame == "function" ? {
2246
- id: window.requestAnimationFrame(p),
2263
+ id: window.requestAnimationFrame(m),
2247
2264
  type: "animation"
2248
2265
  } : {
2249
- id: window.setTimeout(p, 0),
2266
+ id: window.setTimeout(m, 0),
2250
2267
  type: "timeout"
2251
2268
  };
2252
2269
  }
2253
- function R(p) {
2254
- p && (p.type === "animation" ? window.cancelAnimationFrame(p.id) : window.clearTimeout(p.id));
2270
+ function H(m) {
2271
+ m && (m.type === "animation" ? window.cancelAnimationFrame(m.id) : window.clearTimeout(m.id));
2255
2272
  }
2256
2273
  const {
2257
- pulling: fe,
2274
+ pulling: ae,
2258
2275
  pullDistance: ne,
2259
- pullOffset: oe,
2276
+ pullOffset: le,
2260
2277
  pullProgress: ie,
2261
- refreshMessage: H,
2262
- refreshThreshold: le,
2263
- handleTouchStart: pe,
2264
- handleTouchMove: xe,
2265
- handleTouchEnd: he,
2266
- handleTouchCancel: ae
2278
+ refreshMessage: te,
2279
+ refreshThreshold: ue,
2280
+ handleTouchStart: fe,
2281
+ handleTouchMove: he,
2282
+ handleTouchEnd: ve,
2283
+ handleTouchCancel: J
2267
2284
  } = xt({
2268
2285
  enabled: () => e.pullToRefresh,
2269
2286
  refreshing: () => e.refreshing,
2270
2287
  threshold: () => e.pullRefreshThreshold,
2271
- onRefresh: () => x("refresh"),
2288
+ onRefresh: () => z("refresh"),
2272
2289
  scrollTop: () => typeof window > "u" ? 0 : Math.max(0, window.scrollY)
2273
- }), F = m(
2290
+ }), O = h(
2274
2291
  () => Math.max(1, e.estimatedItemSize)
2275
- ), b = m(
2276
- () => Math.max(1, e.loadingItemSize ?? F.value)
2277
- ), C = m(() => Math.max(0, Math.floor(e.overscan))), se = m(() => {
2292
+ ), S = h(
2293
+ () => Math.max(1, e.loadingItemSize ?? O.value)
2294
+ ), P = h(() => Math.max(0, Math.floor(e.overscan))), oe = h(() => {
2278
2295
  n.value;
2279
- const p = new Array(e.items.length + 1), z = new Array(e.items.length);
2280
- p[0] = 0;
2296
+ const m = new Array(e.items.length + 1), w = new Array(e.items.length);
2297
+ m[0] = 0;
2281
2298
  for (let k = 0; k < e.items.length; k += 1) {
2282
- const me = te(e.items[k], k), W = h.get(me) ?? F.value;
2283
- z[k] = W, p[k + 1] = p[k] + W;
2299
+ const ee = Y(e.items[k], k), L = M.get(ee) ?? O.value;
2300
+ w[k] = L, m[k + 1] = m[k] + L;
2284
2301
  }
2285
2302
  return {
2286
- offsets: p,
2287
- sizes: z,
2288
- total: p[e.items.length] ?? 0
2303
+ offsets: m,
2304
+ sizes: w,
2305
+ total: m[e.items.length] ?? 0
2289
2306
  };
2290
- }), ve = m(
2291
- () => se.value.total + (e.loading ? b.value : 0)
2292
- ), ke = m(() => {
2293
- const p = /* @__PURE__ */ new Map();
2294
- return e.items.forEach((z, k) => {
2295
- p.set(te(z, k), k);
2296
- }), p;
2297
- }), L = m(
2298
- () => Math.max(0, M.value - c.value)
2307
+ }), me = h(
2308
+ () => oe.value.total + (e.loading ? S.value : 0)
2309
+ ), Ae = h(() => {
2310
+ const m = /* @__PURE__ */ new Map();
2311
+ return e.items.forEach((w, k) => {
2312
+ m.set(Y(w, k), k);
2313
+ }), m;
2314
+ }), E = h(
2315
+ () => Math.max(0, y.value - u.value)
2299
2316
  );
2300
- function N(p) {
2317
+ function F(m) {
2301
2318
  if (e.items.length === 0) return 0;
2302
- const z = se.value.offsets;
2303
- let k = 0, me = e.items.length;
2304
- for (; k < me; ) {
2305
- const W = Math.floor((k + me) / 2);
2306
- z[W + 1] <= p ? k = W + 1 : me = W;
2319
+ const w = oe.value.offsets;
2320
+ let k = 0, ee = e.items.length;
2321
+ for (; k < ee; ) {
2322
+ const L = Math.floor((k + ee) / 2);
2323
+ w[L + 1] <= m ? k = L + 1 : ee = L;
2307
2324
  }
2308
2325
  return Math.min(k, e.items.length - 1);
2309
2326
  }
2310
- const J = m(
2327
+ const _ = h(
2311
2328
  () => Math.max(
2312
2329
  0,
2313
- N(L.value) - C.value
2330
+ F(E.value) - P.value
2314
2331
  )
2315
- ), Me = m(() => {
2332
+ ), pe = h(() => {
2316
2333
  if (e.items.length === 0) return 0;
2317
- const p = M.value + d.value - c.value, z = Math.max(
2318
- F.value,
2319
- p
2320
- ), k = N(z) + 1;
2334
+ const m = y.value + r.value - u.value, w = Math.max(
2335
+ O.value,
2336
+ m
2337
+ ), k = F(w) + 1;
2321
2338
  return Math.min(
2322
2339
  e.items.length,
2323
- k + C.value
2340
+ k + P.value
2324
2341
  );
2325
- }), $e = m(
2326
- () => e.items.slice(J.value, Me.value).map((p, z) => {
2327
- const k = J.value + z;
2342
+ }), ze = h(
2343
+ () => e.items.slice(_.value, pe.value).map((m, w) => {
2344
+ const k = _.value + w;
2328
2345
  return {
2329
- item: p,
2346
+ item: m,
2330
2347
  index: k,
2331
- key: te(p, k),
2332
- top: se.value.offsets[k]
2348
+ key: Y(m, k),
2349
+ top: oe.value.offsets[k]
2333
2350
  };
2334
2351
  })
2335
2352
  );
2336
2353
  function be() {
2337
- typeof window > "u" || (M.value = Math.max(0, window.scrollY), d.value = window.innerHeight, y.value && (c.value = y.value.getBoundingClientRect().top + M.value));
2354
+ typeof window > "u" || (y.value = Math.max(0, window.scrollY), r.value = window.innerHeight, x.value && (u.value = x.value.getBoundingClientRect().top + y.value));
2338
2355
  }
2339
- function ye() {
2340
- x("scroll", {
2341
- scrollTop: L.value,
2342
- startIndex: J.value,
2343
- endIndex: Me.value
2356
+ function Me() {
2357
+ z("scroll", {
2358
+ scrollTop: E.value,
2359
+ startIndex: _.value,
2360
+ endIndex: pe.value
2344
2361
  });
2345
2362
  }
2346
- function re(p = !1) {
2347
- K && (B || (B = p), !E && (E = ce(() => {
2348
- E = void 0, be(), B && (B = !1, ye()), T();
2363
+ function ce(m = !1) {
2364
+ V && (B || (B = m), !C && (C = se(() => {
2365
+ C = void 0, be(), B && (B = !1, Me()), T();
2349
2366
  })));
2350
2367
  }
2351
2368
  function de() {
2352
- re(!0);
2369
+ ce(!0);
2353
2370
  }
2354
2371
  function v() {
2355
- re();
2372
+ ce();
2356
2373
  }
2357
2374
  function T() {
2358
2375
  if (typeof window > "u" || !e.hasMore || e.loading || G === e.items.length)
2359
2376
  return;
2360
- const p = Math.max(0, e.loadMoreThreshold), z = c.value + ve.value, k = M.value + d.value;
2361
- z - k <= p && (G = e.items.length, x("loadMore"));
2377
+ const m = Math.max(0, e.loadMoreThreshold), w = u.value + me.value, k = y.value + r.value;
2378
+ w - k <= m && (G = e.items.length, z("loadMore"));
2362
2379
  }
2363
- function r(p) {
2364
- const z = p.borderBoxSize;
2365
- if (z) {
2366
- const k = Array.isArray(z) ? z[0] : z;
2380
+ function i(m) {
2381
+ const w = m.borderBoxSize;
2382
+ if (w) {
2383
+ const k = Array.isArray(w) ? w[0] : w;
2367
2384
  if (k != null && k.blockSize) return k.blockSize;
2368
2385
  }
2369
- return p.contentRect.height;
2370
- }
2371
- function q(p) {
2372
- const z = se.value;
2373
- let k = 0, me = !1;
2374
- for (const W of p) {
2375
- const Ie = W.target, ge = $.get(Ie), Le = r(W);
2376
- if (ge === void 0 || Le <= 0) continue;
2377
- const He = h.get(ge) ?? F.value;
2378
- if (Math.abs(He - Le) < 0.5) continue;
2379
- const Oe = ke.value.get(ge);
2380
- Oe !== void 0 && z.offsets[Oe + 1] <= L.value && (k += Le - He), h.set(ge, Le), me = !0;
2386
+ return m.contentRect.height;
2387
+ }
2388
+ function q(m) {
2389
+ const w = oe.value;
2390
+ let k = 0, ee = !1;
2391
+ for (const L of m) {
2392
+ const xe = L.target, we = R.get(xe), $e = i(L);
2393
+ if (we === void 0 || $e <= 0) continue;
2394
+ const De = M.get(we) ?? O.value;
2395
+ if (Math.abs(De - $e) < 0.5) continue;
2396
+ const Ie = Ae.value.get(we);
2397
+ Ie !== void 0 && w.offsets[Ie + 1] <= E.value && (k += $e - De), M.set(we, $e), ee = !0;
2381
2398
  }
2382
- me && (n.value += 1, Z(() => {
2383
- if (K) {
2399
+ ee && (n.value += 1, Z(() => {
2400
+ if (V) {
2384
2401
  if (k !== 0 && typeof window < "u") {
2385
- const W = Math.max(
2402
+ const L = Math.max(
2386
2403
  0,
2387
- M.value + k
2404
+ y.value + k
2388
2405
  );
2389
- M.value = W, window.scrollTo({ top: W, behavior: "auto" });
2406
+ y.value = L, window.scrollTo({ top: L, behavior: "auto" });
2390
2407
  }
2391
2408
  be(), T();
2392
2409
  }
2393
2410
  }));
2394
2411
  }
2395
- function Q(p) {
2396
- if (K) {
2397
- for (const z of p)
2398
- Y.set(z.target, z);
2399
- S || (S = ce(() => {
2400
- S = void 0;
2401
- const z = Array.from(Y.values());
2402
- Y.clear(), q(z);
2412
+ function Q(m) {
2413
+ if (V) {
2414
+ for (const w of m)
2415
+ D.set(w.target, w);
2416
+ $ || ($ = se(() => {
2417
+ $ = void 0;
2418
+ const w = Array.from(D.values());
2419
+ D.clear(), q(w);
2403
2420
  }));
2404
2421
  }
2405
2422
  }
2406
- function ze(p, z) {
2407
- p instanceof HTMLElement && ($.set(p, z), P == null || P.observe(p));
2423
+ function ke(m, w) {
2424
+ m instanceof HTMLElement && (R.set(m, w), A == null || A.observe(m));
2408
2425
  }
2409
- function i() {
2410
- for (const [p] of $)
2411
- p.isConnected || (P == null || P.unobserve(p), $.delete(p));
2426
+ function ge() {
2427
+ for (const [m] of R)
2428
+ m.isConnected || (A == null || A.unobserve(m), R.delete(m));
2412
2429
  }
2413
- function D(p, z = {}) {
2430
+ function Ee(m, w = {}) {
2414
2431
  if (typeof window > "u") return;
2415
2432
  be();
2416
- const k = Math.max(0, ve.value - d.value), me = Math.min(
2417
- Math.max(0, Number.isFinite(p) ? p : 0),
2433
+ const k = Math.max(0, me.value - r.value), ee = Math.min(
2434
+ Math.max(0, Number.isFinite(m) ? m : 0),
2418
2435
  k
2419
- ), W = Math.max(0, c.value + me), Ie = z.behavior ?? "auto";
2420
- Ie === "auto" && (M.value = W), window.scrollTo({ ...z, top: W, behavior: Ie });
2436
+ ), L = Math.max(0, u.value + ee), xe = w.behavior ?? "auto";
2437
+ xe === "auto" && (y.value = L), window.scrollTo({ ...w, top: L, behavior: xe });
2421
2438
  }
2422
- function _(p, z = {}) {
2439
+ function d(m, w = {}) {
2423
2440
  if (typeof window > "u" || e.items.length === 0) return;
2424
2441
  be();
2425
2442
  const k = Math.min(
2426
2443
  e.items.length - 1,
2427
- Math.max(0, Math.floor(p))
2428
- ), { align: me = "start", ...W } = z, Ie = se.value.sizes[k];
2429
- let ge = c.value + se.value.offsets[k];
2430
- me === "center" ? ge -= (d.value - Ie) / 2 : me === "end" && (ge -= d.value - Ie);
2431
- const Le = Math.max(
2432
- c.value,
2433
- c.value + ve.value - d.value
2434
- ), He = Math.max(0, Math.min(ge, Le)), Oe = W.behavior ?? "auto";
2435
- Oe === "auto" && (M.value = He), window.scrollTo({
2436
- ...W,
2437
- top: He,
2438
- behavior: Oe
2444
+ Math.max(0, Math.floor(m))
2445
+ ), { align: ee = "start", ...L } = w, xe = oe.value.sizes[k];
2446
+ let we = u.value + oe.value.offsets[k];
2447
+ ee === "center" ? we -= (r.value - xe) / 2 : ee === "end" && (we -= r.value - xe);
2448
+ const $e = Math.max(
2449
+ u.value,
2450
+ u.value + me.value - r.value
2451
+ ), De = Math.max(0, Math.min(we, $e)), Ie = L.behavior ?? "auto";
2452
+ Ie === "auto" && (y.value = De), window.scrollTo({
2453
+ ...L,
2454
+ top: De,
2455
+ behavior: Ie
2439
2456
  });
2440
2457
  }
2441
- function X(p = "auto") {
2442
- typeof window > "u" || (be(), window.scrollTo({ top: Math.max(0, c.value), behavior: p }));
2458
+ function K(m = "auto") {
2459
+ typeof window > "u" || (be(), window.scrollTo({ top: Math.max(0, u.value), behavior: m }));
2443
2460
  }
2444
- return we(
2461
+ return ye(
2445
2462
  () => e.itemKey,
2446
2463
  () => {
2447
- h.clear(), n.value += 1, G = -1;
2464
+ M.clear(), n.value += 1, G = -1;
2448
2465
  }
2449
- ), we(
2450
- () => e.items.map((p, z) => te(p, z)),
2451
- async (p, z) => {
2452
- const k = p.length !== z.length || p.some((W, Ie) => W !== z[Ie]), me = new Set(p);
2453
- for (const W of h.keys())
2454
- me.has(W) || h.delete(W);
2455
- k && (G = -1), n.value += 1, await Z(), K && (be(), T());
2466
+ ), ye(
2467
+ () => e.items.map((m, w) => Y(m, w)),
2468
+ async (m, w) => {
2469
+ const k = m.length !== w.length || m.some((L, xe) => L !== w[xe]), ee = new Set(m);
2470
+ for (const L of M.keys())
2471
+ ee.has(L) || M.delete(L);
2472
+ k && (G = -1), n.value += 1, await Z(), V && (be(), T());
2456
2473
  }
2457
- ), we(
2474
+ ), ye(
2458
2475
  () => [e.hasMore, e.loading],
2459
- async ([p]) => {
2460
- p || (G = -1), await Z(), K && (be(), T());
2476
+ async ([m]) => {
2477
+ m || (G = -1), await Z(), V && (be(), T());
2461
2478
  }
2462
- ), _e(() => {
2463
- if (K = !0, be(), window.addEventListener("scroll", de, { passive: !0 }), window.addEventListener("resize", v, { passive: !0 }), typeof ResizeObserver < "u") {
2464
- A = new ResizeObserver(() => {
2465
- re();
2466
- }), P = new ResizeObserver(Q), y.value && A.observe(y.value);
2467
- for (const [p] of $)
2468
- P.observe(p);
2479
+ ), at(() => {
2480
+ if (V = !0, be(), window.addEventListener("scroll", de, { passive: !0 }), window.addEventListener("resize", v, { passive: !0 }), typeof ResizeObserver < "u") {
2481
+ b = new ResizeObserver(() => {
2482
+ ce();
2483
+ }), A = new ResizeObserver(Q), x.value && b.observe(x.value);
2484
+ for (const [m] of R)
2485
+ A.observe(m);
2469
2486
  }
2470
2487
  Z(() => {
2471
- K && T();
2488
+ V && T();
2472
2489
  });
2473
- }), $t(i), qe(() => {
2474
- K = !1, window.removeEventListener("scroll", de), window.removeEventListener("resize", v), R(E), R(S), E = void 0, S = void 0, B = !1, Y.clear(), A && (A.disconnect(), A = void 0), P && (P.disconnect(), P = void 0), $.clear();
2490
+ }), $t(ge), Xe(() => {
2491
+ V = !1, window.removeEventListener("scroll", de), window.removeEventListener("resize", v), H(C), H($), C = void 0, $ = void 0, B = !1, D.clear(), b && (b.disconnect(), b = void 0), A && (A.disconnect(), A = void 0), R.clear();
2475
2492
  }), s({
2476
- scrollTo: D,
2477
- scrollToIndex: _,
2478
- scrollToTop: X
2479
- }), (p, z) => (j(), U("div", {
2493
+ scrollTo: Ee,
2494
+ scrollToIndex: d,
2495
+ scrollToTop: K
2496
+ }), (m, w) => (j(), U("div", {
2480
2497
  ref_key: "root",
2481
- ref: y,
2482
- class: ot(["vue-window-dynamic-virtual-scroll", { "vue-window-dynamic-virtual-scroll--pulling": f(fe) }]),
2498
+ ref: x,
2499
+ class: st(["vue-window-dynamic-virtual-scroll", { "vue-window-dynamic-virtual-scroll--pulling": f(ae) }]),
2483
2500
  role: "list",
2484
2501
  "aria-label": t.ariaLabel,
2485
- onTouchstartPassive: z[0] || (z[0] = //@ts-ignore
2486
- (...k) => f(pe) && f(pe)(...k)),
2487
- onTouchmove: z[1] || (z[1] = //@ts-ignore
2488
- (...k) => f(xe) && f(xe)(...k)),
2489
- onTouchend: z[2] || (z[2] = //@ts-ignore
2502
+ onTouchstartPassive: w[0] || (w[0] = //@ts-ignore
2503
+ (...k) => f(fe) && f(fe)(...k)),
2504
+ onTouchmove: w[1] || (w[1] = //@ts-ignore
2490
2505
  (...k) => f(he) && f(he)(...k)),
2491
- onTouchcancel: z[3] || (z[3] = //@ts-ignore
2492
- (...k) => f(ae) && f(ae)(...k))
2506
+ onTouchend: w[2] || (w[2] = //@ts-ignore
2507
+ (...k) => f(ve) && f(ve)(...k)),
2508
+ onTouchcancel: w[3] || (w[3] = //@ts-ignore
2509
+ (...k) => f(J) && f(J)(...k))
2493
2510
  }, [
2494
2511
  t.pullToRefresh || t.refreshing ? (j(), U("div", {
2495
2512
  key: 0,
2496
2513
  class: "vue-window-dynamic-virtual-scroll__refresh",
2497
- style: ue({
2498
- height: `${f(le)}px`,
2499
- transform: `translateY(${f(oe) - f(le)}px)`
2514
+ style: re({
2515
+ height: `${f(ue)}px`,
2516
+ transform: `translateY(${f(le) - f(ue)}px)`
2500
2517
  }),
2501
2518
  role: "status",
2502
2519
  "aria-live": "polite"
2503
2520
  }, [
2504
- Se(p.$slots, "refresh", {
2521
+ Se(m.$slots, "refresh", {
2505
2522
  pullDistance: f(ne),
2506
2523
  progress: f(ie),
2507
2524
  refreshing: t.refreshing
2508
2525
  }, () => [
2509
- Ue(vt(f(H)), 1)
2526
+ Ge(ht(f(te)), 1)
2510
2527
  ])
2511
- ], 4)) : Ve("", !0),
2528
+ ], 4)) : Re("", !0),
2512
2529
  t.items.length || t.loading ? (j(), U("div", {
2513
2530
  key: 1,
2514
2531
  class: "vue-window-dynamic-virtual-scroll__spacer",
2515
- style: ue({
2516
- height: `${ve.value}px`,
2517
- transform: `translateY(${f(oe)}px)`
2532
+ style: re({
2533
+ height: `${me.value}px`,
2534
+ transform: `translateY(${f(le)}px)`
2518
2535
  })
2519
2536
  }, [
2520
- (j(!0), U(Je, null, et($e.value, ({ item: k, index: me, key: W, top: Ie }) => (j(), U("div", {
2521
- key: W,
2537
+ (j(!0), U(et, null, nt(ze.value, ({ item: k, index: ee, key: L, top: xe }) => (j(), U("div", {
2538
+ key: L,
2522
2539
  ref_for: !0,
2523
- ref: (ge) => ze(ge, W),
2540
+ ref: (we) => ke(we, L),
2524
2541
  class: "vue-window-dynamic-virtual-scroll__item",
2525
- style: ue({ transform: `translateY(${Ie}px)` }),
2542
+ style: re({ transform: `translateY(${xe}px)` }),
2526
2543
  role: "listitem",
2527
- "aria-posinset": me + 1,
2544
+ "aria-posinset": ee + 1,
2528
2545
  "aria-setsize": t.items.length
2529
2546
  }, [
2530
- Se(p.$slots, "default", {
2547
+ Se(m.$slots, "default", {
2531
2548
  item: k,
2532
- index: me
2549
+ index: ee
2533
2550
  })
2534
2551
  ], 12, ba))), 128)),
2535
2552
  t.loading ? (j(), U("div", {
2536
2553
  key: 0,
2537
2554
  class: "vue-window-dynamic-virtual-scroll__loading",
2538
- style: ue({
2539
- height: `${b.value}px`,
2540
- transform: `translateY(${se.value.total}px)`
2555
+ style: re({
2556
+ height: `${S.value}px`,
2557
+ transform: `translateY(${oe.value.total}px)`
2541
2558
  }),
2542
2559
  role: "status",
2543
2560
  "aria-live": "polite"
2544
2561
  }, [
2545
- Se(p.$slots, "loading", {}, () => [
2546
- z[4] || (z[4] = Ue("Loading more…", -1))
2562
+ Se(m.$slots, "loading", {}, () => [
2563
+ w[4] || (w[4] = Ge("Loading more…", -1))
2547
2564
  ])
2548
- ], 4)) : Ve("", !0)
2565
+ ], 4)) : Re("", !0)
2549
2566
  ], 4)) : (j(), U("div", {
2550
2567
  key: 2,
2551
2568
  class: "vue-window-dynamic-virtual-scroll__empty",
2552
- style: ue({ transform: `translateY(${f(oe)}px)` })
2569
+ style: re({ transform: `translateY(${f(le)}px)` })
2553
2570
  }, [
2554
- Se(p.$slots, "empty")
2571
+ Se(m.$slots, "empty")
2555
2572
  ], 4))
2556
2573
  ], 42, Ta));
2557
2574
  }
2558
- }), Ia = ["aria-label"], za = ["aria-posinset", "aria-setsize"], ka = /* @__PURE__ */ Qe({
2575
+ }), Ia = ["aria-label"], za = ["aria-posinset", "aria-setsize"], ka = /* @__PURE__ */ tt({
2559
2576
  name: "WindowGirdVirtualScroll",
2560
2577
  __name: "WindowGirdVirtualScroll",
2561
2578
  props: {
@@ -2576,132 +2593,132 @@ const ha = ["dir", "aria-label"], ga = ["data-carousel-index", "aria-label", "ar
2576
2593
  },
2577
2594
  emits: ["scroll", "loadMore", "refresh"],
2578
2595
  setup(t, { expose: s, emit: I }) {
2579
- const e = t, x = I, y = ee(), M = ee(0), d = ee(0), c = ee(0);
2580
- let n, h = -1;
2581
- const { getItemKey: $ } = tt({
2596
+ const e = t, z = I, x = X(), y = X(0), r = X(0), u = X(0);
2597
+ let n, M = -1;
2598
+ const { getItemKey: R } = lt({
2582
2599
  componentName: "WindowGirdVirtualScroll",
2583
2600
  items: () => e.items,
2584
2601
  itemKey: () => e.itemKey
2585
2602
  }), {
2586
- pulling: Y,
2587
- pullDistance: A,
2588
- pullOffset: P,
2589
- pullProgress: E,
2590
- refreshMessage: S,
2603
+ pulling: D,
2604
+ pullDistance: b,
2605
+ pullOffset: A,
2606
+ pullProgress: C,
2607
+ refreshMessage: $,
2591
2608
  refreshThreshold: B,
2592
- handleTouchStart: K,
2609
+ handleTouchStart: V,
2593
2610
  handleTouchMove: G,
2594
- handleTouchEnd: te,
2595
- handleTouchCancel: ce
2611
+ handleTouchEnd: Y,
2612
+ handleTouchCancel: se
2596
2613
  } = xt({
2597
2614
  enabled: () => e.pullToRefresh,
2598
2615
  refreshing: () => e.refreshing,
2599
2616
  threshold: () => e.pullRefreshThreshold,
2600
- onRefresh: () => x("refresh"),
2617
+ onRefresh: () => z("refresh"),
2601
2618
  scrollTop: () => typeof window > "u" ? 0 : Math.max(0, window.scrollY)
2602
- }), R = m(() => Math.max(1, e.itemSize)), fe = m(
2619
+ }), H = h(() => Math.max(1, e.itemSize)), ae = h(
2603
2620
  () => Math.max(1, Math.floor(e.columns))
2604
- ), ne = m(() => Math.max(0, e.gap)), oe = m(() => Math.max(0, Math.floor(e.overscan))), ie = m(
2605
- () => Math.max(1, e.loadingItemSize ?? R.value)
2606
- ), H = m(
2607
- () => R.value + ne.value
2608
- ), le = m(
2609
- () => Math.ceil(e.items.length / fe.value)
2610
- ), pe = m(() => le.value === 0 ? 0 : le.value * R.value + (le.value - 1) * ne.value), xe = m(
2611
- () => pe.value + (e.items.length ? ne.value : 0)
2612
- ), he = m(
2613
- () => pe.value + (e.loading ? ie.value + (e.items.length ? ne.value : 0) : 0)
2614
- ), ae = m(
2615
- () => Math.max(0, M.value - c.value)
2616
- ), F = m(
2621
+ ), ne = h(() => Math.max(0, e.gap)), le = h(() => Math.max(0, Math.floor(e.overscan))), ie = h(
2622
+ () => Math.max(1, e.loadingItemSize ?? H.value)
2623
+ ), te = h(
2624
+ () => H.value + ne.value
2625
+ ), ue = h(
2626
+ () => Math.ceil(e.items.length / ae.value)
2627
+ ), fe = h(() => ue.value === 0 ? 0 : ue.value * H.value + (ue.value - 1) * ne.value), he = h(
2628
+ () => fe.value + (e.items.length ? ne.value : 0)
2629
+ ), ve = h(
2630
+ () => fe.value + (e.loading ? ie.value + (e.items.length ? ne.value : 0) : 0)
2631
+ ), J = h(
2632
+ () => Math.max(0, y.value - u.value)
2633
+ ), O = h(
2617
2634
  () => Math.max(
2618
2635
  0,
2619
- Math.floor(ae.value / H.value) - oe.value
2636
+ Math.floor(J.value / te.value) - le.value
2620
2637
  )
2621
- ), b = m(() => {
2622
- if (le.value === 0) return 0;
2623
- const re = Math.max(
2624
- R.value,
2625
- M.value + d.value - c.value
2638
+ ), S = h(() => {
2639
+ if (ue.value === 0) return 0;
2640
+ const ce = Math.max(
2641
+ H.value,
2642
+ y.value + r.value - u.value
2626
2643
  ), de = Math.ceil(
2627
- (re + ne.value) / H.value
2644
+ (ce + ne.value) / te.value
2628
2645
  );
2629
2646
  return Math.min(
2630
- le.value,
2631
- de + oe.value
2647
+ ue.value,
2648
+ de + le.value
2632
2649
  );
2633
- }), C = m(
2634
- () => Math.min(e.items.length, F.value * fe.value)
2635
- ), se = m(
2636
- () => Math.min(e.items.length, b.value * fe.value)
2637
- ), ve = m(
2638
- () => e.items.slice(C.value, se.value).map((re, de) => {
2639
- const v = C.value + de;
2650
+ }), P = h(
2651
+ () => Math.min(e.items.length, O.value * ae.value)
2652
+ ), oe = h(
2653
+ () => Math.min(e.items.length, S.value * ae.value)
2654
+ ), me = h(
2655
+ () => e.items.slice(P.value, oe.value).map((ce, de) => {
2656
+ const v = P.value + de;
2640
2657
  return {
2641
- item: re,
2658
+ item: ce,
2642
2659
  index: v,
2643
- key: $(re, v),
2644
- rowIndex: Math.floor(v / fe.value),
2645
- columnIndex: v % fe.value
2660
+ key: R(ce, v),
2661
+ rowIndex: Math.floor(v / ae.value),
2662
+ columnIndex: v % ae.value
2646
2663
  };
2647
2664
  })
2648
- ), ke = m(() => ({
2649
- gridTemplateColumns: `repeat(${fe.value}, minmax(0, 1fr))`,
2665
+ ), Ae = h(() => ({
2666
+ gridTemplateColumns: `repeat(${ae.value}, minmax(0, 1fr))`,
2650
2667
  columnGap: `${ne.value}px`,
2651
2668
  rowGap: `${ne.value}px`,
2652
- transform: `translateY(${F.value * H.value}px)`
2669
+ transform: `translateY(${O.value * te.value}px)`
2653
2670
  }));
2654
- function L() {
2655
- typeof window > "u" || (M.value = Math.max(0, window.scrollY), d.value = window.innerHeight, y.value && (c.value = y.value.getBoundingClientRect().top + M.value));
2671
+ function E() {
2672
+ typeof window > "u" || (y.value = Math.max(0, window.scrollY), r.value = window.innerHeight, x.value && (u.value = x.value.getBoundingClientRect().top + y.value));
2656
2673
  }
2657
- function N() {
2658
- x("scroll", {
2659
- scrollTop: ae.value,
2660
- startIndex: C.value,
2661
- endIndex: se.value
2674
+ function F() {
2675
+ z("scroll", {
2676
+ scrollTop: J.value,
2677
+ startIndex: P.value,
2678
+ endIndex: oe.value
2662
2679
  });
2663
2680
  }
2664
- function J() {
2665
- L(), N(), Me();
2681
+ function _() {
2682
+ E(), F(), pe();
2666
2683
  }
2667
- function Me() {
2668
- if (typeof window > "u" || !e.hasMore || e.loading || h === e.items.length)
2684
+ function pe() {
2685
+ if (typeof window > "u" || !e.hasMore || e.loading || M === e.items.length)
2669
2686
  return;
2670
- const re = Math.max(0, e.loadMoreThreshold), de = c.value + he.value, v = M.value + d.value;
2671
- de - v <= re && (h = e.items.length, x("loadMore"));
2687
+ const ce = Math.max(0, e.loadMoreThreshold), de = u.value + ve.value, v = y.value + r.value;
2688
+ de - v <= ce && (M = e.items.length, z("loadMore"));
2672
2689
  }
2673
- function $e(re, de = {}) {
2690
+ function ze(ce, de = {}) {
2674
2691
  if (typeof window > "u") return;
2675
- L();
2676
- const v = Math.max(0, he.value - d.value), T = Math.min(
2677
- Math.max(0, Number.isFinite(re) ? re : 0),
2692
+ E();
2693
+ const v = Math.max(0, ve.value - r.value), T = Math.min(
2694
+ Math.max(0, Number.isFinite(ce) ? ce : 0),
2678
2695
  v
2679
- ), r = Math.max(0, c.value + T), q = de.behavior ?? "auto";
2680
- q === "auto" && (M.value = r), window.scrollTo({ ...de, top: r, behavior: q });
2696
+ ), i = Math.max(0, u.value + T), q = de.behavior ?? "auto";
2697
+ q === "auto" && (y.value = i), window.scrollTo({ ...de, top: i, behavior: q });
2681
2698
  }
2682
- function be(re, de = {}) {
2699
+ function be(ce, de = {}) {
2683
2700
  if (typeof window > "u" || e.items.length === 0) return;
2684
- L();
2701
+ E();
2685
2702
  const v = Math.min(
2686
2703
  e.items.length - 1,
2687
- Math.max(0, Math.floor(re))
2688
- ), T = Math.floor(v / fe.value), { align: r = "start", ...q } = de;
2689
- let Q = c.value + T * H.value;
2690
- r === "center" ? Q -= (d.value - R.value) / 2 : r === "end" && (Q -= d.value - R.value);
2691
- const ze = Math.max(
2692
- c.value,
2693
- c.value + he.value - d.value
2694
- ), i = Math.max(0, Math.min(Q, ze)), D = q.behavior ?? "auto";
2695
- D === "auto" && (M.value = i), window.scrollTo({
2704
+ Math.max(0, Math.floor(ce))
2705
+ ), T = Math.floor(v / ae.value), { align: i = "start", ...q } = de;
2706
+ let Q = u.value + T * te.value;
2707
+ i === "center" ? Q -= (r.value - H.value) / 2 : i === "end" && (Q -= r.value - H.value);
2708
+ const ke = Math.max(
2709
+ u.value,
2710
+ u.value + ve.value - r.value
2711
+ ), ge = Math.max(0, Math.min(Q, ke)), Ee = q.behavior ?? "auto";
2712
+ Ee === "auto" && (y.value = ge), window.scrollTo({
2696
2713
  ...q,
2697
- top: i,
2698
- behavior: D
2714
+ top: ge,
2715
+ behavior: Ee
2699
2716
  });
2700
2717
  }
2701
- function ye(re = "auto") {
2702
- typeof window > "u" || (L(), window.scrollTo({ top: Math.max(0, c.value), behavior: re }));
2718
+ function Me(ce = "auto") {
2719
+ typeof window > "u" || (E(), window.scrollTo({ top: Math.max(0, u.value), behavior: ce }));
2703
2720
  }
2704
- return we(
2721
+ return ye(
2705
2722
  () => [
2706
2723
  e.items.length,
2707
2724
  e.itemSize,
@@ -2709,77 +2726,77 @@ const ha = ["dir", "aria-label"], ga = ["data-carousel-index", "aria-label", "ar
2709
2726
  e.gap
2710
2727
  ],
2711
2728
  async () => {
2712
- await Z(), L(), Me();
2729
+ await Z(), E(), pe();
2713
2730
  }
2714
- ), we(
2731
+ ), ye(
2715
2732
  () => [e.hasMore, e.loading],
2716
- async ([re]) => {
2717
- re || (h = -1), await Z(), L(), Me();
2733
+ async ([ce]) => {
2734
+ ce || (M = -1), await Z(), E(), pe();
2718
2735
  }
2719
- ), _e(() => {
2720
- L(), window.addEventListener("scroll", J, { passive: !0 }), window.addEventListener("resize", J, { passive: !0 }), typeof ResizeObserver < "u" && (n = new ResizeObserver(() => {
2721
- L(), Me();
2722
- }), y.value && n.observe(y.value)), Z(Me);
2723
- }), qe(() => {
2724
- window.removeEventListener("scroll", J), window.removeEventListener("resize", J), n && (n.disconnect(), n = void 0);
2736
+ ), at(() => {
2737
+ E(), window.addEventListener("scroll", _, { passive: !0 }), window.addEventListener("resize", _, { passive: !0 }), typeof ResizeObserver < "u" && (n = new ResizeObserver(() => {
2738
+ E(), pe();
2739
+ }), x.value && n.observe(x.value)), Z(pe);
2740
+ }), Xe(() => {
2741
+ window.removeEventListener("scroll", _), window.removeEventListener("resize", _), n && (n.disconnect(), n = void 0);
2725
2742
  }), s({
2726
- scrollTo: $e,
2743
+ scrollTo: ze,
2727
2744
  scrollToIndex: be,
2728
- scrollToTop: ye
2729
- }), (re, de) => (j(), U("div", {
2745
+ scrollToTop: Me
2746
+ }), (ce, de) => (j(), U("div", {
2730
2747
  ref_key: "root",
2731
- ref: y,
2732
- class: ot(["vue-window-gird-virtual-scroll", { "vue-window-gird-virtual-scroll--pulling": f(Y) }]),
2748
+ ref: x,
2749
+ class: st(["vue-window-gird-virtual-scroll", { "vue-window-gird-virtual-scroll--pulling": f(D) }]),
2733
2750
  role: "list",
2734
2751
  "aria-label": t.ariaLabel,
2735
2752
  onTouchstartPassive: de[0] || (de[0] = //@ts-ignore
2736
- (...v) => f(K) && f(K)(...v)),
2753
+ (...v) => f(V) && f(V)(...v)),
2737
2754
  onTouchmove: de[1] || (de[1] = //@ts-ignore
2738
2755
  (...v) => f(G) && f(G)(...v)),
2739
2756
  onTouchend: de[2] || (de[2] = //@ts-ignore
2740
- (...v) => f(te) && f(te)(...v)),
2757
+ (...v) => f(Y) && f(Y)(...v)),
2741
2758
  onTouchcancel: de[3] || (de[3] = //@ts-ignore
2742
- (...v) => f(ce) && f(ce)(...v))
2759
+ (...v) => f(se) && f(se)(...v))
2743
2760
  }, [
2744
2761
  t.pullToRefresh || t.refreshing ? (j(), U("div", {
2745
2762
  key: 0,
2746
2763
  class: "vue-window-gird-virtual-scroll__refresh",
2747
- style: ue({
2764
+ style: re({
2748
2765
  height: `${f(B)}px`,
2749
- transform: `translateY(${f(P) - f(B)}px)`
2766
+ transform: `translateY(${f(A) - f(B)}px)`
2750
2767
  }),
2751
2768
  role: "status",
2752
2769
  "aria-live": "polite"
2753
2770
  }, [
2754
- Se(re.$slots, "refresh", {
2755
- pullDistance: f(A),
2756
- progress: f(E),
2771
+ Se(ce.$slots, "refresh", {
2772
+ pullDistance: f(b),
2773
+ progress: f(C),
2757
2774
  refreshing: t.refreshing
2758
2775
  }, () => [
2759
- Ue(vt(f(S)), 1)
2776
+ Ge(ht(f($)), 1)
2760
2777
  ])
2761
- ], 4)) : Ve("", !0),
2778
+ ], 4)) : Re("", !0),
2762
2779
  t.items.length || t.loading ? (j(), U("div", {
2763
2780
  key: 1,
2764
2781
  class: "vue-window-gird-virtual-scroll__spacer",
2765
- style: ue({
2766
- height: `${he.value}px`,
2767
- transform: `translateY(${f(P)}px)`
2782
+ style: re({
2783
+ height: `${ve.value}px`,
2784
+ transform: `translateY(${f(A)}px)`
2768
2785
  })
2769
2786
  }, [
2770
- lt("div", {
2787
+ rt("div", {
2771
2788
  class: "vue-window-gird-virtual-scroll__content",
2772
- style: ue(ke.value)
2789
+ style: re(Ae.value)
2773
2790
  }, [
2774
- (j(!0), U(Je, null, et(ve.value, ({ item: v, index: T, key: r, rowIndex: q, columnIndex: Q }) => (j(), U("div", {
2775
- key: r,
2791
+ (j(!0), U(et, null, nt(me.value, ({ item: v, index: T, key: i, rowIndex: q, columnIndex: Q }) => (j(), U("div", {
2792
+ key: i,
2776
2793
  class: "vue-window-gird-virtual-scroll__item",
2777
- style: ue({ height: `${R.value}px` }),
2794
+ style: re({ height: `${H.value}px` }),
2778
2795
  role: "listitem",
2779
2796
  "aria-posinset": T + 1,
2780
2797
  "aria-setsize": t.items.length
2781
2798
  }, [
2782
- Se(re.$slots, "default", {
2799
+ Se(ce.$slots, "default", {
2783
2800
  item: v,
2784
2801
  index: T,
2785
2802
  rowIndex: q,
@@ -2790,29 +2807,29 @@ const ha = ["dir", "aria-label"], ga = ["data-carousel-index", "aria-label", "ar
2790
2807
  t.loading ? (j(), U("div", {
2791
2808
  key: 0,
2792
2809
  class: "vue-window-gird-virtual-scroll__loading",
2793
- style: ue({
2810
+ style: re({
2794
2811
  height: `${ie.value}px`,
2795
- transform: `translateY(${xe.value}px)`
2812
+ transform: `translateY(${he.value}px)`
2796
2813
  }),
2797
2814
  role: "status",
2798
2815
  "aria-live": "polite"
2799
2816
  }, [
2800
- Se(re.$slots, "loading", {}, () => [
2801
- de[4] || (de[4] = Ue("Loading more…", -1))
2817
+ Se(ce.$slots, "loading", {}, () => [
2818
+ de[4] || (de[4] = Ge("Loading more…", -1))
2802
2819
  ])
2803
- ], 4)) : Ve("", !0)
2820
+ ], 4)) : Re("", !0)
2804
2821
  ], 4)) : (j(), U("div", {
2805
2822
  key: 2,
2806
2823
  class: "vue-window-gird-virtual-scroll__empty",
2807
- style: ue({ transform: `translateY(${f(P)}px)` })
2824
+ style: re({ transform: `translateY(${f(A)}px)` })
2808
2825
  }, [
2809
- Se(re.$slots, "empty")
2826
+ Se(ce.$slots, "empty")
2810
2827
  ], 4))
2811
2828
  ], 42, Ia));
2812
2829
  }
2813
- }), $a = Bt, La = {
2830
+ }), $a = Dt, La = {
2814
2831
  install(t) {
2815
- t.component("ChatVirtualScroll", Zt), t.component("DynamicVirtualScroll", Bt), t.component("ShortMediaFeed", la), t.component("SkeletonLoader", sa), t.component("VirtualCarousel", ya), t.component("VirtualList", $a), t.component("VirtualScroll", Ma), t.component(
2832
+ t.component("ChatVirtualScroll", Zt), t.component("DynamicVirtualScroll", Dt), t.component("ShortMediaFeed", la), t.component("SkeletonLoader", sa), t.component("VirtualCarousel", ya), t.component("VirtualList", $a), t.component("VirtualScroll", xa), t.component(
2816
2833
  "WindowDynamicVirtualScroll",
2817
2834
  Sa
2818
2835
  ), t.component(
@@ -2823,12 +2840,12 @@ const ha = ["dir", "aria-label"], ga = ["data-carousel-index", "aria-label", "ar
2823
2840
  };
2824
2841
  export {
2825
2842
  Zt as ChatVirtualScroll,
2826
- Bt as DynamicVirtualScroll,
2843
+ Dt as DynamicVirtualScroll,
2827
2844
  la as ShortMediaFeed,
2828
2845
  sa as SkeletonLoader,
2829
2846
  ya as VirtualCarousel,
2830
2847
  $a as VirtualList,
2831
- Ma as VirtualScroll,
2848
+ xa as VirtualScroll,
2832
2849
  La as VueVirtualScroll,
2833
2850
  Sa as WindowDynamicVirtualScroll,
2834
2851
  ka as WindowGirdVirtualScroll,