@nivaro/react 0.3.114 → 0.3.116

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 (293) hide show
  1. package/dist/components/ScreenShareHost.js +24 -0
  2. package/dist/full.css +50 -2
  3. package/dist/hooks/useSessionRecorder.js +61 -60
  4. package/dist/index.d.ts +1728 -22
  5. package/dist/index.js +1091 -950
  6. package/dist/shared/components/ActivityEntry.js +209 -97
  7. package/dist/shared/components/AgentPresenceChip.js +51 -0
  8. package/dist/shared/components/AnnouncementBanner.js +56 -41
  9. package/dist/shared/components/AutolinkedText.js +98 -85
  10. package/dist/shared/components/BroadcastView.js +149 -141
  11. package/dist/shared/components/CacheStamp.js +78 -30
  12. package/dist/shared/components/CollectionBrowserView.js +4909 -4182
  13. package/dist/shared/components/ConfigChangeStrip.js +63 -0
  14. package/dist/shared/components/ConfigReachNote.js +107 -0
  15. package/dist/shared/components/ConformanceView.js +389 -319
  16. package/dist/shared/components/DataTable.js +612 -551
  17. package/dist/shared/components/DelegateCoverLine.js +164 -0
  18. package/dist/shared/components/EnvironmentNotice.js +56 -65
  19. package/dist/shared/components/FilePreviewLightbox.js +89 -43
  20. package/dist/shared/components/FindingFixedMark.js +23 -0
  21. package/dist/shared/components/GridPresenceLine.js +100 -0
  22. package/dist/shared/components/IdleReloadWatcher.js +82 -43
  23. package/dist/shared/components/InStep.js +46 -0
  24. package/dist/shared/components/ItemEditForm.js +5504 -4889
  25. package/dist/shared/components/LiveAnnouncer.js +62 -0
  26. package/dist/shared/components/LiveCount.js +54 -0
  27. package/dist/shared/components/LiveFigure.js +28 -0
  28. package/dist/shared/components/LiveListControls.js +114 -0
  29. package/dist/shared/components/LiveNewMatchesPill.js +25 -0
  30. package/dist/shared/components/LiveOffNote.js +44 -0
  31. package/dist/shared/components/LivePreferenceHost.js +42 -0
  32. package/dist/shared/components/LiveRowMark.js +25 -20
  33. package/dist/shared/components/LiveTraceView.js +257 -0
  34. package/dist/shared/components/MapView.js +30 -29
  35. package/dist/shared/components/MatrixEditor.js +497 -462
  36. package/dist/shared/components/MyWorkView.js +346 -272
  37. package/dist/shared/components/NotificationBell.js +215 -201
  38. package/dist/shared/components/OverflowRail.js +326 -0
  39. package/dist/shared/components/PageRenderer.js +636 -599
  40. package/dist/shared/components/PresenceDot.js +21 -0
  41. package/dist/shared/components/ProfileView.js +656 -536
  42. package/dist/shared/components/RealtimeStatusBanner.js +25 -25
  43. package/dist/shared/components/RecentRecordsRail.js +51 -48
  44. package/dist/shared/components/RecordCompare.js +241 -150
  45. package/dist/shared/components/RecordDrilldownSheet.js +66 -64
  46. package/dist/shared/components/RecordGridEditor.js +350 -311
  47. package/dist/shared/components/RecordHoverCard.js +147 -0
  48. package/dist/shared/components/RecordPeekHost.js +111 -0
  49. package/dist/shared/components/RecordReadView.js +414 -412
  50. package/dist/shared/components/RelativeTime.js +16 -0
  51. package/dist/shared/components/ReportView.js +1396 -1304
  52. package/dist/shared/components/ScreenRefreshButton.js +77 -0
  53. package/dist/shared/components/TabCountHost.js +10 -0
  54. package/dist/shared/components/TickerNumber.js +19 -18
  55. package/dist/shared/components/TipLayer.js +70 -58
  56. package/dist/shared/components/WidgetImageMenu.js +59 -0
  57. package/dist/shared/components/WidgetSlot.js +571 -524
  58. package/dist/shared/components/activity/RecordActivityStream.js +317 -0
  59. package/dist/shared/components/bulk/BulkSelectionNotices.js +220 -0
  60. package/dist/shared/components/cbv/approval-changed.js +20 -0
  61. package/dist/shared/components/cbv/changed-by-others.js +251 -0
  62. package/dist/shared/components/change-proposals/ChangeProposalsPanel.js +320 -0
  63. package/dist/shared/components/change-proposals/ProposalValue.js +28 -0
  64. package/dist/shared/components/change-proposals/ProposeChangeButton.js +44 -0
  65. package/dist/shared/components/change-proposals/ProposeChangeDialog.js +359 -0
  66. package/dist/shared/components/change-proposals/types.js +4 -0
  67. package/dist/shared/components/chat/ChatPanel.js +1571 -1528
  68. package/dist/shared/components/chat/Composer.js +276 -298
  69. package/dist/shared/components/chat/room-due.js +13 -0
  70. package/dist/shared/components/collections-directory/CollectionRow.js +76 -75
  71. package/dist/shared/components/collections-directory/CollectionsDirectory.js +415 -395
  72. package/dist/shared/components/collections-directory/directory-data.js +75 -63
  73. package/dist/shared/components/imports/ImportConsole.js +159 -155
  74. package/dist/shared/components/imports/ImportDuplicatesNotice.js +46 -31
  75. package/dist/shared/components/integrations/SendStatus.js +202 -0
  76. package/dist/shared/components/integrations/console/IntegrationsConsole.js +45 -36
  77. package/dist/shared/components/integrations/console/ReadyToSendView.js +453 -0
  78. package/dist/shared/components/integrations/console/SignalCard.js +84 -77
  79. package/dist/shared/components/integrations/console/api.js +161 -117
  80. package/dist/shared/components/integrations/console/tone.js +15 -12
  81. package/dist/shared/components/item-edit/CatalogPickerField.js +1353 -1245
  82. package/dist/shared/components/item-edit/ChangedAfterApprovalBadge.js +162 -0
  83. package/dist/shared/components/item-edit/CloneDialog.js +208 -206
  84. package/dist/shared/components/item-edit/DerivedCauseNote.js +57 -0
  85. package/dist/shared/components/item-edit/DraftRecoveryBanner.js +81 -70
  86. package/dist/shared/components/item-edit/DuplicateNotice.js +169 -101
  87. package/dist/shared/components/item-edit/FieldAffordances.js +294 -385
  88. package/dist/shared/components/item-edit/FieldComments.js +159 -116
  89. package/dist/shared/components/item-edit/FieldPointer.js +132 -0
  90. package/dist/shared/components/item-edit/FieldRenderer.js +277 -273
  91. package/dist/shared/components/item-edit/FieldRow.js +519 -439
  92. package/dist/shared/components/item-edit/FieldSourceBadge.js +88 -0
  93. package/dist/shared/components/item-edit/FilePickerField.js +454 -369
  94. package/dist/shared/components/item-edit/GroupSection.js +618 -567
  95. package/dist/shared/components/item-edit/HeldEditsChip.js +113 -0
  96. package/dist/shared/components/item-edit/InlineTableField.js +2891 -2723
  97. package/dist/shared/components/item-edit/ListNeighborNav.js +79 -0
  98. package/dist/shared/components/item-edit/LiveTraceSheet.js +26 -0
  99. package/dist/shared/components/item-edit/M2MCombobox.js +284 -273
  100. package/dist/shared/components/item-edit/OutboxReviewTray.js +313 -0
  101. package/dist/shared/components/item-edit/PickerBadges.js +52 -0
  102. package/dist/shared/components/item-edit/PlanGrid.js +434 -439
  103. package/dist/shared/components/item-edit/RecalcValue.js +55 -0
  104. package/dist/shared/components/item-edit/RecordChatActions.js +76 -64
  105. package/dist/shared/components/item-edit/RecordChatMentionsChip.js +103 -0
  106. package/dist/shared/components/item-edit/RecordGrantTools.js +87 -86
  107. package/dist/shared/components/item-edit/RecordHelpChip.js +70 -0
  108. package/dist/shared/components/item-edit/RecordLiveSync.js +230 -217
  109. package/dist/shared/components/item-edit/RecordOutbox.js +53 -52
  110. package/dist/shared/components/item-edit/RecordRecapStrip.js +109 -36
  111. package/dist/shared/components/item-edit/RelationCombobox.js +229 -217
  112. package/dist/shared/components/item-edit/RelationGroupedCombobox.js +105 -100
  113. package/dist/shared/components/item-edit/RemoteChangeUi.js +454 -0
  114. package/dist/shared/components/item-edit/RemoteUploads.js +55 -0
  115. package/dist/shared/components/item-edit/RemovedLineNote.js +92 -0
  116. package/dist/shared/components/item-edit/RichTextEditorImpl.js +298 -223
  117. package/dist/shared/components/item-edit/ScheduledChangeChip.js +244 -0
  118. package/dist/shared/components/item-edit/SectionPresence.js +78 -0
  119. package/dist/shared/components/item-edit/SplitLinesButton.js +166 -0
  120. package/dist/shared/components/item-edit/catalog-line-watch.js +94 -0
  121. package/dist/shared/components/item-edit/coedit/collab.js +84 -0
  122. package/dist/shared/components/item-edit/coedit/context.js +24 -0
  123. package/dist/shared/components/item-edit/coedit/cursors.js +103 -0
  124. package/dist/shared/components/item-edit/coedit/safe-link.js +15 -0
  125. package/dist/shared/components/item-edit/coedit/session.js +382 -0
  126. package/dist/shared/components/item-edit/coedit/useCoedit.js +49 -0
  127. package/dist/shared/components/item-edit/file-live.js +77 -0
  128. package/dist/shared/components/item-edit/file-processing.js +87 -0
  129. package/dist/shared/components/item-edit/layout-switch.js +148 -0
  130. package/dist/shared/components/item-edit/live-related.js +23 -0
  131. package/dist/shared/components/item-edit/live-title.js +66 -0
  132. package/dist/shared/components/item-edit/partner-needs.js +142 -0
  133. package/dist/shared/components/item-edit/removed-line.js +58 -0
  134. package/dist/shared/components/item-edit/render-stability.js +70 -59
  135. package/dist/shared/components/layout-editor/ChangeNote.js +36 -34
  136. package/dist/shared/components/layout-editor/CollabParts.js +72 -70
  137. package/dist/shared/components/layout-editor/LayoutEditor.js +306 -303
  138. package/dist/shared/components/list/InlineEdit.js +504 -208
  139. package/dist/shared/components/list/ListViewers.js +81 -0
  140. package/dist/shared/components/list/PhonePager.js +50 -0
  141. package/dist/shared/components/merge/MergeRecordsDialog.js +1227 -0
  142. package/dist/shared/components/merge/MergeWithFlow.js +290 -0
  143. package/dist/shared/components/merge/merge-values.js +110 -0
  144. package/dist/shared/components/monitoring/InactiveUserLinksView.js +285 -258
  145. package/dist/shared/components/notifications/NotificationCenterView.js +389 -323
  146. package/dist/shared/components/notifications/NotificationDetailBits.js +205 -130
  147. package/dist/shared/components/notifications/NotificationRulesEditor.js +72 -52
  148. package/dist/shared/components/notifications/bundles.js +21 -19
  149. package/dist/shared/components/notifications/resolved-line.js +25 -0
  150. package/dist/shared/components/ops/OpsTasksView.js +45 -44
  151. package/dist/shared/components/panels/AccessGrantedNote.js +85 -0
  152. package/dist/shared/components/panels/AlertBanners.js +132 -0
  153. package/dist/shared/components/panels/AsyncUserPicker.js +54 -45
  154. package/dist/shared/components/panels/BranchLanes.js +82 -54
  155. package/dist/shared/components/panels/CommentAwareness.js +332 -0
  156. package/dist/shared/components/panels/CommentImages.js +219 -0
  157. package/dist/shared/components/panels/CommentPanel.js +649 -530
  158. package/dist/shared/components/panels/ExternalRequestsChip.js +98 -80
  159. package/dist/shared/components/panels/NewSinceChip.js +16 -0
  160. package/dist/shared/components/panels/OwnerOpenedLine.js +85 -0
  161. package/dist/shared/components/panels/PipelinePanel.js +1644 -1494
  162. package/dist/shared/components/panels/ResubmissionDiff.js +293 -0
  163. package/dist/shared/components/panels/SlaBreachBanner.js +30 -29
  164. package/dist/shared/components/panels/SlaClock.js +130 -99
  165. package/dist/shared/components/panels/TaskPanel.js +308 -287
  166. package/dist/shared/components/panels/unseen-move-check.js +101 -0
  167. package/dist/shared/components/pipeline/OwnerMatrix.js +80 -71
  168. package/dist/shared/components/pipeline/OwnerMatrixSheet.js +495 -0
  169. package/dist/shared/components/pipeline/PipelineEditorView.js +2050 -1942
  170. package/dist/shared/components/profile/AgentNameField.js +141 -0
  171. package/dist/shared/components/profile/AgentsPanel.js +55 -46
  172. package/dist/shared/components/profile/PersonAccess.js +398 -330
  173. package/dist/shared/components/profile/PersonAdminTools.js +127 -113
  174. package/dist/shared/components/profile/PersonProfile.js +81 -73
  175. package/dist/shared/components/profile/SignInTroubleshooter.js +361 -0
  176. package/dist/shared/components/queue/OwnerAvatars.js +9 -9
  177. package/dist/shared/components/queue/QueueBulkBar.js +101 -84
  178. package/dist/shared/components/queue/QueueItemSheet.js +66 -66
  179. package/dist/shared/components/queue/QueueTeamStrip.js +279 -0
  180. package/dist/shared/components/queue/QueueWorklist.js +2407 -1950
  181. package/dist/shared/components/queue/worklist-helpers.js +10 -6
  182. package/dist/shared/components/send-view/SendViewButton.js +136 -0
  183. package/dist/shared/components/send-view/SentViewCards.js +147 -0
  184. package/dist/shared/components/support/ReportProblem.js +1 -0
  185. package/dist/shared/components/support/ScreenShare.js +554 -0
  186. package/dist/shared/components/support/SupportView.js +160 -129
  187. package/dist/shared/components/support/TicketDetailSheet.js +101 -89
  188. package/dist/shared/components/ui/popover.js +53 -29
  189. package/dist/shared/components/watch-list/WatchDock.js +1044 -0
  190. package/dist/shared/components/watch-list/WatchExtras.js +723 -0
  191. package/dist/shared/components/watch-list/WatchListButton.js +46 -0
  192. package/dist/shared/components/watch-list/WatchPinButton.js +67 -0
  193. package/dist/shared/components/watch-list/WatchRows.js +348 -0
  194. package/dist/shared/lib/activity-sentence.js +87 -75
  195. package/dist/shared/lib/agent-presence.js +46 -0
  196. package/dist/shared/lib/approval-progress.js +49 -0
  197. package/dist/shared/lib/attention-prefs.js +27 -0
  198. package/dist/shared/lib/cell-locks.js +56 -0
  199. package/dist/shared/lib/co-edit.js +166 -0
  200. package/dist/shared/lib/coedit-registry.js +44 -0
  201. package/dist/shared/lib/comment-awareness.js +124 -0
  202. package/dist/shared/lib/comment-images.js +45 -0
  203. package/dist/shared/lib/config-watch.js +94 -0
  204. package/dist/shared/lib/copy-rules.js +65 -0
  205. package/dist/shared/lib/count-step.js +30 -0
  206. package/dist/shared/lib/deadline-ticker.js +68 -0
  207. package/dist/shared/lib/derived-causes.js +115 -0
  208. package/dist/shared/lib/draft-store.js +114 -85
  209. package/dist/shared/lib/error-hints.js +1 -0
  210. package/dist/shared/lib/field-merge.js +126 -0
  211. package/dist/shared/lib/filter-sentence.js +10 -10
  212. package/dist/shared/lib/focus-mode.js +16 -12
  213. package/dist/shared/lib/grid-cursors.js +77 -0
  214. package/dist/shared/lib/grid-presence.js +182 -0
  215. package/dist/shared/lib/idle-reload.js +100 -73
  216. package/dist/shared/lib/in-step.js +45 -0
  217. package/dist/shared/lib/integration-chip.js +19 -18
  218. package/dist/shared/lib/keep-row-focus.js +43 -0
  219. package/dist/shared/lib/line-locks.js +141 -0
  220. package/dist/shared/lib/line-split.js +41 -0
  221. package/dist/shared/lib/linked-changes.js +150 -0
  222. package/dist/shared/lib/list-return.js +231 -0
  223. package/dist/shared/lib/list-viewers.js +52 -0
  224. package/dist/shared/lib/live-announcer.js +86 -0
  225. package/dist/shared/lib/live-counts.js +85 -0
  226. package/dist/shared/lib/live-data-changed.js +108 -0
  227. package/dist/shared/lib/live-deltas.js +81 -0
  228. package/dist/shared/lib/live-findings.js +113 -0
  229. package/dist/shared/lib/live-groups.js +122 -0
  230. package/dist/shared/lib/live-link-labels.js +162 -0
  231. package/dist/shared/lib/live-list-flow.js +334 -0
  232. package/dist/shared/lib/live-list.js +143 -129
  233. package/dist/shared/lib/live-moves.js +51 -0
  234. package/dist/shared/lib/live-ops.js +26 -26
  235. package/dist/shared/lib/live-pickers.js +7 -0
  236. package/dist/shared/lib/live-preference.js +184 -0
  237. package/dist/shared/lib/live-queries.js +226 -181
  238. package/dist/shared/lib/live-screen.js +333 -0
  239. package/dist/shared/lib/live-search.js +108 -0
  240. package/dist/shared/lib/live-seen.js +35 -0
  241. package/dist/shared/lib/live-views.js +100 -0
  242. package/dist/shared/lib/live.js +159 -133
  243. package/dist/shared/lib/missed-updates.js +198 -0
  244. package/dist/shared/lib/newer-file.js +56 -0
  245. package/dist/shared/lib/notification-sound.js +42 -20
  246. package/dist/shared/lib/obligation-banner.js +17 -17
  247. package/dist/shared/lib/own-writes.js +59 -41
  248. package/dist/shared/lib/picker-badges.js +94 -0
  249. package/dist/shared/lib/presence-signals.js +131 -84
  250. package/dist/shared/lib/rail-menu-context.js +9 -0
  251. package/dist/shared/lib/realtime.js +49 -24
  252. package/dist/shared/lib/record-gaps.js +85 -0
  253. package/dist/shared/lib/record-outbox.js +369 -222
  254. package/dist/shared/lib/record-peek.js +75 -0
  255. package/dist/shared/lib/record-tabs.js +92 -72
  256. package/dist/shared/lib/relative-ticker.js +42 -0
  257. package/dist/shared/lib/request-gate.js +119 -119
  258. package/dist/shared/lib/rollup-recalc.js +107 -0
  259. package/dist/shared/lib/room-gaps.js +40 -36
  260. package/dist/shared/lib/row-surface.js +7 -0
  261. package/dist/shared/lib/rum.js +137 -87
  262. package/dist/shared/lib/save-progress.js +20 -0
  263. package/dist/shared/lib/scheduled-countdown.js +67 -0
  264. package/dist/shared/lib/screen-refresh.js +160 -0
  265. package/dist/shared/lib/screen-share.js +234 -0
  266. package/dist/shared/lib/seen-since.js +74 -0
  267. package/dist/shared/lib/selection-watch.js +205 -0
  268. package/dist/shared/lib/send-status.js +132 -0
  269. package/dist/shared/lib/send-view.js +23 -0
  270. package/dist/shared/lib/socket-liveness.js +155 -0
  271. package/dist/shared/lib/socket-realtime.js +168 -140
  272. package/dist/shared/lib/state-census.js +53 -0
  273. package/dist/shared/lib/summary-mode.js +61 -39
  274. package/dist/shared/lib/tab-attention.js +143 -32
  275. package/dist/shared/lib/table-density.js +64 -0
  276. package/dist/shared/lib/table-pins.js +20 -18
  277. package/dist/shared/lib/track-travel.js +40 -0
  278. package/dist/shared/lib/unseen-changes.js +68 -0
  279. package/dist/shared/lib/upload-file.js +62 -0
  280. package/dist/shared/lib/upload-presence.js +127 -0
  281. package/dist/shared/lib/urgent-chime.js +65 -0
  282. package/dist/shared/lib/use-below-md.js +29 -0
  283. package/dist/shared/lib/use-online-users.js +32 -11
  284. package/dist/shared/lib/user-sync.js +155 -39
  285. package/dist/shared/lib/waiting-count.js +44 -0
  286. package/dist/shared/lib/watch-desktop.js +83 -0
  287. package/dist/shared/lib/watch-list.js +447 -0
  288. package/dist/shared/lib/widget-image-render.js +64 -0
  289. package/dist/shared/lib/widget-image.js +111 -0
  290. package/dist/shared/lib/worker-socket.js +130 -104
  291. package/dist/shared/lib/write-to-screen.js +133 -0
  292. package/package.json +1 -1
  293. package/styles.css +49 -1
