@nivaro/react 0.3.14 → 0.3.16

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 (34) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +127 -6
  4. package/dist/index.js +736 -734
  5. package/dist/shared/components/CollectionBrowserView.js +2316 -2281
  6. package/dist/shared/components/ItemEditForm.js +3773 -3604
  7. package/dist/shared/components/RecordGridEditor.js +319 -282
  8. package/dist/shared/components/RecordReadView.js +202 -200
  9. package/dist/shared/components/cbv/unknown-fields.js +18 -8
  10. package/dist/shared/components/import/DocumentAutofillButton.js +148 -142
  11. package/dist/shared/components/item-edit/CatalogPickerField.js +264 -276
  12. package/dist/shared/components/item-edit/FieldRenderer.js +136 -133
  13. package/dist/shared/components/item-edit/FieldRow.js +198 -184
  14. package/dist/shared/components/item-edit/HeaderTools.js +107 -99
  15. package/dist/shared/components/item-edit/InlineTableField.js +138 -136
  16. package/dist/shared/components/item-edit/RecordLiveSync.js +1 -0
  17. package/dist/shared/components/item-edit/RelationCombobox.js +30 -23
  18. package/dist/shared/components/item-edit/SummaryPanel.js +334 -294
  19. package/dist/shared/components/item-edit/column-length.js +12 -0
  20. package/dist/shared/components/panels/AccessDeniedPanel.js +47 -37
  21. package/dist/shared/components/panels/ItemLockBanner.js +307 -285
  22. package/dist/shared/components/panels/PipelinePanel.js +486 -465
  23. package/dist/shared/components/panels/RevisionsPanel.js +210 -204
  24. package/dist/shared/components/profile/DelegationCard.js +178 -121
  25. package/dist/shared/components/profile/PersonActivity.js +152 -139
  26. package/dist/shared/components/queue/QueueWorklist.js +668 -659
  27. package/dist/shared/components/queue/transition-note.js +90 -0
  28. package/dist/shared/components/support/SupportRequestDialog.js +100 -89
  29. package/dist/shared/components/support/TicketDetailSheet.js +104 -91
  30. package/dist/shared/lib/autofill-runs.js +33 -26
  31. package/dist/shared/lib/draft-store.js +40 -24
  32. package/dist/shared/lib/live-queries.js +10 -9
  33. package/dist/shared/lib/restore-skipped.js +10 -0
  34. package/package.json +1 -1
@@ -1,22 +1,23 @@
1
- import { jsxs as l, jsx as t, Fragment as _ } from "react/jsx-runtime";
2
- import { useQuery as E, useQueryClient as X, useMutation as H } from "@tanstack/react-query";
3
- import { Clock as J, Search as ge, X as ye, CalendarClock as Ne, GitCompareArrows as ke, ChevronDown as ve, ChevronRight as we, MessageSquare as Se, RotateCcw as le, ArrowRight as Ce } from "lucide-react";
4
- import { useState as k, useRef as _e, useMemo as T, useEffect as Te } from "react";
5
- import { toast as A } from "sonner";
1
+ import { jsxs as l, jsx as t, Fragment as T } from "react/jsx-runtime";
2
+ import { useQuery as B, useQueryClient as Z, useMutation as J } from "@tanstack/react-query";
3
+ import { Clock as Q, Search as ye, X as Ne, CalendarClock as ke, GitCompareArrows as ve, ChevronDown as we, ChevronRight as Se, MessageSquare as Ce, RotateCcw as ie, ArrowRight as _e } from "lucide-react";
4
+ import { useState as k, useRef as Te, useMemo as j, useEffect as Re } from "react";
5
+ import { toast as R } from "sonner";
6
6
  import { useNivaroClient as D } from "../../context.js";
