@opentiny/tiny-robot 0.3.0-alpha.9 → 0.3.0-rc.0

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,117 +1,167 @@
1
- import { onMounted as oe, nextTick as fe, watch as L, getCurrentScope as ve, onScopeDispose as me, isRef as he, getCurrentInstance as B, toValue as g, hasInjectionContext as ie, inject as pe, shallowRef as y, computed as _, reactive as Z, unref as we, watchEffect as se } from "vue";
2
- function V(e) {
3
- return ve() ? (me(e), !0) : !1;
1
+ import { onMounted as re, nextTick as me, watch as k, getCurrentScope as ge, onScopeDispose as we, getCurrentInstance as j, isRef as ie, toValue as w, hasInjectionContext as le, inject as be, toRefs as ye, customRef as Oe, shallowRef as y, computed as P, reactive as Z, unref as Se, watchEffect as se, ref as ue, readonly as Te } from "vue";
2
+ function z(e) {
3
+ return ge() ? (we(e), !0) : !1;
4
4
  }
5
- const N = /* @__PURE__ */ new WeakMap(), be = (...e) => {
5
+ // @__NO_SIDE_EFFECTS__
6
+ function ee() {
7
+ const e = /* @__PURE__ */ new Set(), t = (i) => {
8
+ e.delete(i);
9
+ };
10
+ return {
11
+ on: (i) => {
12
+ e.add(i);
13
+ const a = () => t(i);
14
+ return z(a), {
15
+ off: a
16
+ };
17
+ },
18
+ off: t,
19
+ trigger: (...i) => Promise.all(Array.from(e).map((a) => a(...i))),
20
+ clear: () => {
21
+ e.clear();
22
+ }
23
+ };
24
+ }
25
+ const B = /* @__PURE__ */ new WeakMap(), Ee = /* @__NO_SIDE_EFFECTS__ */ (...e) => {
6
26
  var t;
7
- const o = e[0], n = (t = B()) == null ? void 0 : t.proxy;
8
- if (n == null && !ie())
27
+ const o = e[0], n = (t = j()) == null ? void 0 : t.proxy;
28
+ if (n == null && !le())
9
29
  throw new Error("injectLocal must be called in setup");
10
- return n && N.has(n) && o in N.get(n) ? N.get(n)[o] : pe(...e);
11
- }, re = typeof window < "u" && typeof document < "u";
30
+ return n && B.has(n) && o in B.get(n) ? B.get(n)[o] : be(...e);
31
+ }, $ = typeof window < "u" && typeof document < "u";
12
32
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
13
- const ge = (e) => e != null, ye = Object.prototype.toString, Se = (e) => ye.call(e) === "[object Object]", O = () => {
14
- }, Ee = /* @__PURE__ */ Te();
15
- function Te() {
33
+ const xe = (e) => e != null, We = Object.prototype.toString, Me = (e) => We.call(e) === "[object Object]", W = () => {
34
+ }, Ie = (e, t) => Object.prototype.hasOwnProperty.call(e, t), Pe = /* @__PURE__ */ Ae();
35
+ function Ae() {
16
36
  var e, t;
17
- return re && ((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));
37
+ return $ && ((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
38
  }
19
- function $(e, t) {
39
+ function Y(e, t) {
20
40
  function o(...n) {
21
- return new Promise((f, a) => {
22
- Promise.resolve(e(() => t.apply(this, n), { fn: t, thisArg: this, args: n })).then(f).catch(a);
41
+ return new Promise((u, i) => {
42
+ Promise.resolve(e(() => t.apply(this, n), { fn: t, thisArg: this, args: n })).then(u).catch(i);
23
43
  });
24
44
  }
25
45
  return o;
26
46
  }
27
- const Oe = (e) => e();
28
- function le(e, t = {}) {
29
- let o, n, f = O;
30
- const a = (s) => {
31
- clearTimeout(s), f(), f = O;
47
+ const Fe = (e) => e();
48
+ function ce(e, t = {}) {
49
+ let o, n, u = W;
50
+ const i = (s) => {
51
+ clearTimeout(s), u(), u = W;
32
52
  };
33
- let l;
53
+ let a;
34
54
  return (s) => {
35
- const u = g(e), r = g(t.maxWait);
36
- return o && a(o), u <= 0 || r !== void 0 && r <= 0 ? (n && (a(n), n = void 0), Promise.resolve(s())) : new Promise((c, v) => {
37
- f = t.rejectOnCancel ? v : c, l = s, r && !n && (n = setTimeout(() => {
38
- o && a(o), n = void 0, c(l());
39
- }, r)), o = setTimeout(() => {
40
- n && a(n), n = void 0, c(s());
41
- }, u);
55
+ const d = w(e), v = w(t.maxWait);
56
+ return o && i(o), d <= 0 || v !== void 0 && v <= 0 ? (n && (i(n), n = void 0), Promise.resolve(s())) : new Promise((l, c) => {
57
+ u = t.rejectOnCancel ? c : l, a = s, v && !n && (n = setTimeout(() => {
58
+ o && i(o), n = void 0, l(a());
59
+ }, v)), o = setTimeout(() => {
60
+ n && i(n), n = void 0, l(s());
61
+ }, d);
42
62
  });
43
63
  };
44
64
  }
45
- function ue(...e) {
46
- let t = 0, o, n = !0, f = O, a, l, i, s, u;
47
- !he(e[0]) && typeof e[0] == "object" ? { delay: l, trailing: i = !0, leading: s = !0, rejectOnCancel: u = !1 } = e[0] : [l, i = !0, s = !0, u = !1] = e;
48
- const r = () => {
49
- o && (clearTimeout(o), o = void 0, f(), f = O);
65
+ function ae(...e) {
66
+ let t = 0, o, n = !0, u = W, i, a, r, s, d;
67
+ !ie(e[0]) && typeof e[0] == "object" ? { delay: a, trailing: r = !0, leading: s = !0, rejectOnCancel: d = !1 } = e[0] : [a, r = !0, s = !0, d = !1] = e;
68
+ const v = () => {
69
+ o && (clearTimeout(o), o = void 0, u(), u = W);
50
70
  };
51
- return (v) => {
52
- const m = g(l), h = Date.now() - t, S = () => a = v();
53
- return r(), m <= 0 ? (t = Date.now(), S()) : (h > m && (s || !n) ? (t = Date.now(), S()) : i && (a = new Promise((d, p) => {
54
- f = u ? p : d, o = setTimeout(() => {
55
- t = Date.now(), n = !0, d(S()), r();
56
- }, Math.max(0, m - h));
57
- })), !s && !o && (o = setTimeout(() => n = !0, m)), n = !1, a);
71
+ return (c) => {
72
+ const p = w(a), h = Date.now() - t, O = () => i = c();
73
+ return v(), p <= 0 ? (t = Date.now(), O()) : (h > p && (s || !n) ? (t = Date.now(), O()) : r && (i = new Promise((f, m) => {
74
+ u = d ? m : f, o = setTimeout(() => {
75
+ t = Date.now(), n = !0, f(O()), v();
76
+ }, Math.max(0, p - h));
77
+ })), !s && !o && (o = setTimeout(() => n = !0, p)), n = !1, i);
58
78
  };
59
79
  }
60
- function ee(e) {
80
+ function te(e) {
61
81
  return e.endsWith("rem") ? Number.parseFloat(e) * 16 : Number.parseFloat(e);
62
82
  }
63
- function k(e) {
83
+ function _e(e, t, o = !1) {
84
+ return t.reduce((n, u) => (u in e && (!o || e[u] !== void 0) && (n[u] = e[u]), n), {});
85
+ }
86
+ function C(e) {
64
87
  return Array.isArray(e) ? e : [e];
65
88
  }
66
- function We(e) {
67
- return B();
89
+ function Le(e) {
90
+ return j();
68
91
  }
69
- function xe(e, t = 200, o = {}) {
70
- return $(
71
- le(t, o),
92
+ // @__NO_SIDE_EFFECTS__
93
+ function ke(e, t = 200, o = {}) {
94
+ return Y(
95
+ ce(t, o),
72
96
  e
73
97
  );
74
98
  }
75
- function Me(e, t = 200, o = !1, n = !0, f = !1) {
76
- return $(
77
- ue(t, o, n, f),
99
+ // @__NO_SIDE_EFFECTS__
100
+ function De(e, t = 200, o = !1, n = !0, u = !1) {
101
+ return Y(
102
+ ae(t, o, n, u),
78
103
  e
79
104
  );
80
105
  }
81
- function ce(e, t, o = {}) {
106
+ function fe(e, t, o = {}) {
82
107
  const {
83
- eventFilter: n = Oe,
84
- ...f
108
+ eventFilter: n = Fe,
109
+ ...u
85
110
  } = o;
86
- return L(
111
+ return k(
87
112
  e,
88
- $(
113
+ Y(
89
114
  n,
90
115
  t
91
116
  ),
92
- f
117
+ u
93
118
  );
94
119
  }
95
- function z(e, t = !0, o) {
96
- We() ? oe(e, o) : t ? e() : fe(e);
120
+ function Re(e, t = {}) {
121
+ if (!ie(e))
122
+ return ye(e);
123
+ const o = Array.isArray(e.value) ? Array.from({ length: e.value.length }) : {};
124
+ for (const n in e.value)
125
+ o[n] = Oe(() => ({
126
+ get() {
127
+ return e.value[n];
128
+ },
129
+ set(u) {
130
+ var i;
131
+ if ((i = w(t.replaceRef)) != null ? i : !0)
132
+ if (Array.isArray(e.value)) {
133
+ const r = [...e.value];
134
+ r[n] = u, e.value = r;
135
+ } else {
136
+ const r = { ...e.value, [n]: u };
137
+ Object.setPrototypeOf(r, Object.getPrototypeOf(e.value)), e.value = r;
138
+ }
139
+ else
140
+ e.value[n] = u;
141
+ }
142
+ }));
143
+ return o;
144
+ }
145
+ function N(e, t = !0, o) {
146
+ Le() ? re(e, o) : t ? e() : me(e);
97
147
  }
98
- function Ce(e, t, o = {}) {
148
+ function Xe(e, t, o = {}) {
99
149
  const {
100
150
  debounce: n = 0,
101
- maxWait: f = void 0,
102
- ...a
151
+ maxWait: u = void 0,
152
+ ...i
103
153
  } = o;
104
- return ce(
154
+ return fe(
105
155
  e,
106
156
  t,
107
157
  {
108
- ...a,
109
- eventFilter: le(n, { maxWait: f })
158
+ ...i,
159
+ eventFilter: ce(n, { maxWait: u })
110
160
  }
111
161
  );
112
162
  }
113
- function Re(e, t, o) {
114
- return L(
163
+ function Ce(e, t, o) {
164
+ return k(
115
165
  e,
116
166
  t,
117
167
  {
@@ -120,444 +170,452 @@ function Re(e, t, o) {
120
170
  }
121
171
  );
122
172
  }
123
- function He(e, t, o = {}) {
173
+ function Qe(e, t, o = {}) {
124
174
  const {
125
175
  throttle: n = 0,
126
- trailing: f = !0,
127
- leading: a = !0,
128
- ...l
176
+ trailing: u = !0,
177
+ leading: i = !0,
178
+ ...a
129
179
  } = o;
130
- return ce(
180
+ return fe(
131
181
  e,
132
182
  t,
133
183
  {
134
- ...l,
135
- eventFilter: ue(n, f, a)
184
+ ...a,
185
+ eventFilter: ae(n, u, i)
136
186
  }
137
187
  );
138
188
  }
139
- const I = re ? window : void 0;
140
- function E(e) {
189
+ const A = $ ? window : void 0, Ve = $ ? window.document : void 0;
190
+ function S(e) {
141
191
  var t;
142
- const o = g(e);
192
+ const o = w(e);
143
193
  return (t = o == null ? void 0 : o.$el) != null ? t : o;
144
194
  }
145
195
  function M(...e) {
146
196
  const t = [], o = () => {
147
- t.forEach((i) => i()), t.length = 0;
148
- }, n = (i, s, u, r) => (i.addEventListener(s, u, r), () => i.removeEventListener(s, u, r)), f = _(() => {
149
- const i = k(g(e[0])).filter((s) => s != null);
150
- return i.every((s) => typeof s != "string") ? i : void 0;
151
- }), a = Re(
197
+ t.forEach((r) => r()), t.length = 0;
198
+ }, n = (r, s, d, v) => (r.addEventListener(s, d, v), () => r.removeEventListener(s, d, v)), u = P(() => {
199
+ const r = C(w(e[0])).filter((s) => s != null);
200
+ return r.every((s) => typeof s != "string") ? r : void 0;
201
+ }), i = Ce(
152
202
  () => {
153
- var i, s;
203
+ var r, s;
154
204
  return [
155
- (s = (i = f.value) == null ? void 0 : i.map((u) => E(u))) != null ? s : [I].filter((u) => u != null),
156
- k(g(f.value ? e[1] : e[0])),
157
- k(we(f.value ? e[2] : e[1])),
205
+ (s = (r = u.value) == null ? void 0 : r.map((d) => S(d))) != null ? s : [A].filter((d) => d != null),
206
+ C(w(u.value ? e[1] : e[0])),
207
+ C(Se(u.value ? e[2] : e[1])),
158
208
  // @ts-expect-error - TypeScript gets the correct types, but somehow still complains
159
- g(f.value ? e[3] : e[2])
209
+ w(u.value ? e[3] : e[2])
160
210
  ];
161
211
  },
162
- ([i, s, u, r]) => {
163
- if (o(), !(i != null && i.length) || !(s != null && s.length) || !(u != null && u.length))
212
+ ([r, s, d, v]) => {
213
+ if (o(), !(r != null && r.length) || !(s != null && s.length) || !(d != null && d.length))
164
214
  return;
165
- const c = Se(r) ? { ...r } : r;
215
+ const l = Me(v) ? { ...v } : v;
166
216
  t.push(
167
- ...i.flatMap(
168
- (v) => s.flatMap(
169
- (m) => u.map((h) => n(v, m, h, c))
217
+ ...r.flatMap(
218
+ (c) => s.flatMap(
219
+ (p) => d.map((h) => n(c, p, h, l))
170
220
  )
171
221
  )
172
222
  );
173
223
  },
174
224
  { flush: "post" }
175
- ), l = () => {
176
- a(), o();
225
+ ), a = () => {
226
+ i(), o();
177
227
  };
178
- return V(o), l;
228
+ return z(o), a;
179
229
  }
180
- let te = !1;
181
- function ke(e, t, o = {}) {
182
- const { window: n = I, ignore: f = [], capture: a = !0, detectIframe: l = !1, controls: i = !1 } = o;
230
+ let ne = !1;
231
+ function Ue(e, t, o = {}) {
232
+ const { window: n = A, ignore: u = [], capture: i = !0, detectIframe: a = !1, controls: r = !1 } = o;
183
233
  if (!n)
184
- return i ? { stop: O, cancel: O, trigger: O } : O;
185
- if (Ee && !te) {
186
- te = !0;
187
- const d = { passive: !0 };
188
- Array.from(n.document.body.children).forEach((p) => p.addEventListener("click", O, d)), n.document.documentElement.addEventListener("click", O, d);
234
+ return r ? { stop: W, cancel: W, trigger: W } : W;
235
+ if (Pe && !ne) {
236
+ ne = !0;
237
+ const f = { passive: !0 };
238
+ Array.from(n.document.body.children).forEach((m) => m.addEventListener("click", W, f)), n.document.documentElement.addEventListener("click", W, f);
189
239
  }
190
240
  let s = !0;
191
- const u = (d) => g(f).some((p) => {
192
- if (typeof p == "string")
193
- return Array.from(n.document.querySelectorAll(p)).some((b) => b === d.target || d.composedPath().includes(b));
241
+ const d = (f) => w(u).some((m) => {
242
+ if (typeof m == "string")
243
+ return Array.from(n.document.querySelectorAll(m)).some((b) => b === f.target || f.composedPath().includes(b));
194
244
  {
195
- const b = E(p);
196
- return b && (d.target === b || d.composedPath().includes(b));
245
+ const b = S(m);
246
+ return b && (f.target === b || f.composedPath().includes(b));
197
247
  }
198
248
  });
199
- function r(d) {
200
- const p = g(d);
201
- return p && p.$.subTree.shapeFlag === 16;
249
+ function v(f) {
250
+ const m = w(f);
251
+ return m && m.$.subTree.shapeFlag === 16;
202
252
  }
203
- function c(d, p) {
204
- const b = g(d), T = b.$.subTree && b.$.subTree.children;
205
- return T == null || !Array.isArray(T) ? !1 : T.some((W) => W.el === p.target || p.composedPath().includes(W.el));
253
+ function l(f, m) {
254
+ const b = w(f), T = b.$.subTree && b.$.subTree.children;
255
+ return T == null || !Array.isArray(T) ? !1 : T.some((E) => E.el === m.target || m.composedPath().includes(E.el));
206
256
  }
207
- const v = (d) => {
208
- const p = E(e);
209
- if (d.target != null && !(!(p instanceof Element) && r(e) && c(e, d)) && !(!p || p === d.target || d.composedPath().includes(p))) {
210
- if ("detail" in d && d.detail === 0 && (s = !u(d)), !s) {
257
+ const c = (f) => {
258
+ const m = S(e);
259
+ if (f.target != null && !(!(m instanceof Element) && v(e) && l(e, f)) && !(!m || m === f.target || f.composedPath().includes(m))) {
260
+ if ("detail" in f && f.detail === 0 && (s = !d(f)), !s) {
211
261
  s = !0;
212
262
  return;
213
263
  }
214
- t(d);
264
+ t(f);
215
265
  }
216
266
  };
217
- let m = !1;
267
+ let p = !1;
218
268
  const h = [
219
- M(n, "click", (d) => {
220
- m || (m = !0, setTimeout(() => {
221
- m = !1;
222
- }, 0), v(d));
223
- }, { passive: !0, capture: a }),
224
- M(n, "pointerdown", (d) => {
225
- const p = E(e);
226
- s = !u(d) && !!(p && !d.composedPath().includes(p));
269
+ M(n, "click", (f) => {
270
+ p || (p = !0, setTimeout(() => {
271
+ p = !1;
272
+ }, 0), c(f));
273
+ }, { passive: !0, capture: i }),
274
+ M(n, "pointerdown", (f) => {
275
+ const m = S(e);
276
+ s = !d(f) && !!(m && !f.composedPath().includes(m));
227
277
  }, { passive: !0 }),
228
- l && M(n, "blur", (d) => {
278
+ a && M(n, "blur", (f) => {
229
279
  setTimeout(() => {
230
- var p;
231
- const b = E(e);
232
- ((p = n.document.activeElement) == null ? void 0 : p.tagName) === "IFRAME" && !(b != null && b.contains(n.document.activeElement)) && t(d);
280
+ var m;
281
+ const b = S(e);
282
+ ((m = n.document.activeElement) == null ? void 0 : m.tagName) === "IFRAME" && !(b != null && b.contains(n.document.activeElement)) && t(f);
233
283
  }, 0);
234
284
  }, { passive: !0 })
235
- ].filter(Boolean), S = () => h.forEach((d) => d());
236
- return i ? {
237
- stop: S,
285
+ ].filter(Boolean), O = () => h.forEach((f) => f());
286
+ return r ? {
287
+ stop: O,
238
288
  cancel: () => {
239
289
  s = !1;
240
290
  },
241
- trigger: (d) => {
242
- s = !0, v(d), s = !1;
291
+ trigger: (f) => {
292
+ s = !0, c(f), s = !1;
243
293
  }
244
- } : S;
294
+ } : O;
245
295
  }
246
- function Ie() {
247
- const e = y(!1), t = B();
248
- return t && oe(() => {
296
+ // @__NO_SIDE_EFFECTS__
297
+ function He() {
298
+ const e = y(!1), t = j();
299
+ return t && re(() => {
249
300
  e.value = !0;
250
301
  }, t), e;
251
302
  }
303
+ // @__NO_SIDE_EFFECTS__
252
304
  function G(e) {
253
- const t = Ie();
254
- return _(() => (t.value, !!e()));
305
+ const t = /* @__PURE__ */ He();
306
+ return P(() => (t.value, !!e()));
255
307
  }
256
- function Y(e, t, o = {}) {
257
- const { window: n = I, ...f } = o;
258
- let a;
259
- const l = G(() => n && "MutationObserver" in n), i = () => {
260
- a && (a.disconnect(), a = void 0);
261
- }, s = _(() => {
262
- const v = g(e), m = k(v).map(E).filter(ge);
263
- return new Set(m);
264
- }), u = L(
308
+ function de(e, t, o = {}) {
309
+ const { window: n = A, ...u } = o;
310
+ let i;
311
+ const a = /* @__PURE__ */ G(() => n && "MutationObserver" in n), r = () => {
312
+ i && (i.disconnect(), i = void 0);
313
+ }, s = P(() => {
314
+ const c = w(e), p = C(c).map(S).filter(xe);
315
+ return new Set(p);
316
+ }), d = k(
265
317
  () => s.value,
266
- (v) => {
267
- i(), l.value && v.size && (a = new MutationObserver(t), v.forEach((m) => a.observe(m, f)));
318
+ (c) => {
319
+ r(), a.value && c.size && (i = new MutationObserver(t), c.forEach((p) => i.observe(p, u)));
268
320
  },
269
321
  { immediate: !0, flush: "post" }
270
- ), r = () => a == null ? void 0 : a.takeRecords(), c = () => {
271
- u(), i();
322
+ ), v = () => i == null ? void 0 : i.takeRecords(), l = () => {
323
+ d(), r();
272
324
  };
273
- return V(c), {
274
- isSupported: l,
275
- stop: c,
276
- takeRecords: r
325
+ return z(l), {
326
+ isSupported: a,
327
+ stop: l,
328
+ takeRecords: v
277
329
  };
278
330
  }
279
- function _e(e, t, o = {}) {
280
- const {
281
- window: n = I,
282
- document: f = n == null ? void 0 : n.document,
283
- flush: a = "sync"
284
- } = o;
285
- if (!n || !f)
286
- return O;
287
- let l;
288
- const i = (r) => {
289
- l == null || l(), l = r;
290
- }, s = se(() => {
291
- const r = E(e);
292
- if (r) {
293
- const { stop: c } = Y(
294
- f,
295
- (v) => {
296
- v.map((h) => [...h.removedNodes]).flat().some((h) => h === r || h.contains(r)) && t(v);
297
- },
298
- {
299
- window: n,
300
- childList: !0,
301
- subtree: !0
302
- }
303
- );
304
- i(c);
305
- }
306
- }, { flush: a }), u = () => {
307
- s(), i();
308
- };
309
- return V(u), u;
310
- }
311
- const Ae = Symbol("vueuse-ssr-width");
312
- function Pe() {
313
- const e = ie() ? be(Ae, null) : null;
331
+ const ze = Symbol("vueuse-ssr-width");
332
+ // @__NO_SIDE_EFFECTS__
333
+ function Ne() {
334
+ const e = le() ? /* @__PURE__ */ Ee(ze, null) : null;
314
335
  return typeof e == "number" ? e : void 0;
315
336
  }
316
- function Fe(e, t = {}) {
317
- const { window: o = I, ssrWidth: n = Pe() } = t, f = G(() => o && "matchMedia" in o && typeof o.matchMedia == "function"), a = y(typeof n == "number"), l = y(), i = y(!1), s = (u) => {
318
- i.value = u.matches;
337
+ function Be(e, t = {}) {
338
+ const { window: o = A, ssrWidth: n = /* @__PURE__ */ Ne() } = t, u = /* @__PURE__ */ G(() => o && "matchMedia" in o && typeof o.matchMedia == "function"), i = y(typeof n == "number"), a = y(), r = y(!1), s = (d) => {
339
+ r.value = d.matches;
319
340
  };
320
341
  return se(() => {
321
- if (a.value) {
322
- a.value = !f.value;
323
- const u = g(e).split(",");
324
- i.value = u.some((r) => {
325
- const c = r.includes("not all"), v = r.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/), m = r.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);
326
- let h = !!(v || m);
327
- return v && h && (h = n >= ee(v[1])), m && h && (h = n <= ee(m[1])), c ? !h : h;
342
+ if (i.value) {
343
+ i.value = !u.value;
344
+ const d = w(e).split(",");
345
+ r.value = d.some((v) => {
346
+ const l = v.includes("not all"), c = v.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/), p = v.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);
347
+ let h = !!(c || p);
348
+ return c && h && (h = n >= te(c[1])), p && h && (h = n <= te(p[1])), l ? !h : h;
328
349
  });
329
350
  return;
330
351
  }
331
- f.value && (l.value = o.matchMedia(g(e)), i.value = l.value.matches);
332
- }), M(l, "change", s, { passive: !0 }), _(() => i.value);
352
+ u.value && (a.value = o.matchMedia(w(e)), r.value = a.value.matches);
353
+ }), M(a, "change", s, { passive: !0 }), P(() => r.value);
333
354
  }
334
- function ae(e, t, o = {}) {
335
- const { window: n = I, ...f } = o;
336
- let a;
337
- const l = G(() => n && "ResizeObserver" in n), i = () => {
338
- a && (a.disconnect(), a = void 0);
339
- }, s = _(() => {
340
- const c = g(e);
341
- return Array.isArray(c) ? c.map((v) => E(v)) : [E(c)];
342
- }), u = L(
355
+ function ve(e, t, o = {}) {
356
+ const { window: n = A, ...u } = o;
357
+ let i;
358
+ const a = /* @__PURE__ */ G(() => n && "ResizeObserver" in n), r = () => {
359
+ i && (i.disconnect(), i = void 0);
360
+ }, s = P(() => {
361
+ const l = w(e);
362
+ return Array.isArray(l) ? l.map((c) => S(c)) : [S(l)];
363
+ }), d = k(
343
364
  s,
344
- (c) => {
345
- if (i(), l.value && n) {
346
- a = new ResizeObserver(t);
347
- for (const v of c)
348
- v && a.observe(v, f);
365
+ (l) => {
366
+ if (r(), a.value && n) {
367
+ i = new ResizeObserver(t);
368
+ for (const c of l)
369
+ c && i.observe(c, u);
349
370
  }
350
371
  },
351
372
  { immediate: !0, flush: "post" }
352
- ), r = () => {
353
- i(), u();
373
+ ), v = () => {
374
+ r(), d();
354
375
  };
355
- return V(r), {
356
- isSupported: l,
357
- stop: r
376
+ return z(v), {
377
+ isSupported: a,
378
+ stop: v
358
379
  };
359
380
  }
360
- function De(e, t = {}) {
381
+ function qe(e, t = {}) {
361
382
  const {
362
383
  reset: o = !0,
363
384
  windowResize: n = !0,
364
- windowScroll: f = !0,
365
- immediate: a = !0,
366
- updateTiming: l = "sync"
367
- } = t, i = y(0), s = y(0), u = y(0), r = y(0), c = y(0), v = y(0), m = y(0), h = y(0);
368
- function S() {
369
- const p = E(e);
370
- if (!p) {
371
- o && (i.value = 0, s.value = 0, u.value = 0, r.value = 0, c.value = 0, v.value = 0, m.value = 0, h.value = 0);
385
+ windowScroll: u = !0,
386
+ immediate: i = !0,
387
+ updateTiming: a = "sync"
388
+ } = t, r = y(0), s = y(0), d = y(0), v = y(0), l = y(0), c = y(0), p = y(0), h = y(0);
389
+ function O() {
390
+ const m = S(e);
391
+ if (!m) {
392
+ o && (r.value = 0, s.value = 0, d.value = 0, v.value = 0, l.value = 0, c.value = 0, p.value = 0, h.value = 0);
372
393
  return;
373
394
  }
374
- const b = p.getBoundingClientRect();
375
- i.value = b.height, s.value = b.bottom, u.value = b.left, r.value = b.right, c.value = b.top, v.value = b.width, m.value = b.x, h.value = b.y;
395
+ const b = m.getBoundingClientRect();
396
+ r.value = b.height, s.value = b.bottom, d.value = b.left, v.value = b.right, l.value = b.top, c.value = b.width, p.value = b.x, h.value = b.y;
376
397
  }
377
- function d() {
378
- l === "sync" ? S() : l === "next-frame" && requestAnimationFrame(() => S());
398
+ function f() {
399
+ a === "sync" ? O() : a === "next-frame" && requestAnimationFrame(() => O());
379
400
  }
380
- return ae(e, d), L(() => E(e), (p) => !p && d()), Y(e, d, {
401
+ return ve(e, f), k(() => S(e), (m) => !m && f()), de(e, f, {
381
402
  attributeFilter: ["style", "class"]
382
- }), f && M("scroll", d, { capture: !0, passive: !0 }), n && M("resize", d, { passive: !0 }), z(() => {
383
- a && d();
403
+ }), u && M("scroll", f, { capture: !0, passive: !0 }), n && M("resize", f, { passive: !0 }), N(() => {
404
+ i && f();
384
405
  }), {
385
- height: i,
406
+ height: r,
386
407
  bottom: s,
387
- left: u,
388
- right: r,
389
- top: c,
390
- width: v,
391
- x: m,
408
+ left: d,
409
+ right: v,
410
+ top: l,
411
+ width: c,
412
+ x: p,
392
413
  y: h,
393
- update: d
414
+ update: f
394
415
  };
395
416
  }
396
- function je(e, t = {}) {
397
- const {
398
- delayEnter: o = 0,
399
- delayLeave: n = 0,
400
- triggerOnRemoval: f = !1,
401
- window: a = I
402
- } = t, l = y(!1);
403
- let i;
404
- const s = (u) => {
405
- const r = u ? o : n;
406
- i && (clearTimeout(i), i = void 0), r ? i = setTimeout(() => l.value = u, r) : l.value = u;
407
- };
408
- return a && (M(e, "mouseenter", () => s(!0), { passive: !0 }), M(e, "mouseleave", () => s(!1), { passive: !0 }), f && _e(
409
- _(() => E(e)),
410
- () => s(!1)
411
- )), l;
412
- }
413
- function Ve(e, t = { width: 0, height: 0 }, o = {}) {
414
- const { window: n = I, box: f = "content-box" } = o, a = _(() => {
415
- var c, v;
416
- return (v = (c = E(e)) == null ? void 0 : c.namespaceURI) == null ? void 0 : v.includes("svg");
417
- }), l = y(t.width), i = y(t.height), { stop: s } = ae(
417
+ function Je(e, t = { width: 0, height: 0 }, o = {}) {
418
+ const { window: n = A, box: u = "content-box" } = o, i = P(() => {
419
+ var l, c;
420
+ return (c = (l = S(e)) == null ? void 0 : l.namespaceURI) == null ? void 0 : c.includes("svg");
421
+ }), a = y(t.width), r = y(t.height), { stop: s } = ve(
418
422
  e,
419
- ([c]) => {
420
- const v = f === "border-box" ? c.borderBoxSize : f === "content-box" ? c.contentBoxSize : c.devicePixelContentBoxSize;
421
- if (n && a.value) {
422
- const m = E(e);
423
- if (m) {
424
- const h = m.getBoundingClientRect();
425
- l.value = h.width, i.value = h.height;
423
+ ([l]) => {
424
+ const c = u === "border-box" ? l.borderBoxSize : u === "content-box" ? l.contentBoxSize : l.devicePixelContentBoxSize;
425
+ if (n && i.value) {
426
+ const p = S(e);
427
+ if (p) {
428
+ const h = p.getBoundingClientRect();
429
+ a.value = h.width, r.value = h.height;
426
430
  }
427
- } else if (v) {
428
- const m = k(v);
429
- l.value = m.reduce((h, { inlineSize: S }) => h + S, 0), i.value = m.reduce((h, { blockSize: S }) => h + S, 0);
431
+ } else if (c) {
432
+ const p = C(c);
433
+ a.value = p.reduce((h, { inlineSize: O }) => h + O, 0), r.value = p.reduce((h, { blockSize: O }) => h + O, 0);
430
434
  } else
431
- l.value = c.contentRect.width, i.value = c.contentRect.height;
435
+ a.value = l.contentRect.width, r.value = l.contentRect.height;
432
436
  },
433
437
  o
434
438
  );
435
- z(() => {
436
- const c = E(e);
437
- c && (l.value = "offsetWidth" in c ? c.offsetWidth : t.width, i.value = "offsetHeight" in c ? c.offsetHeight : t.height);
439
+ N(() => {
440
+ const l = S(e);
441
+ l && (a.value = "offsetWidth" in l ? l.offsetWidth : t.width, r.value = "offsetHeight" in l ? l.offsetHeight : t.height);
438
442
  });
439
- const u = L(
440
- () => E(e),
441
- (c) => {
442
- l.value = c ? t.width : 0, i.value = c ? t.height : 0;
443
+ const d = k(
444
+ () => S(e),
445
+ (l) => {
446
+ a.value = l ? t.width : 0, r.value = l ? t.height : 0;
443
447
  }
444
448
  );
445
- function r() {
446
- s(), u();
449
+ function v() {
450
+ s(), d();
447
451
  }
448
452
  return {
449
- width: l,
450
- height: i,
451
- stop: r
453
+ width: a,
454
+ height: r,
455
+ stop: v
452
456
  };
453
457
  }
454
- const ne = 1;
455
- function ze(e, t = {}) {
458
+ const je = {
459
+ multiple: !0,
460
+ accept: "*",
461
+ reset: !1,
462
+ directory: !1
463
+ };
464
+ function $e(e) {
465
+ if (!e)
466
+ return null;
467
+ if (e instanceof FileList)
468
+ return e;
469
+ const t = new DataTransfer();
470
+ for (const o of e)
471
+ t.items.add(o);
472
+ return t.files;
473
+ }
474
+ function Ke(e = {}) {
475
+ const {
476
+ document: t = Ve
477
+ } = e, o = ue($e(e.initialFiles)), { on: n, trigger: u } = /* @__PURE__ */ ee(), { on: i, trigger: a } = /* @__PURE__ */ ee(), r = P(() => {
478
+ var l;
479
+ const c = (l = S(e.input)) != null ? l : t ? t.createElement("input") : void 0;
480
+ return c && (c.type = "file", c.onchange = (p) => {
481
+ const h = p.target;
482
+ o.value = h.files, u(o.value);
483
+ }, c.oncancel = () => {
484
+ a();
485
+ }), c;
486
+ }), s = () => {
487
+ o.value = null, r.value && r.value.value && (r.value.value = "", u(null));
488
+ }, d = (l) => {
489
+ const c = r.value;
490
+ c && (c.multiple = w(l.multiple), c.accept = w(l.accept), c.webkitdirectory = w(l.directory), Ie(l, "capture") && (c.capture = w(l.capture)));
491
+ }, v = (l) => {
492
+ const c = r.value;
493
+ if (!c)
494
+ return;
495
+ const p = {
496
+ ...je,
497
+ ...e,
498
+ ...l
499
+ };
500
+ d(p), w(p.reset) && s(), c.click();
501
+ };
502
+ return se(() => {
503
+ d(e);
504
+ }), {
505
+ files: Te(o),
506
+ open: v,
507
+ reset: s,
508
+ onCancel: i,
509
+ onChange: n
510
+ };
511
+ }
512
+ const oe = 1;
513
+ function Ze(e, t = {}) {
456
514
  const {
457
515
  throttle: o = 0,
458
516
  idle: n = 200,
459
- onStop: f = O,
460
- onScroll: a = O,
461
- offset: l = {
517
+ onStop: u = W,
518
+ onScroll: i = W,
519
+ offset: a = {
462
520
  left: 0,
463
521
  right: 0,
464
522
  top: 0,
465
523
  bottom: 0
466
524
  },
467
- observe: i = {
525
+ observe: r = {
468
526
  mutation: !1
469
527
  },
470
528
  eventListenerOptions: s = {
471
529
  capture: !1,
472
530
  passive: !0
473
531
  },
474
- behavior: u = "auto",
475
- window: r = I,
476
- onError: c = (w) => {
477
- console.error(w);
532
+ behavior: d = "auto",
533
+ window: v = A,
534
+ onError: l = (g) => {
535
+ console.error(g);
478
536
  }
479
- } = t, v = typeof i == "boolean" ? {
480
- mutation: i
481
- } : i, m = y(0), h = y(0), S = _({
537
+ } = t, c = typeof r == "boolean" ? {
538
+ mutation: r
539
+ } : r, p = y(0), h = y(0), O = P({
482
540
  get() {
483
- return m.value;
541
+ return p.value;
484
542
  },
485
- set(w) {
486
- p(w, void 0);
543
+ set(g) {
544
+ m(g, void 0);
487
545
  }
488
- }), d = _({
546
+ }), f = P({
489
547
  get() {
490
548
  return h.value;
491
549
  },
492
- set(w) {
493
- p(void 0, w);
550
+ set(g) {
551
+ m(void 0, g);
494
552
  }
495
553
  });
496
- function p(w, P) {
497
- var x, C, H, j;
498
- if (!r)
554
+ function m(g, _) {
555
+ var x, D, R, H;
556
+ if (!v)
499
557
  return;
500
- const R = g(e);
501
- if (!R)
558
+ const I = w(e);
559
+ if (!I)
502
560
  return;
503
- (H = R instanceof Document ? r.document.body : R) == null || H.scrollTo({
504
- top: (x = g(P)) != null ? x : d.value,
505
- left: (C = g(w)) != null ? C : S.value,
506
- behavior: g(u)
561
+ (R = I instanceof Document ? v.document.body : I) == null || R.scrollTo({
562
+ top: (x = w(_)) != null ? x : f.value,
563
+ left: (D = w(g)) != null ? D : O.value,
564
+ behavior: w(d)
507
565
  });
508
- const A = ((j = R == null ? void 0 : R.document) == null ? void 0 : j.documentElement) || (R == null ? void 0 : R.documentElement) || R;
509
- S != null && (m.value = A.scrollLeft), d != null && (h.value = A.scrollTop);
566
+ const F = ((H = I == null ? void 0 : I.document) == null ? void 0 : H.documentElement) || (I == null ? void 0 : I.documentElement) || I;
567
+ O != null && (p.value = F.scrollLeft), f != null && (h.value = F.scrollTop);
510
568
  }
511
569
  const b = y(!1), T = Z({
512
570
  left: !0,
513
571
  right: !1,
514
572
  top: !0,
515
573
  bottom: !1
516
- }), W = Z({
574
+ }), E = Z({
517
575
  left: !1,
518
576
  right: !1,
519
577
  top: !1,
520
578
  bottom: !1
521
- }), Q = (w) => {
522
- b.value && (b.value = !1, W.left = !1, W.right = !1, W.top = !1, W.bottom = !1, f(w));
523
- }, de = xe(Q, o + n), D = (w) => {
524
- var P;
525
- if (!r)
579
+ }), X = (g) => {
580
+ b.value && (b.value = !1, E.left = !1, E.right = !1, E.top = !1, E.bottom = !1, u(g));
581
+ }, he = /* @__PURE__ */ ke(X, o + n), V = (g) => {
582
+ var _;
583
+ if (!v)
526
584
  return;
527
- const x = ((P = w == null ? void 0 : w.document) == null ? void 0 : P.documentElement) || (w == null ? void 0 : w.documentElement) || E(w), { display: C, flexDirection: H, direction: j } = getComputedStyle(x), R = j === "rtl" ? -1 : 1, A = x.scrollLeft;
528
- W.left = A < m.value, W.right = A > m.value;
529
- const X = Math.abs(A * R) <= (l.left || 0), q = Math.abs(A * R) + x.clientWidth >= x.scrollWidth - (l.right || 0) - ne;
530
- C === "flex" && H === "row-reverse" ? (T.left = q, T.right = X) : (T.left = X, T.right = q), m.value = A;
531
- let F = x.scrollTop;
532
- w === r.document && !F && (F = r.document.body.scrollTop), W.top = F < h.value, W.bottom = F > h.value;
533
- const J = Math.abs(F) <= (l.top || 0), K = Math.abs(F) + x.clientHeight >= x.scrollHeight - (l.bottom || 0) - ne;
534
- C === "flex" && H === "column-reverse" ? (T.top = K, T.bottom = J) : (T.top = J, T.bottom = K), h.value = F;
535
- }, U = (w) => {
536
- var P;
537
- if (!r)
585
+ const x = ((_ = g == null ? void 0 : g.document) == null ? void 0 : _.documentElement) || (g == null ? void 0 : g.documentElement) || S(g), { display: D, flexDirection: R, direction: H } = getComputedStyle(x), I = H === "rtl" ? -1 : 1, F = x.scrollLeft;
586
+ E.left = F < p.value, E.right = F > p.value;
587
+ const U = Math.abs(F * I) <= (a.left || 0), q = Math.abs(F * I) + x.clientWidth >= x.scrollWidth - (a.right || 0) - oe;
588
+ D === "flex" && R === "row-reverse" ? (T.left = q, T.right = U) : (T.left = U, T.right = q), p.value = F;
589
+ let L = x.scrollTop;
590
+ g === v.document && !L && (L = v.document.body.scrollTop), E.top = L < h.value, E.bottom = L > h.value;
591
+ const J = Math.abs(L) <= (a.top || 0), K = Math.abs(L) + x.clientHeight >= x.scrollHeight - (a.bottom || 0) - oe;
592
+ D === "flex" && R === "column-reverse" ? (T.top = K, T.bottom = J) : (T.top = J, T.bottom = K), h.value = L;
593
+ }, Q = (g) => {
594
+ var _;
595
+ if (!v)
538
596
  return;
539
- const x = (P = w.target.documentElement) != null ? P : w.target;
540
- D(x), b.value = !0, de(w), a(w);
597
+ const x = (_ = g.target.documentElement) != null ? _ : g.target;
598
+ V(x), b.value = !0, he(g), i(g);
541
599
  };
542
600
  return M(
543
601
  e,
544
602
  "scroll",
545
- o ? Me(U, o, !0, !1) : U,
603
+ o ? /* @__PURE__ */ De(Q, o, !0, !1) : Q,
546
604
  s
547
- ), z(() => {
605
+ ), N(() => {
548
606
  try {
549
- const w = g(e);
550
- if (!w)
607
+ const g = w(e);
608
+ if (!g)
551
609
  return;
552
- D(w);
553
- } catch (w) {
554
- c(w);
610
+ V(g);
611
+ } catch (g) {
612
+ l(g);
555
613
  }
556
- }), v != null && v.mutation && e != null && e !== r && e !== document && Y(
614
+ }), c != null && c.mutation && e != null && e !== v && e !== document && de(
557
615
  e,
558
616
  () => {
559
- const w = g(e);
560
- w && D(w);
617
+ const g = w(e);
618
+ g && V(g);
561
619
  },
562
620
  {
563
621
  attributes: !0,
@@ -567,55 +625,86 @@ function ze(e, t = {}) {
567
625
  ), M(
568
626
  e,
569
627
  "scrollend",
570
- Q,
628
+ X,
571
629
  s
572
630
  ), {
573
- x: S,
574
- y: d,
631
+ x: O,
632
+ y: f,
575
633
  isScrolling: b,
576
634
  arrivedState: T,
577
- directions: W,
635
+ directions: E,
578
636
  measure() {
579
- const w = g(e);
580
- r && w && D(w);
637
+ const g = w(e);
638
+ v && g && V(g);
581
639
  }
582
640
  };
583
641
  }
584
- function Ne(e = {}) {
642
+ const pe = {
643
+ x: 0,
644
+ y: 0,
645
+ pointerId: 0,
646
+ pressure: 0,
647
+ tiltX: 0,
648
+ tiltY: 0,
649
+ width: 0,
650
+ height: 0,
651
+ twist: 0,
652
+ pointerType: null
653
+ }, Ye = /* @__PURE__ */ Object.keys(pe);
654
+ function et(e = {}) {
655
+ const {
656
+ target: t = A
657
+ } = e, o = y(!1), n = ue(e.initialValue || {});
658
+ Object.assign(n.value, pe, n.value);
659
+ const u = (i) => {
660
+ o.value = !0, !(e.pointerTypes && !e.pointerTypes.includes(i.pointerType)) && (n.value = _e(i, Ye, !1));
661
+ };
662
+ if (t) {
663
+ const i = { passive: !0 };
664
+ M(t, ["pointerdown", "pointermove", "pointerup"], u, i), M(t, "pointerleave", () => o.value = !1, i);
665
+ }
666
+ return {
667
+ ...Re(n),
668
+ isInside: o
669
+ };
670
+ }
671
+ // @__NO_SIDE_EFFECTS__
672
+ function tt(e = {}) {
585
673
  const {
586
- window: t = I,
674
+ window: t = A,
587
675
  initialWidth: o = Number.POSITIVE_INFINITY,
588
676
  initialHeight: n = Number.POSITIVE_INFINITY,
589
- listenOrientation: f = !0,
590
- includeScrollbar: a = !0,
591
- type: l = "inner"
592
- } = e, i = y(o), s = y(n), u = () => {
677
+ listenOrientation: u = !0,
678
+ includeScrollbar: i = !0,
679
+ type: a = "inner"
680
+ } = e, r = y(o), s = y(n), d = () => {
593
681
  if (t)
594
- if (l === "outer")
595
- i.value = t.outerWidth, s.value = t.outerHeight;
596
- else if (l === "visual" && t.visualViewport) {
597
- const { width: c, height: v, scale: m } = t.visualViewport;
598
- i.value = Math.round(c * m), s.value = Math.round(v * m);
599
- } else a ? (i.value = t.innerWidth, s.value = t.innerHeight) : (i.value = t.document.documentElement.clientWidth, s.value = t.document.documentElement.clientHeight);
682
+ if (a === "outer")
683
+ r.value = t.outerWidth, s.value = t.outerHeight;
684
+ else if (a === "visual" && t.visualViewport) {
685
+ const { width: l, height: c, scale: p } = t.visualViewport;
686
+ r.value = Math.round(l * p), s.value = Math.round(c * p);
687
+ } else i ? (r.value = t.innerWidth, s.value = t.innerHeight) : (r.value = t.document.documentElement.clientWidth, s.value = t.document.documentElement.clientHeight);
600
688
  };
601
- u(), z(u);
602
- const r = { passive: !0 };
603
- if (M("resize", u, r), t && l === "visual" && t.visualViewport && M(t.visualViewport, "resize", u, r), f) {
604
- const c = Fe("(orientation: portrait)");
605
- L(c, () => u());
689
+ d(), N(d);
690
+ const v = { passive: !0 };
691
+ if (M("resize", d, v), t && a === "visual" && t.visualViewport && M(t.visualViewport, "resize", d, v), u) {
692
+ const l = Be("(orientation: portrait)");
693
+ k(l, () => d());
606
694
  }
607
- return { width: i, height: s };
695
+ return { width: r, height: s };
608
696
  }
609
697
  export {
610
- je as a,
611
- Ne as b,
612
- Ve as c,
613
- E as d,
614
- M as e,
615
- De as f,
616
- Fe as g,
617
- He as h,
618
- ke as o,
619
- ze as u,
620
- Ce as w
698
+ qe as a,
699
+ S as b,
700
+ tt as c,
701
+ Ke as d,
702
+ Je as e,
703
+ Xe as f,
704
+ M as g,
705
+ Be as h,
706
+ et as i,
707
+ Ue as o,
708
+ Ze as u,
709
+ Qe as w
621
710
  };