@nivaro/react 0.3.111 → 0.3.112

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 (75) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +170 -2
  4. package/dist/index.js +745 -728
  5. package/dist/shared/components/CollectionBrowserView.js +3097 -2972
  6. package/dist/shared/components/CollectionImportBanner.js +135 -0
  7. package/dist/shared/components/ItemEditForm.js +2235 -2218
  8. package/dist/shared/components/JobsTray.js +54 -47
  9. package/dist/shared/components/ViewAsPersonButton.js +109 -0
  10. package/dist/shared/components/bulk/BulkFieldUpdate.js +228 -150
  11. package/dist/shared/components/bulk/BulkFieldUpdateButton.js +35 -41
  12. package/dist/shared/components/bulk/BulkLinksValue.js +91 -0
  13. package/dist/shared/components/bulk/bulk-field-options.js +20 -19
  14. package/dist/shared/components/bulk/bulk-update-preview.js +39 -0
  15. package/dist/shared/components/cbv/ColumnHeaderMenu.js +113 -0
  16. package/dist/shared/components/cbv/column-totals.js +66 -0
  17. package/dist/shared/components/collections-directory/CollectionHoverCard.js +108 -81
  18. package/dist/shared/components/collections-directory/CollectionRow.js +164 -148
  19. package/dist/shared/components/collections-directory/CollectionsDirectory.js +167 -166
  20. package/dist/shared/components/collections-directory/directory-data.js +70 -58
  21. package/dist/shared/components/imports/CollectionImportPanel.js +120 -118
  22. package/dist/shared/components/imports/DefinitionsPanel.js +24 -24
  23. package/dist/shared/components/imports/ImportDuplicatesNotice.js +65 -0
  24. package/dist/shared/components/item-edit/CatalogPickerField.js +631 -639
  25. package/dist/shared/components/item-edit/DuplicateNotice.js +168 -0
  26. package/dist/shared/components/item-edit/FieldRow.js +248 -246
  27. package/dist/shared/components/item-edit/InlineGridField.js +34 -33
  28. package/dist/shared/components/item-edit/InlineTableField.js +3064 -2882
  29. package/dist/shared/components/item-edit/MembershipSetField.js +165 -169
  30. package/dist/shared/components/item-edit/NestedRelationEditor.js +184 -189
  31. package/dist/shared/components/item-edit/PlanGrid.js +2 -1
  32. package/dist/shared/components/item-edit/QuickPickerDialog.js +35 -34
  33. package/dist/shared/components/item-edit/RecordLiveSync.js +32 -30
  34. package/dist/shared/components/item-edit/RelationCombobox.js +101 -100
  35. package/dist/shared/components/item-edit/RowHistorySheet.js +28 -27
  36. package/dist/shared/components/item-edit/SummaryPanel.js +133 -135
  37. package/dist/shared/components/item-edit/ViewAsRole.js +129 -52
  38. package/dist/shared/components/item-edit/grid-search.js +345 -0
  39. package/dist/shared/components/item-edit/render-stability.js +61 -54
  40. package/dist/shared/components/notifications/NotificationRulesEditor.js +25 -20
  41. package/dist/shared/components/ops-report/DigestSections.js +163 -144
  42. package/dist/shared/components/ops-report/drill.js +97 -97
  43. package/dist/shared/components/panels/AddendumLinesDiff.js +52 -51
  44. package/dist/shared/components/panels/AddendumPanel.js +92 -91
  45. package/dist/shared/components/panels/AsyncUserPicker.js +108 -0
  46. package/dist/shared/components/panels/CommentPanel.js +265 -252
  47. package/dist/shared/components/panels/OwnersSlot.js +47 -35
  48. package/dist/shared/components/panels/PipelineInsight.js +186 -0
  49. package/dist/shared/components/panels/PipelinePanel.js +1529 -1492
  50. package/dist/shared/components/panels/RecordIntegrityBanner.js +39 -38
  51. package/dist/shared/components/panels/RevisionsPanel.js +261 -260
  52. package/dist/shared/components/pipeline/FieldPicker.js +41 -40
  53. package/dist/shared/components/pipeline/OwnerMatrix.js +829 -700
  54. package/dist/shared/components/pipeline/OwnerRecordTrial.js +362 -0
  55. package/dist/shared/components/pipeline/PipelineEditorView.js +483 -467
  56. package/dist/shared/components/pipeline/PipelineStateOwners.js +65 -64
  57. package/dist/shared/components/pipeline/owner-matrix-draft.js +178 -0
  58. package/dist/shared/components/profile/MyDefaultsCard.js +36 -35
  59. package/dist/shared/components/profile/PersonHeader.js +29 -29
  60. package/dist/shared/components/profile/PersonProfile.js +30 -28
  61. package/dist/shared/components/profile/SlowScreensCard.js +286 -0
  62. package/dist/shared/components/queue/QueueWorklist.js +1090 -1071
  63. package/dist/shared/components/quick-filters/useQuickFilterEditing.js +45 -44
  64. package/dist/shared/components/support/TicketDetailSheet.js +25 -16
  65. package/dist/shared/components/support/TicketSlowScreens.js +32 -0
  66. package/dist/shared/lib/activity-sentence.js +224 -178
  67. package/dist/shared/lib/collection-import-banner.js +27 -0
  68. package/dist/shared/lib/crash-report.js +112 -0
  69. package/dist/shared/lib/export-runs.js +99 -0
  70. package/dist/shared/lib/jobs-tray.js +89 -67
  71. package/dist/shared/lib/list-link.js +76 -69
  72. package/dist/shared/lib/nav-trail.js +180 -76
  73. package/dist/shared/lib/query-keys.js +26 -0
  74. package/dist/shared/lib/view-as.js +16 -11
  75. package/package.json +1 -1
