@nivaro/react 0.2.54 → 0.2.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +99 -98
  3. package/dist/index.d.ts +339 -2
  4. package/dist/index.js +644 -618
  5. package/dist/layout-editor.d.ts +4 -0
  6. package/dist/shared/components/BackgroundRunOffer.js +117 -0
  7. package/dist/shared/components/BroadcastView.js +214 -213
  8. package/dist/shared/components/CollectionBrowserView.js +2592 -2695
  9. package/dist/shared/components/ItemEditForm.js +4066 -3832
  10. package/dist/shared/components/JobsTray.js +100 -55
  11. package/dist/shared/components/MyWorkView.js +91 -89
  12. package/dist/shared/components/NotificationBell.js +80 -79
  13. package/dist/shared/components/ProfileView.js +568 -520
  14. package/dist/shared/components/RecordCompare.js +254 -0
  15. package/dist/shared/components/RecordReadView.js +599 -552
  16. package/dist/shared/components/ReportView.js +578 -543
  17. package/dist/shared/components/RowPresence.js +91 -0
  18. package/dist/shared/components/WidgetSlot.js +474 -458
  19. package/dist/shared/components/ai/AiAnalyticsView.js +16 -6
  20. package/dist/shared/components/ai/AskPanel.js +139 -119
  21. package/dist/shared/components/ai/FirstWeekCard.js +126 -0
  22. package/dist/shared/components/bulk/BulkFieldUpdate.js +289 -0
  23. package/dist/shared/components/bulk/bulk-field-options.js +45 -0
  24. package/dist/shared/components/charts/CumulativeFlowChart.js +176 -0
  25. package/dist/shared/components/chat/ChannelArchive.js +326 -0
  26. package/dist/shared/components/chat/ChannelExtras.js +141 -121
  27. package/dist/shared/components/chat/ChatAnalyticsView.js +112 -110
  28. package/dist/shared/components/chat/ChatPanel.js +1695 -1733
  29. package/dist/shared/components/chat/Composer.js +357 -303
  30. package/dist/shared/components/chat/MessageActions.js +92 -0
  31. package/dist/shared/components/chat/MessageFormat.js +290 -264
  32. package/dist/shared/components/chat/OutboxBubbles.js +146 -0
  33. package/dist/shared/components/chat/RequestIdCard.js +135 -0
  34. package/dist/shared/components/chat/RoomHeaderMenu.js +202 -0
  35. package/dist/shared/components/chat/RoomParts.js +213 -274
  36. package/dist/shared/components/chat/ScreenClip.js +184 -0
  37. package/dist/shared/components/chat/chat-core.js +402 -483
  38. package/dist/shared/components/chat/chat-drafts.js +59 -0
  39. package/dist/shared/components/chat/chat-emoji.js +348 -0
  40. package/dist/shared/components/chat/chat-local-time.js +41 -0
  41. package/dist/shared/components/chat/chat-outbox.js +303 -0
  42. package/dist/shared/components/chat/chat-window.js +163 -0
  43. package/dist/shared/components/chat/huddle/HuddleControls.js +143 -0
  44. package/dist/shared/components/chat/huddle/HuddleStage.js +164 -0
  45. package/dist/shared/components/chat/huddle/huddle-store.js +342 -0
  46. package/dist/shared/components/chat/huddle/useHuddle.js +58 -0
  47. package/dist/shared/components/help-videos/api.js +76 -73
  48. package/dist/shared/components/item-edit/CatalogPickerField.js +113 -112
  49. package/dist/shared/components/item-edit/ChangeReasonDialog.js +13 -13
  50. package/dist/shared/components/item-edit/FieldAffordances.js +2 -2
  51. package/dist/shared/components/item-edit/FieldRenderer.js +248 -245
  52. package/dist/shared/components/item-edit/FieldRow.js +292 -279
  53. package/dist/shared/components/item-edit/GroupSection.js +698 -574
  54. package/dist/shared/components/item-edit/InlineTableField.js +3 -1
  55. package/dist/shared/components/item-edit/RelationCombobox.js +186 -176
  56. package/dist/shared/components/item-edit/entry/EntryStrip.js +54 -0
  57. package/dist/shared/components/item-edit/entry/entry-keys.js +27 -0
  58. package/dist/shared/components/item-edit/entry/useEntryKeyboard.js +70 -0
  59. package/dist/shared/components/item-edit/entry/useEntryMode.js +59 -0
  60. package/dist/shared/components/item-edit/form-structure-ui.js +105 -0
  61. package/dist/shared/components/item-edit/lazy-sections.js +36 -0
  62. package/dist/shared/components/item-edit/lock-why.js +39 -32
  63. package/dist/shared/components/item-edit/picker-miss.js +26 -0
  64. package/dist/shared/components/item-edit/placement-behaviour.js +196 -0
  65. package/dist/shared/components/item-edit/useFormUsageBeacon.js +51 -45
  66. package/dist/shared/components/layout-editor/AddPanel.js +134 -117
  67. package/dist/shared/components/layout-editor/ChangeNote.js +25 -24
  68. package/dist/shared/components/layout-editor/CollabParts.js +80 -75
  69. package/dist/shared/components/layout-editor/DesignNode.js +126 -120
  70. package/dist/shared/components/layout-editor/EditorCanvas.js +30 -27
  71. package/dist/shared/components/layout-editor/EditorTopBar.js +203 -192
  72. package/dist/shared/components/layout-editor/HistoryPanel.js +120 -104
  73. package/dist/shared/components/layout-editor/LayoutEditor.js +768 -671
  74. package/dist/shared/components/layout-editor/RestorePiece.js +143 -0
  75. package/dist/shared/components/layout-editor/StagedChip.js +22 -0
  76. package/dist/shared/components/layout-editor/StructureMenu.js +237 -186
  77. package/dist/shared/components/layout-editor/collab/FormFollowShare.js +149 -103
  78. package/dist/shared/components/layout-editor/collab/collab-api.js +29 -26
  79. package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +81 -80
  80. package/dist/shared/components/layout-editor/dnd/node.js +69 -57
  81. package/dist/shared/components/layout-editor/draft-recovery.js +113 -43
  82. package/dist/shared/components/layout-editor/entry/PlacementPresets.js +149 -0
  83. package/dist/shared/components/layout-editor/entry/entry-editor-context.js +10 -0
  84. package/dist/shared/components/layout-editor/entry/presets.js +71 -0
  85. package/dist/shared/components/layout-editor/entry/tab-order.js +110 -0
  86. package/dist/shared/components/layout-editor/entry/theme-preview.js +37 -0
  87. package/dist/shared/components/layout-editor/grid-guides.js +142 -0
  88. package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +402 -0
  89. package/dist/shared/components/layout-editor/inspector/BulkInspector.js +61 -57
  90. package/dist/shared/components/layout-editor/inspector/GroupInspector.js +247 -151
  91. package/dist/shared/components/layout-editor/inspector/Inspector.js +176 -155
  92. package/dist/shared/components/layout-editor/inspector/LookTab.js +167 -116
  93. package/dist/shared/components/layout-editor/inspector/PickerMisses.js +129 -0
  94. package/dist/shared/components/layout-editor/inspector/PickerTab.js +84 -82
  95. package/dist/shared/components/layout-editor/inspector/RulesTab.js +66 -62
  96. package/dist/shared/components/layout-editor/inspector/kit.js +69 -68
  97. package/dist/shared/components/layout-editor/outputs/OutputsButton.js +254 -0
  98. package/dist/shared/components/layout-editor/outputs/help-sheet.js +154 -0
  99. package/dist/shared/components/layout-editor/outputs/output-api.js +61 -0
  100. package/dist/shared/components/layout-editor/overview/describe-conditions.js +6 -0
  101. package/dist/shared/components/layout-editor/overview/purpose.js +15 -13
  102. package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
  103. package/dist/shared/components/layout-editor/restore-piece.js +192 -0
  104. package/dist/shared/components/layout-editor/section-structure.js +241 -0
  105. package/dist/shared/components/layout-editor/settings/EntrySection.js +296 -0
  106. package/dist/shared/components/layout-editor/settings/FormSettings.js +41 -39
  107. package/dist/shared/components/layout-editor/settings/ResolveSettings.js +255 -0
  108. package/dist/shared/components/layout-editor/settings/ToolsSection.js +147 -111
  109. package/dist/shared/components/layout-editor/settings/WhoSection.js +29 -26
  110. package/dist/shared/components/layout-editor/settings/settings-registry.js +114 -17
  111. package/dist/shared/components/layout-editor/staged-api.js +64 -0
  112. package/dist/shared/components/layout-editor/structure-ops.js +81 -77
  113. package/dist/shared/components/layout-editor/testing/TestingPanels.js +65 -60
  114. package/dist/shared/components/layout-editor/testing/testing-model.js +198 -185
  115. package/dist/shared/components/layout-editor/toolbar-kit.js +11 -11
  116. package/dist/shared/components/layout-editor/usage/AbTestSection.js +355 -0
  117. package/dist/shared/components/layout-editor/usage/UsagePanel.js +144 -70
  118. package/dist/shared/components/layout-editor/usage/ab-api.js +86 -0
  119. package/dist/shared/components/layout-editor/usage/suggest-collapse.js +32 -0
  120. package/dist/shared/components/layout-editor/useLayoutDraft.js +25 -24
  121. package/dist/shared/components/notifications/NotificationAnalyticsView.js +148 -77
  122. package/dist/shared/components/panels/ErpFailureBanner.js +18 -17
  123. package/dist/shared/components/panels/ExternalRequestsChip.js +63 -62
  124. package/dist/shared/components/pipeline/PipelineEditorView.js +106 -104
  125. package/dist/shared/components/profile/AgentsPanel.js +479 -0
  126. package/dist/shared/components/queue/QueueWorklist.js +1026 -1040
  127. package/dist/shared/components/support/SupportAnalytics.js +171 -0
  128. package/dist/shared/components/support/SupportView.js +75 -73
  129. package/dist/shared/lib/background-runs.js +150 -0
  130. package/dist/shared/lib/delivery-ack.js +9 -0
  131. package/dist/shared/lib/entry-badge-style.js +13 -0
  132. package/dist/shared/lib/entry-config.js +71 -0
  133. package/dist/shared/lib/form-sections.js +64 -0
  134. package/dist/shared/lib/form-structure.js +99 -0
  135. package/dist/shared/lib/form-usage-beacon.js +101 -52
  136. package/dist/shared/lib/jobs-tray.js +25 -23
  137. package/dist/shared/lib/keyset-pager.js +37 -0
  138. package/dist/shared/lib/layout-ops.js +84 -82
  139. package/dist/shared/lib/layout-resolve.js +113 -0
  140. package/dist/shared/lib/placement-behaviour.js +144 -0
  141. package/dist/shared/lib/prefetch.js +149 -0
  142. package/dist/shared/lib/presence-hooks.js +199 -0
  143. package/dist/shared/lib/record-outbox.js +82 -81
  144. package/dist/shared/lib/replay-socket.js +93 -0
  145. package/dist/shared/lib/request-gate.js +51 -50
  146. package/dist/shared/lib/room-gaps.js +96 -0
  147. package/dist/shared/lib/search-log.js +27 -0
  148. package/dist/shared/lib/socket-realtime.js +101 -80
  149. package/dist/shared/lib/worker-socket.js +200 -0
  150. package/package.json +1 -1
