@kvaser/canking-api
Version:
CanKing API to communicate with the CanKing service using Node.js.
1,742 lines (1,741 loc) • 83.1 kB
JavaScript
import { u as ne, a as hn, b as bn, r as pn, c as le, d as qe, e as He } from "./index.mjs";
import { C as ea, D as na, L as ta, g as ra, f as aa, M as ia, O as sa, R as la, U as da, W as oa } from "./index.mjs";
import { jsx as s, jsxs as T, Fragment as ce } from "react/jsx-runtime";
import * as be from "react";
import we, { useCallback as w, useRef as Ke, useState as U, useEffect as z, useMemo as O, Fragment as Sn } from "react";
import { FormControlLabel as Qe, Checkbox as xn, Box as xe, styled as V, Button as Nn, IconButton as Xe, Popover as vn, MenuItem as We, FormControl as Ye, Stack as Je, TextField as Ze, InputAdornment as Ee, Radio as Cn, RadioGroup as In, Divider as $n, Tooltip as Se, InputLabel as Mn, Select as Fn, FormHelperText as Ln, ListSubheader as wn, Dialog as Ve, DialogTitle as Ge, DialogContent as en, DialogActions as Re, Autocomplete as Rn, TableContainer as Wn, Table as An, TableHead as _n, TableRow as Be, TableCell as Fe, TableBody as kn, Toolbar as En, Typography as nn, ToggleButtonGroup as Bn, toggleButtonGroupClasses as Ue, ButtonGroup as Un, buttonGroupClasses as Ce, Paper as yn, ToggleButton as On, Menu as Pn, ListItemIcon as jn, ListItemText as ye } from "@mui/material";
import { LineArrowDownIcon as tn, LineArrowUpIcon as Dn, CloseIcon as zn } from "./icons.mjs";
import { v4 as Tn } from "uuid";
import { SimpleTreeView as rn, TreeItem as pe } from "@mui/x-tree-view";
import { getFrameDefinitions as qn } from "./ipc.mjs";
import ge from "fast-deep-equal";
import "long";
import { C as ee, W as an } from "./measurement_settings.mjs";
function sn({
id: e = void 0,
label: n,
checked: t,
onChange: r,
disabled: a = !1,
size: l = "small",
sx: u = void 0
}) {
const d = w((i) => {
if (i.key === "Enter" && !i.ctrlKey && !i.altKey && !i.shiftKey) {
i.preventDefault();
return;
}
}, []);
return /* @__PURE__ */ s(
Qe,
{
id: e,
"aria-label": e,
disabled: a,
"aria-disabled": a,
control: /* @__PURE__ */ s(xn, { size: l, checked: t, onChange: (i, o) => r(o), onKeyDown: d }),
label: n,
slotProps: { typography: { noWrap: !0 } },
sx: u
}
);
}
var Ie = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function ln(e) {
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
function Hn(e) {
var n = typeof e;
return e != null && (n == "object" || n == "function");
}
var Ae = Hn, Kn = typeof Ie == "object" && Ie && Ie.Object === Object && Ie, Qn = Kn, Xn = Qn, Yn = typeof self == "object" && self && self.Object === Object && self, Jn = Xn || Yn || Function("return this")(), dn = Jn, Zn = dn, Vn = function() {
return Zn.Date.now();
}, Gn = Vn, et = /\s/;
function nt(e) {
for (var n = e.length; n-- && et.test(e.charAt(n)); )
;
return n;
}
var tt = nt, rt = tt, at = /^\s+/;
function it(e) {
return e && e.slice(0, rt(e) + 1).replace(at, "");
}
var st = it, lt = dn, dt = lt.Symbol, on = dt, Oe = on, un = Object.prototype, ot = un.hasOwnProperty, ut = un.toString, he = Oe ? Oe.toStringTag : void 0;
function ct(e) {
var n = ot.call(e, he), t = e[he];
try {
e[he] = void 0;
var r = !0;
} catch {
}
var a = ut.call(e);
return r && (n ? e[he] = t : delete e[he]), a;
}
var ft = ct, gt = Object.prototype, mt = gt.toString;
function ht(e) {
return mt.call(e);
}
var bt = ht, Pe = on, pt = ft, St = bt, xt = "[object Null]", Nt = "[object Undefined]", je = Pe ? Pe.toStringTag : void 0;
function vt(e) {
return e == null ? e === void 0 ? Nt : xt : je && je in Object(e) ? pt(e) : St(e);
}
var Ct = vt;
function It(e) {
return e != null && typeof e == "object";
}
var $t = It, Mt = Ct, Ft = $t, Lt = "[object Symbol]";
function wt(e) {
return typeof e == "symbol" || Ft(e) && Mt(e) == Lt;
}
var Rt = wt, Wt = st, De = Ae, At = Rt, ze = NaN, _t = /^[-+]0x[0-9a-f]+$/i, kt = /^0b[01]+$/i, Et = /^0o[0-7]+$/i, Bt = parseInt;
function Ut(e) {
if (typeof e == "number")
return e;
if (At(e))
return ze;
if (De(e)) {
var n = typeof e.valueOf == "function" ? e.valueOf() : e;
e = De(n) ? n + "" : n;
}
if (typeof e != "string")
return e === 0 ? e : +e;
e = Wt(e);
var t = kt.test(e);
return t || Et.test(e) ? Bt(e.slice(2), t ? 2 : 8) : _t.test(e) ? ze : +e;
}
var yt = Ut, Ot = Ae, Le = Gn, Te = yt, Pt = "Expected a function", jt = Math.max, Dt = Math.min;
function zt(e, n, t) {
var r, a, l, u, d, i, o = 0, g = !1, c = !1, I = !0;
if (typeof e != "function")
throw new TypeError(Pt);
n = Te(n) || 0, Ot(t) && (g = !!t.leading, c = "maxWait" in t, l = c ? jt(Te(t.maxWait) || 0, n) : l, I = "trailing" in t ? !!t.trailing : I);
function N(M) {
var b = r, $ = a;
return r = a = void 0, o = M, u = e.apply($, b), u;
}
function m(M) {
return o = M, d = setTimeout(F, n), g ? N(M) : u;
}
function f(M) {
var b = M - i, $ = M - o, R = n - b;
return c ? Dt(R, l - $) : R;
}
function h(M) {
var b = M - i, $ = M - o;
return i === void 0 || b >= n || b < 0 || c && $ >= l;
}
function F() {
var M = Le();
if (h(M))
return p(M);
d = setTimeout(F, f(M));
}
function p(M) {
return d = void 0, I && r ? N(M) : (r = a = void 0, u);
}
function L() {
d !== void 0 && clearTimeout(d), o = 0, r = i = a = d = void 0;
}
function S() {
return d === void 0 ? u : p(Le());
}
function v() {
var M = Le(), b = h(M);
if (r = arguments, a = this, i = M, b) {
if (d === void 0)
return m(i);
if (c)
return clearTimeout(d), d = setTimeout(F, n), N(i);
}
return d === void 0 && (d = setTimeout(F, n)), u;
}
return v.cancel = L, v.flush = S, v;
}
var cn = zt;
const Tt = /* @__PURE__ */ ln(cn);
var qt = cn, Ht = Ae, Kt = "Expected a function";
function Qt(e, n, t) {
var r = !0, a = !0;
if (typeof e != "function")
throw new TypeError(Kt);
return Ht(t) && (r = "leading" in t ? !!t.leading : r, a = "trailing" in t ? !!t.trailing : a), qt(e, n, {
leading: r,
maxWait: n,
trailing: a
});
}
var Xt = Qt;
const Yt = /* @__PURE__ */ ln(Xt), Jt = (e, n, t, r) => {
switch (n) {
case "debounce":
return Tt(e, t, r);
case "throttle":
return Yt(e, t, r);
default:
return e;
}
}, Zt = (
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(e) => {
const n = be.useRef(e);
return be.useEffect(() => {
n.current = e;
}), be.useMemo(() => (...t) => {
var r;
return (r = n.current) === null || r === void 0 ? void 0 : r.call(n, ...t);
}, []);
}
), Vt = (
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(e) => {
const [n, t] = be.useState((e == null ? void 0 : e.current) || null);
return e && setTimeout(() => {
e.current !== n && t(e.current);
}, 0), { refProxy: be.useMemo(() => new Proxy((a) => {
a !== n && t(a);
}, {
get(a, l) {
return l === "current" ? n : a[l];
},
set(a, l, u) {
return l === "current" ? t(u) : a[l] = u, !0;
}
}), [n]), refElement: n, setRefElement: t };
}
), Gt = (e, n) => n === "border-box" ? {
width: e.borderBoxSize[0].inlineSize,
height: e.borderBoxSize[0].blockSize
} : n === "content-box" ? {
width: e.contentBoxSize[0].inlineSize,
height: e.contentBoxSize[0].blockSize
} : {
width: e.contentRect.width,
height: e.contentRect.height
};
function er({ skipOnMount: e = !1, refreshMode: n, refreshRate: t = 1e3, refreshOptions: r, handleWidth: a = !0, handleHeight: l = !0, targetRef: u, observerOptions: d, onResize: i } = {}) {
const o = Ke(e), g = Zt(i), [c, I] = U({
width: void 0,
height: void 0
}), { refProxy: N, refElement: m } = Vt(u), { box: f } = d || {}, h = w((p) => {
if (!a && !l)
return;
if (o.current) {
o.current = !1;
return;
}
const L = (S, v) => a && S.width !== v.width || l && S.height !== v.height;
p.forEach((S) => {
const v = Gt(S, f);
I((M) => L(M, v) ? (g == null || g({
width: v.width,
height: v.height,
entry: S
}), v) : M);
});
}, [a, l, o, f]), F = w(Jt(h, n, t, r), [
h,
n,
t,
r
]);
return z(() => {
let p;
return m ? (p = new window.ResizeObserver(F), p.observe(m, d)) : (c.width || c.height) && (g == null || g({
width: null,
height: null,
entry: null
}), I({ width: void 0, height: void 0 })), () => {
var L, S, v;
(L = p == null ? void 0 : p.disconnect) === null || L === void 0 || L.call(p), (v = (S = F).cancel) === null || v === void 0 || v.call(S);
};
}, [F, m]), Object.assign({ ref: N }, c);
}
const de = () => {
const { ref: e, width: n } = er();
return {
ref: e,
width: n
};
}, Ne = (...e) => {
const [n, t] = U();
return z(() => {
const r = e.filter((a) => a.width !== void 0).map((a) => Number(a.width.toFixed(1)));
if (r.length === e.length) {
const a = Math.max(...r);
t((l) => l === void 0 ? a : l);
}
}, [e]), n;
};
function oe({ columnItem: e, width: n = void 0, children: t = void 0 }) {
return /* @__PURE__ */ s("div", { ref: e.ref, children: /* @__PURE__ */ s(xe, { sx: { width: n }, children: t }) });
}
const Z = V(Nn)(() => ({
whiteSpace: "nowrap",
minWidth: "max-content"
}));
function Er({ items: e, onSelect: n, onClose: t = void 0 }) {
const r = w(
(a, l) => {
n(a, l), t && t();
},
[t, n]
);
return /* @__PURE__ */ s(ce, { children: e.map((a) => /* @__PURE__ */ s(We, { onClick: () => r(a.key, a.text), children: a.text }, a.key)) });
}
function nr({
id: e = "dropdown-button",
startIcon: n = void 0,
endIcon: t = void 0,
text: r = void 0,
variant: a = "outlined",
color: l = void 0,
size: u = "medium",
disabled: d = !1,
children: i
}) {
const [o, g] = U(null), c = !!o, I = w((f) => {
g(f.currentTarget);
}, []), N = w(() => {
g(null);
}, []), m = we.cloneElement(we.Children.only(i), {
onClose: N
});
return /* @__PURE__ */ T(ce, { children: [
!r && /* @__PURE__ */ s(
Xe,
{
id: e,
"data-testid": e,
"aria-controls": c ? `${e}-popover` : void 0,
"aria-haspopup": "true",
"aria-expanded": c ? "true" : void 0,
onClick: I,
size: u,
color: l,
disabled: d,
children: n
}
),
r && /* @__PURE__ */ s(
Z,
{
id: e,
"data-testid": e,
"aria-controls": c ? `${e}-popover` : void 0,
"aria-haspopup": "true",
"aria-expanded": c ? "true" : void 0,
variant: a,
disableElevation: !0,
onClick: I,
startIcon: n,
endIcon: t ?? /* @__PURE__ */ s(tn, {}),
size: u,
color: l,
disabled: d,
children: r
}
),
/* @__PURE__ */ s(
vn,
{
id: `${e}-popover`,
"aria-labelledby": e,
anchorEl: o,
open: c,
onClose: N,
anchorOrigin: {
vertical: "bottom",
horizontal: "left"
},
transformOrigin: {
vertical: "top",
horizontal: "left"
},
children: m
}
)
] });
}
const tr = V("div")(({ top: e, left: n, width: t, height: r }) => ({
top: e,
left: n,
width: t,
height: r,
position: "absolute",
zIndex: 1
})), rr = V("div")(({ top: e, left: n, width: t, height: r, position: a, theme: l }) => ({
top: e,
left: n,
width: t,
height: r,
position: "absolute",
zIndex: 2,
color: l.palette.primary.contrastText,
backgroundColor: l.palette.primary.main,
display: "flex",
flexDirection: a === "left" || a === "right" ? "column" : "row",
borderTopLeftRadius: a === "top" || a === "left" ? 0 : 8,
borderTopRightRadius: a === "top" || a === "right" ? 0 : 8,
borderBottomRightRadius: a === "bottom" || a === "right" ? 0 : 8,
borderBottomLeftRadius: a === "bottom" || a === "left" ? 0 : 8
})), $e = 8;
function Br({
id: e = void 0,
position: n,
parentWidth: t,
parentHeight: r,
maxLength: a,
dropDownSize: l,
autoHideTimeout: u = 0,
forceShow: d = !1,
children: i = null
}) {
const o = O(() => {
switch (n) {
case "left":
case "right":
return Math.min(a, r);
case "top":
case "bottom":
return Math.min(a, t);
default:
return a;
}
}, [a, r, t, n]), g = O(() => {
switch (n) {
case "left":
case "right":
return (r - o) / 2;
case "top":
return 0;
case "bottom":
return r - $e;
default:
return 0;
}
}, [o, r, n]), c = O(() => {
switch (n) {
case "left":
return 0;
case "right":
return t - $e;
case "top":
case "bottom":
return (t - o) / 2;
default:
return 0;
}
}, [o, t, n]), I = O(() => {
switch (n) {
case "left":
case "right":
return $e;
case "top":
case "bottom":
return o;
default:
return 0;
}
}, [o, n]), N = O(() => {
switch (n) {
case "left":
case "right":
return o;
case "top":
case "bottom":
return $e;
default:
return 0;
}
}, [o, n]), m = O(() => {
switch (n) {
case "left":
case "right":
return (r - o) / 2;
case "top":
return 0;
case "bottom":
return r - l;
default:
return 0;
}
}, [l, o, r, n]), f = O(() => {
switch (n) {
case "left":
return 0;
case "right":
return t - l;
case "top":
case "bottom":
return (t - o) / 2;
default:
return 0;
}
}, [l, o, t, n]), h = O(() => {
switch (n) {
case "left":
case "right":
return l;
case "top":
case "bottom":
return o;
default:
return 0;
}
}, [l, o, n]), F = O(() => {
switch (n) {
case "left":
case "right":
return o;
case "top":
case "bottom":
return l;
default:
return 0;
}
}, [l, o, n]), [p, L] = U(!1), S = w(
(M) => {
M.buttons === 0 && u && L(!0);
},
[u]
), v = w(() => {
L(!1);
}, []);
return z(() => {
let M;
return p && u && (M = setTimeout(() => L(!1), u)), () => {
M && clearTimeout(M);
};
}, [u, p]), /* @__PURE__ */ T(ce, { children: [
/* @__PURE__ */ s(
tr,
{
id: e,
top: g,
left: c,
width: I,
height: N,
"aria-haspopup": "true",
onMouseEnter: S
}
),
(p || d === !0) && /* @__PURE__ */ s(
rr,
{
top: m,
left: f,
width: h,
height: F,
position: n,
onMouseLeave: v,
children: i
}
)
] });
}
function ue({
children: e,
fullWidth: n = !0,
spacing: t = "4px",
alignItems: r = "center"
}) {
return /* @__PURE__ */ s(Ye, { margin: "dense", fullWidth: n, variant: "standard", children: /* @__PURE__ */ s(Je, { direction: "row", spacing: t, alignItems: r, children: e }) });
}
const ar = V("input")(({ variant: e, theme: n }) => ({
...n.typography[e]
})), ir = V("span")(({ variant: e, theme: n }) => ({
...n.typography[e]
}));
function sr({ value: e, onChange: n, ariaLabel: t = void 0, variant: r = "body1" }) {
const a = Ke(null), [l, u] = U(e), d = w(
(g) => u(g.target.value),
[]
), i = w(
(g) => {
(g.key === "Enter" || g.key === "Escape") && (g.key === "Escape" && (u(e), g.currentTarget.value = e), g.currentTarget.blur());
},
[e]
), o = w(
(g) => {
n(g.target.value);
},
[n]
);
return z(() => {
var g;
(g = a.current) == null || g.focus();
}, []), /* @__PURE__ */ s(
ar,
{
ref: a,
variant: r ?? "body1",
type: "text",
"aria-label": t,
value: l,
onChange: d,
onKeyDown: i,
onBlur: o
}
);
}
function Ur({ editMode: e, value: n, onValueChange: t, ariaLabel: r = void 0, variant: a = "body1" }) {
return /* @__PURE__ */ T(ce, { children: [
e && /* @__PURE__ */ s(sr, { ariaLabel: r, value: n, onChange: t, variant: a }),
!e && /* @__PURE__ */ s(ir, { variant: a ?? "body1", children: n })
] });
}
function lr({
id: e = void 0,
label: n = void 0,
helperText: t = "",
value: r,
onChange: a = void 0,
onBlur: l = void 0,
disabled: u = !1,
error: d = !1,
required: i = !1,
margin: o = "dense",
size: g = "small",
fullWidth: c = !1,
inputMode: I = void 0,
pattern: N = void 0,
startAdornment: m = void 0,
endAdornment: f = void 0,
sx: h = void 0,
sxStartAdornment: F = void 0,
sxEndAdornment: p = void 0
}) {
const L = w(
(b) => {
a && a(b.target.value);
},
[a]
), S = w((b) => {
if (b.key === "Enter" && !b.ctrlKey && !b.altKey && !b.shiftKey) {
b.preventDefault(), b.stopPropagation(), document.activeElement instanceof HTMLElement && document.activeElement.blur();
return;
}
}, []), v = F ?? { marginBottom: 1 }, M = p ?? { marginBottom: 1 };
return /* @__PURE__ */ s(
Ze,
{
id: e,
"aria-label": e,
type: "text",
label: n,
helperText: t,
margin: o,
size: g,
fullWidth: c,
variant: "standard",
value: r,
onChange: L,
onBlur: l,
disabled: u,
"aria-disabled": u,
error: d,
required: i,
slotProps: {
input: {
startAdornment: m ? /* @__PURE__ */ s(Ee, { position: "start", sx: { ...v }, children: m }) : null,
endAdornment: f ? /* @__PURE__ */ s(Ee, { position: "end", sx: { ...M }, children: f }) : null
},
htmlInput: {
inputMode: I,
pattern: N
}
},
sx: h,
onKeyDown: S
}
);
}
function re({
id: e,
label: n = void 0,
helperText: t = "",
value: r,
onChange: a = void 0,
onBlur: l = void 0,
disabled: u = !1,
required: d = !1,
margin: i = "dense",
size: o = "small",
fullWidth: g = !1,
inputMode: c = void 0,
pattern: I = void 0,
startAdornment: N = void 0,
endAdornment: m = void 0,
sx: f = void 0,
sxStartAdornment: h = void 0,
sxEndAdornment: F = void 0,
error: p = void 0,
onErrorChange: L = void 0,
onValidate: S = void 0,
numberType: v = void 0,
minValue: M = void 0,
maxValue: b = void 0
}) {
const [$, R] = U(r), [k, _] = U(p !== void 0 ? p : !1);
z(() => {
R((x) => r !== x ? r : x);
}, [r]), z(() => {
_((x) => p !== void 0 && p !== x ? p : x);
}, [p]);
const W = w(
(x) => {
const B = Number.parseInt(x, x.startsWith("0x") ? 16 : 10);
let y = Number.isNaN(B);
return y || (y = M !== void 0 && B < M), y || (y = b !== void 0 && B > b), { val: x, err: y };
},
[b, M]
), j = w(
(x) => {
let B = !1;
if (x.endsWith(",") || x.endsWith("."))
return B = !0, { val: x, err: B };
const y = Number.parseFloat(x.replace(",", "."));
return B = Number.isNaN(y), B || (B = M !== void 0 && y < M), B || (B = b !== void 0 && y > b), { val: y.toString(), err: B };
},
[b, M]
), X = w(
(x) => v === "int" ? W(x) : j(x),
[v, j, W]
), P = w(
(x, B) => {
let y = x, D = !1;
return !d && (y === void 0 || y === "") ? { val: y, err: D } : (v !== void 0 && ({ val: y, err: D } = X(x)), !D && S && ({ val: y, err: D } = S(y, B)), { val: y, err: D });
},
[S, X]
), A = w(
(x) => {
const { val: B, err: y } = P(x, "change");
_(y), R(y ? x : B), !y && a && a(B);
},
[a, P]
), C = w(() => {
const { val: x, err: B } = P($, "blur");
_(B), !B && l && l(x);
}, [l, P, $]);
return z(() => {
L && L(k);
}, [k, L]), z(() => {
let x = !1;
u || (x = P($, "blur").err), _(x);
}, [u]), /* @__PURE__ */ s(
lr,
{
id: e,
label: n,
helperText: t,
value: $,
onChange: A,
onBlur: C,
disabled: u,
error: k,
required: d,
margin: i,
size: o,
fullWidth: g,
inputMode: c,
pattern: I,
startAdornment: N,
endAdornment: m,
sx: f,
sxStartAdornment: h,
sxEndAdornment: F
}
);
}
function yr({
minValue: e,
maxValue: n,
onChange: t = void 0,
onBlur: r = void 0,
minError: a = void 0,
onMinErrorChange: l = void 0,
maxError: u = void 0,
onMaxErrorChange: d = void 0,
onMinValidate: i = void 0,
onMaxValidate: o = void 0,
minDisabled: g = !1,
maxDisabled: c = !1,
unit: I = void 0,
lowerLimit: N = void 0,
upperLimit: m = void 0
}) {
const f = ne(), h = Number.parseInt(e), F = Number.parseInt(n), [p, L] = U(e.toString()), [S, v] = U(n.toString()), [M, b] = U(
a === !0 || Number.isNaN(h) || h < (N ?? 0) || m && h > m || !Number.isNaN(F) && h >= F
), [$, R] = U(
u === !0 || Number.isNaN(F) || F < (N ?? 0) || m && F > m || !Number.isNaN(h) && h >= F
);
z(() => {
L((A) => e.toString() !== A ? e.toString() : A);
}, [e]), z(() => {
b((A) => a !== void 0 && a !== A ? a : A);
}, [a]), z(() => {
v((A) => n.toString() !== A ? n.toString() : A);
}, [n]), z(() => {
R((A) => u !== void 0 && u !== A ? u : A);
}, [u]);
const k = w(
(A) => {
const C = Number.parseInt(A, A.startsWith("0x") ? 16 : 10), x = Number.parseInt(S), B = Number.isNaN(C) || C < (N ?? 0) || m && C > m || !Number.isNaN(x) && C >= x;
return { val: A, err: B };
},
[S, N, m]
), _ = w(
(A) => {
const C = Number.parseInt(A, A.startsWith("0x") ? 16 : 10), x = Number.parseInt(p), B = Number.isNaN(C) || C < (N ?? 0) || m && C > m || !Number.isNaN(x) && x >= C;
return { val: A, err: B };
},
[p, N, m]
), W = w(
(A) => {
let { val: C, err: x } = k(A);
if (!x && i && ({ val: C, err: x } = i(A, "change")), (a === void 0 || a === !1) && b(x), x)
t && t(A, S);
else {
const B = Number.parseInt(C, C.startsWith("0x") ? 16 : 10).toString();
L(B), t && t(B, S);
}
},
[k, i, a, t, S]
), j = w(
(A) => {
let { val: C, err: x } = k(A);
!x && i && ({ val: C, err: x } = i(C, "blur")), b(x), !x && r && r(C, S);
},
[k, i, r, S]
), X = w(
(A) => {
let { val: C, err: x } = _(A);
if (!x && o && ({ val: C, err: x } = o(A, "change")), (u === void 0 || u === !1) && R(x), x)
t && t(p, A);
else {
const B = Number.parseInt(C, C.startsWith("0x") ? 16 : 10).toString();
v(B), t && t(p, B);
}
},
[_, o, u, t, p]
), P = w(
(A) => {
let { val: C, err: x } = _(A);
!x && o && ({ val: C, err: x } = o(C, "blur")), R(x), !x && r && r(p, C);
},
[_, o, r, p]
);
return z(() => {
l && l(M), d && d($);
}, [$, M, d, l]), /* @__PURE__ */ T(ce, { children: [
/* @__PURE__ */ s(
re,
{
id: "min-value",
disabled: g,
inputMode: "numeric",
fullWidth: !0,
value: p,
onChange: W,
onBlur: j,
startAdornment: f.getString("LabelFrom"),
endAdornment: I,
numberType: "int",
error: M,
onErrorChange: b
}
),
/* @__PURE__ */ s(
re,
{
id: "max-value",
disabled: c,
inputMode: "numeric",
fullWidth: !0,
value: S,
onChange: X,
onBlur: P,
startAdornment: f.getString("LabelTo"),
endAdornment: I,
numberType: "int",
error: $,
onErrorChange: R
}
)
] });
}
function fe({
id: e = void 0,
label: n,
value: t,
disabled: r = !1,
size: a = "small",
sx: l = void 0
}) {
return /* @__PURE__ */ s(
Qe,
{
id: e,
"aria-label": e,
value: t,
disabled: r,
"aria-disabled": r,
control: /* @__PURE__ */ s(Cn, { size: a }),
label: n,
componentsProps: { typography: { noWrap: !0 } },
sx: l
}
);
}
function fn({
children: e,
id: n = void 0,
value: t,
onChange: r
}) {
return /* @__PURE__ */ s(In, { id: n, "aria-label": n, value: t, onChange: (a, l) => r(l), children: e });
}
const dr = V(xe, {
shouldForwardProp: (e) => e !== "collapsed"
})(({ collapsed: e, theme: n }) => ({
paddingTop: e ? "4px" : "8px",
paddingLeft: "2px",
paddingRight: "2px",
paddingBottom: e ? "0px" : "2px",
marginTop: "2px",
"&:hover, &:focus-within": {
background: n.palette.action.hover
}
})), gn = V("span")(({ theme: e }) => ({
color: e.palette.divider
})), or = V(gn)(() => ({
"&:hover": {
cursor: "pointer"
}
})), ur = V(Xe)(({ theme: e }) => ({
color: e.palette.divider,
padding: "0px"
}));
function me({
textAlign: e = "left",
text: n = void 0,
summary: t = void 0,
children: r = void 0,
collapsible: a = !1,
collapsed: l = !1,
collapsedChange: u = void 0
}) {
const d = hn(), i = ne(), [o, g] = U(l);
z(() => g(l), [l]);
const c = w(
(I) => {
u ? u(I) : g(I);
},
[u]
);
return /* @__PURE__ */ T(dr, { collapsed: o, children: [
n && /* @__PURE__ */ s($n, { textAlign: e, variant: "fullWidth", children: a ? /* @__PURE__ */ T(Je, { direction: "row", spacing: 1, alignItems: "center", children: [
/* @__PURE__ */ T(or, { onClick: () => c(!o), children: [
n.toLocaleUpperCase(d),
o && t ? ` (${t})` : ""
] }),
/* @__PURE__ */ s(
Se,
{
title: o ? i == null ? void 0 : i.getString("TooltipExpandSection", n) : i == null ? void 0 : i.getString("TooltipCollapseSection", n),
children: /* @__PURE__ */ s(ur, { onClick: () => c(!o), children: o ? /* @__PURE__ */ s(tn, {}) : /* @__PURE__ */ s(Dn, {}) })
}
)
] }) : /* @__PURE__ */ s(gn, { children: n.toLocaleUpperCase(d) }) }),
!o && r
] });
}
function Me({
id: e,
label: n,
showLabel: t = !1,
helperText: r = "",
options: a,
value: l,
onChange: u,
disabled: d = !1,
required: i = !1,
margin: o = "dense",
size: g = "small",
fullWidth: c = !1,
minWidth: I = void 0,
prefixTextWithValue: N = !1
}) {
const m = w(
(L) => {
typeof L.target.value == "string" ? u("") : u(L.target.value);
},
[u]
), f = w(
(L) => L.map((S) => /* @__PURE__ */ s(We, { "aria-label": `menu-item-${S.value}`, value: S.value, children: N ? `${S.value} - ${S.displayText}` : S.displayText }, S.value)),
[N]
), h = w(
(L, S) => {
const v = [
/* @__PURE__ */ s(wn, { color: "primary", children: L }, L)
];
return v.push(...f(S)), v;
},
[f]
), F = w(
(L) => {
const S = [];
return L.forEach((v, M) => {
S.push(...h(M, v));
}), S;
},
[h]
), p = w(
(L) => {
let S = "";
if (a instanceof Map)
a.forEach((v, M) => {
if (S === "") {
const b = v.find(($) => $.value === L);
b && (S = N ? `${b.value} - ${M} - ${b.displayText}` : `${M} - ${b.displayText}`);
}
});
else {
const v = a.find((M) => M.value === L);
v && (S = N ? `${v.value} - ${v.displayText}` : v.displayText);
}
return S === "" && (S = i ? `${n} *` : n), S;
},
[n, a, N, i]
);
return /* @__PURE__ */ T(Ye, { fullWidth: c, variant: "standard", sx: { minWidth: I }, margin: o, size: g, children: [
t && /* @__PURE__ */ s(Mn, { id: `${e}-label`, children: i ? `${n} *` : n }),
/* @__PURE__ */ T(
Fn,
{
labelId: `${e}-label`,
"aria-label": e,
id: e,
value: l,
renderValue: p,
onChange: m,
displayEmpty: !t,
disabled: d,
"aria-disabled": d,
children: [
a instanceof Map && F(a),
a instanceof Array && f(a)
]
}
),
r && /* @__PURE__ */ s(Ln, { children: r })
] });
}
const _e = (e) => {
const [n, t] = U([]);
return z(() => {
const r = () => {
qn(e).then((l) => {
const u = [];
for (let d = 0; d < l.length; d += 1) {
let i;
const o = l[d];
if (o.messageQualifiedName !== void 0) {
const g = o.messageQualifiedName.indexOf(".");
if (g !== -1) {
const c = o.messageQualifiedName.substring(0, g);
i = u.find((I) => I.name === c), i || (i = { name: c, messages: [] }, u.push(i));
}
}
i && i.messages.push(o);
}
return t(u), u;
});
}, a = Tn();
return bn(a, "meas-setup-changed", r), r(), () => {
pn(a, "meas-setup-changed");
};
}, [e]), n;
};
function Or({
parentDialogTitle: e = void 0,
open: n,
onSelect: t,
nodeIdentifier: r = void 0,
onClose: a,
modal: l = !1
}) {
const u = ne(), d = _e(r), i = O(
() => e ? `${e} > ${u.getString("DialogHeaderSelectMessage")}` : u.getString("DialogHeaderSelectMessage"),
[u, e]
), o = w(
(c) => {
if (c !== null)
for (let I = 0; I < d.length; I += 1) {
const m = d[I].messages.find((f) => f.messageQualifiedName === c);
m && (t(m), a && a());
}
},
[d, a, t]
), g = O(() => d.map((c) => c.name), [d]);
return /* @__PURE__ */ T(
Ve,
{
open: n,
fullScreen: l !== !0,
fullWidth: l === !0,
maxWidth: l === !0 ? "md" : void 0,
children: [
/* @__PURE__ */ s(Ge, { className: "draggable", children: i }),
/* @__PURE__ */ s(en, { dividers: !0, children: /* @__PURE__ */ s(
rn,
{
"aria-label": "frame-selector",
onSelectedItemsChange: (c, I) => o(I),
multiSelect: !1,
defaultExpandedItems: g,
sx: { height: 400 },
children: d.map((c) => /* @__PURE__ */ s(pe, { itemId: c.name, label: c.name, children: c.messages.map((I) => /* @__PURE__ */ s(pe, { itemId: I.messageQualifiedName, label: I.messageName }, I.messageQualifiedName)) }, c.name))
}
) }),
/* @__PURE__ */ s(Re, { children: /* @__PURE__ */ s(Z, { onClick: a, variant: "outlined", size: "large", children: u.getString("ButtonBack") }) })
]
}
);
}
function cr({
parentDialogTitle: e = void 0,
nodeIdentifier: n = void 0,
open: t,
multiSelect: r = !1,
checkboxSelection: a = !1,
onSelect: l = void 0,
onMultiSelect: u = void 0,
onClose: d,
selectedMessages: i = void 0,
selectedSignals: o = void 0
}) {
const g = ne(), c = _e(n), I = O(
() => e ? `${e} > ${g.getString("DialogHeaderSelectSignal")}` : g.getString("DialogHeaderSelectSignal"),
[g, e]
), [N, m] = U(() => i ? c.map((b) => b.messages.filter(($) => i.includes($.messageQualifiedName))).flat() : []);
z(() => {
if (i) {
const b = c.map(($) => $.messages.filter((R) => i.includes(R.messageQualifiedName))).flat();
m(b);
}
}, [i, c]);
const [f, h] = U(() => o ? c.map(
(b) => b.messages.filter(
($) => $.signals && $.signals.find((R) => o.includes(R.qualifiedName))
)
).flat().map((b) => b.signals.filter(($) => o.includes($.qualifiedName))).flat() : []);
z(() => {
if (o) {
const b = c.map(
($) => $.messages.filter(
(R) => R.signals && R.signals.find((k) => o.includes(k.qualifiedName))
)
).flat().map(($) => $.signals.filter((R) => o.includes(R.qualifiedName))).flat();
h(b);
}
}, [o, c]);
const [F, p] = U(!1), L = O(() => {
if (r)
return [
...N.map((b) => b.messageQualifiedName),
...f.map((b) => b.qualifiedName)
];
}, [r, N, f]), S = w(
(b) => {
if (b === null)
return;
if (!r)
for (let R = 0; R < c.length; R += 1) {
const _ = c[R].messages.find(
(W) => W.signals && W.signals.findIndex((j) => j.qualifiedName === b) !== -1
);
if (_ != null && _.signals) {
const W = _.signals.find((j) => j.qualifiedName === b);
if (W && l && (l(_, W), d)) {
d();
return;
}
}
}
let $ = [];
m((R) => {
let k = [];
for (let _ = 0; _ < c.length; _ += 1) {
const W = c[_], j = W.messages.filter(
(C) => C.signals && C.signals.length > 0 && C.signals.every((x) => b.includes(x.qualifiedName))
), X = W.messages.filter(
(C) => C.signals && C.signals.some((x) => b.includes(x.qualifiedName))
);
if (X) {
const C = X.map((x) => x.signals).flat().filter((x) => b.includes(x.qualifiedName));
C && (k = [...new Set(k.concat(j))], $ = [...new Set($.concat(C))]);
}
const P = W.messages.filter(
(C) => C.signals.length > 0 && b.includes(C.messageQualifiedName) && !R.some((x) => x.messageQualifiedName === C.messageQualifiedName)
);
if (P.length > 0) {
const C = P.map((x) => x.signals).flat();
C && (k = [...new Set(k.concat(P))], $ = [...new Set($.concat(C))]);
}
const A = W.messages.filter(
(C) => !b.includes(C.messageQualifiedName) && R.some((x) => x.messageQualifiedName === C.messageQualifiedName)
);
if (A.length > 0) {
const C = A.map((x) => x.signals).flat();
C && (k = k.filter(
(x) => !A.some((B) => B.messageQualifiedName === x.messageQualifiedName)
), $ = $.filter(
(x) => !C.some((B) => B.qualifiedName === x.qualifiedName)
));
}
}
return k;
}), h($);
},
[c, r, d, l]
), v = w(() => {
u && (u(N, f), m([]), h([])), d && d();
}, [d, u, N, f]);
z(() => {
p(f.length === 0);
}, [f.length]);
const M = O(() => {
const b = c.map((R) => R.name), $ = c.map((R) => R.messages).flat().filter(
(R) => R.signals && R.signals.some((k) => f.some((_) => _.qualifiedName === k.qualifiedName))
).map((R) => R.messageQualifiedName);
return [...b, ...$];
}, [c, f]);
return /* @__PURE__ */ T(Ve, { open: t, fullScreen: !0, children: [
/* @__PURE__ */ s(Ge, { className: "draggable", children: I }),
/* @__PURE__ */ s(en, { dividers: !0, children: /* @__PURE__ */ s(
rn,
{
"aria-label": "signal-selector",
multiSelect: r,
checkboxSelection: a,
selectedItems: L,
onSelectedItemsChange: (b, $) => S($),
defaultExpandedItems: M,
children: c.map((b) => /* @__PURE__ */ s(pe, { itemId: b.name, label: b.name, children: b.messages.map(($) => /* @__PURE__ */ s(pe, { itemId: $.messageQualifiedName, label: $.messageName, children: $.signals && $.signals.map((R) => /* @__PURE__ */ s(pe, { itemId: R.qualifiedName, label: R.name }, R.qualifiedName)) }, $.messageQualifiedName)) }, b.name))
}
) }),
r && /* @__PURE__ */ T(Re, { children: [
/* @__PURE__ */ s(
Z,
{
onClick: v,
variant: "contained",
size: "large",
disabled: F,
children: g.getString("ButtonSave")
}
),
/* @__PURE__ */ s(Z, { onClick: d, variant: "outlined", size: "large", children: g.getString("ButtonCancel") })
] }),
!r && /* @__PURE__ */ s(Re, { children: /* @__PURE__ */ s(Z, { onClick: d, variant: "outlined", size: "large", children: g.getString("ButtonBack") }) })
] });
}
function Pr({
selectedSignals: e,
onSelectedSignalseChange: n,
onErrorsChange: t = void 0,
signalFilterError: r = void 0,
parentDialogTitle: a = void 0,
nodeIdentifier: l = void 0,
disabled: u = !1
}) {
const d = ne(), i = de(), o = Ne(i), g = _e(l), c = O(() => {
const h = /* @__PURE__ */ new Set();
return g.forEach((F) => {
F.messages.forEach((p) => {
p.signals.length > 0 && p.signals.every((L) => e.includes(L.qualifiedName)) && h.add(p.messageQualifiedName);
});
}), Array.from(h);
}, [g, e]), I = w(
(h, F) => {
n(F.map((p) => p.qualifiedName));
},
[n]
), N = w(
(h, F) => {
n(F);
},
[n]
);
z(() => {
r && (r.current = e.length === 0), t && t(e.length === 0);
}, [t, e, r]);
const [m, f] = U(!1);
return /* @__PURE__ */ s(ce, { children: /* @__PURE__ */ T(ue, { children: [
/* @__PURE__ */ s(
Rn,
{
id: "selected-signals",
multiple: !0,
limitTags: 3,
freeSolo: !0,
options: [],
value: e,
renderInput: (h) => /* @__PURE__ */ s(Ze, { ...h, label: d.getString("LabelSelectedSignals") }),
size: "small",
fullWidth: !0,
onChange: N,
inputValue: ""
}
),
/* @__PURE__ */ s(oe, { columnItem: i, width: o, children: /* @__PURE__ */ s(Se, { title: d.getString("TooltipSelectSignals"), children: /* @__PURE__ */ s(
Z,
{
disabled: u,
onClick: () => f(!0),
variant: "outlined",
size: "large",
children: d.getString("ButtonSelectSignals")
}
) }) }),
/* @__PURE__ */ s(
cr,
{
parentDialogTitle: a,
open: m,
onClose: () => f(!1),
nodeIdentifier: l,
onMultiSelect: I,
multiSelect: !0,
selectedMessages: c,
selectedSignals: e,
checkboxSelection: !0
}
)
] }) });
}
const jr = V(xe)(({ height: e, width: n }) => ({
height: e,
width: n,
padding: "4px",
overflow: "auto"
}));
function fr({ label: e, variant: n = "h6" }) {
return /* @__PURE__ */ s(En, { children: /* @__PURE__ */ s(nn, { sx: { flex: "1 1 100%" }, variant: n, id: "tableTitle", component: "div", children: e }) });
}
function Dr({
data: e,
dataKey: n,
hasRemoveButton: t = !1,
removeButtonTitle: r = void 0,
onRemoveRow: a = void 0,
selectedKey: l = void 0,
onClickRow: u = void 0,
columns: d,
label: i = void 0,
labelVariant: o = "h6",
maxHeight: g = void 0,
size: c = "medium",
stickyHeader: I = !1,
hover: N = !1
}) {
const m = w(
(f) => {
u && u(f);
},
[u]
);
return /* @__PURE__ */ T(xe, { children: [
i && /* @__PURE__ */ s(fr, { label: i, variant: o }),
/* @__PURE__ */ s(Wn, { children: /* @__PURE__ */ T(An, { "aria-labelledby": "tableTitle", size: c, stickyHeader: I, sx: { maxHeight: g }, padding: "none", children: [
/* @__PURE__ */ s(_n, { children: /* @__PURE__ */ s(Be, { children: d.map((f) => (
// eslint-disable-next-line react/jsx-props-no-spreading
/* @__PURE__ */ s(Fe, { ...f.headProps, children: f.headCell }, f.key)
)) }) }),
/* @__PURE__ */ s(kn, { children: e.map((f) => {
const h = n(f);
return /* @__PURE__ */ s(Be, { hover: N, selected: h === l, children: d.map((F) => /* @__PURE__ */ T(Sn, { children: [
/* @__PURE__ */ s(
Fe,
{
onClick: () => m(f),
...F.dataProps,
children: F.dataCell(f)
},
`${h}-${F.key}-project-file`
),
t && /* @__PURE__ */ s(Fe, { children: /* @__PURE__ */ s(Z, { size: "small", title: r, onClick: () => a(f), children: /* @__PURE__ */ s(zn, { fontSize: "small" }) }) }, `${h}-${F.key}-remove-button`)
] }, `${h}-${F.key}`)) }, h);
}) })
] }) })
] });
}
const zr = V("div")(({ theme: e }) => ({
borderBottom: "1px solid",
borderColor: e.palette.divider
})), gr = V(Bn)(({ theme: e }) => ({
[`& .${Ue.grouped}`]: {
margin: e.spacing(0.5),
padding: e.spacing(1.25),
minWidth: 24,
color: e.palette.action.active,
border: 0,
borderRadius: e.shape.borderRadius,
[`&.${Ue.disabled}`]: {
border: 0
}
}
// [`& .${toggleButtonGroupClasses.middleButton},& .${toggleButtonGroupClasses.lastButton}`]: {
// marginLeft: -1,
// borderLeft: '1px solid transparent',
// },
})), mr = V(Un)(({ theme: e }) => ({
[`& .${Ce.grouped}`]: {
margin: e.spacing(0.5),
padding: e.spacing(1.25),
minWidth: 24,
color: e.palette.action.active,
border: 0,
borderRadius: e.shape.borderRadius,
[`&.${Ce.disabled}`]: {
border: 0
}
},
[`& .${Ce.middleButton},& .${Ce.lastButton}`]: {
marginLeft: -1,
borderLeft: "1px solid transparent"
}
}));
function mn({
onClick: e,
icon: n = void 0,
text: t = void 0,
size: r = "small",
variant: a = void 0,
color: l = "inherit",
tooltip: u = void 0,
ariaLabel: d = void 0,
children: i = void 0,
disabled: o = !1
}) {
return i ? /* @__PURE__ */ s(
nr,
{
size: typeof r == "string" ? r : "small",
variant: a,
color: l,
startIcon: n,
text: t,
disabled: o,
children: i
}
) : t ? /* @__PURE__ */ T(
Z,
{
size: typeof r == "string" ? r : "small",
variant: a,
color: l,
"aria-label": d,
onClick: e,
startIcon: n,
disabled: o,
children: [
u && /* @__PURE__ */ s(Se, { placement: "bottom-start", title: u, children: /* @__PURE__ */ s("span", { children: t }) }),
!u && t
]
}
) : /* @__PURE__ */ T(
Z,
{
size: typeof r == "string" ? r : "small",
variant: a,
color: l,
"aria-label": d,
onClick: e,
disabled: o,
sx: {
height: typeof r == "number" ? `${r}px` : void 0,
width: typeof r == "number" ? `${r}px` : void 0
},
children: [
u && /* @__PURE__ */ s(Se, { placement: "bottom-start", title: u, children: /* @__PURE__ */ s("span", { children: n }) }),
!u && n
]
}
);
}
function hr({
buttons: e,
size: n = "small",
ariaLabel: t = void 0,
orientation: r = "horizontal"
}) {
return /* @__PURE__ */ s(mr, { size: n, "aria-label": t, orientation: r, children: e.map((a, l) => /* @__PURE__ */ s(
mn,
{
onClick: a.onClick,
icon: a.icon,
text: a.text,
size: a.size,
variant: a.variant,
color: a.color,
tooltip: a.tooltip,
ariaLabel: a.ariaLabel,
disabled: a.disabled,
children: a.children
},
l
)) });
}
function br({
value: e,
onChange: n,
size: t = "small",
ariaLabel: r = void 0,
exclusive: a = void 0,
buttons: l,
orientation: u = "horizontal"
}) {
return /* @__PURE__ */ s(
gr,
{
size: t,
value: e,
onChange: (d, i) => n(i),
"aria-label": r,
exclusive: a,
orientation: u,
children: l.map((d, i) => /* @__PURE__ */ T(
On,
{
size: typeof t == "string" ? t : "small",
value: d.value,
"aria-label": d.ariaLabel,
sx: {
height: typeof t == "number" ? `${t}px` : void 0,
width: typeof t == "number" ? `${t}px` : void 0,
padding: d.size === "small" || typeof t == "number" ? 1 : void 0,
margin: d.size === "small" || typeof t == "number" ? 0 : void 0
},
disabled: d.disabled,
children: [
d.tooltip && /* @__PURE__ */ s(Se, { placement: "bottom-start", title: d.tooltip, children: /* @__PURE__ */ s("span", { children: d.icon }) }),
!d.tooltip && d.icon
]
},
i
))
}
);
}
function Tr({
items: e,
height: n = 34,
width: t = 34,
justifyContent: r = "left",
borderSize: a = 1,
padding: l = 1,
backgroundColor: u = void 0,
orientation: d = "horizontal"
}) {
return /* @__PURE__ */ s(
yn,
{
elevation: 0,
sx: {
display: "flex",
alignItems: "center",
justifyContent: r,
border: (i) => `${a}px solid ${i.palette.divider}`,
flexWrap: "wrap",
height: d === "horizontal" ? `${n}px` : "100%",
minHeight: d === "horizontal" ? `${n}px` : void 0,
width: d === "vertical" ? `${t}px` : "100%",
minWidth: d === "vertical" ? `${t}px` : void 0,
paddingLeft: d === "horizontal" ? l : 0,
paddingRight: d === "horizontal" ? l : 0,
paddingTop: d === "vertical" ? l : 0,
paddingBottom: d === "vertical" ? l : 0,
borderRadius: "0px",
backgroundColor: u
},
children: e.map((i, o) => i.label ? (
// eslint-disable-next-line react/no-array-index-key
/* @__PURE__ */ s(nn, { variant: i.label.variant, component: "div", children: i.label.text }, o)
) : i.toggleButtonGroup ? /* @__PURE__ */ s(
br,
{
value: i.toggleButtonGroup.value,
onChange: i.toggleButtonGroup.onChange,
ariaLabel: i.toggleButtonGroup.ariaLabel,
exclusive: i.toggleButtonGroup.exclusive,
buttons: i.toggleButtonGroup.buttons,
orientation: d
},
o
) : i.button ? /* @__PURE__ */ s(
mn,
{
onClick: i.button.onClick,
icon: i.button.icon,
text: i.button.text,
variant: i.button.variant,
color: i.button.color,
tooltip: i.button.tooltip,
ariaLabel: i.button.ariaLabel,
disabled: i.button.disabled
},
o
) : i.buttonGroup ? (
// eslint-disable-next-line react/no-array-index-key
/* @__PURE__ */ s(
hr,
{
ariaLabel: i.buttonGroup.ariaLabel,
buttons: i.buttonGroup.buttons,
orientation: d
},
o
)
) : i.other)
}
);
}
function qr({ options: e, onSelect: n, children: t = void 0 }) {
const [r, a] = we.useState(null), l = w(
(i) => {
e.length !== 0 && (i.preventDefault(), a(
r === null ? {
mouseX: i.clientX + 2,
mouseY: i.clientY - 6
} : (
// repeated contextmenu when it is already open closes it with Chrome 84 on Ubuntu
// Other native context menus might behave different.
// With this behavior we prevent contextmenu from the backdrop to re-locale existing context menus.
null
)
));
},
[r, e.length]
), u = w(() => {
a(null);
}, []), d = w(
(i) => {
n(i), u();
},
[u, n]
);
return /* @__PURE__ */ T("div", { onContextMenu: l, style: { cursor: "context-menu" }, children: [
t,
/* @__PURE__ */ s(
Pn,
{
open: r !== null,
onClose: u,
anchorReference: "anchorPosition",
anchorPosition: r !== null ? { top: r.mouseY, left: r.mouseX } : void 0,
children: e.map((i) => /* @__PURE__ */ T(We, { onClick: () => d(i.value), children: [
i.icon && /* @__PURE__ */ s(jn, { children: i.icon }),
/* @__PURE__ */ s(ye, { children: i.displayText }),
i.shortcut && /* @__PURE__ */ s(ye, { sx: { pl: 2, textAlign: "right" }, children: i.shortcut })
] }, i.value))
}
)
] });
}
function pr({
canIdentifier: e,
canIdentifierType: n,
onCanIdentifierChange: t,
onErrorsChange: r = void 0,
showSelectMessageDialogChange: a = void 0,
showSelectSignalDialogChange: l = void 0,
disabled: u = !1,
disableSelectMessageButton: d = !1,
disableSelectSignalButton: i = !1,
hideSection: o = !1,
hideSelectMessageButton: g = !1,
showSelectSignalButton: c = !1,
collapsible: I = !1,
collapsed: N = !1,
collapsedChange: m = void 0
}) {
const f = ne(), h = le(), F = de(), p = de(), L = Ne(F, p), [S, v] = U(!1);
z(() => {
r && r(S);
}, [S, r]);
const [M, b] = U(!1), [$, R] = U(n);
z(() => {
R(n);
}, [n]);
const k = w((P) => {
R(P ? "extended" : "standard");
}, []), _ = w(
(P) => {
let A = P;
const C = parseInt(A, A.startsWith("0x") ? 16 : h);
if ($ === "extended") {
if (Number.isNaN(C) || C < 0 || C > 536870911)
return Number.isNaN(C) || t(`${C.toString(h).toUpperCase()}`, $), { val: P, err: !0 };
} else if ($ === "standard" && (Number.isNaN(C) || C < 0 || C > 2047))
return Number.isNaN(C) || t(`${C.toString(h).toUpperCase()}`, $), { val: P, err: !0 };
return t(`${C.toString(h).toUpperCase()}`, $), b(A.startsWith("0x")), { val: P, err: !1 };
},
[$, h, t]
), W = w(
(P) => {
if (P !== $) {
let A = !1;
const C = parseInt(e, e.startsWith("0x") ? 16 : h);
P === "standard" ? (Number.isNaN(C) || C < 0 || C > 2047) && (A = !0) : P === "extended" && (Number.isNaN(C) || C < 0 || C > 536870911) && (A = !0), t(e, P), v(A);
}
},
[$, e, t, h]
), j = O(() => {
const P = parseInt(e, e.startsWith("0x") ? 16 : h);
return M ? `0x${P.toString(16).toUpperCase()}` : P.toString(h).toUpperCase();
}, [M, e, h]), X = O(
() => /* @__PURE__ */ T(ue, { spacing: 4, children: [
/* @__PURE__ */ s(
re,
{
id: "constant-id",
fullWidth: !0,
value: j,
error: S,
onValidate: _,
onErrorChange: v,
disabled: u
}
),
/* @__PURE__ */ s(
sn,
{
id: "id-type",
label: f.getString("LabelUseExtendedIdentifier"),
checked: $ === "extended",
onChange: (P) => {
k(P), W(P ? "extended" : "standard");
},
disabled: u
}
),
!g && /* @__PURE__ */ s(oe, { columnItem: F, width: L, children: /* @__PURE__ */ s(
Z,
{
disabled: d,
onClick: () => {
a && a(!0);
},
variant: "outlined",
size: "large",
children: f.getString("ButtonSelectMessage")
}
) }),
c && /* @__PURE__ */ s(oe, { columnItem: p, width: L, children: /* @__PURE__ */ s(
Z,
{
disabled: i,
onClick: () => {
l && l(!0);