@nivaro/react 0.3.143 → 0.3.145

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,42 +1,42 @@
1
- import { jsx as t, jsxs as p, Fragment as me } from "react/jsx-runtime";
2
- import { useQuery as H, useQueryClient as _t } from "@tanstack/react-query";
3
- import { Pencil as Ut, ChevronDown as Ht } from "lucide-react";
4
- import { useMemo as ke, useRef as Ye, useState as U, useEffect as fe, useCallback as bt, Fragment as Vt } from "react";
5
- import { DrilldownContext as Gt, useNivaroClient as we, useApiFetchConfig as Jt, useDrilldown as kt } from "../context.js";
6
- import { useDebounced as Qt } from "../hooks/useDebounced.js";
7
- import { parseAllowedCollections as zt } from "../lib/allowed-collections.js";
8
- import { get as z, patch as Yt } from "../lib/commands.js";
9
- import { toastError as Xt } from "../lib/error-toast.js";
10
- import { readGroupStructure as Zt, isFolded as el, isEmptyValue as ve, planFieldGrid as tl } from "../lib/form-structure.js";
11
- import { quietHiddenSectionsOf as ll } from "../lib/layout-resolve.js";
12
- import { useLiveRecord as rl } from "../lib/live.js";
13
- import { formatCurrency as wt, formatFieldNumber as Nt, formatGrouped as nl } from "../lib/number-format.js";
14
- import { isDisplayFormulaField as Le, resolvePlacementText as al, displayFormulaOf as il, formatDisplayValue as sl } from "../lib/placement-behaviour.js";
15
- import { invalidateRecordRow as dl, useRecordReader as ol } from "../lib/record-loader.js";
16
- import { sanitizeHtml as cl } from "../lib/sanitize-html.js";
17
- import { titleCase as Xe, formatRelative as je } from "../lib/utils.js";
18
- import { matchesVisibleWhen as ul } from "../lib/visible-when.js";
19
- import { InboundRequestPopover as ml } from "./integrations/InboundRequest.js";
20
- import { FileM2MField as fl } from "./item-edit/FilePickerField.js";
21
- import { useFieldTouches as pl } from "./item-edit/HeaderFreshness.js";
22
- import { richTextToPlain as hl } from "./item-edit/helpers.js";
23
- import { isNamelessLabel as bl, NAMELESS_LABEL as gl } from "./item-edit/option-disambiguate.js";
1
+ import { jsx as t, jsxs as b, Fragment as me } from "react/jsx-runtime";
2
+ import { useQuery as V, useQueryClient as wt } from "@tanstack/react-query";
3
+ import { Pencil as Vt, ChevronDown as Gt } from "lucide-react";
4
+ import { useMemo as ke, useRef as Xe, useState as U, useEffect as fe, useCallback as bt, Fragment as Jt } from "react";
5
+ import { DrilldownContext as Qt, useNivaroClient as we, useApiFetchConfig as zt, useDrilldown as Nt } from "../context.js";
6
+ import { useDebounced as Yt } from "../hooks/useDebounced.js";
7
+ import { parseAllowedCollections as Xt } from "../lib/allowed-collections.js";
8
+ import { get as z, patch as Zt } from "../lib/commands.js";
9
+ import { toastError as el } from "../lib/error-toast.js";
10
+ import { readGroupStructure as tl, isFolded as ll, isEmptyValue as ve, planFieldGrid as rl } from "../lib/form-structure.js";
11
+ import { quietHiddenSectionsOf as nl } from "../lib/layout-resolve.js";
12
+ import { useLiveRecord as al } from "../lib/live.js";
13
+ import { formatCurrency as St, formatFieldNumber as $t, formatGrouped as il } from "../lib/number-format.js";
14
+ import { isDisplayFormulaField as Le, resolvePlacementText as sl, displayFormulaOf as dl, formatDisplayValue as ol } from "../lib/placement-behaviour.js";
15
+ import { invalidateRecordRow as cl, useRecordReader as ul } from "../lib/record-loader.js";
16
+ import { sanitizeHtml as ml } from "../lib/sanitize-html.js";
17
+ import { titleCase as Ze, formatRelative as Be } from "../lib/utils.js";
18
+ import { matchesVisibleWhen as fl } from "../lib/visible-when.js";
19
+ import { InboundRequestPopover as pl } from "./integrations/InboundRequest.js";
20
+ import { FileM2MField as hl } from "./item-edit/FilePickerField.js";
21
+ import { useFieldTouches as bl } from "./item-edit/HeaderFreshness.js";
22
+ import { richTextToPlain as gl } from "./item-edit/helpers.js";
23
+ import { isNamelessLabel as yl, NAMELESS_LABEL as xl } from "./item-edit/option-disambiguate.js";
24
24
  import { PersonalDefaultMark as gt } from "./item-edit/PersonalDefaultControl.js";
25
- import { usePlacementTextContext as yl, evaluateDisplayFormula as xl } from "./item-edit/placement-behaviour.js";
26
- import { RuleHiddenNotes as vl } from "./item-edit/RuleHiddenNotes.js";
27
- import { RELATED_LOADING_CLASS as _l, RelatedMissingLabel as kl } from "./item-edit/related-missing.js";
28
- import { ruleHiddenGroups as wl, groupHasReadableField as Nl } from "./item-edit/rule-hidden.js";
29
- import { UserChip as St } from "./item-edit/UserChip.js";
30
- import { DesignNode as Sl } from "./layout-editor/DesignNode.js";
31
- import { DesignCanvas as $l } from "./layout-editor/design-canvas.js";
32
- import { revealGroupKey as Fl } from "./layout-editor/design-context.js";
33
- import { choiceLabelsFrom as ql } from "./layout-editor/overview/describe-conditions.js";
34
- import { useRecordIntegrity as Rl, integrityByField as Al } from "./panels/RecordIntegrityBanner.js";
35
- import { RecordHoverCard as Ze } from "./RecordHoverCard.js";
36
- import { RelativeTime as Cl } from "./RelativeTime.js";
25
+ import { usePlacementTextContext as vl, evaluateDisplayFormula as _l } from "./item-edit/placement-behaviour.js";
26
+ import { RuleHiddenNotes as kl } from "./item-edit/RuleHiddenNotes.js";
27
+ import { RELATED_LOADING_CLASS as wl, RelatedMissingLabel as Nl } from "./item-edit/related-missing.js";
28
+ import { ruleHiddenGroups as Sl, groupHasReadableField as $l } from "./item-edit/rule-hidden.js";
29
+ import { UserChip as Ft } from "./item-edit/UserChip.js";
30
+ import { DesignNode as Fl } from "./layout-editor/DesignNode.js";
31
+ import { DesignCanvas as ql } from "./layout-editor/design-canvas.js";
32
+ import { revealGroupKey as Rl } from "./layout-editor/design-context.js";
33
+ import { choiceLabelsFrom as Ol } from "./layout-editor/overview/describe-conditions.js";
34
+ import { useRecordIntegrity as Al, integrityByField as Cl } from "./panels/RecordIntegrityBanner.js";
35
+ import { RecordHoverCard as et } from "./RecordHoverCard.js";
36
+ import { RelativeTime as Tl } from "./RelativeTime.js";
37
37
  import { SimpleSelectXs as yt } from "./ui/SimpleSelect.js";
