quantum-component-library 1.0.1-qa → 1.4.45-dev.13

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