@nivaro/react 0.3.40 → 0.3.42

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