@nivaro/react 0.3.56 → 0.3.58

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