@@ -3,61 +3,62 @@ import { useQuery as $ } from "@tanstack/react-query";
3
3
  import { Check as pe, Copy as he, ChevronRight as xe, Loader2 as be } from "lucide-react";
4
4
  import { useState as Z, useRef as ge, createContext as _e, useContext as ke } from "react";
5
5
  import { useNivaroClient as U } from "../../context.js";
6
- import { get as L } from "../../lib/commands.js";
7
- import { useRecordReader as Se } from "../../lib/record-loader.js";
8
- import { cn as v, titleCase as ee, toLocalDateString as ie, choiceLabel as Ne } from "../../lib/utils.js";
9
- import { useChangePulse as we } from "./GroupSection.js";
10
- import { SYSTEM_FIELDS as qe, SENTINEL_FIELDS as Te, applyDisplayTemplate as re, parseJson as oe, richTextToPlain as te } from "./helpers.js";
11
- import { resolveM2MRelatedCollection as $e, m2mIdKey as ne } from "./M2MCombobox.js";
6
+ import { get as v } from "../../lib/commands.js";
7
+ import { fetchCollectionRelations as Se, queryKeys as Ne } from "../../lib/query-keys.js";
8
+ import { useRecordReader as we } from "../../lib/record-loader.js";
9
+ import { cn as C, titleCase as ee, toLocalDateString as ie, choiceLabel as qe } from "../../lib/utils.js";
10
+ import { useChangePulse as Te } from "./GroupSection.js";
11
+ import { SYSTEM_FIELDS as $e, SENTINEL_FIELDS as Oe, applyDisplayTemplate as re, parseJson as oe, richTextToPlain as te } from "./helpers.js";
12
+ import { resolveM2MRelatedCollection as je, m2mIdKey as ne } from "./M2MCombobox.js";
12
13
  import { RelatedItemLabel as se } from "./RelationCombobox.js";
13
14
  const ce = _e({});
