@nivaro/react 0.3.48 → 0.3.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/shared/components/CellCopyLayer.js +81 -44
  4. package/dist/shared/components/CollectionBrowserView.js +306 -297
  5. package/dist/shared/components/DataTable.js +3 -3
  6. package/dist/shared/components/FulfilmentPill.js +98 -78
  7. package/dist/shared/components/ItemEditForm.js +2830 -2815
  8. package/dist/shared/components/NotificationSourcesCard.js +151 -147
  9. package/dist/shared/components/ProfileView.js +72 -70
  10. package/dist/shared/components/QueryTable.js +3 -3
  11. package/dist/shared/components/imports/ImportConsole.js +4 -4
  12. package/dist/shared/components/integrations/console/IntegrationsConsole.js +58 -50
  13. package/dist/shared/components/item-edit/HeaderTools.js +118 -113
  14. package/dist/shared/components/item-edit/InlineTableField.js +874 -868
  15. package/dist/shared/components/layout-editor/settings/ResolveSettings.js +65 -65
  16. package/dist/shared/components/layout-editor/settings/settings-registry.js +4 -4
  17. package/dist/shared/components/notifications/DeliveryChips.js +9 -9
  18. package/dist/shared/components/panels/PipelinePanel.js +73 -71
  19. package/dist/shared/components/panels/SlaBreachBanner.js +2 -2
  20. package/dist/shared/components/panels/TransitionRequirementsDialog.js +384 -380
  21. package/dist/shared/components/profile/PersonProfile.js +23 -21
  22. package/dist/shared/components/profile/SignedInDevices.js +126 -0
  23. package/dist/shared/components/queue/QueueItemSheet.js +38 -37
  24. package/dist/shared/components/support/SupportView.js +1 -1
  25. package/dist/shared/lib/edit-lock-fields.js +7 -0
  26. package/dist/shared/lib/reimport-visibility.js +10 -0
  27. package/package.json +1 -1
@@ -1,18 +1,19 @@
1
- import { jsx as r, jsxs as m, Fragment as ge } from "react/jsx-runtime";
2
- import { useQueryClient as xe, useQuery as oe } from "@tanstack/react-query";
3
- import { AlertCircle as z, CopyPlus as ye, Loader2 as Q, ChevronDown as ce, Check as de, Paperclip as Z, X as ke } from "lucide-react";
4
- import { useState as D, useRef as P, Fragment as we, useEffect as ue, useLayoutEffect as ve } from "react";
5
- import { createPortal as Ne } from "react-dom";
1
+ import { jsx as l, jsxs as h, Fragment as ye } from "react/jsx-runtime";
2
+ import { useQueryClient as ke, useQuery as ce } from "@tanstack/react-query";
3
+ import { AlertCircle as z, CopyPlus as we, Loader2 as H, ChevronDown as de, Check as ue, Paperclip as ee, X as ve } from "lucide-react";
4
+ import { useState as R, useRef as F, Fragment as Ne, useEffect as me, useLayoutEffect as _e } from "react";
5
+ import { createPortal as Se } from "react-dom";
6
6
  import { useNivaroClient as I } from "../../context.js";
