@nivaro/react 0.3.8 → 0.3.10

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 (60) hide show
  1. package/dist/components/fields/FileField.js +20 -19
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/replayUploadQueue.js +107 -93
  4. package/dist/hooks/useNivaroForm.js +129 -126
  5. package/dist/hooks/useSessionRecorder.js +103 -101
  6. package/dist/index.d.ts +115 -2
  7. package/dist/index.js +466 -447
  8. package/dist/shared/components/CollectionBrowserView.js +1058 -1059
  9. package/dist/shared/components/ConformanceView.js +36 -35
  10. package/dist/shared/components/DataTable.js +230 -223
  11. package/dist/shared/components/ForceReloadBanner.js +58 -34
  12. package/dist/shared/components/ItemEditForm.js +3687 -3580
  13. package/dist/shared/components/JsonMapEditor.js +18 -17
  14. package/dist/shared/components/MatrixEditor.js +8 -7
  15. package/dist/shared/components/MyWorkView.js +32 -31
  16. package/dist/shared/components/PageRenderer.js +146 -145
  17. package/dist/shared/components/QueryTable.js +49 -49
  18. package/dist/shared/components/RecordGridEditor.js +76 -75
  19. package/dist/shared/components/ai/AiMemorySuggestions.js +15 -14
  20. package/dist/shared/components/ai/AskPanel.js +55 -54
  21. package/dist/shared/components/bulk/BulkActionButtons.js +30 -29
  22. package/dist/shared/components/bulk/PushBulkButtons.js +57 -56
  23. package/dist/shared/components/chat/ChatPanel.js +288 -287
  24. package/dist/shared/components/chat/SlashCommands.js +30 -29
  25. package/dist/shared/components/chat/chat-outbox.js +76 -75
  26. package/dist/shared/components/help-videos/recorder/useLeaveWarning.js +6 -5
  27. package/dist/shared/components/integrations/console/SignalCard.js +124 -123
  28. package/dist/shared/components/integrations/console/SnoozeMenu.js +24 -23
  29. package/dist/shared/components/item-edit/CloneDialog.js +85 -78
  30. package/dist/shared/components/item-edit/InlineTableField.js +301 -300
  31. package/dist/shared/components/item-edit/MembershipSetField.js +24 -23
  32. package/dist/shared/components/item-edit/QuickCreateButton.js +8 -7
  33. package/dist/shared/components/item-edit/RecordLiveSync.js +101 -100
  34. package/dist/shared/components/item-edit/staged-links.js +86 -0
  35. package/dist/shared/components/layout-editor/LayoutEditor.js +275 -274
  36. package/dist/shared/components/layout-editor/editors/cascade-rule-row.js +18 -17
  37. package/dist/shared/components/layout-editor/inspector/HelpTab.js +37 -36
  38. package/dist/shared/components/layout-editor/matrix/FieldStateMatrix.js +50 -49
  39. package/dist/shared/components/panels/CommentPanel.js +237 -236
  40. package/dist/shared/components/profile/AiMemoryCard.js +15 -14
  41. package/dist/shared/components/profile/PersonAdminTools.js +70 -67
  42. package/dist/shared/components/profile/usePersonPresence.js +42 -37
  43. package/dist/shared/components/queue/QueueItemSheet.js +36 -35
  44. package/dist/shared/components/queue/QueueWorklist.js +597 -598
  45. package/dist/shared/lib/client-version.js +63 -0
  46. package/dist/shared/lib/force-reload.js +36 -0
  47. package/dist/shared/lib/load-error.js +11 -10
  48. package/dist/shared/lib/presence-live.js +73 -0
  49. package/dist/shared/lib/presence-state.js +39 -31
  50. package/dist/shared/lib/record-outbox.js +76 -75
  51. package/dist/shared/lib/request-gate.js +120 -102
  52. package/dist/shared/lib/rum.js +45 -36
  53. package/dist/shared/lib/safe-error.js +39 -0
  54. package/dist/shared/lib/server-clock.js +11 -7
  55. package/dist/shared/lib/signed-out.js +114 -0
  56. package/dist/shared/lib/socket-realtime.js +19 -17
  57. package/dist/shared/lib/unsaved-work.js +62 -0
  58. package/dist/shared/lib/use-online-users.js +11 -10
  59. package/dist/shared/lib/worker-socket.js +89 -79
  60. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  import { jsxs as y, jsx as o, Fragment as ae } from "react/jsx-runtime";
2
2
  import { useQueryClient as rr, useQuery as or } from "@tanstack/react-query";
3
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 R, useEffect as U, useMemo as b, useRef as j, useCallback as C } from "react";
4
+ import { useState as N, useEffect as U, useMemo as b, useRef as j, useCallback as C } from "react";
5
5
  import { createPortal as mr } from "react-dom";
6
6
  import { toast as gt } from "sonner";
7
7
  import { useNivaroClient as fr } from "../../context.js";
@@ -9,104 +9,105 @@ import { get as yr } from "../../lib/commands.js";
9
9
  import { HEADER_GROUP_KEY as Pt, UNGROUPED_KEY as hr } from "../../lib/layout-ops.js";
10
10
  import { activeFreeze as vr, dayWords as gr } from "../../lib/layout-resolve.js";
11
11
  import { useMyUserId as kr } from "../../lib/presence-signals.js";
12
+ import { useUnsavedWork as wr } from "../../lib/unsaved-work.js";
12
13
  import { cn as G } from "../../lib/utils.js";
13
- import { usePretendDownScope as wr, LAYOUT_PRETEND_SCOPE as kt, layoutPretendDownOptions as br, PretendDownSection as xr } from "../PretendDown.js";
14
- import { modalHostOf as Sr } from "../ui/popover.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";
15
16
  import { Skeleton as wt } from "../ui/skeleton.js";
16
- import { AddPanel as Cr } from "./AddPanel.js";
17
- import { AutoArrangeButton as Tr } from "./AutoArrange.js";
18
- import { AiToolsButton as Or } from "./ai/AiToolsButton.js";
19
- import { pinsToMarks as Ar, mergeMarks as bt } from "./ai/ai-tools-api.js";
20
- import { AiFormsButton as Pr } from "./ai-forms/AiFormsButton.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";
21
22
  import { AskButton as Nr, AskPanel as Rr } from "./assist/AskPanel.js";
22
- import { useAskThread as Lr } from "./assist/assist-api.js";
23
- import { jumpToSetting as Er } from "./assist/jump.js";
24
- import { ProposalsButton as Dr } from "./assist/ProposalsButton.js";
25
- import { BulkChangesButton as Fr } from "./bulk/BulkChangesButton.js";
26
- import { useMacroRecorder as Ir } from "./bulk/useMacroRecorder.js";
27
- import { bundleToActiveLayout as Nt, previewForRole as Kr, roleMarker as _r } from "./bundle-to-active.js";
28
- import { useCanvasCompare as Mr, CompareBanner as Br } from "./CanvasCompare.js";
29
- import { changeNotePolicyOf as xt, changeNoteMeta as qr, changeNoteReady as Ur, ChangeNoteFields as $r, ChangeNoteSave as zr } from "./ChangeNote.js";
30
- import { PresenceAvatars as Vr, DroppedBanner as Hr, RecoveryBanner as Wr, UnsavedList as jr } from "./CollabParts.js";
31
- import { CommandPalette as Gr } from "./commands/CommandPalette.js";
32
- import { nextSelection as Qr, targetKey as z } from "./design-context.js";
33
- import { WIDTH_LABELS as Yr } from "./field-zones.js";
34
- import { LayoutDndProvider as Jr, useLayoutDnd as Zr } from "./dnd/LayoutDndProvider.js";
35
- import { NO_DND as Xr } from "./dnd/node.js";
36
- import { useDraftRecovery as eo, stagedTip as to } from "./draft-recovery.js";
37
- import { canvasRenderer as ro, EditorCanvas as oo } from "./EditorCanvas.js";
38
- import { EditorTopBar as no } from "./EditorTopBar.js";
39
- import { notesOf as ao, noteKey as so } from "./editor-notes.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";
40
41
  import { EntryEditorContext as St } from "./entry/entry-editor-context.js";
