@nivaro/react 0.3.99 → 0.3.101

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 (60) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useFormSchema.js +82 -85
  3. package/dist/hooks/useSessionRecorder.js +206 -175
  4. package/dist/index.d.ts +84 -16
  5. package/dist/index.js +627 -622
  6. package/dist/lib/commands.js +15 -11
  7. package/dist/shared/components/ActivityEntry.js +5 -5
  8. package/dist/shared/components/CollectionBrowserView.js +516 -503
  9. package/dist/shared/components/ItemEditForm.js +3471 -3465
  10. package/dist/shared/components/JobsTray.js +76 -61
  11. package/dist/shared/components/MyWorkView.js +133 -126
  12. package/dist/shared/components/NotificationBell.js +322 -289
  13. package/dist/shared/components/RecordCompare.js +38 -40
  14. package/dist/shared/components/RecordReadView.js +119 -119
  15. package/dist/shared/components/TipLayer.js +56 -41
  16. package/dist/shared/components/cbv/FoundElsewhere.js +61 -0
  17. package/dist/shared/components/integrations/console/SignalCard.js +40 -40
  18. package/dist/shared/components/integrations/console/drill/SubmissionDrill.js +95 -73
  19. package/dist/shared/components/integrations/console/drill/status.js +23 -18
  20. package/dist/shared/components/item-edit/InlineGridField.js +45 -45
  21. package/dist/shared/components/item-edit/InlineTableField.js +750 -749
  22. package/dist/shared/components/item-edit/QuickPickerDialog.js +44 -44
  23. package/dist/shared/components/item-edit/RawEditSheet.js +122 -114
  24. package/dist/shared/components/item-edit/RecordInsights.js +86 -86
  25. package/dist/shared/components/item-edit/RelationCombobox.js +454 -378
  26. package/dist/shared/components/item-edit/SummaryPanel.js +56 -48
  27. package/dist/shared/components/item-edit/header-path-preview.js +46 -34
  28. package/dist/shared/components/item-edit/related-missing.js +75 -19
  29. package/dist/shared/components/notifications/DeliveryChips.js +1 -2
  30. package/dist/shared/components/notifications/NotificationCenterView.js +249 -226
  31. package/dist/shared/components/panels/AccessDeniedPanel.js +31 -28
  32. package/dist/shared/components/panels/BackgroundMove.js +242 -0
  33. package/dist/shared/components/panels/MoveAdvisory.js +204 -0
  34. package/dist/shared/components/panels/PipelinePanel.js +1459 -1220
  35. package/dist/shared/components/panels/RecordIntegrityBanner.js +113 -112
  36. package/dist/shared/components/profile/ActivityFeedCard.js +322 -0
  37. package/dist/shared/components/profile/DayTimeline.js +145 -140
  38. package/dist/shared/components/profile/PersonAccess.js +679 -383
  39. package/dist/shared/components/profile/PersonActivity.js +404 -427
  40. package/dist/shared/components/profile/PersonDidPanel.js +248 -134
  41. package/dist/shared/components/profile/PersonProfile.js +33 -32
  42. package/dist/shared/components/profile/journey-view.js +166 -0
  43. package/dist/shared/lib/activity-sentence.js +319 -236
  44. package/dist/shared/lib/commands.js +18 -14
  45. package/dist/shared/lib/error-hints.js +1 -1
  46. package/dist/shared/lib/job-failure-text.js +12 -0
  47. package/dist/shared/lib/jobs-tray.js +60 -41
  48. package/dist/shared/lib/move-failure.js +19 -0
  49. package/dist/shared/lib/obligation-banner.js +22 -21
  50. package/dist/shared/lib/partner-failure.js +83 -0
  51. package/dist/shared/lib/prefetch.js +73 -73
  52. package/dist/shared/lib/replay-checkout.js +18 -13
  53. package/dist/shared/lib/replay-context.js +90 -77
  54. package/dist/shared/lib/replay-idle.js +21 -0
  55. package/dist/shared/lib/replay-socket.js +21 -17
  56. package/dist/shared/lib/rum.js +56 -51
  57. package/dist/shared/lib/safe-error.js +17 -13
  58. package/dist/shared/lib/stale-chunk.js +69 -26
  59. package/dist/shared/lib/system-collections.js +20 -0
  60. package/package.json +1 -1
