@nivaro/react 0.3.17 → 0.3.19

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 +54 -1
  4. package/dist/index.js +243 -240
  5. package/dist/shared/components/CollectionBrowserView.js +439 -438
  6. package/dist/shared/components/ItemEditForm.js +3758 -3708
  7. package/dist/shared/components/ProfileView.js +38 -23
  8. package/dist/shared/components/RecordReadView.js +452 -430
  9. package/dist/shared/components/bulk/BulkActionButtons.js +113 -106
  10. package/dist/shared/components/chat/ChannelArchive.js +16 -17
  11. package/dist/shared/components/chat/ChatPanel.js +992 -930
  12. package/dist/shared/components/chat/Composer.js +307 -303
  13. package/dist/shared/components/chat/chat-core.js +8 -4
  14. package/dist/shared/components/chat/chat-drafts.js +60 -43
  15. package/dist/shared/components/help-videos/api.js +3 -0
  16. package/dist/shared/components/help-videos/library/HelpVideoLibrary.js +225 -177
  17. package/dist/shared/components/item-edit/InlineTableField.js +159 -158
  18. package/dist/shared/components/item-edit/RecordLiveSync.js +169 -155
  19. package/dist/shared/components/item-edit/RelationCombobox.js +274 -247
  20. package/dist/shared/components/item-edit/RowHistorySheet.js +62 -62
  21. package/dist/shared/components/item-edit/picker-search.js +28 -0
  22. package/dist/shared/components/panels/RevisionsPanel.js +268 -260
  23. package/dist/shared/components/profile/BrowserPushCard.js +135 -89
  24. package/dist/shared/components/profile/push-failure.js +76 -0
  25. package/dist/shared/lib/display-prefs.js +90 -0
  26. package/dist/shared/lib/theme-accents.js +21 -16
  27. package/package.json +1 -1
@@ -1,23 +1,23 @@
1
1
  import { jsxs as l, jsx as t, Fragment as T } from "react/jsx-runtime";
2
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";
3
+ import { Clock as Q, Search as Ne, X as ke, CalendarClock as ve, GitCompareArrows as we, ChevronDown as Se, ChevronRight as Ce, MessageSquare as _e, RotateCcw as de, ArrowRight as Te } from "lucide-react";
4
+ import { useState as k, useRef as Re, useMemo as j, useEffect as je } from "react";
5
5
  import { toast as R } from "sonner";
6
6
  import { useNivaroClient as D } from "../../context.js";
