@esrf/daiquiri-lib 0.1.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js DELETED
@@ -1,1567 +0,0 @@
1
- import { jsxs as s, jsx as n, Fragment as v } from "react/jsx-runtime";
2
- import { map as C, each as fe } from "lodash";
3
- import { Badge as D, ButtonGroup as re, Button as y, OverlayTrigger as V, Popover as b, Container as _, Row as q, Col as k, Form as N, InputGroup as x, Alert as E, Tab as me, Tabs as X } from "react-bootstrap";
4
- import { forwardRef as pe, useRef as $, useState as A, useEffect as H, Component as ie, Fragment as we, Children as ge, isValidElement as ye, cloneElement as ve, Suspense as ee, useMemo as be } from "react";
5
- import L from "classnames";
6
- import Ne from "debug";
7
- function Ce(e) {
8
- const {
9
- activeMessage: t = "Online",
10
- inactiveMessage: r = "Offline",
11
- message: i = "This device is"
12
- } = e;
13
- return /* @__PURE__ */ n(
14
- "div",
15
- {
16
- className: `dot-indicator small bg-${e.online ? "success" : "danger"}`,
17
- title: `${i} ${e.online ? t : r}`
18
- }
19
- );
20
- }
21
- function I(e) {
22
- const { name: t, icon: r } = e;
23
- return /* @__PURE__ */ s("div", { className: "icon", title: t, children: [
24
- /* @__PURE__ */ n("i", { className: `fa ${r}` }),
25
- /* @__PURE__ */ n(Ce, { ...e })
26
- ] });
27
- }
28
- function Oe(e) {
29
- const t = {
30
- 24: "Y",
31
- 21: "Z",
32
- 18: "E",
33
- 15: "P",
34
- 12: "T",
35
- 9: "G",
36
- 6: "M",
37
- 3: "k",
38
- "-3": "m",
39
- "-6": "µ",
40
- "-9": "n",
41
- "-12": "p",
42
- "-15": "f",
43
- "-18": "a",
44
- "-21": "z",
45
- "-24": "y"
46
- }, r = Math.log(e) / Math.log(1e3), i = !Number.isInteger(r), a = 3 * Math.ceil(r - (i ? 1 : 0)), o = a === 0 ? "" : t[a];
47
- return {
48
- scalar: e * 10 ** -a,
49
- prefix: o,
50
- multiplier: 10 ** -a
51
- };
52
- }
53
- function Se(e) {
54
- return e.charAt(0).toUpperCase() + e.slice(1);
55
- }
56
- function ae(e) {
57
- if (e < 60)
58
- return `${Math.round(e)} sec`;
59
- const t = Math.round(e / 60), r = t % 60, i = Math.floor(t / 60);
60
- return i ? `${i} hr ${r} min` : `${r} min`;
61
- }
62
- function Ee(e) {
63
- return e > 0 ? (662607004e-42 * 299792458 / (e * 1e-10) / 160218e-24 * 1e-3).toFixed(4) : 0;
64
- }
65
- function xe(e, t) {
66
- return Number.parseFloat(e.toFixed(t));
67
- }
68
- const St = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
69
- __proto__: null,
70
- formatEng: Oe,
71
- round: xe,
72
- toEnergy: Ee,
73
- toHoursMins: ae,
74
- ucfirst: Se
75
- }, Symbol.toStringTag, { value: "Module" }));
76
- function Me(e) {
77
- const { hardware: t } = e;
78
- function r(d) {
79
- t.requestChange({
80
- function: "reset"
81
- });
82
- }
83
- const i = {
84
- "Front End": "feitlk",
85
- Experimental: "expitlk",
86
- PSS: "pssitlk"
87
- }, a = {
88
- Current: `${t.properties.current.toFixed(1)} mA`,
89
- Mode: t.properties.mode,
90
- Refill: ae(t.properties.refill),
91
- Message: /* @__PURE__ */ n("pre", { children: t.properties.message })
92
- };
93
- function o(d) {
94
- if (!(d in t.properties))
95
- return "UNKNOWN";
96
- const l = t.properties[d];
97
- return !l || typeof l != "string" ? "UNKNOWN" : l;
98
- }
99
- return /* @__PURE__ */ n(
100
- V,
101
- {
102
- trigger: "click",
103
- rootClose: !0,
104
- overlay: /* @__PURE__ */ s(b, { id: "popid", children: [
105
- /* @__PURE__ */ s(b.Header, { children: [
106
- t.name,
107
- " Details"
108
- ] }),
109
- /* @__PURE__ */ s(b.Body, { children: [
110
- /* @__PURE__ */ n("h6", { children: "Status" }),
111
- /* @__PURE__ */ n("pre", { children: t.properties.status }),
112
- /* @__PURE__ */ n("h6", { children: "Interlocks" }),
113
- /* @__PURE__ */ n(_, { children: C(i, (d, l) => /* @__PURE__ */ s(q, { children: [
114
- /* @__PURE__ */ s(k, { children: [
115
- l,
116
- ":"
117
- ] }),
118
- /* @__PURE__ */ n(k, { children: /* @__PURE__ */ n(
119
- D,
120
- {
121
- bg: o(d) === "ON" ? "success" : "danger",
122
- children: o(d)
123
- }
124
- ) })
125
- ] }, l)) }),
126
- /* @__PURE__ */ n("h6", { children: "Ring Status" }),
127
- /* @__PURE__ */ n(_, { children: C(a, (d, l) => /* @__PURE__ */ s(q, { children: [
128
- /* @__PURE__ */ s(k, { children: [
129
- l,
130
- ":"
131
- ] }),
132
- /* @__PURE__ */ n(k, { children: d })
133
- ] }, l)) }),
134
- /* @__PURE__ */ n("div", { className: "d-grid gap-2", children: /* @__PURE__ */ n(y, { disabled: e.disabled, onClick: r, children: "Reset" }) })
135
- ] })
136
- ] }),
137
- children: /* @__PURE__ */ n(y, { className: "flex-grow-0", title: "Shutter Details", children: /* @__PURE__ */ n("i", { className: "fa fa-ellipsis-h" }) })
138
- }
139
- );
140
- }
141
- function Et(e) {
142
- const { hardware: t, options: r = {} } = e;
143
- function i(a) {
144
- t.requestChange({
145
- function: t.properties.frontend === "FE open" ? "close" : "open"
146
- });
147
- }
148
- return /* @__PURE__ */ s("div", { className: "hw-component", children: [
149
- /* @__PURE__ */ s("div", { className: "hw-head", children: [
150
- /* @__PURE__ */ n(
151
- I,
152
- {
153
- name: "Frontend",
154
- icon: "fam-hardware-frontend",
155
- online: t.online
156
- }
157
- ),
158
- /* @__PURE__ */ n("div", { className: "name", children: t.name }),
159
- /* @__PURE__ */ n(
160
- D,
161
- {
162
- bg: t.properties.state === "OPEN" || t.properties.state === "RUNNING" ? "success" : "danger",
163
- children: t.properties.state
164
- }
165
- )
166
- ] }),
167
- /* @__PURE__ */ n("div", { className: "hw-content", children: /* @__PURE__ */ s(re, { className: "d-flex", children: [
168
- /* @__PURE__ */ n(
169
- y,
170
- {
171
- variant: t.properties.frontend === "FE open" ? "danger" : "success",
172
- onClick: i,
173
- disabled: e.disabled,
174
- children: t.properties.frontend === "FE open" ? "Close" : "Open"
175
- }
176
- ),
177
- /* @__PURE__ */ n(Me, { ...e })
178
- ] }) })
179
- ] });
180
- }
181
- function xt(e) {
182
- const { hardware: t, options: r = {} } = e;
183
- function i() {
184
- const a = r.property;
185
- if (a === void 0)
186
- return "property is not set";
187
- if (a === null)
188
- return "property is null";
189
- let o = t;
190
- for (const d of a.split("/"))
191
- if (o = o[d], o === void 0)
192
- return `property '${a}' not found`;
193
- return `${o}`;
194
- }
195
- return /* @__PURE__ */ n(v, { children: i() });
196
- }
197
- function Y(e) {
198
- const { headerMode: t, hardware: r } = e;
199
- function i() {
200
- return r.alias ? r.alias : r.name ? r.name : r.id;
201
- }
202
- const a = i();
203
- switch (t) {
204
- case "front":
205
- return /* @__PURE__ */ n("div", { className: "hw-component", children: /* @__PURE__ */ s("div", { className: "hw-single", children: [
206
- e.widgetIcon,
207
- /* @__PURE__ */ n("div", { className: "name", children: a }),
208
- /* @__PURE__ */ n("div", { className: "d-inline-block", children: e.widgetContent })
209
- ] }) });
210
- case "none":
211
- return /* @__PURE__ */ n("div", { className: "hw-component", children: /* @__PURE__ */ n("div", { className: "hw-single", children: e.widgetContent }) });
212
- case "state":
213
- return e.widgetState;
214
- default:
215
- return /* @__PURE__ */ s("div", { className: "hw-component", children: [
216
- /* @__PURE__ */ s("div", { className: "hw-head", children: [
217
- e.widgetIcon,
218
- /* @__PURE__ */ n("div", { className: "name", children: /* @__PURE__ */ n(N.Label, { htmlFor: r.id, children: a }) }),
219
- e.widgetState,
220
- e.hardware.errors && e.hardware.errors.length > 0 && /* @__PURE__ */ n(
221
- V,
222
- {
223
- trigger: "click",
224
- placement: "bottom",
225
- rootClose: !0,
226
- overlay: /* @__PURE__ */ s(b, { id: e.hardware.id, style: { maxWidth: 500 }, children: [
227
- /* @__PURE__ */ n(b.Header, { children: "Device Errors" }),
228
- /* @__PURE__ */ s(b.Body, { children: [
229
- "There were errors with properties on this device:",
230
- /* @__PURE__ */ n("ul", { children: e.hardware.errors.map((o) => /* @__PURE__ */ s("li", { children: [
231
- o.property,
232
- ":",
233
- /* @__PURE__ */ s("span", { className: "stack-trace", children: [
234
- o.traceback,
235
- /* @__PURE__ */ n("br", {}),
236
- o.exception
237
- ] })
238
- ] })) })
239
- ] })
240
- ] }),
241
- children: /* @__PURE__ */ n(y, { variant: "danger", size: "sm", children: /* @__PURE__ */ n("i", { className: "fa fa-exclamation-triangle" }) })
242
- }
243
- )
244
- ] }),
245
- /* @__PURE__ */ n("div", { className: "hw-content", children: e.widgetContent })
246
- ] });
247
- }
248
- }
249
- function W(e) {
250
- const t = {
251
- display: "inline-block",
252
- minWidth: ""
253
- };
254
- return e.minWidth && (t.minWidth = `${e.minWidth}em`), /* @__PURE__ */ n("div", { style: t, children: /* @__PURE__ */ n(D, { bg: e.variant, children: e.state }) });
255
- }
256
- function oe(e) {
257
- const { hardware: t } = e;
258
- function r() {
259
- if (!t.online)
260
- return "OFFLINE";
261
- let a = "UNKNOWN";
262
- return e.hardware.properties.state && ([a] = e.hardware.properties.state), a;
263
- }
264
- const i = r();
265
- return /* @__PURE__ */ n(
266
- W,
267
- {
268
- state: i,
269
- minWidth: 6,
270
- variant: i === "READY" ? "success" : "warning"
271
- }
272
- );
273
- }
274
- function se(e) {
275
- const { hardware: t } = e;
276
- function r() {
277
- if (!t.online)
278
- return "OFFLINE";
279
- const o = t.properties.state;
280
- return e.useReadyState && (o === "OPEN" || o === "CLOSED") ? "READY" : o;
281
- }
282
- const i = r();
283
- function a() {
284
- switch (i) {
285
- case "READY":
286
- return "success";
287
- case "OPEN":
288
- return "success";
289
- case "CLOSED":
290
- return "danger";
291
- case "DISABLED":
292
- return "secondary";
293
- case "MOVING":
294
- case "STANDBY":
295
- case "OFFLINE":
296
- return "warning";
297
- case "FAULT":
298
- return "fatal";
299
- default:
300
- return "fatal";
301
- }
302
- }
303
- return /* @__PURE__ */ n(W, { state: i, minWidth: 6, variant: a() });
304
- }
305
- const Mt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
306
- __proto__: null,
307
- HardwareState: W,
308
- MotorState: oe,
309
- ShutterState: se
310
- }, Symbol.toStringTag, { value: "Module" })), Ae = pe((e, t) => {
311
- const r = $(null), [i, a] = A(e.step), o = (g) => {
312
- const z = t;
313
- if (r.current === null)
314
- return;
315
- let J = Number.parseFloat(z.current.value);
316
- const Q = Number.parseFloat(r.current.value);
317
- J += g ? Q : -Q, z.current.value = `${J}`, e.onStep && e.onStep({
318
- target: z.current
319
- });
320
- }, {
321
- onStep: d,
322
- step: l,
323
- overlay: h,
324
- incIcon: u,
325
- decIcon: c,
326
- swapIncDec: f,
327
- onKeyDown: m,
328
- horizontalArrows: M,
329
- largeArrows: K,
330
- ...S
331
- } = e, Z = (g) => {
332
- g.key === "ArrowUp" ? (g.preventDefault(), o(!0)) : g.key === "ArrowDown" ? (g.preventDefault(), o(!1)) : m && m(g);
333
- };
334
- if (!e.step)
335
- return /* @__PURE__ */ n(
336
- N.Control,
337
- {
338
- ref: t,
339
- type: "number",
340
- step: "any",
341
- onKeyDown: Z,
342
- ...S
343
- }
344
- );
345
- const he = C(e.steps || [e.step], (g) => /* @__PURE__ */ n("option", { value: g, children: g }, g));
346
- return /* @__PURE__ */ n(
347
- "div",
348
- {
349
- className: L("numeric-step", {
350
- "numeric-step-large": K,
351
- "numeric-step-horizontal": M
352
- }),
353
- children: /* @__PURE__ */ s(x, { children: [
354
- /* @__PURE__ */ n(
355
- N.Control,
356
- {
357
- onKeyDown: Z,
358
- ref: t,
359
- type: "number",
360
- step: "any",
361
- ...S
362
- }
363
- ),
364
- /* @__PURE__ */ s(v, { children: [
365
- h,
366
- !h && /* @__PURE__ */ s(x.Text, { className: "d-flex flex-column", children: [
367
- /* @__PURE__ */ n(
368
- N.Control,
369
- {
370
- ref: r,
371
- as: "select",
372
- className: "step-size",
373
- defaultValue: i,
374
- onChange: (g) => a(Number.parseFloat(g.target.value)),
375
- children: he
376
- }
377
- ),
378
- e.unit && /* @__PURE__ */ n("div", { children: e.unit }),
379
- !u && !c && /* @__PURE__ */ s(v, { children: [
380
- /* @__PURE__ */ n(
381
- y,
382
- {
383
- className: "step step-up",
384
- disabled: e.disabled,
385
- onClick: (g) => o(!0)
386
- }
387
- ),
388
- /* @__PURE__ */ n(
389
- y,
390
- {
391
- className: "step step-down",
392
- disabled: e.disabled,
393
- onClick: (g) => o(!1)
394
- }
395
- )
396
- ] })
397
- ] }),
398
- c && f && /* @__PURE__ */ n(y, { disabled: e.disabled, onClick: (g) => o(!1), children: /* @__PURE__ */ n("i", { className: `fa fa-fw fa-${c}` }) }),
399
- u && /* @__PURE__ */ n(y, { disabled: e.disabled, onClick: (g) => o(!0), children: /* @__PURE__ */ n("i", { className: `fa fa-fw fa-${u}` }) }),
400
- c && !f && /* @__PURE__ */ n(y, { disabled: e.disabled, onClick: (g) => o(!1), children: /* @__PURE__ */ n("i", { className: `fa fa-fw fa-${c}` }) })
401
- ] })
402
- ] })
403
- }
404
- );
405
- }), Ie = Ae;
406
- function ke(e) {
407
- const t = $(null), [r, i] = A(!1), [a, o] = A(!1);
408
- H(() => {
409
- t.current && (e.hardwareValue === null ? t.current.value = "" : t.current.value = e.hardwareValue.toString(), i(!1));
410
- }, [e.hardwareValue]);
411
- function d(f) {
412
- let m = f;
413
- e.precision !== void 0 && (m = Number.parseFloat(m).toFixed(e.precision)), t != null && t.current && (t.current.value = m);
414
- }
415
- function l() {
416
- r && setTimeout(() => {
417
- d(e.hardwareValue), i(!1);
418
- }, 3e3);
419
- }
420
- function h(f) {
421
- e.hardwareValue !== null && (i(!0), t != null && t.current && (t.current.value = f.target.value), f.target.value === e.hardwareValue.toString() && i(!1));
422
- }
423
- function u(f) {
424
- i(!1), e.onMoveRequested(f.target.value);
425
- }
426
- function c(f) {
427
- switch (f.key) {
428
- case "Enter":
429
- {
430
- i(!1);
431
- const m = Number.parseFloat(f.target.value), M = e.onMoveRequested(m);
432
- M && M.catch(() => {
433
- o(!0), setTimeout(() => {
434
- d(e.hardwareValue), o(!1);
435
- }, 2e3);
436
- });
437
- }
438
- f.preventDefault(), f.stopPropagation();
439
- break;
440
- case "Esc":
441
- case "Escape":
442
- r && (o(!1), i(!1), d(e.hardwareValue)), f.target.blur(), f.preventDefault(), f.stopPropagation();
443
- break;
444
- }
445
- }
446
- return /* @__PURE__ */ n(
447
- Ie,
448
- {
449
- id: e.id,
450
- className: L({
451
- "form-control-edited": r,
452
- "form-control-error": a,
453
- "hw-moving": e.hardwareIsMoving
454
- }),
455
- type: e.readOnly ? "text" : "number",
456
- ref: t,
457
- precision: e.precision,
458
- onChange: h,
459
- onBlur: l,
460
- onStep: u,
461
- onKeyDown: c,
462
- disabled: e.hardwareIsDisabled || e.readOnly || !e.hardwareIsReady,
463
- step: e.step,
464
- steps: e.steps,
465
- incIcon: e.incIcon,
466
- decIcon: e.decIcon,
467
- swapIncDec: e.swapIncDec,
468
- horizontalArrows: e.horizontalArrows,
469
- largeArrows: e.largeArrows,
470
- overlay: e.hardwareIsMoving && !e.hardwareIsDisabled ? /* @__PURE__ */ n(y, { variant: "danger", onClick: e.onAbortRequested, children: /* @__PURE__ */ n("i", { className: "fa fa-times" }) }) : null
471
- }
472
- );
473
- }
474
- function te(e) {
475
- const t = $(null), [r, i] = A(!1), [a, o] = A(!1);
476
- function d(c) {
477
- return e.precision !== void 0 ? Number.parseFloat(c).toFixed(e.precision) : c;
478
- }
479
- H(() => {
480
- var c;
481
- t.current && (t.current.value = d((c = e.hardwareValue) == null ? void 0 : c.toString()), i(!1));
482
- }, [e.hardwareValue, e.precision]);
483
- function l(c) {
484
- const f = d(c);
485
- t != null && t.current && (t.current.value = f);
486
- }
487
- function h(c) {
488
- switch (c.key) {
489
- case "Enter": {
490
- i(!1);
491
- const f = Number.parseFloat(c.target.value), m = e.onMoveRequested(f);
492
- m && m.catch(() => {
493
- o(!0), setTimeout(() => {
494
- l(e.hardwareValue), o(!1);
495
- }, 2e3);
496
- }), c.preventDefault(), c.stopPropagation();
497
- break;
498
- }
499
- case "Esc":
500
- case "Escape":
501
- r && (o(!1), i(!1), l(e.hardwareValue)), c.target.blur(), c.preventDefault(), c.stopPropagation();
502
- break;
503
- }
504
- }
505
- function u(c) {
506
- i(!0), c.target, t != null && t.current && (t.current.value = c.target.value), c.target.value === e.hardwareValue.toString() && i(!1);
507
- }
508
- return /* @__PURE__ */ n(
509
- N.Control,
510
- {
511
- className: L({
512
- "form-control-edited": r,
513
- "form-control-error": a,
514
- "hw-moving": e.hardwareIsMoving
515
- }),
516
- type: "number",
517
- ref: t,
518
- onChange: u,
519
- onKeyDown: h,
520
- disabled: e.readOnly || e.hardwareIsMoving || e.hardwareIsDisabled,
521
- step: e.step
522
- }
523
- );
524
- }
525
- function De(e) {
526
- function t(a) {
527
- return e.hardware.requestChange({
528
- property: "velocity",
529
- value: a
530
- });
531
- }
532
- function r(a) {
533
- return e.hardware.requestChange({
534
- property: "acceleration",
535
- value: a
536
- });
537
- }
538
- let i = "UNKNOWN";
539
- return e.hardware.properties.state && ([i] = e.hardware.properties.state), /* @__PURE__ */ n(
540
- V,
541
- {
542
- trigger: "click",
543
- rootClose: !0,
544
- overlay: /* @__PURE__ */ s(b, { id: "popid", children: [
545
- /* @__PURE__ */ s(b.Header, { children: [
546
- e.hardware.name,
547
- " details"
548
- ] }),
549
- /* @__PURE__ */ s(b.Body, { children: [
550
- /* @__PURE__ */ s(N.Group, { children: [
551
- /* @__PURE__ */ n(N.Label, { children: "Velocity" }),
552
- /* @__PURE__ */ n(
553
- te,
554
- {
555
- hardwareValue: e.hardware.properties.velocity,
556
- onMoveRequested: t,
557
- hardwareIsDisabled: e.disabled,
558
- hardwareIsReady: i === "READY",
559
- hardwareIsMoving: i === "MOVING",
560
- readOnly: e.readOnly
561
- }
562
- )
563
- ] }),
564
- /* @__PURE__ */ s(N.Group, { children: [
565
- /* @__PURE__ */ n(N.Label, { children: "Acceleration" }),
566
- /* @__PURE__ */ n(
567
- te,
568
- {
569
- hardwareValue: e.hardware.properties.acceleration,
570
- onMoveRequested: r,
571
- hardwareIsDisabled: e.disabled,
572
- hardwareIsReady: i === "READY",
573
- hardwareIsMoving: i === "MOVING",
574
- readOnly: e.readOnly
575
- }
576
- )
577
- ] })
578
- ] })
579
- ] }),
580
- children: /* @__PURE__ */ n(y, { children: /* @__PURE__ */ n("i", { className: "fa fa-ellipsis-h" }) })
581
- }
582
- );
583
- }
584
- function At(e) {
585
- const { hardware: t, options: r = {} } = e;
586
- function i() {
587
- t.requestChange({
588
- function: "stop"
589
- });
590
- }
591
- function a(u) {
592
- return t.requestChange({
593
- property: "position",
594
- value: u,
595
- function: "move"
596
- });
597
- }
598
- let o = "UNKNOWN";
599
- e.hardware.properties.state && ([o] = e.hardware.properties.state);
600
- const d = /* @__PURE__ */ n(I, { name: "Motor", icon: "fam-hardware-motor", online: t.online }), l = /* @__PURE__ */ n(oe, { hardware: t }), h = e.options ? e.options.header : "top";
601
- return /* @__PURE__ */ n(
602
- Y,
603
- {
604
- hardware: t,
605
- widgetIcon: d,
606
- widgetState: l,
607
- widgetContent: /* @__PURE__ */ s(x, { children: [
608
- /* @__PURE__ */ n(
609
- ke,
610
- {
611
- id: t.id,
612
- hardwareValue: t.properties.position,
613
- hardwareIsDisabled: e.disabled,
614
- hardwareIsReady: o === "READY",
615
- hardwareIsMoving: o === "MOVING",
616
- onMoveRequested: a,
617
- onAbortRequested: i,
618
- precision: r.precision,
619
- readOnly: r.readOnly,
620
- step: r.step,
621
- steps: r.steps,
622
- incIcon: r.incicon,
623
- decIcon: r.decicon,
624
- swapIncDec: r.swapincdec,
625
- horizontalArrows: r.horizontalarrows,
626
- largeArrows: r.largearrows
627
- }
628
- ),
629
- t.properties.unit && /* @__PURE__ */ n(x.Text, { children: t.properties.unit }),
630
- o !== "MOVING" && r.extended && /* @__PURE__ */ n(
631
- De,
632
- {
633
- hardware: t,
634
- disabled: e.disabled,
635
- readOnly: r.readOnly
636
- }
637
- ),
638
- o === "MOVING" && !e.disabled && !r.step && /* @__PURE__ */ n(y, { variant: "danger", onClick: i, children: /* @__PURE__ */ n("i", { className: "fa fa-times" }) })
639
- ] }),
640
- headerMode: h
641
- }
642
- );
643
- }
644
- function It(e) {
645
- const { hardware: t, options: r = {} } = e, i = $(null);
646
- H(() => {
647
- if (!i.current) {
648
- console.error("selectionRef ref is unset");
649
- return;
650
- }
651
- i.current.value = t.properties.position;
652
- }, [t.properties.position]);
653
- function a(l) {
654
- if (console.debug("change", l), !i || !i.current) {
655
- console.error("selection ref is unset");
656
- return;
657
- }
658
- t.requestChange({
659
- value: i.current.value,
660
- function: "move"
661
- });
662
- }
663
- function o(l) {
664
- t.requestChange({
665
- function: "stop"
666
- });
667
- }
668
- const d = C(t.properties.positions, (l) => /* @__PURE__ */ n("option", { title: l.description, children: l.position }, l.position));
669
- return /* @__PURE__ */ s("div", { className: "hw-component", children: [
670
- /* @__PURE__ */ s("div", { className: "hw-head", children: [
671
- /* @__PURE__ */ n(
672
- I,
673
- {
674
- name: "Multiposition",
675
- icon: "fam-hardware-multiposition",
676
- online: t.online
677
- }
678
- ),
679
- /* @__PURE__ */ n("div", { className: "name", children: t.name }),
680
- /* @__PURE__ */ n(
681
- D,
682
- {
683
- bg: t.properties.state === "READY" ? "success" : "warning",
684
- children: t.properties.state
685
- }
686
- )
687
- ] }),
688
- /* @__PURE__ */ n("div", { className: "hw-content", children: /* @__PURE__ */ s(x, { children: [
689
- /* @__PURE__ */ s(
690
- N.Control,
691
- {
692
- className: "custom-select",
693
- as: "select",
694
- ref: i,
695
- disabled: e.disabled,
696
- defaultValue: t.properties.position,
697
- children: [
698
- /* @__PURE__ */ n("option", { disabled: !0, children: "unknown" }),
699
- d
700
- ]
701
- }
702
- ),
703
- t.properties.state !== "MOVING" && /* @__PURE__ */ n(y, { onClick: a, disabled: e.disabled, children: "Move" }),
704
- t.properties.state === "MOVING" && !e.disabled && /* @__PURE__ */ n(y, { variant: "danger", onClick: o, children: /* @__PURE__ */ n("i", { className: "fa fa-times" }) })
705
- ] }) })
706
- ] });
707
- }
708
- const $e = Ne("daiquiri.components.hardware.NoObject");
709
- function kt(e) {
710
- if (e.options.emptyifnone)
711
- return $e(
712
- 'Component id:"%s" name:"%s" not displayed cause setup with emptyifnone.',
713
- e.id,
714
- e.name
715
- ), /* @__PURE__ */ n(v, {});
716
- const t = /* @__PURE__ */ n(I, { name: "NoObject", icon: "fam-hardware-any", online: !1 }), r = /* @__PURE__ */ n(v, {}), i = /* @__PURE__ */ n(v, { children: "Missing" }), a = e.options ? e.options.header : "top", o = {
717
- id: e.id,
718
- name: e.name ?? "",
719
- alias: null,
720
- online: !1,
721
- properties: {},
722
- type: ""
723
- };
724
- return /* @__PURE__ */ n(
725
- Y,
726
- {
727
- hardware: o,
728
- widgetIcon: t,
729
- widgetState: r,
730
- widgetContent: i,
731
- headerMode: a
732
- }
733
- );
734
- }
735
- function Fe(e) {
736
- const t = e.online ? "READY" : "OFFLINE";
737
- return /* @__PURE__ */ n(D, { bg: t === "READY" ? "success" : "warning", children: t });
738
- }
739
- function Dt(e) {
740
- const { hardware: t, options: r = {} } = e, i = /* @__PURE__ */ n(I, { name: "Optic", icon: "fa-cog", online: t.online }), a = /* @__PURE__ */ n(Fe, { ...t });
741
- function o() {
742
- const c = r.property;
743
- if (c === void 0)
744
- return "property is not set";
745
- if (c === null)
746
- return "property is null";
747
- let f = t;
748
- for (const m of c.split("/"))
749
- if (f = f[m], f === void 0)
750
- return `property '${c}' not found`;
751
- return `${f}`;
752
- }
753
- function d() {
754
- const c = r.unit;
755
- if (!c)
756
- return null;
757
- if (!c.includes("properties"))
758
- return c;
759
- let f = e;
760
- for (const m of c.split("/"))
761
- if (f = f[m], f === void 0)
762
- return null;
763
- return `${f}`;
764
- }
765
- const l = d(), h = /* @__PURE__ */ s(x, { children: [
766
- /* @__PURE__ */ n(N.Control, { value: o(), readOnly: !0 }),
767
- l && /* @__PURE__ */ n(x.Text, { children: l })
768
- ] }), u = e.options.header || "top";
769
- return /* @__PURE__ */ n(
770
- Y,
771
- {
772
- hardware: t,
773
- widgetIcon: i,
774
- widgetState: a,
775
- widgetContent: h,
776
- headerMode: u
777
- }
778
- );
779
- }
780
- function Re(e) {
781
- const { hardware: t } = e, r = () => {
782
- t.requestChange({
783
- function: "reset"
784
- });
785
- };
786
- return /* @__PURE__ */ n(
787
- V,
788
- {
789
- trigger: "click",
790
- rootClose: !0,
791
- overlay: /* @__PURE__ */ s(b, { id: "popid", children: [
792
- /* @__PURE__ */ s(b.Header, { children: [
793
- t.name,
794
- " Details"
795
- ] }),
796
- /* @__PURE__ */ s(b.Body, { children: [
797
- /* @__PURE__ */ n("h6", { children: "Status" }),
798
- /* @__PURE__ */ n("pre", { children: t.properties.status }),
799
- /* @__PURE__ */ n("div", { className: "d-grid gap-2", children: /* @__PURE__ */ n(y, { onClick: r, disabled: e.disabled, children: "Reset" }) })
800
- ] })
801
- ] }),
802
- children: /* @__PURE__ */ n(y, { className: "flex-grow-0", title: "Shutter Details", children: /* @__PURE__ */ n("i", { className: "fa fa-ellipsis-h" }) })
803
- }
804
- );
805
- }
806
- function $t(e) {
807
- const { hardware: t, options: r = {} } = e, i = /* @__PURE__ */ n(
808
- I,
809
- {
810
- name: "Shutter",
811
- icon: "fam-hardware-shutter",
812
- online: t.online
813
- }
814
- ), a = /* @__PURE__ */ n(se, { hardware: t });
815
- function o() {
816
- return t.properties ? t.properties.state : "UNKNOWN";
817
- }
818
- function d(S) {
819
- return S === "OPEN" ? ["Close", "close"] : S === "CLOSED" ? ["Open", "open"] : S === "DISABLED" || S === "STANDBY" || S === "FAULT" ? ["Closed", ""] : S === "MOVING" ? ["...", ""] : ["Unknown", ""];
820
- }
821
- const l = o(), [h, u] = d(l), f = {
822
- OPEN: "danger",
823
- CLOSED: "success",
824
- MOVING: "warning",
825
- DISABLED: "secondary",
826
- STANDBY: "danger",
827
- FAULT: "fatal",
828
- UNKNOWN: "warning"
829
- }[l] || "danger";
830
- function m() {
831
- t.requestChange({
832
- function: u
833
- });
834
- }
835
- const M = /* @__PURE__ */ s(re, { className: "d-flex flex-nowrap", children: [
836
- /* @__PURE__ */ n(
837
- y,
838
- {
839
- variant: f,
840
- onClick: m,
841
- disabled: e.disabled || u === "",
842
- children: h
843
- }
844
- ),
845
- r.extended && /* @__PURE__ */ n(Re, { ...e })
846
- ] }), K = e.options.header || "top";
847
- return /* @__PURE__ */ n(
848
- Y,
849
- {
850
- hardware: t,
851
- widgetIcon: i,
852
- widgetState: a,
853
- widgetContent: M,
854
- headerMode: K
855
- }
856
- );
857
- }
858
- class Ft extends ie {
859
- constructor() {
860
- super(...arguments), this.variants = {};
861
- }
862
- render() {
863
- let t = this.variants.default;
864
- return this.props.options.variant in this.variants && (t = this.variants[this.props.options.variant]), /* @__PURE__ */ n(t, { ...this.props });
865
- }
866
- }
867
- function _e(e) {
868
- const [t, r] = A({}), i = $(null);
869
- return H(() => {
870
- if (i.current) {
871
- const a = i.current;
872
- r({
873
- width: a.clientWidth,
874
- height: a.clientHeight
875
- });
876
- }
877
- }, []), /* @__PURE__ */ n(
878
- "div",
879
- {
880
- ref: i,
881
- style: { width: "100%", height: "100%" },
882
- className: e.className,
883
- children: t.width > 0 && /* @__PURE__ */ n(
884
- "div",
885
- {
886
- className: "full-sizer",
887
- style: {
888
- width: `${t.width}px`,
889
- height: `${t.height}px`,
890
- overflow: "scroll"
891
- },
892
- children: e.children
893
- }
894
- )
895
- }
896
- );
897
- }
898
- const Rt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
899
- __proto__: null
900
- }, Symbol.toStringTag, { value: "Module" })), _t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
901
- __proto__: null
902
- }, Symbol.toStringTag, { value: "Module" }));
903
- function Te(e) {
904
- return /* @__PURE__ */ n("div", { className: "panel-header", style: e.style, children: e.children });
905
- }
906
- function Pe(e) {
907
- return /* @__PURE__ */ n("div", { className: "panel-contents", style: e.style, children: e.children });
908
- }
909
- function p(e) {
910
- const t = e.scroll ? _e : we;
911
- return /* @__PURE__ */ n("div", { className: `panel ${e.className ?? ""}`, style: e.style, children: /* @__PURE__ */ n(t, { children: e.children }) });
912
- }
913
- p.Header = Te;
914
- p.Contents = Pe;
915
- const R = {};
916
- function Ve(e, t) {
917
- R[e] = t;
918
- }
919
- function O(e, t, r = !0) {
920
- if (!e)
921
- return /* @__PURE__ */ n(v, {});
922
- const { type: i } = e, a = i && i in R ? R[i] : R.component;
923
- return /* @__PURE__ */ n(a, { yamlNode: e, panel: r }, t);
924
- }
925
- function He({
926
- children: e,
927
- key: t,
928
- panel: r,
929
- options: i
930
- }) {
931
- return r ? /* @__PURE__ */ n(p, { style: i.style, scroll: i.scroll, children: /* @__PURE__ */ n(p.Contents, { children: e }) }, t) : /* @__PURE__ */ n(v, { children: ge.map(
932
- e,
933
- (a) => ye(a) ? ve(a, { key: t, ...a.props }) : void 0
934
- ) });
935
- }
936
- function le(e, t) {
937
- const { _parentNode: r, _indexFromParent: i, ...a } = t;
938
- if (e && Object.keys(a).length > 0)
939
- throw new T(e, Object.keys(a));
940
- }
941
- class F extends Error {
942
- constructor(t, r) {
943
- super(t), this.yamlNode = r;
944
- }
945
- }
946
- class T extends F {
947
- constructor(t, r) {
948
- super(`Unexpected keys: ${r.join(", ")}`, t), this.keys = r;
949
- }
950
- }
951
- class P extends F {
952
- constructor(t, r) {
953
- super(`Keys ${r.join(", ")} are missing`, t), this.keys = r;
954
- }
955
- }
956
- class w extends F {
957
- constructor(t, r, i) {
958
- super(`Key ${r} error: ${i}`, t), this.key = r, this.keyMessage = i;
959
- }
960
- }
961
- function Le(e) {
962
- let t = e;
963
- for (; t._parentNode; )
964
- t = t._parentNode;
965
- return t;
966
- }
967
- function Ye(e) {
968
- const t = [];
969
- let r = e;
970
- for (; r; )
971
- t.push({
972
- node: r,
973
- indexFromParent: r._indexFromParent
974
- }), r = r._parentNode;
975
- return t.reverse(), t;
976
- }
977
- function ce(e, t = null, r = null) {
978
- if (e._parentNode)
979
- throw new Error(
980
- "Attribute _parentNode was already defined by the yml layout."
981
- );
982
- const i = {
983
- ...e,
984
- _parentNode: t,
985
- _indexFromParent: r
986
- };
987
- if (e.children) {
988
- const a = [...e.children];
989
- Object.freeze(a), i.children = a.map((o, d) => ce(o, i, d));
990
- }
991
- return Object.freeze(i), i;
992
- }
993
- function je(e) {
994
- return /* @__PURE__ */ n(E, { variant: "danger", children: e.message });
995
- }
996
- function Ke(e) {
997
- const { error: t } = e;
998
- if (!(t instanceof F))
999
- return /* @__PURE__ */ n(v, {});
1000
- function r(o, d = 3) {
1001
- const l = Ye(o.yamlNode), h = [];
1002
- let u = "";
1003
- for (let c = 1; c < l.length; c++) {
1004
- const { node: f, indexFromParent: m } = l[c];
1005
- h.push(`${u}children:`), u += " ".repeat(d), m === 1 ? h.push(`${u}- type: ...`) : (m ?? 0 > 1) && h.push(
1006
- `${u}...`,
1007
- `${u}...`,
1008
- `${u}# children number ${m ?? 0 + 1}`
1009
- ), h.push(`${u}- type: ${f.type}`), u += " ".repeat(2);
1010
- }
1011
- return o instanceof T ? o.keys.forEach((c) => {
1012
- h.push(
1013
- `${u}${c}: ... ${" ".repeat(
1014
- 50 - u.length - c.length
1015
- )}<-- unexpected key`
1016
- );
1017
- }) : o instanceof P ? o.keys.forEach((c) => {
1018
- h.push(
1019
- `${u}???: ${" ".repeat(
1020
- 50 - u.length - c.length
1021
- )}<-- key **${c}** is expected`
1022
- );
1023
- }) : o instanceof w && h.push(
1024
- `${u}${o.key}: ${" ".repeat(
1025
- 50 - u.length - o.key.length
1026
- )}<-- ${o.keyMessage}`
1027
- ), h.join(`
1028
- `);
1029
- }
1030
- const a = Le(t.yamlNode).name;
1031
- if (t instanceof T) {
1032
- const o = t.keys.length === 1 ? "key" : "keys";
1033
- return /* @__PURE__ */ s(E, { variant: "danger", children: [
1034
- "Unexpected ",
1035
- o,
1036
- " ",
1037
- t.keys.map((d, l) => /* @__PURE__ */ s(v, { children: [
1038
- l !== 0 && ", ",
1039
- /* @__PURE__ */ n("b", { children: d })
1040
- ] })),
1041
- " ",
1042
- "from the layout name ",
1043
- /* @__PURE__ */ n("b", { children: a }),
1044
- ".",
1045
- /* @__PURE__ */ n("br", {}),
1046
- /* @__PURE__ */ n("pre", { className: "mt-3", children: r(t) }),
1047
- /* @__PURE__ */ n("br", {})
1048
- ] });
1049
- }
1050
- if (t instanceof P) {
1051
- const o = t.keys.length === 1 ? "Key" : "Keys";
1052
- return /* @__PURE__ */ s(E, { variant: "danger", children: [
1053
- "Expected ",
1054
- o,
1055
- " ",
1056
- t.keys.map((d, l) => /* @__PURE__ */ s(v, { children: [
1057
- l !== 0 && ", ",
1058
- /* @__PURE__ */ n("b", { children: d })
1059
- ] })),
1060
- " ",
1061
- "from the layout name ",
1062
- /* @__PURE__ */ n("b", { children: a }),
1063
- ".",
1064
- /* @__PURE__ */ n("br", {}),
1065
- /* @__PURE__ */ n("pre", { className: "mt-3", children: r(t) }),
1066
- /* @__PURE__ */ n("br", {})
1067
- ] });
1068
- }
1069
- return t instanceof w ? /* @__PURE__ */ s(E, { variant: "danger", children: [
1070
- "Error on key ",
1071
- /* @__PURE__ */ n("b", { children: t.key }),
1072
- " from the layout name ",
1073
- /* @__PURE__ */ n("b", { children: a }),
1074
- ".",
1075
- /* @__PURE__ */ n("br", {}),
1076
- /* @__PURE__ */ n("pre", { className: "mt-3", children: r(t) }),
1077
- /* @__PURE__ */ n("br", {})
1078
- ] }) : /* @__PURE__ */ n(je, { ...e });
1079
- }
1080
- const ne = {
1081
- hasError: !1,
1082
- message: "",
1083
- error: void 0
1084
- };
1085
- class ze extends ie {
1086
- constructor(t) {
1087
- super(t), this.reload = () => {
1088
- window.location.reload();
1089
- }, this.state = ne;
1090
- }
1091
- static getDerivedStateFromError() {
1092
- return { hasError: !0 };
1093
- }
1094
- componentDidCatch(t) {
1095
- t instanceof F && this.setState({
1096
- hasError: !0,
1097
- message: t.message,
1098
- error: t
1099
- });
1100
- }
1101
- // https://github.com/bvaughn/react-error-boundary/blob/23a4d779744f3079dfe0960acaa4bdfd5dede87b/src/ErrorBoundary.ts#L53
1102
- componentDidUpdate(t, r) {
1103
- this.state.hasError && r.error !== void 0 && t.resetKey !== this.props.resetKey && this.setState(ne);
1104
- }
1105
- render() {
1106
- return this.state.hasError ? /* @__PURE__ */ s(_, { className: "mt-2", children: [
1107
- /* @__PURE__ */ n("h4", { children: "Something went wrong" }),
1108
- /* @__PURE__ */ n(
1109
- Ke,
1110
- {
1111
- message: this.state.message,
1112
- error: this.state.error
1113
- }
1114
- ),
1115
- /* @__PURE__ */ s("p", { children: [
1116
- "This error has been logged. Please",
1117
- " ",
1118
- /* @__PURE__ */ s(y, { size: "sm", onClick: this.reload, children: [
1119
- /* @__PURE__ */ n("i", { className: "fa fa-refresh" }),
1120
- " Reload"
1121
- ] }),
1122
- " ",
1123
- "the application"
1124
- ] })
1125
- ] }) : this.props.children;
1126
- }
1127
- }
1128
- function qe(e, t, r) {
1129
- if (e && r === void 0)
1130
- throw new P(e, [t]);
1131
- }
1132
- function Ge(e, t, r) {
1133
- if (typeof r != "string")
1134
- throw new w(e, t, "A string is expected");
1135
- }
1136
- function Ue(e, t, r) {
1137
- if (typeof r != "boolean")
1138
- throw new w(e, t, "A boolean is expected");
1139
- }
1140
- function Be(e, t, r) {
1141
- if (typeof r != "number")
1142
- throw new w(e, t, "A number is expected");
1143
- }
1144
- function G(e, t, r) {
1145
- if (r !== void 0 && typeof r != "boolean")
1146
- throw new w(e, t, "An optional boolean is expected");
1147
- }
1148
- function de(e, t, r) {
1149
- if (r !== void 0 && typeof r != "string")
1150
- throw new w(e, t, "An optional string is expected");
1151
- }
1152
- function We(e, t, r) {
1153
- if (!Array.isArray(r))
1154
- throw new w(e, t, "A list of string is expected");
1155
- r.forEach((i) => {
1156
- if (typeof i != "string")
1157
- throw new w(e, t, "A list of string is expected");
1158
- });
1159
- }
1160
- function Ze(e, t, r) {
1161
- if (r !== void 0 && typeof r != "string") {
1162
- if (!Array.isArray(r))
1163
- throw new w(
1164
- e,
1165
- t,
1166
- "An optional string or list of string is expected"
1167
- );
1168
- r.forEach((i) => {
1169
- if (typeof i != "string")
1170
- throw new w(
1171
- e,
1172
- t,
1173
- "An optional string or list of string is expected"
1174
- );
1175
- });
1176
- }
1177
- }
1178
- function Je(e, t, r) {
1179
- if (r !== void 0) {
1180
- if (!Array.isArray(r))
1181
- throw new w(e, t, "An optional list of string is expected");
1182
- r.forEach((i) => {
1183
- if (typeof i != "string")
1184
- throw new w(
1185
- e,
1186
- t,
1187
- "A optional list of string is expected"
1188
- );
1189
- });
1190
- }
1191
- }
1192
- function ue(e, t, r) {
1193
- if (r !== void 0 && typeof r != "number")
1194
- throw new w(e, t, "An optional number is expected");
1195
- }
1196
- function Qe(e, t, r) {
1197
- if (r !== void 0) {
1198
- if (!Array.isArray(r))
1199
- throw new w(
1200
- e,
1201
- t,
1202
- "An optional list of numbers is expected"
1203
- );
1204
- r.forEach((i) => {
1205
- if (typeof i != "number")
1206
- throw new w(
1207
- e,
1208
- t,
1209
- "An optional list of numbers is expected"
1210
- );
1211
- });
1212
- }
1213
- }
1214
- function j(e, t) {
1215
- const { _parentNode: r, _indexFromParent: i, ...a } = t;
1216
- if (e && Object.keys(a).length > 0)
1217
- throw new T(e, Object.keys(a));
1218
- }
1219
- function Xe(e, t, r) {
1220
- if (r !== "last" && typeof r != "number")
1221
- throw new w(e, t, '"last" or a number is expected');
1222
- }
1223
- function et(e, t, r) {
1224
- if (r !== void 0 && r !== "h5web" && r !== "plotly")
1225
- throw new w(e, t, '"h5web" or "plotly" string is expected');
1226
- }
1227
- const Tt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1228
- __proto__: null,
1229
- assertBoolean: Ue,
1230
- assertDataCollectionId: Xe,
1231
- assertKeyExpected: qe,
1232
- assertNoUnknownKeys: j,
1233
- assertNumber: Be,
1234
- assertOptionalBackend: et,
1235
- assertOptionalBoolean: G,
1236
- assertOptionalNumber: ue,
1237
- assertOptionalNumberList: Qe,
1238
- assertOptionalString: de,
1239
- assertOptionalStringList: Je,
1240
- assertOptionalStringOrStringList: Ze,
1241
- assertString: Ge,
1242
- assertStringList: We
1243
- }, Symbol.toStringTag, { value: "Module" }));
1244
- function tt({ yamlNode: e, panel: t }) {
1245
- const { type: r, style: i, children: a, ...o } = e;
1246
- return j(e, o), /* @__PURE__ */ n(q, { className: "ymllayout-row gx-0", style: i, children: C(a, (d, l) => O(d, l, t)) });
1247
- }
1248
- function nt({ yamlNode: e, panel: t }) {
1249
- const { type: r, style: i, xs: a, children: o, ...d } = e;
1250
- return j(e, d), ue(e, "xs", a), /* @__PURE__ */ n(
1251
- k,
1252
- {
1253
- className: L("yamymllayout-col", { col: !!a }),
1254
- style: i,
1255
- xs: a,
1256
- children: C(e.children, (l, h) => O(l, h, t))
1257
- }
1258
- );
1259
- }
1260
- const U = {};
1261
- function Pt(e, t) {
1262
- U[e] = t;
1263
- }
1264
- function rt(e, t) {
1265
- if (t === void 0)
1266
- throw new P(e, ["id"]);
1267
- if (typeof t.id != "string")
1268
- throw new w(e, "id", "A string is expected");
1269
- }
1270
- function it(e, t, r) {
1271
- if (r !== void 0) {
1272
- if (!Array.isArray(r))
1273
- throw new w(e, "ids", "A option list is expected");
1274
- r.forEach((i, a) => {
1275
- try {
1276
- rt(e, i);
1277
- } catch {
1278
- throw new w(
1279
- e,
1280
- "ids",
1281
- `The hardware description ${a} is wrong`
1282
- );
1283
- }
1284
- });
1285
- }
1286
- }
1287
- function at(e) {
1288
- const {
1289
- providers: t = {},
1290
- yamlNode: r,
1291
- ids: i,
1292
- groupid: a,
1293
- even: o,
1294
- nowrap: d,
1295
- ...l
1296
- } = e;
1297
- if (it(r, "ids", i), de(r, "groupid", a), G(r, "even", o), G(r, "nowrap", d), j(r, l), !U.HardwareGroup)
1298
- return /* @__PURE__ */ n(E, { variant: "warning", children: "No `HardwareGroup` component registered" });
1299
- const h = U.HardwareGroup;
1300
- return /* @__PURE__ */ n(
1301
- h,
1302
- {
1303
- providers: t,
1304
- ids: i,
1305
- groupid: a,
1306
- nowrap: d || !1,
1307
- even: o || !1
1308
- }
1309
- );
1310
- }
1311
- const B = {
1312
- hardwaregroup: at
1313
- };
1314
- function Vt(e, t) {
1315
- B[e] = t;
1316
- }
1317
- function ot(e) {
1318
- const { yamlNode: t, panel: r } = e, { type: i, style: a, scroll: o, title: d, ...l } = t;
1319
- if (!(i in B))
1320
- return /* @__PURE__ */ n(p, { children: /* @__PURE__ */ n(p.Contents, { children: /* @__PURE__ */ s(E, { variant: "warning", children: [
1321
- 'Unknown component "',
1322
- i,
1323
- '"'
1324
- ] }) }) });
1325
- const h = B[t.type];
1326
- return r ? /* @__PURE__ */ n(p, { style: a, scroll: o, children: /* @__PURE__ */ s(ee, { fallback: /* @__PURE__ */ n("p", { children: "Loading..." }), children: [
1327
- d && /* @__PURE__ */ n(p.Header, { children: d }),
1328
- /* @__PURE__ */ n(p.Contents, { children: /* @__PURE__ */ n(h, { ...l, yamlNode: t }) })
1329
- ] }) }) : /* @__PURE__ */ n(ee, { fallback: /* @__PURE__ */ n("p", { children: "Loading..." }), children: /* @__PURE__ */ n(h, { ...l, yamlNode: t }) });
1330
- }
1331
- function st({ yamlNode: e, panel: t }) {
1332
- const r = e.options || {};
1333
- return /* @__PURE__ */ n(_, { className: "ymllayout-container", ...r, children: C(e.children, (i, a) => O(i, a, t)) });
1334
- }
1335
- function lt(e) {
1336
- const { yamlNode: t } = e, r = t.options || {}, i = {};
1337
- return r.centerContent && (i.margin = "auto"), /* @__PURE__ */ s(p, { className: "ymllayout-panel", ...r, children: [
1338
- t.title && /* @__PURE__ */ n(p.Header, { children: t.title }),
1339
- /* @__PURE__ */ n(p.Contents, { style: i, children: C(
1340
- t.children,
1341
- (a, o) => O(a, o, !1)
1342
- ) })
1343
- ] });
1344
- }
1345
- const ct = () => Math.random().toString(36).slice(2, 15) + Math.random().toString(36).slice(2, 15);
1346
- function dt({ yamlNode: e, panel: t }) {
1347
- const r = [];
1348
- return fe(e.children, (i, a) => {
1349
- r.push(
1350
- /* @__PURE__ */ n(me, { eventKey: ct(), title: i.title, children: O(i, 0, !1) }, a)
1351
- );
1352
- }), t ? /* @__PURE__ */ s(p, { className: "ymllayout-tabs", children: [
1353
- e.title && /* @__PURE__ */ n(p.Header, { children: e.title }),
1354
- /* @__PURE__ */ n(p.Contents, { children: /* @__PURE__ */ n(X, { mountOnEnter: !0, children: r }) })
1355
- ] }) : /* @__PURE__ */ n(X, { children: r });
1356
- }
1357
- function ut(e) {
1358
- const { node: t } = e, { type: r, title: i, ...a } = t;
1359
- return le(t, a), /* @__PURE__ */ n("div", { style: { gridColumn: "1 / 3" }, children: /* @__PURE__ */ n("h3", { children: i }) });
1360
- }
1361
- function ht(e) {
1362
- const { node: t, state: r, row: i } = e, { title: a } = t;
1363
- function o() {
1364
- if (t.id)
1365
- return t.id;
1366
- }
1367
- function d() {
1368
- if (a !== void 0)
1369
- return a;
1370
- if (t.type === "hardware") {
1371
- const h = o(), u = {
1372
- _parentNode: t._parentNode,
1373
- _indexFromParent: t._indexFromParent,
1374
- type: "hardware",
1375
- id: h,
1376
- variant: "name",
1377
- emptyifnone: !0
1378
- };
1379
- return O(u, "a", !1);
1380
- }
1381
- return "";
1382
- }
1383
- const l = d();
1384
- return /* @__PURE__ */ s(
1385
- "div",
1386
- {
1387
- style: {
1388
- textAlign: "center"
1389
- },
1390
- children: [
1391
- /* @__PURE__ */ n(
1392
- "h5",
1393
- {
1394
- style: {
1395
- margin: "0px",
1396
- whiteSpace: "nowrap"
1397
- },
1398
- children: l
1399
- }
1400
- ),
1401
- r && /* @__PURE__ */ n("div", { style: { position: "relative", top: -5 }, children: r })
1402
- ]
1403
- }
1404
- );
1405
- }
1406
- function ft(e) {
1407
- const { node: t, row: r } = e, {
1408
- titlealign: i,
1409
- title: a,
1410
- stateinheader: o = !1,
1411
- variant: d,
1412
- id: l,
1413
- ...h
1414
- } = t;
1415
- let u, c;
1416
- if (h.type === "hardware")
1417
- if (u = {
1418
- ...h,
1419
- id: l,
1420
- variant: d
1421
- }, o) {
1422
- const f = {
1423
- ...h,
1424
- id: l,
1425
- variant: "state",
1426
- emptyifnone: !0
1427
- };
1428
- c = O(f, "k", !1);
1429
- } else
1430
- c = null;
1431
- else
1432
- u = h, c = null;
1433
- return /* @__PURE__ */ s(v, { children: [
1434
- /* @__PURE__ */ n(
1435
- "div",
1436
- {
1437
- style: {
1438
- gridColumn: 1,
1439
- alignSelf: i ?? "center"
1440
- },
1441
- children: /* @__PURE__ */ n(ht, { node: t, state: c, row: r })
1442
- }
1443
- ),
1444
- /* @__PURE__ */ n("div", { style: { gridColumn: 2 }, children: O(u, "k", !1) })
1445
- ] });
1446
- }
1447
- function mt(e) {
1448
- const { yamlNode: t, panel: r } = e, { type: i, children: a, options: o = {}, title: d, ...l } = t;
1449
- return le(t, l), /* @__PURE__ */ s(p, { className: "ymllayout-form", ...o, children: [
1450
- t.title && /* @__PURE__ */ n(p.Header, { children: t.title }),
1451
- /* @__PURE__ */ n(p.Contents, { children: /* @__PURE__ */ n(
1452
- "div",
1453
- {
1454
- style: {
1455
- display: "grid",
1456
- gridTemplateColumns: "min-content auto"
1457
- },
1458
- children: C(a, (h, u) => h.type === "formheader" ? /* @__PURE__ */ n(
1459
- ut,
1460
- {
1461
- node: h,
1462
- row: u
1463
- },
1464
- u
1465
- ) : /* @__PURE__ */ n(ft, { node: h, row: u }, u))
1466
- }
1467
- ) })
1468
- ] });
1469
- }
1470
- function pt(e) {
1471
- const { yamlNode: t, panel: r } = e;
1472
- return /* @__PURE__ */ s(
1473
- "div",
1474
- {
1475
- className: "ymllayout-grid",
1476
- style: {
1477
- gridTemplateColumns: t.columns,
1478
- gridTemplateRows: t.rows
1479
- },
1480
- children: [
1481
- C(t.children, (i, a) => {
1482
- const { columnSpan: o = 1, rowSpan: d = 1, ...l } = i, h = o > 1 ? `span ${o}` : void 0, u = d > 1 ? `span ${d}` : void 0;
1483
- return /* @__PURE__ */ n(
1484
- "div",
1485
- {
1486
- className: "ymllayout-grid-cell",
1487
- style: {
1488
- gridColumn: h,
1489
- gridRow: u
1490
- },
1491
- children: O(l, a, r)
1492
- },
1493
- a
1494
- );
1495
- }),
1496
- " "
1497
- ]
1498
- }
1499
- );
1500
- }
1501
- function wt({ yamlNode: e, panel: t }) {
1502
- const r = e.options || {};
1503
- return /* @__PURE__ */ n(He, { panel: t, options: r, children: /* @__PURE__ */ n("div", { children: e.label }) });
1504
- }
1505
- const gt = {
1506
- row: tt,
1507
- col: nt,
1508
- container: st,
1509
- component: ot,
1510
- panel: lt,
1511
- tabs: dt,
1512
- form: mt,
1513
- grid: pt,
1514
- label: wt
1515
- };
1516
- Object.entries(gt).forEach(([e, t]) => {
1517
- Ve(e, t);
1518
- });
1519
- function Ht(e) {
1520
- var r;
1521
- const t = be(() => ce(e.layout), [e.layout]);
1522
- return t.error ? /* @__PURE__ */ n("div", { className: `${e.className ?? ""} ymllayout-main`, id: e.id, children: /* @__PURE__ */ s(p, { children: [
1523
- /* @__PURE__ */ n(p.Header, { children: "Layout Error" }),
1524
- /* @__PURE__ */ s(p.Contents, { children: [
1525
- /* @__PURE__ */ s("p", { children: [
1526
- "File: ",
1527
- t.name
1528
- ] }),
1529
- /* @__PURE__ */ n(E, { variant: "warning", children: /* @__PURE__ */ n("pre", { className: "mb-0", children: t.error }) })
1530
- ] })
1531
- ] }) }) : /* @__PURE__ */ n("div", { className: `${e.className ?? ""} ymllayout-main`, id: e.id, children: /* @__PURE__ */ n(ze, { resetKey: t, children: (r = t.children) == null ? void 0 : r.map((i, a) => O(i, a)) }) });
1532
- }
1533
- const Lt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1534
- __proto__: null
1535
- }, Symbol.toStringTag, { value: "Module" }));
1536
- export {
1537
- St as Formatting,
1538
- Et as Frontend,
1539
- _e as FullSizer,
1540
- Lt as HWObject,
1541
- te as HardwareInputNumber,
1542
- ke as HardwareNumericStep,
1543
- _t as HardwareSchema,
1544
- Mt as HardwareState,
1545
- Y as HardwareTemplate,
1546
- Rt as HardwareTypes,
1547
- Ft as HardwareVariant,
1548
- xt as Info,
1549
- w as KeyError,
1550
- P as MissingKeysError,
1551
- At as MotorDefault,
1552
- It as Multiposition,
1553
- kt as NoObject,
1554
- Ie as NumericStep,
1555
- Dt as Property,
1556
- $t as ShutterDefault,
1557
- I as TypeIcon,
1558
- ze as YAMLErrorBoundary,
1559
- Ht as YAMLLayout,
1560
- Tt as YamlAsserts,
1561
- Pt as registerHardwareComponent,
1562
- Vt as registerYamlComponent,
1563
- Ve as registerYamlType,
1564
- O as renderYamlNode,
1565
- gt as yamlMap
1566
- };
1567
- //# sourceMappingURL=index.esm.js.map