@nivaro/react 0.3.56 → 0.3.58

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 (55) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +9 -2
  4. package/dist/shared/components/CollectionBrowserView.js +2827 -2750
  5. package/dist/shared/components/DataTable.js +247 -236
  6. package/dist/shared/components/ItemEditForm.js +1693 -1668
  7. package/dist/shared/components/ProfileView.js +716 -715
  8. package/dist/shared/components/RecordReadView.js +367 -364
  9. package/dist/shared/components/ReportView.js +64 -39
  10. package/dist/shared/components/alerts/AlertManagerView.js +284 -271
  11. package/dist/shared/components/cbv/row-focus.js +19 -0
  12. package/dist/shared/components/help-videos/HelpVideoPlayer.js +152 -147
  13. package/dist/shared/components/integrations/console/SignalCard.js +59 -59
  14. package/dist/shared/components/integrations/console/tone.js +52 -30
  15. package/dist/shared/components/item-edit/CatalogPickerField.js +525 -505
  16. package/dist/shared/components/item-edit/FieldRow.js +175 -173
  17. package/dist/shared/components/item-edit/InlineTableField.js +407 -402
  18. package/dist/shared/components/item-edit/M2MCombobox.js +313 -291
  19. package/dist/shared/components/item-edit/MidairCollisionDialog.js +1 -1
  20. package/dist/shared/components/item-edit/PlanGrid.js +826 -803
  21. package/dist/shared/components/item-edit/QuickCreateButton.js +115 -79
  22. package/dist/shared/components/item-edit/RecordLiveSync.js +77 -75
  23. package/dist/shared/components/item-edit/RelationCombobox.js +412 -328
  24. package/dist/shared/components/item-edit/RelationGroupedCombobox.js +147 -125
  25. package/dist/shared/components/item-edit/SummaryPanel.js +406 -392
  26. package/dist/shared/components/item-edit/option-disambiguate.js +44 -32
  27. package/dist/shared/components/item-edit/related-missing.js +45 -0
  28. package/dist/shared/components/item-edit/save-outcome.js +5 -5
  29. package/dist/shared/components/notifications/NotificationRulesEditor.js +130 -123
  30. package/dist/shared/components/panels/AccessDeniedPanel.js +52 -48
  31. package/dist/shared/components/panels/ItemLockBanner.js +2 -3
  32. package/dist/shared/components/panels/PipelinePanel.js +1027 -978
  33. package/dist/shared/components/panels/RevisionsPanel.js +4 -1
  34. package/dist/shared/components/panels/TaskPanel.js +265 -249
  35. package/dist/shared/components/panels/landing-state.js +27 -0
  36. package/dist/shared/components/pipeline/PipelineEditorView.js +86 -78
  37. package/dist/shared/components/profile/AiMemoryCard.js +12 -10
  38. package/dist/shared/components/queue/OwnerAvatars.js +80 -41
  39. package/dist/shared/components/queue/QueueItemSheet.js +111 -111
  40. package/dist/shared/components/queue/QueueQuickFilters.js +48 -48
  41. package/dist/shared/components/queue/QueueWorklist.js +975 -964
  42. package/dist/shared/components/queue/group-sums.js +27 -0
  43. package/dist/shared/components/queue/live-state-aspect.js +7 -3
  44. package/dist/shared/components/queue/path-label.js +14 -0
  45. package/dist/shared/components/widgets/ReviewListWidget.js +186 -168
  46. package/dist/shared/lib/back-closes.js +25 -0
  47. package/dist/shared/lib/cbv-page-warm.js +36 -0
  48. package/dist/shared/lib/form-usage-beacon.js +7 -7
  49. package/dist/shared/lib/list-page-memory.js +41 -0
  50. package/dist/shared/lib/live.js +44 -44
  51. package/dist/shared/lib/own-writes.js +76 -28
  52. package/dist/shared/lib/record-ref.js +78 -53
  53. package/dist/shared/lib/request-gate.js +110 -109
  54. package/dist/shared/lib/validation-rules.js +34 -19
  55. package/package.json +1 -1
