@nivaro/react 0.3.49 → 0.3.50

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 (32) hide show
  1. package/dist/components/InlineGridField.js +166 -105
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useSessionRecorder.js +1 -1
  4. package/dist/index.d.ts +25 -1
  5. package/dist/shared/components/ItemEditForm.js +4676 -4579
  6. package/dist/shared/components/QueryTable.js +461 -332
  7. package/dist/shared/components/item-edit/CatalogPickerField.js +1144 -1127
  8. package/dist/shared/components/item-edit/CloneDialog.js +192 -142
  9. package/dist/shared/components/item-edit/FieldRenderer.js +127 -126
  10. package/dist/shared/components/item-edit/FieldRow.js +236 -226
  11. package/dist/shared/components/item-edit/InlineGridField.js +92 -90
  12. package/dist/shared/components/item-edit/InlineTableField.js +3088 -2945
  13. package/dist/shared/components/item-edit/MidairCollisionDialog.js +175 -0
  14. package/dist/shared/components/item-edit/PlanGrid.js +162 -162
  15. package/dist/shared/components/item-edit/PolishFields.js +169 -162
  16. package/dist/shared/components/item-edit/RelationCombobox.js +186 -181
  17. package/dist/shared/components/item-edit/SummaryPanel.js +148 -135
  18. package/dist/shared/components/item-edit/ValidationSummary.js +64 -47
  19. package/dist/shared/components/item-edit/helpers.js +181 -155
  20. package/dist/shared/components/item-edit/line-midair.js +201 -0
  21. package/dist/shared/components/item-edit/soft-rules.js +27 -0
  22. package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
  23. package/dist/shared/components/panels/ItemLockBanner.js +414 -358
  24. package/dist/shared/components/panels/PipelinePanel.js +1157 -963
  25. package/dist/shared/components/panels/RecordIntegrityBanner.js +1 -1
  26. package/dist/shared/components/queue/QueueWorklist.js +870 -827
  27. package/dist/shared/components/queue/column-chooser.js +21 -0
  28. package/dist/shared/components/queue/live-state-aspect.js +6 -0
  29. package/dist/shared/components/ui/number-draft-input.js +93 -0
  30. package/dist/shared/components/widgets/ReviewListWidget.js +191 -166
  31. package/dist/shared/lib/error-hints.js +1 -0
  32. package/package.json +1 -1
@@ -1,34 +1,35 @@
1
1
  import { jsxs as d, jsx as n } from "react/jsx-runtime";
2
- import { useQueryClient as Ve, useQueries as xt, useQuery as re, useMutation as yt } from "@tanstack/react-query";
3
- import { Info as bt, Loader2 as gt, Sparkles as vt, Lock as wt, SlidersHorizontal as kt, History as _t, BellRing as Nt, Bell as Ft, Sigma as Ct } from "lucide-react";
4
- import { memo as Lt, useState as ve, useRef as R, useId as St, useEffect as le, useCallback as Ke } from "react";
2
+ import { useQueryClient as Ge, useQueries as bt, useQuery as re, useMutation as gt } from "@tanstack/react-query";
3
+ import { Info as vt, Loader2 as wt, Sparkles as kt, Lock as _t, SlidersHorizontal as Nt, History as Ft, BellRing as Ct, Bell as Lt, Sigma as Rt } from "lucide-react";
4
+ import { memo as St, useState as ve, useRef as S, useId as $t, useEffect as le, useCallback as He } from "react";
5
5
  import { toast as oe } from "sonner";
6
- import { useParentDraft as Rt, useNivaroClient as ie } from "../../context.js";
7
- import { showsAiButton as $t, AUTOFILL_CHECK_KEY as qt, readAiFill as At } from "../../lib/ai-fill.js";
8
- import { get as K, del as Tt, post as ge } from "../../lib/commands.js";
9
- import { toastError as Et } from "../../lib/error-toast.js";
6
+ import { useParentDraft as qt, useNivaroClient as ie } from "../../context.js";
7
+ import { showsAiButton as At, AUTOFILL_CHECK_KEY as Tt, readAiFill as Et } from "../../lib/ai-fill.js";
8
+ import { get as K, del as Pt, post as ge } from "../../lib/commands.js";
9
+ import { toastError as jt } from "../../lib/error-toast.js";
10
10
  import { titleCase as Z, cn as j } from "../../lib/utils.js";
11
- import { GlossaryLabel as Ue } from "../ai/GlossaryText.js";
12
- import { useFieldSource as Pt, FieldSourceInfo as jt } from "../ConfigReadBack.js";
11
+ import { GlossaryLabel as We } from "../ai/GlossaryText.js";
12
+ import { useFieldSource as Bt, FieldSourceInfo as Ot } from "../ConfigReadBack.js";
13
13
  import { Label as Dt } from "../ui/label.js";
14
14
  import { TooltipProvider as I, Tooltip as ee, TooltipTrigger as te, TooltipContent as ne } from "../ui/tooltip.js";
