@opentiny/tiny-robot 0.2.5 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index2.js CHANGED
@@ -1,60 +1,60 @@
1
- import { onMounted as te, nextTick as re, watch as _, getCurrentScope as se, onScopeDispose as ue, isRef as ce, getCurrentInstance as B, toValue as g, hasInjectionContext as ne, inject as ae, shallowRef as S, computed as I, reactive as J, unref as de, watchEffect as fe } from "vue";
1
+ import { onMounted as te, nextTick as ue, watch as _, getCurrentScope as ce, onScopeDispose as ae, isRef as de, getCurrentInstance as B, toValue as g, hasInjectionContext as ne, inject as fe, shallowRef as S, computed as I, reactive as J, unref as ve, watchEffect as he } from "vue";
2
2
  function N(e) {
3
- return se() ? (ue(e), !0) : !1;
3
+ return ce() ? (ae(e), !0) : !1;
4
4
  }
5
- const H = /* @__PURE__ */ new WeakMap(), ve = (...e) => {
5
+ const H = /* @__PURE__ */ new WeakMap(), me = (...e) => {
6
6
  var t;
7
7
  const o = e[0], n = (t = B()) == null ? void 0 : t.proxy;
8
8
  if (n == null && !ne())
9
9
  throw new Error("injectLocal must be called in setup");
10
- return n && H.has(n) && o in H.get(n) ? H.get(n)[o] : ae(...e);
10
+ return n && H.has(n) && o in H.get(n) ? H.get(n)[o] : fe(...e);
11
11
  }, oe = typeof window < "u" && typeof document < "u";
12
12
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
13
- const he = (e) => e != null, me = Object.prototype.toString, pe = (e) => me.call(e) === "[object Object]", x = () => {
14
- }, we = /* @__PURE__ */ be();
15
- function be() {
13
+ const pe = (e) => e != null, we = Object.prototype.toString, be = (e) => we.call(e) === "[object Object]", x = () => {
14
+ }, ge = /* @__PURE__ */ Se();
15
+ function Se() {
16
16
  var e, t;
17
17
  return oe && ((e = window == null ? void 0 : window.navigator) == null ? void 0 : e.userAgent) && (/iP(?:ad|hone|od)/.test(window.navigator.userAgent) || ((t = window == null ? void 0 : window.navigator) == null ? void 0 : t.maxTouchPoints) > 2 && /iPad|Macintosh/.test(window == null ? void 0 : window.navigator.userAgent));
18
18
  }
19
19
  function $(e, t) {
20
20
  function o(...n) {
21
- return new Promise((v, c) => {
22
- Promise.resolve(e(() => t.apply(this, n), { fn: t, thisArg: this, args: n })).then(v).catch(c);
21
+ return new Promise((d, c) => {
22
+ Promise.resolve(e(() => t.apply(this, n), { fn: t, thisArg: this, args: n })).then(d).catch(c);
23
23
  });
24
24
  }
25
25
  return o;
26
26
  }
27
- const ge = (e) => e();
27
+ const ye = (e) => e();
28
28
  function ie(e, t = {}) {
29
- let o, n, v = x;
30
- const c = (l) => {
31
- clearTimeout(l), v(), v = x;
29
+ let o, n, d = x;
30
+ const c = (r) => {
31
+ clearTimeout(r), d(), d = x;
32
32
  };
33
- let d;
34
- return (l) => {
33
+ let a;
34
+ return (r) => {
35
35
  const s = g(e), h = g(t.maxWait);
36
- return o && c(o), s <= 0 || h !== void 0 && h <= 0 ? (n && (c(n), n = null), Promise.resolve(l())) : new Promise((r, a) => {
37
- v = t.rejectOnCancel ? a : r, d = l, h && !n && (n = setTimeout(() => {
38
- o && c(o), n = null, r(d());
36
+ return o && c(o), s <= 0 || h !== void 0 && h <= 0 ? (n && (c(n), n = null), Promise.resolve(r())) : new Promise((l, f) => {
37
+ d = t.rejectOnCancel ? f : l, a = r, h && !n && (n = setTimeout(() => {
38
+ o && c(o), n = null, l(a());
39
39
  }, h)), o = setTimeout(() => {
40
- n && c(n), n = null, r(l());
40
+ n && c(n), n = null, l(r());
41
41
  }, s);
42
42
  });
43
43
  };
44
44
  }
45
- function Se(...e) {
46
- let t = 0, o, n = !0, v = x, c, d, i, l, s;
47
- !ce(e[0]) && typeof e[0] == "object" ? { delay: d, trailing: i = !0, leading: l = !0, rejectOnCancel: s = !1 } = e[0] : [d, i = !0, l = !0, s = !1] = e;
45
+ function re(...e) {
46
+ let t = 0, o, n = !0, d = x, c, a, i, r, s;
47
+ !de(e[0]) && typeof e[0] == "object" ? { delay: a, trailing: i = !0, leading: r = !0, rejectOnCancel: s = !1 } = e[0] : [a, i = !0, r = !0, s = !1] = e;
48
48
  const h = () => {
49
- o && (clearTimeout(o), o = void 0, v(), v = x);
49
+ o && (clearTimeout(o), o = void 0, d(), d = x);
50
50
  };
51
- return (a) => {
52
- const m = g(d), b = Date.now() - t, y = () => c = a();
53
- return h(), m <= 0 ? (t = Date.now(), y()) : (b > m && (l || !n) ? (t = Date.now(), y()) : i && (c = new Promise((u, f) => {
54
- v = s ? f : u, o = setTimeout(() => {
51
+ return (f) => {
52
+ const m = g(a), b = Date.now() - t, y = () => c = f();
53
+ return h(), m <= 0 ? (t = Date.now(), y()) : (b > m && (r || !n) ? (t = Date.now(), y()) : i && (c = new Promise((u, v) => {
54
+ d = s ? v : u, o = setTimeout(() => {
55
55
  t = Date.now(), n = !0, u(y()), h();
56
56
  }, Math.max(0, m - b));
57
- })), !l && !o && (o = setTimeout(() => n = !0, m)), n = !1, c);
57
+ })), !r && !o && (o = setTimeout(() => n = !0, m)), n = !1, c);
58
58
  };
59
59
  }
60
60
  function K(e) {
@@ -63,25 +63,25 @@ function K(e) {
63
63
  function k(e) {
64
64
  return Array.isArray(e) ? e : [e];
65
65
  }
66
- function ye(e) {
66
+ function Ee(e) {
67
67
  return B();
68
68
  }
69
- function Ee(e, t = 200, o = {}) {
69
+ function Te(e, t = 200, o = {}) {
70
70
  return $(
71
71
  ie(t, o),
72
72
  e
73
73
  );
74
74
  }
75
- function Te(e, t = 200, o = !1, n = !0, v = !1) {
75
+ function xe(e, t = 200, o = !1, n = !0, d = !1) {
76
76
  return $(
77
- Se(t, o, n, v),
77
+ re(t, o, n, d),
78
78
  e
79
79
  );
80
80
  }
81
- function xe(e, t, o = {}) {
81
+ function le(e, t, o = {}) {
82
82
  const {
83
- eventFilter: n = ge,
84
- ...v
83
+ eventFilter: n = ye,
84
+ ...d
85
85
  } = o;
86
86
  return _(
87
87
  e,
@@ -89,28 +89,28 @@ function xe(e, t, o = {}) {
89
89
  n,
90
90
  t
91
91
  ),
92
- v
92
+ d
93
93
  );
94
94
  }
95
95
  function V(e, t = !0, o) {
96
- ye() ? te(e, o) : t ? e() : re(e);
96
+ Ee() ? te(e, o) : t ? e() : ue(e);
97
97
  }
98
98
  function _e(e, t, o = {}) {
99
99
  const {
100
100
  debounce: n = 0,
101
- maxWait: v = void 0,
101
+ maxWait: d = void 0,
102
102
  ...c
103
103
  } = o;
104
- return xe(
104
+ return le(
105
105
  e,
106
106
  t,
107
107
  {
108
108
  ...c,
109
- eventFilter: ie(n, { maxWait: v })
109
+ eventFilter: ie(n, { maxWait: d })
110
110
  }
111
111
  );
112
112
  }
113
- function We(e, t, o) {
113
+ function Oe(e, t, o) {
114
114
  return _(
115
115
  e,
116
116
  t,
@@ -120,79 +120,95 @@ function We(e, t, o) {
120
120
  }
121
121
  );
122
122
  }
123
+ function Fe(e, t, o = {}) {
124
+ const {
125
+ throttle: n = 0,
126
+ trailing: d = !0,
127
+ leading: c = !0,
128
+ ...a
129
+ } = o;
130
+ return le(
131
+ e,
132
+ t,
133
+ {
134
+ ...a,
135
+ eventFilter: re(n, d, c)
136
+ }
137
+ );
138
+ }
123
139
  const R = oe ? window : void 0;
124
140
  function E(e) {
125
141
  var t;
126
142
  const o = g(e);
127
143
  return (t = o == null ? void 0 : o.$el) != null ? t : o;
128
144
  }
129
- function M(...e) {
145
+ function W(...e) {
130
146
  const t = [], o = () => {
131
147
  t.forEach((i) => i()), t.length = 0;
132
- }, n = (i, l, s, h) => (i.addEventListener(l, s, h), () => i.removeEventListener(l, s, h)), v = I(() => {
133
- const i = k(g(e[0])).filter((l) => l != null);
134
- return i.every((l) => typeof l != "string") ? i : void 0;
135
- }), c = We(
148
+ }, n = (i, r, s, h) => (i.addEventListener(r, s, h), () => i.removeEventListener(r, s, h)), d = I(() => {
149
+ const i = k(g(e[0])).filter((r) => r != null);
150
+ return i.every((r) => typeof r != "string") ? i : void 0;
151
+ }), c = Oe(
136
152
  () => {
137
- var i, l;
153
+ var i, r;
138
154
  return [
139
- (l = (i = v.value) == null ? void 0 : i.map((s) => E(s))) != null ? l : [R].filter((s) => s != null),
140
- k(g(v.value ? e[1] : e[0])),
141
- k(de(v.value ? e[2] : e[1])),
155
+ (r = (i = d.value) == null ? void 0 : i.map((s) => E(s))) != null ? r : [R].filter((s) => s != null),
156
+ k(g(d.value ? e[1] : e[0])),
157
+ k(ve(d.value ? e[2] : e[1])),
142
158
  // @ts-expect-error - TypeScript gets the correct types, but somehow still complains
143
- g(v.value ? e[3] : e[2])
159
+ g(d.value ? e[3] : e[2])
144
160
  ];
145
161
  },
146
- ([i, l, s, h]) => {
147
- if (o(), !(i != null && i.length) || !(l != null && l.length) || !(s != null && s.length))
162
+ ([i, r, s, h]) => {
163
+ if (o(), !(i != null && i.length) || !(r != null && r.length) || !(s != null && s.length))
148
164
  return;
149
- const r = pe(h) ? { ...h } : h;
165
+ const l = be(h) ? { ...h } : h;
150
166
  t.push(
151
167
  ...i.flatMap(
152
- (a) => l.flatMap(
153
- (m) => s.map((b) => n(a, m, b, r))
168
+ (f) => r.flatMap(
169
+ (m) => s.map((b) => n(f, m, b, l))
154
170
  )
155
171
  )
156
172
  );
157
173
  },
158
174
  { flush: "post" }
159
- ), d = () => {
175
+ ), a = () => {
160
176
  c(), o();
161
177
  };
162
- return N(o), d;
178
+ return N(o), a;
163
179
  }
164
180
  let Z = !1;
165
- function Fe(e, t, o = {}) {
166
- const { window: n = R, ignore: v = [], capture: c = !0, detectIframe: d = !1, controls: i = !1 } = o;
181
+ function Le(e, t, o = {}) {
182
+ const { window: n = R, ignore: d = [], capture: c = !0, detectIframe: a = !1, controls: i = !1 } = o;
167
183
  if (!n)
168
184
  return i ? { stop: x, cancel: x, trigger: x } : x;
169
- if (we && !Z) {
185
+ if (ge && !Z) {
170
186
  Z = !0;
171
187
  const u = { passive: !0 };
172
- Array.from(n.document.body.children).forEach((f) => f.addEventListener("click", x, u)), n.document.documentElement.addEventListener("click", x, u);
188
+ Array.from(n.document.body.children).forEach((v) => v.addEventListener("click", x, u)), n.document.documentElement.addEventListener("click", x, u);
173
189
  }
174
- let l = !0;
175
- const s = (u) => g(v).some((f) => {
176
- if (typeof f == "string")
177
- return Array.from(n.document.querySelectorAll(f)).some((p) => p === u.target || u.composedPath().includes(p));
190
+ let r = !0;
191
+ const s = (u) => g(d).some((v) => {
192
+ if (typeof v == "string")
193
+ return Array.from(n.document.querySelectorAll(v)).some((p) => p === u.target || u.composedPath().includes(p));
178
194
  {
179
- const p = E(f);
195
+ const p = E(v);
180
196
  return p && (u.target === p || u.composedPath().includes(p));
181
197
  }
182
198
  });
183
199
  function h(u) {
184
- const f = g(u);
185
- return f && f.$.subTree.shapeFlag === 16;
200
+ const v = g(u);
201
+ return v && v.$.subTree.shapeFlag === 16;
186
202
  }
187
- function r(u, f) {
203
+ function l(u, v) {
188
204
  const p = g(u), F = p.$.subTree && p.$.subTree.children;
189
- return F == null || !Array.isArray(F) ? !1 : F.some((D) => D.el === f.target || f.composedPath().includes(D.el));
205
+ return F == null || !Array.isArray(F) ? !1 : F.some((D) => D.el === v.target || v.composedPath().includes(D.el));
190
206
  }
191
- const a = (u) => {
192
- const f = E(e);
193
- if (u.target != null && !(!(f instanceof Element) && h(e) && r(e, u)) && !(!f || f === u.target || u.composedPath().includes(f))) {
194
- if ("detail" in u && u.detail === 0 && (l = !s(u)), !l) {
195
- l = !0;
207
+ const f = (u) => {
208
+ const v = E(e);
209
+ if (u.target != null && !(!(v instanceof Element) && h(e) && l(e, u)) && !(!v || v === u.target || u.composedPath().includes(v))) {
210
+ if ("detail" in u && u.detail === 0 && (r = !s(u)), !r) {
211
+ r = !0;
196
212
  return;
197
213
  }
198
214
  t(u);
@@ -200,104 +216,104 @@ function Fe(e, t, o = {}) {
200
216
  };
201
217
  let m = !1;
202
218
  const b = [
203
- M(n, "click", (u) => {
219
+ W(n, "click", (u) => {
204
220
  m || (m = !0, setTimeout(() => {
205
221
  m = !1;
206
- }, 0), a(u));
222
+ }, 0), f(u));
207
223
  }, { passive: !0, capture: c }),
208
- M(n, "pointerdown", (u) => {
209
- const f = E(e);
210
- l = !s(u) && !!(f && !u.composedPath().includes(f));
224
+ W(n, "pointerdown", (u) => {
225
+ const v = E(e);
226
+ r = !s(u) && !!(v && !u.composedPath().includes(v));
211
227
  }, { passive: !0 }),
212
- d && M(n, "blur", (u) => {
228
+ a && W(n, "blur", (u) => {
213
229
  setTimeout(() => {
214
- var f;
230
+ var v;
215
231
  const p = E(e);
216
- ((f = n.document.activeElement) == null ? void 0 : f.tagName) === "IFRAME" && !(p != null && p.contains(n.document.activeElement)) && t(u);
232
+ ((v = n.document.activeElement) == null ? void 0 : v.tagName) === "IFRAME" && !(p != null && p.contains(n.document.activeElement)) && t(u);
217
233
  }, 0);
218
234
  }, { passive: !0 })
219
235
  ].filter(Boolean), y = () => b.forEach((u) => u());
220
236
  return i ? {
221
237
  stop: y,
222
238
  cancel: () => {
223
- l = !1;
239
+ r = !1;
224
240
  },
225
241
  trigger: (u) => {
226
- l = !0, a(u), l = !1;
242
+ r = !0, f(u), r = !1;
227
243
  }
228
244
  } : y;
229
245
  }
230
- function Me() {
246
+ function We() {
231
247
  const e = S(!1), t = B();
232
248
  return t && te(() => {
233
249
  e.value = !0;
234
250
  }, t), e;
235
251
  }
236
252
  function G(e) {
237
- const t = Me();
253
+ const t = We();
238
254
  return I(() => (t.value, !!e()));
239
255
  }
240
- function Oe(e, t, o = {}) {
241
- const { window: n = R, ...v } = o;
256
+ function Me(e, t, o = {}) {
257
+ const { window: n = R, ...d } = o;
242
258
  let c;
243
- const d = G(() => n && "MutationObserver" in n), i = () => {
259
+ const a = G(() => n && "MutationObserver" in n), i = () => {
244
260
  c && (c.disconnect(), c = void 0);
245
- }, l = I(() => {
246
- const a = g(e), m = k(a).map(E).filter(he);
261
+ }, r = I(() => {
262
+ const f = g(e), m = k(f).map(E).filter(pe);
247
263
  return new Set(m);
248
264
  }), s = _(
249
- () => l.value,
250
- (a) => {
251
- i(), d.value && a.size && (c = new MutationObserver(t), a.forEach((m) => c.observe(m, v)));
265
+ () => r.value,
266
+ (f) => {
267
+ i(), a.value && f.size && (c = new MutationObserver(t), f.forEach((m) => c.observe(m, d)));
252
268
  },
253
269
  { immediate: !0, flush: "post" }
254
- ), h = () => c == null ? void 0 : c.takeRecords(), r = () => {
270
+ ), h = () => c == null ? void 0 : c.takeRecords(), l = () => {
255
271
  s(), i();
256
272
  };
257
- return N(r), {
258
- isSupported: d,
259
- stop: r,
273
+ return N(l), {
274
+ isSupported: a,
275
+ stop: l,
260
276
  takeRecords: h
261
277
  };
262
278
  }
263
279
  const Ie = Symbol("vueuse-ssr-width");
264
280
  function Re() {
265
- const e = ne() ? ve(Ie, null) : null;
281
+ const e = ne() ? me(Ie, null) : null;
266
282
  return typeof e == "number" ? e : void 0;
267
283
  }
268
284
  function Pe(e, t = {}) {
269
- const { window: o = R, ssrWidth: n = Re() } = t, v = G(() => o && "matchMedia" in o && typeof o.matchMedia == "function"), c = S(typeof n == "number"), d = S(), i = S(!1), l = (s) => {
285
+ const { window: o = R, ssrWidth: n = Re() } = t, d = G(() => o && "matchMedia" in o && typeof o.matchMedia == "function"), c = S(typeof n == "number"), a = S(), i = S(!1), r = (s) => {
270
286
  i.value = s.matches;
271
287
  };
272
- return fe(() => {
288
+ return he(() => {
273
289
  if (c.value) {
274
- c.value = !v.value;
290
+ c.value = !d.value;
275
291
  const s = g(e).split(",");
276
292
  i.value = s.some((h) => {
277
- const r = h.includes("not all"), a = h.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/), m = h.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);
278
- let b = !!(a || m);
279
- return a && b && (b = n >= K(a[1])), m && b && (b = n <= K(m[1])), r ? !b : b;
293
+ const l = h.includes("not all"), f = h.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/), m = h.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);
294
+ let b = !!(f || m);
295
+ return f && b && (b = n >= K(f[1])), m && b && (b = n <= K(m[1])), l ? !b : b;
280
296
  });
281
297
  return;
282
298
  }
283
- v.value && (d.value = o.matchMedia(g(e)), i.value = d.value.matches);
284
- }), M(d, "change", l, { passive: !0 }), I(() => i.value);
299
+ d.value && (a.value = o.matchMedia(g(e)), i.value = a.value.matches);
300
+ }), W(a, "change", r, { passive: !0 }), I(() => i.value);
285
301
  }
286
- function le(e, t, o = {}) {
287
- const { window: n = R, ...v } = o;
302
+ function se(e, t, o = {}) {
303
+ const { window: n = R, ...d } = o;
288
304
  let c;
289
- const d = G(() => n && "ResizeObserver" in n), i = () => {
305
+ const a = G(() => n && "ResizeObserver" in n), i = () => {
290
306
  c && (c.disconnect(), c = void 0);
291
- }, l = I(() => {
292
- const r = g(e);
293
- return Array.isArray(r) ? r.map((a) => E(a)) : [E(r)];
307
+ }, r = I(() => {
308
+ const l = g(e);
309
+ return Array.isArray(l) ? l.map((f) => E(f)) : [E(l)];
294
310
  }), s = _(
295
- l,
296
- (r) => {
297
- if (i(), d.value && n) {
311
+ r,
312
+ (l) => {
313
+ if (i(), a.value && n) {
298
314
  c = new ResizeObserver(t);
299
- for (const a of r)
300
- a && c.observe(a, v);
315
+ for (const f of l)
316
+ f && c.observe(f, d);
301
317
  }
302
318
  },
303
319
  { immediate: !0, flush: "post" }
@@ -305,95 +321,95 @@ function le(e, t, o = {}) {
305
321
  i(), s();
306
322
  };
307
323
  return N(h), {
308
- isSupported: d,
324
+ isSupported: a,
309
325
  stop: h
310
326
  };
311
327
  }
312
- function Le(e, t = {}) {
328
+ function Ce(e, t = {}) {
313
329
  const {
314
330
  reset: o = !0,
315
331
  windowResize: n = !0,
316
- windowScroll: v = !0,
332
+ windowScroll: d = !0,
317
333
  immediate: c = !0,
318
- updateTiming: d = "sync"
319
- } = t, i = S(0), l = S(0), s = S(0), h = S(0), r = S(0), a = S(0), m = S(0), b = S(0);
334
+ updateTiming: a = "sync"
335
+ } = t, i = S(0), r = S(0), s = S(0), h = S(0), l = S(0), f = S(0), m = S(0), b = S(0);
320
336
  function y() {
321
- const f = E(e);
322
- if (!f) {
323
- o && (i.value = 0, l.value = 0, s.value = 0, h.value = 0, r.value = 0, a.value = 0, m.value = 0, b.value = 0);
337
+ const v = E(e);
338
+ if (!v) {
339
+ o && (i.value = 0, r.value = 0, s.value = 0, h.value = 0, l.value = 0, f.value = 0, m.value = 0, b.value = 0);
324
340
  return;
325
341
  }
326
- const p = f.getBoundingClientRect();
327
- i.value = p.height, l.value = p.bottom, s.value = p.left, h.value = p.right, r.value = p.top, a.value = p.width, m.value = p.x, b.value = p.y;
342
+ const p = v.getBoundingClientRect();
343
+ i.value = p.height, r.value = p.bottom, s.value = p.left, h.value = p.right, l.value = p.top, f.value = p.width, m.value = p.x, b.value = p.y;
328
344
  }
329
345
  function u() {
330
- d === "sync" ? y() : d === "next-frame" && requestAnimationFrame(() => y());
346
+ a === "sync" ? y() : a === "next-frame" && requestAnimationFrame(() => y());
331
347
  }
332
- return le(e, u), _(() => E(e), (f) => !f && u()), Oe(e, u, {
348
+ return se(e, u), _(() => E(e), (v) => !v && u()), Me(e, u, {
333
349
  attributeFilter: ["style", "class"]
334
- }), v && M("scroll", u, { capture: !0, passive: !0 }), n && M("resize", u, { passive: !0 }), V(() => {
350
+ }), d && W("scroll", u, { capture: !0, passive: !0 }), n && W("resize", u, { passive: !0 }), V(() => {
335
351
  c && u();
336
352
  }), {
337
353
  height: i,
338
- bottom: l,
354
+ bottom: r,
339
355
  left: s,
340
356
  right: h,
341
- top: r,
342
- width: a,
357
+ top: l,
358
+ width: f,
343
359
  x: m,
344
360
  y: b,
345
361
  update: u
346
362
  };
347
363
  }
348
- function Ce(e, t = { width: 0, height: 0 }, o = {}) {
349
- const { window: n = R, box: v = "content-box" } = o, c = I(() => {
350
- var r, a;
351
- return (a = (r = E(e)) == null ? void 0 : r.namespaceURI) == null ? void 0 : a.includes("svg");
352
- }), d = S(t.width), i = S(t.height), { stop: l } = le(
364
+ function ke(e, t = { width: 0, height: 0 }, o = {}) {
365
+ const { window: n = R, box: d = "content-box" } = o, c = I(() => {
366
+ var l, f;
367
+ return (f = (l = E(e)) == null ? void 0 : l.namespaceURI) == null ? void 0 : f.includes("svg");
368
+ }), a = S(t.width), i = S(t.height), { stop: r } = se(
353
369
  e,
354
- ([r]) => {
355
- const a = v === "border-box" ? r.borderBoxSize : v === "content-box" ? r.contentBoxSize : r.devicePixelContentBoxSize;
370
+ ([l]) => {
371
+ const f = d === "border-box" ? l.borderBoxSize : d === "content-box" ? l.contentBoxSize : l.devicePixelContentBoxSize;
356
372
  if (n && c.value) {
357
373
  const m = E(e);
358
374
  if (m) {
359
375
  const b = m.getBoundingClientRect();
360
- d.value = b.width, i.value = b.height;
376
+ a.value = b.width, i.value = b.height;
361
377
  }
362
- } else if (a) {
363
- const m = k(a);
364
- d.value = m.reduce((b, { inlineSize: y }) => b + y, 0), i.value = m.reduce((b, { blockSize: y }) => b + y, 0);
378
+ } else if (f) {
379
+ const m = k(f);
380
+ a.value = m.reduce((b, { inlineSize: y }) => b + y, 0), i.value = m.reduce((b, { blockSize: y }) => b + y, 0);
365
381
  } else
366
- d.value = r.contentRect.width, i.value = r.contentRect.height;
382
+ a.value = l.contentRect.width, i.value = l.contentRect.height;
367
383
  },
368
384
  o
369
385
  );
370
386
  V(() => {
371
- const r = E(e);
372
- r && (d.value = "offsetWidth" in r ? r.offsetWidth : t.width, i.value = "offsetHeight" in r ? r.offsetHeight : t.height);
387
+ const l = E(e);
388
+ l && (a.value = "offsetWidth" in l ? l.offsetWidth : t.width, i.value = "offsetHeight" in l ? l.offsetHeight : t.height);
373
389
  });
374
390
  const s = _(
375
391
  () => E(e),
376
- (r) => {
377
- d.value = r ? t.width : 0, i.value = r ? t.height : 0;
392
+ (l) => {
393
+ a.value = l ? t.width : 0, i.value = l ? t.height : 0;
378
394
  }
379
395
  );
380
396
  function h() {
381
- l(), s();
397
+ r(), s();
382
398
  }
383
399
  return {
384
- width: d,
400
+ width: a,
385
401
  height: i,
386
402
  stop: h
387
403
  };
388
404
  }
389
405
  const ee = 1;
390
- function ke(e, t = {}) {
406
+ function De(e, t = {}) {
391
407
  const {
392
408
  throttle: o = 0,
393
409
  idle: n = 200,
394
- onStop: v = x,
410
+ onStop: d = x,
395
411
  onScroll: c = x,
396
- offset: d = {
412
+ offset: a = {
397
413
  left: 0,
398
414
  right: 0,
399
415
  top: 0,
@@ -403,21 +419,21 @@ function ke(e, t = {}) {
403
419
  capture: !1,
404
420
  passive: !0
405
421
  },
406
- behavior: l = "auto",
422
+ behavior: r = "auto",
407
423
  window: s = R,
408
424
  onError: h = (w) => {
409
425
  console.error(w);
410
426
  }
411
- } = t, r = S(0), a = S(0), m = I({
427
+ } = t, l = S(0), f = S(0), m = I({
412
428
  get() {
413
- return r.value;
429
+ return l.value;
414
430
  },
415
431
  set(w) {
416
432
  y(w, void 0);
417
433
  }
418
434
  }), b = I({
419
435
  get() {
420
- return a.value;
436
+ return f.value;
421
437
  },
422
438
  set(w) {
423
439
  y(void 0, w);
@@ -427,18 +443,18 @@ function ke(e, t = {}) {
427
443
  var T, L, C, j;
428
444
  if (!s)
429
445
  return;
430
- const W = g(e);
431
- if (!W)
446
+ const O = g(e);
447
+ if (!O)
432
448
  return;
433
- (C = W instanceof Document ? s.document.body : W) == null || C.scrollTo({
449
+ (C = O instanceof Document ? s.document.body : O) == null || C.scrollTo({
434
450
  top: (T = g(P)) != null ? T : b.value,
435
451
  left: (L = g(w)) != null ? L : m.value,
436
- behavior: g(l)
452
+ behavior: g(r)
437
453
  });
438
- const O = ((j = W == null ? void 0 : W.document) == null ? void 0 : j.documentElement) || (W == null ? void 0 : W.documentElement) || W;
439
- m != null && (r.value = O.scrollLeft), b != null && (a.value = O.scrollTop);
454
+ const M = ((j = O == null ? void 0 : O.document) == null ? void 0 : j.documentElement) || (O == null ? void 0 : O.documentElement) || O;
455
+ m != null && (l.value = M.scrollLeft), b != null && (f.value = M.scrollTop);
440
456
  }
441
- const u = S(!1), f = J({
457
+ const u = S(!1), v = J({
442
458
  left: !0,
443
459
  right: !1,
444
460
  top: !0,
@@ -449,19 +465,19 @@ function ke(e, t = {}) {
449
465
  top: !1,
450
466
  bottom: !1
451
467
  }), F = (w) => {
452
- u.value && (u.value = !1, p.left = !1, p.right = !1, p.top = !1, p.bottom = !1, v(w));
453
- }, D = Ee(F, o + n), z = (w) => {
468
+ u.value && (u.value = !1, p.left = !1, p.right = !1, p.top = !1, p.bottom = !1, d(w));
469
+ }, D = Te(F, o + n), z = (w) => {
454
470
  var P;
455
471
  if (!s)
456
472
  return;
457
- const T = ((P = w == null ? void 0 : w.document) == null ? void 0 : P.documentElement) || (w == null ? void 0 : w.documentElement) || E(w), { display: L, flexDirection: C, direction: j } = getComputedStyle(T), W = j === "rtl" ? -1 : 1, O = T.scrollLeft;
458
- p.left = O < r.value, p.right = O > r.value;
459
- const Q = Math.abs(O * W) <= (d.left || 0), X = Math.abs(O * W) + T.clientWidth >= T.scrollWidth - (d.right || 0) - ee;
460
- L === "flex" && C === "row-reverse" ? (f.left = X, f.right = Q) : (f.left = Q, f.right = X), r.value = O;
473
+ const T = ((P = w == null ? void 0 : w.document) == null ? void 0 : P.documentElement) || (w == null ? void 0 : w.documentElement) || E(w), { display: L, flexDirection: C, direction: j } = getComputedStyle(T), O = j === "rtl" ? -1 : 1, M = T.scrollLeft;
474
+ p.left = M < l.value, p.right = M > l.value;
475
+ const Q = Math.abs(M * O) <= (a.left || 0), X = Math.abs(M * O) + T.clientWidth >= T.scrollWidth - (a.right || 0) - ee;
476
+ L === "flex" && C === "row-reverse" ? (v.left = X, v.right = Q) : (v.left = Q, v.right = X), l.value = M;
461
477
  let A = T.scrollTop;
462
- w === s.document && !A && (A = s.document.body.scrollTop), p.top = A < a.value, p.bottom = A > a.value;
463
- const U = Math.abs(A) <= (d.top || 0), q = Math.abs(A) + T.clientHeight >= T.scrollHeight - (d.bottom || 0) - ee;
464
- L === "flex" && C === "column-reverse" ? (f.top = q, f.bottom = U) : (f.top = U, f.bottom = q), a.value = A;
478
+ w === s.document && !A && (A = s.document.body.scrollTop), p.top = A < f.value, p.bottom = A > f.value;
479
+ const U = Math.abs(A) <= (a.top || 0), q = Math.abs(A) + T.clientHeight >= T.scrollHeight - (a.bottom || 0) - ee;
480
+ L === "flex" && C === "column-reverse" ? (v.top = q, v.bottom = U) : (v.top = U, v.bottom = q), f.value = A;
465
481
  }, Y = (w) => {
466
482
  var P;
467
483
  if (!s)
@@ -469,10 +485,10 @@ function ke(e, t = {}) {
469
485
  const T = (P = w.target.documentElement) != null ? P : w.target;
470
486
  z(T), u.value = !0, D(w), c(w);
471
487
  };
472
- return M(
488
+ return W(
473
489
  e,
474
490
  "scroll",
475
- o ? Te(Y, o, !0, !1) : Y,
491
+ o ? xe(Y, o, !0, !1) : Y,
476
492
  i
477
493
  ), V(() => {
478
494
  try {
@@ -483,7 +499,7 @@ function ke(e, t = {}) {
483
499
  } catch (w) {
484
500
  h(w);
485
501
  }
486
- }), M(
502
+ }), W(
487
503
  e,
488
504
  "scrollend",
489
505
  F,
@@ -492,7 +508,7 @@ function ke(e, t = {}) {
492
508
  x: m,
493
509
  y: b,
494
510
  isScrolling: u,
495
- arrivedState: f,
511
+ arrivedState: v,
496
512
  directions: p,
497
513
  measure() {
498
514
  const w = g(e);
@@ -500,37 +516,38 @@ function ke(e, t = {}) {
500
516
  }
501
517
  };
502
518
  }
503
- function De(e = {}) {
519
+ function je(e = {}) {
504
520
  const {
505
521
  window: t = R,
506
522
  initialWidth: o = Number.POSITIVE_INFINITY,
507
523
  initialHeight: n = Number.POSITIVE_INFINITY,
508
- listenOrientation: v = !0,
524
+ listenOrientation: d = !0,
509
525
  includeScrollbar: c = !0,
510
- type: d = "inner"
511
- } = e, i = S(o), l = S(n), s = () => {
526
+ type: a = "inner"
527
+ } = e, i = S(o), r = S(n), s = () => {
512
528
  if (t)
513
- if (d === "outer")
514
- i.value = t.outerWidth, l.value = t.outerHeight;
515
- else if (d === "visual" && t.visualViewport) {
516
- const { width: r, height: a, scale: m } = t.visualViewport;
517
- i.value = Math.round(r * m), l.value = Math.round(a * m);
518
- } else c ? (i.value = t.innerWidth, l.value = t.innerHeight) : (i.value = t.document.documentElement.clientWidth, l.value = t.document.documentElement.clientHeight);
529
+ if (a === "outer")
530
+ i.value = t.outerWidth, r.value = t.outerHeight;
531
+ else if (a === "visual" && t.visualViewport) {
532
+ const { width: l, height: f, scale: m } = t.visualViewport;
533
+ i.value = Math.round(l * m), r.value = Math.round(f * m);
534
+ } else c ? (i.value = t.innerWidth, r.value = t.innerHeight) : (i.value = t.document.documentElement.clientWidth, r.value = t.document.documentElement.clientHeight);
519
535
  };
520
536
  s(), V(s);
521
537
  const h = { passive: !0 };
522
- if (M("resize", s, h), t && d === "visual" && t.visualViewport && M(t.visualViewport, "resize", s, h), v) {
523
- const r = Pe("(orientation: portrait)");
524
- _(r, () => s());
538
+ if (W("resize", s, h), t && a === "visual" && t.visualViewport && W(t.visualViewport, "resize", s, h), d) {
539
+ const l = Pe("(orientation: portrait)");
540
+ _(l, () => s());
525
541
  }
526
- return { width: i, height: l };
542
+ return { width: i, height: r };
527
543
  }
528
544
  export {
529
- De as a,
530
- Ce as b,
531
- Le as c,
545
+ je as a,
546
+ ke as b,
547
+ Ce as c,
532
548
  Pe as d,
533
- Fe as o,
534
- ke as u,
549
+ Fe as e,
550
+ Le as o,
551
+ De as u,
535
552
  _e as w
536
553
  };