@nivaro/react 0.3.66 → 0.3.67

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 (27) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +8 -1
  4. package/dist/shared/components/ActivityEntry.js +28 -28
  5. package/dist/shared/components/CollectionBrowserView.js +584 -585
  6. package/dist/shared/components/ItemEditForm.js +1758 -1758
  7. package/dist/shared/components/RecordCompare.js +149 -129
  8. package/dist/shared/components/bulk/BulkCompareButton.js +16 -16
  9. package/dist/shared/components/integrations/IntegrationObligationsView.js +199 -187
  10. package/dist/shared/components/integrations/console/EventsView.js +22 -24
  11. package/dist/shared/components/integrations/console/SubmissionRow.js +6 -13
  12. package/dist/shared/components/integrations/console/drill/SubmissionDrill.js +29 -28
  13. package/dist/shared/components/integrations/console/tone.js +22 -21
  14. package/dist/shared/components/item-edit/FieldRow.js +193 -193
  15. package/dist/shared/components/item-edit/GroupSection.js +209 -209
  16. package/dist/shared/components/item-edit/RecordInsights.js +46 -45
  17. package/dist/shared/components/panels/BranchLanes.js +7 -7
  18. package/dist/shared/components/panels/CommentPanel.js +72 -72
  19. package/dist/shared/components/panels/PipelinePanel.js +261 -261
  20. package/dist/shared/components/panels/RecordIntegrityBanner.js +78 -78
  21. package/dist/shared/components/panels/RevisionsPanel.js +220 -220
  22. package/dist/shared/components/panels/TaskPanel.js +75 -75
  23. package/dist/shared/components/queue/QueueWorklist.js +499 -498
  24. package/dist/shared/lib/compare-value.js +73 -0
  25. package/dist/shared/lib/format-value.js +19 -18
  26. package/dist/shared/lib/utils.js +59 -57
  27. package/package.json +1 -1
@@ -1,26 +1,26 @@
1
- import { jsxs as l, jsx as t, Fragment as L } from "react/jsx-runtime";
2
- import { useQuery as P, useQueryClient as ee, useMutation as Q } from "@tanstack/react-query";
3
- import { Clock as Y, Search as Ce, X as _e, CalendarClock as Te, GitCompareArrows as Re, ChevronDown as je, ChevronRight as Ae, MessageSquare as Le, RotateCcw as oe, ArrowRight as $e } from "lucide-react";
4
- import { useState as w, useRef as Oe, useMemo as R, createContext as De, useEffect as qe, useContext as ce } from "react";
1
+ import { jsxs as l, jsx as t, Fragment as $ } from "react/jsx-runtime";
2
+ import { useQuery as P, useQueryClient as te, useMutation as Y } from "@tanstack/react-query";
3
+ import { Clock as G, Search as _e, X as Te, CalendarClock as Re, GitCompareArrows as je, ChevronDown as Ae, ChevronRight as $e, MessageSquare as Oe, RotateCcw as ce, ArrowRight as Le } from "lucide-react";
4
+ import { useState as w, useRef as qe, useMemo as R, createContext as Fe, useEffect as De, useContext as me } from "react";
5
5
  import { toast as A } from "sonner";
