quantum-component-library 1.4.47-dev.5 → 1.4.47-dev.6

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,49 +1,51 @@
1
1
  import { j as e } from "./react-jsx-runtime-vendor-OVHDjVDe.js";
2
- import { Flex as me, InputGroup as Le, InputLeftElement as lt, Icon as Ue, Input as je, FormLabel as We, Box as J, TableContainer as Be, Table as Qe, Thead as qe, Tr as Se, Th as ce, Tbody as He, Td as he, ButtonGroup as pe, Tooltip as at, Button as X, RangeSlider as ct, RangeSliderMark as Ne, Text as b, RangeSliderTrack as dt, RangeSliderFilledTrack as ut, RangeSliderThumb as Fe, Select as Re, NumberInput as ke, NumberInputField as De, HStack as te, Tag as fe, Checkbox as ht, useToast as Ye, VStack as ee, FormControl as B, RadioGroup as Je, Radio as Te, Alert as Ae, AlertIcon as Me, Spinner as Xe, useDisclosure as mt, Modal as pt, ModalOverlay as gt, ModalContent as xt, ModalHeader as jt, ModalCloseButton as ft, ModalBody as vt, ModalFooter as yt, IconButton as bt, Textarea as Ee } from "@chakra-ui/react";
3
- import { useMemo as D, useState as z, useCallback as R, useRef as Ct, useEffect as se, memo as Oe } from "react";
2
+ import { Flex as me, InputGroup as Le, InputLeftElement as lt, Icon as We, Input as je, FormLabel as Ue, Box as J, TableContainer as Be, Table as Qe, Thead as qe, Tr as Se, Th as ce, Tbody as He, Td as he, ButtonGroup as pe, Tooltip as at, Button as X, RangeSlider as ct, RangeSliderMark as Ne, Text as w, RangeSliderTrack as dt, RangeSliderFilledTrack as ut, RangeSliderThumb as Fe, Select as Re, NumberInput as ke, NumberInputField as De, HStack as te, Tag as fe, Checkbox as ht, useToast as Ye, VStack as ee, FormControl as B, RadioGroup as Je, Radio as Ae, Alert as Te, AlertIcon as Me, Spinner as Xe, useDisclosure as mt, Modal as pt, ModalOverlay as gt, ModalContent as xt, ModalHeader as jt, ModalCloseButton as ft, ModalBody as vt, ModalFooter as yt, IconButton as bt, Textarea as Ee } from "@chakra-ui/react";
3
+ import { useMemo as k, useState as z, useCallback as F, useRef as Ct, useEffect as ne, memo as Oe } from "react";
4
4
  import { u as wt } from "./ufuzzy-vendor-Dl0ZI6Av.js";
5
- import { s as ne } from "./react-select-vendor-BlY9Il4Q.js";
6
- import { F as St, a as Tt } from "./react-icons-vendor-TETORdU9.js";
5
+ import { s as se } from "./react-select-vendor-BlY9Il4Q.js";
6
+ import { F as St, a as At } from "./react-icons-vendor-TETORdU9.js";
7
7
  import { u as le, a as oe } from "./graphql-vendor-B0NjgbDB.js";
8
8
  import { getFragmentData as _ } from "./generated.js";
9
- import { M as de, A as ae, G as Ke, a as At, C as Ie, b as Ve, c as Ze, d as Ce, e as et, f as Mt, U as tt, g as st, h as Ot, i as Nt, j as nt, k as It, l as Lt, m as Ft } from "./graphql-CvUc6Vdv.js";
9
+ import { M as de, A as ae, G as Ze, a as Tt, C as Ie, b as Ke, c as Ve, d as Ce, e as et, f as Mt, U as tt, g as nt, h as Ot, i as Nt, j as st, k as It, l as Lt, m as Ft } from "./graphql-CvUc6Vdv.js";
10
10
  import { D as Rt, H as kt, u as Dt, a as Et } from "./react-dnd-vendor-D4nn9Mqx.js";
11
- import { ThresholdKind as we, SensorLocation as P, SessionType as zt, ActionLaterality as Pt, ActivityType as $t } from "./generated-graphql.js";
12
- import { getSegmentNameWithPlane as ot, getJointNameWithPlane as rt, getJointAngleDirectionName as _t, getSegmentAngleDirectionName as Gt, getNormativeJointRange as Ut, mapSessionTypeEnumToLabel as ze, getActivityKindFromActivityType as Wt, mapActivityTypeEnumToLabel as Pe } from "./services.js";
13
- import { availablePlanes as $e, getAnalysisPartIdNoSide as ve } from "./types.js";
11
+ import { ThresholdKind as we, SensorLocation as $, SessionType as zt, ActionLaterality as $t, ActivityType as Pt } from "./generated-graphql.js";
12
+ import { getSegmentNameWithPlane as ot, getJointNameWithPlane as rt, getJointAngleDirectionName as _t, getSegmentAngleDirectionName as Gt, getNormativeJointRange as Wt, mapSessionTypeEnumToLabel as ze, getActivityKindFromActivityType as Ut, mapActivityTypeEnumToLabel as $e } from "./services.js";
13
+ import { availablePlanes as Pe, getAnalysisPartIdNoSide as ve } from "./types.js";
14
14
  import { thresholdsToParameters as Bt, parametersToThresholds as _e, cn as Qt } from "./utils.js";
15
15
  import { usePartOptionsForSensorLocations as qt } from "./hooks.js";
