@nivaro/react 0.3.137 → 0.3.139

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 (50) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +95 -4
  4. package/dist/index.js +748 -743
  5. package/dist/shared/components/CollectionBrowserView.js +392 -389
  6. package/dist/shared/components/DelegateCoverLine.js +80 -87
  7. package/dist/shared/components/ItemEditForm.js +589 -588
  8. package/dist/shared/components/MyWorkView.js +284 -286
  9. package/dist/shared/components/NotificationBell.js +251 -205
  10. package/dist/shared/components/ai/AiAnalyticsView.js +878 -417
  11. package/dist/shared/components/ai/AiPlanCard.js +164 -122
  12. package/dist/shared/components/ai/AiPlanUndo.js +291 -0
  13. package/dist/shared/components/ai/call-log/CallDrawer.js +357 -0
  14. package/dist/shared/components/ai/call-log/RawJson.js +126 -0
  15. package/dist/shared/components/ai/call-log/ThreadView.js +223 -0
  16. package/dist/shared/components/ai/call-log/TranscriptView.js +227 -0
  17. package/dist/shared/components/ai/call-log/controls.js +364 -0
  18. package/dist/shared/components/ai/call-log/format.js +46 -0
  19. package/dist/shared/components/ai/call-log/url.js +105 -0
  20. package/dist/shared/components/chat/chat-core.js +422 -346
  21. package/dist/shared/components/integrations/IntegrationObligationsView.js +98 -98
  22. package/dist/shared/components/integrations/RecordIntegrationPreview.js +102 -93
  23. package/dist/shared/components/integrations/console/api.js +11 -1
  24. package/dist/shared/components/item-edit/HeaderRollupExplainer.js +5 -1
  25. package/dist/shared/components/item-edit/RecordLiveSync.js +241 -229
  26. package/dist/shared/components/item-edit/RecordRecapChanges.js +166 -0
  27. package/dist/shared/components/item-edit/RecordRecapStrip.js +254 -84
  28. package/dist/shared/components/item-edit/live-related.js +34 -18
  29. package/dist/shared/components/panels/RevisionsPanel.js +735 -683
  30. package/dist/shared/components/queue/QueueWorklist.js +323 -316
  31. package/dist/shared/components/support/SupportRequestDialog.js +198 -181
  32. package/dist/shared/components/trackers/use-tracker-link.js +74 -65
  33. package/dist/shared/lib/activity-sentence.js +167 -151
  34. package/dist/shared/lib/config-update-refresh.js +34 -0
  35. package/dist/shared/lib/config-watch.js +17 -17
  36. package/dist/shared/lib/gap-refresh.js +49 -0
  37. package/dist/shared/lib/integration-dots.js +8 -8
  38. package/dist/shared/lib/live-ops.js +26 -23
  39. package/dist/shared/lib/live-pickers.js +1 -1
  40. package/dist/shared/lib/live-queries.js +223 -195
  41. package/dist/shared/lib/live.js +56 -51
  42. package/dist/shared/lib/obligation-banner.js +11 -10
  43. package/dist/shared/lib/obligation-filters.js +22 -18
  44. package/dist/shared/lib/obligation-reason-text.js +18 -8
  45. package/dist/shared/lib/presence-hooks.js +133 -132
  46. package/dist/shared/lib/reconnect-resync.js +90 -0
  47. package/dist/shared/lib/record-room-holds.js +43 -0
  48. package/dist/shared/lib/socket-realtime.js +116 -105
  49. package/dist/shared/lib/user-sync.js +1 -6
  50. package/package.json +1 -1