@@ -0,0 +1,25 @@
1
+ import { useRef as a, useEffect as w } from "react";
2
+ let d = 0;
3
+ function f(e, t = !0) {
4
+ const o = a(e);
5
+ o.current = e, w(() => {
6
+ if (!t || typeof window > "u") return;
7
+ const r = `nvr-dialog-${++d}`, n = () => {
8
+ var u;
9
+ return ((u = window.history.state) == null ? void 0 : u.nvrDialog) === r;
10
+ };
11
+ window.history.pushState({ ...window.history.state ?? {}, nvrDialog: r }, "");
12
+ let s = !1;
13
+ const i = () => {
14
+ n() || (s = !0, o.current());
15
+ };
16
+ return window.addEventListener("popstate", i), () => {
17
+ window.removeEventListener("popstate", i), s || setTimeout(() => {
18
+ n() && window.history.back();
19
+ }, 0);
20
+ };
21
+ }, [t]);
22
+ }
23
+ export {
24
+ f as useBackCloses
25
+ };
@@ -0,0 +1,36 @@
1
+ const a = (e) => e.startsWith("directus_") || e.startsWith("nivaro_");
2
+ function d(e) {
3
+ var f;
4
+ const { qc: r, collection: l, rows: c } = e;
5
+ if (c.length !== 0) {
6
+ if (e.resolveList.length > 0) {
7
+ const i = c.map((n) => String(n.id)).join(",");
8
+ r.prefetchQuery({
9
+ queryKey: ["cbv-resolved", l, i, e.resolveList.join(",")],
10
+ queryFn: () => e.fetchResolved(i),
11
+ staleTime: 3e4
12
+ });
13
+ }
14
+ for (const i of e.columns) {
15
+ if (e.isResolvedCol(i)) continue;
16
+ const n = (f = e.relations.find(
17
+ (o) => o.many_collection === l && o.many_field === i && o.one_collection
18
+ )) == null ? void 0 : f.one_collection;
19
+ if (!n) continue;
20
+ const u = /* @__PURE__ */ new Set();
21
+ for (const o of c) {
22
+ const s = o[i];
23
+ if (s == null || s === "") continue;
24
+ const t = String(s);
25
+ u.has(t) || (u.add(t), n === "nivaro_users" ? r.prefetchQuery({ ...e.userCardQuery(t), staleTime: 12e4 }) : a(n) || r.prefetchQuery({
26
+ queryKey: ["cbv-relation-item", n, t],
27
+ queryFn: () => e.fetchRelation(n, t),
28
+ staleTime: 30 * 6e4
29
+ }));
30
+ }
31
+ }
32
+ }
33
+ }
34
+ export {
35
+ d as warmPageLookups
36
+ };
@@ -4,7 +4,7 @@ var o = (t, e, n) => g(t, typeof e != "symbol" ? e + "" : e, n);
4
4
  const l = [];
5
5
  let h = null, c = null, p = !1;
6
6
  const v = 20, m = 15e3;
