@nivaro/react 0.3.53 → 0.3.54

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