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

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