@useknest/widget-core 0.0.1-alpha.3 → 0.0.1-alpha.4
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.
- package/dist/config.d.ts +6 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/constants.d.ts +6 -3
- package/dist/constants.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4229 -63
- package/dist/sentry.d.ts +10 -0
- package/dist/sentry.d.ts.map +1 -0
- package/dist/streaming.d.ts +2 -0
- package/dist/streaming.d.ts.map +1 -1
- package/package.json +33 -33
package/dist/index.js
CHANGED
|
@@ -1,98 +1,4264 @@
|
|
|
1
|
-
import { marked as
|
|
2
|
-
const
|
|
1
|
+
import { marked as Qe } from "marked";
|
|
2
|
+
const tn = "https://useknest.com", en = "/api/v1";
|
|
3
|
+
function Wn(t = tn) {
|
|
4
|
+
return `${t}${en}/chat-messages`;
|
|
5
|
+
}
|
|
6
|
+
function qn(t = tn) {
|
|
7
|
+
return `${t}${en}/widget-config`;
|
|
8
|
+
}
|
|
9
|
+
const Yn = "Sorry, I didn't get a response.", ie = "Unknown error occurred", Ra = "/default-avatar.svg", ka = "#0d7a7f", Aa = "Hi! I'm your AI assistant. I'm trained to answer questions about your documentation. How can I help you today?", xa = [
|
|
3
10
|
"How do I get started?",
|
|
4
11
|
"What features are available?",
|
|
5
12
|
"How do I integrate this?"
|
|
6
13
|
];
|
|
7
|
-
async function
|
|
14
|
+
async function Oa(t, e) {
|
|
8
15
|
try {
|
|
9
|
-
const
|
|
16
|
+
const n = await fetch(qn(e), {
|
|
10
17
|
method: "GET",
|
|
11
18
|
headers: {
|
|
12
|
-
"X-Api-Key":
|
|
19
|
+
"X-Api-Key": t
|
|
13
20
|
}
|
|
14
21
|
});
|
|
15
|
-
if (
|
|
16
|
-
return await
|
|
22
|
+
if (n.ok)
|
|
23
|
+
return await n.json();
|
|
17
24
|
{
|
|
18
|
-
const r = await
|
|
19
|
-
return console.warn("Failed to fetch widget config:",
|
|
25
|
+
const r = await n.text();
|
|
26
|
+
return console.warn("Failed to fetch widget config:", n.status, r), null;
|
|
20
27
|
}
|
|
21
|
-
} catch (
|
|
22
|
-
return console.error("Error fetching widget config:",
|
|
28
|
+
} catch (n) {
|
|
29
|
+
return console.error("Error fetching widget config:", n), null;
|
|
23
30
|
}
|
|
24
31
|
}
|
|
25
|
-
async function
|
|
26
|
-
const { publishableApiKey:
|
|
32
|
+
async function Na(t) {
|
|
33
|
+
const { publishableApiKey: e, content: n, threadId: r, callbacks: s, baseUrl: o } = t;
|
|
27
34
|
try {
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
const
|
|
35
|
+
const i = { content: n };
|
|
36
|
+
r && (i.threadId = r);
|
|
37
|
+
const a = await fetch(Wn(o), {
|
|
31
38
|
method: "POST",
|
|
32
39
|
headers: {
|
|
33
40
|
"Content-Type": "application/json",
|
|
34
|
-
"X-Api-Key":
|
|
41
|
+
"X-Api-Key": e
|
|
35
42
|
},
|
|
36
|
-
body: JSON.stringify(
|
|
43
|
+
body: JSON.stringify(i)
|
|
37
44
|
});
|
|
38
|
-
if (!
|
|
39
|
-
const
|
|
40
|
-
throw new Error(
|
|
45
|
+
if (!a.ok) {
|
|
46
|
+
const m = await a.json();
|
|
47
|
+
throw new Error(m.error || "Failed to send message");
|
|
41
48
|
}
|
|
42
|
-
const
|
|
43
|
-
if (!
|
|
49
|
+
const c = a.body?.getReader();
|
|
50
|
+
if (!c)
|
|
44
51
|
throw new Error("Response body is not readable");
|
|
45
|
-
const
|
|
46
|
-
let
|
|
52
|
+
const u = new TextDecoder();
|
|
53
|
+
let f = "", l = !1;
|
|
47
54
|
for (; ; ) {
|
|
48
|
-
const { done:
|
|
49
|
-
if (
|
|
50
|
-
|
|
51
|
-
const
|
|
55
|
+
const { done: m, value: d } = await c.read();
|
|
56
|
+
if (m) break;
|
|
57
|
+
f += u.decode(d, { stream: !0 });
|
|
58
|
+
const E = f.split(`
|
|
52
59
|
`);
|
|
53
|
-
|
|
54
|
-
for (const
|
|
55
|
-
if (
|
|
60
|
+
f = E.pop() || "";
|
|
61
|
+
for (const R of E)
|
|
62
|
+
if (R.startsWith("data: "))
|
|
56
63
|
try {
|
|
57
|
-
const
|
|
58
|
-
if (
|
|
59
|
-
|
|
60
|
-
else if (
|
|
61
|
-
|
|
62
|
-
else if (
|
|
63
|
-
|
|
64
|
-
else if (
|
|
65
|
-
throw new Error(
|
|
66
|
-
} catch (
|
|
67
|
-
console.error("Error parsing SSE data:",
|
|
64
|
+
const g = JSON.parse(R.slice(6));
|
|
65
|
+
if (g.type === "init")
|
|
66
|
+
g.threadId && s.onInit && s.onInit(g.threadId);
|
|
67
|
+
else if (g.type === "content")
|
|
68
|
+
g.content && (l = !0, s.onContent(g.content));
|
|
69
|
+
else if (g.type === "complete")
|
|
70
|
+
s.onComplete && s.onComplete(g.sources || []);
|
|
71
|
+
else if (g.type === "error")
|
|
72
|
+
throw new Error(g.error || ie);
|
|
73
|
+
} catch (g) {
|
|
74
|
+
console.error("Error parsing SSE data:", g, R);
|
|
68
75
|
}
|
|
69
76
|
}
|
|
70
|
-
|
|
71
|
-
} catch (
|
|
72
|
-
const
|
|
73
|
-
|
|
77
|
+
l || s.onError(Yn);
|
|
78
|
+
} catch (i) {
|
|
79
|
+
const a = i instanceof Error ? i.message : ie;
|
|
80
|
+
s.onError(a);
|
|
74
81
|
}
|
|
75
82
|
}
|
|
76
|
-
|
|
83
|
+
Qe.setOptions({
|
|
77
84
|
breaks: !0,
|
|
78
85
|
gfm: !0
|
|
79
86
|
});
|
|
80
|
-
function
|
|
81
|
-
return
|
|
82
|
-
html:
|
|
87
|
+
function Ca(t) {
|
|
88
|
+
return t.split(/\n\s*\n/).map((n) => n.trim()).filter((n) => n).map((n) => ({
|
|
89
|
+
html: Qe.parseInline(n)
|
|
90
|
+
}));
|
|
91
|
+
}
|
|
92
|
+
const h = typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__, _ = globalThis, P = "9.47.1";
|
|
93
|
+
function mt() {
|
|
94
|
+
return gt(_), _;
|
|
95
|
+
}
|
|
96
|
+
function gt(t) {
|
|
97
|
+
const e = t.__SENTRY__ = t.__SENTRY__ || {};
|
|
98
|
+
return e.version = e.version || P, e[P] = e[P] || {};
|
|
99
|
+
}
|
|
100
|
+
function J(t, e, n = _) {
|
|
101
|
+
const r = n.__SENTRY__ = n.__SENTRY__ || {}, s = r[P] = r[P] || {};
|
|
102
|
+
return s[t] || (s[t] = e());
|
|
103
|
+
}
|
|
104
|
+
const zn = [
|
|
105
|
+
"debug",
|
|
106
|
+
"info",
|
|
107
|
+
"warn",
|
|
108
|
+
"error",
|
|
109
|
+
"log",
|
|
110
|
+
"assert",
|
|
111
|
+
"trace"
|
|
112
|
+
], Xn = "Sentry Logger ", lt = {};
|
|
113
|
+
function Y(t) {
|
|
114
|
+
if (!("console" in _))
|
|
115
|
+
return t();
|
|
116
|
+
const e = _.console, n = {}, r = Object.keys(lt);
|
|
117
|
+
r.forEach((s) => {
|
|
118
|
+
const o = lt[s];
|
|
119
|
+
n[s] = e[s], e[s] = o;
|
|
120
|
+
});
|
|
121
|
+
try {
|
|
122
|
+
return t();
|
|
123
|
+
} finally {
|
|
124
|
+
r.forEach((s) => {
|
|
125
|
+
e[s] = n[s];
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
function Kn() {
|
|
130
|
+
Yt().enabled = !0;
|
|
131
|
+
}
|
|
132
|
+
function Vn() {
|
|
133
|
+
Yt().enabled = !1;
|
|
134
|
+
}
|
|
135
|
+
function nn() {
|
|
136
|
+
return Yt().enabled;
|
|
137
|
+
}
|
|
138
|
+
function Jn(...t) {
|
|
139
|
+
qt("log", ...t);
|
|
140
|
+
}
|
|
141
|
+
function Zn(...t) {
|
|
142
|
+
qt("warn", ...t);
|
|
143
|
+
}
|
|
144
|
+
function Qn(...t) {
|
|
145
|
+
qt("error", ...t);
|
|
146
|
+
}
|
|
147
|
+
function qt(t, ...e) {
|
|
148
|
+
h && nn() && Y(() => {
|
|
149
|
+
_.console[t](`${Xn}[${t}]:`, ...e);
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
function Yt() {
|
|
153
|
+
return h ? J("loggerSettings", () => ({ enabled: !1 })) : { enabled: !1 };
|
|
154
|
+
}
|
|
155
|
+
const p = {
|
|
156
|
+
/** Enable logging. */
|
|
157
|
+
enable: Kn,
|
|
158
|
+
/** Disable logging. */
|
|
159
|
+
disable: Vn,
|
|
160
|
+
/** Check if logging is enabled. */
|
|
161
|
+
isEnabled: nn,
|
|
162
|
+
/** Log a message. */
|
|
163
|
+
log: Jn,
|
|
164
|
+
/** Log a warning. */
|
|
165
|
+
warn: Zn,
|
|
166
|
+
/** Log an error. */
|
|
167
|
+
error: Qn
|
|
168
|
+
}, rn = 50, M = "?", ae = /\(error: (.*)\)/, ce = /captureMessage|captureException/;
|
|
169
|
+
function sn(...t) {
|
|
170
|
+
const e = t.sort((n, r) => n[0] - r[0]).map((n) => n[1]);
|
|
171
|
+
return (n, r = 0, s = 0) => {
|
|
172
|
+
const o = [], i = n.split(`
|
|
173
|
+
`);
|
|
174
|
+
for (let a = r; a < i.length; a++) {
|
|
175
|
+
const c = i[a];
|
|
176
|
+
if (c.length > 1024)
|
|
177
|
+
continue;
|
|
178
|
+
const u = ae.test(c) ? c.replace(ae, "$1") : c;
|
|
179
|
+
if (!u.match(/\S*Error: /)) {
|
|
180
|
+
for (const f of e) {
|
|
181
|
+
const l = f(u);
|
|
182
|
+
if (l) {
|
|
183
|
+
o.push(l);
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if (o.length >= rn + s)
|
|
188
|
+
break;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return er(o.slice(s));
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
function tr(t) {
|
|
195
|
+
return Array.isArray(t) ? sn(...t) : t;
|
|
196
|
+
}
|
|
197
|
+
function er(t) {
|
|
198
|
+
if (!t.length)
|
|
199
|
+
return [];
|
|
200
|
+
const e = Array.from(t);
|
|
201
|
+
return /sentryWrapped/.test(nt(e).function || "") && e.pop(), e.reverse(), ce.test(nt(e).function || "") && (e.pop(), ce.test(nt(e).function || "") && e.pop()), e.slice(0, rn).map((n) => ({
|
|
202
|
+
...n,
|
|
203
|
+
filename: n.filename || nt(e).filename,
|
|
204
|
+
function: n.function || M
|
|
83
205
|
}));
|
|
84
206
|
}
|
|
207
|
+
function nt(t) {
|
|
208
|
+
return t[t.length - 1] || {};
|
|
209
|
+
}
|
|
210
|
+
const It = "<anonymous>";
|
|
211
|
+
function O(t) {
|
|
212
|
+
try {
|
|
213
|
+
return !t || typeof t != "function" ? It : t.name || It;
|
|
214
|
+
} catch {
|
|
215
|
+
return It;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
function ue(t) {
|
|
219
|
+
const e = t.exception;
|
|
220
|
+
if (e) {
|
|
221
|
+
const n = [];
|
|
222
|
+
try {
|
|
223
|
+
return e.values.forEach((r) => {
|
|
224
|
+
r.stacktrace.frames && n.push(...r.stacktrace.frames);
|
|
225
|
+
}), n;
|
|
226
|
+
} catch {
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
const ct = {}, fe = {};
|
|
232
|
+
function j(t, e) {
|
|
233
|
+
ct[t] = ct[t] || [], ct[t].push(e);
|
|
234
|
+
}
|
|
235
|
+
function B(t, e) {
|
|
236
|
+
if (!fe[t]) {
|
|
237
|
+
fe[t] = !0;
|
|
238
|
+
try {
|
|
239
|
+
e();
|
|
240
|
+
} catch (n) {
|
|
241
|
+
h && p.error(`Error while instrumenting ${t}`, n);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
function v(t, e) {
|
|
246
|
+
const n = t && ct[t];
|
|
247
|
+
if (n)
|
|
248
|
+
for (const r of n)
|
|
249
|
+
try {
|
|
250
|
+
r(e);
|
|
251
|
+
} catch (s) {
|
|
252
|
+
h && p.error(
|
|
253
|
+
`Error while triggering instrumentation handler.
|
|
254
|
+
Type: ${t}
|
|
255
|
+
Name: ${O(r)}
|
|
256
|
+
Error:`,
|
|
257
|
+
s
|
|
258
|
+
);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
let vt = null;
|
|
262
|
+
function nr(t) {
|
|
263
|
+
const e = "error";
|
|
264
|
+
j(e, t), B(e, rr);
|
|
265
|
+
}
|
|
266
|
+
function rr() {
|
|
267
|
+
vt = _.onerror, _.onerror = function(t, e, n, r, s) {
|
|
268
|
+
return v("error", {
|
|
269
|
+
column: r,
|
|
270
|
+
error: s,
|
|
271
|
+
line: n,
|
|
272
|
+
msg: t,
|
|
273
|
+
url: e
|
|
274
|
+
}), vt ? vt.apply(this, arguments) : !1;
|
|
275
|
+
}, _.onerror.__SENTRY_INSTRUMENTED__ = !0;
|
|
276
|
+
}
|
|
277
|
+
let wt = null;
|
|
278
|
+
function sr(t) {
|
|
279
|
+
const e = "unhandledrejection";
|
|
280
|
+
j(e, t), B(e, or);
|
|
281
|
+
}
|
|
282
|
+
function or() {
|
|
283
|
+
wt = _.onunhandledrejection, _.onunhandledrejection = function(t) {
|
|
284
|
+
return v("unhandledrejection", t), wt ? wt.apply(this, arguments) : !0;
|
|
285
|
+
}, _.onunhandledrejection.__SENTRY_INSTRUMENTED__ = !0;
|
|
286
|
+
}
|
|
287
|
+
const on = Object.prototype.toString;
|
|
288
|
+
function zt(t) {
|
|
289
|
+
switch (on.call(t)) {
|
|
290
|
+
case "[object Error]":
|
|
291
|
+
case "[object Exception]":
|
|
292
|
+
case "[object DOMException]":
|
|
293
|
+
case "[object WebAssembly.Exception]":
|
|
294
|
+
return !0;
|
|
295
|
+
default:
|
|
296
|
+
return N(t, Error);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
function z(t, e) {
|
|
300
|
+
return on.call(t) === `[object ${e}]`;
|
|
301
|
+
}
|
|
302
|
+
function an(t) {
|
|
303
|
+
return z(t, "ErrorEvent");
|
|
304
|
+
}
|
|
305
|
+
function le(t) {
|
|
306
|
+
return z(t, "DOMError");
|
|
307
|
+
}
|
|
308
|
+
function ir(t) {
|
|
309
|
+
return z(t, "DOMException");
|
|
310
|
+
}
|
|
311
|
+
function A(t) {
|
|
312
|
+
return z(t, "String");
|
|
313
|
+
}
|
|
314
|
+
function Xt(t) {
|
|
315
|
+
return typeof t == "object" && t !== null && "__sentry_template_string__" in t && "__sentry_template_values__" in t;
|
|
316
|
+
}
|
|
317
|
+
function Kt(t) {
|
|
318
|
+
return t === null || Xt(t) || typeof t != "object" && typeof t != "function";
|
|
319
|
+
}
|
|
320
|
+
function K(t) {
|
|
321
|
+
return z(t, "Object");
|
|
322
|
+
}
|
|
323
|
+
function _t(t) {
|
|
324
|
+
return typeof Event < "u" && N(t, Event);
|
|
325
|
+
}
|
|
326
|
+
function ar(t) {
|
|
327
|
+
return typeof Element < "u" && N(t, Element);
|
|
328
|
+
}
|
|
329
|
+
function cr(t) {
|
|
330
|
+
return z(t, "RegExp");
|
|
331
|
+
}
|
|
332
|
+
function yt(t) {
|
|
333
|
+
return !!(t?.then && typeof t.then == "function");
|
|
334
|
+
}
|
|
335
|
+
function ur(t) {
|
|
336
|
+
return K(t) && "nativeEvent" in t && "preventDefault" in t && "stopPropagation" in t;
|
|
337
|
+
}
|
|
338
|
+
function N(t, e) {
|
|
339
|
+
try {
|
|
340
|
+
return t instanceof e;
|
|
341
|
+
} catch {
|
|
342
|
+
return !1;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
function cn(t) {
|
|
346
|
+
return !!(typeof t == "object" && t !== null && (t.__isVue || t._isVue));
|
|
347
|
+
}
|
|
348
|
+
function fr(t) {
|
|
349
|
+
return typeof Request < "u" && N(t, Request);
|
|
350
|
+
}
|
|
351
|
+
const Vt = _, lr = 80;
|
|
352
|
+
function un(t, e = {}) {
|
|
353
|
+
if (!t)
|
|
354
|
+
return "<unknown>";
|
|
355
|
+
try {
|
|
356
|
+
let n = t;
|
|
357
|
+
const r = 5, s = [];
|
|
358
|
+
let o = 0, i = 0;
|
|
359
|
+
const a = " > ", c = a.length;
|
|
360
|
+
let u;
|
|
361
|
+
const f = Array.isArray(e) ? e : e.keyAttrs, l = !Array.isArray(e) && e.maxStringLength || lr;
|
|
362
|
+
for (; n && o++ < r && (u = dr(n, f), !(u === "html" || o > 1 && i + s.length * c + u.length >= l)); )
|
|
363
|
+
s.push(u), i += u.length, n = n.parentNode;
|
|
364
|
+
return s.reverse().join(a);
|
|
365
|
+
} catch {
|
|
366
|
+
return "<unknown>";
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
function dr(t, e) {
|
|
370
|
+
const n = t, r = [];
|
|
371
|
+
if (!n?.tagName)
|
|
372
|
+
return "";
|
|
373
|
+
if (Vt.HTMLElement && n instanceof HTMLElement && n.dataset) {
|
|
374
|
+
if (n.dataset.sentryComponent)
|
|
375
|
+
return n.dataset.sentryComponent;
|
|
376
|
+
if (n.dataset.sentryElement)
|
|
377
|
+
return n.dataset.sentryElement;
|
|
378
|
+
}
|
|
379
|
+
r.push(n.tagName.toLowerCase());
|
|
380
|
+
const s = e?.length ? e.filter((i) => n.getAttribute(i)).map((i) => [i, n.getAttribute(i)]) : null;
|
|
381
|
+
if (s?.length)
|
|
382
|
+
s.forEach((i) => {
|
|
383
|
+
r.push(`[${i[0]}="${i[1]}"]`);
|
|
384
|
+
});
|
|
385
|
+
else {
|
|
386
|
+
n.id && r.push(`#${n.id}`);
|
|
387
|
+
const i = n.className;
|
|
388
|
+
if (i && A(i)) {
|
|
389
|
+
const a = i.split(/\s+/);
|
|
390
|
+
for (const c of a)
|
|
391
|
+
r.push(`.${c}`);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
const o = ["aria-label", "type", "name", "title", "alt"];
|
|
395
|
+
for (const i of o) {
|
|
396
|
+
const a = n.getAttribute(i);
|
|
397
|
+
a && r.push(`[${i}="${a}"]`);
|
|
398
|
+
}
|
|
399
|
+
return r.join("");
|
|
400
|
+
}
|
|
401
|
+
function Jt() {
|
|
402
|
+
try {
|
|
403
|
+
return Vt.document.location.href;
|
|
404
|
+
} catch {
|
|
405
|
+
return "";
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
function pr(t) {
|
|
409
|
+
if (!Vt.HTMLElement)
|
|
410
|
+
return null;
|
|
411
|
+
let e = t;
|
|
412
|
+
const n = 5;
|
|
413
|
+
for (let r = 0; r < n; r++) {
|
|
414
|
+
if (!e)
|
|
415
|
+
return null;
|
|
416
|
+
if (e instanceof HTMLElement) {
|
|
417
|
+
if (e.dataset.sentryComponent)
|
|
418
|
+
return e.dataset.sentryComponent;
|
|
419
|
+
if (e.dataset.sentryElement)
|
|
420
|
+
return e.dataset.sentryElement;
|
|
421
|
+
}
|
|
422
|
+
e = e.parentNode;
|
|
423
|
+
}
|
|
424
|
+
return null;
|
|
425
|
+
}
|
|
426
|
+
function dt(t, e = 0) {
|
|
427
|
+
return typeof t != "string" || e === 0 || t.length <= e ? t : `${t.slice(0, e)}...`;
|
|
428
|
+
}
|
|
429
|
+
function de(t, e) {
|
|
430
|
+
if (!Array.isArray(t))
|
|
431
|
+
return "";
|
|
432
|
+
const n = [];
|
|
433
|
+
for (let r = 0; r < t.length; r++) {
|
|
434
|
+
const s = t[r];
|
|
435
|
+
try {
|
|
436
|
+
cn(s) ? n.push("[VueViewModel]") : n.push(String(s));
|
|
437
|
+
} catch {
|
|
438
|
+
n.push("[value cannot be serialized]");
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
return n.join(e);
|
|
442
|
+
}
|
|
443
|
+
function hr(t, e, n = !1) {
|
|
444
|
+
return A(t) ? cr(e) ? e.test(t) : A(e) ? n ? t === e : t.includes(e) : !1 : !1;
|
|
445
|
+
}
|
|
446
|
+
function Et(t, e = [], n = !1) {
|
|
447
|
+
return e.some((r) => hr(t, r, n));
|
|
448
|
+
}
|
|
449
|
+
function T(t, e, n) {
|
|
450
|
+
if (!(e in t))
|
|
451
|
+
return;
|
|
452
|
+
const r = t[e];
|
|
453
|
+
if (typeof r != "function")
|
|
454
|
+
return;
|
|
455
|
+
const s = n(r);
|
|
456
|
+
typeof s == "function" && fn(s, r);
|
|
457
|
+
try {
|
|
458
|
+
t[e] = s;
|
|
459
|
+
} catch {
|
|
460
|
+
h && p.log(`Failed to replace method "${e}" in object`, t);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
function F(t, e, n) {
|
|
464
|
+
try {
|
|
465
|
+
Object.defineProperty(t, e, {
|
|
466
|
+
// enumerable: false, // the default, so we can save on bundle size by not explicitly setting it
|
|
467
|
+
value: n,
|
|
468
|
+
writable: !0,
|
|
469
|
+
configurable: !0
|
|
470
|
+
});
|
|
471
|
+
} catch {
|
|
472
|
+
h && p.log(`Failed to add non-enumerable property "${e}" to object`, t);
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
function fn(t, e) {
|
|
476
|
+
try {
|
|
477
|
+
const n = e.prototype || {};
|
|
478
|
+
t.prototype = e.prototype = n, F(t, "__sentry_original__", e);
|
|
479
|
+
} catch {
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
function Zt(t) {
|
|
483
|
+
return t.__sentry_original__;
|
|
484
|
+
}
|
|
485
|
+
function ln(t) {
|
|
486
|
+
if (zt(t))
|
|
487
|
+
return {
|
|
488
|
+
message: t.message,
|
|
489
|
+
name: t.name,
|
|
490
|
+
stack: t.stack,
|
|
491
|
+
...he(t)
|
|
492
|
+
};
|
|
493
|
+
if (_t(t)) {
|
|
494
|
+
const e = {
|
|
495
|
+
type: t.type,
|
|
496
|
+
target: pe(t.target),
|
|
497
|
+
currentTarget: pe(t.currentTarget),
|
|
498
|
+
...he(t)
|
|
499
|
+
};
|
|
500
|
+
return typeof CustomEvent < "u" && N(t, CustomEvent) && (e.detail = t.detail), e;
|
|
501
|
+
} else
|
|
502
|
+
return t;
|
|
503
|
+
}
|
|
504
|
+
function pe(t) {
|
|
505
|
+
try {
|
|
506
|
+
return ar(t) ? un(t) : Object.prototype.toString.call(t);
|
|
507
|
+
} catch {
|
|
508
|
+
return "<unknown>";
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
function he(t) {
|
|
512
|
+
if (typeof t == "object" && t !== null) {
|
|
513
|
+
const e = {};
|
|
514
|
+
for (const n in t)
|
|
515
|
+
Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
|
|
516
|
+
return e;
|
|
517
|
+
} else
|
|
518
|
+
return {};
|
|
519
|
+
}
|
|
520
|
+
function mr(t, e = 40) {
|
|
521
|
+
const n = Object.keys(ln(t));
|
|
522
|
+
n.sort();
|
|
523
|
+
const r = n[0];
|
|
524
|
+
if (!r)
|
|
525
|
+
return "[object has no keys]";
|
|
526
|
+
if (r.length >= e)
|
|
527
|
+
return dt(r, e);
|
|
528
|
+
for (let s = n.length; s > 0; s--) {
|
|
529
|
+
const o = n.slice(0, s).join(", ");
|
|
530
|
+
if (!(o.length > e))
|
|
531
|
+
return s === n.length ? o : dt(o, e);
|
|
532
|
+
}
|
|
533
|
+
return "";
|
|
534
|
+
}
|
|
535
|
+
function gr() {
|
|
536
|
+
const t = _;
|
|
537
|
+
return t.crypto || t.msCrypto;
|
|
538
|
+
}
|
|
539
|
+
function I(t = gr()) {
|
|
540
|
+
let e = () => Math.random() * 16;
|
|
541
|
+
try {
|
|
542
|
+
if (t?.randomUUID)
|
|
543
|
+
return t.randomUUID().replace(/-/g, "");
|
|
544
|
+
t?.getRandomValues && (e = () => {
|
|
545
|
+
const n = new Uint8Array(1);
|
|
546
|
+
return t.getRandomValues(n), n[0];
|
|
547
|
+
});
|
|
548
|
+
} catch {
|
|
549
|
+
}
|
|
550
|
+
return ("10000000100040008000" + 1e11).replace(
|
|
551
|
+
/[018]/g,
|
|
552
|
+
(n) => (
|
|
553
|
+
// eslint-disable-next-line no-bitwise
|
|
554
|
+
(n ^ (e() & 15) >> n / 4).toString(16)
|
|
555
|
+
)
|
|
556
|
+
);
|
|
557
|
+
}
|
|
558
|
+
function dn(t) {
|
|
559
|
+
return t.exception?.values?.[0];
|
|
560
|
+
}
|
|
561
|
+
function L(t) {
|
|
562
|
+
const { message: e, event_id: n } = t;
|
|
563
|
+
if (e)
|
|
564
|
+
return e;
|
|
565
|
+
const r = dn(t);
|
|
566
|
+
return r ? r.type && r.value ? `${r.type}: ${r.value}` : r.type || r.value || n || "<unknown>" : n || "<unknown>";
|
|
567
|
+
}
|
|
568
|
+
function Nt(t, e, n) {
|
|
569
|
+
const r = t.exception = t.exception || {}, s = r.values = r.values || [], o = s[0] = s[0] || {};
|
|
570
|
+
o.value || (o.value = e || ""), o.type || (o.type = "Error");
|
|
571
|
+
}
|
|
572
|
+
function H(t, e) {
|
|
573
|
+
const n = dn(t);
|
|
574
|
+
if (!n)
|
|
575
|
+
return;
|
|
576
|
+
const r = { type: "generic", handled: !0 }, s = n.mechanism;
|
|
577
|
+
if (n.mechanism = { ...r, ...s, ...e }, e && "data" in e) {
|
|
578
|
+
const o = { ...s?.data, ...e.data };
|
|
579
|
+
n.mechanism.data = o;
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
function me(t) {
|
|
583
|
+
if (_r(t))
|
|
584
|
+
return !0;
|
|
585
|
+
try {
|
|
586
|
+
F(t, "__sentry_captured__", !0);
|
|
587
|
+
} catch {
|
|
588
|
+
}
|
|
589
|
+
return !1;
|
|
590
|
+
}
|
|
591
|
+
function _r(t) {
|
|
592
|
+
try {
|
|
593
|
+
return t.__sentry_captured__;
|
|
594
|
+
} catch {
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
const pn = 1e3;
|
|
598
|
+
function Z() {
|
|
599
|
+
return Date.now() / pn;
|
|
600
|
+
}
|
|
601
|
+
function yr() {
|
|
602
|
+
const { performance: t } = _;
|
|
603
|
+
if (!t?.now || !t.timeOrigin)
|
|
604
|
+
return Z;
|
|
605
|
+
const e = t.timeOrigin;
|
|
606
|
+
return () => (e + t.now()) / pn;
|
|
607
|
+
}
|
|
608
|
+
let ge;
|
|
609
|
+
function x() {
|
|
610
|
+
return (ge ?? (ge = yr()))();
|
|
611
|
+
}
|
|
612
|
+
function Er(t) {
|
|
613
|
+
const e = x(), n = {
|
|
614
|
+
sid: I(),
|
|
615
|
+
init: !0,
|
|
616
|
+
timestamp: e,
|
|
617
|
+
started: e,
|
|
618
|
+
duration: 0,
|
|
619
|
+
status: "ok",
|
|
620
|
+
errors: 0,
|
|
621
|
+
ignoreDuration: !1,
|
|
622
|
+
toJSON: () => br(n)
|
|
623
|
+
};
|
|
624
|
+
return t && G(n, t), n;
|
|
625
|
+
}
|
|
626
|
+
function G(t, e = {}) {
|
|
627
|
+
if (e.user && (!t.ipAddress && e.user.ip_address && (t.ipAddress = e.user.ip_address), !t.did && !e.did && (t.did = e.user.id || e.user.email || e.user.username)), t.timestamp = e.timestamp || x(), e.abnormal_mechanism && (t.abnormal_mechanism = e.abnormal_mechanism), e.ignoreDuration && (t.ignoreDuration = e.ignoreDuration), e.sid && (t.sid = e.sid.length === 32 ? e.sid : I()), e.init !== void 0 && (t.init = e.init), !t.did && e.did && (t.did = `${e.did}`), typeof e.started == "number" && (t.started = e.started), t.ignoreDuration)
|
|
628
|
+
t.duration = void 0;
|
|
629
|
+
else if (typeof e.duration == "number")
|
|
630
|
+
t.duration = e.duration;
|
|
631
|
+
else {
|
|
632
|
+
const n = t.timestamp - t.started;
|
|
633
|
+
t.duration = n >= 0 ? n : 0;
|
|
634
|
+
}
|
|
635
|
+
e.release && (t.release = e.release), e.environment && (t.environment = e.environment), !t.ipAddress && e.ipAddress && (t.ipAddress = e.ipAddress), !t.userAgent && e.userAgent && (t.userAgent = e.userAgent), typeof e.errors == "number" && (t.errors = e.errors), e.status && (t.status = e.status);
|
|
636
|
+
}
|
|
637
|
+
function Sr(t, e) {
|
|
638
|
+
let n = {};
|
|
639
|
+
t.status === "ok" && (n = { status: "exited" }), G(t, n);
|
|
640
|
+
}
|
|
641
|
+
function br(t) {
|
|
642
|
+
return {
|
|
643
|
+
sid: `${t.sid}`,
|
|
644
|
+
init: t.init,
|
|
645
|
+
// Make sure that sec is converted to ms for date constructor
|
|
646
|
+
started: new Date(t.started * 1e3).toISOString(),
|
|
647
|
+
timestamp: new Date(t.timestamp * 1e3).toISOString(),
|
|
648
|
+
status: t.status,
|
|
649
|
+
errors: t.errors,
|
|
650
|
+
did: typeof t.did == "number" || typeof t.did == "string" ? `${t.did}` : void 0,
|
|
651
|
+
duration: t.duration,
|
|
652
|
+
abnormal_mechanism: t.abnormal_mechanism,
|
|
653
|
+
attrs: {
|
|
654
|
+
release: t.release,
|
|
655
|
+
environment: t.environment,
|
|
656
|
+
ip_address: t.ipAddress,
|
|
657
|
+
user_agent: t.userAgent
|
|
658
|
+
}
|
|
659
|
+
};
|
|
660
|
+
}
|
|
661
|
+
function Q(t, e, n = 2) {
|
|
662
|
+
if (!e || typeof e != "object" || n <= 0)
|
|
663
|
+
return e;
|
|
664
|
+
if (t && Object.keys(e).length === 0)
|
|
665
|
+
return t;
|
|
666
|
+
const r = { ...t };
|
|
667
|
+
for (const s in e)
|
|
668
|
+
Object.prototype.hasOwnProperty.call(e, s) && (r[s] = Q(r[s], e[s], n - 1));
|
|
669
|
+
return r;
|
|
670
|
+
}
|
|
671
|
+
function _e() {
|
|
672
|
+
return I();
|
|
673
|
+
}
|
|
674
|
+
function hn() {
|
|
675
|
+
return I().substring(16);
|
|
676
|
+
}
|
|
677
|
+
const Ct = "_sentrySpan";
|
|
678
|
+
function ye(t, e) {
|
|
679
|
+
e ? F(t, Ct, e) : delete t[Ct];
|
|
680
|
+
}
|
|
681
|
+
function Ee(t) {
|
|
682
|
+
return t[Ct];
|
|
683
|
+
}
|
|
684
|
+
const Tr = 100;
|
|
685
|
+
class w {
|
|
686
|
+
/** Flag if notifying is happening. */
|
|
687
|
+
/** Callback for client to receive scope changes. */
|
|
688
|
+
/** Callback list that will be called during event processing. */
|
|
689
|
+
/** Array of breadcrumbs. */
|
|
690
|
+
/** User */
|
|
691
|
+
/** Tags */
|
|
692
|
+
/** Extra */
|
|
693
|
+
/** Contexts */
|
|
694
|
+
/** Attachments */
|
|
695
|
+
/** Propagation Context for distributed tracing */
|
|
696
|
+
/**
|
|
697
|
+
* A place to stash data which is needed at some point in the SDK's event processing pipeline but which shouldn't get
|
|
698
|
+
* sent to Sentry
|
|
699
|
+
*/
|
|
700
|
+
/** Fingerprint */
|
|
701
|
+
/** Severity */
|
|
702
|
+
/**
|
|
703
|
+
* Transaction Name
|
|
704
|
+
*
|
|
705
|
+
* IMPORTANT: The transaction name on the scope has nothing to do with root spans/transaction objects.
|
|
706
|
+
* It's purpose is to assign a transaction to the scope that's added to non-transaction events.
|
|
707
|
+
*/
|
|
708
|
+
/** Session */
|
|
709
|
+
/** The client on this scope */
|
|
710
|
+
/** Contains the last event id of a captured event. */
|
|
711
|
+
// NOTE: Any field which gets added here should get added not only to the constructor but also to the `clone` method.
|
|
712
|
+
constructor() {
|
|
713
|
+
this._notifyingListeners = !1, this._scopeListeners = [], this._eventProcessors = [], this._breadcrumbs = [], this._attachments = [], this._user = {}, this._tags = {}, this._extra = {}, this._contexts = {}, this._sdkProcessingMetadata = {}, this._propagationContext = {
|
|
714
|
+
traceId: _e(),
|
|
715
|
+
sampleRand: Math.random()
|
|
716
|
+
};
|
|
717
|
+
}
|
|
718
|
+
/**
|
|
719
|
+
* Clone all data from this scope into a new scope.
|
|
720
|
+
*/
|
|
721
|
+
clone() {
|
|
722
|
+
const e = new w();
|
|
723
|
+
return e._breadcrumbs = [...this._breadcrumbs], e._tags = { ...this._tags }, e._extra = { ...this._extra }, e._contexts = { ...this._contexts }, this._contexts.flags && (e._contexts.flags = {
|
|
724
|
+
values: [...this._contexts.flags.values]
|
|
725
|
+
}), e._user = this._user, e._level = this._level, e._session = this._session, e._transactionName = this._transactionName, e._fingerprint = this._fingerprint, e._eventProcessors = [...this._eventProcessors], e._attachments = [...this._attachments], e._sdkProcessingMetadata = { ...this._sdkProcessingMetadata }, e._propagationContext = { ...this._propagationContext }, e._client = this._client, e._lastEventId = this._lastEventId, ye(e, Ee(this)), e;
|
|
726
|
+
}
|
|
727
|
+
/**
|
|
728
|
+
* Update the client assigned to this scope.
|
|
729
|
+
* Note that not every scope will have a client assigned - isolation scopes & the global scope will generally not have a client,
|
|
730
|
+
* as well as manually created scopes.
|
|
731
|
+
*/
|
|
732
|
+
setClient(e) {
|
|
733
|
+
this._client = e;
|
|
734
|
+
}
|
|
735
|
+
/**
|
|
736
|
+
* Set the ID of the last captured error event.
|
|
737
|
+
* This is generally only captured on the isolation scope.
|
|
738
|
+
*/
|
|
739
|
+
setLastEventId(e) {
|
|
740
|
+
this._lastEventId = e;
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
743
|
+
* Get the client assigned to this scope.
|
|
744
|
+
*/
|
|
745
|
+
getClient() {
|
|
746
|
+
return this._client;
|
|
747
|
+
}
|
|
748
|
+
/**
|
|
749
|
+
* Get the ID of the last captured error event.
|
|
750
|
+
* This is generally only available on the isolation scope.
|
|
751
|
+
*/
|
|
752
|
+
lastEventId() {
|
|
753
|
+
return this._lastEventId;
|
|
754
|
+
}
|
|
755
|
+
/**
|
|
756
|
+
* @inheritDoc
|
|
757
|
+
*/
|
|
758
|
+
addScopeListener(e) {
|
|
759
|
+
this._scopeListeners.push(e);
|
|
760
|
+
}
|
|
761
|
+
/**
|
|
762
|
+
* Add an event processor that will be called before an event is sent.
|
|
763
|
+
*/
|
|
764
|
+
addEventProcessor(e) {
|
|
765
|
+
return this._eventProcessors.push(e), this;
|
|
766
|
+
}
|
|
767
|
+
/**
|
|
768
|
+
* Set the user for this scope.
|
|
769
|
+
* Set to `null` to unset the user.
|
|
770
|
+
*/
|
|
771
|
+
setUser(e) {
|
|
772
|
+
return this._user = e || {
|
|
773
|
+
email: void 0,
|
|
774
|
+
id: void 0,
|
|
775
|
+
ip_address: void 0,
|
|
776
|
+
username: void 0
|
|
777
|
+
}, this._session && G(this._session, { user: e }), this._notifyScopeListeners(), this;
|
|
778
|
+
}
|
|
779
|
+
/**
|
|
780
|
+
* Get the user from this scope.
|
|
781
|
+
*/
|
|
782
|
+
getUser() {
|
|
783
|
+
return this._user;
|
|
784
|
+
}
|
|
785
|
+
/**
|
|
786
|
+
* Set an object that will be merged into existing tags on the scope,
|
|
787
|
+
* and will be sent as tags data with the event.
|
|
788
|
+
*/
|
|
789
|
+
setTags(e) {
|
|
790
|
+
return this._tags = {
|
|
791
|
+
...this._tags,
|
|
792
|
+
...e
|
|
793
|
+
}, this._notifyScopeListeners(), this;
|
|
794
|
+
}
|
|
795
|
+
/**
|
|
796
|
+
* Set a single tag that will be sent as tags data with the event.
|
|
797
|
+
*/
|
|
798
|
+
setTag(e, n) {
|
|
799
|
+
return this._tags = { ...this._tags, [e]: n }, this._notifyScopeListeners(), this;
|
|
800
|
+
}
|
|
801
|
+
/**
|
|
802
|
+
* Set an object that will be merged into existing extra on the scope,
|
|
803
|
+
* and will be sent as extra data with the event.
|
|
804
|
+
*/
|
|
805
|
+
setExtras(e) {
|
|
806
|
+
return this._extra = {
|
|
807
|
+
...this._extra,
|
|
808
|
+
...e
|
|
809
|
+
}, this._notifyScopeListeners(), this;
|
|
810
|
+
}
|
|
811
|
+
/**
|
|
812
|
+
* Set a single key:value extra entry that will be sent as extra data with the event.
|
|
813
|
+
*/
|
|
814
|
+
setExtra(e, n) {
|
|
815
|
+
return this._extra = { ...this._extra, [e]: n }, this._notifyScopeListeners(), this;
|
|
816
|
+
}
|
|
817
|
+
/**
|
|
818
|
+
* Sets the fingerprint on the scope to send with the events.
|
|
819
|
+
* @param {string[]} fingerprint Fingerprint to group events in Sentry.
|
|
820
|
+
*/
|
|
821
|
+
setFingerprint(e) {
|
|
822
|
+
return this._fingerprint = e, this._notifyScopeListeners(), this;
|
|
823
|
+
}
|
|
824
|
+
/**
|
|
825
|
+
* Sets the level on the scope for future events.
|
|
826
|
+
*/
|
|
827
|
+
setLevel(e) {
|
|
828
|
+
return this._level = e, this._notifyScopeListeners(), this;
|
|
829
|
+
}
|
|
830
|
+
/**
|
|
831
|
+
* Sets the transaction name on the scope so that the name of e.g. taken server route or
|
|
832
|
+
* the page location is attached to future events.
|
|
833
|
+
*
|
|
834
|
+
* IMPORTANT: Calling this function does NOT change the name of the currently active
|
|
835
|
+
* root span. If you want to change the name of the active root span, use
|
|
836
|
+
* `Sentry.updateSpanName(rootSpan, 'new name')` instead.
|
|
837
|
+
*
|
|
838
|
+
* By default, the SDK updates the scope's transaction name automatically on sensible
|
|
839
|
+
* occasions, such as a page navigation or when handling a new request on the server.
|
|
840
|
+
*/
|
|
841
|
+
setTransactionName(e) {
|
|
842
|
+
return this._transactionName = e, this._notifyScopeListeners(), this;
|
|
843
|
+
}
|
|
844
|
+
/**
|
|
845
|
+
* Sets context data with the given name.
|
|
846
|
+
* Data passed as context will be normalized. You can also pass `null` to unset the context.
|
|
847
|
+
* Note that context data will not be merged - calling `setContext` will overwrite an existing context with the same key.
|
|
848
|
+
*/
|
|
849
|
+
setContext(e, n) {
|
|
850
|
+
return n === null ? delete this._contexts[e] : this._contexts[e] = n, this._notifyScopeListeners(), this;
|
|
851
|
+
}
|
|
852
|
+
/**
|
|
853
|
+
* Set the session for the scope.
|
|
854
|
+
*/
|
|
855
|
+
setSession(e) {
|
|
856
|
+
return e ? this._session = e : delete this._session, this._notifyScopeListeners(), this;
|
|
857
|
+
}
|
|
858
|
+
/**
|
|
859
|
+
* Get the session from the scope.
|
|
860
|
+
*/
|
|
861
|
+
getSession() {
|
|
862
|
+
return this._session;
|
|
863
|
+
}
|
|
864
|
+
/**
|
|
865
|
+
* Updates the scope with provided data. Can work in three variations:
|
|
866
|
+
* - plain object containing updatable attributes
|
|
867
|
+
* - Scope instance that'll extract the attributes from
|
|
868
|
+
* - callback function that'll receive the current scope as an argument and allow for modifications
|
|
869
|
+
*/
|
|
870
|
+
update(e) {
|
|
871
|
+
if (!e)
|
|
872
|
+
return this;
|
|
873
|
+
const n = typeof e == "function" ? e(this) : e, r = n instanceof w ? n.getScopeData() : K(n) ? e : void 0, { tags: s, extra: o, user: i, contexts: a, level: c, fingerprint: u = [], propagationContext: f } = r || {};
|
|
874
|
+
return this._tags = { ...this._tags, ...s }, this._extra = { ...this._extra, ...o }, this._contexts = { ...this._contexts, ...a }, i && Object.keys(i).length && (this._user = i), c && (this._level = c), u.length && (this._fingerprint = u), f && (this._propagationContext = f), this;
|
|
875
|
+
}
|
|
876
|
+
/**
|
|
877
|
+
* Clears the current scope and resets its properties.
|
|
878
|
+
* Note: The client will not be cleared.
|
|
879
|
+
*/
|
|
880
|
+
clear() {
|
|
881
|
+
return this._breadcrumbs = [], this._tags = {}, this._extra = {}, this._user = {}, this._contexts = {}, this._level = void 0, this._transactionName = void 0, this._fingerprint = void 0, this._session = void 0, ye(this, void 0), this._attachments = [], this.setPropagationContext({ traceId: _e(), sampleRand: Math.random() }), this._notifyScopeListeners(), this;
|
|
882
|
+
}
|
|
883
|
+
/**
|
|
884
|
+
* Adds a breadcrumb to the scope.
|
|
885
|
+
* By default, the last 100 breadcrumbs are kept.
|
|
886
|
+
*/
|
|
887
|
+
addBreadcrumb(e, n) {
|
|
888
|
+
const r = typeof n == "number" ? n : Tr;
|
|
889
|
+
if (r <= 0)
|
|
890
|
+
return this;
|
|
891
|
+
const s = {
|
|
892
|
+
timestamp: Z(),
|
|
893
|
+
...e,
|
|
894
|
+
// Breadcrumb messages can theoretically be infinitely large and they're held in memory so we truncate them not to leak (too much) memory
|
|
895
|
+
message: e.message ? dt(e.message, 2048) : e.message
|
|
896
|
+
};
|
|
897
|
+
return this._breadcrumbs.push(s), this._breadcrumbs.length > r && (this._breadcrumbs = this._breadcrumbs.slice(-r), this._client?.recordDroppedEvent("buffer_overflow", "log_item")), this._notifyScopeListeners(), this;
|
|
898
|
+
}
|
|
899
|
+
/**
|
|
900
|
+
* Get the last breadcrumb of the scope.
|
|
901
|
+
*/
|
|
902
|
+
getLastBreadcrumb() {
|
|
903
|
+
return this._breadcrumbs[this._breadcrumbs.length - 1];
|
|
904
|
+
}
|
|
905
|
+
/**
|
|
906
|
+
* Clear all breadcrumbs from the scope.
|
|
907
|
+
*/
|
|
908
|
+
clearBreadcrumbs() {
|
|
909
|
+
return this._breadcrumbs = [], this._notifyScopeListeners(), this;
|
|
910
|
+
}
|
|
911
|
+
/**
|
|
912
|
+
* Add an attachment to the scope.
|
|
913
|
+
*/
|
|
914
|
+
addAttachment(e) {
|
|
915
|
+
return this._attachments.push(e), this;
|
|
916
|
+
}
|
|
917
|
+
/**
|
|
918
|
+
* Clear all attachments from the scope.
|
|
919
|
+
*/
|
|
920
|
+
clearAttachments() {
|
|
921
|
+
return this._attachments = [], this;
|
|
922
|
+
}
|
|
923
|
+
/**
|
|
924
|
+
* Get the data of this scope, which should be applied to an event during processing.
|
|
925
|
+
*/
|
|
926
|
+
getScopeData() {
|
|
927
|
+
return {
|
|
928
|
+
breadcrumbs: this._breadcrumbs,
|
|
929
|
+
attachments: this._attachments,
|
|
930
|
+
contexts: this._contexts,
|
|
931
|
+
tags: this._tags,
|
|
932
|
+
extra: this._extra,
|
|
933
|
+
user: this._user,
|
|
934
|
+
level: this._level,
|
|
935
|
+
fingerprint: this._fingerprint || [],
|
|
936
|
+
eventProcessors: this._eventProcessors,
|
|
937
|
+
propagationContext: this._propagationContext,
|
|
938
|
+
sdkProcessingMetadata: this._sdkProcessingMetadata,
|
|
939
|
+
transactionName: this._transactionName,
|
|
940
|
+
span: Ee(this)
|
|
941
|
+
};
|
|
942
|
+
}
|
|
943
|
+
/**
|
|
944
|
+
* Add data which will be accessible during event processing but won't get sent to Sentry.
|
|
945
|
+
*/
|
|
946
|
+
setSDKProcessingMetadata(e) {
|
|
947
|
+
return this._sdkProcessingMetadata = Q(this._sdkProcessingMetadata, e, 2), this;
|
|
948
|
+
}
|
|
949
|
+
/**
|
|
950
|
+
* Add propagation context to the scope, used for distributed tracing
|
|
951
|
+
*/
|
|
952
|
+
setPropagationContext(e) {
|
|
953
|
+
return this._propagationContext = e, this;
|
|
954
|
+
}
|
|
955
|
+
/**
|
|
956
|
+
* Get propagation context from the scope, used for distributed tracing
|
|
957
|
+
*/
|
|
958
|
+
getPropagationContext() {
|
|
959
|
+
return this._propagationContext;
|
|
960
|
+
}
|
|
961
|
+
/**
|
|
962
|
+
* Capture an exception for this scope.
|
|
963
|
+
*
|
|
964
|
+
* @returns {string} The id of the captured Sentry event.
|
|
965
|
+
*/
|
|
966
|
+
captureException(e, n) {
|
|
967
|
+
const r = n?.event_id || I();
|
|
968
|
+
if (!this._client)
|
|
969
|
+
return h && p.warn("No client configured on scope - will not capture exception!"), r;
|
|
970
|
+
const s = new Error("Sentry syntheticException");
|
|
971
|
+
return this._client.captureException(
|
|
972
|
+
e,
|
|
973
|
+
{
|
|
974
|
+
originalException: e,
|
|
975
|
+
syntheticException: s,
|
|
976
|
+
...n,
|
|
977
|
+
event_id: r
|
|
978
|
+
},
|
|
979
|
+
this
|
|
980
|
+
), r;
|
|
981
|
+
}
|
|
982
|
+
/**
|
|
983
|
+
* Capture a message for this scope.
|
|
984
|
+
*
|
|
985
|
+
* @returns {string} The id of the captured message.
|
|
986
|
+
*/
|
|
987
|
+
captureMessage(e, n, r) {
|
|
988
|
+
const s = r?.event_id || I();
|
|
989
|
+
if (!this._client)
|
|
990
|
+
return h && p.warn("No client configured on scope - will not capture message!"), s;
|
|
991
|
+
const o = new Error(e);
|
|
992
|
+
return this._client.captureMessage(
|
|
993
|
+
e,
|
|
994
|
+
n,
|
|
995
|
+
{
|
|
996
|
+
originalException: e,
|
|
997
|
+
syntheticException: o,
|
|
998
|
+
...r,
|
|
999
|
+
event_id: s
|
|
1000
|
+
},
|
|
1001
|
+
this
|
|
1002
|
+
), s;
|
|
1003
|
+
}
|
|
1004
|
+
/**
|
|
1005
|
+
* Capture a Sentry event for this scope.
|
|
1006
|
+
*
|
|
1007
|
+
* @returns {string} The id of the captured event.
|
|
1008
|
+
*/
|
|
1009
|
+
captureEvent(e, n) {
|
|
1010
|
+
const r = n?.event_id || I();
|
|
1011
|
+
return this._client ? (this._client.captureEvent(e, { ...n, event_id: r }, this), r) : (h && p.warn("No client configured on scope - will not capture event!"), r);
|
|
1012
|
+
}
|
|
1013
|
+
/**
|
|
1014
|
+
* This will be called on every set call.
|
|
1015
|
+
*/
|
|
1016
|
+
_notifyScopeListeners() {
|
|
1017
|
+
this._notifyingListeners || (this._notifyingListeners = !0, this._scopeListeners.forEach((e) => {
|
|
1018
|
+
e(this);
|
|
1019
|
+
}), this._notifyingListeners = !1);
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
function Ir() {
|
|
1023
|
+
return J("defaultCurrentScope", () => new w());
|
|
1024
|
+
}
|
|
1025
|
+
function vr() {
|
|
1026
|
+
return J("defaultIsolationScope", () => new w());
|
|
1027
|
+
}
|
|
1028
|
+
class wr {
|
|
1029
|
+
constructor(e, n) {
|
|
1030
|
+
let r;
|
|
1031
|
+
e ? r = e : r = new w();
|
|
1032
|
+
let s;
|
|
1033
|
+
n ? s = n : s = new w(), this._stack = [{ scope: r }], this._isolationScope = s;
|
|
1034
|
+
}
|
|
1035
|
+
/**
|
|
1036
|
+
* Fork a scope for the stack.
|
|
1037
|
+
*/
|
|
1038
|
+
withScope(e) {
|
|
1039
|
+
const n = this._pushScope();
|
|
1040
|
+
let r;
|
|
1041
|
+
try {
|
|
1042
|
+
r = e(n);
|
|
1043
|
+
} catch (s) {
|
|
1044
|
+
throw this._popScope(), s;
|
|
1045
|
+
}
|
|
1046
|
+
return yt(r) ? r.then(
|
|
1047
|
+
(s) => (this._popScope(), s),
|
|
1048
|
+
(s) => {
|
|
1049
|
+
throw this._popScope(), s;
|
|
1050
|
+
}
|
|
1051
|
+
) : (this._popScope(), r);
|
|
1052
|
+
}
|
|
1053
|
+
/**
|
|
1054
|
+
* Get the client of the stack.
|
|
1055
|
+
*/
|
|
1056
|
+
getClient() {
|
|
1057
|
+
return this.getStackTop().client;
|
|
1058
|
+
}
|
|
1059
|
+
/**
|
|
1060
|
+
* Returns the scope of the top stack.
|
|
1061
|
+
*/
|
|
1062
|
+
getScope() {
|
|
1063
|
+
return this.getStackTop().scope;
|
|
1064
|
+
}
|
|
1065
|
+
/**
|
|
1066
|
+
* Get the isolation scope for the stack.
|
|
1067
|
+
*/
|
|
1068
|
+
getIsolationScope() {
|
|
1069
|
+
return this._isolationScope;
|
|
1070
|
+
}
|
|
1071
|
+
/**
|
|
1072
|
+
* Returns the topmost scope layer in the order domain > local > process.
|
|
1073
|
+
*/
|
|
1074
|
+
getStackTop() {
|
|
1075
|
+
return this._stack[this._stack.length - 1];
|
|
1076
|
+
}
|
|
1077
|
+
/**
|
|
1078
|
+
* Push a scope to the stack.
|
|
1079
|
+
*/
|
|
1080
|
+
_pushScope() {
|
|
1081
|
+
const e = this.getScope().clone();
|
|
1082
|
+
return this._stack.push({
|
|
1083
|
+
client: this.getClient(),
|
|
1084
|
+
scope: e
|
|
1085
|
+
}), e;
|
|
1086
|
+
}
|
|
1087
|
+
/**
|
|
1088
|
+
* Pop a scope from the stack.
|
|
1089
|
+
*/
|
|
1090
|
+
_popScope() {
|
|
1091
|
+
return this._stack.length <= 1 ? !1 : !!this._stack.pop();
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
function W() {
|
|
1095
|
+
const t = mt(), e = gt(t);
|
|
1096
|
+
return e.stack = e.stack || new wr(Ir(), vr());
|
|
1097
|
+
}
|
|
1098
|
+
function Rr(t) {
|
|
1099
|
+
return W().withScope(t);
|
|
1100
|
+
}
|
|
1101
|
+
function kr(t, e) {
|
|
1102
|
+
const n = W();
|
|
1103
|
+
return n.withScope(() => (n.getStackTop().scope = t, e(t)));
|
|
1104
|
+
}
|
|
1105
|
+
function Se(t) {
|
|
1106
|
+
return W().withScope(() => t(W().getIsolationScope()));
|
|
1107
|
+
}
|
|
1108
|
+
function Ar() {
|
|
1109
|
+
return {
|
|
1110
|
+
withIsolationScope: Se,
|
|
1111
|
+
withScope: Rr,
|
|
1112
|
+
withSetScope: kr,
|
|
1113
|
+
withSetIsolationScope: (t, e) => Se(e),
|
|
1114
|
+
getCurrentScope: () => W().getScope(),
|
|
1115
|
+
getIsolationScope: () => W().getIsolationScope()
|
|
1116
|
+
};
|
|
1117
|
+
}
|
|
1118
|
+
function Qt(t) {
|
|
1119
|
+
const e = gt(t);
|
|
1120
|
+
return e.acs ? e.acs : Ar();
|
|
1121
|
+
}
|
|
1122
|
+
function D() {
|
|
1123
|
+
const t = mt();
|
|
1124
|
+
return Qt(t).getCurrentScope();
|
|
1125
|
+
}
|
|
1126
|
+
function tt() {
|
|
1127
|
+
const t = mt();
|
|
1128
|
+
return Qt(t).getIsolationScope();
|
|
1129
|
+
}
|
|
1130
|
+
function xr() {
|
|
1131
|
+
return J("globalScope", () => new w());
|
|
1132
|
+
}
|
|
1133
|
+
function Or(...t) {
|
|
1134
|
+
const e = mt(), n = Qt(e);
|
|
1135
|
+
if (t.length === 2) {
|
|
1136
|
+
const [r, s] = t;
|
|
1137
|
+
return r ? n.withSetScope(r, s) : n.withScope(s);
|
|
1138
|
+
}
|
|
1139
|
+
return n.withScope(t[0]);
|
|
1140
|
+
}
|
|
1141
|
+
function b() {
|
|
1142
|
+
return D().getClient();
|
|
1143
|
+
}
|
|
1144
|
+
function Nr(t) {
|
|
1145
|
+
const e = t.getPropagationContext(), { traceId: n, parentSpanId: r, propagationSpanId: s } = e, o = {
|
|
1146
|
+
trace_id: n,
|
|
1147
|
+
span_id: s || hn()
|
|
1148
|
+
};
|
|
1149
|
+
return r && (o.parent_span_id = r), o;
|
|
1150
|
+
}
|
|
1151
|
+
const Cr = "sentry.source", Dr = "sentry.sample_rate", Lr = "sentry.previous_trace_sample_rate", Pr = "sentry.op", Mr = "sentry.origin", mn = "sentry.profile_id", gn = "sentry.exclusive_time", Fr = 0, $r = 1, Ur = "_sentryScope", jr = "_sentryIsolationScope";
|
|
1152
|
+
function _n(t) {
|
|
1153
|
+
return {
|
|
1154
|
+
scope: t[Ur],
|
|
1155
|
+
isolationScope: t[jr]
|
|
1156
|
+
};
|
|
1157
|
+
}
|
|
1158
|
+
const Br = "sentry-", Hr = /^sentry-/;
|
|
1159
|
+
function Gr(t) {
|
|
1160
|
+
const e = Wr(t);
|
|
1161
|
+
if (!e)
|
|
1162
|
+
return;
|
|
1163
|
+
const n = Object.entries(e).reduce((r, [s, o]) => {
|
|
1164
|
+
if (s.match(Hr)) {
|
|
1165
|
+
const i = s.slice(Br.length);
|
|
1166
|
+
r[i] = o;
|
|
1167
|
+
}
|
|
1168
|
+
return r;
|
|
1169
|
+
}, {});
|
|
1170
|
+
if (Object.keys(n).length > 0)
|
|
1171
|
+
return n;
|
|
1172
|
+
}
|
|
1173
|
+
function Wr(t) {
|
|
1174
|
+
if (!(!t || !A(t) && !Array.isArray(t)))
|
|
1175
|
+
return Array.isArray(t) ? t.reduce((e, n) => {
|
|
1176
|
+
const r = be(n);
|
|
1177
|
+
return Object.entries(r).forEach(([s, o]) => {
|
|
1178
|
+
e[s] = o;
|
|
1179
|
+
}), e;
|
|
1180
|
+
}, {}) : be(t);
|
|
1181
|
+
}
|
|
1182
|
+
function be(t) {
|
|
1183
|
+
return t.split(",").map(
|
|
1184
|
+
(e) => e.split("=").map((n) => {
|
|
1185
|
+
try {
|
|
1186
|
+
return decodeURIComponent(n.trim());
|
|
1187
|
+
} catch {
|
|
1188
|
+
return;
|
|
1189
|
+
}
|
|
1190
|
+
})
|
|
1191
|
+
).reduce((e, [n, r]) => (n && r && (e[n] = r), e), {});
|
|
1192
|
+
}
|
|
1193
|
+
function qr(t) {
|
|
1194
|
+
if (typeof t == "boolean")
|
|
1195
|
+
return Number(t);
|
|
1196
|
+
const e = typeof t == "string" ? parseFloat(t) : t;
|
|
1197
|
+
if (!(typeof e != "number" || isNaN(e) || e < 0 || e > 1))
|
|
1198
|
+
return e;
|
|
1199
|
+
}
|
|
1200
|
+
const yn = 1;
|
|
1201
|
+
let Te = !1;
|
|
1202
|
+
function Yr(t) {
|
|
1203
|
+
const { spanId: e, traceId: n, isRemote: r } = t.spanContext(), s = r ? e : te(t).parent_span_id, o = _n(t).scope, i = r ? o?.getPropagationContext().propagationSpanId || hn() : e;
|
|
1204
|
+
return {
|
|
1205
|
+
parent_span_id: s,
|
|
1206
|
+
span_id: i,
|
|
1207
|
+
trace_id: n
|
|
1208
|
+
};
|
|
1209
|
+
}
|
|
1210
|
+
function zr(t) {
|
|
1211
|
+
if (t && t.length > 0)
|
|
1212
|
+
return t.map(({ context: { spanId: e, traceId: n, traceFlags: r, ...s }, attributes: o }) => ({
|
|
1213
|
+
span_id: e,
|
|
1214
|
+
trace_id: n,
|
|
1215
|
+
sampled: r === yn,
|
|
1216
|
+
attributes: o,
|
|
1217
|
+
...s
|
|
1218
|
+
}));
|
|
1219
|
+
}
|
|
1220
|
+
function Ie(t) {
|
|
1221
|
+
return typeof t == "number" ? ve(t) : Array.isArray(t) ? t[0] + t[1] / 1e9 : t instanceof Date ? ve(t.getTime()) : x();
|
|
1222
|
+
}
|
|
1223
|
+
function ve(t) {
|
|
1224
|
+
return t > 9999999999 ? t / 1e3 : t;
|
|
1225
|
+
}
|
|
1226
|
+
function te(t) {
|
|
1227
|
+
if (Kr(t))
|
|
1228
|
+
return t.getSpanJSON();
|
|
1229
|
+
const { spanId: e, traceId: n } = t.spanContext();
|
|
1230
|
+
if (Xr(t)) {
|
|
1231
|
+
const { attributes: r, startTime: s, name: o, endTime: i, status: a, links: c } = t, u = "parentSpanId" in t ? t.parentSpanId : "parentSpanContext" in t ? t.parentSpanContext?.spanId : void 0;
|
|
1232
|
+
return {
|
|
1233
|
+
span_id: e,
|
|
1234
|
+
trace_id: n,
|
|
1235
|
+
data: r,
|
|
1236
|
+
description: o,
|
|
1237
|
+
parent_span_id: u,
|
|
1238
|
+
start_timestamp: Ie(s),
|
|
1239
|
+
// This is [0,0] by default in OTEL, in which case we want to interpret this as no end time
|
|
1240
|
+
timestamp: Ie(i) || void 0,
|
|
1241
|
+
status: Jr(a),
|
|
1242
|
+
op: r[Pr],
|
|
1243
|
+
origin: r[Mr],
|
|
1244
|
+
links: zr(c)
|
|
1245
|
+
};
|
|
1246
|
+
}
|
|
1247
|
+
return {
|
|
1248
|
+
span_id: e,
|
|
1249
|
+
trace_id: n,
|
|
1250
|
+
start_timestamp: 0,
|
|
1251
|
+
data: {}
|
|
1252
|
+
};
|
|
1253
|
+
}
|
|
1254
|
+
function Xr(t) {
|
|
1255
|
+
const e = t;
|
|
1256
|
+
return !!e.attributes && !!e.startTime && !!e.name && !!e.endTime && !!e.status;
|
|
1257
|
+
}
|
|
1258
|
+
function Kr(t) {
|
|
1259
|
+
return typeof t.getSpanJSON == "function";
|
|
1260
|
+
}
|
|
1261
|
+
function Vr(t) {
|
|
1262
|
+
const { traceFlags: e } = t.spanContext();
|
|
1263
|
+
return e === yn;
|
|
1264
|
+
}
|
|
1265
|
+
function Jr(t) {
|
|
1266
|
+
if (!(!t || t.code === Fr))
|
|
1267
|
+
return t.code === $r ? "ok" : t.message || "unknown_error";
|
|
1268
|
+
}
|
|
1269
|
+
const Zr = "_sentryRootSpan";
|
|
1270
|
+
function En(t) {
|
|
1271
|
+
return t[Zr] || t;
|
|
1272
|
+
}
|
|
1273
|
+
function we() {
|
|
1274
|
+
Te || (Y(() => {
|
|
1275
|
+
console.warn(
|
|
1276
|
+
"[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly."
|
|
1277
|
+
);
|
|
1278
|
+
}), Te = !0);
|
|
1279
|
+
}
|
|
1280
|
+
function Qr(t) {
|
|
1281
|
+
if (typeof __SENTRY_TRACING__ == "boolean" && !__SENTRY_TRACING__)
|
|
1282
|
+
return !1;
|
|
1283
|
+
const e = t || b()?.getOptions();
|
|
1284
|
+
return !!e && // Note: This check is `!= null`, meaning "nullish". `0` is not "nullish", `undefined` and `null` are. (This comment was brought to you by 15 minutes of questioning life)
|
|
1285
|
+
(e.tracesSampleRate != null || !!e.tracesSampler);
|
|
1286
|
+
}
|
|
1287
|
+
const ee = "production", ts = /^o(\d+)\./, es = /^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;
|
|
1288
|
+
function ns(t) {
|
|
1289
|
+
return t === "http" || t === "https";
|
|
1290
|
+
}
|
|
1291
|
+
function St(t, e = !1) {
|
|
1292
|
+
const { host: n, path: r, pass: s, port: o, projectId: i, protocol: a, publicKey: c } = t;
|
|
1293
|
+
return `${a}://${c}${e && s ? `:${s}` : ""}@${n}${o ? `:${o}` : ""}/${r && `${r}/`}${i}`;
|
|
1294
|
+
}
|
|
1295
|
+
function rs(t) {
|
|
1296
|
+
const e = es.exec(t);
|
|
1297
|
+
if (!e) {
|
|
1298
|
+
Y(() => {
|
|
1299
|
+
console.error(`Invalid Sentry Dsn: ${t}`);
|
|
1300
|
+
});
|
|
1301
|
+
return;
|
|
1302
|
+
}
|
|
1303
|
+
const [n, r, s = "", o = "", i = "", a = ""] = e.slice(1);
|
|
1304
|
+
let c = "", u = a;
|
|
1305
|
+
const f = u.split("/");
|
|
1306
|
+
if (f.length > 1 && (c = f.slice(0, -1).join("/"), u = f.pop()), u) {
|
|
1307
|
+
const l = u.match(/^\d+/);
|
|
1308
|
+
l && (u = l[0]);
|
|
1309
|
+
}
|
|
1310
|
+
return Sn({ host: o, pass: s, path: c, projectId: u, port: i, protocol: n, publicKey: r });
|
|
1311
|
+
}
|
|
1312
|
+
function Sn(t) {
|
|
1313
|
+
return {
|
|
1314
|
+
protocol: t.protocol,
|
|
1315
|
+
publicKey: t.publicKey || "",
|
|
1316
|
+
pass: t.pass || "",
|
|
1317
|
+
host: t.host,
|
|
1318
|
+
port: t.port || "",
|
|
1319
|
+
path: t.path || "",
|
|
1320
|
+
projectId: t.projectId
|
|
1321
|
+
};
|
|
1322
|
+
}
|
|
1323
|
+
function ss(t) {
|
|
1324
|
+
if (!h)
|
|
1325
|
+
return !0;
|
|
1326
|
+
const { port: e, projectId: n, protocol: r } = t;
|
|
1327
|
+
return ["protocol", "publicKey", "host", "projectId"].find((i) => t[i] ? !1 : (p.error(`Invalid Sentry Dsn: ${i} missing`), !0)) ? !1 : n.match(/^\d+$/) ? ns(r) ? e && isNaN(parseInt(e, 10)) ? (p.error(`Invalid Sentry Dsn: Invalid port ${e}`), !1) : !0 : (p.error(`Invalid Sentry Dsn: Invalid protocol ${r}`), !1) : (p.error(`Invalid Sentry Dsn: Invalid projectId ${n}`), !1);
|
|
1328
|
+
}
|
|
1329
|
+
function os(t) {
|
|
1330
|
+
return t.match(ts)?.[1];
|
|
1331
|
+
}
|
|
1332
|
+
function is(t) {
|
|
1333
|
+
const e = typeof t == "string" ? rs(t) : Sn(t);
|
|
1334
|
+
if (!(!e || !ss(e)))
|
|
1335
|
+
return e;
|
|
1336
|
+
}
|
|
1337
|
+
const as = "_frozenDsc";
|
|
1338
|
+
function bn(t, e) {
|
|
1339
|
+
const n = e.getOptions(), { publicKey: r, host: s } = e.getDsn() || {};
|
|
1340
|
+
let o;
|
|
1341
|
+
n.orgId ? o = String(n.orgId) : s && (o = os(s));
|
|
1342
|
+
const i = {
|
|
1343
|
+
environment: n.environment || ee,
|
|
1344
|
+
release: n.release,
|
|
1345
|
+
public_key: r,
|
|
1346
|
+
trace_id: t,
|
|
1347
|
+
org_id: o
|
|
1348
|
+
};
|
|
1349
|
+
return e.emit("createDsc", i), i;
|
|
1350
|
+
}
|
|
1351
|
+
function cs(t, e) {
|
|
1352
|
+
const n = e.getPropagationContext();
|
|
1353
|
+
return n.dsc || bn(n.traceId, t);
|
|
1354
|
+
}
|
|
1355
|
+
function us(t) {
|
|
1356
|
+
const e = b();
|
|
1357
|
+
if (!e)
|
|
1358
|
+
return {};
|
|
1359
|
+
const n = En(t), r = te(n), s = r.data, o = n.spanContext().traceState, i = o?.get("sentry.sample_rate") ?? s[Dr] ?? s[Lr];
|
|
1360
|
+
function a(E) {
|
|
1361
|
+
return (typeof i == "number" || typeof i == "string") && (E.sample_rate = `${i}`), E;
|
|
1362
|
+
}
|
|
1363
|
+
const c = n[as];
|
|
1364
|
+
if (c)
|
|
1365
|
+
return a(c);
|
|
1366
|
+
const u = o?.get("sentry.dsc"), f = u && Gr(u);
|
|
1367
|
+
if (f)
|
|
1368
|
+
return a(f);
|
|
1369
|
+
const l = bn(t.spanContext().traceId, e), m = s[Cr], d = r.description;
|
|
1370
|
+
return m !== "url" && d && (l.transaction = d), Qr() && (l.sampled = String(Vr(n)), l.sample_rand = // In OTEL we store the sample rand on the trace state because we cannot access scopes for NonRecordingSpans
|
|
1371
|
+
// The Sentry OTEL SpanSampler takes care of writing the sample rand on the root span
|
|
1372
|
+
o?.get("sentry.sample_rand") ?? // On all other platforms we can actually get the scopes from a root span (we use this as a fallback)
|
|
1373
|
+
_n(n).scope?.getPropagationContext().sampleRand.toString()), a(l), e.emit("createDsc", l, n), l;
|
|
1374
|
+
}
|
|
1375
|
+
function k(t, e = 100, n = 1 / 0) {
|
|
1376
|
+
try {
|
|
1377
|
+
return Dt("", t, e, n);
|
|
1378
|
+
} catch (r) {
|
|
1379
|
+
return { ERROR: `**non-serializable** (${r})` };
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
function Tn(t, e = 3, n = 100 * 1024) {
|
|
1383
|
+
const r = k(t, e);
|
|
1384
|
+
return ps(r) > n ? Tn(t, e - 1, n) : r;
|
|
1385
|
+
}
|
|
1386
|
+
function Dt(t, e, n = 1 / 0, r = 1 / 0, s = hs()) {
|
|
1387
|
+
const [o, i] = s;
|
|
1388
|
+
if (e == null || // this matches null and undefined -> eqeq not eqeqeq
|
|
1389
|
+
["boolean", "string"].includes(typeof e) || typeof e == "number" && Number.isFinite(e))
|
|
1390
|
+
return e;
|
|
1391
|
+
const a = fs(t, e);
|
|
1392
|
+
if (!a.startsWith("[object "))
|
|
1393
|
+
return a;
|
|
1394
|
+
if (e.__sentry_skip_normalization__)
|
|
1395
|
+
return e;
|
|
1396
|
+
const c = typeof e.__sentry_override_normalization_depth__ == "number" ? e.__sentry_override_normalization_depth__ : n;
|
|
1397
|
+
if (c === 0)
|
|
1398
|
+
return a.replace("object ", "");
|
|
1399
|
+
if (o(e))
|
|
1400
|
+
return "[Circular ~]";
|
|
1401
|
+
const u = e;
|
|
1402
|
+
if (u && typeof u.toJSON == "function")
|
|
1403
|
+
try {
|
|
1404
|
+
const d = u.toJSON();
|
|
1405
|
+
return Dt("", d, c - 1, r, s);
|
|
1406
|
+
} catch {
|
|
1407
|
+
}
|
|
1408
|
+
const f = Array.isArray(e) ? [] : {};
|
|
1409
|
+
let l = 0;
|
|
1410
|
+
const m = ln(e);
|
|
1411
|
+
for (const d in m) {
|
|
1412
|
+
if (!Object.prototype.hasOwnProperty.call(m, d))
|
|
1413
|
+
continue;
|
|
1414
|
+
if (l >= r) {
|
|
1415
|
+
f[d] = "[MaxProperties ~]";
|
|
1416
|
+
break;
|
|
1417
|
+
}
|
|
1418
|
+
const E = m[d];
|
|
1419
|
+
f[d] = Dt(d, E, c - 1, r, s), l++;
|
|
1420
|
+
}
|
|
1421
|
+
return i(e), f;
|
|
1422
|
+
}
|
|
1423
|
+
function fs(t, e) {
|
|
1424
|
+
try {
|
|
1425
|
+
if (t === "domain" && e && typeof e == "object" && e._events)
|
|
1426
|
+
return "[Domain]";
|
|
1427
|
+
if (t === "domainEmitter")
|
|
1428
|
+
return "[DomainEmitter]";
|
|
1429
|
+
if (typeof global < "u" && e === global)
|
|
1430
|
+
return "[Global]";
|
|
1431
|
+
if (typeof window < "u" && e === window)
|
|
1432
|
+
return "[Window]";
|
|
1433
|
+
if (typeof document < "u" && e === document)
|
|
1434
|
+
return "[Document]";
|
|
1435
|
+
if (cn(e))
|
|
1436
|
+
return "[VueViewModel]";
|
|
1437
|
+
if (ur(e))
|
|
1438
|
+
return "[SyntheticEvent]";
|
|
1439
|
+
if (typeof e == "number" && !Number.isFinite(e))
|
|
1440
|
+
return `[${e}]`;
|
|
1441
|
+
if (typeof e == "function")
|
|
1442
|
+
return `[Function: ${O(e)}]`;
|
|
1443
|
+
if (typeof e == "symbol")
|
|
1444
|
+
return `[${String(e)}]`;
|
|
1445
|
+
if (typeof e == "bigint")
|
|
1446
|
+
return `[BigInt: ${String(e)}]`;
|
|
1447
|
+
const n = ls(e);
|
|
1448
|
+
return /^HTML(\w*)Element$/.test(n) ? `[HTMLElement: ${n}]` : `[object ${n}]`;
|
|
1449
|
+
} catch (n) {
|
|
1450
|
+
return `**non-serializable** (${n})`;
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
function ls(t) {
|
|
1454
|
+
const e = Object.getPrototypeOf(t);
|
|
1455
|
+
return e?.constructor ? e.constructor.name : "null prototype";
|
|
1456
|
+
}
|
|
1457
|
+
function ds(t) {
|
|
1458
|
+
return ~-encodeURI(t).split(/%..|./).length;
|
|
1459
|
+
}
|
|
1460
|
+
function ps(t) {
|
|
1461
|
+
return ds(JSON.stringify(t));
|
|
1462
|
+
}
|
|
1463
|
+
function hs() {
|
|
1464
|
+
const t = /* @__PURE__ */ new WeakSet();
|
|
1465
|
+
function e(r) {
|
|
1466
|
+
return t.has(r) ? !0 : (t.add(r), !1);
|
|
1467
|
+
}
|
|
1468
|
+
function n(r) {
|
|
1469
|
+
t.delete(r);
|
|
1470
|
+
}
|
|
1471
|
+
return [e, n];
|
|
1472
|
+
}
|
|
1473
|
+
function et(t, e = []) {
|
|
1474
|
+
return [t, e];
|
|
1475
|
+
}
|
|
1476
|
+
function ms(t, e) {
|
|
1477
|
+
const [n, r] = t;
|
|
1478
|
+
return [n, [...r, e]];
|
|
1479
|
+
}
|
|
1480
|
+
function Re(t, e) {
|
|
1481
|
+
const n = t[1];
|
|
1482
|
+
for (const r of n) {
|
|
1483
|
+
const s = r[0].type;
|
|
1484
|
+
if (e(r, s))
|
|
1485
|
+
return !0;
|
|
1486
|
+
}
|
|
1487
|
+
return !1;
|
|
1488
|
+
}
|
|
1489
|
+
function Lt(t) {
|
|
1490
|
+
const e = gt(_);
|
|
1491
|
+
return e.encodePolyfill ? e.encodePolyfill(t) : new TextEncoder().encode(t);
|
|
1492
|
+
}
|
|
1493
|
+
function gs(t) {
|
|
1494
|
+
const [e, n] = t;
|
|
1495
|
+
let r = JSON.stringify(e);
|
|
1496
|
+
function s(o) {
|
|
1497
|
+
typeof r == "string" ? r = typeof o == "string" ? r + o : [Lt(r), o] : r.push(typeof o == "string" ? Lt(o) : o);
|
|
1498
|
+
}
|
|
1499
|
+
for (const o of n) {
|
|
1500
|
+
const [i, a] = o;
|
|
1501
|
+
if (s(`
|
|
1502
|
+
${JSON.stringify(i)}
|
|
1503
|
+
`), typeof a == "string" || a instanceof Uint8Array)
|
|
1504
|
+
s(a);
|
|
1505
|
+
else {
|
|
1506
|
+
let c;
|
|
1507
|
+
try {
|
|
1508
|
+
c = JSON.stringify(a);
|
|
1509
|
+
} catch {
|
|
1510
|
+
c = JSON.stringify(k(a));
|
|
1511
|
+
}
|
|
1512
|
+
s(c);
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1515
|
+
return typeof r == "string" ? r : _s(r);
|
|
1516
|
+
}
|
|
1517
|
+
function _s(t) {
|
|
1518
|
+
const e = t.reduce((s, o) => s + o.length, 0), n = new Uint8Array(e);
|
|
1519
|
+
let r = 0;
|
|
1520
|
+
for (const s of t)
|
|
1521
|
+
n.set(s, r), r += s.length;
|
|
1522
|
+
return n;
|
|
1523
|
+
}
|
|
1524
|
+
function ys(t) {
|
|
1525
|
+
const e = typeof t.data == "string" ? Lt(t.data) : t.data;
|
|
1526
|
+
return [
|
|
1527
|
+
{
|
|
1528
|
+
type: "attachment",
|
|
1529
|
+
length: e.length,
|
|
1530
|
+
filename: t.filename,
|
|
1531
|
+
content_type: t.contentType,
|
|
1532
|
+
attachment_type: t.attachmentType
|
|
1533
|
+
},
|
|
1534
|
+
e
|
|
1535
|
+
];
|
|
1536
|
+
}
|
|
1537
|
+
const Es = {
|
|
1538
|
+
session: "session",
|
|
1539
|
+
sessions: "session",
|
|
1540
|
+
attachment: "attachment",
|
|
1541
|
+
transaction: "transaction",
|
|
1542
|
+
event: "error",
|
|
1543
|
+
client_report: "internal",
|
|
1544
|
+
user_report: "default",
|
|
1545
|
+
profile: "profile",
|
|
1546
|
+
profile_chunk: "profile",
|
|
1547
|
+
replay_event: "replay",
|
|
1548
|
+
replay_recording: "replay",
|
|
1549
|
+
check_in: "monitor",
|
|
1550
|
+
feedback: "feedback",
|
|
1551
|
+
span: "span",
|
|
1552
|
+
raw_security: "security",
|
|
1553
|
+
log: "log_item"
|
|
1554
|
+
};
|
|
1555
|
+
function ke(t) {
|
|
1556
|
+
return Es[t];
|
|
1557
|
+
}
|
|
1558
|
+
function In(t) {
|
|
1559
|
+
if (!t?.sdk)
|
|
1560
|
+
return;
|
|
1561
|
+
const { name: e, version: n } = t.sdk;
|
|
1562
|
+
return { name: e, version: n };
|
|
1563
|
+
}
|
|
1564
|
+
function Ss(t, e, n, r) {
|
|
1565
|
+
const s = t.sdkProcessingMetadata?.dynamicSamplingContext;
|
|
1566
|
+
return {
|
|
1567
|
+
event_id: t.event_id,
|
|
1568
|
+
sent_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1569
|
+
...e && { sdk: e },
|
|
1570
|
+
...!!n && r && { dsn: St(r) },
|
|
1571
|
+
...s && {
|
|
1572
|
+
trace: s
|
|
1573
|
+
}
|
|
1574
|
+
};
|
|
1575
|
+
}
|
|
1576
|
+
function bs(t, e) {
|
|
1577
|
+
return e && (t.sdk = t.sdk || {}, t.sdk.name = t.sdk.name || e.name, t.sdk.version = t.sdk.version || e.version, t.sdk.integrations = [...t.sdk.integrations || [], ...e.integrations || []], t.sdk.packages = [...t.sdk.packages || [], ...e.packages || []]), t;
|
|
1578
|
+
}
|
|
1579
|
+
function Ts(t, e, n, r) {
|
|
1580
|
+
const s = In(n), o = {
|
|
1581
|
+
sent_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1582
|
+
...s && { sdk: s },
|
|
1583
|
+
...!!r && e && { dsn: St(e) }
|
|
1584
|
+
}, i = "aggregates" in t ? [{ type: "sessions" }, t] : [{ type: "session" }, t.toJSON()];
|
|
1585
|
+
return et(o, [i]);
|
|
1586
|
+
}
|
|
1587
|
+
function Is(t, e, n, r) {
|
|
1588
|
+
const s = In(n), o = t.type && t.type !== "replay_event" ? t.type : "event";
|
|
1589
|
+
bs(t, n?.sdk);
|
|
1590
|
+
const i = Ss(t, s, r, e);
|
|
1591
|
+
return delete t.sdkProcessingMetadata, et(i, [[{ type: o }, t]]);
|
|
1592
|
+
}
|
|
1593
|
+
const Rt = 0, Ae = 1, xe = 2;
|
|
1594
|
+
function $(t) {
|
|
1595
|
+
return new C((e) => {
|
|
1596
|
+
e(t);
|
|
1597
|
+
});
|
|
1598
|
+
}
|
|
1599
|
+
function pt(t) {
|
|
1600
|
+
return new C((e, n) => {
|
|
1601
|
+
n(t);
|
|
1602
|
+
});
|
|
1603
|
+
}
|
|
1604
|
+
class C {
|
|
1605
|
+
constructor(e) {
|
|
1606
|
+
this._state = Rt, this._handlers = [], this._runExecutor(e);
|
|
1607
|
+
}
|
|
1608
|
+
/** @inheritdoc */
|
|
1609
|
+
then(e, n) {
|
|
1610
|
+
return new C((r, s) => {
|
|
1611
|
+
this._handlers.push([
|
|
1612
|
+
!1,
|
|
1613
|
+
(o) => {
|
|
1614
|
+
if (!e)
|
|
1615
|
+
r(o);
|
|
1616
|
+
else
|
|
1617
|
+
try {
|
|
1618
|
+
r(e(o));
|
|
1619
|
+
} catch (i) {
|
|
1620
|
+
s(i);
|
|
1621
|
+
}
|
|
1622
|
+
},
|
|
1623
|
+
(o) => {
|
|
1624
|
+
if (!n)
|
|
1625
|
+
s(o);
|
|
1626
|
+
else
|
|
1627
|
+
try {
|
|
1628
|
+
r(n(o));
|
|
1629
|
+
} catch (i) {
|
|
1630
|
+
s(i);
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
]), this._executeHandlers();
|
|
1634
|
+
});
|
|
1635
|
+
}
|
|
1636
|
+
/** @inheritdoc */
|
|
1637
|
+
catch(e) {
|
|
1638
|
+
return this.then((n) => n, e);
|
|
1639
|
+
}
|
|
1640
|
+
/** @inheritdoc */
|
|
1641
|
+
finally(e) {
|
|
1642
|
+
return new C((n, r) => {
|
|
1643
|
+
let s, o;
|
|
1644
|
+
return this.then(
|
|
1645
|
+
(i) => {
|
|
1646
|
+
o = !1, s = i, e && e();
|
|
1647
|
+
},
|
|
1648
|
+
(i) => {
|
|
1649
|
+
o = !0, s = i, e && e();
|
|
1650
|
+
}
|
|
1651
|
+
).then(() => {
|
|
1652
|
+
if (o) {
|
|
1653
|
+
r(s);
|
|
1654
|
+
return;
|
|
1655
|
+
}
|
|
1656
|
+
n(s);
|
|
1657
|
+
});
|
|
1658
|
+
});
|
|
1659
|
+
}
|
|
1660
|
+
/** Excute the resolve/reject handlers. */
|
|
1661
|
+
_executeHandlers() {
|
|
1662
|
+
if (this._state === Rt)
|
|
1663
|
+
return;
|
|
1664
|
+
const e = this._handlers.slice();
|
|
1665
|
+
this._handlers = [], e.forEach((n) => {
|
|
1666
|
+
n[0] || (this._state === Ae && n[1](this._value), this._state === xe && n[2](this._value), n[0] = !0);
|
|
1667
|
+
});
|
|
1668
|
+
}
|
|
1669
|
+
/** Run the executor for the SyncPromise. */
|
|
1670
|
+
_runExecutor(e) {
|
|
1671
|
+
const n = (o, i) => {
|
|
1672
|
+
if (this._state === Rt) {
|
|
1673
|
+
if (yt(i)) {
|
|
1674
|
+
i.then(r, s);
|
|
1675
|
+
return;
|
|
1676
|
+
}
|
|
1677
|
+
this._state = o, this._value = i, this._executeHandlers();
|
|
1678
|
+
}
|
|
1679
|
+
}, r = (o) => {
|
|
1680
|
+
n(Ae, o);
|
|
1681
|
+
}, s = (o) => {
|
|
1682
|
+
n(xe, o);
|
|
1683
|
+
};
|
|
1684
|
+
try {
|
|
1685
|
+
e(r, s);
|
|
1686
|
+
} catch (o) {
|
|
1687
|
+
s(o);
|
|
1688
|
+
}
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
function Pt(t, e, n, r = 0) {
|
|
1692
|
+
return new C((s, o) => {
|
|
1693
|
+
const i = t[r];
|
|
1694
|
+
if (e === null || typeof i != "function")
|
|
1695
|
+
s(e);
|
|
1696
|
+
else {
|
|
1697
|
+
const a = i({ ...e }, n);
|
|
1698
|
+
h && i.id && a === null && p.log(`Event processor "${i.id}" dropped event`), yt(a) ? a.then((c) => Pt(t, c, n, r + 1).then(s)).then(null, o) : Pt(t, a, n, r + 1).then(s).then(null, o);
|
|
1699
|
+
}
|
|
1700
|
+
});
|
|
1701
|
+
}
|
|
1702
|
+
function vs(t, e) {
|
|
1703
|
+
const { fingerprint: n, span: r, breadcrumbs: s, sdkProcessingMetadata: o } = e;
|
|
1704
|
+
ws(t, e), r && As(t, r), xs(t, n), Rs(t, s), ks(t, o);
|
|
1705
|
+
}
|
|
1706
|
+
function Oe(t, e) {
|
|
1707
|
+
const {
|
|
1708
|
+
extra: n,
|
|
1709
|
+
tags: r,
|
|
1710
|
+
user: s,
|
|
1711
|
+
contexts: o,
|
|
1712
|
+
level: i,
|
|
1713
|
+
sdkProcessingMetadata: a,
|
|
1714
|
+
breadcrumbs: c,
|
|
1715
|
+
fingerprint: u,
|
|
1716
|
+
eventProcessors: f,
|
|
1717
|
+
attachments: l,
|
|
1718
|
+
propagationContext: m,
|
|
1719
|
+
transactionName: d,
|
|
1720
|
+
span: E
|
|
1721
|
+
} = e;
|
|
1722
|
+
rt(t, "extra", n), rt(t, "tags", r), rt(t, "user", s), rt(t, "contexts", o), t.sdkProcessingMetadata = Q(t.sdkProcessingMetadata, a, 2), i && (t.level = i), d && (t.transactionName = d), E && (t.span = E), c.length && (t.breadcrumbs = [...t.breadcrumbs, ...c]), u.length && (t.fingerprint = [...t.fingerprint, ...u]), f.length && (t.eventProcessors = [...t.eventProcessors, ...f]), l.length && (t.attachments = [...t.attachments, ...l]), t.propagationContext = { ...t.propagationContext, ...m };
|
|
1723
|
+
}
|
|
1724
|
+
function rt(t, e, n) {
|
|
1725
|
+
t[e] = Q(t[e], n, 1);
|
|
1726
|
+
}
|
|
1727
|
+
function ws(t, e) {
|
|
1728
|
+
const { extra: n, tags: r, user: s, contexts: o, level: i, transactionName: a } = e;
|
|
1729
|
+
Object.keys(n).length && (t.extra = { ...n, ...t.extra }), Object.keys(r).length && (t.tags = { ...r, ...t.tags }), Object.keys(s).length && (t.user = { ...s, ...t.user }), Object.keys(o).length && (t.contexts = { ...o, ...t.contexts }), i && (t.level = i), a && t.type !== "transaction" && (t.transaction = a);
|
|
1730
|
+
}
|
|
1731
|
+
function Rs(t, e) {
|
|
1732
|
+
const n = [...t.breadcrumbs || [], ...e];
|
|
1733
|
+
t.breadcrumbs = n.length ? n : void 0;
|
|
1734
|
+
}
|
|
1735
|
+
function ks(t, e) {
|
|
1736
|
+
t.sdkProcessingMetadata = {
|
|
1737
|
+
...t.sdkProcessingMetadata,
|
|
1738
|
+
...e
|
|
1739
|
+
};
|
|
1740
|
+
}
|
|
1741
|
+
function As(t, e) {
|
|
1742
|
+
t.contexts = {
|
|
1743
|
+
trace: Yr(e),
|
|
1744
|
+
...t.contexts
|
|
1745
|
+
}, t.sdkProcessingMetadata = {
|
|
1746
|
+
dynamicSamplingContext: us(e),
|
|
1747
|
+
...t.sdkProcessingMetadata
|
|
1748
|
+
};
|
|
1749
|
+
const n = En(e), r = te(n).description;
|
|
1750
|
+
r && !t.transaction && t.type === "transaction" && (t.transaction = r);
|
|
1751
|
+
}
|
|
1752
|
+
function xs(t, e) {
|
|
1753
|
+
t.fingerprint = t.fingerprint ? Array.isArray(t.fingerprint) ? t.fingerprint : [t.fingerprint] : [], e && (t.fingerprint = t.fingerprint.concat(e)), t.fingerprint.length || delete t.fingerprint;
|
|
1754
|
+
}
|
|
1755
|
+
let st, Ne, ot;
|
|
1756
|
+
function Os(t) {
|
|
1757
|
+
const e = _._sentryDebugIds;
|
|
1758
|
+
if (!e)
|
|
1759
|
+
return {};
|
|
1760
|
+
const n = Object.keys(e);
|
|
1761
|
+
return ot && n.length === Ne || (Ne = n.length, ot = n.reduce((r, s) => {
|
|
1762
|
+
st || (st = {});
|
|
1763
|
+
const o = st[s];
|
|
1764
|
+
if (o)
|
|
1765
|
+
r[o[0]] = o[1];
|
|
1766
|
+
else {
|
|
1767
|
+
const i = t(s);
|
|
1768
|
+
for (let a = i.length - 1; a >= 0; a--) {
|
|
1769
|
+
const u = i[a]?.filename, f = e[s];
|
|
1770
|
+
if (u && f) {
|
|
1771
|
+
r[u] = f, st[s] = [u, f];
|
|
1772
|
+
break;
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1776
|
+
return r;
|
|
1777
|
+
}, {})), ot;
|
|
1778
|
+
}
|
|
1779
|
+
function Ns(t, e, n, r, s, o) {
|
|
1780
|
+
const { normalizeDepth: i = 3, normalizeMaxBreadth: a = 1e3 } = t, c = {
|
|
1781
|
+
...e,
|
|
1782
|
+
event_id: e.event_id || n.event_id || I(),
|
|
1783
|
+
timestamp: e.timestamp || Z()
|
|
1784
|
+
}, u = n.integrations || t.integrations.map((g) => g.name);
|
|
1785
|
+
Cs(c, t), Ps(c, u), s && s.emit("applyFrameMetadata", e), e.type === void 0 && Ds(c, t.stackParser);
|
|
1786
|
+
const f = Fs(r, n.captureContext);
|
|
1787
|
+
n.mechanism && H(c, n.mechanism);
|
|
1788
|
+
const l = s ? s.getEventProcessors() : [], m = xr().getScopeData();
|
|
1789
|
+
if (o) {
|
|
1790
|
+
const g = o.getScopeData();
|
|
1791
|
+
Oe(m, g);
|
|
1792
|
+
}
|
|
1793
|
+
if (f) {
|
|
1794
|
+
const g = f.getScopeData();
|
|
1795
|
+
Oe(m, g);
|
|
1796
|
+
}
|
|
1797
|
+
const d = [...n.attachments || [], ...m.attachments];
|
|
1798
|
+
d.length && (n.attachments = d), vs(c, m);
|
|
1799
|
+
const E = [
|
|
1800
|
+
...l,
|
|
1801
|
+
// Run scope event processors _after_ all other processors
|
|
1802
|
+
...m.eventProcessors
|
|
1803
|
+
];
|
|
1804
|
+
return Pt(E, c, n).then((g) => (g && Ls(g), typeof i == "number" && i > 0 ? Ms(g, i, a) : g));
|
|
1805
|
+
}
|
|
1806
|
+
function Cs(t, e) {
|
|
1807
|
+
const { environment: n, release: r, dist: s, maxValueLength: o = 250 } = e;
|
|
1808
|
+
t.environment = t.environment || n || ee, !t.release && r && (t.release = r), !t.dist && s && (t.dist = s);
|
|
1809
|
+
const i = t.request;
|
|
1810
|
+
i?.url && (i.url = dt(i.url, o));
|
|
1811
|
+
}
|
|
1812
|
+
function Ds(t, e) {
|
|
1813
|
+
const n = Os(e);
|
|
1814
|
+
t.exception?.values?.forEach((r) => {
|
|
1815
|
+
r.stacktrace?.frames?.forEach((s) => {
|
|
1816
|
+
s.filename && (s.debug_id = n[s.filename]);
|
|
1817
|
+
});
|
|
1818
|
+
});
|
|
1819
|
+
}
|
|
1820
|
+
function Ls(t) {
|
|
1821
|
+
const e = {};
|
|
1822
|
+
if (t.exception?.values?.forEach((r) => {
|
|
1823
|
+
r.stacktrace?.frames?.forEach((s) => {
|
|
1824
|
+
s.debug_id && (s.abs_path ? e[s.abs_path] = s.debug_id : s.filename && (e[s.filename] = s.debug_id), delete s.debug_id);
|
|
1825
|
+
});
|
|
1826
|
+
}), Object.keys(e).length === 0)
|
|
1827
|
+
return;
|
|
1828
|
+
t.debug_meta = t.debug_meta || {}, t.debug_meta.images = t.debug_meta.images || [];
|
|
1829
|
+
const n = t.debug_meta.images;
|
|
1830
|
+
Object.entries(e).forEach(([r, s]) => {
|
|
1831
|
+
n.push({
|
|
1832
|
+
type: "sourcemap",
|
|
1833
|
+
code_file: r,
|
|
1834
|
+
debug_id: s
|
|
1835
|
+
});
|
|
1836
|
+
});
|
|
1837
|
+
}
|
|
1838
|
+
function Ps(t, e) {
|
|
1839
|
+
e.length > 0 && (t.sdk = t.sdk || {}, t.sdk.integrations = [...t.sdk.integrations || [], ...e]);
|
|
1840
|
+
}
|
|
1841
|
+
function Ms(t, e, n) {
|
|
1842
|
+
if (!t)
|
|
1843
|
+
return null;
|
|
1844
|
+
const r = {
|
|
1845
|
+
...t,
|
|
1846
|
+
...t.breadcrumbs && {
|
|
1847
|
+
breadcrumbs: t.breadcrumbs.map((s) => ({
|
|
1848
|
+
...s,
|
|
1849
|
+
...s.data && {
|
|
1850
|
+
data: k(s.data, e, n)
|
|
1851
|
+
}
|
|
1852
|
+
}))
|
|
1853
|
+
},
|
|
1854
|
+
...t.user && {
|
|
1855
|
+
user: k(t.user, e, n)
|
|
1856
|
+
},
|
|
1857
|
+
...t.contexts && {
|
|
1858
|
+
contexts: k(t.contexts, e, n)
|
|
1859
|
+
},
|
|
1860
|
+
...t.extra && {
|
|
1861
|
+
extra: k(t.extra, e, n)
|
|
1862
|
+
}
|
|
1863
|
+
};
|
|
1864
|
+
return t.contexts?.trace && r.contexts && (r.contexts.trace = t.contexts.trace, t.contexts.trace.data && (r.contexts.trace.data = k(t.contexts.trace.data, e, n))), t.spans && (r.spans = t.spans.map((s) => ({
|
|
1865
|
+
...s,
|
|
1866
|
+
...s.data && {
|
|
1867
|
+
data: k(s.data, e, n)
|
|
1868
|
+
}
|
|
1869
|
+
}))), t.contexts?.flags && r.contexts && (r.contexts.flags = k(t.contexts.flags, 3, n)), r;
|
|
1870
|
+
}
|
|
1871
|
+
function Fs(t, e) {
|
|
1872
|
+
if (!e)
|
|
1873
|
+
return t;
|
|
1874
|
+
const n = t ? t.clone() : new w();
|
|
1875
|
+
return n.update(e), n;
|
|
1876
|
+
}
|
|
1877
|
+
function $s(t) {
|
|
1878
|
+
if (t)
|
|
1879
|
+
return Us(t) ? { captureContext: t } : Bs(t) ? {
|
|
1880
|
+
captureContext: t
|
|
1881
|
+
} : t;
|
|
1882
|
+
}
|
|
1883
|
+
function Us(t) {
|
|
1884
|
+
return t instanceof w || typeof t == "function";
|
|
1885
|
+
}
|
|
1886
|
+
const js = [
|
|
1887
|
+
"user",
|
|
1888
|
+
"level",
|
|
1889
|
+
"extra",
|
|
1890
|
+
"contexts",
|
|
1891
|
+
"tags",
|
|
1892
|
+
"fingerprint",
|
|
1893
|
+
"propagationContext"
|
|
1894
|
+
];
|
|
1895
|
+
function Bs(t) {
|
|
1896
|
+
return Object.keys(t).some((e) => js.includes(e));
|
|
1897
|
+
}
|
|
1898
|
+
function vn(t, e) {
|
|
1899
|
+
return D().captureException(t, $s(e));
|
|
1900
|
+
}
|
|
1901
|
+
function wn(t, e) {
|
|
1902
|
+
return D().captureEvent(t, e);
|
|
1903
|
+
}
|
|
1904
|
+
function Ce(t) {
|
|
1905
|
+
const e = tt(), n = D(), { userAgent: r } = _.navigator || {}, s = Er({
|
|
1906
|
+
user: n.getUser() || e.getUser(),
|
|
1907
|
+
...r && { userAgent: r },
|
|
1908
|
+
...t
|
|
1909
|
+
}), o = e.getSession();
|
|
1910
|
+
return o?.status === "ok" && G(o, { status: "exited" }), Rn(), e.setSession(s), s;
|
|
1911
|
+
}
|
|
1912
|
+
function Rn() {
|
|
1913
|
+
const t = tt(), n = D().getSession() || t.getSession();
|
|
1914
|
+
n && Sr(n), kn(), t.setSession();
|
|
1915
|
+
}
|
|
1916
|
+
function kn() {
|
|
1917
|
+
const t = tt(), e = b(), n = t.getSession();
|
|
1918
|
+
n && e && e.captureSession(n);
|
|
1919
|
+
}
|
|
1920
|
+
function De(t = !1) {
|
|
1921
|
+
if (t) {
|
|
1922
|
+
Rn();
|
|
1923
|
+
return;
|
|
1924
|
+
}
|
|
1925
|
+
kn();
|
|
1926
|
+
}
|
|
1927
|
+
const Hs = "7";
|
|
1928
|
+
function Gs(t) {
|
|
1929
|
+
const e = t.protocol ? `${t.protocol}:` : "", n = t.port ? `:${t.port}` : "";
|
|
1930
|
+
return `${e}//${t.host}${n}${t.path ? `/${t.path}` : ""}/api/`;
|
|
1931
|
+
}
|
|
1932
|
+
function Ws(t) {
|
|
1933
|
+
return `${Gs(t)}${t.projectId}/envelope/`;
|
|
1934
|
+
}
|
|
1935
|
+
function qs(t, e) {
|
|
1936
|
+
const n = {
|
|
1937
|
+
sentry_version: Hs
|
|
1938
|
+
};
|
|
1939
|
+
return t.publicKey && (n.sentry_key = t.publicKey), e && (n.sentry_client = `${e.name}/${e.version}`), new URLSearchParams(n).toString();
|
|
1940
|
+
}
|
|
1941
|
+
function Ys(t, e, n) {
|
|
1942
|
+
return e || `${Ws(t)}?${qs(t, n)}`;
|
|
1943
|
+
}
|
|
1944
|
+
const Le = [];
|
|
1945
|
+
function zs(t) {
|
|
1946
|
+
const e = {};
|
|
1947
|
+
return t.forEach((n) => {
|
|
1948
|
+
const { name: r } = n, s = e[r];
|
|
1949
|
+
s && !s.isDefaultInstance && n.isDefaultInstance || (e[r] = n);
|
|
1950
|
+
}), Object.values(e);
|
|
1951
|
+
}
|
|
1952
|
+
function Xs(t) {
|
|
1953
|
+
const e = t.defaultIntegrations || [], n = t.integrations;
|
|
1954
|
+
e.forEach((s) => {
|
|
1955
|
+
s.isDefaultInstance = !0;
|
|
1956
|
+
});
|
|
1957
|
+
let r;
|
|
1958
|
+
if (Array.isArray(n))
|
|
1959
|
+
r = [...e, ...n];
|
|
1960
|
+
else if (typeof n == "function") {
|
|
1961
|
+
const s = n(e);
|
|
1962
|
+
r = Array.isArray(s) ? s : [s];
|
|
1963
|
+
} else
|
|
1964
|
+
r = e;
|
|
1965
|
+
return zs(r);
|
|
1966
|
+
}
|
|
1967
|
+
function Ks(t, e) {
|
|
1968
|
+
const n = {};
|
|
1969
|
+
return e.forEach((r) => {
|
|
1970
|
+
r && An(t, r, n);
|
|
1971
|
+
}), n;
|
|
1972
|
+
}
|
|
1973
|
+
function Pe(t, e) {
|
|
1974
|
+
for (const n of e)
|
|
1975
|
+
n?.afterAllSetup && n.afterAllSetup(t);
|
|
1976
|
+
}
|
|
1977
|
+
function An(t, e, n) {
|
|
1978
|
+
if (n[e.name]) {
|
|
1979
|
+
h && p.log(`Integration skipped because it was already installed: ${e.name}`);
|
|
1980
|
+
return;
|
|
1981
|
+
}
|
|
1982
|
+
if (n[e.name] = e, Le.indexOf(e.name) === -1 && typeof e.setupOnce == "function" && (e.setupOnce(), Le.push(e.name)), e.setup && typeof e.setup == "function" && e.setup(t), typeof e.preprocessEvent == "function") {
|
|
1983
|
+
const r = e.preprocessEvent.bind(e);
|
|
1984
|
+
t.on("preprocessEvent", (s, o) => r(s, o, t));
|
|
1985
|
+
}
|
|
1986
|
+
if (typeof e.processEvent == "function") {
|
|
1987
|
+
const r = e.processEvent.bind(e), s = Object.assign((o, i) => r(o, i, t), {
|
|
1988
|
+
id: e.name
|
|
1989
|
+
});
|
|
1990
|
+
t.addEventProcessor(s);
|
|
1991
|
+
}
|
|
1992
|
+
h && p.log(`Integration installed: ${e.name}`);
|
|
1993
|
+
}
|
|
1994
|
+
function Vs(t, e, n) {
|
|
1995
|
+
const r = [
|
|
1996
|
+
{ type: "client_report" },
|
|
1997
|
+
{
|
|
1998
|
+
timestamp: Z(),
|
|
1999
|
+
discarded_events: t
|
|
2000
|
+
}
|
|
2001
|
+
];
|
|
2002
|
+
return et(e ? { dsn: e } : {}, [r]);
|
|
2003
|
+
}
|
|
2004
|
+
function xn(t) {
|
|
2005
|
+
const e = [];
|
|
2006
|
+
t.message && e.push(t.message);
|
|
2007
|
+
try {
|
|
2008
|
+
const n = t.exception.values[t.exception.values.length - 1];
|
|
2009
|
+
n?.value && (e.push(n.value), n.type && e.push(`${n.type}: ${n.value}`));
|
|
2010
|
+
} catch {
|
|
2011
|
+
}
|
|
2012
|
+
return e;
|
|
2013
|
+
}
|
|
2014
|
+
function Js(t) {
|
|
2015
|
+
const { trace_id: e, parent_span_id: n, span_id: r, status: s, origin: o, data: i, op: a } = t.contexts?.trace ?? {};
|
|
2016
|
+
return {
|
|
2017
|
+
data: i ?? {},
|
|
2018
|
+
description: t.transaction,
|
|
2019
|
+
op: a,
|
|
2020
|
+
parent_span_id: n,
|
|
2021
|
+
span_id: r ?? "",
|
|
2022
|
+
start_timestamp: t.start_timestamp ?? 0,
|
|
2023
|
+
status: s,
|
|
2024
|
+
timestamp: t.timestamp,
|
|
2025
|
+
trace_id: e ?? "",
|
|
2026
|
+
origin: o,
|
|
2027
|
+
profile_id: i?.[mn],
|
|
2028
|
+
exclusive_time: i?.[gn],
|
|
2029
|
+
measurements: t.measurements,
|
|
2030
|
+
is_segment: !0
|
|
2031
|
+
};
|
|
2032
|
+
}
|
|
2033
|
+
function Zs(t) {
|
|
2034
|
+
return {
|
|
2035
|
+
type: "transaction",
|
|
2036
|
+
timestamp: t.timestamp,
|
|
2037
|
+
start_timestamp: t.start_timestamp,
|
|
2038
|
+
transaction: t.description,
|
|
2039
|
+
contexts: {
|
|
2040
|
+
trace: {
|
|
2041
|
+
trace_id: t.trace_id,
|
|
2042
|
+
span_id: t.span_id,
|
|
2043
|
+
parent_span_id: t.parent_span_id,
|
|
2044
|
+
op: t.op,
|
|
2045
|
+
status: t.status,
|
|
2046
|
+
origin: t.origin,
|
|
2047
|
+
data: {
|
|
2048
|
+
...t.data,
|
|
2049
|
+
...t.profile_id && { [mn]: t.profile_id },
|
|
2050
|
+
...t.exclusive_time && { [gn]: t.exclusive_time }
|
|
2051
|
+
}
|
|
2052
|
+
}
|
|
2053
|
+
},
|
|
2054
|
+
measurements: t.measurements
|
|
2055
|
+
};
|
|
2056
|
+
}
|
|
2057
|
+
const Me = "Not capturing exception because it's already been captured.", Fe = "Discarded session because of missing or non-string release", On = Symbol.for("SentryInternalError"), Nn = Symbol.for("SentryDoNotSendEventError");
|
|
2058
|
+
function ut(t) {
|
|
2059
|
+
return {
|
|
2060
|
+
message: t,
|
|
2061
|
+
[On]: !0
|
|
2062
|
+
};
|
|
2063
|
+
}
|
|
2064
|
+
function kt(t) {
|
|
2065
|
+
return {
|
|
2066
|
+
message: t,
|
|
2067
|
+
[Nn]: !0
|
|
2068
|
+
};
|
|
2069
|
+
}
|
|
2070
|
+
function $e(t) {
|
|
2071
|
+
return !!t && typeof t == "object" && On in t;
|
|
2072
|
+
}
|
|
2073
|
+
function Ue(t) {
|
|
2074
|
+
return !!t && typeof t == "object" && Nn in t;
|
|
2075
|
+
}
|
|
2076
|
+
class Qs {
|
|
2077
|
+
/** Options passed to the SDK. */
|
|
2078
|
+
/** The client Dsn, if specified in options. Without this Dsn, the SDK will be disabled. */
|
|
2079
|
+
/** Array of set up integrations. */
|
|
2080
|
+
/** Number of calls being processed */
|
|
2081
|
+
/** Holds flushable */
|
|
2082
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
2083
|
+
/**
|
|
2084
|
+
* Initializes this client instance.
|
|
2085
|
+
*
|
|
2086
|
+
* @param options Options for the client.
|
|
2087
|
+
*/
|
|
2088
|
+
constructor(e) {
|
|
2089
|
+
if (this._options = e, this._integrations = {}, this._numProcessing = 0, this._outcomes = {}, this._hooks = {}, this._eventProcessors = [], e.dsn ? this._dsn = is(e.dsn) : h && p.warn("No DSN provided, client will not send events."), this._dsn) {
|
|
2090
|
+
const n = Ys(
|
|
2091
|
+
this._dsn,
|
|
2092
|
+
e.tunnel,
|
|
2093
|
+
e._metadata ? e._metadata.sdk : void 0
|
|
2094
|
+
);
|
|
2095
|
+
this._transport = e.transport({
|
|
2096
|
+
tunnel: this._options.tunnel,
|
|
2097
|
+
recordDroppedEvent: this.recordDroppedEvent.bind(this),
|
|
2098
|
+
...e.transportOptions,
|
|
2099
|
+
url: n
|
|
2100
|
+
});
|
|
2101
|
+
}
|
|
2102
|
+
}
|
|
2103
|
+
/**
|
|
2104
|
+
* Captures an exception event and sends it to Sentry.
|
|
2105
|
+
*
|
|
2106
|
+
* Unlike `captureException` exported from every SDK, this method requires that you pass it the current scope.
|
|
2107
|
+
*/
|
|
2108
|
+
captureException(e, n, r) {
|
|
2109
|
+
const s = I();
|
|
2110
|
+
if (me(e))
|
|
2111
|
+
return h && p.log(Me), s;
|
|
2112
|
+
const o = {
|
|
2113
|
+
event_id: s,
|
|
2114
|
+
...n
|
|
2115
|
+
};
|
|
2116
|
+
return this._process(
|
|
2117
|
+
this.eventFromException(e, o).then(
|
|
2118
|
+
(i) => this._captureEvent(i, o, r)
|
|
2119
|
+
)
|
|
2120
|
+
), o.event_id;
|
|
2121
|
+
}
|
|
2122
|
+
/**
|
|
2123
|
+
* Captures a message event and sends it to Sentry.
|
|
2124
|
+
*
|
|
2125
|
+
* Unlike `captureMessage` exported from every SDK, this method requires that you pass it the current scope.
|
|
2126
|
+
*/
|
|
2127
|
+
captureMessage(e, n, r, s) {
|
|
2128
|
+
const o = {
|
|
2129
|
+
event_id: I(),
|
|
2130
|
+
...r
|
|
2131
|
+
}, i = Xt(e) ? e : String(e), a = Kt(e) ? this.eventFromMessage(i, n, o) : this.eventFromException(e, o);
|
|
2132
|
+
return this._process(a.then((c) => this._captureEvent(c, o, s))), o.event_id;
|
|
2133
|
+
}
|
|
2134
|
+
/**
|
|
2135
|
+
* Captures a manually created event and sends it to Sentry.
|
|
2136
|
+
*
|
|
2137
|
+
* Unlike `captureEvent` exported from every SDK, this method requires that you pass it the current scope.
|
|
2138
|
+
*/
|
|
2139
|
+
captureEvent(e, n, r) {
|
|
2140
|
+
const s = I();
|
|
2141
|
+
if (n?.originalException && me(n.originalException))
|
|
2142
|
+
return h && p.log(Me), s;
|
|
2143
|
+
const o = {
|
|
2144
|
+
event_id: s,
|
|
2145
|
+
...n
|
|
2146
|
+
}, i = e.sdkProcessingMetadata || {}, a = i.capturedSpanScope, c = i.capturedSpanIsolationScope;
|
|
2147
|
+
return this._process(
|
|
2148
|
+
this._captureEvent(e, o, a || r, c)
|
|
2149
|
+
), o.event_id;
|
|
2150
|
+
}
|
|
2151
|
+
/**
|
|
2152
|
+
* Captures a session.
|
|
2153
|
+
*/
|
|
2154
|
+
captureSession(e) {
|
|
2155
|
+
this.sendSession(e), G(e, { init: !1 });
|
|
2156
|
+
}
|
|
2157
|
+
/**
|
|
2158
|
+
* Create a cron monitor check in and send it to Sentry. This method is not available on all clients.
|
|
2159
|
+
*
|
|
2160
|
+
* @param checkIn An object that describes a check in.
|
|
2161
|
+
* @param upsertMonitorConfig An optional object that describes a monitor config. Use this if you want
|
|
2162
|
+
* to create a monitor automatically when sending a check in.
|
|
2163
|
+
* @param scope An optional scope containing event metadata.
|
|
2164
|
+
* @returns A string representing the id of the check in.
|
|
2165
|
+
*/
|
|
2166
|
+
/**
|
|
2167
|
+
* Get the current Dsn.
|
|
2168
|
+
*/
|
|
2169
|
+
getDsn() {
|
|
2170
|
+
return this._dsn;
|
|
2171
|
+
}
|
|
2172
|
+
/**
|
|
2173
|
+
* Get the current options.
|
|
2174
|
+
*/
|
|
2175
|
+
getOptions() {
|
|
2176
|
+
return this._options;
|
|
2177
|
+
}
|
|
2178
|
+
/**
|
|
2179
|
+
* Get the SDK metadata.
|
|
2180
|
+
* @see SdkMetadata
|
|
2181
|
+
*/
|
|
2182
|
+
getSdkMetadata() {
|
|
2183
|
+
return this._options._metadata;
|
|
2184
|
+
}
|
|
2185
|
+
/**
|
|
2186
|
+
* Returns the transport that is used by the client.
|
|
2187
|
+
* Please note that the transport gets lazy initialized so it will only be there once the first event has been sent.
|
|
2188
|
+
*/
|
|
2189
|
+
getTransport() {
|
|
2190
|
+
return this._transport;
|
|
2191
|
+
}
|
|
2192
|
+
/**
|
|
2193
|
+
* Wait for all events to be sent or the timeout to expire, whichever comes first.
|
|
2194
|
+
*
|
|
2195
|
+
* @param timeout Maximum time in ms the client should wait for events to be flushed. Omitting this parameter will
|
|
2196
|
+
* cause the client to wait until all events are sent before resolving the promise.
|
|
2197
|
+
* @returns A promise that will resolve with `true` if all events are sent before the timeout, or `false` if there are
|
|
2198
|
+
* still events in the queue when the timeout is reached.
|
|
2199
|
+
*/
|
|
2200
|
+
flush(e) {
|
|
2201
|
+
const n = this._transport;
|
|
2202
|
+
return n ? (this.emit("flush"), this._isClientDoneProcessing(e).then((r) => n.flush(e).then((s) => r && s))) : $(!0);
|
|
2203
|
+
}
|
|
2204
|
+
/**
|
|
2205
|
+
* Flush the event queue and set the client to `enabled = false`. See {@link Client.flush}.
|
|
2206
|
+
*
|
|
2207
|
+
* @param {number} timeout Maximum time in ms the client should wait before shutting down. Omitting this parameter will cause
|
|
2208
|
+
* the client to wait until all events are sent before disabling itself.
|
|
2209
|
+
* @returns {Promise<boolean>} A promise which resolves to `true` if the flush completes successfully before the timeout, or `false` if
|
|
2210
|
+
* it doesn't.
|
|
2211
|
+
*/
|
|
2212
|
+
close(e) {
|
|
2213
|
+
return this.flush(e).then((n) => (this.getOptions().enabled = !1, this.emit("close"), n));
|
|
2214
|
+
}
|
|
2215
|
+
/**
|
|
2216
|
+
* Get all installed event processors.
|
|
2217
|
+
*/
|
|
2218
|
+
getEventProcessors() {
|
|
2219
|
+
return this._eventProcessors;
|
|
2220
|
+
}
|
|
2221
|
+
/**
|
|
2222
|
+
* Adds an event processor that applies to any event processed by this client.
|
|
2223
|
+
*/
|
|
2224
|
+
addEventProcessor(e) {
|
|
2225
|
+
this._eventProcessors.push(e);
|
|
2226
|
+
}
|
|
2227
|
+
/**
|
|
2228
|
+
* Initialize this client.
|
|
2229
|
+
* Call this after the client was set on a scope.
|
|
2230
|
+
*/
|
|
2231
|
+
init() {
|
|
2232
|
+
(this._isEnabled() || // Force integrations to be setup even if no DSN was set when we have
|
|
2233
|
+
// Spotlight enabled. This is particularly important for browser as we
|
|
2234
|
+
// don't support the `spotlight` option there and rely on the users
|
|
2235
|
+
// adding the `spotlightBrowserIntegration()` to their integrations which
|
|
2236
|
+
// wouldn't get initialized with the check below when there's no DSN set.
|
|
2237
|
+
this._options.integrations.some(({ name: e }) => e.startsWith("Spotlight"))) && this._setupIntegrations();
|
|
2238
|
+
}
|
|
2239
|
+
/**
|
|
2240
|
+
* Gets an installed integration by its name.
|
|
2241
|
+
*
|
|
2242
|
+
* @returns {Integration|undefined} The installed integration or `undefined` if no integration with that `name` was installed.
|
|
2243
|
+
*/
|
|
2244
|
+
getIntegrationByName(e) {
|
|
2245
|
+
return this._integrations[e];
|
|
2246
|
+
}
|
|
2247
|
+
/**
|
|
2248
|
+
* Add an integration to the client.
|
|
2249
|
+
* This can be used to e.g. lazy load integrations.
|
|
2250
|
+
* In most cases, this should not be necessary,
|
|
2251
|
+
* and you're better off just passing the integrations via `integrations: []` at initialization time.
|
|
2252
|
+
* However, if you find the need to conditionally load & add an integration, you can use `addIntegration` to do so.
|
|
2253
|
+
*/
|
|
2254
|
+
addIntegration(e) {
|
|
2255
|
+
const n = this._integrations[e.name];
|
|
2256
|
+
An(this, e, this._integrations), n || Pe(this, [e]);
|
|
2257
|
+
}
|
|
2258
|
+
/**
|
|
2259
|
+
* Send a fully prepared event to Sentry.
|
|
2260
|
+
*/
|
|
2261
|
+
sendEvent(e, n = {}) {
|
|
2262
|
+
this.emit("beforeSendEvent", e, n);
|
|
2263
|
+
let r = Is(e, this._dsn, this._options._metadata, this._options.tunnel);
|
|
2264
|
+
for (const o of n.attachments || [])
|
|
2265
|
+
r = ms(r, ys(o));
|
|
2266
|
+
const s = this.sendEnvelope(r);
|
|
2267
|
+
s && s.then((o) => this.emit("afterSendEvent", e, o), null);
|
|
2268
|
+
}
|
|
2269
|
+
/**
|
|
2270
|
+
* Send a session or session aggregrates to Sentry.
|
|
2271
|
+
*/
|
|
2272
|
+
sendSession(e) {
|
|
2273
|
+
const { release: n, environment: r = ee } = this._options;
|
|
2274
|
+
if ("aggregates" in e) {
|
|
2275
|
+
const o = e.attrs || {};
|
|
2276
|
+
if (!o.release && !n) {
|
|
2277
|
+
h && p.warn(Fe);
|
|
2278
|
+
return;
|
|
2279
|
+
}
|
|
2280
|
+
o.release = o.release || n, o.environment = o.environment || r, e.attrs = o;
|
|
2281
|
+
} else {
|
|
2282
|
+
if (!e.release && !n) {
|
|
2283
|
+
h && p.warn(Fe);
|
|
2284
|
+
return;
|
|
2285
|
+
}
|
|
2286
|
+
e.release = e.release || n, e.environment = e.environment || r;
|
|
2287
|
+
}
|
|
2288
|
+
this.emit("beforeSendSession", e);
|
|
2289
|
+
const s = Ts(e, this._dsn, this._options._metadata, this._options.tunnel);
|
|
2290
|
+
this.sendEnvelope(s);
|
|
2291
|
+
}
|
|
2292
|
+
/**
|
|
2293
|
+
* Record on the client that an event got dropped (ie, an event that will not be sent to Sentry).
|
|
2294
|
+
*/
|
|
2295
|
+
recordDroppedEvent(e, n, r = 1) {
|
|
2296
|
+
if (this._options.sendClientReports) {
|
|
2297
|
+
const s = `${e}:${n}`;
|
|
2298
|
+
h && p.log(`Recording outcome: "${s}"${r > 1 ? ` (${r} times)` : ""}`), this._outcomes[s] = (this._outcomes[s] || 0) + r;
|
|
2299
|
+
}
|
|
2300
|
+
}
|
|
2301
|
+
/* eslint-disable @typescript-eslint/unified-signatures */
|
|
2302
|
+
/**
|
|
2303
|
+
* Register a callback for whenever a span is started.
|
|
2304
|
+
* Receives the span as argument.
|
|
2305
|
+
* @returns {() => void} A function that, when executed, removes the registered callback.
|
|
2306
|
+
*/
|
|
2307
|
+
/**
|
|
2308
|
+
* Register a hook on this client.
|
|
2309
|
+
*/
|
|
2310
|
+
on(e, n) {
|
|
2311
|
+
const r = this._hooks[e] = this._hooks[e] || [];
|
|
2312
|
+
return r.push(n), () => {
|
|
2313
|
+
const s = r.indexOf(n);
|
|
2314
|
+
s > -1 && r.splice(s, 1);
|
|
2315
|
+
};
|
|
2316
|
+
}
|
|
2317
|
+
/** Fire a hook whenever a span starts. */
|
|
2318
|
+
/**
|
|
2319
|
+
* Emit a hook that was previously registered via `on()`.
|
|
2320
|
+
*/
|
|
2321
|
+
emit(e, ...n) {
|
|
2322
|
+
const r = this._hooks[e];
|
|
2323
|
+
r && r.forEach((s) => s(...n));
|
|
2324
|
+
}
|
|
2325
|
+
/**
|
|
2326
|
+
* Send an envelope to Sentry.
|
|
2327
|
+
*/
|
|
2328
|
+
sendEnvelope(e) {
|
|
2329
|
+
return this.emit("beforeEnvelope", e), this._isEnabled() && this._transport ? this._transport.send(e).then(null, (n) => (h && p.error("Error while sending envelope:", n), n)) : (h && p.error("Transport disabled"), $({}));
|
|
2330
|
+
}
|
|
2331
|
+
/* eslint-enable @typescript-eslint/unified-signatures */
|
|
2332
|
+
/** Setup integrations for this client. */
|
|
2333
|
+
_setupIntegrations() {
|
|
2334
|
+
const { integrations: e } = this._options;
|
|
2335
|
+
this._integrations = Ks(this, e), Pe(this, e);
|
|
2336
|
+
}
|
|
2337
|
+
/** Updates existing session based on the provided event */
|
|
2338
|
+
_updateSessionFromEvent(e, n) {
|
|
2339
|
+
let r = n.level === "fatal", s = !1;
|
|
2340
|
+
const o = n.exception?.values;
|
|
2341
|
+
if (o) {
|
|
2342
|
+
s = !0;
|
|
2343
|
+
for (const c of o)
|
|
2344
|
+
if (c.mechanism?.handled === !1) {
|
|
2345
|
+
r = !0;
|
|
2346
|
+
break;
|
|
2347
|
+
}
|
|
2348
|
+
}
|
|
2349
|
+
const i = e.status === "ok";
|
|
2350
|
+
(i && e.errors === 0 || i && r) && (G(e, {
|
|
2351
|
+
...r && { status: "crashed" },
|
|
2352
|
+
errors: e.errors || Number(s || r)
|
|
2353
|
+
}), this.captureSession(e));
|
|
2354
|
+
}
|
|
2355
|
+
/**
|
|
2356
|
+
* Determine if the client is finished processing. Returns a promise because it will wait `timeout` ms before saying
|
|
2357
|
+
* "no" (resolving to `false`) in order to give the client a chance to potentially finish first.
|
|
2358
|
+
*
|
|
2359
|
+
* @param timeout The time, in ms, after which to resolve to `false` if the client is still busy. Passing `0` (or not
|
|
2360
|
+
* passing anything) will make the promise wait as long as it takes for processing to finish before resolving to
|
|
2361
|
+
* `true`.
|
|
2362
|
+
* @returns A promise which will resolve to `true` if processing is already done or finishes before the timeout, and
|
|
2363
|
+
* `false` otherwise
|
|
2364
|
+
*/
|
|
2365
|
+
_isClientDoneProcessing(e) {
|
|
2366
|
+
return new C((n) => {
|
|
2367
|
+
let r = 0;
|
|
2368
|
+
const s = 1, o = setInterval(() => {
|
|
2369
|
+
this._numProcessing == 0 ? (clearInterval(o), n(!0)) : (r += s, e && r >= e && (clearInterval(o), n(!1)));
|
|
2370
|
+
}, s);
|
|
2371
|
+
});
|
|
2372
|
+
}
|
|
2373
|
+
/** Determines whether this SDK is enabled and a transport is present. */
|
|
2374
|
+
_isEnabled() {
|
|
2375
|
+
return this.getOptions().enabled !== !1 && this._transport !== void 0;
|
|
2376
|
+
}
|
|
2377
|
+
/**
|
|
2378
|
+
* Adds common information to events.
|
|
2379
|
+
*
|
|
2380
|
+
* The information includes release and environment from `options`,
|
|
2381
|
+
* breadcrumbs and context (extra, tags and user) from the scope.
|
|
2382
|
+
*
|
|
2383
|
+
* Information that is already present in the event is never overwritten. For
|
|
2384
|
+
* nested objects, such as the context, keys are merged.
|
|
2385
|
+
*
|
|
2386
|
+
* @param event The original event.
|
|
2387
|
+
* @param hint May contain additional information about the original exception.
|
|
2388
|
+
* @param currentScope A scope containing event metadata.
|
|
2389
|
+
* @returns A new event with more information.
|
|
2390
|
+
*/
|
|
2391
|
+
_prepareEvent(e, n, r, s) {
|
|
2392
|
+
const o = this.getOptions(), i = Object.keys(this._integrations);
|
|
2393
|
+
return !n.integrations && i?.length && (n.integrations = i), this.emit("preprocessEvent", e, n), e.type || s.setLastEventId(e.event_id || n.event_id), Ns(o, e, n, r, this, s).then((a) => {
|
|
2394
|
+
if (a === null)
|
|
2395
|
+
return a;
|
|
2396
|
+
this.emit("postprocessEvent", a, n), a.contexts = {
|
|
2397
|
+
trace: Nr(r),
|
|
2398
|
+
...a.contexts
|
|
2399
|
+
};
|
|
2400
|
+
const c = cs(this, r);
|
|
2401
|
+
return a.sdkProcessingMetadata = {
|
|
2402
|
+
dynamicSamplingContext: c,
|
|
2403
|
+
...a.sdkProcessingMetadata
|
|
2404
|
+
}, a;
|
|
2405
|
+
});
|
|
2406
|
+
}
|
|
2407
|
+
/**
|
|
2408
|
+
* Processes the event and logs an error in case of rejection
|
|
2409
|
+
* @param event
|
|
2410
|
+
* @param hint
|
|
2411
|
+
* @param scope
|
|
2412
|
+
*/
|
|
2413
|
+
_captureEvent(e, n = {}, r = D(), s = tt()) {
|
|
2414
|
+
return h && Mt(e) && p.log(`Captured error event \`${xn(e)[0] || "<unknown>"}\``), this._processEvent(e, n, r, s).then(
|
|
2415
|
+
(o) => o.event_id,
|
|
2416
|
+
(o) => {
|
|
2417
|
+
h && (Ue(o) ? p.log(o.message) : $e(o) ? p.warn(o.message) : p.warn(o));
|
|
2418
|
+
}
|
|
2419
|
+
);
|
|
2420
|
+
}
|
|
2421
|
+
/**
|
|
2422
|
+
* Processes an event (either error or message) and sends it to Sentry.
|
|
2423
|
+
*
|
|
2424
|
+
* This also adds breadcrumbs and context information to the event. However,
|
|
2425
|
+
* platform specific meta data (such as the User's IP address) must be added
|
|
2426
|
+
* by the SDK implementor.
|
|
2427
|
+
*
|
|
2428
|
+
*
|
|
2429
|
+
* @param event The event to send to Sentry.
|
|
2430
|
+
* @param hint May contain additional information about the original exception.
|
|
2431
|
+
* @param currentScope A scope containing event metadata.
|
|
2432
|
+
* @returns A SyncPromise that resolves with the event or rejects in case event was/will not be send.
|
|
2433
|
+
*/
|
|
2434
|
+
_processEvent(e, n, r, s) {
|
|
2435
|
+
const o = this.getOptions(), { sampleRate: i } = o, a = Cn(e), c = Mt(e), u = e.type || "error", f = `before send for type \`${u}\``, l = typeof i > "u" ? void 0 : qr(i);
|
|
2436
|
+
if (c && typeof l == "number" && Math.random() > l)
|
|
2437
|
+
return this.recordDroppedEvent("sample_rate", "error"), pt(
|
|
2438
|
+
kt(
|
|
2439
|
+
`Discarding event because it's not included in the random sample (sampling rate = ${i})`
|
|
2440
|
+
)
|
|
2441
|
+
);
|
|
2442
|
+
const m = u === "replay_event" ? "replay" : u;
|
|
2443
|
+
return this._prepareEvent(e, n, r, s).then((d) => {
|
|
2444
|
+
if (d === null)
|
|
2445
|
+
throw this.recordDroppedEvent("event_processor", m), kt("An event processor returned `null`, will not send event.");
|
|
2446
|
+
if (n.data && n.data.__sentry__ === !0)
|
|
2447
|
+
return d;
|
|
2448
|
+
const R = eo(this, o, d, n);
|
|
2449
|
+
return to(R, f);
|
|
2450
|
+
}).then((d) => {
|
|
2451
|
+
if (d === null) {
|
|
2452
|
+
if (this.recordDroppedEvent("before_send", m), a) {
|
|
2453
|
+
const Tt = 1 + (e.spans || []).length;
|
|
2454
|
+
this.recordDroppedEvent("before_send", "span", Tt);
|
|
2455
|
+
}
|
|
2456
|
+
throw kt(`${f} returned \`null\`, will not send event.`);
|
|
2457
|
+
}
|
|
2458
|
+
const E = r.getSession() || s.getSession();
|
|
2459
|
+
if (c && E && this._updateSessionFromEvent(E, d), a) {
|
|
2460
|
+
const g = d.sdkProcessingMetadata?.spanCountBeforeProcessing || 0, Tt = d.spans ? d.spans.length : 0, oe = g - Tt;
|
|
2461
|
+
oe > 0 && this.recordDroppedEvent("before_send", "span", oe);
|
|
2462
|
+
}
|
|
2463
|
+
const R = d.transaction_info;
|
|
2464
|
+
if (a && R && d.transaction !== e.transaction) {
|
|
2465
|
+
const g = "custom";
|
|
2466
|
+
d.transaction_info = {
|
|
2467
|
+
...R,
|
|
2468
|
+
source: g
|
|
2469
|
+
};
|
|
2470
|
+
}
|
|
2471
|
+
return this.sendEvent(d, n), d;
|
|
2472
|
+
}).then(null, (d) => {
|
|
2473
|
+
throw Ue(d) || $e(d) ? d : (this.captureException(d, {
|
|
2474
|
+
data: {
|
|
2475
|
+
__sentry__: !0
|
|
2476
|
+
},
|
|
2477
|
+
originalException: d
|
|
2478
|
+
}), ut(
|
|
2479
|
+
`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
2480
|
+
Reason: ${d}`
|
|
2481
|
+
));
|
|
2482
|
+
});
|
|
2483
|
+
}
|
|
2484
|
+
/**
|
|
2485
|
+
* Occupies the client with processing and event
|
|
2486
|
+
*/
|
|
2487
|
+
_process(e) {
|
|
2488
|
+
this._numProcessing++, e.then(
|
|
2489
|
+
(n) => (this._numProcessing--, n),
|
|
2490
|
+
(n) => (this._numProcessing--, n)
|
|
2491
|
+
);
|
|
2492
|
+
}
|
|
2493
|
+
/**
|
|
2494
|
+
* Clears outcomes on this client and returns them.
|
|
2495
|
+
*/
|
|
2496
|
+
_clearOutcomes() {
|
|
2497
|
+
const e = this._outcomes;
|
|
2498
|
+
return this._outcomes = {}, Object.entries(e).map(([n, r]) => {
|
|
2499
|
+
const [s, o] = n.split(":");
|
|
2500
|
+
return {
|
|
2501
|
+
reason: s,
|
|
2502
|
+
category: o,
|
|
2503
|
+
quantity: r
|
|
2504
|
+
};
|
|
2505
|
+
});
|
|
2506
|
+
}
|
|
2507
|
+
/**
|
|
2508
|
+
* Sends client reports as an envelope.
|
|
2509
|
+
*/
|
|
2510
|
+
_flushOutcomes() {
|
|
2511
|
+
h && p.log("Flushing outcomes...");
|
|
2512
|
+
const e = this._clearOutcomes();
|
|
2513
|
+
if (e.length === 0) {
|
|
2514
|
+
h && p.log("No outcomes to send");
|
|
2515
|
+
return;
|
|
2516
|
+
}
|
|
2517
|
+
if (!this._dsn) {
|
|
2518
|
+
h && p.log("No dsn provided, will not send outcomes");
|
|
2519
|
+
return;
|
|
2520
|
+
}
|
|
2521
|
+
h && p.log("Sending outcomes:", e);
|
|
2522
|
+
const n = Vs(e, this._options.tunnel && St(this._dsn));
|
|
2523
|
+
this.sendEnvelope(n);
|
|
2524
|
+
}
|
|
2525
|
+
/**
|
|
2526
|
+
* Creates an {@link Event} from all inputs to `captureException` and non-primitive inputs to `captureMessage`.
|
|
2527
|
+
*/
|
|
2528
|
+
}
|
|
2529
|
+
function to(t, e) {
|
|
2530
|
+
const n = `${e} must return \`null\` or a valid event.`;
|
|
2531
|
+
if (yt(t))
|
|
2532
|
+
return t.then(
|
|
2533
|
+
(r) => {
|
|
2534
|
+
if (!K(r) && r !== null)
|
|
2535
|
+
throw ut(n);
|
|
2536
|
+
return r;
|
|
2537
|
+
},
|
|
2538
|
+
(r) => {
|
|
2539
|
+
throw ut(`${e} rejected with ${r}`);
|
|
2540
|
+
}
|
|
2541
|
+
);
|
|
2542
|
+
if (!K(t) && t !== null)
|
|
2543
|
+
throw ut(n);
|
|
2544
|
+
return t;
|
|
2545
|
+
}
|
|
2546
|
+
function eo(t, e, n, r) {
|
|
2547
|
+
const { beforeSend: s, beforeSendTransaction: o, beforeSendSpan: i } = e;
|
|
2548
|
+
let a = n;
|
|
2549
|
+
if (Mt(a) && s)
|
|
2550
|
+
return s(a, r);
|
|
2551
|
+
if (Cn(a)) {
|
|
2552
|
+
if (i) {
|
|
2553
|
+
const c = i(Js(a));
|
|
2554
|
+
if (c ? a = Q(n, Zs(c)) : we(), a.spans) {
|
|
2555
|
+
const u = [];
|
|
2556
|
+
for (const f of a.spans) {
|
|
2557
|
+
const l = i(f);
|
|
2558
|
+
l ? u.push(l) : (we(), u.push(f));
|
|
2559
|
+
}
|
|
2560
|
+
a.spans = u;
|
|
2561
|
+
}
|
|
2562
|
+
}
|
|
2563
|
+
if (o) {
|
|
2564
|
+
if (a.spans) {
|
|
2565
|
+
const c = a.spans.length;
|
|
2566
|
+
a.sdkProcessingMetadata = {
|
|
2567
|
+
...n.sdkProcessingMetadata,
|
|
2568
|
+
spanCountBeforeProcessing: c
|
|
2569
|
+
};
|
|
2570
|
+
}
|
|
2571
|
+
return o(a, r);
|
|
2572
|
+
}
|
|
2573
|
+
}
|
|
2574
|
+
return a;
|
|
2575
|
+
}
|
|
2576
|
+
function Mt(t) {
|
|
2577
|
+
return t.type === void 0;
|
|
2578
|
+
}
|
|
2579
|
+
function Cn(t) {
|
|
2580
|
+
return t.type === "transaction";
|
|
2581
|
+
}
|
|
2582
|
+
function no(t) {
|
|
2583
|
+
return [
|
|
2584
|
+
{
|
|
2585
|
+
type: "log",
|
|
2586
|
+
item_count: t.length,
|
|
2587
|
+
content_type: "application/vnd.sentry.items.log+json"
|
|
2588
|
+
},
|
|
2589
|
+
{
|
|
2590
|
+
items: t
|
|
2591
|
+
}
|
|
2592
|
+
];
|
|
2593
|
+
}
|
|
2594
|
+
function ro(t, e, n, r) {
|
|
2595
|
+
const s = {};
|
|
2596
|
+
return e?.sdk && (s.sdk = {
|
|
2597
|
+
name: e.sdk.name,
|
|
2598
|
+
version: e.sdk.version
|
|
2599
|
+
}), n && r && (s.dsn = St(r)), et(s, [no(t)]);
|
|
2600
|
+
}
|
|
2601
|
+
function At(t, e) {
|
|
2602
|
+
const n = so(t) ?? [];
|
|
2603
|
+
if (n.length === 0)
|
|
2604
|
+
return;
|
|
2605
|
+
const r = t.getOptions(), s = ro(n, r._metadata, r.tunnel, t.getDsn());
|
|
2606
|
+
Dn().set(t, []), t.emit("flushLogs"), t.sendEnvelope(s);
|
|
2607
|
+
}
|
|
2608
|
+
function so(t) {
|
|
2609
|
+
return Dn().get(t);
|
|
2610
|
+
}
|
|
2611
|
+
function Dn() {
|
|
2612
|
+
return J("clientToLogBufferMap", () => /* @__PURE__ */ new WeakMap());
|
|
2613
|
+
}
|
|
2614
|
+
function oo(t, e) {
|
|
2615
|
+
e.debug === !0 && (h ? p.enable() : Y(() => {
|
|
2616
|
+
console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.");
|
|
2617
|
+
})), D().update(e.initialScope);
|
|
2618
|
+
const r = new t(e);
|
|
2619
|
+
return io(r), r.init(), r;
|
|
2620
|
+
}
|
|
2621
|
+
function io(t) {
|
|
2622
|
+
D().setClient(t);
|
|
2623
|
+
}
|
|
2624
|
+
const Ln = Symbol.for("SentryBufferFullError");
|
|
2625
|
+
function ao(t) {
|
|
2626
|
+
const e = [];
|
|
2627
|
+
function n() {
|
|
2628
|
+
return t === void 0 || e.length < t;
|
|
2629
|
+
}
|
|
2630
|
+
function r(i) {
|
|
2631
|
+
return e.splice(e.indexOf(i), 1)[0] || Promise.resolve(void 0);
|
|
2632
|
+
}
|
|
2633
|
+
function s(i) {
|
|
2634
|
+
if (!n())
|
|
2635
|
+
return pt(Ln);
|
|
2636
|
+
const a = i();
|
|
2637
|
+
return e.indexOf(a) === -1 && e.push(a), a.then(() => r(a)).then(
|
|
2638
|
+
null,
|
|
2639
|
+
() => r(a).then(null, () => {
|
|
2640
|
+
})
|
|
2641
|
+
), a;
|
|
2642
|
+
}
|
|
2643
|
+
function o(i) {
|
|
2644
|
+
return new C((a, c) => {
|
|
2645
|
+
let u = e.length;
|
|
2646
|
+
if (!u)
|
|
2647
|
+
return a(!0);
|
|
2648
|
+
const f = setTimeout(() => {
|
|
2649
|
+
i && i > 0 && a(!1);
|
|
2650
|
+
}, i);
|
|
2651
|
+
e.forEach((l) => {
|
|
2652
|
+
$(l).then(() => {
|
|
2653
|
+
--u || (clearTimeout(f), a(!0));
|
|
2654
|
+
}, c);
|
|
2655
|
+
});
|
|
2656
|
+
});
|
|
2657
|
+
}
|
|
2658
|
+
return {
|
|
2659
|
+
$: e,
|
|
2660
|
+
add: s,
|
|
2661
|
+
drain: o
|
|
2662
|
+
};
|
|
2663
|
+
}
|
|
2664
|
+
const co = 60 * 1e3;
|
|
2665
|
+
function uo(t, e = Date.now()) {
|
|
2666
|
+
const n = parseInt(`${t}`, 10);
|
|
2667
|
+
if (!isNaN(n))
|
|
2668
|
+
return n * 1e3;
|
|
2669
|
+
const r = Date.parse(`${t}`);
|
|
2670
|
+
return isNaN(r) ? co : r - e;
|
|
2671
|
+
}
|
|
2672
|
+
function fo(t, e) {
|
|
2673
|
+
return t[e] || t.all || 0;
|
|
2674
|
+
}
|
|
2675
|
+
function lo(t, e, n = Date.now()) {
|
|
2676
|
+
return fo(t, e) > n;
|
|
2677
|
+
}
|
|
2678
|
+
function po(t, { statusCode: e, headers: n }, r = Date.now()) {
|
|
2679
|
+
const s = {
|
|
2680
|
+
...t
|
|
2681
|
+
}, o = n?.["x-sentry-rate-limits"], i = n?.["retry-after"];
|
|
2682
|
+
if (o)
|
|
2683
|
+
for (const a of o.trim().split(",")) {
|
|
2684
|
+
const [c, u, , , f] = a.split(":", 5), l = parseInt(c, 10), m = (isNaN(l) ? 60 : l) * 1e3;
|
|
2685
|
+
if (!u)
|
|
2686
|
+
s.all = r + m;
|
|
2687
|
+
else
|
|
2688
|
+
for (const d of u.split(";"))
|
|
2689
|
+
d === "metric_bucket" ? (!f || f.split(";").includes("custom")) && (s[d] = r + m) : s[d] = r + m;
|
|
2690
|
+
}
|
|
2691
|
+
else i ? s.all = r + uo(i, r) : e === 429 && (s.all = r + 60 * 1e3);
|
|
2692
|
+
return s;
|
|
2693
|
+
}
|
|
2694
|
+
const ho = 64;
|
|
2695
|
+
function mo(t, e, n = ao(
|
|
2696
|
+
t.bufferSize || ho
|
|
2697
|
+
)) {
|
|
2698
|
+
let r = {};
|
|
2699
|
+
const s = (i) => n.drain(i);
|
|
2700
|
+
function o(i) {
|
|
2701
|
+
const a = [];
|
|
2702
|
+
if (Re(i, (l, m) => {
|
|
2703
|
+
const d = ke(m);
|
|
2704
|
+
lo(r, d) ? t.recordDroppedEvent("ratelimit_backoff", d) : a.push(l);
|
|
2705
|
+
}), a.length === 0)
|
|
2706
|
+
return $({});
|
|
2707
|
+
const c = et(i[0], a), u = (l) => {
|
|
2708
|
+
Re(c, (m, d) => {
|
|
2709
|
+
t.recordDroppedEvent(l, ke(d));
|
|
2710
|
+
});
|
|
2711
|
+
}, f = () => e({ body: gs(c) }).then(
|
|
2712
|
+
(l) => (l.statusCode !== void 0 && (l.statusCode < 200 || l.statusCode >= 300) && h && p.warn(`Sentry responded with status code ${l.statusCode} to sent event.`), r = po(r, l), l),
|
|
2713
|
+
(l) => {
|
|
2714
|
+
throw u("network_error"), h && p.error("Encountered error running transport request:", l), l;
|
|
2715
|
+
}
|
|
2716
|
+
);
|
|
2717
|
+
return n.add(f).then(
|
|
2718
|
+
(l) => l,
|
|
2719
|
+
(l) => {
|
|
2720
|
+
if (l === Ln)
|
|
2721
|
+
return h && p.error("Skipped sending event because buffer is full."), u("queue_overflow"), $({});
|
|
2722
|
+
throw l;
|
|
2723
|
+
}
|
|
2724
|
+
);
|
|
2725
|
+
}
|
|
2726
|
+
return {
|
|
2727
|
+
send: o,
|
|
2728
|
+
flush: s
|
|
2729
|
+
};
|
|
2730
|
+
}
|
|
2731
|
+
function go(t) {
|
|
2732
|
+
t.user?.ip_address === void 0 && (t.user = {
|
|
2733
|
+
...t.user,
|
|
2734
|
+
ip_address: "{{auto}}"
|
|
2735
|
+
});
|
|
2736
|
+
}
|
|
2737
|
+
function _o(t) {
|
|
2738
|
+
"aggregates" in t ? t.attrs?.ip_address === void 0 && (t.attrs = {
|
|
2739
|
+
...t.attrs,
|
|
2740
|
+
ip_address: "{{auto}}"
|
|
2741
|
+
}) : t.ipAddress === void 0 && (t.ipAddress = "{{auto}}");
|
|
2742
|
+
}
|
|
2743
|
+
function yo(t, e, n = [e], r = "npm") {
|
|
2744
|
+
const s = t._metadata || {};
|
|
2745
|
+
s.sdk || (s.sdk = {
|
|
2746
|
+
name: `sentry.javascript.${e}`,
|
|
2747
|
+
packages: n.map((o) => ({
|
|
2748
|
+
name: `${r}:@sentry/${o}`,
|
|
2749
|
+
version: P
|
|
2750
|
+
})),
|
|
2751
|
+
version: P
|
|
2752
|
+
}), t._metadata = s;
|
|
2753
|
+
}
|
|
2754
|
+
const Eo = 100;
|
|
2755
|
+
function U(t, e) {
|
|
2756
|
+
const n = b(), r = tt();
|
|
2757
|
+
if (!n) return;
|
|
2758
|
+
const { beforeBreadcrumb: s = null, maxBreadcrumbs: o = Eo } = n.getOptions();
|
|
2759
|
+
if (o <= 0) return;
|
|
2760
|
+
const a = { timestamp: Z(), ...t }, c = s ? Y(() => s(a, e)) : a;
|
|
2761
|
+
c !== null && (n.emit && n.emit("beforeAddBreadcrumb", c, e), r.addBreadcrumb(c, o));
|
|
2762
|
+
}
|
|
2763
|
+
let je;
|
|
2764
|
+
const So = "FunctionToString", Be = /* @__PURE__ */ new WeakMap(), bo = (() => ({
|
|
2765
|
+
name: So,
|
|
2766
|
+
setupOnce() {
|
|
2767
|
+
je = Function.prototype.toString;
|
|
2768
|
+
try {
|
|
2769
|
+
Function.prototype.toString = function(...t) {
|
|
2770
|
+
const e = Zt(this), n = Be.has(b()) && e !== void 0 ? e : this;
|
|
2771
|
+
return je.apply(n, t);
|
|
2772
|
+
};
|
|
2773
|
+
} catch {
|
|
2774
|
+
}
|
|
2775
|
+
},
|
|
2776
|
+
setup(t) {
|
|
2777
|
+
Be.set(t, !0);
|
|
2778
|
+
}
|
|
2779
|
+
})), To = bo, Io = [
|
|
2780
|
+
/^Script error\.?$/,
|
|
2781
|
+
/^Javascript error: Script error\.? on line 0$/,
|
|
2782
|
+
/^ResizeObserver loop completed with undelivered notifications.$/,
|
|
2783
|
+
// The browser logs this when a ResizeObserver handler takes a bit longer. Usually this is not an actual issue though. It indicates slowness.
|
|
2784
|
+
/^Cannot redefine property: googletag$/,
|
|
2785
|
+
// This is thrown when google tag manager is used in combination with an ad blocker
|
|
2786
|
+
/^Can't find variable: gmo$/,
|
|
2787
|
+
// Error from Google Search App https://issuetracker.google.com/issues/396043331
|
|
2788
|
+
/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,
|
|
2789
|
+
// Random error that happens but not actionable or noticeable to end-users.
|
|
2790
|
+
`can't redefine non-configurable property "solana"`,
|
|
2791
|
+
// Probably a browser extension or custom browser (Brave) throwing this error
|
|
2792
|
+
"vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)",
|
|
2793
|
+
// Error thrown by GTM, seemingly not affecting end-users
|
|
2794
|
+
"Can't find variable: _AutofillCallbackHandler",
|
|
2795
|
+
// Unactionable error in instagram webview https://developers.facebook.com/community/threads/320013549791141/
|
|
2796
|
+
/^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/,
|
|
2797
|
+
// unactionable error from CEFSharp, a .NET library that embeds chromium in .NET apps
|
|
2798
|
+
/^Java exception was raised during method invocation$/
|
|
2799
|
+
// error from Facebook Mobile browser (https://github.com/getsentry/sentry-javascript/issues/15065)
|
|
2800
|
+
], vo = "EventFilters", wo = (t = {}) => {
|
|
2801
|
+
let e;
|
|
2802
|
+
return {
|
|
2803
|
+
name: vo,
|
|
2804
|
+
setup(n) {
|
|
2805
|
+
const r = n.getOptions();
|
|
2806
|
+
e = He(t, r);
|
|
2807
|
+
},
|
|
2808
|
+
processEvent(n, r, s) {
|
|
2809
|
+
if (!e) {
|
|
2810
|
+
const o = s.getOptions();
|
|
2811
|
+
e = He(t, o);
|
|
2812
|
+
}
|
|
2813
|
+
return ko(n, e) ? null : n;
|
|
2814
|
+
}
|
|
2815
|
+
};
|
|
2816
|
+
}, Ro = ((t = {}) => ({
|
|
2817
|
+
...wo(t),
|
|
2818
|
+
name: "InboundFilters"
|
|
2819
|
+
}));
|
|
2820
|
+
function He(t = {}, e = {}) {
|
|
2821
|
+
return {
|
|
2822
|
+
allowUrls: [...t.allowUrls || [], ...e.allowUrls || []],
|
|
2823
|
+
denyUrls: [...t.denyUrls || [], ...e.denyUrls || []],
|
|
2824
|
+
ignoreErrors: [
|
|
2825
|
+
...t.ignoreErrors || [],
|
|
2826
|
+
...e.ignoreErrors || [],
|
|
2827
|
+
...t.disableErrorDefaults ? [] : Io
|
|
2828
|
+
],
|
|
2829
|
+
ignoreTransactions: [...t.ignoreTransactions || [], ...e.ignoreTransactions || []]
|
|
2830
|
+
};
|
|
2831
|
+
}
|
|
2832
|
+
function ko(t, e) {
|
|
2833
|
+
if (t.type) {
|
|
2834
|
+
if (t.type === "transaction" && xo(t, e.ignoreTransactions))
|
|
2835
|
+
return h && p.warn(
|
|
2836
|
+
`Event dropped due to being matched by \`ignoreTransactions\` option.
|
|
2837
|
+
Event: ${L(t)}`
|
|
2838
|
+
), !0;
|
|
2839
|
+
} else {
|
|
2840
|
+
if (Ao(t, e.ignoreErrors))
|
|
2841
|
+
return h && p.warn(
|
|
2842
|
+
`Event dropped due to being matched by \`ignoreErrors\` option.
|
|
2843
|
+
Event: ${L(t)}`
|
|
2844
|
+
), !0;
|
|
2845
|
+
if (Do(t))
|
|
2846
|
+
return h && p.warn(
|
|
2847
|
+
`Event dropped due to not having an error message, error type or stacktrace.
|
|
2848
|
+
Event: ${L(
|
|
2849
|
+
t
|
|
2850
|
+
)}`
|
|
2851
|
+
), !0;
|
|
2852
|
+
if (Oo(t, e.denyUrls))
|
|
2853
|
+
return h && p.warn(
|
|
2854
|
+
`Event dropped due to being matched by \`denyUrls\` option.
|
|
2855
|
+
Event: ${L(
|
|
2856
|
+
t
|
|
2857
|
+
)}.
|
|
2858
|
+
Url: ${ht(t)}`
|
|
2859
|
+
), !0;
|
|
2860
|
+
if (!No(t, e.allowUrls))
|
|
2861
|
+
return h && p.warn(
|
|
2862
|
+
`Event dropped due to not being matched by \`allowUrls\` option.
|
|
2863
|
+
Event: ${L(
|
|
2864
|
+
t
|
|
2865
|
+
)}.
|
|
2866
|
+
Url: ${ht(t)}`
|
|
2867
|
+
), !0;
|
|
2868
|
+
}
|
|
2869
|
+
return !1;
|
|
2870
|
+
}
|
|
2871
|
+
function Ao(t, e) {
|
|
2872
|
+
return e?.length ? xn(t).some((n) => Et(n, e)) : !1;
|
|
2873
|
+
}
|
|
2874
|
+
function xo(t, e) {
|
|
2875
|
+
if (!e?.length)
|
|
2876
|
+
return !1;
|
|
2877
|
+
const n = t.transaction;
|
|
2878
|
+
return n ? Et(n, e) : !1;
|
|
2879
|
+
}
|
|
2880
|
+
function Oo(t, e) {
|
|
2881
|
+
if (!e?.length)
|
|
2882
|
+
return !1;
|
|
2883
|
+
const n = ht(t);
|
|
2884
|
+
return n ? Et(n, e) : !1;
|
|
2885
|
+
}
|
|
2886
|
+
function No(t, e) {
|
|
2887
|
+
if (!e?.length)
|
|
2888
|
+
return !0;
|
|
2889
|
+
const n = ht(t);
|
|
2890
|
+
return n ? Et(n, e) : !0;
|
|
2891
|
+
}
|
|
2892
|
+
function Co(t = []) {
|
|
2893
|
+
for (let e = t.length - 1; e >= 0; e--) {
|
|
2894
|
+
const n = t[e];
|
|
2895
|
+
if (n && n.filename !== "<anonymous>" && n.filename !== "[native code]")
|
|
2896
|
+
return n.filename || null;
|
|
2897
|
+
}
|
|
2898
|
+
return null;
|
|
2899
|
+
}
|
|
2900
|
+
function ht(t) {
|
|
2901
|
+
try {
|
|
2902
|
+
const n = [...t.exception?.values ?? []].reverse().find((r) => r.mechanism?.parent_id === void 0 && r.stacktrace?.frames?.length)?.stacktrace?.frames;
|
|
2903
|
+
return n ? Co(n) : null;
|
|
2904
|
+
} catch {
|
|
2905
|
+
return h && p.error(`Cannot extract url for event ${L(t)}`), null;
|
|
2906
|
+
}
|
|
2907
|
+
}
|
|
2908
|
+
function Do(t) {
|
|
2909
|
+
return t.exception?.values?.length ? (
|
|
2910
|
+
// No top-level message
|
|
2911
|
+
!t.message && // There are no exception values that have a stacktrace, a non-generic-Error type or value
|
|
2912
|
+
!t.exception.values.some((e) => e.stacktrace || e.type && e.type !== "Error" || e.value)
|
|
2913
|
+
) : !1;
|
|
2914
|
+
}
|
|
2915
|
+
function Lo(t, e, n, r, s, o) {
|
|
2916
|
+
if (!s.exception?.values || !o || !N(o.originalException, Error))
|
|
2917
|
+
return;
|
|
2918
|
+
const i = s.exception.values.length > 0 ? s.exception.values[s.exception.values.length - 1] : void 0;
|
|
2919
|
+
i && (s.exception.values = Ft(
|
|
2920
|
+
t,
|
|
2921
|
+
e,
|
|
2922
|
+
r,
|
|
2923
|
+
o.originalException,
|
|
2924
|
+
n,
|
|
2925
|
+
s.exception.values,
|
|
2926
|
+
i,
|
|
2927
|
+
0
|
|
2928
|
+
));
|
|
2929
|
+
}
|
|
2930
|
+
function Ft(t, e, n, r, s, o, i, a) {
|
|
2931
|
+
if (o.length >= n + 1)
|
|
2932
|
+
return o;
|
|
2933
|
+
let c = [...o];
|
|
2934
|
+
if (N(r[s], Error)) {
|
|
2935
|
+
Ge(i, a);
|
|
2936
|
+
const u = t(e, r[s]), f = c.length;
|
|
2937
|
+
We(u, s, f, a), c = Ft(
|
|
2938
|
+
t,
|
|
2939
|
+
e,
|
|
2940
|
+
n,
|
|
2941
|
+
r[s],
|
|
2942
|
+
s,
|
|
2943
|
+
[u, ...c],
|
|
2944
|
+
u,
|
|
2945
|
+
f
|
|
2946
|
+
);
|
|
2947
|
+
}
|
|
2948
|
+
return Array.isArray(r.errors) && r.errors.forEach((u, f) => {
|
|
2949
|
+
if (N(u, Error)) {
|
|
2950
|
+
Ge(i, a);
|
|
2951
|
+
const l = t(e, u), m = c.length;
|
|
2952
|
+
We(l, `errors[${f}]`, m, a), c = Ft(
|
|
2953
|
+
t,
|
|
2954
|
+
e,
|
|
2955
|
+
n,
|
|
2956
|
+
u,
|
|
2957
|
+
s,
|
|
2958
|
+
[l, ...c],
|
|
2959
|
+
l,
|
|
2960
|
+
m
|
|
2961
|
+
);
|
|
2962
|
+
}
|
|
2963
|
+
}), c;
|
|
2964
|
+
}
|
|
2965
|
+
function Ge(t, e) {
|
|
2966
|
+
t.mechanism = t.mechanism || { type: "generic", handled: !0 }, t.mechanism = {
|
|
2967
|
+
...t.mechanism,
|
|
2968
|
+
...t.type === "AggregateError" && { is_exception_group: !0 },
|
|
2969
|
+
exception_id: e
|
|
2970
|
+
};
|
|
2971
|
+
}
|
|
2972
|
+
function We(t, e, n, r) {
|
|
2973
|
+
t.mechanism = t.mechanism || { type: "generic", handled: !0 }, t.mechanism = {
|
|
2974
|
+
...t.mechanism,
|
|
2975
|
+
type: "chained",
|
|
2976
|
+
source: e,
|
|
2977
|
+
exception_id: n,
|
|
2978
|
+
parent_id: r
|
|
2979
|
+
};
|
|
2980
|
+
}
|
|
2981
|
+
function Po(t) {
|
|
2982
|
+
const e = "console";
|
|
2983
|
+
j(e, t), B(e, Mo);
|
|
2984
|
+
}
|
|
2985
|
+
function Mo() {
|
|
2986
|
+
"console" in _ && zn.forEach(function(t) {
|
|
2987
|
+
t in _.console && T(_.console, t, function(e) {
|
|
2988
|
+
return lt[t] = e, function(...n) {
|
|
2989
|
+
v("console", { args: n, level: t }), lt[t]?.apply(_.console, n);
|
|
2990
|
+
};
|
|
2991
|
+
});
|
|
2992
|
+
});
|
|
2993
|
+
}
|
|
2994
|
+
function Fo(t) {
|
|
2995
|
+
return t === "warn" ? "warning" : ["fatal", "error", "warning", "log", "info", "debug"].includes(t) ? t : "log";
|
|
2996
|
+
}
|
|
2997
|
+
const $o = "Dedupe", Uo = (() => {
|
|
2998
|
+
let t;
|
|
2999
|
+
return {
|
|
3000
|
+
name: $o,
|
|
3001
|
+
processEvent(e) {
|
|
3002
|
+
if (e.type)
|
|
3003
|
+
return e;
|
|
3004
|
+
try {
|
|
3005
|
+
if (Bo(e, t))
|
|
3006
|
+
return h && p.warn("Event dropped due to being a duplicate of previously captured event."), null;
|
|
3007
|
+
} catch {
|
|
3008
|
+
}
|
|
3009
|
+
return t = e;
|
|
3010
|
+
}
|
|
3011
|
+
};
|
|
3012
|
+
}), jo = Uo;
|
|
3013
|
+
function Bo(t, e) {
|
|
3014
|
+
return e ? !!(Ho(t, e) || Go(t, e)) : !1;
|
|
3015
|
+
}
|
|
3016
|
+
function Ho(t, e) {
|
|
3017
|
+
const n = t.message, r = e.message;
|
|
3018
|
+
return !(!n && !r || n && !r || !n && r || n !== r || !Mn(t, e) || !Pn(t, e));
|
|
3019
|
+
}
|
|
3020
|
+
function Go(t, e) {
|
|
3021
|
+
const n = qe(e), r = qe(t);
|
|
3022
|
+
return !(!n || !r || n.type !== r.type || n.value !== r.value || !Mn(t, e) || !Pn(t, e));
|
|
3023
|
+
}
|
|
3024
|
+
function Pn(t, e) {
|
|
3025
|
+
let n = ue(t), r = ue(e);
|
|
3026
|
+
if (!n && !r)
|
|
3027
|
+
return !0;
|
|
3028
|
+
if (n && !r || !n && r || (n = n, r = r, r.length !== n.length))
|
|
3029
|
+
return !1;
|
|
3030
|
+
for (let s = 0; s < r.length; s++) {
|
|
3031
|
+
const o = r[s], i = n[s];
|
|
3032
|
+
if (o.filename !== i.filename || o.lineno !== i.lineno || o.colno !== i.colno || o.function !== i.function)
|
|
3033
|
+
return !1;
|
|
3034
|
+
}
|
|
3035
|
+
return !0;
|
|
3036
|
+
}
|
|
3037
|
+
function Mn(t, e) {
|
|
3038
|
+
let n = t.fingerprint, r = e.fingerprint;
|
|
3039
|
+
if (!n && !r)
|
|
3040
|
+
return !0;
|
|
3041
|
+
if (n && !r || !n && r)
|
|
3042
|
+
return !1;
|
|
3043
|
+
n = n, r = r;
|
|
3044
|
+
try {
|
|
3045
|
+
return n.join("") === r.join("");
|
|
3046
|
+
} catch {
|
|
3047
|
+
return !1;
|
|
3048
|
+
}
|
|
3049
|
+
}
|
|
3050
|
+
function qe(t) {
|
|
3051
|
+
return t.exception?.values?.[0];
|
|
3052
|
+
}
|
|
3053
|
+
function xt(t) {
|
|
3054
|
+
if (!t)
|
|
3055
|
+
return {};
|
|
3056
|
+
const e = t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);
|
|
3057
|
+
if (!e)
|
|
3058
|
+
return {};
|
|
3059
|
+
const n = e[6] || "", r = e[8] || "";
|
|
3060
|
+
return {
|
|
3061
|
+
host: e[4],
|
|
3062
|
+
path: e[5],
|
|
3063
|
+
protocol: e[2],
|
|
3064
|
+
search: n,
|
|
3065
|
+
hash: r,
|
|
3066
|
+
relative: e[5] + n + r
|
|
3067
|
+
// everything minus origin
|
|
3068
|
+
};
|
|
3069
|
+
}
|
|
3070
|
+
function Fn(t) {
|
|
3071
|
+
if (t !== void 0)
|
|
3072
|
+
return t >= 400 && t < 500 ? "warning" : t >= 500 ? "error" : void 0;
|
|
3073
|
+
}
|
|
3074
|
+
const V = _;
|
|
3075
|
+
function Wo() {
|
|
3076
|
+
return "history" in V && !!V.history;
|
|
3077
|
+
}
|
|
3078
|
+
function qo() {
|
|
3079
|
+
if (!("fetch" in V))
|
|
3080
|
+
return !1;
|
|
3081
|
+
try {
|
|
3082
|
+
return new Headers(), new Request("http://www.example.com"), new Response(), !0;
|
|
3083
|
+
} catch {
|
|
3084
|
+
return !1;
|
|
3085
|
+
}
|
|
3086
|
+
}
|
|
3087
|
+
function $t(t) {
|
|
3088
|
+
return t && /^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString());
|
|
3089
|
+
}
|
|
3090
|
+
function Yo() {
|
|
3091
|
+
if (typeof EdgeRuntime == "string")
|
|
3092
|
+
return !0;
|
|
3093
|
+
if (!qo())
|
|
3094
|
+
return !1;
|
|
3095
|
+
if ($t(V.fetch))
|
|
3096
|
+
return !0;
|
|
3097
|
+
let t = !1;
|
|
3098
|
+
const e = V.document;
|
|
3099
|
+
if (e && typeof e.createElement == "function")
|
|
3100
|
+
try {
|
|
3101
|
+
const n = e.createElement("iframe");
|
|
3102
|
+
n.hidden = !0, e.head.appendChild(n), n.contentWindow?.fetch && (t = $t(n.contentWindow.fetch)), e.head.removeChild(n);
|
|
3103
|
+
} catch (n) {
|
|
3104
|
+
h && p.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ", n);
|
|
3105
|
+
}
|
|
3106
|
+
return t;
|
|
3107
|
+
}
|
|
3108
|
+
function zo(t, e) {
|
|
3109
|
+
const n = "fetch";
|
|
3110
|
+
j(n, t), B(n, () => Xo(void 0, e));
|
|
3111
|
+
}
|
|
3112
|
+
function Xo(t, e = !1) {
|
|
3113
|
+
e && !Yo() || T(_, "fetch", function(n) {
|
|
3114
|
+
return function(...r) {
|
|
3115
|
+
const s = new Error(), { method: o, url: i } = Ko(r), a = {
|
|
3116
|
+
args: r,
|
|
3117
|
+
fetchData: {
|
|
3118
|
+
method: o,
|
|
3119
|
+
url: i
|
|
3120
|
+
},
|
|
3121
|
+
startTimestamp: x() * 1e3,
|
|
3122
|
+
// // Adding the error to be able to fingerprint the failed fetch event in HttpClient instrumentation
|
|
3123
|
+
virtualError: s,
|
|
3124
|
+
headers: Vo(r)
|
|
3125
|
+
};
|
|
3126
|
+
return v("fetch", {
|
|
3127
|
+
...a
|
|
3128
|
+
}), n.apply(_, r).then(
|
|
3129
|
+
async (c) => (v("fetch", {
|
|
3130
|
+
...a,
|
|
3131
|
+
endTimestamp: x() * 1e3,
|
|
3132
|
+
response: c
|
|
3133
|
+
}), c),
|
|
3134
|
+
(c) => {
|
|
3135
|
+
if (v("fetch", {
|
|
3136
|
+
...a,
|
|
3137
|
+
endTimestamp: x() * 1e3,
|
|
3138
|
+
error: c
|
|
3139
|
+
}), zt(c) && c.stack === void 0 && (c.stack = s.stack, F(c, "framesToPop", 1)), c instanceof TypeError && (c.message === "Failed to fetch" || c.message === "Load failed" || c.message === "NetworkError when attempting to fetch resource."))
|
|
3140
|
+
try {
|
|
3141
|
+
const u = new URL(a.fetchData.url);
|
|
3142
|
+
c.message = `${c.message} (${u.host})`;
|
|
3143
|
+
} catch {
|
|
3144
|
+
}
|
|
3145
|
+
throw c;
|
|
3146
|
+
}
|
|
3147
|
+
);
|
|
3148
|
+
};
|
|
3149
|
+
});
|
|
3150
|
+
}
|
|
3151
|
+
function Ut(t, e) {
|
|
3152
|
+
return !!t && typeof t == "object" && !!t[e];
|
|
3153
|
+
}
|
|
3154
|
+
function Ye(t) {
|
|
3155
|
+
return typeof t == "string" ? t : t ? Ut(t, "url") ? t.url : t.toString ? t.toString() : "" : "";
|
|
3156
|
+
}
|
|
3157
|
+
function Ko(t) {
|
|
3158
|
+
if (t.length === 0)
|
|
3159
|
+
return { method: "GET", url: "" };
|
|
3160
|
+
if (t.length === 2) {
|
|
3161
|
+
const [n, r] = t;
|
|
3162
|
+
return {
|
|
3163
|
+
url: Ye(n),
|
|
3164
|
+
method: Ut(r, "method") ? String(r.method).toUpperCase() : "GET"
|
|
3165
|
+
};
|
|
3166
|
+
}
|
|
3167
|
+
const e = t[0];
|
|
3168
|
+
return {
|
|
3169
|
+
url: Ye(e),
|
|
3170
|
+
method: Ut(e, "method") ? String(e.method).toUpperCase() : "GET"
|
|
3171
|
+
};
|
|
3172
|
+
}
|
|
3173
|
+
function Vo(t) {
|
|
3174
|
+
const [e, n] = t;
|
|
3175
|
+
try {
|
|
3176
|
+
if (typeof n == "object" && n !== null && "headers" in n && n.headers)
|
|
3177
|
+
return new Headers(n.headers);
|
|
3178
|
+
if (fr(e))
|
|
3179
|
+
return new Headers(e.headers);
|
|
3180
|
+
} catch {
|
|
3181
|
+
}
|
|
3182
|
+
}
|
|
3183
|
+
function Jo() {
|
|
3184
|
+
return "npm";
|
|
3185
|
+
}
|
|
3186
|
+
const y = _;
|
|
3187
|
+
let jt = 0;
|
|
3188
|
+
function $n() {
|
|
3189
|
+
return jt > 0;
|
|
3190
|
+
}
|
|
3191
|
+
function Zo() {
|
|
3192
|
+
jt++, setTimeout(() => {
|
|
3193
|
+
jt--;
|
|
3194
|
+
});
|
|
3195
|
+
}
|
|
3196
|
+
function q(t, e = {}) {
|
|
3197
|
+
function n(s) {
|
|
3198
|
+
return typeof s == "function";
|
|
3199
|
+
}
|
|
3200
|
+
if (!n(t))
|
|
3201
|
+
return t;
|
|
3202
|
+
try {
|
|
3203
|
+
const s = t.__sentry_wrapped__;
|
|
3204
|
+
if (s)
|
|
3205
|
+
return typeof s == "function" ? s : t;
|
|
3206
|
+
if (Zt(t))
|
|
3207
|
+
return t;
|
|
3208
|
+
} catch {
|
|
3209
|
+
return t;
|
|
3210
|
+
}
|
|
3211
|
+
const r = function(...s) {
|
|
3212
|
+
try {
|
|
3213
|
+
const o = s.map((i) => q(i, e));
|
|
3214
|
+
return t.apply(this, o);
|
|
3215
|
+
} catch (o) {
|
|
3216
|
+
throw Zo(), Or((i) => {
|
|
3217
|
+
i.addEventProcessor((a) => (e.mechanism && (Nt(a, void 0), H(a, e.mechanism)), a.extra = {
|
|
3218
|
+
...a.extra,
|
|
3219
|
+
arguments: s
|
|
3220
|
+
}, a)), vn(o);
|
|
3221
|
+
}), o;
|
|
3222
|
+
}
|
|
3223
|
+
};
|
|
3224
|
+
try {
|
|
3225
|
+
for (const s in t)
|
|
3226
|
+
Object.prototype.hasOwnProperty.call(t, s) && (r[s] = t[s]);
|
|
3227
|
+
} catch {
|
|
3228
|
+
}
|
|
3229
|
+
fn(r, t), F(t, "__sentry_wrapped__", r);
|
|
3230
|
+
try {
|
|
3231
|
+
Object.getOwnPropertyDescriptor(r, "name").configurable && Object.defineProperty(r, "name", {
|
|
3232
|
+
get() {
|
|
3233
|
+
return t.name;
|
|
3234
|
+
}
|
|
3235
|
+
});
|
|
3236
|
+
} catch {
|
|
3237
|
+
}
|
|
3238
|
+
return r;
|
|
3239
|
+
}
|
|
3240
|
+
function Qo() {
|
|
3241
|
+
const t = Jt(), { referrer: e } = y.document || {}, { userAgent: n } = y.navigator || {}, r = {
|
|
3242
|
+
...e && { Referer: e },
|
|
3243
|
+
...n && { "User-Agent": n }
|
|
3244
|
+
};
|
|
3245
|
+
return {
|
|
3246
|
+
url: t,
|
|
3247
|
+
headers: r
|
|
3248
|
+
};
|
|
3249
|
+
}
|
|
3250
|
+
function ne(t, e) {
|
|
3251
|
+
const n = re(t, e), r = {
|
|
3252
|
+
type: si(e),
|
|
3253
|
+
value: oi(e)
|
|
3254
|
+
};
|
|
3255
|
+
return n.length && (r.stacktrace = { frames: n }), r.type === void 0 && r.value === "" && (r.value = "Unrecoverable error caught"), r;
|
|
3256
|
+
}
|
|
3257
|
+
function ti(t, e, n, r) {
|
|
3258
|
+
const o = b()?.getOptions().normalizeDepth, i = fi(e), a = {
|
|
3259
|
+
__serialized__: Tn(e, o)
|
|
3260
|
+
};
|
|
3261
|
+
if (i)
|
|
3262
|
+
return {
|
|
3263
|
+
exception: {
|
|
3264
|
+
values: [ne(t, i)]
|
|
3265
|
+
},
|
|
3266
|
+
extra: a
|
|
3267
|
+
};
|
|
3268
|
+
const c = {
|
|
3269
|
+
exception: {
|
|
3270
|
+
values: [
|
|
3271
|
+
{
|
|
3272
|
+
type: _t(e) ? e.constructor.name : r ? "UnhandledRejection" : "Error",
|
|
3273
|
+
value: ci(e, { isUnhandledRejection: r })
|
|
3274
|
+
}
|
|
3275
|
+
]
|
|
3276
|
+
},
|
|
3277
|
+
extra: a
|
|
3278
|
+
};
|
|
3279
|
+
if (n) {
|
|
3280
|
+
const u = re(t, n);
|
|
3281
|
+
u.length && (c.exception.values[0].stacktrace = { frames: u });
|
|
3282
|
+
}
|
|
3283
|
+
return c;
|
|
3284
|
+
}
|
|
3285
|
+
function Ot(t, e) {
|
|
3286
|
+
return {
|
|
3287
|
+
exception: {
|
|
3288
|
+
values: [ne(t, e)]
|
|
3289
|
+
}
|
|
3290
|
+
};
|
|
3291
|
+
}
|
|
3292
|
+
function re(t, e) {
|
|
3293
|
+
const n = e.stacktrace || e.stack || "", r = ni(e), s = ri(e);
|
|
3294
|
+
try {
|
|
3295
|
+
return t(n, r, s);
|
|
3296
|
+
} catch {
|
|
3297
|
+
}
|
|
3298
|
+
return [];
|
|
3299
|
+
}
|
|
3300
|
+
const ei = /Minified React error #\d+;/i;
|
|
3301
|
+
function ni(t) {
|
|
3302
|
+
return t && ei.test(t.message) ? 1 : 0;
|
|
3303
|
+
}
|
|
3304
|
+
function ri(t) {
|
|
3305
|
+
return typeof t.framesToPop == "number" ? t.framesToPop : 0;
|
|
3306
|
+
}
|
|
3307
|
+
function Un(t) {
|
|
3308
|
+
return typeof WebAssembly < "u" && typeof WebAssembly.Exception < "u" ? t instanceof WebAssembly.Exception : !1;
|
|
3309
|
+
}
|
|
3310
|
+
function si(t) {
|
|
3311
|
+
const e = t?.name;
|
|
3312
|
+
return !e && Un(t) ? t.message && Array.isArray(t.message) && t.message.length == 2 ? t.message[0] : "WebAssembly.Exception" : e;
|
|
3313
|
+
}
|
|
3314
|
+
function oi(t) {
|
|
3315
|
+
const e = t?.message;
|
|
3316
|
+
return Un(t) ? Array.isArray(t.message) && t.message.length == 2 ? t.message[1] : "wasm exception" : e ? e.error && typeof e.error.message == "string" ? e.error.message : e : "No error message";
|
|
3317
|
+
}
|
|
3318
|
+
function ii(t, e, n, r) {
|
|
3319
|
+
const s = n?.syntheticException || void 0, o = se(t, e, s, r);
|
|
3320
|
+
return H(o), o.level = "error", n?.event_id && (o.event_id = n.event_id), $(o);
|
|
3321
|
+
}
|
|
3322
|
+
function ai(t, e, n = "info", r, s) {
|
|
3323
|
+
const o = r?.syntheticException || void 0, i = Bt(t, e, o, s);
|
|
3324
|
+
return i.level = n, r?.event_id && (i.event_id = r.event_id), $(i);
|
|
3325
|
+
}
|
|
3326
|
+
function se(t, e, n, r, s) {
|
|
3327
|
+
let o;
|
|
3328
|
+
if (an(e) && e.error)
|
|
3329
|
+
return Ot(t, e.error);
|
|
3330
|
+
if (le(e) || ir(e)) {
|
|
3331
|
+
const i = e;
|
|
3332
|
+
if ("stack" in e)
|
|
3333
|
+
o = Ot(t, e);
|
|
3334
|
+
else {
|
|
3335
|
+
const a = i.name || (le(i) ? "DOMError" : "DOMException"), c = i.message ? `${a}: ${i.message}` : a;
|
|
3336
|
+
o = Bt(t, c, n, r), Nt(o, c);
|
|
3337
|
+
}
|
|
3338
|
+
return "code" in i && (o.tags = { ...o.tags, "DOMException.code": `${i.code}` }), o;
|
|
3339
|
+
}
|
|
3340
|
+
return zt(e) ? Ot(t, e) : K(e) || _t(e) ? (o = ti(t, e, n, s), H(o, {
|
|
3341
|
+
synthetic: !0
|
|
3342
|
+
}), o) : (o = Bt(t, e, n, r), Nt(o, `${e}`), H(o, {
|
|
3343
|
+
synthetic: !0
|
|
3344
|
+
}), o);
|
|
3345
|
+
}
|
|
3346
|
+
function Bt(t, e, n, r) {
|
|
3347
|
+
const s = {};
|
|
3348
|
+
if (r && n) {
|
|
3349
|
+
const o = re(t, n);
|
|
3350
|
+
o.length && (s.exception = {
|
|
3351
|
+
values: [{ value: e, stacktrace: { frames: o } }]
|
|
3352
|
+
}), H(s, { synthetic: !0 });
|
|
3353
|
+
}
|
|
3354
|
+
if (Xt(e)) {
|
|
3355
|
+
const { __sentry_template_string__: o, __sentry_template_values__: i } = e;
|
|
3356
|
+
return s.logentry = {
|
|
3357
|
+
message: o,
|
|
3358
|
+
params: i
|
|
3359
|
+
}, s;
|
|
3360
|
+
}
|
|
3361
|
+
return s.message = e, s;
|
|
3362
|
+
}
|
|
3363
|
+
function ci(t, { isUnhandledRejection: e }) {
|
|
3364
|
+
const n = mr(t), r = e ? "promise rejection" : "exception";
|
|
3365
|
+
return an(t) ? `Event \`ErrorEvent\` captured as ${r} with message \`${t.message}\`` : _t(t) ? `Event \`${ui(t)}\` (type=${t.type}) captured as ${r}` : `Object captured as ${r} with keys: ${n}`;
|
|
3366
|
+
}
|
|
3367
|
+
function ui(t) {
|
|
3368
|
+
try {
|
|
3369
|
+
const e = Object.getPrototypeOf(t);
|
|
3370
|
+
return e ? e.constructor.name : void 0;
|
|
3371
|
+
} catch {
|
|
3372
|
+
}
|
|
3373
|
+
}
|
|
3374
|
+
function fi(t) {
|
|
3375
|
+
for (const e in t)
|
|
3376
|
+
if (Object.prototype.hasOwnProperty.call(t, e)) {
|
|
3377
|
+
const n = t[e];
|
|
3378
|
+
if (n instanceof Error)
|
|
3379
|
+
return n;
|
|
3380
|
+
}
|
|
3381
|
+
}
|
|
3382
|
+
const li = 5e3;
|
|
3383
|
+
class di extends Qs {
|
|
3384
|
+
/**
|
|
3385
|
+
* Creates a new Browser SDK instance.
|
|
3386
|
+
*
|
|
3387
|
+
* @param options Configuration options for this SDK.
|
|
3388
|
+
*/
|
|
3389
|
+
constructor(e) {
|
|
3390
|
+
const n = pi(e), r = y.SENTRY_SDK_SOURCE || Jo();
|
|
3391
|
+
yo(n, "browser", ["browser"], r), super(n);
|
|
3392
|
+
const { sendDefaultPii: s, sendClientReports: o, enableLogs: i, _experiments: a } = this._options, c = i ?? a?.enableLogs;
|
|
3393
|
+
y.document && (o || c) && y.document.addEventListener("visibilitychange", () => {
|
|
3394
|
+
y.document.visibilityState === "hidden" && (o && this._flushOutcomes(), c && At(this));
|
|
3395
|
+
}), c && (this.on("flush", () => {
|
|
3396
|
+
At(this);
|
|
3397
|
+
}), this.on("afterCaptureLog", () => {
|
|
3398
|
+
this._logFlushIdleTimeout && clearTimeout(this._logFlushIdleTimeout), this._logFlushIdleTimeout = setTimeout(() => {
|
|
3399
|
+
At(this);
|
|
3400
|
+
}, li);
|
|
3401
|
+
})), s && (this.on("postprocessEvent", go), this.on("beforeSendSession", _o));
|
|
3402
|
+
}
|
|
3403
|
+
/**
|
|
3404
|
+
* @inheritDoc
|
|
3405
|
+
*/
|
|
3406
|
+
eventFromException(e, n) {
|
|
3407
|
+
return ii(this._options.stackParser, e, n, this._options.attachStacktrace);
|
|
3408
|
+
}
|
|
3409
|
+
/**
|
|
3410
|
+
* @inheritDoc
|
|
3411
|
+
*/
|
|
3412
|
+
eventFromMessage(e, n = "info", r) {
|
|
3413
|
+
return ai(this._options.stackParser, e, n, r, this._options.attachStacktrace);
|
|
3414
|
+
}
|
|
3415
|
+
/**
|
|
3416
|
+
* @inheritDoc
|
|
3417
|
+
*/
|
|
3418
|
+
_prepareEvent(e, n, r, s) {
|
|
3419
|
+
return e.platform = e.platform || "javascript", super._prepareEvent(e, n, r, s);
|
|
3420
|
+
}
|
|
3421
|
+
}
|
|
3422
|
+
function pi(t) {
|
|
3423
|
+
return {
|
|
3424
|
+
release: typeof __SENTRY_RELEASE__ == "string" ? __SENTRY_RELEASE__ : y.SENTRY_RELEASE?.id,
|
|
3425
|
+
// This supports the variable that sentry-webpack-plugin injects
|
|
3426
|
+
sendClientReports: !0,
|
|
3427
|
+
// We default this to true, as it is the safer scenario
|
|
3428
|
+
parentSpanIsAlwaysRootSpan: !0,
|
|
3429
|
+
...t
|
|
3430
|
+
};
|
|
3431
|
+
}
|
|
3432
|
+
const hi = typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__, S = _, mi = 1e3;
|
|
3433
|
+
let ze, Ht, Gt;
|
|
3434
|
+
function gi(t) {
|
|
3435
|
+
j("dom", t), B("dom", _i);
|
|
3436
|
+
}
|
|
3437
|
+
function _i() {
|
|
3438
|
+
if (!S.document)
|
|
3439
|
+
return;
|
|
3440
|
+
const t = v.bind(null, "dom"), e = Xe(t, !0);
|
|
3441
|
+
S.document.addEventListener("click", e, !1), S.document.addEventListener("keypress", e, !1), ["EventTarget", "Node"].forEach((n) => {
|
|
3442
|
+
const s = S[n]?.prototype;
|
|
3443
|
+
s?.hasOwnProperty?.("addEventListener") && (T(s, "addEventListener", function(o) {
|
|
3444
|
+
return function(i, a, c) {
|
|
3445
|
+
if (i === "click" || i == "keypress")
|
|
3446
|
+
try {
|
|
3447
|
+
const u = this.__sentry_instrumentation_handlers__ = this.__sentry_instrumentation_handlers__ || {}, f = u[i] = u[i] || { refCount: 0 };
|
|
3448
|
+
if (!f.handler) {
|
|
3449
|
+
const l = Xe(t);
|
|
3450
|
+
f.handler = l, o.call(this, i, l, c);
|
|
3451
|
+
}
|
|
3452
|
+
f.refCount++;
|
|
3453
|
+
} catch {
|
|
3454
|
+
}
|
|
3455
|
+
return o.call(this, i, a, c);
|
|
3456
|
+
};
|
|
3457
|
+
}), T(
|
|
3458
|
+
s,
|
|
3459
|
+
"removeEventListener",
|
|
3460
|
+
function(o) {
|
|
3461
|
+
return function(i, a, c) {
|
|
3462
|
+
if (i === "click" || i == "keypress")
|
|
3463
|
+
try {
|
|
3464
|
+
const u = this.__sentry_instrumentation_handlers__ || {}, f = u[i];
|
|
3465
|
+
f && (f.refCount--, f.refCount <= 0 && (o.call(this, i, f.handler, c), f.handler = void 0, delete u[i]), Object.keys(u).length === 0 && delete this.__sentry_instrumentation_handlers__);
|
|
3466
|
+
} catch {
|
|
3467
|
+
}
|
|
3468
|
+
return o.call(this, i, a, c);
|
|
3469
|
+
};
|
|
3470
|
+
}
|
|
3471
|
+
));
|
|
3472
|
+
});
|
|
3473
|
+
}
|
|
3474
|
+
function yi(t) {
|
|
3475
|
+
if (t.type !== Ht)
|
|
3476
|
+
return !1;
|
|
3477
|
+
try {
|
|
3478
|
+
if (!t.target || t.target._sentryId !== Gt)
|
|
3479
|
+
return !1;
|
|
3480
|
+
} catch {
|
|
3481
|
+
}
|
|
3482
|
+
return !0;
|
|
3483
|
+
}
|
|
3484
|
+
function Ei(t, e) {
|
|
3485
|
+
return t !== "keypress" ? !1 : e?.tagName ? !(e.tagName === "INPUT" || e.tagName === "TEXTAREA" || e.isContentEditable) : !0;
|
|
3486
|
+
}
|
|
3487
|
+
function Xe(t, e = !1) {
|
|
3488
|
+
return (n) => {
|
|
3489
|
+
if (!n || n._sentryCaptured)
|
|
3490
|
+
return;
|
|
3491
|
+
const r = Si(n);
|
|
3492
|
+
if (Ei(n.type, r))
|
|
3493
|
+
return;
|
|
3494
|
+
F(n, "_sentryCaptured", !0), r && !r._sentryId && F(r, "_sentryId", I());
|
|
3495
|
+
const s = n.type === "keypress" ? "input" : n.type;
|
|
3496
|
+
yi(n) || (t({ event: n, name: s, global: e }), Ht = n.type, Gt = r ? r._sentryId : void 0), clearTimeout(ze), ze = S.setTimeout(() => {
|
|
3497
|
+
Gt = void 0, Ht = void 0;
|
|
3498
|
+
}, mi);
|
|
3499
|
+
};
|
|
3500
|
+
}
|
|
3501
|
+
function Si(t) {
|
|
3502
|
+
try {
|
|
3503
|
+
return t.target;
|
|
3504
|
+
} catch {
|
|
3505
|
+
return null;
|
|
3506
|
+
}
|
|
3507
|
+
}
|
|
3508
|
+
let it;
|
|
3509
|
+
function jn(t) {
|
|
3510
|
+
const e = "history";
|
|
3511
|
+
j(e, t), B(e, bi);
|
|
3512
|
+
}
|
|
3513
|
+
function bi() {
|
|
3514
|
+
if (S.addEventListener("popstate", () => {
|
|
3515
|
+
const e = S.location.href, n = it;
|
|
3516
|
+
if (it = e, n === e)
|
|
3517
|
+
return;
|
|
3518
|
+
v("history", { from: n, to: e });
|
|
3519
|
+
}), !Wo())
|
|
3520
|
+
return;
|
|
3521
|
+
function t(e) {
|
|
3522
|
+
return function(...n) {
|
|
3523
|
+
const r = n.length > 2 ? n[2] : void 0;
|
|
3524
|
+
if (r) {
|
|
3525
|
+
const s = it, o = Ti(String(r));
|
|
3526
|
+
if (it = o, s === o)
|
|
3527
|
+
return e.apply(this, n);
|
|
3528
|
+
v("history", { from: s, to: o });
|
|
3529
|
+
}
|
|
3530
|
+
return e.apply(this, n);
|
|
3531
|
+
};
|
|
3532
|
+
}
|
|
3533
|
+
T(S.history, "pushState", t), T(S.history, "replaceState", t);
|
|
3534
|
+
}
|
|
3535
|
+
function Ti(t) {
|
|
3536
|
+
try {
|
|
3537
|
+
return new URL(t, S.location.origin).toString();
|
|
3538
|
+
} catch {
|
|
3539
|
+
return t;
|
|
3540
|
+
}
|
|
3541
|
+
}
|
|
3542
|
+
const ft = {};
|
|
3543
|
+
function Ii(t) {
|
|
3544
|
+
const e = ft[t];
|
|
3545
|
+
if (e)
|
|
3546
|
+
return e;
|
|
3547
|
+
let n = S[t];
|
|
3548
|
+
if ($t(n))
|
|
3549
|
+
return ft[t] = n.bind(S);
|
|
3550
|
+
const r = S.document;
|
|
3551
|
+
if (r && typeof r.createElement == "function")
|
|
3552
|
+
try {
|
|
3553
|
+
const s = r.createElement("iframe");
|
|
3554
|
+
s.hidden = !0, r.head.appendChild(s);
|
|
3555
|
+
const o = s.contentWindow;
|
|
3556
|
+
o?.[t] && (n = o[t]), r.head.removeChild(s);
|
|
3557
|
+
} catch (s) {
|
|
3558
|
+
hi && p.warn(`Could not create sandbox iframe for ${t} check, bailing to window.${t}: `, s);
|
|
3559
|
+
}
|
|
3560
|
+
return n && (ft[t] = n.bind(S));
|
|
3561
|
+
}
|
|
3562
|
+
function Ke(t) {
|
|
3563
|
+
ft[t] = void 0;
|
|
3564
|
+
}
|
|
3565
|
+
const X = "__sentry_xhr_v3__";
|
|
3566
|
+
function vi(t) {
|
|
3567
|
+
j("xhr", t), B("xhr", wi);
|
|
3568
|
+
}
|
|
3569
|
+
function wi() {
|
|
3570
|
+
if (!S.XMLHttpRequest)
|
|
3571
|
+
return;
|
|
3572
|
+
const t = XMLHttpRequest.prototype;
|
|
3573
|
+
t.open = new Proxy(t.open, {
|
|
3574
|
+
apply(e, n, r) {
|
|
3575
|
+
const s = new Error(), o = x() * 1e3, i = A(r[0]) ? r[0].toUpperCase() : void 0, a = Ri(r[1]);
|
|
3576
|
+
if (!i || !a)
|
|
3577
|
+
return e.apply(n, r);
|
|
3578
|
+
n[X] = {
|
|
3579
|
+
method: i,
|
|
3580
|
+
url: a,
|
|
3581
|
+
request_headers: {}
|
|
3582
|
+
}, i === "POST" && a.match(/sentry_key/) && (n.__sentry_own_request__ = !0);
|
|
3583
|
+
const c = () => {
|
|
3584
|
+
const u = n[X];
|
|
3585
|
+
if (u && n.readyState === 4) {
|
|
3586
|
+
try {
|
|
3587
|
+
u.status_code = n.status;
|
|
3588
|
+
} catch {
|
|
3589
|
+
}
|
|
3590
|
+
const f = {
|
|
3591
|
+
endTimestamp: x() * 1e3,
|
|
3592
|
+
startTimestamp: o,
|
|
3593
|
+
xhr: n,
|
|
3594
|
+
virtualError: s
|
|
3595
|
+
};
|
|
3596
|
+
v("xhr", f);
|
|
3597
|
+
}
|
|
3598
|
+
};
|
|
3599
|
+
return "onreadystatechange" in n && typeof n.onreadystatechange == "function" ? n.onreadystatechange = new Proxy(n.onreadystatechange, {
|
|
3600
|
+
apply(u, f, l) {
|
|
3601
|
+
return c(), u.apply(f, l);
|
|
3602
|
+
}
|
|
3603
|
+
}) : n.addEventListener("readystatechange", c), n.setRequestHeader = new Proxy(n.setRequestHeader, {
|
|
3604
|
+
apply(u, f, l) {
|
|
3605
|
+
const [m, d] = l, E = f[X];
|
|
3606
|
+
return E && A(m) && A(d) && (E.request_headers[m.toLowerCase()] = d), u.apply(f, l);
|
|
3607
|
+
}
|
|
3608
|
+
}), e.apply(n, r);
|
|
3609
|
+
}
|
|
3610
|
+
}), t.send = new Proxy(t.send, {
|
|
3611
|
+
apply(e, n, r) {
|
|
3612
|
+
const s = n[X];
|
|
3613
|
+
if (!s)
|
|
3614
|
+
return e.apply(n, r);
|
|
3615
|
+
r[0] !== void 0 && (s.body = r[0]);
|
|
3616
|
+
const o = {
|
|
3617
|
+
startTimestamp: x() * 1e3,
|
|
3618
|
+
xhr: n
|
|
3619
|
+
};
|
|
3620
|
+
return v("xhr", o), e.apply(n, r);
|
|
3621
|
+
}
|
|
3622
|
+
});
|
|
3623
|
+
}
|
|
3624
|
+
function Ri(t) {
|
|
3625
|
+
if (A(t))
|
|
3626
|
+
return t;
|
|
3627
|
+
try {
|
|
3628
|
+
return t.toString();
|
|
3629
|
+
} catch {
|
|
3630
|
+
}
|
|
3631
|
+
}
|
|
3632
|
+
function ki(t, e = Ii("fetch")) {
|
|
3633
|
+
let n = 0, r = 0;
|
|
3634
|
+
function s(o) {
|
|
3635
|
+
const i = o.body.length;
|
|
3636
|
+
n += i, r++;
|
|
3637
|
+
const a = {
|
|
3638
|
+
body: o.body,
|
|
3639
|
+
method: "POST",
|
|
3640
|
+
referrerPolicy: "strict-origin",
|
|
3641
|
+
headers: t.headers,
|
|
3642
|
+
// Outgoing requests are usually cancelled when navigating to a different page, causing a "TypeError: Failed to
|
|
3643
|
+
// fetch" error and sending a "network_error" client-outcome - in Chrome, the request status shows "(cancelled)".
|
|
3644
|
+
// The `keepalive` flag keeps outgoing requests alive, even when switching pages. We want this since we're
|
|
3645
|
+
// frequently sending events right before the user is switching pages (eg. when finishing navigation transactions).
|
|
3646
|
+
// Gotchas:
|
|
3647
|
+
// - `keepalive` isn't supported by Firefox
|
|
3648
|
+
// - As per spec (https://fetch.spec.whatwg.org/#http-network-or-cache-fetch):
|
|
3649
|
+
// If the sum of contentLength and inflightKeepaliveBytes is greater than 64 kibibytes, then return a network error.
|
|
3650
|
+
// We will therefore only activate the flag when we're below that limit.
|
|
3651
|
+
// There is also a limit of requests that can be open at the same time, so we also limit this to 15
|
|
3652
|
+
// See https://github.com/getsentry/sentry-javascript/pull/7553 for details
|
|
3653
|
+
keepalive: n <= 6e4 && r < 15,
|
|
3654
|
+
...t.fetchOptions
|
|
3655
|
+
};
|
|
3656
|
+
if (!e)
|
|
3657
|
+
return Ke("fetch"), pt("No fetch implementation available");
|
|
3658
|
+
try {
|
|
3659
|
+
return e(t.url, a).then((c) => (n -= i, r--, {
|
|
3660
|
+
statusCode: c.status,
|
|
3661
|
+
headers: {
|
|
3662
|
+
"x-sentry-rate-limits": c.headers.get("X-Sentry-Rate-Limits"),
|
|
3663
|
+
"retry-after": c.headers.get("Retry-After")
|
|
3664
|
+
}
|
|
3665
|
+
}));
|
|
3666
|
+
} catch (c) {
|
|
3667
|
+
return Ke("fetch"), n -= i, r--, pt(c);
|
|
3668
|
+
}
|
|
3669
|
+
}
|
|
3670
|
+
return mo(t, s);
|
|
3671
|
+
}
|
|
3672
|
+
const Ai = 30, xi = 50;
|
|
3673
|
+
function Wt(t, e, n, r) {
|
|
3674
|
+
const s = {
|
|
3675
|
+
filename: t,
|
|
3676
|
+
function: e === "<anonymous>" ? M : e,
|
|
3677
|
+
in_app: !0
|
|
3678
|
+
// All browser frames are considered in_app
|
|
3679
|
+
};
|
|
3680
|
+
return n !== void 0 && (s.lineno = n), r !== void 0 && (s.colno = r), s;
|
|
3681
|
+
}
|
|
3682
|
+
const Oi = /^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i, Ni = /^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i, Ci = /\((\S*)(?::(\d+))(?::(\d+))\)/, Di = (t) => {
|
|
3683
|
+
const e = Oi.exec(t);
|
|
3684
|
+
if (e) {
|
|
3685
|
+
const [, r, s, o] = e;
|
|
3686
|
+
return Wt(r, M, +s, +o);
|
|
3687
|
+
}
|
|
3688
|
+
const n = Ni.exec(t);
|
|
3689
|
+
if (n) {
|
|
3690
|
+
if (n[2] && n[2].indexOf("eval") === 0) {
|
|
3691
|
+
const i = Ci.exec(n[2]);
|
|
3692
|
+
i && (n[2] = i[1], n[3] = i[2], n[4] = i[3]);
|
|
3693
|
+
}
|
|
3694
|
+
const [s, o] = Bn(n[1] || M, n[2]);
|
|
3695
|
+
return Wt(o, s, n[3] ? +n[3] : void 0, n[4] ? +n[4] : void 0);
|
|
3696
|
+
}
|
|
3697
|
+
}, Li = [Ai, Di], Pi = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i, Mi = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i, Fi = (t) => {
|
|
3698
|
+
const e = Pi.exec(t);
|
|
3699
|
+
if (e) {
|
|
3700
|
+
if (e[3] && e[3].indexOf(" > eval") > -1) {
|
|
3701
|
+
const o = Mi.exec(e[3]);
|
|
3702
|
+
o && (e[1] = e[1] || "eval", e[3] = o[1], e[4] = o[2], e[5] = "");
|
|
3703
|
+
}
|
|
3704
|
+
let r = e[3], s = e[1] || M;
|
|
3705
|
+
return [s, r] = Bn(s, r), Wt(r, s, e[4] ? +e[4] : void 0, e[5] ? +e[5] : void 0);
|
|
3706
|
+
}
|
|
3707
|
+
}, $i = [xi, Fi], Ui = [Li, $i], ji = sn(...Ui), Bn = (t, e) => {
|
|
3708
|
+
const n = t.indexOf("safari-extension") !== -1, r = t.indexOf("safari-web-extension") !== -1;
|
|
3709
|
+
return n || r ? [
|
|
3710
|
+
t.indexOf("@") !== -1 ? t.split("@")[0] : M,
|
|
3711
|
+
n ? `safari-extension:${e}` : `safari-web-extension:${e}`
|
|
3712
|
+
] : [t, e];
|
|
3713
|
+
}, bt = typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__, at = 1024, Bi = "Breadcrumbs", Hi = ((t = {}) => {
|
|
3714
|
+
const e = {
|
|
3715
|
+
console: !0,
|
|
3716
|
+
dom: !0,
|
|
3717
|
+
fetch: !0,
|
|
3718
|
+
history: !0,
|
|
3719
|
+
sentry: !0,
|
|
3720
|
+
xhr: !0,
|
|
3721
|
+
...t
|
|
3722
|
+
};
|
|
3723
|
+
return {
|
|
3724
|
+
name: Bi,
|
|
3725
|
+
setup(n) {
|
|
3726
|
+
e.console && Po(qi(n)), e.dom && gi(Wi(n, e.dom)), e.xhr && vi(Yi(n)), e.fetch && zo(zi(n)), e.history && jn(Xi(n)), e.sentry && n.on("beforeSendEvent", Gi(n));
|
|
3727
|
+
}
|
|
3728
|
+
};
|
|
3729
|
+
}), Hn = Hi;
|
|
3730
|
+
function Gi(t) {
|
|
3731
|
+
return function(n) {
|
|
3732
|
+
b() === t && U(
|
|
3733
|
+
{
|
|
3734
|
+
category: `sentry.${n.type === "transaction" ? "transaction" : "event"}`,
|
|
3735
|
+
event_id: n.event_id,
|
|
3736
|
+
level: n.level,
|
|
3737
|
+
message: L(n)
|
|
3738
|
+
},
|
|
3739
|
+
{
|
|
3740
|
+
event: n
|
|
3741
|
+
}
|
|
3742
|
+
);
|
|
3743
|
+
};
|
|
3744
|
+
}
|
|
3745
|
+
function Wi(t, e) {
|
|
3746
|
+
return function(r) {
|
|
3747
|
+
if (b() !== t)
|
|
3748
|
+
return;
|
|
3749
|
+
let s, o, i = typeof e == "object" ? e.serializeAttribute : void 0, a = typeof e == "object" && typeof e.maxStringLength == "number" ? e.maxStringLength : void 0;
|
|
3750
|
+
a && a > at && (bt && p.warn(
|
|
3751
|
+
`\`dom.maxStringLength\` cannot exceed ${at}, but a value of ${a} was configured. Sentry will use ${at} instead.`
|
|
3752
|
+
), a = at), typeof i == "string" && (i = [i]);
|
|
3753
|
+
try {
|
|
3754
|
+
const u = r.event, f = Ki(u) ? u.target : u;
|
|
3755
|
+
s = un(f, { keyAttrs: i, maxStringLength: a }), o = pr(f);
|
|
3756
|
+
} catch {
|
|
3757
|
+
s = "<unknown>";
|
|
3758
|
+
}
|
|
3759
|
+
if (s.length === 0)
|
|
3760
|
+
return;
|
|
3761
|
+
const c = {
|
|
3762
|
+
category: `ui.${r.name}`,
|
|
3763
|
+
message: s
|
|
3764
|
+
};
|
|
3765
|
+
o && (c.data = { "ui.component_name": o }), U(c, {
|
|
3766
|
+
event: r.event,
|
|
3767
|
+
name: r.name,
|
|
3768
|
+
global: r.global
|
|
3769
|
+
});
|
|
3770
|
+
};
|
|
3771
|
+
}
|
|
3772
|
+
function qi(t) {
|
|
3773
|
+
return function(n) {
|
|
3774
|
+
if (b() !== t)
|
|
3775
|
+
return;
|
|
3776
|
+
const r = {
|
|
3777
|
+
category: "console",
|
|
3778
|
+
data: {
|
|
3779
|
+
arguments: n.args,
|
|
3780
|
+
logger: "console"
|
|
3781
|
+
},
|
|
3782
|
+
level: Fo(n.level),
|
|
3783
|
+
message: de(n.args, " ")
|
|
3784
|
+
};
|
|
3785
|
+
if (n.level === "assert")
|
|
3786
|
+
if (n.args[0] === !1)
|
|
3787
|
+
r.message = `Assertion failed: ${de(n.args.slice(1), " ") || "console.assert"}`, r.data.arguments = n.args.slice(1);
|
|
3788
|
+
else
|
|
3789
|
+
return;
|
|
3790
|
+
U(r, {
|
|
3791
|
+
input: n.args,
|
|
3792
|
+
level: n.level
|
|
3793
|
+
});
|
|
3794
|
+
};
|
|
3795
|
+
}
|
|
3796
|
+
function Yi(t) {
|
|
3797
|
+
return function(n) {
|
|
3798
|
+
if (b() !== t)
|
|
3799
|
+
return;
|
|
3800
|
+
const { startTimestamp: r, endTimestamp: s } = n, o = n.xhr[X];
|
|
3801
|
+
if (!r || !s || !o)
|
|
3802
|
+
return;
|
|
3803
|
+
const { method: i, url: a, status_code: c, body: u } = o, f = {
|
|
3804
|
+
method: i,
|
|
3805
|
+
url: a,
|
|
3806
|
+
status_code: c
|
|
3807
|
+
}, l = {
|
|
3808
|
+
xhr: n.xhr,
|
|
3809
|
+
input: u,
|
|
3810
|
+
startTimestamp: r,
|
|
3811
|
+
endTimestamp: s
|
|
3812
|
+
}, m = {
|
|
3813
|
+
category: "xhr",
|
|
3814
|
+
data: f,
|
|
3815
|
+
type: "http",
|
|
3816
|
+
level: Fn(c)
|
|
3817
|
+
};
|
|
3818
|
+
t.emit("beforeOutgoingRequestBreadcrumb", m, l), U(m, l);
|
|
3819
|
+
};
|
|
3820
|
+
}
|
|
3821
|
+
function zi(t) {
|
|
3822
|
+
return function(n) {
|
|
3823
|
+
if (b() !== t)
|
|
3824
|
+
return;
|
|
3825
|
+
const { startTimestamp: r, endTimestamp: s } = n;
|
|
3826
|
+
if (s && !(n.fetchData.url.match(/sentry_key/) && n.fetchData.method === "POST"))
|
|
3827
|
+
if (n.fetchData.method, n.fetchData.url, n.error) {
|
|
3828
|
+
const o = n.fetchData, i = {
|
|
3829
|
+
data: n.error,
|
|
3830
|
+
input: n.args,
|
|
3831
|
+
startTimestamp: r,
|
|
3832
|
+
endTimestamp: s
|
|
3833
|
+
}, a = {
|
|
3834
|
+
category: "fetch",
|
|
3835
|
+
data: o,
|
|
3836
|
+
level: "error",
|
|
3837
|
+
type: "http"
|
|
3838
|
+
};
|
|
3839
|
+
t.emit("beforeOutgoingRequestBreadcrumb", a, i), U(a, i);
|
|
3840
|
+
} else {
|
|
3841
|
+
const o = n.response, i = {
|
|
3842
|
+
...n.fetchData,
|
|
3843
|
+
status_code: o?.status
|
|
3844
|
+
};
|
|
3845
|
+
n.fetchData.request_body_size, n.fetchData.response_body_size, o?.status;
|
|
3846
|
+
const a = {
|
|
3847
|
+
input: n.args,
|
|
3848
|
+
response: o,
|
|
3849
|
+
startTimestamp: r,
|
|
3850
|
+
endTimestamp: s
|
|
3851
|
+
}, c = {
|
|
3852
|
+
category: "fetch",
|
|
3853
|
+
data: i,
|
|
3854
|
+
type: "http",
|
|
3855
|
+
level: Fn(i.status_code)
|
|
3856
|
+
};
|
|
3857
|
+
t.emit("beforeOutgoingRequestBreadcrumb", c, a), U(c, a);
|
|
3858
|
+
}
|
|
3859
|
+
};
|
|
3860
|
+
}
|
|
3861
|
+
function Xi(t) {
|
|
3862
|
+
return function(n) {
|
|
3863
|
+
if (b() !== t)
|
|
3864
|
+
return;
|
|
3865
|
+
let r = n.from, s = n.to;
|
|
3866
|
+
const o = xt(y.location.href);
|
|
3867
|
+
let i = r ? xt(r) : void 0;
|
|
3868
|
+
const a = xt(s);
|
|
3869
|
+
i?.path || (i = o), o.protocol === a.protocol && o.host === a.host && (s = a.relative), o.protocol === i.protocol && o.host === i.host && (r = i.relative), U({
|
|
3870
|
+
category: "navigation",
|
|
3871
|
+
data: {
|
|
3872
|
+
from: r,
|
|
3873
|
+
to: s
|
|
3874
|
+
}
|
|
3875
|
+
});
|
|
3876
|
+
};
|
|
3877
|
+
}
|
|
3878
|
+
function Ki(t) {
|
|
3879
|
+
return !!t && !!t.target;
|
|
3880
|
+
}
|
|
3881
|
+
const Vi = [
|
|
3882
|
+
"EventTarget",
|
|
3883
|
+
"Window",
|
|
3884
|
+
"Node",
|
|
3885
|
+
"ApplicationCache",
|
|
3886
|
+
"AudioTrackList",
|
|
3887
|
+
"BroadcastChannel",
|
|
3888
|
+
"ChannelMergerNode",
|
|
3889
|
+
"CryptoOperation",
|
|
3890
|
+
"EventSource",
|
|
3891
|
+
"FileReader",
|
|
3892
|
+
"HTMLUnknownElement",
|
|
3893
|
+
"IDBDatabase",
|
|
3894
|
+
"IDBRequest",
|
|
3895
|
+
"IDBTransaction",
|
|
3896
|
+
"KeyOperation",
|
|
3897
|
+
"MediaController",
|
|
3898
|
+
"MessagePort",
|
|
3899
|
+
"ModalWindow",
|
|
3900
|
+
"Notification",
|
|
3901
|
+
"SVGElementInstance",
|
|
3902
|
+
"Screen",
|
|
3903
|
+
"SharedWorker",
|
|
3904
|
+
"TextTrack",
|
|
3905
|
+
"TextTrackCue",
|
|
3906
|
+
"TextTrackList",
|
|
3907
|
+
"WebSocket",
|
|
3908
|
+
"WebSocketWorker",
|
|
3909
|
+
"Worker",
|
|
3910
|
+
"XMLHttpRequest",
|
|
3911
|
+
"XMLHttpRequestEventTarget",
|
|
3912
|
+
"XMLHttpRequestUpload"
|
|
3913
|
+
], Ji = "BrowserApiErrors", Zi = ((t = {}) => {
|
|
3914
|
+
const e = {
|
|
3915
|
+
XMLHttpRequest: !0,
|
|
3916
|
+
eventTarget: !0,
|
|
3917
|
+
requestAnimationFrame: !0,
|
|
3918
|
+
setInterval: !0,
|
|
3919
|
+
setTimeout: !0,
|
|
3920
|
+
unregisterOriginalCallbacks: !1,
|
|
3921
|
+
...t
|
|
3922
|
+
};
|
|
3923
|
+
return {
|
|
3924
|
+
name: Ji,
|
|
3925
|
+
// TODO: This currently only works for the first client this is setup
|
|
3926
|
+
// We may want to adjust this to check for client etc.
|
|
3927
|
+
setupOnce() {
|
|
3928
|
+
e.setTimeout && T(y, "setTimeout", Ve), e.setInterval && T(y, "setInterval", Ve), e.requestAnimationFrame && T(y, "requestAnimationFrame", ta), e.XMLHttpRequest && "XMLHttpRequest" in y && T(XMLHttpRequest.prototype, "send", ea);
|
|
3929
|
+
const n = e.eventTarget;
|
|
3930
|
+
n && (Array.isArray(n) ? n : Vi).forEach((s) => na(s, e));
|
|
3931
|
+
}
|
|
3932
|
+
};
|
|
3933
|
+
}), Qi = Zi;
|
|
3934
|
+
function Ve(t) {
|
|
3935
|
+
return function(...e) {
|
|
3936
|
+
const n = e[0];
|
|
3937
|
+
return e[0] = q(n, {
|
|
3938
|
+
mechanism: {
|
|
3939
|
+
data: { function: O(t) },
|
|
3940
|
+
handled: !1,
|
|
3941
|
+
type: "instrument"
|
|
3942
|
+
}
|
|
3943
|
+
}), t.apply(this, e);
|
|
3944
|
+
};
|
|
3945
|
+
}
|
|
3946
|
+
function ta(t) {
|
|
3947
|
+
return function(e) {
|
|
3948
|
+
return t.apply(this, [
|
|
3949
|
+
q(e, {
|
|
3950
|
+
mechanism: {
|
|
3951
|
+
data: {
|
|
3952
|
+
function: "requestAnimationFrame",
|
|
3953
|
+
handler: O(t)
|
|
3954
|
+
},
|
|
3955
|
+
handled: !1,
|
|
3956
|
+
type: "instrument"
|
|
3957
|
+
}
|
|
3958
|
+
})
|
|
3959
|
+
]);
|
|
3960
|
+
};
|
|
3961
|
+
}
|
|
3962
|
+
function ea(t) {
|
|
3963
|
+
return function(...e) {
|
|
3964
|
+
const n = this;
|
|
3965
|
+
return ["onload", "onerror", "onprogress", "onreadystatechange"].forEach((s) => {
|
|
3966
|
+
s in n && typeof n[s] == "function" && T(n, s, function(o) {
|
|
3967
|
+
const i = {
|
|
3968
|
+
mechanism: {
|
|
3969
|
+
data: {
|
|
3970
|
+
function: s,
|
|
3971
|
+
handler: O(o)
|
|
3972
|
+
},
|
|
3973
|
+
handled: !1,
|
|
3974
|
+
type: "instrument"
|
|
3975
|
+
}
|
|
3976
|
+
}, a = Zt(o);
|
|
3977
|
+
return a && (i.mechanism.data.handler = O(a)), q(o, i);
|
|
3978
|
+
});
|
|
3979
|
+
}), t.apply(this, e);
|
|
3980
|
+
};
|
|
3981
|
+
}
|
|
3982
|
+
function na(t, e) {
|
|
3983
|
+
const r = y[t]?.prototype;
|
|
3984
|
+
r?.hasOwnProperty?.("addEventListener") && (T(r, "addEventListener", function(s) {
|
|
3985
|
+
return function(o, i, a) {
|
|
3986
|
+
try {
|
|
3987
|
+
ra(i) && (i.handleEvent = q(i.handleEvent, {
|
|
3988
|
+
mechanism: {
|
|
3989
|
+
data: {
|
|
3990
|
+
function: "handleEvent",
|
|
3991
|
+
handler: O(i),
|
|
3992
|
+
target: t
|
|
3993
|
+
},
|
|
3994
|
+
handled: !1,
|
|
3995
|
+
type: "instrument"
|
|
3996
|
+
}
|
|
3997
|
+
}));
|
|
3998
|
+
} catch {
|
|
3999
|
+
}
|
|
4000
|
+
return e.unregisterOriginalCallbacks && sa(this, o, i), s.apply(this, [
|
|
4001
|
+
o,
|
|
4002
|
+
q(i, {
|
|
4003
|
+
mechanism: {
|
|
4004
|
+
data: {
|
|
4005
|
+
function: "addEventListener",
|
|
4006
|
+
handler: O(i),
|
|
4007
|
+
target: t
|
|
4008
|
+
},
|
|
4009
|
+
handled: !1,
|
|
4010
|
+
type: "instrument"
|
|
4011
|
+
}
|
|
4012
|
+
}),
|
|
4013
|
+
a
|
|
4014
|
+
]);
|
|
4015
|
+
};
|
|
4016
|
+
}), T(r, "removeEventListener", function(s) {
|
|
4017
|
+
return function(o, i, a) {
|
|
4018
|
+
try {
|
|
4019
|
+
const c = i.__sentry_wrapped__;
|
|
4020
|
+
c && s.call(this, o, c, a);
|
|
4021
|
+
} catch {
|
|
4022
|
+
}
|
|
4023
|
+
return s.call(this, o, i, a);
|
|
4024
|
+
};
|
|
4025
|
+
}));
|
|
4026
|
+
}
|
|
4027
|
+
function ra(t) {
|
|
4028
|
+
return typeof t.handleEvent == "function";
|
|
4029
|
+
}
|
|
4030
|
+
function sa(t, e, n) {
|
|
4031
|
+
t && typeof t == "object" && "removeEventListener" in t && typeof t.removeEventListener == "function" && t.removeEventListener(e, n);
|
|
4032
|
+
}
|
|
4033
|
+
const oa = () => ({
|
|
4034
|
+
name: "BrowserSession",
|
|
4035
|
+
setupOnce() {
|
|
4036
|
+
if (typeof y.document > "u") {
|
|
4037
|
+
bt && p.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");
|
|
4038
|
+
return;
|
|
4039
|
+
}
|
|
4040
|
+
Ce({ ignoreDuration: !0 }), De(), jn(({ from: t, to: e }) => {
|
|
4041
|
+
t !== void 0 && t !== e && (Ce({ ignoreDuration: !0 }), De());
|
|
4042
|
+
});
|
|
4043
|
+
}
|
|
4044
|
+
}), ia = "GlobalHandlers", aa = ((t = {}) => {
|
|
4045
|
+
const e = {
|
|
4046
|
+
onerror: !0,
|
|
4047
|
+
onunhandledrejection: !0,
|
|
4048
|
+
...t
|
|
4049
|
+
};
|
|
4050
|
+
return {
|
|
4051
|
+
name: ia,
|
|
4052
|
+
setupOnce() {
|
|
4053
|
+
Error.stackTraceLimit = 50;
|
|
4054
|
+
},
|
|
4055
|
+
setup(n) {
|
|
4056
|
+
e.onerror && (ua(n), Je("onerror")), e.onunhandledrejection && (fa(n), Je("onunhandledrejection"));
|
|
4057
|
+
}
|
|
4058
|
+
};
|
|
4059
|
+
}), ca = aa;
|
|
4060
|
+
function ua(t) {
|
|
4061
|
+
nr((e) => {
|
|
4062
|
+
const { stackParser: n, attachStacktrace: r } = Gn();
|
|
4063
|
+
if (b() !== t || $n())
|
|
4064
|
+
return;
|
|
4065
|
+
const { msg: s, url: o, line: i, column: a, error: c } = e, u = pa(
|
|
4066
|
+
se(n, c || s, void 0, r, !1),
|
|
4067
|
+
o,
|
|
4068
|
+
i,
|
|
4069
|
+
a
|
|
4070
|
+
);
|
|
4071
|
+
u.level = "error", wn(u, {
|
|
4072
|
+
originalException: c,
|
|
4073
|
+
mechanism: {
|
|
4074
|
+
handled: !1,
|
|
4075
|
+
type: "onerror"
|
|
4076
|
+
}
|
|
4077
|
+
});
|
|
4078
|
+
});
|
|
4079
|
+
}
|
|
4080
|
+
function fa(t) {
|
|
4081
|
+
sr((e) => {
|
|
4082
|
+
const { stackParser: n, attachStacktrace: r } = Gn();
|
|
4083
|
+
if (b() !== t || $n())
|
|
4084
|
+
return;
|
|
4085
|
+
const s = la(e), o = Kt(s) ? da(s) : se(n, s, void 0, r, !0);
|
|
4086
|
+
o.level = "error", wn(o, {
|
|
4087
|
+
originalException: s,
|
|
4088
|
+
mechanism: {
|
|
4089
|
+
handled: !1,
|
|
4090
|
+
type: "onunhandledrejection"
|
|
4091
|
+
}
|
|
4092
|
+
});
|
|
4093
|
+
});
|
|
4094
|
+
}
|
|
4095
|
+
function la(t) {
|
|
4096
|
+
if (Kt(t))
|
|
4097
|
+
return t;
|
|
4098
|
+
try {
|
|
4099
|
+
if ("reason" in t)
|
|
4100
|
+
return t.reason;
|
|
4101
|
+
if ("detail" in t && "reason" in t.detail)
|
|
4102
|
+
return t.detail.reason;
|
|
4103
|
+
} catch {
|
|
4104
|
+
}
|
|
4105
|
+
return t;
|
|
4106
|
+
}
|
|
4107
|
+
function da(t) {
|
|
4108
|
+
return {
|
|
4109
|
+
exception: {
|
|
4110
|
+
values: [
|
|
4111
|
+
{
|
|
4112
|
+
type: "UnhandledRejection",
|
|
4113
|
+
// String() is needed because the Primitive type includes symbols (which can't be automatically stringified)
|
|
4114
|
+
value: `Non-Error promise rejection captured with value: ${String(t)}`
|
|
4115
|
+
}
|
|
4116
|
+
]
|
|
4117
|
+
}
|
|
4118
|
+
};
|
|
4119
|
+
}
|
|
4120
|
+
function pa(t, e, n, r) {
|
|
4121
|
+
const s = t.exception = t.exception || {}, o = s.values = s.values || [], i = o[0] = o[0] || {}, a = i.stacktrace = i.stacktrace || {}, c = a.frames = a.frames || [], u = r, f = n, l = A(e) && e.length > 0 ? e : Jt();
|
|
4122
|
+
return c.length === 0 && c.push({
|
|
4123
|
+
colno: u,
|
|
4124
|
+
filename: l,
|
|
4125
|
+
function: M,
|
|
4126
|
+
in_app: !0,
|
|
4127
|
+
lineno: f
|
|
4128
|
+
}), t;
|
|
4129
|
+
}
|
|
4130
|
+
function Je(t) {
|
|
4131
|
+
bt && p.log(`Global Handler attached: ${t}`);
|
|
4132
|
+
}
|
|
4133
|
+
function Gn() {
|
|
4134
|
+
return b()?.getOptions() || {
|
|
4135
|
+
stackParser: () => [],
|
|
4136
|
+
attachStacktrace: !1
|
|
4137
|
+
};
|
|
4138
|
+
}
|
|
4139
|
+
const ha = () => ({
|
|
4140
|
+
name: "HttpContext",
|
|
4141
|
+
preprocessEvent(t) {
|
|
4142
|
+
if (!y.navigator && !y.location && !y.document)
|
|
4143
|
+
return;
|
|
4144
|
+
const e = Qo(), n = {
|
|
4145
|
+
...e.headers,
|
|
4146
|
+
...t.request?.headers
|
|
4147
|
+
};
|
|
4148
|
+
t.request = {
|
|
4149
|
+
...e,
|
|
4150
|
+
...t.request,
|
|
4151
|
+
headers: n
|
|
4152
|
+
};
|
|
4153
|
+
}
|
|
4154
|
+
}), ma = "cause", ga = 5, _a = "LinkedErrors", ya = ((t = {}) => {
|
|
4155
|
+
const e = t.limit || ga, n = t.key || ma;
|
|
4156
|
+
return {
|
|
4157
|
+
name: _a,
|
|
4158
|
+
preprocessEvent(r, s, o) {
|
|
4159
|
+
const i = o.getOptions();
|
|
4160
|
+
Lo(
|
|
4161
|
+
// This differs from the LinkedErrors integration in core by using a different exceptionFromError function
|
|
4162
|
+
ne,
|
|
4163
|
+
i.stackParser,
|
|
4164
|
+
n,
|
|
4165
|
+
e,
|
|
4166
|
+
r,
|
|
4167
|
+
s
|
|
4168
|
+
);
|
|
4169
|
+
}
|
|
4170
|
+
};
|
|
4171
|
+
}), Ea = ya;
|
|
4172
|
+
function Sa() {
|
|
4173
|
+
return ba() ? (bt && Y(() => {
|
|
4174
|
+
console.error(
|
|
4175
|
+
"[Sentry] You cannot use Sentry.init() in a browser extension, see: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/"
|
|
4176
|
+
);
|
|
4177
|
+
}), !0) : !1;
|
|
4178
|
+
}
|
|
4179
|
+
function ba() {
|
|
4180
|
+
if (typeof y.window > "u")
|
|
4181
|
+
return !1;
|
|
4182
|
+
const t = y;
|
|
4183
|
+
if (t.nw || !(t.chrome || t.browser)?.runtime?.id)
|
|
4184
|
+
return !1;
|
|
4185
|
+
const n = Jt(), r = ["chrome-extension", "moz-extension", "ms-browser-extension", "safari-web-extension"];
|
|
4186
|
+
return !(y === y.top && r.some((o) => n.startsWith(`${o}://`)));
|
|
4187
|
+
}
|
|
4188
|
+
function Ta(t) {
|
|
4189
|
+
return [
|
|
4190
|
+
// TODO(v10): Replace with `eventFiltersIntegration` once we remove the deprecated `inboundFiltersIntegration`
|
|
4191
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
4192
|
+
Ro(),
|
|
4193
|
+
To(),
|
|
4194
|
+
Qi(),
|
|
4195
|
+
Hn(),
|
|
4196
|
+
ca(),
|
|
4197
|
+
Ea(),
|
|
4198
|
+
jo(),
|
|
4199
|
+
ha(),
|
|
4200
|
+
oa()
|
|
4201
|
+
];
|
|
4202
|
+
}
|
|
4203
|
+
function Ia(t = {}) {
|
|
4204
|
+
const e = !t.skipBrowserExtensionCheck && Sa(), n = {
|
|
4205
|
+
...t,
|
|
4206
|
+
enabled: e ? !1 : t.enabled,
|
|
4207
|
+
stackParser: tr(t.stackParser || ji),
|
|
4208
|
+
integrations: Xs({
|
|
4209
|
+
integrations: t.integrations,
|
|
4210
|
+
defaultIntegrations: t.defaultIntegrations == null ? Ta() : t.defaultIntegrations
|
|
4211
|
+
}),
|
|
4212
|
+
transport: t.transport || ki
|
|
4213
|
+
};
|
|
4214
|
+
return oo(di, n);
|
|
4215
|
+
}
|
|
4216
|
+
const va = "https://005d25250a41bd0071570b0c0a2b2c4d@o4510467570073600.ingest.us.sentry.io/4510472944156672";
|
|
4217
|
+
let Ze = !1;
|
|
4218
|
+
function Da() {
|
|
4219
|
+
Ze || (Ia({
|
|
4220
|
+
dsn: va,
|
|
4221
|
+
// Only capture errors, not performance data.
|
|
4222
|
+
tracesSampleRate: 0,
|
|
4223
|
+
// Minimal breadcrumbs to reduce noise.
|
|
4224
|
+
integrations: [
|
|
4225
|
+
Hn({
|
|
4226
|
+
console: !1,
|
|
4227
|
+
dom: !0,
|
|
4228
|
+
fetch: !0,
|
|
4229
|
+
history: !1,
|
|
4230
|
+
xhr: !1
|
|
4231
|
+
})
|
|
4232
|
+
],
|
|
4233
|
+
// Tag all events as coming from the widget.
|
|
4234
|
+
initialScope: {
|
|
4235
|
+
tags: {
|
|
4236
|
+
source: "knest-widget"
|
|
4237
|
+
}
|
|
4238
|
+
}
|
|
4239
|
+
}), Ze = !0);
|
|
4240
|
+
}
|
|
4241
|
+
function La(t, e) {
|
|
4242
|
+
const n = typeof t == "string" ? new Error(t) : t;
|
|
4243
|
+
vn(n, {
|
|
4244
|
+
tags: { source: "knest-widget" },
|
|
4245
|
+
extra: e
|
|
4246
|
+
});
|
|
4247
|
+
}
|
|
85
4248
|
export {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
4249
|
+
en as API_PATH,
|
|
4250
|
+
Ra as DEFAULT_AVATAR_URL,
|
|
4251
|
+
tn as DEFAULT_BASE_URL,
|
|
4252
|
+
ka as DEFAULT_BRAND_COLOR,
|
|
4253
|
+
ie as DEFAULT_ERROR_MESSAGE,
|
|
4254
|
+
xa as DEFAULT_EXAMPLE_QUESTIONS,
|
|
4255
|
+
Aa as DEFAULT_WELCOME_MESSAGE,
|
|
4256
|
+
Yn as FALLBACK_ERROR_MESSAGE,
|
|
4257
|
+
La as captureWidgetException,
|
|
4258
|
+
Oa as fetchWidgetConfig,
|
|
4259
|
+
Ca as formatContent,
|
|
4260
|
+
Wn as getChatApiUrl,
|
|
4261
|
+
qn as getConfigApiUrl,
|
|
4262
|
+
Da as initWidgetSentry,
|
|
4263
|
+
Na as streamChatMessage
|
|
98
4264
|
};
|