quantum-component-library 1.4.50-dev.2 → 1.4.50-dev.3

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