@nivaro/react 0.3.49 → 0.3.51

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