cncjs-handwheel 0.3.0 → 0.5.0

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 CHANGED
@@ -128,6 +128,7 @@ Start from `cncjs-handwheel.config.example.json`.
128
128
  | `device.baudRate`, `device.settleMs` | pendant baud rate; pendant input is ignored this long after opening |
129
129
  | `device.send` | `false` (or `--no-pendant-send`): never write anything to the pendant, no status, `PONG` or `ERR`. Pendant to CNCjs keeps working. Useful when the firmware does not read from the serial port yet, or to rule the status stream out when debugging |
130
130
  | `device.hupcl`, `dtr`, `rts` | modem control line handling (the defaults are fine with the udev rule) |
131
+ | `device.power` | `{line, poweredWhen, pollMs, debounceMs}`: detect that the handwheel is switched off while the USB cable is still plugged in, see "Detecting a switched-off handwheel". Off unless `line` is set |
131
132
  | `status.intervalMs`, `status.minGapMs` | status line at least every 400 ms (the heartbeat), and never more often than every 350 ms (about 3 per second); a burst of commands or position changes costs one line per gap, always carrying the latest values. Explicit `?` / `STATUS?` requests are answered at once |
132
133
  | `status.pollAfterCommand` | ask Grbl for a fresh report after pendant commands (at most one per `status.minGapMs`) |
133
134
  | `status.format` | `grbl` or `json` |
@@ -139,6 +140,40 @@ Start from `cncjs-handwheel.config.example.json`.
139
140
  | `http` | health endpoint (`enabled`, `host`, `port`) |
140
141
  | `log.max` | pendant log lines kept for the widget |
141
142
 
