@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,48 +1,49 @@
1
- import { jsxs as r, jsx as e, Fragment as I } from "react/jsx-runtime";
2
- import { ChevronLeft as de, Undo2 as ie, Redo2 as ce, Wrench as me, Sparkles as he, History as pe, MoreHorizontal as ue, Save as z, GitCompare as be, ChevronDown as q, Eye as Y, X as xe } from "lucide-react";
3
- import { useState as W, useMemo as ve, useCallback as ge } from "react";
4
- import { useNivaroClient as we } from "../../context.js";
5
- import { useDebounced as fe } from "../../hooks/useDebounced.js";
6
- import { useRelationOptions as ke } from "../../hooks/useRelationOptions.js";
7
- import { titleCase as Ne, cn as h } from "../../lib/utils.js";
8
- import { usePretendDownIds as ye, LAYOUT_PRETEND_SCOPE as Ce } from "../PretendDown.js";
9
- import { useOverflowTip as Se } from "../TipLayer.js";
10
- import { Popover as K, PopoverTrigger as Q, PopoverContent as V } from "../ui/popover.js";
11
- import { SimpleSelect as Oe } from "../ui/SimpleSelect.js";
12
- import { AiChangeCheck as Re } from "./ai/ChangeCheck.js";
13
- import { ShareButton as Pe, WatchButton as Ae } from "./collab/FormFollowShare.js";
14
- import { HistoryPanel as Te } from "./HistoryPanel.js";
15
- import { useRuleChoiceLabels as Be, useDisplayTemplate as Le, useRoleNames as Ue } from "./overview/overview-api.js";
16
- import { rowPill as Ee, purposeSegments as De, TYPE_USE as G, Pill as $e, Sentence as Me } from "./overview/purpose.js";
17
- import { ScheduleChange as je } from "./ScheduleChange.js";
18
- import { barIconBtn as j, BarMenu as A, barIconOn as He, MenuSeparator as H, ToolButton as J, barBtnOn as Ie, barBtn as We } from "./toolbar-kit.js";
19
- import { unsavedText as Z } from "./UnsavedConfirm.js";
20
- const Ze = "h-8 w-full rounded-md border border-slate-200 bg-white px-2.5 text-[12.5px] text-slate-800 outline-none placeholder:text-slate-400 focus:border-nvr-cyan dark:border-border dark:bg-background dark:text-foreground dark:placeholder:text-muted-foreground", X = "mb-1 block text-[11.5px] font-semibold text-slate-600 dark:text-muted-foreground", _e = `
1
+ import { jsxs as n, jsx as e, Fragment as Z } from "react/jsx-runtime";
2
+ import { ChevronLeft as ie, Undo2 as ce, Redo2 as me, Wrench as ue, Sparkles as he, History as pe, MoreHorizontal as be, Save as z, GitCompare as xe, ChevronDown as X, Eye as Y, X as ge, RotateCcw as ve } from "lucide-react";
3
+ import { useState as E, useMemo as we, useCallback as q, useRef as fe, useEffect as ke } from "react";
4
+ import { useNivaroClient as Ne } from "../../context.js";
5
+ import { useDebounced as ye } from "../../hooks/useDebounced.js";
6
+ import { useRelationOptions as Ce } from "../../hooks/useRelationOptions.js";
7
+ import { titleCase as Se, cn as u } from "../../lib/utils.js";
8
+ import { usePretendDownIds as Re, LAYOUT_PRETEND_SCOPE as Oe } from "../PretendDown.js";
9
+ import { useOverflowTip as Te } from "../TipLayer.js";
10
+ import { Popover as Q, PopoverTrigger as V, PopoverContent as ee } from "../ui/popover.js";
11
+ import { SimpleSelect as Pe } from "../ui/SimpleSelect.js";
12
+ import { AiChangeCheck as Ae } from "./ai/ChangeCheck.js";
13
+ import { ShareButton as Be, WatchButton as De } from "./collab/FormFollowShare.js";
14
+ import { HistoryPanel as Ee } from "./HistoryPanel.js";
15
+ import { useRuleChoiceLabels as Le, useDisplayTemplate as Ue, useRoleNames as $e } from "./overview/overview-api.js";
16
+ import { rowPill as Me, purposeSegments as je, TYPE_USE as G, Pill as He, Sentence as Ie } from "./overview/purpose.js";
17
+ import { SampleRecordChip as We, SampleRecordOffer as Ze } from "./preview/SampleRecord.js";
18
+ import { ScheduleChange as _e } from "./ScheduleChange.js";
19
+ import { barIconBtn as I, BarMenu as D, barIconOn as Fe, MenuSeparator as W, ToolButton as J, barBtnOn as ze, barBtn as Ye } from "./toolbar-kit.js";
20
+ import { unsavedText as L } from "./UnsavedConfirm.js";
21
+ const Ge = "h-8 w-full rounded-md border border-slate-200 bg-white px-2.5 text-[12.5px] text-slate-800 outline-none placeholder:text-slate-400 focus:border-nvr-cyan dark:border-border dark:bg-background dark:text-foreground dark:placeholder:text-muted-foreground", K = "mb-1 block text-[11.5px] font-semibold text-slate-600 dark:text-muted-foreground", Je = `
21
22
  [data-editor-topbar]{container-type:inline-size;container-name:letb}
22
23
  @container letb (max-width: 1499px){[data-editor-topbar] [data-tb-sentence]{display:none}}
23
24
  @container letb (max-width: 1399px){[data-editor-topbar] [data-tb-xwide]{display:none}}