41
- import { useTabOrderEditor as io, TabOrderBar as lo } from "./entry/tab-order.js";
42
- import { useAppIsDark as co, ThemePreviewTool as uo, previewThemeClass as po } from "./entry/theme-preview.js";
43
- import { useRulesView as mo, explainMarks as fo, RulesToggle as yo, RuleLoopsBanner as ho } from "./explain/CanvasRules.js";
44
- import { useDriverHover as vo } from "./explain/driver-hover.js";
45
- import { useCanvasExplain as go, useDefaultGhosts as ko } from "./explain/use-explain.js";
46
- import { FindReplaceButton as wo } from "./FindReplace.js";
47
- import { OutputsButton as bo } from "./outputs/OutputsButton.js";
48
- import { FormMapButton as xo } from "./FormMapButton.js";
49
- import { useSectionChanges as So } from "./history-api.js";
50
- import { useLayoutEditorHost as Co } from "./host.js";
51
- import { overriddenTargets as To, overrideMark as Oo } from "./inheritance.js";
52
- import { BulkInspector as Ao } from "./inspector/BulkInspector.js";
53
- import { requestInspectorTab as Po } from "./inspector/tab-request.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";
54
55
  import { isTyping as $e } from "./is-typing.js";
55
56
  import { ARROW_DIRS as No, altArrowMove as Ro } from "./keyboard-move.js";
56
- import { LayoutsRail as Lo } from "./LayoutsRail.js";
57
- import { LintButton as Eo, LintPanel as Do } from "./lint/LintPanel.js";
58
- import { useLayoutLint as Fo } from "./lint/lint-api.js";
59
- import { FieldStateMatrix as Io } from "./matrix/FieldStateMatrix.js";
60
- import { RoleSectionMatrix as Ko } from "./matrix/RoleSectionMatrix.js";
61
- import { FindTool as _o, OutlineTool as Mo, ViewTools as Bo, ShortcutsTool as qo } from "./nav/NavTools.js";
62
- import { OutlinePanel as Uo } from "./nav/OutlinePanel.js";
63
- import { useEditorNav as $o } from "./nav/useEditorNav.js";
64
- import { COMPACT_ZOOM as zo } from "./nav/view-prefs.js";
65
- import { useLayoutOverview as Vo, useOverviewFields as Ho, useInvalidateLayouts as Rt, useRuleChoiceLabels as Wo, useApproxRecordCount as jo } from "./overview/overview-api.js";
66
- import { purposeSegments as Go, Sentence as Qo } from "./overview/purpose.js";
67
- import { PlacementsTable as Yo } from "./PlacementsTable.js";
68
- import { segTrack as Jo, amberStrip as Me, segOption as Zo } from "./panel-style.js";
69
- import { useLayoutPresence as Xo, peersByTarget as en } from "./presence.js";
70
- import { PreviewModes as tn } from "./preview/PreviewModes.js";
71
- import { PreviewPanes as rn } from "./preview/PreviewPanes.js";
72
- import { FormMoreMenu as on } from "./reuse/FormMoreMenu.js";
73
- import { useRailCopy as nn } from "./reuse/useRailCopy.js";
74
- import { StagedByOthers as an } from "./StagedChip.js";
75
- import { StructureActions as sn, usePinMarks as ln } from "./StructureMenu.js";
76
- import { useRolePreview as dn } from "./settings/settings-api.js";
77
- import { layoutKindOf as cn } from "./settings/settings-registry.js";
78
- import { useStagedDraft as un, useStagedWriter as pn } from "./staged-api.js";
79
- import { ImpactButton as mn, TestingButton as fn } from "./testing/TestingPanels.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";
80
81
  import { MenuSeparator as Ce, ToolButton as Ct } from "./toolbar-kit.js";
81
- import { unsavedText as yn, UnsavedConfirm as hn } from "./UnsavedConfirm.js";
82
- import { unsavedKeys as vn, targetFromKey as Tt, describeTarget as Ot } from "./unsaved-marks.js";
83
- import { UsagePanel as gn } from "./usage/UsagePanel.js";
84
- import { useShowFillRates as kn, useFieldFillRates as wn, usageTodayText as bn, useLayoutUsageToday as xn } from "./usage/usage-api.js";
85
- import { useLayoutDraft as Sn, useLayoutBundle as Be, layoutDraftKeys as Cn, touchesOverview as Tn } from "./useLayoutDraft.js";
86
- import { FormSettings as On } from "./settings/FormSettings.js";
87
- import { Inspector as An } from "./inspector/Inspector.js";
88
- function Pn(r) {
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) {
89
90
  U(() => {
90
- const l = (s) => {
91
+ const i = (s) => {
91
92
  if (!(s.metaKey || s.ctrlKey) || s.altKey) return;
92
- const i = s.key.toLowerCase();
93
- if (i === "s" && !s.shiftKey) {
93
+ const l = s.key.toLowerCase();
94
+ if (l === "s" && !s.shiftKey) {
94
95
  s.preventDefault(), r.autosave ? r.flush() : r.save();
95
96
  return;
96
97
  }
97
- const m = i === "z" && s.shiftKey || i === "y" && !s.shiftKey;
98
- i !== "z" && !m || $e(s.target) || (s.preventDefault(), m ? r.redo() : r.undo());
98
+ const m = l === "z" && s.shiftKey || l === "y" && !s.shiftKey;
99
+ l !== "z" && !m || $e(s.target) || (s.preventDefault(), m ? r.redo() : r.undo());
99
100
  };
100
- return window.addEventListener("keydown", l), () => window.removeEventListener("keydown", l);
101
+ return window.addEventListener("keydown", i), () => window.removeEventListener("keydown", i);
101
102
  }, [r.undo, r.redo, r.autosave, r.flush, r.save]);
102
103
  }
103
- function Nn(r, l, s, i, m) {
104
+ function Nn(r, i, s, l, m) {
104
105
  U(() => {
105
106
  const d = (c) => {
106
107
  const v = No[c.key];
107
- 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;
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;
108
109
  c.preventDefault();
109
- const p = Ro(r, l[0], v);
110
+ const p = Ro(r, i[0], v);
110
111
  if (!p) return;
111
112
  s(p.ops, { label: p.label }), m(p.next);
112
113
  const u = z(p.next);
@@ -119,50 +120,50 @@ function Nn(r, l, s, i, m) {
119
120
  });
120
121
  };
121
122
  return window.addEventListener("keydown", d), () => window.removeEventListener("keydown", d);
122
- }, [r, l, s, i, m]);
123
+ }, [r, i, s, l, m]);
123
124
  }
