quantum-component-library 1.4.69 → 1.4.71

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.
Files changed (45) hide show
  1. package/dist/components/parameter-edit-list/index.d.ts +2 -1
  2. package/dist/components.cjs +1 -1
  3. package/dist/components.js +1428 -1398
  4. package/dist/{dnd-core-vendor-Dpm8Ha_h.cjs → dnd-core-vendor-BQo1WiA6.cjs} +1 -1
  5. package/dist/{dnd-core-vendor-BvkN08kD.js → dnd-core-vendor-NmXYCL5j.js} +2 -2
  6. package/dist/generated/graphql.d.ts +601 -6
  7. package/dist/generated-graphql.cjs +1 -1
  8. package/dist/generated-graphql.js +83 -76
  9. package/dist/{graphql-vendor-ipMKtdBu.js → graphql-vendor-BOwWQmc4.js} +1 -1
  10. package/dist/{graphql-vendor-CSrUjvOC.cjs → graphql-vendor-CMjSICJP.cjs} +1 -1
  11. package/dist/hooks.cjs +1 -1
  12. package/dist/hooks.js +3 -3
  13. package/dist/index.cjs +1 -1
  14. package/dist/index.js +47 -46
  15. package/dist/lib/types/sensor-info.test.d.ts +1 -0
  16. package/dist/lib/utils/parameters.d.ts +14 -1
  17. package/dist/lib/utils/parameters.test.d.ts +1 -0
  18. package/dist/{lodash-vendor-CfNg9qwP.cjs → lodash-vendor-CGEP7jch.cjs} +1 -1
  19. package/dist/{lodash-vendor-CY4G3-79.js → lodash-vendor-Deq42ySR.js} +1 -1
  20. package/dist/{other-CPHWCRXi.js → other-Bp68Uzz1.js} +3 -3
  21. package/dist/{other-B_xypnnb.cjs → other-Bsl3n3tj.cjs} +1 -1
  22. package/dist/{react-dnd-vendor-DvbjNa5U.cjs → react-dnd-vendor-CPQdLxxA.cjs} +1 -1
  23. package/dist/{react-dnd-vendor-DYesaYGm.js → react-dnd-vendor-D7ujbWN2.js} +2 -2
  24. package/dist/react-icons-vendor-D3in8HbI.cjs +1 -0
  25. package/dist/{react-icons-vendor-DqOJrTLA.js → react-icons-vendor-bPI9-m-x.js} +26 -22
  26. package/dist/{react-select-vendor-B0QF8gkj.js → react-select-vendor-B-vWCyYj.js} +1 -1
  27. package/dist/{react-select-vendor-BLLqfZvd.cjs → react-select-vendor-Dletsq31.cjs} +1 -1
  28. package/dist/services-human-Cl36G8mV.cjs +1 -0
  29. package/dist/{services-human-D5IllQkM.js → services-human-mjbBM3xQ.js} +2 -2
  30. package/dist/services.cjs +1 -1
  31. package/dist/services.js +1 -1
  32. package/dist/types.cjs +1 -1
  33. package/dist/types.js +13 -13
  34. package/dist/{utils-conversion-DFO1UVSN.cjs → utils-conversion-CBAxJ_Vx.cjs} +1 -1
  35. package/dist/{utils-conversion-BQfLNP0g.js → utils-conversion-Dmt0JwSC.js} +1 -1
  36. package/dist/{utils-parameters-DkefNhWo.js → utils-parameters-BiyUnm5t.js} +17 -7
  37. package/dist/utils-parameters-Bx16_6xw.cjs +1 -0
  38. package/dist/utils.cjs +1 -1
  39. package/dist/utils.js +19 -18
  40. package/dist/{vendor-DeYnrakH.cjs → vendor-CNEuzHxC.cjs} +1 -1
  41. package/dist/{vendor-BSFJsa1P.js → vendor-D_9BWGCW.js} +1 -1
  42. package/package.json +1 -1
  43. package/dist/react-icons-vendor-c4NUuwCE.cjs +0 -1
  44. package/dist/services-human-DFPelsei.cjs +0 -1
  45. package/dist/utils-parameters-dwKmz1VU.cjs +0 -1
@@ -1,192 +1,193 @@
1
1
  import { j as e } from "./react-jsx-runtime-vendor-OVHDjVDe.js";
2
2
  import "./moment-vendor-DMLRxgRE.js";
3
- import { Flex as Me, InputGroup as ct, InputLeftElement as Pt, Icon as Ct, Input as ye, FormLabel as _e, ButtonGroup as Ne, Tooltip as rt, Button as te, Box as se, RangeSlider as _t, RangeSliderMark as st, Text as M, RangeSliderTrack as Et, RangeSliderFilledTrack as zt, RangeSliderThumb as dt, Select as ut, NumberInput as mt, NumberInputField as ht, HStack as V, Tag as Ge, FormControl as X, TableContainer as Bt, Table as Ut, Thead as Wt, Tr as pt, Th as De, Tbody as Qt, Td as We, IconButton as ot, Image as qt, useToast as wt, VStack as ue, RadioGroup as It, Radio as Ze, Alert as Ve, AlertIcon as et, Spinner as St, useDisclosure as Kt, Modal as Ht, ModalOverlay as Yt, ModalContent as Jt, ModalHeader as Xt, ModalCloseButton as Zt, ModalBody as Vt, ModalFooter as en, Badge as Oe, Tabs as tn, TabList as nn, Tab as gt, TabPanels as sn, TabPanel as xt, Textarea as Qe, Switch as on } from "@chakra-ui/react";
4
- import { useMemo as $, useState as q, useEffect as ce, useCallback as _, createContext as rn, useContext as an, memo as Ae, useRef as ln } from "react";
5
- import { getFragmentData as A } from "./generated.js";
6
- import { G as at, M as je, a as be, b as Lt, c as cn, C as it, d as kt, e as Mt, R as Fe, f as Pe, T as Te, A as ve, g as dn, h as At, U as Ot, i as Ye, j as Tt, k as un, l as mn, m as hn, n as pn, o as gn, p as xn } from "./graphql-DFQnN0la.js";
3
+ import { Flex as Me, InputGroup as ut, InputLeftElement as _t, Icon as at, Input as ye, FormLabel as ze, ButtonGroup as Ne, Tooltip as it, Button as ne, Box as se, RangeSlider as zt, RangeSliderMark as ot, Text as S, RangeSliderTrack as Et, RangeSliderFilledTrack as Bt, RangeSliderThumb as mt, Select as ht, NumberInput as pt, NumberInputField as gt, HStack as V, Tag as Ge, FormControl as X, TableContainer as Ut, Table as Wt, Thead as Qt, Tr as xt, Th as De, Tbody as qt, Td as Qe, IconButton as Ze, Image as Kt, useToast as It, VStack as ue, RadioGroup as St, Radio as Ve, Alert as et, AlertIcon as tt, Spinner as Lt, useDisclosure as Ht, Modal as Yt, ModalOverlay as Jt, ModalContent as Xt, ModalHeader as Zt, ModalCloseButton as Vt, ModalBody as en, ModalFooter as tn, Badge as Oe, Tabs as nn, TabList as sn, Tab as ft, TabPanels as on, TabPanel as jt, Textarea as qe, Switch as rn } from "@chakra-ui/react";
4
+ import { useMemo as N, useState as K, useEffect as ce, useCallback as E, createContext as an, useContext as ln, memo as Ae, useRef as cn } from "react";
5
+ import { getFragmentData as k } from "./generated.js";
6
+ import { G as lt, M as je, a as be, b as kt, c as dn, C as ct, d as Mt, e as At, R as Pe, f as _e, T as Te, A as Ce, g as un, h as Ot, U as Tt, i as Ye, j as Nt, k as mn, l as hn, m as pn, n as gn, o as xn, p as fn } from "./graphql-DFQnN0la.js";
7
7
  import { c as Je } from "./utils-cn-CgdSr4hO.js";
8
- import "./lodash-vendor-CY4G3-79.js";
9
- import { useClient as lt, useQuery as Ce, useMutation as fe } from "urql";
10
- import { useUiLabelContext as xe, useAllPartParameters as fn } from "./hooks.js";
11
- import { u as jn } from "./ufuzzy-vendor-Dl0ZI6Av.js";
12
- import { s as he } from "./react-select-vendor-B0QF8gkj.js";
13
- import { F as bn, a as yn, b as vn, c as Cn, d as wn, e as In } from "./react-icons-vendor-DqOJrTLA.js";
8
+ import { sensorLocationName as jn, availablePlanes as bt, getAnalysisPartIdNoSide as Ke } from "./types.js";
9
+ import "./lodash-vendor-Deq42ySR.js";
10
+ import { useClient as dt, useQuery as ve, useMutation as fe } from "urql";
11
+ import { useUiLabelContext as xe, useAllPartParameters as bn } from "./hooks.js";
12
+ import { u as yn } from "./ufuzzy-vendor-Dl0ZI6Av.js";
13
+ import { s as he } from "./react-select-vendor-B-vWCyYj.js";
14
+ import { F as Cn, a as vn, b as wn, c as In, d as Sn, e as Ln, f as kn } from "./react-icons-vendor-bPI9-m-x.js";
14
15
  import { reportKindName as ke } from "./services.js";
