quantum-component-library 1.4.66 → 1.4.68

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