6
- import { useNivaroClient as F } from "../../context.js";
7
- import { o2mSentence as Fe, activityPredicate as Ee, activityWhy as Be, actorName as Pe } from "../../lib/activity-sentence.js";
8
- import { get as q, post as K } from "../../lib/commands.js";
9
- import { useLiveRecordQueries as Ie } from "../../lib/live.js";
10
- import { restoreSkippedNote as se } from "../../lib/restore-skipped.js";
11
- import { cn as T, titleCase as me, toLocalDateString as Ke } from "../../lib/utils.js";
12
- import { useActivityLabels as Me } from "../ActivityEntry.js";
13
- import { AgentBadge as Ue } from "../AgentBadge.js";
14
- import { RelatedItemLabel as We } from "../item-edit/RelationCombobox.js";
15
- import { UserAvatar as pe } from "../UserAvatar.js";
16
- import { Button as M } from "../ui/button.js";
17
- import { Sheet as Ve, SheetTrigger as ze, SheetContent as He, SheetHeader as Je, SheetTitle as Qe } from "../ui/sheet.js";
18
- import { Skeleton as Ye } from "../ui/skeleton.js";
19
- import { IntegrationActivitySection as Ge } from "./IntegrationActivitySection.js";
20
- const G = (e) => e.id != null && (e.action === "create" || e.action === "update" || e.action === "delete" || e.action === "restore"), Xe = (e) => !G(e), O = (e) => {
6
+ import { useNivaroClient as D } from "../../context.js";
7
+ import { o2mSentence as Ee, activityPredicate as Be, activityWhy as Pe, actorName as Ie } from "../../lib/activity-sentence.js";
8
+ import { get as F, post as M } from "../../lib/commands.js";
9
+ import { useLiveRecordQueries as Ke } from "../../lib/live.js";
10
+ import { restoreSkippedNote as ne } from "../../lib/restore-skipped.js";
11
+ import { formatDateTime as I, cn as T, titleCase as pe, toLocalDateString as Me } from "../../lib/utils.js";
12
+ import { useActivityLabels as Ue } from "../ActivityEntry.js";
13
+ import { AgentBadge as We } from "../AgentBadge.js";
14
+ import { RelatedItemLabel as Ve } from "../item-edit/RelationCombobox.js";
15
+ import { UserAvatar as ue } from "../UserAvatar.js";
16
+ import { Button as U } from "../ui/button.js";
17
+ import { Sheet as ze, SheetTrigger as He, SheetContent as Je, SheetHeader as Qe, SheetTitle as Ye } from "../ui/sheet.js";
18
+ import { Skeleton as Ge } from "../ui/skeleton.js";
19
+ import { IntegrationActivitySection as Xe } from "./IntegrationActivitySection.js";
20
+ const X = (e) => e.id != null && (e.action === "create" || e.action === "update" || e.action === "delete" || e.action === "restore"), Ze = (e) => !X(e), L = (e) => {
21
21
  var s;
22
22
  return e.id != null ? `r${e.id}` : `e${((s = e.event) == null ? void 0 : s.history_id) ?? ""}-${e.activity ?? ""}-${e.timestamp ?? ""}`;
23
- }, Ze = /* @__PURE__ */ new Set([
23
+ }, et = /* @__PURE__ */ new Set([
24
24
  "id",
25
25
  "created",
26
26
  "changed",
@@ -32,16 +32,16 @@ const G = (e) => e.id != null && (e.action === "create" || e.action === "update"
32
32
  "updated_at",
33
33
  "sort"
34
34
  ]);
35
- function ue(e, s) {
36
- const d = F(), { data: a } = P({
35
+ function he(e, s) {
36
+ const d = D(), { data: a } = P({
37
37
  queryKey: ["revisions-field-meta", e],
38
38
  enabled: s,
39
39
  staleTime: 3e5,
40
40
  queryFn: async () => {
41
41
  const [i, o] = await Promise.all([
42
- d.request(q(`/field-config/${e}`)).then((n) => n.data ?? []).catch(() => []),
42
+ d.request(F(`/field-config/${e}`)).then((n) => n.data ?? []).catch(() => []),
43
43
  d.request(
44
- q(`/collections/${e}`)
44
+ F(`/collections/${e}`)
45
45
  ).then((n) => {
46
46
  var r;
47
47
  return ((r = n.data) == null ? void 0 : r.relations) ?? [];
@@ -59,11 +59,11 @@ function ue(e, s) {
59
59
  };
60
60
  for (const n of (a == null ? void 0 : a.fields) ?? [])
61
61
  n.field.startsWith("__") || i.set(n.field, {
62
- label: n.label || me(n.field.replace(/_/g, " ")),
62
+ label: n.label || pe(n.field.replace(/_/g, " ")),
63
63
  // Hidden fields are machine columns (e.g. the retired "workflow_state
64
64
  // (legacy)" a save still writes) — folded with the system fields, not
65
65
  // listed among what a person changed (army8 b01).
66
- system: Ze.has(n.field) || n.hidden === !0,
66
+ system: et.has(n.field) || n.hidden === !0,
67
67
  // layout_assigned is only stamped when the collection HAS an active
68
68
  // layout — absent means there's no layout to be off of.
69
69
  onLayout: n.layout_assigned !== !1,
@@ -76,12 +76,12 @@ function ue(e, s) {
76
76
  function k(e, s) {
77
77
  return e.get(s) ?? {
78
78
  // Unknown to the form = machine column. Still labeled, still reachable.
79
- label: me(s.replace(/[_-]/g, " ")),
79
+ label: pe(s.replace(/[_-]/g, " ")),
80
80
  system: !0,
81
81
  onLayout: !1
82
82
  };
83
83
  }
84
- function et({ map: e, field: s }) {
84
+ function tt({ map: e, field: s }) {
85
85
  const d = k(e, s);
86
86
  return /* @__PURE__ */ t(
87
87
  "span",
@@ -93,30 +93,30 @@ function et({ map: e, field: s }) {
93
93
  }
94
94
  );
95
95
  }
96
- const ne = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/, tt = /^\d{4}-\d{2}-\d{2}(?:T00:00:00(?:\.0+)?Z)?$/;
97
- function at(e, s = !1) {
96
+ const le = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/, at = /^\d{4}-\d{2}-\d{2}(?:T00:00:00(?:\.0+)?Z)?$/;
97
+ function rt(e, s = !1) {
98
98
  if (e == null || e === "") return "";
99
99
  if (typeof e == "boolean") return e ? "Yes" : "No";
100
- if (typeof e == "string" && (tt.test(e) || s && ne.test(e)))
101
- return Ke(e);
102
- if (typeof e == "string" && ne.test(e)) {
100
+ if (typeof e == "string" && (at.test(e) || s && le.test(e)))
101
+ return Me(e);
102
+ if (typeof e == "string" && le.test(e)) {
103
103
  const d = new Date(e);
104
104
  if (!Number.isNaN(d.getTime())) return d.toLocaleString();
105
105
  }
106
106
  return typeof e == "object" ? JSON.stringify(e) : String(e);
107
107
  }
108
- function U(e) {
108
+ function W(e) {
109
109
  return e == null ? "" : typeof e == "object" ? JSON.stringify(e) : String(e);
110
110
  }
111
- function rt({ collection: e, id: s }) {
112
- const d = F(), { data: a } = P({
111
+ function st({ collection: e, id: s }) {
112
+ const d = D(), { data: a } = P({
113
113
  queryKey: ["col-meta", e],
114
- queryFn: () => d.request(q(`/collections/${e}`)).then((i) => i.data),
114
+ queryFn: () => d.request(F(`/collections/${e}`)).then((i) => i.data),
115
115
  staleTime: 3e5,
116
116
  retry: !1
117
117
  });
118
118
  return /* @__PURE__ */ t("span", { title: `${e} #${String(s)}`, children: /* @__PURE__ */ t(
119
- We,
119
+ Ve,
120
120
  {
121
121
  collection: e,
122
122
  id: s,
@@ -124,19 +124,19 @@ function rt({ collection: e, id: s }) {
124
124
  }
125
125
  ) });
126
126
  }
127
- function st(e) {
128
- return Z(e).join(" ");
127
+ function nt(e) {
128
+ return ee(e).join(" ");
129
129
  }
130
- const le = 160;
131
- function de({
130
+ const de = 160;
131
+ function ie({
132
132
  value: e,
133
133
  tone: s,
134
134
  dateOnly: d
135
135
  }) {
136
- const [a, i] = w(!1), o = at(e, d);
136
+ const [a, i] = w(!1), o = rt(e, d);
137
137
  if (o === "")
138
138
  return /* @__PURE__ */ t("span", { className: "text-[11.5px] italic text-slate-300 dark:text-slate-600", children: "empty" });
139
- const n = o.length > le, r = a || !n ? o : `${o.slice(0, le)}…`;
139
+ const n = o.length > de, r = a || !n ? o : `${o.slice(0, de)}…`;
140
140
  return /* @__PURE__ */ l("span", { className: "break-words text-[12px] leading-relaxed text-slate-700 dark:text-slate-300", children: [
141
141
  typeof e == "object" ? /* @__PURE__ */ t("span", { className: "font-mono text-[11px]", children: r }) : r,
142
142
  n && /* @__PURE__ */ t(
@@ -153,7 +153,7 @@ function de({
153
153
  )
154
154
  ] });
155
155
  }
156
- function I(e) {
156
+ function K(e) {
157
157
  if (e && typeof e == "object" && !Array.isArray(e)) return e;
158
158
  if (typeof e == "string" && e.trim().startsWith("{"))
159
159
  try {
@@ -164,7 +164,7 @@ function I(e) {
164
164
  }
165
165
  return null;
166
166
  }
167
- function nt({
167
+ function lt({
168
168
  before: e,
169
169
  after: s
170
170
  }) {
@@ -184,7 +184,7 @@ function nt({
184
184
  r !== void 0 ? /* @__PURE__ */ t("span", { className: "text-emerald-700 dark:text-emerald-400", children: i(r) }) : /* @__PURE__ */ t("span", { className: "italic text-slate-400", children: " (removed)" })
185
185
  ] }, o)) });
186
186
  }
187
- function lt({ field: e, ctl: s }) {
187
+ function dt({ field: e, ctl: s }) {
188
188
  return s.confirmField === e ? /* @__PURE__ */ l("span", { className: "inline-flex items-center gap-1", "data-revert-field-confirm": e, children: [
189
189
  /* @__PURE__ */ t("span", { className: "text-[10.5px] text-slate-500", children: "Revert?" }),
190
190
  /* @__PURE__ */ t(
@@ -215,20 +215,20 @@ function lt({ field: e, ctl: s }) {
215
215
  title: "Set the field back to this revision’s value",
216
216
  "data-revert-field": e,
217
217
  children: [
218
- /* @__PURE__ */ t(oe, { className: "h-3 w-3" }),
218
+ /* @__PURE__ */ t(ce, { className: "h-3 w-3" }),
219
219
  "Revert"
220
220
  ]
221
221
  }
222
222
  );
223
223
  }
224
- function X(e) {
224
+ function Z(e) {
225
225
  return typeof e == "string" && /<[a-z][^>]*>/i.test(e);
226
226
  }
227
- function Z(e) {
227
+ function ee(e) {
228
228
  return String(e ?? "").replace(/<[^>]*>/g, " ").replace(/&nbsp;/g, " ").replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").split(/\s+/).filter(Boolean);
229
229
  }
230
- function dt(e, s) {
231
- const a = Z(e).slice(0, 600), i = Z(s).slice(0, 600), o = a.length, n = i.length, r = Array.from({ length: o + 1 }, () => new Array(n + 1).fill(0));
230
+ function it(e, s) {
231
+ const a = ee(e).slice(0, 600), i = ee(s).slice(0, 600), o = a.length, n = i.length, r = Array.from({ length: o + 1 }, () => new Array(n + 1).fill(0));
232
232
  for (let g = o - 1; g >= 0; g--)
233
233
  for (let c = n - 1; c >= 0; c--)
234
234
  r[g][c] = a[g] === i[c] ? r[g + 1][c + 1] + 1 : Math.max(r[g + 1][c], r[g][c + 1]);
@@ -243,8 +243,8 @@ function dt(e, s) {
243
243
  for (; u < n; ) x("ins", i[u++]);
244
244
  return m;
245
245
  }
246
- function it({ before: e, after: s }) {
247
- const d = dt(e, s);
246
+ function ot({ before: e, after: s }) {
247
+ const d = it(e, s);
248
248
  return /* @__PURE__ */ t("p", { className: "whitespace-pre-wrap break-words text-[12px] leading-relaxed text-slate-700 dark:text-slate-300", children: d.map(
249
249
  (a, i) => a.type === "same" ? (
250
250
  // biome-ignore lint/suspicious/noArrayIndexKey: static segment list
@@ -281,16 +281,16 @@ function it({ before: e, after: s }) {
281
281
  )
282
282
  ) });
283
283
  }
284
- const ot = {
284
+ const ct = {
285
285
  added: "bg-emerald-100 text-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-400",
286
286
  removed: "bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-400",
287
287
  changed: "bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-400"
288
288
  };
289
- function ct(e, s, d) {
289
+ function mt(e, s, d) {
290
290
  const a = Array.from(/* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(s)])), i = (r) => r == null || r === "", o = a.map((r) => {
291
291
  const m = !(r in e) || i(e[r]), x = !(r in s) || i(s[r]);
292
292
  if (m && x) return null;
293
- const p = m ? "added" : x ? "removed" : U(e[r]) !== U(s[r]) ? "changed" : "unchanged";
293
+ const p = m ? "added" : x ? "removed" : W(e[r]) !== W(s[r]) ? "changed" : "unchanged";
294
294
  return {
295
295
  field: r,
296
296
  status: p,
@@ -306,14 +306,14 @@ function ct(e, s, d) {
306
306
  (r, m) => n(r) - n(m) || k(d, r.field).label.localeCompare(k(d, m.field).label)
307
307
  );
308
308
  }
309
- function D({
309
+ function q({
310
310
  value: e,
311
311
  meta: s,
312
312
  tone: d
313
313
  }) {
314
- return e == null || e === "" ? /* @__PURE__ */ t("span", { className: "text-[11.5px] italic text-slate-300 dark:text-slate-600", children: "empty" }) : s.relatedCollection && (typeof e == "string" || typeof e == "number") ? /* @__PURE__ */ t("span", { className: "break-words text-[12px] leading-relaxed text-slate-700 dark:text-slate-300", children: /* @__PURE__ */ t(rt, { collection: s.relatedCollection, id: e }) }) : X(e) ? /* @__PURE__ */ t(de, { value: st(e), tone: d }) : /* @__PURE__ */ t(de, { value: e, tone: d, dateOnly: s.dateOnly });
314
+ return e == null || e === "" ? /* @__PURE__ */ t("span", { className: "text-[11.5px] italic text-slate-300 dark:text-slate-600", children: "empty" }) : s.relatedCollection && (typeof e == "string" || typeof e == "number") ? /* @__PURE__ */ t("span", { className: "break-words text-[12px] leading-relaxed text-slate-700 dark:text-slate-300", children: /* @__PURE__ */ t(st, { collection: s.relatedCollection, id: e }) }) : Z(e) ? /* @__PURE__ */ t(ie, { value: nt(e), tone: d }) : /* @__PURE__ */ t(ie, { value: e, tone: d, dateOnly: s.dateOnly });
315
315
  }
316
- function mt({
316
+ function pt({
317
317
  row: e,
318
318
  meta: s,
319
319
  fieldRevert: d,
@@ -321,7 +321,7 @@ function mt({
321
321
  hideStatusChips: i,
322
322
  between: o
323
323
  }) {
324
- const n = e.status === "changed" && (X(e.before) || X(e.after)), r = e.status === "changed" && I(e.before) && I(e.after);
324
+ const n = e.status === "changed" && (Z(e.before) || Z(e.after)), r = e.status === "changed" && K(e.before) && K(e.after);
325
325
  return /* @__PURE__ */ l(
326
326
  "div",
327
327
  {
@@ -332,37 +332,37 @@ function mt({
332
332
  "data-field-row": e.field,
333
333
  children: [
334
334
  /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
335
- /* @__PURE__ */ t(et, { map: s, field: e.field }),
335
+ /* @__PURE__ */ t(tt, { map: s, field: e.field }),
336
336
  e.status !== "unchanged" && !i && /* @__PURE__ */ t(
337
337
  "span",
338
338
  {
339
339
  className: T(
340
340
  "rounded px-1 py-px text-[9px] font-semibold uppercase tracking-wide",
341
- ot[e.status]
341
+ ct[e.status]
342
342
  ),
343
343
  children: e.status === "added" ? "set" : e.status
344
344
  }
345
345
  ),
346
346
  (e.status === "changed" || a === "changes" && e.status === "added") && d && e.field !== "id" && // A value worked out between saves (a rollup, a forecast status) is
347
347
  // not something to put back by hand (army11 f1 design review).
348
- !o && /* @__PURE__ */ t("span", { className: "ml-auto shrink-0", children: /* @__PURE__ */ t(lt, { field: e.field, ctl: d }) })
348
+ !o && /* @__PURE__ */ t("span", { className: "ml-auto shrink-0", children: /* @__PURE__ */ t(dt, { field: e.field, ctl: d }) })
349
349
  ] }),
350
- /* @__PURE__ */ t("div", { className: "mt-1", children: n ? /* @__PURE__ */ t("div", { "data-richtext-diff": !0, children: /* @__PURE__ */ t(it, { before: e.before, after: e.after }) }) : r ? /* @__PURE__ */ t(
351
- nt,
350
+ /* @__PURE__ */ t("div", { className: "mt-1", children: n ? /* @__PURE__ */ t("div", { "data-richtext-diff": !0, children: /* @__PURE__ */ t(ot, { before: e.before, after: e.after }) }) : r ? /* @__PURE__ */ t(
351
+ lt,
352
352
  {
353
- before: I(e.before),
354
- after: I(e.after)
353
+ before: K(e.before),
354
+ after: K(e.after)
355
355
  }
356
356
  ) : e.status === "changed" || e.status === "removed" ? /* @__PURE__ */ l("div", { className: "flex flex-wrap items-baseline gap-x-2 gap-y-0.5", children: [
357
- /* @__PURE__ */ t("span", { className: "max-w-full break-words text-[12px] text-rose-600 line-through decoration-rose-300 dark:text-rose-400", children: /* @__PURE__ */ t(D, { value: e.before, meta: k(s, e.field), tone: "before" }) }),
358
- /* @__PURE__ */ t($e, { className: "h-3 w-3 shrink-0 self-center text-slate-300 dark:text-slate-600" }),
359
- /* @__PURE__ */ t(D, { value: e.after, meta: k(s, e.field), tone: "after" })
360
- ] }) : /* @__PURE__ */ t(D, { value: e.after ?? e.before, meta: k(s, e.field), tone: "after" }) })
357
+ /* @__PURE__ */ t("span", { className: "max-w-full break-words text-[12px] text-rose-600 line-through decoration-rose-300 dark:text-rose-400", children: /* @__PURE__ */ t(q, { value: e.before, meta: k(s, e.field), tone: "before" }) }),
358
+ /* @__PURE__ */ t(Le, { className: "h-3 w-3 shrink-0 self-center text-slate-300 dark:text-slate-600" }),
359
+ /* @__PURE__ */ t(q, { value: e.after, meta: k(s, e.field), tone: "after" })
360
+ ] }) : /* @__PURE__ */ t(q, { value: e.after ?? e.before, meta: k(s, e.field), tone: "after" }) })
361
361
  ]
362
362
  }
363
363
  );
364
364
  }
365
- function pt({
365
+ function ut({
366
366
  before: e,
367
367
  after: s,
368
368
  meta: d,
@@ -371,17 +371,17 @@ function pt({
371
371
  hideStatusChips: o,
372
372
  ownFields: n
373
373
  }) {
374
- const [r, m] = w(!1), x = R(() => ct(e, s, d), [e, s, d]), p = i === "changes" ? x.filter((h) => h.status !== "unchanged") : x, u = r ? p : p.filter((h) => !h.system), g = (h) => !!n && i === "changes" && !h.system && !n.has(h.field), c = u.filter(g), y = [...u.filter((h) => !g(h)), ...c], j = c.length ? y.length - c.length : -1, f = p.length - y.length;
374
+ const [r, m] = w(!1), x = R(() => mt(e, s, d), [e, s, d]), p = i === "changes" ? x.filter((h) => h.status !== "unchanged") : x, u = r ? p : p.filter((h) => !h.system), g = (h) => !!n && i === "changes" && !h.system && !n.has(h.field), c = u.filter(g), y = [...u.filter((h) => !g(h)), ...c], j = c.length ? y.length - c.length : -1, f = p.length - y.length;
375
375
  if (p.length === 0)
376
376
  return /* @__PURE__ */ t("p", { className: "px-3 py-3 text-[12px] text-slate-400", children: i === "changes" ? "No field changes recorded." : "No snapshot data available." });
377
377
  const N = y.findIndex(
378
378
  (h) => !g(h) && !k(d, h.field).onLayout && !k(d, h.field).system
379
- ), S = y.some(
379
+ ), C = y.some(
380
380
  (h) => !g(h) && k(d, h.field).onLayout && !k(d, h.field).system
381
381
  );
382
382
  return /* @__PURE__ */ l("div", { className: "overflow-hidden rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: [
383
- y.map((h, C) => /* @__PURE__ */ l("div", { children: [
384
- C === j && /* @__PURE__ */ l(
383
+ y.map((h, S) => /* @__PURE__ */ l("div", { children: [
384
+ S === j && /* @__PURE__ */ l(
385
385
  "div",
386
386
  {
387
387
  "data-recalculated-between": !0,
@@ -392,12 +392,12 @@ function pt({
392
392
  ]
393
393
  }
394
394
  ),
395
- C === N && S && /* @__PURE__ */ l("div", { className: "border-b border-t border-slate-100 bg-slate-50/70 px-3 py-1.5 dark:border-border/60 dark:bg-muted/30", children: [
395
+ S === N && C && /* @__PURE__ */ l("div", { className: "border-b border-t border-slate-100 bg-slate-50/70 px-3 py-1.5 dark:border-border/60 dark:bg-muted/30", children: [
396
396
  /* @__PURE__ */ t("p", { className: "text-[10.5px] font-semibold uppercase tracking-wide text-slate-400", children: "Behind the scenes" }),
397
397
  /* @__PURE__ */ t("p", { className: "text-[10.5px] text-slate-400", children: "Not on the form — written automatically by rules, computed fields or integrations." })
398
398
  ] }),
399
399
  /* @__PURE__ */ t(
400
- mt,
400
+ pt,
401
401
  {
402
402
  row: h,
403
403
  meta: d,
@@ -435,24 +435,24 @@ function pt({
435
435
  )
436
436
  ] });
437
437
  }
438
- const ut = {
438
+ const ht = {
439
439
  create: "bg-emerald-500",
440
440
  restore: "bg-emerald-500",
441
441
  update: "bg-nvr-cyan",
442
442
  delete: "bg-red-500"
443
- }, te = De(void 0);
443
+ }, ae = Fe(void 0);
444
444
  function B(e, s) {
445
445
  var d;
446
- return e.actor && e.actor.kind !== "person" ? Pe(e, s) : e.first_name || e.last_name ? [e.first_name, e.last_name].filter(Boolean).join(" ") : e.user_email ?? ((d = e.user_id) == null ? void 0 : d.slice(0, 8)) ?? "System";
446
+ return e.actor && e.actor.kind !== "person" ? Ie(e, s) : e.first_name || e.last_name ? [e.first_name, e.last_name].filter(Boolean).join(" ") : e.user_email ?? ((d = e.user_id) == null ? void 0 : d.slice(0, 8)) ?? "System";
447
447
  }
448
- function ht(e, s, d) {
448
+ function xt(e, s, d) {
449
449
  return e.action === "create" ? "created this record" : e.action === "restore" ? "restored this record from trash" : e.action === "delete" ? "deleted this record" : s > 0 ? `changed ${s} field${s === 1 ? "" : "s"}` : d > 0 ? "updated system fields" : "saved this record";
450
450
  }
451
- function xt({ revision: e, isLast: s }) {
451
+ function ft({ revision: e, isLast: s }) {
452
452
  var x, p, u;
453
- const d = ce(te), a = e.event, i = (a == null ? void 0 : a.source) === "auto" || !e.user_id && (a == null ? void 0 : a.kind) === "transition", o = !i && ((x = a == null ? void 0 : a.on_behalf_of) != null && x.name) ? a.on_behalf_of.name : null, n = i ? "Automatic rule" : o ? `${B(e, d)}, for ${o}` : B(e, d);
453
+ const d = me(ae), a = e.event, i = (a == null ? void 0 : a.source) === "auto" || !e.user_id && (a == null ? void 0 : a.kind) === "transition", o = !i && ((x = a == null ? void 0 : a.on_behalf_of) != null && x.name) ? a.on_behalf_of.name : null, n = i ? "Automatic rule" : o ? `${B(e, d)}, for ${o}` : B(e, d);
454
454
  let r;
455
- (a == null ? void 0 : a.kind) === "transition" && a.addendum ? r = /* @__PURE__ */ l(L, { children: [
455
+ (a == null ? void 0 : a.kind) === "transition" && a.addendum ? r = /* @__PURE__ */ l($, { children: [
456
456
  "moved",
457
457
  " ",
458
458
  /* @__PURE__ */ l("span", { className: "font-medium text-slate-700 dark:text-slate-200", "data-revision-addendum": !0, children: [
@@ -462,7 +462,7 @@ function xt({ revision: e, isLast: s }) {
462
462
  ] }),
463
463
  ":",
464
464
  " ",
465
- a.from_label && /* @__PURE__ */ l(L, { children: [
465
+ a.from_label && /* @__PURE__ */ l($, { children: [
466
466
  /* @__PURE__ */ t("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: a.from_label }),
467
467
  " ",
468
468
  "→",
@@ -473,10 +473,10 @@ function xt({ revision: e, isLast: s }) {
473
473
  " · ",
474
474
  a.transition_label
475
475
  ] })
476
- ] }) : (a == null ? void 0 : a.kind) === "transition" ? r = /* @__PURE__ */ l(L, { children: [
476
+ ] }) : (a == null ? void 0 : a.kind) === "transition" ? r = /* @__PURE__ */ l($, { children: [
477
477
  "moved it",
478
478
  " ",
479
- a.from_label && /* @__PURE__ */ l(L, { children: [
479
+ a.from_label && /* @__PURE__ */ l($, { children: [
480
480
  "from",
481
481
  " ",
482
482
  /* @__PURE__ */ t("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: a.from_label }),
@@ -489,15 +489,15 @@ function xt({ revision: e, isLast: s }) {
489
489
  " · ",
490
490
  a.transition_label
491
491
  ] })
492
- ] }) : (a == null ? void 0 : a.kind) === "start" && a.to_label ? r = /* @__PURE__ */ l(L, { children: [
492
+ ] }) : (a == null ? void 0 : a.kind) === "start" && a.to_label ? r = /* @__PURE__ */ l($, { children: [
493
493
  "started it in",
494
494
  " ",
495
495
  /* @__PURE__ */ t("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: a.to_label })
496
- ] }) : (a == null ? void 0 : a.kind) === "start" ? r = /* @__PURE__ */ l(L, { children: [
496
+ ] }) : (a == null ? void 0 : a.kind) === "start" ? r = /* @__PURE__ */ l($, { children: [
497
497
  "started the pipeline",
498
498
  e.comment ? ` — ${e.comment.replace(/^Started pipeline\s*[—-]?\s*/i, "")}` : ""
499
- ] }) : (p = e.action) != null && p.startsWith("o2m-") ? r = /* @__PURE__ */ t("span", { "data-revision-o2m": !0, children: e.o2m ? Fe(e.o2m) : `${e.action === "o2m-create" ? "added" : e.action === "o2m-delete" ? "removed" : "changed"} related rows` }) : r = /* @__PURE__ */ l(L, { children: [
500
- Ee({ ...e, item: null }, d),
499
+ ] }) : (p = e.action) != null && p.startsWith("o2m-") ? r = /* @__PURE__ */ t("span", { "data-revision-o2m": !0, children: e.o2m ? Ee(e.o2m) : `${e.action === "o2m-create" ? "added" : e.action === "o2m-delete" ? "removed" : "changed"} related rows` }) : r = /* @__PURE__ */ l($, { children: [
500
+ Be({ ...e, item: null }, d),
501
501
  e.comment ? ` — ${e.comment}` : ""
502
502
  ] });
503
503
  const m = e.timestamp ? new Date(e.timestamp).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }) : "—";
@@ -527,7 +527,7 @@ function xt({ revision: e, isLast: s }) {
527
527
  ),
528
528
  /* @__PURE__ */ l("div", { className: "flex w-full items-start gap-2.5 rounded-md px-2 py-2.5 text-left", children: [
529
529
  i ? /* @__PURE__ */ t("span", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-violet-500/10 text-[10px] font-semibold text-violet-700 dark:text-violet-300", children: "⚡" }) : /* @__PURE__ */ t(
530
- pe,
530
+ ue,
531
531
  {
532
532
  userId: e.user_id,
533
533
  className: "h-6 w-6",
@@ -555,7 +555,7 @@ function xt({ revision: e, isLast: s }) {
555
555
  "span",
556
556
  {
557
557
  className: "shrink-0 text-[11px] tabular-nums text-slate-400",
558
- title: e.timestamp ? new Date(e.timestamp).toLocaleString() : void 0,
558
+ title: e.timestamp ? I(e.timestamp) : void 0,
559
559
  children: m
560
560
  }
561
561
  )
@@ -564,7 +564,7 @@ function xt({ revision: e, isLast: s }) {
564
564
  }
565
565
  );
566
566
  }
567
- function ft({
567
+ function bt({
568
568
  revision: e,
569
569
  previousData: s,
570
570
  meta: d,
@@ -572,64 +572,64 @@ function ft({
572
572
  inlineTableFields: i,
573
573
  isLast: o
574
574
  }) {
575
- const n = F(), r = ce(te), m = Be(e).reason, [x, p] = w(!1), [u, g] = w(!1), [c, y] = w("changes"), [j, f] = w(!1), [N, S] = w(null), h = e.action === "update", C = e.action === "create" || e.action === "restore", W = e.action === "delete", v = W ? e.data ?? {} : C ? {} : s ?? {}, $ = W ? {} : e.data ?? {}, { humanDelta: V, systemDelta: he } = R(() => {
575
+ const n = D(), r = me(ae), m = Pe(e).reason, [x, p] = w(!1), [u, g] = w(!1), [c, y] = w("changes"), [j, f] = w(!1), [N, C] = w(null), h = e.action === "update", S = e.action === "create" || e.action === "restore", V = e.action === "delete", v = V ? e.data ?? {} : S ? {} : s ?? {}, O = V ? {} : e.data ?? {}, { humanDelta: z, systemDelta: xe } = R(() => {
576
576
  const b = e.delta ?? {};
577
577
  let _ = 0, E = 0;
578
- for (const J of Object.keys(b)) {
579
- const we = s == null ? void 0 : s[J], Se = (e.data ?? {})[J];
580
- h && s && U(we) === U(Se) || (k(d, J).system ? E++ : _++);
578
+ for (const Q of Object.keys(b)) {
579
+ const Ce = s == null ? void 0 : s[Q], Se = (e.data ?? {})[Q];
580
+ h && s && W(Ce) === W(Se) || (k(d, Q).system ? E++ : _++);
581
581
  }
582
582
  return { humanDelta: _, systemDelta: E };
583
- }, [e, s, d, h]), xe = R(() => new Set(Object.keys(e.delta ?? {})), [e]), fe = h || C, [z, be] = w(null), ge = ee(), [ye, ae] = w(null), re = Q({
584
- mutationFn: (b) => n.request(K(`/revisions/${e.id}/revert-field`, { field: b })),
583
+ }, [e, s, d, h]), fe = R(() => new Set(Object.keys(e.delta ?? {})), [e]), be = h || S, [H, ge] = w(null), ye = te(), [Ne, re] = w(null), se = Y({
584
+ mutationFn: (b) => n.request(M(`/revisions/${e.id}/revert-field`, { field: b })),
585
585
  onSuccess: (b, _) => {
586
- ae(null), A.success(`Reverted ${k(d, _).label} to this revision's value`), ge.invalidateQueries({ queryKey: ["revisions", e.collection, e.item] }), a == null || a();
586
+ re(null), A.success(`Reverted ${k(d, _).label} to this revision's value`), ye.invalidateQueries({ queryKey: ["revisions", e.collection, e.item] }), a == null || a();
587
587
  },
588
588
  onError: () => A.error("Failed to revert field")
589
- }), Ne = h || C ? {
590
- confirmField: ye,
591
- setConfirmField: ae,
592
- revert: (b) => re.mutate(b),
593
- pending: re.isPending
594
- } : void 0, H = Q({
595
- mutationFn: () => n.request(K(`/revisions/${e.id}/rollback`, {})),
589
+ }), ke = h || S ? {
590
+ confirmField: Ne,
591
+ setConfirmField: re,
592
+ revert: (b) => se.mutate(b),
593
+ pending: se.isPending
594
+ } : void 0, J = Y({
595
+ mutationFn: () => n.request(M(`/revisions/${e.id}/rollback`, {})),
596
596
  onSuccess: (b) => {
597
597
  g(!1), A.success("Rolled back to this revision");
598
- const _ = se(b);
599
- _ && A.warning(_, { duration: 1e4 }), i != null && i.length && e.timestamp && be(e.timestamp), a == null || a();
598
+ const _ = ne(b);
599
+ _ && A.warning(_, { duration: 1e4 }), i != null && i.length && e.timestamp && ge(e.timestamp), a == null || a();
600
600
  },
601
601
  onError: () => A.error("Failed to rollback")
602
602
  });
603
- async function ke(b) {
604
- if (z) {
605
- S(b.field);
603
+ async function ve(b) {
604
+ if (H) {
605
+ C(b.field);
606
606
  try {
607
607
  const _ = await n.request(
608
- K("/revisions/o2m-restore", {
608
+ M("/revisions/o2m-restore", {
609
609
  collection: b.relatedCollection,
610
610
  many_field: b.manyField,
611
611
  parent_id: b.parentId,
612
- target_timestamp: z
612
+ target_timestamp: H
613
613
  })
614
614
  );
615
615
  A.success(`Restored ${b.label}`);
616
- const E = se(_);
616
+ const E = ne(_);
617
617
  E && A.warning(E, { duration: 1e4 });
618
618
  } catch {
619
619
  A.error(`Failed to restore ${b.label}`);
620
620
  } finally {
621
- S(null);
621
+ C(null);
622
622
  }
623
623
  }
624
624
  }
625
- const ve = e.timestamp ? new Date(e.timestamp).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }) : "—";
625
+ const we = e.timestamp ? new Date(e.timestamp).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }) : "—";
626
626
  return /* @__PURE__ */ l("div", { className: "relative pl-9", "data-revision-row": e.id, children: [
627
627
  /* @__PURE__ */ t(
628
628
  "span",
629
629
  {
630
630
  className: T(
631
631
  "absolute left-[11px] top-[18px] h-2.5 w-2.5 rounded-full ring-4 ring-white dark:ring-card",
632
- ut[e.action ?? ""] ?? "bg-slate-300"
632
+ ht[e.action ?? ""] ?? "bg-slate-300"
633
633
  ),
634
634
  "aria-hidden": !0
635
635
  }
@@ -649,7 +649,7 @@ function ft({
649
649
  className: "flex w-full items-center gap-2.5 rounded-md px-2 py-2.5 text-left transition-colors hover:bg-slate-50 dark:hover:bg-muted/40",
650
650
  children: [
651
651
  /* @__PURE__ */ t(
652
- pe,
652
+ ue,
653
653
  {
654
654
  userId: e.user_id,
655
655
  className: "h-6 w-6",
@@ -659,7 +659,7 @@ function ft({
659
659
  /* @__PURE__ */ l("span", { className: "min-w-0 flex-1 truncate text-[12.5px] text-slate-700 dark:text-slate-200", children: [
660
660
  /* @__PURE__ */ t("span", { className: "font-medium", children: B(e, r) }),
661
661
  " ",
662
- /* @__PURE__ */ t("span", { className: "text-slate-500 dark:text-slate-400", children: ht(e, V, he) }),
662
+ /* @__PURE__ */ t("span", { className: "text-slate-500 dark:text-slate-400", children: xt(e, z, xe) }),
663
663
  m && /* @__PURE__ */ l(
664
664
  "span",
665
665
  {
@@ -673,16 +673,16 @@ function ft({
673
673
  }
674
674
  )
675
675
  ] }),
676
- /* @__PURE__ */ t(Ue, { label: e.via_agent }),
676
+ /* @__PURE__ */ t(We, { label: e.via_agent }),
677
677
  /* @__PURE__ */ t(
678
678
  "span",
679
679
  {
680
680
  className: "shrink-0 text-[11px] tabular-nums text-slate-400",
681
- title: e.timestamp ? new Date(e.timestamp).toLocaleString() : void 0,
682
- children: ve
681
+ title: e.timestamp ? I(e.timestamp) : void 0,
682
+ children: we
683
683
  }
684
684
  ),
685
- x ? /* @__PURE__ */ t(je, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }) : /* @__PURE__ */ t(Ae, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
685
+ x ? /* @__PURE__ */ t(Ae, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }) : /* @__PURE__ */ t($e, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
686
686
  ]
687
687
  }
688
688
  ),
@@ -715,26 +715,26 @@ function ft({
715
715
  j ? "border-nvr-cyan/40 text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 text-slate-400 hover:text-slate-600 dark:border-border dark:hover:text-slate-300"
716
716
  ),
717
717
  children: [
718
- /* @__PURE__ */ t(Le, { className: "h-3 w-3" }),
718
+ /* @__PURE__ */ t(Oe, { className: "h-3 w-3" }),
719
719
  "Notes"
720
720
  ]
721
721
  }
722
722
  ),
723
- fe && (u ? /* @__PURE__ */ l("span", { className: "inline-flex items-center gap-1.5", children: [
723
+ be && (u ? /* @__PURE__ */ l("span", { className: "inline-flex items-center gap-1.5", children: [
724
724
  /* @__PURE__ */ t("span", { className: "text-[11px] text-slate-500", children: "Restore this version?" }),
725
725
  /* @__PURE__ */ t(
726
- M,
726
+ U,
727
727
  {
728
728
  size: "sm",
729
729
  variant: "destructive",
730
730
  className: "h-6 text-[11px]",
731
- disabled: H.isPending,
732
- onClick: () => H.mutate(),
731
+ disabled: J.isPending,
732
+ onClick: () => J.mutate(),
733
733
  children: "Yes, restore"
734
734
  }
735
735
  ),
736
736
  /* @__PURE__ */ t(
737
- M,
737
+ U,
738
738
  {
739
739
  size: "sm",
740
740
  variant: "outline",
@@ -744,36 +744,36 @@ function ft({
744
744
  }
745
745
  )
746
746
  ] }) : /* @__PURE__ */ l(
747
- M,
747
+ U,
748
748
  {
749
749
  size: "sm",
750
750
  variant: "outline",
751
751
  className: "h-6 gap-1 text-[11px]",
752
- disabled: H.isPending,
752
+ disabled: J.isPending,
753
753
  onClick: () => g(!0),
754
754
  title: "Set the whole record back to how it looked after this save",
755
755
  children: [
756
- /* @__PURE__ */ t(oe, { className: "h-3 w-3" }),
756
+ /* @__PURE__ */ t(ce, { className: "h-3 w-3" }),
757
757
  "Restore this version"
758
758
  ]
759
759
  }
760
760
  ))
761
761
  ] })
762
762
  ] }),
763
- j && /* @__PURE__ */ t(kt, { revisionId: e.id ?? "" }),
763
+ j && /* @__PURE__ */ t(vt, { revisionId: e.id ?? "" }),
764
764
  /* @__PURE__ */ t(
765
- pt,
765
+ ut,
766
766
  {
767
767
  before: v,
768
- after: $,
768
+ after: O,
769
769
  meta: d,
770
- fieldRevert: Ne,
770
+ fieldRevert: ke,
771
771
  mode: c,
772
- hideStatusChips: C,
773
- ownFields: h && e.delta ? xe : null
772
+ hideStatusChips: S,
773
+ ownFields: h && e.delta ? fe : null
774
774
  }
775
775
  ),
776
- z && i && i.length > 0 && /* @__PURE__ */ l("div", { className: "space-y-1.5 rounded-md border border-slate-100 bg-slate-50 p-2 dark:border-border dark:bg-muted/30", children: [
776
+ H && i && i.length > 0 && /* @__PURE__ */ l("div", { className: "space-y-1.5 rounded-md border border-slate-100 bg-slate-50 p-2 dark:border-border dark:bg-muted/30", children: [
777
777
  /* @__PURE__ */ t("p", { className: "text-[10.5px] font-medium text-slate-500", children: "Also restore related rows?" }),
778
778
  i.map((b) => /* @__PURE__ */ l("div", { className: "flex items-center justify-between gap-2", children: [
779
779
  /* @__PURE__ */ t("span", { className: "text-[11.5px] text-slate-600 dark:text-slate-300", children: b.label }),
@@ -782,7 +782,7 @@ function ft({
782
782
  {
783
783
  type: "button",
784
784
  disabled: N === b.field,
785
- onClick: () => ke(b),
785
+ onClick: () => ve(b),
786
786
  className: "rounded border border-nvr-cyan/40 px-2 py-0.5 text-[10.5px] font-medium text-nvr-cyan hover:bg-nvr-cyan/10 disabled:opacity-40",
787
787
  children: N === b.field ? "Restoring…" : "Restore"
788
788
  }
@@ -792,7 +792,7 @@ function ft({
792
792
  ] })
793
793
  ] });
794
794
  }
795
- function bt({ data: e, meta: s }) {
795
+ function gt({ data: e, meta: s }) {
796
796
  const [d, a] = w(null), [i, o] = w(""), [n, r] = w(""), [m, x] = w(""), p = R(() => {
797
797
  if (!i || !e) return null;
798
798
  const c = (/* @__PURE__ */ new Date(`${i}T23:59:59`)).getTime();
@@ -801,16 +801,16 @@ function bt({ data: e, meta: s }) {
801
801
  if (!n || !m || !e) return null;
802
802
  const c = (/* @__PURE__ */ new Date(`${n}T23:59:59`)).getTime(), y = (/* @__PURE__ */ new Date(`${m}T23:59:59`)).getTime();
803
803
  if (y <= c) return { error: "The second date must be after the first" };
804
- const j = (v) => e.find(($) => $.timestamp && new Date($.timestamp).getTime() <= v) ?? null, f = j(c), N = j(y);
804
+ const j = (v) => e.find((O) => O.timestamp && new Date(O.timestamp).getTime() <= v) ?? null, f = j(c), N = j(y);
805
805
  if (!N) return { error: "No snapshot exists at or before the second date" };
806
- const S = (f == null ? void 0 : f.data) ?? {}, h = N.data ?? {}, C = /* @__PURE__ */ new Map();
806
+ const C = (f == null ? void 0 : f.data) ?? {}, h = N.data ?? {}, S = /* @__PURE__ */ new Map();
807
807
  for (const v of [...e].reverse()) {
808
- const $ = v.timestamp ? new Date(v.timestamp).getTime() : 0;
809
- if (!($ <= c || $ > y || !v.delta))
810
- for (const V of Object.keys(v.delta))
811
- C.set(V, { name: B(v), when: v.timestamp });
808
+ const O = v.timestamp ? new Date(v.timestamp).getTime() : 0;
809
+ if (!(O <= c || O > y || !v.delta))
810
+ for (const z of Object.keys(v.delta))
811
+ S.set(z, { name: B(v), when: v.timestamp });
812
812
  }
813
- return { fields: [.../* @__PURE__ */ new Set([...Object.keys(S), ...Object.keys(h)])].filter((v) => String(S[v] ?? "") !== String(h[v] ?? "")).map((v) => ({ field: v, from: S[v], to: h[v], by: C.get(v) ?? null })) };
813
+ return { fields: [.../* @__PURE__ */ new Set([...Object.keys(C), ...Object.keys(h)])].filter((v) => String(C[v] ?? "") !== String(h[v] ?? "")).map((v) => ({ field: v, from: C[v], to: h[v], by: S.get(v) ?? null })) };
814
814
  }, [n, m, e]), g = "h-7 rounded-md border border-slate-200 bg-white px-2 text-[12px] dark:border-border dark:bg-card";
815
815
  return /* @__PURE__ */ l("div", { className: "space-y-2", children: [
816
816
  /* @__PURE__ */ l("div", { className: "flex items-center gap-1.5", children: [
@@ -824,7 +824,7 @@ function bt({ data: e, meta: s }) {
824
824
  d === "asof" || i ? "border-nvr-cyan/40 bg-nvr-cyan/5 font-medium text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 text-slate-500 hover:text-slate-700 dark:border-border dark:text-slate-400 dark:hover:text-slate-200"
825
825
  ),
826
826
  children: [
827
- /* @__PURE__ */ t(Te, { className: "h-3.5 w-3.5" }),
827
+ /* @__PURE__ */ t(Re, { className: "h-3.5 w-3.5" }),
828
828
  "View as of a date"
829
829
  ]
830
830
  }
@@ -839,7 +839,7 @@ function bt({ data: e, meta: s }) {
839
839
  d === "compare" || n && m ? "border-nvr-cyan/40 bg-nvr-cyan/5 font-medium text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 text-slate-500 hover:text-slate-700 dark:border-border dark:text-slate-400 dark:hover:text-slate-200"
840
840
  ),
841
841
  children: [
842
- /* @__PURE__ */ t(Re, { className: "h-3.5 w-3.5" }),
842
+ /* @__PURE__ */ t(je, { className: "h-3.5 w-3.5" }),
843
843
  "Compare two dates"
844
844
  ]
845
845
  }
@@ -874,7 +874,7 @@ function bt({ data: e, meta: s }) {
874
874
  /* @__PURE__ */ t("div", { className: "border-b border-slate-200 bg-[#f0fbff] px-2.5 py-1.5 dark:border-border dark:bg-nvr-cyan/10", children: /* @__PURE__ */ l("span", { className: "text-[11.5px] font-semibold text-slate-700 dark:text-slate-200", children: [
875
875
  "Record as of",
876
876
  " ",
877
- p.timestamp ? new Date(p.timestamp).toLocaleString() : i
877
+ p.timestamp ? I(p.timestamp) : i
878
878
  ] }) }),
879
879
  /* @__PURE__ */ t("div", { className: "max-h-80 overflow-y-auto", children: Object.entries(p.data ?? {}).filter(([, c]) => c != null && c !== "").sort(([c], [y]) => k(s, c).label.localeCompare(k(s, y).label)).map(([c, y]) => /* @__PURE__ */ l(
880
880
  "div",
@@ -889,7 +889,7 @@ function bt({ data: e, meta: s }) {
889
889
  children: k(s, c).label
890
890
  }
891
891
  ),
892
- /* @__PURE__ */ t("span", { className: "break-words text-[11.5px] text-slate-700 dark:text-slate-300", children: /* @__PURE__ */ t(D, { value: y, meta: k(s, c), tone: "after" }) })
892
+ /* @__PURE__ */ t("span", { className: "break-words text-[11.5px] text-slate-700 dark:text-slate-300", children: /* @__PURE__ */ t(q, { value: y, meta: k(s, c), tone: "after" }) })
893
893
  ]
894
894
  },
895
895
  c
@@ -971,8 +971,8 @@ function bt({ data: e, meta: s }) {
971
971
  ] })
972
972
  ] }),
973
973
  /* @__PURE__ */ l("p", { className: "mt-0.5 flex flex-wrap items-baseline gap-x-2 break-words text-[11.5px]", children: [
974
- /* @__PURE__ */ t("span", { className: "text-red-500 line-through dark:text-red-400", children: /* @__PURE__ */ t(D, { value: c.from, meta: k(s, c.field), tone: "before" }) }),
975
- /* @__PURE__ */ t("span", { className: "text-emerald-600 dark:text-emerald-400", children: /* @__PURE__ */ t(D, { value: c.to, meta: k(s, c.field), tone: "after" }) })
974
+ /* @__PURE__ */ t("span", { className: "text-red-500 line-through dark:text-red-400", children: /* @__PURE__ */ t(q, { value: c.from, meta: k(s, c.field), tone: "before" }) }),
975
+ /* @__PURE__ */ t("span", { className: "text-emerald-600 dark:text-emerald-400", children: /* @__PURE__ */ t(q, { value: c.to, meta: k(s, c.field), tone: "after" }) })
976
976
  ] })
977
977
  ]
978
978
  },
@@ -984,7 +984,7 @@ function bt({ data: e, meta: s }) {
984
984
  ] })
985
985
  ] });
986
986
  }
987
- function gt(e) {
987
+ function yt(e) {
988
988
  return e ? new Date(e).toLocaleDateString([], {
989
989
  weekday: "short",
990
990
  month: "short",
@@ -992,77 +992,77 @@ function gt(e) {
992
992
  year: "numeric"
993
993
  }) : "Unknown date";
994
994
  }
995
- function yt({
995
+ function Nt({
996
996
  collection: e,
997
997
  item: s,
998
998
  onRollback: d,
999
999
  inlineTableFields: a
1000
1000
  }) {
1001
- const i = F(), o = ue(e, !0), { data: n, isLoading: r } = P({
1001
+ const i = D(), o = he(e, !0), { data: n, isLoading: r } = P({
1002
1002
  queryKey: ["revisions", e, s],
1003
- queryFn: () => i.request(q("/revisions", { collection: e, item: s })).then((f) => f.data ?? []),
1003
+ queryFn: () => i.request(F("/revisions", { collection: e, item: s })).then((f) => f.data ?? []),
1004
1004
  staleTime: 3e4
1005
- }), m = ee();
1006
- Ie(e, s, [["revisions", e, s]], { client: m });
1007
- const x = Oe(null), p = R(() => {
1005
+ }), m = te();
1006
+ Ke(e, s, [["revisions", e, s]], { client: m });
1007
+ const x = qe(null), p = R(() => {
1008
1008
  if (!n) return /* @__PURE__ */ new Set();
1009
- const f = n.map(O);
1009
+ const f = n.map(L);
1010
1010
  if (!x.current)
1011
1011
  return x.current = new Set(f), /* @__PURE__ */ new Set();
1012
1012
  const N = x.current;
1013
- return new Set(f.filter((S) => !N.has(S)));
1014
- }, [n]), u = (n == null ? void 0 : n.length) ?? 0, g = R(() => (n ?? []).filter(G), [n]), c = R(
1013
+ return new Set(f.filter((C) => !N.has(C)));
1014
+ }, [n]), u = (n == null ? void 0 : n.length) ?? 0, g = R(() => (n ?? []).filter(X), [n]), c = R(
1015
1015
  () => (n ?? []).filter((f) => f.actor && f.actor.kind !== "person").map((f) => ({ action: f.action, user: f.user_id, actor: f.actor })),
1016
1016
  [n]
1017
- ), y = Me(c, { enabled: c.length > 0 }), j = R(() => {
1017
+ ), y = Ue(c, { enabled: c.length > 0 }), j = R(() => {
1018
1018
  const f = [];
1019
1019
  for (const N of n ?? []) {
1020
- const S = gt(N.timestamp), h = f[f.length - 1];
1021
- h && h.day === S ? h.revisions.push(N) : f.push({ day: S, revisions: [N] });
1020
+ const C = yt(N.timestamp), h = f[f.length - 1];
1021
+ h && h.day === C ? h.revisions.push(N) : f.push({ day: C, revisions: [N] });
1022
1022
  }
1023
1023
  return f;
1024
1024
  }, [n]);
1025
- return r ? /* @__PURE__ */ t("div", { className: "space-y-2 pt-3", children: [1, 2, 3, 4].map((f) => /* @__PURE__ */ t(Ye, { className: "h-11 rounded-md" }, f)) }) : u === 0 ? /* @__PURE__ */ l("div", { className: "flex flex-col items-center py-16 text-center", children: [
1026
- /* @__PURE__ */ t(Y, { className: "mb-2 h-8 w-8 text-slate-300 dark:text-slate-600" }),
1025
+ return r ? /* @__PURE__ */ t("div", { className: "space-y-2 pt-3", children: [1, 2, 3, 4].map((f) => /* @__PURE__ */ t(Ge, { className: "h-11 rounded-md" }, f)) }) : u === 0 ? /* @__PURE__ */ l("div", { className: "flex flex-col items-center py-16 text-center", children: [
1026
+ /* @__PURE__ */ t(G, { className: "mb-2 h-8 w-8 text-slate-300 dark:text-slate-600" }),
1027
1027
  /* @__PURE__ */ t("p", { className: "text-[13px] font-medium text-slate-600 dark:text-slate-300", children: "No history yet" }),
1028
1028
  /* @__PURE__ */ t("p", { className: "mt-1 max-w-[38ch] text-[12px] text-slate-400", children: "Every save records who changed what — the trail will appear here." })
1029
- ] }) : /* @__PURE__ */ t(te.Provider, { value: y, children: /* @__PURE__ */ l("div", { className: "space-y-3 pt-3", children: [
1030
- /* @__PURE__ */ t(bt, { data: g, meta: o }),
1031
- g.length >= 3 && /* @__PURE__ */ t(vt, { revisions: g, meta: o }),
1029
+ ] }) : /* @__PURE__ */ t(ae.Provider, { value: y, children: /* @__PURE__ */ l("div", { className: "space-y-3 pt-3", children: [
1030
+ /* @__PURE__ */ t(gt, { data: g, meta: o }),
1031
+ g.length >= 3 && /* @__PURE__ */ t(wt, { revisions: g, meta: o }),
1032
1032
  /* @__PURE__ */ t("div", { children: j.map((f) => /* @__PURE__ */ l("div", { children: [
1033
1033
  /* @__PURE__ */ t("div", { className: "sticky top-0 z-10 -mx-6 border-b border-slate-100 bg-white px-6 py-1.5 dark:border-border/60 dark:bg-card", children: /* @__PURE__ */ t("span", { className: "text-[10.5px] font-semibold uppercase tracking-wide text-slate-400", children: f.day }) }),
1034
1034
  f.revisions.map((N) => {
1035
- const S = (n ?? []).indexOf(N), h = S === ((n == null ? void 0 : n.length) ?? 1) - 1;
1036
- if (Xe(N))
1035
+ const C = (n ?? []).indexOf(N), h = C === ((n == null ? void 0 : n.length) ?? 1) - 1;
1036
+ if (Ze(N))
1037
1037
  return /* @__PURE__ */ l(
1038
1038
  "div",
1039
1039
  {
1040
1040
  className: T(
1041
1041
  "nvr-fade-in relative",
1042
- p.has(O(N)) && "rounded-md bg-nvr-cyan/[0.06]"
1042
+ p.has(L(N)) && "rounded-md bg-nvr-cyan/[0.06]"
1043
1043
  ),
1044
1044
  children: [
1045
- p.has(O(N)) && /* @__PURE__ */ t(ie, {}),
1046
- /* @__PURE__ */ t(xt, { revision: N, isLast: h })
1045
+ p.has(L(N)) && /* @__PURE__ */ t(oe, {}),
1046
+ /* @__PURE__ */ t(ft, { revision: N, isLast: h })
1047
1047
  ]
1048
1048
  },
1049
- O(N)
1049
+ L(N)
1050
1050
  );
1051
- const C = (n ?? []).slice(S + 1).find(G);
1051
+ const S = (n ?? []).slice(C + 1).find(X);
1052
1052
  return /* @__PURE__ */ l(
1053
1053
  "div",
1054
1054
  {
1055
1055
  className: T(
1056
1056
  "nvr-fade-in relative",
1057
- p.has(O(N)) && "rounded-md bg-nvr-cyan/[0.06]"
1057
+ p.has(L(N)) && "rounded-md bg-nvr-cyan/[0.06]"
1058
1058
  ),
1059
1059
  children: [
1060
- p.has(O(N)) && /* @__PURE__ */ t(ie, {}),
1060
+ p.has(L(N)) && /* @__PURE__ */ t(oe, {}),
1061
1061
  /* @__PURE__ */ t(
1062
- ft,
1062
+ bt,
1063
1063
  {
1064
1064
  revision: N,
1065
- previousData: (C == null ? void 0 : C.data) ?? null,
1065
+ previousData: (S == null ? void 0 : S.data) ?? null,
1066
1066
  meta: o,
1067
1067
  onRollback: d,
1068
1068
  inlineTableFields: a,
@@ -1071,13 +1071,13 @@ function yt({
1071
1071
  )
1072
1072
  ]
1073
1073
  },
1074
- O(N)
1074
+ L(N)
1075
1075
  );
1076
1076
  })
1077
1077
  ] }, f.day)) })
1078
1078
  ] }) });
1079
1079
  }
1080
- function ie() {
1080
+ function oe() {
1081
1081
  return (
1082
1082
  // Under the timeline dot, inside the row's 36px gutter.
1083
1083
  /* @__PURE__ */ t(
@@ -1090,7 +1090,7 @@ function ie() {
1090
1090
  )
1091
1091
  );
1092
1092
  }
1093
- function Mt({
1093
+ function Ut({
1094
1094
  collection: e,
1095
1095
  item: s,
1096
1096
  onRollback: d,
@@ -1100,9 +1100,9 @@ function Mt({
1100
1100
  onOpenChange: n,
1101
1101
  compact: r
1102
1102
  }) {
1103
- return /* @__PURE__ */ l(Ve, { open: o, onOpenChange: n, children: [
1104
- !(o !== void 0) && /* @__PURE__ */ t(ze, { asChild: !0, children: /* @__PURE__ */ l(
1105
- M,
1103
+ return /* @__PURE__ */ l(ze, { open: o, onOpenChange: n, children: [
1104
+ !(o !== void 0) && /* @__PURE__ */ t(He, { asChild: !0, children: /* @__PURE__ */ l(
1105
+ U,
1106
1106
  {
1107
1107
  variant: r ? "ghost" : "outline",
1108
1108
  size: "sm",
@@ -1110,23 +1110,23 @@ function Mt({
1110
1110
  "aria-label": "History",
1111
1111
  className: a ?? (r ? "h-8 w-8 rounded-none p-0" : "gap-1.5"),
1112
1112
  children: [
1113
- /* @__PURE__ */ t(Y, { className: r ? "h-4 w-4" : "h-3.5 w-3.5" }),
1113
+ /* @__PURE__ */ t(G, { className: r ? "h-4 w-4" : "h-3.5 w-3.5" }),
1114
1114
  !r && "History"
1115
1115
  ]
1116
1116
  }
1117
1117
  ) }),
1118
- /* @__PURE__ */ t(He, { className: "w-[720px] overflow-y-auto p-0 sm:max-w-[92vw]", children: /* @__PURE__ */ l("div", { className: "p-6", children: [
1119
- /* @__PURE__ */ l(Je, { children: [
1120
- /* @__PURE__ */ l(Qe, { className: "flex items-center gap-2 text-base", children: [
1121
- /* @__PURE__ */ t(Y, { className: "h-4 w-4 text-slate-400" }),
1118
+ /* @__PURE__ */ t(Je, { className: "w-[720px] overflow-y-auto p-0 sm:max-w-[92vw]", children: /* @__PURE__ */ l("div", { className: "p-6", children: [
1119
+ /* @__PURE__ */ l(Qe, { children: [
1120
+ /* @__PURE__ */ l(Ye, { className: "flex items-center gap-2 text-base", children: [
1121
+ /* @__PURE__ */ t(G, { className: "h-4 w-4 text-slate-400" }),
1122
1122
  "Revision history"
1123
1123
  ] }),
1124
1124
  /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-400", children: "Who changed what, when — expand any entry to see the exact values, revert a single field, or restore the whole version." })
1125
1125
  ] }),
1126
- /* @__PURE__ */ t(Nt, { collection: e, item: s }),
1127
- /* @__PURE__ */ t(Ge, { collection: e, item: String(s) }),
1126
+ /* @__PURE__ */ t(kt, { collection: e, item: s }),
1127
+ /* @__PURE__ */ t(Xe, { collection: e, item: String(s) }),
1128
1128
  /* @__PURE__ */ t(
1129
- yt,
1129
+ Nt,
1130
1130
  {
1131
1131
  collection: e,
1132
1132
  item: s,
@@ -1137,15 +1137,15 @@ function Mt({
1137
1137
  ] }) })
1138
1138
  ] });
1139
1139
  }
1140
- function Nt({ collection: e, item: s }) {
1141
- const d = F(), a = ue(e, !0), [i, o] = w(""), [n, r] = w(""), { data: m, isFetching: x } = P({
1140
+ function kt({ collection: e, item: s }) {
1141
+ const d = D(), a = he(e, !0), [i, o] = w(""), [n, r] = w(""), { data: m, isFetching: x } = P({
1142
1142
  queryKey: ["rev-value-search", e, s, n],
1143
- queryFn: () => d.request(q("/revisions/value-search", { collection: e, item: s, q: n })).then((p) => p.data),
1143
+ queryFn: () => d.request(F("/revisions/value-search", { collection: e, item: s, q: n })).then((p) => p.data),
1144
1144
  enabled: n.length >= 2
1145
1145
  });
1146
1146
  return /* @__PURE__ */ l("div", { className: "mt-3", children: [
1147
1147
  /* @__PURE__ */ l("div", { className: "relative", children: [
1148
- /* @__PURE__ */ t(Ce, { className: "pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
1148
+ /* @__PURE__ */ t(_e, { className: "pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
1149
1149
  /* @__PURE__ */ t(
1150
1150
  "input",
1151
1151
  {
@@ -1167,7 +1167,7 @@ function Nt({ collection: e, item: s }) {
1167
1167
  },
1168
1168
  className: "absolute right-2 top-1/2 -translate-y-1/2 text-slate-400 hover:text-slate-600",
1169
1169
  "aria-label": "Clear search",
1170
- children: /* @__PURE__ */ t(_e, { className: "h-3.5 w-3.5" })
1170
+ children: /* @__PURE__ */ t(Te, { className: "h-3.5 w-3.5" })
1171
1171
  }
1172
1172
  )
1173
1173
  ] }),
@@ -1175,7 +1175,7 @@ function Nt({ collection: e, item: s }) {
1175
1175
  "“",
1176
1176
  n,
1177
1177
  "” never appears in this record’s recorded changes."
1178
- ] }) : /* @__PURE__ */ l(L, { children: [
1178
+ ] }) : /* @__PURE__ */ l($, { children: [
1179
1179
  m == null ? void 0 : m.matches.map((p) => /* @__PURE__ */ l("div", { className: "text-[11.5px]", children: [
1180
1180
  /* @__PURE__ */ t("p", { className: "text-slate-600 dark:text-slate-300", children: p.fields.map((u) => /* @__PURE__ */ l("span", { children: [
1181
1181
  /* @__PURE__ */ t("span", { className: "font-medium", title: u.field, children: k(a, u.field).label }),
@@ -1187,10 +1187,10 @@ function Nt({ collection: e, item: s }) {
1187
1187
  ] }, u.field)) }),
1188
1188
  /* @__PURE__ */ l("p", { className: "text-[10.5px] text-slate-400", children: [
1189
1189
  p.user_name ?? "System",
1190
+ " · ",
1191
+ p.timestamp ? I(p.timestamp) : "",
1190
1192
  " ·",
1191
1193
  " ",
1192
- p.timestamp ? new Date(p.timestamp).toLocaleString() : "",
1193
- " · ",
1194
1194
  p.action
1195
1195
  ] })
1196
1196
  ] }, p.revision_id)),
@@ -1198,14 +1198,14 @@ function Nt({ collection: e, item: s }) {
1198
1198
  ] }) })
1199
1199
  ] });
1200
1200
  }
1201
- function kt({ revisionId: e }) {
1202
- const s = F(), d = ee(), [a, i] = w(""), { data: o = [] } = P({
1201
+ function vt({ revisionId: e }) {
1202
+ const s = D(), d = te(), [a, i] = w(""), { data: o = [] } = P({
1203
1203
  queryKey: ["revision-notes", String(e)],
1204
- queryFn: () => s.request(q("/comments", { collection: "nivaro_revisions", item: String(e) })).then((r) => r.data ?? []).catch(() => []),
1204
+ queryFn: () => s.request(F("/comments", { collection: "nivaro_revisions", item: String(e) })).then((r) => r.data ?? []).catch(() => []),
1205
1205
  staleTime: 3e4
1206
- }), n = Q({
1206
+ }), n = Y({
1207
1207
  mutationFn: () => s.request(
1208
- K("/comments", { collection: "nivaro_revisions", item: String(e), text: a })
1208
+ M("/comments", { collection: "nivaro_revisions", item: String(e), text: a })
1209
1209
  ),
1210
1210
  onSuccess: () => {
1211
1211
  i(""), d.invalidateQueries({ queryKey: ["revision-notes", String(e)] });
@@ -1254,12 +1254,12 @@ function kt({ revisionId: e }) {
1254
1254
  )
1255
1255
  ] });
1256
1256
  }
1257
- function vt({
1257
+ function wt({
1258
1258
  revisions: e,
1259
1259
  meta: s
1260
1260
  }) {
1261
1261
  const d = [...e].reverse(), [a, i] = w(!1), [o, n] = w(0);
1262
- qe(() => {
1262
+ De(() => {
1263
1263
  if (!a) return;
1264
1264
  if (o >= d.length - 1) {
1265
1265
  i(!1);
@@ -1304,7 +1304,7 @@ function vt({
1304
1304
  ] }),
1305
1305
  r && /* @__PURE__ */ l("p", { className: "mt-1 text-[11.5px] text-slate-600 dark:text-slate-300", children: [
1306
1306
  /* @__PURE__ */ t("span", { className: "font-medium capitalize", children: r.action ?? "change" }),
1307
- r.timestamp ? ` · ${new Date(r.timestamp).toLocaleString()}` : "",
1307
+ r.timestamp ? ` · ${I(r.timestamp)}` : "",
1308
1308
  r.user_name ? ` · ${r.user_name}` : "",
1309
1309
  m.length > 0 && /* @__PURE__ */ l("span", { className: "ml-1 text-[10.5px] text-slate-400", children: [
1310
1310
  "changed: ",
@@ -1314,7 +1314,7 @@ function vt({
1314
1314
  ] });
1315
1315
  }
1316
1316
  export {
1317
- pt as FieldChangeList,
1318
- Mt as RevisionsPanel,
1319
- at as displayValue
1317
+ ut as FieldChangeList,
1318
+ Ut as RevisionsPanel,
1319
+ rt as displayValue
1320
1320
  };