vuesp-components 5.3.0 → 5.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,134 +1,134 @@
1
- import { ref as h, reactive as C, watch as P, computed as D, onMounted as Ee, onBeforeUnmount as Fe } from "vue";
2
- import { u as Be, b as _e, a as Ke } from "../useDialog-Buvn63AR.js";
3
- function Ue(o) {
4
- const { validationSchema: i, initialValues: v = {} } = o, F = typeof i == "function", b = h(
5
- F ? i(v) : i
6
- ), T = h(!0), R = (n) => {
7
- b.value = n;
8
- const r = Object.keys(n), f = Object.keys(c);
9
- r.forEach((s) => {
10
- s in c || (c[s] = v[s] ?? "", y[s] = [], m[s] = !1, g[s] = !1);
11
- }), f.forEach((s) => {
12
- r.includes(s) || (delete c[s], delete y[s], delete m[s], delete g[s]);
13
- }), $(), O();
14
- }, c = C({}), y = C({}), m = C({}), g = C({}), d = /* @__PURE__ */ new Map(), I = () => {
15
- Object.keys(b.value).forEach((n) => {
16
- c[n] = v[n] ?? "", y[n] = [], m[n] = !1, g[n] = !1;
17
- }), T.value = !0;
18
- }, E = () => F ? i(c) : b.value, M = (n, r) => {
19
- const s = E()[n] || [], u = [];
20
- for (const p of s) {
21
- const L = p(r, c);
22
- L !== !0 && u.push(L);
1
+ import { ref as f, reactive as _, watch as G, computed as O, onMounted as Me, onBeforeUnmount as Ce } from "vue";
2
+ import { u as Ge, b as Je, a as We } from "../useDialog-Buvn63AR.js";
3
+ function He(l) {
4
+ const { validationSchema: u, initialValues: v = {} } = l, w = typeof u == "function", E = f(
5
+ w ? u(v) : u
6
+ ), F = f(!0), D = (n) => {
7
+ E.value = n;
8
+ const s = Object.keys(n), c = Object.keys(o);
9
+ s.forEach((r) => {
10
+ r in o || (o[r] = v[r] ?? "", p[r] = [], x[r] = !1, g[r] = !1);
11
+ }), c.forEach((r) => {
12
+ s.includes(r) || (delete o[r], delete p[r], delete x[r], delete g[r]);
13
+ }), Q(), I();
14
+ }, o = _({}), p = _({}), x = _({}), g = _({}), d = /* @__PURE__ */ new Map(), C = () => {
15
+ Object.keys(E.value).forEach((n) => {
16
+ o[n] = v[n] ?? "", p[n] = [], x[n] = !1, g[n] = !1;
17
+ }), F.value = !0;
18
+ }, k = () => w ? u(o) : E.value, T = (n, s) => {
19
+ const r = k()[n] || [], h = [];
20
+ for (const m of r) {
21
+ const L = m(s, o);
22
+ L !== !0 && h.push(L);
23
23
  }
24
- return y[n] = u, u.length === 0;
25
- }, j = (n, r) => {
26
- const f = E();
27
- if (!f[n]) return;
28
- M(n, r);
29
- const s = d.get(n);
30
- s && s.forEach((u) => {
31
- f[u] && M(u, c[u]);
32
- }), O();
33
- }, $ = () => {
24
+ return p[n] = h, h.length === 0;
25
+ }, K = (n, s) => {
26
+ const c = k();
27
+ if (!c[n]) return;
28
+ T(n, s);
29
+ const r = d.get(n);
30
+ r && r.forEach((h) => {
31
+ c[h] && T(h, o[h]);
32
+ }), I();
33
+ }, Q = () => {
34
34
  d.clear();
35
- const n = E();
36
- Object.keys(n).forEach((r) => {
37
- (n[r] || []).forEach((s) => {
38
- if (typeof s == "function" && s.name === "sameAs") {
39
- const u = s.toString().match(/['"](.*?)['"]/);
40
- if (u) {
41
- const p = u[1];
42
- d.has(p) || d.set(p, /* @__PURE__ */ new Set()), d.get(p).add(r);
35
+ const n = k();
36
+ Object.keys(n).forEach((s) => {
37
+ (n[s] || []).forEach((r) => {
38
+ if (typeof r == "function" && r.name === "sameAs") {
39
+ const h = r.toString().match(/['"](.*?)['"]/);
40
+ if (h) {
41
+ const m = h[1];
42
+ d.has(m) || d.set(m, /* @__PURE__ */ new Set()), d.get(m).add(s);
43
43
  }
44
44
  }
45
45
  });
46
46
  });
47
- }, O = () => {
48
- const n = E();
49
- let r = !0;
50
- return Object.keys(n).forEach((f) => {
51
- M(f, c[f]) || (r = !1);
52
- }), T.value = r, r;
53
- }, k = (n, r = {}) => {
54
- E()[n] || console.warn(`Field "${n}" not found in current validationSchema`);
55
- const s = D({
56
- get: () => c[n],
57
- set: (p) => {
58
- c[n] = p, g[n] = !0, j(n, p);
47
+ }, I = () => {
48
+ const n = k();
49
+ let s = !0;
50
+ return Object.keys(n).forEach((c) => {
51
+ T(c, o[c]) || (s = !1);
52
+ }), F.value = s, s;
53
+ }, j = (n, s = {}) => {
54
+ k()[n] || console.warn(`Field "${n}" not found in current validationSchema`);
55
+ const r = O({
56
+ get: () => o[n],
57
+ set: (m) => {
58
+ o[n] = m, g[n] = !0, K(n, m);
59
59
  }
60
- }), u = D(() => {
61
- var A;
62
- const p = {
63
- errors: y[n] || [],
64
- touched: m[n] || !1,
60
+ }), h = O(() => {
61
+ var M;
62
+ const m = {
63
+ errors: p[n] || [],
64
+ touched: x[n] || !1,
65
65
  dirty: g[n] || !1
66
66
  }, L = {
67
- message: (A = y[n]) == null ? void 0 : A[0],
68
- onInput: (w) => {
69
- const B = w.target;
70
- s.value = B.value;
67
+ message: (M = p[n]) == null ? void 0 : M[0],
68
+ onInput: (A) => {
69
+ const $ = A.target;
70
+ r.value = $.value;
71
71
  },
72
72
  onBlur: () => {
73
- m[n] = !0, j(n, c[n]);
73
+ x[n] = !0, K(n, o[n]);
74
74
  }
75
75
  };
76
- if (r.props) {
77
- const w = r.props(p);
78
- return { ...L, ...w };
76
+ if (s.props) {
77
+ const A = s.props(m);
78
+ return { ...L, ...A };
79
79
  }
80
80
  return L;
81
81
  });
82
- return [s, u];
83
- }, U = (n) => async (r) => {
84
- r && r.preventDefault();
85
- const f = E();
86
- Object.keys(f).forEach((u) => {
87
- m[u] = !0;
88
- }), O() && await n(c);
89
- }, K = () => {
90
- const n = E();
91
- Object.keys(n).forEach((r) => {
92
- c[r] = v[r] || "", y[r] = [], m[r] = !1, g[r] = !1;
93
- }), T.value = !0;
82
+ return [r, h];
83
+ }, U = (n) => async (s) => {
84
+ s && s.preventDefault();
85
+ const c = k();
86
+ Object.keys(c).forEach((h) => {
87
+ x[h] = !0;
88
+ }), I() && await n(o);
89
+ }, S = () => {
90
+ const n = k();
91
+ Object.keys(n).forEach((s) => {
92
+ o[s] = v[s] || "", p[s] = [], x[s] = !1, g[s] = !1;
93
+ }), F.value = !0;
94
94
  };
95
- return I(), $(), F && P(
96
- () => c,
95
+ return C(), Q(), w && G(
96
+ () => o,
97
97
  () => {
98
- const n = i(c), r = b.value, f = Object.keys(n), s = Object.keys(r);
99
- (f.length !== s.length || f.some((u) => !s.includes(u))) && R(n);
98
+ const n = u(o), s = E.value, c = Object.keys(n), r = Object.keys(s);
99
+ (c.length !== r.length || c.some((h) => !r.includes(h))) && D(n);
100
100
  },
101
101
  { deep: !0 }
102
102
  ), {
103
- values: c,
104
- errors: y,
105
- defineField: k,
103
+ values: o,
104
+ errors: p,
105
+ defineField: j,
106
106
  handleSubmit: U,
107
- resetForm: K,
108
- validate: O,
109
- updateSchema: R,
110
- isValid: T
107
+ resetForm: S,
108
+ validate: I,
109
+ updateSchema: D,
110
+ isValid: F
111
111
  };
112
112
  }
113
- const Le = 150, Te = 4096, se = 256 * 1024, ce = 12, Oe = 1200, Ae = { utf8: "utf-8", cp1251: "windows-1251" }, De = {
113
+ const je = 150, $e = 4096, fe = 256 * 1024, he = 12, Be = 1200, _e = { utf8: "utf-8", cp1251: "windows-1251" }, Ke = {
114
114
  encoding: "utf8",
115
115
  framing: "line",
116
116
  gapMs: 25,
117
117
  paused: !1
118
- }, Re = (o, i) => (
118
+ }, Qe = (l, u) => (
119
119
  // eslint-disable-next-line no-control-regex
120
- new TextDecoder(Ae[i]).decode(o).replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f]/g, ".")
121
- ), Ie = (o) => Array.from(o, (i) => i.toString(16).padStart(2, "0")).join(" ");
122
- function Ce(o) {
123
- var re, ae;
124
- const i = h([]), v = C({ ...De }), F = h(0), b = h(0), T = h(0), R = h(0), c = h(""), y = h(!1), m = h(((re = o.initialLineEnding) == null ? void 0 : re.call(o)) ?? "crlf"), g = h([]), d = h(-1), I = h(""), E = h(!1), M = h(!0), j = h(!0), $ = h(!0), O = h(!1), k = h([]), U = h("");
125
- let K = 0, n = [], r = [], f = null, s = null, u = null, p = 0, L = 0, A = 0, w = null;
126
- const B = (e) => {
120
+ new TextDecoder(_e[u]).decode(l).replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f]/g, ".")
121
+ ), Ve = (l) => Array.from(l, (u) => u.toString(16).padStart(2, "0")).join(" ");
122
+ function Pe(l) {
123
+ var ue, ie;
124
+ const u = f([]), v = _({ ...Ke }), w = f(0), E = f(0), F = f(0), D = f(0), o = f(""), p = f(!1), x = f(((ue = l.initialLineEnding) == null ? void 0 : ue.call(l)) ?? "crlf"), g = f([]), d = f(-1), C = f(""), k = f("text"), T = f(null), K = f(!0), Q = f(!0), I = f(!0), j = f(!1), U = f(!1), S = f([]), n = f("");
125
+ let s = 0, c = [], r = [], h = null, m = null, L = null, M = "", A = null, $ = 0, H = 0, V = 0, R = null;
126
+ const J = (e) => {
127
127
  var a;
128
- const t = (a = o.storageKey) == null ? void 0 : a.call(o);
128
+ const t = (a = l.storageKey) == null ? void 0 : a.call(l);
129
129
  return t ? `${t}:${e}` : null;
130
- }, X = (e) => {
131
- const t = B(e);
130
+ }, W = (e) => {
131
+ const t = J(e);
132
132
  if (!t || typeof localStorage > "u") return null;
133
133
  try {
134
134
  const a = localStorage.getItem(t);
@@ -136,198 +136,221 @@ function Ce(o) {
136
136
  } catch {
137
137
  return null;
138
138
  }
139
- }, V = (e, t) => {
140
- const a = B(e);
139
+ }, P = (e, t) => {
140
+ const a = J(e);
141
141
  if (!(!a || typeof localStorage > "u"))
142
142
  try {
143
143
  localStorage.setItem(a, JSON.stringify(t));
144
144
  } catch {
145
145
  }
146
- }, z = X("view");
147
- z && Object.assign(v, z, { paused: !1 }), v.paused = !1;
148
- const le = X("quick"), oe = ((ae = o.initialQuickCommands) == null ? void 0 : ae.call(o)) ?? [];
149
- k.value = (le ?? oe).filter((e) => typeof e == "string").slice(0, ce), P(v, () => V("view", { ...v, paused: !1 }), { deep: !0 });
150
- const q = (e, t) => {
151
- const a = Re(t, v.encoding);
152
- i.value.push({
153
- id: ++K,
146
+ }, Y = W("view");
147
+ Y && Object.assign(v, Y, { paused: !1 }), v.paused = !1;
148
+ const de = W("quick"), ve = ((ie = l.initialQuickCommands) == null ? void 0 : ie.call(l)) ?? [];
149
+ S.value = (de ?? ve).filter((e) => typeof e == "string").slice(0, he), G(v, () => P("view", { ...v, paused: !1 }), { deep: !0 });
150
+ const X = (e, t) => {
151
+ const a = Qe(t, v.encoding);
152
+ u.value.push({
153
+ id: ++s,
154
154
  dir: e,
155
- at: (/* @__PURE__ */ new Date()).toLocaleTimeString(o.locale() === "ru" ? "ru-RU" : "en-GB", { hour12: !1 }),
155
+ at: (/* @__PURE__ */ new Date()).toLocaleTimeString(l.locale() === "ru" ? "ru-RU" : "en-GB", { hour12: !1 }),
156
156
  text: v.framing === "gap" ? a.replace(/[\r\n]+/g, " ") : a,
157
- hex: Ie(t),
158
- bytes: t.length
157
+ hex: Ve(t),
158
+ bytes: t.length,
159
+ // Keep a bounded copy for the binary view and byte inspector.
160
+ data: Array.from(t.slice(0, 1024))
159
161
  });
160
- const l = o.maxLines();
161
- i.value.length > l && i.value.splice(0, i.value.length - l);
162
- }, _ = () => {
163
- f && (clearTimeout(f), f = null);
164
- }, G = () => {
165
- if (_(), !n.length) return;
166
- const e = new Uint8Array(n);
167
- n = [], q("rx", e);
168
- }, ue = () => {
169
- _();
170
- const e = v.framing === "gap" ? Math.max(5, v.gapMs) : Le;
171
- f = setTimeout(G, e);
172
- }, J = (e) => {
173
- for (const t of e) n.push(t);
162
+ const i = l.maxLines();
163
+ u.value.length > i && u.value.splice(0, u.value.length - i);
164
+ }, q = () => {
165
+ h && (clearTimeout(h), h = null);
166
+ }, Z = () => {
167
+ if (q(), !c.length) return;
168
+ const e = new Uint8Array(c);
169
+ c = [], X("rx", e);
170
+ }, ge = () => {
171
+ q();
172
+ const e = v.framing === "gap" ? Math.max(5, v.gapMs) : je;
173
+ h = setTimeout(Z, e);
174
+ }, N = (e) => {
175
+ for (const t of e) c.push(t);
174
176
  if (v.framing === "line") {
175
177
  let t = 0;
176
- for (let a = 0; a < n.length; a++) {
177
- const l = n[a];
178
- if (l !== 10 && l !== 13) continue;
179
- const x = n.slice(t, a);
180
- x.length && q("rx", new Uint8Array(x)), l === 13 && n[a + 1] === 10 && a++, t = a + 1;
178
+ for (let a = 0; a < c.length; a++) {
179
+ const i = c[a];
180
+ if (i !== 10 && i !== 13) continue;
181
+ const y = c.slice(t, a);
182
+ y.length && X("rx", new Uint8Array(y)), i === 13 && c[a + 1] === 10 && a++, t = a + 1;
181
183
  }
182
- t && (n = n.slice(t));
184
+ t && (c = c.slice(t));
183
185
  }
184
- n.length >= Te ? G() : ue();
185
- }, ie = (e) => {
186
+ c.length >= $e ? Z() : ge();
187
+ }, B = () => {
188
+ L && clearTimeout(L), L = null, U.value = !1;
189
+ }, ye = (e) => {
190
+ var a;
191
+ const t = (a = l.noReplyHint) == null ? void 0 : a.call(l);
192
+ t && (B(), L = setTimeout(() => {
193
+ w.value === e && (U.value = !0);
194
+ }, t.delay ?? 1500));
195
+ }, me = (e) => {
186
196
  if (e != null && e.length) {
187
- if (F.value += e.length, v.paused) {
197
+ if (U.value && B(), w.value += e.length, v.paused) {
188
198
  for (const t of e) r.push(t);
189
- r.length > se && r.splice(0, r.length - se);
199
+ r.length > fe && r.splice(0, r.length - fe);
190
200
  return;
191
201
  }
192
- J(e);
202
+ N(e);
193
203
  }
194
- }, fe = () => {
195
- w == null || w(), w = o.transport().subscribe(ie);
204
+ }, pe = () => {
205
+ R == null || R(), R = l.transport().subscribe(me);
196
206
  };
197
- P(
207
+ G(
198
208
  () => v.paused,
199
209
  (e) => {
200
210
  if (e || !r.length) return;
201
211
  const t = new Uint8Array(r);
202
- r = [], J(t);
212
+ r = [], N(t);
203
213
  }
204
214
  );
205
- const W = async (e) => {
206
- const t = await o.transport().send(e);
207
- return t && (b.value += e.length, q("tx", e)), t;
208
- }, Q = D(() => c.value.replace(/^0x/i, "").replace(/0x/gi, "").replace(/[^0-9a-fA-F]/g, "")), he = D(() => {
209
- const e = c.value.replace(/0x/gi, "").replace(/[\s,;:]/g, "");
215
+ const ee = async (e) => {
216
+ const t = await l.transport().send(e);
217
+ return t && (E.value += e.length, X("tx", e)), t;
218
+ }, z = O(() => o.value.replace(/^0x/i, "").replace(/0x/gi, "").replace(/[^0-9a-fA-F]/g, "")), xe = O(() => {
219
+ const e = o.value.replace(/0x/gi, "").replace(/[\s,;:]/g, "");
210
220
  return e.length > 0 && /[^0-9a-fA-F]/.test(e);
211
- }), H = D(() => {
212
- const e = Q.value, t = [];
221
+ }), te = O(() => {
222
+ const e = z.value, t = [];
213
223
  for (let a = 0; a + 1 < e.length; a += 2) t.push(parseInt(e.slice(a, a + 2), 16));
214
224
  return t;
215
- }), Y = D(() => y.value ? he.value ? o.labels().hexInvalid : Q.value && Q.value.length % 2 ? o.labels().hexOdd : "" : ""), Z = (e, t) => {
225
+ }), ne = O(() => p.value ? xe.value ? l.labels().hexInvalid : z.value && z.value.length % 2 ? l.labels().hexOdd : "" : ""), ae = (e, t) => {
216
226
  if (t) {
217
- const l = e.replace(/0x/gi, "").replace(/[^0-9a-fA-F]/g, "");
218
- if (!l.length || l.length % 2) return [];
219
- const x = [];
220
- for (let S = 0; S + 1 < l.length; S += 2) x.push(parseInt(l.slice(S, S + 2), 16));
221
- return x;
227
+ const i = e.replace(/0x/gi, "").replace(/[^0-9a-fA-F]/g, "");
228
+ if (!i.length || i.length % 2) return [];
229
+ const y = [];
230
+ for (let b = 0; b + 1 < i.length; b += 2) y.push(parseInt(i.slice(b, b + 2), 16));
231
+ return y;
222
232
  }
223
233
  const a = Array.from(new TextEncoder().encode(e));
224
- return (m.value === "cr" || m.value === "crlf") && a.push(13), (m.value === "lf" || m.value === "crlf") && a.push(10), a;
225
- }, de = async () => {
226
- if (y.value && (Y.value || !H.value.length)) return;
227
- const e = c.value, t = Z(e, y.value);
228
- !t.length || !await W(new Uint8Array(t.slice(0, 4096))) || (e.trim() && (g.value = [e, ...g.value.filter((l) => l !== e)].slice(0, 50), d.value = -1), c.value = "");
229
- }, ve = async (e) => {
230
- const t = Z(e, !1);
231
- !t.length || !await W(new Uint8Array(t.slice(0, 4096))) || (g.value = [e, ...g.value.filter((l) => l !== e)].slice(0, 50), d.value = -1);
232
- }, ge = (e) => {
234
+ return (x.value === "cr" || x.value === "crlf") && a.push(13), (x.value === "lf" || x.value === "crlf") && a.push(10), a;
235
+ }, we = async () => {
236
+ if (p.value && (ne.value || !te.value.length)) return;
237
+ const e = o.value, t = ae(e, p.value);
238
+ !t.length || !await ee(new Uint8Array(t.slice(0, 4096))) || (e.trim() && (g.value = [e, ...g.value.filter((i) => i !== e)].slice(0, 50), d.value = -1), o.value = "");
239
+ }, re = async (e) => {
240
+ const t = ae(e, !1);
241
+ if (!t.length) return;
242
+ const a = w.value;
243
+ await ee(new Uint8Array(t.slice(0, 4096))) && (g.value = [e, ...g.value.filter((y) => y !== e)].slice(0, 50), d.value = -1, M = e, ye(a));
244
+ }, ke = async () => {
245
+ var t;
246
+ const e = (t = l.noReplyHint) == null ? void 0 : t.call(l);
247
+ e != null && e.onAction && (B(), await e.onAction(), (e.resend ?? !0) && M && await re(M));
248
+ }, Se = (e) => {
233
249
  if (e.key === "ArrowUp") {
234
250
  if (!g.value.length) return;
235
- e.preventDefault(), d.value = d.value === -1 ? g.value.length - 1 : Math.max(0, d.value - 1), c.value = g.value[d.value] ?? "";
251
+ e.preventDefault(), d.value = d.value === -1 ? g.value.length - 1 : Math.max(0, d.value - 1), o.value = g.value[d.value] ?? "";
236
252
  return;
237
253
  }
238
254
  if (e.key === "ArrowDown") {
239
255
  if (d.value === -1) return;
240
- e.preventDefault(), d.value++, d.value >= g.value.length ? (d.value = -1, c.value = "") : c.value = g.value[d.value] ?? "";
256
+ e.preventDefault(), d.value++, d.value >= g.value.length ? (d.value = -1, o.value = "") : o.value = g.value[d.value] ?? "";
241
257
  return;
242
258
  }
243
- e.key === "Escape" && (c.value = "", d.value = -1);
244
- }, pe = D(() => {
245
- const e = I.value.trim().toLowerCase();
246
- return e ? i.value.filter((t) => t.text.toLowerCase().includes(e) || t.hex.toLowerCase().includes(e)) : i.value;
247
- }), ye = (e) => E.value ? e.hex : e.text || e.hex, me = (e) => {
248
- const t = I.value.trim().toLowerCase();
259
+ e.key === "Escape" && (o.value = "", d.value = -1);
260
+ }, be = O(() => {
261
+ const e = C.value.trim().toLowerCase();
262
+ return e ? u.value.filter((t) => t.text.toLowerCase().includes(e) || t.hex.toLowerCase().includes(e)) : u.value;
263
+ }), Ee = (e) => (e.data ?? []).map((t) => t.toString(2).padStart(8, "0")).join(" "), Le = (e) => k.value === "hex" ? e.hex : k.value === "bin" ? Ee(e) : e.text || e.hex, Te = O(() => u.value.find((e) => e.id === T.value) ?? null), Ae = (e) => {
264
+ T.value = T.value === e.id ? null : e.id;
265
+ }, Fe = (e) => {
266
+ const t = C.value.trim().toLowerCase();
249
267
  if (!t) return [{ text: e, match: !1 }];
250
- const a = e.toLowerCase(), l = [];
251
- let x = 0;
252
- for (; x < e.length; ) {
253
- const S = a.indexOf(t, x);
254
- if (S === -1) break;
255
- S > x && l.push({ text: e.slice(x, S), match: !1 }), l.push({ text: e.slice(S, S + t.length), match: !0 }), x = S + t.length;
268
+ const a = e.toLowerCase(), i = [];
269
+ let y = 0;
270
+ for (; y < e.length; ) {
271
+ const b = a.indexOf(t, y);
272
+ if (b === -1) break;
273
+ b > y && i.push({ text: e.slice(y, b), match: !1 }), i.push({ text: e.slice(b, b + t.length), match: !0 }), y = b + t.length;
256
274
  }
257
- return x < e.length && l.push({ text: e.slice(x), match: !1 }), l.length ? l : [{ text: e, match: !1 }];
258
- }, N = () => i.value.map((e) => `${e.at} ${e.dir.toUpperCase()} ${e.text || e.hex}`).join(`
259
- `), ee = async () => {
260
- if (!i.value.length) return !1;
275
+ return y < e.length && i.push({ text: e.slice(y), match: !1 }), i.length ? i : [{ text: e, match: !1 }];
276
+ }, se = () => u.value.map((e) => `${e.at} ${e.dir.toUpperCase()} ${e.text || e.hex}`).join(`
277
+ `), le = async () => {
278
+ if (!u.value.length) return !1;
261
279
  try {
262
- return await navigator.clipboard.writeText(N()), O.value = !0, u && clearTimeout(u), u = setTimeout(() => {
263
- O.value = !1;
264
- }, Oe), !0;
280
+ return await navigator.clipboard.writeText(se()), j.value = !0, A && clearTimeout(A), A = setTimeout(() => {
281
+ j.value = !1;
282
+ }, Be), !0;
265
283
  } catch {
266
284
  return !1;
267
285
  }
268
- }, xe = () => {
269
- if (!i.value.length) return !1;
270
- const e = new Blob([N()], { type: "text/plain;charset=utf-8" }), t = URL.createObjectURL(e), a = document.createElement("a"), l = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
271
- return a.href = t, a.download = `serial-${l}.log`, a.click(), URL.revokeObjectURL(t), !0;
272
- }, te = () => {
273
- _(), n = [], r = [], i.value = [], F.value = 0, b.value = 0, T.value = 0, R.value = 0, p = 0, L = 0, A = performance.now();
274
- }, we = (e) => {
275
- const t = o.labels();
286
+ }, Re = () => {
287
+ if (!u.value.length) return !1;
288
+ const e = new Blob([se()], { type: "text/plain;charset=utf-8" }), t = URL.createObjectURL(e), a = document.createElement("a"), i = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
289
+ return a.href = t, a.download = `serial-${i}.log`, a.click(), URL.revokeObjectURL(t), !0;
290
+ }, ce = () => {
291
+ B(), q(), c = [], r = [], u.value = [], T.value = null, w.value = 0, E.value = 0, F.value = 0, D.value = 0, $ = 0, H = 0, V = performance.now();
292
+ }, Oe = (e) => {
293
+ const t = l.labels();
276
294
  return e < 1024 ? `${e} ${t.byteShort}` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} ${t.kiloShort}` : `${(e / (1024 * 1024)).toFixed(2)} ${t.megaShort}`;
277
- }, ke = () => {
278
- const e = performance.now(), t = (e - A) / 1e3;
279
- t <= 0 || (T.value = Math.max(0, Math.round((F.value - p) / t)), R.value = Math.max(0, Math.round((b.value - L) / t)), p = F.value, L = b.value, A = e);
280
- }, Se = () => {
281
- const e = U.value.trim();
282
- e && (k.value.includes(e) || (k.value = [...k.value, e].slice(0, ce)), U.value = "", V("quick", k.value));
283
- }, be = (e) => {
284
- k.value = k.value.filter((t) => t !== e), V("quick", k.value);
285
- }, ne = (e) => {
286
- e.ctrlKey && (e.key.toLowerCase() === "l" && (e.preventDefault(), te()), e.shiftKey && e.key.toLowerCase() === "c" && (e.preventDefault(), ee()));
295
+ }, De = () => {
296
+ const e = performance.now(), t = (e - V) / 1e3;
297
+ t <= 0 || (F.value = Math.max(0, Math.round((w.value - $) / t)), D.value = Math.max(0, Math.round((E.value - H) / t)), $ = w.value, H = E.value, V = e);
298
+ }, Ie = () => {
299
+ const e = n.value.trim();
300
+ e && (S.value.includes(e) || (S.value = [...S.value, e].slice(0, he)), n.value = "", P("quick", S.value));
301
+ }, Ue = (e) => {
302
+ S.value = S.value.filter((t) => t !== e), P("quick", S.value);
303
+ }, oe = (e) => {
304
+ e.ctrlKey && (e.key.toLowerCase() === "l" && (e.preventDefault(), ce()), e.shiftKey && e.key.toLowerCase() === "c" && (e.preventDefault(), le()));
287
305
  };
288
- return Ee(() => {
289
- fe(), A = performance.now(), s = setInterval(ke, 1e3), window.addEventListener("keydown", ne);
290
- }), Fe(() => {
291
- w == null || w(), w = null, _(), s && clearInterval(s), u && clearTimeout(u), window.removeEventListener("keydown", ne);
306
+ return Me(() => {
307
+ pe(), V = performance.now(), m = setInterval(De, 1e3), window.addEventListener("keydown", oe);
308
+ }), Ce(() => {
309
+ R == null || R(), R = null, B(), q(), m && clearInterval(m), A && clearTimeout(A), window.removeEventListener("keydown", oe);
292
310
  }), {
293
- lines: i,
294
- visibleLines: pe,
311
+ lines: u,
312
+ visibleLines: be,
295
313
  view: v,
296
- rxBytes: F,
297
- txBytes: b,
298
- rxRate: T,
299
- txRate: R,
300
- input: c,
301
- hexSend: y,
302
- lineEnding: m,
314
+ rxBytes: w,
315
+ txBytes: E,
316
+ rxRate: F,
317
+ txRate: D,
318
+ input: o,
319
+ hexSend: p,
320
+ lineEnding: x,
303
321
  history: g,
304
- filter: I,
305
- hexMode: E,
306
- showTime: M,
307
- wrapLines: j,
308
- autoScroll: $,
309
- copied: O,
310
- quickCommands: k,
311
- quickInput: U,
312
- hexBytes: H,
313
- hexError: Y,
314
- sendText: de,
315
- sendQuick: ve,
316
- onInputKeydown: ge,
317
- lineContent: ye,
318
- lineSegments: me,
319
- copyLog: ee,
320
- downloadLog: xe,
321
- clearLog: te,
322
- formatBytes: we,
323
- addQuick: Se,
324
- removeQuick: be
322
+ filter: C,
323
+ mode: k,
324
+ selectedId: T,
325
+ selectedLine: Te,
326
+ selectLine: Ae,
327
+ showTime: K,
328
+ wrapLines: Q,
329
+ autoScroll: I,
330
+ copied: j,
331
+ showNoReply: U,
332
+ quickCommands: S,
333
+ quickInput: n,
334
+ hexBytes: te,
335
+ hexError: ne,
336
+ sendText: we,
337
+ sendQuick: re,
338
+ onInputKeydown: Se,
339
+ lineContent: Le,
340
+ lineSegments: Fe,
341
+ copyLog: le,
342
+ downloadLog: Re,
343
+ clearLog: ce,
344
+ formatBytes: Oe,
345
+ addQuick: Ie,
346
+ removeQuick: Ue,
347
+ applyHintAction: ke
325
348
  };
326
349
  }
327
350
  export {
328
- Be as useDialog,
329
- _e as useFocusTrap,
330
- Ue as useForm,
331
- Ce as useSerialConsole,
332
- Ke as useSwipeDown
351
+ Ge as useDialog,
352
+ Je as useFocusTrap,
353
+ He as useForm,
354
+ Pe as useSerialConsole,
355
+ We as useSwipeDown
333
356
  };