@nivaro/react 0.3.98 → 0.3.100

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 (43) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useFormSchema.js +82 -85
  3. package/dist/hooks/useSessionRecorder.js +206 -175
  4. package/dist/index.d.ts +38 -13
  5. package/dist/index.js +182 -180
  6. package/dist/lib/commands.js +15 -11
  7. package/dist/shared/components/CollectionBrowserView.js +516 -503
  8. package/dist/shared/components/ItemEditForm.js +3021 -3019
  9. package/dist/shared/components/JobsTray.js +20 -16
  10. package/dist/shared/components/MyWorkView.js +133 -126
  11. package/dist/shared/components/NotificationBell.js +314 -288
  12. package/dist/shared/components/RecordCompare.js +38 -40
  13. package/dist/shared/components/RecordReadView.js +119 -119
  14. package/dist/shared/components/cbv/FoundElsewhere.js +61 -0
  15. package/dist/shared/components/item-edit/InlineGridField.js +45 -45
  16. package/dist/shared/components/item-edit/InlineTableField.js +750 -749
  17. package/dist/shared/components/item-edit/QuickPickerDialog.js +44 -44
  18. package/dist/shared/components/item-edit/RawEditSheet.js +122 -114
  19. package/dist/shared/components/item-edit/RelationCombobox.js +454 -378
  20. package/dist/shared/components/item-edit/SummaryPanel.js +56 -48
  21. package/dist/shared/components/item-edit/related-missing.js +75 -19
  22. package/dist/shared/components/notifications/NotificationCenterView.js +249 -226
  23. package/dist/shared/components/panels/AccessDeniedPanel.js +31 -28
  24. package/dist/shared/components/panels/BackgroundMove.js +175 -0
  25. package/dist/shared/components/panels/MoveAdvisory.js +204 -0
  26. package/dist/shared/components/panels/PipelinePanel.js +1450 -1219
  27. package/dist/shared/components/panels/RecordIntegrityBanner.js +113 -112
  28. package/dist/shared/lib/commands.js +18 -14
  29. package/dist/shared/lib/error-hints.js +1 -1
  30. package/dist/shared/lib/job-failure-text.js +12 -0
  31. package/dist/shared/lib/move-failure.js +9 -0
  32. package/dist/shared/lib/obligation-banner.js +15 -14
  33. package/dist/shared/lib/partner-failure.js +71 -0
  34. package/dist/shared/lib/prefetch.js +73 -73
  35. package/dist/shared/lib/replay-checkout.js +18 -13
  36. package/dist/shared/lib/replay-context.js +90 -77
  37. package/dist/shared/lib/replay-idle.js +21 -0
  38. package/dist/shared/lib/replay-socket.js +21 -17
  39. package/dist/shared/lib/rum.js +56 -51
  40. package/dist/shared/lib/safe-error.js +17 -13
  41. package/dist/shared/lib/stale-chunk.js +69 -26
  42. package/dist/shared/lib/system-collections.js +20 -0
  43. package/package.json +1 -1
@@ -1,144 +1,157 @@
1
- import { pagePattern as b } from "./page-context.js";
2
- const R = ["warn", "error"], A = 200, U = 500, N = 1e3, u = "[redacted]", T = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
3
- function C(t) {
4
- return String(t).replace(
1
+ import { pagePattern as _ } from "./page-context.js";
2
+ const L = ["warn", "error"], T = 200, O = 500, U = 1e3, u = "[redacted]", N = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
3
+ function v(e) {
4
+ return String(e).replace(
5
5
  /([\w.-]*(?:token|secret|password|passwd|api[_-]?key|authorization|cookie)[\w.-]*)(["']?\s*[:=]\s*["']?)((?:(?:bearer|basic)\s+)?[^\s"'&,;}\])]+)/gi,
6
- (e, n, o, i) => i === u ? e : `${n}${o}${u}`
6
+ (t, o, n, c) => c === u ? t : `${o}${n}${u}`
7
7
  ).replace(/\b(bearer)\s+(?!\[redacted\])[\w.~+/=-]+/gi, `$1 ${u}`).replace(
8
8
  /\bBasic\s+([A-Za-z0-9+/]{8,}={0,2})/g,
9
- (e, n) => /[0-9+/=]/.test(n) || /[A-Z]/.test(n.slice(1)) ? `Basic ${u}` : e
10
- ).replace(/\beyJ[\w-]{6,}(?:\.[\w-]*){1,2}/g, u).replace(/[A-Za-z0-9+/_=-]{32,}/g, (e) => T.test(e) ? e : /^[0-9a-f]{32,}$/i.test(e) ? u : e.includes("/") && /[a-z]{3,}\//i.test(e) ? e : /\d/.test(e) && /[a-z]/i.test(e) ? u : e);
9
+ (t, o) => /[0-9+/=]/.test(o) || /[A-Z]/.test(o.slice(1)) ? `Basic ${u}` : t
10
+ ).replace(/\beyJ[\w-]{6,}(?:\.[\w-]*){1,2}/g, u).replace(/[A-Za-z0-9+/_=-]{32,}/g, (t) => N.test(t) ? t : /^[0-9a-f]{32,}$/i.test(t) ? u : t.includes("/") && /[a-z]{3,}\//i.test(t) ? t : /\d/.test(t) && /[a-z]/i.test(t) ? u : t);
11
11
  }
