quantum-component-library 1.4.52 → 1.4.53-dev.1

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