@@ -5,7 +5,7 @@ function M(e) {
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
- function Ce(e) {
8
+ function Le(e) {
9
9
  return (e.totals ?? []).filter((n) => n && i(n.label) && Number.isFinite(n.delta) && n.delta !== 0).map(
10
10
  (n) => `${i(n.label)} ${n.delta > 0 ? "+" : "−"}${Math.abs(n.delta).toLocaleString("en-US", { maximumFractionDigits: 2 })}`
11
11
  ).join(", ");
@@ -34,7 +34,7 @@ const k = "a record you can't see", z = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0
34
34
  function i(e) {
35
35
  return e == null ? "" : String(e).trim();
36
36
  }
37
- function ie(e) {
37
+ function se(e) {
38
38
  return i(e).toUpperCase();
39
39
  }
40
40
  function F(e) {
@@ -44,14 +44,14 @@ function U(e) {
44
44
  const n = e.toLowerCase();
45
45
  return W[n] ?? n;
46
46
  }
47
- function G(e) {
47
+ function X(e) {
48
48
  const n = F(e).map(U).join(" ");
49
49
  return n ? n.charAt(0).toUpperCase() + n.slice(1) : "";
50
50
  }
51
51
  function q(e) {
52
52
  return F(e).map((n) => W[n.toLowerCase()] ?? n.charAt(0).toUpperCase() + n.slice(1).toLowerCase()).join(" ");
53
53
  }
54
- function Q(e) {
54
+ function V(e) {
55
55
  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;
56
56
  }
57
57
  function D(e) {
@@ -60,7 +60,7 @@ function D(e) {
60
60
  function g(e) {
61
61
  return e.split(" ").map((n) => /[A-Z][^ ]*[A-Z]/.test(n) ? n : n.toLowerCase()).join(" ");
62
62
  }
63
- const se = {
63
+ const ae = {
64
64
  nivaro_activity: "Activity entry",
65
65
  nivaro_activity_views: "Activity view",
66
66
  nivaro_addendums: "Addendum",
@@ -126,45 +126,45 @@ const se = {
126
126
  nivaro_workflow_states: "Pipeline state",
127
127
  nivaro_workflow_templates: "Pipeline",
128
128
  nivaro_workflow_transitions: "Pipeline move"
129
- }, ae = /^(nivaro|directus)_/i;
130
- function C(e) {
129
+ }, ce = /^(nivaro|directus)_/i;
130
+ function N(e) {
131
131
  const n = g(e);
132
132
  return `${/^[aeiou]/i.test(n) ? "an" : "a"} ${n}`;
133
133
  }
134
- function N(e, n) {
134
+ function I(e, n) {
135
135
  var l;
136
136
  const t = i(e);
137
137
  if (!t) return { singular: "Record", plural: "Records" };
138
138
  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);
139
139
  if (a || s) {
140
- const f = a || y(s, Q), $ = s && s !== f ? s : y(f, D);
140
+ const f = a || A(s, V), $ = s && s !== f ? s : A(f, D);
141
141
  return { singular: f, plural: $ };
142
142
  }
143
- const c = se[t];
144
- if (c) return { singular: c, plural: c === "Settings" ? c : y(c, D) };
145
- const u = q(t.replace(/^(nivaro|directus)_/, "")) || "Record", d = y(u, Q);
146
- return { singular: d, plural: y(d, D) };
143
+ const c = ae[t];
144
+ if (c) return { singular: c, plural: c === "Settings" ? c : A(c, D) };
145
+ const u = q(t.replace(/^(nivaro|directus)_/, "")) || "Record", d = A(u, V);
146
+ return { singular: d, plural: A(d, D) };
147
147
  }
148
- function y(e, n) {
148
+ function A(e, n) {
149
149
  const t = e.split(" ");
150
150
  return t[t.length - 1] = n(t[t.length - 1] ?? ""), t.join(" ");
151
151
  }
152
- function L(e, n, t) {
153
- const { singular: r, plural: o } = N(n, t);
152
+ function P(e, n, t) {
153
+ const { singular: r, plural: o } = I(n, t);
154
154
  return `${e} ${g(e === 1 ? r : o)}`;
155
155
  }
156
- function ce(e, n) {
157
- const t = e.user ?? e.user_id ?? null, r = t ? T(t, n) : null;
156
+ function ue(e, n) {
157
+ const t = e.user ?? e.user_id ?? null, r = t ? L(t, n) : null;
158
158
  if (r) return r;
159
159
  const o = [i(e.first_name), i(e.last_name)].filter(Boolean).join(" ");
160
160
  return o || (i(e.user_email) ? i(e.user_email) : null);
161
161
  }
162
- function T(e, n) {
162
+ function L(e, n) {
163
163
  if (!e || !(n != null && n.users)) return null;
164
164
  const t = n.users;
165
- return i(t[e] ?? t[ie(e)] ?? t[i(e).toLowerCase()]) || null;
165
+ return i(t[e] ?? t[se(e)] ?? t[i(e).toLowerCase()]) || null;
166
166
  }
167
- const ue = /* @__PURE__ */ new Set([
167
+ const de = /* @__PURE__ */ new Set([
168
168
  "person",
169
169
  "view_as",
170
170
  "api_key",
@@ -174,7 +174,7 @@ const ue = /* @__PURE__ */ new Set([
174
174
  "cron",
175
175
  "system"
176
176
  ]);
177
- function de(e) {
177
+ function le(e) {
178
178
  if (e == null || e === "") return null;
179
179
  let n = e;
180
180
  if (typeof e == "string")
@@ -185,7 +185,7 @@ function de(e) {
185
185
  }
186
186
  if (!n || typeof n != "object") return null;
187
187
  const t = n, r = i(t.kind);
188
- return ue.has(r) ? {
188
+ return de.has(r) ? {
189
189
  kind: r,
190
190
  id: t.id == null ? null : String(t.id),
191
191
  name: t.name == null ? null : String(t.name),
@@ -193,7 +193,7 @@ function de(e) {
193
193
  } : null;
194
194
  }
195
195
  function Y(e) {
196
- const n = de(e.actor);
196
+ const n = le(e.actor);
197
197
  if (n) return n;
198
198
  const t = e.user ?? e.user_id ?? null;
199
199
  if (i(e.mcp_conn) || i(e.via_app) || i(e.via_agent))
@@ -224,13 +224,13 @@ function Y(e) {
224
224
  name: i(e.origin) === "integration" ? "An integration" : null
225
225
  };
226
226
  }
227
- function H(e, n) {
228
- const t = Y(e), r = ce(e, n), o = T(t.on_behalf_of, n) ?? r;
227
+ function ee(e, n) {
228
+ const t = Y(e), r = ue(e, n), o = L(t.on_behalf_of, n) ?? r;
229
229
  switch (t.kind) {
230
230
  case "person":
231
231
  return r ?? "Someone";
232
232
  case "view_as":
233
- return `${(T(t.id, n) ?? i(t.name) ?? "") || "An administrator"} as ${o ?? "someone"}`;
233
+ return `${(L(t.id, n) ?? i(t.name) ?? "") || "An administrator"} as ${o ?? "someone"}`;
234
234
  case "api_key":
235
235
  return `API key “${i(t.name) || (t.id ? `#${t.id}` : "unnamed")}”`;
236
236
  case "mcp": {
@@ -247,32 +247,48 @@ function H(e, n) {
247
247
  return i(t.name) || "System";
248
248
  }
249
249
  }
250
- function I(e, n, t) {
250
+ function j(e, n, t) {
251
+ var s;
251
252
  const r = i(n);
252
253
  if (!r || !i(e)) return null;
253
- const o = `${e}:${r}`, s = t == null ? void 0 : t.records, { singular: a } = N(e, t), c = ae.test(i(e));
254
- if (s && o in s) {
255
- const u = s[o];
256
- if (u == null) return c ? C(a) : k;
257
- const d = i(u);
258
- return d ? c && (d === r || z.test(d)) ? C(a) : d.toLowerCase().startsWith(a.toLowerCase()) ? d : `${a} ${d}` : c ? C(a) : a;
259
- }
260
- return c || z.test(r) ? C(a) : `${a} ${r}`;
254
+ const o = (s = t == null ? void 0 : t.junctions) == null ? void 0 : s[`${e}:${r}`];
255
+ return o ? fe(o, t) : Z(e, r, t);
256
+ }
257
+ function pe(e, n) {
258
+ const t = i(e.parent_id);
259
+ if (!t) return !1;
260
+ const r = Z(e.parent_collection, t, n);
261
+ return !!r && r !== k;
262
+ }
263
+ function fe(e, n) {
264
+ const t = G(e, n), r = i(e.value);
265
+ return r ? `${e.noun} ${r} on ${t}` : pe(e, n) ? `${t} · ${e.noun}` : `${Q(e.noun)} on ${t}`;
261
266
  }
262
267
  function Z(e, n, t) {
268
+ if (!n || !i(e)) return null;
269
+ const r = `${e}:${n}`, o = t == null ? void 0 : t.records, { singular: s } = I(e, t), a = ce.test(i(e));
270
+ if (o && r in o) {
271
+ const c = o[r];
272
+ if (c == null) return a ? N(s) : k;
273
+ const u = i(c);
274
+ return u ? a && (u === n || z.test(u)) ? N(s) : u.toLowerCase().startsWith(s.toLowerCase()) ? u : `${s} ${u}` : a ? N(s) : s;
275
+ }
276
+ return a || z.test(n) ? N(s) : `${s} ${n}`;
277
+ }
278
+ function B(e, n, t) {
263
279
  var o;
264
280
  const r = (o = t == null ? void 0 : t.fields) == null ? void 0 : o[`${e ?? ""}.${n}`];
265
281
  return i(r) || q(n);
266
282
  }
267
- function P(e, n, t) {
268
- const r = [...new Set(n)].map((o) => Z(e, o, t));
283
+ function T(e, n, t) {
284
+ const r = [...new Set(n)].map((o) => B(e, o, t));
269
285
  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`;
270
286
  }
271
- function le(e) {
287
+ function me(e) {
272
288
  const n = String(e ?? "");
273
289
  return n.startsWith("$t:") ? q(n.slice(3).replace(/-/g, "_")) : n;
274
290
  }
275
- const pe = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/, fe = /^\d{4}-\d{2}-\d{2}$/, me = /<\/?[a-z][a-z0-9]*(\s[^>]*)?\/?>/i, $e = {
291
+ const $e = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/, _e = /^\d{4}-\d{2}-\d{2}$/, ve = /<\/?[a-z][a-z0-9]*(\s[^>]*)?\/?>/i, he = {
276
292
  "&nbsp;": " ",
277
293
  "&amp;": "&",
278
294
  "&lt;": "<",
@@ -280,21 +296,21 @@ const pe = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/, fe = /^\d{4}-\d{2}-\d{2}$/, me = /<
280
296
  "&quot;": '"',
281
297
  "&#39;": "'"
282
298
  };
283
- function _e(e) {
284
- return e.replace(/<(script|style|template)\b[\s\S]*?<\/\1>/gi, " ").replace(/<[^>]+>/g, " ").replace(/&(nbsp|amp|lt|gt|quot|#39);/g, (n) => $e[n] ?? n).replace(/\s+/g, " ").trim();
299
+ function ge(e) {
300
+ return e.replace(/<(script|style|template)\b[\s\S]*?<\/\1>/gi, " ").replace(/<[^>]+>/g, " ").replace(/&(nbsp|amp|lt|gt|quot|#39);/g, (n) => he[n] ?? n).replace(/\s+/g, " ").trim();
285
301
  }
286
- function V(e, n, t, r) {
302
+ function ne(e, n, t, r) {
287
303
  var c, u;
288
304
  if (t == null || t === "") return "empty";
289
305
  if (typeof t == "boolean") return t ? "Yes" : "No";
290
306
  if (typeof t == "object")
291
307
  return Array.isArray(t) ? `${t.length} items` : "a new value";
292
- const o = String(t), s = me.test(o) ? _e(o) : o;
308
+ const o = String(t), s = ve.test(o) ? ge(o) : o;
293
309
  if (!s) return "empty";
294
310
  const a = (u = (c = r == null ? void 0 : r.choices) == null ? void 0 : c[`${e ?? ""}.${n}`]) == null ? void 0 : u[s];
295
- if (a) return le(a);
296
- if (fe.test(s)) return s;
297
- if (pe.test(s)) {
311
+ if (a) return me(a);
312
+ if (_e.test(s)) return s;
313
+ if ($e.test(s)) {
298
314
  const d = new Date(s);
299
315
  if (!Number.isNaN(d.getTime()))
300
316
  try {
@@ -309,12 +325,12 @@ function V(e, n, t, r) {
309
325
  }
310
326
  return s.length > 60 ? `${s.slice(0, 57)}…` : s;
311
327
  }
312
- function X(e, n, t, r) {
328
+ function te(e, n, t, r) {
313
329
  var s;
314
330
  const o = `${e ?? ""}.${n}`;
315
331
  return !(!(r != null && r.fields) || !(o in r.fields) || (s = r.links) != null && s[o] || t != null && typeof t == "object");
316
332
  }
317
- function B(e) {
333
+ function K(e) {
318
334
  var n, t;
319
335
  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) : [];
320
336
  }
@@ -337,7 +353,7 @@ function J(e) {
337
353
  }
338
354
  return n;
339
355
  }
340
- const x = {
356
+ const b = {
341
357
  ack: "acknowledged",
342
358
  acknowledge: "acknowledged",
343
359
  acquire: "took",
@@ -458,7 +474,7 @@ const x = {
458
474
  updated: "updated",
459
475
  upload: "uploaded",
460
476
  view: "viewed"
461
- }, ve = /* @__PURE__ */ new Set([
477
+ }, ke = /* @__PURE__ */ new Set([
462
478
  "add",
463
479
  "build",
464
480
  "create",
@@ -473,22 +489,22 @@ const x = {
473
489
  "schedule",
474
490
  "upload"
475
491
  ]);
476
- function ee(e) {
492
+ function re(e) {
477
493
  const n = F(e).map((a) => a.toLowerCase());
478
494
  if (n.length === 0) return { verb: null, past: null, noun: "" };
479
495
  const t = n[n.length - 1];
480
496
  let r = -1;
481
- if (x[t]) r = n.length - 1;
482
- else if (x[n[0]]) r = 0;
483
- else for (let a = n.length - 1; a >= 0; a--) x[n[a]] && (r = a);
497
+ if (b[t]) r = n.length - 1;
498
+ else if (b[n[0]]) r = 0;
499
+ else for (let a = n.length - 1; a >= 0; a--) b[n[a]] && (r = a);
484
500
  if (r < 0) return { verb: null, past: null, noun: n.map(U).join(" ") };
485
501
  const o = n[r], s = [...n.slice(0, r), ...n.slice(r + 1)];
486
- return { verb: o, past: x[o], noun: s.map(U).join(" ") };
502
+ return { verb: o, past: b[o], noun: s.map(U).join(" ") };
487
503
  }
488
- function he(e, n) {
489
- return n ? /s$/.test(n) && !/ss$/.test(n) ? n : e && ve.has(e) ? `${/^[aeiou]/i.test(n) ? "an" : "a"} ${n}` : `the ${n}` : "";
504
+ function we(e, n) {
505
+ return n ? /s$/.test(n) && !/ss$/.test(n) ? n : e && ke.has(e) ? `${/^[aeiou]/i.test(n) ? "an" : "a"} ${n}` : `the ${n}` : "";
490
506
  }
491
- function ge(e) {
507
+ function Se(e) {
492
508
  const n = /(\d[\d,]*)\s+rows?/i.exec(e), t = /^\s*(csv|xlsx|json|pdf|xml)\b/i.exec(e);
493
509
  return {
494
510
  rows: n ? Number(n[1].replace(/,/g, "")) : null,
@@ -500,24 +516,24 @@ function S(e, n) {
500
516
  const t = `${i(e.collection)}:${i(e.item)}`;
501
517
  return ((r = n == null ? void 0 : n.junctions) == null ? void 0 : r[t]) ?? null;
502
518
  }
503
- function ne(e) {
519
+ function Q(e) {
504
520
  return `${/^[aeiou]/i.test(e) ? "an" : "a"} ${e}`;
505
521
  }
506
- function te(e, n) {
507
- const t = g(N(e.parent_collection, n).singular), r = `${/^[aeiou]/i.test(t) ? "an" : "a"} ${t} record`;
522
+ function G(e, n) {
523
+ const t = g(I(e.parent_collection, n).singular), r = `${/^[aeiou]/i.test(t) ? "an" : "a"} ${t} record`;
508
524
  if (!i(e.parent_id)) return r;
509
- const o = I(e.parent_collection, e.parent_id, n);
525
+ const o = Z(e.parent_collection, i(e.parent_id), n);
510
526
  return !o || o === k ? r : o;
511
527
  }
512
528
  function E(e) {
513
529
  const n = i(e.value);
514
- return n ? `${e.noun} ${n}` : ne(e.noun);
530
+ return n ? `${e.noun} ${n}` : Q(e.noun);
515
531
  }
516
- function re(e, n, t) {
517
- const r = te(n, t);
532
+ function oe(e, n, t) {
533
+ const r = G(n, t);
518
534
  return e === "create" ? `added ${E(n)} to ${r}` : e === "delete" ? `removed ${E(n)} from ${r}` : `updated ${E(n)} on ${r}`;
519
535
  }
520
- function ke(e, n) {
536
+ function ye(e, n) {
521
537
  var l;
522
538
  const t = e.map((f) => ({ e: f, j: S(f, n) }));
523
539
  if (t.length === 0 || t.some((f) => !f.j)) return null;
@@ -528,7 +544,7 @@ function ke(e, n) {
528
544
  const _ = a.get($.noun) ?? { removed: [], added: [], updated: [] }, h = i($.value), v = i(f.action);
529
545
  v === "delete" ? _.removed.push(h) : v === "create" ? _.added.push(h) : _.updated.push(h), a.set($.noun, _);
530
546
  }
531
- const c = (f, $) => $ ? `${f} ${$}` : ne(f), u = [], d = [];
547
+ const c = (f, $) => $ ? `${f} ${$}` : Q(f), u = [], d = [];
532
548
  for (const [f, $] of a) {
533
549
  if ($.removed.length === 1 && $.added.length === 1 && $.updated.length === 0) {
534
550
  u.push({ noun: f, from: $.removed[0], to: $.added[0] });
@@ -538,13 +554,13 @@ function ke(e, n) {
538
554
  for (const _ of $.added) d.push(`added ${c(f, _)}`);
539
555
  for (const _ of $.updated) d.push(`updated ${c(f, _)}`);
540
556
  }
541
- return { parent: te(s, n), pairs: u, rest: d };
557
+ return { parent: G(s, n), pairs: u, rest: d };
542
558
  }
543
- function we(e) {
559
+ function Ae(e) {
544
560
  return e.from && e.to ? `${e.noun} ${e.from} → ${e.to}` : e.to ? `${e.noun} set to ${e.to}` : `changed ${e.noun}`;
545
561
  }
546
- function Se(e, n) {
547
- const t = ke(e, n);
562
+ function xe(e, n) {
563
+ const t = ye(e, n);
548
564
  if (!t) return null;
549
565
  const { parent: r, pairs: o, rest: s } = t;
550
566
  if (s.length === 0 && o.length === 1) {
@@ -553,25 +569,25 @@ function Se(e, n) {
553
569
  }
554
570
  if (o.length === 0 && s.length === 1) {
555
571
  const a = e[0];
556
- return re(i(a.action), S(a, n), n);
572
+ return oe(i(a.action), S(a, n), n);
557
573
  }
558
- return `changed ${r}: ${[...o.map(we), ...s].join("; ")}`;
574
+ return `changed ${r}: ${[...o.map(Ae), ...s].join("; ")}`;
559
575
  }
560
- const K = /* @__PURE__ */ new Set(["transition", "pipeline-transition"]);
576
+ const H = /* @__PURE__ */ new Set(["transition", "pipeline-transition"]);
561
577
  function je(e) {
562
578
  const n = i(e).toLowerCase();
563
579
  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";
564
580
  }
565
581
  function be(e, n) {
566
- var $, _, h, v, b;
567
- const t = i(e.action), r = e.collection ?? null, o = I(r, e.item, n), s = N(r, n), a = `${/^[aeiou]/i.test(s.singular) ? "an" : "a"} ${g(s.singular)}`, c = i(e.comment), u = o ? ` on ${o}` : "", d = S(e, n);
582
+ var $, _, h, v, y;
583
+ const t = i(e.action), r = e.collection ?? null, o = j(r, e.item, n), s = I(r, n), a = `${/^[aeiou]/i.test(s.singular) ? "an" : "a"} ${g(s.singular)}`, c = i(e.comment), u = o ? ` on ${o}` : "", d = S(e, n);
568
584
  if (d && (t === "create" || t === "delete" || t === "update"))
569
- return re(t, d, n);
585
+ return oe(t, d, n);
570
586
  if ((($ = e.event) == null ? void 0 : $.kind) === "start") {
571
587
  const p = i(e.event.to_label);
572
588
  return `started ${o ?? "the pipeline"}${p ? ` in ${p}` : ""}`;
573
589
  }
574
- if (((_ = e.event) == null ? void 0 : _.kind) === "transition" || K.has(t)) {
590
+ if (((_ = e.event) == null ? void 0 : _.kind) === "transition" || H.has(t)) {
575
591
  const p = e.event ? {
576
592
  from: i(e.event.from_label) || null,
577
593
  to: i(e.event.to_label) || null,
@@ -587,16 +603,16 @@ function be(e, n) {
587
603
  case "o2m-update": {
588
604
  if (t === "o2m-update")
589
605
  return e.o2m ? `${M(e.o2m)}${u}` : `changed related rows${u}`;
590
- const p = B(e);
606
+ const p = K(e);
591
607
  if (r === "nivaro_settings")
592
- return p.length ? `changed the ${P(r, p, n)} setting${p.length === 1 ? "" : "s"}` : "changed the settings";
608
+ return p.length ? `changed the ${T(r, p, n)} setting${p.length === 1 ? "" : "s"}` : "changed the settings";
593
609
  if (r === "nivaro_approval_instances" && ((v = e.why) != null && v.approval)) {
594
- const m = e.why.approval, w = I(m.collection, m.item, n);
595
- return `${(x[i(m.decision).toLowerCase()] ?? i(m.decision).toLowerCase()) || "decided on"} ${w ?? o ?? "an approval"}${m.chain ? ` (${m.chain})` : ""}`;
610
+ const m = e.why.approval, w = j(m.collection, m.item, n);
611
+ return `${(b[i(m.decision).toLowerCase()] ?? i(m.decision).toLowerCase()) || "decided on"} ${w ?? o ?? "an approval"}${m.chain ? ` (${m.chain})` : ""}`;
596
612
  }
597
613
  if (p.length) {
598
- const m = ((b = e.changes) == null ? void 0 : b.length) === 1 ? e.changes[0] : null;
599
- return m && "value" in m && X(r, m.field, m.value, n) ? `set ${Z(r, m.field, n)} to ${V(r, m.field, m.value, n)}${u}` : `changed ${P(r, p, n)}${u}`;
614
+ const m = ((y = e.changes) == null ? void 0 : y.length) === 1 ? e.changes[0] : null;
615
+ return m && "value" in m && te(r, m.field, m.value, n) ? `set ${B(r, m.field, n)} to ${ne(r, m.field, m.value, n)}${u}` : `changed ${T(r, p, n)}${u}`;
600
616
  }
601
617
  return `updated ${o ?? a}`;
602
618
  }
@@ -618,17 +634,17 @@ function be(e, n) {
618
634
  case "sign-in-failed":
619
635
  return o && o !== k ? `had a sign-in as ${o} fail` : "had a sign-in fail";
620
636
  case "export": {
621
- const p = ge(c);
622
- return `exported ${p.rows != null ? L(p.rows, r, n) : g(s.plural)}${p.format ? ` to ${p.format}` : ""}`;
637
+ const p = Se(c);
638
+ return `exported ${p.rows != null ? P(p.rows, r, n) : g(s.plural)}${p.format ? ` to ${p.format}` : ""}`;
623
639
  }
624
640
  case "masquerade-start":
625
- return `started viewing as ${A(e, n, c)}`;
641
+ return `started viewing as ${x(e, n, c)}`;
626
642
  case "masquerade-stop":
627
- return `stopped viewing as ${A(e, n, c)}`;
643
+ return `stopped viewing as ${x(e, n, c)}`;
628
644
  case "token.generate":
629
- return `generated a static token for ${A(e, n, "")}`;
645
+ return `generated a static token for ${x(e, n, "")}`;
630
646
  case "token.revoke":
631
- return `revoked the static token of ${A(e, n, "")}`;
647
+ return `revoked the static token of ${x(e, n, "")}`;
632
648
  case "api_key_created":
633
649
  return `created ${o && o !== k ? o : "an API key"}`;
634
650
  case "api_key_revoked":
@@ -638,10 +654,10 @@ function be(e, n) {
638
654
  case "api_key_simulate":
639
655
  return `tested requests as ${o && o !== k ? o : "an API key"}`;
640
656
  case "set_role":
641
- return `changed the role of ${A(e, n, "")}`;
657
+ return `changed the role of ${x(e, n, "")}`;
642
658
  case "bulk-write":
643
659
  case "bulk-action-execute": {
644
- const p = /(\d+)\s+(?:item|row)/i.exec(c), m = p ? L(Number(p[1]), r, n) : g(s.plural), w = t === "bulk-action-execute" ? /^(.+?)\s*\([^)]*\)\s+on\s/.exec(c) : null;
660
+ const p = /(\d+)\s+(?:item|row)/i.exec(c), m = p ? P(Number(p[1]), r, n) : g(s.plural), w = t === "bulk-action-execute" ? /^(.+?)\s*\([^)]*\)\s+on\s/.exec(c) : null;
645
661
  return w ? `ran “${w[1]}” on ${m}` : `changed ${m} in bulk`;
646
662
  }
647
663
  case "import-create":
@@ -687,45 +703,45 @@ function be(e, n) {
687
703
  return "downloaded a configuration snapshot";
688
704
  }
689
705
  if (!t) return `did something${u}`;
690
- const l = ee(t);
691
- return /settings$/.test(l.noun) && !l.verb ? `changed the ${l.noun}` : l.past ? o && l.noun && g(s.singular).toLowerCase().includes(l.noun.toLowerCase()) ? `${l.past} ${o}` : l.noun ? `${l.past} ${he(l.verb, l.noun)}${u}` : `${l.past} ${o ?? "something"}` : `recorded “${G(t)}”${u}`;
706
+ const l = re(t);
707
+ return /settings$/.test(l.noun) && !l.verb ? `changed the ${l.noun}` : l.past ? o && l.noun && g(s.singular).toLowerCase().includes(l.noun.toLowerCase()) ? `${l.past} ${o}` : l.noun ? `${l.past} ${we(l.verb, l.noun)}${u}` : `${l.past} ${o ?? "something"}` : `recorded “${X(t)}”${u}`;
692
708
  }
693
- function A(e, n, t) {
694
- const r = i(e.item), o = T(r, n) ?? (t || null);
709
+ function x(e, n, t) {
710
+ const r = i(e.item), o = L(r, n) ?? (t || null);
695
711
  if (o) return o;
696
- const s = e.collection === "nivaro_users" ? I(e.collection, e.item, n) : null;
712
+ const s = e.collection === "nivaro_users" ? j(e.collection, e.item, n) : null;
697
713
  return s && !z.test(r) ? s : "someone";
698
714
  }
699
- function ye(e, n) {
700
- return `${H(e, n)} ${be(e, n)}`;
715
+ function Ie(e, n) {
716
+ return `${ee(e, n)} ${be(e, n)}`;
701
717
  }
702
- function Re(e) {
718
+ function Te(e) {
703
719
  var c, u, d, l;
704
720
  const n = i(e.action), t = i(e.comment);
705
721
  let r = i((c = e.why) == null ? void 0 : c.reason) || null, o = i((u = e.why) == null ? void 0 : u.note) || null;
706
- !o && K.has(n) && !e.event && (o = J(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);
722
+ !o && H.has(n) && !e.event && (o = J(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);
707
723
  const s = (l = e.why) == null ? void 0 : l.approval, a = s ? `${q(i(s.decision)) || "Decided"}${s.chain ? ` · ${s.chain}` : ""}${s.step != null && s.step !== "" ? ` · step ${s.step}` : ""}${i(s.comment) ? ` — “${i(s.comment)}”` : ""}` : null;
708
724
  return { reason: r, note: o, approval: a };
709
725
  }
710
- const Ae = 6e4, xe = 5e3;
711
- function j(e) {
726
+ const Ne = 6e4, Ce = 5e3;
727
+ function C(e) {
712
728
  return e.timestamp ? new Date(e.timestamp).getTime() : Number.NaN;
713
729
  }
714
730
  function R(e) {
715
731
  const n = Y(e);
716
732
  return `${n.kind}|${i(n.id)}|${i(e.user ?? e.user_id).toUpperCase()}`;
717
733
  }
718
- function Ie(e) {
734
+ function Re(e) {
719
735
  const n = i(e.action);
720
736
  return !i(e.item) && (n.startsWith("bulk-") || n === "import-complete");
721
737
  }
722
- function Le(e, n = {}) {
723
- const t = n.windowMs ?? Ae, 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));
738
+ function qe(e, n = {}) {
739
+ const t = n.windowMs ?? Ne, 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));
724
740
  for (const s of e) {
725
741
  const a = r[r.length - 1], c = a == null ? void 0 : a.entries[a.entries.length - 1], u = i(s.group_key);
726
742
  if (a && c && n.labels) {
727
743
  const d = S(s, n.labels), l = S(c, n.labels);
728
- if (d && l && a.entries.every((f) => S(f, n.labels)) && o(d, l) && R(s) === R(c) && Math.abs(j(c) - j(s)) <= xe) {
744
+ if (d && l && a.entries.every((f) => S(f, n.labels)) && o(d, l) && R(s) === R(c) && Math.abs(C(c) - C(s)) <= Ce) {
729
745
  a.entries.push(s), a.by !== "group_key" && (a.by = "time");
730
746
  continue;
731
747
  }
@@ -736,7 +752,7 @@ function Le(e, n = {}) {
736
752
  a.entries.push(s), a.by = "group_key";
737
753
  continue;
738
754
  }
739
- if (!u && !d && a.by !== "group_key" && i(s.action) === i(c.action) && i(s.collection) === i(c.collection) && i(s.collection) !== "" && R(s) === R(c) && Math.abs(j(c) - j(s)) <= t) {
755
+ if (!u && !d && a.by !== "group_key" && i(s.action) === i(c.action) && i(s.collection) === i(c.collection) && i(s.collection) !== "" && R(s) === R(c) && Math.abs(C(c) - C(s)) <= t) {
740
756
  a.entries.push(s), a.by = "time";
741
757
  continue;
742
758
  }
@@ -745,14 +761,14 @@ function Le(e, n = {}) {
745
761
  }
746
762
  return r;
747
763
  }
748
- function Te(e, n) {
764
+ function Oe(e, n) {
749
765
  if (e.length === 0) return "";
750
- const t = e.filter((v) => !Ie(v)), r = t[0] ?? e[0];
751
- if (t.length <= 1) return ye(r, n);
752
- const o = H(r, n), s = Se(t, n);
766
+ const t = e.filter((v) => !Re(v)), r = t[0] ?? e[0];
767
+ if (t.length <= 1) return Ie(r, n);
768
+ const o = ee(r, n), s = xe(t, n);
753
769
  if (s) return `${o} ${s}`;
754
- const c = new Set(t.map((v) => i(v.collection))).size === 1 ? r.collection ?? null : null, u = new Set(t.map((v) => i(v.item))), d = u.size > 1 ? u.size : t.length, l = c ? u.size === 1 && i(r.item) ? I(c, r.item, n) ?? L(d, c, n) : L(d, c, n) : `${d} records`, f = u.size === 1 && t.length > 1 ? ` ${t.length} times` : "", $ = new Set(
755
- t.map((v) => K.has(i(v.action)) ? "transition" : i(v.action))
770
+ const c = new Set(t.map((v) => i(v.collection))).size === 1 ? r.collection ?? null : null, u = new Set(t.map((v) => i(v.item))), d = u.size > 1 ? u.size : t.length, l = c ? u.size === 1 && i(r.item) ? j(c, r.item, n) ?? P(d, c, n) : P(d, c, n) : `${d} records`, f = u.size === 1 && t.length > 1 ? ` ${t.length} times` : "", $ = new Set(
771
+ t.map((v) => H.has(i(v.action)) ? "transition" : i(v.action))
756
772
  );
757
773
  if ($.size !== 1) return `${o} made ${t.length} changes to ${l}`;
758
774
  const _ = [...$][0];
@@ -762,36 +778,36 @@ function Te(e, n) {
762
778
  var m;
763
779
  return i(((m = p.event) == null ? void 0 : m.to_label) ?? J(p.comment).to);
764
780
  })
765
- ), b = v.size === 1 ? [...v][0] : "";
766
- return `${o} moved ${l}${b ? ` to ${b}` : ""}${f}`;
781
+ ), y = v.size === 1 ? [...v][0] : "";
782
+ return `${o} moved ${l}${y ? ` to ${y}` : ""}${f}`;
767
783
  }
768
784
  if (_ === "update") {
769
- const v = Ne(t, c, n);
785
+ const v = Pe(t, c, n);
770
786
  return `${o} updated ${l}${f}${v ? `: ${v}` : ""}`;
771
787
  }
772
788
  if (_ === "create") return `${o} created ${l}`;
773
789
  if (_ === "delete") return `${o} deleted ${l}`;
774
790
  if (_ === "picker-exclude") return `${o} hid ${l} from pickers${f}`;
775
791
  if (_ === "picker-include") return `${o} showed ${l} in pickers again${f}`;
776
- const h = ee(_);
777
- return h.past ? `${o} ${h.past} ${l}${h.noun && !g(N(c, n).plural).toLowerCase().includes(h.noun) ? ` (${h.noun})` : ""}${f}` : `${o} recorded “${G(_)}” on ${l}`;
792
+ const h = re(_);
793
+ return h.past ? `${o} ${h.past} ${l}${h.noun && !g(I(c, n).plural).toLowerCase().includes(h.noun) ? ` (${h.noun})` : ""}${f}` : `${o} recorded “${X(_)}” on ${l}`;
778
794
  }
779
- function Ne(e, n, t) {
795
+ function Pe(e, n, t) {
780
796
  var c;
781
797
  const r = ((c = e[0]) == null ? void 0 : c.changes) ?? null;
782
798
  if (!(r != null && r.length)) {
783
- const u = e.map((d) => B(d).sort().join(","));
784
- return u[0] && u.every((d) => d === u[0]) ? P(n, u[0].split(","), t) : "";
799
+ const u = e.map((d) => K(d).sort().join(","));
800
+ return u[0] && u.every((d) => d === u[0]) ? T(n, u[0].split(","), t) : "";
785
801
  }
786
802
  const o = (u) => JSON.stringify((u.changes ?? []).map((d) => [d.field, d.value ?? null]).sort());
787
- if (e.every((u) => o(u) === o(e[0])) && r.length <= 2 && r.every((u) => X(n, u.field, u.value, t)))
803
+ if (e.every((u) => o(u) === o(e[0])) && r.length <= 2 && r.every((u) => te(n, u.field, u.value, t)))
788
804
  return r.map(
789
- (u) => `${Z(n, u.field, t)} → ${V(n, u.field, u.value, t)}`
805
+ (u) => `${B(n, u.field, t)} → ${ne(n, u.field, u.value, t)}`
790
806
  ).join(", ");
791
807
  const a = new Set(e.flatMap((u) => (u.changes ?? []).map((d) => d.field)));
792
- return P(n, [...a], t);
808
+ return T(n, [...a], t);
793
809
  }
794
- function Pe(e) {
810
+ function Me(e) {
795
811
  var a;
796
812
  const n = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set(), s = (c, u) => {
797
813
  const d = i(c), l = i(u);
@@ -802,7 +818,7 @@ function Pe(e) {
802
818
  u && t.add(u);
803
819
  const d = Y(c);
804
820
  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);
805
- for (const l of B(c)) {
821
+ for (const l of K(c)) {
806
822
  const f = i(c.collection);
807
823
  f && r.set(`${f}.${l}`, { collection: f, field: l });
808
824
  }
@@ -815,34 +831,34 @@ function Pe(e) {
815
831
  };
816
832
  }
817
833
  export {
818
- Ae as BURST_WINDOW_MS,
834
+ Ne as BURST_WINDOW_MS,
819
835
  k as HIDDEN_RECORD,
820
- xe as LINK_WRITE_WINDOW_MS,
821
- ee as actionParts,
822
- Pe as activityLabelRefs,
836
+ Ce as LINK_WRITE_WINDOW_MS,
837
+ re as actionParts,
838
+ Me as activityLabelRefs,
823
839
  be as activityPredicate,
824
- Re as activityWhy,
825
- H as actorName,
840
+ Te as activityWhy,
841
+ ee as actorName,
826
842
  Y as actorOf,
827
- le as choiceText,
828
- N as collectionNouns,
829
- L as countNoun,
830
- Z as fieldLabel,
831
- P as fieldList,
832
- Le as groupActivity,
843
+ me as choiceText,
844
+ I as collectionNouns,
845
+ P as countNoun,
846
+ B as fieldLabel,
847
+ T as fieldList,
848
+ qe as groupActivity,
833
849
  S as junctionOf,
834
- ke as linkChanges,
835
- Se as linkGroupPredicate,
836
- we as linkPairText,
850
+ ye as linkChanges,
851
+ xe as linkGroupPredicate,
852
+ Ae as linkPairText,
837
853
  M as o2mSentence,
838
- Ce as o2mTotalsText,
839
- de as parseActor,
854
+ Le as o2mTotalsText,
855
+ le as parseActor,
840
856
  J as parseTransitionComment,
841
- G as readableTitle,
842
- I as recordPhrase,
843
- Te as renderActivityGroupSentence,
844
- ye as renderActivitySentence,
857
+ X as readableTitle,
858
+ j as recordPhrase,
859
+ Oe as renderActivityGroupSentence,
860
+ Ie as renderActivitySentence,
845
861
  je as transitionVerb,
846
- X as valueShowable,
847
- V as valueText
862
+ te as valueShowable,
863
+ ne as valueText
848
864
  };