12
- function M(t) {
13
- if (typeof t == "string") return t;
14
- if (t instanceof Error) return `${t.name}: ${t.message}`;
12
+ function C(e) {
13
+ if (typeof e == "string") return e;
14
+ if (e instanceof Error) return `${e.name}: ${e.message}`;
15
15
  try {
16
- return JSON.stringify(t) ?? String(t);
16
+ return JSON.stringify(e) ?? String(e);
17
17
  } catch {
18
- return String(t);
18
+ return String(e);
19
19
  }
20
20
  }
21
- function k(t, e = A) {
22
- const n = t.map(M).join(" ").slice(0, e * 8);
23
- return C(n).slice(0, e);
21
+ function M(e, t = T) {
22
+ const o = e.map(C).join(" ").slice(0, t * 8);
23
+ return v(o).slice(0, t);
24
24
  }
25
- function v(t, e = U) {
25
+ function H(e, t = O) {
26
26
  if (typeof console > "u") return () => {
27
27
  };
28
- let n = 0, o = !1;
29
- const i = {}, f = {};
30
- for (const s of R) {
28
+ let o = 0, n = !1;
29
+ const c = {}, f = {};
30
+ for (const s of L) {
31
31
  const l = console[s];
32
- i[s] = l;
32
+ c[s] = l;
33
33
  const d = (...r) => {
34
- if (l.apply(console, r), !(o || n >= e)) {
35
- o = !0;
34
+ if (l.apply(console, r), !(n || o >= t)) {
35
+ n = !0;
36
36
  try {
37
- n++, t("console", { level: s, msg: k(r) });
37
+ o++, e("console", { level: s, msg: M(r) });
38
38
  } catch {
39
39
  } finally {
40
- o = !1;
40
+ n = !1;
41
41
  }
42
42
  }
43
43
  };
44
44
  f[s] = d, console[s] = d;
45
45
  }
46
46
  return () => {
47
- for (const s of R)
48
- console[s] === f[s] && (console[s] = i[s]);
47
+ for (const s of L)
48
+ console[s] === f[s] && (console[s] = c[s]);
49
49
  };
50
50
  }
51
- function z(t, e) {
51
+ function k(e, t) {
52
52
  try {
53
- const n = e ?? (typeof window < "u" && window.location ? window.location.href : "http://localhost/"), o = new URL(t, n);
54
- if (o.protocol !== "http:" && o.protocol !== "https:") return null;
55
- const i = b(o.pathname);
56
- return o.origin === new URL(n).origin ? i : `${o.host}${i}`;
53
+ const o = t ?? (typeof window < "u" && window.location ? window.location.href : "http://localhost/"), n = new URL(e, o);
54
+ if (n.protocol !== "http:" && n.protocol !== "https:") return null;
55
+ const c = _(n.pathname);
56
+ return n.origin === new URL(o).origin ? c : `${n.host}${c}`;
57
57
  } catch {
58
58
  return null;
59
59
  }
60
60
  }
61
- function q(t, e) {
61
+ const z = [
62
+ /\/api\/presence\/(ping|online|disconnect)\/?$/,
63
+ /\/api\/job-runs\/busy\/?$/,
64
+ /\/api\/announcements\/active\/?$/,
65
+ /\/api\/realtime\/build-status\/?$/,
66
+ /\/api\/notifications\/unread-count\/?$/,
67
+ /\/api\/auth\/ws-token\/?$/,
68
+ /\/api\/analytics\/pageview(\/[^/]*)?\/?$/,
69
+ /\/api\/layout-usage\/beacon\/?$/,
70
+ /\/api\/(health|ready|version)\/?$/,
71
+ /\/version\.json$/,
72
+ /\/api\/items\/[^/]*_presence(\/[^/]*)?\/?$/
73
+ ];
74
+ function q(e, t) {
62
75
  try {
63
- const n = e ?? (typeof window < "u" && window.location ? window.location.href : "http://localhost/"), o = new URL(t, n).pathname;
64
- return /\/session-recordings(\/|$)/.test(o) || /\/rum\/?$/.test(o);
76
+ const o = t ?? (typeof window < "u" && window.location ? window.location.href : "http://localhost/"), n = new URL(e, o).pathname;
77
+ return /\/session-recordings(\/|$)/.test(n) || /\/rum\/?$/.test(n) ? !0 : z.some((c) => c.test(n));
65
78
  } catch {
66
79
  return !1;
67
80
  }
68
81
  }
69
- const $ = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now();
70
- function O(t) {
71
- if (typeof t == "string") return t;
72
- if (typeof URL < "u" && t instanceof URL) return t.href;
73
- const e = t == null ? void 0 : t.url;
74
- return typeof e == "string" ? e : String(t ?? "");
82
+ const S = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now();
83
+ function A(e) {
84
+ if (typeof e == "string") return e;
85
+ if (typeof URL < "u" && e instanceof URL) return e.href;
86
+ const t = e == null ? void 0 : e.url;
87
+ return typeof t == "string" ? t : String(e ?? "");
75
88
  }
76
- function V(t, e = N) {
77
- let n = 0, o = !1;
78
- const i = (a, c, h, S) => {
79
- if (!(o || n >= e))
89
+ function j(e, t = U) {
90
+ let o = 0, n = !1;
91
+ const c = (a, i, h, m) => {
92
+ if (!(n || o >= t))
80
93
  try {
81
- if (q(c)) return;
82
- const p = z(c);
94
+ if (q(i)) return;
95
+ const p = k(i);
83
96
  if (!p) return;
84
- n++;
85
- const m = {
97
+ o++;
98
+ const E = {
86
99
  method: String(a || "GET").toUpperCase().slice(0, 10),
87
100
  route: p,
88
101
  status: Number(h) || 0,
89
- duration_ms: Math.max(0, Math.round($() - S))
102
+ duration_ms: Math.max(0, Math.round(S() - m))
90
103
  };
91
- t("request", m);
104
+ e("request", E);
92
105
  } catch {
93
106
  }
94
107
  }, f = globalThis, s = typeof f.fetch == "function" ? f.fetch : null;
95
108
  let l = null;
96
- s && (l = function(a, c) {
97
- const h = $(), S = s.call(this ?? globalThis, a, c);
109
+ s && (l = function(a, i) {
110
+ const h = S(), m = s.call(this ?? globalThis, a, i);
98
111
  try {
99
- const p = (c == null ? void 0 : c.method) ?? (a == null ? void 0 : a.method) ?? "GET", m = O(a);
100
- S.then(
101
- (_) => i(p, m, _.status, h),
102
- () => i(p, m, 0, h)
112
+ const p = (i == null ? void 0 : i.method) ?? (a == null ? void 0 : a.method) ?? "GET", E = A(a);
113
+ m.then(
114
+ (R) => c(p, E, R.status, h),
115
+ () => c(p, E, 0, h)
103
116
  );
104
117
  } catch {
105
118
  }
106
- return S;
119
+ return m;
107
120
  }, f.fetch = l);
108
- const d = f.XMLHttpRequest, r = d == null ? void 0 : d.prototype, g = r == null ? void 0 : r.open, w = r == null ? void 0 : r.send, L = /* @__PURE__ */ new WeakMap();
109
- let y = null, E = null;
110
- return r && g && w && (y = function(a, c) {
121
+ const d = f.XMLHttpRequest, r = d == null ? void 0 : d.prototype, g = r == null ? void 0 : r.open, w = r == null ? void 0 : r.send, b = /* @__PURE__ */ new WeakMap();
122
+ let y = null, $ = null;
123
+ return r && g && w && (y = function(a, i) {
111
124
  try {
112
- L.set(this, { method: a, url: O(c) });
125
+ b.set(this, { method: a, url: A(i) });
113
126
  } catch {
114
127
  }
115
128
  return g.apply(this, arguments);
116
- }, E = function(a) {
117
- const c = L.get(this);
118
- if (c) {
119
- const h = $();
129
+ }, $ = function(a) {
130
+ const i = b.get(this);
131
+ if (i) {
132
+ const h = S();
120
133
  try {
121
- this.addEventListener("loadend", () => i(c.method, c.url, this.status, h), {
134
+ this.addEventListener("loadend", () => c(i.method, i.url, this.status, h), {
122
135
  once: !0
123
136
  });
124
137
  } catch {
125
138
  }
126
139
  }
127
140
  return w.call(this, a);
128
- }, r.open = y, r.send = E), () => {
129
- o = !0, l && f.fetch === l && s && (f.fetch = s), r && (y && r.open === y && g && (r.open = g), E && r.send === E && w && (r.send = w));
141
+ }, r.open = y, r.send = $), () => {
142
+ n = !0, l && f.fetch === l && s && (f.fetch = s), r && (y && r.open === y && g && (r.open = g), $ && r.send === $ && w && (r.send = w));
130
143
  };
131
144
  }
132
145
  export {
133
- R as CONSOLE_LEVELS,
134
- A as CONSOLE_MAX_CHARS,
135
- U as CONSOLE_MAX_EVENTS,
146
+ L as CONSOLE_LEVELS,
147
+ T as CONSOLE_MAX_CHARS,
148
+ O as CONSOLE_MAX_EVENTS,
136
149
  u as REDACTED,
137
- N as REQUEST_MAX_EVENTS,
138
- k as consoleLine,
139
- v as instrumentConsole,
140
- V as instrumentRequests,
150
+ U as REQUEST_MAX_EVENTS,
151
+ M as consoleLine,
152
+ H as instrumentConsole,
153
+ j as instrumentRequests,
141
154
  q as isRecorderNoise,
142
- C as redactSecrets,
143
- z as requestRoute
155
+ v as redactSecrets,
156
+ k as requestRoute
144
157
  };
@@ -0,0 +1,21 @@
1
+ import { isReplayInputEvent as p } from "./replay-checkout.js";
2
+ const u = 5 * 6e4, l = 30 * 6e4, A = 15e3, a = 2, c = 4;
3
+ function I(i = Date.now()) {
4
+ return { lastInputAt: i, pausedAt: 0, awaitingSince: 0, idleMs: 0 };
5
+ }
6
+ function f(i, e, n = Date.now()) {
7
+ const t = p(e);
8
+ if (i.awaitingSince) {
9
+ t && (i.lastInputAt = n);
10
+ const r = e == null ? void 0 : e.type;
11
+ return r === a ? (i.awaitingSince = 0, "keep") : r === c ? "keep" : n - i.awaitingSince < A ? "drop" : (i.awaitingSince = 0, "keep");
12
+ }
13
+ return i.pausedAt ? t ? (i.idleMs = n - i.lastInputAt, i.pausedAt = 0, i.lastInputAt = n, i.awaitingSince = n, "resume") : "drop" : t ? (i.lastInputAt = n, "keep") : n - i.lastInputAt >= u ? (i.pausedAt = n, "drop") : "keep";
14
+ }
15
+ export {
16
+ u as REPLAY_IDLE_PAUSE_MS,
17
+ l as REPLAY_IDLE_RESTART_MS,
18
+ A as REPLAY_IDLE_RESUME_WAIT_MS,
19
+ I as createReplayIdleState,
20
+ f as noteReplayIdle
21
+ };
@@ -1,12 +1,16 @@
1
- import { redactSecrets as S } from "./replay-context.js";
2
- const g = 800, h = 10, m = 20, A = /* @__PURE__ */ new Set([
1
+ import { redactSecrets as g } from "./replay-context.js";
2
+ const S = 800, h = 10, m = 20, A = /* @__PURE__ */ new Set([
3
3
  "nvr:ping",
4
4
  "nvr:pong",
5
5
  "time:sync",
6
6
  "chat:typing",
7
7
  "presence:update",
8
+ // Sent to every tab whenever anyone comes or goes: 77% of logged frames (production 2026-11-12).
9
+ "presence:changed",
10
+ // One frame per log line of a running job; job:update still says what changed.
11
+ "job:log",
8
12
  "catchup:cursor"
9
- ]), f = /* @__PURE__ */ new Set(), p = (n, e) => S(String(n)).replace(/\s+/g, " ").slice(0, e);
13
+ ]), f = /* @__PURE__ */ new Set(), p = (n, e) => g(String(n)).replace(/\s+/g, " ").slice(0, e);
10
14
  function _(n) {
11
15
  const e = Array.isArray(n) ? n : n == null ? [] : [n], t = [];
12
16
  for (const r of e)
@@ -39,7 +43,7 @@ function C(n, e) {
39
43
  } catch {
40
44
  }
41
45
  }
42
- function d(n, e) {
46
+ function u(n, e) {
43
47
  if (f.size !== 0)
44
48
  try {
45
49
  const t = { kind: "connection", name: n };
@@ -48,23 +52,23 @@ function d(n, e) {
48
52
  } catch {
49
53
  }
50
54
  }
51
- function O(n) {
55
+ function I(n) {
52
56
  var i;
53
57
  let e = 0;
54
58
  const t = (o, ...l) => {
55
- var a, u;
56
- if (o === "catchup:full") d("full-resync");
59
+ var a, d;
60
+ if (o === "catchup:full") u("full-resync");
57
61
  else if (o === "catchup:events") {
58
- const y = ((u = (a = l[0]) == null ? void 0 : a.events) == null ? void 0 : u.length) ?? 0;
59
- d("catch-up", `${y} missed event${y === 1 ? "" : "s"} replayed`);
62
+ const y = ((d = (a = l[0]) == null ? void 0 : a.events) == null ? void 0 : d.length) ?? 0;
63
+ u("catch-up", `${y} missed event${y === 1 ? "" : "s"} replayed`);
60
64
  } else C(o, l[0]);
61
- }, r = () => d(e++ > 0 ? "reconnected" : "connected"), c = (o) => d("disconnected", o), s = (o) => d("error", o == null ? void 0 : o.message);
65
+ }, r = () => u(e++ > 0 ? "reconnected" : "connected"), c = (o) => u("disconnected", o), s = (o) => u("error", o == null ? void 0 : o.message);
62
66
  return (i = n.onAny) == null || i.call(n, t), n.on("connect", r), n.on("disconnect", c), n.on("connect_error", s), () => {
63
- var o, l, a, u;
64
- (o = n.offAny) == null || o.call(n, t), (l = n.off) == null || l.call(n, "connect", r), (a = n.off) == null || a.call(n, "disconnect", c), (u = n.off) == null || u.call(n, "connect_error", s);
67
+ var o, l, a, d;
68
+ (o = n.offAny) == null || o.call(n, t), (l = n.off) == null || l.call(n, "connect", r), (a = n.off) == null || a.call(n, "disconnect", c), (d = n.off) == null || d.call(n, "connect_error", s);
65
69
  };
66
70
  }
67
- function T(n, e = g) {
71
+ function O(n, e = S) {
68
72
  let t = 0, r = !1;
69
73
  const c = (s) => {
70
74
  if (!(r || t > e))
@@ -82,12 +86,12 @@ function T(n, e = g) {
82
86
  };
83
87
  }
84
88
  export {
85
- g as SOCKET_MAX_EVENTS,
89
+ S as SOCKET_MAX_EVENTS,
86
90
  m as SOCKET_MAX_FIELDS,
87
91
  h as SOCKET_MAX_IDS,
88
92
  E as describeSocketPayload,
89
- T as instrumentSocket,
90
- d as reportSocketConnection,
93
+ O as instrumentSocket,
94
+ u as reportSocketConnection,
91
95
  C as reportSocketEvent,
92
- O as tapReplaySocket
96
+ I as tapReplaySocket
93
97
  };
@@ -1,41 +1,41 @@
1
1
  import { isSignedOut as E, isSignedOutError as T, noteUnauthorized as k } from "./signed-out.js";
2
- let m = !1, v, d = (e) => e;
2
+ let m = !1, p, c = (e) => e;
3
3
  const o = [];
4
- let h = null, p = "/api", f, w = null, c = 0, g = null;
4
+ let h = null, v = "/api", f, w = null, d = 0, g = null;
5
5
  function y(e) {
6
- const t = e.tagName.toLowerCase(), n = (e.textContent ?? "").trim().slice(0, 40), r = e.getAttribute("aria-label"), i = e.getAttribute("data-testid");
7
- return `${t}${i ? `[${i}]` : ""}${r ? ` '${r}'` : n ? ` '${n}'` : ""}`;
6
+ const n = e.tagName.toLowerCase(), t = (e.textContent ?? "").trim().slice(0, 40), i = e.getAttribute("aria-label"), r = e.getAttribute("data-testid");
7
+ return `${n}${r ? `[${r}]` : ""}${i ? ` '${i}'` : t ? ` '${t}'` : ""}`;
8
8
  }
9
9
  function _(e) {
10
10
  typeof window > "u" || window.addEventListener(
11
11
  "click",
12
- (t) => {
13
- const n = t.target instanceof Element ? t.target.closest('button, a, [role="button"], input, [data-testid]') : null;
14
- n && (n === w ? (c++, c === 3 && (s({
12
+ (n) => {
13
+ const t = n.target instanceof Element ? n.target.closest('button, a, [role="button"], input, [data-testid]') : null;
14
+ t && (t === w ? (d++, d === 3 && (s({
15
15
  kind: "rage",
16
- route: `${e()} :: ${y(n)}`.slice(0, 300),
17
- duration_ms: c
18
- }), u())) : (w = n, c = 1), g && clearTimeout(g), g = setTimeout(() => {
19
- w = null, c = 0;
16
+ route: `${e()} :: ${y(t)}`.slice(0, 300),
17
+ duration_ms: d
18
+ }), u())) : (w = t, d = 1), g && clearTimeout(g), g = setTimeout(() => {
19
+ w = null, d = 0;
20
20
  }, 600));
21
21
  },
22
22
  { capture: !0, passive: !0 }
23
23
  );
24
24
  }
25
25
  const $ = 1e3, M = 1e4, b = 3;
26
- function D(e = b, t = M) {
27
- let n = [];
28
- return (r) => (n = n.filter((i) => r - i < t), n.push(r), n.length >= e ? (n = [], !0) : !1);
26
+ function D(e = b, n = M) {
27
+ let t = [];
28
+ return (i) => (t = t.filter((r) => i - r < n), t.push(i), t.length >= e ? (t = [], !0) : !1);
29
29
  }
30
30
  function A(e) {
31
31
  if (typeof window > "u" || typeof MutationObserver > "u") return;
32
- const t = D();
32
+ const n = D();
33
33
  window.addEventListener(
34
34
  "click",
35
- (n) => {
36
- const r = n.target instanceof Element ? n.target.closest('button, a[href], [role="button"]') : null;
37
- if (!r || r.disabled || r.closest(".nvr-no-record")) return;
38
- const i = window.location.href;
35
+ (t) => {
36
+ const i = t.target instanceof Element ? t.target.closest('button, a[href], [role="button"]') : null;
37
+ if (!i || i.disabled || i.closest(".nvr-no-record")) return;
38
+ const r = window.location.href;
39
39
  let l = !1;
40
40
  const a = new MutationObserver(() => {
41
41
  l = !0;
@@ -51,9 +51,9 @@ function A(e) {
51
51
  return;
52
52
  }
53
53
  setTimeout(() => {
54
- a.disconnect(), !(l || window.location.href !== i) && t(Date.now()) && (s({
54
+ a.disconnect(), !(l || window.location.href !== r) && n(Date.now()) && (s({
55
55
  kind: "dead",
56
- route: `${e()} :: ${y(r)}`.slice(0, 300),
56
+ route: `${e()} :: ${y(i)}`.slice(0, 300),
57
57
  duration_ms: b
58
58
  }), u());
59
59
  }, $);
@@ -69,20 +69,20 @@ function u() {
69
69
  }
70
70
  const e = JSON.stringify({ events: o.splice(0, o.length) });
71
71
  try {
72
- const t = f == null ? void 0 : f();
73
- !t && typeof navigator.sendBeacon == "function" && navigator.sendBeacon(`${p}/rum`, new Blob([e], { type: "application/json" })) || fetch(`${p}/rum`, {
72
+ const n = f == null ? void 0 : f();
73
+ !n && typeof navigator.sendBeacon == "function" && navigator.sendBeacon(`${v}/rum`, new Blob([e], { type: "application/json" })) || fetch(`${v}/rum`, {
74
74
  method: "POST",
75
75
  credentials: "include",
76
76
  headers: {
77
77
  "Content-Type": "application/json",
78
- ...t ? { Authorization: `Bearer ${t}` } : {}
78
+ ...n ? { Authorization: `Bearer ${n}` } : {}
79
79
  },
80
80
  body: e,
81
81
  keepalive: !0
82
- }).then(async (r) => {
83
- if (r.status !== 401) return;
84
- const i = await r.json().catch(() => null);
85
- T({ status: 401, response: i }) && k(!1);
82
+ }).then(async (i) => {
83
+ if (i.status !== 401) return;
84
+ const r = await i.json().catch(() => null);
85
+ T({ status: 401, response: r }) && k(!1);
86
86
  }).catch(() => {
87
87
  });
88
88
  } catch {
@@ -91,54 +91,59 @@ function u() {
91
91
  function s(e) {
92
92
  o.push({
93
93
  ...e,
94
- app: v,
94
+ app: p,
95
95
  vw: typeof window > "u" ? void 0 : window.innerWidth
96
96
  }), o.length >= 10 ? u() : (h && clearTimeout(h), h = setTimeout(u, 1e4));
97
97
  }
98
- const C = /^[A-Za-z0-9._:-]{1,80}$/, B = /^[0-9A-Fa-f-]{36}$/;
99
- function O(e) {
98
+ const C = /^[A-Za-z0-9._:-]{1,80}$/, L = /^[0-9A-Fa-f-]{36}$/;
99
+ function B(e) {
100
100
  if (!m || !C.test(e.key)) return;
101
- const t = e.roleId && B.test(e.roleId) ? e.roleId.toUpperCase() : void 0;
101
+ const n = e.roleId && L.test(e.roleId) ? e.roleId.toUpperCase() : void 0;
102
102
  s({
103
103
  kind: "widget",
104
104
  route: `widget:${e.key}`,
105
105
  widget: e.key,
106
- role: t,
106
+ role: n,
107
107
  fetch_ms: Math.max(0, Math.round(e.fetchMs)),
108
108
  paint_ms: Math.max(0, Math.round(e.paintMs))
109
109
  });
110
110
  }
111
- function S(e) {
112
- if (!m || typeof window > "u") return;
113
- const t = performance.now();
114
- requestAnimationFrame(() => {
111
+ function O(e) {
112
+ if (!m || typeof window > "u" || document.visibilityState === "hidden") return;
113
+ const n = performance.now();
114
+ let t = !1;
115
+ const i = () => {
116
+ document.visibilityState === "hidden" && (t = !0);
117
+ };
118
+ document.addEventListener("visibilitychange", i), requestAnimationFrame(() => {
115
119
  requestAnimationFrame(() => {
116
- const n = Math.round(performance.now() - t);
117
- s({ route: d(e), kind: "route", duration_ms: n });
120
+ if (document.removeEventListener("visibilitychange", i), t) return;
121
+ const r = Math.round(performance.now() - n);
122
+ s({ route: c(e), kind: "route", duration_ms: r });
118
123
  });
119
124
  });
120
125
  }
121
126
  function I(e) {
122
127
  if (m || typeof window > "u" || typeof performance > "u") return;
123
- m = !0, v = e == null ? void 0 : e.app, e != null && e.routePattern && (d = e.routePattern), e != null && e.apiBase && (p = e.apiBase), f = e == null ? void 0 : e.getToken, _(() => d(window.location.pathname)), A(() => d(window.location.pathname));
124
- const t = performance.getEntriesByType("navigation")[0];
125
- let n = null;
128
+ m = !0, p = e == null ? void 0 : e.app, e != null && e.routePattern && (c = e.routePattern), e != null && e.apiBase && (v = e.apiBase), f = e == null ? void 0 : e.getToken, _(() => c(window.location.pathname)), A(() => c(window.location.pathname));
129
+ const n = performance.getEntriesByType("navigation")[0];
130
+ let t = null;
126
131
  try {
127
132
  new PerformanceObserver((l) => {
128
133
  const a = l.getEntries().at(-1);
129
- (a == null ? void 0 : a.startTime) != null && (n = Math.round(a.startTime));
134
+ (a == null ? void 0 : a.startTime) != null && (t = Math.round(a.startTime));
130
135
  }).observe({ type: "largest-contentful-paint", buffered: !0 });
131
136
  } catch {
132
137
  }
133
138
  setTimeout(() => {
134
- const i = performance.getEntriesByName("first-contentful-paint")[0];
139
+ const r = performance.getEntriesByName("first-contentful-paint")[0];
135
140
  s({
136
- route: d(window.location.pathname),
141
+ route: c(window.location.pathname),
137
142
  kind: "load",
138
- ttfb_ms: t ? Math.round(t.responseStart) : void 0,
139
- fcp_ms: i ? Math.round(i.startTime) : void 0,
140
- lcp_ms: n ?? void 0,
141
- duration_ms: t ? Math.round(t.loadEventEnd || t.domContentLoadedEventEnd) : void 0
143
+ ttfb_ms: n ? Math.round(n.responseStart) : void 0,
144
+ fcp_ms: r ? Math.round(r.startTime) : void 0,
145
+ lcp_ms: t ?? void 0,
146
+ duration_ms: n ? Math.round(n.loadEventEnd || n.domContentLoadedEventEnd) : void 0
142
147
  });
143
148
  }, 6e3), window.addEventListener("pagehide", u), document.addEventListener("visibilitychange", () => {
144
149
  document.visibilityState === "hidden" && u();
@@ -149,7 +154,7 @@ export {
149
154
  $ as DEAD_WAIT_MS,
150
155
  M as DEAD_WINDOW_MS,
151
156
  D as createDeadClickCounter,
152
- S as rumRouteChange,
153
- O as rumWidget,
157
+ O as rumRouteChange,
158
+ B as rumWidget,
154
159
  I as startRum
155
160
  };
@@ -1,4 +1,4 @@
1
- import { reportClientCrash as T } from "./client-crash.js";
1
+ import { reportClientCrash as y } from "./client-crash.js";
2
2
  const d = "Something went wrong — it’s been reported", m = /failed to fetch|load failed|networkerror|network request failed|network error/i;
3
3
  function h(e) {
4
4
  var r;
@@ -9,7 +9,7 @@ function w(e) {
9
9
  return !(e instanceof Error) || h(e) != null || e.response != null || m.test(e.message) ? !1 : e instanceof TypeError || e instanceof ReferenceError || e instanceof RangeError;
10
10
  }
11
11
  const g = /^(bad request|unauthorized|forbidden|not found|conflict|unprocessable entity|too many requests|internal server error|bad gateway|service unavailable|gateway timeout)$/i;
12
- function y(e) {
12
+ function T(e) {
13
13
  var r;
14
14
  const t = e, o = [(r = t == null ? void 0 : t.response) == null ? void 0 : r.data, t == null ? void 0 : t.response];
15
15
  for (const n of o) {
@@ -22,14 +22,17 @@ function y(e) {
22
22
  }
23
23
  return null;
24
24
  }
25
- function A(e, t = "Failed") {
26
- const o = h(e), r = y(e);
27
- if (r && !c(r) && !S(e, o)) return r;
25
+ function A(e) {
26
+ return T(e);
27
+ }
28
+ function O(e, t = "Failed") {
29
+ const o = h(e), r = T(e);
30
+ if (r && !c(r) && !v(e, o)) return r;
28
31
  if (w(e)) return d;
29
32
  const n = e instanceof Error ? e.message : typeof e == "string" ? e : "";
30
33
  return !o && m.test(n) ? "Cannot reach the server" : n.trim() && !c(n) ? n.trim() : n.trim() ? C(n, t || d, o) : r ? f(o) ?? (t || d) : t;
31
34
  }
32
- function S(e, t) {
35
+ function v(e, t) {
33
36
  if (t !== 500) return !1;
34
37
  const o = e, r = o == null ? void 0 : o.response, n = r && typeof r.data == "object" && r.data ? r.data : r;
35
38
  return !!n && typeof n.statusCode == "number" && typeof n.code != "string";
@@ -53,7 +56,7 @@ const E = {
53
56
  function f(e) {
54
57
  return e == null ? null : E[e] ?? (e >= 500 ? E[500] : e >= 400 ? E[400] : null);
55
58
  }
56
- function v(e) {
59
+ function S(e) {
57
60
  if (typeof e != "string") return !1;
58
61
  const t = e.trim();
59
62
  return /^request failed with status( code)? \d{3}$/i.test(t) || // apiFetch-style "Request failed (500)", the SDK's "HTTP 500", "Error 404", "500 Internal Server Error"
@@ -120,7 +123,7 @@ const R = [
120
123
  function c(e) {
121
124
  if (typeof e != "string") return e != null;
122
125
  const t = e.trim();
123
- return t ? v(t) ? !0 : R.some((o) => o.test(t)) : !1;
126
+ return t ? S(t) ? !0 : R.some((o) => o.test(t)) : !1;
124
127
  }
125
128
  const N = /\s+[—–-]\s+|:\s+|\.\s+/;
126
129
  function C(e, t = d, o) {
@@ -146,20 +149,21 @@ function C(e, t = d, o) {
146
149
  return f(o ?? b(r)) ?? t;
147
150
  }
148
151
  const p = /* @__PURE__ */ new WeakSet();
149
- function O(e, t) {
150
- !e || !w(t) || p.has(t) || (p.add(t), T(e, t, null).catch(() => {
152
+ function k(e, t) {
153
+ !e || !w(t) || p.has(t) || (p.add(t), y(e, t, null).catch(() => {
151
154
  }));
152
155
  }
153
156
  export {
154
157
  d as SOMETHING_WENT_WRONG,
155
158
  E as STATUS_TITLES,
156
159
  h as errorStatusOf,
157
- v as isBareStatusText,
160
+ S as isBareStatusText,
158
161
  w as isCodeError,
159
162
  c as isRawErrorText,
160
163
  C as plainErrorText,
161
- O as reportCodeError,
164
+ k as reportCodeError,
165
+ A as serverErrorText,
162
166
  b as statusInText,
163
167
  f as statusTitle,
164
- A as userErrorMessage
168
+ O as userErrorMessage
165
169
  };