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