@nivaro/react 0.3.52 → 0.3.54

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 (41) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +47 -3
  4. package/dist/shared/components/ItemEditForm.js +4196 -4163
  5. package/dist/shared/components/NotificationBell.js +163 -150
  6. package/dist/shared/components/PageRenderer.js +645 -593
  7. package/dist/shared/components/ProfileView.js +36 -34
  8. package/dist/shared/components/QueryStatStrip.js +96 -89
  9. package/dist/shared/components/QueryTable.js +214 -215
  10. package/dist/shared/components/ReportView.js +548 -529
  11. package/dist/shared/components/alerts/AlertManagerView.js +346 -320
  12. package/dist/shared/components/item-edit/CatalogPickerField.js +1300 -1219
  13. package/dist/shared/components/item-edit/DraftRecoveryBanner.js +52 -54
  14. package/dist/shared/components/item-edit/FieldAffordances.js +145 -136
  15. package/dist/shared/components/item-edit/FieldRenderer.js +366 -326
  16. package/dist/shared/components/item-edit/InlineTableField.js +3047 -2932
  17. package/dist/shared/components/item-edit/NestedRelationEditor.js +149 -143
  18. package/dist/shared/components/item-edit/PersonalDefaultControl.js +12 -11
  19. package/dist/shared/components/item-edit/PlanGrid.js +718 -705
  20. package/dist/shared/components/item-edit/RelationCombobox.js +23 -20
  21. package/dist/shared/components/item-edit/SummaryPanel.js +415 -361
  22. package/dist/shared/components/item-edit/line-qty.js +115 -53
  23. package/dist/shared/components/item-edit/save-outcome.js +48 -0
  24. package/dist/shared/components/item-edit/save-refusal.js +18 -18
  25. package/dist/shared/components/item-edit/stale-banner.js +13 -0
  26. package/dist/shared/components/item-edit/usePersonalDefaults.js +225 -220
  27. package/dist/shared/components/panels/CommentPanel.js +204 -197
  28. package/dist/shared/components/panels/ItemLockBanner.js +318 -291
  29. package/dist/shared/components/panels/PipelinePanel.js +1388 -1218
  30. package/dist/shared/components/panels/RecordIntegrityBanner.js +201 -172
  31. package/dist/shared/components/panels/RevisionsPanel.js +101 -106
  32. package/dist/shared/components/panels/TransitionRequirementsDialog.js +564 -534
  33. package/dist/shared/components/panels/requirement-side-effects.js +46 -29
  34. package/dist/shared/components/queue/QueueItemSheet.js +219 -146
  35. package/dist/shared/components/queue/QueueWorklist.js +738 -730
  36. package/dist/shared/components/widgets/ReviewListWidget.js +236 -201
  37. package/dist/shared/lib/activity-sentence.js +236 -227
  38. package/dist/shared/lib/draft-store.js +35 -29
  39. package/dist/shared/lib/page-widget-access.js +11 -0
  40. package/dist/shared/lib/record-ref.js +43 -34
  41. package/package.json +1 -1
@@ -1,524 +1,574 @@
1
- import { jsx as l, jsxs as p } from "react/jsx-runtime";
2
- import { useQuery as E } from "@tanstack/react-query";
1
+ import { jsx as r, jsxs as b } from "react/jsx-runtime";
2
+ import { useQuery as $ } from "@tanstack/react-query";
3
3
  import { Check as ue, Copy as fe, ChevronRight as ye, Loader2 as pe } from "lucide-react";
4
- import { useState as Q, useRef as he, createContext as xe, useContext as be } from "react";
4
+ import { useState as z, useRef as he, createContext as be, useContext as xe } from "react";
5
5
  import { useNivaroClient as U } from "../../context.js";
6
- import { get as K } from "../../lib/commands.js";
6
+ import { get as O } from "../../lib/commands.js";
7
7
  import { useRecordReader as ge } from "../../lib/record-loader.js";
