@nivaro/react 0.2.54 → 0.2.55

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