flight-indicators 1.2.2 → 1.2.4

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/dist/index.js CHANGED
@@ -11,16 +11,16 @@ function polar(r, deg2, cx = CENTER, cy = CENTER) {
11
11
  const a = deg2 * Math.PI / 180;
12
12
  return [round(cx + r * Math.sin(a)), round(cy - r * Math.cos(a))];
13
13
  }
14
- function arcPath(r, startDeg, endDeg) {
15
- const [x1, y1] = polar(r, startDeg);
16
- const [x2, y2] = polar(r, endDeg);
14
+ function arcPath(r, startDeg, endDeg, cx = CENTER, cy = CENTER) {
15
+ const [x1, y1] = polar(r, startDeg, cx, cy);
16
+ const [x2, y2] = polar(r, endDeg, cx, cy);
17
17
  const largeArc = Math.abs(endDeg - startDeg) > 180 ? 1 : 0;
18
18
  const sweep = endDeg >= startDeg ? 1 : 0;
19
19
  return `M ${x1} ${y1} A ${r} ${r} 0 ${largeArc} ${sweep} ${x2} ${y2}`;
20
20
  }
21
- function tickPath(r1, r2, deg2) {
22
- const [x1, y1] = polar(r1, deg2);
23
- const [x2, y2] = polar(r2, deg2);
21
+ function tickPath(r1, r2, deg2, cx = CENTER, cy = CENTER) {
22
+ const [x1, y1] = polar(r1, deg2, cx, cy);
23
+ const [x2, y2] = polar(r2, deg2, cx, cy);
24
24
  return `M ${x1} ${y1} L ${x2} ${y2}`;
25
25
  }
26
26
  function range(start, end, step) {
@@ -54,6 +54,47 @@ function useSvgId(prefix) {
54
54
 
55
55
  // src/components/Instrument.tsx
56
56
  import { jsx, jsxs } from "react/jsx-runtime";
57
+ var KNOB_PLACES = {
58
+ "bottom-left": [46, 354, 30],
59
+ "bottom-right": [354, 354, 30],
60
+ bottom: [CENTER, 376, 17]
61
+ };
62
+ function Knob({ id, label: label2, position, angle = 0, animationDuration = DEFAULT_ANIMATION_MS }) {
63
+ const [cx, cy, r] = KNOB_PLACES[position];
64
+ const display2 = useContinuousAngle(angle);
65
+ const step = 360 / 28;
66
+ return /* @__PURE__ */ jsxs("g", { "data-testid": `knob-${id}`, children: [
67
+ /* @__PURE__ */ jsx("circle", { cx, cy: cy + 2, r: r + 2, fill: "#000", opacity: "0.55" }),
68
+ /* @__PURE__ */ jsxs("g", { "data-testid": `knob-${id}-rim`, style: motionStyle(`rotate(${display2}deg)`, animationDuration, cx, cy), children: [
69
+ /* @__PURE__ */ jsx("circle", { cx, cy, r, fill: "#2e2e2e", stroke: "#000", strokeWidth: "2" }),
70
+ /* @__PURE__ */ jsx("g", { stroke: "#111", strokeWidth: r > 20 ? 3 : 2, children: range(0, 360 - step, step).map((a) => {
71
+ const rad = a * Math.PI / 180;
72
+ return /* @__PURE__ */ jsx(
73
+ "path",
74
+ {
75
+ d: `M ${cx + (r - 5) * Math.sin(rad)} ${cy - (r - 5) * Math.cos(rad)} L ${cx + r * Math.sin(rad)} ${cy - r * Math.cos(rad)}`
76
+ },
77
+ a
78
+ );
79
+ }) }),
80
+ /* @__PURE__ */ jsx("path", { d: `M ${cx} ${cy - r + 1} v ${r * 0.22}`, stroke: "#ddd", strokeWidth: "2", strokeLinecap: "round" })
81
+ ] }),
82
+ /* @__PURE__ */ jsx("circle", { cx, cy, r: r * 0.72, fill: "#1f1f1f", stroke: "#cfcfcf", strokeWidth: r > 20 ? 2 : 1.5 }),
83
+ label2 && /* @__PURE__ */ jsx(
84
+ "text",
85
+ {
86
+ x: cx,
87
+ y: cy,
88
+ fill: "#eee",
89
+ fontSize: Math.min(13, r * 1.15 / Math.max(1, label2.length * 0.6)),
90
+ fontWeight: "bold",
91
+ textAnchor: "middle",
92
+ dominantBaseline: "central",
93
+ children: label2
94
+ }
95
+ )
96
+ ] });
97
+ }
57
98
  var SCREWS = [
58
99
  [32, 32],
59
100
  [368, 32],
@@ -63,10 +104,14 @@ var SCREWS = [
63
104
  function InstrumentFrame({
64
105
  size = 200,
65
106
  showBox = true,
107
+ showKnobs = true,
108
+ knobs,
109
+ animationDuration,
66
110
  className,
67
111
  style,
68
112
  title,
69
113
  label: label2,
114
+ role = "img",
70
115
  children
71
116
  }) {
72
117
  const titleId = useSvgId("fi-title");
@@ -78,7 +123,7 @@ function InstrumentFrame({
78
123
  viewBox: "0 0 400 400",
79
124
  width: size,
80
125
  height: size,
81
- role: "img",
126
+ role,
82
127
  "aria-labelledby": titleId,
83
128
  className,
84
129
  style: { display: "inline-block", userSelect: "none", ...style },
@@ -98,7 +143,8 @@ function InstrumentFrame({
98
143
  ] }),
99
144
  /* @__PURE__ */ jsx("circle", { cx: CENTER, cy: CENTER, r: "196", fill: `url(#${bezelId})` }),
100
145
  /* @__PURE__ */ jsx("circle", { cx: CENTER, cy: CENTER, r: "182", fill: "#111", stroke: "#000", strokeWidth: "4" }),
101
- children
146
+ children,
147
+ showKnobs && knobs?.map((k) => /* @__PURE__ */ jsx(Knob, { ...k, animationDuration }, k.id))
102
148
  ]
103
149
  }
104
150
  );
@@ -106,6 +152,34 @@ function InstrumentFrame({
106
152
  function Hub({ r = 14 }) {
107
153
  return /* @__PURE__ */ jsx("circle", { cx: CENTER, cy: CENTER, r, fill: "#2a2a2a", stroke: "#555", strokeWidth: "2" });
108
154
  }
155
+ function PanelFrame({ size = 200, showBox = true, className, style, title, label: label2, width, height, children }) {
156
+ const titleId = useSvgId("fi-title");
157
+ return /* @__PURE__ */ jsxs(
158
+ "svg",
159
+ {
160
+ xmlns: "http://www.w3.org/2000/svg",
161
+ viewBox: `0 0 ${width} ${height}`,
162
+ width: size,
163
+ height: typeof size === "number" ? Math.round(size * height / width * 100) / 100 : void 0,
164
+ role: "img",
165
+ "aria-labelledby": titleId,
166
+ className,
167
+ style: { display: "inline-block", userSelect: "none", aspectRatio: `${width} / ${height}`, ...style },
168
+ fontFamily: "'Helvetica Neue', Arial, sans-serif",
169
+ children: [
170
+ /* @__PURE__ */ jsx("title", { id: titleId, children: title ?? label2 }),
171
+ showBox && /* @__PURE__ */ jsxs("g", { children: [
172
+ /* @__PURE__ */ jsx("rect", { x: "2", y: "2", width: width - 4, height: height - 4, rx: "14", fill: "#232323", stroke: "#0d0d0d", strokeWidth: "4" }),
173
+ [22, width - 22].map((x) => /* @__PURE__ */ jsxs("g", { children: [
174
+ /* @__PURE__ */ jsx("circle", { cx: x, cy: height / 2, r: "9", fill: "#3a3a3a", stroke: "#111", strokeWidth: "2" }),
175
+ /* @__PURE__ */ jsx("path", { d: `M ${x - 6} ${height / 2 + 2} L ${x + 6} ${height / 2 - 2}`, stroke: "#111", strokeWidth: "2.5" })
176
+ ] }, x))
177
+ ] }),
178
+ children
179
+ ]
180
+ }
181
+ );
182
+ }
109
183
 
110
184
  // src/components/AttitudeIndicator.tsx
111
185
  import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
@@ -131,6 +205,7 @@ function AttitudeIndicator({ roll = 0, pitch = 0, pitchLimit = 40, ...props }) {
131
205
  {
132
206
  ...props,
133
207
  label: `Attitude indicator: pitch ${Math.round(safePitch)}\xB0, roll ${Math.round(safeRoll)}\xB0`,
208
+ knobs: [{ id: "adjust", position: "bottom" }],
134
209
  children: [
135
210
  /* @__PURE__ */ jsx2("defs", { children: /* @__PURE__ */ jsx2("clipPath", { id: clipId, children: /* @__PURE__ */ jsx2("circle", { cx: CENTER, cy: CENTER, r: FACE_R }) }) }),
136
211
  /* @__PURE__ */ jsxs2("g", { clipPath: `url(#${clipId})`, children: [
@@ -183,41 +258,49 @@ function HeadingIndicator({ heading = 0, ...props }) {
183
258
  const safeHeading = finite(heading);
184
259
  const normalised = (Math.round(safeHeading) % 360 + 360) % 360;
185
260
  const displayHeading = useContinuousAngle(safeHeading);
186
- return /* @__PURE__ */ jsxs3(InstrumentFrame, { ...props, label: `Heading indicator: ${String(normalised).padStart(3, "0")}\xB0`, children: [
187
- /* @__PURE__ */ jsxs3("g", { "data-testid": "heading-card", style: motionStyle(`rotate(${-displayHeading}deg)`, duration), children: [
188
- /* @__PURE__ */ jsx3("g", { stroke: "#fff", strokeLinecap: "round", children: range(0, 355, 5).map((a) => /* @__PURE__ */ jsx3("path", { d: tickPath(176, a % 10 === 0 ? 152 : 164, a), strokeWidth: a % 10 === 0 ? 3 : 2 }, a)) }),
189
- range(0, 330, 30).map((a) => {
190
- const [x, y] = polar(132, a);
191
- const label2 = CARDINALS[a] ?? String(a / 10);
192
- return /* @__PURE__ */ jsx3(
193
- "text",
261
+ return /* @__PURE__ */ jsxs3(
262
+ InstrumentFrame,
263
+ {
264
+ ...props,
265
+ label: `Heading indicator: ${String(normalised).padStart(3, "0")}\xB0`,
266
+ knobs: [{ id: "set", label: "PUSH", position: "bottom-left", angle: safeHeading }],
267
+ children: [
268
+ /* @__PURE__ */ jsxs3("g", { "data-testid": "heading-card", style: motionStyle(`rotate(${-displayHeading}deg)`, duration), children: [
269
+ /* @__PURE__ */ jsx3("g", { stroke: "#fff", strokeLinecap: "round", children: range(0, 355, 5).map((a) => /* @__PURE__ */ jsx3("path", { d: tickPath(176, a % 10 === 0 ? 152 : 164, a), strokeWidth: a % 10 === 0 ? 3 : 2 }, a)) }),
270
+ range(0, 330, 30).map((a) => {
271
+ const [x, y] = polar(132, a);
272
+ const label2 = CARDINALS[a] ?? String(a / 10);
273
+ return /* @__PURE__ */ jsx3(
274
+ "text",
275
+ {
276
+ x,
277
+ y,
278
+ transform: `rotate(${a} ${x} ${y})`,
279
+ fill: a % 90 === 0 ? "#ffb000" : "#fff",
280
+ fontSize: a % 90 === 0 ? 30 : 26,
281
+ fontWeight: "bold",
282
+ textAnchor: "middle",
283
+ dominantBaseline: "central",
284
+ children: label2
285
+ },
286
+ a
287
+ );
288
+ })
289
+ ] }),
290
+ /* @__PURE__ */ jsx3("g", { stroke: "#ffb000", strokeWidth: "4", strokeLinecap: "round", children: [45, 135, 225, 315].map((a) => /* @__PURE__ */ jsx3("path", { d: tickPath(192, 178, a) }, a)) }),
291
+ /* @__PURE__ */ jsx3("path", { d: `M ${CENTER} ${CENTER - 150} l -9 -26 h 18 z`, fill: "#ffb000" }),
292
+ /* @__PURE__ */ jsx3(
293
+ "path",
194
294
  {
195
- x,
196
- y,
197
- transform: `rotate(${a} ${x} ${y})`,
198
- fill: a % 90 === 0 ? "#ffb000" : "#fff",
199
- fontSize: a % 90 === 0 ? 30 : 26,
200
- fontWeight: "bold",
201
- textAnchor: "middle",
202
- dominantBaseline: "central",
203
- children: label2
204
- },
205
- a
206
- );
207
- })
208
- ] }),
209
- /* @__PURE__ */ jsx3("g", { stroke: "#ffb000", strokeWidth: "4", strokeLinecap: "round", children: [45, 135, 225, 315].map((a) => /* @__PURE__ */ jsx3("path", { d: tickPath(192, 178, a) }, a)) }),
210
- /* @__PURE__ */ jsx3("path", { d: `M ${CENTER} ${CENTER - 150} l -9 -26 h 18 z`, fill: "#ffb000" }),
211
- /* @__PURE__ */ jsx3(
212
- "path",
213
- {
214
- d: "M200 135 c6 0 8 8 8 16 v30 l52 18 v12 l-52 -8 v34 l18 12 v10 l-26 -6 l-26 6 v-10 l18 -12 v-34 l-52 8 v-12 l52 -18 v-30 c0 -8 2 -16 8 -16 z",
215
- fill: "#ffb000",
216
- stroke: "#000",
217
- strokeWidth: "2"
218
- }
219
- )
220
- ] });
295
+ d: "M200 135 c6 0 8 8 8 16 v30 l52 18 v12 l-52 -8 v34 l18 12 v10 l-26 -6 l-26 6 v-10 l18 -12 v-34 l-52 8 v-12 l52 -18 v-30 c0 -8 2 -16 8 -16 z",
296
+ fill: "#ffb000",
297
+ stroke: "#000",
298
+ strokeWidth: "2"
299
+ }
300
+ )
301
+ ]
302
+ }
303
+ );
221
304
  }
222
305
 
223
306
  // src/components/Airspeed.tsx
@@ -266,25 +349,33 @@ function Altimeter({ altitude = 0, pressure, pressureUnit = "hPa", ...props }) {
266
349
  const alt = finite(altitude);
267
350
  const qnh = finite(pressure, STANDARD[pressureUnit]);
268
351
  const qnhText = pressureUnit === "inHg" ? qnh.toFixed(2) : Math.round(qnh).toString();
269
- return /* @__PURE__ */ jsxs5(InstrumentFrame, { ...props, label: `Altimeter: ${Math.round(alt)} feet, ${qnhText} ${pressureUnit}`, children: [
270
- /* @__PURE__ */ jsx5("g", { stroke: "#fff", strokeLinecap: "round", children: range(0, 49, 1).map((i) => /* @__PURE__ */ jsx5("path", { d: tickPath(178, i % 5 === 0 ? 150 : 164, i * 7.2), strokeWidth: i % 5 === 0 ? 4 : 2 }, i)) }),
271
- range(0, 9, 1).map((n) => {
272
- const [x, y] = polar(126, n * 36);
273
- return /* @__PURE__ */ jsx5("text", { x, y, fill: "#fff", fontSize: "32", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: n }, n);
274
- }),
275
- /* @__PURE__ */ jsx5("text", { x: CENTER, y: CENTER - 58, fill: "#ccc", fontSize: "16", textAnchor: "middle", children: "ALT" }),
276
- /* @__PURE__ */ jsx5("text", { x: CENTER, y: CENTER - 40, fill: "#ccc", fontSize: "12", textAnchor: "middle", children: "100 FEET" }),
277
- /* @__PURE__ */ jsx5("rect", { x: CENTER + 30, y: CENTER - 16, width: "74", height: "32", rx: "4", fill: "#000", stroke: "#666", strokeWidth: "2" }),
278
- /* @__PURE__ */ jsx5("text", { "data-testid": "altimeter-pressure", x: CENTER + 67, y: CENTER + 1, fill: "#fff", fontSize: "20", fontFamily: "monospace", textAnchor: "middle", dominantBaseline: "central", children: qnhText }),
279
- /* @__PURE__ */ jsx5("text", { x: CENTER + 67, y: CENTER + 30, fill: "#ccc", fontSize: "12", textAnchor: "middle", children: pressureUnit }),
280
- /* @__PURE__ */ jsxs5("g", { "data-testid": "altimeter-10000", style: motionStyle(`rotate(${alt / 1e5 * 360}deg)`, duration), children: [
281
- /* @__PURE__ */ jsx5("path", { d: `M ${CENTER} ${CENTER} L ${CENTER} ${CENTER - 150}`, stroke: "#fff", strokeWidth: "3" }),
282
- /* @__PURE__ */ jsx5("path", { d: `M ${CENTER} ${CENTER - 178} l -10 22 h 20 z`, fill: "#fff" })
283
- ] }),
284
- /* @__PURE__ */ jsx5("g", { "data-testid": "altimeter-1000", style: motionStyle(`rotate(${alt / 1e4 * 360}deg)`, duration), children: /* @__PURE__ */ jsx5("path", { d: `M ${CENTER - 9} ${CENTER + 14} L ${CENTER - 12} ${CENTER - 70} L ${CENTER} ${CENTER - 100} L ${CENTER + 12} ${CENTER - 70} L ${CENTER + 9} ${CENTER + 14} Z`, fill: "#fff", stroke: "#000", strokeWidth: "1.5" }) }),
285
- /* @__PURE__ */ jsx5("g", { "data-testid": "altimeter-100", style: motionStyle(`rotate(${alt / 1e3 * 360}deg)`, duration), children: /* @__PURE__ */ jsx5("path", { d: `M ${CENTER - 5} ${CENTER + 30} L ${CENTER - 4} ${CENTER - 140} L ${CENTER} ${CENTER - 168} L ${CENTER + 4} ${CENTER - 140} L ${CENTER + 5} ${CENTER + 30} Z`, fill: "#fff", stroke: "#000", strokeWidth: "1.5" }) }),
286
- /* @__PURE__ */ jsx5(Hub, {})
287
- ] });
352
+ return /* @__PURE__ */ jsxs5(
353
+ InstrumentFrame,
354
+ {
355
+ ...props,
356
+ label: `Altimeter: ${Math.round(alt)} feet, ${qnhText} ${pressureUnit}`,
357
+ knobs: [{ id: "baro", label: "BARO", position: "bottom-left", angle: Math.round((qnh - STANDARD[pressureUnit]) * (pressureUnit === "inHg" ? 3e4 : 1e3)) / 100 }],
358
+ children: [
359
+ /* @__PURE__ */ jsx5("g", { stroke: "#fff", strokeLinecap: "round", children: range(0, 49, 1).map((i) => /* @__PURE__ */ jsx5("path", { d: tickPath(178, i % 5 === 0 ? 150 : 164, i * 7.2), strokeWidth: i % 5 === 0 ? 4 : 2 }, i)) }),
360
+ range(0, 9, 1).map((n) => {
361
+ const [x, y] = polar(126, n * 36);
362
+ return /* @__PURE__ */ jsx5("text", { x, y, fill: "#fff", fontSize: "32", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: n }, n);
363
+ }),
364
+ /* @__PURE__ */ jsx5("text", { x: CENTER, y: CENTER - 58, fill: "#ccc", fontSize: "16", textAnchor: "middle", children: "ALT" }),
365
+ /* @__PURE__ */ jsx5("text", { x: CENTER, y: CENTER - 40, fill: "#ccc", fontSize: "12", textAnchor: "middle", children: "100 FEET" }),
366
+ /* @__PURE__ */ jsx5("rect", { x: CENTER + 30, y: CENTER - 16, width: "74", height: "32", rx: "4", fill: "#000", stroke: "#666", strokeWidth: "2" }),
367
+ /* @__PURE__ */ jsx5("text", { "data-testid": "altimeter-pressure", x: CENTER + 67, y: CENTER + 1, fill: "#fff", fontSize: "20", fontFamily: "monospace", textAnchor: "middle", dominantBaseline: "central", children: qnhText }),
368
+ /* @__PURE__ */ jsx5("text", { x: CENTER + 67, y: CENTER + 30, fill: "#ccc", fontSize: "12", textAnchor: "middle", children: pressureUnit }),
369
+ /* @__PURE__ */ jsxs5("g", { "data-testid": "altimeter-10000", style: motionStyle(`rotate(${alt / 1e5 * 360}deg)`, duration), children: [
370
+ /* @__PURE__ */ jsx5("path", { d: `M ${CENTER} ${CENTER} L ${CENTER} ${CENTER - 150}`, stroke: "#fff", strokeWidth: "3" }),
371
+ /* @__PURE__ */ jsx5("path", { d: `M ${CENTER} ${CENTER - 178} l -10 22 h 20 z`, fill: "#fff" })
372
+ ] }),
373
+ /* @__PURE__ */ jsx5("g", { "data-testid": "altimeter-1000", style: motionStyle(`rotate(${alt / 1e4 * 360}deg)`, duration), children: /* @__PURE__ */ jsx5("path", { d: `M ${CENTER - 9} ${CENTER + 14} L ${CENTER - 12} ${CENTER - 70} L ${CENTER} ${CENTER - 100} L ${CENTER + 12} ${CENTER - 70} L ${CENTER + 9} ${CENTER + 14} Z`, fill: "#fff", stroke: "#000", strokeWidth: "1.5" }) }),
374
+ /* @__PURE__ */ jsx5("g", { "data-testid": "altimeter-100", style: motionStyle(`rotate(${alt / 1e3 * 360}deg)`, duration), children: /* @__PURE__ */ jsx5("path", { d: `M ${CENTER - 5} ${CENTER + 30} L ${CENTER - 4} ${CENTER - 140} L ${CENTER} ${CENTER - 168} L ${CENTER + 4} ${CENTER - 140} L ${CENTER + 5} ${CENTER + 30} Z`, fill: "#fff", stroke: "#000", strokeWidth: "1.5" }) }),
375
+ /* @__PURE__ */ jsx5(Hub, {})
376
+ ]
377
+ }
378
+ );
288
379
  }
289
380
 
290
381
  // src/components/VerticalSpeed.tsx
@@ -612,7 +703,7 @@ function VorIndicator({ course = 0, radial, deviation, toFrom, signal = true, ne
612
703
  const needleAngle = -(dev / FULL_SCALE_DEG) * SWING_FULL_SCALE_DEG;
613
704
  const devText = Math.abs(dev) < 0.05 ? "centred" : `${Math.abs(dev).toFixed(1)}\xB0 ${dev > 0 ? "right" : "left"}`;
614
705
  const label2 = signal ? `VOR indicator: course ${courseText}\xB0, needle ${devText}, ${flag === "OFF" ? "no TO/FROM indication" : flag}` : `VOR indicator: course ${courseText}\xB0, no signal`;
615
- return /* @__PURE__ */ jsxs9(InstrumentFrame, { ...props, label: label2, children: [
706
+ return /* @__PURE__ */ jsxs9(InstrumentFrame, { ...props, label: label2, knobs: [{ id: "obs", label: "OBS", position: "bottom-left", angle: crs }], children: [
616
707
  /* @__PURE__ */ jsxs9("g", { "data-testid": "vor-card", style: motionStyle(`rotate(${-displayCourse}deg)`, duration), children: [
617
708
  /* @__PURE__ */ jsx9("g", { stroke: "#fff", strokeLinecap: "round", children: range(0, 355, 5).map((a) => /* @__PURE__ */ jsx9("path", { d: tickPath(176, a % 10 === 0 ? 152 : 164, a), strokeWidth: a % 10 === 0 ? 3 : 2 }, a)) }),
618
709
  range(0, 330, 30).map((a) => {
@@ -812,7 +903,7 @@ function IlsIndicator({
812
903
  const label2 = signal ? `ILS indicator: course ${courseText}\xB0, course needle ${devText}, ${gsText}, ${flag === "OFF" ? "no TO/FROM indication" : flag}` : `ILS indicator: course ${courseText}\xB0, no NAV signal, ${gsText}`;
813
904
  const clipId = useSvgId("fi-ils-clip");
814
905
  const dots = range(1, 5, 1).flatMap((i) => [-i, i]);
815
- return /* @__PURE__ */ jsxs10(InstrumentFrame, { ...props, label: label2, children: [
906
+ return /* @__PURE__ */ jsxs10(InstrumentFrame, { ...props, label: label2, knobs: [{ id: "obs", label: "OBS", position: "bottom-left", angle: crs }], children: [
816
907
  /* @__PURE__ */ jsxs10("g", { "data-testid": "ils-card", style: motionStyle(`rotate(${-displayCourse}deg)`, duration), children: [
817
908
  /* @__PURE__ */ jsx10("g", { stroke: "#eee", strokeLinecap: "butt", children: range(0, 355, 5).map((a) => /* @__PURE__ */ jsx10("path", { d: tickPath(170, a % 10 === 0 ? 154 : 162, a), strokeWidth: a % 10 === 0 ? 4 : 2.5 }, a)) }),
818
909
  range(0, 330, 30).map((a) => {
@@ -875,25 +966,195 @@ function IlsIndicator({
875
966
  ] }),
876
967
  /* @__PURE__ */ jsx10(FlagWindow, { x: CENTER, y: CENTER + FLAG_OFFSET, axis: "h", visible: !signal, testId: "ils-nav-flag" }),
877
968
  /* @__PURE__ */ jsx10(FlagWindow, { x: CENTER + FLAG_OFFSET, y: CENTER, axis: "v", visible: !hasGs, testId: "ils-gs-flag" }),
878
- swing && /* @__PURE__ */ jsx10("circle", { cx: GS_PIVOT_X, cy: CENTER, r: "7", fill: "#1a1a1a", stroke: "#555", strokeWidth: "2" }),
879
- props.showBox !== false && /* @__PURE__ */ jsxs10("g", { "data-testid": "ils-obs", children: [
880
- /* @__PURE__ */ jsx10("circle", { cx: 44, cy: 356, r: "30", fill: "#1a1a1a", stroke: "#000", strokeWidth: "2" }),
881
- /* @__PURE__ */ jsx10("circle", { cx: 44, cy: 356, r: "24", fill: "#2a2a2a", stroke: "#ddd", strokeWidth: "2" }),
882
- /* @__PURE__ */ jsx10("text", { x: 44, y: 356, fill: "#eee", fontSize: "13", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: "OBS" })
883
- ] })
969
+ swing && /* @__PURE__ */ jsx10("circle", { cx: GS_PIVOT_X, cy: CENTER, r: "7", fill: "#1a1a1a", stroke: "#555", strokeWidth: "2" })
884
970
  ] });
885
971
  }
886
972
 
887
- // src/components/AdfIndicator.tsx
973
+ // src/components/HsiIndicator.tsx
888
974
  import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
889
975
  var CARDINALS5 = { 0: "N", 90: "E", 180: "S", 270: "W" };
890
976
  var AMBER3 = "#ffb000";
977
+ var COURSE = "#e6d930";
978
+ var BUG = "#ff7a1a";
979
+ var FLAG2 = "#e0342a";
980
+ var DOT_SPACING3 = 36;
981
+ var FULL_SCALE_PX3 = DOT_SPACING3 * 2;
982
+ var BAR_HALF = 58;
983
+ var GS_X = 108;
984
+ var GS_DOT_SPACING = 24;
985
+ var GS_FULL_SCALE_PX = GS_DOT_SPACING * 2;
986
+ var norm4 = (deg2) => (deg2 % 360 + 360) % 360;
987
+ var round22 = (n) => Math.round(n * 100) / 100 + 0;
988
+ var pad3 = (deg2) => String(Math.round(norm4(deg2)) % 360 || 360).padStart(3, "0");
989
+ function WarningFlag({ x, y, text, visible, testId, vertical }) {
990
+ const [w, h] = vertical ? [20, 46] : [44, 20];
991
+ return /* @__PURE__ */ jsxs11("g", { "data-testid": testId, opacity: visible ? 1 : 0, style: { transition: "opacity 200ms ease-out" }, children: [
992
+ /* @__PURE__ */ jsx11("rect", { x: x - w / 2, y: y - h / 2, width: w, height: h, rx: "2", fill: FLAG2, stroke: "#000", strokeWidth: "1.5" }),
993
+ vertical ? text.split("").map((c, i) => /* @__PURE__ */ jsx11("text", { x, y: y + (i - (text.length - 1) / 2) * 15, fill: "#111", fontSize: "14", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: c }, i)) : /* @__PURE__ */ jsx11("text", { x, y, fill: "#111", fontSize: "14", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: text })
994
+ ] });
995
+ }
996
+ function GlideslopeScale({ side, y, visible, duration }) {
997
+ const x = CENTER + side * GS_X;
998
+ return /* @__PURE__ */ jsxs11("g", { children: [
999
+ /* @__PURE__ */ jsx11("g", { fill: "none", stroke: "#eee", strokeWidth: "2", children: [-2, -1, 1, 2].map((i) => /* @__PURE__ */ jsx11("circle", { cx: x, cy: CENTER + i * GS_DOT_SPACING, r: "4.5" }, i)) }),
1000
+ /* @__PURE__ */ jsx11("path", { d: `M ${x - 7} ${CENTER} h 14`, stroke: "#eee", strokeWidth: "3", strokeLinecap: "round" }),
1001
+ /* @__PURE__ */ jsx11(
1002
+ "g",
1003
+ {
1004
+ "data-testid": side > 0 ? "hsi-gs-pointer" : "hsi-gs-pointer-left",
1005
+ opacity: visible ? 1 : 0,
1006
+ style: { ...motionStyle(`translate(0px, ${y}px)`, duration), transition: duration > 0 ? `transform ${duration}ms ease-out, opacity 200ms ease-out` : "opacity 200ms ease-out" },
1007
+ children: /* @__PURE__ */ jsx11("path", { d: `M ${x - side * 7} ${CENTER} l ${side * 15} -9 v 18 z`, fill: "#3ddc84", stroke: "#000", strokeWidth: "1.5", strokeLinejoin: "round" })
1008
+ }
1009
+ )
1010
+ ] });
1011
+ }
1012
+ function HsiIndicator({
1013
+ heading = 0,
1014
+ headingBug,
1015
+ course = 0,
1016
+ radial,
1017
+ deviation,
1018
+ fullScale = 10,
1019
+ toFrom,
1020
+ signal = true,
1021
+ glideslope,
1022
+ glideslopeFullScale = 0.7,
1023
+ glideslopeSignal,
1024
+ ...props
1025
+ }) {
1026
+ const duration = props.animationDuration ?? DEFAULT_ANIMATION_MS;
1027
+ const hdg = finite(heading);
1028
+ const crs = finite(course);
1029
+ const hasBug = typeof headingBug === "number" && Number.isFinite(headingBug);
1030
+ const bug = hasBug ? headingBug : 0;
1031
+ const computed = typeof radial === "number" && Number.isFinite(radial) ? vorDeviation(crs, radial) : void 0;
1032
+ const locScale = finite(fullScale, 10) > 0 ? finite(fullScale, 10) : 10;
1033
+ const gsScale = finite(glideslopeFullScale, 0.7) > 0 ? finite(glideslopeFullScale, 0.7) : 0.7;
1034
+ const dev = signal ? clamp(finite(deviation, computed?.deviation ?? 0), -locScale, locScale) : 0;
1035
+ const flag = !signal ? "OFF" : toFrom ?? computed?.toFrom ?? "OFF";
1036
+ const hasGs = glideslopeSignal ?? (typeof glideslope === "number" && Number.isFinite(glideslope));
1037
+ const gs = hasGs ? clamp(finite(glideslope), -gsScale, gsScale) : 0;
1038
+ const barX = round22(dev / locScale * FULL_SCALE_PX3);
1039
+ const gsY = round22(-(gs / gsScale) * GS_FULL_SCALE_PX);
1040
+ const displayHeading = useContinuousAngle(hdg);
1041
+ const displayCourse = useContinuousAngle(crs);
1042
+ const displayBug = useContinuousAngle(bug);
1043
+ const devText = Math.abs(dev) < 0.05 ? "centred" : `${Math.abs(dev).toFixed(1)}\xB0 ${dev > 0 ? "right" : "left"}`;
1044
+ const gsText = !hasGs ? "glideslope off" : Math.abs(gs) < 5e-3 ? "glideslope centred" : `glideslope ${Math.abs(gs).toFixed(2)}\xB0 ${gs > 0 ? "up" : "down"}`;
1045
+ const navText = signal ? `course bar ${devText}, ${flag === "OFF" ? "no TO/FROM indication" : flag}` : "no NAV signal";
1046
+ const label2 = `HSI: heading ${pad3(hdg)}\xB0, course ${pad3(crs)}\xB0, ${navText}, ${gsText}${hasBug ? `, heading bug ${pad3(bug)}\xB0` : ""}`;
1047
+ return /* @__PURE__ */ jsxs11(
1048
+ InstrumentFrame,
1049
+ {
1050
+ ...props,
1051
+ label: label2,
1052
+ knobs: [
1053
+ { id: "crs", label: "CRS", position: "bottom-left", angle: crs },
1054
+ { id: "hdg", label: "HDG", position: "bottom-right", angle: bug }
1055
+ ],
1056
+ children: [
1057
+ /* @__PURE__ */ jsxs11("g", { "data-testid": "hsi-card", style: motionStyle(`rotate(${-displayHeading}deg)`, duration), children: [
1058
+ /* @__PURE__ */ jsx11("g", { stroke: "#eee", strokeLinecap: "butt", children: range(0, 355, 5).map((a) => /* @__PURE__ */ jsx11("path", { d: tickPath(172, a % 10 === 0 ? 154 : 163, a), strokeWidth: a % 10 === 0 ? 3.5 : 2 }, a)) }),
1059
+ range(0, 330, 30).map((a) => {
1060
+ const [x, y] = polar(138, a);
1061
+ return /* @__PURE__ */ jsx11(
1062
+ "text",
1063
+ {
1064
+ x,
1065
+ y,
1066
+ transform: `rotate(${a} ${x} ${y})`,
1067
+ fill: "#eee",
1068
+ fontSize: a % 90 === 0 ? 24 : 21,
1069
+ fontWeight: "bold",
1070
+ textAnchor: "middle",
1071
+ dominantBaseline: "central",
1072
+ children: CARDINALS5[a] ?? String(a / 10)
1073
+ },
1074
+ a
1075
+ );
1076
+ }),
1077
+ /* @__PURE__ */ jsx11("g", { "data-testid": "hsi-heading-bug", opacity: hasBug ? 1 : 0, style: motionStyle(`rotate(${displayBug}deg)`, duration), children: /* @__PURE__ */ jsx11(
1078
+ "path",
1079
+ {
1080
+ d: `M ${CENTER - 13} ${CENTER - 182} h 26 v 20 h -7 l -6 -8 l -6 8 h -7 z`,
1081
+ fill: BUG,
1082
+ stroke: "#000",
1083
+ strokeWidth: "1.5",
1084
+ strokeLinejoin: "round"
1085
+ }
1086
+ ) }),
1087
+ /* @__PURE__ */ jsxs11("g", { "data-testid": "hsi-course", style: motionStyle(`rotate(${displayCourse}deg)`, duration), children: [
1088
+ /* @__PURE__ */ jsx11("g", { fill: "none", stroke: "#eee", strokeWidth: "2.5", children: [-2, -1, 1, 2].map((i) => /* @__PURE__ */ jsx11("circle", { cx: CENTER + i * DOT_SPACING3, cy: CENTER, r: "6" }, i)) }),
1089
+ /* @__PURE__ */ jsx11(
1090
+ "path",
1091
+ {
1092
+ d: `M ${CENTER} ${CENTER - 126} l 13 24 h -8 v 40 h -10 v -40 h -8 z`,
1093
+ fill: COURSE,
1094
+ stroke: "#000",
1095
+ strokeWidth: "1.5",
1096
+ strokeLinejoin: "round"
1097
+ }
1098
+ ),
1099
+ /* @__PURE__ */ jsx11("rect", { x: CENTER - 5, y: CENTER + 62, width: "10", height: "58", fill: COURSE, stroke: "#000", strokeWidth: "1.5" }),
1100
+ /* @__PURE__ */ jsx11("g", { "data-testid": "hsi-cdi", style: motionStyle(`translate(${barX}px, 0px)`, duration), children: /* @__PURE__ */ jsx11("rect", { x: CENTER - 5, y: CENTER - BAR_HALF, width: "10", height: BAR_HALF * 2, fill: COURSE, stroke: "#000", strokeWidth: "1.5" }) }),
1101
+ /* @__PURE__ */ jsx11(
1102
+ "path",
1103
+ {
1104
+ "data-testid": "hsi-to",
1105
+ d: `M ${CENTER + 26} ${CENTER - 58} l 11 18 h -22 z`,
1106
+ fill: "#eee",
1107
+ stroke: "#000",
1108
+ strokeWidth: "1.5",
1109
+ opacity: flag === "TO" ? 1 : 0,
1110
+ style: { transition: "opacity 200ms ease-out" }
1111
+ }
1112
+ ),
1113
+ /* @__PURE__ */ jsx11(
1114
+ "path",
1115
+ {
1116
+ "data-testid": "hsi-from",
1117
+ d: `M ${CENTER + 26} ${CENTER + 58} l 11 -18 h -22 z`,
1118
+ fill: "#eee",
1119
+ stroke: "#000",
1120
+ strokeWidth: "1.5",
1121
+ opacity: flag === "FROM" ? 1 : 0,
1122
+ style: { transition: "opacity 200ms ease-out" }
1123
+ }
1124
+ )
1125
+ ] })
1126
+ ] }),
1127
+ /* @__PURE__ */ jsx11("g", { stroke: AMBER3, strokeWidth: "4", strokeLinecap: "round", children: [45, 135, 225, 315].map((a) => /* @__PURE__ */ jsx11("path", { d: tickPath(192, 180, a) }, a)) }),
1128
+ /* @__PURE__ */ jsx11("path", { d: `M ${CENTER} ${CENTER - 156} l -9 -24 h 18 z`, fill: AMBER3, stroke: "#000", strokeWidth: "1" }),
1129
+ /* @__PURE__ */ jsx11(
1130
+ "path",
1131
+ {
1132
+ d: `M ${CENTER} ${CENTER - 30} c 4 0 5 5 5 10 v 14 l 25 9 v 7 l -25 -3 v 16 l 10 6 v 6 l -15 -3 l -15 3 v -6 l 10 -6 v -16 l -25 3 v -7 l 25 -9 v -14 c 0 -5 1 -10 5 -10 z`,
1133
+ fill: AMBER3,
1134
+ stroke: "#000",
1135
+ strokeWidth: "1.5",
1136
+ strokeLinejoin: "round"
1137
+ }
1138
+ ),
1139
+ /* @__PURE__ */ jsx11(GlideslopeScale, { side: -1, y: gsY, visible: hasGs, duration }),
1140
+ /* @__PURE__ */ jsx11(GlideslopeScale, { side: 1, y: gsY, visible: hasGs, duration }),
1141
+ /* @__PURE__ */ jsx11(WarningFlag, { x: CENTER + GS_X, y: CENTER, text: "GS", visible: !hasGs, testId: "hsi-gs-flag", vertical: true }),
1142
+ /* @__PURE__ */ jsx11(WarningFlag, { x: CENTER - 62, y: CENTER - 84, text: "NAV", visible: !signal, testId: "hsi-nav-flag" })
1143
+ ]
1144
+ }
1145
+ );
1146
+ }
1147
+
1148
+ // src/components/AdfIndicator.tsx
1149
+ import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
1150
+ var CARDINALS6 = { 0: "N", 90: "E", 180: "S", 270: "W" };
1151
+ var AMBER4 = "#ffb000";
891
1152
  var NEEDLE = "#ffe14d";
892
1153
  var PARKED_DEG = 90;
893
- var norm4 = (deg2) => (deg2 % 360 + 360) % 360;
894
- var pad3 = (deg2) => String(Math.round(norm4(deg2)) % 360).padStart(3, "0");
1154
+ var norm5 = (deg2) => (deg2 % 360 + 360) % 360;
1155
+ var pad32 = (deg2) => String(Math.round(norm5(deg2)) % 360).padStart(3, "0");
895
1156
  function relativeBearing(heading, bearingToStation) {
896
- return norm4(finite(bearingToStation) - finite(heading));
1157
+ return norm5(finite(bearingToStation) - finite(heading));
897
1158
  }
898
1159
  function AdfIndicator({ bearing = 0, heading = 0, signal = true, ...props }) {
899
1160
  const duration = props.animationDuration ?? DEFAULT_ANIMATION_MS;
@@ -901,41 +1162,41 @@ function AdfIndicator({ bearing = 0, heading = 0, signal = true, ...props }) {
901
1162
  const hdg = finite(heading);
902
1163
  const displayCard = useContinuousAngle(hdg);
903
1164
  const displayNeedle = useContinuousAngle(signal ? rel : PARKED_DEG);
904
- const label2 = signal ? `ADF indicator: station ${pad3(rel)}\xB0 relative, bearing ${pad3(rel + hdg)}\xB0 to station` : "ADF indicator: no signal";
905
- return /* @__PURE__ */ jsxs11(InstrumentFrame, { ...props, label: label2, children: [
906
- /* @__PURE__ */ jsxs11("g", { "data-testid": "adf-card", style: motionStyle(`rotate(${-displayCard}deg)`, duration), children: [
907
- /* @__PURE__ */ jsx11("g", { stroke: "#fff", strokeLinecap: "round", children: range(0, 355, 5).map((a) => /* @__PURE__ */ jsx11("path", { d: tickPath(176, a % 10 === 0 ? 152 : 164, a), strokeWidth: a % 10 === 0 ? 3 : 2 }, a)) }),
1165
+ const label2 = signal ? `ADF indicator: station ${pad32(rel)}\xB0 relative, bearing ${pad32(rel + hdg)}\xB0 to station` : "ADF indicator: no signal";
1166
+ return /* @__PURE__ */ jsxs12(InstrumentFrame, { ...props, label: label2, knobs: [{ id: "hdg", label: "HDG", position: "bottom-left", angle: hdg }], children: [
1167
+ /* @__PURE__ */ jsxs12("g", { "data-testid": "adf-card", style: motionStyle(`rotate(${-displayCard}deg)`, duration), children: [
1168
+ /* @__PURE__ */ jsx12("g", { stroke: "#fff", strokeLinecap: "round", children: range(0, 355, 5).map((a) => /* @__PURE__ */ jsx12("path", { d: tickPath(176, a % 10 === 0 ? 152 : 164, a), strokeWidth: a % 10 === 0 ? 3 : 2 }, a)) }),
908
1169
  range(0, 330, 30).map((a) => {
909
1170
  const [x, y] = polar(132, a);
910
- return /* @__PURE__ */ jsx11(
1171
+ return /* @__PURE__ */ jsx12(
911
1172
  "text",
912
1173
  {
913
1174
  x,
914
1175
  y,
915
1176
  transform: `rotate(${a} ${x} ${y})`,
916
- fill: a % 90 === 0 ? AMBER3 : "#fff",
1177
+ fill: a % 90 === 0 ? AMBER4 : "#fff",
917
1178
  fontSize: a % 90 === 0 ? 28 : 24,
918
1179
  fontWeight: "bold",
919
1180
  textAnchor: "middle",
920
1181
  dominantBaseline: "central",
921
- children: CARDINALS5[a] ?? String(a / 10)
1182
+ children: CARDINALS6[a] ?? String(a / 10)
922
1183
  },
923
1184
  a
924
1185
  );
925
1186
  })
926
1187
  ] }),
927
- /* @__PURE__ */ jsx11("path", { d: `M ${CENTER} ${CENTER - 150} l -10 -28 h 20 z`, fill: AMBER3, stroke: "#000", strokeWidth: "1.5" }),
928
- /* @__PURE__ */ jsx11("g", { stroke: AMBER3, strokeWidth: "4", strokeLinecap: "round", children: [45, 90, 135, 180, 225, 270, 315].map((a) => /* @__PURE__ */ jsx11("path", { d: tickPath(192, 178, a) }, a)) }),
929
- /* @__PURE__ */ jsxs11("g", { stroke: AMBER3, strokeWidth: "2", strokeLinecap: "round", opacity: "0.7", children: [
930
- /* @__PURE__ */ jsx11("path", { d: `M ${CENTER - 26} ${CENTER} H ${CENTER + 26}` }),
931
- /* @__PURE__ */ jsx11("path", { d: `M ${CENTER} ${CENTER - 26} V ${CENTER + 14}` })
1188
+ /* @__PURE__ */ jsx12("path", { d: `M ${CENTER} ${CENTER - 150} l -10 -28 h 20 z`, fill: AMBER4, stroke: "#000", strokeWidth: "1.5" }),
1189
+ /* @__PURE__ */ jsx12("g", { stroke: AMBER4, strokeWidth: "4", strokeLinecap: "round", children: [45, 90, 135, 180, 225, 270, 315].map((a) => /* @__PURE__ */ jsx12("path", { d: tickPath(192, 178, a) }, a)) }),
1190
+ /* @__PURE__ */ jsxs12("g", { stroke: AMBER4, strokeWidth: "2", strokeLinecap: "round", opacity: "0.7", children: [
1191
+ /* @__PURE__ */ jsx12("path", { d: `M ${CENTER - 26} ${CENTER} H ${CENTER + 26}` }),
1192
+ /* @__PURE__ */ jsx12("path", { d: `M ${CENTER} ${CENTER - 26} V ${CENTER + 14}` })
932
1193
  ] }),
933
- /* @__PURE__ */ jsx11("text", { x: CENTER, y: CENTER + 62, fill: "#ccc", fontSize: "15", fontWeight: "bold", letterSpacing: "2", textAnchor: "middle", dominantBaseline: "central", children: "ADF" }),
934
- /* @__PURE__ */ jsxs11("g", { "data-testid": "adf-flag", opacity: signal ? 0 : 1, style: { transition: "opacity 200ms ease-out" }, children: [
935
- /* @__PURE__ */ jsx11("rect", { x: CENTER - 28, y: CENTER - 76, width: "56", height: "24", rx: "3", fill: "#d42626", stroke: "#000", strokeWidth: "1.5" }),
936
- /* @__PURE__ */ jsx11("text", { x: CENTER, y: CENTER - 63, fill: "#fff", fontSize: "15", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: "ADF" })
1194
+ /* @__PURE__ */ jsx12("text", { x: CENTER, y: CENTER + 62, fill: "#ccc", fontSize: "15", fontWeight: "bold", letterSpacing: "2", textAnchor: "middle", dominantBaseline: "central", children: "ADF" }),
1195
+ /* @__PURE__ */ jsxs12("g", { "data-testid": "adf-flag", opacity: signal ? 0 : 1, style: { transition: "opacity 200ms ease-out" }, children: [
1196
+ /* @__PURE__ */ jsx12("rect", { x: CENTER - 28, y: CENTER - 76, width: "56", height: "24", rx: "3", fill: "#d42626", stroke: "#000", strokeWidth: "1.5" }),
1197
+ /* @__PURE__ */ jsx12("text", { x: CENTER, y: CENTER - 63, fill: "#fff", fontSize: "15", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: "ADF" })
937
1198
  ] }),
938
- /* @__PURE__ */ jsx11("g", { "data-testid": "adf-needle", style: motionStyle(`rotate(${displayNeedle}deg)`, duration), children: /* @__PURE__ */ jsx11(
1199
+ /* @__PURE__ */ jsx12("g", { "data-testid": "adf-needle", style: motionStyle(`rotate(${displayNeedle}deg)`, duration), children: /* @__PURE__ */ jsx12(
939
1200
  "path",
940
1201
  {
941
1202
  d: `M ${CENTER} ${CENTER - 146} l -13 30 h 9 V ${CENTER + 140} h 8 V ${CENTER - 116} h 9 z`,
@@ -945,12 +1206,12 @@ function AdfIndicator({ bearing = 0, heading = 0, signal = true, ...props }) {
945
1206
  strokeLinejoin: "round"
946
1207
  }
947
1208
  ) }),
948
- /* @__PURE__ */ jsx11(Hub, { r: 10 })
1209
+ /* @__PURE__ */ jsx12(Hub, { r: 10 })
949
1210
  ] });
950
1211
  }
951
1212
 
952
1213
  // src/components/RadioPanel.tsx
953
- import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
1214
+ import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
954
1215
  var SIDE = 252;
955
1216
  var ORIGIN = CENTER - SIDE / 2;
956
1217
  var ROW_H = 60;
@@ -967,9 +1228,9 @@ var formatAdf = (khz) => usable(khz) ? Number.isInteger(khz) ? String(khz) : khz
967
1228
  var formatDme = (nm) => usable(nm) ? nm < 99.95 ? nm.toFixed(1) : nm.toFixed(0) : "--.-";
968
1229
  function Display({ x, y, width, value, color, testId, unit }) {
969
1230
  const h = ROW_H - 16;
970
- return /* @__PURE__ */ jsxs12("g", { children: [
971
- /* @__PURE__ */ jsx12("rect", { x, y: y + 8, width, height: h, rx: "5", fill: "#1a0d00", stroke: "#3a2a14", strokeWidth: "1.5" }),
972
- /* @__PURE__ */ jsx12(
1231
+ return /* @__PURE__ */ jsxs13("g", { children: [
1232
+ /* @__PURE__ */ jsx13("rect", { x, y: y + 8, width, height: h, rx: "5", fill: "#1a0d00", stroke: "#3a2a14", strokeWidth: "1.5" }),
1233
+ /* @__PURE__ */ jsx13(
973
1234
  "text",
974
1235
  {
975
1236
  "data-testid": testId,
@@ -984,18 +1245,18 @@ function Display({ x, y, width, value, color, testId, unit }) {
984
1245
  children: value
985
1246
  }
986
1247
  ),
987
- unit && /* @__PURE__ */ jsx12("text", { x: x + width - 10, y: y + ROW_H / 2 + 5, fill: "#9aa4b1", fontSize: "13", fontWeight: "bold", textAnchor: "end", dominantBaseline: "central", children: unit })
1248
+ unit && /* @__PURE__ */ jsx13("text", { x: x + width - 10, y: y + ROW_H / 2 + 5, fill: "#9aa4b1", fontSize: "13", fontWeight: "bold", textAnchor: "end", dominantBaseline: "central", children: unit })
988
1249
  ] });
989
1250
  }
990
1251
  function Swap({ y }) {
991
1252
  const cy = y + ROW_H / 2;
992
- return /* @__PURE__ */ jsxs12("g", { stroke: "#9aa4b1", strokeWidth: "1.8", fill: "none", strokeLinecap: "round", strokeLinejoin: "round", children: [
993
- /* @__PURE__ */ jsx12("path", { d: `M ${SWAP_X - 7} ${cy - 4} H ${SWAP_X + 7} m -4 -3 l 4 3 l -4 3` }),
994
- /* @__PURE__ */ jsx12("path", { d: `M ${SWAP_X + 7} ${cy + 4} H ${SWAP_X - 7} m 4 -3 l -4 3 l 4 3` })
1253
+ return /* @__PURE__ */ jsxs13("g", { stroke: "#9aa4b1", strokeWidth: "1.8", fill: "none", strokeLinecap: "round", strokeLinejoin: "round", children: [
1254
+ /* @__PURE__ */ jsx13("path", { d: `M ${SWAP_X - 7} ${cy - 4} H ${SWAP_X + 7} m -4 -3 l 4 3 l -4 3` }),
1255
+ /* @__PURE__ */ jsx13("path", { d: `M ${SWAP_X + 7} ${cy + 4} H ${SWAP_X - 7} m 4 -3 l -4 3 l 4 3` })
995
1256
  ] });
996
1257
  }
997
1258
  function RowLabel({ y, children }) {
998
- return /* @__PURE__ */ jsx12("text", { x: LABEL_X, y: y + ROW_H / 2 + 1, fill: "#ccc", fontSize: "14", fontWeight: "bold", letterSpacing: "1", dominantBaseline: "central", children });
1259
+ return /* @__PURE__ */ jsx13("text", { x: LABEL_X, y: y + ROW_H / 2 + 1, fill: "#ccc", fontSize: "14", fontWeight: "bold", letterSpacing: "1", dominantBaseline: "central", children });
999
1260
  }
1000
1261
  function RadioPanel({ nav, adf, dme, color = "#ff9a2e", ...props }) {
1001
1262
  const rows = [
@@ -1005,29 +1266,29 @@ function RadioPanel({ nav, adf, dme, color = "#ff9a2e", ...props }) {
1005
1266
  const dmeText = formatDme(dme);
1006
1267
  const dmeY = FIRST_ROW + 2 * (ROW_H + ROW_GAP);
1007
1268
  const label2 = "Radio panel: " + rows.map((r) => `${r.name} ${r.tuned ? `${r.active} ${r.unit}` : "not tuned"}`).join(", ") + `, DME ${usable(dme) ? `${dmeText} NM` : "no distance"}`;
1008
- return /* @__PURE__ */ jsxs12(InstrumentFrame, { ...props, label: label2, children: [
1009
- /* @__PURE__ */ jsx12("rect", { x: ORIGIN, y: ORIGIN, width: SIDE, height: SIDE, rx: "10", fill: "#1c1f24", stroke: "#3a3f47", strokeWidth: "2" }),
1010
- /* @__PURE__ */ jsxs12("g", { fill: "#9aa4b1", fontSize: "11", fontWeight: "bold", letterSpacing: "1.5", textAnchor: "middle", dominantBaseline: "central", children: [
1011
- /* @__PURE__ */ jsx12("text", { x: ACTIVE_X + DISPLAY_W / 2, y: ORIGIN + 22, children: "ACTIVE" }),
1012
- /* @__PURE__ */ jsx12("text", { x: STANDBY_X + DISPLAY_W / 2, y: ORIGIN + 22, children: "STBY" })
1269
+ return /* @__PURE__ */ jsxs13(InstrumentFrame, { ...props, label: label2, children: [
1270
+ /* @__PURE__ */ jsx13("rect", { x: ORIGIN, y: ORIGIN, width: SIDE, height: SIDE, rx: "10", fill: "#1c1f24", stroke: "#3a3f47", strokeWidth: "2" }),
1271
+ /* @__PURE__ */ jsxs13("g", { fill: "#9aa4b1", fontSize: "11", fontWeight: "bold", letterSpacing: "1.5", textAnchor: "middle", dominantBaseline: "central", children: [
1272
+ /* @__PURE__ */ jsx13("text", { x: ACTIVE_X + DISPLAY_W / 2, y: ORIGIN + 22, children: "ACTIVE" }),
1273
+ /* @__PURE__ */ jsx13("text", { x: STANDBY_X + DISPLAY_W / 2, y: ORIGIN + 22, children: "STBY" })
1013
1274
  ] }),
1014
1275
  rows.map((r, i) => {
1015
1276
  const y = FIRST_ROW + i * (ROW_H + ROW_GAP);
1016
- return /* @__PURE__ */ jsxs12("g", { children: [
1017
- /* @__PURE__ */ jsx12(RowLabel, { y, children: r.name }),
1018
- /* @__PURE__ */ jsx12(Display, { x: ACTIVE_X, y, width: DISPLAY_W, value: r.active, color, testId: `radio-${r.key}-active` }),
1019
- /* @__PURE__ */ jsx12(Swap, { y }),
1020
- /* @__PURE__ */ jsx12(Display, { x: STANDBY_X, y, width: DISPLAY_W, value: r.standby, color, testId: `radio-${r.key}-standby` })
1277
+ return /* @__PURE__ */ jsxs13("g", { children: [
1278
+ /* @__PURE__ */ jsx13(RowLabel, { y, children: r.name }),
1279
+ /* @__PURE__ */ jsx13(Display, { x: ACTIVE_X, y, width: DISPLAY_W, value: r.active, color, testId: `radio-${r.key}-active` }),
1280
+ /* @__PURE__ */ jsx13(Swap, { y }),
1281
+ /* @__PURE__ */ jsx13(Display, { x: STANDBY_X, y, width: DISPLAY_W, value: r.standby, color, testId: `radio-${r.key}-standby` })
1021
1282
  ] }, r.key);
1022
1283
  }),
1023
- /* @__PURE__ */ jsx12(RowLabel, { y: dmeY, children: "DME" }),
1024
- /* @__PURE__ */ jsx12(Display, { x: ACTIVE_X, y: dmeY, width: STANDBY_X + DISPLAY_W - ACTIVE_X, value: dmeText, color, testId: "radio-dme", unit: "NM" })
1284
+ /* @__PURE__ */ jsx13(RowLabel, { y: dmeY, children: "DME" }),
1285
+ /* @__PURE__ */ jsx13(Display, { x: ACTIVE_X, y: dmeY, width: STANDBY_X + DISPLAY_W - ACTIVE_X, value: dmeText, color, testId: "radio-dme", unit: "NM" })
1025
1286
  ] });
1026
1287
  }
1027
1288
 
1028
1289
  // src/components/RadioStack.tsx
1029
1290
  import { useState } from "react";
1030
- import { Fragment as Fragment4, jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
1291
+ import { Fragment as Fragment4, jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
1031
1292
  var parseNav = (text) => {
1032
1293
  const mhz = Math.round(Number.parseFloat(text.replace(",", ".")) * 100) / 100;
1033
1294
  return mhz >= 108 && mhz <= 117.95 ? mhz : void 0;
@@ -1060,9 +1321,9 @@ var display = {
1060
1321
  var label = { display: "flex", flexDirection: "column", justifyContent: "center", color: LABEL, fontWeight: "bold", letterSpacing: "0.06em", lineHeight: 1.15 };
1061
1322
  var ident = { color: "#3cc8ff", fontSize: "0.72em", fontFamily: MONO, minHeight: "1.15em" };
1062
1323
  function SwapIcon() {
1063
- return /* @__PURE__ */ jsxs13("svg", { viewBox: "0 0 16 16", width: "1em", height: "1em", "aria-hidden": "true", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round", children: [
1064
- /* @__PURE__ */ jsx13("path", { d: "M2 5.5 H14 M11 2.5 l3 3 l-3 3" }),
1065
- /* @__PURE__ */ jsx13("path", { d: "M14 10.5 H2 M5 7.5 l-3 3 l3 3" })
1324
+ return /* @__PURE__ */ jsxs14("svg", { viewBox: "0 0 16 16", width: "1em", height: "1em", "aria-hidden": "true", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round", children: [
1325
+ /* @__PURE__ */ jsx14("path", { d: "M2 5.5 H14 M11 2.5 l3 3 l-3 3" }),
1326
+ /* @__PURE__ */ jsx14("path", { d: "M14 10.5 H2 M5 7.5 l-3 3 l3 3" })
1066
1327
  ] });
1067
1328
  }
1068
1329
  function Receiver({ name, unit, value, ident: station, color, format, parse, onChange }) {
@@ -1096,13 +1357,13 @@ function Receiver({ name, unit, value, ident: station, color, format, parse, onC
1096
1357
  if (text && standby === void 0 || standby === value.standby) return;
1097
1358
  onChange({ active: value.active, standby });
1098
1359
  };
1099
- return /* @__PURE__ */ jsxs13(Fragment4, { children: [
1100
- /* @__PURE__ */ jsxs13("div", { style: label, children: [
1101
- /* @__PURE__ */ jsx13("span", { children: name }),
1102
- /* @__PURE__ */ jsx13("span", { "data-testid": `radio-stack-${key}-ident`, style: ident, children: station ?? "" })
1360
+ return /* @__PURE__ */ jsxs14(Fragment4, { children: [
1361
+ /* @__PURE__ */ jsxs14("div", { style: label, children: [
1362
+ /* @__PURE__ */ jsx14("span", { children: name }),
1363
+ /* @__PURE__ */ jsx14("span", { "data-testid": `radio-stack-${key}-ident`, style: ident, children: station ?? "" })
1103
1364
  ] }),
1104
- /* @__PURE__ */ jsx13("div", { "data-testid": `radio-stack-${key}-active`, "aria-label": `${name} active frequency`, style: { ...display, color }, children: format(value.active) }),
1105
- /* @__PURE__ */ jsx13(
1365
+ /* @__PURE__ */ jsx14("div", { "data-testid": `radio-stack-${key}-active`, "aria-label": `${name} active frequency`, style: { ...display, color }, children: format(value.active) }),
1366
+ /* @__PURE__ */ jsx14(
1106
1367
  "button",
1107
1368
  {
1108
1369
  type: "button",
@@ -1110,10 +1371,10 @@ function Receiver({ name, unit, value, ident: station, color, format, parse, onC
1110
1371
  "aria-label": `Swap ${name} active and standby`,
1111
1372
  title: "Swap active and standby",
1112
1373
  style: { display: "flex", alignItems: "center", justifyContent: "center", width: "100%", height: "2em", padding: 0, margin: 0, border: "0.08em solid #555", borderRadius: "0.3em", background: "#3a3a3a", color: "#ddd", font: "inherit", fontSize: "1.2em", cursor: "pointer" },
1113
- children: /* @__PURE__ */ jsx13(SwapIcon, {})
1374
+ children: /* @__PURE__ */ jsx14(SwapIcon, {})
1114
1375
  }
1115
1376
  ),
1116
- /* @__PURE__ */ jsx13(
1377
+ /* @__PURE__ */ jsx14(
1117
1378
  "input",
1118
1379
  {
1119
1380
  type: "text",
@@ -1175,7 +1436,7 @@ function RadioStack({
1175
1436
  const heading = { color: MUTED, fontSize: "0.72em", fontWeight: "bold", letterSpacing: "0.12em", textAlign: "center" };
1176
1437
  return (
1177
1438
  // The outer box is a size container so every inner measurement can follow the width.
1178
- /* @__PURE__ */ jsx13("div", { className, style: { display: "inline-block", width, maxWidth: "100%", verticalAlign: "top", containerType: "inline-size", ...style }, children: /* @__PURE__ */ jsxs13(
1439
+ /* @__PURE__ */ jsx14("div", { className, style: { display: "inline-block", width, maxWidth: "100%", verticalAlign: "top", containerType: "inline-size", ...style }, children: /* @__PURE__ */ jsxs14(
1179
1440
  "div",
1180
1441
  {
1181
1442
  role: "group",
@@ -1198,20 +1459,20 @@ function RadioStack({
1198
1459
  userSelect: "none"
1199
1460
  },
1200
1461
  children: [
1201
- SCREWS2.map((position, i) => /* @__PURE__ */ jsxs13("svg", { viewBox: "-14 -14 28 28", "aria-hidden": "true", style: { position: "absolute", width: "0.75em", height: "0.75em", ...position }, children: [
1202
- /* @__PURE__ */ jsx13("circle", { r: "12", fill: "#3a3a3a", stroke: "#111", strokeWidth: "2" }),
1203
- /* @__PURE__ */ jsx13("path", { d: "M -8 3 L 8 -3", stroke: "#111", strokeWidth: "3" })
1462
+ SCREWS2.map((position, i) => /* @__PURE__ */ jsxs14("svg", { viewBox: "-14 -14 28 28", "aria-hidden": "true", style: { position: "absolute", width: "0.75em", height: "0.75em", ...position }, children: [
1463
+ /* @__PURE__ */ jsx14("circle", { r: "12", fill: "#3a3a3a", stroke: "#111", strokeWidth: "2" }),
1464
+ /* @__PURE__ */ jsx14("path", { d: "M -8 3 L 8 -3", stroke: "#111", strokeWidth: "3" })
1204
1465
  ] }, i)),
1205
- /* @__PURE__ */ jsx13("span", {}),
1206
- /* @__PURE__ */ jsx13("span", { style: heading, children: "ACTIVE" }),
1207
- /* @__PURE__ */ jsx13("span", {}),
1208
- /* @__PURE__ */ jsx13("span", { style: heading, children: "STBY" }),
1209
- /* @__PURE__ */ jsx13(Receiver, { name: "NAV", unit: "MHz", value: nav ?? innerNav, ident: navIdent, color, format: formatNav, parse: parseNav, onChange: changeNav }),
1210
- /* @__PURE__ */ jsx13(Receiver, { name: "ADF", unit: "kHz", value: adf ?? innerAdf, ident: adfIdent, color, format: formatAdf, parse: parseAdf, onChange: changeAdf }),
1211
- /* @__PURE__ */ jsx13("div", { style: label, children: "DME" }),
1212
- /* @__PURE__ */ jsxs13("div", { "aria-label": "DME distance", style: { ...display, gridColumn: "span 3", display: "flex", alignItems: "baseline", justifyContent: "flex-end", gap: "0.4em", padding: "0 0.5em", color }, children: [
1213
- /* @__PURE__ */ jsx13("span", { "data-testid": "radio-stack-dme", children: formatDme(dme) }),
1214
- /* @__PURE__ */ jsx13("span", { style: { color: MUTED, fontFamily: "'Helvetica Neue', Arial, sans-serif", fontSize: "0.5em" }, children: "NM" })
1466
+ /* @__PURE__ */ jsx14("span", {}),
1467
+ /* @__PURE__ */ jsx14("span", { style: heading, children: "ACTIVE" }),
1468
+ /* @__PURE__ */ jsx14("span", {}),
1469
+ /* @__PURE__ */ jsx14("span", { style: heading, children: "STBY" }),
1470
+ /* @__PURE__ */ jsx14(Receiver, { name: "NAV", unit: "MHz", value: nav ?? innerNav, ident: navIdent, color, format: formatNav, parse: parseNav, onChange: changeNav }),
1471
+ /* @__PURE__ */ jsx14(Receiver, { name: "ADF", unit: "kHz", value: adf ?? innerAdf, ident: adfIdent, color, format: formatAdf, parse: parseAdf, onChange: changeAdf }),
1472
+ /* @__PURE__ */ jsx14("div", { style: label, children: "DME" }),
1473
+ /* @__PURE__ */ jsxs14("div", { "aria-label": "DME distance", style: { ...display, gridColumn: "span 3", display: "flex", alignItems: "baseline", justifyContent: "flex-end", gap: "0.4em", padding: "0 0.5em", color }, children: [
1474
+ /* @__PURE__ */ jsx14("span", { "data-testid": "radio-stack-dme", children: formatDme(dme) }),
1475
+ /* @__PURE__ */ jsx14("span", { style: { color: MUTED, fontFamily: "'Helvetica Neue', Arial, sans-serif", fontSize: "0.5em" }, children: "NM" })
1215
1476
  ] })
1216
1477
  ]
1217
1478
  }
@@ -1220,7 +1481,7 @@ function RadioStack({
1220
1481
  }
1221
1482
 
1222
1483
  // src/components/DataPanel.tsx
1223
- import { jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
1484
+ import { jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
1224
1485
  var MAX_FIELDS = 6;
1225
1486
  var SIDE2 = 252;
1226
1487
  var PAD = 8;
@@ -1240,9 +1501,9 @@ function DataPanel({ fields = [], heading, ...props }) {
1240
1501
  const cellH = (SIDE2 - PAD * 2 - GAP * (rows - 1)) / rows;
1241
1502
  const valueSize = VALUE_SIZE[rows] ?? 27;
1242
1503
  const label2 = `${heading ?? "Data panel"}: ` + (shown.length ? shown.map((f) => `${f.name} ${formatValue(f)}${f.unit ? ` ${f.unit}` : ""}`).join(", ") : "no data");
1243
- return /* @__PURE__ */ jsxs14(InstrumentFrame, { ...props, label: label2, children: [
1244
- heading && /* @__PURE__ */ jsx14("text", { x: CENTER, y: ORIGIN2 - 14, fill: "#ccc", fontSize: "13", fontWeight: "bold", letterSpacing: "2", textAnchor: "middle", dominantBaseline: "central", children: heading.toUpperCase() }),
1245
- /* @__PURE__ */ jsx14("rect", { x: ORIGIN2, y: ORIGIN2, width: SIDE2, height: SIDE2, rx: "10", fill: "#1c1f24", stroke: "#3a3f47", strokeWidth: "2" }),
1504
+ return /* @__PURE__ */ jsxs15(InstrumentFrame, { ...props, label: label2, children: [
1505
+ heading && /* @__PURE__ */ jsx15("text", { x: CENTER, y: ORIGIN2 - 14, fill: "#ccc", fontSize: "13", fontWeight: "bold", letterSpacing: "2", textAnchor: "middle", dominantBaseline: "central", children: heading.toUpperCase() }),
1506
+ /* @__PURE__ */ jsx15("rect", { x: ORIGIN2, y: ORIGIN2, width: SIDE2, height: SIDE2, rx: "10", fill: "#1c1f24", stroke: "#3a3f47", strokeWidth: "2" }),
1246
1507
  shown.map((f, i) => {
1247
1508
  const col = i % cols;
1248
1509
  const row = Math.floor(i / cols);
@@ -1250,10 +1511,10 @@ function DataPanel({ fields = [], heading, ...props }) {
1250
1511
  const y = ORIGIN2 + PAD + row * (cellH + GAP);
1251
1512
  const value = formatValue(f);
1252
1513
  const fit = Math.min(valueSize, (cellW - 16) / (0.62 * Math.max(1, value.length)));
1253
- return /* @__PURE__ */ jsxs14("g", { "data-testid": `data-field-${i}`, children: [
1254
- /* @__PURE__ */ jsx14("rect", { x, y, width: cellW, height: cellH, rx: "6", fill: "#000", stroke: "#262a30", strokeWidth: "1" }),
1255
- /* @__PURE__ */ jsx14("text", { x: x + 8, y: y + 12, fill: "#9aa4b1", fontSize: "12", fontWeight: "bold", letterSpacing: "1", dominantBaseline: "central", children: f.name.toUpperCase() }),
1256
- /* @__PURE__ */ jsx14(
1514
+ return /* @__PURE__ */ jsxs15("g", { "data-testid": `data-field-${i}`, children: [
1515
+ /* @__PURE__ */ jsx15("rect", { x, y, width: cellW, height: cellH, rx: "6", fill: "#000", stroke: "#262a30", strokeWidth: "1" }),
1516
+ /* @__PURE__ */ jsx15("text", { x: x + 8, y: y + 12, fill: "#9aa4b1", fontSize: "12", fontWeight: "bold", letterSpacing: "1", dominantBaseline: "central", children: f.name.toUpperCase() }),
1517
+ /* @__PURE__ */ jsx15(
1257
1518
  "text",
1258
1519
  {
1259
1520
  "data-testid": `data-value-${i}`,
@@ -1268,14 +1529,14 @@ function DataPanel({ fields = [], heading, ...props }) {
1268
1529
  children: value
1269
1530
  }
1270
1531
  ),
1271
- f.unit && /* @__PURE__ */ jsx14("text", { x: x + cellW - 8, y: y + cellH - 12, fill: "#9aa4b1", fontSize: "12", textAnchor: "end", dominantBaseline: "central", children: f.unit })
1532
+ f.unit && /* @__PURE__ */ jsx15("text", { x: x + cellW - 8, y: y + cellH - 12, fill: "#9aa4b1", fontSize: "12", textAnchor: "end", dominantBaseline: "central", children: f.unit })
1272
1533
  ] }, i);
1273
1534
  })
1274
1535
  ] });
1275
1536
  }
1276
1537
 
1277
1538
  // src/components/FuelIndicator.tsx
1278
- import { jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
1539
+ import { jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
1279
1540
  var MAX_TANKS = 4;
1280
1541
  var GREEN2 = "#2ee05a";
1281
1542
  var RED = "#ff3b3b";
@@ -1318,16 +1579,16 @@ function FuelIndicator({
1318
1579
  return { name: t.name, qty, cap, fraction, full, isLow, text: full ? "FULL" : qty.toFixed(places) };
1319
1580
  });
1320
1581
  const title = `${label2}: ` + (readings.length ? readings.map((r) => `${r.name} ${r.full ? "full" : `${r.text} of ${r.cap.toFixed(places)} ${unit}`}${r.isLow ? " (low)" : ""}`).join(", ") : "no tanks");
1321
- return /* @__PURE__ */ jsxs15(InstrumentFrame, { ...props, label: title, children: [
1322
- /* @__PURE__ */ jsx15("rect", { x: ORIGIN3, y: ORIGIN3, width: SIDE3, height: SIDE3, rx: "10", fill: "#000", stroke: "#3a3f47", strokeWidth: "2" }),
1582
+ return /* @__PURE__ */ jsxs16(InstrumentFrame, { ...props, label: title, children: [
1583
+ /* @__PURE__ */ jsx16("rect", { x: ORIGIN3, y: ORIGIN3, width: SIDE3, height: SIDE3, rx: "10", fill: "#000", stroke: "#3a3f47", strokeWidth: "2" }),
1323
1584
  readings.map((r, i) => {
1324
1585
  const cx = INNER_LEFT + colW * (i + 0.5);
1325
1586
  const color = r.isLow ? RED : GREEN2;
1326
1587
  const tickX = cx - barW / 2 - 14;
1327
- return /* @__PURE__ */ jsxs15("g", { "data-testid": `fuel-tank-${i}`, children: [
1328
- i > 0 && /* @__PURE__ */ jsx15("path", { d: `M ${INNER_LEFT + colW * i} ${ORIGIN3 + 10} V ${FOOTER_Y}`, stroke: "#555", strokeWidth: "1.5" }),
1329
- /* @__PURE__ */ jsx15("text", { x: cx, y: ORIGIN3 + 22, fill: "#fff", fontSize: Math.min(17, colW / 5), fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: r.name.toUpperCase() }),
1330
- /* @__PURE__ */ jsx15("g", { strokeWidth: "2.5", strokeLinecap: "round", children: [0, 0.25, 0.5, 0.75, 1].map((f) => /* @__PURE__ */ jsx15(
1588
+ return /* @__PURE__ */ jsxs16("g", { "data-testid": `fuel-tank-${i}`, children: [
1589
+ i > 0 && /* @__PURE__ */ jsx16("path", { d: `M ${INNER_LEFT + colW * i} ${ORIGIN3 + 10} V ${FOOTER_Y}`, stroke: "#555", strokeWidth: "1.5" }),
1590
+ /* @__PURE__ */ jsx16("text", { x: cx, y: ORIGIN3 + 22, fill: "#fff", fontSize: Math.min(17, colW / 5), fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: r.name.toUpperCase() }),
1591
+ /* @__PURE__ */ jsx16("g", { strokeWidth: "2.5", strokeLinecap: "round", children: [0, 0.25, 0.5, 0.75, 1].map((f) => /* @__PURE__ */ jsx16(
1331
1592
  "path",
1332
1593
  {
1333
1594
  d: `M ${tickX - 7} ${BAR_BOTTOM - f * BAR_H} h 7`,
@@ -1335,9 +1596,9 @@ function FuelIndicator({
1335
1596
  },
1336
1597
  f
1337
1598
  )) }),
1338
- /* @__PURE__ */ jsx15("rect", { x: cx - barW / 2, y: BAR_TOP, width: barW, height: BAR_H, fill: "#15181c" }),
1339
- /* @__PURE__ */ jsx15("g", { "data-testid": `fuel-bar-${i}`, style: motionStyle(`scaleY(${r.fraction})`, duration, cx, BAR_BOTTOM), children: /* @__PURE__ */ jsx15("rect", { x: cx - barW / 2, y: BAR_TOP, width: barW, height: BAR_H, fill: color }) }),
1340
- /* @__PURE__ */ jsx15(
1599
+ /* @__PURE__ */ jsx16("rect", { x: cx - barW / 2, y: BAR_TOP, width: barW, height: BAR_H, fill: "#15181c" }),
1600
+ /* @__PURE__ */ jsx16("g", { "data-testid": `fuel-bar-${i}`, style: motionStyle(`scaleY(${r.fraction})`, duration, cx, BAR_BOTTOM), children: /* @__PURE__ */ jsx16("rect", { x: cx - barW / 2, y: BAR_TOP, width: barW, height: BAR_H, fill: color }) }),
1601
+ /* @__PURE__ */ jsx16(
1341
1602
  "text",
1342
1603
  {
1343
1604
  "data-testid": `fuel-value-${i}`,
@@ -1352,16 +1613,16 @@ function FuelIndicator({
1352
1613
  children: r.text
1353
1614
  }
1354
1615
  ),
1355
- /* @__PURE__ */ jsx15("text", { x: cx, y: BAR_BOTTOM + 44, fill: "#fff", fontSize: "13", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: unit })
1616
+ /* @__PURE__ */ jsx16("text", { x: cx, y: BAR_BOTTOM + 44, fill: "#fff", fontSize: "13", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: unit })
1356
1617
  ] }, i);
1357
1618
  }),
1358
- /* @__PURE__ */ jsx15("path", { d: `M ${ORIGIN3 + 8} ${FOOTER_Y} H ${ORIGIN3 + SIDE3 - 8}`, stroke: "#555", strokeWidth: "1.5" }),
1359
- /* @__PURE__ */ jsx15("text", { x: CENTER, y: FOOTER_Y + 19, fill: "#fff", fontSize: "24", fontWeight: "bold", letterSpacing: "2", textAnchor: "middle", dominantBaseline: "central", children: label2.toUpperCase() })
1619
+ /* @__PURE__ */ jsx16("path", { d: `M ${ORIGIN3 + 8} ${FOOTER_Y} H ${ORIGIN3 + SIDE3 - 8}`, stroke: "#555", strokeWidth: "1.5" }),
1620
+ /* @__PURE__ */ jsx16("text", { x: CENTER, y: FOOTER_Y + 19, fill: "#fff", fontSize: "24", fontWeight: "bold", letterSpacing: "2", textAnchor: "middle", dominantBaseline: "central", children: label2.toUpperCase() })
1360
1621
  ] });
1361
1622
  }
1362
1623
 
1363
1624
  // src/components/EngineIndicator.tsx
1364
- import { jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
1625
+ import { jsx as jsx17, jsxs as jsxs17 } from "react/jsx-runtime";
1365
1626
  var MAX_CYLINDERS = 6;
1366
1627
  var MAX_BAR_GAUGES = 4;
1367
1628
  var GREEN3 = "#5fe04a";
@@ -1370,11 +1631,11 @@ var RED2 = "#ff3030";
1370
1631
  var BLUE = "#4fb7e8";
1371
1632
  var LABEL2 = "#b9c8e6";
1372
1633
  var LINE = "#8a8f99";
1373
- var round22 = (n) => Math.round(n * 100) / 100;
1634
+ var round23 = (n) => Math.round(n * 100) / 100;
1374
1635
  var DIAL_R = 182;
1375
1636
  function chord(y, inset = 8) {
1376
1637
  const half = Math.sqrt(Math.max(0, DIAL_R * DIAL_R - (y - CENTER) ** 2)) - inset;
1377
- return `M ${round22(CENTER - half)} ${y} H ${round22(CENTER + half)}`;
1638
+ return `M ${round23(CENTER - half)} ${y} H ${round23(CENTER + half)}`;
1378
1639
  }
1379
1640
  var DEFAULT_MANIFOLD = { min: 10, max: 35, green: [15, 29], yellow: [29, 31], high: 31, unit: "IN", decimals: 1 };
1380
1641
  var DEFAULT_RPM = { min: 0, max: 3e3, green: [800, 2500], yellow: [2500, 2700], high: 2700, decimals: 0 };
@@ -1419,22 +1680,22 @@ function arcAt(cx, cy, r, a0, a1) {
1419
1680
  }
1420
1681
  function ArcGauge({ cx, label: label2, g, duration, testId }) {
1421
1682
  const span = g.max - g.min;
1422
- const angle = (v) => round22(-ARC_SWEEP + 2 * ARC_SWEEP * clamp((v - g.min) / span, 0, 1));
1423
- const band = (from, to, color) => /* @__PURE__ */ jsx16("path", { d: arcAt(cx, ARC_Y, ARC_R, angle(from), angle(to)), stroke: color, strokeWidth: "6", fill: "none" });
1683
+ const angle = (v) => round23(-ARC_SWEEP + 2 * ARC_SWEEP * clamp((v - g.min) / span, 0, 1));
1684
+ const band = (from, to, color) => /* @__PURE__ */ jsx17("path", { d: arcAt(cx, ARC_Y, ARC_R, angle(from), angle(to)), stroke: color, strokeWidth: "6", fill: "none" });
1424
1685
  const [tipX, tipY] = polar(ARC_R - 4, 0, cx, ARC_Y);
1425
1686
  const [lx, ly] = polar(ARC_R - 16, -7, cx, ARC_Y);
1426
1687
  const [rx, ry] = polar(ARC_R - 16, 7, cx, ARC_Y);
1427
- return /* @__PURE__ */ jsxs16("g", { children: [
1428
- /* @__PURE__ */ jsx16("path", { d: arcAt(cx, ARC_Y, ARC_R, -ARC_SWEEP, ARC_SWEEP), stroke: "#fff", strokeWidth: "1.5", fill: "none" }),
1688
+ return /* @__PURE__ */ jsxs17("g", { children: [
1689
+ /* @__PURE__ */ jsx17("path", { d: arcAt(cx, ARC_Y, ARC_R, -ARC_SWEEP, ARC_SWEEP), stroke: "#fff", strokeWidth: "1.5", fill: "none" }),
1429
1690
  g.green && band(g.green[0], g.green[1], GREEN3),
1430
1691
  g.yellow && band(g.yellow[0], g.yellow[1], YELLOW2),
1431
1692
  g.low !== void 0 && band(g.min, g.low, RED2),
1432
1693
  g.high !== void 0 && band(g.high, g.max, RED2),
1433
- /* @__PURE__ */ jsx16("g", { "data-testid": testId, style: motionStyle(`rotate(${angle(g.value)}deg)`, duration, cx, ARC_Y), children: /* @__PURE__ */ jsx16("path", { d: `M ${tipX} ${tipY} L ${lx} ${ly} L ${rx} ${ry} Z`, fill: "#fff", stroke: "#000", strokeWidth: "1" }) }),
1434
- /* @__PURE__ */ jsx16("text", { x: cx, y: ARC_Y - 20, fill: LABEL2, fontSize: "14", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: label2 }),
1435
- /* @__PURE__ */ jsxs16("text", { x: cx, y: ARC_Y + 4, fill: g.color, fontSize: "28", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: [
1694
+ /* @__PURE__ */ jsx17("g", { "data-testid": testId, style: motionStyle(`rotate(${angle(g.value)}deg)`, duration, cx, ARC_Y), children: /* @__PURE__ */ jsx17("path", { d: `M ${tipX} ${tipY} L ${lx} ${ly} L ${rx} ${ry} Z`, fill: "#fff", stroke: "#000", strokeWidth: "1" }) }),
1695
+ /* @__PURE__ */ jsx17("text", { x: cx, y: ARC_Y - 20, fill: LABEL2, fontSize: "14", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: label2 }),
1696
+ /* @__PURE__ */ jsxs17("text", { x: cx, y: ARC_Y + 4, fill: g.color, fontSize: "28", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: [
1436
1697
  g.text,
1437
- g.unit && /* @__PURE__ */ jsx16("tspan", { fontSize: "11", dx: "2", children: g.unit })
1698
+ g.unit && /* @__PURE__ */ jsx17("tspan", { fontSize: "11", dx: "2", children: g.unit })
1438
1699
  ] })
1439
1700
  ] });
1440
1701
  }
@@ -1444,28 +1705,28 @@ var BAR_ROW_H = 39;
1444
1705
  var BAR_TOP2 = 137;
1445
1706
  function BarGauge({ top, g, label: label2, duration, testId }) {
1446
1707
  const y = top + 14;
1447
- const at = (v) => round22(BAR_X0 + (BAR_X1 - BAR_X0) * clamp((v - g.min) / (g.max - g.min), 0, 1));
1448
- const seg = (from, to, color, w = 7) => /* @__PURE__ */ jsx16("path", { d: `M ${at(from)} ${y} H ${at(to)}`, stroke: color, strokeWidth: w });
1449
- return /* @__PURE__ */ jsxs16("g", { children: [
1450
- /* @__PURE__ */ jsx16("path", { d: `M ${BAR_X0} ${y} H ${BAR_X1}`, stroke: "#fff", strokeWidth: "2" }),
1451
- /* @__PURE__ */ jsx16("path", { d: `M ${BAR_X0} ${y - 4} v 8 M ${BAR_X1} ${y - 4} v 8`, stroke: "#fff", strokeWidth: "2" }),
1708
+ const at = (v) => round23(BAR_X0 + (BAR_X1 - BAR_X0) * clamp((v - g.min) / (g.max - g.min), 0, 1));
1709
+ const seg = (from, to, color, w = 7) => /* @__PURE__ */ jsx17("path", { d: `M ${at(from)} ${y} H ${at(to)}`, stroke: color, strokeWidth: w });
1710
+ return /* @__PURE__ */ jsxs17("g", { children: [
1711
+ /* @__PURE__ */ jsx17("path", { d: `M ${BAR_X0} ${y} H ${BAR_X1}`, stroke: "#fff", strokeWidth: "2" }),
1712
+ /* @__PURE__ */ jsx17("path", { d: `M ${BAR_X0} ${y - 4} v 8 M ${BAR_X1} ${y - 4} v 8`, stroke: "#fff", strokeWidth: "2" }),
1452
1713
  g.green && seg(g.green[0], g.green[1], GREEN3),
1453
1714
  g.yellow && seg(g.yellow[0], g.yellow[1], YELLOW2),
1454
1715
  g.low !== void 0 && seg(g.min, g.low, RED2),
1455
1716
  g.high !== void 0 && seg(g.high, g.max, RED2),
1456
- /* @__PURE__ */ jsx16("g", { "data-testid": testId, style: motionStyle(`translate(${round22(at(g.value) - BAR_X0)}px, 0px)`, duration), children: /* @__PURE__ */ jsx16("path", { d: `M ${BAR_X0} ${y - 3} l -5 -9 h 10 z`, fill: "#fff", stroke: "#000", strokeWidth: "1" }) }),
1457
- /* @__PURE__ */ jsx16("text", { x: BAR_X0, y: top + 31, fill: LABEL2, fontSize: "13", fontWeight: "bold", dominantBaseline: "central", children: label2 }),
1458
- /* @__PURE__ */ jsx16("text", { x: 350, y: top + 15, fill: g.color, fontSize: "20", fontWeight: "bold", textAnchor: "end", dominantBaseline: "central", children: g.text }),
1459
- g.unit && /* @__PURE__ */ jsx16("text", { x: 350, y: top + 31, fill: LABEL2, fontSize: "10", fontWeight: "bold", textAnchor: "end", dominantBaseline: "central", children: g.unit })
1717
+ /* @__PURE__ */ jsx17("g", { "data-testid": testId, style: motionStyle(`translate(${round23(at(g.value) - BAR_X0)}px, 0px)`, duration), children: /* @__PURE__ */ jsx17("path", { d: `M ${BAR_X0} ${y - 3} l -5 -9 h 10 z`, fill: "#fff", stroke: "#000", strokeWidth: "1" }) }),
1718
+ /* @__PURE__ */ jsx17("text", { x: BAR_X0, y: top + 31, fill: LABEL2, fontSize: "13", fontWeight: "bold", dominantBaseline: "central", children: label2 }),
1719
+ /* @__PURE__ */ jsx17("text", { x: 350, y: top + 15, fill: g.color, fontSize: "20", fontWeight: "bold", textAnchor: "end", dominantBaseline: "central", children: g.text }),
1720
+ g.unit && /* @__PURE__ */ jsx17("text", { x: 350, y: top + 31, fill: LABEL2, fontSize: "10", fontWeight: "bold", textAnchor: "end", dominantBaseline: "central", children: g.unit })
1460
1721
  ] });
1461
1722
  }
1462
1723
  function Tank({ x, fraction, duration, testId }) {
1463
1724
  const top = 304;
1464
1725
  const h = 40;
1465
- return /* @__PURE__ */ jsxs16("g", { children: [
1466
- /* @__PURE__ */ jsx16("rect", { x: x - 7, y: top, width: "14", height: h, rx: "3", fill: "#000", stroke: "#fff", strokeWidth: "1.5" }),
1467
- /* @__PURE__ */ jsx16("g", { "data-testid": testId, style: motionStyle(`scaleY(${fraction})`, duration, x, top + h - 2), children: /* @__PURE__ */ jsx16("rect", { x: x - 5.5, y: top + 2, width: "11", height: h - 4, fill: BLUE }) }),
1468
- /* @__PURE__ */ jsx16("rect", { x: x - 5.5, y: top + h - 5, width: "11", height: "3", fill: RED2 })
1726
+ return /* @__PURE__ */ jsxs17("g", { children: [
1727
+ /* @__PURE__ */ jsx17("rect", { x: x - 7, y: top, width: "14", height: h, rx: "3", fill: "#000", stroke: "#fff", strokeWidth: "1.5" }),
1728
+ /* @__PURE__ */ jsx17("g", { "data-testid": testId, style: motionStyle(`scaleY(${fraction})`, duration, x, top + h - 2), children: /* @__PURE__ */ jsx17("rect", { x: x - 5.5, y: top + 2, width: "11", height: h - 4, fill: BLUE }) }),
1729
+ /* @__PURE__ */ jsx17("rect", { x: x - 5.5, y: top + h - 5, width: "11", height: "3", fill: RED2 })
1469
1730
  ] });
1470
1731
  }
1471
1732
  var hottest = (values) => {
@@ -1533,79 +1794,79 @@ function EngineIndicator({
1533
1794
  fuelLeft !== void 0 || fuelRight !== void 0 ? `fuel ${fmt(fuelLeft)}/${fmt(fuelRight)} ${fuelUnit}` : null,
1534
1795
  volts !== void 0 ? `${fmt(volts, 1)} V` : null
1535
1796
  ].filter(Boolean).join(", ");
1536
- return /* @__PURE__ */ jsxs16(InstrumentFrame, { ...props, label: label2, children: [
1537
- power !== void 0 && /* @__PURE__ */ jsxs16("text", { x: CENTER, y: 44, fill: "#fff", fontSize: "18", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: [
1538
- /* @__PURE__ */ jsxs16("tspan", { fill: LABEL2, fontSize: "11", children: [
1797
+ return /* @__PURE__ */ jsxs17(InstrumentFrame, { ...props, label: label2, children: [
1798
+ power !== void 0 && /* @__PURE__ */ jsxs17("text", { x: CENTER, y: 44, fill: "#fff", fontSize: "18", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: [
1799
+ /* @__PURE__ */ jsxs17("tspan", { fill: LABEL2, fontSize: "11", children: [
1539
1800
  "POWER",
1540
1801
  " "
1541
1802
  ] }),
1542
1803
  fmt(power),
1543
- /* @__PURE__ */ jsx16("tspan", { fontSize: "11", children: "%" })
1804
+ /* @__PURE__ */ jsx17("tspan", { fontSize: "11", children: "%" })
1544
1805
  ] }),
1545
- /* @__PURE__ */ jsx16(ArcGauge, { cx: 118, label: "MAN", g: man, duration, testId: "engine-man" }),
1546
- /* @__PURE__ */ jsx16(ArcGauge, { cx: 282, label: "RPM", g: speed, duration, testId: "engine-rpm" }),
1547
- /* @__PURE__ */ jsxs16("g", { stroke: LINE, strokeWidth: "1.5", children: [
1548
- /* @__PURE__ */ jsx16("path", { d: chord(133) }),
1549
- /* @__PURE__ */ jsx16("path", { d: "M 200 133 V 298" }),
1550
- /* @__PURE__ */ jsx16("path", { d: chord(298) }),
1551
- /* @__PURE__ */ jsx16("path", { d: "M 136 298 V 348 M 264 298 V 348" })
1806
+ /* @__PURE__ */ jsx17(ArcGauge, { cx: 118, label: "MAN", g: man, duration, testId: "engine-man" }),
1807
+ /* @__PURE__ */ jsx17(ArcGauge, { cx: 282, label: "RPM", g: speed, duration, testId: "engine-rpm" }),
1808
+ /* @__PURE__ */ jsxs17("g", { stroke: LINE, strokeWidth: "1.5", children: [
1809
+ /* @__PURE__ */ jsx17("path", { d: chord(133) }),
1810
+ /* @__PURE__ */ jsx17("path", { d: "M 200 133 V 298" }),
1811
+ /* @__PURE__ */ jsx17("path", { d: chord(298) }),
1812
+ /* @__PURE__ */ jsx17("path", { d: "M 136 298 V 348 M 264 298 V 348" })
1552
1813
  ] }),
1553
- /* @__PURE__ */ jsx16("g", { fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: readouts.map((r) => /* @__PURE__ */ jsxs16("g", { children: [
1554
- /* @__PURE__ */ jsxs16("text", { x: r.x, y: 144, fill: LABEL2, fontSize: "13", children: [
1814
+ /* @__PURE__ */ jsx17("g", { fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: readouts.map((r) => /* @__PURE__ */ jsxs17("g", { children: [
1815
+ /* @__PURE__ */ jsxs17("text", { x: r.x, y: 144, fill: LABEL2, fontSize: "13", children: [
1555
1816
  r.name,
1556
- /* @__PURE__ */ jsx16("tspan", { fontSize: "9", children: temperatureUnit })
1817
+ /* @__PURE__ */ jsx17("tspan", { fontSize: "9", children: temperatureUnit })
1557
1818
  ] }),
1558
- /* @__PURE__ */ jsx16("text", { "data-testid": `engine-${r.name.toLowerCase()}`, x: r.x, y: 165, fill: r.color, fontSize: "22", children: fmt(r.value) })
1819
+ /* @__PURE__ */ jsx17("text", { "data-testid": `engine-${r.name.toLowerCase()}`, x: r.x, y: 165, fill: r.color, fontSize: "22", children: fmt(r.value) })
1559
1820
  ] }, r.name)) }),
1560
- /* @__PURE__ */ jsx16("path", { d: "M 40 178 H 190", stroke: LINE, strokeWidth: "1" }),
1561
- columns > 0 && /* @__PURE__ */ jsxs16("g", { children: [
1562
- /* @__PURE__ */ jsx16("path", { d: `M ${chartX0} ${limitY} H ${chartX1}`, stroke: RED2, strokeWidth: "1.5", strokeDasharray: "5 4" }),
1563
- /* @__PURE__ */ jsx16("text", { x: chartX0 - 4, y: limitY, fill: "#fff", fontSize: "10", fontWeight: "bold", textAnchor: "end", dominantBaseline: "central", children: "CHT" }),
1821
+ /* @__PURE__ */ jsx17("path", { d: "M 40 178 H 190", stroke: LINE, strokeWidth: "1" }),
1822
+ columns > 0 && /* @__PURE__ */ jsxs17("g", { children: [
1823
+ /* @__PURE__ */ jsx17("path", { d: `M ${chartX0} ${limitY} H ${chartX1}`, stroke: RED2, strokeWidth: "1.5", strokeDasharray: "5 4" }),
1824
+ /* @__PURE__ */ jsx17("text", { x: chartX0 - 4, y: limitY, fill: "#fff", fontSize: "10", fontWeight: "bold", textAnchor: "end", dominantBaseline: "central", children: "CHT" }),
1564
1825
  Array.from({ length: cylinders }, (_, i) => {
1565
1826
  const x0 = chartX0 + colW * i;
1566
1827
  const mid = x0 + colW / 2;
1567
1828
  const c = chtValues[i];
1568
1829
  const e = egtValues[i];
1569
- return /* @__PURE__ */ jsxs16("g", { children: [
1570
- c !== void 0 && /* @__PURE__ */ jsx16("g", { "data-testid": `engine-cht-${i}`, style: motionStyle(`scaleY(${chtFrac(c)})`, duration, mid, chartBase), children: /* @__PURE__ */ jsx16("rect", { x: mid - barW - 1, y: chartBase - chartH, width: barW, height: chartH, fill: GREEN3 }) }),
1571
- e !== void 0 && /* @__PURE__ */ jsx16("g", { "data-testid": `engine-egt-${i}`, style: motionStyle(`scaleY(${egtFrac(e)})`, duration, mid, chartBase), children: /* @__PURE__ */ jsx16("rect", { x: mid + 1, y: chartBase - chartH, width: barW, height: chartH, fill: BLUE }) }),
1572
- /* @__PURE__ */ jsx16("text", { x: mid, y: 294, fill: "#fff", fontSize: "12", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: i + 1 })
1830
+ return /* @__PURE__ */ jsxs17("g", { children: [
1831
+ c !== void 0 && /* @__PURE__ */ jsx17("g", { "data-testid": `engine-cht-${i}`, style: motionStyle(`scaleY(${chtFrac(c)})`, duration, mid, chartBase), children: /* @__PURE__ */ jsx17("rect", { x: mid - barW - 1, y: chartBase - chartH, width: barW, height: chartH, fill: GREEN3 }) }),
1832
+ e !== void 0 && /* @__PURE__ */ jsx17("g", { "data-testid": `engine-egt-${i}`, style: motionStyle(`scaleY(${egtFrac(e)})`, duration, mid, chartBase), children: /* @__PURE__ */ jsx17("rect", { x: mid + 1, y: chartBase - chartH, width: barW, height: chartH, fill: BLUE }) }),
1833
+ /* @__PURE__ */ jsx17("text", { x: mid, y: 294, fill: "#fff", fontSize: "12", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: i + 1 })
1573
1834
  ] }, i);
1574
1835
  }),
1575
- hasTit && /* @__PURE__ */ jsxs16("g", { children: [
1576
- /* @__PURE__ */ jsx16("g", { "data-testid": "engine-tit-bar", style: motionStyle(`scaleY(${egtFrac(tit)})`, duration, chartX1 - colW / 2, chartBase), children: /* @__PURE__ */ jsx16("rect", { x: chartX1 - colW / 2 - barW / 2, y: chartBase - chartH, width: barW, height: chartH, fill: "#fff" }) }),
1577
- /* @__PURE__ */ jsx16("text", { x: chartX1 - colW / 2, y: 294, fill: "#fff", fontSize: "12", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: "T" })
1836
+ hasTit && /* @__PURE__ */ jsxs17("g", { children: [
1837
+ /* @__PURE__ */ jsx17("g", { "data-testid": "engine-tit-bar", style: motionStyle(`scaleY(${egtFrac(tit)})`, duration, chartX1 - colW / 2, chartBase), children: /* @__PURE__ */ jsx17("rect", { x: chartX1 - colW / 2 - barW / 2, y: chartBase - chartH, width: barW, height: chartH, fill: "#fff" }) }),
1838
+ /* @__PURE__ */ jsx17("text", { x: chartX1 - colW / 2, y: 294, fill: "#fff", fontSize: "12", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: "T" })
1578
1839
  ] })
1579
1840
  ] }),
1580
- bars.map((b, i) => /* @__PURE__ */ jsxs16("g", { children: [
1581
- i > 0 && /* @__PURE__ */ jsx16("path", { d: `M 206 ${BAR_TOP2 + BAR_ROW_H * i - 2} H 352`, stroke: LINE, strokeWidth: "1" }),
1582
- /* @__PURE__ */ jsx16(BarGauge, { top: BAR_TOP2 + BAR_ROW_H * i, g: b.g, label: b.label, duration, testId: `engine-bar-${i}` })
1841
+ bars.map((b, i) => /* @__PURE__ */ jsxs17("g", { children: [
1842
+ i > 0 && /* @__PURE__ */ jsx17("path", { d: `M 206 ${BAR_TOP2 + BAR_ROW_H * i - 2} H 352`, stroke: LINE, strokeWidth: "1" }),
1843
+ /* @__PURE__ */ jsx17(BarGauge, { top: BAR_TOP2 + BAR_ROW_H * i, g: b.g, label: b.label, duration, testId: `engine-bar-${i}` })
1583
1844
  ] }, b.label)),
1584
- /* @__PURE__ */ jsxs16("g", { fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: [
1585
- /* @__PURE__ */ jsxs16("text", { "data-testid": "engine-amps", x: 104, y: 318, fill: "#fff", fontSize: "20", children: [
1845
+ /* @__PURE__ */ jsxs17("g", { fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: [
1846
+ /* @__PURE__ */ jsxs17("text", { "data-testid": "engine-amps", x: 104, y: 318, fill: "#fff", fontSize: "20", children: [
1586
1847
  fmt(amps),
1587
- /* @__PURE__ */ jsx16("tspan", { fontSize: "11", dx: "2", children: "A" })
1848
+ /* @__PURE__ */ jsx17("tspan", { fontSize: "11", dx: "2", children: "A" })
1588
1849
  ] }),
1589
- /* @__PURE__ */ jsx16("text", { x: 104, y: 338, fill: LABEL2, fontSize: "13", children: "ALT" }),
1590
- /* @__PURE__ */ jsx16(Tank, { x: 152, fraction: left / cap, duration, testId: "engine-fuel-left" }),
1591
- /* @__PURE__ */ jsx16(Tank, { x: 248, fraction: right / cap, duration, testId: "engine-fuel-right" }),
1592
- /* @__PURE__ */ jsxs16("text", { "data-testid": "engine-fuel", x: 200, y: 316, fill: "#fff", fontSize: "20", children: [
1850
+ /* @__PURE__ */ jsx17("text", { x: 104, y: 338, fill: LABEL2, fontSize: "13", children: "ALT" }),
1851
+ /* @__PURE__ */ jsx17(Tank, { x: 152, fraction: left / cap, duration, testId: "engine-fuel-left" }),
1852
+ /* @__PURE__ */ jsx17(Tank, { x: 248, fraction: right / cap, duration, testId: "engine-fuel-right" }),
1853
+ /* @__PURE__ */ jsxs17("text", { "data-testid": "engine-fuel", x: 200, y: 316, fill: "#fff", fontSize: "20", children: [
1593
1854
  fmt(left),
1594
- /* @__PURE__ */ jsx16("tspan", { dx: "14", children: fmt(right) })
1855
+ /* @__PURE__ */ jsx17("tspan", { dx: "14", children: fmt(right) })
1595
1856
  ] }),
1596
- /* @__PURE__ */ jsx16("text", { x: 200, y: 335, fill: LABEL2, fontSize: "13", children: "Fuel" }),
1597
- /* @__PURE__ */ jsx16("text", { x: 200, y: 348, fill: LABEL2, fontSize: "9", children: fuelUnit }),
1598
- /* @__PURE__ */ jsxs16("text", { "data-testid": "engine-volts", x: 296, y: 318, fill: "#fff", fontSize: "20", children: [
1857
+ /* @__PURE__ */ jsx17("text", { x: 200, y: 335, fill: LABEL2, fontSize: "13", children: "Fuel" }),
1858
+ /* @__PURE__ */ jsx17("text", { x: 200, y: 348, fill: LABEL2, fontSize: "9", children: fuelUnit }),
1859
+ /* @__PURE__ */ jsxs17("text", { "data-testid": "engine-volts", x: 296, y: 318, fill: "#fff", fontSize: "20", children: [
1599
1860
  fmt(volts, 1),
1600
- /* @__PURE__ */ jsx16("tspan", { fontSize: "11", dx: "2", children: "V" })
1861
+ /* @__PURE__ */ jsx17("tspan", { fontSize: "11", dx: "2", children: "V" })
1601
1862
  ] }),
1602
- /* @__PURE__ */ jsx16("text", { x: 296, y: 338, fill: LABEL2, fontSize: "13", children: "BATT" })
1863
+ /* @__PURE__ */ jsx17("text", { x: 296, y: 338, fill: LABEL2, fontSize: "13", children: "BATT" })
1603
1864
  ] })
1604
1865
  ] });
1605
1866
  }
1606
1867
 
1607
1868
  // src/components/FlapIndicator.tsx
1608
- import { jsx as jsx17, jsxs as jsxs17 } from "react/jsx-runtime";
1869
+ import { jsx as jsx18, jsxs as jsxs18 } from "react/jsx-runtime";
1609
1870
  var GREEN4 = "#3ddc3d";
1610
1871
  var YELLOW3 = "#ffd400";
1611
1872
  var ORANGE = "#ff8a00";
@@ -1644,12 +1905,12 @@ function FlapIndicator({
1644
1905
  const overspeed = limit !== void 0 && !Number.isNaN(ias) && ias > limit.speed;
1645
1906
  const segH = BAR_H2 / count;
1646
1907
  const title = `${label2}: ${Math.round(position)}\xB0 of ${Math.round(full)}\xB0` + (limit ? `, max ${Math.round(limit.speed)} knots${overspeed ? " (overspeed)" : ""}` : "");
1647
- return /* @__PURE__ */ jsxs17(InstrumentFrame, { ...props, label: title, children: [
1648
- /* @__PURE__ */ jsx17("rect", { x: BAR_X - BAR_W / 2 - 4, y: BAR_TOP3 - 4, width: BAR_W + 8, height: BAR_H2 + 8, rx: "4", fill: "#000", stroke: "#333", strokeWidth: "1.5" }),
1908
+ return /* @__PURE__ */ jsxs18(InstrumentFrame, { ...props, label: title, children: [
1909
+ /* @__PURE__ */ jsx18("rect", { x: BAR_X - BAR_W / 2 - 4, y: BAR_TOP3 - 4, width: BAR_W + 8, height: BAR_H2 + 8, rx: "4", fill: "#000", stroke: "#333", strokeWidth: "1.5" }),
1649
1910
  Array.from({ length: count }, (_, i) => {
1650
1911
  const y = BAR_TOP3 + i * segH;
1651
1912
  const on = i < lit;
1652
- return /* @__PURE__ */ jsx17(
1913
+ return /* @__PURE__ */ jsx18(
1653
1914
  "rect",
1654
1915
  {
1655
1916
  "data-testid": `flap-segment-${i}`,
@@ -1666,26 +1927,26 @@ function FlapIndicator({
1666
1927
  i
1667
1928
  );
1668
1929
  }),
1669
- /* @__PURE__ */ jsx17("g", { fill: "#fff", fontSize: "18", fontWeight: "bold", dominantBaseline: "central", children: scale.map((d) => /* @__PURE__ */ jsxs17("g", { children: [
1670
- /* @__PURE__ */ jsx17("path", { d: `M ${BAR_X + BAR_W / 2 + 8} ${yAt(d)} h 8`, stroke: "#fff", strokeWidth: "2" }),
1671
- /* @__PURE__ */ jsx17("text", { x: BAR_X + BAR_W / 2 + 22, y: yAt(d), children: d })
1930
+ /* @__PURE__ */ jsx18("g", { fill: "#fff", fontSize: "18", fontWeight: "bold", dominantBaseline: "central", children: scale.map((d) => /* @__PURE__ */ jsxs18("g", { children: [
1931
+ /* @__PURE__ */ jsx18("path", { d: `M ${BAR_X + BAR_W / 2 + 8} ${yAt(d)} h 8`, stroke: "#fff", strokeWidth: "2" }),
1932
+ /* @__PURE__ */ jsx18("text", { x: BAR_X + BAR_W / 2 + 22, y: yAt(d), children: d })
1672
1933
  ] }, d)) }),
1673
- /* @__PURE__ */ jsx17("g", { "data-testid": "flap-pointer", style: motionStyle(`translate(0px, ${yAt(position) - BAR_TOP3}px)`, duration), children: /* @__PURE__ */ jsx17("path", { d: `M ${BAR_X - BAR_W / 2 - 8} ${BAR_TOP3} l -14 -8 v 16 z`, fill: "#fff", stroke: "#000", strokeWidth: "1" }) }),
1674
- limit && /* @__PURE__ */ jsxs17("g", { textAnchor: "middle", dominantBaseline: "central", fill: overspeed ? RED3 : "#fff", children: [
1675
- /* @__PURE__ */ jsxs17("text", { "data-testid": "flap-speed", x: 118, y: 176, fontSize: "36", fontWeight: "bold", children: [
1934
+ /* @__PURE__ */ jsx18("g", { "data-testid": "flap-pointer", style: motionStyle(`translate(0px, ${yAt(position) - BAR_TOP3}px)`, duration), children: /* @__PURE__ */ jsx18("path", { d: `M ${BAR_X - BAR_W / 2 - 8} ${BAR_TOP3} l -14 -8 v 16 z`, fill: "#fff", stroke: "#000", strokeWidth: "1" }) }),
1935
+ limit && /* @__PURE__ */ jsxs18("g", { textAnchor: "middle", dominantBaseline: "central", fill: overspeed ? RED3 : "#fff", children: [
1936
+ /* @__PURE__ */ jsxs18("text", { "data-testid": "flap-speed", x: 118, y: 176, fontSize: "36", fontWeight: "bold", children: [
1676
1937
  Math.round(limit.speed),
1677
- /* @__PURE__ */ jsx17("tspan", { fontSize: "13", dx: "3", children: "KTS" })
1938
+ /* @__PURE__ */ jsx18("tspan", { fontSize: "13", dx: "3", children: "KTS" })
1678
1939
  ] }),
1679
- /* @__PURE__ */ jsx17("text", { x: 118, y: 212, fontSize: "13", fontWeight: "bold", fill: "#bbb", letterSpacing: "2", children: "MAX" })
1940
+ /* @__PURE__ */ jsx18("text", { x: 118, y: 212, fontSize: "13", fontWeight: "bold", fill: "#bbb", letterSpacing: "2", children: "MAX" })
1680
1941
  ] }),
1681
- /* @__PURE__ */ jsx17("text", { x: CENTER, y: 345, fill: "#ccc", fontSize: "16", textAnchor: "middle", children: label2.toUpperCase() })
1942
+ /* @__PURE__ */ jsx18("text", { x: CENTER, y: 345, fill: "#ccc", fontSize: "16", textAnchor: "middle", children: label2.toUpperCase() })
1682
1943
  ] });
1683
1944
  }
1684
1945
 
1685
1946
  // src/components/AoaIndicator.tsx
1686
- import { Fragment as Fragment5, jsx as jsx18, jsxs as jsxs18 } from "react/jsx-runtime";
1947
+ import { Fragment as Fragment5, jsx as jsx19, jsxs as jsxs19 } from "react/jsx-runtime";
1687
1948
  var GREEN5 = "#3ddc3d";
1688
- var AMBER4 = "#ffb000";
1949
+ var AMBER5 = "#ffb000";
1689
1950
  var RED4 = "#ff2a2a";
1690
1951
  var UNLIT_OPACITY = 0.15;
1691
1952
  var ROWS = [
@@ -1694,10 +1955,10 @@ var ROWS = [
1694
1955
  { shape: "bar", color: GREEN5, y: 256 },
1695
1956
  { shape: "bar", color: GREEN5, y: 234 },
1696
1957
  { shape: "donut", color: GREEN5, y: 208 },
1697
- { shape: "bar", color: AMBER4, y: 182 },
1698
- { shape: "split", color: AMBER4, y: 160 },
1699
- { shape: "chevron", color: AMBER4, y: 125 },
1700
- { shape: "chevron", color: AMBER4, y: 103 },
1958
+ { shape: "bar", color: AMBER5, y: 182 },
1959
+ { shape: "split", color: AMBER5, y: 160 },
1960
+ { shape: "chevron", color: AMBER5, y: 125 },
1961
+ { shape: "chevron", color: AMBER5, y: 103 },
1701
1962
  { shape: "chevron", color: RED4, y: 74 },
1702
1963
  { shape: "chevron", color: RED4, y: 52 }
1703
1964
  ];
@@ -1711,20 +1972,20 @@ function RowShape({ shape, y }) {
1711
1972
  const r = CENTER + HALF;
1712
1973
  switch (shape) {
1713
1974
  case "bar":
1714
- return /* @__PURE__ */ jsx18("rect", { x: l, y: y - BAR_H3 / 2, width: HALF * 2, height: BAR_H3, rx: "2" });
1975
+ return /* @__PURE__ */ jsx19("rect", { x: l, y: y - BAR_H3 / 2, width: HALF * 2, height: BAR_H3, rx: "2" });
1715
1976
  case "split":
1716
- return /* @__PURE__ */ jsxs18(Fragment5, { children: [
1717
- /* @__PURE__ */ jsx18("rect", { x: l, y: y - BAR_H3 / 2, width: 50, height: BAR_H3, rx: "2" }),
1718
- /* @__PURE__ */ jsx18("rect", { x: r - 50, y: y - BAR_H3 / 2, width: 50, height: BAR_H3, rx: "2" })
1977
+ return /* @__PURE__ */ jsxs19(Fragment5, { children: [
1978
+ /* @__PURE__ */ jsx19("rect", { x: l, y: y - BAR_H3 / 2, width: 50, height: BAR_H3, rx: "2" }),
1979
+ /* @__PURE__ */ jsx19("rect", { x: r - 50, y: y - BAR_H3 / 2, width: 50, height: BAR_H3, rx: "2" })
1719
1980
  ] });
1720
1981
  case "donut":
1721
- return /* @__PURE__ */ jsxs18(Fragment5, { children: [
1722
- /* @__PURE__ */ jsx18("rect", { x: l, y: y - BAR_H3 / 2, width: HALF - 24, height: BAR_H3, rx: "2" }),
1723
- /* @__PURE__ */ jsx18("rect", { x: CENTER + 24, y: y - BAR_H3 / 2, width: HALF - 24, height: BAR_H3, rx: "2" }),
1724
- /* @__PURE__ */ jsx18("circle", { cx: CENTER, cy: y, r: 13, fill: "none", strokeWidth: "7" })
1982
+ return /* @__PURE__ */ jsxs19(Fragment5, { children: [
1983
+ /* @__PURE__ */ jsx19("rect", { x: l, y: y - BAR_H3 / 2, width: HALF - 24, height: BAR_H3, rx: "2" }),
1984
+ /* @__PURE__ */ jsx19("rect", { x: CENTER + 24, y: y - BAR_H3 / 2, width: HALF - 24, height: BAR_H3, rx: "2" }),
1985
+ /* @__PURE__ */ jsx19("circle", { cx: CENTER, cy: y, r: 13, fill: "none", strokeWidth: "7" })
1725
1986
  ] });
1726
1987
  case "chevron":
1727
- return /* @__PURE__ */ jsx18("path", { d: `M ${l} ${y} L ${CENTER} ${y + CHEVRON_DEPTH} L ${r} ${y}`, fill: "none", strokeWidth: "11", strokeLinejoin: "miter" });
1988
+ return /* @__PURE__ */ jsx19("path", { d: `M ${l} ${y} L ${CENTER} ${y + CHEVRON_DEPTH} L ${r} ${y}`, fill: "none", strokeWidth: "11", strokeLinejoin: "miter" });
1728
1989
  }
1729
1990
  }
1730
1991
  function AoaIndicator({ aoa = 0, min = 0, optimum, max = 20, showValue = false, label: label2 = "AOA", ...props }) {
@@ -1738,11 +1999,11 @@ function AoaIndicator({ aoa = 0, min = 0, optimum, max = 20, showValue = false,
1738
1999
  const reading = Number.isNaN(value) ? "---" : `${value.toFixed(1)}\xB0`;
1739
2000
  const state = stall ? " (stall warning)" : lit > DONUT + 1 ? " (high)" : lit === DONUT + 1 ? " (optimum)" : "";
1740
2001
  const title = `${label2}: ${reading}${Number.isNaN(value) ? "" : state}`;
1741
- return /* @__PURE__ */ jsxs18(InstrumentFrame, { ...props, label: title, children: [
1742
- /* @__PURE__ */ jsx18("rect", { x: CENTER - HALF - 10, y: 40, width: (HALF + 10) * 2, height: 278, rx: "10", fill: "#000", stroke: "#333", strokeWidth: "1.5" }),
2002
+ return /* @__PURE__ */ jsxs19(InstrumentFrame, { ...props, label: title, children: [
2003
+ /* @__PURE__ */ jsx19("rect", { x: CENTER - HALF - 10, y: 40, width: (HALF + 10) * 2, height: 278, rx: "10", fill: "#000", stroke: "#333", strokeWidth: "1.5" }),
1743
2004
  ROWS.map((row, i) => {
1744
2005
  const on = i < lit;
1745
- return /* @__PURE__ */ jsxs18(
2006
+ return /* @__PURE__ */ jsxs19(
1746
2007
  "g",
1747
2008
  {
1748
2009
  "data-testid": `aoa-row-${i}`,
@@ -1753,45 +2014,919 @@ function AoaIndicator({ aoa = 0, min = 0, optimum, max = 20, showValue = false,
1753
2014
  opacity: on ? 1 : UNLIT_OPACITY,
1754
2015
  style: { transition: "opacity 150ms ease-out" },
1755
2016
  children: [
1756
- /* @__PURE__ */ jsx18(RowShape, { shape: row.shape, y: row.y }),
1757
- on && stall && row.shape === "chevron" && /* @__PURE__ */ jsx18("animate", { attributeName: "opacity", values: "1;0.25;1", dur: "0.6s", repeatCount: "indefinite" })
2017
+ /* @__PURE__ */ jsx19(RowShape, { shape: row.shape, y: row.y }),
2018
+ on && stall && row.shape === "chevron" && /* @__PURE__ */ jsx19("animate", { attributeName: "opacity", values: "1;0.25;1", dur: "0.6s", repeatCount: "indefinite" })
1758
2019
  ]
1759
2020
  },
1760
2021
  i
1761
2022
  );
1762
2023
  }),
1763
- showValue && /* @__PURE__ */ jsx18("text", { "data-testid": "aoa-value", x: CENTER, y: 340, fill: "#fff", fontSize: "18", fontWeight: "bold", textAnchor: "middle", children: reading }),
1764
- /* @__PURE__ */ jsx18("text", { x: CENTER, y: showValue ? 362 : 345, fill: "#ccc", fontSize: "16", textAnchor: "middle", children: label2.toUpperCase() })
2024
+ showValue && /* @__PURE__ */ jsx19("text", { "data-testid": "aoa-value", x: CENTER, y: 340, fill: "#fff", fontSize: "18", fontWeight: "bold", textAnchor: "middle", children: reading }),
2025
+ /* @__PURE__ */ jsx19("text", { x: CENTER, y: showValue ? 362 : 345, fill: "#ccc", fontSize: "16", textAnchor: "middle", children: label2.toUpperCase() })
2026
+ ] });
2027
+ }
2028
+
2029
+ // src/components/DigitalClock.tsx
2030
+ import { useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
2031
+ import { jsx as jsx20, jsxs as jsxs20 } from "react/jsx-runtime";
2032
+ var MIN = 6e4;
2033
+ var HOUR = 60 * MIN;
2034
+ var DAY = 24 * HOUR;
2035
+ var HOLD_TIME = 2e3;
2036
+ var MODES = ["UT", "LT", "FT", "ET"];
2037
+ var UPPER = ["volts", "F", "C"];
2038
+ var pad2 = (n) => String(n).padStart(2, "0");
2039
+ var mod = (n, m) => (n % m + m) % m;
2040
+ var readWatch = (w, t) => w.acc + (w.since === null ? 0 : Math.max(0, t - w.since));
2041
+ var startWatch = (w, t) => w.since === null ? { acc: w.acc, since: t } : w;
2042
+ var stopWatch = (w, t) => w.since === null ? w : { acc: readWatch(w, t), since: null };
2043
+ function timerDigits(ms) {
2044
+ const s = Math.max(0, Math.floor(ms / 1e3));
2045
+ if (s < 3600) return pad2(Math.floor(s / 60)) + pad2(s % 60);
2046
+ return pad2(Math.floor(s / 3600) % 100) + pad2(Math.floor(s / 60) % 60);
2047
+ }
2048
+ function formatTimer(seconds) {
2049
+ const d = timerDigits(finite(seconds) * 1e3);
2050
+ return `${d.slice(0, 2)}:${d.slice(2)}`;
2051
+ }
2052
+ function upperText(display2, oat, volts) {
2053
+ if (display2 === "volts") {
2054
+ if (Number.isNaN(volts)) return ["---", "V"];
2055
+ const v = clamp(volts, 0, 99.9);
2056
+ return [v.toFixed(1).padStart(4, " "), "V"];
2057
+ }
2058
+ if (Number.isNaN(oat)) return ["---", `\xB0${display2}`];
2059
+ const t = display2 === "F" ? oat * 9 / 5 + 32 : oat;
2060
+ return [String(Math.round(clamp(t, -99, 999))).padStart(3, " "), `\xB0${display2}`];
2061
+ }
2062
+ var GLYPHS = {
2063
+ "0": "abcdef",
2064
+ "1": "bc",
2065
+ "2": "abdeg",
2066
+ "3": "abcdg",
2067
+ "4": "bcfg",
2068
+ "5": "acdfg",
2069
+ "6": "acdefg",
2070
+ "7": "abc",
2071
+ "8": "abcdefg",
2072
+ "9": "abcdfg",
2073
+ "-": "g",
2074
+ " ": ""
2075
+ };
2076
+ function segmentPaths(w, h) {
2077
+ const t = w * 0.2;
2078
+ const half = t / 2;
2079
+ const gap = t * 0.2;
2080
+ const pts = (p) => p.map(([x, y]) => `${Math.round(x * 10) / 10},${Math.round(y * 10) / 10}`).join(" ");
2081
+ const hs = (y) => {
2082
+ const x1 = half + gap;
2083
+ const x2 = w - half - gap;
2084
+ return pts([[x1, y], [x1 + half, y - half], [x2 - half, y - half], [x2, y], [x2 - half, y + half], [x1 + half, y + half]]);
2085
+ };
2086
+ const vs = (x, y1, y2) => pts([[x, y1], [x + half, y1 + half], [x + half, y2 - half], [x, y2], [x - half, y2 - half], [x - half, y1 + half]]);
2087
+ return {
2088
+ a: hs(half),
2089
+ g: hs(h / 2),
2090
+ d: hs(h - half),
2091
+ f: vs(half, half + gap, h / 2 - gap),
2092
+ b: vs(w - half, half + gap, h / 2 - gap),
2093
+ e: vs(half, h / 2 + gap, h - half - gap),
2094
+ c: vs(w - half, h / 2 + gap, h - half - gap)
2095
+ };
2096
+ }
2097
+ function Cell({ x, y, w, h, char, dot, on, off, testId }) {
2098
+ const paths = segmentPaths(w, h);
2099
+ const lit = GLYPHS[char] ?? "";
2100
+ return /* @__PURE__ */ jsxs20("g", { transform: `translate(${x + h * 0.05} ${y}) skewX(-5)`, "data-testid": testId, "data-char": char, children: [
2101
+ Object.keys(paths).map((s) => /* @__PURE__ */ jsx20("polygon", { points: paths[s], fill: lit.includes(s) ? on : off }, s)),
2102
+ /* @__PURE__ */ jsx20("circle", { cx: w + w * 0.2, cy: h - w * 0.1, r: w * 0.1, fill: dot ? on : off })
2103
+ ] });
2104
+ }
2105
+ function digitMax(target, digits, i) {
2106
+ if (target === "ET") return [5, 9, 5, 9][i] ?? 9;
2107
+ if (target === "FT") return [9, 9, 5, 9][i] ?? 9;
2108
+ if (i === 0) return 2;
2109
+ if (i === 1) return digits[0] === 2 ? 3 : 9;
2110
+ return [5, 9][i - 2] ?? 9;
2111
+ }
2112
+ var lastDigit = (target) => target === "LT" ? 1 : 3;
2113
+ var twoDigits = (d, i) => (d[i] ?? 0) * 10 + (d[i + 1] ?? 0);
2114
+ var LCD = "#9da793";
2115
+ var INK = "#1f241d";
2116
+ var GHOST = "rgba(31,36,29,0.07)";
2117
+ var FACE_TEXT = "#e6e6e6";
2118
+ var BUTTONS = {
2119
+ oatVolts: { cx: CENTER, cy: 56, name: "O.A.T / VOLTS" },
2120
+ select: { cx: 140, cy: 330, name: "SELECT" },
2121
+ control: { cx: 260, cy: 330, name: "CONTROL" }
2122
+ };
2123
+ function DigitalClock({
2124
+ oat,
2125
+ volts,
2126
+ upperDisplay,
2127
+ defaultUpperDisplay = "volts",
2128
+ onUpperDisplayChange,
2129
+ mode,
2130
+ defaultMode = "UT",
2131
+ onModeChange,
2132
+ now,
2133
+ localOffset,
2134
+ defaultLocalOffset,
2135
+ onLocalOffsetChange,
2136
+ onTimeSet,
2137
+ flightTimeRunning = true,
2138
+ defaultFlightTime = 0,
2139
+ defaultFlightTimeAlarm = 0,
2140
+ defaultCountdown = 0,
2141
+ lowVoltage,
2142
+ highVoltage,
2143
+ onAlarm,
2144
+ ...props
2145
+ }) {
2146
+ const lcdId = useSvgId("fi-lcd");
2147
+ const clockNow = now === void 0 ? Date.now() : finite(now instanceof Date ? now.getTime() : now, Date.now());
2148
+ const clockRef = useRef2(clockNow);
2149
+ clockRef.current = clockNow;
2150
+ const readClock = () => now === void 0 ? Date.now() : clockRef.current;
2151
+ const [, setTick] = useState2(0);
2152
+ useEffect2(() => {
2153
+ const id = setInterval(() => setTick((n) => n + 1), 250);
2154
+ return () => clearInterval(id);
2155
+ }, []);
2156
+ const blinkOn = Math.floor(Date.now() / 400) % 2 === 0;
2157
+ const [innerUpper, setInnerUpper] = useState2(defaultUpperDisplay);
2158
+ const upper = upperDisplay ?? innerUpper;
2159
+ const changeUpper = (next) => {
2160
+ if (upperDisplay === void 0) setInnerUpper(next);
2161
+ onUpperDisplayChange?.(next);
2162
+ };
2163
+ const [innerMode, setInnerMode] = useState2(defaultMode);
2164
+ const current = mode ?? innerMode;
2165
+ const changeMode = (next) => {
2166
+ if (mode === void 0) setInnerMode(next);
2167
+ onModeChange?.(next);
2168
+ };
2169
+ const [correction, setCorrection] = useState2(0);
2170
+ const [innerOffset, setInnerOffset] = useState2(() => finite(defaultLocalOffset, -(/* @__PURE__ */ new Date()).getTimezoneOffset()));
2171
+ const offset = finite(localOffset, innerOffset);
2172
+ const ut = clockNow + correction;
2173
+ const utDate = new Date(ut);
2174
+ const ltDate = new Date(ut + offset * MIN);
2175
+ const [ft, setFt] = useState2(() => ({
2176
+ acc: Math.max(0, finite(defaultFlightTime)) * 1e3,
2177
+ since: flightTimeRunning ? clockNow : null
2178
+ }));
2179
+ useEffect2(() => {
2180
+ setFt((w) => flightTimeRunning ? startWatch(w, clockRef.current) : stopWatch(w, clockRef.current));
2181
+ }, [flightTimeRunning]);
2182
+ const [ftAlarm, setFtAlarm] = useState2(() => Math.max(0, finite(defaultFlightTimeAlarm)) * 1e3);
2183
+ const ftMs = readWatch(ft, clockNow);
2184
+ const [et, setEt] = useState2({ acc: 0, since: null });
2185
+ const [countdown, setCountdown] = useState2(() => Math.max(0, finite(defaultCountdown)) * 1e3);
2186
+ const etMs = readWatch(et, clockNow);
2187
+ const countingDown = countdown > 0 && etMs < countdown;
2188
+ const etRunning = et.since !== null;
2189
+ const v = finite(volts, NaN);
2190
+ const system28 = Number.isNaN(v) || v > 18;
2191
+ const low = finite(lowVoltage, system28 ? 24.5 : 12.4);
2192
+ const high = finite(highVoltage, system28 ? 32 : 16);
2193
+ const voltsBad = !Number.isNaN(v) && (v < low || v > high);
2194
+ const [voltsAck, setVoltsAck] = useState2(false);
2195
+ const [lowerAlarm, setLowerAlarm] = useState2(null);
2196
+ const fired = useRef2({ voltage: false, flightTime: false, countdown: false });
2197
+ useEffect2(() => {
2198
+ const f = fired.current;
2199
+ if (voltsBad && !f.voltage) {
2200
+ f.voltage = true;
2201
+ onAlarm?.("voltage");
2202
+ } else if (!voltsBad && f.voltage) {
2203
+ f.voltage = false;
2204
+ setVoltsAck(false);
2205
+ }
2206
+ if (countdown > 0 && etMs >= countdown && !f.countdown) {
2207
+ f.countdown = true;
2208
+ setLowerAlarm("countdown");
2209
+ changeMode("ET");
2210
+ onAlarm?.("countdown");
2211
+ }
2212
+ if (ftAlarm > 0 && ftMs >= ftAlarm && !f.flightTime) {
2213
+ f.flightTime = true;
2214
+ setLowerAlarm("flightTime");
2215
+ changeMode("FT");
2216
+ onAlarm?.("flightTime");
2217
+ }
2218
+ });
2219
+ const voltsFlashing = voltsBad && !voltsAck;
2220
+ const alarmActive = voltsFlashing || lowerAlarm !== null;
2221
+ const [editing, setEditing] = useState2(null);
2222
+ const [lampTest, setLampTest] = useState2(false);
2223
+ const startEditing = () => {
2224
+ const d = (a, b) => [Math.floor(a / 10), a % 10, Math.floor(b / 10), b % 10];
2225
+ let digits;
2226
+ if (current === "UT") digits = d(utDate.getUTCHours(), utDate.getUTCMinutes());
2227
+ else if (current === "LT") digits = d(ltDate.getUTCHours(), ltDate.getUTCMinutes());
2228
+ else if (current === "ET") digits = d(Math.floor(countdown / MIN) % 60, Math.floor(countdown / 1e3) % 60);
2229
+ else digits = d(Math.min(99, Math.floor(ftAlarm / HOUR)), Math.floor(ftAlarm / MIN) % 60);
2230
+ setEditing({ target: current, digits, index: 0 });
2231
+ };
2232
+ const commit = (e) => {
2233
+ const { target, digits } = e;
2234
+ setEditing(null);
2235
+ if (target === "UT") {
2236
+ const wanted = twoDigits(digits, 0) * HOUR + twoDigits(digits, 2) * MIN;
2237
+ const delta = mod(wanted - mod(ut, DAY) + DAY / 2, DAY) - DAY / 2;
2238
+ setCorrection(correction + delta);
2239
+ onTimeSet?.(new Date(ut + delta));
2240
+ } else if (target === "LT") {
2241
+ let next = offset + (twoDigits(digits, 0) - ltDate.getUTCHours()) * 60;
2242
+ while (next > 14 * 60) next -= 24 * 60;
2243
+ while (next < -12 * 60) next += 24 * 60;
2244
+ if (localOffset === void 0) setInnerOffset(next);
2245
+ onLocalOffsetChange?.(next);
2246
+ } else if (target === "ET") {
2247
+ setCountdown((twoDigits(digits, 0) * 60 + twoDigits(digits, 2)) * 1e3);
2248
+ setEt({ acc: 0, since: null });
2249
+ fired.current.countdown = false;
2250
+ } else {
2251
+ setFtAlarm(twoDigits(digits, 0) * HOUR + twoDigits(digits, 2) * MIN);
2252
+ fired.current.flightTime = false;
2253
+ }
2254
+ };
2255
+ const resetEt = () => {
2256
+ setEt({ acc: 0, since: null });
2257
+ fired.current.countdown = false;
2258
+ };
2259
+ const resetFt = () => {
2260
+ setFt({ acc: 0, since: flightTimeRunning ? readClock() : null });
2261
+ fired.current.flightTime = false;
2262
+ };
2263
+ const click = (b) => {
2264
+ if (b === "oatVolts") return changeUpper(UPPER[(UPPER.indexOf(upper) + 1) % UPPER.length]);
2265
+ if (editing) {
2266
+ if (b === "control") {
2267
+ const digits = [...editing.digits];
2268
+ const i = editing.index;
2269
+ const d = digits[i] ?? 0;
2270
+ digits[i] = d >= digitMax(editing.target, digits, i) ? 0 : d + 1;
2271
+ if (i === 0 && editing.target !== "ET" && editing.target !== "FT") digits[1] = Math.min(digits[1] ?? 0, digitMax(editing.target, digits, 1));
2272
+ return setEditing({ ...editing, digits });
2273
+ }
2274
+ if (editing.index >= lastDigit(editing.target)) return commit(editing);
2275
+ return setEditing({ ...editing, index: editing.index + 1 });
2276
+ }
2277
+ if (b === "select") return changeMode(MODES[(MODES.indexOf(current) + 1) % MODES.length]);
2278
+ if (current === "ET") {
2279
+ if (etRunning) setEt(stopWatch(et, readClock()));
2280
+ else if (et.acc > 0) resetEt();
2281
+ else setEt(startWatch(et, readClock()));
2282
+ }
2283
+ };
2284
+ const hold = (b) => {
2285
+ if (b === "oatVolts") {
2286
+ setLampTest(true);
2287
+ return true;
2288
+ }
2289
+ if (b === "select") {
2290
+ if (editing) commit(editing);
2291
+ else startEditing();
2292
+ return true;
2293
+ }
2294
+ if (editing) return false;
2295
+ if (current === "FT") resetFt();
2296
+ else if (current === "ET") resetEt();
2297
+ else return false;
2298
+ return true;
2299
+ };
2300
+ const both = () => editing ? commit(editing) : startEditing();
2301
+ const acknowledge = () => {
2302
+ if (voltsBad) setVoltsAck(true);
2303
+ setLowerAlarm(null);
2304
+ };
2305
+ const actions = useRef2({ click, hold, both, acknowledge, alarmActive });
2306
+ actions.current = { click, hold, both, acknowledge, alarmActive };
2307
+ const presses = useRef2({
2308
+ oatVolts: { down: false, used: false },
2309
+ select: { down: false, used: false },
2310
+ control: { down: false, used: false }
2311
+ });
2312
+ const [pressed, setPressed] = useState2(null);
2313
+ useEffect2(() => () => Object.values(presses.current).forEach((p) => clearTimeout(p.timer)), []);
2314
+ const press = (b) => {
2315
+ const p = presses.current[b];
2316
+ if (p.down) return;
2317
+ p.down = true;
2318
+ p.used = false;
2319
+ setPressed(b);
2320
+ const a = actions.current;
2321
+ if (a.alarmActive) {
2322
+ a.acknowledge();
2323
+ p.used = true;
2324
+ return;
2325
+ }
2326
+ const other = b === "select" ? presses.current.control : b === "control" ? presses.current.select : null;
2327
+ if (other?.down) {
2328
+ clearTimeout(other.timer);
2329
+ other.used = true;
2330
+ p.used = true;
2331
+ a.both();
2332
+ return;
2333
+ }
2334
+ p.timer = setTimeout(() => {
2335
+ if (p.down && !p.used) p.used = actions.current.hold(b);
2336
+ }, HOLD_TIME);
2337
+ };
2338
+ const release = (b, cancel = false) => {
2339
+ const p = presses.current[b];
2340
+ if (!p.down) return;
2341
+ p.down = false;
2342
+ clearTimeout(p.timer);
2343
+ setPressed((x) => x === b ? null : x);
2344
+ if (b === "oatVolts") setLampTest(false);
2345
+ if (!p.used && !cancel) actions.current.click(b);
2346
+ };
2347
+ const oatC = finite(oat, NaN);
2348
+ const shownUpper = voltsFlashing ? "volts" : upper;
2349
+ const [upperDigits, unit] = lampTest ? ["88.8", "V"] : upperText(shownUpper, oatC, v);
2350
+ const upperCells = [];
2351
+ for (const ch of upperDigits) {
2352
+ const prev = upperCells[upperCells.length - 1];
2353
+ if (ch === "." && prev) prev.dot = true;
2354
+ else upperCells.push({ char: ch, dot: false });
2355
+ }
2356
+ while (upperCells.length < 3) upperCells.unshift({ char: " ", dot: false });
2357
+ const upperVisible = !voltsFlashing || blinkOn;
2358
+ let lowerDigits;
2359
+ if (lampTest) lowerDigits = "8888";
2360
+ else if (editing) {
2361
+ const d = editing.digits.join("");
2362
+ lowerDigits = editing.target === "LT" ? d.slice(0, 2) + pad2(ltDate.getUTCMinutes()) : d;
2363
+ } else if (current === "UT") lowerDigits = pad2(utDate.getUTCHours()) + pad2(utDate.getUTCMinutes());
2364
+ else if (current === "LT") lowerDigits = pad2(ltDate.getUTCHours()) + pad2(ltDate.getUTCMinutes());
2365
+ else if (current === "FT") lowerDigits = timerDigits(ftMs);
2366
+ else lowerDigits = timerDigits(countingDown ? Math.ceil((countdown - etMs) / 1e3) * 1e3 : countdown > 0 ? etMs - countdown : etMs);
2367
+ const lowerVisible = lowerAlarm === null || blinkOn;
2368
+ const shownMode = editing ? editing.target : current;
2369
+ const upperLabel = upperText(shownUpper, oatC, v);
2370
+ const lowerLabel = `${lowerDigits.slice(0, 2)}:${lowerDigits.slice(2)}`;
2371
+ const state = shownMode === "ET" ? etRunning ? countingDown ? " counting down" : " running" : et.acc > 0 ? " stopped" : "" : shownMode === "FT" && !flightTimeRunning ? " stopped" : "";
2372
+ const label2 = `Clock: ${shownUpper === "volts" ? `${upperLabel[0].trim()} volts` : `OAT ${upperLabel[0].trim()} ${upperLabel[1]}`}${voltsBad ? v < low ? " LOW" : " HIGH" : ""}, ${shownMode} ${lowerLabel}${state}${editing ? " (setting)" : ""}`;
2373
+ const labelPos = { UT: [86, 202], LT: [128, 202], FT: [86, 246], ET: [128, 246] };
2374
+ const DW = 32;
2375
+ const DH = 58;
2376
+ const lowerX = [166, 206, 262, 302];
2377
+ return /* @__PURE__ */ jsxs20(InstrumentFrame, { ...props, role: "group", label: label2, children: [
2378
+ /* @__PURE__ */ jsx20("defs", { children: /* @__PURE__ */ jsxs20("linearGradient", { id: lcdId, x1: "0", y1: "0", x2: "0", y2: "1", children: [
2379
+ /* @__PURE__ */ jsx20("stop", { offset: "0", stopColor: "#7f8977" }),
2380
+ /* @__PURE__ */ jsx20("stop", { offset: "0.18", stopColor: LCD }),
2381
+ /* @__PURE__ */ jsx20("stop", { offset: "1", stopColor: "#a9b29f" })
2382
+ ] }) }),
2383
+ /* @__PURE__ */ jsxs20("g", { fill: FACE_TEXT, fontSize: "16", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: [
2384
+ /* @__PURE__ */ jsx20("text", { x: "148", y: "80", children: "O.A.T" }),
2385
+ /* @__PURE__ */ jsx20("text", { x: "256", y: "80", children: "VOLTS" }),
2386
+ /* @__PURE__ */ jsx20("text", { x: "140", y: "294", children: "SELECT" }),
2387
+ /* @__PURE__ */ jsx20("text", { x: "260", y: "294", children: "CONTROL" })
2388
+ ] }),
2389
+ /* @__PURE__ */ jsx20("rect", { x: "104", y: "94", width: "192", height: "66", rx: "4", fill: "#0b0b0b" }),
2390
+ /* @__PURE__ */ jsx20("rect", { x: "108", y: "98", width: "184", height: "58", rx: "2", fill: `url(#${lcdId})` }),
2391
+ /* @__PURE__ */ jsxs20("g", { "data-testid": "clock-upper", "data-unit": unit, opacity: upperVisible ? 1 : 0, children: [
2392
+ upperCells.map((c, i) => /* @__PURE__ */ jsx20(Cell, { x: 132 + i * 36, y: 104, w: 26, h: 46, char: c.char, dot: c.dot, on: INK, off: GHOST, testId: `clock-upper-${i}` }, i)),
2393
+ /* @__PURE__ */ jsx20("text", { x: "244", y: "129", fill: INK, fontSize: "34", fontWeight: "bold", dominantBaseline: "central", children: unit })
2394
+ ] }),
2395
+ /* @__PURE__ */ jsx20("rect", { x: "56", y: "170", width: "288", height: "104", rx: "4", fill: "#0b0b0b" }),
2396
+ /* @__PURE__ */ jsx20("rect", { x: "60", y: "174", width: "280", height: "96", rx: "2", fill: `url(#${lcdId})` }),
2397
+ /* @__PURE__ */ jsx20("g", { fill: INK, fontSize: "17", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: MODES.map((m) => /* @__PURE__ */ jsx20("text", { x: labelPos[m][0], y: labelPos[m][1], children: m }, m)) }),
2398
+ MODES.map((m) => {
2399
+ const [x, y] = labelPos[m];
2400
+ const top = y < 224;
2401
+ const points = top ? `${x - 8},224 ${x + 8},224 ${x},215` : `${x - 8},220 ${x + 8},220 ${x},229`;
2402
+ const active = lampTest || m === shownMode;
2403
+ return /* @__PURE__ */ jsx20("polygon", { "data-testid": `clock-mode-${m}`, "data-active": active, points, fill: active ? INK : GHOST }, m);
2404
+ }),
2405
+ /* @__PURE__ */ jsxs20("g", { "data-testid": "clock-lower", opacity: lowerVisible ? 1 : 0, children: [
2406
+ lowerX.map((x, i) => {
2407
+ const blank = editing !== null && i === editing.index && !blinkOn;
2408
+ const ch = blank ? " " : lowerDigits[i] ?? " ";
2409
+ return /* @__PURE__ */ jsx20(Cell, { x, y: 193, w: DW, h: DH, char: ch, on: INK, off: GHOST, testId: `clock-lower-${i}` }, i);
2410
+ }),
2411
+ /* @__PURE__ */ jsx20("circle", { cx: "253", cy: "210", r: "4", fill: INK }),
2412
+ /* @__PURE__ */ jsx20("circle", { cx: "249", cy: "236", r: "4", fill: INK })
2413
+ ] }),
2414
+ Object.keys(BUTTONS).map((b) => {
2415
+ const { cx, cy, name } = BUTTONS[b];
2416
+ const down = pressed === b;
2417
+ return /* @__PURE__ */ jsxs20(
2418
+ "g",
2419
+ {
2420
+ role: "button",
2421
+ tabIndex: 0,
2422
+ "aria-label": name,
2423
+ "data-testid": `clock-button-${b}`,
2424
+ style: { cursor: "pointer", outline: "none", touchAction: "none" },
2425
+ onPointerDown: (e) => {
2426
+ e.preventDefault();
2427
+ press(b);
2428
+ },
2429
+ onPointerUp: () => release(b),
2430
+ onPointerLeave: () => release(b, true),
2431
+ onPointerCancel: () => release(b, true),
2432
+ onKeyDown: (e) => {
2433
+ if (e.key !== "Enter" && e.key !== " ") return;
2434
+ e.preventDefault();
2435
+ if (!e.repeat) press(b);
2436
+ },
2437
+ onKeyUp: (e) => {
2438
+ if (e.key === "Enter" || e.key === " ") release(b);
2439
+ },
2440
+ onBlur: () => release(b, true),
2441
+ children: [
2442
+ /* @__PURE__ */ jsx20("circle", { cx, cy, r: "24", fill: "transparent" }),
2443
+ /* @__PURE__ */ jsx20("circle", { cx, cy: cy + 2, r: "17", fill: "#000", opacity: "0.6" }),
2444
+ /* @__PURE__ */ jsx20("circle", { cx, cy: cy + (down ? 1.5 : 0), r: "15", fill: down ? "#bdbdbd" : "#ececec", stroke: "#8a8a8a", strokeWidth: "1.5" })
2445
+ ]
2446
+ },
2447
+ b
2448
+ );
2449
+ })
2450
+ ] });
2451
+ }
2452
+
2453
+ // src/components/DualGauge.tsx
2454
+ import { jsx as jsx21, jsxs as jsxs21 } from "react/jsx-runtime";
2455
+ var GREEN6 = "#2fb54a";
2456
+ var YELLOW4 = "#f2c200";
2457
+ var RED5 = "#e02020";
2458
+ var SWEEP2 = 56;
2459
+ var PIVOT_OFFSET = 130;
2460
+ var R = 118;
2461
+ var pivotX = (side) => CENTER + side * PIVOT_OFFSET;
2462
+ var angleAt = (side, fraction) => side < 0 ? 90 + SWEEP2 - fraction * 2 * SWEEP2 : 270 - SWEEP2 + fraction * 2 * SWEEP2;
2463
+ var round24 = (n) => Math.round(n * 100) / 100;
2464
+ function resolve2(scale) {
2465
+ const min = finite(scale?.min, 0);
2466
+ const rawMax = finite(scale?.max, 100);
2467
+ const max = rawMax > min ? rawMax : min + 1;
2468
+ const value = clamp(finite(scale?.value, min), min, max);
2469
+ return { ...scale, min, max, value };
2470
+ }
2471
+ function Half({ side, scale, duration }) {
2472
+ const px = pivotX(side);
2473
+ const frac = (v) => (clamp(v, scale.min, scale.max) - scale.min) / (scale.max - scale.min);
2474
+ const deg2 = (v) => angleAt(side, frac(v));
2475
+ const band = (b, color, key) => {
2476
+ if (!b) return null;
2477
+ const a = Math.min(deg2(b[0]), deg2(b[1]));
2478
+ const c = Math.max(deg2(b[0]), deg2(b[1]));
2479
+ return /* @__PURE__ */ jsx21("path", { d: arcPath(R - 5, a, c, px, CENTER), stroke: color, strokeWidth: "10", fill: "none" }, key);
2480
+ };
2481
+ const ticks = Math.max(1, Math.round(finite(scale.ticks, 10)));
2482
+ const marks = (scale.marks ?? [scale.min, scale.max]).map((m) => typeof m === "number" ? { value: m, text: String(m) } : m);
2483
+ const labelX = CENTER + side * 76;
2484
+ return /* @__PURE__ */ jsxs21("g", { "data-testid": `dual-${side < 0 ? "left" : "right"}`, children: [
2485
+ band(scale.green, GREEN6, "green"),
2486
+ band(scale.yellow, YELLOW4, "yellow"),
2487
+ /* @__PURE__ */ jsxs21("g", { stroke: "#fff", strokeLinecap: "round", children: [
2488
+ Array.from({ length: ticks + 1 }, (_, i) => /* @__PURE__ */ jsx21("path", { d: tickPath(R, R - 10, angleAt(side, i / ticks), px, CENTER), strokeWidth: "2" }, i)),
2489
+ marks.map(({ value }) => /* @__PURE__ */ jsx21("path", { d: tickPath(R, R - 18, deg2(value), px, CENTER), strokeWidth: "3.5" }, value))
2490
+ ] }),
2491
+ /* @__PURE__ */ jsx21("g", { stroke: RED5, strokeWidth: "5", children: [scale.low, scale.high].map(
2492
+ (l, i) => typeof l === "number" && Number.isFinite(l) ? /* @__PURE__ */ jsx21("path", { d: tickPath(R + 4, R - 20, deg2(l), px, CENTER) }, i) : null
2493
+ ) }),
2494
+ marks.map(({ value, text }) => {
2495
+ const [x, y] = polar(R - 36, deg2(value), px, CENTER);
2496
+ return /* @__PURE__ */ jsx21("text", { x, y, fill: "#fff", fontSize: "19", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: text }, `${value}-${text}`);
2497
+ }),
2498
+ scale.label && /* @__PURE__ */ jsx21("text", { x: labelX, y: CENTER - 116, fill: "#ddd", fontSize: scale.label.length > 3 ? 15 : 22, fontWeight: "bold", textAnchor: "middle", children: scale.label }),
2499
+ scale.unit && /* @__PURE__ */ jsx21("text", { x: labelX, y: CENTER + 128, fill: "#bbb", fontSize: "14", textAnchor: "middle", children: scale.unit }),
2500
+ /* @__PURE__ */ jsx21("g", { "data-testid": `dual-${side < 0 ? "left" : "right"}-needle`, style: motionStyle(`rotate(${round24(deg2(scale.value))}deg)`, duration, px, CENTER), children: /* @__PURE__ */ jsx21("path", { d: `M ${px - 4} ${CENTER + 14} L ${px - 3} ${CENTER - R + 22} L ${px} ${CENTER - R + 6} L ${px + 3} ${CENTER - R + 22} L ${px + 4} ${CENTER + 14} Z`, fill: "#fff" }) }),
2501
+ /* @__PURE__ */ jsx21("circle", { cx: px, cy: CENTER, r: "11", fill: "#2a2a2a", stroke: "#555", strokeWidth: "2" })
2502
+ ] });
2503
+ }
2504
+ var describe = (s, fallback) => `${s.label ?? fallback} ${s.value.toFixed(Math.max(0, Math.floor(finite(s.decimals, 0))))}${s.unit ? ` ${s.unit}` : ""}`;
2505
+ function DualGauge({ left, right, label: label2, sublabel, ...props }) {
2506
+ const duration = props.animationDuration ?? DEFAULT_ANIMATION_MS;
2507
+ const l = resolve2(left);
2508
+ const r = resolve2(right);
2509
+ const title = `${label2 ?? "Gauge"}: ${describe(l, "left")}, ${describe(r, "right")}`;
2510
+ return /* @__PURE__ */ jsxs21(InstrumentFrame, { ...props, label: title, children: [
2511
+ label2 && /* @__PURE__ */ jsx21("text", { x: CENTER, y: CENTER - 146, fill: "#eee", fontSize: "17", fontWeight: "bold", textAnchor: "middle", letterSpacing: "1", children: label2 }),
2512
+ sublabel && /* @__PURE__ */ jsx21("text", { x: CENTER, y: CENTER + 158, fill: "#bbb", fontSize: "14", textAnchor: "middle", letterSpacing: "1", children: sublabel }),
2513
+ /* @__PURE__ */ jsx21(Half, { side: -1, scale: l, duration }),
2514
+ /* @__PURE__ */ jsx21(Half, { side: 1, scale: r, duration })
2515
+ ] });
2516
+ }
2517
+ var FUEL_QUANTITY_SCALE = { min: 0, max: 44, marks: [0, 10, 20, 30, { value: 44, text: "F" }], ticks: 11, yellow: [0, 5], low: 0, unit: "GAL" };
2518
+ var OIL_TEMPERATURE_SCALE = { label: "OIL TEMP", min: 75, max: 250, marks: [100, 150, 200, 250], ticks: 7, green: [100, 245], high: 245, unit: "\xB0F" };
2519
+ var OIL_PRESSURE_SCALE = { label: "OIL PRESS", min: 0, max: 115, marks: [0, 50, 100], ticks: 23, green: [50, 90], low: 20, high: 115, unit: "PSI" };
2520
+ var VACUUM_SCALE = { label: "VAC", min: 3, max: 7, marks: [3, 5, 7], ticks: 8, green: [4.5, 5.5], unit: "IN HG", decimals: 1 };
2521
+ var AMMETER_SCALE = { label: "AMP", min: -60, max: 60, marks: [{ value: -60, text: "\u2212" }, 0, { value: 60, text: "+" }], ticks: 12, unit: "AMPS" };
2522
+ var EGT_SCALE = { label: "EGT", min: 1250, max: 1650, marks: [], ticks: 8, unit: "\xB0F" };
2523
+ var FUEL_FLOW_SCALE = { label: "FUEL FLOW", min: 0, max: 20, marks: [0, 10, 20], ticks: 10, green: [0, 17], unit: "GAL/HR", decimals: 1 };
2524
+ var MANIFOLD_SCALE = { label: "MAN PRESS", min: 10, max: 35, marks: [10, 20, 30], ticks: 25, green: [15, 23], unit: "IN HG", decimals: 1 };
2525
+ function FuelQuantityGauge({ leftQuantity, rightQuantity, leftScale, rightScale, ...props }) {
2526
+ return /* @__PURE__ */ jsx21(
2527
+ DualGauge,
2528
+ {
2529
+ ...props,
2530
+ label: "FUEL QTY",
2531
+ left: { ...FUEL_QUANTITY_SCALE, label: "L", ...leftScale, value: leftQuantity },
2532
+ right: { ...FUEL_QUANTITY_SCALE, label: "R", ...rightScale, value: rightQuantity }
2533
+ }
2534
+ );
2535
+ }
2536
+ function OilGauge({ temperature, pressure, leftScale, rightScale, ...props }) {
2537
+ return /* @__PURE__ */ jsx21(
2538
+ DualGauge,
2539
+ {
2540
+ ...props,
2541
+ label: "OIL",
2542
+ left: { ...OIL_TEMPERATURE_SCALE, ...leftScale, value: temperature },
2543
+ right: { ...OIL_PRESSURE_SCALE, ...rightScale, value: pressure }
2544
+ }
2545
+ );
2546
+ }
2547
+ function VacuumAmmeterGauge({ vacuum, amps, leftScale, rightScale, ...props }) {
2548
+ return /* @__PURE__ */ jsx21(
2549
+ DualGauge,
2550
+ {
2551
+ ...props,
2552
+ label: "VAC / AMP",
2553
+ left: { ...VACUUM_SCALE, ...leftScale, value: vacuum },
2554
+ right: { ...AMMETER_SCALE, ...rightScale, value: amps }
2555
+ }
2556
+ );
2557
+ }
2558
+ function EgtFuelFlowGauge({ egt, fuelFlow, leftScale, rightScale, ...props }) {
2559
+ return /* @__PURE__ */ jsx21(
2560
+ DualGauge,
2561
+ {
2562
+ ...props,
2563
+ label: "EGT / FF",
2564
+ left: { ...EGT_SCALE, ...leftScale, value: egt },
2565
+ right: { ...FUEL_FLOW_SCALE, ...rightScale, value: fuelFlow }
2566
+ }
2567
+ );
2568
+ }
2569
+ function ManifoldFuelFlowGauge({ manifold, fuelFlow, leftScale, rightScale, ...props }) {
2570
+ return /* @__PURE__ */ jsx21(
2571
+ DualGauge,
2572
+ {
2573
+ ...props,
2574
+ label: "MAP / FF",
2575
+ left: { ...MANIFOLD_SCALE, ...leftScale, value: manifold },
2576
+ right: { ...FUEL_FLOW_SCALE, ...rightScale, value: fuelFlow }
2577
+ }
2578
+ );
2579
+ }
2580
+
2581
+ // src/components/Odometer.tsx
2582
+ import { jsx as jsx22, jsxs as jsxs22 } from "react/jsx-runtime";
2583
+ function drumPositions(value, digits) {
2584
+ const n = Math.max(1, Math.floor(digits));
2585
+ const span = 10 ** n;
2586
+ const tenths = (finite(value) * 10 % span + span) % span;
2587
+ return Array.from({ length: n }, (_, i) => {
2588
+ if (i === 0) return Math.round(tenths % 10 * 1e3) / 1e3;
2589
+ const unit = 10 ** i;
2590
+ const digit = Math.floor(tenths / unit) % 10;
2591
+ const below = tenths % unit;
2592
+ const carry = below > unit - 1 ? below - (unit - 1) : 0;
2593
+ return Math.round((digit + carry) * 1e3) / 1e3;
2594
+ });
2595
+ }
2596
+ function Odometer({ value, digits, x, y, digitWidth, height, clipId, testId = "odometer" }) {
2597
+ const positions = drumPositions(value, digits);
2598
+ const n = positions.length;
2599
+ const left = x - n * digitWidth / 2;
2600
+ const top = y - height / 2;
2601
+ const fontSize = height * 0.72;
2602
+ return /* @__PURE__ */ jsxs22("g", { "data-testid": testId, children: [
2603
+ /* @__PURE__ */ jsx22("defs", { children: /* @__PURE__ */ jsx22("clipPath", { id: clipId, children: /* @__PURE__ */ jsx22("rect", { x: left, y: top, width: n * digitWidth, height }) }) }),
2604
+ /* @__PURE__ */ jsx22("rect", { x: left - 4, y: top - 4, width: n * digitWidth + 8, height: height + 8, rx: "3", fill: "#000", stroke: "#555", strokeWidth: "2" }),
2605
+ /* @__PURE__ */ jsx22("g", { clipPath: `url(#${clipId})`, children: positions.map((p, k) => {
2606
+ const i = n - 1 - k;
2607
+ const dx = left + i * digitWidth;
2608
+ const tenths = k === 0;
2609
+ return /* @__PURE__ */ jsxs22("g", { children: [
2610
+ /* @__PURE__ */ jsx22("rect", { x: dx + 1, y: top, width: digitWidth - 2, height, fill: tenths ? "#eee" : "#151515" }),
2611
+ /* @__PURE__ */ jsx22("g", { "data-testid": `${testId}-drum-${k}`, transform: `translate(0 ${Math.round(-p * height * 100) / 100})`, children: Array.from({ length: 11 }, (_, d) => /* @__PURE__ */ jsx22(
2612
+ "text",
2613
+ {
2614
+ x: dx + digitWidth / 2,
2615
+ y: top + height / 2 + d * height,
2616
+ fill: tenths ? "#111" : "#f2f2f2",
2617
+ fontSize,
2618
+ fontFamily: "monospace",
2619
+ fontWeight: "bold",
2620
+ textAnchor: "middle",
2621
+ dominantBaseline: "central",
2622
+ children: d % 10
2623
+ },
2624
+ d
2625
+ )) })
2626
+ ] }, k);
2627
+ }) }),
2628
+ /* @__PURE__ */ jsx22("rect", { x: left, y: top, width: n * digitWidth, height: height * 0.18, fill: "#000", opacity: "0.35", pointerEvents: "none" }),
2629
+ /* @__PURE__ */ jsx22("rect", { x: left, y: top + height * 0.82, width: n * digitWidth, height: height * 0.18, fill: "#000", opacity: "0.35", pointerEvents: "none" })
2630
+ ] });
2631
+ }
2632
+
2633
+ // src/components/Tachometer.tsx
2634
+ import { Fragment as Fragment6, jsx as jsx23, jsxs as jsxs23 } from "react/jsx-runtime";
2635
+ var START = -135;
2636
+ var SWEEP3 = 270;
2637
+ function Tachometer({ rpm = 0, max = 3500, green = [2e3, 2400], redline = 2400, hours, ...props }) {
2638
+ const duration = props.animationDuration ?? DEFAULT_ANIMATION_MS;
2639
+ const clipId = useSvgId("fi-tach");
2640
+ const top = Math.max(500, finite(max, 3500));
2641
+ const value = clamp(finite(rpm), 0, top);
2642
+ const angle = (v) => START + clamp(v, 0, top) / top * SWEEP3;
2643
+ const showHours = typeof hours === "number" && Number.isFinite(hours);
2644
+ const engineHours = showHours ? Math.max(0, hours) : 0;
2645
+ return /* @__PURE__ */ jsxs23(InstrumentFrame, { ...props, label: `Tachometer: ${Math.round(value)} RPM${showHours ? `, ${engineHours.toFixed(1)} hours` : ""}`, children: [
2646
+ green && /* @__PURE__ */ jsx23("path", { d: arcPath(166, angle(green[0]), angle(green[1])), stroke: "#2fb54a", strokeWidth: "12", fill: "none" }),
2647
+ /* @__PURE__ */ jsx23("g", { stroke: "#fff", strokeLinecap: "round", children: range(0, top, 100).map((v) => {
2648
+ const major = v % 500 === 0;
2649
+ return /* @__PURE__ */ jsx23("path", { d: tickPath(178, major ? 148 : 162, angle(v)), strokeWidth: major ? 3.5 : 2 }, v);
2650
+ }) }),
2651
+ typeof redline === "number" && Number.isFinite(redline) && /* @__PURE__ */ jsx23("path", { d: tickPath(180, 146, angle(redline)), stroke: "#e02020", strokeWidth: "6" }),
2652
+ range(0, top, 500).map((v) => {
2653
+ const [x, y] = polar(122, angle(v));
2654
+ return /* @__PURE__ */ jsx23("text", { x, y, fill: "#fff", fontSize: "26", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: v / 100 }, v);
2655
+ }),
2656
+ /* @__PURE__ */ jsx23("text", { x: CENTER, y: CENTER - 50, fill: "#ddd", fontSize: "20", fontWeight: "bold", textAnchor: "middle", children: "RPM" }),
2657
+ /* @__PURE__ */ jsx23("text", { x: CENTER, y: CENTER - 28, fill: "#bbb", fontSize: "13", textAnchor: "middle", children: "\xD7 100" }),
2658
+ showHours && /* @__PURE__ */ jsxs23(Fragment6, { children: [
2659
+ /* @__PURE__ */ jsx23(Odometer, { value: engineHours, digits: 6, x: CENTER, y: CENTER + 70, digitWidth: 20, height: 28, clipId, testId: "tach-hours" }),
2660
+ /* @__PURE__ */ jsx23("text", { x: CENTER, y: CENTER + 103, fill: "#bbb", fontSize: "11", textAnchor: "middle", letterSpacing: "2", children: "HOURS" })
2661
+ ] }),
2662
+ /* @__PURE__ */ jsx23("g", { "data-testid": "tach-needle", style: motionStyle(`rotate(${Math.round(angle(value) * 100) / 100}deg)`, duration), children: /* @__PURE__ */ jsx23("path", { d: `M ${CENTER - 5} ${CENTER + 30} L ${CENTER - 4} ${CENTER - 140} L ${CENTER} ${CENTER - 165} L ${CENTER + 4} ${CENTER - 140} L ${CENTER + 5} ${CENTER + 30} Z`, fill: "#fff" }) }),
2663
+ /* @__PURE__ */ jsx23(Hub, {})
2664
+ ] });
2665
+ }
2666
+
2667
+ // src/components/MagneticCompass.tsx
2668
+ import { jsx as jsx24, jsxs as jsxs24 } from "react/jsx-runtime";
2669
+ var CARDINALS7 = { 0: "N", 90: "E", 180: "S", 270: "W" };
2670
+ var PPD = 4;
2671
+ var WINDOW_W = 284;
2672
+ var WINDOW_H = 120;
2673
+ var WINDOW_Y = CENTER - 70;
2674
+ var SPAN = 90;
2675
+ var norm6 = (deg2) => (deg2 % 360 + 360) % 360;
2676
+ var cardLabel = (deg2) => CARDINALS7[Math.round(norm6(deg2)) % 360] ?? String(Math.round(norm6(deg2)));
2677
+ var pad33 = (deg2) => String(Math.round(norm6(deg2)) % 360 || 360).padStart(3, "0");
2678
+ function MagneticCompass({ heading = 0, deviationCard, ...props }) {
2679
+ const duration = props.animationDuration ?? DEFAULT_ANIMATION_MS;
2680
+ const hdg = finite(heading);
2681
+ const display2 = useContinuousAngle(hdg);
2682
+ const base = Math.round(display2 / 5) * 5;
2683
+ const cardX = (d) => CENTER - d * PPD;
2684
+ const left = CENTER - WINDOW_W / 2;
2685
+ const clipId = useSvgId("fi-compass-window");
2686
+ const shadeId = useSvgId("fi-compass-shade");
2687
+ const rows = (deviationCard ?? []).slice(0, 6);
2688
+ return /* @__PURE__ */ jsxs24(InstrumentFrame, { ...props, label: `Magnetic compass: ${pad33(hdg)}\xB0`, children: [
2689
+ /* @__PURE__ */ jsxs24("defs", { children: [
2690
+ /* @__PURE__ */ jsx24("clipPath", { id: clipId, children: /* @__PURE__ */ jsx24("rect", { x: left, y: WINDOW_Y, width: WINDOW_W, height: WINDOW_H, rx: "16" }) }),
2691
+ /* @__PURE__ */ jsxs24("linearGradient", { id: shadeId, x1: "0", y1: "0", x2: "1", y2: "0", children: [
2692
+ /* @__PURE__ */ jsx24("stop", { offset: "0", stopColor: "#000", stopOpacity: "0.85" }),
2693
+ /* @__PURE__ */ jsx24("stop", { offset: "0.22", stopColor: "#000", stopOpacity: "0" }),
2694
+ /* @__PURE__ */ jsx24("stop", { offset: "0.78", stopColor: "#000", stopOpacity: "0" }),
2695
+ /* @__PURE__ */ jsx24("stop", { offset: "1", stopColor: "#000", stopOpacity: "0.85" })
2696
+ ] })
2697
+ ] }),
2698
+ /* @__PURE__ */ jsx24("rect", { x: left - 6, y: WINDOW_Y - 6, width: WINDOW_W + 12, height: WINDOW_H + 12, rx: "20", fill: "#000", stroke: "#444", strokeWidth: "3" }),
2699
+ /* @__PURE__ */ jsxs24("g", { clipPath: `url(#${clipId})`, children: [
2700
+ /* @__PURE__ */ jsx24("rect", { x: left, y: WINDOW_Y, width: WINDOW_W, height: WINDOW_H, fill: "#16181a" }),
2701
+ /* @__PURE__ */ jsx24("g", { "data-testid": "compass-card", style: motionStyle(`translate(${Math.round(display2 * PPD * 100) / 100}px, 0px)`, duration), children: range(base - SPAN, base + SPAN, 5).map((d) => {
2702
+ const x = cardX(d);
2703
+ const n = norm6(d);
2704
+ const label2 = n % 30 === 0 ? CARDINALS7[n] ?? String(n / 10) : null;
2705
+ return /* @__PURE__ */ jsxs24("g", { children: [
2706
+ /* @__PURE__ */ jsx24("path", { d: `M ${x} ${WINDOW_Y + 4} v ${n % 10 === 0 ? 26 : 16}`, stroke: "#eee", strokeWidth: n % 10 === 0 ? 3 : 2 }),
2707
+ label2 && /* @__PURE__ */ jsx24("text", { x, y: WINDOW_Y + 66, fill: CARDINALS7[n] ? "#fff" : "#e8e8e8", fontSize: CARDINALS7[n] ? 40 : 34, fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: label2 })
2708
+ ] }, d);
2709
+ }) }),
2710
+ /* @__PURE__ */ jsx24("rect", { x: left, y: WINDOW_Y, width: WINDOW_W, height: WINDOW_H, fill: `url(#${shadeId})`, pointerEvents: "none" })
2711
+ ] }),
2712
+ /* @__PURE__ */ jsx24("path", { d: `M ${CENTER} ${WINDOW_Y - 4} V ${WINDOW_Y + WINDOW_H + 4}`, stroke: "#ff5a2a", strokeWidth: "3" }),
2713
+ /* @__PURE__ */ jsx24("text", { x: CENTER, y: WINDOW_Y - 24, fill: "#ccc", fontSize: "16", textAnchor: "middle", letterSpacing: "3", children: "COMPASS" }),
2714
+ rows.length > 0 && /* @__PURE__ */ jsxs24("g", { "data-testid": "compass-deviation-card", fontSize: "13", fill: "#222", textAnchor: "middle", dominantBaseline: "central", children: [
2715
+ /* @__PURE__ */ jsx24("rect", { x: CENTER - 136, y: CENTER + 70, width: "272", height: "64", rx: "4", fill: "#ececec" }),
2716
+ /* @__PURE__ */ jsx24("text", { x: CENTER - 110, y: CENTER + 86, fontWeight: "bold", children: "FOR" }),
2717
+ /* @__PURE__ */ jsx24("text", { x: CENTER - 110, y: CENTER + 116, fontWeight: "bold", children: "STEER" }),
2718
+ rows.map((r, i) => {
2719
+ const x = CENTER - 56 + i * (166 / Math.max(1, rows.length - 1));
2720
+ return /* @__PURE__ */ jsxs24("g", { children: [
2721
+ /* @__PURE__ */ jsx24("text", { x, y: CENTER + 86, children: cardLabel(finite(r.for)) }),
2722
+ /* @__PURE__ */ jsx24("text", { x, y: CENTER + 116, children: Math.round(norm6(finite(r.steer))) })
2723
+ ] }, i);
2724
+ })
2725
+ ] })
2726
+ ] });
2727
+ }
2728
+
2729
+ // src/components/TrimIndicator.tsx
2730
+ import { jsx as jsx25, jsxs as jsxs25 } from "react/jsx-runtime";
2731
+ var SLOT_X = 248;
2732
+ var TOP2 = 74;
2733
+ var BOTTOM2 = 326;
2734
+ var MID = (TOP2 + BOTTOM2) / 2;
2735
+ var HALF2 = (BOTTOM2 - TOP2) / 2;
2736
+ var WHEEL_X = 150;
2737
+ var WHEEL_W = 56;
2738
+ var WHEEL_TRAVEL = 140;
2739
+ var RIB = 14;
2740
+ var round25 = (n) => Math.round(n * 100) / 100;
2741
+ function TrimIndicator({ trim = 0, takeoff = [0.05, 0.35], ...props }) {
2742
+ const duration = props.animationDuration ?? DEFAULT_ANIMATION_MS;
2743
+ const clipId = useSvgId("fi-trim-wheel");
2744
+ const value = clamp(finite(trim), -1, 1);
2745
+ const yAt = (t) => round25(MID + clamp(t, -1, 1) * HALF2);
2746
+ const inTakeoff = takeoff ? value >= Math.min(...takeoff) && value <= Math.max(...takeoff) : false;
2747
+ const percent = Math.round(Math.abs(value) * 100);
2748
+ const describe2 = percent === 0 ? "neutral" : `${percent}% nose ${value > 0 ? "up" : "down"}`;
2749
+ const ribCount = Math.ceil((BOTTOM2 - TOP2 + 2 * WHEEL_TRAVEL) / RIB) + 1;
2750
+ return /* @__PURE__ */ jsxs25(InstrumentFrame, { ...props, label: `Elevator trim: ${describe2}${inTakeoff ? ", take-off range" : ""}`, children: [
2751
+ /* @__PURE__ */ jsx25("defs", { children: /* @__PURE__ */ jsx25("clipPath", { id: clipId, children: /* @__PURE__ */ jsx25("rect", { x: WHEEL_X - WHEEL_W / 2, y: TOP2, width: WHEEL_W, height: BOTTOM2 - TOP2, rx: "10" }) }) }),
2752
+ /* @__PURE__ */ jsx25("rect", { x: WHEEL_X - WHEEL_W / 2 - 6, y: TOP2 - 6, width: WHEEL_W + 12, height: BOTTOM2 - TOP2 + 12, rx: "14", fill: "#000", stroke: "#333", strokeWidth: "2" }),
2753
+ /* @__PURE__ */ jsxs25("g", { clipPath: `url(#${clipId})`, children: [
2754
+ /* @__PURE__ */ jsx25("rect", { x: WHEEL_X - WHEEL_W / 2, y: TOP2, width: WHEEL_W, height: BOTTOM2 - TOP2, fill: "#2c2c2c" }),
2755
+ /* @__PURE__ */ jsx25("g", { "data-testid": "trim-wheel", style: motionStyle(`translate(0px, ${round25(value * WHEEL_TRAVEL)}px)`, duration), children: Array.from({ length: ribCount }, (_, i) => /* @__PURE__ */ jsx25("rect", { x: WHEEL_X - WHEEL_W / 2, y: TOP2 - WHEEL_TRAVEL + i * RIB, width: WHEEL_W, height: RIB / 2, fill: "#121212" }, i)) }),
2756
+ /* @__PURE__ */ jsx25("rect", { x: WHEEL_X - WHEEL_W / 2, y: TOP2, width: WHEEL_W, height: "40", fill: "#000", opacity: "0.5" }),
2757
+ /* @__PURE__ */ jsx25("rect", { x: WHEEL_X - WHEEL_W / 2, y: BOTTOM2 - 40, width: WHEEL_W, height: "40", fill: "#000", opacity: "0.5" })
2758
+ ] }),
2759
+ /* @__PURE__ */ jsx25("rect", { x: SLOT_X - 7, y: TOP2, width: "14", height: BOTTOM2 - TOP2, rx: "7", fill: "#000", stroke: "#444", strokeWidth: "2" }),
2760
+ /* @__PURE__ */ jsx25("g", { stroke: "#ddd", strokeWidth: "2", children: Array.from({ length: 11 }, (_, i) => {
2761
+ const y = TOP2 + i * (BOTTOM2 - TOP2) / 10;
2762
+ return /* @__PURE__ */ jsx25("path", { d: `M ${SLOT_X + 12} ${y} h ${i === 5 ? 20 : 12}` }, i);
2763
+ }) }),
2764
+ takeoff && /* @__PURE__ */ jsxs25("g", { "data-testid": "trim-takeoff", children: [
2765
+ /* @__PURE__ */ jsx25("rect", { x: SLOT_X - 20, y: yAt(Math.min(...takeoff)), width: "8", height: Math.max(2, yAt(Math.max(...takeoff)) - yAt(Math.min(...takeoff))), fill: "#fff" }),
2766
+ /* @__PURE__ */ jsx25(
2767
+ "text",
2768
+ {
2769
+ x: SLOT_X - 30,
2770
+ y: (yAt(takeoff[0]) + yAt(takeoff[1])) / 2,
2771
+ fill: "#fff",
2772
+ fontSize: "12",
2773
+ fontWeight: "bold",
2774
+ textAnchor: "end",
2775
+ dominantBaseline: "central",
2776
+ children: "TAKE OFF"
2777
+ }
2778
+ )
2779
+ ] }),
2780
+ /* @__PURE__ */ jsxs25("g", { "data-testid": "trim-pointer", style: motionStyle(`translate(0px, ${round25(value * HALF2)}px)`, duration), children: [
2781
+ /* @__PURE__ */ jsx25("path", { d: `M ${SLOT_X + 8} ${MID} l 26 -11 v 22 z`, fill: "#fff", stroke: "#000", strokeWidth: "1.5" }),
2782
+ /* @__PURE__ */ jsx25("rect", { x: SLOT_X - 5, y: MID - 4, width: "10", height: "8", rx: "2", fill: "#fff" })
2783
+ ] }),
2784
+ /* @__PURE__ */ jsxs25("g", { fill: "#ddd", fontSize: "15", fontWeight: "bold", textAnchor: "middle", children: [
2785
+ /* @__PURE__ */ jsx25("text", { x: CENTER + 92, y: TOP2 - 14, children: "NOSE" }),
2786
+ /* @__PURE__ */ jsx25("text", { x: CENTER + 92, y: TOP2 + 2, children: "DOWN" }),
2787
+ /* @__PURE__ */ jsx25("text", { x: CENTER + 92, y: BOTTOM2 + 8, children: "NOSE" }),
2788
+ /* @__PURE__ */ jsx25("text", { x: CENTER + 92, y: BOTTOM2 + 24, children: "UP" })
2789
+ ] }),
2790
+ /* @__PURE__ */ jsx25("text", { x: WHEEL_X, y: BOTTOM2 + 32, fill: "#ccc", fontSize: "14", textAnchor: "middle", letterSpacing: "2", children: "TRIM" })
2791
+ ] });
2792
+ }
2793
+
2794
+ // src/components/HobbsMeter.tsx
2795
+ import { jsx as jsx26, jsxs as jsxs26 } from "react/jsx-runtime";
2796
+ var W = 400;
2797
+ var H = 170;
2798
+ function HobbsMeter({ hours = 0, digits = 6, running = false, label: label2 = "HOURS", ...props }) {
2799
+ const clipId = useSvgId("fi-hobbs");
2800
+ const value = Math.max(0, finite(hours));
2801
+ const n = Math.min(8, Math.max(2, Math.floor(finite(digits, 6))));
2802
+ const digitW = Math.min(40, 260 / n);
2803
+ const counterRight = W / 2 + 10 + n * digitW / 2;
2804
+ return /* @__PURE__ */ jsxs26(PanelFrame, { ...props, width: W, height: H, label: `${label2}: ${value.toFixed(1)}${running ? ", running" : ""}`, children: [
2805
+ /* @__PURE__ */ jsx26("rect", { x: "44", y: "18", width: W - 88, height: H - 36, rx: "10", fill: "#111", stroke: "#000", strokeWidth: "3" }),
2806
+ /* @__PURE__ */ jsx26("text", { x: W / 2 + 10, y: "44", fill: "#ddd", fontSize: "15", fontWeight: "bold", textAnchor: "middle", letterSpacing: "3", children: label2 }),
2807
+ /* @__PURE__ */ jsx26(Odometer, { value, digits: n, x: W / 2 + 10, y: 92, digitWidth: digitW, height: 52, clipId, testId: "hobbs" }),
2808
+ /* @__PURE__ */ jsx26("text", { x: counterRight - digitW / 2, y: "136", fill: "#999", fontSize: "11", textAnchor: "middle", children: "1/10" }),
2809
+ /* @__PURE__ */ jsxs26("g", { "data-testid": "hobbs-running", "data-running": running ? "true" : "false", children: [
2810
+ /* @__PURE__ */ jsx26("circle", { cx: "66", cy: "92", r: "13", fill: "#000", stroke: "#555", strokeWidth: "2" }),
2811
+ /* @__PURE__ */ jsxs26("g", { children: [
2812
+ /* @__PURE__ */ jsx26("path", { d: "M 66 92 L 66 80 A 12 12 0 0 1 76.4 86 Z", fill: running ? "#eee" : "#666" }),
2813
+ /* @__PURE__ */ jsx26("path", { d: "M 66 92 L 66 104 A 12 12 0 0 1 55.6 98 Z", fill: running ? "#eee" : "#666" }),
2814
+ running && /* @__PURE__ */ jsx26("animateTransform", { attributeName: "transform", type: "rotate", from: "0 66 92", to: "360 66 92", dur: "2s", repeatCount: "indefinite" })
2815
+ ] })
2816
+ ] })
2817
+ ] });
2818
+ }
2819
+
2820
+ // src/components/AnnunciatorPanel.tsx
2821
+ import { jsx as jsx27, jsxs as jsxs27 } from "react/jsx-runtime";
2822
+ var DEFAULT_ANNUNCIATORS = [
2823
+ { id: "fuel", label: "FUEL", level: "caution", split: true },
2824
+ { id: "oil", label: "OIL PRESS", level: "warning" },
2825
+ { id: "trim", label: "PITCH TRIM", level: "warning" },
2826
+ { id: "vac", label: "VAC", level: "caution", split: true },
2827
+ { id: "volts", label: "VOLTS", level: "warning" }
2828
+ ];
2829
+ var COLORS = { warning: "#ff2a2a", caution: "#ffb000", advisory: "#3ddc3d" };
2830
+ var OFF = "#3a3a3a";
2831
+ var W2 = 400;
2832
+ var PAD_X = 44;
2833
+ function litParts(state, split, test) {
2834
+ if (test) return { left: true, right: true, main: true };
2835
+ if (!split) return { left: false, right: false, main: !!state };
2836
+ const left = state === true || state === "left" || state === "both";
2837
+ const right = state === true || state === "right" || state === "both";
2838
+ return { left, right, main: left || right };
2839
+ }
2840
+ function AnnunciatorPanel({ annunciators = DEFAULT_ANNUNCIATORS, lights = {}, test = false, ...props }) {
2841
+ const items = annunciators.slice(0, 12);
2842
+ const rows = items.length > 3 ? 2 : 1;
2843
+ const cols = Math.max(1, Math.ceil(items.length / rows));
2844
+ const rowH = 34;
2845
+ const H2 = 28 + rows * rowH;
2846
+ const cellW = (W2 - 2 * PAD_X) / cols;
2847
+ const on = [];
2848
+ items.forEach((a) => {
2849
+ const p = litParts(lights[a.id], !!a.split, test);
2850
+ if (!p.main) return;
2851
+ if (a.split && !(p.left && p.right)) on.push(`${p.left ? "L" : "R"} ${a.label}`);
2852
+ else on.push(a.split ? `L ${a.label} R` : a.label);
2853
+ });
2854
+ return /* @__PURE__ */ jsxs27(PanelFrame, { ...props, width: W2, height: H2, label: `Annunciator: ${on.length ? on.join(", ") : "all clear"}`, children: [
2855
+ /* @__PURE__ */ jsx27("rect", { x: PAD_X - 6, y: "10", width: W2 - 2 * PAD_X + 12, height: H2 - 20, rx: "4", fill: "#0b0b0b", stroke: "#000", strokeWidth: "2" }),
2856
+ items.map((a, i) => {
2857
+ const row = Math.floor(i / cols);
2858
+ const col = i % cols;
2859
+ const cx = PAD_X + col * cellW + cellW / 2;
2860
+ const cy = 14 + row * rowH + rowH / 2;
2861
+ const color = COLORS[a.level ?? "caution"];
2862
+ const p = litParts(lights[a.id], !!a.split, test);
2863
+ const fill = (lit) => lit ? color : OFF;
2864
+ const glow = (lit) => lit ? { filter: `drop-shadow(0 0 3px ${color})` } : void 0;
2865
+ const fontSize = Math.min(15, (cellW - 10) / Math.max(4, (a.label.length + (a.split ? 4 : 0)) * 0.62));
2866
+ return /* @__PURE__ */ jsxs27("g", { "data-testid": `annunciator-${a.id}`, "data-lit": p.main ? "true" : "false", fontWeight: "bold", fontSize, dominantBaseline: "central", children: [
2867
+ /* @__PURE__ */ jsx27("rect", { x: cx - cellW / 2 + 3, y: cy - rowH / 2 + 3, width: cellW - 6, height: rowH - 6, rx: "2", fill: "#141414" }),
2868
+ a.split ? /* @__PURE__ */ jsxs27("text", { x: cx, y: cy, textAnchor: "middle", children: [
2869
+ /* @__PURE__ */ jsx27("tspan", { "data-testid": `annunciator-${a.id}-left`, fill: fill(p.left), style: glow(p.left), children: "L" }),
2870
+ /* @__PURE__ */ jsx27("tspan", { fill: fill(p.main), style: glow(p.main), children: ` ${a.label} ` }),
2871
+ /* @__PURE__ */ jsx27("tspan", { "data-testid": `annunciator-${a.id}-right`, fill: fill(p.right), style: glow(p.right), children: "R" })
2872
+ ] }) : /* @__PURE__ */ jsx27("text", { x: cx, y: cy, textAnchor: "middle", fill: fill(p.main), style: glow(p.main), children: a.label })
2873
+ ] }, a.id);
2874
+ })
1765
2875
  ] });
1766
2876
  }
1767
2877
  export {
2878
+ AMMETER_SCALE,
1768
2879
  AdfIndicator,
1769
2880
  Airspeed,
1770
2881
  Altimeter,
2882
+ AnnunciatorPanel,
1771
2883
  AoaIndicator,
1772
2884
  AttitudeIndicator,
2885
+ DEFAULT_ANNUNCIATORS,
1773
2886
  DEFAULT_BAR_GAUGES,
1774
2887
  DEFAULT_MANIFOLD,
1775
2888
  DEFAULT_RPM,
1776
2889
  DataPanel,
2890
+ DigitalClock,
2891
+ DualGauge,
2892
+ EGT_SCALE,
2893
+ EgtFuelFlowGauge,
1777
2894
  EngineIndicator,
2895
+ FUEL_FLOW_SCALE,
2896
+ FUEL_QUANTITY_SCALE,
1778
2897
  FlapIndicator,
1779
2898
  FuelIndicator,
2899
+ FuelQuantityGauge,
2900
+ HOLD_TIME,
1780
2901
  HeadingIndicator,
2902
+ HobbsMeter,
2903
+ HsiIndicator,
1781
2904
  IlsIndicator,
2905
+ MANIFOLD_SCALE,
1782
2906
  MAX_BAR_GAUGES,
1783
2907
  MAX_CYLINDERS,
1784
2908
  MAX_FIELDS,
1785
2909
  MAX_TANKS,
2910
+ MagneticCompass,
2911
+ ManifoldFuelFlowGauge,
2912
+ OIL_PRESSURE_SCALE,
2913
+ OIL_TEMPERATURE_SCALE,
2914
+ OilGauge,
1786
2915
  RadioPanel,
1787
2916
  RadioStack,
2917
+ Tachometer,
2918
+ TrimIndicator,
1788
2919
  TurnCoordinator,
2920
+ VACUUM_SCALE,
2921
+ VacuumAmmeterGauge,
1789
2922
  VerticalSpeed,
1790
2923
  VorIndicator,
1791
2924
  WindIndicator,
2925
+ drumPositions,
1792
2926
  formatAdf,
1793
2927
  formatDme,
1794
2928
  formatNav,
2929
+ formatTimer,
1795
2930
  formatValue,
1796
2931
  parseAdf,
1797
2932
  parseNav,