@nivaro/react 0.3.60 → 0.3.62

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,9 +1,9 @@
1
1
  import { jsxs as i, Fragment as Ne, jsx as t } from "react/jsx-runtime";
2
- import { useQueryClient as Qe, useQuery as G, useQueries as De, useMutation as pe } from "@tanstack/react-query";
2
+ import { useQueryClient as Qe, useQuery as V, useQueries as De, useMutation as pe } from "@tanstack/react-query";
3
3
  import { FileDiff as Ze, ChevronDown as et, Paperclip as Ue, Loader2 as tt, Upload as rt } from "lucide-react";
4
- import { useState as R, useRef as Me, useEffect as Be, useMemo as de, Fragment as Ce, useCallback as Ee, memo as at } from "react";
4
+ import { useState as j, useRef as Me, useEffect as Be, useMemo as oe, Fragment as Ce, useCallback as Ee, memo as nt } from "react";
5
5
  import { toast as z } from "sonner";
6
- import { useNivaroClient as xe, useItemEditAuth as nt } from "../../context.js";
6
+ import { useNivaroClient as xe, useItemEditAuth as at } from "../../context.js";
7
7
  import { get as Q, post as ve, del as lt } from "../../lib/commands.js";
8
8
  import { sanitizeHtml as st } from "../../lib/sanitize-html.js";
9
9
  import { titleCase as fe } from "../../lib/utils.js";
@@ -14,36 +14,36 @@ import { evalClientFormula as ct } from "../item-edit/InlineTableField.js";
14
14
  import { parseRollupParentFilter as Le, matchesRollupFilter as mt, computeLiveRollup as Ie, parseRollupSources as Je } from "../item-edit/live-rollups.js";
15
15
  import { useLocalLiveRows as ut, LiveRowsContext as pt, O2MStagingContext as ft, useLiveRows as ht } from "../item-edit/O2MStagingContext.js";
16
16
  import { Button as I } from "../ui/button.js";
17
- import { Input as je } from "../ui/input.js";
17
+ import { Input as Pe } from "../ui/input.js";
18
18
  import { Label as he } from "../ui/label.js";
19
19
  import { Sheet as xt, SheetContent as bt, SheetHeader as gt, SheetTitle as vt } from "../ui/sheet.js";
20
- import { Skeleton as se } from "../ui/skeleton.js";
20
+ import { Skeleton as le } from "../ui/skeleton.js";
21
21
  import { Textarea as yt } from "../ui/textarea.js";
22
22
  import { AddendumCompare as Nt } from "./AddendumCompare.js";
23
23
  import { AddendumLinesDiff as Ke } from "./AddendumLinesDiff.js";
24
24
  import { resolveAddendumAmounts as kt } from "./addendum-summary.js";
25
25
  const ye = new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }), _t = (r) => r.replace(/<[^>]+>/g, " ").replace(/&nbsp;/g, " ").replace(/\s+/g, " ").trim();