14
- function Oe(e, n) {
15
+ function Le(e, n) {
15
16
  return n ? Object.entries(n).every(
16
17
  ([a, l]) => l !== null && typeof l == "object" || String(e[a] ?? "") === String(l ?? "")
17
18
  ) : !0;
18
19
  }
19
- function je({
20
+ function Me({
20
21
  relation: e,
21
22
  parentId: n,
22
23
  allRelations: a,
23
24
  staging: l,
24
25
  maxValues: c
25
26
  }) {
26
- var K, T;
27
- const r = U(), u = e.many_field ?? "", f = e.junction_field ?? (() => {
27
+ var D, T;
28
+ const r = U(), m = e.many_field ?? "", f = e.junction_field ?? (() => {
28
29
  const t = a.find(
29
30
  (s) => s.many_collection === e.many_collection && s.id !== e.id
30
31
  );
31
32
  return (t == null ? void 0 : t.many_field) ?? "";
32
- })(), p = e.one_field ?? `${e.many_collection}.${f}`, g = ((K = a.find(
33
+ })(), p = e.one_field ?? `${e.many_collection}.${f}`, g = ((D = a.find(
33
34
  (t) => t.many_collection === e.many_collection && t.many_field === f && t.id !== e.id
34
- )) == null ? void 0 : K.one_collection) ?? null, { data: b } = $({
35
+ )) == null ? void 0 : D.one_collection) ?? null, { data: b } = $({
35
36
  queryKey: ["summary-junction-relations", e.many_collection],
36
37
  queryFn: () => r.request(
37
- L(`/data-model/relations/for/${e.many_collection}`)
38
+ v(`/data-model/relations/for/${e.many_collection}`)
38
39
  ).then((t) => t.data ?? []).catch(() => []),
39
40
  enabled: !g && !!e.many_collection && !!f,
40
41
  staleTime: 10 * 6e4
41
42
  }), o = g ?? ((T = b == null ? void 0 : b.find(
42
43
  (t) => t.many_collection === e.many_collection && t.many_field === f && !!t.one_collection
43
44
  )) == null ? void 0 : T.one_collection) ?? null, { data: d = [] } = $({
44
- queryKey: ["m2m-items", e.many_collection, u, n],
45
+ queryKey: ["m2m-items", e.many_collection, m, n],
45
46
  queryFn: () => r.request(
46
- L(`/items/${e.many_collection}`, {
47
- filter: JSON.stringify({ [u]: { _eq: n } }),
47
+ v(`/items/${e.many_collection}`, {
48
+ filter: JSON.stringify({ [m]: { _eq: n } }),
48
49
  limit: 200,
49
50
  fields: `id,${f}`
50
51
  })
51
52
  ).then((t) => t.data ?? []),
52
53
  staleTime: 3e4,
53
54
  enabled: !!n && n !== "new"
54
- }), m = o ? void 0 : [...a, ...b ?? []].find(
55
+ }), u = o ? void 0 : [...a, ...b ?? []].find(
55
56
  (t) => t.many_collection === e.many_collection && t.many_field === f && !!t.one_collection_field
56
- ), k = (m == null ? void 0 : m.one_collection_field) ?? null, E = m ? $e(m) : null, { data: F = [] } = $({
57
- queryKey: ["summary-m2a-items", e.many_collection, u, n, k],
57
+ ), k = (u == null ? void 0 : u.one_collection_field) ?? null, E = u ? je(u) : null, { data: F = [] } = $({
58
+ queryKey: ["summary-m2a-items", e.many_collection, m, n, k],
58
59
  queryFn: () => r.request(
59
- L(`/items/${e.many_collection}`, {
60
- filter: JSON.stringify({ [u]: { _eq: n } }),
60
+ v(`/items/${e.many_collection}`, {
61
+ filter: JSON.stringify({ [m]: { _eq: n } }),
61
62
  limit: 200,
62
63
  fields: `id,${f},${k}`
63
64
  })
@@ -66,7 +67,7 @@ function je({
66
67
  enabled: !!k && !!n && n !== "new"
67
68
  }), I = o === "nivaro_files" || o === "directus_files", { data: O } = $({
68
69
  queryKey: ["col-meta", o],
69
- queryFn: () => r.request(L(`/collections/${o}`)).then((t) => t.data),
70
+ queryFn: () => r.request(v(`/collections/${o}`)).then((t) => t.data),
70
71
  enabled: !!o && !I,
71
72
  staleTime: 3e5
72
73
  }), w = (l == null ? void 0 : l.getStagedLinks(p)) ?? [], R = (l == null ? void 0 : l.getStagedUnlinks(p)) ?? /* @__PURE__ */ new Set(), S = d.filter((t) => !R.has(t.id)), j = /* @__PURE__ */ new Set(), _ = [
@@ -99,10 +100,10 @@ function je({
99
100
  ] })
100
101
  ] });
101
102
  }
102
- const D = /* @__PURE__ */ new Set(), q = (k ? [
103
+ const K = /* @__PURE__ */ new Set(), q = (k ? [
103
104
  ...F.filter((t) => !R.has(t.id) && t[f] != null && t[k]).map((t) => ({
104
105
  key: String(t.id),
105
- collection: Le(String(t[k])),
106
+ collection: Ce(String(t[k])),
106
107
  id: t[f]
107
108
  })),
108
109
  ...E ? w.map((t) => ({
@@ -112,7 +113,7 @@ function je({
112
113
  })) : []
113
114
  ] : []).filter((t) => {
114
115
  const s = `${t.collection}|${ne(t.id)}`;
115
- return D.has(s) ? !1 : (D.add(s), !0);
116
+ return K.has(s) ? !1 : (K.add(s), !0);
116
117
  });
117
118
  if (q.length > 0 && (w.length === 0 || E)) {
118
119
  const t = q.length - 5;
@@ -134,14 +135,14 @@ function je({
134
135
  _.length !== 1 ? "s" : ""
135
136
  ] });
136
137
  }
137
- function Le(e) {
138
+ function Ce(e) {
138
139
  return e === "directus_users" ? "nivaro_users" : e;
139
140
  }
140
141
  function de(e) {
141
142
  const n = U();
142
143
  return $({
143
144
  queryKey: ["summary-display-template", e],
144
- queryFn: () => n.request(L(`/collections/${e}`)).then((a) => {
145
+ queryFn: () => n.request(v(`/collections/${e}`)).then((a) => {
145
146
  var l;
146
147
  return ((l = a.data) == null ? void 0 : l.display_template) ?? null;
147
148
  }).catch(() => null),
@@ -161,7 +162,7 @@ function X({ collection: e, id: n }) {
161
162
  }
162
163
  );
163
164
  }
164
- const Me = ["name", "title", "label", "subject", "description", "line_number"], Ce = ["amount", "total", "cost"], C = (e) => {
165
+ const ve = ["name", "title", "label", "subject", "description", "line_number"], Ee = ["amount", "total", "cost"], M = (e) => {
165
166
  if (typeof e == "number") return Number.isFinite(e) ? e : null;
166
167
  if (typeof e == "string" && e.trim() !== "") {
167
168
  const n = Number(e);
@@ -169,38 +170,38 @@ const Me = ["name", "title", "label", "subject", "description", "line_number"],
169
170
  }
170
171
  return null;
171
172
  };
172
- function ve(e) {
173
- const n = Ce.find((l) => e.some((c) => C(c[l]) !== null)), a = e.some((l) => C(l.price) !== null && C(l.quantity) !== null);
173
+ function Re(e) {
174
+ const n = Ee.find((l) => e.some((c) => M(c[l]) !== null)), a = e.some((l) => M(l.price) !== null && M(l.quantity) !== null);
174
175
  return n || a ? {
175
176
  currency: !0,
176
177
  of: (l) => {
177
- const c = n ? C(l[n]) : null;
178
+ const c = n ? M(l[n]) : null;
178
179
  if (c !== null) return c;
179
- const r = C(l.price), u = C(l.quantity);
180
- return r !== null && u !== null ? Math.round(r * u * 100) / 100 : null;
180
+ const r = M(l.price), m = M(l.quantity);
181
+ return r !== null && m !== null ? Math.round(r * m * 100) / 100 : null;
181
182
  }
182
- } : e.some((l) => C(l.quantity) !== null) ? { currency: !1, of: (l) => C(l.quantity) } : null;
183
+ } : e.some((l) => M(l.quantity) !== null) ? { currency: !1, of: (l) => M(l.quantity) } : null;
183
184
  }
184
185
  const V = 4, H = 200;
185
- function Ee(e, n) {
186
+ function Ke(e, n) {
186
187
  if (n) {
187
188
  const a = re(n, e).replace(/\s*[·|\-–—/]\s*(?=[·|\-–—/]|$)/g, "").replace(/^\s*[·|\-–—/]\s*/, "").trim();
188
189
  if (a !== "") return a;
189
190
  }
190
- for (const a of Me) {
191
+ for (const a of ve) {
191
192
  const l = e[a];
192
193
  if (l != null && String(l).trim() !== "") return String(l).trim();
193
194
  }
194
195
  return null;
195
196
  }
196
- function Re(e) {
197
+ function De(e) {
197
198
  if (!e) return [];
198
199
  const n = /* @__PURE__ */ new Set();
199
200
  for (const a of e.matchAll(/\{\{\s*([\w.]+)\s*\}\}/g))
200
201
  a[1].includes(".") && !a[1].startsWith(".") && n.add(a[1]);
201
202
  return [...n];
202
203
  }
203
- function De(e, n, a) {
204
+ function Ae(e, n, a) {
204
205
  if (!n || a.length === 0) return e;
205
206
  const l = { ...e };
206
207
  for (const c of new Set(a.map((r) => r.split(".")[0]))) {
@@ -209,22 +210,22 @@ function De(e, n, a) {
209
210
  }
210
211
  return l;
211
212
  }
212
- const Ke = ["cifa", "item", "catalog_item", "product", "part", "material"], Ae = /* @__PURE__ */ new Set(["nivaro_users", "directus_users"]);
213
- function Pe(e, n, a) {
213
+ const Pe = ["cifa", "item", "catalog_item", "product", "part", "material"], Fe = /* @__PURE__ */ new Set(["nivaro_users", "directus_users"]);
214
+ function Ie(e, n, a) {
214
215
  const l = e.filter(
215
- (r) => r.many_collection === n && !!r.many_field && r.many_field !== a && !r.junction_field && !!r.one_collection && !Ae.has(r.one_collection)
216
- ), c = Ke.map((r) => l.find((u) => u.many_field === r)).find(Boolean) ?? l[0];
216
+ (r) => r.many_collection === n && !!r.many_field && r.many_field !== a && !r.junction_field && !!r.one_collection && !Fe.has(r.one_collection)
217
+ ), c = Pe.map((r) => l.find((m) => m.many_field === r)).find(Boolean) ?? l[0];
217
218
  return c != null && c.many_field && c.one_collection ? { field: c.many_field, collection: c.one_collection } : null;
218
219
  }
219
- function ue({
220
+ function me({
220
221
  relatedCollection: e,
221
222
  manyField: n,
222
223
  parentId: a,
223
224
  rowFilter: l,
224
225
  expanded: c
225
226
  }) {
226
- var K, T;
227
- const r = U(), u = ke(ce), f = l && Object.keys(l).length > 0 ? {
227
+ var D, T;
228
+ const r = U(), m = ke(ce), f = l && Object.keys(l).length > 0 ? {
228
229
  _and: [
229
230
  { [n]: { _eq: a } },
230
231
  Object.fromEntries(
@@ -243,7 +244,7 @@ function ue({
243
244
  l ? JSON.stringify(l) : ""
244
245
  ],
245
246
  queryFn: () => r.request(
246
- L(`/items/${e}`, {
247
+ v(`/items/${e}`, {
247
248
  filter: JSON.stringify(f),
248
249
  limit: H
249
250
  })
@@ -251,33 +252,30 @@ function ue({
251
252
  enabled: !!a && a !== "new",
252
253
  staleTime: 3e4
253
254
  }), b = de(e), { data: o = [] } = $({
254
- queryKey: ["collection-relations", e],
255
- queryFn: () => r.request(L(`/collections/${e}`)).then((t) => {
256
- var s;
257
- return ((s = t.data) == null ? void 0 : s.relations) ?? [];
258
- }),
255
+ queryKey: Ne.collectionRelations(e),
256
+ queryFn: () => Se(r, e),
259
257
  staleTime: 10 * 6e4
260
- }), d = Pe(o, e, n), m = Re(b), k = [...new Set(m.map((t) => t.split(".")[0]))], E = m.length ? JSON.stringify((p ?? []).map((t) => [t.id, ...k.map((s) => t[s] ?? null)])) : "", { data: F } = $({
258
+ }), d = Ie(o, e, n), u = De(b), k = [...new Set(u.map((t) => t.split(".")[0]))], E = u.length ? JSON.stringify((p ?? []).map((t) => [t.id, ...k.map((s) => t[s] ?? null)])) : "", { data: F } = $({
261
259
  queryKey: [
262
260
  "o2m-summary-labels",
263
261
  e,
264
262
  n,
265
263
  a,
266
264
  l ? JSON.stringify(l) : "",
267
- m.join(","),
265
+ u.join(","),
268
266
  E
269
267
  ],
270
268
  queryFn: () => r.request(
271
- L(`/items/${e}`, {
269
+ v(`/items/${e}`, {
272
270
  filter: JSON.stringify(f),
273
- fields: ["id", ...m].join(","),
271
+ fields: ["id", ...u].join(","),
274
272
  limit: H
275
273
  })
276
274
  ).then((t) => t.data ?? []).catch(() => []),
277
- enabled: m.length > 0 && !!a && a !== "new" && ((p == null ? void 0 : p.length) ?? 0) > 0,
275
+ enabled: u.length > 0 && !!a && a !== "new" && ((p == null ? void 0 : p.length) ?? 0) > 0,
278
276
  staleTime: 6e4
279
- }), I = new Map((F ?? []).map((t) => [String(t.id), t])), O = `${e}.${n}`, w = (K = u.deletes) == null ? void 0 : K.get(O), R = (((T = u.rows) == null ? void 0 : T.get(O)) ?? []).filter(
280
- (t) => Oe(t, l)
277
+ }), I = new Map((F ?? []).map((t) => [String(t.id), t])), O = `${e}.${n}`, w = (D = m.deletes) == null ? void 0 : D.get(O), R = (((T = m.rows) == null ? void 0 : T.get(O)) ?? []).filter(
278
+ (t) => Le(t, l)
281
279
  ), S = [
282
280
  ...(p ?? []).filter((t) => !(w != null && w.has(String(t.id)))),
283
281
  ...R
@@ -286,7 +284,7 @@ function ue({
286
284
  return /* @__PURE__ */ i(be, { className: "h-3 w-3 animate-spin text-slate-400 dark:text-slate-500" });
287
285
  if (S.length === 0)
288
286
  return /* @__PURE__ */ i("span", { className: "italic text-[11px] text-slate-400 dark:text-slate-500", children: "None yet" });
289
- const j = ((p == null ? void 0 : p.length) ?? 0) >= H, _ = ve(S), D = _ && !j ? Math.round(S.reduce((t, s) => t + (_.of(s) ?? 0), 0) * 100) / 100 : null, q = (_ == null ? void 0 : _.currency) ?? !1;
287
+ const j = ((p == null ? void 0 : p.length) ?? 0) >= H, _ = Re(S), K = _ && !j ? Math.round(S.reduce((t, s) => t + (_.of(s) ?? 0), 0) * 100) / 100 : null, q = (_ == null ? void 0 : _.currency) ?? !1;
290
288
  return /* @__PURE__ */ h("span", { className: "block", children: [
291
289
  /* @__PURE__ */ h("span", { className: "flex items-baseline gap-2", children: [
292
290
  /* @__PURE__ */ h("span", { className: "text-slate-700 dark:text-slate-200", children: [
@@ -294,12 +292,12 @@ function ue({
294
292
  " row",
295
293
  S.length !== 1 ? "s" : ""
296
294
  ] }),
297
- D !== null && /* @__PURE__ */ i("span", { className: "tabular-nums text-[11px] text-slate-500 dark:text-slate-400", children: q ? D.toLocaleString(void 0, {
295
+ K !== null && /* @__PURE__ */ i("span", { className: "tabular-nums text-[11px] text-slate-500 dark:text-slate-400", children: q ? K.toLocaleString(void 0, {
298
296
  style: "currency",
299
297
  currency: "USD",
300
298
  minimumFractionDigits: 2,
301
299
  maximumFractionDigits: 2
302
- }) : D.toLocaleString() })
300
+ }) : K.toLocaleString() })
303
301
  ] }),
304
302
  /* @__PURE__ */ h("span", { className: "mt-1 block space-y-0.5", children: [
305
303
  (c ? S : S.slice(0, V)).map((t, s) => /* @__PURE__ */ h(
@@ -307,8 +305,8 @@ function ue({
307
305
  {
308
306
  className: "flex items-baseline justify-between gap-2 text-[11px] text-slate-500 dark:text-slate-400",
309
307
  children: [
310
- /* @__PURE__ */ i("span", { className: "truncate", children: Ee(
311
- De(t, I.get(String(t.id)), m),
308
+ /* @__PURE__ */ i("span", { className: "truncate", children: Ke(
309
+ Ae(t, I.get(String(t.id)), u),
312
310
  b ?? null
313
311
  ) ?? (d && t[d.field] != null && t[d.field] !== "" ? /* @__PURE__ */ i(X, { collection: d.collection, id: t[d.field] }) : `Row ${s + 1}`) }),
314
312
  _ && _.of(t) !== null && /* @__PURE__ */ i("span", { className: "shrink-0 tabular-nums", children: (() => {
@@ -332,11 +330,11 @@ function ue({
332
330
  ] })
333
331
  ] });
334
332
  }
335
- function Fe(e) {
336
- const n = we(e.val);
337
- return /* @__PURE__ */ i("span", { className: v("inline-block max-w-full rounded-sm", n && "nvr-value-pulse-bg"), children: /* @__PURE__ */ i(Ie, { ...e }) });
333
+ function Je(e) {
334
+ const n = Te(e.val);
335
+ return /* @__PURE__ */ i("span", { className: C("inline-block max-w-full rounded-sm", n && "nvr-value-pulse-bg"), children: /* @__PURE__ */ i(Ve, { ...e }) });
338
336
  }
339
- function Ie({
337
+ function Ve({
340
338
  field: e,
341
339
  val: n,
342
340
  relations: a,
@@ -344,8 +342,8 @@ function Ie({
344
342
  itemId: c,
345
343
  staging: r
346
344
  }) {
347
- const u = e.interface ?? "", f = /* @__PURE__ */ new Set(["select-multiple-m2m", "files-m2m", "files", "relation-grouped"]);
348
- if (!f.has(u) && c) {
345
+ const m = e.interface ?? "", f = /* @__PURE__ */ new Set(["select-multiple-m2m", "files-m2m", "files", "relation-grouped"]);
346
+ if (!f.has(m) && c) {
349
347
  const o = a.find(
350
348
  (d) => !d.junction_field && (d.one_field === e.field || d.many_collection === e.field) && (d.one_collection === l || d.one_collection == null)
351
349
  );
@@ -358,7 +356,7 @@ function Ie({
358
356
  }
359
357
  })();
360
358
  return /* @__PURE__ */ i(
361
- ue,
359
+ me,
362
360
  {
363
361
  relatedCollection: o.many_collection,
364
362
  manyField: o.many_field,
@@ -368,25 +366,25 @@ function Ie({
368
366
  );
369
367
  }
370
368
  }
371
- if (f.has(u) && c) {
369
+ if (f.has(m) && c) {
372
370
  const o = a.find(
373
- (m) => m.one_collection === l && (m.one_field === e.field || m.junction_field != null && m.many_collection === e.field)
371
+ (u) => u.one_collection === l && (u.one_field === e.field || u.junction_field != null && u.many_collection === e.field)
374
372
  ), d = o ? o.junction_field ? o : (() => {
375
- const m = a.find(
373
+ const u = a.find(
376
374
  (k) => k.many_collection === o.many_collection && k.id !== o.id
377
375
  );
378
- return m ? { ...o, junction_field: m.many_field } : null;
376
+ return u ? { ...o, junction_field: u.many_field } : null;
379
377
  })() : null;
380
378
  if (d) {
381
- const m = oe(e.options);
379
+ const u = oe(e.options);
382
380
  return /* @__PURE__ */ i(
383
- je,
381
+ Me,
384
382
  {
385
383
  relation: d,
386
384
  parentId: c,
387
385
  allRelations: a,
388
386
  staging: r,
389
- maxValues: m == null ? void 0 : m.max_values
387
+ maxValues: u == null ? void 0 : u.max_values
390
388
  }
391
389
  );
392
390
  }
@@ -395,8 +393,8 @@ function Ie({
395
393
  if (p && e.type === "boolean")
396
394
  return /* @__PURE__ */ i("span", { className: "text-slate-700 dark:text-slate-200", children: "No" });
397
395
  if (p) return /* @__PURE__ */ i("span", { className: "text-slate-400 dark:text-slate-500", children: "—" });
398
- if (u === "extension-editorjs" || u === "input-rich-text-html" || u === "rich_text" || u === "wysiwyg" || typeof n == "string") {
399
- const o = He(n, u);
396
+ if (m === "extension-editorjs" || m === "input-rich-text-html" || m === "rich_text" || m === "wysiwyg" || typeof n == "string") {
397
+ const o = We(n, m);
400
398
  if (o !== null)
401
399
  return /* @__PURE__ */ i("span", { className: "truncate text-slate-700 dark:text-slate-200", title: o, children: o || "—" });
402
400
  }
@@ -412,30 +410,30 @@ function Ie({
412
410
  return /* @__PURE__ */ i("span", { className: "text-slate-700 dark:text-slate-200", children: ie(n) });
413
411
  } catch {
414
412
  }
415
- const b = Je(e.options, n);
413
+ const b = He(e.options, n);
416
414
  return /* @__PURE__ */ i("span", { className: "truncate text-slate-700 dark:text-slate-200", children: b ?? String(n) });
417
415
  }
418
- function Je(e, n) {
416
+ function He(e, n) {
419
417
  var c;
420
418
  if (n == null || typeof n == "object") return null;
421
419
  const a = oe(
422
420
  e
423
421
  ), l = (c = a == null ? void 0 : a.choices) == null ? void 0 : c.find((r) => r && String(r.value) === String(n));
424
- return (l == null ? void 0 : l.text) != null ? Ne(l.text) : null;
422
+ return (l == null ? void 0 : l.text) != null ? qe(l.text) : null;
425
423
  }
426
- const Ve = /* @__PURE__ */ new Set([
424
+ const Ue = /* @__PURE__ */ new Set([
427
425
  "extension-editorjs",
428
426
  "input-rich-text-html",
429
427
  "rich_text",
430
428
  "wysiwyg"
431
429
  ]);
432
- function He(e, n) {
430
+ function We(e, n) {
433
431
  if (typeof e != "string") return null;
434
- if (Ve.has(n)) return te(e);
432
+ if (Ue.has(n)) return te(e);
435
433
  const a = e.trim();
436
434
  return a.startsWith("{") && /"blocks"\s*:/.test(a) ? te(e) : null;
437
435
  }
438
- function Ue(e) {
436
+ function Ye(e) {
439
437
  if (e == null || e === "") return "—";
440
438
  if (typeof e == "boolean") return e ? "Yes" : "No";
441
439
  const n = String(e);
@@ -455,13 +453,13 @@ const le = (e) => {
455
453
  return n.length > 48 ? `${n.slice(0, 48)}…` : n;
456
454
  };
457
455
  function ae(e, n) {
458
- const a = U(), l = Se(), c = !!e && n != null && n !== "", { data: r } = $({
456
+ const a = U(), l = we(), c = !!e && n != null && n !== "", { data: r } = $({
459
457
  queryKey: ["cbv-collection-meta", e],
460
- queryFn: () => a.request(L(`/collections/${e}`)).then((p) => p.data),
458
+ queryFn: () => a.request(v(`/collections/${e}`)).then((p) => p.data),
461
459
  enabled: c,
462
460
  staleTime: 10 * 6e4,
463
461
  retry: !1
464
- }), { data: u } = $({
462
+ }), { data: m } = $({
465
463
  queryKey: ["rrv-related", e, String(n)],
466
464
  queryFn: () => l(e, n).catch(() => null),
467
465
  enabled: c && !!r,
@@ -469,26 +467,26 @@ function ae(e, n) {
469
467
  retry: !1
470
468
  });
471
469
  if (!c) return null;
472
- if (!u) return "a linked record";
473
- const f = re(r == null ? void 0 : r.display_template, u).trim();
470
+ if (!m) return "a linked record";
471
+ const f = re(r == null ? void 0 : r.display_template, m).trim();
474
472
  if (f) return f;
475
- for (const p of ["name", "title", "label", "number", "email"]) if (u[p]) return String(u[p]);
473
+ for (const p of ["name", "title", "label", "number", "email"]) if (m[p]) return String(m[p]);
476
474
  return "a linked record";
477
475
  }
478
- function We({
476
+ function Be({
479
477
  field: e,
480
478
  from: n,
481
479
  to: a,
482
480
  detail: l,
483
481
  relations: c,
484
482
  collection: r,
485
- onRevert: u
483
+ onRevert: m
486
484
  }) {
487
485
  var o;
488
486
  const f = ((o = c.find(
489
487
  (d) => d.many_collection === r && d.many_field === e.field && !!d.one_collection
490
488
  )) == null ? void 0 : o.one_collection) ?? null, p = ae(f, n), g = ae(f, a), b = l ? `Unsaved — ${l}` : `Unsaved — was ${p ?? le(n)} → now ${g ?? le(a)}`;
491
- return u ? (
489
+ return m ? (
492
490
  // biome-ignore lint/a11y/useSemanticElements: nested inside the row's <button> — a real <button> is invalid there
493
491
  /* @__PURE__ */ i(
494
492
  "span",
@@ -499,10 +497,10 @@ function We({
499
497
  "data-tip": `${b} · click to revert`,
500
498
  "aria-label": "Revert this change",
501
499
  onClick: (d) => {
502
- d.stopPropagation(), u();
500
+ d.stopPropagation(), m();
503
501
  },
504
502
  onKeyDown: (d) => {
505
- (d.key === "Enter" || d.key === " ") && (d.preventDefault(), d.stopPropagation(), u());
503
+ (d.key === "Enter" || d.key === " ") && (d.preventDefault(), d.stopPropagation(), m());
506
504
  },
507
505
  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",
508
506
  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" })
@@ -517,21 +515,21 @@ function We({
517
515
  }
518
516
  );
519
517
  }
520
- function it({
518
+ function st({
521
519
  allSteps: e,
522
520
  groupedMap: n,
523
521
  ungroupedFields: a,
524
522
  sectionGroups: l,
525
523
  draft: c,
526
524
  relations: r,
527
- collection: u,
525
+ collection: m,
528
526
  itemId: f,
529
527
  staging: p,
530
528
  errors: g,
531
529
  staleFields: b,
532
530
  aliasEmptiness: o,
533
531
  layoutFields: d,
534
- changedFields: m,
532
+ changedFields: u,
535
533
  onRevertChange: k,
536
534
  onFieldClick: E,
537
535
  stagedO2MRows: F,
@@ -541,10 +539,10 @@ function it({
541
539
  ...!e.some((t) => t.key === "__general__") && a.length > 0 ? [{ key: "__general__", label: "General" }] : [],
542
540
  ...e
543
541
  ].map((t) => {
544
- const s = (t.key === "__general__" ? [...a, ...l.flatMap((x) => n[x.key] ?? [])] : n[t.key] ?? []).filter((x) => !x.hidden && !qe.has(x.field) && !Te.has(x.field));
542
+ const s = (t.key === "__general__" ? [...a, ...l.flatMap((x) => n[x.key] ?? [])] : n[t.key] ?? []).filter((x) => !x.hidden && !$e.has(x.field) && !Oe.has(x.field));
545
543
  return { step: t, fields: s };
546
- }).filter((t) => t.fields.length > 0), K = new Set(q.flatMap((t) => t.fields.map((s) => s.field))), T = f && f !== "new" ? r.filter(
547
- (t) => !t.junction_field && t.many_field && t.many_collection && (t.one_collection === u || t.one_collection == null) && t.one_field != null && !K.has(t.one_field) && // Off-layout aliases stay out — the sidebar summarizes THIS layout.
544
+ }).filter((t) => t.fields.length > 0), D = new Set(q.flatMap((t) => t.fields.map((s) => s.field))), T = f && f !== "new" ? r.filter(
545
+ (t) => !t.junction_field && t.many_field && t.many_collection && (t.one_collection === m || t.one_collection == null) && t.one_field != null && !D.has(t.one_field) && // Off-layout aliases stay out — the sidebar summarizes THIS layout.
548
546
  (!d || d.has(t.one_field))
549
547
  ) : [];
550
548
  return q.length === 0 && T.length === 0 ? null : /* @__PURE__ */ i(ce.Provider, { value: { rows: F, deletes: I }, children: /* @__PURE__ */ h("div", { className: "overflow-hidden bg-white dark:bg-card", children: [
@@ -553,7 +551,7 @@ function it({
553
551
  /* @__PURE__ */ i(
554
552
  "div",
555
553
  {
556
- className: v(
554
+ className: C(
557
555
  "bg-slate-100 px-4 py-2 border-b border-slate-200 dark:bg-white/[0.06] dark:border-border/80",
558
556
  x > 0 && "border-t border-slate-200 dark:border-border/80"
559
557
  ),
@@ -561,11 +559,11 @@ function it({
561
559
  }
562
560
  ),
563
561
  s.map((y, P) => {
564
- const N = c[y.field], M = y.label ?? ee(y.field), A = !!(g != null && g[y.field]), J = o == null ? void 0 : o[y.field], me = J !== void 0 ? J === !0 : N == null || typeof N == "string" && N.trim() === "" || Array.isArray(N) && N.length === 0, fe = J === null, W = !!y.required && me && !A && !fe, Y = (b == null ? void 0 : b.has(y.field)) ?? !1;
562
+ const N = c[y.field], L = y.label ?? ee(y.field), A = !!(g != null && g[y.field]), J = o == null ? void 0 : o[y.field], ue = J !== void 0 ? J === !0 : N == null || typeof N == "string" && N.trim() === "" || Array.isArray(N) && N.length === 0, fe = J === null, W = !!y.required && ue && !A && !fe, Y = (b == null ? void 0 : b.has(y.field)) ?? !1;
565
563
  return /* @__PURE__ */ h(
566
564
  "div",
567
565
  {
568
- className: v(
566
+ className: C(
569
567
  "group/row flex items-stretch",
570
568
  P < s.length - 1 && "border-b border-slate-100 dark:border-border/60",
571
569
  A ? "bg-red-50 dark:bg-red-900/10" : W || Y ? "bg-amber-50/70 dark:bg-amber-900/10" : ""
@@ -576,7 +574,7 @@ function it({
576
574
  {
577
575
  type: "button",
578
576
  onClick: () => E(t.key, y.field),
579
- className: v(
577
+ className: C(
580
578
  "flex flex-1 flex-col px-4 py-2 text-left transition-colors duration-150 min-w-0",
581
579
  A ? "hover:bg-red-50 dark:hover:bg-red-900/15" : "hover:bg-slate-50 dark:hover:bg-white/[0.03]"
582
580
  ),
@@ -584,21 +582,21 @@ function it({
584
582
  /* @__PURE__ */ h(
585
583
  "span",
586
584
  {
587
- className: v(
585
+ className: C(
588
586
  "flex items-center gap-1 text-[10px] font-medium truncate",
589
587
  A ? "text-red-500 dark:text-red-400" : W || Y ? "text-amber-700 dark:text-amber-400" : "text-slate-400 dark:text-slate-500"
590
588
  ),
591
589
  children: [
592
- /* @__PURE__ */ i("span", { className: "truncate", children: M }),
593
- (m == null ? void 0 : m[y.field]) && /* @__PURE__ */ i(
594
- We,
590
+ /* @__PURE__ */ i("span", { className: "truncate", children: L }),
591
+ (u == null ? void 0 : u[y.field]) && /* @__PURE__ */ i(
592
+ Be,
595
593
  {
596
594
  field: y,
597
- from: m[y.field].from,
598
- detail: m[y.field].detail,
595
+ from: u[y.field].from,
596
+ detail: u[y.field].detail,
599
597
  to: N,
600
598
  relations: r,
601
- collection: u,
599
+ collection: m,
602
600
  onRevert: k ? () => k(y.field) : void 0
603
601
  }
604
602
  ),
@@ -622,12 +620,12 @@ function it({
622
620
  },
623
621
  className: "mt-0.5 w-full text-[12px] min-w-0 overflow-hidden",
624
622
  children: /* @__PURE__ */ i(
625
- Fe,
623
+ Je,
626
624
  {
627
625
  field: y,
628
626
  val: N,
629
627
  relations: r,
630
- collection: u,
628
+ collection: m,
631
629
  itemId: f,
632
630
  staging: p
633
631
  }
@@ -645,14 +643,14 @@ function it({
645
643
  onClick: (B) => {
646
644
  var G, Q;
647
645
  B.stopPropagation();
648
- const ye = ((Q = (G = j.current.get(y.field)) == null ? void 0 : G.textContent) == null ? void 0 : Q.trim()) ?? Ue(N);
646
+ const ye = ((Q = (G = j.current.get(y.field)) == null ? void 0 : G.textContent) == null ? void 0 : Q.trim()) ?? Ye(N);
649
647
  navigator.clipboard.writeText(ye).catch(() => {
650
648
  }), w(y.field), setTimeout(
651
649
  () => w((z) => z === y.field ? null : z),
652
650
  1500
653
651
  );
654
652
  },
655
- className: v(
653
+ className: C(
656
654
  "flex items-center px-2 opacity-0 group-hover/row:opacity-100 transition-all duration-150",
657
655
  O === y.field ? "text-emerald-500" : "text-slate-400 hover:text-slate-600 dark:text-slate-500 dark:hover:text-slate-300"
658
656
  ),
@@ -672,7 +670,7 @@ function it({
672
670
  return /* @__PURE__ */ i(
673
671
  "div",
674
672
  {
675
- className: v(
673
+ className: C(
676
674
  "flex items-stretch",
677
675
  s < T.length - 1 && "border-b border-slate-100 dark:border-border/60"
678
676
  ),
@@ -682,13 +680,13 @@ function it({
682
680
  type: "button",
683
681
  onClick: () => {
684
682
  var A;
685
- const P = t.many_collection ?? "", N = /(^|_)(notes?|comments?)$/i.test(P), M = document.querySelector(`[data-o2m-collection="${P}"]`) ?? (N ? document.querySelector('[data-panel="notes"]') : null);
686
- if (!M) {
683
+ const P = t.many_collection ?? "", N = /(^|_)(notes?|comments?)$/i.test(P), L = document.querySelector(`[data-o2m-collection="${P}"]`) ?? (N ? document.querySelector('[data-panel="notes"]') : null);
684
+ if (!L) {
687
685
  S((J) => J === x ? null : x);
688
686
  return;
689
687
  }
690
- M.getAttribute("data-panel-expanded") === "false" && ((A = M.querySelector("[data-panel-toggle]")) == null || A.click()), M.scrollIntoView({ behavior: "smooth", block: "center" }), M.classList.add("ring-2", "ring-nvr-cyan", "ring-offset-2", "rounded-md"), setTimeout(
691
- () => M.classList.remove(
688
+ L.getAttribute("data-panel-expanded") === "false" && ((A = L.querySelector("[data-panel-toggle]")) == null || A.click()), L.scrollIntoView({ behavior: "smooth", block: "center" }), L.classList.add("ring-2", "ring-nvr-cyan", "ring-offset-2", "rounded-md"), setTimeout(
689
+ () => L.classList.remove(
692
690
  "ring-2",
693
691
  "ring-nvr-cyan",
694
692
  "ring-offset-2",
@@ -703,7 +701,7 @@ function it({
703
701
  /* @__PURE__ */ i(
704
702
  xe,
705
703
  {
706
- className: v(
704
+ className: C(
707
705
  "h-3 w-3 shrink-0 transition-transform",
708
706
  y && "rotate-90"
709
707
  )
@@ -712,7 +710,7 @@ function it({
712
710
  ee(t.one_field ?? t.many_collection ?? "")
713
711
  ] }),
714
712
  /* @__PURE__ */ i("span", { className: "mt-0.5 text-[12px]", children: /* @__PURE__ */ i(
715
- ue,
713
+ me,
716
714
  {
717
715
  relatedCollection: t.many_collection ?? "",
718
716
  manyField: t.many_field,
@@ -731,15 +729,15 @@ function it({
731
729
  ] }) });
732
730
  }
733
731
  export {
734
- je as M2MSummaryCount,
732
+ Me as M2MSummaryCount,
735
733
  X as M2OSummaryValue,
736
- Fe as SummaryFieldValue,
737
- it as SummaryPanel,
738
- ve as o2mAmountOf,
739
- Pe as o2mItemRelation,
740
- Ee as o2mRowLabel,
741
- Je as summaryChoiceLabel,
742
- He as summaryPlainText,
743
- Re as templateRelationPaths,
744
- De as withTemplateRelations
734
+ Je as SummaryFieldValue,
735
+ st as SummaryPanel,
736
+ Re as o2mAmountOf,
737
+ Ie as o2mItemRelation,
738
+ Ke as o2mRowLabel,
739
+ He as summaryChoiceLabel,
740
+ We as summaryPlainText,
741
+ De as templateRelationPaths,
742
+ Ae as withTemplateRelations
745
743
  };