@eloquentai/chat-sdk 0.37.0-dev.3 → 0.37.0-dev.5
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/contexts/error-handling/error-context.d.ts +1 -1
- package/dist/contexts/error-handling/error-provider.d.ts +2 -1
- package/dist/index-BtNTB0jt.js +2697 -0
- package/dist/index-BtNTB0jt.js.map +1 -0
- package/dist/index.mjs +962 -889
- package/dist/index.mjs.map +1 -1
- package/dist/lib/error-reporting.d.ts +25 -0
- package/dist/lib/http.d.ts +12 -2
- package/dist/{skeleton-DJDQ11eO.js → skeleton-Lf4Nqzua.js} +281 -270
- package/dist/{skeleton-DJDQ11eO.js.map → skeleton-Lf4Nqzua.js.map} +1 -1
- package/dist/ui.mjs +1 -1
- package/package.json +1 -1
- package/dist/index-hFbiYJI3.js +0 -4165
- package/dist/index-hFbiYJI3.js.map +0 -1
- package/dist/instrumentation.d.ts +0 -1
|
@@ -0,0 +1,2697 @@
|
|
|
1
|
+
try {
|
|
2
|
+
let t = typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : {}, e = new t.Error().stack;
|
|
3
|
+
e && (t._sentryDebugIds = t._sentryDebugIds || {}, t._sentryDebugIds[e] = "f2aa53b5-f8af-4d68-bed4-b343a32f6ad0", t._sentryDebugIdIdentifier = "sentry-dbid-f2aa53b5-f8af-4d68-bed4-b343a32f6ad0");
|
|
4
|
+
} catch {
|
|
5
|
+
}
|
|
6
|
+
const _ = typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__, y = globalThis, T = "9.47.1";
|
|
7
|
+
function ft() {
|
|
8
|
+
return z(y), y;
|
|
9
|
+
}
|
|
10
|
+
function z(t) {
|
|
11
|
+
const e = t.__SENTRY__ = t.__SENTRY__ || {};
|
|
12
|
+
return e.version = e.version || T, e[T] = e[T] || {};
|
|
13
|
+
}
|
|
14
|
+
function C(t, e, n = y) {
|
|
15
|
+
const r = n.__SENTRY__ = n.__SENTRY__ || {}, s = r[T] = r[T] || {};
|
|
16
|
+
return s[t] || (s[t] = e());
|
|
17
|
+
}
|
|
18
|
+
const Oe = "Sentry Logger ", St = {};
|
|
19
|
+
function pt(t) {
|
|
20
|
+
if (!("console" in y))
|
|
21
|
+
return t();
|
|
22
|
+
const e = y.console, n = {}, r = Object.keys(St);
|
|
23
|
+
r.forEach((s) => {
|
|
24
|
+
const i = St[s];
|
|
25
|
+
n[s] = e[s], e[s] = i;
|
|
26
|
+
});
|
|
27
|
+
try {
|
|
28
|
+
return t();
|
|
29
|
+
} finally {
|
|
30
|
+
r.forEach((s) => {
|
|
31
|
+
e[s] = n[s];
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function Ne() {
|
|
36
|
+
lt().enabled = !0;
|
|
37
|
+
}
|
|
38
|
+
function De() {
|
|
39
|
+
lt().enabled = !1;
|
|
40
|
+
}
|
|
41
|
+
function qt() {
|
|
42
|
+
return lt().enabled;
|
|
43
|
+
}
|
|
44
|
+
function Ce(...t) {
|
|
45
|
+
dt("log", ...t);
|
|
46
|
+
}
|
|
47
|
+
function xe(...t) {
|
|
48
|
+
dt("warn", ...t);
|
|
49
|
+
}
|
|
50
|
+
function Pe(...t) {
|
|
51
|
+
dt("error", ...t);
|
|
52
|
+
}
|
|
53
|
+
function dt(t, ...e) {
|
|
54
|
+
_ && qt() && pt(() => {
|
|
55
|
+
y.console[t](`${Oe}[${t}]:`, ...e);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function lt() {
|
|
59
|
+
return _ ? C("loggerSettings", () => ({ enabled: !1 })) : { enabled: !1 };
|
|
60
|
+
}
|
|
61
|
+
const l = {
|
|
62
|
+
/** Enable logging. */
|
|
63
|
+
enable: Ne,
|
|
64
|
+
/** Disable logging. */
|
|
65
|
+
disable: De,
|
|
66
|
+
/** Check if logging is enabled. */
|
|
67
|
+
isEnabled: qt,
|
|
68
|
+
/** Log a message. */
|
|
69
|
+
log: Ce,
|
|
70
|
+
/** Log a warning. */
|
|
71
|
+
warn: xe,
|
|
72
|
+
/** Log an error. */
|
|
73
|
+
error: Pe
|
|
74
|
+
}, Zt = 50, k = "?", bt = /\(error: (.*)\)/, It = /captureMessage|captureException/;
|
|
75
|
+
function we(...t) {
|
|
76
|
+
const e = t.sort((n, r) => n[0] - r[0]).map((n) => n[1]);
|
|
77
|
+
return (n, r = 0, s = 0) => {
|
|
78
|
+
const i = [], o = n.split(`
|
|
79
|
+
`);
|
|
80
|
+
for (let a = r; a < o.length; a++) {
|
|
81
|
+
const c = o[a];
|
|
82
|
+
if (c.length > 1024)
|
|
83
|
+
continue;
|
|
84
|
+
const u = bt.test(c) ? c.replace(bt, "$1") : c;
|
|
85
|
+
if (!u.match(/\S*Error: /)) {
|
|
86
|
+
for (const d of e) {
|
|
87
|
+
const f = d(u);
|
|
88
|
+
if (f) {
|
|
89
|
+
i.push(f);
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (i.length >= Zt + s)
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return Me(i.slice(s));
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
function Me(t) {
|
|
101
|
+
if (!t.length)
|
|
102
|
+
return [];
|
|
103
|
+
const e = Array.from(t);
|
|
104
|
+
return /sentryWrapped/.test(M(e).function || "") && e.pop(), e.reverse(), It.test(M(e).function || "") && (e.pop(), It.test(M(e).function || "") && e.pop()), e.slice(0, Zt).map((n) => ({
|
|
105
|
+
...n,
|
|
106
|
+
filename: n.filename || M(e).filename,
|
|
107
|
+
function: n.function || k
|
|
108
|
+
}));
|
|
109
|
+
}
|
|
110
|
+
function M(t) {
|
|
111
|
+
return t[t.length - 1] || {};
|
|
112
|
+
}
|
|
113
|
+
const q = "<anonymous>";
|
|
114
|
+
function Le(t) {
|
|
115
|
+
try {
|
|
116
|
+
return !t || typeof t != "function" ? q : t.name || q;
|
|
117
|
+
} catch {
|
|
118
|
+
return q;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
const Qt = Object.prototype.toString;
|
|
122
|
+
function te(t) {
|
|
123
|
+
switch (Qt.call(t)) {
|
|
124
|
+
case "[object Error]":
|
|
125
|
+
case "[object Exception]":
|
|
126
|
+
case "[object DOMException]":
|
|
127
|
+
case "[object WebAssembly.Exception]":
|
|
128
|
+
return !0;
|
|
129
|
+
default:
|
|
130
|
+
return K(t, Error);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
function x(t, e) {
|
|
134
|
+
return Qt.call(t) === `[object ${e}]`;
|
|
135
|
+
}
|
|
136
|
+
function ee(t) {
|
|
137
|
+
return x(t, "ErrorEvent");
|
|
138
|
+
}
|
|
139
|
+
function Tt(t) {
|
|
140
|
+
return x(t, "DOMError");
|
|
141
|
+
}
|
|
142
|
+
function $e(t) {
|
|
143
|
+
return x(t, "DOMException");
|
|
144
|
+
}
|
|
145
|
+
function ne(t) {
|
|
146
|
+
return x(t, "String");
|
|
147
|
+
}
|
|
148
|
+
function _t(t) {
|
|
149
|
+
return typeof t == "object" && t !== null && "__sentry_template_string__" in t && "__sentry_template_values__" in t;
|
|
150
|
+
}
|
|
151
|
+
function Fe(t) {
|
|
152
|
+
return t === null || _t(t) || typeof t != "object" && typeof t != "function";
|
|
153
|
+
}
|
|
154
|
+
function N(t) {
|
|
155
|
+
return x(t, "Object");
|
|
156
|
+
}
|
|
157
|
+
function W(t) {
|
|
158
|
+
return typeof Event < "u" && K(t, Event);
|
|
159
|
+
}
|
|
160
|
+
function je(t) {
|
|
161
|
+
return typeof Element < "u" && K(t, Element);
|
|
162
|
+
}
|
|
163
|
+
function V(t) {
|
|
164
|
+
return !!(t?.then && typeof t.then == "function");
|
|
165
|
+
}
|
|
166
|
+
function Ue(t) {
|
|
167
|
+
return N(t) && "nativeEvent" in t && "preventDefault" in t && "stopPropagation" in t;
|
|
168
|
+
}
|
|
169
|
+
function K(t, e) {
|
|
170
|
+
try {
|
|
171
|
+
return t instanceof e;
|
|
172
|
+
} catch {
|
|
173
|
+
return !1;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
function Be(t) {
|
|
177
|
+
return !!(typeof t == "object" && t !== null && (t.__isVue || t._isVue));
|
|
178
|
+
}
|
|
179
|
+
const Ye = y, Ge = 80;
|
|
180
|
+
function ze(t, e = {}) {
|
|
181
|
+
if (!t)
|
|
182
|
+
return "<unknown>";
|
|
183
|
+
try {
|
|
184
|
+
let n = t;
|
|
185
|
+
const r = 5, s = [];
|
|
186
|
+
let i = 0, o = 0;
|
|
187
|
+
const a = " > ", c = a.length;
|
|
188
|
+
let u;
|
|
189
|
+
const d = Array.isArray(e) ? e : e.keyAttrs, f = !Array.isArray(e) && e.maxStringLength || Ge;
|
|
190
|
+
for (; n && i++ < r && (u = We(n, d), !(u === "html" || i > 1 && o + s.length * c + u.length >= f)); )
|
|
191
|
+
s.push(u), o += u.length, n = n.parentNode;
|
|
192
|
+
return s.reverse().join(a);
|
|
193
|
+
} catch {
|
|
194
|
+
return "<unknown>";
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
function We(t, e) {
|
|
198
|
+
const n = t, r = [];
|
|
199
|
+
if (!n?.tagName)
|
|
200
|
+
return "";
|
|
201
|
+
if (Ye.HTMLElement && n instanceof HTMLElement && n.dataset) {
|
|
202
|
+
if (n.dataset.sentryComponent)
|
|
203
|
+
return n.dataset.sentryComponent;
|
|
204
|
+
if (n.dataset.sentryElement)
|
|
205
|
+
return n.dataset.sentryElement;
|
|
206
|
+
}
|
|
207
|
+
r.push(n.tagName.toLowerCase());
|
|
208
|
+
const s = e?.length ? e.filter((o) => n.getAttribute(o)).map((o) => [o, n.getAttribute(o)]) : null;
|
|
209
|
+
if (s?.length)
|
|
210
|
+
s.forEach((o) => {
|
|
211
|
+
r.push(`[${o[0]}="${o[1]}"]`);
|
|
212
|
+
});
|
|
213
|
+
else {
|
|
214
|
+
n.id && r.push(`#${n.id}`);
|
|
215
|
+
const o = n.className;
|
|
216
|
+
if (o && ne(o)) {
|
|
217
|
+
const a = o.split(/\s+/);
|
|
218
|
+
for (const c of a)
|
|
219
|
+
r.push(`.${c}`);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
const i = ["aria-label", "type", "name", "title", "alt"];
|
|
223
|
+
for (const o of i) {
|
|
224
|
+
const a = n.getAttribute(o);
|
|
225
|
+
a && r.push(`[${o}="${a}"]`);
|
|
226
|
+
}
|
|
227
|
+
return r.join("");
|
|
228
|
+
}
|
|
229
|
+
function Y(t, e = 0) {
|
|
230
|
+
return typeof t != "string" || e === 0 || t.length <= e ? t : `${t.slice(0, e)}...`;
|
|
231
|
+
}
|
|
232
|
+
function re(t, e, n) {
|
|
233
|
+
try {
|
|
234
|
+
Object.defineProperty(t, e, {
|
|
235
|
+
// enumerable: false, // the default, so we can save on bundle size by not explicitly setting it
|
|
236
|
+
value: n,
|
|
237
|
+
writable: !0,
|
|
238
|
+
configurable: !0
|
|
239
|
+
});
|
|
240
|
+
} catch {
|
|
241
|
+
_ && l.log(`Failed to add non-enumerable property "${e}" to object`, t);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
function se(t) {
|
|
245
|
+
if (te(t))
|
|
246
|
+
return {
|
|
247
|
+
message: t.message,
|
|
248
|
+
name: t.name,
|
|
249
|
+
stack: t.stack,
|
|
250
|
+
...kt(t)
|
|
251
|
+
};
|
|
252
|
+
if (W(t)) {
|
|
253
|
+
const e = {
|
|
254
|
+
type: t.type,
|
|
255
|
+
target: vt(t.target),
|
|
256
|
+
currentTarget: vt(t.currentTarget),
|
|
257
|
+
...kt(t)
|
|
258
|
+
};
|
|
259
|
+
return typeof CustomEvent < "u" && K(t, CustomEvent) && (e.detail = t.detail), e;
|
|
260
|
+
} else
|
|
261
|
+
return t;
|
|
262
|
+
}
|
|
263
|
+
function vt(t) {
|
|
264
|
+
try {
|
|
265
|
+
return je(t) ? ze(t) : Object.prototype.toString.call(t);
|
|
266
|
+
} catch {
|
|
267
|
+
return "<unknown>";
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
function kt(t) {
|
|
271
|
+
if (typeof t == "object" && t !== null) {
|
|
272
|
+
const e = {};
|
|
273
|
+
for (const n in t)
|
|
274
|
+
Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
|
|
275
|
+
return e;
|
|
276
|
+
} else
|
|
277
|
+
return {};
|
|
278
|
+
}
|
|
279
|
+
function Ve(t, e = 40) {
|
|
280
|
+
const n = Object.keys(se(t));
|
|
281
|
+
n.sort();
|
|
282
|
+
const r = n[0];
|
|
283
|
+
if (!r)
|
|
284
|
+
return "[object has no keys]";
|
|
285
|
+
if (r.length >= e)
|
|
286
|
+
return Y(r, e);
|
|
287
|
+
for (let s = n.length; s > 0; s--) {
|
|
288
|
+
const i = n.slice(0, s).join(", ");
|
|
289
|
+
if (!(i.length > e))
|
|
290
|
+
return s === n.length ? i : Y(i, e);
|
|
291
|
+
}
|
|
292
|
+
return "";
|
|
293
|
+
}
|
|
294
|
+
function Ke() {
|
|
295
|
+
const t = y;
|
|
296
|
+
return t.crypto || t.msCrypto;
|
|
297
|
+
}
|
|
298
|
+
function E(t = Ke()) {
|
|
299
|
+
let e = () => Math.random() * 16;
|
|
300
|
+
try {
|
|
301
|
+
if (t?.randomUUID)
|
|
302
|
+
return t.randomUUID().replace(/-/g, "");
|
|
303
|
+
t?.getRandomValues && (e = () => {
|
|
304
|
+
const n = new Uint8Array(1);
|
|
305
|
+
return t.getRandomValues(n), n[0];
|
|
306
|
+
});
|
|
307
|
+
} catch {
|
|
308
|
+
}
|
|
309
|
+
return ("10000000100040008000" + 1e11).replace(
|
|
310
|
+
/[018]/g,
|
|
311
|
+
(n) => (
|
|
312
|
+
// eslint-disable-next-line no-bitwise
|
|
313
|
+
(n ^ (e() & 15) >> n / 4).toString(16)
|
|
314
|
+
)
|
|
315
|
+
);
|
|
316
|
+
}
|
|
317
|
+
function He(t) {
|
|
318
|
+
return t.exception?.values?.[0];
|
|
319
|
+
}
|
|
320
|
+
function At(t, e, n) {
|
|
321
|
+
const r = t.exception = t.exception || {}, s = r.values = r.values || [], i = s[0] = s[0] || {};
|
|
322
|
+
i.value || (i.value = e || ""), i.type || (i.type = "Error");
|
|
323
|
+
}
|
|
324
|
+
function D(t, e) {
|
|
325
|
+
const n = He(t);
|
|
326
|
+
if (!n)
|
|
327
|
+
return;
|
|
328
|
+
const r = { type: "generic", handled: !0 }, s = n.mechanism;
|
|
329
|
+
if (n.mechanism = { ...r, ...s, ...e }, e && "data" in e) {
|
|
330
|
+
const i = { ...s?.data, ...e.data };
|
|
331
|
+
n.mechanism.data = i;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
function Rt(t) {
|
|
335
|
+
if (Je(t))
|
|
336
|
+
return !0;
|
|
337
|
+
try {
|
|
338
|
+
re(t, "__sentry_captured__", !0);
|
|
339
|
+
} catch {
|
|
340
|
+
}
|
|
341
|
+
return !1;
|
|
342
|
+
}
|
|
343
|
+
function Je(t) {
|
|
344
|
+
try {
|
|
345
|
+
return t.__sentry_captured__;
|
|
346
|
+
} catch {
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
const ie = 1e3;
|
|
350
|
+
function H() {
|
|
351
|
+
return Date.now() / ie;
|
|
352
|
+
}
|
|
353
|
+
function Xe() {
|
|
354
|
+
const { performance: t } = y;
|
|
355
|
+
if (!t?.now || !t.timeOrigin)
|
|
356
|
+
return H;
|
|
357
|
+
const e = t.timeOrigin;
|
|
358
|
+
return () => (e + t.now()) / ie;
|
|
359
|
+
}
|
|
360
|
+
let Ot;
|
|
361
|
+
function oe() {
|
|
362
|
+
return (Ot ?? (Ot = Xe()))();
|
|
363
|
+
}
|
|
364
|
+
function nt(t, e = {}) {
|
|
365
|
+
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 || oe(), 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 : E()), 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)
|
|
366
|
+
t.duration = void 0;
|
|
367
|
+
else if (typeof e.duration == "number")
|
|
368
|
+
t.duration = e.duration;
|
|
369
|
+
else {
|
|
370
|
+
const n = t.timestamp - t.started;
|
|
371
|
+
t.duration = n >= 0 ? n : 0;
|
|
372
|
+
}
|
|
373
|
+
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);
|
|
374
|
+
}
|
|
375
|
+
function P(t, e, n = 2) {
|
|
376
|
+
if (!e || typeof e != "object" || n <= 0)
|
|
377
|
+
return e;
|
|
378
|
+
if (t && Object.keys(e).length === 0)
|
|
379
|
+
return t;
|
|
380
|
+
const r = { ...t };
|
|
381
|
+
for (const s in e)
|
|
382
|
+
Object.prototype.hasOwnProperty.call(e, s) && (r[s] = P(r[s], e[s], n - 1));
|
|
383
|
+
return r;
|
|
384
|
+
}
|
|
385
|
+
function Nt() {
|
|
386
|
+
return E();
|
|
387
|
+
}
|
|
388
|
+
function ae() {
|
|
389
|
+
return E().substring(16);
|
|
390
|
+
}
|
|
391
|
+
const rt = "_sentrySpan";
|
|
392
|
+
function Dt(t, e) {
|
|
393
|
+
e ? re(t, rt, e) : delete t[rt];
|
|
394
|
+
}
|
|
395
|
+
function Ct(t) {
|
|
396
|
+
return t[rt];
|
|
397
|
+
}
|
|
398
|
+
const qe = 100;
|
|
399
|
+
class b {
|
|
400
|
+
/** Flag if notifying is happening. */
|
|
401
|
+
/** Callback for client to receive scope changes. */
|
|
402
|
+
/** Callback list that will be called during event processing. */
|
|
403
|
+
/** Array of breadcrumbs. */
|
|
404
|
+
/** User */
|
|
405
|
+
/** Tags */
|
|
406
|
+
/** Extra */
|
|
407
|
+
/** Contexts */
|
|
408
|
+
/** Attachments */
|
|
409
|
+
/** Propagation Context for distributed tracing */
|
|
410
|
+
/**
|
|
411
|
+
* A place to stash data which is needed at some point in the SDK's event processing pipeline but which shouldn't get
|
|
412
|
+
* sent to Sentry
|
|
413
|
+
*/
|
|
414
|
+
/** Fingerprint */
|
|
415
|
+
/** Severity */
|
|
416
|
+
/**
|
|
417
|
+
* Transaction Name
|
|
418
|
+
*
|
|
419
|
+
* IMPORTANT: The transaction name on the scope has nothing to do with root spans/transaction objects.
|
|
420
|
+
* It's purpose is to assign a transaction to the scope that's added to non-transaction events.
|
|
421
|
+
*/
|
|
422
|
+
/** Session */
|
|
423
|
+
/** The client on this scope */
|
|
424
|
+
/** Contains the last event id of a captured event. */
|
|
425
|
+
// NOTE: Any field which gets added here should get added not only to the constructor but also to the `clone` method.
|
|
426
|
+
constructor() {
|
|
427
|
+
this._notifyingListeners = !1, this._scopeListeners = [], this._eventProcessors = [], this._breadcrumbs = [], this._attachments = [], this._user = {}, this._tags = {}, this._extra = {}, this._contexts = {}, this._sdkProcessingMetadata = {}, this._propagationContext = {
|
|
428
|
+
traceId: Nt(),
|
|
429
|
+
sampleRand: Math.random()
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* Clone all data from this scope into a new scope.
|
|
434
|
+
*/
|
|
435
|
+
clone() {
|
|
436
|
+
const e = new b();
|
|
437
|
+
return e._breadcrumbs = [...this._breadcrumbs], e._tags = { ...this._tags }, e._extra = { ...this._extra }, e._contexts = { ...this._contexts }, this._contexts.flags && (e._contexts.flags = {
|
|
438
|
+
values: [...this._contexts.flags.values]
|
|
439
|
+
}), 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, Dt(e, Ct(this)), e;
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* Update the client assigned to this scope.
|
|
443
|
+
* Note that not every scope will have a client assigned - isolation scopes & the global scope will generally not have a client,
|
|
444
|
+
* as well as manually created scopes.
|
|
445
|
+
*/
|
|
446
|
+
setClient(e) {
|
|
447
|
+
this._client = e;
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* Set the ID of the last captured error event.
|
|
451
|
+
* This is generally only captured on the isolation scope.
|
|
452
|
+
*/
|
|
453
|
+
setLastEventId(e) {
|
|
454
|
+
this._lastEventId = e;
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Get the client assigned to this scope.
|
|
458
|
+
*/
|
|
459
|
+
getClient() {
|
|
460
|
+
return this._client;
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* Get the ID of the last captured error event.
|
|
464
|
+
* This is generally only available on the isolation scope.
|
|
465
|
+
*/
|
|
466
|
+
lastEventId() {
|
|
467
|
+
return this._lastEventId;
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* @inheritDoc
|
|
471
|
+
*/
|
|
472
|
+
addScopeListener(e) {
|
|
473
|
+
this._scopeListeners.push(e);
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Add an event processor that will be called before an event is sent.
|
|
477
|
+
*/
|
|
478
|
+
addEventProcessor(e) {
|
|
479
|
+
return this._eventProcessors.push(e), this;
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* Set the user for this scope.
|
|
483
|
+
* Set to `null` to unset the user.
|
|
484
|
+
*/
|
|
485
|
+
setUser(e) {
|
|
486
|
+
return this._user = e || {
|
|
487
|
+
email: void 0,
|
|
488
|
+
id: void 0,
|
|
489
|
+
ip_address: void 0,
|
|
490
|
+
username: void 0
|
|
491
|
+
}, this._session && nt(this._session, { user: e }), this._notifyScopeListeners(), this;
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* Get the user from this scope.
|
|
495
|
+
*/
|
|
496
|
+
getUser() {
|
|
497
|
+
return this._user;
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* Set an object that will be merged into existing tags on the scope,
|
|
501
|
+
* and will be sent as tags data with the event.
|
|
502
|
+
*/
|
|
503
|
+
setTags(e) {
|
|
504
|
+
return this._tags = {
|
|
505
|
+
...this._tags,
|
|
506
|
+
...e
|
|
507
|
+
}, this._notifyScopeListeners(), this;
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* Set a single tag that will be sent as tags data with the event.
|
|
511
|
+
*/
|
|
512
|
+
setTag(e, n) {
|
|
513
|
+
return this._tags = { ...this._tags, [e]: n }, this._notifyScopeListeners(), this;
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* Set an object that will be merged into existing extra on the scope,
|
|
517
|
+
* and will be sent as extra data with the event.
|
|
518
|
+
*/
|
|
519
|
+
setExtras(e) {
|
|
520
|
+
return this._extra = {
|
|
521
|
+
...this._extra,
|
|
522
|
+
...e
|
|
523
|
+
}, this._notifyScopeListeners(), this;
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* Set a single key:value extra entry that will be sent as extra data with the event.
|
|
527
|
+
*/
|
|
528
|
+
setExtra(e, n) {
|
|
529
|
+
return this._extra = { ...this._extra, [e]: n }, this._notifyScopeListeners(), this;
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* Sets the fingerprint on the scope to send with the events.
|
|
533
|
+
* @param {string[]} fingerprint Fingerprint to group events in Sentry.
|
|
534
|
+
*/
|
|
535
|
+
setFingerprint(e) {
|
|
536
|
+
return this._fingerprint = e, this._notifyScopeListeners(), this;
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* Sets the level on the scope for future events.
|
|
540
|
+
*/
|
|
541
|
+
setLevel(e) {
|
|
542
|
+
return this._level = e, this._notifyScopeListeners(), this;
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* Sets the transaction name on the scope so that the name of e.g. taken server route or
|
|
546
|
+
* the page location is attached to future events.
|
|
547
|
+
*
|
|
548
|
+
* IMPORTANT: Calling this function does NOT change the name of the currently active
|
|
549
|
+
* root span. If you want to change the name of the active root span, use
|
|
550
|
+
* `Sentry.updateSpanName(rootSpan, 'new name')` instead.
|
|
551
|
+
*
|
|
552
|
+
* By default, the SDK updates the scope's transaction name automatically on sensible
|
|
553
|
+
* occasions, such as a page navigation or when handling a new request on the server.
|
|
554
|
+
*/
|
|
555
|
+
setTransactionName(e) {
|
|
556
|
+
return this._transactionName = e, this._notifyScopeListeners(), this;
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* Sets context data with the given name.
|
|
560
|
+
* Data passed as context will be normalized. You can also pass `null` to unset the context.
|
|
561
|
+
* Note that context data will not be merged - calling `setContext` will overwrite an existing context with the same key.
|
|
562
|
+
*/
|
|
563
|
+
setContext(e, n) {
|
|
564
|
+
return n === null ? delete this._contexts[e] : this._contexts[e] = n, this._notifyScopeListeners(), this;
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Set the session for the scope.
|
|
568
|
+
*/
|
|
569
|
+
setSession(e) {
|
|
570
|
+
return e ? this._session = e : delete this._session, this._notifyScopeListeners(), this;
|
|
571
|
+
}
|
|
572
|
+
/**
|
|
573
|
+
* Get the session from the scope.
|
|
574
|
+
*/
|
|
575
|
+
getSession() {
|
|
576
|
+
return this._session;
|
|
577
|
+
}
|
|
578
|
+
/**
|
|
579
|
+
* Updates the scope with provided data. Can work in three variations:
|
|
580
|
+
* - plain object containing updatable attributes
|
|
581
|
+
* - Scope instance that'll extract the attributes from
|
|
582
|
+
* - callback function that'll receive the current scope as an argument and allow for modifications
|
|
583
|
+
*/
|
|
584
|
+
update(e) {
|
|
585
|
+
if (!e)
|
|
586
|
+
return this;
|
|
587
|
+
const n = typeof e == "function" ? e(this) : e, r = n instanceof b ? n.getScopeData() : N(n) ? e : void 0, { tags: s, extra: i, user: o, contexts: a, level: c, fingerprint: u = [], propagationContext: d } = r || {};
|
|
588
|
+
return this._tags = { ...this._tags, ...s }, this._extra = { ...this._extra, ...i }, this._contexts = { ...this._contexts, ...a }, o && Object.keys(o).length && (this._user = o), c && (this._level = c), u.length && (this._fingerprint = u), d && (this._propagationContext = d), this;
|
|
589
|
+
}
|
|
590
|
+
/**
|
|
591
|
+
* Clears the current scope and resets its properties.
|
|
592
|
+
* Note: The client will not be cleared.
|
|
593
|
+
*/
|
|
594
|
+
clear() {
|
|
595
|
+
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, Dt(this, void 0), this._attachments = [], this.setPropagationContext({ traceId: Nt(), sampleRand: Math.random() }), this._notifyScopeListeners(), this;
|
|
596
|
+
}
|
|
597
|
+
/**
|
|
598
|
+
* Adds a breadcrumb to the scope.
|
|
599
|
+
* By default, the last 100 breadcrumbs are kept.
|
|
600
|
+
*/
|
|
601
|
+
addBreadcrumb(e, n) {
|
|
602
|
+
const r = typeof n == "number" ? n : qe;
|
|
603
|
+
if (r <= 0)
|
|
604
|
+
return this;
|
|
605
|
+
const s = {
|
|
606
|
+
timestamp: H(),
|
|
607
|
+
...e,
|
|
608
|
+
// Breadcrumb messages can theoretically be infinitely large and they're held in memory so we truncate them not to leak (too much) memory
|
|
609
|
+
message: e.message ? Y(e.message, 2048) : e.message
|
|
610
|
+
};
|
|
611
|
+
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;
|
|
612
|
+
}
|
|
613
|
+
/**
|
|
614
|
+
* Get the last breadcrumb of the scope.
|
|
615
|
+
*/
|
|
616
|
+
getLastBreadcrumb() {
|
|
617
|
+
return this._breadcrumbs[this._breadcrumbs.length - 1];
|
|
618
|
+
}
|
|
619
|
+
/**
|
|
620
|
+
* Clear all breadcrumbs from the scope.
|
|
621
|
+
*/
|
|
622
|
+
clearBreadcrumbs() {
|
|
623
|
+
return this._breadcrumbs = [], this._notifyScopeListeners(), this;
|
|
624
|
+
}
|
|
625
|
+
/**
|
|
626
|
+
* Add an attachment to the scope.
|
|
627
|
+
*/
|
|
628
|
+
addAttachment(e) {
|
|
629
|
+
return this._attachments.push(e), this;
|
|
630
|
+
}
|
|
631
|
+
/**
|
|
632
|
+
* Clear all attachments from the scope.
|
|
633
|
+
*/
|
|
634
|
+
clearAttachments() {
|
|
635
|
+
return this._attachments = [], this;
|
|
636
|
+
}
|
|
637
|
+
/**
|
|
638
|
+
* Get the data of this scope, which should be applied to an event during processing.
|
|
639
|
+
*/
|
|
640
|
+
getScopeData() {
|
|
641
|
+
return {
|
|
642
|
+
breadcrumbs: this._breadcrumbs,
|
|
643
|
+
attachments: this._attachments,
|
|
644
|
+
contexts: this._contexts,
|
|
645
|
+
tags: this._tags,
|
|
646
|
+
extra: this._extra,
|
|
647
|
+
user: this._user,
|
|
648
|
+
level: this._level,
|
|
649
|
+
fingerprint: this._fingerprint || [],
|
|
650
|
+
eventProcessors: this._eventProcessors,
|
|
651
|
+
propagationContext: this._propagationContext,
|
|
652
|
+
sdkProcessingMetadata: this._sdkProcessingMetadata,
|
|
653
|
+
transactionName: this._transactionName,
|
|
654
|
+
span: Ct(this)
|
|
655
|
+
};
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* Add data which will be accessible during event processing but won't get sent to Sentry.
|
|
659
|
+
*/
|
|
660
|
+
setSDKProcessingMetadata(e) {
|
|
661
|
+
return this._sdkProcessingMetadata = P(this._sdkProcessingMetadata, e, 2), this;
|
|
662
|
+
}
|
|
663
|
+
/**
|
|
664
|
+
* Add propagation context to the scope, used for distributed tracing
|
|
665
|
+
*/
|
|
666
|
+
setPropagationContext(e) {
|
|
667
|
+
return this._propagationContext = e, this;
|
|
668
|
+
}
|
|
669
|
+
/**
|
|
670
|
+
* Get propagation context from the scope, used for distributed tracing
|
|
671
|
+
*/
|
|
672
|
+
getPropagationContext() {
|
|
673
|
+
return this._propagationContext;
|
|
674
|
+
}
|
|
675
|
+
/**
|
|
676
|
+
* Capture an exception for this scope.
|
|
677
|
+
*
|
|
678
|
+
* @returns {string} The id of the captured Sentry event.
|
|
679
|
+
*/
|
|
680
|
+
captureException(e, n) {
|
|
681
|
+
const r = n?.event_id || E();
|
|
682
|
+
if (!this._client)
|
|
683
|
+
return _ && l.warn("No client configured on scope - will not capture exception!"), r;
|
|
684
|
+
const s = new Error("Sentry syntheticException");
|
|
685
|
+
return this._client.captureException(
|
|
686
|
+
e,
|
|
687
|
+
{
|
|
688
|
+
originalException: e,
|
|
689
|
+
syntheticException: s,
|
|
690
|
+
...n,
|
|
691
|
+
event_id: r
|
|
692
|
+
},
|
|
693
|
+
this
|
|
694
|
+
), r;
|
|
695
|
+
}
|
|
696
|
+
/**
|
|
697
|
+
* Capture a message for this scope.
|
|
698
|
+
*
|
|
699
|
+
* @returns {string} The id of the captured message.
|
|
700
|
+
*/
|
|
701
|
+
captureMessage(e, n, r) {
|
|
702
|
+
const s = r?.event_id || E();
|
|
703
|
+
if (!this._client)
|
|
704
|
+
return _ && l.warn("No client configured on scope - will not capture message!"), s;
|
|
705
|
+
const i = new Error(e);
|
|
706
|
+
return this._client.captureMessage(
|
|
707
|
+
e,
|
|
708
|
+
n,
|
|
709
|
+
{
|
|
710
|
+
originalException: e,
|
|
711
|
+
syntheticException: i,
|
|
712
|
+
...r,
|
|
713
|
+
event_id: s
|
|
714
|
+
},
|
|
715
|
+
this
|
|
716
|
+
), s;
|
|
717
|
+
}
|
|
718
|
+
/**
|
|
719
|
+
* Capture a Sentry event for this scope.
|
|
720
|
+
*
|
|
721
|
+
* @returns {string} The id of the captured event.
|
|
722
|
+
*/
|
|
723
|
+
captureEvent(e, n) {
|
|
724
|
+
const r = n?.event_id || E();
|
|
725
|
+
return this._client ? (this._client.captureEvent(e, { ...n, event_id: r }, this), r) : (_ && l.warn("No client configured on scope - will not capture event!"), r);
|
|
726
|
+
}
|
|
727
|
+
/**
|
|
728
|
+
* This will be called on every set call.
|
|
729
|
+
*/
|
|
730
|
+
_notifyScopeListeners() {
|
|
731
|
+
this._notifyingListeners || (this._notifyingListeners = !0, this._scopeListeners.forEach((e) => {
|
|
732
|
+
e(this);
|
|
733
|
+
}), this._notifyingListeners = !1);
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
function Ze() {
|
|
737
|
+
return C("defaultCurrentScope", () => new b());
|
|
738
|
+
}
|
|
739
|
+
function Qe() {
|
|
740
|
+
return C("defaultIsolationScope", () => new b());
|
|
741
|
+
}
|
|
742
|
+
class tn {
|
|
743
|
+
constructor(e, n) {
|
|
744
|
+
let r;
|
|
745
|
+
e ? r = e : r = new b();
|
|
746
|
+
let s;
|
|
747
|
+
n ? s = n : s = new b(), this._stack = [{ scope: r }], this._isolationScope = s;
|
|
748
|
+
}
|
|
749
|
+
/**
|
|
750
|
+
* Fork a scope for the stack.
|
|
751
|
+
*/
|
|
752
|
+
withScope(e) {
|
|
753
|
+
const n = this._pushScope();
|
|
754
|
+
let r;
|
|
755
|
+
try {
|
|
756
|
+
r = e(n);
|
|
757
|
+
} catch (s) {
|
|
758
|
+
throw this._popScope(), s;
|
|
759
|
+
}
|
|
760
|
+
return V(r) ? r.then(
|
|
761
|
+
(s) => (this._popScope(), s),
|
|
762
|
+
(s) => {
|
|
763
|
+
throw this._popScope(), s;
|
|
764
|
+
}
|
|
765
|
+
) : (this._popScope(), r);
|
|
766
|
+
}
|
|
767
|
+
/**
|
|
768
|
+
* Get the client of the stack.
|
|
769
|
+
*/
|
|
770
|
+
getClient() {
|
|
771
|
+
return this.getStackTop().client;
|
|
772
|
+
}
|
|
773
|
+
/**
|
|
774
|
+
* Returns the scope of the top stack.
|
|
775
|
+
*/
|
|
776
|
+
getScope() {
|
|
777
|
+
return this.getStackTop().scope;
|
|
778
|
+
}
|
|
779
|
+
/**
|
|
780
|
+
* Get the isolation scope for the stack.
|
|
781
|
+
*/
|
|
782
|
+
getIsolationScope() {
|
|
783
|
+
return this._isolationScope;
|
|
784
|
+
}
|
|
785
|
+
/**
|
|
786
|
+
* Returns the topmost scope layer in the order domain > local > process.
|
|
787
|
+
*/
|
|
788
|
+
getStackTop() {
|
|
789
|
+
return this._stack[this._stack.length - 1];
|
|
790
|
+
}
|
|
791
|
+
/**
|
|
792
|
+
* Push a scope to the stack.
|
|
793
|
+
*/
|
|
794
|
+
_pushScope() {
|
|
795
|
+
const e = this.getScope().clone();
|
|
796
|
+
return this._stack.push({
|
|
797
|
+
client: this.getClient(),
|
|
798
|
+
scope: e
|
|
799
|
+
}), e;
|
|
800
|
+
}
|
|
801
|
+
/**
|
|
802
|
+
* Pop a scope from the stack.
|
|
803
|
+
*/
|
|
804
|
+
_popScope() {
|
|
805
|
+
return this._stack.length <= 1 ? !1 : !!this._stack.pop();
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
function A() {
|
|
809
|
+
const t = ft(), e = z(t);
|
|
810
|
+
return e.stack = e.stack || new tn(Ze(), Qe());
|
|
811
|
+
}
|
|
812
|
+
function en(t) {
|
|
813
|
+
return A().withScope(t);
|
|
814
|
+
}
|
|
815
|
+
function nn(t, e) {
|
|
816
|
+
const n = A();
|
|
817
|
+
return n.withScope(() => (n.getStackTop().scope = t, e(t)));
|
|
818
|
+
}
|
|
819
|
+
function xt(t) {
|
|
820
|
+
return A().withScope(() => t(A().getIsolationScope()));
|
|
821
|
+
}
|
|
822
|
+
function rn() {
|
|
823
|
+
return {
|
|
824
|
+
withIsolationScope: xt,
|
|
825
|
+
withScope: en,
|
|
826
|
+
withSetScope: nn,
|
|
827
|
+
withSetIsolationScope: (t, e) => xt(e),
|
|
828
|
+
getCurrentScope: () => A().getScope(),
|
|
829
|
+
getIsolationScope: () => A().getIsolationScope()
|
|
830
|
+
};
|
|
831
|
+
}
|
|
832
|
+
function ce(t) {
|
|
833
|
+
const e = z(t);
|
|
834
|
+
return e.acs ? e.acs : rn();
|
|
835
|
+
}
|
|
836
|
+
function ue() {
|
|
837
|
+
const t = ft();
|
|
838
|
+
return ce(t).getCurrentScope();
|
|
839
|
+
}
|
|
840
|
+
function sn() {
|
|
841
|
+
const t = ft();
|
|
842
|
+
return ce(t).getIsolationScope();
|
|
843
|
+
}
|
|
844
|
+
function on() {
|
|
845
|
+
return C("globalScope", () => new b());
|
|
846
|
+
}
|
|
847
|
+
function ht() {
|
|
848
|
+
return ue().getClient();
|
|
849
|
+
}
|
|
850
|
+
function an(t) {
|
|
851
|
+
const e = t.getPropagationContext(), { traceId: n, parentSpanId: r, propagationSpanId: s } = e, i = {
|
|
852
|
+
trace_id: n,
|
|
853
|
+
span_id: s || ae()
|
|
854
|
+
};
|
|
855
|
+
return r && (i.parent_span_id = r), i;
|
|
856
|
+
}
|
|
857
|
+
const cn = "sentry.source", un = "sentry.sample_rate", fn = "sentry.previous_trace_sample_rate", pn = "sentry.op", dn = "sentry.origin", fe = "sentry.profile_id", pe = "sentry.exclusive_time", ln = 0, _n = 1, hn = "_sentryScope", gn = "_sentryIsolationScope";
|
|
858
|
+
function de(t) {
|
|
859
|
+
return {
|
|
860
|
+
scope: t[hn],
|
|
861
|
+
isolationScope: t[gn]
|
|
862
|
+
};
|
|
863
|
+
}
|
|
864
|
+
const mn = "sentry-", yn = /^sentry-/;
|
|
865
|
+
function En(t) {
|
|
866
|
+
const e = Sn(t);
|
|
867
|
+
if (!e)
|
|
868
|
+
return;
|
|
869
|
+
const n = Object.entries(e).reduce((r, [s, i]) => {
|
|
870
|
+
if (s.match(yn)) {
|
|
871
|
+
const o = s.slice(mn.length);
|
|
872
|
+
r[o] = i;
|
|
873
|
+
}
|
|
874
|
+
return r;
|
|
875
|
+
}, {});
|
|
876
|
+
if (Object.keys(n).length > 0)
|
|
877
|
+
return n;
|
|
878
|
+
}
|
|
879
|
+
function Sn(t) {
|
|
880
|
+
if (!(!t || !ne(t) && !Array.isArray(t)))
|
|
881
|
+
return Array.isArray(t) ? t.reduce((e, n) => {
|
|
882
|
+
const r = Pt(n);
|
|
883
|
+
return Object.entries(r).forEach(([s, i]) => {
|
|
884
|
+
e[s] = i;
|
|
885
|
+
}), e;
|
|
886
|
+
}, {}) : Pt(t);
|
|
887
|
+
}
|
|
888
|
+
function Pt(t) {
|
|
889
|
+
return t.split(",").map(
|
|
890
|
+
(e) => e.split("=").map((n) => {
|
|
891
|
+
try {
|
|
892
|
+
return decodeURIComponent(n.trim());
|
|
893
|
+
} catch {
|
|
894
|
+
return;
|
|
895
|
+
}
|
|
896
|
+
})
|
|
897
|
+
).reduce((e, [n, r]) => (n && r && (e[n] = r), e), {});
|
|
898
|
+
}
|
|
899
|
+
function bn(t) {
|
|
900
|
+
if (typeof t == "boolean")
|
|
901
|
+
return Number(t);
|
|
902
|
+
const e = typeof t == "string" ? parseFloat(t) : t;
|
|
903
|
+
if (!(typeof e != "number" || isNaN(e) || e < 0 || e > 1))
|
|
904
|
+
return e;
|
|
905
|
+
}
|
|
906
|
+
const le = 1;
|
|
907
|
+
let wt = !1;
|
|
908
|
+
function In(t) {
|
|
909
|
+
const { spanId: e, traceId: n, isRemote: r } = t.spanContext(), s = r ? e : gt(t).parent_span_id, i = de(t).scope, o = r ? i?.getPropagationContext().propagationSpanId || ae() : e;
|
|
910
|
+
return {
|
|
911
|
+
parent_span_id: s,
|
|
912
|
+
span_id: o,
|
|
913
|
+
trace_id: n
|
|
914
|
+
};
|
|
915
|
+
}
|
|
916
|
+
function Tn(t) {
|
|
917
|
+
if (t && t.length > 0)
|
|
918
|
+
return t.map(({ context: { spanId: e, traceId: n, traceFlags: r, ...s }, attributes: i }) => ({
|
|
919
|
+
span_id: e,
|
|
920
|
+
trace_id: n,
|
|
921
|
+
sampled: r === le,
|
|
922
|
+
attributes: i,
|
|
923
|
+
...s
|
|
924
|
+
}));
|
|
925
|
+
}
|
|
926
|
+
function Mt(t) {
|
|
927
|
+
return typeof t == "number" ? Lt(t) : Array.isArray(t) ? t[0] + t[1] / 1e9 : t instanceof Date ? Lt(t.getTime()) : oe();
|
|
928
|
+
}
|
|
929
|
+
function Lt(t) {
|
|
930
|
+
return t > 9999999999 ? t / 1e3 : t;
|
|
931
|
+
}
|
|
932
|
+
function gt(t) {
|
|
933
|
+
if (kn(t))
|
|
934
|
+
return t.getSpanJSON();
|
|
935
|
+
const { spanId: e, traceId: n } = t.spanContext();
|
|
936
|
+
if (vn(t)) {
|
|
937
|
+
const { attributes: r, startTime: s, name: i, endTime: o, status: a, links: c } = t, u = "parentSpanId" in t ? t.parentSpanId : "parentSpanContext" in t ? t.parentSpanContext?.spanId : void 0;
|
|
938
|
+
return {
|
|
939
|
+
span_id: e,
|
|
940
|
+
trace_id: n,
|
|
941
|
+
data: r,
|
|
942
|
+
description: i,
|
|
943
|
+
parent_span_id: u,
|
|
944
|
+
start_timestamp: Mt(s),
|
|
945
|
+
// This is [0,0] by default in OTEL, in which case we want to interpret this as no end time
|
|
946
|
+
timestamp: Mt(o) || void 0,
|
|
947
|
+
status: Rn(a),
|
|
948
|
+
op: r[pn],
|
|
949
|
+
origin: r[dn],
|
|
950
|
+
links: Tn(c)
|
|
951
|
+
};
|
|
952
|
+
}
|
|
953
|
+
return {
|
|
954
|
+
span_id: e,
|
|
955
|
+
trace_id: n,
|
|
956
|
+
start_timestamp: 0,
|
|
957
|
+
data: {}
|
|
958
|
+
};
|
|
959
|
+
}
|
|
960
|
+
function vn(t) {
|
|
961
|
+
const e = t;
|
|
962
|
+
return !!e.attributes && !!e.startTime && !!e.name && !!e.endTime && !!e.status;
|
|
963
|
+
}
|
|
964
|
+
function kn(t) {
|
|
965
|
+
return typeof t.getSpanJSON == "function";
|
|
966
|
+
}
|
|
967
|
+
function An(t) {
|
|
968
|
+
const { traceFlags: e } = t.spanContext();
|
|
969
|
+
return e === le;
|
|
970
|
+
}
|
|
971
|
+
function Rn(t) {
|
|
972
|
+
if (!(!t || t.code === ln))
|
|
973
|
+
return t.code === _n ? "ok" : t.message || "unknown_error";
|
|
974
|
+
}
|
|
975
|
+
const On = "_sentryRootSpan";
|
|
976
|
+
function _e(t) {
|
|
977
|
+
return t[On] || t;
|
|
978
|
+
}
|
|
979
|
+
function $t() {
|
|
980
|
+
wt || (pt(() => {
|
|
981
|
+
console.warn(
|
|
982
|
+
"[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly."
|
|
983
|
+
);
|
|
984
|
+
}), wt = !0);
|
|
985
|
+
}
|
|
986
|
+
function Nn(t) {
|
|
987
|
+
if (typeof __SENTRY_TRACING__ == "boolean" && !__SENTRY_TRACING__)
|
|
988
|
+
return !1;
|
|
989
|
+
const e = t || ht()?.getOptions();
|
|
990
|
+
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)
|
|
991
|
+
(e.tracesSampleRate != null || !!e.tracesSampler);
|
|
992
|
+
}
|
|
993
|
+
const mt = "production", Dn = /^o(\d+)\./, Cn = /^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;
|
|
994
|
+
function xn(t) {
|
|
995
|
+
return t === "http" || t === "https";
|
|
996
|
+
}
|
|
997
|
+
function J(t, e = !1) {
|
|
998
|
+
const { host: n, path: r, pass: s, port: i, projectId: o, protocol: a, publicKey: c } = t;
|
|
999
|
+
return `${a}://${c}${e && s ? `:${s}` : ""}@${n}${i ? `:${i}` : ""}/${r && `${r}/`}${o}`;
|
|
1000
|
+
}
|
|
1001
|
+
function Pn(t) {
|
|
1002
|
+
const e = Cn.exec(t);
|
|
1003
|
+
if (!e) {
|
|
1004
|
+
pt(() => {
|
|
1005
|
+
console.error(`Invalid Sentry Dsn: ${t}`);
|
|
1006
|
+
});
|
|
1007
|
+
return;
|
|
1008
|
+
}
|
|
1009
|
+
const [n, r, s = "", i = "", o = "", a = ""] = e.slice(1);
|
|
1010
|
+
let c = "", u = a;
|
|
1011
|
+
const d = u.split("/");
|
|
1012
|
+
if (d.length > 1 && (c = d.slice(0, -1).join("/"), u = d.pop()), u) {
|
|
1013
|
+
const f = u.match(/^\d+/);
|
|
1014
|
+
f && (u = f[0]);
|
|
1015
|
+
}
|
|
1016
|
+
return he({ host: i, pass: s, path: c, projectId: u, port: o, protocol: n, publicKey: r });
|
|
1017
|
+
}
|
|
1018
|
+
function he(t) {
|
|
1019
|
+
return {
|
|
1020
|
+
protocol: t.protocol,
|
|
1021
|
+
publicKey: t.publicKey || "",
|
|
1022
|
+
pass: t.pass || "",
|
|
1023
|
+
host: t.host,
|
|
1024
|
+
port: t.port || "",
|
|
1025
|
+
path: t.path || "",
|
|
1026
|
+
projectId: t.projectId
|
|
1027
|
+
};
|
|
1028
|
+
}
|
|
1029
|
+
function wn(t) {
|
|
1030
|
+
if (!_)
|
|
1031
|
+
return !0;
|
|
1032
|
+
const { port: e, projectId: n, protocol: r } = t;
|
|
1033
|
+
return ["protocol", "publicKey", "host", "projectId"].find((o) => t[o] ? !1 : (l.error(`Invalid Sentry Dsn: ${o} missing`), !0)) ? !1 : n.match(/^\d+$/) ? xn(r) ? e && isNaN(parseInt(e, 10)) ? (l.error(`Invalid Sentry Dsn: Invalid port ${e}`), !1) : !0 : (l.error(`Invalid Sentry Dsn: Invalid protocol ${r}`), !1) : (l.error(`Invalid Sentry Dsn: Invalid projectId ${n}`), !1);
|
|
1034
|
+
}
|
|
1035
|
+
function Mn(t) {
|
|
1036
|
+
return t.match(Dn)?.[1];
|
|
1037
|
+
}
|
|
1038
|
+
function Ln(t) {
|
|
1039
|
+
const e = typeof t == "string" ? Pn(t) : he(t);
|
|
1040
|
+
if (!(!e || !wn(e)))
|
|
1041
|
+
return e;
|
|
1042
|
+
}
|
|
1043
|
+
const $n = "_frozenDsc";
|
|
1044
|
+
function ge(t, e) {
|
|
1045
|
+
const n = e.getOptions(), { publicKey: r, host: s } = e.getDsn() || {};
|
|
1046
|
+
let i;
|
|
1047
|
+
n.orgId ? i = String(n.orgId) : s && (i = Mn(s));
|
|
1048
|
+
const o = {
|
|
1049
|
+
environment: n.environment || mt,
|
|
1050
|
+
release: n.release,
|
|
1051
|
+
public_key: r,
|
|
1052
|
+
trace_id: t,
|
|
1053
|
+
org_id: i
|
|
1054
|
+
};
|
|
1055
|
+
return e.emit("createDsc", o), o;
|
|
1056
|
+
}
|
|
1057
|
+
function Fn(t, e) {
|
|
1058
|
+
const n = e.getPropagationContext();
|
|
1059
|
+
return n.dsc || ge(n.traceId, t);
|
|
1060
|
+
}
|
|
1061
|
+
function jn(t) {
|
|
1062
|
+
const e = ht();
|
|
1063
|
+
if (!e)
|
|
1064
|
+
return {};
|
|
1065
|
+
const n = _e(t), r = gt(n), s = r.data, i = n.spanContext().traceState, o = i?.get("sentry.sample_rate") ?? s[un] ?? s[fn];
|
|
1066
|
+
function a(m) {
|
|
1067
|
+
return (typeof o == "number" || typeof o == "string") && (m.sample_rate = `${o}`), m;
|
|
1068
|
+
}
|
|
1069
|
+
const c = n[$n];
|
|
1070
|
+
if (c)
|
|
1071
|
+
return a(c);
|
|
1072
|
+
const u = i?.get("sentry.dsc"), d = u && En(u);
|
|
1073
|
+
if (d)
|
|
1074
|
+
return a(d);
|
|
1075
|
+
const f = ge(t.spanContext().traceId, e), h = s[cn], p = r.description;
|
|
1076
|
+
return h !== "url" && p && (f.transaction = p), Nn() && (f.sampled = String(An(n)), f.sample_rand = // In OTEL we store the sample rand on the trace state because we cannot access scopes for NonRecordingSpans
|
|
1077
|
+
// The Sentry OTEL SpanSampler takes care of writing the sample rand on the root span
|
|
1078
|
+
i?.get("sentry.sample_rand") ?? // On all other platforms we can actually get the scopes from a root span (we use this as a fallback)
|
|
1079
|
+
de(n).scope?.getPropagationContext().sampleRand.toString()), a(f), e.emit("createDsc", f, n), f;
|
|
1080
|
+
}
|
|
1081
|
+
function S(t, e = 100, n = 1 / 0) {
|
|
1082
|
+
try {
|
|
1083
|
+
return st("", t, e, n);
|
|
1084
|
+
} catch (r) {
|
|
1085
|
+
return { ERROR: `**non-serializable** (${r})` };
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
function me(t, e = 3, n = 100 * 1024) {
|
|
1089
|
+
const r = S(t, e);
|
|
1090
|
+
return Gn(r) > n ? me(t, e - 1, n) : r;
|
|
1091
|
+
}
|
|
1092
|
+
function st(t, e, n = 1 / 0, r = 1 / 0, s = zn()) {
|
|
1093
|
+
const [i, o] = s;
|
|
1094
|
+
if (e == null || // this matches null and undefined -> eqeq not eqeqeq
|
|
1095
|
+
["boolean", "string"].includes(typeof e) || typeof e == "number" && Number.isFinite(e))
|
|
1096
|
+
return e;
|
|
1097
|
+
const a = Un(t, e);
|
|
1098
|
+
if (!a.startsWith("[object "))
|
|
1099
|
+
return a;
|
|
1100
|
+
if (e.__sentry_skip_normalization__)
|
|
1101
|
+
return e;
|
|
1102
|
+
const c = typeof e.__sentry_override_normalization_depth__ == "number" ? e.__sentry_override_normalization_depth__ : n;
|
|
1103
|
+
if (c === 0)
|
|
1104
|
+
return a.replace("object ", "");
|
|
1105
|
+
if (i(e))
|
|
1106
|
+
return "[Circular ~]";
|
|
1107
|
+
const u = e;
|
|
1108
|
+
if (u && typeof u.toJSON == "function")
|
|
1109
|
+
try {
|
|
1110
|
+
const p = u.toJSON();
|
|
1111
|
+
return st("", p, c - 1, r, s);
|
|
1112
|
+
} catch {
|
|
1113
|
+
}
|
|
1114
|
+
const d = Array.isArray(e) ? [] : {};
|
|
1115
|
+
let f = 0;
|
|
1116
|
+
const h = se(e);
|
|
1117
|
+
for (const p in h) {
|
|
1118
|
+
if (!Object.prototype.hasOwnProperty.call(h, p))
|
|
1119
|
+
continue;
|
|
1120
|
+
if (f >= r) {
|
|
1121
|
+
d[p] = "[MaxProperties ~]";
|
|
1122
|
+
break;
|
|
1123
|
+
}
|
|
1124
|
+
const m = h[p];
|
|
1125
|
+
d[p] = st(p, m, c - 1, r, s), f++;
|
|
1126
|
+
}
|
|
1127
|
+
return o(e), d;
|
|
1128
|
+
}
|
|
1129
|
+
function Un(t, e) {
|
|
1130
|
+
try {
|
|
1131
|
+
if (t === "domain" && e && typeof e == "object" && e._events)
|
|
1132
|
+
return "[Domain]";
|
|
1133
|
+
if (t === "domainEmitter")
|
|
1134
|
+
return "[DomainEmitter]";
|
|
1135
|
+
if (typeof global < "u" && e === global)
|
|
1136
|
+
return "[Global]";
|
|
1137
|
+
if (typeof window < "u" && e === window)
|
|
1138
|
+
return "[Window]";
|
|
1139
|
+
if (typeof document < "u" && e === document)
|
|
1140
|
+
return "[Document]";
|
|
1141
|
+
if (Be(e))
|
|
1142
|
+
return "[VueViewModel]";
|
|
1143
|
+
if (Ue(e))
|
|
1144
|
+
return "[SyntheticEvent]";
|
|
1145
|
+
if (typeof e == "number" && !Number.isFinite(e))
|
|
1146
|
+
return `[${e}]`;
|
|
1147
|
+
if (typeof e == "function")
|
|
1148
|
+
return `[Function: ${Le(e)}]`;
|
|
1149
|
+
if (typeof e == "symbol")
|
|
1150
|
+
return `[${String(e)}]`;
|
|
1151
|
+
if (typeof e == "bigint")
|
|
1152
|
+
return `[BigInt: ${String(e)}]`;
|
|
1153
|
+
const n = Bn(e);
|
|
1154
|
+
return /^HTML(\w*)Element$/.test(n) ? `[HTMLElement: ${n}]` : `[object ${n}]`;
|
|
1155
|
+
} catch (n) {
|
|
1156
|
+
return `**non-serializable** (${n})`;
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
function Bn(t) {
|
|
1160
|
+
const e = Object.getPrototypeOf(t);
|
|
1161
|
+
return e?.constructor ? e.constructor.name : "null prototype";
|
|
1162
|
+
}
|
|
1163
|
+
function Yn(t) {
|
|
1164
|
+
return ~-encodeURI(t).split(/%..|./).length;
|
|
1165
|
+
}
|
|
1166
|
+
function Gn(t) {
|
|
1167
|
+
return Yn(JSON.stringify(t));
|
|
1168
|
+
}
|
|
1169
|
+
function zn() {
|
|
1170
|
+
const t = /* @__PURE__ */ new WeakSet();
|
|
1171
|
+
function e(r) {
|
|
1172
|
+
return t.has(r) ? !0 : (t.add(r), !1);
|
|
1173
|
+
}
|
|
1174
|
+
function n(r) {
|
|
1175
|
+
t.delete(r);
|
|
1176
|
+
}
|
|
1177
|
+
return [e, n];
|
|
1178
|
+
}
|
|
1179
|
+
function w(t, e = []) {
|
|
1180
|
+
return [t, e];
|
|
1181
|
+
}
|
|
1182
|
+
function Wn(t, e) {
|
|
1183
|
+
const [n, r] = t;
|
|
1184
|
+
return [n, [...r, e]];
|
|
1185
|
+
}
|
|
1186
|
+
function Ft(t, e) {
|
|
1187
|
+
const n = t[1];
|
|
1188
|
+
for (const r of n) {
|
|
1189
|
+
const s = r[0].type;
|
|
1190
|
+
if (e(r, s))
|
|
1191
|
+
return !0;
|
|
1192
|
+
}
|
|
1193
|
+
return !1;
|
|
1194
|
+
}
|
|
1195
|
+
function it(t) {
|
|
1196
|
+
const e = z(y);
|
|
1197
|
+
return e.encodePolyfill ? e.encodePolyfill(t) : new TextEncoder().encode(t);
|
|
1198
|
+
}
|
|
1199
|
+
function Vn(t) {
|
|
1200
|
+
const [e, n] = t;
|
|
1201
|
+
let r = JSON.stringify(e);
|
|
1202
|
+
function s(i) {
|
|
1203
|
+
typeof r == "string" ? r = typeof i == "string" ? r + i : [it(r), i] : r.push(typeof i == "string" ? it(i) : i);
|
|
1204
|
+
}
|
|
1205
|
+
for (const i of n) {
|
|
1206
|
+
const [o, a] = i;
|
|
1207
|
+
if (s(`
|
|
1208
|
+
${JSON.stringify(o)}
|
|
1209
|
+
`), typeof a == "string" || a instanceof Uint8Array)
|
|
1210
|
+
s(a);
|
|
1211
|
+
else {
|
|
1212
|
+
let c;
|
|
1213
|
+
try {
|
|
1214
|
+
c = JSON.stringify(a);
|
|
1215
|
+
} catch {
|
|
1216
|
+
c = JSON.stringify(S(a));
|
|
1217
|
+
}
|
|
1218
|
+
s(c);
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
return typeof r == "string" ? r : Kn(r);
|
|
1222
|
+
}
|
|
1223
|
+
function Kn(t) {
|
|
1224
|
+
const e = t.reduce((s, i) => s + i.length, 0), n = new Uint8Array(e);
|
|
1225
|
+
let r = 0;
|
|
1226
|
+
for (const s of t)
|
|
1227
|
+
n.set(s, r), r += s.length;
|
|
1228
|
+
return n;
|
|
1229
|
+
}
|
|
1230
|
+
function Hn(t) {
|
|
1231
|
+
const e = typeof t.data == "string" ? it(t.data) : t.data;
|
|
1232
|
+
return [
|
|
1233
|
+
{
|
|
1234
|
+
type: "attachment",
|
|
1235
|
+
length: e.length,
|
|
1236
|
+
filename: t.filename,
|
|
1237
|
+
content_type: t.contentType,
|
|
1238
|
+
attachment_type: t.attachmentType
|
|
1239
|
+
},
|
|
1240
|
+
e
|
|
1241
|
+
];
|
|
1242
|
+
}
|
|
1243
|
+
const Jn = {
|
|
1244
|
+
session: "session",
|
|
1245
|
+
sessions: "session",
|
|
1246
|
+
attachment: "attachment",
|
|
1247
|
+
transaction: "transaction",
|
|
1248
|
+
event: "error",
|
|
1249
|
+
client_report: "internal",
|
|
1250
|
+
user_report: "default",
|
|
1251
|
+
profile: "profile",
|
|
1252
|
+
profile_chunk: "profile",
|
|
1253
|
+
replay_event: "replay",
|
|
1254
|
+
replay_recording: "replay",
|
|
1255
|
+
check_in: "monitor",
|
|
1256
|
+
feedback: "feedback",
|
|
1257
|
+
span: "span",
|
|
1258
|
+
raw_security: "security",
|
|
1259
|
+
log: "log_item"
|
|
1260
|
+
};
|
|
1261
|
+
function jt(t) {
|
|
1262
|
+
return Jn[t];
|
|
1263
|
+
}
|
|
1264
|
+
function ye(t) {
|
|
1265
|
+
if (!t?.sdk)
|
|
1266
|
+
return;
|
|
1267
|
+
const { name: e, version: n } = t.sdk;
|
|
1268
|
+
return { name: e, version: n };
|
|
1269
|
+
}
|
|
1270
|
+
function Xn(t, e, n, r) {
|
|
1271
|
+
const s = t.sdkProcessingMetadata?.dynamicSamplingContext;
|
|
1272
|
+
return {
|
|
1273
|
+
event_id: t.event_id,
|
|
1274
|
+
sent_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1275
|
+
...e && { sdk: e },
|
|
1276
|
+
...!!n && r && { dsn: J(r) },
|
|
1277
|
+
...s && {
|
|
1278
|
+
trace: s
|
|
1279
|
+
}
|
|
1280
|
+
};
|
|
1281
|
+
}
|
|
1282
|
+
function qn(t, e) {
|
|
1283
|
+
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;
|
|
1284
|
+
}
|
|
1285
|
+
function Zn(t, e, n, r) {
|
|
1286
|
+
const s = ye(n), i = {
|
|
1287
|
+
sent_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1288
|
+
...s && { sdk: s },
|
|
1289
|
+
...!!r && e && { dsn: J(e) }
|
|
1290
|
+
}, o = "aggregates" in t ? [{ type: "sessions" }, t] : [{ type: "session" }, t.toJSON()];
|
|
1291
|
+
return w(i, [o]);
|
|
1292
|
+
}
|
|
1293
|
+
function Qn(t, e, n, r) {
|
|
1294
|
+
const s = ye(n), i = t.type && t.type !== "replay_event" ? t.type : "event";
|
|
1295
|
+
qn(t, n?.sdk);
|
|
1296
|
+
const o = Xn(t, s, r, e);
|
|
1297
|
+
return delete t.sdkProcessingMetadata, w(o, [[{ type: i }, t]]);
|
|
1298
|
+
}
|
|
1299
|
+
const Z = 0, Ut = 1, Bt = 2;
|
|
1300
|
+
function v(t) {
|
|
1301
|
+
return new I((e) => {
|
|
1302
|
+
e(t);
|
|
1303
|
+
});
|
|
1304
|
+
}
|
|
1305
|
+
function G(t) {
|
|
1306
|
+
return new I((e, n) => {
|
|
1307
|
+
n(t);
|
|
1308
|
+
});
|
|
1309
|
+
}
|
|
1310
|
+
class I {
|
|
1311
|
+
constructor(e) {
|
|
1312
|
+
this._state = Z, this._handlers = [], this._runExecutor(e);
|
|
1313
|
+
}
|
|
1314
|
+
/** @inheritdoc */
|
|
1315
|
+
then(e, n) {
|
|
1316
|
+
return new I((r, s) => {
|
|
1317
|
+
this._handlers.push([
|
|
1318
|
+
!1,
|
|
1319
|
+
(i) => {
|
|
1320
|
+
if (!e)
|
|
1321
|
+
r(i);
|
|
1322
|
+
else
|
|
1323
|
+
try {
|
|
1324
|
+
r(e(i));
|
|
1325
|
+
} catch (o) {
|
|
1326
|
+
s(o);
|
|
1327
|
+
}
|
|
1328
|
+
},
|
|
1329
|
+
(i) => {
|
|
1330
|
+
if (!n)
|
|
1331
|
+
s(i);
|
|
1332
|
+
else
|
|
1333
|
+
try {
|
|
1334
|
+
r(n(i));
|
|
1335
|
+
} catch (o) {
|
|
1336
|
+
s(o);
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
]), this._executeHandlers();
|
|
1340
|
+
});
|
|
1341
|
+
}
|
|
1342
|
+
/** @inheritdoc */
|
|
1343
|
+
catch(e) {
|
|
1344
|
+
return this.then((n) => n, e);
|
|
1345
|
+
}
|
|
1346
|
+
/** @inheritdoc */
|
|
1347
|
+
finally(e) {
|
|
1348
|
+
return new I((n, r) => {
|
|
1349
|
+
let s, i;
|
|
1350
|
+
return this.then(
|
|
1351
|
+
(o) => {
|
|
1352
|
+
i = !1, s = o, e && e();
|
|
1353
|
+
},
|
|
1354
|
+
(o) => {
|
|
1355
|
+
i = !0, s = o, e && e();
|
|
1356
|
+
}
|
|
1357
|
+
).then(() => {
|
|
1358
|
+
if (i) {
|
|
1359
|
+
r(s);
|
|
1360
|
+
return;
|
|
1361
|
+
}
|
|
1362
|
+
n(s);
|
|
1363
|
+
});
|
|
1364
|
+
});
|
|
1365
|
+
}
|
|
1366
|
+
/** Excute the resolve/reject handlers. */
|
|
1367
|
+
_executeHandlers() {
|
|
1368
|
+
if (this._state === Z)
|
|
1369
|
+
return;
|
|
1370
|
+
const e = this._handlers.slice();
|
|
1371
|
+
this._handlers = [], e.forEach((n) => {
|
|
1372
|
+
n[0] || (this._state === Ut && n[1](this._value), this._state === Bt && n[2](this._value), n[0] = !0);
|
|
1373
|
+
});
|
|
1374
|
+
}
|
|
1375
|
+
/** Run the executor for the SyncPromise. */
|
|
1376
|
+
_runExecutor(e) {
|
|
1377
|
+
const n = (i, o) => {
|
|
1378
|
+
if (this._state === Z) {
|
|
1379
|
+
if (V(o)) {
|
|
1380
|
+
o.then(r, s);
|
|
1381
|
+
return;
|
|
1382
|
+
}
|
|
1383
|
+
this._state = i, this._value = o, this._executeHandlers();
|
|
1384
|
+
}
|
|
1385
|
+
}, r = (i) => {
|
|
1386
|
+
n(Ut, i);
|
|
1387
|
+
}, s = (i) => {
|
|
1388
|
+
n(Bt, i);
|
|
1389
|
+
};
|
|
1390
|
+
try {
|
|
1391
|
+
e(r, s);
|
|
1392
|
+
} catch (i) {
|
|
1393
|
+
s(i);
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
}
|
|
1397
|
+
function ot(t, e, n, r = 0) {
|
|
1398
|
+
return new I((s, i) => {
|
|
1399
|
+
const o = t[r];
|
|
1400
|
+
if (e === null || typeof o != "function")
|
|
1401
|
+
s(e);
|
|
1402
|
+
else {
|
|
1403
|
+
const a = o({ ...e }, n);
|
|
1404
|
+
_ && o.id && a === null && l.log(`Event processor "${o.id}" dropped event`), V(a) ? a.then((c) => ot(t, c, n, r + 1).then(s)).then(null, i) : ot(t, a, n, r + 1).then(s).then(null, i);
|
|
1405
|
+
}
|
|
1406
|
+
});
|
|
1407
|
+
}
|
|
1408
|
+
function tr(t, e) {
|
|
1409
|
+
const { fingerprint: n, span: r, breadcrumbs: s, sdkProcessingMetadata: i } = e;
|
|
1410
|
+
er(t, e), r && sr(t, r), ir(t, n), nr(t, s), rr(t, i);
|
|
1411
|
+
}
|
|
1412
|
+
function Yt(t, e) {
|
|
1413
|
+
const {
|
|
1414
|
+
extra: n,
|
|
1415
|
+
tags: r,
|
|
1416
|
+
user: s,
|
|
1417
|
+
contexts: i,
|
|
1418
|
+
level: o,
|
|
1419
|
+
sdkProcessingMetadata: a,
|
|
1420
|
+
breadcrumbs: c,
|
|
1421
|
+
fingerprint: u,
|
|
1422
|
+
eventProcessors: d,
|
|
1423
|
+
attachments: f,
|
|
1424
|
+
propagationContext: h,
|
|
1425
|
+
transactionName: p,
|
|
1426
|
+
span: m
|
|
1427
|
+
} = e;
|
|
1428
|
+
L(t, "extra", n), L(t, "tags", r), L(t, "user", s), L(t, "contexts", i), t.sdkProcessingMetadata = P(t.sdkProcessingMetadata, a, 2), o && (t.level = o), p && (t.transactionName = p), m && (t.span = m), c.length && (t.breadcrumbs = [...t.breadcrumbs, ...c]), u.length && (t.fingerprint = [...t.fingerprint, ...u]), d.length && (t.eventProcessors = [...t.eventProcessors, ...d]), f.length && (t.attachments = [...t.attachments, ...f]), t.propagationContext = { ...t.propagationContext, ...h };
|
|
1429
|
+
}
|
|
1430
|
+
function L(t, e, n) {
|
|
1431
|
+
t[e] = P(t[e], n, 1);
|
|
1432
|
+
}
|
|
1433
|
+
function er(t, e) {
|
|
1434
|
+
const { extra: n, tags: r, user: s, contexts: i, level: o, transactionName: a } = e;
|
|
1435
|
+
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(i).length && (t.contexts = { ...i, ...t.contexts }), o && (t.level = o), a && t.type !== "transaction" && (t.transaction = a);
|
|
1436
|
+
}
|
|
1437
|
+
function nr(t, e) {
|
|
1438
|
+
const n = [...t.breadcrumbs || [], ...e];
|
|
1439
|
+
t.breadcrumbs = n.length ? n : void 0;
|
|
1440
|
+
}
|
|
1441
|
+
function rr(t, e) {
|
|
1442
|
+
t.sdkProcessingMetadata = {
|
|
1443
|
+
...t.sdkProcessingMetadata,
|
|
1444
|
+
...e
|
|
1445
|
+
};
|
|
1446
|
+
}
|
|
1447
|
+
function sr(t, e) {
|
|
1448
|
+
t.contexts = {
|
|
1449
|
+
trace: In(e),
|
|
1450
|
+
...t.contexts
|
|
1451
|
+
}, t.sdkProcessingMetadata = {
|
|
1452
|
+
dynamicSamplingContext: jn(e),
|
|
1453
|
+
...t.sdkProcessingMetadata
|
|
1454
|
+
};
|
|
1455
|
+
const n = _e(e), r = gt(n).description;
|
|
1456
|
+
r && !t.transaction && t.type === "transaction" && (t.transaction = r);
|
|
1457
|
+
}
|
|
1458
|
+
function ir(t, e) {
|
|
1459
|
+
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;
|
|
1460
|
+
}
|
|
1461
|
+
let $, Gt, F;
|
|
1462
|
+
function or(t) {
|
|
1463
|
+
const e = y._sentryDebugIds;
|
|
1464
|
+
if (!e)
|
|
1465
|
+
return {};
|
|
1466
|
+
const n = Object.keys(e);
|
|
1467
|
+
return F && n.length === Gt || (Gt = n.length, F = n.reduce((r, s) => {
|
|
1468
|
+
$ || ($ = {});
|
|
1469
|
+
const i = $[s];
|
|
1470
|
+
if (i)
|
|
1471
|
+
r[i[0]] = i[1];
|
|
1472
|
+
else {
|
|
1473
|
+
const o = t(s);
|
|
1474
|
+
for (let a = o.length - 1; a >= 0; a--) {
|
|
1475
|
+
const u = o[a]?.filename, d = e[s];
|
|
1476
|
+
if (u && d) {
|
|
1477
|
+
r[u] = d, $[s] = [u, d];
|
|
1478
|
+
break;
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
return r;
|
|
1483
|
+
}, {})), F;
|
|
1484
|
+
}
|
|
1485
|
+
function ar(t, e, n, r, s, i) {
|
|
1486
|
+
const { normalizeDepth: o = 3, normalizeMaxBreadth: a = 1e3 } = t, c = {
|
|
1487
|
+
...e,
|
|
1488
|
+
event_id: e.event_id || n.event_id || E(),
|
|
1489
|
+
timestamp: e.timestamp || H()
|
|
1490
|
+
}, u = n.integrations || t.integrations.map((g) => g.name);
|
|
1491
|
+
cr(c, t), pr(c, u), s && s.emit("applyFrameMetadata", e), e.type === void 0 && ur(c, t.stackParser);
|
|
1492
|
+
const d = lr(r, n.captureContext);
|
|
1493
|
+
n.mechanism && D(c, n.mechanism);
|
|
1494
|
+
const f = s ? s.getEventProcessors() : [], h = on().getScopeData();
|
|
1495
|
+
if (i) {
|
|
1496
|
+
const g = i.getScopeData();
|
|
1497
|
+
Yt(h, g);
|
|
1498
|
+
}
|
|
1499
|
+
if (d) {
|
|
1500
|
+
const g = d.getScopeData();
|
|
1501
|
+
Yt(h, g);
|
|
1502
|
+
}
|
|
1503
|
+
const p = [...n.attachments || [], ...h.attachments];
|
|
1504
|
+
p.length && (n.attachments = p), tr(c, h);
|
|
1505
|
+
const m = [
|
|
1506
|
+
...f,
|
|
1507
|
+
// Run scope event processors _after_ all other processors
|
|
1508
|
+
...h.eventProcessors
|
|
1509
|
+
];
|
|
1510
|
+
return ot(m, c, n).then((g) => (g && fr(g), typeof o == "number" && o > 0 ? dr(g, o, a) : g));
|
|
1511
|
+
}
|
|
1512
|
+
function cr(t, e) {
|
|
1513
|
+
const { environment: n, release: r, dist: s, maxValueLength: i = 250 } = e;
|
|
1514
|
+
t.environment = t.environment || n || mt, !t.release && r && (t.release = r), !t.dist && s && (t.dist = s);
|
|
1515
|
+
const o = t.request;
|
|
1516
|
+
o?.url && (o.url = Y(o.url, i));
|
|
1517
|
+
}
|
|
1518
|
+
function ur(t, e) {
|
|
1519
|
+
const n = or(e);
|
|
1520
|
+
t.exception?.values?.forEach((r) => {
|
|
1521
|
+
r.stacktrace?.frames?.forEach((s) => {
|
|
1522
|
+
s.filename && (s.debug_id = n[s.filename]);
|
|
1523
|
+
});
|
|
1524
|
+
});
|
|
1525
|
+
}
|
|
1526
|
+
function fr(t) {
|
|
1527
|
+
const e = {};
|
|
1528
|
+
if (t.exception?.values?.forEach((r) => {
|
|
1529
|
+
r.stacktrace?.frames?.forEach((s) => {
|
|
1530
|
+
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);
|
|
1531
|
+
});
|
|
1532
|
+
}), Object.keys(e).length === 0)
|
|
1533
|
+
return;
|
|
1534
|
+
t.debug_meta = t.debug_meta || {}, t.debug_meta.images = t.debug_meta.images || [];
|
|
1535
|
+
const n = t.debug_meta.images;
|
|
1536
|
+
Object.entries(e).forEach(([r, s]) => {
|
|
1537
|
+
n.push({
|
|
1538
|
+
type: "sourcemap",
|
|
1539
|
+
code_file: r,
|
|
1540
|
+
debug_id: s
|
|
1541
|
+
});
|
|
1542
|
+
});
|
|
1543
|
+
}
|
|
1544
|
+
function pr(t, e) {
|
|
1545
|
+
e.length > 0 && (t.sdk = t.sdk || {}, t.sdk.integrations = [...t.sdk.integrations || [], ...e]);
|
|
1546
|
+
}
|
|
1547
|
+
function dr(t, e, n) {
|
|
1548
|
+
if (!t)
|
|
1549
|
+
return null;
|
|
1550
|
+
const r = {
|
|
1551
|
+
...t,
|
|
1552
|
+
...t.breadcrumbs && {
|
|
1553
|
+
breadcrumbs: t.breadcrumbs.map((s) => ({
|
|
1554
|
+
...s,
|
|
1555
|
+
...s.data && {
|
|
1556
|
+
data: S(s.data, e, n)
|
|
1557
|
+
}
|
|
1558
|
+
}))
|
|
1559
|
+
},
|
|
1560
|
+
...t.user && {
|
|
1561
|
+
user: S(t.user, e, n)
|
|
1562
|
+
},
|
|
1563
|
+
...t.contexts && {
|
|
1564
|
+
contexts: S(t.contexts, e, n)
|
|
1565
|
+
},
|
|
1566
|
+
...t.extra && {
|
|
1567
|
+
extra: S(t.extra, e, n)
|
|
1568
|
+
}
|
|
1569
|
+
};
|
|
1570
|
+
return t.contexts?.trace && r.contexts && (r.contexts.trace = t.contexts.trace, t.contexts.trace.data && (r.contexts.trace.data = S(t.contexts.trace.data, e, n))), t.spans && (r.spans = t.spans.map((s) => ({
|
|
1571
|
+
...s,
|
|
1572
|
+
...s.data && {
|
|
1573
|
+
data: S(s.data, e, n)
|
|
1574
|
+
}
|
|
1575
|
+
}))), t.contexts?.flags && r.contexts && (r.contexts.flags = S(t.contexts.flags, 3, n)), r;
|
|
1576
|
+
}
|
|
1577
|
+
function lr(t, e) {
|
|
1578
|
+
if (!e)
|
|
1579
|
+
return t;
|
|
1580
|
+
const n = t ? t.clone() : new b();
|
|
1581
|
+
return n.update(e), n;
|
|
1582
|
+
}
|
|
1583
|
+
const _r = "7";
|
|
1584
|
+
function hr(t) {
|
|
1585
|
+
const e = t.protocol ? `${t.protocol}:` : "", n = t.port ? `:${t.port}` : "";
|
|
1586
|
+
return `${e}//${t.host}${n}${t.path ? `/${t.path}` : ""}/api/`;
|
|
1587
|
+
}
|
|
1588
|
+
function gr(t) {
|
|
1589
|
+
return `${hr(t)}${t.projectId}/envelope/`;
|
|
1590
|
+
}
|
|
1591
|
+
function mr(t, e) {
|
|
1592
|
+
const n = {
|
|
1593
|
+
sentry_version: _r
|
|
1594
|
+
};
|
|
1595
|
+
return t.publicKey && (n.sentry_key = t.publicKey), e && (n.sentry_client = `${e.name}/${e.version}`), new URLSearchParams(n).toString();
|
|
1596
|
+
}
|
|
1597
|
+
function yr(t, e, n) {
|
|
1598
|
+
return e || `${gr(t)}?${mr(t, n)}`;
|
|
1599
|
+
}
|
|
1600
|
+
const zt = [];
|
|
1601
|
+
function Er(t, e) {
|
|
1602
|
+
const n = {};
|
|
1603
|
+
return e.forEach((r) => {
|
|
1604
|
+
r && Ee(t, r, n);
|
|
1605
|
+
}), n;
|
|
1606
|
+
}
|
|
1607
|
+
function Wt(t, e) {
|
|
1608
|
+
for (const n of e)
|
|
1609
|
+
n?.afterAllSetup && n.afterAllSetup(t);
|
|
1610
|
+
}
|
|
1611
|
+
function Ee(t, e, n) {
|
|
1612
|
+
if (n[e.name]) {
|
|
1613
|
+
_ && l.log(`Integration skipped because it was already installed: ${e.name}`);
|
|
1614
|
+
return;
|
|
1615
|
+
}
|
|
1616
|
+
if (n[e.name] = e, zt.indexOf(e.name) === -1 && typeof e.setupOnce == "function" && (e.setupOnce(), zt.push(e.name)), e.setup && typeof e.setup == "function" && e.setup(t), typeof e.preprocessEvent == "function") {
|
|
1617
|
+
const r = e.preprocessEvent.bind(e);
|
|
1618
|
+
t.on("preprocessEvent", (s, i) => r(s, i, t));
|
|
1619
|
+
}
|
|
1620
|
+
if (typeof e.processEvent == "function") {
|
|
1621
|
+
const r = e.processEvent.bind(e), s = Object.assign((i, o) => r(i, o, t), {
|
|
1622
|
+
id: e.name
|
|
1623
|
+
});
|
|
1624
|
+
t.addEventProcessor(s);
|
|
1625
|
+
}
|
|
1626
|
+
_ && l.log(`Integration installed: ${e.name}`);
|
|
1627
|
+
}
|
|
1628
|
+
function Sr(t, e, n) {
|
|
1629
|
+
const r = [
|
|
1630
|
+
{ type: "client_report" },
|
|
1631
|
+
{
|
|
1632
|
+
timestamp: H(),
|
|
1633
|
+
discarded_events: t
|
|
1634
|
+
}
|
|
1635
|
+
];
|
|
1636
|
+
return w(e ? { dsn: e } : {}, [r]);
|
|
1637
|
+
}
|
|
1638
|
+
function br(t) {
|
|
1639
|
+
const e = [];
|
|
1640
|
+
t.message && e.push(t.message);
|
|
1641
|
+
try {
|
|
1642
|
+
const n = t.exception.values[t.exception.values.length - 1];
|
|
1643
|
+
n?.value && (e.push(n.value), n.type && e.push(`${n.type}: ${n.value}`));
|
|
1644
|
+
} catch {
|
|
1645
|
+
}
|
|
1646
|
+
return e;
|
|
1647
|
+
}
|
|
1648
|
+
function Ir(t) {
|
|
1649
|
+
const { trace_id: e, parent_span_id: n, span_id: r, status: s, origin: i, data: o, op: a } = t.contexts?.trace ?? {};
|
|
1650
|
+
return {
|
|
1651
|
+
data: o ?? {},
|
|
1652
|
+
description: t.transaction,
|
|
1653
|
+
op: a,
|
|
1654
|
+
parent_span_id: n,
|
|
1655
|
+
span_id: r ?? "",
|
|
1656
|
+
start_timestamp: t.start_timestamp ?? 0,
|
|
1657
|
+
status: s,
|
|
1658
|
+
timestamp: t.timestamp,
|
|
1659
|
+
trace_id: e ?? "",
|
|
1660
|
+
origin: i,
|
|
1661
|
+
profile_id: o?.[fe],
|
|
1662
|
+
exclusive_time: o?.[pe],
|
|
1663
|
+
measurements: t.measurements,
|
|
1664
|
+
is_segment: !0
|
|
1665
|
+
};
|
|
1666
|
+
}
|
|
1667
|
+
function Tr(t) {
|
|
1668
|
+
return {
|
|
1669
|
+
type: "transaction",
|
|
1670
|
+
timestamp: t.timestamp,
|
|
1671
|
+
start_timestamp: t.start_timestamp,
|
|
1672
|
+
transaction: t.description,
|
|
1673
|
+
contexts: {
|
|
1674
|
+
trace: {
|
|
1675
|
+
trace_id: t.trace_id,
|
|
1676
|
+
span_id: t.span_id,
|
|
1677
|
+
parent_span_id: t.parent_span_id,
|
|
1678
|
+
op: t.op,
|
|
1679
|
+
status: t.status,
|
|
1680
|
+
origin: t.origin,
|
|
1681
|
+
data: {
|
|
1682
|
+
...t.data,
|
|
1683
|
+
...t.profile_id && { [fe]: t.profile_id },
|
|
1684
|
+
...t.exclusive_time && { [pe]: t.exclusive_time }
|
|
1685
|
+
}
|
|
1686
|
+
}
|
|
1687
|
+
},
|
|
1688
|
+
measurements: t.measurements
|
|
1689
|
+
};
|
|
1690
|
+
}
|
|
1691
|
+
const Vt = "Not capturing exception because it's already been captured.", Kt = "Discarded session because of missing or non-string release", Se = Symbol.for("SentryInternalError"), be = Symbol.for("SentryDoNotSendEventError");
|
|
1692
|
+
function U(t) {
|
|
1693
|
+
return {
|
|
1694
|
+
message: t,
|
|
1695
|
+
[Se]: !0
|
|
1696
|
+
};
|
|
1697
|
+
}
|
|
1698
|
+
function Q(t) {
|
|
1699
|
+
return {
|
|
1700
|
+
message: t,
|
|
1701
|
+
[be]: !0
|
|
1702
|
+
};
|
|
1703
|
+
}
|
|
1704
|
+
function Ht(t) {
|
|
1705
|
+
return !!t && typeof t == "object" && Se in t;
|
|
1706
|
+
}
|
|
1707
|
+
function Jt(t) {
|
|
1708
|
+
return !!t && typeof t == "object" && be in t;
|
|
1709
|
+
}
|
|
1710
|
+
class vr {
|
|
1711
|
+
/** Options passed to the SDK. */
|
|
1712
|
+
/** The client Dsn, if specified in options. Without this Dsn, the SDK will be disabled. */
|
|
1713
|
+
/** Array of set up integrations. */
|
|
1714
|
+
/** Number of calls being processed */
|
|
1715
|
+
/** Holds flushable */
|
|
1716
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
1717
|
+
/**
|
|
1718
|
+
* Initializes this client instance.
|
|
1719
|
+
*
|
|
1720
|
+
* @param options Options for the client.
|
|
1721
|
+
*/
|
|
1722
|
+
constructor(e) {
|
|
1723
|
+
if (this._options = e, this._integrations = {}, this._numProcessing = 0, this._outcomes = {}, this._hooks = {}, this._eventProcessors = [], e.dsn ? this._dsn = Ln(e.dsn) : _ && l.warn("No DSN provided, client will not send events."), this._dsn) {
|
|
1724
|
+
const n = yr(
|
|
1725
|
+
this._dsn,
|
|
1726
|
+
e.tunnel,
|
|
1727
|
+
e._metadata ? e._metadata.sdk : void 0
|
|
1728
|
+
);
|
|
1729
|
+
this._transport = e.transport({
|
|
1730
|
+
tunnel: this._options.tunnel,
|
|
1731
|
+
recordDroppedEvent: this.recordDroppedEvent.bind(this),
|
|
1732
|
+
...e.transportOptions,
|
|
1733
|
+
url: n
|
|
1734
|
+
});
|
|
1735
|
+
}
|
|
1736
|
+
}
|
|
1737
|
+
/**
|
|
1738
|
+
* Captures an exception event and sends it to Sentry.
|
|
1739
|
+
*
|
|
1740
|
+
* Unlike `captureException` exported from every SDK, this method requires that you pass it the current scope.
|
|
1741
|
+
*/
|
|
1742
|
+
captureException(e, n, r) {
|
|
1743
|
+
const s = E();
|
|
1744
|
+
if (Rt(e))
|
|
1745
|
+
return _ && l.log(Vt), s;
|
|
1746
|
+
const i = {
|
|
1747
|
+
event_id: s,
|
|
1748
|
+
...n
|
|
1749
|
+
};
|
|
1750
|
+
return this._process(
|
|
1751
|
+
this.eventFromException(e, i).then(
|
|
1752
|
+
(o) => this._captureEvent(o, i, r)
|
|
1753
|
+
)
|
|
1754
|
+
), i.event_id;
|
|
1755
|
+
}
|
|
1756
|
+
/**
|
|
1757
|
+
* Captures a message event and sends it to Sentry.
|
|
1758
|
+
*
|
|
1759
|
+
* Unlike `captureMessage` exported from every SDK, this method requires that you pass it the current scope.
|
|
1760
|
+
*/
|
|
1761
|
+
captureMessage(e, n, r, s) {
|
|
1762
|
+
const i = {
|
|
1763
|
+
event_id: E(),
|
|
1764
|
+
...r
|
|
1765
|
+
}, o = _t(e) ? e : String(e), a = Fe(e) ? this.eventFromMessage(o, n, i) : this.eventFromException(e, i);
|
|
1766
|
+
return this._process(a.then((c) => this._captureEvent(c, i, s))), i.event_id;
|
|
1767
|
+
}
|
|
1768
|
+
/**
|
|
1769
|
+
* Captures a manually created event and sends it to Sentry.
|
|
1770
|
+
*
|
|
1771
|
+
* Unlike `captureEvent` exported from every SDK, this method requires that you pass it the current scope.
|
|
1772
|
+
*/
|
|
1773
|
+
captureEvent(e, n, r) {
|
|
1774
|
+
const s = E();
|
|
1775
|
+
if (n?.originalException && Rt(n.originalException))
|
|
1776
|
+
return _ && l.log(Vt), s;
|
|
1777
|
+
const i = {
|
|
1778
|
+
event_id: s,
|
|
1779
|
+
...n
|
|
1780
|
+
}, o = e.sdkProcessingMetadata || {}, a = o.capturedSpanScope, c = o.capturedSpanIsolationScope;
|
|
1781
|
+
return this._process(
|
|
1782
|
+
this._captureEvent(e, i, a || r, c)
|
|
1783
|
+
), i.event_id;
|
|
1784
|
+
}
|
|
1785
|
+
/**
|
|
1786
|
+
* Captures a session.
|
|
1787
|
+
*/
|
|
1788
|
+
captureSession(e) {
|
|
1789
|
+
this.sendSession(e), nt(e, { init: !1 });
|
|
1790
|
+
}
|
|
1791
|
+
/**
|
|
1792
|
+
* Create a cron monitor check in and send it to Sentry. This method is not available on all clients.
|
|
1793
|
+
*
|
|
1794
|
+
* @param checkIn An object that describes a check in.
|
|
1795
|
+
* @param upsertMonitorConfig An optional object that describes a monitor config. Use this if you want
|
|
1796
|
+
* to create a monitor automatically when sending a check in.
|
|
1797
|
+
* @param scope An optional scope containing event metadata.
|
|
1798
|
+
* @returns A string representing the id of the check in.
|
|
1799
|
+
*/
|
|
1800
|
+
/**
|
|
1801
|
+
* Get the current Dsn.
|
|
1802
|
+
*/
|
|
1803
|
+
getDsn() {
|
|
1804
|
+
return this._dsn;
|
|
1805
|
+
}
|
|
1806
|
+
/**
|
|
1807
|
+
* Get the current options.
|
|
1808
|
+
*/
|
|
1809
|
+
getOptions() {
|
|
1810
|
+
return this._options;
|
|
1811
|
+
}
|
|
1812
|
+
/**
|
|
1813
|
+
* Get the SDK metadata.
|
|
1814
|
+
* @see SdkMetadata
|
|
1815
|
+
*/
|
|
1816
|
+
getSdkMetadata() {
|
|
1817
|
+
return this._options._metadata;
|
|
1818
|
+
}
|
|
1819
|
+
/**
|
|
1820
|
+
* Returns the transport that is used by the client.
|
|
1821
|
+
* Please note that the transport gets lazy initialized so it will only be there once the first event has been sent.
|
|
1822
|
+
*/
|
|
1823
|
+
getTransport() {
|
|
1824
|
+
return this._transport;
|
|
1825
|
+
}
|
|
1826
|
+
/**
|
|
1827
|
+
* Wait for all events to be sent or the timeout to expire, whichever comes first.
|
|
1828
|
+
*
|
|
1829
|
+
* @param timeout Maximum time in ms the client should wait for events to be flushed. Omitting this parameter will
|
|
1830
|
+
* cause the client to wait until all events are sent before resolving the promise.
|
|
1831
|
+
* @returns A promise that will resolve with `true` if all events are sent before the timeout, or `false` if there are
|
|
1832
|
+
* still events in the queue when the timeout is reached.
|
|
1833
|
+
*/
|
|
1834
|
+
flush(e) {
|
|
1835
|
+
const n = this._transport;
|
|
1836
|
+
return n ? (this.emit("flush"), this._isClientDoneProcessing(e).then((r) => n.flush(e).then((s) => r && s))) : v(!0);
|
|
1837
|
+
}
|
|
1838
|
+
/**
|
|
1839
|
+
* Flush the event queue and set the client to `enabled = false`. See {@link Client.flush}.
|
|
1840
|
+
*
|
|
1841
|
+
* @param {number} timeout Maximum time in ms the client should wait before shutting down. Omitting this parameter will cause
|
|
1842
|
+
* the client to wait until all events are sent before disabling itself.
|
|
1843
|
+
* @returns {Promise<boolean>} A promise which resolves to `true` if the flush completes successfully before the timeout, or `false` if
|
|
1844
|
+
* it doesn't.
|
|
1845
|
+
*/
|
|
1846
|
+
close(e) {
|
|
1847
|
+
return this.flush(e).then((n) => (this.getOptions().enabled = !1, this.emit("close"), n));
|
|
1848
|
+
}
|
|
1849
|
+
/**
|
|
1850
|
+
* Get all installed event processors.
|
|
1851
|
+
*/
|
|
1852
|
+
getEventProcessors() {
|
|
1853
|
+
return this._eventProcessors;
|
|
1854
|
+
}
|
|
1855
|
+
/**
|
|
1856
|
+
* Adds an event processor that applies to any event processed by this client.
|
|
1857
|
+
*/
|
|
1858
|
+
addEventProcessor(e) {
|
|
1859
|
+
this._eventProcessors.push(e);
|
|
1860
|
+
}
|
|
1861
|
+
/**
|
|
1862
|
+
* Initialize this client.
|
|
1863
|
+
* Call this after the client was set on a scope.
|
|
1864
|
+
*/
|
|
1865
|
+
init() {
|
|
1866
|
+
(this._isEnabled() || // Force integrations to be setup even if no DSN was set when we have
|
|
1867
|
+
// Spotlight enabled. This is particularly important for browser as we
|
|
1868
|
+
// don't support the `spotlight` option there and rely on the users
|
|
1869
|
+
// adding the `spotlightBrowserIntegration()` to their integrations which
|
|
1870
|
+
// wouldn't get initialized with the check below when there's no DSN set.
|
|
1871
|
+
this._options.integrations.some(({ name: e }) => e.startsWith("Spotlight"))) && this._setupIntegrations();
|
|
1872
|
+
}
|
|
1873
|
+
/**
|
|
1874
|
+
* Gets an installed integration by its name.
|
|
1875
|
+
*
|
|
1876
|
+
* @returns {Integration|undefined} The installed integration or `undefined` if no integration with that `name` was installed.
|
|
1877
|
+
*/
|
|
1878
|
+
getIntegrationByName(e) {
|
|
1879
|
+
return this._integrations[e];
|
|
1880
|
+
}
|
|
1881
|
+
/**
|
|
1882
|
+
* Add an integration to the client.
|
|
1883
|
+
* This can be used to e.g. lazy load integrations.
|
|
1884
|
+
* In most cases, this should not be necessary,
|
|
1885
|
+
* and you're better off just passing the integrations via `integrations: []` at initialization time.
|
|
1886
|
+
* However, if you find the need to conditionally load & add an integration, you can use `addIntegration` to do so.
|
|
1887
|
+
*/
|
|
1888
|
+
addIntegration(e) {
|
|
1889
|
+
const n = this._integrations[e.name];
|
|
1890
|
+
Ee(this, e, this._integrations), n || Wt(this, [e]);
|
|
1891
|
+
}
|
|
1892
|
+
/**
|
|
1893
|
+
* Send a fully prepared event to Sentry.
|
|
1894
|
+
*/
|
|
1895
|
+
sendEvent(e, n = {}) {
|
|
1896
|
+
this.emit("beforeSendEvent", e, n);
|
|
1897
|
+
let r = Qn(e, this._dsn, this._options._metadata, this._options.tunnel);
|
|
1898
|
+
for (const i of n.attachments || [])
|
|
1899
|
+
r = Wn(r, Hn(i));
|
|
1900
|
+
const s = this.sendEnvelope(r);
|
|
1901
|
+
s && s.then((i) => this.emit("afterSendEvent", e, i), null);
|
|
1902
|
+
}
|
|
1903
|
+
/**
|
|
1904
|
+
* Send a session or session aggregrates to Sentry.
|
|
1905
|
+
*/
|
|
1906
|
+
sendSession(e) {
|
|
1907
|
+
const { release: n, environment: r = mt } = this._options;
|
|
1908
|
+
if ("aggregates" in e) {
|
|
1909
|
+
const i = e.attrs || {};
|
|
1910
|
+
if (!i.release && !n) {
|
|
1911
|
+
_ && l.warn(Kt);
|
|
1912
|
+
return;
|
|
1913
|
+
}
|
|
1914
|
+
i.release = i.release || n, i.environment = i.environment || r, e.attrs = i;
|
|
1915
|
+
} else {
|
|
1916
|
+
if (!e.release && !n) {
|
|
1917
|
+
_ && l.warn(Kt);
|
|
1918
|
+
return;
|
|
1919
|
+
}
|
|
1920
|
+
e.release = e.release || n, e.environment = e.environment || r;
|
|
1921
|
+
}
|
|
1922
|
+
this.emit("beforeSendSession", e);
|
|
1923
|
+
const s = Zn(e, this._dsn, this._options._metadata, this._options.tunnel);
|
|
1924
|
+
this.sendEnvelope(s);
|
|
1925
|
+
}
|
|
1926
|
+
/**
|
|
1927
|
+
* Record on the client that an event got dropped (ie, an event that will not be sent to Sentry).
|
|
1928
|
+
*/
|
|
1929
|
+
recordDroppedEvent(e, n, r = 1) {
|
|
1930
|
+
if (this._options.sendClientReports) {
|
|
1931
|
+
const s = `${e}:${n}`;
|
|
1932
|
+
_ && l.log(`Recording outcome: "${s}"${r > 1 ? ` (${r} times)` : ""}`), this._outcomes[s] = (this._outcomes[s] || 0) + r;
|
|
1933
|
+
}
|
|
1934
|
+
}
|
|
1935
|
+
/* eslint-disable @typescript-eslint/unified-signatures */
|
|
1936
|
+
/**
|
|
1937
|
+
* Register a callback for whenever a span is started.
|
|
1938
|
+
* Receives the span as argument.
|
|
1939
|
+
* @returns {() => void} A function that, when executed, removes the registered callback.
|
|
1940
|
+
*/
|
|
1941
|
+
/**
|
|
1942
|
+
* Register a hook on this client.
|
|
1943
|
+
*/
|
|
1944
|
+
on(e, n) {
|
|
1945
|
+
const r = this._hooks[e] = this._hooks[e] || [];
|
|
1946
|
+
return r.push(n), () => {
|
|
1947
|
+
const s = r.indexOf(n);
|
|
1948
|
+
s > -1 && r.splice(s, 1);
|
|
1949
|
+
};
|
|
1950
|
+
}
|
|
1951
|
+
/** Fire a hook whenever a span starts. */
|
|
1952
|
+
/**
|
|
1953
|
+
* Emit a hook that was previously registered via `on()`.
|
|
1954
|
+
*/
|
|
1955
|
+
emit(e, ...n) {
|
|
1956
|
+
const r = this._hooks[e];
|
|
1957
|
+
r && r.forEach((s) => s(...n));
|
|
1958
|
+
}
|
|
1959
|
+
/**
|
|
1960
|
+
* Send an envelope to Sentry.
|
|
1961
|
+
*/
|
|
1962
|
+
sendEnvelope(e) {
|
|
1963
|
+
return this.emit("beforeEnvelope", e), this._isEnabled() && this._transport ? this._transport.send(e).then(null, (n) => (_ && l.error("Error while sending envelope:", n), n)) : (_ && l.error("Transport disabled"), v({}));
|
|
1964
|
+
}
|
|
1965
|
+
/* eslint-enable @typescript-eslint/unified-signatures */
|
|
1966
|
+
/** Setup integrations for this client. */
|
|
1967
|
+
_setupIntegrations() {
|
|
1968
|
+
const { integrations: e } = this._options;
|
|
1969
|
+
this._integrations = Er(this, e), Wt(this, e);
|
|
1970
|
+
}
|
|
1971
|
+
/** Updates existing session based on the provided event */
|
|
1972
|
+
_updateSessionFromEvent(e, n) {
|
|
1973
|
+
let r = n.level === "fatal", s = !1;
|
|
1974
|
+
const i = n.exception?.values;
|
|
1975
|
+
if (i) {
|
|
1976
|
+
s = !0;
|
|
1977
|
+
for (const c of i)
|
|
1978
|
+
if (c.mechanism?.handled === !1) {
|
|
1979
|
+
r = !0;
|
|
1980
|
+
break;
|
|
1981
|
+
}
|
|
1982
|
+
}
|
|
1983
|
+
const o = e.status === "ok";
|
|
1984
|
+
(o && e.errors === 0 || o && r) && (nt(e, {
|
|
1985
|
+
...r && { status: "crashed" },
|
|
1986
|
+
errors: e.errors || Number(s || r)
|
|
1987
|
+
}), this.captureSession(e));
|
|
1988
|
+
}
|
|
1989
|
+
/**
|
|
1990
|
+
* Determine if the client is finished processing. Returns a promise because it will wait `timeout` ms before saying
|
|
1991
|
+
* "no" (resolving to `false`) in order to give the client a chance to potentially finish first.
|
|
1992
|
+
*
|
|
1993
|
+
* @param timeout The time, in ms, after which to resolve to `false` if the client is still busy. Passing `0` (or not
|
|
1994
|
+
* passing anything) will make the promise wait as long as it takes for processing to finish before resolving to
|
|
1995
|
+
* `true`.
|
|
1996
|
+
* @returns A promise which will resolve to `true` if processing is already done or finishes before the timeout, and
|
|
1997
|
+
* `false` otherwise
|
|
1998
|
+
*/
|
|
1999
|
+
_isClientDoneProcessing(e) {
|
|
2000
|
+
return new I((n) => {
|
|
2001
|
+
let r = 0;
|
|
2002
|
+
const s = 1, i = setInterval(() => {
|
|
2003
|
+
this._numProcessing == 0 ? (clearInterval(i), n(!0)) : (r += s, e && r >= e && (clearInterval(i), n(!1)));
|
|
2004
|
+
}, s);
|
|
2005
|
+
});
|
|
2006
|
+
}
|
|
2007
|
+
/** Determines whether this SDK is enabled and a transport is present. */
|
|
2008
|
+
_isEnabled() {
|
|
2009
|
+
return this.getOptions().enabled !== !1 && this._transport !== void 0;
|
|
2010
|
+
}
|
|
2011
|
+
/**
|
|
2012
|
+
* Adds common information to events.
|
|
2013
|
+
*
|
|
2014
|
+
* The information includes release and environment from `options`,
|
|
2015
|
+
* breadcrumbs and context (extra, tags and user) from the scope.
|
|
2016
|
+
*
|
|
2017
|
+
* Information that is already present in the event is never overwritten. For
|
|
2018
|
+
* nested objects, such as the context, keys are merged.
|
|
2019
|
+
*
|
|
2020
|
+
* @param event The original event.
|
|
2021
|
+
* @param hint May contain additional information about the original exception.
|
|
2022
|
+
* @param currentScope A scope containing event metadata.
|
|
2023
|
+
* @returns A new event with more information.
|
|
2024
|
+
*/
|
|
2025
|
+
_prepareEvent(e, n, r, s) {
|
|
2026
|
+
const i = this.getOptions(), o = Object.keys(this._integrations);
|
|
2027
|
+
return !n.integrations && o?.length && (n.integrations = o), this.emit("preprocessEvent", e, n), e.type || s.setLastEventId(e.event_id || n.event_id), ar(i, e, n, r, this, s).then((a) => {
|
|
2028
|
+
if (a === null)
|
|
2029
|
+
return a;
|
|
2030
|
+
this.emit("postprocessEvent", a, n), a.contexts = {
|
|
2031
|
+
trace: an(r),
|
|
2032
|
+
...a.contexts
|
|
2033
|
+
};
|
|
2034
|
+
const c = Fn(this, r);
|
|
2035
|
+
return a.sdkProcessingMetadata = {
|
|
2036
|
+
dynamicSamplingContext: c,
|
|
2037
|
+
...a.sdkProcessingMetadata
|
|
2038
|
+
}, a;
|
|
2039
|
+
});
|
|
2040
|
+
}
|
|
2041
|
+
/**
|
|
2042
|
+
* Processes the event and logs an error in case of rejection
|
|
2043
|
+
* @param event
|
|
2044
|
+
* @param hint
|
|
2045
|
+
* @param scope
|
|
2046
|
+
*/
|
|
2047
|
+
_captureEvent(e, n = {}, r = ue(), s = sn()) {
|
|
2048
|
+
return _ && at(e) && l.log(`Captured error event \`${br(e)[0] || "<unknown>"}\``), this._processEvent(e, n, r, s).then(
|
|
2049
|
+
(i) => i.event_id,
|
|
2050
|
+
(i) => {
|
|
2051
|
+
_ && (Jt(i) ? l.log(i.message) : Ht(i) ? l.warn(i.message) : l.warn(i));
|
|
2052
|
+
}
|
|
2053
|
+
);
|
|
2054
|
+
}
|
|
2055
|
+
/**
|
|
2056
|
+
* Processes an event (either error or message) and sends it to Sentry.
|
|
2057
|
+
*
|
|
2058
|
+
* This also adds breadcrumbs and context information to the event. However,
|
|
2059
|
+
* platform specific meta data (such as the User's IP address) must be added
|
|
2060
|
+
* by the SDK implementor.
|
|
2061
|
+
*
|
|
2062
|
+
*
|
|
2063
|
+
* @param event The event to send to Sentry.
|
|
2064
|
+
* @param hint May contain additional information about the original exception.
|
|
2065
|
+
* @param currentScope A scope containing event metadata.
|
|
2066
|
+
* @returns A SyncPromise that resolves with the event or rejects in case event was/will not be send.
|
|
2067
|
+
*/
|
|
2068
|
+
_processEvent(e, n, r, s) {
|
|
2069
|
+
const i = this.getOptions(), { sampleRate: o } = i, a = Ie(e), c = at(e), u = e.type || "error", d = `before send for type \`${u}\``, f = typeof o > "u" ? void 0 : bn(o);
|
|
2070
|
+
if (c && typeof f == "number" && Math.random() > f)
|
|
2071
|
+
return this.recordDroppedEvent("sample_rate", "error"), G(
|
|
2072
|
+
Q(
|
|
2073
|
+
`Discarding event because it's not included in the random sample (sampling rate = ${o})`
|
|
2074
|
+
)
|
|
2075
|
+
);
|
|
2076
|
+
const h = u === "replay_event" ? "replay" : u;
|
|
2077
|
+
return this._prepareEvent(e, n, r, s).then((p) => {
|
|
2078
|
+
if (p === null)
|
|
2079
|
+
throw this.recordDroppedEvent("event_processor", h), Q("An event processor returned `null`, will not send event.");
|
|
2080
|
+
if (n.data && n.data.__sentry__ === !0)
|
|
2081
|
+
return p;
|
|
2082
|
+
const R = Ar(this, i, p, n);
|
|
2083
|
+
return kr(R, d);
|
|
2084
|
+
}).then((p) => {
|
|
2085
|
+
if (p === null) {
|
|
2086
|
+
if (this.recordDroppedEvent("before_send", h), a) {
|
|
2087
|
+
const X = 1 + (e.spans || []).length;
|
|
2088
|
+
this.recordDroppedEvent("before_send", "span", X);
|
|
2089
|
+
}
|
|
2090
|
+
throw Q(`${d} returned \`null\`, will not send event.`);
|
|
2091
|
+
}
|
|
2092
|
+
const m = r.getSession() || s.getSession();
|
|
2093
|
+
if (c && m && this._updateSessionFromEvent(m, p), a) {
|
|
2094
|
+
const g = p.sdkProcessingMetadata?.spanCountBeforeProcessing || 0, X = p.spans ? p.spans.length : 0, Et = g - X;
|
|
2095
|
+
Et > 0 && this.recordDroppedEvent("before_send", "span", Et);
|
|
2096
|
+
}
|
|
2097
|
+
const R = p.transaction_info;
|
|
2098
|
+
if (a && R && p.transaction !== e.transaction) {
|
|
2099
|
+
const g = "custom";
|
|
2100
|
+
p.transaction_info = {
|
|
2101
|
+
...R,
|
|
2102
|
+
source: g
|
|
2103
|
+
};
|
|
2104
|
+
}
|
|
2105
|
+
return this.sendEvent(p, n), p;
|
|
2106
|
+
}).then(null, (p) => {
|
|
2107
|
+
throw Jt(p) || Ht(p) ? p : (this.captureException(p, {
|
|
2108
|
+
data: {
|
|
2109
|
+
__sentry__: !0
|
|
2110
|
+
},
|
|
2111
|
+
originalException: p
|
|
2112
|
+
}), U(
|
|
2113
|
+
`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
2114
|
+
Reason: ${p}`
|
|
2115
|
+
));
|
|
2116
|
+
});
|
|
2117
|
+
}
|
|
2118
|
+
/**
|
|
2119
|
+
* Occupies the client with processing and event
|
|
2120
|
+
*/
|
|
2121
|
+
_process(e) {
|
|
2122
|
+
this._numProcessing++, e.then(
|
|
2123
|
+
(n) => (this._numProcessing--, n),
|
|
2124
|
+
(n) => (this._numProcessing--, n)
|
|
2125
|
+
);
|
|
2126
|
+
}
|
|
2127
|
+
/**
|
|
2128
|
+
* Clears outcomes on this client and returns them.
|
|
2129
|
+
*/
|
|
2130
|
+
_clearOutcomes() {
|
|
2131
|
+
const e = this._outcomes;
|
|
2132
|
+
return this._outcomes = {}, Object.entries(e).map(([n, r]) => {
|
|
2133
|
+
const [s, i] = n.split(":");
|
|
2134
|
+
return {
|
|
2135
|
+
reason: s,
|
|
2136
|
+
category: i,
|
|
2137
|
+
quantity: r
|
|
2138
|
+
};
|
|
2139
|
+
});
|
|
2140
|
+
}
|
|
2141
|
+
/**
|
|
2142
|
+
* Sends client reports as an envelope.
|
|
2143
|
+
*/
|
|
2144
|
+
_flushOutcomes() {
|
|
2145
|
+
_ && l.log("Flushing outcomes...");
|
|
2146
|
+
const e = this._clearOutcomes();
|
|
2147
|
+
if (e.length === 0) {
|
|
2148
|
+
_ && l.log("No outcomes to send");
|
|
2149
|
+
return;
|
|
2150
|
+
}
|
|
2151
|
+
if (!this._dsn) {
|
|
2152
|
+
_ && l.log("No dsn provided, will not send outcomes");
|
|
2153
|
+
return;
|
|
2154
|
+
}
|
|
2155
|
+
_ && l.log("Sending outcomes:", e);
|
|
2156
|
+
const n = Sr(e, this._options.tunnel && J(this._dsn));
|
|
2157
|
+
this.sendEnvelope(n);
|
|
2158
|
+
}
|
|
2159
|
+
/**
|
|
2160
|
+
* Creates an {@link Event} from all inputs to `captureException` and non-primitive inputs to `captureMessage`.
|
|
2161
|
+
*/
|
|
2162
|
+
}
|
|
2163
|
+
function kr(t, e) {
|
|
2164
|
+
const n = `${e} must return \`null\` or a valid event.`;
|
|
2165
|
+
if (V(t))
|
|
2166
|
+
return t.then(
|
|
2167
|
+
(r) => {
|
|
2168
|
+
if (!N(r) && r !== null)
|
|
2169
|
+
throw U(n);
|
|
2170
|
+
return r;
|
|
2171
|
+
},
|
|
2172
|
+
(r) => {
|
|
2173
|
+
throw U(`${e} rejected with ${r}`);
|
|
2174
|
+
}
|
|
2175
|
+
);
|
|
2176
|
+
if (!N(t) && t !== null)
|
|
2177
|
+
throw U(n);
|
|
2178
|
+
return t;
|
|
2179
|
+
}
|
|
2180
|
+
function Ar(t, e, n, r) {
|
|
2181
|
+
const { beforeSend: s, beforeSendTransaction: i, beforeSendSpan: o } = e;
|
|
2182
|
+
let a = n;
|
|
2183
|
+
if (at(a) && s)
|
|
2184
|
+
return s(a, r);
|
|
2185
|
+
if (Ie(a)) {
|
|
2186
|
+
if (o) {
|
|
2187
|
+
const c = o(Ir(a));
|
|
2188
|
+
if (c ? a = P(n, Tr(c)) : $t(), a.spans) {
|
|
2189
|
+
const u = [];
|
|
2190
|
+
for (const d of a.spans) {
|
|
2191
|
+
const f = o(d);
|
|
2192
|
+
f ? u.push(f) : ($t(), u.push(d));
|
|
2193
|
+
}
|
|
2194
|
+
a.spans = u;
|
|
2195
|
+
}
|
|
2196
|
+
}
|
|
2197
|
+
if (i) {
|
|
2198
|
+
if (a.spans) {
|
|
2199
|
+
const c = a.spans.length;
|
|
2200
|
+
a.sdkProcessingMetadata = {
|
|
2201
|
+
...n.sdkProcessingMetadata,
|
|
2202
|
+
spanCountBeforeProcessing: c
|
|
2203
|
+
};
|
|
2204
|
+
}
|
|
2205
|
+
return i(a, r);
|
|
2206
|
+
}
|
|
2207
|
+
}
|
|
2208
|
+
return a;
|
|
2209
|
+
}
|
|
2210
|
+
function at(t) {
|
|
2211
|
+
return t.type === void 0;
|
|
2212
|
+
}
|
|
2213
|
+
function Ie(t) {
|
|
2214
|
+
return t.type === "transaction";
|
|
2215
|
+
}
|
|
2216
|
+
function Rr(t) {
|
|
2217
|
+
return [
|
|
2218
|
+
{
|
|
2219
|
+
type: "log",
|
|
2220
|
+
item_count: t.length,
|
|
2221
|
+
content_type: "application/vnd.sentry.items.log+json"
|
|
2222
|
+
},
|
|
2223
|
+
{
|
|
2224
|
+
items: t
|
|
2225
|
+
}
|
|
2226
|
+
];
|
|
2227
|
+
}
|
|
2228
|
+
function Or(t, e, n, r) {
|
|
2229
|
+
const s = {};
|
|
2230
|
+
return e?.sdk && (s.sdk = {
|
|
2231
|
+
name: e.sdk.name,
|
|
2232
|
+
version: e.sdk.version
|
|
2233
|
+
}), n && r && (s.dsn = J(r)), w(s, [Rr(t)]);
|
|
2234
|
+
}
|
|
2235
|
+
function tt(t, e) {
|
|
2236
|
+
const n = Nr(t) ?? [];
|
|
2237
|
+
if (n.length === 0)
|
|
2238
|
+
return;
|
|
2239
|
+
const r = t.getOptions(), s = Or(n, r._metadata, r.tunnel, t.getDsn());
|
|
2240
|
+
Te().set(t, []), t.emit("flushLogs"), t.sendEnvelope(s);
|
|
2241
|
+
}
|
|
2242
|
+
function Nr(t) {
|
|
2243
|
+
return Te().get(t);
|
|
2244
|
+
}
|
|
2245
|
+
function Te() {
|
|
2246
|
+
return C("clientToLogBufferMap", () => /* @__PURE__ */ new WeakMap());
|
|
2247
|
+
}
|
|
2248
|
+
const ve = Symbol.for("SentryBufferFullError");
|
|
2249
|
+
function Dr(t) {
|
|
2250
|
+
const e = [];
|
|
2251
|
+
function n() {
|
|
2252
|
+
return t === void 0 || e.length < t;
|
|
2253
|
+
}
|
|
2254
|
+
function r(o) {
|
|
2255
|
+
return e.splice(e.indexOf(o), 1)[0] || Promise.resolve(void 0);
|
|
2256
|
+
}
|
|
2257
|
+
function s(o) {
|
|
2258
|
+
if (!n())
|
|
2259
|
+
return G(ve);
|
|
2260
|
+
const a = o();
|
|
2261
|
+
return e.indexOf(a) === -1 && e.push(a), a.then(() => r(a)).then(
|
|
2262
|
+
null,
|
|
2263
|
+
() => r(a).then(null, () => {
|
|
2264
|
+
})
|
|
2265
|
+
), a;
|
|
2266
|
+
}
|
|
2267
|
+
function i(o) {
|
|
2268
|
+
return new I((a, c) => {
|
|
2269
|
+
let u = e.length;
|
|
2270
|
+
if (!u)
|
|
2271
|
+
return a(!0);
|
|
2272
|
+
const d = setTimeout(() => {
|
|
2273
|
+
o && o > 0 && a(!1);
|
|
2274
|
+
}, o);
|
|
2275
|
+
e.forEach((f) => {
|
|
2276
|
+
v(f).then(() => {
|
|
2277
|
+
--u || (clearTimeout(d), a(!0));
|
|
2278
|
+
}, c);
|
|
2279
|
+
});
|
|
2280
|
+
});
|
|
2281
|
+
}
|
|
2282
|
+
return {
|
|
2283
|
+
$: e,
|
|
2284
|
+
add: s,
|
|
2285
|
+
drain: i
|
|
2286
|
+
};
|
|
2287
|
+
}
|
|
2288
|
+
const Cr = 60 * 1e3;
|
|
2289
|
+
function xr(t, e = Date.now()) {
|
|
2290
|
+
const n = parseInt(`${t}`, 10);
|
|
2291
|
+
if (!isNaN(n))
|
|
2292
|
+
return n * 1e3;
|
|
2293
|
+
const r = Date.parse(`${t}`);
|
|
2294
|
+
return isNaN(r) ? Cr : r - e;
|
|
2295
|
+
}
|
|
2296
|
+
function Pr(t, e) {
|
|
2297
|
+
return t[e] || t.all || 0;
|
|
2298
|
+
}
|
|
2299
|
+
function wr(t, e, n = Date.now()) {
|
|
2300
|
+
return Pr(t, e) > n;
|
|
2301
|
+
}
|
|
2302
|
+
function Mr(t, { statusCode: e, headers: n }, r = Date.now()) {
|
|
2303
|
+
const s = {
|
|
2304
|
+
...t
|
|
2305
|
+
}, i = n?.["x-sentry-rate-limits"], o = n?.["retry-after"];
|
|
2306
|
+
if (i)
|
|
2307
|
+
for (const a of i.trim().split(",")) {
|
|
2308
|
+
const [c, u, , , d] = a.split(":", 5), f = parseInt(c, 10), h = (isNaN(f) ? 60 : f) * 1e3;
|
|
2309
|
+
if (!u)
|
|
2310
|
+
s.all = r + h;
|
|
2311
|
+
else
|
|
2312
|
+
for (const p of u.split(";"))
|
|
2313
|
+
p === "metric_bucket" ? (!d || d.split(";").includes("custom")) && (s[p] = r + h) : s[p] = r + h;
|
|
2314
|
+
}
|
|
2315
|
+
else o ? s.all = r + xr(o, r) : e === 429 && (s.all = r + 60 * 1e3);
|
|
2316
|
+
return s;
|
|
2317
|
+
}
|
|
2318
|
+
const Lr = 64;
|
|
2319
|
+
function $r(t, e, n = Dr(
|
|
2320
|
+
t.bufferSize || Lr
|
|
2321
|
+
)) {
|
|
2322
|
+
let r = {};
|
|
2323
|
+
const s = (o) => n.drain(o);
|
|
2324
|
+
function i(o) {
|
|
2325
|
+
const a = [];
|
|
2326
|
+
if (Ft(o, (f, h) => {
|
|
2327
|
+
const p = jt(h);
|
|
2328
|
+
wr(r, p) ? t.recordDroppedEvent("ratelimit_backoff", p) : a.push(f);
|
|
2329
|
+
}), a.length === 0)
|
|
2330
|
+
return v({});
|
|
2331
|
+
const c = w(o[0], a), u = (f) => {
|
|
2332
|
+
Ft(c, (h, p) => {
|
|
2333
|
+
t.recordDroppedEvent(f, jt(p));
|
|
2334
|
+
});
|
|
2335
|
+
}, d = () => e({ body: Vn(c) }).then(
|
|
2336
|
+
(f) => (f.statusCode !== void 0 && (f.statusCode < 200 || f.statusCode >= 300) && _ && l.warn(`Sentry responded with status code ${f.statusCode} to sent event.`), r = Mr(r, f), f),
|
|
2337
|
+
(f) => {
|
|
2338
|
+
throw u("network_error"), _ && l.error("Encountered error running transport request:", f), f;
|
|
2339
|
+
}
|
|
2340
|
+
);
|
|
2341
|
+
return n.add(d).then(
|
|
2342
|
+
(f) => f,
|
|
2343
|
+
(f) => {
|
|
2344
|
+
if (f === ve)
|
|
2345
|
+
return _ && l.error("Skipped sending event because buffer is full."), u("queue_overflow"), v({});
|
|
2346
|
+
throw f;
|
|
2347
|
+
}
|
|
2348
|
+
);
|
|
2349
|
+
}
|
|
2350
|
+
return {
|
|
2351
|
+
send: i,
|
|
2352
|
+
flush: s
|
|
2353
|
+
};
|
|
2354
|
+
}
|
|
2355
|
+
function Fr(t) {
|
|
2356
|
+
t.user?.ip_address === void 0 && (t.user = {
|
|
2357
|
+
...t.user,
|
|
2358
|
+
ip_address: "{{auto}}"
|
|
2359
|
+
});
|
|
2360
|
+
}
|
|
2361
|
+
function jr(t) {
|
|
2362
|
+
"aggregates" in t ? t.attrs?.ip_address === void 0 && (t.attrs = {
|
|
2363
|
+
...t.attrs,
|
|
2364
|
+
ip_address: "{{auto}}"
|
|
2365
|
+
}) : t.ipAddress === void 0 && (t.ipAddress = "{{auto}}");
|
|
2366
|
+
}
|
|
2367
|
+
function Ur(t, e, n = [e], r = "npm") {
|
|
2368
|
+
const s = t._metadata || {};
|
|
2369
|
+
s.sdk || (s.sdk = {
|
|
2370
|
+
name: `sentry.javascript.${e}`,
|
|
2371
|
+
packages: n.map((i) => ({
|
|
2372
|
+
name: `${r}:@sentry/${i}`,
|
|
2373
|
+
version: T
|
|
2374
|
+
})),
|
|
2375
|
+
version: T
|
|
2376
|
+
}), t._metadata = s;
|
|
2377
|
+
}
|
|
2378
|
+
function Br(t) {
|
|
2379
|
+
return t && /^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString());
|
|
2380
|
+
}
|
|
2381
|
+
function Yr() {
|
|
2382
|
+
return "npm";
|
|
2383
|
+
}
|
|
2384
|
+
const O = y;
|
|
2385
|
+
function ke(t, e) {
|
|
2386
|
+
const n = yt(t, e), r = {
|
|
2387
|
+
type: Kr(e),
|
|
2388
|
+
value: Hr(e)
|
|
2389
|
+
};
|
|
2390
|
+
return n.length && (r.stacktrace = { frames: n }), r.type === void 0 && r.value === "" && (r.value = "Unrecoverable error caught"), r;
|
|
2391
|
+
}
|
|
2392
|
+
function Gr(t, e, n, r) {
|
|
2393
|
+
const i = ht()?.getOptions().normalizeDepth, o = ts(e), a = {
|
|
2394
|
+
__serialized__: me(e, i)
|
|
2395
|
+
};
|
|
2396
|
+
if (o)
|
|
2397
|
+
return {
|
|
2398
|
+
exception: {
|
|
2399
|
+
values: [ke(t, o)]
|
|
2400
|
+
},
|
|
2401
|
+
extra: a
|
|
2402
|
+
};
|
|
2403
|
+
const c = {
|
|
2404
|
+
exception: {
|
|
2405
|
+
values: [
|
|
2406
|
+
{
|
|
2407
|
+
type: W(e) ? e.constructor.name : r ? "UnhandledRejection" : "Error",
|
|
2408
|
+
value: Zr(e, { isUnhandledRejection: r })
|
|
2409
|
+
}
|
|
2410
|
+
]
|
|
2411
|
+
},
|
|
2412
|
+
extra: a
|
|
2413
|
+
};
|
|
2414
|
+
if (n) {
|
|
2415
|
+
const u = yt(t, n);
|
|
2416
|
+
u.length && (c.exception.values[0].stacktrace = { frames: u });
|
|
2417
|
+
}
|
|
2418
|
+
return c;
|
|
2419
|
+
}
|
|
2420
|
+
function et(t, e) {
|
|
2421
|
+
return {
|
|
2422
|
+
exception: {
|
|
2423
|
+
values: [ke(t, e)]
|
|
2424
|
+
}
|
|
2425
|
+
};
|
|
2426
|
+
}
|
|
2427
|
+
function yt(t, e) {
|
|
2428
|
+
const n = e.stacktrace || e.stack || "", r = Wr(e), s = Vr(e);
|
|
2429
|
+
try {
|
|
2430
|
+
return t(n, r, s);
|
|
2431
|
+
} catch {
|
|
2432
|
+
}
|
|
2433
|
+
return [];
|
|
2434
|
+
}
|
|
2435
|
+
const zr = /Minified React error #\d+;/i;
|
|
2436
|
+
function Wr(t) {
|
|
2437
|
+
return t && zr.test(t.message) ? 1 : 0;
|
|
2438
|
+
}
|
|
2439
|
+
function Vr(t) {
|
|
2440
|
+
return typeof t.framesToPop == "number" ? t.framesToPop : 0;
|
|
2441
|
+
}
|
|
2442
|
+
function Ae(t) {
|
|
2443
|
+
return typeof WebAssembly < "u" && typeof WebAssembly.Exception < "u" ? t instanceof WebAssembly.Exception : !1;
|
|
2444
|
+
}
|
|
2445
|
+
function Kr(t) {
|
|
2446
|
+
const e = t?.name;
|
|
2447
|
+
return !e && Ae(t) ? t.message && Array.isArray(t.message) && t.message.length == 2 ? t.message[0] : "WebAssembly.Exception" : e;
|
|
2448
|
+
}
|
|
2449
|
+
function Hr(t) {
|
|
2450
|
+
const e = t?.message;
|
|
2451
|
+
return Ae(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";
|
|
2452
|
+
}
|
|
2453
|
+
function Jr(t, e, n, r) {
|
|
2454
|
+
const s = n?.syntheticException || void 0, i = qr(t, e, s, r);
|
|
2455
|
+
return D(i), i.level = "error", n?.event_id && (i.event_id = n.event_id), v(i);
|
|
2456
|
+
}
|
|
2457
|
+
function Xr(t, e, n = "info", r, s) {
|
|
2458
|
+
const i = r?.syntheticException || void 0, o = ct(t, e, i, s);
|
|
2459
|
+
return o.level = n, r?.event_id && (o.event_id = r.event_id), v(o);
|
|
2460
|
+
}
|
|
2461
|
+
function qr(t, e, n, r, s) {
|
|
2462
|
+
let i;
|
|
2463
|
+
if (ee(e) && e.error)
|
|
2464
|
+
return et(t, e.error);
|
|
2465
|
+
if (Tt(e) || $e(e)) {
|
|
2466
|
+
const o = e;
|
|
2467
|
+
if ("stack" in e)
|
|
2468
|
+
i = et(t, e);
|
|
2469
|
+
else {
|
|
2470
|
+
const a = o.name || (Tt(o) ? "DOMError" : "DOMException"), c = o.message ? `${a}: ${o.message}` : a;
|
|
2471
|
+
i = ct(t, c, n, r), At(i, c);
|
|
2472
|
+
}
|
|
2473
|
+
return "code" in o && (i.tags = { ...i.tags, "DOMException.code": `${o.code}` }), i;
|
|
2474
|
+
}
|
|
2475
|
+
return te(e) ? et(t, e) : N(e) || W(e) ? (i = Gr(t, e, n, s), D(i, {
|
|
2476
|
+
synthetic: !0
|
|
2477
|
+
}), i) : (i = ct(t, e, n, r), At(i, `${e}`), D(i, {
|
|
2478
|
+
synthetic: !0
|
|
2479
|
+
}), i);
|
|
2480
|
+
}
|
|
2481
|
+
function ct(t, e, n, r) {
|
|
2482
|
+
const s = {};
|
|
2483
|
+
if (r && n) {
|
|
2484
|
+
const i = yt(t, n);
|
|
2485
|
+
i.length && (s.exception = {
|
|
2486
|
+
values: [{ value: e, stacktrace: { frames: i } }]
|
|
2487
|
+
}), D(s, { synthetic: !0 });
|
|
2488
|
+
}
|
|
2489
|
+
if (_t(e)) {
|
|
2490
|
+
const { __sentry_template_string__: i, __sentry_template_values__: o } = e;
|
|
2491
|
+
return s.logentry = {
|
|
2492
|
+
message: i,
|
|
2493
|
+
params: o
|
|
2494
|
+
}, s;
|
|
2495
|
+
}
|
|
2496
|
+
return s.message = e, s;
|
|
2497
|
+
}
|
|
2498
|
+
function Zr(t, { isUnhandledRejection: e }) {
|
|
2499
|
+
const n = Ve(t), r = "exception";
|
|
2500
|
+
return ee(t) ? `Event \`ErrorEvent\` captured as ${r} with message \`${t.message}\`` : W(t) ? `Event \`${Qr(t)}\` (type=${t.type}) captured as ${r}` : `Object captured as ${r} with keys: ${n}`;
|
|
2501
|
+
}
|
|
2502
|
+
function Qr(t) {
|
|
2503
|
+
try {
|
|
2504
|
+
const e = Object.getPrototypeOf(t);
|
|
2505
|
+
return e ? e.constructor.name : void 0;
|
|
2506
|
+
} catch {
|
|
2507
|
+
}
|
|
2508
|
+
}
|
|
2509
|
+
function ts(t) {
|
|
2510
|
+
for (const e in t)
|
|
2511
|
+
if (Object.prototype.hasOwnProperty.call(t, e)) {
|
|
2512
|
+
const n = t[e];
|
|
2513
|
+
if (n instanceof Error)
|
|
2514
|
+
return n;
|
|
2515
|
+
}
|
|
2516
|
+
}
|
|
2517
|
+
const es = 5e3;
|
|
2518
|
+
class ms extends vr {
|
|
2519
|
+
/**
|
|
2520
|
+
* Creates a new Browser SDK instance.
|
|
2521
|
+
*
|
|
2522
|
+
* @param options Configuration options for this SDK.
|
|
2523
|
+
*/
|
|
2524
|
+
constructor(e) {
|
|
2525
|
+
const n = ns(e), r = O.SENTRY_SDK_SOURCE || Yr();
|
|
2526
|
+
Ur(n, "browser", ["browser"], r), super(n);
|
|
2527
|
+
const { sendDefaultPii: s, sendClientReports: i, enableLogs: o, _experiments: a } = this._options, c = o ?? a?.enableLogs;
|
|
2528
|
+
O.document && (i || c) && O.document.addEventListener("visibilitychange", () => {
|
|
2529
|
+
O.document.visibilityState === "hidden" && (i && this._flushOutcomes(), c && tt(this));
|
|
2530
|
+
}), c && (this.on("flush", () => {
|
|
2531
|
+
tt(this);
|
|
2532
|
+
}), this.on("afterCaptureLog", () => {
|
|
2533
|
+
this._logFlushIdleTimeout && clearTimeout(this._logFlushIdleTimeout), this._logFlushIdleTimeout = setTimeout(() => {
|
|
2534
|
+
tt(this);
|
|
2535
|
+
}, es);
|
|
2536
|
+
})), s && (this.on("postprocessEvent", Fr), this.on("beforeSendSession", jr));
|
|
2537
|
+
}
|
|
2538
|
+
/**
|
|
2539
|
+
* @inheritDoc
|
|
2540
|
+
*/
|
|
2541
|
+
eventFromException(e, n) {
|
|
2542
|
+
return Jr(this._options.stackParser, e, n, this._options.attachStacktrace);
|
|
2543
|
+
}
|
|
2544
|
+
/**
|
|
2545
|
+
* @inheritDoc
|
|
2546
|
+
*/
|
|
2547
|
+
eventFromMessage(e, n = "info", r) {
|
|
2548
|
+
return Xr(this._options.stackParser, e, n, r, this._options.attachStacktrace);
|
|
2549
|
+
}
|
|
2550
|
+
/**
|
|
2551
|
+
* @inheritDoc
|
|
2552
|
+
*/
|
|
2553
|
+
_prepareEvent(e, n, r, s) {
|
|
2554
|
+
return e.platform = e.platform || "javascript", super._prepareEvent(e, n, r, s);
|
|
2555
|
+
}
|
|
2556
|
+
}
|
|
2557
|
+
function ns(t) {
|
|
2558
|
+
return {
|
|
2559
|
+
release: typeof __SENTRY_RELEASE__ == "string" ? __SENTRY_RELEASE__ : O.SENTRY_RELEASE?.id,
|
|
2560
|
+
// This supports the variable that sentry-webpack-plugin injects
|
|
2561
|
+
sendClientReports: !0,
|
|
2562
|
+
// We default this to true, as it is the safer scenario
|
|
2563
|
+
parentSpanIsAlwaysRootSpan: !0,
|
|
2564
|
+
...t
|
|
2565
|
+
};
|
|
2566
|
+
}
|
|
2567
|
+
const rs = typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__, j = y, B = {};
|
|
2568
|
+
function ss(t) {
|
|
2569
|
+
const e = B[t];
|
|
2570
|
+
if (e)
|
|
2571
|
+
return e;
|
|
2572
|
+
let n = j[t];
|
|
2573
|
+
if (Br(n))
|
|
2574
|
+
return B[t] = n.bind(j);
|
|
2575
|
+
const r = j.document;
|
|
2576
|
+
if (r && typeof r.createElement == "function")
|
|
2577
|
+
try {
|
|
2578
|
+
const s = r.createElement("iframe");
|
|
2579
|
+
s.hidden = !0, r.head.appendChild(s);
|
|
2580
|
+
const i = s.contentWindow;
|
|
2581
|
+
i?.[t] && (n = i[t]), r.head.removeChild(s);
|
|
2582
|
+
} catch (s) {
|
|
2583
|
+
rs && l.warn(`Could not create sandbox iframe for ${t} check, bailing to window.${t}: `, s);
|
|
2584
|
+
}
|
|
2585
|
+
return n && (B[t] = n.bind(j));
|
|
2586
|
+
}
|
|
2587
|
+
function Xt(t) {
|
|
2588
|
+
B[t] = void 0;
|
|
2589
|
+
}
|
|
2590
|
+
function ys(t, e = ss("fetch")) {
|
|
2591
|
+
let n = 0, r = 0;
|
|
2592
|
+
function s(i) {
|
|
2593
|
+
const o = i.body.length;
|
|
2594
|
+
n += o, r++;
|
|
2595
|
+
const a = {
|
|
2596
|
+
body: i.body,
|
|
2597
|
+
method: "POST",
|
|
2598
|
+
referrerPolicy: "strict-origin",
|
|
2599
|
+
headers: t.headers,
|
|
2600
|
+
// Outgoing requests are usually cancelled when navigating to a different page, causing a "TypeError: Failed to
|
|
2601
|
+
// fetch" error and sending a "network_error" client-outcome - in Chrome, the request status shows "(cancelled)".
|
|
2602
|
+
// The `keepalive` flag keeps outgoing requests alive, even when switching pages. We want this since we're
|
|
2603
|
+
// frequently sending events right before the user is switching pages (eg. when finishing navigation transactions).
|
|
2604
|
+
// Gotchas:
|
|
2605
|
+
// - `keepalive` isn't supported by Firefox
|
|
2606
|
+
// - As per spec (https://fetch.spec.whatwg.org/#http-network-or-cache-fetch):
|
|
2607
|
+
// If the sum of contentLength and inflightKeepaliveBytes is greater than 64 kibibytes, then return a network error.
|
|
2608
|
+
// We will therefore only activate the flag when we're below that limit.
|
|
2609
|
+
// There is also a limit of requests that can be open at the same time, so we also limit this to 15
|
|
2610
|
+
// See https://github.com/getsentry/sentry-javascript/pull/7553 for details
|
|
2611
|
+
keepalive: n <= 6e4 && r < 15,
|
|
2612
|
+
...t.fetchOptions
|
|
2613
|
+
};
|
|
2614
|
+
if (!e)
|
|
2615
|
+
return Xt("fetch"), G("No fetch implementation available");
|
|
2616
|
+
try {
|
|
2617
|
+
return e(t.url, a).then((c) => (n -= o, r--, {
|
|
2618
|
+
statusCode: c.status,
|
|
2619
|
+
headers: {
|
|
2620
|
+
"x-sentry-rate-limits": c.headers.get("X-Sentry-Rate-Limits"),
|
|
2621
|
+
"retry-after": c.headers.get("Retry-After")
|
|
2622
|
+
}
|
|
2623
|
+
}));
|
|
2624
|
+
} catch (c) {
|
|
2625
|
+
return Xt("fetch"), n -= o, r--, G(c);
|
|
2626
|
+
}
|
|
2627
|
+
}
|
|
2628
|
+
return $r(t, s);
|
|
2629
|
+
}
|
|
2630
|
+
const is = 30, os = 50;
|
|
2631
|
+
function ut(t, e, n, r) {
|
|
2632
|
+
const s = {
|
|
2633
|
+
filename: t,
|
|
2634
|
+
function: e === "<anonymous>" ? k : e,
|
|
2635
|
+
in_app: !0
|
|
2636
|
+
// All browser frames are considered in_app
|
|
2637
|
+
};
|
|
2638
|
+
return n !== void 0 && (s.lineno = n), r !== void 0 && (s.colno = r), s;
|
|
2639
|
+
}
|
|
2640
|
+
const as = /^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i, cs = /^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i, us = /\((\S*)(?::(\d+))(?::(\d+))\)/, fs = (t) => {
|
|
2641
|
+
const e = as.exec(t);
|
|
2642
|
+
if (e) {
|
|
2643
|
+
const [, r, s, i] = e;
|
|
2644
|
+
return ut(r, k, +s, +i);
|
|
2645
|
+
}
|
|
2646
|
+
const n = cs.exec(t);
|
|
2647
|
+
if (n) {
|
|
2648
|
+
if (n[2] && n[2].indexOf("eval") === 0) {
|
|
2649
|
+
const o = us.exec(n[2]);
|
|
2650
|
+
o && (n[2] = o[1], n[3] = o[2], n[4] = o[3]);
|
|
2651
|
+
}
|
|
2652
|
+
const [s, i] = Re(n[1] || k, n[2]);
|
|
2653
|
+
return ut(i, s, n[3] ? +n[3] : void 0, n[4] ? +n[4] : void 0);
|
|
2654
|
+
}
|
|
2655
|
+
}, ps = [is, fs], ds = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i, ls = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i, _s = (t) => {
|
|
2656
|
+
const e = ds.exec(t);
|
|
2657
|
+
if (e) {
|
|
2658
|
+
if (e[3] && e[3].indexOf(" > eval") > -1) {
|
|
2659
|
+
const i = ls.exec(e[3]);
|
|
2660
|
+
i && (e[1] = e[1] || "eval", e[3] = i[1], e[4] = i[2], e[5] = "");
|
|
2661
|
+
}
|
|
2662
|
+
let r = e[3], s = e[1] || k;
|
|
2663
|
+
return [s, r] = Re(s, r), ut(r, s, e[4] ? +e[4] : void 0, e[5] ? +e[5] : void 0);
|
|
2664
|
+
}
|
|
2665
|
+
}, hs = [os, _s], gs = [ps, hs], Es = we(...gs), Re = (t, e) => {
|
|
2666
|
+
const n = t.indexOf("safari-extension") !== -1, r = t.indexOf("safari-web-extension") !== -1;
|
|
2667
|
+
return n || r ? [
|
|
2668
|
+
t.indexOf("@") !== -1 ? t.split("@")[0] : k,
|
|
2669
|
+
n ? `safari-extension:${e}` : `safari-web-extension:${e}`
|
|
2670
|
+
] : [t, e];
|
|
2671
|
+
};
|
|
2672
|
+
export {
|
|
2673
|
+
ms as BrowserClient,
|
|
2674
|
+
T as SDK_VERSION,
|
|
2675
|
+
pn as SEMANTIC_ATTRIBUTE_SENTRY_OP,
|
|
2676
|
+
dn as SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
|
|
2677
|
+
un as SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE,
|
|
2678
|
+
cn as SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,
|
|
2679
|
+
b as Scope,
|
|
2680
|
+
O as WINDOW,
|
|
2681
|
+
ps as chromeStackLineParser,
|
|
2682
|
+
$r as createTransport,
|
|
2683
|
+
gs as defaultStackLineParsers,
|
|
2684
|
+
Es as defaultStackParser,
|
|
2685
|
+
Jr as eventFromException,
|
|
2686
|
+
Xr as eventFromMessage,
|
|
2687
|
+
ke as exceptionFromError,
|
|
2688
|
+
hs as geckoStackLineParser,
|
|
2689
|
+
ht as getClient,
|
|
2690
|
+
ue as getCurrentScope,
|
|
2691
|
+
on as getGlobalScope,
|
|
2692
|
+
sn as getIsolationScope,
|
|
2693
|
+
_e as getRootSpan,
|
|
2694
|
+
ys as makeFetchTransport,
|
|
2695
|
+
gt as spanToJSON
|
|
2696
|
+
};
|
|
2697
|
+
//# sourceMappingURL=index-BtNTB0jt.js.map
|