@esrf/daiquiri-lib 1.0.0 → 1.0.1

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.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  import { jsxs as l, jsx as r, Fragment as v } from "react/jsx-runtime";
2
- import { map as C, each as ve } from "lodash";
3
- import { Badge as D, ButtonGroup as oe, Button as y, OverlayTrigger as F, Popover as b, Container as $, Row as P, Col as E, Form as N, InputGroup as M, Alert as x, Tab as be, Tabs as te, Tooltip as Ne } from "react-bootstrap";
4
- import { forwardRef as Ce, useRef as R, useState as k, useEffect as j, Component as se, Fragment as U, Children as Oe, isValidElement as Se, cloneElement as Ee, Suspense as ne, useMemo as xe, createElement as Me } from "react";
5
- import T from "classnames";
6
- import Ae from "debug";
7
- function ke(e) {
2
+ import { map as C, each as be } from "lodash";
3
+ import { Badge as F, ButtonGroup as oe, Button as y, OverlayTrigger as R, Popover as b, Container as $, Row as P, Col as E, Form as N, InputGroup as A, Alert as x, Tab as Ne, Tabs as te, Tooltip as Ce } from "react-bootstrap";
4
+ import { forwardRef as Oe, useRef as T, useState as I, useEffect as j, Component as se, Fragment as q, Children as Se, isValidElement as Ee, cloneElement as xe, Suspense as ne, useMemo as Me, createElement as Ae } from "react";
5
+ import H from "classnames";
6
+ import ke from "debug";
7
+ function Ie(e) {
8
8
  const {
9
9
  activeMessage: t = "Online",
10
10
  inactiveMessage: n = "Offline",
@@ -18,14 +18,14 @@ function ke(e) {
18
18
  }
19
19
  );
20
20
  }
21
- function I(e) {
21
+ function D(e) {
22
22
  const { name: t, icon: n } = e;
23
23
  return /* @__PURE__ */ l("div", { className: "icon", title: t, children: [
24
24
  /* @__PURE__ */ r("i", { className: `fa ${n}` }),
25
- /* @__PURE__ */ r(ke, { ...e })
25
+ /* @__PURE__ */ r(Ie, { ...e })
26
26
  ] });
27
27
  }
28
- function Ie(e) {
28
+ function De(e) {
29
29
  const t = {
30
30
  24: "Y",
31
31
  21: "Z",
@@ -59,21 +59,21 @@ function le(e) {
59
59
  const t = Math.round(e / 60), n = t % 60, i = Math.floor(t / 60);
60
60
  return i ? `${i} hr ${n} min` : `${n} min`;
61
61
  }
62
- function De(e) {
62
+ function Fe(e) {
63
63
  return e > 0 ? (662607004e-42 * 299792458 / (e * 1e-10) / 160218e-24 * 1e-3).toFixed(4) : 0;
64
64
  }
65
- function Fe(e, t) {
65
+ function Re(e, t) {
66
66
  return Number.parseFloat(e.toFixed(t));
67
67
  }
68
68
  const _t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
69
69
  __proto__: null,
70
- formatEng: Ie,
71
- round: Fe,
72
- toEnergy: De,
70
+ formatEng: De,
71
+ round: Re,
72
+ toEnergy: Fe,
73
73
  toHoursMins: le,
74
74
  ucfirst: $e
75
75
  }, Symbol.toStringTag, { value: "Module" }));
76
- function Re(e) {
76
+ function Te(e) {
77
77
  const { hardware: t } = e;
78
78
  function n(d) {
79
79
  t.requestChange({
@@ -97,7 +97,7 @@ function Re(e) {
97
97
  return !s || typeof s != "string" ? "UNKNOWN" : s;
98
98
  }
99
99
  return /* @__PURE__ */ r(
100
- F,
100
+ R,
101
101
  {
102
102
  trigger: "click",
103
103
  rootClose: !0,
@@ -116,7 +116,7 @@ function Re(e) {
116
116
  ":"
117
117
  ] }),
118
118
  /* @__PURE__ */ r(E, { children: /* @__PURE__ */ r(
119
- D,
119
+ F,
120
120
  {
121
121
  bg: o(d) === "ON" ? "success" : "danger",
122
122
  children: o(d)
@@ -148,7 +148,7 @@ function Pt(e) {
148
148
  return /* @__PURE__ */ l("div", { className: "hw-component", children: [
149
149
  /* @__PURE__ */ l("div", { className: "hw-head", children: [
150
150
  /* @__PURE__ */ r(
151
- I,
151
+ D,
152
152
  {
153
153
  name: "Frontend",
154
154
  icon: "fam-hardware-frontend",
@@ -157,7 +157,7 @@ function Pt(e) {
157
157
  ),
158
158
  /* @__PURE__ */ r("div", { className: "name", children: t.name }),
159
159
  /* @__PURE__ */ r(
160
- D,
160
+ F,
161
161
  {
162
162
  bg: t.properties.state === "OPEN" || t.properties.state === "RUNNING" ? "success" : "danger",
163
163
  children: t.properties.state
@@ -174,7 +174,7 @@ function Pt(e) {
174
174
  children: t.properties.frontend === "FE open" ? "Close" : "Open"
175
175
  }
176
176
  ),
177
- /* @__PURE__ */ r(Re, { ...e })
177
+ /* @__PURE__ */ r(Te, { ...e })
178
178
  ] }) })
179
179
  ] });
180
180
  }
@@ -218,7 +218,7 @@ function Y(e) {
218
218
  /* @__PURE__ */ r("div", { className: "name", children: /* @__PURE__ */ r(N.Label, { htmlFor: n.id, children: a }) }),
219
219
  e.widgetState,
220
220
  e.hardware.errors && e.hardware.errors.length > 0 && /* @__PURE__ */ r(
221
- F,
221
+ R,
222
222
  {
223
223
  trigger: "click",
224
224
  placement: "bottom",
@@ -251,7 +251,7 @@ function J(e) {
251
251
  display: "inline-block",
252
252
  minWidth: ""
253
253
  };
254
- return e.minWidth && (t.minWidth = `${e.minWidth}em`), /* @__PURE__ */ r("div", { style: t, children: /* @__PURE__ */ r(D, { bg: e.variant, children: e.state }) });
254
+ return e.minWidth && (t.minWidth = `${e.minWidth}em`), /* @__PURE__ */ r("div", { style: t, children: /* @__PURE__ */ r(F, { bg: e.variant, children: e.state }) });
255
255
  }
256
256
  function ce(e) {
257
257
  const { hardware: t } = e;
@@ -307,15 +307,15 @@ const Lt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
307
307
  HardwareState: J,
308
308
  MotorState: ce,
309
309
  ShutterState: de
310
- }, Symbol.toStringTag, { value: "Module" })), Te = Ce((e, t) => {
311
- const n = R(null), [i, a] = k(e.step), o = (w) => {
312
- const q = t;
310
+ }, Symbol.toStringTag, { value: "Module" })), He = Oe((e, t) => {
311
+ const n = T(null), [i, a] = I(e.step), o = (w) => {
312
+ const z = t;
313
313
  if (n.current === null)
314
314
  return;
315
- let X = Number.parseFloat(q.current.value);
315
+ let X = Number.parseFloat(z.current.value);
316
316
  const ee = Number.parseFloat(n.current.value);
317
- X += w ? ee : -ee, q.current.value = `${X}`, e.onStep && e.onStep({
318
- target: q.current
317
+ X += w ? ee : -ee, z.current.value = `${X}`, e.onStep && e.onStep({
318
+ target: z.current
319
319
  });
320
320
  }, {
321
321
  onStep: d,
@@ -325,8 +325,8 @@ const Lt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
325
325
  decIcon: c,
326
326
  swapIncDec: f,
327
327
  onKeyDown: m,
328
- horizontalArrows: A,
329
- largeArrows: z,
328
+ horizontalArrows: k,
329
+ largeArrows: K,
330
330
  ...S
331
331
  } = e, Q = (w) => {
332
332
  w.key === "ArrowUp" ? (w.preventDefault(), o(!0)) : w.key === "ArrowDown" ? (w.preventDefault(), o(!1)) : m && m(w);
@@ -342,15 +342,15 @@ const Lt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
342
342
  ...S
343
343
  }
344
344
  );
345
- const ye = C(e.steps || [e.step], (w) => /* @__PURE__ */ r("option", { value: w, children: w }, w));
345
+ const ve = C(e.steps || [e.step], (w) => /* @__PURE__ */ r("option", { value: w, children: w }, w));
346
346
  return /* @__PURE__ */ r(
347
347
  "div",
348
348
  {
349
- className: T("numeric-step", {
350
- "numeric-step-large": z,
351
- "numeric-step-horizontal": A
349
+ className: H("numeric-step", {
350
+ "numeric-step-large": K,
351
+ "numeric-step-horizontal": k
352
352
  }),
353
- children: /* @__PURE__ */ l(M, { children: [
353
+ children: /* @__PURE__ */ l(A, { children: [
354
354
  /* @__PURE__ */ r(
355
355
  N.Control,
356
356
  {
@@ -363,7 +363,7 @@ const Lt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
363
363
  ),
364
364
  /* @__PURE__ */ l(v, { children: [
365
365
  h,
366
- !h && /* @__PURE__ */ l(M.Text, { className: "d-flex flex-column", children: [
366
+ !h && /* @__PURE__ */ l(A.Text, { className: "d-flex flex-column", children: [
367
367
  /* @__PURE__ */ r(
368
368
  N.Control,
369
369
  {
@@ -372,7 +372,7 @@ const Lt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
372
372
  className: "step-size",
373
373
  defaultValue: i,
374
374
  onChange: (w) => a(Number.parseFloat(w.target.value)),
375
- children: ye
375
+ children: ve
376
376
  }
377
377
  ),
378
378
  e.unit && /* @__PURE__ */ r("div", { children: e.unit }),
@@ -402,9 +402,9 @@ const Lt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
402
402
  ] })
403
403
  }
404
404
  );
405
- }), He = Te;
406
- function _e(e) {
407
- const t = R(null), [n, i] = k(!1), [a, o] = k(!1);
405
+ }), _e = He;
406
+ function Pe(e) {
407
+ const t = T(null), [n, i] = I(!1), [a, o] = I(!1);
408
408
  j(() => {
409
409
  t.current && (e.hardwareValue === null ? t.current.value = "" : t.current.value = e.hardwareValue.toString(), i(!1));
410
410
  }, [e.hardwareValue]);
@@ -428,8 +428,8 @@ function _e(e) {
428
428
  case "Enter":
429
429
  {
430
430
  i(!1);
431
- const m = Number.parseFloat(f.target.value), A = e.onMoveRequested(m);
432
- A && A.catch(() => {
431
+ const m = Number.parseFloat(f.target.value), k = e.onMoveRequested(m);
432
+ k && k.catch(() => {
433
433
  o(!0), setTimeout(() => {
434
434
  d(e.hardwareValue), o(!1);
435
435
  }, 2e3);
@@ -444,10 +444,10 @@ function _e(e) {
444
444
  }
445
445
  }
446
446
  return /* @__PURE__ */ r(
447
- He,
447
+ _e,
448
448
  {
449
449
  id: e.id,
450
- className: T({
450
+ className: H({
451
451
  "form-control-edited": n,
452
452
  "form-control-error": a,
453
453
  "hw-moving": e.hardwareIsMoving
@@ -472,7 +472,7 @@ function _e(e) {
472
472
  );
473
473
  }
474
474
  function re(e) {
475
- const t = R(null), [n, i] = k(!1), [a, o] = k(!1);
475
+ const t = T(null), [n, i] = I(!1), [a, o] = I(!1);
476
476
  function d(c) {
477
477
  return e.precision !== void 0 ? Number.parseFloat(c).toFixed(e.precision) : c;
478
478
  }
@@ -508,7 +508,7 @@ function re(e) {
508
508
  return /* @__PURE__ */ r(
509
509
  N.Control,
510
510
  {
511
- className: T({
511
+ className: H({
512
512
  "form-control-edited": n,
513
513
  "form-control-error": a,
514
514
  "hw-moving": e.hardwareIsMoving
@@ -522,7 +522,7 @@ function re(e) {
522
522
  }
523
523
  );
524
524
  }
525
- function Pe(e) {
525
+ function Ve(e) {
526
526
  function t(a) {
527
527
  return e.hardware.requestChange({
528
528
  property: "velocity",
@@ -537,7 +537,7 @@ function Pe(e) {
537
537
  }
538
538
  let i = "UNKNOWN";
539
539
  return e.hardware.properties.state && ([i] = e.hardware.properties.state), /* @__PURE__ */ r(
540
- F,
540
+ R,
541
541
  {
542
542
  trigger: "click",
543
543
  rootClose: !0,
@@ -597,16 +597,16 @@ function jt(e) {
597
597
  }
598
598
  let o = "UNKNOWN";
599
599
  e.hardware.properties.state && ([o] = e.hardware.properties.state);
600
- const d = /* @__PURE__ */ r(I, { name: "Motor", icon: "fam-hardware-motor", online: t.online }), s = /* @__PURE__ */ r(ce, { hardware: t }), h = e.options ? e.options.header : "top";
600
+ const d = /* @__PURE__ */ r(D, { name: "Motor", icon: "fam-hardware-motor", online: t.online }), s = /* @__PURE__ */ r(ce, { hardware: t }), h = e.options ? e.options.header : "top";
601
601
  return /* @__PURE__ */ r(
602
602
  Y,
603
603
  {
604
604
  hardware: t,
605
605
  widgetIcon: d,
606
606
  widgetState: s,
607
- widgetContent: /* @__PURE__ */ l(M, { children: [
607
+ widgetContent: /* @__PURE__ */ l(A, { children: [
608
608
  /* @__PURE__ */ r(
609
- _e,
609
+ Pe,
610
610
  {
611
611
  id: t.id,
612
612
  hardwareValue: t.properties.position,
@@ -626,9 +626,9 @@ function jt(e) {
626
626
  largeArrows: n.largearrows
627
627
  }
628
628
  ),
629
- t.properties.unit && /* @__PURE__ */ r(M.Text, { children: t.properties.unit }),
629
+ t.properties.unit && /* @__PURE__ */ r(A.Text, { children: t.properties.unit }),
630
630
  o !== "MOVING" && n.extended && /* @__PURE__ */ r(
631
- Pe,
631
+ Ve,
632
632
  {
633
633
  hardware: t,
634
634
  disabled: e.disabled,
@@ -642,7 +642,7 @@ function jt(e) {
642
642
  );
643
643
  }
644
644
  function Yt(e) {
645
- const { hardware: t, options: n = {} } = e, i = R(null);
645
+ const { hardware: t, options: n = {} } = e, i = T(null);
646
646
  j(() => {
647
647
  if (!i.current) {
648
648
  console.error("selectionRef ref is unset");
@@ -669,7 +669,7 @@ function Yt(e) {
669
669
  return /* @__PURE__ */ l("div", { className: "hw-component", children: [
670
670
  /* @__PURE__ */ l("div", { className: "hw-head", children: [
671
671
  /* @__PURE__ */ r(
672
- I,
672
+ D,
673
673
  {
674
674
  name: "Multiposition",
675
675
  icon: "fam-hardware-multiposition",
@@ -678,14 +678,14 @@ function Yt(e) {
678
678
  ),
679
679
  /* @__PURE__ */ r("div", { className: "name", children: t.name }),
680
680
  /* @__PURE__ */ r(
681
- D,
681
+ F,
682
682
  {
683
683
  bg: t.properties.state === "READY" ? "success" : "warning",
684
684
  children: t.properties.state
685
685
  }
686
686
  )
687
687
  ] }),
688
- /* @__PURE__ */ r("div", { className: "hw-content", children: /* @__PURE__ */ l(M, { children: [
688
+ /* @__PURE__ */ r("div", { className: "hw-content", children: /* @__PURE__ */ l(A, { children: [
689
689
  /* @__PURE__ */ l(
690
690
  N.Control,
691
691
  {
@@ -705,15 +705,15 @@ function Yt(e) {
705
705
  ] }) })
706
706
  ] });
707
707
  }
708
- const Ve = Ae("daiquiri.components.hardware.NoObject");
709
- function Kt(e) {
708
+ const Le = ke("daiquiri.components.hardware.NoObject");
709
+ function Ut(e) {
710
710
  if (e.options.emptyifnone)
711
- return Ve(
711
+ return Le(
712
712
  'Component id:"%s" name:"%s" not displayed cause setup with emptyifnone.',
713
713
  e.id,
714
714
  e.name
715
715
  ), /* @__PURE__ */ r(v, {});
716
- const t = /* @__PURE__ */ r(I, { name: "NoObject", icon: "fam-hardware-any", online: !1 }), n = /* @__PURE__ */ r(v, {}), i = /* @__PURE__ */ r(v, { children: "Missing" }), a = e.options ? e.options.header : "top", o = {
716
+ const t = /* @__PURE__ */ r(D, { name: "NoObject", icon: "fam-hardware-any", online: !1 }), n = /* @__PURE__ */ r(v, {}), i = /* @__PURE__ */ r(v, { children: "Missing" }), a = e.options ? e.options.header : "top", o = {
717
717
  id: e.id,
718
718
  name: e.name ?? "",
719
719
  alias: null,
@@ -732,12 +732,12 @@ function Kt(e) {
732
732
  }
733
733
  );
734
734
  }
735
- function Le(e) {
735
+ function je(e) {
736
736
  const t = e.online ? "READY" : "OFFLINE";
737
- return /* @__PURE__ */ r(D, { bg: t === "READY" ? "success" : "warning", children: t });
737
+ return /* @__PURE__ */ r(F, { bg: t === "READY" ? "success" : "warning", children: t });
738
738
  }
739
- function zt(e) {
740
- const { hardware: t, options: n = {} } = e, i = /* @__PURE__ */ r(I, { name: "Optic", icon: "fa-cog", online: t.online }), a = /* @__PURE__ */ r(Le, { ...t });
739
+ function Kt(e) {
740
+ const { hardware: t, options: n = {} } = e, i = /* @__PURE__ */ r(D, { name: "Optic", icon: "fa-cog", online: t.online }), a = /* @__PURE__ */ r(je, { ...t });
741
741
  function o() {
742
742
  const c = n.property;
743
743
  if (c === void 0)
@@ -762,9 +762,9 @@ function zt(e) {
762
762
  return null;
763
763
  return `${f}`;
764
764
  }
765
- const s = d(), h = /* @__PURE__ */ l(M, { children: [
765
+ const s = d(), h = /* @__PURE__ */ l(A, { children: [
766
766
  /* @__PURE__ */ r(N.Control, { value: o(), readOnly: !0 }),
767
- s && /* @__PURE__ */ r(M.Text, { children: s })
767
+ s && /* @__PURE__ */ r(A.Text, { children: s })
768
768
  ] }), u = e.options.header || "top";
769
769
  return /* @__PURE__ */ r(
770
770
  Y,
@@ -777,14 +777,14 @@ function zt(e) {
777
777
  }
778
778
  );
779
779
  }
780
- function je(e) {
780
+ function Ye(e) {
781
781
  const { hardware: t } = e, n = () => {
782
782
  t.requestChange({
783
783
  function: "reset"
784
784
  });
785
785
  };
786
786
  return /* @__PURE__ */ r(
787
- F,
787
+ R,
788
788
  {
789
789
  trigger: "click",
790
790
  rootClose: !0,
@@ -803,9 +803,9 @@ function je(e) {
803
803
  }
804
804
  );
805
805
  }
806
- function qt(e) {
806
+ function zt(e) {
807
807
  const { hardware: t, options: n = {} } = e, i = /* @__PURE__ */ r(
808
- I,
808
+ D,
809
809
  {
810
810
  name: "Shutter",
811
811
  icon: "fam-hardware-shutter",
@@ -832,7 +832,7 @@ function qt(e) {
832
832
  function: u
833
833
  });
834
834
  }
835
- const A = /* @__PURE__ */ l(oe, { className: "d-flex flex-nowrap", children: [
835
+ const k = /* @__PURE__ */ l(oe, { className: "d-flex flex-nowrap", children: [
836
836
  /* @__PURE__ */ r(
837
837
  y,
838
838
  {
@@ -842,20 +842,20 @@ function qt(e) {
842
842
  children: h
843
843
  }
844
844
  ),
845
- n.extended && /* @__PURE__ */ r(je, { ...e })
846
- ] }), z = e.options.header || "top";
845
+ n.extended && /* @__PURE__ */ r(Ye, { ...e })
846
+ ] }), K = e.options.header || "top";
847
847
  return /* @__PURE__ */ r(
848
848
  Y,
849
849
  {
850
850
  hardware: t,
851
851
  widgetIcon: i,
852
852
  widgetState: a,
853
- widgetContent: A,
854
- headerMode: z
853
+ widgetContent: k,
854
+ headerMode: K
855
855
  }
856
856
  );
857
857
  }
858
- class Ut extends se {
858
+ class qt extends se {
859
859
  constructor() {
860
860
  super(...arguments), this.variants = {};
861
861
  }
@@ -864,8 +864,8 @@ class Ut extends se {
864
864
  return this.props.options.variant in this.variants && (t = this.variants[this.props.options.variant]), /* @__PURE__ */ r(t, { ...this.props });
865
865
  }
866
866
  }
867
- function Ye(e) {
868
- const [t, n] = k({}), i = R(null);
867
+ function Ue(e) {
868
+ const [t, n] = I({}), i = T(null);
869
869
  return j(() => {
870
870
  if (i.current) {
871
871
  const a = i.current;
@@ -902,7 +902,7 @@ function ze(e) {
902
902
  return /* @__PURE__ */ r("div", { className: "panel-contents", style: e.style, children: e.children });
903
903
  }
904
904
  function p(e) {
905
- const t = e.scroll ? Ye : U;
905
+ const t = e.scroll ? Ue : q;
906
906
  return /* @__PURE__ */ r("div", { className: `panel ${e.className ?? ""}`, style: e.style, children: /* @__PURE__ */ r(t, { children: e.children }) });
907
907
  }
908
908
  p.Header = Ke;
@@ -921,15 +921,15 @@ function O(e, t, n = !0) {
921
921
  const { type: i } = e, a = i && i in _ ? _[i] : _.component;
922
922
  return /* @__PURE__ */ r(a, { yamlNode: e, panel: n }, t);
923
923
  }
924
- function Ue({
924
+ function Ge({
925
925
  children: e,
926
926
  key: t,
927
927
  panel: n,
928
928
  options: i
929
929
  }) {
930
- return n ? /* @__PURE__ */ r(p, { style: i.style, scroll: i.scroll, children: /* @__PURE__ */ r(p.Contents, { children: e }) }, t) : /* @__PURE__ */ r(v, { children: Oe.map(
930
+ return n ? /* @__PURE__ */ r(p, { style: i.style, scroll: i.scroll, children: /* @__PURE__ */ r(p.Contents, { children: e }) }, t) : /* @__PURE__ */ r(v, { children: Se.map(
931
931
  e,
932
- (a) => Se(a) ? Ee(a, { key: t, ...a.props }) : void 0
932
+ (a) => Ee(a) ? xe(a, { key: t, ...a.props }) : void 0
933
933
  ) });
934
934
  }
935
935
  function ue(e, t) {
@@ -937,33 +937,33 @@ function ue(e, t) {
937
937
  if (e && Object.keys(a).length > 0)
938
938
  throw new V(e, Object.keys(a));
939
939
  }
940
- class H extends Error {
940
+ class M extends Error {
941
941
  constructor(t, n) {
942
942
  super(t), this.yamlNode = n;
943
943
  }
944
944
  }
945
- class V extends H {
945
+ class V extends M {
946
946
  constructor(t, n) {
947
947
  super(`Unexpected keys: ${n.join(", ")}`, t), this.keys = n;
948
948
  }
949
949
  }
950
- class L extends H {
950
+ class L extends M {
951
951
  constructor(t, n) {
952
952
  super(`Keys ${n.join(", ")} are missing`, t), this.keys = n;
953
953
  }
954
954
  }
955
- class g extends H {
955
+ class g extends M {
956
956
  constructor(t, n, i) {
957
957
  super(`Key ${n} error: ${i}`, t), this.key = n, this.keyMessage = i;
958
958
  }
959
959
  }
960
- function Ge(e) {
960
+ function We(e) {
961
961
  let t = e;
962
962
  for (; t._parentNode; )
963
963
  t = t._parentNode;
964
964
  return t;
965
965
  }
966
- function We(e) {
966
+ function Be(e) {
967
967
  const t = [];
968
968
  let n = e;
969
969
  for (; n; )
@@ -989,15 +989,15 @@ function he(e, t = null, n = null) {
989
989
  }
990
990
  return Object.freeze(i), i;
991
991
  }
992
- function Be(e) {
992
+ function fe(e) {
993
993
  return /* @__PURE__ */ r(x, { variant: "danger", children: e.message });
994
994
  }
995
995
  function Ze(e) {
996
996
  const { error: t } = e;
997
- if (!(t instanceof H))
997
+ if (!(t instanceof M))
998
998
  return /* @__PURE__ */ r(v, {});
999
999
  function n(o, d = 3) {
1000
- const s = We(o.yamlNode), h = [];
1000
+ const s = Be(o.yamlNode), h = [];
1001
1001
  let u = "";
1002
1002
  for (let c = 1; c < s.length; c++) {
1003
1003
  const { node: f, indexFromParent: m } = s[c];
@@ -1026,7 +1026,7 @@ function Ze(e) {
1026
1026
  ), h.join(`
1027
1027
  `);
1028
1028
  }
1029
- const a = Ge(t.yamlNode).name;
1029
+ const a = We(t.yamlNode).name;
1030
1030
  if (t instanceof V) {
1031
1031
  const o = t.keys.length === 1 ? "key" : "keys";
1032
1032
  return /* @__PURE__ */ l(x, { variant: "danger", children: [
@@ -1074,7 +1074,7 @@ function Ze(e) {
1074
1074
  /* @__PURE__ */ r("br", {}),
1075
1075
  /* @__PURE__ */ r("pre", { className: "mt-3", children: n(t) }),
1076
1076
  /* @__PURE__ */ r("br", {})
1077
- ] }) : /* @__PURE__ */ r(Be, { ...e });
1077
+ ] }) : /* @__PURE__ */ r(fe, { ...e });
1078
1078
  }
1079
1079
  const ie = {
1080
1080
  hasError: !1,
@@ -1091,10 +1091,17 @@ class Je extends se {
1091
1091
  return { hasError: !0 };
1092
1092
  }
1093
1093
  componentDidCatch(t) {
1094
- t instanceof H && this.setState({
1094
+ t instanceof M ? this.setState({
1095
1095
  hasError: !0,
1096
1096
  message: t.message,
1097
1097
  error: t
1098
+ }) : this.props.unhandledComponentDidCatch && this.props.unhandledComponentDidCatch(t, (n) => {
1099
+ this.setState({
1100
+ hasError: !0,
1101
+ message: t.message,
1102
+ error: t,
1103
+ ...n
1104
+ });
1098
1105
  });
1099
1106
  }
1100
1107
  // https://github.com/bvaughn/react-error-boundary/blob/23a4d779744f3079dfe0960acaa4bdfd5dede87b/src/ErrorBoundary.ts#L53
@@ -1102,26 +1109,37 @@ class Je extends se {
1102
1109
  this.state.hasError && n.error !== void 0 && t.resetKey !== this.props.resetKey && this.setState(ie);
1103
1110
  }
1104
1111
  render() {
1105
- return this.state.hasError ? /* @__PURE__ */ l($, { className: "mt-2", children: [
1106
- /* @__PURE__ */ r("h4", { children: "Something went wrong" }),
1107
- /* @__PURE__ */ r(
1108
- Ze,
1109
- {
1110
- message: this.state.message,
1111
- error: this.state.error
1112
- }
1113
- ),
1114
- /* @__PURE__ */ l("p", { children: [
1115
- "This error has been logged. Please",
1116
- " ",
1117
- /* @__PURE__ */ l(y, { size: "sm", onClick: this.reload, children: [
1118
- /* @__PURE__ */ r("i", { className: "fa fa-refresh" }),
1119
- " Reload"
1120
- ] }),
1121
- " ",
1122
- "the application"
1123
- ] })
1124
- ] }) : this.props.children;
1112
+ if (this.state.hasError) {
1113
+ const { UnhandledErrorComponent: t } = this.props, { hasError: n, ...i } = this.state;
1114
+ return /* @__PURE__ */ l($, { className: "mt-2", children: [
1115
+ /* @__PURE__ */ r("h4", { children: "Something went wrong" }),
1116
+ this.state.error instanceof M && /* @__PURE__ */ r(
1117
+ Ze,
1118
+ {
1119
+ message: this.state.message,
1120
+ error: this.state.error
1121
+ }
1122
+ ),
1123
+ !(this.state.error instanceof M) && /* @__PURE__ */ r(v, { children: t ? /* @__PURE__ */ r(t, { ...i }) : /* @__PURE__ */ r(
1124
+ fe,
1125
+ {
1126
+ message: this.state.message,
1127
+ error: this.state.error
1128
+ }
1129
+ ) }),
1130
+ /* @__PURE__ */ l("p", { children: [
1131
+ "This error has been logged. Please",
1132
+ " ",
1133
+ /* @__PURE__ */ l(y, { size: "sm", onClick: this.reload, children: [
1134
+ /* @__PURE__ */ r("i", { className: "fa fa-refresh" }),
1135
+ " Reload"
1136
+ ] }),
1137
+ " ",
1138
+ "the application"
1139
+ ] })
1140
+ ] });
1141
+ }
1142
+ return this.props.children;
1125
1143
  }
1126
1144
  }
1127
1145
  function Qe(e, t, n) {
@@ -1144,7 +1162,7 @@ function G(e, t, n) {
1144
1162
  if (n !== void 0 && typeof n != "boolean")
1145
1163
  throw new g(e, t, "An optional boolean is expected");
1146
1164
  }
1147
- function fe(e, t, n) {
1165
+ function me(e, t, n) {
1148
1166
  if (n !== void 0 && typeof n != "string")
1149
1167
  throw new g(e, t, "An optional string is expected");
1150
1168
  }
@@ -1188,7 +1206,7 @@ function it(e, t, n) {
1188
1206
  });
1189
1207
  }
1190
1208
  }
1191
- function me(e, t, n) {
1209
+ function pe(e, t, n) {
1192
1210
  if (n !== void 0 && typeof n != "number")
1193
1211
  throw new g(e, t, "An optional number is expected");
1194
1212
  }
@@ -1210,7 +1228,7 @@ function at(e, t, n) {
1210
1228
  });
1211
1229
  }
1212
1230
  }
1213
- function K(e, t) {
1231
+ function U(e, t) {
1214
1232
  const { _parentNode: n, _indexFromParent: i, ...a } = t;
1215
1233
  if (e && Object.keys(a).length > 0)
1216
1234
  throw new V(e, Object.keys(a));
@@ -1228,13 +1246,13 @@ const Bt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1228
1246
  assertBoolean: et,
1229
1247
  assertDataCollectionId: ot,
1230
1248
  assertKeyExpected: Qe,
1231
- assertNoUnknownKeys: K,
1249
+ assertNoUnknownKeys: U,
1232
1250
  assertNumber: tt,
1233
1251
  assertOptionalBackend: st,
1234
1252
  assertOptionalBoolean: G,
1235
- assertOptionalNumber: me,
1253
+ assertOptionalNumber: pe,
1236
1254
  assertOptionalNumberList: at,
1237
- assertOptionalString: fe,
1255
+ assertOptionalString: me,
1238
1256
  assertOptionalStringList: it,
1239
1257
  assertOptionalStringOrStringList: rt,
1240
1258
  assertString: Xe,
@@ -1242,14 +1260,14 @@ const Bt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1242
1260
  }, Symbol.toStringTag, { value: "Module" }));
1243
1261
  function lt({ yamlNode: e, panel: t }) {
1244
1262
  const { type: n, style: i, children: a, ...o } = e;
1245
- return K(e, o), /* @__PURE__ */ r(P, { className: "ymllayout-row gx-0", style: i, children: C(a, (d, s) => O(d, s, t)) });
1263
+ return U(e, o), /* @__PURE__ */ r(P, { className: "ymllayout-row gx-0", style: i, children: C(a, (d, s) => O(d, s, t)) });
1246
1264
  }
1247
1265
  function ct({ yamlNode: e, panel: t }) {
1248
1266
  const { type: n, style: i, xs: a, children: o, ...d } = e;
1249
- return K(e, d), me(e, "xs", a), /* @__PURE__ */ r(
1267
+ return U(e, d), pe(e, "xs", a), /* @__PURE__ */ r(
1250
1268
  E,
1251
1269
  {
1252
- className: T("yamymllayout-col", { col: !!a }),
1270
+ className: H("yamymllayout-col", { col: !!a }),
1253
1271
  style: i,
1254
1272
  xs: a,
1255
1273
  children: C(e.children, (s, h) => O(s, h, t))
@@ -1293,7 +1311,7 @@ function ht(e) {
1293
1311
  nowrap: d,
1294
1312
  ...s
1295
1313
  } = e;
1296
- if (ut(n, "ids", i), fe(n, "groupid", a), G(n, "even", o), G(n, "nowrap", d), K(n, s), !W.HardwareGroup)
1314
+ if (ut(n, "ids", i), me(n, "groupid", a), G(n, "even", o), G(n, "nowrap", d), U(n, s), !W.HardwareGroup)
1297
1315
  return /* @__PURE__ */ r(x, { variant: "warning", children: "No `HardwareGroup` component registered" });
1298
1316
  const h = W.HardwareGroup;
1299
1317
  return /* @__PURE__ */ r(
@@ -1349,9 +1367,9 @@ function gt(e) {
1349
1367
  const wt = () => Math.random().toString(36).slice(2, 15) + Math.random().toString(36).slice(2, 15);
1350
1368
  function yt({ yamlNode: e, panel: t }) {
1351
1369
  const n = [];
1352
- return ve(e.children, (i, a) => {
1370
+ return be(e.children, (i, a) => {
1353
1371
  n.push(
1354
- /* @__PURE__ */ r(be, { eventKey: wt(), title: i.title, children: O(i, 0, !1) }, a)
1372
+ /* @__PURE__ */ r(Ne, { eventKey: wt(), title: i.title, children: O(i, 0, !1) }, a)
1355
1373
  );
1356
1374
  }), t ? /* @__PURE__ */ l(p, { className: "ymllayout-tabs", children: [
1357
1375
  e.title && /* @__PURE__ */ r(p.Header, { children: e.title }),
@@ -1504,7 +1522,7 @@ function Ot(e) {
1504
1522
  }
1505
1523
  function St({ yamlNode: e, panel: t }) {
1506
1524
  const n = e.options || {};
1507
- return /* @__PURE__ */ r(Ue, { panel: t, options: n, children: /* @__PURE__ */ r("div", { children: e.label }) });
1525
+ return /* @__PURE__ */ r(Ge, { panel: t, options: n, children: /* @__PURE__ */ r("div", { children: e.label }) });
1508
1526
  }
1509
1527
  const Et = {
1510
1528
  row: lt,
@@ -1522,7 +1540,7 @@ Object.entries(Et).forEach(([e, t]) => {
1522
1540
  });
1523
1541
  function Qt(e) {
1524
1542
  var n;
1525
- const t = xe(() => he(e.layout), [e.layout]);
1543
+ const t = Me(() => he(e.layout), [e.layout]);
1526
1544
  return t.error ? /* @__PURE__ */ r("div", { className: `${e.className ?? ""} ymllayout-main`, id: e.id, children: /* @__PURE__ */ l(p, { children: [
1527
1545
  /* @__PURE__ */ r(p.Header, { children: "Layout Error" }),
1528
1546
  /* @__PURE__ */ l(p.Contents, { children: [
@@ -1532,15 +1550,23 @@ function Qt(e) {
1532
1550
  ] }),
1533
1551
  /* @__PURE__ */ r(x, { variant: "warning", children: /* @__PURE__ */ r("pre", { className: "mb-0", children: t.error }) })
1534
1552
  ] })
1535
- ] }) }) : /* @__PURE__ */ r("div", { className: `${e.className ?? ""} ymllayout-main`, id: e.id, children: /* @__PURE__ */ r(Je, { resetKey: t, children: (n = t.children) == null ? void 0 : n.map((i, a) => O(i, a)) }) });
1553
+ ] }) }) : /* @__PURE__ */ r("div", { className: `${e.className ?? ""} ymllayout-main`, id: e.id, children: /* @__PURE__ */ r(
1554
+ Je,
1555
+ {
1556
+ resetKey: t,
1557
+ unhandledComponentDidCatch: e.unhandledComponentDidCatch,
1558
+ UnhandledErrorComponent: e.UnhandledErrorComponent,
1559
+ children: (n = t.children) == null ? void 0 : n.map((i, a) => O(i, a))
1560
+ }
1561
+ ) });
1536
1562
  }
1537
1563
  const Xt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1538
1564
  __proto__: null
1539
- }, Symbol.toStringTag, { value: "Module" })), pe = {
1565
+ }, Symbol.toStringTag, { value: "Module" })), ge = {
1540
1566
  hardware: It
1541
1567
  };
1542
1568
  function en(e, t) {
1543
- pe[e] = t;
1569
+ ge[e] = t;
1544
1570
  }
1545
1571
  function xt(e) {
1546
1572
  return /* @__PURE__ */ l(
@@ -1557,7 +1583,7 @@ function xt(e) {
1557
1583
  }
1558
1584
  function tn(e) {
1559
1585
  const t = C(e.monitors, (n, i) => {
1560
- const a = n.type ?? "hardware", o = pe[a];
1586
+ const a = n.type ?? "hardware", o = ge[a];
1561
1587
  return o === void 0 ? /* @__PURE__ */ r(
1562
1588
  xt,
1563
1589
  {
@@ -1570,7 +1596,7 @@ function tn(e) {
1570
1596
  return /* @__PURE__ */ r(
1571
1597
  "div",
1572
1598
  {
1573
- className: T(
1599
+ className: H(
1574
1600
  { "ms-auto": e.margin === "start" },
1575
1601
  "me-auto",
1576
1602
  "monitor-panel",
@@ -1587,7 +1613,7 @@ const Z = {};
1587
1613
  function nn(e, t) {
1588
1614
  Z[e] = t;
1589
1615
  }
1590
- function ge(e) {
1616
+ function we(e) {
1591
1617
  if (!Z.useHardware)
1592
1618
  throw new Error("No `useHardware` hook registered");
1593
1619
  return Z.useHardware(e);
@@ -1605,17 +1631,17 @@ const At = (e, t, n) => {
1605
1631
  if (e in i)
1606
1632
  return i[e](t, n);
1607
1633
  };
1608
- function we(e, t, n) {
1634
+ function ye(e, t, n) {
1609
1635
  const i = e.split(t);
1610
1636
  return n ? [i.slice(0, -n).join(t)].concat(i.slice(-n)) : i;
1611
1637
  }
1612
1638
  function ae(e) {
1613
- const t = e !== void 0 ? we(e, ".", 1) : [null, ""], n = ge(t[0]);
1639
+ const t = e !== void 0 ? ye(e, ".", 1) : [null, ""], n = we(t[0]);
1614
1640
  if (n && n.properties && t[1] !== null)
1615
1641
  return Array.isArray(n.properties[t[1]]) ? n.properties[t[1]][0] : n.properties[t[1]];
1616
1642
  }
1617
1643
  function kt(e) {
1618
- const t = e !== void 0 && !e.includes("."), n = e !== void 0 ? we(e, ".", 1) : [null, ""], i = ge(n[0]);
1644
+ const t = e !== void 0 && !e.includes("."), n = e !== void 0 ? ye(e, ".", 1) : [null, ""], i = we(n[0]);
1619
1645
  if (t)
1620
1646
  return e;
1621
1647
  if (i && i.properties && n[1] !== null)
@@ -1628,13 +1654,13 @@ function It(e) {
1628
1654
  Number.isNaN(o) || String(o).length > 5 && (n = o.toPrecision(5));
1629
1655
  let d;
1630
1656
  t.comparator && t.comparison && (d = At(t.comparator, n, t.comparison) ? "valid" : "invalid"), Number.isNaN(o) || i !== void 0 && (n = `${n} ${i}`);
1631
- let s = U;
1657
+ let s = q;
1632
1658
  const h = {};
1633
1659
  if (a) {
1634
1660
  const u = `${a}`;
1635
- let c = U;
1661
+ let c = q;
1636
1662
  u.includes(`
1637
- `) && (c = "pre"), s = F, h.placement = "bottom", h.overlay = /* @__PURE__ */ r(Ne, {
1663
+ `) && (c = "pre"), s = R, h.placement = "bottom", h.overlay = /* @__PURE__ */ r(Ce, {
1638
1664
  id: "tooltipid",
1639
1665
  className: "monitor-panel-tooltip",
1640
1666
  // @ts-expect-error
@@ -1643,7 +1669,7 @@ function It(e) {
1643
1669
  }
1644
1670
  return (
1645
1671
  // @ts-expect-error
1646
- /* @__PURE__ */ Me(s, { ...h, key: t.name }, /* @__PURE__ */ l(Mt, { children: [
1672
+ /* @__PURE__ */ Ae(s, { ...h, key: t.name }, /* @__PURE__ */ l(Mt, { children: [
1647
1673
  /* @__PURE__ */ r("h1", { children: t.name }),
1648
1674
  /* @__PURE__ */ r("div", { className: d, children: `${n}` })
1649
1675
  ] }))
@@ -1652,15 +1678,15 @@ function It(e) {
1652
1678
  export {
1653
1679
  _t as Formatting,
1654
1680
  Pt as Frontend,
1655
- Ye as FullSizer,
1681
+ Ue as FullSizer,
1656
1682
  Xt as HWObject,
1657
1683
  re as HardwareInputNumber,
1658
- _e as HardwareNumericStep,
1684
+ Pe as HardwareNumericStep,
1659
1685
  Wt as HardwareSchema,
1660
1686
  Lt as HardwareState,
1661
1687
  Y as HardwareTemplate,
1662
1688
  Gt as HardwareTypes,
1663
- Ut as HardwareVariant,
1689
+ qt as HardwareVariant,
1664
1690
  Vt as Info,
1665
1691
  g as KeyError,
1666
1692
  L as MissingKeysError,
@@ -1669,12 +1695,12 @@ export {
1669
1695
  Mt as MonitorPanelItem,
1670
1696
  jt as MotorDefault,
1671
1697
  Yt as Multiposition,
1672
- Kt as NoObject,
1673
- He as NumericStep,
1698
+ Ut as NoObject,
1699
+ _e as NumericStep,
1674
1700
  p as Panel,
1675
- zt as Property,
1676
- qt as ShutterDefault,
1677
- I as TypeIcon,
1701
+ Kt as Property,
1702
+ zt as ShutterDefault,
1703
+ D as TypeIcon,
1678
1704
  Je as YAMLErrorBoundary,
1679
1705
  Qt as YAMLLayout,
1680
1706
  Bt as YamlAsserts,