7
- function a() {
7
+ function d() {
8
8
  if (c && (clearTimeout(c), c = null), !h || l.length === 0) return;
9
9
  const { apiBase: t, authHeaders: e, credentials: n } = h;
10
10
  for (; l.length; ) {
@@ -24,12 +24,12 @@ function a() {
24
24
  }
25
25
  }
26
26
  function y() {
27
- p || typeof window > "u" || (p = !0, window.addEventListener("pagehide", a), document.addEventListener("visibilitychange", () => {
28
- document.visibilityState === "hidden" && a();
27
+ p || typeof window > "u" || (p = !0, window.addEventListener("pagehide", d), document.addEventListener("visibilitychange", () => {
28
+ document.visibilityState === "hidden" && d();
29
29
  }));
30
30
  }
31
31
  function O(t, e) {
32
- h = e, l.push(t), y(), l.length >= v ? a() : c || (c = setTimeout(a, m));
32
+ h = e, l.push(t), y(), l.length >= v ? d() : c || (c = setTimeout(d, m));
33
33
  }
34
34
  class _ {
35
35
  constructor(e, n, i = !0) {
@@ -78,8 +78,8 @@ class A {
78
78
  this.tries++;
79
79
  for (const s of i.slice(0, 60)) {
80
80
  this.fields[s] || (this.fields[s] = { required: 0, invalid: 0 });
81
- const d = this.fields[s], u = e[s] ?? "";
82
- n === "required" || n == null && (u === "This field is required" || /^At least one .+ is required$/.test(u)) ? d.required++ : d.invalid++;
81
+ const u = this.fields[s], a = e[s] ?? "";
82
+ n === "required" || n == null && (a === "This field is required" || a === "Add at least one line" || /^At least one .+ is required$/.test(a)) ? u.required++ : u.invalid++;
83
83
  }
84
84
  }
85
85
  }
@@ -161,7 +161,7 @@ export {
161
161
  A as RefusalTally,
162
162
  N as SectionTally,
163
163
  _ as StepClock,
164
- a as flushFormUsage,
164
+ d as flushFormUsage,
165
165
  B as onSectionUse,
166
166
  O as queueFormUsage,
167
167
  j as reportSectionUse,
@@ -0,0 +1,41 @@
1
+ const c = "nvr:list-page:";
2
+ function l() {
3
+ var t;
4
+ if (typeof window > "u") return null;
5
+ const e = (t = window.history) == null ? void 0 : t.state;
6
+ return typeof (e == null ? void 0 : e.key) == "string" && e.key ? e.key : null;
7
+ }
8
+ function f(e, t) {
9
+ return `${c}${e}|${t}`;
10
+ }
11
+ function a(e, t = l()) {
12
+ if (!t) return null;
13
+ try {
14
+ const r = window.sessionStorage.getItem(f(e, t)), n = r == null ? Number.NaN : Number(r);
15
+ return Number.isInteger(n) && n > 1 && n < 1e5 ? n : null;
16
+ } catch {
17
+ return null;
18
+ }
19
+ }
20
+ function m(e, t, r = l()) {
21
+ if (r)
22
+ try {
23
+ const n = window.sessionStorage, u = f(e, r);
24
+ if (!(t > 1)) {
25
+ n.removeItem(u);
26
+ return;
27
+ }
28
+ n.setItem(u, String(Math.floor(t)));
29
+ const i = [];
30
+ for (let o = 0; o < n.length; o++) {
31
+ const s = n.key(o);
32
+ s != null && s.startsWith(c) && i.push(s);
33
+ }
34
+ for (const o of i.slice(0, Math.max(0, i.length - 50))) n.removeItem(o);
35
+ } catch {
36
+ }
37
+ }
38
+ export {
39
+ m as rememberListPage,
40
+ a as rememberedListPage
41
+ };
@@ -1,10 +1,10 @@
1
- import { useContext as j, useRef as h, useEffect as S } from "react";
2
- import { ItemEditAuthContext as k } from "../context.js";
3
- import { releaseLiveOwner as x, deliverLive as _ } from "./focus-mode.js";
1
+ import { useContext as _, useRef as h, useEffect as E } from "react";
2
+ import { ItemEditAuthContext as j } from "../context.js";
3
+ import { releaseLiveOwner as T, deliverLive as x } from "./focus-mode.js";
4
4
  import { isOwnWrite as F } from "./own-writes.js";
5
5
  import { noteOwnWrite as ee, noteOwnWriteFromCommand as ne } from "./own-writes.js";
6
- import { useOptionalRealtime as E } from "./realtime.js";
7
- const A = "nvr:live-event";
6
+ import { useOptionalRealtime as C } from "./realtime.js";
7
+ const $ = "nvr:live-event";
8
8
  function U(n, ...o) {
9
9
  return n.changedFields === null ? !n.aspectsOnly : o.some((e) => {
10
10
  var t;
@@ -20,7 +20,7 @@ const P = {
20
20
  /** An edit lock was taken or released (list rows show the lock icon). */
21
21
  lock: "$lock"
22
22
  };
23
- function T(n) {
23
+ function k(n) {
24
24
  for (const o of ["by", "user", "user_id"]) {
25
25
  const e = n[o];
26
26
  if (typeof e == "string" && e) return e;
@@ -30,17 +30,17 @@ function T(n) {
30
30
  return null;
31
31
  }
32
32
  function N(n, o) {
33
- const e = T(n);
33
+ const e = k(n);
34
34
  if (e && o && e.toUpperCase() === o.toUpperCase()) return !0;
35
- const t = typeof n.collection == "string" ? n.collection : "";
36
- return t !== "" && n.item != null && F(t, n.item);
35
+ const t = typeof n.collection == "string" ? n.collection : "", r = Array.isArray(n.changed_fields) ? n.changed_fields : null;
36
+ return t !== "" && n.item != null && F(t, n.item, r);
37
37
  }
38
38
  function V(n) {
39
39
  if (!n.coalesced) return [n];
40
40
  const { coalesced: o, items: e, many: t, count: r, ...c } = n;
41
41
  return t || !Array.isArray(e) ? [{ ...c, item: "*", ...typeof r == "number" ? { bulk: r } : {} }] : e.map((i) => ({ ...c, item: i }));
42
42
  }
43
- function $(n) {
43
+ function v(n) {
44
44
  const o = [...new Set(n.map((r) => String(r.item)))];
45
45
  let e = /* @__PURE__ */ new Set(), t = n.length > 0;
46
46
  for (const r of n) {
@@ -62,35 +62,35 @@ function $(n) {
62
62
  };
63
63
  }
64
64
  function q(n, o, e = {}) {
65
- const t = E(), { userId: r } = j(k), c = h(o);
65
+ const t = C(), { userId: r } = _(j), c = h(o);
66
66
  c.current = o;
67
67
  const i = h(e);
68
68
  i.current = e;
69
69
  const s = h(r);
70
70
  s.current = r;
71
- const a = h({}), p = (n == null ? [] : Array.isArray(n) ? n : [n]).filter(Boolean).join(","), w = e.enabled !== !1;
72
- S(() => {
71
+ const f = h({}), p = (n == null ? [] : Array.isArray(n) ? n : [n]).filter(Boolean).join(","), w = e.enabled !== !1;
72
+ E(() => {
73
73
  if (!t || !p || !w) return;
74
74
  const g = p.split(",");
75
- let f = [], y = null;
75
+ let a = [], y = null;
76
76
  const O = () => {
77
77
  y = null;
78
- const u = f;
79
- f = [], u.length !== 0 && (i.current.focusable ? _(a.current, u, (l) => c.current($(l))) : c.current($(u)));
80
- }, C = t.subscribeCollections(g, (u) => {
78
+ const u = a;
79
+ a = [], u.length !== 0 && (i.current.focusable ? x(f.current, u, (l) => c.current(v(l))) : c.current(v(u)));
80
+ }, A = t.subscribeCollections(g, (u) => {
81
81
  const l = u;
82
82
  if (!l || !g.includes(String(l.collection))) return;
83
83
  const d = i.current;
84
84
  for (const b of V(l)) {
85
85
  const R = { ...b, own: N(b, s.current) };
86
- R.own && !d.includeOwn || d.match && !d.match(R) || f.push(R);
86
+ R.own && !d.includeOwn || d.match && !d.match(R) || a.push(R);
87
87
  }
88
- if (f.length === 0) return;
88
+ if (a.length === 0) return;
89
89
  const m = d.debounceMs ?? 250;
90
90
  m <= 0 ? O() : y || (y = setTimeout(O, m));
91
91
  });
92
92
  return () => {
93
- C(), y && clearTimeout(y), x(a.current);
93
+ A(), y && clearTimeout(y), T(f.current);
94
94
  };
95
95
  }, [t, p, w]);
96
96
  }
@@ -109,32 +109,32 @@ function z(n, o, e, t = {}) {
109
109
  n,
110
110
  o,
111
111
  (i) => {
112
- var a;
112
+ var f;
113
113
  const s = t.aspects;
114
114
  if (!(s && s.length > 0 && i.changedFields !== null && !U(i, ...s)))
115
- for (const L of r.current) (a = c.current) == null || a.invalidateQueries({ queryKey: L });
115
+ for (const L of r.current) (f = c.current) == null || f.invalidateQueries({ queryKey: L });
116
116
  },
117
117
  t
118
118
  );
119
119
  }
120
120
  function K(n, o, e = {}) {
121
- const t = E(), { userId: r } = j(k), c = h(o);
121
+ const t = C(), { userId: r } = _(j), c = h(o);
122
122
  c.current = o;
123
123
  const i = h(e);
124
124
  i.current = e;
125
125
  const s = h(r);
126
126
  s.current = r;
127
- const a = (Array.isArray(n) ? n : [n]).join(","), L = e.enabled !== !1;
128
- S(() => {
129
- if (!L || !a) return;
130
- const p = a.split(",");
131
- let w = null, g = null, f = null;
127
+ const f = (Array.isArray(n) ? n : [n]).join(","), L = e.enabled !== !1;
128
+ E(() => {
129
+ if (!L || !f) return;
130
+ const p = f.split(",");
131
+ let w = null, g = null, a = null;
132
132
  const y = (u, l) => {
133
133
  if (!p.includes(u)) return;
134
134
  const d = i.current, m = l ?? {};
135
135
  if (!d.includeOwn && typeof m == "object") {
136
- const v = T(m);
137
- if (v && s.current && v.toUpperCase() === s.current.toUpperCase())
136
+ const W = k(m);
137
+ if (W && s.current && W.toUpperCase() === s.current.toUpperCase())
138
138
  return;
139
139
  }
140
140
  if (d.match && !d.match(m)) return;
@@ -146,24 +146,24 @@ function K(n, o, e = {}) {
146
146
  const R = Date.now();
147
147
  if (w && w.sig === b && R - w.at < 150) return;
148
148
  w = { sig: b, at: R };
149
- const W = d.debounceMs ?? 0;
150
- if (W <= 0) {
149
+ const S = d.debounceMs ?? 0;
150
+ if (S <= 0) {
151
151
  c.current(m, u);
152
152
  return;
153
153
  }
154
- f = { payload: m, event: u }, g || (g = setTimeout(() => {
155
- g = null, f && c.current(f.payload, f.event), f = null;
156
- }, W));
154
+ a = { payload: m, event: u }, g || (g = setTimeout(() => {
155
+ g = null, a && c.current(a.payload, a.event), a = null;
156
+ }, S));
157
157
  }, O = p.map((u) => (t == null ? void 0 : t.on(u, (l) => y(u, l))) ?? (() => {
158
- })), C = (u) => {
158
+ })), A = (u) => {
159
159
  const l = u.detail;
160
160
  l != null && l.event && y(l.event, l.payload);
161
161
  };
162
- return window.addEventListener(A, C), () => {
162
+ return window.addEventListener($, A), () => {
163
163
  for (const u of O) u();
164
- window.removeEventListener(A, C), g && clearTimeout(g);
164
+ window.removeEventListener($, A), g && clearTimeout(g);
165
165
  };
166
- }, [t, a, L]);
166
+ }, [t, f, L]);
167
167
  }
168
168
  function G(n, o, e, t, r = {}) {
169
169
  const c = e == null || e === "new" ? null : String(e), i = r.match;
@@ -174,24 +174,24 @@ function G(n, o, e, t, r = {}) {
174
174
  });
175
175
  }
176
176
  function H(n, o = !0) {
177
- const e = E(), t = !!(e != null && e.joinWatch);
178
- return S(() => {
177
+ const e = C(), t = !!(e != null && e.joinWatch);
178
+ return E(() => {
179
179
  if (!(!o || !(e != null && e.joinWatch)))
180
180
  return e.joinWatch(n);
181
181
  }, [e, n, o]), t && o;
182
182
  }
183
183
  function X() {
184
- return E() != null;
184
+ return C() != null;
185
185
  }
186
186
  export {
187
187
  P as LIVE_ASPECTS,
188
- A as LIVE_WINDOW_EVENT,
188
+ $ as LIVE_WINDOW_EVENT,
189
189
  U as batchTouches,
190
190
  V as expandCoalesced,
191
191
  F as isOwnWrite,
192
192
  ee as noteOwnWrite,
193
193
  ne as noteOwnWriteFromCommand,
194
- $ as toLiveBatch,
194
+ v as toLiveBatch,
195
195
  X as useLiveAvailable,
196
196
  q as useLiveCollection,
197
197
  K as useLiveEvent,
@@ -1,36 +1,84 @@
1
- const l = /* @__PURE__ */ new Map();
2
- function p(o, n) {
3
- return `${o}:${n == null ? "*" : String(n)}`;
1
+ const _ = /* @__PURE__ */ new Map();
2
+ function p(e, r) {
3
+ return `${e}:${r == null ? "*" : String(r)}`;
4
4
  }
5
- function a(o, n, i = 6e3) {
6
- if (!o) return;
7
- const e = Date.now();
8
- if (l.set(p(o, n), e + i), l.size > 200)
9
- for (const [f, c] of l) c < e && l.delete(f);
5
+ function f(e, r, n = 6e3, o) {
6
+ if (!e) return;
7
+ const s = Date.now(), i = p(e, r), l = o && o.length > 0 ? new Set(o) : null, u = _.get(i), c = u && u.exp >= s ? u : null, T = !l || c && !c.fields ? null : c != null && c.fields ? /* @__PURE__ */ new Set([...c.fields, ...l]) : l;
8
+ if (_.set(i, { exp: s + n, fields: T }), _.size > 200)
9
+ for (const [A, E] of _) E.exp < s && _.delete(A);
10
10
  }
11
- function w(o, n) {
12
- const i = Date.now(), e = l.get(p(o, n));
13
- return e != null && e >= i;
11
+ function M(e, r, n) {
12
+ const o = _.get(p(e, r));
13
+ return !o || o.exp < Date.now() ? !1 : !o.fields || !n || n.length === 0 ? !0 : n.some((s) => {
14
+ var i;
15
+ return (i = o.fields) == null ? void 0 : i.has(s);
16
+ });
14
17
  }
15
- const T = /^\/items\/([A-Za-z_][A-Za-z0-9_]*)(?:\/([^/?#]+))?/, m = /^\/pipelines\/instance\/([A-Za-z_][A-Za-z0-9_]*)\/([^/?#]+)/, W = /^\/addendums\/([A-Za-z_][A-Za-z0-9_]*)\/([^/?#]+)/;
16
- function E(o, n, i, e) {
17
- var u;
18
- if ((o ?? "GET").toUpperCase() === "GET" || !n) return;
19
- const c = n.split("?")[0], _ = T.exec(c);
20
- if (_) {
21
- const [, t, s] = _;
22
- s && !["batch", "bulk", "batch-read", "aggregate", "export"].includes(s) && a(t, decodeURIComponent(s));
23
- const d = (u = e == null ? void 0 : e.data) == null ? void 0 : u.id;
24
- d != null && a(t, d);
18
+ const w = /^\/items\/([A-Za-z_][A-Za-z0-9_]*)\/([^/?#]+)$/, O = /^\/items\/([A-Za-z_][A-Za-z0-9_]*)$/, I = /^\/items\/([A-Za-z_][A-Za-z0-9_]*)\/(batch|bulk)$/, S = /^\/pipelines\/instance\/([A-Za-z_][A-Za-z0-9_]*)\/([^/?#]+)/, y = /^\/addendums\/([A-Za-z_][A-Za-z0-9_]*)\/([^/?#]+)/, N = /* @__PURE__ */ new Set(["batch", "bulk", "batch-read", "aggregate", "export", "auto-id-preview"]), R = [
19
+ [/^\/comments(\/|$)/, ["$comments"]],
20
+ [/^\/tasks(\/|$)/, ["$tasks"]],
21
+ [/^\/addendums(\/|$)/, ["$addendums"]],
22
+ [/^\/pipelines\/instance\//, ["$state", "$owners"]]
23
+ ];
24
+ function $(e) {
25
+ for (const [r, n] of R) if (r.test(e)) return n;
26
+ return null;
27
+ }
28
+ function m(e) {
29
+ if (!e || typeof e != "object" || Array.isArray(e)) return null;
30
+ const r = Object.keys(e).filter((n) => !n.startsWith("_"));
31
+ return r.length > 0 ? r : null;
32
+ }
33
+ function x(e, r) {
34
+ const n = (s) => s === !0 || s === 1 || s === "1" || s === "true";
35
+ if (r && typeof r == "object" && n(r.dry_run))
36
+ return !0;
37
+ const o = e == null ? void 0 : e.split("?")[1];
38
+ return o ? n(new URLSearchParams(o).get("dry_run")) : !1;
39
+ }
40
+ function z(e, r, n, o) {
41
+ var A, E;
42
+ const s = (e ?? "GET").toUpperCase();
43
+ if (s === "GET" || !r) return;
44
+ const i = r.split("?")[0];
45
+ if (o !== void 0) {
46
+ const t = O.exec(i), a = (A = o == null ? void 0 : o.data) == null ? void 0 : A.id;
47
+ t && s === "POST" && a != null && f(t[1], a);
48
+ return;
49
+ }
50
+ const l = I.exec(i);
51
+ if (l) {
52
+ const t = n, a = Array.isArray(t) ? t : Array.isArray(t == null ? void 0 : t.update) ? t.update : Array.isArray(t == null ? void 0 : t.rows) ? t.rows : [];
53
+ for (const d of a)
54
+ d && typeof d == "object" && d.id != null && f(
55
+ l[1],
56
+ d.id,
57
+ 6e3,
58
+ ((E = m(d)) == null ? void 0 : E.filter((W) => W !== "id")) ?? null
59
+ );
60
+ return;
61
+ }
62
+ const u = w.exec(i);
63
+ if (u) {
64
+ const [, t, a] = u;
65
+ N.has(a) || f(
66
+ t,
67
+ decodeURIComponent(a),
68
+ 6e3,
69
+ s === "DELETE" ? null : m(n)
70
+ );
71
+ return;
25
72
  }
26
- const r = m.exec(c) ?? W.exec(c);
27
- if (r && a(r[1], decodeURIComponent(r[2])), i && typeof i == "object") {
28
- const t = i;
29
- typeof t.collection == "string" && t.item != null && a(t.collection, t.item), typeof t.parent_collection == "string" && t.parent_id != null && a(t.parent_collection, t.parent_id);
73
+ const c = $(i), T = S.exec(i) ?? y.exec(i);
74
+ if (T && f(T[1], decodeURIComponent(T[2]), 6e3, c), n && typeof n == "object" && !Array.isArray(n)) {
75
+ const t = n;
76
+ typeof t.collection == "string" && t.item != null && f(t.collection, t.item, 6e3, c), typeof t.parent_collection == "string" && t.parent_id != null && f(t.parent_collection, t.parent_id, 6e3, c);
30
77
  }
31
78
  }
32
79
  export {
33
- w as isOwnWrite,
34
- a as noteOwnWrite,
35
- E as noteOwnWriteFromCommand
80
+ M as isOwnWrite,
81
+ x as isRehearsalCommand,
82
+ f as noteOwnWrite,
83
+ z as noteOwnWriteFromCommand
36
84
  };
@@ -1,81 +1,106 @@
1
- import { get as c } from "./commands.js";
2
- const o = /^[A-Za-z_][A-Za-z0-9_]*$/;
3
- function a(n) {
4
- const t = n == null ? void 0 : n.friendly_id_field;
5
- return typeof t == "string" && t !== "id" && o.test(t) ? t : null;
1
+ import { get as y } from "./commands.js";
2
+ const s = /^[A-Za-z_][A-Za-z0-9_]*$/;
3
+ function d(e) {
4
+ const n = e == null ? void 0 : e.friendly_id_field;
5
+ return typeof n == "string" && n !== "id" && s.test(n) ? n : null;
6
6
  }
7
- function s(n) {
8
- if (n == null || typeof n == "object") return null;
9
- const t = String(n).trim();
10
- return t === "" ? null : t;
7
+ function f(e) {
8
+ if (e == null || typeof e == "object") return null;
9
+ const n = String(e).trim();
10
+ return n === "" ? null : n;
11
11
  }
12
- function d(n, t) {
13
- const r = a(n);
14
- return r && t ? s(t[r]) : null;
12
+ function a(e, n) {
13
+ const t = d(e);
14
+ return t && n ? f(n[t]) : null;
15
15
  }
16
- function y(n) {
17
- const t = n == null ? void 0 : n.url_alias_fields;
18
- let r = t;
19
- if (typeof t == "string")
16
+ const g = ["title", "name", "label", "subject", "description"];
17
+ function p(e) {
18
+ const n = String(e || "record").replace(/^nivaro_/, "").replace(/_/g, " ").trim().toLowerCase();
19
+ return /ies$/.test(n) ? `${n.slice(0, -3)}y` : /[^s]s$/.test(n) ? n.slice(0, -1) : n || "record";
20
+ }
21
+ function b(e, n, t, r) {
22
+ var c;
23
+ const i = a(e, n);
24
+ if (i) return i;
25
+ if ((t == null || t === "") && !n) return "";
26
+ const l = `No ${p(r)} number`, u = n ? (c = g.map((o) => f(n[o])).find((o) => o != null)) == null ? void 0 : c.replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim() : void 0;
27
+ return u ? `${l} · ${u.length > 60 ? `${u.slice(0, 59)}…` : u}` : l;
28
+ }
29
+ function m(e) {
30
+ const n = e == null ? void 0 : e.url_alias_fields;
31
+ let t = n;
32
+ if (typeof n == "string")
20
33
  try {
21
- r = JSON.parse(t);
34
+ t = JSON.parse(n);
22
35
  } catch {
23
- r = [];
36
+ t = [];
24
37
  }
25
- return Array.isArray(r) ? r.filter((e) => typeof e == "string" && o.test(e)) : [];
38
+ return Array.isArray(t) ? t.filter((r) => typeof r == "string" && s.test(r)) : [];
26
39
  }
27
- function g(n, t) {
28
- if (!t) return null;
29
- const r = y(n);
30
- let e;
31
- if (r.length > 0) {
32
- const i = r.map((l) => s(t[l]));
40
+ function S(e, n) {
41
+ if (!n) return null;
42
+ const t = m(e);
43
+ let r;
44
+ if (t.length > 0) {
45
+ const i = t.map((l) => f(n[l]));
33
46
  if (i.some((l) => l == null)) return null;
34
- e = i.join("-");
47
+ r = i.join("-");
35
48
  } else
36
- e = d(n, t);
37
- return !e || /^\d+$/.test(e) || /^[0-9a-f]{8}-[0-9a-f]{4}-/i.test(e) || e === "new" || e.includes("/") ? null : e;
49
+ r = a(e, n);
50
+ return !r || /^\d+$/.test(r) || /^[0-9a-f]{8}-[0-9a-f]{4}-/i.test(r) || r === "new" || r.includes("/") ? null : r;
38
51
  }
39
- async function S(n, t, r, e, i) {
40
- var f;
41
- const l = g(r, e);
52
+ async function I(e, n, t, r, i) {
53
+ var u;
54
+ const l = S(t, r);
42
55
  if (!l) return String(i);
43
56
  try {
44
- const u = await n.request(
45
- c(`/items/${t}/by-slug/${encodeURIComponent(l)}`, { fields: "id" })
57
+ const c = await e.request(
58
+ y(`/items/${n}/by-slug/${encodeURIComponent(l)}`, { fields: "id" })
46
59
  );
47
- return String(((f = u == null ? void 0 : u.data) == null ? void 0 : f.id) ?? "") === String(i) ? l : String(i);
60
+ return String(((u = c == null ? void 0 : c.data) == null ? void 0 : u.id) ?? "") === String(i) ? l : String(i);
48
61
  } catch {
49
62
  return String(i);
50
63
  }
51
64
  }
52
- async function w(n) {
53
- const t = typeof navigator < "u" ? navigator.clipboard : void 0;
54
- if (!t) return;
55
- const r = globalThis.ClipboardItem;
56
- if (r && typeof t.write == "function")
65
+ async function _(e) {
66
+ const n = typeof navigator < "u" ? navigator.clipboard : void 0;
67
+ if (!n) return;
68
+ const t = globalThis.ClipboardItem;
69
+ if (t && typeof n.write == "function")
57
70
  try {
58
- await t.write([
59
- new r({ "text/plain": n.then((e) => new Blob([e], { type: "text/plain" })) })
71
+ await n.write([
72
+ new t({ "text/plain": e.then((r) => new Blob([r], { type: "text/plain" })) })
60
73
  ]);
61
74
  return;
62
75
  } catch {
63
76
  }
64
- await t.writeText(await n);
77
+ await n.writeText(await e);
78
+ }
79
+ function $(e) {
80
+ return /^No [\w ]+ number( · |$)/.test(String(e ?? ""));
65
81
  }
66
- function p(n) {
67
- return /^No [\w ]+ number( · |$)/.test(String(n ?? ""));
82
+ function h(e) {
83
+ const n = String(e.label ?? "").trim();
84
+ return !n || $(n) ? null : n;
68
85
  }
69
- function h(n) {
70
- const t = String(n.label ?? "").trim();
71
- return !t || p(t) ? null : t;
86
+ function N(e) {
87
+ const n = String(e.label ?? "").trim();
88
+ if (n) return { copy: h({ label: n }), name: n };
89
+ const t = a(e.meta, e.row);
90
+ return t ? { copy: t, name: t } : e.meta ? d(e.meta) ? {
91
+ copy: null,
92
+ name: b(e.meta, e.row, e.id, e.collection)
93
+ } : { copy: String(e.id), name: String(e.id) } : { copy: null, name: "this record" };
72
94
  }
73
95
  export {
74
- g as aliasSegmentOf,
96
+ S as aliasSegmentOf,
75
97
  h as copyIdText,
76
- w as copyWhenReady,
77
- a as friendlyIdFieldOf,
78
- d as friendlyIdOf,
79
- p as isNoNumberLabel,
80
- S as shareableRecordId
98
+ _ as copyWhenReady,
99
+ d as friendlyIdFieldOf,
100
+ a as friendlyIdOf,
101
+ $ as isNoNumberLabel,
102
+ p as recordNoun,
103
+ b as recordRefLabel,
104
+ N as rowMenuRef,
105
+ I as shareableRecordId
81
106
  };