143
+ ## Detecting a switched-off handwheel
144
+
145
+ A USB serial chip such as the CH340 is powered by the cable, so when the handwheel's own power switch only cuts the
146
+ ESP32 (and display) the port stays open and the bridge cannot tell that nobody is listening. The way around is one
147
+ wire: the firmware drives a spare GPIO high once it is running, and that GPIO is connected to a **modem input of the
148
+ USB chip** (CTS#, DSR# or DCD#, whichever pin your chip has). The bridge reads that input; when the ESP32 has no power
149
+ the pin is not driven and a pull-down resistor holds it low.
150
+
151
+ Those inputs are active low, so a pin driven HIGH reads as *clear* and a pin pulled LOW reads as *set*. With the
152
+ wiring above the default `poweredWhen: "clear"` is right. Config:
153
+
154
+ ```json
155
+ "device": { "power": { "line": "cts" } }
156
+ ```
157
+
158
+ | Key | Meaning |
159
+ |---|---|
160
+ | `line` | `cts`, `dsr` or `dcd`: the input that is wired to the handwheel (`null` = off, the default) |
161
+ | `poweredWhen` | `clear` (default: pin high = switched on) or `set` (pin low = switched on, if you wired it the other way round) |
162
+ | `pollMs`, `debounceMs` | read the line every 250 ms; a change must last 1000 ms to count (opening the port can reset the ESP32 and make the pin dip) |
163
+
164
+ While the handwheel is off the bridge reports `pendant.powered: false` in `/status` (`null` = unknown, or not
165
+ configured), ignores whatever the adapter's RX line picks up, writes nothing to it, drops the stored battery state and
166
+ discards a jog that was being held back. The widget shows **Handwheel switched off** (grey) and `Off` in the glyph row.
167
+ After switch-on the bridge ignores the ESP32's boot output for `device.settleMs`, as it does after opening the port.
168
+
169
+ **Check the wiring first.** Stop the bridge (it holds the port) and run `node tools/probe-modem-lines.js /dev/pendant`
170
+ from the repository. It prints CTS, DSR and DCD twice a second and marks changes; switch the handwheel off and on and
171
+ the wired line must change and stay changed (`1` = pin low, `0` = pin high). A line that never moves is not wired or is
172
+ not a pin of your chip; one that flickers is floating. USB only: a Bluetooth link has no modem lines, and the bridge
173
+ turns the feature off with a message if the port cannot report them. GPIO2 is a strapping pin: low or floating at reset
174
+ is what the ESP32 wants, so the pull-down is the right resistor, and the firmware should only drive it high once it has
175
+ started.
176
+
142
177
  ## CNCjs widget
143
178
 
144
179
  The package ships a small [custom widget](https://github.com/cncjs/cncjs-widget-boilerplate) for CNCjs (source in
@@ -151,7 +186,7 @@ jog statistics and a live tail of the handwheel log.
151
186
  | green | handwheel connected, CNCjs socket up and machine port open |
152
187
  | amber | handwheel connected, but CNCjs is unreachable or the machine port is closed |
153
188
  | red | handwheel not connected |
154
- | grey | the widget cannot reach the bridge at all |
189
+ | grey | the widget cannot reach the bridge at all, or the handwheel is plugged in but switched off (needs `device.power`) |
155
190
 
156
191
  The widget runs in your browser, not on the Pi, so it cannot use the bridge's `127.0.0.1:8001` directly. Two pieces
157
192
  are needed, both on the machine that runs CNCjs.
@@ -185,19 +220,25 @@ URL parameters (append them to the widget URL, e.g. `/handwheel/?theme=dark`):
185
220
  | `debug` | | `1` adds an expand/collapse button (normally the details show only while CNCjs shows the widget fullscreen) |
186
221
  | `poll` | `400` | how often the widget asks the bridge, in ms (at least 200) |
187
222
 
188
- **Colours.** Served from the same origin as CNCjs, the widget takes its light/dark mode (`data-color-mode` on
189
- `<html>`) and its colours from CNCjs's own theme tokens (`--color-surface`, `--color-widget-header-bg`,
223
+ **Messages from CNCjs.** The CNCjs Custom widget tells the page what state it is in: after the page's `connect`
224
+ handshake, and whenever something changes, it sends a `change` message whose `payload.props` holds `fullscreen`,
225
+ `colorMode` (`light` or `dark`) and `disabled`. The widget follows `fullscreen` (expands and collapses with CNCjs's
226
+ own fullscreen button; its own expand button then hides) and `colorMode`, in every setup, same origin or not. Needs a
227
+ CNCjs with that support (cncjs/cncjs, Custom widget `props`); against an older CNCjs the messages carry no `props`
228
+ and the widget uses the fallbacks below.
229
+
230
+ **Colours.** Light or dark follows CNCjs's `colorMode`. Served from the same origin as CNCjs the widget also takes
231
+ its colours from CNCjs's own theme tokens (`--color-surface`, `--color-widget-header-bg`,
190
232
  `--color-status-danger-text`, ... see `widget/src/hostTheme.js` for the mapping) and follows a mode change live. CNCjs has no green
191
233
  token, so the OK green is the widget's own. Where it cannot read the page (cross-origin, such as the Vite dev server) or
192
- CNCjs lacks a token, the widget's own light and dark stylesheet applies.
234
+ CNCjs lacks a token, the widget's own light and dark stylesheet applies. Without a `colorMode` message it reads
235
+ `data-color-mode` off the CNCjs page (same origin only) and finally the OS preference; `?theme=` overrides all of it.
193
236
 
194
- **Fullscreen.** When the widget is served from the same origin as CNCjs (the setups above), it watches CNCjs's
195
- widget container and expands and collapses with CNCjs's own fullscreen button; its own expand button then hides.
196
- Fullscreen, the log pane takes the height that is left, so the CNCjs widget only scrolls when the screen is too short for the cards. This relies on the CSS class CNCjs puts on a fullscreen widget, so a CNCjs refactor can break it; the widget then
197
- just keeps its own expand button. Where the widget is cross-origin (the Vite dev server) it cannot look at the
198
- page, so use the expand button or `?mode=full`. A sturdier alternative is `tools/cncjs-custom-widget-fullscreen.diff`
199
- (11 lines in the CNCjs `Custom` widget): the patched CNCjs posts the fullscreen state to the widget, which listens
200
- for it in every setup. It is optional.
237
+ **Fullscreen.** With the `fullscreen` prop above, the log pane takes the height that is left when it can read the
238
+ CNCjs page (same origin), so the CNCjs widget only scrolls when the screen is too short for the cards; elsewhere the
239
+ log keeps its default height. Against a CNCjs without the prop, a same-origin widget watches the CSS class CNCjs puts
240
+ on a fullscreen widget (a CNCjs refactor can break that; the widget then just keeps its own expand button), and a
241
+ cross-origin one (the Vite dev server) needs the expand button or `?mode=full`.
201
242
 
202
243
  **Developing the widget.** `npm run dev:widget` starts a Vite dev server that forwards `/handwheel-api` to a bridge
203
244
  on `127.0.0.1:8001` (override with `HANDWHEEL_BRIDGE=http://host:port`). `npm run build:widget` builds `widget/dist`;
@@ -253,6 +294,12 @@ the machine moves) tracks the move. If no line arrives for about 1 second, treat
253
294
  EN to GND on the board removes the problem at its source.