15
- import { D as Sn, H as Ln, u as kn, a as Mn } from "./react-dnd-vendor-DYesaYGm.js";
16
- import { g as Nt, a as Rt, b as An, c as On, d as Tn, e as ft, f as jt } from "./services-human-D5IllQkM.js";
17
- import { ThresholdKind as Xe, ReportKind as ie, ActionLaterality as Nn, SensorLocation as me } from "./generated-graphql.js";
18
- import { availablePlanes as bt, getAnalysisPartIdNoSide as qe } from "./types.js";
19
- const Rn = ({
20
- setSearch: s,
16
+ import { D as Mn, H as An, u as On, a as Tn } from "./react-dnd-vendor-D7ujbWN2.js";
17
+ import { g as Rt, a as $t, b as Nn, c as Rn, d as $n, e as yt, f as Ct } from "./services-human-mjbBM3xQ.js";
18
+ import { ThresholdKind as Xe, ReportKind as ie, ActionLaterality as Dn, SensorLocation as me } from "./generated-graphql.js";
19
+ import { f as rt } from "./utils-parameters-BiyUnm5t.js";
20
+ const Fn = ({
21
+ setSearch: n,
21
22
  actions: t,
22
23
  updateUseCases: r,
23
- hideUseCaseFilter: p = !1
24
+ hideUseCaseFilter: g = !1
24
25
  }) => {
25
- const m = $(
26
- () => t?.flatMap((h) => h.useCases).filter((h, d, g) => g.findIndex((n) => n.id === h.id) === d).map((h) => ({
27
- label: h.name,
28
- value: h.id
26
+ const u = N(
27
+ () => t?.flatMap((m) => m.useCases).filter((m, h, x) => x.findIndex((s) => s.id === m.id) === h).map((m) => ({
28
+ label: m.name,
29
+ value: m.id
29
30
  })) || [],
30
31
  [t]
31
32
  );
32
33
  return /* @__PURE__ */ e.jsxs(Me, { width: "100%", alignContent: "space-evenly", gap: 4, children: [
33
- /* @__PURE__ */ e.jsxs(ct, { size: "md", flex: 1, children: [
34
- /* @__PURE__ */ e.jsx(Pt, { children: /* @__PURE__ */ e.jsx(Ct, { as: bn, color: "gray.300" }) }),
34
+ /* @__PURE__ */ e.jsxs(ut, { size: "md", flex: 1, children: [
35
+ /* @__PURE__ */ e.jsx(_t, { children: /* @__PURE__ */ e.jsx(at, { as: Cn, color: "gray.300" }) }),
35
36
  /* @__PURE__ */ e.jsx(
36
37
  ye,
37
38
  {
38
39
  placeholder: "Search by name...",
39
40
  width: "100%",
40
- maxW: p ? void 0 : "30rem",
41
- onChange: (h) => s(h.target.value)
41
+ maxW: g ? void 0 : "30rem",
42
+ onChange: (m) => n(m.target.value)
42
43
  }
43
44
  )
44
45
  ] }),
45
- !p && /* @__PURE__ */ e.jsx(ct, { size: "md", children: /* @__PURE__ */ e.jsx(
46
+ !g && /* @__PURE__ */ e.jsx(ut, { size: "md", children: /* @__PURE__ */ e.jsx(
46
47
  he,
47
48
  {
48
49
  size: "md",
49
50
  chakraStyles: {
50
- container: (h) => ({
51
- ...h,
51
+ container: (m) => ({
52
+ ...m,
52
53
  width: "100%"
53
54
  })
54
55
  },
55
56
  menuPortalTarget: document.body,
56
57
  placeholder: "Filter use case",
57
58
  isMulti: !0,
58
- options: m,
59
- onChange: (h) => r(h.map((d) => d.value))
59
+ options: u,
60
+ onChange: (m) => r(m.map((h) => h.value))
60
61
  }
61
62
  ) })
62
63
  ] });
63
64
  }, ge = ({
64
- children: s
65
- }) => /* @__PURE__ */ e.jsx(_e, { fontWeight: "bold", fontFamily: "sans-serif", fontSize: "large", children: s }), $n = ({
66
- items: s,
65
+ children: n
66
+ }) => /* @__PURE__ */ e.jsx(ze, { fontWeight: "bold", fontFamily: "sans-serif", fontSize: "large", children: n }), Gn = ({
67
+ items: n,
67
68
  onChange: t,
68
69
  selectedItem: r,
69
- isDisabled: p,
70
- selectedProps: m,
71
- buttonProps: h
70
+ isDisabled: g,
71
+ selectedProps: u,
72
+ buttonProps: m
72
73
  }) => {
73
- const d = (n) => n === r || n.value === r, g = (n) => d(n) ? { ...h, ...m } : h;
74
- return /* @__PURE__ */ e.jsx(Ne, { isAttached: !0, isDisabled: p, children: s.map((n, o) => /* @__PURE__ */ e.jsx(
75
- rt,
74
+ const h = (s) => s === r || s.value === r, x = (s) => h(s) ? { ...m, ...u } : m;
75
+ return /* @__PURE__ */ e.jsx(Ne, { isAttached: !0, isDisabled: g, children: n.map((s, o) => /* @__PURE__ */ e.jsx(
76
+ it,
76
77
  {
77
- label: n.tooltip,
78
+ label: s.tooltip,
78
79
  openDelay: 50,
79
80
  closeDelay: 200,
80
81
  placement: "top",
81
- visibility: n.tooltip ? "visible" : "hidden",
82
+ visibility: s.tooltip ? "visible" : "hidden",
82
83
  hasArrow: !0,
83
84
  children: /* @__PURE__ */ e.jsx(
84
- te,
85
+ ne,
85
86
  {
86
- onClick: () => d(n) ? null : t(n, o),
87
- isDisabled: n.disabled,
88
- ...g(n),
89
- children: n.label
87
+ onClick: () => h(s) ? null : t(s, o),
88
+ isDisabled: s.disabled,
89
+ ...x(s),
90
+ children: s.label
90
91
  }
91
92
  )
92
93
  },
93
94
  o
94
95
  )) });
95
- }, Ke = (s, t) => t < 0 ? -1 * Math.abs(s) : Math.abs(s), Dn = ({
96
- isReversed: s,
96
+ }, He = (n, t) => t < 0 ? -1 * Math.abs(n) : Math.abs(n), Pn = ({
97
+ isReversed: n,
97
98
  min: t,
98
99
  max: r,
99
- value: p,
100
- onChange: m,
101
- inputProps: h,
102
- size: d,
103
- zeroMarker: g,
104
- formatValue: n,
100
+ value: g,
101
+ onChange: u,
102
+ inputProps: m,
103
+ size: h,
104
+ zeroMarker: x,
105
+ formatValue: s,
105
106
  valueLabel: o,
106
- positiveNegativeLabels: u,
107
- isDisabled: y,
108
- ...b
107
+ positiveNegativeLabels: b,
108
+ isDisabled: j,
109
+ ...L
109
110
  }) => {
110
- const [w, I] = q([void 0, void 0]), L = w[0], f = w[1], c = g && t < -5 && r > 5, k = Number(p?.[0] ?? f ?? t) > 0 ? 1 : -1, x = Number(p?.[1] ?? f ?? r) < 0 ? -1 : 1, N = u?.[0] === u?.[1], v = p?.[0], E = p?.[1];
111
+ const [M, f] = K([void 0, void 0]), C = M[0], p = M[1], c = x && t < -5 && r > 5, A = Number(g?.[0] ?? p ?? t) > 0 ? 1 : -1, d = Number(g?.[1] ?? p ?? r) < 0 ? -1 : 1, D = b?.[0] === b?.[1], v = g?.[0], z = g?.[1];
111
112
  ce(() => {
112
- v !== void 0 && E !== void 0 && I([v.toFixed(0), E.toFixed(0)]);
113
- }, [v, E, I]);
114
- const R = _(
115
- ([T, B]) => {
116
- T < B && I([T.toFixed(0), B.toFixed(0)]);
113
+ v !== void 0 && z !== void 0 && f([v.toFixed(0), z.toFixed(0)]);
114
+ }, [v, z, f]);
115
+ const T = E(
116
+ ([O, W]) => {
117
+ O < W && f([O.toFixed(0), W.toFixed(0)]);
117
118
  },
118
- [I]
119
- ), O = _(
120
- ([T, B]) => {
121
- T < B && m([T, B]);
119
+ [f]
120
+ ), F = E(
121
+ ([O, W]) => {
122
+ O < W && u([O, W]);
122
123
  },
123
- [m]
124
- ), K = _(() => {
125
- I(([T, B]) => {
126
- const J = isNaN(Number(T)) ? t : Number(T), U = isNaN(Number(B)) ? r : Number(B), Y = Ke(Number(J), k), i = Ke(Number(U), x), a = k < 0 ? Math.max(Y, t) : Math.min(Y, r), C = x < 0 ? Math.max(i, t) : Math.min(i, r);
127
- return a > C ? (m([C, a]), [C.toFixed(0), a.toFixed(0)]) : (m([a, C]), [a.toFixed(0), C.toFixed(0)]);
124
+ [u]
125
+ ), G = E(() => {
126
+ f(([O, W]) => {
127
+ const J = isNaN(Number(O)) ? t : Number(O), U = isNaN(Number(W)) ? r : Number(W), Y = He(Number(J), A), i = He(Number(U), d), a = A < 0 ? Math.max(Y, t) : Math.min(Y, r), w = d < 0 ? Math.max(i, t) : Math.min(i, r);
128
+ return a > w ? (u([w, a]), [w.toFixed(0), a.toFixed(0)]) : (u([a, w]), [a.toFixed(0), w.toFixed(0)]);
128
129
  });
129
- }, [m, I, k, x, t, r]), oe = _(
130
- (T) => {
131
- const B = T === "" || isNaN(Number(T)) ? T : Ke(Number(T), k);
132
- I(([J, U]) => [B.toString(), U]);
130
+ }, [u, f, A, d, t, r]), oe = E(
131
+ (O) => {
132
+ const W = O === "" || isNaN(Number(O)) ? O : He(Number(O), A);
133
+ f(([J, U]) => [W.toString(), U]);
133
134
  },
134
- [I, k]
135
- ), D = _(
136
- (T) => {
137
- const B = T === "" || isNaN(Number(T)) ? T : Ke(Number(T), x);
138
- I(([J, U]) => [J, B.toString()]);
135
+ [f, A]
136
+ ), P = E(
137
+ (O) => {
138
+ const W = O === "" || isNaN(Number(O)) ? O : He(Number(O), d);
139
+ f(([J, U]) => [J, W.toString()]);
139
140
  },
140
- [I, x]
141
- ), ae = $(
142
- () => d === "xs" ? "0.75rem" : void 0,
143
- [d]
144
- ), Z = _(
145
- (T, B) => {
146
- const J = Number(B.target.value);
147
- if (!L || !f || ![-1, 1].includes(J))
141
+ [f, d]
142
+ ), ae = N(
143
+ () => h === "xs" ? "0.75rem" : void 0,
144
+ [h]
145
+ ), Z = E(
146
+ (O, W) => {
147
+ const J = Number(W.target.value);
148
+ if (!C || !p || ![-1, 1].includes(J))
148
149
  return;
149
- const U = (a) => J < 0 ? -1 * Math.abs(a) : Math.abs(a), Y = T ? U(Number(L)) : Number(L), i = T ? Number(f) : U(Number(f));
150
- Y > i ? m([i, Y]) : m([Y, i]);
150
+ const U = (a) => J < 0 ? -1 * Math.abs(a) : Math.abs(a), Y = O ? U(Number(C)) : Number(C), i = O ? Number(p) : U(Number(p));
151
+ Y > i ? u([i, Y]) : u([Y, i]);
151
152
  },
152
- [L, f, m]
153
+ [C, p, u]
153
154
  );
154
- return /* @__PURE__ */ e.jsxs(Me, { direction: "column", ...b, children: [
155
+ return /* @__PURE__ */ e.jsxs(Me, { direction: "column", ...L, children: [
155
156
  /* @__PURE__ */ e.jsx(se, { pt: "1em", mb: "-0.5em", children: /* @__PURE__ */ e.jsxs(
156
- _t,
157
+ zt,
157
158
  {
158
159
  "aria-label": ["min", "max"],
159
- isReversed: s,
160
- value: [Number(L ?? t), Number(f ?? r)],
160
+ isReversed: n,
161
+ value: [Number(C ?? t), Number(p ?? r)],
161
162
  max: r,
162
163
  min: t,
163
164
  minStepsBetweenThumbs: 3,
164
165
  step: 1,
165
- onChange: R,
166
- onChangeEnd: O,
167
- isDisabled: y,
166
+ onChange: T,
167
+ onChangeEnd: F,
168
+ isDisabled: j,
168
169
  children: [
169
- /* @__PURE__ */ e.jsx(st, { value: t, top: "-1em", children: /* @__PURE__ */ e.jsx(
170
- M,
170
+ /* @__PURE__ */ e.jsx(ot, { value: t, top: "-1em", children: /* @__PURE__ */ e.jsx(
171
+ S,
171
172
  {
172
- fontSize: d ?? "sm",
173
+ fontSize: h ?? "sm",
173
174
  fontWeight: "semibold",
174
175
  whiteSpace: "nowrap",
175
- children: n ? n?.(t) : t
176
+ children: s ? s?.(t) : t
176
177
  }
177
178
  ) }),
178
- /* @__PURE__ */ e.jsx(st, { value: r, top: "-1em", children: /* @__PURE__ */ e.jsx(
179
- M,
179
+ /* @__PURE__ */ e.jsx(ot, { value: r, top: "-1em", children: /* @__PURE__ */ e.jsx(
180
+ S,
180
181
  {
181
- fontSize: d ?? "sm",
182
+ fontSize: h ?? "sm",
182
183
  fontWeight: "semibold",
183
184
  style: { transform: "translateX(-100%)" },
184
185
  whiteSpace: "nowrap",
185
- children: n ? n(r) : r
186
+ children: s ? s(r) : r
186
187
  }
187
188
  ) }),
188
- c && /* @__PURE__ */ e.jsxs(st, { value: 0, top: "-1em", pos: "relative", children: [
189
- /* @__PURE__ */ e.jsx(M, { fontSize: d, fontWeight: "semibold", children: n?.(0) ?? "0" }),
189
+ c && /* @__PURE__ */ e.jsxs(ot, { value: 0, top: "-1em", pos: "relative", children: [
190
+ /* @__PURE__ */ e.jsx(S, { fontSize: h, fontWeight: "semibold", children: s?.(0) ?? "0" }),
190
191
  /* @__PURE__ */ e.jsx(
191
192
  se,
192
193
  {
@@ -199,31 +200,31 @@ const Rn = ({
199
200
  }
200
201
  )
201
202
  ] }),
202
- /* @__PURE__ */ e.jsx(Et, { children: /* @__PURE__ */ e.jsx(zt, {}) }),
203
- /* @__PURE__ */ e.jsx(dt, { index: 0, w: ae, h: ae }),
204
- /* @__PURE__ */ e.jsx(dt, { index: 1, w: ae, h: ae })
203
+ /* @__PURE__ */ e.jsx(Et, { children: /* @__PURE__ */ e.jsx(Bt, {}) }),
204
+ /* @__PURE__ */ e.jsx(mt, { index: 0, w: ae, h: ae }),
205
+ /* @__PURE__ */ e.jsx(mt, { index: 1, w: ae, h: ae })
205
206
  ]
206
207
  }
207
208
  ) }),
208
209
  o && /* @__PURE__ */ e.jsxs(
209
210
  Me,
210
211
  {
211
- direction: s ? "row-reverse" : "row",
212
+ direction: n ? "row-reverse" : "row",
212
213
  justifyContent: "space-between",
213
214
  children: [
214
215
  /* @__PURE__ */ e.jsx(
215
- M,
216
+ S,
216
217
  {
217
- fontSize: d ?? "sm",
218
+ fontSize: h ?? "sm",
218
219
  fontWeight: "semibold",
219
220
  whiteSpace: "nowrap",
220
221
  children: o(t)
221
222
  }
222
223
  ),
223
224
  /* @__PURE__ */ e.jsx(
224
- M,
225
+ S,
225
226
  {
226
- fontSize: d ?? "sm",
227
+ fontSize: h ?? "sm",
227
228
  fontWeight: "semibold",
228
229
  whiteSpace: "nowrap",
229
230
  children: o(r)
@@ -235,43 +236,43 @@ const Rn = ({
235
236
  /* @__PURE__ */ e.jsxs(
236
237
  Me,
237
238
  {
238
- direction: s ? "row-reverse" : "row",
239
+ direction: n ? "row-reverse" : "row",
239
240
  justifyContent: "center",
240
241
  alignItems: "center",
241
242
  gap: "0.125em",
242
243
  children: [
243
- u && /* @__PURE__ */ e.jsxs(
244
- ut,
244
+ b && /* @__PURE__ */ e.jsxs(
245
+ ht,
245
246
  {
246
247
  width: "auto",
247
- size: d,
248
+ size: h,
248
249
  fontWeight: "bold",
249
- value: k,
250
- onChange: (T) => Z(!0, T),
251
- isDisabled: N || y,
250
+ value: A,
251
+ onChange: (O) => Z(!0, O),
252
+ isDisabled: D || j,
252
253
  children: [
253
- /* @__PURE__ */ e.jsx("option", { value: -1, children: u[0] }),
254
- /* @__PURE__ */ e.jsx("option", { value: 1, children: u[1] })
254
+ /* @__PURE__ */ e.jsx("option", { value: -1, children: b[0] }),
255
+ /* @__PURE__ */ e.jsx("option", { value: 1, children: b[1] })
255
256
  ]
256
257
  }
257
258
  ),
258
259
  /* @__PURE__ */ e.jsx(
259
- mt,
260
+ pt,
260
261
  {
261
262
  precision: 0,
262
- size: d ?? "sm",
263
+ size: h ?? "sm",
263
264
  min: 0,
264
- max: k < 0 ? Math.abs(t) : E ?? r,
265
- value: L === "" ? "" : Math.abs(Number(L ?? t)),
265
+ max: A < 0 ? Math.abs(t) : z ?? r,
266
+ value: C === "" ? "" : Math.abs(Number(C ?? t)),
266
267
  onChange: oe,
267
- onBlur: K,
268
+ onBlur: G,
268
269
  borderWidth: 1,
269
270
  borderRadius: 3,
270
271
  borderColor: "#ccc",
271
- isDisabled: y,
272
- ...h,
272
+ isDisabled: j,
273
+ ...m,
273
274
  children: /* @__PURE__ */ e.jsx(
274
- ht,
275
+ gt,
275
276
  {
276
277
  backgroundColor: "#fff",
277
278
  paddingRight: 0,
@@ -281,22 +282,22 @@ const Rn = ({
281
282
  }
282
283
  ),
283
284
  /* @__PURE__ */ e.jsx(
284
- mt,
285
+ pt,
285
286
  {
286
- size: d ?? "sm",
287
+ size: h ?? "sm",
287
288
  min: 0,
288
- max: x < 0 ? Math.abs(v ?? t) : r,
289
+ max: d < 0 ? Math.abs(v ?? t) : r,
289
290
  precision: 0,
290
- value: f === "" ? "" : Math.abs(Number(f ?? r)),
291
- onChange: D,
292
- onBlur: K,
291
+ value: p === "" ? "" : Math.abs(Number(p ?? r)),
292
+ onChange: P,
293
+ onBlur: G,
293
294
  borderWidth: 1,
294
295
  borderRadius: 3,
295
296
  borderColor: "#ccc",
296
- isDisabled: y,
297
- ...h,
297
+ isDisabled: j,
298
+ ...m,
298
299
  children: /* @__PURE__ */ e.jsx(
299
- ht,
300
+ gt,
300
301
  {
301
302
  backgroundColor: "#fff",
302
303
  paddingRight: 0,
@@ -305,18 +306,18 @@ const Rn = ({
305
306
  )
306
307
  }
307
308
  ),
308
- u && /* @__PURE__ */ e.jsxs(
309
- ut,
309
+ b && /* @__PURE__ */ e.jsxs(
310
+ ht,
310
311
  {
311
312
  width: "auto",
312
- size: d,
313
+ size: h,
313
314
  fontWeight: "bold",
314
- value: x,
315
- onChange: (T) => Z(!1, T),
316
- isDisabled: N || y,
315
+ value: d,
316
+ onChange: (O) => Z(!1, O),
317
+ isDisabled: D || j,
317
318
  children: [
318
- /* @__PURE__ */ e.jsx("option", { value: -1, children: u[0] }),
319
- /* @__PURE__ */ e.jsx("option", { value: 1, children: u[1] })
319
+ /* @__PURE__ */ e.jsx("option", { value: -1, children: b[0] }),
320
+ /* @__PURE__ */ e.jsx("option", { value: 1, children: b[1] })
320
321
  ]
321
322
  }
322
323
  )
@@ -324,17 +325,17 @@ const Rn = ({
324
325
  }
325
326
  )
326
327
  ] });
327
- }, Gn = ({ tags: s, containerProps: t, ...r }) => /* @__PURE__ */ e.jsx(V, { ...t, children: s.map((p, m) => /* @__PURE__ */ e.jsx(Ge, { ...r, children: p }, m)) }), Fn = new jn({}), Pn = ({
328
- action: s,
328
+ }, _n = ({ tags: n, containerProps: t, ...r }) => /* @__PURE__ */ e.jsx(V, { ...t, children: n.map((g, u) => /* @__PURE__ */ e.jsx(Ge, { ...r, children: g }, u)) }), zn = new yn({}), En = ({
329
+ action: n,
329
330
  quantumIconSrc: t
330
331
  }) => {
331
- const { getLabel: r } = xe(), p = $(() => ({
332
+ const { getLabel: r } = xe(), g = N(() => ({
332
333
  actionLowerCase: r("action").toLocaleLowerCase()
333
334
  }), [r]);
334
- return s.quantumOwned ? /* @__PURE__ */ e.jsx(
335
- rt,
335
+ return n.quantumOwned ? /* @__PURE__ */ e.jsx(
336
+ it,
336
337
  {
337
- label: `This ${p.actionLowerCase} is owned by Quantum`,
338
+ label: `This ${g.actionLowerCase} is owned by Quantum`,
338
339
  "aria-label": "Quantum owned",
339
340
  children: /* @__PURE__ */ e.jsx(
340
341
  se,
@@ -346,81 +347,76 @@ const Rn = ({
346
347
  alignItems: "center",
347
348
  justifyContent: "center",
348
349
  children: /* @__PURE__ */ e.jsx(
349
- qt,
350
+ Kt,
350
351
  {
351
352
  src: t,
352
353
  boxSize: "1em",
353
- alt: `Quantum-owned ${p.actionLowerCase}`
354
+ alt: `Quantum-owned ${g.actionLowerCase}`
354
355
  }
355
356
  )
356
357
  }
357
358
  )
358
359
  }
359
360
  ) : null;
360
- }, _n = (s, t) => {
361
+ }, Bn = (n, t) => {
361
362
  if (!t || !t.trim().length)
362
- return s;
363
- const r = s.map((m) => m.name ?? "");
364
- return Fn.filter(r, t)?.map((m) => s[m]) ?? [];
365
- }, En = (s) => !s || s.length === 0 ? "None" : s.map(
366
- (t) => (
367
- // Convert camelCase to separate words (e.g., 'LeftFoot' -> 'Left Foot')
368
- t.replace(/([A-Z])/g, " $1").trim()
369
- )
370
- ).join(", "), zn = (s, t) => !t || t.length == 0 ? s : s.filter(
371
- (r) => r.useCases?.some((p) => t.includes(p.id)) ?? !1
372
- ), Bn = (s, t, r) => !t || t.length === 0 ? s : s.filter((p) => {
373
- const m = {};
374
- return t.forEach((h) => {
375
- for (const [d, g] of Object.entries(r || {}))
376
- if (g.some((n) => n.id === h)) {
377
- m[d] || (m[d] = []), m[d].push(h);
363
+ return n;
364
+ const r = n.map((u) => u.name ?? "");
365
+ return zn.filter(r, t)?.map((u) => n[u]) ?? [];
366
+ }, Un = (n) => !n || n.length === 0 ? "None" : n.map((t) => jn(t)).join(", "), Wn = (n, t) => !t || t.length == 0 ? n : n.filter(
367
+ (r) => r.useCases?.some((g) => t.includes(g.id)) ?? !1
368
+ ), Qn = (n, t, r) => !t || t.length === 0 ? n : n.filter((g) => {
369
+ const u = {};
370
+ return t.forEach((m) => {
371
+ for (const [h, x] of Object.entries(r || {}))
372
+ if (x.some((s) => s.id === m)) {
373
+ u[h] || (u[h] = []), u[h].push(m);
378
374
  break;
379
375
  }
380
- }), Object.entries(m).every(
381
- ([h, d]) => {
382
- const g = p.metadataGroups?.find((y) => A(je, y).key === h);
383
- if (!g)
376
+ }), Object.entries(u).every(
377
+ ([m, h]) => {
378
+ const x = g.metadataGroups?.find((j) => k(je, j).key === m);
379
+ if (!x)
384
380
  return !1;
385
- const n = A(
381
+ const s = k(
386
382
  je,
387
- g
388
- ), u = A(
383
+ x
384
+ ), b = k(
389
385
  be,
390
- n.data
391
- ).map((y) => y.id);
392
- return d.some(
393
- (y) => u.includes(y)
386
+ s.data
387
+ ).map((j) => j.id);
388
+ return h.some(
389
+ (j) => b.includes(j)
394
390
  );
395
391
  }
396
392
  );
397
- }), Un = ({
398
- actions: s,
393
+ }), qn = ({
394
+ actions: n,
399
395
  totalActions: t,
400
396
  onCreate: r,
401
- onDelete: p,
402
- onEdit: m,
403
- onView: h,
404
- onSelected: d,
405
- onDuplicate: g,
406
- disableMultiSelect: n,
397
+ onDelete: g,
398
+ onEdit: u,
399
+ onView: m,
400
+ onSelected: h,
401
+ onDuplicate: x,
402
+ disableMultiSelect: s,
407
403
  disableDelete: o,
408
- disableEdit: u,
409
- disableCreate: y,
410
- hideUseCase: b = !0,
411
- showMetadataFilters: w = !0,
412
- tableProps: I,
413
- containerProps: L,
414
- quantumIconSrc: f = "/favicon.ico",
404
+ disableEdit: b,
405
+ disableCreate: j,
406
+ hideUseCase: L = !0,
407
+ showMetadataFilters: M = !0,
408
+ tableProps: f,
409
+ containerProps: C,
410
+ quantumIconSrc: p = "/favicon.ico",
415
411
  allowDuplicateSelection: c = !1,
416
- getSelectedCount: k
412
+ getSelectedCount: A
417
413
  }) => {
418
- const [x, N] = q(""), [v, E] = q(), [R, O] = q([]), [K, oe] = q({}), { getLabel: D } = xe(), ae = lt(), Z = $(() => ({
419
- action: D("action"),
420
- actionPlural: D("action_plural"),
421
- actionLowerCase: D("action").toLocaleLowerCase(),
422
- actionPluralLowerCase: D("action_plural").toLocaleLowerCase()
423
- }), [D]), T = $(() => [
414
+ const [d, D] = K(""), [v, z] = K(), [T, F] = K([]), [G, oe] = K({}), { getLabel: P } = xe(), ae = dt(), Z = N(() => ({
415
+ action: P("action"),
416
+ actionPlural: P("action_plural"),
417
+ actionLowerCase: P("action").toLocaleLowerCase(),
418
+ actionPluralLowerCase: P("action_plural").toLocaleLowerCase()
419
+ }), [P]), O = N(() => [
424
420
  { key: "module_category", label: "Link Category", multi: !0 },
425
421
  { key: "activity_type", label: `${Z.action} Type`, multi: !0 },
426
422
  { key: "session_type", label: "Session Type", multi: !0 },
@@ -428,79 +424,79 @@ const Rn = ({
428
424
  { key: "sport", label: "Sport", multi: !0 }
429
425
  ], [Z.action]);
430
426
  ce(() => {
431
- if (!w)
427
+ if (!M)
432
428
  return;
433
- const l = T.map(
434
- (S) => ae.query(at, { key: S.key })
429
+ const l = O.map(
430
+ (I) => ae.query(lt, { key: I.key })
435
431
  );
436
- Promise.all(l).then((S) => {
437
- const W = {};
438
- S.forEach((G) => {
439
- if (G.error || !G.data) return;
440
- const Q = A(
432
+ Promise.all(l).then((I) => {
433
+ const Q = {};
434
+ I.forEach((_) => {
435
+ if (_.error || !_.data) return;
436
+ const q = k(
441
437
  je,
442
- G.data.getMetadataByKey
443
- ), H = A(
438
+ _.data.getMetadataByKey
439
+ ), H = k(
444
440
  be,
445
- Q.data
441
+ q.data
446
442
  );
447
- W[Q.key] = H.map((re) => ({
443
+ Q[q.key] = H.map((re) => ({
448
444
  label: re.label || re.value,
449
445
  value: re.value,
450
446
  id: re.id
451
447
  }));
452
- }), oe(W);
448
+ }), oe(Q);
453
449
  });
454
- }, [ae, T, w]);
455
- const B = $(() => {
456
- if (!s)
450
+ }, [ae, O, M]);
451
+ const W = N(() => {
452
+ if (!n)
457
453
  return;
458
- const l = _n(s, x), S = b ? l : zn(l, v);
459
- return w ? Bn(
460
- S,
461
- R,
462
- K
463
- ) : S;
454
+ const l = Bn(n, d), I = L ? l : Wn(l, v);
455
+ return M ? Qn(
456
+ I,
457
+ T,
458
+ G
459
+ ) : I;
464
460
  }, [
465
- s,
466
- x,
461
+ n,
462
+ d,
467
463
  v,
468
- b,
469
- w,
470
- R,
471
- K
472
- ]), J = _(() => {
473
- if (!p)
474
- return;
475
- const S = s.filter(
476
- (W) => W.selected && !W.quantumOwned
477
- ).map((W) => W.id);
478
- p(S);
479
- }, [s, p]), U = _(() => {
464
+ L,
465
+ M,
466
+ T,
467
+ G
468
+ ]), J = E(() => {
480
469
  if (!g)
481
470
  return;
482
- const l = s.filter((S) => S.selected);
483
- g(l.map((S) => S.id)), d && l.forEach((S) => d(S, !1));
484
- }, [s, g, d]), Y = $(() => s.some((l) => l.selected && !l.quantumOwned), [s]), i = $(() => s.some((l) => l.selected), [s]), a = $(() => s.some((l) => l.selected && l.quantumOwned), [s]), C = _(
485
- (l, S) => {
486
- const W = T.find((Q) => Q.key === l);
487
- if (!W) return;
488
- const G = W.multi ? (S ?? []).map((Q) => Q.id) : S ? [S.id] : [];
489
- O((Q) => [...Q.filter((re) => Object.values(K).flat().find((Ie) => Ie.id === re) && !Object.keys(K).find(
490
- (Ie) => K[Ie]?.some(
471
+ const I = n.filter(
472
+ (Q) => Q.selected && !Q.quantumOwned
473
+ ).map((Q) => Q.id);
474
+ g(I);
475
+ }, [n, g]), U = E(() => {
476
+ if (!x)
477
+ return;
478
+ const l = n.filter((I) => I.selected);
479
+ x(l.map((I) => I.id)), h && l.forEach((I) => h(I, !1));
480
+ }, [n, x, h]), Y = N(() => n.some((l) => l.selected && !l.quantumOwned), [n]), i = N(() => n.some((l) => l.selected), [n]), a = N(() => n.some((l) => l.selected && l.quantumOwned), [n]), w = E(
481
+ (l, I) => {
482
+ const Q = O.find((q) => q.key === l);
483
+ if (!Q) return;
484
+ const _ = Q.multi ? (I ?? []).map((q) => q.id) : I ? [I.id] : [];
485
+ F((q) => [...q.filter((re) => Object.values(G).flat().find((Ie) => Ie.id === re) && !Object.keys(G).find(
486
+ (Ie) => G[Ie]?.some(
491
487
  (Se) => Se.id === re && Ie === l
492
488
  )
493
- )), ...G]);
489
+ )), ..._]);
494
490
  },
495
- [T, K]
491
+ [O, G]
496
492
  );
497
- return /* @__PURE__ */ e.jsxs(se, { ...L, children: [
493
+ return /* @__PURE__ */ e.jsxs(se, { ...C, children: [
498
494
  /* @__PURE__ */ e.jsxs(Me, { alignContent: "space-between", gap: 4, children: [
499
- (r || p || g) && /* @__PURE__ */ e.jsxs(Ne, { mb: "1rem", gap: 4, children: [
495
+ (r || g || x) && /* @__PURE__ */ e.jsxs(Ne, { mb: "1rem", gap: 4, children: [
500
496
  r && /* @__PURE__ */ e.jsxs(
501
- te,
497
+ ne,
502
498
  {
503
- isDisabled: !r || y,
499
+ isDisabled: !r || j,
504
500
  colorScheme: "blackAlpha",
505
501
  backgroundColor: "gray.700",
506
502
  onClick: r,
@@ -510,24 +506,24 @@ const Rn = ({
510
506
  ]
511
507
  }
512
508
  ),
513
- p && !n && /* @__PURE__ */ e.jsx(
514
- rt,
509
+ g && !s && /* @__PURE__ */ e.jsx(
510
+ it,
515
511
  {
516
512
  label: a ? Y ? `Quantum-owned ${Z.actionPluralLowerCase} are selected and will be skipped` : `Selected ${Z.actionPluralLowerCase} are quantum-owned and cannot be deleted` : void 0,
517
513
  shouldWrapChildren: !0,
518
514
  children: /* @__PURE__ */ e.jsx(
519
- te,
515
+ ne,
520
516
  {
521
517
  colorScheme: "gray",
522
- isDisabled: !Y || !p || o,
518
+ isDisabled: !Y || !g || o,
523
519
  onClick: J,
524
520
  children: "Delete Selected"
525
521
  }
526
522
  )
527
523
  }
528
524
  ),
529
- g && !n && /* @__PURE__ */ e.jsx(
530
- te,
525
+ x && !s && /* @__PURE__ */ e.jsx(
526
+ ne,
531
527
  {
532
528
  colorScheme: "gray",
533
529
  isDisabled: !i,
@@ -537,157 +533,157 @@ const Rn = ({
537
533
  )
538
534
  ] }),
539
535
  /* @__PURE__ */ e.jsx(
540
- Rn,
536
+ Fn,
541
537
  {
542
- setSearch: N,
543
- actions: s,
544
- updateUseCases: E,
545
- hideUseCaseFilter: b
538
+ setSearch: D,
539
+ actions: n,
540
+ updateUseCases: z,
541
+ hideUseCaseFilter: L
546
542
  }
547
543
  )
548
544
  ] }),
549
- w && K && /* @__PURE__ */ e.jsx(se, { my: 4, children: /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4", children: T.map((l) => /* @__PURE__ */ e.jsxs(X, { children: [
550
- /* @__PURE__ */ e.jsx(_e, { fontSize: "sm", children: l.label }),
545
+ M && G && /* @__PURE__ */ e.jsx(se, { my: 4, children: /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4", children: O.map((l) => /* @__PURE__ */ e.jsxs(X, { children: [
546
+ /* @__PURE__ */ e.jsx(ze, { fontSize: "sm", children: l.label }),
551
547
  /* @__PURE__ */ e.jsx(
552
548
  he,
553
549
  {
554
550
  chakraStyles: {
555
- menu: (S) => ({
556
- ...S,
551
+ menu: (I) => ({
552
+ ...I,
557
553
  zIndex: 2
558
554
  })
559
555
  },
560
556
  isMulti: l.multi,
561
- value: K[l.key]?.filter(
562
- (S) => R.includes(S.id)
557
+ value: G[l.key]?.filter(
558
+ (I) => T.includes(I.id)
563
559
  ),
564
- onChange: (S) => {
565
- C(
560
+ onChange: (I) => {
561
+ w(
566
562
  l.key,
567
- S
563
+ I
568
564
  );
569
565
  },
570
- options: K[l.key],
566
+ options: G[l.key],
571
567
  placeholder: `Select ${l.multi ? "one or more" : "one"} ${l.label.toLowerCase()}`,
572
568
  isClearable: l.multi
573
569
  }
574
570
  )
575
571
  ] }, l.key)) }) }),
576
- /* @__PURE__ */ e.jsx(Bt, { mr: "2rem", overflowX: "hidden", ...I, children: /* @__PURE__ */ e.jsxs(Ut, { size: "md", variant: "simple", children: [
577
- /* @__PURE__ */ e.jsx(Wt, { position: "sticky", top: 0, bg: "white", zIndex: 1, children: /* @__PURE__ */ e.jsxs(pt, { children: [
572
+ /* @__PURE__ */ e.jsx(Ut, { mr: "2rem", overflowX: "hidden", ...f, children: /* @__PURE__ */ e.jsxs(Wt, { size: "md", variant: "simple", children: [
573
+ /* @__PURE__ */ e.jsx(Qt, { position: "sticky", top: 0, bg: "white", zIndex: 1, children: /* @__PURE__ */ e.jsxs(xt, { children: [
578
574
  /* @__PURE__ */ e.jsxs(De, { fontWeight: "normal", children: [
579
575
  "(showing ",
580
- B?.length ?? 0,
576
+ W?.length ?? 0,
581
577
  " of",
582
578
  " ",
583
- t ?? s.length,
579
+ t ?? n.length,
584
580
  ")"
585
581
  ] }),
586
582
  /* @__PURE__ */ e.jsx(De, { children: "Name" }),
587
583
  /* @__PURE__ */ e.jsx(De, { children: "Sensor Locations" }),
588
- !b && /* @__PURE__ */ e.jsx(De, { children: "Use Case" }),
584
+ !L && /* @__PURE__ */ e.jsx(De, { children: "Use Case" }),
589
585
  /* @__PURE__ */ e.jsx(De, {})
590
586
  ] }) }),
591
- /* @__PURE__ */ e.jsx(Qt, { children: B?.map((l) => {
592
- const S = c ? k?.(l.id) ?? 0 : 0, W = c ? S > 0 : !!l.selected;
587
+ /* @__PURE__ */ e.jsx(qt, { children: W?.map((l) => {
588
+ const I = c ? A?.(l.id) ?? 0 : 0, Q = c ? I > 0 : !!l.selected;
593
589
  return /* @__PURE__ */ e.jsxs(
594
- pt,
590
+ xt,
595
591
  {
596
592
  className: Je(
597
593
  "hover:bg-[#f7f7f7]",
598
- !n && !c && "cursor-pointer",
599
- W && "bg-gray-200"
594
+ !s && !c && "cursor-pointer",
595
+ Q && "bg-gray-200"
600
596
  ),
601
597
  onClick: () => {
602
- n || c || d?.(l, !l.selected);
598
+ s || c || h?.(l, !l.selected);
603
599
  },
604
600
  children: [
605
- /* @__PURE__ */ e.jsx(We, { children: /* @__PURE__ */ e.jsxs(Me, { alignItems: "center", children: [
606
- !n && c ? /* @__PURE__ */ e.jsxs(
601
+ /* @__PURE__ */ e.jsx(Qe, { children: /* @__PURE__ */ e.jsxs(Me, { alignItems: "center", children: [
602
+ !s && c ? /* @__PURE__ */ e.jsxs(
607
603
  V,
608
604
  {
609
605
  spacing: 1,
610
- onClick: (G) => G.stopPropagation(),
606
+ onClick: (_) => _.stopPropagation(),
611
607
  children: [
612
608
  /* @__PURE__ */ e.jsx(
613
- ot,
609
+ Ze,
614
610
  {
615
611
  "aria-label": "Remove one instance",
616
- icon: /* @__PURE__ */ e.jsx(yn, {}),
612
+ icon: /* @__PURE__ */ e.jsx(vn, {}),
617
613
  size: "xs",
618
614
  variant: "outline",
619
- isDisabled: S === 0,
620
- onClick: () => d?.(l, !1)
615
+ isDisabled: I === 0,
616
+ onClick: () => h?.(l, !1)
621
617
  }
622
618
  ),
623
619
  /* @__PURE__ */ e.jsx(
624
- M,
620
+ S,
625
621
  {
626
622
  minW: "1.5rem",
627
623
  textAlign: "center",
628
- fontWeight: S > 0 ? "semibold" : "normal",
629
- color: S > 0 ? "blue.600" : "gray.500",
630
- children: S
624
+ fontWeight: I > 0 ? "semibold" : "normal",
625
+ color: I > 0 ? "blue.600" : "gray.500",
626
+ children: I
631
627
  }
632
628
  ),
633
629
  /* @__PURE__ */ e.jsx(
634
- ot,
630
+ Ze,
635
631
  {
636
632
  "aria-label": "Add one instance",
637
- icon: /* @__PURE__ */ e.jsx(vn, {}),
633
+ icon: /* @__PURE__ */ e.jsx(wn, {}),
638
634
  size: "xs",
639
635
  variant: "outline",
640
636
  colorScheme: "blue",
641
- onClick: () => d?.(l, !0)
637
+ onClick: () => h?.(l, !0)
642
638
  }
643
639
  )
644
640
  ]
645
641
  }
646
- ) : n ? null : /* @__PURE__ */ e.jsx(e.Fragment, { children: l.selected ? /* @__PURE__ */ e.jsx(Cn, { className: "text-blue-500" }) : /* @__PURE__ */ e.jsx(wn, { className: "text-gray-400" }) }),
647
- (l.quantumOwned || !m) && h && /* @__PURE__ */ e.jsx(
648
- te,
642
+ ) : s ? null : /* @__PURE__ */ e.jsx(e.Fragment, { children: l.selected ? /* @__PURE__ */ e.jsx(In, { className: "text-blue-500" }) : /* @__PURE__ */ e.jsx(Sn, { className: "text-gray-400" }) }),
643
+ (l.quantumOwned || !u) && m && /* @__PURE__ */ e.jsx(
644
+ ne,
649
645
  {
650
646
  ml: "1em",
651
647
  size: "sm",
652
648
  variant: "link",
653
649
  colorScheme: "blue",
654
- onClick: (G) => {
655
- G.stopPropagation(), h(l.id);
650
+ onClick: (_) => {
651
+ _.stopPropagation(), m(l.id);
656
652
  },
657
653
  children: "View"
658
654
  }
659
655
  ),
660
- !l.quantumOwned && m && /* @__PURE__ */ e.jsx(
661
- te,
656
+ !l.quantumOwned && u && /* @__PURE__ */ e.jsx(
657
+ ne,
662
658
  {
663
- isDisabled: u,
659
+ isDisabled: b,
664
660
  ml: "1em",
665
661
  size: "sm",
666
662
  variant: "link",
667
663
  colorScheme: "blue",
668
- onClick: (G) => {
669
- G.stopPropagation(), m(l.id);
664
+ onClick: (_) => {
665
+ _.stopPropagation(), u(l.id);
670
666
  },
671
667
  children: "Edit"
672
668
  }
673
669
  )
674
670
  ] }) }),
675
- /* @__PURE__ */ e.jsx(We, { whiteSpace: "break-spaces", children: /* @__PURE__ */ e.jsxs(Me, { align: "center", gap: 2, children: [
671
+ /* @__PURE__ */ e.jsx(Qe, { whiteSpace: "break-spaces", children: /* @__PURE__ */ e.jsxs(Me, { align: "center", gap: 2, children: [
676
672
  /* @__PURE__ */ e.jsx(
677
- Pn,
673
+ En,
678
674
  {
679
675
  action: l,
680
- quantumIconSrc: f
676
+ quantumIconSrc: p
681
677
  }
682
678
  ),
683
679
  l.name
684
680
  ] }) }),
685
- /* @__PURE__ */ e.jsx(We, { maxW: "20rem", whiteSpace: "break-spaces", children: En(l.sensorLocations) }),
686
- !b && /* @__PURE__ */ e.jsx(We, { maxW: "20rem", children: /* @__PURE__ */ e.jsx(
687
- Gn,
681
+ /* @__PURE__ */ e.jsx(Qe, { maxW: "20rem", whiteSpace: "break-spaces", children: Un(l.sensorLocations) }),
682
+ !L && /* @__PURE__ */ e.jsx(Qe, { maxW: "20rem", children: /* @__PURE__ */ e.jsx(
683
+ _n,
688
684
  {
689
685
  containerProps: { flexWrap: "wrap" },
690
- tags: l.useCases?.map((G) => G.name) ?? []
686
+ tags: l.useCases?.map((_) => _.name) ?? []
691
687
  }
692
688
  ) })
693
689
  ]
@@ -697,70 +693,70 @@ const Rn = ({
697
693
  }) })
698
694
  ] }) })
699
695
  ] });
700
- }, bs = ({
701
- onSave: s,
696
+ }, ws = ({
697
+ onSave: n,
702
698
  onCancel: t,
703
699
  onError: r,
704
- hideButtons: p = !1,
705
- setButtonDisabled: m,
706
- setButtonOnClick: h,
707
- quantumOwned: d
700
+ hideButtons: g = !1,
701
+ setButtonDisabled: u,
702
+ setButtonOnClick: m,
703
+ quantumOwned: h
708
704
  }) => {
709
- const g = wt(), { getLabel: n } = xe(), o = $(() => ({
710
- singular: n("action"),
711
- plural: n("action_plural"),
712
- pluralLowerCase: n("action_plural").toLowerCase(),
713
- singularLowerCase: n("action").toLowerCase()
714
- }), [n]), [u, y] = q("copy"), [b, w] = q(""), [I, L] = q([]), [f, c] = q(!1), [k] = Ce({
715
- query: Lt
716
- }), [x] = Ce({
717
- query: cn,
718
- variables: { groupId: b },
719
- pause: !b
705
+ const x = It(), { getLabel: s } = xe(), o = N(() => ({
706
+ singular: s("action"),
707
+ plural: s("action_plural"),
708
+ pluralLowerCase: s("action_plural").toLowerCase(),
709
+ singularLowerCase: s("action").toLowerCase()
710
+ }), [s]), [b, j] = K("copy"), [L, M] = K(""), [f, C] = K([]), [p, c] = K(!1), [A] = ve({
711
+ query: kt
712
+ }), [d] = ve({
713
+ query: dn,
714
+ variables: { groupId: L },
715
+ pause: !L
720
716
  // Only run when group is selected
721
- }), [, N] = fe(it), [, v] = fe(
722
- kt
723
- ), E = $(() => k.data?.groups ? k.data.groups.map(
724
- (i) => A(Mt, i)
725
- ) : [], [k.data]), R = $(() => x.data ? x.data.actions.map((a) => {
726
- const C = A(ve, a), l = A(
727
- Fe,
728
- C.reports
729
- ), S = A(
717
+ }), [, D] = fe(ct), [, v] = fe(
718
+ Mt
719
+ ), z = N(() => A.data?.groups ? A.data.groups.map(
720
+ (i) => k(At, i)
721
+ ) : [], [A.data]), T = N(() => d.data ? d.data.actions.map((a) => {
722
+ const w = k(Ce, a), l = k(
730
723
  Pe,
731
- C.categories
732
- ), G = A(
724
+ w.reports
725
+ ), I = k(
726
+ _e,
727
+ w.categories
728
+ ), _ = k(
733
729
  je,
734
- C.metadataGroups
735
- ).map((Q) => ({
736
- ...Q,
737
- data: Q.data.map((H) => A(be, H))
730
+ w.metadataGroups
731
+ ).map((q) => ({
732
+ ...q,
733
+ data: q.data.map((H) => k(be, H))
738
734
  }));
739
735
  return {
740
- ...C,
741
- thresholds: A(Te, C.thresholds),
742
- reports: l.map((Q) => ({
743
- ...Q,
744
- thresholds: A(Te, Q.thresholds)
736
+ ...w,
737
+ thresholds: k(Te, w.thresholds),
738
+ reports: l.map((q) => ({
739
+ ...q,
740
+ thresholds: k(Te, q.thresholds)
745
741
  })),
746
- categories: S,
747
- metadataGroups: G
742
+ categories: I,
743
+ metadataGroups: _
748
744
  };
749
- }) : [], [x.data]), O = $(() => R.filter(
750
- (i) => I.includes(i.id)
751
- ), [R, I]), K = _(
745
+ }) : [], [d.data]), F = N(() => T.filter(
746
+ (i) => f.includes(i.id)
747
+ ), [T, f]), G = E(
752
748
  (i) => {
753
749
  const a = i?.value || "";
754
- w(a), L([]);
750
+ M(a), C([]);
755
751
  },
756
752
  []
757
- ), oe = _(
753
+ ), oe = E(
758
754
  (i) => {
759
- const a = i.map((C) => C.value);
760
- L(a);
755
+ const a = i.map((w) => w.value);
756
+ C(a);
761
757
  },
762
758
  []
763
- ), D = _(
759
+ ), P = E(
764
760
  async (i) => {
765
761
  const a = {
766
762
  ...i,
@@ -777,41 +773,41 @@ const Rn = ({
777
773
  id: void 0
778
774
  })),
779
775
  categories: i.categories.map((l) => l.id),
780
- quantumOwned: d,
781
- metadataItemIds: i.metadataGroups.flatMap((l) => l.data.map((S) => S.id)).filter((l) => l !== void 0),
776
+ quantumOwned: h,
777
+ metadataItemIds: i.metadataGroups.flatMap((l) => l.data.map((I) => I.id)).filter((l) => l !== void 0),
782
778
  reports: i.reports.map((l) => ({
783
779
  ...l,
784
780
  id: void 0,
785
- thresholds: l.thresholds.map((S) => ({
786
- ...S,
781
+ thresholds: l.thresholds.map((I) => ({
782
+ ...I,
787
783
  id: void 0
788
784
  }))
789
785
  })),
790
786
  id: void 0
791
- }, C = await N({ fields: a });
792
- if (C.error) throw new Error(C.error.message);
793
- if (C.data?.createAction)
794
- return A(ve, C.data.createAction);
787
+ }, w = await D({ fields: a });
788
+ if (w.error) throw new Error(w.error.message);
789
+ if (w.data?.createAction)
790
+ return k(Ce, w.data.createAction);
795
791
  throw new Error("No action data returned");
796
792
  },
797
- [N, d]
798
- ), ae = _(
793
+ [D, h]
794
+ ), ae = E(
799
795
  async (i) => {
800
796
  const a = await v({ id: i.id });
801
797
  if (a.error)
802
798
  throw new Error(a.error.message);
803
799
  if (a.data?.convertActionToQuantumOwned)
804
- return A(
805
- ve,
800
+ return k(
801
+ Ce,
806
802
  a.data.convertActionToQuantumOwned
807
803
  );
808
804
  throw new Error("No action data returned");
809
805
  },
810
806
  [v]
811
- ), Z = _(async () => {
812
- if (c(!0), !O.length) {
807
+ ), Z = E(async () => {
808
+ if (c(!0), !F.length) {
813
809
  const i = new Error(
814
- `No ${o.pluralLowerCase} selected for ${u === "copy" ? "copying" : "converting"}`
810
+ `No ${o.pluralLowerCase} selected for ${b === "copy" ? "copying" : "converting"}`
815
811
  );
816
812
  r?.(i), c(!1);
817
813
  return;
@@ -819,103 +815,103 @@ const Rn = ({
819
815
  try {
820
816
  const i = [];
821
817
  let a = 0;
822
- const C = u === "copy" ? D : ae, l = u === "copy" ? "copy" : "convert";
823
- for (const S of O)
818
+ const w = b === "copy" ? P : ae, l = b === "copy" ? "copy" : "convert";
819
+ for (const I of F)
824
820
  try {
825
- const W = await C(S);
826
- i.push(W);
827
- } catch (W) {
821
+ const Q = await w(I);
822
+ i.push(Q);
823
+ } catch (Q) {
828
824
  console.error(
829
- `Failed to ${l} ${o.singularLowerCase} "${S.name}":`,
830
- W
825
+ `Failed to ${l} ${o.singularLowerCase} "${I.name}":`,
826
+ Q
831
827
  ), a++;
832
828
  }
833
829
  if (i.length > 0) {
834
- const S = i.length, W = O.length, G = u === "copy" ? "copied" : "converted", Q = u === "copy" ? "copy" : "convert";
835
- g({
836
- title: a > 0 ? `Partial ${Q} completed` : `${o.plural} ${G} successfully`,
837
- description: a > 0 ? `${S} of ${W} ${o.pluralLowerCase} ${G} successfully` : `${S} ${S > 1 ? o.pluralLowerCase : o.singularLowerCase} ${G} successfully`,
830
+ const I = i.length, Q = F.length, _ = b === "copy" ? "copied" : "converted", q = b === "copy" ? "copy" : "convert";
831
+ x({
832
+ title: a > 0 ? `Partial ${q} completed` : `${o.plural} ${_} successfully`,
833
+ description: a > 0 ? `${I} of ${Q} ${o.pluralLowerCase} ${_} successfully` : `${I} ${I > 1 ? o.pluralLowerCase : o.singularLowerCase} ${_} successfully`,
838
834
  status: a > 0 ? "warning" : "success",
839
835
  duration: 3e3,
840
836
  isClosable: !0
841
- }), s?.(), w(""), L([]);
837
+ }), n?.(), M(""), C([]);
842
838
  } else
843
839
  throw new Error(
844
840
  `Failed to ${l} any ${o.pluralLowerCase}`
845
841
  );
846
842
  } catch (i) {
847
- const a = u === "copy" ? "copy" : "convert", C = i instanceof Error ? i.message : `Failed to ${a} ${o.pluralLowerCase}`;
848
- g({
849
- title: `${u === "copy" ? "Copy" : "Convert"} failed`,
850
- description: C,
843
+ const a = b === "copy" ? "copy" : "convert", w = i instanceof Error ? i.message : `Failed to ${a} ${o.pluralLowerCase}`;
844
+ x({
845
+ title: `${b === "copy" ? "Copy" : "Convert"} failed`,
846
+ description: w,
851
847
  status: "error",
852
848
  duration: 5e3,
853
849
  isClosable: !0
854
- }), r?.(i instanceof Error ? i : new Error(C));
850
+ }), r?.(i instanceof Error ? i : new Error(w));
855
851
  } finally {
856
852
  c(!1);
857
853
  }
858
854
  }, [
859
- O,
860
- u,
861
- D,
855
+ F,
856
+ b,
857
+ P,
862
858
  ae,
863
- g,
864
- s,
859
+ x,
860
+ n,
865
861
  r,
866
862
  o
867
- ]), T = _(() => {
868
- w(""), L([]), y("copy"), t?.();
863
+ ]), O = E(() => {
864
+ M(""), C([]), j("copy"), t?.();
869
865
  }, [t]);
870
866
  ce(() => {
871
- m && m({
867
+ u && u({
872
868
  cancelButton: !1,
873
- saveButton: O.length === 0 || f
869
+ saveButton: F.length === 0 || p
874
870
  });
875
- }, [O.length, f, m]), ce(() => {
876
- h && h({
877
- cancelButton: T,
871
+ }, [F.length, p, u]), ce(() => {
872
+ m && m({
873
+ cancelButton: O,
878
874
  saveButton: Z
879
875
  });
880
- }, [h, T, Z]);
881
- const B = $(() => E.map((i) => ({
876
+ }, [m, O, Z]);
877
+ const W = N(() => z.map((i) => ({
882
878
  value: i.id,
883
879
  label: i.name
884
- })), [E]), J = $(() => R.filter((i) => u === "copy" ? !0 : !i.quantumOwned).map((i) => ({
880
+ })), [z]), J = N(() => T.filter((i) => b === "copy" ? !0 : !i.quantumOwned).map((i) => ({
885
881
  value: i.id,
886
882
  label: i.name,
887
883
  // Add custom data to identify quantum-owned actions for UI display
888
884
  isQuantumOwned: i.quantumOwned
889
- })), [R, u]), U = k.fetching, Y = x.fetching;
885
+ })), [T, b]), U = A.fetching, Y = d.fetching;
890
886
  return /* @__PURE__ */ e.jsx(se, { children: /* @__PURE__ */ e.jsxs(ue, { spacing: 6, align: "stretch", children: [
891
- d && /* @__PURE__ */ e.jsxs(X, { children: [
887
+ h && /* @__PURE__ */ e.jsxs(X, { children: [
892
888
  /* @__PURE__ */ e.jsx(ge, { children: "Operation Mode" }),
893
889
  /* @__PURE__ */ e.jsx(
894
- It,
890
+ St,
895
891
  {
896
- value: u,
892
+ value: b,
897
893
  onChange: (i) => {
898
- y(i), L([]);
894
+ j(i), C([]);
899
895
  },
900
896
  children: /* @__PURE__ */ e.jsxs(V, { spacing: 6, children: [
901
- /* @__PURE__ */ e.jsx(Ze, { value: "copy", colorScheme: "blue", children: /* @__PURE__ */ e.jsxs(ue, { align: "start", spacing: 1, children: [
902
- /* @__PURE__ */ e.jsxs(M, { fontWeight: "medium", children: [
897
+ /* @__PURE__ */ e.jsx(Ve, { value: "copy", colorScheme: "blue", children: /* @__PURE__ */ e.jsxs(ue, { align: "start", spacing: 1, children: [
898
+ /* @__PURE__ */ e.jsxs(S, { fontWeight: "medium", children: [
903
899
  "Copy ",
904
900
  o.plural
905
901
  ] }),
906
- /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", color: "gray.600", children: [
902
+ /* @__PURE__ */ e.jsxs(S, { fontSize: "sm", color: "gray.600", children: [
907
903
  "Create new ",
908
904
  o.plural.toLocaleLowerCase(),
909
905
  " ",
910
906
  "based on selected ones"
911
907
  ] })
912
908
  ] }) }),
913
- /* @__PURE__ */ e.jsx(Ze, { value: "convert", colorScheme: "green", children: /* @__PURE__ */ e.jsxs(ue, { align: "start", spacing: 1, children: [
914
- /* @__PURE__ */ e.jsxs(M, { fontWeight: "medium", children: [
909
+ /* @__PURE__ */ e.jsx(Ve, { value: "convert", colorScheme: "green", children: /* @__PURE__ */ e.jsxs(ue, { align: "start", spacing: 1, children: [
910
+ /* @__PURE__ */ e.jsxs(S, { fontWeight: "medium", children: [
915
911
  "Convert to Quantum Owned ",
916
912
  o.singular
917
913
  ] }),
918
- /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", color: "gray.600", children: [
914
+ /* @__PURE__ */ e.jsxs(S, { fontSize: "sm", color: "gray.600", children: [
919
915
  "Convert existing",
920
916
  " ",
921
917
  o.plural.toLocaleLowerCase(),
@@ -932,33 +928,33 @@ const Rn = ({
932
928
  he,
933
929
  {
934
930
  placeholder: "Choose a group...",
935
- options: B,
936
- value: B.find((i) => i.value === b) || null,
937
- onChange: K,
931
+ options: W,
932
+ value: W.find((i) => i.value === L) || null,
933
+ onChange: G,
938
934
  isLoading: U,
939
935
  isDisabled: U,
940
936
  isClearable: !0
941
937
  }
942
938
  ),
943
- k.error && /* @__PURE__ */ e.jsxs(Ve, { status: "error", mt: 2, children: [
944
- /* @__PURE__ */ e.jsx(et, {}),
945
- /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", children: [
939
+ A.error && /* @__PURE__ */ e.jsxs(et, { status: "error", mt: 2, children: [
940
+ /* @__PURE__ */ e.jsx(tt, {}),
941
+ /* @__PURE__ */ e.jsxs(S, { fontSize: "sm", children: [
946
942
  "Failed to load groups: ",
947
- k.error.message
943
+ A.error.message
948
944
  ] })
949
945
  ] })
950
946
  ] }),
951
- b && /* @__PURE__ */ e.jsxs(X, { children: [
947
+ L && /* @__PURE__ */ e.jsxs(X, { children: [
952
948
  /* @__PURE__ */ e.jsxs(ge, { children: [
953
949
  "Select ",
954
950
  o.plural,
955
951
  " to",
956
952
  " ",
957
- u === "copy" ? "Copy" : "Convert"
953
+ b === "copy" ? "Copy" : "Convert"
958
954
  ] }),
959
955
  Y ? /* @__PURE__ */ e.jsxs(V, { children: [
960
- /* @__PURE__ */ e.jsx(St, { size: "sm" }),
961
- /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", color: "gray.600", children: [
956
+ /* @__PURE__ */ e.jsx(Lt, { size: "sm" }),
957
+ /* @__PURE__ */ e.jsxs(S, { fontSize: "sm", color: "gray.600", children: [
962
958
  "Loading ",
963
959
  o.pluralLowerCase,
964
960
  "..."
@@ -967,10 +963,10 @@ const Rn = ({
967
963
  /* @__PURE__ */ e.jsx(
968
964
  he,
969
965
  {
970
- placeholder: `Choose ${o.pluralLowerCase} to ${u}...`,
966
+ placeholder: `Choose ${o.pluralLowerCase} to ${b}...`,
971
967
  options: J,
972
968
  value: J.filter(
973
- (i) => I.includes(i.value)
969
+ (i) => f.includes(i.value)
974
970
  ),
975
971
  onChange: oe,
976
972
  isDisabled: J.length === 0,
@@ -979,34 +975,34 @@ const Rn = ({
979
975
  closeMenuOnSelect: !1,
980
976
  formatOptionLabel: (i, { context: a }) => /* @__PURE__ */ e.jsxs(V, { justify: "space-between", w: "100%", children: [
981
977
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
982
- /* @__PURE__ */ e.jsx(M, { children: i.label }),
983
- a === "value" && i.isQuantumOwned && /* @__PURE__ */ e.jsx(M, { color: "blue", fontSize: "xs", children: "(Quantum Owned)" })
978
+ /* @__PURE__ */ e.jsx(S, { children: i.label }),
979
+ a === "value" && i.isQuantumOwned && /* @__PURE__ */ e.jsx(S, { color: "blue", fontSize: "xs", children: "(Quantum Owned)" })
984
980
  ] }),
985
981
  i.isQuantumOwned && a === "menu" && /* @__PURE__ */ e.jsx(Ge, { size: "sm", colorScheme: "blue", variant: "solid", children: "Quantum Owned" })
986
982
  ] })
987
983
  }
988
984
  ),
989
- J.length === 0 && /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", color: "gray.500", mt: 2, children: [
985
+ J.length === 0 && /* @__PURE__ */ e.jsxs(S, { fontSize: "sm", color: "gray.500", mt: 2, children: [
990
986
  "No ",
991
987
  o.pluralLowerCase,
992
988
  " found"
993
989
  ] })
994
990
  ] }),
995
- x.error && /* @__PURE__ */ e.jsxs(Ve, { status: "error", mt: 2, children: [
996
- /* @__PURE__ */ e.jsx(et, {}),
997
- /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", children: [
991
+ d.error && /* @__PURE__ */ e.jsxs(et, { status: "error", mt: 2, children: [
992
+ /* @__PURE__ */ e.jsx(tt, {}),
993
+ /* @__PURE__ */ e.jsxs(S, { fontSize: "sm", children: [
998
994
  "Failed to load ",
999
995
  o.pluralLowerCase,
1000
996
  ":",
1001
997
  " ",
1002
- x.error.message
998
+ d.error.message
1003
999
  ] })
1004
1000
  ] })
1005
1001
  ] }),
1006
- O.length > 0 && /* @__PURE__ */ e.jsxs(se, { p: 4, bg: "gray.50", borderRadius: "md", children: [
1007
- /* @__PURE__ */ e.jsx(M, { fontWeight: "semibold", mb: 3, children: O.length === 1 ? `${o.singular} to ${u === "copy" ? "Copy" : "Convert"}:` : `${O.length} ${o.plural} to ${u === "copy" ? "Copy" : "Convert"}:` }),
1002
+ F.length > 0 && /* @__PURE__ */ e.jsxs(se, { p: 4, bg: "gray.50", borderRadius: "md", children: [
1003
+ /* @__PURE__ */ e.jsx(S, { fontWeight: "semibold", mb: 3, children: F.length === 1 ? `${o.singular} to ${b === "copy" ? "Copy" : "Convert"}:` : `${F.length} ${o.plural} to ${b === "copy" ? "Copy" : "Convert"}:` }),
1008
1004
  /* @__PURE__ */ e.jsxs(ue, { align: "start", spacing: 3, children: [
1009
- O.map((i, a) => /* @__PURE__ */ e.jsxs(
1005
+ F.map((i, a) => /* @__PURE__ */ e.jsxs(
1010
1006
  se,
1011
1007
  {
1012
1008
  w: "100%",
@@ -1017,7 +1013,7 @@ const Rn = ({
1017
1013
  borderColor: "gray.200",
1018
1014
  children: [
1019
1015
  /* @__PURE__ */ e.jsxs(V, { justify: "space-between", align: "start", mb: 2, children: [
1020
- /* @__PURE__ */ e.jsxs(M, { fontWeight: "medium", fontSize: "sm", children: [
1016
+ /* @__PURE__ */ e.jsxs(S, { fontWeight: "medium", fontSize: "sm", children: [
1021
1017
  a + 1,
1022
1018
  ". ",
1023
1019
  i.name
@@ -1032,35 +1028,35 @@ const Rn = ({
1032
1028
  fontSize: "sm",
1033
1029
  color: "gray.600",
1034
1030
  children: [
1035
- i.description && /* @__PURE__ */ e.jsxs(M, { children: [
1031
+ i.description && /* @__PURE__ */ e.jsxs(S, { children: [
1036
1032
  /* @__PURE__ */ e.jsx("strong", { children: "Description:" }),
1037
1033
  " ",
1038
1034
  i.description
1039
1035
  ] }),
1040
- /* @__PURE__ */ e.jsxs(M, { children: [
1036
+ /* @__PURE__ */ e.jsxs(S, { children: [
1041
1037
  /* @__PURE__ */ e.jsx("strong", { children: "Type:" }),
1042
1038
  " ",
1043
1039
  i.activityKind
1044
1040
  ] }),
1045
- /* @__PURE__ */ e.jsxs(M, { children: [
1041
+ /* @__PURE__ */ e.jsxs(S, { children: [
1046
1042
  /* @__PURE__ */ e.jsx("strong", { children: "Laterality:" }),
1047
1043
  " ",
1048
1044
  i.laterality
1049
1045
  ] }),
1050
- /* @__PURE__ */ e.jsxs(M, { children: [
1046
+ /* @__PURE__ */ e.jsxs(S, { children: [
1051
1047
  /* @__PURE__ */ e.jsx("strong", { children: "Sensor Locations:" }),
1052
1048
  " ",
1053
1049
  i.sensorLocations.length
1054
1050
  ] }),
1055
- /* @__PURE__ */ e.jsxs(M, { children: [
1051
+ /* @__PURE__ */ e.jsxs(S, { children: [
1056
1052
  /* @__PURE__ */ e.jsx("strong", { children: "Thresholds:" }),
1057
1053
  " ",
1058
1054
  i.thresholds.length
1059
1055
  ] }),
1060
- /* @__PURE__ */ e.jsxs(M, { children: [
1056
+ /* @__PURE__ */ e.jsxs(S, { children: [
1061
1057
  /* @__PURE__ */ e.jsx("strong", { children: "Use Cases:" }),
1062
1058
  " ",
1063
- i.useCases.map((C) => C.name).join(", ") || "None"
1059
+ i.useCases.map((w) => w.name).join(", ") || "None"
1064
1060
  ] })
1065
1061
  ]
1066
1062
  }
@@ -1069,7 +1065,7 @@ const Rn = ({
1069
1065
  },
1070
1066
  i.id
1071
1067
  )),
1072
- O.length > 1 && /* @__PURE__ */ e.jsx(
1068
+ F.length > 1 && /* @__PURE__ */ e.jsx(
1073
1069
  se,
1074
1070
  {
1075
1071
  w: "100%",
@@ -1078,116 +1074,116 @@ const Rn = ({
1078
1074
  borderRadius: "md",
1079
1075
  border: "1px solid",
1080
1076
  borderColor: "blue.200",
1081
- children: /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", fontWeight: "medium", color: "blue.800", children: [
1077
+ children: /* @__PURE__ */ e.jsxs(S, { fontSize: "sm", fontWeight: "medium", color: "blue.800", children: [
1082
1078
  "Total: ",
1083
- O.length,
1079
+ F.length,
1084
1080
  " ",
1085
1081
  o.pluralLowerCase,
1086
1082
  " will be",
1087
1083
  " ",
1088
- u === "copy" ? "copied" : "converted"
1084
+ b === "copy" ? "copied" : "converted"
1089
1085
  ] })
1090
1086
  }
1091
1087
  )
1092
1088
  ] })
1093
1089
  ] }),
1094
- !p && /* @__PURE__ */ e.jsxs(Ne, { spacing: 4, justifyContent: "flex-end", children: [
1090
+ !g && /* @__PURE__ */ e.jsxs(Ne, { spacing: 4, justifyContent: "flex-end", children: [
1095
1091
  /* @__PURE__ */ e.jsx(
1096
- te,
1092
+ ne,
1097
1093
  {
1098
1094
  variant: "outline",
1099
- onClick: T,
1100
- isDisabled: f,
1095
+ onClick: O,
1096
+ isDisabled: p,
1101
1097
  children: "Cancel"
1102
1098
  }
1103
1099
  ),
1104
1100
  /* @__PURE__ */ e.jsxs(
1105
- te,
1101
+ ne,
1106
1102
  {
1107
- colorScheme: u === "copy" ? "blue" : "green",
1103
+ colorScheme: b === "copy" ? "blue" : "green",
1108
1104
  onClick: Z,
1109
- isDisabled: O.length === 0 || f,
1110
- isLoading: f,
1111
- loadingText: `${u === "copy" ? "Copying" : "Converting"}...`,
1105
+ isDisabled: F.length === 0 || p,
1106
+ isLoading: p,
1107
+ loadingText: `${b === "copy" ? "Copying" : "Converting"}...`,
1112
1108
  children: [
1113
- u === "copy" ? "Copy" : "Convert",
1109
+ b === "copy" ? "Copy" : "Convert",
1114
1110
  " ",
1115
- O.length === 1 ? o.singular : `${O.length} ${o.plural}`
1111
+ F.length === 1 ? o.singular : `${F.length} ${o.plural}`
1116
1112
  ]
1117
1113
  }
1118
1114
  )
1119
1115
  ] })
1120
1116
  ] }) });
1121
- }, ys = ({
1122
- onSave: s,
1117
+ }, Is = ({
1118
+ onSave: n,
1123
1119
  onCancel: t,
1124
1120
  onError: r,
1125
- hideButtons: p = !1,
1126
- setButtonDisabled: m,
1127
- setButtonOnClick: h,
1128
- quantumOwned: d
1121
+ hideButtons: g = !1,
1122
+ setButtonDisabled: u,
1123
+ setButtonOnClick: m,
1124
+ quantumOwned: h
1129
1125
  }) => {
1130
- const g = wt(), { getLabel: n } = xe(), o = $(() => ({
1131
- singular: n("module"),
1132
- plural: n("module_plural"),
1133
- pluralLowerCase: n("module_plural").toLowerCase(),
1134
- singularLowerCase: n("module").toLowerCase()
1135
- }), [n]), u = $(() => ({
1136
- singular: n("action"),
1137
- plural: n("action_plural"),
1138
- pluralLowerCase: n("action_plural").toLowerCase(),
1139
- singularLowerCase: n("action").toLowerCase()
1140
- }), [n]), [y, b] = q(""), [w, I] = q([]), [L, f] = q(!1), [c, k] = q("copy"), [x] = Ce({
1141
- query: Lt
1142
- }), [N] = Ce({
1143
- query: dn,
1144
- variables: { groupId: y },
1145
- pause: !y
1126
+ const x = It(), { getLabel: s } = xe(), o = N(() => ({
1127
+ singular: s("module"),
1128
+ plural: s("module_plural"),
1129
+ pluralLowerCase: s("module_plural").toLowerCase(),
1130
+ singularLowerCase: s("module").toLowerCase()
1131
+ }), [s]), b = N(() => ({
1132
+ singular: s("action"),
1133
+ plural: s("action_plural"),
1134
+ pluralLowerCase: s("action_plural").toLowerCase(),
1135
+ singularLowerCase: s("action").toLowerCase()
1136
+ }), [s]), [j, L] = K(""), [M, f] = K([]), [C, p] = K(!1), [c, A] = K("copy"), [d] = ve({
1137
+ query: kt
1138
+ }), [D] = ve({
1139
+ query: un,
1140
+ variables: { groupId: j },
1141
+ pause: !j
1146
1142
  // Only run when group is selected
1147
- }), [, v] = fe(At), [, E] = fe(Ot), [, R] = fe(it), [, O] = fe(
1148
- kt
1149
- ), K = $(() => x.data?.groups ? x.data.groups.map(
1150
- (a) => A(Mt, a)
1151
- ) : [], [x.data]), oe = $(() => N.data?.modules ? A(
1143
+ }), [, v] = fe(Ot), [, z] = fe(Tt), [, T] = fe(ct), [, F] = fe(
1144
+ Mt
1145
+ ), G = N(() => d.data?.groups ? d.data.groups.map(
1146
+ (a) => k(At, a)
1147
+ ) : [], [d.data]), oe = N(() => D.data?.modules ? k(
1152
1148
  Ye,
1153
- N.data?.modules
1154
- ).map((C) => {
1155
- const l = A(
1156
- Tt,
1157
- C.moduleActions
1158
- ), W = A(
1149
+ D.data?.modules
1150
+ ).map((w) => {
1151
+ const l = k(
1152
+ Nt,
1153
+ w.moduleActions
1154
+ ), Q = k(
1159
1155
  je,
1160
- C.metadataGroups
1161
- ).map((G) => A(be, G.data)).flat();
1156
+ w.metadataGroups
1157
+ ).map((_) => k(be, _.data)).flat();
1162
1158
  return {
1163
- ...C,
1164
- moduleActions: l.map((G) => ({
1165
- ...G,
1166
- action: A(ve, G.action)
1159
+ ...w,
1160
+ moduleActions: l.map((_) => ({
1161
+ ..._,
1162
+ action: k(Ce, _.action)
1167
1163
  })),
1168
- categories: A(
1169
- Pe,
1170
- C.categories
1164
+ categories: k(
1165
+ _e,
1166
+ w.categories
1171
1167
  ),
1172
- metadataItems: W
1168
+ metadataItems: Q
1173
1169
  };
1174
- }) : [], [N.data]), D = $(() => oe.filter(
1175
- (a) => w.includes(a.id)
1176
- ), [oe, w]), ae = _(
1170
+ }) : [], [D.data]), P = N(() => oe.filter(
1171
+ (a) => M.includes(a.id)
1172
+ ), [oe, M]), ae = E(
1177
1173
  (a) => {
1178
- const C = a?.value || "";
1179
- b(C), I([]);
1174
+ const w = a?.value || "";
1175
+ L(w), f([]);
1180
1176
  },
1181
1177
  []
1182
- ), Z = _(
1178
+ ), Z = E(
1183
1179
  (a) => {
1184
- const C = a.map((l) => l.value);
1185
- I(C);
1180
+ const w = a.map((l) => l.value);
1181
+ f(w);
1186
1182
  },
1187
1183
  []
1188
- ), T = _(async () => {
1189
- if (f(!0), !D.length) {
1190
- f(!1);
1184
+ ), O = E(async () => {
1185
+ if (p(!0), !P.length) {
1186
+ p(!1);
1191
1187
  const a = new Error(
1192
1188
  `No modules selected for ${c === "convert" ? "converting" : "copying"}`
1193
1189
  );
@@ -1196,37 +1192,37 @@ const Rn = ({
1196
1192
  }
1197
1193
  try {
1198
1194
  const a = [];
1199
- let C = 0;
1200
- for (const l of D)
1195
+ let w = 0;
1196
+ for (const l of P)
1201
1197
  try {
1202
- let S = l.moduleActions.map((W) => W.actionId);
1203
- if (d) {
1204
- const W = l.moduleActions.map((H) => H.action), G = async (H) => {
1198
+ let I = l.moduleActions.map((Q) => Q.actionId);
1199
+ if (h) {
1200
+ const Q = l.moduleActions.map((H) => H.action), _ = async (H) => {
1205
1201
  if (c === "copy") {
1206
1202
  if (H.quantumOwned) return H;
1207
- const we = A(
1208
- Pe,
1203
+ const we = k(
1204
+ _e,
1209
1205
  H.categories
1210
- ), Se = A(
1206
+ ), Se = k(
1211
1207
  je,
1212
1208
  H.metadataGroups
1213
- ).map((pe) => A(
1209
+ ).map((pe) => k(
1214
1210
  be,
1215
1211
  pe.data
1216
- ).map(($e) => $e.id)).flat(), Be = A(
1217
- Fe,
1212
+ ).map(($e) => $e.id)).flat(), Ue = k(
1213
+ Pe,
1218
1214
  H.reports
1219
1215
  ).map((pe) => ({
1220
1216
  ...pe,
1221
1217
  id: void 0,
1222
- thresholds: A(
1218
+ thresholds: k(
1223
1219
  Te,
1224
1220
  pe.thresholds
1225
1221
  ).map(($e) => ({
1226
1222
  ...$e,
1227
1223
  id: void 0
1228
1224
  }))
1229
- })), tt = A(
1225
+ })), nt = k(
1230
1226
  Te,
1231
1227
  H.thresholds
1232
1228
  ).map((pe) => ({
@@ -1235,161 +1231,161 @@ const Rn = ({
1235
1231
  })), Re = {
1236
1232
  ...H,
1237
1233
  quantumOwned: !0,
1238
- thresholds: tt,
1234
+ thresholds: nt,
1239
1235
  categories: we?.map((pe) => pe.id),
1240
- reports: Be,
1236
+ reports: Ue,
1241
1237
  metadataIds: Se,
1242
1238
  id: void 0
1243
- }, Le = await R({ fields: Re });
1244
- return Le.error || !Le.data?.createAction ? null : A(
1245
- ve,
1239
+ }, Le = await T({ fields: Re });
1240
+ return Le.error || !Le.data?.createAction ? null : k(
1241
+ Ce,
1246
1242
  Le.data.createAction
1247
1243
  );
1248
1244
  }
1249
1245
  if (H.quantumOwned) return H;
1250
- const re = await O({
1246
+ const re = await F({
1251
1247
  id: H.id
1252
1248
  });
1253
- return re.error || !re.data?.convertActionToQuantumOwned ? null : A(
1254
- ve,
1249
+ return re.error || !re.data?.convertActionToQuantumOwned ? null : k(
1250
+ Ce,
1255
1251
  re.data.convertActionToQuantumOwned
1256
1252
  );
1257
1253
  };
1258
- S = (await Promise.all(
1259
- W.map(G)
1254
+ I = (await Promise.all(
1255
+ Q.map(_)
1260
1256
  )).filter((H) => !!H?.id).map((H) => H.id);
1261
1257
  }
1262
1258
  if (c === "convert") {
1263
- const W = {
1259
+ const Q = {
1264
1260
  name: l.name,
1265
1261
  description: l.description || void 0,
1266
- actions: S,
1267
- categories: l.categories.map((Q) => Q.id),
1262
+ actions: I,
1263
+ categories: l.categories.map((q) => q.id),
1268
1264
  quantumOwned: !0
1269
- }, G = await E({
1265
+ }, _ = await z({
1270
1266
  id: l.id,
1271
- input: W
1267
+ input: Q
1272
1268
  });
1273
- if (G.error) throw new Error(G.error.message);
1274
- if (G.data?.updateModule) {
1275
- const Q = A(
1269
+ if (_.error) throw new Error(_.error.message);
1270
+ if (_.data?.updateModule) {
1271
+ const q = k(
1276
1272
  Ye,
1277
- G.data.updateModule
1273
+ _.data.updateModule
1278
1274
  );
1279
- a.push(Q);
1275
+ a.push(q);
1280
1276
  }
1281
1277
  } else {
1282
- const W = {
1278
+ const Q = {
1283
1279
  name: `${l.name} (Copy)`,
1284
1280
  description: l.description || void 0,
1285
- moduleActions: l.moduleActions.map((Q) => ({
1286
- actionId: Q.actionId,
1287
- reportId: Q.reportId ?? void 0
1281
+ moduleActions: l.moduleActions.map((q) => ({
1282
+ actionId: q.actionId,
1283
+ reportId: q.reportId ?? void 0
1288
1284
  })),
1289
- categories: l.categories.map((Q) => Q.id),
1290
- quantumOwned: d,
1291
- metadataItemIds: l.metadataItems.map((Q) => Q.id)
1292
- }, G = await v({ input: W });
1293
- if (G.error) throw new Error(G.error.message);
1294
- if (G.data?.createModule) {
1295
- const Q = A(
1285
+ categories: l.categories.map((q) => q.id),
1286
+ quantumOwned: h,
1287
+ metadataItemIds: l.metadataItems.map((q) => q.id)
1288
+ }, _ = await v({ input: Q });
1289
+ if (_.error) throw new Error(_.error.message);
1290
+ if (_.data?.createModule) {
1291
+ const q = k(
1296
1292
  Ye,
1297
- G.data.createModule
1293
+ _.data.createModule
1298
1294
  );
1299
- a.push(Q);
1295
+ a.push(q);
1300
1296
  }
1301
1297
  }
1302
- } catch (S) {
1298
+ } catch (I) {
1303
1299
  console.error(
1304
1300
  `Failed to ${c === "convert" ? "convert" : "copy"} module "${l.name}":`,
1305
- S
1306
- ), C++;
1301
+ I
1302
+ ), w++;
1307
1303
  }
1308
1304
  if (a.length > 0) {
1309
- const l = a.length, S = D.length;
1310
- g({
1311
- title: C > 0 ? `Partial ${c === "convert" ? "convert" : "copy"} completed` : `${o.plural} ${c === "convert" ? "converted" : "copied"} successfully`,
1312
- description: C > 0 ? `${l} of ${S} ${o.plural} ${c === "convert" ? "converted" : "copied"} successfully` : `${l} ${l > 1 ? o.plural : o.singular} ${c === "convert" ? "converted" : "copied"} successfully`,
1313
- status: C > 0 ? "warning" : "success",
1305
+ const l = a.length, I = P.length;
1306
+ x({
1307
+ title: w > 0 ? `Partial ${c === "convert" ? "convert" : "copy"} completed` : `${o.plural} ${c === "convert" ? "converted" : "copied"} successfully`,
1308
+ description: w > 0 ? `${l} of ${I} ${o.plural} ${c === "convert" ? "converted" : "copied"} successfully` : `${l} ${l > 1 ? o.plural : o.singular} ${c === "convert" ? "converted" : "copied"} successfully`,
1309
+ status: w > 0 ? "warning" : "success",
1314
1310
  duration: 3e3,
1315
1311
  isClosable: !0
1316
- }), a.length > 0 && s?.(), b(""), I([]);
1312
+ }), a.length > 0 && n?.(), L(""), f([]);
1317
1313
  } else
1318
1314
  throw new Error(
1319
1315
  `Failed to ${c === "convert" ? "convert" : "copy"} any modules`
1320
1316
  );
1321
1317
  } catch (a) {
1322
- const C = a instanceof Error ? a.message : `Failed to ${c === "convert" ? "convert" : "copy"} modules`;
1323
- g({
1318
+ const w = a instanceof Error ? a.message : `Failed to ${c === "convert" ? "convert" : "copy"} modules`;
1319
+ x({
1324
1320
  title: c === "convert" ? "Convert failed" : "Copy failed",
1325
- description: C,
1321
+ description: w,
1326
1322
  status: "error",
1327
1323
  duration: 5e3,
1328
1324
  isClosable: !0
1329
- }), r?.(a instanceof Error ? a : new Error(C));
1325
+ }), r?.(a instanceof Error ? a : new Error(w));
1330
1326
  } finally {
1331
- f(!1);
1327
+ p(!1);
1332
1328
  }
1333
1329
  }, [
1334
- D,
1330
+ P,
1335
1331
  v,
1336
- E,
1337
- g,
1338
- s,
1332
+ z,
1333
+ x,
1334
+ n,
1339
1335
  r,
1340
- d,
1341
- R,
1342
- O,
1336
+ h,
1337
+ T,
1338
+ F,
1343
1339
  c,
1344
1340
  o
1345
- ]), B = _(() => {
1346
- b(""), I([]), k("copy"), t?.();
1341
+ ]), W = E(() => {
1342
+ L(""), f([]), A("copy"), t?.();
1347
1343
  }, [t]);
1348
1344
  ce(() => {
1349
- m && m({
1345
+ u && u({
1350
1346
  cancelButton: !1,
1351
- saveButton: D.length === 0 || L
1347
+ saveButton: P.length === 0 || C
1352
1348
  });
1353
- }, [D.length, L, m]), ce(() => {
1354
- h && h({
1355
- cancelButton: B,
1356
- saveButton: T
1349
+ }, [P.length, C, u]), ce(() => {
1350
+ m && m({
1351
+ cancelButton: W,
1352
+ saveButton: O
1357
1353
  });
1358
- }, [h, B, T]);
1359
- const J = $(() => K.map((a) => ({
1354
+ }, [m, W, O]);
1355
+ const J = N(() => G.map((a) => ({
1360
1356
  value: a.id,
1361
1357
  label: a.name
1362
- })), [K]), U = $(() => oe.filter((a) => c === "copy" ? !0 : !a.quantumOwned).map((a) => ({
1358
+ })), [G]), U = N(() => oe.filter((a) => c === "copy" ? !0 : !a.quantumOwned).map((a) => ({
1363
1359
  value: a.id,
1364
1360
  label: a.name,
1365
1361
  // Add custom data to identify quantum-owned modules
1366
1362
  isQuantumOwned: a.quantumOwned
1367
- })), [oe, c]), Y = x.fetching, i = N.fetching;
1363
+ })), [oe, c]), Y = d.fetching, i = D.fetching;
1368
1364
  return /* @__PURE__ */ e.jsx(se, { children: /* @__PURE__ */ e.jsxs(ue, { spacing: 6, align: "stretch", children: [
1369
- d && /* @__PURE__ */ e.jsxs(X, { children: [
1365
+ h && /* @__PURE__ */ e.jsxs(X, { children: [
1370
1366
  /* @__PURE__ */ e.jsx(ge, { children: "Operation Mode" }),
1371
1367
  /* @__PURE__ */ e.jsx(
1372
- It,
1368
+ St,
1373
1369
  {
1374
1370
  value: c,
1375
1371
  onChange: (a) => {
1376
- k(a), I([]);
1372
+ A(a), f([]);
1377
1373
  },
1378
1374
  children: /* @__PURE__ */ e.jsxs(V, { spacing: 6, children: [
1379
- /* @__PURE__ */ e.jsx(Ze, { value: "copy", colorScheme: "blue", children: /* @__PURE__ */ e.jsxs(ue, { align: "start", spacing: 1, children: [
1380
- /* @__PURE__ */ e.jsxs(M, { fontWeight: "medium", children: [
1375
+ /* @__PURE__ */ e.jsx(Ve, { value: "copy", colorScheme: "blue", children: /* @__PURE__ */ e.jsxs(ue, { align: "start", spacing: 1, children: [
1376
+ /* @__PURE__ */ e.jsxs(S, { fontWeight: "medium", children: [
1381
1377
  "Copy ",
1382
1378
  o.plural
1383
1379
  ] }),
1384
- /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", color: "gray.600", children: [
1380
+ /* @__PURE__ */ e.jsxs(S, { fontSize: "sm", color: "gray.600", children: [
1385
1381
  "Create new ",
1386
1382
  o.pluralLowerCase,
1387
1383
  " based on selected ones"
1388
1384
  ] })
1389
1385
  ] }) }),
1390
- /* @__PURE__ */ e.jsx(Ze, { value: "convert", colorScheme: "green", children: /* @__PURE__ */ e.jsxs(ue, { align: "start", spacing: 1, children: [
1391
- /* @__PURE__ */ e.jsx(M, { fontWeight: "medium", children: "Convert to Quantum Owned" }),
1392
- /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", color: "gray.600", children: [
1386
+ /* @__PURE__ */ e.jsx(Ve, { value: "convert", colorScheme: "green", children: /* @__PURE__ */ e.jsxs(ue, { align: "start", spacing: 1, children: [
1387
+ /* @__PURE__ */ e.jsx(S, { fontWeight: "medium", children: "Convert to Quantum Owned" }),
1388
+ /* @__PURE__ */ e.jsxs(S, { fontSize: "sm", color: "gray.600", children: [
1393
1389
  "Convert existing ",
1394
1390
  o.pluralLowerCase,
1395
1391
  " to quantum-owned"
@@ -1406,26 +1402,26 @@ const Rn = ({
1406
1402
  {
1407
1403
  placeholder: "Choose a group...",
1408
1404
  options: J,
1409
- value: J.find((a) => a.value === y) || null,
1405
+ value: J.find((a) => a.value === j) || null,
1410
1406
  onChange: ae,
1411
1407
  isLoading: Y,
1412
1408
  isDisabled: Y,
1413
1409
  isClearable: !0
1414
1410
  }
1415
1411
  ),
1416
- x.error && /* @__PURE__ */ e.jsxs(Ve, { status: "error", mt: 2, children: [
1417
- /* @__PURE__ */ e.jsx(et, {}),
1418
- /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", children: [
1412
+ d.error && /* @__PURE__ */ e.jsxs(et, { status: "error", mt: 2, children: [
1413
+ /* @__PURE__ */ e.jsx(tt, {}),
1414
+ /* @__PURE__ */ e.jsxs(S, { fontSize: "sm", children: [
1419
1415
  "Failed to load groups: ",
1420
- x.error.message
1416
+ d.error.message
1421
1417
  ] })
1422
1418
  ] })
1423
1419
  ] }),
1424
- y && /* @__PURE__ */ e.jsxs(X, { children: [
1420
+ j && /* @__PURE__ */ e.jsxs(X, { children: [
1425
1421
  /* @__PURE__ */ e.jsx(ge, { children: c === "convert" ? `Select ${o.plural} to Convert` : `Select ${o.plural} to Copy` }),
1426
1422
  i ? /* @__PURE__ */ e.jsxs(V, { children: [
1427
- /* @__PURE__ */ e.jsx(St, { size: "sm" }),
1428
- /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", color: "gray.600", children: [
1423
+ /* @__PURE__ */ e.jsx(Lt, { size: "sm" }),
1424
+ /* @__PURE__ */ e.jsxs(S, { fontSize: "sm", color: "gray.600", children: [
1429
1425
  "Loading ",
1430
1426
  o.pluralLowerCase,
1431
1427
  "..."
@@ -1437,43 +1433,43 @@ const Rn = ({
1437
1433
  placeholder: c === "convert" ? `Choose ${o.pluralLowerCase} to convert...` : `Choose ${o.pluralLowerCase} to copy...`,
1438
1434
  options: U,
1439
1435
  value: U.filter(
1440
- (a) => w.includes(a.value)
1436
+ (a) => M.includes(a.value)
1441
1437
  ),
1442
1438
  onChange: Z,
1443
1439
  isDisabled: U.length === 0,
1444
1440
  isClearable: !0,
1445
1441
  isMulti: !0,
1446
1442
  closeMenuOnSelect: !1,
1447
- formatOptionLabel: (a, { context: C }) => /* @__PURE__ */ e.jsxs(V, { justify: "space-between", w: "100%", children: [
1443
+ formatOptionLabel: (a, { context: w }) => /* @__PURE__ */ e.jsxs(V, { justify: "space-between", w: "100%", children: [
1448
1444
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
1449
- /* @__PURE__ */ e.jsx(M, { children: a.label }),
1450
- C === "value" && a.isQuantumOwned && /* @__PURE__ */ e.jsx(M, { color: "blue", fontSize: "xs", children: "(Quantum Owned)" })
1445
+ /* @__PURE__ */ e.jsx(S, { children: a.label }),
1446
+ w === "value" && a.isQuantumOwned && /* @__PURE__ */ e.jsx(S, { color: "blue", fontSize: "xs", children: "(Quantum Owned)" })
1451
1447
  ] }),
1452
- a.isQuantumOwned && C === "menu" && /* @__PURE__ */ e.jsx(Ge, { size: "sm", colorScheme: "blue", variant: "solid", children: "Quantum Owned" })
1448
+ a.isQuantumOwned && w === "menu" && /* @__PURE__ */ e.jsx(Ge, { size: "sm", colorScheme: "blue", variant: "solid", children: "Quantum Owned" })
1453
1449
  ] })
1454
1450
  }
1455
1451
  ),
1456
- U.length === 0 && /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", color: "gray.500", mt: 2, children: [
1452
+ U.length === 0 && /* @__PURE__ */ e.jsxs(S, { fontSize: "sm", color: "gray.500", mt: 2, children: [
1457
1453
  "No ",
1458
1454
  o.pluralLowerCase,
1459
1455
  " found in this group"
1460
1456
  ] })
1461
1457
  ] }),
1462
- N.error && /* @__PURE__ */ e.jsxs(Ve, { status: "error", mt: 2, children: [
1463
- /* @__PURE__ */ e.jsx(et, {}),
1464
- /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", children: [
1458
+ D.error && /* @__PURE__ */ e.jsxs(et, { status: "error", mt: 2, children: [
1459
+ /* @__PURE__ */ e.jsx(tt, {}),
1460
+ /* @__PURE__ */ e.jsxs(S, { fontSize: "sm", children: [
1465
1461
  "Failed to load ",
1466
1462
  o.pluralLowerCase,
1467
1463
  ":",
1468
1464
  " ",
1469
- N.error.message
1465
+ D.error.message
1470
1466
  ] })
1471
1467
  ] })
1472
1468
  ] }),
1473
- D.length > 0 && /* @__PURE__ */ e.jsxs(se, { p: 4, bg: "gray.50", borderRadius: "md", children: [
1474
- /* @__PURE__ */ e.jsx(M, { fontWeight: "semibold", mb: 3, children: D.length === 1 ? `${o.singular} to ${c === "copy" ? "Copy" : "Convert"}` : `${D.length} ${o.plural} to ${c === "copy" ? "Copy" : "Convert"}` }),
1469
+ P.length > 0 && /* @__PURE__ */ e.jsxs(se, { p: 4, bg: "gray.50", borderRadius: "md", children: [
1470
+ /* @__PURE__ */ e.jsx(S, { fontWeight: "semibold", mb: 3, children: P.length === 1 ? `${o.singular} to ${c === "copy" ? "Copy" : "Convert"}` : `${P.length} ${o.plural} to ${c === "copy" ? "Copy" : "Convert"}` }),
1475
1471
  /* @__PURE__ */ e.jsxs(ue, { align: "start", spacing: 3, children: [
1476
- D.map((a, C) => /* @__PURE__ */ e.jsxs(
1472
+ P.map((a, w) => /* @__PURE__ */ e.jsxs(
1477
1473
  se,
1478
1474
  {
1479
1475
  w: "100%",
@@ -1484,8 +1480,8 @@ const Rn = ({
1484
1480
  borderColor: "gray.200",
1485
1481
  children: [
1486
1482
  /* @__PURE__ */ e.jsxs(V, { justify: "space-between", align: "start", mb: 2, children: [
1487
- /* @__PURE__ */ e.jsxs(M, { fontWeight: "medium", fontSize: "sm", children: [
1488
- C + 1,
1483
+ /* @__PURE__ */ e.jsxs(S, { fontWeight: "medium", fontSize: "sm", children: [
1484
+ w + 1,
1489
1485
  ". ",
1490
1486
  a.name
1491
1487
  ] }),
@@ -1499,17 +1495,17 @@ const Rn = ({
1499
1495
  fontSize: "sm",
1500
1496
  color: "gray.600",
1501
1497
  children: [
1502
- a.description && /* @__PURE__ */ e.jsxs(M, { children: [
1498
+ a.description && /* @__PURE__ */ e.jsxs(S, { children: [
1503
1499
  /* @__PURE__ */ e.jsx("strong", { children: "Description:" }),
1504
1500
  " ",
1505
1501
  a.description
1506
1502
  ] }),
1507
- /* @__PURE__ */ e.jsxs(M, { children: [
1503
+ /* @__PURE__ */ e.jsxs(S, { children: [
1508
1504
  /* @__PURE__ */ e.jsx("strong", { children: "Activities:" }),
1509
1505
  " ",
1510
1506
  a.moduleActions.length
1511
1507
  ] }),
1512
- /* @__PURE__ */ e.jsxs(M, { children: [
1508
+ /* @__PURE__ */ e.jsxs(S, { children: [
1513
1509
  /* @__PURE__ */ e.jsx("strong", { children: "Categories:" }),
1514
1510
  " ",
1515
1511
  a.categories.map((l) => l.name).join(", ") || "None"
@@ -1521,7 +1517,7 @@ const Rn = ({
1521
1517
  },
1522
1518
  a.id
1523
1519
  )),
1524
- D.length > 1 && /* @__PURE__ */ e.jsx(
1520
+ P.length > 1 && /* @__PURE__ */ e.jsx(
1525
1521
  se,
1526
1522
  {
1527
1523
  w: "100%",
@@ -1530,9 +1526,9 @@ const Rn = ({
1530
1526
  borderRadius: "md",
1531
1527
  border: "1px solid",
1532
1528
  borderColor: "blue.200",
1533
- children: /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", fontWeight: "medium", color: "blue.800", children: [
1529
+ children: /* @__PURE__ */ e.jsxs(S, { fontSize: "sm", fontWeight: "medium", color: "blue.800", children: [
1534
1530
  "Total: ",
1535
- D.length,
1531
+ P.length,
1536
1532
  " ",
1537
1533
  o.pluralLowerCase,
1538
1534
  " will be",
@@ -1541,7 +1537,7 @@ const Rn = ({
1541
1537
  ] })
1542
1538
  }
1543
1539
  ),
1544
- d && D.filter((a) => a.moduleActions.some((C) => !C.action.quantumOwned)).length > 0 && /* @__PURE__ */ e.jsx(
1540
+ h && P.filter((a) => a.moduleActions.some((w) => !w.action.quantumOwned)).length > 0 && /* @__PURE__ */ e.jsx(
1545
1541
  se,
1546
1542
  {
1547
1543
  p: 2,
@@ -1549,155 +1545,155 @@ const Rn = ({
1549
1545
  borderRadius: "md",
1550
1546
  border: "1px solid",
1551
1547
  borderColor: "yellow.200",
1552
- children: /* @__PURE__ */ e.jsx(M, { fontSize: "sm", fontWeight: "medium", color: "yellow.800", children: c === "convert" ? `Converting ${o.plural} will convert non QM-Owned ${u.plural} to QM-Owned ${u.plural}` : `Copying ${o.plural} with Non QM-Owned ${u.plural} will create corresponding QM-Owned ${u.plural}` })
1548
+ children: /* @__PURE__ */ e.jsx(S, { fontSize: "sm", fontWeight: "medium", color: "yellow.800", children: c === "convert" ? `Converting ${o.plural} will convert non QM-Owned ${b.plural} to QM-Owned ${b.plural}` : `Copying ${o.plural} with Non QM-Owned ${b.plural} will create corresponding QM-Owned ${b.plural}` })
1553
1549
  }
1554
1550
  )
1555
1551
  ] })
1556
1552
  ] }),
1557
- !p && /* @__PURE__ */ e.jsxs(Ne, { spacing: 4, justifyContent: "flex-end", children: [
1553
+ !g && /* @__PURE__ */ e.jsxs(Ne, { spacing: 4, justifyContent: "flex-end", children: [
1558
1554
  /* @__PURE__ */ e.jsx(
1559
- te,
1555
+ ne,
1560
1556
  {
1561
1557
  variant: "outline",
1562
- onClick: B,
1563
- isDisabled: L,
1558
+ onClick: W,
1559
+ isDisabled: C,
1564
1560
  children: "Cancel"
1565
1561
  }
1566
1562
  ),
1567
1563
  /* @__PURE__ */ e.jsxs(
1568
- te,
1564
+ ne,
1569
1565
  {
1570
1566
  colorScheme: c === "copy" ? "blue" : "green",
1571
- onClick: T,
1572
- isDisabled: D.length === 0 || L,
1573
- isLoading: L,
1567
+ onClick: O,
1568
+ isDisabled: P.length === 0 || C,
1569
+ isLoading: C,
1574
1570
  loadingText: `${c === "copy" ? "Copying" : "Converting"}...`,
1575
1571
  children: [
1576
1572
  c === "copy" ? "Copy" : "Convert",
1577
1573
  " ",
1578
- D.length === 1 ? o.singular : `${D.length} ${o.plural}`
1574
+ P.length === 1 ? o.singular : `${P.length} ${o.plural}`
1579
1575
  ]
1580
1576
  }
1581
1577
  )
1582
1578
  ] })
1583
1579
  ] }) });
1584
- }, $t = rn(void 0), Ee = () => {
1585
- const s = an($t);
1586
- if (!s)
1580
+ }, Dt = an(void 0), Ee = () => {
1581
+ const n = ln(Dt);
1582
+ if (!n)
1587
1583
  throw new Error(
1588
1584
  "useUpsertModuleFormContext must be used within a UpsertModuleFormProvider"
1589
1585
  );
1590
- return s;
1591
- }, Wn = ({
1592
- name: s,
1586
+ return n;
1587
+ }, Kn = ({
1588
+ name: n,
1593
1589
  setName: t,
1594
1590
  actions: r,
1595
- moduleActionEntries: p,
1596
- setModuleActionEntries: m,
1597
- availableCategories: h,
1598
- selectedCategoryIds: d,
1599
- setSelectedCategoryIds: g,
1600
- description: n,
1591
+ moduleActionEntries: g,
1592
+ setModuleActionEntries: u,
1593
+ availableCategories: m,
1594
+ selectedCategoryIds: h,
1595
+ setSelectedCategoryIds: x,
1596
+ description: s,
1601
1597
  setDescription: o,
1602
- selectedMetadataIds: u,
1603
- setSelectedMetadataIds: y,
1604
- ...b
1598
+ selectedMetadataIds: b,
1599
+ setSelectedMetadataIds: j,
1600
+ ...L
1605
1601
  }) => {
1606
- const w = Kt(), I = $(() => {
1602
+ const M = Ht(), f = N(() => {
1607
1603
  const v = {};
1608
- return p.forEach((E) => {
1609
- v[E.actionId] = (v[E.actionId] ?? 0) + 1;
1604
+ return g.forEach((z) => {
1605
+ v[z.actionId] = (v[z.actionId] ?? 0) + 1;
1610
1606
  }), v;
1611
- }, [p]), L = _(
1612
- (v) => I[v] ?? 0,
1613
- [I]
1614
- ), f = $(() => r.map((v) => ({
1607
+ }, [g]), C = E(
1608
+ (v) => f[v] ?? 0,
1609
+ [f]
1610
+ ), p = N(() => r.map((v) => ({
1615
1611
  ...v,
1616
- selected: (I[v.id] ?? 0) > 0
1617
- })), [r, I]), c = $(() => r.reduce((v, E) => (v[E.id] = E, v), {}), [r]), k = _(
1618
- (v, E) => {
1619
- if (E) {
1620
- const R = {
1612
+ selected: (f[v.id] ?? 0) > 0
1613
+ })), [r, f]), c = N(() => r.reduce((v, z) => (v[z.id] = z, v), {}), [r]), A = E(
1614
+ (v, z) => {
1615
+ if (z) {
1616
+ const T = {
1621
1617
  key: crypto.randomUUID(),
1622
1618
  actionId: v.id,
1623
1619
  reportId: null
1624
1620
  };
1625
- m((O) => [...O, R]);
1621
+ u((F) => [...F, T]);
1626
1622
  } else
1627
- m((R) => {
1628
- for (let O = R.length - 1; O >= 0; O--)
1629
- if (R[O].actionId === v.id) {
1630
- const K = [...R];
1631
- return K.splice(O, 1), K;
1623
+ u((T) => {
1624
+ for (let F = T.length - 1; F >= 0; F--)
1625
+ if (T[F].actionId === v.id) {
1626
+ const G = [...T];
1627
+ return G.splice(F, 1), G;
1632
1628
  }
1633
- return R;
1629
+ return T;
1634
1630
  });
1635
1631
  },
1636
- [m]
1637
- ), x = _(
1632
+ [u]
1633
+ ), d = E(
1638
1634
  (v) => {
1639
1635
  t(v.target.value);
1640
1636
  },
1641
1637
  [t]
1642
- ), N = _(
1638
+ ), D = E(
1643
1639
  (v) => {
1644
1640
  o?.(v.target.value);
1645
1641
  },
1646
1642
  [o]
1647
1643
  );
1648
- return /* @__PURE__ */ e.jsxs(se, { ...b, children: [
1644
+ return /* @__PURE__ */ e.jsxs(se, { ...L, children: [
1649
1645
  /* @__PURE__ */ e.jsxs(V, { gap: "2rem", children: [
1650
- /* @__PURE__ */ e.jsx(Qn, { name: s ?? "", onInputChange: x }),
1646
+ /* @__PURE__ */ e.jsx(Hn, { name: n ?? "", onInputChange: d }),
1651
1647
  /* @__PURE__ */ e.jsx(
1652
- qn,
1648
+ Yn,
1653
1649
  {
1654
- availableCategories: h,
1655
- value: d,
1656
- onChange: g
1650
+ availableCategories: m,
1651
+ value: h,
1652
+ onChange: x
1657
1653
  }
1658
1654
  )
1659
1655
  ] }),
1660
1656
  /* @__PURE__ */ e.jsx(
1661
- Kn,
1657
+ Jn,
1662
1658
  {
1663
- description: n ?? "",
1664
- onInputChange: N
1659
+ description: s ?? "",
1660
+ onInputChange: D
1665
1661
  }
1666
1662
  ),
1667
1663
  /* @__PURE__ */ e.jsx(
1668
- Xn,
1664
+ es,
1669
1665
  {
1670
- selectedMetadataIds: u,
1671
- setSelectedMetadataIds: y
1666
+ selectedMetadataIds: b,
1667
+ setSelectedMetadataIds: j
1672
1668
  }
1673
1669
  ),
1674
1670
  /* @__PURE__ */ e.jsx(
1675
- Hn,
1671
+ Xn,
1676
1672
  {
1677
- moduleActionEntries: p,
1678
- setModuleActionEntries: m,
1673
+ moduleActionEntries: g,
1674
+ setModuleActionEntries: u,
1679
1675
  actionsById: c,
1680
- onAdjustActivities: () => w.onOpen()
1676
+ onAdjustActivities: () => M.onOpen()
1681
1677
  }
1682
1678
  ),
1683
1679
  /* @__PURE__ */ e.jsxs(
1684
- Ht,
1680
+ Yt,
1685
1681
  {
1686
- isOpen: w.isOpen,
1687
- onClose: w.onClose,
1682
+ isOpen: M.isOpen,
1683
+ onClose: M.onClose,
1688
1684
  size: "6xl",
1689
1685
  children: [
1690
- /* @__PURE__ */ e.jsx(Yt, {}),
1691
- /* @__PURE__ */ e.jsxs(Jt, { children: [
1692
- /* @__PURE__ */ e.jsx(Xt, { children: "Select Activities" }),
1693
- /* @__PURE__ */ e.jsx(Zt, {}),
1694
- /* @__PURE__ */ e.jsx(Vt, { children: /* @__PURE__ */ e.jsx(
1695
- Un,
1686
+ /* @__PURE__ */ e.jsx(Jt, {}),
1687
+ /* @__PURE__ */ e.jsxs(Xt, { children: [
1688
+ /* @__PURE__ */ e.jsx(Zt, { children: "Select Activities" }),
1689
+ /* @__PURE__ */ e.jsx(Vt, {}),
1690
+ /* @__PURE__ */ e.jsx(en, { children: /* @__PURE__ */ e.jsx(
1691
+ qn,
1696
1692
  {
1697
- actions: f,
1698
- onSelected: k,
1693
+ actions: p,
1694
+ onSelected: A,
1699
1695
  allowDuplicateSelection: !0,
1700
- getSelectedCount: L,
1696
+ getSelectedCount: C,
1701
1697
  disableCreate: !0,
1702
1698
  disableDelete: !0,
1703
1699
  tableProps: {
@@ -1706,12 +1702,12 @@ const Rn = ({
1706
1702
  }
1707
1703
  }
1708
1704
  ) }),
1709
- /* @__PURE__ */ e.jsx(en, { children: /* @__PURE__ */ e.jsx(
1710
- te,
1705
+ /* @__PURE__ */ e.jsx(tn, { children: /* @__PURE__ */ e.jsx(
1706
+ ne,
1711
1707
  {
1712
1708
  colorScheme: "blue",
1713
- onClick: w.onClose,
1714
- isDisabled: p.length === 0,
1709
+ onClick: M.onClose,
1710
+ isDisabled: g.length === 0,
1715
1711
  children: "Done"
1716
1712
  }
1717
1713
  ) })
@@ -1720,72 +1716,72 @@ const Rn = ({
1720
1716
  }
1721
1717
  )
1722
1718
  ] });
1723
- }, Qn = Ae(
1719
+ }, Hn = Ae(
1724
1720
  ({
1725
- name: s,
1721
+ name: n,
1726
1722
  onInputChange: t
1727
1723
  }) => {
1728
- const { getLabel: r } = xe(), p = r("module"), { isView: m } = Ee();
1724
+ const { getLabel: r } = xe(), g = r("module"), { isView: u } = Ee();
1729
1725
  return /* @__PURE__ */ e.jsxs(X, { mb: 4, children: [
1730
1726
  /* @__PURE__ */ e.jsxs(ge, { children: [
1731
- p,
1727
+ g,
1732
1728
  " Name"
1733
1729
  ] }),
1734
1730
  /* @__PURE__ */ e.jsx(
1735
1731
  ye,
1736
1732
  {
1737
1733
  placeholder: "i.e. ACL RTP Test Battery",
1738
- value: s,
1734
+ value: n,
1739
1735
  onChange: t,
1740
1736
  isRequired: !0,
1741
- isDisabled: m
1737
+ isDisabled: u
1742
1738
  }
1743
1739
  )
1744
1740
  ] });
1745
1741
  }
1746
- ), qn = Ae(
1742
+ ), Yn = Ae(
1747
1743
  ({
1748
- availableCategories: s,
1744
+ availableCategories: n,
1749
1745
  value: t,
1750
1746
  onChange: r
1751
1747
  }) => {
1752
- const { getLabel: p } = xe(), m = p("module"), { isView: h } = Ee(), d = $(() => s.map((g) => ({
1753
- value: g.id,
1754
- label: g.name
1755
- })), [s]);
1748
+ const { getLabel: g } = xe(), u = g("module"), { isView: m } = Ee(), h = N(() => n.map((x) => ({
1749
+ value: x.id,
1750
+ label: x.name
1751
+ })), [n]);
1756
1752
  return /* @__PURE__ */ e.jsxs(X, { mb: 4, children: [
1757
1753
  /* @__PURE__ */ e.jsxs(ge, { children: [
1758
- m,
1754
+ u,
1759
1755
  " Category"
1760
1756
  ] }),
1761
1757
  /* @__PURE__ */ e.jsx(
1762
1758
  he,
1763
1759
  {
1764
- isDisabled: s.length === 0 || h,
1765
- options: d,
1766
- value: s.filter((g) => t.includes(g.id)).map((g) => ({
1767
- value: g.id,
1768
- label: g.name
1760
+ isDisabled: n.length === 0 || m,
1761
+ options: h,
1762
+ value: n.filter((x) => t.includes(x.id)).map((x) => ({
1763
+ value: x.id,
1764
+ label: x.name
1769
1765
  }))[0] ?? null,
1770
- onChange: (g) => r(g ? [g.value] : []),
1766
+ onChange: (x) => r(x ? [x.value] : []),
1771
1767
  placeholder: "Select category"
1772
1768
  }
1773
1769
  )
1774
1770
  ] });
1775
1771
  }
1776
- ), Kn = Ae(
1772
+ ), Jn = Ae(
1777
1773
  ({
1778
- description: s,
1774
+ description: n,
1779
1775
  onInputChange: t
1780
1776
  }) => {
1781
- const { getLabel: r } = xe(), p = r("module"), { isView: m } = Ee();
1777
+ const { getLabel: r } = xe(), g = r("module"), { isView: u } = Ee();
1782
1778
  return /* @__PURE__ */ e.jsxs(X, { mb: 4, children: [
1783
1779
  /* @__PURE__ */ e.jsx(ge, { children: /* @__PURE__ */ e.jsxs("span", { children: [
1784
1780
  "Description",
1785
- /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", color: "gray.500", children: [
1781
+ /* @__PURE__ */ e.jsxs(S, { fontSize: "sm", color: "gray.500", children: [
1786
1782
  "Briefly describe the objective of this",
1787
1783
  " ",
1788
- p.toLocaleLowerCase(),
1784
+ g.toLocaleLowerCase(),
1789
1785
  ". Max 40 words."
1790
1786
  ] })
1791
1787
  ] }) }),
@@ -1793,277 +1789,277 @@ const Rn = ({
1793
1789
  ye,
1794
1790
  {
1795
1791
  placeholder: "i.e. Assess readiness to return to play post-ACL reconstruction",
1796
- value: s,
1792
+ value: n,
1797
1793
  onChange: t,
1798
- isDisabled: m
1794
+ isDisabled: u
1799
1795
  }
1800
1796
  )
1801
1797
  ] });
1802
1798
  }
1803
- ), Hn = Ae(
1799
+ ), Xn = Ae(
1804
1800
  ({
1805
- moduleActionEntries: s,
1801
+ moduleActionEntries: n,
1806
1802
  setModuleActionEntries: t,
1807
1803
  actionsById: r,
1808
- onAdjustActivities: p
1804
+ onAdjustActivities: g
1809
1805
  }) => {
1810
- const { getLabel: m } = xe(), { isView: h } = Ee(), d = $(() => ({
1811
- module: m("module"),
1812
- moduleLowerCase: m("module").toLocaleLowerCase(),
1813
- action: m("action"),
1814
- actionPlural: m("action_plural"),
1815
- actionPluralLowerCase: m("action_plural").toLocaleLowerCase()
1816
- }), [m]), g = $(
1817
- () => s.map((n) => {
1818
- const o = r[n.actionId];
1806
+ const { getLabel: u } = xe(), { isView: m } = Ee(), h = N(() => ({
1807
+ module: u("module"),
1808
+ moduleLowerCase: u("module").toLocaleLowerCase(),
1809
+ action: u("action"),
1810
+ actionPlural: u("action_plural"),
1811
+ actionPluralLowerCase: u("action_plural").toLocaleLowerCase()
1812
+ }), [u]), x = N(
1813
+ () => n.map((s) => {
1814
+ const o = r[s.actionId];
1819
1815
  return o ? {
1820
- key: n.key,
1821
- actionId: n.actionId,
1816
+ key: s.key,
1817
+ actionId: s.actionId,
1822
1818
  name: o.name,
1823
- reports: A(Fe, o.reports) || [],
1824
- selectedReportId: n.reportId
1819
+ reports: k(Pe, o.reports) || [],
1820
+ selectedReportId: s.reportId
1825
1821
  } : null;
1826
1822
  }).filter(Boolean),
1827
- [s, r]
1823
+ [n, r]
1828
1824
  );
1829
1825
  return /* @__PURE__ */ e.jsxs(X, { mb: 4, children: [
1830
1826
  /* @__PURE__ */ e.jsxs(V, { justifyContent: "space-between", children: [
1831
1827
  /* @__PURE__ */ e.jsx(ge, { children: /* @__PURE__ */ e.jsxs("span", { children: [
1832
- d.actionPlural,
1833
- !h && /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", color: "gray.500", children: [
1828
+ h.actionPlural,
1829
+ !m && /* @__PURE__ */ e.jsxs(S, { fontSize: "sm", color: "gray.500", children: [
1834
1830
  "Drag and drop to reorder the ",
1835
- d.actionPluralLowerCase,
1831
+ h.actionPluralLowerCase,
1836
1832
  " ",
1837
1833
  "in this ",
1838
- d.moduleLowerCase,
1834
+ h.moduleLowerCase,
1839
1835
  "."
1840
1836
  ] })
1841
1837
  ] }) }),
1842
- !h && /* @__PURE__ */ e.jsxs(
1843
- te,
1838
+ !m && /* @__PURE__ */ e.jsxs(
1839
+ ne,
1844
1840
  {
1845
1841
  size: "sm",
1846
1842
  variant: "solid",
1847
1843
  colorScheme: "blue",
1848
- onClick: p,
1844
+ onClick: g,
1849
1845
  children: [
1850
1846
  "Add / Remove ",
1851
- d.actionPlural
1847
+ h.actionPlural
1852
1848
  ]
1853
1849
  }
1854
1850
  )
1855
1851
  ] }),
1856
- g.length === 0 ? /* @__PURE__ */ e.jsx(ue, { children: /* @__PURE__ */ e.jsxs(M, { color: "gray.500", fontSize: "lg", mb: "4rem", mt: "4rem", children: [
1852
+ x.length === 0 ? /* @__PURE__ */ e.jsx(ue, { children: /* @__PURE__ */ e.jsxs(S, { color: "gray.500", fontSize: "lg", mb: "4rem", mt: "4rem", children: [
1857
1853
  "No ",
1858
- d.actionPluralLowerCase,
1854
+ h.actionPluralLowerCase,
1859
1855
  " selected for this",
1860
1856
  " ",
1861
- d.moduleLowerCase,
1857
+ h.moduleLowerCase,
1862
1858
  ".",
1863
- !h && /* @__PURE__ */ e.jsxs(
1864
- te,
1859
+ !m && /* @__PURE__ */ e.jsxs(
1860
+ ne,
1865
1861
  {
1866
1862
  ml: "0.5em",
1867
1863
  size: "sm",
1868
1864
  variant: "link",
1869
1865
  colorScheme: "blue",
1870
- onClick: p,
1866
+ onClick: g,
1871
1867
  children: [
1872
1868
  "Add ",
1873
- d.actionPluralLowerCase,
1869
+ h.actionPluralLowerCase,
1874
1870
  "."
1875
1871
  ]
1876
1872
  }
1877
1873
  )
1878
1874
  ] }) }) : /* @__PURE__ */ e.jsx(
1879
- Yn,
1875
+ Zn,
1880
1876
  {
1881
- value: g,
1882
- onChange: (n) => {
1877
+ value: x,
1878
+ onChange: (s) => {
1883
1879
  t((o) => {
1884
- const u = o.map((b) => {
1885
- const w = r[b.actionId];
1886
- return w ? {
1887
- key: b.key,
1888
- actionId: b.actionId,
1889
- name: w.name,
1890
- reports: A(Fe, w.reports) || [],
1891
- selectedReportId: b.reportId
1880
+ const b = o.map((L) => {
1881
+ const M = r[L.actionId];
1882
+ return M ? {
1883
+ key: L.key,
1884
+ actionId: L.actionId,
1885
+ name: M.name,
1886
+ reports: k(Pe, M.reports) || [],
1887
+ selectedReportId: L.reportId
1892
1888
  } : null;
1893
1889
  }).filter(Boolean);
1894
- return n(u).map((b) => ({
1895
- key: b.key,
1896
- actionId: b.actionId,
1897
- reportId: b.selectedReportId
1890
+ return s(b).map((L) => ({
1891
+ key: L.key,
1892
+ actionId: L.actionId,
1893
+ reportId: L.selectedReportId
1898
1894
  }));
1899
1895
  });
1900
1896
  },
1901
- disabled: h,
1897
+ disabled: m,
1902
1898
  setModuleActionEntries: t
1903
1899
  }
1904
1900
  )
1905
1901
  ] });
1906
1902
  }
1907
- ), Yn = Ae(
1903
+ ), Zn = Ae(
1908
1904
  ({
1909
- value: s,
1905
+ value: n,
1910
1906
  onChange: t,
1911
1907
  disabled: r,
1912
- setModuleActionEntries: p
1908
+ setModuleActionEntries: g
1913
1909
  }) => {
1914
- const [m] = q(
1910
+ const [u] = K(
1915
1911
  () => Math.random().toString(36).substring(2, 15)
1916
- ), h = _(
1917
- (n, o) => {
1918
- r || t((u) => {
1919
- const y = [...u], [b] = y.splice(n, 1);
1920
- return y.splice(o, 0, b), y;
1912
+ ), m = E(
1913
+ (s, o) => {
1914
+ r || t((b) => {
1915
+ const j = [...b], [L] = j.splice(s, 1);
1916
+ return j.splice(o, 0, L), j;
1921
1917
  });
1922
1918
  },
1923
1919
  [t, r]
1924
- ), d = _(
1925
- (n) => {
1926
- p((o) => {
1927
- const u = o.findIndex((I) => I.key === n);
1928
- if (u === -1) return o;
1929
- const y = o[u], b = {
1920
+ ), h = E(
1921
+ (s) => {
1922
+ g((o) => {
1923
+ const b = o.findIndex((f) => f.key === s);
1924
+ if (b === -1) return o;
1925
+ const j = o[b], L = {
1930
1926
  key: crypto.randomUUID(),
1931
- actionId: y.actionId,
1927
+ actionId: j.actionId,
1932
1928
  reportId: null
1933
- }, w = [...o];
1934
- return w.splice(u + 1, 0, b), w;
1929
+ }, M = [...o];
1930
+ return M.splice(b + 1, 0, L), M;
1935
1931
  });
1936
1932
  },
1937
- [p]
1938
- ), g = _(
1939
- (n) => {
1940
- p(
1941
- (o) => o.filter((u) => u.key !== n)
1933
+ [g]
1934
+ ), x = E(
1935
+ (s) => {
1936
+ g(
1937
+ (o) => o.filter((b) => b.key !== s)
1942
1938
  );
1943
1939
  },
1944
- [p]
1940
+ [g]
1945
1941
  );
1946
- return /* @__PURE__ */ e.jsx(se, { children: /* @__PURE__ */ e.jsx(Sn, { backend: Ln, children: /* @__PURE__ */ e.jsx(ue, { spacing: 3, align: "stretch", children: s.map((n, o) => /* @__PURE__ */ e.jsx(
1947
- Jn,
1942
+ return /* @__PURE__ */ e.jsx(se, { children: /* @__PURE__ */ e.jsx(Mn, { backend: An, children: /* @__PURE__ */ e.jsx(ue, { spacing: 3, align: "stretch", children: n.map((s, o) => /* @__PURE__ */ e.jsx(
1943
+ Vn,
1948
1944
  {
1949
- listKey: m,
1950
- item: n,
1945
+ listKey: u,
1946
+ item: s,
1951
1947
  index: o,
1952
1948
  disabled: !!r,
1953
- move: h,
1954
- onReportChange: (u) => {
1955
- p(
1956
- (y) => y.map(
1957
- (b) => b.key === n.key ? { ...b, reportId: u } : b
1949
+ move: m,
1950
+ onReportChange: (b) => {
1951
+ g(
1952
+ (j) => j.map(
1953
+ (L) => L.key === s.key ? { ...L, reportId: b } : L
1958
1954
  )
1959
1955
  );
1960
1956
  },
1961
- onDuplicate: () => d(n.key),
1962
- onRemove: () => g(n.key)
1957
+ onDuplicate: () => h(s.key),
1958
+ onRemove: () => x(s.key)
1963
1959
  },
1964
- n.key
1960
+ s.key
1965
1961
  )) }) }) });
1966
1962
  }
1967
- ), Jn = Ae(
1963
+ ), Vn = Ae(
1968
1964
  ({
1969
- listKey: s,
1965
+ listKey: n,
1970
1966
  item: t,
1971
1967
  index: r,
1972
- disabled: p,
1973
- move: m,
1974
- onReportChange: h,
1975
- onDuplicate: d,
1976
- onRemove: g
1968
+ disabled: g,
1969
+ move: u,
1970
+ onReportChange: m,
1971
+ onDuplicate: h,
1972
+ onRemove: x
1977
1973
  }) => {
1978
- const n = ln(null), { getLabel: o } = xe(), u = o("action"), [{ handlerId: y }, b] = kn({
1979
- accept: s,
1980
- collect: (x) => ({
1981
- handlerId: x.getHandlerId()?.toString() ?? ""
1974
+ const s = cn(null), { getLabel: o } = xe(), b = o("action"), [{ handlerId: j }, L] = On({
1975
+ accept: n,
1976
+ collect: (d) => ({
1977
+ handlerId: d.getHandlerId()?.toString() ?? ""
1982
1978
  }),
1983
- hover: (x, N) => {
1984
- if (!n.current)
1979
+ hover: (d, D) => {
1980
+ if (!s.current)
1985
1981
  return;
1986
- const v = x.index, E = r;
1987
- if (v === E)
1982
+ const v = d.index, z = r;
1983
+ if (v === z)
1988
1984
  return;
1989
- const R = n.current?.getBoundingClientRect(), O = (R.bottom - R.top) / 2, oe = N.getClientOffset().y - R.top;
1990
- v < E && oe < O || v > E && oe > O || (m(v, E), x.index = E);
1985
+ const T = s.current?.getBoundingClientRect(), F = (T.bottom - T.top) / 2, oe = D.getClientOffset().y - T.top;
1986
+ v < z && oe < F || v > z && oe > F || (u(v, z), d.index = z);
1991
1987
  }
1992
- }), [{ isDragging: w }, I] = Mn({
1993
- type: s,
1988
+ }), [{ isDragging: M }, f] = Tn({
1989
+ type: n,
1994
1990
  item: () => ({ id: t.key, index: r }),
1995
- collect: (x) => ({
1996
- isDragging: x.isDragging()
1991
+ collect: (d) => ({
1992
+ isDragging: d.isDragging()
1997
1993
  }),
1998
- canDrag: !p
1999
- }), L = $(() => `action-report-label-${t.key}`, [t.key]), f = $(() => [
1994
+ canDrag: !g
1995
+ }), C = N(() => `action-report-label-${t.key}`, [t.key]), p = N(() => [
2000
1996
  { value: null, label: "No Report" },
2001
- ...t.reports.map((x) => {
2002
- const N = x.name && x.name.length > 0 ? x.name : "No Name", v = ke(x.reportKind);
1997
+ ...t.reports.map((d) => {
1998
+ const D = d.name && d.name.length > 0 ? d.name : "No Name", v = ke(d.reportKind);
2003
1999
  return {
2004
- value: x.id,
2005
- label: `${N} (${v})`
2000
+ value: d.id,
2001
+ label: `${D} (${v})`
2006
2002
  };
2007
2003
  })
2008
- ], [t.reports]), c = w ? 0.6 : 1, k = p ? "default" : w ? "grabbing" : "grab";
2009
- return I(b(n)), /* @__PURE__ */ e.jsx(
2004
+ ], [t.reports]), c = M ? 0.6 : 1, A = g ? "default" : M ? "grabbing" : "grab";
2005
+ return f(L(s)), /* @__PURE__ */ e.jsx(
2010
2006
  se,
2011
2007
  {
2012
- ref: n,
2008
+ ref: s,
2013
2009
  p: 3,
2014
2010
  border: "1px solid",
2015
2011
  borderColor: "gray.200",
2016
2012
  borderRadius: "md",
2017
2013
  bg: "gray.50",
2018
- style: { opacity: c, cursor: k },
2019
- "data-handler-id": y,
2014
+ style: { opacity: c, cursor: A },
2015
+ "data-handler-id": j,
2020
2016
  children: /* @__PURE__ */ e.jsxs(V, { justify: "space-between", align: "center", children: [
2021
2017
  /* @__PURE__ */ e.jsxs(V, { spacing: 3, children: [
2022
- /* @__PURE__ */ e.jsxs(M, { fontWeight: "semibold", minW: "2rem", children: [
2018
+ /* @__PURE__ */ e.jsxs(S, { fontWeight: "semibold", minW: "2rem", children: [
2023
2019
  r + 1,
2024
2020
  "."
2025
2021
  ] }),
2026
- /* @__PURE__ */ e.jsx(M, { fontWeight: "medium", children: t.name })
2022
+ /* @__PURE__ */ e.jsx(S, { fontWeight: "medium", children: t.name })
2027
2023
  ] }),
2028
2024
  /* @__PURE__ */ e.jsxs(V, { spacing: 3, align: "center", children: [
2029
- /* @__PURE__ */ e.jsxs(M, { id: L, fontSize: "sm", color: "gray.600", children: [
2030
- u,
2025
+ /* @__PURE__ */ e.jsxs(S, { id: C, fontSize: "sm", color: "gray.600", children: [
2026
+ b,
2031
2027
  " Report:"
2032
2028
  ] }),
2033
2029
  /* @__PURE__ */ e.jsx(se, { width: { base: "100%", md: "350px" }, children: /* @__PURE__ */ e.jsx(
2034
2030
  he,
2035
2031
  {
2036
- "aria-labelledby": L,
2037
- value: f.find(
2038
- (x) => x.value === t.selectedReportId
2032
+ "aria-labelledby": C,
2033
+ value: p.find(
2034
+ (d) => d.value === t.selectedReportId
2039
2035
  ),
2040
- onChange: (x) => {
2041
- h(x?.value || null);
2036
+ onChange: (d) => {
2037
+ m(d?.value || null);
2042
2038
  },
2043
- options: f,
2039
+ options: p,
2044
2040
  placeholder: "Select report...",
2045
- isDisabled: p
2041
+ isDisabled: g
2046
2042
  }
2047
2043
  ) }),
2048
- !p && /* @__PURE__ */ e.jsxs(V, { spacing: 1, children: [
2044
+ !g && /* @__PURE__ */ e.jsxs(V, { spacing: 1, children: [
2049
2045
  /* @__PURE__ */ e.jsx(
2050
- te,
2046
+ ne,
2051
2047
  {
2052
2048
  size: "xs",
2053
2049
  variant: "ghost",
2054
2050
  colorScheme: "blue",
2055
- onClick: d,
2051
+ onClick: h,
2056
2052
  title: "Add another instance with a different report",
2057
2053
  children: "+ Duplicate"
2058
2054
  }
2059
2055
  ),
2060
2056
  /* @__PURE__ */ e.jsx(
2061
- te,
2057
+ ne,
2062
2058
  {
2063
2059
  size: "xs",
2064
2060
  variant: "ghost",
2065
2061
  colorScheme: "red",
2066
- onClick: g,
2062
+ onClick: x,
2067
2063
  title: "Remove this entry",
2068
2064
  children: "Remove"
2069
2065
  }
@@ -2074,12 +2070,12 @@ const Rn = ({
2074
2070
  }
2075
2071
  );
2076
2072
  }
2077
- ), Xn = Ae(
2073
+ ), es = Ae(
2078
2074
  ({
2079
- selectedMetadataIds: s,
2075
+ selectedMetadataIds: n,
2080
2076
  setSelectedMetadataIds: t
2081
2077
  }) => {
2082
- const { getLabel: r } = xe(), { isView: p, metadataOptions: m } = Ee(), h = $(() => [
2078
+ const { getLabel: r } = xe(), { isView: g, metadataOptions: u } = Ee(), m = N(() => [
2083
2079
  {
2084
2080
  key: "activity_type",
2085
2081
  label: `${r("action")} Type`,
@@ -2088,114 +2084,117 @@ const Rn = ({
2088
2084
  { key: "session_type", label: "Session Type", multi: !0 },
2089
2085
  { key: "body_region", label: "Body Region", multi: !0 },
2090
2086
  { key: "sport", label: "Sport", multi: !0 }
2091
- ], [r]), d = _(
2092
- (g, n) => {
2093
- const o = h.find((y) => y.key === g);
2087
+ ], [r]), h = E(
2088
+ (x, s) => {
2089
+ const o = m.find((j) => j.key === x);
2094
2090
  if (!o) return;
2095
- const u = o.multi ? (n ?? []).map((y) => y.id) : n ? [n.id] : [];
2096
- t((y) => [...y.filter((w) => Object.values(m || {}).flat().find((L) => L.id === w) && !Object.keys(m || {}).find(
2097
- (L) => m?.[L]?.some(
2098
- (f) => f.id === w && L === g
2091
+ const b = o.multi ? (s ?? []).map((j) => j.id) : s ? [s.id] : [];
2092
+ t((j) => [...j.filter((M) => Object.values(u || {}).flat().find((C) => C.id === M) && !Object.keys(u || {}).find(
2093
+ (C) => u?.[C]?.some(
2094
+ (p) => p.id === M && C === x
2099
2095
  )
2100
- )), ...u]);
2096
+ )), ...b]);
2101
2097
  },
2102
- [h, m, t]
2098
+ [m, u, t]
2103
2099
  );
2104
- return m ? /* @__PURE__ */ e.jsxs(X, { mb: 4, children: [
2100
+ return u ? /* @__PURE__ */ e.jsxs(X, { mb: 4, children: [
2105
2101
  /* @__PURE__ */ e.jsx(ge, { children: "Metadata Tags" }),
2106
- /* @__PURE__ */ e.jsx(V, { gap: "1rem", align: "start", children: h.map((g) => /* @__PURE__ */ e.jsxs(X, { flex: "1", children: [
2107
- /* @__PURE__ */ e.jsx(_e, { fontSize: "sm", children: g.label }),
2102
+ /* @__PURE__ */ e.jsx(V, { gap: "1rem", align: "start", children: m.map((x) => /* @__PURE__ */ e.jsxs(X, { flex: "1", children: [
2103
+ /* @__PURE__ */ e.jsx(ze, { fontSize: "sm", children: x.label }),
2108
2104
  /* @__PURE__ */ e.jsx(
2109
2105
  he,
2110
2106
  {
2111
- isMulti: g.multi,
2112
- value: m[g.key]?.filter(
2113
- (n) => s.includes(n.id)
2107
+ isMulti: x.multi,
2108
+ value: u[x.key]?.filter(
2109
+ (s) => n.includes(s.id)
2114
2110
  ),
2115
- onChange: (n) => {
2116
- d(
2117
- g.key,
2118
- n
2111
+ onChange: (s) => {
2112
+ h(
2113
+ x.key,
2114
+ s
2119
2115
  );
2120
2116
  },
2121
- options: m[g.key],
2122
- placeholder: `Select ${g.multi ? "one or more" : "one"} ${g.label.toLowerCase()}`,
2123
- isDisabled: p,
2124
- isClearable: g.multi
2117
+ options: u[x.key],
2118
+ placeholder: `Select ${x.multi ? "one or more" : "one"} ${x.label.toLowerCase()}`,
2119
+ isDisabled: g,
2120
+ isClearable: x.multi
2125
2121
  }
2126
2122
  )
2127
- ] }, g.key)) })
2123
+ ] }, x.key)) })
2128
2124
  ] }) : null;
2129
2125
  }
2130
- ), Zn = ({
2131
- value: s,
2126
+ ), ts = ({
2127
+ value: n,
2132
2128
  onChange: t,
2133
2129
  forceKind: r,
2134
- disableRemove: p,
2135
- disableKind: m,
2136
- isDisabled: h,
2137
- lockRanges: d,
2138
- ...g
2130
+ disableRemove: g,
2131
+ disableKind: u,
2132
+ isDisabled: m,
2133
+ lockRanges: h,
2134
+ canAddCopy: x,
2135
+ ...s
2139
2136
  }) => {
2140
- const n = $(() => [...s].sort((b, w) => {
2141
- const I = bt.indexOf(b.plane), L = bt.indexOf(w.plane);
2142
- return I - L;
2143
- }), [s]), o = _((b) => "segment" in b.id ? Nt(b.id.segment, b.plane, !0) ?? "Unknown" : Rt(b.id.joint, b.plane, !0) ?? "Unknown", []), u = _(
2144
- (b, w) => {
2145
- const I = n.findIndex(
2146
- (f) => f.id === w.id && f.plane === w.plane
2147
- );
2148
- let L = [...n];
2149
- r && (w = { ...w, kind: r }), L[I] = w, d && (L = L.map((f) => ({
2150
- ...f,
2151
- min: w.min,
2152
- max: w.max
2153
- }))), t(L);
2137
+ const o = N(() => n.map((f, C) => C).sort((f, C) => {
2138
+ const p = bt.indexOf(n[f].plane), c = bt.indexOf(n[C].plane);
2139
+ return p - c;
2140
+ }), [n]), b = E((f) => "segment" in f.id ? Rt(f.id.segment, f.plane, !0) ?? "Unknown" : $t(f.id.joint, f.plane, !0) ?? "Unknown", []), j = E(
2141
+ (f, C) => {
2142
+ let p = [...n];
2143
+ r && (C = { ...C, kind: r }), p[f] = C, h && (p = p.map((c) => ({
2144
+ ...c,
2145
+ min: C.min,
2146
+ max: C.max
2147
+ }))), t(p);
2154
2148
  },
2155
- [t, n, r, d]
2156
- ), y = _(
2157
- (b) => {
2158
- const w = n.filter(
2159
- (I) => I.id !== b.id || I.plane !== b.plane
2160
- );
2161
- t(w);
2149
+ [t, n, r, h]
2150
+ ), L = E(
2151
+ (f) => {
2152
+ t(n.filter((C, p) => p !== f));
2153
+ },
2154
+ [t, n]
2155
+ ), M = E(
2156
+ (f) => {
2157
+ const C = [...n];
2158
+ C.splice(f + 1, 0, { ...n[f], oldId: void 0 }), t(C);
2162
2159
  },
2163
2160
  [t, n]
2164
2161
  );
2165
- return /* @__PURE__ */ e.jsx(ue, { alignItems: "flex-start", overflowY: "auto", ...g, children: n.map((b, w) => /* @__PURE__ */ e.jsx(
2166
- Vn,
2162
+ return /* @__PURE__ */ e.jsx(ue, { alignItems: "flex-start", overflowY: "auto", ...s, children: o.map((f) => /* @__PURE__ */ e.jsx(
2163
+ ns,
2167
2164
  {
2168
- label: o(b),
2169
- parameter: b,
2170
- onChange: (I) => u(w, I),
2171
- onRemove: p || h ? void 0 : () => y(b),
2165
+ label: b(n[f]),
2166
+ parameter: n[f],
2167
+ onChange: (C) => j(f, C),
2168
+ onRemove: g || m ? void 0 : () => L(f),
2169
+ onAddCopy: x && !m ? () => M(f) : void 0,
2172
2170
  forceKind: r,
2173
- disableKind: m || h,
2174
- isDisabled: h
2171
+ disableKind: u || m,
2172
+ isDisabled: m
2175
2173
  },
2176
- `${JSON.stringify(b.id)}-${b.plane}`
2174
+ n[f].oldId ?? `new-${f}`
2177
2175
  )) });
2178
- }, Vn = ({
2179
- label: s,
2176
+ }, ns = ({
2177
+ label: n,
2180
2178
  parameter: t,
2181
2179
  onChange: r,
2182
- onRemove: p,
2180
+ onRemove: g,
2181
+ onAddCopy: u,
2183
2182
  forceKind: m,
2184
2183
  disableKind: h,
2185
- isDisabled: d
2184
+ isDisabled: x
2186
2185
  }) => {
2187
- const g = _(
2188
- (u) => "joint" in t.id ? An(
2186
+ const s = E(
2187
+ (j) => "joint" in t.id ? Nn(
2189
2188
  t.id.joint,
2190
2189
  t.plane,
2191
- u < 0 ? -1 : 1
2192
- ) : On(
2190
+ j < 0 ? -1 : 1
2191
+ ) : Rn(
2193
2192
  t.id.segment,
2194
2193
  t.plane,
2195
- u < 0 ? -1 : 1
2194
+ j < 0 ? -1 : 1
2196
2195
  ),
2197
2196
  [t]
2198
- ), { min: n, max: o } = "joint" in t.id ? Tn(t.id.joint, t.plane) : { min: -180, max: 180 };
2197
+ ), { min: o, max: b } = "joint" in t.id ? $n(t.id.joint, t.plane) : { min: -180, max: 180 };
2199
2198
  return /* @__PURE__ */ e.jsxs(
2200
2199
  ue,
2201
2200
  {
@@ -2209,35 +2208,46 @@ const Rn = ({
2209
2208
  children: [
2210
2209
  /* @__PURE__ */ e.jsxs(V, { w: "100%", alignItems: "center", children: [
2211
2210
  /* @__PURE__ */ e.jsx(
2212
- M,
2211
+ S,
2213
2212
  {
2214
2213
  fontSize: "sm",
2215
2214
  flex: 1,
2216
2215
  textTransform: "capitalize",
2217
2216
  fontWeight: "semibold",
2218
- children: s
2217
+ children: n
2219
2218
  }
2220
2219
  ),
2221
2220
  t.sensorOnly ? /* @__PURE__ */ e.jsx(Oe, { size: "sm", colorScheme: "orange", variant: "subtle", children: "Sensor" }) : /* @__PURE__ */ e.jsxs(V, { spacing: 1, children: [
2222
2221
  /* @__PURE__ */ e.jsx(Oe, { size: "sm", colorScheme: "blue", variant: "subtle", children: "Pose" }),
2223
2222
  /* @__PURE__ */ e.jsx(Oe, { size: "sm", colorScheme: "orange", variant: "subtle", children: "Sensor" })
2224
2223
  ] }),
2225
- p && !d && /* @__PURE__ */ e.jsx(
2226
- ot,
2224
+ u && /* @__PURE__ */ e.jsx(
2225
+ Ze,
2226
+ {
2227
+ size: "xs",
2228
+ variant: "ghost",
2229
+ "aria-label": "Add another",
2230
+ title: "Add this parameter again with its own range",
2231
+ icon: /* @__PURE__ */ e.jsx(at, { as: Ln }),
2232
+ onClick: u
2233
+ }
2234
+ ),
2235
+ g && !x && /* @__PURE__ */ e.jsx(
2236
+ Ze,
2227
2237
  {
2228
2238
  size: "xs",
2229
2239
  variant: "ghost",
2230
2240
  "aria-label": "delete",
2231
- icon: /* @__PURE__ */ e.jsx(Ct, { as: In }),
2232
- onClick: p
2241
+ icon: /* @__PURE__ */ e.jsx(at, { as: kn }),
2242
+ onClick: g
2233
2243
  }
2234
2244
  ),
2235
2245
  !m && /* @__PURE__ */ e.jsx(
2236
- $n,
2246
+ Gn,
2237
2247
  {
2238
2248
  selectedItem: t?.kind ?? Xe.Limit,
2239
- onChange: ({ value: u }) => r({ ...t, kind: u }),
2240
- isDisabled: h || d,
2249
+ onChange: ({ value: j }) => r({ ...t, kind: j }),
2250
+ isDisabled: h || x,
2241
2251
  buttonProps: {
2242
2252
  size: "sm",
2243
2253
  variant: "outline",
@@ -2255,53 +2265,53 @@ const Rn = ({
2255
2265
  )
2256
2266
  ] }),
2257
2267
  /* @__PURE__ */ e.jsx(
2258
- Dn,
2268
+ Pn,
2259
2269
  {
2260
2270
  w: "100%",
2261
2271
  size: "xs",
2262
- min: n,
2263
- max: o,
2272
+ min: o,
2273
+ max: b,
2264
2274
  zeroMarker: !0,
2265
2275
  value: [t.min, t.max],
2266
- onChange: (u) => r({ ...t, min: u[0], max: u[1] }),
2267
- formatValue: (u) => `${Math.abs(u)}°`,
2268
- valueLabel: (u) => g(u) ?? "",
2269
- positiveNegativeLabels: g(0) ? [g(-1) ?? "", g(1) ?? ""] : void 0,
2270
- isDisabled: d
2276
+ onChange: (j) => r({ ...t, min: j[0], max: j[1] }),
2277
+ formatValue: (j) => `${Math.abs(j)}°`,
2278
+ valueLabel: (j) => s(j) ?? "",
2279
+ positiveNegativeLabels: s(0) ? [s(-1) ?? "", s(1) ?? ""] : void 0,
2280
+ isDisabled: x
2271
2281
  }
2272
2282
  )
2273
2283
  ]
2274
2284
  }
2275
2285
  );
2276
- }, He = (s, t) => "segment" in s && "segment" in t && s.segment === t.segment || "joint" in s && "joint" in t && s.joint === t.joint, yt = ({
2277
- options: s,
2286
+ }, Fe = (n, t) => "segment" in n && "segment" in t && n.segment === t.segment || "joint" in n && "joint" in t && n.joint === t.joint, vt = ({
2287
+ options: n,
2278
2288
  value: t,
2279
2289
  onChange: r,
2280
- forceKind: p,
2281
- singleValue: m,
2282
- singleValueSideless: h,
2283
- editOnly: d,
2284
- disableKind: g,
2285
- maxParameters: n,
2290
+ forceKind: g,
2291
+ singleValue: u,
2292
+ singleValueSideless: m,
2293
+ editOnly: h,
2294
+ disableKind: x,
2295
+ maxParameters: s,
2286
2296
  ...o
2287
2297
  }) => {
2288
- const u = h ? 2 : n, y = $(() => {
2289
- const f = /* @__PURE__ */ new Map();
2290
- return s.forEach((c) => {
2291
- const k = "joint" in c.id;
2292
- let x, N;
2293
- if (k ? (x = Rt(c.id.joint, c.plane, !0) ?? "Unknown", N = `joint:${c.id.joint}`) : (x = Nt(c.id.segment, c.plane, !0) ?? "Unknown", N = `segment:${c.id.segment}`), !f.has(N)) {
2294
- const R = k ? ft(c.id.joint) ?? "Unknown Joint" : ft(c.id.segment) ?? "Unknown Segment";
2295
- f.set(N, {
2296
- label: R,
2298
+ const b = m ? 2 : s, j = N(() => {
2299
+ const p = /* @__PURE__ */ new Map();
2300
+ return n.forEach((c) => {
2301
+ const A = "joint" in c.id;
2302
+ let d, D;
2303
+ if (A ? (d = $t(c.id.joint, c.plane, !0) ?? "Unknown", D = `joint:${c.id.joint}`) : (d = Rt(c.id.segment, c.plane, !0) ?? "Unknown", D = `segment:${c.id.segment}`), !p.has(D)) {
2304
+ const T = A ? yt(c.id.joint) ?? "Unknown Joint" : yt(c.id.segment) ?? "Unknown Segment";
2305
+ p.set(D, {
2306
+ label: T,
2297
2307
  options: []
2298
2308
  });
2299
2309
  }
2300
- const v = f.get(N), E = [
2301
- x,
2302
- k ? c.id.joint : c.id.segment,
2310
+ const v = p.get(D), z = [
2311
+ d,
2312
+ A ? c.id.joint : c.id.segment,
2303
2313
  c.plane
2304
- ].filter(Boolean).map((R) => String(R).toLowerCase().replace(/\s+|_/g, ""));
2314
+ ].filter(Boolean).map((T) => String(T).toLowerCase().replace(/\s+|_/g, ""));
2305
2315
  v.options.push({
2306
2316
  label: /* @__PURE__ */ e.jsxs(
2307
2317
  V,
@@ -2312,7 +2322,7 @@ const Rn = ({
2312
2322
  w: "100%",
2313
2323
  pl: 3,
2314
2324
  children: [
2315
- /* @__PURE__ */ e.jsx(M, { children: x }),
2325
+ /* @__PURE__ */ e.jsx(S, { children: d }),
2316
2326
  c.sensorOnly ? /* @__PURE__ */ e.jsx(Oe, { size: "sm", colorScheme: "orange", variant: "subtle", children: "Sensor" }) : /* @__PURE__ */ e.jsxs(V, { spacing: 1, children: [
2317
2327
  /* @__PURE__ */ e.jsx(Oe, { size: "sm", colorScheme: "blue", variant: "subtle", children: "Pose" }),
2318
2328
  /* @__PURE__ */ e.jsx(Oe, { size: "sm", colorScheme: "orange", variant: "subtle", children: "Sensor" })
@@ -2323,87 +2333,96 @@ const Rn = ({
2323
2333
  value: c.id,
2324
2334
  plane: c.plane,
2325
2335
  sensorOnly: c.sensorOnly,
2326
- searchTokens: E
2336
+ searchTokens: z
2327
2337
  });
2328
- }), Array.from(f.values());
2329
- }, [s]), b = $(() => {
2330
- if (!h || t.length === 0)
2331
- return y;
2332
- const f = t[0];
2333
- return y.map((c) => ({
2338
+ }), Array.from(p.values());
2339
+ }, [n]), L = N(() => {
2340
+ if (!m || t.length === 0)
2341
+ return j;
2342
+ const p = t[0];
2343
+ return j.map((c) => ({
2334
2344
  ...c,
2335
2345
  options: c.options.filter(
2336
- (k) => qe(k.value) === qe(f.id) && k.plane === f.plane
2346
+ (A) => Ke(A.value) === Ke(p.id) && A.plane === p.plane
2337
2347
  )
2338
2348
  })).filter((c) => c.options.length > 0);
2339
- }, [y, t, h]), w = $(() => y.flatMap((c) => c.options).filter(
2340
- (c) => t.some((k) => He(k.id, c.value) && k.plane === c.plane)
2341
- ), [y, t]), I = _((f, c) => {
2349
+ }, [j, t, m]), M = N(() => j.flatMap((c) => c.options).filter(
2350
+ (c) => t.some((A) => Fe(A.id, c.value) && A.plane === c.plane)
2351
+ ), [j, t]), f = E((p, c) => {
2342
2352
  if (!c) return !0;
2343
- const k = c.toLowerCase().replace(/\s+|_/g, ""), x = f.data;
2344
- return !x || !x.searchTokens ? !1 : x.searchTokens.some(
2345
- (N) => N.includes(k)
2353
+ const A = c.toLowerCase().replace(/\s+|_/g, ""), d = p.data;
2354
+ return !d || !d.searchTokens ? !1 : d.searchTokens.some(
2355
+ (D) => D.includes(A)
2346
2356
  );
2347
- }, []), L = _(
2348
- (f) => {
2349
- const c = f.map((k) => {
2350
- const x = t.find(
2351
- (O) => He(O.id, k.value) && O.plane === k.plane
2352
- ), N = s.find(
2353
- (O) => He(O.id, k.value) && O.plane === k.plane
2354
- ), v = h ? t.find(
2355
- (O) => qe(O.id) === qe(k.value) && O.plane === k.plane
2356
- ) : void 0, E = v && !x ? v.min : N && N.min ? N.min : 0, R = v && !x ? v.max : N && N.max ? N.max : 0;
2357
- return x ?? {
2358
- id: k.value,
2359
- plane: k.plane,
2360
- min: E,
2361
- max: R,
2362
- sensorOnly: k.sensorOnly,
2363
- kind: p ?? Xe.Limit
2364
- };
2357
+ }, []), C = E(
2358
+ (p) => {
2359
+ const c = t.filter(
2360
+ (d) => p.some(
2361
+ (D) => Fe(d.id, D.value) && d.plane === D.plane
2362
+ )
2363
+ ), A = p.flatMap((d) => {
2364
+ if (t.find(
2365
+ (G) => Fe(G.id, d.value) && G.plane === d.plane
2366
+ ))
2367
+ return [];
2368
+ const v = n.find(
2369
+ (G) => Fe(G.id, d.value) && G.plane === d.plane
2370
+ ), z = m ? t.find(
2371
+ (G) => Ke(G.id) === Ke(d.value) && G.plane === d.plane
2372
+ ) : void 0, T = z ? z.min : v && v.min ? v.min : 0, F = z ? z.max : v && v.max ? v.max : 0;
2373
+ return [
2374
+ {
2375
+ id: d.value,
2376
+ plane: d.plane,
2377
+ min: T,
2378
+ max: F,
2379
+ sensorOnly: d.sensorOnly,
2380
+ kind: g ?? Xe.Limit
2381
+ }
2382
+ ];
2365
2383
  });
2366
- r(c);
2384
+ r([...c, ...A]);
2367
2385
  },
2368
- [r, t, s, p, h]
2386
+ [r, t, n, g, m]
2369
2387
  );
2370
2388
  return ce(() => {
2371
- const f = t.filter(
2372
- (c) => s.some((k) => He(k.id, c.id) && k.plane === c.plane)
2389
+ const p = t.filter(
2390
+ (c) => n.some((A) => Fe(A.id, c.id) && A.plane === c.plane)
2373
2391
  );
2374
- f.length !== t.length && r(f);
2375
- }, [s, r, t]), /* @__PURE__ */ e.jsxs(se, { ...o, children: [
2392
+ p.length !== t.length && r(p);
2393
+ }, [n, r, t]), /* @__PURE__ */ e.jsxs(se, { ...o, children: [
2376
2394
  /* @__PURE__ */ e.jsx(
2377
2395
  he,
2378
2396
  {
2379
- isMulti: !m,
2397
+ isMulti: !u,
2380
2398
  placeholder: t.length ? `${t.length} selected` : "Search...",
2381
- value: w,
2382
- isDisabled: d || w.length >= (u ?? 1 / 0),
2383
- onChange: (f) => Array.isArray(f) ? L([...f]) : L(f !== null ? [f] : []),
2384
- options: b,
2399
+ value: M,
2400
+ isDisabled: h || t.length >= (b ?? 1 / 0),
2401
+ onChange: (p) => Array.isArray(p) ? C([...p]) : C(p !== null ? [p] : []),
2402
+ options: L,
2385
2403
  controlShouldRenderValue: !1,
2386
- formatOptionLabel: (f) => f.label,
2387
- filterOption: I,
2404
+ formatOptionLabel: (p) => p.label,
2405
+ filterOption: f,
2388
2406
  isSearchable: !0
2389
2407
  }
2390
2408
  ),
2391
2409
  /* @__PURE__ */ e.jsx(
2392
- Zn,
2410
+ ts,
2393
2411
  {
2394
2412
  marginTop: 2,
2395
2413
  maxH: "28rem",
2396
2414
  value: t,
2397
2415
  onChange: r,
2398
- forceKind: p,
2399
- disableKind: g,
2400
- isDisabled: d,
2401
- lockRanges: h
2416
+ forceKind: g,
2417
+ disableKind: x,
2418
+ isDisabled: h,
2419
+ lockRanges: m,
2420
+ canAddCopy: !h && !u && !m && t.length < (b ?? 1 / 0)
2402
2421
  }
2403
2422
  )
2404
2423
  ] });
2405
- }, vt = (s) => {
2406
- switch (s) {
2424
+ }, wt = (n) => {
2425
+ switch (n) {
2407
2426
  case me.Thorax:
2408
2427
  return "Thorax";
2409
2428
  case me.CenterBack:
@@ -2415,9 +2434,9 @@ const Rn = ({
2415
2434
  case me.RightThigh:
2416
2435
  return "Right Thigh";
2417
2436
  case me.LeftShank:
2418
- return "Left Shank";
2437
+ return "Left Lower Leg";
2419
2438
  case me.RightShank:
2420
- return "Right Shank";
2439
+ return "Right Lower Leg";
2421
2440
  case me.LeftFoot:
2422
2441
  return "Left Foot";
2423
2442
  case me.RightFoot:
@@ -2433,41 +2452,41 @@ const Rn = ({
2433
2452
  case me.Head:
2434
2453
  return "Head";
2435
2454
  }
2436
- }, vs = ({
2437
- id: s,
2455
+ }, Ss = ({
2456
+ id: n,
2438
2457
  onError: t,
2439
2458
  onCancel: r,
2440
- onSave: p,
2441
- hideButtons: m,
2442
- setButtonOnClick: h,
2443
- setButtonDisabled: d,
2444
- quantumOwned: g,
2445
- isView: n
2459
+ onSave: g,
2460
+ hideButtons: u,
2461
+ setButtonOnClick: m,
2462
+ setButtonDisabled: h,
2463
+ quantumOwned: x,
2464
+ isView: s
2446
2465
  }) => {
2447
- const o = lt(), [{ fetching: u }, y] = fe(it), [{ fetching: b }, w] = fe(un), [{ data: I }] = Ce({
2448
- query: mn,
2449
- variables: { id: s ?? "" },
2450
- pause: !s
2451
- }), L = $(() => {
2452
- const j = A(
2453
- ve,
2454
- I?.getActionById
2466
+ const o = dt(), [{ fetching: b }, j] = fe(ct), [{ fetching: L }, M] = fe(mn), [{ data: f }] = ve({
2467
+ query: hn,
2468
+ variables: { id: n ?? "" },
2469
+ pause: !n
2470
+ }), C = N(() => {
2471
+ const y = k(
2472
+ Ce,
2473
+ f?.getActionById
2455
2474
  );
2456
- if (!j) return null;
2457
- const P = (A(Fe, j.reports) || []).map((F) => ({
2458
- ...F,
2459
- thresholds: A(Te, F.thresholds)
2475
+ if (!y) return null;
2476
+ const R = (k(Pe, y.reports) || []).map(($) => ({
2477
+ ...$,
2478
+ thresholds: k(Te, $.thresholds)
2460
2479
  }));
2461
2480
  return {
2462
- ...j,
2463
- thresholds: A(Te, j.thresholds),
2464
- reports: P
2481
+ ...y,
2482
+ thresholds: k(Te, y.thresholds),
2483
+ reports: R
2465
2484
  };
2466
- }, [I]), f = u || b, c = !!L && !!s, { getLabel: k } = xe(), x = $(() => ({
2467
- action: k("action")
2468
- }), [k]), N = $(() => [
2485
+ }, [f]), p = b || L, c = !!C && !!n, { getLabel: A } = xe(), d = N(() => ({
2486
+ action: A("action")
2487
+ }), [A]), D = N(() => [
2469
2488
  { key: "module_category", label: "Link Category", multi: !0 },
2470
- { key: "activity_type", label: `${x.action} Type`, multi: !1 },
2489
+ { key: "activity_type", label: `${d.action} Type`, multi: !1 },
2471
2490
  { key: "session_type", label: "Session Type", multi: !0 },
2472
2491
  { key: "body_region", label: "Body Region", multi: !0 },
2473
2492
  { key: "sport", label: "Sport", multi: !0 },
@@ -2476,7 +2495,7 @@ const Rn = ({
2476
2495
  label: "Activity Motion Direction",
2477
2496
  multi: !0
2478
2497
  }
2479
- ], [x.action]), [v, E] = q(""), [R, O] = q(""), [K, oe] = q(""), [D, ae] = q(""), [Z, T] = q([]), [B, J] = q({}), [U, Y] = q(null), [i, a] = q(""), [C, l] = q([]), [S, W] = q([]), [G, Q] = q(""), [H, re] = q([]), we = fn(), Ie = $(() => we.filter((j) => j.sensorOnly), [we]), Se = [
2498
+ ], [d.action]), [v, z] = K(""), [T, F] = K(""), [G, oe] = K(""), [P, ae] = K(""), [Z, O] = K([]), [W, J] = K({}), [U, Y] = K(null), [i, a] = K(""), [w, l] = K([]), [I, Q] = K([]), [_, q] = K(""), [H, re] = K([]), we = bn(), Ie = N(() => we.filter((y) => y.sensorOnly), [we]), Se = [
2480
2499
  {
2481
2500
  label: ke(ie.GeneralActivity),
2482
2501
  value: ie.GeneralActivity
@@ -2494,212 +2513,212 @@ const Rn = ({
2494
2513
  label: ke(ie.PointOfInterest),
2495
2514
  value: ie.PointOfInterest
2496
2515
  }
2497
- ], ze = $(() => v.trim().length > 0, [v]), [Be, tt] = q({});
2516
+ ], Be = N(() => v.trim().length > 0, [v]), [Ue, nt] = K({});
2498
2517
  ce(() => {
2499
- const j = N.map(
2500
- (z) => o.query(at, { key: z.key })
2518
+ const y = D.map(
2519
+ (B) => o.query(lt, { key: B.key })
2501
2520
  );
2502
- Promise.all(j).then((z) => {
2503
- const P = {};
2504
- z.forEach((F) => {
2505
- if (F.error || !F.data) return;
2506
- const ne = A(
2521
+ Promise.all(y).then((B) => {
2522
+ const R = {};
2523
+ B.forEach(($) => {
2524
+ if ($.error || !$.data) return;
2525
+ const ee = k(
2507
2526
  je,
2508
- F.data.getMetadataByKey
2509
- ), ee = A(
2527
+ $.data.getMetadataByKey
2528
+ ), te = k(
2510
2529
  be,
2511
- ne.data
2530
+ ee.data
2512
2531
  );
2513
- P[ne.key] = ee.map((de) => ({
2532
+ R[ee.key] = te.map((de) => ({
2514
2533
  label: de.label || de.value,
2515
2534
  value: de.value,
2516
2535
  id: de.id
2517
2536
  }));
2518
- }), J(P);
2537
+ }), J(R);
2519
2538
  });
2520
- }, [o, N]), ce(() => {
2521
- if (L) {
2522
- const z = A(
2539
+ }, [o, D]), ce(() => {
2540
+ if (C) {
2541
+ const B = k(
2523
2542
  je,
2524
- L.metadataGroups
2543
+ C.metadataGroups
2525
2544
  ).map(
2526
- (ne) => ne.data.map((ee) => A(be, ee).id)
2527
- ), P = L.reports.map((ne) => ({
2528
- id: ne.id,
2529
- name: ne.name ?? "",
2530
- instructions: ne.instructions ?? "",
2531
- kind: ne.reportKind,
2532
- autoGenerate: ne.autoGenerate ?? !1,
2533
- parameters: ne.thresholds.map((ee) => ({
2545
+ (ee) => ee.data.map((te) => k(be, te).id)
2546
+ ), R = C.reports.map((ee) => ({
2547
+ id: ee.id,
2548
+ name: ee.name ?? "",
2549
+ instructions: ee.instructions ?? "",
2550
+ kind: ee.reportKind,
2551
+ autoGenerate: ee.autoGenerate ?? !1,
2552
+ parameters: ee.thresholds.map((te) => ({
2534
2553
  id: {
2535
- [ee.partKind]: ee.partId
2554
+ [te.partKind]: te.partId
2536
2555
  },
2537
- kind: ee.kind,
2538
- min: ee.min,
2539
- max: ee.max,
2540
- plane: ee.partDimension,
2541
- oldId: ee.id,
2556
+ kind: te.kind,
2557
+ min: te.min,
2558
+ max: te.max,
2559
+ plane: te.partDimension,
2560
+ oldId: te.id,
2542
2561
  sensorOnly: Ie.some((de) => {
2543
- const nt = de.id[ee.partKind];
2544
- return nt ? nt === ee.partId && de.plane === ee.partDimension : !1;
2562
+ const st = de.id[te.partKind];
2563
+ return st ? st === te.partId && de.plane === te.partDimension : !1;
2545
2564
  })
2546
2565
  })),
2547
- sensorLocations: ne.sensorLocations
2548
- })), F = {
2549
- name: L.name,
2550
- description: L.description || "",
2551
- cameraPlacement: L.cameraPlacement || "",
2552
- videoLink: L.videoLink || "",
2553
- metadataIds: z.flat(),
2554
- reports: P
2566
+ sensorLocations: ee.sensorLocations
2567
+ })), $ = {
2568
+ name: C.name,
2569
+ description: C.description || "",
2570
+ cameraPlacement: C.cameraPlacement || "",
2571
+ videoLink: C.videoLink || "",
2572
+ metadataIds: B.flat(),
2573
+ reports: R
2555
2574
  };
2556
- E(F.name), O(F.description), oe(F.cameraPlacement), ae(F.videoLink), T(F.metadataIds), re(P), tt(F);
2575
+ z($.name), F($.description), oe($.cameraPlacement), ae($.videoLink), O($.metadataIds), re(R), nt($);
2557
2576
  }
2558
- }, [L]);
2559
- const Re = $(
2560
- () => JSON.stringify(Be) !== JSON.stringify({
2577
+ }, [C]);
2578
+ const Re = N(
2579
+ () => JSON.stringify(Ue) !== JSON.stringify({
2561
2580
  name: v,
2562
- description: R,
2563
- cameraPlacement: K,
2564
- videoLink: D,
2581
+ description: T,
2582
+ cameraPlacement: G,
2583
+ videoLink: P,
2565
2584
  metadataIds: Z,
2566
2585
  reports: H
2567
2586
  }),
2568
2587
  [
2569
- Be,
2588
+ Ue,
2570
2589
  v,
2571
- R,
2572
- K,
2573
- D,
2590
+ T,
2591
+ G,
2592
+ P,
2574
2593
  Z,
2575
2594
  H
2576
2595
  ]
2577
- ), Le = _(() => {
2578
- const j = {
2596
+ ), Le = E(() => {
2597
+ const y = {
2579
2598
  name: v,
2580
- description: R,
2581
- cameraPlacement: K,
2582
- videoLink: D,
2599
+ description: T,
2600
+ cameraPlacement: G,
2601
+ videoLink: P,
2583
2602
  metadataItemIds: Z,
2584
2603
  // Backend requires laterality; keep existing default since UI no longer edits it
2585
- laterality: Nn.Either,
2586
- quantumOwned: g,
2604
+ laterality: Dn.Either,
2605
+ quantumOwned: x,
2587
2606
  //Backend requires session type; keep existing default since UI no longer edits it
2588
2607
  sessionType: [],
2589
2608
  // Backend requires thresholds; use empty array since reports handle parameters now
2590
2609
  thresholds: [],
2591
2610
  // Include reports data
2592
- reports: H.map((P) => ({
2593
- id: P.isNew ? void 0 : P.id,
2594
- name: P.name,
2595
- reportKind: P.kind,
2596
- sensorLocations: P.sensorLocations,
2597
- instructions: P.instructions,
2598
- autoGenerate: P.autoGenerate ?? !1,
2599
- thresholds: P.parameters.map((F) => ({
2600
- id: F.oldId,
2601
- kind: F.kind,
2602
- min: F.min,
2603
- max: F.max,
2604
- partKind: "joint" in F.id ? "joint" : "segment",
2605
- partId: "joint" in F.id ? F.id.joint : F.id.segment,
2606
- partDimension: F.plane
2611
+ reports: H.map((R) => ({
2612
+ id: R.isNew ? void 0 : R.id,
2613
+ name: R.name,
2614
+ reportKind: R.kind,
2615
+ sensorLocations: R.sensorLocations,
2616
+ instructions: R.instructions,
2617
+ autoGenerate: R.autoGenerate ?? !1,
2618
+ thresholds: R.parameters.map(($) => ({
2619
+ id: $.oldId,
2620
+ kind: $.kind,
2621
+ min: $.min,
2622
+ max: $.max,
2623
+ partKind: "joint" in $.id ? "joint" : "segment",
2624
+ partId: "joint" in $.id ? $.id.joint : $.id.segment,
2625
+ partDimension: $.plane
2607
2626
  }))
2608
2627
  }))
2609
2628
  };
2610
- let z;
2611
- c && s ? z = w({
2612
- id: s,
2613
- fields: j
2614
- }) : z = y({
2615
- fields: j
2616
- }), z.then(({ error: P }) => {
2617
- P ? t(P) : p();
2629
+ let B;
2630
+ c && n ? B = M({
2631
+ id: n,
2632
+ fields: y
2633
+ }) : B = j({
2634
+ fields: y
2635
+ }), B.then(({ error: R }) => {
2636
+ R ? t(R) : g();
2618
2637
  });
2619
2638
  }, [
2620
- g,
2621
- y,
2622
- w,
2623
- s,
2639
+ x,
2640
+ j,
2641
+ M,
2642
+ n,
2624
2643
  v,
2625
- R,
2626
- K,
2627
- D,
2644
+ T,
2645
+ G,
2646
+ P,
2628
2647
  Z,
2629
2648
  H,
2630
2649
  c,
2631
- p,
2650
+ g,
2632
2651
  t
2633
2652
  ]);
2634
2653
  ce(() => {
2635
- d && d({
2636
- cancelButton: f,
2637
- saveButton: n ? !0 : f || !ze || !Re
2638
- });
2639
- }, [f, d, ze, Re, n]), ce(() => {
2640
2654
  h && h({
2655
+ cancelButton: p,
2656
+ saveButton: s ? !0 : p || !Be || !Re
2657
+ });
2658
+ }, [p, h, Be, Re, s]), ce(() => {
2659
+ m && m({
2641
2660
  cancelButton: r,
2642
- saveButton: n ? () => {
2661
+ saveButton: s ? () => {
2643
2662
  } : Le
2644
2663
  });
2645
- }, [h, r, Le, n]);
2646
- const pe = _(
2647
- (j) => {
2648
- const z = jt(
2649
- j.map(
2650
- (P) => "joint" in P.id ? P.id.joint : P.id.segment
2664
+ }, [m, r, Le, s]);
2665
+ const pe = E(
2666
+ (y) => {
2667
+ const B = Ct(
2668
+ y.map(
2669
+ (R) => "joint" in R.id ? R.id.joint : R.id.segment
2651
2670
  )
2652
2671
  );
2653
- W(z);
2672
+ Q(B);
2654
2673
  },
2655
2674
  []
2656
2675
  );
2657
2676
  ce(() => {
2658
- pe(C);
2659
- }, [C, pe]);
2660
- const $e = _(() => {
2677
+ pe(w);
2678
+ }, [w, pe]);
2679
+ const $e = E(() => {
2661
2680
  if (!U || !i.trim())
2662
2681
  return;
2663
- const j = U === ie.PointOfInterest, z = {
2682
+ const y = U === ie.PointOfInterest, B = {
2664
2683
  id: Date.now().toString(),
2665
2684
  // Temporary ID
2666
2685
  name: i.trim(),
2667
2686
  kind: U,
2668
- parameters: j ? [] : C,
2669
- sensorLocations: j ? [] : S,
2670
- instructions: j ? G : "",
2687
+ parameters: y ? [] : w,
2688
+ sensorLocations: y ? [] : I,
2689
+ instructions: y ? _ : "",
2671
2690
  autoGenerate: !1,
2672
2691
  isNew: !0
2673
2692
  };
2674
- re((P) => [...P, z]), Y(null), a(""), l([]), W([]), Q("");
2693
+ re((R) => [...R, B]), Y(null), a(""), l([]), Q([]), q("");
2675
2694
  }, [
2676
2695
  U,
2677
2696
  i,
2678
- C,
2679
- S,
2680
- G
2681
- ]), Dt = _((j) => {
2682
- re((z) => z.filter((P) => P.id !== j));
2683
- }, []), Gt = (j, z) => {
2684
- const P = N.find((ne) => ne.key === j);
2685
- if (!P) return;
2686
- const F = P.multi ? (z ?? []).map(
2687
- (ne) => ne.id
2688
- ) : z ? [z.id] : [];
2689
- T((ne) => [...ne.filter((de) => Object.values(B).flat().find((Ue) => Ue.id === de) && !Object.keys(B).find(
2690
- (Ue) => B[Ue]?.some(
2691
- (Ft) => Ft.id === de && Ue === j
2697
+ w,
2698
+ I,
2699
+ _
2700
+ ]), Ft = E((y) => {
2701
+ re((B) => B.filter((R) => R.id !== y));
2702
+ }, []), Gt = (y, B) => {
2703
+ const R = D.find((ee) => ee.key === y);
2704
+ if (!R) return;
2705
+ const $ = R.multi ? (B ?? []).map(
2706
+ (ee) => ee.id
2707
+ ) : B ? [B.id] : [];
2708
+ O((ee) => [...ee.filter((de) => Object.values(W).flat().find((We) => We.id === de) && !Object.keys(W).find(
2709
+ (We) => W[We]?.some(
2710
+ (Pt) => Pt.id === de && We === y
2692
2711
  )
2693
- )), ...F]);
2712
+ )), ...$]);
2694
2713
  };
2695
2714
  return /* @__PURE__ */ e.jsxs(ue, { spacing: 4, w: "full", align: "stretch", children: [
2696
- /* @__PURE__ */ e.jsxs(tn, { children: [
2697
- /* @__PURE__ */ e.jsxs(nn, { children: [
2698
- /* @__PURE__ */ e.jsx(gt, { children: "Activity Configuration" }),
2699
- /* @__PURE__ */ e.jsx(gt, { children: "Reports Configuration" })
2700
- ] }),
2715
+ /* @__PURE__ */ e.jsxs(nn, { children: [
2701
2716
  /* @__PURE__ */ e.jsxs(sn, { children: [
2702
- /* @__PURE__ */ e.jsx(xt, { px: 0, children: /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-6", children: [
2717
+ /* @__PURE__ */ e.jsx(ft, { children: "Activity Configuration" }),
2718
+ /* @__PURE__ */ e.jsx(ft, { children: "Reports Configuration" })
2719
+ ] }),
2720
+ /* @__PURE__ */ e.jsxs(on, { children: [
2721
+ /* @__PURE__ */ e.jsx(jt, { px: 0, children: /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-6", children: [
2703
2722
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
2704
2723
  /* @__PURE__ */ e.jsxs(X, { children: [
2705
2724
  /* @__PURE__ */ e.jsx(le, { children: "Name" }),
@@ -2707,23 +2726,23 @@ const Rn = ({
2707
2726
  ye,
2708
2727
  {
2709
2728
  value: v,
2710
- onChange: (j) => E(j.target.value),
2729
+ onChange: (y) => z(y.target.value),
2711
2730
  type: "text",
2712
2731
  placeholder: "i.e. Lunge & Return",
2713
- isDisabled: n
2732
+ isDisabled: s
2714
2733
  }
2715
2734
  )
2716
2735
  ] }),
2717
2736
  /* @__PURE__ */ e.jsxs(X, { children: [
2718
2737
  /* @__PURE__ */ e.jsx(le, { children: "Camera Placement" }),
2719
2738
  /* @__PURE__ */ e.jsx(
2720
- Qe,
2739
+ qe,
2721
2740
  {
2722
- value: K,
2723
- onChange: (j) => oe(j.target.value),
2741
+ value: G,
2742
+ onChange: (y) => oe(y.target.value),
2724
2743
  rows: 2,
2725
2744
  placeholder: "(optional) Describe camera setup, placement, angles",
2726
- isDisabled: n
2745
+ isDisabled: s
2727
2746
  }
2728
2747
  )
2729
2748
  ] }),
@@ -2732,60 +2751,60 @@ const Rn = ({
2732
2751
  /* @__PURE__ */ e.jsx(
2733
2752
  ye,
2734
2753
  {
2735
- value: D,
2736
- onChange: (j) => ae(j.target.value),
2754
+ value: P,
2755
+ onChange: (y) => ae(y.target.value),
2737
2756
  type: "url",
2738
2757
  placeholder: "(optional) https://...",
2739
- isDisabled: n
2758
+ isDisabled: s
2740
2759
  }
2741
2760
  )
2742
2761
  ] }),
2743
2762
  /* @__PURE__ */ e.jsxs(X, { children: [
2744
2763
  /* @__PURE__ */ e.jsx(le, { children: "Description" }),
2745
2764
  /* @__PURE__ */ e.jsx(
2746
- Qe,
2765
+ qe,
2747
2766
  {
2748
- value: R,
2749
- onChange: (j) => O(j.target.value),
2767
+ value: T,
2768
+ onChange: (y) => F(y.target.value),
2750
2769
  rows: 2,
2751
2770
  placeholder: "(optional) Describe how to perform the test or exercise",
2752
- isDisabled: n
2771
+ isDisabled: s
2753
2772
  }
2754
2773
  )
2755
2774
  ] })
2756
2775
  ] }),
2757
2776
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
2758
2777
  /* @__PURE__ */ e.jsx(le, { children: "Metadata Tags" }),
2759
- N.map((j) => /* @__PURE__ */ e.jsxs(X, { children: [
2760
- /* @__PURE__ */ e.jsx(le, { children: j.label }),
2778
+ D.map((y) => /* @__PURE__ */ e.jsxs(X, { children: [
2779
+ /* @__PURE__ */ e.jsx(le, { children: y.label }),
2761
2780
  /* @__PURE__ */ e.jsx(
2762
2781
  he,
2763
2782
  {
2764
- isMulti: j.multi,
2765
- value: B[j.key]?.filter(
2766
- (z) => Z.includes(z.id)
2783
+ isMulti: y.multi,
2784
+ value: W[y.key]?.filter(
2785
+ (B) => Z.includes(B.id)
2767
2786
  ),
2768
- onChange: (z) => {
2769
- Gt(j.key, z);
2787
+ onChange: (B) => {
2788
+ Gt(y.key, B);
2770
2789
  },
2771
- options: B[j.key],
2772
- placeholder: `Select ${j.multi ? "one or more" : "one"} ${j.label.toLowerCase()}`,
2773
- isDisabled: n,
2774
- isClearable: j.multi
2790
+ options: W[y.key],
2791
+ placeholder: `Select ${y.multi ? "one or more" : "one"} ${y.label.toLowerCase()}`,
2792
+ isDisabled: s,
2793
+ isClearable: y.multi
2775
2794
  }
2776
2795
  )
2777
- ] }, j.key))
2796
+ ] }, y.key))
2778
2797
  ] })
2779
2798
  ] }) }),
2780
- /* @__PURE__ */ e.jsx(xt, { px: 0, children: /* @__PURE__ */ e.jsxs(
2799
+ /* @__PURE__ */ e.jsx(jt, { px: 0, children: /* @__PURE__ */ e.jsxs(
2781
2800
  "div",
2782
2801
  {
2783
2802
  className: Je(
2784
2803
  "grid grid-cols-1 gap-6",
2785
- !n && "md:grid-cols-2"
2804
+ !s && "md:grid-cols-2"
2786
2805
  ),
2787
2806
  children: [
2788
- /* @__PURE__ */ e.jsxs("div", { className: Je("space-y-4", n && "hidden"), children: [
2807
+ /* @__PURE__ */ e.jsxs("div", { className: Je("space-y-4", s && "hidden"), children: [
2789
2808
  /* @__PURE__ */ e.jsx(le, { children: "Add New Report" }),
2790
2809
  /* @__PURE__ */ e.jsxs(X, { children: [
2791
2810
  /* @__PURE__ */ e.jsx(le, { children: "Report Name" }),
@@ -2793,11 +2812,11 @@ const Rn = ({
2793
2812
  ye,
2794
2813
  {
2795
2814
  value: i,
2796
- onChange: (j) => a(j.target.value),
2815
+ onChange: (y) => a(y.target.value),
2797
2816
  maxLength: 120,
2798
2817
  type: "text",
2799
2818
  placeholder: "Enter report name...",
2800
- isDisabled: n
2819
+ isDisabled: s
2801
2820
  }
2802
2821
  )
2803
2822
  ] }),
@@ -2807,12 +2826,19 @@ const Rn = ({
2807
2826
  he,
2808
2827
  {
2809
2828
  value: U ? Se.find(
2810
- (j) => j.value === U
2829
+ (y) => y.value === U
2811
2830
  ) : null,
2812
- onChange: (j) => Y(j?.value || null),
2831
+ onChange: (y) => {
2832
+ const B = y?.value || null;
2833
+ Y(B);
2834
+ const R = rt(B);
2835
+ R && l(
2836
+ ($) => $.map((ee) => ({ ...ee, kind: R }))
2837
+ );
2838
+ },
2813
2839
  options: Se,
2814
2840
  placeholder: "Select report type...",
2815
- isDisabled: n,
2841
+ isDisabled: s,
2816
2842
  isClearable: !0
2817
2843
  }
2818
2844
  )
@@ -2821,12 +2847,13 @@ const Rn = ({
2821
2847
  /* @__PURE__ */ e.jsxs(X, { children: [
2822
2848
  /* @__PURE__ */ e.jsx(le, { children: "Default Parameters" }),
2823
2849
  /* @__PURE__ */ e.jsx(
2824
- yt,
2850
+ vt,
2825
2851
  {
2826
2852
  options: we,
2827
- value: C,
2853
+ value: w,
2828
2854
  onChange: l,
2829
- editOnly: n
2855
+ forceKind: rt(U),
2856
+ editOnly: s
2830
2857
  }
2831
2858
  )
2832
2859
  ] }),
@@ -2835,8 +2862,8 @@ const Rn = ({
2835
2862
  /* @__PURE__ */ e.jsx(
2836
2863
  ye,
2837
2864
  {
2838
- value: S.map(
2839
- (j) => vt(j)
2865
+ value: I.map(
2866
+ (y) => wt(y)
2840
2867
  ).join(", "),
2841
2868
  placeholder: "Auto-filled based on parameters...",
2842
2869
  isDisabled: !0
@@ -2847,42 +2874,42 @@ const Rn = ({
2847
2874
  U === ie.PointOfInterest && /* @__PURE__ */ e.jsxs(X, { children: [
2848
2875
  /* @__PURE__ */ e.jsx(le, { children: "Instructions" }),
2849
2876
  /* @__PURE__ */ e.jsx(
2850
- Qe,
2877
+ qe,
2851
2878
  {
2852
- value: G,
2853
- onChange: (j) => Q(j.target.value),
2879
+ value: _,
2880
+ onChange: (y) => q(y.target.value),
2854
2881
  rows: 3,
2855
2882
  placeholder: "Enter specific instructions for this report...",
2856
- isDisabled: n
2883
+ isDisabled: s
2857
2884
  }
2858
2885
  )
2859
2886
  ] }),
2860
2887
  /* @__PURE__ */ e.jsx("div", { className: "w-full flex justify-end", children: /* @__PURE__ */ e.jsx(
2861
- te,
2888
+ ne,
2862
2889
  {
2863
2890
  colorScheme: "blue",
2864
2891
  onClick: $e,
2865
- isDisabled: !U || !i.trim() || n || Se.length === 0 || U !== ie.PointOfInterest && C.length === 0,
2892
+ isDisabled: !U || !i.trim() || s || Se.length === 0 || U !== ie.PointOfInterest && w.length === 0,
2866
2893
  children: "Add Report"
2867
2894
  }
2868
2895
  ) })
2869
2896
  ] }),
2870
2897
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
2871
2898
  /* @__PURE__ */ e.jsx(le, { children: "Configured Reports" }),
2872
- H.length === 0 ? /* @__PURE__ */ e.jsx(M, { fontSize: "sm", color: "gray.500", children: "No reports created yet" }) : /* @__PURE__ */ e.jsx("div", { className: "space-y-3", children: H.map((j) => /* @__PURE__ */ e.jsxs(
2899
+ H.length === 0 ? /* @__PURE__ */ e.jsx(S, { fontSize: "sm", color: "gray.500", children: "No reports created yet" }) : /* @__PURE__ */ e.jsx("div", { className: "space-y-3", children: H.map((y) => /* @__PURE__ */ e.jsxs(
2873
2900
  "div",
2874
2901
  {
2875
2902
  className: "p-3 border border-gray-200 rounded-md bg-gray-50 flex flex-col gap-2",
2876
2903
  children: [
2877
2904
  /* @__PURE__ */ e.jsxs("div", { className: "flex justify-between items-start", children: [
2878
- /* @__PURE__ */ e.jsx(M, { fontSize: "sm", color: "gray.600", children: ke(j.kind) }),
2879
- !n && /* @__PURE__ */ e.jsx(
2880
- te,
2905
+ /* @__PURE__ */ e.jsx(S, { fontSize: "sm", color: "gray.600", children: ke(y.kind) }),
2906
+ !s && /* @__PURE__ */ e.jsx(
2907
+ ne,
2881
2908
  {
2882
2909
  size: "xs",
2883
2910
  colorScheme: "red",
2884
2911
  variant: "ghost",
2885
- onClick: () => Dt(j.id),
2912
+ onClick: () => Ft(y.id),
2886
2913
  children: "Remove"
2887
2914
  }
2888
2915
  )
@@ -2892,86 +2919,89 @@ const Rn = ({
2892
2919
  /* @__PURE__ */ e.jsx(
2893
2920
  ye,
2894
2921
  {
2895
- value: j.name,
2896
- onChange: (z) => re(
2897
- (P) => P.map(
2898
- (F) => F.id === j.id ? { ...F, name: z.target.value } : F
2922
+ value: y.name,
2923
+ onChange: (B) => re(
2924
+ (R) => R.map(
2925
+ ($) => $.id === y.id ? { ...$, name: B.target.value } : $
2899
2926
  )
2900
2927
  ),
2901
2928
  placeholder: "Enter report name...",
2902
- isDisabled: n
2929
+ isDisabled: s
2903
2930
  }
2904
2931
  )
2905
2932
  ] }),
2906
2933
  /* @__PURE__ */ e.jsxs(X, { display: "flex", alignItems: "center", children: [
2907
2934
  /* @__PURE__ */ e.jsx(
2908
- _e,
2935
+ ze,
2909
2936
  {
2910
- htmlFor: `auto-generate-${j.id}`,
2937
+ htmlFor: `auto-generate-${y.id}`,
2911
2938
  mb: "0",
2912
2939
  children: "Auto Generate"
2913
2940
  }
2914
2941
  ),
2915
2942
  /* @__PURE__ */ e.jsx(
2916
- on,
2943
+ rn,
2917
2944
  {
2918
- id: `auto-generate-${j.id}`,
2919
- isChecked: j.autoGenerate ?? !1,
2920
- onChange: (z) => re(
2921
- (P) => P.map(
2922
- (F) => F.id === j.id ? { ...F, autoGenerate: z.target.checked } : F
2945
+ id: `auto-generate-${y.id}`,
2946
+ isChecked: y.autoGenerate ?? !1,
2947
+ onChange: (B) => re(
2948
+ (R) => R.map(
2949
+ ($) => $.id === y.id ? { ...$, autoGenerate: B.target.checked } : $
2923
2950
  )
2924
2951
  ),
2925
- isDisabled: n
2952
+ isDisabled: s
2926
2953
  }
2927
2954
  )
2928
2955
  ] }),
2929
- j.kind === ie.PointOfInterest && /* @__PURE__ */ e.jsxs(X, { children: [
2956
+ y.kind === ie.PointOfInterest && /* @__PURE__ */ e.jsxs(X, { children: [
2930
2957
  /* @__PURE__ */ e.jsx(le, { children: "Instructions" }),
2931
2958
  /* @__PURE__ */ e.jsx(
2932
- Qe,
2959
+ qe,
2933
2960
  {
2934
- value: j.instructions,
2935
- onChange: (z) => re(
2936
- (P) => P.map(
2937
- (F) => F.id === j.id ? { ...F, instructions: z.target.value } : F
2961
+ value: y.instructions,
2962
+ onChange: (B) => re(
2963
+ (R) => R.map(
2964
+ ($) => $.id === y.id ? { ...$, instructions: B.target.value } : $
2938
2965
  )
2939
2966
  ),
2940
2967
  rows: 3,
2941
2968
  placeholder: "Enter specific instructions for this report...",
2942
- isDisabled: n
2969
+ isDisabled: s
2943
2970
  }
2944
2971
  )
2945
2972
  ] }),
2946
- j.kind !== ie.PointOfInterest && /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col", children: [
2973
+ y.kind !== ie.PointOfInterest && /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col", children: [
2947
2974
  /* @__PURE__ */ e.jsx(le, { children: "Default Parameters" }),
2948
2975
  /* @__PURE__ */ e.jsx(
2949
- yt,
2976
+ vt,
2950
2977
  {
2951
2978
  options: we,
2952
- value: j.parameters,
2953
- onChange: (z) => {
2954
- const P = (ee) => "joint" in ee.id ? ee.id.joint : ee.id.segment, F = z.map(P), ne = jt(F);
2979
+ forceKind: rt(
2980
+ y.kind
2981
+ ),
2982
+ value: y.parameters,
2983
+ onChange: (B) => {
2984
+ const R = (te) => "joint" in te.id ? te.id.joint : te.id.segment, $ = B.map(R), ee = Ct($);
2955
2985
  re(
2956
- (ee) => ee.map(
2957
- (de) => de.id === j.id ? { ...de, parameters: z, sensorLocations: ne } : de
2986
+ (te) => te.map(
2987
+ (de) => de.id === y.id ? { ...de, parameters: B, sensorLocations: ee } : de
2958
2988
  )
2959
2989
  );
2960
2990
  },
2961
- editOnly: n
2991
+ editOnly: s
2962
2992
  }
2963
2993
  )
2964
2994
  ] }),
2965
- j.kind !== ie.PointOfInterest && /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", color: "gray.600", children: [
2995
+ y.kind !== ie.PointOfInterest && /* @__PURE__ */ e.jsxs(S, { fontSize: "sm", color: "gray.600", children: [
2966
2996
  "Sensors:",
2967
2997
  " ",
2968
- j.sensorLocations.map(
2969
- (z) => vt(z)
2998
+ y.sensorLocations.map(
2999
+ (B) => wt(B)
2970
3000
  ).join(", ")
2971
3001
  ] })
2972
3002
  ]
2973
3003
  },
2974
- j.id
3004
+ y.id
2975
3005
  )) })
2976
3006
  ] })
2977
3007
  ]
@@ -2983,15 +3013,15 @@ const Rn = ({
2983
3013
  V,
2984
3014
  {
2985
3015
  justify: "end",
2986
- className: Je((m || n) && "!hidden"),
3016
+ className: Je((u || s) && "!hidden"),
2987
3017
  children: /* @__PURE__ */ e.jsxs(Ne, { gap: 4, children: [
2988
- /* @__PURE__ */ e.jsx(te, { colorScheme: "gray", isDisabled: f, onClick: r, children: "Cancel" }),
3018
+ /* @__PURE__ */ e.jsx(ne, { colorScheme: "gray", isDisabled: p, onClick: r, children: "Cancel" }),
2989
3019
  /* @__PURE__ */ e.jsx(
2990
- te,
3020
+ ne,
2991
3021
  {
2992
3022
  colorScheme: "blue",
2993
- isDisabled: f || !ze || !Re,
2994
- isLoading: f,
3023
+ isDisabled: p || !Be || !Re,
3024
+ isLoading: p,
2995
3025
  onClick: Le,
2996
3026
  children: "Save changes"
2997
3027
  }
@@ -3000,168 +3030,168 @@ const Rn = ({
3000
3030
  }
3001
3031
  )
3002
3032
  ] });
3003
- }, le = ({ children: s }) => /* @__PURE__ */ e.jsx(_e, { fontWeight: "bold", fontFamily: "sans-serif", fontSize: "large", children: s }), es = ({
3004
- children: s,
3033
+ }, le = ({ children: n }) => /* @__PURE__ */ e.jsx(ze, { fontWeight: "bold", fontFamily: "sans-serif", fontSize: "large", children: n }), ss = ({
3034
+ children: n,
3005
3035
  isView: t,
3006
3036
  metadataKeys: r
3007
3037
  }) => {
3008
- const [p, m] = q({}), h = lt();
3038
+ const [g, u] = K({}), m = dt();
3009
3039
  return ce(() => {
3010
- let d = !1;
3040
+ let h = !1;
3011
3041
  return (async () => {
3012
- const n = (r ?? []).map(
3013
- (y) => h.query(at, { key: y }).toPromise()
3014
- ), o = await Promise.all(n), u = {};
3015
- for (const y of o) {
3016
- if (y.error || !y.data?.getMetadataByKey) continue;
3017
- const b = A(
3042
+ const s = (r ?? []).map(
3043
+ (j) => m.query(lt, { key: j }).toPromise()
3044
+ ), o = await Promise.all(s), b = {};
3045
+ for (const j of o) {
3046
+ if (j.error || !j.data?.getMetadataByKey) continue;
3047
+ const L = k(
3018
3048
  je,
3019
- y.data.getMetadataByKey
3049
+ j.data.getMetadataByKey
3020
3050
  );
3021
- if (!b) continue;
3022
- const w = A(be, b.data) ?? [];
3023
- u[b.key] = w.map((I) => ({
3024
- label: I.label || I.value,
3025
- value: I.value,
3026
- id: I.id
3051
+ if (!L) continue;
3052
+ const M = k(be, L.data) ?? [];
3053
+ b[L.key] = M.map((f) => ({
3054
+ label: f.label || f.value,
3055
+ value: f.value,
3056
+ id: f.id
3027
3057
  }));
3028
3058
  }
3029
- d || m(u);
3059
+ h || u(b);
3030
3060
  })(), () => {
3031
- d = !0;
3061
+ h = !0;
3032
3062
  };
3033
- }, [h, r]), /* @__PURE__ */ e.jsx($t.Provider, { value: { isView: t, metadataOptions: p }, children: s });
3034
- }, Cs = ({
3035
- id: s,
3063
+ }, [m, r]), /* @__PURE__ */ e.jsx(Dt.Provider, { value: { isView: t, metadataOptions: g }, children: n });
3064
+ }, Ls = ({
3065
+ id: n,
3036
3066
  onCancel: t,
3037
3067
  onSave: r,
3038
- onError: p,
3039
- hideButtons: m,
3040
- quantumOwned: h,
3041
- setButtonOnClick: d,
3042
- setButtonDisabled: g,
3043
- isView: n
3068
+ onError: g,
3069
+ hideButtons: u,
3070
+ quantumOwned: m,
3071
+ setButtonOnClick: h,
3072
+ setButtonDisabled: x,
3073
+ isView: s
3044
3074
  }) => {
3045
- const [{ data: o, fetching: u }] = Ce({
3046
- query: h ? hn : pn
3047
- }), [{ data: y }] = Ce({
3048
- query: gn,
3049
- variables: { id: s },
3050
- pause: !s
3051
- }), [{ data: b }] = Ce({
3052
- query: xn
3053
- }), w = A(
3054
- Pe,
3055
- b?.moduleCategories
3056
- ), [{ fetching: I }, L] = fe(Ot), [{ fetching: f }, c] = fe(At), k = $(() => !o || u ? [] : A(
3057
- ve,
3058
- h ? o?.quantumOwnedActions ?? [] : o?.actions ?? []
3059
- ).filter((U) => !!U?.id), [o, h, u]), x = A(Ye, y?.module), N = $(() => A(Tt, x?.moduleActions) ?? [], [x?.moduleActions]), [v, E] = q([]), [R, O] = q(x?.name ?? ""), [K, oe] = q([]), [D, ae] = q(x?.description ?? ""), [Z, T] = q([]);
3075
+ const [{ data: o, fetching: b }] = ve({
3076
+ query: m ? pn : gn
3077
+ }), [{ data: j }] = ve({
3078
+ query: xn,
3079
+ variables: { id: n },
3080
+ pause: !n
3081
+ }), [{ data: L }] = ve({
3082
+ query: fn
3083
+ }), M = k(
3084
+ _e,
3085
+ L?.moduleCategories
3086
+ ), [{ fetching: f }, C] = fe(Tt), [{ fetching: p }, c] = fe(Ot), A = N(() => !o || b ? [] : k(
3087
+ Ce,
3088
+ m ? o?.quantumOwnedActions ?? [] : o?.actions ?? []
3089
+ ).filter((U) => !!U?.id), [o, m, b]), d = k(Ye, j?.module), D = N(() => k(Nt, d?.moduleActions) ?? [], [d?.moduleActions]), [v, z] = K([]), [T, F] = K(d?.name ?? ""), [G, oe] = K([]), [P, ae] = K(d?.description ?? ""), [Z, O] = K([]);
3060
3090
  ce(() => {
3061
- if (x) {
3062
- const J = N.map((i, a) => ({
3091
+ if (d) {
3092
+ const J = D.map((i, a) => ({
3063
3093
  key: i.id ?? `${i.actionId}-${a}`,
3064
3094
  actionId: i.actionId,
3065
3095
  reportId: i.reportId || null
3066
3096
  }));
3067
- E(J), O(x.name), ae(x.description ?? ""), oe(
3068
- x.categories.map(
3069
- (i) => A(Pe, i).id
3097
+ z(J), F(d.name), ae(d.description ?? ""), oe(
3098
+ d.categories.map(
3099
+ (i) => k(_e, i).id
3070
3100
  ) ?? []
3071
3101
  );
3072
- const Y = A(
3102
+ const Y = k(
3073
3103
  je,
3074
- x.metadataGroups
3104
+ d.metadataGroups
3075
3105
  ).map(
3076
- (i) => i.data.map((a) => A(be, a).id)
3106
+ (i) => i.data.map((a) => k(be, a).id)
3077
3107
  );
3078
- T(Y.flat());
3108
+ O(Y.flat());
3079
3109
  }
3080
- }, [x, N]);
3081
- const B = _(() => {
3110
+ }, [d, D]);
3111
+ const W = E(() => {
3082
3112
  let J;
3083
3113
  const U = {
3084
3114
  moduleActions: v.map((Y) => ({
3085
3115
  actionId: Y.actionId,
3086
3116
  reportId: Y.reportId ?? void 0
3087
3117
  })),
3088
- name: R,
3089
- categories: K,
3090
- description: D,
3091
- quantumOwned: h,
3118
+ name: T,
3119
+ categories: G,
3120
+ description: P,
3121
+ quantumOwned: m,
3092
3122
  metadataItemIds: Z
3093
3123
  };
3094
- x ? J = L({
3095
- id: x.id,
3124
+ d ? J = C({
3125
+ id: d.id,
3096
3126
  input: U
3097
3127
  }) : J = c({
3098
3128
  input: U
3099
3129
  }), J.then(({ error: Y }) => {
3100
- Y ? p(Y instanceof Error ? Y : new Error(String(Y))) : r();
3130
+ Y ? g(Y instanceof Error ? Y : new Error(String(Y))) : r();
3101
3131
  });
3102
3132
  }, [
3103
3133
  c,
3104
- L,
3134
+ C,
3105
3135
  v,
3106
- R,
3107
- D,
3108
- K,
3136
+ T,
3137
+ P,
3138
+ G,
3109
3139
  Z,
3110
- x,
3140
+ d,
3111
3141
  r,
3112
- p,
3113
- h
3142
+ g,
3143
+ m
3114
3144
  ]);
3115
3145
  return ce(() => {
3116
- g && g({
3117
- cancelButton: I || f,
3118
- saveButton: I || f || !R || D.trim().split(/\s+/).filter(Boolean).length > 40
3146
+ x && x({
3147
+ cancelButton: f || p,
3148
+ saveButton: f || p || !T || P.trim().split(/\s+/).filter(Boolean).length > 40
3119
3149
  });
3120
- }, [g, I, f, v, R, D]), ce(() => {
3121
- d && d({
3150
+ }, [x, f, p, v, T, P]), ce(() => {
3151
+ h && h({
3122
3152
  cancelButton: t,
3123
- saveButton: B
3153
+ saveButton: W
3124
3154
  });
3125
- }, [d, t, B]), /* @__PURE__ */ e.jsx(se, { width: "100%", children: /* @__PURE__ */ e.jsxs(
3126
- es,
3155
+ }, [h, t, W]), /* @__PURE__ */ e.jsx(se, { width: "100%", children: /* @__PURE__ */ e.jsxs(
3156
+ ss,
3127
3157
  {
3128
- isView: n,
3158
+ isView: s,
3129
3159
  metadataKeys: ["activity_type", "session_type", "body_region", "sport"],
3130
3160
  children: [
3131
3161
  /* @__PURE__ */ e.jsx(
3132
- Wn,
3162
+ Kn,
3133
3163
  {
3134
- name: R,
3135
- setName: O,
3136
- actions: k,
3164
+ name: T,
3165
+ setName: F,
3166
+ actions: A,
3137
3167
  moduleActionEntries: v,
3138
- setModuleActionEntries: E,
3139
- availableCategories: w ?? [],
3140
- selectedCategoryIds: K,
3168
+ setModuleActionEntries: z,
3169
+ availableCategories: M ?? [],
3170
+ selectedCategoryIds: G,
3141
3171
  setSelectedCategoryIds: oe,
3142
- description: D,
3172
+ description: P,
3143
3173
  setDescription: ae,
3144
3174
  selectedMetadataIds: Z,
3145
- setSelectedMetadataIds: T
3175
+ setSelectedMetadataIds: O
3146
3176
  }
3147
3177
  ),
3148
- !m && !n && /* @__PURE__ */ e.jsx(V, { justifyContent: "flex-start", children: /* @__PURE__ */ e.jsxs(Ne, { mt: 16, gap: 4, children: [
3178
+ !u && !s && /* @__PURE__ */ e.jsx(V, { justifyContent: "flex-start", children: /* @__PURE__ */ e.jsxs(Ne, { mt: 16, gap: 4, children: [
3149
3179
  /* @__PURE__ */ e.jsx(
3150
- te,
3180
+ ne,
3151
3181
  {
3152
3182
  colorScheme: "gray",
3153
- isDisabled: I || f,
3183
+ isDisabled: f || p,
3154
3184
  onClick: t,
3155
3185
  children: "Cancel"
3156
3186
  }
3157
3187
  ),
3158
3188
  /* @__PURE__ */ e.jsx(
3159
- te,
3189
+ ne,
3160
3190
  {
3161
3191
  colorScheme: "blue",
3162
- isDisabled: I || f || !R || D.trim().split(/\s+/).filter(Boolean).length > 40,
3163
- isLoading: I || f,
3164
- onClick: B,
3192
+ isDisabled: f || p || !T || P.trim().split(/\s+/).filter(Boolean).length > 40,
3193
+ isLoading: f || p,
3194
+ onClick: W,
3165
3195
  children: "Save"
3166
3196
  }
3167
3197
  )
@@ -3171,12 +3201,12 @@ const Rn = ({
3171
3201
  ) });
3172
3202
  };
3173
3203
  export {
3174
- Un as ActivityList,
3175
- bs as CopyActivityForm,
3176
- ys as CopyModuleForm,
3177
- Wn as ModuleForm,
3178
- Zn as ParameterEditList,
3179
- yt as ParameterEditSelect,
3180
- vs as UpsertActivityForm,
3181
- Cs as UpsertModuleForm
3204
+ qn as ActivityList,
3205
+ ws as CopyActivityForm,
3206
+ Is as CopyModuleForm,
3207
+ Kn as ModuleForm,
3208
+ ts as ParameterEditList,
3209
+ vt as ParameterEditSelect,
3210
+ Ss as UpsertActivityForm,
3211
+ Ls as UpsertModuleForm
3182
3212
  };