7
- import { get as U, patch as ee, del as te, post as ne } from "../../lib/commands.js";
8
- import { cn as R } from "../../lib/utils.js";
9
- import { Button as H } from "../ui/button.js";
10
- import { Dialog as _e, DialogContent as Se, DialogHeader as Ae, DialogTitle as Ce, DialogBody as je, DialogFooter as $e } from "../ui/dialog.js";
11
- import { Input as V } from "../ui/input.js";
12
- function O(i, u) {
7
+ import { get as T, patch as te, del as ne, post as re } from "../../lib/commands.js";
8
+ import { cn as O } from "../../lib/utils.js";
9
+ import { Button as W } from "../ui/button.js";
10
+ import { Dialog as Ae, DialogContent as Ce, DialogHeader as je, DialogTitle as $e, DialogBody as qe, DialogFooter as Ee } from "../ui/dialog.js";
11
+ import { Input as U } from "../ui/input.js";
12
+ const Le = "x-nivaro-requirements-for";
13
+ function D(i, u) {
13
14
  return `${i}::${String(u)}`;
14
15
  }
15
- const qe = [
16
+ const Re = [
16
17
  "integer",
17
18
  "bigInteger",
18
19
  "float",
@@ -28,447 +29,450 @@ const qe = [
28
29
  "double",
29
30
  "number"
30
31
  ];
31
- function re(i, u) {
32
- if (u && qe.includes(u)) {
33
- const h = Number(i.trim());
34
- if (!Number.isNaN(h)) return h;
32
+ function le(i, u) {
33
+ if (u && Re.includes(u)) {
34
+ const b = Number(i.trim());
35
+ if (!Number.isNaN(b)) return b;
35
36
  }
36
37
  return i;
37
38
  }
38
- function W(i) {
39
+ function J(i) {
39
40
  return i == null ? "" : String(i);
40
41
  }
41
- function le(i, u) {
42
- const h = W(i);
43
- if (!u || h === "") return h;
44
- const v = Number(h);
45
- return Number.isNaN(v) ? h : u === "currency" ? v.toLocaleString("en-US", { style: "currency", currency: "USD" }) : v.toLocaleString("en-US");
42
+ function ie(i, u) {
43
+ const b = J(i);
44
+ if (!u || b === "") return b;
45
+ const _ = Number(b);
46
+ return Number.isNaN(_) ? b : u === "currency" ? _.toLocaleString("en-US", { style: "currency", currency: "USD" }) : _.toLocaleString("en-US");
46
47
  }
47
- const J = (i) => i.kind === "m2m" || i.kind === "files";
48
- function K(i) {
49
- return O(i.collection, `record:${i.item}`);
48
+ const X = (i) => i.kind === "m2m" || i.kind === "files";
49
+ function M(i) {
50
+ return D(i.collection, `record:${i.item}`);
50
51
  }
51
- function ie(i, u = !1) {
52
- var v;
53
- const h = {};
54
- for (const b of i) {
55
- if (b.type === "record_fields") {
56
- const f = {};
57
- for (const x of b.fields) {
58
- const c = b.values[x.field];
59
- f[x.field] = J(x) ? Array.isArray(c) ? c.map(String) : [] : W(c);
52
+ function se(i, u = !1) {
53
+ var _;
54
+ const b = {};
55
+ for (const m of i) {
56
+ if (m.type === "record_fields") {
57
+ const v = {};
58
+ for (const f of m.fields) {
59
+ const p = m.values[f.field];
60
+ v[f.field] = X(f) ? Array.isArray(p) ? p.map(String) : [] : J(p);
60
61
  }
61
- h[K(b)] = f;
62
+ b[M(m)] = v;
62
63
  continue;
63
64
  }
64
- for (const f of b.rows) {
65
- const x = {};
66
- for (const c of b.fields) {
67
- let y = c.kind === "m2m" ? Array.isArray(f.values[c.field]) ? f.values[c.field].map(String) : [] : W(f.values[c.field]);
68
- if (u && ((v = b.prefill_values) == null ? void 0 : v[c.field]) != null) {
69
- const $ = b.prefill_values[c.field];
70
- c.kind === "m2m" && Array.isArray(y) && y.length === 0 ? y = [String($)] : c.kind !== "m2m" && y === "" && (y = String($));
65
+ for (const v of m.rows) {
66
+ const f = {};
67
+ for (const p of m.fields) {
68
+ let d = p.kind === "m2m" ? Array.isArray(v.values[p.field]) ? v.values[p.field].map(String) : [] : J(v.values[p.field]);
69
+ if (u && ((_ = m.prefill_values) == null ? void 0 : _[p.field]) != null) {
70
+ const q = m.prefill_values[p.field];
71
+ p.kind === "m2m" && Array.isArray(d) && d.length === 0 ? d = [String(q)] : p.kind !== "m2m" && d === "" && (d = String(q));
71
72
  }
72
- x[c.field] = y;
73
+ f[p.field] = d;
73
74
  }
74
- h[O(b.collection, f.id)] = x;
75
+ b[D(m.collection, v.id)] = f;
75
76
  }
76
77
  }
77
- return h;
78
+ return b;
78
79
  }
79
- function Ee(i) {
80
+ function De(i) {
80
81
  if (Array.isArray(i)) {
81
82
  const u = {};
82
- for (const h of i)
83
- (h == null ? void 0 : h.id) != null && (u[String(h.id)] = String(h.name ?? h.id));
83
+ for (const b of i)
84
+ (b == null ? void 0 : b.id) != null && (u[String(b.id)] = String(b.name ?? b.id));
84
85
  return u;
85
86
  }
86
87
  return typeof i == "string" ? { __single__: i } : {};
87
88
  }
88
- function Le({
89
+ function Oe({
89
90
  multiple: i,
90
91
  ids: u,
91
- initialNames: h,
92
- onChange: v
92
+ initialNames: b,
93
+ onChange: _
93
94
  }) {
94
- const b = I(), f = P(null), [x, c] = D({}), [y, $] = D(!1), [k, d] = D(null), p = (N) => x[N] ?? h[N] ?? (i ? void 0 : h.__single__) ?? N;
95
- async function q(N) {
96
- if (!(N != null && N.length)) return;
97
- $(!0), d(null);
95
+ const m = I(), v = F(null), [f, p] = R({}), [d, q] = R(!1), [w, c] = R(null), x = (y) => f[y] ?? b[y] ?? (i ? void 0 : b.__single__) ?? y;
96
+ async function C(y) {
97
+ if (!(y != null && y.length)) return;
98
+ q(!0), c(null);
98
99
  const E = [];
99
100
  try {
100
- for (const L of Array.from(N).slice(0, i ? 20 : 1)) {
101
- const T = await b.upload(L), F = String(T.id);
102
- E.push(F), c((M) => ({ ...M, [F]: L.name }));
101
+ for (const P of Array.from(y).slice(0, i ? 20 : 1)) {
102
+ const V = await m.upload(P), L = String(V.id);
103
+ E.push(L), p((B) => ({ ...B, [L]: P.name }));
103
104
  }
104
105
  } catch {
105
- d("A file could not be uploaded");
106
+ c("A file could not be uploaded");
106
107
  } finally {
107
- $(!1), f.current && (f.current.value = "");
108
+ q(!1), v.current && (v.current.value = "");
108
109
  }
109
- E.length && v(i ? [...u, ...E] : E.slice(0, 1));
110
+ E.length && _(i ? [...u, ...E] : E.slice(0, 1));
110
111
  }
111
- return /* @__PURE__ */ m("div", { className: "space-y-1.5", "data-requirement-file": i ? "files" : "file", children: [
112
- u.length > 0 && /* @__PURE__ */ r("ul", { className: "space-y-1", children: u.map((N) => /* @__PURE__ */ m(
112
+ return /* @__PURE__ */ h("div", { className: "space-y-1.5", "data-requirement-file": i ? "files" : "file", children: [
113
+ u.length > 0 && /* @__PURE__ */ l("ul", { className: "space-y-1", children: u.map((y) => /* @__PURE__ */ h(
113
114
  "li",
114
115
  {
115
116
  className: "flex items-center gap-1.5 rounded border border-slate-200 px-2 py-1 text-[12px] text-slate-700 dark:border-border dark:text-slate-200",
116
117
  children: [
117
- /* @__PURE__ */ r(Z, { className: "h-3 w-3 shrink-0 text-slate-400" }),
118
- /* @__PURE__ */ r("span", { className: "min-w-0 flex-1 truncate", children: p(N) }),
119
- /* @__PURE__ */ r(
118
+ /* @__PURE__ */ l(ee, { className: "h-3 w-3 shrink-0 text-slate-400" }),
119
+ /* @__PURE__ */ l("span", { className: "min-w-0 flex-1 truncate", children: x(y) }),
120
+ /* @__PURE__ */ l(
120
121
  "button",
121
122
  {
122
123
  type: "button",
123
- "aria-label": `Remove ${p(N)}`,
124
- onClick: () => v(u.filter((E) => E !== N)),
124
+ "aria-label": `Remove ${x(y)}`,
125
+ onClick: () => _(u.filter((E) => E !== y)),
125
126
  className: "rounded p-0.5 text-slate-400 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted",
126
- children: /* @__PURE__ */ r(ke, { className: "h-3 w-3" })
127
+ children: /* @__PURE__ */ l(ve, { className: "h-3 w-3" })
127
128
  }
128
129
  )
129
130
  ]
130
131
  },
131
- N
132
+ y
132
133
  )) }),
133
- (i || u.length === 0) && /* @__PURE__ */ m(ge, { children: [
134
- /* @__PURE__ */ r(
134
+ (i || u.length === 0) && /* @__PURE__ */ h(ye, { children: [
135
+ /* @__PURE__ */ l(
135
136
  "input",
136
137
  {
137
- ref: f,
138
+ ref: v,
138
139
  type: "file",
139
140
  multiple: i,
140
141
  className: "hidden",
141
- onChange: (N) => void q(N.target.files)
142
+ onChange: (y) => void C(y.target.files)
142
143
  }
143
144
  ),
144
- /* @__PURE__ */ m(
145
- H,
145
+ /* @__PURE__ */ h(
146
+ W,
146
147
  {
147
148
  type: "button",
148
149
  variant: "outline",
149
150
  size: "sm",
150
- disabled: y,
151
+ disabled: d,
151
152
  onClick: () => {
152
- var N;
153
- return (N = f.current) == null ? void 0 : N.click();
153
+ var y;
154
+ return (y = v.current) == null ? void 0 : y.click();
154
155
  },
155
156
  className: "h-8 gap-1.5 text-[12px]",
156
157
  "data-requirement-upload": !0,
157
158
  children: [
158
- y ? /* @__PURE__ */ r(Q, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ r(Z, { className: "h-3.5 w-3.5" }),
159
- y ? "Uploading…" : i ? "Add files" : "Upload a file"
159
+ d ? /* @__PURE__ */ l(H, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ l(ee, { className: "h-3.5 w-3.5" }),
160
+ d ? "Uploading…" : i ? "Add files" : "Upload a file"
160
161
  ]
161
162
  }
162
163
  )
163
164
  ] }),
164
- k && /* @__PURE__ */ r("p", { className: "text-[11px] text-red-600", children: k })
165
+ w && /* @__PURE__ */ l("p", { className: "text-[11px] text-red-600", children: w })
165
166
  ] });
166
167
  }
167
- function me({
168
+ function fe({
168
169
  anchor: i,
169
170
  panelRef: u,
170
- children: h
171
+ children: b
171
172
  }) {
172
- const v = i.closest('[role="dialog"]'), [b, f] = D(null);
173
- return ve(() => {
174
- if (!v) return;
175
- const x = () => {
176
- const c = i.getBoundingClientRect(), y = v.getBoundingClientRect(), $ = c.bottom + 208 > window.innerHeight && c.top > 216;
177
- f(
178
- $ ? { bottom: y.bottom - c.top + 4, left: c.left - y.left, width: c.width } : { top: c.bottom - y.top + 4, left: c.left - y.left, width: c.width }
173
+ const _ = i.closest('[role="dialog"]'), [m, v] = R(null);
174
+ return _e(() => {
175
+ if (!_) return;
176
+ const f = () => {
177
+ const p = i.getBoundingClientRect(), d = _.getBoundingClientRect(), q = p.bottom + 208 > window.innerHeight && p.top > 216;
178
+ v(
179
+ q ? { bottom: d.bottom - p.top + 4, left: p.left - d.left, width: p.width } : { top: p.bottom - d.top + 4, left: p.left - d.left, width: p.width }
179
180
  );
180
181
  };
181
- return x(), window.addEventListener("scroll", x, !0), window.addEventListener("resize", x), () => {
182
- window.removeEventListener("scroll", x, !0), window.removeEventListener("resize", x);
182
+ return f(), window.addEventListener("scroll", f, !0), window.addEventListener("resize", f), () => {
183
+ window.removeEventListener("scroll", f, !0), window.removeEventListener("resize", f);
183
184
  };
184
- }, [i, v]), !b || !v ? null : Ne(
185
- /* @__PURE__ */ r(
185
+ }, [i, _]), !m || !_ ? null : Se(
186
+ /* @__PURE__ */ l(
186
187
  "div",
187
188
  {
188
189
  ref: u,
189
190
  role: "listbox",
190
191
  className: "absolute z-[120] max-h-48 w-56 overflow-y-auto rounded-md border border-slate-200 bg-white py-1 shadow-lg dark:border-border dark:bg-card",
191
- style: { top: b.top, bottom: b.bottom, left: b.left, minWidth: b.width },
192
- children: h
192
+ style: { top: m.top, bottom: m.bottom, left: m.left, minWidth: m.width },
193
+ children: b
193
194
  }
194
195
  ),
195
- v
196
+ _
196
197
  );
197
198
  }
198
- function se({
199
+ function ae({
199
200
  meta: i,
200
201
  selected: u,
201
- onChange: h
202
+ onChange: b
202
203
  }) {
203
- const v = I(), [b, f] = D(!1), x = P(null), c = P(null), { data: y = [] } = oe({
204
+ const _ = I(), [m, v] = R(!1), f = F(null), p = F(null), { data: d = [] } = ce({
204
205
  queryKey: ["req-m2m-options", i.related_collection],
205
- queryFn: () => v.request(
206
- U(`/items/${i.related_collection}`, { limit: 500 })
206
+ queryFn: () => _.request(
207
+ T(`/items/${i.related_collection}`, { limit: 500 })
207
208
  ).then(
208
- (k) => (k.data ?? []).map((d) => ({
209
- id: String(d.id),
210
- label: String(d.name ?? d.title ?? d.label ?? d.short_name ?? d.id)
209
+ (w) => (w.data ?? []).map((c) => ({
210
+ id: String(c.id),
211
+ label: String(c.name ?? c.title ?? c.label ?? c.short_name ?? c.id)
211
212
  }))
212
213
  ).catch(() => []),
213
214
  enabled: !!i.related_collection,
214
215
  staleTime: 3e5
215
216
  });
216
- ue(() => {
217
- if (!b) return;
218
- const k = (d) => {
219
- var q, N;
220
- const p = d.target;
221
- (q = x.current) != null && q.contains(p) || (N = c.current) != null && N.contains(p) || f(!1);
217
+ me(() => {
218
+ if (!m) return;
219
+ const w = (c) => {
220
+ var C, y;
221
+ const x = c.target;
222
+ (C = f.current) != null && C.contains(x) || (y = p.current) != null && y.contains(x) || v(!1);
222
223
  };
223
- return window.addEventListener("mousedown", k), () => window.removeEventListener("mousedown", k);
224
- }, [b]);
225
- const $ = u.length === 0 ? `Select ${i.label.toLowerCase()}…` : u.map((k) => {
226
- var d;
227
- return ((d = y.find((p) => p.id === k)) == null ? void 0 : d.label) ?? k;
224
+ return window.addEventListener("mousedown", w), () => window.removeEventListener("mousedown", w);
225
+ }, [m]);
226
+ const q = u.length === 0 ? `Select ${i.label.toLowerCase()}…` : u.map((w) => {
227
+ var c;
228
+ return ((c = d.find((x) => x.id === w)) == null ? void 0 : c.label) ?? w;
228
229
  }).join(", ");
229
- return /* @__PURE__ */ m("div", { ref: x, className: "relative", children: [
230
- /* @__PURE__ */ m(
230
+ return /* @__PURE__ */ h("div", { ref: f, className: "relative", children: [
231
+ /* @__PURE__ */ h(
231
232
  "button",
232
233
  {
233
234
  type: "button",
234
- onClick: () => f((k) => !k),
235
+ onClick: () => v((w) => !w),
235
236
  "aria-haspopup": "listbox",
236
- "aria-expanded": b,
237
- className: R(
237
+ "aria-expanded": m,
238
+ className: O(
238
239
  "flex h-8 w-full min-w-[10rem] items-center justify-between gap-1 rounded-md border border-slate-200 bg-white px-2 text-left text-[12px] dark:border-border dark:bg-card",
239
240
  u.length === 0 && "text-slate-400"
240
241
  ),
241
242
  children: [
242
- /* @__PURE__ */ r("span", { className: "truncate", children: $ }),
243
- /* @__PURE__ */ r(ce, { className: "h-3 w-3 shrink-0 text-slate-400" })
243
+ /* @__PURE__ */ l("span", { className: "truncate", children: q }),
244
+ /* @__PURE__ */ l(de, { className: "h-3 w-3 shrink-0 text-slate-400" })
244
245
  ]
245
246
  }
246
247
  ),
247
- b && x.current && /* @__PURE__ */ m(me, { anchor: x.current, panelRef: c, children: [
248
- y.map((k) => {
249
- const d = u.includes(k.id), p = i.max_values === 1;
250
- return /* @__PURE__ */ m(
248
+ m && f.current && /* @__PURE__ */ h(fe, { anchor: f.current, panelRef: p, children: [
249
+ d.map((w) => {
250
+ const c = u.includes(w.id), x = i.max_values === 1;
251
+ return /* @__PURE__ */ h(
251
252
  "button",
252
253
  {
253
254
  type: "button",
254
255
  role: "option",
255
- "aria-selected": d,
256
+ "aria-selected": c,
256
257
  onClick: () => {
257
- if (p) {
258
- h([k.id]), f(!1);
258
+ if (x) {
259
+ b([w.id]), v(!1);
259
260
  return;
260
261
  }
261
- h(d ? u.filter((q) => q !== k.id) : [...u, k.id]);
262
+ b(c ? u.filter((C) => C !== w.id) : [...u, w.id]);
262
263
  },
263
- className: R(
264
+ className: O(
264
265
  "flex w-full items-center justify-between px-2.5 py-1.5 text-left text-[12px] hover:bg-slate-50 dark:hover:bg-muted/50",
265
- d ? "font-semibold text-nvr-navy dark:text-nvr-cyan" : "text-slate-700 dark:text-slate-200"
266
+ c ? "font-semibold text-nvr-navy dark:text-nvr-cyan" : "text-slate-700 dark:text-slate-200"
266
267
  ),
267
268
  children: [
268
- /* @__PURE__ */ r("span", { className: "truncate", children: k.label }),
269
- d && /* @__PURE__ */ r(de, { className: "h-3 w-3 shrink-0" })
269
+ /* @__PURE__ */ l("span", { className: "truncate", children: w.label }),
270
+ c && /* @__PURE__ */ l(ue, { className: "h-3 w-3 shrink-0" })
270
271
  ]
271
272
  },
272
- k.id
273
+ w.id
273
274
  );
274
275
  }),
275
- y.length === 0 && /* @__PURE__ */ r("p", { className: "px-2.5 py-2 text-[11px] text-slate-400", children: "No options" })
276
+ d.length === 0 && /* @__PURE__ */ l("p", { className: "px-2.5 py-2 text-[11px] text-slate-400", children: "No options" })
276
277
  ] })
277
278
  ] });
278
279
  }
279
- function ae({
280
+ function oe({
280
281
  meta: i,
281
282
  selected: u,
282
- onChange: h
283
+ onChange: b
283
284
  }) {
284
- var k;
285
- const v = I(), [b, f] = D(!1), x = P(null), c = P(null), { data: y = [] } = oe({
285
+ var w;
286
+ const _ = I(), [m, v] = R(!1), f = F(null), p = F(null), { data: d = [] } = ce({
286
287
  queryKey: ["req-m2m-options", i.related_collection],
287
- queryFn: () => v.request(
288
- U(`/items/${i.related_collection}`, { limit: 500 })
288
+ queryFn: () => _.request(
289
+ T(`/items/${i.related_collection}`, { limit: 500 })
289
290
  ).then(
290
- (d) => (d.data ?? []).map((p) => ({
291
- id: String(p.id),
292
- label: String(p.name ?? p.title ?? p.label ?? p.short_name ?? p.id)
291
+ (c) => (c.data ?? []).map((x) => ({
292
+ id: String(x.id),
293
+ label: String(x.name ?? x.title ?? x.label ?? x.short_name ?? x.id)
293
294
  }))
294
295
  ).catch(() => []),
295
296
  enabled: !!i.related_collection,
296
297
  staleTime: 3e5
297
298
  });
298
- ue(() => {
299
- if (!b) return;
300
- const d = (p) => {
301
- var N, E;
302
- const q = p.target;
303
- (N = x.current) != null && N.contains(q) || (E = c.current) != null && E.contains(q) || f(!1);
299
+ me(() => {
300
+ if (!m) return;
301
+ const c = (x) => {
302
+ var y, E;
303
+ const C = x.target;
304
+ (y = f.current) != null && y.contains(C) || (E = p.current) != null && E.contains(C) || v(!1);
304
305
  };
305
- return window.addEventListener("mousedown", d), () => window.removeEventListener("mousedown", d);
306
- }, [b]);
307
- const $ = u ? ((k = y.find((d) => d.id === u)) == null ? void 0 : k.label) ?? u : `Select ${i.label.toLowerCase()}…`;
308
- return /* @__PURE__ */ m("div", { ref: x, className: "relative", children: [
309
- /* @__PURE__ */ m(
306
+ return window.addEventListener("mousedown", c), () => window.removeEventListener("mousedown", c);
307
+ }, [m]);
308
+ const q = u ? ((w = d.find((c) => c.id === u)) == null ? void 0 : w.label) ?? u : `Select ${i.label.toLowerCase()}…`;
309
+ return /* @__PURE__ */ h("div", { ref: f, className: "relative", children: [
310
+ /* @__PURE__ */ h(
310
311
  "button",
311
312
  {
312
313
  type: "button",
313
- onClick: () => f((d) => !d),
314
+ onClick: () => v((c) => !c),
314
315
  "aria-haspopup": "listbox",
315
- "aria-expanded": b,
316
- className: R(
316
+ "aria-expanded": m,
317
+ className: O(
317
318
  "flex h-8 w-full min-w-[10rem] items-center justify-between gap-1 rounded-md border border-slate-200 bg-white px-2 text-left text-[12px] dark:border-border dark:bg-card",
318
319
  !u && "text-slate-400"
319
320
  ),
320
321
  children: [
321
- /* @__PURE__ */ r("span", { className: "truncate", children: $ }),
322
- /* @__PURE__ */ r(ce, { className: "h-3 w-3 shrink-0 text-slate-400" })
322
+ /* @__PURE__ */ l("span", { className: "truncate", children: q }),
323
+ /* @__PURE__ */ l(de, { className: "h-3 w-3 shrink-0 text-slate-400" })
323
324
  ]
324
325
  }
325
326
  ),
326
- b && x.current && /* @__PURE__ */ m(me, { anchor: x.current, panelRef: c, children: [
327
- y.map((d) => {
328
- const p = u === d.id;
329
- return /* @__PURE__ */ m(
327
+ m && f.current && /* @__PURE__ */ h(fe, { anchor: f.current, panelRef: p, children: [
328
+ d.map((c) => {
329
+ const x = u === c.id;
330
+ return /* @__PURE__ */ h(
330
331
  "button",
331
332
  {
332
333
  type: "button",
333
334
  role: "option",
334
- "aria-selected": p,
335
+ "aria-selected": x,
335
336
  onClick: () => {
336
- h(d.id), f(!1);
337
+ b(c.id), v(!1);
337
338
  },
338
- className: R(
339
+ className: O(
339
340
  "flex w-full items-center justify-between px-2.5 py-1.5 text-left text-[12px] hover:bg-slate-50 dark:hover:bg-muted/50",
340
- p ? "font-semibold text-nvr-navy dark:text-nvr-cyan" : "text-slate-700 dark:text-slate-200"
341
+ x ? "font-semibold text-nvr-navy dark:text-nvr-cyan" : "text-slate-700 dark:text-slate-200"
341
342
  ),
342
343
  children: [
343
- /* @__PURE__ */ r("span", { className: "truncate", children: d.label }),
344
- p && /* @__PURE__ */ r(de, { className: "h-3 w-3 shrink-0" })
344
+ /* @__PURE__ */ l("span", { className: "truncate", children: c.label }),
345
+ x && /* @__PURE__ */ l(ue, { className: "h-3 w-3 shrink-0" })
345
346
  ]
346
347
  },
347
- d.id
348
+ c.id
348
349
  );
349
350
  }),
350
- y.length === 0 && /* @__PURE__ */ r("p", { className: "px-2.5 py-2 text-[11px] text-slate-400", children: "No options" })
351
+ d.length === 0 && /* @__PURE__ */ l("p", { className: "px-2.5 py-2 text-[11px] text-slate-400", children: "No options" })
351
352
  ] })
352
353
  ] });
353
354
  }
354
- function Be({
355
+ function He({
355
356
  payload: i,
356
- isRetry: u,
357
- onSubmitted: h,
358
- executing: v = !1,
359
- onClose: b
357
+ transitionId: u,
358
+ isRetry: b,
359
+ onSubmitted: _,
360
+ executing: m = !1,
361
+ onClose: v
360
362
  }) {
361
- var G;
362
- const f = I(), x = xe(), [c, y] = D(
363
- () => ie(i, !0)
364
- ), $ = P(ie(i)), [k, d] = D({}), [p, q] = D(!1), [N, E] = D("save"), L = (l, _, a) => {
365
- y((e) => ({ ...e, [l]: { ...e[l], [_]: a } })), d((e) => {
366
- if (!(l in e)) return e;
363
+ var Z;
364
+ const f = I(), p = ke(), [d, q] = R(
365
+ () => se(i, !0)
366
+ ), w = F(se(i)), [c, x] = R({}), [C, y] = R(!1), [E, P] = R("save"), V = (r) => u ? { ...r, _headers: { [Le]: u } } : r, L = (r, N, a) => {
367
+ q((e) => ({ ...e, [r]: { ...e[r], [N]: a } })), x((e) => {
368
+ if (!(r in e)) return e;
367
369
  const t = { ...e };
368
- return delete t[l], t;
370
+ return delete t[r], t;
369
371
  });
370
- }, T = (l, _) => {
371
- const a = l.rows.map((e) => {
372
+ }, B = (r, N) => {
373
+ const a = r.rows.map((e) => {
372
374
  var t;
373
- return (t = c[O(l.collection, e.id)]) == null ? void 0 : t[_.field];
375
+ return (t = d[D(r.collection, e.id)]) == null ? void 0 : t[N.field];
374
376
  }).find(
375
- (e) => _.kind === "m2m" ? Array.isArray(e) && e.length > 0 : typeof e == "string" && e.trim()
377
+ (e) => N.kind === "m2m" ? Array.isArray(e) && e.length > 0 : typeof e == "string" && e.trim()
376
378
  );
377
- a != null && (y((e) => {
379
+ a != null && (q((e) => {
378
380
  const t = { ...e };
379
- for (const n of l.rows) {
380
- const g = O(l.collection, n.id);
381
- t[g] = { ...t[g], [_.field]: Array.isArray(a) ? [...a] : a };
381
+ for (const n of r.rows) {
382
+ const g = D(r.collection, n.id);
383
+ t[g] = { ...t[g], [N.field]: Array.isArray(a) ? [...a] : a };
382
384
  }
383
385
  return t;
384
- }), d({}));
385
- }, F = (l, _) => {
386
+ }), x({}));
387
+ }, K = (r, N) => {
386
388
  var g;
387
- const a = _.optional_when;
389
+ const a = N.optional_when;
388
390
  if (!a) return !1;
389
- const e = (g = c[l]) == null ? void 0 : g[a.field], t = new Set(a.in.map(String));
390
- return (Array.isArray(e) ? e : [e]).some((w) => w != null && w !== "" && t.has(String(w)));
391
- }, [M, fe] = D({}), X = (l, _) => {
392
- l.trim() && (y((a) => {
391
+ const e = (g = d[r]) == null ? void 0 : g[a.field], t = new Set(a.in.map(String));
392
+ return (Array.isArray(e) ? e : [e]).some((k) => k != null && k !== "" && t.has(String(k)));
393
+ }, [pe, he] = R({}), Y = (r, N) => {
394
+ r.trim() && (q((a) => {
393
395
  var t;
394
396
  const e = { ...a };
395
397
  for (const n of i) {
396
398
  if (n.type !== "child_fields") continue;
397
- const g = n.fields.find((w) => w.field === _);
399
+ const g = n.fields.find((k) => k.field === N);
398
400
  if (!(!g || g.kind === "m2m"))
399
- for (const w of n.rows) {
400
- const s = O(n.collection, w.id), o = g.optional_when;
401
+ for (const k of n.rows) {
402
+ const s = D(n.collection, k.id), o = g.optional_when;
401
403
  if (o) {
402
- const S = (t = e[s]) == null ? void 0 : t[o.field], C = new Set(o.in.map(String));
403
- if ((Array.isArray(S) ? S : [S]).some((A) => A != null && A !== "" && C.has(String(A)))) continue;
404
+ const S = (t = e[s]) == null ? void 0 : t[o.field], j = new Set(o.in.map(String));
405
+ if ((Array.isArray(S) ? S : [S]).some((A) => A != null && A !== "" && j.has(String(A)))) continue;
404
406
  }
405
- e[s] = { ...e[s], [_]: l };
407
+ e[s] = { ...e[s], [N]: r };
406
408
  }
407
409
  }
408
410
  return e;
409
- }), d({}));
410
- }, pe = i.some((l) => {
411
- if (l.type === "record_fields") {
412
- if (l.optional) return !1;
413
- const _ = K(l);
414
- return l.fields.some((a) => {
411
+ }), x({}));
412
+ }, be = i.some((r) => {
413
+ if (r.type === "record_fields") {
414
+ if (r.optional) return !1;
415
+ const N = M(r);
416
+ return r.fields.some((a) => {
415
417
  var t;
416
- if (F(_, a)) return !1;
417
- const e = (t = c[_]) == null ? void 0 : t[a.field];
418
- return J(a) ? !Array.isArray(e) || e.length === 0 : !(typeof e == "string" ? e : "").trim();
418
+ if (K(N, a)) return !1;
419
+ const e = (t = d[N]) == null ? void 0 : t[a.field];
420
+ return X(a) ? !Array.isArray(e) || e.length === 0 : !(typeof e == "string" ? e : "").trim();
419
421
  });
420
422
  }
421
- return l.rows.some((_) => {
422
- const a = O(l.collection, _.id);
423
- return l.fields.some((e) => {
423
+ return r.rows.some((N) => {
424
+ const a = D(r.collection, N.id);
425
+ return r.fields.some((e) => {
424
426
  var n;
425
- if (F(a, e)) return !1;
426
- const t = (n = c[a]) == null ? void 0 : n[e.field];
427
+ if (K(a, e)) return !1;
428
+ const t = (n = d[a]) == null ? void 0 : n[e.field];
427
429
  return e.kind === "m2m" ? !Array.isArray(t) || t.length === 0 : !(typeof t == "string" ? t : "").trim();
428
430
  });
429
431
  });
430
- }), Y = ((G = i.find((l) => l.type === "child_fields" && !!l.review)) == null ? void 0 : G.review_message) ?? null, he = async () => {
431
- q(!0);
432
- const l = await Promise.all(
432
+ }), G = ((Z = i.find((r) => r.type === "child_fields" && !!r.review)) == null ? void 0 : Z.review_message) ?? null, ge = async () => {
433
+ y(!0);
434
+ const r = await Promise.all(
433
435
  i.flatMap((a) => {
434
436
  if (a.type === "record_fields") {
435
- const e = K(a);
437
+ const e = M(a);
436
438
  return [
437
439
  (async () => {
438
- const t = c[e] ?? {}, n = $.current[e] ?? {}, g = {}, w = [];
440
+ const t = d[e] ?? {}, n = w.current[e] ?? {}, g = {}, k = [];
439
441
  for (const s of a.fields) {
440
- if (J(s)) {
441
- const o = Array.isArray(t[s.field]) ? t[s.field] : [], S = Array.isArray(n[s.field]) ? n[s.field] : [], C = o.filter((A) => !S.includes(A)), j = S.filter((A) => !o.includes(A));
442
- (C.length > 0 || j.length > 0) && w.push({ meta: s, add: C, remove: j });
442
+ if (X(s)) {
443
+ const o = Array.isArray(t[s.field]) ? t[s.field] : [], S = Array.isArray(n[s.field]) ? n[s.field] : [], j = o.filter((A) => !S.includes(A)), $ = S.filter((A) => !o.includes(A));
444
+ (j.length > 0 || $.length > 0) && k.push({ meta: s, add: j, remove: $ });
443
445
  continue;
444
446
  }
445
- t[s.field] !== n[s.field] && (g[s.field] = s.kind === "m2o" || s.kind === "file" ? String(t[s.field] ?? "") || null : re(String(t[s.field] ?? ""), s.type));
447
+ t[s.field] !== n[s.field] && (g[s.field] = s.kind === "m2o" || s.kind === "file" ? String(t[s.field] ?? "") || null : le(String(t[s.field] ?? ""), s.type));
446
448
  }
447
- if (Object.keys(g).length === 0 && w.length === 0)
449
+ if (Object.keys(g).length === 0 && k.length === 0)
448
450
  return { rk: e, ok: !0 };
449
451
  try {
450
- Object.keys(g).length > 0 && await f.request(ee(`/items/${a.collection}/${a.item}`, g));
451
- for (const { meta: s, add: o, remove: S } of w)
452
+ Object.keys(g).length > 0 && await f.request(
453
+ V(te(`/items/${a.collection}/${a.item}`, g))
454
+ );
455
+ for (const { meta: s, add: o, remove: S } of k)
452
456
  if (!(!s.junction || !s.fk_to_child || !s.junction_field)) {
453
457
  if (S.length > 0) {
454
- const C = await f.request(
455
- U(`/items/${s.junction}`, {
458
+ const j = await f.request(
459
+ T(`/items/${s.junction}`, {
456
460
  limit: 500,
457
461
  filter: JSON.stringify({ [s.fk_to_child]: { _eq: a.item } })
458
462
  })
459
463
  );
460
- for (const j of C.data ?? [])
461
- S.includes(String(j[s.junction_field])) && await f.request(te(`/items/${s.junction}/${j.id}`));
464
+ for (const $ of j.data ?? [])
465
+ S.includes(String($[s.junction_field])) && await f.request(ne(`/items/${s.junction}/${$.id}`));
462
466
  }
463
- for (const C of o)
467
+ for (const j of o)
464
468
  await f.request(
465
- ne(`/items/${s.junction}`, {
469
+ re(`/items/${s.junction}`, {
466
470
  [s.fk_to_child]: a.item,
467
- [s.junction_field]: C
471
+ [s.junction_field]: j
468
472
  })
469
473
  );
470
474
  }
471
- return x.invalidateQueries({
475
+ return p.invalidateQueries({
472
476
  queryKey: ["item", a.collection, String(a.item)]
473
477
  }), { rk: e, ok: !0, saved: { ...n, ...t } };
474
478
  } catch (s) {
@@ -479,130 +483,130 @@ function Be({
479
483
  ];
480
484
  }
481
485
  return a.rows.map(async (e) => {
482
- const t = O(a.collection, e.id), n = c[t] ?? {}, g = $.current[t] ?? {}, w = {}, s = [];
486
+ const t = D(a.collection, e.id), n = d[t] ?? {}, g = w.current[t] ?? {}, k = {}, s = [];
483
487
  for (const o of a.fields) {
484
488
  if (o.kind === "m2m") {
485
- const S = Array.isArray(n[o.field]) ? n[o.field] : [], C = Array.isArray(g[o.field]) ? g[o.field] : [], j = S.filter((B) => !C.includes(B)), A = C.filter((B) => !S.includes(B));
486
- (j.length > 0 || A.length > 0) && s.push({ meta: o, add: j, remove: A });
489
+ const S = Array.isArray(n[o.field]) ? n[o.field] : [], j = Array.isArray(g[o.field]) ? g[o.field] : [], $ = S.filter((Q) => !j.includes(Q)), A = j.filter((Q) => !S.includes(Q));
490
+ ($.length > 0 || A.length > 0) && s.push({ meta: o, add: $, remove: A });
487
491
  continue;
488
492
  }
489
- F(t, o) || n[o.field] !== g[o.field] && (w[o.field] = o.kind === "m2o" ? String(n[o.field] ?? "") || null : re(String(n[o.field] ?? ""), o.type));
493
+ K(t, o) || n[o.field] !== g[o.field] && (k[o.field] = o.kind === "m2o" ? String(n[o.field] ?? "") || null : le(String(n[o.field] ?? ""), o.type));
490
494
  }
491
- if (Object.keys(w).length === 0 && s.length === 0)
495
+ if (Object.keys(k).length === 0 && s.length === 0)
492
496
  return { rk: t, ok: !0 };
493
497
  try {
494
- Object.keys(w).length > 0 && await f.request(ee(`/items/${a.collection}/${e.id}`, w));
495
- for (const { meta: o, add: S, remove: C } of s)
498
+ Object.keys(k).length > 0 && await f.request(V(te(`/items/${a.collection}/${e.id}`, k)));
499
+ for (const { meta: o, add: S, remove: j } of s)
496
500
  if (!(!o.junction || !o.fk_to_child || !o.junction_field)) {
497
- if (C.length > 0) {
498
- const j = await f.request(
499
- U(`/items/${o.junction}`, {
501
+ if (j.length > 0) {
502
+ const $ = await f.request(
503
+ T(`/items/${o.junction}`, {
500
504
  limit: 500,
501
505
  filter: JSON.stringify({ [o.fk_to_child]: { _eq: e.id } })
502
506
  })
503
507
  );
504
- for (const A of j.data ?? [])
505
- C.includes(String(A[o.junction_field])) && await f.request(te(`/items/${o.junction}/${A.id}`));
508
+ for (const A of $.data ?? [])
509
+ j.includes(String(A[o.junction_field])) && await f.request(ne(`/items/${o.junction}/${A.id}`));
506
510
  }
507
- for (const j of S)
511
+ for (const $ of S)
508
512
  await f.request(
509
- ne(`/items/${o.junction}`, {
513
+ re(`/items/${o.junction}`, {
510
514
  [o.fk_to_child]: e.id,
511
- [o.junction_field]: j
515
+ [o.junction_field]: $
512
516
  })
513
517
  );
514
518
  }
515
- return x.invalidateQueries({ queryKey: ["item", a.collection, String(e.id)] }), { rk: t, ok: !0, saved: { ...g, ...n } };
519
+ return p.invalidateQueries({ queryKey: ["item", a.collection, String(e.id)] }), { rk: t, ok: !0, saved: { ...g, ...n } };
516
520
  } catch (o) {
517
521
  const S = o == null ? void 0 : o.response;
518
522
  return { rk: t, ok: !1, error: (S == null ? void 0 : S.error) ?? "Failed to save" };
519
523
  }
520
524
  });
521
525
  })
522
- ), _ = l.filter((a) => !a.ok);
523
- for (const a of l)
524
- a.ok && a.saved && ($.current[a.rk] = a.saved);
525
- if (_.length > 0) {
526
- q(!1), d(Object.fromEntries(_.map((a) => [a.rk, a.ok ? "" : a.error])));
526
+ ), N = r.filter((a) => !a.ok);
527
+ for (const a of r)
528
+ a.ok && a.saved && (w.current[a.rk] = a.saved);
529
+ if (N.length > 0) {
530
+ y(!1), x(Object.fromEntries(N.map((a) => [a.rk, a.ok ? "" : a.error])));
527
531
  return;
528
532
  }
529
- d({}), E("transition");
533
+ x({}), P("transition");
530
534
  try {
531
- await h();
535
+ await _();
532
536
  } catch {
533
537
  } finally {
534
- q(!1), E("save");
538
+ y(!1), P("save");
535
539
  }
536
- }, be = i.length === 1 && i[0].title ? i[0].title : "Required before continuing";
537
- return /* @__PURE__ */ r(_e, { open: !0, onOpenChange: (l) => !l && !p && !v && b(), children: /* @__PURE__ */ m(
538
- Se,
540
+ }, xe = i.length === 1 && i[0].title ? i[0].title : "Required before continuing";
541
+ return /* @__PURE__ */ l(Ae, { open: !0, onOpenChange: (r) => !r && !C && !m && v(), children: /* @__PURE__ */ h(
542
+ Ce,
539
543
  {
540
- className: R(
544
+ className: O(
541
545
  "max-w-2xl",
542
546
  i.some(
543
- (l) => l.type === "child_fields" && (l.display_fields ?? []).length + l.fields.length > 3
547
+ (r) => r.type === "child_fields" && (r.display_fields ?? []).length + r.fields.length > 3
544
548
  ) && "max-w-5xl"
545
549
  ),
546
550
  style: (() => {
547
- var _;
548
- const l = (_ = i.find(
551
+ var N;
552
+ const r = (N = i.find(
549
553
  (a) => a.type === "child_fields" && !!a.width
550
- )) == null ? void 0 : _.width;
551
- return l ? { width: l, maxWidth: l } : void 0;
554
+ )) == null ? void 0 : N.width;
555
+ return r ? { width: r, maxWidth: r } : void 0;
552
556
  })(),
553
557
  children: [
554
- /* @__PURE__ */ r(Ae, { children: /* @__PURE__ */ r(Ce, { className: "text-[15px]", children: be }) }),
555
- /* @__PURE__ */ m(
556
- je,
558
+ /* @__PURE__ */ l(je, { children: /* @__PURE__ */ l($e, { className: "text-[15px]", children: xe }) }),
559
+ /* @__PURE__ */ h(
560
+ qe,
557
561
  {
558
- className: R(
562
+ className: O(
559
563
  "max-h-[60vh] space-y-5 overflow-y-auto",
560
- (p || v) && "pointer-events-none opacity-60 transition-opacity"
564
+ (C || m) && "pointer-events-none opacity-60 transition-opacity"
561
565
  ),
562
566
  children: [
563
- u && /* @__PURE__ */ m("p", { className: "flex items-center gap-2 rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-[12px] text-amber-700 dark:border-amber-500/20 dark:bg-amber-500/10 dark:text-amber-400", children: [
564
- /* @__PURE__ */ r("span", { className: "h-1.5 w-1.5 shrink-0 rounded-full bg-amber-400" }),
567
+ b && /* @__PURE__ */ h("p", { className: "flex items-center gap-2 rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-[12px] text-amber-700 dark:border-amber-500/20 dark:bg-amber-500/10 dark:text-amber-400", children: [
568
+ /* @__PURE__ */ l("span", { className: "h-1.5 w-1.5 shrink-0 rounded-full bg-amber-400" }),
565
569
  "Values changed since your last attempt — review the highlighted rows."
566
570
  ] }),
567
- Y && !u && /* @__PURE__ */ m("p", { className: "flex items-center gap-2 rounded-md border border-red-200 bg-red-50 px-3 py-2 text-[12px] text-red-700 dark:border-red-500/20 dark:bg-red-500/10 dark:text-red-400", children: [
568
- /* @__PURE__ */ r(z, { className: "h-3.5 w-3.5 shrink-0" }),
569
- Y
571
+ G && !b && /* @__PURE__ */ h("p", { className: "flex items-center gap-2 rounded-md border border-red-200 bg-red-50 px-3 py-2 text-[12px] text-red-700 dark:border-red-500/20 dark:bg-red-500/10 dark:text-red-400", children: [
572
+ /* @__PURE__ */ l(z, { className: "h-3.5 w-3.5 shrink-0" }),
573
+ G
570
574
  ] }),
571
- i.map((l) => {
572
- if (l.type === "record_fields") {
573
- const e = K(l);
574
- return /* @__PURE__ */ m("div", { className: "space-y-2", children: [
575
- i.length > 1 && /* @__PURE__ */ r("h4", { className: "text-[12px] font-semibold text-slate-500", children: l.title }),
576
- /* @__PURE__ */ r("div", { className: "grid grid-cols-1 gap-3 rounded-md border border-slate-200 p-3 sm:grid-cols-2 dark:border-border", children: l.fields.map((t) => {
577
- var g, w;
578
- const n = (g = c[e]) == null ? void 0 : g[t.field];
579
- return /* @__PURE__ */ m("div", { className: "space-y-1", children: [
580
- /* @__PURE__ */ r("label", { className: "text-[11px] font-medium text-slate-500", children: t.label }),
581
- t.kind === "m2o" ? /* @__PURE__ */ r(
582
- ae,
575
+ i.map((r) => {
576
+ if (r.type === "record_fields") {
577
+ const e = M(r);
578
+ return /* @__PURE__ */ h("div", { className: "space-y-2", children: [
579
+ i.length > 1 && /* @__PURE__ */ l("h4", { className: "text-[12px] font-semibold text-slate-500", children: r.title }),
580
+ /* @__PURE__ */ l("div", { className: "grid grid-cols-1 gap-3 rounded-md border border-slate-200 p-3 sm:grid-cols-2 dark:border-border", children: r.fields.map((t) => {
581
+ var g, k;
582
+ const n = (g = d[e]) == null ? void 0 : g[t.field];
583
+ return /* @__PURE__ */ h("div", { className: "space-y-1", children: [
584
+ /* @__PURE__ */ l("label", { className: "text-[11px] font-medium text-slate-500", children: t.label }),
585
+ t.kind === "m2o" ? /* @__PURE__ */ l(
586
+ oe,
583
587
  {
584
588
  meta: t,
585
589
  selected: typeof n == "string" ? n : "",
586
590
  onChange: (s) => L(e, t.field, s)
587
591
  }
588
- ) : t.kind === "m2m" ? /* @__PURE__ */ r(
589
- se,
592
+ ) : t.kind === "m2m" ? /* @__PURE__ */ l(
593
+ ae,
590
594
  {
591
595
  meta: t,
592
596
  selected: Array.isArray(n) ? n : [],
593
597
  onChange: (s) => L(e, t.field, s)
594
598
  }
595
- ) : t.kind === "file" || t.kind === "files" ? /* @__PURE__ */ r(
596
- Le,
599
+ ) : t.kind === "file" || t.kind === "files" ? /* @__PURE__ */ l(
600
+ Oe,
597
601
  {
598
602
  multiple: t.kind === "files",
599
603
  ids: Array.isArray(n) ? n : typeof n == "string" && n ? [n] : [],
600
- initialNames: Ee(l.display[t.field]),
604
+ initialNames: De(r.display[t.field]),
601
605
  onChange: (s) => L(e, t.field, t.kind === "files" ? s : s[0] ?? "")
602
606
  }
603
- ) : (w = l.copy_to_lines) != null && w[t.field] ? /* @__PURE__ */ m("div", { className: "flex items-center gap-1.5", children: [
604
- /* @__PURE__ */ r(
605
- V,
607
+ ) : (k = r.copy_to_lines) != null && k[t.field] ? /* @__PURE__ */ h("div", { className: "flex items-center gap-1.5", children: [
608
+ /* @__PURE__ */ l(
609
+ U,
606
610
  {
607
611
  value: typeof n == "string" ? n : "",
608
612
  onChange: (s) => L(e, t.field, s.target.value),
@@ -610,16 +614,16 @@ function Be({
610
614
  className: "h-8 w-full text-[12px]"
611
615
  }
612
616
  ),
613
- /* @__PURE__ */ r(
617
+ /* @__PURE__ */ l(
614
618
  "button",
615
619
  {
616
620
  type: "button",
617
621
  disabled: !(typeof n == "string" && n.trim()),
618
622
  onClick: () => {
619
623
  var s;
620
- return X(
624
+ return Y(
621
625
  typeof n == "string" ? n : "",
622
- (s = l.copy_to_lines) == null ? void 0 : s[t.field]
626
+ (s = r.copy_to_lines) == null ? void 0 : s[t.field]
623
627
  );
624
628
  },
625
629
  title: "Copy this value to every available line",
@@ -627,8 +631,8 @@ function Be({
627
631
  children: "Apply to lines ↓"
628
632
  }
629
633
  )
630
- ] }) : /* @__PURE__ */ r(
631
- V,
634
+ ] }) : /* @__PURE__ */ l(
635
+ U,
632
636
  {
633
637
  value: typeof n == "string" ? n : "",
634
638
  onChange: (s) => L(e, t.field, s.target.value),
@@ -638,42 +642,42 @@ function Be({
638
642
  )
639
643
  ] }, t.field);
640
644
  }) }),
641
- k[e] && /* @__PURE__ */ m("p", { className: "flex items-center gap-1 text-[11px] text-red-600", children: [
642
- /* @__PURE__ */ r(z, { className: "h-3 w-3 shrink-0" }),
643
- k[e]
645
+ c[e] && /* @__PURE__ */ h("p", { className: "flex items-center gap-1 text-[11px] text-red-600", children: [
646
+ /* @__PURE__ */ l(z, { className: "h-3 w-3 shrink-0" }),
647
+ c[e]
644
648
  ] })
645
649
  ] }, e);
646
650
  }
647
- const _ = l.display_fields ?? [], a = 1 + _.length + l.fields.length;
648
- return /* @__PURE__ */ m(
651
+ const N = r.display_fields ?? [], a = 1 + N.length + r.fields.length;
652
+ return /* @__PURE__ */ h(
649
653
  "div",
650
654
  {
651
655
  className: "space-y-2",
652
656
  children: [
653
- i.length > 1 && /* @__PURE__ */ r("h4", { className: "text-[12px] font-semibold text-slate-500", children: l.title }),
654
- (l.apply_all ?? []).map((e) => l.fields.find((t) => t.field === e)).filter((e) => !!e && e.kind !== "m2m").map((e) => {
655
- const t = `__bulk__:${l.collection}:${e.field}`, n = M[t] ?? "";
656
- return /* @__PURE__ */ m(
657
+ i.length > 1 && /* @__PURE__ */ l("h4", { className: "text-[12px] font-semibold text-slate-500", children: r.title }),
658
+ (r.apply_all ?? []).map((e) => r.fields.find((t) => t.field === e)).filter((e) => !!e && e.kind !== "m2m").map((e) => {
659
+ const t = `__bulk__:${r.collection}:${e.field}`, n = pe[t] ?? "";
660
+ return /* @__PURE__ */ h(
657
661
  "div",
658
662
  {
659
663
  className: "flex items-center gap-2 rounded-md border border-slate-200 bg-slate-50/60 px-3 py-2 dark:border-border dark:bg-white/[0.03]",
660
664
  children: [
661
- /* @__PURE__ */ r("label", { className: "shrink-0 text-[11px] font-medium text-slate-500", children: e.label }),
662
- /* @__PURE__ */ r(
663
- V,
665
+ /* @__PURE__ */ l("label", { className: "shrink-0 text-[11px] font-medium text-slate-500", children: e.label }),
666
+ /* @__PURE__ */ l(
667
+ U,
664
668
  {
665
669
  value: n,
666
- onChange: (g) => fe((w) => ({ ...w, [t]: g.target.value })),
670
+ onChange: (g) => he((k) => ({ ...k, [t]: g.target.value })),
667
671
  placeholder: `${e.label} for every line…`,
668
672
  className: "h-8 w-full max-w-xs text-[12px]"
669
673
  }
670
674
  ),
671
- /* @__PURE__ */ r(
675
+ /* @__PURE__ */ l(
672
676
  "button",
673
677
  {
674
678
  type: "button",
675
679
  disabled: !n.trim(),
676
- onClick: () => X(n, e.field),
680
+ onClick: () => Y(n, e.field),
677
681
  className: "h-8 shrink-0 whitespace-nowrap rounded-md bg-nvr-cyan px-3 text-[11px] font-medium text-white transition-colors hover:opacity-90 disabled:opacity-40",
678
682
  children: "Apply to all lines"
679
683
  }
@@ -683,34 +687,34 @@ function Be({
683
687
  t
684
688
  );
685
689
  }),
686
- /* @__PURE__ */ r("div", { className: "overflow-x-auto rounded-md border border-slate-200 dark:border-border", children: /* @__PURE__ */ m("table", { className: "w-full border-collapse text-[12px]", children: [
687
- /* @__PURE__ */ r("thead", { children: /* @__PURE__ */ m("tr", { className: "border-b border-slate-200 bg-slate-50/60 text-left text-[11px] font-medium text-slate-400 dark:border-border dark:bg-white/[0.02]", children: [
688
- /* @__PURE__ */ r("th", { className: "px-2.5 py-1.5 font-medium", children: "Row" }),
689
- _.map((e) => /* @__PURE__ */ r("th", { className: "px-2.5 py-1.5 font-medium", children: e.label }, e.field)),
690
- l.fields.map((e) => /* @__PURE__ */ r("th", { className: "w-40 px-2.5 py-1.5 font-medium", children: /* @__PURE__ */ m("span", { className: "flex items-center gap-1.5", children: [
690
+ /* @__PURE__ */ l("div", { className: "overflow-x-auto rounded-md border border-slate-200 dark:border-border", children: /* @__PURE__ */ h("table", { className: "w-full border-collapse text-[12px]", children: [
691
+ /* @__PURE__ */ l("thead", { children: /* @__PURE__ */ h("tr", { className: "border-b border-slate-200 bg-slate-50/60 text-left text-[11px] font-medium text-slate-400 dark:border-border dark:bg-white/[0.02]", children: [
692
+ /* @__PURE__ */ l("th", { className: "px-2.5 py-1.5 font-medium", children: "Row" }),
693
+ N.map((e) => /* @__PURE__ */ l("th", { className: "px-2.5 py-1.5 font-medium", children: e.label }, e.field)),
694
+ r.fields.map((e) => /* @__PURE__ */ l("th", { className: "w-40 px-2.5 py-1.5 font-medium", children: /* @__PURE__ */ h("span", { className: "flex items-center gap-1.5", children: [
691
695
  e.label,
692
- l.rows.length > 1 && /* @__PURE__ */ r(
696
+ r.rows.length > 1 && /* @__PURE__ */ l(
693
697
  "button",
694
698
  {
695
699
  type: "button",
696
- onClick: () => T(l, e),
700
+ onClick: () => B(r, e),
697
701
  title: `Apply the first ${e.label} to all lines`,
698
702
  className: "rounded p-0.5 text-slate-300 transition-colors hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-muted/50",
699
- children: /* @__PURE__ */ r(ye, { className: "h-3 w-3" })
703
+ children: /* @__PURE__ */ l(we, { className: "h-3 w-3" })
700
704
  }
701
705
  )
702
706
  ] }) }, e.field))
703
707
  ] }) }),
704
- /* @__PURE__ */ r("tbody", { children: l.rows.map((e) => {
705
- const t = O(l.collection, e.id);
706
- return /* @__PURE__ */ m(we, { children: [
707
- /* @__PURE__ */ m("tr", { className: "border-b border-slate-100 last:border-b-0 dark:border-border/50", children: [
708
- /* @__PURE__ */ r("td", { className: "max-w-[220px] px-2.5 py-1.5", children: /* @__PURE__ */ m("span", { className: "flex items-center gap-1.5", children: [
709
- !e.complete && /* @__PURE__ */ r("span", { className: "h-1.5 w-1.5 shrink-0 rounded-full bg-amber-400 animate-pulse" }),
710
- /* @__PURE__ */ r(
708
+ /* @__PURE__ */ l("tbody", { children: r.rows.map((e) => {
709
+ const t = D(r.collection, e.id);
710
+ return /* @__PURE__ */ h(Ne, { children: [
711
+ /* @__PURE__ */ h("tr", { className: "border-b border-slate-100 last:border-b-0 dark:border-border/50", children: [
712
+ /* @__PURE__ */ l("td", { className: "max-w-[220px] px-2.5 py-1.5", children: /* @__PURE__ */ h("span", { className: "flex items-center gap-1.5", children: [
713
+ !e.complete && /* @__PURE__ */ l("span", { className: "h-1.5 w-1.5 shrink-0 rounded-full bg-amber-400 animate-pulse" }),
714
+ /* @__PURE__ */ l(
711
715
  "span",
712
716
  {
713
- className: R(
717
+ className: O(
714
718
  "truncate",
715
719
  e.complete ? "text-slate-400" : "font-medium text-slate-700"
716
720
  ),
@@ -719,32 +723,32 @@ function Be({
719
723
  }
720
724
  )
721
725
  ] }) }),
722
- _.map((n) => {
723
- var g, w;
724
- return /* @__PURE__ */ r(
726
+ N.map((n) => {
727
+ var g, k;
728
+ return /* @__PURE__ */ l(
725
729
  "td",
726
730
  {
727
- className: R(
731
+ className: O(
728
732
  "max-w-[200px] truncate px-2.5 py-1.5 text-slate-500",
729
733
  n.format && "text-right tabular-nums"
730
734
  ),
731
- title: le((g = e.display) == null ? void 0 : g[n.field], n.format),
732
- children: le((w = e.display) == null ? void 0 : w[n.field], n.format) || "—"
735
+ title: ie((g = e.display) == null ? void 0 : g[n.field], n.format),
736
+ children: ie((k = e.display) == null ? void 0 : k[n.field], n.format) || "—"
733
737
  },
734
738
  n.field
735
739
  );
736
740
  }),
737
- l.fields.map((n) => {
738
- var g, w, s, o, S, C, j;
739
- return /* @__PURE__ */ r("td", { className: "px-2 py-1", children: n.kind === "m2m" ? /* @__PURE__ */ r(
740
- se,
741
+ r.fields.map((n) => {
742
+ var g, k, s, o, S, j, $;
743
+ return /* @__PURE__ */ l("td", { className: "px-2 py-1", children: n.kind === "m2m" ? /* @__PURE__ */ l(
744
+ ae,
741
745
  {
742
746
  meta: n,
743
- selected: Array.isArray((g = c[t]) == null ? void 0 : g[n.field]) ? (w = c[t]) == null ? void 0 : w[n.field] : [],
747
+ selected: Array.isArray((g = d[t]) == null ? void 0 : g[n.field]) ? (k = d[t]) == null ? void 0 : k[n.field] : [],
744
748
  onChange: (A) => L(t, n.field, A)
745
749
  }
746
- ) : F(t, n) ? /* @__PURE__ */ r(
747
- V,
750
+ ) : K(t, n) ? /* @__PURE__ */ l(
751
+ U,
748
752
  {
749
753
  value: "",
750
754
  disabled: !0,
@@ -753,17 +757,17 @@ function Be({
753
757
  title: "Assigned automatically after submission",
754
758
  className: "h-8 w-full min-w-[9rem] bg-slate-50 text-[12px] italic dark:bg-muted/50"
755
759
  }
756
- ) : n.kind === "m2o" ? /* @__PURE__ */ r(
757
- ae,
760
+ ) : n.kind === "m2o" ? /* @__PURE__ */ l(
761
+ oe,
758
762
  {
759
763
  meta: n,
760
- selected: typeof ((o = c[t]) == null ? void 0 : o[n.field]) == "string" ? (S = c[t]) == null ? void 0 : S[n.field] : "",
764
+ selected: typeof ((o = d[t]) == null ? void 0 : o[n.field]) == "string" ? (S = d[t]) == null ? void 0 : S[n.field] : "",
761
765
  onChange: (A) => L(t, n.field, A)
762
766
  }
763
- ) : /* @__PURE__ */ r(
764
- V,
767
+ ) : /* @__PURE__ */ l(
768
+ U,
765
769
  {
766
- value: typeof ((C = c[t]) == null ? void 0 : C[n.field]) == "string" ? (j = c[t]) == null ? void 0 : j[n.field] : "",
770
+ value: typeof ((j = d[t]) == null ? void 0 : j[n.field]) == "string" ? ($ = d[t]) == null ? void 0 : $[n.field] : "",
767
771
  onChange: (A) => L(t, n.field, A.target.value),
768
772
  placeholder: n.label,
769
773
  className: "h-8 w-full min-w-[9rem] text-[12px]"
@@ -771,45 +775,45 @@ function Be({
771
775
  ) }, n.field);
772
776
  })
773
777
  ] }),
774
- k[t] && /* @__PURE__ */ r("tr", { children: /* @__PURE__ */ r("td", { colSpan: a, className: "px-2.5 pb-1.5", children: /* @__PURE__ */ m("p", { className: "flex items-center gap-1 text-[11px] text-red-600", children: [
775
- /* @__PURE__ */ r(z, { className: "h-3 w-3 shrink-0" }),
776
- k[t]
778
+ c[t] && /* @__PURE__ */ l("tr", { children: /* @__PURE__ */ l("td", { colSpan: a, className: "px-2.5 pb-1.5", children: /* @__PURE__ */ h("p", { className: "flex items-center gap-1 text-[11px] text-red-600", children: [
779
+ /* @__PURE__ */ l(z, { className: "h-3 w-3 shrink-0" }),
780
+ c[t]
777
781
  ] }) }) })
778
782
  ] }, t);
779
783
  }) })
780
784
  ] }) })
781
785
  ]
782
786
  },
783
- `${l.collection}-${l.fk_field}-${l.title}`
787
+ `${r.collection}-${r.fk_field}-${r.title}`
784
788
  );
785
789
  })
786
790
  ]
787
791
  }
788
792
  ),
789
- /* @__PURE__ */ m($e, { className: "items-center", children: [
790
- (p || v) && /* @__PURE__ */ m("span", { className: "mr-auto flex items-center gap-2 text-[12px] text-slate-500 dark:text-slate-400", children: [
791
- /* @__PURE__ */ r(Q, { className: "h-3.5 w-3.5 animate-spin text-nvr-cyan" }),
792
- p ? "Saving line values…" : "Submitting — contacting external systems, this can take a few seconds…"
793
+ /* @__PURE__ */ h(Ee, { className: "items-center", children: [
794
+ (C || m) && /* @__PURE__ */ h("span", { className: "mr-auto flex items-center gap-2 text-[12px] text-slate-500 dark:text-slate-400", children: [
795
+ /* @__PURE__ */ l(H, { className: "h-3.5 w-3.5 animate-spin text-nvr-cyan" }),
796
+ C ? "Saving line values…" : "Submitting — contacting external systems, this can take a few seconds…"
793
797
  ] }),
794
- /* @__PURE__ */ r(
795
- H,
798
+ /* @__PURE__ */ l(
799
+ W,
796
800
  {
797
801
  type: "button",
798
802
  variant: "outline",
799
- onClick: b,
800
- disabled: p || v,
803
+ onClick: v,
804
+ disabled: C || m,
801
805
  children: "Cancel"
802
806
  }
803
807
  ),
804
- /* @__PURE__ */ r(
805
- H,
808
+ /* @__PURE__ */ l(
809
+ W,
806
810
  {
807
811
  type: "button",
808
- onClick: he,
809
- disabled: p || v || pe,
810
- children: p || v ? /* @__PURE__ */ m("span", { className: "flex items-center gap-1.5", children: [
811
- /* @__PURE__ */ r(Q, { className: "h-3.5 w-3.5 animate-spin" }),
812
- p && N === "save" ? "Saving…" : "Submitting…"
812
+ onClick: ge,
813
+ disabled: C || m || be,
814
+ children: C || m ? /* @__PURE__ */ h("span", { className: "flex items-center gap-1.5", children: [
815
+ /* @__PURE__ */ l(H, { className: "h-3.5 w-3.5 animate-spin" }),
816
+ C && E === "save" ? "Saving…" : "Submitting…"
813
817
  ] }) : "Submit"
814
818
  }
815
819
  )
@@ -819,5 +823,5 @@ function Be({
819
823
  ) });
820
824
  }
821
825
  export {
822
- Be as TransitionRequirementsDialog
826
+ He as TransitionRequirementsDialog
823
827
  };