@nivaro/react 0.2.53 → 0.2.54

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 (191) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +113 -2
  4. package/dist/layout-editor.d.ts +248 -2
  5. package/dist/shared/components/FormWhatsNew.js +60 -0
  6. package/dist/shared/components/ItemEditForm.js +4058 -3942
  7. package/dist/shared/components/RecordReadView.js +219 -211
  8. package/dist/shared/components/TipLayer.js +27 -27
  9. package/dist/shared/components/help-videos/api.js +51 -41
  10. package/dist/shared/components/help-videos/editor/DetailsTab.js +147 -130
  11. package/dist/shared/components/item-edit/FieldAffordances.js +7 -6
  12. package/dist/shared/components/item-edit/FieldRow.js +353 -304
  13. package/dist/shared/components/item-edit/FormHelpVideoButton.js +59 -0
  14. package/dist/shared/components/item-edit/GroupSection.js +419 -396
  15. package/dist/shared/components/item-edit/HeaderTools.js +59 -56
  16. package/dist/shared/components/item-edit/LayoutContentBlock.js +47 -24
  17. package/dist/shared/components/item-edit/lock-why.js +87 -0
  18. package/dist/shared/components/item-edit/useFormUsageBeacon.js +59 -0
  19. package/dist/shared/components/layout-editor/AddPanel.js +204 -146
  20. package/dist/shared/components/layout-editor/ArrangeButton.js +34 -0
  21. package/dist/shared/components/layout-editor/AutoArrange.js +86 -0
  22. package/dist/shared/components/layout-editor/CanvasCompare.js +79 -0
  23. package/dist/shared/components/layout-editor/ChangeNote.js +146 -0
  24. package/dist/shared/components/layout-editor/CollabParts.js +170 -0
  25. package/dist/shared/components/layout-editor/DesignNode.js +304 -115
  26. package/dist/shared/components/layout-editor/EditorCanvas.js +21 -20
  27. package/dist/shared/components/layout-editor/EditorTopBar.js +452 -175
  28. package/dist/shared/components/layout-editor/FindReplace.js +188 -0
  29. package/dist/shared/components/layout-editor/FormMapButton.js +141 -0
  30. package/dist/shared/components/layout-editor/HistoryPanel.js +234 -109
  31. package/dist/shared/components/layout-editor/LayoutEditor.js +1101 -307
  32. package/dist/shared/components/layout-editor/LayoutsRail.js +94 -67
  33. package/dist/shared/components/layout-editor/NoteMarker.js +38 -0
  34. package/dist/shared/components/layout-editor/PlacementsTable.js +187 -0
  35. package/dist/shared/components/layout-editor/ScheduleChange.js +106 -0
  36. package/dist/shared/components/layout-editor/SessionHistory.js +84 -0
  37. package/dist/shared/components/layout-editor/StructureMenu.js +413 -0
  38. package/dist/shared/components/layout-editor/UnsavedConfirm.js +103 -0
  39. package/dist/shared/components/layout-editor/ai/AiToolsButton.js +625 -0
  40. package/dist/shared/components/layout-editor/ai/ChangeCheck.js +153 -0
  41. package/dist/shared/components/layout-editor/ai/ai-tools-api.js +80 -0
  42. package/dist/shared/components/layout-editor/ai/assist-ops.js +38 -0
  43. package/dist/shared/components/layout-editor/ai/autofill-ops.js +73 -0
  44. package/dist/shared/components/layout-editor/ai/canvas-capture.js +41 -0
  45. package/dist/shared/components/layout-editor/ai-forms/AiComposer.js +271 -0
  46. package/dist/shared/components/layout-editor/ai-forms/AiFormsButton.js +182 -0
  47. package/dist/shared/components/layout-editor/ai-forms/MeaningSuggestions.js +109 -0
  48. package/dist/shared/components/layout-editor/ai-forms/SlimPanel.js +170 -0
  49. package/dist/shared/components/layout-editor/ai-forms/ai-forms-api.js +40 -0
  50. package/dist/shared/components/layout-editor/ai-forms/pending.js +25 -0
  51. package/dist/shared/components/layout-editor/ai-forms/plan.js +263 -0
  52. package/dist/shared/components/layout-editor/ai-rules/AiAskPopover.js +160 -0
  53. package/dist/shared/components/layout-editor/ai-rules/CascadeWriter.js +175 -0
  54. package/dist/shared/components/layout-editor/ai-rules/FieldRuleWriter.js +97 -0
  55. package/dist/shared/components/layout-editor/ai-rules/RuleWriter.js +94 -0
  56. package/dist/shared/components/layout-editor/ai-rules/ValidationSuggest.js +153 -0
  57. package/dist/shared/components/layout-editor/ai-rules/api.js +6 -0
  58. package/dist/shared/components/layout-editor/ai-text/AiTextTools.js +383 -0
  59. package/dist/shared/components/layout-editor/ai-text/text-ops.js +125 -0
  60. package/dist/shared/components/layout-editor/assist/AskPanel.js +278 -0
  61. package/dist/shared/components/layout-editor/assist/ExplainDiff.js +93 -0
  62. package/dist/shared/components/layout-editor/assist/ProposalsButton.js +150 -0
  63. package/dist/shared/components/layout-editor/assist/assist-api.js +63 -0
  64. package/dist/shared/components/layout-editor/assist/jump.js +142 -0
  65. package/dist/shared/components/layout-editor/assist/settings-index.js +118 -0
  66. package/dist/shared/components/layout-editor/auto-arrange.js +101 -0
  67. package/dist/shared/components/layout-editor/bulk/BulkChangesButton.js +221 -0
  68. package/dist/shared/components/layout-editor/bulk/BulkRun.js +237 -0
  69. package/dist/shared/components/layout-editor/bulk/MacrosPanel.js +230 -0
  70. package/dist/shared/components/layout-editor/bulk/bulk-api.js +65 -0
  71. package/dist/shared/components/layout-editor/bulk/field-labels.js +22 -0
  72. package/dist/shared/components/layout-editor/bulk/macro-record.js +142 -0
  73. package/dist/shared/components/layout-editor/bulk/useMacroRecorder.js +65 -0
  74. package/dist/shared/components/layout-editor/bundle-to-active.js +1 -0
  75. package/dist/shared/components/layout-editor/canvas-diff.js +157 -0
  76. package/dist/shared/components/layout-editor/collab/FormFollowShare.js +342 -0
  77. package/dist/shared/components/layout-editor/collab/collab-api.js +77 -0
  78. package/dist/shared/components/layout-editor/commands/CommandPalette.js +221 -0
  79. package/dist/shared/components/layout-editor/commands/intents.js +214 -0
  80. package/dist/shared/components/layout-editor/commands/parse.js +242 -0
  81. package/dist/shared/components/layout-editor/design-context.js +26 -6
  82. package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +179 -163
  83. package/dist/shared/components/layout-editor/dnd/collision.js +25 -23
  84. package/dist/shared/components/layout-editor/dnd/rail-drop.js +56 -0
  85. package/dist/shared/components/layout-editor/draft-recovery.js +61 -0
  86. package/dist/shared/components/layout-editor/editor-notes.js +78 -0
  87. package/dist/shared/components/layout-editor/editors/swap-config.js +1 -0
  88. package/dist/shared/components/layout-editor/explain/CanvasRules.js +142 -0
  89. package/dist/shared/components/layout-editor/explain/default-ghosts.js +81 -0
  90. package/dist/shared/components/layout-editor/explain/driver-hover.js +62 -0
  91. package/dist/shared/components/layout-editor/explain/field-sources.js +246 -0
  92. package/dist/shared/components/layout-editor/explain/rule-graph.js +215 -0
  93. package/dist/shared/components/layout-editor/explain/use-explain.js +132 -0
  94. package/dist/shared/components/layout-editor/field-zones.js +116 -0
  95. package/dist/shared/components/layout-editor/form-map.js +138 -0
  96. package/dist/shared/components/layout-editor/history-api.js +87 -0
  97. package/dist/shared/components/layout-editor/inheritance.js +55 -0
  98. package/dist/shared/components/layout-editor/inspect/inspect-api.js +66 -0
  99. package/dist/shared/components/layout-editor/inspect/picker-preview.js +48 -0
  100. package/dist/shared/components/layout-editor/inspect/width-fit.js +87 -0
  101. package/dist/shared/components/layout-editor/inspector/AiFillSetting.js +85 -0
  102. package/dist/shared/components/layout-editor/inspector/Breadcrumb.js +36 -0
  103. package/dist/shared/components/layout-editor/inspector/BulkInspector.js +175 -0
  104. package/dist/shared/components/layout-editor/inspector/ColumnFit.js +112 -0
  105. package/dist/shared/components/layout-editor/inspector/GroupInspector.js +146 -92
  106. package/dist/shared/components/layout-editor/inspector/HelpTab.js +174 -0
  107. package/dist/shared/components/layout-editor/inspector/Inspector.js +256 -175
  108. package/dist/shared/components/layout-editor/inspector/LookTab.js +46 -40
  109. package/dist/shared/components/layout-editor/inspector/OverrideNotice.js +61 -0
  110. package/dist/shared/components/layout-editor/inspector/PickerPreview.js +134 -0
  111. package/dist/shared/components/layout-editor/inspector/PickerTab.js +167 -141
  112. package/dist/shared/components/layout-editor/inspector/RulesTab.js +175 -128
  113. package/dist/shared/components/layout-editor/inspector/Translations.js +156 -0
  114. package/dist/shared/components/layout-editor/inspector/kit.js +3 -3
  115. package/dist/shared/components/layout-editor/inspector/tab-request.js +21 -0
  116. package/dist/shared/components/layout-editor/is-typing.js +9 -0
  117. package/dist/shared/components/layout-editor/keyboard-move.js +66 -0
  118. package/dist/shared/components/layout-editor/lint/LintPanel.js +190 -0
  119. package/dist/shared/components/layout-editor/lint/lint-api.js +52 -0
  120. package/dist/shared/components/layout-editor/load-error.js +37 -0
  121. package/dist/shared/components/layout-editor/matrix/FieldStateMatrix.js +305 -0
  122. package/dist/shared/components/layout-editor/matrix/MatrixGrid.js +181 -0
  123. package/dist/shared/components/layout-editor/matrix/RoleSectionMatrix.js +147 -0
  124. package/dist/shared/components/layout-editor/matrix/matrix-api.js +48 -0
  125. package/dist/shared/components/layout-editor/matrix/role-matrix.js +36 -0
  126. package/dist/shared/components/layout-editor/matrix/state-matrix.js +145 -0
  127. package/dist/shared/components/layout-editor/nav/FindPanel.js +109 -0
  128. package/dist/shared/components/layout-editor/nav/NavTools.js +114 -0
  129. package/dist/shared/components/layout-editor/nav/OutlinePanel.js +228 -0
  130. package/dist/shared/components/layout-editor/nav/ShortcutSheet.js +31 -0
  131. package/dist/shared/components/layout-editor/nav/find.js +20 -0
  132. package/dist/shared/components/layout-editor/nav/tree.js +142 -0
  133. package/dist/shared/components/layout-editor/nav/useEditorNav.js +101 -0
  134. package/dist/shared/components/layout-editor/nav/view-prefs.js +34 -0
  135. package/dist/shared/components/layout-editor/ops/ChangeRequestsPanel.js +143 -0
  136. package/dist/shared/components/layout-editor/ops/DependencyDiagram.js +179 -0
  137. package/dist/shared/components/layout-editor/ops/LayoutOpsBlocks.js +92 -0
  138. package/dist/shared/components/layout-editor/ops/PromotePanel.js +287 -0
  139. package/dist/shared/components/layout-editor/ops/ops-api.js +122 -0
  140. package/dist/shared/components/layout-editor/overview/OverviewActions.js +15 -3
  141. package/dist/shared/components/layout-editor/overview/describe-conditions.js +18 -14
  142. package/dist/shared/components/layout-editor/overview/overview-api.js +105 -88
  143. package/dist/shared/components/layout-editor/panel-style.js +8 -7
  144. package/dist/shared/components/layout-editor/parity-keys.json.js +4 -0
  145. package/dist/shared/components/layout-editor/pin.js +25 -0
  146. package/dist/shared/components/layout-editor/presence.js +111 -0
  147. package/dist/shared/components/layout-editor/preview/PreviewModes.js +224 -0
  148. package/dist/shared/components/layout-editor/preview/PreviewPanes.js +262 -0
  149. package/dist/shared/components/layout-editor/preview/preview-api.js +57 -0
  150. package/dist/shared/components/layout-editor/preview/preview-model.js +157 -0
  151. package/dist/shared/components/layout-editor/reuse/FieldMapStep.js +70 -0
  152. package/dist/shared/components/layout-editor/reuse/FormMoreMenu.js +127 -0
  153. package/dist/shared/components/layout-editor/reuse/LibraryRows.js +150 -0
  154. package/dist/shared/components/layout-editor/reuse/NewFormStart.js +20 -0
  155. package/dist/shared/components/layout-editor/reuse/SectionReuseActions.js +291 -0
  156. package/dist/shared/components/layout-editor/reuse/field-match.js +77 -0
  157. package/dist/shared/components/layout-editor/reuse/reuse-api.js +73 -0
  158. package/dist/shared/components/layout-editor/reuse/seed.js +13 -0
  159. package/dist/shared/components/layout-editor/reuse/useFormFromRecord.js +43 -0
  160. package/dist/shared/components/layout-editor/reuse/useRailCopy.js +34 -0
  161. package/dist/shared/components/layout-editor/settings/FormSettings.js +123 -103
  162. package/dist/shared/components/layout-editor/settings/InheritanceSection.js +1 -1
  163. package/dist/shared/components/layout-editor/settings/ToolsSection.js +174 -100
  164. package/dist/shared/components/layout-editor/settings/WhoSection.js +136 -100
  165. package/dist/shared/components/layout-editor/settings/controls.js +8 -8
  166. package/dist/shared/components/layout-editor/settings/settings-registry.js +35 -11
  167. package/dist/shared/components/layout-editor/shortcuts.js +88 -0
  168. package/dist/shared/components/layout-editor/show-when.js +35 -0
  169. package/dist/shared/components/layout-editor/slot-names.js +4 -3
  170. package/dist/shared/components/layout-editor/structure-ops.js +399 -0
  171. package/dist/shared/components/layout-editor/testing/CostLimitSetting.js +42 -0
  172. package/dist/shared/components/layout-editor/testing/TestingPanels.js +551 -0
  173. package/dist/shared/components/layout-editor/testing/testing-api.js +67 -0
  174. package/dist/shared/components/layout-editor/testing/testing-model.js +393 -0
  175. package/dist/shared/components/layout-editor/testing/use-record-check.js +44 -0
  176. package/dist/shared/components/layout-editor/toolbar-kit.js +242 -0
  177. package/dist/shared/components/layout-editor/unsaved-marks.js +72 -0
  178. package/dist/shared/components/layout-editor/usage/FillChip.js +27 -0
  179. package/dist/shared/components/layout-editor/usage/UsagePanel.js +158 -0
  180. package/dist/shared/components/layout-editor/usage/suggest-sections.js +55 -0
  181. package/dist/shared/components/layout-editor/usage/usage-api.js +104 -0
  182. package/dist/shared/components/layout-editor/useLayoutDraft.js +573 -307
  183. package/dist/shared/components/support/SuggestFormChange.js +143 -0
  184. package/dist/shared/lib/ai-fill.js +37 -0
  185. package/dist/shared/lib/form-usage-beacon.js +84 -0
  186. package/dist/shared/lib/layout-i18n.js +66 -0
  187. package/dist/shared/lib/layout-lint.js +490 -0
  188. package/dist/shared/lib/layout-ops.js +110 -106
  189. package/dist/shared/lib/screenshot.js +54 -28
  190. package/dist/shared/lib/visible-when.js +34 -0
  191. package/package.json +1 -1
