@nivaro/react 0.3.67 → 0.3.69

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 (32) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +7 -0
  4. package/dist/index.js +836 -835
  5. package/dist/shared/components/ConformanceView.js +34 -34
  6. package/dist/shared/components/ReportView.js +196 -196
  7. package/dist/shared/components/SlaRulesView.js +36 -36
  8. package/dist/shared/components/chat/ChatPanel.js +484 -487
  9. package/dist/shared/components/chat/ChatViews.js +66 -66
  10. package/dist/shared/components/chat/RoomParts.js +159 -157
  11. package/dist/shared/components/help-videos/editor/StatsTab.js +48 -47
  12. package/dist/shared/components/help-videos/editor/VersionsTab.js +17 -16
  13. package/dist/shared/components/imports/CollectionImportPanel.js +72 -72
  14. package/dist/shared/components/item-edit/FieldRenderer.js +186 -182
  15. package/dist/shared/components/item-edit/FieldRow.js +87 -87
  16. package/dist/shared/components/item-edit/FileDownloadCount.js +94 -0
  17. package/dist/shared/components/item-edit/FilePickerField.js +350 -349
  18. package/dist/shared/components/item-edit/RecordInsights.js +90 -91
  19. package/dist/shared/components/item-edit/SummaryPanel.js +31 -31
  20. package/dist/shared/components/layout-editor/assist/ExplainDiff.js +12 -12
  21. package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +175 -138
  22. package/dist/shared/components/layout-editor/inspector/RulesTab.js +53 -52
  23. package/dist/shared/components/panels/AddendumPanel.js +409 -411
  24. package/dist/shared/components/panels/CommentPanel.js +169 -162
  25. package/dist/shared/components/panels/PipelinePanel.js +75 -75
  26. package/dist/shared/components/panels/RevisionsPanel.js +103 -103
  27. package/dist/shared/components/queue/QueueWorklist.js +142 -141
  28. package/dist/shared/lib/activity-sentence.js +154 -144
  29. package/dist/shared/lib/format-value.js +15 -15
  30. package/dist/shared/lib/placement-behaviour.js +39 -31
  31. package/dist/shared/lib/utils.js +58 -53
  32. package/package.json +1 -1