254
295
  - **Nothing from the pendant.** Run with `-v`. Lines rejected as non-text are reported as `dropped non-text line`
255
296
  and counted in `/status` (`pendant.garbageLines`); wrong baud rate and a rebooting ESP32 look like that.
297
+ - **The widget's log pane stays empty.** The pane shows the pendant's *log lines* only: lines that start with a
298
+ semicolon (`; text`). It also says how many lines the bridge has received and how many of them were log lines
299
+ (`/status` has the same numbers as `pendant.rxLines` and `pendant.logLines`; `/log` has the entries). Lines
300
+ without the semicolon are not log lines: the bridge sends them to the controller as gcode, so a firmware that
301
+ prints debug text on the same serial port must prefix it with `;`. Output from before the port settled
302
+ (`device.settleMs`) is discarded.
256
303
  - **`$$` and `$I` output at start.** Normal: CNCjs queries the controller when a client opens the CNC port.
257
304
  - **No WPos.** Grbl reports the work offset only every 10-30 status reports; the first WPos can take a few seconds.
258
305
 
@@ -50,7 +50,17 @@ const DEFAULTS = {
50
50
  // the DTR/RTS toggling around open/close can reset the ESP32 or drop it into download mode.
51
51
  hupcl: false, // do NOT drop DTR/RTS when the port is closed
52
52
  dtr: null, // true/false = force DTR right after open, null = leave alone
53
- rts: null // true/false = force RTS right after open, null = leave alone
53
+ rts: null, // true/false = force RTS right after open, null = leave alone
54
+
55
+ // "Is the handwheel switched on?" for a USB-powered adapter that stays alive when the handwheel is
56
+ // switched off. The handwheel drives one modem INPUT of the USB serial chip (CTS#, DSR# or DCD#),
57
+ // and the bridge reads it. Off by default (line: null). USB only; there is no such line over Bluetooth.
58
+ // line: 'cts' | 'dsr' | 'dcd' which input is wired to the handwheel
59
+ // poweredWhen: 'clear' | 'set' the line state that means "switched on". The inputs are active low:
60
+ // a pin driven HIGH reads as clear, a pin pulled LOW reads as set. 'clear' = high means on
61
+ // pollMs: how often the line is read
62
+ // debounceMs: a change must last this long before it counts (opening the port can reset the ESP32)
63
+ power: { line: null, poweredWhen: 'clear', pollMs: 250, debounceMs: 1000 }
54
64
  },
