@nivaro/react 0.3.52 → 0.3.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 (41) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +47 -3
  4. package/dist/shared/components/ItemEditForm.js +4196 -4163
  5. package/dist/shared/components/NotificationBell.js +163 -150
  6. package/dist/shared/components/PageRenderer.js +645 -593
  7. package/dist/shared/components/ProfileView.js +36 -34
  8. package/dist/shared/components/QueryStatStrip.js +96 -89
  9. package/dist/shared/components/QueryTable.js +214 -215
  10. package/dist/shared/components/ReportView.js +548 -529
  11. package/dist/shared/components/alerts/AlertManagerView.js +346 -320
  12. package/dist/shared/components/item-edit/CatalogPickerField.js +1300 -1219
  13. package/dist/shared/components/item-edit/DraftRecoveryBanner.js +52 -54
  14. package/dist/shared/components/item-edit/FieldAffordances.js +145 -136
  15. package/dist/shared/components/item-edit/FieldRenderer.js +366 -326
  16. package/dist/shared/components/item-edit/InlineTableField.js +3047 -2932
  17. package/dist/shared/components/item-edit/NestedRelationEditor.js +149 -143
  18. package/dist/shared/components/item-edit/PersonalDefaultControl.js +12 -11
  19. package/dist/shared/components/item-edit/PlanGrid.js +718 -705
  20. package/dist/shared/components/item-edit/RelationCombobox.js +23 -20
  21. package/dist/shared/components/item-edit/SummaryPanel.js +415 -361
  22. package/dist/shared/components/item-edit/line-qty.js +115 -53
  23. package/dist/shared/components/item-edit/save-outcome.js +48 -0
  24. package/dist/shared/components/item-edit/save-refusal.js +18 -18
  25. package/dist/shared/components/item-edit/stale-banner.js +13 -0
  26. package/dist/shared/components/item-edit/usePersonalDefaults.js +225 -220
  27. package/dist/shared/components/panels/CommentPanel.js +204 -197
  28. package/dist/shared/components/panels/ItemLockBanner.js +318 -291
  29. package/dist/shared/components/panels/PipelinePanel.js +1388 -1218
  30. package/dist/shared/components/panels/RecordIntegrityBanner.js +201 -172
  31. package/dist/shared/components/panels/RevisionsPanel.js +101 -106
  32. package/dist/shared/components/panels/TransitionRequirementsDialog.js +564 -534
  33. package/dist/shared/components/panels/requirement-side-effects.js +46 -29
  34. package/dist/shared/components/queue/QueueItemSheet.js +219 -146
  35. package/dist/shared/components/queue/QueueWorklist.js +738 -730
  36. package/dist/shared/components/widgets/ReviewListWidget.js +236 -201
  37. package/dist/shared/lib/activity-sentence.js +236 -227
  38. package/dist/shared/lib/draft-store.js +35 -29
  39. package/dist/shared/lib/page-widget-access.js +11 -0
  40. package/dist/shared/lib/record-ref.js +43 -34
  41. package/package.json +1 -1
