@nivaro/react 0.3.14 → 0.3.16

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