@eloquentai/chat-sdk 0.33.10-dev → 0.33.12-dev

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