24
25
  @container letb (max-width: 1099px){[data-editor-topbar] [data-tb-wide],[data-editor-topbar] [data-tb-menu-label]{display:none}}
25
26
  @container letb (min-width: 1100px){[data-editor-topbar] [data-tb-name]{min-width:140px}}
26
27
  `;
27
- function Fe({
28
+ function Ke({
28
29
  draft: i,
29
30
  onOpen: a,
30
- pendingTip: c
31
+ pendingTip: d
31
32
  }) {
32
- const { status: n, error: s } = i, l = i.unsavedCount ?? 0, t = l > 0 && (n === "idle" || n === "saved"), m = n === "saving" ? "Saving…" : n === "error" ? s ?? "Not saved" : n === "conflict" ? l > 0 ? "Not saved — someone else saved" : "Reloaded — someone else saved" : t ? Z(l) : "Saved", u = /* @__PURE__ */ r(
33
+ const { status: r, error: o } = i, l = i.unsavedCount ?? 0, t = l > 0 && (r === "idle" || r === "saved"), m = r === "saving" ? "Saving…" : r === "error" ? o ?? "Not saved" : r === "conflict" ? l > 0 ? "Not saved — someone else saved" : "Reloaded — someone else saved" : t ? L(l) : "Saved", p = /* @__PURE__ */ n(
33
34
  "span",
34
35
  {
35
36
  role: "status",
36
- "data-save-status": n,
37
+ "data-save-status": r,
37
38
  "data-unsaved": l,
38
- "data-tip": (n === "error" || n === "conflict") && s ? s : t ? c ?? "Only you see these changes until you save (⌘S)" : void 0,
39
- className: h(
39
+ "data-tip": (r === "error" || r === "conflict") && o ? o : t ? d ?? "Only you see these changes until you save (⌘S)" : void 0,
40
+ className: u(
40
41
  "inline-flex max-w-[180px] shrink-0 items-center gap-1 whitespace-nowrap rounded-full px-2 py-px text-[11px] font-semibold",
41
- n === "saving" && "bg-slate-100 text-slate-600 dark:bg-muted dark:text-muted-foreground",
42
- (n === "saved" || n === "idle") && !t && "bg-emerald-50 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-300",
42
+ r === "saving" && "bg-slate-100 text-slate-600 dark:bg-muted dark:text-muted-foreground",
43
+ (r === "saved" || r === "idle") && !t && "bg-emerald-50 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-300",
43
44
  t && "bg-nvr-cyan/10 text-slate-700 dark:text-foreground",
44
- n === "error" && "bg-red-50 text-red-700 dark:bg-red-500/15 dark:text-red-300",
45
- n === "conflict" && "bg-amber-50 text-amber-700 dark:bg-amber-500/15 dark:text-amber-300"
45
+ r === "error" && "bg-red-50 text-red-700 dark:bg-red-500/15 dark:text-red-300",
46
+ r === "conflict" && "bg-amber-50 text-amber-700 dark:bg-amber-500/15 dark:text-amber-300"
46
47
  ),
47
48
  children: [
48
49
  t && /* @__PURE__ */ e("span", { "aria-hidden": !0, className: "h-1.5 w-1.5 shrink-0 rounded-full bg-nvr-cyan" }),
@@ -50,51 +51,51 @@ function Fe({
50
51
  ]
51
52
  }
52
53
  );
53
- return !t || !a ? u : /* @__PURE__ */ e(
54
+ return !t || !a ? p : /* @__PURE__ */ e(
54
55
  "button",
55
56
  {
56
57
  type: "button",
57
58
  "data-unsaved-list-open": "",
58
- "aria-label": `${Z(l)} — list them`,
59
+ "aria-label": `${L(l)} — list them`,
59
60
  onClick: (b) => a(b.currentTarget),
60
61
  className: "inline-flex rounded-full transition-opacity hover:opacity-80",
61
- children: u
62
+ children: p
62
63
  }
63
64
  );
64
65
  }
65
- function ze({
66
+ function Xe({
66
67
  icon: i,
67
68
  label: a,
68
- hint: c,
69
- on: n,
70
- onChange: s,
69
+ hint: d,
70
+ on: r,
71
+ onChange: o,
71
72
  data: l
72
73
  }) {
73
- return /* @__PURE__ */ r("div", { className: "flex items-start gap-2 text-[12.5px] text-slate-700 dark:text-foreground", children: [
74
+ return /* @__PURE__ */ n("div", { className: "flex items-start gap-2 text-[12.5px] text-slate-700 dark:text-foreground", children: [
74
75
  /* @__PURE__ */ e("span", { className: "mt-0.5 text-slate-500 dark:text-muted-foreground", children: i }),
75
- /* @__PURE__ */ r("span", { className: "flex min-w-0 flex-1 flex-col", children: [
76
+ /* @__PURE__ */ n("span", { className: "flex min-w-0 flex-1 flex-col", children: [
76
77
  /* @__PURE__ */ e("span", { className: "font-medium", children: a }),
77
- /* @__PURE__ */ e("span", { className: "text-[11.5px] leading-snug text-slate-500 dark:text-muted-foreground", children: c })
78
+ /* @__PURE__ */ e("span", { className: "text-[11.5px] leading-snug text-slate-500 dark:text-muted-foreground", children: d })
78
79
  ] }),
79
80
  /* @__PURE__ */ e(
80
81
  "button",
81
82
  {
82
83
  type: "button",
83
84
  role: "switch",
84
- "aria-checked": n,
85
+ "aria-checked": r,
85
86
  "aria-label": a,
86
- onClick: () => s(!n),
87
+ onClick: () => o(!r),
87
88
  ...l,
88
- className: h(
89
+ className: u(
89
90
  "relative mt-0.5 h-4 w-7 shrink-0 rounded-full transition-colors",
90
- n ? "bg-nvr-cyan" : "bg-slate-300 dark:bg-white/35"
91
+ r ? "bg-nvr-cyan" : "bg-slate-300 dark:bg-white/35"
91
92
  ),
92
93
  children: /* @__PURE__ */ e(
93
94
  "span",
94
95
  {
95
- className: h(
96
+ className: u(
96
97
  "absolute left-0 top-0.5 h-3 w-3 rounded-full bg-white shadow-sm transition-transform",
97
- n ? "translate-x-3.5" : "translate-x-0.5"
98
+ r ? "translate-x-3.5" : "translate-x-0.5"
98
99
  )
99
100
  }
100
101
  )
@@ -102,50 +103,50 @@ function ze({
102
103
  )
103
104
  ] });
104
105
  }
105
- function Ye({
106
+ function qe({
106
107
  collection: i,
107
108
  value: a,
108
- onChange: c,
109
- showHidden: n,
110
- onShowHidden: s,
109
+ onChange: d,
110
+ showHidden: r,
111
+ onShowHidden: o,
111
112
  extra: l
112
113
  }) {
113
- var S, O, R, f;
114
- const t = we(), [m, u] = W(!1), [b, T] = W(""), B = fe(b, 250), { data: g } = Le(i, m), { data: x = [] } = Ue(!0), { options: N, loading: L } = ke(m ? t : null, i, {
115
- search: B,
114
+ var O, T, P, N;
115
+ const t = Ne(), [m, p] = E(!1), [b, U] = E(""), v = ye(b, 250), { data: w } = Ue(i, m), { data: x = [] } = $e(!0), { options: f, loading: C } = Ce(m ? t : null, i, {
116
+ search: v,
116
117
  limit: 8,
117
- displayTemplate: g ?? null,
118
- enabled: m && g !== void 0
119
- }), y = ye(Ce).length, w = ((S = x.find((o) => o.id === a.roleId)) == null ? void 0 : S.name) ?? null, C = ((O = x.find((o) => o.id === a.compareRoleId)) == null ? void 0 : O.name) ?? null, U = [
120
- (R = a.record) == null ? void 0 : R.label,
121
- C && w ? `${w} | ${C}` : w,
122
- (f = a.state) == null ? void 0 : f.label,
118
+ displayTemplate: w ?? null,
119
+ enabled: m && w !== void 0
120
+ }), S = Re(Oe).length, k = ((O = x.find((s) => s.id === a.roleId)) == null ? void 0 : O.name) ?? null, R = ((T = x.find((s) => s.id === a.compareRoleId)) == null ? void 0 : T.name) ?? null, $ = [
121
+ a.sample ? "Sample record" : (P = a.record) == null ? void 0 : P.label,
122
+ R && k ? `${k} | ${R}` : k,
123
+ (N = a.state) == null ? void 0 : N.label,
123
124
  a.values && Object.keys(a.values).length > 0 ? "What if" : null,
124
- a.device && a.device !== "desktop" ? a.device === "phone" ? "Phone" : "Tablet" : null,
125
+ a.device && a.device !== "desktop" ? a.device === "phone" ? "Phone" : a.device === "all" ? "All devices" : "Tablet" : null,
125
126
  a.who ? "Who sees" : null,
126
127
  // #2858 — pretending something is down is a preview mode too: never forgotten on screen.
127
- y > 0 ? `${y} down` : null
128
+ S > 0 ? `${S} down` : null
128
129
  ].filter(Boolean).join(" · ") || "No record";
129
- return /* @__PURE__ */ r(K, { open: m, onOpenChange: u, children: [
130
- /* @__PURE__ */ e(Q, { asChild: !0, children: /* @__PURE__ */ r(
130
+ return /* @__PURE__ */ n(Q, { open: m, onOpenChange: p, children: [
131
+ /* @__PURE__ */ e(V, { asChild: !0, children: /* @__PURE__ */ n(
131
132
  "button",
132
133
  {
133
134
  type: "button",
134
- className: h(We, "min-w-[110px] max-w-[260px] shrink", m && Ie),
135
+ className: u(Ye, "min-w-[110px] max-w-[260px] shrink", m && ze),
135
136
  "aria-label": "Preview as",
136
137
  "data-preview-as": "",
137
138
  "data-tip": "Show the form with a real record’s values, as a role sees it",
138
139
  children: [
139
140
  /* @__PURE__ */ e(Y, { className: "h-3.5 w-3.5 shrink-0" }),
140
- /* @__PURE__ */ r("span", { className: "min-w-0 truncate", children: [
141
+ /* @__PURE__ */ n("span", { className: "min-w-0 truncate", children: [
141
142
  "Preview",
142
- /* @__PURE__ */ r("span", { "data-tb-wide": "", children: [
143
+ /* @__PURE__ */ n("span", { "data-tb-wide": "", children: [
143
144
  ":",
144
145
  " ",
145
- /* @__PURE__ */ e("span", { "data-preview-summary": "", className: "text-slate-500 dark:text-muted-foreground", children: U })
146
+ /* @__PURE__ */ e("span", { "data-preview-summary": "", className: "text-slate-500 dark:text-muted-foreground", children: $ })
146
147
  ] })
147
148
  ] }),
148
- n && /* @__PURE__ */ e(
149
+ r && /* @__PURE__ */ e(
149
150
  "span",
150
151
  {
151
152
  "data-preview-hidden-on": "",
@@ -153,77 +154,96 @@ function Ye({
153
154
  className: "h-1.5 w-1.5 shrink-0 rounded-full bg-nvr-cyan"
154
155
  }
155
156
  ),
156
- /* @__PURE__ */ e(q, { className: "h-3 w-3 shrink-0 text-slate-500 dark:text-muted-foreground" })
157
+ /* @__PURE__ */ e(X, { className: "h-3 w-3 shrink-0 text-slate-500 dark:text-muted-foreground" })
157
158
  ]
158
159
  }
159
160
  ) }),
160
- /* @__PURE__ */ r(
161
- V,
161
+ /* @__PURE__ */ n(
162
+ ee,
162
163
  {
163
164
  align: "end",
164
165
  className: "max-h-[min(80vh,640px)] w-[320px] overflow-y-auto overscroll-contain p-3",
165
166
  children: [
166
- /* @__PURE__ */ e("p", { className: X, children: "Record" }),
167
- a.record ? /* @__PURE__ */ r("span", { className: "inline-flex max-w-full items-center gap-1.5 rounded-full bg-nvr-cyan/10 px-2.5 py-1 text-[12px] font-medium text-slate-800 dark:text-foreground", children: [
167
+ /* @__PURE__ */ e("p", { className: K, children: "Record" }),
168
+ a.sample ? /* @__PURE__ */ e(
169
+ We,
170
+ {
171
+ collection: i,
172
+ onSample: (s) => d({ ...a, record: null, sample: s }),
173
+ onClear: () => d({ ...a, sample: null })
174
+ }
175
+ ) : a.record ? /* @__PURE__ */ n("span", { className: "inline-flex max-w-full items-center gap-1.5 rounded-full bg-nvr-cyan/10 px-2.5 py-1 text-[12px] font-medium text-slate-800 dark:text-foreground", children: [
168
176
  /* @__PURE__ */ e("span", { className: "truncate", children: a.record.label }),
169
177
  /* @__PURE__ */ e(
170
178
  "button",
171
179
  {
172
180
  type: "button",
173
181
  "aria-label": "Preview without a record",
174
- onClick: () => c({ ...a, record: null }),
182
+ onClick: () => d({ ...a, record: null }),
175
183
  className: "text-slate-500 hover:text-slate-800 dark:text-muted-foreground dark:hover:text-foreground",
176
- children: /* @__PURE__ */ e(xe, { className: "h-3 w-3" })
184
+ children: /* @__PURE__ */ e(ge, { className: "h-3 w-3" })
177
185
  }
178
186
  )
179
- ] }) : /* @__PURE__ */ r(I, { children: [
187
+ ] }) : /* @__PURE__ */ n(Z, { children: [
180
188
  /* @__PURE__ */ e(
181
189
  "input",
182
190
  {
183
191
  value: b,
184
- onChange: (o) => T(o.target.value),
192
+ onChange: (s) => U(s.target.value),
185
193
  placeholder: "Search records…",
186
194
  "aria-label": "Search records",
187
- className: Ze
195
+ className: Ge
188
196
  }
189
197
  ),
190
- /* @__PURE__ */ r("div", { className: "mt-1 max-h-[220px] overflow-y-auto overscroll-contain", children: [
191
- N.map((o) => /* @__PURE__ */ e(
198
+ /* @__PURE__ */ n("div", { className: "mt-1 max-h-[220px] overflow-y-auto overscroll-contain", children: [
199
+ f.map((s) => /* @__PURE__ */ e(
192
200
  "button",
193
201
  {
194
202
  type: "button",
195
- onClick: () => c({ ...a, record: { id: String(o.id), label: o.label } }),
203
+ onClick: () => d({
204
+ ...a,
205
+ record: { id: String(s.id), label: s.label },
206
+ sample: null
207
+ }),
196
208
  className: "block w-full truncate rounded px-2 py-1.5 text-left text-[12.5px] text-slate-700 hover:bg-muted dark:text-foreground",
197
- children: o.label
209
+ children: s.label
198
210
  },
199
- String(o.id)
211
+ String(s.id)
200
212
  )),
201
- !L && N.length === 0 && /* @__PURE__ */ e("p", { className: "px-2 py-1.5 text-[12px] text-slate-500 dark:text-muted-foreground", children: "No records match." })
202
- ] })
213
+ !C && f.length === 0 && v.trim() !== "" && /* @__PURE__ */ e("p", { className: "px-2 py-1.5 text-[12px] text-slate-500 dark:text-muted-foreground", children: "No records match." })
214
+ ] }),
215
+ /* @__PURE__ */ e(
216
+ Ze,
217
+ {
218
+ collection: i,
219
+ empty: !C && f.length === 0 && v.trim() === "",
220
+ onSample: (s) => d({ ...a, record: null, sample: s })
221
+ }
222
+ )
203
223
  ] }),
204
- /* @__PURE__ */ e("p", { className: h(X, "mt-3"), children: "As a role" }),
224
+ /* @__PURE__ */ e("p", { className: u(K, "mt-3"), children: "As a role" }),
205
225
  /* @__PURE__ */ e(
206
- Oe,
226
+ Pe,
207
227
  {
208
228
  value: a.roleId ?? "",
209
- onChange: (o) => c({ ...a, roleId: o || null }),
229
+ onChange: (s) => d({ ...a, roleId: s || null }),
210
230
  ariaLabel: "Preview as role",
211
231
  className: "h-8 text-[12.5px]",
212
232
  options: [
213
233
  { value: "", label: "Any role" },
214
- ...x.map((o) => ({ value: o.id, label: o.name }))
234
+ ...x.map((s) => ({ value: s.id, label: s.name }))
215
235
  ]
216
236
  }
217
237
  ),
218
238
  /* @__PURE__ */ e("p", { className: "mt-2 text-[11.5px] leading-snug text-slate-500 dark:text-muted-foreground", children: "The form shows this record’s values, steps and rules. Nothing you do here changes the record." }),
219
239
  /* @__PURE__ */ e("div", { className: "mt-3 border-t border-slate-100 pt-3 dark:border-border", children: /* @__PURE__ */ e(
220
- ze,
240
+ Xe,
221
241
  {
222
242
  icon: /* @__PURE__ */ e(Y, { className: "h-3.5 w-3.5" }),
223
243
  label: "Show hidden",
224
244
  hint: "Fields and sections the preview would hide, faintly, so you can select them",
225
- on: n,
226
- onChange: s,
245
+ on: r,
246
+ onChange: o,
227
247
  data: { "data-show-hidden-switch": "" }
228
248
  }
229
249
  ) }),
@@ -233,102 +253,102 @@ function Ye({
233
253
  )
234
254
  ] });
235
255
  }
236
- function ht({
256
+ function wt({
237
257
  collection: i,
238
258
  layoutId: a,
239
- layoutName: c,
240
- layoutType: n,
241
- row: s,
259
+ layoutName: d,
260
+ layoutType: r,
261
+ row: o,
242
262
  fields: l,
243
263
  draft: t,
244
264
  preview: m,
245
- onPreview: u,
265
+ onPreview: p,
246
266
  showHidden: b,
247
- onShowHidden: T,
248
- onBack: B,
249
- backLabel: g = "Forms",
267
+ onShowHidden: U,
268
+ onBack: v,
269
+ backLabel: w = "Forms",
250
270
  view: x,
251
- tools: N,
252
- ai: L,
253
- previewExtra: y,
254
- problems: w,
255
- more: C,
256
- presence: U,
257
- onOpenUnsaved: S,
258
- pendingTip: O,
259
- onSelectField: R,
260
- onShowOnCanvas: f,
261
- onReviewChanges: o,
262
- reviewing: ee = !1,
263
- testing: te,
264
- beforeSave: ae
271
+ tools: f,
272
+ ai: C,
273
+ previewExtra: S,
274
+ problems: k,
275
+ more: R,
276
+ presence: $,
277
+ onOpenUnsaved: O,
278
+ pendingTip: T,
279
+ onSelectField: P,
280
+ onShowOnCanvas: N,
281
+ onReviewChanges: s,
282
+ reviewing: te = !1,
283
+ testing: ae,
284
+ beforeSave: re
265
285
  }) {
266
- const [E, D] = W(
286
+ const [M, j] = E(
267
287
  () => typeof window < "u" && new URLSearchParams(window.location.search).get("history") === "1"
268
- ), p = t.unsavedCount ?? 0, $ = s ? Ee(s) : null, ne = ve(() => s ? [s] : [], [s]), re = Be(i, l, ne), _ = s ? De(s, l, re) : G[n] ? [{ text: G[n] }] : [], P = !!t.save && !t.autosave, M = P && p > 0, oe = ge(
269
- (d) => {
270
- var v, F;
271
- return ((F = (v = l.find((le) => le.field === d)) == null ? void 0 : v.label) == null ? void 0 : F.trim()) || Ne(d);
288
+ ), h = t.unsavedCount ?? 0, H = o ? Me(o) : null, ne = we(() => o ? [o] : [], [o]), oe = Le(i, l, ne), _ = o ? je(o, l, oe) : G[r] ? [{ text: G[r] }] : [], A = !!t.save && !t.autosave, B = A && h > 0, se = q(
289
+ (c) => {
290
+ var g, F;
291
+ return ((F = (g = l.find((le) => le.field === c)) == null ? void 0 : g.label) == null ? void 0 : F.trim()) || Se(c);
272
292
  },
273
293
  [l]
274
- ), se = Se(c);
275
- return /* @__PURE__ */ r(
294
+ ), de = Te(d);
295
+ return /* @__PURE__ */ n(
276
296
  "header",
277
297
  {
278
298
  "data-editor-topbar": "",
279
299
  className: "flex shrink-0 flex-nowrap items-center gap-1.5 overflow-hidden border-b border-slate-200 bg-white px-3 py-2 dark:border-border dark:bg-card",
280
300
  children: [
281
- /* @__PURE__ */ e("style", { children: _e }),
282
- /* @__PURE__ */ r(
301
+ /* @__PURE__ */ e("style", { children: Je }),
302
+ /* @__PURE__ */ n(
283
303
  "button",
284
304
  {
285
305
  type: "button",
286
- "aria-label": g,
306
+ "aria-label": w,
287
307
  "data-editor-back": "",
288
- onClick: (d) => B(d.currentTarget),
308
+ onClick: (c) => v(c.currentTarget),
289
309
  className: "inline-flex h-8 shrink-0 items-center gap-0.5 rounded-md pl-1 pr-2 text-[12px] text-slate-500 transition-colors hover:bg-muted hover:text-slate-800 dark:text-muted-foreground dark:hover:text-foreground",
290
310
  children: [
291
- /* @__PURE__ */ e(de, { className: "h-4 w-4" }),
292
- /* @__PURE__ */ e("span", { "data-tb-wide": "", children: g })
311
+ /* @__PURE__ */ e(ie, { className: "h-4 w-4" }),
312
+ /* @__PURE__ */ e("span", { "data-tb-wide": "", children: w })
293
313
  ]
294
314
  }
295
315
  ),
296
- /* @__PURE__ */ e(k, {}),
297
- /* @__PURE__ */ r("div", { "data-tb-name": "", className: "flex min-w-[64px] flex-1 items-center gap-2", children: [
316
+ /* @__PURE__ */ e(y, {}),
317
+ /* @__PURE__ */ n("div", { "data-tb-name": "", className: "flex min-w-[64px] flex-1 items-center gap-2", children: [
298
318
  /* @__PURE__ */ e(
299
319
  "h2",
300
320
  {
301
- ref: se,
321
+ ref: de,
302
322
  className: "min-w-0 truncate text-[14px] font-semibold text-slate-900 dark:text-foreground",
303
- children: c
323
+ children: d
304
324
  }
305
325
  ),
306
- $ && /* @__PURE__ */ e("span", { className: "shrink-0", children: /* @__PURE__ */ e($e, { tone: $.tone, children: $.text }) }),
307
- _.length > 0 && /* @__PURE__ */ r(
326
+ H && /* @__PURE__ */ e("span", { className: "shrink-0", children: /* @__PURE__ */ e(He, { tone: H.tone, children: H.text }) }),
327
+ _.length > 0 && /* @__PURE__ */ n(
308
328
  "span",
309
329
  {
310
330
  "data-tb-sentence": "",
311
331
  className: "min-w-0 truncate text-[12px] text-slate-500 dark:text-muted-foreground",
312
332
  children: [
313
333
  "· ",
314
- /* @__PURE__ */ e(Me, { segs: _, muted: !0 })
334
+ /* @__PURE__ */ e(Ie, { segs: _, muted: !0 })
315
335
  ]
316
336
  }
317
337
  ),
318
- U
338
+ $
319
339
  ] }),
320
- /* @__PURE__ */ e(k, {}),
321
- /* @__PURE__ */ r("div", { className: "flex shrink-0 items-center gap-0.5", children: [
340
+ /* @__PURE__ */ e(y, {}),
341
+ /* @__PURE__ */ n("div", { className: "flex shrink-0 items-center gap-0.5", children: [
322
342
  /* @__PURE__ */ e(
323
343
  "button",
324
344
  {
325
345
  type: "button",
326
346
  "aria-label": "Undo",
327
- className: j,
347
+ className: I,
328
348
  disabled: !t.canUndo,
329
349
  onClick: t.undo,
330
350
  "data-tip": t.undoLabel ? `Undo ${t.undoLabel} (⌘Z)` : "Undo (⌘Z)",
331
- children: /* @__PURE__ */ e(ie, { className: "h-4 w-4" })
351
+ children: /* @__PURE__ */ e(ce, { className: "h-4 w-4" })
332
352
  }
333
353
  ),
334
354
  /* @__PURE__ */ e(
@@ -336,56 +356,56 @@ function ht({
336
356
  {
337
357
  type: "button",
338
358
  "aria-label": "Redo",
339
- className: j,
359
+ className: I,
340
360
  disabled: !t.canRedo,
341
361
  onClick: t.redo,
342
362
  "data-tip": t.redoLabel ? `Redo ${t.redoLabel} (⇧⌘Z)` : "Redo (⇧⌘Z)",
343
- children: /* @__PURE__ */ e(ce, { className: "h-4 w-4" })
363
+ children: /* @__PURE__ */ e(me, { className: "h-4 w-4" })
344
364
  }
345
365
  )
346
366
  ] }),
347
- x && /* @__PURE__ */ r(I, { children: [
348
- /* @__PURE__ */ e(k, {}),
367
+ x && /* @__PURE__ */ n(Z, { children: [
368
+ /* @__PURE__ */ e(y, {}),
349
369
  /* @__PURE__ */ e("div", { className: "flex shrink-0 items-center gap-1", children: x })
350
370
  ] }),
351
- /* @__PURE__ */ e(k, {}),
371
+ /* @__PURE__ */ e(y, {}),
352
372
  /* @__PURE__ */ e(
353
- Ye,
373
+ qe,
354
374
  {
355
375
  collection: i,
356
376
  value: m,
357
- onChange: u,
377
+ onChange: p,
358
378
  showHidden: b,
359
- onShowHidden: T,
360
- extra: y
379
+ onShowHidden: U,
380
+ extra: S
361
381
  }
362
382
  ),
363
383
  /* @__PURE__ */ e(
364
- A,
384
+ D,
365
385
  {
366
386
  label: "Tools",
367
- icon: /* @__PURE__ */ e(me, { className: "h-3.5 w-3.5" }),
387
+ icon: /* @__PURE__ */ e(ue, { className: "h-3.5 w-3.5" }),
368
388
  tip: "Arrange, find, outline, every form, form map and shortcuts",
369
- children: N
389
+ children: f
370
390
  }
371
391
  ),
372
392
  /* @__PURE__ */ e(
373
- A,
393
+ D,
374
394
  {
375
395
  label: "AI",
376
396
  icon: /* @__PURE__ */ e(he, { className: "h-3.5 w-3.5 text-nvr-cyan" }),
377
397
  tip: "Rebuild, review and ask about this form with AI; type a change",
378
398
  width: "w-[320px]",
379
- children: L
399
+ children: C
380
400
  }
381
401
  ),
382
- w,
383
- /* @__PURE__ */ r(K, { open: E, onOpenChange: D, children: [
384
- /* @__PURE__ */ e(Q, { asChild: !0, children: /* @__PURE__ */ e(
402
+ k,
403
+ /* @__PURE__ */ n(Q, { open: M, onOpenChange: j, children: [
404
+ /* @__PURE__ */ e(V, { asChild: !0, children: /* @__PURE__ */ e(
385
405
  "button",
386
406
  {
387
407
  type: "button",
388
- className: h(j, E && He),
408
+ className: u(I, M && Fe),
389
409
  "aria-label": "History",
390
410
  "data-tip": "History: saved versions, this session’s steps, restore",
391
411
  "data-editor-history": "",
@@ -393,66 +413,67 @@ function ht({
393
413
  }
394
414
  ) }),
395
415
  /* @__PURE__ */ e(
396
- V,
416
+ ee,
397
417
  {
398
418
  align: "end",
399
419
  className: "max-h-[min(75vh,640px)] w-[460px] overflow-y-auto overscroll-contain p-3",
400
- children: E && /* @__PURE__ */ e(
401
- Te,
420
+ children: M && /* @__PURE__ */ e(
421
+ Ee,
402
422
  {
403
423
  layoutId: a,
404
- onRestored: () => D(!1),
405
- unsavedCount: p,
424
+ onRestored: () => j(!1),
425
+ unsavedCount: h,
406
426
  onDiscardUnsaved: t.discard,
407
427
  session: t.session,
408
428
  onJump: t.jump,
409
429
  bundle: t.bundle,
410
- onApply: (d, v) => t.apply(d, { label: v }),
411
- fieldLabel: oe,
412
- onShowOnCanvas: f ? (d, v) => {
413
- D(!1), f(d, v);
430
+ onApply: (c, g) => t.apply(c, { label: g }),
431
+ fieldLabel: se,
432
+ onShowOnCanvas: N ? (c, g) => {
433
+ j(!1), N(c, g);
414
434
  } : void 0
415
435
  }
416
436
  )
417
437
  }
418
438
  )
419
439
  ] }),
420
- /* @__PURE__ */ r(
421
- A,
440
+ /* @__PURE__ */ n(
441
+ D,
422
442
  {
423
443
  label: "More",
424
- icon: /* @__PURE__ */ e(ue, { className: "h-4 w-4" }),
444
+ icon: /* @__PURE__ */ e(be, { className: "h-4 w-4" }),
425
445
  iconOnly: !0,
426
446
  align: "end",
427
447
  tip: "Test, share and watch this form, templates and download",
428
448
  data: { "data-editor-more": "" },
429
449
  children: [
430
- te,
431
- /* @__PURE__ */ e(H, {}),
432
- /* @__PURE__ */ e(Pe, { layoutId: a, fields: l, onSelectField: R }),
433
- /* @__PURE__ */ e(Ae, { layoutId: a }),
434
- /* @__PURE__ */ e(H, {}),
435
- C
450
+ ae,
451
+ /* @__PURE__ */ e(W, {}),
452
+ /* @__PURE__ */ e(Be, { layoutId: a, fields: l, onSelectField: P }),
453
+ /* @__PURE__ */ e(De, { layoutId: a }),
454
+ /* @__PURE__ */ e(W, {}),
455
+ R
436
456
  ]
437
457
  }
438
458
  ),
439
- /* @__PURE__ */ e(k, {}),
440
- /* @__PURE__ */ e(Fe, { draft: t, onOpen: S, pendingTip: O }),
441
- /* @__PURE__ */ r("div", { "data-save-split": "", className: "flex shrink-0 items-center", children: [
442
- P && /* @__PURE__ */ r(
459
+ /* @__PURE__ */ e(y, {}),
460
+ /* @__PURE__ */ e(Ke, { draft: t, onOpen: O, pendingTip: T }),
461
+ B && t.discard && /* @__PURE__ */ e(Qe, { count: h, onDiscard: t.discard }),
462
+ /* @__PURE__ */ n("div", { "data-save-split": "", className: "flex shrink-0 items-center", children: [
463
+ A && /* @__PURE__ */ n(
443
464
  "button",
444
465
  {
445
466
  type: "button",
446
467
  "data-editor-save": "",
447
- disabled: p === 0,
468
+ disabled: h === 0,
448
469
  onClick: () => {
449
- var d;
450
- return void ((d = t.save) == null ? void 0 : d.call(t));
470
+ var c;
471
+ return void ((c = t.save) == null ? void 0 : c.call(t));
451
472
  },
452
- "data-tip": p > 0 ? `Save ${Z(p)} (⌘S)` : "Nothing to save",
453
- className: h(
473
+ "data-tip": h > 0 ? `Save ${L(h)} (⌘S)` : "Nothing to save",
474
+ className: u(
454
475
  "inline-flex h-8 items-center gap-1.5 rounded-l-md px-3 text-[12.5px] font-medium transition-opacity disabled:pointer-events-none disabled:opacity-40",
455
- p > 0 ? "bg-nvr-cyan text-white hover:opacity-90" : "border border-slate-200 text-slate-700 dark:border-border dark:text-foreground"
476
+ h > 0 ? "bg-nvr-cyan text-white hover:opacity-90" : "border border-slate-200 text-slate-700 dark:border-border dark:text-foreground"
456
477
  ),
457
478
  children: [
458
479
  /* @__PURE__ */ e(z, { className: "h-3.5 w-3.5" }),
@@ -460,47 +481,47 @@ function ht({
460
481
  ]
461
482
  }
462
483
  ),
463
- /* @__PURE__ */ r(
464
- A,
484
+ /* @__PURE__ */ n(
485
+ D,
465
486
  {
466
487
  label: "Save options",
467
- icon: /* @__PURE__ */ e(q, { className: "h-3.5 w-3.5" }),
488
+ icon: /* @__PURE__ */ e(X, { className: "h-3.5 w-3.5" }),
468
489
  iconOnly: !0,
469
490
  align: "end",
470
491
  width: "w-[300px]",
471
- tip: P ? "Review, check or schedule the changes; Autosave" : "Autosave",
472
- className: h(
473
- P ? "rounded-l-none border border-l-0 border-slate-200 dark:border-border" : "border border-slate-200 dark:border-border"
492
+ tip: A ? "Review, check or schedule the changes; Autosave" : "Autosave",
493
+ className: u(
494
+ A ? "rounded-l-none border border-l-0 border-slate-200 dark:border-border" : "border border-slate-200 dark:border-border"
474
495
  ),
475
496
  data: { "data-save-menu": "" },
476
497
  children: [
477
- o && M && /* @__PURE__ */ e(
498
+ s && B && /* @__PURE__ */ e(
478
499
  J,
479
500
  {
480
501
  label: "Review changes on canvas",
481
- icon: /* @__PURE__ */ e(be, { className: "h-3.5 w-3.5" }),
502
+ icon: /* @__PURE__ */ e(xe, { className: "h-3.5 w-3.5" }),
482
503
  hint: "Mark the unsaved changes on the form",
483
- checked: ee,
484
- onClick: o,
504
+ checked: te,
505
+ onClick: s,
485
506
  data: { "data-editor-review": "" }
486
507
  }
487
508
  ),
488
- M && ae,
489
- /* @__PURE__ */ e(Re, { layoutId: a, draft: t }),
490
- t.unsavedOps && t.discard && M && /* @__PURE__ */ e(
491
- je,
509
+ B && re,
510
+ /* @__PURE__ */ e(Ae, { layoutId: a, draft: t }),
511
+ t.unsavedOps && t.discard && B && /* @__PURE__ */ e(
512
+ _e,
492
513
  {
493
514
  collection: i,
494
515
  layoutId: a,
495
516
  draft: {
496
517
  unsavedOps: t.unsavedOps,
497
518
  discard: t.discard,
498
- unsavedCount: p
519
+ unsavedCount: h
499
520
  }
500
521
  }
501
522
  ),
502
- t.setAutosave && /* @__PURE__ */ r(I, { children: [
503
- /* @__PURE__ */ e(H, {}),
523
+ t.setAutosave && /* @__PURE__ */ n(Z, { children: [
524
+ /* @__PURE__ */ e(W, {}),
504
525
  /* @__PURE__ */ e(
505
526
  J,
506
527
  {
@@ -509,8 +530,8 @@ function ht({
509
530
  hint: t.autosave ? "Every change saves as you make it, until you close the editor" : "Off: changes wait for Save",
510
531
  checked: !!t.autosave,
511
532
  onClick: () => {
512
- var d;
513
- return (d = t.setAutosave) == null ? void 0 : d.call(t, !t.autosave);
533
+ var c;
534
+ return (c = t.setAutosave) == null ? void 0 : c.call(t, !t.autosave);
514
535
  },
515
536
  data: { "data-autosave-switch": "" }
516
537
  }
@@ -524,9 +545,50 @@ function ht({
524
545
  }
525
546
  );
526
547
  }
527
- function k() {
548
+ function Qe({ count: i, onDiscard: a }) {
549
+ const [d, r] = E(!1), o = fe(null), l = q(() => {
550
+ o.current && clearTimeout(o.current), o.current = null, r(!1);
551
+ }, []);
552
+ ke(() => l, [l]);
553
+ const t = `Discard ${L(i)}`;
554
+ return /* @__PURE__ */ n(
555
+ "button",
556
+ {
557
+ type: "button",
558
+ "data-editor-discard": "",
559
+ "data-armed": d ? "" : void 0,
560
+ "aria-label": d ? `${t}? Click again to discard` : t,
561
+ "data-tip": d ? "Click again to discard. This cannot be undone." : t,
562
+ onClick: () => {
563
+ if (!d) {
564
+ r(!0), o.current && clearTimeout(o.current), o.current = setTimeout(() => r(!1), 4e3);
565
+ return;
566
+ }
567
+ l(), a();
568
+ },
569
+ onBlur: l,
570
+ onKeyDown: (m) => {
571
+ m.key === "Escape" && d && (m.stopPropagation(), l());
572
+ },
573
+ className: u(
574
+ "inline-flex h-8 shrink-0 items-center gap-1.5 whitespace-nowrap rounded-md px-2.5 text-[12.5px] font-medium transition-colors",
575
+ d ? "bg-red-50 text-red-700 ring-1 ring-red-200 hover:bg-red-100 dark:bg-red-500/15 dark:text-red-300 dark:ring-red-500/30 dark:hover:bg-red-500/25" : "text-slate-600 hover:bg-muted hover:text-slate-900 dark:text-muted-foreground dark:hover:text-foreground"
576
+ ),
577
+ children: [
578
+ /* @__PURE__ */ e(ve, { "aria-hidden": !0, className: "h-3.5 w-3.5" }),
579
+ d ? /* @__PURE__ */ n("span", { children: [
580
+ "Discard ",
581
+ i === 1 ? "it" : "them",
582
+ "?"
583
+ ] }) : /* @__PURE__ */ e("span", { "data-tb-wide": "", children: "Discard" })
584
+ ]
585
+ }
586
+ );
587
+ }
588
+ function y() {
528
589
  return /* @__PURE__ */ e("span", { "aria-hidden": !0, "data-tb-wide": "", className: "h-5 w-px shrink-0 bg-slate-200 dark:bg-border" });
529
590
  }
530
591
  export {
531
- ht as EditorTopBar
592
+ Qe as DiscardButton,
593
+ wt as EditorTopBar
532
594
  };