@@ -1,11 +1,11 @@
1
- function L(e) {
1
+ function R(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 S = "a record you can't see", Z = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, P = {
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 = {
9
9
  ai: "AI",
10
10
  api: "API",
11
11
  csv: "CSV",
@@ -29,33 +29,33 @@ const S = "a record you can't see", Z = /^[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 G(e) {
32
+ function Q(e) {
33
33
  return i(e).toUpperCase();
34
34
  }
35
- function O(e) {
35
+ function T(e) {
36
36
  return e.split(/[\s_.:-]+/).map((n) => n.trim()).filter(Boolean);
37
37
  }
38
- function q(e) {
38
+ function O(e) {
39
39
  const n = e.toLowerCase();
40
40
  return P[n] ?? n;
41
41
  }
42
- function Y(e) {
43
- const n = O(e).map(q).join(" ");
42
+ function B(e) {
43
+ const n = T(e).map(O).join(" ");
44
44
  return n ? n.charAt(0).toUpperCase() + n.slice(1) : "";
45
45
  }
46
- function j(e) {
47
- return O(e).map((n) => P[n.toLowerCase()] ?? n.charAt(0).toUpperCase() + n.slice(1).toLowerCase()).join(" ");
46
+ function N(e) {
47
+ return T(e).map((n) => P[n.toLowerCase()] ?? n.charAt(0).toUpperCase() + n.slice(1).toLowerCase()).join(" ");
48
48
  }
49
- function E(e) {
49
+ function W(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 R(e) {
52
+ function q(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
55
  function g(e) {
56
56
  return e.split(" ").map((n) => /[A-Z][^ ]*[A-Z]/.test(n) ? n : n.toLowerCase()).join(" ");
57
57
  }
58
- const H = {
58
+ const X = {
59
59
  nivaro_activity: "Activity entry",
60
60
  nivaro_api_keys: "API key",
61
61
  nivaro_approval_chains: "Approval chain",
@@ -80,29 +80,29 @@ const H = {
80
80
  nivaro_webhooks: "Webhook",
81
81
  nivaro_workflow_templates: "Pipeline"
82
82
  };
83
- function N(e, n) {
83
+ function j(e, n) {
84
84
  var f;
85
85
  const t = i(e);
86
86
  if (!t) return { singular: "Record", plural: "Records" };
87
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
88
  if (u || s) {
89
- const $ = u || k(s, E), h = s && s !== $ ? s : k($, R);
89
+ const $ = u || w(s, W), h = s && s !== $ ? s : w($, q);
90
90
  return { singular: $, plural: h };
91
91
  }
92
- const a = H[t];
93
- if (a) return { singular: a, plural: a === "Settings" ? a : k(a, R) };
94
- const c = j(t.replace(/^(nivaro|directus)_/, "")) || "Record", d = k(c, E);
95
- return { singular: d, plural: k(d, R) };
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) };
96
96
  }
97
- function k(e, n) {
97
+ function w(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
101
  function b(e, n, t) {
102
- const { singular: r, plural: o } = N(n, t);
102
+ const { singular: r, plural: o } = j(n, t);
103
103
  return `${e} ${g(e === 1 ? r : o)}`;
104
104
  }
105
- function Q(e, n) {
105
+ function ee(e, n) {
106
106
  const t = e.user ?? e.user_id ?? null, r = t ? C(t, n) : null;
107
107
  if (r) return r;
108
108
  const o = [i(e.first_name), i(e.last_name)].filter(Boolean).join(" ");
@@ -111,9 +111,9 @@ function Q(e, n) {
111
111
  function C(e, n) {
112
112
  if (!e || !(n != null && n.users)) return null;
113
113
  const t = n.users;
114
- return i(t[e] ?? t[G(e)] ?? t[i(e).toLowerCase()]) || null;
114
+ return i(t[e] ?? t[Q(e)] ?? t[i(e).toLowerCase()]) || null;
115
115
  }
116
- const X = /* @__PURE__ */ new Set([
116
+ const ne = /* @__PURE__ */ new Set([
117
117
  "person",
118
118
  "view_as",
119
119
  "api_key",
@@ -123,7 +123,7 @@ const X = /* @__PURE__ */ new Set([
123
123
  "cron",
124
124
  "system"
125
125
  ]);
126
- function ee(e) {
126
+ function te(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 ee(e) {
134
134
  }
135
135
  if (!n || typeof n != "object") return null;
136
136
  const t = n, r = i(t.kind);
137
- return X.has(r) ? {
137
+ return ne.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 T(e) {
145
- const n = ee(e.actor);
144
+ function D(e) {
145
+ const n = te(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))
@@ -173,8 +173,8 @@ function T(e) {
173
173
  name: i(e.origin) === "integration" ? "An integration" : null
174
174
  };
175
175
  }
176
- function B(e, n) {
177
- const t = T(e), r = Q(e, n), o = C(t.on_behalf_of, n) ?? r;
176
+ function J(e, n) {
177
+ const t = D(e), r = ee(e, n), o = C(t.on_behalf_of, n) ?? r;
178
178
  switch (t.kind) {
179
179
  case "person":
180
180
  return r ?? "Someone";
@@ -196,32 +196,32 @@ function B(e, n) {
196
196
  return i(t.name) || "System";
197
197
  }
198
198
  }
199
- function I(e, n, t) {
199
+ function y(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 } = N(e, t);
202
+ const o = `${e}:${r}`, s = t == null ? void 0 : t.records, { singular: u } = j(e, t);
203
203
  if (s && o in s) {
204
204
  const a = s[o];
205
- if (a == null) return S;
205
+ if (a == null) return x;
206
206
  const c = i(a);
207
207
  return c ? c.toLowerCase().startsWith(u.toLowerCase()) ? c : `${u} ${c}` : u;
208
208
  }
209
- return Z.test(r) ? `a ${g(u)}` : `${u} ${r}`;
209
+ return Y.test(r) ? `a ${g(u)}` : `${u} ${r}`;
210
210
  }
211
- function D(e, n, t) {
211
+ function M(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) || j(n);
214
+ return i(r) || N(n);
215
215
  }
216
- function y(e, n, t) {
217
- const r = [...new Set(n)].map((o) => D(e, o, t));
216
+ function I(e, n, t) {
217
+ const r = [...new Set(n)].map((o) => M(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 ne(e) {
220
+ function re(e) {
221
221
  const n = String(e ?? "");
222
- return n.startsWith("$t:") ? j(n.slice(3).replace(/-/g, "_")) : n;
222
+ return n.startsWith("$t:") ? N(n.slice(3).replace(/-/g, "_")) : n;
223
223
  }
224
- const te = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/, re = /^\d{4}-\d{2}-\d{2}$/;
224
+ const oe = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/, ie = /^\d{4}-\d{2}-\d{2}$/;
225
225
  function K(e, n, t, r) {
226
226
  var u, a;
227
227
  if (t == null || t === "") return "empty";
@@ -229,9 +229,9 @@ function K(e, n, t, r) {
229
229
  if (typeof t == "object")
230
230
  return Array.isArray(t) ? `${t.length} items` : "a new value";
231
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 ne(s);
233
- if (re.test(o)) return o;
234
- if (te.test(o)) {
232
+ if (s) return re(s);
233
+ if (ie.test(o)) return o;
234
+ if (oe.test(o)) {
235
235
  const c = new Date(o);
236
236
  if (!Number.isNaN(c.getTime()))
237
237
  try {
@@ -246,16 +246,16 @@ function K(e, n, t, r) {
246
246
  }
247
247
  return o.length > 60 ? `${o.slice(0, 57)}…` : o;
248
248
  }
249
- function J(e, n, t, r) {
249
+ function V(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 M(e) {
254
+ function U(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 U(e) {
258
+ function z(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;
@@ -274,7 +274,7 @@ function U(e) {
274
274
  }
275
275
  return n;
276
276
  }
277
- const x = {
277
+ const A = {
278
278
  ack: "acknowledged",
279
279
  acknowledge: "acknowledged",
280
280
  acquire: "took",
@@ -395,7 +395,7 @@ const x = {
395
395
  updated: "updated",
396
396
  upload: "uploaded",
397
397
  view: "viewed"
398
- }, oe = /* @__PURE__ */ new Set([
398
+ }, se = /* @__PURE__ */ new Set([
399
399
  "add",
400
400
  "build",
401
401
  "create",
@@ -410,68 +410,68 @@ const x = {
410
410
  "schedule",
411
411
  "upload"
412
412
  ]);
413
- function V(e) {
414
- const n = O(e).map((u) => u.toLowerCase());
413
+ function G(e) {
414
+ const n = T(e).map((u) => u.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 (x[t]) r = n.length - 1;
419
- else if (x[n[0]]) r = 0;
420
- else for (let u = n.length - 1; u >= 0; u--) x[n[u]] && (r = u);
421
- if (r < 0) return { verb: null, past: null, noun: n.map(q).join(" ") };
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(" ") };
422
422
  const o = n[r], s = [...n.slice(0, r), ...n.slice(r + 1)];
423
- return { verb: o, past: x[o], noun: s.map(q).join(" ") };
423
+ return { verb: o, past: A[o], noun: s.map(O).join(" ") };
424
424
  }
425
- function ie(e, n) {
426
- return n ? /s$/.test(n) && !/ss$/.test(n) ? n : e && oe.has(e) ? `${/^[aeiou]/i.test(n) ? "an" : "a"} ${n}` : `the ${n}` : "";
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}` : "";
427
427
  }
428
- function se(e) {
428
+ function ce(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
432
  format: t ? P[t[1].toLowerCase()] ?? t[1].toUpperCase() : null
433
433
  };
434
434
  }
435
- const z = /* @__PURE__ */ new Set(["transition", "pipeline-transition"]);
436
- function ae(e, n) {
437
- var $, h, v, m, _;
438
- const t = i(e.action), r = e.collection ?? null, o = I(r, e.item, n), s = N(r, n), u = `${/^[aeiou]/i.test(s.singular) ? "an" : "a"} ${g(s.singular)}`, a = i(e.comment), c = o ? ` on ${o}` : "";
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}` : "";
439
439
  if ((($ = e.event) == null ? void 0 : $.kind) === "start") {
440
440
  const l = i(e.event.to_label);
441
441
  return `started ${o ?? "the pipeline"}${l ? ` in ${l}` : ""}`;
442
442
  }
443
- if (((h = e.event) == null ? void 0 : h.kind) === "transition" || z.has(t)) {
443
+ if (((h = e.event) == null ? void 0 : h.kind) === "transition" || E.has(t)) {
444
444
  const l = e.event ? {
445
445
  from: i(e.event.from_label) || null,
446
446
  to: i(e.event.to_label) || null,
447
447
  via: i(e.event.transition_label) || null
448
- } : U(a), p = (v = e.event) != null && v.addendum ? `Addendum “${i(e.event.addendum.title) || "Untitled"}”` : o ?? "a record";
448
+ } : z(a), p = (v = e.event) != null && v.addendum ? `Addendum “${i(e.event.addendum.title) || "Untitled"}”` : o ?? "a record";
449
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}`;
450
450
  }
451
451
  switch (t) {
452
452
  case "create":
453
453
  case "o2m-create":
454
- return t === "o2m-create" ? e.o2m ? `${L(e.o2m)}${c}` : `added related rows${c}` : r === "nivaro_settings" ? "saved the settings" : `created ${o ?? u}`;
454
+ return t === "o2m-create" ? e.o2m ? `${R(e.o2m)}${c}` : `added related rows${c}` : r === "nivaro_settings" ? "saved the settings" : `created ${o ?? u}`;
455
455
  case "update":
456
456
  case "o2m-update": {
457
457
  if (t === "o2m-update")
458
- return e.o2m ? `${L(e.o2m)}${c}` : `changed related rows${c}`;
459
- const l = M(e);
458
+ return e.o2m ? `${R(e.o2m)}${c}` : `changed related rows${c}`;
459
+ const l = U(e);
460
460
  if (r === "nivaro_settings")
461
- return l.length ? `changed the ${y(r, l, n)} setting${l.length === 1 ? "" : "s"}` : "changed the settings";
461
+ return l.length ? `changed the ${I(r, l, n)} setting${l.length === 1 ? "" : "s"}` : "changed the settings";
462
462
  if (r === "nivaro_approval_instances" && ((m = e.why) != null && m.approval)) {
463
- const p = e.why.approval, A = I(p.collection, p.item, n);
464
- return `${(x[i(p.decision).toLowerCase()] ?? i(p.decision).toLowerCase()) || "decided on"} ${A ?? o ?? "an approval"}${p.chain ? ` (${p.chain})` : ""}`;
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})` : ""}`;
465
465
  }
466
466
  if (l.length) {
467
- const p = ((_ = e.changes) == null ? void 0 : _.length) === 1 ? e.changes[0] : null;
468
- return p && "value" in p && J(r, p.field, p.value, n) ? `set ${D(r, p.field, n)} to ${K(r, p.field, p.value, n)}${c}` : `changed ${y(r, l, n)}${c}`;
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}`;
469
469
  }
470
470
  return `updated ${o ?? u}`;
471
471
  }
472
472
  case "delete":
473
473
  case "o2m-delete":
474
- return t === "o2m-delete" ? e.o2m ? `${L(e.o2m)}${c}` : `removed related rows${c}` : `deleted ${o ?? u}`;
474
+ return t === "o2m-delete" ? e.o2m ? `${R(e.o2m)}${c}` : `removed related rows${c}` : `deleted ${o ?? u}`;
475
475
  case "restore":
476
476
  return `restored ${o ?? u}`;
477
477
  case "pipeline-start": {
@@ -485,31 +485,31 @@ function ae(e, n) {
485
485
  case "login-refused":
486
486
  return "was refused sign-in";
487
487
  case "export": {
488
- const l = se(a);
488
+ const l = ce(a);
489
489
  return `exported ${l.rows != null ? b(l.rows, r, n) : g(s.plural)}${l.format ? ` to ${l.format}` : ""}`;
490
490
  }
491
491
  case "masquerade-start":
492
- return `started viewing as ${w(e, n, a)}`;
492
+ return `started viewing as ${S(e, n, a)}`;
493
493
  case "masquerade-stop":
494
- return `stopped viewing as ${w(e, n, a)}`;
494
+ return `stopped viewing as ${S(e, n, a)}`;
495
495
  case "token.generate":
496
- return `generated a static token for ${w(e, n, "")}`;
496
+ return `generated a static token for ${S(e, n, "")}`;
497
497
  case "token.revoke":
498
- return `revoked the static token of ${w(e, n, "")}`;
498
+ return `revoked the static token of ${S(e, n, "")}`;
499
499
  case "api_key_created":
500
- return `created ${o && o !== S ? o : "an API key"}`;
500
+ return `created ${o && o !== x ? o : "an API key"}`;
501
501
  case "api_key_revoked":
502
- return `revoked ${o && o !== S ? o : "an API key"}`;
502
+ return `revoked ${o && o !== x ? o : "an API key"}`;
503
503
  case "api_key_deleted":
504
- return `deleted ${o && o !== S ? o : "an API key"}`;
504
+ return `deleted ${o && o !== x ? o : "an API key"}`;
505
505
  case "api_key_simulate":
506
- return `tested requests as ${o && o !== S ? o : "an API key"}`;
506
+ return `tested requests as ${o && o !== x ? o : "an API key"}`;
507
507
  case "set_role":
508
- return `changed the role of ${w(e, n, "")}`;
508
+ return `changed the role of ${S(e, n, "")}`;
509
509
  case "bulk-write":
510
510
  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), A = t === "bulk-action-execute" ? /^(.+?)\s*\([^)]*\)\s+on\s/.exec(a) : null;
512
- return A ? `ran “${A[1]}” on ${p}` : `changed ${p} in bulk`;
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`;
513
513
  }
514
514
  case "import-create":
515
515
  case "import-queue":
@@ -520,6 +520,16 @@ function ae(e, n) {
520
520
  return `had an import into ${g(s.plural)} fail`;
521
521
  case "comment":
522
522
  return `commented${c}`;
523
+ case "file-download": {
524
+ let l = "", p = !1;
525
+ try {
526
+ const L = JSON.parse(a);
527
+ l = typeof L.name == "string" ? L.name : "", p = L.kind === "open";
528
+ } catch {
529
+ }
530
+ const _ = l ? `“${l}”` : "a file";
531
+ return `${p ? "opened" : "downloaded"} ${_}${r === "nivaro_files" ? "" : c}`;
532
+ }
523
533
  case "picker-exclude":
524
534
  return `hid ${o ?? u} from pickers`;
525
535
  case "picker-include":
@@ -534,40 +544,40 @@ function ae(e, n) {
534
544
  return "downloaded a configuration snapshot";
535
545
  }
536
546
  if (!t) return `did something${c}`;
537
- const d = V(t);
538
- 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} ${ie(d.verb, d.noun)}${c}` : `${d.past} ${o ?? "something"}` : `recorded “${Y(t)}”${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}`;
539
549
  }
540
- function w(e, n, t) {
550
+ function S(e, n, t) {
541
551
  const r = i(e.item), o = C(r, n) ?? (t || null);
542
552
  if (o) return o;
543
- const s = e.collection === "nivaro_users" ? I(e.collection, e.item, n) : null;
544
- return s && !Z.test(r) ? s : "someone";
553
+ const s = e.collection === "nivaro_users" ? y(e.collection, e.item, n) : null;
554
+ return s && !Y.test(r) ? s : "someone";
545
555
  }
546
- function ce(e, n) {
547
- return `${B(e, n)} ${ae(e, n)}`;
556
+ function de(e, n) {
557
+ return `${J(e, n)} ${ue(e, n)}`;
548
558
  }
549
- function fe(e) {
559
+ function me(e) {
550
560
  var a, c, d, f;
551
561
  const n = i(e.action), t = i(e.comment);
552
562
  let r = i((a = e.why) == null ? void 0 : a.reason) || null, o = i((c = e.why) == null ? void 0 : c.note) || null;
553
- !o && z.has(n) && !e.event && (o = U(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);
554
- const s = (f = e.why) == null ? void 0 : f.approval, u = s ? `${j(i(s.decision)) || "Decided"}${s.chain ? ` · ${s.chain}` : ""}${s.step != null && s.step !== "" ? ` · step ${s.step}` : ""}${i(s.comment) ? ` — “${i(s.comment)}”` : ""}` : 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;
555
565
  return { reason: r, note: o, approval: u };
556
566
  }
557
- const ue = 6e4;
558
- function W(e) {
567
+ const le = 6e4;
568
+ function F(e) {
559
569
  return e.timestamp ? new Date(e.timestamp).getTime() : Number.NaN;
560
570
  }
561
- function F(e) {
562
- const n = T(e);
571
+ function Z(e) {
572
+ const n = D(e);
563
573
  return `${n.kind}|${i(n.id)}|${i(e.user ?? e.user_id).toUpperCase()}`;
564
574
  }
565
- function de(e) {
575
+ function pe(e) {
566
576
  const n = i(e.action);
567
577
  return !i(e.item) && (n.startsWith("bulk-") || n === "import-complete");
568
578
  }
569
- function me(e, n = {}) {
570
- const t = n.windowMs ?? ue, r = [];
579
+ function $e(e, n = {}) {
580
+ const t = n.windowMs ?? le, r = [];
571
581
  for (const o of e) {
572
582
  const s = r[r.length - 1], u = s == null ? void 0 : s.entries[s.entries.length - 1], a = i(o.group_key);
573
583
  if (s && u) {
@@ -576,7 +586,7 @@ function me(e, n = {}) {
576
586
  s.entries.push(o), s.by = "group_key";
577
587
  continue;
578
588
  }
579
- if (!a && !c && s.by !== "group_key" && i(o.action) === i(u.action) && i(o.collection) === i(u.collection) && i(o.collection) !== "" && F(o) === F(u) && Math.abs(W(u) - W(o)) <= t) {
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) {
580
590
  s.entries.push(o), s.by = "time";
581
591
  continue;
582
592
  }
@@ -585,12 +595,12 @@ function me(e, n = {}) {
585
595
  }
586
596
  return r;
587
597
  }
588
- function $e(e, n) {
598
+ function he(e, n) {
589
599
  if (e.length === 0) return "";
590
- const t = e.filter((m) => !de(m)), r = t[0] ?? e[0];
591
- if (t.length <= 1) return ce(r, n);
592
- const o = B(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) ? I(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(
593
- t.map((m) => z.has(i(m.action)) ? "transition" : i(m.action))
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))
594
604
  );
595
605
  if ($.size !== 1) return `${o} made ${t.length} changes to ${d}`;
596
606
  const h = [...$][0];
@@ -598,38 +608,38 @@ function $e(e, n) {
598
608
  const m = new Set(
599
609
  t.map((l) => {
600
610
  var p;
601
- return i(((p = l.event) == null ? void 0 : p.to_label) ?? U(l.comment).to);
611
+ return i(((p = l.event) == null ? void 0 : p.to_label) ?? z(l.comment).to);
602
612
  })
603
- ), _ = m.size === 1 ? [...m][0] : "";
604
- return `${o} moved ${d}${_ ? ` to ${_}` : ""}${f}`;
613
+ ), k = m.size === 1 ? [...m][0] : "";
614
+ return `${o} moved ${d}${k ? ` to ${k}` : ""}${f}`;
605
615
  }
606
616
  if (h === "update") {
607
- const m = le(t, u, n);
617
+ const m = fe(t, u, n);
608
618
  return `${o} updated ${d}${f}${m ? `: ${m}` : ""}`;
609
619
  }
610
620
  if (h === "create") return `${o} created ${d}`;
611
621
  if (h === "delete") return `${o} deleted ${d}`;
612
622
  if (h === "picker-exclude") return `${o} hid ${d} from pickers${f}`;
613
623
  if (h === "picker-include") return `${o} showed ${d} in pickers again${f}`;
614
- const v = V(h);
615
- return v.past ? `${o} ${v.past} ${d}${v.noun && !g(N(u, n).plural).toLowerCase().includes(v.noun) ? ` (${v.noun})` : ""}${f}` : `${o} recorded “${Y(h)}” on ${d}`;
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}`;
616
626
  }
617
- function le(e, n, t) {
627
+ function fe(e, n, t) {
618
628
  var a;
619
629
  const r = ((a = e[0]) == null ? void 0 : a.changes) ?? null;
620
630
  if (!(r != null && r.length)) {
621
- const c = e.map((d) => M(d).sort().join(","));
622
- return c[0] && c.every((d) => d === c[0]) ? y(n, c[0].split(","), t) : "";
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) : "";
623
633
  }
624
634
  const o = (c) => JSON.stringify((c.changes ?? []).map((d) => [d.field, d.value ?? null]).sort());
625
- if (e.every((c) => o(c) === o(e[0])) && r.length <= 2 && r.every((c) => J(n, c.field, c.value, t)))
635
+ if (e.every((c) => o(c) === o(e[0])) && r.length <= 2 && r.every((c) => V(n, c.field, c.value, t)))
626
636
  return r.map(
627
- (c) => `${D(n, c.field, t)} → ${K(n, c.field, c.value, t)}`
637
+ (c) => `${M(n, c.field, t)} → ${K(n, c.field, c.value, t)}`
628
638
  ).join(", ");
629
639
  const u = new Set(e.flatMap((c) => (c.changes ?? []).map((d) => d.field)));
630
- return y(n, [...u], t);
640
+ return I(n, [...u], t);
631
641
  }
632
- function he(e) {
642
+ function ge(e) {
633
643
  var u;
634
644
  const n = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set(), s = (a, c) => {
635
645
  const d = i(a), f = i(c);
@@ -638,9 +648,9 @@ function he(e) {
638
648
  for (const a of e) {
639
649
  const c = i(a.user ?? a.user_id);
640
650
  c && t.add(c);
641
- const d = T(a);
651
+ const d = D(a);
642
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);
643
- for (const f of M(a)) {
653
+ for (const f of U(a)) {
644
654
  const $ = i(a.collection);
645
655
  $ && r.set(`${$}.${f}`, { collection: $, field: f });
646
656
  }
@@ -653,27 +663,27 @@ function he(e) {
653
663
  };
654
664
  }
655
665
  export {
656
- ue as BURST_WINDOW_MS,
657
- S as HIDDEN_RECORD,
658
- V as actionParts,
659
- he as activityLabelRefs,
660
- ae as activityPredicate,
661
- fe as activityWhy,
662
- B as actorName,
663
- T as actorOf,
664
- ne as choiceText,
665
- N as collectionNouns,
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,
666
676
  b as countNoun,
667
- D as fieldLabel,
668
- y as fieldList,
669
- me as groupActivity,
670
- L as o2mSentence,
671
- ee as parseActor,
672
- U as parseTransitionComment,
673
- Y as readableTitle,
674
- I as recordPhrase,
675
- $e as renderActivityGroupSentence,
676
- ce as renderActivitySentence,
677
- J as valueShowable,
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,
678
688
  K as valueText
679
689
  };