15
- import { useAddendumFields as Bt } from "./AddendumFieldContext.js";
16
- import { AutoIdPreviewField as Ot } from "./AutoIdPreviewField.js";
17
- import { FOCUSABLE as He } from "./entry/entry-keys.js";
18
- import { useFieldAffordances as Mt, useFieldContextMenu as Kt, usePresenceSoftLock as Ut, LockReasonBadge as Ht, PresenceSoftLockStrip as Wt, RemoteChangeGhost as Vt } from "./FieldAffordances.js";
19
- import { FieldCommentButton as zt } from "./FieldComments.js";
20
- import { FieldRenderer as Gt } from "./FieldRenderer.js";
21
- import { FormHelpVideoButton as Qt } from "./FormHelpVideoButton.js";
22
- import { getCascadeFilters as Yt, SYSTEM_FIELDS as Jt, parseJson as Xt, buildCascadeFilter as Zt, CascadeEffectController as It } from "./helpers.js";
23
- import { isDerivedForRecord as en } from "./live-rollups.js";
24
- import { useM2MStaging as tn } from "./M2MStagingContext.js";
25
- import { personalDefaultSlotFor as nn, PersonalDefaultSlot as rn } from "./PersonalDefaultControl.js";
26
- import { PersonalDefaultHint as ln } from "./PersonalDefaultPill.js";
27
- import { isDisplayFormulaRow as We, usePlacementTextContext as on, placementFieldText as an, fieldCounterConfig as sn, fieldIsRecommended as cn, RecommendedMarker as dn, RepeatLastButton as un, DisplayFormulaValue as mn, FieldCounter as pn } from "./placement-behaviour.js";
28
- import { keepIfEqual as hn, jsonEqual as fn } from "./render-stability.js";
29
- import { usePersonalDefaultsApi as xn } from "./usePersonalDefaults.js";
30
- import { resolveOptionFilterTokens as yn } from "../../lib/option-filter-tokens.js";
31
- const bn = /* @__PURE__ */ new Set(["integer", "float", "decimal", "bigInteger", "number"]), gn = /* @__PURE__ */ new Set(["string", "text", "richtext", "textarea", "markdown", "json", "csv"]), vn = /* @__PURE__ */ new Set([
15
+ import { useAddendumFields as Mt } from "./AddendumFieldContext.js";
16
+ import { AutoIdPreviewField as Kt } from "./AutoIdPreviewField.js";
17
+ import { FOCUSABLE as Ve } from "./entry/entry-keys.js";
18
+ import { useFieldAffordances as Ut, useFieldContextMenu as Ht, usePresenceSoftLock as Wt, LockReasonBadge as Vt, PresenceSoftLockStrip as zt, RemoteChangeGhost as Gt } from "./FieldAffordances.js";
19
+ import { FieldCommentButton as Qt } from "./FieldComments.js";
20
+ import { FieldRenderer as Yt } from "./FieldRenderer.js";
21
+ import { FormHelpVideoButton as Jt } from "./FormHelpVideoButton.js";
22
+ import { getCascadeFilters as Xt, SYSTEM_FIELDS as Zt, parseJson as It, buildCascadeFilter as en, CascadeEffectController as tn } from "./helpers.js";
23
+ import { isDerivedForRecord as nn } from "./live-rollups.js";
24
+ import { useM2MStaging as rn } from "./M2MStagingContext.js";
25
+ import { personalDefaultSlotFor as ln, PersonalDefaultSlot as on } from "./PersonalDefaultControl.js";
26
+ import { PersonalDefaultHint as an } from "./PersonalDefaultPill.js";
27
+ import { isDisplayFormulaRow as ze, usePlacementTextContext as sn, placementFieldText as cn, fieldCounterConfig as dn, fieldIsRecommended as un, RecommendedMarker as mn, RepeatLastButton as pn, DisplayFormulaValue as hn, FieldCounter as xn } from "./placement-behaviour.js";
28
+ import { keepIfEqual as fn, jsonEqual as yn } from "./render-stability.js";
29
+ import { softRuleWarning as bn } from "./soft-rules.js";
30
+ import { usePersonalDefaultsApi as gn } from "./usePersonalDefaults.js";
31
+ import { resolveOptionFilterTokens as vn } from "../../lib/option-filter-tokens.js";
32
+ const wn = /* @__PURE__ */ new Set(["integer", "float", "decimal", "bigInteger", "number"]), kn = /* @__PURE__ */ new Set(["string", "text", "richtext", "textarea", "markdown", "json", "csv"]), _n = /* @__PURE__ */ new Set([
32
33
  "input",
33
34
  "textarea",
34
35
  "wysiwyg",
@@ -36,7 +37,7 @@ const bn = /* @__PURE__ */ new Set(["integer", "float", "decimal", "bigInteger",
36
37
  "input-rich-text-html",
37
38
  "rich_text",
38
39
  "extension-editorjs"
39
- ]), wn = /* @__PURE__ */ new Set([
40
+ ]), Nn = /* @__PURE__ */ new Set([
40
41
  "relation-m2o",
41
42
  "relation-m2m",
42
43
  "select-multiple-m2m",
@@ -47,71 +48,71 @@ const bn = /* @__PURE__ */ new Set(["integer", "float", "decimal", "bigInteger",
47
48
  "file",
48
49
  "files",
49
50
  "image"
50
- ]), kn = /* @__PURE__ */ new Set(["file", "file-image", "files-m2m", "files", "image"]);
51
- function _n(c) {
51
+ ]), Fn = /* @__PURE__ */ new Set(["file", "file-image", "files-m2m", "files", "image"]);
52
+ function Cn(c) {
52
53
  const e = c.interface ?? "";
53
- return wn.has(e) || e.startsWith("relation-") || e.endsWith("-m2o") || e.endsWith("-m2m") ? !1 : !!(gn.has(c.type ?? "") || vn.has(e) || !e && c.type && !bn.has(c.type));
54
+ return Nn.has(e) || e.startsWith("relation-") || e.endsWith("-m2o") || e.endsWith("-m2m") ? !1 : !!(kn.has(c.type ?? "") || _n.has(e) || !e && c.type && !wn.has(c.type));
54
55
  }
55
- function Nn(c, e, m, p) {
56
- const x = ie();
56
+ function Ln(c, e, u, p) {
57
+ const f = ie();
57
58
  return re({
58
- queryKey: ["field-lineage", c, e, m],
59
- queryFn: () => x.request(
60
- K(`/lineage/${c}/${encodeURIComponent(e)}/${m}`)
59
+ queryKey: ["field-lineage", c, e, u],
60
+ queryFn: () => f.request(
61
+ K(`/lineage/${c}/${encodeURIComponent(e)}/${u}`)
61
62
  ).then((a) => a.data),
62
63
  enabled: p,
63
64
  staleTime: 3e4
64
65
  });
65
66
  }
66
- function or(c, e = "rows") {
67
+ function cr(c, e = "rows") {
67
68
  var l, _, b;
68
69
  if (c && (c.kind === "write" || c.kind === "read") && c.formula) {
69
- const u = (y) => typeof y == "number" ? y.toLocaleString(void 0, { maximumFractionDigits: 2 }) : y == null || y === "" ? "∅" : String(y);
70
+ const m = (y) => typeof y == "number" ? y.toLocaleString(void 0, { maximumFractionDigits: 2 }) : y == null || y === "" ? "∅" : String(y);
70
71
  return `= ${c.formula.replace(/item\.([A-Za-z_][A-Za-z0-9_]*)/g, (y, o) => {
71
- var f;
72
- return u((f = c.inputs) == null ? void 0 : f[o]);
72
+ var x;
73
+ return m((x = c.inputs) == null ? void 0 : x[o]);
73
74
  }).replace(/\s*-\s*/g, " − ").replace(/\s*\*\s*/g, " × ").replace(/\s*\/\s*/g, " ÷ ")}`;
74
75
  }
75
76
  if (!c || c.kind !== "rollup") return null;
76
- const m = (c.sources ?? []).reduce((u, i) => u + i.rows.length, 0), p = (c.sources ?? []).reduce((u, i) => {
77
+ const u = (c.sources ?? []).reduce((m, i) => m + i.rows.length, 0), p = (c.sources ?? []).reduce((m, i) => {
77
78
  var y;
78
- return u + (((y = i.excluded) == null ? void 0 : y.length) ?? 0);
79
- }, 0), x = (b = (_ = (l = (c.sources ?? []).find((u) => {
79
+ return m + (((y = i.excluded) == null ? void 0 : y.length) ?? 0);
80
+ }, 0), f = (b = (_ = (l = (c.sources ?? []).find((m) => {
80
81
  var i;
81
- return (i = u.excluded) == null ? void 0 : i.length;
82
- })) == null ? void 0 : l.excluded) == null ? void 0 : _[0]) == null ? void 0 : b.reason, a = [`= ${m} ${m === 1 ? e.replace(/s$/, "") : e}`];
82
+ return (i = m.excluded) == null ? void 0 : i.length;
83
+ })) == null ? void 0 : l.excluded) == null ? void 0 : _[0]) == null ? void 0 : b.reason, a = [`= ${u} ${u === 1 ? e.replace(/s$/, "") : e}`];
83
84
  return p && a.push(
84
- `${p} excluded${x ? ` (${x.replace(/^does not match: /, "")})` : ""}`
85
+ `${p} excluded${f ? ` (${f.replace(/^does not match: /, "")})` : ""}`
85
86
  ), a.join(" · ");
86
87
  }
87
- function Fn({
88
+ function Rn({
88
89
  collection: c,
89
90
  itemId: e,
90
- field: m
91
+ field: u
91
92
  }) {
92
- const [p, x] = ve(!1), a = R(null), { data: l, isLoading: _ } = Nn(c, e, m, p);
93
+ const [p, f] = ve(!1), a = S(null), { data: l, isLoading: _ } = Ln(c, e, u, p);
93
94
  le(() => {
94
95
  if (!p) return;
95
96
  const i = (y) => {
96
97
  var o;
97
- (o = a.current) != null && o.contains(y.target) || x(!1);
98
+ (o = a.current) != null && o.contains(y.target) || f(!1);
98
99
  };
99
100
  return window.addEventListener("mousedown", i), () => window.removeEventListener("mousedown", i);
100
101
  }, [p]);
101
- const b = (i) => i == null ? "—" : Number(i).toLocaleString(void 0, { maximumFractionDigits: 2 }), u = (l == null ? void 0 : l.stored_value) != null ? Number(l.stored_value) : null;
102
+ const b = (i) => i == null ? "—" : Number(i).toLocaleString(void 0, { maximumFractionDigits: 2 }), m = (l == null ? void 0 : l.stored_value) != null ? Number(l.stored_value) : null;
102
103
  return /* @__PURE__ */ d("div", { ref: a, className: "relative inline-flex", children: [
103
104
  /* @__PURE__ */ n(
104
105
  "button",
105
106
  {
106
107
  type: "button",
107
- onClick: () => x((i) => !i),
108
+ onClick: () => f((i) => !i),
108
109
  title: "Where does this number come from?",
109
110
  className: j(
110
111
  "inline-flex items-center rounded p-0.5 transition-opacity",
111
112
  p ? "text-nvr-cyan opacity-100" : "text-slate-400 hover:text-nvr-cyan dark:text-slate-300 dark:hover:text-nvr-cyan"
112
113
  ),
113
114
  "data-field-lineage": !0,
114
- children: /* @__PURE__ */ n(Ct, { className: "h-3 w-3" })
115
+ children: /* @__PURE__ */ n(Rt, { className: "h-3 w-3" })
115
116
  }
116
117
  ),
117
118
  p && /* @__PURE__ */ d("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: [
@@ -141,24 +142,24 @@ function Fn({
141
142
  ] }),
142
143
  i.error && /* @__PURE__ */ n("p", { className: "px-1 py-1 text-[11.5px] text-amber-600 dark:text-amber-400", children: i.error }),
143
144
  i.note && /* @__PURE__ */ n("p", { className: "px-1 py-1 text-[11.5px] text-slate-400", children: i.note }),
144
- i.rows.length > 0 && /* @__PURE__ */ n("div", { className: "mt-0.5 space-y-px", children: i.rows.map((f) => /* @__PURE__ */ d(
145
+ i.rows.length > 0 && /* @__PURE__ */ n("div", { className: "mt-0.5 space-y-px", children: i.rows.map((x) => /* @__PURE__ */ d(
145
146
  "div",
146
147
  {
147
148
  className: "flex items-baseline gap-2 rounded px-1 py-0.5 text-[11.5px] hover:bg-slate-50 dark:hover:bg-muted",
148
149
  children: [
149
- /* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate text-slate-600 dark:text-slate-300", children: f.label }),
150
- /* @__PURE__ */ n("span", { className: "shrink-0 font-mono tabular-nums text-slate-800 dark:text-slate-100", children: b(f.value) }),
150
+ /* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate text-slate-600 dark:text-slate-300", children: x.label }),
151
+ /* @__PURE__ */ n("span", { className: "shrink-0 font-mono tabular-nums text-slate-800 dark:text-slate-100", children: b(x.value) }),
151
152
  /* @__PURE__ */ n(
152
153
  "span",
153
154
  {
154
155
  className: "w-[88px] shrink-0 truncate text-right text-[10px] text-slate-400",
155
- "data-tip": f.updated_at ? `${f.updated_by ?? "unknown"} · ${new Date(f.updated_at).toLocaleString()}` : void 0,
156
- children: f.updated_by ?? ""
156
+ "data-tip": x.updated_at ? `${x.updated_by ?? "unknown"} · ${new Date(x.updated_at).toLocaleString()}` : void 0,
157
+ children: x.updated_by ?? ""
157
158
  }
158
159
  )
159
160
  ]
160
161
  },
161
- f.id
162
+ x.id
162
163
  )) }),
163
164
  i.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." }),
164
165
  i.subtotal != null && /* @__PURE__ */ d("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: [
@@ -172,16 +173,16 @@ function Fn({
172
173
  " ",
173
174
  i.excluded[0].reason.replace(/^does not match: /, "")
174
175
  ] }),
175
- i.excluded.slice(0, 8).map((f) => /* @__PURE__ */ d(
176
+ i.excluded.slice(0, 8).map((x) => /* @__PURE__ */ d(
176
177
  "div",
177
178
  {
178
179
  className: "flex items-baseline gap-2 px-0.5 text-[11px] text-slate-400",
179
180
  children: [
180
- /* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate line-through decoration-slate-300", children: f.label }),
181
- /* @__PURE__ */ n("span", { className: "shrink-0 font-mono tabular-nums", children: b(f.value) })
181
+ /* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate line-through decoration-slate-300", children: x.label }),
182
+ /* @__PURE__ */ n("span", { className: "shrink-0 font-mono tabular-nums", children: b(x.value) })
182
183
  ]
183
184
  },
184
- f.id
185
+ x.id
185
186
  )),
186
187
  i.excluded.length > 8 && /* @__PURE__ */ d("p", { className: "px-0.5 text-[10.5px] text-slate-400", children: [
187
188
  "+",
@@ -191,39 +192,39 @@ function Fn({
191
192
  ] })
192
193
  ] }, y);
193
194
  }),
194
- (l == null ? void 0 : l.kind) === "rollup" && u != null && /* @__PURE__ */ d("p", { className: "px-1 pt-0.5 text-right text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
195
+ (l == null ? void 0 : l.kind) === "rollup" && m != null && /* @__PURE__ */ d("p", { className: "px-1 pt-0.5 text-right text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
195
196
  "stored ",
196
- b(u),
197
+ b(m),
197
198
  (() => {
198
- const i = (l.sources ?? []).reduce((o, f) => o + (f.subtotal ?? 0), 0);
199
- return (l.sources ?? []).some((o) => o.truncated) ? null : Math.abs(i - u) < 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" });
199
+ const i = (l.sources ?? []).reduce((o, x) => o + (x.subtotal ?? 0), 0);
200
+ return (l.sources ?? []).some((o) => o.truncated) ? null : Math.abs(i - m) < 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" });
200
201
  })()
201
202
  ] })
202
203
  ] })
203
204
  ] });
204
205
  }
205
- function Cn({
206
+ function Sn({
206
207
  collection: c,
207
208
  itemId: e,
208
- field: m,
209
+ field: u,
209
210
  formatValue: p,
210
- onRestore: x
211
+ onRestore: f
211
212
  }) {
212
- const a = ie(), [l, _] = ve(!1), b = R(null), { data: u, isLoading: i } = re({
213
- queryKey: ["field-value-history", c, e, m],
214
- queryFn: () => a.request(K(`/field-history/${c}/${encodeURIComponent(e)}/${m}`)).then((o) => o.data ?? []),
213
+ const a = ie(), [l, _] = ve(!1), b = S(null), { data: m, isLoading: i } = re({
214
+ queryKey: ["field-value-history", c, e, u],
215
+ queryFn: () => a.request(K(`/field-history/${c}/${encodeURIComponent(e)}/${u}`)).then((o) => o.data ?? []),
215
216
  enabled: l,
216
217
  staleTime: 6e4
217
218
  });
218
219
  le(() => {
219
220
  if (!l) return;
220
- const o = (f) => {
221
+ const o = (x) => {
221
222
  var U;
222
- (U = b.current) != null && U.contains(f.target) || _(!1);
223
+ (U = b.current) != null && U.contains(x.target) || _(!1);
223
224
  };
224
225
  return window.addEventListener("mousedown", o), () => window.removeEventListener("mousedown", o);
225
226
  }, [l]);
226
- const y = (o, f) => f || (o == null || o === "" ? "—" : p ? p(o) : typeof o == "boolean" || o === "true" || o === "false" ? o === !0 || o === "true" ? "Yes" : "No" : typeof o == "string" && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/.test(o) ? new Date(o).toLocaleString() : typeof o == "object" ? JSON.stringify(o).slice(0, 60) : String(o).slice(0, 80));
227
+ const y = (o, x) => x || (o == null || o === "" ? "—" : p ? p(o) : typeof o == "boolean" || o === "true" || o === "false" ? o === !0 || o === "true" ? "Yes" : "No" : typeof o == "string" && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/.test(o) ? new Date(o).toLocaleString() : typeof o == "object" ? JSON.stringify(o).slice(0, 60) : String(o).slice(0, 80));
227
228
  return /* @__PURE__ */ d("div", { ref: b, className: "relative inline-flex", children: [
228
229
  /* @__PURE__ */ n(
229
230
  "button",
@@ -236,24 +237,24 @@ function Cn({
236
237
  l ? "text-nvr-cyan opacity-100" : "text-slate-400 hover:text-nvr-cyan dark:text-slate-300 dark:hover:text-nvr-cyan"
237
238
  ),
238
239
  "data-field-history": !0,
239
- children: /* @__PURE__ */ n(_t, { className: "h-3 w-3" })
240
+ children: /* @__PURE__ */ n(Ft, { className: "h-3 w-3" })
240
241
  }
241
242
  ),
242
243
  l && /* @__PURE__ */ d("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: [
243
244
  /* @__PURE__ */ n("p", { className: "mb-1 px-1 text-[10px] font-semibold uppercase tracking-wide text-slate-400", children: "Value history" }),
244
- i ? /* @__PURE__ */ n("p", { className: "px-1 py-2 text-[11.5px] text-slate-400", children: "Loading…" }) : (u ?? []).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: (u ?? []).map((o, f) => /* @__PURE__ */ d(
245
+ i ? /* @__PURE__ */ n("p", { className: "px-1 py-2 text-[11.5px] text-slate-400", children: "Loading…" }) : (m ?? []).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: (m ?? []).map((o, x) => /* @__PURE__ */ d(
245
246
  "div",
246
247
  {
247
248
  className: "rounded px-1 py-1 text-[11.5px] leading-snug hover:bg-slate-50 dark:hover:bg-muted",
248
249
  children: [
249
250
  /* @__PURE__ */ d("span", { className: "flex items-baseline justify-between gap-2", children: [
250
251
  /* @__PURE__ */ n("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: y(o.value, o.display) }),
251
- x && f > 0 && /* @__PURE__ */ n(
252
+ f && x > 0 && /* @__PURE__ */ n(
252
253
  "button",
253
254
  {
254
255
  type: "button",
255
256
  onClick: () => {
256
- x(o.value ?? null), _(!1);
257
+ f(o.value ?? null), _(!1);
257
258
  },
258
259
  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",
259
260
  children: "Restore"
@@ -279,17 +280,17 @@ function Cn({
279
280
  ] })
280
281
  ]
281
282
  },
282
- f
283
+ x
283
284
  )) })
284
285
  ] })
285
286
  ] });
286
287
  }
287
- function Ln({
288
+ function $n({
288
289
  collection: c,
289
290
  itemId: e,
290
- field: m
291
+ field: u
291
292
  }) {
292
- const p = ie(), x = Ve(), { data: a } = re({
293
+ const p = ie(), f = Ge(), { data: a } = re({
293
294
  queryKey: ["field-watch-config"],
294
295
  queryFn: () => p.request(K("/field-watches/config")).then((i) => i.data).catch(() => ({ enabled: !1 })),
295
296
  staleTime: 5 * 6e4
@@ -298,14 +299,14 @@ function Ln({
298
299
  queryFn: () => p.request(K("/field-watches/self", { collection: c, item_id: e })).then((i) => i.data ?? []).catch(() => []),
299
300
  enabled: !!(a != null && a.enabled),
300
301
  staleTime: 6e4
301
- }), b = _.includes(m), u = yt({
302
+ }), b = _.includes(u), m = gt({
302
303
  mutationFn: () => b ? p.request(
303
- Tt(
304
- `/field-watches/self?collection=${encodeURIComponent(c)}&field=${encodeURIComponent(m)}&item_id=${encodeURIComponent(e)}`
304
+ Pt(
305
+ `/field-watches/self?collection=${encodeURIComponent(c)}&field=${encodeURIComponent(u)}&item_id=${encodeURIComponent(e)}`
305
306
  )
306
- ) : p.request(ge("/field-watches/self", { collection: c, field: m, item_id: e })),
307
+ ) : p.request(ge("/field-watches/self", { collection: c, field: u, item_id: e })),
307
308
  onSuccess: () => {
308
- x.invalidateQueries({ queryKey: l }), oe.success(
309
+ f.invalidateQueries({ queryKey: l }), oe.success(
309
310
  b ? "No longer watching this field" : "Watching — you will be notified when it changes"
310
311
  );
311
312
  },
@@ -315,47 +316,47 @@ function Ln({
315
316
  "button",
316
317
  {
317
318
  type: "button",
318
- onClick: () => u.mutate(),
319
+ onClick: () => m.mutate(),
319
320
  title: b ? "Stop watching this field on this record" : "Watch this field on this record",
320
- "data-field-watch": m,
321
+ "data-field-watch": u,
321
322
  className: `rounded p-0.5 transition-colors ${b ? "text-nvr-navy dark:text-nvr-cyan" : "text-slate-300 hover:text-slate-500"}`,
322
- children: b ? /* @__PURE__ */ n(Nt, { className: "h-3 w-3" }) : /* @__PURE__ */ n(Ft, { className: "h-3 w-3" })
323
+ children: b ? /* @__PURE__ */ n(Ct, { className: "h-3 w-3" }) : /* @__PURE__ */ n(Lt, { className: "h-3 w-3" })
323
324
  }
324
325
  ) : null;
325
326
  }
326
- function Sn(c) {
327
+ function qn(c) {
327
328
  return c ? c.querySelector(
328
329
  'input:not([type=hidden]), textarea, [role="combobox"], [contenteditable="true"]'
329
330
  ) ?? c.querySelector("button") : null;
330
331
  }
331
- const ir = Lt(function({
332
+ const dr = St(function({
332
333
  field: e,
333
- draft: m,
334
+ draft: u,
334
335
  onChange: p,
335
- relations: x,
336
+ relations: f,
336
337
  collection: a,
337
338
  itemId: l,
338
339
  error: _,
339
340
  visible: b,
340
- locked: u,
341
+ locked: m,
341
342
  layoutAiEnabled: i,
342
343
  renderField: y,
343
344
  onCountChange: o,
344
- swapButton: f,
345
+ swapButton: x,
345
346
  swapContent: U,
346
- forceVisible: ze,
347
+ forceVisible: Qe,
347
348
  autoFillTick: ae
348
349
  }) {
349
- var De, Be, Oe;
350
- const H = kn.has(e.interface ?? ""), F = Rt(), g = tn(), we = Ve(), se = ie(), [ke, W] = ve(!1), s = Mt(), _e = Pt(e.field), V = R(null), z = St(), ce = R(null), Ne = R(!1);
350
+ var Oe, De, Me, Ke;
351
+ const H = Fn.has(e.interface ?? ""), N = qt(), g = rn(), we = Ge(), se = ie(), [ke, W] = ve(!1), s = Ut(), _e = Bt(e.field), V = S(null), z = $t(), ce = S(null), Ne = S(!1);
351
352
  le(() => {
352
- const t = Ne.current ? Sn(ce.current) : null;
353
+ const t = Ne.current ? qn(ce.current) : null;
353
354
  if (!t || t.hasAttribute("aria-label")) return;
354
355
  t.id || (t.id = `${z}-control`);
355
356
  const r = t.tagName === "BUTTON" ? `${z} ${t.id}` : z;
356
357
  t.getAttribute("aria-labelledby") !== r && t.setAttribute("aria-labelledby", r);
357
358
  });
358
- const Fe = u && !H, Ce = R(null);
359
+ const Fe = m && !H, Ce = S(null);
359
360
  le(() => {
360
361
  const t = Ce.current;
361
362
  if (!t) return;
@@ -366,36 +367,36 @@ const ir = Lt(function({
366
367
  const r = typeof document < "u" ? document.activeElement : null;
367
368
  r instanceof HTMLElement && t.contains(r) && r.blur(), t.setAttribute("inert", "");
368
369
  }, [Fe, ae]);
369
- const G = e.field, Le = Ke(
370
+ const G = e.field, Le = He(
370
371
  (t) => {
371
- u || p(G, t);
372
+ m || p(G, t);
372
373
  },
373
- [u, p, G]
374
- ), Ge = Ke(
374
+ [m, p, G]
375
+ ), Ye = He(
375
376
  (t) => o == null ? void 0 : o(G, t),
376
377
  [o, G]
377
- ), Qe = R(void 0), Se = R(void 0), Re = R(void 0), $e = !u && !e.readonly && !e.computed_formula && !(e.hidden && !e.layout_assigned) && !We(e), {
378
- onContextMenu: Ye,
379
- onKeyDown: Je,
380
- menu: Xe,
381
- confirmSaveFrom: Ze,
378
+ ), Je = S(void 0), Re = S(void 0), Se = S(void 0), $e = !m && !e.readonly && !e.computed_formula && !(e.hidden && !e.layout_assigned) && !ze(e), {
379
+ onContextMenu: Xe,
380
+ onKeyDown: Ze,
381
+ menu: Ie,
382
+ confirmSaveFrom: et,
382
383
  openedBy: de
383
- } = Kt({
384
+ } = Ht({
384
385
  wrapperRef: V,
385
386
  field: e,
386
- value: m[e.field],
387
- relations: x,
387
+ value: u[e.field],
388
+ relations: f,
388
389
  collection: a,
389
390
  itemId: l,
390
391
  openRelated: s == null ? void 0 : s.openRelated,
391
392
  editable: $e
392
- }), T = Ut(V), Ie = on(), qe = s == null ? void 0 : s.remoteChanges[e.field], D = s == null ? void 0 : s.lockReasons[e.field], q = s == null ? void 0 : s.applyToLines[e.field], C = xn(), et = (C == null ? void 0 : C.applied(e.field)) ?? !1, Ae = (C == null ? void 0 : C.hintFor(e.field)) ?? null, ue = nn(C, e.field, $e), me = () => {
393
+ }), T = Wt(V), tt = sn(), qe = s == null ? void 0 : s.remoteChanges[e.field], B = s == null ? void 0 : s.lockReasons[e.field], A = s == null ? void 0 : s.applyToLines[e.field], C = gn(), nt = (C == null ? void 0 : C.applied(e.field)) ?? !1, Ae = (C == null ? void 0 : C.hintFor(e.field)) ?? null, ue = ln(C, e.field, $e), me = () => {
393
394
  var t, r;
394
- return ((t = ce.current) == null ? void 0 : t.querySelector(He)) ?? ((r = V.current) == null ? void 0 : r.querySelector(He));
395
- }, Q = $t(e._overrides, i, _n(e)), pe = !!(s != null && s.fromAutofill) && !!e._overrides && e._overrides[qt] === !0;
396
- async function tt() {
395
+ return ((t = ce.current) == null ? void 0 : t.querySelector(Ve)) ?? ((r = V.current) == null ? void 0 : r.querySelector(Ve));
396
+ }, Q = At(e._overrides, i, Cn(e)), pe = !!(s != null && s.fromAutofill) && !!e._overrides && e._overrides[Tt] === !0;
397
+ async function rt() {
397
398
  var t;
398
- if (Q.perField) return nt();
399
+ if (Q.perField) return lt();
399
400
  W(!0);
400
401
  try {
401
402
  const r = await se.request(
@@ -411,10 +412,10 @@ const ir = Lt(function({
411
412
  W(!1);
412
413
  }
413
414
  }
414
- async function nt() {
415
+ async function lt() {
415
416
  var r, h, w, P;
416
417
  const t = {};
417
- for (const k of ((r = At(e._overrides)) == null ? void 0 : r.tokens) ?? []) k in m && (t[k] = m[k]);
418
+ for (const k of ((r = Et(e._overrides)) == null ? void 0 : r.tokens) ?? []) k in u && (t[k] = u[k]);
418
419
  W(!0);
419
420
  try {
420
421
  const k = await se.request(
@@ -425,25 +426,25 @@ const ir = Lt(function({
425
426
  item_id: l && l !== "new" ? l : null,
426
427
  values: t
427
428
  })
428
- ), N = (h = k.data) == null ? void 0 : h.value;
429
- typeof N == "string" && N !== "" ? p(e.field, N) : oe.info("The AI had nothing to write here"), (P = (w = k.data) == null ? void 0 : w.missing) != null && P.length && oe.info(`Filled without ${k.data.missing.join(", ")} (empty or not visible to you)`);
429
+ ), F = (h = k.data) == null ? void 0 : h.value;
430
+ typeof F == "string" && F !== "" ? p(e.field, F) : oe.info("The AI had nothing to write here"), (P = (w = k.data) == null ? void 0 : w.missing) != null && P.length && oe.info(`Filled without ${k.data.missing.join(", ")} (empty or not visible to you)`);
430
431
  } catch (k) {
431
- Et(k, "AI fill failed", { action: "Fill with AI" });
432
+ jt(k, "AI fill failed", { action: "Fill with AI" });
432
433
  } finally {
433
434
  W(!1);
434
435
  }
435
436
  }
436
- const E = Yt(e.dependency_config), Te = E.flatMap((t) => {
437
- const r = x.find(
437
+ const E = Xt(e.dependency_config), Te = E.flatMap((t) => {
438
+ const r = f.find(
438
439
  (w) => w.one_collection === a && w.one_field === t.parent_field
439
440
  );
440
441
  if (!r) return [];
441
442
  if (r.junction_field) return [{ rule: t, rel: r }];
442
- const h = x.find(
443
+ const h = f.find(
443
444
  (w) => w.many_collection === r.many_collection && w.id !== r.id
444
445
  );
445
446
  return h != null && h.many_field ? [{ rule: t, rel: { ...r, junction_field: h.many_field } }] : [];
446
- }), rt = xt({
447
+ }), ot = bt({
447
448
  queries: Te.map(({ rel: t }) => ({
448
449
  queryKey: ["m2m-items", t.many_collection, t.many_field, l],
449
450
  queryFn: () => se.request(
@@ -456,41 +457,41 @@ const ir = Lt(function({
456
457
  enabled: !!l && l !== "new",
457
458
  staleTime: 3e4
458
459
  }))
459
- }), lt = Object.fromEntries(
460
+ }), it = Object.fromEntries(
460
461
  Te.map(({ rule: t, rel: r }, h) => {
461
462
  var k;
462
463
  const w = r.one_field ?? `${r.many_collection}.${r.junction_field}`, P = (g == null ? void 0 : g.getStagedUnlinks(w)) ?? /* @__PURE__ */ new Set();
463
464
  return [
464
465
  t.parent_field,
465
- (((k = rt[h]) == null ? void 0 : k.data) ?? []).filter((N) => !P.has(N.id)).map((N) => N[r.junction_field])
466
+ (((k = ot[h]) == null ? void 0 : k.data) ?? []).filter((F) => !P.has(F.id)).map((F) => F[r.junction_field])
466
467
  ];
467
468
  })
468
- ), Y = Bt()[e.field] ?? [];
469
- if (!ze && (!b || !e.layout_assigned && (e.hidden || Jt.has(e.field))))
469
+ ), Y = Mt()[e.field] ?? [];
470
+ if (!Qe && (!b || !e.layout_assigned && (e.hidden || Zt.has(e.field))))
470
471
  return null;
471
- const he = m[e.field] ?? null, J = an(e, Ie), L = J.label ?? Z(e.field);
472
+ const he = u[e.field] ?? null, J = cn(e, tt), L = J.label ?? Z(e.field);
472
473
  Ne.current = L !== "";
473
- const A = We(e), Ee = A ? null : sn(e), ot = !A && !u && !e.readonly && ((De = e._overrides) == null ? void 0 : De.repeat_last) === !0, it = en(e, m), at = (Oe = (Be = Xt(e.options)) == null ? void 0 : Be.auto_id) == null ? void 0 : Oe.pattern, v = (() => {
474
- const t = x.find(
474
+ const $ = ze(e), Ee = $ ? null : dn(e), Pe = $ || !(l === "new" || !l || (Oe = N == null ? void 0 : N.dirtyFields) != null && Oe.has(e.field)) ? null : bn(e, u), at = !$ && !m && !e.readonly && ((De = e._overrides) == null ? void 0 : De.repeat_last) === !0, st = nn(e, u), ct = (Ke = (Me = It(e.options)) == null ? void 0 : Me.auto_id) == null ? void 0 : Ke.pattern, v = (() => {
475
+ const t = f.find(
475
476
  (h) => h.one_collection === a && h.one_field === e.field
476
477
  );
477
478
  if (!t) return null;
478
479
  if (t.junction_field) return t;
479
- const r = x.find(
480
+ const r = f.find(
480
481
  (h) => h.many_collection === t.many_collection && h.id !== t.id
481
482
  );
482
483
  return r ? { ...t, junction_field: r.many_field } : null;
483
- })(), fe = v ? null : x.find((t) => t.many_collection === a && t.many_field === e.field) ?? null, xe = v ? x.find(
484
+ })(), xe = v ? null : f.find((t) => t.many_collection === a && t.many_field === e.field) ?? null, fe = v ? f.find(
484
485
  (t) => t.many_collection === v.many_collection && t.many_field === v.junction_field && t.id !== v.id
485
- ) ?? null : null, B = v ? v.one_field ?? `${v.many_collection}.${v.junction_field}` : null, Pe = B ? (g == null ? void 0 : g.getStagedLinks(B)) ?? [] : [], st = v ? (we.getQueryData([
486
+ ) ?? null : null, O = v ? v.one_field ?? `${v.many_collection}.${v.junction_field}` : null, je = O ? (g == null ? void 0 : g.getStagedLinks(O)) ?? [] : [], dt = v ? (we.getQueryData([
486
487
  "m2m-items",
487
488
  v.many_collection,
488
489
  v.many_field,
489
490
  l
490
- ]) ?? []).map((t) => t[v.junction_field]) : [], ct = v ? Pe[0] ?? st[0] ?? null : he, dt = (xe == null ? void 0 : xe.one_collection) ?? (fe == null ? void 0 : fe.one_collection) ?? void 0, X = (t) => {
491
+ ]) ?? []).map((t) => t[v.junction_field]) : [], ut = v ? je[0] ?? dt[0] ?? null : he, mt = (fe == null ? void 0 : fe.one_collection) ?? (xe == null ? void 0 : xe.one_collection) ?? void 0, X = (t) => {
491
492
  var r;
492
- return ((F == null ? void 0 : F.collection) === a ? (r = F == null ? void 0 : F.fieldLabels) == null ? void 0 : r[t] : void 0) ?? Z(String(t));
493
- }, $ = Zt({
493
+ return ((N == null ? void 0 : N.collection) === a ? (r = N == null ? void 0 : N.fieldLabels) == null ? void 0 : r[t] : void 0) ?? Z(String(t));
494
+ }, q = en({
494
495
  rules: E,
495
496
  // A parent whose value THIS field's own pick derived must not narrow this
496
497
  // field's options — otherwise picking a region locks the region picker
@@ -501,43 +502,43 @@ const ir = Lt(function({
501
502
  return ((r = g == null ? void 0 : g.getDerivedOrigin) == null ? void 0 : r.call(g, t)) === e.field;
502
503
  },
503
504
  parentValue: (t) => {
504
- if (m[t] != null) return m[t];
505
- const r = x.find((S) => S.one_collection === a && S.one_field === t);
505
+ if (u[t] != null) return u[t];
506
+ const r = f.find((R) => R.one_collection === a && R.one_field === t);
506
507
  if (!r) return null;
507
508
  let h = r;
508
509
  if (!h.junction_field) {
509
- const S = x.find(
510
- (Me) => Me.many_collection === r.many_collection && Me.id !== r.id
510
+ const R = f.find(
511
+ (Ue) => Ue.many_collection === r.many_collection && Ue.id !== r.id
511
512
  );
512
- if (S != null && S.many_field) h = { ...r, junction_field: S.many_field };
513
+ if (R != null && R.many_field) h = { ...r, junction_field: R.many_field };
513
514
  else return null;
514
515
  }
515
- const w = h.one_field ?? `${h.many_collection}.${h.junction_field}`, P = (g == null ? void 0 : g.getStagedLinks(w)) ?? [], k = lt[t] ?? [], N = [...new Set([...P, ...k].map((S) => String(S)))];
516
- return N.length === 0 ? null : N.length === 1 ? N[0] : N;
516
+ const w = h.one_field ?? `${h.many_collection}.${h.junction_field}`, P = (g == null ? void 0 : g.getStagedLinks(w)) ?? [], k = it[t] ?? [], F = [...new Set([...P, ...k].map((R) => String(R)))];
517
+ return F.length === 0 ? null : F.length === 1 ? F[0] : F;
517
518
  },
518
519
  parentOptionFilter: (t) => {
519
520
  var h;
520
- const r = (F == null ? void 0 : F.collection) === a ? (h = F.fieldOptionFilters) == null ? void 0 : h[t] : void 0;
521
- return r ? yn(r, m, l) : void 0;
521
+ const r = (N == null ? void 0 : N.collection) === a ? (h = N.fieldOptionFilters) == null ? void 0 : h[t] : void 0;
522
+ return r ? vn(r, u, l) : void 0;
522
523
  }
523
- }), O = $.filter ? hn(Qe, $.filter, fn) : $.filter, M = $.satisfiedParents.map(X), ye = $.satisfiedParents, ut = $.unsatisfiedParents.length ? X($.unsatisfiedParents[0]) : null, be = $.missingRequiredParents, je = be.length ? X(be[0]) : null;
524
- function mt() {
525
- const t = Re.current;
524
+ }), D = q.filter ? fn(Je, q.filter, yn) : q.filter, M = q.satisfiedParents.map(X), ye = q.satisfiedParents, pt = q.unsatisfiedParents.length ? X(q.unsatisfiedParents[0]) : null, be = q.missingRequiredParents, Be = be.length ? X(be[0]) : null;
525
+ function ht() {
526
+ const t = Se.current;
526
527
  if (t && t.src === e) return t.value;
527
528
  const r = { ...e, readonly: !0 };
528
- return Re.current = { src: e, value: r }, r;
529
+ return Se.current = { src: e, value: r }, r;
529
530
  }
530
- function pt() {
531
- const t = JSON.stringify([M, ye]), r = Se.current;
531
+ function xt() {
532
+ const t = JSON.stringify([M, ye]), r = Re.current;
532
533
  if (r && r.sig === t && r.onChange === p) return r.value;
533
534
  const h = {
534
535
  labels: M,
535
536
  keys: ye,
536
537
  onClear: (w) => p(w, null)
537
538
  };
538
- return Se.current = { sig: t, onChange: p, value: h }, h;
539
+ return Re.current = { sig: t, onChange: p, value: h }, h;
539
540
  }
540
- function ht() {
541
+ function ft() {
541
542
  for (const t of ye) {
542
543
  const r = document.querySelector(`[data-field="${t}"]`);
543
544
  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(() => {
@@ -547,16 +548,16 @@ const ir = Lt(function({
547
548
  }, 900));
548
549
  }
549
550
  }
550
- const ft = () => {
551
- if (v && B) {
552
- for (const r of Pe) g == null || g.unstageLink(B, r);
551
+ const yt = () => {
552
+ if (v && O) {
553
+ for (const r of je) g == null || g.unstageLink(O, r);
553
554
  const t = we.getQueryData([
554
555
  "m2m-items",
555
556
  v.many_collection,
556
557
  v.many_field,
557
558
  l
558
559
  ]) ?? [];
559
- for (const r of t) g == null || g.stageUnlink(B, r.id);
560
+ for (const r of t) g == null || g.stageUnlink(O, r.id);
560
561
  } else
561
562
  p(e.field, null);
562
563
  };
@@ -574,20 +575,20 @@ const ir = Lt(function({
574
575
  "group/fieldrow space-y-1.5",
575
576
  pe && "rounded-md bg-amber-50/60 p-1.5 ring-1 ring-amber-300 dark:bg-amber-500/10 dark:ring-amber-500/40"
576
577
  ),
577
- onContextMenu: Ye,
578
- onKeyDown: Je,
578
+ onContextMenu: Xe,
579
+ onKeyDown: Ze,
579
580
  onFocusCapture: T.onFocusCapture,
580
581
  children: [
581
- Xe,
582
+ Ie,
582
583
  E.length > 0 && /* @__PURE__ */ n(
583
- It,
584
+ tn,
584
585
  {
585
586
  cascadeRules: E,
586
- cascadeFilter: O,
587
- currentValue: ct,
588
- relatedCollection: dt,
587
+ cascadeFilter: D,
588
+ currentValue: ut,
589
+ relatedCollection: mt,
589
590
  missingRequiredParents: be,
590
- onClear: ft
591
+ onClear: yt
591
592
  }
592
593
  ),
593
594
  (L !== "" || Y.length > 0) && /* @__PURE__ */ d(
@@ -597,17 +598,17 @@ const ir = Lt(function({
597
598
  "data-pd-row": ue ? "" : void 0,
598
599
  children: [
599
600
  L !== "" && /* @__PURE__ */ d(Dt, { id: z, "data-field-label": !0, className: "text-sm font-medium", children: [
600
- /* @__PURE__ */ n(Ue, { text: L, collection: a }),
601
+ /* @__PURE__ */ n(We, { text: L, collection: a }),
601
602
  e.required && /* @__PURE__ */ n("span", { className: "ml-0.5 text-destructive", children: "*" }),
602
- cn(e) && /* @__PURE__ */ n(dn, {})
603
+ un(e) && /* @__PURE__ */ n(mn, {})
603
604
  ] }),
604
605
  J.note && /* @__PURE__ */ n(I, { delayDuration: 100, children: /* @__PURE__ */ d(ee, { children: [
605
- /* @__PURE__ */ n(te, { asChild: !0, children: /* @__PURE__ */ n(bt, { className: "h-3.5 w-3.5 shrink-0 cursor-help text-slate-400 hover:text-slate-600" }) }),
606
- /* @__PURE__ */ n(ne, { side: "top", className: "max-w-[240px] text-[12px]", children: (s == null ? void 0 : s.glossaryHelp) === !1 ? J.note : /* @__PURE__ */ n(Ue, { text: J.note, collection: a }) })
606
+ /* @__PURE__ */ n(te, { asChild: !0, children: /* @__PURE__ */ n(vt, { className: "h-3.5 w-3.5 shrink-0 cursor-help text-slate-400 hover:text-slate-600" }) }),
607
+ /* @__PURE__ */ n(ne, { side: "top", className: "max-w-[240px] text-[12px]", children: (s == null ? void 0 : s.glossaryHelp) === !1 ? J.note : /* @__PURE__ */ n(We, { text: J.note, collection: a }) })
607
608
  ] }) }),
608
- _e && /* @__PURE__ */ n(jt, { source: _e, label: L }),
609
- !A && l && l !== "new" && /* @__PURE__ */ n(
610
- Cn,
609
+ _e && /* @__PURE__ */ n(Ot, { source: _e, label: L }),
610
+ !$ && l && l !== "new" && /* @__PURE__ */ n(
611
+ Sn,
611
612
  {
612
613
  collection: a,
613
614
  itemId: l,
@@ -615,11 +616,11 @@ const ir = Lt(function({
615
616
  onRestore: e.readonly ? void 0 : (t) => p(e.field, t)
616
617
  }
617
618
  ),
618
- !A && l && l !== "new" && /* @__PURE__ */ n(Ln, { collection: a, itemId: l, field: e.field }),
619
- !A && l && l !== "new" && /* @__PURE__ */ n(zt, { field: e.field, label: L || Z(e.field) }),
620
- l && l !== "new" && it && /* @__PURE__ */ n(Fn, { collection: a, itemId: l, field: e.field }),
621
- ot && /* @__PURE__ */ n(
622
- un,
619
+ !$ && l && l !== "new" && /* @__PURE__ */ n($n, { collection: a, itemId: l, field: e.field }),
620
+ !$ && l && l !== "new" && /* @__PURE__ */ n(Qt, { field: e.field, label: L || Z(e.field) }),
621
+ l && l !== "new" && st && /* @__PURE__ */ n(Rn, { collection: a, itemId: l, field: e.field }),
622
+ at && /* @__PURE__ */ n(
623
+ pn,
623
624
  {
624
625
  collection: a,
625
626
  itemId: l,
@@ -628,17 +629,17 @@ const ir = Lt(function({
628
629
  onFill: (t) => p(e.field, t)
629
630
  }
630
631
  ),
631
- !A && Q.show && !(Q.perField && (u || e.readonly)) && /* @__PURE__ */ d(
632
+ !$ && Q.show && !(Q.perField && (m || e.readonly)) && /* @__PURE__ */ d(
632
633
  "button",
633
634
  {
634
635
  type: "button",
635
- onClick: tt,
636
+ onClick: rt,
636
637
  disabled: ke,
637
638
  "data-ai-fill": Q.perField ? e.field : void 0,
638
639
  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",
639
640
  title: "Generate with AI",
640
641
  children: [
641
- ke ? /* @__PURE__ */ n(gt, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ n(vt, { className: "h-3 w-3" }),
642
+ ke ? /* @__PURE__ */ n(wt, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ n(kt, { className: "h-3 w-3" }),
642
643
  "AI"
643
644
  ]
644
645
  }
@@ -651,18 +652,18 @@ const ir = Lt(function({
651
652
  children: "Check this"
652
653
  }
653
654
  ),
654
- f,
655
- q && !u && !e.readonly && /* @__PURE__ */ d(
655
+ x,
656
+ A && !m && !e.readonly && /* @__PURE__ */ d(
656
657
  "button",
657
658
  {
658
659
  type: "button",
659
- onClick: () => q.onApply(m[e.field] ?? null),
660
- disabled: m[e.field] == null || m[e.field] === "" || q.count === 0,
660
+ onClick: () => A.onApply(u[e.field] ?? null),
661
+ disabled: u[e.field] == null || u[e.field] === "" || A.count === 0,
661
662
  "data-apply-to-lines": e.field,
662
- "data-tip": q.count === 0 ? "No lines yet — add lines first" : m[e.field] == null || m[e.field] === "" ? "Pick a value first" : q.count != null ? `Copy this value onto all ${q.count} lines (staged until you save)` : "Copy this value onto every line (staged until you save)",
663
+ "data-tip": A.count === 0 ? "No lines yet — add lines first" : u[e.field] == null || u[e.field] === "" ? "Pick a value first" : A.count != null ? `Copy this value onto all ${A.count} lines (staged until you save)` : "Copy this value onto every line (staged until you save)",
663
664
  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",
664
665
  children: [
665
- q.label ?? "Apply to lines",
666
+ A.label ?? "Apply to lines",
666
667
  " ↓"
667
668
  ]
668
669
  }
@@ -690,7 +691,7 @@ const ir = Lt(function({
690
691
  ] })
691
692
  ] }) }),
692
693
  /* @__PURE__ */ n(
693
- Qt,
694
+ Jt,
694
695
  {
695
696
  collection: a,
696
697
  kind: "field",
@@ -698,12 +699,12 @@ const ir = Lt(function({
698
699
  label: L
699
700
  }
700
701
  ),
701
- (u || e.readonly) && D ? /* @__PURE__ */ n(Ht, { reason: D, onHover: s == null ? void 0 : s.onLockHover }) : u ? /* @__PURE__ */ n(I, { delayDuration: 200, children: /* @__PURE__ */ d(ee, { children: [
702
- /* @__PURE__ */ n(te, { asChild: !0, children: /* @__PURE__ */ n("span", { className: "inline-flex items-center text-amber-400 dark:text-amber-500", children: /* @__PURE__ */ n(wt, { className: "h-3 w-3" }) }) }),
702
+ (m || e.readonly) && B ? /* @__PURE__ */ n(Vt, { reason: B, onHover: s == null ? void 0 : s.onLockHover }) : m ? /* @__PURE__ */ n(I, { delayDuration: 200, children: /* @__PURE__ */ d(ee, { children: [
703
+ /* @__PURE__ */ n(te, { asChild: !0, children: /* @__PURE__ */ n("span", { className: "inline-flex items-center text-amber-400 dark:text-amber-500", children: /* @__PURE__ */ n(_t, { className: "h-3 w-3" }) }) }),
703
704
  /* @__PURE__ */ n(ne, { side: "top", className: "text-[12px]", children: "This field is locked" })
704
705
  ] }) }) : null,
705
706
  E.length > 0 && (() => {
706
- const t = !!O && Object.keys(O).length > 0 && M.length > 0, r = E.map(
707
+ const t = !!D && Object.keys(D).length > 0 && M.length > 0, r = E.map(
707
708
  (h) => X(String(h.parent_field))
708
709
  );
709
710
  return /* @__PURE__ */ n(I, { delayDuration: 100, children: /* @__PURE__ */ d(ee, { children: [
@@ -712,12 +713,12 @@ const ir = Lt(function({
712
713
  {
713
714
  type: "button",
714
715
  "aria-label": `Show the fields that narrow ${L || "this list"}`,
715
- onClick: ht,
716
+ onClick: ft,
716
717
  className: j(
717
718
  "inline-flex items-center transition-colors",
718
719
  t ? "text-nvr-cyan hover:text-nvr-cyan" : "text-slate-300 hover:text-nvr-cyan dark:text-slate-600 dark:hover:text-nvr-cyan"
719
720
  ),
720
- children: /* @__PURE__ */ n(kt, { className: "h-3 w-3" })
721
+ children: /* @__PURE__ */ n(Nt, { className: "h-3 w-3" })
721
722
  }
722
723
  ) }),
723
724
  /* @__PURE__ */ n(ne, { side: "top", className: "text-[12px]", children: t ? `Filtered by ${M.join(", ")} — click to highlight` : `Options filter by ${r.join(", ")} once set` })
@@ -728,7 +729,7 @@ const ir = Lt(function({
728
729
  // Shift+F10 still open the field menu). The slot keeps one box whatever it shows,
729
730
  // so nothing to its left moves.
730
731
  /* @__PURE__ */ n("span", { className: "ml-auto inline-flex shrink-0 items-center gap-1", children: /* @__PURE__ */ n(
731
- rn,
732
+ on,
732
733
  {
733
734
  field: e.field,
734
735
  label: L,
@@ -736,7 +737,7 @@ const ir = Lt(function({
736
737
  confirmOpen: de === "make" || de === "update" ? de : null,
737
738
  onConfirm: (t, r) => (
738
739
  // After a save the button becomes "Your default": focus goes to the field.
739
- Ze(t, me, r)
740
+ et(t, me, r)
740
741
  ),
741
742
  onUndo: () => {
742
743
  C == null || C.undo(e.field), requestAnimationFrame(() => {
@@ -756,8 +757,8 @@ const ir = Lt(function({
756
757
  ]
757
758
  }
758
759
  ),
759
- T.editor && !u && /* @__PURE__ */ n(
760
- Wt,
760
+ T.editor && !m && /* @__PURE__ */ n(
761
+ zt,
761
762
  {
762
763
  editor: T.editor,
763
764
  confirming: T.confirming,
@@ -769,9 +770,9 @@ const ir = Lt(function({
769
770
  "div",
770
771
  {
771
772
  ref: ce,
772
- className: j(u && !H && "cursor-not-allowed"),
773
- "data-tip": (u || e.readonly) && D ? D : void 0,
774
- onPointerEnter: (u || e.readonly) && D ? s == null ? void 0 : s.onLockHover : void 0,
773
+ className: j(m && !H && "cursor-not-allowed"),
774
+ "data-tip": (m || e.readonly) && B ? B : void 0,
775
+ onPointerEnter: (m || e.readonly) && B ? s == null ? void 0 : s.onLockHover : void 0,
775
776
  children: /* @__PURE__ */ n(
776
777
  "div",
777
778
  {
@@ -782,44 +783,44 @@ const ir = Lt(function({
782
783
  // upload/replace/remove when readonly) — blocking pointer events
783
784
  // made attachments unopenable on every locked form (addendum
784
785
  // view, terminal states).
785
- u && !H && "pointer-events-none opacity-60",
786
+ m && !H && "pointer-events-none opacity-60",
786
787
  // The ring lands with a 2px shake so the eye finds the field;
787
788
  // the animation runs once when the class is added.
788
789
  _ && "nvr-shake ring-1 ring-red-400 rounded-md",
789
790
  ae && "nvr-autofill-glow"
790
791
  ),
791
- children: A ? /* @__PURE__ */ n(mn, { field: e, values: m }) : at ? /* @__PURE__ */ n(
792
- Ot,
792
+ children: $ ? /* @__PURE__ */ n(hn, { field: e, values: u }) : ct ? /* @__PURE__ */ n(
793
+ Kt,
793
794
  {
794
795
  collection: a,
795
796
  field: e,
796
- draft: m,
797
+ draft: u,
797
798
  itemId: l
798
799
  }
799
800
  ) : y ? y({
800
801
  field: e,
801
802
  value: he,
802
803
  onChange: Le,
803
- disabled: u,
804
+ disabled: m,
804
805
  collection: a,
805
806
  itemId: l,
806
- relations: x,
807
- cascadeFilter: O,
808
- unsatisfiedParentLabel: ut,
809
- requiredParentLabel: je
807
+ relations: f,
808
+ cascadeFilter: D,
809
+ unsatisfiedParentLabel: pt,
810
+ requiredParentLabel: Be
810
811
  }) : /* @__PURE__ */ n(
811
- Gt,
812
+ Yt,
812
813
  {
813
- field: u && H ? mt() : e,
814
+ field: m && H ? ht() : e,
814
815
  value: he,
815
816
  onChange: Le,
816
- relations: x,
817
+ relations: f,
817
818
  collection: a,
818
819
  itemId: l,
819
- cascadeFilter: O,
820
- requiredParentLabel: je,
821
- narrowedBy: M.length > 0 ? pt() : void 0,
822
- onCountChange: o ? Ge : void 0
820
+ cascadeFilter: D,
821
+ requiredParentLabel: Be,
822
+ narrowedBy: M.length > 0 ? xt() : void 0,
823
+ onCountChange: o ? Ye : void 0
823
824
  }
824
825
  )
825
826
  },
@@ -827,10 +828,19 @@ const ir = Lt(function({
827
828
  )
828
829
  }
829
830
  ),
830
- Ee && /* @__PURE__ */ n(pn, { value: m[e.field], config: Ee }),
831
- Ae && !et && /* @__PURE__ */ n(ln, { field: e.field, text: Ae }),
831
+ Ee && /* @__PURE__ */ n(xn, { value: u[e.field], config: Ee }),
832
+ !_ && Pe && // A soft (warning-only) rule the value breaks: said here, never blocks the save.
833
+ /* @__PURE__ */ n(
834
+ "p",
835
+ {
836
+ "data-field-warning": e.field,
837
+ className: "text-[11.5px] leading-snug text-amber-700 dark:text-amber-400",
838
+ children: Pe
839
+ }
840
+ ),
841
+ Ae && !nt && /* @__PURE__ */ n(an, { field: e.field, text: Ae }),
832
842
  qe && /* @__PURE__ */ n(
833
- Vt,
843
+ Gt,
834
844
  {
835
845
  change: qe,
836
846
  onDismiss: () => s == null ? void 0 : s.dismissRemoteChange(e.field),
@@ -846,7 +856,7 @@ const ir = Lt(function({
846
856
  );
847
857
  });
848
858
  export {
849
- ir as FieldRow,
850
- or as lineageSummary,
851
- Nn as useFieldLineage
859
+ dr as FieldRow,
860
+ cr as lineageSummary,
861
+ Ln as useFieldLineage
852
862
  };