@@ -1,11 +1,11 @@
1
- function R(e) {
1
+ function q(e) {
2
2
  const n = i(e.collection_label) || "related rows", t = i(e.row_label), r = t ? `${n} · ${t}` : n;
3
3
  if (e.verb === "added") return `added ${r}`;
4
4
  if (e.verb === "removed") return `removed ${r}`;
5
5
  const o = (e.changes ?? []).filter((s) => s && i(s.label)).map((s) => `${i(s.label)} ${i(s.from) || "—"} → ${i(s.to) || "—"}`);
6
6
  return o.length ? `changed ${r}: ${o.join(", ")}` : `changed ${r}`;
7
7
  }
8
- const x = "a record you can't see", Y = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, P = {
8
+ const w = "a record you can't see", J = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, U = {
9
9
  ai: "AI",
10
10
  api: "API",
11
11
  csv: "CSV",
@@ -29,33 +29,33 @@ const x = "a record you can't see", Y = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0
29
29
  function i(e) {
30
30
  return e == null ? "" : String(e).trim();
31
31
  }
32
- function Q(e) {
32
+ function oe(e) {
33
33
  return i(e).toUpperCase();
34
34
  }
35
- function T(e) {
35
+ function E(e) {
36
36
  return e.split(/[\s_.:-]+/).map((n) => n.trim()).filter(Boolean);
37
37
  }
38
- function O(e) {
38
+ function z(e) {
39
39
  const n = e.toLowerCase();
40
- return P[n] ?? n;
40
+ return U[n] ?? n;
41
41
  }
42
- function B(e) {
43
- const n = T(e).map(O).join(" ");
42
+ function V(e) {
43
+ const n = E(e).map(z).join(" ");
44
44
  return n ? n.charAt(0).toUpperCase() + n.slice(1) : "";
45
45
  }
46
- function N(e) {
47
- return T(e).map((n) => P[n.toLowerCase()] ?? n.charAt(0).toUpperCase() + n.slice(1).toLowerCase()).join(" ");
46
+ function O(e) {
47
+ return E(e).map((n) => U[n.toLowerCase()] ?? n.charAt(0).toUpperCase() + n.slice(1).toLowerCase()).join(" ");
48
48
  }
49
- function W(e) {
49
+ function K(e) {
50
50
  return /ies$/i.test(e) ? e.replace(/ies$/i, (n) => n === "IES" ? "Y" : "y") : /(ss|us|is)$/i.test(e) ? e : /(x|ch|sh|ss|us)es$/i.test(e) ? e.replace(/es$/i, "") : /s$/i.test(e) && e.length > 1 ? e.slice(0, -1) : e;
51
51
  }
52
- function q(e) {
52
+ function M(e) {
53
53
  return /[^aeiou]y$/i.test(e) ? e.replace(/y$/i, (n) => n === "Y" ? "IES" : "ies") : /(s|x|z|ch|sh)$/i.test(e) && !/^[A-Z0-9]+$/.test(e) ? `${e}es` : `${e}s`;
54
54
  }
55
- function g(e) {
55
+ function _(e) {
56
56
  return e.split(" ").map((n) => /[A-Z][^ ]*[A-Z]/.test(n) ? n : n.toLowerCase()).join(" ");
57
57
  }
58
- const X = {
58
+ const ie = {
59
59
  nivaro_activity: "Activity entry",
60
60
  nivaro_api_keys: "API key",
61
61
  nivaro_approval_chains: "Approval chain",
@@ -80,40 +80,40 @@ const X = {
80
80
  nivaro_webhooks: "Webhook",
81
81
  nivaro_workflow_templates: "Pipeline"
82
82
  };
83
- function j(e, n) {
84
- var f;
83
+ function b(e, n) {
84
+ var l;
85
85
  const t = i(e);
86
86
  if (!t) return { singular: "Record", plural: "Records" };
87
- const r = (f = n == null ? void 0 : n.collections) == null ? void 0 : f[t], o = typeof r == "string" ? { plural: r } : r ?? {}, s = i(o.plural), u = i(o.singular);
88
- if (u || s) {
89
- const $ = u || w(s, W), h = s && s !== $ ? s : w($, q);
90
- return { singular: $, plural: h };
87
+ const r = (l = n == null ? void 0 : n.collections) == null ? void 0 : l[t], o = typeof r == "string" ? { plural: r } : r ?? {}, s = i(o.plural), a = i(o.singular);
88
+ if (a || s) {
89
+ const p = a || A(s, K), $ = s && s !== p ? s : A(p, M);
90
+ return { singular: p, plural: $ };
91
91
  }
92
- const a = X[t];
93
- if (a) return { singular: a, plural: a === "Settings" ? a : w(a, q) };
94
- const c = N(t.replace(/^(nivaro|directus)_/, "")) || "Record", d = w(c, W);
95
- return { singular: d, plural: w(d, q) };
92
+ const c = ie[t];
93
+ if (c) return { singular: c, plural: c === "Settings" ? c : A(c, M) };
94
+ const u = O(t.replace(/^(nivaro|directus)_/, "")) || "Record", d = A(u, K);
95
+ return { singular: d, plural: A(d, M) };
96
96
  }
97
- function w(e, n) {
97
+ function A(e, n) {
98
98
  const t = e.split(" ");
99
99
  return t[t.length - 1] = n(t[t.length - 1] ?? ""), t.join(" ");
100
100
  }
101
- function b(e, n, t) {
102
- const { singular: r, plural: o } = j(n, t);
103
- return `${e} ${g(e === 1 ? r : o)}`;
101
+ function R(e, n, t) {
102
+ const { singular: r, plural: o } = b(n, t);
103
+ return `${e} ${_(e === 1 ? r : o)}`;
104
104
  }
105
- function ee(e, n) {
106
- const t = e.user ?? e.user_id ?? null, r = t ? C(t, n) : null;
105
+ function se(e, n) {
106
+ const t = e.user ?? e.user_id ?? null, r = t ? L(t, n) : null;
107
107
  if (r) return r;
108
108
  const o = [i(e.first_name), i(e.last_name)].filter(Boolean).join(" ");
109
109
  return o || (i(e.user_email) ? i(e.user_email) : null);
110
110
  }
111
- function C(e, n) {
111
+ function L(e, n) {
112
112
  if (!e || !(n != null && n.users)) return null;
113
113
  const t = n.users;
114
- return i(t[e] ?? t[Q(e)] ?? t[i(e).toLowerCase()]) || null;
114
+ return i(t[e] ?? t[oe(e)] ?? t[i(e).toLowerCase()]) || null;
115
115
  }
116
- const ne = /* @__PURE__ */ new Set([
116
+ const ae = /* @__PURE__ */ new Set([
117
117
  "person",
118
118
  "view_as",
119
119
  "api_key",
@@ -123,7 +123,7 @@ const ne = /* @__PURE__ */ new Set([
123
123
  "cron",
124
124
  "system"
125
125
  ]);
126
- function te(e) {
126
+ function ce(e) {
127
127
  if (e == null || e === "") return null;
128
128
  let n = e;
129
129
  if (typeof e == "string")
@@ -134,15 +134,15 @@ function te(e) {
134
134
  }
135
135
  if (!n || typeof n != "object") return null;
136
136
  const t = n, r = i(t.kind);
137
- return ne.has(r) ? {
137
+ return ae.has(r) ? {
138
138
  kind: r,
139
139
  id: t.id == null ? null : String(t.id),
140
140
  name: t.name == null ? null : String(t.name),
141
141
  on_behalf_of: t.on_behalf_of == null ? null : String(t.on_behalf_of)
142
142
  } : null;
143
143
  }
144
- function D(e) {
145
- const n = te(e.actor);
144
+ function W(e) {
145
+ const n = ce(e.actor);
146
146
  if (n) return n;
147
147
  const t = e.user ?? e.user_id ?? null;
148
148
  if (i(e.mcp_conn) || i(e.via_app) || i(e.via_agent))
@@ -163,23 +163,23 @@ function D(e) {
163
163
  };
164
164
  const o = i(e.chain_parent), s = /^(cron|import_run|flow_run):(.+)$/.exec(o);
165
165
  if (s) {
166
- const a = s[1] === "cron" ? "cron" : s[1] === "import_run" ? "import" : "flow";
167
- return { kind: a, id: s[2], name: a === "cron" ? s[2] : null, on_behalf_of: t };
166
+ const c = s[1] === "cron" ? "cron" : s[1] === "import_run" ? "import" : "flow";
167
+ return { kind: c, id: s[2], name: c === "cron" ? s[2] : null, on_behalf_of: t };
168
168
  }
169
- const u = /^import:([^:]+)/i.exec(i(e.comment));
170
- return u ? { kind: "import", id: u[1], name: u[1], on_behalf_of: t } : i(e.origin) === "import" ? { kind: "import", id: null, name: null, on_behalf_of: t } : t ? { kind: "person", id: t, name: null, on_behalf_of: null } : {
169
+ const a = /^import:([^:]+)/i.exec(i(e.comment));
170
+ return a ? { kind: "import", id: a[1], name: a[1], on_behalf_of: t } : i(e.origin) === "import" ? { kind: "import", id: null, name: null, on_behalf_of: t } : t ? { kind: "person", id: t, name: null, on_behalf_of: null } : {
171
171
  kind: "system",
172
172
  id: null,
173
173
  name: i(e.origin) === "integration" ? "An integration" : null
174
174
  };
175
175
  }
176
- function J(e, n) {
177
- const t = D(e), r = ee(e, n), o = C(t.on_behalf_of, n) ?? r;
176
+ function G(e, n) {
177
+ const t = W(e), r = se(e, n), o = L(t.on_behalf_of, n) ?? r;
178
178
  switch (t.kind) {
179
179
  case "person":
180
180
  return r ?? "Someone";
181
181
  case "view_as":
182
- return `${(C(t.id, n) ?? i(t.name) ?? "") || "An administrator"} as ${o ?? "someone"}`;
182
+ return `${(L(t.id, n) ?? i(t.name) ?? "") || "An administrator"} as ${o ?? "someone"}`;
183
183
  case "api_key":
184
184
  return `API key “${i(t.name) || (t.id ? `#${t.id}` : "unnamed")}”`;
185
185
  case "mcp": {
@@ -196,66 +196,66 @@ function J(e, n) {
196
196
  return i(t.name) || "System";
197
197
  }
198
198
  }
199
- function y(e, n, t) {
199
+ function I(e, n, t) {
200
200
  const r = i(n);
201
201
  if (!r || !i(e)) return null;
202
- const o = `${e}:${r}`, s = t == null ? void 0 : t.records, { singular: u } = j(e, t);
202
+ const o = `${e}:${r}`, s = t == null ? void 0 : t.records, { singular: a } = b(e, t);
203
203
  if (s && o in s) {
204
- const a = s[o];
205
- if (a == null) return x;
206
- const c = i(a);
207
- return c ? c.toLowerCase().startsWith(u.toLowerCase()) ? c : `${u} ${c}` : u;
204
+ const c = s[o];
205
+ if (c == null) return w;
206
+ const u = i(c);
207
+ return u ? u.toLowerCase().startsWith(a.toLowerCase()) ? u : `${a} ${u}` : a;
208
208
  }
209
- return Y.test(r) ? `a ${g(u)}` : `${u} ${r}`;
209
+ return J.test(r) ? `a ${_(a)}` : `${a} ${r}`;
210
210
  }
211
- function M(e, n, t) {
211
+ function F(e, n, t) {
212
212
  var o;
213
213
  const r = (o = t == null ? void 0 : t.fields) == null ? void 0 : o[`${e ?? ""}.${n}`];
214
- return i(r) || N(n);
214
+ return i(r) || O(n);
215
215
  }
216
- function I(e, n, t) {
217
- const r = [...new Set(n)].map((o) => M(e, o, t));
216
+ function P(e, n, t) {
217
+ const r = [...new Set(n)].map((o) => F(e, o, t));
218
218
  return r.length === 0 ? "" : r.length === 1 ? r[0] : r.length <= 3 ? `${r.slice(0, -1).join(", ")} and ${r[r.length - 1]}` : `${r.slice(0, 2).join(", ")} and ${r.length - 2} other fields`;
219
219
  }
220
- function re(e) {
220
+ function ue(e) {
221
221
  const n = String(e ?? "");
222
- return n.startsWith("$t:") ? N(n.slice(3).replace(/-/g, "_")) : n;
222
+ return n.startsWith("$t:") ? O(n.slice(3).replace(/-/g, "_")) : n;
223
223
  }
224
- const oe = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/, ie = /^\d{4}-\d{2}-\d{2}$/;
225
- function K(e, n, t, r) {
226
- var u, a;
224
+ const de = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/, le = /^\d{4}-\d{2}-\d{2}$/;
225
+ function H(e, n, t, r) {
226
+ var a, c;
227
227
  if (t == null || t === "") return "empty";
228
228
  if (typeof t == "boolean") return t ? "Yes" : "No";
229
229
  if (typeof t == "object")
230
230
  return Array.isArray(t) ? `${t.length} items` : "a new value";
231
- const o = String(t), s = (a = (u = r == null ? void 0 : r.choices) == null ? void 0 : u[`${e ?? ""}.${n}`]) == null ? void 0 : a[o];
232
- if (s) return re(s);
233
- if (ie.test(o)) return o;
234
- if (oe.test(o)) {
235
- const c = new Date(o);
236
- if (!Number.isNaN(c.getTime()))
231
+ const o = String(t), s = (c = (a = r == null ? void 0 : r.choices) == null ? void 0 : a[`${e ?? ""}.${n}`]) == null ? void 0 : c[o];
232
+ if (s) return ue(s);
233
+ if (le.test(o)) return o;
234
+ if (de.test(o)) {
235
+ const u = new Date(o);
236
+ if (!Number.isNaN(u.getTime()))
237
237
  try {
238
- return c.toLocaleString(void 0, {
238
+ return u.toLocaleString(void 0, {
239
239
  dateStyle: "medium",
240
240
  timeStyle: "short",
241
241
  ...r != null && r.timeZone ? { timeZone: r.timeZone } : {}
242
242
  });
243
243
  } catch {
244
- return c.toLocaleString();
244
+ return u.toLocaleString();
245
245
  }
246
246
  }
247
247
  return o.length > 60 ? `${o.slice(0, 57)}…` : o;
248
248
  }
249
- function V(e, n, t, r) {
249
+ function Q(e, n, t, r) {
250
250
  var s;
251
251
  const o = `${e ?? ""}.${n}`;
252
252
  return !(!(r != null && r.fields) || !(o in r.fields) || (s = r.links) != null && s[o] || t != null && typeof t == "object");
253
253
  }
254
- function U(e) {
254
+ function Z(e) {
255
255
  var n, t;
256
256
  return (n = e.changes) != null && n.length ? e.changes.map((r) => r.field) : (t = e.changed_fields) != null && t.length ? e.changed_fields : e.delta && typeof e.delta == "object" ? Object.keys(e.delta) : [];
257
257
  }
258
- function z(e) {
258
+ function B(e) {
259
259
  const n = { from: null, to: null, via: null, note: null, auto: !1 };
260
260
  let t = i(e);
261
261
  if (!t) return n;
@@ -267,14 +267,14 @@ function z(e) {
267
267
  const s = /^bulk:\s*(.+?)\s*→\s*(.+)$/i.exec(t);
268
268
  if (s)
269
269
  return n.via = s[1], n.to = s[2], n;
270
- const u = /^(.*?)\s*→\s*(.+?)(?:\s+via\s+(.+))?$/.exec(t);
271
- if (u) {
272
- const a = i(u[1]);
273
- n.from = a && a !== "Start" ? a : null, n.to = i(u[2]) || null, n.via = i(u[3]) || null;
270
+ const a = /^(.*?)\s*→\s*(.+?)(?:\s+via\s+(.+))?$/.exec(t);
271
+ if (a) {
272
+ const c = i(a[1]);
273
+ n.from = c && c !== "Start" ? c : null, n.to = i(a[2]) || null, n.via = i(a[3]) || null;
274
274
  }
275
275
  return n;
276
276
  }
277
- const A = {
277
+ const y = {
278
278
  ack: "acknowledged",
279
279
  acknowledge: "acknowledged",
280
280
  acquire: "took",
@@ -395,7 +395,7 @@ const A = {
395
395
  updated: "updated",
396
396
  upload: "uploaded",
397
397
  view: "viewed"
398
- }, se = /* @__PURE__ */ new Set([
398
+ }, pe = /* @__PURE__ */ new Set([
399
399
  "add",
400
400
  "build",
401
401
  "create",
@@ -410,73 +410,141 @@ const A = {
410
410
  "schedule",
411
411
  "upload"
412
412
  ]);
413
- function G(e) {
414
- const n = T(e).map((u) => u.toLowerCase());
413
+ function X(e) {
414
+ const n = E(e).map((a) => a.toLowerCase());
415
415
  if (n.length === 0) return { verb: null, past: null, noun: "" };
416
416
  const t = n[n.length - 1];
417
417
  let r = -1;
418
- if (A[t]) r = n.length - 1;
419
- else if (A[n[0]]) r = 0;
420
- else for (let u = n.length - 1; u >= 0; u--) A[n[u]] && (r = u);
421
- if (r < 0) return { verb: null, past: null, noun: n.map(O).join(" ") };
418
+ if (y[t]) r = n.length - 1;
419
+ else if (y[n[0]]) r = 0;
420
+ else for (let a = n.length - 1; a >= 0; a--) y[n[a]] && (r = a);
421
+ if (r < 0) return { verb: null, past: null, noun: n.map(z).join(" ") };
422
422
  const o = n[r], s = [...n.slice(0, r), ...n.slice(r + 1)];
423
- return { verb: o, past: A[o], noun: s.map(O).join(" ") };
423
+ return { verb: o, past: y[o], noun: s.map(z).join(" ") };
424
424
  }
425
- function ae(e, n) {
426
- return n ? /s$/.test(n) && !/ss$/.test(n) ? n : e && se.has(e) ? `${/^[aeiou]/i.test(n) ? "an" : "a"} ${n}` : `the ${n}` : "";
425
+ function fe(e, n) {
426
+ return n ? /s$/.test(n) && !/ss$/.test(n) ? n : e && pe.has(e) ? `${/^[aeiou]/i.test(n) ? "an" : "a"} ${n}` : `the ${n}` : "";
427
427
  }
428
- function ce(e) {
428
+ function me(e) {
429
429
  const n = /(\d[\d,]*)\s+rows?/i.exec(e), t = /^\s*(csv|xlsx|json|pdf|xml)\b/i.exec(e);
430
430
  return {
431
431
  rows: n ? Number(n[1].replace(/,/g, "")) : null,
432
- format: t ? P[t[1].toLowerCase()] ?? t[1].toUpperCase() : null
432
+ format: t ? U[t[1].toLowerCase()] ?? t[1].toUpperCase() : null
433
433
  };
434
434
  }
435
- const E = /* @__PURE__ */ new Set(["transition", "pipeline-transition"]);
436
- function ue(e, n) {
437
- var $, h, v, m, k;
438
- const t = i(e.action), r = e.collection ?? null, o = y(r, e.item, n), s = j(r, n), u = `${/^[aeiou]/i.test(s.singular) ? "an" : "a"} ${g(s.singular)}`, a = i(e.comment), c = o ? ` on ${o}` : "";
435
+ function S(e, n) {
436
+ var r;
437
+ const t = `${i(e.collection)}:${i(e.item)}`;
438
+ return ((r = n == null ? void 0 : n.junctions) == null ? void 0 : r[t]) ?? null;
439
+ }
440
+ function ee(e) {
441
+ return `${/^[aeiou]/i.test(e) ? "an" : "a"} ${e}`;
442
+ }
443
+ function ne(e, n) {
444
+ const t = `a ${_(b(e.parent_collection, n).singular)} record`;
445
+ if (!i(e.parent_id)) return t;
446
+ const r = I(e.parent_collection, e.parent_id, n);
447
+ return !r || r === w ? t : r;
448
+ }
449
+ function D(e) {
450
+ const n = i(e.value);
451
+ return n ? `${e.noun} ${n}` : ee(e.noun);
452
+ }
453
+ function te(e, n, t) {
454
+ const r = ne(n, t);
455
+ return e === "create" ? `added ${D(n)} to ${r}` : e === "delete" ? `removed ${D(n)} from ${r}` : `updated ${D(n)} on ${r}`;
456
+ }
457
+ function $e(e, n) {
458
+ var l;
459
+ const t = e.map((p) => ({ e: p, j: S(p, n) }));
460
+ if (t.length === 0 || t.some((p) => !p.j)) return null;
461
+ const r = new Set(t.map((p) => i(p.j.parent_id)).filter(Boolean)), o = new Set(t.map((p) => p.j.parent_collection));
462
+ if (r.size > 1 || o.size > 1) return null;
463
+ const s = ((l = t.find((p) => i(p.j.parent_id))) == null ? void 0 : l.j) ?? t[0].j, a = /* @__PURE__ */ new Map();
464
+ for (const { e: p, j: $ } of [...t].reverse()) {
465
+ const h = a.get($.noun) ?? { removed: [], added: [], updated: [] }, v = i($.value), g = i(p.action);
466
+ g === "delete" ? h.removed.push(v) : g === "create" ? h.added.push(v) : h.updated.push(v), a.set($.noun, h);
467
+ }
468
+ const c = (p, $) => $ ? `${p} ${$}` : ee(p), u = [], d = [];
469
+ for (const [p, $] of a) {
470
+ if ($.removed.length === 1 && $.added.length === 1 && $.updated.length === 0) {
471
+ u.push({ noun: p, from: $.removed[0], to: $.added[0] });
472
+ continue;
473
+ }
474
+ for (const h of $.removed) d.push(`removed ${c(p, h)}`);
475
+ for (const h of $.added) d.push(`added ${c(p, h)}`);
476
+ for (const h of $.updated) d.push(`updated ${c(p, h)}`);
477
+ }
478
+ return { parent: ne(s, n), pairs: u, rest: d };
479
+ }
480
+ function he(e) {
481
+ return e.from && e.to ? `${e.noun} ${e.from} → ${e.to}` : e.to ? `${e.noun} set to ${e.to}` : `changed ${e.noun}`;
482
+ }
483
+ function ge(e, n) {
484
+ const t = $e(e, n);
485
+ if (!t) return null;
486
+ const { parent: r, pairs: o, rest: s } = t;
487
+ if (s.length === 0 && o.length === 1) {
488
+ const a = o[0];
489
+ return a.from && a.to ? `changed ${a.noun} on ${r}: ${a.from} → ${a.to}` : a.to ? `changed ${a.noun} on ${r} to ${a.to}` : `changed ${a.noun} on ${r}`;
490
+ }
491
+ if (o.length === 0 && s.length === 1) {
492
+ const a = e[0];
493
+ return te(i(a.action), S(a, n), n);
494
+ }
495
+ return `changed ${r}: ${[...o.map(he), ...s].join("; ")}`;
496
+ }
497
+ const Y = /* @__PURE__ */ new Set(["transition", "pipeline-transition"]);
498
+ function Ae(e) {
499
+ const n = i(e).toLowerCase();
500
+ return /approv/.test(n) ? "Approved" : /reject/.test(n) ? "Rejected" : /declin/.test(n) ? "Declined" : /send.?back|return/.test(n) ? "Sent back" : /submit/.test(n) ? "Submitted" : /cancel/.test(n) ? "Cancelled" : "Moved";
501
+ }
502
+ function ve(e, n) {
503
+ var $, h, v, g, x;
504
+ const t = i(e.action), r = e.collection ?? null, o = I(r, e.item, n), s = b(r, n), a = `${/^[aeiou]/i.test(s.singular) ? "an" : "a"} ${_(s.singular)}`, c = i(e.comment), u = o ? ` on ${o}` : "", d = S(e, n);
505
+ if (d && (t === "create" || t === "delete" || t === "update"))
506
+ return te(t, d, n);
439
507
  if ((($ = e.event) == null ? void 0 : $.kind) === "start") {
440
- const l = i(e.event.to_label);
441
- return `started ${o ?? "the pipeline"}${l ? ` in ${l}` : ""}`;
508
+ const f = i(e.event.to_label);
509
+ return `started ${o ?? "the pipeline"}${f ? ` in ${f}` : ""}`;
442
510
  }
443
- if (((h = e.event) == null ? void 0 : h.kind) === "transition" || E.has(t)) {
444
- const l = e.event ? {
511
+ if (((h = e.event) == null ? void 0 : h.kind) === "transition" || Y.has(t)) {
512
+ const f = e.event ? {
445
513
  from: i(e.event.from_label) || null,
446
514
  to: i(e.event.to_label) || null,
447
515
  via: i(e.event.transition_label) || null
448
- } : z(a), p = (v = e.event) != null && v.addendum ? `Addendum “${i(e.event.addendum.title) || "Untitled"}”` : o ?? "a record";
449
- return l.from && l.to ? `moved ${p} from ${l.from} to ${l.to}` : l.to ? `moved ${p} to ${l.to}` : l.via ? `ran “${l.via}” on ${p}` : `moved ${p}`;
516
+ } : B(c), m = (v = e.event) != null && v.addendum ? `Addendum “${i(e.event.addendum.title) || "Untitled"}”` : o ?? "a record";
517
+ return f.from && f.to ? `moved ${m} from ${f.from} to ${f.to}` : f.to ? `moved ${m} to ${f.to}` : f.via ? `ran “${f.via}” on ${m}` : `moved ${m}`;
450
518
  }
451
519
  switch (t) {
452
520
  case "create":
453
521
  case "o2m-create":
454
- return t === "o2m-create" ? e.o2m ? `${R(e.o2m)}${c}` : `added related rows${c}` : r === "nivaro_settings" ? "saved the settings" : `created ${o ?? u}`;
522
+ return t === "o2m-create" ? e.o2m ? `${q(e.o2m)}${u}` : `added related rows${u}` : r === "nivaro_settings" ? "saved the settings" : `created ${o ?? a}`;
455
523
  case "update":
456
524
  case "o2m-update": {
457
525
  if (t === "o2m-update")
458
- return e.o2m ? `${R(e.o2m)}${c}` : `changed related rows${c}`;
459
- const l = U(e);
526
+ return e.o2m ? `${q(e.o2m)}${u}` : `changed related rows${u}`;
527
+ const f = Z(e);
460
528
  if (r === "nivaro_settings")
461
- return l.length ? `changed the ${I(r, l, n)} setting${l.length === 1 ? "" : "s"}` : "changed the settings";
462
- if (r === "nivaro_approval_instances" && ((m = e.why) != null && m.approval)) {
463
- const p = e.why.approval, _ = y(p.collection, p.item, n);
464
- return `${(A[i(p.decision).toLowerCase()] ?? i(p.decision).toLowerCase()) || "decided on"} ${_ ?? o ?? "an approval"}${p.chain ? ` (${p.chain})` : ""}`;
529
+ return f.length ? `changed the ${P(r, f, n)} setting${f.length === 1 ? "" : "s"}` : "changed the settings";
530
+ if (r === "nivaro_approval_instances" && ((g = e.why) != null && g.approval)) {
531
+ const m = e.why.approval, k = I(m.collection, m.item, n);
532
+ return `${(y[i(m.decision).toLowerCase()] ?? i(m.decision).toLowerCase()) || "decided on"} ${k ?? o ?? "an approval"}${m.chain ? ` (${m.chain})` : ""}`;
465
533
  }
466
- if (l.length) {
467
- const p = ((k = e.changes) == null ? void 0 : k.length) === 1 ? e.changes[0] : null;
468
- return p && "value" in p && V(r, p.field, p.value, n) ? `set ${M(r, p.field, n)} to ${K(r, p.field, p.value, n)}${c}` : `changed ${I(r, l, n)}${c}`;
534
+ if (f.length) {
535
+ const m = ((x = e.changes) == null ? void 0 : x.length) === 1 ? e.changes[0] : null;
536
+ return m && "value" in m && Q(r, m.field, m.value, n) ? `set ${F(r, m.field, n)} to ${H(r, m.field, m.value, n)}${u}` : `changed ${P(r, f, n)}${u}`;
469
537
  }
470
- return `updated ${o ?? u}`;
538
+ return `updated ${o ?? a}`;
471
539
  }
472
540
  case "delete":
473
541
  case "o2m-delete":
474
- return t === "o2m-delete" ? e.o2m ? `${R(e.o2m)}${c}` : `removed related rows${c}` : `deleted ${o ?? u}`;
542
+ return t === "o2m-delete" ? e.o2m ? `${q(e.o2m)}${u}` : `removed related rows${u}` : `deleted ${o ?? a}`;
475
543
  case "restore":
476
- return `restored ${o ?? u}`;
544
+ return `restored ${o ?? a}`;
477
545
  case "pipeline-start": {
478
- const l = /initial state:\s*(.+)$/i.exec(a);
479
- return `started ${o ?? "the pipeline"}${l ? ` in ${l[1]}` : ""}`;
546
+ const f = /initial state:\s*(.+)$/i.exec(c);
547
+ return `started ${o ?? "the pipeline"}${f ? ` in ${f[1]}` : ""}`;
480
548
  }
481
549
  case "login":
482
550
  return "signed in";
@@ -485,55 +553,55 @@ function ue(e, n) {
485
553
  case "login-refused":
486
554
  return "was refused sign-in";
487
555
  case "export": {
488
- const l = ce(a);
489
- return `exported ${l.rows != null ? b(l.rows, r, n) : g(s.plural)}${l.format ? ` to ${l.format}` : ""}`;
556
+ const f = me(c);
557
+ return `exported ${f.rows != null ? R(f.rows, r, n) : _(s.plural)}${f.format ? ` to ${f.format}` : ""}`;
490
558
  }
491
559
  case "masquerade-start":
492
- return `started viewing as ${S(e, n, a)}`;
560
+ return `started viewing as ${C(e, n, c)}`;
493
561
  case "masquerade-stop":
494
- return `stopped viewing as ${S(e, n, a)}`;
562
+ return `stopped viewing as ${C(e, n, c)}`;
495
563
  case "token.generate":
496
- return `generated a static token for ${S(e, n, "")}`;
564
+ return `generated a static token for ${C(e, n, "")}`;
497
565
  case "token.revoke":
498
- return `revoked the static token of ${S(e, n, "")}`;
566
+ return `revoked the static token of ${C(e, n, "")}`;
499
567
  case "api_key_created":
500
- return `created ${o && o !== x ? o : "an API key"}`;
568
+ return `created ${o && o !== w ? o : "an API key"}`;
501
569
  case "api_key_revoked":
502
- return `revoked ${o && o !== x ? o : "an API key"}`;
570
+ return `revoked ${o && o !== w ? o : "an API key"}`;
503
571
  case "api_key_deleted":
504
- return `deleted ${o && o !== x ? o : "an API key"}`;
572
+ return `deleted ${o && o !== w ? o : "an API key"}`;
505
573
  case "api_key_simulate":
506
- return `tested requests as ${o && o !== x ? o : "an API key"}`;
574
+ return `tested requests as ${o && o !== w ? o : "an API key"}`;
507
575
  case "set_role":
508
- return `changed the role of ${S(e, n, "")}`;
576
+ return `changed the role of ${C(e, n, "")}`;
509
577
  case "bulk-write":
510
578
  case "bulk-action-execute": {
511
- const l = /(\d+)\s+(?:item|row)/i.exec(a), p = l ? b(Number(l[1]), r, n) : g(s.plural), _ = t === "bulk-action-execute" ? /^(.+?)\s*\([^)]*\)\s+on\s/.exec(a) : null;
512
- return _ ? `ran “${_[1]}” on ${p}` : `changed ${p} in bulk`;
579
+ const f = /(\d+)\s+(?:item|row)/i.exec(c), m = f ? R(Number(f[1]), r, n) : _(s.plural), k = t === "bulk-action-execute" ? /^(.+?)\s*\([^)]*\)\s+on\s/.exec(c) : null;
580
+ return k ? `ran “${k[1]}” on ${m}` : `changed ${m} in bulk`;
513
581
  }
514
582
  case "import-create":
515
583
  case "import-queue":
516
- return `started an import into ${g(s.plural)}`;
584
+ return `started an import into ${_(s.plural)}`;
517
585
  case "import-complete":
518
- return `finished an import into ${g(s.plural)}${a ? ` (${a})` : ""}`;
586
+ return `finished an import into ${_(s.plural)}${c ? ` (${c})` : ""}`;
519
587
  case "import-failed":
520
- return `had an import into ${g(s.plural)} fail`;
588
+ return `had an import into ${_(s.plural)} fail`;
521
589
  case "comment":
522
- return `commented${c}`;
590
+ return `commented${u}`;
523
591
  case "file-download": {
524
- let l = "", p = !1;
592
+ let f = "", m = !1;
525
593
  try {
526
- const L = JSON.parse(a);
527
- l = typeof L.name == "string" ? L.name : "", p = L.kind === "open";
594
+ const T = JSON.parse(c);
595
+ f = typeof T.name == "string" ? T.name : "", m = T.kind === "open";
528
596
  } catch {
529
597
  }
530
- const _ = l ? `“${l}”` : "a file";
531
- return `${p ? "opened" : "downloaded"} ${_}${r === "nivaro_files" ? "" : c}`;
598
+ const k = f ? `“${f}”` : "a file";
599
+ return `${m ? "opened" : "downloaded"} ${k}${r === "nivaro_files" ? "" : u}`;
532
600
  }
533
601
  case "picker-exclude":
534
- return `hid ${o ?? u} from pickers`;
602
+ return `hid ${o ?? a} from pickers`;
535
603
  case "picker-include":
536
- return `showed ${o ?? u} in pickers again`;
604
+ return `showed ${o ?? a} in pickers again`;
537
605
  case "ai-brief":
538
606
  return "asked the assistant for a brief";
539
607
  case "config-epoch":
@@ -543,116 +611,125 @@ function ue(e, n) {
543
611
  case "config-snapshot-export":
544
612
  return "downloaded a configuration snapshot";
545
613
  }
546
- if (!t) return `did something${c}`;
547
- const d = G(t);
548
- return /settings$/.test(d.noun) && !d.verb ? `changed the ${d.noun}` : d.past ? o && d.noun && g(s.singular).toLowerCase().includes(d.noun.toLowerCase()) ? `${d.past} ${o}` : d.noun ? `${d.past} ${ae(d.verb, d.noun)}${c}` : `${d.past} ${o ?? "something"}` : `recorded “${B(t)}”${c}`;
614
+ if (!t) return `did something${u}`;
615
+ const l = X(t);
616
+ return /settings$/.test(l.noun) && !l.verb ? `changed the ${l.noun}` : l.past ? o && l.noun && _(s.singular).toLowerCase().includes(l.noun.toLowerCase()) ? `${l.past} ${o}` : l.noun ? `${l.past} ${fe(l.verb, l.noun)}${u}` : `${l.past} ${o ?? "something"}` : `recorded “${V(t)}”${u}`;
549
617
  }
550
- function S(e, n, t) {
551
- const r = i(e.item), o = C(r, n) ?? (t || null);
618
+ function C(e, n, t) {
619
+ const r = i(e.item), o = L(r, n) ?? (t || null);
552
620
  if (o) return o;
553
- const s = e.collection === "nivaro_users" ? y(e.collection, e.item, n) : null;
554
- return s && !Y.test(r) ? s : "someone";
621
+ const s = e.collection === "nivaro_users" ? I(e.collection, e.item, n) : null;
622
+ return s && !J.test(r) ? s : "someone";
555
623
  }
556
- function de(e, n) {
557
- return `${J(e, n)} ${ue(e, n)}`;
624
+ function _e(e, n) {
625
+ return `${G(e, n)} ${ve(e, n)}`;
558
626
  }
559
- function me(e) {
560
- var a, c, d, f;
627
+ function Ce(e) {
628
+ var c, u, d, l;
561
629
  const n = i(e.action), t = i(e.comment);
562
- let r = i((a = e.why) == null ? void 0 : a.reason) || null, o = i((c = e.why) == null ? void 0 : c.note) || null;
563
- !o && E.has(n) && !e.event && (o = z(t).note), !o && ((d = e.event) == null ? void 0 : d.kind) === "transition" && t && (o = t), !r && (n === "create" || n === "update" || n === "delete") && t && !/^import:/i.test(t) && (r = t);
564
- const s = (f = e.why) == null ? void 0 : f.approval, u = s ? `${N(i(s.decision)) || "Decided"}${s.chain ? ` · ${s.chain}` : ""}${s.step != null && s.step !== "" ? ` · step ${s.step}` : ""}${i(s.comment) ? ` — “${i(s.comment)}”` : ""}` : null;
565
- return { reason: r, note: o, approval: u };
630
+ let r = i((c = e.why) == null ? void 0 : c.reason) || null, o = i((u = e.why) == null ? void 0 : u.note) || null;
631
+ !o && Y.has(n) && !e.event && (o = B(t).note), !o && ((d = e.event) == null ? void 0 : d.kind) === "transition" && t && (o = t), !r && (n === "create" || n === "update" || n === "delete") && t && !/^import:/i.test(t) && (r = t);
632
+ const s = (l = e.why) == null ? void 0 : l.approval, a = s ? `${O(i(s.decision)) || "Decided"}${s.chain ? ` · ${s.chain}` : ""}${s.step != null && s.step !== "" ? ` · step ${s.step}` : ""}${i(s.comment) ? ` — “${i(s.comment)}”` : ""}` : null;
633
+ return { reason: r, note: o, approval: a };
566
634
  }
567
- const le = 6e4;
568
- function F(e) {
635
+ const ke = 6e4, we = 5e3;
636
+ function j(e) {
569
637
  return e.timestamp ? new Date(e.timestamp).getTime() : Number.NaN;
570
638
  }
571
- function Z(e) {
572
- const n = D(e);
639
+ function N(e) {
640
+ const n = W(e);
573
641
  return `${n.kind}|${i(n.id)}|${i(e.user ?? e.user_id).toUpperCase()}`;
574
642
  }
575
- function pe(e) {
643
+ function Se(e) {
576
644
  const n = i(e.action);
577
645
  return !i(e.item) && (n.startsWith("bulk-") || n === "import-complete");
578
646
  }
579
- function $e(e, n = {}) {
580
- const t = n.windowMs ?? le, r = [];
581
- for (const o of e) {
582
- const s = r[r.length - 1], u = s == null ? void 0 : s.entries[s.entries.length - 1], a = i(o.group_key);
583
- if (s && u) {
584
- const c = i(u.group_key);
585
- if (a && a === c) {
586
- s.entries.push(o), s.by = "group_key";
647
+ function ye(e, n = {}) {
648
+ const t = n.windowMs ?? ke, r = [], o = (s, a) => s.parent_collection === a.parent_collection && (!i(s.parent_id) || !i(a.parent_id) || i(s.parent_id) === i(a.parent_id));
649
+ for (const s of e) {
650
+ const a = r[r.length - 1], c = a == null ? void 0 : a.entries[a.entries.length - 1], u = i(s.group_key);
651
+ if (a && c && n.labels) {
652
+ const d = S(s, n.labels), l = S(c, n.labels);
653
+ if (d && l && a.entries.every((p) => S(p, n.labels)) && o(d, l) && N(s) === N(c) && Math.abs(j(c) - j(s)) <= we) {
654
+ a.entries.push(s), a.by !== "group_key" && (a.by = "time");
587
655
  continue;
588
656
  }
589
- if (!a && !c && s.by !== "group_key" && i(o.action) === i(u.action) && i(o.collection) === i(u.collection) && i(o.collection) !== "" && Z(o) === Z(u) && Math.abs(F(u) - F(o)) <= t) {
590
- s.entries.push(o), s.by = "time";
657
+ }
658
+ if (a && c) {
659
+ const d = i(c.group_key);
660
+ if (u && u === d) {
661
+ a.entries.push(s), a.by = "group_key";
662
+ continue;
663
+ }
664
+ if (!u && !d && a.by !== "group_key" && i(s.action) === i(c.action) && i(s.collection) === i(c.collection) && i(s.collection) !== "" && N(s) === N(c) && Math.abs(j(c) - j(s)) <= t) {
665
+ a.entries.push(s), a.by = "time";
591
666
  continue;
592
667
  }
593
668
  }
594
- r.push({ key: `${a || "e"}:${o.id ?? r.length}`, entries: [o], by: null });
669
+ r.push({ key: `${u || "e"}:${s.id ?? r.length}`, entries: [s], by: null });
595
670
  }
596
671
  return r;
597
672
  }
598
- function he(e, n) {
673
+ function Ie(e, n) {
599
674
  if (e.length === 0) return "";
600
- const t = e.filter((m) => !pe(m)), r = t[0] ?? e[0];
601
- if (t.length <= 1) return de(r, n);
602
- const o = J(r, n), u = new Set(t.map((m) => i(m.collection))).size === 1 ? r.collection ?? null : null, a = new Set(t.map((m) => i(m.item))), c = a.size > 1 ? a.size : t.length, d = u ? a.size === 1 && i(r.item) ? y(u, r.item, n) ?? b(c, u, n) : b(c, u, n) : `${c} records`, f = a.size === 1 && t.length > 1 ? ` ${t.length} times` : "", $ = new Set(
603
- t.map((m) => E.has(i(m.action)) ? "transition" : i(m.action))
675
+ const t = e.filter((g) => !Se(g)), r = t[0] ?? e[0];
676
+ if (t.length <= 1) return _e(r, n);
677
+ const o = G(r, n), s = ge(t, n);
678
+ if (s) return `${o} ${s}`;
679
+ const c = new Set(t.map((g) => i(g.collection))).size === 1 ? r.collection ?? null : null, u = new Set(t.map((g) => i(g.item))), d = u.size > 1 ? u.size : t.length, l = c ? u.size === 1 && i(r.item) ? I(c, r.item, n) ?? R(d, c, n) : R(d, c, n) : `${d} records`, p = u.size === 1 && t.length > 1 ? ` ${t.length} times` : "", $ = new Set(
680
+ t.map((g) => Y.has(i(g.action)) ? "transition" : i(g.action))
604
681
  );
605
- if ($.size !== 1) return `${o} made ${t.length} changes to ${d}`;
682
+ if ($.size !== 1) return `${o} made ${t.length} changes to ${l}`;
606
683
  const h = [...$][0];
607
684
  if (h === "transition") {
608
- const m = new Set(
609
- t.map((l) => {
610
- var p;
611
- return i(((p = l.event) == null ? void 0 : p.to_label) ?? z(l.comment).to);
685
+ const g = new Set(
686
+ t.map((f) => {
687
+ var m;
688
+ return i(((m = f.event) == null ? void 0 : m.to_label) ?? B(f.comment).to);
612
689
  })
613
- ), k = m.size === 1 ? [...m][0] : "";
614
- return `${o} moved ${d}${k ? ` to ${k}` : ""}${f}`;
690
+ ), x = g.size === 1 ? [...g][0] : "";
691
+ return `${o} moved ${l}${x ? ` to ${x}` : ""}${p}`;
615
692
  }
616
693
  if (h === "update") {
617
- const m = fe(t, u, n);
618
- return `${o} updated ${d}${f}${m ? `: ${m}` : ""}`;
694
+ const g = xe(t, c, n);
695
+ return `${o} updated ${l}${p}${g ? `: ${g}` : ""}`;
619
696
  }
620
- if (h === "create") return `${o} created ${d}`;
621
- if (h === "delete") return `${o} deleted ${d}`;
622
- if (h === "picker-exclude") return `${o} hid ${d} from pickers${f}`;
623
- if (h === "picker-include") return `${o} showed ${d} in pickers again${f}`;
624
- const v = G(h);
625
- return v.past ? `${o} ${v.past} ${d}${v.noun && !g(j(u, n).plural).toLowerCase().includes(v.noun) ? ` (${v.noun})` : ""}${f}` : `${o} recorded “${B(h)}” on ${d}`;
626
- }
627
- function fe(e, n, t) {
628
- var a;
629
- const r = ((a = e[0]) == null ? void 0 : a.changes) ?? null;
697
+ if (h === "create") return `${o} created ${l}`;
698
+ if (h === "delete") return `${o} deleted ${l}`;
699
+ if (h === "picker-exclude") return `${o} hid ${l} from pickers${p}`;
700
+ if (h === "picker-include") return `${o} showed ${l} in pickers again${p}`;
701
+ const v = X(h);
702
+ return v.past ? `${o} ${v.past} ${l}${v.noun && !_(b(c, n).plural).toLowerCase().includes(v.noun) ? ` (${v.noun})` : ""}${p}` : `${o} recorded “${V(h)}” on ${l}`;
703
+ }
704
+ function xe(e, n, t) {
705
+ var c;
706
+ const r = ((c = e[0]) == null ? void 0 : c.changes) ?? null;
630
707
  if (!(r != null && r.length)) {
631
- const c = e.map((d) => U(d).sort().join(","));
632
- return c[0] && c.every((d) => d === c[0]) ? I(n, c[0].split(","), t) : "";
708
+ const u = e.map((d) => Z(d).sort().join(","));
709
+ return u[0] && u.every((d) => d === u[0]) ? P(n, u[0].split(","), t) : "";
633
710
  }
634
- const o = (c) => JSON.stringify((c.changes ?? []).map((d) => [d.field, d.value ?? null]).sort());
635
- if (e.every((c) => o(c) === o(e[0])) && r.length <= 2 && r.every((c) => V(n, c.field, c.value, t)))
711
+ const o = (u) => JSON.stringify((u.changes ?? []).map((d) => [d.field, d.value ?? null]).sort());
712
+ if (e.every((u) => o(u) === o(e[0])) && r.length <= 2 && r.every((u) => Q(n, u.field, u.value, t)))
636
713
  return r.map(
637
- (c) => `${M(n, c.field, t)} → ${K(n, c.field, c.value, t)}`
714
+ (u) => `${F(n, u.field, t)} → ${H(n, u.field, u.value, t)}`
638
715
  ).join(", ");
639
- const u = new Set(e.flatMap((c) => (c.changes ?? []).map((d) => d.field)));
640
- return I(n, [...u], t);
641
- }
642
- function ge(e) {
643
- var u;
644
- const n = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set(), s = (a, c) => {
645
- const d = i(a), f = i(c);
646
- !d || !f || (o.add(d), d === "nivaro_users" && t.add(f), n.set(`${d}:${f}`, { collection: d, id: f }));
716
+ const a = new Set(e.flatMap((u) => (u.changes ?? []).map((d) => d.field)));
717
+ return P(n, [...a], t);
718
+ }
719
+ function be(e) {
720
+ var a;
721
+ const n = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set(), s = (c, u) => {
722
+ const d = i(c), l = i(u);
723
+ !d || !l || (o.add(d), d === "nivaro_users" && t.add(l), n.set(`${d}:${l}`, { collection: d, id: l }));
647
724
  };
648
- for (const a of e) {
649
- const c = i(a.user ?? a.user_id);
650
- c && t.add(c);
651
- const d = D(a);
652
- d.kind === "view_as" && d.id && t.add(d.id), d.on_behalf_of && t.add(d.on_behalf_of), i(a.collection) && o.add(i(a.collection)), s(a.collection, a.item), (u = a.why) != null && u.approval && s(a.why.approval.collection, a.why.approval.item);
653
- for (const f of U(a)) {
654
- const $ = i(a.collection);
655
- $ && r.set(`${$}.${f}`, { collection: $, field: f });
725
+ for (const c of e) {
726
+ const u = i(c.user ?? c.user_id);
727
+ u && t.add(u);
728
+ const d = W(c);
729
+ d.kind === "view_as" && d.id && t.add(d.id), d.on_behalf_of && t.add(d.on_behalf_of), i(c.collection) && o.add(i(c.collection)), s(c.collection, c.item), (a = c.why) != null && a.approval && s(c.why.approval.collection, c.why.approval.item);
730
+ for (const l of Z(c)) {
731
+ const p = i(c.collection);
732
+ p && r.set(`${p}.${l}`, { collection: p, field: l });
656
733
  }
657
734
  }
658
735
  return {
@@ -663,27 +740,33 @@ function ge(e) {
663
740
  };
664
741
  }
665
742
  export {
666
- le as BURST_WINDOW_MS,
667
- x as HIDDEN_RECORD,
668
- G as actionParts,
669
- ge as activityLabelRefs,
670
- ue as activityPredicate,
671
- me as activityWhy,
672
- J as actorName,
673
- D as actorOf,
674
- re as choiceText,
675
- j as collectionNouns,
676
- b as countNoun,
677
- M as fieldLabel,
678
- I as fieldList,
679
- $e as groupActivity,
680
- R as o2mSentence,
681
- te as parseActor,
682
- z as parseTransitionComment,
683
- B as readableTitle,
684
- y as recordPhrase,
685
- he as renderActivityGroupSentence,
686
- de as renderActivitySentence,
687
- V as valueShowable,
688
- K as valueText
743
+ ke as BURST_WINDOW_MS,
744
+ w as HIDDEN_RECORD,
745
+ we as LINK_WRITE_WINDOW_MS,
746
+ X as actionParts,
747
+ be as activityLabelRefs,
748
+ ve as activityPredicate,
749
+ Ce as activityWhy,
750
+ G as actorName,
751
+ W as actorOf,
752
+ ue as choiceText,
753
+ b as collectionNouns,
754
+ R as countNoun,
755
+ F as fieldLabel,
756
+ P as fieldList,
757
+ ye as groupActivity,
758
+ S as junctionOf,
759
+ $e as linkChanges,
760
+ ge as linkGroupPredicate,
761
+ he as linkPairText,
762
+ q as o2mSentence,
763
+ ce as parseActor,
764
+ B as parseTransitionComment,
765
+ V as readableTitle,
766
+ I as recordPhrase,
767
+ Ie as renderActivityGroupSentence,
768
+ _e as renderActivitySentence,
769
+ Ae as transitionVerb,
770
+ Q as valueShowable,
771
+ H as valueText
689
772
  };