7
- import { get as F, post as I } from "../../lib/commands.js";
8
- import { useLiveRecordQueries as Re } from "../../lib/live.js";
9
- import { cn as C, titleCase as ie } from "../../lib/utils.js";
10
- import { RelatedItemLabel as je } from "../item-edit/RelationCombobox.js";
11
- import { UserAvatar as de } from "../UserAvatar.js";
12
- import { Button as K } from "../ui/button.js";
13
- import { Sheet as Ae, SheetTrigger as $e, SheetContent as qe, SheetHeader as Le, SheetTitle as Fe } from "../ui/sheet.js";
14
- import { Skeleton as De } from "../ui/skeleton.js";
15
- import { IntegrationActivitySection as Oe } from "./IntegrationActivitySection.js";
16
- const Q = (e) => e.id != null && (e.action === "create" || e.action === "update" || e.action === "delete" || e.action === "restore"), Ee = (e) => !Q(e), j = (e) => {
7
+ import { get as F, post as K } from "../../lib/commands.js";
8
+ import { useLiveRecordQueries as je } from "../../lib/live.js";
9
+ import { restoreSkippedNote as re } from "../../lib/restore-skipped.js";
10
+ import { cn as _, titleCase as de } from "../../lib/utils.js";
11
+ import { RelatedItemLabel as Ae } from "../item-edit/RelationCombobox.js";
12
+ import { UserAvatar as oe } from "../UserAvatar.js";
13
+ import { Button as M } from "../ui/button.js";
14
+ import { Sheet as $e, SheetTrigger as qe, SheetContent as Le, SheetHeader as Fe, SheetTitle as De } from "../ui/sheet.js";
15
+ import { Skeleton as Oe } from "../ui/skeleton.js";
16
+ import { IntegrationActivitySection as Ee } from "./IntegrationActivitySection.js";
17
+ const Y = (e) => e.id != null && (e.action === "create" || e.action === "update" || e.action === "delete" || e.action === "restore"), Be = (e) => !Y(e), $ = (e) => {
17
18
  var r;
18
19
  return e.id != null ? `r${e.id}` : `e${((r = e.event) == null ? void 0 : r.history_id) ?? ""}-${e.activity ?? ""}-${e.timestamp ?? ""}`;
19
- }, Be = /* @__PURE__ */ new Set([
20
+ }, Pe = /* @__PURE__ */ new Set([
20
21
  "id",
21
22
  "created",
22
23
  "changed",
@@ -28,8 +29,8 @@ const Q = (e) => e.id != null && (e.action === "create" || e.action === "update"
28
29
  "updated_at",
29
30
  "sort"
30
31
  ]);
31
- function oe(e, r) {
32
- const a = D(), { data: d } = E({
32
+ function ce(e, r) {
33
+ const a = D(), { data: d } = B({
33
34
  queryKey: ["revisions-field-meta", e],
34
35
  enabled: r,
35
36
  staleTime: 3e5,
@@ -46,7 +47,7 @@ function oe(e, r) {
46
47
  return { fields: i, relations: o };
47
48
  }
48
49
  });
49
- return T(() => {
50
+ return j(() => {
50
51
  const i = /* @__PURE__ */ new Map(), o = (n) => {
51
52
  const s = ((d == null ? void 0 : d.relations) ?? []).find(
52
53
  (p) => p.many_collection === e && p.many_field === n && p.junction_field == null
@@ -55,8 +56,8 @@ function oe(e, r) {
55
56
  };
56
57
  for (const n of (d == null ? void 0 : d.fields) ?? [])
57
58
  n.field.startsWith("__") || i.set(n.field, {
58
- label: n.label || ie(n.field.replace(/_/g, " ")),
59
- system: Be.has(n.field),
59
+ label: n.label || de(n.field.replace(/_/g, " ")),
60
+ system: Pe.has(n.field),
60
61
  // layout_assigned is only stamped when the collection HAS an active
61
62
  // layout — absent means there's no layout to be off of.
62
63
  onLayout: n.layout_assigned !== !1,
@@ -68,12 +69,12 @@ function oe(e, r) {
68
69
  function g(e, r) {
69
70
  return e.get(r) ?? {
70
71
  // Unknown to the form = machine column. Still labeled, still reachable.
71
- label: ie(r.replace(/[_-]/g, " ")),
72
+ label: de(r.replace(/[_-]/g, " ")),
72
73
  system: !0,
73
74
  onLayout: !1
74
75
  };
75
76
  }
76
- function Pe({ map: e, field: r }) {
77
+ function Ie({ map: e, field: r }) {
77
78
  const a = g(e, r);
78
79
  return /* @__PURE__ */ t(
79
80
  "span",
@@ -85,28 +86,28 @@ function Pe({ map: e, field: r }) {
85
86
  }
86
87
  );
87
88
  }
88
- const Ie = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/;
89
- function Ke(e) {
89
+ const Ke = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/;
90
+ function Me(e) {
90
91
  if (e == null || e === "") return "";
91
92
  if (typeof e == "boolean") return e ? "Yes" : "No";
92
- if (typeof e == "string" && Ie.test(e)) {
93
+ if (typeof e == "string" && Ke.test(e)) {
93
94
  const r = new Date(e);
94
95
  if (!Number.isNaN(r.getTime())) return r.toLocaleString();
95
96
  }
96
97
  return typeof e == "object" ? JSON.stringify(e) : String(e);
97
98
  }
98
- function M(e) {
99
+ function U(e) {
99
100
  return e == null ? "" : typeof e == "object" ? JSON.stringify(e) : String(e);
100
101
  }
101
- function Me({ collection: e, id: r }) {
102
- const a = D(), { data: d } = E({
102
+ function Ue({ collection: e, id: r }) {
103
+ const a = D(), { data: d } = B({
103
104
  queryKey: ["col-meta", e],
104
105
  queryFn: () => a.request(F(`/collections/${e}`)).then((i) => i.data),
105
106
  staleTime: 3e5,
106
107
  retry: !1
107
108
  });
108
109
  return /* @__PURE__ */ t("span", { title: `${e} #${String(r)}`, children: /* @__PURE__ */ t(
109
- je,
110
+ Ae,
110
111
  {
111
112
  collection: e,
112
113
  id: r,
@@ -114,15 +115,15 @@ function Me({ collection: e, id: r }) {
114
115
  }
115
116
  ) });
116
117
  }
117
- function Ue(e) {
118
- return G(e).join(" ");
118
+ function Ve(e) {
119
+ return X(e).join(" ");
119
120
  }
120
- const re = 160;
121
- function se({ value: e, tone: r }) {
122
- const [a, d] = k(!1), i = Ke(e);
121
+ const se = 160;
122
+ function ne({ value: e, tone: r }) {
123
+ const [a, d] = k(!1), i = Me(e);
123
124
  if (i === "")
124
125
  return /* @__PURE__ */ t("span", { className: "text-[11.5px] italic text-slate-300 dark:text-slate-600", children: "empty" });
125
- const o = i.length > re, n = a || !o ? i : `${i.slice(0, re)}…`;
126
+ const o = i.length > se, n = a || !o ? i : `${i.slice(0, se)}…`;
126
127
  return /* @__PURE__ */ l("span", { className: "break-words text-[12px] leading-relaxed text-slate-700 dark:text-slate-300", children: [
127
128
  typeof e == "object" ? /* @__PURE__ */ t("span", { className: "font-mono text-[11px]", children: n }) : n,
128
129
  o && /* @__PURE__ */ t(
@@ -130,7 +131,7 @@ function se({ value: e, tone: r }) {
130
131
  {
131
132
  type: "button",
132
133
  onClick: () => d((s) => !s),
133
- className: C(
134
+ className: _(
134
135
  "ml-1 text-[10.5px] font-medium hover:underline",
135
136
  r === "before" ? "text-rose-500" : "text-emerald-600"
136
137
  ),
@@ -139,7 +140,7 @@ function se({ value: e, tone: r }) {
139
140
  )
140
141
  ] });
141
142
  }
142
- function P(e) {
143
+ function I(e) {
143
144
  if (e && typeof e == "object" && !Array.isArray(e)) return e;
144
145
  if (typeof e == "string" && e.trim().startsWith("{"))
145
146
  try {
@@ -150,7 +151,7 @@ function P(e) {
150
151
  }
151
152
  return null;
152
153
  }
153
- function Ve({
154
+ function We({
154
155
  before: e,
155
156
  after: r
156
157
  }) {
@@ -170,7 +171,7 @@ function Ve({
170
171
  s !== void 0 ? /* @__PURE__ */ t("span", { className: "text-emerald-700 dark:text-emerald-400", children: i(s) }) : /* @__PURE__ */ t("span", { className: "italic text-slate-400", children: " (removed)" })
171
172
  ] }, o)) });
172
173
  }
173
- function We({ field: e, ctl: r }) {
174
+ function ze({ field: e, ctl: r }) {
174
175
  return r.confirmField === e ? /* @__PURE__ */ l("span", { className: "inline-flex items-center gap-1", "data-revert-field-confirm": e, children: [
175
176
  /* @__PURE__ */ t("span", { className: "text-[10.5px] text-slate-500", children: "Revert?" }),
176
177
  /* @__PURE__ */ t(
@@ -201,20 +202,20 @@ function We({ field: e, ctl: r }) {
201
202
  title: "Set the field back to this revision’s value",
202
203
  "data-revert-field": e,
203
204
  children: [
204
- /* @__PURE__ */ t(le, { className: "h-3 w-3" }),
205
+ /* @__PURE__ */ t(ie, { className: "h-3 w-3" }),
205
206
  "Revert"
206
207
  ]
207
208
  }
208
209
  );
209
210
  }
210
- function Y(e) {
211
+ function G(e) {
211
212
  return typeof e == "string" && /<[a-z][^>]*>/i.test(e);
212
213
  }
213
- function G(e) {
214
+ function X(e) {
214
215
  return String(e ?? "").replace(/<[^>]*>/g, " ").replace(/&nbsp;/g, " ").replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").split(/\s+/).filter(Boolean);
215
216
  }
216
- function ze(e, r) {
217
- const d = G(e).slice(0, 600), i = G(r).slice(0, 600), o = d.length, n = i.length, s = Array.from({ length: o + 1 }, () => new Array(n + 1).fill(0));
217
+ function He(e, r) {
218
+ const d = X(e).slice(0, 600), i = X(r).slice(0, 600), o = d.length, n = i.length, s = Array.from({ length: o + 1 }, () => new Array(n + 1).fill(0));
218
219
  for (let y = o - 1; y >= 0; y--)
219
220
  for (let c = n - 1; c >= 0; c--)
220
221
  s[y][c] = d[y] === i[c] ? s[y + 1][c + 1] + 1 : Math.max(s[y + 1][c], s[y][c + 1]);
@@ -229,8 +230,8 @@ function ze(e, r) {
229
230
  for (; h < n; ) x("ins", i[h++]);
230
231
  return p;
231
232
  }
232
- function He({ before: e, after: r }) {
233
- const a = ze(e, r);
233
+ function Je({ before: e, after: r }) {
234
+ const a = He(e, r);
234
235
  return /* @__PURE__ */ t("p", { className: "whitespace-pre-wrap break-words text-[12px] leading-relaxed text-slate-700 dark:text-slate-300", children: a.map(
235
236
  (d, i) => d.type === "same" ? (
236
237
  // biome-ignore lint/suspicious/noArrayIndexKey: static segment list
@@ -267,16 +268,16 @@ function He({ before: e, after: r }) {
267
268
  )
268
269
  ) });
269
270
  }
270
- const Je = {
271
+ const Qe = {
271
272
  added: "bg-emerald-100 text-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-400",
272
273
  removed: "bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-400",
273
274
  changed: "bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-400"
274
275
  };
275
- function Qe(e, r, a) {
276
+ function Ye(e, r, a) {
276
277
  const d = Array.from(/* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(r)])), i = (s) => s == null || s === "", o = d.map((s) => {
277
278
  const p = !(s in e) || i(e[s]), x = !(s in r) || i(r[s]);
278
279
  if (p && x) return null;
279
- const m = p ? "added" : x ? "removed" : M(e[s]) !== M(r[s]) ? "changed" : "unchanged";
280
+ const m = p ? "added" : x ? "removed" : U(e[s]) !== U(r[s]) ? "changed" : "unchanged";
280
281
  return {
281
282
  field: s,
282
283
  status: m,
@@ -297,55 +298,55 @@ function L({
297
298
  meta: r,
298
299
  tone: a
299
300
  }) {
300
- return e == null || e === "" ? /* @__PURE__ */ t("span", { className: "text-[11.5px] italic text-slate-300 dark:text-slate-600", children: "empty" }) : r.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(Me, { collection: r.relatedCollection, id: e }) }) : Y(e) ? /* @__PURE__ */ t(se, { value: Ue(e), tone: a }) : /* @__PURE__ */ t(se, { value: e, tone: a });
301
+ return e == null || e === "" ? /* @__PURE__ */ t("span", { className: "text-[11.5px] italic text-slate-300 dark:text-slate-600", children: "empty" }) : r.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(Ue, { collection: r.relatedCollection, id: e }) }) : G(e) ? /* @__PURE__ */ t(ne, { value: Ve(e), tone: a }) : /* @__PURE__ */ t(ne, { value: e, tone: a });
301
302
  }
302
- function Ye({
303
+ function Ge({
303
304
  row: e,
304
305
  meta: r,
305
306
  fieldRevert: a,
306
307
  mode: d,
307
308
  hideStatusChips: i
308
309
  }) {
309
- const o = e.status === "changed" && (Y(e.before) || Y(e.after)), n = e.status === "changed" && P(e.before) && P(e.after);
310
+ const o = e.status === "changed" && (G(e.before) || G(e.after)), n = e.status === "changed" && I(e.before) && I(e.after);
310
311
  return /* @__PURE__ */ l(
311
312
  "div",
312
313
  {
313
- className: C(
314
+ className: _(
314
315
  "group/frow border-b border-slate-100 px-3 py-2 last:border-0 dark:border-border/60",
315
316
  e.system && "bg-slate-50/60 dark:bg-muted/20"
316
317
  ),
317
318
  "data-field-row": e.field,
318
319
  children: [
319
320
  /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
320
- /* @__PURE__ */ t(Pe, { map: r, field: e.field }),
321
+ /* @__PURE__ */ t(Ie, { map: r, field: e.field }),
321
322
  e.status !== "unchanged" && !i && /* @__PURE__ */ t(
322
323
  "span",
323
324
  {
324
- className: C(
325
+ className: _(
325
326
  "rounded px-1 py-px text-[9px] font-semibold uppercase tracking-wide",
326
- Je[e.status]
327
+ Qe[e.status]
327
328
  ),
328
329
  children: e.status === "added" ? "set" : e.status
329
330
  }
330
331
  ),
331
- (e.status === "changed" || d === "changes" && e.status === "added") && a && e.field !== "id" && /* @__PURE__ */ t("span", { className: "ml-auto shrink-0", children: /* @__PURE__ */ t(We, { field: e.field, ctl: a }) })
332
+ (e.status === "changed" || d === "changes" && e.status === "added") && a && e.field !== "id" && /* @__PURE__ */ t("span", { className: "ml-auto shrink-0", children: /* @__PURE__ */ t(ze, { field: e.field, ctl: a }) })
332
333
  ] }),
333
- /* @__PURE__ */ t("div", { className: "mt-1", children: o ? /* @__PURE__ */ t("div", { "data-richtext-diff": !0, children: /* @__PURE__ */ t(He, { before: e.before, after: e.after }) }) : n ? /* @__PURE__ */ t(
334
- Ve,
334
+ /* @__PURE__ */ t("div", { className: "mt-1", children: o ? /* @__PURE__ */ t("div", { "data-richtext-diff": !0, children: /* @__PURE__ */ t(Je, { before: e.before, after: e.after }) }) : n ? /* @__PURE__ */ t(
335
+ We,
335
336
  {
336
- before: P(e.before),
337
- after: P(e.after)
337
+ before: I(e.before),
338
+ after: I(e.after)
338
339
  }
339
340
  ) : e.status === "changed" || e.status === "removed" ? /* @__PURE__ */ l("div", { className: "flex flex-wrap items-baseline gap-x-2 gap-y-0.5", children: [
340
341
  /* @__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(L, { value: e.before, meta: g(r, e.field), tone: "before" }) }),
341
- /* @__PURE__ */ t(Ce, { className: "h-3 w-3 shrink-0 self-center text-slate-300 dark:text-slate-600" }),
342
+ /* @__PURE__ */ t(_e, { className: "h-3 w-3 shrink-0 self-center text-slate-300 dark:text-slate-600" }),
342
343
  /* @__PURE__ */ t(L, { value: e.after, meta: g(r, e.field), tone: "after" })
343
344
  ] }) : /* @__PURE__ */ t(L, { value: e.after ?? e.before, meta: g(r, e.field), tone: "after" }) })
344
345
  ]
345
346
  }
346
347
  );
347
348
  }
348
- function Ge({
349
+ function Xe({
349
350
  before: e,
350
351
  after: r,
351
352
  meta: a,
@@ -353,7 +354,7 @@ function Ge({
353
354
  mode: i,
354
355
  hideStatusChips: o
355
356
  }) {
356
- const [n, s] = k(!1), p = T(() => Qe(e, r, a), [e, r, a]), x = i === "changes" ? p.filter((u) => u.status !== "unchanged") : p, m = n ? x : x.filter((u) => !u.system), h = x.length - m.length;
357
+ const [n, s] = k(!1), p = j(() => Ye(e, r, a), [e, r, a]), x = i === "changes" ? p.filter((u) => u.status !== "unchanged") : p, m = n ? x : x.filter((u) => !u.system), h = x.length - m.length;
357
358
  if (x.length === 0)
358
359
  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." });
359
360
  const y = m.findIndex(
@@ -368,7 +369,7 @@ function Ge({
368
369
  /* @__PURE__ */ t("p", { className: "text-[10.5px] text-slate-400", children: "Not on the form — written automatically by rules, computed fields or integrations." })
369
370
  ] }),
370
371
  /* @__PURE__ */ t(
371
- Ye,
372
+ Ge,
372
373
  {
373
374
  row: u,
374
375
  meta: a,
@@ -405,24 +406,24 @@ function Ge({
405
406
  )
406
407
  ] });
407
408
  }
408
- const Xe = {
409
+ const Ze = {
409
410
  create: "bg-emerald-500",
410
411
  restore: "bg-emerald-500",
411
412
  update: "bg-nvr-cyan",
412
413
  delete: "bg-red-500"
413
414
  };
414
- function O(e) {
415
+ function E(e) {
415
416
  var r;
416
417
  return e.first_name || e.last_name ? [e.first_name, e.last_name].filter(Boolean).join(" ") : e.user_email ?? ((r = e.user_id) == null ? void 0 : r.slice(0, 8)) ?? "System";
417
418
  }
418
- function Ze(e, r, a) {
419
+ function et(e, r, a) {
419
420
  return e.action === "create" ? "created this record" : e.action === "restore" ? "restored this record from trash" : e.action === "delete" ? "deleted this record" : r > 0 ? `changed ${r} field${r === 1 ? "" : "s"}` : a > 0 ? "updated system fields" : "saved this record";
420
421
  }
421
- function et({ revision: e, isLast: r }) {
422
+ function tt({ revision: e, isLast: r }) {
422
423
  var p, x, m;
423
- const a = e.event, d = (a == null ? void 0 : a.source) === "auto" || !e.user_id && (a == null ? void 0 : a.kind) === "transition", i = !d && ((p = a == null ? void 0 : a.on_behalf_of) != null && p.name) ? a.on_behalf_of.name : null, o = d ? "Automatic rule" : i ? `${O(e)}, for ${i}` : O(e);
424
+ const a = e.event, d = (a == null ? void 0 : a.source) === "auto" || !e.user_id && (a == null ? void 0 : a.kind) === "transition", i = !d && ((p = a == null ? void 0 : a.on_behalf_of) != null && p.name) ? a.on_behalf_of.name : null, o = d ? "Automatic rule" : i ? `${E(e)}, for ${i}` : E(e);
424
425
  let n;
425
- (a == null ? void 0 : a.kind) === "transition" && a.addendum ? n = /* @__PURE__ */ l(_, { children: [
426
+ (a == null ? void 0 : a.kind) === "transition" && a.addendum ? n = /* @__PURE__ */ l(T, { children: [
426
427
  "moved",
427
428
  " ",
428
429
  /* @__PURE__ */ l("span", { className: "font-medium text-slate-700 dark:text-slate-200", "data-revision-addendum": !0, children: [
@@ -432,7 +433,7 @@ function et({ revision: e, isLast: r }) {
432
433
  ] }),
433
434
  ":",
434
435
  " ",
435
- a.from_label && /* @__PURE__ */ l(_, { children: [
436
+ a.from_label && /* @__PURE__ */ l(T, { children: [
436
437
  /* @__PURE__ */ t("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: a.from_label }),
437
438
  " ",
438
439
  "→",
@@ -443,10 +444,10 @@ function et({ revision: e, isLast: r }) {
443
444
  " · ",
444
445
  a.transition_label
445
446
  ] })
446
- ] }) : (a == null ? void 0 : a.kind) === "transition" ? n = /* @__PURE__ */ l(_, { children: [
447
+ ] }) : (a == null ? void 0 : a.kind) === "transition" ? n = /* @__PURE__ */ l(T, { children: [
447
448
  "moved it",
448
449
  " ",
449
- a.from_label && /* @__PURE__ */ l(_, { children: [
450
+ a.from_label && /* @__PURE__ */ l(T, { children: [
450
451
  "from",
451
452
  " ",
452
453
  /* @__PURE__ */ t("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: a.from_label }),
@@ -459,19 +460,19 @@ function et({ revision: e, isLast: r }) {
459
460
  " · ",
460
461
  a.transition_label
461
462
  ] })
462
- ] }) : (a == null ? void 0 : a.kind) === "start" && a.to_label ? n = /* @__PURE__ */ l(_, { children: [
463
+ ] }) : (a == null ? void 0 : a.kind) === "start" && a.to_label ? n = /* @__PURE__ */ l(T, { children: [
463
464
  "started it in",
464
465
  " ",
465
466
  /* @__PURE__ */ t("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: a.to_label })
466
- ] }) : (a == null ? void 0 : a.kind) === "start" ? n = /* @__PURE__ */ l(_, { children: [
467
+ ] }) : (a == null ? void 0 : a.kind) === "start" ? n = /* @__PURE__ */ l(T, { children: [
467
468
  "started the pipeline",
468
469
  e.comment ? ` — ${e.comment.replace(/^Started pipeline\s*[—-]?\s*/i, "")}` : ""
469
- ] }) : (x = e.action) != null && x.startsWith("o2m-") ? n = /* @__PURE__ */ l(_, { children: [
470
+ ] }) : (x = e.action) != null && x.startsWith("o2m-") ? n = /* @__PURE__ */ l(T, { children: [
470
471
  e.action === "o2m-create" ? "added" : e.action === "o2m-delete" ? "removed" : "changed",
471
472
  " ",
472
473
  "related rows",
473
474
  e.comment ? ` — ${e.comment}` : ""
474
- ] }) : n = /* @__PURE__ */ l(_, { children: [
475
+ ] }) : n = /* @__PURE__ */ l(T, { children: [
475
476
  e.action ?? "event",
476
477
  e.comment ? ` — ${e.comment}` : ""
477
478
  ] });
@@ -486,7 +487,7 @@ function et({ revision: e, isLast: r }) {
486
487
  /* @__PURE__ */ t(
487
488
  "span",
488
489
  {
489
- className: C(
490
+ className: _(
490
491
  "absolute left-[11px] top-[18px] h-2.5 w-2.5 rounded-full ring-4 ring-white dark:ring-card",
491
492
  (a == null ? void 0 : a.kind) === "transition" && a.addendum ? "bg-amber-500" : (a == null ? void 0 : a.kind) === "transition" ? "bg-violet-500" : (a == null ? void 0 : a.kind) === "start" ? "bg-violet-300" : "bg-slate-300"
492
493
  ),
@@ -502,7 +503,7 @@ function et({ revision: e, isLast: r }) {
502
503
  ),
503
504
  /* @__PURE__ */ l("div", { className: "flex w-full items-start gap-2.5 rounded-md px-2 py-2.5 text-left", children: [
504
505
  d ? /* @__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(
505
- de,
506
+ oe,
506
507
  {
507
508
  userId: e.user_id,
508
509
  className: "h-6 w-6",
@@ -539,7 +540,7 @@ function et({ revision: e, isLast: r }) {
539
540
  }
540
541
  );
541
542
  }
542
- function tt({
543
+ function at({
543
544
  revision: e,
544
545
  previousData: r,
545
546
  meta: a,
@@ -547,59 +548,64 @@ function tt({
547
548
  inlineTableFields: i,
548
549
  isLast: o
549
550
  }) {
550
- const n = D(), [s, p] = k(!1), [x, m] = k(!1), [h, y] = k("changes"), [c, u] = k(!1), [b, v] = k(null), w = e.action === "update", S = e.action === "create" || e.action === "restore", $ = e.action === "delete", B = $ ? e.data ?? {} : S ? {} : r ?? {}, Z = $ ? {} : e.data ?? {}, { humanDelta: N, systemDelta: R } = T(() => {
551
+ const n = D(), [s, p] = k(!1), [x, m] = k(!1), [h, y] = k("changes"), [c, u] = k(!1), [b, v] = k(null), w = e.action === "update", S = e.action === "create" || e.action === "restore", q = e.action === "delete", P = q ? e.data ?? {} : S ? {} : r ?? {}, ee = q ? {} : e.data ?? {}, { humanDelta: N, systemDelta: A } = j(() => {
551
552
  const f = e.delta ?? {};
552
- let q = 0, ae = 0;
553
- for (const z of Object.keys(f)) {
554
- const fe = r == null ? void 0 : r[z], be = (e.data ?? {})[z];
555
- w && r && M(fe) === M(be) || (g(a, z).system ? ae++ : q++);
553
+ let C = 0, O = 0;
554
+ for (const H of Object.keys(f)) {
555
+ const be = r == null ? void 0 : r[H], ge = (e.data ?? {})[H];
556
+ w && r && U(be) === U(ge) || (g(a, H).system ? O++ : C++);
556
557
  }
557
- return { humanDelta: q, systemDelta: ae };
558
- }, [e, r, a, w]), U = w || S, [V, ce] = k(null), me = X(), [pe, ee] = k(null), te = H({
559
- mutationFn: (f) => n.request(I(`/revisions/${e.id}/revert-field`, { field: f })),
560
- onSuccess: (f, q) => {
561
- ee(null), A.success(`Reverted ${g(a, q).label} to this revision's value`), me.invalidateQueries({ queryKey: ["revisions", e.collection, e.item] }), d == null || d();
558
+ return { humanDelta: C, systemDelta: O };
559
+ }, [e, r, a, w]), V = w || S, [W, me] = k(null), pe = Z(), [ue, te] = k(null), ae = J({
560
+ mutationFn: (f) => n.request(K(`/revisions/${e.id}/revert-field`, { field: f })),
561
+ onSuccess: (f, C) => {
562
+ te(null), R.success(`Reverted ${g(a, C).label} to this revision's value`), pe.invalidateQueries({ queryKey: ["revisions", e.collection, e.item] }), d == null || d();
562
563
  },
563
- onError: () => A.error("Failed to revert field")
564
- }), ue = w || S ? {
565
- confirmField: pe,
566
- setConfirmField: ee,
567
- revert: (f) => te.mutate(f),
568
- pending: te.isPending
569
- } : void 0, W = H({
570
- mutationFn: () => n.request(I(`/revisions/${e.id}/rollback`, {})),
571
- onSuccess: () => {
572
- m(!1), A.success("Rolled back to this revision"), i != null && i.length && e.timestamp && ce(e.timestamp), d == null || d();
564
+ onError: () => R.error("Failed to revert field")
565
+ }), he = w || S ? {
566
+ confirmField: ue,
567
+ setConfirmField: te,
568
+ revert: (f) => ae.mutate(f),
569
+ pending: ae.isPending
570
+ } : void 0, z = J({
571
+ mutationFn: () => n.request(K(`/revisions/${e.id}/rollback`, {})),
572
+ onSuccess: (f) => {
573
+ m(!1), R.success("Rolled back to this revision");
574
+ const C = re(f);
575
+ C && R.warning(C, { duration: 1e4 }), i != null && i.length && e.timestamp && me(e.timestamp), d == null || d();
573
576
  },
574
- onError: () => A.error("Failed to rollback")
577
+ onError: () => R.error("Failed to rollback")
575
578
  });
576
- async function he(f) {
577
- if (V) {
579
+ async function xe(f) {
580
+ if (W) {
578
581
  v(f.field);
579
582
  try {
580
- await n.request(
581
- I("/revisions/o2m-restore", {
583
+ const C = await n.request(
584
+ K("/revisions/o2m-restore", {
582
585
  collection: f.relatedCollection,
583
586
  many_field: f.manyField,
584
587
  parent_id: f.parentId,
585
- target_timestamp: V
588
+ target_timestamp: W
586
589
  })
587
- ), A.success(`Restored ${f.label}`);
590
+ );
591
+ R.success(`Restored ${f.label}`);
592
+ const O = re(C);
593
+ O && R.warning(O, { duration: 1e4 });
588
594
  } catch {
589
- A.error(`Failed to restore ${f.label}`);
595
+ R.error(`Failed to restore ${f.label}`);
590
596
  } finally {
591
597
  v(null);
592
598
  }
593
599
  }
594
600
  }
595
- const xe = e.timestamp ? new Date(e.timestamp).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }) : "—";
601
+ const fe = e.timestamp ? new Date(e.timestamp).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }) : "—";
596
602
  return /* @__PURE__ */ l("div", { className: "relative pl-9", "data-revision-row": e.id, children: [
597
603
  /* @__PURE__ */ t(
598
604
  "span",
599
605
  {
600
- className: C(
606
+ className: _(
601
607
  "absolute left-[11px] top-[18px] h-2.5 w-2.5 rounded-full ring-4 ring-white dark:ring-card",
602
- Xe[e.action ?? ""] ?? "bg-slate-300"
608
+ Ze[e.action ?? ""] ?? "bg-slate-300"
603
609
  ),
604
610
  "aria-hidden": !0
605
611
  }
@@ -619,27 +625,27 @@ function tt({
619
625
  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",
620
626
  children: [
621
627
  /* @__PURE__ */ t(
622
- de,
628
+ oe,
623
629
  {
624
630
  userId: e.user_id,
625
631
  className: "h-6 w-6",
626
- fallback: /* @__PURE__ */ t("span", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/10 text-[10px] font-semibold text-nvr-navy dark:text-nvr-cyan", children: O(e).split(" ").map((f) => f[0]).filter(Boolean).slice(0, 2).join("").toUpperCase() })
632
+ fallback: /* @__PURE__ */ t("span", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/10 text-[10px] font-semibold text-nvr-navy dark:text-nvr-cyan", children: E(e).split(" ").map((f) => f[0]).filter(Boolean).slice(0, 2).join("").toUpperCase() })
627
633
  }
628
634
  ),
629
635
  /* @__PURE__ */ l("span", { className: "min-w-0 flex-1 truncate text-[12.5px] text-slate-700 dark:text-slate-200", children: [
630
- /* @__PURE__ */ t("span", { className: "font-medium", children: O(e) }),
636
+ /* @__PURE__ */ t("span", { className: "font-medium", children: E(e) }),
631
637
  " ",
632
- /* @__PURE__ */ t("span", { className: "text-slate-500 dark:text-slate-400", children: Ze(e, N, R) })
638
+ /* @__PURE__ */ t("span", { className: "text-slate-500 dark:text-slate-400", children: et(e, N, A) })
633
639
  ] }),
634
640
  /* @__PURE__ */ t(
635
641
  "span",
636
642
  {
637
643
  className: "shrink-0 text-[11px] tabular-nums text-slate-400",
638
644
  title: e.timestamp ? new Date(e.timestamp).toLocaleString() : void 0,
639
- children: xe
645
+ children: fe
640
646
  }
641
647
  ),
642
- s ? /* @__PURE__ */ t(ve, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }) : /* @__PURE__ */ t(we, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
648
+ s ? /* @__PURE__ */ t(we, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }) : /* @__PURE__ */ t(Se, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
643
649
  ]
644
650
  }
645
651
  ),
@@ -648,16 +654,16 @@ function tt({
648
654
  /* @__PURE__ */ t("div", { className: "flex items-center overflow-hidden rounded-md border border-slate-200 dark:border-border", children: [
649
655
  ["changes", "What changed"],
650
656
  ["all", "Full record"]
651
- ].map(([f, q]) => /* @__PURE__ */ t(
657
+ ].map(([f, C]) => /* @__PURE__ */ t(
652
658
  "button",
653
659
  {
654
660
  type: "button",
655
661
  onClick: () => y(f),
656
- className: C(
662
+ className: _(
657
663
  "px-2.5 py-1 text-[11.5px] transition-colors",
658
664
  h === f ? "bg-nvr-cyan/10 font-medium text-nvr-navy dark:text-nvr-cyan" : "text-slate-400 hover:text-slate-600 dark:hover:text-slate-300"
659
665
  ),
660
- children: q
666
+ children: C
661
667
  },
662
668
  f
663
669
  )) }),
@@ -667,31 +673,31 @@ function tt({
667
673
  {
668
674
  type: "button",
669
675
  onClick: () => u((f) => !f),
670
- className: C(
676
+ className: _(
671
677
  "inline-flex items-center gap-1 rounded-md border px-2 py-1 text-[11.5px] transition-colors",
672
678
  c ? "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"
673
679
  ),
674
680
  children: [
675
- /* @__PURE__ */ t(Se, { className: "h-3 w-3" }),
681
+ /* @__PURE__ */ t(Ce, { className: "h-3 w-3" }),
676
682
  "Notes"
677
683
  ]
678
684
  }
679
685
  ),
680
- U && (x ? /* @__PURE__ */ l("span", { className: "inline-flex items-center gap-1.5", children: [
686
+ V && (x ? /* @__PURE__ */ l("span", { className: "inline-flex items-center gap-1.5", children: [
681
687
  /* @__PURE__ */ t("span", { className: "text-[11px] text-slate-500", children: "Restore this version?" }),
682
688
  /* @__PURE__ */ t(
683
- K,
689
+ M,
684
690
  {
685
691
  size: "sm",
686
692
  variant: "destructive",
687
693
  className: "h-6 text-[11px]",
688
- disabled: W.isPending,
689
- onClick: () => W.mutate(),
694
+ disabled: z.isPending,
695
+ onClick: () => z.mutate(),
690
696
  children: "Yes, restore"
691
697
  }
692
698
  ),
693
699
  /* @__PURE__ */ t(
694
- K,
700
+ M,
695
701
  {
696
702
  size: "sm",
697
703
  variant: "outline",
@@ -701,35 +707,35 @@ function tt({
701
707
  }
702
708
  )
703
709
  ] }) : /* @__PURE__ */ l(
704
- K,
710
+ M,
705
711
  {
706
712
  size: "sm",
707
713
  variant: "outline",
708
714
  className: "h-6 gap-1 text-[11px]",
709
- disabled: W.isPending,
715
+ disabled: z.isPending,
710
716
  onClick: () => m(!0),
711
717
  title: "Set the whole record back to how it looked after this save",
712
718
  children: [
713
- /* @__PURE__ */ t(le, { className: "h-3 w-3" }),
719
+ /* @__PURE__ */ t(ie, { className: "h-3 w-3" }),
714
720
  "Restore this version"
715
721
  ]
716
722
  }
717
723
  ))
718
724
  ] })
719
725
  ] }),
720
- c && /* @__PURE__ */ t(lt, { revisionId: e.id ?? "" }),
726
+ c && /* @__PURE__ */ t(it, { revisionId: e.id ?? "" }),
721
727
  /* @__PURE__ */ t(
722
- Ge,
728
+ Xe,
723
729
  {
724
- before: B,
725
- after: Z,
730
+ before: P,
731
+ after: ee,
726
732
  meta: a,
727
- fieldRevert: ue,
733
+ fieldRevert: he,
728
734
  mode: h,
729
735
  hideStatusChips: S
730
736
  }
731
737
  ),
732
- V && 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: [
738
+ W && 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: [
733
739
  /* @__PURE__ */ t("p", { className: "text-[10.5px] font-medium text-slate-500", children: "Also restore related rows?" }),
734
740
  i.map((f) => /* @__PURE__ */ l("div", { className: "flex items-center justify-between gap-2", children: [
735
741
  /* @__PURE__ */ t("span", { className: "text-[11.5px] text-slate-600 dark:text-slate-300", children: f.label }),
@@ -738,7 +744,7 @@ function tt({
738
744
  {
739
745
  type: "button",
740
746
  disabled: b === f.field,
741
- onClick: () => he(f),
747
+ onClick: () => xe(f),
742
748
  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",
743
749
  children: b === f.field ? "Restoring…" : "Restore"
744
750
  }
@@ -748,25 +754,25 @@ function tt({
748
754
  ] })
749
755
  ] });
750
756
  }
751
- function at({ data: e, meta: r }) {
752
- const [a, d] = k(null), [i, o] = k(""), [n, s] = k(""), [p, x] = k(""), m = T(() => {
757
+ function rt({ data: e, meta: r }) {
758
+ const [a, d] = k(null), [i, o] = k(""), [n, s] = k(""), [p, x] = k(""), m = j(() => {
753
759
  if (!i || !e) return null;
754
760
  const c = (/* @__PURE__ */ new Date(`${i}T23:59:59`)).getTime();
755
761
  return e.find((u) => u.timestamp && new Date(u.timestamp).getTime() <= c) ?? null;
756
- }, [i, e]), h = T(() => {
762
+ }, [i, e]), h = j(() => {
757
763
  if (!n || !p || !e) return null;
758
764
  const c = (/* @__PURE__ */ new Date(`${n}T23:59:59`)).getTime(), u = (/* @__PURE__ */ new Date(`${p}T23:59:59`)).getTime();
759
765
  if (u <= c) return { error: "The second date must be after the first" };
760
- const b = (N) => e.find((R) => R.timestamp && new Date(R.timestamp).getTime() <= N) ?? null, v = b(c), w = b(u);
766
+ const b = (N) => e.find((A) => A.timestamp && new Date(A.timestamp).getTime() <= N) ?? null, v = b(c), w = b(u);
761
767
  if (!w) return { error: "No snapshot exists at or before the second date" };
762
- const S = (v == null ? void 0 : v.data) ?? {}, $ = w.data ?? {}, B = /* @__PURE__ */ new Map();
768
+ const S = (v == null ? void 0 : v.data) ?? {}, q = w.data ?? {}, P = /* @__PURE__ */ new Map();
763
769
  for (const N of [...e].reverse()) {
764
- const R = N.timestamp ? new Date(N.timestamp).getTime() : 0;
765
- if (!(R <= c || R > u || !N.delta))
766
- for (const U of Object.keys(N.delta))
767
- B.set(U, { name: O(N), when: N.timestamp });
770
+ const A = N.timestamp ? new Date(N.timestamp).getTime() : 0;
771
+ if (!(A <= c || A > u || !N.delta))
772
+ for (const V of Object.keys(N.delta))
773
+ P.set(V, { name: E(N), when: N.timestamp });
768
774
  }
769
- return { fields: [.../* @__PURE__ */ new Set([...Object.keys(S), ...Object.keys($)])].filter((N) => String(S[N] ?? "") !== String($[N] ?? "")).map((N) => ({ field: N, from: S[N], to: $[N], by: B.get(N) ?? null })) };
775
+ return { fields: [.../* @__PURE__ */ new Set([...Object.keys(S), ...Object.keys(q)])].filter((N) => String(S[N] ?? "") !== String(q[N] ?? "")).map((N) => ({ field: N, from: S[N], to: q[N], by: P.get(N) ?? null })) };
770
776
  }, [n, p, e]), y = "h-7 rounded-md border border-slate-200 bg-white px-2 text-[12px] dark:border-border dark:bg-card";
771
777
  return /* @__PURE__ */ l("div", { className: "space-y-2", children: [
772
778
  /* @__PURE__ */ l("div", { className: "flex items-center gap-1.5", children: [
@@ -775,12 +781,12 @@ function at({ data: e, meta: r }) {
775
781
  {
776
782
  type: "button",
777
783
  onClick: () => d(a === "asof" ? null : "asof"),
778
- className: C(
784
+ className: _(
779
785
  "inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1 text-[11.5px] transition-colors",
780
786
  a === "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"
781
787
  ),
782
788
  children: [
783
- /* @__PURE__ */ t(Ne, { className: "h-3.5 w-3.5" }),
789
+ /* @__PURE__ */ t(ke, { className: "h-3.5 w-3.5" }),
784
790
  "View as of a date"
785
791
  ]
786
792
  }
@@ -790,12 +796,12 @@ function at({ data: e, meta: r }) {
790
796
  {
791
797
  type: "button",
792
798
  onClick: () => d(a === "compare" ? null : "compare"),
793
- className: C(
799
+ className: _(
794
800
  "inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1 text-[11.5px] transition-colors",
795
801
  a === "compare" || n && p ? "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"
796
802
  ),
797
803
  children: [
798
- /* @__PURE__ */ t(ke, { className: "h-3.5 w-3.5" }),
804
+ /* @__PURE__ */ t(ve, { className: "h-3.5 w-3.5" }),
799
805
  "Compare two dates"
800
806
  ]
801
807
  }
@@ -940,7 +946,7 @@ function at({ data: e, meta: r }) {
940
946
  ] })
941
947
  ] });
942
948
  }
943
- function rt(e) {
949
+ function st(e) {
944
950
  return e ? new Date(e).toLocaleDateString([], {
945
951
  weekday: "short",
946
952
  month: "short",
@@ -948,71 +954,71 @@ function rt(e) {
948
954
  year: "numeric"
949
955
  }) : "Unknown date";
950
956
  }
951
- function st({
957
+ function nt({
952
958
  collection: e,
953
959
  item: r,
954
960
  onRollback: a,
955
961
  inlineTableFields: d
956
962
  }) {
957
- const i = D(), o = oe(e, !0), { data: n, isLoading: s } = E({
963
+ const i = D(), o = ce(e, !0), { data: n, isLoading: s } = B({
958
964
  queryKey: ["revisions", e, r],
959
965
  queryFn: () => i.request(F("/revisions", { collection: e, item: r })).then((u) => u.data ?? []),
960
966
  staleTime: 3e4
961
- }), p = X();
962
- Re(e, r, [["revisions", e, r]], { client: p });
963
- const x = _e(null), m = T(() => {
967
+ }), p = Z();
968
+ je(e, r, [["revisions", e, r]], { client: p });
969
+ const x = Te(null), m = j(() => {
964
970
  if (!n) return /* @__PURE__ */ new Set();
965
- const u = n.map(j);
971
+ const u = n.map($);
966
972
  if (!x.current)
967
973
  return x.current = new Set(u), /* @__PURE__ */ new Set();
968
974
  const b = x.current;
969
975
  return new Set(u.filter((v) => !b.has(v)));
970
- }, [n]), h = (n == null ? void 0 : n.length) ?? 0, y = T(() => (n ?? []).filter(Q), [n]), c = T(() => {
976
+ }, [n]), h = (n == null ? void 0 : n.length) ?? 0, y = j(() => (n ?? []).filter(Y), [n]), c = j(() => {
971
977
  const u = [];
972
978
  for (const b of n ?? []) {
973
- const v = rt(b.timestamp), w = u[u.length - 1];
979
+ const v = st(b.timestamp), w = u[u.length - 1];
974
980
  w && w.day === v ? w.revisions.push(b) : u.push({ day: v, revisions: [b] });
975
981
  }
976
982
  return u;
977
983
  }, [n]);
978
- return s ? /* @__PURE__ */ t("div", { className: "space-y-2 pt-3", children: [1, 2, 3, 4].map((u) => /* @__PURE__ */ t(De, { className: "h-11 rounded-md" }, u)) }) : h === 0 ? /* @__PURE__ */ l("div", { className: "flex flex-col items-center py-16 text-center", children: [
979
- /* @__PURE__ */ t(J, { className: "mb-2 h-8 w-8 text-slate-300 dark:text-slate-600" }),
984
+ return s ? /* @__PURE__ */ t("div", { className: "space-y-2 pt-3", children: [1, 2, 3, 4].map((u) => /* @__PURE__ */ t(Oe, { className: "h-11 rounded-md" }, u)) }) : h === 0 ? /* @__PURE__ */ l("div", { className: "flex flex-col items-center py-16 text-center", children: [
985
+ /* @__PURE__ */ t(Q, { className: "mb-2 h-8 w-8 text-slate-300 dark:text-slate-600" }),
980
986
  /* @__PURE__ */ t("p", { className: "text-[13px] font-medium text-slate-600 dark:text-slate-300", children: "No history yet" }),
981
987
  /* @__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." })
982
988
  ] }) : /* @__PURE__ */ l("div", { className: "space-y-3 pt-3", children: [
983
- /* @__PURE__ */ t(at, { data: y, meta: o }),
984
- y.length >= 3 && /* @__PURE__ */ t(it, { revisions: y, meta: o }),
989
+ /* @__PURE__ */ t(rt, { data: y, meta: o }),
990
+ y.length >= 3 && /* @__PURE__ */ t(dt, { revisions: y, meta: o }),
985
991
  /* @__PURE__ */ t("div", { children: c.map((u) => /* @__PURE__ */ l("div", { children: [
986
992
  /* @__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: u.day }) }),
987
993
  u.revisions.map((b) => {
988
994
  const v = (n ?? []).indexOf(b), w = v === ((n == null ? void 0 : n.length) ?? 1) - 1;
989
- if (Ee(b))
995
+ if (Be(b))
990
996
  return /* @__PURE__ */ l(
991
997
  "div",
992
998
  {
993
- className: C(
999
+ className: _(
994
1000
  "nvr-fade-in relative",
995
- m.has(j(b)) && "rounded-md bg-nvr-cyan/[0.06]"
1001
+ m.has($(b)) && "rounded-md bg-nvr-cyan/[0.06]"
996
1002
  ),
997
1003
  children: [
998
- m.has(j(b)) && /* @__PURE__ */ t(ne, {}),
999
- /* @__PURE__ */ t(et, { revision: b, isLast: w })
1004
+ m.has($(b)) && /* @__PURE__ */ t(le, {}),
1005
+ /* @__PURE__ */ t(tt, { revision: b, isLast: w })
1000
1006
  ]
1001
1007
  },
1002
- j(b)
1008
+ $(b)
1003
1009
  );
1004
- const S = (n ?? []).slice(v + 1).find(Q);
1010
+ const S = (n ?? []).slice(v + 1).find(Y);
1005
1011
  return /* @__PURE__ */ l(
1006
1012
  "div",
1007
1013
  {
1008
- className: C(
1014
+ className: _(
1009
1015
  "nvr-fade-in relative",
1010
- m.has(j(b)) && "rounded-md bg-nvr-cyan/[0.06]"
1016
+ m.has($(b)) && "rounded-md bg-nvr-cyan/[0.06]"
1011
1017
  ),
1012
1018
  children: [
1013
- m.has(j(b)) && /* @__PURE__ */ t(ne, {}),
1019
+ m.has($(b)) && /* @__PURE__ */ t(le, {}),
1014
1020
  /* @__PURE__ */ t(
1015
- tt,
1021
+ at,
1016
1022
  {
1017
1023
  revision: b,
1018
1024
  previousData: (S == null ? void 0 : S.data) ?? null,
@@ -1024,13 +1030,13 @@ function st({
1024
1030
  )
1025
1031
  ]
1026
1032
  },
1027
- j(b)
1033
+ $(b)
1028
1034
  );
1029
1035
  })
1030
1036
  ] }, u.day)) })
1031
1037
  ] });
1032
1038
  }
1033
- function ne() {
1039
+ function le() {
1034
1040
  return (
1035
1041
  // Under the timeline dot, inside the row's 36px gutter.
1036
1042
  /* @__PURE__ */ t(
@@ -1043,7 +1049,7 @@ function ne() {
1043
1049
  )
1044
1050
  );
1045
1051
  }
1046
- function wt({
1052
+ function Ct({
1047
1053
  collection: e,
1048
1054
  item: r,
1049
1055
  onRollback: a,
@@ -1053,9 +1059,9 @@ function wt({
1053
1059
  onOpenChange: n,
1054
1060
  compact: s
1055
1061
  }) {
1056
- return /* @__PURE__ */ l(Ae, { open: o, onOpenChange: n, children: [
1057
- !(o !== void 0) && /* @__PURE__ */ t($e, { asChild: !0, children: /* @__PURE__ */ l(
1058
- K,
1062
+ return /* @__PURE__ */ l($e, { open: o, onOpenChange: n, children: [
1063
+ !(o !== void 0) && /* @__PURE__ */ t(qe, { asChild: !0, children: /* @__PURE__ */ l(
1064
+ M,
1059
1065
  {
1060
1066
  variant: s ? "ghost" : "outline",
1061
1067
  size: "sm",
@@ -1063,23 +1069,23 @@ function wt({
1063
1069
  "aria-label": "History",
1064
1070
  className: d ?? (s ? "h-8 w-8 rounded-none p-0" : "gap-1.5"),
1065
1071
  children: [
1066
- /* @__PURE__ */ t(J, { className: s ? "h-4 w-4" : "h-3.5 w-3.5" }),
1072
+ /* @__PURE__ */ t(Q, { className: s ? "h-4 w-4" : "h-3.5 w-3.5" }),
1067
1073
  !s && "History"
1068
1074
  ]
1069
1075
  }
1070
1076
  ) }),
1071
- /* @__PURE__ */ t(qe, { className: "w-[720px] overflow-y-auto p-0 sm:max-w-[92vw]", children: /* @__PURE__ */ l("div", { className: "p-6", children: [
1072
- /* @__PURE__ */ l(Le, { children: [
1073
- /* @__PURE__ */ l(Fe, { className: "flex items-center gap-2 text-base", children: [
1074
- /* @__PURE__ */ t(J, { className: "h-4 w-4 text-slate-400" }),
1077
+ /* @__PURE__ */ t(Le, { className: "w-[720px] overflow-y-auto p-0 sm:max-w-[92vw]", children: /* @__PURE__ */ l("div", { className: "p-6", children: [
1078
+ /* @__PURE__ */ l(Fe, { children: [
1079
+ /* @__PURE__ */ l(De, { className: "flex items-center gap-2 text-base", children: [
1080
+ /* @__PURE__ */ t(Q, { className: "h-4 w-4 text-slate-400" }),
1075
1081
  "Revision history"
1076
1082
  ] }),
1077
1083
  /* @__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." })
1078
1084
  ] }),
1079
- /* @__PURE__ */ t(nt, { collection: e, item: r }),
1080
- /* @__PURE__ */ t(Oe, { collection: e, item: String(r) }),
1085
+ /* @__PURE__ */ t(lt, { collection: e, item: r }),
1086
+ /* @__PURE__ */ t(Ee, { collection: e, item: String(r) }),
1081
1087
  /* @__PURE__ */ t(
1082
- st,
1088
+ nt,
1083
1089
  {
1084
1090
  collection: e,
1085
1091
  item: r,
@@ -1090,15 +1096,15 @@ function wt({
1090
1096
  ] }) })
1091
1097
  ] });
1092
1098
  }
1093
- function nt({ collection: e, item: r }) {
1094
- const a = D(), d = oe(e, !0), [i, o] = k(""), [n, s] = k(""), { data: p, isFetching: x } = E({
1099
+ function lt({ collection: e, item: r }) {
1100
+ const a = D(), d = ce(e, !0), [i, o] = k(""), [n, s] = k(""), { data: p, isFetching: x } = B({
1095
1101
  queryKey: ["rev-value-search", e, r, n],
1096
1102
  queryFn: () => a.request(F("/revisions/value-search", { collection: e, item: r, q: n })).then((m) => m.data),
1097
1103
  enabled: n.length >= 2
1098
1104
  });
1099
1105
  return /* @__PURE__ */ l("div", { className: "mt-3", children: [
1100
1106
  /* @__PURE__ */ l("div", { className: "relative", children: [
1101
- /* @__PURE__ */ t(ge, { className: "pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
1107
+ /* @__PURE__ */ t(ye, { className: "pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
1102
1108
  /* @__PURE__ */ t(
1103
1109
  "input",
1104
1110
  {
@@ -1120,7 +1126,7 @@ function nt({ collection: e, item: r }) {
1120
1126
  },
1121
1127
  className: "absolute right-2 top-1/2 -translate-y-1/2 text-slate-400 hover:text-slate-600",
1122
1128
  "aria-label": "Clear search",
1123
- children: /* @__PURE__ */ t(ye, { className: "h-3.5 w-3.5" })
1129
+ children: /* @__PURE__ */ t(Ne, { className: "h-3.5 w-3.5" })
1124
1130
  }
1125
1131
  )
1126
1132
  ] }),
@@ -1128,7 +1134,7 @@ function nt({ collection: e, item: r }) {
1128
1134
  "“",
1129
1135
  n,
1130
1136
  "” never appears in this record’s recorded changes."
1131
- ] }) : /* @__PURE__ */ l(_, { children: [
1137
+ ] }) : /* @__PURE__ */ l(T, { children: [
1132
1138
  p == null ? void 0 : p.matches.map((m) => /* @__PURE__ */ l("div", { className: "text-[11.5px]", children: [
1133
1139
  /* @__PURE__ */ t("p", { className: "text-slate-600 dark:text-slate-300", children: m.fields.map((h) => /* @__PURE__ */ l("span", { children: [
1134
1140
  /* @__PURE__ */ t("span", { className: "font-medium", title: h.field, children: g(d, h.field).label }),
@@ -1151,19 +1157,19 @@ function nt({ collection: e, item: r }) {
1151
1157
  ] }) })
1152
1158
  ] });
1153
1159
  }
1154
- function lt({ revisionId: e }) {
1155
- const r = D(), a = X(), [d, i] = k(""), { data: o = [] } = E({
1160
+ function it({ revisionId: e }) {
1161
+ const r = D(), a = Z(), [d, i] = k(""), { data: o = [] } = B({
1156
1162
  queryKey: ["revision-notes", String(e)],
1157
1163
  queryFn: () => r.request(F("/comments", { collection: "nivaro_revisions", item: String(e) })).then((s) => s.data ?? []).catch(() => []),
1158
1164
  staleTime: 3e4
1159
- }), n = H({
1165
+ }), n = J({
1160
1166
  mutationFn: () => r.request(
1161
- I("/comments", { collection: "nivaro_revisions", item: String(e), text: d })
1167
+ K("/comments", { collection: "nivaro_revisions", item: String(e), text: d })
1162
1168
  ),
1163
1169
  onSuccess: () => {
1164
1170
  i(""), a.invalidateQueries({ queryKey: ["revision-notes", String(e)] });
1165
1171
  },
1166
- onError: () => A.error("Note failed")
1172
+ onError: () => R.error("Note failed")
1167
1173
  });
1168
1174
  return /* @__PURE__ */ l("div", { className: "rounded-md border border-slate-100 bg-slate-50/60 p-2 dark:border-border/60 dark:bg-muted/30", children: [
1169
1175
  o.map((s) => /* @__PURE__ */ l("p", { className: "text-[11.5px] text-slate-600 dark:text-slate-300", children: [
@@ -1207,12 +1213,12 @@ function lt({ revisionId: e }) {
1207
1213
  )
1208
1214
  ] });
1209
1215
  }
1210
- function it({
1216
+ function dt({
1211
1217
  revisions: e,
1212
1218
  meta: r
1213
1219
  }) {
1214
1220
  const a = [...e].reverse(), [d, i] = k(!1), [o, n] = k(0);
1215
- Te(() => {
1221
+ Re(() => {
1216
1222
  if (!d) return;
1217
1223
  if (o >= a.length - 1) {
1218
1224
  i(!1);
@@ -1267,5 +1273,5 @@ function it({
1267
1273
  ] });
1268
1274
  }
1269
1275
  export {
1270
- wt as RevisionsPanel
1276
+ Ct as RevisionsPanel
1271
1277
  };