@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,24 +1,28 @@
1
- import { jsx as e, jsxs as N } from "react/jsx-runtime";
2
- import { useQuery as ie, useQueryClient as ct } from "@tanstack/react-query";
3
- import * as dt from "lucide-react";
4
- import { ChevronDown as ut, Loader2 as mt, User as pt, Mail as ft } from "lucide-react";
5
- import Ae, { useState as Z, useRef as pe, useEffect as fe } from "react";
6
- import { fieldDrilldownConfig as ht, useDrilldown as bt, useOptionalNivaroClient as se, useNavigation as gt } from "../../context.js";
7
- import { get as Ee, post as xt } from "../../lib/commands.js";
8
- import { useRecordReader as Ye } from "../../lib/record-loader.js";
9
- import { choiceLabel as yt, titleCase as Qe, cn as re } from "../../lib/utils.js";
10
- import { DesignDropZone as Nt, designWrap as _t } from "../layout-editor/DesignNode.js";
11
- import { useLayoutDesign as wt, revealGroupKey as vt } from "../layout-editor/design-context.js";
12
- import { UserAvatar as St } from "../UserAvatar.js";
13
- import { DropdownMenu as kt, DropdownMenuTrigger as Dt, DropdownMenuContent as $t, DropdownMenuItem as Je } from "../ui/dropdown-menu.js";
14
- import { WidgetSlot as Pe } from "../WidgetSlot.js";
15
- import { FieldRow as Ve } from "./FieldRow.js";
16
- import { useFormHelpVideos as Ft, FormHelpVideoButton as jt } from "./FormHelpVideoButton.js";
17
- import { applyDisplayTemplate as Ot, useContainerWidth as Lt, resolveColSpan as Ce } from "./helpers.js";
18
- import { SectionIntro as Bt } from "./LayoutContentBlock.js";
19
- import { UserChip as Ze, OwnersInline as Ke, OwnersInlineCompact as qt } from "./UserChip.js";
20
- import { UserRosterCluster as on } from "./UserChip.js";
21
- function Re(t) {
1
+ import { jsx as e, jsxs as x, Fragment as _t } from "react/jsx-runtime";
2
+ import { useQuery as de, useQueryClient as wt } from "@tanstack/react-query";
3
+ import * as vt from "lucide-react";
4
+ import { ChevronDown as St, Loader2 as kt, User as Dt, Mail as $t } from "lucide-react";
5
+ import nt, { useState as Q, useRef as Se, useEffect as ne } from "react";
6
+ import { fieldDrilldownConfig as Ft, useDrilldown as jt, useOptionalNivaroClient as ue, useNavigation as Lt } from "../../context.js";
7
+ import { get as rt, post as Ot } from "../../lib/commands.js";
8
+ import { planFieldGrid as qt, isEmptyValue as Bt, isFolded as Ut, readGroupStructure as Tt } from "../../lib/form-structure.js";
9
+ import { reportSectionUse as it } from "../../lib/form-usage-beacon.js";
10
+ import { useRecordReader as st } from "../../lib/record-loader.js";
11
+ import { choiceLabel as It, titleCase as lt, cn as W } from "../../lib/utils.js";
12
+ import { DesignDropZone as Mt, designWrap as Gt } from "../layout-editor/DesignNode.js";
13
+ import { useLayoutDesign as Vt, revealGroupKey as Pt } from "../layout-editor/design-context.js";
14
+ import { GridGuides as we } from "../layout-editor/grid-guides.js";
15
+ import { UserAvatar as Ct } from "../UserAvatar.js";
16
+ import { DropdownMenu as Jt, DropdownMenuTrigger as Rt, DropdownMenuContent as zt, DropdownMenuItem as We } from "../ui/dropdown-menu.js";
17
+ import { WidgetSlot as Ae } from "../WidgetSlot.js";
18
+ import { FieldRow as ve } from "./FieldRow.js";
19
+ import { FoldArea as Kt, RowGroupCell as Ht, rowMemberField as Wt } from "./form-structure-ui.js";
20
+ import { useFormHelpVideos as At, FormHelpVideoButton as Et } from "./FormHelpVideoButton.js";
21
+ import { applyDisplayTemplate as Yt, useContainerWidth as Qt, resolveColSpan as Ee } from "./helpers.js";
22
+ import { SectionIntro as Zt } from "./LayoutContentBlock.js";
23
+ import { UserChip as at, OwnersInline as Ye, OwnersInlineCompact as Xt } from "./UserChip.js";
24
+ import { UserRosterCluster as Bn } from "./UserChip.js";
25
+ function Qe(t) {
22
26
  if (typeof t != "string") return t ?? [];
23
27
  try {
24
28
  return JSON.parse(t);
@@ -26,94 +30,94 @@ function Re(t) {
26
30
  return [];
27
31
  }
28
32
  }
29
- function It({
33
+ function en({
30
34
  relCollection: t,
31
35
  relId: r,
32
36
  entries: i,
33
37
  separator: u
34
38
  }) {
35
- const s = se(), l = Ye(), n = String(r), p = i.some((b) => b.field.includes(".")) ? ["id", ...i.map((b) => b.field)].join(",") : null, { data: h } = ie({
36
- queryKey: ["inline-display", t, n, p],
37
- queryFn: () => l(t, n, p),
39
+ const s = ue(), l = st(), n = String(r), m = i.some((g) => g.field.includes(".")) ? ["id", ...i.map((g) => g.field)].join(",") : null, { data: h } = de({
40
+ queryKey: ["inline-display", t, n, m],
41
+ queryFn: () => l(t, n, m),
38
42
  enabled: !!s && !!n,
39
43
  staleTime: 6e4
40
44
  });
41
45
  if (!h) return null;
42
- const v = (b) => {
46
+ const k = (g) => {
43
47
  let f = h;
44
- for (const g of b.split(".")) {
48
+ for (const y of g.split(".")) {
45
49
  if (f == null || typeof f != "object") return;
46
- f = f[g];
50
+ f = f[y];
47
51
  }
48
52
  return f;
49
53
  };
50
54
  if (u != null) {
51
- const b = ($) => {
52
- const _ = v($.field);
53
- if (_ == null || _ === "") return null;
54
- const w = $.format ?? "text";
55
- if (w === "date" || w === "datetime")
55
+ const g = (L) => {
56
+ const S = k(L.field);
57
+ if (S == null || S === "") return null;
58
+ const D = L.format ?? "text";
59
+ if (D === "date" || D === "datetime")
56
60
  try {
57
- return new Date(String(_)).toLocaleDateString();
61
+ return new Date(String(S)).toLocaleDateString();
58
62
  } catch {
59
- return String(_);
63
+ return String(S);
60
64
  }
61
- return w === "boolean" ? _ ? "Yes" : "No" : String(_);
65
+ return D === "boolean" ? S ? "Yes" : "No" : String(S);
62
66
  }, f = [];
63
- let g = [];
64
- for (const $ of i)
65
- $.line_break && g.length > 0 ? (f.push(g), g = [$]) : g.push($);
66
- g.length > 0 && f.push(g);
67
- const O = f.map(
68
- ($) => $.map((_) => {
69
- const w = b(_);
70
- return w ? { label: _.label ?? null, display: w } : null;
67
+ let y = [];
68
+ for (const L of i)
69
+ L.line_break && y.length > 0 ? (f.push(y), y = [L]) : y.push(L);
70
+ y.length > 0 && f.push(y);
71
+ const q = f.map(
72
+ (L) => L.map((S) => {
73
+ const D = g(S);
74
+ return D ? { label: S.label ?? null, display: D } : null;
71
75
  }).filter(Boolean)
72
- ).filter(($) => $.length > 0);
73
- return O.length === 0 ? null : /* @__PURE__ */ e("div", { className: "mt-1", children: O.map(($, _) => (
76
+ ).filter((L) => L.length > 0);
77
+ return q.length === 0 ? null : /* @__PURE__ */ e("div", { className: "mt-1", children: q.map((L, S) => (
74
78
  // biome-ignore lint/suspicious/noArrayIndexKey: stable line order
75
- /* @__PURE__ */ e("p", { className: "text-[12px] text-slate-500 dark:text-slate-400", children: $.map((w, P) => (
79
+ /* @__PURE__ */ e("p", { className: "text-[12px] text-slate-500 dark:text-slate-400", children: L.map((D, J) => (
76
80
  // biome-ignore lint/suspicious/noArrayIndexKey: stable token order
77
- /* @__PURE__ */ N(Ae.Fragment, { children: [
78
- P > 0 && u,
79
- w.label && /* @__PURE__ */ N("span", { className: "font-semibold text-slate-600 dark:text-slate-300", children: [
80
- w.label,
81
+ /* @__PURE__ */ x(nt.Fragment, { children: [
82
+ J > 0 && u,
83
+ D.label && /* @__PURE__ */ x("span", { className: "font-semibold text-slate-600 dark:text-slate-300", children: [
84
+ D.label,
81
85
  ":"
82
86
  ] }),
83
- w.label ? " " : "",
84
- w.display
85
- ] }, P)
86
- )) }, _)
87
+ D.label ? " " : "",
88
+ D.display
89
+ ] }, J)
90
+ )) }, S)
87
91
  )) });
88
92
  }
89
- const c = i.map((b) => {
90
- const f = v(b.field);
93
+ const o = i.map((g) => {
94
+ const f = k(g.field);
91
95
  if (f == null || f === "") return null;
92
- const g = b.format ?? "text";
93
- let O;
94
- if (g === "date" || g === "datetime")
96
+ const y = g.format ?? "text";
97
+ let q;
98
+ if (y === "date" || y === "datetime")
95
99
  try {
96
- O = new Date(String(f)).toLocaleDateString();
100
+ q = new Date(String(f)).toLocaleDateString();
97
101
  } catch {
98
- O = String(f);
102
+ q = String(f);
99
103
  }
100
- else g === "boolean" ? O = f ? "Yes" : "No" : O = String(f);
101
- return { label: b.label, display: O };
104
+ else y === "boolean" ? q = f ? "Yes" : "No" : q = String(f);
105
+ return { label: g.label, display: q };
102
106
  }).filter(Boolean);
103
- return c.length === 0 ? null : /* @__PURE__ */ e("div", { className: "mt-1 rounded border border-slate-200 bg-slate-50 dark:border-slate-700 dark:bg-slate-800/50 px-3 py-1.5 space-y-0.5", children: c.map((b, f) => (
107
+ return o.length === 0 ? null : /* @__PURE__ */ e("div", { className: "mt-1 rounded border border-slate-200 bg-slate-50 dark:border-slate-700 dark:bg-slate-800/50 px-3 py-1.5 space-y-0.5", children: o.map((g, f) => (
104
108
  // biome-ignore lint/suspicious/noArrayIndexKey: stable order from config
105
- /* @__PURE__ */ N("div", { className: "flex items-baseline gap-2", children: [
106
- b.label && /* @__PURE__ */ e("span", { className: "shrink-0 min-w-[56px] text-[10px] font-medium text-slate-400", children: b.label }),
107
- /* @__PURE__ */ e("span", { className: "text-[12px] text-slate-700 dark:text-slate-300 truncate", children: b.display })
109
+ /* @__PURE__ */ x("div", { className: "flex items-baseline gap-2", children: [
110
+ g.label && /* @__PURE__ */ e("span", { className: "shrink-0 min-w-[56px] text-[10px] font-medium text-slate-400", children: g.label }),
111
+ /* @__PURE__ */ e("span", { className: "text-[12px] text-slate-700 dark:text-slate-300 truncate", children: g.display })
108
112
  ] }, f)
109
113
  )) });
110
114
  }
111
- function Ut(t) {
115
+ function tn(t) {
112
116
  if (!t) return null;
113
- const r = t.replace(/(^|-)([a-z])/g, (u, s, l) => l.toUpperCase()), i = dt[r];
117
+ const r = t.replace(/(^|-)([a-z])/g, (u, s, l) => l.toUpperCase()), i = vt[r];
114
118
  return i || null;
115
119
  }
116
- function ze(t) {
120
+ function Ze(t) {
117
121
  if (!t.options) return {};
118
122
  if (typeof t.options == "object") return t.options;
119
123
  try {
@@ -122,7 +126,7 @@ function ze(t) {
122
126
  return {};
123
127
  }
124
128
  }
125
- function he(t, r) {
129
+ function ke(t, r) {
126
130
  if (t == null || t === "") return "—";
127
131
  if (typeof t == "boolean") return t ? "Yes" : "No";
128
132
  const i = (r == null ? void 0 : r.interface) ?? "", u = (() => {
@@ -140,12 +144,12 @@ function he(t, r) {
140
144
  if (u === "percent" && Number.isFinite(n)) return `${(n * 100).toFixed(1)}%`;
141
145
  if (/^0\.0+$/.test(u) && Number.isFinite(n)) return n.toFixed(u.length - 2);
142
146
  if (u === "date" && typeof t == "string") {
143
- const o = t.length === 10 ? /* @__PURE__ */ new Date(`${t}T00:00:00`) : new Date(t);
144
- if (!Number.isNaN(o.getTime())) return o.toLocaleDateString();
147
+ const a = t.length === 10 ? /* @__PURE__ */ new Date(`${t}T00:00:00`) : new Date(t);
148
+ if (!Number.isNaN(a.getTime())) return a.toLocaleDateString();
145
149
  }
146
150
  if (u === "datetime" && typeof t == "string") {
147
- const o = new Date(t);
148
- if (!Number.isNaN(o.getTime())) return o.toLocaleString();
151
+ const a = new Date(t);
152
+ if (!Number.isNaN(a.getTime())) return a.toLocaleString();
149
153
  }
150
154
  }
151
155
  if (i === "duration" && Number.isFinite(Number(t))) {
@@ -157,7 +161,7 @@ function he(t, r) {
157
161
  if (i === "checklist" && typeof t == "string")
158
162
  try {
159
163
  const n = JSON.parse(t);
160
- if (Array.isArray(n)) return `${n.filter((o) => o == null ? void 0 : o.done).length}/${n.length} done`;
164
+ if (Array.isArray(n)) return `${n.filter((a) => a == null ? void 0 : a.done).length}/${n.length} done`;
161
165
  } catch {
162
166
  }
163
167
  if (i === "address" && typeof t == "string" && t.trim().startsWith("{"))
@@ -182,27 +186,27 @@ function he(t, r) {
182
186
  let n = /^\d{4}-\d{2}-\d{2}$/.test(s) || i === "date";
183
187
  if (!n && (r != null && r.options))
184
188
  try {
185
- const p = typeof r.options == "string" ? JSON.parse(r.options) : r.options;
186
- p && p.date_mode === "date" && (n = !0);
189
+ const m = typeof r.options == "string" ? JSON.parse(r.options) : r.options;
190
+ m && m.date_mode === "date" && (n = !0);
187
191
  } catch {
188
192
  }
189
- const o = s.match(/^(\d{4})-(\d{2})-(\d{2})(?:T00:00:00(?:\.000)?Z)?$/);
190
- return o ? new Date(Number(o[1]), Number(o[2]) - 1, Number(o[3])).toLocaleDateString() : n ? new Date(s).toLocaleDateString() : new Date(s).toLocaleString();
193
+ const a = s.match(/^(\d{4})-(\d{2})-(\d{2})(?:T00:00:00(?:\.000)?Z)?$/);
194
+ return a ? new Date(Number(a[1]), Number(a[2]) - 1, Number(a[3])).toLocaleDateString() : n ? new Date(s).toLocaleDateString() : new Date(s).toLocaleString();
191
195
  } catch {
192
196
  }
193
197
  if ((i === "select-dropdown" || i === "radio-buttons") && r) {
194
- const o = ze(r).choices;
195
- if (Array.isArray(o)) {
196
- const p = o.find((h) => String(h.value) === s);
197
- if (p) return yt(p.text);
198
+ const a = Ze(r).choices;
199
+ if (Array.isArray(a)) {
200
+ const m = a.find((h) => String(h.value) === s);
201
+ if (m) return It(m.text);
198
202
  }
199
203
  }
200
204
  const l = Number(s);
201
205
  if (!Number.isNaN(l) && s !== "" && r) {
202
- const n = ze(r), o = n.format, p = typeof n.unit == "string" ? n.unit.trim() : "";
203
- if (p && !o) {
206
+ const n = Ze(r), a = n.format, m = typeof n.unit == "string" ? n.unit.trim() : "";
207
+ if (m && !a) {
204
208
  const h = new Intl.NumberFormat(void 0, { maximumFractionDigits: 2 }).format(l);
205
- if (p === "$")
209
+ if (m === "$")
206
210
  try {
207
211
  return new Intl.NumberFormat(void 0, { style: "currency", currency: "USD" }).format(
208
212
  l
@@ -210,9 +214,9 @@ function he(t, r) {
210
214
  } catch {
211
215
  return `$${h}`;
212
216
  }
213
- return p === "%" ? `${h}%` : `${h} ${p}`;
217
+ return m === "%" ? `${h}%` : `${h} ${m}`;
214
218
  }
215
- if (o === "currency")
219
+ if (a === "currency")
216
220
  try {
217
221
  return new Intl.NumberFormat(void 0, {
218
222
  style: "currency",
@@ -220,9 +224,9 @@ function he(t, r) {
220
224
  }).format(l);
221
225
  } catch {
222
226
  }
223
- if (o === "int")
227
+ if (a === "int")
224
228
  return new Intl.NumberFormat(void 0, { maximumFractionDigits: 0 }).format(l);
225
- if (o === "decimal") {
229
+ if (a === "decimal") {
226
230
  const h = typeof n.precision == "number" ? n.precision : 2;
227
231
  return new Intl.NumberFormat(void 0, {
228
232
  minimumFractionDigits: h,
@@ -230,50 +234,50 @@ function he(t, r) {
230
234
  }).format(l);
231
235
  }
232
236
  }
233
- return !s.includes(" ") && !s.includes("@") && !/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(s) && !/^\d+$/.test(s) && (s.includes("_") || s.includes("-") || /^[a-z]/.test(s)) ? Qe(s) : s;
237
+ return !s.includes(" ") && !s.includes("@") && !/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(s) && !/^\d+$/.test(s) && (s.includes("_") || s.includes("-") || /^[a-z]/.test(s)) ? lt(s) : s;
234
238
  }
235
- function Ge({ userId: t }) {
236
- const r = se(), { navigate: i, userUrl: u } = gt(), s = u ? u(t) : `/users/${t}`, { data: l } = ie({
239
+ function Xe({ userId: t }) {
240
+ const r = ue(), { navigate: i, userUrl: u } = Lt(), s = u ? u(t) : `/users/${t}`, { data: l } = de({
237
241
  queryKey: ["user-chip", t],
238
242
  queryFn: () => r.request(
239
- Ee(`/users/${t}`)
240
- ).then((p) => p.data ?? null),
243
+ rt(`/users/${t}`)
244
+ ).then((m) => m.data ?? null),
241
245
  enabled: !!r && !!t,
242
246
  staleTime: 12e4
243
- }), n = l ? [l.first_name, l.last_name].filter(Boolean).join(" ") || l.email : t, o = n.split(" ").map((p) => p[0]).filter(Boolean).slice(0, 2).join("").toUpperCase();
244
- return /* @__PURE__ */ N(kt, { children: [
245
- /* @__PURE__ */ e(Dt, { asChild: !0, children: /* @__PURE__ */ N("span", { className: "inline-flex cursor-pointer items-center gap-1 rounded-full bg-slate-100 py-px pl-0.5 pr-2 hover:bg-slate-200 transition-colors", children: [
247
+ }), n = l ? [l.first_name, l.last_name].filter(Boolean).join(" ") || l.email : t, a = n.split(" ").map((m) => m[0]).filter(Boolean).slice(0, 2).join("").toUpperCase();
248
+ return /* @__PURE__ */ x(Jt, { children: [
249
+ /* @__PURE__ */ e(Rt, { asChild: !0, children: /* @__PURE__ */ x("span", { className: "inline-flex cursor-pointer items-center gap-1 rounded-full bg-slate-100 py-px pl-0.5 pr-2 hover:bg-slate-200 transition-colors", children: [
246
250
  /* @__PURE__ */ e(
247
- St,
251
+ Ct,
248
252
  {
249
253
  userId: t,
250
254
  className: "h-4 w-4",
251
- fallback: /* @__PURE__ */ e("span", { className: "flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/20 text-[9px] font-bold text-nvr-navy dark:text-nvr-cyan", children: o })
255
+ fallback: /* @__PURE__ */ e("span", { className: "flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/20 text-[9px] font-bold text-nvr-navy dark:text-nvr-cyan", children: a })
252
256
  }
253
257
  ),
254
258
  /* @__PURE__ */ e("span", { className: "text-[11px] text-slate-600", children: n })
255
259
  ] }) }),
256
- /* @__PURE__ */ N($t, { align: "start", className: "text-[12px]", children: [
257
- s && /* @__PURE__ */ N(
258
- Je,
260
+ /* @__PURE__ */ x(zt, { align: "start", className: "text-[12px]", children: [
261
+ s && /* @__PURE__ */ x(
262
+ We,
259
263
  {
260
264
  className: "gap-2 text-[12px] cursor-pointer",
261
265
  onSelect: () => i(s),
262
266
  children: [
263
- /* @__PURE__ */ e(pt, { className: "h-3.5 w-3.5" }),
267
+ /* @__PURE__ */ e(Dt, { className: "h-3.5 w-3.5" }),
264
268
  " View profile"
265
269
  ]
266
270
  }
267
271
  ),
268
- (l == null ? void 0 : l.email) && /* @__PURE__ */ N(
269
- Je,
272
+ (l == null ? void 0 : l.email) && /* @__PURE__ */ x(
273
+ We,
270
274
  {
271
275
  className: "gap-2 text-[12px] cursor-pointer",
272
276
  onSelect: () => {
273
277
  window.location.href = `mailto:${l.email}`;
274
278
  },
275
279
  children: [
276
- /* @__PURE__ */ e(ft, { className: "h-3.5 w-3.5" }),
280
+ /* @__PURE__ */ e($t, { className: "h-3.5 w-3.5" }),
277
281
  " Send email"
278
282
  ]
279
283
  }
@@ -281,7 +285,7 @@ function Ge({ userId: t }) {
281
285
  ] })
282
286
  ] });
283
287
  }
284
- function Tt({
288
+ function nn({
285
289
  collection: t,
286
290
  itemId: r,
287
291
  layoutId: i,
@@ -289,34 +293,34 @@ function Tt({
289
293
  filenameTemplate: s,
290
294
  label: l
291
295
  }) {
292
- const n = se(), o = ct(), [p, h] = Z(!1), v = async () => {
293
- if (!(!n || p || !u)) {
296
+ const n = ue(), a = wt(), [m, h] = Q(!1), k = async () => {
297
+ if (!(!n || m || !u)) {
294
298
  h(!0);
295
299
  try {
296
300
  await n.request(
297
- xt(`/collection-layouts/${i}/generate-and-attach`, {
301
+ Ot(`/collection-layouts/${i}/generate-and-attach`, {
298
302
  collection: t,
299
303
  item_id: r,
300
304
  attach_field: u,
301
305
  filename_template: s ?? void 0
302
306
  })
303
- ), o.invalidateQueries({ queryKey: ["m2m-items"] }), o.invalidateQueries({ queryKey: ["items", t, r] });
307
+ ), a.invalidateQueries({ queryKey: ["m2m-items"] }), a.invalidateQueries({ queryKey: ["items", t, r] });
304
308
  } catch {
305
309
  } finally {
306
310
  h(!1);
307
311
  }
308
312
  }
309
- }, c = !u;
310
- return /* @__PURE__ */ N(
313
+ }, o = !u;
314
+ return /* @__PURE__ */ x(
311
315
  "button",
312
316
  {
313
317
  type: "button",
314
- onClick: v,
315
- disabled: p || c,
316
- title: c ? "Configure PDF field in Data Model → Layouts" : void 0,
318
+ onClick: k,
319
+ disabled: m || o,
320
+ title: o ? "Configure PDF field in Data Model → Layouts" : void 0,
317
321
  className: "inline-flex items-center gap-1.5 rounded-md border border-nvr-cyan/40 bg-nvr-cyan/10 px-3 py-1.5 text-[12px] font-medium text-nvr-navy hover:bg-nvr-cyan/20 disabled:cursor-not-allowed disabled:opacity-40 dark:text-nvr-cyan",
318
322
  children: [
319
- /* @__PURE__ */ N(
323
+ /* @__PURE__ */ x(
320
324
  "svg",
321
325
  {
322
326
  xmlns: "http://www.w3.org/2000/svg",
@@ -333,47 +337,47 @@ function Tt({
333
337
  ]
334
338
  }
335
339
  ),
336
- p ? "Generating…" : l
340
+ m ? "Generating…" : l
337
341
  ]
338
342
  }
339
343
  );
340
344
  }
341
- function X({
345
+ function re({
342
346
  relCollection: t,
343
347
  id: r,
344
348
  className: i
345
349
  }) {
346
350
  var f;
347
- const u = se(), s = Ye(), l = r != null && r !== "" ? String(r) : null, { data: n } = ie({
351
+ const u = ue(), s = st(), l = r != null && r !== "" ? String(r) : null, { data: n } = de({
348
352
  queryKey: ["col-meta-dt", t],
349
353
  queryFn: () => u.request(
350
- Ee(`/collections/${t}`)
351
- ).then((g) => g.data).catch(() => ({})),
354
+ rt(`/collections/${t}`)
355
+ ).then((y) => y.data).catch(() => ({})),
352
356
  enabled: !!u && !!l,
353
357
  staleTime: 3e5
354
- }), o = (((f = n == null ? void 0 : n.display_template) == null ? void 0 : f.match(/\{\{\s*[^}]+?\s*\}\}/g)) ?? []).map((g) => g.replace(/[{}\s]/g, "")).filter((g) => g.includes(".")), p = o.length ? ["id", ...o].join(",") : null, { data: h, isLoading: v } = ie({
355
- queryKey: ["rel-display", t, l, p],
356
- queryFn: () => s(t, l, p),
358
+ }), a = (((f = n == null ? void 0 : n.display_template) == null ? void 0 : f.match(/\{\{\s*[^}]+?\s*\}\}/g)) ?? []).map((y) => y.replace(/[{}\s]/g, "")).filter((y) => y.includes(".")), m = a.length ? ["id", ...a].join(",") : null, { data: h, isLoading: k } = de({
359
+ queryKey: ["rel-display", t, l, m],
360
+ queryFn: () => s(t, l, m),
357
361
  enabled: !!u && !!l && n !== void 0,
358
362
  staleTime: 6e4
359
363
  });
360
364
  if (!l) return /* @__PURE__ */ e("span", { children: "—" });
361
- if (v || u && n === void 0)
365
+ if (k || u && n === void 0)
362
366
  return /* @__PURE__ */ e("span", { className: "animate-pulse h-3 w-20 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))] inline-block" });
363
- const c = i ?? "text-[13px] text-slate-700";
364
- if (!h) return /* @__PURE__ */ e("span", { className: c, children: l });
365
- const b = n != null && n.display_template ? Ot(n.display_template, h) : String(h.name ?? h.title ?? h.label ?? h.display_name ?? l);
366
- return /* @__PURE__ */ e("span", { className: c, children: b });
367
+ const o = i ?? "text-[13px] text-slate-700";
368
+ if (!h) return /* @__PURE__ */ e("span", { className: o, children: l });
369
+ const g = n != null && n.display_template ? Yt(n.display_template, h) : String(h.name ?? h.title ?? h.label ?? h.display_name ?? l);
370
+ return /* @__PURE__ */ e("span", { className: o, children: g });
367
371
  }
368
- function He({ userId: t }) {
369
- return /* @__PURE__ */ e(Ze, { userId: t, size: "compact" });
372
+ function et({ userId: t }) {
373
+ return /* @__PURE__ */ e(at, { userId: t, size: "compact" });
370
374
  }
371
- function We({
375
+ function tt({
372
376
  relCollection: t,
373
377
  id: r,
374
378
  drillConfig: i
375
379
  }) {
376
- const u = bt(), s = /* @__PURE__ */ e(X, { relCollection: t, id: r });
380
+ const u = jt(), s = /* @__PURE__ */ e(re, { relCollection: t, id: r });
377
381
  return !u || r == null || r === "" ? s : /* @__PURE__ */ e(
378
382
  "button",
379
383
  {
@@ -390,7 +394,7 @@ function We({
390
394
  },
391
395
  className: "group/drill cursor-pointer text-left transition-colors",
392
396
  children: /* @__PURE__ */ e(
393
- X,
397
+ re,
394
398
  {
395
399
  relCollection: t,
396
400
  id: r,
@@ -400,9 +404,9 @@ function We({
400
404
  }
401
405
  );
402
406
  }
403
- function Mt(t) {
404
- const [r, i] = Z(!1), u = pe(!0), s = pe(JSON.stringify(t ?? null));
405
- return fe(() => {
407
+ function rn(t) {
408
+ const [r, i] = Q(!1), u = Se(!0), s = Se(JSON.stringify(t ?? null));
409
+ return ne(() => {
406
410
  const l = JSON.stringify(t ?? null);
407
411
  if (u.current) {
408
412
  u.current = !1, s.current = l;
@@ -410,13 +414,13 @@ function Mt(t) {
410
414
  }
411
415
  if (l === s.current) return;
412
416
  s.current = l, i(!1);
413
- const n = window.setTimeout(() => i(!0), 0), o = window.setTimeout(() => i(!1), 1200);
417
+ const n = window.setTimeout(() => i(!0), 0), a = window.setTimeout(() => i(!1), 1200);
414
418
  return () => {
415
- window.clearTimeout(n), window.clearTimeout(o);
419
+ window.clearTimeout(n), window.clearTimeout(a);
416
420
  };
417
421
  }, [t]), r ? "nvr-value-pulse" : "";
418
422
  }
419
- function rn({
423
+ function jn({
420
424
  field: t,
421
425
  val: r,
422
426
  relations: i,
@@ -424,70 +428,70 @@ function rn({
424
428
  displayFormat: s,
425
429
  textClassName: l
426
430
  }) {
427
- const n = Mt(r), o = re(l ?? "text-[13px] text-slate-900 dark:text-slate-100", n), p = ht(t) ?? { enabled: !0, layout_id: null, width: null }, h = i.find(
428
- (c) => c.one_collection === u && c.one_field === t.field && c.junction_field
431
+ const n = rn(r), a = W(l ?? "text-[13px] text-slate-900 dark:text-slate-100", n), m = Ft(t) ?? { enabled: !0, layout_id: null, width: null }, h = i.find(
432
+ (o) => o.one_collection === u && o.one_field === t.field && o.junction_field
429
433
  );
430
434
  if (h) {
431
- const c = i.find(
432
- (g) => g.many_collection === h.many_collection && g.many_field === h.junction_field
433
- ), b = c == null ? void 0 : c.one_collection, f = Array.isArray(r) ? r : r != null && r !== "" ? [r] : [];
434
- return !b || f.length === 0 ? /* @__PURE__ */ e("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }) : b === "nivaro_users" ? /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1 gap-y-0.5", children: f.map((g) => /* @__PURE__ */ e(He, { userId: String(g) }, String(g))) }) : /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5", children: f.map((g) => /* @__PURE__ */ e(
435
- We,
435
+ const o = i.find(
436
+ (y) => y.many_collection === h.many_collection && y.many_field === h.junction_field
437
+ ), g = o == null ? void 0 : o.one_collection, f = Array.isArray(r) ? r : r != null && r !== "" ? [r] : [];
438
+ return !g || f.length === 0 ? /* @__PURE__ */ e("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }) : g === "nivaro_users" ? /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1 gap-y-0.5", children: f.map((y) => /* @__PURE__ */ e(et, { userId: String(y) }, String(y))) }) : /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5", children: f.map((y) => /* @__PURE__ */ e(
439
+ tt,
436
440
  {
437
- relCollection: b,
438
- id: g,
439
- drillConfig: p
441
+ relCollection: g,
442
+ id: y,
443
+ drillConfig: m
440
444
  },
441
- String(g)
445
+ String(y)
442
446
  )) });
443
447
  }
444
- const v = i.find(
445
- (c) => c.many_collection === u && c.many_field === t.field && !c.junction_field
448
+ const k = i.find(
449
+ (o) => o.many_collection === u && o.many_field === t.field && !o.junction_field
446
450
  );
447
- if (v != null && v.one_collection) {
448
- const c = Array.isArray(r) ? r : r != null && r !== "" ? [r] : [];
449
- return c.length === 0 ? /* @__PURE__ */ e("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }) : v.one_collection === "nivaro_users" ? /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1 gap-y-0.5", children: c.map((b) => /* @__PURE__ */ e(He, { userId: String(b) }, String(b))) }) : /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5", children: c.map((b) => /* @__PURE__ */ e(
450
- We,
451
+ if (k != null && k.one_collection) {
452
+ const o = Array.isArray(r) ? r : r != null && r !== "" ? [r] : [];
453
+ return o.length === 0 ? /* @__PURE__ */ e("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }) : k.one_collection === "nivaro_users" ? /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1 gap-y-0.5", children: o.map((g) => /* @__PURE__ */ e(et, { userId: String(g) }, String(g))) }) : /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5", children: o.map((g) => /* @__PURE__ */ e(
454
+ tt,
451
455
  {
452
- relCollection: v.one_collection,
453
- id: b,
454
- drillConfig: p
456
+ relCollection: k.one_collection,
457
+ id: g,
458
+ drillConfig: m
455
459
  },
456
- String(b)
460
+ String(g)
457
461
  )) });
458
462
  }
459
463
  if (r == null || r === "")
460
464
  return /* @__PURE__ */ e("span", { className: "text-slate-300 dark:text-slate-600", children: "—" });
461
465
  if (s && s !== "text") {
462
- const c = Number(r);
463
- if (s === "currency" && !isNaN(c))
464
- return /* @__PURE__ */ e("span", { className: `font-semibold ${o}`, children: new Intl.NumberFormat(void 0, {
466
+ const o = Number(r);
467
+ if (s === "currency" && !isNaN(o))
468
+ return /* @__PURE__ */ e("span", { className: `font-semibold ${a}`, children: new Intl.NumberFormat(void 0, {
465
469
  style: "currency",
466
470
  currency: "USD",
467
471
  minimumFractionDigits: 2
468
- }).format(c) });
469
- if (s === "integer" && !isNaN(c))
470
- return /* @__PURE__ */ e("span", { className: `font-semibold ${o}`, children: new Intl.NumberFormat(void 0, { maximumFractionDigits: 0 }).format(Math.round(c)) });
471
- if (s === "decimal" && !isNaN(c))
472
- return /* @__PURE__ */ e("span", { className: `font-semibold ${o}`, children: new Intl.NumberFormat(void 0, { maximumFractionDigits: 2 }).format(c) });
473
- if (s === "percent" && !isNaN(c))
474
- return /* @__PURE__ */ e("span", { className: `font-semibold ${o}`, children: new Intl.NumberFormat(void 0, { style: "percent", maximumFractionDigits: 1 }).format(
475
- c / 100
472
+ }).format(o) });
473
+ if (s === "integer" && !isNaN(o))
474
+ return /* @__PURE__ */ e("span", { className: `font-semibold ${a}`, children: new Intl.NumberFormat(void 0, { maximumFractionDigits: 0 }).format(Math.round(o)) });
475
+ if (s === "decimal" && !isNaN(o))
476
+ return /* @__PURE__ */ e("span", { className: `font-semibold ${a}`, children: new Intl.NumberFormat(void 0, { maximumFractionDigits: 2 }).format(o) });
477
+ if (s === "percent" && !isNaN(o))
478
+ return /* @__PURE__ */ e("span", { className: `font-semibold ${a}`, children: new Intl.NumberFormat(void 0, { style: "percent", maximumFractionDigits: 1 }).format(
479
+ o / 100
476
480
  ) });
477
481
  if (s === "date")
478
482
  try {
479
- return /* @__PURE__ */ e("span", { className: `font-semibold ${o}`, children: new Date(String(r)).toLocaleDateString() });
483
+ return /* @__PURE__ */ e("span", { className: `font-semibold ${a}`, children: new Date(String(r)).toLocaleDateString() });
480
484
  } catch {
481
485
  }
482
486
  if (s === "datetime")
483
487
  try {
484
- return /* @__PURE__ */ e("span", { className: `font-semibold ${o}`, children: new Date(String(r)).toLocaleString() });
488
+ return /* @__PURE__ */ e("span", { className: `font-semibold ${a}`, children: new Date(String(r)).toLocaleString() });
485
489
  } catch {
486
490
  }
487
491
  }
488
- return /* @__PURE__ */ e("span", { className: `font-semibold ${o}`, children: he(r, t) });
492
+ return /* @__PURE__ */ e("span", { className: `font-semibold ${a}`, children: ke(r, t) });
489
493
  }
490
- function Jt({
494
+ function sn({
491
495
  summaryFields: t,
492
496
  fields: r,
493
497
  draft: i,
@@ -495,134 +499,134 @@ function Jt({
495
499
  collection: s,
496
500
  itemId: l,
497
501
  ownersCollection: n,
498
- ownersItemId: o,
499
- ownersAssignment: p,
502
+ ownersItemId: a,
503
+ ownersAssignment: m,
500
504
  m2mCounts: h,
501
- o2mCounts: v,
502
- o2mAggValues: c,
503
- summaryAggConfigs: b,
505
+ o2mCounts: k,
506
+ o2mAggValues: o,
507
+ summaryAggConfigs: g,
504
508
  o2mLoading: f,
505
- hideEmpty: g
509
+ hideEmpty: y
506
510
  }) {
507
- const O = t.map((x) => typeof x == "string" ? x : x.field), $ = g ? O.filter((x) => {
508
- if (x === "__owners__" || f != null && f.has(x) || c && x in c) return !0;
509
- if (h && x in h) return (h[x] ?? 0) > 0;
510
- if (v && x in v) return (v[x] ?? 0) > 0;
511
- const q = i[x];
512
- return q != null && q !== "" && !(Array.isArray(q) && q.length === 0);
513
- }) : O;
514
- if ($.length === 0) return null;
515
- const _ = "text-[9px] font-semibold uppercase tracking-wider text-slate-400 dark:text-slate-500 shrink-0", w = "text-[12px] font-semibold text-slate-700 dark:text-slate-300", P = "text-[12px] text-slate-300 dark:text-slate-600", V = "flex items-baseline gap-1.5", le = (x) => {
516
- if (x === "__owners__") {
517
- const d = (p == null ? void 0 : p.label_override) || "Owners";
518
- return /* @__PURE__ */ N("div", { className: "flex items-center gap-1.5", children: [
519
- /* @__PURE__ */ e("span", { className: _, children: d }),
511
+ const q = t.map((N) => typeof N == "string" ? N : N.field), L = y ? q.filter((N) => {
512
+ if (N === "__owners__" || f != null && f.has(N) || o && N in o) return !0;
513
+ if (h && N in h) return (h[N] ?? 0) > 0;
514
+ if (k && N in k) return (k[N] ?? 0) > 0;
515
+ const U = i[N];
516
+ return U != null && U !== "" && !(Array.isArray(U) && U.length === 0);
517
+ }) : q;
518
+ if (L.length === 0) return null;
519
+ const S = "text-[9px] font-semibold uppercase tracking-wider text-slate-400 dark:text-slate-500 shrink-0", D = "text-[12px] font-semibold text-slate-700 dark:text-slate-300", J = "text-[12px] text-slate-300 dark:text-slate-600", R = "flex items-baseline gap-1.5", me = (N) => {
520
+ if (N === "__owners__") {
521
+ const d = (m == null ? void 0 : m.label_override) || "Owners";
522
+ return /* @__PURE__ */ x("div", { className: "flex items-center gap-1.5", children: [
523
+ /* @__PURE__ */ e("span", { className: S, children: d }),
520
524
  /* @__PURE__ */ e(
521
- qt,
525
+ Xt,
522
526
  {
523
527
  collection: n ?? s,
524
- itemId: o ?? l
528
+ itemId: a ?? l
525
529
  }
526
530
  )
527
531
  ] });
528
532
  }
529
- const q = t.find((d) => (typeof d == "string" ? d : d.field) === x), ee = q && typeof q != "string" ? q.label : void 0, R = r.find((d) => d.field === x), I = ee || (R == null ? void 0 : R.label) || x.replace(/_/g, " ").replace(/\b\w/g, (d) => d.toUpperCase());
530
- if (f != null && f.has(x))
531
- return /* @__PURE__ */ N("div", { className: "flex items-center gap-1.5", children: [
532
- /* @__PURE__ */ e("span", { className: _, children: I }),
533
- /* @__PURE__ */ e(mt, { className: "h-3 w-3 animate-spin text-slate-300" })
533
+ const U = t.find((d) => (typeof d == "string" ? d : d.field) === N), ie = U && typeof U != "string" ? U.label : void 0, A = r.find((d) => d.field === N), I = ie || (A == null ? void 0 : A.label) || N.replace(/_/g, " ").replace(/\b\w/g, (d) => d.toUpperCase());
534
+ if (f != null && f.has(N))
535
+ return /* @__PURE__ */ x("div", { className: "flex items-center gap-1.5", children: [
536
+ /* @__PURE__ */ e("span", { className: S, children: I }),
537
+ /* @__PURE__ */ e(kt, { className: "h-3 w-3 animate-spin text-slate-300" })
534
538
  ] });
535
- if (c && x in c) {
536
- const d = b == null ? void 0 : b[x], B = (d == null ? void 0 : d.label) || I, F = c[x];
537
- let T;
539
+ if (o && N in o) {
540
+ const d = g == null ? void 0 : g[N], B = (d == null ? void 0 : d.label) || I, $ = o[N];
541
+ let G;
538
542
  if ((d == null ? void 0 : d.agg) === "count")
539
- T = String(F);
543
+ G = String($);
540
544
  else {
541
- const C = d != null && d.field_options ? (() => {
545
+ const K = d != null && d.field_options ? (() => {
542
546
  try {
543
547
  return JSON.parse(d.field_options);
544
548
  } catch {
545
549
  return {};
546
550
  }
547
- })() : {}, z = C.format;
548
- if (z === "currency")
551
+ })() : {}, E = K.format;
552
+ if (E === "currency")
549
553
  try {
550
- T = new Intl.NumberFormat(void 0, {
554
+ G = new Intl.NumberFormat(void 0, {
551
555
  style: "currency",
552
- currency: C.currency || "USD"
553
- }).format(F);
556
+ currency: K.currency || "USD"
557
+ }).format($);
554
558
  } catch {
555
- T = F.toLocaleString(void 0, { maximumFractionDigits: 2 });
559
+ G = $.toLocaleString(void 0, { maximumFractionDigits: 2 });
556
560
  }
557
- else if (z === "int")
558
- T = new Intl.NumberFormat(void 0, { maximumFractionDigits: 0 }).format(F);
559
- else if (z === "decimal") {
560
- const G = typeof C.precision == "number" ? C.precision : 2;
561
- T = new Intl.NumberFormat(void 0, {
562
- minimumFractionDigits: G,
563
- maximumFractionDigits: G
564
- }).format(F);
561
+ else if (E === "int")
562
+ G = new Intl.NumberFormat(void 0, { maximumFractionDigits: 0 }).format($);
563
+ else if (E === "decimal") {
564
+ const Y = typeof K.precision == "number" ? K.precision : 2;
565
+ G = new Intl.NumberFormat(void 0, {
566
+ minimumFractionDigits: Y,
567
+ maximumFractionDigits: Y
568
+ }).format($);
565
569
  } else
566
- T = F.toLocaleString(void 0, { maximumFractionDigits: 2 });
570
+ G = $.toLocaleString(void 0, { maximumFractionDigits: 2 });
567
571
  }
568
- return /* @__PURE__ */ N("div", { className: V, children: [
569
- /* @__PURE__ */ e("span", { className: _, children: B }),
570
- /* @__PURE__ */ e("span", { className: w, children: T })
572
+ return /* @__PURE__ */ x("div", { className: R, children: [
573
+ /* @__PURE__ */ e("span", { className: S, children: B }),
574
+ /* @__PURE__ */ e("span", { className: D, children: G })
571
575
  ] });
572
576
  }
573
- if (h && x in h) {
574
- const d = h[x];
575
- return /* @__PURE__ */ N("div", { className: V, children: [
576
- /* @__PURE__ */ e("span", { className: _, children: I }),
577
- /* @__PURE__ */ N("span", { className: w, children: [
577
+ if (h && N in h) {
578
+ const d = h[N];
579
+ return /* @__PURE__ */ x("div", { className: R, children: [
580
+ /* @__PURE__ */ e("span", { className: S, children: I }),
581
+ /* @__PURE__ */ x("span", { className: D, children: [
578
582
  d,
579
583
  " item",
580
584
  d !== 1 ? "s" : ""
581
585
  ] })
582
586
  ] });
583
587
  }
584
- if (v && x in v) {
585
- const d = v[x];
586
- return /* @__PURE__ */ N("div", { className: V, children: [
587
- /* @__PURE__ */ e("span", { className: _, children: I }),
588
- /* @__PURE__ */ N("span", { className: w, children: [
588
+ if (k && N in k) {
589
+ const d = k[N];
590
+ return /* @__PURE__ */ x("div", { className: R, children: [
591
+ /* @__PURE__ */ e("span", { className: S, children: I }),
592
+ /* @__PURE__ */ x("span", { className: D, children: [
589
593
  d,
590
594
  " row",
591
595
  d !== 1 ? "s" : ""
592
596
  ] })
593
597
  ] });
594
598
  }
595
- const k = i[x], U = u.find(
596
- (d) => d.many_collection === s && d.many_field === x && !d.junction_field
599
+ const j = i[N], M = u.find(
600
+ (d) => d.many_collection === s && d.many_field === N && !d.junction_field
597
601
  );
598
- if (U != null && U.one_collection) {
599
- const d = Array.isArray(k) ? k : k != null && k !== "" ? [k] : [];
600
- return /* @__PURE__ */ N("div", { className: V, children: [
601
- /* @__PURE__ */ e("span", { className: _, children: I }),
602
- d.length === 0 ? /* @__PURE__ */ e("span", { className: P, children: "—" }) : U.one_collection === "nivaro_users" ? /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5 gap-y-0.5", children: d.map((B) => /* @__PURE__ */ e(Ge, { userId: String(B) }, String(B))) }) : /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5", children: d.map((B) => /* @__PURE__ */ e(X, { relCollection: U.one_collection, id: B }, String(B))) })
602
+ if (M != null && M.one_collection) {
603
+ const d = Array.isArray(j) ? j : j != null && j !== "" ? [j] : [];
604
+ return /* @__PURE__ */ x("div", { className: R, children: [
605
+ /* @__PURE__ */ e("span", { className: S, children: I }),
606
+ d.length === 0 ? /* @__PURE__ */ e("span", { className: J, children: "—" }) : M.one_collection === "nivaro_users" ? /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5 gap-y-0.5", children: d.map((B) => /* @__PURE__ */ e(Xe, { userId: String(B) }, String(B))) }) : /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5", children: d.map((B) => /* @__PURE__ */ e(re, { relCollection: M.one_collection, id: B }, String(B))) })
603
607
  ] });
604
608
  }
605
- if (Array.isArray(k)) {
606
- const d = u.find((F) => F.many_field === x && F.junction_field), B = d == null ? void 0 : d.one_collection;
607
- return /* @__PURE__ */ N("div", { className: V, children: [
608
- /* @__PURE__ */ e("span", { className: _, children: I }),
609
- k.length === 0 ? /* @__PURE__ */ e("span", { className: P, children: "—" }) : B ? /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5 gap-y-0.5", children: k.map(
610
- (F) => B === "nivaro_users" ? /* @__PURE__ */ e(Ge, { userId: String(F) }, String(F)) : /* @__PURE__ */ e(X, { relCollection: B, id: F }, String(F))
611
- ) }) : /* @__PURE__ */ N("span", { className: w, children: [
612
- k.length,
609
+ if (Array.isArray(j)) {
610
+ const d = u.find(($) => $.many_field === N && $.junction_field), B = d == null ? void 0 : d.one_collection;
611
+ return /* @__PURE__ */ x("div", { className: R, children: [
612
+ /* @__PURE__ */ e("span", { className: S, children: I }),
613
+ j.length === 0 ? /* @__PURE__ */ e("span", { className: J, children: "—" }) : B ? /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5 gap-y-0.5", children: j.map(
614
+ ($) => B === "nivaro_users" ? /* @__PURE__ */ e(Xe, { userId: String($) }, String($)) : /* @__PURE__ */ e(re, { relCollection: B, id: $ }, String($))
615
+ ) }) : /* @__PURE__ */ x("span", { className: D, children: [
616
+ j.length,
613
617
  " item",
614
- k.length !== 1 ? "s" : ""
618
+ j.length !== 1 ? "s" : ""
615
619
  ] })
616
620
  ] });
617
621
  }
618
- return /* @__PURE__ */ N("div", { className: V, children: [
619
- /* @__PURE__ */ e("span", { className: _, children: I }),
620
- k == null || k === "" ? /* @__PURE__ */ e("span", { className: P, children: "—" }) : /* @__PURE__ */ e("span", { className: w, children: he(k, R) })
622
+ return /* @__PURE__ */ x("div", { className: R, children: [
623
+ /* @__PURE__ */ e("span", { className: S, children: I }),
624
+ j == null || j === "" ? /* @__PURE__ */ e("span", { className: J, children: "—" }) : /* @__PURE__ */ e("span", { className: D, children: ke(j, A) })
621
625
  ] });
622
626
  };
623
- return /* @__PURE__ */ e("div", { className: "flex flex-wrap items-baseline gap-x-5 gap-y-1.5 border-t border-slate-100 dark:border-border/60 bg-slate-50/50 dark:bg-white/[0.015] px-5 py-2.5", children: $.map((x) => /* @__PURE__ */ e(Ae.Fragment, { children: le(x) }, x)) });
627
+ return /* @__PURE__ */ e("div", { className: "flex flex-wrap items-baseline gap-x-5 gap-y-1.5 border-t border-slate-100 dark:border-border/60 bg-slate-50/50 dark:bg-white/[0.015] px-5 py-2.5", children: L.map((N) => /* @__PURE__ */ e(nt.Fragment, { children: me(N) }, N)) });
624
628
  }
625
- function sn({
629
+ function Ln({
626
630
  group: t,
627
631
  fields: r,
628
632
  draft: i,
@@ -630,59 +634,69 @@ function sn({
630
634
  relations: s,
631
635
  collection: l,
632
636
  itemId: n,
633
- errors: o,
634
- visibleFields: p,
637
+ errors: a,
638
+ visibleFields: m,
635
639
  lockedFields: h,
636
- layoutAiEnabled: v,
637
- displayOnly: c,
638
- renderField: b,
640
+ layoutAiEnabled: k,
641
+ displayOnly: o,
642
+ renderField: g,
639
643
  onCountChange: f,
640
- isNew: g,
641
- fieldValues: O,
642
- isOpen: $,
643
- onToggle: _,
644
- summaryFields: w,
645
- m2mCounts: P,
646
- o2mCounts: V,
647
- o2mAggValues: le,
648
- summaryAggConfigs: x,
649
- o2mLoading: q,
650
- footerSlot: ee,
651
- ownersCollection: R,
644
+ isNew: y,
645
+ fieldValues: q,
646
+ isOpen: L,
647
+ onToggle: S,
648
+ summaryFields: D,
649
+ m2mCounts: J,
650
+ o2mCounts: R,
651
+ o2mAggValues: me,
652
+ summaryAggConfigs: N,
653
+ o2mLoading: U,
654
+ footerSlot: ie,
655
+ ownersCollection: A,
652
656
  ownersItemId: I,
653
- ownersAssignment: k,
654
- pdfAssignment: U,
657
+ ownersAssignment: j,
658
+ pdfAssignment: M,
655
659
  pdfAttachField: d,
656
660
  pdfFilenameTemplate: B,
657
- layoutId: F,
658
- hideEmptySummary: T,
659
- widgetAssignments: C,
660
- widgetApiBase: z,
661
- fieldInlineDisplay: G,
662
- swapConfig: M,
663
- swapped: be,
664
- onSwapToggle: ge,
665
- alternateFields: W,
666
- alternateWidths: ae
661
+ layoutId: $,
662
+ hideEmptySummary: G,
663
+ widgetAssignments: K,
664
+ widgetApiBase: E,
665
+ fieldInlineDisplay: Y,
666
+ swapConfig: V,
667
+ swapped: De,
668
+ onSwapToggle: $e,
669
+ alternateFields: Z,
670
+ alternateWidths: pe,
671
+ deferred: se,
672
+ onFirstOpen: le
667
673
  }) {
668
- var Fe;
669
- const [Xe, et] = Z(t.is_collapsed ?? !1), j = wt(), H = (m, a) => _t(j, m, a, { asChild: !0 }), te = (m) => ({ kind: "slot", field: m, group_key: t.key }), xe = !!(j != null && j.showHidden), [ye, Ne] = Z({}), { data: oe } = Ft(l), A = (j == null ? void 0 : j.fold) ?? null, E = (j == null ? void 0 : j.reveal) ?? null, [_e, ce] = Z(null);
670
- fe(() => {
671
- A && ce(!A.open);
672
- }, [A == null ? void 0 : A.seq]), fe(() => {
673
- E && vt(E.target) === t.key && ce(!1);
674
- }, [E == null ? void 0 : E.seq]);
675
- const we = _ !== void 0, Y = _e ?? (we ? !$ : Xe), tt = _e !== null ? () => ce((m) => !m) : we ? _ : () => et((m) => !m), nt = !c && r.some((m) => o[m.field]), ve = j ? "always" : t.visibility_mode ?? "always";
676
- if (ve === "new_only" && !g || ve === "existing_only" && g) return null;
677
- const Q = C ?? [], rt = !g && Q.some((m) => m.widget_id != null && ye[m.field] === void 0);
678
- let de = !1;
679
- if (t.hide_when_empty && O && !j && (de = O.every(
680
- (a) => a == null || a === "" || Array.isArray(a) && a.length === 0
681
- ) && !rt && Q.every((a) => !ye[a.field])), de && Q.length === 0) return null;
682
- const ue = pe(null), Se = Lt(ue), ke = Ut(t.icon), it = xe ? r : r.filter((m) => !m.hidden), De = (Fe = oe == null ? void 0 : oe.sections) == null ? void 0 : Fe[t.key], st = Array.isArray(De) && De.length > 0, lt = (m) => st ? /* @__PURE__ */ N("div", { className: "relative", children: [
683
- m,
674
+ var Me;
675
+ const [ot, ct] = Q(t.is_collapsed ?? !1), [dt, ut] = Q(!1), F = Vt(), H = (p, _) => Gt(F, p, _, { asChild: !0 }), ae = (p) => ({ kind: "slot", field: p, group_key: t.key }), Fe = !!(F != null && F.showHidden), [je, Le] = Q({}), { data: fe } = At(l), X = (F == null ? void 0 : F.fold) ?? null, ee = (F == null ? void 0 : F.reveal) ?? null, [Oe, he] = Q(null);
676
+ ne(() => {
677
+ X && he(!X.open);
678
+ }, [X == null ? void 0 : X.seq]), ne(() => {
679
+ ee && Pt(ee.target) === t.key && he(!1);
680
+ }, [ee == null ? void 0 : ee.seq]);
681
+ const qe = S !== void 0, z = Oe ?? (qe ? !L : ot);
682
+ ne(() => {
683
+ se && !z && (le == null || le(t.key));
684
+ }, [se, z, le, t.key]);
685
+ const be = Oe !== null ? () => he((p) => !p) : qe ? S : () => ct((p) => !p), Be = !F && $ != null, ge = () => {
686
+ Be && it({ layoutId: Number($), collection: l, kind: "opened", key: t.key });
687
+ }, mt = () => {
688
+ z && ge(), be == null || be();
689
+ }, pt = !o && r.some((p) => a[p.field]), Ue = F ? "always" : t.visibility_mode ?? "always";
690
+ if (Ue === "new_only" && !y || Ue === "existing_only" && y) return null;
691
+ const te = K ?? [], ft = !y && te.some((p) => p.widget_id != null && je[p.field] === void 0);
692
+ let oe = !1;
693
+ if (t.hide_when_empty && q && !F && (oe = q.every(
694
+ (_) => _ == null || _ === "" || Array.isArray(_) && _.length === 0
695
+ ) && !ft && te.every((_) => !je[_.field])), oe && te.length === 0) return null;
696
+ const xe = Se(null), ye = Qt(xe), Te = tn(t.icon), ht = Fe ? r : r.filter((p) => !p.hidden), Ie = (Me = fe == null ? void 0 : fe.sections) == null ? void 0 : Me[t.key], bt = Array.isArray(Ie) && Ie.length > 0, gt = (p) => bt ? /* @__PURE__ */ x("div", { className: "relative", children: [
697
+ p,
684
698
  /* @__PURE__ */ e("span", { className: "absolute right-[52px] top-1/2 flex -translate-y-1/2", children: /* @__PURE__ */ e(
685
- jt,
699
+ Et,
686
700
  {
687
701
  collection: l,
688
702
  kind: "section",
@@ -690,42 +704,53 @@ function sn({
690
704
  label: t.label || t.key
691
705
  }
692
706
  ) })
693
- ] }) : m, $e = (m) => xe && (m.hidden || !(p.has(m.field) || !p.size));
694
- return /* @__PURE__ */ N(
707
+ ] }) : p, Ne = (p) => Fe && (p.hidden || !(m.has(p.field) || !m.size));
708
+ return /* @__PURE__ */ x(
695
709
  "div",
696
710
  {
697
- className: re(
711
+ "data-loads-on-open": se ? "" : void 0,
712
+ className: W(
698
713
  "nvr-section-enter rounded-xl border border-slate-200 bg-white dark:bg-card dark:border-border",
699
- c && "bg-slate-50/60 dark:bg-slate-900/20",
700
- de && "hidden"
714
+ o && "bg-slate-50/60 dark:bg-slate-900/20",
715
+ oe && "hidden"
701
716
  ),
717
+ onPointerDownCapture: (p) => {
718
+ var _, c;
719
+ (c = (_ = p.target) == null ? void 0 : _.closest) != null && c.call(_, "[data-usage-header]") || ge();
720
+ },
721
+ onFocusCapture: (p) => {
722
+ var _, c;
723
+ (c = (_ = p.target) == null ? void 0 : _.closest) != null && c.call(_, "[data-usage-header]") || ge();
724
+ },
702
725
  children: [
703
- lt(
704
- /* @__PURE__ */ N(
726
+ Be && !oe && /* @__PURE__ */ e(ln, { layoutId: Number($), collection: l, sectionKey: t.key }),
727
+ gt(
728
+ /* @__PURE__ */ x(
705
729
  "button",
706
730
  {
707
731
  type: "button",
708
- onClick: tt,
709
- "data-design-group-header": j ? "" : void 0,
710
- className: re(
732
+ "data-usage-header": "",
733
+ onClick: mt,
734
+ "data-design-group-header": F ? "" : void 0,
735
+ className: W(
711
736
  "flex w-full items-center gap-2 px-5 py-3 text-left hover:bg-slate-50/50 dark:hover:bg-white/[0.02] rounded-t-xl",
712
737
  // Round the bottom only when nothing renders below the header — an
713
738
  // expanded body (or collapsed summary strip) square-joins it, and a
714
739
  // rounded hover overlay would leave see-through notches at the seam.
715
- Y && !(w && w.length > 0) && "rounded-b-xl"
740
+ z && !(D && D.length > 0) && "rounded-b-xl"
716
741
  ),
717
742
  children: [
718
- ke && /* @__PURE__ */ e(ke, { className: "h-3.5 w-3.5 shrink-0 text-slate-400 dark:text-slate-500" }),
743
+ Te && /* @__PURE__ */ e(Te, { className: "h-3.5 w-3.5 shrink-0 text-slate-400 dark:text-slate-500" }),
719
744
  /* @__PURE__ */ e("span", { className: "font-medium text-[13px] shrink-0 text-slate-800 dark:text-slate-200", children: t.label }),
720
745
  /* @__PURE__ */ e("span", { className: "flex-1" }),
721
- nt && /* @__PURE__ */ e("span", { className: "nvr-pop h-2 w-2 rounded-full bg-destructive shrink-0" }),
746
+ pt && /* @__PURE__ */ e("span", { className: "nvr-pop h-2 w-2 rounded-full bg-destructive shrink-0" }),
722
747
  /* @__PURE__ */ e(
723
- ut,
748
+ St,
724
749
  {
725
- "data-design-pass": j ? "" : void 0,
726
- className: re(
750
+ "data-design-pass": F ? "" : void 0,
751
+ className: W(
727
752
  "h-4 w-4 text-slate-400 dark:text-slate-500 transition-transform duration-200",
728
- Y && "-rotate-90"
753
+ z && "-rotate-90"
729
754
  )
730
755
  }
731
756
  )
@@ -733,304 +758,403 @@ function sn({
733
758
  }
734
759
  )
735
760
  ),
736
- Y && w && w.length > 0 && /* @__PURE__ */ e(
737
- Jt,
761
+ z && D && D.length > 0 && /* @__PURE__ */ e(
762
+ sn,
738
763
  {
739
- summaryFields: w,
764
+ summaryFields: D,
740
765
  fields: r,
741
766
  draft: i,
742
767
  relations: s,
743
768
  collection: l,
744
769
  itemId: n,
745
- ownersCollection: R,
770
+ ownersCollection: A,
746
771
  ownersItemId: I,
747
- ownersAssignment: k,
748
- m2mCounts: P,
749
- o2mCounts: V,
750
- o2mAggValues: le,
751
- summaryAggConfigs: x,
752
- o2mLoading: q,
753
- hideEmpty: !!t.summary_hide_empty || !!T
772
+ ownersAssignment: j,
773
+ m2mCounts: J,
774
+ o2mCounts: R,
775
+ o2mAggValues: me,
776
+ summaryAggConfigs: N,
777
+ o2mLoading: U,
778
+ hideEmpty: !!t.summary_hide_empty || !!G
754
779
  }
755
780
  ),
756
- Y && t.hide_when_empty && Q.length > 0 && /* @__PURE__ */ e("div", { className: "hidden", children: Q.filter((m) => m.widget_id != null).map((m) => /* @__PURE__ */ e(
757
- Pe,
781
+ z && !se && t.hide_when_empty && te.length > 0 && /* @__PURE__ */ e("div", { className: "hidden", children: te.filter((p) => p.widget_id != null).map((p) => /* @__PURE__ */ e(
782
+ Ae,
758
783
  {
759
- widgetId: m.widget_id,
760
- inputBindings: Re(m.input_bindings),
784
+ widgetId: p.widget_id,
785
+ inputBindings: Qe(p.input_bindings),
761
786
  itemDraft: i,
762
787
  frameless: !0,
763
- apiBase: z,
764
- onContentChange: (a) => Ne(
765
- (y) => y[m.field] === a ? y : { ...y, [m.field]: a }
788
+ apiBase: E,
789
+ onContentChange: (_) => Le(
790
+ (c) => c[p.field] === _ ? c : { ...c, [p.field]: _ }
766
791
  )
767
792
  },
768
- m.field
793
+ p.field
769
794
  )) }),
770
- !Y && /* @__PURE__ */ N("div", { className: "nvr-expand-in border-t border-slate-100 px-5 py-4", children: [
771
- !c && /* @__PURE__ */ e(Bt, { group: t, className: "mb-3" }),
795
+ !z && /* @__PURE__ */ x("div", { className: "nvr-expand-in border-t border-slate-100 px-5 py-4", children: [
796
+ !o && /* @__PURE__ */ e(Zt, { group: t, className: "mb-3" }),
772
797
  (() => {
773
- const m = it.map((a) => ({
774
- _k: a.field,
775
- sort: a.sort ?? 0,
776
- _t: "field",
777
- f: a
778
- }));
779
- k && m.push({
798
+ const p = qt(ht, {
799
+ rows: o ? [] : Tt(t.swap_config).rows,
800
+ folded: (c) => !o && Ut(c._overrides),
801
+ keep: (c) => !!c.required,
802
+ filled: (c) => !Bt(i[c.field]) || !!a[c.field]
803
+ }), _ = p.units.map(
804
+ (c) => c.kind === "row" ? {
805
+ _k: `row:${c.row.key}`,
806
+ sort: c.members[0].sort ?? 0,
807
+ _t: "row",
808
+ row: c.row,
809
+ members: c.members
810
+ } : { _k: c.field.field, sort: c.field.sort ?? 0, _t: "field", f: c.field }
811
+ );
812
+ j && _.push({
780
813
  _k: "__owners__",
781
- sort: k.sort,
814
+ sort: j.sort,
782
815
  _t: "owners",
783
- slot: k
784
- }), U && m.push({
816
+ slot: j
817
+ }), M && _.push({
785
818
  _k: "__pdf__",
786
- sort: U.sort,
819
+ sort: M.sort,
787
820
  _t: "pdf",
788
- slot: U
821
+ slot: M
789
822
  });
790
- for (const a of C ?? [])
791
- m.push({ _k: a.field, sort: a.sort, _t: "widget", slot: a });
792
- return m.sort((a, y) => a.sort - y.sort), j && m.length === 0 ? /* @__PURE__ */ e(Nt, {}) : c ? /* @__PURE__ */ e("div", { ref: ue, className: "grid grid-cols-12 gap-x-6 gap-y-3", children: m.map((a) => {
793
- if (a._t === "owners") {
794
- const D = a.slot.col_span ?? 12;
795
- return H(
796
- te("__owners__"),
797
- /* @__PURE__ */ e(
798
- "div",
799
- {
800
- className: "min-w-0",
801
- style: { gridColumn: `span ${D}` },
802
- children: /* @__PURE__ */ e(
803
- Ke,
823
+ for (const c of K ?? [])
824
+ _.push({ _k: c.field, sort: c.sort, _t: "widget", slot: c });
825
+ return _.sort((c, O) => c.sort - O.sort), F && _.length === 0 && p.folded.length === 0 ? /* @__PURE__ */ e(Mt, {}) : o ? /* @__PURE__ */ x(
826
+ "div",
827
+ {
828
+ ref: xe,
829
+ className: W(F && "relative", "grid grid-cols-12 gap-x-6 gap-y-3"),
830
+ children: [
831
+ /* @__PURE__ */ e(we, { gapClass: "gap-x-6" }),
832
+ _.map((c) => {
833
+ if (c._t === "owners") {
834
+ const v = c.slot.col_span ?? 12;
835
+ return H(
836
+ ae("__owners__"),
837
+ /* @__PURE__ */ e(
838
+ "div",
839
+ {
840
+ className: "min-w-0",
841
+ style: { gridColumn: `span ${v}` },
842
+ children: /* @__PURE__ */ e(
843
+ Ye,
844
+ {
845
+ collection: l,
846
+ itemId: n,
847
+ label: c.slot.label_override || "Owners"
848
+ }
849
+ )
850
+ },
851
+ "__owners__"
852
+ )
853
+ );
854
+ }
855
+ if (c._t === "pdf" || c._t === "widget" || c._t === "row") return null;
856
+ const O = c.f, b = s.find(
857
+ (v) => v.many_collection === l && v.many_field === O.field && !v.junction_field
858
+ );
859
+ return H(
860
+ { kind: "field", field: O.field, group_key: t.key },
861
+ /* @__PURE__ */ x(
862
+ "div",
804
863
  {
805
- collection: l,
806
- itemId: n,
807
- label: a.slot.label_override || "Owners"
808
- }
864
+ className: "min-w-0",
865
+ style: { gridColumn: `span ${Ee(O.options, ye)}` },
866
+ children: [
867
+ /* @__PURE__ */ e("dt", { className: "text-[11px] font-medium text-slate-400 truncate", children: O.label || lt(O.field) }),
868
+ /* @__PURE__ */ e("dd", { className: "mt-0.5 break-words", children: (b == null ? void 0 : b.one_collection) === "nivaro_users" ? (() => {
869
+ const v = i[O.field], P = Array.isArray(v) ? v : v != null && v !== "" ? [v] : [];
870
+ return P.length === 0 ? /* @__PURE__ */ e("span", { className: "text-[13px] text-slate-400", children: "—" }) : /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1.5", children: P.map((T) => /* @__PURE__ */ e(at, { userId: String(T) }, String(T))) });
871
+ })() : b != null && b.one_collection ? /* @__PURE__ */ e(re, { relCollection: b.one_collection, id: i[O.field] }) : /* @__PURE__ */ e("span", { className: "text-[13px] text-slate-700", children: ke(i[O.field], O) }) })
872
+ ]
873
+ },
874
+ O.field
809
875
  )
810
- },
811
- "__owners__"
812
- )
813
- );
876
+ );
877
+ })
878
+ ]
814
879
  }
815
- if (a._t === "pdf" || a._t === "widget") return null;
816
- const y = a.f, L = s.find(
817
- (D) => D.many_collection === l && D.many_field === y.field && !D.junction_field
818
- );
819
- return H(
820
- { kind: "field", field: y.field, group_key: t.key },
821
- /* @__PURE__ */ N(
822
- "div",
823
- {
824
- className: "min-w-0",
825
- style: { gridColumn: `span ${Ce(y.options, Se)}` },
826
- children: [
827
- /* @__PURE__ */ e("dt", { className: "text-[11px] font-medium text-slate-400 truncate", children: y.label || Qe(y.field) }),
828
- /* @__PURE__ */ e("dd", { className: "mt-0.5 break-words", children: (L == null ? void 0 : L.one_collection) === "nivaro_users" ? (() => {
829
- const D = i[y.field], ne = Array.isArray(D) ? D : D != null && D !== "" ? [D] : [];
830
- return ne.length === 0 ? /* @__PURE__ */ e("span", { className: "text-[13px] text-slate-400", children: "—" }) : /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1.5", children: ne.map((K) => /* @__PURE__ */ e(Ze, { userId: String(K) }, String(K))) });
831
- })() : L != null && L.one_collection ? /* @__PURE__ */ e(X, { relCollection: L.one_collection, id: i[y.field] }) : /* @__PURE__ */ e("span", { className: "text-[13px] text-slate-700", children: he(i[y.field], y) }) })
832
- ]
833
- },
834
- y.field
835
- )
836
- );
837
- }) }) : /* @__PURE__ */ e("div", { ref: ue, className: "grid grid-cols-12 gap-4 items-start", children: m.map((a) => {
838
- var Ue, Te;
839
- if (a._t === "owners") {
840
- const S = a.slot.col_span ?? 12;
841
- return H(
842
- te("__owners__"),
843
- /* @__PURE__ */ e("div", { style: { gridColumn: `span ${S}` }, children: /* @__PURE__ */ e(
844
- Ke,
880
+ ) : (() => {
881
+ const c = (b) => {
882
+ var ze, Ke;
883
+ if (b._t === "row")
884
+ return /* @__PURE__ */ e(
885
+ Ht,
845
886
  {
846
- collection: l,
847
- itemId: n,
848
- label: a.slot.label_override || "Owners"
887
+ row: b.row,
888
+ members: b.members,
889
+ containerWidth: ye,
890
+ errors: a,
891
+ renderMember: (w) => H(
892
+ { kind: "field", field: w.field, group_key: t.key },
893
+ /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
894
+ ve,
895
+ {
896
+ field: Wt(w),
897
+ draft: i,
898
+ onChange: u,
899
+ relations: s,
900
+ collection: l,
901
+ itemId: n,
902
+ error: a[w.field],
903
+ visible: m.has(w.field) || !m.size,
904
+ forceVisible: Ne(w) || void 0,
905
+ locked: h.has(w.field),
906
+ layoutAiEnabled: k,
907
+ renderField: g,
908
+ onCountChange: f
909
+ }
910
+ ) }, w.field)
911
+ )
912
+ },
913
+ b._k
914
+ );
915
+ if (b._t === "owners") {
916
+ const w = b.slot.col_span ?? 12;
917
+ return H(
918
+ ae("__owners__"),
919
+ /* @__PURE__ */ e("div", { style: { gridColumn: `span ${w}` }, children: /* @__PURE__ */ e(
920
+ Ye,
921
+ {
922
+ collection: l,
923
+ itemId: n,
924
+ label: b.slot.label_override || "Owners"
925
+ }
926
+ ) }, "__owners__")
927
+ );
928
+ }
929
+ if (b._t === "pdf") {
930
+ if (!$) return null;
931
+ const w = b.slot.col_span ?? 12, C = ((ze = b.slot.label_override) == null ? void 0 : ze.trim()) || "Generate PDF";
932
+ return H(
933
+ ae("__pdf__"),
934
+ /* @__PURE__ */ e("div", { style: { gridColumn: `span ${w}` }, children: /* @__PURE__ */ e(
935
+ nn,
936
+ {
937
+ collection: l,
938
+ itemId: n,
939
+ layoutId: $,
940
+ attachField: d ?? null,
941
+ filenameTemplate: B,
942
+ label: C
943
+ }
944
+ ) }, "__pdf__")
945
+ );
946
+ }
947
+ if (b._t === "widget") {
948
+ if (!b.slot.widget_id) return null;
949
+ const w = b.slot.col_span ?? 12, C = Qe(b.slot.input_bindings);
950
+ return H(
951
+ ae(b.slot.field),
952
+ /* @__PURE__ */ e("div", { style: { gridColumn: `span ${w}` }, children: /* @__PURE__ */ e(
953
+ Ae,
954
+ {
955
+ widgetId: b.slot.widget_id,
956
+ inputBindings: C,
957
+ itemDraft: i,
958
+ label: b.slot.label_override ?? void 0,
959
+ defaultExpanded: b.slot.default_expanded ?? !0,
960
+ frameless: !0,
961
+ apiBase: E,
962
+ onContentChange: (He) => Le(
963
+ (_e) => _e[b.slot.field] === He ? _e : { ..._e, [b.slot.field]: He }
964
+ )
965
+ }
966
+ ) }, b.slot.field)
967
+ );
968
+ }
969
+ const v = b.f, P = Y == null ? void 0 : Y[v.field], T = P == null ? void 0 : P.entries, xt = (P == null ? void 0 : P.separator) ?? null, ce = i[v.field], Ge = ce != null && ce !== "", Ve = T != null && T.length && Ge ? ((Ke = s.find(
970
+ (w) => w.many_collection === l && w.many_field === v.field && !w.junction_field
971
+ )) == null ? void 0 : Ke.one_collection) ?? null : null, Pe = (V == null ? void 0 : V.enabled) && v.field === V.primary_field, Ce = (() => {
972
+ const w = i[(V == null ? void 0 : V.primary_field) ?? ""];
973
+ return w != null && w !== "";
974
+ })(), Je = (Z ?? []).some((w) => {
975
+ const C = i[w.field];
976
+ return C != null && C !== "";
977
+ }), yt = Pe && $e ? /* @__PURE__ */ x("span", { className: "inline-flex items-center gap-1.5", children: [
978
+ /* @__PURE__ */ e(
979
+ "button",
980
+ {
981
+ type: "button",
982
+ onClick: $e,
983
+ className: "inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-medium text-nvr-cyan hover:bg-nvr-cyan/10 transition-colors",
984
+ children: De ? V.back_label ?? "Back" : V.toggle_label ?? "Enter manually"
849
985
  }
850
- ) }, "__owners__")
851
- );
852
- }
853
- if (a._t === "pdf") {
854
- if (!F) return null;
855
- const S = a.slot.col_span ?? 12, J = ((Ue = a.slot.label_override) == null ? void 0 : Ue.trim()) || "Generate PDF";
856
- return H(
857
- te("__pdf__"),
858
- /* @__PURE__ */ e("div", { style: { gridColumn: `span ${S}` }, children: /* @__PURE__ */ e(
859
- Tt,
986
+ ),
987
+ /* @__PURE__ */ x(
988
+ "span",
860
989
  {
861
- collection: l,
862
- itemId: n,
863
- layoutId: F,
864
- attachField: d ?? null,
865
- filenameTemplate: B,
866
- label: J
990
+ className: [
991
+ "inline-flex items-center gap-0.5 rounded px-1 py-0.5 text-[9px] font-medium",
992
+ Ce ? "bg-emerald-50 text-emerald-600 dark:bg-emerald-900/30 dark:text-emerald-400" : "bg-slate-100 text-slate-400 dark:bg-slate-800 dark:text-slate-500"
993
+ ].join(" "),
994
+ title: "Original field",
995
+ children: [
996
+ /* @__PURE__ */ e(
997
+ "span",
998
+ {
999
+ className: [
1000
+ "h-1.5 w-1.5 rounded-full",
1001
+ Ce ? "bg-emerald-500" : "bg-slate-300 dark:bg-slate-600"
1002
+ ].join(" ")
1003
+ }
1004
+ ),
1005
+ "Original"
1006
+ ]
867
1007
  }
868
- ) }, "__pdf__")
869
- );
870
- }
871
- if (a._t === "widget") {
872
- if (!a.slot.widget_id) return null;
873
- const S = a.slot.col_span ?? 12, J = Re(a.slot.input_bindings);
874
- return H(
875
- te(a.slot.field),
876
- /* @__PURE__ */ e("div", { style: { gridColumn: `span ${S}` }, children: /* @__PURE__ */ e(
877
- Pe,
1008
+ ),
1009
+ /* @__PURE__ */ x(
1010
+ "span",
878
1011
  {
879
- widgetId: a.slot.widget_id,
880
- inputBindings: J,
881
- itemDraft: i,
882
- label: a.slot.label_override ?? void 0,
883
- defaultExpanded: a.slot.default_expanded ?? !0,
884
- frameless: !0,
885
- apiBase: z,
886
- onContentChange: (Me) => Ne(
887
- (me) => me[a.slot.field] === Me ? me : { ...me, [a.slot.field]: Me }
888
- )
1012
+ className: [
1013
+ "inline-flex items-center gap-0.5 rounded px-1 py-0.5 text-[9px] font-medium",
1014
+ Je ? "bg-emerald-50 text-emerald-600 dark:bg-emerald-900/30 dark:text-emerald-400" : "bg-slate-100 text-slate-400 dark:bg-slate-800 dark:text-slate-500"
1015
+ ].join(" "),
1016
+ title: "Manual fields",
1017
+ children: [
1018
+ /* @__PURE__ */ e(
1019
+ "span",
1020
+ {
1021
+ className: [
1022
+ "h-1.5 w-1.5 rounded-full",
1023
+ Je ? "bg-emerald-500" : "bg-slate-300 dark:bg-slate-600"
1024
+ ].join(" ")
1025
+ }
1026
+ ),
1027
+ "Manual"
1028
+ ]
889
1029
  }
890
- ) }, a.slot.field)
891
- );
892
- }
893
- const y = a.f, L = G == null ? void 0 : G[y.field], D = L == null ? void 0 : L.entries, ne = (L == null ? void 0 : L.separator) ?? null, K = i[y.field], je = K != null && K !== "", Oe = D != null && D.length && je ? ((Te = s.find(
894
- (S) => S.many_collection === l && S.many_field === y.field && !S.junction_field
895
- )) == null ? void 0 : Te.one_collection) ?? null : null, Le = (M == null ? void 0 : M.enabled) && y.field === M.primary_field, Be = (() => {
896
- const S = i[(M == null ? void 0 : M.primary_field) ?? ""];
897
- return S != null && S !== "";
898
- })(), qe = (W ?? []).some((S) => {
899
- const J = i[S.field];
900
- return J != null && J !== "";
901
- }), at = Le && ge ? /* @__PURE__ */ N("span", { className: "inline-flex items-center gap-1.5", children: [
902
- /* @__PURE__ */ e(
903
- "button",
904
- {
905
- type: "button",
906
- onClick: ge,
907
- className: "inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-medium text-nvr-cyan hover:bg-nvr-cyan/10 transition-colors",
908
- children: be ? M.back_label ?? "Back" : M.toggle_label ?? "Enter manually"
909
- }
910
- ),
911
- /* @__PURE__ */ N(
912
- "span",
913
- {
914
- className: [
915
- "inline-flex items-center gap-0.5 rounded px-1 py-0.5 text-[9px] font-medium",
916
- Be ? "bg-emerald-50 text-emerald-600 dark:bg-emerald-900/30 dark:text-emerald-400" : "bg-slate-100 text-slate-400 dark:bg-slate-800 dark:text-slate-500"
917
- ].join(" "),
918
- title: "Original field",
919
- children: [
920
- /* @__PURE__ */ e(
921
- "span",
922
- {
923
- className: [
924
- "h-1.5 w-1.5 rounded-full",
925
- Be ? "bg-emerald-500" : "bg-slate-300 dark:bg-slate-600"
926
- ].join(" ")
927
- }
928
- ),
929
- "Original"
930
- ]
931
- }
932
- ),
933
- /* @__PURE__ */ N(
934
- "span",
935
- {
936
- className: [
937
- "inline-flex items-center gap-0.5 rounded px-1 py-0.5 text-[9px] font-medium",
938
- qe ? "bg-emerald-50 text-emerald-600 dark:bg-emerald-900/30 dark:text-emerald-400" : "bg-slate-100 text-slate-400 dark:bg-slate-800 dark:text-slate-500"
939
- ].join(" "),
940
- title: "Manual fields",
941
- children: [
942
- /* @__PURE__ */ e(
943
- "span",
944
- {
945
- className: [
946
- "h-1.5 w-1.5 rounded-full",
947
- qe ? "bg-emerald-500" : "bg-slate-300 dark:bg-slate-600"
948
- ].join(" ")
949
- }
950
- ),
951
- "Manual"
952
- ]
953
- }
954
- )
955
- ] }) : void 0, ot = Le && be && (W != null && W.length) ? /* @__PURE__ */ e("div", { className: "mt-2 rounded-lg border border-slate-200 bg-slate-50 dark:border-border dark:bg-slate-900/40 p-3", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-2 gap-3", children: W.map((S) => {
956
- const J = (ae == null ? void 0 : ae[S.field]) ?? 2;
957
- return /* @__PURE__ */ e("div", { style: { gridColumn: `span ${J}` }, children: /* @__PURE__ */ e(
958
- Ve,
1030
+ )
1031
+ ] }) : void 0, Nt = Pe && De && (Z != null && Z.length) ? /* @__PURE__ */ e("div", { className: "mt-2 rounded-lg border border-slate-200 bg-slate-50 dark:border-border dark:bg-slate-900/40 p-3", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-2 gap-3", children: Z.map((w) => {
1032
+ const C = (pe == null ? void 0 : pe[w.field]) ?? 2;
1033
+ return /* @__PURE__ */ e("div", { style: { gridColumn: `span ${C}` }, children: /* @__PURE__ */ e(
1034
+ ve,
1035
+ {
1036
+ field: w,
1037
+ draft: i,
1038
+ onChange: u,
1039
+ relations: s,
1040
+ collection: l,
1041
+ itemId: n,
1042
+ error: a[w.field],
1043
+ visible: !0,
1044
+ forceVisible: !0,
1045
+ locked: h.has(w.field),
1046
+ layoutAiEnabled: k,
1047
+ renderField: g,
1048
+ onCountChange: f
1049
+ }
1050
+ ) }, w.field);
1051
+ }) }) }) : void 0, Re = /* @__PURE__ */ e(
1052
+ ve,
959
1053
  {
960
- field: S,
1054
+ field: v,
961
1055
  draft: i,
962
1056
  onChange: u,
963
1057
  relations: s,
964
1058
  collection: l,
965
1059
  itemId: n,
966
- error: o[S.field],
967
- visible: !0,
968
- forceVisible: !0,
969
- locked: h.has(S.field),
970
- layoutAiEnabled: v,
971
- renderField: b,
972
- onCountChange: f
1060
+ error: a[v.field],
1061
+ visible: m.has(v.field) || !m.size,
1062
+ forceVisible: Ne(v) || void 0,
1063
+ locked: h.has(v.field),
1064
+ layoutAiEnabled: k,
1065
+ renderField: g,
1066
+ onCountChange: f,
1067
+ swapButton: yt,
1068
+ swapContent: Nt
973
1069
  }
974
- ) }, S.field);
975
- }) }) }) : void 0, Ie = /* @__PURE__ */ e(
976
- Ve,
977
- {
978
- field: y,
979
- draft: i,
980
- onChange: u,
981
- relations: s,
982
- collection: l,
983
- itemId: n,
984
- error: o[y.field],
985
- visible: p.has(y.field) || !p.size,
986
- forceVisible: $e(y) || void 0,
987
- locked: h.has(y.field),
988
- layoutAiEnabled: v,
989
- renderField: b,
990
- onCountChange: f,
991
- swapButton: at,
992
- swapContent: ot
993
- }
994
- );
995
- return H(
996
- { kind: "field", field: y.field, group_key: t.key },
997
- /* @__PURE__ */ N(
1070
+ );
1071
+ return H(
1072
+ { kind: "field", field: v.field, group_key: t.key },
1073
+ /* @__PURE__ */ x(
1074
+ "div",
1075
+ {
1076
+ style: { gridColumn: `span ${Ee(v.options, ye)}` },
1077
+ children: [
1078
+ Ne(v) ? /* @__PURE__ */ e("div", { "data-design-hidden": "", className: "opacity-40", children: Re }) : Re,
1079
+ (T == null ? void 0 : T.length) && Ge && Ve && /* @__PURE__ */ e(
1080
+ en,
1081
+ {
1082
+ relCollection: Ve,
1083
+ relId: ce,
1084
+ entries: T,
1085
+ separator: xt
1086
+ }
1087
+ )
1088
+ ]
1089
+ },
1090
+ v.field
1091
+ )
1092
+ );
1093
+ }, O = p.folded.map((b) => ({
1094
+ _k: b.field,
1095
+ sort: b.sort ?? 0,
1096
+ _t: "field",
1097
+ f: b
1098
+ }));
1099
+ return /* @__PURE__ */ x(_t, { children: [
1100
+ /* @__PURE__ */ x(
998
1101
  "div",
999
1102
  {
1000
- style: { gridColumn: `span ${Ce(y.options, Se)}` },
1103
+ ref: xe,
1104
+ className: W(F && "relative", "grid grid-cols-12 gap-4 items-start"),
1001
1105
  children: [
1002
- $e(y) ? /* @__PURE__ */ e("div", { "data-design-hidden": "", className: "opacity-40", children: Ie }) : Ie,
1003
- (D == null ? void 0 : D.length) && je && Oe && /* @__PURE__ */ e(
1004
- It,
1005
- {
1006
- relCollection: Oe,
1007
- relId: K,
1008
- entries: D,
1009
- separator: ne
1010
- }
1011
- )
1106
+ /* @__PURE__ */ e(we, {}),
1107
+ _.map(c)
1012
1108
  ]
1013
- },
1014
- y.field
1109
+ }
1110
+ ),
1111
+ /* @__PURE__ */ e(
1112
+ Kt,
1113
+ {
1114
+ count: O.length,
1115
+ open: dt,
1116
+ forcedOpen: p.forcedOpen,
1117
+ design: !!F,
1118
+ onToggle: () => ut((b) => !b),
1119
+ children: /* @__PURE__ */ x(
1120
+ "div",
1121
+ {
1122
+ className: W(F && "relative", "grid grid-cols-12 gap-4 items-start"),
1123
+ children: [
1124
+ /* @__PURE__ */ e(we, {}),
1125
+ O.map(c)
1126
+ ]
1127
+ }
1128
+ )
1129
+ }
1015
1130
  )
1016
- );
1017
- }) });
1131
+ ] });
1132
+ })();
1018
1133
  })(),
1019
- ee && /* @__PURE__ */ e("div", { className: "mt-4", children: ee })
1134
+ ie && /* @__PURE__ */ e("div", { className: "mt-4", children: ie })
1020
1135
  ] })
1021
1136
  ]
1022
1137
  }
1023
1138
  );
1024
1139
  }
1140
+ function ln({
1141
+ layoutId: t,
1142
+ collection: r,
1143
+ sectionKey: i
1144
+ }) {
1145
+ return ne(() => {
1146
+ it({ layoutId: t, collection: r, kind: "shown", key: i });
1147
+ }, [t, r, i]), null;
1148
+ }
1025
1149
  export {
1026
- sn as GroupSection,
1027
- It as InlineDisplay,
1028
- Ke as OwnersInline,
1029
- qt as OwnersInlineCompact,
1030
- X as RelationCell,
1031
- rn as StripFieldValue,
1032
- Ze as UserChip,
1033
- on as UserRosterCluster,
1034
- he as formatDisplayValue,
1035
- Mt as useChangePulse
1150
+ Ln as GroupSection,
1151
+ en as InlineDisplay,
1152
+ Ye as OwnersInline,
1153
+ Xt as OwnersInlineCompact,
1154
+ re as RelationCell,
1155
+ jn as StripFieldValue,
1156
+ at as UserChip,
1157
+ Bn as UserRosterCluster,
1158
+ ke as formatDisplayValue,
1159
+ rn as useChangePulse
1036
1160
  };