quantum-component-library 1.4.64 → 1.4.66

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