UNPKG

@kvaser/canking-api

Version:

CanKing API to communicate with the CanKing service using Node.js.

785 lines (784 loc) 30.7 kB
import { i as Pe, j as $e, k as be, l as ve, m as ae, W as ce, n as Fe, M as De, o as Ie, p as re } from "./useMeasurement.mjs"; import { q as Rt, s as _t, t as At, v as xt, w as Ut, x as Tt, a as wt, u as Lt, y as kt, d as Ct, z as Et, e as Pt, A as $t, b as Ot, B as qt, C as Nt, c as jt, D as Kt, E as Wt, F as zt, G as Bt, H as Jt, f as Xt } from "./useMeasurement.mjs"; import { c as B } from "react/compiler-runtime"; import { useState as W, useEffect as A, useRef as v, useCallback as V, useMemo as Oe, useContext as ie } from "react"; import "long"; import { electronApiFake as de, deep_equal as z, jsonReviver as Me, jsonReplacer as qe, calculateSubscriptionKey as ne, deserializeFrame as Ne, calculateSubscriptionKeyFromFrame as se, compareFixedPosFrameIdentifiers as je } from "./models.mjs"; import { getLogger as ge, getFrameDefinitions as Re, getMessageDataBeforeTimestamp as Ke } from "./ipc.mjs"; import { a as _e, b as Ae, C as xe } from "./status_params.mjs"; const We = () => Pe(), lt = () => We().devices, Ue = window.electron ?? de, Te = ge("hooks"), ft = () => $e(), mt = (r) => { const n = B(5), s = r === void 0 ? !1 : r; let e; n[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = [], n[0] = e) : e = n[0]; const [t, a] = W(e), o = be(); let c, u; return n[1] !== o || n[2] !== s ? (c = () => { const f = new AbortController(); return Ue.ipcRenderer.invoke("mm-get-message-log-file-formats", s).then((m) => { f.signal.aborted || a(ve(m, o)); }).catch((m) => { f.signal.aborted || Te.error("Failed to get message log file formats:", m); }), () => { f.abort(); }; }, u = [o, s], n[1] = o, n[2] = s, n[3] = c, n[4] = u) : (c = n[3], u = n[4]), A(c, u), t; }, dt = () => { const r = B(4); let n; r[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (n = [], r[0] = n) : n = r[0]; const [s, e] = W(n), t = be(); let a, o; return r[1] !== t ? (a = () => { const c = new AbortController(); return Ue.ipcRenderer.invoke("mm-get-signal-log-file-formats").then((u) => { c.signal.aborted || e(ve(u, t)); }).catch((u) => { c.signal.aborted || Te.error("Failed to get signal log file formats:", u); }), () => { c.abort(); }; }, o = [t], r[1] = t, r[2] = a, r[3] = o) : (a = r[2], o = r[3]), A(a, o), s; }, ue = 25; function we(r, n) { return r.length >= n ? r.slice(1) : r; } function ze(r, n) { if (r.previous.length === 0) return r; const s = r.previous[r.previous.length - 1], e = r.previous.slice(0, r.previous.length - 1), t = r.current === void 0 ? r.next : r.next.length === n ? [r.current, ...r.next.slice(0, n - 1)] : [r.current, ...r.next]; return { previous: e, current: s, next: t }; } function Be(r, n) { if (r.next.length === 0) return r; const s = r.next[0], e = r.next.slice(1); return { previous: r.current === void 0 ? r.previous : [...we(r.previous, n), r.current], current: s, next: e }; } function Je(r, n, s, e) { return e && e(r.current, n) ? null : { previous: r.current === void 0 ? r.previous : [...we(r.previous, s), r.current], current: n, next: [] }; } function Le(r) { const n = v({ previous: r?.previous || [], current: r?.current, next: r?.next || [] }), s = v(/* @__PURE__ */ new Set()), e = V(() => { s.current.forEach((a) => a()); }, []); return Oe(() => ({ get state() { return n.current; }, set state(a) { n.current = a; }, canUndo: () => n.current.previous.length !== 0, canRedo: () => n.current.next.length !== 0, undo: () => { n.current.previous.length !== 0 && (n.current = ze(n.current, ue), e()); }, redo: () => { n.current.next.length !== 0 && (n.current = Be(n.current, ue), e()); }, set: (a) => { const o = typeof a == "function" ? a(n.current.current) : a, c = Je(n.current, o, ue, z); c && (n.current = c, e()); }, reset: (a, o = [], c = []) => { n.current = { previous: o, current: a, next: c }, e(); }, subscribe: (a) => (s.current.add(a), () => { s.current.delete(a); }) }), [e]); } function gt(r) { const n = B(6); let s; n[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (s = {}, n[0] = s) : s = n[0]; const [, e] = W(s), t = Le(r); let a; n[1] !== e || n[2] !== t ? (a = () => t.subscribe?.(() => { e({}); }), n[1] = e, n[2] = t, n[3] = a) : a = n[3]; let o; return n[4] !== t ? (o = [t], n[4] = t, n[5] = o) : o = n[5], A(a, o), t; } const pe = window.electron ?? de, Q = ge("hooks"); function Se(r) { const n = B(11), { enabled: s, intervalMs: e, stateRef: t, lastSavedStateRef: a, queueSave: o, intervals: c, maxIntervals: u, warnLabel: f, canSave: m } = r, l = e === void 0 ? 5e3 : e; let g, i; n[0] !== m || n[1] !== s || n[2] !== l || n[3] !== c || n[4] !== a || n[5] !== u || n[6] !== o || n[7] !== t || n[8] !== f ? (g = () => { if (!s) return; c.size >= u && Q.warn(`Too many active auto-save intervals (${c.size}/${u}), consider optimizing ${f} usage`); const S = setInterval(() => { if (m && !m()) return; const b = t.current; b != null && !z(b, a.current) && (o(b), a.current = b); }, l); return c.add(S), () => { clearInterval(S), c.delete(S); }; }, i = [s, l, c, u, f, o, m, t, a], n[0] = m, n[1] = s, n[2] = l, n[3] = c, n[4] = a, n[5] = u, n[6] = o, n[7] = t, n[8] = f, n[9] = g, n[10] = i) : (g = n[9], i = n[10]), A(g, i); } const Xe = "project-data-internal-v1"; function he(r, n) { return r == null ? n : Array.isArray(n) && Array.isArray(r) ? r : typeof n == "object" && !Array.isArray(n) && typeof r == "object" && !Array.isArray(r) ? { ...n, ...r } : typeof n != typeof r || Array.isArray(n) !== Array.isArray(r) ? n : r; } const Y = []; let ee = null; const le = 100, Ye = /* @__PURE__ */ new Set(); function He(r) { return Math.max(15, r * 7); } function ye(r, n, s, e, t = 200) { const a = `${r}:${n}`; if (!a || s === void 0) return; const o = Y.find((c) => c.key === a); o ? o.state = s : (Y.push({ key: a, state: s, id: r, slice: n }), Y.length > le && (Q.warn(`Project data save queue exceeded ${le} items, removing oldest entries`), Y.splice(0, Y.length - le))), ee && clearTimeout(ee), ee = setTimeout(() => { if (!Y.length) return; const c = [...Y]; Y.length = 0, ee = null; try { e((u) => { const f = [...u]; let m = !1; for (const l of c) { const g = f.find((i) => i.id === l.id); if (g?.componentData) { const i = g.componentData.componentPropSlices[l.slice] ? JSON.parse(g.componentData.componentPropSlices[l.slice], Me) : {}; z(i, l.state) || (g.componentData.componentPropSlices[l.slice] = JSON.stringify(l.state, qe), m = !0); } } return m ? f : u; }); } catch (u) { Q.error("Failed to save project data batch:", u); } }, t); } const G = (r, n, s, e) => { const [t, a] = ie(ce), o = v(typeof s == "function" ? s() : s), [c, u] = W(() => o.current), [f, m] = W(!1), l = v(c), g = v(void 0), i = v(!1), S = v(!1); A(() => { l.current = c; }, [c]), A(() => { i.current = f; }, [f]), A(() => { if (!(t === null || i.current)) { try { const p = t?.find((T) => T.id === r), d = p?.componentData?.componentPropSlices[n] && p?.componentData?.componentPropSlices[n] !== "" ? JSON.parse(p.componentData.componentPropSlices[n], Me) : o.current, h = he(d, o.current); u(h), l.current = h, e && !S.current && (S.current = !0, e(h)); } catch (p) { Q.error(`Failed to load project data slice ${n}:`, p), u(o.current), l.current = o.current, e && !S.current && (S.current = !0, e(o.current)); } finally { m(!0), i.current = !0; } return () => { m(!1), i.current = !1; }; } }, [r, e, n, t]); const b = V((p) => ye(r, n, p, a), [r, a, n]); Se({ enabled: f, stateRef: l, lastSavedStateRef: g, queueSave: b, intervals: Ye, maxIntervals: He(t?.length ?? 0), warnLabel: "project data", canSave: () => i.current }); const D = V((p) => { if (!i.current) return; const d = l.current, h = typeof p == "function" ? p(d) : p; z(h, d) || (u(h), l.current = h, z(h, g.current) || (ye(r, n, h, a), g.current = h)); }, [r, a, n]); return [c, D, f]; }, pt = (r, n) => { const s = B(4), [e, t, a] = G(r, Xe, n); let o; return s[0] !== e || s[1] !== a || s[2] !== t ? (o = { projectDataIsInitialized: a, projectData: e, setProjectData: t }, s[0] = e, s[1] = a, s[2] = t, s[3] = o) : o = s[3], o; }, H = []; let te = null; const fe = 100, ke = /* @__PURE__ */ new Set(); function Ce(r) { return Math.max(15, r * 7); } function oe(r, n, s = 200) { if (!r || n === void 0) return; const e = H.find((t) => t.key === r); e ? e.state = n : (H.push({ key: r, state: n }), H.length > fe && (Q.warn(`Session data save queue exceeded ${fe} items, removing oldest entries`), H.splice(0, H.length - fe))), te && clearTimeout(te), te = setTimeout(() => { if (!H.length) return; const t = [...H]; H.length = 0, te = null; try { pe.ipcRenderer.invoke("main-set-workspace-view-session-data-batch", t); } catch (a) { Q.error("Failed to send batch:", a); } }, s); } const St = (r, n, s) => { const e = v(typeof n == "function" ? n() : n), [t, a] = W(() => e.current), [o, c] = W(!1), [u] = ie(ce), f = v(t), m = v(void 0), l = v(!1), g = v(!1), i = v(!1); A(() => { f.current = t; }, [t]), A(() => (l.current = !0, (async () => { try { const D = await pe.ipcRenderer.invoke("main-get-workspace-view-session-data-object", r.toString()); if (!l.current) return; const p = he(D, e.current); a(p), f.current = p, s && !g.current && (g.current = !0, s(p)); } catch (D) { Q.error(`Failed to load session data for view ${r}:`, D), a(e.current), f.current = e.current, s && !g.current && (g.current = !0, s(e.current)); } finally { c(!0), i.current = !0; } })(), () => { l.current = !1, i.current = !1; }), [r, s]); const S = V((D) => oe(r.toString(), D), [r]); Se({ enabled: o, stateRef: f, lastSavedStateRef: m, queueSave: S, intervals: ke, maxIntervals: Ce(u?.length ?? 0), warnLabel: "session data", canSave: () => l.current }); const b = V((D) => { if (!i.current) return; const p = f.current, d = typeof D == "function" ? D(p) : D; z(d, p) || (a(d), f.current = d, z(d, m.current) || (oe(r.toString(), d), m.current = d)); }, [r]); return { sessionDataIsInitialized: o, sessionData: t, setSessionData: b }; }; function Ee(r, n, s, e) { const t = `${r}:${n}`, [a] = ie(ce), o = v(typeof s == "function" ? s() : s), [c, u] = W(() => o.current), [f, m] = W(!1), l = v(c), g = v(void 0), i = v(!1), S = v(!1), b = v(!1); A(() => { l.current = c; }, [c]), A(() => (i.current = !0, (async () => { try { const d = await pe.ipcRenderer.invoke("main-get-workspace-view-session-data-slice", t); if (!i.current) return; const h = he(d, o.current); u(h), l.current = h, e && !S.current && (S.current = !0, e(h)); } catch (d) { Q.error(`Failed to load session data slice ${t}:`, d), u(o.current), l.current = o.current, e && !S.current && (S.current = !0, e(o.current)); } finally { m(!0), b.current = !0; } })(), () => { i.current = !1, b.current = !1; }), [t, e]); const D = V((d) => oe(t, d), [t]); Se({ enabled: f, stateRef: l, lastSavedStateRef: g, queueSave: D, intervals: ke, maxIntervals: Ce(a?.length ?? 0), warnLabel: "session data", canSave: () => i.current && b.current }); const p = V((d) => { if (!b.current) return; const h = l.current, T = typeof d == "function" ? d(h) : d; z(T, h) || (u(T), l.current = T, z(T, g.current) || (oe(t, T), g.current = T)); }, [t]); return [c, p, f]; } function ht(r, n, s) { const e = B(10), t = Le(s); let a; e[0] !== t ? (a = (l) => { t.reset(l.current, l.previous, l.next); }, e[0] = t, e[1] = a) : a = e[1]; const [, o, c] = Ee(r, n, t.state, a); let u, f; e[2] !== c || e[3] !== o || e[4] !== t ? (u = () => c ? t.subscribe?.(() => { o(t.state); }) : void 0, f = [c, o, t], e[2] = c, e[3] = o, e[4] = t, e[5] = u, e[6] = f) : (u = e[5], f = e[6]), A(u, f); let m; return e[7] !== c || e[8] !== t ? (m = [t, c], e[7] = c, e[8] = t, e[9] = m) : m = e[9], m; } const yt = (r) => { const n = B(3), [s] = ie(ce); let e; return n[0] !== r || n[1] !== s ? (e = s?.find((a) => a.id === r) ?? null, n[0] = r, n[1] = s, n[2] = e) : e = n[2], e; }; function bt(r, n, s, e) { const t = B(9), a = v(!0), o = ae(), c = v(null), [u, f, m] = G(n, "useOnlineStatusSync-isNewWorkspaceView", !0); let l, g; return t[0] !== u || t[1] !== m || t[2] !== e || t[3] !== s || t[4] !== o || t[5] !== r || t[6] !== f ? (l = () => { !r || !m || !o.isLoaded || o?.onlineStatus === null || (o.onlineStatus.isOnline && (c.current !== o.onlineStatus.isOnline || a.current) ? s(u, a.current, o.onlineStatus.onlineCounter) : !o.onlineStatus.isOnline && (c.current !== o.onlineStatus.isOnline || a.current) && e(u, a.current, o.onlineStatus.onlineCounter), c.current = o.onlineStatus.isOnline, a.current = !1, u && queueMicrotask(() => f(!1))); }, g = [u, m, e, s, o, r, f], t[0] = u, t[1] = m, t[2] = e, t[3] = s, t[4] = o, t[5] = r, t[6] = f, t[7] = l, t[8] = g) : (l = t[7], g = t[8]), A(l, g), o?.onlineStatus?.isOnline === !0; } const me = window.electron ?? de, Z = ge("hooks"); var Qe = /* @__PURE__ */ ((r) => (r.PENDING = "pending", r.FRAME_KEYS_READY = "frameKeysReady", r.HISTORICAL_DATA_READY = "historicalDataReady", r.READY = "ready", r))(Qe || {}); const vt = (r, n, s) => { const e = B(20); let t; e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t = [], e[0] = t) : t = e[0]; const [a, o] = W(t); let c; e[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (c = [], e[1] = c) : c = e[1]; const [u, f] = G(r, `framesubscription-${n}`, c); let m; e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (m = /* @__PURE__ */ new Map(), e[2] = m) : m = e[2]; const l = v(m), g = v(!1); let i; e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (i = /* @__PURE__ */ new Map(), e[3] = i) : i = e[3]; const S = v(i); let b, D; e[4] !== s || e[5] !== f ? (b = () => { l.current.clear(), s.forEach(($) => { l.current.set(ne($), $); }), queueMicrotask(() => f(s.map(Ve))); }, D = [s, f], e[4] = s, e[5] = f, e[6] = b, e[7] = D) : (b = e[6], D = e[7]), A(b, D); const p = Fe(); let d, h; e[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (d = () => { const $ = new AbortController(); return me.ipcRenderer.invoke("mm-get-measurement-data-before-timestamp", Number.MAX_SAFE_INTEGER, De).then((M) => { $.signal.aborted || (M.length > 0 && M.forEach((x) => { const w = Ne(x), I = se(w), _ = S.current.get(I); _ ? S.current.set(I, Ie(_, [w])) : S.current.set(I, [w]); }), g.current = !0); }).catch((M) => { Z.error("Failed to get historical data:", M), g.current = !0; }), () => { $.abort(), g.current = !1; }; }, h = [], e[8] = d, e[9] = h) : (d = e[8], h = e[9]), A(d, h); let T; e[10] !== p.subscribedData ? (T = () => { if (!g.current) { re(S.current, p.subscribedData); return; } const $ = new Map(S.current); S.current.clear(), re($, p.subscribedData); const M = []; l.current.forEach((x, w) => { const I = x.sourceId === void 0 || x.sourceId === "", _ = x.tx === void 0, O = x.mux === void 0, L = []; for (const C of $.values()) { const F = C[0]; if (!F) continue; se(F, I, _, O, !0) === w && L.push(...C); } M.push(...L); }), M.sort(Ze), queueMicrotask(() => o(M)); }, e[10] = p.subscribedData, e[11] = T) : T = e[11]; let q; e[12] !== u || e[13] !== p ? (q = [u, p], e[12] = u, e[13] = p, e[14] = q) : q = e[14], A(T, q); const E = ae(); let P; e[15] !== E.isLoaded || e[16] !== E.onlineStatus?.isOnline ? (P = () => { E.isLoaded && E?.onlineStatus?.isOnline === !0 && queueMicrotask(() => o([])); }, e[15] = E.isLoaded, e[16] = E.onlineStatus?.isOnline, e[17] = P) : P = e[17]; let N; return e[18] !== E ? (N = [E], e[18] = E, e[19] = N) : N = e[19], A(P, N), a; }, Ft = (r, n, s) => { const e = B(20); let t; e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t = [], e[0] = t) : t = e[0]; const [a, o] = W(t); let c; e[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (c = [], e[1] = c) : c = e[1]; const [, u] = G(r, `framesubscription-${n}`, c); let f; e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (f = /* @__PURE__ */ new Map(), e[2] = f) : f = e[2]; const m = v(f); let l; e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (l = /* @__PURE__ */ new Map(), e[3] = l) : l = e[3]; const g = v(l), i = v( "pending" /* PENDING */ ); let S; e[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (S = /* @__PURE__ */ new Map(), e[4] = S) : S = e[4]; const b = v(S); let D, p; e[5] !== u || e[6] !== s ? (D = () => { const M = new AbortController(); return Re().then((x) => { if (M.signal.aborted) return; const w = []; m.current.clear(), g.current.clear(); for (let I = 0; I < s.length; I++) { const { qualifiedName: _, sourceId: O } = s[I], L = x.find((C) => (O === void 0 || O === "" || C.sourceIdentifiers.includes(O)) && C.signals.some((F) => F.qualifiedName === _)); if (L) { const C = L.signals.find((R) => R.qualifiedName === _); if (!C) continue; const F = _e.create({ id: L.id, sourceId: O, mux: C.multiplexValue }); L.canFrameFlags && (F.canFrameFlags = Ae.create(L.canFrameFlags), F.canFrameFlags.flags = F.canFrameFlags.flags.filter(Ge)); const y = ne(F); if (g.current.has(y)) { const R = g.current.get(y); R && !R.includes(_) && (R.push(_), g.current.set(y, R)); } else g.current.set(y, [_]), m.current.set(y, F); const U = w.find((R) => z(R.frameId, F)); U ? U.signalIds.includes(_) || U.signalIds.push(_) : w.push({ frameId: F, signalIds: [_] }); } } u(w), i.current === "pending" ? i.current = "frameKeysReady" : i.current === "historicalDataReady" && (i.current = "ready"); }).catch((x) => { Z.error("Failed to get frame definitions:", x), i.current === "pending" ? i.current = "frameKeysReady" : i.current === "historicalDataReady" && (i.current = "ready"); }), () => { M.abort(), i.current === "ready" ? i.current = "historicalDataReady" : i.current = "pending"; }; }, p = [s, u], e[5] = u, e[6] = s, e[7] = D, e[8] = p) : (D = e[7], p = e[8]), A(D, p); const d = Fe(); let h, T; e[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (h = () => { const M = new AbortController(); return Ke(Number.MAX_SAFE_INTEGER, De).then((x) => { M.signal.aborted || (x.length > 0 && x.forEach((w) => { const I = se(w), _ = b.current.get(I); _ ? b.current.set(I, Ie(_, [w])) : b.current.set(I, [w]); }), i.current === "pending" ? i.current = "historicalDataReady" : i.current === "frameKeysReady" && (i.current = "ready")); }).catch((x) => { Z.error("Failed to get historical data:", x), i.current === "pending" ? i.current = "historicalDataReady" : i.current === "frameKeysReady" && (i.current = "ready"); }), () => { M.abort(), i.current === "ready" ? i.current = "frameKeysReady" : i.current = "pending"; }; }, T = [], e[9] = h, e[10] = T) : (h = e[9], T = e[10]), A(h, T); let q; e[11] !== d.subscribedData ? (q = () => { if (i.current !== "ready") { re(b.current, d.subscribedData); return; } const M = new Map(b.current); b.current.clear(), re(M, d.subscribedData); const x = []; m.current.forEach((w, I) => { const _ = w.sourceId === void 0 || w.sourceId === "", O = w.tx === void 0, L = w.mux === void 0, C = []; for (const y of M.values()) { const U = y[0]; if (!U) continue; se(U, _, O, L, !0) === I && C.push(...y); } const F = g.current.get(I) ?? []; C.forEach((y) => { const U = F.map((R) => { const k = y.signalValues.find((j) => j.qualifiedName === R); return k ? { qualifiedName: k.qualifiedName, sourceId: y.sourceId, name: k.name, unit: k.unit, timeUs: y.timeUs, doubleValue: k.doubleValue, stringValue: k.stringValue } : null; }); x.push(...U.filter(et)); }); }), x.sort(tt), queueMicrotask(() => o(x)); }, e[11] = d.subscribedData, e[12] = q) : q = e[12]; let E; e[13] !== d ? (E = [d], e[13] = d, e[14] = E) : E = e[14], A(q, E); const P = ae(); let N; e[15] !== P.isLoaded || e[16] !== P.onlineStatus?.isOnline ? (N = () => { P.isLoaded && P?.onlineStatus?.isOnline === !0 && queueMicrotask(() => o([])); }, e[15] = P.isLoaded, e[16] = P.onlineStatus?.isOnline, e[17] = N) : N = e[17]; let $; return e[18] !== P ? ($ = [P], e[18] = P, e[19] = $) : $ = e[19], A(N, $), a; }, Dt = (r, n, s, e) => { const t = B(40); let a; t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (a = [], t[0] = a) : a = t[0]; const [o, c] = W(a); let u; t[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (u = [], t[1] = u) : u = t[1]; const [, f] = G(r, `framesubscription-${n}`, u); let m; t[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (m = { windowUs: 3e7, width: 1e3 }, t[2] = m) : m = t[2]; const [, l] = Ee(r, `envelopeviewwidth-${n}`, m); let g, i; t[3] !== l || t[4] !== e.endTimeUs || t[5] !== e.startTimeUs || t[6] !== e.width || t[7] !== e.windowUs ? (g = () => { const I = { windowUs: e.windowUs ?? (e.endTimeUs !== void 0 && e.startTimeUs !== void 0 ? e.endTimeUs - e.startTimeUs : 3e7), width: e.width ?? 1e3 }; queueMicrotask(() => l(I)); }, i = [l, e.endTimeUs, e.windowUs, e.startTimeUs, e.width], t[3] = l, t[4] = e.endTimeUs, t[5] = e.startTimeUs, t[6] = e.width, t[7] = e.windowUs, t[8] = g, t[9] = i) : (g = t[8], i = t[9]), A(g, i); let S; t[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (S = /* @__PURE__ */ new Map(), t[10] = S) : S = t[10]; const b = v(S); let D; t[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (D = /* @__PURE__ */ new Map(), t[11] = D) : D = t[11]; const p = v(D), [d, h] = W(!1); let T, q; t[12] !== f || t[13] !== s ? (T = () => { const I = new AbortController(); return queueMicrotask(() => h(!1)), Re().then((_) => { if (I.signal.aborted) return; const O = [], L = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new Map(); for (let F = 0; F < s.length; F++) { const { qualifiedName: y, sourceId: U } = s[F], R = _.find((k) => (U === void 0 || U === "" || k.sourceIdentifiers.includes(U)) && k.signals.some((j) => j.qualifiedName === y)); if (R) { const k = R.signals.find((K) => K.qualifiedName === y); if (!k) continue; const j = _e.create({ id: R.id, sourceId: U, mux: k.multiplexValue }); R.canFrameFlags && (j.canFrameFlags = Ae.create(R.canFrameFlags), j.canFrameFlags.flags = j.canFrameFlags.flags.filter(rt)); const J = ne(j); if (L.has(J)) { const K = L.get(J); K && !K.includes(y) && (K.push(y), L.set(J, K)); } else L.set(J, [y]); C.set(J, j); const X = O.find((K) => z(K.frameId, j)); X ? X.signalIds.includes(y) || X.signalIds.push(y) : O.push({ frameId: j, signalIds: [y] }); } } f((F) => z(F, O) ? F : O), b.current = L, p.current = C, h(!0); }).catch((_) => { I.signal.aborted || (Z.error("Failed to get frame definitions:", _), b.current = /* @__PURE__ */ new Map(), p.current = /* @__PURE__ */ new Map(), f([]), h(!0)); }), () => { I.abort(); }; }, q = [s, f], t[12] = f, t[13] = s, t[14] = T, t[15] = q) : (T = t[14], q = t[15]), A(T, q); let E, P; t[16] !== d || t[17] !== r || t[18] !== e.endTimeUs || t[19] !== e.startTimeUs ? (P = () => { if (!d || e.startTimeUs !== void 0 && e.endTimeUs !== void 0) return; queueMicrotask(() => c([])); const I = new AbortController(), _ = me.ipcRenderer.on(`mm-new-frames-envelopes-for-pane-${r}`, (O, L) => { if (!I.signal.aborted) { if (L.length === 0) { c([]); return; } c((C) => { let F = !1; const y = [...C]; return L.forEach((U) => { U.envelopes.size !== 0 && U.envelopes.forEach((R, k) => { const j = ne(U.frameId); if (!b.current.get(j)?.includes(k)) return; const X = y.findIndex((K) => K.qualifiedName === k && K.sourceId === U.frameId.sourceId); X !== -1 && y.splice(X, 1), y.push({ qualifiedName: k, sourceId: U.frameId.sourceId, timeUs: Array.from(R.timeUs), min: Array.from(R.min), max: Array.from(R.max) }), F = !0; }); }), F ? y : C; }); } }); return () => { I.abort(), _(); }; }, E = [d, r, e.endTimeUs, e.startTimeUs], t[16] = d, t[17] = r, t[18] = e.endTimeUs, t[19] = e.startTimeUs, t[20] = E, t[21] = P) : (E = t[20], P = t[21]), A(P, E); let N; t[22] !== d || t[23] !== r || t[24] !== e.endTimeUs || t[25] !== e.startTimeUs || t[26] !== e.width ? (N = () => { if (!d || e.startTimeUs === void 0 || e.endTimeUs === void 0) return; const I = new AbortController(), _ = setTimeout(() => { me.ipcRenderer.invoke("mm-get-frames-envelopes-for-pane", r, e.startTimeUs, e.endTimeUs, e.width).then((O) => { I.signal.aborted || c((L) => { let C = !1; const F = [...L]; return O.forEach((y) => { if (y.envelopes.size === 0) return; let U = ""; p.current.forEach((R, k) => { je(R, y.frameId) && (U = k); }), U !== "" && y.envelopes.forEach((R, k) => { if (!b.current.get(U)?.includes(k)) return; const J = p.current.get(U)?.sourceId, X = F.findIndex((K) => K.qualifiedName === k && K.sourceId === J); X !== -1 && F.splice(X, 1), F.push({ qualifiedName: k, sourceId: J, timeUs: Array.from(R.timeUs), min: Array.from(R.min), max: Array.from(R.max) }), C = !0; }); }), C ? F : L; }); }).catch((O) => { Z.error(`Failed to get signal data envelopes for pane ${r}:`, O); }); }, 200); return () => { clearTimeout(_), I.abort(); }; }, t[22] = d, t[23] = r, t[24] = e.endTimeUs, t[25] = e.startTimeUs, t[26] = e.width, t[27] = N) : N = t[27]; let $; t[28] !== d || t[29] !== r || t[30] !== e.endTimeUs || t[31] !== e.forceUpdateCounter || t[32] !== e.startTimeUs || t[33] !== e.width ? ($ = [d, r, e.endTimeUs, e.startTimeUs, e.width, e.forceUpdateCounter], t[28] = d, t[29] = r, t[30] = e.endTimeUs, t[31] = e.forceUpdateCounter, t[32] = e.startTimeUs, t[33] = e.width, t[34] = $) : $ = t[34], A(N, $); const M = ae(); let x; t[35] !== M.isLoaded || t[36] !== M.onlineStatus?.isOnline ? (x = () => { M.isLoaded && M?.onlineStatus?.isOnline === !0 && queueMicrotask(() => c([])); }, t[35] = M.isLoaded, t[36] = M.onlineStatus?.isOnline, t[37] = x) : x = t[37]; let w; return t[38] !== M ? (w = [M], t[38] = M, t[39] = w) : w = t[39], A(x, w), o; }; function Ve(r) { return { frameId: r, signalIds: [] }; } function Ze(r, n) { return r.timeUs.compare(n.timeUs); } function Ge(r) { return r !== xe.CAN_FRAME_FLAG_FD_BRS; } function et(r) { return r !== null; } function tt(r, n) { return r.timeUs.compare(n.timeUs); } function rt(r) { return r !== xe.CAN_FRAME_FLAG_FD_BRS; } export { De as MAX_HISTORICAL_FRAMES, Qe as SignalDataInitState, He as calculateMaxActiveProjectDataIntervals, Ce as calculateMaxActiveSessionDataIntervals, Rt as calculateOverallStatusLevel, _t as calculateOverallStatusLevelFromBusStatus, At as extractProtocolsFromSources, ve as filterLogFileFormats, we as limitBuffer, Ie as mergeAndDeduplicateFrames, he as mergeData, re as mergeFrameDataMaps, Be as performRedo, Je as performSet, ze as performUndo, be as useAvailableProtocols, xt as useCombinedMeasurementTraceData, lt as useDevices, We as useDevicesState, Ut as useFixedPositionModeMeasurementData, Tt as useIsOnline, wt as useLanguage, Lt as useLocalizedStrings, ft as useLogMessages, kt as useMaxDataBytes, Ct as useMeasurementSetup, Et as useMeasurementSetupState, Pt as useMeasurementStatus, $t as useMeasurementStatusState, vt as useMessageData, Ot as useMessageDatabases, mt as useMessageLogFileFormats, qt as useNewMeasurementData, Nt as useNodeStatus, jt as useNumericRadix, Kt as useOnlineStatus, bt as useOnlineStatusSync, Wt as useOverallStatusLevel, pt as useProjectData, G as useProjectDataSlice, zt as useRecentProjectFiles, Bt as useRunningPeriodicTransmissions, Jt as useScrollModeMeasurementData, St as useSessionData, Ee as useSessionDataSlice, Ft as useSignalData, Dt as useSignalDataEnvelopes, dt as useSignalLogFileFormats, gt as useUndo, Le as useUndoRef, ht as useUndoSessionDataSlice, Xt as useUserSettings, yt as useWorkspacePaneWithId };