55
65
  status: {
56
66
  format: 'grbl', // 'grbl' -> <Idle|MPos:..|WPos:..|FS:..> 'json' -> {"t":"status",...}
@@ -166,6 +176,17 @@ if (cli.jogTranslate === false) cfg.jog.translate = false;
166
176
 
167
177
  if (!cfg.cncjs.port) { console.error('Missing CNC controller port (cncjs.port / --port)'); process.exit(1); }
168
178
  if (!cfg.device.path) { console.error('Missing pendant port (device.path / --pendant-port). Try --list'); process.exit(1); }
179
+ if (cfg.device.power.line) {
180
+ cfg.device.power.line = String(cfg.device.power.line).toLowerCase();
181
+ if (!['cts', 'dsr', 'dcd'].includes(cfg.device.power.line)) {
182
+ console.error('device.power.line must be "cts", "dsr", "dcd" or null, not "' + cfg.device.power.line + '"');
183
+ process.exit(1);
184
+ }
185
+ if (!['clear', 'set'].includes(cfg.device.power.poweredWhen)) {
186
+ console.error('device.power.poweredWhen must be "clear" or "set", not "' + cfg.device.power.poweredWhen + '"');
187
+ process.exit(1);
188
+ }
189
+ }
169
190
 
170
191
  // ---------------------------------------------------------------- state
171
192
  const store = { controller: { state: {}, settings: {} }, sender: { status: {} } };
@@ -173,7 +194,8 @@ const store = { controller: { state: {}, settings: {} }, sender: { status: {} }
173
194
  const health = {
174
195
  startedAt: Date.now(),
175
196
  pendant: { path: cfg.device.path, connected: false, lastRx: null, lastTx: null, rxLines: 0, txLines: 0,
176
- reconnects: 0, errors: 0, lastError: null, logLines: 0, garbageLines: 0, link: null, info: null },
197
+ reconnects: 0, errors: 0, lastError: null, logLines: 0, garbageLines: 0, link: null, info: null,
198
+ powered: null, powerError: null }, // powered: null = unknown or not configured, true / false = switched on / off
177
199
  cncjs: { socketConnected: false, portOpen: false, port: cfg.cncjs.port, controllerType: cfg.cncjs.controllerType,
178
200
  lastError: null, droppedCommands: 0 },
179
201
  jog: { sent: 0, merged: 0, discarded: 0, stalls: 0, cancels: 0, inFlight: 0, held: false, lastAt: null },
@@ -341,6 +363,11 @@ let lastReset = 0;
341
363
  */
342
364
  function onPendantData(buf) {
343
365
  const now = Date.now();
366
+ if (health.pendant.powered === false) { // switched off: whatever the adapter's RX line picks up is noise
367
+ rxBuf = '';
368
+ skipLine = false;
369
+ return;
370
+ }
344
371
  health.pendant.lastRx = now;
345
372
  if (now < ignoreUntil) {
346
373
  rxBuf = '';
@@ -812,7 +839,7 @@ function queueStatus() {
812
839
  function sendToPendant(text, should_log=false) {
813
840
  if (!cfg.device.send) return false;
814
841
  const port = pendantPort;
815
- if (!port || !port.isOpen) return false;
842
+ if (!port || !port.isOpen || health.pendant.powered === false) return false;
816
843
  if(should_log) log('cncjs -> ', 'pendant', text);
817
844
  port.write(text + '\n', (err) => {
818
845
  if (err) noteError(err);
@@ -854,6 +881,89 @@ function scheduleReconnect() {
854
881
  }, cfg.device.reconnectMs);
855
882
  }
856
883
 
884
+ // ---------------------------------------------------------------- handwheel power (modem line)
885
+ let powerTimer = null;
886
+ let powerBusy = false;
887
+ let powerRaw = null; // last reading (true = on), not yet debounced
888
+ let powerSince = 0; // when powerRaw last changed
889
+
890
+ /**
891
+ * Stops reading the power line and forgets what it said (the state is unknown while the port is closed).
892
+ *
893
+ * @returns {void}
894
+ */
895
+ function stopPowerWatch() {
896
+ clearInterval(powerTimer);
897
+ powerTimer = null;
898
+ powerBusy = false;
899
+ powerRaw = null;
900
+ health.pendant.powered = null;
901
+ }
902
+
903
+ /**
904
+ * Records a debounced change of the handwheel's power state.
905
+ *
906
+ * @param {boolean} on - true if the handwheel is switched on
907
+ * @returns {void}
908
+ */
909
+ function setPowered(on) {
910
+ health.pendant.powered = on;
911
+ rxBuf = '';
912
+ skipLine = false;
913
+ if (on) {
914
+ // the ESP32 is booting: ignore its output like after opening the port
915
+ ignoreUntil = Date.now() + Number(cfg.device.settleMs || 0);
916
+ } else {
917
+ health.pendant.info = null; // a stale battery level is worse than none
918
+ discardHeldJog(); // switching the handwheel off must not let a held jog fire afterwards
919
+ }
920
+ console.log('Handwheel switched ' + (on ? 'on' : 'off'));
921
+ }
922
+
923
+ /**
924
+ * Reads the modem line once and applies the debounce.
925
+ *
926
+ * @param {SerialPort} port - the open pendant port
927
+ * @returns {void}
928
+ */
929
+ function pollPower(port) {
930
+ if (powerBusy || !port.isOpen) return;
931
+ powerBusy = true;
932
+ port.get((err, signals) => {
933
+ powerBusy = false;
934
+ if (port !== pendantPort || !port.isOpen) return;
935
+ if (err) {
936
+ // e.g. Bluetooth (rfcomm) has no modem lines: say so once and stop asking
937
+ health.pendant.powerError = err.message;
938
+ console.error('Pendant power line cannot be read, power detection is off:', err.message);
939
+ stopPowerWatch();
940
+ return;
941
+ }
942
+ const set = !!(signals && signals[cfg.device.power.line]);
943
+ const on = cfg.device.power.poweredWhen === 'set' ? set : !set;
944
+ const now = Date.now();
945
+ if (on !== powerRaw) {
946
+ powerRaw = on;
947
+ powerSince = now;
948
+ }
949
+ if (health.pendant.powered !== on && now - powerSince >= Number(cfg.device.power.debounceMs || 0)) setPowered(on);
950
+ });
951
+ }
952
+
953
+ /**
954
+ * Starts polling the configured modem line of the pendant's port (nothing happens if device.power.line is null).
955
+ *
956
+ * @param {SerialPort} port - the open pendant port
957
+ * @returns {void}
958
+ */
959
+ function startPowerWatch(port) {
960
+ stopPowerWatch();
961
+ health.pendant.powerError = null;
962
+ if (!cfg.device.power.line) return;
963
+ powerTimer = setInterval(() => pollPower(port), Math.max(50, Number(cfg.device.power.pollMs) || 250));
964
+ pollPower(port);
965
+ }
966
+
857
967
  /**
858
968
  * Opens the pendant's serial port and wires up its events. Failures and closes schedule a reconnect.
859
969
  * After a successful open, pendant input is ignored for device.settleMs and a status line is sent.
@@ -880,6 +990,7 @@ function openPendant() {
880
990
  port.on('close', () => {
881
991
  health.pendant.connected = false;
882
992
  health.pendant.info = null; // a stale battery level is worse than none
993
+ stopPowerWatch();
883
994
  if (!shuttingDown) console.log('Pendant port closed');
884
995
  scheduleReconnect();
885
996
  });
@@ -902,6 +1013,7 @@ function openPendant() {
902
1013
  health.pendant.link = detectLink(cfg.device.path);
903
1014
  health.pendant.lastError = null;
904
1015
  console.log('Pendant connected on ' + cfg.device.path);
1016
+ startPowerWatch(port);
905
1017
  sendStatus(true);
906
1018
  });
907
1019
  }
@@ -917,10 +1029,11 @@ function healthReport() {
917
1029
  const now = Date.now();
918
1030
  const age = (t) => (t ? now - t : null);
919
1031
  return {
920
- ok: health.pendant.connected && cncReady(),
1032
+ ok: health.pendant.connected && health.pendant.powered !== false && cncReady(),
921
1033
  version: pkg.version,
922
1034
  uptimeMs: now - health.startedAt,
923
- pendant: Object.assign({}, health.pendant, { sendEnabled: !!cfg.device.send, lastRxAgeMs: age(health.pendant.lastRx),
1035
+ pendant: Object.assign({}, health.pendant, { sendEnabled: !!cfg.device.send, powerDetect: !!cfg.device.power.line,
1036
+ lastRxAgeMs: age(health.pendant.lastRx),
924
1037
  lastTxAgeMs: age(health.pendant.lastTx),
925
1038
  info: health.pendant.info && Object.assign({}, health.pendant.info, { ageMs: age(health.pendant.info.at) }) }),
926
1039
  cncjs: health.cncjs,
@@ -964,6 +1077,7 @@ function shutdown() {
964
1077
  if (shuttingDown) return;
965
1078
  shuttingDown = true;
966
1079
  clearInterval(statusTimer);
1080
+ clearInterval(powerTimer);
967
1081
  clearInterval(jogTimer);
968
1082
  clearTimeout(cancelTimer);
969
1083
  clearTimeout(reconnectTimer);
@@ -19,7 +19,8 @@
19
19
  "send": true,
20
20
  "hupcl": false,
21
21
  "dtr": null,
22
- "rts": null
22
+ "rts": null,
23
+ "power": { "line": null, "poweredWhen": "clear", "pollMs": 250, "debounceMs": 1000 }
23
24
  },
24
25
  "status": {
25
26
  "format": "grbl",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cncjs-handwheel",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "CNCjs pendant bridge for a serial (USB/Bluetooth) ESP32 CNC handwheel",
5
5
  "keywords": [
6
6
  "cncjs",
@@ -0,0 +1 @@
1
+ :root{--bg: #fff;--fg: #333;--muted: #777;--card: #fafafa;--border: #ddd;--ok: #2e8b3d;--warn: #c77c00;--down: #c9302c;--offline: #8a8a8a;--unknown: #8a8a8a;--accent: #337ab7;--head-bg: #f6f7f8;--head-fg: #222;--head-border: #ccc;color-scheme:light}:root[data-theme=dark]{--bg: #1e1f22;--fg: #dcdcdc;--muted: #9a9a9a;--card: #26282c;--border: #3a3d42;--ok: #52c262;--warn: #e0a030;--down: #ef6a64;--offline: #8f8f8f;--unknown: #8f8f8f;--accent: #6aaee6;--head-bg: #2b2e33;--head-fg: #dcdcdc;--head-border: #3a3d42;color-scheme:dark}*{box-sizing:border-box}html,body{margin:0}body{background:var(--bg);color:var(--fg);font:14px/1.35 Segoe UI,-apple-system,BlinkMacSystemFont,Helvetica Neue,Helvetica,Arial,sans-serif}code,.mono{font-family:Segoe UI Mono,SFMono-Medium,SF Mono,Menlo,Consolas,Courier,monospace}.widget{padding:8px}.widget.level-ok{--level: var(--ok)}.widget.level-warn{--level: var(--warn)}.widget.level-down{--level: var(--down)}.widget.level-offline{--level: var(--offline)}.widget.level-unknown{--level: var(--unknown)}.head{display:flex;align-items:center;gap:10px;min-height:44px}.icon{color:var(--level);display:flex;flex:none}.title{flex:1;min-width:0;display:flex;flex-direction:column}.title strong{color:var(--level);font-size:15px}.title small{color:var(--muted);font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.toggle{flex:none;width:44px;height:44px;border:1px solid var(--border);border-radius:4px;background:var(--btn-bg, var(--card));color:var(--fg);font-size:16px;cursor:pointer}.toggle:focus-visible{outline:2px solid var(--focus, var(--accent));outline-offset:1px}.cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:8px;margin-top:8px}.card{background:var(--bg);border:1px solid var(--head-border)}.card h3{margin:0;padding:0 10px;font-size:14px;font-weight:400;line-height:32px;background:var(--head-bg);color:var(--head-fg);border-bottom:1px solid var(--head-border)}.card .body{padding:6px 10px 8px}.logcard{margin-top:8px}.value b{font-weight:inherit}.bad{color:var(--down)}.good{color:var(--ok)}.row{display:flex;justify-content:space-between;gap:10px;padding:1px 0}.label{color:var(--muted)}.value{text-align:right;overflow-wrap:anywhere}.log{height:260px;overflow-y:auto;background:var(--card);padding:4px 8px;font-family:Segoe UI Mono,SFMono-Medium,SF Mono,Menlo,Consolas,Courier,monospace;font-size:12px}.logline{white-space:pre-wrap;overflow-wrap:anywhere}.logline .time,.empty,.hint{color:var(--muted)}.hint{margin:8px 0 0}.title small{white-space:normal;overflow:visible}.counts{display:flex;flex-wrap:nowrap;gap:2px 10px;margin-top:2px}.counts em{font-style:normal;color:var(--muted);margin-right:1px}.counts b{font-weight:600;font-variant-numeric:tabular-nums}.counts i{font-style:normal;color:var(--muted);margin:0 1px}.counts .good{color:var(--ok)}.counts .bad{color:var(--down)}.counts>span{white-space:nowrap}.counts>.mstate{min-width:2.7em}.counts>.grp-jog{min-width:8em}.mstate{font-weight:600}.mstate.busy{color:var(--accent)}.mstate.warn{color:var(--warn)}.mstate.bad{color:var(--down)}.pend{display:flex;align-items:center;flex-wrap:wrap;gap:6px 18px;margin-top:8px;padding-top:8px;border-top:1px solid var(--border)}.g{display:inline-flex;align-items:center;gap:6px}.g small{color:var(--muted);font-size:12px}.g.muted{color:var(--muted)}.bat .pct{font-weight:600;font-variant-numeric:tabular-nums}.bat.ok svg{color:var(--ok)}.bat.mid svg{color:var(--warn)}.bat.low svg,.bat.low .pct{color:var(--down)}.st{margin-left:auto}.st.s-ok{color:var(--ok)}.st.s-warn{color:var(--warn)}.st.s-err{color:var(--down)}.st.s-unk{color:var(--muted)}.st.s-warn small{color:var(--warn);font-weight:600}.st.s-err small{color:var(--down);font-weight:600}html.embedded,html.embedded body{overflow-y:hidden}