@@ -1,31 +1,35 @@
1
- import { jsx as e, jsxs as y, Fragment as Dt } from "react/jsx-runtime";
2
- import { useQuery as de, useQueryClient as Ft } from "@tanstack/react-query";
3
- import * as jt from "lucide-react";
4
- import { ChevronDown as Ot, Loader2 as qt, User as Bt, Mail as Ut } from "lucide-react";
5
- import st, { useContext as Tt, useState as te, useRef as $e, useEffect as ne, memo as It } from "react";
6
- import { RelationPathDataContext as Mt, useDrilldown as lt, fieldDrilldownConfig as Pt, useOptionalNivaroClient as ue, useNavigation as Gt } from "../../context.js";
7
- import { get as at, post as Ct } from "../../lib/commands.js";
8
- import { planFieldGrid as Lt, isEmptyValue as Vt, isFolded as Jt, readGroupStructure as Rt } from "../../lib/form-structure.js";
9
- import { reportSectionUse as ot } from "../../lib/form-usage-beacon.js";
10
- import { useRecordReader as ct } from "../../lib/record-loader.js";
11
- import { useStartsOpen as zt } from "../../lib/use-starts-open.js";
12
- import { formatDate as ce, formatDateTime as dt, choiceLabel as Ht, titleCase as ut, cn as E, toLocalDateString as De } from "../../lib/utils.js";
13
- import { DesignDropZone as Kt, designWrap as Et } from "../layout-editor/DesignNode.js";
14
- import { useLayoutDesign as Wt, revealGroupKey as At } from "../layout-editor/design-context.js";
15
- import { GridGuides as ke } from "../layout-editor/grid-guides.js";
16
- import { UserAvatar as Yt } from "../UserAvatar.js";
17
- import { DropdownMenu as Qt, DropdownMenuTrigger as Zt, DropdownMenuContent as Xt, DropdownMenuItem as Ye } from "../ui/dropdown-menu.js";
18
- import { WidgetSlot as Qe } from "../WidgetSlot.js";
19
- import { FieldRow as Se } from "./FieldRow.js";
20
- import { useFormHelpVideos as en, FormHelpVideoButton as tn } from "./FormHelpVideoButton.js";
21
- import { FoldArea as nn, RowGroupCell as rn, rowMemberField as sn } from "./form-structure-ui.js";
22
- import { applyDisplayTemplate as ln, useContainerWidth as an, resolveColSpan as Ze } from "./helpers.js";
23
- import { SectionIntro as on } from "./LayoutContentBlock.js";
24
- import { invalidateM2MFor as cn } from "./m2m-invalidate.js";
25
- import { groupSectionPropsEqual as dn } from "./render-stability.js";
26
- import { UserChip as pt, OwnersInline as Xe, OwnersInlineCompact as un } from "./UserChip.js";
27
- import { UserRosterCluster as En } from "./UserChip.js";
28
- function et(n) {
1
+ import { jsx as e, jsxs as x, Fragment as Bt } from "react/jsx-runtime";
2
+ import { useQuery as pe, useQueryClient as Ut } from "@tanstack/react-query";
3
+ import * as Pt from "lucide-react";
4
+ import { ChevronDown as Mt, Loader2 as Gt, User as It, Mail as Tt } from "lucide-react";
5
+ import ut, { useContext as Vt, useState as re, useRef as me, useEffect as Q, memo as Et } from "react";
6
+ import { RelationPathDataContext as Ct, useDrilldown as pt, fieldDrilldownConfig as Rt, useOptionalNivaroClient as fe, useNavigation as Jt } from "../../context.js";
7
+ import { OPEN_SECTION_EVENT as tt } from "../../lib/co-edit.js";
8
+ import { get as mt, post as zt } from "../../lib/commands.js";
9
+ import { useCountStep as Ht, countLabel as je } from "../../lib/count-step.js";
10
+ import { planFieldGrid as Kt, isEmptyValue as Wt, isFolded as At, readGroupStructure as Yt } from "../../lib/form-structure.js";
11
+ import { reportSectionUse as ft } from "../../lib/form-usage-beacon.js";
12
+ import { useRecordReader as ht } from "../../lib/record-loader.js";
13
+ import { useStartsOpen as Qt } from "../../lib/use-starts-open.js";
14
+ import { formatDate as ue, formatDateTime as bt, choiceLabel as Zt, titleCase as xt, cn as W, toLocalDateString as Le } from "../../lib/utils.js";
15
+ import { LiveCount as yt } from "../LiveCount.js";
16
+ import { DesignDropZone as Xt, designWrap as en } from "../layout-editor/DesignNode.js";
17
+ import { useLayoutDesign as tn, revealGroupKey as nn } from "../layout-editor/design-context.js";
18
+ import { GridGuides as Fe } from "../layout-editor/grid-guides.js";
19
+ import { UserAvatar as rn } from "../UserAvatar.js";
20
+ import { DropdownMenu as sn, DropdownMenuTrigger as ln, DropdownMenuContent as an, DropdownMenuItem as nt } from "../ui/dropdown-menu.js";
21
+ import { WidgetSlot as rt } from "../WidgetSlot.js";
22
+ import { FieldRow as Oe } from "./FieldRow.js";
23
+ import { useFormHelpVideos as on, FormHelpVideoButton as cn } from "./FormHelpVideoButton.js";
24
+ import { FoldArea as dn, RowGroupCell as un, rowMemberField as pn } from "./form-structure-ui.js";
25
+ import { applyDisplayTemplate as mn, useContainerWidth as fn, resolveColSpan as it } from "./helpers.js";
26
+ import { SectionIntro as hn } from "./LayoutContentBlock.js";
27
+ import { invalidateM2MFor as bn } from "./m2m-invalidate.js";
28
+ import { groupSectionPropsEqual as xn } from "./render-stability.js";
29
+ import { SectionPresence as yn } from "./SectionPresence.js";
30
+ import { UserChip as gt, OwnersInline as st, OwnersInlineCompact as gn } from "./UserChip.js";
31
+ import { UserRosterCluster as lr } from "./UserChip.js";
32
+ function lt(n) {
29
33
  if (typeof n != "string") return n ?? [];
30
34
  try {
31
35
  return JSON.parse(n);
@@ -33,94 +37,94 @@ function et(n) {
33
37
  return [];
34
38
  }
35
39
  }
36
- function pn({
40
+ function Nn({
37
41
  relCollection: n,
38
42
  relId: t,
39
43
  entries: i,
40
- separator: a
44
+ separator: o
41
45
  }) {
42
- const s = ue(), o = ct(), r = String(t), m = i.some((g) => g.field.includes(".")) ? ["id", ...i.map((g) => g.field)].join(",") : null, { data: d } = de({
43
- queryKey: ["inline-display", n, r, m],
44
- queryFn: () => o(n, r, m),
45
- enabled: !!s && !!r,
46
+ const l = fe(), c = ht(), r = String(t), f = i.some((g) => g.field.includes(".")) ? ["id", ...i.map((g) => g.field)].join(",") : null, { data: u } = pe({
47
+ queryKey: ["inline-display", n, r, f],
48
+ queryFn: () => c(n, r, f),
49
+ enabled: !!l && !!r,
46
50
  staleTime: 6e4
47
51
  });
48
- if (!d) return null;
49
- const F = (g) => {
50
- let h = d;
52
+ if (!u) return null;
53
+ const O = (g) => {
54
+ let h = u;
51
55
  for (const v of g.split(".")) {
52
56
  if (h == null || typeof h != "object") return;
53
57
  h = h[v];
54
58
  }
55
59
  return h;
56
60
  };
57
- if (a != null) {
58
- const g = (c) => {
59
- const x = F(c.field);
60
- if (x == null || x === "") return null;
61
- const S = c.format ?? "text";
62
- if (S === "date" || S === "datetime")
61
+ if (o != null) {
62
+ const g = (d) => {
63
+ const y = O(d.field);
64
+ if (y == null || y === "") return null;
65
+ const k = d.format ?? "text";
66
+ if (k === "date" || k === "datetime")
63
67
  try {
64
- return De(x);
68
+ return Le(y);
65
69
  } catch {
66
- return String(x);
70
+ return String(y);
67
71
  }
68
- return S === "boolean" ? x ? "Yes" : "No" : String(x);
72
+ return k === "boolean" ? y ? "Yes" : "No" : String(y);
69
73
  }, h = [];
70
74
  let v = [];
71
- for (const c of i)
72
- c.line_break && v.length > 0 ? (h.push(v), v = [c]) : v.push(c);
75
+ for (const d of i)
76
+ d.line_break && v.length > 0 ? (h.push(v), v = [d]) : v.push(d);
73
77
  v.length > 0 && h.push(v);
74
- const O = h.map(
75
- (c) => c.map((x) => {
76
- const S = g(x);
77
- return S ? { label: x.label ?? null, display: S } : null;
78
+ const j = h.map(
79
+ (d) => d.map((y) => {
80
+ const k = g(y);
81
+ return k ? { label: y.label ?? null, display: k } : null;
78
82
  }).filter(Boolean)
79
- ).filter((c) => c.length > 0);
80
- return O.length === 0 ? null : /* @__PURE__ */ e("div", { className: "mt-1", children: O.map((c, x) => (
83
+ ).filter((d) => d.length > 0);
84
+ return j.length === 0 ? null : /* @__PURE__ */ e("div", { className: "mt-1", children: j.map((d, y) => (
81
85
  // biome-ignore lint/suspicious/noArrayIndexKey: stable line order
82
- /* @__PURE__ */ e("p", { className: "text-[12px] text-slate-500 dark:text-slate-400", children: c.map((S, D) => (
86
+ /* @__PURE__ */ e("p", { className: "text-[12px] text-slate-500 dark:text-slate-400", children: d.map((k, D) => (
83
87
  // biome-ignore lint/suspicious/noArrayIndexKey: stable token order
84
- /* @__PURE__ */ y(st.Fragment, { children: [
85
- D > 0 && a,
86
- S.label && /* @__PURE__ */ y("span", { className: "font-semibold text-slate-600 dark:text-slate-300", children: [
87
- S.label,
88
+ /* @__PURE__ */ x(ut.Fragment, { children: [
89
+ D > 0 && o,
90
+ k.label && /* @__PURE__ */ x("span", { className: "font-semibold text-slate-600 dark:text-slate-300", children: [
91
+ k.label,
88
92
  ":"
89
93
  ] }),
90
- S.label ? " " : "",
91
- S.display
94
+ k.label ? " " : "",
95
+ k.display
92
96
  ] }, D)
93
- )) }, x)
97
+ )) }, y)
94
98
  )) });
95
99
  }
96
100
  const $ = i.map((g) => {
97
- const h = F(g.field);
101
+ const h = O(g.field);
98
102
  if (h == null || h === "") return null;
99
103
  const v = g.format ?? "text";
100
- let O;
104
+ let j;
101
105
  if (v === "date" || v === "datetime")
102
106
  try {
103
- O = De(h);
107
+ j = Le(h);
104
108
  } catch {
105
- O = String(h);
109
+ j = String(h);
106
110
  }
107
- else v === "boolean" ? O = h ? "Yes" : "No" : O = String(h);
108
- return { label: g.label, display: O };
111
+ else v === "boolean" ? j = h ? "Yes" : "No" : j = String(h);
112
+ return { label: g.label, display: j };
109
113
  }).filter(Boolean);
110
114
  return $.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: $.map((g, h) => (
111
115
  // biome-ignore lint/suspicious/noArrayIndexKey: stable order from config
112
- /* @__PURE__ */ y("div", { className: "flex items-baseline gap-2", children: [
116
+ /* @__PURE__ */ x("div", { className: "flex items-baseline gap-2", children: [
113
117
  g.label && /* @__PURE__ */ e("span", { className: "shrink-0 min-w-[56px] text-[10px] font-medium text-slate-400", children: g.label }),
114
118
  /* @__PURE__ */ e("span", { className: "text-[12px] text-slate-700 dark:text-slate-300 truncate", children: g.display })
115
119
  ] }, h)
116
120
  )) });
117
121
  }
118
- function mn(n) {
122
+ function _n(n) {
119
123
  if (!n) return null;
120
- const t = n.replace(/(^|-)([a-z])/g, (a, s, o) => o.toUpperCase()), i = jt[t];
124
+ const t = n.replace(/(^|-)([a-z])/g, (o, l, c) => c.toUpperCase()), i = Pt[t];
121
125
  return i || null;
122
126
  }
123
- function tt(n) {
127
+ function at(n) {
124
128
  if (!n.options) return {};
125
129
  if (typeof n.options == "object") return n.options;
126
130
  try {
@@ -129,10 +133,10 @@ function tt(n) {
129
133
  return {};
130
134
  }
131
135
  }
132
- function Fe(n, t) {
136
+ function qe(n, t) {
133
137
  if (n == null || n === "") return "—";
134
138
  if (typeof n == "boolean") return n ? "Yes" : "No";
135
- const i = (t == null ? void 0 : t.interface) ?? "", a = (() => {
139
+ const i = (t == null ? void 0 : t.interface) ?? "", o = (() => {
136
140
  try {
137
141
  const r = t != null && t.options ? JSON.parse(String(t.options)) : null;
138
142
  return (r == null ? void 0 : r.display_format) ?? null;
@@ -140,19 +144,19 @@ function Fe(n, t) {
140
144
  return null;
141
145
  }
142
146
  })();
143
- if (a) {
147
+ if (o) {
144
148
  const r = Number(n);
145
- if (a === "currency" && Number.isFinite(r))
149
+ if (o === "currency" && Number.isFinite(r))
146
150
  return r.toLocaleString(void 0, { style: "currency", currency: "USD" });
147
- if (a === "percent" && Number.isFinite(r)) return `${(r * 100).toFixed(1)}%`;
148
- if (/^0\.0+$/.test(a) && Number.isFinite(r)) return r.toFixed(a.length - 2);
149
- if (a === "date" && typeof n == "string") {
150
- const l = n.length === 10 ? /* @__PURE__ */ new Date(`${n}T00:00:00`) : new Date(n);
151
- if (!Number.isNaN(l.getTime())) return ce(n);
151
+ if (o === "percent" && Number.isFinite(r)) return `${(r * 100).toFixed(1)}%`;
152
+ if (/^0\.0+$/.test(o) && Number.isFinite(r)) return r.toFixed(o.length - 2);
153
+ if (o === "date" && typeof n == "string") {
154
+ const s = n.length === 10 ? /* @__PURE__ */ new Date(`${n}T00:00:00`) : new Date(n);
155
+ if (!Number.isNaN(s.getTime())) return ue(n);
152
156
  }
153
- if (a === "datetime" && typeof n == "string") {
154
- const l = new Date(n);
155
- if (!Number.isNaN(l.getTime())) return l.toLocaleString();
157
+ if (o === "datetime" && typeof n == "string") {
158
+ const s = new Date(n);
159
+ if (!Number.isNaN(s.getTime())) return s.toLocaleString();
156
160
  }
157
161
  }
158
162
  if (i === "duration" && Number.isFinite(Number(n))) {
@@ -164,7 +168,7 @@ function Fe(n, t) {
164
168
  if (i === "checklist" && typeof n == "string")
165
169
  try {
166
170
  const r = JSON.parse(n);
167
- if (Array.isArray(r)) return `${r.filter((l) => l == null ? void 0 : l.done).length}/${r.length} done`;
171
+ if (Array.isArray(r)) return `${r.filter((s) => s == null ? void 0 : s.done).length}/${r.length} done`;
168
172
  } catch {
169
173
  }
170
174
  if (i === "address" && typeof n == "string" && n.trim().startsWith("{"))
@@ -183,104 +187,104 @@ function Fe(n, t) {
183
187
  return String(n);
184
188
  }
185
189
  }
186
- const s = String(n);
187
- if (i === "datetime" || i === "date" || /^\d{4}-\d{2}-\d{2}T/.test(s) || /^\d{4}-\d{2}-\d{2}$/.test(s))
190
+ const l = String(n);
191
+ if (i === "datetime" || i === "date" || /^\d{4}-\d{2}-\d{2}T/.test(l) || /^\d{4}-\d{2}-\d{2}$/.test(l))
188
192
  try {
189
- let r = /^\d{4}-\d{2}-\d{2}$/.test(s) || i === "date";
193
+ let r = /^\d{4}-\d{2}-\d{2}$/.test(l) || i === "date";
190
194
  if (!r && (t != null && t.options))
191
195
  try {
192
- const m = typeof t.options == "string" ? JSON.parse(t.options) : t.options;
193
- m && m.date_mode === "date" && (r = !0);
196
+ const f = typeof t.options == "string" ? JSON.parse(t.options) : t.options;
197
+ f && f.date_mode === "date" && (r = !0);
194
198
  } catch {
195
199
  }
196
- const l = s.match(/^(\d{4})-(\d{2})-(\d{2})(?:T00:00:00(?:\.000)?Z)?$/);
197
- return l ? ce(`${l[1]}-${l[2]}-${l[3]}`) : r ? ce(s) : dt(s);
200
+ const s = l.match(/^(\d{4})-(\d{2})-(\d{2})(?:T00:00:00(?:\.000)?Z)?$/);
201
+ return s ? ue(`${s[1]}-${s[2]}-${s[3]}`) : r ? ue(l) : bt(l);
198
202
  } catch {
199
203
  }
200
204
  if ((i === "select-dropdown" || i === "radio-buttons") && t) {
201
- const l = tt(t).choices;
202
- if (Array.isArray(l)) {
203
- const m = l.find((d) => String(d.value) === s);
204
- if (m) return Ht(m.text);
205
+ const s = at(t).choices;
206
+ if (Array.isArray(s)) {
207
+ const f = s.find((u) => String(u.value) === l);
208
+ if (f) return Zt(f.text);
205
209
  }
206
210
  }
207
- const o = Number(s);
208
- if (!Number.isNaN(o) && s !== "" && t) {
209
- const r = tt(t), l = r.format, m = typeof r.unit == "string" ? r.unit.trim() : "";
210
- if (m && !l) {
211
- const d = new Intl.NumberFormat(void 0, { maximumFractionDigits: 2 }).format(o);
212
- if (m === "$")
211
+ const c = Number(l);
212
+ if (!Number.isNaN(c) && l !== "" && t) {
213
+ const r = at(t), s = r.format, f = typeof r.unit == "string" ? r.unit.trim() : "";
214
+ if (f && !s) {
215
+ const u = new Intl.NumberFormat(void 0, { maximumFractionDigits: 2 }).format(c);
216
+ if (f === "$")
213
217
  try {
214
218
  return new Intl.NumberFormat(void 0, { style: "currency", currency: "USD" }).format(
215
- o
219
+ c
216
220
  );
217
221
  } catch {
218
- return `$${d}`;
222
+ return `$${u}`;
219
223
  }
220
- return m === "%" ? `${d}%` : `${d} ${m}`;
224
+ return f === "%" ? `${u}%` : `${u} ${f}`;
221
225
  }
222
- if (l === "currency")
226
+ if (s === "currency")
223
227
  try {
224
228
  return new Intl.NumberFormat(void 0, {
225
229
  style: "currency",
226
230
  currency: r.currency || "USD"
227
- }).format(o);
231
+ }).format(c);
228
232
  } catch {
229
233
  }
230
- if (l === "int")
231
- return new Intl.NumberFormat(void 0, { maximumFractionDigits: 0 }).format(o);
232
- if (l === "decimal") {
233
- const d = typeof r.precision == "number" ? r.precision : 2;
234
+ if (s === "int")
235
+ return new Intl.NumberFormat(void 0, { maximumFractionDigits: 0 }).format(c);
236
+ if (s === "decimal") {
237
+ const u = typeof r.precision == "number" ? r.precision : 2;
234
238
  return new Intl.NumberFormat(void 0, {
235
- minimumFractionDigits: d,
236
- maximumFractionDigits: d
237
- }).format(o);
239
+ minimumFractionDigits: u,
240
+ maximumFractionDigits: u
241
+ }).format(c);
238
242
  }
239
243
  }
240
- 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)) ? ut(s) : s;
244
+ return !l.includes(" ") && !l.includes("@") && !/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(l) && !/^\d+$/.test(l) && (l.includes("_") || l.includes("-") || /^[a-z]/.test(l)) ? xt(l) : l;
241
245
  }
242
- function nt({ userId: n }) {
243
- const t = ue(), { navigate: i, userUrl: a } = Gt(), s = a ? a(n) : `/users/${n}`, { data: o } = de({
246
+ function ot({ userId: n }) {
247
+ const t = fe(), { navigate: i, userUrl: o } = Jt(), l = o ? o(n) : `/users/${n}`, { data: c } = pe({
244
248
  queryKey: ["user-chip", n],
245
249
  queryFn: () => t.request(
246
- at(`/users/${n}`)
247
- ).then((m) => m.data ?? null),
250
+ mt(`/users/${n}`)
251
+ ).then((f) => f.data ?? null),
248
252
  enabled: !!t && !!n,
249
253
  staleTime: 12e4
250
- }), r = o ? [o.first_name, o.last_name].filter(Boolean).join(" ") || o.email : n, l = r.split(" ").map((m) => m[0]).filter(Boolean).slice(0, 2).join("").toUpperCase();
251
- return /* @__PURE__ */ y(Qt, { children: [
252
- /* @__PURE__ */ e(Zt, { asChild: !0, children: /* @__PURE__ */ y("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: [
254
+ }), r = c ? [c.first_name, c.last_name].filter(Boolean).join(" ") || c.email : n, s = r.split(" ").map((f) => f[0]).filter(Boolean).slice(0, 2).join("").toUpperCase();
255
+ return /* @__PURE__ */ x(sn, { children: [
256
+ /* @__PURE__ */ e(ln, { 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: [
253
257
  /* @__PURE__ */ e(
254
- Yt,
258
+ rn,
255
259
  {
256
260
  userId: n,
257
261
  className: "h-4 w-4",
258
- 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: l })
262
+ 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: s })
259
263
  }
260
264
  ),
261
265
  /* @__PURE__ */ e("span", { className: "text-[11px] text-slate-600", children: r })
262
266
  ] }) }),
263
- /* @__PURE__ */ y(Xt, { align: "start", className: "text-[12px]", children: [
264
- s && /* @__PURE__ */ y(
265
- Ye,
267
+ /* @__PURE__ */ x(an, { align: "start", className: "text-[12px]", children: [
268
+ l && /* @__PURE__ */ x(
269
+ nt,
266
270
  {
267
271
  className: "gap-2 text-[12px] cursor-pointer",
268
- onSelect: () => i(s),
272
+ onSelect: () => i(l),
269
273
  children: [
270
- /* @__PURE__ */ e(Bt, { className: "h-3.5 w-3.5" }),
274
+ /* @__PURE__ */ e(It, { className: "h-3.5 w-3.5" }),
271
275
  " View profile"
272
276
  ]
273
277
  }
274
278
  ),
275
- (o == null ? void 0 : o.email) && /* @__PURE__ */ y(
276
- Ye,
279
+ (c == null ? void 0 : c.email) && /* @__PURE__ */ x(
280
+ nt,
277
281
  {
278
282
  className: "gap-2 text-[12px] cursor-pointer",
279
283
  onSelect: () => {
280
- window.location.href = `mailto:${o.email}`;
284
+ window.location.href = `mailto:${c.email}`;
281
285
  },
282
286
  children: [
283
- /* @__PURE__ */ e(Ut, { className: "h-3.5 w-3.5" }),
287
+ /* @__PURE__ */ e(Tt, { className: "h-3.5 w-3.5" }),
284
288
  " Send email"
285
289
  ]
286
290
  }
@@ -288,42 +292,42 @@ function nt({ userId: n }) {
288
292
  ] })
289
293
  ] });
290
294
  }
291
- function fn({
295
+ function wn({
292
296
  collection: n,
293
297
  itemId: t,
294
298
  layoutId: i,
295
- attachField: a,
296
- filenameTemplate: s,
297
- label: o
299
+ attachField: o,
300
+ filenameTemplate: l,
301
+ label: c
298
302
  }) {
299
- const r = ue(), l = Ft(), [m, d] = te(!1), F = async () => {
300
- if (!(!r || m || !a)) {
301
- d(!0);
303
+ const r = fe(), s = Ut(), [f, u] = re(!1), O = async () => {
304
+ if (!(!r || f || !o)) {
305
+ u(!0);
302
306
  try {
303
307
  await r.request(
304
- Ct(`/collection-layouts/${i}/generate-and-attach`, {
308
+ zt(`/collection-layouts/${i}/generate-and-attach`, {
305
309
  collection: n,
306
310
  item_id: t,
307
- attach_field: a,
308
- filename_template: s ?? void 0
311
+ attach_field: o,
312
+ filename_template: l ?? void 0
309
313
  })
310
- ), cn(l, [t]), l.invalidateQueries({ queryKey: ["items", n, t] });
314
+ ), bn(s, [t]), s.invalidateQueries({ queryKey: ["items", n, t] });
311
315
  } catch {
312
316
  } finally {
313
- d(!1);
317
+ u(!1);
314
318
  }
315
319
  }
316
- }, $ = !a;
317
- return /* @__PURE__ */ y(
320
+ }, $ = !o;
321
+ return /* @__PURE__ */ x(
318
322
  "button",
319
323
  {
320
324
  type: "button",
321
- onClick: F,
322
- disabled: m || $,
325
+ onClick: O,
326
+ disabled: f || $,
323
327
  title: $ ? "Configure PDF field in Data Model → Layouts" : void 0,
324
328
  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",
325
329
  children: [
326
- /* @__PURE__ */ y(
330
+ /* @__PURE__ */ x(
327
331
  "svg",
328
332
  {
329
333
  xmlns: "http://www.w3.org/2000/svg",
@@ -340,53 +344,53 @@ function fn({
340
344
  ]
341
345
  }
342
346
  ),
343
- m ? "Generating…" : o
347
+ f ? "Generating…" : c
344
348
  ]
345
349
  }
346
350
  );
347
351
  }
348
- function re({
352
+ function ie({
349
353
  relCollection: n,
350
354
  id: t,
351
355
  className: i
352
356
  }) {
353
357
  var h;
354
- const a = ue(), s = ct(), o = t != null && t !== "" ? String(t) : null, { data: r } = de({
358
+ const o = fe(), l = ht(), c = t != null && t !== "" ? String(t) : null, { data: r } = pe({
355
359
  queryKey: ["col-meta-dt", n],
356
- queryFn: () => a.request(
357
- at(`/collections/${n}`)
360
+ queryFn: () => o.request(
361
+ mt(`/collections/${n}`)
358
362
  ).then((v) => v.data).catch(() => ({})),
359
- enabled: !!a && !!o,
363
+ enabled: !!o && !!c,
360
364
  staleTime: 3e5
361
- }), l = (((h = r == null ? void 0 : r.display_template) == null ? void 0 : h.match(/\{\{\s*[^}]+?\s*\}\}/g)) ?? []).map((v) => v.replace(/[{}\s]/g, "")).filter((v) => v.includes(".")), m = l.length ? ["id", ...l].join(",") : null, { data: d, isLoading: F } = de({
362
- queryKey: ["rel-display", n, o, m],
363
- queryFn: () => s(n, o, m),
364
- enabled: !!a && !!o && r !== void 0,
365
+ }), s = (((h = r == null ? void 0 : r.display_template) == null ? void 0 : h.match(/\{\{\s*[^}]+?\s*\}\}/g)) ?? []).map((v) => v.replace(/[{}\s]/g, "")).filter((v) => v.includes(".")), f = s.length ? ["id", ...s].join(",") : null, { data: u, isLoading: O } = pe({
366
+ queryKey: ["rel-display", n, c, f],
367
+ queryFn: () => l(n, c, f),
368
+ enabled: !!o && !!c && r !== void 0,
365
369
  staleTime: 6e4
366
370
  });
367
- if (!o) return /* @__PURE__ */ e("span", { children: "—" });
368
- if (F || a && r === void 0)
371
+ if (!c) return /* @__PURE__ */ e("span", { children: "—" });
372
+ if (O || o && r === void 0)
369
373
  return /* @__PURE__ */ e("span", { className: "animate-pulse h-3 w-20 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))] inline-block" });
370
374
  const $ = i ?? "text-[13px] text-slate-700";
371
- if (!d) return /* @__PURE__ */ e("span", { className: $, children: o });
372
- const g = r != null && r.display_template ? ln(r.display_template, d) : String(d.name ?? d.title ?? d.label ?? d.display_name ?? o);
375
+ if (!u) return /* @__PURE__ */ e("span", { className: $, children: c });
376
+ const g = r != null && r.display_template ? mn(r.display_template, u) : String(u.name ?? u.title ?? u.label ?? u.display_name ?? c);
373
377
  return /* @__PURE__ */ e("span", { className: $, children: g });
374
378
  }
375
- function rt({ userId: n }) {
376
- return /* @__PURE__ */ e(pt, { userId: n, size: "compact" });
379
+ function ct({ userId: n }) {
380
+ return /* @__PURE__ */ e(gt, { userId: n, size: "compact" });
377
381
  }
378
- function it({
382
+ function dt({
379
383
  relCollection: n,
380
384
  id: t,
381
385
  drillConfig: i
382
386
  }) {
383
- const a = lt(), s = /* @__PURE__ */ e(re, { relCollection: n, id: t });
384
- return !a || t == null || t === "" ? s : /* @__PURE__ */ e(
387
+ const o = pt(), l = /* @__PURE__ */ e(ie, { relCollection: n, id: t });
388
+ return !o || t == null || t === "" ? l : /* @__PURE__ */ e(
385
389
  "button",
386
390
  {
387
391
  type: "button",
388
392
  onClick: (r) => {
389
- r.stopPropagation(), a.open({
393
+ r.stopPropagation(), o.open({
390
394
  collection: n,
391
395
  itemId: String(t),
392
396
  layoutId: (i == null ? void 0 : i.layout_id) ?? null,
@@ -397,7 +401,7 @@ function it({
397
401
  },
398
402
  className: "group/drill cursor-pointer text-left transition-colors",
399
403
  children: /* @__PURE__ */ e(
400
- re,
404
+ ie,
401
405
  {
402
406
  relCollection: n,
403
407
  id: t,
@@ -407,102 +411,102 @@ function it({
407
411
  }
408
412
  );
409
413
  }
410
- function hn(n) {
411
- const [t, i] = te(!1), a = $e(!0), s = $e(JSON.stringify(n ?? null));
412
- return ne(() => {
413
- const o = JSON.stringify(n ?? null);
414
- if (a.current) {
415
- a.current = !1, s.current = o;
414
+ function vn(n) {
415
+ const [t, i] = re(!1), o = me(!0), l = me(JSON.stringify(n ?? null));
416
+ return Q(() => {
417
+ const c = JSON.stringify(n ?? null);
418
+ if (o.current) {
419
+ o.current = !1, l.current = c;
416
420
  return;
417
421
  }
418
- if (o === s.current) return;
419
- s.current = o, i(!1);
420
- const r = window.setTimeout(() => i(!0), 0), l = window.setTimeout(() => i(!1), 1200);
422
+ if (c === l.current) return;
423
+ l.current = c, i(!1);
424
+ const r = window.setTimeout(() => i(!0), 0), s = window.setTimeout(() => i(!1), 1200);
421
425
  return () => {
422
- window.clearTimeout(r), window.clearTimeout(l);
426
+ window.clearTimeout(r), window.clearTimeout(s);
423
427
  };
424
428
  }, [n]), t ? "nvr-value-pulse" : "";
425
429
  }
426
- function Rn({
430
+ function nr({
427
431
  field: n,
428
432
  val: t,
429
433
  relations: i,
430
- collection: a,
431
- displayFormat: s,
432
- textClassName: o
434
+ collection: o,
435
+ displayFormat: l,
436
+ textClassName: c
433
437
  }) {
434
- var O;
435
- const r = hn(t), l = (O = Tt(Mt)) == null ? void 0 : O[n.field], m = lt(), d = E(o ?? "text-[13px] text-slate-900 dark:text-slate-100", r), F = Pt(n) ?? { enabled: !0, layout_id: null, width: null }, $ = i.find(
436
- (c) => c.one_collection === a && c.one_field === n.field && c.junction_field
438
+ var j;
439
+ const r = vn(t), s = (j = Vt(Ct)) == null ? void 0 : j[n.field], f = pt(), u = W(c ?? "text-[13px] text-slate-900 dark:text-slate-100", r), O = Rt(n) ?? { enabled: !0, layout_id: null, width: null }, $ = i.find(
440
+ (d) => d.one_collection === o && d.one_field === n.field && d.junction_field
437
441
  );
438
442
  if ($) {
439
- const c = i.find(
443
+ const d = i.find(
440
444
  (D) => D.many_collection === $.many_collection && D.many_field === $.junction_field
441
- ), x = c == null ? void 0 : c.one_collection, S = Array.isArray(t) ? t : t != null && t !== "" ? [t] : [];
442
- return !x || S.length === 0 ? /* @__PURE__ */ e("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }) : x === "nivaro_users" ? /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1 gap-y-0.5", children: S.map((D) => /* @__PURE__ */ e(rt, { userId: String(D) }, String(D))) }) : /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5", children: S.map((D) => /* @__PURE__ */ e(
443
- it,
445
+ ), y = d == null ? void 0 : d.one_collection, k = Array.isArray(t) ? t : t != null && t !== "" ? [t] : [];
446
+ return !y || k.length === 0 ? /* @__PURE__ */ e("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }) : y === "nivaro_users" ? /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1 gap-y-0.5", children: k.map((D) => /* @__PURE__ */ e(ct, { userId: String(D) }, String(D))) }) : /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5", children: k.map((D) => /* @__PURE__ */ e(
447
+ dt,
444
448
  {
445
- relCollection: x,
449
+ relCollection: y,
446
450
  id: D,
447
- drillConfig: F
451
+ drillConfig: O
448
452
  },
449
453
  String(D)
450
454
  )) });
451
455
  }
452
456
  const g = i.find(
453
- (c) => c.many_collection === a && c.many_field === n.field && !c.junction_field
457
+ (d) => d.many_collection === o && d.many_field === n.field && !d.junction_field
454
458
  );
455
459
  if (g != null && g.one_collection) {
456
- const c = Array.isArray(t) ? t : t != null && t !== "" ? [t] : [];
457
- return c.length === 0 ? /* @__PURE__ */ e("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }) : g.one_collection === "nivaro_users" ? /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1 gap-y-0.5", children: c.map((x) => /* @__PURE__ */ e(rt, { userId: String(x) }, String(x))) }) : /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5", children: c.map((x) => /* @__PURE__ */ e(
458
- it,
460
+ const d = Array.isArray(t) ? t : t != null && t !== "" ? [t] : [];
461
+ return d.length === 0 ? /* @__PURE__ */ e("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }) : g.one_collection === "nivaro_users" ? /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1 gap-y-0.5", children: d.map((y) => /* @__PURE__ */ e(ct, { userId: String(y) }, String(y))) }) : /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5", children: d.map((y) => /* @__PURE__ */ e(
462
+ dt,
459
463
  {
460
464
  relCollection: g.one_collection,
461
- id: x,
462
- drillConfig: F
465
+ id: y,
466
+ drillConfig: O
463
467
  },
464
- String(x)
468
+ String(y)
465
469
  )) });
466
470
  }
467
471
  if (t == null || t === "")
468
472
  return /* @__PURE__ */ e("span", { className: "text-slate-300 dark:text-slate-600", children: "—" });
469
- if (s && s !== "text") {
470
- const c = Number(t);
471
- if (s === "currency" && !isNaN(c))
472
- return /* @__PURE__ */ e("span", { className: `font-semibold ${d}`, children: new Intl.NumberFormat(void 0, {
473
+ if (l && l !== "text") {
474
+ const d = Number(t);
475
+ if (l === "currency" && !isNaN(d))
476
+ return /* @__PURE__ */ e("span", { className: `font-semibold ${u}`, children: new Intl.NumberFormat(void 0, {
473
477
  style: "currency",
474
478
  currency: "USD",
475
479
  minimumFractionDigits: 2
476
- }).format(c) });
477
- if (s === "integer" && !isNaN(c))
478
- return /* @__PURE__ */ e("span", { className: `font-semibold ${d}`, children: new Intl.NumberFormat(void 0, { maximumFractionDigits: 0 }).format(Math.round(c)) });
479
- if (s === "decimal" && !isNaN(c))
480
- return /* @__PURE__ */ e("span", { className: `font-semibold ${d}`, children: new Intl.NumberFormat(void 0, { maximumFractionDigits: 2 }).format(c) });
481
- if (s === "percent" && !isNaN(c))
482
- return /* @__PURE__ */ e("span", { className: `font-semibold ${d}`, children: new Intl.NumberFormat(void 0, { style: "percent", maximumFractionDigits: 1 }).format(
483
- c / 100
480
+ }).format(d) });
481
+ if (l === "integer" && !isNaN(d))
482
+ return /* @__PURE__ */ e("span", { className: `font-semibold ${u}`, children: new Intl.NumberFormat(void 0, { maximumFractionDigits: 0 }).format(Math.round(d)) });
483
+ if (l === "decimal" && !isNaN(d))
484
+ return /* @__PURE__ */ e("span", { className: `font-semibold ${u}`, children: new Intl.NumberFormat(void 0, { maximumFractionDigits: 2 }).format(d) });
485
+ if (l === "percent" && !isNaN(d))
486
+ return /* @__PURE__ */ e("span", { className: `font-semibold ${u}`, children: new Intl.NumberFormat(void 0, { style: "percent", maximumFractionDigits: 1 }).format(
487
+ d / 100
484
488
  ) });
485
- if (s === "date")
489
+ if (l === "date")
486
490
  try {
487
- return /* @__PURE__ */ e("span", { className: `font-semibold ${d}`, children: ce(t) || De(t) });
491
+ return /* @__PURE__ */ e("span", { className: `font-semibold ${u}`, children: ue(t) || Le(t) });
488
492
  } catch {
489
493
  }
490
- if (s === "datetime")
494
+ if (l === "datetime")
491
495
  try {
492
- return /* @__PURE__ */ e("span", { className: `font-semibold ${d}`, children: dt(String(t)) });
496
+ return /* @__PURE__ */ e("span", { className: `font-semibold ${u}`, children: bt(String(t)) });
493
497
  } catch {
494
498
  }
495
499
  }
496
- const h = /* @__PURE__ */ e("span", { className: `font-semibold ${d}`, children: Fe(t, n) }), v = l == null ? void 0 : l.target_collection;
497
- if (m && v && (l == null ? void 0 : l.ids.length) === 1) {
498
- const c = l.ids[0];
500
+ const h = /* @__PURE__ */ e("span", { className: `font-semibold ${u}`, children: qe(t, n) }), v = s == null ? void 0 : s.target_collection;
501
+ if (f && v && (s == null ? void 0 : s.ids.length) === 1) {
502
+ const d = s.ids[0];
499
503
  return /* @__PURE__ */ e(
500
504
  "button",
501
505
  {
502
506
  type: "button",
503
507
  "data-header-path-link": "",
504
- onClick: (x) => {
505
- x.stopPropagation(), m.open({ collection: v, itemId: String(c), layoutId: null, width: "85%" });
508
+ onClick: (y) => {
509
+ y.stopPropagation(), f.open({ collection: v, itemId: String(d), layoutId: null, width: "85%" });
506
510
  },
507
511
  className: "cursor-pointer text-left underline decoration-slate-300 underline-offset-[3px] hover:text-[#0284c7] hover:decoration-[#0284c7] dark:decoration-slate-600 dark:hover:text-sky-400",
508
512
  children: h
@@ -511,137 +515,163 @@ function Rn({
511
515
  }
512
516
  return h;
513
517
  }
514
- function bn({
518
+ function kn({ value: n }) {
519
+ const t = Ht(n);
520
+ return /* @__PURE__ */ x(
521
+ "span",
522
+ {
523
+ className: "shrink-0 text-[12px] tabular-nums text-slate-500 dark:text-slate-400",
524
+ "data-folded-line-count": n,
525
+ "aria-label": `${n} row${n === 1 ? "" : "s"}`,
526
+ children: [
527
+ t && /* @__PURE__ */ x(
528
+ "span",
529
+ {
530
+ "aria-hidden": !0,
531
+ "data-folded-line-step": !0,
532
+ className: "nvr-fade-in text-slate-400 dark:text-slate-500",
533
+ children: [
534
+ je(t.from),
535
+ /* @__PURE__ */ e("span", { className: "px-1", children: "→" })
536
+ ]
537
+ }
538
+ ),
539
+ /* @__PURE__ */ e(yt, { value: n, format: (i) => je(Number(i)) })
540
+ ]
541
+ }
542
+ );
543
+ }
544
+ function Sn({
515
545
  summaryFields: n,
516
546
  fields: t,
517
547
  draft: i,
518
- relations: a,
519
- collection: s,
520
- itemId: o,
548
+ relations: o,
549
+ collection: l,
550
+ itemId: c,
521
551
  ownersCollection: r,
522
- ownersItemId: l,
523
- ownersAssignment: m,
524
- m2mCounts: d,
525
- o2mCounts: F,
552
+ ownersItemId: s,
553
+ ownersAssignment: f,
554
+ m2mCounts: u,
555
+ o2mCounts: O,
526
556
  o2mAggValues: $,
527
557
  summaryAggConfigs: g,
528
558
  o2mLoading: h,
529
559
  hideEmpty: v
530
560
  }) {
531
- const O = n.map((_) => typeof _ == "string" ? _ : _.field), c = v ? O.filter((_) => {
532
- if (_ === "__owners__" || h != null && h.has(_) || $ && _ in $) return !0;
533
- if (d && _ in d) return (d[_] ?? 0) > 0;
534
- if (F && _ in F) return (F[_] ?? 0) > 0;
535
- const M = i[_];
536
- return M != null && M !== "" && !(Array.isArray(M) && M.length === 0);
537
- }) : O;
538
- if (c.length === 0) return null;
539
- const x = "text-[9px] font-semibold uppercase tracking-wider text-slate-400 dark:text-slate-500 shrink-0", S = "text-[12px] font-semibold text-slate-700 dark:text-slate-300", D = "text-[12px] text-slate-300 dark:text-slate-600", z = "flex items-baseline gap-1.5", pe = (_) => {
540
- if (_ === "__owners__") {
541
- const u = (m == null ? void 0 : m.label_override) || "Owners";
542
- return /* @__PURE__ */ y("div", { className: "flex items-center gap-1.5", children: [
543
- /* @__PURE__ */ e("span", { className: x, children: u }),
561
+ const j = n.map((N) => typeof N == "string" ? N : N.field), d = v ? j.filter((N) => {
562
+ if (N === "__owners__" || h != null && h.has(N) || $ && N in $) return !0;
563
+ if (u && N in u) return (u[N] ?? 0) > 0;
564
+ if (O && N in O) return (O[N] ?? 0) > 0;
565
+ const G = i[N];
566
+ return G != null && G !== "" && !(Array.isArray(G) && G.length === 0);
567
+ }) : j;
568
+ if (d.length === 0) return null;
569
+ const y = "text-[9px] font-semibold uppercase tracking-wider text-slate-400 dark:text-slate-500 shrink-0", k = "text-[12px] font-semibold text-slate-700 dark:text-slate-300", D = "text-[12px] text-slate-300 dark:text-slate-600", J = "flex items-baseline gap-1.5", z = (N) => {
570
+ if (N === "__owners__") {
571
+ const m = (f == null ? void 0 : f.label_override) || "Owners";
572
+ return /* @__PURE__ */ x("div", { className: "flex items-center gap-1.5", children: [
573
+ /* @__PURE__ */ e("span", { className: y, children: m }),
544
574
  /* @__PURE__ */ e(
545
- un,
575
+ gn,
546
576
  {
547
- collection: r ?? s,
548
- itemId: l ?? o
577
+ collection: r ?? l,
578
+ itemId: s ?? c
549
579
  }
550
580
  )
551
581
  ] });
552
582
  }
553
- const M = n.find((u) => (typeof u == "string" ? u : u.field) === _), me = M && typeof M != "string" ? M.label : void 0, H = t.find((u) => u.field === _), C = me || (H == null ? void 0 : H.label) || _.replace(/_/g, " ").replace(/\b\w/g, (u) => u.toUpperCase());
554
- if (h != null && h.has(_))
555
- return /* @__PURE__ */ y("div", { className: "flex items-center gap-1.5", children: [
556
- /* @__PURE__ */ e("span", { className: x, children: C }),
557
- /* @__PURE__ */ e(qt, { className: "h-3 w-3 animate-spin text-slate-300" })
583
+ const G = n.find((m) => (typeof m == "string" ? m : m.field) === N), he = G && typeof G != "string" ? G.label : void 0, H = t.find((m) => m.field === N), V = he || (H == null ? void 0 : H.label) || N.replace(/_/g, " ").replace(/\b\w/g, (m) => m.toUpperCase());
584
+ if (h != null && h.has(N))
585
+ return /* @__PURE__ */ x("div", { className: "flex items-center gap-1.5", children: [
586
+ /* @__PURE__ */ e("span", { className: y, children: V }),
587
+ /* @__PURE__ */ e(Gt, { className: "h-3 w-3 animate-spin text-slate-300" })
558
588
  ] });
559
- if ($ && _ in $) {
560
- const u = g == null ? void 0 : g[_], T = (u == null ? void 0 : u.label) || C, B = $[_];
561
- let I;
562
- if ((u == null ? void 0 : u.agg) === "count")
563
- I = String(B);
589
+ if ($ && N in $) {
590
+ const m = g == null ? void 0 : g[N], U = (m == null ? void 0 : m.label) || V, B = $[N];
591
+ let P;
592
+ if ((m == null ? void 0 : m.agg) === "count")
593
+ P = String(B);
564
594
  else {
565
- const W = u != null && u.field_options ? (() => {
595
+ const A = m != null && m.field_options ? (() => {
566
596
  try {
567
- return JSON.parse(u.field_options);
597
+ return JSON.parse(m.field_options);
568
598
  } catch {
569
599
  return {};
570
600
  }
571
- })() : {}, A = W.format;
572
- if (A === "currency")
601
+ })() : {}, Y = A.format;
602
+ if (Y === "currency")
573
603
  try {
574
- I = new Intl.NumberFormat(void 0, {
604
+ P = new Intl.NumberFormat(void 0, {
575
605
  style: "currency",
576
- currency: W.currency || "USD"
606
+ currency: A.currency || "USD"
577
607
  }).format(B);
578
608
  } catch {
579
- I = B.toLocaleString(void 0, { maximumFractionDigits: 2 });
609
+ P = B.toLocaleString(void 0, { maximumFractionDigits: 2 });
580
610
  }
581
- else if (A === "int")
582
- I = new Intl.NumberFormat(void 0, { maximumFractionDigits: 0 }).format(B);
583
- else if (A === "decimal") {
584
- const Y = typeof W.precision == "number" ? W.precision : 2;
585
- I = new Intl.NumberFormat(void 0, {
586
- minimumFractionDigits: Y,
587
- maximumFractionDigits: Y
611
+ else if (Y === "int")
612
+ P = new Intl.NumberFormat(void 0, { maximumFractionDigits: 0 }).format(B);
613
+ else if (Y === "decimal") {
614
+ const Z = typeof A.precision == "number" ? A.precision : 2;
615
+ P = new Intl.NumberFormat(void 0, {
616
+ minimumFractionDigits: Z,
617
+ maximumFractionDigits: Z
588
618
  }).format(B);
589
619
  } else
590
- I = B.toLocaleString(void 0, { maximumFractionDigits: 2 });
620
+ P = B.toLocaleString(void 0, { maximumFractionDigits: 2 });
591
621
  }
592
- return /* @__PURE__ */ y("div", { className: z, children: [
593
- /* @__PURE__ */ e("span", { className: x, children: T }),
594
- /* @__PURE__ */ e("span", { className: S, children: I })
622
+ return /* @__PURE__ */ x("div", { className: J, children: [
623
+ /* @__PURE__ */ e("span", { className: y, children: U }),
624
+ /* @__PURE__ */ e("span", { className: k, children: P })
595
625
  ] });
596
626
  }
597
- if (d && _ in d) {
598
- const u = d[_];
599
- return /* @__PURE__ */ y("div", { className: z, children: [
600
- /* @__PURE__ */ e("span", { className: x, children: C }),
601
- /* @__PURE__ */ y("span", { className: S, children: [
602
- u,
627
+ if (u && N in u) {
628
+ const m = u[N];
629
+ return /* @__PURE__ */ x("div", { className: J, children: [
630
+ /* @__PURE__ */ e("span", { className: y, children: V }),
631
+ /* @__PURE__ */ x("span", { className: k, children: [
632
+ m,
603
633
  " item",
604
- u !== 1 ? "s" : ""
634
+ m !== 1 ? "s" : ""
605
635
  ] })
606
636
  ] });
607
637
  }
608
- if (F && _ in F) {
609
- const u = F[_];
610
- return /* @__PURE__ */ y("div", { className: z, children: [
611
- /* @__PURE__ */ e("span", { className: x, children: C }),
612
- /* @__PURE__ */ y("span", { className: S, children: [
613
- u,
638
+ if (O && N in O) {
639
+ const m = O[N];
640
+ return /* @__PURE__ */ x("div", { className: J, children: [
641
+ /* @__PURE__ */ e("span", { className: y, children: V }),
642
+ /* @__PURE__ */ x("span", { className: k, children: [
643
+ /* @__PURE__ */ e(yt, { value: m, format: (U) => je(Number(U)) }),
614
644
  " row",
615
- u !== 1 ? "s" : ""
645
+ m !== 1 ? "s" : ""
616
646
  ] })
617
647
  ] });
618
648
  }
619
- const q = i[_], P = a.find(
620
- (u) => u.many_collection === s && u.many_field === _ && !u.junction_field
649
+ const q = i[N], I = o.find(
650
+ (m) => m.many_collection === l && m.many_field === N && !m.junction_field
621
651
  );
622
- if (P != null && P.one_collection) {
623
- const u = Array.isArray(q) ? q : q != null && q !== "" ? [q] : [];
624
- return /* @__PURE__ */ y("div", { className: z, children: [
625
- /* @__PURE__ */ e("span", { className: x, children: C }),
626
- u.length === 0 ? /* @__PURE__ */ e("span", { className: D, children: "—" }) : P.one_collection === "nivaro_users" ? /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5 gap-y-0.5", children: u.map((T) => /* @__PURE__ */ e(nt, { userId: String(T) }, String(T))) }) : /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5", children: u.map((T) => /* @__PURE__ */ e(re, { relCollection: P.one_collection, id: T }, String(T))) })
652
+ if (I != null && I.one_collection) {
653
+ const m = Array.isArray(q) ? q : q != null && q !== "" ? [q] : [];
654
+ return /* @__PURE__ */ x("div", { className: J, children: [
655
+ /* @__PURE__ */ e("span", { className: y, children: V }),
656
+ m.length === 0 ? /* @__PURE__ */ e("span", { className: D, children: "—" }) : I.one_collection === "nivaro_users" ? /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5 gap-y-0.5", children: m.map((U) => /* @__PURE__ */ e(ot, { userId: String(U) }, String(U))) }) : /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5", children: m.map((U) => /* @__PURE__ */ e(ie, { relCollection: I.one_collection, id: U }, String(U))) })
627
657
  ] });
628
658
  }
629
659
  if (Array.isArray(q)) {
630
- const u = a.find((B) => B.many_field === _ && B.junction_field), T = u == null ? void 0 : u.one_collection;
631
- return /* @__PURE__ */ y("div", { className: z, children: [
632
- /* @__PURE__ */ e("span", { className: x, children: C }),
633
- q.length === 0 ? /* @__PURE__ */ e("span", { className: D, children: "—" }) : T ? /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5 gap-y-0.5", children: q.map(
634
- (B) => T === "nivaro_users" ? /* @__PURE__ */ e(nt, { userId: String(B) }, String(B)) : /* @__PURE__ */ e(re, { relCollection: T, id: B }, String(B))
635
- ) }) : /* @__PURE__ */ y("span", { className: S, children: [
660
+ const m = o.find((B) => B.many_field === N && B.junction_field), U = m == null ? void 0 : m.one_collection;
661
+ return /* @__PURE__ */ x("div", { className: J, children: [
662
+ /* @__PURE__ */ e("span", { className: y, children: V }),
663
+ q.length === 0 ? /* @__PURE__ */ e("span", { className: D, children: "—" }) : U ? /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5 gap-y-0.5", children: q.map(
664
+ (B) => U === "nivaro_users" ? /* @__PURE__ */ e(ot, { userId: String(B) }, String(B)) : /* @__PURE__ */ e(ie, { relCollection: U, id: B }, String(B))
665
+ ) }) : /* @__PURE__ */ x("span", { className: k, children: [
636
666
  q.length,
637
667
  " item",
638
668
  q.length !== 1 ? "s" : ""
639
669
  ] })
640
670
  ] });
641
671
  }
642
- return /* @__PURE__ */ y("div", { className: z, children: [
643
- /* @__PURE__ */ e("span", { className: x, children: C }),
644
- q == null || q === "" ? /* @__PURE__ */ e("span", { className: D, children: "—" }) : /* @__PURE__ */ e("span", { className: S, children: Fe(q, H) })
672
+ return /* @__PURE__ */ x("div", { className: J, children: [
673
+ /* @__PURE__ */ e("span", { className: y, children: V }),
674
+ q == null || q === "" ? /* @__PURE__ */ e("span", { className: D, children: "—" }) : /* @__PURE__ */ e("span", { className: k, children: qe(q, H) })
645
675
  ] });
646
676
  };
647
677
  return /* @__PURE__ */ e(
@@ -649,84 +679,94 @@ function bn({
649
679
  {
650
680
  "data-summary-strip": "",
651
681
  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",
652
- children: c.map((_) => /* @__PURE__ */ e(st.Fragment, { children: pe(_) }, _))
682
+ children: d.map((N) => /* @__PURE__ */ e(ut.Fragment, { children: z(N) }, N))
653
683
  }
654
684
  );
655
685
  }
656
- const zn = It(function({
686
+ const rr = Et(function({
657
687
  group: t,
658
688
  fields: i,
659
- draft: a,
660
- onChange: s,
661
- relations: o,
689
+ draft: o,
690
+ onChange: l,
691
+ relations: c,
662
692
  collection: r,
663
- itemId: l,
664
- errors: m,
665
- visibleFields: d,
666
- lockedFields: F,
693
+ itemId: s,
694
+ errors: f,
695
+ visibleFields: u,
696
+ lockedFields: O,
667
697
  layoutAiEnabled: $,
668
698
  displayOnly: g,
669
699
  renderField: h,
670
700
  onCountChange: v,
671
- isNew: O,
672
- fieldValues: c,
673
- isOpen: x,
674
- onToggle: S,
701
+ isNew: j,
702
+ fieldValues: d,
703
+ isOpen: y,
704
+ onToggle: k,
675
705
  summaryFields: D,
676
- m2mCounts: z,
677
- o2mCounts: pe,
678
- o2mAggValues: _,
679
- summaryAggConfigs: M,
680
- o2mLoading: me,
706
+ m2mCounts: J,
707
+ o2mCounts: z,
708
+ o2mAggValues: N,
709
+ summaryAggConfigs: G,
710
+ o2mLoading: he,
681
711
  footerSlot: H,
682
- ownersCollection: C,
712
+ ownersCollection: V,
683
713
  ownersItemId: q,
684
- ownersAssignment: P,
685
- pdfAssignment: u,
686
- pdfAttachField: T,
714
+ ownersAssignment: I,
715
+ pdfAssignment: m,
716
+ pdfAttachField: U,
687
717
  pdfFilenameTemplate: B,
688
- layoutId: I,
689
- hideEmptySummary: W,
690
- widgetAssignments: A,
691
- widgetApiBase: Y,
692
- fieldInlineDisplay: fe,
693
- swapConfig: L,
694
- swapped: je,
695
- onSwapToggle: Oe,
696
- alternateFields: Q,
697
- alternateWidths: he,
698
- deferred: ie,
699
- onFirstOpen: se
718
+ layoutId: P,
719
+ hideEmptySummary: A,
720
+ widgetAssignments: Y,
721
+ widgetApiBase: Z,
722
+ fieldInlineDisplay: be,
723
+ swapConfig: E,
724
+ swapped: Be,
725
+ onSwapToggle: Ue,
726
+ alternateFields: X,
727
+ alternateWidths: xe,
728
+ deferred: se,
729
+ onFirstOpen: le
700
730
  }) {
701
- var Le;
702
- const [mt, ft] = zt(
731
+ var ze;
732
+ const [Nt, Pe] = Qt(
703
733
  t.is_collapsed == null ? void 0 : !t.is_collapsed,
704
734
  !0
705
- ), ht = !mt, [bt, xt] = te(!1), j = Wt(), K = (f, N) => Et(j, f, N, { asChild: !0 }), le = (f) => ({ kind: "slot", field: f, group_key: t.key }), qe = !!(j != null && j.showHidden), [Be, Ue] = te({}), { data: be } = en(r), Z = (j == null ? void 0 : j.fold) ?? null, X = (j == null ? void 0 : j.reveal) ?? null, [Te, xe] = te(null);
706
- ne(() => {
707
- Z && xe(!Z.open);
708
- }, [Z == null ? void 0 : Z.seq]), ne(() => {
709
- X && At(X.target) === t.key && xe(!1);
710
- }, [X == null ? void 0 : X.seq]);
711
- const Ie = S !== void 0, V = Te ?? (Ie ? !x : ht);
712
- ne(() => {
713
- ie && !V && (se == null || se(t.key));
714
- }, [ie, V, se, t.key]);
715
- const ge = Te !== null ? () => xe((f) => !f) : Ie ? S : () => ft((f) => !f), Me = !j && I != null, ye = () => {
716
- Me && ot({ layoutId: Number(I), collection: r, kind: "opened", key: t.key });
717
- }, gt = () => {
718
- V && ye(), ge == null || ge();
719
- }, yt = !g && i.some((f) => m[f.field]), Pe = j ? "always" : t.visibility_mode ?? "always";
720
- if (Pe === "new_only" && !O || Pe === "existing_only" && O) return null;
721
- const ee = A ?? [], _t = !O && ee.some((f) => f.widget_id != null && Be[f.field] === void 0);
722
- let ae = !1;
723
- if (t.hide_when_empty && c && !j && (ae = c.every(
724
- (N) => N == null || N === "" || Array.isArray(N) && N.length === 0
725
- ) && !_t && ee.every((N) => !Be[N.field])), ae && ee.length === 0) return null;
726
- const _e = $e(null), Ne = an(_e), Ge = mn(t.icon), Nt = qe ? i : i.filter((f) => !f.hidden), Ce = (Le = be == null ? void 0 : be.sections) == null ? void 0 : Le[t.key], wt = Array.isArray(Ce) && Ce.length > 0, vt = (f) => wt ? /* @__PURE__ */ y("div", { className: "relative", children: [
727
- f,
735
+ ), _t = !Nt, [wt, vt] = re(!1), F = tn(), K = (p, _) => en(F, p, _, { asChild: !0 }), ae = (p) => ({ kind: "slot", field: p, group_key: t.key }), Me = !!(F != null && F.showHidden), [Ge, Ie] = re({}), { data: ye } = on(r), ee = (F == null ? void 0 : F.fold) ?? null, te = (F == null ? void 0 : F.reveal) ?? null, [ge, oe] = re(null);
736
+ Q(() => {
737
+ ee && oe(!ee.open);
738
+ }, [ee == null ? void 0 : ee.seq]), Q(() => {
739
+ te && nn(te.target) === t.key && oe(!1);
740
+ }, [te == null ? void 0 : te.seq]);
741
+ const Ne = k !== void 0, M = ge ?? (Ne ? !y : _t), Te = me(() => {
742
+ });
743
+ Te.current = () => {
744
+ M && (ge !== null ? oe(!1) : Ne ? k == null || k() : Pe(!0));
745
+ }, Q(() => {
746
+ if (typeof window > "u") return;
747
+ const p = (_) => {
748
+ const a = _.detail;
749
+ ((a == null ? void 0 : a.key) === t.key || a != null && a.field && i.some((L) => L.field === a.field)) && Te.current();
750
+ };
751
+ return window.addEventListener(tt, p), () => window.removeEventListener(tt, p);
752
+ }, [t.key, i]), Q(() => {
753
+ se && !M && (le == null || le(t.key));
754
+ }, [se, M, le, t.key]);
755
+ const _e = ge !== null ? () => oe((p) => !p) : Ne ? k : () => Pe((p) => !p), Ve = !F && P != null, we = () => {
756
+ Ve && ft({ layoutId: Number(P), collection: r, kind: "opened", key: t.key });
757
+ }, kt = () => {
758
+ M && we(), _e == null || _e();
759
+ }, St = !g && i.some((p) => f[p.field]), Ee = F ? "always" : t.visibility_mode ?? "always";
760
+ if (Ee === "new_only" && !j || Ee === "existing_only" && j) return null;
761
+ const ne = Y ?? [], $t = !j && ne.some((p) => p.widget_id != null && Ge[p.field] === void 0);
762
+ let ce = !1;
763
+ if (t.hide_when_empty && d && !F && (ce = d.every(
764
+ (_) => _ == null || _ === "" || Array.isArray(_) && _.length === 0
765
+ ) && !$t && ne.every((_) => !Ge[_.field])), ce && ne.length === 0) return null;
766
+ const ve = me(null), ke = fn(ve), Ce = _n(t.icon), Dt = Me ? i : i.filter((p) => !p.hidden), Re = (ze = ye == null ? void 0 : ye.sections) == null ? void 0 : ze[t.key], Ft = Array.isArray(Re) && Re.length > 0, Ot = (p) => Ft ? /* @__PURE__ */ x("div", { className: "relative", children: [
767
+ p,
728
768
  /* @__PURE__ */ e("span", { className: "absolute right-[52px] top-1/2 flex -translate-y-1/2", children: /* @__PURE__ */ e(
729
- tn,
769
+ cn,
730
770
  {
731
771
  collection: r,
732
772
  kind: "section",
@@ -734,55 +774,66 @@ const zn = It(function({
734
774
  label: t.label || t.key
735
775
  }
736
776
  ) })
737
- ] }) : f, we = (f) => qe && (f.hidden || !(d.has(f.field) || !d.size));
738
- return /* @__PURE__ */ y(
777
+ ] }) : p, Je = z ? i.filter((p) => p.field in z) : [], Se = Je.length === 1 ? Je[0].field : null, $e = (p) => Me && (p.hidden || !(u.has(p.field) || !u.size));
778
+ return /* @__PURE__ */ x(
739
779
  "div",
740
780
  {
741
- "data-loads-on-open": ie ? "" : void 0,
781
+ "data-loads-on-open": se ? "" : void 0,
742
782
  "data-section-key": t.key,
743
- "data-collapsed": V ? "" : void 0,
744
- className: E(
783
+ "data-collapsed": M ? "" : void 0,
784
+ className: W(
745
785
  "nvr-section-enter rounded-xl border border-slate-200 bg-white dark:bg-card dark:border-border",
746
786
  g && "bg-slate-50/60 dark:bg-slate-900/20",
747
- ae && "hidden"
787
+ ce && "hidden"
748
788
  ),
749
- onPointerDownCapture: (f) => {
750
- var N, p;
751
- (p = (N = f.target) == null ? void 0 : N.closest) != null && p.call(N, "[data-usage-header]") || ye();
789
+ onPointerDownCapture: (p) => {
790
+ var _, a;
791
+ (a = (_ = p.target) == null ? void 0 : _.closest) != null && a.call(_, "[data-usage-header]") || we();
752
792
  },
753
- onFocusCapture: (f) => {
754
- var N, p;
755
- (p = (N = f.target) == null ? void 0 : N.closest) != null && p.call(N, "[data-usage-header]") || ye();
793
+ onFocusCapture: (p) => {
794
+ var _, a;
795
+ (a = (_ = p.target) == null ? void 0 : _.closest) != null && a.call(_, "[data-usage-header]") || we();
756
796
  },
757
797
  children: [
758
- Me && !ae && /* @__PURE__ */ e(xn, { layoutId: Number(I), collection: r, sectionKey: t.key }),
759
- vt(
760
- /* @__PURE__ */ y(
798
+ Ve && !ce && /* @__PURE__ */ e($n, { layoutId: Number(P), collection: r, sectionKey: t.key }),
799
+ Ot(
800
+ /* @__PURE__ */ x(
761
801
  "button",
762
802
  {
763
803
  type: "button",
764
804
  "data-usage-header": "",
765
- onClick: gt,
766
- "data-design-group-header": j ? "" : void 0,
767
- className: E(
805
+ onClick: kt,
806
+ "data-design-group-header": F ? "" : void 0,
807
+ className: W(
768
808
  "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",
769
809
  // Round the bottom only when nothing renders below the header — an
770
810
  // expanded body (or collapsed summary strip) square-joins it, and a
771
811
  // rounded hover overlay would leave see-through notches at the seam.
772
- V && !(D && D.length > 0) && "rounded-b-xl"
812
+ M && !(D && D.length > 0) && "rounded-b-xl"
773
813
  ),
774
814
  children: [
775
- Ge && /* @__PURE__ */ e(Ge, { className: "h-3.5 w-3.5 shrink-0 text-slate-400 dark:text-slate-500" }),
815
+ Ce && /* @__PURE__ */ e(Ce, { className: "h-3.5 w-3.5 shrink-0 text-slate-400 dark:text-slate-500" }),
776
816
  /* @__PURE__ */ e("span", { className: "font-medium text-[13px] shrink-0 text-slate-800 dark:text-slate-200", children: t.label }),
817
+ M && Se && z && Se in z && /* @__PURE__ */ e(kn, { value: z[Se] }),
777
818
  /* @__PURE__ */ e("span", { className: "flex-1" }),
778
- yt && /* @__PURE__ */ e("span", { className: "nvr-pop h-2 w-2 rounded-full bg-destructive shrink-0" }),
819
+ M && !F && s && s !== "new" && /* @__PURE__ */ e(
820
+ yn,
821
+ {
822
+ collection: r,
823
+ itemId: s,
824
+ fields: i,
825
+ relations: c,
826
+ label: t.label || t.key
827
+ }
828
+ ),
829
+ St && /* @__PURE__ */ e("span", { className: "nvr-pop h-2 w-2 rounded-full bg-destructive shrink-0" }),
779
830
  /* @__PURE__ */ e(
780
- Ot,
831
+ Mt,
781
832
  {
782
- "data-design-pass": j ? "" : void 0,
783
- className: E(
833
+ "data-design-pass": F ? "" : void 0,
834
+ className: W(
784
835
  "h-4 w-4 text-slate-400 dark:text-slate-500 transition-transform duration-200",
785
- V && "-rotate-90"
836
+ M && "-rotate-90"
786
837
  )
787
838
  }
788
839
  )
@@ -790,99 +841,99 @@ const zn = It(function({
790
841
  }
791
842
  )
792
843
  ),
793
- V && D && D.length > 0 && /* @__PURE__ */ e(
794
- bn,
844
+ M && D && D.length > 0 && /* @__PURE__ */ e(
845
+ Sn,
795
846
  {
796
847
  summaryFields: D,
797
848
  fields: i,
798
- draft: a,
799
- relations: o,
849
+ draft: o,
850
+ relations: c,
800
851
  collection: r,
801
- itemId: l,
802
- ownersCollection: C,
852
+ itemId: s,
853
+ ownersCollection: V,
803
854
  ownersItemId: q,
804
- ownersAssignment: P,
805
- m2mCounts: z,
806
- o2mCounts: pe,
807
- o2mAggValues: _,
808
- summaryAggConfigs: M,
809
- o2mLoading: me,
810
- hideEmpty: !!t.summary_hide_empty || !!W
855
+ ownersAssignment: I,
856
+ m2mCounts: J,
857
+ o2mCounts: z,
858
+ o2mAggValues: N,
859
+ summaryAggConfigs: G,
860
+ o2mLoading: he,
861
+ hideEmpty: !!t.summary_hide_empty || !!A
811
862
  }
812
863
  ),
813
- V && !ie && t.hide_when_empty && ee.length > 0 && /* @__PURE__ */ e("div", { className: "hidden", children: ee.filter((f) => f.widget_id != null).map((f) => /* @__PURE__ */ e(
814
- Qe,
864
+ M && !se && t.hide_when_empty && ne.length > 0 && /* @__PURE__ */ e("div", { className: "hidden", children: ne.filter((p) => p.widget_id != null).map((p) => /* @__PURE__ */ e(
865
+ rt,
815
866
  {
816
- widgetId: f.widget_id,
817
- inputBindings: et(f.input_bindings),
818
- itemDraft: a,
867
+ widgetId: p.widget_id,
868
+ inputBindings: lt(p.input_bindings),
869
+ itemDraft: o,
819
870
  frameless: !0,
820
- apiBase: Y,
821
- onContentChange: (N) => Ue(
822
- (p) => p[f.field] === N ? p : { ...p, [f.field]: N }
871
+ apiBase: Z,
872
+ onContentChange: (_) => Ie(
873
+ (a) => a[p.field] === _ ? a : { ...a, [p.field]: _ }
823
874
  )
824
875
  },
825
- f.field
876
+ p.field
826
877
  )) }),
827
- !V && /* @__PURE__ */ y(
878
+ !M && /* @__PURE__ */ x(
828
879
  "div",
829
880
  {
830
881
  "data-section-body": "",
831
882
  className: "nvr-expand-in border-t border-slate-100 px-5 py-4 dark:border-border/60",
832
883
  children: [
833
- !g && /* @__PURE__ */ e(on, { group: t, className: "mb-3" }),
884
+ !g && /* @__PURE__ */ e(hn, { group: t, className: "mb-3" }),
834
885
  (() => {
835
- const f = Lt(Nt, {
836
- rows: g ? [] : Rt(t.swap_config).rows,
837
- folded: (p) => !g && Jt(p._overrides),
838
- keep: (p) => !!p.required,
839
- filled: (p) => !Vt(a[p.field]) || !!m[p.field]
840
- }), N = f.units.map(
841
- (p) => p.kind === "row" ? {
842
- _k: `row:${p.row.key}`,
843
- sort: p.members[0].sort ?? 0,
886
+ const p = Kt(Dt, {
887
+ rows: g ? [] : Yt(t.swap_config).rows,
888
+ folded: (a) => !g && At(a._overrides),
889
+ keep: (a) => !!a.required,
890
+ filled: (a) => !Wt(o[a.field]) || !!f[a.field]
891
+ }), _ = p.units.map(
892
+ (a) => a.kind === "row" ? {
893
+ _k: `row:${a.row.key}`,
894
+ sort: a.members[0].sort ?? 0,
844
895
  _t: "row",
845
- row: p.row,
846
- members: p.members
847
- } : { _k: p.field.field, sort: p.field.sort ?? 0, _t: "field", f: p.field }
896
+ row: a.row,
897
+ members: a.members
898
+ } : { _k: a.field.field, sort: a.field.sort ?? 0, _t: "field", f: a.field }
848
899
  );
849
- P && N.push({
900
+ I && _.push({
850
901
  _k: "__owners__",
851
- sort: P.sort,
902
+ sort: I.sort,
852
903
  _t: "owners",
853
- slot: P
854
- }), u && N.push({
904
+ slot: I
905
+ }), m && _.push({
855
906
  _k: "__pdf__",
856
- sort: u.sort,
907
+ sort: m.sort,
857
908
  _t: "pdf",
858
- slot: u
909
+ slot: m
859
910
  });
860
- for (const p of A ?? [])
861
- N.push({ _k: p.field, sort: p.sort, _t: "widget", slot: p });
862
- return N.sort((p, U) => p.sort - U.sort), j && N.length === 0 && f.folded.length === 0 ? /* @__PURE__ */ e(Kt, {}) : g ? /* @__PURE__ */ y(
911
+ for (const a of Y ?? [])
912
+ _.push({ _k: a.field, sort: a.sort, _t: "widget", slot: a });
913
+ return _.sort((a, L) => a.sort - L.sort), F && _.length === 0 && p.folded.length === 0 ? /* @__PURE__ */ e(Xt, {}) : g ? /* @__PURE__ */ x(
863
914
  "div",
864
915
  {
865
- ref: _e,
916
+ ref: ve,
866
917
  "data-section-grid": "",
867
- className: E(j && "relative", "grid grid-cols-12 gap-x-6 gap-y-3"),
918
+ className: W(F && "relative", "grid grid-cols-12 gap-x-6 gap-y-3"),
868
919
  children: [
869
- /* @__PURE__ */ e(ke, { gapClass: "gap-x-6" }),
870
- N.map((p) => {
871
- if (p._t === "owners") {
872
- const k = p.slot.col_span ?? 12;
920
+ /* @__PURE__ */ e(Fe, { gapClass: "gap-x-6" }),
921
+ _.map((a) => {
922
+ if (a._t === "owners") {
923
+ const S = a.slot.col_span ?? 12;
873
924
  return K(
874
- le("__owners__"),
925
+ ae("__owners__"),
875
926
  /* @__PURE__ */ e(
876
927
  "div",
877
928
  {
878
929
  className: "min-w-0",
879
- style: { gridColumn: `span ${k}` },
930
+ style: { gridColumn: `span ${S}` },
880
931
  children: /* @__PURE__ */ e(
881
- Xe,
932
+ st,
882
933
  {
883
934
  collection: r,
884
- itemId: l,
885
- label: p.slot.label_override || "Owners"
935
+ itemId: s,
936
+ label: a.slot.label_override || "Owners"
886
937
  }
887
938
  )
888
939
  },
@@ -890,57 +941,57 @@ const zn = It(function({
890
941
  )
891
942
  );
892
943
  }
893
- if (p._t === "pdf" || p._t === "widget" || p._t === "row") return null;
894
- const U = p.f, b = o.find(
895
- (k) => k.many_collection === r && k.many_field === U.field && !k.junction_field
944
+ if (a._t === "pdf" || a._t === "widget" || a._t === "row") return null;
945
+ const L = a.f, b = c.find(
946
+ (S) => S.many_collection === r && S.many_field === L.field && !S.junction_field
896
947
  );
897
948
  return K(
898
- { kind: "field", field: U.field, group_key: t.key },
899
- /* @__PURE__ */ y(
949
+ { kind: "field", field: L.field, group_key: t.key },
950
+ /* @__PURE__ */ x(
900
951
  "div",
901
952
  {
902
953
  className: "min-w-0",
903
- style: { gridColumn: `span ${Ze(U.options, Ne)}` },
954
+ style: { gridColumn: `span ${it(L.options, ke)}` },
904
955
  children: [
905
- /* @__PURE__ */ e("dt", { className: "text-[11px] font-medium text-slate-400 truncate", children: U.label || ut(U.field) }),
956
+ /* @__PURE__ */ e("dt", { className: "text-[11px] font-medium text-slate-400 truncate", children: L.label || xt(L.field) }),
906
957
  /* @__PURE__ */ e("dd", { className: "mt-0.5 break-words", children: (b == null ? void 0 : b.one_collection) === "nivaro_users" ? (() => {
907
- const k = a[U.field], J = Array.isArray(k) ? k : k != null && k !== "" ? [k] : [];
908
- return J.length === 0 ? /* @__PURE__ */ e("span", { className: "text-[13px] text-slate-400", children: "—" }) : /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1.5", children: J.map((G) => /* @__PURE__ */ e(pt, { userId: String(G) }, String(G))) });
909
- })() : b != null && b.one_collection ? /* @__PURE__ */ e(re, { relCollection: b.one_collection, id: a[U.field] }) : /* @__PURE__ */ e("span", { className: "text-[13px] text-slate-700", children: Fe(a[U.field], U) }) })
958
+ const S = o[L.field], C = Array.isArray(S) ? S : S != null && S !== "" ? [S] : [];
959
+ return C.length === 0 ? /* @__PURE__ */ e("span", { className: "text-[13px] text-slate-400", children: "—" }) : /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1.5", children: C.map((T) => /* @__PURE__ */ e(gt, { userId: String(T) }, String(T))) });
960
+ })() : b != null && b.one_collection ? /* @__PURE__ */ e(ie, { relCollection: b.one_collection, id: o[L.field] }) : /* @__PURE__ */ e("span", { className: "text-[13px] text-slate-700", children: qe(o[L.field], L) }) })
910
961
  ]
911
962
  },
912
- U.field
963
+ L.field
913
964
  )
914
965
  );
915
966
  })
916
967
  ]
917
968
  }
918
969
  ) : (() => {
919
- const p = (b) => {
920
- var Ee, We;
970
+ const a = (b) => {
971
+ var Ze, Xe;
921
972
  if (b._t === "row")
922
973
  return /* @__PURE__ */ e(
923
- rn,
974
+ un,
924
975
  {
925
976
  row: b.row,
926
977
  members: b.members,
927
- containerWidth: Ne,
928
- errors: m,
978
+ containerWidth: ke,
979
+ errors: f,
929
980
  renderMember: (w) => K(
930
981
  { kind: "field", field: w.field, group_key: t.key },
931
982
  /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
932
- Se,
983
+ Oe,
933
984
  {
934
- field: sn(w),
935
- draft: a,
936
- onChange: s,
937
- relations: o,
985
+ field: pn(w),
986
+ draft: o,
987
+ onChange: l,
988
+ relations: c,
938
989
  collection: r,
939
- itemId: l,
940
- error: m[w.field],
941
- visible: d.has(w.field) || !d.size,
942
- forceVisible: we(w) || void 0,
943
- locked: F.has(w.field),
990
+ itemId: s,
991
+ error: f[w.field],
992
+ visible: u.has(w.field) || !u.size,
993
+ forceVisible: $e(w) || void 0,
994
+ locked: O.has(w.field),
944
995
  layoutAiEnabled: $,
945
996
  renderField: h,
946
997
  onCountChange: v
@@ -953,29 +1004,29 @@ const zn = It(function({
953
1004
  if (b._t === "owners") {
954
1005
  const w = b.slot.col_span ?? 12;
955
1006
  return K(
956
- le("__owners__"),
1007
+ ae("__owners__"),
957
1008
  /* @__PURE__ */ e("div", { style: { gridColumn: `span ${w}` }, children: /* @__PURE__ */ e(
958
- Xe,
1009
+ st,
959
1010
  {
960
1011
  collection: r,
961
- itemId: l,
1012
+ itemId: s,
962
1013
  label: b.slot.label_override || "Owners"
963
1014
  }
964
1015
  ) }, "__owners__")
965
1016
  );
966
1017
  }
967
1018
  if (b._t === "pdf") {
968
- if (!I) return null;
969
- const w = b.slot.col_span ?? 12, R = ((Ee = b.slot.label_override) == null ? void 0 : Ee.trim()) || "Generate PDF";
1019
+ if (!P) return null;
1020
+ const w = b.slot.col_span ?? 12, R = ((Ze = b.slot.label_override) == null ? void 0 : Ze.trim()) || "Generate PDF";
970
1021
  return K(
971
- le("__pdf__"),
1022
+ ae("__pdf__"),
972
1023
  /* @__PURE__ */ e("div", { style: { gridColumn: `span ${w}` }, children: /* @__PURE__ */ e(
973
- fn,
1024
+ wn,
974
1025
  {
975
1026
  collection: r,
976
- itemId: l,
977
- layoutId: I,
978
- attachField: T ?? null,
1027
+ itemId: s,
1028
+ layoutId: P,
1029
+ attachField: U ?? null,
979
1030
  filenameTemplate: B,
980
1031
  label: R
981
1032
  }
@@ -984,50 +1035,50 @@ const zn = It(function({
984
1035
  }
985
1036
  if (b._t === "widget") {
986
1037
  if (!b.slot.widget_id) return null;
987
- const w = b.slot.col_span ?? 12, R = et(b.slot.input_bindings);
1038
+ const w = b.slot.col_span ?? 12, R = lt(b.slot.input_bindings);
988
1039
  return K(
989
- le(b.slot.field),
1040
+ ae(b.slot.field),
990
1041
  /* @__PURE__ */ e("div", { style: { gridColumn: `span ${w}` }, children: /* @__PURE__ */ e(
991
- Qe,
1042
+ rt,
992
1043
  {
993
1044
  widgetId: b.slot.widget_id,
994
1045
  inputBindings: R,
995
- itemDraft: a,
1046
+ itemDraft: o,
996
1047
  label: b.slot.label_override ?? void 0,
997
1048
  defaultExpanded: b.slot.default_expanded ?? !0,
998
1049
  frameless: !0,
999
- apiBase: Y,
1000
- onContentChange: (Ae) => Ue(
1001
- (ve) => ve[b.slot.field] === Ae ? ve : { ...ve, [b.slot.field]: Ae }
1050
+ apiBase: Z,
1051
+ onContentChange: (et) => Ie(
1052
+ (De) => De[b.slot.field] === et ? De : { ...De, [b.slot.field]: et }
1002
1053
  )
1003
1054
  }
1004
1055
  ) }, b.slot.field)
1005
1056
  );
1006
1057
  }
1007
- const k = b.f, J = fe == null ? void 0 : fe[k.field], G = J == null ? void 0 : J.entries, kt = (J == null ? void 0 : J.separator) ?? null, oe = a[k.field], Ve = oe != null && oe !== "", Je = G != null && G.length && Ve ? ((We = o.find(
1008
- (w) => w.many_collection === r && w.many_field === k.field && !w.junction_field
1009
- )) == null ? void 0 : We.one_collection) ?? null : null, Re = (L == null ? void 0 : L.enabled) && k.field === L.primary_field, ze = (() => {
1010
- const w = a[(L == null ? void 0 : L.primary_field) ?? ""];
1058
+ const S = b.f, C = be == null ? void 0 : be[S.field], T = C == null ? void 0 : C.entries, jt = (C == null ? void 0 : C.separator) ?? null, de = o[S.field], He = de != null && de !== "", Ke = T != null && T.length && He ? ((Xe = c.find(
1059
+ (w) => w.many_collection === r && w.many_field === S.field && !w.junction_field
1060
+ )) == null ? void 0 : Xe.one_collection) ?? null : null, We = (E == null ? void 0 : E.enabled) && S.field === E.primary_field, Ae = (() => {
1061
+ const w = o[(E == null ? void 0 : E.primary_field) ?? ""];
1011
1062
  return w != null && w !== "";
1012
- })(), He = (Q ?? []).some((w) => {
1013
- const R = a[w.field];
1063
+ })(), Ye = (X ?? []).some((w) => {
1064
+ const R = o[w.field];
1014
1065
  return R != null && R !== "";
1015
- }), St = Re && Oe ? /* @__PURE__ */ y("span", { className: "inline-flex items-center gap-1.5", children: [
1066
+ }), Lt = We && Ue ? /* @__PURE__ */ x("span", { className: "inline-flex items-center gap-1.5", children: [
1016
1067
  /* @__PURE__ */ e(
1017
1068
  "button",
1018
1069
  {
1019
1070
  type: "button",
1020
- onClick: Oe,
1071
+ onClick: Ue,
1021
1072
  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",
1022
- children: je ? L.back_label ?? "Back" : L.toggle_label ?? "Enter manually"
1073
+ children: Be ? E.back_label ?? "Back" : E.toggle_label ?? "Enter manually"
1023
1074
  }
1024
1075
  ),
1025
- /* @__PURE__ */ y(
1076
+ /* @__PURE__ */ x(
1026
1077
  "span",
1027
1078
  {
1028
1079
  className: [
1029
1080
  "inline-flex items-center gap-0.5 rounded px-1 py-0.5 text-[9px] font-medium",
1030
- ze ? "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"
1081
+ Ae ? "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"
1031
1082
  ].join(" "),
1032
1083
  title: "Original field",
1033
1084
  children: [
@@ -1036,7 +1087,7 @@ const zn = It(function({
1036
1087
  {
1037
1088
  className: [
1038
1089
  "h-1.5 w-1.5 rounded-full",
1039
- ze ? "bg-emerald-500" : "bg-slate-300 dark:bg-slate-600"
1090
+ Ae ? "bg-emerald-500" : "bg-slate-300 dark:bg-slate-600"
1040
1091
  ].join(" ")
1041
1092
  }
1042
1093
  ),
@@ -1044,12 +1095,12 @@ const zn = It(function({
1044
1095
  ]
1045
1096
  }
1046
1097
  ),
1047
- /* @__PURE__ */ y(
1098
+ /* @__PURE__ */ x(
1048
1099
  "span",
1049
1100
  {
1050
1101
  className: [
1051
1102
  "inline-flex items-center gap-0.5 rounded px-1 py-0.5 text-[9px] font-medium",
1052
- He ? "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"
1103
+ Ye ? "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"
1053
1104
  ].join(" "),
1054
1105
  title: "Manual fields",
1055
1106
  children: [
@@ -1058,7 +1109,7 @@ const zn = It(function({
1058
1109
  {
1059
1110
  className: [
1060
1111
  "h-1.5 w-1.5 rounded-full",
1061
- He ? "bg-emerald-500" : "bg-slate-300 dark:bg-slate-600"
1112
+ Ye ? "bg-emerald-500" : "bg-slate-300 dark:bg-slate-600"
1062
1113
  ].join(" ")
1063
1114
  }
1064
1115
  ),
@@ -1066,103 +1117,103 @@ const zn = It(function({
1066
1117
  ]
1067
1118
  }
1068
1119
  )
1069
- ] }) : void 0, $t = Re && je && (Q != null && Q.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: Q.map((w) => {
1070
- const R = (he == null ? void 0 : he[w.field]) ?? 2;
1120
+ ] }) : void 0, qt = We && Be && (X != null && X.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: X.map((w) => {
1121
+ const R = (xe == null ? void 0 : xe[w.field]) ?? 2;
1071
1122
  return /* @__PURE__ */ e("div", { style: { gridColumn: `span ${R}` }, children: /* @__PURE__ */ e(
1072
- Se,
1123
+ Oe,
1073
1124
  {
1074
1125
  field: w,
1075
- draft: a,
1076
- onChange: s,
1077
- relations: o,
1126
+ draft: o,
1127
+ onChange: l,
1128
+ relations: c,
1078
1129
  collection: r,
1079
- itemId: l,
1080
- error: m[w.field],
1130
+ itemId: s,
1131
+ error: f[w.field],
1081
1132
  visible: !0,
1082
1133
  forceVisible: !0,
1083
- locked: F.has(w.field),
1134
+ locked: O.has(w.field),
1084
1135
  layoutAiEnabled: $,
1085
1136
  renderField: h,
1086
1137
  onCountChange: v
1087
1138
  }
1088
1139
  ) }, w.field);
1089
- }) }) }) : void 0, Ke = /* @__PURE__ */ e(
1090
- Se,
1140
+ }) }) }) : void 0, Qe = /* @__PURE__ */ e(
1141
+ Oe,
1091
1142
  {
1092
- field: k,
1093
- draft: a,
1094
- onChange: s,
1095
- relations: o,
1143
+ field: S,
1144
+ draft: o,
1145
+ onChange: l,
1146
+ relations: c,
1096
1147
  collection: r,
1097
- itemId: l,
1098
- error: m[k.field],
1099
- visible: d.has(k.field) || !d.size,
1100
- forceVisible: we(k) || void 0,
1101
- locked: F.has(k.field),
1148
+ itemId: s,
1149
+ error: f[S.field],
1150
+ visible: u.has(S.field) || !u.size,
1151
+ forceVisible: $e(S) || void 0,
1152
+ locked: O.has(S.field),
1102
1153
  layoutAiEnabled: $,
1103
1154
  renderField: h,
1104
1155
  onCountChange: v,
1105
- swapButton: St,
1106
- swapContent: $t
1156
+ swapButton: Lt,
1157
+ swapContent: qt
1107
1158
  }
1108
1159
  );
1109
1160
  return K(
1110
- { kind: "field", field: k.field, group_key: t.key },
1111
- /* @__PURE__ */ y(
1161
+ { kind: "field", field: S.field, group_key: t.key },
1162
+ /* @__PURE__ */ x(
1112
1163
  "div",
1113
1164
  {
1114
- style: { gridColumn: `span ${Ze(k.options, Ne)}` },
1165
+ style: { gridColumn: `span ${it(S.options, ke)}` },
1115
1166
  children: [
1116
- we(k) ? /* @__PURE__ */ e("div", { "data-design-hidden": "", className: "opacity-40", children: Ke }) : Ke,
1117
- (G == null ? void 0 : G.length) && Ve && Je && /* @__PURE__ */ e(
1118
- pn,
1167
+ $e(S) ? /* @__PURE__ */ e("div", { "data-design-hidden": "", className: "opacity-40", children: Qe }) : Qe,
1168
+ (T == null ? void 0 : T.length) && He && Ke && /* @__PURE__ */ e(
1169
+ Nn,
1119
1170
  {
1120
- relCollection: Je,
1121
- relId: oe,
1122
- entries: G,
1123
- separator: kt
1171
+ relCollection: Ke,
1172
+ relId: de,
1173
+ entries: T,
1174
+ separator: jt
1124
1175
  }
1125
1176
  )
1126
1177
  ]
1127
1178
  },
1128
- k.field
1179
+ S.field
1129
1180
  )
1130
1181
  );
1131
- }, U = f.folded.map((b) => ({
1182
+ }, L = p.folded.map((b) => ({
1132
1183
  _k: b.field,
1133
1184
  sort: b.sort ?? 0,
1134
1185
  _t: "field",
1135
1186
  f: b
1136
1187
  }));
1137
- return /* @__PURE__ */ y(Dt, { children: [
1138
- /* @__PURE__ */ y(
1188
+ return /* @__PURE__ */ x(Bt, { children: [
1189
+ /* @__PURE__ */ x(
1139
1190
  "div",
1140
1191
  {
1141
- ref: _e,
1192
+ ref: ve,
1142
1193
  "data-section-grid": "",
1143
- className: E(j && "relative", "grid grid-cols-12 gap-4 items-start"),
1194
+ className: W(F && "relative", "grid grid-cols-12 gap-4 items-start"),
1144
1195
  children: [
1145
- /* @__PURE__ */ e(ke, {}),
1146
- N.map(p)
1196
+ /* @__PURE__ */ e(Fe, {}),
1197
+ _.map(a)
1147
1198
  ]
1148
1199
  }
1149
1200
  ),
1150
1201
  /* @__PURE__ */ e(
1151
- nn,
1202
+ dn,
1152
1203
  {
1153
- count: U.length,
1154
- open: bt,
1155
- forcedOpen: f.forcedOpen,
1156
- design: !!j,
1157
- onToggle: () => xt((b) => !b),
1158
- children: /* @__PURE__ */ y(
1204
+ count: L.length,
1205
+ open: wt,
1206
+ forcedOpen: p.forcedOpen,
1207
+ design: !!F,
1208
+ onToggle: () => vt((b) => !b),
1209
+ children: /* @__PURE__ */ x(
1159
1210
  "div",
1160
1211
  {
1161
1212
  "data-section-grid": "",
1162
- className: E(j && "relative", "grid grid-cols-12 gap-4 items-start"),
1213
+ className: W(F && "relative", "grid grid-cols-12 gap-4 items-start"),
1163
1214
  children: [
1164
- /* @__PURE__ */ e(ke, {}),
1165
- U.map(p)
1215
+ /* @__PURE__ */ e(Fe, {}),
1216
+ L.map(a)
1166
1217
  ]
1167
1218
  }
1168
1219
  )
@@ -1178,25 +1229,25 @@ const zn = It(function({
1178
1229
  ]
1179
1230
  }
1180
1231
  );
1181
- }, dn);
1182
- function xn({
1232
+ }, xn);
1233
+ function $n({
1183
1234
  layoutId: n,
1184
1235
  collection: t,
1185
1236
  sectionKey: i
1186
1237
  }) {
1187
- return ne(() => {
1188
- ot({ layoutId: n, collection: t, kind: "shown", key: i });
1238
+ return Q(() => {
1239
+ ft({ layoutId: n, collection: t, kind: "shown", key: i });
1189
1240
  }, [n, t, i]), null;
1190
1241
  }
1191
1242
  export {
1192
- zn as GroupSection,
1193
- pn as InlineDisplay,
1194
- Xe as OwnersInline,
1195
- un as OwnersInlineCompact,
1196
- re as RelationCell,
1197
- Rn as StripFieldValue,
1198
- pt as UserChip,
1199
- En as UserRosterCluster,
1200
- Fe as formatDisplayValue,
1201
- hn as useChangePulse
1243
+ rr as GroupSection,
1244
+ Nn as InlineDisplay,
1245
+ st as OwnersInline,
1246
+ gn as OwnersInlineCompact,
1247
+ ie as RelationCell,
1248
+ nr as StripFieldValue,
1249
+ gt as UserChip,
1250
+ lr as UserRosterCluster,
1251
+ qe as formatDisplayValue,
1252
+ vn as useChangePulse
1202
1253
  };