16
16
  const Ht = ({
17
- setSearch: n,
18
- actions: s,
19
- updateUseCases: o
17
+ setSearch: s,
18
+ actions: n,
19
+ updateUseCases: o,
20
+ hideUseCaseFilter: a = !1
20
21
  }) => {
21
- const c = D(
22
- () => s?.flatMap((i) => i.useCases).filter((i, l, u) => u.findIndex((x) => x.id === i.id) === l).map((i) => ({
23
- label: i.name,
24
- value: i.id
22
+ const c = k(
23
+ () => n?.flatMap((r) => r.useCases).filter((r, d, j) => j.findIndex((l) => l.id === r.id) === d).map((r) => ({
24
+ label: r.name,
25
+ value: r.id
25
26
  })) || [],
26
- [s]
27
+ [n]
27
28
  );
28
29
  return /* @__PURE__ */ e.jsxs(me, { width: "100%", alignContent: "space-evenly", gap: 4, children: [
29
- /* @__PURE__ */ e.jsxs(Le, { size: "md", children: [
30
- /* @__PURE__ */ e.jsx(lt, { children: /* @__PURE__ */ e.jsx(Ue, { as: St, color: "gray.300" }) }),
30
+ /* @__PURE__ */ e.jsxs(Le, { size: "md", flex: 1, children: [
31
+ /* @__PURE__ */ e.jsx(lt, { children: /* @__PURE__ */ e.jsx(We, { as: St, color: "gray.300" }) }),
31
32
  /* @__PURE__ */ e.jsx(
32
33
  je,
33
34
  {
34
35
  placeholder: "Search by name...",
35
- maxW: "30rem",
36
- onChange: (i) => n(i.target.value)
36
+ width: "100%",
37
+ maxW: a ? void 0 : "30rem",
38
+ onChange: (r) => s(r.target.value)
37
39
  }
38
40
  )
39
41
  ] }),
40
- /* @__PURE__ */ e.jsx(Le, { size: "md", children: /* @__PURE__ */ e.jsx(
41
- ne,
42
+ !a && /* @__PURE__ */ e.jsx(Le, { size: "md", children: /* @__PURE__ */ e.jsx(
43
+ se,
42
44
  {
43
45
  size: "md",
44
46
  chakraStyles: {
45
- container: (i) => ({
46
- ...i,
47
+ container: (r) => ({
48
+ ...r,
47
49
  width: "100%"
48
50
  })
49
51
  },
@@ -51,192 +53,192 @@ const Ht = ({
51
53
  placeholder: "Filter use case",
52
54
  isMulti: !0,
53
55
  options: c,
54
- onChange: (i) => o(i.map((l) => l.value))
56
+ onChange: (r) => o(r.map((d) => d.value))
55
57
  }
56
58
  ) })
57
59
  ] });
58
60
  }, re = ({
59
- children: n
60
- }) => /* @__PURE__ */ e.jsx(We, { fontWeight: "bold", fontFamily: "sans-serif", fontSize: "large", children: n }), Yt = ({ value: n, onChange: s }) => {
61
+ children: s
62
+ }) => /* @__PURE__ */ e.jsx(Ue, { fontWeight: "bold", fontFamily: "sans-serif", fontSize: "large", children: s }), Yt = ({ value: s, onChange: n }) => {
61
63
  const o = z(
62
64
  () => Math.random().toString(36).substring(2, 15)
63
- )[0], c = R(
64
- (i, l) => {
65
- s((u) => {
66
- const x = [...u], [a] = x.splice(i, 1);
67
- return x.splice(l, 0, a), x;
65
+ )[0], a = F(
66
+ (c, r) => {
67
+ n((d) => {
68
+ const j = [...d], [l] = j.splice(c, 1);
69
+ return j.splice(r, 0, l), j;
68
70
  });
69
71
  },
70
- [s]
72
+ [n]
71
73
  );
72
74
  return /* @__PURE__ */ e.jsx(J, { children: /* @__PURE__ */ e.jsx(Rt, { backend: kt, children: /* @__PURE__ */ e.jsx(Be, { children: /* @__PURE__ */ e.jsxs(Qe, { variant: "simple", size: "md", children: [
73
75
  /* @__PURE__ */ e.jsx(qe, { children: /* @__PURE__ */ e.jsxs(Se, { children: [
74
76
  /* @__PURE__ */ e.jsx(ce, { children: "Order" }),
75
77
  /* @__PURE__ */ e.jsx(ce, { children: "Name" })
76
78
  ] }) }),
77
- /* @__PURE__ */ e.jsx(He, { children: n.map((i, l) => /* @__PURE__ */ e.jsx(
79
+ /* @__PURE__ */ e.jsx(He, { children: s.map((c, r) => /* @__PURE__ */ e.jsx(
78
80
  Jt,
79
81
  {
80
82
  listKey: o,
81
- index: l,
82
- id: i.id,
83
- name: i.name,
84
- move: c
83
+ index: r,
84
+ id: c.id,
85
+ name: c.name,
86
+ move: a
85
87
  },
86
- i.id
88
+ c.id
87
89
  )) })
88
90
  ] }) }) }) });
89
- }, Jt = ({ listKey: n, index: s, id: o, name: c, move: i }) => {
90
- const l = Ct(null), [{ handlerId: u }, x] = Dt({
91
- accept: n,
92
- collect: (j) => ({
93
- handlerId: j.getHandlerId()?.toString() ?? ""
91
+ }, Jt = ({ listKey: s, index: n, id: o, name: a, move: c }) => {
92
+ const r = Ct(null), [{ handlerId: d }, j] = Dt({
93
+ accept: s,
94
+ collect: (f) => ({
95
+ handlerId: f.getHandlerId()?.toString() ?? ""
94
96
  }),
95
- hover: (j, f) => {
96
- if (!l.current)
97
+ hover: (f, v) => {
98
+ if (!r.current)
97
99
  return;
98
- const r = j.index, d = s;
99
- if (r === d)
100
+ const i = f.index, u = n;
101
+ if (i === u)
100
102
  return;
101
- const p = l.current?.getBoundingClientRect(), g = (p.bottom - p.top) / 2, A = f.getClientOffset().y - p.top;
102
- r < d && A < g || r > d && A > g || (i(r, d), j.index = d);
103
+ const p = r.current?.getBoundingClientRect(), g = (p.bottom - p.top) / 2, T = v.getClientOffset().y - p.top;
104
+ i < u && T < g || i > u && T > g || (c(i, u), f.index = u);
103
105
  }
104
- }), [{ isDragging: a }, w] = Et({
105
- type: n,
106
- item: () => ({ id: o, index: s }),
107
- collect: (j) => ({
108
- isDragging: j.isDragging()
106
+ }), [{ isDragging: l }, S] = Et({
107
+ type: s,
108
+ item: () => ({ id: o, index: n }),
109
+ collect: (f) => ({
110
+ isDragging: f.isDragging()
109
111
  })
110
- }), I = a ? 0.6 : 1, m = a ? "grabbing" : "grab";
111
- return w(x(l)), /* @__PURE__ */ e.jsxs(Se, { ref: l, style: { opacity: I, cursor: m }, "data-handler-id": u, children: [
112
- /* @__PURE__ */ e.jsx(he, { children: s + 1 }),
113
- /* @__PURE__ */ e.jsx(he, { children: c })
112
+ }), N = l ? 0.6 : 1, h = l ? "grabbing" : "grab";
113
+ return S(j(r)), /* @__PURE__ */ e.jsxs(Se, { ref: r, style: { opacity: N, cursor: h }, "data-handler-id": d, children: [
114
+ /* @__PURE__ */ e.jsx(he, { children: n + 1 }),
115
+ /* @__PURE__ */ e.jsx(he, { children: a })
114
116
  ] });
115
117
  }, Xt = ({
116
- items: n,
117
- onChange: s,
118
+ items: s,
119
+ onChange: n,
118
120
  selectedItem: o,
119
- isDisabled: c,
120
- selectedProps: i,
121
- buttonProps: l
121
+ isDisabled: a,
122
+ selectedProps: c,
123
+ buttonProps: r
122
124
  }) => {
123
- const u = (a) => a === o || a.value === o, x = (a) => u(a) ? { ...l, ...i } : l;
124
- return /* @__PURE__ */ e.jsx(pe, { isAttached: !0, isDisabled: c, children: n.map((a, w) => /* @__PURE__ */ e.jsx(
125
+ const d = (l) => l === o || l.value === o, j = (l) => d(l) ? { ...r, ...c } : r;
126
+ return /* @__PURE__ */ e.jsx(pe, { isAttached: !0, isDisabled: a, children: s.map((l, S) => /* @__PURE__ */ e.jsx(
125
127
  at,
126
128
  {
127
- label: a.tooltip,
129
+ label: l.tooltip,
128
130
  openDelay: 50,
129
131
  closeDelay: 200,
130
132
  placement: "top",
131
- visibility: a.tooltip ? "visible" : "hidden",
133
+ visibility: l.tooltip ? "visible" : "hidden",
132
134
  hasArrow: !0,
133
135
  children: /* @__PURE__ */ e.jsx(
134
136
  X,
135
137
  {
136
- onClick: () => u(a) ? null : s(a, w),
137
- isDisabled: a.disabled,
138
- ...x(a),
139
- children: a.label
138
+ onClick: () => d(l) ? null : n(l, S),
139
+ isDisabled: l.disabled,
140
+ ...j(l),
141
+ children: l.label
140
142
  }
141
143
  )
142
144
  },
143
- w
145
+ S
144
146
  )) });
145
- }, ye = (n, s) => s < 0 ? -1 * Math.abs(n) : Math.abs(n), Kt = ({
146
- isReversed: n,
147
- min: s,
147
+ }, ye = (s, n) => n < 0 ? -1 * Math.abs(s) : Math.abs(s), Zt = ({
148
+ isReversed: s,
149
+ min: n,
148
150
  max: o,
149
- value: c,
150
- onChange: i,
151
- inputProps: l,
152
- size: u,
153
- zeroMarker: x,
154
- formatValue: a,
155
- valueLabel: w,
156
- positiveNegativeLabels: I,
157
- isDisabled: m,
158
- ...j
151
+ value: a,
152
+ onChange: c,
153
+ inputProps: r,
154
+ size: d,
155
+ zeroMarker: j,
156
+ formatValue: l,
157
+ valueLabel: S,
158
+ positiveNegativeLabels: N,
159
+ isDisabled: h,
160
+ ...f
159
161
  }) => {
160
- const [f, r] = z([void 0, void 0]), d = f[0], p = f[1], g = x && s < -5 && o > 5, y = Number(c?.[0] ?? p ?? s) > 0 ? 1 : -1, A = Number(c?.[1] ?? p ?? o) < 0 ? -1 : 1, C = I?.[0] === I?.[1], T = c?.[0], M = c?.[1];
161
- se(() => {
162
- T !== void 0 && M !== void 0 && r([T.toFixed(0), M.toFixed(0)]);
163
- }, [T, M, r]);
164
- const E = R(
165
- ([v, $]) => {
166
- v < $ && r([v.toFixed(0), $.toFixed(0)]);
167
- },
168
- [r]
169
- ), O = R(
170
- ([v, $]) => {
171
- v < $ && i([v, $]);
162
+ const [v, i] = z([void 0, void 0]), u = v[0], p = v[1], g = j && n < -5 && o > 5, y = Number(a?.[0] ?? p ?? n) > 0 ? 1 : -1, T = Number(a?.[1] ?? p ?? o) < 0 ? -1 : 1, D = N?.[0] === N?.[1], C = a?.[0], x = a?.[1];
163
+ ne(() => {
164
+ C !== void 0 && x !== void 0 && i([C.toFixed(0), x.toFixed(0)]);
165
+ }, [C, x, i]);
166
+ const E = F(
167
+ ([b, P]) => {
168
+ b < P && i([b.toFixed(0), P.toFixed(0)]);
172
169
  },
173
170
  [i]
174
- ), Q = R(() => {
175
- r(([v, $]) => {
176
- const q = isNaN(Number(v)) ? s : Number(v), t = isNaN(Number($)) ? o : Number($), h = ye(Number(q), y), S = ye(Number(t), A), F = y < 0 ? Math.max(h, s) : Math.min(h, o), L = A < 0 ? Math.max(S, s) : Math.min(S, o);
177
- return F > L ? (i([L, F]), [L.toFixed(0), F.toFixed(0)]) : (i([F, L]), [F.toFixed(0), L.toFixed(0)]);
171
+ ), M = F(
172
+ ([b, P]) => {
173
+ b < P && c([b, P]);
174
+ },
175
+ [c]
176
+ ), Q = F(() => {
177
+ i(([b, P]) => {
178
+ const q = isNaN(Number(b)) ? n : Number(b), t = isNaN(Number(P)) ? o : Number(P), m = ye(Number(q), y), A = ye(Number(t), T), L = y < 0 ? Math.max(m, n) : Math.min(m, o), I = T < 0 ? Math.max(A, n) : Math.min(A, o);
179
+ return L > I ? (c([I, L]), [I.toFixed(0), L.toFixed(0)]) : (c([L, I]), [L.toFixed(0), I.toFixed(0)]);
178
180
  });
179
- }, [i, r, y, A, s, o]), K = R(
180
- (v) => {
181
- const $ = v === "" || isNaN(Number(v)) ? v : ye(Number(v), y);
182
- r(([q, t]) => [$.toString(), t]);
181
+ }, [c, i, y, T, n, o]), Z = F(
182
+ (b) => {
183
+ const P = b === "" || isNaN(Number(b)) ? b : ye(Number(b), y);
184
+ i(([q, t]) => [P.toString(), t]);
183
185
  },
184
- [r, y]
185
- ), Y = R(
186
- (v) => {
187
- const $ = v === "" || isNaN(Number(v)) ? v : ye(Number(v), A);
188
- r(([q, t]) => [q, $.toString()]);
186
+ [i, y]
187
+ ), Y = F(
188
+ (b) => {
189
+ const P = b === "" || isNaN(Number(b)) ? b : ye(Number(b), T);
190
+ i(([q, t]) => [q, P.toString()]);
189
191
  },
190
- [r, A]
191
- ), k = D(
192
- () => u === "xs" ? "0.75rem" : void 0,
193
- [u]
194
- ), V = R(
195
- (v, $) => {
196
- const q = Number($.target.value);
197
- if (!d || !p || ![-1, 1].includes(q))
192
+ [i, T]
193
+ ), R = k(
194
+ () => d === "xs" ? "0.75rem" : void 0,
195
+ [d]
196
+ ), K = F(
197
+ (b, P) => {
198
+ const q = Number(P.target.value);
199
+ if (!u || !p || ![-1, 1].includes(q))
198
200
  return;
199
- const t = (F) => q < 0 ? -1 * Math.abs(F) : Math.abs(F), h = v ? t(Number(d)) : Number(d), S = v ? Number(p) : t(Number(p));
200
- h > S ? i([S, h]) : i([h, S]);
201
+ const t = (L) => q < 0 ? -1 * Math.abs(L) : Math.abs(L), m = b ? t(Number(u)) : Number(u), A = b ? Number(p) : t(Number(p));
202
+ m > A ? c([A, m]) : c([m, A]);
201
203
  },
202
- [d, p, i]
204
+ [u, p, c]
203
205
  );
204
- return /* @__PURE__ */ e.jsxs(me, { direction: "column", ...j, children: [
206
+ return /* @__PURE__ */ e.jsxs(me, { direction: "column", ...f, children: [
205
207
  /* @__PURE__ */ e.jsx(J, { pt: "1em", mb: "-0.5em", children: /* @__PURE__ */ e.jsxs(
206
208
  ct,
207
209
  {
208
210
  "aria-label": ["min", "max"],
209
- isReversed: n,
210
- value: [Number(d ?? s), Number(p ?? o)],
211
+ isReversed: s,
212
+ value: [Number(u ?? n), Number(p ?? o)],
211
213
  max: o,
212
- min: s,
214
+ min: n,
213
215
  minStepsBetweenThumbs: 3,
214
216
  step: 1,
215
217
  onChange: E,
216
- onChangeEnd: O,
217
- isDisabled: m,
218
+ onChangeEnd: M,
219
+ isDisabled: h,
218
220
  children: [
219
- /* @__PURE__ */ e.jsx(Ne, { value: s, top: "-1em", children: /* @__PURE__ */ e.jsx(
220
- b,
221
+ /* @__PURE__ */ e.jsx(Ne, { value: n, top: "-1em", children: /* @__PURE__ */ e.jsx(
222
+ w,
221
223
  {
222
- fontSize: u ?? "sm",
224
+ fontSize: d ?? "sm",
223
225
  fontWeight: "semibold",
224
226
  whiteSpace: "nowrap",
225
- children: a ? a?.(s) : s
227
+ children: l ? l?.(n) : n
226
228
  }
227
229
  ) }),
228
230
  /* @__PURE__ */ e.jsx(Ne, { value: o, top: "-1em", children: /* @__PURE__ */ e.jsx(
229
- b,
231
+ w,
230
232
  {
231
- fontSize: u ?? "sm",
233
+ fontSize: d ?? "sm",
232
234
  fontWeight: "semibold",
233
235
  style: { transform: "translateX(-100%)" },
234
236
  whiteSpace: "nowrap",
235
- children: a ? a(o) : o
237
+ children: l ? l(o) : o
236
238
  }
237
239
  ) }),
238
240
  g && /* @__PURE__ */ e.jsxs(Ne, { value: 0, top: "-1em", pos: "relative", children: [
239
- /* @__PURE__ */ e.jsx(b, { fontSize: u, fontWeight: "semibold", children: a?.(0) ?? "0" }),
241
+ /* @__PURE__ */ e.jsx(w, { fontSize: d, fontWeight: "semibold", children: l?.(0) ?? "0" }),
240
242
  /* @__PURE__ */ e.jsx(
241
243
  J,
242
244
  {
@@ -250,33 +252,33 @@ const Ht = ({
250
252
  )
251
253
  ] }),
252
254
  /* @__PURE__ */ e.jsx(dt, { children: /* @__PURE__ */ e.jsx(ut, {}) }),
253
- /* @__PURE__ */ e.jsx(Fe, { index: 0, w: k, h: k }),
254
- /* @__PURE__ */ e.jsx(Fe, { index: 1, w: k, h: k })
255
+ /* @__PURE__ */ e.jsx(Fe, { index: 0, w: R, h: R }),
256
+ /* @__PURE__ */ e.jsx(Fe, { index: 1, w: R, h: R })
255
257
  ]
256
258
  }
257
259
  ) }),
258
- w && /* @__PURE__ */ e.jsxs(
260
+ S && /* @__PURE__ */ e.jsxs(
259
261
  me,
260
262
  {
261
- direction: n ? "row-reverse" : "row",
263
+ direction: s ? "row-reverse" : "row",
262
264
  justifyContent: "space-between",
263
265
  children: [
264
266
  /* @__PURE__ */ e.jsx(
265
- b,
267
+ w,
266
268
  {
267
- fontSize: u ?? "sm",
269
+ fontSize: d ?? "sm",
268
270
  fontWeight: "semibold",
269
271
  whiteSpace: "nowrap",
270
- children: w(s)
272
+ children: S(n)
271
273
  }
272
274
  ),
273
275
  /* @__PURE__ */ e.jsx(
274
- b,
276
+ w,
275
277
  {
276
- fontSize: u ?? "sm",
278
+ fontSize: d ?? "sm",
277
279
  fontWeight: "semibold",
278
280
  whiteSpace: "nowrap",
279
- children: w(o)
281
+ children: S(o)
280
282
  }
281
283
  )
282
284
  ]
@@ -285,23 +287,23 @@ const Ht = ({
285
287
  /* @__PURE__ */ e.jsxs(
286
288
  me,
287
289
  {
288
- direction: n ? "row-reverse" : "row",
290
+ direction: s ? "row-reverse" : "row",
289
291
  justifyContent: "center",
290
292
  alignItems: "center",
291
293
  gap: "0.125em",
292
294
  children: [
293
- I && /* @__PURE__ */ e.jsxs(
295
+ N && /* @__PURE__ */ e.jsxs(
294
296
  Re,
295
297
  {
296
298
  width: "auto",
297
- size: u,
299
+ size: d,
298
300
  fontWeight: "bold",
299
301
  value: y,
300
- onChange: (v) => V(!0, v),
301
- isDisabled: C || m,
302
+ onChange: (b) => K(!0, b),
303
+ isDisabled: D || h,
302
304
  children: [
303
- /* @__PURE__ */ e.jsx("option", { value: -1, children: I[0] }),
304
- /* @__PURE__ */ e.jsx("option", { value: 1, children: I[1] })
305
+ /* @__PURE__ */ e.jsx("option", { value: -1, children: N[0] }),
306
+ /* @__PURE__ */ e.jsx("option", { value: 1, children: N[1] })
305
307
  ]
306
308
  }
307
309
  ),
@@ -309,17 +311,17 @@ const Ht = ({
309
311
  ke,
310
312
  {
311
313
  precision: 0,
312
- size: u ?? "sm",
314
+ size: d ?? "sm",
313
315
  min: 0,
314
- max: y < 0 ? Math.abs(s) : M ?? o,
315
- value: d === "" ? "" : Math.abs(Number(d ?? s)),
316
- onChange: K,
316
+ max: y < 0 ? Math.abs(n) : x ?? o,
317
+ value: u === "" ? "" : Math.abs(Number(u ?? n)),
318
+ onChange: Z,
317
319
  onBlur: Q,
318
320
  borderWidth: 1,
319
321
  borderRadius: 3,
320
322
  borderColor: "#ccc",
321
- isDisabled: m,
322
- ...l,
323
+ isDisabled: h,
324
+ ...r,
323
325
  children: /* @__PURE__ */ e.jsx(
324
326
  De,
325
327
  {
@@ -333,9 +335,9 @@ const Ht = ({
333
335
  /* @__PURE__ */ e.jsx(
334
336
  ke,
335
337
  {
336
- size: u ?? "sm",
338
+ size: d ?? "sm",
337
339
  min: 0,
338
- max: A < 0 ? Math.abs(T ?? s) : o,
340
+ max: T < 0 ? Math.abs(C ?? n) : o,
339
341
  precision: 0,
340
342
  value: p === "" ? "" : Math.abs(Number(p ?? o)),
341
343
  onChange: Y,
@@ -343,8 +345,8 @@ const Ht = ({
343
345
  borderWidth: 1,
344
346
  borderRadius: 3,
345
347
  borderColor: "#ccc",
346
- isDisabled: m,
347
- ...l,
348
+ isDisabled: h,
349
+ ...r,
348
350
  children: /* @__PURE__ */ e.jsx(
349
351
  De,
350
352
  {
@@ -355,18 +357,18 @@ const Ht = ({
355
357
  )
356
358
  }
357
359
  ),
358
- I && /* @__PURE__ */ e.jsxs(
360
+ N && /* @__PURE__ */ e.jsxs(
359
361
  Re,
360
362
  {
361
363
  width: "auto",
362
- size: u,
364
+ size: d,
363
365
  fontWeight: "bold",
364
- value: A,
365
- onChange: (v) => V(!1, v),
366
- isDisabled: C || m,
366
+ value: T,
367
+ onChange: (b) => K(!1, b),
368
+ isDisabled: D || h,
367
369
  children: [
368
- /* @__PURE__ */ e.jsx("option", { value: -1, children: I[0] }),
369
- /* @__PURE__ */ e.jsx("option", { value: 1, children: I[1] })
370
+ /* @__PURE__ */ e.jsx("option", { value: -1, children: N[0] }),
371
+ /* @__PURE__ */ e.jsx("option", { value: 1, children: N[1] })
370
372
  ]
371
373
  }
372
374
  )
@@ -374,72 +376,78 @@ const Ht = ({
374
376
  }
375
377
  )
376
378
  ] });
377
- }, Vt = ({ tags: n, containerProps: s, ...o }) => /* @__PURE__ */ e.jsx(te, { ...s, children: n.map((c, i) => /* @__PURE__ */ e.jsx(fe, { ...o, children: c }, i)) }), Zt = new wt({}), es = (n, s) => {
378
- if (!s || !s.trim().length)
379
- return n;
380
- const o = n.map((i) => i.name ?? "");
381
- return Zt.filter(o, s)?.map((i) => n[i]) ?? [];
382
- }, ts = (n, s) => !s || s.length == 0 ? n : n.filter(
383
- (o) => o.useCases.some((c) => s.includes(c.id))
384
- ), ss = ({
385
- actions: n,
386
- totalActions: s,
379
+ }, Kt = ({ tags: s, containerProps: n, ...o }) => /* @__PURE__ */ e.jsx(te, { ...n, children: s.map((a, c) => /* @__PURE__ */ e.jsx(fe, { ...o, children: a }, c)) }), Vt = new wt({}), en = (s, n) => {
380
+ if (!n || !n.trim().length)
381
+ return s;
382
+ const o = s.map((c) => c.name ?? "");
383
+ return Vt.filter(o, n)?.map((c) => s[c]) ?? [];
384
+ }, tn = (s) => !s || s.length === 0 ? "None" : s.map(
385
+ (n) => (
386
+ // Convert camelCase to separate words (e.g., 'LeftFoot' -> 'Left Foot')
387
+ n.replace(/([A-Z])/g, " $1").trim()
388
+ )
389
+ ).join(", "), nn = (s, n) => !n || n.length == 0 ? s : s.filter(
390
+ (o) => o.useCases.some((a) => n.includes(a.id))
391
+ ), sn = ({
392
+ actions: s,
393
+ totalActions: n,
387
394
  onCreate: o,
388
- onDelete: c,
389
- onEdit: i,
390
- onSelected: l,
391
- onDuplicate: u,
392
- disableMultiSelect: x,
393
- disableDelete: a,
394
- disableEdit: w,
395
- disableCreate: I,
396
- tableProps: m,
397
- ...j
395
+ onDelete: a,
396
+ onEdit: c,
397
+ onSelected: r,
398
+ onDuplicate: d,
399
+ disableMultiSelect: j,
400
+ disableDelete: l,
401
+ disableEdit: S,
402
+ disableCreate: N,
403
+ hideUseCase: h = !0,
404
+ tableProps: f,
405
+ ...v
398
406
  }) => {
399
- const [f, r] = z(""), [d, p] = z(), g = D(() => {
400
- if (!n)
407
+ const [i, u] = z(""), [p, g] = z(), y = k(() => {
408
+ if (!s)
401
409
  return;
402
- const C = es(n, f);
403
- return ts(C, d).sort((M, E) => M.name.localeCompare(E.name));
404
- }, [n, f, d]), y = R(() => {
405
- if (!c)
410
+ const C = en(s, i);
411
+ return (h ? C : nn(C, p)).sort((E, M) => E.name.localeCompare(M.name));
412
+ }, [s, i, p, h]), T = F(() => {
413
+ if (!a)
406
414
  return;
407
- const C = n.filter((T) => T.selected).map((T) => T.id);
408
- c(C);
409
- }, [n, c]), A = R(() => {
410
- if (!u)
415
+ const C = s.filter((x) => x.selected).map((x) => x.id);
416
+ a(C);
417
+ }, [s, a]), D = F(() => {
418
+ if (!d)
411
419
  return;
412
- const C = n.filter((T) => T.selected);
413
- u(C.map((T) => T.id)), l && C.forEach((T) => l(T, !1));
414
- }, [n, u, l]);
415
- return /* @__PURE__ */ e.jsxs(J, { ...j, children: [
420
+ const C = s.filter((x) => x.selected);
421
+ d(C.map((x) => x.id)), r && C.forEach((x) => r(x, !1));
422
+ }, [s, d, r]);
423
+ return /* @__PURE__ */ e.jsxs(J, { ...v, children: [
416
424
  /* @__PURE__ */ e.jsxs(me, { alignContent: "space-between", gap: 4, children: [
417
- (o || c || u) && /* @__PURE__ */ e.jsxs(pe, { mb: "1rem", gap: 4, children: [
425
+ (o || a || d) && /* @__PURE__ */ e.jsxs(pe, { mb: "1rem", gap: 4, children: [
418
426
  o && /* @__PURE__ */ e.jsx(
419
427
  X,
420
428
  {
421
- isDisabled: !o || I,
429
+ isDisabled: !o || N,
422
430
  colorScheme: "blackAlpha",
423
431
  backgroundColor: "gray.700",
424
432
  onClick: o,
425
433
  children: "Create New Activity"
426
434
  }
427
435
  ),
428
- c && !x && /* @__PURE__ */ e.jsx(
436
+ a && !j && /* @__PURE__ */ e.jsx(
429
437
  X,
430
438
  {
431
439
  colorScheme: "gray",
432
- isDisabled: n.length <= 0 || !c || a,
433
- onClick: y,
440
+ isDisabled: s.length <= 0 || !a || l,
441
+ onClick: T,
434
442
  children: "Delete Selected"
435
443
  }
436
444
  ),
437
- u && !x && /* @__PURE__ */ e.jsx(
445
+ d && !j && /* @__PURE__ */ e.jsx(
438
446
  X,
439
447
  {
440
448
  colorScheme: "gray",
441
- isDisabled: n.length <= 0,
442
- onClick: A,
449
+ isDisabled: s.length <= 0,
450
+ onClick: D,
443
451
  children: "Duplicate Selected"
444
452
  }
445
453
  )
@@ -447,66 +455,67 @@ const Ht = ({
447
455
  /* @__PURE__ */ e.jsx(
448
456
  Ht,
449
457
  {
450
- setSearch: r,
451
- actions: n,
452
- updateUseCases: p
458
+ setSearch: u,
459
+ actions: s,
460
+ updateUseCases: g,
461
+ hideUseCaseFilter: h
453
462
  }
454
463
  )
455
464
  ] }),
456
- /* @__PURE__ */ e.jsx(Be, { mr: "2rem", overflowX: "hidden", ...m, children: /* @__PURE__ */ e.jsxs(Qe, { size: "md", variant: "simple", children: [
465
+ /* @__PURE__ */ e.jsx(Be, { mr: "2rem", overflowX: "hidden", ...f, children: /* @__PURE__ */ e.jsxs(Qe, { size: "md", variant: "simple", children: [
457
466
  /* @__PURE__ */ e.jsx(qe, { position: "sticky", top: 0, bg: "white", zIndex: 1, children: /* @__PURE__ */ e.jsxs(Se, { children: [
458
467
  /* @__PURE__ */ e.jsxs(ce, { fontWeight: "normal", children: [
459
468
  "(showing ",
460
- g?.length ?? 0,
469
+ y?.length ?? 0,
461
470
  " of",
462
471
  " ",
463
- s ?? n.length,
472
+ n ?? s.length,
464
473
  ")"
465
474
  ] }),
466
475
  /* @__PURE__ */ e.jsx(ce, { children: "Name" }),
467
- /* @__PURE__ */ e.jsx(ce, { children: "Sensor Count" }),
468
- /* @__PURE__ */ e.jsx(ce, { children: "Use Case" }),
476
+ /* @__PURE__ */ e.jsx(ce, { children: "Sensor Locations" }),
477
+ !h && /* @__PURE__ */ e.jsx(ce, { children: "Use Case" }),
469
478
  /* @__PURE__ */ e.jsx(ce, {})
470
479
  ] }) }),
471
- /* @__PURE__ */ e.jsx(He, { children: g?.map((C) => /* @__PURE__ */ e.jsxs(
480
+ /* @__PURE__ */ e.jsx(He, { children: y?.map((C) => /* @__PURE__ */ e.jsxs(
472
481
  Se,
473
482
  {
474
- title: x && C.selected ? "This activity is selected. Click it again to deselect." : void 0,
475
- bg: x && C.selected ? "gray.200" : void 0,
483
+ title: j && C.selected ? "This activity is selected. Click it again to deselect." : void 0,
484
+ bg: j && C.selected ? "gray.200" : void 0,
476
485
  _hover: {
477
- bg: x && !C.selected ? "#f7f7f7" : void 0
486
+ bg: j && !C.selected ? "#f7f7f7" : void 0
478
487
  },
479
- cursor: x ? "pointer" : "default",
480
- onClick: () => x ? l?.(C, !C.selected) : void 0,
488
+ cursor: j ? "pointer" : "default",
489
+ onClick: () => j ? r?.(C, !C.selected) : void 0,
481
490
  children: [
482
491
  /* @__PURE__ */ e.jsx(he, { children: /* @__PURE__ */ e.jsxs(me, { children: [
483
- l && !x && /* @__PURE__ */ e.jsx(
492
+ r && !j && /* @__PURE__ */ e.jsx(
484
493
  ht,
485
494
  {
486
495
  isChecked: C.selected,
487
- onChange: (T) => l(C, T.target.checked)
496
+ onChange: (x) => r(C, x.target.checked)
488
497
  }
489
498
  ),
490
- i && /* @__PURE__ */ e.jsx(
499
+ c && /* @__PURE__ */ e.jsx(
491
500
  X,
492
501
  {
493
- disabled: w,
502
+ disabled: S,
494
503
  ml: "1em",
495
504
  size: "sm",
496
505
  variant: "link",
497
506
  colorScheme: "blue",
498
- onClick: () => i(C.id),
507
+ onClick: () => c(C.id),
499
508
  children: "edit"
500
509
  }
501
510
  )
502
511
  ] }) }),
503
512
  /* @__PURE__ */ e.jsx(he, { whiteSpace: "break-spaces", children: C.name }),
504
- /* @__PURE__ */ e.jsx(he, { maxW: "20rem", children: C.sensorLocations.length }),
505
- /* @__PURE__ */ e.jsx(he, { maxW: "20rem", children: /* @__PURE__ */ e.jsx(
506
- Vt,
513
+ /* @__PURE__ */ e.jsx(he, { maxW: "20rem", whiteSpace: "break-spaces", children: tn(C.sensorLocations) }),
514
+ !h && /* @__PURE__ */ e.jsx(he, { maxW: "20rem", children: /* @__PURE__ */ e.jsx(
515
+ Kt,
507
516
  {
508
517
  containerProps: { flexWrap: "wrap" },
509
- tags: C.useCases?.map((T) => T.name) ?? []
518
+ tags: C.useCases?.map((x) => x.name) ?? []
510
519
  }
511
520
  ) })
512
521
  ]
@@ -515,48 +524,48 @@ const Ht = ({
515
524
  )) })
516
525
  ] }) })
517
526
  ] });
518
- }, Ns = ({
519
- onSave: n,
520
- onCancel: s,
527
+ }, Ln = ({
528
+ onSave: s,
529
+ onCancel: n,
521
530
  onError: o,
522
- hideButtons: c = !1,
523
- setButtonDisabled: i,
524
- setButtonOnClick: l,
525
- quantumOwned: u
531
+ hideButtons: a = !1,
532
+ setButtonDisabled: c,
533
+ setButtonOnClick: r,
534
+ quantumOwned: d
526
535
  }) => {
527
- const x = Ye(), [a, w] = z("copy"), [I, m] = z(""), [j, f] = z([]), [r, d] = z(!1), [p] = le({
528
- query: Ke
536
+ const j = Ye(), [l, S] = z("copy"), [N, h] = z(""), [f, v] = z([]), [i, u] = z(!1), [p] = le({
537
+ query: Ze
529
538
  }), [g] = le({
530
- query: At,
531
- variables: { groupId: I },
532
- pause: !I
539
+ query: Tt,
540
+ variables: { groupId: N },
541
+ pause: !N
533
542
  // Only run when group is selected
534
- }), [, y] = oe(Ie), [, A] = oe(
535
- Ve
536
- ), C = D(() => p.data?.groups ? p.data.groups.map(
537
- (t) => _(Ze, t)
538
- ) : [], [p.data]), T = D(() => g.data ? g.data.actions.map(
539
- (h) => _(ae, h)
540
- ) : [], [g.data]), M = D(() => T.filter(
541
- (t) => j.includes(t.id)
542
- ), [T, j]), E = R(
543
+ }), [, y] = oe(Ie), [, T] = oe(
544
+ Ke
545
+ ), D = k(() => p.data?.groups ? p.data.groups.map(
546
+ (t) => _(Ve, t)
547
+ ) : [], [p.data]), C = k(() => g.data ? g.data.actions.map(
548
+ (m) => _(ae, m)
549
+ ) : [], [g.data]), x = k(() => C.filter(
550
+ (t) => f.includes(t.id)
551
+ ), [C, f]), E = F(
543
552
  (t) => {
544
- const h = t?.value || "";
545
- m(h), f([]);
553
+ const m = t?.value || "";
554
+ h(m), v([]);
546
555
  },
547
556
  []
548
- ), O = R(
557
+ ), M = F(
549
558
  (t) => {
550
- const h = t.map((S) => S.value);
551
- f(h);
559
+ const m = t.map((A) => A.value);
560
+ v(m);
552
561
  },
553
562
  []
554
- ), Q = R(
563
+ ), Q = F(
555
564
  async (t) => {
556
- const h = _(
565
+ const m = _(
557
566
  de,
558
567
  t.categories
559
- ), S = {
568
+ ), A = {
560
569
  ...t,
561
570
  name: `${t.name} (Copy)`,
562
571
  // Add "(Copy)" suffix to distinguish
@@ -566,128 +575,128 @@ const Ht = ({
566
575
  laterality: t.laterality,
567
576
  activityKind: t.activityKind,
568
577
  sensorLocations: t.sensorLocations,
569
- thresholds: t.thresholds.map((L) => ({
570
- ...L,
578
+ thresholds: t.thresholds.map((I) => ({
579
+ ...I,
571
580
  id: void 0
572
581
  })),
573
- categories: h?.map((L) => L.id),
574
- quantumOwned: u,
582
+ categories: m?.map((I) => I.id),
583
+ quantumOwned: d,
575
584
  id: void 0
576
- }, F = await y({ fields: S });
577
- if (F.error)
578
- throw new Error(F.error.message);
579
- if (F.data?.createAction)
580
- return _(ae, F.data.createAction);
585
+ }, L = await y({ fields: A });
586
+ if (L.error)
587
+ throw new Error(L.error.message);
588
+ if (L.data?.createAction)
589
+ return _(ae, L.data.createAction);
581
590
  throw new Error("No action data returned");
582
591
  },
583
- [y, u]
584
- ), K = R(
592
+ [y, d]
593
+ ), Z = F(
585
594
  async (t) => {
586
- const h = await A({ id: t.id });
587
- if (h.error)
588
- throw new Error(h.error.message);
589
- if (h.data?.convertActionToQuantumOwned)
595
+ const m = await T({ id: t.id });
596
+ if (m.error)
597
+ throw new Error(m.error.message);
598
+ if (m.data?.convertActionToQuantumOwned)
590
599
  return _(
591
600
  ae,
592
- h.data.convertActionToQuantumOwned
601
+ m.data.convertActionToQuantumOwned
593
602
  );
594
603
  throw new Error("No action data returned");
595
604
  },
596
- [A]
597
- ), Y = R(async () => {
598
- if (d(!0), !M.length) {
605
+ [T]
606
+ ), Y = F(async () => {
607
+ if (u(!0), !x.length) {
599
608
  const t = new Error(
600
- `No activities selected for ${a === "copy" ? "copying" : "converting"}`
609
+ `No activities selected for ${l === "copy" ? "copying" : "converting"}`
601
610
  );
602
- o?.(t), d(!1);
611
+ o?.(t), u(!1);
603
612
  return;
604
613
  }
605
614
  try {
606
615
  const t = [];
607
- let h = 0;
608
- const S = a === "copy" ? Q : K, F = a === "copy" ? "copy" : "convert";
609
- for (const L of M)
616
+ let m = 0;
617
+ const A = l === "copy" ? Q : Z, L = l === "copy" ? "copy" : "convert";
618
+ for (const I of x)
610
619
  try {
611
- const U = await S(L);
612
- t.push(U);
613
- } catch (U) {
620
+ const W = await A(I);
621
+ t.push(W);
622
+ } catch (W) {
614
623
  console.error(
615
- `Failed to ${F} activity "${L.name}":`,
616
- U
617
- ), h++;
624
+ `Failed to ${L} activity "${I.name}":`,
625
+ W
626
+ ), m++;
618
627
  }
619
628
  if (t.length > 0) {
620
- const L = t.length, U = M.length, H = a === "copy" ? "copied" : "converted", W = a === "copy" ? "copy" : "convert";
621
- x({
622
- title: h > 0 ? `Partial ${W} completed` : `Activities ${H} successfully`,
623
- description: h > 0 ? `${L} of ${U} activities ${H} successfully` : `${L} activit${L > 1 ? "ies" : "y"} ${H} successfully`,
624
- status: h > 0 ? "warning" : "success",
629
+ const I = t.length, W = x.length, H = l === "copy" ? "copied" : "converted", U = l === "copy" ? "copy" : "convert";
630
+ j({
631
+ title: m > 0 ? `Partial ${U} completed` : `Activities ${H} successfully`,
632
+ description: m > 0 ? `${I} of ${W} activities ${H} successfully` : `${I} activit${I > 1 ? "ies" : "y"} ${H} successfully`,
633
+ status: m > 0 ? "warning" : "success",
625
634
  duration: 3e3,
626
635
  isClosable: !0
627
- }), n?.(), m(""), f([]);
636
+ }), s?.(), h(""), v([]);
628
637
  } else
629
- throw new Error(`Failed to ${F} any activities`);
638
+ throw new Error(`Failed to ${L} any activities`);
630
639
  } catch (t) {
631
- const h = a === "copy" ? "copy" : "convert", S = t instanceof Error ? t.message : `Failed to ${h} activities`;
632
- x({
633
- title: `${a === "copy" ? "Copy" : "Convert"} failed`,
634
- description: S,
640
+ const m = l === "copy" ? "copy" : "convert", A = t instanceof Error ? t.message : `Failed to ${m} activities`;
641
+ j({
642
+ title: `${l === "copy" ? "Copy" : "Convert"} failed`,
643
+ description: A,
635
644
  status: "error",
636
645
  duration: 5e3,
637
646
  isClosable: !0
638
- }), o?.(t instanceof Error ? t : new Error(S));
647
+ }), o?.(t instanceof Error ? t : new Error(A));
639
648
  } finally {
640
- d(!1);
649
+ u(!1);
641
650
  }
642
651
  }, [
643
- M,
644
- a,
645
- Q,
646
- K,
647
652
  x,
648
- n,
653
+ l,
654
+ Q,
655
+ Z,
656
+ j,
657
+ s,
649
658
  o
650
- ]), k = R(() => {
651
- m(""), f([]), w("copy"), s?.();
652
- }, [s]);
653
- se(() => {
654
- i && i({
659
+ ]), R = F(() => {
660
+ h(""), v([]), S("copy"), n?.();
661
+ }, [n]);
662
+ ne(() => {
663
+ c && c({
655
664
  cancelButton: !1,
656
- saveButton: M.length === 0 || r
665
+ saveButton: x.length === 0 || i
657
666
  });
658
- }, [M.length, r, i]), se(() => {
659
- l && l({
660
- cancelButton: k,
667
+ }, [x.length, i, c]), ne(() => {
668
+ r && r({
669
+ cancelButton: R,
661
670
  saveButton: Y
662
671
  });
663
- }, [l, k, Y]);
664
- const V = D(() => C.map((t) => ({
672
+ }, [r, R, Y]);
673
+ const K = k(() => D.map((t) => ({
665
674
  value: t.id,
666
675
  label: t.name
667
- })), [C]), v = D(() => T.filter((t) => a === "copy" ? !0 : !t.quantumOwned).map((t) => ({
676
+ })), [D]), b = k(() => C.filter((t) => l === "copy" ? !0 : !t.quantumOwned).map((t) => ({
668
677
  value: t.id,
669
678
  label: t.name,
670
679
  // Add custom data to identify quantum-owned actions for UI display
671
680
  isQuantumOwned: t.quantumOwned
672
- })), [T, a]), $ = p.fetching, q = g.fetching;
681
+ })), [C, l]), P = p.fetching, q = g.fetching;
673
682
  return /* @__PURE__ */ e.jsx(J, { children: /* @__PURE__ */ e.jsxs(ee, { spacing: 6, align: "stretch", children: [
674
- u && /* @__PURE__ */ e.jsxs(B, { children: [
683
+ d && /* @__PURE__ */ e.jsxs(B, { children: [
675
684
  /* @__PURE__ */ e.jsx(re, { children: "Operation Mode" }),
676
685
  /* @__PURE__ */ e.jsx(
677
686
  Je,
678
687
  {
679
- value: a,
688
+ value: l,
680
689
  onChange: (t) => {
681
- w(t), f([]);
690
+ S(t), v([]);
682
691
  },
683
692
  children: /* @__PURE__ */ e.jsxs(te, { spacing: 6, children: [
684
- /* @__PURE__ */ e.jsx(Te, { value: "copy", colorScheme: "blue", children: /* @__PURE__ */ e.jsxs(ee, { align: "start", spacing: 1, children: [
685
- /* @__PURE__ */ e.jsx(b, { fontWeight: "medium", children: "Copy Activities" }),
686
- /* @__PURE__ */ e.jsx(b, { fontSize: "sm", color: "gray.600", children: "Create new activities based on selected ones" })
693
+ /* @__PURE__ */ e.jsx(Ae, { value: "copy", colorScheme: "blue", children: /* @__PURE__ */ e.jsxs(ee, { align: "start", spacing: 1, children: [
694
+ /* @__PURE__ */ e.jsx(w, { fontWeight: "medium", children: "Copy Activities" }),
695
+ /* @__PURE__ */ e.jsx(w, { fontSize: "sm", color: "gray.600", children: "Create new activities based on selected ones" })
687
696
  ] }) }),
688
- /* @__PURE__ */ e.jsx(Te, { value: "convert", colorScheme: "green", children: /* @__PURE__ */ e.jsxs(ee, { align: "start", spacing: 1, children: [
689
- /* @__PURE__ */ e.jsx(b, { fontWeight: "medium", children: "Convert to Quantum Owned" }),
690
- /* @__PURE__ */ e.jsx(b, { fontSize: "sm", color: "gray.600", children: "Convert existing activities to quantum-owned" })
697
+ /* @__PURE__ */ e.jsx(Ae, { value: "convert", colorScheme: "green", children: /* @__PURE__ */ e.jsxs(ee, { align: "start", spacing: 1, children: [
698
+ /* @__PURE__ */ e.jsx(w, { fontWeight: "medium", children: "Convert to Quantum Owned" }),
699
+ /* @__PURE__ */ e.jsx(w, { fontSize: "sm", color: "gray.600", children: "Convert existing activities to quantum-owned" })
691
700
  ] }) })
692
701
  ] })
693
702
  }
@@ -696,71 +705,71 @@ const Ht = ({
696
705
  /* @__PURE__ */ e.jsxs(B, { children: [
697
706
  /* @__PURE__ */ e.jsx(re, { children: "Select Source Group" }),
698
707
  /* @__PURE__ */ e.jsx(
699
- ne,
708
+ se,
700
709
  {
701
710
  placeholder: "Choose a group...",
702
- options: V,
703
- value: V.find((t) => t.value === I) || null,
711
+ options: K,
712
+ value: K.find((t) => t.value === N) || null,
704
713
  onChange: E,
705
- isLoading: $,
706
- isDisabled: $,
714
+ isLoading: P,
715
+ isDisabled: P,
707
716
  isClearable: !0
708
717
  }
709
718
  ),
710
- p.error && /* @__PURE__ */ e.jsxs(Ae, { status: "error", mt: 2, children: [
719
+ p.error && /* @__PURE__ */ e.jsxs(Te, { status: "error", mt: 2, children: [
711
720
  /* @__PURE__ */ e.jsx(Me, {}),
712
- /* @__PURE__ */ e.jsxs(b, { fontSize: "sm", children: [
721
+ /* @__PURE__ */ e.jsxs(w, { fontSize: "sm", children: [
713
722
  "Failed to load groups: ",
714
723
  p.error.message
715
724
  ] })
716
725
  ] })
717
726
  ] }),
718
- I && /* @__PURE__ */ e.jsxs(B, { children: [
727
+ N && /* @__PURE__ */ e.jsxs(B, { children: [
719
728
  /* @__PURE__ */ e.jsxs(re, { children: [
720
729
  "Select Activities to",
721
730
  " ",
722
- a === "copy" ? "Copy" : "Convert"
731
+ l === "copy" ? "Copy" : "Convert"
723
732
  ] }),
724
733
  q ? /* @__PURE__ */ e.jsxs(te, { children: [
725
734
  /* @__PURE__ */ e.jsx(Xe, { size: "sm" }),
726
- /* @__PURE__ */ e.jsx(b, { fontSize: "sm", color: "gray.600", children: "Loading activities..." })
735
+ /* @__PURE__ */ e.jsx(w, { fontSize: "sm", color: "gray.600", children: "Loading activities..." })
727
736
  ] }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
728
737
  /* @__PURE__ */ e.jsx(
729
- ne,
738
+ se,
730
739
  {
731
- placeholder: `Choose activities to ${a}...`,
732
- options: v,
733
- value: v.filter(
734
- (t) => j.includes(t.value)
740
+ placeholder: `Choose activities to ${l}...`,
741
+ options: b,
742
+ value: b.filter(
743
+ (t) => f.includes(t.value)
735
744
  ),
736
- onChange: O,
737
- isDisabled: v.length === 0,
745
+ onChange: M,
746
+ isDisabled: b.length === 0,
738
747
  isClearable: !0,
739
748
  isMulti: !0,
740
749
  closeMenuOnSelect: !1,
741
- formatOptionLabel: (t, { context: h }) => /* @__PURE__ */ e.jsxs(te, { justify: "space-between", w: "100%", children: [
750
+ formatOptionLabel: (t, { context: m }) => /* @__PURE__ */ e.jsxs(te, { justify: "space-between", w: "100%", children: [
742
751
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
743
- /* @__PURE__ */ e.jsx(b, { children: t.label }),
744
- h === "value" && t.isQuantumOwned && /* @__PURE__ */ e.jsx(b, { color: "blue", fontSize: "xs", children: "(Quantum Owned)" })
752
+ /* @__PURE__ */ e.jsx(w, { children: t.label }),
753
+ m === "value" && t.isQuantumOwned && /* @__PURE__ */ e.jsx(w, { color: "blue", fontSize: "xs", children: "(Quantum Owned)" })
745
754
  ] }),
746
- t.isQuantumOwned && h === "menu" && /* @__PURE__ */ e.jsx(fe, { size: "sm", colorScheme: "blue", variant: "solid", children: "Quantum Owned" })
755
+ t.isQuantumOwned && m === "menu" && /* @__PURE__ */ e.jsx(fe, { size: "sm", colorScheme: "blue", variant: "solid", children: "Quantum Owned" })
747
756
  ] })
748
757
  }
749
758
  ),
750
- v.length === 0 && /* @__PURE__ */ e.jsx(b, { fontSize: "sm", color: "gray.500", mt: 2, children: "No activities found" })
759
+ b.length === 0 && /* @__PURE__ */ e.jsx(w, { fontSize: "sm", color: "gray.500", mt: 2, children: "No activities found" })
751
760
  ] }),
752
- g.error && /* @__PURE__ */ e.jsxs(Ae, { status: "error", mt: 2, children: [
761
+ g.error && /* @__PURE__ */ e.jsxs(Te, { status: "error", mt: 2, children: [
753
762
  /* @__PURE__ */ e.jsx(Me, {}),
754
- /* @__PURE__ */ e.jsxs(b, { fontSize: "sm", children: [
763
+ /* @__PURE__ */ e.jsxs(w, { fontSize: "sm", children: [
755
764
  "Failed to load activities: ",
756
765
  g.error.message
757
766
  ] })
758
767
  ] })
759
768
  ] }),
760
- M.length > 0 && /* @__PURE__ */ e.jsxs(J, { p: 4, bg: "gray.50", borderRadius: "md", children: [
761
- /* @__PURE__ */ e.jsx(b, { fontWeight: "semibold", mb: 3, children: M.length === 1 ? `Activity to ${a === "copy" ? "Copy" : "Convert"}:` : `${M.length} Activities to ${a === "copy" ? "Copy" : "Convert"}:` }),
769
+ x.length > 0 && /* @__PURE__ */ e.jsxs(J, { p: 4, bg: "gray.50", borderRadius: "md", children: [
770
+ /* @__PURE__ */ e.jsx(w, { fontWeight: "semibold", mb: 3, children: x.length === 1 ? `Activity to ${l === "copy" ? "Copy" : "Convert"}:` : `${x.length} Activities to ${l === "copy" ? "Copy" : "Convert"}:` }),
762
771
  /* @__PURE__ */ e.jsxs(ee, { align: "start", spacing: 3, children: [
763
- M.map((t, h) => /* @__PURE__ */ e.jsxs(
772
+ x.map((t, m) => /* @__PURE__ */ e.jsxs(
764
773
  J,
765
774
  {
766
775
  w: "100%",
@@ -771,8 +780,8 @@ const Ht = ({
771
780
  borderColor: "gray.200",
772
781
  children: [
773
782
  /* @__PURE__ */ e.jsxs(te, { justify: "space-between", align: "start", mb: 2, children: [
774
- /* @__PURE__ */ e.jsxs(b, { fontWeight: "medium", fontSize: "sm", children: [
775
- h + 1,
783
+ /* @__PURE__ */ e.jsxs(w, { fontWeight: "medium", fontSize: "sm", children: [
784
+ m + 1,
776
785
  ". ",
777
786
  t.name
778
787
  ] }),
@@ -786,35 +795,35 @@ const Ht = ({
786
795
  fontSize: "sm",
787
796
  color: "gray.600",
788
797
  children: [
789
- t.description && /* @__PURE__ */ e.jsxs(b, { children: [
798
+ t.description && /* @__PURE__ */ e.jsxs(w, { children: [
790
799
  /* @__PURE__ */ e.jsx("strong", { children: "Description:" }),
791
800
  " ",
792
801
  t.description
793
802
  ] }),
794
- /* @__PURE__ */ e.jsxs(b, { children: [
803
+ /* @__PURE__ */ e.jsxs(w, { children: [
795
804
  /* @__PURE__ */ e.jsx("strong", { children: "Type:" }),
796
805
  " ",
797
806
  t.activityKind
798
807
  ] }),
799
- /* @__PURE__ */ e.jsxs(b, { children: [
808
+ /* @__PURE__ */ e.jsxs(w, { children: [
800
809
  /* @__PURE__ */ e.jsx("strong", { children: "Laterality:" }),
801
810
  " ",
802
811
  t.laterality
803
812
  ] }),
804
- /* @__PURE__ */ e.jsxs(b, { children: [
813
+ /* @__PURE__ */ e.jsxs(w, { children: [
805
814
  /* @__PURE__ */ e.jsx("strong", { children: "Sensor Locations:" }),
806
815
  " ",
807
816
  t.sensorLocations.length
808
817
  ] }),
809
- /* @__PURE__ */ e.jsxs(b, { children: [
818
+ /* @__PURE__ */ e.jsxs(w, { children: [
810
819
  /* @__PURE__ */ e.jsx("strong", { children: "Thresholds:" }),
811
820
  " ",
812
821
  t.thresholds.length
813
822
  ] }),
814
- /* @__PURE__ */ e.jsxs(b, { children: [
823
+ /* @__PURE__ */ e.jsxs(w, { children: [
815
824
  /* @__PURE__ */ e.jsx("strong", { children: "Use Cases:" }),
816
825
  " ",
817
- t.useCases.map((S) => S.name).join(", ") || "None"
826
+ t.useCases.map((A) => A.name).join(", ") || "None"
818
827
  ] })
819
828
  ]
820
829
  }
@@ -823,7 +832,7 @@ const Ht = ({
823
832
  },
824
833
  t.id
825
834
  )),
826
- M.length > 1 && /* @__PURE__ */ e.jsx(
835
+ x.length > 1 && /* @__PURE__ */ e.jsx(
827
836
  J,
828
837
  {
829
838
  w: "100%",
@@ -832,266 +841,266 @@ const Ht = ({
832
841
  borderRadius: "md",
833
842
  border: "1px solid",
834
843
  borderColor: "blue.200",
835
- children: /* @__PURE__ */ e.jsxs(b, { fontSize: "sm", fontWeight: "medium", color: "blue.800", children: [
844
+ children: /* @__PURE__ */ e.jsxs(w, { fontSize: "sm", fontWeight: "medium", color: "blue.800", children: [
836
845
  "Total: ",
837
- M.length,
846
+ x.length,
838
847
  " activities will be",
839
848
  " ",
840
- a === "copy" ? "copied" : "converted"
849
+ l === "copy" ? "copied" : "converted"
841
850
  ] })
842
851
  }
843
852
  )
844
853
  ] })
845
854
  ] }),
846
- !c && /* @__PURE__ */ e.jsxs(pe, { spacing: 4, justifyContent: "flex-end", children: [
855
+ !a && /* @__PURE__ */ e.jsxs(pe, { spacing: 4, justifyContent: "flex-end", children: [
847
856
  /* @__PURE__ */ e.jsx(
848
857
  X,
849
858
  {
850
859
  variant: "outline",
851
- onClick: k,
852
- isDisabled: r,
860
+ onClick: R,
861
+ isDisabled: i,
853
862
  children: "Cancel"
854
863
  }
855
864
  ),
856
865
  /* @__PURE__ */ e.jsxs(
857
866
  X,
858
867
  {
859
- colorScheme: a === "copy" ? "blue" : "green",
868
+ colorScheme: l === "copy" ? "blue" : "green",
860
869
  onClick: Y,
861
- isDisabled: M.length === 0 || r,
862
- isLoading: r,
863
- loadingText: `${a === "copy" ? "Copying" : "Converting"}...`,
870
+ isDisabled: x.length === 0 || i,
871
+ isLoading: i,
872
+ loadingText: `${l === "copy" ? "Copying" : "Converting"}...`,
864
873
  children: [
865
- a === "copy" ? "Copy" : "Convert",
874
+ l === "copy" ? "Copy" : "Convert",
866
875
  " ",
867
- M.length === 1 ? "Activity" : `${M.length} Activities`
876
+ x.length === 1 ? "Activity" : `${x.length} Activities`
868
877
  ]
869
878
  }
870
879
  )
871
880
  ] })
872
881
  ] }) });
873
- }, Is = ({
874
- onSave: n,
875
- onCancel: s,
882
+ }, Fn = ({
883
+ onSave: s,
884
+ onCancel: n,
876
885
  onError: o,
877
- hideButtons: c = !1,
878
- setButtonDisabled: i,
879
- setButtonOnClick: l,
880
- quantumOwned: u
886
+ hideButtons: a = !1,
887
+ setButtonDisabled: c,
888
+ setButtonOnClick: r,
889
+ quantumOwned: d
881
890
  }) => {
882
- const x = Ye(), [a, w] = z(""), [I, m] = z([]), [j, f] = z(!1), [r, d] = z("copy"), [p] = le({
883
- query: Ke
891
+ const j = Ye(), [l, S] = z(""), [N, h] = z([]), [f, v] = z(!1), [i, u] = z("copy"), [p] = le({
892
+ query: Ze
884
893
  }), [g] = le({
885
894
  query: Mt,
886
- variables: { groupId: a },
887
- pause: !a
895
+ variables: { groupId: l },
896
+ pause: !l
888
897
  // Only run when group is selected
889
- }), [, y] = oe(st), [, A] = oe(tt), [, C] = oe(Ie), [, T] = oe(
890
- Ve
891
- ), M = D(() => p.data?.groups ? p.data.groups.map(
892
- (t) => _(Ze, t)
893
- ) : [], [p.data]), E = D(() => g.data?.modules ? _(
898
+ }), [, y] = oe(nt), [, T] = oe(tt), [, D] = oe(Ie), [, C] = oe(
899
+ Ke
900
+ ), x = k(() => p.data?.groups ? p.data.groups.map(
901
+ (t) => _(Ve, t)
902
+ ) : [], [p.data]), E = k(() => g.data?.modules ? _(
894
903
  Ce,
895
904
  g.data?.modules
896
- ).map((h) => {
897
- const S = _(
905
+ ).map((m) => {
906
+ const A = _(
898
907
  et,
899
- h.moduleActions
908
+ m.moduleActions
900
909
  );
901
910
  return {
902
- ...h,
903
- moduleActions: S.map((F) => ({
904
- ...F,
905
- action: _(ae, F.action)
911
+ ...m,
912
+ moduleActions: A.map((L) => ({
913
+ ...L,
914
+ action: _(ae, L.action)
906
915
  })),
907
916
  categories: _(
908
917
  de,
909
- h.categories
918
+ m.categories
910
919
  )
911
920
  };
912
- }) : [], [g.data]), O = D(() => E.filter(
913
- (t) => I.includes(t.id)
914
- ), [E, I]), Q = R(
921
+ }) : [], [g.data]), M = k(() => E.filter(
922
+ (t) => N.includes(t.id)
923
+ ), [E, N]), Q = F(
915
924
  (t) => {
916
- const h = t?.value || "";
917
- w(h), m([]);
925
+ const m = t?.value || "";
926
+ S(m), h([]);
918
927
  },
919
928
  []
920
- ), K = R(
929
+ ), Z = F(
921
930
  (t) => {
922
- const h = t.map((S) => S.value);
923
- m(h);
931
+ const m = t.map((A) => A.value);
932
+ h(m);
924
933
  },
925
934
  []
926
- ), Y = R(async () => {
927
- if (f(!0), !O.length) {
928
- f(!1);
935
+ ), Y = F(async () => {
936
+ if (v(!0), !M.length) {
937
+ v(!1);
929
938
  const t = new Error(
930
- `No modules selected for ${r === "convert" ? "converting" : "copying"}`
939
+ `No modules selected for ${i === "convert" ? "converting" : "copying"}`
931
940
  );
932
941
  o?.(t);
933
942
  return;
934
943
  }
935
944
  try {
936
945
  const t = [];
937
- let h = 0;
938
- for (const S of O)
946
+ let m = 0;
947
+ for (const A of M)
939
948
  try {
940
- let F = S.moduleActions.map((L) => L.actionId);
941
- if (u) {
942
- const L = S.moduleActions.map((W) => W.action), U = async (W) => {
943
- if (r === "copy") {
944
- if (W.quantumOwned) return W;
949
+ let L = A.moduleActions.map((I) => I.actionId);
950
+ if (d) {
951
+ const I = A.moduleActions.map((U) => U.action), W = async (U) => {
952
+ if (i === "copy") {
953
+ if (U.quantumOwned) return U;
945
954
  const ue = _(
946
955
  de,
947
- W.categories
956
+ U.categories
948
957
  ), xe = {
949
- ...W,
958
+ ...U,
950
959
  quantumOwned: !0,
951
- thresholds: W.thresholds.map((G) => ({
960
+ thresholds: U.thresholds.map((G) => ({
952
961
  ...G,
953
962
  id: void 0
954
963
  })),
955
964
  categories: ue?.map((G) => G.id),
956
965
  id: void 0
957
- }, N = await C({ fields: xe });
958
- return N.error || !N.data?.createAction ? null : _(
966
+ }, O = await D({ fields: xe });
967
+ return O.error || !O.data?.createAction ? null : _(
959
968
  ae,
960
- N.data.createAction
969
+ O.data.createAction
961
970
  );
962
971
  }
963
- if (W.quantumOwned) return W;
964
- const ge = await T({
965
- id: W.id
972
+ if (U.quantumOwned) return U;
973
+ const ge = await C({
974
+ id: U.id
966
975
  });
967
976
  return ge.error || !ge.data?.convertActionToQuantumOwned ? null : _(
968
977
  ae,
969
978
  ge.data.convertActionToQuantumOwned
970
979
  );
971
980
  };
972
- F = (await Promise.all(
973
- L.map(U)
974
- )).filter((W) => !!W).map((W) => W.id);
981
+ L = (await Promise.all(
982
+ I.map(W)
983
+ )).filter((U) => !!U).map((U) => U.id);
975
984
  }
976
- if (r === "convert") {
977
- const L = {
978
- name: S.name,
979
- description: S.description || void 0,
980
- actions: F,
981
- categories: S.categories.map((H) => H.id),
985
+ if (i === "convert") {
986
+ const I = {
987
+ name: A.name,
988
+ description: A.description || void 0,
989
+ actions: L,
990
+ categories: A.categories.map((H) => H.id),
982
991
  quantumOwned: !0
983
- }, U = await A({
984
- id: S.id,
985
- input: L
992
+ }, W = await T({
993
+ id: A.id,
994
+ input: I
986
995
  });
987
- if (U.error) throw new Error(U.error.message);
988
- if (U.data?.updateModule) {
996
+ if (W.error) throw new Error(W.error.message);
997
+ if (W.data?.updateModule) {
989
998
  const H = _(
990
999
  Ce,
991
- U.data.updateModule
1000
+ W.data.updateModule
992
1001
  );
993
1002
  t.push(H);
994
1003
  }
995
1004
  } else {
996
- const L = {
997
- name: `${S.name} (Copy)`,
998
- description: S.description || void 0,
999
- actions: F,
1000
- categories: S.categories.map((H) => H.id),
1001
- quantumOwned: u
1002
- }, U = await y({ input: L });
1003
- if (U.error) throw new Error(U.error.message);
1004
- if (U.data?.createModule) {
1005
+ const I = {
1006
+ name: `${A.name} (Copy)`,
1007
+ description: A.description || void 0,
1008
+ actions: L,
1009
+ categories: A.categories.map((H) => H.id),
1010
+ quantumOwned: d
1011
+ }, W = await y({ input: I });
1012
+ if (W.error) throw new Error(W.error.message);
1013
+ if (W.data?.createModule) {
1005
1014
  const H = _(
1006
1015
  Ce,
1007
- U.data.createModule
1016
+ W.data.createModule
1008
1017
  );
1009
1018
  t.push(H);
1010
1019
  }
1011
1020
  }
1012
- } catch (F) {
1021
+ } catch (L) {
1013
1022
  console.error(
1014
- `Failed to ${r === "convert" ? "convert" : "copy"} module "${S.name}":`,
1015
- F
1016
- ), h++;
1023
+ `Failed to ${i === "convert" ? "convert" : "copy"} module "${A.name}":`,
1024
+ L
1025
+ ), m++;
1017
1026
  }
1018
1027
  if (t.length > 0) {
1019
- const S = t.length, F = O.length;
1020
- x({
1021
- title: h > 0 ? `Partial ${r === "convert" ? "convert" : "copy"} completed` : `Modules ${r === "convert" ? "converted" : "copied"} successfully`,
1022
- description: h > 0 ? `${S} of ${F} modules ${r === "convert" ? "converted" : "copied"} successfully` : `${S} module${S > 1 ? "s" : ""} ${r === "convert" ? "converted" : "copied"} successfully`,
1023
- status: h > 0 ? "warning" : "success",
1028
+ const A = t.length, L = M.length;
1029
+ j({
1030
+ title: m > 0 ? `Partial ${i === "convert" ? "convert" : "copy"} completed` : `Modules ${i === "convert" ? "converted" : "copied"} successfully`,
1031
+ description: m > 0 ? `${A} of ${L} modules ${i === "convert" ? "converted" : "copied"} successfully` : `${A} module${A > 1 ? "s" : ""} ${i === "convert" ? "converted" : "copied"} successfully`,
1032
+ status: m > 0 ? "warning" : "success",
1024
1033
  duration: 3e3,
1025
1034
  isClosable: !0
1026
- }), t.length > 0 && n?.(), w(""), m([]);
1035
+ }), t.length > 0 && s?.(), S(""), h([]);
1027
1036
  } else
1028
1037
  throw new Error(
1029
- `Failed to ${r === "convert" ? "convert" : "copy"} any modules`
1038
+ `Failed to ${i === "convert" ? "convert" : "copy"} any modules`
1030
1039
  );
1031
1040
  } catch (t) {
1032
- const h = t instanceof Error ? t.message : `Failed to ${r === "convert" ? "convert" : "copy"} modules`;
1033
- x({
1034
- title: r === "convert" ? "Convert failed" : "Copy failed",
1035
- description: h,
1041
+ const m = t instanceof Error ? t.message : `Failed to ${i === "convert" ? "convert" : "copy"} modules`;
1042
+ j({
1043
+ title: i === "convert" ? "Convert failed" : "Copy failed",
1044
+ description: m,
1036
1045
  status: "error",
1037
1046
  duration: 5e3,
1038
1047
  isClosable: !0
1039
- }), o?.(t instanceof Error ? t : new Error(h));
1048
+ }), o?.(t instanceof Error ? t : new Error(m));
1040
1049
  } finally {
1041
- f(!1);
1050
+ v(!1);
1042
1051
  }
1043
1052
  }, [
1044
- O,
1053
+ M,
1045
1054
  y,
1046
- A,
1047
- x,
1048
- n,
1055
+ T,
1056
+ j,
1057
+ s,
1049
1058
  o,
1050
- u,
1059
+ d,
1060
+ D,
1051
1061
  C,
1052
- T,
1053
- r
1054
- ]), k = R(() => {
1055
- w(""), m([]), d("copy"), s?.();
1056
- }, [s]);
1057
- se(() => {
1058
- i && i({
1062
+ i
1063
+ ]), R = F(() => {
1064
+ S(""), h([]), u("copy"), n?.();
1065
+ }, [n]);
1066
+ ne(() => {
1067
+ c && c({
1059
1068
  cancelButton: !1,
1060
- saveButton: O.length === 0 || j
1069
+ saveButton: M.length === 0 || f
1061
1070
  });
1062
- }, [O.length, j, i]), se(() => {
1063
- l && l({
1064
- cancelButton: k,
1071
+ }, [M.length, f, c]), ne(() => {
1072
+ r && r({
1073
+ cancelButton: R,
1065
1074
  saveButton: Y
1066
1075
  });
1067
- }, [l, k, Y]);
1068
- const V = D(() => M.map((t) => ({
1076
+ }, [r, R, Y]);
1077
+ const K = k(() => x.map((t) => ({
1069
1078
  value: t.id,
1070
1079
  label: t.name
1071
- })), [M]), v = D(() => E.filter((t) => r === "copy" ? !0 : !t.quantumOwned).map((t) => ({
1080
+ })), [x]), b = k(() => E.filter((t) => i === "copy" ? !0 : !t.quantumOwned).map((t) => ({
1072
1081
  value: t.id,
1073
1082
  label: t.name,
1074
1083
  // Add custom data to identify quantum-owned modules
1075
1084
  isQuantumOwned: t.quantumOwned
1076
- })), [E, r]), $ = p.fetching, q = g.fetching;
1085
+ })), [E, i]), P = p.fetching, q = g.fetching;
1077
1086
  return /* @__PURE__ */ e.jsx(J, { children: /* @__PURE__ */ e.jsxs(ee, { spacing: 6, align: "stretch", children: [
1078
- u && /* @__PURE__ */ e.jsxs(B, { children: [
1087
+ d && /* @__PURE__ */ e.jsxs(B, { children: [
1079
1088
  /* @__PURE__ */ e.jsx(re, { children: "Operation Mode" }),
1080
1089
  /* @__PURE__ */ e.jsx(
1081
1090
  Je,
1082
1091
  {
1083
- value: r,
1092
+ value: i,
1084
1093
  onChange: (t) => {
1085
- d(t), m([]);
1094
+ u(t), h([]);
1086
1095
  },
1087
1096
  children: /* @__PURE__ */ e.jsxs(te, { spacing: 6, children: [
1088
- /* @__PURE__ */ e.jsx(Te, { value: "copy", colorScheme: "blue", children: /* @__PURE__ */ e.jsxs(ee, { align: "start", spacing: 1, children: [
1089
- /* @__PURE__ */ e.jsx(b, { fontWeight: "medium", children: "Copy Modules" }),
1090
- /* @__PURE__ */ e.jsx(b, { fontSize: "sm", color: "gray.600", children: "Create new modules based on selected ones" })
1097
+ /* @__PURE__ */ e.jsx(Ae, { value: "copy", colorScheme: "blue", children: /* @__PURE__ */ e.jsxs(ee, { align: "start", spacing: 1, children: [
1098
+ /* @__PURE__ */ e.jsx(w, { fontWeight: "medium", children: "Copy Modules" }),
1099
+ /* @__PURE__ */ e.jsx(w, { fontSize: "sm", color: "gray.600", children: "Create new modules based on selected ones" })
1091
1100
  ] }) }),
1092
- /* @__PURE__ */ e.jsx(Te, { value: "convert", colorScheme: "green", children: /* @__PURE__ */ e.jsxs(ee, { align: "start", spacing: 1, children: [
1093
- /* @__PURE__ */ e.jsx(b, { fontWeight: "medium", children: "Convert to Quantum Owned" }),
1094
- /* @__PURE__ */ e.jsx(b, { fontSize: "sm", color: "gray.600", children: "Convert existing modules to quantum-owned" })
1101
+ /* @__PURE__ */ e.jsx(Ae, { value: "convert", colorScheme: "green", children: /* @__PURE__ */ e.jsxs(ee, { align: "start", spacing: 1, children: [
1102
+ /* @__PURE__ */ e.jsx(w, { fontWeight: "medium", children: "Convert to Quantum Owned" }),
1103
+ /* @__PURE__ */ e.jsx(w, { fontSize: "sm", color: "gray.600", children: "Convert existing modules to quantum-owned" })
1095
1104
  ] }) })
1096
1105
  ] })
1097
1106
  }
@@ -1100,67 +1109,67 @@ const Ht = ({
1100
1109
  /* @__PURE__ */ e.jsxs(B, { children: [
1101
1110
  /* @__PURE__ */ e.jsx(re, { children: "Select Source Group" }),
1102
1111
  /* @__PURE__ */ e.jsx(
1103
- ne,
1112
+ se,
1104
1113
  {
1105
1114
  placeholder: "Choose a group...",
1106
- options: V,
1107
- value: V.find((t) => t.value === a) || null,
1115
+ options: K,
1116
+ value: K.find((t) => t.value === l) || null,
1108
1117
  onChange: Q,
1109
- isLoading: $,
1110
- isDisabled: $,
1118
+ isLoading: P,
1119
+ isDisabled: P,
1111
1120
  isClearable: !0
1112
1121
  }
1113
1122
  ),
1114
- p.error && /* @__PURE__ */ e.jsxs(Ae, { status: "error", mt: 2, children: [
1123
+ p.error && /* @__PURE__ */ e.jsxs(Te, { status: "error", mt: 2, children: [
1115
1124
  /* @__PURE__ */ e.jsx(Me, {}),
1116
- /* @__PURE__ */ e.jsxs(b, { fontSize: "sm", children: [
1125
+ /* @__PURE__ */ e.jsxs(w, { fontSize: "sm", children: [
1117
1126
  "Failed to load groups: ",
1118
1127
  p.error.message
1119
1128
  ] })
1120
1129
  ] })
1121
1130
  ] }),
1122
- a && /* @__PURE__ */ e.jsxs(B, { children: [
1123
- /* @__PURE__ */ e.jsx(re, { children: r === "convert" ? "Select Module to Convert" : "Select Module to Copy" }),
1131
+ l && /* @__PURE__ */ e.jsxs(B, { children: [
1132
+ /* @__PURE__ */ e.jsx(re, { children: i === "convert" ? "Select Module to Convert" : "Select Module to Copy" }),
1124
1133
  q ? /* @__PURE__ */ e.jsxs(te, { children: [
1125
1134
  /* @__PURE__ */ e.jsx(Xe, { size: "sm" }),
1126
- /* @__PURE__ */ e.jsx(b, { fontSize: "sm", color: "gray.600", children: "Loading modules..." })
1135
+ /* @__PURE__ */ e.jsx(w, { fontSize: "sm", color: "gray.600", children: "Loading modules..." })
1127
1136
  ] }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1128
1137
  /* @__PURE__ */ e.jsx(
1129
- ne,
1138
+ se,
1130
1139
  {
1131
- placeholder: r === "convert" ? "Choose modules to convert..." : "Choose modules to copy...",
1132
- options: v,
1133
- value: v.filter(
1134
- (t) => I.includes(t.value)
1140
+ placeholder: i === "convert" ? "Choose modules to convert..." : "Choose modules to copy...",
1141
+ options: b,
1142
+ value: b.filter(
1143
+ (t) => N.includes(t.value)
1135
1144
  ),
1136
- onChange: K,
1137
- isDisabled: v.length === 0,
1145
+ onChange: Z,
1146
+ isDisabled: b.length === 0,
1138
1147
  isClearable: !0,
1139
1148
  isMulti: !0,
1140
1149
  closeMenuOnSelect: !1,
1141
- formatOptionLabel: (t, { context: h }) => /* @__PURE__ */ e.jsxs(te, { justify: "space-between", w: "100%", children: [
1150
+ formatOptionLabel: (t, { context: m }) => /* @__PURE__ */ e.jsxs(te, { justify: "space-between", w: "100%", children: [
1142
1151
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
1143
- /* @__PURE__ */ e.jsx(b, { children: t.label }),
1144
- h === "value" && t.isQuantumOwned && /* @__PURE__ */ e.jsx(b, { color: "blue", fontSize: "xs", children: "(Quantum Owned)" })
1152
+ /* @__PURE__ */ e.jsx(w, { children: t.label }),
1153
+ m === "value" && t.isQuantumOwned && /* @__PURE__ */ e.jsx(w, { color: "blue", fontSize: "xs", children: "(Quantum Owned)" })
1145
1154
  ] }),
1146
- t.isQuantumOwned && h === "menu" && /* @__PURE__ */ e.jsx(fe, { size: "sm", colorScheme: "blue", variant: "solid", children: "Quantum Owned" })
1155
+ t.isQuantumOwned && m === "menu" && /* @__PURE__ */ e.jsx(fe, { size: "sm", colorScheme: "blue", variant: "solid", children: "Quantum Owned" })
1147
1156
  ] })
1148
1157
  }
1149
1158
  ),
1150
- v.length === 0 && /* @__PURE__ */ e.jsx(b, { fontSize: "sm", color: "gray.500", mt: 2, children: "No modules found in this group" })
1159
+ b.length === 0 && /* @__PURE__ */ e.jsx(w, { fontSize: "sm", color: "gray.500", mt: 2, children: "No modules found in this group" })
1151
1160
  ] }),
1152
- g.error && /* @__PURE__ */ e.jsxs(Ae, { status: "error", mt: 2, children: [
1161
+ g.error && /* @__PURE__ */ e.jsxs(Te, { status: "error", mt: 2, children: [
1153
1162
  /* @__PURE__ */ e.jsx(Me, {}),
1154
- /* @__PURE__ */ e.jsxs(b, { fontSize: "sm", children: [
1163
+ /* @__PURE__ */ e.jsxs(w, { fontSize: "sm", children: [
1155
1164
  "Failed to load modules: ",
1156
1165
  g.error.message
1157
1166
  ] })
1158
1167
  ] })
1159
1168
  ] }),
1160
- O.length > 0 && /* @__PURE__ */ e.jsxs(J, { p: 4, bg: "gray.50", borderRadius: "md", children: [
1161
- /* @__PURE__ */ e.jsx(b, { fontWeight: "semibold", mb: 3, children: O.length === 1 ? `Module to ${r === "copy" ? "Copy" : "Convert"}` : `${O.length} Modules to ${r === "copy" ? "Copy" : "Convert"}` }),
1169
+ M.length > 0 && /* @__PURE__ */ e.jsxs(J, { p: 4, bg: "gray.50", borderRadius: "md", children: [
1170
+ /* @__PURE__ */ e.jsx(w, { fontWeight: "semibold", mb: 3, children: M.length === 1 ? `Module to ${i === "copy" ? "Copy" : "Convert"}` : `${M.length} Modules to ${i === "copy" ? "Copy" : "Convert"}` }),
1162
1171
  /* @__PURE__ */ e.jsxs(ee, { align: "start", spacing: 3, children: [
1163
- O.map((t, h) => /* @__PURE__ */ e.jsxs(
1172
+ M.map((t, m) => /* @__PURE__ */ e.jsxs(
1164
1173
  J,
1165
1174
  {
1166
1175
  w: "100%",
@@ -1171,8 +1180,8 @@ const Ht = ({
1171
1180
  borderColor: "gray.200",
1172
1181
  children: [
1173
1182
  /* @__PURE__ */ e.jsxs(te, { justify: "space-between", align: "start", mb: 2, children: [
1174
- /* @__PURE__ */ e.jsxs(b, { fontWeight: "medium", fontSize: "sm", children: [
1175
- h + 1,
1183
+ /* @__PURE__ */ e.jsxs(w, { fontWeight: "medium", fontSize: "sm", children: [
1184
+ m + 1,
1176
1185
  ". ",
1177
1186
  t.name
1178
1187
  ] }),
@@ -1186,20 +1195,20 @@ const Ht = ({
1186
1195
  fontSize: "sm",
1187
1196
  color: "gray.600",
1188
1197
  children: [
1189
- t.description && /* @__PURE__ */ e.jsxs(b, { children: [
1198
+ t.description && /* @__PURE__ */ e.jsxs(w, { children: [
1190
1199
  /* @__PURE__ */ e.jsx("strong", { children: "Description:" }),
1191
1200
  " ",
1192
1201
  t.description
1193
1202
  ] }),
1194
- /* @__PURE__ */ e.jsxs(b, { children: [
1203
+ /* @__PURE__ */ e.jsxs(w, { children: [
1195
1204
  /* @__PURE__ */ e.jsx("strong", { children: "Actions:" }),
1196
1205
  " ",
1197
1206
  t.moduleActions.length
1198
1207
  ] }),
1199
- /* @__PURE__ */ e.jsxs(b, { children: [
1208
+ /* @__PURE__ */ e.jsxs(w, { children: [
1200
1209
  /* @__PURE__ */ e.jsx("strong", { children: "Categories:" }),
1201
1210
  " ",
1202
- t.categories.map((S) => S.name).join(", ") || "None"
1211
+ t.categories.map((A) => A.name).join(", ") || "None"
1203
1212
  ] })
1204
1213
  ]
1205
1214
  }
@@ -1208,7 +1217,7 @@ const Ht = ({
1208
1217
  },
1209
1218
  t.id
1210
1219
  )),
1211
- O.length > 1 && /* @__PURE__ */ e.jsx(
1220
+ M.length > 1 && /* @__PURE__ */ e.jsx(
1212
1221
  J,
1213
1222
  {
1214
1223
  w: "100%",
@@ -1217,16 +1226,16 @@ const Ht = ({
1217
1226
  borderRadius: "md",
1218
1227
  border: "1px solid",
1219
1228
  borderColor: "blue.200",
1220
- children: /* @__PURE__ */ e.jsxs(b, { fontSize: "sm", fontWeight: "medium", color: "blue.800", children: [
1229
+ children: /* @__PURE__ */ e.jsxs(w, { fontSize: "sm", fontWeight: "medium", color: "blue.800", children: [
1221
1230
  "Total: ",
1222
- O.length,
1231
+ M.length,
1223
1232
  " modules will be",
1224
1233
  " ",
1225
- r === "copy" ? "copied" : "converted"
1234
+ i === "copy" ? "copied" : "converted"
1226
1235
  ] })
1227
1236
  }
1228
1237
  ),
1229
- u && O.filter((t) => t.moduleActions.some((h) => !h.action.quantumOwned)).length > 0 && /* @__PURE__ */ e.jsx(
1238
+ d && M.filter((t) => t.moduleActions.some((m) => !m.action.quantumOwned)).length > 0 && /* @__PURE__ */ e.jsx(
1230
1239
  J,
1231
1240
  {
1232
1241
  p: 2,
@@ -1234,105 +1243,105 @@ const Ht = ({
1234
1243
  borderRadius: "md",
1235
1244
  border: "1px solid",
1236
1245
  borderColor: "yellow.200",
1237
- children: /* @__PURE__ */ e.jsx(b, { fontSize: "sm", fontWeight: "medium", color: "yellow.800", children: r === "convert" ? "Converting Modules will convert non QM-Owned Actions to QM-Owned" : "Copying Modules with Non QM-Owned Actions will create corresponding QM-Owned Actions" })
1246
+ children: /* @__PURE__ */ e.jsx(w, { fontSize: "sm", fontWeight: "medium", color: "yellow.800", children: i === "convert" ? "Converting Modules will convert non QM-Owned Actions to QM-Owned" : "Copying Modules with Non QM-Owned Actions will create corresponding QM-Owned Actions" })
1238
1247
  }
1239
1248
  )
1240
1249
  ] })
1241
1250
  ] }),
1242
- !c && /* @__PURE__ */ e.jsxs(pe, { spacing: 4, justifyContent: "flex-end", children: [
1251
+ !a && /* @__PURE__ */ e.jsxs(pe, { spacing: 4, justifyContent: "flex-end", children: [
1243
1252
  /* @__PURE__ */ e.jsx(
1244
1253
  X,
1245
1254
  {
1246
1255
  variant: "outline",
1247
- onClick: k,
1248
- isDisabled: j,
1256
+ onClick: R,
1257
+ isDisabled: f,
1249
1258
  children: "Cancel"
1250
1259
  }
1251
1260
  ),
1252
1261
  /* @__PURE__ */ e.jsxs(
1253
1262
  X,
1254
1263
  {
1255
- colorScheme: r === "copy" ? "blue" : "green",
1264
+ colorScheme: i === "copy" ? "blue" : "green",
1256
1265
  onClick: Y,
1257
- isDisabled: O.length === 0 || j,
1258
- isLoading: j,
1259
- loadingText: `${r === "copy" ? "Copying" : "Converting"}...`,
1266
+ isDisabled: M.length === 0 || f,
1267
+ isLoading: f,
1268
+ loadingText: `${i === "copy" ? "Copying" : "Converting"}...`,
1260
1269
  children: [
1261
- r === "copy" ? "Copy" : "Convert",
1270
+ i === "copy" ? "Copy" : "Convert",
1262
1271
  " ",
1263
- O.length === 1 ? "Module" : `${O.length} Modules`
1272
+ M.length === 1 ? "Module" : `${M.length} Modules`
1264
1273
  ]
1265
1274
  }
1266
1275
  )
1267
1276
  ] })
1268
1277
  ] }) });
1269
- }, ns = ({
1270
- name: n,
1271
- setName: s,
1278
+ }, on = ({
1279
+ name: s,
1280
+ setName: n,
1272
1281
  actions: o,
1273
- selectedActionIds: c,
1274
- setSelectedActionIds: i,
1275
- availableCategories: l,
1276
- selectedCategoryIds: u,
1277
- setSelectedCategoryIds: x,
1278
- description: a,
1279
- setDescription: w,
1280
- ...I
1282
+ selectedActionIds: a,
1283
+ setSelectedActionIds: c,
1284
+ availableCategories: r,
1285
+ selectedCategoryIds: d,
1286
+ setSelectedCategoryIds: j,
1287
+ description: l,
1288
+ setDescription: S,
1289
+ ...N
1281
1290
  }) => {
1282
- const m = mt(), j = D(() => o.map((y) => ({
1291
+ const h = mt(), f = k(() => o.map((y) => ({
1283
1292
  ...y,
1284
- selected: c.includes(y.id)
1285
- })), [o, c]), f = D(() => o.reduce((y, A) => (y[A.id] = A, y), {}), [o]), r = D(
1286
- () => c.map((y) => f[y]),
1287
- [j, c]
1288
- ), d = R(
1289
- (y, A) => {
1290
- i(A ? [...c, y.id] : c.filter((C) => C !== y.id));
1293
+ selected: a.includes(y.id)
1294
+ })), [o, a]), v = k(() => o.reduce((y, T) => (y[T.id] = T, y), {}), [o]), i = k(
1295
+ () => a.map((y) => v[y]),
1296
+ [f, a]
1297
+ ), u = F(
1298
+ (y, T) => {
1299
+ c(T ? [...a, y.id] : a.filter((D) => D !== y.id));
1291
1300
  },
1292
- [c, i]
1293
- ), p = R(
1301
+ [a, c]
1302
+ ), p = F(
1294
1303
  (y) => {
1295
- s(y.target.value);
1304
+ n(y.target.value);
1296
1305
  },
1297
- [s]
1298
- ), g = R(
1306
+ [n]
1307
+ ), g = F(
1299
1308
  (y) => {
1300
- w?.(y.target.value);
1309
+ S?.(y.target.value);
1301
1310
  },
1302
- [w]
1311
+ [S]
1303
1312
  );
1304
- return /* @__PURE__ */ e.jsxs(J, { ...I, children: [
1313
+ return /* @__PURE__ */ e.jsxs(J, { ...N, children: [
1305
1314
  /* @__PURE__ */ e.jsxs(te, { gap: "2rem", children: [
1306
- /* @__PURE__ */ e.jsx(os, { name: n ?? "", onInputChange: p }),
1315
+ /* @__PURE__ */ e.jsx(rn, { name: s ?? "", onInputChange: p }),
1307
1316
  /* @__PURE__ */ e.jsx(
1308
- rs,
1317
+ ln,
1309
1318
  {
1310
- availableCategories: l,
1311
- value: u,
1312
- onChange: x
1319
+ availableCategories: r,
1320
+ value: d,
1321
+ onChange: j
1313
1322
  }
1314
1323
  )
1315
1324
  ] }),
1316
1325
  /* @__PURE__ */ e.jsx(
1317
- is,
1326
+ an,
1318
1327
  {
1319
- description: a ?? "",
1328
+ description: l ?? "",
1320
1329
  onInputChange: g
1321
1330
  }
1322
1331
  ),
1323
1332
  /* @__PURE__ */ e.jsx(
1324
- ls,
1333
+ cn,
1325
1334
  {
1326
- value: r,
1327
- onChange: i,
1328
- onAdjustActivities: () => m.onOpen()
1335
+ value: i,
1336
+ onChange: c,
1337
+ onAdjustActivities: () => h.onOpen()
1329
1338
  }
1330
1339
  ),
1331
1340
  /* @__PURE__ */ e.jsxs(
1332
1341
  pt,
1333
1342
  {
1334
- isOpen: m.isOpen,
1335
- onClose: m.onClose,
1343
+ isOpen: h.isOpen,
1344
+ onClose: h.onClose,
1336
1345
  size: "6xl",
1337
1346
  children: [
1338
1347
  /* @__PURE__ */ e.jsx(gt, {}),
@@ -1340,10 +1349,10 @@ const Ht = ({
1340
1349
  /* @__PURE__ */ e.jsx(jt, { children: "Select Activities" }),
1341
1350
  /* @__PURE__ */ e.jsx(ft, {}),
1342
1351
  /* @__PURE__ */ e.jsx(vt, { children: /* @__PURE__ */ e.jsx(
1343
- ss,
1352
+ sn,
1344
1353
  {
1345
- actions: j,
1346
- onSelected: d,
1354
+ actions: f,
1355
+ onSelected: u,
1347
1356
  disableCreate: !0,
1348
1357
  disableDelete: !0,
1349
1358
  tableProps: {
@@ -1356,8 +1365,8 @@ const Ht = ({
1356
1365
  X,
1357
1366
  {
1358
1367
  colorScheme: "blue",
1359
- onClick: m.onClose,
1360
- isDisabled: c.length === 0,
1368
+ onClick: h.onClose,
1369
+ isDisabled: a.length === 0,
1361
1370
  children: "Done"
1362
1371
  }
1363
1372
  ) })
@@ -1366,92 +1375,92 @@ const Ht = ({
1366
1375
  }
1367
1376
  )
1368
1377
  ] });
1369
- }, os = Oe(
1378
+ }, rn = Oe(
1370
1379
  ({
1371
- name: n,
1372
- onInputChange: s
1380
+ name: s,
1381
+ onInputChange: n
1373
1382
  }) => /* @__PURE__ */ e.jsxs(B, { mb: 4, children: [
1374
1383
  /* @__PURE__ */ e.jsx(re, { children: "Module Name" }),
1375
1384
  /* @__PURE__ */ e.jsx(
1376
1385
  je,
1377
1386
  {
1378
1387
  placeholder: "i.e. ACL RTP Test Battery",
1379
- value: n,
1380
- onChange: s,
1388
+ value: s,
1389
+ onChange: n,
1381
1390
  isRequired: !0
1382
1391
  }
1383
1392
  )
1384
1393
  ] })
1385
- ), rs = Oe(
1394
+ ), ln = Oe(
1386
1395
  ({
1387
- availableCategories: n,
1388
- value: s,
1396
+ availableCategories: s,
1397
+ value: n,
1389
1398
  onChange: o
1390
1399
  }) => {
1391
- const c = D(() => [
1392
- ...n,
1400
+ const a = k(() => [
1401
+ ...s,
1393
1402
  {
1394
1403
  id: "other",
1395
1404
  name: "Other"
1396
1405
  }
1397
- ], [n]), i = D(() => c.map((l) => ({
1398
- value: l.id,
1399
- label: l.name
1400
- })), [c]);
1406
+ ], [s]), c = k(() => a.map((r) => ({
1407
+ value: r.id,
1408
+ label: r.name
1409
+ })), [a]);
1401
1410
  return /* @__PURE__ */ e.jsxs(B, { mb: 4, children: [
1402
1411
  /* @__PURE__ */ e.jsx(re, { children: "Module Category" }),
1403
1412
  /* @__PURE__ */ e.jsx(
1404
- ne,
1413
+ se,
1405
1414
  {
1406
- isDisabled: n.length === 0,
1415
+ isDisabled: s.length === 0,
1407
1416
  isClearable: !0,
1408
- options: i,
1409
- value: c.filter((l) => s.includes(l.id)).map((l) => ({
1410
- value: l.id,
1411
- label: l.name
1417
+ options: c,
1418
+ value: a.filter((r) => n.includes(r.id)).map((r) => ({
1419
+ value: r.id,
1420
+ label: r.name
1412
1421
  })),
1413
- onChange: (l) => o(l ? [l.value] : []),
1422
+ onChange: (r) => o(r ? [r.value] : []),
1414
1423
  placeholder: "Select category"
1415
1424
  }
1416
1425
  )
1417
1426
  ] });
1418
1427
  }
1419
- ), is = Oe(
1428
+ ), an = Oe(
1420
1429
  ({
1421
- description: n,
1422
- onInputChange: s
1430
+ description: s,
1431
+ onInputChange: n
1423
1432
  }) => /* @__PURE__ */ e.jsxs(B, { mb: 4, children: [
1424
1433
  /* @__PURE__ */ e.jsx(re, { children: /* @__PURE__ */ e.jsxs("span", { children: [
1425
1434
  "Description",
1426
- /* @__PURE__ */ e.jsx(b, { fontSize: "sm", color: "gray.500", children: "Briefly describe the objective of this module. Max 40 words." })
1435
+ /* @__PURE__ */ e.jsx(w, { fontSize: "sm", color: "gray.500", children: "Briefly describe the objective of this module. Max 40 words." })
1427
1436
  ] }) }),
1428
1437
  /* @__PURE__ */ e.jsx(
1429
1438
  je,
1430
1439
  {
1431
1440
  placeholder: "i.e. Assess readiness to return to play post-ACL reconstruction",
1432
- value: n,
1433
- onChange: s
1441
+ value: s,
1442
+ onChange: n
1434
1443
  }
1435
1444
  )
1436
1445
  ] })
1437
- ), ls = Oe(
1446
+ ), cn = Oe(
1438
1447
  ({
1439
- value: n,
1440
- onChange: s,
1448
+ value: s,
1449
+ onChange: n,
1441
1450
  onAdjustActivities: o
1442
1451
  }) => {
1443
- const c = D(
1444
- () => n.map((i) => ({
1445
- id: i.id,
1446
- name: i.name
1452
+ const a = k(
1453
+ () => s.map((c) => ({
1454
+ id: c.id,
1455
+ name: c.name
1447
1456
  })),
1448
- [n]
1457
+ [s]
1449
1458
  );
1450
1459
  return /* @__PURE__ */ e.jsxs(B, { mb: 4, children: [
1451
1460
  /* @__PURE__ */ e.jsxs(te, { justifyContent: "space-between", children: [
1452
1461
  /* @__PURE__ */ e.jsx(re, { children: /* @__PURE__ */ e.jsxs("span", { children: [
1453
1462
  "Activities",
1454
- /* @__PURE__ */ e.jsx(b, { fontSize: "sm", color: "gray.500", children: "Drag and drop to reorder the activities in this module." })
1463
+ /* @__PURE__ */ e.jsx(w, { fontSize: "sm", color: "gray.500", children: "Drag and drop to reorder the activities in this module." })
1455
1464
  ] }) }),
1456
1465
  /* @__PURE__ */ e.jsx(
1457
1466
  X,
@@ -1464,7 +1473,7 @@ const Ht = ({
1464
1473
  }
1465
1474
  )
1466
1475
  ] }),
1467
- c.length === 0 ? /* @__PURE__ */ e.jsx(ee, { children: /* @__PURE__ */ e.jsxs(b, { color: "gray.500", fontSize: "lg", mb: "4rem", mt: "4rem", children: [
1476
+ a.length === 0 ? /* @__PURE__ */ e.jsx(ee, { children: /* @__PURE__ */ e.jsxs(w, { color: "gray.500", fontSize: "lg", mb: "4rem", mt: "4rem", children: [
1468
1477
  "No activities selected for this module.",
1469
1478
  /* @__PURE__ */ e.jsx(
1470
1479
  X,
@@ -1480,81 +1489,81 @@ const Ht = ({
1480
1489
  ] }) }) : /* @__PURE__ */ e.jsx(
1481
1490
  Yt,
1482
1491
  {
1483
- value: c,
1484
- onChange: (i) => {
1485
- const l = i(c);
1486
- s(l.map((u) => u.id));
1492
+ value: a,
1493
+ onChange: (c) => {
1494
+ const r = c(a);
1495
+ n(r.map((d) => d.id));
1487
1496
  }
1488
1497
  }
1489
1498
  )
1490
1499
  ] });
1491
1500
  }
1492
- ), as = ({
1493
- value: n,
1494
- onChange: s,
1501
+ ), dn = ({
1502
+ value: s,
1503
+ onChange: n,
1495
1504
  forceKind: o,
1496
- disableRemove: c,
1497
- disableKind: i,
1498
- lockRanges: l,
1499
- ...u
1505
+ disableRemove: a,
1506
+ disableKind: c,
1507
+ lockRanges: r,
1508
+ ...d
1500
1509
  }) => {
1501
- const x = D(() => [...n].sort((m, j) => {
1502
- const f = $e.indexOf(m.plane), r = $e.indexOf(j.plane);
1503
- return f - r;
1504
- }), [n]), a = R((m) => "segment" in m.id ? ot(m.id.segment, m.plane, !0) ?? "Unknown" : rt(m.id.joint, m.plane, !0) ?? "Unknown", []), w = R(
1505
- (m, j) => {
1506
- const f = x.findIndex(
1507
- (d) => d.id === j.id && d.plane === j.plane
1510
+ const j = k(() => [...s].sort((h, f) => {
1511
+ const v = Pe.indexOf(h.plane), i = Pe.indexOf(f.plane);
1512
+ return v - i;
1513
+ }), [s]), l = F((h) => "segment" in h.id ? ot(h.id.segment, h.plane, !0) ?? "Unknown" : rt(h.id.joint, h.plane, !0) ?? "Unknown", []), S = F(
1514
+ (h, f) => {
1515
+ const v = j.findIndex(
1516
+ (u) => u.id === f.id && u.plane === f.plane
1508
1517
  );
1509
- let r = [...x];
1510
- o && (j = { ...j, kind: o }), r[f] = j, l && (r = r.map((d) => ({
1511
- ...d,
1512
- min: j.min,
1513
- max: j.max
1514
- }))), s(r);
1518
+ let i = [...j];
1519
+ o && (f = { ...f, kind: o }), i[v] = f, r && (i = i.map((u) => ({
1520
+ ...u,
1521
+ min: f.min,
1522
+ max: f.max
1523
+ }))), n(i);
1515
1524
  },
1516
- [s, x, o, l]
1517
- ), I = R(
1518
- (m) => {
1519
- const j = x.filter(
1520
- (f) => f.id !== m.id || f.plane !== m.plane
1525
+ [n, j, o, r]
1526
+ ), N = F(
1527
+ (h) => {
1528
+ const f = j.filter(
1529
+ (v) => v.id !== h.id || v.plane !== h.plane
1521
1530
  );
1522
- s(j);
1531
+ n(f);
1523
1532
  },
1524
- [s, x]
1533
+ [n, j]
1525
1534
  );
1526
- return /* @__PURE__ */ e.jsx(ee, { alignItems: "flex-start", overflowY: "auto", ...u, children: x.map((m, j) => /* @__PURE__ */ e.jsx(
1527
- cs,
1535
+ return /* @__PURE__ */ e.jsx(ee, { alignItems: "flex-start", overflowY: "auto", ...d, children: j.map((h, f) => /* @__PURE__ */ e.jsx(
1536
+ un,
1528
1537
  {
1529
- label: a(m),
1530
- parameter: m,
1531
- onChange: (f) => w(j, f),
1532
- onRemove: c ? void 0 : () => I(m),
1538
+ label: l(h),
1539
+ parameter: h,
1540
+ onChange: (v) => S(f, v),
1541
+ onRemove: a ? void 0 : () => N(h),
1533
1542
  forceKind: o,
1534
- disableKind: i
1543
+ disableKind: c
1535
1544
  },
1536
- `${JSON.stringify(m.id)}-${m.plane}`
1545
+ `${JSON.stringify(h.id)}-${h.plane}`
1537
1546
  )) });
1538
- }, cs = ({
1539
- label: n,
1540
- parameter: s,
1547
+ }, un = ({
1548
+ label: s,
1549
+ parameter: n,
1541
1550
  onChange: o,
1542
- onRemove: c,
1543
- forceKind: i,
1544
- disableKind: l
1551
+ onRemove: a,
1552
+ forceKind: c,
1553
+ disableKind: r
1545
1554
  }) => {
1546
- const u = R(
1547
- (w) => "joint" in s.id ? _t(
1548
- s.id.joint,
1549
- s.plane,
1550
- w < 0 ? -1 : 1
1555
+ const d = F(
1556
+ (S) => "joint" in n.id ? _t(
1557
+ n.id.joint,
1558
+ n.plane,
1559
+ S < 0 ? -1 : 1
1551
1560
  ) : Gt(
1552
- s.id.segment,
1553
- s.plane,
1554
- w < 0 ? -1 : 1
1561
+ n.id.segment,
1562
+ n.plane,
1563
+ S < 0 ? -1 : 1
1555
1564
  ),
1556
- [s]
1557
- ), { min: x, max: a } = "joint" in s.id ? Ut(s.id.joint, s.plane) : { min: -180, max: 180 };
1565
+ [n]
1566
+ ), { min: j, max: l } = "joint" in n.id ? Wt(n.id.joint, n.plane) : { min: -180, max: 180 };
1558
1567
  return /* @__PURE__ */ e.jsxs(
1559
1568
  ee,
1560
1569
  {
@@ -1568,31 +1577,31 @@ const Ht = ({
1568
1577
  children: [
1569
1578
  /* @__PURE__ */ e.jsxs(te, { w: "100%", children: [
1570
1579
  /* @__PURE__ */ e.jsx(
1571
- b,
1580
+ w,
1572
1581
  {
1573
1582
  fontSize: "sm",
1574
1583
  flex: 1,
1575
1584
  textTransform: "capitalize",
1576
1585
  fontWeight: "semibold",
1577
- children: n
1586
+ children: s
1578
1587
  }
1579
1588
  ),
1580
- c && /* @__PURE__ */ e.jsx(
1589
+ a && /* @__PURE__ */ e.jsx(
1581
1590
  bt,
1582
1591
  {
1583
1592
  size: "xs",
1584
1593
  variant: "ghost",
1585
1594
  "aria-label": "delete",
1586
- icon: /* @__PURE__ */ e.jsx(Ue, { as: Tt }),
1587
- onClick: c
1595
+ icon: /* @__PURE__ */ e.jsx(We, { as: At }),
1596
+ onClick: a
1588
1597
  }
1589
1598
  ),
1590
- !i && /* @__PURE__ */ e.jsx(
1599
+ !c && /* @__PURE__ */ e.jsx(
1591
1600
  Xt,
1592
1601
  {
1593
- selectedItem: s?.kind ?? we.Limit,
1594
- onChange: ({ value: w }) => o({ ...s, kind: w }),
1595
- isDisabled: l,
1602
+ selectedItem: n?.kind ?? we.Limit,
1603
+ onChange: ({ value: S }) => o({ ...n, kind: S }),
1604
+ isDisabled: r,
1596
1605
  buttonProps: {
1597
1606
  size: "sm",
1598
1607
  variant: "outline",
@@ -1610,288 +1619,288 @@ const Ht = ({
1610
1619
  )
1611
1620
  ] }),
1612
1621
  /* @__PURE__ */ e.jsx(
1613
- Kt,
1622
+ Zt,
1614
1623
  {
1615
1624
  w: "100%",
1616
1625
  size: "xs",
1617
- min: x,
1618
- max: a,
1626
+ min: j,
1627
+ max: l,
1619
1628
  zeroMarker: !0,
1620
- value: [s.min, s.max],
1621
- onChange: (w) => o({ ...s, min: w[0], max: w[1] }),
1622
- formatValue: (w) => `${Math.abs(w)}°`,
1623
- valueLabel: (w) => u(w) ?? "",
1624
- positiveNegativeLabels: u(0) ? [u(-1) ?? "", u(1) ?? ""] : void 0
1629
+ value: [n.min, n.max],
1630
+ onChange: (S) => o({ ...n, min: S[0], max: S[1] }),
1631
+ formatValue: (S) => `${Math.abs(S)}°`,
1632
+ valueLabel: (S) => d(S) ?? "",
1633
+ positiveNegativeLabels: d(0) ? [d(-1) ?? "", d(1) ?? ""] : void 0
1625
1634
  }
1626
1635
  )
1627
1636
  ]
1628
1637
  }
1629
1638
  );
1630
- }, be = (n, s) => "segment" in n && "segment" in s && n.segment === s.segment || "joint" in n && "joint" in s && n.joint === s.joint, ds = ({
1631
- options: n,
1632
- value: s,
1639
+ }, be = (s, n) => "segment" in s && "segment" in n && s.segment === n.segment || "joint" in s && "joint" in n && s.joint === n.joint, hn = ({
1640
+ options: s,
1641
+ value: n,
1633
1642
  onChange: o,
1634
- forceKind: c,
1635
- singleValue: i,
1636
- singleValueSideless: l,
1637
- editOnly: u,
1638
- disableKind: x,
1639
- maxParameters: a,
1640
- ...w
1643
+ forceKind: a,
1644
+ singleValue: c,
1645
+ singleValueSideless: r,
1646
+ editOnly: d,
1647
+ disableKind: j,
1648
+ maxParameters: l,
1649
+ ...S
1641
1650
  }) => {
1642
- const I = l ? 2 : a, m = D(
1643
- () => n.map((d) => ({
1644
- label: "segment" in d.id ? ot(d.id.segment, d.plane, !0) ?? "Unknown" : rt(d.id.joint, d.plane, !0) ?? "Unknown",
1645
- value: d.id,
1646
- plane: d.plane
1651
+ const N = r ? 2 : l, h = k(
1652
+ () => s.map((u) => ({
1653
+ label: "segment" in u.id ? ot(u.id.segment, u.plane, !0) ?? "Unknown" : rt(u.id.joint, u.plane, !0) ?? "Unknown",
1654
+ value: u.id,
1655
+ plane: u.plane
1647
1656
  })),
1648
- [n]
1649
- ), j = D(() => {
1650
- if (!l || s.length === 0)
1651
- return m;
1652
- const d = s[0];
1653
- return m.filter(
1654
- (p) => ve(p.value) === ve(d.id) && p.plane === d.plane
1657
+ [s]
1658
+ ), f = k(() => {
1659
+ if (!r || n.length === 0)
1660
+ return h;
1661
+ const u = n[0];
1662
+ return h.filter(
1663
+ (p) => ve(p.value) === ve(u.id) && p.plane === u.plane
1655
1664
  );
1656
- }, [m, s, l]), f = D(
1657
- () => m.filter(
1658
- (d) => s.some((p) => be(p.id, d.value) && p.plane === d.plane)
1665
+ }, [h, n, r]), v = k(
1666
+ () => h.filter(
1667
+ (u) => n.some((p) => be(p.id, u.value) && p.plane === u.plane)
1659
1668
  ),
1660
- [m, s]
1661
- ), r = R(
1662
- (d) => {
1663
- const p = d.map((g) => {
1664
- const y = s.find(
1669
+ [h, n]
1670
+ ), i = F(
1671
+ (u) => {
1672
+ const p = u.map((g) => {
1673
+ const y = n.find(
1665
1674
  (E) => be(E.id, g.value) && E.plane === g.plane
1666
- ), A = n.find(
1675
+ ), T = s.find(
1667
1676
  (E) => be(E.id, g.value) && E.plane === g.plane
1668
- ), C = l ? s.find(
1677
+ ), D = r ? n.find(
1669
1678
  (E) => ve(E.id) === ve(g.value) && E.plane === g.plane
1670
- ) : void 0, T = C && !y ? C.min : A && A.min ? A.min : 0, M = C && !y ? C.max : A && A.max ? A.max : 0;
1679
+ ) : void 0, C = D && !y ? D.min : T && T.min ? T.min : 0, x = D && !y ? D.max : T && T.max ? T.max : 0;
1671
1680
  return y ?? {
1672
1681
  id: g.value,
1673
1682
  plane: g.plane,
1674
- min: T,
1675
- max: M,
1676
- kind: c ?? we.Limit
1683
+ min: C,
1684
+ max: x,
1685
+ kind: a ?? we.Limit
1677
1686
  };
1678
1687
  });
1679
1688
  o(p);
1680
1689
  },
1681
- [o, s, n, c, l]
1690
+ [o, n, s, a, r]
1682
1691
  );
1683
- return se(() => {
1684
- const d = s.filter(
1685
- (p) => n.some((g) => be(g.id, p.id) && g.plane === p.plane)
1692
+ return ne(() => {
1693
+ const u = n.filter(
1694
+ (p) => s.some((g) => be(g.id, p.id) && g.plane === p.plane)
1686
1695
  );
1687
- d.length !== s.length && o(d);
1688
- }, [n, o]), /* @__PURE__ */ e.jsxs(J, { ...w, children: [
1696
+ u.length !== n.length && o(u);
1697
+ }, [s, o]), /* @__PURE__ */ e.jsxs(J, { ...S, children: [
1689
1698
  /* @__PURE__ */ e.jsx(
1690
- ne,
1699
+ se,
1691
1700
  {
1692
- isMulti: !i,
1693
- placeholder: s.length ? `${s.length} selected` : "Search...",
1694
- value: f,
1695
- isDisabled: u || f.length >= (I ?? 1 / 0),
1696
- onChange: (d) => Array.isArray(d) ? r([...d]) : r(d !== null ? [d] : []),
1697
- options: j,
1701
+ isMulti: !c,
1702
+ placeholder: n.length ? `${n.length} selected` : "Search...",
1703
+ value: v,
1704
+ isDisabled: d || v.length >= (N ?? 1 / 0),
1705
+ onChange: (u) => Array.isArray(u) ? i([...u]) : i(u !== null ? [u] : []),
1706
+ options: f,
1698
1707
  controlShouldRenderValue: !1
1699
1708
  }
1700
1709
  ),
1701
1710
  /* @__PURE__ */ e.jsx(
1702
- as,
1711
+ dn,
1703
1712
  {
1704
1713
  marginTop: 2,
1705
1714
  maxH: "28rem",
1706
- value: s,
1715
+ value: n,
1707
1716
  onChange: o,
1708
- forceKind: c,
1709
- disableKind: x,
1710
- lockRanges: l
1717
+ forceKind: a,
1718
+ disableKind: j,
1719
+ lockRanges: r
1711
1720
  }
1712
1721
  )
1713
1722
  ] });
1714
- }, it = (n) => {
1715
- switch (n) {
1716
- case P.Thorax:
1723
+ }, it = (s) => {
1724
+ switch (s) {
1725
+ case $.Thorax:
1717
1726
  return "Thorax";
1718
- case P.CenterBack:
1727
+ case $.CenterBack:
1719
1728
  return "Center Back";
1720
- case P.Pelvis:
1729
+ case $.Pelvis:
1721
1730
  return "Pelvis";
1722
- case P.LeftThigh:
1731
+ case $.LeftThigh:
1723
1732
  return "Left Thigh";
1724
- case P.RightThigh:
1733
+ case $.RightThigh:
1725
1734
  return "Right Thigh";
1726
- case P.LeftShank:
1735
+ case $.LeftShank:
1727
1736
  return "Left Shank";
1728
- case P.RightShank:
1737
+ case $.RightShank:
1729
1738
  return "Right Shank";
1730
- case P.LeftFoot:
1739
+ case $.LeftFoot:
1731
1740
  return "Left Foot";
1732
- case P.RightFoot:
1741
+ case $.RightFoot:
1733
1742
  return "Right Foot";
1734
- case P.LeftUpperArm:
1743
+ case $.LeftUpperArm:
1735
1744
  return "Left Upper Arm";
1736
- case P.RightUpperArm:
1745
+ case $.RightUpperArm:
1737
1746
  return "Right Upper Arm";
1738
- case P.LeftForearm:
1747
+ case $.LeftForearm:
1739
1748
  return "Left Forearm";
1740
- case P.RightForearm:
1749
+ case $.RightForearm:
1741
1750
  return "Right Forearm";
1742
- case P.Head:
1751
+ case $.Head:
1743
1752
  return "Head";
1744
1753
  }
1745
- return console.warn(`Unknown sensor location: ${n}`), "Unknown";
1746
- }, us = 6, hs = [
1747
- P.LeftFoot,
1748
- P.LeftShank,
1749
- P.LeftThigh,
1750
- P.Pelvis,
1751
- P.RightFoot,
1752
- P.RightShank,
1753
- P.RightThigh,
1754
- P.Thorax,
1755
- P.CenterBack,
1756
- P.Head
1757
- ], ms = hs.map((n) => ({
1758
- label: it(n),
1759
- value: n
1760
- })), Ge = (n, s) => n.map((o) => ({ label: s ? s(o) : o, value: o })), Ls = ({
1761
- id: n,
1762
- onError: s,
1754
+ return console.warn(`Unknown sensor location: ${s}`), "Unknown";
1755
+ }, mn = 6, pn = [
1756
+ $.LeftFoot,
1757
+ $.LeftShank,
1758
+ $.LeftThigh,
1759
+ $.Pelvis,
1760
+ $.RightFoot,
1761
+ $.RightShank,
1762
+ $.RightThigh,
1763
+ $.Thorax,
1764
+ $.CenterBack,
1765
+ $.Head
1766
+ ], gn = pn.map((s) => ({
1767
+ label: it(s),
1768
+ value: s
1769
+ })), Ge = (s, n) => s.map((o) => ({ label: n ? n(o) : o, value: o })), Rn = ({
1770
+ id: s,
1771
+ onError: n,
1763
1772
  onCancel: o,
1764
- onSave: c,
1765
- hideButtons: i,
1766
- setButtonOnClick: l,
1767
- setButtonDisabled: u,
1768
- quantumOwned: x
1773
+ onSave: a,
1774
+ hideButtons: c,
1775
+ setButtonOnClick: r,
1776
+ setButtonDisabled: d,
1777
+ quantumOwned: j
1769
1778
  }) => {
1770
- const [{ fetching: a }, w] = oe(Ie), [{ fetching: I }, m] = oe(Ot), [{ data: j }] = le({
1779
+ const [{ fetching: l }, S] = oe(Ie), [{ fetching: N }, h] = oe(Ot), [{ data: f }] = le({
1771
1780
  query: Nt,
1772
- variables: { id: n ?? "" },
1773
- pause: !n
1774
- }), f = _(
1781
+ variables: { id: s ?? "" },
1782
+ pause: !s
1783
+ }), v = _(
1775
1784
  ae,
1776
- j?.getActionById
1777
- ), r = a || I, d = !!f && !!n, [p, g] = z(""), [y, A] = z(""), [C, T] = z(""), [M, E] = z(""), [O, Q] = z(), [K, Y] = z([]), [k, V] = z([]), [v, $] = z([]), q = D(
1778
- () => k.map((N) => N.value),
1779
- [k]
1780
- ), t = qt(q), [{ data: h }] = le({
1781
- query: nt
1782
- }), S = D(() => _(
1785
+ f?.getActionById
1786
+ ), i = l || N, u = !!v && !!s, [p, g] = z(""), [y, T] = z(""), [D, C] = z(""), [x, E] = z(""), [M, Q] = z(), [Z, Y] = z([]), [R, K] = z([]), [b, P] = z([]), q = k(
1787
+ () => R.map((O) => O.value),
1788
+ [R]
1789
+ ), t = qt(q), [{ data: m }] = le({
1790
+ query: st
1791
+ }), A = k(() => _(
1783
1792
  de,
1784
- h?.moduleCategories
1793
+ m?.moduleCategories
1785
1794
  )?.map((G) => ({
1786
1795
  label: G.name,
1787
1796
  value: G.id
1788
- })), [h?.moduleCategories]), F = D(
1797
+ })), [m?.moduleCategories]), L = k(
1789
1798
  () => Ge(Object.values(zt), ze),
1790
1799
  []
1791
- ), [L, U] = z([]), H = p.length > 0, [W, ge] = z({});
1792
- se(() => {
1793
- if (f) {
1794
- const N = _(
1800
+ ), [I, W] = z([]), H = p.length > 0, [U, ge] = z({});
1801
+ ne(() => {
1802
+ if (v) {
1803
+ const O = _(
1795
1804
  de,
1796
- f.categories
1805
+ v.categories
1797
1806
  ), G = {
1798
- name: f.name,
1799
- activityType: f.activityType ?? void 0,
1800
- description: f.description || "",
1801
- cameraPlacement: f.cameraPlacement || "",
1802
- videoLink: f.videoLink || "",
1803
- sessionType: f.sessionType.map((Z) => ({
1804
- label: ze(Z),
1805
- value: Z
1807
+ name: v.name,
1808
+ activityType: v.activityType ?? void 0,
1809
+ description: v.description || "",
1810
+ cameraPlacement: v.cameraPlacement || "",
1811
+ videoLink: v.videoLink || "",
1812
+ sessionType: v.sessionType.map((V) => ({
1813
+ label: ze(V),
1814
+ value: V
1806
1815
  })),
1807
- categories: N?.map((Z) => Z.id) || [],
1808
- sensorLocations: f.sensorLocations.map((Z) => ({
1809
- label: it(Z),
1810
- value: Z
1816
+ categories: O?.map((V) => V.id) || [],
1817
+ sensorLocations: v.sensorLocations.map((V) => ({
1818
+ label: it(V),
1819
+ value: V
1811
1820
  })),
1812
- thresholds: Bt(f.thresholds)
1821
+ thresholds: Bt(v.thresholds)
1813
1822
  };
1814
- g(G.name), Q(G.activityType ?? void 0), A(G.description), T(G.cameraPlacement), E(G.videoLink), Y(G.sessionType), $(N?.map((Z) => Z.id) || []), V(G.sensorLocations), U(G.thresholds), ge(G);
1823
+ g(G.name), Q(G.activityType ?? void 0), T(G.description), C(G.cameraPlacement), E(G.videoLink), Y(G.sessionType), P(O?.map((V) => V.id) || []), K(G.sensorLocations), W(G.thresholds), ge(G);
1815
1824
  }
1816
- }, [f]);
1817
- const ue = D(
1818
- () => JSON.stringify(W) !== JSON.stringify({
1825
+ }, [v]);
1826
+ const ue = k(
1827
+ () => JSON.stringify(U) !== JSON.stringify({
1819
1828
  name: p,
1820
1829
  description: y,
1821
- cameraPlacement: C,
1822
- videoLink: M,
1823
- activityType: O,
1824
- sessionType: K.map((N) => N.value),
1825
- categories: v,
1830
+ cameraPlacement: D,
1831
+ videoLink: x,
1832
+ activityType: M,
1833
+ sessionType: Z.map((O) => O.value),
1834
+ categories: b,
1826
1835
  sensorLocations: q,
1827
- thresholds: _e(L)
1836
+ thresholds: _e(I)
1828
1837
  }),
1829
1838
  [
1830
- W,
1839
+ U,
1831
1840
  p,
1832
1841
  q,
1833
1842
  y,
1834
- C,
1843
+ D,
1844
+ x,
1835
1845
  M,
1836
- O,
1837
- K,
1838
- v,
1839
- L
1846
+ Z,
1847
+ b,
1848
+ I
1840
1849
  ]
1841
- ), xe = R(() => {
1842
- const N = {
1850
+ ), xe = F(() => {
1851
+ const O = {
1843
1852
  name: p,
1844
1853
  description: y,
1845
- cameraPlacement: C,
1846
- videoLink: M,
1847
- activityType: O,
1848
- activityKind: Wt(O),
1849
- sessionType: K.map((Z) => Z.value),
1850
- categories: v,
1854
+ cameraPlacement: D,
1855
+ videoLink: x,
1856
+ activityType: M,
1857
+ activityKind: Ut(M),
1858
+ sessionType: Z.map((V) => V.value),
1859
+ categories: b,
1851
1860
  sensorLocations: q,
1852
- thresholds: _e(L),
1861
+ thresholds: _e(I),
1853
1862
  // Backend requires laterality; keep existing default since UI no longer edits it
1854
- laterality: Pt.Either,
1855
- quantumOwned: x
1863
+ laterality: $t.Either,
1864
+ quantumOwned: j
1856
1865
  };
1857
1866
  let G;
1858
- d && n ? G = m({
1859
- id: n,
1860
- fields: N
1861
- }) : G = w({
1862
- fields: N
1863
- }), G.then(({ error: Z }) => {
1864
- Z ? s(Z) : c();
1867
+ u && s ? G = h({
1868
+ id: s,
1869
+ fields: O
1870
+ }) : G = S({
1871
+ fields: O
1872
+ }), G.then(({ error: V }) => {
1873
+ V ? n(V) : a();
1865
1874
  });
1866
1875
  }, [
1867
- x,
1868
- w,
1869
- m,
1870
- n,
1876
+ j,
1877
+ S,
1878
+ h,
1879
+ s,
1871
1880
  p,
1872
1881
  q,
1873
1882
  y,
1874
- C,
1883
+ D,
1884
+ x,
1875
1885
  M,
1876
- O,
1877
- K,
1878
- v,
1879
- d,
1880
- L,
1881
- c,
1882
- s
1886
+ Z,
1887
+ b,
1888
+ u,
1889
+ I,
1890
+ a,
1891
+ n
1883
1892
  ]);
1884
- return se(() => {
1885
- u && u({
1886
- cancelButton: r,
1887
- saveButton: r || !H || !ue
1893
+ return ne(() => {
1894
+ d && d({
1895
+ cancelButton: i,
1896
+ saveButton: i || !H || !ue
1888
1897
  });
1889
- }, [r, u, H, ue]), se(() => {
1890
- l && l({
1898
+ }, [i, d, H, ue]), ne(() => {
1899
+ r && r({
1891
1900
  cancelButton: o,
1892
1901
  saveButton: xe
1893
1902
  });
1894
- }, [l, o, xe]), console.log(H, ue, r, W), /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-2 gap-4 w-full", children: [
1903
+ }, [r, o, xe]), console.log(H, ue, i, U), /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-2 gap-4 w-full", children: [
1895
1904
  /* @__PURE__ */ e.jsxs("div", { className: "col-span-2 lg:col-span-1 flex flex-col gap-4", children: [
1896
1905
  /* @__PURE__ */ e.jsxs(B, { children: [
1897
1906
  /* @__PURE__ */ e.jsx(ie, { children: "Name" }),
@@ -1899,7 +1908,7 @@ const Ht = ({
1899
1908
  je,
1900
1909
  {
1901
1910
  value: p,
1902
- onChange: (N) => g(N.target.value),
1911
+ onChange: (O) => g(O.target.value),
1903
1912
  type: "text",
1904
1913
  placeholder: "i.e. Lunge & Return"
1905
1914
  }
@@ -1908,18 +1917,18 @@ const Ht = ({
1908
1917
  /* @__PURE__ */ e.jsxs(B, { children: [
1909
1918
  /* @__PURE__ */ e.jsx(ie, { children: "Activity Type" }),
1910
1919
  /* @__PURE__ */ e.jsx(
1911
- ne,
1920
+ se,
1912
1921
  {
1913
1922
  isClearable: !0,
1914
1923
  isMulti: !1,
1915
- value: O ? {
1916
- label: Pe(O),
1917
- value: O
1924
+ value: M ? {
1925
+ label: $e(M),
1926
+ value: M
1918
1927
  } : null,
1919
- onChange: (N) => Q(N?.value),
1928
+ onChange: (O) => Q(O?.value),
1920
1929
  options: Ge(
1921
- Object.values($t),
1922
- Pe
1930
+ Object.values(Pt),
1931
+ $e
1923
1932
  ),
1924
1933
  placeholder: "(optional) Select activity type"
1925
1934
  }
@@ -1930,8 +1939,8 @@ const Ht = ({
1930
1939
  /* @__PURE__ */ e.jsx(
1931
1940
  Ee,
1932
1941
  {
1933
- value: C,
1934
- onChange: (N) => T(N.target.value),
1942
+ value: D,
1943
+ onChange: (O) => C(O.target.value),
1935
1944
  rows: 2,
1936
1945
  placeholder: "(optional) Describe camera setup, placement, angles"
1937
1946
  }
@@ -1942,8 +1951,8 @@ const Ht = ({
1942
1951
  /* @__PURE__ */ e.jsx(
1943
1952
  je,
1944
1953
  {
1945
- value: M,
1946
- onChange: (N) => E(N.target.value),
1954
+ value: x,
1955
+ onChange: (O) => E(O.target.value),
1947
1956
  type: "url",
1948
1957
  placeholder: "(optional) https://..."
1949
1958
  }
@@ -1955,7 +1964,7 @@ const Ht = ({
1955
1964
  Ee,
1956
1965
  {
1957
1966
  value: y,
1958
- onChange: (N) => A(N.target.value),
1967
+ onChange: (O) => T(O.target.value),
1959
1968
  rows: 2,
1960
1969
  placeholder: "(optional) Describe how to perform the test or exercise"
1961
1970
  }
@@ -1964,18 +1973,18 @@ const Ht = ({
1964
1973
  /* @__PURE__ */ e.jsxs(B, { children: [
1965
1974
  /* @__PURE__ */ e.jsx(ie, { children: "Link to Category" }),
1966
1975
  /* @__PURE__ */ e.jsx(
1967
- ne,
1976
+ se,
1968
1977
  {
1969
1978
  isMulti: !0,
1970
- value: S?.filter(
1971
- (N) => v.includes(N.value)
1979
+ value: A?.filter(
1980
+ (O) => b.includes(O.value)
1972
1981
  ),
1973
- onChange: (N) => $(
1974
- (N ?? []).map(
1982
+ onChange: (O) => P(
1983
+ (O ?? []).map(
1975
1984
  (G) => G.value
1976
1985
  )
1977
1986
  ),
1978
- options: S,
1987
+ options: A,
1979
1988
  placeholder: "Select one or more categories"
1980
1989
  }
1981
1990
  )
@@ -1983,14 +1992,14 @@ const Ht = ({
1983
1992
  /* @__PURE__ */ e.jsxs(B, { children: [
1984
1993
  /* @__PURE__ */ e.jsx(ie, { children: "Session Types" }),
1985
1994
  /* @__PURE__ */ e.jsx(
1986
- ne,
1995
+ se,
1987
1996
  {
1988
1997
  isMulti: !0,
1989
- value: K,
1990
- onChange: (N) => Y(
1991
- N ?? []
1998
+ value: Z,
1999
+ onChange: (O) => Y(
2000
+ O ?? []
1992
2001
  ),
1993
- options: F,
2002
+ options: L,
1994
2003
  placeholder: "Select one or more session types"
1995
2004
  }
1996
2005
  )
@@ -2000,24 +2009,24 @@ const Ht = ({
2000
2009
  /* @__PURE__ */ e.jsxs(B, { children: [
2001
2010
  /* @__PURE__ */ e.jsx(ie, { children: "Sensor Locations" }),
2002
2011
  /* @__PURE__ */ e.jsx(
2003
- ne,
2012
+ se,
2004
2013
  {
2005
2014
  isMulti: !0,
2006
- value: k,
2007
- onChange: (N) => V([...N]),
2008
- options: ms,
2009
- isOptionDisabled: () => k.length >= us
2015
+ value: R,
2016
+ onChange: (O) => K([...O]),
2017
+ options: gn,
2018
+ isOptionDisabled: () => R.length >= mn
2010
2019
  }
2011
2020
  )
2012
2021
  ] }),
2013
2022
  /* @__PURE__ */ e.jsxs(B, { children: [
2014
2023
  /* @__PURE__ */ e.jsx(ie, { children: "Default Parameters" }),
2015
2024
  /* @__PURE__ */ e.jsx(
2016
- ds,
2025
+ hn,
2017
2026
  {
2018
2027
  options: t,
2019
- value: L,
2020
- onChange: U
2028
+ value: I,
2029
+ onChange: W
2021
2030
  }
2022
2031
  )
2023
2032
  ] })
@@ -2025,15 +2034,15 @@ const Ht = ({
2025
2034
  /* @__PURE__ */ e.jsx(
2026
2035
  "div",
2027
2036
  {
2028
- className: Qt("col-span-2 flex justify-end", i && "hidden"),
2037
+ className: Qt("col-span-2 flex justify-end", c && "hidden"),
2029
2038
  children: /* @__PURE__ */ e.jsxs(pe, { mt: 16, gap: 4, children: [
2030
- /* @__PURE__ */ e.jsx(X, { colorScheme: "gray", isDisabled: r, onClick: o, children: "Cancel" }),
2039
+ /* @__PURE__ */ e.jsx(X, { colorScheme: "gray", isDisabled: i, onClick: o, children: "Cancel" }),
2031
2040
  /* @__PURE__ */ e.jsx(
2032
2041
  X,
2033
2042
  {
2034
2043
  colorScheme: "blue",
2035
- isDisabled: r || !H || !ue,
2036
- isLoading: r,
2044
+ isDisabled: i || !H || !ue,
2045
+ isLoading: i,
2037
2046
  onClick: xe,
2038
2047
  children: "Save changes"
2039
2048
  }
@@ -2042,101 +2051,101 @@ const Ht = ({
2042
2051
  }
2043
2052
  )
2044
2053
  ] });
2045
- }, ie = ({ children: n }) => /* @__PURE__ */ e.jsx(We, { fontWeight: "bold", fontFamily: "sans-serif", fontSize: "large", children: n }), Fs = ({
2046
- id: n,
2047
- onCancel: s,
2054
+ }, ie = ({ children: s }) => /* @__PURE__ */ e.jsx(Ue, { fontWeight: "bold", fontFamily: "sans-serif", fontSize: "large", children: s }), kn = ({
2055
+ id: s,
2056
+ onCancel: n,
2048
2057
  onSave: o,
2049
- onError: c,
2050
- hideButtons: i,
2051
- quantumOwned: l,
2052
- setButtonOnClick: u,
2053
- setButtonDisabled: x
2058
+ onError: a,
2059
+ hideButtons: c,
2060
+ quantumOwned: r,
2061
+ setButtonOnClick: d,
2062
+ setButtonDisabled: j
2054
2063
  }) => {
2055
- const [{ data: a }] = le({
2056
- query: l ? It : Lt
2057
- }), [{ data: w }] = le({
2064
+ const [{ data: l }] = le({
2065
+ query: r ? It : Lt
2066
+ }), [{ data: S }] = le({
2058
2067
  query: Ft,
2059
- variables: { id: n },
2060
- pause: !n
2061
- }), [{ data: I }] = le({
2062
- query: nt
2063
- }), m = _(
2068
+ variables: { id: s },
2069
+ pause: !s
2070
+ }), [{ data: N }] = le({
2071
+ query: st
2072
+ }), h = _(
2064
2073
  de,
2065
- I?.moduleCategories
2066
- ), [{ fetching: j }, f] = oe(tt), [{ fetching: r }, d] = oe(st), p = _(
2074
+ N?.moduleCategories
2075
+ ), [{ fetching: f }, v] = oe(tt), [{ fetching: i }, u] = oe(nt), p = _(
2067
2076
  ae,
2068
- l ? a?.quantumOwnedActions : a?.actions
2069
- ) ?? [], g = _(Ce, w?.module), y = _(et, g?.moduleActions) ?? [], [A, C] = z([
2070
- ...y.map((k) => k.actionId) ?? []
2071
- ]), [T, M] = z(g?.name ?? ""), [E, O] = z([]), [Q, K] = z(g?.description ?? "");
2072
- se(() => {
2073
- g && (C(y.map((k) => k.actionId)), M(g.name), K(g.description ?? ""), O(
2077
+ r ? l?.quantumOwnedActions : l?.actions
2078
+ ) ?? [], g = _(Ce, S?.module), y = _(et, g?.moduleActions) ?? [], [T, D] = z([
2079
+ ...y.map((R) => R.actionId) ?? []
2080
+ ]), [C, x] = z(g?.name ?? ""), [E, M] = z([]), [Q, Z] = z(g?.description ?? "");
2081
+ ne(() => {
2082
+ g && (D(y.map((R) => R.actionId)), x(g.name), Z(g.description ?? ""), M(
2074
2083
  g.categories.map(
2075
- (k) => _(de, k).id
2084
+ (R) => _(de, R).id
2076
2085
  ) ?? []
2077
2086
  ));
2078
2087
  }, [g, y]);
2079
- const Y = R(() => {
2080
- let k;
2081
- const V = {
2082
- actions: A,
2083
- name: T,
2084
- categories: E.filter((v) => v !== "other"),
2088
+ const Y = F(() => {
2089
+ let R;
2090
+ const K = {
2091
+ actions: T,
2092
+ name: C,
2093
+ categories: E.filter((b) => b !== "other"),
2085
2094
  description: Q,
2086
- quantumOwned: l
2095
+ quantumOwned: r
2087
2096
  };
2088
- g ? k = f({
2097
+ g ? R = v({
2089
2098
  id: g.id,
2090
- input: V
2091
- }) : k = d({
2092
- input: V
2093
- }), k.then(({ error: v }) => {
2094
- v ? c(v) : o();
2099
+ input: K
2100
+ }) : R = u({
2101
+ input: K
2102
+ }), R.then(({ error: b }) => {
2103
+ b ? a(b) : o();
2095
2104
  });
2096
2105
  }, [
2097
- d,
2098
- f,
2099
- A,
2106
+ u,
2107
+ v,
2100
2108
  T,
2109
+ C,
2101
2110
  Q,
2102
2111
  E,
2103
2112
  g,
2104
2113
  o,
2105
- c
2114
+ a
2106
2115
  ]);
2107
- return se(() => {
2108
- x && x({
2109
- cancelButton: j || r,
2110
- saveButton: j || r || !T || Q.trim().split(/\s+/).filter(Boolean).length > 40
2116
+ return ne(() => {
2117
+ j && j({
2118
+ cancelButton: f || i,
2119
+ saveButton: f || i || !C || Q.trim().split(/\s+/).filter(Boolean).length > 40
2111
2120
  });
2112
- }, [x, j, r, A, T, Q]), se(() => {
2113
- u && u({
2114
- cancelButton: s,
2121
+ }, [j, f, i, T, C, Q]), ne(() => {
2122
+ d && d({
2123
+ cancelButton: n,
2115
2124
  saveButton: Y
2116
2125
  });
2117
- }, [u, s, Y]), /* @__PURE__ */ e.jsxs(J, { width: "100%", children: [
2126
+ }, [d, n, Y]), /* @__PURE__ */ e.jsxs(J, { width: "100%", children: [
2118
2127
  /* @__PURE__ */ e.jsx(
2119
- ns,
2128
+ on,
2120
2129
  {
2121
- name: T,
2122
- setName: M,
2130
+ name: C,
2131
+ setName: x,
2123
2132
  actions: p,
2124
- selectedActionIds: A,
2125
- setSelectedActionIds: C,
2126
- availableCategories: m ?? [],
2133
+ selectedActionIds: T,
2134
+ setSelectedActionIds: D,
2135
+ availableCategories: h ?? [],
2127
2136
  selectedCategoryIds: E,
2128
- setSelectedCategoryIds: O,
2137
+ setSelectedCategoryIds: M,
2129
2138
  description: Q,
2130
- setDescription: K
2139
+ setDescription: Z
2131
2140
  }
2132
2141
  ),
2133
- !i && /* @__PURE__ */ e.jsx(te, { justifyContent: "flex-start", children: /* @__PURE__ */ e.jsxs(pe, { mt: 16, gap: 4, children: [
2142
+ !c && /* @__PURE__ */ e.jsx(te, { justifyContent: "flex-start", children: /* @__PURE__ */ e.jsxs(pe, { mt: 16, gap: 4, children: [
2134
2143
  /* @__PURE__ */ e.jsx(
2135
2144
  X,
2136
2145
  {
2137
2146
  colorScheme: "gray",
2138
- isDisabled: j || r,
2139
- onClick: s,
2147
+ isDisabled: f || i,
2148
+ onClick: n,
2140
2149
  children: "Cancel"
2141
2150
  }
2142
2151
  ),
@@ -2144,8 +2153,8 @@ const Ht = ({
2144
2153
  X,
2145
2154
  {
2146
2155
  colorScheme: "blue",
2147
- isDisabled: j || r || !T || Q.trim().split(/\s+/).filter(Boolean).length > 40,
2148
- isLoading: j || r,
2156
+ isDisabled: f || i || !C || Q.trim().split(/\s+/).filter(Boolean).length > 40,
2157
+ isLoading: f || i,
2149
2158
  onClick: Y,
2150
2159
  children: "Save"
2151
2160
  }
@@ -2154,12 +2163,12 @@ const Ht = ({
2154
2163
  ] });
2155
2164
  };
2156
2165
  export {
2157
- ss as ActivityList,
2158
- Ns as CopyActivityForm,
2159
- Is as CopyModuleForm,
2160
- ns as ModuleForm,
2161
- as as ParameterEditList,
2162
- ds as ParameterEditSelect,
2163
- Ls as UpsertActivityForm,
2164
- Fs as UpsertModuleForm
2166
+ sn as ActivityList,
2167
+ Ln as CopyActivityForm,
2168
+ Fn as CopyModuleForm,
2169
+ on as ModuleForm,
2170
+ dn as ParameterEditList,
2171
+ hn as ParameterEditSelect,
2172
+ Rn as UpsertActivityForm,
2173
+ kn as UpsertModuleForm
2165
2174
  };