vue-virtual-flow 0.0.2 → 0.0.3

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