@@ -1,309 +1,335 @@
1
- import { jsxs as a, jsx as t } from "react/jsx-runtime";
2
- import { useQuery as U, useQueryClient as H, useMutation as Q } from "@tanstack/react-query";
3
- import { useState as h, useMemo as V, useEffect as z } from "react";
4
- import { useNivaroClient as I } from "../../context.js";
5
- import { get as G, post as $ } from "../../lib/commands.js";
6
- import { useAfterIdle as X } from "../../lib/defer.js";
7
- import { formatRelative as Y, cn as R } from "../../lib/utils.js";
8
- function Z(d, r, n = !0) {
9
- const i = I(), { data: g } = U({
10
- queryKey: ["record-integrity", d, r],
11
- enabled: n,
12
- queryFn: () => i.request(
13
- G(`/config-conformance/record/${d}/${encodeURIComponent(r)}`)
14
- ).then((o) => o.data).catch(() => ({ enabled: !1, findings: [] })),
1
+ import { jsxs as d, jsx as r } from "react/jsx-runtime";
2
+ import { useQuery as S, useQueryClient as X, useMutation as Q } from "@tanstack/react-query";
3
+ import { useState as b, useMemo as Y, useEffect as Z } from "react";
4
+ import { useNivaroClient as U } from "../../context.js";
5
+ import { get as z, post as q } from "../../lib/commands.js";
6
+ import { useAfterIdle as J } from "../../lib/defer.js";
7
+ import { formatRelative as ee, cn as F, titleCase as te } from "../../lib/utils.js";
8
+ function ne(n, t, a = !0) {
9
+ const u = U(), { data: i } = S({
10
+ queryKey: ["record-integrity", n, t],
11
+ enabled: a,
12
+ queryFn: () => u.request(
13
+ z(`/config-conformance/record/${n}/${encodeURIComponent(t)}`)
14
+ ).then((f) => f.data).catch(() => ({ enabled: !1, findings: [] })),
15
15
  staleTime: 5 * 6e4
16
- }), b = X(2e3), { data: u, isFetching: x } = U({
17
- queryKey: ["record-integrity", d, r, "live"],
18
- enabled: n && b,
19
- queryFn: () => i.request(
20
- $(`/config-conformance/record/${d}/${encodeURIComponent(r)}/check`, {})
21
- ).then((o) => o.data).catch(() => null),
16
+ }), p = J(2e3), { data: g, isFetching: m } = S({
17
+ queryKey: ["record-integrity", n, t, "live"],
18
+ enabled: a && p,
19
+ queryFn: () => u.request(
20
+ q(`/config-conformance/record/${n}/${encodeURIComponent(t)}/check`, {})
21
+ ).then((f) => f.data).catch(() => null),
22
22
  staleTime: 6e4,
23
23
  // Never spin the banner on a background refetch storm — one live check per
24
24
  // mount / invalidation is the contract.
25
25
  refetchOnWindowFocus: !1
26
26
  });
27
- return { data: u ?? g, checking: x };
27
+ return { data: g ?? i, checking: m };
28
28
  }
29
- function oe(d) {
30
- const r = /* @__PURE__ */ new Map();
31
- for (const n of d ?? []) {
32
- const i = r.get(n.field) ?? [];
33
- i.push(n), r.set(n.field, i);
29
+ const re = "nvr:own-record-writes";
30
+ function T(n) {
31
+ var a;
32
+ const t = [];
33
+ for (const u of n.writes ?? []) {
34
+ const i = u;
35
+ i && typeof i.collection == "string" && i.item_id != null && i.item_id !== "" && t.push({ collection: i.collection, id: String(i.item_id) });
34
36
  }
35
- return r;
37
+ return (a = n.pick) != null && a.collection && n.pick.item_id && t.push({ collection: n.pick.collection, id: String(n.pick.item_id) }), t;
36
38
  }
37
- const D = {
39
+ function V(n) {
40
+ n.length === 0 || typeof window > "u" || window.dispatchEvent(
41
+ new CustomEvent(re, { detail: { writes: n } })
42
+ );
43
+ }
44
+ function ae(n, t) {
45
+ var u;
46
+ const a = t == null ? void 0 : t.find((i) => i.field === n);
47
+ return ((u = a == null ? void 0 : a.label) == null ? void 0 : u.trim()) || te(n);
48
+ }
49
+ function xe(n) {
50
+ const t = /* @__PURE__ */ new Map();
51
+ for (const a of n ?? []) {
52
+ const u = t.get(a.field) ?? [];
53
+ u.push(a), t.set(a.field, u);
54
+ }
55
+ return t;
56
+ }
57
+ const H = {
38
58
  high: { dot: "bg-emerald-500", text: "Confident" },
39
59
  medium: { dot: "bg-amber-500", text: "Likely" },
40
60
  low: { dot: "bg-slate-400", text: "Manual" }
41
61
  };
42
- function se({
43
- collection: d,
44
- itemId: r,
45
- onJumpToField: n
62
+ function pe({
63
+ collection: n,
64
+ itemId: t,
65
+ onJumpToField: a
46
66
  }) {
47
- I();
48
- const i = H(), [g, b] = h(!1), [u, x] = h(null), { data: o, checking: C } = Z(d, r), q = () => {
49
- i.invalidateQueries({ queryKey: ["record-integrity", d, r] }), i.invalidateQueries({ queryKey: ["item", d, r] }), i.invalidateQueries({ queryKey: [d, r] }), i.invalidateQueries({ queryKey: ["o2m-rows"] }), i.invalidateQueries({ queryKey: ["revisions"] });
67
+ var _;
68
+ const u = U(), i = X(), [p, g] = b(!1), [m, f] = b(null), { data: s, checking: E } = ne(n, t), { data: y } = S({
69
+ queryKey: ["field-config", n, null],
70
+ queryFn: () => u.request(z(`/field-config/${n}`)).then((l) => l.data ?? []),
71
+ enabled: !!((_ = s == null ? void 0 : s.findings) != null && _.length),
72
+ staleTime: 6e4
73
+ }), K = () => {
74
+ i.invalidateQueries({ queryKey: ["record-integrity", n, t] }), i.invalidateQueries({ queryKey: ["item", n, t] }), i.invalidateQueries({ queryKey: [n, t] }), i.invalidateQueries({ queryKey: ["o2m-rows"] }), i.invalidateQueries({ queryKey: ["revisions"] });
50
75
  };
51
- if (!(o != null && o.enabled) || o.findings.length === 0) return null;
52
- const k = o.findings.length;
53
- return /* @__PURE__ */ a(
76
+ if (!(s != null && s.enabled) || s.findings.length === 0) return null;
77
+ const v = s.findings.length;
78
+ return /* @__PURE__ */ d(
54
79
  "div",
55
80
  {
56
81
  "data-record-integrity": !0,
57
82
  className: "nvr-expand-in rounded-lg border border-amber-200 bg-amber-50 px-4 py-2.5 dark:border-amber-500/30 dark:bg-amber-400/10",
58
83
  children: [
59
- /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
60
- /* @__PURE__ */ a("span", { className: "text-[12.5px] font-medium text-amber-800 dark:text-amber-300", children: [
61
- k,
84
+ /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
85
+ /* @__PURE__ */ d("span", { className: "text-[12.5px] font-medium text-amber-800 dark:text-amber-300", children: [
86
+ v,
62
87
  " data integrity issue",
63
- k === 1 ? "" : "s",
88
+ v === 1 ? "" : "s",
64
89
  " on this record"
65
90
  ] }),
66
- o.live ? /* @__PURE__ */ t(
91
+ s.live ? /* @__PURE__ */ r(
67
92
  "span",
68
93
  {
69
94
  className: "text-[11px] text-amber-600/80 dark:text-amber-400/70",
70
95
  "data-integrity-checked": "live",
71
96
  children: "checked just now"
72
97
  }
73
- ) : C ? /* @__PURE__ */ t(
98
+ ) : E ? /* @__PURE__ */ r(
74
99
  "span",
75
100
  {
76
101
  className: "text-[11px] text-amber-600/80 dark:text-amber-400/70",
77
102
  "data-integrity-checked": "checking",
78
103
  children: "checking…"
79
104
  }
80
- ) : o.checked_at ? /* @__PURE__ */ a(
105
+ ) : s.checked_at ? /* @__PURE__ */ d(
81
106
  "span",
82
107
  {
83
108
  className: "text-[11px] text-amber-600/80 dark:text-amber-400/70",
84
109
  "data-integrity-checked": "stored",
85
- title: new Date(o.checked_at).toLocaleString(),
110
+ title: new Date(s.checked_at).toLocaleString(),
86
111
  children: [
87
112
  "checked ",
88
- Y(o.checked_at)
113
+ ee(s.checked_at)
89
114
  ]
90
115
  }
91
116
  ) : null,
92
- /* @__PURE__ */ t(
117
+ /* @__PURE__ */ r(
93
118
  "button",
94
119
  {
95
120
  type: "button",
96
- onClick: () => b((c) => !c),
121
+ onClick: () => g((l) => !l),
97
122
  className: "ml-auto text-[11.5px] font-medium text-amber-700 underline decoration-dotted underline-offset-2 dark:text-amber-300",
98
- children: g ? "Hide" : "View"
123
+ children: p ? "Hide" : "View"
99
124
  }
100
125
  )
101
126
  ] }),
102
- g && /* @__PURE__ */ t("div", { className: "mt-1.5 space-y-1", children: o.findings.map((c, p) => /* @__PURE__ */ a("div", { children: [
103
- /* @__PURE__ */ a("div", { className: "flex items-baseline gap-2 text-[12px]", children: [
104
- /* @__PURE__ */ t(
127
+ p && /* @__PURE__ */ r("div", { className: "mt-1.5 space-y-1", children: s.findings.map((l, k) => /* @__PURE__ */ d("div", { children: [
128
+ /* @__PURE__ */ d("div", { className: "flex items-baseline gap-2 text-[12px]", children: [
129
+ /* @__PURE__ */ r(
105
130
  "button",
106
131
  {
107
132
  type: "button",
108
- onClick: () => n == null ? void 0 : n(c.field),
109
- className: "shrink-0 font-mono text-[11px] text-amber-700 underline decoration-dotted underline-offset-2 dark:text-amber-300",
110
- children: c.field
133
+ onClick: () => a == null ? void 0 : a(l.field),
134
+ "data-integrity-field": l.field,
135
+ className: "shrink-0 text-[11.5px] font-medium text-amber-700 underline decoration-dotted underline-offset-2 dark:text-amber-300",
136
+ children: ae(l.field, y)
111
137
  }
112
138
  ),
113
- /* @__PURE__ */ t("span", { className: "min-w-0 flex-1 text-amber-800 dark:text-amber-200/90", children: c.message }),
114
- c.fixable && /* @__PURE__ */ t(
139
+ /* @__PURE__ */ r("span", { className: "min-w-0 flex-1 text-amber-800 dark:text-amber-200/90", children: l.message }),
140
+ l.fixable && /* @__PURE__ */ r(
115
141
  "button",
116
142
  {
117
143
  type: "button",
118
- onClick: () => x((K) => K === p ? null : p),
119
- className: R(
144
+ onClick: () => f((h) => h === k ? null : k),
145
+ className: F(
120
146
  "shrink-0 rounded px-2 py-0.5 text-[10.5px] font-semibold transition-colors",
121
- u === p ? "bg-amber-200 text-amber-900 dark:bg-amber-400/30 dark:text-amber-100" : "bg-amber-600 text-white hover:bg-amber-700"
147
+ m === k ? "bg-amber-200 text-amber-900 dark:bg-amber-400/30 dark:text-amber-100" : "bg-amber-600 text-white hover:bg-amber-700"
122
148
  ),
123
- children: u === p ? "Close" : "Fix…"
149
+ children: m === k ? "Close" : "Fix…"
124
150
  }
125
151
  )
126
152
  ] }),
127
- u === p && /* @__PURE__ */ t(
128
- T,
153
+ m === k && /* @__PURE__ */ r(
154
+ ie,
129
155
  {
130
- collection: d,
131
- itemId: r,
132
- finding: c,
133
- onApplied: q,
134
- onClose: () => x(null)
156
+ collection: n,
157
+ itemId: t,
158
+ finding: l,
159
+ onApplied: K,
160
+ onClose: () => f(null)
135
161
  }
136
162
  )
137
- ] }, `${c.field}|${c.rule}|${p}`)) })
163
+ ] }, `${l.field}|${l.rule}|${k}`)) })
138
164
  ]
139
165
  }
140
166
  );
141
167
  }
142
- function T({
143
- collection: d,
144
- itemId: r,
145
- finding: n,
146
- onApplied: i,
147
- onClose: g
168
+ function ie({
169
+ collection: n,
170
+ itemId: t,
171
+ finding: a,
172
+ onApplied: u,
173
+ onClose: i
148
174
  }) {
149
- const b = I(), u = `/config-conformance/record/${d}/${encodeURIComponent(r)}`, x = { field: n.field, rule: n.rule, message: n.message }, { data: o, isLoading: C, error: q } = U({
150
- queryKey: ["integrity-proposals", d, r, n.field, n.rule],
151
- queryFn: () => b.request($(`${u}/proposals`, x)).then((e) => e.data.proposals),
175
+ const p = U(), g = `/config-conformance/record/${n}/${encodeURIComponent(t)}`, m = { field: a.field, rule: a.rule, message: a.message }, { data: f, isLoading: s, error: E } = S({
176
+ queryKey: ["integrity-proposals", n, t, a.field, a.rule],
177
+ queryFn: () => p.request(q(`${g}/proposals`, m)).then((e) => e.data.proposals),
152
178
  staleTime: 6e4
153
- }), [k, c] = h([]), [p, K] = h({}), [P, W] = h(""), [f, _] = h(null), [M, O] = h(0), [j, y] = h(null), B = V(() => [...o ?? [], ...k], [o, k]);
154
- z(() => {
155
- if (!f || f.undo.length === 0) return;
156
- O(30);
157
- const e = setInterval(() => O((l) => l <= 1 ? 0 : l - 1), 1e3);
179
+ }), [y, K] = b([]), [v, _] = b({}), [l, k] = b(""), [h, I] = b(null), [W, M] = b(0), [j, N] = b(null), [D, G] = b(null), B = Y(() => [...f ?? [], ...y], [f, y]);
180
+ Z(() => {
181
+ if (!h || h.undo.length === 0) return;
182
+ M(30);
183
+ const e = setInterval(() => M((c) => c <= 1 ? 0 : c - 1), 1e3);
158
184
  return () => clearInterval(e);
159
- }, [f]);
160
- const A = Q({
161
- mutationFn: (e) => b.request(
162
- $(`${u}/fix`, {
163
- ...x,
185
+ }, [h]);
186
+ const R = Q({
187
+ mutationFn: (e) => p.request(
188
+ q(`${g}/fix`, {
189
+ ...m,
164
190
  proposal_id: e.id,
165
- choice: e.kind === "pick" ? p[e.id] : void 0
191
+ choice: e.kind === "pick" ? v[e.id] : void 0
166
192
  })
167
193
  ),
168
- onSuccess: (e, l) => {
169
- var N, w, s;
170
- y(null);
171
- const m = e.data, v = ((N = m.failed) == null ? void 0 : N.length) ?? 0;
172
- _({
173
- text: l.kind === "notify" ? `Sent to ${((w = l.notify) == null ? void 0 : w.name) ?? "the owner"} as a task.` : `${m.applied} write${m.applied === 1 ? "" : "s"} applied${v ? ` — ${v} failed: ${((s = m.failed[0]) == null ? void 0 : s.error) ?? ""}` : ""}.`,
174
- undo: m.undo ?? []
175
- }), i();
194
+ onSuccess: (e, c) => {
195
+ var C, $, o;
196
+ N(null), V(T(c)), G(c);
197
+ const x = e.data, w = ((C = x.failed) == null ? void 0 : C.length) ?? 0;
198
+ I({
199
+ text: c.kind === "notify" ? `Sent to ${(($ = c.notify) == null ? void 0 : $.name) ?? "the owner"} as a task.` : `${x.applied} write${x.applied === 1 ? "" : "s"} applied${w ? ` — ${w} failed: ${((o = x.failed[0]) == null ? void 0 : o.error) ?? ""}` : ""}.`,
200
+ undo: x.undo ?? []
201
+ }), u();
176
202
  },
177
- onError: (e) => y(F(e))
178
- }), S = Q({
179
- mutationFn: (e) => b.request($(`${u}/fix`, { ...x, undo: e })),
203
+ onError: (e) => N(A(e))
204
+ }), L = Q({
205
+ mutationFn: (e) => p.request(q(`${g}/fix`, { ...m, undo: e })),
180
206
  onSuccess: () => {
181
- _({ text: "Undone.", undo: [] }), i();
207
+ D && V(T(D)), I({ text: "Undone.", undo: [] }), u();
182
208
  },
183
- onError: (e) => y(F(e))
184
- }), E = Q({
185
- mutationFn: () => b.request($(`${u}/proposals/ai`, x)).then((e) => e.data.proposal),
209
+ onError: (e) => N(A(e))
210
+ }), O = Q({
211
+ mutationFn: () => p.request(q(`${g}/proposals/ai`, m)).then((e) => e.data.proposal),
186
212
  onSuccess: (e) => {
187
- y(null), c((l) => l.some((m) => m.id === e.id) ? l : [...l, e]);
213
+ N(null), K((c) => c.some((x) => x.id === e.id) ? c : [...c, e]);
188
214
  },
189
- onError: (e) => y(F(e))
215
+ onError: (e) => N(A(e))
190
216
  });
191
- return /* @__PURE__ */ a(
217
+ return /* @__PURE__ */ d(
192
218
  "div",
193
219
  {
194
220
  "data-integrity-proposals": !0,
195
221
  className: "mt-1.5 rounded-md border border-amber-200/80 bg-white/70 px-3 py-2 dark:border-amber-500/20 dark:bg-black/20",
196
222
  children: [
197
- C && /* @__PURE__ */ t("p", { className: "text-[11.5px] text-slate-500 dark:text-muted-foreground", children: "Working out what would fix this…" }),
198
- q && /* @__PURE__ */ t("p", { className: "text-[11.5px] text-red-600 dark:text-red-400", children: F(q) }),
199
- f ? /* @__PURE__ */ a("div", { className: "flex flex-wrap items-center gap-2 text-[11.5px]", children: [
200
- /* @__PURE__ */ t("span", { className: "font-medium text-emerald-700 dark:text-emerald-400", children: f.text }),
201
- f.undo.length > 0 && M > 0 && /* @__PURE__ */ t(
223
+ s && /* @__PURE__ */ r("p", { className: "text-[11.5px] text-slate-500 dark:text-muted-foreground", children: "Working out what would fix this…" }),
224
+ E && /* @__PURE__ */ r("p", { className: "text-[11.5px] text-red-600 dark:text-red-400", children: A(E) }),
225
+ h ? /* @__PURE__ */ d("div", { className: "flex flex-wrap items-center gap-2 text-[11.5px]", children: [
226
+ /* @__PURE__ */ r("span", { className: "font-medium text-emerald-700 dark:text-emerald-400", children: h.text }),
227
+ h.undo.length > 0 && W > 0 && /* @__PURE__ */ r(
202
228
  "button",
203
229
  {
204
230
  type: "button",
205
- disabled: S.isPending,
206
- onClick: () => S.mutate(f.undo),
231
+ disabled: L.isPending,
232
+ onClick: () => L.mutate(h.undo),
207
233
  className: "rounded border border-slate-300 px-2 py-0.5 text-[11px] font-medium text-slate-700 hover:bg-slate-50 disabled:opacity-50 dark:border-border dark:text-foreground dark:hover:bg-muted",
208
- children: S.isPending ? "Undoing…" : `Undo (${M}s)`
234
+ children: L.isPending ? "Undoing…" : `Undo (${W}s)`
209
235
  }
210
236
  ),
211
- /* @__PURE__ */ t(
237
+ /* @__PURE__ */ r(
212
238
  "button",
213
239
  {
214
240
  type: "button",
215
- onClick: g,
241
+ onClick: i,
216
242
  className: "ml-auto text-[11px] text-slate-500 hover:text-slate-700 dark:text-muted-foreground",
217
243
  children: "Done"
218
244
  }
219
245
  )
220
- ] }) : !C && /* @__PURE__ */ a("div", { className: "space-y-1.5", children: [
221
- B.length === 0 && /* @__PURE__ */ t("p", { className: "text-[11.5px] text-slate-500 dark:text-muted-foreground", children: "Nothing on this record can derive a value — fix it by hand on the form." }),
246
+ ] }) : !s && /* @__PURE__ */ d("div", { className: "space-y-1.5", children: [
247
+ B.length === 0 && /* @__PURE__ */ r("p", { className: "text-[11.5px] text-slate-500 dark:text-muted-foreground", children: "Nothing on this record can derive a value — fix it by hand on the form." }),
222
248
  B.map((e) => {
223
- var N, w;
224
- const l = D[e.confidence] ?? D.low, m = p[e.id], v = (e.choices ?? []).filter(
225
- (s) => !P || s.label.toLowerCase().includes(P.toLowerCase())
249
+ var C, $;
250
+ const c = H[e.confidence] ?? H.low, x = v[e.id], w = (e.choices ?? []).filter(
251
+ (o) => !l || o.label.toLowerCase().includes(l.toLowerCase())
226
252
  );
227
- return /* @__PURE__ */ t(
253
+ return /* @__PURE__ */ r(
228
254
  "div",
229
255
  {
230
256
  className: "rounded border border-slate-200/80 bg-white px-2.5 py-1.5 dark:border-border dark:bg-card",
231
- children: /* @__PURE__ */ a("div", { className: "flex items-start gap-2", children: [
232
- /* @__PURE__ */ t(
257
+ children: /* @__PURE__ */ d("div", { className: "flex items-start gap-2", children: [
258
+ /* @__PURE__ */ r(
233
259
  "span",
234
260
  {
235
- className: R("mt-1.5 h-2 w-2 shrink-0 rounded-full", l.dot),
236
- title: l.text,
237
- "data-tip": l.text
261
+ className: F("mt-1.5 h-2 w-2 shrink-0 rounded-full", c.dot),
262
+ title: c.text,
263
+ "data-tip": c.text
238
264
  }
239
265
  ),
240
- /* @__PURE__ */ a("div", { className: "min-w-0 flex-1", children: [
241
- /* @__PURE__ */ a("p", { className: "text-[12px] font-medium text-slate-800 dark:text-foreground", children: [
266
+ /* @__PURE__ */ d("div", { className: "min-w-0 flex-1", children: [
267
+ /* @__PURE__ */ d("p", { className: "text-[12px] font-medium text-slate-800 dark:text-foreground", children: [
242
268
  e.label,
243
- /* @__PURE__ */ t("span", { className: "ml-1.5 text-[10px] font-normal uppercase tracking-wide text-slate-400", children: e.kind === "ai" ? "AI" : l.text })
269
+ /* @__PURE__ */ r("span", { className: "ml-1.5 text-[10px] font-normal uppercase tracking-wide text-slate-400", children: e.kind === "ai" ? "AI" : c.text })
244
270
  ] }),
245
- /* @__PURE__ */ t("p", { className: "text-[11px] leading-snug text-slate-500 dark:text-muted-foreground", children: e.basis }),
246
- e.preview.length > 0 && /* @__PURE__ */ a("div", { className: "mt-1 flex flex-wrap gap-1", children: [
247
- e.preview.slice(0, 8).map((s, L) => /* @__PURE__ */ a(
271
+ /* @__PURE__ */ r("p", { className: "text-[11px] leading-snug text-slate-500 dark:text-muted-foreground", children: e.basis }),
272
+ e.preview.length > 0 && /* @__PURE__ */ d("div", { className: "mt-1 flex flex-wrap gap-1", children: [
273
+ e.preview.slice(0, 8).map((o, P) => /* @__PURE__ */ d(
248
274
  "span",
249
275
  {
250
276
  className: "rounded bg-slate-100 px-1.5 py-0.5 text-[10.5px] text-slate-700 dark:bg-muted dark:text-foreground",
251
277
  children: [
252
- s.label,
278
+ o.label,
253
279
  ": ",
254
- /* @__PURE__ */ t("span", { className: "line-through opacity-60", children: s.from }),
280
+ /* @__PURE__ */ r("span", { className: "line-through opacity-60", children: o.from }),
255
281
  " ",
256
282
  "→ ",
257
- /* @__PURE__ */ t("span", { className: "font-medium", children: s.to })
283
+ /* @__PURE__ */ r("span", { className: "font-medium", children: o.to })
258
284
  ]
259
285
  },
260
- `${s.item_id}|${s.field}|${L}`
286
+ `${o.item_id}|${o.field}|${P}`
261
287
  )),
262
- e.preview.length > 8 && /* @__PURE__ */ a("span", { className: "text-[10.5px] text-slate-400", children: [
288
+ e.preview.length > 8 && /* @__PURE__ */ d("span", { className: "text-[10.5px] text-slate-400", children: [
263
289
  "+",
264
290
  e.preview.length - 8,
265
291
  " more"
266
292
  ] })
267
293
  ] }),
268
- e.kind === "pick" && /* @__PURE__ */ a("div", { className: "mt-1.5", children: [
269
- (((N = e.choices) == null ? void 0 : N.length) ?? 0) > 8 && /* @__PURE__ */ t(
294
+ e.kind === "pick" && /* @__PURE__ */ d("div", { className: "mt-1.5", children: [
295
+ (((C = e.choices) == null ? void 0 : C.length) ?? 0) > 8 && /* @__PURE__ */ r(
270
296
  "input",
271
297
  {
272
- value: P,
273
- onChange: (s) => W(s.target.value),
298
+ value: l,
299
+ onChange: (o) => k(o.target.value),
274
300
  placeholder: "Filter options…",
275
301
  className: "mb-1 h-6 w-full rounded border border-slate-200 bg-white px-2 text-[11px] dark:border-border dark:bg-background"
276
302
  }
277
303
  ),
278
- /* @__PURE__ */ a("div", { className: "flex max-h-36 flex-wrap gap-1 overflow-y-auto", children: [
279
- v.map((s) => /* @__PURE__ */ t(
304
+ /* @__PURE__ */ d("div", { className: "flex max-h-36 flex-wrap gap-1 overflow-y-auto", children: [
305
+ w.map((o) => /* @__PURE__ */ r(
280
306
  "button",
281
307
  {
282
308
  type: "button",
283
- onClick: () => K((L) => ({ ...L, [e.id]: s.id })),
284
- className: R(
309
+ onClick: () => _((P) => ({ ...P, [e.id]: o.id })),
310
+ className: F(
285
311
  "rounded border px-1.5 py-0.5 text-[11px] transition-colors",
286
- m === s.id ? "border-nvr-cyan bg-nvr-cyan/10 text-slate-900 dark:text-foreground" : "border-slate-200 text-slate-700 hover:bg-muted dark:border-border dark:text-foreground"
312
+ x === o.id ? "border-nvr-cyan bg-nvr-cyan/10 text-slate-900 dark:text-foreground" : "border-slate-200 text-slate-700 hover:bg-muted dark:border-border dark:text-foreground"
287
313
  ),
288
- children: s.label
314
+ children: o.label
289
315
  },
290
- s.id
316
+ o.id
291
317
  )),
292
- v.length === 0 && /* @__PURE__ */ t("span", { className: "text-[11px] text-slate-400", children: "No options match." })
318
+ w.length === 0 && /* @__PURE__ */ r("span", { className: "text-[11px] text-slate-400", children: "No options match." })
293
319
  ] })
294
320
  ] })
295
321
  ] }),
296
- /* @__PURE__ */ t(
322
+ /* @__PURE__ */ r(
297
323
  "button",
298
324
  {
299
325
  type: "button",
300
- disabled: A.isPending || e.kind === "pick" && !m,
301
- onClick: () => A.mutate(e),
302
- className: R(
326
+ disabled: R.isPending || e.kind === "pick" && !x,
327
+ onClick: () => R.mutate(e),
328
+ className: F(
303
329
  "shrink-0 rounded px-2 py-0.5 text-[10.5px] font-semibold text-white transition-colors disabled:opacity-50",
304
330
  e.kind === "notify" ? "bg-slate-600 hover:bg-slate-700" : "bg-nvr-cyan hover:bg-nvr-cyan-dark"
305
331
  ),
306
- children: A.isPending && ((w = A.variables) == null ? void 0 : w.id) === e.id ? "Applying…" : e.kind === "notify" ? "Send" : "Apply"
332
+ children: R.isPending && (($ = R.variables) == null ? void 0 : $.id) === e.id ? "Applying…" : e.kind === "notify" ? "Send" : "Apply"
307
333
  }
308
334
  )
309
335
  ] })
@@ -311,40 +337,43 @@ function T({
311
337
  e.id
312
338
  );
313
339
  }),
314
- /* @__PURE__ */ a("div", { className: "flex items-center gap-2 pt-0.5", children: [
315
- !k.some((e) => e.kind === "ai") && /* @__PURE__ */ t(
340
+ /* @__PURE__ */ d("div", { className: "flex items-center gap-2 pt-0.5", children: [
341
+ !y.some((e) => e.kind === "ai") && /* @__PURE__ */ r(
316
342
  "button",
317
343
  {
318
344
  type: "button",
319
- disabled: E.isPending,
320
- onClick: () => E.mutate(),
345
+ disabled: O.isPending,
346
+ onClick: () => O.mutate(),
321
347
  className: "text-[11px] font-medium text-slate-600 underline decoration-dotted underline-offset-2 hover:text-slate-900 disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground",
322
- children: E.isPending ? "Asking AI…" : "Ask AI for a suggestion"
348
+ children: O.isPending ? "Asking AI…" : "Ask AI for a suggestion"
323
349
  }
324
350
  ),
325
- /* @__PURE__ */ t(
351
+ /* @__PURE__ */ r(
326
352
  "button",
327
353
  {
328
354
  type: "button",
329
- onClick: g,
355
+ onClick: i,
330
356
  className: "ml-auto text-[11px] text-slate-500 hover:text-slate-700 dark:text-muted-foreground",
331
357
  children: "Cancel"
332
358
  }
333
359
  )
334
360
  ] }),
335
- j && /* @__PURE__ */ t("p", { className: "text-[11px] text-red-600 dark:text-red-400", children: j })
361
+ j && /* @__PURE__ */ r("p", { className: "text-[11px] text-red-600 dark:text-red-400", children: j })
336
362
  ] })
337
363
  ]
338
364
  }
339
365
  );
340
366
  }
341
- function F(d) {
342
- var n;
343
- const r = d;
344
- return String(((n = r == null ? void 0 : r.response) == null ? void 0 : n.error) ?? (r == null ? void 0 : r.message) ?? "Request failed");
367
+ function A(n) {
368
+ var a;
369
+ const t = n;
370
+ return String(((a = t == null ? void 0 : t.response) == null ? void 0 : a.error) ?? (t == null ? void 0 : t.message) ?? "Request failed");
345
371
  }
346
372
  export {
347
- se as RecordIntegrityBanner,
348
- oe as integrityByField,
349
- Z as useRecordIntegrity
373
+ re as OWN_RECORD_WRITES_EVENT,
374
+ pe as RecordIntegrityBanner,
375
+ ae as findingFieldLabel,
376
+ xe as integrityByField,
377
+ T as ownWritesOf,
378
+ ne as useRecordIntegrity
350
379
  };