8
- import { cn as M, titleCase as z, toLocalDateString as _e, choiceLabel as ke } from "../../lib/utils.js";
9
- import { useChangePulse as Ne } from "./GroupSection.js";
10
- import { SYSTEM_FIELDS as Se, SENTINEL_FIELDS as we, applyDisplayTemplate as ne, parseJson as le, richTextToPlain as Z } from "./helpers.js";
11
- import { RelatedItemLabel as ae } from "./RelationCombobox.js";
12
- const re = xe({});
13
- function qe(e, t) {
14
- return t ? Object.entries(t).every(
15
- ([n, a]) => a !== null && typeof a == "object" || String(e[n] ?? "") === String(a ?? "")
8
+ import { cn as R, titleCase as Z, toLocalDateString as _e, choiceLabel as ke } from "../../lib/utils.js";
9
+ import { useChangePulse as Se } from "./GroupSection.js";
10
+ import { SYSTEM_FIELDS as Ne, SENTINEL_FIELDS as we, applyDisplayTemplate as le, parseJson as ae, richTextToPlain as ee } from "./helpers.js";
11
+ import { RelatedItemLabel as ie } from "./RelationCombobox.js";
12
+ const re = be({});
13
+ function qe(e, n) {
14
+ return n ? Object.entries(n).every(
15
+ ([l, a]) => a !== null && typeof a == "object" || String(e[l] ?? "") === String(a ?? "")
16
16
  ) : !0;
17
17
  }
18
18
  function Te({
19
19
  relation: e,
20
- parentId: t,
21
- allRelations: n,
20
+ parentId: n,
21
+ allRelations: l,
22
22
  staging: a,
23
- maxValues: h
23
+ maxValues: f
24
24
  }) {
25
- var b, w, J;
26
- const y = U(), c = e.many_field ?? "", u = e.junction_field ?? (() => {
27
- const r = n.find(
28
- ($) => $.many_collection === e.many_collection && $.id !== e.id
25
+ var L, S, M;
26
+ const s = U(), m = e.many_field ?? "", y = e.junction_field ?? (() => {
27
+ const i = l.find(
28
+ (N) => N.many_collection === e.many_collection && N.id !== e.id
29
29
  );
30
- return (r == null ? void 0 : r.many_field) ?? "";
31
- })(), x = e.one_field ?? `${e.many_collection}.${u}`, _ = ((b = n.find(
32
- (r) => r.many_collection === e.many_collection && r.many_field === u && r.id !== e.id
33
- )) == null ? void 0 : b.one_collection) ?? null, { data: k } = E({
30
+ return (i == null ? void 0 : i.many_field) ?? "";
31
+ })(), h = e.one_field ?? `${e.many_collection}.${y}`, k = ((L = l.find(
32
+ (i) => i.many_collection === e.many_collection && i.many_field === y && i.id !== e.id
33
+ )) == null ? void 0 : L.one_collection) ?? null, { data: g } = $({
34
34
  queryKey: ["summary-junction-relations", e.many_collection],
35
- queryFn: () => y.request(
36
- K(`/data-model/relations/for/${e.many_collection}`)
37
- ).then((r) => r.data ?? []).catch(() => []),
38
- enabled: !_ && !!e.many_collection && !!u,
35
+ queryFn: () => s.request(
36
+ O(`/data-model/relations/for/${e.many_collection}`)
37
+ ).then((i) => i.data ?? []).catch(() => []),
38
+ enabled: !k && !!e.many_collection && !!y,
39
39
  staleTime: 10 * 6e4
40
- }), s = _ ?? ((w = k == null ? void 0 : k.find(
41
- (r) => r.many_collection === e.many_collection && r.many_field === u && !!r.one_collection
42
- )) == null ? void 0 : w.one_collection) ?? null, { data: o = [] } = E({
43
- queryKey: ["m2m-items", e.many_collection, c, t],
44
- queryFn: () => y.request(
45
- K(`/items/${e.many_collection}`, {
46
- filter: JSON.stringify({ [c]: { _eq: t } }),
40
+ }), o = k ?? ((S = g == null ? void 0 : g.find(
41
+ (i) => i.many_collection === e.many_collection && i.many_field === y && !!i.one_collection
42
+ )) == null ? void 0 : S.one_collection) ?? null, { data: c = [] } = $({
43
+ queryKey: ["m2m-items", e.many_collection, m, n],
44
+ queryFn: () => s.request(
45
+ O(`/items/${e.many_collection}`, {
46
+ filter: JSON.stringify({ [m]: { _eq: n } }),
47
47
  limit: 200,
48
- fields: `id,${u}`
48
+ fields: `id,${y}`
49
49
  })
50
- ).then((r) => r.data ?? []),
50
+ ).then((i) => i.data ?? []),
51
51
  staleTime: 3e4,
52
- enabled: !!t && t !== "new"
53
- }), d = s ? null : ((J = [...n, ...k ?? []].find(
54
- (r) => r.many_collection === e.many_collection && r.many_field === u && !!r.one_collection_field
55
- )) == null ? void 0 : J.one_collection_field) ?? null, { data: g = [] } = E({
56
- queryKey: ["summary-m2a-items", e.many_collection, c, t, d],
57
- queryFn: () => y.request(
58
- K(`/items/${e.many_collection}`, {
59
- filter: JSON.stringify({ [c]: { _eq: t } }),
52
+ enabled: !!n && n !== "new"
53
+ }), d = o ? null : ((M = [...l, ...g ?? []].find(
54
+ (i) => i.many_collection === e.many_collection && i.many_field === y && !!i.one_collection_field
55
+ )) == null ? void 0 : M.one_collection_field) ?? null, { data: j = [] } = $({
56
+ queryKey: ["summary-m2a-items", e.many_collection, m, n, d],
57
+ queryFn: () => s.request(
58
+ O(`/items/${e.many_collection}`, {
59
+ filter: JSON.stringify({ [m]: { _eq: n } }),
60
60
  limit: 200,
61
- fields: `id,${u},${d}`
61
+ fields: `id,${y},${d}`
62
62
  })
63
- ).then((r) => r.data ?? []),
63
+ ).then((i) => i.data ?? []),
64
64
  staleTime: 3e4,
65
- enabled: !!d && !!t && t !== "new"
66
- }), D = s === "nivaro_files" || s === "directus_files", { data: N } = E({
67
- queryKey: ["col-meta", s],
68
- queryFn: () => y.request(K(`/collections/${s}`)).then((r) => r.data),
69
- enabled: !!s && !D,
65
+ enabled: !!d && !!n && n !== "new"
66
+ }), P = o === "nivaro_files" || o === "directus_files", { data: D } = $({
67
+ queryKey: ["col-meta", o],
68
+ queryFn: () => s.request(O(`/collections/${o}`)).then((i) => i.data),
69
+ enabled: !!o && !P,
70
70
  staleTime: 3e5
71
- }), C = (a == null ? void 0 : a.getStagedLinks(x)) ?? [], L = (a == null ? void 0 : a.getStagedUnlinks(x)) ?? /* @__PURE__ */ new Set(), R = o.filter((r) => !L.has(r.id)), S = [
72
- ...C,
73
- ...R.map((r) => r[u]).filter((r) => r != null)
71
+ }), K = (a == null ? void 0 : a.getStagedLinks(h)) ?? [], v = (a == null ? void 0 : a.getStagedUnlinks(h)) ?? /* @__PURE__ */ new Set(), C = c.filter((i) => !v.has(i.id)), q = [
72
+ ...K,
73
+ ...C.map((i) => i[y]).filter((i) => i != null)
74
74
  ];
75
- if (S.length === 0)
76
- return /* @__PURE__ */ l("span", { className: "text-slate-400 dark:text-slate-500", children: "—" });
77
- if (s) {
78
- const $ = S.slice(0, 5), j = S.length - 5;
79
- return /* @__PURE__ */ p("span", { className: "text-[12px] text-slate-700 dark:text-slate-200", children: [
80
- $.map((i, v) => /* @__PURE__ */ p("span", { children: [
81
- v > 0 && ", ",
82
- /* @__PURE__ */ l(
83
- ae,
75
+ if (q.length === 0)
76
+ return /* @__PURE__ */ r("span", { className: "text-slate-400 dark:text-slate-500", children: "—" });
77
+ if (o) {
78
+ const N = q.slice(0, 5), w = q.length - 5;
79
+ return /* @__PURE__ */ b("span", { className: "text-[12px] text-slate-700 dark:text-slate-200", children: [
80
+ N.map((t, u) => /* @__PURE__ */ b("span", { children: [
81
+ u > 0 && ", ",
82
+ /* @__PURE__ */ r(
83
+ ie,
84
84
  {
85
- collection: s,
86
- id: i,
87
- displayTemplate: N == null ? void 0 : N.display_template
85
+ collection: o,
86
+ id: t,
87
+ displayTemplate: D == null ? void 0 : D.display_template
88
88
  }
89
89
  )
90
- ] }, String(i))),
91
- j > 0 && /* @__PURE__ */ p("span", { className: "text-slate-400 dark:text-slate-500", children: [
90
+ ] }, String(t))),
91
+ w > 0 && /* @__PURE__ */ b("span", { className: "text-slate-400 dark:text-slate-500", children: [
92
92
  " +",
93
- j,
93
+ w,
94
94
  " more"
95
95
  ] })
96
96
  ] });
97
97
  }
98
- const m = d ? g.filter((r) => !L.has(r.id) && r[u] != null && r[d]).slice(0, 5) : [];
99
- if (m.length > 0 && C.length === 0) {
100
- const r = S.length - m.length;
101
- return /* @__PURE__ */ p("span", { className: "text-[12px] text-slate-700 dark:text-slate-200", children: [
102
- m.map(($, j) => /* @__PURE__ */ p("span", { children: [
103
- j > 0 && ", ",
104
- /* @__PURE__ */ l(
105
- ie,
98
+ const _ = d ? j.filter((i) => !v.has(i.id) && i[y] != null && i[d]).slice(0, 5) : [];
99
+ if (_.length > 0 && K.length === 0) {
100
+ const i = q.length - _.length;
101
+ return /* @__PURE__ */ b("span", { className: "text-[12px] text-slate-700 dark:text-slate-200", children: [
102
+ _.map((N, w) => /* @__PURE__ */ b("span", { children: [
103
+ w > 0 && ", ",
104
+ /* @__PURE__ */ r(
105
+ X,
106
106
  {
107
- collection: $e(String($[d])),
108
- id: $[u]
107
+ collection: $e(String(N[d])),
108
+ id: N[y]
109
109
  }
110
110
  )
111
- ] }, String($.id))),
112
- r > 0 && /* @__PURE__ */ p("span", { className: "text-slate-400 dark:text-slate-500", children: [
111
+ ] }, String(N.id))),
112
+ i > 0 && /* @__PURE__ */ b("span", { className: "text-slate-400 dark:text-slate-500", children: [
113
113
  " +",
114
- r,
114
+ i,
115
115
  " more"
116
116
  ] })
117
117
  ] });
118
118
  }
119
- return /* @__PURE__ */ p("span", { className: "text-slate-700 dark:text-slate-200", children: [
120
- S.length,
119
+ return /* @__PURE__ */ b("span", { className: "text-slate-700 dark:text-slate-200", children: [
120
+ q.length,
121
121
  " item",
122
- S.length !== 1 ? "s" : ""
122
+ q.length !== 1 ? "s" : ""
123
123
  ] });
124
124
  }
125
125
  function $e(e) {
126
126
  return e === "directus_users" ? "nivaro_users" : e;
127
127
  }
128
128
  function se(e) {
129
- const t = U();
130
- return E({
129
+ const n = U();
130
+ return $({
131
131
  queryKey: ["summary-display-template", e],
132
- queryFn: () => t.request(K(`/collections/${e}`)).then((n) => {
132
+ queryFn: () => n.request(O(`/collections/${e}`)).then((l) => {
133
133
  var a;
134
- return ((a = n.data) == null ? void 0 : a.display_template) ?? null;
134
+ return ((a = l.data) == null ? void 0 : a.display_template) ?? null;
135
135
  }).catch(() => null),
136
136
  enabled: !!e,
137
137
  staleTime: 10 * 6e4
138
138
  }).data;
139
139
  }
140
- function ie({ collection: e, id: t }) {
141
- const n = se(e);
142
- return /* @__PURE__ */ l(ae, { collection: e, id: t, displayTemplate: n ?? void 0 });
140
+ function X({ collection: e, id: n }) {
141
+ const l = se(e);
142
+ return /* @__PURE__ */ r(ie, { collection: e, id: n, displayTemplate: l ?? void 0 });
143
143
  }
144
- const ve = ["name", "title", "label", "subject", "description", "line_number"], Ce = ["amount", "total", "cost", "price", "quantity"], V = 4, X = 200;
145
- function je(e, t) {
146
- if (t) {
147
- const n = ne(t, e).replace(/\s*[·|\-–—/]\s*(?=[·|\-–—/]|$)/g, "").replace(/^\s*[·|\-–—/]\s*/, "").trim();
148
- if (n !== "") return n;
144
+ const je = ["name", "title", "label", "subject", "description", "line_number"], Le = ["amount", "total", "cost", "price", "quantity"], V = 4, I = 200;
145
+ function Oe(e, n) {
146
+ if (n) {
147
+ const l = le(n, e).replace(/\s*[·|\-–—/]\s*(?=[·|\-–—/]|$)/g, "").replace(/^\s*[·|\-–—/]\s*/, "").trim();
148
+ if (l !== "") return l;
149
149
  }
150
- for (const n of ve) {
151
- const a = e[n];
150
+ for (const l of je) {
151
+ const a = e[l];
152
152
  if (a != null && String(a).trim() !== "") return String(a).trim();
153
153
  }
154
- return `#${String(e.id ?? "")}`;
154
+ return null;
155
+ }
156
+ function ve(e) {
157
+ if (!e) return [];
158
+ const n = /* @__PURE__ */ new Set();
159
+ for (const l of e.matchAll(/\{\{\s*([\w.]+)\s*\}\}/g))
160
+ l[1].includes(".") && !l[1].startsWith(".") && n.add(l[1]);
161
+ return [...n];
162
+ }
163
+ function Ce(e, n, l) {
164
+ if (!n || l.length === 0) return e;
165
+ const a = { ...e };
166
+ for (const f of new Set(l.map((s) => s.split(".")[0]))) {
167
+ const s = n[f];
168
+ s !== null && typeof s == "object" && (a[f] = s);
169
+ }
170
+ return a;
171
+ }
172
+ const Me = ["cifa", "item", "catalog_item", "product", "part", "material"], Ee = /* @__PURE__ */ new Set(["nivaro_users", "directus_users"]);
173
+ function Re(e, n, l) {
174
+ const a = e.filter(
175
+ (s) => s.many_collection === n && !!s.many_field && s.many_field !== l && !s.junction_field && !!s.one_collection && !Ee.has(s.one_collection)
176
+ ), f = Me.map((s) => a.find((m) => m.many_field === s)).find(Boolean) ?? a[0];
177
+ return f != null && f.many_field && f.one_collection ? { field: f.many_field, collection: f.one_collection } : null;
155
178
  }
156
179
  function oe({
157
180
  relatedCollection: e,
158
- manyField: t,
159
- parentId: n,
181
+ manyField: n,
182
+ parentId: l,
160
183
  rowFilter: a,
161
- expanded: h
184
+ expanded: f
162
185
  }) {
163
- var R, S;
164
- const y = U(), c = be(re), u = a && Object.keys(a).length > 0 ? {
186
+ var N, w;
187
+ const s = U(), m = xe(re), y = a && Object.keys(a).length > 0 ? {
165
188
  _and: [
166
- { [t]: { _eq: n } },
189
+ { [n]: { _eq: l } },
167
190
  Object.fromEntries(
168
- Object.entries(a).map(([m, b]) => [
169
- m,
170
- b !== null && typeof b == "object" ? b : { _eq: b }
191
+ Object.entries(a).map(([t, u]) => [
192
+ t,
193
+ u !== null && typeof u == "object" ? u : { _eq: u }
171
194
  ])
172
195
  )
173
196
  ]
174
- } : { [t]: { _eq: n } }, { data: x, isLoading: _ } = E({
197
+ } : { [n]: { _eq: l } }, { data: h, isLoading: k } = $({
175
198
  queryKey: [
176
199
  "o2m-rows",
177
200
  e,
178
- t,
179
201
  n,
202
+ l,
180
203
  a ? JSON.stringify(a) : ""
181
204
  ],
182
- queryFn: () => y.request(
183
- K(`/items/${e}`, {
184
- filter: JSON.stringify(u),
185
- limit: X
205
+ queryFn: () => s.request(
206
+ O(`/items/${e}`, {
207
+ filter: JSON.stringify(y),
208
+ limit: I
186
209
  })
187
- ).then((m) => m.data ?? []),
188
- enabled: !!n && n !== "new",
210
+ ).then((t) => t.data ?? []),
211
+ enabled: !!l && l !== "new",
189
212
  staleTime: 3e4
190
- }), k = se(e), s = `${e}.${t}`, o = (R = c.deletes) == null ? void 0 : R.get(s), d = (((S = c.rows) == null ? void 0 : S.get(s)) ?? []).filter(
191
- (m) => qe(m, a)
192
- ), g = [
193
- ...(x ?? []).filter((m) => !(o != null && o.has(String(m.id)))),
194
- ...d
213
+ }), g = se(e), { data: o = [] } = $({
214
+ queryKey: ["collection-relations", e],
215
+ queryFn: () => s.request(O(`/collections/${e}`)).then((t) => {
216
+ var u;
217
+ return ((u = t.data) == null ? void 0 : u.relations) ?? [];
218
+ }),
219
+ staleTime: 10 * 6e4
220
+ }), c = Re(o, e, n), d = ve(g), j = [...new Set(d.map((t) => t.split(".")[0]))], P = d.length ? JSON.stringify((h ?? []).map((t) => [t.id, ...j.map((u) => t[u] ?? null)])) : "", { data: D } = $({
221
+ queryKey: [
222
+ "o2m-summary-labels",
223
+ e,
224
+ n,
225
+ l,
226
+ a ? JSON.stringify(a) : "",
227
+ d.join(","),
228
+ P
229
+ ],
230
+ queryFn: () => s.request(
231
+ O(`/items/${e}`, {
232
+ filter: JSON.stringify(y),
233
+ fields: ["id", ...d].join(","),
234
+ limit: I
235
+ })
236
+ ).then((t) => t.data ?? []).catch(() => []),
237
+ enabled: d.length > 0 && !!l && l !== "new" && ((h == null ? void 0 : h.length) ?? 0) > 0,
238
+ staleTime: 6e4
239
+ }), K = new Map((D ?? []).map((t) => [String(t.id), t])), v = `${e}.${n}`, C = (N = m.deletes) == null ? void 0 : N.get(v), q = (((w = m.rows) == null ? void 0 : w.get(v)) ?? []).filter(
240
+ (t) => qe(t, a)
241
+ ), _ = [
242
+ ...(h ?? []).filter((t) => !(C != null && C.has(String(t.id)))),
243
+ ...q
195
244
  ];
196
- if (_ && d.length === 0)
197
- return /* @__PURE__ */ l(pe, { className: "h-3 w-3 animate-spin text-slate-400 dark:text-slate-500" });
198
- if (g.length === 0)
199
- return /* @__PURE__ */ l("span", { className: "italic text-[11px] text-slate-400 dark:text-slate-500", children: "None yet" });
200
- const D = ((x == null ? void 0 : x.length) ?? 0) >= X, N = Ce.find(
201
- (m) => g.some(
202
- (b) => typeof b[m] == "number" || typeof b[m] == "string" && b[m] !== "" && !Number.isNaN(Number(b[m]))
245
+ if (k && q.length === 0)
246
+ return /* @__PURE__ */ r(pe, { className: "h-3 w-3 animate-spin text-slate-400 dark:text-slate-500" });
247
+ if (_.length === 0)
248
+ return /* @__PURE__ */ r("span", { className: "italic text-[11px] text-slate-400 dark:text-slate-500", children: "None yet" });
249
+ const L = ((h == null ? void 0 : h.length) ?? 0) >= I, S = Le.find(
250
+ (t) => _.some(
251
+ (u) => typeof u[t] == "number" || typeof u[t] == "string" && u[t] !== "" && !Number.isNaN(Number(u[t]))
203
252
  )
204
- ), C = N && !D ? g.reduce((m, b) => {
205
- const w = Number(b[N]);
206
- return m + (Number.isFinite(w) ? w : 0);
207
- }, 0) : null, L = N ? N !== "quantity" : !1;
208
- return /* @__PURE__ */ p("span", { className: "block", children: [
209
- /* @__PURE__ */ p("span", { className: "flex items-baseline gap-2", children: [
210
- /* @__PURE__ */ p("span", { className: "text-slate-700 dark:text-slate-200", children: [
211
- D ? `${X}+` : g.length,
253
+ ), M = S && !L ? _.reduce((t, u) => {
254
+ const x = Number(u[S]);
255
+ return t + (Number.isFinite(x) ? x : 0);
256
+ }, 0) : null, i = S ? S !== "quantity" : !1;
257
+ return /* @__PURE__ */ b("span", { className: "block", children: [
258
+ /* @__PURE__ */ b("span", { className: "flex items-baseline gap-2", children: [
259
+ /* @__PURE__ */ b("span", { className: "text-slate-700 dark:text-slate-200", children: [
260
+ L ? `${I}+` : _.length,
212
261
  " row",
213
- g.length !== 1 ? "s" : ""
262
+ _.length !== 1 ? "s" : ""
214
263
  ] }),
215
- C !== null && /* @__PURE__ */ l("span", { className: "tabular-nums text-[11px] text-slate-500 dark:text-slate-400", children: L ? C.toLocaleString(void 0, {
264
+ M !== null && /* @__PURE__ */ r("span", { className: "tabular-nums text-[11px] text-slate-500 dark:text-slate-400", children: i ? M.toLocaleString(void 0, {
216
265
  style: "currency",
217
266
  currency: "USD",
218
- maximumFractionDigits: C % 1 === 0 ? 0 : 2
219
- }) : C.toLocaleString() })
267
+ maximumFractionDigits: M % 1 === 0 ? 0 : 2
268
+ }) : M.toLocaleString() })
220
269
  ] }),
221
- /* @__PURE__ */ p("span", { className: "mt-1 block space-y-0.5", children: [
222
- (h ? g : g.slice(0, V)).map((m, b) => /* @__PURE__ */ p(
270
+ /* @__PURE__ */ b("span", { className: "mt-1 block space-y-0.5", children: [
271
+ (f ? _ : _.slice(0, V)).map((t, u) => /* @__PURE__ */ b(
223
272
  "span",
224
273
  {
225
274
  className: "flex items-baseline justify-between gap-2 text-[11px] text-slate-500 dark:text-slate-400",
226
275
  children: [
227
- /* @__PURE__ */ l("span", { className: "truncate", children: je(m, k ?? null) }),
228
- N && m[N] !== null && m[N] !== void 0 && /* @__PURE__ */ l("span", { className: "shrink-0 tabular-nums", children: (() => {
229
- const w = Number(m[N]);
230
- return Number.isFinite(w) ? L ? w.toLocaleString(void 0, {
276
+ /* @__PURE__ */ r("span", { className: "truncate", children: Oe(
277
+ Ce(t, K.get(String(t.id)), d),
278
+ g ?? null
279
+ ) ?? (c && t[c.field] != null && t[c.field] !== "" ? /* @__PURE__ */ r(X, { collection: c.collection, id: t[c.field] }) : `Row ${u + 1}`) }),
280
+ S && t[S] !== null && t[S] !== void 0 && /* @__PURE__ */ r("span", { className: "shrink-0 tabular-nums", children: (() => {
281
+ const x = Number(t[S]);
282
+ return Number.isFinite(x) ? i ? x.toLocaleString(void 0, {
231
283
  style: "currency",
232
284
  currency: "USD",
233
- maximumFractionDigits: w % 1 === 0 ? 0 : 2
234
- }) : w.toLocaleString() : String(m[N]);
285
+ maximumFractionDigits: x % 1 === 0 ? 0 : 2
286
+ }) : x.toLocaleString() : String(t[S]);
235
287
  })() })
236
288
  ]
237
289
  },
238
- String(m.id ?? b)
290
+ String(t.id ?? u)
239
291
  )),
240
- !h && g.length > V && /* @__PURE__ */ p("span", { className: "block text-[11px] italic text-slate-400 dark:text-slate-500", children: [
292
+ !f && _.length > V && /* @__PURE__ */ b("span", { className: "block text-[11px] italic text-slate-400 dark:text-slate-500", children: [
241
293
  "+",
242
- D ? `${g.length - V}+` : g.length - V,
294
+ L ? `${_.length - V}+` : _.length - V,
243
295
  " more"
244
296
  ] })
245
297
  ] })
246
298
  ] });
247
299
  }
248
- function Le(e) {
249
- const t = Ne(e.val);
250
- return /* @__PURE__ */ l("span", { className: M("inline-block max-w-full rounded-sm", t && "nvr-value-pulse-bg"), children: /* @__PURE__ */ l(Oe, { ...e }) });
300
+ function De(e) {
301
+ const n = Se(e.val);
302
+ return /* @__PURE__ */ r("span", { className: R("inline-block max-w-full rounded-sm", n && "nvr-value-pulse-bg"), children: /* @__PURE__ */ r(Ae, { ...e }) });
251
303
  }
252
- function Oe({
304
+ function Ae({
253
305
  field: e,
254
- val: t,
255
- relations: n,
306
+ val: n,
307
+ relations: l,
256
308
  collection: a,
257
- itemId: h,
258
- staging: y
309
+ itemId: f,
310
+ staging: s
259
311
  }) {
260
- const c = e.interface ?? "", u = /* @__PURE__ */ new Set(["select-multiple-m2m", "files-m2m", "files", "relation-grouped"]);
261
- if (!u.has(c) && h) {
262
- const s = n.find(
263
- (o) => !o.junction_field && (o.one_field === e.field || o.many_collection === e.field) && (o.one_collection === a || o.one_collection == null)
312
+ const m = e.interface ?? "", y = /* @__PURE__ */ new Set(["select-multiple-m2m", "files-m2m", "files", "relation-grouped"]);
313
+ if (!y.has(m) && f) {
314
+ const o = l.find(
315
+ (c) => !c.junction_field && (c.one_field === e.field || c.many_collection === e.field) && (c.one_collection === a || c.one_collection == null)
264
316
  );
265
- if (s != null && s.many_collection && s.many_field) {
266
- const o = (() => {
317
+ if (o != null && o.many_collection && o.many_field) {
318
+ const c = (() => {
267
319
  try {
268
320
  return typeof e.options == "string" ? JSON.parse(e.options) : e.options ?? {};
269
321
  } catch {
270
322
  return {};
271
323
  }
272
324
  })();
273
- return /* @__PURE__ */ l(
325
+ return /* @__PURE__ */ r(
274
326
  oe,
275
327
  {
276
- relatedCollection: s.many_collection,
277
- manyField: s.many_field,
278
- parentId: h,
279
- rowFilter: o.row_filter && typeof o.row_filter == "object" ? o.row_filter : void 0
328
+ relatedCollection: o.many_collection,
329
+ manyField: o.many_field,
330
+ parentId: f,
331
+ rowFilter: c.row_filter && typeof c.row_filter == "object" ? c.row_filter : void 0
280
332
  }
281
333
  );
282
334
  }
283
335
  }
284
- if (u.has(c) && h) {
285
- const s = n.find(
336
+ if (y.has(m) && f) {
337
+ const o = l.find(
286
338
  (d) => d.one_collection === a && (d.one_field === e.field || d.junction_field != null && d.many_collection === e.field)
287
- ), o = s ? s.junction_field ? s : (() => {
288
- const d = n.find(
289
- (g) => g.many_collection === s.many_collection && g.id !== s.id
339
+ ), c = o ? o.junction_field ? o : (() => {
340
+ const d = l.find(
341
+ (j) => j.many_collection === o.many_collection && j.id !== o.id
290
342
  );
291
- return d ? { ...s, junction_field: d.many_field } : null;
343
+ return d ? { ...o, junction_field: d.many_field } : null;
292
344
  })() : null;
293
- if (o) {
294
- const d = le(e.options);
295
- return /* @__PURE__ */ l(
345
+ if (c) {
346
+ const d = ae(e.options);
347
+ return /* @__PURE__ */ r(
296
348
  Te,
297
349
  {
298
- relation: o,
299
- parentId: h,
300
- allRelations: n,
301
- staging: y,
350
+ relation: c,
351
+ parentId: f,
352
+ allRelations: l,
353
+ staging: s,
302
354
  maxValues: d == null ? void 0 : d.max_values
303
355
  }
304
356
  );
305
357
  }
306
358
  }
307
- const x = t == null || t === "";
308
- if (x && e.type === "boolean")
309
- return /* @__PURE__ */ l("span", { className: "text-slate-700 dark:text-slate-200", children: "No" });
310
- if (x) return /* @__PURE__ */ l("span", { className: "text-slate-400 dark:text-slate-500", children: "—" });
311
- if (c === "extension-editorjs" || c === "input-rich-text-html" || c === "rich_text" || c === "wysiwyg" || typeof t == "string") {
312
- const s = De(t, c);
313
- if (s !== null)
314
- return /* @__PURE__ */ l("span", { className: "truncate text-slate-700 dark:text-slate-200", title: s, children: s || "—" });
359
+ const h = n == null || n === "";
360
+ if (h && e.type === "boolean")
361
+ return /* @__PURE__ */ r("span", { className: "text-slate-700 dark:text-slate-200", children: "No" });
362
+ if (h) return /* @__PURE__ */ r("span", { className: "text-slate-400 dark:text-slate-500", children: "—" });
363
+ if (m === "extension-editorjs" || m === "input-rich-text-html" || m === "rich_text" || m === "wysiwyg" || typeof n == "string") {
364
+ const o = Fe(n, m);
365
+ if (o !== null)
366
+ return /* @__PURE__ */ r("span", { className: "truncate text-slate-700 dark:text-slate-200", title: o, children: o || "—" });
315
367
  }
316
- if (typeof t == "boolean")
317
- return /* @__PURE__ */ l("span", { className: "text-slate-700 dark:text-slate-200", children: t ? "Yes" : "No" });
318
- const _ = n.find(
319
- (s) => s.many_collection === a && s.many_field === e.field && !s.junction_field
368
+ if (typeof n == "boolean")
369
+ return /* @__PURE__ */ r("span", { className: "text-slate-700 dark:text-slate-200", children: n ? "Yes" : "No" });
370
+ const k = l.find(
371
+ (o) => o.many_collection === a && o.many_field === e.field && !o.junction_field
320
372
  );
321
- if (_ != null && _.one_collection)
322
- return /* @__PURE__ */ l(ie, { collection: _.one_collection, id: t });
373
+ if (k != null && k.one_collection)
374
+ return /* @__PURE__ */ r(X, { collection: k.one_collection, id: n });
323
375
  if (e.type === "datetime" || e.type === "date")
324
376
  try {
325
- return /* @__PURE__ */ l("span", { className: "text-slate-700 dark:text-slate-200", children: _e(t) });
377
+ return /* @__PURE__ */ r("span", { className: "text-slate-700 dark:text-slate-200", children: _e(n) });
326
378
  } catch {
327
379
  }
328
- const k = Me(e.options, t);
329
- return /* @__PURE__ */ l("span", { className: "truncate text-slate-700 dark:text-slate-200", children: k ?? String(t) });
380
+ const g = Ke(e.options, n);
381
+ return /* @__PURE__ */ r("span", { className: "truncate text-slate-700 dark:text-slate-200", children: g ?? String(n) });
330
382
  }
331
- function Me(e, t) {
332
- var h;
333
- if (t == null || typeof t == "object") return null;
334
- const n = le(
383
+ function Ke(e, n) {
384
+ var f;
385
+ if (n == null || typeof n == "object") return null;
386
+ const l = ae(
335
387
  e
336
- ), a = (h = n == null ? void 0 : n.choices) == null ? void 0 : h.find((y) => y && String(y.value) === String(t));
388
+ ), a = (f = l == null ? void 0 : l.choices) == null ? void 0 : f.find((s) => s && String(s.value) === String(n));
337
389
  return (a == null ? void 0 : a.text) != null ? ke(a.text) : null;
338
390
  }
339
- const Ee = /* @__PURE__ */ new Set([
391
+ const Pe = /* @__PURE__ */ new Set([
340
392
  "extension-editorjs",
341
393
  "input-rich-text-html",
342
394
  "rich_text",
343
395
  "wysiwyg"
344
396
  ]);
345
- function De(e, t) {
397
+ function Fe(e, n) {
346
398
  if (typeof e != "string") return null;
347
- if (Ee.has(t)) return Z(e);
348
- const n = e.trim();
349
- return n.startsWith("{") && /"blocks"\s*:/.test(n) ? Z(e) : null;
399
+ if (Pe.has(n)) return ee(e);
400
+ const l = e.trim();
401
+ return l.startsWith("{") && /"blocks"\s*:/.test(l) ? ee(e) : null;
350
402
  }
351
- function Re(e) {
403
+ function Je(e) {
352
404
  if (e == null || e === "") return "—";
353
405
  if (typeof e == "boolean") return e ? "Yes" : "No";
354
- const t = String(e);
355
- if (/^\d{4}-\d{2}-\d{2}T/.test(t))
406
+ const n = String(e);
407
+ if (/^\d{4}-\d{2}-\d{2}T/.test(n))
356
408
  try {
357
- return new Date(t).toLocaleDateString();
409
+ return new Date(n).toLocaleDateString();
358
410
  } catch {
359
411
  }
360
- return t;
412
+ return n;
361
413
  }
362
- const ee = (e) => {
414
+ const te = (e) => {
363
415
  if (e == null || e === "") return "empty";
364
416
  if (typeof e == "boolean") return e ? "Yes" : "No";
365
- if (typeof e == "object") {
366
- const n = e.id;
367
- return n != null ? `#${String(n)}` : Array.isArray(e) ? `${e.length} items` : "a value";
368
- }
369
- const t = String(e).replace(/<[^>]+>/g, "").trim();
370
- return t.length > 48 ? `${t.slice(0, 48)}…` : t;
417
+ if (typeof e == "object")
418
+ return e.id != null ? "a linked record" : Array.isArray(e) ? `${e.length} items` : "a value";
419
+ const n = String(e).replace(/<[^>]+>/g, "").trim();
420
+ return n.length > 48 ? `${n.slice(0, 48)}…` : n;
371
421
  };
372
- function te(e, t) {
373
- const n = U(), a = ge(), h = !!e && t != null && t !== "", { data: y } = E({
422
+ function ne(e, n) {
423
+ const l = U(), a = ge(), f = !!e && n != null && n !== "", { data: s } = $({
374
424
  queryKey: ["cbv-collection-meta", e],
375
- queryFn: () => n.request(K(`/collections/${e}`)).then((x) => x.data),
376
- enabled: h,
425
+ queryFn: () => l.request(O(`/collections/${e}`)).then((h) => h.data),
426
+ enabled: f,
377
427
  staleTime: 10 * 6e4,
378
428
  retry: !1
379
- }), { data: c } = E({
380
- queryKey: ["rrv-related", e, String(t)],
381
- queryFn: () => a(e, t).catch(() => null),
382
- enabled: h && !!y,
429
+ }), { data: m } = $({
430
+ queryKey: ["rrv-related", e, String(n)],
431
+ queryFn: () => a(e, n).catch(() => null),
432
+ enabled: f && !!s,
383
433
  staleTime: 6e4,
384
434
  retry: !1
385
435
  });
386
- if (!h) return null;
387
- if (!c) return `#${String(t)}`;
388
- const u = ne(y == null ? void 0 : y.display_template, c).trim();
389
- if (u) return u;
390
- for (const x of ["name", "title", "label", "number", "email"]) if (c[x]) return String(c[x]);
391
- return `#${String(t)}`;
436
+ if (!f) return null;
437
+ if (!m) return "a linked record";
438
+ const y = le(s == null ? void 0 : s.display_template, m).trim();
439
+ if (y) return y;
440
+ for (const h of ["name", "title", "label", "number", "email"]) if (m[h]) return String(m[h]);
441
+ return "a linked record";
392
442
  }
393
- function Ae({
443
+ function Ve({
394
444
  field: e,
395
- from: t,
396
- to: n,
445
+ from: n,
446
+ to: l,
397
447
  detail: a,
398
- relations: h,
399
- collection: y,
400
- onRevert: c
448
+ relations: f,
449
+ collection: s,
450
+ onRevert: m
401
451
  }) {
402
- var s;
403
- const u = ((s = h.find(
404
- (o) => o.many_collection === y && o.many_field === e.field && !!o.one_collection
405
- )) == null ? void 0 : s.one_collection) ?? null, x = te(u, t), _ = te(u, n), k = a ? `Unsaved — ${a}` : `Unsaved — was ${x ?? ee(t)} → now ${_ ?? ee(n)}`;
406
- return c ? (
452
+ var o;
453
+ const y = ((o = f.find(
454
+ (c) => c.many_collection === s && c.many_field === e.field && !!c.one_collection
455
+ )) == null ? void 0 : o.one_collection) ?? null, h = ne(y, n), k = ne(y, l), g = a ? `Unsaved — ${a}` : `Unsaved — was ${h ?? te(n)} → now ${k ?? te(l)}`;
456
+ return m ? (
407
457
  // biome-ignore lint/a11y/useSemanticElements: nested inside the row's <button> — a real <button> is invalid there
408
- /* @__PURE__ */ l(
458
+ /* @__PURE__ */ r(
409
459
  "span",
410
460
  {
411
461
  role: "button",
412
462
  tabIndex: 0,
413
463
  "data-summary-changed": !0,
414
- "data-tip": `${k} · click to revert`,
464
+ "data-tip": `${g} · click to revert`,
415
465
  "aria-label": "Revert this change",
416
- onClick: (o) => {
417
- o.stopPropagation(), c();
466
+ onClick: (c) => {
467
+ c.stopPropagation(), m();
418
468
  },
419
- onKeyDown: (o) => {
420
- (o.key === "Enter" || o.key === " ") && (o.preventDefault(), o.stopPropagation(), c());
469
+ onKeyDown: (c) => {
470
+ (c.key === "Enter" || c.key === " ") && (c.preventDefault(), c.stopPropagation(), m());
421
471
  },
422
472
  className: "group/dot inline-flex h-4 w-4 shrink-0 cursor-pointer items-center justify-center rounded-full hover:bg-amber-100 dark:hover:bg-amber-500/20",
423
- children: /* @__PURE__ */ l("span", { className: "h-1.5 w-1.5 rounded-full bg-amber-400 ring-2 ring-amber-100 group-hover/dot:ring-amber-200 dark:ring-amber-500/30" })
473
+ children: /* @__PURE__ */ r("span", { className: "h-1.5 w-1.5 rounded-full bg-amber-400 ring-2 ring-amber-100 group-hover/dot:ring-amber-200 dark:ring-amber-500/30" })
424
474
  }
425
475
  )
426
- ) : /* @__PURE__ */ l(
476
+ ) : /* @__PURE__ */ r(
427
477
  "span",
428
478
  {
429
479
  "data-summary-changed": !0,
430
- "data-tip": k,
480
+ "data-tip": g,
431
481
  className: "h-1.5 w-1.5 shrink-0 rounded-full bg-amber-400 ring-2 ring-amber-100 dark:ring-amber-500/30"
432
482
  }
433
483
  );
434
484
  }
435
- function Ge({
485
+ function et({
436
486
  allSteps: e,
437
- groupedMap: t,
438
- ungroupedFields: n,
487
+ groupedMap: n,
488
+ ungroupedFields: l,
439
489
  sectionGroups: a,
440
- draft: h,
441
- relations: y,
442
- collection: c,
443
- itemId: u,
444
- staging: x,
445
- errors: _,
446
- staleFields: k,
447
- aliasEmptiness: s,
448
- layoutFields: o,
490
+ draft: f,
491
+ relations: s,
492
+ collection: m,
493
+ itemId: y,
494
+ staging: h,
495
+ errors: k,
496
+ staleFields: g,
497
+ aliasEmptiness: o,
498
+ layoutFields: c,
449
499
  changedFields: d,
450
- onRevertChange: g,
451
- onFieldClick: D,
452
- stagedO2MRows: N,
453
- stagedO2MDeletes: C
500
+ onRevertChange: j,
501
+ onFieldClick: P,
502
+ stagedO2MRows: D,
503
+ stagedO2MDeletes: K
454
504
  }) {
455
- const [L, R] = Q(null), [S, m] = Q(null), b = he(/* @__PURE__ */ new Map()), r = [
456
- ...!e.some((i) => i.key === "__general__") && n.length > 0 ? [{ key: "__general__", label: "General" }] : [],
505
+ const [v, C] = z(null), [q, _] = z(null), L = he(/* @__PURE__ */ new Map()), i = [
506
+ ...!e.some((t) => t.key === "__general__") && l.length > 0 ? [{ key: "__general__", label: "General" }] : [],
457
507
  ...e
458
- ].map((i) => {
459
- const v = (i.key === "__general__" ? [...n, ...a.flatMap((q) => t[q.key] ?? [])] : t[i.key] ?? []).filter((q) => !q.hidden && !Se.has(q.field) && !we.has(q.field));
460
- return { step: i, fields: v };
461
- }).filter((i) => i.fields.length > 0), $ = new Set(r.flatMap((i) => i.fields.map((v) => v.field))), j = u && u !== "new" ? y.filter(
462
- (i) => !i.junction_field && i.many_field && i.many_collection && (i.one_collection === c || i.one_collection == null) && i.one_field != null && !$.has(i.one_field) && // Off-layout aliases stay out — the sidebar summarizes THIS layout.
463
- (!o || o.has(i.one_field))
508
+ ].map((t) => {
509
+ const u = (t.key === "__general__" ? [...l, ...a.flatMap((x) => n[x.key] ?? [])] : n[t.key] ?? []).filter((x) => !x.hidden && !Ne.has(x.field) && !we.has(x.field));
510
+ return { step: t, fields: u };
511
+ }).filter((t) => t.fields.length > 0), N = new Set(i.flatMap((t) => t.fields.map((u) => u.field))), w = y && y !== "new" ? s.filter(
512
+ (t) => !t.junction_field && t.many_field && t.many_collection && (t.one_collection === m || t.one_collection == null) && t.one_field != null && !N.has(t.one_field) && // Off-layout aliases stay out — the sidebar summarizes THIS layout.
513
+ (!c || c.has(t.one_field))
464
514
  ) : [];
465
- return r.length === 0 && j.length === 0 ? null : /* @__PURE__ */ l(re.Provider, { value: { rows: N, deletes: C }, children: /* @__PURE__ */ p("div", { className: "overflow-hidden bg-white dark:bg-card", children: [
466
- /* @__PURE__ */ l("div", { className: "bg-slate-200 border-b border-slate-300 px-4 py-2.5 dark:bg-white/[0.1] dark:border-border", children: /* @__PURE__ */ l("span", { className: "text-[12px] font-semibold text-slate-700 dark:text-slate-200", children: "Summary" }) }),
467
- r.map(({ step: i, fields: v }, q) => /* @__PURE__ */ p("div", { children: [
468
- /* @__PURE__ */ l(
515
+ return i.length === 0 && w.length === 0 ? null : /* @__PURE__ */ r(re.Provider, { value: { rows: D, deletes: K }, children: /* @__PURE__ */ b("div", { className: "overflow-hidden bg-white dark:bg-card", children: [
516
+ /* @__PURE__ */ r("div", { className: "bg-slate-200 border-b border-slate-300 px-4 py-2.5 dark:bg-white/[0.1] dark:border-border", children: /* @__PURE__ */ r("span", { className: "text-[12px] font-semibold text-slate-700 dark:text-slate-200", children: "Summary" }) }),
517
+ i.map(({ step: t, fields: u }, x) => /* @__PURE__ */ b("div", { children: [
518
+ /* @__PURE__ */ r(
469
519
  "div",
470
520
  {
471
- className: M(
521
+ className: R(
472
522
  "bg-slate-100 px-4 py-2 border-b border-slate-200 dark:bg-white/[0.06] dark:border-border/80",
473
- q > 0 && "border-t border-slate-200 dark:border-border/80"
523
+ x > 0 && "border-t border-slate-200 dark:border-border/80"
474
524
  ),
475
- children: /* @__PURE__ */ l("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: i.label })
525
+ children: /* @__PURE__ */ r("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: t.label })
476
526
  }
477
527
  ),
478
- v.map((f, P) => {
479
- const T = h[f.field], O = f.label ?? z(f.field), A = !!(_ != null && _[f.field]), F = s == null ? void 0 : s[f.field], ce = F !== void 0 ? F === !0 : T == null || typeof T == "string" && T.trim() === "" || Array.isArray(T) && T.length === 0, de = F === null, H = !!f.required && ce && !A && !de, I = (k == null ? void 0 : k.has(f.field)) ?? !1;
480
- return /* @__PURE__ */ p(
528
+ u.map((p, J) => {
529
+ const T = f[p.field], E = p.label ?? Z(p.field), A = !!(k != null && k[p.field]), F = o == null ? void 0 : o[p.field], ce = F !== void 0 ? F === !0 : T == null || typeof T == "string" && T.trim() === "" || Array.isArray(T) && T.length === 0, de = F === null, H = !!p.required && ce && !A && !de, W = (g == null ? void 0 : g.has(p.field)) ?? !1;
530
+ return /* @__PURE__ */ b(
481
531
  "div",
482
532
  {
483
- className: M(
533
+ className: R(
484
534
  "group/row flex items-stretch",
485
- P < v.length - 1 && "border-b border-slate-100 dark:border-border/60",
486
- A ? "bg-red-50 dark:bg-red-900/10" : H || I ? "bg-amber-50/70 dark:bg-amber-900/10" : ""
535
+ J < u.length - 1 && "border-b border-slate-100 dark:border-border/60",
536
+ A ? "bg-red-50 dark:bg-red-900/10" : H || W ? "bg-amber-50/70 dark:bg-amber-900/10" : ""
487
537
  ),
488
538
  children: [
489
- /* @__PURE__ */ p(
539
+ /* @__PURE__ */ b(
490
540
  "button",
491
541
  {
492
542
  type: "button",
493
- onClick: () => D(i.key, f.field),
494
- className: M(
543
+ onClick: () => P(t.key, p.field),
544
+ className: R(
495
545
  "flex flex-1 flex-col px-4 py-2 text-left transition-colors duration-150 min-w-0",
496
546
  A ? "hover:bg-red-50 dark:hover:bg-red-900/15" : "hover:bg-slate-50 dark:hover:bg-white/[0.03]"
497
547
  ),
498
548
  children: [
499
- /* @__PURE__ */ p(
549
+ /* @__PURE__ */ b(
500
550
  "span",
501
551
  {
502
- className: M(
552
+ className: R(
503
553
  "flex items-center gap-1 text-[10px] font-medium truncate",
504
- A ? "text-red-500 dark:text-red-400" : H || I ? "text-amber-700 dark:text-amber-400" : "text-slate-400 dark:text-slate-500"
554
+ A ? "text-red-500 dark:text-red-400" : H || W ? "text-amber-700 dark:text-amber-400" : "text-slate-400 dark:text-slate-500"
505
555
  ),
506
556
  children: [
507
- /* @__PURE__ */ l("span", { className: "truncate", children: O }),
508
- (d == null ? void 0 : d[f.field]) && /* @__PURE__ */ l(
509
- Ae,
557
+ /* @__PURE__ */ r("span", { className: "truncate", children: E }),
558
+ (d == null ? void 0 : d[p.field]) && /* @__PURE__ */ r(
559
+ Ve,
510
560
  {
511
- field: f,
512
- from: d[f.field].from,
513
- detail: d[f.field].detail,
561
+ field: p,
562
+ from: d[p.field].from,
563
+ detail: d[p.field].detail,
514
564
  to: T,
515
- relations: y,
516
- collection: c,
517
- onRevert: g ? () => g(f.field) : void 0
565
+ relations: s,
566
+ collection: m,
567
+ onRevert: j ? () => j(p.field) : void 0
518
568
  }
519
569
  ),
520
- H && /* @__PURE__ */ l("span", { className: "shrink-0 rounded bg-amber-100 px-1 text-[9px] font-semibold uppercase tracking-wide text-amber-700 dark:bg-amber-900/30 dark:text-amber-400", children: "required" }),
521
- I && /* @__PURE__ */ l(
570
+ H && /* @__PURE__ */ r("span", { className: "shrink-0 rounded bg-amber-100 px-1 text-[9px] font-semibold uppercase tracking-wide text-amber-700 dark:bg-amber-900/30 dark:text-amber-400", children: "required" }),
571
+ W && /* @__PURE__ */ r(
522
572
  "span",
523
573
  {
524
574
  title: "This value is no longer one of the available options",
@@ -529,22 +579,22 @@ function Ge({
529
579
  ]
530
580
  }
531
581
  ),
532
- /* @__PURE__ */ l(
582
+ /* @__PURE__ */ r(
533
583
  "span",
534
584
  {
535
- ref: (W) => {
536
- b.current.set(f.field, W);
585
+ ref: (B) => {
586
+ L.current.set(p.field, B);
537
587
  },
538
588
  className: "mt-0.5 w-full text-[12px] min-w-0 overflow-hidden",
539
- children: /* @__PURE__ */ l(
540
- Le,
589
+ children: /* @__PURE__ */ r(
590
+ De,
541
591
  {
542
- field: f,
592
+ field: p,
543
593
  val: T,
544
- relations: y,
545
- collection: c,
546
- itemId: u,
547
- staging: x
594
+ relations: s,
595
+ collection: m,
596
+ itemId: y,
597
+ staging: h
548
598
  }
549
599
  )
550
600
  }
@@ -552,58 +602,58 @@ function Ge({
552
602
  ]
553
603
  }
554
604
  ),
555
- /* @__PURE__ */ l(
605
+ /* @__PURE__ */ r(
556
606
  "button",
557
607
  {
558
608
  type: "button",
559
609
  title: "Copy value",
560
- onClick: (W) => {
610
+ onClick: (B) => {
561
611
  var Y, G;
562
- W.stopPropagation();
563
- const me = ((G = (Y = b.current.get(f.field)) == null ? void 0 : Y.textContent) == null ? void 0 : G.trim()) ?? Re(T);
612
+ B.stopPropagation();
613
+ const me = ((G = (Y = L.current.get(p.field)) == null ? void 0 : Y.textContent) == null ? void 0 : G.trim()) ?? Je(T);
564
614
  navigator.clipboard.writeText(me).catch(() => {
565
- }), R(f.field), setTimeout(
566
- () => R((B) => B === f.field ? null : B),
615
+ }), C(p.field), setTimeout(
616
+ () => C((Q) => Q === p.field ? null : Q),
567
617
  1500
568
618
  );
569
619
  },
570
- className: M(
620
+ className: R(
571
621
  "flex items-center px-2 opacity-0 group-hover/row:opacity-100 transition-all duration-150",
572
- L === f.field ? "text-emerald-500" : "text-slate-400 hover:text-slate-600 dark:text-slate-500 dark:hover:text-slate-300"
622
+ v === p.field ? "text-emerald-500" : "text-slate-400 hover:text-slate-600 dark:text-slate-500 dark:hover:text-slate-300"
573
623
  ),
574
- children: L === f.field ? /* @__PURE__ */ l(ue, { className: "h-3 w-3" }) : /* @__PURE__ */ l(fe, { className: "h-3 w-3" })
624
+ children: v === p.field ? /* @__PURE__ */ r(ue, { className: "h-3 w-3" }) : /* @__PURE__ */ r(fe, { className: "h-3 w-3" })
575
625
  }
576
626
  )
577
627
  ]
578
628
  },
579
- f.field
629
+ p.field
580
630
  );
581
631
  })
582
- ] }, i.key)),
583
- j.length > 0 && /* @__PURE__ */ p("div", { children: [
584
- /* @__PURE__ */ l("div", { className: "bg-slate-100 px-4 py-2 border-y border-slate-200 dark:bg-white/[0.06] dark:border-border/80", children: /* @__PURE__ */ l("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: "Related" }) }),
585
- j.map((i, v) => {
586
- const q = i.one_field ?? i.many_collection ?? "", f = S === q;
587
- return /* @__PURE__ */ l(
632
+ ] }, t.key)),
633
+ w.length > 0 && /* @__PURE__ */ b("div", { children: [
634
+ /* @__PURE__ */ r("div", { className: "bg-slate-100 px-4 py-2 border-y border-slate-200 dark:bg-white/[0.06] dark:border-border/80", children: /* @__PURE__ */ r("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: "Related" }) }),
635
+ w.map((t, u) => {
636
+ const x = t.one_field ?? t.many_collection ?? "", p = q === x;
637
+ return /* @__PURE__ */ r(
588
638
  "div",
589
639
  {
590
- className: M(
640
+ className: R(
591
641
  "flex items-stretch",
592
- v < j.length - 1 && "border-b border-slate-100 dark:border-border/60"
642
+ u < w.length - 1 && "border-b border-slate-100 dark:border-border/60"
593
643
  ),
594
- children: /* @__PURE__ */ p(
644
+ children: /* @__PURE__ */ b(
595
645
  "button",
596
646
  {
597
647
  type: "button",
598
648
  onClick: () => {
599
649
  var A;
600
- const P = i.many_collection ?? "", T = /(^|_)(notes?|comments?)$/i.test(P), O = document.querySelector(`[data-o2m-collection="${P}"]`) ?? (T ? document.querySelector('[data-panel="notes"]') : null);
601
- if (!O) {
602
- m((F) => F === q ? null : q);
650
+ const J = t.many_collection ?? "", T = /(^|_)(notes?|comments?)$/i.test(J), E = document.querySelector(`[data-o2m-collection="${J}"]`) ?? (T ? document.querySelector('[data-panel="notes"]') : null);
651
+ if (!E) {
652
+ _((F) => F === x ? null : x);
603
653
  return;
604
654
  }
605
- O.getAttribute("data-panel-expanded") === "false" && ((A = O.querySelector("[data-panel-toggle]")) == null || A.click()), O.scrollIntoView({ behavior: "smooth", block: "center" }), O.classList.add("ring-2", "ring-nvr-cyan", "ring-offset-2", "rounded-md"), setTimeout(
606
- () => O.classList.remove(
655
+ E.getAttribute("data-panel-expanded") === "false" && ((A = E.querySelector("[data-panel-toggle]")) == null || A.click()), E.scrollIntoView({ behavior: "smooth", block: "center" }), E.classList.add("ring-2", "ring-nvr-cyan", "ring-offset-2", "rounded-md"), setTimeout(
656
+ () => E.classList.remove(
607
657
  "ring-2",
608
658
  "ring-nvr-cyan",
609
659
  "ring-offset-2",
@@ -614,41 +664,45 @@ function Ge({
614
664
  },
615
665
  className: "flex flex-1 flex-col px-4 py-2 min-w-0 text-left transition-colors hover:bg-nvr-cyan/5",
616
666
  children: [
617
- /* @__PURE__ */ p("span", { className: "flex items-center gap-1 text-[10px] font-medium truncate text-slate-400 dark:text-slate-500", children: [
618
- /* @__PURE__ */ l(
667
+ /* @__PURE__ */ b("span", { className: "flex items-center gap-1 text-[10px] font-medium truncate text-slate-400 dark:text-slate-500", children: [
668
+ /* @__PURE__ */ r(
619
669
  ye,
620
670
  {
621
- className: M(
671
+ className: R(
622
672
  "h-3 w-3 shrink-0 transition-transform",
623
- f && "rotate-90"
673
+ p && "rotate-90"
624
674
  )
625
675
  }
626
676
  ),
627
- z(i.one_field ?? i.many_collection ?? "")
677
+ Z(t.one_field ?? t.many_collection ?? "")
628
678
  ] }),
629
- /* @__PURE__ */ l("span", { className: "mt-0.5 text-[12px]", children: /* @__PURE__ */ l(
679
+ /* @__PURE__ */ r("span", { className: "mt-0.5 text-[12px]", children: /* @__PURE__ */ r(
630
680
  oe,
631
681
  {
632
- relatedCollection: i.many_collection ?? "",
633
- manyField: i.many_field,
634
- parentId: u,
635
- expanded: f
682
+ relatedCollection: t.many_collection ?? "",
683
+ manyField: t.many_field,
684
+ parentId: y,
685
+ expanded: p
636
686
  }
637
687
  ) })
638
688
  ]
639
689
  }
640
690
  )
641
691
  },
642
- i.id ?? `${i.many_collection}.${i.many_field}`
692
+ t.id ?? `${t.many_collection}.${t.many_field}`
643
693
  );
644
694
  })
645
695
  ] })
646
696
  ] }) });
647
697
  }
648
698
  export {
649
- ie as M2OSummaryValue,
650
- Le as SummaryFieldValue,
651
- Ge as SummaryPanel,
652
- Me as summaryChoiceLabel,
653
- De as summaryPlainText
699
+ X as M2OSummaryValue,
700
+ De as SummaryFieldValue,
701
+ et as SummaryPanel,
702
+ Re as o2mItemRelation,
703
+ Oe as o2mRowLabel,
704
+ Ke as summaryChoiceLabel,
705
+ Fe as summaryPlainText,
706
+ ve as templateRelationPaths,
707
+ Ce as withTemplateRelations
654
708
  };