@@ -1,83 +1,91 @@
1
- import { jsxs as v, jsx as n, Fragment as ue } from "react/jsx-runtime";
2
- import { useQueryClient as Bt, useQuery as _t } from "@tanstack/react-query";
3
- import { Percent as qt, AlertTriangle as at, Plus as Ut, BarChart3 as $t, LayoutGrid as Vt, Table2 as jt, Grid3x3 as zt, Users as Gt } from "lucide-react";
4
- import { useState as P, useEffect as B, useMemo as N, useRef as z, useCallback as b } from "react";
5
- import { createPortal as Ht } from "react-dom";
6
- import { toast as st } from "sonner";
7
- import { useNivaroClient as Wt } from "../../context.js";
8
- import { get as Qt } from "../../lib/commands.js";
9
- import { HEADER_GROUP_KEY as mt, UNGROUPED_KEY as Jt } from "../../lib/layout-ops.js";
10
- import { useMyUserId as Yt } from "../../lib/presence-signals.js";
11
- import { cn as re } from "../../lib/utils.js";
12
- import { modalHostOf as Zt } from "../ui/popover.js";
13
- import { Skeleton as it } from "../ui/skeleton.js";
14
- import { AddPanel as Xt } from "./AddPanel.js";
15
- import { AutoArrangeButton as er } from "./AutoArrange.js";
16
- import { AiToolsButton as tr } from "./ai/AiToolsButton.js";
17
- import { pinsToMarks as rr, mergeMarks as lt } from "./ai/ai-tools-api.js";
18
- import { AiFormsButton as or } from "./ai-forms/AiFormsButton.js";
19
- import { AskButton as nr, AskPanel as ar } from "./assist/AskPanel.js";
20
- import { useAskThread as sr } from "./assist/assist-api.js";
21
- import { jumpToSetting as ir } from "./assist/jump.js";
22
- import { ProposalsButton as lr } from "./assist/ProposalsButton.js";
23
- import { BulkChangesButton as dr } from "./bulk/BulkChangesButton.js";
24
- import { useMacroRecorder as ur } from "./bulk/useMacroRecorder.js";
25
- import { bundleToActiveLayout as ft, previewForRole as cr, roleMarker as pr } from "./bundle-to-active.js";
26
- import { useCanvasCompare as mr, CompareBanner as fr } from "./CanvasCompare.js";
27
- import { changeNotePolicyOf as dt, changeNoteMeta as yr, changeNoteReady as hr, ChangeNoteFields as vr, ChangeNoteSave as gr } from "./ChangeNote.js";
28
- import { PresenceAvatars as kr, DroppedBanner as wr, RecoveryBanner as br, UnsavedList as xr } from "./CollabParts.js";
29
- import { CommandPalette as Sr } from "./commands/CommandPalette.js";
30
- import { nextSelection as Cr, targetKey as U } from "./design-context.js";
31
- import { LayoutDndProvider as Rr, useLayoutDnd as Ar } from "./dnd/LayoutDndProvider.js";
32
- import { NO_DND as Nr } from "./dnd/node.js";
33
- import { useDraftRecovery as Lr } from "./draft-recovery.js";
34
- import { canvasRenderer as Pr, EditorCanvas as Tr } from "./EditorCanvas.js";
35
- import { EditorTopBar as Or } from "./EditorTopBar.js";
36
- import { notesOf as Er, noteKey as Kr } from "./editor-notes.js";
37
- import { useRulesView as Ir, explainMarks as Fr, RulesToggle as Mr, RuleLoopsBanner as Dr } from "./explain/CanvasRules.js";
38
- import { useDriverHover as Br } from "./explain/driver-hover.js";
39
- import { useCanvasExplain as _r, useDefaultGhosts as qr } from "./explain/use-explain.js";
40
- import { FindReplaceButton as Ur } from "./FindReplace.js";
41
- import { FormMapButton as $r } from "./FormMapButton.js";
42
- import { useSectionChanges as Vr } from "./history-api.js";
43
- import { useLayoutEditorHost as jr } from "./host.js";
44
- import { overriddenTargets as zr, overrideMark as Gr } from "./inheritance.js";
45
- import { BulkInspector as Hr } from "./inspector/BulkInspector.js";
46
- import { requestInspectorTab as Wr } from "./inspector/tab-request.js";
47
- import { isTyping as Ke } from "./is-typing.js";
48
- import { ARROW_DIRS as Qr, altArrowMove as Jr } from "./keyboard-move.js";
49
- import { LayoutsRail as Yr } from "./LayoutsRail.js";
50
- import { LintButton as Zr, LintPanel as Xr } from "./lint/LintPanel.js";
51
- import { useLayoutLint as eo } from "./lint/lint-api.js";
52
- import { FieldStateMatrix as to } from "./matrix/FieldStateMatrix.js";
53
- import { RoleSectionMatrix as ro } from "./matrix/RoleSectionMatrix.js";
54
- import { FindTool as oo, OutlineTool as no, ViewTools as ao, ShortcutsTool as so } from "./nav/NavTools.js";
55
- import { OutlinePanel as io } from "./nav/OutlinePanel.js";
56
- import { useEditorNav as lo } from "./nav/useEditorNav.js";
57
- import { COMPACT_ZOOM as uo } from "./nav/view-prefs.js";
58
- import { useLayoutOverview as co, useOverviewFields as po, useInvalidateLayouts as yt, useRuleChoiceLabels as mo, useApproxRecordCount as fo } from "./overview/overview-api.js";
59
- import { purposeSegments as yo, Sentence as ho } from "./overview/purpose.js";
60
- import { PlacementsTable as vo } from "./PlacementsTable.js";
61
- import { segTrack as go, amberStrip as ut, segOption as ko } from "./panel-style.js";
62
- import { useLayoutPresence as wo, peersByTarget as bo } from "./presence.js";
63
- import { PreviewModes as xo } from "./preview/PreviewModes.js";
64
- import { PreviewPanes as So } from "./preview/PreviewPanes.js";
65
- import { FormMoreMenu as Co } from "./reuse/FormMoreMenu.js";
66
- import { useRailCopy as Ro } from "./reuse/useRailCopy.js";
67
- import { StructureActions as Ao, usePinMarks as No } from "./StructureMenu.js";
68
- import { useRolePreview as Lo } from "./settings/settings-api.js";
69
- import { layoutKindOf as Po } from "./settings/settings-registry.js";
70
- import { ImpactButton as To, TestingButton as Oo } from "./testing/TestingPanels.js";
71
- import { MenuSeparator as ge, ToolButton as Eo } from "./toolbar-kit.js";
72
- import { unsavedText as Ko, UnsavedConfirm as Io } from "./UnsavedConfirm.js";
73
- import { unsavedKeys as Fo, targetFromKey as ct, describeTarget as pt } from "./unsaved-marks.js";
74
- import { UsagePanel as Mo } from "./usage/UsagePanel.js";
75
- import { useShowFillRates as Do, useFieldFillRates as Bo, usageTodayText as _o, useLayoutUsageToday as qo } from "./usage/usage-api.js";
76
- import { useLayoutDraft as Uo, useLayoutBundle as Te, layoutDraftKeys as $o, touchesOverview as Vo } from "./useLayoutDraft.js";
77
- import { FormSettings as jo } from "./settings/FormSettings.js";
78
- import { Inspector as zo } from "./inspector/Inspector.js";
79
- function Go(r) {
80
- B(() => {
1
+ import { jsxs as h, jsx as o, Fragment as de } from "react/jsx-runtime";
2
+ import { useQueryClient as er, useQuery as tr } from "@tanstack/react-query";
3
+ import { Percent as rr, ListOrdered as or, AlertTriangle as ht, Lock as nr, Plus as ar, BarChart3 as sr, LayoutGrid as ir, Table2 as lr, Grid3x3 as dr, Users as cr } from "lucide-react";
4
+ import { useState as R, useEffect as $, useMemo as S, useRef as j, useCallback as C } from "react";
5
+ import { createPortal as ur } from "react-dom";
6
+ import { toast as vt } from "sonner";
7
+ import { useNivaroClient as pr } from "../../context.js";
8
+ import { get as mr } from "../../lib/commands.js";
9
+ import { HEADER_GROUP_KEY as At, UNGROUPED_KEY as fr } from "../../lib/layout-ops.js";
10
+ import { activeFreeze as yr, dayWords as hr } from "../../lib/layout-resolve.js";
11
+ import { useMyUserId as vr } from "../../lib/presence-signals.js";
12
+ import { cn as G } from "../../lib/utils.js";
13
+ import { modalHostOf as gr } from "../ui/popover.js";
14
+ import { Skeleton as gt } from "../ui/skeleton.js";
15
+ import { AddPanel as kr } from "./AddPanel.js";
16
+ import { AutoArrangeButton as br } from "./AutoArrange.js";
17
+ import { AiToolsButton as wr } from "./ai/AiToolsButton.js";
18
+ import { pinsToMarks as xr, mergeMarks as kt } from "./ai/ai-tools-api.js";
19
+ import { AiFormsButton as Sr } from "./ai-forms/AiFormsButton.js";
20
+ import { AskButton as Cr, AskPanel as Tr } from "./assist/AskPanel.js";
21
+ import { useAskThread as Ar } from "./assist/assist-api.js";
22
+ import { jumpToSetting as Nr } from "./assist/jump.js";
23
+ import { ProposalsButton as Or } from "./assist/ProposalsButton.js";
24
+ import { BulkChangesButton as Rr } from "./bulk/BulkChangesButton.js";
25
+ import { useMacroRecorder as Lr } from "./bulk/useMacroRecorder.js";
26
+ import { bundleToActiveLayout as Nt, previewForRole as Pr, roleMarker as Er } from "./bundle-to-active.js";
27
+ import { useCanvasCompare as Fr, CompareBanner as Ir } from "./CanvasCompare.js";
28
+ import { changeNotePolicyOf as bt, changeNoteMeta as Kr, changeNoteReady as Dr, ChangeNoteFields as _r, ChangeNoteSave as Mr } from "./ChangeNote.js";
29
+ import { PresenceAvatars as Br, DroppedBanner as qr, RecoveryBanner as $r, UnsavedList as Ur } from "./CollabParts.js";
30
+ import { CommandPalette as zr } from "./commands/CommandPalette.js";
31
+ import { nextSelection as Vr, targetKey as z } from "./design-context.js";
32
+ import { WIDTH_LABELS as Hr } from "./field-zones.js";
33
+ import { LayoutDndProvider as Wr, useLayoutDnd as jr } from "./dnd/LayoutDndProvider.js";
34
+ import { NO_DND as Gr } from "./dnd/node.js";
35
+ import { useDraftRecovery as Qr, stagedTip as Jr } from "./draft-recovery.js";
36
+ import { canvasRenderer as Yr, EditorCanvas as Zr } from "./EditorCanvas.js";
37
+ import { EditorTopBar as Xr } from "./EditorTopBar.js";
38
+ import { notesOf as eo, noteKey as to } from "./editor-notes.js";
39
+ import { EntryEditorContext as wt } from "./entry/entry-editor-context.js";
40
+ import { useTabOrderEditor as ro, TabOrderBar as oo } from "./entry/tab-order.js";
41
+ import { useAppIsDark as no, ThemePreviewTool as ao, previewThemeClass as so } from "./entry/theme-preview.js";
42
+ import { useRulesView as io, explainMarks as lo, RulesToggle as co, RuleLoopsBanner as uo } from "./explain/CanvasRules.js";
43
+ import { useDriverHover as po } from "./explain/driver-hover.js";
44
+ import { useCanvasExplain as mo, useDefaultGhosts as fo } from "./explain/use-explain.js";
45
+ import { FindReplaceButton as yo } from "./FindReplace.js";
46
+ import { OutputsButton as ho } from "./outputs/OutputsButton.js";
47
+ import { FormMapButton as vo } from "./FormMapButton.js";
48
+ import { useSectionChanges as go } from "./history-api.js";
49
+ import { useLayoutEditorHost as ko } from "./host.js";
50
+ import { overriddenTargets as bo, overrideMark as wo } from "./inheritance.js";
51
+ import { BulkInspector as xo } from "./inspector/BulkInspector.js";
52
+ import { requestInspectorTab as So } from "./inspector/tab-request.js";
53
+ import { isTyping as $e } from "./is-typing.js";
54
+ import { ARROW_DIRS as Co, altArrowMove as To } from "./keyboard-move.js";
55
+ import { LayoutsRail as Ao } from "./LayoutsRail.js";
56
+ import { LintButton as No, LintPanel as Oo } from "./lint/LintPanel.js";
57
+ import { useLayoutLint as Ro } from "./lint/lint-api.js";
58
+ import { FieldStateMatrix as Lo } from "./matrix/FieldStateMatrix.js";
59
+ import { RoleSectionMatrix as Po } from "./matrix/RoleSectionMatrix.js";
60
+ import { FindTool as Eo, OutlineTool as Fo, ViewTools as Io, ShortcutsTool as Ko } from "./nav/NavTools.js";
61
+ import { OutlinePanel as Do } from "./nav/OutlinePanel.js";
62
+ import { useEditorNav as _o } from "./nav/useEditorNav.js";
63
+ import { COMPACT_ZOOM as Mo } from "./nav/view-prefs.js";
64
+ import { useLayoutOverview as Bo, useOverviewFields as qo, useInvalidateLayouts as Ot, useRuleChoiceLabels as $o, useApproxRecordCount as Uo } from "./overview/overview-api.js";
65
+ import { purposeSegments as zo, Sentence as Vo } from "./overview/purpose.js";
66
+ import { PlacementsTable as Ho } from "./PlacementsTable.js";
67
+ import { segTrack as Wo, amberStrip as _e, segOption as jo } from "./panel-style.js";
68
+ import { useLayoutPresence as Go, peersByTarget as Qo } from "./presence.js";
69
+ import { PreviewModes as Jo } from "./preview/PreviewModes.js";
70
+ import { PreviewPanes as Yo } from "./preview/PreviewPanes.js";
71
+ import { FormMoreMenu as Zo } from "./reuse/FormMoreMenu.js";
72
+ import { useRailCopy as Xo } from "./reuse/useRailCopy.js";
73
+ import { StagedByOthers as en } from "./StagedChip.js";
74
+ import { StructureActions as tn, usePinMarks as rn } from "./StructureMenu.js";
75
+ import { useRolePreview as on } from "./settings/settings-api.js";
76
+ import { layoutKindOf as nn } from "./settings/settings-registry.js";
77
+ import { useStagedDraft as an, useStagedWriter as sn } from "./staged-api.js";
78
+ import { ImpactButton as ln, TestingButton as dn } from "./testing/TestingPanels.js";
79
+ import { MenuSeparator as Se, ToolButton as xt } from "./toolbar-kit.js";
80
+ import { unsavedText as cn, UnsavedConfirm as un } from "./UnsavedConfirm.js";
81
+ import { unsavedKeys as pn, targetFromKey as St, describeTarget as Ct } from "./unsaved-marks.js";
82
+ import { UsagePanel as mn } from "./usage/UsagePanel.js";
83
+ import { useShowFillRates as fn, useFieldFillRates as yn, usageTodayText as hn, useLayoutUsageToday as vn } from "./usage/usage-api.js";
84
+ import { useLayoutDraft as gn, useLayoutBundle as Me, layoutDraftKeys as kn, touchesOverview as bn } from "./useLayoutDraft.js";
85
+ import { FormSettings as wn } from "./settings/FormSettings.js";
86
+ import { Inspector as xn } from "./inspector/Inspector.js";
87
+ function Sn(r) {
88
+ $(() => {
81
89
  const l = (s) => {
82
90
  if (!(s.metaKey || s.ctrlKey) || s.altKey) return;
83
91
  const i = s.key.toLowerCase();
@@ -86,247 +94,262 @@ function Go(r) {
86
94
  return;
87
95
  }
88
96
  const m = i === "z" && s.shiftKey || i === "y" && !s.shiftKey;
89
- i !== "z" && !m || Ke(s.target) || (s.preventDefault(), m ? r.redo() : r.undo());
97
+ i !== "z" && !m || $e(s.target) || (s.preventDefault(), m ? r.redo() : r.undo());
90
98
  };
91
99
  return window.addEventListener("keydown", l), () => window.removeEventListener("keydown", l);
92
100
  }, [r.undo, r.redo, r.autosave, r.flush, r.save]);
93
101
  }
94
- function Ho(r, l, s, i, m) {
95
- B(() => {
96
- const d = (u) => {
97
- const h = Qr[u.key];
98
- if (!h || !u.altKey || u.metaKey || u.ctrlKey || u.shiftKey || u.defaultPrevented || !r || l.length !== 1 || i.current || Ke(u.target) || document.querySelector('[data-radix-popper-content-wrapper], [role="menu"]')) return;
99
- u.preventDefault();
100
- const p = Jr(r, l[0], h);
102
+ function Cn(r, l, s, i, m) {
103
+ $(() => {
104
+ const d = (c) => {
105
+ const v = Co[c.key];
106
+ if (!v || !c.altKey || c.metaKey || c.ctrlKey || c.shiftKey || c.defaultPrevented || !r || l.length !== 1 || i.current || $e(c.target) || document.querySelector('[data-radix-popper-content-wrapper], [role="menu"]')) return;
107
+ c.preventDefault();
108
+ const p = To(r, l[0], v);
101
109
  if (!p) return;
102
110
  s(p.ops, { label: p.label }), m(p.next);
103
- const c = U(p.next);
111
+ const u = z(p.next);
104
112
  requestAnimationFrame(() => {
105
- var G;
113
+ var Q;
106
114
  const g = document.querySelector(
107
- `[data-layout-editor] [data-design-target="${CSS.escape(c)}"]`
115
+ `[data-layout-editor] [data-design-target="${CSS.escape(u)}"]`
108
116
  );
109
- g == null || g.focus({ preventScroll: !0 }), (G = g == null ? void 0 : g.scrollIntoView) == null || G.call(g, { block: "nearest" });
117
+ g == null || g.focus({ preventScroll: !0 }), (Q = g == null ? void 0 : g.scrollIntoView) == null || Q.call(g, { block: "nearest" });
110
118
  });
111
119
  };
112
120
  return window.addEventListener("keydown", d), () => window.removeEventListener("keydown", d);
113
121
  }, [r, l, s, i, m]);
114
122
  }
115
- function Wo(r) {
123
+ function Tn(r) {
116
124
  const l = r.status === "saving" || r.dirty;
117
- B(() => {
125
+ $(() => {
118
126
  if (!l) return;
119
127
  const s = (i) => {
120
128
  r.flush(), i.preventDefault(), i.returnValue = "";
121
129
  };
122
130
  return window.addEventListener("beforeunload", s), () => window.removeEventListener("beforeunload", s);
123
- }, [l, r.flush]), B(() => {
131
+ }, [l, r.flush]), $(() => {
124
132
  const s = () => r.flush();
125
133
  return window.addEventListener("pagehide", s), () => window.removeEventListener("pagehide", s);
126
134
  }, [r.flush]);
127
135
  }
128
- function Qo(r) {
129
- const l = Bt(), s = yt(r);
130
- return b(
136
+ function An(r) {
137
+ const l = er(), s = Ot(r);
138
+ return C(
131
139
  (i, m) => {
132
140
  const d = Number(i.layout.id);
133
- Number.isFinite(d) && l.invalidateQueries({ queryKey: $o.versions(d) }), s({ lazy: !Vo(m) });
141
+ Number.isFinite(d) && l.invalidateQueries({ queryKey: kn.versions(d) }), s({ lazy: !bn(m) });
134
142
  },
135
143
  [l, s]
136
144
  );
137
145
  }
138
- function Jo(r, l) {
139
- const s = Wt();
140
- return _t({
146
+ function Nn(r, l) {
147
+ const s = pr();
148
+ return tr({
141
149
  queryKey: ["layout-editor", "preview-record", r, l],
142
150
  queryFn: () => s.request(
143
- Qt(`/items/${encodeURIComponent(r)}/${encodeURIComponent(String(l))}`)
151
+ mr(`/items/${encodeURIComponent(r)}/${encodeURIComponent(String(l))}`)
144
152
  ).then((i) => i.data ?? null),
145
153
  enabled: l != null,
146
154
  staleTime: 3e4
147
155
  });
148
156
  }
149
- function Yo(r, l) {
150
- const s = z(l);
151
- s.current = l, B(() => {
157
+ function On(r, l) {
158
+ const s = j(l);
159
+ s.current = l, $(() => {
152
160
  if (!r) return;
153
161
  let i = !1;
154
162
  const m = (d) => {
155
- var p, c;
163
+ var p, u;
156
164
  if (i || d.defaultPrevented || d.button !== 0 || d.metaKey || d.ctrlKey || d.shiftKey || d.altKey) return;
157
- const u = (c = (p = d.target) == null ? void 0 : p.closest) == null ? void 0 : c.call(p, "a[href]");
158
- if (!u || u.target && u.target !== "_self" || u.hasAttribute("download")) return;
159
- let h;
165
+ const c = (u = (p = d.target) == null ? void 0 : p.closest) == null ? void 0 : u.call(p, "a[href]");
166
+ if (!c || c.target && c.target !== "_self" || c.hasAttribute("download")) return;
167
+ let v;
160
168
  try {
161
- h = new URL(u.href, window.location.href);
169
+ v = new URL(c.href, window.location.href);
162
170
  } catch {
163
171
  return;
164
172
  }
165
- h.origin === window.location.origin && h.pathname + h.search !== window.location.pathname + window.location.search && (d.preventDefault(), d.stopPropagation(), s.current(() => {
173
+ v.origin === window.location.origin && v.pathname + v.search !== window.location.pathname + window.location.search && (d.preventDefault(), d.stopPropagation(), s.current(() => {
166
174
  i = !0;
167
175
  try {
168
- u.click();
176
+ c.click();
169
177
  } finally {
170
178
  i = !1;
171
179
  }
172
- }, u));
180
+ }, c));
173
181
  };
174
182
  return document.addEventListener("click", m, !0), () => document.removeEventListener("click", m, !0);
175
183
  }, [r]);
176
184
  }
177
- function Oe(r, l, s = null) {
185
+ function Be(r, l, s = null) {
178
186
  const i = (m) => {
179
- if (r.kind === "group") return r.key === Jt || m.groups.some((u) => u.key === r.key);
180
- const d = r.kind === "header" ? mt : r.group_key;
181
- return m.placements.some((u) => u.field === r.field && u.group_key === d);
187
+ if (r.kind === "group") return r.key === fr || m.groups.some((c) => c.key === r.key);
188
+ const d = r.kind === "header" ? At : r.group_key;
189
+ return m.placements.some((c) => c.field === r.field && c.group_key === d);
182
190
  };
183
191
  return i(l) || s != null && i(s);
184
192
  }
185
- function Zo(r, l, s) {
186
- const i = z(null), m = z(l);
187
- return m.current = l, B(() => {
188
- var h;
193
+ function Rn(r, l, s) {
194
+ const i = j(null), m = j(l);
195
+ return m.current = l, $(() => {
196
+ var v;
189
197
  if (!r) return;
190
198
  const d = document.activeElement;
191
- (h = i.current) == null || h.focus();
192
- const u = (p) => {
193
- p.key !== "Escape" || p.defaultPrevented || s.current || Ke(p.target) || document.querySelector('[data-radix-popper-content-wrapper], [role="menu"]') || (p.preventDefault(), m.current());
199
+ (v = i.current) == null || v.focus();
200
+ const c = (p) => {
201
+ p.key !== "Escape" || p.defaultPrevented || s.current || $e(p.target) || document.querySelector('[data-radix-popper-content-wrapper], [role="menu"]') || (p.preventDefault(), m.current());
194
202
  };
195
- return document.addEventListener("keydown", u), () => {
196
- document.removeEventListener("keydown", u), d != null && d.isConnected && d.focus();
203
+ return document.addEventListener("keydown", c), () => {
204
+ document.removeEventListener("keydown", c), d != null && d.isConnected && d.focus();
197
205
  };
198
206
  }, [r, s]), i;
199
207
  }
200
- function Xo({
208
+ function Ln({
201
209
  collection: r,
202
210
  bundle: l,
203
211
  parent: s,
204
212
  roleId: i,
205
213
  stateKey: m = null,
206
214
  marks: d,
207
- overlay: u,
208
- ruleMarks: h,
215
+ overlay: c,
216
+ ruleMarks: v,
209
217
  ghost: p,
210
- deps: c,
218
+ deps: u,
211
219
  noDnd: g = !1,
212
- record: G,
213
- selected: o,
214
- selection: ce,
220
+ record: Q,
221
+ selected: n,
222
+ selection: ye,
215
223
  onSelect: t,
216
- showHidden: T,
217
- fold: J = null,
218
- reveal: $ = null,
219
- apply: O,
220
- whenIdle: ke,
221
- fillRate: pe,
222
- unsaved: me,
223
- peers: ne,
224
+ showHidden: E,
225
+ fold: te = null,
226
+ reveal: V = null,
227
+ apply: N,
228
+ whenIdle: Ce,
229
+ fillRate: he,
230
+ unsaved: ve,
231
+ peers: ce,
224
232
  compare: y,
225
233
  lastChanges: L
226
234
  }) {
227
- const Y = Ar(), _ = g ? Nr : Y, ae = Pr(String(l.layout.layout_type ?? "grouped")), oe = (ae === "item-edit-form" || ae === "read-view") && (y == null ? void 0 : y.diff.bundle) || l, M = N(() => ft(oe, s), [oe, s]), H = N(
228
- () => s ? zr(l, s) : null,
235
+ const re = jr(), K = g ? Gr : re, se = Yr(String(l.layout.layout_type ?? "grouped")), ie = (se === "item-edit-form" || se === "read-view") && (y == null ? void 0 : y.diff.bundle) || l, M = S(() => Nt(ie, s), [ie, s]), J = S(
236
+ () => s ? bo(l, s) : null,
229
237
  [l, s]
230
- ), V = N(() => H != null && H.size ? (S) => {
231
- const j = H.get(U(S)), Z = (d == null ? void 0 : d(S)) ?? [];
232
- return j ? [...Z, Gr(j)] : Z;
233
- } : d, [H, d]), we = N(
234
- () => cr(M.active, i, T),
235
- [M.active, i, T]
236
- ), { data: I = null } = Lo(r, i), W = N(
237
- () => i ? pr(I) : void 0,
238
- [i, I]
239
- ), C = N(() => Er(l), [l]), F = N(
240
- () => V && h ? (S) => [...V(S), ...h(S)] : V ?? h,
241
- [V, h]
242
- ), D = No(l, F), be = N(
238
+ ), H = S(() => J != null && J.size ? (k) => {
239
+ const P = J.get(z(k)), oe = (d == null ? void 0 : d(k)) ?? [];
240
+ return P ? [...oe, wo(P)] : oe;
241
+ } : d, [J, d]), Te = S(
242
+ () => Pr(M.active, i, E),
243
+ [M.active, i, E]
244
+ ), { data: D = null } = on(r, i), Y = S(
245
+ () => i ? Er(D) : void 0,
246
+ [i, D]
247
+ ), O = S(() => eo(l), [l]), _ = S(
248
+ () => H && v ? (k) => [...H(k), ...v(k)] : H ?? v,
249
+ [H, v]
250
+ ), B = rn(l, _), Ae = S(
243
251
  () => ({
244
- selected: o,
245
- selection: ce,
252
+ selected: n,
253
+ selection: ye,
246
254
  onSelect: t,
247
- showHidden: T,
248
- inheritedFrom: (S) => M.inherited.get(U(S)) ?? null,
249
- dnd: _,
250
- roleMark: W,
251
- marks: D,
252
- overlay: u,
253
- fillRate: pe,
254
- note: (S) => {
255
- const j = Kr(S);
256
- return j ? C.get(j) ?? null : null;
255
+ showHidden: E,
256
+ inheritedFrom: (k) => M.inherited.get(z(k)) ?? null,
257
+ dnd: K,
258
+ roleMark: Y,
259
+ marks: B,
260
+ overlay: c,
261
+ fillRate: he,
262
+ note: (k) => {
263
+ const P = to(k);
264
+ return P ? O.get(P) ?? null : null;
257
265
  },
258
- fold: J,
259
- reveal: $,
260
- unsaved: me,
261
- peers: ne,
262
- diffMark: y ? (S) => y.diff.marks.get(U(S)) ?? null : void 0,
263
- lastChange: L ? (S) => S.kind === "group" ? L[S.key] ?? null : null : void 0,
264
- ghost: p
266
+ fold: te,
267
+ reveal: V,
268
+ unsaved: ve,
269
+ peers: ce,
270
+ diffMark: y ? (k) => y.diff.marks.get(z(k)) ?? null : void 0,
271
+ lastChange: L ? (k) => k.kind === "group" ? L[k.key] ?? null : null : void 0,
272
+ ghost: p,
273
+ resizeWidth: g ? void 0 : (k, P) => {
274
+ k.kind !== "field" && k.kind !== "slot" || N(
275
+ [
276
+ {
277
+ op: "update_placement",
278
+ at: { field: k.field, group_key: k.group_key },
279
+ patch: { col_span: P === 12 ? null : P }
280
+ }
281
+ ],
282
+ { label: `Set the width to ${Hr[P] ?? P}` }
283
+ );
284
+ }
265
285
  }),
266
286
  [
267
- o,
268
- ce,
287
+ n,
288
+ ye,
269
289
  t,
270
- T,
290
+ E,
271
291
  M.inherited,
272
- _,
273
- W,
274
- D,
275
- u,
276
- pe,
277
- C,
278
- J,
279
- $,
280
- me,
281
- ne,
292
+ K,
293
+ Y,
294
+ B,
295
+ c,
296
+ he,
297
+ O,
298
+ te,
299
+ V,
300
+ ve,
301
+ ce,
282
302
  y,
283
303
  L,
284
- p
304
+ p,
305
+ N,
306
+ g
285
307
  ]
286
- ), x = Br(c);
287
- return /* @__PURE__ */ n("div", { ref: x, className: "flex min-h-full flex-col", children: /* @__PURE__ */ n(
288
- Tr,
308
+ ), T = po(u);
309
+ return /* @__PURE__ */ o("div", { ref: T, className: "flex min-h-full flex-col", children: /* @__PURE__ */ o(
310
+ Zr,
289
311
  {
290
312
  collection: r,
291
- bundle: oe,
292
- layout: we,
293
- record: G,
313
+ bundle: ie,
314
+ layout: Te,
315
+ record: Q,
294
316
  stateKey: m,
295
- design: be,
296
- apply: O,
297
- whenIdle: ke
317
+ roleId: i,
318
+ design: Ae,
319
+ apply: N,
320
+ whenIdle: Ce
298
321
  }
299
322
  ) });
300
323
  }
301
- function en({
324
+ function Pn({
302
325
  collection: r,
303
326
  name: l,
304
327
  row: s,
305
328
  layoutId: i,
306
329
  rows: m,
307
330
  fields: d,
308
- onDone: u
331
+ onDone: c
309
332
  }) {
310
- const h = mo(r, d, m), { data: p } = fo(r, s, m), c = _o(qo(i).data), g = s ? s.section === "forms" && (s.reason.kind === "default" || s.reason.kind === "fallback") ? [{ text: "used by every record no rule catches" }] : yo(s, d, h) : [];
311
- return g.length > 0 && typeof p == "number" && g.push({ text: ` (≈ ${p.toLocaleString()} ${p === 1 ? "record" : "records"})` }), c && g.push({ text: g.length > 0 ? `; ${c}` : c }), /* @__PURE__ */ v(
333
+ const v = $o(r, d, m), { data: p } = Uo(r, s, m), u = hn(vn(i).data), g = s ? s.section === "forms" && (s.reason.kind === "default" || s.reason.kind === "fallback") ? [{ text: "used by every record no rule catches" }] : zo(s, d, v) : [];
334
+ return g.length > 0 && typeof p == "number" && g.push({ text: ` (≈ ${p.toLocaleString()} ${p === 1 ? "record" : "records"})` }), u && g.push({ text: g.length > 0 ? `; ${u}` : u }), /* @__PURE__ */ h(
312
335
  "div",
313
336
  {
314
337
  "data-editing-banner": "",
315
338
  className: "flex shrink-0 items-center gap-3 border-b border-nvr-cyan/30 bg-nvr-cyan/10 px-4 py-1.5 text-[12.5px] text-slate-700 dark:text-slate-200",
316
339
  children: [
317
- /* @__PURE__ */ v("p", { className: "m-0 min-w-0 flex-1 truncate", children: [
340
+ /* @__PURE__ */ h("p", { className: "m-0 min-w-0 flex-1 truncate", children: [
318
341
  "Editing ",
319
- /* @__PURE__ */ n("b", { className: "font-semibold text-slate-900 dark:text-foreground", children: l }),
320
- g.length > 0 && /* @__PURE__ */ v(ue, { children: [
342
+ /* @__PURE__ */ o("b", { className: "font-semibold text-slate-900 dark:text-foreground", children: l }),
343
+ g.length > 0 && /* @__PURE__ */ h(de, { children: [
321
344
  " — ",
322
- /* @__PURE__ */ n(ho, { segs: g, muted: !0 })
345
+ /* @__PURE__ */ o(Vo, { segs: g, muted: !0 })
323
346
  ] })
324
347
  ] }),
325
- /* @__PURE__ */ n(
348
+ /* @__PURE__ */ o(
326
349
  "button",
327
350
  {
328
351
  type: "button",
329
- onClick: (G) => u(G.currentTarget),
352
+ onClick: (Q) => c(Q.currentTarget),
330
353
  className: "inline-flex h-7 shrink-0 items-center rounded-md bg-nvr-cyan px-3 text-[12px] font-medium text-white transition-opacity hover:opacity-90",
331
354
  children: "Done"
332
355
  }
@@ -335,482 +358,529 @@ function en({
335
358
  }
336
359
  );
337
360
  }
338
- function tn({ view: r, onView: l }) {
339
- const s = (i, m, d, u) => /* @__PURE__ */ v(
361
+ function En({ view: r, onView: l }) {
362
+ const s = (i, m, d, c) => /* @__PURE__ */ h(
340
363
  "button",
341
364
  {
342
365
  type: "button",
343
366
  "aria-pressed": r === i,
344
367
  "aria-label": m,
345
368
  "data-editor-view": i,
346
- "data-tip": u,
369
+ "data-tip": c,
347
370
  onClick: () => l(i),
348
- className: re(ko(r === i), "inline-flex items-center justify-center gap-1"),
371
+ className: G(jo(r === i), "inline-flex items-center justify-center gap-1"),
349
372
  children: [
350
- /* @__PURE__ */ n(d, { className: "h-3.5 w-3.5 shrink-0" }),
351
- /* @__PURE__ */ n("span", { "data-tb-xwide": "", children: m })
373
+ /* @__PURE__ */ o(d, { className: "h-3.5 w-3.5 shrink-0" }),
374
+ /* @__PURE__ */ o("span", { "data-tb-xwide": "", children: m })
352
375
  ]
353
376
  }
354
377
  );
355
- return /* @__PURE__ */ v(
378
+ return /* @__PURE__ */ h(
356
379
  "fieldset",
357
380
  {
358
381
  "aria-label": "Show the form as",
359
- className: re("m-0 min-w-0 shrink-0 border-0", go(4)),
382
+ className: G("m-0 min-w-0 shrink-0 border-0", Wo(4)),
360
383
  children: [
361
- s("canvas", "Canvas", Vt, "The form as people see it"),
362
- s("table", "Table", jt, "Every field as a row: label, section, width, rules"),
384
+ s("canvas", "Canvas", ir, "The form as people see it"),
385
+ s("table", "Table", lr, "Every field as a row: label, section, width, rules"),
363
386
  s(
364
387
  "states",
365
388
  "States",
366
- zt,
389
+ dr,
367
390
  "Every field by workflow state: editable, read-only, required"
368
391
  ),
369
- s("roles", "Roles", Gt, "Every section by role: can edit, read-only, hidden")
392
+ s("roles", "Roles", cr, "Every section by role: can edit, read-only, hidden")
370
393
  ]
371
394
  }
372
395
  );
373
396
  }
374
- const Ee = (r) => re(
397
+ const qe = (r) => G(
375
398
  "inline-flex h-7 items-center gap-1 rounded-md px-2.5 text-[12px] font-medium transition-colors",
376
399
  r ? "bg-accent text-slate-900 dark:text-foreground" : "text-slate-500 hover:bg-muted hover:text-slate-800 dark:text-muted-foreground dark:hover:text-foreground"
377
400
  );
378
- function Na({
401
+ function us({
379
402
  collection: r,
380
403
  layoutId: l,
381
404
  onBack: s,
382
405
  mode: i,
383
406
  onLayoutChange: m,
384
407
  previewRecordId: d = null,
385
- portalContainer: u,
386
- onDirtyChange: h
408
+ portalContainer: c,
409
+ onDirtyChange: v
387
410
  }) {
388
- var rt, ot, nt;
389
- const p = jr(), [c, g] = P(l);
390
- B(() => g(l), [l]);
391
- const G = Qo(r), { draft: o, recorder: ce } = ur(Uo(c, { onSaved: G })), t = o.bundle, [T, J] = P("layouts"), [$, O] = P("inspector"), [ke, pe] = sr(), [me, ne] = P(null), [y, L] = P([]), Y = y.length > 0 ? y[y.length - 1] : null, [_, ae] = P("canvas"), [fe, oe] = P(!1), [M, H] = Do(), { data: V } = Bo(r, M), we = N(
392
- () => M && V && V.total > 0 ? (e) => V.pct.get(e) ?? null : void 0,
393
- [M, V]
394
- ), [I, W] = P({
411
+ var ct, ut, pt, mt, ft, yt;
412
+ const p = ko(), [u, g] = R(l);
413
+ $(() => g(l), [l]);
414
+ const Q = An(r), { draft: n, recorder: ye } = Lr(gn(u, { onSaved: Q })), t = n.bundle, [E, te] = R("layouts"), [V, N] = R("inspector"), [Ce, he] = Ar(), [ve, ce] = R(null), [y, L] = R([]), re = y.length > 0 ? y[y.length - 1] : null, [K, se] = R("canvas"), [ge, ie] = R(!1), [M, J] = fn(), { data: H } = yn(r, M), Te = S(
415
+ () => M && H && H.total > 0 ? (e) => H.pct.get(e) ?? null : void 0,
416
+ [M, H]
417
+ ), [D, Y] = R({
395
418
  record: d ? { id: d, label: `#${d}` } : null,
396
419
  roleId: null
397
- }), { data: C } = co(r), { data: F = [] } = po(r), D = C == null ? void 0 : C.rows.find((e) => e.layout_id === c), be = (t == null ? void 0 : t.layout.parent_layout_id) != null ? Number(t.layout.parent_layout_id) : null, { data: x = null } = Te(be), { data: S = null } = Jo(r, ((rt = I.record) == null ? void 0 : rt.id) ?? null), j = N(
398
- () => t ? ft(t, x).active : null,
399
- [t, x]
400
- ), Z = eo(r, t, x), { data: ht } = Te(c), Q = mr(t, ht ?? null, o.unsavedCount, c), { data: vt } = Vr(c, t != null), [Ie, gt] = P([]), kt = N(() => {
401
- const e = rr(Ie), a = /* @__PURE__ */ new WeakMap();
420
+ }), { data: O } = Bo(r), { data: _ = [] } = qo(r), B = O == null ? void 0 : O.rows.find((e) => e.layout_id === u), Ae = (t == null ? void 0 : t.layout.parent_layout_id) != null ? Number(t.layout.parent_layout_id) : null, { data: T = null } = Me(Ae), { data: k = null } = Nn(r, ((ct = D.record) == null ? void 0 : ct.id) ?? null), P = S(
421
+ () => t ? Nt(t, T).active : null,
422
+ [t, T]
423
+ ), oe = Ro(r, t, T), { data: Rt } = Me(u), Z = Fr(t, Rt ?? null, n.unsavedCount, u), { data: Lt } = go(u, t != null), [Ue, Pt] = R([]), Et = S(() => {
424
+ const e = xr(Ue), a = /* @__PURE__ */ new WeakMap();
402
425
  return (f) => {
403
- if (!f || !e) return lt(f, e);
404
- const k = a.get(f);
405
- if (k) return k;
406
- const K = lt(f, e);
407
- return a.set(f, K), K;
426
+ if (!f || !e) return kt(f, e);
427
+ const b = a.get(f);
428
+ if (b) return b;
429
+ const I = kt(f, e);
430
+ return a.set(f, I), I;
408
431
  };
409
- }, [Ie]), [se, wt] = Ir(), ye = _r(r, j, se), ie = qr(r, j, se && !I.record), { data: xe } = Te(c), E = dt(xe == null ? void 0 : xe.layout) ?? dt(t == null ? void 0 : t.layout), [le, Se] = P({ reason: "", ticket: "" }), [Fe, Me] = P(null), De = z(le);
410
- De.current = le;
411
- const Be = b(async () => {
412
- const e = E ? yr(De.current) : void 0;
413
- await o.save(e);
414
- const a = o.unsavedOps().length === 0;
415
- return a && e && Se((f) => ({ ...f, reason: "" })), a;
416
- }, [o.save, o.unsavedOps, E]), _e = b(() => {
432
+ }, [Ue]), [ue, Ft] = io(), ke = mo(r, P, ue), pe = fo(r, P, ue && !D.record), { data: le } = Me(u), X = yr(((ut = le == null ? void 0 : le.layout) == null ? void 0 : ut.conditions) ?? ((pt = t == null ? void 0 : t.layout) == null ? void 0 : pt.conditions)), F = bt(le == null ? void 0 : le.layout) ?? bt(t == null ? void 0 : t.layout) ?? (X ? "note" : null), [me, Ne] = R({ reason: "", ticket: "" }), [ze, Ve] = R(null), Oe = j(me);
433
+ Oe.current = me;
434
+ const He = C(async () => {
435
+ const e = F ? {
436
+ ...Kr(Oe.current),
437
+ ...X ? { freeze_override: Oe.current.reason.trim() } : {}
438
+ } : void 0;
439
+ await n.save(e);
440
+ const a = n.unsavedOps().length === 0;
441
+ return a && e && Ne((f) => ({ ...f, reason: "" })), a;
442
+ }, [n.save, n.unsavedOps, F, X]), We = C(() => {
417
443
  var e, a;
418
- return E ? (o.unsavedOps().length > 0 && Me(
419
- ((e = q.current) == null ? void 0 : e.querySelector("[data-editor-save]")) ?? ((a = q.current) == null ? void 0 : a.querySelector("[data-editor-topbar]")) ?? null
420
- ), Promise.resolve()) : o.save();
421
- }, [E, o.save, o.unsavedOps]);
422
- B(() => {
423
- E && o.autosave && o.setAutosave(!1);
424
- }, [E, o.autosave, o.setAutosave]);
425
- const bt = E ? { ...o, save: _e, setAutosave: void 0 } : o;
426
- Go(E ? { ...o, save: _e } : o), Wo(o);
427
- const q = z(null), [xt, qe] = P(null), Ue = z(o.dirty);
428
- Ue.current = o.dirty;
429
- const X = b((e, a, f) => {
430
- var K, de;
431
- if (!Ue.current) return a();
432
- const k = ((K = q.current) == null ? void 0 : K.querySelector("[data-editor-save]")) ?? ((de = q.current) == null ? void 0 : de.querySelector("[data-editor-topbar]")) ?? null;
433
- qe({ what: e, go: a, anchor: f ?? k });
434
- }, []), St = Be;
435
- Yo(o.dirty, (e, a) => X("leave this page", e, a)), B(() => {
436
- h == null || h(o.dirty);
437
- }, [o.dirty, h]);
438
- const $e = z(o.unsavedOps);
439
- $e.current = o.unsavedOps, B(
444
+ return F ? (n.unsavedOps().length > 0 && Ve(
445
+ ((e = U.current) == null ? void 0 : e.querySelector("[data-editor-save]")) ?? ((a = U.current) == null ? void 0 : a.querySelector("[data-editor-topbar]")) ?? null
446
+ ), Promise.resolve()) : n.save();
447
+ }, [F, n.save, n.unsavedOps]);
448
+ $(() => {
449
+ F && n.autosave && n.setAutosave(!1);
450
+ }, [F, n.autosave, n.setAutosave]);
451
+ const It = F ? { ...n, save: We, setAutosave: void 0 } : n;
452
+ Sn(F ? { ...n, save: We } : n), Tn(n);
453
+ const U = j(null), [Kt, je] = R(null), Ge = j(n.dirty);
454
+ Ge.current = n.dirty;
455
+ const ne = C((e, a, f) => {
456
+ var I, fe;
457
+ if (!Ge.current) return a();
458
+ const b = ((I = U.current) == null ? void 0 : I.querySelector("[data-editor-save]")) ?? ((fe = U.current) == null ? void 0 : fe.querySelector("[data-editor-topbar]")) ?? null;
459
+ je({ what: e, go: a, anchor: f ?? b });
460
+ }, []), Dt = He;
461
+ On(n.dirty, (e, a) => ne("leave this page", e, a)), $(() => {
462
+ v == null || v(n.dirty);
463
+ }, [n.dirty, v]);
464
+ const Qe = j(n.unsavedOps);
465
+ Qe.current = n.unsavedOps, $(
440
466
  () => () => {
441
- $e.current().length > 0 && st.warning("Unsaved form changes kept — open the form again to save or discard them");
467
+ Qe.current().length > 0 && vt.warning("Unsaved form changes kept — open the form again to save or discard them");
442
468
  },
443
469
  []
444
470
  );
445
- const Ve = yt(r), je = b(() => {
446
- const e = o.whenIdle();
447
- e.then(() => Ve()), s(e);
448
- }, [o.whenIdle, Ve, s]), Ce = b(
449
- (e) => X(i === "overlay" ? "go back to the record" : "leave this form", je, e),
450
- [X, je, i]
471
+ const Je = Ot(r), Ye = C(() => {
472
+ const e = n.whenIdle();
473
+ e.then(() => Je()), s(e);
474
+ }, [n.whenIdle, Je, s]), Re = C(
475
+ (e) => ne(i === "overlay" ? "go back to the record" : "leave this form", Ye, e),
476
+ [ne, Ye, i]
451
477
  );
452
- B(() => {
478
+ $(() => {
453
479
  if (!t || y.length === 0) return;
454
- const e = y.filter((a) => Oe(a, t, x));
480
+ const e = y.filter((a) => Be(a, t, T));
455
481
  e.length !== y.length && L(e);
456
- }, [y, t, x]);
457
- const ee = i === "overlay", [Re, Ct] = P(null), Ae = z(!1), Rt = b((e) => {
458
- Ae.current = e;
459
- }, []), At = Zo(ee && Re != null, () => Ce(), Ae), R = b((e, a) => {
460
- L((f) => Cr(f, e, a)), O("inspector");
461
- }, []), ze = b((e) => L([e]), []), Ge = b(
482
+ }, [y, t, T]);
483
+ const ae = i === "overlay", [Le, _t] = R(null), Pe = j(!1), Mt = C((e) => {
484
+ Pe.current = e;
485
+ }, []), Bt = Rn(ae && Le != null, () => Re(), Pe), A = C((e, a) => {
486
+ L((f) => Vr(f, e, a)), N("inspector");
487
+ }, []), Ze = C((e) => L([e]), []), q = ro(t, n.apply), qt = S(() => q.intercept(A), [q.intercept, A]), [Ee, $t] = R(!1), Fe = no(), Ie = S(
488
+ () => ({
489
+ tabOrderActive: q.active,
490
+ startTabOrder: () => {
491
+ se("canvas"), q.start();
492
+ }
493
+ }),
494
+ [q.active, q.start]
495
+ ), Xe = C(
462
496
  (e, a) => {
463
- if (e.kind === "group") return R({ kind: "group", key: e.key });
497
+ if (e.kind === "group") return A({ kind: "group", key: e.key });
464
498
  if (e.kind === "tab") {
465
- R(a), (a.kind === "field" || a.kind === "header") && Wr(a.field, e.tab);
499
+ A(a), (a.kind === "field" || a.kind === "header") && So(a.field, e.tab);
466
500
  return;
467
501
  }
468
502
  if (e.kind === "pipeline")
469
- return X(
503
+ return ne(
470
504
  "open the pipeline",
471
505
  () => p.navigate(`/pipelines/${encodeURIComponent(e.id)}`)
472
506
  );
473
- X(
507
+ ne(
474
508
  "open the field rules",
475
509
  () => p.navigate(`/data-model/${encodeURIComponent(r)}?tab=rules`)
476
510
  );
477
511
  },
478
- [R, X, p, r]
479
- ), Nt = N(() => {
512
+ [A, ne, p, r]
513
+ ), Ut = S(() => {
480
514
  const e = /* @__PURE__ */ new Map();
481
- for (const [a, f] of ie)
515
+ for (const [a, f] of pe)
482
516
  (f.type === "boolean" || f.text.endsWith(" linked")) && e.set(a, f.text);
483
- return Fr(ye, { chips: se, ghostTags: e, open: Ge });
484
- }, [ye, se, ie, Ge]), Lt = N(
485
- () => ie.size > 0 ? (e) => {
517
+ return lo(ke, { chips: ue, ghostTags: e, open: Xe });
518
+ }, [ke, ue, pe, Xe]), zt = S(
519
+ () => pe.size > 0 ? (e) => {
486
520
  var a;
487
- return ((a = ie.get(e)) == null ? void 0 : a.text) ?? null;
521
+ return ((a = pe.get(e)) == null ? void 0 : a.text) ?? null;
488
522
  } : void 0,
489
- [ie]
490
- ), Pt = b(
523
+ [pe]
524
+ ), Vt = C(
491
525
  (e) => {
492
- const a = t == null ? void 0 : t.placements.find((k) => k.field === e);
526
+ const a = t == null ? void 0 : t.placements.find((b) => b.field === e);
493
527
  if (!a) return;
494
- const f = a.group_key === mt ? { kind: "header", field: e } : { kind: "field", field: e, group_key: a.group_key };
495
- R(f), requestAnimationFrame(
528
+ const f = a.group_key === At ? { kind: "header", field: e } : { kind: "field", field: e, group_key: a.group_key };
529
+ A(f), requestAnimationFrame(
496
530
  () => {
497
- var k, K;
498
- return (K = (k = document.querySelector(`[data-layout-editor] [data-design-target="${CSS.escape(U(f))}"]`)) == null ? void 0 : k.scrollIntoView) == null ? void 0 : K.call(k, { block: "center" });
531
+ var b, I;
532
+ return (I = (b = document.querySelector(`[data-layout-editor] [data-design-target="${CSS.escape(z(f))}"]`)) == null ? void 0 : b.scrollIntoView) == null ? void 0 : I.call(b, { block: "center" });
499
533
  }
500
534
  );
501
535
  },
502
- [t, R]
536
+ [t, A]
503
537
  );
504
- Ho(t, y, o.apply, Ae, ze);
505
- const Ne = wo(c, Y ? U(Y) : null), He = N(() => bo(Ne), [Ne]), Tt = b(
506
- (e) => (He.get(U(e)) ?? []).map((a) => ({
538
+ Cn(t, y, n.apply, Pe, Ze);
539
+ const Ke = Go(u, re ? z(re) : null), et = S(() => Qo(Ke), [Ke]), Ht = C(
540
+ (e) => (et.get(z(e)) ?? []).map((a) => ({
507
541
  id: a.id,
508
542
  name: a.name,
509
543
  outline: a.tone.outline,
510
544
  chip: a.tone.chip
511
545
  })),
512
- [He]
513
- ), We = N(() => Fo(o.unsavedSteps), [o.unsavedSteps]), Ot = b((e) => We.has(U(e)), [We]), [Qe, he] = P(null), Je = b((e) => {
514
- ae("canvas"), L([e]), O("inspector"), requestAnimationFrame(() => {
546
+ [et]
547
+ ), tt = S(() => pn(n.unsavedSteps), [n.unsavedSteps]), Wt = C((e) => tt.has(z(e)), [tt]), [rt, be] = R(null), ot = C((e) => {
548
+ se("canvas"), L([e]), N("inspector"), requestAnimationFrame(() => {
515
549
  var f;
516
550
  const a = document.querySelector(
517
- `[data-layout-editor] [data-design-target="${CSS.escape(U(e))}"]`
551
+ `[data-layout-editor] [data-design-target="${CSS.escape(z(e))}"]`
518
552
  );
519
553
  (f = a == null ? void 0 : a.scrollIntoView) == null || f.call(a, { block: "center" }), a == null || a.focus({ preventScroll: !0 });
520
554
  });
521
- }, []), Et = Yt(), Le = Lr(o, c, Et), Kt = b(
522
- (e) => W((a) => a.roleId === e ? a : { ...a, roleId: e }),
555
+ }, []), jt = vr(), W = an(u), nt = sn(), Gt = S(
556
+ () => {
557
+ var e, a;
558
+ return {
559
+ settled: W.isFetched || W.isError,
560
+ draft: ((e = W.data) == null ? void 0 : e.data) ?? null,
561
+ available: ((a = W.data) == null ? void 0 : a.available) ?? !W.isError,
562
+ writer: nt
563
+ };
564
+ },
565
+ [W.isFetched, W.isError, W.data, nt]
566
+ ), we = Qr(n, u, jt, Gt), Qt = C(
567
+ (e) => Y((a) => a.roleId === e ? a : { ...a, roleId: e }),
523
568
  []
524
- ), te = (e) => {
525
- var k;
526
- if (O("inspector"), e === c) return;
527
- const a = document.activeElement, f = a instanceof HTMLElement && ((k = q.current) != null && k.contains(a)) ? a : null;
528
- X(
569
+ ), ee = (e) => {
570
+ var b;
571
+ if (N("inspector"), e === u) return;
572
+ const a = document.activeElement, f = a instanceof HTMLElement && ((b = U.current) != null && b.contains(a)) ? a : null;
573
+ ne(
529
574
  "open another form",
530
575
  () => {
531
- o.flush(), L([]), g(e), m == null || m(e);
576
+ n.flush(), L([]), g(e), m == null || m(e);
532
577
  },
533
578
  f
534
579
  );
535
- }, It = Ro(r, t, (C == null ? void 0 : C.rows) ?? [], te), Ft = b(
536
- (e) => t ? ir(e, {
580
+ }, Jt = Xo(r, t, (O == null ? void 0 : O.rows) ?? [], ee), Yt = C(
581
+ (e) => t ? Nr(e, {
537
582
  bundle: t,
538
583
  selection: y,
539
584
  select: (a) => {
540
- L([a]), O("inspector");
585
+ L([a]), N("inspector");
541
586
  },
542
- openSettings: () => O("settings"),
543
- openAddPanel: () => J("add"),
544
- root: q.current
587
+ openSettings: () => N("settings"),
588
+ openAddPanel: () => te("add"),
589
+ root: U.current
545
590
  }) : Promise.resolve({ ok: !1, message: "The form is still loading" }),
546
591
  [t, y]
547
- ), Ye = z(te);
548
- Ye.current = te;
549
- const Mt = b(
592
+ ), at = j(ee);
593
+ at.current = ee;
594
+ const Zt = C(
550
595
  (e) => {
551
596
  if (e.kind === "record")
552
- W((a) => ({ ...a, record: { id: e.id, label: `#${e.id}` } }));
553
- else if (e.kind === "layout") Ye.current(e.id);
597
+ Y((a) => ({ ...a, record: { id: e.id, label: `#${e.id}` } }));
598
+ else if (e.kind === "layout") at.current(e.id);
554
599
  else {
555
- const a = t == null ? void 0 : t.placements.find((k) => k.field === e.field);
556
- if (!a) return st.info(`${e.label} is not on this form`);
600
+ const a = t == null ? void 0 : t.placements.find((b) => b.field === e.field);
601
+ if (!a) return vt.info(`${e.label} is not on this form`);
557
602
  const f = { kind: "field", field: a.field, group_key: a.group_key };
558
- R(f), requestAnimationFrame(
603
+ A(f), requestAnimationFrame(
559
604
  () => {
560
- var k, K, de;
561
- return (de = (K = (k = q.current) == null ? void 0 : k.querySelector(`[data-design-target="${CSS.escape(U(f))}"]`)) == null ? void 0 : K.scrollIntoView) == null ? void 0 : de.call(K, { block: "center" });
605
+ var b, I, fe;
606
+ return (fe = (I = (b = U.current) == null ? void 0 : b.querySelector(`[data-design-target="${CSS.escape(z(f))}"]`)) == null ? void 0 : I.scrollIntoView) == null ? void 0 : fe.call(I, { block: "center" });
562
607
  }
563
608
  );
564
609
  }
565
610
  },
566
- [t, R]
567
- ), ve = String((t == null ? void 0 : t.layout.name) ?? (D == null ? void 0 : D.name) ?? ""), Pe = String((t == null ? void 0 : t.layout.layout_type) ?? (D == null ? void 0 : D.layout_type) ?? "grouped"), A = Pe !== "table" && Pe !== "file", w = lo({
568
- bodyRef: q,
611
+ [t, A]
612
+ ), xe = String((t == null ? void 0 : t.layout.name) ?? (B == null ? void 0 : B.name) ?? ""), De = String((t == null ? void 0 : t.layout.layout_type) ?? (B == null ? void 0 : B.layout_type) ?? "grouped"), w = De !== "table" && De !== "file", x = _o({
613
+ bodyRef: U,
569
614
  bundle: t,
570
- parent: x,
571
- fields: F,
572
- onSelect: R,
573
- showHidden: fe,
574
- setShowHidden: oe,
575
- canvasShown: !(A && _ === "table")
576
- }), Ze = w.outlineOpen && !!t && A, Xe = p.warning ?? (C == null ? void 0 : C.warning) ?? null, Dt = ee ? {
615
+ parent: T,
616
+ fields: _,
617
+ onSelect: A,
618
+ showHidden: ge,
619
+ setShowHidden: ie,
620
+ canvasShown: !(w && K === "table")
621
+ }), st = x.outlineOpen && !!t && w, it = p.warning ?? (O == null ? void 0 : O.warning) ?? null, Xt = ae ? {
577
622
  role: "dialog",
578
623
  "aria-modal": !0,
579
- "aria-label": `Edit form ${ve}`,
624
+ "aria-label": `Edit form ${xe}`,
580
625
  tabIndex: -1
581
- } : {}, et = /* @__PURE__ */ v(
626
+ } : {}, lt = /* @__PURE__ */ h(
582
627
  "div",
583
628
  {
584
629
  ref: (e) => {
585
- q.current = e, ee && (At.current = e);
630
+ U.current = e, ae && (Bt.current = e);
586
631
  },
587
632
  "data-layout-editor": "",
588
633
  "data-mode": i,
589
- ...Dt,
590
- className: re(
634
+ ...Xt,
635
+ className: G(
591
636
  "flex min-h-0 flex-col bg-slate-50 outline-none dark:bg-background",
592
- ee ? "fixed inset-0 z-[90]" : "flex-1"
637
+ ae ? "fixed inset-0 z-[90]" : "flex-1"
593
638
  ),
594
639
  children: [
595
- /* @__PURE__ */ n(
596
- Or,
640
+ /* @__PURE__ */ o(
641
+ Xr,
597
642
  {
598
643
  collection: r,
599
- layoutId: c,
600
- layoutName: ve,
601
- layoutType: Pe,
602
- row: D,
603
- fields: F,
604
- draft: bt,
605
- preview: I,
606
- onPreview: W,
607
- showHidden: fe,
608
- onShowHidden: oe,
609
- onBack: Ce,
610
- backLabel: ee ? "Back to record" : "Forms",
611
- onShowOnCanvas: Q.showVersion,
612
- onReviewChanges: Q.toggleReview,
613
- reviewing: ((ot = Q.compare) == null ? void 0 : ot.kind) === "unsaved",
614
- onOpenUnsaved: he,
615
- presence: /* @__PURE__ */ n(
616
- kr,
617
- {
618
- peers: Ne,
619
- describe: (e) => {
620
- const a = ct(e);
621
- return a && t && Oe(a, t, x) ? pt(a, t, F) : null;
622
- },
623
- onJump: (e) => {
624
- const a = ct(e);
625
- a && Je(a);
644
+ layoutId: u,
645
+ layoutName: xe,
646
+ layoutType: De,
647
+ row: B,
648
+ fields: _,
649
+ draft: It,
650
+ preview: D,
651
+ onPreview: Y,
652
+ showHidden: ge,
653
+ onShowHidden: ie,
654
+ onBack: Re,
655
+ backLabel: ae ? "Back to record" : "Forms",
656
+ onShowOnCanvas: Z.showVersion,
657
+ onReviewChanges: Z.toggleReview,
658
+ reviewing: ((mt = Z.compare) == null ? void 0 : mt.kind) === "unsaved",
659
+ onOpenUnsaved: be,
660
+ pendingTip: Jr(we.sync),
661
+ presence: /* @__PURE__ */ h(de, { children: [
662
+ /* @__PURE__ */ o(
663
+ Br,
664
+ {
665
+ peers: Ke,
666
+ describe: (e) => {
667
+ const a = St(e);
668
+ return a && t && Be(a, t, T) ? Ct(a, t, _) : null;
669
+ },
670
+ onJump: (e) => {
671
+ const a = St(e);
672
+ a && ot(a);
673
+ }
626
674
  }
627
- }
628
- ),
675
+ ),
676
+ /* @__PURE__ */ o(en, { others: ((ft = W.data) == null ? void 0 : ft.others) ?? [] })
677
+ ] }),
629
678
  onSelectField: (e) => {
630
679
  var a;
631
- return R({
680
+ return A({
632
681
  kind: "field",
633
682
  field: e,
634
683
  group_key: ((a = t == null ? void 0 : t.placements.find((f) => f.field === e)) == null ? void 0 : a.group_key) ?? null
635
684
  });
636
685
  },
637
- view: t && A ? /* @__PURE__ */ v(ue, { children: [
638
- /* @__PURE__ */ n(tn, { view: _, onView: ae }),
639
- /* @__PURE__ */ n(Mr, { on: se, onChange: wt })
686
+ view: t && w ? /* @__PURE__ */ h(de, { children: [
687
+ /* @__PURE__ */ o(En, { view: K, onView: se }),
688
+ /* @__PURE__ */ o(co, { on: ue, onChange: Ft })
640
689
  ] }) : null,
641
- tools: /* @__PURE__ */ v(ue, { children: [
642
- t && A && /* @__PURE__ */ n(er, { bundle: t, apply: o.apply }),
643
- t && /* @__PURE__ */ n(oo, { find: w.find }),
644
- t && A && /* @__PURE__ */ n(Ur, { bundle: t, apply: o.apply, collection: r }),
645
- /* @__PURE__ */ n(ge, {}),
646
- t && /* @__PURE__ */ n(
647
- no,
690
+ tools: /* @__PURE__ */ h(de, { children: [
691
+ t && w && /* @__PURE__ */ o(br, { bundle: t, apply: n.apply }),
692
+ t && /* @__PURE__ */ o(Eo, { find: x.find }),
693
+ t && w && /* @__PURE__ */ o(yo, { bundle: t, apply: n.apply, collection: r }),
694
+ t && w && /* @__PURE__ */ o(ho, { bundle: t, apply: n.apply, collection: r }),
695
+ /* @__PURE__ */ o(Se, {}),
696
+ t && /* @__PURE__ */ o(
697
+ Fo,
648
698
  {
649
- outline: A ? {
650
- open: w.outlineOpen,
651
- onToggle: () => w.setOutlineOpen(!w.outlineOpen)
699
+ outline: w ? {
700
+ open: x.outlineOpen,
701
+ onToggle: () => x.setOutlineOpen(!x.outlineOpen)
652
702
  } : null
653
703
  }
654
704
  ),
655
- t && /* @__PURE__ */ n(
656
- ao,
705
+ t && /* @__PURE__ */ o(
706
+ Io,
657
707
  {
658
- view: A && _ === "canvas" ? {
659
- compact: w.compact,
660
- onCompact: w.setCompact,
661
- onExpandAll: w.expandAll,
662
- onCollapseAll: w.collapseAll
708
+ view: w && K === "canvas" ? {
709
+ compact: x.compact,
710
+ onCompact: x.setCompact,
711
+ onExpandAll: x.expandAll,
712
+ onCollapseAll: x.collapseAll
663
713
  } : null
664
714
  }
665
715
  ),
666
- t && A && /* @__PURE__ */ n(
667
- Eo,
716
+ t && w && /* @__PURE__ */ o(
717
+ xt,
668
718
  {
669
719
  label: "Show how full each field is",
670
- icon: /* @__PURE__ */ n(qt, { className: "h-3.5 w-3.5" }),
720
+ icon: /* @__PURE__ */ o(rr, { className: "h-3.5 w-3.5" }),
671
721
  hint: "The share of records with a value, on each field",
672
722
  checked: M,
673
- onClick: () => H(!M),
723
+ onClick: () => J(!M),
674
724
  data: { "data-editor-fill-toggle": "" }
675
725
  }
676
726
  ),
677
- /* @__PURE__ */ n(ge, {}),
678
- /* @__PURE__ */ n(
679
- dr,
727
+ t && w && /* @__PURE__ */ o(
728
+ xt,
729
+ {
730
+ label: "Set the tab order",
731
+ icon: /* @__PURE__ */ o(or, { className: "h-3.5 w-3.5" }),
732
+ hint: "Click fields in the order Tab should visit them",
733
+ checked: q.active,
734
+ onClick: () => q.active ? q.cancel() : Ie.startTabOrder(),
735
+ data: { "data-editor-tab-order-toggle": "" }
736
+ }
737
+ ),
738
+ t && w && /* @__PURE__ */ o(
739
+ ao,
740
+ {
741
+ on: Ee,
742
+ onChange: $t,
743
+ appDark: Fe,
744
+ disabled: K !== "canvas"
745
+ }
746
+ ),
747
+ /* @__PURE__ */ o(Se, {}),
748
+ /* @__PURE__ */ o(
749
+ Rr,
680
750
  {
681
751
  collection: r,
682
- layoutId: c,
683
- dirty: o.dirty,
684
- recorder: ce
752
+ layoutId: u,
753
+ dirty: n.dirty,
754
+ recorder: ye
685
755
  }
686
756
  ),
687
- /* @__PURE__ */ n($r, { bundle: t, collection: r }),
688
- /* @__PURE__ */ n(ge, {}),
689
- t && /* @__PURE__ */ n(so, { shortcuts: w.shortcuts })
757
+ /* @__PURE__ */ o(vo, { bundle: t, collection: r }),
758
+ /* @__PURE__ */ o(Se, {}),
759
+ t && /* @__PURE__ */ o(Ko, { shortcuts: x.shortcuts })
690
760
  ] }),
691
- ai: /* @__PURE__ */ v(ue, { children: [
692
- t && A && /* @__PURE__ */ n(
693
- or,
761
+ ai: /* @__PURE__ */ h(de, { children: [
762
+ t && w && /* @__PURE__ */ o(
763
+ Sr,
694
764
  {
695
765
  collection: r,
696
- layoutId: c,
697
- draft: o,
698
- onOpenLayout: te
766
+ layoutId: u,
767
+ draft: n,
768
+ onOpenLayout: ee
699
769
  }
700
770
  ),
701
- t && /* @__PURE__ */ n(
702
- tr,
771
+ t && /* @__PURE__ */ o(
772
+ wr,
703
773
  {
704
774
  collection: r,
705
- layoutId: c,
775
+ layoutId: u,
706
776
  bundle: t,
707
- apply: o.apply,
708
- previewRecordShown: I.record != null,
709
- onPins: gt,
710
- onSelect: R
777
+ apply: n.apply,
778
+ previewRecordShown: D.record != null,
779
+ onPins: Pt,
780
+ onSelect: A
711
781
  }
712
782
  ),
713
- /* @__PURE__ */ n(ge, {}),
714
- t && p.isAdmin && /* @__PURE__ */ n(
715
- nr,
783
+ /* @__PURE__ */ o(Se, {}),
784
+ t && p.isAdmin && /* @__PURE__ */ o(
785
+ Cr,
716
786
  {
717
- active: $ === "ask",
718
- onClick: () => O((e) => e === "ask" ? "inspector" : "ask")
787
+ active: V === "ask",
788
+ onClick: () => N((e) => e === "ask" ? "inspector" : "ask")
719
789
  }
720
790
  ),
721
- /* @__PURE__ */ n(Sr, { collection: r, layoutId: c, draft: o }),
722
- t && /* @__PURE__ */ n(lr, { layoutId: c, draft: o })
791
+ /* @__PURE__ */ o(zr, { collection: r, layoutId: u, draft: n }),
792
+ t && /* @__PURE__ */ o(Or, { layoutId: u, draft: n })
723
793
  ] }),
724
- testing: t ? /* @__PURE__ */ n(
725
- Oo,
794
+ testing: t ? /* @__PURE__ */ o(
795
+ dn,
726
796
  {
727
797
  collection: r,
728
- layoutId: c,
798
+ layoutId: u,
729
799
  bundle: t,
730
- parent: x,
731
- apply: o.apply,
732
- dirty: o.dirty,
733
- fields: F
800
+ parent: T,
801
+ apply: n.apply,
802
+ dirty: n.dirty,
803
+ fields: _
734
804
  }
735
805
  ) : null,
736
- beforeSave: t ? /* @__PURE__ */ n(
737
- To,
806
+ beforeSave: t ? /* @__PURE__ */ o(
807
+ ln,
738
808
  {
739
809
  collection: r,
740
- layoutId: c,
810
+ layoutId: u,
741
811
  bundle: t,
742
- parent: x,
743
- apply: o.apply,
744
- dirty: o.dirty,
745
- fields: F
812
+ parent: T,
813
+ apply: n.apply,
814
+ dirty: n.dirty,
815
+ fields: _
746
816
  }
747
817
  ) : null,
748
- previewExtra: /* @__PURE__ */ n(
749
- xo,
818
+ previewExtra: /* @__PURE__ */ o(
819
+ Jo,
750
820
  {
751
821
  collection: r,
752
- value: I,
753
- onChange: W,
754
- layout: j,
755
- fields: F
822
+ value: D,
823
+ onChange: Y,
824
+ layout: P,
825
+ fields: _
756
826
  }
757
827
  ),
758
- problems: t && /* @__PURE__ */ n(
759
- Zr,
828
+ problems: t && /* @__PURE__ */ o(
829
+ No,
760
830
  {
761
- findings: Z.findings,
762
- active: $ === "checks",
763
- onClick: () => O((e) => e === "checks" ? "inspector" : "checks")
831
+ findings: oe.findings,
832
+ active: V === "checks",
833
+ onClick: () => N((e) => e === "checks" ? "inspector" : "checks")
764
834
  }
765
835
  ),
766
- more: /* @__PURE__ */ n(
767
- Co,
836
+ more: /* @__PURE__ */ o(
837
+ Zo,
768
838
  {
769
839
  collection: r,
770
840
  bundle: t,
771
- previewRecord: I.record,
772
- onOpenLayout: te
841
+ previewRecord: D.record,
842
+ onOpenLayout: ee
773
843
  }
774
844
  )
775
845
  }
776
846
  ),
777
- ee && /* @__PURE__ */ n(
778
- en,
847
+ ae && /* @__PURE__ */ o(
848
+ Pn,
779
849
  {
780
850
  collection: r,
781
- layoutId: c,
782
- name: ve,
783
- row: D,
784
- rows: (C == null ? void 0 : C.rows) ?? [],
785
- fields: F,
786
- onDone: Ce
851
+ layoutId: u,
852
+ name: xe,
853
+ row: B,
854
+ rows: (O == null ? void 0 : O.rows) ?? [],
855
+ fields: _,
856
+ onDone: Re
787
857
  }
788
858
  ),
789
- o.status === "conflict" && o.dirty && /* @__PURE__ */ v(
859
+ n.status === "conflict" && n.dirty && /* @__PURE__ */ h(
790
860
  "div",
791
861
  {
792
862
  role: "alert",
793
863
  "data-unsaved-conflict": "",
794
- className: re(
864
+ className: G(
795
865
  "flex shrink-0 items-center gap-3 border-b px-4 py-1.5 text-[12.5px]",
796
- ut
866
+ _e
797
867
  ),
798
868
  children: [
799
- /* @__PURE__ */ n(at, { className: "h-3.5 w-3.5 shrink-0" }),
800
- /* @__PURE__ */ v("p", { className: "m-0 min-w-0 flex-1", children: [
801
- o.error ?? "Someone else saved this form",
869
+ /* @__PURE__ */ o(ht, { className: "h-3.5 w-3.5 shrink-0" }),
870
+ /* @__PURE__ */ h("p", { className: "m-0 min-w-0 flex-1", children: [
871
+ n.error ?? "Someone else saved this form",
802
872
  ". Save again to try once more, or reload their version."
803
873
  ] }),
804
- /* @__PURE__ */ v(
874
+ /* @__PURE__ */ h(
805
875
  "button",
806
876
  {
807
877
  type: "button",
808
878
  "data-unsaved-reload": "",
809
- onClick: o.discard,
879
+ onClick: n.discard,
810
880
  className: "inline-flex h-7 shrink-0 items-center rounded-md border border-amber-300 px-2.5 text-[12px] font-medium hover:bg-amber-100 dark:border-amber-500/40 dark:hover:bg-amber-500/15",
811
881
  children: [
812
882
  "Reload (discard my ",
813
- Ko(o.unsavedCount),
883
+ cn(n.unsavedCount),
814
884
  ")"
815
885
  ]
816
886
  }
@@ -818,95 +888,110 @@ function Na({
818
888
  ]
819
889
  }
820
890
  ),
821
- /* @__PURE__ */ n(wr, { labels: o.dropped, onDismiss: o.clearDropped }),
822
- /* @__PURE__ */ n(
823
- br,
891
+ /* @__PURE__ */ o(qr, { labels: n.dropped, onDismiss: n.clearDropped }),
892
+ /* @__PURE__ */ o(
893
+ $r,
824
894
  {
825
- state: Le.state,
826
- onRecover: Le.recover,
827
- onDismiss: Le.dismiss
895
+ state: we.state,
896
+ onRecover: we.recover,
897
+ onDismiss: we.dismiss
828
898
  }
829
899
  ),
830
- Xe && /* @__PURE__ */ v(
900
+ it && /* @__PURE__ */ h(
831
901
  "div",
832
902
  {
833
903
  role: "note",
834
- className: re(
904
+ className: G(
835
905
  "flex shrink-0 items-center gap-2 border-b px-4 py-1.5 text-[12.5px]",
836
- ut
906
+ _e
837
907
  ),
838
908
  children: [
839
- /* @__PURE__ */ n(at, { className: "h-3.5 w-3.5 shrink-0" }),
840
- Xe
909
+ /* @__PURE__ */ o(ht, { className: "h-3.5 w-3.5 shrink-0" }),
910
+ it
841
911
  ]
842
912
  }
843
913
  ),
844
- /* @__PURE__ */ n(Dr, { explain: ye, onShow: Pt }),
845
- /* @__PURE__ */ n(
846
- Rr,
914
+ X && /* @__PURE__ */ h(
915
+ "div",
916
+ {
917
+ role: "note",
918
+ "data-editor-frozen": X.until,
919
+ className: G(
920
+ "flex shrink-0 items-center gap-2 border-b px-4 py-1.5 text-[12.5px]",
921
+ _e
922
+ ),
923
+ children: [
924
+ /* @__PURE__ */ o(nr, { className: "h-3.5 w-3.5 shrink-0" }),
925
+ Tt(X)
926
+ ]
927
+ }
928
+ ),
929
+ /* @__PURE__ */ o(uo, { explain: ke, onShow: Vt }),
930
+ /* @__PURE__ */ o(
931
+ Wr,
847
932
  {
848
933
  bundle: t,
849
- apply: o.apply,
850
- onDragActive: Rt,
851
- onDropOnLayout: It,
852
- children: /* @__PURE__ */ v("div", { className: "flex min-h-0 flex-1 overflow-hidden", children: [
853
- /* @__PURE__ */ v(
934
+ apply: n.apply,
935
+ onDragActive: Mt,
936
+ onDropOnLayout: Jt,
937
+ children: /* @__PURE__ */ h("div", { className: "flex min-h-0 flex-1 overflow-hidden", children: [
938
+ /* @__PURE__ */ h(
854
939
  "aside",
855
940
  {
856
- className: re(
941
+ className: G(
857
942
  "flex w-[260px] shrink-0 flex-col border-r border-slate-200 bg-white dark:border-border dark:bg-card",
858
- Ze && "hidden"
943
+ st && "hidden"
859
944
  ),
860
945
  children: [
861
- /* @__PURE__ */ v(
946
+ /* @__PURE__ */ h(
862
947
  "div",
863
948
  {
864
949
  role: "tablist",
865
950
  "aria-label": "Left panel",
866
951
  className: "flex shrink-0 items-center gap-1 border-b border-slate-200 px-2 py-1.5 dark:border-border",
867
952
  children: [
868
- /* @__PURE__ */ n(
953
+ /* @__PURE__ */ o(
869
954
  "button",
870
955
  {
871
956
  type: "button",
872
957
  role: "tab",
873
- "aria-selected": T === "layouts",
958
+ "aria-selected": E === "layouts",
874
959
  "data-editor-tab": "layouts",
875
- className: Ee(T === "layouts"),
876
- onClick: () => J("layouts"),
960
+ className: qe(E === "layouts"),
961
+ onClick: () => te("layouts"),
877
962
  children: "Forms"
878
963
  }
879
964
  ),
880
- /* @__PURE__ */ v(
965
+ /* @__PURE__ */ h(
881
966
  "button",
882
967
  {
883
968
  type: "button",
884
969
  role: "tab",
885
- "aria-selected": T === "add",
970
+ "aria-selected": E === "add",
886
971
  "data-editor-tab": "add",
887
- className: Ee(T === "add"),
888
- onClick: () => J("add"),
972
+ className: qe(E === "add"),
973
+ onClick: () => te("add"),
889
974
  disabled: !t,
890
975
  "data-tip": "Add a field, section, panel or widget after the selection",
891
976
  children: [
892
- /* @__PURE__ */ n(Ut, { className: "h-3.5 w-3.5" }),
977
+ /* @__PURE__ */ o(ar, { className: "h-3.5 w-3.5" }),
893
978
  "Add"
894
979
  ]
895
980
  }
896
981
  ),
897
- /* @__PURE__ */ v(
982
+ /* @__PURE__ */ h(
898
983
  "button",
899
984
  {
900
985
  type: "button",
901
986
  role: "tab",
902
- "aria-selected": T === "usage",
987
+ "aria-selected": E === "usage",
903
988
  "data-editor-tab": "usage",
904
- className: Ee(T === "usage"),
905
- onClick: () => J("usage"),
989
+ className: qe(E === "usage"),
990
+ onClick: () => te("usage"),
906
991
  disabled: !t,
907
992
  "data-tip": "How this form is used and where it slows people down",
908
993
  children: [
909
- /* @__PURE__ */ n($t, { className: "h-3.5 w-3.5" }),
994
+ /* @__PURE__ */ o(sr, { className: "h-3.5 w-3.5" }),
910
995
  "Usage"
911
996
  ]
912
997
  }
@@ -914,204 +999,210 @@ function Na({
914
999
  ]
915
1000
  }
916
1001
  ),
917
- /* @__PURE__ */ n("div", { className: "min-h-0 flex-1 overflow-y-auto", children: T === "add" && t ? /* @__PURE__ */ n(
918
- Xt,
1002
+ /* @__PURE__ */ o("div", { className: "min-h-0 flex-1 overflow-y-auto", children: E === "add" && t ? /* @__PURE__ */ o(
1003
+ kr,
919
1004
  {
920
1005
  bundle: t,
921
1006
  collection: r,
922
- selected: Y,
923
- apply: o.apply,
924
- onSelect: R
1007
+ selected: re,
1008
+ apply: n.apply,
1009
+ onSelect: A
925
1010
  }
926
- ) : T === "usage" && t ? /* @__PURE__ */ n(
927
- Mo,
1011
+ ) : E === "usage" && t ? /* @__PURE__ */ o(
1012
+ mn,
928
1013
  {
929
1014
  bundle: t,
930
1015
  collection: r,
931
- fields: F,
932
- apply: o.apply,
1016
+ fields: _,
1017
+ apply: n.apply,
933
1018
  showFill: M,
934
- onShowFill: H
1019
+ onShowFill: J,
1020
+ onOpenLayout: ee
935
1021
  }
936
- ) : /* @__PURE__ */ n(
937
- Yr,
1022
+ ) : /* @__PURE__ */ o(
1023
+ Ao,
938
1024
  {
939
1025
  collection: r,
940
- currentId: c,
941
- onOpen: te,
942
- settingsOpen: $ === "settings",
943
- onSettings: () => O("settings"),
1026
+ currentId: u,
1027
+ onOpen: ee,
1028
+ settingsOpen: V === "settings",
1029
+ onSettings: () => N("settings"),
944
1030
  dropTargets: !0
945
1031
  }
946
1032
  ) })
947
1033
  ]
948
1034
  }
949
1035
  ),
950
- Ze && t && /* @__PURE__ */ n(
1036
+ st && t && /* @__PURE__ */ o(
951
1037
  "aside",
952
1038
  {
953
1039
  "data-editor-outline-panel": "",
954
1040
  className: "flex w-[260px] shrink-0 flex-col border-r border-slate-200 bg-white dark:border-border dark:bg-card",
955
- children: /* @__PURE__ */ n(
956
- io,
1041
+ children: /* @__PURE__ */ o(
1042
+ Do,
957
1043
  {
958
1044
  bundle: t,
959
- nodes: w.nodes,
1045
+ nodes: x.nodes,
960
1046
  selection: y,
961
- onPick: w.selectAndReveal,
962
- onMoved: ze,
963
- apply: o.apply,
964
- onClose: () => w.setOutlineOpen(!1)
1047
+ onPick: x.selectAndReveal,
1048
+ onMoved: Ze,
1049
+ apply: n.apply,
1050
+ onClose: () => x.setOutlineOpen(!1)
965
1051
  }
966
1052
  )
967
1053
  }
968
1054
  ),
969
- /* @__PURE__ */ v("main", { className: "min-w-0 flex-1 overflow-y-auto", children: [
970
- Q.compare && (_ === "canvas" || !A) && /* @__PURE__ */ n(fr, { compare: Q.compare, onClose: Q.close }),
971
- t && A && _ === "states" ? /* @__PURE__ */ n(
972
- to,
1055
+ /* @__PURE__ */ h("main", { className: "min-w-0 flex-1 overflow-y-auto", children: [
1056
+ K === "canvas" && /* @__PURE__ */ o(oo, { editor: q }),
1057
+ Z.compare && (K === "canvas" || !w) && /* @__PURE__ */ o(Ir, { compare: Z.compare, onClose: Z.close }),
1058
+ t && w && K === "states" ? /* @__PURE__ */ o(
1059
+ Lo,
973
1060
  {
974
1061
  bundle: t,
975
- parent: x,
1062
+ parent: T,
976
1063
  collection: r,
977
- apply: o.apply,
978
- onSelect: R
1064
+ apply: n.apply,
1065
+ onSelect: A
979
1066
  }
980
- ) : t && A && _ === "roles" ? /* @__PURE__ */ n(
981
- ro,
1067
+ ) : t && w && K === "roles" ? /* @__PURE__ */ o(
1068
+ Po,
982
1069
  {
983
1070
  bundle: t,
984
- parent: x,
985
- apply: o.apply,
986
- onSelect: R
1071
+ parent: T,
1072
+ apply: n.apply,
1073
+ onSelect: A
987
1074
  }
988
- ) : t && A && _ === "table" ? /* @__PURE__ */ n(
989
- vo,
1075
+ ) : t && w && K === "table" ? /* @__PURE__ */ o(
1076
+ Ho,
990
1077
  {
991
1078
  bundle: t,
992
1079
  collection: r,
993
- apply: o.apply,
994
- flush: o.flush,
1080
+ apply: n.apply,
1081
+ flush: n.flush,
995
1082
  selection: y,
996
- onSelect: R,
1083
+ onSelect: A,
997
1084
  onSelection: L
998
1085
  }
999
- ) : t ? /* @__PURE__ */ n(
1086
+ ) : t ? /* @__PURE__ */ o(
1000
1087
  "div",
1001
1088
  {
1002
- "data-canvas-density": w.compact && A ? "compact" : "normal",
1003
- style: w.compact && A ? { zoom: uo } : void 0,
1004
- className: "min-h-full",
1005
- children: /* @__PURE__ */ n(
1006
- So,
1089
+ "data-canvas-density": x.compact && w ? "compact" : "normal",
1090
+ style: x.compact && w ? { zoom: Mo } : void 0,
1091
+ className: G(
1092
+ "min-h-full",
1093
+ so(Ee, Fe),
1094
+ Ee && !Fe && "bg-background text-foreground"
1095
+ ),
1096
+ children: /* @__PURE__ */ o(
1097
+ Yo,
1007
1098
  {
1008
1099
  collection: r,
1009
1100
  bundle: t,
1010
- parent: x,
1011
- preview: I,
1012
- onPreview: W,
1013
- record: S,
1014
- fields: F,
1015
- renderPane: (e) => /* @__PURE__ */ n(
1016
- Xo,
1101
+ parent: T,
1102
+ preview: D,
1103
+ onPreview: Y,
1104
+ record: k,
1105
+ fields: _,
1106
+ renderPane: (e) => /* @__PURE__ */ o(
1107
+ Ln,
1017
1108
  {
1018
1109
  collection: r,
1019
1110
  bundle: t,
1020
- parent: x,
1111
+ parent: T,
1021
1112
  roleId: e.roleId,
1022
1113
  stateKey: e.stateKey,
1023
- marks: kt(e.marks),
1024
- overlay: e.overlay,
1025
- ruleMarks: Nt,
1026
- ghost: Lt,
1027
- deps: ye.deps,
1114
+ marks: Et(e.marks),
1115
+ overlay: q.overlay(e.overlay),
1116
+ ruleMarks: Ut,
1117
+ ghost: zt,
1118
+ deps: ke.deps,
1028
1119
  noDnd: e.noDnd,
1029
1120
  record: e.record,
1030
- selected: Y,
1121
+ selected: re,
1031
1122
  selection: y,
1032
- onSelect: R,
1033
- showHidden: fe,
1034
- fold: w.fold,
1035
- reveal: w.reveal,
1036
- apply: o.apply,
1037
- whenIdle: o.whenIdle,
1038
- fillRate: we,
1039
- unsaved: Ot,
1040
- peers: Tt,
1041
- compare: Q.compare,
1042
- lastChanges: Q.compare ? void 0 : vt
1123
+ onSelect: qt,
1124
+ showHidden: ge,
1125
+ fold: x.fold,
1126
+ reveal: x.reveal,
1127
+ apply: n.apply,
1128
+ whenIdle: n.whenIdle,
1129
+ fillRate: Te,
1130
+ unsaved: Wt,
1131
+ peers: Ht,
1132
+ compare: Z.compare,
1133
+ lastChanges: Z.compare ? void 0 : Lt
1043
1134
  }
1044
1135
  )
1045
1136
  }
1046
1137
  )
1047
1138
  }
1048
- ) : o.error ? /* @__PURE__ */ n("p", { className: "p-6 text-[13px] text-red-700 dark:text-red-300", children: o.error }) : /* @__PURE__ */ v("div", { className: "flex flex-col gap-3 p-6", children: [
1049
- /* @__PURE__ */ n(it, { className: "h-10 w-full rounded-lg" }),
1050
- /* @__PURE__ */ n(it, { className: "h-48 w-full rounded-lg" })
1139
+ ) : n.error ? /* @__PURE__ */ o("p", { className: "p-6 text-[13px] text-red-700 dark:text-red-300", children: n.error }) : /* @__PURE__ */ h("div", { className: "flex flex-col gap-3 p-6", children: [
1140
+ /* @__PURE__ */ o(gt, { className: "h-10 w-full rounded-lg" }),
1141
+ /* @__PURE__ */ o(gt, { className: "h-48 w-full rounded-lg" })
1051
1142
  ] })
1052
1143
  ] }),
1053
- /* @__PURE__ */ n(
1144
+ /* @__PURE__ */ o(
1054
1145
  "aside",
1055
1146
  {
1056
1147
  "data-editor-inspector": "",
1057
1148
  className: "flex w-[344px] shrink-0 flex-col overflow-hidden border-l border-slate-200 bg-white dark:border-border dark:bg-card",
1058
- children: t && ($ === "ask" ? /* @__PURE__ */ n(
1059
- ar,
1149
+ children: t && (V === "ask" ? /* @__PURE__ */ o(
1150
+ Tr,
1060
1151
  {
1061
- layoutId: c,
1062
- layoutName: ve,
1063
- kind: Po(t.layout),
1152
+ layoutId: u,
1153
+ layoutName: xe,
1154
+ kind: nn(t.layout),
1064
1155
  bundle: t,
1065
- thread: ke,
1066
- setThread: pe,
1067
- pending: me,
1068
- onPendingTaken: () => ne(null),
1069
- jump: Ft,
1070
- onCite: Mt,
1071
- recordId: ((nt = I.record) == null ? void 0 : nt.id) ?? null
1156
+ thread: Ce,
1157
+ setThread: he,
1158
+ pending: ve,
1159
+ onPendingTaken: () => ce(null),
1160
+ jump: Yt,
1161
+ onCite: Zt,
1162
+ recordId: ((yt = D.record) == null ? void 0 : yt.id) ?? null
1072
1163
  }
1073
- ) : $ === "checks" ? /* @__PURE__ */ n(
1074
- Xr,
1164
+ ) : V === "checks" ? /* @__PURE__ */ o(
1165
+ Oo,
1075
1166
  {
1076
- findings: Z.findings,
1077
- health: Z.health,
1078
- ready: Z.ready,
1167
+ findings: oe.findings,
1168
+ health: oe.health,
1169
+ ready: oe.ready,
1079
1170
  onSelect: (e) => L([e]),
1080
- apply: o.apply,
1081
- onOpenAiReview: p.aiReviewSlot ? () => O("settings") : void 0
1171
+ apply: n.apply,
1172
+ onOpenAiReview: p.aiReviewSlot ? () => N("settings") : void 0
1082
1173
  }
1083
- ) : $ === "settings" ? /* @__PURE__ */ n(
1084
- jo,
1174
+ ) : V === "settings" ? /* @__PURE__ */ o(
1175
+ wn,
1085
1176
  {
1086
1177
  bundle: t,
1087
- apply: o.apply,
1088
- flush: o.flush,
1178
+ apply: n.apply,
1179
+ flush: n.flush,
1089
1180
  collection: r,
1090
- previewRoleId: I.roleId,
1091
- onPreviewRoleChange: Kt,
1181
+ previewRoleId: D.roleId,
1182
+ onPreviewRoleChange: Qt,
1092
1183
  onAskWhere: p.isAdmin ? (e) => {
1093
- ne(e), O("ask");
1184
+ ce(e), N("ask");
1094
1185
  } : void 0
1095
1186
  }
1096
- ) : y.length > 1 ? /* @__PURE__ */ n(
1097
- Hr,
1187
+ ) : y.length > 1 ? /* @__PURE__ */ o(
1188
+ xo,
1098
1189
  {
1099
1190
  bundle: t,
1100
1191
  selection: y,
1101
- apply: o.apply,
1192
+ apply: n.apply,
1102
1193
  collection: r,
1103
1194
  onSelection: L
1104
1195
  }
1105
- ) : /* @__PURE__ */ n(
1106
- zo,
1196
+ ) : /* @__PURE__ */ o(
1197
+ xn,
1107
1198
  {
1108
1199
  bundle: t,
1109
- target: Y,
1110
- apply: o.apply,
1111
- flush: o.flush,
1200
+ target: re,
1201
+ apply: n.apply,
1202
+ flush: n.flush,
1112
1203
  collection: r,
1113
- openLayout: te,
1114
- onSelect: w.selectAndReveal
1204
+ openLayout: ee,
1205
+ onSelect: x.selectAndReveal
1115
1206
  }
1116
1207
  ))
1117
1208
  }
@@ -1119,69 +1210,75 @@ function Na({
1119
1210
  ] })
1120
1211
  }
1121
1212
  ),
1122
- /* @__PURE__ */ n(
1123
- Ao,
1213
+ /* @__PURE__ */ o(
1214
+ tn,
1124
1215
  {
1125
1216
  bundle: t,
1126
1217
  selection: y,
1127
- apply: o.apply,
1218
+ apply: n.apply,
1128
1219
  onSelection: L,
1129
- rootRef: q
1220
+ rootRef: U
1130
1221
  }
1131
1222
  ),
1132
- /* @__PURE__ */ n(
1133
- Io,
1223
+ /* @__PURE__ */ o(
1224
+ un,
1134
1225
  {
1135
- request: xt,
1136
- count: o.unsavedCount,
1137
- onSave: St,
1138
- onDiscard: o.discard,
1139
- onKeep: () => qe(null),
1140
- note: E ? /* @__PURE__ */ n(vr, { policy: E, value: le, onChange: Se }) : void 0,
1141
- canSave: hr(E, le)
1226
+ request: Kt,
1227
+ count: n.unsavedCount,
1228
+ onSave: Dt,
1229
+ onDiscard: n.discard,
1230
+ onKeep: () => je(null),
1231
+ note: F ? /* @__PURE__ */ o(_r, { policy: F, value: me, onChange: Ne }) : void 0,
1232
+ canSave: Dr(F, me)
1142
1233
  }
1143
1234
  ),
1144
- E && Fe && /* @__PURE__ */ n(
1145
- gr,
1235
+ F && ze && /* @__PURE__ */ o(
1236
+ Mr,
1146
1237
  {
1147
1238
  open: !0,
1148
- anchor: Fe,
1149
- policy: E,
1150
- count: o.unsavedCount,
1151
- value: le,
1152
- onChange: Se,
1153
- onSave: Be,
1154
- onClose: () => Me(null)
1239
+ anchor: ze,
1240
+ policy: F,
1241
+ intro: X ? Tt(X) : void 0,
1242
+ count: n.unsavedCount,
1243
+ value: me,
1244
+ onChange: Ne,
1245
+ onSave: He,
1246
+ onClose: () => Ve(null)
1155
1247
  }
1156
1248
  ),
1157
- Qe && /* @__PURE__ */ n(
1158
- xr,
1249
+ rt && /* @__PURE__ */ o(
1250
+ Ur,
1159
1251
  {
1160
- anchor: Qe,
1161
- steps: o.unsavedSteps,
1162
- exists: (e) => !!t && Oe(e, t, x),
1163
- describe: (e) => pt(e, t, F),
1252
+ anchor: rt,
1253
+ steps: n.unsavedSteps,
1254
+ exists: (e) => !!t && Be(e, t, T),
1255
+ describe: (e) => Ct(e, t, _),
1164
1256
  onJump: (e) => {
1165
- he(null), Je(e);
1257
+ be(null), ot(e);
1166
1258
  },
1167
1259
  onSettings: () => {
1168
- he(null), O("settings");
1260
+ be(null), N("settings");
1169
1261
  },
1170
- onClose: () => he(null)
1262
+ onClose: () => be(null)
1171
1263
  }
1172
1264
  )
1173
1265
  ]
1174
1266
  }
1175
1267
  );
1176
- if (!ee) return et;
1177
- const tt = u ?? (Re ? Zt(Re) ?? document.body : null);
1178
- return /* @__PURE__ */ v(ue, { children: [
1179
- /* @__PURE__ */ n("span", { ref: Ct, hidden: !0, "data-layout-editor-marker": "" }),
1180
- tt && Ht(et, tt)
1268
+ if (!ae)
1269
+ return /* @__PURE__ */ o(wt.Provider, { value: Ie, children: lt });
1270
+ const dt = c ?? (Le ? gr(Le) ?? document.body : null);
1271
+ return /* @__PURE__ */ h(de, { children: [
1272
+ /* @__PURE__ */ o("span", { ref: _t, hidden: !0, "data-layout-editor-marker": "" }),
1273
+ /* @__PURE__ */ o(wt.Provider, { value: Ie, children: dt && ur(lt, dt) })
1181
1274
  ] });
1182
1275
  }
1276
+ function Tt(r) {
1277
+ const l = r.reason.trim() ? `: ${r.reason.trim()}` : "";
1278
+ return `Frozen until ${hr(r.until)}${l}. Saving asks for an override note, kept in History.`;
1279
+ }
1183
1280
  export {
1184
- Na as LayoutEditor,
1185
- Ke as isTyping,
1186
- Oe as targetExists
1281
+ us as LayoutEditor,
1282
+ $e as isTyping,
1283
+ Be as targetExists
1187
1284
  };