@@ -1,23 +1,25 @@
1
- import { jsxs as o, jsx as n } from "react/jsx-runtime";
2
- import { useQueryClient as ye, useQueries as Pe, useQuery as z, useMutation as Ee } from "@tanstack/react-query";
3
- import { Info as Ae, Loader2 as De, Sparkles as Me, Lock as Oe, SlidersHorizontal as Ke, History as Ue, BellRing as We, Bell as Be, Sigma as ze } from "lucide-react";
4
- import { useState as ee, useRef as te, useEffect as be } from "react";
5
- import { toast as he } from "sonner";
6
- import { useParentDraft as Ge, useNivaroClient as G } from "../../context.js";
7
- import { get as j, del as Qe, post as ge } from "../../lib/commands.js";
8
- import { titleCase as fe, cn as q } from "../../lib/utils.js";
9
- import { GlossaryLabel as Ve } from "../ai/GlossaryText.js";
10
- import { Label as He } from "../ui/label.js";
11
- import { TooltipProvider as K, Tooltip as U, TooltipTrigger as W, TooltipContent as B } from "../ui/tooltip.js";
12
- import { useAddendumFields as Ye } from "./AddendumFieldContext.js";
13
- import { AutoIdPreviewField as Je } from "./AutoIdPreviewField.js";
14
- import { useFieldAffordances as Xe, useFieldContextMenu as Ze, usePresenceSoftLock as Ie, LockReasonBadge as et, PresenceSoftLockStrip as tt, RemoteChangeGhost as nt } from "./FieldAffordances.js";
15
- import { FieldRenderer as at } from "./FieldRenderer.js";
16
- import { getCascadeFilters as lt, SYSTEM_FIELDS as rt, parseJson as it, buildCascadeFilter as st, CascadeEffectController as ot } from "./helpers.js";
17
- import { isDerivedForRecord as dt } from "./live-rollups.js";
18
- import { useM2MStaging as ct } from "./M2MStagingContext.js";
19
- import { resolveOptionFilterTokens as ut } from "../../lib/option-filter-tokens.js";
20
- const mt = /* @__PURE__ */ new Set(["integer", "float", "decimal", "bigInteger", "number"]), pt = /* @__PURE__ */ new Set(["string", "text", "richtext", "textarea", "markdown", "json", "csv"]), xt = /* @__PURE__ */ new Set([
1
+ import { jsxs as s, jsx as n } from "react/jsx-runtime";
2
+ import { useQueryClient as ve, useQueries as De, useQuery as J, useMutation as Me } from "@tanstack/react-query";
3
+ import { Info as Ke, Loader2 as Oe, Sparkles as Ue, Lock as Be, SlidersHorizontal as He, History as We, BellRing as ze, Bell as Ge, Sigma as Qe } from "lucide-react";
4
+ import { useState as oe, useRef as se, useEffect as we } from "react";
5
+ import { toast as D } from "sonner";
6
+ import { useParentDraft as Ve, useNivaroClient as X } from "../../context.js";
7
+ import { showsAiButton as Ye, AUTOFILL_CHECK_KEY as Je, readAiFill as Xe } from "../../lib/ai-fill.js";
8
+ import { get as M, del as Ze, post as ie } from "../../lib/commands.js";
9
+ import { titleCase as ge, cn as j } from "../../lib/utils.js";
10
+ import { GlossaryLabel as Ie } from "../ai/GlossaryText.js";
11
+ import { Label as et } from "../ui/label.js";
12
+ import { TooltipProvider as G, Tooltip as Q, TooltipTrigger as V, TooltipContent as Y } from "../ui/tooltip.js";
13
+ import { useAddendumFields as tt } from "./AddendumFieldContext.js";
14
+ import { AutoIdPreviewField as nt } from "./AutoIdPreviewField.js";
15
+ import { useFieldAffordances as at, useFieldContextMenu as rt, usePresenceSoftLock as lt, LockReasonBadge as it, PresenceSoftLockStrip as ot, RemoteChangeGhost as st } from "./FieldAffordances.js";
16
+ import { FieldRenderer as dt } from "./FieldRenderer.js";
17
+ import { FormHelpVideoButton as ct } from "./FormHelpVideoButton.js";
18
+ import { getCascadeFilters as ut, SYSTEM_FIELDS as mt, parseJson as pt, buildCascadeFilter as ht, CascadeEffectController as xt } from "./helpers.js";
19
+ import { isDerivedForRecord as ft } from "./live-rollups.js";
20
+ import { useM2MStaging as yt } from "./M2MStagingContext.js";
21
+ import { resolveOptionFilterTokens as bt } from "../../lib/option-filter-tokens.js";
22
+ const gt = /* @__PURE__ */ new Set(["integer", "float", "decimal", "bigInteger", "number"]), vt = /* @__PURE__ */ new Set(["string", "text", "richtext", "textarea", "markdown", "json", "csv"]), wt = /* @__PURE__ */ new Set([
21
23
  "input",
22
24
  "textarea",
23
25
  "wysiwyg",
@@ -25,7 +27,7 @@ const mt = /* @__PURE__ */ new Set(["integer", "float", "decimal", "bigInteger",
25
27
  "input-rich-text-html",
26
28
  "rich_text",
27
29
  "extension-editorjs"
28
- ]), ht = /* @__PURE__ */ new Set([
30
+ ]), kt = /* @__PURE__ */ new Set([
29
31
  "relation-m2o",
30
32
  "relation-m2m",
31
33
  "select-multiple-m2m",
@@ -36,92 +38,92 @@ const mt = /* @__PURE__ */ new Set(["integer", "float", "decimal", "bigInteger",
36
38
  "file",
37
39
  "files",
38
40
  "image"
39
- ]), ft = /* @__PURE__ */ new Set(["file", "file-image", "files-m2m", "files", "image"]);
40
- function yt(e) {
41
- const s = e.interface ?? "";
42
- return ht.has(s) || s.startsWith("relation-") || s.endsWith("-m2o") || s.endsWith("-m2m") ? !1 : !!(pt.has(e.type ?? "") || xt.has(s) || !s && e.type && !mt.has(e.type));
41
+ ]), _t = /* @__PURE__ */ new Set(["file", "file-image", "files-m2m", "files", "image"]);
42
+ function Nt(e) {
43
+ const o = e.interface ?? "";
44
+ return kt.has(o) || o.startsWith("relation-") || o.endsWith("-m2o") || o.endsWith("-m2m") ? !1 : !!(vt.has(e.type ?? "") || wt.has(o) || !o && e.type && !gt.has(e.type));
43
45
  }
44
- function bt(e, s, h, c) {
45
- const u = G();
46
- return z({
47
- queryKey: ["field-lineage", e, s, h],
46
+ function Ct(e, o, f, m) {
47
+ const u = X();
48
+ return J({
49
+ queryKey: ["field-lineage", e, o, f],
48
50
  queryFn: () => u.request(
49
- j(`/lineage/${e}/${encodeURIComponent(s)}/${h}`)
51
+ M(`/lineage/${e}/${encodeURIComponent(o)}/${f}`)
50
52
  ).then((i) => i.data),
51
- enabled: c,
53
+ enabled: m,
52
54
  staleTime: 3e4
53
55
  });
54
56
  }
55
- function Ut(e, s = "rows") {
56
- var d, w, m;
57
+ function Jt(e, o = "rows") {
58
+ var d, _, p;
57
59
  if (e && (e.kind === "write" || e.kind === "read") && e.formula) {
58
- const g = (f) => typeof f == "number" ? f.toLocaleString(void 0, { maximumFractionDigits: 2 }) : f == null || f === "" ? "∅" : String(f);
59
- return `= ${e.formula.replace(/item\.([A-Za-z_][A-Za-z0-9_]*)/g, (f, a) => {
60
- var p;
61
- return g((p = e.inputs) == null ? void 0 : p[a]);
60
+ const v = (y) => typeof y == "number" ? y.toLocaleString(void 0, { maximumFractionDigits: 2 }) : y == null || y === "" ? "∅" : String(y);
61
+ return `= ${e.formula.replace(/item\.([A-Za-z_][A-Za-z0-9_]*)/g, (y, a) => {
62
+ var h;
63
+ return v((h = e.inputs) == null ? void 0 : h[a]);
62
64
  }).replace(/\s*-\s*/g, " − ").replace(/\s*\*\s*/g, " × ").replace(/\s*\/\s*/g, " ÷ ")}`;
63
65
  }
64
66
  if (!e || e.kind !== "rollup") return null;
65
- const h = (e.sources ?? []).reduce((g, l) => g + l.rows.length, 0), c = (e.sources ?? []).reduce((g, l) => {
66
- var f;
67
- return g + (((f = l.excluded) == null ? void 0 : f.length) ?? 0);
68
- }, 0), u = (m = (w = (d = (e.sources ?? []).find((g) => {
67
+ const f = (e.sources ?? []).reduce((v, l) => v + l.rows.length, 0), m = (e.sources ?? []).reduce((v, l) => {
68
+ var y;
69
+ return v + (((y = l.excluded) == null ? void 0 : y.length) ?? 0);
70
+ }, 0), u = (p = (_ = (d = (e.sources ?? []).find((v) => {
69
71
  var l;
70
- return (l = g.excluded) == null ? void 0 : l.length;
71
- })) == null ? void 0 : d.excluded) == null ? void 0 : w[0]) == null ? void 0 : m.reason, i = [`= ${h} ${h === 1 ? s.replace(/s$/, "") : s}`];
72
- return c && i.push(
73
- `${c} excluded${u ? ` (${u.replace(/^does not match: /, "")})` : ""}`
72
+ return (l = v.excluded) == null ? void 0 : l.length;
73
+ })) == null ? void 0 : d.excluded) == null ? void 0 : _[0]) == null ? void 0 : p.reason, i = [`= ${f} ${f === 1 ? o.replace(/s$/, "") : o}`];
74
+ return m && i.push(
75
+ `${m} excluded${u ? ` (${u.replace(/^does not match: /, "")})` : ""}`
74
76
  ), i.join(" · ");
75
77
  }
76
- function gt({
78
+ function Ft({
77
79
  collection: e,
78
- itemId: s,
79
- field: h
80
+ itemId: o,
81
+ field: f
80
82
  }) {
81
- const [c, u] = ee(!1), i = te(null), { data: d, isLoading: w } = bt(e, s, h, c);
82
- be(() => {
83
- if (!c) return;
84
- const l = (f) => {
83
+ const [m, u] = oe(!1), i = se(null), { data: d, isLoading: _ } = Ct(e, o, f, m);
84
+ we(() => {
85
+ if (!m) return;
86
+ const l = (y) => {
85
87
  var a;
86
- (a = i.current) != null && a.contains(f.target) || u(!1);
88
+ (a = i.current) != null && a.contains(y.target) || u(!1);
87
89
  };
88
90
  return window.addEventListener("mousedown", l), () => window.removeEventListener("mousedown", l);
89
- }, [c]);
90
- const m = (l) => l == null ? "—" : Number(l).toLocaleString(void 0, { maximumFractionDigits: 2 }), g = (d == null ? void 0 : d.stored_value) != null ? Number(d.stored_value) : null;
91
- return /* @__PURE__ */ o("div", { ref: i, className: "relative inline-flex", children: [
91
+ }, [m]);
92
+ const p = (l) => l == null ? "—" : Number(l).toLocaleString(void 0, { maximumFractionDigits: 2 }), v = (d == null ? void 0 : d.stored_value) != null ? Number(d.stored_value) : null;
93
+ return /* @__PURE__ */ s("div", { ref: i, className: "relative inline-flex", children: [
92
94
  /* @__PURE__ */ n(
93
95
  "button",
94
96
  {
95
97
  type: "button",
96
98
  onClick: () => u((l) => !l),
97
99
  title: "Where does this number come from?",
98
- className: q(
100
+ className: j(
99
101
  "inline-flex items-center rounded p-0.5 transition-opacity",
100
- c ? "text-nvr-cyan opacity-100" : "text-slate-400 hover:text-nvr-cyan dark:text-slate-300 dark:hover:text-nvr-cyan"
102
+ m ? "text-nvr-cyan opacity-100" : "text-slate-400 hover:text-nvr-cyan dark:text-slate-300 dark:hover:text-nvr-cyan"
101
103
  ),
102
104
  "data-field-lineage": !0,
103
- children: /* @__PURE__ */ n(ze, { className: "h-3 w-3" })
105
+ children: /* @__PURE__ */ n(Qe, { className: "h-3 w-3" })
104
106
  }
105
107
  ),
106
- c && /* @__PURE__ */ o("div", { className: "absolute left-0 top-full z-40 mt-1 max-h-[340px] w-[360px] overflow-y-auto rounded-lg border border-slate-200 bg-white p-2 shadow-lg dark:border-border dark:bg-card", children: [
108
+ m && /* @__PURE__ */ s("div", { className: "absolute left-0 top-full z-40 mt-1 max-h-[340px] w-[360px] overflow-y-auto rounded-lg border border-slate-200 bg-white p-2 shadow-lg dark:border-border dark:bg-card", children: [
107
109
  /* @__PURE__ */ n("p", { className: "mb-1 px-1 text-[10px] font-semibold uppercase tracking-wide text-slate-400", children: "Where this number comes from" }),
108
- w && /* @__PURE__ */ n("p", { className: "px-1 py-2 text-[11.5px] text-slate-400", children: "Loading…" }),
109
- (d == null ? void 0 : d.kind) === "write" && /* @__PURE__ */ o("div", { className: "space-y-1 px-1 py-1", children: [
110
+ _ && /* @__PURE__ */ n("p", { className: "px-1 py-2 text-[11.5px] text-slate-400", children: "Loading…" }),
111
+ (d == null ? void 0 : d.kind) === "write" && /* @__PURE__ */ s("div", { className: "space-y-1 px-1 py-1", children: [
110
112
  /* @__PURE__ */ n("p", { className: "font-mono text-[11px] text-slate-600 dark:text-slate-300", children: d.formula }),
111
- Object.entries(d.inputs ?? {}).map(([l, f]) => /* @__PURE__ */ o("p", { className: "text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
113
+ Object.entries(d.inputs ?? {}).map(([l, y]) => /* @__PURE__ */ s("p", { className: "text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
112
114
  /* @__PURE__ */ n("span", { className: "font-mono", children: l }),
113
115
  " = ",
114
- m(f)
116
+ p(y)
115
117
  ] }, l)),
116
- /* @__PURE__ */ o("p", { className: "pt-1 text-[11.5px] font-medium text-slate-700 dark:text-slate-200", children: [
118
+ /* @__PURE__ */ s("p", { className: "pt-1 text-[11.5px] font-medium text-slate-700 dark:text-slate-200", children: [
117
119
  "= ",
118
- m(d.stored_value)
120
+ p(d.stored_value)
119
121
  ] })
120
122
  ] }),
121
- (d == null ? void 0 : d.kind) === "rollup" && (d.sources ?? []).map((l, f) => {
123
+ (d == null ? void 0 : d.kind) === "rollup" && (d.sources ?? []).map((l, y) => {
122
124
  var a;
123
- return /* @__PURE__ */ o("div", { className: "mb-1.5", children: [
124
- /* @__PURE__ */ o("p", { className: "px-1 text-[10.5px] text-slate-400", children: [
125
+ return /* @__PURE__ */ s("div", { className: "mb-1.5", children: [
126
+ /* @__PURE__ */ s("p", { className: "px-1 text-[10.5px] text-slate-400", children: [
125
127
  (l.aggregate ?? "sum").toUpperCase(),
126
128
  l.value_field ? ` of ${l.value_field}` : "",
127
129
  " across ",
@@ -130,126 +132,126 @@ function gt({
130
132
  ] }),
131
133
  l.error && /* @__PURE__ */ n("p", { className: "px-1 py-1 text-[11.5px] text-amber-600 dark:text-amber-400", children: l.error }),
132
134
  l.note && /* @__PURE__ */ n("p", { className: "px-1 py-1 text-[11.5px] text-slate-400", children: l.note }),
133
- l.rows.length > 0 && /* @__PURE__ */ n("div", { className: "mt-0.5 space-y-px", children: l.rows.map((p) => /* @__PURE__ */ o(
135
+ l.rows.length > 0 && /* @__PURE__ */ n("div", { className: "mt-0.5 space-y-px", children: l.rows.map((h) => /* @__PURE__ */ s(
134
136
  "div",
135
137
  {
136
138
  className: "flex items-baseline gap-2 rounded px-1 py-0.5 text-[11.5px] hover:bg-slate-50 dark:hover:bg-muted",
137
139
  children: [
138
- /* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate text-slate-600 dark:text-slate-300", children: p.label }),
139
- /* @__PURE__ */ n("span", { className: "shrink-0 font-mono tabular-nums text-slate-800 dark:text-slate-100", children: m(p.value) }),
140
+ /* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate text-slate-600 dark:text-slate-300", children: h.label }),
141
+ /* @__PURE__ */ n("span", { className: "shrink-0 font-mono tabular-nums text-slate-800 dark:text-slate-100", children: p(h.value) }),
140
142
  /* @__PURE__ */ n(
141
143
  "span",
142
144
  {
143
145
  className: "w-[88px] shrink-0 truncate text-right text-[10px] text-slate-400",
144
- "data-tip": p.updated_at ? `${p.updated_by ?? "unknown"} · ${new Date(p.updated_at).toLocaleString()}` : void 0,
145
- children: p.updated_by ?? ""
146
+ "data-tip": h.updated_at ? `${h.updated_by ?? "unknown"} · ${new Date(h.updated_at).toLocaleString()}` : void 0,
147
+ children: h.updated_by ?? ""
146
148
  }
147
149
  )
148
150
  ]
149
151
  },
150
- p.id
152
+ h.id
151
153
  )) }),
152
154
  l.truncated && /* @__PURE__ */ n("p", { className: "px-1 pt-0.5 text-[10.5px] text-amber-600 dark:text-amber-400", children: "Showing the first 200 rows — the subtotal covers only these." }),
153
- l.subtotal != null && /* @__PURE__ */ o("p", { className: "border-t border-slate-100 px-1 pt-1 text-right text-[11.5px] font-medium text-slate-700 dark:border-border dark:text-slate-200", children: [
155
+ l.subtotal != null && /* @__PURE__ */ s("p", { className: "border-t border-slate-100 px-1 pt-1 text-right text-[11.5px] font-medium text-slate-700 dark:border-border dark:text-slate-200", children: [
154
156
  "subtotal ",
155
- m(l.subtotal)
157
+ p(l.subtotal)
156
158
  ] }),
157
- (((a = l.excluded) == null ? void 0 : a.length) ?? 0) > 0 && /* @__PURE__ */ o("div", { className: "mt-1 rounded bg-slate-50 px-1 py-1 dark:bg-muted/40", children: [
158
- /* @__PURE__ */ o("p", { className: "text-[10.5px] text-slate-500 dark:text-muted-foreground", children: [
159
+ (((a = l.excluded) == null ? void 0 : a.length) ?? 0) > 0 && /* @__PURE__ */ s("div", { className: "mt-1 rounded bg-slate-50 px-1 py-1 dark:bg-muted/40", children: [
160
+ /* @__PURE__ */ s("p", { className: "text-[10.5px] text-slate-500 dark:text-muted-foreground", children: [
159
161
  l.excluded.length,
160
162
  " excluded —",
161
163
  " ",
162
164
  l.excluded[0].reason.replace(/^does not match: /, "")
163
165
  ] }),
164
- l.excluded.slice(0, 8).map((p) => /* @__PURE__ */ o(
166
+ l.excluded.slice(0, 8).map((h) => /* @__PURE__ */ s(
165
167
  "div",
166
168
  {
167
169
  className: "flex items-baseline gap-2 px-0.5 text-[11px] text-slate-400",
168
170
  children: [
169
- /* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate line-through decoration-slate-300", children: p.label }),
170
- /* @__PURE__ */ n("span", { className: "shrink-0 font-mono tabular-nums", children: m(p.value) })
171
+ /* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate line-through decoration-slate-300", children: h.label }),
172
+ /* @__PURE__ */ n("span", { className: "shrink-0 font-mono tabular-nums", children: p(h.value) })
171
173
  ]
172
174
  },
173
- p.id
175
+ h.id
174
176
  )),
175
- l.excluded.length > 8 && /* @__PURE__ */ o("p", { className: "px-0.5 text-[10.5px] text-slate-400", children: [
177
+ l.excluded.length > 8 && /* @__PURE__ */ s("p", { className: "px-0.5 text-[10.5px] text-slate-400", children: [
176
178
  "+",
177
179
  l.excluded.length - 8,
178
180
  " more"
179
181
  ] })
180
182
  ] })
181
- ] }, f);
183
+ ] }, y);
182
184
  }),
183
- (d == null ? void 0 : d.kind) === "rollup" && g != null && /* @__PURE__ */ o("p", { className: "px-1 pt-0.5 text-right text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
185
+ (d == null ? void 0 : d.kind) === "rollup" && v != null && /* @__PURE__ */ s("p", { className: "px-1 pt-0.5 text-right text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
184
186
  "stored ",
185
- m(g),
187
+ p(v),
186
188
  (() => {
187
- const l = (d.sources ?? []).reduce((a, p) => a + (p.subtotal ?? 0), 0);
188
- return (d.sources ?? []).some((a) => a.truncated) ? null : Math.abs(l - g) < 0.01 ? /* @__PURE__ */ n("span", { className: "ml-1 text-emerald-600 dark:text-emerald-400", children: "✓ matches" }) : /* @__PURE__ */ n("span", { className: "ml-1 text-amber-600 dark:text-amber-400", children: "✕ differs from contributions" });
189
+ const l = (d.sources ?? []).reduce((a, h) => a + (h.subtotal ?? 0), 0);
190
+ return (d.sources ?? []).some((a) => a.truncated) ? null : Math.abs(l - v) < 0.01 ? /* @__PURE__ */ n("span", { className: "ml-1 text-emerald-600 dark:text-emerald-400", children: "✓ matches" }) : /* @__PURE__ */ n("span", { className: "ml-1 text-amber-600 dark:text-amber-400", children: "✕ differs from contributions" });
189
191
  })()
190
192
  ] })
191
193
  ] })
192
194
  ] });
193
195
  }
194
- function vt({
196
+ function Lt({
195
197
  collection: e,
196
- itemId: s,
197
- field: h,
198
- formatValue: c,
198
+ itemId: o,
199
+ field: f,
200
+ formatValue: m,
199
201
  onRestore: u
200
202
  }) {
201
- const i = G(), [d, w] = ee(!1), m = te(null), { data: g, isLoading: l } = z({
202
- queryKey: ["field-value-history", e, s, h],
203
- queryFn: () => i.request(j(`/field-history/${e}/${encodeURIComponent(s)}/${h}`)).then((a) => a.data ?? []),
203
+ const i = X(), [d, _] = oe(!1), p = se(null), { data: v, isLoading: l } = J({
204
+ queryKey: ["field-value-history", e, o, f],
205
+ queryFn: () => i.request(M(`/field-history/${e}/${encodeURIComponent(o)}/${f}`)).then((a) => a.data ?? []),
204
206
  enabled: d,
205
207
  staleTime: 6e4
206
208
  });
207
- be(() => {
209
+ we(() => {
208
210
  if (!d) return;
209
- const a = (p) => {
210
- var P;
211
- (P = m.current) != null && P.contains(p.target) || w(!1);
211
+ const a = (h) => {
212
+ var K;
213
+ (K = p.current) != null && K.contains(h.target) || _(!1);
212
214
  };
213
215
  return window.addEventListener("mousedown", a), () => window.removeEventListener("mousedown", a);
214
216
  }, [d]);
215
- const f = (a, p) => p || (a == null || a === "" ? "—" : c ? c(a) : typeof a == "boolean" || a === "true" || a === "false" ? a === !0 || a === "true" ? "Yes" : "No" : typeof a == "string" && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/.test(a) ? new Date(a).toLocaleString() : typeof a == "object" ? JSON.stringify(a).slice(0, 60) : String(a).slice(0, 80));
216
- return /* @__PURE__ */ o("div", { ref: m, className: "relative inline-flex", children: [
217
+ const y = (a, h) => h || (a == null || a === "" ? "—" : m ? m(a) : typeof a == "boolean" || a === "true" || a === "false" ? a === !0 || a === "true" ? "Yes" : "No" : typeof a == "string" && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/.test(a) ? new Date(a).toLocaleString() : typeof a == "object" ? JSON.stringify(a).slice(0, 60) : String(a).slice(0, 80));
218
+ return /* @__PURE__ */ s("div", { ref: p, className: "relative inline-flex", children: [
217
219
  /* @__PURE__ */ n(
218
220
  "button",
219
221
  {
220
222
  type: "button",
221
- onClick: () => w((a) => !a),
223
+ onClick: () => _((a) => !a),
222
224
  title: "Value history",
223
- className: q(
225
+ className: j(
224
226
  "inline-flex items-center rounded p-0.5 transition-opacity",
225
227
  d ? "text-nvr-cyan opacity-100" : "text-slate-400 hover:text-nvr-cyan dark:text-slate-300 dark:hover:text-nvr-cyan"
226
228
  ),
227
229
  "data-field-history": !0,
228
- children: /* @__PURE__ */ n(Ue, { className: "h-3 w-3" })
230
+ children: /* @__PURE__ */ n(We, { className: "h-3 w-3" })
229
231
  }
230
232
  ),
231
- d && /* @__PURE__ */ o("div", { className: "absolute left-0 top-full z-40 mt-1 max-h-64 w-[300px] overflow-y-auto rounded-lg border border-slate-200 bg-white p-2 shadow-lg dark:border-border dark:bg-card", children: [
233
+ d && /* @__PURE__ */ s("div", { className: "absolute left-0 top-full z-40 mt-1 max-h-64 w-[300px] overflow-y-auto rounded-lg border border-slate-200 bg-white p-2 shadow-lg dark:border-border dark:bg-card", children: [
232
234
  /* @__PURE__ */ n("p", { className: "mb-1 px-1 text-[10px] font-semibold uppercase tracking-wide text-slate-400", children: "Value history" }),
233
- l ? /* @__PURE__ */ n("p", { className: "px-1 py-2 text-[11.5px] text-slate-400", children: "Loading…" }) : (g ?? []).length === 0 ? /* @__PURE__ */ n("p", { className: "px-1 py-2 text-[11.5px] text-slate-400", children: "No recorded changes for this field." }) : /* @__PURE__ */ n("div", { className: "space-y-1", children: (g ?? []).map((a, p) => /* @__PURE__ */ o(
235
+ l ? /* @__PURE__ */ n("p", { className: "px-1 py-2 text-[11.5px] text-slate-400", children: "Loading…" }) : (v ?? []).length === 0 ? /* @__PURE__ */ n("p", { className: "px-1 py-2 text-[11.5px] text-slate-400", children: "No recorded changes for this field." }) : /* @__PURE__ */ n("div", { className: "space-y-1", children: (v ?? []).map((a, h) => /* @__PURE__ */ s(
234
236
  "div",
235
237
  {
236
238
  className: "rounded px-1 py-1 text-[11.5px] leading-snug hover:bg-slate-50 dark:hover:bg-muted",
237
239
  children: [
238
- /* @__PURE__ */ o("span", { className: "flex items-baseline justify-between gap-2", children: [
239
- /* @__PURE__ */ n("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: f(a.value, a.display) }),
240
- u && p > 0 && /* @__PURE__ */ n(
240
+ /* @__PURE__ */ s("span", { className: "flex items-baseline justify-between gap-2", children: [
241
+ /* @__PURE__ */ n("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: y(a.value, a.display) }),
242
+ u && h > 0 && /* @__PURE__ */ n(
241
243
  "button",
242
244
  {
243
245
  type: "button",
244
246
  onClick: () => {
245
- u(a.value ?? null), w(!1);
247
+ u(a.value ?? null), _(!1);
246
248
  },
247
249
  className: "shrink-0 rounded border border-slate-200 px-1.5 py-px text-[10px] text-slate-500 hover:border-nvr-cyan/60 hover:text-nvr-navy dark:border-border dark:hover:text-nvr-cyan",
248
250
  children: "Restore"
249
251
  }
250
252
  )
251
253
  ] }),
252
- /* @__PURE__ */ o("span", { className: "block text-[10.5px] text-slate-400", children: [
254
+ /* @__PURE__ */ s("span", { className: "block text-[10.5px] text-slate-400", children: [
253
255
  a.action === "create" ? "initial value" : "changed",
254
256
  a.timestamp ? ` · ${new Date(a.timestamp).toLocaleString()}` : "",
255
257
  a.user_name ? ` · ${a.user_name}` : "",
@@ -261,121 +263,145 @@ function vt({
261
263
  }
262
264
  )
263
265
  ] }),
264
- a.note && /* @__PURE__ */ o("span", { className: "block text-[10.5px] italic text-slate-500 dark:text-slate-400", children: [
266
+ a.note && /* @__PURE__ */ s("span", { className: "block text-[10.5px] italic text-slate-500 dark:text-slate-400", children: [
265
267
  "“",
266
268
  a.note,
267
269
  "”"
268
270
  ] })
269
271
  ]
270
272
  },
271
- p
273
+ h
272
274
  )) })
273
275
  ] })
274
276
  ] });
275
277
  }
276
- function wt({
278
+ function Rt({
277
279
  collection: e,
278
- itemId: s,
279
- field: h
280
+ itemId: o,
281
+ field: f
280
282
  }) {
281
- const c = G(), u = ye(), { data: i } = z({
283
+ const m = X(), u = ve(), { data: i } = J({
282
284
  queryKey: ["field-watch-config"],
283
- queryFn: () => c.request(j("/field-watches/config")).then((l) => l.data).catch(() => ({ enabled: !1 })),
285
+ queryFn: () => m.request(M("/field-watches/config")).then((l) => l.data).catch(() => ({ enabled: !1 })),
284
286
  staleTime: 5 * 6e4
285
- }), d = ["field-watch-self", e, s], { data: w = [] } = z({
287
+ }), d = ["field-watch-self", e, o], { data: _ = [] } = J({
286
288
  queryKey: d,
287
- queryFn: () => c.request(j("/field-watches/self", { collection: e, item_id: s })).then((l) => l.data ?? []).catch(() => []),
289
+ queryFn: () => m.request(M("/field-watches/self", { collection: e, item_id: o })).then((l) => l.data ?? []).catch(() => []),
288
290
  enabled: !!(i != null && i.enabled),
289
291
  staleTime: 6e4
290
- }), m = w.includes(h), g = Ee({
291
- mutationFn: () => m ? c.request(
292
- Qe(
293
- `/field-watches/self?collection=${encodeURIComponent(e)}&field=${encodeURIComponent(h)}&item_id=${encodeURIComponent(s)}`
292
+ }), p = _.includes(f), v = Me({
293
+ mutationFn: () => p ? m.request(
294
+ Ze(
295
+ `/field-watches/self?collection=${encodeURIComponent(e)}&field=${encodeURIComponent(f)}&item_id=${encodeURIComponent(o)}`
294
296
  )
295
- ) : c.request(ge("/field-watches/self", { collection: e, field: h, item_id: s })),
297
+ ) : m.request(ie("/field-watches/self", { collection: e, field: f, item_id: o })),
296
298
  onSuccess: () => {
297
- u.invalidateQueries({ queryKey: d }), he.success(
298
- m ? "No longer watching this field" : "Watching — you will be notified when it changes"
299
+ u.invalidateQueries({ queryKey: d }), D.success(
300
+ p ? "No longer watching this field" : "Watching — you will be notified when it changes"
299
301
  );
300
302
  },
301
- onError: () => he.error("Could not update the watch")
303
+ onError: () => D.error("Could not update the watch")
302
304
  });
303
305
  return i != null && i.enabled ? /* @__PURE__ */ n(
304
306
  "button",
305
307
  {
306
308
  type: "button",
307
- onClick: () => g.mutate(),
308
- title: m ? "Stop watching this field on this record" : "Watch this field on this record",
309
- "data-field-watch": h,
310
- className: `rounded p-0.5 transition-colors ${m ? "text-nvr-navy dark:text-nvr-cyan" : "text-slate-300 hover:text-slate-500"}`,
311
- children: m ? /* @__PURE__ */ n(We, { className: "h-3 w-3" }) : /* @__PURE__ */ n(Be, { className: "h-3 w-3" })
309
+ onClick: () => v.mutate(),
310
+ title: p ? "Stop watching this field on this record" : "Watch this field on this record",
311
+ "data-field-watch": f,
312
+ className: `rounded p-0.5 transition-colors ${p ? "text-nvr-navy dark:text-nvr-cyan" : "text-slate-300 hover:text-slate-500"}`,
313
+ children: p ? /* @__PURE__ */ n(ze, { className: "h-3 w-3" }) : /* @__PURE__ */ n(Ge, { className: "h-3 w-3" })
312
314
  }
313
315
  ) : null;
314
316
  }
315
- function Wt({
317
+ function Xt({
316
318
  field: e,
317
- draft: s,
318
- onChange: h,
319
- relations: c,
319
+ draft: o,
320
+ onChange: f,
321
+ relations: m,
320
322
  collection: u,
321
323
  itemId: i,
322
324
  error: d,
323
- visible: w,
324
- locked: m,
325
- layoutAiEnabled: g,
325
+ visible: _,
326
+ locked: p,
327
+ layoutAiEnabled: v,
326
328
  renderField: l,
327
- onCountChange: f,
329
+ onCountChange: y,
328
330
  swapButton: a,
329
- swapContent: p,
330
- forceVisible: P,
331
- autoFillTick: ne
331
+ swapContent: h,
332
+ forceVisible: K,
333
+ autoFillTick: de
332
334
  }) {
333
- var me, pe;
334
- const Q = ft.has(e.interface ?? ""), k = Ge(), b = ct(), ae = ye(), le = G(), [re, ie] = ee(!1), y = Xe(), V = te(null), {
335
- onContextMenu: ve,
336
- onKeyDown: we,
337
- menu: ke
338
- } = Ze({
339
- wrapperRef: V,
335
+ var ye, be;
336
+ const Z = _t.has(e.interface ?? ""), F = Ve(), b = yt(), ce = ve(), I = X(), [ue, O] = oe(!1), c = at(), ee = se(null), {
337
+ onContextMenu: ke,
338
+ onKeyDown: _e,
339
+ menu: Ne
340
+ } = rt({
341
+ wrapperRef: ee,
340
342
  field: e,
341
- value: s[e.field],
342
- relations: c,
343
+ value: o[e.field],
344
+ relations: m,
343
345
  collection: u,
344
346
  itemId: i,
345
- openRelated: y == null ? void 0 : y.openRelated
346
- }), L = Ie(V), se = y == null ? void 0 : y.remoteChanges[e.field], E = y == null ? void 0 : y.lockReasons[e.field], F = y == null ? void 0 : y.applyToLines[e.field];
347
- async function Ne() {
347
+ openRelated: c == null ? void 0 : c.openRelated
348
+ }), $ = lt(ee), me = c == null ? void 0 : c.remoteChanges[e.field], P = c == null ? void 0 : c.lockReasons[e.field], L = c == null ? void 0 : c.applyToLines[e.field], U = Ye(e._overrides, v, Nt(e)), te = !!(c != null && c.fromAutofill) && !!e._overrides && e._overrides[Je] === !0;
349
+ async function Ce() {
348
350
  var t;
349
- ie(!0);
351
+ if (U.perField) return Fe();
352
+ O(!0);
350
353
  try {
351
- const r = await le.request(
352
- ge("/ai/generate", {
354
+ const r = await I.request(
355
+ ie("/ai/generate", {
353
356
  collection: u,
354
357
  item_id: i !== "new" ? i : void 0,
355
358
  field: e.field
356
359
  })
357
360
  );
358
- ((t = r.data) == null ? void 0 : t.value) != null && h(e.field, r.data.value);
361
+ ((t = r.data) == null ? void 0 : t.value) != null && f(e.field, r.data.value);
359
362
  } catch {
360
363
  } finally {
361
- ie(!1);
364
+ O(!1);
362
365
  }
363
366
  }
364
- const R = lt(e.dependency_config), oe = R.flatMap((t) => {
365
- const r = c.find(
367
+ async function Fe() {
368
+ var r, x, N, q, R, C;
369
+ const t = {};
370
+ for (const g of ((r = Xe(e._overrides)) == null ? void 0 : r.tokens) ?? []) g in o && (t[g] = o[g]);
371
+ O(!0);
372
+ try {
373
+ const g = await I.request(
374
+ ie("/ai/field-fill", {
375
+ collection: u,
376
+ layout_id: (c == null ? void 0 : c.layoutId) ?? null,
377
+ field: e.field,
378
+ item_id: i && i !== "new" ? i : null,
379
+ values: t
380
+ })
381
+ ), k = (x = g.data) == null ? void 0 : x.value;
382
+ typeof k == "string" && k !== "" ? f(e.field, k) : D.info("The AI had nothing to write here"), (q = (N = g.data) == null ? void 0 : N.missing) != null && q.length && D.info(`Filled without ${g.data.missing.join(", ")} (empty or not visible to you)`);
383
+ } catch (g) {
384
+ const k = g;
385
+ D.error(((C = (R = k == null ? void 0 : k.response) == null ? void 0 : R.data) == null ? void 0 : C.error) ?? (k == null ? void 0 : k.message) ?? "AI fill failed");
386
+ } finally {
387
+ O(!1);
388
+ }
389
+ }
390
+ const S = ut(e.dependency_config), pe = S.flatMap((t) => {
391
+ const r = m.find(
366
392
  (N) => N.one_collection === u && N.one_field === t.parent_field
367
393
  );
368
394
  if (!r) return [];
369
395
  if (r.junction_field) return [{ rule: t, rel: r }];
370
- const x = c.find(
396
+ const x = m.find(
371
397
  (N) => N.many_collection === r.many_collection && N.id !== r.id
372
398
  );
373
399
  return x != null && x.many_field ? [{ rule: t, rel: { ...r, junction_field: x.many_field } }] : [];
374
- }), _e = Pe({
375
- queries: oe.map(({ rel: t }) => ({
400
+ }), Le = De({
401
+ queries: pe.map(({ rel: t }) => ({
376
402
  queryKey: ["m2m-items", t.many_collection, t.many_field, i],
377
- queryFn: () => le.request(
378
- j(`/items/${t.many_collection}`, {
403
+ queryFn: () => I.request(
404
+ M(`/items/${t.many_collection}`, {
379
405
  filter: JSON.stringify({ [t.many_field]: { _eq: i } }),
380
406
  limit: 200,
381
407
  fields: `id,${t.junction_field}`
@@ -384,40 +410,40 @@ function Wt({
384
410
  enabled: !!i && i !== "new",
385
411
  staleTime: 3e4
386
412
  }))
387
- }), Ce = Object.fromEntries(
388
- oe.map(({ rule: t, rel: r }, x) => {
389
- var O;
390
- const N = r.one_field ?? `${r.many_collection}.${r.junction_field}`, I = (b == null ? void 0 : b.getStagedUnlinks(N)) ?? /* @__PURE__ */ new Set();
413
+ }), Re = Object.fromEntries(
414
+ pe.map(({ rule: t, rel: r }, x) => {
415
+ var R;
416
+ const N = r.one_field ?? `${r.many_collection}.${r.junction_field}`, q = (b == null ? void 0 : b.getStagedUnlinks(N)) ?? /* @__PURE__ */ new Set();
391
417
  return [
392
418
  t.parent_field,
393
- (((O = _e[x]) == null ? void 0 : O.data) ?? []).filter((C) => !I.has(C.id)).map((C) => C[r.junction_field])
419
+ (((R = Le[x]) == null ? void 0 : R.data) ?? []).filter((C) => !q.has(C.id)).map((C) => C[r.junction_field])
394
420
  ];
395
421
  })
396
- ), A = Ye()[e.field] ?? [];
397
- if (!P && (!w || !e.layout_assigned && (e.hidden || rt.has(e.field))))
422
+ ), B = tt()[e.field] ?? [];
423
+ if (!K && (!_ || !e.layout_assigned && (e.hidden || mt.has(e.field))))
398
424
  return null;
399
- const H = s[e.field] ?? null, Y = e.label ?? fe(e.field), Fe = dt(e, s), Le = (pe = (me = it(e.options)) == null ? void 0 : me.auto_id) == null ? void 0 : pe.pattern, v = (() => {
400
- const t = c.find(
425
+ const ne = o[e.field] ?? null, H = e.label ?? ge(e.field), $e = ft(e, o), Se = (be = (ye = pt(e.options)) == null ? void 0 : ye.auto_id) == null ? void 0 : be.pattern, w = (() => {
426
+ const t = m.find(
401
427
  (x) => x.one_collection === u && x.one_field === e.field
402
428
  );
403
429
  if (!t) return null;
404
430
  if (t.junction_field) return t;
405
- const r = c.find(
431
+ const r = m.find(
406
432
  (x) => x.many_collection === t.many_collection && x.id !== t.id
407
433
  );
408
434
  return r ? { ...t, junction_field: r.many_field } : null;
409
- })(), J = v ? null : c.find((t) => t.many_collection === u && t.many_field === e.field) ?? null, X = v ? c.find(
410
- (t) => t.many_collection === v.many_collection && t.many_field === v.junction_field && t.id !== v.id
411
- ) ?? null : null, $ = v ? v.one_field ?? `${v.many_collection}.${v.junction_field}` : null, de = $ ? (b == null ? void 0 : b.getStagedLinks($)) ?? [] : [], Re = v ? (ae.getQueryData([
435
+ })(), ae = w ? null : m.find((t) => t.many_collection === u && t.many_field === e.field) ?? null, re = w ? m.find(
436
+ (t) => t.many_collection === w.many_collection && t.many_field === w.junction_field && t.id !== w.id
437
+ ) ?? null : null, E = w ? w.one_field ?? `${w.many_collection}.${w.junction_field}` : null, he = E ? (b == null ? void 0 : b.getStagedLinks(E)) ?? [] : [], Te = w ? (ce.getQueryData([
412
438
  "m2m-items",
413
- v.many_collection,
414
- v.many_field,
439
+ w.many_collection,
440
+ w.many_field,
415
441
  i
416
- ]) ?? []).map((t) => t[v.junction_field]) : [], Se = v ? de[0] ?? Re[0] ?? null : H, $e = (X == null ? void 0 : X.one_collection) ?? (J == null ? void 0 : J.one_collection) ?? void 0, D = (t) => {
442
+ ]) ?? []).map((t) => t[w.junction_field]) : [], qe = w ? he[0] ?? Te[0] ?? null : ne, je = (re == null ? void 0 : re.one_collection) ?? (ae == null ? void 0 : ae.one_collection) ?? void 0, W = (t) => {
417
443
  var r;
418
- return ((k == null ? void 0 : k.collection) === u ? (r = k == null ? void 0 : k.fieldLabels) == null ? void 0 : r[t] : void 0) ?? fe(String(t));
419
- }, S = st({
420
- rules: R,
444
+ return ((F == null ? void 0 : F.collection) === u ? (r = F == null ? void 0 : F.fieldLabels) == null ? void 0 : r[t] : void 0) ?? ge(String(t));
445
+ }, T = ht({
446
+ rules: S,
421
447
  // A parent whose value THIS field's own pick derived must not narrow this
422
448
  // field's options — otherwise picking a region locks the region picker
423
449
  // into the zone the pick itself filled, and cross-zone changes read as
@@ -427,28 +453,28 @@ function Wt({
427
453
  return ((r = b == null ? void 0 : b.getDerivedOrigin) == null ? void 0 : r.call(b, t)) === e.field;
428
454
  },
429
455
  parentValue: (t) => {
430
- if (s[t] != null) return s[t];
431
- const r = c.find((_) => _.one_collection === u && _.one_field === t);
456
+ if (o[t] != null) return o[t];
457
+ const r = m.find((g) => g.one_collection === u && g.one_field === t);
432
458
  if (!r) return null;
433
459
  let x = r;
434
460
  if (!x.junction_field) {
435
- const _ = c.find(
436
- (xe) => xe.many_collection === r.many_collection && xe.id !== r.id
461
+ const g = m.find(
462
+ (k) => k.many_collection === r.many_collection && k.id !== r.id
437
463
  );
438
- if (_ != null && _.many_field) x = { ...r, junction_field: _.many_field };
464
+ if (g != null && g.many_field) x = { ...r, junction_field: g.many_field };
439
465
  else return null;
440
466
  }
441
- const N = x.one_field ?? `${x.many_collection}.${x.junction_field}`, I = (b == null ? void 0 : b.getStagedLinks(N)) ?? [], O = Ce[t] ?? [], C = [...new Set([...I, ...O].map((_) => String(_)))];
467
+ const N = x.one_field ?? `${x.many_collection}.${x.junction_field}`, q = (b == null ? void 0 : b.getStagedLinks(N)) ?? [], R = Re[t] ?? [], C = [...new Set([...q, ...R].map((g) => String(g)))];
442
468
  return C.length === 0 ? null : C.length === 1 ? C[0] : C;
443
469
  },
444
470
  parentOptionFilter: (t) => {
445
471
  var x;
446
- const r = (k == null ? void 0 : k.collection) === u ? (x = k.fieldOptionFilters) == null ? void 0 : x[t] : void 0;
447
- return r ? ut(r, s, i) : void 0;
472
+ const r = (F == null ? void 0 : F.collection) === u ? (x = F.fieldOptionFilters) == null ? void 0 : x[t] : void 0;
473
+ return r ? bt(r, o, i) : void 0;
448
474
  }
449
- }), T = S.filter, M = S.satisfiedParents.map(D), ce = S.satisfiedParents, Te = S.unsatisfiedParents.length ? D(S.unsatisfiedParents[0]) : null, Z = S.missingRequiredParents, ue = Z.length ? D(Z[0]) : null;
450
- function qe() {
451
- for (const t of ce) {
475
+ }), A = T.filter, z = T.satisfiedParents.map(W), xe = T.satisfiedParents, Pe = T.unsatisfiedParents.length ? W(T.unsatisfiedParents[0]) : null, le = T.missingRequiredParents, fe = le.length ? W(le[0]) : null;
476
+ function Ee() {
477
+ for (const t of xe) {
452
478
  const r = document.querySelector(`[data-field="${t}"]`);
453
479
  r && (r.scrollIntoView({ behavior: "smooth", block: "center" }), r.style.transition = "box-shadow 0.15s ease", r.style.boxShadow = "0 0 0 2px rgb(var(--nvr-cyan-rgb, 0 206 255)), 0 0 0 5px rgb(var(--nvr-cyan-rgb, 0 206 255) / 0.25)", r.style.borderRadius = "12px", setTimeout(() => {
454
480
  r.style.boxShadow = "none", setTimeout(() => {
@@ -457,110 +483,123 @@ function Wt({
457
483
  }, 900));
458
484
  }
459
485
  }
460
- const je = () => {
461
- if (v && $) {
462
- for (const r of de) b == null || b.unstageLink($, r);
463
- const t = ae.getQueryData([
486
+ const Ae = () => {
487
+ if (w && E) {
488
+ for (const r of he) b == null || b.unstageLink(E, r);
489
+ const t = ce.getQueryData([
464
490
  "m2m-items",
465
- v.many_collection,
466
- v.many_field,
491
+ w.many_collection,
492
+ w.many_field,
467
493
  i
468
494
  ]) ?? [];
469
- for (const r of t) b == null || b.stageUnlink($, r.id);
495
+ for (const r of t) b == null || b.stageUnlink(E, r.id);
470
496
  } else
471
- h(e.field, null);
497
+ f(e.field, null);
472
498
  };
473
499
  return (
474
500
  // biome-ignore lint/a11y/noStaticElementInteractions: the wrapper only hosts the field context menu (right-click / Shift+F10); the inputs inside stay the controls
475
- /* @__PURE__ */ o(
501
+ /* @__PURE__ */ s(
476
502
  "div",
477
503
  {
478
- ref: V,
504
+ ref: ee,
479
505
  "data-field": e.field,
480
506
  "data-field-collection": u,
481
507
  "data-field-interface": e.interface ?? void 0,
482
- className: "group/fieldrow space-y-1.5",
483
- onContextMenu: ve,
484
- onKeyDown: we,
485
- onFocusCapture: L.onFocusCapture,
508
+ "data-autofill-check": te ? "" : void 0,
509
+ className: j(
510
+ "group/fieldrow space-y-1.5",
511
+ te && "rounded-md bg-amber-50/60 p-1.5 ring-1 ring-amber-300 dark:bg-amber-500/10 dark:ring-amber-500/40"
512
+ ),
513
+ onContextMenu: ke,
514
+ onKeyDown: _e,
515
+ onFocusCapture: $.onFocusCapture,
486
516
  children: [
487
- ke,
488
- R.length > 0 && /* @__PURE__ */ n(
489
- ot,
517
+ Ne,
518
+ S.length > 0 && /* @__PURE__ */ n(
519
+ xt,
490
520
  {
491
- cascadeRules: R,
492
- cascadeFilter: T,
493
- currentValue: Se,
494
- relatedCollection: $e,
495
- missingRequiredParents: Z,
496
- onClear: je
521
+ cascadeRules: S,
522
+ cascadeFilter: A,
523
+ currentValue: qe,
524
+ relatedCollection: je,
525
+ missingRequiredParents: le,
526
+ onClear: Ae
497
527
  }
498
528
  ),
499
- (Y !== "" || A.length > 0) && /* @__PURE__ */ o("div", { className: "flex flex-wrap items-center gap-1.5 min-h-[1.5rem]", children: [
500
- Y !== "" && /* @__PURE__ */ o(He, { "data-field-label": !0, className: "text-sm font-medium", children: [
501
- /* @__PURE__ */ n(Ve, { text: Y, collection: u }),
529
+ (H !== "" || B.length > 0) && /* @__PURE__ */ s("div", { className: "flex flex-wrap items-center gap-1.5 min-h-[1.5rem]", children: [
530
+ H !== "" && /* @__PURE__ */ s(et, { "data-field-label": !0, className: "text-sm font-medium", children: [
531
+ /* @__PURE__ */ n(Ie, { text: H, collection: u }),
502
532
  e.required && /* @__PURE__ */ n("span", { className: "ml-0.5 text-destructive", children: "*" })
503
533
  ] }),
504
- e.note && /* @__PURE__ */ n(K, { delayDuration: 100, children: /* @__PURE__ */ o(U, { children: [
505
- /* @__PURE__ */ n(W, { asChild: !0, children: /* @__PURE__ */ n(Ae, { className: "h-3.5 w-3.5 shrink-0 cursor-help text-slate-400 hover:text-slate-600" }) }),
506
- /* @__PURE__ */ n(B, { side: "top", className: "max-w-[240px] text-[12px]", children: e.note })
534
+ e.note && /* @__PURE__ */ n(G, { delayDuration: 100, children: /* @__PURE__ */ s(Q, { children: [
535
+ /* @__PURE__ */ n(V, { asChild: !0, children: /* @__PURE__ */ n(Ke, { className: "h-3.5 w-3.5 shrink-0 cursor-help text-slate-400 hover:text-slate-600" }) }),
536
+ /* @__PURE__ */ n(Y, { side: "top", className: "max-w-[240px] text-[12px]", children: e.note })
507
537
  ] }) }),
508
538
  i && i !== "new" && /* @__PURE__ */ n(
509
- vt,
539
+ Lt,
510
540
  {
511
541
  collection: u,
512
542
  itemId: i,
513
543
  field: e.field,
514
- onRestore: e.readonly ? void 0 : (t) => h(e.field, t)
544
+ onRestore: e.readonly ? void 0 : (t) => f(e.field, t)
515
545
  }
516
546
  ),
517
- i && i !== "new" && /* @__PURE__ */ n(wt, { collection: u, itemId: i, field: e.field }),
518
- i && i !== "new" && Fe && /* @__PURE__ */ n(gt, { collection: u, itemId: i, field: e.field }),
519
- yt(e) && g && /* @__PURE__ */ o(
547
+ i && i !== "new" && /* @__PURE__ */ n(Rt, { collection: u, itemId: i, field: e.field }),
548
+ i && i !== "new" && $e && /* @__PURE__ */ n(Ft, { collection: u, itemId: i, field: e.field }),
549
+ U.show && !(U.perField && (p || e.readonly)) && /* @__PURE__ */ s(
520
550
  "button",
521
551
  {
522
552
  type: "button",
523
- onClick: Ne,
524
- disabled: re,
553
+ onClick: Ce,
554
+ disabled: ue,
555
+ "data-ai-fill": U.perField ? e.field : void 0,
525
556
  className: "inline-flex items-center gap-0.5 rounded px-1 py-0.5 text-[10px] font-medium text-nvr-cyan hover:bg-nvr-cyan/10 disabled:opacity-50 transition-colors",
526
557
  title: "Generate with AI",
527
558
  children: [
528
- re ? /* @__PURE__ */ n(De, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ n(Me, { className: "h-3 w-3" }),
559
+ ue ? /* @__PURE__ */ n(Oe, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ n(Ue, { className: "h-3 w-3" }),
529
560
  "AI"
530
561
  ]
531
562
  }
532
563
  ),
564
+ te && /* @__PURE__ */ n(
565
+ "span",
566
+ {
567
+ "data-tip": "People often change what the AI read from the document here — check it",
568
+ className: "inline-flex items-center rounded px-1.5 py-0.5 text-[10.5px] font-medium text-amber-800 bg-amber-100 dark:bg-amber-500/15 dark:text-amber-200",
569
+ children: "Check this"
570
+ }
571
+ ),
533
572
  a,
534
- F && !m && !e.readonly && /* @__PURE__ */ o(
573
+ L && !p && !e.readonly && /* @__PURE__ */ s(
535
574
  "button",
536
575
  {
537
576
  type: "button",
538
- onClick: () => F.onApply(s[e.field] ?? null),
539
- disabled: s[e.field] == null || s[e.field] === "" || F.count === 0,
577
+ onClick: () => L.onApply(o[e.field] ?? null),
578
+ disabled: o[e.field] == null || o[e.field] === "" || L.count === 0,
540
579
  "data-apply-to-lines": e.field,
541
- "data-tip": F.count === 0 ? "No lines yet — add lines first" : s[e.field] == null || s[e.field] === "" ? "Pick a value first" : F.count != null ? `Copy this value onto all ${F.count} lines (staged until you save)` : "Copy this value onto every line (staged until you save)",
580
+ "data-tip": L.count === 0 ? "No lines yet — add lines first" : o[e.field] == null || o[e.field] === "" ? "Pick a value first" : L.count != null ? `Copy this value onto all ${L.count} lines (staged until you save)` : "Copy this value onto every line (staged until you save)",
542
581
  className: "inline-flex items-center gap-1 rounded border border-nvr-cyan/40 px-1.5 py-0.5 text-[10.5px] font-medium text-[#0e7490] transition-colors hover:bg-nvr-cyan/10 disabled:cursor-not-allowed disabled:opacity-40 dark:text-nvr-cyan",
543
582
  children: [
544
- F.label ?? "Apply to lines",
583
+ L.label ?? "Apply to lines",
545
584
  " ↓"
546
585
  ]
547
586
  }
548
587
  ),
549
- A.length > 0 && /* @__PURE__ */ n(K, { delayDuration: 100, children: /* @__PURE__ */ o(U, { children: [
550
- /* @__PURE__ */ n(W, { asChild: !0, children: /* @__PURE__ */ o("span", { className: "inline-flex items-center gap-1 rounded-full bg-amber-50 px-1.5 py-0.5 text-[10px] font-medium text-amber-700 border border-amber-200 dark:bg-amber-500/10 dark:text-amber-400 dark:border-amber-500/20 cursor-default", children: [
588
+ B.length > 0 && /* @__PURE__ */ n(G, { delayDuration: 100, children: /* @__PURE__ */ s(Q, { children: [
589
+ /* @__PURE__ */ n(V, { asChild: !0, children: /* @__PURE__ */ s("span", { className: "inline-flex items-center gap-1 rounded-full bg-amber-50 px-1.5 py-0.5 text-[10px] font-medium text-amber-700 border border-amber-200 dark:bg-amber-500/10 dark:text-amber-400 dark:border-amber-500/20 cursor-default", children: [
551
590
  /* @__PURE__ */ n("span", { className: "h-1.5 w-1.5 rounded-full bg-amber-400 shrink-0" }),
552
591
  "addendum"
553
592
  ] }) }),
554
- /* @__PURE__ */ o(B, { side: "top", className: "max-w-[220px] text-[12px]", children: [
555
- /* @__PURE__ */ o("p", { className: "font-medium mb-1", children: [
593
+ /* @__PURE__ */ s(Y, { side: "top", className: "max-w-[220px] text-[12px]", children: [
594
+ /* @__PURE__ */ s("p", { className: "font-medium mb-1", children: [
556
595
  "In active addendum",
557
- A.length > 1 ? "s" : "",
596
+ B.length > 1 ? "s" : "",
558
597
  ":"
559
598
  ] }),
560
- A.map((t) => /* @__PURE__ */ o("p", { className: "text-slate-400", children: [
599
+ B.map((t) => /* @__PURE__ */ s("p", { className: "text-slate-400", children: [
561
600
  t.title,
562
601
  " ",
563
- /* @__PURE__ */ o("span", { className: "capitalize", children: [
602
+ /* @__PURE__ */ s("span", { className: "capitalize", children: [
564
603
  "(",
565
604
  t.status,
566
605
  ")"
@@ -568,111 +607,121 @@ function Wt({
568
607
  ] }, t.id))
569
608
  ] })
570
609
  ] }) }),
571
- (m || e.readonly) && E ? /* @__PURE__ */ n(et, { reason: E }) : m ? /* @__PURE__ */ n(K, { delayDuration: 200, children: /* @__PURE__ */ o(U, { children: [
572
- /* @__PURE__ */ n(W, { asChild: !0, children: /* @__PURE__ */ n("span", { className: "inline-flex items-center text-amber-400 dark:text-amber-500", children: /* @__PURE__ */ n(Oe, { className: "h-3 w-3" }) }) }),
573
- /* @__PURE__ */ n(B, { side: "top", className: "text-[12px]", children: "This field is locked" })
610
+ /* @__PURE__ */ n(
611
+ ct,
612
+ {
613
+ collection: u,
614
+ kind: "field",
615
+ name: e.field,
616
+ label: H
617
+ }
618
+ ),
619
+ (p || e.readonly) && P ? /* @__PURE__ */ n(it, { reason: P, onHover: c == null ? void 0 : c.onLockHover }) : p ? /* @__PURE__ */ n(G, { delayDuration: 200, children: /* @__PURE__ */ s(Q, { children: [
620
+ /* @__PURE__ */ n(V, { asChild: !0, children: /* @__PURE__ */ n("span", { className: "inline-flex items-center text-amber-400 dark:text-amber-500", children: /* @__PURE__ */ n(Be, { className: "h-3 w-3" }) }) }),
621
+ /* @__PURE__ */ n(Y, { side: "top", className: "text-[12px]", children: "This field is locked" })
574
622
  ] }) }) : null,
575
- R.length > 0 && (() => {
576
- const t = !!T && Object.keys(T).length > 0 && M.length > 0, r = R.map(
577
- (x) => D(String(x.parent_field))
623
+ S.length > 0 && (() => {
624
+ const t = !!A && Object.keys(A).length > 0 && z.length > 0, r = S.map(
625
+ (x) => W(String(x.parent_field))
578
626
  );
579
- return /* @__PURE__ */ n(K, { delayDuration: 100, children: /* @__PURE__ */ o(U, { children: [
580
- /* @__PURE__ */ n(W, { asChild: !0, children: /* @__PURE__ */ n(
627
+ return /* @__PURE__ */ n(G, { delayDuration: 100, children: /* @__PURE__ */ s(Q, { children: [
628
+ /* @__PURE__ */ n(V, { asChild: !0, children: /* @__PURE__ */ n(
581
629
  "button",
582
630
  {
583
631
  type: "button",
584
- onClick: qe,
585
- className: q(
632
+ onClick: Ee,
633
+ className: j(
586
634
  "inline-flex items-center transition-colors",
587
635
  t ? "text-nvr-cyan hover:text-nvr-cyan" : "text-slate-300 hover:text-nvr-cyan dark:text-slate-600 dark:hover:text-nvr-cyan"
588
636
  ),
589
- children: /* @__PURE__ */ n(Ke, { className: "h-3 w-3" })
637
+ children: /* @__PURE__ */ n(He, { className: "h-3 w-3" })
590
638
  }
591
639
  ) }),
592
- /* @__PURE__ */ n(B, { side: "top", className: "text-[12px]", children: t ? `Filtered by ${M.join(", ")} — click to highlight` : `Options filter by ${r.join(", ")} once set` })
640
+ /* @__PURE__ */ n(Y, { side: "top", className: "text-[12px]", children: t ? `Filtered by ${z.join(", ")} — click to highlight` : `Options filter by ${r.join(", ")} once set` })
593
641
  ] }) });
594
642
  })()
595
643
  ] }),
596
- L.editor && !m && /* @__PURE__ */ n(
597
- tt,
644
+ $.editor && !p && /* @__PURE__ */ n(
645
+ ot,
598
646
  {
599
- editor: L.editor,
600
- confirming: L.confirming,
601
- onConfirm: L.confirm,
602
- onCancel: L.cancel
647
+ editor: $.editor,
648
+ confirming: $.confirming,
649
+ onConfirm: $.confirm,
650
+ onCancel: $.cancel
603
651
  }
604
652
  ),
605
- p ?? /* @__PURE__ */ n(
653
+ h ?? /* @__PURE__ */ n(
606
654
  "div",
607
655
  {
608
- className: q(m && !Q && "cursor-not-allowed"),
609
- "data-tip": (m || e.readonly) && E ? E : void 0,
656
+ className: j(p && !Z && "cursor-not-allowed"),
657
+ "data-tip": (p || e.readonly) && P ? P : void 0,
658
+ onPointerEnter: (p || e.readonly) && P ? c == null ? void 0 : c.onLockHover : void 0,
610
659
  children: /* @__PURE__ */ n(
611
660
  "div",
612
661
  {
613
- className: q(
662
+ className: j(
614
663
  // A locked FILE field stays interactive: its chips keep the
615
664
  // download link and preview click (the component itself hides
616
665
  // upload/replace/remove when readonly) — blocking pointer events
617
666
  // made attachments unopenable on every locked form (addendum
618
667
  // view, terminal states).
619
- m && !Q && "pointer-events-none opacity-60",
668
+ p && !Z && "pointer-events-none opacity-60",
620
669
  // The ring lands with a 2px shake so the eye finds the field;
621
670
  // the animation runs once when the class is added.
622
671
  d && "nvr-shake ring-1 ring-red-400 rounded-md",
623
- ne && "nvr-autofill-glow"
672
+ de && "nvr-autofill-glow"
624
673
  ),
625
- children: Le ? /* @__PURE__ */ n(
626
- Je,
674
+ children: Se ? /* @__PURE__ */ n(
675
+ nt,
627
676
  {
628
677
  collection: u,
629
678
  field: e,
630
- draft: s,
679
+ draft: o,
631
680
  itemId: i
632
681
  }
633
682
  ) : l ? l({
634
683
  field: e,
635
- value: H,
636
- onChange: (t) => h(e.field, t),
637
- disabled: m,
684
+ value: ne,
685
+ onChange: (t) => f(e.field, t),
686
+ disabled: p,
638
687
  collection: u,
639
688
  itemId: i,
640
- relations: c,
641
- cascadeFilter: T,
642
- unsatisfiedParentLabel: Te,
643
- requiredParentLabel: ue
689
+ relations: m,
690
+ cascadeFilter: A,
691
+ unsatisfiedParentLabel: Pe,
692
+ requiredParentLabel: fe
644
693
  }) : /* @__PURE__ */ n(
645
- at,
694
+ dt,
646
695
  {
647
- field: m && Q ? { ...e, readonly: !0 } : e,
648
- value: H,
649
- onChange: (t) => h(e.field, t),
650
- relations: c,
696
+ field: p && Z ? { ...e, readonly: !0 } : e,
697
+ value: ne,
698
+ onChange: (t) => f(e.field, t),
699
+ relations: m,
651
700
  collection: u,
652
701
  itemId: i,
653
- cascadeFilter: T,
654
- requiredParentLabel: ue,
655
- narrowedBy: M.length > 0 ? {
656
- labels: M,
657
- keys: ce,
658
- onClear: (t) => h(t, null)
702
+ cascadeFilter: A,
703
+ requiredParentLabel: fe,
704
+ narrowedBy: z.length > 0 ? {
705
+ labels: z,
706
+ keys: xe,
707
+ onClear: (t) => f(t, null)
659
708
  } : void 0,
660
- onCountChange: f ? (t) => f(e.field, t) : void 0
709
+ onCountChange: y ? (t) => y(e.field, t) : void 0
661
710
  }
662
711
  )
663
712
  },
664
- ne ?? 0
713
+ de ?? 0
665
714
  )
666
715
  }
667
716
  ),
668
- se && /* @__PURE__ */ n(
669
- nt,
717
+ me && /* @__PURE__ */ n(
718
+ st,
670
719
  {
671
- change: se,
672
- onDismiss: () => y == null ? void 0 : y.dismissRemoteChange(e.field),
673
- onTakeTheirs: y != null && y.takeRemoteChange ? () => {
720
+ change: me,
721
+ onDismiss: () => c == null ? void 0 : c.dismissRemoteChange(e.field),
722
+ onTakeTheirs: c != null && c.takeRemoteChange ? () => {
674
723
  var t;
675
- return (t = y.takeRemoteChange) == null ? void 0 : t.call(y, e.field);
724
+ return (t = c.takeRemoteChange) == null ? void 0 : t.call(c, e.field);
676
725
  } : void 0
677
726
  }
678
727
  )
@@ -682,7 +731,7 @@ function Wt({
682
731
  );
683
732
  }
684
733
  export {
685
- Wt as FieldRow,
686
- Ut as lineageSummary,
687
- bt as useFieldLineage
734
+ Xt as FieldRow,
735
+ Jt as lineageSummary,
736
+ Ct as useFieldLineage
688
737
  };