26
26
  function ze(r) {
27
- const c = Number(r);
28
- return !r || Number.isNaN(c) || c === 0 ? null : /* @__PURE__ */ i(
27
+ const m = Number(r);
28
+ return !r || Number.isNaN(m) || m === 0 ? null : /* @__PURE__ */ i(
29
29
  "span",
30
30
  {
31
31
  className: D(
32
32
  "inline-flex items-center rounded-full px-2 py-0.5 text-[11px] font-medium tabular-nums",
33
- c > 0 ? "bg-emerald-50 text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-400" : "bg-red-50 text-red-600 dark:bg-red-500/10 dark:text-red-400"
33
+ m > 0 ? "bg-emerald-50 text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-400" : "bg-red-50 text-red-600 dark:bg-red-500/10 dark:text-red-400"
34
34
  ),
35
35
  children: [
36
- c > 0 ? "+" : "−",
37
- ye.format(Math.abs(c))
36
+ m > 0 ? "+" : "−",
37
+ ye.format(Math.abs(m))
38
38
  ]
39
39
  }
40
40
  );
41
41
  }
42
42
  function wt({ amounts: r }) {
43
- const { previous: c, next: v, change: k } = r, N = k != null && k !== 0, h = [
43
+ const { previous: m, next: v, change: k } = r, N = k != null && k !== 0, h = [
44
44
  {
45
45
  label: "Previous",
46
- value: c == null ? "—" : ye.format(c),
46
+ value: m == null ? "—" : ye.format(m),
47
47
  className: "text-slate-500 dark:text-slate-400"
48
48
  },
49
49
  {
@@ -57,12 +57,12 @@ function wt({ amounts: r }) {
57
57
  className: N ? k > 0 ? "font-semibold text-emerald-600 dark:text-emerald-400" : "font-semibold text-red-600 dark:text-red-400" : "text-slate-500 dark:text-slate-400"
58
58
  }
59
59
  ];
60
- return /* @__PURE__ */ t("div", { className: "flex flex-wrap items-start gap-x-8 gap-y-2", children: h.map((u) => /* @__PURE__ */ i("div", { className: "min-w-0", children: [
61
- /* @__PURE__ */ t("p", { className: D("text-[13px] leading-5 tabular-nums", u.className), children: u.value }),
62
- /* @__PURE__ */ t("p", { className: "text-[11px] leading-4 text-slate-400 dark:text-slate-500", children: u.label })
63
- ] }, u.label)) });
60
+ return /* @__PURE__ */ t("div", { className: "flex flex-wrap items-start gap-x-8 gap-y-2", children: h.map((p) => /* @__PURE__ */ i("div", { className: "min-w-0", children: [
61
+ /* @__PURE__ */ t("p", { className: D("text-[13px] leading-5 tabular-nums", p.className), children: p.value }),
62
+ /* @__PURE__ */ t("p", { className: "text-[11px] leading-4 text-slate-400 dark:text-slate-500", children: p.label })
63
+ ] }, p.label)) });
64
64
  }
65
- const We = "grid grid-cols-1 items-baseline text-[12.5px] sm:grid-cols-[140px_minmax(0,1fr)] sm:gap-x-6 sm:gap-y-2.5", ce = "text-[12px] text-slate-500 dark:text-slate-400", me = "mb-2.5 min-w-0 text-slate-700 sm:mb-0 dark:text-slate-200";
65
+ const We = "grid grid-cols-1 items-baseline text-[12.5px] sm:grid-cols-[140px_minmax(0,1fr)] sm:gap-x-6 sm:gap-y-2.5", de = "text-[12px] text-slate-500 dark:text-slate-400", ce = "mb-2.5 min-w-0 text-slate-700 sm:mb-0 dark:text-slate-200";
66
66
  function D(...r) {
67
67
  return r.filter(Boolean).join(" ");
68
68
  }
@@ -87,39 +87,39 @@ const Ae = {
87
87
  badge: "bg-amber-50 text-amber-700 dark:bg-amber-500/10 dark:text-amber-400",
88
88
  dot: "bg-amber-500"
89
89
  }
90
- }, Ct = (r, c) => Math.round(Number(r) * 100) === Math.round(Number(c) * 100);
91
- function St(r, c, v) {
90
+ }, Ct = (r, m) => Math.round(Number(r) * 100) === Math.round(Number(m) * 100);
91
+ function St(r, m, v) {
92
92
  if (!v || r.computed_type !== "rollup" || !r.computed_formula) return r;
93
93
  const k = Ie(Je(r.computed_formula), v.rows);
94
- return k === null || c != null && Ct(c, k) ? r : {
94
+ return k === null || m != null && Ct(m, k) ? r : {
95
95
  ...r,
96
96
  options: {
97
97
  ...r.options ?? {},
98
- __live_delta: { original: c, live: k }
98
+ __live_delta: { original: m, live: k }
99
99
  }
100
100
  };
101
101
  }
102
- function qt({
102
+ function Ft({
103
103
  current: r,
104
- value: c,
104
+ value: m,
105
105
  onChange: v,
106
106
  currentLabel: k,
107
107
  newLabel: N
108
108
  }) {
109
- const [h, u] = R(() => {
110
- const g = Number(c);
109
+ const [h, p] = j(() => {
110
+ const g = Number(m);
111
111
  return !Number.isFinite(g) || Math.round(g * 100) === Math.round(r * 100) ? "" : String(Math.round((g - r) * 100) / 100);
112
- }), _ = h.trim() === "" ? 0 : Number(h), f = Number.isFinite(_), $ = f ? Math.round((r + _) * 100) / 100 : r, m = (g) => g.toLocaleString("en-US", { style: "currency", currency: "USD" });
112
+ }), _ = h.trim() === "" ? 0 : Number(h), f = Number.isFinite(_), F = f ? Math.round((r + _) * 100) / 100 : r, c = (g) => g.toLocaleString("en-US", { style: "currency", currency: "USD" });
113
113
  return /* @__PURE__ */ i("div", { className: "space-y-1.5", children: [
114
114
  /* @__PURE__ */ i("div", { className: "flex items-center gap-0", children: [
115
115
  /* @__PURE__ */ t("span", { className: "flex h-9 items-center rounded-l-md border border-r-0 border-slate-200 bg-slate-50 px-2.5 text-[13px] text-slate-500 dark:border-border dark:bg-muted", children: "$" }),
116
116
  /* @__PURE__ */ t(
117
- je,
117
+ Pe,
118
118
  {
119
119
  value: h,
120
120
  onChange: (g) => {
121
121
  const C = g.target.value;
122
- u(C);
122
+ p(C);
123
123
  const w = C.trim() === "" ? 0 : Number(C);
124
124
  Number.isFinite(w) && v(Math.round((r + w) * 100) / 100);
125
125
  },
@@ -134,7 +134,7 @@ function qt({
134
134
  ":"
135
135
  ] }),
136
136
  " ",
137
- /* @__PURE__ */ t("span", { className: "tabular-nums text-slate-700 dark:text-slate-200", children: m(r) }),
137
+ /* @__PURE__ */ t("span", { className: "tabular-nums text-slate-700 dark:text-slate-200", children: c(r) }),
138
138
  /* @__PURE__ */ t("span", { className: "mx-2 text-slate-300", children: "·" }),
139
139
  /* @__PURE__ */ i("span", { className: "font-medium text-slate-600 dark:text-slate-300", children: [
140
140
  N ?? "New REQ Total",
@@ -144,89 +144,89 @@ function qt({
144
144
  /* @__PURE__ */ t(
145
145
  "span",
146
146
  {
147
- className: "tabular-nums font-semibold " + ($ > r ? "text-emerald-600 dark:text-emerald-400" : $ < r ? "text-red-600 dark:text-red-400" : "text-slate-700 dark:text-slate-200"),
148
- children: m($)
147
+ className: "tabular-nums font-semibold " + (F > r ? "text-emerald-600 dark:text-emerald-400" : F < r ? "text-red-600 dark:text-red-400" : "text-slate-700 dark:text-slate-200"),
148
+ children: c(F)
149
149
  }
150
150
  ),
151
151
  !f && /* @__PURE__ */ t("span", { className: "ml-2 text-[11px] text-red-500", children: "Enter a number" })
152
152
  ] })
153
153
  ] });
154
154
  }
155
- const $t = at(function({
156
- configuredFields: c,
155
+ const qt = nt(function({
156
+ configuredFields: m,
157
157
  fieldMap: v,
158
158
  formData: k,
159
159
  onFieldChange: N,
160
160
  relations: h,
161
- collection: u,
161
+ collection: p,
162
162
  prefillParentId: _,
163
163
  parentData: f
164
164
  }) {
165
- const $ = ht();
166
- return c.length === 0 ? /* @__PURE__ */ t("div", { className: "rounded-lg border border-dashed border-slate-200 bg-slate-50 px-4 py-6 text-center dark:border-border dark:bg-muted/30", children: /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-400 dark:text-slate-500", children: "No fields configured for addendum. Set up the field list in Data Model → Layouts → Addendum Form." }) }) : /* @__PURE__ */ i("div", { className: "border-t border-slate-100 dark:border-border pt-3", children: [
165
+ const F = ht();
166
+ return m.length === 0 ? /* @__PURE__ */ t("div", { className: "rounded-lg border border-dashed border-slate-200 bg-slate-50 px-4 py-6 text-center dark:border-border dark:bg-muted/30", children: /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-400 dark:text-slate-500", children: "No fields configured for addendum. Set up the field list in Data Model → Layouts → Addendum Form." }) }) : /* @__PURE__ */ i("div", { className: "border-t border-slate-100 dark:border-border pt-3", children: [
167
167
  /* @__PURE__ */ t("p", { className: "mb-3 text-[11px] font-semibold uppercase tracking-wide text-slate-400 dark:text-slate-500", children: "Proposed changes" }),
168
- /* @__PURE__ */ t("div", { className: "space-y-3", children: c.map((m) => {
169
- const g = v[m.field], C = m.label_override ?? fe((g == null ? void 0 : g.field) ?? m.field);
168
+ /* @__PURE__ */ t("div", { className: "space-y-3", children: m.map((c) => {
169
+ const g = v[c.field], C = c.label_override ?? fe((g == null ? void 0 : g.field) ?? c.field);
170
170
  if (!g)
171
171
  return /* @__PURE__ */ i("div", { children: [
172
172
  /* @__PURE__ */ t(he, { className: "mb-1 block text-[11px] font-medium text-slate-600 dark:text-slate-400", children: C }),
173
173
  /* @__PURE__ */ t(
174
- je,
174
+ Pe,
175
175
  {
176
- value: String(k[m.field] ?? ""),
177
- onChange: (O) => N(m.field, O.target.value),
176
+ value: String(k[c.field] ?? ""),
177
+ onChange: (R) => N(c.field, R.target.value),
178
178
  className: "h-8 text-[12px]"
179
179
  }
180
180
  )
181
- ] }, m.field);
182
- const T = (typeof m.overrides == "string" ? (() => {
181
+ ] }, c.field);
182
+ const T = (typeof c.overrides == "string" ? (() => {
183
183
  try {
184
- return JSON.parse(m.overrides);
184
+ return JSON.parse(c.overrides);
185
185
  } catch {
186
186
  return {};
187
187
  }
188
- })() : m.overrides ?? {}).options ?? {};
188
+ })() : c.overrides ?? {}).options ?? {};
189
189
  if (T.entry_mode === "delta") {
190
- const O = Number((f == null ? void 0 : f[m.field]) ?? 0);
190
+ const R = Number((f == null ? void 0 : f[c.field]) ?? 0);
191
191
  return /* @__PURE__ */ i("div", { children: [
192
192
  /* @__PURE__ */ t(he, { className: "mb-1 block text-[11px] font-medium text-slate-600 dark:text-slate-400", children: C }),
193
193
  /* @__PURE__ */ t(
194
- qt,
194
+ Ft,
195
195
  {
196
- current: Number.isFinite(O) ? O : 0,
197
- value: k[m.field],
198
- onChange: (P) => N(m.field, P),
196
+ current: Number.isFinite(R) ? R : 0,
197
+ value: k[c.field],
198
+ onChange: (P) => N(c.field, P),
199
199
  currentLabel: typeof T.current_label == "string" ? T.current_label : void 0,
200
200
  newLabel: typeof T.new_label == "string" ? T.new_label : void 0
201
201
  }
202
202
  )
203
- ] }, m.field);
203
+ ] }, c.field);
204
204
  }
205
205
  return /* @__PURE__ */ i("div", { children: [
206
206
  /* @__PURE__ */ t(he, { className: "mb-1 block text-[11px] font-medium text-slate-600 dark:text-slate-400", children: C }),
207
207
  /* @__PURE__ */ t(
208
208
  dt,
209
209
  {
210
- field: St(g, k[m.field], $),
211
- value: k[m.field],
212
- onChange: (O) => N(m.field, O),
210
+ field: St(g, k[c.field], F),
211
+ value: k[c.field],
212
+ onChange: (R) => N(c.field, R),
213
213
  relations: h,
214
- collection: u,
214
+ collection: p,
215
215
  itemId: "new",
216
216
  prefillParentId: _
217
217
  }
218
218
  )
219
- ] }, m.field);
219
+ ] }, c.field);
220
220
  }) })
221
221
  ] });
222
222
  });
223
- function Ft({ addendumId: r }) {
224
- const c = xe(), { data: v, isLoading: k } = G({
223
+ function $t({ addendumId: r }) {
224
+ const m = xe(), { data: v, isLoading: k } = V({
225
225
  queryKey: ["pipeline-instance", "nivaro_addendums", r],
226
- queryFn: () => c.request(Q(`/pipelines/instance/nivaro_addendums/${r}`)).then((u) => u.data),
226
+ queryFn: () => m.request(Q(`/pipelines/instance/nivaro_addendums/${r}`)).then((p) => p.data),
227
227
  staleTime: 1e4
228
228
  });
229
- if (k) return /* @__PURE__ */ t(se, { className: "h-8 w-full" });
229
+ if (k) return /* @__PURE__ */ t(le, { className: "h-8 w-full" });
230
230
  if (!(v != null && v.instance))
231
231
  return /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-400 italic", children: "No workflow instance found." });
232
232
  const { instance: N } = v, h = N.current_state_obj;
@@ -251,33 +251,33 @@ function Ft({ addendumId: r }) {
251
251
  }
252
252
  function At({
253
253
  collection: r,
254
- itemId: c,
254
+ itemId: m,
255
255
  assignments: v,
256
256
  workflowTemplateId: k,
257
257
  resolvedLayoutId: N,
258
258
  fields: h,
259
- relations: u,
259
+ relations: p,
260
260
  parentData: _,
261
261
  onClose: f,
262
- onCreated: $
262
+ onCreated: F
263
263
  }) {
264
- const m = xe(), g = v.filter(
265
- (l) => !String(l.field).startsWith("__") && (l.is_visible || l.is_visible === 1)
266
- ), [C, w] = R(""), [T, O] = R(""), [P, J] = R([]), [te, M] = R(0), Z = Me(null), j = async (l) => {
267
- if (l.length !== 0) {
268
- M((s) => s + l.length);
269
- for (const s of l)
264
+ const c = xe(), g = v.filter(
265
+ (a) => !String(a.field).startsWith("__") && (a.is_visible || a.is_visible === 1)
266
+ ), [C, w] = j(""), [T, R] = j(""), [P, J] = j([]), [ee, A] = j(0), G = Me(null), M = async (a) => {
267
+ if (a.length !== 0) {
268
+ A((s) => s + a.length);
269
+ for (const s of a)
270
270
  try {
271
- const d = await m.upload(s);
271
+ const d = await c.upload(s);
272
272
  J((o) => [...o, { id: String(d.id), name: s.name }]);
273
273
  } catch {
274
274
  z.error(`Failed to upload ${s.name}`);
275
275
  } finally {
276
- M((d) => d - 1);
276
+ A((d) => d - 1);
277
277
  }
278
278
  }
279
- }, [ee, E] = R(() => {
280
- const l = {};
279
+ }, [te, E] = j(() => {
280
+ const a = {};
281
281
  for (const s of g) {
282
282
  const d = typeof s.overrides == "string" ? (() => {
283
283
  try {
@@ -286,117 +286,117 @@ function At({
286
286
  return {};
287
287
  }
288
288
  })() : s.overrides ?? {}, o = (d == null ? void 0 : d.prefill_from_parent) !== !1;
289
- l[s.field] = o ? _[s.field] ?? null : null;
289
+ a[s.field] = o ? _[s.field] ?? null : null;
290
290
  }
291
- return l;
292
- }), re = de(() => {
293
- const l = {};
294
- for (const s of h) l[s.field] = s;
295
- return l;
296
- }, [h]), ae = Ee((l, s) => {
297
- E((d) => ({ ...d, [l]: s }));
291
+ return a;
292
+ }), me = oe(() => {
293
+ const a = {};
294
+ for (const s of h) a[s.field] = s;
295
+ return a;
296
+ }, [h]), X = Ee((a, s) => {
297
+ E((d) => ({ ...d, [a]: s }));
298
298
  }, []), W = Ee(
299
- (l) => {
300
- E((s) => ({ ...s, ...l.values })), !C.trim() && l.summary && w(l.summary.slice(0, 120));
301
- for (const [s, d] of Object.entries(l.lines_by_alias)) {
302
- const o = u.find(
299
+ (a) => {
300
+ E((s) => ({ ...s, ...a.values })), !C.trim() && a.summary && w(a.summary.slice(0, 120));
301
+ for (const [s, d] of Object.entries(a.lines_by_alias)) {
302
+ const o = p.find(
303
303
  (S) => S.one_collection === r && !S.junction_field && (S.one_field === s || S.many_collection === s)
304
304
  );
305
305
  if (!(o != null && o.many_collection) || !o.many_field) continue;
306
306
  const x = o.many_field, y = `${o.many_collection}.${x}`;
307
- H((S) => {
308
- const F = new Map(S);
309
- return F.set(y, [
310
- ...F.get(y) ?? [],
311
- ...d.map((le) => ({ ...le.values, [x]: c }))
312
- ]), F;
307
+ L((S) => {
308
+ const q = new Map(S);
309
+ return q.set(y, [
310
+ ...q.get(y) ?? [],
311
+ ...d.map((ae) => ({ ...ae.values, [x]: m }))
312
+ ]), q;
313
313
  });
314
314
  }
315
- l.file_id && J((s) => [...s, { id: l.file_id, name: l.document_name }]);
315
+ a.file_id && J((s) => [...s, { id: a.file_id, name: a.document_name }]);
316
316
  },
317
- [r, c, u, C]
318
- ), [X, H] = R(
317
+ [r, m, p, C]
318
+ ), [Y, L] = j(
319
319
  /* @__PURE__ */ new Map()
320
- ), [ie, L] = R(/* @__PURE__ */ new Map()), [V, p] = R(/* @__PURE__ */ new Map()), q = Me(X);
320
+ ), [re, se] = j(/* @__PURE__ */ new Map()), [ne, ie] = j(/* @__PURE__ */ new Map()), Z = Me(Y);
321
321
  Be(() => {
322
- q.current = X;
323
- }, [X]);
324
- const ne = ut(), U = de(
322
+ Z.current = Y;
323
+ }, [Y]);
324
+ const U = ut(), O = oe(
325
325
  () => ({
326
- getPendingRows: (l, s) => X.get(`${l}.${s}`) ?? [],
327
- queueRow: (l, s, d) => H((o) => {
328
- const x = new Map(o), y = `${l}.${s}`;
326
+ getPendingRows: (a, s) => Y.get(`${a}.${s}`) ?? [],
327
+ queueRow: (a, s, d) => L((o) => {
328
+ const x = new Map(o), y = `${a}.${s}`;
329
329
  return x.set(y, [...x.get(y) ?? [], d]), x;
330
330
  }),
331
- removeRow: (l, s, d) => H((o) => {
332
- const x = new Map(o), y = `${l}.${s}`, S = [...x.get(y) ?? []];
331
+ removeRow: (a, s, d) => L((o) => {
332
+ const x = new Map(o), y = `${a}.${s}`, S = [...x.get(y) ?? []];
333
333
  return S.splice(d, 1), x.set(y, S), x;
334
334
  }),
335
- updateRow: (l, s, d, o) => H((x) => {
336
- const y = new Map(x), S = `${l}.${s}`, F = [...y.get(S) ?? []];
337
- return F[d] = { ...F[d], ...o }, y.set(S, F), y;
335
+ updateRow: (a, s, d, o) => L((x) => {
336
+ const y = new Map(x), S = `${a}.${s}`, q = [...y.get(S) ?? []];
337
+ return q[d] = { ...q[d], ...o }, y.set(S, q), y;
338
338
  }),
339
- reorderRows: (l, s, d, o) => H((x) => {
340
- const y = new Map(x), S = `${l}.${s}`, F = [...y.get(S) ?? []], [le] = F.splice(d, 1);
341
- return F.splice(o, 0, le), y.set(S, F), y;
339
+ reorderRows: (a, s, d, o) => L((x) => {
340
+ const y = new Map(x), S = `${a}.${s}`, q = [...y.get(S) ?? []], [ae] = q.splice(d, 1);
341
+ return q.splice(o, 0, ae), y.set(S, q), y;
342
342
  }),
343
- getPendingEdits: (l, s) => ie.get(`${l}.${s}`) ?? /* @__PURE__ */ new Map(),
344
- getPendingDeletes: (l, s) => V.get(`${l}.${s}`) ?? /* @__PURE__ */ new Set(),
345
- queueEdit: (l, s, d, o) => L((x) => {
346
- const y = new Map(x), S = `${l}.${s}`, F = new Map(y.get(S) ?? []);
347
- return F.set(d, { ...F.get(d) ?? {}, ...o }), y.set(S, F), y;
343
+ getPendingEdits: (a, s) => re.get(`${a}.${s}`) ?? /* @__PURE__ */ new Map(),
344
+ getPendingDeletes: (a, s) => ne.get(`${a}.${s}`) ?? /* @__PURE__ */ new Set(),
345
+ queueEdit: (a, s, d, o) => se((x) => {
346
+ const y = new Map(x), S = `${a}.${s}`, q = new Map(y.get(S) ?? []);
347
+ return q.set(d, { ...q.get(d) ?? {}, ...o }), y.set(S, q), y;
348
348
  }),
349
- queueDelete: (l, s, d) => p((o) => {
350
- const x = new Map(o), y = `${l}.${s}`;
349
+ queueDelete: (a, s, d) => ie((o) => {
350
+ const x = new Map(o), y = `${a}.${s}`;
351
351
  return x.set(y, /* @__PURE__ */ new Set([...x.get(y) ?? [], d])), x;
352
352
  }),
353
- cancelPendingEdit: (l, s, d) => L((o) => {
354
- const x = new Map(o), y = `${l}.${s}`, S = new Map(x.get(y) ?? []);
353
+ cancelPendingEdit: (a, s, d) => se((o) => {
354
+ const x = new Map(o), y = `${a}.${s}`, S = new Map(x.get(y) ?? []);
355
355
  return S.delete(d), x.set(y, S), x;
356
356
  }),
357
- cancelPendingDelete: (l, s, d) => p((o) => {
358
- const x = new Map(o), y = `${l}.${s}`, S = new Set(x.get(y) ?? []);
357
+ cancelPendingDelete: (a, s, d) => ie((o) => {
358
+ const x = new Map(o), y = `${a}.${s}`, S = new Set(x.get(y) ?? []);
359
359
  return S.delete(d), x.set(y, S), x;
360
360
  })
361
361
  }),
362
- [X, ie, V]
363
- ), oe = pe({
362
+ [Y, re, ne]
363
+ ), u = pe({
364
364
  mutationFn: () => {
365
- const l = {};
366
- for (const [s, d] of Object.entries(ee)) {
367
- const o = re[s];
368
- (o == null ? void 0 : o.computed_type) === "rollup" || (o == null ? void 0 : o.computed_type) === "write" || d !== void 0 && String(d ?? "") !== String(_[s] ?? "") && (l[s] = d);
365
+ const a = {};
366
+ for (const [s, d] of Object.entries(te)) {
367
+ const o = me[s];
368
+ (o == null ? void 0 : o.computed_type) === "rollup" || (o == null ? void 0 : o.computed_type) === "write" || d !== void 0 && String(d ?? "") !== String(_[s] ?? "") && (a[s] = d);
369
369
  }
370
370
  for (const s of g) {
371
- const d = u.find(
371
+ const d = p.find(
372
372
  (o) => o.one_collection === r && !o.junction_field && (o.one_field === s.field || o.many_collection === s.field)
373
373
  );
374
374
  if (d != null && d.many_collection && d.many_field) {
375
- const o = (q.current.get(`${d.many_collection}.${d.many_field}`) ?? []).map(({ __prefilled: x, ...y }) => y);
376
- o.length > 0 && (l[s.field] = o);
375
+ const o = (Z.current.get(`${d.many_collection}.${d.many_field}`) ?? []).map(({ __prefilled: x, ...y }) => y);
376
+ o.length > 0 && (a[s.field] = o);
377
377
  }
378
378
  }
379
- return m.request(
379
+ return c.request(
380
380
  ve("/addendums", {
381
381
  parent_collection: r,
382
- parent_id: c,
382
+ parent_id: m,
383
383
  title: C.trim(),
384
384
  description: T.trim() || void 0,
385
385
  workflow_template_id: k ?? void 0,
386
386
  addendum_layout_id: N,
387
- data: l,
387
+ data: a,
388
388
  fields_schema: g.map((s) => s.field),
389
389
  attachments: P.length > 0 ? P.map((s) => s.id) : void 0
390
390
  })
391
391
  );
392
392
  },
393
- onSuccess: (l) => {
393
+ onSuccess: (a) => {
394
394
  var s;
395
- z.success("Addendum created"), $(((s = l == null ? void 0 : l.data) == null ? void 0 : s.id) != null ? String(l.data.id) : null), f();
395
+ z.success("Addendum created"), F(((s = a == null ? void 0 : a.data) == null ? void 0 : s.id) != null ? String(a.data.id) : null), f();
396
396
  },
397
397
  onError: () => z.error("Failed to create addendum")
398
398
  });
399
- return /* @__PURE__ */ t(pt.Provider, { value: ne, children: /* @__PURE__ */ t(ft.Provider, { value: U, children: /* @__PURE__ */ i("div", { className: "flex h-full flex-col", children: [
399
+ return /* @__PURE__ */ t(pt.Provider, { value: U, children: /* @__PURE__ */ t(ft.Provider, { value: O, children: /* @__PURE__ */ i("div", { className: "flex h-full flex-col", children: [
400
400
  /* @__PURE__ */ i(gt, { className: "shrink-0 border-b border-slate-200 px-5 py-4 dark:border-border", children: [
401
401
  /* @__PURE__ */ t(vt, { className: "text-[14px] font-semibold text-slate-900 dark:text-slate-100", children: "New Addendum" }),
402
402
  /* @__PURE__ */ t("p", { className: "mt-0.5 text-[12px] text-slate-500 dark:text-slate-400", children: "Propose changes to this record. Fields are pre-filled with current values — edit what's changing." })
@@ -409,10 +409,10 @@ function At({
409
409
  /* @__PURE__ */ t("span", { className: "text-red-500", children: "*" })
410
410
  ] }),
411
411
  /* @__PURE__ */ t(
412
- je,
412
+ Pe,
413
413
  {
414
414
  value: C,
415
- onChange: (l) => w(l.target.value),
415
+ onChange: (a) => w(a.target.value),
416
416
  className: "h-8 text-[12px]",
417
417
  placeholder: "Brief description of this addendum",
418
418
  autoFocus: !0
@@ -425,7 +425,7 @@ function At({
425
425
  yt,
426
426
  {
427
427
  value: T,
428
- onChange: (l) => O(l.target.value),
428
+ onChange: (a) => R(a.target.value),
429
429
  rows: 2,
430
430
  className: "text-[12px]",
431
431
  placeholder: "Why is this change needed?"
@@ -437,49 +437,49 @@ function At({
437
437
  /* @__PURE__ */ t(
438
438
  "input",
439
439
  {
440
- ref: Z,
440
+ ref: G,
441
441
  type: "file",
442
442
  multiple: !0,
443
443
  className: "hidden",
444
- onChange: (l) => {
445
- j(Array.from(l.target.files ?? [])), l.target.value = "";
444
+ onChange: (a) => {
445
+ M(Array.from(a.target.files ?? [])), a.target.value = "";
446
446
  }
447
447
  }
448
448
  ),
449
449
  /* @__PURE__ */ i("div", { className: "flex flex-wrap items-center gap-1.5", children: [
450
- P.map((l) => /* @__PURE__ */ i(
450
+ P.map((a) => /* @__PURE__ */ i(
451
451
  "span",
452
452
  {
453
453
  className: "inline-flex max-w-[240px] items-center gap-1 rounded border border-slate-200 bg-slate-50 px-2 py-1 text-[11px] text-slate-700 dark:border-border dark:bg-muted dark:text-slate-200",
454
454
  children: [
455
455
  /* @__PURE__ */ t(Ue, { className: "h-3 w-3 shrink-0 text-slate-400" }),
456
- /* @__PURE__ */ t("span", { className: "truncate", children: l.name }),
456
+ /* @__PURE__ */ t("span", { className: "truncate", children: a.name }),
457
457
  /* @__PURE__ */ t(
458
458
  "button",
459
459
  {
460
460
  type: "button",
461
- onClick: () => J((s) => s.filter((d) => d.id !== l.id)),
461
+ onClick: () => J((s) => s.filter((d) => d.id !== a.id)),
462
462
  className: "shrink-0 text-slate-400 hover:text-red-500",
463
463
  children: "×"
464
464
  }
465
465
  )
466
466
  ]
467
467
  },
468
- l.id
468
+ a.id
469
469
  )),
470
470
  /* @__PURE__ */ i(
471
471
  "button",
472
472
  {
473
473
  type: "button",
474
474
  onClick: () => {
475
- var l;
476
- return (l = Z.current) == null ? void 0 : l.click();
475
+ var a;
476
+ return (a = G.current) == null ? void 0 : a.click();
477
477
  },
478
- disabled: te > 0,
478
+ disabled: ee > 0,
479
479
  className: "inline-flex items-center gap-1.5 rounded-md border border-slate-200 px-2.5 py-1 text-[11px] font-medium text-slate-600 hover:border-slate-300 hover:text-slate-800 disabled:opacity-50 dark:border-border dark:text-slate-300 dark:hover:text-slate-100",
480
480
  children: [
481
- te > 0 ? /* @__PURE__ */ t(tt, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ t(rt, { className: "h-3 w-3" }),
482
- te > 0 ? "Uploading…" : "Upload"
481
+ ee > 0 ? /* @__PURE__ */ t(tt, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ t(rt, { className: "h-3 w-3" }),
482
+ ee > 0 ? "Uploading…" : "Upload"
483
483
  ]
484
484
  }
485
485
  ),
@@ -497,16 +497,16 @@ function At({
497
497
  ] })
498
498
  ] }),
499
499
  /* @__PURE__ */ t(
500
- $t,
500
+ qt,
501
501
  {
502
502
  parentData: _,
503
503
  configuredFields: g,
504
- fieldMap: re,
505
- formData: ee,
506
- onFieldChange: ae,
507
- relations: u,
504
+ fieldMap: me,
505
+ formData: te,
506
+ onFieldChange: X,
507
+ relations: p,
508
508
  collection: r,
509
- prefillParentId: c
509
+ prefillParentId: m
510
510
  }
511
511
  )
512
512
  ] }),
@@ -517,27 +517,27 @@ function At({
517
517
  {
518
518
  size: "sm",
519
519
  className: "h-8 bg-nvr-cyan text-[12px] font-medium text-white hover:bg-nvr-cyan/90",
520
- disabled: !C.trim() || oe.isPending,
521
- onClick: () => oe.mutate(),
522
- children: oe.isPending ? "Creating…" : "Create Addendum"
520
+ disabled: !C.trim() || u.isPending,
521
+ onClick: () => u.mutate(),
522
+ children: u.isPending ? "Creating…" : "Create Addendum"
523
523
  }
524
524
  )
525
525
  ] })
526
526
  ] }) }) });
527
527
  }
528
528
  function Mt({ addendum: r }) {
529
- var $;
530
- const c = xe(), v = [r.created_by, r.approved_by].filter(Boolean), { data: k = {} } = G({
529
+ var F;
530
+ const m = xe(), v = [r.created_by, r.approved_by].filter(Boolean), { data: k = {} } = V({
531
531
  queryKey: ["addendum-users", ...v.sort()],
532
532
  queryFn: async () => {
533
- const m = await c.request(
533
+ const c = await m.request(
534
534
  Q("/items/nivaro_users", {
535
535
  filter: JSON.stringify({ id: { _in: v } }),
536
536
  fields: "id,first_name,last_name"
537
537
  })
538
538
  ).then((g) => g.data ?? []);
539
539
  return Object.fromEntries(
540
- m.map((g) => [
540
+ c.map((g) => [
541
541
  String(g.id).toUpperCase(),
542
542
  [g.first_name, g.last_name].filter(Boolean).join(" ")
543
543
  ])
@@ -545,24 +545,24 @@ function Mt({ addendum: r }) {
545
545
  },
546
546
  enabled: v.length > 0,
547
547
  staleTime: 3e5
548
- }), N = (m) => m && k[String(m).toUpperCase()] || null, h = (m) => m ? new Date(m).toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric" }) : null, u = N(r.created_by), _ = N(r.approved_by), f = [];
548
+ }), N = (c) => c && k[String(c).toUpperCase()] || null, h = (c) => c ? new Date(c).toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric" }) : null, p = N(r.created_by), _ = N(r.approved_by), f = [];
549
549
  return r.timeline_impact_days != null && Number(r.timeline_impact_days) !== 0 && f.push({
550
550
  label: "Timeline impact",
551
551
  value: `${r.timeline_impact_days > 0 ? "+" : ""}${r.timeline_impact_days} days`
552
552
  }), r.created_at && f.push({
553
553
  label: "Created",
554
- value: [h(r.created_at), u].filter(Boolean).join(" · ")
554
+ value: [h(r.created_at), p].filter(Boolean).join(" · ")
555
555
  }), r.status === "approved" && (r.approved_at || _) && f.push({
556
556
  label: "Approved",
557
557
  value: [h(r.approved_at), _].filter(Boolean).join(" · ")
558
- }), f.length === 0 && !r.description && !(($ = r.attachments) != null && $.length) ? null : /* @__PURE__ */ i("dl", { className: D(We, "px-4 py-3.5"), children: [
559
- f.map((m) => /* @__PURE__ */ i(Ce, { children: [
560
- /* @__PURE__ */ t("dt", { className: ce, children: m.label }),
561
- /* @__PURE__ */ t("dd", { className: me, children: m.value })
562
- ] }, m.label)),
558
+ }), f.length === 0 && !r.description && !((F = r.attachments) != null && F.length) ? null : /* @__PURE__ */ i("dl", { className: D(We, "px-4 py-3.5"), children: [
559
+ f.map((c) => /* @__PURE__ */ i(Ce, { children: [
560
+ /* @__PURE__ */ t("dt", { className: de, children: c.label }),
561
+ /* @__PURE__ */ t("dd", { className: ce, children: c.value })
562
+ ] }, c.label)),
563
563
  r.description && /* @__PURE__ */ i(Ne, { children: [
564
- /* @__PURE__ */ t("dt", { className: ce, children: "Justification" }),
565
- /* @__PURE__ */ t("dd", { className: me, children: /^\s*</.test(r.description) ? /* @__PURE__ */ t(
564
+ /* @__PURE__ */ t("dt", { className: de, children: "Justification" }),
565
+ /* @__PURE__ */ t("dd", { className: ce, children: /^\s*</.test(r.description) ? /* @__PURE__ */ t(
566
566
  "div",
567
567
  {
568
568
  className: "nvr-addendum-reason max-w-[75ch] leading-relaxed [&_a]:text-nvr-cyan [&_a]:underline [&_li]:ml-4 [&_ol]:list-decimal [&_p]:mb-1 [&_ul]:list-disc",
@@ -570,32 +570,32 @@ function Mt({ addendum: r }) {
570
570
  }
571
571
  ) : /* @__PURE__ */ t("p", { className: "max-w-[75ch] whitespace-pre-wrap leading-relaxed", children: r.description }) })
572
572
  ] }),
573
- /* @__PURE__ */ t(jt, { ids: r.attachments })
573
+ /* @__PURE__ */ t(Pt, { ids: r.attachments })
574
574
  ] });
575
575
  }
576
- function jt({ ids: r }) {
577
- const c = xe(), [v, k] = R(null), N = Array.isArray(r) ? r.filter(Boolean) : [], { data: h = [] } = G({
576
+ function Pt({ ids: r }) {
577
+ const m = xe(), [v, k] = j(null), N = Array.isArray(r) ? r.filter(Boolean) : [], { data: h = [] } = V({
578
578
  queryKey: ["addendum-files", ...N],
579
579
  queryFn: () => Promise.all(
580
580
  N.map(
581
- (u) => c.request(Q(`/files/${u}/meta`)).then((_) => {
582
- var f, $, m, g, C, w;
581
+ (p) => m.request(Q(`/files/${p}/meta`)).then((_) => {
582
+ var f, F, c, g, C, w;
583
583
  return {
584
- id: u,
585
- filename: ((f = _.data) == null ? void 0 : f.filename_download) ?? (($ = _.data) == null ? void 0 : $.filename) ?? ((m = _.data) == null ? void 0 : m.title) ?? null,
584
+ id: p,
585
+ filename: ((f = _.data) == null ? void 0 : f.filename_download) ?? ((F = _.data) == null ? void 0 : F.filename) ?? ((c = _.data) == null ? void 0 : c.title) ?? null,
586
586
  size: ((g = _.data) == null ? void 0 : g.filesize) ?? null,
587
587
  type: ((C = _.data) == null ? void 0 : C.type) ?? null,
588
588
  missing: !!((w = _.data) != null && w.missing_at)
589
589
  };
590
- }).catch(() => ({ id: u, filename: null, size: null, type: null, missing: !1 }))
590
+ }).catch(() => ({ id: p, filename: null, size: null, type: null, missing: !1 }))
591
591
  )
592
592
  ),
593
593
  enabled: N.length > 0,
594
594
  staleTime: 3e5
595
595
  });
596
596
  return N.length === 0 ? null : /* @__PURE__ */ i(Ne, { children: [
597
- /* @__PURE__ */ t("dt", { className: ce, children: "Attachments" }),
598
- /* @__PURE__ */ i("dd", { className: D(me, "flex flex-wrap gap-x-4 gap-y-1"), children: [
597
+ /* @__PURE__ */ t("dt", { className: de, children: "Attachments" }),
598
+ /* @__PURE__ */ i("dd", { className: D(ce, "flex flex-wrap gap-x-4 gap-y-1"), children: [
599
599
  v && /* @__PURE__ */ t(it, { file: v, onClose: () => k(null) }),
600
600
  h.length === 0 && /* @__PURE__ */ i("span", { className: "text-slate-400 dark:text-slate-500", children: [
601
601
  N.length,
@@ -603,20 +603,20 @@ function jt({ ids: r }) {
603
603
  N.length === 1 ? "file" : "files",
604
604
  "…"
605
605
  ] }),
606
- h.map((u) => /* @__PURE__ */ i(
606
+ h.map((p) => /* @__PURE__ */ i(
607
607
  "button",
608
608
  {
609
609
  type: "button",
610
610
  onClick: () => k({
611
- id: u.id,
612
- url: c.fileUrl(u.id),
613
- name: u.filename ?? `File ${u.id.slice(0, 8)}…`,
614
- type: u.type,
615
- size: u.size
611
+ id: p.id,
612
+ url: m.fileUrl(p.id),
613
+ name: p.filename ?? `File ${p.id.slice(0, 8)}…`,
614
+ type: p.type,
615
+ size: p.size
616
616
  }),
617
617
  className: "inline-flex min-w-0 items-center gap-1.5 rounded text-slate-700 underline-offset-2 transition-colors hover:text-nvr-cyan hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/40 dark:text-slate-200",
618
618
  children: [
619
- u.missing && /* @__PURE__ */ t(
619
+ p.missing && /* @__PURE__ */ t(
620
620
  "span",
621
621
  {
622
622
  className: "rounded bg-red-500/10 px-1 py-px text-[9px] font-semibold uppercase tracking-wide text-red-600 dark:text-red-400",
@@ -625,149 +625,149 @@ function jt({ ids: r }) {
625
625
  }
626
626
  ),
627
627
  /* @__PURE__ */ t(Ue, { className: "h-3 w-3 shrink-0 text-slate-400" }),
628
- /* @__PURE__ */ t("span", { className: "max-w-[320px] truncate", children: u.filename ?? `File ${u.id.slice(0, 8)}…` })
628
+ /* @__PURE__ */ t("span", { className: "max-w-[320px] truncate", children: p.filename ?? `File ${p.id.slice(0, 8)}…` })
629
629
  ]
630
630
  },
631
- u.id
631
+ p.id
632
632
  ))
633
633
  ] })
634
634
  ] });
635
635
  }
636
- function Pt({
636
+ function jt({
637
637
  addendum: r,
638
- configuredFields: c,
638
+ configuredFields: m,
639
639
  onRefresh: v,
640
640
  isActive: k,
641
641
  relations: N = [],
642
642
  parentCollection: h,
643
- parentId: u,
643
+ parentId: p,
644
644
  fieldMap: _ = {}
645
645
  }) {
646
- var Pe, Re;
647
- const f = xe(), [$, m] = R(!1), g = r.workflow_template_id && ["draft", "review"].includes(r.status) ? "in approvals" : r.status, C = g === "in approvals" ? Ae.review : Ae[r.status] ?? Ae.draft, w = r.data ?? {}, O = Object.keys(w).filter((e) => Array.isArray(w[e])).map((e) => c.find((a) => a.field === e) ?? { field: e }).map((e) => {
648
- const a = N.find(
649
- (n) => n.one_collection === h && !n.junction_field && (n.one_field === e.field || n.many_collection === e.field)
646
+ var je, Re;
647
+ const f = xe(), [F, c] = j(!1), g = r.workflow_template_id && ["draft", "review"].includes(r.status) ? "in approvals" : r.status, C = g === "in approvals" ? Ae.review : Ae[r.status] ?? Ae.draft, w = r.data ?? {}, R = Object.keys(w).filter((e) => Array.isArray(w[e])).map((e) => m.find((n) => n.field === e) ?? { field: e }).map((e) => {
648
+ const n = N.find(
649
+ (l) => l.one_collection === h && !l.junction_field && (l.one_field === e.field || l.many_collection === e.field)
650
650
  );
651
- return { field: e.field, rel: a };
651
+ return { field: e.field, rel: n };
652
652
  }).filter((e) => {
653
- var a, n;
654
- return ((a = e.rel) == null ? void 0 : a.many_collection) && ((n = e.rel) == null ? void 0 : n.many_field);
653
+ var n, l;
654
+ return ((n = e.rel) == null ? void 0 : n.many_collection) && ((l = e.rel) == null ? void 0 : l.many_field);
655
655
  }), P = De({
656
- queries: O.map(({ rel: e }) => ({
657
- queryKey: ["o2m-rows", e.many_collection, e.many_field, u],
656
+ queries: R.map(({ rel: e }) => ({
657
+ queryKey: ["o2m-rows", e.many_collection, e.many_field, p],
658
658
  queryFn: () => f.request(
659
659
  Q(`/items/${e.many_collection}`, {
660
- filter: JSON.stringify({ [e.many_field]: { _eq: u } }),
660
+ filter: JSON.stringify({ [e.many_field]: { _eq: p } }),
661
661
  limit: 200
662
662
  })
663
- ).then((a) => a.data ?? []),
663
+ ).then((n) => n.data ?? []),
664
664
  staleTime: 3e4,
665
- enabled: !!u
665
+ enabled: !!p
666
666
  }))
667
- }), J = ["approved", "reverted"].includes(r.status), { data: te } = G({
667
+ }), J = ["approved", "reverted"].includes(r.status), { data: ee } = V({
668
668
  queryKey: ["addendum-lines", r.id],
669
669
  queryFn: () => f.request(Q(`/addendums/${r.id}/lines`)).then((e) => e.data ?? {}),
670
- enabled: $ && J,
670
+ enabled: F && J,
671
671
  staleTime: 6e4
672
- }), M = Object.fromEntries(
673
- P.map((e, a) => [
674
- O[a].field,
672
+ }), A = Object.fromEntries(
673
+ P.map((e, n) => [
674
+ R[n].field,
675
675
  e.data ?? null
676
676
  ])
677
- ), Z = pe({
677
+ ), G = pe({
678
678
  mutationFn: () => f.request(ve(`/addendums/${r.id}/approve`)),
679
679
  onSuccess: () => {
680
680
  v(), z.success("Addendum approved — changes applied to record");
681
681
  },
682
682
  onError: (e) => {
683
- var n, b;
684
- const a = (b = (n = e == null ? void 0 : e.response) == null ? void 0 : n.data) == null ? void 0 : b.error;
685
- z.error(a ?? "Failed to approve");
683
+ var l, b;
684
+ const n = (b = (l = e == null ? void 0 : e.response) == null ? void 0 : l.data) == null ? void 0 : b.error;
685
+ z.error(n ?? "Failed to approve");
686
686
  }
687
- }), j = pe({
687
+ }), M = pe({
688
688
  mutationFn: () => f.request(ve(`/addendums/${r.id}/revert`)),
689
689
  onSuccess: () => {
690
- X(), z.success("Addendum reverted — the record is back to its pre-approval values");
690
+ Y(), z.success("Addendum reverted — the record is back to its pre-approval values");
691
691
  },
692
692
  onError: (e) => {
693
- var n, b;
694
- const a = (b = (n = e == null ? void 0 : e.response) == null ? void 0 : n.data) == null ? void 0 : b.error;
695
- z.error(a ?? "Failed to revert", { duration: 1e4 });
693
+ var l, b;
694
+ const n = (b = (l = e == null ? void 0 : e.response) == null ? void 0 : l.data) == null ? void 0 : b.error;
695
+ z.error(n ?? "Failed to revert", { duration: 1e4 });
696
696
  }
697
- }), [ee, E] = R(!1), [re, ae] = R(!1), W = Qe(), X = () => {
697
+ }), [te, E] = j(!1), [me, X] = j(!1), W = Qe(), Y = () => {
698
698
  v(), W.invalidateQueries({ queryKey: ["addendums"] }), W.invalidateQueries({ queryKey: ["item-actions"] }), W.invalidateQueries({ queryKey: ["ext-item-actions"] }), W.invalidateQueries({ queryKey: ["pipeline-all-owners"] }), W.invalidateQueries({ queryKey: ["item"] }), W.invalidateQueries({ queryKey: ["o2m-rows"] }), W.invalidateQueries({ queryKey: ["pipeline-instance"] });
699
- }, H = pe({
699
+ }, L = pe({
700
700
  mutationFn: () => f.request(lt(`/addendums/${r.id}`)),
701
701
  onSuccess: () => {
702
- X(), z.success("Addendum deleted");
702
+ Y(), z.success("Addendum deleted");
703
703
  },
704
704
  onError: (e) => {
705
- var n, b;
706
- const a = (b = (n = e == null ? void 0 : e.response) == null ? void 0 : n.data) == null ? void 0 : b.error;
707
- z.error(a ?? "Failed to delete", { duration: 1e4 });
705
+ var l, b;
706
+ const n = (b = (l = e == null ? void 0 : e.response) == null ? void 0 : l.data) == null ? void 0 : b.error;
707
+ z.error(n ?? "Failed to delete", { duration: 1e4 });
708
708
  }
709
- }), { isAdmin: ie } = nt(), L = pe({
709
+ }), { isAdmin: re } = at(), se = pe({
710
710
  mutationFn: () => f.request(ve(`/addendums/${r.id}/reject`)),
711
711
  onSuccess: () => {
712
712
  v(), z.success("Addendum rejected");
713
713
  },
714
714
  onError: () => z.error("Failed to reject")
715
- }), V = pe({
715
+ }), ne = pe({
716
716
  mutationFn: () => f.request(ve(`/addendums/${r.id}/submit`)),
717
717
  onSuccess: () => {
718
718
  v(), z.success("Submitted for review");
719
719
  },
720
720
  onError: () => z.error("Failed to submit")
721
- }), p = c.filter((e) => w[e.field] !== void 0), q = (e) => e.computed_type === "rollup" ? Je(e.computed_formula) : [], ne = (e) => {
722
- const a = N.find(
723
- (n) => n.one_collection === h && n.many_collection === e.related_collection && n.many_field === e.fk_field && !n.junction_field
721
+ }), ie = m.filter((e) => w[e.field] !== void 0), Z = (e) => e.computed_type === "rollup" ? Je(e.computed_formula) : [], U = (e) => {
722
+ const n = N.find(
723
+ (l) => l.one_collection === h && l.many_collection === e.related_collection && l.many_field === e.fk_field && !l.junction_field
724
724
  );
725
- return a ? a.one_field ?? a.many_collection : null;
726
- }, U = de(
725
+ return n ? n.one_field ?? n.many_collection : null;
726
+ }, O = oe(
727
727
  () => Object.values(_).filter((e) => {
728
- const a = q(e);
729
- return a.length > 0 && !a.some((n) => n.recursive) && a.every((n) => {
730
- const b = ne(n);
728
+ const n = Z(e);
729
+ return n.length > 0 && !n.some((l) => l.recursive) && n.every((l) => {
730
+ const b = U(l);
731
731
  return !!b && Array.isArray(w[b]);
732
732
  });
733
733
  }),
734
734
  // biome-ignore lint/correctness/useExhaustiveDependencies: helpers close over relations/parentCollection
735
735
  [_, w, N, h]
736
- ), oe = de(
736
+ ), u = oe(
737
737
  () => [
738
738
  ...new Set(
739
- U.flatMap((e) => q(e).map((a) => a.related_collection))
739
+ O.flatMap((e) => Z(e).map((n) => n.related_collection))
740
740
  )
741
741
  ],
742
- [U]
743
- ), l = De({
744
- queries: oe.map((e) => ({
742
+ [O]
743
+ ), a = De({
744
+ queries: u.map((e) => ({
745
745
  queryKey: ["field-config", e, null],
746
- queryFn: () => f.request(Q(`/field-config/${e}`)).then((a) => a.data ?? []),
746
+ queryFn: () => f.request(Q(`/field-config/${e}`)).then((n) => n.data ?? []),
747
747
  staleTime: 6e4
748
748
  }))
749
- }), s = l.map((e) => e.dataUpdatedAt).join(","), d = p.filter((e) => {
750
- const a = w[e.field];
751
- return a != null && typeof a == "object" || a == null ? !1 : !N.some(
752
- (n) => n.one_collection === h && (n.one_field === e.field || n.many_collection === e.field)
749
+ }), s = a.map((e) => e.dataUpdatedAt).join(","), d = ie.filter((e) => {
750
+ const n = w[e.field];
751
+ return n != null && typeof n == "object" || n == null ? !1 : !N.some(
752
+ (l) => l.one_collection === h && (l.one_field === e.field || l.many_collection === e.field)
753
753
  );
754
- }), { data: o } = G({
754
+ }), { data: o } = V({
755
755
  queryKey: [
756
756
  "addendum-current",
757
757
  h,
758
- u,
758
+ p,
759
759
  d.map((e) => e.field).join(","),
760
- U.map((e) => e.field).join(",")
760
+ O.map((e) => e.field).join(",")
761
761
  ],
762
762
  queryFn: () => f.request(
763
- Q(`/items/${h}/${u}`, {
763
+ Q(`/items/${h}/${p}`, {
764
764
  fields: [
765
765
  .../* @__PURE__ */ new Set([
766
766
  "id",
767
767
  ...d.map((e) => e.field),
768
768
  // The rollups themselves (current figure) plus any parent_filter
769
769
  // columns that decide whether the rollup applies to this record.
770
- ...U.flatMap((e) => [
770
+ ...O.flatMap((e) => [
771
771
  e.field,
772
772
  ...Object.keys(Le(e.computed_formula) ?? {})
773
773
  ])
@@ -775,63 +775,63 @@ function Pt({
775
775
  ].join(",")
776
776
  })
777
777
  ).then((e) => e.data ?? null).catch(() => null),
778
- enabled: !!h && !!u && (d.length > 0 || U.length > 0),
778
+ enabled: !!h && !!p && (d.length > 0 || O.length > 0),
779
779
  staleTime: 15e3
780
- }), x = de(() => {
781
- const e = /* @__PURE__ */ new Map(), a = new Map(
782
- oe.map((n, b) => {
783
- var A;
780
+ }), x = oe(() => {
781
+ const e = /* @__PURE__ */ new Map(), n = new Map(
782
+ u.map((l, b) => {
783
+ var $;
784
784
  return [
785
- n,
786
- (A = l[b]) == null ? void 0 : A.data
785
+ l,
786
+ ($ = a[b]) == null ? void 0 : $.data
787
787
  ];
788
788
  })
789
789
  );
790
- for (const n of U) {
791
- const b = Le(n.computed_formula);
790
+ for (const l of O) {
791
+ const b = Le(l.computed_formula);
792
792
  if (b && o && !mt(o, b)) continue;
793
- const A = /* @__PURE__ */ new Map();
794
- let Y = !0;
795
- for (const B of q(n)) {
796
- const ge = ne(B), ue = a.get(B.related_collection);
793
+ const $ = /* @__PURE__ */ new Map();
794
+ let H = !0;
795
+ for (const B of Z(l)) {
796
+ const ge = U(B), ue = n.get(B.related_collection);
797
797
  if (!ge || !ue) {
798
- Y = !1;
798
+ H = !1;
799
799
  break;
800
800
  }
801
801
  const Ge = ue.filter((we) => we.computed_type === "write" && !!we.computed_formula), Xe = w[ge].map((we) => {
802
- const Fe = { ...we };
802
+ const $e = { ...we };
803
803
  for (const Oe of Ge) {
804
- const Te = ct(String(Oe.computed_formula), Fe);
805
- Te !== null && (Fe[Oe.field] = Te);
804
+ const Te = ct(String(Oe.computed_formula), $e);
805
+ Te !== null && ($e[Oe.field] = Te);
806
806
  }
807
- return Fe;
807
+ return $e;
808
808
  });
809
- A.set(`${B.related_collection}.${B.fk_field}`, Xe);
809
+ $.set(`${B.related_collection}.${B.fk_field}`, Xe);
810
810
  }
811
- if (!Y) continue;
812
- const K = Ie(q(n), A);
813
- K !== null && e.set(n.field, Math.round(K * 100) / 100);
811
+ if (!H) continue;
812
+ const K = Ie(Z(l), $);
813
+ K !== null && e.set(l.field, Math.round(K * 100) / 100);
814
814
  }
815
815
  return e;
816
- }, [U, oe, s, w, o]), y = (e, a) => a ? e.filter((n) => {
817
- const b = a.find((A) => String(A.id) === String(n.id));
818
- return b ? Object.keys(n).some(
819
- (A) => A !== "id" && String(n[A] ?? "") !== String(b[A] ?? "")
816
+ }, [O, u, s, w, o]), y = (e, n) => n ? e.filter((l) => {
817
+ const b = n.find(($) => String($.id) === String(l.id));
818
+ return b ? Object.keys(l).some(
819
+ ($) => $ !== "id" && String(l[$] ?? "") !== String(b[$] ?? "")
820
820
  ) : !0;
821
- }).length : e.length, F = [
822
- ...p.filter((e) => {
823
- const a = w[e.field];
824
- if (a == null || a === "") return !1;
825
- if (Array.isArray(a))
826
- return y(a, M[e.field]) > 0;
827
- const n = _[e.field];
828
- return !((n == null ? void 0 : n.computed_type) === "rollup" || (n == null ? void 0 : n.computed_type) === "write" || o && e.field in o && String(o[e.field] ?? "") === String(a));
821
+ }).length : e.length, q = [
822
+ ...ie.filter((e) => {
823
+ const n = w[e.field];
824
+ if (n == null || n === "") return !1;
825
+ if (Array.isArray(n))
826
+ return y(n, A[e.field]) > 0;
827
+ const l = _[e.field];
828
+ return !((l == null ? void 0 : l.computed_type) === "rollup" || (l == null ? void 0 : l.computed_type) === "write" || o && e.field in o && String(o[e.field] ?? "") === String(n));
829
829
  }).map((e) => ({
830
830
  field: e.field,
831
831
  label_override: e.label_override ?? null,
832
832
  value: w[e.field]
833
833
  })),
834
- ...U.flatMap(
834
+ ...O.flatMap(
835
835
  (e) => x.has(e.field) && !(o && o[e.field] != null && Number(o[e.field]) === x.get(e.field)) ? [
836
836
  {
837
837
  field: e.field,
@@ -840,33 +840,33 @@ function Pt({
840
840
  }
841
841
  ] : []
842
842
  )
843
- ], le = F.length, He = (e, a) => {
843
+ ], ae = q.length, He = (e, n) => {
844
844
  var b;
845
- const n = (b = _[e]) == null ? void 0 : b.type;
846
- return n && ["integer", "bigInteger", "decimal", "float", "number"].includes(n) ? !0 : a != null && a !== "" && !Array.isArray(a) && !Number.isNaN(Number(a));
845
+ const l = (b = _[e]) == null ? void 0 : b.type;
846
+ return l && ["integer", "bigInteger", "decimal", "float", "number"].includes(l) ? !0 : n != null && n !== "" && !Array.isArray(n) && !Number.isNaN(Number(n));
847
847
  }, Se = (e) => {
848
- var n;
849
- const a = (n = _[e]) == null ? void 0 : n.options;
850
- return a && typeof a == "object" && a.format === "currency" ? !0 : /amount|cost|price|total|budget|spend/i.test(e);
851
- }, qe = (e, a) => Se(e) ? ye.format(Number(a)) : new Intl.NumberFormat("en-US").format(Number(a)), Ve = de(() => {
848
+ var l;
849
+ const n = (l = _[e]) == null ? void 0 : l.options;
850
+ return n && typeof n == "object" && n.format === "currency" ? !0 : /amount|cost|price|total|budget|spend/i.test(e);
851
+ }, Fe = (e, n) => Se(e) ? ye.format(Number(n)) : new Intl.NumberFormat("en-US").format(Number(n)), Ve = oe(() => {
852
852
  if (r.cost_impact != null && Number(r.cost_impact) !== 0 || !o) return null;
853
853
  for (const e of d) {
854
854
  if (!Se(e.field)) continue;
855
- const a = Number(w[e.field]), n = Number(o[e.field]);
856
- if (!Number.isNaN(a) && !Number.isNaN(n) && a !== n) return a - n;
855
+ const n = Number(w[e.field]), l = Number(o[e.field]);
856
+ if (!Number.isNaN(n) && !Number.isNaN(l) && n !== l) return n - l;
857
857
  }
858
858
  return null;
859
- }, [r.cost_impact, o, d, w]), ke = de(() => {
859
+ }, [r.cost_impact, o, d, w]), ke = oe(() => {
860
860
  if (!o) return null;
861
861
  const e = [
862
- ...d.map((a) => [a.field, Number(w[a.field])]),
862
+ ...d.map((n) => [n.field, Number(w[n.field])]),
863
863
  ...x.entries()
864
- ].flatMap(([a, n]) => {
865
- const b = o[a];
866
- return !Se(a) || b == null || b === "" ? [] : Number.isNaN(Number(b)) || Number.isNaN(n) ? [] : [{ field: a, previous: Number(b), next: n }];
864
+ ].flatMap(([n, l]) => {
865
+ const b = o[n];
866
+ return !Se(n) || b == null || b === "" ? [] : Number.isNaN(Number(b)) || Number.isNaN(l) ? [] : [{ field: n, previous: Number(b), next: l }];
867
867
  });
868
- return e.find((a) => a.previous !== a.next) ?? e[0] ?? null;
869
- }, [o, d, w, x]), _e = kt(r, ke), $e = _e.previous != null || _e.next != null || _e.change != null, be = $e ? (ke == null ? void 0 : ke.field) ?? null : null, Ye = be ? ((Pe = F.find((e) => e.field === be)) == null ? void 0 : Pe.label_override) ?? ((Re = _[be]) == null ? void 0 : Re.label) ?? fe(be) : "Amount";
868
+ return e.find((n) => n.previous !== n.next) ?? e[0] ?? null;
869
+ }, [o, d, w, x]), _e = kt(r, ke), qe = _e.previous != null || _e.next != null || _e.change != null, be = qe ? (ke == null ? void 0 : ke.field) ?? null : null, Ye = be ? ((je = q.find((e) => e.field === be)) == null ? void 0 : je.label_override) ?? ((Re = _[be]) == null ? void 0 : Re.label) ?? fe(be) : "Amount";
870
870
  return /* @__PURE__ */ i(
871
871
  "div",
872
872
  {
@@ -880,7 +880,7 @@ function Pt({
880
880
  {
881
881
  type: "button",
882
882
  className: "flex w-full items-start gap-3 px-4 py-3 text-left",
883
- onClick: () => m((e) => !e),
883
+ onClick: () => c((e) => !e),
884
884
  children: [
885
885
  /* @__PURE__ */ t("span", { className: D("mt-0.5 h-2 w-2 shrink-0 rounded-full", C.dot) }),
886
886
  /* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
@@ -896,22 +896,22 @@ function Pt({
896
896
  children: g
897
897
  }
898
898
  ),
899
- le > 0 && /* @__PURE__ */ i("span", { className: "text-[11px] text-slate-400 dark:text-slate-500", children: [
900
- le,
899
+ ae > 0 && /* @__PURE__ */ i("span", { className: "text-[11px] text-slate-400 dark:text-slate-500", children: [
900
+ ae,
901
901
  " field",
902
- le !== 1 ? "s" : "",
902
+ ae !== 1 ? "s" : "",
903
903
  " changed"
904
904
  ] }),
905
905
  ze(r.cost_impact) ?? ze(Ve)
906
906
  ] }),
907
- r.description && !$ && /* @__PURE__ */ t("p", { className: "mt-0.5 text-[12px] text-slate-500 dark:text-slate-400 line-clamp-1", children: _t(r.description) })
907
+ r.description && !F && /* @__PURE__ */ t("p", { className: "mt-0.5 text-[12px] text-slate-500 dark:text-slate-400 line-clamp-1", children: _t(r.description) })
908
908
  ] }),
909
909
  /* @__PURE__ */ t(
910
910
  "span",
911
911
  {
912
912
  className: D(
913
913
  "shrink-0 text-[10px] text-slate-400 transition-transform",
914
- $ && "rotate-180"
914
+ F && "rotate-180"
915
915
  ),
916
916
  children: "▾"
917
917
  }
@@ -919,33 +919,33 @@ function Pt({
919
919
  ]
920
920
  }
921
921
  ),
922
- $ && /* @__PURE__ */ i("div", { className: "border-t border-slate-100 dark:border-border", children: [
922
+ F && /* @__PURE__ */ i("div", { className: "border-t border-slate-100 dark:border-border", children: [
923
923
  /* @__PURE__ */ t(Mt, { addendum: r }),
924
- (le > 0 || $e) && /* @__PURE__ */ i("section", { className: "border-t border-slate-100 px-4 py-3.5 dark:border-border", children: [
924
+ (ae > 0 || qe) && /* @__PURE__ */ i("section", { className: "border-t border-slate-100 px-4 py-3.5 dark:border-border", children: [
925
925
  /* @__PURE__ */ t("h4", { className: "mb-3 text-[12.5px] font-semibold text-slate-800 dark:text-slate-100", children: J ? "Changes" : "Proposed changes" }),
926
926
  /* @__PURE__ */ i("dl", { className: We, children: [
927
- $e && /* @__PURE__ */ i(Ne, { children: [
928
- /* @__PURE__ */ t("dt", { className: ce, children: Ye }),
929
- /* @__PURE__ */ t("dd", { className: me, children: /* @__PURE__ */ t(wt, { amounts: _e }) })
927
+ qe && /* @__PURE__ */ i(Ne, { children: [
928
+ /* @__PURE__ */ t("dt", { className: de, children: Ye }),
929
+ /* @__PURE__ */ t("dd", { className: ce, children: /* @__PURE__ */ t(wt, { amounts: _e }) })
930
930
  ] }),
931
- F.map((e) => {
931
+ q.map((e) => {
932
932
  var b;
933
- const a = e.value;
934
- if (e.field === be || Array.isArray(a) && M[e.field]) return null;
935
- let n;
936
- if (a == null)
937
- n = "—";
938
- else if (Array.isArray(a))
939
- n = `${a.length} row${a.length === 1 ? "" : "s"}`;
940
- else if (typeof a == "object")
941
- n = JSON.stringify(a).slice(0, 60);
942
- else if (He(e.field, a)) {
943
- const A = Number(a), Y = o == null ? void 0 : o[e.field], K = Y != null && Y !== "" && !Number.isNaN(Number(Y)) ? Number(Y) : null, B = K != null ? A - K : 0;
944
- n = /* @__PURE__ */ i("span", { className: "inline-flex flex-wrap items-baseline gap-x-1.5 tabular-nums", children: [
945
- K != null && K !== A && /* @__PURE__ */ t("span", { className: "text-slate-400 line-through decoration-slate-300 dark:text-slate-500 dark:decoration-slate-600", children: qe(e.field, K) }),
933
+ const n = e.value;
934
+ if (e.field === be || Array.isArray(n) && A[e.field]) return null;
935
+ let l;
936
+ if (n == null)
937
+ l = "—";
938
+ else if (Array.isArray(n))
939
+ l = `${n.length} row${n.length === 1 ? "" : "s"}`;
940
+ else if (typeof n == "object")
941
+ l = JSON.stringify(n).slice(0, 60);
942
+ else if (He(e.field, n)) {
943
+ const $ = Number(n), H = o == null ? void 0 : o[e.field], K = H != null && H !== "" && !Number.isNaN(Number(H)) ? Number(H) : null, B = K != null ? $ - K : 0;
944
+ l = /* @__PURE__ */ i("span", { className: "inline-flex flex-wrap items-baseline gap-x-1.5 tabular-nums", children: [
945
+ K != null && K !== $ && /* @__PURE__ */ t("span", { className: "text-slate-400 line-through decoration-slate-300 dark:text-slate-500 dark:decoration-slate-600", children: Fe(e.field, K) }),
946
946
  /* @__PURE__ */ i("span", { className: "font-medium text-foreground", children: [
947
- K != null && K !== A && /* @__PURE__ */ t("span", { className: "mr-1 font-normal text-slate-400", "aria-hidden": "true", children: "→" }),
948
- qe(e.field, A)
947
+ K != null && K !== $ && /* @__PURE__ */ t("span", { className: "mr-1 font-normal text-slate-400", "aria-hidden": "true", children: "→" }),
948
+ Fe(e.field, $)
949
949
  ] }),
950
950
  B !== 0 && /* @__PURE__ */ i(
951
951
  "span",
@@ -956,52 +956,52 @@ function Pt({
956
956
  ),
957
957
  children: [
958
958
  B > 0 ? "+" : "−",
959
- qe(e.field, Math.abs(B))
959
+ Fe(e.field, Math.abs(B))
960
960
  ]
961
961
  }
962
962
  )
963
963
  ] });
964
964
  } else
965
- n = String(a);
965
+ l = String(n);
966
966
  return /* @__PURE__ */ i(Ce, { children: [
967
- /* @__PURE__ */ t("dt", { className: ce, children: e.label_override ?? ((b = _[e.field]) == null ? void 0 : b.label) ?? fe(e.field) }),
968
- /* @__PURE__ */ t("dd", { className: D(me, "break-words"), children: n })
967
+ /* @__PURE__ */ t("dt", { className: de, children: e.label_override ?? ((b = _[e.field]) == null ? void 0 : b.label) ?? fe(e.field) }),
968
+ /* @__PURE__ */ t("dd", { className: D(ce, "break-words"), children: l })
969
969
  ] }, e.field);
970
970
  }),
971
- J && Object.entries(te ?? {}).map(([e, a]) => {
972
- var n, b;
971
+ J && Object.entries(ee ?? {}).map(([e, n]) => {
972
+ var l, b;
973
973
  return /* @__PURE__ */ i(Ce, { children: [
974
- /* @__PURE__ */ t("dt", { className: ce, children: ((n = _[e]) == null ? void 0 : n.label) ?? fe(e) }),
975
- /* @__PURE__ */ t("dd", { className: me, children: /* @__PURE__ */ t(
974
+ /* @__PURE__ */ t("dt", { className: de, children: ((l = _[e]) == null ? void 0 : l.label) ?? fe(e) }),
975
+ /* @__PURE__ */ t("dd", { className: ce, children: /* @__PURE__ */ t(
976
976
  Ke,
977
977
  {
978
978
  client: f,
979
- childCollection: a.collection,
980
- fkField: a.fk,
981
- proposed: a.after,
982
- original: a.before,
979
+ childCollection: n.collection,
980
+ fkField: n.fk,
981
+ proposed: n.after,
982
+ original: n.before,
983
983
  ignoreMissing: !0,
984
984
  label: ((b = _[e]) == null ? void 0 : b.label) ?? fe(e)
985
985
  }
986
986
  ) })
987
987
  ] }, `applied-${e}`);
988
988
  }),
989
- O.map(({ field: e, rel: a }) => {
989
+ R.map(({ field: e, rel: n }) => {
990
990
  var B, ge;
991
- const n = w[e], b = O.findIndex((ue) => ue.field === e), A = M[e] ?? ((B = P[b]) != null && B.isLoading ? null : []);
992
- if (J || !Array.isArray(n) || !A || !(a != null && a.many_collection) || !a.many_field)
991
+ const l = w[e], b = R.findIndex((ue) => ue.field === e), $ = A[e] ?? ((B = P[b]) != null && B.isLoading ? null : []);
992
+ if (J || !Array.isArray(l) || !$ || !(n != null && n.many_collection) || !n.many_field)
993
993
  return null;
994
- const Y = c.find((ue) => ue.field === e), K = (Y == null ? void 0 : Y.label_override) ?? ((ge = _[e]) == null ? void 0 : ge.label) ?? fe(e);
994
+ const H = m.find((ue) => ue.field === e), K = (H == null ? void 0 : H.label_override) ?? ((ge = _[e]) == null ? void 0 : ge.label) ?? fe(e);
995
995
  return /* @__PURE__ */ i(Ce, { children: [
996
- /* @__PURE__ */ t("dt", { className: ce, children: K }),
997
- /* @__PURE__ */ t("dd", { className: me, children: /* @__PURE__ */ t(
996
+ /* @__PURE__ */ t("dt", { className: de, children: K }),
997
+ /* @__PURE__ */ t("dd", { className: ce, children: /* @__PURE__ */ t(
998
998
  Ke,
999
999
  {
1000
1000
  client: f,
1001
- childCollection: a.many_collection,
1002
- fkField: a.many_field,
1003
- proposed: n,
1004
- original: A,
1001
+ childCollection: n.many_collection,
1002
+ fkField: n.many_field,
1003
+ proposed: l,
1004
+ original: $,
1005
1005
  label: K
1006
1006
  }
1007
1007
  ) })
@@ -1011,19 +1011,19 @@ function Pt({
1011
1011
  ] }),
1012
1012
  r.workflow_template_id && /* @__PURE__ */ i("div", { className: "border-t border-slate-100 dark:border-border px-4 py-3.5", children: [
1013
1013
  /* @__PURE__ */ t("h4", { className: "mb-3 text-[12.5px] font-semibold text-slate-800 dark:text-slate-100", children: "Workflow" }),
1014
- /* @__PURE__ */ t(Ft, { addendumId: r.id }),
1015
- ie && /* @__PURE__ */ t("div", { className: "mt-2 flex items-center justify-end gap-2", children: r.status === "approved" ? r.legacy_id != null ? null : ee ? /* @__PURE__ */ i("span", { className: "flex items-center gap-1.5", children: [
1014
+ /* @__PURE__ */ t($t, { addendumId: r.id }),
1015
+ re && /* @__PURE__ */ t("div", { className: "mt-2 flex items-center justify-end gap-2", children: r.status === "approved" ? r.legacy_id != null ? null : te ? /* @__PURE__ */ i("span", { className: "flex items-center gap-1.5", children: [
1016
1016
  /* @__PURE__ */ t("span", { className: "text-[11px] text-amber-600 dark:text-amber-400", children: "Roll every applied change back?" }),
1017
1017
  /* @__PURE__ */ t(
1018
1018
  I,
1019
1019
  {
1020
1020
  size: "sm",
1021
1021
  className: "h-6 bg-amber-600 px-2 text-[11px] text-white hover:bg-amber-700",
1022
- disabled: j.isPending,
1022
+ disabled: M.isPending,
1023
1023
  onClick: () => {
1024
- j.mutate(), E(!1);
1024
+ M.mutate(), E(!1);
1025
1025
  },
1026
- children: j.isPending ? "Reverting…" : "Revert"
1026
+ children: M.isPending ? "Reverting…" : "Revert"
1027
1027
  }
1028
1028
  ),
1029
1029
  /* @__PURE__ */ t(
@@ -1045,18 +1045,18 @@ function Pt({
1045
1045
  className: "text-[11px] text-slate-400 underline decoration-dotted underline-offset-2 hover:text-amber-600",
1046
1046
  children: "Revert…"
1047
1047
  }
1048
- ) : re ? /* @__PURE__ */ i("span", { className: "flex items-center gap-1.5", children: [
1048
+ ) : me ? /* @__PURE__ */ i("span", { className: "flex items-center gap-1.5", children: [
1049
1049
  /* @__PURE__ */ t("span", { className: "text-[11px] text-red-600 dark:text-red-400", children: "Delete this addendum and its approval workflow?" }),
1050
1050
  /* @__PURE__ */ t(
1051
1051
  I,
1052
1052
  {
1053
1053
  size: "sm",
1054
1054
  className: "h-6 bg-red-600 px-2 text-[11px] text-white hover:bg-red-700",
1055
- disabled: H.isPending,
1055
+ disabled: L.isPending,
1056
1056
  onClick: () => {
1057
- H.mutate(), ae(!1);
1057
+ L.mutate(), X(!1);
1058
1058
  },
1059
- children: H.isPending ? "Deleting…" : "Delete"
1059
+ children: L.isPending ? "Deleting…" : "Delete"
1060
1060
  }
1061
1061
  ),
1062
1062
  /* @__PURE__ */ t(
@@ -1065,7 +1065,7 @@ function Pt({
1065
1065
  size: "sm",
1066
1066
  variant: "ghost",
1067
1067
  className: "h-6 px-2 text-[11px]",
1068
- onClick: () => ae(!1),
1068
+ onClick: () => X(!1),
1069
1069
  children: "Cancel"
1070
1070
  }
1071
1071
  )
@@ -1074,7 +1074,7 @@ function Pt({
1074
1074
  {
1075
1075
  type: "button",
1076
1076
  "data-tip": "Admin only — removes the addendum and its approval workflow; nothing has applied to the record yet",
1077
- onClick: () => ae(!0),
1077
+ onClick: () => X(!0),
1078
1078
  className: "text-[11px] text-slate-400 underline decoration-dotted underline-offset-2 hover:text-red-600",
1079
1079
  children: "Delete addendum…"
1080
1080
  }
@@ -1087,9 +1087,9 @@ function Pt({
1087
1087
  size: "sm",
1088
1088
  variant: "outline",
1089
1089
  className: "h-7 text-[11px]",
1090
- onClick: () => V.mutate(),
1091
- disabled: V.isPending,
1092
- children: V.isPending ? "Submitting…" : "Submit for Review"
1090
+ onClick: () => ne.mutate(),
1091
+ disabled: ne.isPending,
1092
+ children: ne.isPending ? "Submitting…" : "Submit for Review"
1093
1093
  }
1094
1094
  ),
1095
1095
  r.status === "review" && !r.workflow_template_id && /* @__PURE__ */ i(Ne, { children: [
@@ -1099,8 +1099,8 @@ function Pt({
1099
1099
  size: "sm",
1100
1100
  variant: "outline",
1101
1101
  className: "h-7 border-red-200 text-[11px] text-red-600 hover:bg-red-50 dark:border-red-800 dark:text-red-400 dark:hover:bg-red-900/20",
1102
- onClick: () => L.mutate(),
1103
- disabled: L.isPending,
1102
+ onClick: () => se.mutate(),
1103
+ disabled: se.isPending,
1104
1104
  children: "Reject"
1105
1105
  }
1106
1106
  ),
@@ -1109,26 +1109,26 @@ function Pt({
1109
1109
  {
1110
1110
  size: "sm",
1111
1111
  className: "h-7 bg-emerald-600 text-[11px] text-white hover:bg-emerald-700",
1112
- onClick: () => Z.mutate(),
1113
- disabled: Z.isPending,
1114
- children: Z.isPending ? "Approving…" : "Approve"
1112
+ onClick: () => G.mutate(),
1113
+ disabled: G.isPending,
1114
+ children: G.isPending ? "Approving…" : "Approve"
1115
1115
  }
1116
1116
  )
1117
1117
  ] }),
1118
1118
  !r.workflow_template_id && (r.status === "approved" || r.status === "rejected") && /* @__PURE__ */ t("span", { className: "text-[11px] text-slate-400 dark:text-slate-500 italic", children: r.status === "approved" ? "Changes applied to record" : "No changes applied" }),
1119
1119
  r.status === "reverted" && /* @__PURE__ */ t("span", { className: "text-[11px] italic text-amber-600 dark:text-amber-400", children: "Reverted — the applied changes were rolled back" }),
1120
- ie && r.status === "approved" && r.legacy_id == null && (ee ? /* @__PURE__ */ i("span", { className: "ml-auto flex items-center gap-1.5", children: [
1120
+ re && r.status === "approved" && r.legacy_id == null && (te ? /* @__PURE__ */ i("span", { className: "ml-auto flex items-center gap-1.5", children: [
1121
1121
  /* @__PURE__ */ t("span", { className: "text-[11px] text-amber-600 dark:text-amber-400", children: "Roll every applied change back?" }),
1122
1122
  /* @__PURE__ */ t(
1123
1123
  I,
1124
1124
  {
1125
1125
  size: "sm",
1126
1126
  className: "h-7 bg-amber-600 text-[11px] text-white hover:bg-amber-700",
1127
- disabled: j.isPending,
1127
+ disabled: M.isPending,
1128
1128
  onClick: () => {
1129
- j.mutate(), E(!1);
1129
+ M.mutate(), E(!1);
1130
1130
  },
1131
- children: j.isPending ? "Reverting…" : "Revert"
1131
+ children: M.isPending ? "Reverting…" : "Revert"
1132
1132
  }
1133
1133
  ),
1134
1134
  /* @__PURE__ */ t(
@@ -1157,90 +1157,88 @@ function Pt({
1157
1157
  }
1158
1158
  );
1159
1159
  }
1160
- function nr({
1160
+ function ar({
1161
1161
  collection: r,
1162
- item: c,
1162
+ item: m,
1163
1163
  addendumLayoutId: v,
1164
1164
  canCreate: k = !0,
1165
1165
  onActiveCountChange: N,
1166
1166
  onApplied: h,
1167
- onCreated: u,
1167
+ onCreated: p,
1168
1168
  defaultExpanded: _ = !0
1169
1169
  }) {
1170
- const f = xe(), $ = Qe(), [m, g] = R(!1), [C, w] = R(!_), [T, O] = R(!1), {
1170
+ const f = xe(), F = Qe(), [c, g] = j(!1), [C, w] = j(!_), [T, R] = j(!1), {
1171
1171
  data: P = [],
1172
1172
  isLoading: J,
1173
- refetch: te
1174
- } = G({
1175
- queryKey: ["addendums", r, c],
1176
- queryFn: () => f.request(Q(`/addendums/${r}/${c}`)).then((p) => p.data ?? []),
1173
+ refetch: ee
1174
+ } = V({
1175
+ queryKey: ["addendums", r, m],
1176
+ queryFn: () => f.request(Q(`/addendums/${r}/${m}`)).then((u) => u.data ?? []),
1177
1177
  // The form reads this key first (staleTime 30 s); with none here the panel,
1178
1178
  // mounting just after, counted that answer stale and fetched it again.
1179
1179
  // Live sync and the panel's own writes invalidate it.
1180
1180
  staleTime: 3e4
1181
- }), { data: M, isLoading: Z } = G({
1181
+ }), { data: A, isLoading: G } = V({
1182
1182
  queryKey: ["addendum-layout", r, v ?? "default"],
1183
1183
  queryFn: async () => {
1184
- const p = await f.request(
1185
- Q("/collection-layouts", { collection: r, layout_type: "addendum" })
1186
- ).then((q) => q.data ?? []);
1187
- return v != null ? p.find((q) => q.id === v) ?? null : p[0] ?? null;
1184
+ const u = await f.request(Q("/collection-layouts", { collection: r })).then((a) => (a.data ?? []).filter((s) => s.layout_type === "addendum"));
1185
+ return v != null ? u.find((a) => a.id === v) ?? null : u[0] ?? null;
1188
1186
  },
1189
1187
  staleTime: 300 * 1e3
1190
- }), j = v ?? (M == null ? void 0 : M.id) ?? null, { data: ee = [] } = G({
1191
- queryKey: ["addendum-layout-assignments", j],
1192
- queryFn: () => j ? f.request(
1193
- Q(`/collection-layouts/${j}/assignments`)
1194
- ).then((p) => p.data ?? []) : Promise.resolve([]),
1195
- enabled: !!j,
1188
+ }), M = v ?? (A == null ? void 0 : A.id) ?? null, te = !!M && (c || P.length > 0), { data: E = [], isPending: me } = V({
1189
+ queryKey: ["addendum-layout-assignments", M],
1190
+ queryFn: () => M ? f.request(
1191
+ Q(`/collection-layouts/${M}/assignments`)
1192
+ ).then((u) => u.data ?? []) : Promise.resolve([]),
1193
+ enabled: te,
1196
1194
  staleTime: 300 * 1e3
1197
- }), { data: E = [] } = G({
1198
- queryKey: ["collection-fields", r, j],
1195
+ }), { data: X = [], isPending: W } = V({
1196
+ queryKey: ["collection-fields", r, M],
1199
1197
  queryFn: () => f.request(
1200
1198
  Q(
1201
1199
  `/field-config/${r}`,
1202
- j ? { layout_id: String(j) } : void 0
1200
+ M ? { layout_id: String(M) } : void 0
1203
1201
  )
1204
- ).then((p) => p.data ?? []),
1205
- enabled: j != null,
1202
+ ).then((u) => u.data ?? []),
1203
+ enabled: te,
1206
1204
  staleTime: 300 * 1e3
1207
- }), { data: re = [] } = G({
1205
+ }), Y = c && M != null && (me || W), { data: L = [] } = V({
1208
1206
  queryKey: ["relations", r],
1209
- queryFn: () => f.request(Q(`/data-model/relations/for/${r}`)).then((p) => p.data ?? []),
1207
+ queryFn: () => f.request(Q(`/data-model/relations/for/${r}`)).then((u) => u.data ?? []),
1210
1208
  staleTime: 300 * 1e3
1211
- }), { data: ae, isLoading: W } = G({
1212
- queryKey: ["item", r, c],
1213
- queryFn: () => f.request(Q(`/items/${r}/${c}`)).then((p) => p.data ?? {}),
1214
- enabled: m,
1209
+ }), { data: re, isLoading: se } = V({
1210
+ queryKey: ["item", r, m],
1211
+ queryFn: () => f.request(Q(`/items/${r}/${m}`)).then((u) => u.data ?? {}),
1212
+ enabled: c,
1215
1213
  staleTime: 0
1216
- }), X = () => {
1217
- $.invalidateQueries({ queryKey: ["addendums", r, c] }), te(), h == null || h();
1218
- }, H = (p) => {
1219
- $.invalidateQueries({ queryKey: ["addendums", r, c] }), te();
1220
- const q = ee.find((U) => String(U.field) === "__pdf__");
1221
- let ne = null;
1222
- if (q != null && q.overrides)
1214
+ }), ne = () => {
1215
+ F.invalidateQueries({ queryKey: ["addendums", r, m] }), ee(), h == null || h();
1216
+ }, ie = (u) => {
1217
+ F.invalidateQueries({ queryKey: ["addendums", r, m] }), ee();
1218
+ const a = E.find((d) => String(d.field) === "__pdf__");
1219
+ let s = null;
1220
+ if (a != null && a.overrides)
1223
1221
  try {
1224
- ne = typeof q.overrides == "string" ? JSON.parse(q.overrides) : q.overrides;
1222
+ s = typeof a.overrides == "string" ? JSON.parse(a.overrides) : a.overrides;
1225
1223
  } catch {
1226
- ne = null;
1224
+ s = null;
1227
1225
  }
1228
- u == null || u({ id: p, pdfSlot: ne });
1229
- }, ie = ee.filter(
1230
- (p) => !String(p.field).startsWith("__") && (p.is_visible || p.is_visible === 1)
1231
- ), L = P.filter(
1232
- (p) => !["approved", "rejected", "reverted"].includes(p.status)
1233
- ).length, V = Me(N);
1234
- return V.current = N, Be(() => {
1235
- var p;
1236
- (p = V.current) == null || p.call(V, L);
1237
- }, [L]), !k && (J || P.length === 0) ? null : /* @__PURE__ */ i(Ne, { children: [
1226
+ p == null || p({ id: u, pdfSlot: s });
1227
+ }, Z = E.filter(
1228
+ (u) => !String(u.field).startsWith("__") && (u.is_visible || u.is_visible === 1)
1229
+ ), U = P.filter(
1230
+ (u) => !["approved", "rejected", "reverted"].includes(u.status)
1231
+ ).length, O = Me(N);
1232
+ return O.current = N, Be(() => {
1233
+ var u;
1234
+ (u = O.current) == null || u.call(O, U);
1235
+ }, [U]), !k && (J || P.length === 0) ? null : /* @__PURE__ */ i(Ne, { children: [
1238
1236
  /* @__PURE__ */ i(
1239
1237
  "div",
1240
1238
  {
1241
1239
  className: D(
1242
1240
  "overflow-hidden rounded-xl border bg-white dark:bg-card",
1243
- L > 0 ? "border-amber-300 dark:border-amber-500/40" : "border-slate-200 dark:border-border"
1241
+ U > 0 ? "border-amber-300 dark:border-amber-500/40" : "border-slate-200 dark:border-border"
1244
1242
  ),
1245
1243
  children: [
1246
1244
  /* @__PURE__ */ i(
@@ -1248,24 +1246,24 @@ function nr({
1248
1246
  {
1249
1247
  className: D(
1250
1248
  "flex items-center justify-between px-4 py-3 cursor-pointer select-none",
1251
- !C && (L > 0 ? "border-b border-amber-200 dark:border-amber-500/30" : "border-b border-slate-200 dark:border-border")
1249
+ !C && (U > 0 ? "border-b border-amber-200 dark:border-amber-500/30" : "border-b border-slate-200 dark:border-border")
1252
1250
  ),
1253
- onClick: () => w((p) => !p),
1251
+ onClick: () => w((u) => !u),
1254
1252
  children: [
1255
1253
  /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
1256
1254
  /* @__PURE__ */ t(Ze, { className: "h-3.5 w-3.5 shrink-0 text-slate-400 dark:text-slate-500" }),
1257
1255
  /* @__PURE__ */ t("h3", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children: "Addendums" }),
1258
- L > 0 && /* @__PURE__ */ i("span", { className: "inline-flex items-center gap-1 rounded-full bg-amber-50 px-2 py-0.5 text-[11px] font-medium text-amber-700 border border-amber-200 dark:bg-amber-500/10 dark:text-amber-400 dark:border-amber-500/20", children: [
1256
+ U > 0 && /* @__PURE__ */ i("span", { className: "inline-flex items-center gap-1 rounded-full bg-amber-50 px-2 py-0.5 text-[11px] font-medium text-amber-700 border border-amber-200 dark:bg-amber-500/10 dark:text-amber-400 dark:border-amber-500/20", children: [
1259
1257
  /* @__PURE__ */ t("span", { className: "h-1.5 w-1.5 rounded-full bg-amber-400 animate-pulse" }),
1260
- L,
1258
+ U,
1261
1259
  " in review"
1262
1260
  ] }),
1263
1261
  P.length >= 2 && !C && /* @__PURE__ */ t(
1264
1262
  "button",
1265
1263
  {
1266
1264
  type: "button",
1267
- onClick: (p) => {
1268
- p.stopPropagation(), O((q) => !q);
1265
+ onClick: (u) => {
1266
+ u.stopPropagation(), R((a) => !a);
1269
1267
  },
1270
1268
  className: D(
1271
1269
  "ml-1 rounded-md border px-2 py-0.5 text-[11px] font-medium transition-colors",
@@ -1278,14 +1276,14 @@ function nr({
1278
1276
  )
1279
1277
  ] }),
1280
1278
  /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
1281
- k && (!(M != null && M.single_active_addendum) || L === 0) && /* @__PURE__ */ t(
1279
+ k && (!(A != null && A.single_active_addendum) || U === 0) && /* @__PURE__ */ t(
1282
1280
  I,
1283
1281
  {
1284
1282
  size: "sm",
1285
1283
  variant: "outline",
1286
1284
  className: "h-7 text-[12px]",
1287
- onClick: (p) => {
1288
- p.stopPropagation(), g(!0);
1285
+ onClick: (u) => {
1286
+ u.stopPropagation(), g(!0);
1289
1287
  },
1290
1288
  children: "+ New Addendum"
1291
1289
  }
@@ -1303,13 +1301,13 @@ function nr({
1303
1301
  ]
1304
1302
  }
1305
1303
  ),
1306
- !C && !M && !Z && /* @__PURE__ */ i("div", { className: "px-4 py-4 text-center", children: [
1304
+ !C && !A && !G && /* @__PURE__ */ i("div", { className: "px-4 py-4 text-center", children: [
1307
1305
  /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-400", children: "No addendum form configured." }),
1308
1306
  /* @__PURE__ */ t("p", { className: "text-[11px] text-slate-300 dark:text-slate-600", children: 'Create an "Addendum Form" layout in Data Model → Layouts to enable addendum creation.' })
1309
1307
  ] }),
1310
- !C && (M || Z) && (J ? /* @__PURE__ */ i("div", { className: "p-4 space-y-2", children: [
1311
- /* @__PURE__ */ t(se, { className: "h-12 w-full" }),
1312
- /* @__PURE__ */ t(se, { className: "h-12 w-full" })
1308
+ !C && (A || G) && (J ? /* @__PURE__ */ i("div", { className: "p-4 space-y-2", children: [
1309
+ /* @__PURE__ */ t(le, { className: "h-12 w-full" }),
1310
+ /* @__PURE__ */ t(le, { className: "h-12 w-full" })
1313
1311
  ] }) : P.length === 0 ? /* @__PURE__ */ i("div", { className: "px-4 py-8 text-center", children: [
1314
1312
  /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-400 dark:text-slate-500", children: "No addendum attached to this record" }),
1315
1313
  /* @__PURE__ */ t("p", { className: "mt-0.5 text-[11px] text-slate-300 dark:text-slate-600", children: "Addendums propose changes that go through a review process before being applied." })
@@ -1319,50 +1317,50 @@ function nr({
1319
1317
  client: f,
1320
1318
  addendums: P,
1321
1319
  parentCollection: r,
1322
- parentId: c,
1323
- relations: re,
1324
- fieldMap: Object.fromEntries(E.map((p) => [p.field, p]))
1320
+ parentId: m,
1321
+ relations: L,
1322
+ fieldMap: Object.fromEntries(X.map((u) => [u.field, u]))
1325
1323
  }
1326
- ) }) : /* @__PURE__ */ t("div", { className: "p-3 space-y-2", children: P.map((p) => /* @__PURE__ */ t(
1327
- Pt,
1324
+ ) }) : /* @__PURE__ */ t("div", { className: "p-3 space-y-2", children: P.map((u) => /* @__PURE__ */ t(
1325
+ jt,
1328
1326
  {
1329
- addendum: p,
1330
- configuredFields: ie,
1331
- onRefresh: X,
1332
- isActive: !["approved", "rejected", "reverted"].includes(p.status),
1333
- relations: re,
1327
+ addendum: u,
1328
+ configuredFields: Z,
1329
+ onRefresh: ne,
1330
+ isActive: !["approved", "rejected", "reverted"].includes(u.status),
1331
+ relations: L,
1334
1332
  parentCollection: r,
1335
- parentId: c,
1336
- fieldMap: Object.fromEntries(E.map((q) => [q.field, q]))
1333
+ parentId: m,
1334
+ fieldMap: Object.fromEntries(X.map((a) => [a.field, a]))
1337
1335
  },
1338
- p.id
1336
+ u.id
1339
1337
  )) }))
1340
1338
  ]
1341
1339
  }
1342
1340
  ),
1343
- /* @__PURE__ */ t(xt, { open: m, onOpenChange: g, children: /* @__PURE__ */ t(bt, { side: "right", className: "w-[80vw] sm:max-w-[80vw] p-0 flex flex-col", children: m && W ? /* @__PURE__ */ i("div", { className: "flex flex-col gap-3 p-6", children: [
1344
- /* @__PURE__ */ t(se, { className: "h-6 w-48" }),
1345
- /* @__PURE__ */ t(se, { className: "h-9 w-full" }),
1346
- /* @__PURE__ */ t(se, { className: "h-9 w-full" }),
1347
- /* @__PURE__ */ t(se, { className: "h-9 w-full" }),
1348
- /* @__PURE__ */ t(se, { className: "h-9 w-3/4" })
1349
- ] }) : m && ae ? /* @__PURE__ */ t(
1341
+ /* @__PURE__ */ t(xt, { open: c, onOpenChange: g, children: /* @__PURE__ */ t(bt, { side: "right", className: "w-[80vw] sm:max-w-[80vw] p-0 flex flex-col", children: c && (se || Y) ? /* @__PURE__ */ i("div", { className: "flex flex-col gap-3 p-6", children: [
1342
+ /* @__PURE__ */ t(le, { className: "h-6 w-48" }),
1343
+ /* @__PURE__ */ t(le, { className: "h-9 w-full" }),
1344
+ /* @__PURE__ */ t(le, { className: "h-9 w-full" }),
1345
+ /* @__PURE__ */ t(le, { className: "h-9 w-full" }),
1346
+ /* @__PURE__ */ t(le, { className: "h-9 w-3/4" })
1347
+ ] }) : c && re ? /* @__PURE__ */ t(
1350
1348
  At,
1351
1349
  {
1352
1350
  collection: r,
1353
- itemId: c,
1354
- assignments: ee,
1355
- workflowTemplateId: (M == null ? void 0 : M.workflow_template_id) ?? null,
1356
- resolvedLayoutId: j,
1357
- fields: E,
1358
- relations: re,
1359
- parentData: ae,
1351
+ itemId: m,
1352
+ assignments: E,
1353
+ workflowTemplateId: (A == null ? void 0 : A.workflow_template_id) ?? null,
1354
+ resolvedLayoutId: M,
1355
+ fields: X,
1356
+ relations: L,
1357
+ parentData: re,
1360
1358
  onClose: () => g(!1),
1361
- onCreated: H
1359
+ onCreated: ie
1362
1360
  }
1363
1361
  ) : null }) })
1364
1362
  ] });
1365
1363
  }
1366
1364
  export {
1367
- nr as AddendumPanel
1365
+ ar as AddendumPanel
1368
1366
  };