38
- import { WidgetSlot as Ol } from "./WidgetSlot.js";
39
- import { numberCurrencyOf as $t, numberKindOf as et } from "../lib/number-kind.js";
38
+ import { WidgetSlot as Ll } from "./WidgetSlot.js";
39
+ import { numberCurrencyOf as qt, numberKindOf as tt } from "../lib/number-kind.js";
40
40
  const _e = (a) => {
41
41
  if (!a) return {};
42
42
  if (typeof a == "object") return a;
@@ -45,72 +45,125 @@ const _e = (a) => {
45
45
  } catch {
46
46
  return {};
47
47
  }
48
- }, Tl = 3;
49
- function Ll(a) {
50
- let u = a;
51
- if (typeof u == "string")
48
+ }, Dl = 3;
49
+ function El(a) {
50
+ let o = a;
51
+ if (typeof o == "string")
52
52
  try {
53
- u = JSON.parse(u);
53
+ o = JSON.parse(o);
54
54
  } catch {
55
- u = u ? u.split(",").map((i) => i.trim()) : [];
55
+ o = o ? o.split(",").map((i) => i.trim()) : [];
56
56
  }
57
- if (!Array.isArray(u)) return [];
58
- const h = [];
59
- for (const i of u)
60
- if (typeof i == "string" && i) h.push({ field: i, label: null });
57
+ if (!Array.isArray(o)) return [];
58
+ const m = [];
59
+ for (const i of o)
60
+ if (typeof i == "string" && i) m.push({ field: i, label: null });
61
61
  else if (i && typeof i == "object" && typeof i.field == "string") {
62
- const N = i.label;
63
- h.push({
62
+ const w = i.label;
63
+ m.push({
64
64
  field: i.field,
65
- label: typeof N == "string" && N.trim() ? N.trim() : null
65
+ label: typeof w == "string" && w.trim() ? w.trim() : null
66
66
  });
67
67
  }
68
- return h.filter((i) => !i.field.startsWith("__"));
68
+ return m.filter((i) => !i.field.startsWith("__"));
69
69
  }
70
- const Ft = (a) => {
71
- const u = String(a).match(/^(\d{4})-(\d{2})-(\d{2})(?:[T ]00:00:00(?:\.0+)?(?:Z|[+-]00:?00)?)?$/);
72
- if (u) return `${u[2]}/${u[3]}/${u[1]}`;
73
- const h = new Date(String(a));
74
- return Number.isNaN(h.getTime()) ? String(a) : `${String(h.getMonth() + 1).padStart(2, "0")}/${String(h.getDate()).padStart(2, "0")}/${h.getFullYear()}`;
75
- }, El = (a) => {
76
- const u = Number(a);
77
- return Number.isNaN(u) ? String(a) : u.toLocaleString("en-US");
78
- }, tt = "text-[11.5px] font-medium text-slate-500 dark:text-slate-400", xt = `${tt} flex min-w-0 items-center whitespace-nowrap`;
79
- function Dl({ name: a, at: u }) {
80
- const h = Ye(null), [i, N] = U(!1), _ = Ye(0);
70
+ const Rt = (a) => {
71
+ const o = String(a).match(/^(\d{4})-(\d{2})-(\d{2})(?:[T ]00:00:00(?:\.0+)?(?:Z|[+-]00:?00)?)?$/);
72
+ if (o) return `${o[2]}/${o[3]}/${o[1]}`;
73
+ const m = new Date(String(a));
74
+ return Number.isNaN(m.getTime()) ? String(a) : `${String(m.getMonth() + 1).padStart(2, "0")}/${String(m.getDate()).padStart(2, "0")}/${m.getFullYear()}`;
75
+ }, Ml = (a) => {
76
+ const o = Number(a);
77
+ return Number.isNaN(o) ? String(a) : o.toLocaleString("en-US");
78
+ }, lt = "text-[11.5px] font-medium text-slate-500 dark:text-slate-400", xt = `${lt} flex min-w-0 items-center whitespace-nowrap`;
79
+ function Pl({ name: a, at: o }) {
80
+ const m = Xe(null), [i, w] = U(!1), y = Xe(0);
81
81
  return fe(() => {
82
- const x = h.current, S = x == null ? void 0 : x.parentElement, w = S == null ? void 0 : S.parentElement;
83
- if (!x || !S || !w || typeof ResizeObserver > "u") return;
84
- const m = () => {
82
+ const h = m.current, g = h == null ? void 0 : h.parentElement, k = g == null ? void 0 : g.parentElement;
83
+ if (!h || !g || !k || typeof ResizeObserver > "u") return;
84
+ const f = () => {
85
85
  if (!i) {
86
- const T = x.scrollWidth - x.clientWidth;
87
- T > 0.5 && (_.current = S.getBoundingClientRect().width + T, N(!0));
86
+ const T = h.scrollWidth - h.clientWidth;
87
+ T > 0.5 && (y.current = g.getBoundingClientRect().width + T, w(!0));
88
88
  return;
89
89
  }
90
- const F = w.getBoundingClientRect().right - S.getBoundingClientRect().left;
91
- _.current && F >= _.current + 1 && N(!1);
90
+ const S = k.getBoundingClientRect().right - g.getBoundingClientRect().left;
91
+ y.current && S >= y.current + 1 && w(!1);
92
92
  };
93
- m();
94
- const C = new ResizeObserver(m);
95
- return C.observe(w), () => C.disconnect();
96
- }, [i]), /* @__PURE__ */ p(
93
+ f();
94
+ const A = new ResizeObserver(f);
95
+ return A.observe(k), () => A.disconnect();
96
+ }, [i]), /* @__PURE__ */ b(
97
97
  "span",
98
98
  {
99
- ref: h,
99
+ ref: m,
100
100
  "data-field-touch-text": !0,
101
101
  "data-short": i || void 0,
102
102
  className: "min-w-0 truncate",
103
103
  children: [
104
104
  a,
105
- !i && /* @__PURE__ */ p(me, { children: [
105
+ !i && /* @__PURE__ */ b(me, { children: [
106
106
  " · ",
107
- /* @__PURE__ */ t(Cl, { value: u })
107
+ /* @__PURE__ */ t(Tl, { value: o })
108
108
  ] })
109
109
  ]
110
110
  }
111
111
  );
112
112
  }
113
- const le = () => /* @__PURE__ */ t("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }), Pl = `
113
+ const le = () => /* @__PURE__ */ t("span", { className: "text-slate-300 dark:text-slate-600", children: "—" });
114
+ function vt(a) {
115
+ const o = a.dataset.readWidth;
116
+ return o === "half" ? 3 : o === "third" ? 2 : 6;
117
+ }
118
+ function Wl(a) {
119
+ const o = [...a.children].filter(
120
+ (h) => h instanceof HTMLElement && h.dataset.readWidth != null
121
+ );
122
+ for (const h of o) {
123
+ h.style.gridColumn = "";
124
+ const g = h.querySelector("[data-read-dl]");
125
+ g != null && g.dataset.readDlOwn && (g.dataset.readDl = g.dataset.readDlOwn);
126
+ }
127
+ if (getComputedStyle(a).gridTemplateColumns.split(" ").filter(Boolean).length < 6) return;
128
+ let i = [], w = 0;
129
+ const y = () => {
130
+ const h = i[i.length - 1];
131
+ if (h && w < 6) {
132
+ const g = vt(h) + 6 - w;
133
+ h.style.gridColumn = `span ${g} / span ${g}`;
134
+ const k = h.querySelector("[data-read-dl]");
135
+ k && g === 6 && k.dataset.readDl !== "full" && (k.dataset.readDlOwn = k.dataset.readDl ?? "", k.dataset.readDl = "full");
136
+ }
137
+ i = [], w = 0;
138
+ };
139
+ for (const h of o) {
140
+ if (h.hidden) continue;
141
+ const g = vt(h);
142
+ w + g > 6 && y(), i.push(h), w += g;
143
+ }
144
+ y();
145
+ }
146
+ function Kl(a) {
147
+ if (!a) return;
148
+ const o = () => Wl(a);
149
+ o();
150
+ const m = typeof ResizeObserver > "u" ? null : new ResizeObserver(o);
151
+ m == null || m.observe(a);
152
+ const i = typeof MutationObserver > "u" ? null : new MutationObserver(o);
153
+ return i == null || i.observe(a, {
154
+ childList: !0,
155
+ subtree: !0,
156
+ attributes: !0,
157
+ attributeFilter: ["hidden", "data-read-width"]
158
+ }), () => {
159
+ m == null || m.disconnect(), i == null || i.disconnect();
160
+ };
161
+ }
162
+ const Bl = 10;
163
+ function jl(a) {
164
+ return a == null ? !0 : String(a).replace(/<[^>]*>/g, "").replace(/&nbsp;/g, " ").trim() === "";
165
+ }
166
+ const Il = `
114
167
  [data-read-board]{grid-template-columns:minmax(0,1fr)}
115
168
  [data-read-dl]{grid-template-columns:repeat(2,minmax(0,1fr))}
116
169
  @media (min-width:640px){[data-read-dl="full"]{grid-template-columns:repeat(3,minmax(0,1fr))}}
@@ -125,49 +178,61 @@ const le = () => /* @__PURE__ */ t("span", { className: "text-slate-300 dark:tex
125
178
  }
126
179
  @media (min-width:1536px){[data-read-dl="full"]{grid-template-columns:repeat(6,minmax(0,1fr))}}
127
180
  `;
128
- function Be({
181
+ function je({
129
182
  value: a,
130
- trueTone: u = "positive"
183
+ trueTone: o = "positive"
131
184
  }) {
132
- const h = a === !0 || a === 1 || a === "1" || a === "true";
185
+ const m = a === !0 || a === 1 || a === "1" || a === "true";
133
186
  return /* @__PURE__ */ t(
134
187
  "span",
135
188
  {
136
- className: `inline-flex h-[18px] items-center rounded-full px-1.5 text-[10.5px] font-semibold ${h ? u === "danger" ? "bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-400" : "bg-emerald-100 text-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-400" : "bg-slate-100 text-slate-500 dark:bg-slate-800 dark:text-slate-400"}`,
137
- children: h ? "Yes" : "No"
189
+ className: `inline-flex h-[18px] items-center rounded-full px-1.5 text-[10.5px] font-semibold ${m ? o === "danger" ? "bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-400" : "bg-emerald-100 text-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-400" : "bg-slate-100 text-slate-500 dark:bg-slate-800 dark:text-slate-400"}`,
190
+ children: m ? "Yes" : "No"
138
191
  }
139
192
  );
140
193
  }
141
- function Kl({ collection: a, id: u }) {
142
- const h = we(), i = ol(), N = kt(), { data: _ } = H({
194
+ function _t(a) {
195
+ if (!a) return "";
196
+ const o = /* @__PURE__ */ new Set();
197
+ for (const m of a.matchAll(/\{\{\s*([\w.]+)\s*\}\}/g))
198
+ m[1].includes(".") && o.add(m[1]);
199
+ return [...o].join(",");
200
+ }
201
+ function Hl({ collection: a, id: o }) {
202
+ const m = we(), i = ul(), w = Nt(), { data: y } = V({
143
203
  queryKey: ["cbv-collection-meta", a],
144
- queryFn: () => h.request(
204
+ queryFn: () => m.request(
145
205
  z(`/collections/${a}`)
146
- ).then((F) => F.data).catch(() => ({ display_template: null, fields: [] })),
206
+ ).then((S) => S.data).catch(() => ({ display_template: null, fields: [] })),
147
207
  staleTime: 10 * 6e4,
148
208
  retry: !1
149
209
  }), {
150
- data: x,
151
- isPending: S,
152
- error: w
153
- } = H({
154
- queryKey: ["rrv-related", a, String(u)],
155
- queryFn: () => i(a, u),
156
- enabled: u != null && !!_,
210
+ data: h,
211
+ isPending: g,
212
+ error: k
213
+ } = V({
214
+ // A template that names a linked record's field ({{core_category.name}}) needs that
215
+ // field read through the link; the plain row only holds the link's id.
216
+ queryKey: ["rrv-related", a, String(o), _t(y == null ? void 0 : y.display_template)],
217
+ queryFn: () => {
218
+ const S = _t(y == null ? void 0 : y.display_template);
219
+ return i(a, o, S ? ["*", ...S.split(",")] : null);
220
+ },
221
+ enabled: o != null && !!y,
157
222
  staleTime: 6e4,
158
223
  retry: !1
159
224
  });
160
- if (u == null) return /* @__PURE__ */ t(le, {});
161
- if (!x && !w && (S || !_))
162
- return /* @__PURE__ */ t("span", { className: _l });
163
- if (!x) return /* @__PURE__ */ t(kl, { error: w, collection: a, id: u });
164
- let m = "";
165
- const C = _ == null ? void 0 : _.display_template;
166
- if (C && (m = C.replace(/\{\{\s*([^}]+?)\s*\}\}/g, (F, T) => {
167
- const q = T.split(".").reduce((v, g) => v == null ? void 0 : v[g], x);
225
+ if (o == null) return /* @__PURE__ */ t(le, {});
226
+ if (!h && !k && (g || !y))
227
+ return /* @__PURE__ */ t("span", { className: wl });
228
+ if (!h) return /* @__PURE__ */ t(Nl, { error: k, collection: a, id: o });
229
+ let f = "";
230
+ const A = y == null ? void 0 : y.display_template;
231
+ if (A && (f = A.replace(/\{\{\s*([^}]+?)\s*\}\}/g, (S, T) => {
232
+ const q = T.split(".").reduce((N, v) => N == null ? void 0 : N[v], h);
168
233
  return q == null ? "" : String(q);
169
- }).trim()), !m) {
170
- for (const F of [
234
+ }).trim()), !f) {
235
+ for (const S of [
171
236
  "name",
172
237
  "title",
173
238
  "label",
@@ -177,65 +242,65 @@ function Kl({ collection: a, id: u }) {
177
242
  "filename_download",
178
243
  "filename"
179
244
  ])
180
- if (x[F]) {
181
- m = String(x[F]);
245
+ if (h[S]) {
246
+ f = String(h[S]);
182
247
  break;
183
248
  }
184
249
  }
185
- return bl(m) && (m = gl), N ? /* @__PURE__ */ t(Ze, { collection: a, id: u, children: /* @__PURE__ */ t(
250
+ return yl(f) && (f = xl), w ? /* @__PURE__ */ t(et, { collection: a, id: o, children: /* @__PURE__ */ t(
186
251
  "button",
187
252
  {
188
253
  type: "button",
189
- onClick: () => N.open({ collection: a, itemId: String(u) }),
254
+ onClick: () => w.open({ collection: a, itemId: String(o) }),
190
255
  className: "inline-block max-w-full truncate text-left align-bottom underline decoration-slate-300 underline-offset-2 transition-colors hover:text-[#007a99] hover:decoration-[#007a99] dark:decoration-slate-600 dark:hover:text-nvr-cyan dark:hover:decoration-nvr-cyan",
191
- children: m
256
+ children: f
192
257
  }
193
- ) }) : /* @__PURE__ */ t(Ze, { collection: a, id: u, children: m });
258
+ ) }) : /* @__PURE__ */ t(et, { collection: a, id: o, children: f });
194
259
  }
195
- function Wl({ id: a }) {
196
- const u = we(), { apiBase: h } = Jt(), { data: i, isPending: N } = H({
260
+ function Ul({ id: a }) {
261
+ const o = we(), { apiBase: m } = zt(), { data: i, isPending: w } = V({
197
262
  queryKey: ["rrv-file-meta", String(a)],
198
- queryFn: () => u.request(
263
+ queryFn: () => o.request(
199
264
  z(`/files/${a}/meta`)
200
- ).then((x) => x.data).catch(() => null),
265
+ ).then((h) => h.data).catch(() => null),
201
266
  enabled: a != null,
202
267
  staleTime: 5 * 6e4,
203
268
  retry: !1
204
269
  });
205
270
  if (a == null) return /* @__PURE__ */ t(le, {});
206
- if (!i && N)
271
+ if (!i && w)
207
272
  return /* @__PURE__ */ t("span", { className: "inline-block h-3.5 w-24 animate-pulse rounded bg-slate-100 align-middle dark:bg-[hsl(var(--nvr-skeleton))]" });
208
- const _ = (i == null ? void 0 : i.title) || (i == null ? void 0 : i.filename_download) || `#${String(a)}`;
273
+ const y = (i == null ? void 0 : i.title) || (i == null ? void 0 : i.filename_download) || `#${String(a)}`;
209
274
  return /* @__PURE__ */ t(
210
275
  "a",
211
276
  {
212
- href: `${h}/files/${a}`,
277
+ href: `${m}/files/${a}`,
213
278
  target: "_blank",
214
279
  rel: "noreferrer",
215
280
  className: "underline decoration-slate-300 underline-offset-2 transition-colors hover:text-[#007a99] hover:decoration-[#007a99] dark:decoration-slate-600 dark:hover:text-nvr-cyan dark:hover:decoration-nvr-cyan",
216
- children: _
281
+ children: y
217
282
  }
218
283
  );
219
284
  }
220
- const lt = ({ collection: a, id: u }) => a === "nivaro_files" ? /* @__PURE__ */ t(Wl, { id: u }) : /* @__PURE__ */ t(Kl, { collection: a, id: u });
221
- function Ml({
285
+ const rt = ({ collection: a, id: o }) => a === "nivaro_files" ? /* @__PURE__ */ t(Ul, { id: o }) : /* @__PURE__ */ t(Hl, { collection: a, id: o });
286
+ function Vl({
222
287
  junction: a,
223
- parentFk: u,
224
- junctionField: h,
288
+ parentFk: o,
289
+ junctionField: m,
225
290
  parentId: i,
226
- onCount: N,
227
- onTarget: _,
228
- relation: x
291
+ onCount: w,
292
+ onTarget: y,
293
+ relation: h
229
294
  }) {
230
- var j;
231
- const S = we(), { data: w } = H({
295
+ var B;
296
+ const g = we(), { data: k } = V({
232
297
  queryKey: ["cbv-collection-meta", a],
233
- queryFn: () => S.request(z(`/collections/${a}`)).then((k) => k.data),
298
+ queryFn: () => g.request(z(`/collections/${a}`)).then(($) => $.data),
234
299
  staleTime: 10 * 6e4,
235
300
  retry: !1
236
- }), m = ((w == null ? void 0 : w.relations) ?? []).find(
237
- (k) => k.many_collection === a && k.many_field === h
238
- ), C = zt(m == null ? void 0 : m.one_allowed_collections), F = !!m && !m.one_collection && (C.length > 0 || !!m.one_collection_field), T = (m == null ? void 0 : m.one_collection_field) ?? "collection", q = (k) => k ? k === "directus_users" ? "nivaro_users" : k : null, v = (m == null ? void 0 : m.one_collection) ?? (F ? C.some((k) => k === "directus_users" || k === "nivaro_users") ? "nivaro_users" : q(C[0]) : null), { data: g } = H({
301
+ }), f = ((k == null ? void 0 : k.relations) ?? []).find(
302
+ ($) => $.many_collection === a && $.many_field === m
303
+ ), A = Xt(f == null ? void 0 : f.one_allowed_collections), S = !!f && !f.one_collection && (A.length > 0 || !!f.one_collection_field), T = (f == null ? void 0 : f.one_collection_field) ?? "collection", q = ($) => $ ? $ === "directus_users" ? "nivaro_users" : $ : null, N = (f == null ? void 0 : f.one_collection) ?? (S ? A.some(($) => $ === "directus_users" || $ === "nivaro_users") ? "nivaro_users" : q(A[0]) : null), { data: v } = V({
239
304
  // Under the edit form's ['m2m-items', junction, parentFk, parentId] prefix (a longer key,
240
305
  // so never the same cache entry): every link write that refreshes the form's list —
241
306
  // a file upload, a picker change, the save itself — refreshes Summary's too. Its own
@@ -243,89 +308,89 @@ function Ml({
243
308
  queryKey: [
244
309
  "m2m-items",
245
310
  a,
246
- u,
311
+ o,
247
312
  i,
248
313
  "rrv",
249
- h,
250
- F ? T : ""
314
+ m,
315
+ S ? T : ""
251
316
  ],
252
- queryFn: () => S.request(
317
+ queryFn: () => g.request(
253
318
  z(`/items/${a}`, {
254
- filter: JSON.stringify({ [u]: { _eq: i } }),
255
- fields: F ? `id,${h},${T}` : `id,${h}`,
319
+ filter: JSON.stringify({ [o]: { _eq: i } }),
320
+ fields: S ? `id,${m},${T}` : `id,${m}`,
256
321
  limit: 200
257
322
  })
258
323
  ).then(
259
- (k) => (k.data ?? []).filter(($) => $[h] != null).map(($) => {
260
- const A = $[h];
324
+ ($) => ($.data ?? []).filter((F) => F[m] != null).map((F) => {
325
+ const O = F[m];
261
326
  return {
262
- id: String(typeof A == "object" ? A.id : A),
263
- collection: F ? q($[T]) : null
327
+ id: String(typeof O == "object" ? O.id : O),
328
+ collection: S ? q(F[T]) : null
264
329
  };
265
330
  })
266
331
  ).catch(() => []),
267
332
  // The fields list depends on the companion leg — wait for it.
268
- enabled: !!w,
333
+ enabled: !!k,
269
334
  staleTime: 3e4,
270
335
  retry: !1
271
- }), E = g == null ? void 0 : g.map((k) => k.id), R = v ?? (F ? ((j = g == null ? void 0 : g.find((k) => k.collection)) == null ? void 0 : j.collection) ?? null : null), D = E == null ? void 0 : E.length;
336
+ }), D = v == null ? void 0 : v.map(($) => $.id), R = N ?? (S ? ((B = v == null ? void 0 : v.find(($) => $.collection)) == null ? void 0 : B.collection) ?? null : null), E = D == null ? void 0 : D.length;
272
337
  return fe(() => {
273
- D !== void 0 && (N == null || N(D));
274
- }, [D, N]), fe(() => {
275
- R && (_ == null || _(R));
276
- }, [R, _]), w && !R && (!F || g) ? /* @__PURE__ */ t(le, {}) : !E || !R ? /* @__PURE__ */ t("span", { className: "inline-block h-3.5 w-20 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }) : E.length === 0 ? /* @__PURE__ */ t(le, {}) : R === "nivaro_files" && x ? /* @__PURE__ */ t("div", { className: "mt-1", children: /* @__PURE__ */ t(
277
- fl,
338
+ E !== void 0 && (w == null || w(E));
339
+ }, [E, w]), fe(() => {
340
+ R && (y == null || y(R));
341
+ }, [R, y]), k && !R && (!S || v) ? /* @__PURE__ */ t(le, {}) : !D || !R ? /* @__PURE__ */ t("span", { className: "inline-block h-3.5 w-20 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }) : D.length === 0 ? /* @__PURE__ */ t(le, {}) : R === "nivaro_files" && h ? /* @__PURE__ */ t("div", { className: "mt-1", children: /* @__PURE__ */ t(
342
+ hl,
278
343
  {
279
- relation: x,
344
+ relation: h,
280
345
  parentId: i,
281
346
  allRelations: [],
282
347
  disabled: !0
283
348
  }
284
- ) }) : /* @__PURE__ */ t("span", { className: "flex flex-wrap gap-x-1.5 gap-y-0.5", children: (g ?? []).map(({ id: k, collection: $ }, A) => /* @__PURE__ */ p(
349
+ ) }) : /* @__PURE__ */ t("span", { className: "flex flex-wrap gap-x-1.5 gap-y-0.5", children: (v ?? []).map(({ id: $, collection: F }, O) => /* @__PURE__ */ b(
285
350
  "span",
286
351
  {
287
352
  className: "inline-flex items-center whitespace-nowrap",
288
353
  children: [
289
- /* @__PURE__ */ t(lt, { collection: $ ?? R, id: k }),
290
- A < E.length - 1 && /* @__PURE__ */ t("span", { className: "text-slate-300 dark:text-slate-600", children: "," })
354
+ /* @__PURE__ */ t(rt, { collection: F ?? R, id: $ }),
355
+ O < D.length - 1 && /* @__PURE__ */ t("span", { className: "text-slate-300 dark:text-slate-600", children: "," })
291
356
  ]
292
357
  },
293
- `${$ ?? R}:${k}`
358
+ `${F ?? R}:${$}`
294
359
  )) });
295
360
  }
296
- function jl({
361
+ function Gl({
297
362
  collection: a,
298
- fkField: u,
299
- parentId: h,
363
+ fkField: o,
364
+ parentId: m,
300
365
  layoutId: i,
301
- presets: N,
302
- defaultPreset: _,
303
- onCount: x
366
+ presets: w,
367
+ defaultPreset: y,
368
+ onCount: h
304
369
  }) {
305
- const S = we(), w = kt(), m = (N ?? []).filter((l) => l && Array.isArray(l.columns)), [C, F] = U(
370
+ const g = we(), k = Nt(), f = (w ?? []).filter((l) => l && Array.isArray(l.columns)), [A, S] = U(
306
371
  () => {
307
372
  var l;
308
- return m.length >= 2 ? ((l = m.find((d) => d.name === _)) == null ? void 0 : l.name) ?? m[0].name : "__all__";
373
+ return f.length >= 2 ? ((l = f.find((d) => d.name === y)) == null ? void 0 : l.name) ?? f[0].name : "__all__";
309
374
  }
310
- ), { data: T } = H({
375
+ ), { data: T } = V({
311
376
  queryKey: ["cbv-collection-meta", a],
312
- queryFn: () => S.request(z(`/collections/${a}`)).then((l) => l.data),
377
+ queryFn: () => g.request(z(`/collections/${a}`)).then((l) => l.data),
313
378
  staleTime: 10 * 6e4,
314
379
  retry: !1
315
380
  }), q = (l) => {
316
381
  var d;
317
382
  return ((d = ((T == null ? void 0 : T.relations) ?? []).find(
318
- (o) => o.many_collection === a && o.many_field === l && o.one_collection
383
+ (c) => c.many_collection === a && c.many_field === l && c.one_collection
319
384
  )) == null ? void 0 : d.one_collection) ?? null;
320
- }, { data: v } = H({
385
+ }, { data: N } = V({
321
386
  queryKey: ["rrv-cols", a, i ?? null],
322
- queryFn: () => S.request(
387
+ queryFn: () => g.request(
323
388
  z(`/field-config/${a}`, i ? { layout_id: i } : {})
324
389
  ).then((l) => ({
325
390
  // Lines carry their own number — sort by it and show it first.
326
391
  lineNo: (l.data ?? []).some((d) => d.field === "line_number"),
327
392
  cols: (l.data ?? []).filter(
328
- (d) => !d.hidden && !d.field.startsWith("__") && (!d.field.includes(".") || d.interface === "relation-path") && d.field !== u && ((i ? d.layout_assigned : !0) ?? !0) && (d.interface === "relation-path" || [
393
+ (d) => !d.hidden && !d.field.startsWith("__") && (!d.field.includes(".") || d.interface === "relation-path") && d.field !== o && ((i ? d.layout_assigned : !0) ?? !0) && (d.interface === "relation-path" || [
329
394
  "string",
330
395
  "text",
331
396
  "integer",
@@ -337,53 +402,53 @@ function jl({
337
402
  "timestamp",
338
403
  "uuid"
339
404
  ].includes(d.type ?? ""))
340
- ).filter((d, o, b) => b.findIndex((L) => L.field === d.field) === o)
405
+ ).filter((d, c, x) => x.findIndex((L) => L.field === d.field) === c)
341
406
  })),
342
407
  staleTime: 5 * 6e4,
343
408
  retry: !1
344
- }), g = (v == null ? void 0 : v.cols) ?? [], E = !!(v != null && v.lineNo), R = C !== "__all__" ? m.find((l) => l.name === C) : null, D = ke(() => {
345
- if (!R) return g;
346
- const l = new Set(R.columns), d = g.filter((o) => l.has(o.field));
347
- return d.length > 0 ? d : g;
348
- }, [g, R]), [j, k] = U(""), [$, A] = U(1), [ie, V] = U({}), Z = Qt(ie, 350), Ee = ke(() => {
409
+ }), v = (N == null ? void 0 : N.cols) ?? [], D = !!(N != null && N.lineNo), R = A !== "__all__" ? f.find((l) => l.name === A) : null, E = ke(() => {
410
+ if (!R) return v;
411
+ const l = new Set(R.columns), d = v.filter((c) => l.has(c.field));
412
+ return d.length > 0 ? d : v;
413
+ }, [v, R]), [B, $] = U(""), [F, O] = U(1), [ie, G] = U({}), Z = Yt(ie, 350), De = ke(() => {
349
414
  const l = [
350
- { path: [u], op: "_eq", value: h }
415
+ { path: [o], op: "_eq", value: m }
351
416
  ];
352
- for (const [d, o] of Object.entries(Z)) {
353
- if (!(o != null && o.value.trim())) continue;
354
- const b = o.value.trim(), L = Number(b), W = o.op === "_contains" ? b : b === "true" || b === "false" ? b === "true" : Number.isNaN(L) ? b : L;
355
- l.push({ path: [d], op: o.op, value: W });
417
+ for (const [d, c] of Object.entries(Z)) {
418
+ if (!(c != null && c.value.trim())) continue;
419
+ const x = c.value.trim(), L = Number(x), W = c.op === "_contains" ? x : x === "true" || x === "false" ? x === "true" : Number.isNaN(L) ? x : L;
420
+ l.push({ path: [d], op: c.op, value: W });
356
421
  }
357
422
  return JSON.stringify(l);
358
- }, [Z, u, h]), f = 25, {
359
- data: G,
423
+ }, [Z, o, m]), p = 25, {
424
+ data: J,
360
425
  isLoading: pe,
361
- isFetching: De
362
- } = H({
363
- queryKey: ["rrv-rows", a, u, h, j, E, $, Ee],
364
- queryFn: () => S.request(
426
+ isFetching: Ee
427
+ } = V({
428
+ queryKey: ["rrv-rows", a, o, m, B, D, F, De],
429
+ queryFn: () => g.request(
365
430
  z(`/items/${a}`, {
366
- limit: f,
367
- page: $,
368
- ...j ? { sort: j } : E ? { sort: "line_number" } : {},
369
- conditions: Ee
431
+ limit: p,
432
+ page: F,
433
+ ...B ? { sort: B } : D ? { sort: "line_number" } : {},
434
+ conditions: De
370
435
  })
371
436
  ),
372
437
  placeholderData: (l) => l,
373
438
  staleTime: 3e4,
374
439
  retry: !1
375
- }), P = (G == null ? void 0 : G.data) ?? [], ee = (G == null ? void 0 : G.total) ?? P.length, I = Object.values(Z).some((l) => !!(l != null && l.value.trim()));
440
+ }), M = (J == null ? void 0 : J.data) ?? [], ee = (J == null ? void 0 : J.total) ?? M.length, I = Object.values(Z).some((l) => !!(l != null && l.value.trim()));
376
441
  fe(() => {
377
- G && !I && (x == null || x(ee));
378
- }, [G, I, ee, x]);
379
- const he = D.filter((l) => l.field.includes(".")), be = P.map((l) => String(l.id)), { data: Y } = H({
442
+ J && !I && (h == null || h(ee));
443
+ }, [J, I, ee, h]);
444
+ const he = E.filter((l) => l.field.includes(".")), be = M.map((l) => String(l.id)), { data: Y } = V({
380
445
  queryKey: [
381
446
  "rrv-resolve-paths",
382
447
  a,
383
448
  he.map((l) => l.field).join(","),
384
449
  be.join(",")
385
450
  ],
386
- queryFn: () => S.request(
451
+ queryFn: () => g.request(
387
452
  z(`/items/${a}/resolve-paths`, {
388
453
  ids: be.join(","),
389
454
  paths: he.map((l) => l.field).join(",")
@@ -391,13 +456,13 @@ function jl({
391
456
  ).then((l) => l.data ?? { rows: {}, targets: {} }).catch(() => ({ rows: {}, targets: {} })),
392
457
  enabled: he.length > 0 && be.length > 0,
393
458
  staleTime: 3e4
394
- }), K = E && P.some((l) => l.line_number != null), se = Math.max(1, Math.ceil(ee / f)), de = (l, d, o) => {
395
- A(1), V((b) => {
396
- const L = { ...b };
397
- return o ? L[l] = { op: d, value: o } : delete L[l], L;
459
+ }), P = D && M.some((l) => l.line_number != null), se = Math.max(1, Math.ceil(ee / p)), de = (l, d, c) => {
460
+ O(1), G((x) => {
461
+ const L = { ...x };
462
+ return c ? L[l] = { op: d, value: c } : delete L[l], L;
398
463
  });
399
464
  }, Ie = (l) => {
400
- A(1), k((d) => d === l ? `-${l}` : d === `-${l}` ? "" : l);
465
+ O(1), $((d) => d === l ? `-${l}` : d === `-${l}` ? "" : l);
401
466
  };
402
467
  if (pe)
403
468
  return /* @__PURE__ */ t("div", { className: "space-y-1.5 py-2", children: [0, 1, 2].map((l) => /* @__PURE__ */ t(
@@ -407,9 +472,9 @@ function jl({
407
472
  },
408
473
  l
409
474
  )) });
410
- if (P.length === 0 && Object.keys(Z).length === 0)
475
+ if (M.length === 0 && Object.keys(Z).length === 0)
411
476
  return /* @__PURE__ */ t("p", { className: "py-3 text-[12px] text-slate-400", children: "No records" });
412
- const Ue = (l, d) => {
477
+ const He = (l, d) => {
413
478
  var W, re;
414
479
  if (d.field.includes(".")) {
415
480
  const ne = (W = Y == null ? void 0 : Y.rows[String(l.id)]) == null ? void 0 : W[d.field];
@@ -417,32 +482,32 @@ function jl({
417
482
  return /* @__PURE__ */ t("span", { className: "inline-block h-3 w-14 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" });
418
483
  if (!ne || ne.value === "") return /* @__PURE__ */ t(le, {});
419
484
  const qe = Y.targets[d.field], ge = (re = ne.ids) == null ? void 0 : re[0];
420
- return w && qe && ge ? /* @__PURE__ */ t(Ze, { collection: qe, id: ge, children: /* @__PURE__ */ t(
485
+ return k && qe && ge ? /* @__PURE__ */ t(et, { collection: qe, id: ge, children: /* @__PURE__ */ t(
421
486
  "button",
422
487
  {
423
488
  type: "button",
424
- onClick: (He) => {
425
- He.stopPropagation(), w.open({ collection: qe, itemId: String(ge) });
489
+ onClick: (Ue) => {
490
+ Ue.stopPropagation(), k.open({ collection: qe, itemId: String(ge) });
426
491
  },
427
492
  className: "inline-block max-w-full truncate text-left align-bottom underline decoration-slate-300 underline-offset-2 hover:text-[#007a99] dark:decoration-slate-600 dark:hover:text-nvr-cyan",
428
493
  children: ne.value
429
494
  }
430
495
  ) }) : ne.value;
431
496
  }
432
- const o = l[d.field];
433
- if (d.type === "boolean" && o == null) return /* @__PURE__ */ t(Be, { value: !1 });
434
- if (o == null || o === "") return /* @__PURE__ */ t(le, {});
435
- const b = q(d.field);
436
- if (b === "nivaro_users")
437
- return /* @__PURE__ */ t("span", { className: "inline-block", children: /* @__PURE__ */ t(St, { userId: String(o), size: "compact" }) });
438
- if (b) return /* @__PURE__ */ t(lt, { collection: b, id: o });
439
- if (d.type === "boolean") return /* @__PURE__ */ t(Be, { value: o });
497
+ const c = l[d.field];
498
+ if (d.type === "boolean" && c == null) return /* @__PURE__ */ t(je, { value: !1 });
499
+ if (c == null || c === "") return /* @__PURE__ */ t(le, {});
500
+ const x = q(d.field);
501
+ if (x === "nivaro_users")
502
+ return /* @__PURE__ */ t("span", { className: "inline-block", children: /* @__PURE__ */ t(Ft, { userId: String(c), size: "compact" }) });
503
+ if (x) return /* @__PURE__ */ t(rt, { collection: x, id: c });
504
+ if (d.type === "boolean") return /* @__PURE__ */ t(je, { value: c });
440
505
  if (d.type === "decimal" || d.type === "float" || d.type === "integer")
441
- return Nt(o, d) || String(o);
442
- if (d.type === "date" || d.type === "datetime" || d.type === "timestamp") return Ft(o);
443
- const L = String(o);
506
+ return $t(c, d) || String(c);
507
+ if (d.type === "date" || d.type === "datetime" || d.type === "timestamp") return Rt(c);
508
+ const L = String(c);
444
509
  return L.length > 48 ? `${L.slice(0, 48)}…` : L;
445
- }, oe = (l) => ["decimal", "float", "integer"].includes(l.type ?? "") && !q(l.field) && !l.field.includes("."), Pe = (l) => {
510
+ }, oe = (l) => ["decimal", "float", "integer"].includes(l.type ?? "") && !q(l.field) && !l.field.includes("."), Me = (l) => {
446
511
  const d = l.options;
447
512
  if (!d) return {};
448
513
  if (typeof d == "string")
@@ -453,28 +518,28 @@ function jl({
453
518
  }
454
519
  return d;
455
520
  }, Ne = (l) => {
456
- const d = Pe(l).aggregate;
521
+ const d = Me(l).aggregate;
457
522
  return typeof d == "string" && ["sum", "avg", "min", "max", "count"].includes(d) ? d : null;
458
- }, Ke = D.some((l) => Ne(l)), Se = (l) => {
523
+ }, Pe = E.some((l) => Ne(l)), Se = (l) => {
459
524
  const d = Ne(l);
460
525
  if (!d) return null;
461
- const o = P.map((W) => Number(W[l.field])).filter((W) => !Number.isNaN(W));
462
- let b = null;
463
- if (d === "count" ? b = P.length : o.length > 0 && (d === "sum" ? b = o.reduce((W, re) => W + re, 0) : d === "avg" ? b = o.reduce((W, re) => W + re, 0) / o.length : d === "min" ? b = Math.min(...o) : d === "max" && (b = Math.max(...o))), b === null) return "—";
464
- const L = Pe(l).format;
465
- return d === "count" || L === "int" ? El(Math.round(b)) : et(l) === "money" ? wt(b, { currency: $t(l) ?? "USD" }) : nl(b, 2);
466
- }, $e = (l) => !q(l.field) && !l.field.includes("."), We = (l) => q(l.field) || l.field.includes(".") ? null : l.type === "boolean" ? "bool" : ["integer", "decimal", "float"].includes(l.type ?? "") ? "num" : ["string", "text"].includes(l.type ?? "") ? "text" : null, Fe = D.some((l) => We(l) != null);
467
- return /* @__PURE__ */ p("div", { children: [
468
- m.length >= 2 && /* @__PURE__ */ t("div", { className: "mb-1.5 flex flex-wrap items-center gap-1", "data-read-presets": !0, children: [
526
+ const c = M.map((W) => Number(W[l.field])).filter((W) => !Number.isNaN(W));
527
+ let x = null;
528
+ if (d === "count" ? x = M.length : c.length > 0 && (d === "sum" ? x = c.reduce((W, re) => W + re, 0) : d === "avg" ? x = c.reduce((W, re) => W + re, 0) / c.length : d === "min" ? x = Math.min(...c) : d === "max" && (x = Math.max(...c))), x === null) return "—";
529
+ const L = Me(l).format;
530
+ return d === "count" || L === "int" ? Ml(Math.round(x)) : tt(l) === "money" ? St(x, { currency: qt(l) ?? "USD" }) : il(x, 2);
531
+ }, $e = (l) => !q(l.field) && !l.field.includes("."), We = (l) => q(l.field) || l.field.includes(".") ? null : l.type === "boolean" ? "bool" : ["integer", "decimal", "float"].includes(l.type ?? "") ? "num" : ["string", "text"].includes(l.type ?? "") ? "text" : null, Fe = E.some((l) => We(l) != null);
532
+ return /* @__PURE__ */ b("div", { children: [
533
+ f.length >= 2 && /* @__PURE__ */ t("div", { className: "mb-1.5 flex flex-wrap items-center gap-1", "data-read-presets": !0, children: [
469
534
  { name: "__all__", label: "All" },
470
- ...m.map((l) => ({ name: l.name, label: l.name }))
535
+ ...f.map((l) => ({ name: l.name, label: l.name }))
471
536
  ].map((l) => /* @__PURE__ */ t(
472
537
  "button",
473
538
  {
474
539
  type: "button",
475
- onClick: () => F(l.name),
476
- "aria-pressed": C === l.name,
477
- className: `rounded-full border px-2 py-0.5 text-[10.5px] font-medium transition-colors ${C === l.name ? "border-nvr-cyan bg-nvr-cyan/10 text-[#007a99] dark:text-nvr-cyan" : "border-slate-200 text-slate-500 hover:bg-slate-50 dark:border-slate-700 dark:text-slate-400 dark:hover:bg-slate-800"}`,
540
+ onClick: () => S(l.name),
541
+ "aria-pressed": A === l.name,
542
+ className: `rounded-full border px-2 py-0.5 text-[10.5px] font-medium transition-colors ${A === l.name ? "border-nvr-cyan bg-nvr-cyan/10 text-[#007a99] dark:text-nvr-cyan" : "border-slate-200 text-slate-500 hover:bg-slate-50 dark:border-slate-700 dark:text-slate-400 dark:hover:bg-slate-800"}`,
478
543
  children: l.label
479
544
  },
480
545
  l.name
@@ -482,48 +547,48 @@ function jl({
482
547
  /* @__PURE__ */ t(
483
548
  "div",
484
549
  {
485
- className: `overflow-x-auto rounded-md border border-slate-200 dark:border-slate-700 ${De && !pe ? "opacity-70" : ""}`,
486
- children: /* @__PURE__ */ p("table", { className: "w-full", style: { fontVariantNumeric: "tabular-nums" }, children: [
487
- /* @__PURE__ */ p("thead", { children: [
488
- /* @__PURE__ */ p("tr", { className: "border-b border-slate-200 bg-slate-50 dark:border-slate-700 dark:bg-slate-800", children: [
489
- K && /* @__PURE__ */ t("th", { className: "h-7 w-8 px-2 text-right text-[9.5px] font-bold uppercase tracking-wider text-slate-400", children: "#" }),
490
- D.map((l) => {
491
- const d = j === l.field || j === `-${l.field}`;
492
- return /* @__PURE__ */ p(
550
+ className: `overflow-x-auto rounded-md border border-slate-200 dark:border-slate-700 ${Ee && !pe ? "opacity-70" : ""}`,
551
+ children: /* @__PURE__ */ b("table", { className: "w-full", style: { fontVariantNumeric: "tabular-nums" }, children: [
552
+ /* @__PURE__ */ b("thead", { children: [
553
+ /* @__PURE__ */ b("tr", { className: "border-b border-slate-200 bg-slate-50 dark:border-slate-700 dark:bg-slate-800", children: [
554
+ P && /* @__PURE__ */ t("th", { className: "h-7 w-8 px-2 text-right text-[9.5px] font-bold uppercase tracking-wider text-slate-400", children: "#" }),
555
+ E.map((l) => {
556
+ const d = B === l.field || B === `-${l.field}`;
557
+ return /* @__PURE__ */ b(
493
558
  "th",
494
559
  {
495
560
  onClick: () => $e(l) && Ie(l.field),
496
561
  className: `h-7 select-none whitespace-nowrap px-2.5 text-[9.5px] font-bold uppercase tracking-wider text-slate-500 dark:text-slate-400 ${oe(l) ? "text-right" : "text-left"} ${$e(l) ? "cursor-pointer hover:text-slate-700 dark:hover:text-slate-200" : ""}`,
497
562
  children: [
498
- l.label || Xe(l.field),
499
- $e(l) && /* @__PURE__ */ t("span", { className: d ? "ml-0.5 text-[#00a5cc]" : "ml-0.5 text-slate-300", children: d ? j.startsWith("-") ? "▼" : "▲" : "⇅" })
563
+ l.label || Ze(l.field),
564
+ $e(l) && /* @__PURE__ */ t("span", { className: d ? "ml-0.5 text-[#00a5cc]" : "ml-0.5 text-slate-300", children: d ? B.startsWith("-") ? "▼" : "▲" : "⇅" })
500
565
  ]
501
566
  },
502
567
  l.field
503
568
  );
504
569
  })
505
570
  ] }),
506
- Fe && /* @__PURE__ */ p("tr", { className: "border-b border-slate-200 bg-slate-50 dark:border-slate-700 dark:bg-slate-800", children: [
507
- K && /* @__PURE__ */ t("th", { className: "px-1.5 py-1" }),
508
- D.map((l) => {
509
- const d = We(l), o = ie[l.field];
510
- return /* @__PURE__ */ p("th", { className: "px-1.5 py-1 font-normal", children: [
571
+ Fe && /* @__PURE__ */ b("tr", { className: "border-b border-slate-200 bg-slate-50 dark:border-slate-700 dark:bg-slate-800", children: [
572
+ P && /* @__PURE__ */ t("th", { className: "px-1.5 py-1" }),
573
+ E.map((l) => {
574
+ const d = We(l), c = ie[l.field];
575
+ return /* @__PURE__ */ b("th", { className: "px-1.5 py-1 font-normal", children: [
511
576
  d === "text" && /* @__PURE__ */ t(
512
577
  "input",
513
578
  {
514
- value: (o == null ? void 0 : o.value) ?? "",
515
- onChange: (b) => de(l.field, "_contains", b.target.value),
579
+ value: (c == null ? void 0 : c.value) ?? "",
580
+ onChange: (x) => de(l.field, "_contains", x.target.value),
516
581
  placeholder: "Filter…",
517
582
  "aria-label": `Filter ${l.field}`,
518
583
  className: "h-6 w-full min-w-[56px] rounded border border-slate-200 bg-white px-1.5 text-[10.5px] font-normal normal-case tracking-normal outline-none focus:border-nvr-cyan/50 dark:border-slate-600 dark:bg-slate-900 dark:text-slate-100"
519
584
  }
520
585
  ),
521
- d === "num" && /* @__PURE__ */ p("span", { className: "flex items-center gap-0.5", children: [
586
+ d === "num" && /* @__PURE__ */ b("span", { className: "flex items-center gap-0.5", children: [
522
587
  /* @__PURE__ */ t(
523
588
  yt,
524
589
  {
525
- value: (o == null ? void 0 : o.op) ?? "_eq",
526
- onChange: (b) => de(l.field, b, (o == null ? void 0 : o.value) ?? ""),
590
+ value: (c == null ? void 0 : c.op) ?? "_eq",
591
+ onChange: (x) => de(l.field, x, (c == null ? void 0 : c.value) ?? ""),
527
592
  options: [
528
593
  { value: "_eq", label: "=" },
529
594
  { value: "_gte", label: "≥" },
@@ -536,8 +601,8 @@ function jl({
536
601
  "input",
537
602
  {
538
603
  type: "number",
539
- value: (o == null ? void 0 : o.value) ?? "",
540
- onChange: (b) => de(l.field, (o == null ? void 0 : o.op) ?? "_eq", b.target.value),
604
+ value: (c == null ? void 0 : c.value) ?? "",
605
+ onChange: (x) => de(l.field, (c == null ? void 0 : c.op) ?? "_eq", x.target.value),
541
606
  "aria-label": `Filter ${l.field}`,
542
607
  className: "h-6 w-full min-w-[48px] rounded border border-slate-200 bg-white px-1 text-[10.5px] font-normal outline-none focus:border-nvr-cyan/50 dark:border-slate-600 dark:bg-slate-900 dark:text-slate-100"
543
608
  }
@@ -546,8 +611,8 @@ function jl({
546
611
  d === "bool" && /* @__PURE__ */ t(
547
612
  yt,
548
613
  {
549
- value: (o == null ? void 0 : o.value) ?? "",
550
- onChange: (b) => de(l.field, "_eq", b),
614
+ value: (c == null ? void 0 : c.value) ?? "",
615
+ onChange: (x) => de(l.field, "_eq", x),
551
616
  options: [
552
617
  { value: "", label: "All" },
553
618
  { value: "true", label: "Yes" },
@@ -561,27 +626,27 @@ function jl({
561
626
  })
562
627
  ] })
563
628
  ] }),
564
- /* @__PURE__ */ p("tbody", { children: [
565
- P.length === 0 && /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t(
629
+ /* @__PURE__ */ b("tbody", { children: [
630
+ M.length === 0 && /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t(
566
631
  "td",
567
632
  {
568
- colSpan: D.length + (K ? 1 : 0),
633
+ colSpan: E.length + (P ? 1 : 0),
569
634
  className: "py-4 text-center text-[12px] text-slate-400",
570
635
  children: "No matches — adjust filters"
571
636
  }
572
637
  ) }),
573
- P.map((l) => /* @__PURE__ */ p(
638
+ M.map((l) => /* @__PURE__ */ b(
574
639
  "tr",
575
640
  {
576
- onClick: w ? () => w.open({ collection: a, itemId: String(l.id) }) : void 0,
577
- className: `border-b border-slate-100 last:border-0 dark:border-slate-800 ${w ? "cursor-pointer hover:bg-nvr-cyan/5 dark:hover:bg-nvr-cyan/10" : ""}`,
641
+ onClick: k ? () => k.open({ collection: a, itemId: String(l.id) }) : void 0,
642
+ className: `border-b border-slate-100 last:border-0 dark:border-slate-800 ${k ? "cursor-pointer hover:bg-nvr-cyan/5 dark:hover:bg-nvr-cyan/10" : ""}`,
578
643
  children: [
579
- K && /* @__PURE__ */ t("td", { className: "px-2 py-1.5 text-right text-[11px] tabular-nums text-slate-400", children: l.line_number == null ? "" : String(l.line_number) }),
580
- D.map((d) => /* @__PURE__ */ t(
644
+ P && /* @__PURE__ */ t("td", { className: "px-2 py-1.5 text-right text-[11px] tabular-nums text-slate-400", children: l.line_number == null ? "" : String(l.line_number) }),
645
+ E.map((d) => /* @__PURE__ */ t(
581
646
  "td",
582
647
  {
583
648
  className: `whitespace-nowrap px-2.5 py-1.5 text-[12px] text-slate-700 dark:text-slate-200 ${oe(d) ? "text-right" : ""}`,
584
- children: Ue(l, d)
649
+ children: He(l, d)
585
650
  },
586
651
  d.field
587
652
  ))
@@ -590,20 +655,20 @@ function jl({
590
655
  String(l.id)
591
656
  ))
592
657
  ] }),
593
- Ke && P.length > 0 && /* @__PURE__ */ t("tfoot", { children: /* @__PURE__ */ p(
658
+ Pe && M.length > 0 && /* @__PURE__ */ t("tfoot", { children: /* @__PURE__ */ b(
594
659
  "tr",
595
660
  {
596
661
  "data-read-grid-footer": !0,
597
662
  className: "border-t border-slate-200 bg-slate-50 text-[11px] font-medium text-slate-600 dark:border-slate-700 dark:bg-slate-800/60 dark:text-slate-300",
598
663
  children: [
599
- K && /* @__PURE__ */ t("td", {}),
600
- D.map((l) => {
664
+ P && /* @__PURE__ */ t("td", {}),
665
+ E.map((l) => {
601
666
  const d = Ne(l);
602
667
  return /* @__PURE__ */ t(
603
668
  "td",
604
669
  {
605
670
  className: `whitespace-nowrap px-2.5 py-1.5 ${oe(l) ? "text-right" : ""}`,
606
- children: d && /* @__PURE__ */ p(me, { children: [
671
+ children: d && /* @__PURE__ */ b(me, { children: [
607
672
  /* @__PURE__ */ t("span", { className: "mr-1 font-mono text-[10px] text-slate-400", children: d.toUpperCase() }),
608
673
  /* @__PURE__ */ t("span", { className: "tabular-nums", children: Se(l) })
609
674
  ] })
@@ -617,22 +682,22 @@ function jl({
617
682
  ] })
618
683
  }
619
684
  ),
620
- ee > f && /* @__PURE__ */ p("div", { className: "mt-1.5 flex items-center justify-between", children: [
621
- /* @__PURE__ */ p("p", { className: "text-[11px] tabular-nums text-slate-400", children: [
622
- (($ - 1) * f + 1).toLocaleString("en-US"),
685
+ ee > p && /* @__PURE__ */ b("div", { className: "mt-1.5 flex items-center justify-between", children: [
686
+ /* @__PURE__ */ b("p", { className: "text-[11px] tabular-nums text-slate-400", children: [
687
+ ((F - 1) * p + 1).toLocaleString("en-US"),
623
688
  "–",
624
- Math.min($ * f, ee).toLocaleString("en-US"),
689
+ Math.min(F * p, ee).toLocaleString("en-US"),
625
690
  " of",
626
691
  " ",
627
692
  ee.toLocaleString("en-US")
628
693
  ] }),
629
- /* @__PURE__ */ p("span", { className: "flex items-center gap-0.5", children: [
694
+ /* @__PURE__ */ b("span", { className: "flex items-center gap-0.5", children: [
630
695
  /* @__PURE__ */ t(
631
696
  "button",
632
697
  {
633
698
  type: "button",
634
- disabled: $ <= 1,
635
- onClick: () => A(1),
699
+ disabled: F <= 1,
700
+ onClick: () => O(1),
636
701
  "aria-label": "First page",
637
702
  "data-tip": "First page",
638
703
  className: "h-6 rounded px-2 text-[11px] text-slate-600 hover:bg-slate-100 disabled:opacity-30 dark:text-slate-300 dark:hover:bg-slate-800",
@@ -643,14 +708,14 @@ function jl({
643
708
  "button",
644
709
  {
645
710
  type: "button",
646
- disabled: $ <= 1,
647
- onClick: () => A((l) => Math.max(1, l - 1)),
711
+ disabled: F <= 1,
712
+ onClick: () => O((l) => Math.max(1, l - 1)),
648
713
  className: "h-6 rounded px-2 text-[11px] text-slate-600 hover:bg-slate-100 disabled:opacity-30 dark:text-slate-300 dark:hover:bg-slate-800",
649
714
  children: "← Prev"
650
715
  }
651
716
  ),
652
- /* @__PURE__ */ p("span", { className: "min-w-[48px] text-center text-[11px] tabular-nums text-slate-500", children: [
653
- $,
717
+ /* @__PURE__ */ b("span", { className: "min-w-[48px] text-center text-[11px] tabular-nums text-slate-500", children: [
718
+ F,
654
719
  " / ",
655
720
  se.toLocaleString("en-US")
656
721
  ] }),
@@ -658,8 +723,8 @@ function jl({
658
723
  "button",
659
724
  {
660
725
  type: "button",
661
- disabled: $ >= se,
662
- onClick: () => A((l) => l + 1),
726
+ disabled: F >= se,
727
+ onClick: () => O((l) => l + 1),
663
728
  className: "h-6 rounded px-2 text-[11px] text-slate-600 hover:bg-slate-100 disabled:opacity-30 dark:text-slate-300 dark:hover:bg-slate-800",
664
729
  children: "Next →"
665
730
  }
@@ -668,8 +733,8 @@ function jl({
668
733
  "button",
669
734
  {
670
735
  type: "button",
671
- disabled: $ >= se,
672
- onClick: () => A(se),
736
+ disabled: F >= se,
737
+ onClick: () => O(se),
673
738
  "aria-label": "Last page",
674
739
  "data-tip": "Last page",
675
740
  className: "h-6 rounded px-2 text-[11px] text-slate-600 hover:bg-slate-100 disabled:opacity-30 dark:text-slate-300 dark:hover:bg-slate-800",
@@ -680,59 +745,59 @@ function jl({
680
745
  ] })
681
746
  ] });
682
747
  }
683
- function vt({
748
+ function kt({
684
749
  collection: a,
685
- itemId: u,
686
- layoutData: h,
750
+ itemId: o,
751
+ layoutData: m,
687
752
  design: i,
688
- flush: N,
689
- renderSlot: _,
690
- integrityMarks: x,
691
- renderGrid: S,
692
- onEditSection: w,
693
- gridCounts: m
753
+ flush: w,
754
+ renderSlot: y,
755
+ integrityMarks: h,
756
+ renderGrid: g,
757
+ onEditSection: k,
758
+ gridCounts: f
694
759
  }) {
695
- var ot;
696
- const C = we(), F = yl(), T = i ? i.record ?? {} : null, q = !!(i != null && i.context.showHidden), v = i ? String(((ot = i.record) == null ? void 0 : ot.id) ?? "") : u ?? "", g = ke(
760
+ var ct;
761
+ const A = we(), S = vl(), T = i ? i.record ?? {} : null, q = !!(i != null && i.context.showHidden), N = i ? String(((ct = i.record) == null ? void 0 : ct.id) ?? "") : o ?? "", v = ke(
697
762
  () => i ? {
698
763
  ...i.layout,
699
764
  layout: i.layout.layout ?? { id: 0, name: "" }
700
- } : h,
701
- [i, h]
702
- ), E = (e) => ({
765
+ } : m,
766
+ [i, m]
767
+ ), D = (e) => ({
703
768
  kind: Le(e.field) ? "slot" : "field",
704
769
  field: e.field,
705
770
  group_key: e.group_key ?? null
706
- }), R = (e, r, s = !1) => i ? /* @__PURE__ */ t(Sl, { target: e, children: s ? /* @__PURE__ */ t("div", { "data-design-hidden": !0, className: "opacity-40", children: r }) : r }) : r, D = ke(
771
+ }), R = (e, r, s = !1) => i ? /* @__PURE__ */ t(Fl, { target: e, children: s ? /* @__PURE__ */ t("div", { "data-design-hidden": !0, className: "opacity-40", children: r }) : r }) : r, E = ke(
707
772
  () => [
708
773
  ...new Set(
709
- (i ? [] : (g == null ? void 0 : g.assignments) ?? []).map((e) => e.field).filter((e) => e && !e.startsWith("__") && !e.includes("."))
774
+ (i ? [] : (v == null ? void 0 : v.assignments) ?? []).map((e) => e.field).filter((e) => e && !e.startsWith("__") && !e.includes("."))
710
775
  )
711
776
  ].sort(),
712
- [g, i]
713
- ), { data: j } = pl(a, v, D), k = (e) => {
714
- const r = j == null ? void 0 : j[e];
777
+ [v, i]
778
+ ), { data: B } = bl(a, N, E), $ = (e) => {
779
+ const r = B == null ? void 0 : B[e];
715
780
  if (!r) return null;
716
781
  const s = r.via !== "user";
717
782
  return r.caller && r.activity_id ? /* @__PURE__ */ t(
718
- ml,
783
+ pl,
719
784
  {
720
785
  activityId: r.activity_id,
721
786
  callerName: r.caller.name,
722
787
  collection: a,
723
- itemId: v,
724
- children: /* @__PURE__ */ p(
788
+ itemId: N,
789
+ children: /* @__PURE__ */ b(
725
790
  "button",
726
791
  {
727
792
  type: "button",
728
793
  "data-field-touch": e,
729
794
  "data-field-touch-caller": r.caller.key,
730
- "data-tip": `Changed ${je(r.at)} by ${r.caller.name} (through the API) — click for the request`,
731
- "aria-label": `Changed ${je(r.at)} by ${r.caller.name} through the API`,
795
+ "data-tip": `Changed ${Be(r.at)} by ${r.caller.name} (through the API) — click for the request`,
796
+ "aria-label": `Changed ${Be(r.at)} by ${r.caller.name} through the API`,
732
797
  className: "ml-1 inline-flex min-w-0 items-center gap-1 overflow-hidden rounded-full bg-amber-50 px-1.5 align-middle text-[9.5px] font-medium leading-4 text-amber-800 hover:bg-amber-100 dark:bg-amber-400/10 dark:text-amber-300 dark:hover:bg-amber-400/20",
733
798
  children: [
734
799
  /* @__PURE__ */ t("span", { className: "h-1.5 w-1.5 shrink-0 rounded-full bg-amber-400", "aria-hidden": !0 }),
735
- /* @__PURE__ */ t(Dl, { name: r.caller.name, at: r.at })
800
+ /* @__PURE__ */ t(Pl, { name: r.caller.name, at: r.at })
736
801
  ]
737
802
  }
738
803
  )
@@ -741,19 +806,19 @@ function vt({
741
806
  "span",
742
807
  {
743
808
  "data-field-touch": e,
744
- "data-tip": `Changed ${je(r.at)} by ${r.who}${s ? ` · ${r.via}` : ""}`,
809
+ "data-tip": `Changed ${Be(r.at)} by ${r.who}${s ? ` · ${r.via}` : ""}`,
745
810
  role: "img",
746
- "aria-label": `Changed ${je(r.at)} by ${r.who}`,
811
+ "aria-label": `Changed ${Be(r.at)} by ${r.who}`,
747
812
  className: `ml-1 inline-block h-1.5 w-1.5 shrink-0 rounded-full align-middle ${s ? "bg-amber-400" : "bg-slate-300 dark:bg-slate-600"}`
748
813
  }
749
814
  );
750
- }, { data: $ } = Rl(a, v, !!x && !i), A = ke(
751
- () => x && ($ != null && $.enabled) ? Al($.findings) : null,
752
- [x, $]
815
+ }, { data: F } = Al(a, N, !!h && !i), O = ke(
816
+ () => h && (F != null && F.enabled) ? Cl(F.findings) : null,
817
+ [h, F]
753
818
  ), ie = ({ field: e }) => {
754
- const r = A == null ? void 0 : A.get(e);
819
+ const r = O == null ? void 0 : O.get(e);
755
820
  if (!r || r.length === 0) return null;
756
- const s = r.map((c) => c.message || c.rule).join(`
821
+ const s = r.map((u) => u.message || u.rule).join(`
757
822
  `);
758
823
  return /* @__PURE__ */ t(
759
824
  "span",
@@ -766,64 +831,64 @@ function vt({
766
831
  children: r.length > 1 ? r.length : "!"
767
832
  }
768
833
  );
769
- }, { data: V } = H({
834
+ }, { data: G } = V({
770
835
  queryKey: ["cbv-collection-meta", a],
771
- queryFn: () => C.request(
836
+ queryFn: () => A.request(
772
837
  z(`/collections/${a}`)
773
838
  ).then((e) => e.data),
774
839
  staleTime: 10 * 6e4,
775
840
  retry: !1
776
- }), Z = _t(), { data: Ee } = H({
777
- queryKey: ["rrv-record", a, v],
841
+ }), Z = wt(), { data: De } = V({
842
+ queryKey: ["rrv-record", a, N],
778
843
  enabled: !i,
779
- queryFn: () => C.request(z(`/items/${a}/${v}`)).then((e) => e.data),
780
- initialData: () => Z.getQueryData(["item", a, v]) ?? void 0,
844
+ queryFn: () => A.request(z(`/items/${a}/${N}`)).then((e) => e.data),
845
+ initialData: () => Z.getQueryData(["item", a, N]) ?? void 0,
781
846
  initialDataUpdatedAt: () => {
782
847
  var e;
783
- return (e = Z.getQueryState(["item", a, v])) == null ? void 0 : e.dataUpdatedAt;
848
+ return (e = Z.getQueryState(["item", a, N])) == null ? void 0 : e.dataUpdatedAt;
784
849
  },
785
850
  staleTime: 3e4,
786
851
  retry: !1
787
- }), f = T ?? Ee;
788
- rl(a, i ? null : v, (e) => {
789
- e.aspectsOnly || e.deleted || (Z.invalidateQueries({ queryKey: ["rrv-record", a, v] }), Z.invalidateQueries({ queryKey: ["field-touch", a, v] }));
852
+ }), p = T ?? De;
853
+ al(a, i ? null : N, (e) => {
854
+ e.aspectsOnly || e.deleted || (Z.invalidateQueries({ queryKey: ["rrv-record", a, N] }), Z.invalidateQueries({ queryKey: ["field-touch", a, N] }));
790
855
  });
791
- const G = Ye(null), [pe, De] = U(() => /* @__PURE__ */ new Set());
856
+ const J = Xe(null), [pe, Ee] = U(() => /* @__PURE__ */ new Set());
792
857
  fe(() => {
793
- const e = G.current;
794
- if (G.current = f ?? null, i || !e || !f || e === f) return;
795
- const r = Object.keys(f).filter(
796
- (c) => !c.startsWith("__") && JSON.stringify(e[c]) !== JSON.stringify(f[c])
858
+ const e = J.current;
859
+ if (J.current = p ?? null, i || !e || !p || e === p) return;
860
+ const r = Object.keys(p).filter(
861
+ (u) => !u.startsWith("__") && JSON.stringify(e[u]) !== JSON.stringify(p[u])
797
862
  );
798
863
  if (r.length === 0) return;
799
- De(new Set(r));
800
- const s = setTimeout(() => De(/* @__PURE__ */ new Set()), 2400);
864
+ Ee(new Set(r));
865
+ const s = setTimeout(() => Ee(/* @__PURE__ */ new Set()), 2400);
801
866
  return () => clearTimeout(s);
802
- }, [f, i]);
803
- const P = (e) => pe.has(e) ? " nvr-value-pulse-bg rounded-sm" : "", { data: ee } = H({
804
- queryKey: ["rrv-field-config", a, g.layout.id],
867
+ }, [p, i]);
868
+ const M = (e) => pe.has(e) ? " nvr-value-pulse-bg rounded-sm" : "", { data: ee } = V({
869
+ queryKey: ["rrv-field-config", a, v.layout.id],
805
870
  enabled: !i,
806
- queryFn: () => C.request(
807
- z(`/field-config/${a}`, { layout_id: g.layout.id })
871
+ queryFn: () => A.request(
872
+ z(`/field-config/${a}`, { layout_id: v.layout.id })
808
873
  ).then((e) => e.data ?? []).catch(() => null),
809
874
  staleTime: 5 * 6e4,
810
875
  retry: !1
811
876
  }), I = ke(
812
- () => new Map((ee ?? (V == null ? void 0 : V.fields) ?? []).map((e) => [e.field, e])),
813
- [ee, V]
814
- ), he = (V == null ? void 0 : V.relations) ?? [], be = (e) => {
877
+ () => new Map((ee ?? (G == null ? void 0 : G.fields) ?? []).map((e) => [e.field, e])),
878
+ [ee, G]
879
+ ), he = (G == null ? void 0 : G.relations) ?? [], be = (e) => {
815
880
  var r;
816
881
  return ((r = he.find(
817
882
  (s) => s.many_collection === a && s.many_field === e && s.one_collection
818
883
  )) == null ? void 0 : r.one_collection) ?? null;
819
884
  }, Y = (e) => he.find(
820
885
  (r) => r.one_collection === a && (r.one_field === e || r.many_collection === e)
821
- ) ?? null, K = (e) => {
886
+ ) ?? null, P = (e) => {
822
887
  var r;
823
888
  return !((e.is_visible === void 0 || e.is_visible) && _e(e.overrides).hidden !== !0 && !((r = I.get(e.field)) != null && r.hidden));
824
- }, se = g.assignments.filter(
825
- (e) => (!e.field.startsWith("__") || Le(e.field)) && (q || !K(e))
826
- ), de = g.assignments.filter(
889
+ }, se = v.assignments.filter(
890
+ (e) => (!e.field.startsWith("__") || Le(e.field)) && (q || !P(e))
891
+ ), de = v.assignments.filter(
827
892
  (e) => e.field.startsWith("__widget_") && e.widget_id != null && (q || e.is_visible === void 0 || !!e.is_visible)
828
893
  ), Ie = (e) => {
829
894
  if (!e.input_bindings) return [];
@@ -832,162 +897,162 @@ function vt({
832
897
  } catch {
833
898
  return [];
834
899
  }
835
- }, Ue = _ || i ? g.assignments.filter(
900
+ }, He = y || i ? v.assignments.filter(
836
901
  (e) => e.field.startsWith("__") && !e.field.startsWith("__widget_") && !Le(e.field) && (q || e.is_visible === void 0 || !!e.is_visible)
837
- ).sort((e, r) => e.sort - r.sort) : [], oe = ["__pipeline__", "__addendums__"], Pe = new Set(oe), Ne = (e) => (_ == null ? void 0 : _(e.field, e)) ?? (i ? /* @__PURE__ */ t("div", { className: "rounded-xl border border-dashed border-slate-300 bg-white px-5 py-3 text-[12px] font-medium text-slate-500 dark:border-slate-600 dark:bg-slate-900/40 dark:text-slate-400", children: e.label_override || Xe(e.field.replace(/^_+|_+$/g, "")) }) : null), Ke = (e, r = "trailing") => _ || i ? Ue.filter(
838
- (s) => e === null ? s.group_key == null && r === "leading" === Pe.has(s.field) : s.group_key === e
902
+ ).sort((e, r) => e.sort - r.sort) : [], oe = ["__pipeline__", "__addendums__"], Me = new Set(oe), Ne = (e) => (y == null ? void 0 : y(e.field, e)) ?? (i ? /* @__PURE__ */ t("div", { className: "rounded-xl border border-dashed border-slate-300 bg-white px-5 py-3 text-[12px] font-medium text-slate-500 dark:border-slate-600 dark:bg-slate-900/40 dark:text-slate-400", children: e.label_override || Ze(e.field.replace(/^_+|_+$/g, "")) }) : null), Pe = (e, r = "trailing") => y || i ? He.filter(
903
+ (s) => e === null ? s.group_key == null && r === "leading" === Me.has(s.field) : s.group_key === e
839
904
  ).sort(
840
- (s, c) => r === "leading" && e === null ? oe.indexOf(s.field) - oe.indexOf(c.field) : 0
905
+ (s, u) => r === "leading" && e === null ? oe.indexOf(s.field) - oe.indexOf(u.field) : 0
841
906
  ).map((s) => ({ key: s.field, a: s, node: Ne(s) })).filter((s) => s.node != null) : [], Se = (e, r = "trailing") => {
842
- const s = Ke(e, r);
907
+ const s = Pe(e, r);
843
908
  return s.length === 0 ? null : /* @__PURE__ */ t(
844
909
  "div",
845
910
  {
846
911
  className: r === "leading" ? "mb-4 space-y-4" : "mt-3 space-y-4",
847
912
  "data-read-live-slots": r,
848
- children: s.map((c) => /* @__PURE__ */ t("div", { children: R(
849
- { kind: "slot", field: c.a.field, group_key: c.a.group_key ?? null },
850
- c.node,
851
- K(c.a)
852
- ) }, c.key))
913
+ children: s.map((u) => /* @__PURE__ */ t("div", { children: R(
914
+ { kind: "slot", field: u.a.field, group_key: u.a.group_key ?? null },
915
+ u.node,
916
+ P(u.a)
917
+ ) }, u.key))
853
918
  }
854
919
  );
855
- }, [$e, We] = U({}), Fe = (e) => q || $e[e] === !0, [l, d] = U({}), o = bt(
920
+ }, [$e, We] = U({}), Fe = (e) => q || $e[e] === !0, [l, d] = U({}), c = bt(
856
921
  (e) => (r) => d((s) => s[e] === r ? s : { ...s, [e]: r }),
857
922
  []
858
- ), [b, L] = U({}), W = bt(
923
+ ), [x, L] = U({}), W = bt(
859
924
  (e) => (r) => L((s) => s[e] === r ? s : { ...s, [e]: r }),
860
925
  []
861
926
  ), re = (e) => {
862
- const r = de.filter((c) => c.group_key === e).sort((c, y) => c.sort - y.sort);
927
+ const r = de.filter((u) => u.group_key === e).sort((u, _) => u.sort - _.sort);
863
928
  if (r.length === 0) return null;
864
- const s = r.some((c) => Fe(c.field));
865
- return /* @__PURE__ */ t("div", { className: s ? "mt-3 space-y-4" : "hidden", "data-read-widgets": !0, children: r.map((c) => /* @__PURE__ */ t("div", { hidden: !Fe(c.field), children: R(
866
- { kind: "slot", field: c.field, group_key: c.group_key ?? null },
929
+ const s = r.some((u) => Fe(u.field));
930
+ return /* @__PURE__ */ t("div", { className: s ? "mt-3 space-y-4" : "hidden", "data-read-widgets": !0, children: r.map((u) => /* @__PURE__ */ t("div", { hidden: !Fe(u.field), children: R(
931
+ { kind: "slot", field: u.field, group_key: u.group_key ?? null },
867
932
  /* @__PURE__ */ t(
868
- Ol,
933
+ Ll,
869
934
  {
870
- widgetId: c.widget_id,
871
- inputBindings: Ie(c),
872
- itemDraft: f ?? {},
935
+ widgetId: u.widget_id,
936
+ inputBindings: Ie(u),
937
+ itemDraft: p ?? {},
873
938
  itemCollection: a,
874
- ready: !!f,
875
- label: c.label_override ?? void 0,
876
- defaultExpanded: c.default_expanded == null ? !0 : !!c.default_expanded,
877
- onContentChange: (y) => We(
878
- (B) => B[c.field] === y ? B : { ...B, [c.field]: y }
939
+ ready: !!p,
940
+ label: u.label_override ?? void 0,
941
+ defaultExpanded: u.default_expanded == null ? !0 : !!u.default_expanded,
942
+ onContentChange: (_) => We(
943
+ (j) => j[u.field] === _ ? j : { ...j, [u.field]: _ }
879
944
  )
880
945
  }
881
946
  ),
882
- K(c)
883
- ) }, c.field)) });
884
- }, [ne, qe] = U(() => /* @__PURE__ */ new Set()), ge = q || !f ? [] : wl({
885
- groups: g.groups.filter(
947
+ P(u)
948
+ ) }, u.field)) });
949
+ }, [ne, qe] = U(() => /* @__PURE__ */ new Set()), ge = q || !p ? [] : Sl({
950
+ groups: v.groups.filter(
886
951
  (e) => e.type !== "container" && e.visibility_mode !== "new_only"
887
952
  ),
888
- values: f,
953
+ values: p,
889
954
  fields: [...I.values()],
890
- choices: ql([...I.values()]),
891
- quiet: ll(g.layout.conditions),
892
- readable: (e) => Nl(
893
- g.assignments.filter((r) => r.group_key === e).map((r) => r.field),
894
- f,
955
+ choices: Ol([...I.values()]),
956
+ quiet: nl(v.layout.conditions),
957
+ readable: (e) => $l(
958
+ v.assignments.filter((r) => r.group_key === e).map((r) => r.field),
959
+ p,
895
960
  !!i
896
961
  )
897
- }), He = (e) => qe((r) => {
962
+ }), Ue = (e) => qe((r) => {
898
963
  const s = new Set(r);
899
964
  return s.has(e) ? s.delete(e) : s.add(e), s;
900
- }), rt = [...g.groups].sort((e, r) => e.sort - r.sort).filter((e) => q || e.visibility_mode !== "new_only").filter(
901
- (e) => q || !f || ne.has(e.key) || ul(e.visible_when, f)
902
- ), [qt, Ve] = U(() => /* @__PURE__ */ new Set()), ye = (e) => !e.is_collapsed || qt.has(e.key), Rt = (e) => Ve((r) => {
965
+ }), nt = [...v.groups].sort((e, r) => e.sort - r.sort).filter((e) => q || e.visibility_mode !== "new_only").filter(
966
+ (e) => q || !p || ne.has(e.key) || fl(e.visible_when, p)
967
+ ), [Ot, Ve] = U(() => /* @__PURE__ */ new Set()), ye = (e) => !e.is_collapsed || Ot.has(e.key), At = (e) => Ve((r) => {
903
968
  const s = new Set(r);
904
969
  return s.has(e) ? s.delete(e) : s.add(e), s;
905
- }), Re = (i == null ? void 0 : i.context.fold) ?? null, Ae = (i == null ? void 0 : i.context.reveal) ?? null;
970
+ }), Re = (i == null ? void 0 : i.context.fold) ?? null, Oe = (i == null ? void 0 : i.context.reveal) ?? null;
906
971
  fe(() => {
907
- Re && Ve(Re.open ? new Set(g.groups.map((e) => e.key)) : /* @__PURE__ */ new Set());
972
+ Re && Ve(Re.open ? new Set(v.groups.map((e) => e.key)) : /* @__PURE__ */ new Set());
908
973
  }, [Re == null ? void 0 : Re.seq]), fe(() => {
909
- const e = Ae ? Fl(Ae.target) : null;
974
+ const e = Oe ? Rl(Oe.target) : null;
910
975
  e && Ve((r) => r.has(e) ? r : new Set(r).add(e));
911
- }, [Ae == null ? void 0 : Ae.seq]);
976
+ }, [Oe == null ? void 0 : Oe.seq]);
912
977
  const Ge = [];
913
- for (const e of rt) {
978
+ for (const e of nt) {
914
979
  if (e.type === "container") {
915
- for (const r of rt.filter((s) => s.container_id != null && s.container_id === e.id))
980
+ for (const r of nt.filter((s) => s.container_id != null && s.container_id === e.id))
916
981
  Ge.push(r);
917
982
  continue;
918
983
  }
919
984
  e.container_id == null && Ge.push(e);
920
985
  }
921
- const J = (e) => {
986
+ const H = (e) => {
922
987
  var r;
923
988
  return !!((r = Y(e.field)) != null && r.junction_field);
924
- }, nt = (e) => {
989
+ }, at = (e) => {
925
990
  var s;
926
991
  const r = String(
927
992
  _e(e.overrides).interface ?? ((s = I.get(e.field)) == null ? void 0 : s.interface) ?? ""
928
993
  );
929
994
  return /rich|wysiwyg|editorjs/i.test(r);
930
- }, Ce = (e) => {
995
+ }, Ae = (e) => {
931
996
  const r = I.get(e.field), s = _e(e.overrides);
932
- if (s.summary_toggle === !0 && !i && v && f)
997
+ if (s.summary_toggle === !0 && !i && N && p)
933
998
  return /* @__PURE__ */ t(
934
- Bl,
999
+ Jl,
935
1000
  {
936
1001
  collection: a,
937
- itemId: String(v),
1002
+ itemId: String(N),
938
1003
  field: e.field,
939
- value: f[e.field],
1004
+ value: p[e.field],
940
1005
  label: ce(e)
941
1006
  }
942
1007
  );
943
1008
  if (Le(e.field)) {
944
- const M = il(s), ue = xl((M == null ? void 0 : M.expr) ?? "", f ?? {});
945
- return /* @__PURE__ */ t("span", { "data-display-formula": e.field, className: "tabular-nums", children: ue.error ? "—" : sl(ue.value, M ?? { format: "", currency: null }) });
1009
+ const K = dl(s), ue = _l((K == null ? void 0 : K.expr) ?? "", p ?? {});
1010
+ return /* @__PURE__ */ t("span", { "data-display-formula": e.field, className: "tabular-nums", children: ue.error ? "—" : ol(ue.value, K ?? { format: "", currency: null }) });
946
1011
  }
947
- const c = Y(e.field);
948
- if (i && !v && (c != null && c.junction_field)) return /* @__PURE__ */ t(le, {});
949
- if (c != null && c.junction_field && c.many_collection && c.many_field)
1012
+ const u = Y(e.field);
1013
+ if (i && !N && (u != null && u.junction_field)) return /* @__PURE__ */ t(le, {});
1014
+ if (u != null && u.junction_field && u.many_collection && u.many_field)
950
1015
  return /* @__PURE__ */ t(
951
- Ml,
1016
+ Vl,
952
1017
  {
953
- junction: c.many_collection,
954
- parentFk: c.many_field,
955
- junctionField: c.junction_field,
956
- parentId: v,
957
- onCount: o(e.field),
1018
+ junction: u.many_collection,
1019
+ parentFk: u.many_field,
1020
+ junctionField: u.junction_field,
1021
+ parentId: N,
1022
+ onCount: c(e.field),
958
1023
  onTarget: W(e.field),
959
- relation: c
1024
+ relation: u
960
1025
  }
961
1026
  );
962
- const y = f == null ? void 0 : f[e.field], B = be(e.field);
963
- if (B === "nivaro_users" && y != null)
964
- return /* @__PURE__ */ t("span", { className: "inline-block", children: /* @__PURE__ */ t(St, { userId: String(y), size: "compact" }) });
965
- if (B) return /* @__PURE__ */ t(lt, { collection: B, id: y });
966
- if ((r == null ? void 0 : r.type) === "boolean" && (y == null || y === "")) return /* @__PURE__ */ t(Be, { value: !1 });
967
- if (y == null || y === "") return /* @__PURE__ */ t(le, {});
1027
+ const _ = p == null ? void 0 : p[e.field], j = be(e.field);
1028
+ if (j === "nivaro_users" && _ != null)
1029
+ return /* @__PURE__ */ t("span", { className: "inline-block", children: /* @__PURE__ */ t(Ft, { userId: String(_), size: "compact" }) });
1030
+ if (j) return /* @__PURE__ */ t(rt, { collection: j, id: _ });
1031
+ if ((r == null ? void 0 : r.type) === "boolean" && (_ == null || _ === "")) return /* @__PURE__ */ t(je, { value: !1 });
1032
+ if (_ == null || _ === "") return /* @__PURE__ */ t(le, {});
968
1033
  if ((r == null ? void 0 : r.type) === "boolean")
969
1034
  return /* @__PURE__ */ t(
970
- Be,
1035
+ je,
971
1036
  {
972
- value: y,
1037
+ value: _,
973
1038
  trueTone: (s.options ?? {}).trueTone ?? "positive"
974
1039
  }
975
1040
  );
976
1041
  const te = s.options ?? {};
977
- return nt(e) && typeof y == "string" ? /^\s*\{/.test(y) ? /* @__PURE__ */ t("div", { className: "min-w-0 whitespace-pre-wrap font-normal [overflow-wrap:anywhere]", children: hl(y) }) : /* @__PURE__ */ t(
1042
+ return at(e) && typeof _ == "string" ? /^\s*\{/.test(_) ? /* @__PURE__ */ t("div", { className: "min-w-0 whitespace-pre-wrap font-normal [overflow-wrap:anywhere]", children: gl(_) }) : /* @__PURE__ */ t(
978
1043
  "div",
979
1044
  {
980
1045
  className: "rrv-prose min-w-0 font-normal leading-relaxed [overflow-wrap:anywhere] [&_a]:underline [&_h1]:text-[15px] [&_h1]:font-semibold [&_h2]:text-[14px] [&_h2]:font-semibold [&_h3]:font-semibold [&_li]:ml-4 [&_ol]:list-decimal [&_p]:my-1 [&_ul]:list-disc",
981
- dangerouslySetInnerHTML: { __html: cl(y) }
1046
+ dangerouslySetInnerHTML: { __html: ml(_) }
982
1047
  }
983
- ) : te.format === "currency" ? /* @__PURE__ */ t("span", { className: "tabular-nums", children: wt(y, { currency: $t(r) ?? "USD" }) || String(y) }) : r && et(r) && et(r) !== "plain" ? /* @__PURE__ */ t("span", { className: "tabular-nums", children: Nt(y, r) || String(y) }) : (r == null ? void 0 : r.type) === "date" || (r == null ? void 0 : r.type) === "datetime" || (r == null ? void 0 : r.type) === "timestamp" ? Ft(y) : String(y);
984
- }, At = (e) => {
1048
+ ) : te.format === "currency" ? /* @__PURE__ */ t("span", { className: "tabular-nums", children: St(_, { currency: qt(r) ?? "USD" }) || String(_) }) : r && tt(r) && tt(r) !== "plain" ? /* @__PURE__ */ t("span", { className: "tabular-nums", children: $t(_, r) || String(_) }) : (r == null ? void 0 : r.type) === "date" || (r == null ? void 0 : r.type) === "datetime" || (r == null ? void 0 : r.type) === "timestamp" ? Rt(_) : String(_);
1049
+ }, Ct = (e) => {
985
1050
  const r = _e(e.overrides), s = Y(e.field);
986
1051
  if (!(s != null && s.many_collection) || !s.many_field) return null;
987
- if (i && !v) return /* @__PURE__ */ t("p", { className: "py-3 text-[12px] text-slate-400", children: "No records" });
988
- const c = r.options ?? {}, y = (() => {
989
- var M;
990
- const te = (M = I.get(e.field)) == null ? void 0 : M.options;
1052
+ if (i && !N) return /* @__PURE__ */ t("p", { className: "py-3 text-[12px] text-slate-400", children: "No records" });
1053
+ const u = r.options ?? {}, _ = (() => {
1054
+ var K;
1055
+ const te = (K = I.get(e.field)) == null ? void 0 : K.options;
991
1056
  if (!te) return {};
992
1057
  if (typeof te == "string")
993
1058
  try {
@@ -996,52 +1061,52 @@ function vt({
996
1061
  return {};
997
1062
  }
998
1063
  return te;
999
- })(), B = c.layout_id ?? null;
1064
+ })(), j = u.layout_id ?? null;
1000
1065
  return /* @__PURE__ */ t(
1001
- jl,
1066
+ Gl,
1002
1067
  {
1003
1068
  collection: s.many_collection,
1004
1069
  fkField: s.many_field,
1005
- parentId: v,
1006
- layoutId: B,
1007
- presets: c.column_presets ?? y.column_presets,
1008
- defaultPreset: c.default_preset ?? y.default_preset ?? null,
1009
- onCount: o(e.field)
1070
+ parentId: N,
1071
+ layoutId: j,
1072
+ presets: u.column_presets ?? _.column_presets,
1073
+ defaultPreset: u.default_preset ?? _.default_preset ?? null,
1074
+ onCount: c(e.field)
1010
1075
  },
1011
1076
  e.field
1012
1077
  );
1013
- }, X = (e) => !!Y(e.field) && !J(e), Ct = !!g.layout.hide_empty, at = Array.isArray(g.layout.header_fields) ? g.layout.header_fields.filter((e) => typeof e == "string") : [], Ot = new Set(at), Tt = (e) => {
1014
- if (!f || J(e)) return !1;
1015
- const r = f[e.field];
1078
+ }, X = (e) => !!Y(e.field) && !H(e), Tt = !!v.layout.hide_empty, it = Array.isArray(v.layout.header_fields) ? v.layout.header_fields.filter((e) => typeof e == "string") : [], Lt = new Set(it), Dt = (e) => {
1079
+ if (!p || H(e)) return !1;
1080
+ const r = p[e.field];
1016
1081
  return r == null || r === "" || Array.isArray(r) && r.length === 0;
1017
- }, Lt = (e) => se.find((r) => r.field === e), ce = (e) => {
1018
- var c;
1019
- const r = _e(e.overrides).label, s = F ? al(e.overrides, F).label : void 0;
1020
- return s !== void 0 ? s : Le(e.field) ? typeof r == "string" && r.trim() ? r : "Formula" : typeof r == "string" && r.trim() ? r : e.label_override || ((c = I.get(e.field)) == null ? void 0 : c.label) || Xe(e.field);
1021
- }, Et = (e) => {
1022
- const r = Zt(e.swap_config), s = se.filter((n) => n.group_key === e.key && !Ot.has(n.field)).filter((n) => q || !f || !el(n.overrides) || !ve(f[n.field])).sort((n, O) => n.sort - O.sort), c = de.filter((n) => n.group_key === e.key), y = Ke(e.key), B = s.length === 0 && c.length === 0 && y.length === 0;
1023
- if (B && !i) return null;
1024
- const te = (n) => Ct && !q && (X(n) || J(n)) && ((m == null ? void 0 : m[n.field]) ?? l[n.field]) === 0, M = s.filter((n) => !X(n)), ue = s.filter(X), Me = c.filter((n) => Fe(n.field)), Pt = !e.hide_when_empty && y.length === 0 && Me.length === 0 && s.length > 0 && s.some((n) => X(n) || J(n)) && s.every(te), Je = (n) => !Pt && te(n), Kt = s.filter((n) => !Je(n)), xe = (n) => (m == null ? void 0 : m[n.field]) ?? l[n.field], Wt = !!e.hide_when_empty && !i && !q && !!f && y.length === 0 && Me.length === 0 && s.every((n) => X(n) || J(n) ? xe(n) === 0 : ve(f[n.field])) || !B && Kt.length === 0 && y.length === 0 && Me.length === 0, Mt = (n) => (m == null ? void 0 : m[n.field]) ?? l[n.field], Qe = !!r.emptyText && !!f && !i && y.length === 0 && Me.length === 0 && s.every((n) => X(n) || J(n) ? Mt(n) === 0 : ve(f[n.field])), jt = tl(M, { rows: r.rows }).units, ze = e.is_collapsed ? Ll(e.summary_fields).map((n) => {
1025
- const O = s.find((Oe) => Oe.field === n.field);
1026
- return O ? { a: O, label: n.label || ce(O) } : null;
1082
+ }, Et = (e) => se.find((r) => r.field === e), ce = (e) => {
1083
+ var u;
1084
+ const r = _e(e.overrides).label, s = S ? sl(e.overrides, S).label : void 0;
1085
+ return s !== void 0 ? s : Le(e.field) ? typeof r == "string" && r.trim() ? r : "Formula" : typeof r == "string" && r.trim() ? r : e.label_override || ((u = I.get(e.field)) == null ? void 0 : u.label) || Ze(e.field);
1086
+ }, Mt = (e) => {
1087
+ const r = tl(e.swap_config), s = se.filter((n) => n.group_key === e.key && !Lt.has(n.field)).filter((n) => q || !p || !ll(n.overrides) || !ve(p[n.field])).sort((n, C) => n.sort - C.sort), u = de.filter((n) => n.group_key === e.key), _ = Pe(e.key), j = s.length === 0 && u.length === 0 && _.length === 0;
1088
+ if (j && !i) return null;
1089
+ const te = (n) => Tt && !q && (X(n) || H(n)) && ((f == null ? void 0 : f[n.field]) ?? l[n.field]) === 0, K = s.filter((n) => !X(n)), ue = s.filter(X), Ke = u.filter((n) => Fe(n.field)), Wt = !e.hide_when_empty && _.length === 0 && Ke.length === 0 && s.length > 0 && s.some((n) => X(n) || H(n)) && s.every(te), Je = (n) => !Wt && te(n), Kt = s.filter((n) => !Je(n)), xe = (n) => (f == null ? void 0 : f[n.field]) ?? l[n.field], Bt = !!e.hide_when_empty && !i && !q && !!p && _.length === 0 && Ke.length === 0 && s.every((n) => X(n) || H(n) ? xe(n) === 0 : ve(p[n.field])) || !j && Kt.length === 0 && _.length === 0 && Ke.length === 0, jt = (n) => (f == null ? void 0 : f[n.field]) ?? l[n.field], Qe = !!r.emptyText && !!p && !i && _.length === 0 && Ke.length === 0 && s.every((n) => X(n) || H(n) ? jt(n) === 0 : ve(p[n.field])), It = rl(K, { rows: r.rows }).units, ze = e.is_collapsed ? El(e.summary_fields).map((n) => {
1090
+ const C = s.find((Ce) => Ce.field === n.field);
1091
+ return C ? { a: C, label: n.label || ce(C) } : null;
1027
1092
  }).filter((n) => !!n).filter(
1028
- ({ a: n }) => !e.summary_hide_empty || !f || (X(n) || J(n) ? xe(n) !== 0 : !ve(f[n.field]))
1029
- ).slice(0, Tl) : [], ct = e.read_width === "full" || e.read_width === "half" || e.read_width === "third" ? e.read_width : ue.length > 0 || c.length > 0 || y.length > 0 || M.length > 4 ? "full" : "half", Bt = (n) => {
1093
+ ({ a: n }) => !e.summary_hide_empty || !p || (X(n) || H(n) ? xe(n) !== 0 : !ve(p[n.field]))
1094
+ ).slice(0, Dl) : [], ut = e.read_width === "full" || e.read_width === "half" || e.read_width === "third" ? e.read_width : ue.length > 0 || u.length > 0 || _.length > 0 || K.length > 4 ? "full" : "half", Ht = (n) => {
1030
1095
  var ft, pt, ht;
1031
- const O = Je(n), Q = !!(_e(n.overrides).options ?? {}).emphasis, Te = nt(n) || !!((pt = (ft = I.get(n.field)) == null ? void 0 : ft.interface) != null && pt.includes("rich-text")), ut = f == null ? void 0 : f[n.field], mt = !Te && !J(n) && !be(n.field) && (String(((ht = I.get(n.field)) == null ? void 0 : ht.interface) ?? "").includes("textarea") || typeof ut == "string" && ut.length > 36);
1096
+ const C = Je(n), Q = !!(_e(n.overrides).options ?? {}).emphasis, Te = p == null ? void 0 : p[n.field], Ye = (at(n) || !!((pt = (ft = I.get(n.field)) == null ? void 0 : ft.interface) != null && pt.includes("rich-text"))) && !jl(Te), mt = !Ye && !H(n) && !be(n.field) && (String(((ht = I.get(n.field)) == null ? void 0 : ht.interface) ?? "").includes("textarea") || typeof Te == "string" && Te.length > 36);
1032
1097
  return /* @__PURE__ */ t(
1033
1098
  "div",
1034
1099
  {
1035
- hidden: O,
1036
- className: `min-w-0 ${Te || J(n) && (b[n.field] === "nivaro_files" || (l[n.field] ?? 0) > 3) ? "col-span-full" : Q || mt ? "col-span-2" : ""}`,
1100
+ hidden: C,
1101
+ className: `min-w-0 ${Ye || H(n) && (x[n.field] === "nivaro_files" || (l[n.field] ?? 0) > Bl) ? "col-span-full" : Q || mt || H(n) && (l[n.field] ?? 0) > 3 ? "col-span-2" : ""}`,
1037
1102
  children: R(
1038
- E(n),
1039
- /* @__PURE__ */ p(me, { children: [
1040
- /* @__PURE__ */ p("dt", { className: xt, "data-fact-label": !0, children: [
1103
+ D(n),
1104
+ /* @__PURE__ */ b(me, { children: [
1105
+ /* @__PURE__ */ b("dt", { className: xt, "data-fact-label": !0, children: [
1041
1106
  /* @__PURE__ */ t("span", { className: "max-w-full shrink-0 truncate", children: ce(n) }),
1042
1107
  /* @__PURE__ */ t(ie, { field: n.field }),
1043
1108
  /* @__PURE__ */ t(gt, { field: n.field }),
1044
- k(n.field)
1109
+ $(n.field)
1045
1110
  ] }),
1046
1111
  /* @__PURE__ */ t(
1047
1112
  "dd",
@@ -1049,39 +1114,39 @@ function vt({
1049
1114
  "data-replay-field": n.field,
1050
1115
  "data-field-collection": a,
1051
1116
  "data-remote-changed": pe.has(n.field) || void 0,
1052
- className: `mt-1 min-w-0${P(n.field)} ${Q ? "text-[17px] font-semibold tracking-[-0.01em] text-slate-900 dark:text-white" : `${J(n) || Te ? "" : mt ? "line-clamp-3 break-words " : "truncate "}text-[13px] font-medium text-slate-800 dark:text-slate-100`}`,
1053
- children: f ? Ce(n) : /* @__PURE__ */ t("span", { className: "inline-block h-3.5 w-20 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" })
1117
+ className: `mt-1 min-w-0${M(n.field)} ${Q ? "text-[17px] font-semibold tracking-[-0.01em] text-slate-900 dark:text-white" : `${H(n) || Ye ? "" : mt ? "line-clamp-3 break-words " : "truncate "}text-[13px] font-medium text-slate-800 dark:text-slate-100`}`,
1118
+ children: p ? Ae(n) : /* @__PURE__ */ t("span", { className: "inline-block h-3.5 w-20 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" })
1054
1119
  }
1055
1120
  )
1056
1121
  ] }),
1057
- K(n)
1122
+ P(n)
1058
1123
  )
1059
1124
  },
1060
1125
  n.field
1061
1126
  );
1062
- }, It = (n, O) => {
1063
- const Oe = f && !i ? O.filter((Q) => !ve(f[Q.field])) : O;
1064
- return /* @__PURE__ */ p(
1127
+ }, Ut = (n, C) => {
1128
+ const Ce = p && !i ? C.filter((Q) => !ve(p[Q.field])) : C;
1129
+ return /* @__PURE__ */ b(
1065
1130
  "div",
1066
1131
  {
1067
1132
  "data-read-row": n.key,
1068
- className: `min-w-0 ${O.length > 2 ? "col-span-full" : "col-span-2"}`,
1133
+ className: `min-w-0 ${C.length > 2 ? "col-span-full" : "col-span-2"}`,
1069
1134
  children: [
1070
- /* @__PURE__ */ t("dt", { className: tt, children: n.label.trim() || O.map(ce).join(" / ") }),
1071
- /* @__PURE__ */ t("dd", { className: "mt-1 flex min-w-0 flex-wrap items-baseline gap-x-1.5 text-[13px] font-medium text-slate-800 dark:text-slate-100", children: f ? Oe.length === 0 ? /* @__PURE__ */ t(le, {}) : Oe.map((Q, Te) => /* @__PURE__ */ p(Vt, { children: [
1135
+ /* @__PURE__ */ t("dt", { className: lt, children: n.label.trim() || C.map(ce).join(" / ") }),
1136
+ /* @__PURE__ */ t("dd", { className: "mt-1 flex min-w-0 flex-wrap items-baseline gap-x-1.5 text-[13px] font-medium text-slate-800 dark:text-slate-100", children: p ? Ce.length === 0 ? /* @__PURE__ */ t(le, {}) : Ce.map((Q, Te) => /* @__PURE__ */ b(Jt, { children: [
1072
1137
  Te > 0 && /* @__PURE__ */ t("span", { "aria-hidden": !0, className: "text-slate-300 dark:text-slate-600", children: "·" }),
1073
1138
  R(
1074
- E(Q),
1139
+ D(Q),
1075
1140
  /* @__PURE__ */ t(
1076
1141
  "span",
1077
1142
  {
1078
1143
  "data-replay-field": Q.field,
1079
1144
  "data-field-collection": a,
1080
- className: `min-w-0 break-words${P(Q.field)}`,
1081
- children: Ce(Q)
1145
+ className: `min-w-0 break-words${M(Q.field)}`,
1146
+ children: Ae(Q)
1082
1147
  }
1083
1148
  ),
1084
- K(Q)
1149
+ P(Q)
1085
1150
  )
1086
1151
  ] }, Q.field)) : /* @__PURE__ */ t("span", { className: "inline-block h-3.5 w-28 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }) })
1087
1152
  ]
@@ -1092,25 +1157,25 @@ function vt({
1092
1157
  return /* @__PURE__ */ t(
1093
1158
  "section",
1094
1159
  {
1095
- hidden: Wt,
1160
+ hidden: Bt,
1096
1161
  "data-read-section": e.key,
1097
- "data-read-width": ct,
1162
+ "data-read-width": ut,
1098
1163
  className: "min-w-0 rounded-xl border border-slate-200 bg-white dark:border-slate-700/60 dark:bg-slate-900/40",
1099
1164
  children: R(
1100
1165
  { kind: "group", key: e.key },
1101
- /* @__PURE__ */ p(me, { children: [
1102
- /* @__PURE__ */ p(
1166
+ /* @__PURE__ */ b(me, { children: [
1167
+ /* @__PURE__ */ b(
1103
1168
  "h2",
1104
1169
  {
1105
1170
  "data-read-head": "",
1106
1171
  className: `group/rs relative flex items-center justify-between gap-2 px-5 py-2.5 text-[12.5px] font-semibold text-slate-700 dark:text-slate-200 ${ye(e) ? "border-b border-slate-100 dark:border-slate-800" : ""}`,
1107
1172
  children: [
1108
- e.is_collapsed ? /* @__PURE__ */ p(me, { children: [
1173
+ e.is_collapsed ? /* @__PURE__ */ b(me, { children: [
1109
1174
  /* @__PURE__ */ t(
1110
1175
  "button",
1111
1176
  {
1112
1177
  type: "button",
1113
- onClick: () => Rt(e.key),
1178
+ onClick: () => At(e.key),
1114
1179
  "aria-expanded": ye(e),
1115
1180
  className: `min-w-0 text-left after:absolute after:inset-0 group-hover/rs:text-slate-900 dark:group-hover/rs:text-white ${ze.length > 0 && !ye(e) ? "shrink-0" : "flex-1"}`,
1116
1181
  children: e.label
@@ -1123,30 +1188,30 @@ function vt({
1123
1188
  {
1124
1189
  "data-read-collapsed-summary": e.key,
1125
1190
  className: "pointer-events-none flex min-w-0 flex-1 items-baseline gap-x-3 overflow-hidden whitespace-nowrap text-[12px] font-normal",
1126
- children: ze.map(({ a: n, label: O }) => /* @__PURE__ */ p("span", { className: "flex min-w-0 shrink items-baseline gap-1", children: [
1127
- /* @__PURE__ */ t("span", { className: "shrink-0 text-[10px] font-semibold uppercase tracking-wider text-slate-400 dark:text-slate-500", children: O }),
1128
- /* @__PURE__ */ t("span", { className: "min-w-0 truncate font-medium text-slate-700 dark:text-slate-300", children: f ? X(n) || J(n) ? xe(n) == null ? "…" : `${xe(n)} ${X(n) ? xe(n) === 1 ? "row" : "rows" : xe(n) === 1 ? "item" : "items"}` : ve(f[n.field]) ? /* @__PURE__ */ t("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }) : Ce(n) : "…" })
1191
+ children: ze.map(({ a: n, label: C }) => /* @__PURE__ */ b("span", { className: "flex min-w-0 shrink items-baseline gap-1", children: [
1192
+ /* @__PURE__ */ t("span", { className: "shrink-0 text-[10px] font-semibold uppercase tracking-wider text-slate-400 dark:text-slate-500", children: C }),
1193
+ /* @__PURE__ */ t("span", { className: "min-w-0 truncate font-medium text-slate-700 dark:text-slate-300", children: p ? X(n) || H(n) ? xe(n) == null ? "…" : `${xe(n)} ${X(n) ? xe(n) === 1 ? "row" : "rows" : xe(n) === 1 ? "item" : "items"}` : ve(p[n.field]) ? /* @__PURE__ */ t("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }) : Ae(n) : "…" })
1129
1194
  ] }, n.field))
1130
1195
  }
1131
1196
  )
1132
1197
  ] }) : /* @__PURE__ */ t("span", { className: "min-w-0 flex-1", children: e.label }),
1133
- w && (M.length > 0 || ue.length > 0) && /* @__PURE__ */ t(
1198
+ k && (K.length > 0 || ue.length > 0) && /* @__PURE__ */ t(
1134
1199
  "button",
1135
1200
  {
1136
1201
  type: "button",
1137
1202
  "data-read-edit-section": e.key,
1138
1203
  onClick: () => {
1139
- var n, O;
1140
- return w(e.key, ((n = M[0]) == null ? void 0 : n.field) ?? ((O = ue[0]) == null ? void 0 : O.field) ?? null);
1204
+ var n, C;
1205
+ return k(e.key, ((n = K[0]) == null ? void 0 : n.field) ?? ((C = ue[0]) == null ? void 0 : C.field) ?? null);
1141
1206
  },
1142
1207
  title: `Edit ${e.label}`,
1143
1208
  "aria-label": `Edit ${e.label}`,
1144
1209
  className: "relative -my-1 rounded p-1 text-slate-400 opacity-0 transition-opacity hover:bg-slate-100 hover:text-slate-700 focus-visible:opacity-100 group-hover/rs:opacity-100 dark:hover:bg-white/5 dark:hover:text-slate-200 motion-reduce:transition-none",
1145
- children: /* @__PURE__ */ t(Ut, { className: "h-3 w-3" })
1210
+ children: /* @__PURE__ */ t(Vt, { className: "h-3 w-3" })
1146
1211
  }
1147
1212
  ),
1148
1213
  e.is_collapsed && /* @__PURE__ */ t(
1149
- Ht,
1214
+ Gt,
1150
1215
  {
1151
1216
  "aria-hidden": "true",
1152
1217
  className: `pointer-events-none h-3.5 w-3.5 shrink-0 transition-transform group-hover/rs:text-slate-700 dark:group-hover/rs:text-slate-200 ${ye(e) ? "" : "-rotate-90"}`
@@ -1155,7 +1220,7 @@ function vt({
1155
1220
  ]
1156
1221
  }
1157
1222
  ),
1158
- /* @__PURE__ */ p("div", { "data-read-body": "", className: "px-5 pb-5 pt-4", hidden: !ye(e), children: [
1223
+ /* @__PURE__ */ b("div", { "data-read-body": "", className: "px-5 pb-5 pt-4", hidden: !ye(e), children: [
1159
1224
  Qe && /* @__PURE__ */ t(
1160
1225
  "p",
1161
1226
  {
@@ -1164,7 +1229,7 @@ function vt({
1164
1229
  children: r.emptyText
1165
1230
  }
1166
1231
  ),
1167
- M.length > 0 && // One column rhythm for the whole page: every section's facts sit
1232
+ K.length > 0 && // One column rhythm for the whole page: every section's facts sit
1168
1233
  // on the same 2 / 3 / 4 / 6 tracks, so values line up card to
1169
1234
  // card instead of each card auto-filling its own grid. Hidden, not
1170
1235
  // unrendered, under the empty text: its link facts must keep reporting.
@@ -1172,37 +1237,37 @@ function vt({
1172
1237
  "dl",
1173
1238
  {
1174
1239
  className: "grid gap-x-6 gap-y-5",
1175
- "data-read-dl": ct,
1240
+ "data-read-dl": ut,
1176
1241
  style: Qe ? { display: "none" } : void 0,
1177
- children: jt.map(
1178
- (n) => n.kind === "row" ? It(n.row, n.members) : Bt(n.field)
1242
+ children: It.map(
1243
+ (n) => n.kind === "row" ? Ut(n.row, n.members) : Ht(n.field)
1179
1244
  )
1180
1245
  }
1181
1246
  ),
1182
1247
  ue.map((n) => {
1183
- var O;
1248
+ var C;
1184
1249
  return /* @__PURE__ */ t(
1185
1250
  "div",
1186
1251
  {
1187
- className: M.length > 0 ? "mt-3" : "",
1252
+ className: K.length > 0 ? "mt-3" : "",
1188
1253
  hidden: Je(n) || Qe,
1189
1254
  children: R(
1190
- E(n),
1191
- /* @__PURE__ */ p(me, { children: [
1192
- (O = A == null ? void 0 : A.get(n.field)) != null && O.length ? /* @__PURE__ */ p("div", { className: "mb-1.5 flex items-center gap-1.5 text-[11px] font-medium text-amber-700 dark:text-amber-300", children: [
1255
+ D(n),
1256
+ /* @__PURE__ */ b(me, { children: [
1257
+ (C = O == null ? void 0 : O.get(n.field)) != null && C.length ? /* @__PURE__ */ b("div", { className: "mb-1.5 flex items-center gap-1.5 text-[11px] font-medium text-amber-700 dark:text-amber-300", children: [
1193
1258
  /* @__PURE__ */ t("span", { children: ce(n) }),
1194
1259
  /* @__PURE__ */ t(ie, { field: n.field }),
1195
- /* @__PURE__ */ p("span", { className: "font-normal text-amber-700/80 dark:text-amber-300/80", children: [
1260
+ /* @__PURE__ */ b("span", { className: "font-normal text-amber-700/80 dark:text-amber-300/80", children: [
1196
1261
  "— ",
1197
- A.get(n.field).length,
1262
+ O.get(n.field).length,
1198
1263
  " line issue",
1199
- A.get(n.field).length === 1 ? "" : "s",
1264
+ O.get(n.field).length === 1 ? "" : "s",
1200
1265
  "; switch to Edit to fix"
1201
1266
  ] })
1202
1267
  ] }) : null,
1203
- (S ? S(n) : null) ?? At(n)
1268
+ (g ? g(n) : null) ?? Ct(n)
1204
1269
  ] }),
1205
- K(n)
1270
+ P(n)
1206
1271
  )
1207
1272
  },
1208
1273
  n.field
@@ -1210,7 +1275,7 @@ function vt({
1210
1275
  }),
1211
1276
  re(e.key),
1212
1277
  Se(e.key),
1213
- B && i && /* @__PURE__ */ t(
1278
+ j && i && /* @__PURE__ */ t(
1214
1279
  "div",
1215
1280
  {
1216
1281
  "data-design-drop": e.key,
@@ -1225,14 +1290,14 @@ function vt({
1225
1290
  },
1226
1291
  e.key
1227
1292
  );
1228
- }, it = Se(null), Dt = Se(null, "leading"), st = at.map((e) => Lt(e)).filter((e) => !!e && !X(e)).filter((e) => q || !Tt(e)), [ae, ...dt] = st;
1229
- return /* @__PURE__ */ p(
1293
+ }, st = Se(null), Pt = Se(null, "leading"), dt = it.map((e) => Et(e)).filter((e) => !!e && !X(e)).filter((e) => q || !Dt(e)), [ae, ...ot] = dt;
1294
+ return /* @__PURE__ */ b(
1230
1295
  "div",
1231
1296
  {
1232
- className: N ? "min-h-0 flex-1" : "min-h-0 flex-1 overflow-y-auto bg-slate-50/60 px-5 py-4 dark:bg-transparent",
1297
+ className: w ? "min-h-0 flex-1" : "min-h-0 flex-1 overflow-y-auto bg-slate-50/60 px-5 py-4 dark:bg-transparent",
1233
1298
  children: [
1234
- Dt,
1235
- st.length > 0 && /* @__PURE__ */ p(
1299
+ Pt,
1300
+ dt.length > 0 && /* @__PURE__ */ b(
1236
1301
  "div",
1237
1302
  {
1238
1303
  "data-read-header": !0,
@@ -1240,8 +1305,8 @@ function vt({
1240
1305
  children: [
1241
1306
  ae && R(
1242
1307
  { kind: "header", field: ae.field },
1243
- /* @__PURE__ */ p("div", { className: "min-w-0", children: [
1244
- /* @__PURE__ */ p("p", { className: tt, children: [
1308
+ /* @__PURE__ */ b("div", { className: "min-w-0", children: [
1309
+ /* @__PURE__ */ b("p", { className: lt, children: [
1245
1310
  ce(ae),
1246
1311
  /* @__PURE__ */ t(ie, { field: ae.field })
1247
1312
  ] }),
@@ -1250,21 +1315,21 @@ function vt({
1250
1315
  {
1251
1316
  "data-replay-field": ae.field,
1252
1317
  "data-field-collection": a,
1253
- className: `truncate text-[22px] font-semibold leading-tight tracking-[-0.015em] text-slate-900 dark:text-white${P(ae.field)}`,
1254
- children: f ? Ce(ae) : "…"
1318
+ className: `truncate text-[22px] font-semibold leading-tight tracking-[-0.015em] text-slate-900 dark:text-white${M(ae.field)}`,
1319
+ children: p ? Ae(ae) : "…"
1255
1320
  }
1256
1321
  )
1257
1322
  ] }),
1258
- K(ae)
1323
+ P(ae)
1259
1324
  ),
1260
- dt.length > 0 && /* @__PURE__ */ t("dl", { className: "mt-3 flex flex-wrap gap-x-8 gap-y-2", children: dt.map((e) => /* @__PURE__ */ t("div", { className: "min-w-0", children: R(
1325
+ ot.length > 0 && /* @__PURE__ */ t("dl", { className: "mt-3 flex flex-wrap gap-x-8 gap-y-2", children: ot.map((e) => /* @__PURE__ */ t("div", { className: "min-w-0", children: R(
1261
1326
  { kind: "header", field: e.field },
1262
- /* @__PURE__ */ p(me, { children: [
1263
- /* @__PURE__ */ p("dt", { className: xt, children: [
1327
+ /* @__PURE__ */ b(me, { children: [
1328
+ /* @__PURE__ */ b("dt", { className: xt, children: [
1264
1329
  /* @__PURE__ */ t("span", { className: "max-w-full shrink-0 truncate", children: ce(e) }),
1265
1330
  /* @__PURE__ */ t(ie, { field: e.field }),
1266
1331
  /* @__PURE__ */ t(gt, { field: e.field }),
1267
- k(e.field)
1332
+ $(e.field)
1268
1333
  ] }),
1269
1334
  /* @__PURE__ */ t(
1270
1335
  "dd",
@@ -1272,85 +1337,88 @@ function vt({
1272
1337
  "data-replay-field": e.field,
1273
1338
  "data-field-collection": a,
1274
1339
  "data-remote-changed": pe.has(e.field) || void 0,
1275
- className: `mt-0.5 truncate text-[13px] font-medium text-slate-800 dark:text-slate-100${P(e.field)}`,
1276
- children: f ? Ce(e) : "…"
1340
+ className: `mt-0.5 truncate text-[13px] font-medium text-slate-800 dark:text-slate-100${M(e.field)}`,
1341
+ children: p ? Ae(e) : "…"
1277
1342
  }
1278
1343
  )
1279
1344
  ] }),
1280
- K(e)
1345
+ P(e)
1281
1346
  ) }, e.field)) })
1282
1347
  ]
1283
1348
  }
1284
1349
  ),
1285
- /* @__PURE__ */ t("style", { children: Pl }),
1286
- V && ge.length > 0 && /* @__PURE__ */ t("div", { className: "mb-3", children: /* @__PURE__ */ t(vl, { items: ge, revealed: ne, onToggle: He }) }),
1287
- V ? /* @__PURE__ */ t("div", { className: "grid items-stretch gap-4", "data-read-board": !0, children: Ge.map(Et) }) : /* @__PURE__ */ p("div", { className: "flex flex-col gap-4", "data-read-board-pending": !0, children: [
1350
+ /* @__PURE__ */ t("style", { children: Il }),
1351
+ G && ge.length > 0 && /* @__PURE__ */ t("div", { className: "mb-3", children: /* @__PURE__ */ t(kl, { items: ge, revealed: ne, onToggle: Ue }) }),
1352
+ G ? /* @__PURE__ */ t("div", { className: "grid items-stretch gap-4", "data-read-board": !0, ref: Kl, children: Ge.map(Mt) }) : /* @__PURE__ */ b("div", { className: "flex flex-col gap-4", "data-read-board-pending": !0, children: [
1288
1353
  /* @__PURE__ */ t("div", { className: "h-32 animate-pulse rounded-xl bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }),
1289
1354
  /* @__PURE__ */ t("div", { className: "h-32 animate-pulse rounded-xl bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }),
1290
1355
  /* @__PURE__ */ t("div", { className: "h-56 animate-pulse rounded-xl bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" })
1291
1356
  ] }),
1292
- it && /* @__PURE__ */ t("div", { className: "mt-4", children: it })
1357
+ st && /* @__PURE__ */ t("div", { className: "mt-4", children: st })
1293
1358
  ]
1294
1359
  }
1295
1360
  );
1296
1361
  }
1297
- function Cr(a) {
1298
- return a.design ? /* @__PURE__ */ t($l, { design: a.design.context, onRefusedWrite: a.design.onRefusedWrite, children: /* @__PURE__ */ t(Gt.Provider, { value: null, children: /* @__PURE__ */ t(vt, { ...a }) }) }) : /* @__PURE__ */ t(vt, { ...a });
1362
+ function Mr(a) {
1363
+ return a.design ? /* @__PURE__ */ t(ql, { design: a.design.context, onRefusedWrite: a.design.onRefusedWrite, children: /* @__PURE__ */ t(Qt.Provider, { value: null, children: /* @__PURE__ */ t(kt, { ...a }) }) }) : /* @__PURE__ */ t(kt, { ...a });
1299
1364
  }
1300
- function Bl({
1365
+ function Jl({
1301
1366
  collection: a,
1302
- itemId: u,
1303
- field: h,
1367
+ itemId: o,
1368
+ field: m,
1304
1369
  value: i,
1305
- label: N
1370
+ label: w
1306
1371
  }) {
1307
- const _ = we(), x = _t(), [S, w] = U(null), m = S ?? (i === !0 || i === 1 || i === "1" || i === "true"), C = async () => {
1308
- if (S !== null) return;
1309
- const F = !m;
1310
- w(F);
1372
+ const y = we(), h = wt(), [g, k] = U(null), f = g ?? (i === !0 || i === 1 || i === "1" || i === "true"), A = async () => {
1373
+ if (g !== null) return;
1374
+ const S = !f;
1375
+ k(S);
1311
1376
  try {
1312
- await _.request(Yt(`/items/${a}/${u}`, { [h]: F })), await Promise.all([
1313
- x.invalidateQueries({ queryKey: ["rrv-record", a, u] }),
1314
- x.invalidateQueries({ queryKey: ["item", a, u] })
1315
- ]), dl(x, a, u);
1377
+ await y.request(Zt(`/items/${a}/${o}`, { [m]: S })), await Promise.all([
1378
+ h.invalidateQueries({ queryKey: ["rrv-record", a, o] }),
1379
+ h.invalidateQueries({ queryKey: ["item", a, o] })
1380
+ ]), cl(h, a, o);
1316
1381
  } catch (T) {
1317
- Xt(T, "Could not save that change");
1382
+ el(T, "Could not save that change");
1318
1383
  } finally {
1319
- w(null);
1384
+ k(null);
1320
1385
  }
1321
1386
  };
1322
- return /* @__PURE__ */ p(
1387
+ return /* @__PURE__ */ b(
1323
1388
  "button",
1324
1389
  {
1325
1390
  type: "button",
1326
1391
  role: "switch",
1327
- "aria-checked": m,
1328
- "aria-label": typeof N == "string" ? N : h,
1329
- disabled: S !== null,
1330
- onClick: () => void C(),
1331
- "data-summary-toggle": h,
1392
+ "aria-checked": f,
1393
+ "aria-label": typeof w == "string" ? w : m,
1394
+ disabled: g !== null,
1395
+ onClick: () => void A(),
1396
+ "data-summary-toggle": m,
1332
1397
  className: "group inline-flex items-center gap-2 rounded-md py-0.5 text-[13px] font-medium text-slate-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan disabled:opacity-60 dark:text-slate-100",
1333
1398
  children: [
1334
1399
  /* @__PURE__ */ t(
1335
1400
  "span",
1336
1401
  {
1337
1402
  "aria-hidden": !0,
1338
- className: `relative inline-flex h-[18px] w-8 shrink-0 items-center rounded-full transition-colors ${m ? "bg-nvr-cyan" : "bg-slate-300 dark:bg-slate-600"}`,
1403
+ className: `relative inline-flex h-[18px] w-8 shrink-0 items-center rounded-full transition-colors ${f ? "bg-nvr-cyan" : "bg-slate-300 dark:bg-slate-600"}`,
1339
1404
  children: /* @__PURE__ */ t(
1340
1405
  "span",
1341
1406
  {
1342
- className: `inline-block h-3.5 w-3.5 rounded-full bg-white shadow transition-transform ${m ? "translate-x-[16px]" : "translate-x-[2px]"}`
1407
+ className: `inline-block h-3.5 w-3.5 rounded-full bg-white shadow transition-transform ${f ? "translate-x-[16px]" : "translate-x-[2px]"}`
1343
1408
  }
1344
1409
  )
1345
1410
  }
1346
1411
  ),
1347
- m ? "Yes" : "No"
1412
+ f ? "Yes" : "No"
1348
1413
  ]
1349
1414
  }
1350
1415
  );
1351
1416
  }
1352
1417
  export {
1353
- Tl as COLLAPSED_SUMMARY_MAX,
1354
- Cr as RecordReadView,
1355
- Ll as collapsedSummaryEntries
1418
+ Dl as COLLAPSED_SUMMARY_MAX,
1419
+ Mr as RecordReadView,
1420
+ El as collapsedSummaryEntries,
1421
+ Wl as fillBoardRowsNow,
1422
+ jl as isBlankRich,
1423
+ _t as nestedTemplatePaths
1356
1424
  };