124
125
  function Rn(r) {
125
- const l = r.status === "saving" || r.dirty;
126
- U(() => {
127
- if (!l) return;
128
- const s = (i) => {
129
- r.flush(), i.preventDefault(), i.returnValue = "";
126
+ const i = r.status === "saving" || r.dirty;
127
+ wr(i, "Layout changes"), U(() => {
128
+ if (!i) return;
129
+ const s = (l) => {
130
+ r.flush(), l.preventDefault(), l.returnValue = "";
130
131
  };
131
132
  return window.addEventListener("beforeunload", s), () => window.removeEventListener("beforeunload", s);
132
- }, [l, r.flush]), U(() => {
133
+ }, [i, r.flush]), U(() => {
133
134
  const s = () => r.flush();
134
135
  return window.addEventListener("pagehide", s), () => window.removeEventListener("pagehide", s);
135
136
  }, [r.flush]);
136
137
  }
137
- function Ln(r) {
138
- const l = rr(), s = Rt(r);
138
+ function En(r) {
139
+ const i = rr(), s = Nt(r);
139
140
  return C(
140
- (i, m) => {
141
- const d = Number(i.layout.id);
142
- Number.isFinite(d) && l.invalidateQueries({ queryKey: Cn.versions(d) }), s({ lazy: !Tn(m) });
141
+ (l, m) => {
142
+ const d = Number(l.layout.id);
143
+ Number.isFinite(d) && i.invalidateQueries({ queryKey: Tn.versions(d) }), s({ lazy: !On(m) });
143
144
  },
144
- [l, s]
145
+ [i, s]
145
146
  );
146
147
  }
147
- function En(r, l) {
148
+ function Dn(r, i) {
148
149
  const s = fr();
149
150
  return or({
150
- queryKey: ["layout-editor", "preview-record", r, l],
151
+ queryKey: ["layout-editor", "preview-record", r, i],
151
152
  queryFn: () => s.request(
152
- yr(`/items/${encodeURIComponent(r)}/${encodeURIComponent(String(l))}`)
153
- ).then((i) => i.data ?? null),
154
- enabled: l != null,
153
+ yr(`/items/${encodeURIComponent(r)}/${encodeURIComponent(String(i))}`)
154
+ ).then((l) => l.data ?? null),
155
+ enabled: i != null,
155
156
  staleTime: 3e4
156
157
  });
157
158
  }
158
- function Dn(r, l) {
159
- const s = j(l);
160
- s.current = l, U(() => {
159
+ function Fn(r, i) {
160
+ const s = j(i);
161
+ s.current = i, U(() => {
161
162
  if (!r) return;
162
- let i = !1;
163
+ let l = !1;
163
164
  const m = (d) => {
164
165
  var p, u;
165
- if (i || d.defaultPrevented || d.button !== 0 || d.metaKey || d.ctrlKey || d.shiftKey || d.altKey) return;
166
+ if (l || d.defaultPrevented || d.button !== 0 || d.metaKey || d.ctrlKey || d.shiftKey || d.altKey) return;
166
167
  const c = (u = (p = d.target) == null ? void 0 : p.closest) == null ? void 0 : u.call(p, "a[href]");
167
168
  if (!c || c.target && c.target !== "_self" || c.hasAttribute("download")) return;
168
169
  let v;
@@ -172,45 +173,45 @@ function Dn(r, l) {
172
173
  return;
173
174
  }
174
175
  v.origin === window.location.origin && v.pathname + v.search !== window.location.pathname + window.location.search && (d.preventDefault(), d.stopPropagation(), s.current(() => {
175
- i = !0;
176
+ l = !0;
176
177
  try {
177
178
  c.click();
178
179
  } finally {
179
- i = !1;
180
+ l = !1;
180
181
  }
181
182
  }, c));
182
183
  };
183
184
  return document.addEventListener("click", m, !0), () => document.removeEventListener("click", m, !0);
184
185
  }, [r]);
185
186
  }
186
- function qe(r, l, s = null) {
187
- const i = (m) => {
187
+ function qe(r, i, s = null) {
188
+ const l = (m) => {
188
189
  if (r.kind === "group") return r.key === hr || m.groups.some((c) => c.key === r.key);
189
190
  const d = r.kind === "header" ? Pt : r.group_key;
190
191
  return m.placements.some((c) => c.field === r.field && c.group_key === d);
191
192
  };
192
- return i(l) || s != null && i(s);
193
+ return l(i) || s != null && l(s);
193
194
  }
194
- function Fn(r, l, s) {
195
- const i = j(null), m = j(l);
196
- return m.current = l, U(() => {
195
+ function In(r, i, s) {
196
+ const l = j(null), m = j(i);
197
+ return m.current = i, U(() => {
197
198
  var v;
198
199
  if (!r) return;
199
200
  const d = document.activeElement;
200
- (v = i.current) == null || v.focus();
201
+ (v = l.current) == null || v.focus();
201
202
  const c = (p) => {
202
203
  p.key !== "Escape" || p.defaultPrevented || s.current || $e(p.target) || document.querySelector('[data-radix-popper-content-wrapper], [role="menu"]') || (p.preventDefault(), m.current());
203
204
  };
204
205
  return document.addEventListener("keydown", c), () => {
205
206
  document.removeEventListener("keydown", c), d != null && d.isConnected && d.focus();
206
207
  };
207
- }, [r, s]), i;
208
+ }, [r, s]), l;
208
209
  }
209
- function In({
210
+ function Kn({
210
211
  collection: r,
211
- bundle: l,
212
+ bundle: i,
212
213
  parent: s,
213
- roleId: i,
214
+ roleId: l,
214
215
  stateKey: m = null,
215
216
  marks: d,
216
217
  overlay: c,
@@ -231,24 +232,24 @@ function In({
231
232
  unsaved: he,
232
233
  peers: de,
233
234
  compare: h,
234
- lastChanges: L
235
+ lastChanges: R
235
236
  }) {
236
- const re = Zr(), I = g ? Xr : re, se = ro(String(l.layout.layout_type ?? "grouped")), ie = (se === "item-edit-form" || se === "read-view") && (h == null ? void 0 : h.diff.bundle) || l, M = b(() => Nt(ie, s), [ie, s]), Y = b(
237
- () => s ? To(l, s) : null,
238
- [l, s]
239
- ), H = b(() => Y != null && Y.size ? (k) => {
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,
239
+ [i, s]
240
+ ), W = b(() => Y != null && Y.size ? (k) => {
240
241
  const O = Y.get(z(k)), ge = (d == null ? void 0 : d(k)) ?? [];
241
- return O ? [...ge, Oo(O)] : ge;
242
+ return O ? [...ge, Ao(O)] : ge;
242
243
  } : d, [Y, d]), Oe = b(
243
- () => Kr(M.active, i, E),
244
- [M.active, i, E]
245
- ), { data: K = null } = dn(r, i), J = b(
246
- () => i ? _r(K) : void 0,
247
- [i, K]
248
- ), N = b(() => ao(l), [l]), _ = b(
249
- () => H && v ? (k) => [...H(k), ...v(k)] : H ?? v,
250
- [H, v]
251
- ), B = ln(l, _), Ae = 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(
252
253
  () => ({
253
254
  selected: n,
254
255
  selection: fe,
@@ -261,15 +262,15 @@ function In({
261
262
  overlay: c,
262
263
  fillRate: ye,
263
264
  note: (k) => {
264
- const O = so(k);
265
- return O ? N.get(O) ?? null : null;
265
+ const O = io(k);
266
+ return O ? L.get(O) ?? null : null;
266
267
  },
267
268
  fold: te,
268
269
  reveal: V,
269
270
  unsaved: he,
270
271
  peers: de,
271
272
  diffMark: h ? (k) => h.diff.marks.get(z(k)) ?? null : void 0,
272
- lastChange: L ? (k) => k.kind === "group" ? L[k.key] ?? null : null : void 0,
273
+ lastChange: R ? (k) => k.kind === "group" ? R[k.key] ?? null : null : void 0,
273
274
  ghost: p,
274
275
  resizeWidth: g ? void 0 : (k, O) => {
275
276
  k.kind !== "field" && k.kind !== "slot" || P(
@@ -280,7 +281,7 @@ function In({
280
281
  patch: { col_span: O === 12 ? null : O }
281
282
  }
282
283
  ],
283
- { label: `Set the width to ${Yr[O] ?? O}` }
284
+ { label: `Set the width to ${Jr[O] ?? O}` }
284
285
  );
285
286
  }
286
287
  }),
@@ -295,43 +296,43 @@ function In({
295
296
  B,
296
297
  c,
297
298
  ye,
298
- N,
299
+ L,
299
300
  te,
300
301
  V,
301
302
  he,
302
303
  de,
303
304
  h,
304
- L,
305
+ R,
305
306
  p,
306
307
  P,
307
308
  g
308
309
  ]
309
- ), T = vo(u);
310
+ ), T = go(u);
310
311
  return /* @__PURE__ */ o("div", { ref: T, className: "flex min-h-full flex-col", children: /* @__PURE__ */ o(
311
- oo,
312
+ no,
312
313
  {
313
314
  collection: r,
314
315
  bundle: ie,
315
316
  layout: Oe,
316
317
  record: Q,
317
318
  stateKey: m,
318
- roleId: i,
319
+ roleId: l,
319
320
  design: Ae,
320
321
  apply: P,
321
322
  whenIdle: Te
322
323
  }
323
324
  ) });
324
325
  }
325
- function Kn({
326
+ function _n({
326
327
  collection: r,
327
- name: l,
328
+ name: i,
328
329
  row: s,
329
- layoutId: i,
330
+ layoutId: l,
330
331
  rows: m,
331
332
  fields: d,
332
333
  onDone: c
333
334
  }) {
334
- const v = Wo(r, d, m), { data: p } = jo(r, s, m), u = bn(xn(i).data), g = s ? s.section === "forms" && (s.reason.kind === "default" || s.reason.kind === "fallback") ? [{ text: "used by every record no rule catches" }] : Go(s, d, v) : [];
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) : [];
335
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(
336
337
  "div",
337
338
  {
@@ -340,10 +341,10 @@ function Kn({
340
341
  children: [
341
342
  /* @__PURE__ */ y("p", { className: "m-0 min-w-0 flex-1 truncate", children: [
342
343
  "Editing ",
343
- /* @__PURE__ */ o("b", { className: "font-semibold text-slate-900 dark:text-foreground", children: l }),
344
+ /* @__PURE__ */ o("b", { className: "font-semibold text-slate-900 dark:text-foreground", children: i }),
344
345
  g.length > 0 && /* @__PURE__ */ y(ae, { children: [
345
346
  " — ",
346
- /* @__PURE__ */ o(Qo, { segs: g, muted: !0 })
347
+ /* @__PURE__ */ o(Yo, { segs: g, muted: !0 })
347
348
  ] })
348
349
  ] }),
349
350
  /* @__PURE__ */ o(
@@ -359,17 +360,17 @@ function Kn({
359
360
  }
360
361
  );
361
362
  }
362
- function _n({ view: r, onView: l }) {
363
- const s = (i, m, d, c) => /* @__PURE__ */ y(
363
+ function Mn({ view: r, onView: i }) {
364
+ const s = (l, m, d, c) => /* @__PURE__ */ y(
364
365
  "button",
365
366
  {
366
367
  type: "button",
367
- "aria-pressed": r === i,
368
+ "aria-pressed": r === l,
368
369
  "aria-label": m,
369
- "data-editor-view": i,
370
+ "data-editor-view": l,
370
371
  "data-tip": c,
371
- onClick: () => l(i),
372
- className: G(Zo(r === i), "inline-flex items-center justify-center gap-1"),
372
+ onClick: () => i(l),
373
+ className: G(Xo(r === l), "inline-flex items-center justify-center gap-1"),
373
374
  children: [
374
375
  /* @__PURE__ */ o(d, { className: "h-3.5 w-3.5 shrink-0" }),
375
376
  /* @__PURE__ */ o("span", { "data-tb-xwide": "", children: m })
@@ -380,7 +381,7 @@ function _n({ view: r, onView: l }) {
380
381
  "fieldset",
381
382
  {
382
383
  "aria-label": "Show the form as",
383
- className: G("m-0 min-w-0 shrink-0 border-0", Jo(4)),
384
+ className: G("m-0 min-w-0 shrink-0 border-0", Zo(4)),
384
385
  children: [
385
386
  s("canvas", "Canvas", dr, "The form as people see it"),
386
387
  s("table", "Table", cr, "Every field as a row: label, section, width, rules"),
@@ -399,32 +400,32 @@ const Ue = (r) => G(
399
400
  "inline-flex h-7 items-center gap-1 rounded-md px-2.5 text-[12px] font-medium transition-colors",
400
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"
401
402
  );
402
- function vs({
403
+ function ks({
403
404
  collection: r,
404
- layoutId: l,
405
+ layoutId: i,
405
406
  onBack: s,
406
- mode: i,
407
+ mode: l,
407
408
  onLayoutChange: m,
408
409
  previewRecordId: d = null,
409
410
  portalContainer: c,
410
411
  onDirtyChange: v
411
412
  }) {
412
413
  var ut, pt, mt, ft, yt, ht;
413
- const p = Co(), [u, g] = R(l);
414
- U(() => g(l), [l]);
415
- const Q = Ln(r), { draft: n, recorder: fe } = Ir(Sn(u, { onSaved: Q })), t = n.bundle, [E, te] = R("layouts"), [V, P] = R("inspector"), [Te, ye] = Lr(), [he, de] = R(null), [h, L] = R([]), re = h.length > 0 ? h[h.length - 1] : null, [I, se] = R("canvas"), [ve, ie] = R(!1), [M, Y] = kn(), { data: H } = wn(r, M), Oe = b(
416
- () => M && H && H.total > 0 ? (e) => H.pct.get(e) ?? null : void 0,
417
- [M, H]
418
- ), [K, J] = R({
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({
419
420
  record: d ? { id: d, label: `#${d}` } : null,
420
421
  roleId: null
421
- }), { data: N } = Vo(r), { data: _ = [] } = Ho(r), B = N == null ? void 0 : N.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 } = En(r, ((ut = K.record) == null ? void 0 : ut.id) ?? null), O = b(
422
- () => t ? Nt(t, T).active : 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,
423
424
  [t, T]
424
425
  );
425
- wr(kt);
426
- const ge = b(() => br(O), [O]), ke = Fo(r, t, T), { data: Lt } = Be(u), Z = Mr(t, Lt ?? null, n.unsavedCount, u), { data: Et } = So(u, t != null), [ze, Dt] = R([]), Ft = b(() => {
427
- const e = Ar(ze), a = /* @__PURE__ */ new WeakMap();
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();
428
429
  return (f) => {
429
430
  if (!f || !e) return bt(f, e);
430
431
  const w = a.get(f);
@@ -432,19 +433,19 @@ function vs({
432
433
  const F = bt(f, e);
433
434
  return a.set(f, F), F;
434
435
  };
435
- }, [ze]), [ce, It] = mo(), we = go(r, O, ce), ue = ko(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] = R({ reason: "", ticket: "" }), [Ve, He] = R(null), Ne = j(pe);
436
- Ne.current = pe;
437
- const We = C(async () => {
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 () => {
438
439
  const e = D ? {
439
- ...qr(Ne.current),
440
- ...X ? { freeze_override: Ne.current.reason.trim() } : {}
440
+ ...Ur(Le.current),
441
+ ...X ? { freeze_override: Le.current.reason.trim() } : {}
441
442
  } : void 0;
442
443
  await n.save(e);
443
444
  const a = n.unsavedOps().length === 0;
444
445
  return a && e && Pe((f) => ({ ...f, reason: "" })), a;
445
446
  }, [n.save, n.unsavedOps, D, X]), je = C(() => {
446
447
  var e, a;
447
- return D ? (n.unsavedOps().length > 0 && He(
448
+ return D ? (n.unsavedOps().length > 0 && We(
448
449
  ((e = $.current) == null ? void 0 : e.querySelector("[data-editor-save]")) ?? ((a = $.current) == null ? void 0 : a.querySelector("[data-editor-topbar]")) ?? null
449
450
  ), Promise.resolve()) : n.save();
450
451
  }, [D, n.save, n.unsavedOps]);
@@ -452,16 +453,16 @@ function vs({
452
453
  D && n.autosave && n.setAutosave(!1);
453
454
  }, [D, n.autosave, n.setAutosave]);
454
455
  const Kt = D ? { ...n, save: je, setAutosave: void 0 } : n;
455
- Pn(D ? { ...n, save: je } : n), Rn(n);
456
- const $ = j(null), [_t, Ge] = R(null), Qe = j(n.dirty);
456
+ Ln(D ? { ...n, save: je } : n), Rn(n);
457
+ const $ = j(null), [_t, Ge] = N(null), Qe = j(n.dirty);
457
458
  Qe.current = n.dirty;
458
459
  const oe = C((e, a, f) => {
459
460
  var F, me;
460
461
  if (!Qe.current) return a();
461
462
  const w = ((F = $.current) == null ? void 0 : F.querySelector("[data-editor-save]")) ?? ((me = $.current) == null ? void 0 : me.querySelector("[data-editor-topbar]")) ?? null;
462
463
  Ge({ what: e, go: a, anchor: f ?? w });
463
- }, []), Mt = We;
464
- Dn(n.dirty, (e, a) => oe("leave this page", e, a)), U(() => {
464
+ }, []), Mt = He;
465
+ Fn(n.dirty, (e, a) => oe("leave this page", e, a)), U(() => {
465
466
  v == null || v(n.dirty);
466
467
  }, [n.dirty, v]);
467
468
  const Ye = j(n.unsavedOps);
@@ -471,23 +472,23 @@ function vs({
471
472
  },
472
473
  []
473
474
  );
474
- const Je = Rt(r), Ze = C(() => {
475
+ const Je = Nt(r), Ze = C(() => {
475
476
  const e = n.whenIdle();
476
477
  e.then(() => Je()), s(e);
477
- }, [n.whenIdle, Je, s]), Re = C(
478
- (e) => oe(i === "overlay" ? "go back to the record" : "leave this form", Ze, e),
479
- [oe, Ze, i]
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]
480
481
  );
481
482
  U(() => {
482
483
  if (!t || h.length === 0) return;
483
484
  const e = h.filter((a) => qe(a, t, T));
484
- e.length !== h.length && L(e);
485
+ e.length !== h.length && R(e);
485
486
  }, [h, t, T]);
486
- const ne = i === "overlay", [Le, Bt] = R(null), Ee = j(!1), qt = C((e) => {
487
+ const ne = l === "overlay", [Re, Bt] = N(null), Ee = j(!1), qt = C((e) => {
487
488
  Ee.current = e;
488
- }, []), Ut = Fn(ne && Le != null, () => Re(), Ee), A = C((e, a) => {
489
- L((f) => Qr(f, e, a)), P("inspector");
490
- }, []), Xe = C((e) => L([e]), []), q = io(t, n.apply), $t = b(() => q.intercept(A), [q.intercept, A]), [De, zt] = R(!1), Fe = co(), Ie = b(
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(
491
492
  () => ({
492
493
  tabOrderActive: q.active,
493
494
  startTabOrder: () => {
@@ -499,7 +500,7 @@ function vs({
499
500
  (e, a) => {
500
501
  if (e.kind === "group") return A({ kind: "group", key: e.key });
501
502
  if (e.kind === "tab") {
502
- A(a), (a.kind === "field" || a.kind === "header") && Po(a.field, e.tab);
503
+ A(a), (a.kind === "field" || a.kind === "header") && Lo(a.field, e.tab);
503
504
  return;
504
505
  }
505
506
  if (e.kind === "pipeline")
@@ -517,14 +518,14 @@ function vs({
517
518
  const e = /* @__PURE__ */ new Map();
518
519
  for (const [a, f] of ue)
519
520
  (f.type === "boolean" || f.text.endsWith(" linked")) && e.set(a, f.text);
520
- return fo(we, { chips: ce, ghostTags: e, open: et });
521
- }, [we, ce, ue, et]), Ht = b(
521
+ return yo(we, { chips: ce, ghostTags: e, open: et });
522
+ }, [we, ce, ue, et]), Wt = b(
522
523
  () => ue.size > 0 ? (e) => {
523
524
  var a;
524
525
  return ((a = ue.get(e)) == null ? void 0 : a.text) ?? null;
525
526
  } : void 0,
526
527
  [ue]
527
- ), Wt = C(
528
+ ), Ht = C(
528
529
  (e) => {
529
530
  const a = t == null ? void 0 : t.placements.find((w) => w.field === e);
530
531
  if (!a) return;
@@ -539,7 +540,7 @@ function vs({
539
540
  [t, A]
540
541
  );
541
542
  Nn(t, h, n.apply, Ee, Xe);
542
- const Ke = Xo(u, re ? z(re) : null), tt = b(() => en(Ke), [Ke]), jt = C(
543
+ const Ke = en(u, re ? z(re) : null), tt = b(() => tn(Ke), [Ke]), jt = C(
543
544
  (e) => (tt.get(z(e)) ?? []).map((a) => ({
544
545
  id: a.id,
545
546
  name: a.name,
@@ -547,26 +548,26 @@ function vs({
547
548
  chip: a.tone.chip
548
549
  })),
549
550
  [tt]
550
- ), rt = b(() => vn(n.unsavedSteps), [n.unsavedSteps]), Gt = C((e) => rt.has(z(e)), [rt]), [ot, be] = R(null), nt = C((e) => {
551
- se("canvas"), L([e]), P("inspector"), requestAnimationFrame(() => {
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(() => {
552
553
  var f;
553
554
  const a = document.querySelector(
554
555
  `[data-layout-editor] [data-design-target="${CSS.escape(z(e))}"]`
555
556
  );
556
557
  (f = a == null ? void 0 : a.scrollIntoView) == null || f.call(a, { block: "center" }), a == null || a.focus({ preventScroll: !0 });
557
558
  });
558
- }, []), Qt = kr(), W = un(u), at = pn(), Yt = b(
559
+ }, []), Qt = kr(), H = pn(u), at = mn(), Yt = b(
559
560
  () => {
560
561
  var e, a;
561
562
  return {
562
- settled: W.isFetched || W.isError,
563
- draft: ((e = W.data) == null ? void 0 : e.data) ?? null,
564
- available: ((a = W.data) == null ? void 0 : a.available) ?? !W.isError,
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,
565
566
  writer: at
566
567
  };
567
568
  },
568
- [W.isFetched, W.isError, W.data, at]
569
- ), xe = eo(n, u, Qt, Yt), Jt = C(
569
+ [H.isFetched, H.isError, H.data, at]
570
+ ), xe = to(n, u, Qt, Yt), Jt = C(
570
571
  (e) => J((a) => a.roleId === e ? a : { ...a, roleId: e }),
571
572
  []
572
573
  ), ee = (e) => {
@@ -576,16 +577,16 @@ function vs({
576
577
  oe(
577
578
  "open another form",
578
579
  () => {
579
- n.flush(), L([]), g(e), m == null || m(e);
580
+ n.flush(), R([]), g(e), m == null || m(e);
580
581
  },
581
582
  f
582
583
  );
583
- }, Zt = nn(r, t, (N == null ? void 0 : N.rows) ?? [], ee), Xt = C(
584
- (e) => t ? Er(e, {
584
+ }, Zt = an(r, t, (L == null ? void 0 : L.rows) ?? [], ee), Xt = C(
585
+ (e) => t ? Dr(e, {
585
586
  bundle: t,
586
587
  selection: h,
587
588
  select: (a) => {
588
- L([a]), P("inspector");
589
+ R([a]), P("inspector");
589
590
  },
590
591
  openSettings: () => P("settings"),
591
592
  openAddPanel: () => te("add"),
@@ -612,7 +613,7 @@ function vs({
612
613
  }
613
614
  },
614
615
  [t, A]
615
- ), 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 = $o({
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({
616
617
  bodyRef: $,
617
618
  bundle: t,
618
619
  parent: T,
@@ -621,7 +622,7 @@ function vs({
621
622
  showHidden: ve,
622
623
  setShowHidden: ie,
623
624
  canvasShown: !(x && I === "table")
624
- }), it = S.outlineOpen && !!t && x, lt = p.warning ?? (N == null ? void 0 : N.warning) ?? null, tr = ne ? {
625
+ }), it = S.outlineOpen && !!t && x, lt = p.warning ?? (L == null ? void 0 : L.warning) ?? null, tr = ne ? {
625
626
  role: "dialog",
626
627
  "aria-modal": !0,
627
628
  "aria-label": `Edit form ${Se}`,
@@ -633,7 +634,7 @@ function vs({
633
634
  $.current = e, ne && (Ut.current = e);
634
635
  },
635
636
  "data-layout-editor": "",
636
- "data-mode": i,
637
+ "data-mode": l,
637
638
  ...tr,
638
639
  className: G(
639
640
  "flex min-h-0 flex-col bg-slate-50 outline-none dark:bg-background",
@@ -641,7 +642,7 @@ function vs({
641
642
  ),
642
643
  children: [
643
644
  /* @__PURE__ */ o(
644
- no,
645
+ ao,
645
646
  {
646
647
  collection: r,
647
648
  layoutId: u,
@@ -654,16 +655,16 @@ function vs({
654
655
  onPreview: J,
655
656
  showHidden: ve,
656
657
  onShowHidden: ie,
657
- onBack: Re,
658
+ onBack: Ne,
658
659
  backLabel: ne ? "Back to record" : "Forms",
659
660
  onShowOnCanvas: Z.showVersion,
660
661
  onReviewChanges: Z.toggleReview,
661
662
  reviewing: ((ft = Z.compare) == null ? void 0 : ft.kind) === "unsaved",
662
663
  onOpenUnsaved: be,
663
- pendingTip: to(xe.sync),
664
+ pendingTip: ro(xe.sync),
664
665
  presence: /* @__PURE__ */ y(ae, { children: [
665
666
  /* @__PURE__ */ o(
666
- Vr,
667
+ Wr,
667
668
  {
668
669
  peers: Ke,
669
670
  describe: (e) => {
@@ -676,7 +677,7 @@ function vs({
676
677
  }
677
678
  }
678
679
  ),
679
- /* @__PURE__ */ o(an, { others: ((yt = W.data) == null ? void 0 : yt.others) ?? [] })
680
+ /* @__PURE__ */ o(sn, { others: ((yt = H.data) == null ? void 0 : yt.others) ?? [] })
680
681
  ] }),
681
682
  onSelectField: (e) => {
682
683
  var a;
@@ -687,17 +688,17 @@ function vs({
687
688
  });
688
689
  },
689
690
  view: t && x ? /* @__PURE__ */ y(ae, { children: [
690
- /* @__PURE__ */ o(_n, { view: I, onView: se }),
691
- /* @__PURE__ */ o(yo, { on: ce, onChange: It })
691
+ /* @__PURE__ */ o(Mn, { view: I, onView: se }),
692
+ /* @__PURE__ */ o(ho, { on: ce, onChange: It })
692
693
  ] }) : null,
693
694
  tools: /* @__PURE__ */ y(ae, { children: [
694
- t && x && /* @__PURE__ */ o(Tr, { bundle: t, apply: n.apply }),
695
- t && /* @__PURE__ */ o(_o, { find: S.find }),
696
- t && x && /* @__PURE__ */ o(wo, { bundle: t, apply: n.apply, collection: r }),
695
+ t && x && /* @__PURE__ */ o(Or, { bundle: t, apply: n.apply }),
696
+ t && /* @__PURE__ */ o(Mo, { find: S.find }),
697
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 }),
698
699
  /* @__PURE__ */ o(Ce, {}),
699
700
  t && /* @__PURE__ */ o(
700
- Mo,
701
+ Bo,
701
702
  {
702
703
  outline: x ? {
703
704
  open: S.outlineOpen,
@@ -706,7 +707,7 @@ function vs({
706
707
  }
707
708
  ),
708
709
  t && /* @__PURE__ */ o(
709
- Bo,
710
+ qo,
710
711
  {
711
712
  view: x && I === "canvas" ? {
712
713
  compact: S.compact,
@@ -739,7 +740,7 @@ function vs({
739
740
  }
740
741
  ),
741
742
  t && x && /* @__PURE__ */ o(
742
- uo,
743
+ po,
743
744
  {
744
745
  on: De,
745
746
  onChange: zt,
@@ -749,7 +750,7 @@ function vs({
749
750
  ),
750
751
  /* @__PURE__ */ o(Ce, {}),
751
752
  /* @__PURE__ */ o(
752
- Fr,
753
+ Ir,
753
754
  {
754
755
  collection: r,
755
756
  layoutId: u,
@@ -757,13 +758,13 @@ function vs({
757
758
  recorder: fe
758
759
  }
759
760
  ),
760
- /* @__PURE__ */ o(xo, { bundle: t, collection: r }),
761
+ /* @__PURE__ */ o(So, { bundle: t, collection: r }),
761
762
  /* @__PURE__ */ o(Ce, {}),
762
- t && /* @__PURE__ */ o(qo, { shortcuts: S.shortcuts })
763
+ t && /* @__PURE__ */ o(Uo, { shortcuts: S.shortcuts })
763
764
  ] }),
764
765
  ai: /* @__PURE__ */ y(ae, { children: [
765
766
  t && x && /* @__PURE__ */ o(
766
- Pr,
767
+ Lr,
767
768
  {
768
769
  collection: r,
769
770
  layoutId: u,
@@ -772,7 +773,7 @@ function vs({
772
773
  }
773
774
  ),
774
775
  t && /* @__PURE__ */ o(
775
- Or,
776
+ Ar,
776
777
  {
777
778
  collection: r,
778
779
  layoutId: u,
@@ -791,11 +792,11 @@ function vs({
791
792
  onClick: () => P((e) => e === "ask" ? "inspector" : "ask")
792
793
  }
793
794
  ),
794
- /* @__PURE__ */ o(Gr, { collection: r, layoutId: u, draft: n }),
795
- t && /* @__PURE__ */ o(Dr, { layoutId: u, draft: n })
795
+ /* @__PURE__ */ o(Qr, { collection: r, layoutId: u, draft: n }),
796
+ t && /* @__PURE__ */ o(Fr, { layoutId: u, draft: n })
796
797
  ] }),
797
798
  testing: t ? /* @__PURE__ */ o(
798
- fn,
799
+ yn,
799
800
  {
800
801
  collection: r,
801
802
  layoutId: u,
@@ -807,7 +808,7 @@ function vs({
807
808
  }
808
809
  ) : null,
809
810
  beforeSave: t ? /* @__PURE__ */ o(
810
- mn,
811
+ fn,
811
812
  {
812
813
  collection: r,
813
814
  layoutId: u,
@@ -820,7 +821,7 @@ function vs({
820
821
  ) : null,
821
822
  previewExtra: /* @__PURE__ */ y(ae, { children: [
822
823
  /* @__PURE__ */ o(
823
- tn,
824
+ rn,
824
825
  {
825
826
  collection: r,
826
827
  value: K,
@@ -829,10 +830,10 @@ function vs({
829
830
  fields: _
830
831
  }
831
832
  ),
832
- /* @__PURE__ */ o(xr, { scope: kt, options: ge })
833
+ /* @__PURE__ */ o(Sr, { scope: kt, options: ge })
833
834
  ] }),
834
835
  problems: t && /* @__PURE__ */ o(
835
- Eo,
836
+ Do,
836
837
  {
837
838
  findings: ke.findings,
838
839
  active: V === "checks",
@@ -840,7 +841,7 @@ function vs({
840
841
  }
841
842
  ),
842
843
  more: /* @__PURE__ */ o(
843
- on,
844
+ nn,
844
845
  {
845
846
  collection: r,
846
847
  bundle: t,
@@ -851,15 +852,15 @@ function vs({
851
852
  }
852
853
  ),
853
854
  ne && /* @__PURE__ */ o(
854
- Kn,
855
+ _n,
855
856
  {
856
857
  collection: r,
857
858
  layoutId: u,
858
859
  name: Se,
859
860
  row: B,
860
- rows: (N == null ? void 0 : N.rows) ?? [],
861
+ rows: (L == null ? void 0 : L.rows) ?? [],
861
862
  fields: _,
862
- onDone: Re
863
+ onDone: Ne
863
864
  }
864
865
  ),
865
866
  n.status === "conflict" && n.dirty && /* @__PURE__ */ y(
@@ -886,7 +887,7 @@ function vs({
886
887
  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",
887
888
  children: [
888
889
  "Reload (discard my ",
889
- yn(n.unsavedCount),
890
+ hn(n.unsavedCount),
890
891
  ")"
891
892
  ]
892
893
  }
@@ -896,7 +897,7 @@ function vs({
896
897
  ),
897
898
  /* @__PURE__ */ o(Hr, { labels: n.dropped, onDismiss: n.clearDropped }),
898
899
  /* @__PURE__ */ o(
899
- Wr,
900
+ jr,
900
901
  {
901
902
  state: xe.state,
902
903
  onRecover: xe.recover,
@@ -932,9 +933,9 @@ function vs({
932
933
  ]
933
934
  }
934
935
  ),
935
- /* @__PURE__ */ o(ho, { explain: we, onShow: Wt }),
936
+ /* @__PURE__ */ o(vo, { explain: we, onShow: Ht }),
936
937
  /* @__PURE__ */ o(
937
- Jr,
938
+ Zr,
938
939
  {
939
940
  bundle: t,
940
941
  apply: n.apply,
@@ -1006,7 +1007,7 @@ function vs({
1006
1007
  }
1007
1008
  ),
1008
1009
  /* @__PURE__ */ o("div", { className: "min-h-0 flex-1 overflow-y-auto", children: E === "add" && t ? /* @__PURE__ */ o(
1009
- Cr,
1010
+ Tr,
1010
1011
  {
1011
1012
  bundle: t,
1012
1013
  collection: r,
@@ -1015,7 +1016,7 @@ function vs({
1015
1016
  onSelect: A
1016
1017
  }
1017
1018
  ) : E === "usage" && t ? /* @__PURE__ */ o(
1018
- gn,
1019
+ kn,
1019
1020
  {
1020
1021
  bundle: t,
1021
1022
  collection: r,
@@ -1026,7 +1027,7 @@ function vs({
1026
1027
  onOpenLayout: ee
1027
1028
  }
1028
1029
  ) : /* @__PURE__ */ o(
1029
- Lo,
1030
+ Eo,
1030
1031
  {
1031
1032
  collection: r,
1032
1033
  currentId: u,
@@ -1045,7 +1046,7 @@ function vs({
1045
1046
  "data-editor-outline-panel": "",
1046
1047
  className: "flex w-[260px] shrink-0 flex-col border-r border-slate-200 bg-white dark:border-border dark:bg-card",
1047
1048
  children: /* @__PURE__ */ o(
1048
- Uo,
1049
+ $o,
1049
1050
  {
1050
1051
  bundle: t,
1051
1052
  nodes: S.nodes,
@@ -1059,10 +1060,10 @@ function vs({
1059
1060
  }
1060
1061
  ),
1061
1062
  /* @__PURE__ */ y("main", { className: "min-w-0 flex-1 overflow-y-auto", children: [
1062
- I === "canvas" && /* @__PURE__ */ o(lo, { editor: q }),
1063
- Z.compare && (I === "canvas" || !x) && /* @__PURE__ */ o(Br, { compare: Z.compare, onClose: Z.close }),
1063
+ I === "canvas" && /* @__PURE__ */ o(co, { editor: q }),
1064
+ Z.compare && (I === "canvas" || !x) && /* @__PURE__ */ o(qr, { compare: Z.compare, onClose: Z.close }),
1064
1065
  t && x && I === "states" ? /* @__PURE__ */ o(
1065
- Io,
1066
+ Ko,
1066
1067
  {
1067
1068
  bundle: t,
1068
1069
  parent: T,
@@ -1071,7 +1072,7 @@ function vs({
1071
1072
  onSelect: A
1072
1073
  }
1073
1074
  ) : t && x && I === "roles" ? /* @__PURE__ */ o(
1074
- Ko,
1075
+ _o,
1075
1076
  {
1076
1077
  bundle: t,
1077
1078
  parent: T,
@@ -1079,7 +1080,7 @@ function vs({
1079
1080
  onSelect: A
1080
1081
  }
1081
1082
  ) : t && x && I === "table" ? /* @__PURE__ */ o(
1082
- Yo,
1083
+ Jo,
1083
1084
  {
1084
1085
  bundle: t,
1085
1086
  collection: r,
@@ -1087,20 +1088,20 @@ function vs({
1087
1088
  flush: n.flush,
1088
1089
  selection: h,
1089
1090
  onSelect: A,
1090
- onSelection: L
1091
+ onSelection: R
1091
1092
  }
1092
1093
  ) : t ? /* @__PURE__ */ o(
1093
1094
  "div",
1094
1095
  {
1095
1096
  "data-canvas-density": S.compact && x ? "compact" : "normal",
1096
- style: S.compact && x ? { zoom: zo } : void 0,
1097
+ style: S.compact && x ? { zoom: Vo } : void 0,
1097
1098
  className: G(
1098
1099
  "min-h-full",
1099
- po(De, Fe),
1100
+ mo(De, Fe),
1100
1101
  De && !Fe && "bg-background text-foreground"
1101
1102
  ),
1102
1103
  children: /* @__PURE__ */ o(
1103
- rn,
1104
+ on,
1104
1105
  {
1105
1106
  collection: r,
1106
1107
  bundle: t,
@@ -1110,7 +1111,7 @@ function vs({
1110
1111
  record: k,
1111
1112
  fields: _,
1112
1113
  renderPane: (e) => /* @__PURE__ */ o(
1113
- In,
1114
+ Kn,
1114
1115
  {
1115
1116
  collection: r,
1116
1117
  bundle: t,
@@ -1120,7 +1121,7 @@ function vs({
1120
1121
  marks: Ft(e.marks),
1121
1122
  overlay: q.overlay(e.overlay),
1122
1123
  ruleMarks: Vt,
1123
- ghost: Ht,
1124
+ ghost: Wt,
1124
1125
  deps: we.deps,
1125
1126
  noDnd: e.noDnd,
1126
1127
  record: e.record,
@@ -1157,7 +1158,7 @@ function vs({
1157
1158
  {
1158
1159
  layoutId: u,
1159
1160
  layoutName: Se,
1160
- kind: cn(t.layout),
1161
+ kind: un(t.layout),
1161
1162
  bundle: t,
1162
1163
  thread: Te,
1163
1164
  setThread: ye,
@@ -1168,17 +1169,17 @@ function vs({
1168
1169
  recordId: ((ht = K.record) == null ? void 0 : ht.id) ?? null
1169
1170
  }
1170
1171
  ) : V === "checks" ? /* @__PURE__ */ o(
1171
- Do,
1172
+ Fo,
1172
1173
  {
1173
1174
  findings: ke.findings,
1174
1175
  health: ke.health,
1175
1176
  ready: ke.ready,
1176
- onSelect: (e) => L([e]),
1177
+ onSelect: (e) => R([e]),
1177
1178
  apply: n.apply,
1178
1179
  onOpenAiReview: p.aiReviewSlot ? () => P("settings") : void 0
1179
1180
  }
1180
1181
  ) : V === "settings" ? /* @__PURE__ */ o(
1181
- On,
1182
+ An,
1182
1183
  {
1183
1184
  bundle: t,
1184
1185
  apply: n.apply,
@@ -1191,16 +1192,16 @@ function vs({
1191
1192
  } : void 0
1192
1193
  }
1193
1194
  ) : h.length > 1 ? /* @__PURE__ */ o(
1194
- Ao,
1195
+ Po,
1195
1196
  {
1196
1197
  bundle: t,
1197
1198
  selection: h,
1198
1199
  apply: n.apply,
1199
1200
  collection: r,
1200
- onSelection: L
1201
+ onSelection: R
1201
1202
  }
1202
1203
  ) : /* @__PURE__ */ o(
1203
- An,
1204
+ Pn,
1204
1205
  {
1205
1206
  bundle: t,
1206
1207
  target: re,
@@ -1217,29 +1218,29 @@ function vs({
1217
1218
  }
1218
1219
  ),
1219
1220
  /* @__PURE__ */ o(
1220
- sn,
1221
+ ln,
1221
1222
  {
1222
1223
  bundle: t,
1223
1224
  selection: h,
1224
1225
  apply: n.apply,
1225
- onSelection: L,
1226
+ onSelection: R,
1226
1227
  rootRef: $
1227
1228
  }
1228
1229
  ),
1229
1230
  /* @__PURE__ */ o(
1230
- hn,
1231
+ vn,
1231
1232
  {
1232
1233
  request: _t,
1233
1234
  count: n.unsavedCount,
1234
1235
  onSave: Mt,
1235
1236
  onDiscard: n.discard,
1236
1237
  onKeep: () => Ge(null),
1237
- note: D ? /* @__PURE__ */ o($r, { policy: D, value: pe, onChange: Pe }) : void 0,
1238
- canSave: Ur(D, pe)
1238
+ note: D ? /* @__PURE__ */ o(zr, { policy: D, value: pe, onChange: Pe }) : void 0,
1239
+ canSave: $r(D, pe)
1239
1240
  }
1240
1241
  ),
1241
1242
  D && Ve && /* @__PURE__ */ o(
1242
- zr,
1243
+ Vr,
1243
1244
  {
1244
1245
  open: !0,
1245
1246
  anchor: Ve,
@@ -1248,12 +1249,12 @@ function vs({
1248
1249
  count: n.unsavedCount,
1249
1250
  value: pe,
1250
1251
  onChange: Pe,
1251
- onSave: We,
1252
- onClose: () => He(null)
1252
+ onSave: He,
1253
+ onClose: () => We(null)
1253
1254
  }
1254
1255
  ),
1255
1256
  ot && /* @__PURE__ */ o(
1256
- jr,
1257
+ Gr,
1257
1258
  {
1258
1259
  anchor: ot,
1259
1260
  steps: n.unsavedSteps,
@@ -1273,18 +1274,18 @@ function vs({
1273
1274
  );
1274
1275
  if (!ne)
1275
1276
  return /* @__PURE__ */ o(St.Provider, { value: Ie, children: dt });
1276
- const ct = c ?? (Le ? Sr(Le) ?? document.body : null);
1277
+ const ct = c ?? (Re ? Cr(Re) ?? document.body : null);
1277
1278
  return /* @__PURE__ */ y(ae, { children: [
1278
1279
  /* @__PURE__ */ o("span", { ref: Bt, hidden: !0, "data-layout-editor-marker": "" }),
1279
1280
  /* @__PURE__ */ o(St.Provider, { value: Ie, children: ct && mr(dt, ct) })
1280
1281
  ] });
1281
1282
  }
1282
1283
  function At(r) {
1283
- const l = r.reason.trim() ? `: ${r.reason.trim()}` : "";
1284
- return `Frozen until ${gr(r.until)}${l}. Saving asks for an override note, kept in History.`;
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.`;
1285
1286
  }
1286
1287
  export {
1287
- vs as LayoutEditor,
1288
+ ks as LayoutEditor,
1288
1289
  $e as isTyping,
1289
1290
  qe as targetExists
1290
1291
  };