quantum-component-library 1.4.45-dev.13 → 1.4.45-dev.14

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