@nivaro/react 0.3.35 → 0.3.37

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