@seedtactics/insight-client 17.0.1 → 17.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -2
- package/dist/assets/ProgramHighlight-C5uXGNDz.js +3 -0
- package/dist/assets/index-BfycE-BU.js +366 -0
- package/dist/cell-status/current-status.js +44 -51
- package/dist/cell-status/loading.d.ts +2 -4
- package/dist/cell-status/loading.js +6 -7
- package/dist/components/station-monitor/BasketLoadStationWork.js +19 -1
- package/dist/extension.d.ts +1 -1
- package/dist/extension.js +1 -1
- package/dist/fms-insight-api.json +4738 -0
- package/dist/index.html +1 -1
- package/dist/network/api.d.ts +2 -0
- package/dist/network/api.js +2 -0
- package/dist/network/backend.d.ts +2 -2
- package/dist/network/current-status-session.d.ts +27 -0
- package/dist/network/current-status-session.js +65 -0
- package/dist/network/websocket.d.ts +3 -0
- package/dist/network/websocket.js +76 -25
- package/package.json +12 -11
- package/dist/assets/ProgramHighlight-mKbZxoXO.js +0 -3
- package/dist/assets/index-CfHZxY5F.js +0 -367
package/dist/index.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<link rel="shortcut icon" href="/assets/favicon-gWFxiJK2.ico" />
|
|
7
7
|
<title>SeedTactic FMS Insight</title>
|
|
8
8
|
<style type="text/css">.download-loader{width:100px;height:100px;display:inline-block}.download-circular{width:100px;height:100px;animation:2s linear infinite rotate}.download-path{stroke-dasharray:1 200;stroke-dashoffset:0;stroke-linecap:round;stroke:#8d6e63;animation:1.5s ease-out infinite dash}@keyframes rotate{to{transform:rotate(360deg)}}@keyframes dash{0%{stroke-dasharray:1 200;stroke-dashoffset:0}50%{stroke-dasharray:89 200;stroke-dashoffset:-35px}to{stroke-dasharray:89 200;stroke-dashoffset:-124px}}</style>
|
|
9
|
-
<script type="module" crossorigin src="/assets/index-
|
|
9
|
+
<script type="module" crossorigin src="/assets/index-BfycE-BU.js"></script>
|
|
10
10
|
<link rel="stylesheet" crossorigin href="/assets/index-DXfAwuj-.css">
|
|
11
11
|
</head>
|
|
12
12
|
<body>
|
package/dist/network/api.d.ts
CHANGED
|
@@ -695,6 +695,7 @@ export interface INewProgramContent {
|
|
|
695
695
|
revision: number;
|
|
696
696
|
}
|
|
697
697
|
export declare class CurrentStatus implements ICurrentStatus {
|
|
698
|
+
revision: number;
|
|
698
699
|
timeOfCurrentStatusUTC: Date;
|
|
699
700
|
jobs: {
|
|
700
701
|
[key: string]: ActiveJob;
|
|
@@ -719,6 +720,7 @@ export declare class CurrentStatus implements ICurrentStatus {
|
|
|
719
720
|
toJSON(data?: any): any;
|
|
720
721
|
}
|
|
721
722
|
export interface ICurrentStatus {
|
|
723
|
+
revision: number;
|
|
722
724
|
timeOfCurrentStatusUTC: Date;
|
|
723
725
|
jobs: {
|
|
724
726
|
[key: string]: ActiveJob;
|
package/dist/network/api.js
CHANGED
|
@@ -3600,6 +3600,7 @@ export class CurrentStatus {
|
|
|
3600
3600
|
}
|
|
3601
3601
|
init(_data) {
|
|
3602
3602
|
if (_data) {
|
|
3603
|
+
this.revision = _data["Revision"];
|
|
3603
3604
|
this.timeOfCurrentStatusUTC = _data["TimeOfCurrentStatusUTC"]
|
|
3604
3605
|
? new Date(_data["TimeOfCurrentStatusUTC"].toString())
|
|
3605
3606
|
: undefined;
|
|
@@ -3670,6 +3671,7 @@ export class CurrentStatus {
|
|
|
3670
3671
|
}
|
|
3671
3672
|
toJSON(data) {
|
|
3672
3673
|
data = typeof data === "object" ? data : {};
|
|
3674
|
+
data["Revision"] = this.revision;
|
|
3673
3675
|
data["TimeOfCurrentStatusUTC"] = this.timeOfCurrentStatusUTC
|
|
3674
3676
|
? this.timeOfCurrentStatusUTC.toISOString()
|
|
3675
3677
|
: undefined;
|
|
@@ -3,7 +3,7 @@ import { User } from "oidc-client-ts";
|
|
|
3
3
|
export interface JobAPI {
|
|
4
4
|
history(startUTC: Date, endUTC: Date): Promise<Readonly<api.IHistoricData>>;
|
|
5
5
|
recent(startUTC: Date, alreadyKnownSchIds: string[]): Promise<Readonly<api.IRecentHistoricData>>;
|
|
6
|
-
currentStatus(): Promise<Readonly<api.ICurrentStatus>>;
|
|
6
|
+
currentStatus(signal?: AbortSignal): Promise<Readonly<api.ICurrentStatus>>;
|
|
7
7
|
setJobComment(unique: string, comment: string): Promise<void>;
|
|
8
8
|
removeMaterialFromAllQueues(materialId: number, operatorName: string | undefined): Promise<void>;
|
|
9
9
|
bulkRemoveMaterialFromQueues(operatorName: string | null, materialIds: ReadonlyArray<number> | null): Promise<void>;
|
|
@@ -25,7 +25,7 @@ export interface FmsAPI {
|
|
|
25
25
|
}
|
|
26
26
|
export interface LogAPI {
|
|
27
27
|
get(startUTC: Date, endUTC: Date, signal?: AbortSignal): Promise<ReadonlyArray<Readonly<api.ILogEntry>>>;
|
|
28
|
-
recent(lastSeenCounter: number, expectedEndUTCofLastSeen: Date | null | undefined): Promise<ReadonlyArray<Readonly<api.ILogEntry>>>;
|
|
28
|
+
recent(lastSeenCounter: number, expectedEndUTCofLastSeen: Date | null | undefined, signal?: AbortSignal): Promise<ReadonlyArray<Readonly<api.ILogEntry>>>;
|
|
29
29
|
logForMaterial(materialID: number, signal?: AbortSignal): Promise<ReadonlyArray<Readonly<api.ILogEntry>>>;
|
|
30
30
|
logForMaterials(materialIDs: ReadonlyArray<number> | null | undefined): Promise<ReadonlyArray<Readonly<api.ILogEntry>>>;
|
|
31
31
|
logForSerial(serial: string, signal?: AbortSignal): Promise<ReadonlyArray<Readonly<api.ILogEntry>>>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type Getter } from "jotai";
|
|
2
|
+
import type { ICurrentStatus } from "./api.js";
|
|
3
|
+
type CurrentStatusSession = {
|
|
4
|
+
readonly id: number;
|
|
5
|
+
readonly open: boolean;
|
|
6
|
+
readonly snapshot: {
|
|
7
|
+
readonly status: Readonly<ICurrentStatus>;
|
|
8
|
+
readonly source: "http" | "socket";
|
|
9
|
+
} | null;
|
|
10
|
+
};
|
|
11
|
+
export declare const currentStatusSessionAtom: import("jotai").PrimitiveAtom<CurrentStatusSession> & {
|
|
12
|
+
init: CurrentStatusSession;
|
|
13
|
+
};
|
|
14
|
+
export declare const currentStatusIsLiveRW: import("jotai").PrimitiveAtom<boolean> & {
|
|
15
|
+
init: boolean;
|
|
16
|
+
};
|
|
17
|
+
export declare const errorLoadingStatusRW: import("jotai").PrimitiveAtom<string | null> & {
|
|
18
|
+
init: string | null;
|
|
19
|
+
};
|
|
20
|
+
export declare function isCurrentSession(get: Getter, session: number): boolean;
|
|
21
|
+
export declare const onLoadCurrentSt: import("jotai").WritableAtom<null, [status: Readonly<ICurrentStatus>], void> & {
|
|
22
|
+
init: null;
|
|
23
|
+
};
|
|
24
|
+
export declare const acceptCurrentStatusSnapshot: import("jotai").WritableAtom<null, [session: number, status: Readonly<ICurrentStatus>, source: "http" | "socket"], boolean> & {
|
|
25
|
+
init: null;
|
|
26
|
+
};
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/* Copyright (c) 2021, John Lenz
|
|
2
|
+
|
|
3
|
+
All rights reserved.
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
* Redistributions of source code must retain the above copyright
|
|
9
|
+
notice, this list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
* Redistributions in binary form must reproduce the above
|
|
12
|
+
copyright notice, this list of conditions and the following
|
|
13
|
+
disclaimer in the documentation and/or other materials provided
|
|
14
|
+
with the distribution.
|
|
15
|
+
|
|
16
|
+
* Neither the name of John Lenz, Black Maple Software, SeedTactics,
|
|
17
|
+
nor the names of other contributors may be used to endorse or
|
|
18
|
+
promote products derived from this software without specific
|
|
19
|
+
prior written permission.
|
|
20
|
+
|
|
21
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
22
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
23
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
24
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
25
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
26
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
27
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
28
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
29
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
30
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
31
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
32
|
+
*/
|
|
33
|
+
import { atom } from "jotai";
|
|
34
|
+
import { setCurrentStatus } from "../cell-status/current-status.js";
|
|
35
|
+
import { replaceCustomState } from "../cell-status/custom-state.js";
|
|
36
|
+
import { setNamesFromCurrentStatus } from "../cell-status/names.js";
|
|
37
|
+
export const currentStatusSessionAtom = atom({
|
|
38
|
+
id: 0,
|
|
39
|
+
open: false,
|
|
40
|
+
snapshot: null,
|
|
41
|
+
});
|
|
42
|
+
export const currentStatusIsLiveRW = atom(false);
|
|
43
|
+
export const errorLoadingStatusRW = atom(null);
|
|
44
|
+
export function isCurrentSession(get, session) {
|
|
45
|
+
return get(currentStatusSessionAtom).id === session;
|
|
46
|
+
}
|
|
47
|
+
// Raw replacement also serves offline fixtures and local rollbacks. Live server snapshots must
|
|
48
|
+
// use acceptCurrentStatusSnapshot so the display and its comparison revision move together.
|
|
49
|
+
export const onLoadCurrentSt = atom(null, (_, set, status) => {
|
|
50
|
+
set(setCurrentStatus, status);
|
|
51
|
+
set(replaceCustomState, status.customState ?? null);
|
|
52
|
+
set(setNamesFromCurrentStatus, status);
|
|
53
|
+
});
|
|
54
|
+
export const acceptCurrentStatusSnapshot = atom(null, (get, set, session, status, source) => {
|
|
55
|
+
const current = get(currentStatusSessionAtom);
|
|
56
|
+
const installed = current.snapshot?.status;
|
|
57
|
+
if (current.id !== session || (installed && status.revision <= installed.revision))
|
|
58
|
+
return false;
|
|
59
|
+
set(onLoadCurrentSt, status);
|
|
60
|
+
set(currentStatusSessionAtom, { ...current, snapshot: { status, source } });
|
|
61
|
+
if (current.open)
|
|
62
|
+
set(currentStatusIsLiveRW, true);
|
|
63
|
+
set(errorLoadingStatusRW, null);
|
|
64
|
+
return true;
|
|
65
|
+
});
|
|
@@ -2,4 +2,7 @@ import { Atom } from "jotai";
|
|
|
2
2
|
export declare const websocketReconnecting: Atom<boolean>;
|
|
3
3
|
export declare const currentStatusIsLive: Atom<boolean>;
|
|
4
4
|
export declare const errorLoadingLast30: Atom<string | null>;
|
|
5
|
+
export declare const refreshCurrentStatus: import("jotai").WritableAtom<null, [signal?: AbortSignal | undefined], Promise<boolean>> & {
|
|
6
|
+
init: null;
|
|
7
|
+
};
|
|
5
8
|
export declare function WebsocketConnection(): null;
|
|
@@ -30,14 +30,16 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
30
30
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
31
31
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
32
32
|
*/
|
|
33
|
+
import { acceptCurrentStatusSnapshot, currentStatusSessionAtom, currentStatusIsLiveRW, errorLoadingStatusRW, isCurrentSession, } from "./current-status-session.js";
|
|
33
34
|
import { ServerEvent } from "./api.js";
|
|
34
35
|
import { apiErrorMessage } from "./api-errors.js";
|
|
35
36
|
import { JobsBackend, LogBackend } from "./backend.js";
|
|
36
37
|
import { fmsInformation } from "./server-settings.js";
|
|
37
38
|
import { useEffect, useRef } from "react";
|
|
38
|
-
import { lastEventCounter,
|
|
39
|
+
import { lastEventCounter, onLoadLast30Jobs, onLoadLast30Log, onLiveServerEvent, onHistoricalServerEvent, } from "../cell-status/loading.js";
|
|
39
40
|
import { addDays } from "date-fns";
|
|
40
41
|
import { last30SchIds } from "../cell-status/scheduled-jobs.js";
|
|
42
|
+
import { currentStatus } from "../cell-status/current-status.js";
|
|
41
43
|
import { HashSet, OrderedMap } from "@seedtactics/immutable-collections";
|
|
42
44
|
import { atom, useAtomValue, useSetAtom } from "jotai";
|
|
43
45
|
const websocketReconnectingAtom = atom(false);
|
|
@@ -45,9 +47,7 @@ export const websocketReconnecting = websocketReconnectingAtom;
|
|
|
45
47
|
// True while the websocket is open and this connection has loaded or received a current status, so
|
|
46
48
|
// the retained current status reflects the server. Loading the historical jobs and log does not
|
|
47
49
|
// affect it.
|
|
48
|
-
const currentStatusIsLiveRW = atom(false);
|
|
49
50
|
export const currentStatusIsLive = currentStatusIsLiveRW;
|
|
50
|
-
const websocketSessionAtom = atom({ id: 0, statusFromSocket: false });
|
|
51
51
|
// Only historical effects wait for HTTP catch-up. A fresh session discards its predecessor's
|
|
52
52
|
// unapplied buffer and reloads from lastEventCounter, which has not advanced past that history.
|
|
53
53
|
const bufferedLogAtom = atom(null);
|
|
@@ -56,22 +56,67 @@ const bufferedLogAtom = atom(null);
|
|
|
56
56
|
const loadedLogCountersAtom = atom(HashSet.empty());
|
|
57
57
|
const errorLoadingLast30RW = atom(null);
|
|
58
58
|
const errorLoadingLogRW = atom(null);
|
|
59
|
-
export const errorLoadingLast30 = atom((get) => get(errorLoadingLast30RW) ?? get(errorLoadingLogRW));
|
|
60
|
-
function
|
|
61
|
-
|
|
59
|
+
export const errorLoadingLast30 = atom((get) => get(errorLoadingStatusRW) ?? get(errorLoadingLast30RW) ?? get(errorLoadingLogRW));
|
|
60
|
+
async function loadCurrentStatus(get, set, session, signal) {
|
|
61
|
+
while (isCurrentSession(get, session)) {
|
|
62
|
+
const before = get(currentStatus);
|
|
63
|
+
const snapshot = get(currentStatusSessionAtom).snapshot;
|
|
64
|
+
let st;
|
|
65
|
+
try {
|
|
66
|
+
signal?.throwIfAborted();
|
|
67
|
+
st = await JobsBackend.currentStatus(signal);
|
|
68
|
+
signal?.throwIfAborted();
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
const current = get(currentStatusSessionAtom);
|
|
72
|
+
if (current.id !== session)
|
|
73
|
+
return false;
|
|
74
|
+
if (!signal?.aborted &&
|
|
75
|
+
current.snapshot !== snapshot &&
|
|
76
|
+
current.snapshot?.source === "socket")
|
|
77
|
+
return true;
|
|
78
|
+
throw error;
|
|
79
|
+
}
|
|
80
|
+
const current = get(currentStatusSessionAtom);
|
|
81
|
+
if (current.id !== session)
|
|
82
|
+
return false;
|
|
83
|
+
const installed = current.snapshot?.status;
|
|
84
|
+
if (installed && st.revision <= installed.revision)
|
|
85
|
+
return true;
|
|
86
|
+
// A higher server revision can replace an intervening complete snapshot, but a log edit or
|
|
87
|
+
// optimistic local edit still needs a fresh read rather than being overwritten.
|
|
88
|
+
if (get(currentStatus) !== before && get(currentStatus) !== installed)
|
|
89
|
+
continue;
|
|
90
|
+
set(acceptCurrentStatusSnapshot, session, st, "http");
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
return false;
|
|
62
94
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
95
|
+
// Every caller starts its own read, after its action has settled. Session ownership stays here.
|
|
96
|
+
export const refreshCurrentStatus = atom(null, (get, set, signal) => loadCurrentStatus(get, set, get(currentStatusSessionAtom).id, signal));
|
|
97
|
+
async function loadBootstrapStatus(get, set, session, retryDelay = 1000) {
|
|
98
|
+
try {
|
|
99
|
+
await loadCurrentStatus(get, set, session, AbortSignal.timeout(10000));
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
if (!isCurrentSession(get, session) || get(currentStatusIsLiveRW))
|
|
67
103
|
return;
|
|
68
|
-
set(
|
|
69
|
-
|
|
70
|
-
|
|
104
|
+
set(errorLoadingStatusRW, apiErrorMessage(error, "Error loading current status"));
|
|
105
|
+
setTimeout(() => {
|
|
106
|
+
if (isCurrentSession(get, session) && !get(currentStatusIsLiveRW)) {
|
|
107
|
+
void loadBootstrapStatus(get, set, session, Math.min(retryDelay * 2, 30000));
|
|
108
|
+
}
|
|
109
|
+
}, retryDelay);
|
|
110
|
+
}
|
|
71
111
|
}
|
|
72
112
|
function loadHistory(get, set, session, from, retryDelay = 1000) {
|
|
73
113
|
const now = new Date();
|
|
74
|
-
|
|
114
|
+
// Initial history can be much larger than status. Bound both headers and body reads, then
|
|
115
|
+
// retry from the same applied position while retaining buffered socket events.
|
|
116
|
+
const signal = AbortSignal.timeout(120000);
|
|
117
|
+
const request = from === null
|
|
118
|
+
? LogBackend.get(addDays(now, -30), now, signal)
|
|
119
|
+
: LogBackend.recent(from, undefined, signal);
|
|
75
120
|
return request.then((log) => {
|
|
76
121
|
if (!isCurrentSession(get, session))
|
|
77
122
|
return;
|
|
@@ -84,7 +129,9 @@ function loadHistory(get, set, session, from, retryDelay = 1000) {
|
|
|
84
129
|
}, (e) => {
|
|
85
130
|
if (!isCurrentSession(get, session))
|
|
86
131
|
return;
|
|
87
|
-
set(errorLoadingLogRW,
|
|
132
|
+
set(errorLoadingLogRW, signal.aborted
|
|
133
|
+
? "Loading log history timed out."
|
|
134
|
+
: apiErrorMessage(e, "Error loading log history"));
|
|
88
135
|
// Keep buffering and retry from the same applied position without interrupting live status.
|
|
89
136
|
setTimeout(() => {
|
|
90
137
|
if (isCurrentSession(get, session)) {
|
|
@@ -96,7 +143,7 @@ function loadHistory(get, set, session, from, retryDelay = 1000) {
|
|
|
96
143
|
function loadConnection(get, set, session) {
|
|
97
144
|
const from = get(lastEventCounter);
|
|
98
145
|
const schIds = get(last30SchIds);
|
|
99
|
-
const curStProm =
|
|
146
|
+
const curStProm = loadBootstrapStatus(get, set, session);
|
|
100
147
|
const jobsProm = JobsBackend.recent(addDays(new Date(), -30), from !== null && schIds ? Array.from(schIds) : []).then((j) => {
|
|
101
148
|
if (isCurrentSession(get, session))
|
|
102
149
|
set(onLoadLast30Jobs, j);
|
|
@@ -169,12 +216,13 @@ class ReconnectingWebsocket {
|
|
|
169
216
|
}
|
|
170
217
|
}
|
|
171
218
|
const onOpenAtom = atom(null, (get, set) => {
|
|
172
|
-
const session = get(
|
|
173
|
-
set(
|
|
219
|
+
const session = get(currentStatusSessionAtom).id + 1;
|
|
220
|
+
set(currentStatusSessionAtom, { id: session, open: true, snapshot: null });
|
|
174
221
|
set(websocketReconnectingAtom, true);
|
|
175
222
|
set(currentStatusIsLiveRW, false);
|
|
176
223
|
set(errorLoadingLast30RW, null);
|
|
177
224
|
set(errorLoadingLogRW, null);
|
|
225
|
+
set(errorLoadingStatusRW, null);
|
|
178
226
|
set(bufferedLogAtom, OrderedMap.empty());
|
|
179
227
|
loadConnection(get, set, session);
|
|
180
228
|
return session;
|
|
@@ -186,16 +234,23 @@ const onCloseAtom = atom(null, (get, set, session, reconnecting) => {
|
|
|
186
234
|
set(websocketReconnectingAtom, true);
|
|
187
235
|
if (session === null || !isCurrentSession(get, session))
|
|
188
236
|
return;
|
|
189
|
-
set(
|
|
237
|
+
set(currentStatusSessionAtom, { id: session + 1, open: false, snapshot: null });
|
|
190
238
|
set(currentStatusIsLiveRW, false);
|
|
191
239
|
set(bufferedLogAtom, null);
|
|
192
240
|
});
|
|
193
241
|
const onMessageAtom = atom(null, (get, set, evt, session) => {
|
|
194
242
|
if (session === null || !isCurrentSession(get, session))
|
|
195
243
|
return;
|
|
196
|
-
const
|
|
244
|
+
const received = ServerEvent.fromJS(JSON.parse(evt.data));
|
|
245
|
+
const status = received.newCurrentStatus;
|
|
246
|
+
const accepted = status && set(acceptCurrentStatusSnapshot, session, status, "socket");
|
|
247
|
+
const serverEvt = status && !accepted
|
|
248
|
+
? new ServerEvent({ logEntry: received.logEntry, newJobs: received.newJobs })
|
|
249
|
+
: received;
|
|
197
250
|
const eventAndTime = { evt: serverEvt, now: new Date(), expire: true };
|
|
198
|
-
|
|
251
|
+
// Complete snapshots were installed above; standalone log edits still apply immediately.
|
|
252
|
+
if (!serverEvt.newCurrentStatus)
|
|
253
|
+
set(onLiveServerEvent, eventAndTime);
|
|
199
254
|
const log = serverEvt.logEntry;
|
|
200
255
|
const buffered = get(bufferedLogAtom);
|
|
201
256
|
if (!log || !get(loadedLogCountersAtom).has(log.counter)) {
|
|
@@ -206,10 +261,6 @@ const onMessageAtom = atom(null, (get, set, evt, session) => {
|
|
|
206
261
|
set(onHistoricalServerEvent, eventAndTime);
|
|
207
262
|
}
|
|
208
263
|
}
|
|
209
|
-
if (serverEvt.newCurrentStatus) {
|
|
210
|
-
set(websocketSessionAtom, { id: session, statusFromSocket: true });
|
|
211
|
-
set(currentStatusIsLiveRW, true);
|
|
212
|
-
}
|
|
213
264
|
});
|
|
214
265
|
export function WebsocketConnection() {
|
|
215
266
|
const onOpen = useSetAtom(onOpenAtom);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seedtactics/insight-client",
|
|
3
|
-
"version": "17.0.
|
|
3
|
+
"version": "17.0.3",
|
|
4
4
|
"license": "BSD-3-Clause",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://github.com/SeedTactics/fms-insight"
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
],
|
|
12
12
|
"type": "module",
|
|
13
13
|
"exports": {
|
|
14
|
+
"./openapi.json": "./dist/fms-insight-api.json",
|
|
14
15
|
"./extension": "./dist/extension.js",
|
|
15
16
|
"./cell-status/*": "./dist/cell-status/*.js",
|
|
16
17
|
"./components/*": "./dist/components/*.js",
|
|
@@ -62,19 +63,19 @@
|
|
|
62
63
|
"@types/react": "^19.3.0",
|
|
63
64
|
"@types/react-dom": "^19.3.0",
|
|
64
65
|
"@vitejs/plugin-react": "^6.1.2",
|
|
65
|
-
"@vitest/browser-playwright": "^5.0.
|
|
66
|
+
"@vitest/browser-playwright": "^5.0.5",
|
|
66
67
|
"jotai": "^3.0.1",
|
|
67
|
-
"jsdom": "^30.1.
|
|
68
|
+
"jsdom": "^30.1.3",
|
|
68
69
|
"nswag": "^14.7.1",
|
|
69
|
-
"oxfmt": "^0.
|
|
70
|
-
"oxlint": "^1.
|
|
70
|
+
"oxfmt": "^0.74.0",
|
|
71
|
+
"oxlint": "^1.89.0",
|
|
71
72
|
"oxlint-tsgolint": "^7.0.2004",
|
|
72
|
-
"playwright": "^1.64.
|
|
73
|
-
"react": "^19.3.
|
|
74
|
-
"react-dom": "^19.3.
|
|
73
|
+
"playwright": "^1.64.1",
|
|
74
|
+
"react": "^19.3.1",
|
|
75
|
+
"react-dom": "^19.3.1",
|
|
75
76
|
"typescript": "^7.0.2",
|
|
76
|
-
"vite": "^8.3.
|
|
77
|
-
"vitest": "^5.0.
|
|
77
|
+
"vite": "^8.3.5",
|
|
78
|
+
"vitest": "^5.0.5",
|
|
78
79
|
"vitest-browser-react": "^2.3.0"
|
|
79
80
|
},
|
|
80
81
|
"peerDependencies": {
|
|
@@ -86,7 +87,7 @@
|
|
|
86
87
|
"type-check": "tsc --noEmit --skipLibCheck",
|
|
87
88
|
"lint": "oxlint --type-aware",
|
|
88
89
|
"build": "vite build",
|
|
89
|
-
"build:package": "tsc --project tsconfig.publish.json && cp -Tr ../../docs ./docs",
|
|
90
|
+
"build:package": "tsc --project tsconfig.publish.json && cp ../../server/fms-insight-api.json ./dist/fms-insight-api.json && cp -Tr ../../docs ./docs",
|
|
90
91
|
"start": "vite",
|
|
91
92
|
"test:unit": "vitest run --project unit",
|
|
92
93
|
"test:integration": "vitest run --browser.headless --project integration",
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
(function(){var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(/* @__PURE__ */ ((n,r,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n)))((/* @__PURE__ */ o(((e,t)=>{function n(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw Error(`map is read-only`)}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw Error(`set is read-only`)}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{let r=e[t],i=typeof r;(i===`object`||i===`function`)&&!Object.isFrozen(r)&&n(r)}),e}var r=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function i(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function a(e,...t){let n=Object.create(null);for(let t in e)n[t]=e[t];return t.forEach(function(e){for(let t in e)n[t]=e[t]}),n}let o=e=>!!e.scope,s=(e,{prefix:t})=>{if(e.startsWith(`language:`))return e.replace(`language:`,`language-`);if(e.includes(`.`)){let n=e.split(`.`);return[`${t}${n.shift()}`,...n.map((e,t)=>`${e}${`_`.repeat(t+1)}`)].join(` `)}return`${t}${e}`};var c=class{constructor(e,t){this.buffer=``,this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=i(e)}openNode(e){if(!o(e))return;let t=s(e.scope,{prefix:this.classPrefix});this.span(t)}closeNode(e){o(e)&&(this.buffer+=`</span>`)}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}};let l=(e={})=>{let t={children:[]};return Object.assign(t,e),t};var u=class e{constructor(){this.rootNode=l(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){let t=l({scope:e});this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return typeof t==`string`?e.addText(t):t.children&&(e.openNode(t),t.children.forEach(t=>this._walk(e,t)),e.closeNode(t)),e}static _collapse(t){typeof t!=`string`&&t.children&&(t.children.every(e=>typeof e==`string`)?t.children=[t.children.join(``)]:t.children.forEach(t=>{e._collapse(t)}))}},d=class extends u{constructor(e){super(),this.options=e}addText(e){e!==``&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,t){let n=e.root;t&&(n.scope=`language:${t}`),this.add(n)}toHTML(){return new c(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function f(e){return e?typeof e==`string`?e:e.source:null}function p(e){return g(`(?=`,e,`)`)}function m(e){return g(`(?:`,e,`)*`)}function h(e){return g(`(?:`,e,`)?`)}function g(...e){return e.map(e=>f(e)).join(``)}function _(e){let t=e[e.length-1];return typeof t==`object`&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function v(...e){return`(`+(_(e).capture?``:`?:`)+e.map(e=>f(e)).join(`|`)+`)`}function y(e){return RegExp(e.toString()+`|`).exec(``).length-1}function ee(e,t){let n=e&&e.exec(t);return n&&n.index===0}let b=new RegExp(v(/\[(?:[^\\\]]|\\.)*\]/,/\(\?<(?![=!])[^>]+>/,/\(\?'[^']+'/,/\(\??/,/\\([1-9][0-9]*)/,/\\./));function x(e,{joinWith:t}){let n=0;return e.map(e=>{n+=1;let t=n,r=f(e),i=``;for(;r.length>0;){let e=b.exec(r);if(!e){i+=r;break}i+=r.substring(0,e.index),r=r.substring(e.index+e[0].length),e[0][0]===`\\`&&e[1]?i+=`\\`+String(Number(e[1])+t):(i+=e[0],(e[0]===`(`||/^\(\?[<']/.test(e[0]))&&n++)}return i}).map(e=>`(${e})`).join(t)}let S=/\b\B/,C=`[a-zA-Z]\\w*`,w=`[a-zA-Z_]\\w*`,T=`\\b\\d+(\\.\\d+)?`,E=`(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)`,D=`\\b(0b[01]+)`,O=(e={})=>{let t=/^#![ ]*\//;return e.binary&&(e.begin=g(t,/.*\b/,e.binary,/\b.*/)),a({scope:`meta`,begin:t,end:/$/,relevance:0,"on:begin":(e,t)=>{e.index!==0&&t.ignoreMatch()}},e)},k={begin:`\\\\[\\s\\S]`,relevance:0},A={scope:`string`,begin:`'`,end:`'`,illegal:`\\n`,contains:[k]},j={scope:`string`,begin:`"`,end:`"`,illegal:`\\n`,contains:[k]},M={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},N=function(e,t,n={}){let r=a({scope:`comment`,begin:e,end:t,contains:[]},n);r.contains.push({scope:`doctag`,begin:`[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)`,end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let i=v(`I`,`a`,`is`,`so`,`us`,`to`,`at`,`if`,`in`,`it`,`on`,/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:g(/[ ]+/,`(`,i,/[.]?[:]?([.][ ]|[ ])/,`){3}`)}),r},P=N(`//`,`$`),F=N(`/\\*`,`\\*/`),I=N(`#`,`$`);var L=/*#__PURE__*/ Object.freeze({__proto__:null,APOS_STRING_MODE:A,BACKSLASH_ESCAPE:k,BINARY_NUMBER_MODE:{scope:`number`,begin:D,relevance:0},BINARY_NUMBER_RE:D,COMMENT:N,C_BLOCK_COMMENT_MODE:F,C_LINE_COMMENT_MODE:P,C_NUMBER_MODE:{scope:`number`,begin:E,relevance:0},C_NUMBER_RE:E,END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})},HASH_COMMENT_MODE:I,IDENT_RE:C,MATCH_NOTHING_RE:S,METHOD_GUARD:{begin:`\\.\\s*[a-zA-Z_]\\w*`,relevance:0},NUMBER_MODE:{scope:`number`,begin:T,relevance:0},NUMBER_RE:T,PHRASAL_WORDS_MODE:M,QUOTE_STRING_MODE:j,REGEXP_MODE:{scope:`regexp`,begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[k,{begin:/\[/,end:/\]/,relevance:0,contains:[k]}]},RE_STARTERS_RE:`!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~`,SHEBANG:O,TITLE_MODE:{scope:`title`,begin:C,relevance:0},UNDERSCORE_IDENT_RE:w,UNDERSCORE_TITLE_MODE:{scope:`title`,begin:w,relevance:0}});function R(e,t){e.input[e.index-1]===`.`&&t.ignoreMatch()}function z(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function B(e,t){t&&e.beginKeywords&&(e.begin=`\\b(`+e.beginKeywords.split(` `).join(`|`)+`)(?!\\.)(?=\\b|\\s)`,e.__beforeBegin=R,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function te(e,t){Array.isArray(e.illegal)&&(e.illegal=v(...e.illegal))}function ne(e,t){if(e.match){if(e.begin||e.end)throw Error(`begin & end are not supported with match`);e.begin=e.match,delete e.match}}function re(e,t){e.relevance===void 0&&(e.relevance=1)}let ie=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw Error(`beforeMatch cannot be used with starts`);let n=Object.assign({},e);Object.keys(e).forEach(t=>{delete e[t]}),e.keywords=n.keywords,e.begin=g(n.beforeMatch,p(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},ae=[`of`,`and`,`for`,`in`,`not`,`or`,`if`,`then`,`parent`,`list`,`value`];function V(e,t,n=`keyword`){let r=Object.create(null);return typeof e==`string`?i(n,e.split(` `)):Array.isArray(e)?i(n,e):Object.keys(e).forEach(function(n){Object.assign(r,V(e[n],t,n))}),r;function i(e,n){t&&(n=n.map(e=>e.toLowerCase())),n.forEach(function(t){let n=t.split(`|`);r[n[0]]=[e,oe(n[0],n[1])]})}}function oe(e,t){return t?Number(t):+!se(e)}function se(e){return ae.includes(e.toLowerCase())}let H={},U=e=>{console.error(e)},W=(e,...t)=>{console.log(`WARN: ${e}`,...t)},G=(e,t)=>{H[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),H[`${e}/${t}`]=!0)},K=/* @__PURE__ */ Error();function q(e,t,{key:n}){let r=0,i=e[n],a={},o={};for(let e=1;e<=t.length;e++)o[e+r]=i[e],a[e+r]=!0,r+=y(t[e-1]);e[n]=o,e[n]._emit=a,e[n]._multi=!0}function ce(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw U(`skip, excludeBegin, returnBegin not compatible with beginScope: {}`),K;if(typeof e.beginScope!=`object`||e.beginScope===null)throw U(`beginScope must be object`),K;q(e,e.begin,{key:`beginScope`}),e.begin=x(e.begin,{joinWith:``})}}function le(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw U(`skip, excludeEnd, returnEnd not compatible with endScope: {}`),K;if(typeof e.endScope!=`object`||e.endScope===null)throw U(`endScope must be object`),K;q(e,e.end,{key:`endScope`}),e.end=x(e.end,{joinWith:``})}}function ue(e){e.scope&&typeof e.scope==`object`&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function de(e){ue(e),typeof e.beginScope==`string`&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope==`string`&&(e.endScope={_wrap:e.endScope}),ce(e),le(e)}function fe(e){function t(t,n){return new RegExp(f(t),`m`+(e.case_insensitive?`i`:``)+(e.unicodeRegex?`u`:``)+(n?`g`:``))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(e,t){t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]),this.matchAt+=y(e)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let e=this.regexes.map(e=>e[1]);this.matcherRe=t(x(e,{joinWith:`|`}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;let t=this.matcherRe.exec(e);if(!t)return null;let n=t.findIndex((e,t)=>t>0&&e!==void 0),r=this.matchIndexes[n];return t.splice(0,n),Object.assign(t,r)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];let t=new n;return this.rules.slice(e).forEach(([e,n])=>t.addRule(e,n)),t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(e,t){this.rules.push([e,t]),t.type===`begin`&&this.count++}exec(e){let t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex;let n=t.exec(e);if(this.resumingScanAtSamePosition()&&!(n&&n.index===this.lastIndex)){let t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)}return n&&(this.regexIndex+=n.position+1,this.regexIndex===this.count&&this.considerAll()),n}}function i(e){let t=new r;return e.contains.forEach(e=>t.addRule(e.begin,{rule:e,type:`begin`})),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:`end`}),e.illegal&&t.addRule(e.illegal,{type:`illegal`}),t}function o(n,r){let a=n;if(n.isCompiled)return a;[z,ne,de,ie].forEach(e=>e(n,r)),e.compilerExtensions.forEach(e=>e(n,r)),n.__beforeBegin=null,[B,te,re].forEach(e=>e(n,r)),n.isCompiled=!0;let s=null;return typeof n.keywords==`object`&&n.keywords.$pattern&&(n.keywords=Object.assign({},n.keywords),s=n.keywords.$pattern,delete n.keywords.$pattern),s||=/\w+/,n.keywords&&=V(n.keywords,e.case_insensitive),a.keywordPatternRe=t(s,!0),r&&(n.begin||=/\B|\b/,a.beginRe=t(a.begin),!n.end&&!n.endsWithParent&&(n.end=/\B|\b/),n.end&&(a.endRe=t(a.end)),a.terminatorEnd=f(a.end)||``,n.endsWithParent&&r.terminatorEnd&&(a.terminatorEnd+=(n.end?`|`:``)+r.terminatorEnd)),n.illegal&&(a.illegalRe=t(n.illegal)),n.contains||=[],n.contains=[].concat(...n.contains.map(function(e){return pe(e===`self`?n:e)})),n.contains.forEach(function(e){o(e,a)}),n.starts&&o(n.starts,r),a.matcher=i(a),a}if(e.compilerExtensions||=[],e.contains&&e.contains.includes(`self`))throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=a(e.classNameAliases||{}),o(e)}function J(e){return e?e.endsWithParent||J(e.starts):!1}function pe(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return a(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:J(e)?a(e,{starts:e.starts?a(e.starts):null}):Object.isFrozen(e)?a(e):e}var me=`11.12.0`,he=class extends Error{constructor(e,t){super(e),this.name=`HTMLInjectionError`,this.html=t}};let Y=i,X=a,Z=Symbol(`nomatch`),Q=function(e){let t=Object.create(null),i=Object.create(null),a=[],o=!0,s=`Could not find the language '{}', did you forget to load/include a language module?`,c={disableAutodetect:!0,name:`Plain text`,contains:[]},l={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:`hljs-`,cssSelector:`pre code`,languages:null,__emitter:d};function u(e){return l.noHighlightRe.test(e)}function f(e){let t=e.className+` `;t+=e.parentNode?e.parentNode.className:``;let n=l.languageDetectRe.exec(t);if(n){let t=M(n[1]);return t||(W(s.replace(`{}`,n[1])),W(`Falling back to no-highlight mode for this block.`,e)),t?n[1]:`no-highlight`}return t.split(/\s+/).find(e=>u(e)||M(e))}function _(e,t,n){let r=``,i=``;typeof t==`object`?(r=e,n=t.ignoreIllegals,i=t.language):(G(`10.7.0`,`highlight(lang, code, ...args) has been deprecated.`),G(`10.7.0`,`Please use highlight(code, options) instead.
|
|
2
|
-
https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(n=!0);let a={code:r,language:i};z(`before:highlight`,a);let o=a.result?a.result:y(a.language,a.code,n);return o.code=a.code,z(`after:highlight`,o),o}function y(e,n,i,a){let c=Object.create(null);function u(e,t){return e.keywords[t]}function d(){if(!k.keywords){j.addText(N);return}let e=0;k.keywordPatternRe.lastIndex=0;let t=k.keywordPatternRe.exec(N),n=``;for(;t;){n+=N.substring(e,t.index);let r=E.case_insensitive?t[0].toLowerCase():t[0],i=u(k,r);if(i){let[e,a]=i;if(j.addText(n),n=``,c[r]=(c[r]||0)+1,c[r]<=7&&(P+=a),e.startsWith(`_`))n+=t[0];else{let n=E.classNameAliases[e]||e;m(t[0],n)}}else n+=t[0];e=k.keywordPatternRe.lastIndex,t=k.keywordPatternRe.exec(N)}n+=N.substring(e),j.addText(n)}function f(){if(N===``)return;let e=null;if(typeof k.subLanguage==`string`){if(!t[k.subLanguage]){j.addText(N);return}e=y(k.subLanguage,N,!0,A[k.subLanguage]),A[k.subLanguage]=e._top}else e=x(N,k.subLanguage.length?k.subLanguage:null);k.relevance>0&&(P+=e.relevance),j.__addSublanguage(e._emitter,e.language)}function p(){k.subLanguage==null?d():f(),N=``}function m(e,t){e!==``&&(j.startScope(t),j.addText(e),j.endScope())}function h(e,t){let n=1,r=t.length-1;for(;n<=r;){if(!e._emit[n]){n++;continue}let r=E.classNameAliases[e[n]]||e[n],i=t[n];r?m(i,r):(N=i,d(),N=``),n++}}function g(e,t){return e.scope&&typeof e.scope==`string`&&j.openNode(E.classNameAliases[e.scope]||e.scope),e.beginScope&&(e.beginScope._wrap?(m(N,E.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap),N=``):e.beginScope._multi&&(h(e.beginScope,t),N=``)),k=Object.create(e,{parent:{value:k}}),k}function _(e,t,n){let i=ee(e.endRe,n);if(i){if(e[`on:end`]){let n=new r(e);e[`on:end`](t,n),n.isMatchIgnored&&(i=!1)}if(i){for(;e.endsParent&&e.parent;)e=e.parent;return e}}if(e.endsWithParent)return _(e.parent,t,n)}function v(e){return k.matcher.regexIndex===0?(N+=e[0],1):(L=!0,0)}function b(e){let t=e[0],n=e.rule,i=new r(n),a=[n.__beforeBegin,n[`on:begin`]];for(let n of a)if(n&&(n(e,i),i.isMatchIgnored))return v(t);return n.skip?N+=t:(n.excludeBegin&&(N+=t),p(),!n.returnBegin&&!n.excludeBegin&&(N=t)),g(n,e),n.returnBegin?0:t.length}function S(e){let t=e[0],r=n.substring(e.index),i=_(k,e,r);if(!i)return Z;let a=k;k.endScope&&k.endScope._wrap?(p(),m(t,k.endScope._wrap)):k.endScope&&k.endScope._multi?(p(),h(k.endScope,e)):a.skip?N+=t:(a.returnEnd||a.excludeEnd||(N+=t),p(),a.excludeEnd&&(N=t));do k.scope&&j.closeNode(),!k.skip&&!k.subLanguage&&(P+=k.relevance),k=k.parent;while(k!==i.parent);return i.starts&&g(i.starts,e),a.returnEnd?0:t.length}function C(){let e=[];for(let t=k;t!==E;t=t.parent)t.scope&&e.unshift(t.scope);e.forEach(e=>j.openNode(e))}let w={};function T(t,r){let a=r&&r[0];if(N+=t,a==null)return p(),0;if(w.type===`begin`&&r.type===`end`&&w.index===r.index&&a===``){if(N+=n.slice(r.index,r.index+1),!o){let t=/* @__PURE__ */ Error(`0 width match regex (${e})`);throw t.languageName=e,t.badRule=w.rule,t}return 1}if(w=r,r.type===`begin`)return b(r);if(r.type===`illegal`&&!i){let e=/* @__PURE__ */ Error(`Illegal lexeme "`+a+`" for mode "`+(k.scope||`<unnamed>`)+`"`);throw e.mode=k,e}if(r.type===`end`){let e=S(r);if(e!==Z)return e}if(r.type===`illegal`&&a===``)return r.index===n.length||(N+=`
|
|
3
|
-
`),1;if(I>1e5&&I>r.index*3)throw/* @__PURE__ */ Error(`potential infinite loop, way more iterations than matches`);return N+=a,a.length}let E=M(e);if(!E)throw U(s.replace(`{}`,e)),Error(`Unknown language: "`+e+`"`);let D=fe(E),O=``,k=a||D,A={},j=new l.__emitter(l);C();let N=``,P=0,F=0,I=0,L=!1;try{if(E.__emitTokens)E.__emitTokens(n,j);else{for(k.matcher.considerAll();;){I++,L?L=!1:k.matcher.considerAll(),k.matcher.lastIndex=F;let e=k.matcher.exec(n);if(!e)break;let t=T(n.substring(F,e.index),e);F=e.index+t}T(n.substring(F))}return j.finalize(),O=j.toHTML(),{language:e,value:O,relevance:P,illegal:!1,_emitter:j,_top:k}}catch(t){if(t.message&&t.message.includes(`Illegal`))return{language:e,value:Y(n),illegal:!0,relevance:0,_illegalBy:{message:t.message,index:F,context:n.slice(F-100,F+100),mode:t.mode,resultSoFar:O},_emitter:j};if(o)return{language:e,value:Y(n),illegal:!1,relevance:0,errorRaised:t,_emitter:j,_top:k};throw t}}function b(e){let t={value:Y(e),illegal:!1,relevance:0,_top:c,_emitter:new l.__emitter(l)};return t._emitter.addText(e),t}function x(e,n){n=n||l.languages||Object.keys(t);let r=b(e),i=n.filter(M).filter(P).map(t=>y(t,e,!1));i.unshift(r);let[a,o]=i.sort((e,t)=>{if(e.relevance!==t.relevance)return t.relevance-e.relevance;if(e.language&&t.language){if(M(e.language).supersetOf===t.language)return 1;if(M(t.language).supersetOf===e.language)return-1}return 0}),s=a;return s.secondBest=o,s}function S(e,t,n){let r=t&&i[t]||n;e.classList.add(`hljs`),e.classList.add(`language-${r}`)}function C(e){let t=null,n=f(e);if(u(n))return;if(z(`before:highlightElement`,{el:e,language:n}),e.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",e);return}if(e.children.length>0&&(l.ignoreUnescapedHTML||(console.warn(`One of your code blocks includes unescaped HTML. This is a potentially serious security risk.`),console.warn(`https://github.com/highlightjs/highlight.js/wiki/security`),console.warn(`The element with unescaped HTML:`),console.warn(e)),l.throwUnescapedHTML))throw new he(`One of your code blocks includes unescaped HTML.`,e.innerHTML);t=e;let r=t.textContent,i=n?_(r,{language:n,ignoreIllegals:!0}):x(r);e.innerHTML=i.value,e.dataset.highlighted=`yes`,S(e,n,i.language),e.result={language:i.language,re:i.relevance,relevance:i.relevance},i.secondBest&&(e.secondBest={language:i.secondBest.language,relevance:i.secondBest.relevance}),z(`after:highlightElement`,{el:e,result:i,text:r})}function w(e){l=X(l,e)}let T=()=>{O(),G(`10.6.0`,`initHighlighting() deprecated. Use highlightAll() now.`)};function E(){O(),G(`10.6.0`,`initHighlightingOnLoad() deprecated. Use highlightAll() now.`)}let D=!1;function O(){function e(){O()}document.readyState===`loading`?(D||window.addEventListener(`DOMContentLoaded`,e,!1),D=!0):document.querySelectorAll(l.cssSelector).forEach(C)}function k(n,r){let i=null;try{i=r(e)}catch(e){if(U(`Language definition for '{}' could not be registered.`.replace(`{}`,n)),o)U(e);else throw e;i=c}i.name||(i.name=n),t[n]=i,i.rawDefinition=r.bind(null,e),i.aliases&&N(i.aliases,{languageName:n})}function A(e){delete t[e];for(let t of Object.keys(i))i[t]===e&&delete i[t]}function j(){return Object.keys(t)}function M(e){return e=(e||``).toLowerCase(),t[e]||t[i[e]]}function N(e,{languageName:t}){typeof e==`string`&&(e=[e]),e.forEach(e=>{i[e.toLowerCase()]=t})}function P(e){let t=M(e);return t&&!t.disableAutodetect}function F(e){e[`before:highlightBlock`]&&!e[`before:highlightElement`]&&(e[`before:highlightElement`]=t=>{e[`before:highlightBlock`](Object.assign({block:t.el},t))}),e[`after:highlightBlock`]&&!e[`after:highlightElement`]&&(e[`after:highlightElement`]=t=>{e[`after:highlightBlock`](Object.assign({block:t.el},t))})}function I(e){F(e),a.push(e)}function R(e){let t=a.indexOf(e);t!==-1&&a.splice(t,1)}function z(e,t){let n=e;a.forEach(function(e){e[n]&&e[n](t)})}function B(e){return G(`10.7.0`,`highlightBlock will be removed entirely in v12.0`),G(`10.7.0`,`Please use highlightElement now.`),C(e)}Object.assign(e,{highlight:_,highlightAuto:x,highlightAll:O,highlightElement:C,highlightBlock:B,configure:w,initHighlighting:T,initHighlightingOnLoad:E,registerLanguage:k,unregisterLanguage:A,listLanguages:j,getLanguage:M,registerAliases:N,autoDetection:P,inherit:X,addPlugin:I,removePlugin:R}),e.debugMode=function(){o=!1},e.safeMode=function(){o=!0},e.versionString=me,e.regex={concat:g,lookahead:p,either:v,optional:h,anyNumberOfTimes:m};for(let e in L)typeof L[e]==`object`&&n(L[e]);return Object.assign(e,L),e},$=Q({});$.newInstance=()=>Q({}),t.exports=$,$.HighlightJS=$,$.default=$})))())).default;function l(e){let t=e.regex,n={$pattern:/[A-Z]+|%/,keyword:[`THEN`,`ELSE`,`ENDIF`,`IF`,`GOTO`,`DO`,`WHILE`,`WH`,`END`,`CALL`,`SUB`,`ENDSUB`,`EQ`,`NE`,`LT`,`GT`,`LE`,`GE`,`AND`,`OR`,`XOR`,`%`],built_in:[`ATAN`,`ABS`,`ACOS`,`ASIN`,`COS`,`EXP`,`FIX`,`FUP`,`ROUND`,`LN`,`SIN`,`SQRT`,`TAN`,`EXISTS`]},r=/\b/;function i(e,t){if(e.index===0)return;let n=e.input[e.index-1];n>=`0`&&n<=`9`||n!==`_`&&t.ignoreMatch()}let a=/[+-]?((\.\d+)|(\d+)(\.\d*)?)/,o=/[GM]\s*\d+(\.\d+)?/,s=/T\s*\d+/,c=/O\s*\d+/,l=/O<.+>/,u=/[ABCUVWXYZ]\s*/,d=/[FHIJKPQRS]\s*/;return{name:`G-code (ISO 6983)`,aliases:[`nc`],case_insensitive:!0,disableAutodetect:!0,keywords:n,contains:[e.COMMENT(/\(/,/\)/),e.COMMENT(/;/,/$/),e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,e.C_NUMBER_MODE,{scope:`title.function`,variants:[{match:t.concat(r,o)},{begin:o,"on:begin":i},{match:t.concat(r,s)},{begin:s,"on:begin":i}]},{scope:`symbol`,variants:[{match:t.concat(r,c)},{begin:c,"on:begin":i},{match:t.concat(r,l)},{begin:l,"on:begin":i},{match:/\*\s*\d+\s*$/}]},{scope:`operator`,match:/^N\s*\d+/},{scope:`variable`,match:/-?#\s*\d+/},{scope:`property`,variants:[{match:t.concat(r,u,a)},{begin:t.concat(u,a),"on:begin":i}]},{scope:`params`,variants:[{match:t.concat(r,d,a)},{begin:t.concat(d,a),"on:begin":i}]}]}}c.registerLanguage(`gcode`,l),self.addEventListener(`message`,e=>{self.postMessage(c.highlight(e.data,{language:`gcode`}).value,[])})})();
|