7
- import { get as F, post as K } from "../../lib/commands.js";
8
- import { useLiveRecordQueries as je } from "../../lib/live.js";
7
+ import { get as q, post as K } from "../../lib/commands.js";
8
+ import { useLiveRecordQueries as Ae } from "../../lib/live.js";
9
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";
10
+ import { cn as _, titleCase as oe, toLocalDateString as $e } from "../../lib/utils.js";
11
+ import { RelatedItemLabel as Le } from "../item-edit/RelationCombobox.js";
12
+ import { UserAvatar as ce } from "../UserAvatar.js";
13
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) => {
14
+ import { Sheet as Oe, SheetTrigger as qe, SheetContent as De, SheetHeader as Fe, SheetTitle as Ee } from "../ui/sheet.js";
15
+ import { Skeleton as Be } from "../ui/skeleton.js";
16
+ import { IntegrationActivitySection as Pe } from "./IntegrationActivitySection.js";
17
+ const Y = (e) => e.id != null && (e.action === "create" || e.action === "update" || e.action === "delete" || e.action === "restore"), Ie = (e) => !Y(e), $ = (e) => {
18
18
  var r;
19
19
  return e.id != null ? `r${e.id}` : `e${((r = e.event) == null ? void 0 : r.history_id) ?? ""}-${e.activity ?? ""}-${e.timestamp ?? ""}`;
20
- }, Pe = /* @__PURE__ */ new Set([
20
+ }, Ke = /* @__PURE__ */ new Set([
21
21
  "id",
22
22
  "created",
23
23
  "changed",
@@ -29,52 +29,53 @@ const Y = (e) => e.id != null && (e.action === "create" || e.action === "update"
29
29
  "updated_at",
30
30
  "sort"
31
31
  ]);
32
- function ce(e, r) {
33
- const a = D(), { data: d } = B({
32
+ function me(e, r) {
33
+ const a = D(), { data: i } = B({
34
34
  queryKey: ["revisions-field-meta", e],
35
35
  enabled: r,
36
36
  staleTime: 3e5,
37
37
  queryFn: async () => {
38
- const [i, o] = await Promise.all([
39
- a.request(F(`/field-config/${e}`)).then((n) => n.data ?? []).catch(() => []),
38
+ const [d, o] = await Promise.all([
39
+ a.request(q(`/field-config/${e}`)).then((n) => n.data ?? []).catch(() => []),
40
40
  a.request(
41
- F(`/collections/${e}`)
41
+ q(`/collections/${e}`)
42
42
  ).then((n) => {
43
43
  var s;
44
44
  return ((s = n.data) == null ? void 0 : s.relations) ?? [];
45
45
  }).catch(() => [])
46
46
  ]);
47
- return { fields: i, relations: o };
47
+ return { fields: d, relations: o };
48
48
  }
49
49
  });
50
50
  return j(() => {
51
- const i = /* @__PURE__ */ new Map(), o = (n) => {
52
- const s = ((d == null ? void 0 : d.relations) ?? []).find(
53
- (p) => p.many_collection === e && p.many_field === n && p.junction_field == null
51
+ const d = /* @__PURE__ */ new Map(), o = (n) => {
52
+ const s = ((i == null ? void 0 : i.relations) ?? []).find(
53
+ (m) => m.many_collection === e && m.many_field === n && m.junction_field == null
54
54
  );
55
55
  return s != null && s.one_collection ? s.one_collection === "directus_users" ? "nivaro_users" : s.one_collection : null;
56
56
  };
57
- for (const n of (d == null ? void 0 : d.fields) ?? [])
58
- n.field.startsWith("__") || i.set(n.field, {
59
- label: n.label || de(n.field.replace(/_/g, " ")),
60
- system: Pe.has(n.field),
57
+ for (const n of (i == null ? void 0 : i.fields) ?? [])
58
+ n.field.startsWith("__") || d.set(n.field, {
59
+ label: n.label || oe(n.field.replace(/_/g, " ")),
60
+ system: Ke.has(n.field),
61
61
  // layout_assigned is only stamped when the collection HAS an active
62
62
  // layout — absent means there's no layout to be off of.
63
63
  onLayout: n.layout_assigned !== !1,
64
- relatedCollection: o(n.field)
64
+ relatedCollection: o(n.field),
65
+ dateOnly: String(n.type ?? "").toLowerCase() === "date"
65
66
  });
66
- return i;
67
- }, [d, e]);
67
+ return d;
68
+ }, [i, e]);
68
69
  }
69
70
  function g(e, r) {
70
71
  return e.get(r) ?? {
71
72
  // Unknown to the form = machine column. Still labeled, still reachable.
72
- label: de(r.replace(/[_-]/g, " ")),
73
+ label: oe(r.replace(/[_-]/g, " ")),
73
74
  system: !0,
74
75
  onLayout: !1
75
76
  };
76
77
  }
77
- function Ie({ map: e, field: r }) {
78
+ function Me({ map: e, field: r }) {
78
79
  const a = g(e, r);
79
80
  return /* @__PURE__ */ t(
80
81
  "span",
@@ -86,56 +87,62 @@ function Ie({ map: e, field: r }) {
86
87
  }
87
88
  );
88
89
  }
89
- const Ke = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/;
90
- function Me(e) {
90
+ const se = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/, Ue = /^\d{4}-\d{2}-\d{2}(?:T00:00:00(?:\.0+)?Z)?$/;
91
+ function Ve(e, r = !1) {
91
92
  if (e == null || e === "") return "";
92
93
  if (typeof e == "boolean") return e ? "Yes" : "No";
93
- if (typeof e == "string" && Ke.test(e)) {
94
- const r = new Date(e);
95
- if (!Number.isNaN(r.getTime())) return r.toLocaleString();
94
+ if (typeof e == "string" && (Ue.test(e) || r && se.test(e)))
95
+ return $e(e);
96
+ if (typeof e == "string" && se.test(e)) {
97
+ const a = new Date(e);
98
+ if (!Number.isNaN(a.getTime())) return a.toLocaleString();
96
99
  }
97
100
  return typeof e == "object" ? JSON.stringify(e) : String(e);
98
101
  }
99
102
  function U(e) {
100
103
  return e == null ? "" : typeof e == "object" ? JSON.stringify(e) : String(e);
101
104
  }
102
- function Ue({ collection: e, id: r }) {
103
- const a = D(), { data: d } = B({
105
+ function We({ collection: e, id: r }) {
106
+ const a = D(), { data: i } = B({
104
107
  queryKey: ["col-meta", e],
105
- queryFn: () => a.request(F(`/collections/${e}`)).then((i) => i.data),
108
+ queryFn: () => a.request(q(`/collections/${e}`)).then((d) => d.data),
106
109
  staleTime: 3e5,
107
110
  retry: !1
108
111
  });
109
112
  return /* @__PURE__ */ t("span", { title: `${e} #${String(r)}`, children: /* @__PURE__ */ t(
110
- Ae,
113
+ Le,
111
114
  {
112
115
  collection: e,
113
116
  id: r,
114
- displayTemplate: d == null ? void 0 : d.display_template
117
+ displayTemplate: i == null ? void 0 : i.display_template
115
118
  }
116
119
  ) });
117
120
  }
118
- function Ve(e) {
121
+ function ze(e) {
119
122
  return X(e).join(" ");
120
123
  }
121
- const se = 160;
122
- function ne({ value: e, tone: r }) {
123
- const [a, d] = k(!1), i = Me(e);
124
- if (i === "")
124
+ const ne = 160;
125
+ function le({
126
+ value: e,
127
+ tone: r,
128
+ dateOnly: a
129
+ }) {
130
+ const [i, d] = k(!1), o = Ve(e, a);
131
+ if (o === "")
125
132
  return /* @__PURE__ */ t("span", { className: "text-[11.5px] italic text-slate-300 dark:text-slate-600", children: "empty" });
126
- const o = i.length > se, n = a || !o ? i : `${i.slice(0, se)}…`;
133
+ const n = o.length > ne, s = i || !n ? o : `${o.slice(0, ne)}…`;
127
134
  return /* @__PURE__ */ l("span", { className: "break-words text-[12px] leading-relaxed text-slate-700 dark:text-slate-300", children: [
128
- typeof e == "object" ? /* @__PURE__ */ t("span", { className: "font-mono text-[11px]", children: n }) : n,
129
- o && /* @__PURE__ */ t(
135
+ typeof e == "object" ? /* @__PURE__ */ t("span", { className: "font-mono text-[11px]", children: s }) : s,
136
+ n && /* @__PURE__ */ t(
130
137
  "button",
131
138
  {
132
139
  type: "button",
133
- onClick: () => d((s) => !s),
140
+ onClick: () => d((m) => !m),
134
141
  className: _(
135
142
  "ml-1 text-[10.5px] font-medium hover:underline",
136
143
  r === "before" ? "text-rose-500" : "text-emerald-600"
137
144
  ),
138
- children: a ? "less" : "more"
145
+ children: i ? "less" : "more"
139
146
  }
140
147
  )
141
148
  ] });
@@ -151,27 +158,27 @@ function I(e) {
151
158
  }
152
159
  return null;
153
160
  }
154
- function We({
161
+ function He({
155
162
  before: e,
156
163
  after: r
157
164
  }) {
158
- const d = Array.from(/* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(r)])).sort().map((o) => {
165
+ const i = Array.from(/* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(r)])).sort().map((o) => {
159
166
  const n = o in e ? JSON.stringify(e[o]) : void 0, s = o in r ? JSON.stringify(r[o]) : void 0;
160
167
  return n === s ? null : { k: o, b: n, a: s };
161
168
  }).filter(Boolean);
162
- if (d.length === 0)
169
+ if (i.length === 0)
163
170
  return /* @__PURE__ */ t("span", { className: "text-[11px] italic text-slate-400", children: "keys reordered only" });
164
- const i = (o) => o == null ? void 0 : o.length > 80 ? `${o.slice(0, 80)}…` : o;
165
- return /* @__PURE__ */ t("div", { className: "space-y-0.5", "data-json-diff": !0, children: d.map(({ k: o, b: n, a: s }) => /* @__PURE__ */ l("p", { className: "text-[11.5px]", children: [
171
+ const d = (o) => o == null ? void 0 : o.length > 80 ? `${o.slice(0, 80)}…` : o;
172
+ return /* @__PURE__ */ t("div", { className: "space-y-0.5", "data-json-diff": !0, children: i.map(({ k: o, b: n, a: s }) => /* @__PURE__ */ l("p", { className: "text-[11.5px]", children: [
166
173
  /* @__PURE__ */ t("span", { className: "font-mono text-[10.5px] text-slate-500", children: o }),
167
174
  ":",
168
175
  " ",
169
- n !== void 0 && /* @__PURE__ */ t("span", { className: "text-rose-600 line-through dark:text-rose-400", children: i(n) }),
176
+ n !== void 0 && /* @__PURE__ */ t("span", { className: "text-rose-600 line-through dark:text-rose-400", children: d(n) }),
170
177
  n !== void 0 && s !== void 0 && " → ",
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)" })
178
+ s !== void 0 ? /* @__PURE__ */ t("span", { className: "text-emerald-700 dark:text-emerald-400", children: d(s) }) : /* @__PURE__ */ t("span", { className: "italic text-slate-400", children: " (removed)" })
172
179
  ] }, o)) });
173
180
  }
174
- function ze({ field: e, ctl: r }) {
181
+ function Je({ field: e, ctl: r }) {
175
182
  return r.confirmField === e ? /* @__PURE__ */ l("span", { className: "inline-flex items-center gap-1", "data-revert-field-confirm": e, children: [
176
183
  /* @__PURE__ */ t("span", { className: "text-[10.5px] text-slate-500", children: "Revert?" }),
177
184
  /* @__PURE__ */ t(
@@ -202,7 +209,7 @@ function ze({ field: e, ctl: r }) {
202
209
  title: "Set the field back to this revision’s value",
203
210
  "data-revert-field": e,
204
211
  children: [
205
- /* @__PURE__ */ t(ie, { className: "h-3 w-3" }),
212
+ /* @__PURE__ */ t(de, { className: "h-3 w-3" }),
206
213
  "Revert"
207
214
  ]
208
215
  }
@@ -214,43 +221,43 @@ function G(e) {
214
221
  function X(e) {
215
222
  return String(e ?? "").replace(/<[^>]*>/g, " ").replace(/&nbsp;/g, " ").replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").split(/\s+/).filter(Boolean);
216
223
  }
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));
224
+ function Qe(e, r) {
225
+ const i = X(e).slice(0, 600), d = X(r).slice(0, 600), o = i.length, n = d.length, s = Array.from({ length: o + 1 }, () => new Array(n + 1).fill(0));
219
226
  for (let y = o - 1; y >= 0; y--)
220
227
  for (let c = n - 1; c >= 0; c--)
221
- s[y][c] = d[y] === i[c] ? s[y + 1][c + 1] + 1 : Math.max(s[y + 1][c], s[y][c + 1]);
222
- const p = [], x = (y, c) => {
223
- const u = p[p.length - 1];
224
- u && u.type === y ? u.text += ` ${c}` : p.push({ text: c, type: y });
228
+ s[y][c] = i[y] === d[c] ? s[y + 1][c + 1] + 1 : Math.max(s[y + 1][c], s[y][c + 1]);
229
+ const m = [], x = (y, c) => {
230
+ const u = m[m.length - 1];
231
+ u && u.type === y ? u.text += ` ${c}` : m.push({ text: c, type: y });
225
232
  };
226
- let m = 0, h = 0;
227
- for (; m < o && h < n; )
228
- d[m] === i[h] ? (x("same", d[m]), m++, h++) : s[m + 1][h] >= s[m][h + 1] ? (x("del", d[m]), m++) : (x("ins", i[h]), h++);
229
- for (; m < o; ) x("del", d[m++]);
230
- for (; h < n; ) x("ins", i[h++]);
231
- return p;
233
+ let p = 0, h = 0;
234
+ for (; p < o && h < n; )
235
+ i[p] === d[h] ? (x("same", i[p]), p++, h++) : s[p + 1][h] >= s[p][h + 1] ? (x("del", i[p]), p++) : (x("ins", d[h]), h++);
236
+ for (; p < o; ) x("del", i[p++]);
237
+ for (; h < n; ) x("ins", d[h++]);
238
+ return m;
232
239
  }
233
- function Je({ before: e, after: r }) {
234
- const a = He(e, r);
240
+ function Ye({ before: e, after: r }) {
241
+ const a = Qe(e, r);
235
242
  return /* @__PURE__ */ t("p", { className: "whitespace-pre-wrap break-words text-[12px] leading-relaxed text-slate-700 dark:text-slate-300", children: a.map(
236
- (d, i) => d.type === "same" ? (
243
+ (i, d) => i.type === "same" ? (
237
244
  // biome-ignore lint/suspicious/noArrayIndexKey: static segment list
238
245
  /* @__PURE__ */ l("span", { children: [
239
- d.text,
246
+ i.text,
240
247
  " "
241
- ] }, i)
242
- ) : d.type === "del" ? (
248
+ ] }, d)
249
+ ) : i.type === "del" ? (
243
250
  // biome-ignore lint/suspicious/noArrayIndexKey: static segment list
244
251
  /* @__PURE__ */ l(
245
252
  "del",
246
253
  {
247
254
  className: "rounded bg-red-100 px-0.5 text-red-700 no-underline line-through dark:bg-red-900/40 dark:text-red-400",
248
255
  children: [
249
- d.text,
256
+ i.text,
250
257
  " "
251
258
  ]
252
259
  },
253
- i
260
+ d
254
261
  )
255
262
  ) : (
256
263
  // biome-ignore lint/suspicious/noArrayIndexKey: static segment list
@@ -259,53 +266,53 @@ function Je({ before: e, after: r }) {
259
266
  {
260
267
  className: "rounded bg-emerald-100 px-0.5 text-emerald-700 no-underline dark:bg-emerald-900/40 dark:text-emerald-400",
261
268
  children: [
262
- d.text,
269
+ i.text,
263
270
  " "
264
271
  ]
265
272
  },
266
- i
273
+ d
267
274
  )
268
275
  )
269
276
  ) });
270
277
  }
271
- const Qe = {
278
+ const Ge = {
272
279
  added: "bg-emerald-100 text-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-400",
273
280
  removed: "bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-400",
274
281
  changed: "bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-400"
275
282
  };
276
- function Ye(e, r, a) {
277
- const d = Array.from(/* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(r)])), i = (s) => s == null || s === "", o = d.map((s) => {
278
- const p = !(s in e) || i(e[s]), x = !(s in r) || i(r[s]);
279
- if (p && x) return null;
280
- const m = p ? "added" : x ? "removed" : U(e[s]) !== U(r[s]) ? "changed" : "unchanged";
283
+ function Xe(e, r, a) {
284
+ const i = Array.from(/* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(r)])), d = (s) => s == null || s === "", o = i.map((s) => {
285
+ const m = !(s in e) || d(e[s]), x = !(s in r) || d(r[s]);
286
+ if (m && x) return null;
287
+ const p = m ? "added" : x ? "removed" : U(e[s]) !== U(r[s]) ? "changed" : "unchanged";
281
288
  return {
282
289
  field: s,
283
- status: m,
290
+ status: p,
284
291
  before: e[s],
285
292
  after: r[s],
286
293
  system: g(a, s).system
287
294
  };
288
295
  }).filter(Boolean), n = (s) => {
289
- const p = g(a, s.field);
290
- return (p.system ? 8 : p.onLayout ? 0 : 4) + (s.status === "unchanged" ? 2 : 0);
296
+ const m = g(a, s.field);
297
+ return (m.system ? 8 : m.onLayout ? 0 : 4) + (s.status === "unchanged" ? 2 : 0);
291
298
  };
292
299
  return o.sort(
293
- (s, p) => n(s) - n(p) || g(a, s.field).label.localeCompare(g(a, p.field).label)
300
+ (s, m) => n(s) - n(m) || g(a, s.field).label.localeCompare(g(a, m.field).label)
294
301
  );
295
302
  }
296
- function L({
303
+ function O({
297
304
  value: e,
298
305
  meta: r,
299
306
  tone: a
300
307
  }) {
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 });
308
+ 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(We, { collection: r.relatedCollection, id: e }) }) : G(e) ? /* @__PURE__ */ t(le, { value: ze(e), tone: a }) : /* @__PURE__ */ t(le, { value: e, tone: a, dateOnly: r.dateOnly });
302
309
  }
303
- function Ge({
310
+ function Ze({
304
311
  row: e,
305
312
  meta: r,
306
313
  fieldRevert: a,
307
- mode: d,
308
- hideStatusChips: i
314
+ mode: i,
315
+ hideStatusChips: d
309
316
  }) {
310
317
  const o = e.status === "changed" && (G(e.before) || G(e.after)), n = e.status === "changed" && I(e.before) && I(e.after);
311
318
  return /* @__PURE__ */ l(
@@ -318,63 +325,63 @@ function Ge({
318
325
  "data-field-row": e.field,
319
326
  children: [
320
327
  /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
321
- /* @__PURE__ */ t(Ie, { map: r, field: e.field }),
322
- e.status !== "unchanged" && !i && /* @__PURE__ */ t(
328
+ /* @__PURE__ */ t(Me, { map: r, field: e.field }),
329
+ e.status !== "unchanged" && !d && /* @__PURE__ */ t(
323
330
  "span",
324
331
  {
325
332
  className: _(
326
333
  "rounded px-1 py-px text-[9px] font-semibold uppercase tracking-wide",
327
- Qe[e.status]
334
+ Ge[e.status]
328
335
  ),
329
336
  children: e.status === "added" ? "set" : e.status
330
337
  }
331
338
  ),
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 }) })
339
+ (e.status === "changed" || i === "changes" && e.status === "added") && a && e.field !== "id" && /* @__PURE__ */ t("span", { className: "ml-auto shrink-0", children: /* @__PURE__ */ t(Je, { field: e.field, ctl: a }) })
333
340
  ] }),
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,
341
+ /* @__PURE__ */ t("div", { className: "mt-1", children: o ? /* @__PURE__ */ t("div", { "data-richtext-diff": !0, children: /* @__PURE__ */ t(Ye, { before: e.before, after: e.after }) }) : n ? /* @__PURE__ */ t(
342
+ He,
336
343
  {
337
344
  before: I(e.before),
338
345
  after: I(e.after)
339
346
  }
340
347
  ) : e.status === "changed" || e.status === "removed" ? /* @__PURE__ */ l("div", { className: "flex flex-wrap items-baseline gap-x-2 gap-y-0.5", children: [
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" }) }),
342
- /* @__PURE__ */ t(_e, { className: "h-3 w-3 shrink-0 self-center text-slate-300 dark:text-slate-600" }),
343
- /* @__PURE__ */ t(L, { value: e.after, meta: g(r, e.field), tone: "after" })
344
- ] }) : /* @__PURE__ */ t(L, { value: e.after ?? e.before, meta: g(r, e.field), tone: "after" }) })
348
+ /* @__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(O, { value: e.before, meta: g(r, e.field), tone: "before" }) }),
349
+ /* @__PURE__ */ t(Te, { className: "h-3 w-3 shrink-0 self-center text-slate-300 dark:text-slate-600" }),
350
+ /* @__PURE__ */ t(O, { value: e.after, meta: g(r, e.field), tone: "after" })
351
+ ] }) : /* @__PURE__ */ t(O, { value: e.after ?? e.before, meta: g(r, e.field), tone: "after" }) })
345
352
  ]
346
353
  }
347
354
  );
348
355
  }
349
- function Xe({
356
+ function et({
350
357
  before: e,
351
358
  after: r,
352
359
  meta: a,
353
- fieldRevert: d,
354
- mode: i,
360
+ fieldRevert: i,
361
+ mode: d,
355
362
  hideStatusChips: o
356
363
  }) {
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;
364
+ const [n, s] = k(!1), m = j(() => Xe(e, r, a), [e, r, a]), x = d === "changes" ? m.filter((u) => u.status !== "unchanged") : m, p = n ? x : x.filter((u) => !u.system), h = x.length - p.length;
358
365
  if (x.length === 0)
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." });
360
- const y = m.findIndex(
366
+ return /* @__PURE__ */ t("p", { className: "px-3 py-3 text-[12px] text-slate-400", children: d === "changes" ? "No field changes recorded." : "No snapshot data available." });
367
+ const y = p.findIndex(
361
368
  (u) => !g(a, u.field).onLayout && !g(a, u.field).system
362
- ), c = m.some(
369
+ ), c = p.some(
363
370
  (u) => g(a, u.field).onLayout && !g(a, u.field).system
364
371
  );
365
372
  return /* @__PURE__ */ l("div", { className: "overflow-hidden rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: [
366
- m.map((u, b) => /* @__PURE__ */ l("div", { children: [
373
+ p.map((u, b) => /* @__PURE__ */ l("div", { children: [
367
374
  b === y && 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: [
368
375
  /* @__PURE__ */ t("p", { className: "text-[10.5px] font-semibold uppercase tracking-wide text-slate-400", children: "Behind the scenes" }),
369
376
  /* @__PURE__ */ t("p", { className: "text-[10.5px] text-slate-400", children: "Not on the form — written automatically by rules, computed fields or integrations." })
370
377
  ] }),
371
378
  /* @__PURE__ */ t(
372
- Ge,
379
+ Ze,
373
380
  {
374
381
  row: u,
375
382
  meta: a,
376
- fieldRevert: d,
377
- mode: i,
383
+ fieldRevert: i,
384
+ mode: d,
378
385
  hideStatusChips: o
379
386
  }
380
387
  )
@@ -406,7 +413,7 @@ function Xe({
406
413
  )
407
414
  ] });
408
415
  }
409
- const Ze = {
416
+ const tt = {
410
417
  create: "bg-emerald-500",
411
418
  restore: "bg-emerald-500",
412
419
  update: "bg-nvr-cyan",
@@ -416,12 +423,12 @@ function E(e) {
416
423
  var r;
417
424
  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";
418
425
  }
419
- function et(e, r, a) {
426
+ function at(e, r, a) {
420
427
  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";
421
428
  }
422
- function tt({ revision: e, isLast: r }) {
423
- var p, x, m;
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);
429
+ function rt({ revision: e, isLast: r }) {
430
+ var m, x, p;
431
+ const a = e.event, i = (a == null ? void 0 : a.source) === "auto" || !e.user_id && (a == null ? void 0 : a.kind) === "transition", d = !i && ((m = a == null ? void 0 : a.on_behalf_of) != null && m.name) ? a.on_behalf_of.name : null, o = i ? "Automatic rule" : d ? `${E(e)}, for ${d}` : E(e);
425
432
  let n;
426
433
  (a == null ? void 0 : a.kind) === "transition" && a.addendum ? n = /* @__PURE__ */ l(T, { children: [
427
434
  "moved",
@@ -482,7 +489,7 @@ function tt({ revision: e, isLast: r }) {
482
489
  {
483
490
  className: "relative pl-9",
484
491
  "data-revision-event": (a == null ? void 0 : a.kind) ?? e.action ?? "",
485
- "data-revision-on-behalf": i ? (m = a == null ? void 0 : a.on_behalf_of) == null ? void 0 : m.id : void 0,
492
+ "data-revision-on-behalf": d ? (p = a == null ? void 0 : a.on_behalf_of) == null ? void 0 : p.id : void 0,
486
493
  children: [
487
494
  /* @__PURE__ */ t(
488
495
  "span",
@@ -502,8 +509,8 @@ function tt({ revision: e, isLast: r }) {
502
509
  }
503
510
  ),
504
511
  /* @__PURE__ */ l("div", { className: "flex w-full items-start gap-2.5 rounded-md px-2 py-2.5 text-left", children: [
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(
506
- oe,
512
+ 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(
513
+ ce,
507
514
  {
508
515
  userId: e.user_id,
509
516
  className: "h-6 w-6",
@@ -540,43 +547,43 @@ function tt({ revision: e, isLast: r }) {
540
547
  }
541
548
  );
542
549
  }
543
- function at({
550
+ function st({
544
551
  revision: e,
545
552
  previousData: r,
546
553
  meta: a,
547
- onRollback: d,
548
- inlineTableFields: i,
554
+ onRollback: i,
555
+ inlineTableFields: d,
549
556
  isLast: o
550
557
  }) {
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(() => {
558
+ const n = D(), [s, m] = k(!1), [x, p] = 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", L = e.action === "delete", P = L ? e.data ?? {} : S ? {} : r ?? {}, ee = L ? {} : e.data ?? {}, { humanDelta: N, systemDelta: A } = j(() => {
552
559
  const f = e.delta ?? {};
553
- let C = 0, O = 0;
560
+ let C = 0, F = 0;
554
561
  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++);
562
+ const ge = r == null ? void 0 : r[H], ye = (e.data ?? {})[H];
563
+ w && r && U(ge) === U(ye) || (g(a, H).system ? F++ : C++);
557
564
  }
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({
565
+ return { humanDelta: C, systemDelta: F };
566
+ }, [e, r, a, w]), V = w || S, [W, pe] = k(null), ue = Z(), [he, te] = k(null), ae = J({
560
567
  mutationFn: (f) => n.request(K(`/revisions/${e.id}/revert-field`, { field: f })),
561
568
  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();
569
+ te(null), R.success(`Reverted ${g(a, C).label} to this revision's value`), ue.invalidateQueries({ queryKey: ["revisions", e.collection, e.item] }), i == null || i();
563
570
  },
564
571
  onError: () => R.error("Failed to revert field")
565
- }), he = w || S ? {
566
- confirmField: ue,
572
+ }), xe = w || S ? {
573
+ confirmField: he,
567
574
  setConfirmField: te,
568
575
  revert: (f) => ae.mutate(f),
569
576
  pending: ae.isPending
570
577
  } : void 0, z = J({
571
578
  mutationFn: () => n.request(K(`/revisions/${e.id}/rollback`, {})),
572
579
  onSuccess: (f) => {
573
- m(!1), R.success("Rolled back to this revision");
580
+ p(!1), R.success("Rolled back to this revision");
574
581
  const C = re(f);
575
- C && R.warning(C, { duration: 1e4 }), i != null && i.length && e.timestamp && me(e.timestamp), d == null || d();
582
+ C && R.warning(C, { duration: 1e4 }), d != null && d.length && e.timestamp && pe(e.timestamp), i == null || i();
576
583
  },
577
584
  onError: () => R.error("Failed to rollback")
578
585
  });
579
- async function xe(f) {
586
+ async function fe(f) {
580
587
  if (W) {
581
588
  v(f.field);
582
589
  try {
@@ -589,8 +596,8 @@ function at({
589
596
  })
590
597
  );
591
598
  R.success(`Restored ${f.label}`);
592
- const O = re(C);
593
- O && R.warning(O, { duration: 1e4 });
599
+ const F = re(C);
600
+ F && R.warning(F, { duration: 1e4 });
594
601
  } catch {
595
602
  R.error(`Failed to restore ${f.label}`);
596
603
  } finally {
@@ -598,14 +605,14 @@ function at({
598
605
  }
599
606
  }
600
607
  }
601
- const fe = e.timestamp ? new Date(e.timestamp).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }) : "—";
608
+ const be = e.timestamp ? new Date(e.timestamp).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }) : "—";
602
609
  return /* @__PURE__ */ l("div", { className: "relative pl-9", "data-revision-row": e.id, children: [
603
610
  /* @__PURE__ */ t(
604
611
  "span",
605
612
  {
606
613
  className: _(
607
614
  "absolute left-[11px] top-[18px] h-2.5 w-2.5 rounded-full ring-4 ring-white dark:ring-card",
608
- Ze[e.action ?? ""] ?? "bg-slate-300"
615
+ tt[e.action ?? ""] ?? "bg-slate-300"
609
616
  ),
610
617
  "aria-hidden": !0
611
618
  }
@@ -621,11 +628,11 @@ function at({
621
628
  "button",
622
629
  {
623
630
  type: "button",
624
- onClick: () => p((f) => !f),
631
+ onClick: () => m((f) => !f),
625
632
  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",
626
633
  children: [
627
634
  /* @__PURE__ */ t(
628
- oe,
635
+ ce,
629
636
  {
630
637
  userId: e.user_id,
631
638
  className: "h-6 w-6",
@@ -635,17 +642,17 @@ function at({
635
642
  /* @__PURE__ */ l("span", { className: "min-w-0 flex-1 truncate text-[12.5px] text-slate-700 dark:text-slate-200", children: [
636
643
  /* @__PURE__ */ t("span", { className: "font-medium", children: E(e) }),
637
644
  " ",
638
- /* @__PURE__ */ t("span", { className: "text-slate-500 dark:text-slate-400", children: et(e, N, A) })
645
+ /* @__PURE__ */ t("span", { className: "text-slate-500 dark:text-slate-400", children: at(e, N, A) })
639
646
  ] }),
640
647
  /* @__PURE__ */ t(
641
648
  "span",
642
649
  {
643
650
  className: "shrink-0 text-[11px] tabular-nums text-slate-400",
644
651
  title: e.timestamp ? new Date(e.timestamp).toLocaleString() : void 0,
645
- children: fe
652
+ children: be
646
653
  }
647
654
  ),
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" })
655
+ s ? /* @__PURE__ */ t(Se, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }) : /* @__PURE__ */ t(Ce, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
649
656
  ]
650
657
  }
651
658
  ),
@@ -678,7 +685,7 @@ function at({
678
685
  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"
679
686
  ),
680
687
  children: [
681
- /* @__PURE__ */ t(Ce, { className: "h-3 w-3" }),
688
+ /* @__PURE__ */ t(_e, { className: "h-3 w-3" }),
682
689
  "Notes"
683
690
  ]
684
691
  }
@@ -702,7 +709,7 @@ function at({
702
709
  size: "sm",
703
710
  variant: "outline",
704
711
  className: "h-6 text-[11px]",
705
- onClick: () => m(!1),
712
+ onClick: () => p(!1),
706
713
  children: "Cancel"
707
714
  }
708
715
  )
@@ -713,38 +720,38 @@ function at({
713
720
  variant: "outline",
714
721
  className: "h-6 gap-1 text-[11px]",
715
722
  disabled: z.isPending,
716
- onClick: () => m(!0),
723
+ onClick: () => p(!0),
717
724
  title: "Set the whole record back to how it looked after this save",
718
725
  children: [
719
- /* @__PURE__ */ t(ie, { className: "h-3 w-3" }),
726
+ /* @__PURE__ */ t(de, { className: "h-3 w-3" }),
720
727
  "Restore this version"
721
728
  ]
722
729
  }
723
730
  ))
724
731
  ] })
725
732
  ] }),
726
- c && /* @__PURE__ */ t(it, { revisionId: e.id ?? "" }),
733
+ c && /* @__PURE__ */ t(ot, { revisionId: e.id ?? "" }),
727
734
  /* @__PURE__ */ t(
728
- Xe,
735
+ et,
729
736
  {
730
737
  before: P,
731
738
  after: ee,
732
739
  meta: a,
733
- fieldRevert: he,
740
+ fieldRevert: xe,
734
741
  mode: h,
735
742
  hideStatusChips: S
736
743
  }
737
744
  ),
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: [
745
+ W && d && d.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: [
739
746
  /* @__PURE__ */ t("p", { className: "text-[10.5px] font-medium text-slate-500", children: "Also restore related rows?" }),
740
- i.map((f) => /* @__PURE__ */ l("div", { className: "flex items-center justify-between gap-2", children: [
747
+ d.map((f) => /* @__PURE__ */ l("div", { className: "flex items-center justify-between gap-2", children: [
741
748
  /* @__PURE__ */ t("span", { className: "text-[11.5px] text-slate-600 dark:text-slate-300", children: f.label }),
742
749
  /* @__PURE__ */ t(
743
750
  "button",
744
751
  {
745
752
  type: "button",
746
753
  disabled: b === f.field,
747
- onClick: () => xe(f),
754
+ onClick: () => fe(f),
748
755
  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",
749
756
  children: b === f.field ? "Restoring…" : "Restore"
750
757
  }
@@ -754,39 +761,39 @@ function at({
754
761
  ] })
755
762
  ] });
756
763
  }
757
- function rt({ data: e, meta: r }) {
758
- const [a, d] = k(null), [i, o] = k(""), [n, s] = k(""), [p, x] = k(""), m = j(() => {
759
- if (!i || !e) return null;
760
- const c = (/* @__PURE__ */ new Date(`${i}T23:59:59`)).getTime();
764
+ function nt({ data: e, meta: r }) {
765
+ const [a, i] = k(null), [d, o] = k(""), [n, s] = k(""), [m, x] = k(""), p = j(() => {
766
+ if (!d || !e) return null;
767
+ const c = (/* @__PURE__ */ new Date(`${d}T23:59:59`)).getTime();
761
768
  return e.find((u) => u.timestamp && new Date(u.timestamp).getTime() <= c) ?? null;
762
- }, [i, e]), h = j(() => {
763
- if (!n || !p || !e) return null;
764
- const c = (/* @__PURE__ */ new Date(`${n}T23:59:59`)).getTime(), u = (/* @__PURE__ */ new Date(`${p}T23:59:59`)).getTime();
769
+ }, [d, e]), h = j(() => {
770
+ if (!n || !m || !e) return null;
771
+ const c = (/* @__PURE__ */ new Date(`${n}T23:59:59`)).getTime(), u = (/* @__PURE__ */ new Date(`${m}T23:59:59`)).getTime();
765
772
  if (u <= c) return { error: "The second date must be after the first" };
766
773
  const b = (N) => e.find((A) => A.timestamp && new Date(A.timestamp).getTime() <= N) ?? null, v = b(c), w = b(u);
767
774
  if (!w) return { error: "No snapshot exists at or before the second date" };
768
- const S = (v == null ? void 0 : v.data) ?? {}, q = w.data ?? {}, P = /* @__PURE__ */ new Map();
775
+ const S = (v == null ? void 0 : v.data) ?? {}, L = w.data ?? {}, P = /* @__PURE__ */ new Map();
769
776
  for (const N of [...e].reverse()) {
770
777
  const A = N.timestamp ? new Date(N.timestamp).getTime() : 0;
771
778
  if (!(A <= c || A > u || !N.delta))
772
779
  for (const V of Object.keys(N.delta))
773
780
  P.set(V, { name: E(N), when: N.timestamp });
774
781
  }
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 })) };
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";
782
+ return { fields: [.../* @__PURE__ */ new Set([...Object.keys(S), ...Object.keys(L)])].filter((N) => String(S[N] ?? "") !== String(L[N] ?? "")).map((N) => ({ field: N, from: S[N], to: L[N], by: P.get(N) ?? null })) };
783
+ }, [n, m, e]), y = "h-7 rounded-md border border-slate-200 bg-white px-2 text-[12px] dark:border-border dark:bg-card";
777
784
  return /* @__PURE__ */ l("div", { className: "space-y-2", children: [
778
785
  /* @__PURE__ */ l("div", { className: "flex items-center gap-1.5", children: [
779
786
  /* @__PURE__ */ l(
780
787
  "button",
781
788
  {
782
789
  type: "button",
783
- onClick: () => d(a === "asof" ? null : "asof"),
790
+ onClick: () => i(a === "asof" ? null : "asof"),
784
791
  className: _(
785
792
  "inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1 text-[11.5px] transition-colors",
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"
793
+ a === "asof" || d ? "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"
787
794
  ),
788
795
  children: [
789
- /* @__PURE__ */ t(ke, { className: "h-3.5 w-3.5" }),
796
+ /* @__PURE__ */ t(ve, { className: "h-3.5 w-3.5" }),
790
797
  "View as of a date"
791
798
  ]
792
799
  }
@@ -795,13 +802,13 @@ function rt({ data: e, meta: r }) {
795
802
  "button",
796
803
  {
797
804
  type: "button",
798
- onClick: () => d(a === "compare" ? null : "compare"),
805
+ onClick: () => i(a === "compare" ? null : "compare"),
799
806
  className: _(
800
807
  "inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1 text-[11.5px] transition-colors",
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"
808
+ a === "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"
802
809
  ),
803
810
  children: [
804
- /* @__PURE__ */ t(ve, { className: "h-3.5 w-3.5" }),
811
+ /* @__PURE__ */ t(we, { className: "h-3.5 w-3.5" }),
805
812
  "Compare two dates"
806
813
  ]
807
814
  }
@@ -814,14 +821,14 @@ function rt({ data: e, meta: r }) {
814
821
  "input",
815
822
  {
816
823
  type: "date",
817
- value: i,
824
+ value: d,
818
825
  onChange: (c) => o(c.target.value),
819
826
  className: y,
820
827
  "aria-label": "View record as of date",
821
828
  "data-as-of": !0
822
829
  }
823
830
  ),
824
- i && /* @__PURE__ */ t(
831
+ d && /* @__PURE__ */ t(
825
832
  "button",
826
833
  {
827
834
  type: "button",
@@ -831,14 +838,14 @@ function rt({ data: e, meta: r }) {
831
838
  }
832
839
  )
833
840
  ] }),
834
- i && !m && /* @__PURE__ */ t("p", { className: "mt-2 text-[12px] text-slate-400", children: "No snapshot exists at or before that date — the record is newer." }),
835
- m && /* @__PURE__ */ l("div", { className: "mt-2 overflow-hidden rounded-lg border border-nvr-cyan/40 bg-white dark:bg-card", children: [
841
+ d && !p && /* @__PURE__ */ t("p", { className: "mt-2 text-[12px] text-slate-400", children: "No snapshot exists at or before that date — the record is newer." }),
842
+ p && /* @__PURE__ */ l("div", { className: "mt-2 overflow-hidden rounded-lg border border-nvr-cyan/40 bg-white dark:bg-card", children: [
836
843
  /* @__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: [
837
844
  "Record as of",
838
845
  " ",
839
- m.timestamp ? new Date(m.timestamp).toLocaleString() : i
846
+ p.timestamp ? new Date(p.timestamp).toLocaleString() : d
840
847
  ] }) }),
841
- /* @__PURE__ */ t("div", { className: "max-h-80 overflow-y-auto", children: Object.entries(m.data ?? {}).filter(([, c]) => c != null && c !== "").sort(([c], [u]) => g(r, c).label.localeCompare(g(r, u).label)).map(([c, u]) => /* @__PURE__ */ l(
848
+ /* @__PURE__ */ t("div", { className: "max-h-80 overflow-y-auto", children: Object.entries(p.data ?? {}).filter(([, c]) => c != null && c !== "").sort(([c], [u]) => g(r, c).label.localeCompare(g(r, u).label)).map(([c, u]) => /* @__PURE__ */ l(
842
849
  "div",
843
850
  {
844
851
  className: "flex items-start gap-3 border-b border-slate-100 px-2.5 py-1.5 last:border-0 dark:border-border/60",
@@ -851,7 +858,7 @@ function rt({ data: e, meta: r }) {
851
858
  children: g(r, c).label
852
859
  }
853
860
  ),
854
- /* @__PURE__ */ t("span", { className: "break-words text-[11.5px] text-slate-700 dark:text-slate-300", children: /* @__PURE__ */ t(L, { value: u, meta: g(r, c), tone: "after" }) })
861
+ /* @__PURE__ */ t("span", { className: "break-words text-[11.5px] text-slate-700 dark:text-slate-300", children: /* @__PURE__ */ t(O, { value: u, meta: g(r, c), tone: "after" }) })
855
862
  ]
856
863
  },
857
864
  c
@@ -877,14 +884,14 @@ function rt({ data: e, meta: r }) {
877
884
  "input",
878
885
  {
879
886
  type: "date",
880
- value: p,
887
+ value: m,
881
888
  onChange: (c) => x(c.target.value),
882
889
  className: y,
883
890
  "aria-label": "Compare to date",
884
891
  "data-diff-to": !0
885
892
  }
886
893
  ),
887
- (n || p) && /* @__PURE__ */ t(
894
+ (n || m) && /* @__PURE__ */ t(
888
895
  "button",
889
896
  {
890
897
  type: "button",
@@ -911,7 +918,7 @@ function rt({ data: e, meta: r }) {
911
918
  n,
912
919
  " and",
913
920
  " ",
914
- p
921
+ m
915
922
  ] }) }),
916
923
  h.fields.length === 0 ? /* @__PURE__ */ t("p", { className: "px-2.5 py-3 text-[12px] text-slate-400", children: "Nothing changed in that window." }) : /* @__PURE__ */ t("div", { className: "max-h-80 overflow-y-auto", children: h.fields.map((c) => /* @__PURE__ */ l(
917
924
  "div",
@@ -933,8 +940,8 @@ function rt({ data: e, meta: r }) {
933
940
  ] })
934
941
  ] }),
935
942
  /* @__PURE__ */ l("p", { className: "mt-0.5 flex flex-wrap items-baseline gap-x-2 break-words text-[11.5px]", children: [
936
- /* @__PURE__ */ t("span", { className: "text-red-500 line-through dark:text-red-400", children: /* @__PURE__ */ t(L, { value: c.from, meta: g(r, c.field), tone: "before" }) }),
937
- /* @__PURE__ */ t("span", { className: "text-emerald-600 dark:text-emerald-400", children: /* @__PURE__ */ t(L, { value: c.to, meta: g(r, c.field), tone: "after" }) })
943
+ /* @__PURE__ */ t("span", { className: "text-red-500 line-through dark:text-red-400", children: /* @__PURE__ */ t(O, { value: c.from, meta: g(r, c.field), tone: "before" }) }),
944
+ /* @__PURE__ */ t("span", { className: "text-emerald-600 dark:text-emerald-400", children: /* @__PURE__ */ t(O, { value: c.to, meta: g(r, c.field), tone: "after" }) })
938
945
  ] })
939
946
  ]
940
947
  },
@@ -946,7 +953,7 @@ function rt({ data: e, meta: r }) {
946
953
  ] })
947
954
  ] });
948
955
  }
949
- function st(e) {
956
+ function lt(e) {
950
957
  return e ? new Date(e).toLocaleDateString([], {
951
958
  weekday: "short",
952
959
  month: "short",
@@ -954,19 +961,19 @@ function st(e) {
954
961
  year: "numeric"
955
962
  }) : "Unknown date";
956
963
  }
957
- function nt({
964
+ function it({
958
965
  collection: e,
959
966
  item: r,
960
967
  onRollback: a,
961
- inlineTableFields: d
968
+ inlineTableFields: i
962
969
  }) {
963
- const i = D(), o = ce(e, !0), { data: n, isLoading: s } = B({
970
+ const d = D(), o = me(e, !0), { data: n, isLoading: s } = B({
964
971
  queryKey: ["revisions", e, r],
965
- queryFn: () => i.request(F("/revisions", { collection: e, item: r })).then((u) => u.data ?? []),
972
+ queryFn: () => d.request(q("/revisions", { collection: e, item: r })).then((u) => u.data ?? []),
966
973
  staleTime: 3e4
967
- }), p = Z();
968
- je(e, r, [["revisions", e, r]], { client: p });
969
- const x = Te(null), m = j(() => {
974
+ }), m = Z();
975
+ Ae(e, r, [["revisions", e, r]], { client: m });
976
+ const x = Re(null), p = j(() => {
970
977
  if (!n) return /* @__PURE__ */ new Set();
971
978
  const u = n.map($);
972
979
  if (!x.current)
@@ -976,33 +983,33 @@ function nt({
976
983
  }, [n]), h = (n == null ? void 0 : n.length) ?? 0, y = j(() => (n ?? []).filter(Y), [n]), c = j(() => {
977
984
  const u = [];
978
985
  for (const b of n ?? []) {
979
- const v = st(b.timestamp), w = u[u.length - 1];
986
+ const v = lt(b.timestamp), w = u[u.length - 1];
980
987
  w && w.day === v ? w.revisions.push(b) : u.push({ day: v, revisions: [b] });
981
988
  }
982
989
  return u;
983
990
  }, [n]);
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: [
991
+ return s ? /* @__PURE__ */ t("div", { className: "space-y-2 pt-3", children: [1, 2, 3, 4].map((u) => /* @__PURE__ */ t(Be, { className: "h-11 rounded-md" }, u)) }) : h === 0 ? /* @__PURE__ */ l("div", { className: "flex flex-col items-center py-16 text-center", children: [
985
992
  /* @__PURE__ */ t(Q, { className: "mb-2 h-8 w-8 text-slate-300 dark:text-slate-600" }),
986
993
  /* @__PURE__ */ t("p", { className: "text-[13px] font-medium text-slate-600 dark:text-slate-300", children: "No history yet" }),
987
994
  /* @__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." })
988
995
  ] }) : /* @__PURE__ */ l("div", { className: "space-y-3 pt-3", children: [
989
- /* @__PURE__ */ t(rt, { data: y, meta: o }),
990
- y.length >= 3 && /* @__PURE__ */ t(dt, { revisions: y, meta: o }),
996
+ /* @__PURE__ */ t(nt, { data: y, meta: o }),
997
+ y.length >= 3 && /* @__PURE__ */ t(ct, { revisions: y, meta: o }),
991
998
  /* @__PURE__ */ t("div", { children: c.map((u) => /* @__PURE__ */ l("div", { children: [
992
999
  /* @__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 }) }),
993
1000
  u.revisions.map((b) => {
994
1001
  const v = (n ?? []).indexOf(b), w = v === ((n == null ? void 0 : n.length) ?? 1) - 1;
995
- if (Be(b))
1002
+ if (Ie(b))
996
1003
  return /* @__PURE__ */ l(
997
1004
  "div",
998
1005
  {
999
1006
  className: _(
1000
1007
  "nvr-fade-in relative",
1001
- m.has($(b)) && "rounded-md bg-nvr-cyan/[0.06]"
1008
+ p.has($(b)) && "rounded-md bg-nvr-cyan/[0.06]"
1002
1009
  ),
1003
1010
  children: [
1004
- m.has($(b)) && /* @__PURE__ */ t(le, {}),
1005
- /* @__PURE__ */ t(tt, { revision: b, isLast: w })
1011
+ p.has($(b)) && /* @__PURE__ */ t(ie, {}),
1012
+ /* @__PURE__ */ t(rt, { revision: b, isLast: w })
1006
1013
  ]
1007
1014
  },
1008
1015
  $(b)
@@ -1013,18 +1020,18 @@ function nt({
1013
1020
  {
1014
1021
  className: _(
1015
1022
  "nvr-fade-in relative",
1016
- m.has($(b)) && "rounded-md bg-nvr-cyan/[0.06]"
1023
+ p.has($(b)) && "rounded-md bg-nvr-cyan/[0.06]"
1017
1024
  ),
1018
1025
  children: [
1019
- m.has($(b)) && /* @__PURE__ */ t(le, {}),
1026
+ p.has($(b)) && /* @__PURE__ */ t(ie, {}),
1020
1027
  /* @__PURE__ */ t(
1021
- at,
1028
+ st,
1022
1029
  {
1023
1030
  revision: b,
1024
1031
  previousData: (S == null ? void 0 : S.data) ?? null,
1025
1032
  meta: o,
1026
1033
  onRollback: a,
1027
- inlineTableFields: d,
1034
+ inlineTableFields: i,
1028
1035
  isLast: w
1029
1036
  }
1030
1037
  )
@@ -1036,7 +1043,7 @@ function nt({
1036
1043
  ] }, u.day)) })
1037
1044
  ] });
1038
1045
  }
1039
- function le() {
1046
+ function ie() {
1040
1047
  return (
1041
1048
  // Under the timeline dot, inside the row's 36px gutter.
1042
1049
  /* @__PURE__ */ t(
@@ -1049,17 +1056,17 @@ function le() {
1049
1056
  )
1050
1057
  );
1051
1058
  }
1052
- function Ct({
1059
+ function Tt({
1053
1060
  collection: e,
1054
1061
  item: r,
1055
1062
  onRollback: a,
1056
- triggerClassName: d,
1057
- inlineTableFields: i,
1063
+ triggerClassName: i,
1064
+ inlineTableFields: d,
1058
1065
  open: o,
1059
1066
  onOpenChange: n,
1060
1067
  compact: s
1061
1068
  }) {
1062
- return /* @__PURE__ */ l($e, { open: o, onOpenChange: n, children: [
1069
+ return /* @__PURE__ */ l(Oe, { open: o, onOpenChange: n, children: [
1063
1070
  !(o !== void 0) && /* @__PURE__ */ t(qe, { asChild: !0, children: /* @__PURE__ */ l(
1064
1071
  M,
1065
1072
  {
@@ -1067,51 +1074,51 @@ function Ct({
1067
1074
  size: "sm",
1068
1075
  title: s ? "History — revisions of this record" : void 0,
1069
1076
  "aria-label": "History",
1070
- className: d ?? (s ? "h-8 w-8 rounded-none p-0" : "gap-1.5"),
1077
+ className: i ?? (s ? "h-8 w-8 rounded-none p-0" : "gap-1.5"),
1071
1078
  children: [
1072
1079
  /* @__PURE__ */ t(Q, { className: s ? "h-4 w-4" : "h-3.5 w-3.5" }),
1073
1080
  !s && "History"
1074
1081
  ]
1075
1082
  }
1076
1083
  ) }),
1077
- /* @__PURE__ */ t(Le, { className: "w-[720px] overflow-y-auto p-0 sm:max-w-[92vw]", children: /* @__PURE__ */ l("div", { className: "p-6", children: [
1084
+ /* @__PURE__ */ t(De, { className: "w-[720px] overflow-y-auto p-0 sm:max-w-[92vw]", children: /* @__PURE__ */ l("div", { className: "p-6", children: [
1078
1085
  /* @__PURE__ */ l(Fe, { children: [
1079
- /* @__PURE__ */ l(De, { className: "flex items-center gap-2 text-base", children: [
1086
+ /* @__PURE__ */ l(Ee, { className: "flex items-center gap-2 text-base", children: [
1080
1087
  /* @__PURE__ */ t(Q, { className: "h-4 w-4 text-slate-400" }),
1081
1088
  "Revision history"
1082
1089
  ] }),
1083
1090
  /* @__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." })
1084
1091
  ] }),
1085
- /* @__PURE__ */ t(lt, { collection: e, item: r }),
1086
- /* @__PURE__ */ t(Ee, { collection: e, item: String(r) }),
1092
+ /* @__PURE__ */ t(dt, { collection: e, item: r }),
1093
+ /* @__PURE__ */ t(Pe, { collection: e, item: String(r) }),
1087
1094
  /* @__PURE__ */ t(
1088
- nt,
1095
+ it,
1089
1096
  {
1090
1097
  collection: e,
1091
1098
  item: r,
1092
1099
  onRollback: a,
1093
- inlineTableFields: i
1100
+ inlineTableFields: d
1094
1101
  }
1095
1102
  )
1096
1103
  ] }) })
1097
1104
  ] });
1098
1105
  }
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({
1106
+ function dt({ collection: e, item: r }) {
1107
+ const a = D(), i = me(e, !0), [d, o] = k(""), [n, s] = k(""), { data: m, isFetching: x } = B({
1101
1108
  queryKey: ["rev-value-search", e, r, n],
1102
- queryFn: () => a.request(F("/revisions/value-search", { collection: e, item: r, q: n })).then((m) => m.data),
1109
+ queryFn: () => a.request(q("/revisions/value-search", { collection: e, item: r, q: n })).then((p) => p.data),
1103
1110
  enabled: n.length >= 2
1104
1111
  });
1105
1112
  return /* @__PURE__ */ l("div", { className: "mt-3", children: [
1106
1113
  /* @__PURE__ */ l("div", { className: "relative", children: [
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" }),
1114
+ /* @__PURE__ */ t(Ne, { className: "pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
1108
1115
  /* @__PURE__ */ t(
1109
1116
  "input",
1110
1117
  {
1111
- value: i,
1112
- onChange: (m) => o(m.target.value),
1113
- onKeyDown: (m) => {
1114
- m.key === "Enter" && s(i.trim());
1118
+ value: d,
1119
+ onChange: (p) => o(p.target.value),
1120
+ onKeyDown: (p) => {
1121
+ p.key === "Enter" && s(d.trim());
1115
1122
  },
1116
1123
  placeholder: "Search this record’s history for a value — who wrote it, and when",
1117
1124
  className: "h-8 w-full rounded-md border border-slate-200 bg-background pl-8 pr-8 text-[12.5px] outline-none focus:border-nvr-cyan dark:border-border"
@@ -1126,18 +1133,18 @@ function lt({ collection: e, item: r }) {
1126
1133
  },
1127
1134
  className: "absolute right-2 top-1/2 -translate-y-1/2 text-slate-400 hover:text-slate-600",
1128
1135
  "aria-label": "Clear search",
1129
- children: /* @__PURE__ */ t(Ne, { className: "h-3.5 w-3.5" })
1136
+ children: /* @__PURE__ */ t(ke, { className: "h-3.5 w-3.5" })
1130
1137
  }
1131
1138
  )
1132
1139
  ] }),
1133
- n && /* @__PURE__ */ t("div", { className: "mt-2 space-y-1.5 rounded-lg border border-slate-200 p-2.5 dark:border-border", children: x ? /* @__PURE__ */ t("p", { className: "text-[11.5px] text-slate-400", children: "Searching…" }) : ((p == null ? void 0 : p.matches) ?? []).length === 0 ? /* @__PURE__ */ l("p", { className: "text-[11.5px] text-slate-400", children: [
1140
+ n && /* @__PURE__ */ t("div", { className: "mt-2 space-y-1.5 rounded-lg border border-slate-200 p-2.5 dark:border-border", children: x ? /* @__PURE__ */ t("p", { className: "text-[11.5px] text-slate-400", children: "Searching…" }) : ((m == null ? void 0 : m.matches) ?? []).length === 0 ? /* @__PURE__ */ l("p", { className: "text-[11.5px] text-slate-400", children: [
1134
1141
  "“",
1135
1142
  n,
1136
1143
  "” never appears in this record’s recorded changes."
1137
1144
  ] }) : /* @__PURE__ */ l(T, { children: [
1138
- p == null ? void 0 : p.matches.map((m) => /* @__PURE__ */ l("div", { className: "text-[11.5px]", children: [
1139
- /* @__PURE__ */ t("p", { className: "text-slate-600 dark:text-slate-300", children: m.fields.map((h) => /* @__PURE__ */ l("span", { children: [
1140
- /* @__PURE__ */ t("span", { className: "font-medium", title: h.field, children: g(d, h.field).label }),
1145
+ m == null ? void 0 : m.matches.map((p) => /* @__PURE__ */ l("div", { className: "text-[11.5px]", children: [
1146
+ /* @__PURE__ */ t("p", { className: "text-slate-600 dark:text-slate-300", children: p.fields.map((h) => /* @__PURE__ */ l("span", { children: [
1147
+ /* @__PURE__ */ t("span", { className: "font-medium", title: h.field, children: g(i, h.field).label }),
1141
1148
  " ",
1142
1149
  "→ “",
1143
1150
  h.value.length > 60 ? `${h.value.slice(0, 60)}…` : h.value,
@@ -1145,29 +1152,29 @@ function lt({ collection: e, item: r }) {
1145
1152
  " "
1146
1153
  ] }, h.field)) }),
1147
1154
  /* @__PURE__ */ l("p", { className: "text-[10.5px] text-slate-400", children: [
1148
- m.user_name ?? "System",
1155
+ p.user_name ?? "System",
1149
1156
  " ·",
1150
1157
  " ",
1151
- m.timestamp ? new Date(m.timestamp).toLocaleString() : "",
1158
+ p.timestamp ? new Date(p.timestamp).toLocaleString() : "",
1152
1159
  " · ",
1153
- m.action
1160
+ p.action
1154
1161
  ] })
1155
- ] }, m.revision_id)),
1156
- (p == null ? void 0 : p.truncated) && /* @__PURE__ */ t("p", { className: "text-[10.5px] text-amber-600", children: "Showing the newest 200 matches." })
1162
+ ] }, p.revision_id)),
1163
+ (m == null ? void 0 : m.truncated) && /* @__PURE__ */ t("p", { className: "text-[10.5px] text-amber-600", children: "Showing the newest 200 matches." })
1157
1164
  ] }) })
1158
1165
  ] });
1159
1166
  }
1160
- function it({ revisionId: e }) {
1161
- const r = D(), a = Z(), [d, i] = k(""), { data: o = [] } = B({
1167
+ function ot({ revisionId: e }) {
1168
+ const r = D(), a = Z(), [i, d] = k(""), { data: o = [] } = B({
1162
1169
  queryKey: ["revision-notes", String(e)],
1163
- queryFn: () => r.request(F("/comments", { collection: "nivaro_revisions", item: String(e) })).then((s) => s.data ?? []).catch(() => []),
1170
+ queryFn: () => r.request(q("/comments", { collection: "nivaro_revisions", item: String(e) })).then((s) => s.data ?? []).catch(() => []),
1164
1171
  staleTime: 3e4
1165
1172
  }), n = J({
1166
1173
  mutationFn: () => r.request(
1167
- K("/comments", { collection: "nivaro_revisions", item: String(e), text: d })
1174
+ K("/comments", { collection: "nivaro_revisions", item: String(e), text: i })
1168
1175
  ),
1169
1176
  onSuccess: () => {
1170
- i(""), a.invalidateQueries({ queryKey: ["revision-notes", String(e)] });
1177
+ d(""), a.invalidateQueries({ queryKey: ["revision-notes", String(e)] });
1171
1178
  },
1172
1179
  onError: () => R.error("Note failed")
1173
1180
  });
@@ -1186,20 +1193,20 @@ function it({ revisionId: e }) {
1186
1193
  "form",
1187
1194
  {
1188
1195
  onSubmit: (s) => {
1189
- s.preventDefault(), d.trim() && n.mutate();
1196
+ s.preventDefault(), i.trim() && n.mutate();
1190
1197
  },
1191
1198
  className: "mt-1 flex gap-1.5",
1192
1199
  children: [
1193
1200
  /* @__PURE__ */ t(
1194
1201
  "input",
1195
1202
  {
1196
- value: d,
1197
- onChange: (s) => i(s.target.value),
1203
+ value: i,
1204
+ onChange: (s) => d(s.target.value),
1198
1205
  placeholder: "Annotate this revision…",
1199
1206
  className: "h-6 flex-1 rounded border border-slate-200 bg-transparent px-1.5 text-[11.5px] outline-none dark:border-border"
1200
1207
  }
1201
1208
  ),
1202
- d.trim() && /* @__PURE__ */ t(
1209
+ i.trim() && /* @__PURE__ */ t(
1203
1210
  "button",
1204
1211
  {
1205
1212
  type: "submit",
@@ -1213,21 +1220,21 @@ function it({ revisionId: e }) {
1213
1220
  )
1214
1221
  ] });
1215
1222
  }
1216
- function dt({
1223
+ function ct({
1217
1224
  revisions: e,
1218
1225
  meta: r
1219
1226
  }) {
1220
- const a = [...e].reverse(), [d, i] = k(!1), [o, n] = k(0);
1221
- Re(() => {
1222
- if (!d) return;
1227
+ const a = [...e].reverse(), [i, d] = k(!1), [o, n] = k(0);
1228
+ je(() => {
1229
+ if (!i) return;
1223
1230
  if (o >= a.length - 1) {
1224
- i(!1);
1231
+ d(!1);
1225
1232
  return;
1226
1233
  }
1227
- const x = setTimeout(() => n((m) => m + 1), 1600);
1234
+ const x = setTimeout(() => n((p) => p + 1), 1600);
1228
1235
  return () => clearTimeout(x);
1229
- }, [d, o, a.length]);
1230
- const s = a[o], p = s != null && s.delta ? Object.keys(s.delta).slice(0, 5).map((x) => g(r, x).label) : [];
1236
+ }, [i, o, a.length]);
1237
+ const s = a[o], m = s != null && s.delta ? Object.keys(s.delta).slice(0, 5).map((x) => g(r, x).label) : [];
1231
1238
  return /* @__PURE__ */ l("div", { className: "rounded-md border border-slate-200 bg-slate-50/70 p-2 dark:border-border dark:bg-muted/30", children: [
1232
1239
  /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
1233
1240
  /* @__PURE__ */ t(
@@ -1235,10 +1242,10 @@ function dt({
1235
1242
  {
1236
1243
  type: "button",
1237
1244
  onClick: () => {
1238
- !d && o >= a.length - 1 && n(0), i((x) => !x);
1245
+ !i && o >= a.length - 1 && n(0), d((x) => !x);
1239
1246
  },
1240
1247
  className: "rounded-md bg-nvr-cyan px-2.5 py-1 text-[11.5px] font-semibold text-white",
1241
- children: d ? "Pause" : "▶ Time-lapse"
1248
+ children: i ? "Pause" : "▶ Time-lapse"
1242
1249
  }
1243
1250
  ),
1244
1251
  /* @__PURE__ */ t(
@@ -1249,7 +1256,7 @@ function dt({
1249
1256
  max: Math.max(0, a.length - 1),
1250
1257
  value: o,
1251
1258
  onChange: (x) => {
1252
- i(!1), n(Number(x.target.value));
1259
+ d(!1), n(Number(x.target.value));
1253
1260
  },
1254
1261
  className: "flex-1 accent-nvr-cyan",
1255
1262
  "aria-label": "History position"
@@ -1265,13 +1272,14 @@ function dt({
1265
1272
  /* @__PURE__ */ t("span", { className: "font-medium capitalize", children: s.action ?? "change" }),
1266
1273
  s.timestamp ? ` · ${new Date(s.timestamp).toLocaleString()}` : "",
1267
1274
  s.user_name ? ` · ${s.user_name}` : "",
1268
- p.length > 0 && /* @__PURE__ */ l("span", { className: "ml-1 text-[10.5px] text-slate-400", children: [
1275
+ m.length > 0 && /* @__PURE__ */ l("span", { className: "ml-1 text-[10.5px] text-slate-400", children: [
1269
1276
  "changed: ",
1270
- p.join(", ")
1277
+ m.join(", ")
1271
1278
  ] })
1272
1279
  ] })
1273
1280
  ] });
1274
1281
  }
1275
1282
  export {
1276
- Ct as RevisionsPanel
1283
+ Tt as RevisionsPanel,
1284
+ Ve as displayValue
1277
1285
  };