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

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 $t, Icon as xt, Input as we, 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 Ce, ButtonGroup as Le, Tooltip as et, Button as ee, RangeSlider as Dt, 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 $, useRef as Vt, useEffect as ce, createContext as en, useContext as tn, memo as Je } from "react";
5
+ import { c as Ne } 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 Se, 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($t, { children: /* @__PURE__ */ e.jsx(xt, { as: on, color: "gray.300" }) }),
34
34
  /* @__PURE__ */ e.jsx(
35
35
  we,
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 = $(
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: Ne(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(Ce, { children: t + 1 }),
132
+ /* @__PURE__ */ e.jsx(Ce, { 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(Le, { 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 = $(
186
+ ([M, E]) => {
187
+ M < E && I([M.toFixed(0), E.toFixed(0)]);
171
188
  },
172
- [w]
173
- ), N = P(
174
- ([L, B]) => {
175
- L < B && p([L, B]);
189
+ [I]
190
+ ), N = $(
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 = $(() => {
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 = $(
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]
189
- ), $ = P(
190
- (L) => {
191
- const B = L === "" || isNaN(Number(L)) ? L : _e(Number(L), y);
192
- w(([ee, U]) => [ee, B.toString()]);
205
+ [I, a]
206
+ ), D = $(
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 = $(
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(
210
- $t,
225
+ return /* @__PURE__ */ e.jsxs(ye, { direction: "column", ...L, children: [
226
+ /* @__PURE__ */ e.jsx(re, { pt: "1em", mb: "-0.5em", children: /* @__PURE__ */ e.jsxs(
227
+ Dt,
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)),
345
- onChange: $,
346
- onBlur: K,
361
+ value: m === "" ? "" : Math.abs(Number(m ?? o)),
362
+ onChange: D,
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
+ }, Pn = (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
+ }, $n = (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(", "), Dn = (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 = Pn(n, m);
470
+ return L ? S : Dn(S, a);
471
+ }, [n, m, a, L]), W = $(() => {
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 = $(() => {
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]), D = 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(Le, { 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: D ? 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,46 +545,46 @@ 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: Ne(
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
563
  /* @__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,
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
  }
@@ -575,92 +592,92 @@ const wn = ({
575
592
  ] }) }),
576
593
  /* @__PURE__ */ e.jsx(Ce, { 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(Ce, { maxW: "20rem", whiteSpace: "break-spaces", children: $n(S.sensorLocations) }),
604
+ !L && /* @__PURE__ */ e.jsx(Ce, { 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(Se, f.thresholds),
659
+ reports: A.map((Y) => ({
660
+ ...Y,
661
+ thresholds: R(Se, 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 = $(
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 = $(
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
- ), $ = P(
680
+ ), D = $(
664
681
  async (i) => {
665
682
  const r = {
666
683
  ...i,
@@ -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 = $(
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 = $(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" ? D : 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
+ D,
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 = $(() => {
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(Le, { 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]), D = T(() => J.filter(
1088
+ (r) => y.includes(r.id)
1089
+ ), [J, y]), S = $(
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 = $(
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 = $(async () => {
1102
+ if (m(!0), !D.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 D)
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 ve = R(
1121
+ ke,
1122
+ K.categories
1123
+ ), Pe = 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((Te) => Te.id)).flat(), Ie = R(
1130
+ nt,
1131
+ K.reports
1115
1132
  ).map((he) => ({
1116
1133
  ...he,
1117
1134
  id: void 0,
1118
- thresholds: A(
1135
+ thresholds: R(
1119
1136
  Se,
1120
1137
  he.thresholds
1121
1138
  ).map((Te) => ({
1122
1139
  ...Te,
1123
1140
  id: void 0
1124
1141
  }))
1125
- })), Oe = A(
1142
+ })), Oe = R(
1126
1143
  Se,
1127
- Y.thresholds
1144
+ K.thresholds
1128
1145
  ).map((he) => ({
1129
1146
  ...he,
1130
1147
  id: void 0
1131
1148
  })), $e = {
1132
- ...Y,
1149
+ ...K,
1133
1150
  quantumOwned: !0,
1134
1151
  thresholds: Oe,
1135
1152
  categories: ve?.map((he) => he.id),
1136
1153
  reports: Ie,
1137
- metadataIds: Fe,
1154
+ metadataIds: Pe,
1138
1155
  id: void 0
1139
- }, Ae = await z({ fields: $e });
1140
- return Ae.error || !Ae.data?.createAction ? null : A(
1156
+ }, Ae = await W({ fields: $e });
1157
+ return Ae.error || !Ae.data?.createAction ? null : R(
1141
1158
  fe,
1142
1159
  Ae.data.createAction
1143
1160
  );
1144
1161
  }
1145
- if (Y.quantumOwned) return Y;
1162
+ if (K.quantumOwned) return K;
1146
1163
  const Me = await N({
1147
- id: Y.id
1164
+ id: K.id
1148
1165
  });
1149
- return Me.error || !Me.data?.convertActionToQuantumOwned ? null : A(
1166
+ return Me.error || !Me.data?.convertActionToQuantumOwned ? null : R(
1150
1167
  fe,
1151
1168
  Me.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 = D.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
- $,
1227
- F,
1228
- q,
1229
- j,
1243
+ D,
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 = $(() => {
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: D.length === 0 || j
1244
1261
  });
1245
- }, [$.length, b, p]), ce(() => {
1246
- c && c({
1247
- cancelButton: B,
1248
- saveButton: L
1262
+ }, [D.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
+ D.length > 0 && /* @__PURE__ */ e.jsxs(re, { p: 4, bg: "gray.50", borderRadius: "md", children: [
1383
+ /* @__PURE__ */ e.jsx(b, { fontWeight: "semibold", mb: 3, children: D.length === 1 ? `${c.singular} to ${l === "copy" ? "Copy" : "Convert"}` : `${D.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
+ D.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
  }
@@ -1413,8 +1430,8 @@ const wn = ({
1413
1430
  },
1414
1431
  r.id
1415
1432
  )),
1416
- $.length > 1 && /* @__PURE__ */ e.jsx(
1417
- se,
1433
+ D.length > 1 && /* @__PURE__ */ e.jsx(
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
- $.length,
1444
+ D.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 && D.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(Le, { 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: D.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
+ D.length === 1 ? c.singular : `${D.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 = $(
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 = $(
1525
+ (a) => {
1526
+ t(a.target.value);
1503
1527
  },
1504
1528
  [t]
1505
- ), s = P(
1506
- (u) => {
1507
- l?.(u.target.value);
1529
+ ), l = $(
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,15 +1597,15 @@ 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(
@@ -1590,60 +1614,61 @@ const wn = ({
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
  ] }) }),
@@ -1652,159 +1677,161 @@ const wn = ({
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
1706
  /* @__PURE__ */ e.jsxs(oe, { justifyContent: "space-between", children: [
1681
1707
  /* @__PURE__ */ e.jsx(pe, { children: /* @__PURE__ */ e.jsxs("span", { children: [
1682
- p.actionPlural,
1683
- /* @__PURE__ */ e.jsxs(S, { fontSize: "sm", color: "gray.500", children: [
1708
+ d.actionPlural,
1709
+ /* @__PURE__ */ e.jsxs(b, { fontSize: "sm", color: "gray.500", children: [
1684
1710
  "Drag and drop to reorder the ",
1685
- p.actionPluralLowerCase,
1711
+ d.actionPluralLowerCase,
1686
1712
  " in this ",
1687
- p.moduleLowerCase,
1713
+ d.moduleLowerCase,
1688
1714
  "."
1689
1715
  ] })
1690
1716
  ] }) }),
1691
- /* @__PURE__ */ e.jsxs(
1692
- V,
1717
+ !g && /* @__PURE__ */ e.jsxs(
1718
+ ee,
1693
1719
  {
1694
1720
  size: "sm",
1695
1721
  variant: "solid",
1696
1722
  colorScheme: "blue",
1697
- onClick: a,
1723
+ onClick: o,
1698
1724
  children: [
1699
1725
  "Add / Remove ",
1700
- p.actionPlural
1726
+ d.actionPlural
1701
1727
  ]
1702
1728
  }
1703
1729
  )
1704
1730
  ] }),
1705
- c.length === 0 ? /* @__PURE__ */ e.jsx(le, { children: /* @__PURE__ */ e.jsxs(S, { color: "gray.500", fontSize: "lg", mb: "4rem", mt: "4rem", children: [
1731
+ u.length === 0 ? /* @__PURE__ */ e.jsx(le, { children: /* @__PURE__ */ e.jsxs(b, { color: "gray.500", fontSize: "lg", mb: "4rem", mt: "4rem", children: [
1706
1732
  "No ",
1707
- p.actionPluralLowerCase,
1733
+ d.actionPluralLowerCase,
1708
1734
  " selected for this",
1709
1735
  " ",
1710
- p.moduleLowerCase,
1736
+ d.moduleLowerCase,
1711
1737
  ".",
1712
- /* @__PURE__ */ e.jsxs(
1713
- V,
1738
+ !g && /* @__PURE__ */ e.jsxs(
1739
+ ee,
1714
1740
  {
1715
1741
  ml: "0.5em",
1716
1742
  size: "sm",
1717
1743
  variant: "link",
1718
1744
  colorScheme: "blue",
1719
- onClick: a,
1745
+ onClick: o,
1720
1746
  children: [
1721
1747
  "Add ",
1722
- p.actionPluralLowerCase,
1748
+ d.actionPluralLowerCase,
1723
1749
  "."
1724
1750
  ]
1725
1751
  }
1726
1752
  )
1727
1753
  ] }) }) : /* @__PURE__ */ e.jsx(
1728
- Sn,
1754
+ On,
1729
1755
  {
1730
- value: c,
1731
- onChange: (m) => {
1732
- const j = m(c);
1733
- t(j.map((o) => o.id));
1734
- }
1756
+ value: u,
1757
+ onChange: (C) => {
1758
+ const s = C(u);
1759
+ t(s.map((c) => c.id));
1760
+ },
1761
+ disabled: g
1735
1762
  }
1736
1763
  )
1737
1764
  ] });
1738
1765
  }
1739
- ), Gn = ({
1766
+ ), Wn = ({
1740
1767
  value: n,
1741
1768
  onChange: t,
1742
- forceKind: a,
1743
- disableRemove: d,
1744
- disableKind: p,
1745
- isDisabled: c,
1746
- lockRanges: m,
1747
- ...j
1769
+ forceKind: o,
1770
+ disableRemove: h,
1771
+ disableKind: g,
1772
+ isDisabled: d,
1773
+ lockRanges: u,
1774
+ ...C
1748
1775
  }) => {
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
1776
+ const s = T(() => [...n].sort((L, y) => {
1777
+ const I = mt.indexOf(L.plane), j = mt.indexOf(y.plane);
1778
+ return I - j;
1779
+ }), [n]), c = $((L) => "segment" in L.id ? Rt(L.id.segment, L.plane, !0) ?? "Unknown" : kt(L.id.joint, L.plane, !0) ?? "Unknown", []), x = $(
1780
+ (L, y) => {
1781
+ const I = s.findIndex(
1782
+ (m) => m.id === y.id && m.plane === y.plane
1756
1783
  );
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);
1784
+ let j = [...s];
1785
+ o && (y = { ...y, kind: o }), j[I] = y, u && (j = j.map((m) => ({
1786
+ ...m,
1787
+ min: y.min,
1788
+ max: y.max
1789
+ }))), t(j);
1763
1790
  },
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
1791
+ [t, s, o, u]
1792
+ ), F = $(
1793
+ (L) => {
1794
+ const y = s.filter(
1795
+ (I) => I.id !== L.id || I.plane !== L.plane
1769
1796
  );
1770
- t(I);
1797
+ t(y);
1771
1798
  },
1772
- [t, o]
1799
+ [t, s]
1773
1800
  );
1774
- return /* @__PURE__ */ e.jsx(le, { alignItems: "flex-start", overflowY: "auto", ...j, children: o.map((f, I) => /* @__PURE__ */ e.jsx(
1775
- zn,
1801
+ return /* @__PURE__ */ e.jsx(le, { alignItems: "flex-start", overflowY: "auto", ...C, children: s.map((L, y) => /* @__PURE__ */ e.jsx(
1802
+ Qn,
1776
1803
  {
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
1804
+ label: c(L),
1805
+ parameter: L,
1806
+ onChange: (I) => x(y, I),
1807
+ onRemove: h || d ? void 0 : () => F(L),
1808
+ forceKind: o,
1809
+ disableKind: g || d,
1810
+ isDisabled: d
1784
1811
  },
1785
- `${JSON.stringify(f.id)}-${f.plane}`
1812
+ `${JSON.stringify(L.id)}-${L.plane}`
1786
1813
  )) });
1787
- }, zn = ({
1814
+ }, Qn = ({
1788
1815
  label: n,
1789
1816
  parameter: t,
1790
- onChange: a,
1791
- onRemove: d,
1792
- forceKind: p,
1793
- disableKind: c,
1794
- isDisabled: m
1817
+ onChange: o,
1818
+ onRemove: h,
1819
+ forceKind: g,
1820
+ disableKind: d,
1821
+ isDisabled: u
1795
1822
  }) => {
1796
- const j = P(
1797
- (x) => "joint" in t.id ? yn(
1823
+ const C = $(
1824
+ (x) => "joint" in t.id ? wn(
1798
1825
  t.id.joint,
1799
1826
  t.plane,
1800
1827
  x < 0 ? -1 : 1
1801
- ) : vn(
1828
+ ) : Sn(
1802
1829
  t.id.segment,
1803
1830
  t.plane,
1804
1831
  x < 0 ? -1 : 1
1805
1832
  ),
1806
1833
  [t]
1807
- ), { min: o, max: l } = "joint" in t.id ? Cn(t.id.joint, t.plane) : { min: -180, max: 180 };
1834
+ ), { min: s, max: c } = "joint" in t.id ? Ln(t.id.joint, t.plane) : { min: -180, max: 180 };
1808
1835
  return /* @__PURE__ */ e.jsxs(
1809
1836
  le,
1810
1837
  {
@@ -1818,7 +1845,7 @@ const wn = ({
1818
1845
  children: [
1819
1846
  /* @__PURE__ */ e.jsxs(oe, { w: "100%", children: [
1820
1847
  /* @__PURE__ */ e.jsx(
1821
- S,
1848
+ b,
1822
1849
  {
1823
1850
  fontSize: "sm",
1824
1851
  flex: 1,
@@ -1827,23 +1854,23 @@ const wn = ({
1827
1854
  children: n
1828
1855
  }
1829
1856
  ),
1830
- t.sensorOnly && /* @__PURE__ */ e.jsx(St, { size: "sm", colorScheme: "orange", variant: "subtle", children: "Sensor Only" }),
1831
- d && !m && /* @__PURE__ */ e.jsx(
1832
- Kt,
1857
+ t.sensorOnly && /* @__PURE__ */ e.jsx(Lt, { size: "sm", colorScheme: "orange", variant: "subtle", children: "Sensor Only" }),
1858
+ h && !u && /* @__PURE__ */ e.jsx(
1859
+ Ht,
1833
1860
  {
1834
1861
  size: "xs",
1835
1862
  variant: "ghost",
1836
1863
  "aria-label": "delete",
1837
- icon: /* @__PURE__ */ e.jsx(gt, { as: rn }),
1838
- onClick: d
1864
+ icon: /* @__PURE__ */ e.jsx(xt, { as: cn }),
1865
+ onClick: h
1839
1866
  }
1840
1867
  ),
1841
- !p && /* @__PURE__ */ e.jsx(
1842
- Mn,
1868
+ !g && /* @__PURE__ */ e.jsx(
1869
+ Tn,
1843
1870
  {
1844
- selectedItem: t?.kind ?? We.Limit,
1845
- onChange: ({ value: x }) => a({ ...t, kind: x }),
1846
- isDisabled: c || m,
1871
+ selectedItem: t?.kind ?? Ue.Limit,
1872
+ onChange: ({ value: x }) => o({ ...t, kind: x }),
1873
+ isDisabled: d || u,
1847
1874
  buttonProps: {
1848
1875
  size: "sm",
1849
1876
  variant: "outline",
@@ -1854,466 +1881,466 @@ const wn = ({
1854
1881
  colorScheme: "teal"
1855
1882
  },
1856
1883
  items: [
1857
- { value: We.Limit, label: "limit" },
1858
- { value: We.Target, label: "target" }
1884
+ { value: Ue.Limit, label: "limit" },
1885
+ { value: Ue.Target, label: "target" }
1859
1886
  ]
1860
1887
  }
1861
1888
  )
1862
1889
  ] }),
1863
1890
  /* @__PURE__ */ e.jsx(
1864
- In,
1891
+ Nn,
1865
1892
  {
1866
1893
  w: "100%",
1867
1894
  size: "xs",
1868
- min: o,
1869
- max: l,
1895
+ min: s,
1896
+ max: c,
1870
1897
  zeroMarker: !0,
1871
1898
  value: [t.min, t.max],
1872
- onChange: (x) => a({ ...t, min: x[0], max: x[1] }),
1899
+ onChange: (x) => o({ ...t, min: x[0], max: x[1] }),
1873
1900
  formatValue: (x) => `${Math.abs(x)}°`,
1874
- valueLabel: (x) => j(x) ?? "",
1875
- positiveNegativeLabels: j(0) ? [j(-1) ?? "", j(1) ?? ""] : void 0,
1876
- isDisabled: m
1901
+ valueLabel: (x) => C(x) ?? "",
1902
+ positiveNegativeLabels: C(0) ? [C(-1) ?? "", C(1) ?? ""] : void 0,
1903
+ isDisabled: u
1877
1904
  }
1878
1905
  )
1879
1906
  ]
1880
1907
  }
1881
1908
  );
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 = ({
1909
+ }, 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
1910
  options: n,
1884
1911
  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
1912
+ onChange: o,
1913
+ forceKind: h,
1914
+ singleValue: g,
1915
+ singleValueSideless: d,
1916
+ editOnly: u,
1917
+ disableKind: C,
1918
+ maxParameters: s,
1919
+ ...c
1893
1920
  }) => {
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,
1921
+ const x = d ? 2 : s, F = T(() => {
1922
+ const m = /* @__PURE__ */ new Map();
1923
+ return n.forEach((l) => {
1924
+ const a = "joint" in l.id;
1925
+ let v, w;
1926
+ 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)) {
1927
+ const W = a ? ut(l.id.joint) ?? "Unknown Joint" : ut(l.id.segment) ?? "Unknown Segment";
1928
+ m.set(w, {
1929
+ label: W,
1903
1930
  options: []
1904
1931
  });
1905
1932
  }
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({
1933
+ const _ = m.get(w), B = [
1934
+ v,
1935
+ a ? l.id.joint : l.id.segment,
1936
+ l.plane
1937
+ ].filter(Boolean).map((W) => String(W).toLowerCase().replace(/\s+|_/g, ""));
1938
+ _.options.push({
1912
1939
  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" })
1940
+ /* @__PURE__ */ e.jsx(b, { children: v }),
1941
+ l.sensorOnly && /* @__PURE__ */ e.jsx(Lt, { size: "sm", colorScheme: "orange", variant: "subtle", children: "Sensor Only" })
1915
1942
  ] }),
1916
- value: s.id,
1917
- plane: s.plane,
1918
- sensorOnly: s.sensorOnly,
1919
- searchTokens: q
1943
+ value: l.id,
1944
+ plane: l.plane,
1945
+ sensorOnly: l.sensorOnly,
1946
+ searchTokens: B
1920
1947
  });
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
1948
+ }), Array.from(m.values());
1949
+ }, [n]), L = T(() => {
1950
+ if (!d || t.length === 0)
1951
+ return F;
1952
+ const m = t[0];
1953
+ return F.map((l) => ({
1954
+ ...l,
1955
+ options: l.options.filter(
1956
+ (a) => _e(a.value) === _e(m.id) && a.plane === m.plane
1930
1957
  )
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)
1958
+ })).filter((l) => l.options.length > 0);
1959
+ }, [F, t, d]), y = T(() => F.flatMap((l) => l.options).filter(
1960
+ (l) => t.some((a) => ze(a.id, l.value) && a.plane === l.plane)
1961
+ ), [F, t]), I = $((m, l) => {
1962
+ if (!l) return !0;
1963
+ const a = l.toLowerCase().replace(/\s+|_/g, ""), v = m.data;
1964
+ return !v || !v.searchTokens ? !1 : v.searchTokens.some(
1965
+ (w) => w.includes(a)
1939
1966
  );
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
1967
+ }, []), j = $(
1968
+ (m) => {
1969
+ const l = m.map((a) => {
1970
+ const v = t.find(
1971
+ (N) => ze(N.id, a.value) && N.plane === a.plane
1972
+ ), w = n.find(
1973
+ (N) => ze(N.id, a.value) && N.plane === a.plane
1974
+ ), _ = d ? t.find(
1975
+ (N) => _e(N.id) === _e(a.value) && N.plane === a.plane
1976
+ ) : void 0, B = _ && !v ? _.min : w && w.min ? w.min : 0, W = _ && !v ? _.max : w && w.max ? w.max : 0;
1977
+ return v ?? {
1978
+ id: a.value,
1979
+ plane: a.plane,
1980
+ min: B,
1981
+ max: W,
1982
+ sensorOnly: a.sensorOnly,
1983
+ kind: h ?? Ue.Limit
1957
1984
  };
1958
1985
  });
1959
- a(s);
1986
+ o(l);
1960
1987
  },
1961
- [a, t, n, d, c]
1988
+ [o, t, n, h, d]
1962
1989
  );
1963
1990
  return ce(() => {
1964
- const h = t.filter(
1965
- (s) => n.some((u) => Ge(u.id, s.id) && u.plane === s.plane)
1991
+ const m = t.filter(
1992
+ (l) => n.some((a) => ze(a.id, l.id) && a.plane === l.plane)
1966
1993
  );
1967
- h.length !== t.length && a(h);
1968
- }, [n, a, t]), /* @__PURE__ */ e.jsxs(se, { ...l, children: [
1994
+ m.length !== t.length && o(m);
1995
+ }, [n, o, t]), /* @__PURE__ */ e.jsxs(re, { ...c, children: [
1969
1996
  /* @__PURE__ */ e.jsx(
1970
1997
  ge,
1971
1998
  {
1972
- isMulti: !p,
1999
+ isMulti: !g,
1973
2000
  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,
2001
+ value: y,
2002
+ isDisabled: u || y.length >= (x ?? 1 / 0),
2003
+ onChange: (m) => Array.isArray(m) ? j([...m]) : j(m !== null ? [m] : []),
2004
+ options: L,
1978
2005
  controlShouldRenderValue: !1,
1979
- formatOptionLabel: (h) => h.label,
1980
- filterOption: w,
2006
+ formatOptionLabel: (m) => m.label,
2007
+ filterOption: I,
1981
2008
  isSearchable: !0
1982
2009
  }
1983
2010
  ),
1984
2011
  /* @__PURE__ */ e.jsx(
1985
- Gn,
2012
+ Wn,
1986
2013
  {
1987
2014
  marginTop: 2,
1988
2015
  maxH: "28rem",
1989
2016
  value: t,
1990
- onChange: a,
1991
- forceKind: d,
1992
- disableKind: j,
1993
- isDisabled: m,
1994
- lockRanges: c
2017
+ onChange: o,
2018
+ forceKind: h,
2019
+ disableKind: C,
2020
+ isDisabled: u,
2021
+ lockRanges: d
1995
2022
  }
1996
2023
  )
1997
2024
  ] });
1998
- }, pt = (n) => {
2025
+ }, gt = (n) => {
1999
2026
  switch (n) {
2000
- case ie.Thorax:
2027
+ case ae.Thorax:
2001
2028
  return "Thorax";
2002
- case ie.CenterBack:
2029
+ case ae.CenterBack:
2003
2030
  return "Center Back";
2004
- case ie.Pelvis:
2031
+ case ae.Pelvis:
2005
2032
  return "Pelvis";
2006
- case ie.LeftThigh:
2033
+ case ae.LeftThigh:
2007
2034
  return "Left Thigh";
2008
- case ie.RightThigh:
2035
+ case ae.RightThigh:
2009
2036
  return "Right Thigh";
2010
- case ie.LeftShank:
2037
+ case ae.LeftShank:
2011
2038
  return "Left Shank";
2012
- case ie.RightShank:
2039
+ case ae.RightShank:
2013
2040
  return "Right Shank";
2014
- case ie.LeftFoot:
2041
+ case ae.LeftFoot:
2015
2042
  return "Left Foot";
2016
- case ie.RightFoot:
2043
+ case ae.RightFoot:
2017
2044
  return "Right Foot";
2018
- case ie.LeftUpperArm:
2045
+ case ae.LeftUpperArm:
2019
2046
  return "Left Upper Arm";
2020
- case ie.RightUpperArm:
2047
+ case ae.RightUpperArm:
2021
2048
  return "Right Upper Arm";
2022
- case ie.LeftForearm:
2049
+ case ae.LeftForearm:
2023
2050
  return "Left Forearm";
2024
- case ie.RightForearm:
2051
+ case ae.RightForearm:
2025
2052
  return "Right Forearm";
2026
- case ie.Head:
2053
+ case ae.Head:
2027
2054
  return "Head";
2028
2055
  }
2029
- }, Bn = (n) => {
2056
+ }, qn = (n) => {
2030
2057
  switch (n) {
2031
- case ne.GeneralActivity:
2058
+ case se.GeneralActivity:
2032
2059
  return "General Activity";
2033
- case ne.MovementCoordination:
2060
+ case se.MovementCoordination:
2034
2061
  return "Movement Coordination";
2035
- case ne.PointOfInterest:
2062
+ case se.PointOfInterest:
2036
2063
  return "Point of Interest";
2037
- case ne.Range:
2064
+ case se.Range:
2038
2065
  return "Range";
2039
- case ne.StabilityBalance:
2066
+ case se.StabilityBalance:
2040
2067
  return "Stability Balance";
2041
2068
  }
2042
- }, ls = ({
2069
+ }, ms = ({
2043
2070
  id: n,
2044
2071
  onError: t,
2045
- onCancel: a,
2046
- onSave: d,
2047
- hideButtons: p,
2048
- setButtonOnClick: c,
2049
- setButtonDisabled: m,
2050
- quantumOwned: j,
2051
- isView: o
2072
+ onCancel: o,
2073
+ onSave: h,
2074
+ hideButtons: g,
2075
+ setButtonOnClick: d,
2076
+ setButtonDisabled: u,
2077
+ quantumOwned: C,
2078
+ isView: s
2052
2079
  }) => {
2053
- const l = Zt(), [{ fetching: x }, k] = me(et), [{ fetching: f }, I] = me(ln), [{ data: w }] = je({
2054
- query: cn,
2080
+ const c = nn(), [{ fetching: x }, F] = me(tt), [{ fetching: L }, y] = me(hn), [{ data: I }] = je({
2081
+ query: mn,
2055
2082
  variables: { id: n ?? "" },
2056
2083
  pause: !n
2057
- }), b = T(() => {
2058
- const g = A(
2084
+ }), j = T(() => {
2085
+ const p = R(
2059
2086
  fe,
2060
- w?.getActionById
2087
+ I?.getActionById
2061
2088
  );
2062
- if (!g) return null;
2063
- const R = A(tt, g.reports).map((_) => ({
2064
- ..._,
2065
- thresholds: A(Se, _.thresholds)
2089
+ if (!p) return null;
2090
+ const k = R(nt, p.reports).map((G) => ({
2091
+ ...G,
2092
+ thresholds: R(Se, G.thresholds)
2066
2093
  }));
2067
2094
  return {
2068
- ...g,
2069
- thresholds: A(Se, g.thresholds),
2070
- reports: R
2095
+ ...p,
2096
+ thresholds: R(Se, p.thresholds),
2097
+ reports: k
2071
2098
  };
2072
- }, [w]), h = x || f, s = !!b && !!n, { getLabel: u } = xe(), y = T(() => ({
2073
- action: u("action")
2074
- }), [u]), M = T(() => [
2099
+ }, [I]), m = x || L, l = !!j && !!n, { getLabel: a } = xe(), v = T(() => ({
2100
+ action: a("action")
2101
+ }), [a]), w = T(() => [
2075
2102
  { key: "module_category", label: "Link Category", multi: !0 },
2076
- { key: "activity_type", label: `${y.action} Type`, multi: !1 },
2103
+ { key: "activity_type", label: `${v.action} Type`, multi: !1 },
2077
2104
  { key: "session_type", label: "Session Type", multi: !0 },
2078
2105
  { key: "body_region", label: "Body Region", multi: !0 },
2079
2106
  { 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 },
2107
+ ], [v.action]), [_, B] = z(""), [W, N] = z(""), [Z, J] = z(""), [D, 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(), Me = T(() => K.filter((p) => p.sensorOnly), [K]), ve = T(() => {
2108
+ const p = [
2109
+ { label: "General Activity", value: se.GeneralActivity },
2083
2110
  {
2084
2111
  label: "Movement Coordination",
2085
- value: ne.MovementCoordination
2112
+ value: se.MovementCoordination
2086
2113
  },
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)
2114
+ { label: "Point of Interest", value: se.PointOfInterest },
2115
+ { label: "Range", value: se.Range },
2116
+ { label: "Stability Balance", value: se.StabilityBalance }
2117
+ ], P = q.map((k) => k.kind);
2118
+ return p.filter(
2119
+ (k) => !P.includes(k.value)
2093
2120
  );
2094
- }, [Q]), ke = F.length > 0, [Fe, nt] = G({});
2121
+ }, [q]), Fe = _.length > 0, [Pe, st] = z({});
2095
2122
  ce(() => {
2096
- const g = M.map(
2097
- (D) => l.query(dn, { key: D.key })
2123
+ const p = w.map(
2124
+ (P) => c.query(pn, { key: P.key })
2098
2125
  );
2099
- Promise.all(g).then((D) => {
2100
- const R = {};
2101
- D.forEach((_) => {
2102
- if (_.error || !_.data) return;
2103
- const J = A(
2126
+ Promise.all(p).then((P) => {
2127
+ const k = {};
2128
+ P.forEach((G) => {
2129
+ if (G.error || !G.data) return;
2130
+ const H = R(
2104
2131
  Ye,
2105
- _.data.getMetadataByKey
2106
- ), Z = A(
2132
+ G.data.getMetadataByKey
2133
+ ), V = R(
2107
2134
  He,
2108
- J.data
2135
+ H.data
2109
2136
  );
2110
- R[J.key] = Z.map((ue) => ({
2137
+ k[H.key] = V.map((ue) => ({
2111
2138
  label: ue.label || ue.value,
2112
2139
  value: ue.value,
2113
2140
  id: ue.id
2114
2141
  }));
2115
- }), ee(R);
2142
+ }), te(k);
2116
2143
  });
2117
- }, [l, M]), ce(() => {
2118
- if (b) {
2119
- const D = A(
2144
+ }, [c, w]), ce(() => {
2145
+ if (j) {
2146
+ const P = R(
2120
2147
  Ye,
2121
- b.metadataGroups
2148
+ j.metadataGroups
2122
2149
  ).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) => ({
2150
+ (H) => H.data.map((V) => R(He, V).id)
2151
+ ), k = j.reports.map((H) => ({
2152
+ id: H.id,
2153
+ instructions: H.instructions ?? "",
2154
+ kind: H.reportKind,
2155
+ parameters: H.thresholds.map((V) => ({
2129
2156
  id: {
2130
- [Z.partKind]: Z.partId
2157
+ [V.partKind]: V.partId
2131
2158
  },
2132
- kind: Z.kind,
2133
- min: Z.min,
2134
- max: Z.max,
2135
- plane: Z.partDimension,
2136
- oldId: Z.id,
2159
+ kind: V.kind,
2160
+ min: V.min,
2161
+ max: V.max,
2162
+ plane: V.partDimension,
2163
+ oldId: V.id,
2137
2164
  sensorOnly: Me.some((ue) => {
2138
- const Xe = ue.id[Z.partKind];
2139
- return Xe ? Xe === Z.partId && ue.plane === Z.partDimension : !1;
2165
+ const Ze = ue.id[V.partKind];
2166
+ return Ze ? Ze === V.partId && ue.plane === V.partDimension : !1;
2140
2167
  })
2141
2168
  })),
2142
- sensorLocations: J.sensorLocations
2143
- })), _ = {
2144
- name: b.name,
2145
- description: b.description || "",
2146
- cameraPlacement: b.cameraPlacement || "",
2147
- videoLink: b.videoLink || "",
2148
- metadataIds: D.flat(),
2149
- reports: R
2169
+ sensorLocations: H.sensorLocations
2170
+ })), G = {
2171
+ name: j.name,
2172
+ description: j.description || "",
2173
+ cameraPlacement: j.cameraPlacement || "",
2174
+ videoLink: j.videoLink || "",
2175
+ metadataIds: P.flat(),
2176
+ reports: k
2150
2177
  };
2151
- q(_.name), N(_.description), re(_.cameraPlacement), C(_.videoLink), L(_.metadataIds), H(R), nt(_);
2178
+ B(G.name), N(G.description), J(G.cameraPlacement), S(G.videoLink), M(G.metadataIds), Y(k), st(G);
2152
2179
  }
2153
- }, [b]);
2180
+ }, [j]);
2154
2181
  const Ie = T(
2155
- () => JSON.stringify(Fe) !== JSON.stringify({
2156
- name: F,
2157
- description: z,
2158
- cameraPlacement: K,
2159
- videoLink: $,
2160
- metadataIds: E,
2161
- reports: Q
2182
+ () => JSON.stringify(Pe) !== JSON.stringify({
2183
+ name: _,
2184
+ description: W,
2185
+ cameraPlacement: Z,
2186
+ videoLink: D,
2187
+ metadataIds: O,
2188
+ reports: q
2162
2189
  }),
2163
2190
  [
2164
- Fe,
2165
- F,
2166
- z,
2167
- K,
2168
- $,
2169
- E,
2170
- Q
2191
+ Pe,
2192
+ _,
2193
+ W,
2194
+ Z,
2195
+ D,
2196
+ O,
2197
+ q
2171
2198
  ]
2172
- ), Oe = P(() => {
2173
- const g = {
2174
- name: F,
2175
- description: z,
2176
- cameraPlacement: K,
2177
- videoLink: $,
2178
- metadataItemIds: E,
2199
+ ), Oe = $(() => {
2200
+ const p = {
2201
+ name: _,
2202
+ description: W,
2203
+ cameraPlacement: Z,
2204
+ videoLink: D,
2205
+ metadataItemIds: O,
2179
2206
  // Backend requires laterality; keep existing default since UI no longer edits it
2180
- laterality: bn.Either,
2181
- quantumOwned: j,
2207
+ laterality: Mn.Either,
2208
+ quantumOwned: C,
2182
2209
  //Backend requires session type; keep existing default since UI no longer edits it
2183
2210
  sessionType: [],
2184
2211
  // Backend requires thresholds; use empty array since reports handle parameters now
2185
2212
  thresholds: [],
2186
2213
  // 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
2214
+ reports: q.map((k) => ({
2215
+ id: k.isNew ? void 0 : k.id,
2216
+ reportKind: k.kind,
2217
+ sensorLocations: k.sensorLocations,
2218
+ instructions: k.instructions,
2219
+ thresholds: k.parameters.map((G) => ({
2220
+ id: G.oldId,
2221
+ kind: G.kind,
2222
+ min: G.min,
2223
+ max: G.max,
2224
+ partKind: "joint" in G.id ? "joint" : "segment",
2225
+ partId: "joint" in G.id ? G.id.joint : G.id.segment,
2226
+ partDimension: G.plane
2200
2227
  }))
2201
2228
  }))
2202
2229
  };
2203
- let D;
2204
- s && n ? D = I({
2230
+ let P;
2231
+ l && n ? P = y({
2205
2232
  id: n,
2206
- fields: g
2207
- }) : D = k({
2208
- fields: g
2209
- }), D.then(({ error: R }) => {
2210
- R ? t(R) : d();
2233
+ fields: p
2234
+ }) : P = F({
2235
+ fields: p
2236
+ }), P.then(({ error: k }) => {
2237
+ k ? t(k) : h();
2211
2238
  });
2212
2239
  }, [
2213
- j,
2214
- k,
2215
- I,
2216
- n,
2240
+ C,
2217
2241
  F,
2218
- z,
2219
- K,
2220
- $,
2221
- E,
2222
- Q,
2223
- s,
2224
- d,
2242
+ y,
2243
+ n,
2244
+ _,
2245
+ W,
2246
+ Z,
2247
+ D,
2248
+ O,
2249
+ q,
2250
+ l,
2251
+ h,
2225
2252
  t
2226
2253
  ]);
2227
2254
  ce(() => {
2228
- m && m({
2229
- cancelButton: h,
2230
- saveButton: o ? !0 : h || !ke || !Ie
2255
+ u && u({
2256
+ cancelButton: m,
2257
+ saveButton: s ? !0 : m || !Fe || !Ie
2231
2258
  });
2232
- }, [h, m, ke, Ie, o]), ce(() => {
2233
- c && c({
2234
- cancelButton: a,
2235
- saveButton: o ? () => {
2259
+ }, [m, u, Fe, Ie, s]), ce(() => {
2260
+ d && d({
2261
+ cancelButton: o,
2262
+ saveButton: s ? () => {
2236
2263
  } : Oe
2237
2264
  });
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
2265
+ }, [d, o, Oe, s]);
2266
+ const $e = $(
2267
+ (p) => {
2268
+ const P = ht(
2269
+ p.map(
2270
+ (k) => "joint" in k.id ? k.id.joint : k.id.segment
2244
2271
  )
2245
2272
  );
2246
- O(D);
2273
+ A(P);
2247
2274
  },
2248
2275
  []
2249
2276
  );
2250
2277
  ce(() => {
2251
2278
  $e(i);
2252
2279
  }, [i, $e]);
2253
- const Ae = P(() => {
2254
- if (!U)
2280
+ const Ae = $(() => {
2281
+ if (!Q)
2255
2282
  return;
2256
- const g = U === ne.PointOfInterest, D = {
2283
+ const p = Q === se.PointOfInterest, P = {
2257
2284
  id: Date.now().toString(),
2258
2285
  // Temporary ID
2259
- kind: U,
2260
- parameters: g ? [] : i,
2261
- sensorLocations: g ? [] : v,
2262
- instructions: g ? W : "",
2286
+ kind: Q,
2287
+ parameters: p ? [] : i,
2288
+ sensorLocations: p ? [] : f,
2289
+ instructions: p ? U : "",
2263
2290
  isNew: !0
2264
2291
  };
2265
- H((R) => [...R, D]), ae(null), r([]), O([]), te("");
2292
+ Y((k) => [...k, P]), ie(null), r([]), A([]), ne("");
2266
2293
  }, [
2267
- U,
2294
+ Q,
2268
2295
  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
2278
- ) : 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
2296
+ f,
2297
+ U
2298
+ ]), he = $((p) => {
2299
+ Y((P) => P.filter((k) => k.id !== p));
2300
+ }, []), Te = (p, P) => {
2301
+ const k = w.find((H) => H.key === p);
2302
+ if (!k) return;
2303
+ const G = k.multi ? (P ?? []).map(
2304
+ (H) => H.id
2305
+ ) : P ? [P.id] : [];
2306
+ M((H) => [...H.filter((ue) => Object.values(E).flat().find((De) => De.id === ue) && !Object.keys(E).find(
2307
+ (De) => E[De]?.some(
2308
+ (Pt) => Pt.id === ue && De === p
2282
2309
  )
2283
- )), ..._]);
2310
+ )), ...G]);
2284
2311
  };
2285
2312
  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" })
2313
+ /* @__PURE__ */ e.jsxs(Jt, { children: [
2314
+ /* @__PURE__ */ e.jsxs(Xt, { children: [
2315
+ /* @__PURE__ */ e.jsx(ct, { children: "Basic Information" }),
2316
+ /* @__PURE__ */ e.jsx(ct, { children: "Reports" })
2290
2317
  ] }),
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: [
2318
+ /* @__PURE__ */ e.jsxs(Zt, { children: [
2319
+ /* @__PURE__ */ e.jsx(dt, { px: 0, children: /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-6", children: [
2293
2320
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
2294
2321
  /* @__PURE__ */ e.jsxs(X, { children: [
2295
2322
  /* @__PURE__ */ e.jsx(de, { children: "Name" }),
2296
2323
  /* @__PURE__ */ e.jsx(
2297
2324
  we,
2298
2325
  {
2299
- value: F,
2300
- onChange: (g) => q(g.target.value),
2326
+ value: _,
2327
+ onChange: (p) => B(p.target.value),
2301
2328
  type: "text",
2302
2329
  placeholder: "i.e. Lunge & Return",
2303
- isDisabled: o
2330
+ isDisabled: s
2304
2331
  }
2305
2332
  )
2306
2333
  ] }),
2307
2334
  /* @__PURE__ */ e.jsxs(X, { children: [
2308
2335
  /* @__PURE__ */ e.jsx(de, { children: "Camera Placement" }),
2309
2336
  /* @__PURE__ */ e.jsx(
2310
- Pe,
2337
+ Ee,
2311
2338
  {
2312
- value: K,
2313
- onChange: (g) => re(g.target.value),
2339
+ value: Z,
2340
+ onChange: (p) => J(p.target.value),
2314
2341
  rows: 2,
2315
2342
  placeholder: "(optional) Describe camera setup, placement, angles",
2316
- isDisabled: o
2343
+ isDisabled: s
2317
2344
  }
2318
2345
  )
2319
2346
  ] }),
@@ -2322,87 +2349,87 @@ const wn = ({
2322
2349
  /* @__PURE__ */ e.jsx(
2323
2350
  we,
2324
2351
  {
2325
- value: $,
2326
- onChange: (g) => C(g.target.value),
2352
+ value: D,
2353
+ onChange: (p) => S(p.target.value),
2327
2354
  type: "url",
2328
2355
  placeholder: "(optional) https://...",
2329
- isDisabled: o
2356
+ isDisabled: s
2330
2357
  }
2331
2358
  )
2332
2359
  ] }),
2333
2360
  /* @__PURE__ */ e.jsxs(X, { children: [
2334
2361
  /* @__PURE__ */ e.jsx(de, { children: "Description" }),
2335
2362
  /* @__PURE__ */ e.jsx(
2336
- Pe,
2363
+ Ee,
2337
2364
  {
2338
- value: z,
2339
- onChange: (g) => N(g.target.value),
2365
+ value: W,
2366
+ onChange: (p) => N(p.target.value),
2340
2367
  rows: 2,
2341
2368
  placeholder: "(optional) Describe how to perform the test or exercise",
2342
- isDisabled: o
2369
+ isDisabled: s
2343
2370
  }
2344
2371
  )
2345
2372
  ] })
2346
2373
  ] }),
2347
2374
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
2348
2375
  /* @__PURE__ */ e.jsx(de, { children: "Metadata Tags" }),
2349
- M.map((g) => /* @__PURE__ */ e.jsxs(X, { children: [
2350
- /* @__PURE__ */ e.jsx(de, { children: g.label }),
2376
+ w.map((p) => /* @__PURE__ */ e.jsxs(X, { children: [
2377
+ /* @__PURE__ */ e.jsx(de, { children: p.label }),
2351
2378
  /* @__PURE__ */ e.jsx(
2352
2379
  ge,
2353
2380
  {
2354
- isMulti: g.multi,
2355
- value: B[g.key]?.filter(
2356
- (D) => E.includes(D.id)
2381
+ isMulti: p.multi,
2382
+ value: E[p.key]?.filter(
2383
+ (P) => O.includes(P.id)
2357
2384
  ),
2358
- onChange: (D) => {
2359
- Te(g.key, D);
2385
+ onChange: (P) => {
2386
+ Te(p.key, P);
2360
2387
  },
2361
- options: B[g.key],
2362
- placeholder: `Select ${g.multi ? "one or more" : "one"} ${g.label.toLowerCase()}`,
2363
- isDisabled: o,
2364
- isClearable: g.multi
2388
+ options: E[p.key],
2389
+ placeholder: `Select ${p.multi ? "one or more" : "one"} ${p.label.toLowerCase()}`,
2390
+ isDisabled: s,
2391
+ isClearable: p.multi
2365
2392
  }
2366
2393
  )
2367
- ] }, g.key))
2394
+ ] }, p.key))
2368
2395
  ] })
2369
2396
  ] }) }),
2370
- /* @__PURE__ */ e.jsx(ct, { px: 0, children: /* @__PURE__ */ e.jsxs(
2397
+ /* @__PURE__ */ e.jsx(dt, { px: 0, children: /* @__PURE__ */ e.jsxs(
2371
2398
  "div",
2372
2399
  {
2373
- className: ze(
2400
+ className: Ne(
2374
2401
  "grid grid-cols-1 gap-6",
2375
- !o && "md:grid-cols-2"
2402
+ !s && "md:grid-cols-2"
2376
2403
  ),
2377
2404
  children: [
2378
- /* @__PURE__ */ e.jsxs("div", { className: ze("space-y-4", o && "hidden"), children: [
2405
+ /* @__PURE__ */ e.jsxs("div", { className: Ne("space-y-4", s && "hidden"), children: [
2379
2406
  /* @__PURE__ */ e.jsx(de, { children: "Add New Report" }),
2380
2407
  /* @__PURE__ */ e.jsxs(X, { children: [
2381
2408
  /* @__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(
2409
+ ve.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
2410
  ge,
2384
2411
  {
2385
- value: U ? ve.find(
2386
- (g) => g.value === U
2412
+ value: Q ? ve.find(
2413
+ (p) => p.value === Q
2387
2414
  ) : null,
2388
- onChange: (g) => ae(g?.value || null),
2415
+ onChange: (p) => ie(p?.value || null),
2389
2416
  options: ve,
2390
2417
  placeholder: "Select report kind...",
2391
- isDisabled: o,
2418
+ isDisabled: s,
2392
2419
  isClearable: !0
2393
2420
  }
2394
2421
  )
2395
2422
  ] }),
2396
- U !== ne.PointOfInterest && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
2423
+ Q !== se.PointOfInterest && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
2397
2424
  /* @__PURE__ */ e.jsxs(X, { children: [
2398
2425
  /* @__PURE__ */ e.jsx(de, { children: "Default Parameters" }),
2399
2426
  /* @__PURE__ */ e.jsx(
2400
- mt,
2427
+ pt,
2401
2428
  {
2402
- options: Y,
2429
+ options: K,
2403
2430
  value: i,
2404
2431
  onChange: r,
2405
- editOnly: o
2432
+ editOnly: s
2406
2433
  }
2407
2434
  )
2408
2435
  ] }),
@@ -2411,8 +2438,8 @@ const wn = ({
2411
2438
  /* @__PURE__ */ e.jsx(
2412
2439
  we,
2413
2440
  {
2414
- value: v.map(
2415
- (g) => pt(g)
2441
+ value: f.map(
2442
+ (p) => gt(p)
2416
2443
  ).join(", "),
2417
2444
  placeholder: "Auto-filled based on parameters...",
2418
2445
  isDisabled: !0
@@ -2420,94 +2447,94 @@ const wn = ({
2420
2447
  )
2421
2448
  ] })
2422
2449
  ] }),
2423
- U === ne.PointOfInterest && /* @__PURE__ */ e.jsxs(X, { children: [
2450
+ Q === se.PointOfInterest && /* @__PURE__ */ e.jsxs(X, { children: [
2424
2451
  /* @__PURE__ */ e.jsx(de, { children: "Instructions" }),
2425
2452
  /* @__PURE__ */ e.jsx(
2426
- Pe,
2453
+ Ee,
2427
2454
  {
2428
- value: W,
2429
- onChange: (g) => te(g.target.value),
2455
+ value: U,
2456
+ onChange: (p) => ne(p.target.value),
2430
2457
  rows: 3,
2431
2458
  placeholder: "Enter specific instructions for this report...",
2432
- isDisabled: o
2459
+ isDisabled: s
2433
2460
  }
2434
2461
  )
2435
2462
  ] }),
2436
2463
  /* @__PURE__ */ e.jsx("div", { className: "w-full flex justify-end", children: /* @__PURE__ */ e.jsx(
2437
- V,
2464
+ ee,
2438
2465
  {
2439
2466
  colorScheme: "blue",
2440
2467
  onClick: Ae,
2441
- isDisabled: !U || o || ve.length === 0 || U !== ne.PointOfInterest && i.length === 0,
2468
+ isDisabled: !Q || s || ve.length === 0 || Q !== se.PointOfInterest && i.length === 0,
2442
2469
  children: "Add Report"
2443
2470
  }
2444
2471
  ) })
2445
2472
  ] }),
2446
2473
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
2447
2474
  /* @__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(
2475
+ 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
2476
  "div",
2450
2477
  {
2451
2478
  className: "p-3 border border-gray-200 rounded-md bg-gray-50",
2452
2479
  children: [
2453
2480
  /* @__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,
2481
+ /* @__PURE__ */ e.jsx(b, { fontWeight: "semibold", children: qn(p.kind) }),
2482
+ !s && /* @__PURE__ */ e.jsx(
2483
+ ee,
2457
2484
  {
2458
2485
  size: "xs",
2459
2486
  colorScheme: "red",
2460
2487
  variant: "ghost",
2461
- onClick: () => he(g.id),
2488
+ onClick: () => he(p.id),
2462
2489
  children: "Remove"
2463
2490
  }
2464
2491
  )
2465
2492
  ] }),
2466
- g.kind === ne.PointOfInterest && /* @__PURE__ */ e.jsxs(X, { children: [
2493
+ p.kind === se.PointOfInterest && /* @__PURE__ */ e.jsxs(X, { children: [
2467
2494
  /* @__PURE__ */ e.jsx(de, { children: "Instructions" }),
2468
2495
  /* @__PURE__ */ e.jsx(
2469
- Pe,
2496
+ Ee,
2470
2497
  {
2471
- value: g.instructions,
2472
- onChange: (D) => H(
2473
- (R) => R.map(
2474
- (_) => _.id === g.id ? { ..._, instructions: D.target.value } : _
2498
+ value: p.instructions,
2499
+ onChange: (P) => Y(
2500
+ (k) => k.map(
2501
+ (G) => G.id === p.id ? { ...G, instructions: P.target.value } : G
2475
2502
  )
2476
2503
  ),
2477
2504
  rows: 3,
2478
2505
  placeholder: "Enter specific instructions for this report...",
2479
- isDisabled: o
2506
+ isDisabled: s
2480
2507
  }
2481
2508
  )
2482
2509
  ] }),
2483
- g.kind !== ne.PointOfInterest && /* @__PURE__ */ e.jsx(
2484
- mt,
2510
+ p.kind !== se.PointOfInterest && /* @__PURE__ */ e.jsx(
2511
+ pt,
2485
2512
  {
2486
- options: Y,
2487
- value: g.parameters,
2488
- 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
2513
+ options: K,
2514
+ value: p.parameters,
2515
+ onChange: (P) => {
2516
+ const k = P.map(
2517
+ (H) => H.id.joint ?? H.id.segment
2518
+ ), G = ht(k);
2519
+ Y(
2520
+ (H) => H.map(
2521
+ (V) => V.id === p.id ? { ...V, parameters: P, sensorLocations: G } : V
2495
2522
  )
2496
2523
  );
2497
2524
  },
2498
- editOnly: o
2525
+ editOnly: s
2499
2526
  }
2500
2527
  ),
2501
- g.kind !== ne.PointOfInterest && /* @__PURE__ */ e.jsxs(S, { fontSize: "sm", color: "gray.600", mt: 2, children: [
2528
+ p.kind !== se.PointOfInterest && /* @__PURE__ */ e.jsxs(b, { fontSize: "sm", color: "gray.600", mt: 2, children: [
2502
2529
  "Sensors:",
2503
2530
  " ",
2504
- g.sensorLocations.map(
2505
- (D) => pt(D)
2531
+ p.sensorLocations.map(
2532
+ (P) => gt(P)
2506
2533
  ).join(", ")
2507
2534
  ] })
2508
2535
  ]
2509
2536
  },
2510
- g.id
2537
+ p.id
2511
2538
  )) })
2512
2539
  ] })
2513
2540
  ]
@@ -2519,15 +2546,15 @@ const wn = ({
2519
2546
  oe,
2520
2547
  {
2521
2548
  justify: "end",
2522
- className: ze((p || o) && "!hidden"),
2549
+ className: Ne((g || s) && "!hidden"),
2523
2550
  children: /* @__PURE__ */ e.jsxs(Le, { gap: 4, children: [
2524
- /* @__PURE__ */ e.jsx(V, { colorScheme: "gray", isDisabled: h, onClick: a, children: "Cancel" }),
2551
+ /* @__PURE__ */ e.jsx(ee, { colorScheme: "gray", isDisabled: m, onClick: o, children: "Cancel" }),
2525
2552
  /* @__PURE__ */ e.jsx(
2526
- V,
2553
+ ee,
2527
2554
  {
2528
2555
  colorScheme: "blue",
2529
- isDisabled: h || !ke || !Ie,
2530
- isLoading: h,
2556
+ isDisabled: m || !Fe || !Ie,
2557
+ isLoading: m,
2531
2558
  onClick: Oe,
2532
2559
  children: "Save changes"
2533
2560
  }
@@ -2536,125 +2563,129 @@ const wn = ({
2536
2563
  }
2537
2564
  )
2538
2565
  ] });
2539
- }, de = ({ children: n }) => /* @__PURE__ */ e.jsx(xt, { fontWeight: "bold", fontFamily: "sans-serif", fontSize: "large", children: n }), cs = ({
2566
+ }, de = ({ children: n }) => /* @__PURE__ */ e.jsx(jt, { fontWeight: "bold", fontFamily: "sans-serif", fontSize: "large", children: n }), Kn = ({
2567
+ children: n,
2568
+ isView: t
2569
+ }) => /* @__PURE__ */ e.jsx(Ft.Provider, { value: { isView: t }, children: n }), ps = ({
2540
2570
  id: n,
2541
2571
  onCancel: t,
2542
- onSave: a,
2543
- onError: d,
2544
- hideButtons: p,
2545
- quantumOwned: c,
2546
- setButtonOnClick: m,
2547
- setButtonDisabled: j
2572
+ onSave: o,
2573
+ onError: h,
2574
+ hideButtons: g,
2575
+ quantumOwned: d,
2576
+ setButtonOnClick: u,
2577
+ setButtonDisabled: C,
2578
+ isView: s
2548
2579
  }) => {
2549
- const [{ data: o }] = je({
2550
- query: c ? un : hn
2551
- }), [{ data: l }] = je({
2552
- query: mn,
2580
+ const [{ data: c }] = je({
2581
+ query: d ? gn : xn
2582
+ }), [{ data: x }] = je({
2583
+ query: jn,
2553
2584
  variables: { id: n },
2554
2585
  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(
2586
+ }), [{ data: F }] = je({
2587
+ query: fn
2588
+ }), L = R(
2589
+ ke,
2590
+ F?.moduleCategories
2591
+ ), [{ fetching: y }, I] = me(Tt), [{ fetching: j }, m] = me(At), l = R(
2561
2592
  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 ?? "");
2593
+ d ? c?.quantumOwnedActions : c?.actions
2594
+ ) ?? [], a = R(Be, x?.module), v = T(() => R(Nt, a?.moduleActions) ?? [], [a?.moduleActions]), [w, _] = z([
2595
+ ...v.map((O) => O.actionId) ?? []
2596
+ ]), [B, W] = z(a?.name ?? ""), [N, Z] = z([]), [J, D] = z(a?.description ?? "");
2566
2597
  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
2598
+ a && (_(v.map((O) => O.actionId)), W(a.name), D(a.description ?? ""), Z(
2599
+ a.categories.map(
2600
+ (O) => R(ke, O).id
2570
2601
  ) ?? []
2571
2602
  ));
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
2603
+ }, [a, v]);
2604
+ const S = $(() => {
2605
+ let O;
2606
+ const M = {
2607
+ actions: w,
2608
+ name: B,
2609
+ categories: N.filter((E) => E !== "other"),
2610
+ description: J,
2611
+ quantumOwned: d
2581
2612
  };
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();
2613
+ a ? O = I({
2614
+ id: a.id,
2615
+ input: M
2616
+ }) : O = m({
2617
+ input: M
2618
+ }), O.then(({ error: E }) => {
2619
+ E ? h(E) : o();
2589
2620
  });
2590
2621
  }, [
2591
- b,
2622
+ m,
2592
2623
  I,
2593
- y,
2594
- F,
2595
- K,
2596
- z,
2597
- s,
2624
+ w,
2625
+ B,
2626
+ J,
2627
+ N,
2598
2628
  a,
2599
- d,
2600
- c
2629
+ o,
2630
+ h,
2631
+ d
2601
2632
  ]);
2602
2633
  return ce(() => {
2603
- j && j({
2604
- cancelButton: f || w,
2605
- saveButton: f || w || !F || K.trim().split(/\s+/).filter(Boolean).length > 40
2634
+ C && C({
2635
+ cancelButton: y || j,
2636
+ saveButton: y || j || !B || J.trim().split(/\s+/).filter(Boolean).length > 40
2606
2637
  });
2607
- }, [j, f, w, y, F, K]), ce(() => {
2608
- m && m({
2638
+ }, [C, y, j, w, B, J]), ce(() => {
2639
+ u && u({
2609
2640
  cancelButton: t,
2610
- saveButton: $
2641
+ saveButton: S
2611
2642
  });
2612
- }, [m, t, $]), /* @__PURE__ */ e.jsxs(se, { width: "100%", children: [
2643
+ }, [u, t, S]), /* @__PURE__ */ e.jsx(re, { width: "100%", children: /* @__PURE__ */ e.jsxs(Kn, { isView: s, children: [
2613
2644
  /* @__PURE__ */ e.jsx(
2614
- $n,
2645
+ _n,
2615
2646
  {
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
2647
+ name: B,
2648
+ setName: W,
2649
+ actions: l,
2650
+ selectedActionIds: w,
2651
+ setSelectedActionIds: _,
2652
+ availableCategories: L ?? [],
2653
+ selectedCategoryIds: N,
2654
+ setSelectedCategoryIds: Z,
2655
+ description: J,
2656
+ setDescription: D
2626
2657
  }
2627
2658
  ),
2628
- !p && /* @__PURE__ */ e.jsx(oe, { justifyContent: "flex-start", children: /* @__PURE__ */ e.jsxs(Le, { mt: 16, gap: 4, children: [
2659
+ !g && !s && /* @__PURE__ */ e.jsx(oe, { justifyContent: "flex-start", children: /* @__PURE__ */ e.jsxs(Le, { mt: 16, gap: 4, children: [
2629
2660
  /* @__PURE__ */ e.jsx(
2630
- V,
2661
+ ee,
2631
2662
  {
2632
2663
  colorScheme: "gray",
2633
- isDisabled: f || w,
2664
+ isDisabled: y || j,
2634
2665
  onClick: t,
2635
2666
  children: "Cancel"
2636
2667
  }
2637
2668
  ),
2638
2669
  /* @__PURE__ */ e.jsx(
2639
- V,
2670
+ ee,
2640
2671
  {
2641
2672
  colorScheme: "blue",
2642
- isDisabled: f || w || !F || K.trim().split(/\s+/).filter(Boolean).length > 40,
2643
- isLoading: f || w,
2644
- onClick: $,
2673
+ isDisabled: y || j || !B || J.trim().split(/\s+/).filter(Boolean).length > 40,
2674
+ isLoading: y || j,
2675
+ onClick: S,
2645
2676
  children: "Save"
2646
2677
  }
2647
2678
  )
2648
2679
  ] }) })
2649
- ] });
2680
+ ] }) });
2650
2681
  };
2651
2682
  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
2683
+ En as ActivityList,
2684
+ us as CopyActivityForm,
2685
+ hs as CopyModuleForm,
2686
+ _n as ModuleForm,
2687
+ Wn as ParameterEditList,
2688
+ pt as ParameterEditSelect,
2689
+ ms as UpsertActivityForm,
2690
+ ps as UpsertModuleForm
2660
2691
  };