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