@cloudflare/vite-plugin 0.0.0-229d00fce

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,2311 @@
1
+ // ../workers-shared/dist/router-worker.mjs
2
+ var Pn = Object.defineProperty;
3
+ var Cn = (t, e, n) => e in t ? Pn(t, e, { enumerable: true, configurable: true, writable: true, value: n }) : t[e] = n;
4
+ var fe = (t, e, n) => (Cn(t, typeof e != "symbol" ? e + "" : e, n), n);
5
+ var bt = (t, e, n) => {
6
+ if (!e.has(t)) throw TypeError("Cannot " + n);
7
+ };
8
+ var Ye = (t, e, n) => (bt(t, e, "read from private field"), n ? n.call(t) : e.get(t));
9
+ var Rt = (t, e, n) => {
10
+ if (e.has(t)) throw TypeError("Cannot add the same private member more than once");
11
+ e instanceof WeakSet ? e.add(t) : e.set(t, n);
12
+ };
13
+ var xt = (t, e, n, r) => (bt(t, e, "write to private field"), r ? r.call(t, n) : e.set(t, n), n);
14
+ var pe = class {
15
+ constructor(e) {
16
+ this.performanceTimer = e;
17
+ }
18
+ now() {
19
+ return this.performanceTimer ? this.performanceTimer.timeOrigin + this.performanceTimer.now() : Date.now();
20
+ }
21
+ };
22
+ var It = Object.prototype.toString;
23
+ function U(t) {
24
+ switch (It.call(t)) {
25
+ case "[object Error]":
26
+ case "[object Exception]":
27
+ case "[object DOMException]":
28
+ return true;
29
+ default:
30
+ return O(t, Error);
31
+ }
32
+ }
33
+ function Dt(t, e) {
34
+ return It.call(t) === `[object ${e}]`;
35
+ }
36
+ function j(t) {
37
+ return Dt(t, "String");
38
+ }
39
+ function le(t) {
40
+ return t === null || typeof t != "object" && typeof t != "function";
41
+ }
42
+ function R(t) {
43
+ return Dt(t, "Object");
44
+ }
45
+ function $e(t) {
46
+ return typeof Event < "u" && O(t, Event);
47
+ }
48
+ function je(t) {
49
+ return typeof Element < "u" && O(t, Element);
50
+ }
51
+ function G(t) {
52
+ return !!(t && t.then && typeof t.then == "function");
53
+ }
54
+ function He(t) {
55
+ return R(t) && "nativeEvent" in t && "preventDefault" in t && "stopPropagation" in t;
56
+ }
57
+ function Z(t) {
58
+ return typeof t == "number" && t !== t;
59
+ }
60
+ function O(t, e) {
61
+ try {
62
+ return t instanceof e;
63
+ } catch {
64
+ return false;
65
+ }
66
+ }
67
+ function qe(t) {
68
+ return !!(typeof t == "object" && t !== null && (t.__isVue || t._isVue));
69
+ }
70
+ function w(t, e = 0) {
71
+ return typeof t != "string" || e === 0 || t.length <= e ? t : `${t.slice(0, e)}...`;
72
+ }
73
+ function me(t) {
74
+ return t && t.Math == Math ? t : void 0;
75
+ }
76
+ var m = typeof globalThis == "object" && me(globalThis) || typeof window == "object" && me(window) || typeof self == "object" && me(self) || typeof global == "object" && me(global) || /* @__PURE__ */ function() {
77
+ return this;
78
+ }() || {};
79
+ function I() {
80
+ return m;
81
+ }
82
+ function Q(t, e, n) {
83
+ let r = n || m, s = r.__SENTRY__ = r.__SENTRY__ || {};
84
+ return s[t] || (s[t] = e());
85
+ }
86
+ var us = I();
87
+ var Mn = 80;
88
+ function Nt(t, e = {}) {
89
+ if (!t) return "<unknown>";
90
+ try {
91
+ let n = t, r = 5, s = [], i = 0, o = 0, a = " > ", c = a.length, u, f = Array.isArray(e) ? e : e.keyAttrs, d = !Array.isArray(e) && e.maxStringLength || Mn;
92
+ for (; n && i++ < r && (u = Un(n, f), !(u === "html" || i > 1 && o + s.length * c + u.length >= d)); ) s.push(u), o += u.length, n = n.parentNode;
93
+ return s.reverse().join(a);
94
+ } catch {
95
+ return "<unknown>";
96
+ }
97
+ }
98
+ function Un(t, e) {
99
+ let n = t, r = [], s, i, o, a, c;
100
+ if (!n || !n.tagName) return "";
101
+ r.push(n.tagName.toLowerCase());
102
+ let u = e && e.length ? e.filter((d) => n.getAttribute(d)).map((d) => [d, n.getAttribute(d)]) : null;
103
+ if (u && u.length) u.forEach((d) => {
104
+ r.push(`[${d[0]}="${d[1]}"]`);
105
+ });
106
+ else if (n.id && r.push(`#${n.id}`), s = n.className, s && j(s)) for (i = s.split(/\s+/), c = 0; c < i.length; c++) r.push(`.${i[c]}`);
107
+ let f = ["aria-label", "type", "name", "title", "alt"];
108
+ for (c = 0; c < f.length; c++) o = f[c], a = n.getAttribute(o), a && r.push(`[${o}="${a}"]`);
109
+ return r.join("");
110
+ }
111
+ var Gn = "Sentry Logger ";
112
+ var ee = ["debug", "info", "warn", "error", "log", "assert", "trace"];
113
+ var H = {};
114
+ function _e(t) {
115
+ if (!("console" in m)) return t();
116
+ let e = m.console, n = {}, r = Object.keys(H);
117
+ r.forEach((s) => {
118
+ let i = H[s];
119
+ n[s] = e[s], e[s] = i;
120
+ });
121
+ try {
122
+ return t();
123
+ } finally {
124
+ r.forEach((s) => {
125
+ e[s] = n[s];
126
+ });
127
+ }
128
+ }
129
+ function Fn() {
130
+ let t = false, e = { enable: () => {
131
+ t = true;
132
+ }, disable: () => {
133
+ t = false;
134
+ }, isEnabled: () => t };
135
+ return typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__ ? ee.forEach((n) => {
136
+ e[n] = (...r) => {
137
+ t && _e(() => {
138
+ m.console[n](`${Gn}[${n}]:`, ...r);
139
+ });
140
+ };
141
+ }) : ee.forEach((n) => {
142
+ e[n] = () => {
143
+ };
144
+ }), e;
145
+ }
146
+ var p = Fn();
147
+ var Bn = /^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;
148
+ function Ln(t) {
149
+ return t === "http" || t === "https";
150
+ }
151
+ function P(t, e = false) {
152
+ let { host: n, path: r, pass: s, port: i, projectId: o, protocol: a, publicKey: c } = t;
153
+ return `${a}://${c}${e && s ? `:${s}` : ""}@${n}${i ? `:${i}` : ""}/${r && `${r}/`}${o}`;
154
+ }
155
+ function kt(t) {
156
+ let e = Bn.exec(t);
157
+ if (!e) {
158
+ console.error(`Invalid Sentry Dsn: ${t}`);
159
+ return;
160
+ }
161
+ let [n, r, s = "", i, o = "", a] = e.slice(1), c = "", u = a, f = u.split("/");
162
+ if (f.length > 1 && (c = f.slice(0, -1).join("/"), u = f.pop()), u) {
163
+ let d = u.match(/^\d+/);
164
+ d && (u = d[0]);
165
+ }
166
+ return Ot({ host: i, pass: s, path: c, projectId: u, port: o, protocol: n, publicKey: r });
167
+ }
168
+ function Ot(t) {
169
+ return { protocol: t.protocol, publicKey: t.publicKey || "", pass: t.pass || "", host: t.host, port: t.port || "", path: t.path || "", projectId: t.projectId };
170
+ }
171
+ function Yn(t) {
172
+ if (!(typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__)) return true;
173
+ let { port: e, projectId: n, protocol: r } = t;
174
+ return ["protocol", "publicKey", "host", "projectId"].find((o) => t[o] ? false : (p.error(`Invalid Sentry Dsn: ${o} missing`), true)) ? false : n.match(/^\d+$/) ? Ln(r) ? e && isNaN(parseInt(e, 10)) ? (p.error(`Invalid Sentry Dsn: Invalid port ${e}`), false) : true : (p.error(`Invalid Sentry Dsn: Invalid protocol ${r}`), false) : (p.error(`Invalid Sentry Dsn: Invalid projectId ${n}`), false);
175
+ }
176
+ function he(t) {
177
+ let e = typeof t == "string" ? kt(t) : Ot(t);
178
+ if (!(!e || !Yn(e))) return e;
179
+ }
180
+ var y = class extends Error {
181
+ constructor(e, n = "warn") {
182
+ super(e), this.message = e, this.name = new.target.prototype.constructor.name, Object.setPrototypeOf(this, new.target.prototype), this.logLevel = n;
183
+ }
184
+ };
185
+ function x(t, e, n) {
186
+ if (!(e in t)) return;
187
+ let r = t[e], s = n(r);
188
+ typeof s == "function" && wt(s, r), t[e] = s;
189
+ }
190
+ function q(t, e, n) {
191
+ try {
192
+ Object.defineProperty(t, e, { value: n, writable: true, configurable: true });
193
+ } catch {
194
+ (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && p.log(`Failed to add non-enumerable property "${e}" to object`, t);
195
+ }
196
+ }
197
+ function wt(t, e) {
198
+ try {
199
+ let n = e.prototype || {};
200
+ t.prototype = e.prototype = n, q(t, "__sentry_original__", e);
201
+ } catch {
202
+ }
203
+ }
204
+ function We(t) {
205
+ return Object.keys(t).map((e) => `${encodeURIComponent(e)}=${encodeURIComponent(t[e])}`).join("&");
206
+ }
207
+ function ge(t) {
208
+ if (U(t)) return { message: t.message, name: t.name, stack: t.stack, ...vt(t) };
209
+ if ($e(t)) {
210
+ let e = { type: t.type, target: At(t.target), currentTarget: At(t.currentTarget), ...vt(t) };
211
+ return typeof CustomEvent < "u" && O(t, CustomEvent) && (e.detail = t.detail), e;
212
+ } else return t;
213
+ }
214
+ function At(t) {
215
+ try {
216
+ return je(t) ? Nt(t) : Object.prototype.toString.call(t);
217
+ } catch {
218
+ return "<unknown>";
219
+ }
220
+ }
221
+ function vt(t) {
222
+ if (typeof t == "object" && t !== null) {
223
+ let e = {};
224
+ for (let n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
225
+ return e;
226
+ } else return {};
227
+ }
228
+ function te(t, e = 40) {
229
+ let n = Object.keys(ge(t));
230
+ if (n.sort(), !n.length) return "[object has no keys]";
231
+ if (n[0].length >= e) return w(n[0], e);
232
+ for (let r = n.length; r > 0; r--) {
233
+ let s = n.slice(0, r).join(", ");
234
+ if (!(s.length > e)) return r === n.length ? s : w(s, e);
235
+ }
236
+ return "";
237
+ }
238
+ function g(t) {
239
+ return ze(t, /* @__PURE__ */ new Map());
240
+ }
241
+ function ze(t, e) {
242
+ if (R(t)) {
243
+ let n = e.get(t);
244
+ if (n !== void 0) return n;
245
+ let r = {};
246
+ e.set(t, r);
247
+ for (let s of Object.keys(t)) typeof t[s] < "u" && (r[s] = ze(t[s], e));
248
+ return r;
249
+ }
250
+ if (Array.isArray(t)) {
251
+ let n = e.get(t);
252
+ if (n !== void 0) return n;
253
+ let r = [];
254
+ return e.set(t, r), t.forEach((s) => {
255
+ r.push(ze(s, e));
256
+ }), r;
257
+ }
258
+ return t;
259
+ }
260
+ function $n(t, e = false) {
261
+ return !(e || t && !t.startsWith("/") && !t.includes(":\\") && !t.startsWith(".") && !t.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//)) && t !== void 0 && !t.includes("node_modules/");
262
+ }
263
+ function Pt(t) {
264
+ let e = /^\s*[-]{4,}$/, n = /at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/;
265
+ return (r) => {
266
+ let s = r.match(n);
267
+ if (s) {
268
+ let i, o, a, c, u;
269
+ if (s[1]) {
270
+ a = s[1];
271
+ let l = a.lastIndexOf(".");
272
+ if (a[l - 1] === "." && l--, l > 0) {
273
+ i = a.slice(0, l), o = a.slice(l + 1);
274
+ let _ = i.indexOf(".Module");
275
+ _ > 0 && (a = a.slice(_ + 1), i = i.slice(0, _));
276
+ }
277
+ c = void 0;
278
+ }
279
+ o && (c = i, u = o), o === "<anonymous>" && (u = void 0, a = void 0), a === void 0 && (u = u || "<anonymous>", a = c ? `${c}.${u}` : u);
280
+ let f = s[2] && s[2].startsWith("file://") ? s[2].slice(7) : s[2], d = s[5] === "native";
281
+ return !f && s[5] && !d && (f = s[5]), { filename: f, module: t ? t(f) : void 0, function: a, lineno: parseInt(s[3], 10) || void 0, colno: parseInt(s[4], 10) || void 0, in_app: $n(f, d) };
282
+ }
283
+ if (r.match(e)) return { filename: r };
284
+ };
285
+ }
286
+ var Ut = 50;
287
+ var Ct = /\(error: (.*)\)/;
288
+ var Mt = /captureMessage|captureException/;
289
+ function Ee(...t) {
290
+ let e = t.sort((n, r) => n[0] - r[0]).map((n) => n[1]);
291
+ return (n, r = 0) => {
292
+ let s = [], i = n.split(`
293
+ `);
294
+ for (let o = r; o < i.length; o++) {
295
+ let a = i[o];
296
+ if (a.length > 1024) continue;
297
+ let c = Ct.test(a) ? a.replace(Ct, "$1") : a;
298
+ if (!c.match(/\S*Error: /)) {
299
+ for (let u of e) {
300
+ let f = u(c);
301
+ if (f) {
302
+ s.push(f);
303
+ break;
304
+ }
305
+ }
306
+ if (s.length >= Ut) break;
307
+ }
308
+ }
309
+ return Gt(s);
310
+ };
311
+ }
312
+ function Ve(t) {
313
+ return Array.isArray(t) ? Ee(...t) : t;
314
+ }
315
+ function Gt(t) {
316
+ if (!t.length) return [];
317
+ let e = Array.from(t);
318
+ return /sentryWrapped/.test(e[e.length - 1].function || "") && e.pop(), e.reverse(), Mt.test(e[e.length - 1].function || "") && (e.pop(), Mt.test(e[e.length - 1].function || "") && e.pop()), e.slice(0, Ut).map((n) => ({ ...n, filename: n.filename || e[e.length - 1].filename, function: n.function || "?" }));
319
+ }
320
+ var Ke = "<anonymous>";
321
+ function ne(t) {
322
+ try {
323
+ return !t || typeof t != "function" ? Ke : t.name || Ke;
324
+ } catch {
325
+ return Ke;
326
+ }
327
+ }
328
+ function Je(t) {
329
+ return [90, Pt(t)];
330
+ }
331
+ var Xe = I();
332
+ function jn() {
333
+ if (!("fetch" in Xe)) return false;
334
+ try {
335
+ return new Headers(), new Request("http://www.example.com"), new Response(), true;
336
+ } catch {
337
+ return false;
338
+ }
339
+ }
340
+ function Ft(t) {
341
+ return t && /^function fetch\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString());
342
+ }
343
+ function Bt() {
344
+ if (!jn()) return false;
345
+ if (Ft(Xe.fetch)) return true;
346
+ let t = false, e = Xe.document;
347
+ if (e && typeof e.createElement == "function") try {
348
+ let n = e.createElement("iframe");
349
+ n.hidden = true, e.head.appendChild(n), n.contentWindow && n.contentWindow.fetch && (t = Ft(n.contentWindow.fetch)), e.head.removeChild(n);
350
+ } catch (n) {
351
+ (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && p.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ", n);
352
+ }
353
+ return t;
354
+ }
355
+ var Se = I();
356
+ function Lt() {
357
+ let t = Se.chrome, e = t && t.app && t.app.runtime, n = "history" in Se && !!Se.history.pushState && !!Se.history.replaceState;
358
+ return !e && n;
359
+ }
360
+ var E = I();
361
+ var re = "__sentry_xhr_v2__";
362
+ var se = {};
363
+ var Yt = {};
364
+ function Hn(t) {
365
+ if (!Yt[t]) switch (Yt[t] = true, t) {
366
+ case "console":
367
+ qn();
368
+ break;
369
+ case "dom":
370
+ Wt();
371
+ break;
372
+ case "xhr":
373
+ zt();
374
+ break;
375
+ case "fetch":
376
+ zn();
377
+ break;
378
+ case "history":
379
+ Wn();
380
+ break;
381
+ case "error":
382
+ Xn();
383
+ break;
384
+ case "unhandledrejection":
385
+ Zn();
386
+ break;
387
+ default:
388
+ (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && p.warn("unknown instrumentation type:", t);
389
+ return;
390
+ }
391
+ }
392
+ function xe(t, e) {
393
+ se[t] = se[t] || [], se[t].push(e), Hn(t);
394
+ }
395
+ function D(t, e) {
396
+ if (!(!t || !se[t])) for (let n of se[t] || []) try {
397
+ n(e);
398
+ } catch (r) {
399
+ (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && p.error(`Error while triggering instrumentation handler.
400
+ Type: ${t}
401
+ Name: ${ne(n)}
402
+ Error:`, r);
403
+ }
404
+ }
405
+ function qn() {
406
+ "console" in m && ee.forEach(function(t) {
407
+ t in m.console && x(m.console, t, function(e) {
408
+ return H[t] = e, function(...n) {
409
+ D("console", { args: n, level: t });
410
+ let r = H[t];
411
+ r && r.apply(m.console, n);
412
+ };
413
+ });
414
+ });
415
+ }
416
+ function zn() {
417
+ Bt() && x(m, "fetch", function(t) {
418
+ return function(...e) {
419
+ let { method: n, url: r } = qt(e), s = { args: e, fetchData: { method: n, url: r }, startTimestamp: Date.now() };
420
+ return D("fetch", { ...s }), t.apply(m, e).then((i) => (D("fetch", { ...s, endTimestamp: Date.now(), response: i }), i), (i) => {
421
+ throw D("fetch", { ...s, endTimestamp: Date.now(), error: i }), i;
422
+ });
423
+ };
424
+ });
425
+ }
426
+ function Ze(t, e) {
427
+ return !!t && typeof t == "object" && !!t[e];
428
+ }
429
+ function $t(t) {
430
+ return typeof t == "string" ? t : t ? Ze(t, "url") ? t.url : t.toString ? t.toString() : "" : "";
431
+ }
432
+ function qt(t) {
433
+ if (t.length === 0) return { method: "GET", url: "" };
434
+ if (t.length === 2) {
435
+ let [n, r] = t;
436
+ return { url: $t(n), method: Ze(r, "method") ? String(r.method).toUpperCase() : "GET" };
437
+ }
438
+ let e = t[0];
439
+ return { url: $t(e), method: Ze(e, "method") ? String(e.method).toUpperCase() : "GET" };
440
+ }
441
+ function zt() {
442
+ if (!E.XMLHttpRequest) return;
443
+ let t = XMLHttpRequest.prototype;
444
+ x(t, "open", function(e) {
445
+ return function(...n) {
446
+ let r = Date.now(), s = n[1], i = this[re] = { method: j(n[0]) ? n[0].toUpperCase() : n[0], url: n[1], request_headers: {} };
447
+ j(s) && i.method === "POST" && s.match(/sentry_key/) && (this.__sentry_own_request__ = true);
448
+ let o = () => {
449
+ let a = this[re];
450
+ if (a && this.readyState === 4) {
451
+ try {
452
+ a.status_code = this.status;
453
+ } catch {
454
+ }
455
+ D("xhr", { args: n, endTimestamp: Date.now(), startTimestamp: r, xhr: this });
456
+ }
457
+ };
458
+ return "onreadystatechange" in this && typeof this.onreadystatechange == "function" ? x(this, "onreadystatechange", function(a) {
459
+ return function(...c) {
460
+ return o(), a.apply(this, c);
461
+ };
462
+ }) : this.addEventListener("readystatechange", o), x(this, "setRequestHeader", function(a) {
463
+ return function(...c) {
464
+ let [u, f] = c, d = this[re];
465
+ return d && (d.request_headers[u.toLowerCase()] = f), a.apply(this, c);
466
+ };
467
+ }), e.apply(this, n);
468
+ };
469
+ }), x(t, "send", function(e) {
470
+ return function(...n) {
471
+ let r = this[re];
472
+ return r && n[0] !== void 0 && (r.body = n[0]), D("xhr", { args: n, startTimestamp: Date.now(), xhr: this }), e.apply(this, n);
473
+ };
474
+ });
475
+ }
476
+ var ye;
477
+ function Wn() {
478
+ if (!Lt()) return;
479
+ let t = E.onpopstate;
480
+ E.onpopstate = function(...n) {
481
+ let r = E.location.href, s = ye;
482
+ if (ye = r, D("history", { from: s, to: r }), t) try {
483
+ return t.apply(this, n);
484
+ } catch {
485
+ }
486
+ };
487
+ function e(n) {
488
+ return function(...r) {
489
+ let s = r.length > 2 ? r[2] : void 0;
490
+ if (s) {
491
+ let i = ye, o = String(s);
492
+ ye = o, D("history", { from: i, to: o });
493
+ }
494
+ return n.apply(this, r);
495
+ };
496
+ }
497
+ x(E.history, "pushState", e), x(E.history, "replaceState", e);
498
+ }
499
+ var Kn = 1e3;
500
+ var jt;
501
+ var Te;
502
+ function Vn(t, e) {
503
+ if (t.type !== e.type) return false;
504
+ try {
505
+ if (t.target !== e.target) return false;
506
+ } catch {
507
+ }
508
+ return true;
509
+ }
510
+ function Jn(t) {
511
+ if (t.type !== "keypress") return false;
512
+ try {
513
+ let e = t.target;
514
+ if (!e || !e.tagName) return true;
515
+ if (e.tagName === "INPUT" || e.tagName === "TEXTAREA" || e.isContentEditable) return false;
516
+ } catch {
517
+ }
518
+ return true;
519
+ }
520
+ function Ht(t, e = false) {
521
+ return (n) => {
522
+ if (!n || n._sentryCaptured || Jn(n)) return;
523
+ q(n, "_sentryCaptured", true);
524
+ let r = n.type === "keypress" ? "input" : n.type;
525
+ (Te === void 0 || !Vn(Te, n)) && (t({ event: n, name: r, global: e }), Te = n), clearTimeout(jt), jt = E.setTimeout(() => {
526
+ Te = void 0;
527
+ }, Kn);
528
+ };
529
+ }
530
+ function Wt() {
531
+ if (!E.document) return;
532
+ let t = D.bind(null, "dom"), e = Ht(t, true);
533
+ E.document.addEventListener("click", e, false), E.document.addEventListener("keypress", e, false), ["EventTarget", "Node"].forEach((n) => {
534
+ let r = E[n] && E[n].prototype;
535
+ !r || !r.hasOwnProperty || !r.hasOwnProperty("addEventListener") || (x(r, "addEventListener", function(s) {
536
+ return function(i, o, a) {
537
+ if (i === "click" || i == "keypress") try {
538
+ let c = this, u = c.__sentry_instrumentation_handlers__ = c.__sentry_instrumentation_handlers__ || {}, f = u[i] = u[i] || { refCount: 0 };
539
+ if (!f.handler) {
540
+ let d = Ht(t);
541
+ f.handler = d, s.call(this, i, d, a);
542
+ }
543
+ f.refCount++;
544
+ } catch {
545
+ }
546
+ return s.call(this, i, o, a);
547
+ };
548
+ }), x(r, "removeEventListener", function(s) {
549
+ return function(i, o, a) {
550
+ if (i === "click" || i == "keypress") try {
551
+ let c = this, u = c.__sentry_instrumentation_handlers__ || {}, f = u[i];
552
+ f && (f.refCount--, f.refCount <= 0 && (s.call(this, i, f.handler, a), f.handler = void 0, delete u[i]), Object.keys(u).length === 0 && delete c.__sentry_instrumentation_handlers__);
553
+ } catch {
554
+ }
555
+ return s.call(this, i, o, a);
556
+ };
557
+ }));
558
+ });
559
+ }
560
+ var be = null;
561
+ function Xn() {
562
+ be = E.onerror, E.onerror = function(t, e, n, r, s) {
563
+ return D("error", { column: r, error: s, line: n, msg: t, url: e }), be && !be.__SENTRY_LOADER__ ? be.apply(this, arguments) : false;
564
+ }, E.onerror.__SENTRY_INSTRUMENTED__ = true;
565
+ }
566
+ var Re = null;
567
+ function Zn() {
568
+ Re = E.onunhandledrejection, E.onunhandledrejection = function(t) {
569
+ return D("unhandledrejection", t), Re && !Re.__SENTRY_LOADER__ ? Re.apply(this, arguments) : true;
570
+ }, E.onunhandledrejection.__SENTRY_INSTRUMENTED__ = true;
571
+ }
572
+ function Kt() {
573
+ return typeof __SENTRY_BROWSER_BUNDLE__ < "u" && !!__SENTRY_BROWSER_BUNDLE__;
574
+ }
575
+ function Vt() {
576
+ return !Kt() && Object.prototype.toString.call(typeof process < "u" ? process : 0) === "[object process]";
577
+ }
578
+ function Jt(t, e) {
579
+ return t.require(e);
580
+ }
581
+ function Xt() {
582
+ let t = typeof WeakSet == "function", e = t ? /* @__PURE__ */ new WeakSet() : [];
583
+ function n(s) {
584
+ if (t) return e.has(s) ? true : (e.add(s), false);
585
+ for (let i = 0; i < e.length; i++) if (e[i] === s) return true;
586
+ return e.push(s), false;
587
+ }
588
+ function r(s) {
589
+ if (t) e.delete(s);
590
+ else for (let i = 0; i < e.length; i++) if (e[i] === s) {
591
+ e.splice(i, 1);
592
+ break;
593
+ }
594
+ }
595
+ return [n, r];
596
+ }
597
+ function h() {
598
+ let t = m, e = t.crypto || t.msCrypto, n = () => Math.random() * 16;
599
+ try {
600
+ if (e && e.randomUUID) return e.randomUUID().replace(/-/g, "");
601
+ e && e.getRandomValues && (n = () => e.getRandomValues(new Uint8Array(1))[0]);
602
+ } catch {
603
+ }
604
+ return ("10000000100040008000" + 1e11).replace(/[018]/g, (r) => (r ^ (n() & 15) >> r / 4).toString(16));
605
+ }
606
+ function Qn(t) {
607
+ return t.exception && t.exception.values ? t.exception.values[0] : void 0;
608
+ }
609
+ function ie(t, e, n) {
610
+ let r = t.exception = t.exception || {}, s = r.values = r.values || [], i = s[0] = s[0] || {};
611
+ i.value || (i.value = e || ""), i.type || (i.type = n || "Error");
612
+ }
613
+ function oe(t, e) {
614
+ let n = Qn(t);
615
+ if (!n) return;
616
+ let r = { type: "generic", handled: true }, s = n.mechanism;
617
+ if (n.mechanism = { ...r, ...s, ...e }, e && "data" in e) {
618
+ let i = { ...s && s.data, ...e.data };
619
+ n.mechanism.data = i;
620
+ }
621
+ }
622
+ function Ie(t) {
623
+ if (t && t.__sentry_captured__) return true;
624
+ try {
625
+ q(t, "__sentry_captured__", true);
626
+ } catch {
627
+ }
628
+ return false;
629
+ }
630
+ function ae(t) {
631
+ return Array.isArray(t) ? t : [t];
632
+ }
633
+ function N(t, e = 100, n = 1 / 0) {
634
+ try {
635
+ return De("", t, e, n);
636
+ } catch (r) {
637
+ return { ERROR: `**non-serializable** (${r})` };
638
+ }
639
+ }
640
+ function z(t, e = 3, n = 100 * 1024) {
641
+ let r = N(t, e);
642
+ return rr(r) > n ? z(t, e - 1, n) : r;
643
+ }
644
+ function De(t, e, n = 1 / 0, r = 1 / 0, s = Xt()) {
645
+ let [i, o] = s;
646
+ if (e == null || ["number", "boolean", "string"].includes(typeof e) && !Z(e)) return e;
647
+ let a = er(t, e);
648
+ if (!a.startsWith("[object ")) return a;
649
+ if (e.__sentry_skip_normalization__) return e;
650
+ let c = typeof e.__sentry_override_normalization_depth__ == "number" ? e.__sentry_override_normalization_depth__ : n;
651
+ if (c === 0) return a.replace("object ", "");
652
+ if (i(e)) return "[Circular ~]";
653
+ let u = e;
654
+ if (u && typeof u.toJSON == "function") try {
655
+ let _ = u.toJSON();
656
+ return De("", _, c - 1, r, s);
657
+ } catch {
658
+ }
659
+ let f = Array.isArray(e) ? [] : {}, d = 0, l = ge(e);
660
+ for (let _ in l) {
661
+ if (!Object.prototype.hasOwnProperty.call(l, _)) continue;
662
+ if (d >= r) {
663
+ f[_] = "[MaxProperties ~]";
664
+ break;
665
+ }
666
+ let M = l[_];
667
+ f[_] = De(_, M, c - 1, r, s), d++;
668
+ }
669
+ return o(e), f;
670
+ }
671
+ function er(t, e) {
672
+ try {
673
+ if (t === "domain" && e && typeof e == "object" && e._events) return "[Domain]";
674
+ if (t === "domainEmitter") return "[DomainEmitter]";
675
+ if (typeof global < "u" && e === global) return "[Global]";
676
+ if (typeof window < "u" && e === window) return "[Window]";
677
+ if (typeof document < "u" && e === document) return "[Document]";
678
+ if (qe(e)) return "[VueViewModel]";
679
+ if (He(e)) return "[SyntheticEvent]";
680
+ if (typeof e == "number" && e !== e) return "[NaN]";
681
+ if (typeof e == "function") return `[Function: ${ne(e)}]`;
682
+ if (typeof e == "symbol") return `[${String(e)}]`;
683
+ if (typeof e == "bigint") return `[BigInt: ${String(e)}]`;
684
+ let n = tr(e);
685
+ return /^HTML(\w*)Element$/.test(n) ? `[HTMLElement: ${n}]` : `[object ${n}]`;
686
+ } catch (n) {
687
+ return `**non-serializable** (${n})`;
688
+ }
689
+ }
690
+ function tr(t) {
691
+ let e = Object.getPrototypeOf(t);
692
+ return e ? e.constructor.name : "null prototype";
693
+ }
694
+ function nr(t) {
695
+ return ~-encodeURI(t).split(/%..|./).length;
696
+ }
697
+ function rr(t) {
698
+ return nr(JSON.stringify(t));
699
+ }
700
+ var sr = /^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;
701
+ function ir(t) {
702
+ let e = t.length > 1024 ? `<truncated>${t.slice(-1024)}` : t, n = sr.exec(e);
703
+ return n ? n.slice(1) : [];
704
+ }
705
+ function Qe(t, e) {
706
+ let n = ir(t)[2];
707
+ return e && n.slice(e.length * -1) === e && (n = n.slice(0, n.length - e.length)), n;
708
+ }
709
+ var A;
710
+ (function(t) {
711
+ t[t.PENDING = 0] = "PENDING";
712
+ let n = 1;
713
+ t[t.RESOLVED = n] = "RESOLVED";
714
+ let r = 2;
715
+ t[t.REJECTED = r] = "REJECTED";
716
+ })(A || (A = {}));
717
+ function T(t) {
718
+ return new S((e) => {
719
+ e(t);
720
+ });
721
+ }
722
+ function F(t) {
723
+ return new S((e, n) => {
724
+ n(t);
725
+ });
726
+ }
727
+ var S = class {
728
+ constructor(e) {
729
+ S.prototype.__init.call(this), S.prototype.__init2.call(this), S.prototype.__init3.call(this), S.prototype.__init4.call(this), this._state = A.PENDING, this._handlers = [];
730
+ try {
731
+ e(this._resolve, this._reject);
732
+ } catch (n) {
733
+ this._reject(n);
734
+ }
735
+ }
736
+ then(e, n) {
737
+ return new S((r, s) => {
738
+ this._handlers.push([false, (i) => {
739
+ if (!e) r(i);
740
+ else try {
741
+ r(e(i));
742
+ } catch (o) {
743
+ s(o);
744
+ }
745
+ }, (i) => {
746
+ if (!n) s(i);
747
+ else try {
748
+ r(n(i));
749
+ } catch (o) {
750
+ s(o);
751
+ }
752
+ }]), this._executeHandlers();
753
+ });
754
+ }
755
+ catch(e) {
756
+ return this.then((n) => n, e);
757
+ }
758
+ finally(e) {
759
+ return new S((n, r) => {
760
+ let s, i;
761
+ return this.then((o) => {
762
+ i = false, s = o, e && e();
763
+ }, (o) => {
764
+ i = true, s = o, e && e();
765
+ }).then(() => {
766
+ if (i) {
767
+ r(s);
768
+ return;
769
+ }
770
+ n(s);
771
+ });
772
+ });
773
+ }
774
+ __init() {
775
+ this._resolve = (e) => {
776
+ this._setResult(A.RESOLVED, e);
777
+ };
778
+ }
779
+ __init2() {
780
+ this._reject = (e) => {
781
+ this._setResult(A.REJECTED, e);
782
+ };
783
+ }
784
+ __init3() {
785
+ this._setResult = (e, n) => {
786
+ if (this._state === A.PENDING) {
787
+ if (G(n)) {
788
+ n.then(this._resolve, this._reject);
789
+ return;
790
+ }
791
+ this._state = e, this._value = n, this._executeHandlers();
792
+ }
793
+ };
794
+ }
795
+ __init4() {
796
+ this._executeHandlers = () => {
797
+ if (this._state === A.PENDING) return;
798
+ let e = this._handlers.slice();
799
+ this._handlers = [], e.forEach((n) => {
800
+ n[0] || (this._state === A.RESOLVED && n[1](this._value), this._state === A.REJECTED && n[2](this._value), n[0] = true);
801
+ });
802
+ };
803
+ }
804
+ };
805
+ function et(t) {
806
+ let e = [];
807
+ function n() {
808
+ return t === void 0 || e.length < t;
809
+ }
810
+ function r(o) {
811
+ return e.splice(e.indexOf(o), 1)[0];
812
+ }
813
+ function s(o) {
814
+ if (!n()) return F(new y("Not adding Promise because buffer limit was reached."));
815
+ let a = o();
816
+ return e.indexOf(a) === -1 && e.push(a), a.then(() => r(a)).then(null, () => r(a).then(null, () => {
817
+ })), a;
818
+ }
819
+ function i(o) {
820
+ return new S((a, c) => {
821
+ let u = e.length;
822
+ if (!u) return a(true);
823
+ let f = setTimeout(() => {
824
+ o && o > 0 && a(false);
825
+ }, o);
826
+ e.forEach((d) => {
827
+ T(d).then(() => {
828
+ --u || (clearTimeout(f), a(true));
829
+ }, c);
830
+ });
831
+ });
832
+ }
833
+ return { $: e, add: s, drain: i };
834
+ }
835
+ var Qt = I();
836
+ var nt = { nowSeconds: () => Date.now() / 1e3 };
837
+ function or() {
838
+ let { performance: t } = Qt;
839
+ if (!t || !t.now) return;
840
+ let e = Date.now() - t.now();
841
+ return { now: () => t.now(), timeOrigin: e };
842
+ }
843
+ function ar() {
844
+ try {
845
+ return Jt(module, "perf_hooks").performance;
846
+ } catch {
847
+ return;
848
+ }
849
+ }
850
+ var tt = Vt() ? ar() : or();
851
+ var Zt = tt === void 0 ? nt : { nowSeconds: () => (tt.timeOrigin + tt.now()) / 1e3 };
852
+ var B = nt.nowSeconds.bind(nt);
853
+ var L = Zt.nowSeconds.bind(Zt);
854
+ var ce;
855
+ var cr = (() => {
856
+ let { performance: t } = Qt;
857
+ if (!t || !t.now) {
858
+ ce = "none";
859
+ return;
860
+ }
861
+ let e = 3600 * 1e3, n = t.now(), r = Date.now(), s = t.timeOrigin ? Math.abs(t.timeOrigin + n - r) : e, i = s < e, o = t.timing && t.timing.navigationStart, c = typeof o == "number" ? Math.abs(o + n - r) : e, u = c < e;
862
+ return i || u ? s <= c ? (ce = "timeOrigin", t.timeOrigin) : (ce = "navigationStart", o) : (ce = "dateNow", r);
863
+ })();
864
+ var ur = new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");
865
+ function rt(t = h(), e = h().substring(16), n) {
866
+ let r = "";
867
+ return n !== void 0 && (r = n ? "-1" : "-0"), `${t}-${e}${r}`;
868
+ }
869
+ function C(t, e = []) {
870
+ return [t, e];
871
+ }
872
+ function it(t, e) {
873
+ let [n, r] = t;
874
+ return [n, [...r, e]];
875
+ }
876
+ function Ne(t, e) {
877
+ let n = t[1];
878
+ for (let r of n) {
879
+ let s = r[0].type;
880
+ if (e(r, s)) return true;
881
+ }
882
+ return false;
883
+ }
884
+ function st(t, e) {
885
+ return (e || new TextEncoder()).encode(t);
886
+ }
887
+ function ot(t, e) {
888
+ let [n, r] = t, s = JSON.stringify(n);
889
+ function i(o) {
890
+ typeof s == "string" ? s = typeof o == "string" ? s + o : [st(s, e), o] : s.push(typeof o == "string" ? st(o, e) : o);
891
+ }
892
+ for (let o of r) {
893
+ let [a, c] = o;
894
+ if (i(`
895
+ ${JSON.stringify(a)}
896
+ `), typeof c == "string" || c instanceof Uint8Array) i(c);
897
+ else {
898
+ let u;
899
+ try {
900
+ u = JSON.stringify(c);
901
+ } catch {
902
+ u = JSON.stringify(N(c));
903
+ }
904
+ i(u);
905
+ }
906
+ }
907
+ return typeof s == "string" ? s : dr(s);
908
+ }
909
+ function dr(t) {
910
+ let e = t.reduce((s, i) => s + i.length, 0), n = new Uint8Array(e), r = 0;
911
+ for (let s of t) n.set(s, r), r += s.length;
912
+ return n;
913
+ }
914
+ function at(t, e) {
915
+ let n = typeof t.data == "string" ? st(t.data, e) : t.data;
916
+ return [g({ type: "attachment", length: n.length, filename: t.filename, content_type: t.contentType, attachment_type: t.attachmentType }), n];
917
+ }
918
+ var fr = { session: "session", sessions: "session", attachment: "attachment", transaction: "transaction", event: "error", client_report: "internal", user_report: "default", profile: "profile", replay_event: "replay", replay_recording: "replay", check_in: "monitor", statsd: "unknown" };
919
+ function ke(t) {
920
+ return fr[t];
921
+ }
922
+ function Oe(t) {
923
+ if (!t || !t.sdk) return;
924
+ let { name: e, version: n } = t.sdk;
925
+ return { name: e, version: n };
926
+ }
927
+ function ct(t, e, n, r) {
928
+ let s = t.sdkProcessingMetadata && t.sdkProcessingMetadata.dynamicSamplingContext;
929
+ return { event_id: t.event_id, sent_at: (/* @__PURE__ */ new Date()).toISOString(), ...e && { sdk: e }, ...!!n && r && { dsn: P(r) }, ...s && { trace: g({ ...s }) } };
930
+ }
931
+ function en(t, e = Date.now()) {
932
+ let n = parseInt(`${t}`, 10);
933
+ if (!isNaN(n)) return n * 1e3;
934
+ let r = Date.parse(`${t}`);
935
+ return isNaN(r) ? 6e4 : r - e;
936
+ }
937
+ function tn(t, e) {
938
+ return t[e] || t.all || 0;
939
+ }
940
+ function ut(t, e, n = Date.now()) {
941
+ return tn(t, e) > n;
942
+ }
943
+ function dt(t, { statusCode: e, headers: n }, r = Date.now()) {
944
+ let s = { ...t }, i = n && n["x-sentry-rate-limits"], o = n && n["retry-after"];
945
+ if (i) for (let a of i.trim().split(",")) {
946
+ let [c, u] = a.split(":", 2), f = parseInt(c, 10), d = (isNaN(f) ? 60 : f) * 1e3;
947
+ if (!u) s.all = r + d;
948
+ else for (let l of u.split(";")) s[l] = r + d;
949
+ }
950
+ else o ? s.all = r + en(o, r) : e === 429 && (s.all = r + 60 * 1e3);
951
+ return s;
952
+ }
953
+ function ft(t, e) {
954
+ return t(e.stack || "", 1);
955
+ }
956
+ function nn(t, e) {
957
+ let n = { type: e.name || e.constructor.name, value: e.message }, r = ft(t, e);
958
+ return r.length && (n.stacktrace = { frames: r }), n;
959
+ }
960
+ function pr(t) {
961
+ if ("name" in t && typeof t.name == "string") {
962
+ let e = `'${t.name}' captured as exception`;
963
+ return "message" in t && typeof t.message == "string" && (e += ` with message '${t.message}'`), e;
964
+ } else return "message" in t && typeof t.message == "string" ? t.message : `Object captured as exception with keys: ${te(t)}`;
965
+ }
966
+ function pt(t, e, n, r) {
967
+ let s = n, o = r && r.data && r.data.mechanism || { handled: true, type: "generic" };
968
+ if (!U(n)) {
969
+ if (R(n)) {
970
+ let c = t(), u = c.getClient(), f = u && u.getOptions().normalizeDepth;
971
+ c.configureScope((l) => {
972
+ l.setExtra("__serialized__", z(n, f));
973
+ });
974
+ let d = pr(n);
975
+ s = r && r.syntheticException || new Error(d), s.message = d;
976
+ } else s = r && r.syntheticException || new Error(n), s.message = n;
977
+ o.synthetic = true;
978
+ }
979
+ let a = { exception: { values: [nn(e, s)] } };
980
+ return ie(a, void 0, void 0), oe(a, o), { ...a, event_id: r && r.event_id };
981
+ }
982
+ function lt(t, e, n = "info", r, s) {
983
+ let i = { event_id: r && r.event_id, level: n, message: e };
984
+ if (s && r && r.syntheticException) {
985
+ let o = ft(t, r.syntheticException);
986
+ o.length && (i.exception = { values: [{ value: e, stacktrace: { frames: o } }] });
987
+ }
988
+ return i;
989
+ }
990
+ var W = "production";
991
+ function ue() {
992
+ return Q("globalEventProcessors", () => []);
993
+ }
994
+ function rn(t) {
995
+ ue().push(t);
996
+ }
997
+ function K(t, e, n, r = 0) {
998
+ return new S((s, i) => {
999
+ let o = t[r];
1000
+ if (e === null || typeof o != "function") s(e);
1001
+ else {
1002
+ let a = o({ ...e }, n);
1003
+ (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && o.id && a === null && p.log(`Event processor "${o.id}" dropped event`), G(a) ? a.then((c) => K(t, c, n, r + 1).then(s)).then(null, i) : K(t, a, n, r + 1).then(s).then(null, i);
1004
+ }
1005
+ });
1006
+ }
1007
+ function sn(t) {
1008
+ let e = L(), n = { sid: h(), init: true, timestamp: e, started: e, duration: 0, status: "ok", errors: 0, ignoreDuration: false, toJSON: () => lr(n) };
1009
+ return t && v(n, t), n;
1010
+ }
1011
+ function v(t, e = {}) {
1012
+ 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 || L(), 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 : h()), 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) t.duration = void 0;
1013
+ else if (typeof e.duration == "number") t.duration = e.duration;
1014
+ else {
1015
+ let n = t.timestamp - t.started;
1016
+ t.duration = n >= 0 ? n : 0;
1017
+ }
1018
+ 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);
1019
+ }
1020
+ function on(t, e) {
1021
+ let n = {};
1022
+ e ? n = { status: e } : t.status === "ok" && (n = { status: "exited" }), v(t, n);
1023
+ }
1024
+ function lr(t) {
1025
+ return g({ sid: `${t.sid}`, init: t.init, started: new Date(t.started * 1e3).toISOString(), timestamp: new Date(t.timestamp * 1e3).toISOString(), status: t.status, errors: t.errors, did: typeof t.did == "number" || typeof t.did == "string" ? `${t.did}` : void 0, duration: t.duration, abnormal_mechanism: t.abnormal_mechanism, attrs: { release: t.release, environment: t.environment, ip_address: t.ipAddress, user_agent: t.userAgent } });
1026
+ }
1027
+ var mr = 100;
1028
+ var k = class {
1029
+ constructor() {
1030
+ this._notifyingListeners = false, this._scopeListeners = [], this._eventProcessors = [], this._breadcrumbs = [], this._attachments = [], this._user = {}, this._tags = {}, this._extra = {}, this._contexts = {}, this._sdkProcessingMetadata = {}, this._propagationContext = an();
1031
+ }
1032
+ static clone(e) {
1033
+ let n = new k();
1034
+ return e && (n._breadcrumbs = [...e._breadcrumbs], n._tags = { ...e._tags }, n._extra = { ...e._extra }, n._contexts = { ...e._contexts }, n._user = e._user, n._level = e._level, n._span = e._span, n._session = e._session, n._transactionName = e._transactionName, n._fingerprint = e._fingerprint, n._eventProcessors = [...e._eventProcessors], n._requestSession = e._requestSession, n._attachments = [...e._attachments], n._sdkProcessingMetadata = { ...e._sdkProcessingMetadata }, n._propagationContext = { ...e._propagationContext }), n;
1035
+ }
1036
+ addScopeListener(e) {
1037
+ this._scopeListeners.push(e);
1038
+ }
1039
+ addEventProcessor(e) {
1040
+ return this._eventProcessors.push(e), this;
1041
+ }
1042
+ setUser(e) {
1043
+ return this._user = e || {}, this._session && v(this._session, { user: e }), this._notifyScopeListeners(), this;
1044
+ }
1045
+ getUser() {
1046
+ return this._user;
1047
+ }
1048
+ getRequestSession() {
1049
+ return this._requestSession;
1050
+ }
1051
+ setRequestSession(e) {
1052
+ return this._requestSession = e, this;
1053
+ }
1054
+ setTags(e) {
1055
+ return this._tags = { ...this._tags, ...e }, this._notifyScopeListeners(), this;
1056
+ }
1057
+ setTag(e, n) {
1058
+ return this._tags = { ...this._tags, [e]: n }, this._notifyScopeListeners(), this;
1059
+ }
1060
+ setExtras(e) {
1061
+ return this._extra = { ...this._extra, ...e }, this._notifyScopeListeners(), this;
1062
+ }
1063
+ setExtra(e, n) {
1064
+ return this._extra = { ...this._extra, [e]: n }, this._notifyScopeListeners(), this;
1065
+ }
1066
+ setFingerprint(e) {
1067
+ return this._fingerprint = e, this._notifyScopeListeners(), this;
1068
+ }
1069
+ setLevel(e) {
1070
+ return this._level = e, this._notifyScopeListeners(), this;
1071
+ }
1072
+ setTransactionName(e) {
1073
+ return this._transactionName = e, this._notifyScopeListeners(), this;
1074
+ }
1075
+ setContext(e, n) {
1076
+ return n === null ? delete this._contexts[e] : this._contexts[e] = n, this._notifyScopeListeners(), this;
1077
+ }
1078
+ setSpan(e) {
1079
+ return this._span = e, this._notifyScopeListeners(), this;
1080
+ }
1081
+ getSpan() {
1082
+ return this._span;
1083
+ }
1084
+ getTransaction() {
1085
+ let e = this.getSpan();
1086
+ return e && e.transaction;
1087
+ }
1088
+ setSession(e) {
1089
+ return e ? this._session = e : delete this._session, this._notifyScopeListeners(), this;
1090
+ }
1091
+ getSession() {
1092
+ return this._session;
1093
+ }
1094
+ update(e) {
1095
+ if (!e) return this;
1096
+ if (typeof e == "function") {
1097
+ let n = e(this);
1098
+ return n instanceof k ? n : this;
1099
+ }
1100
+ return e instanceof k ? (this._tags = { ...this._tags, ...e._tags }, this._extra = { ...this._extra, ...e._extra }, this._contexts = { ...this._contexts, ...e._contexts }, e._user && Object.keys(e._user).length && (this._user = e._user), e._level && (this._level = e._level), e._fingerprint && (this._fingerprint = e._fingerprint), e._requestSession && (this._requestSession = e._requestSession), e._propagationContext && (this._propagationContext = e._propagationContext)) : R(e) && (e = e, this._tags = { ...this._tags, ...e.tags }, this._extra = { ...this._extra, ...e.extra }, this._contexts = { ...this._contexts, ...e.contexts }, e.user && (this._user = e.user), e.level && (this._level = e.level), e.fingerprint && (this._fingerprint = e.fingerprint), e.requestSession && (this._requestSession = e.requestSession), e.propagationContext && (this._propagationContext = e.propagationContext)), this;
1101
+ }
1102
+ clear() {
1103
+ return this._breadcrumbs = [], this._tags = {}, this._extra = {}, this._user = {}, this._contexts = {}, this._level = void 0, this._transactionName = void 0, this._fingerprint = void 0, this._requestSession = void 0, this._span = void 0, this._session = void 0, this._notifyScopeListeners(), this._attachments = [], this._propagationContext = an(), this;
1104
+ }
1105
+ addBreadcrumb(e, n) {
1106
+ let r = typeof n == "number" ? n : mr;
1107
+ if (r <= 0) return this;
1108
+ let s = { timestamp: B(), ...e }, i = this._breadcrumbs;
1109
+ return i.push(s), this._breadcrumbs = i.length > r ? i.slice(-r) : i, this._notifyScopeListeners(), this;
1110
+ }
1111
+ getLastBreadcrumb() {
1112
+ return this._breadcrumbs[this._breadcrumbs.length - 1];
1113
+ }
1114
+ clearBreadcrumbs() {
1115
+ return this._breadcrumbs = [], this._notifyScopeListeners(), this;
1116
+ }
1117
+ addAttachment(e) {
1118
+ return this._attachments.push(e), this;
1119
+ }
1120
+ getAttachments() {
1121
+ return this._attachments;
1122
+ }
1123
+ clearAttachments() {
1124
+ return this._attachments = [], this;
1125
+ }
1126
+ applyToEvent(e, n = {}, r) {
1127
+ if (this._extra && Object.keys(this._extra).length && (e.extra = { ...this._extra, ...e.extra }), this._tags && Object.keys(this._tags).length && (e.tags = { ...this._tags, ...e.tags }), this._user && Object.keys(this._user).length && (e.user = { ...this._user, ...e.user }), this._contexts && Object.keys(this._contexts).length && (e.contexts = { ...this._contexts, ...e.contexts }), this._level && (e.level = this._level), this._transactionName && (e.transaction = this._transactionName), this._span) {
1128
+ e.contexts = { trace: this._span.getTraceContext(), ...e.contexts };
1129
+ let o = this._span.transaction;
1130
+ if (o) {
1131
+ e.sdkProcessingMetadata = { dynamicSamplingContext: o.getDynamicSamplingContext(), ...e.sdkProcessingMetadata };
1132
+ let a = o.name;
1133
+ a && (e.tags = { transaction: a, ...e.tags });
1134
+ }
1135
+ }
1136
+ this._applyFingerprint(e);
1137
+ let s = this._getBreadcrumbs(), i = [...e.breadcrumbs || [], ...s];
1138
+ return e.breadcrumbs = i.length > 0 ? i : void 0, e.sdkProcessingMetadata = { ...e.sdkProcessingMetadata, ...this._sdkProcessingMetadata, propagationContext: this._propagationContext }, K([...r || [], ...ue(), ...this._eventProcessors], e, n);
1139
+ }
1140
+ setSDKProcessingMetadata(e) {
1141
+ return this._sdkProcessingMetadata = { ...this._sdkProcessingMetadata, ...e }, this;
1142
+ }
1143
+ setPropagationContext(e) {
1144
+ return this._propagationContext = e, this;
1145
+ }
1146
+ getPropagationContext() {
1147
+ return this._propagationContext;
1148
+ }
1149
+ _getBreadcrumbs() {
1150
+ return this._breadcrumbs;
1151
+ }
1152
+ _notifyScopeListeners() {
1153
+ this._notifyingListeners || (this._notifyingListeners = true, this._scopeListeners.forEach((e) => {
1154
+ e(this);
1155
+ }), this._notifyingListeners = false);
1156
+ }
1157
+ _applyFingerprint(e) {
1158
+ e.fingerprint = e.fingerprint ? ae(e.fingerprint) : [], this._fingerprint && (e.fingerprint = e.fingerprint.concat(this._fingerprint)), e.fingerprint && !e.fingerprint.length && delete e.fingerprint;
1159
+ }
1160
+ };
1161
+ function an() {
1162
+ return { traceId: h(), spanId: h().substring(16) };
1163
+ }
1164
+ var cn = 4;
1165
+ var _r = 100;
1166
+ var Y = class {
1167
+ constructor(e, n = new k(), r = cn) {
1168
+ this._version = r, this._stack = [{ scope: n }], e && this.bindClient(e);
1169
+ }
1170
+ isOlderThan(e) {
1171
+ return this._version < e;
1172
+ }
1173
+ bindClient(e) {
1174
+ let n = this.getStackTop();
1175
+ n.client = e, e && e.setupIntegrations && e.setupIntegrations();
1176
+ }
1177
+ pushScope() {
1178
+ let e = k.clone(this.getScope());
1179
+ return this.getStack().push({ client: this.getClient(), scope: e }), e;
1180
+ }
1181
+ popScope() {
1182
+ return this.getStack().length <= 1 ? false : !!this.getStack().pop();
1183
+ }
1184
+ withScope(e) {
1185
+ let n = this.pushScope();
1186
+ try {
1187
+ e(n);
1188
+ } finally {
1189
+ this.popScope();
1190
+ }
1191
+ }
1192
+ getClient() {
1193
+ return this.getStackTop().client;
1194
+ }
1195
+ getScope() {
1196
+ return this.getStackTop().scope;
1197
+ }
1198
+ getStack() {
1199
+ return this._stack;
1200
+ }
1201
+ getStackTop() {
1202
+ return this._stack[this._stack.length - 1];
1203
+ }
1204
+ captureException(e, n) {
1205
+ let r = this._lastEventId = n && n.event_id ? n.event_id : h(), s = new Error("Sentry syntheticException");
1206
+ return this._withClient((i, o) => {
1207
+ i.captureException(e, { originalException: e, syntheticException: s, ...n, event_id: r }, o);
1208
+ }), r;
1209
+ }
1210
+ captureMessage(e, n, r) {
1211
+ let s = this._lastEventId = r && r.event_id ? r.event_id : h(), i = new Error(e);
1212
+ return this._withClient((o, a) => {
1213
+ o.captureMessage(e, n, { originalException: e, syntheticException: i, ...r, event_id: s }, a);
1214
+ }), s;
1215
+ }
1216
+ captureEvent(e, n) {
1217
+ let r = n && n.event_id ? n.event_id : h();
1218
+ return e.type || (this._lastEventId = r), this._withClient((s, i) => {
1219
+ s.captureEvent(e, { ...n, event_id: r }, i);
1220
+ }), r;
1221
+ }
1222
+ lastEventId() {
1223
+ return this._lastEventId;
1224
+ }
1225
+ addBreadcrumb(e, n) {
1226
+ let { scope: r, client: s } = this.getStackTop();
1227
+ if (!s) return;
1228
+ let { beforeBreadcrumb: i = null, maxBreadcrumbs: o = _r } = s.getOptions && s.getOptions() || {};
1229
+ if (o <= 0) return;
1230
+ let c = { timestamp: B(), ...e }, u = i ? _e(() => i(c, n)) : c;
1231
+ u !== null && (s.emit && s.emit("beforeAddBreadcrumb", u, n), r.addBreadcrumb(u, o));
1232
+ }
1233
+ setUser(e) {
1234
+ this.getScope().setUser(e);
1235
+ }
1236
+ setTags(e) {
1237
+ this.getScope().setTags(e);
1238
+ }
1239
+ setExtras(e) {
1240
+ this.getScope().setExtras(e);
1241
+ }
1242
+ setTag(e, n) {
1243
+ this.getScope().setTag(e, n);
1244
+ }
1245
+ setExtra(e, n) {
1246
+ this.getScope().setExtra(e, n);
1247
+ }
1248
+ setContext(e, n) {
1249
+ this.getScope().setContext(e, n);
1250
+ }
1251
+ configureScope(e) {
1252
+ let { scope: n, client: r } = this.getStackTop();
1253
+ r && e(n);
1254
+ }
1255
+ run(e) {
1256
+ let n = mt(this);
1257
+ try {
1258
+ e(this);
1259
+ } finally {
1260
+ mt(n);
1261
+ }
1262
+ }
1263
+ getIntegration(e) {
1264
+ let n = this.getClient();
1265
+ if (!n) return null;
1266
+ try {
1267
+ return n.getIntegration(e);
1268
+ } catch {
1269
+ return (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && p.warn(`Cannot retrieve integration ${e.id} from the current Hub`), null;
1270
+ }
1271
+ }
1272
+ startTransaction(e, n) {
1273
+ let r = this._callExtensionMethod("startTransaction", e, n);
1274
+ if ((typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && !r) {
1275
+ let s = this.getClient();
1276
+ console.warn(s ? `Tracing extension 'startTransaction' has not been added. Call 'addTracingExtensions' before calling 'init':
1277
+ Sentry.addTracingExtensions();
1278
+ Sentry.init({...});
1279
+ ` : "Tracing extension 'startTransaction' is missing. You should 'init' the SDK before calling 'startTransaction'");
1280
+ }
1281
+ return r;
1282
+ }
1283
+ traceHeaders() {
1284
+ return this._callExtensionMethod("traceHeaders");
1285
+ }
1286
+ captureSession(e = false) {
1287
+ if (e) return this.endSession();
1288
+ this._sendSessionUpdate();
1289
+ }
1290
+ endSession() {
1291
+ let n = this.getStackTop().scope, r = n.getSession();
1292
+ r && on(r), this._sendSessionUpdate(), n.setSession();
1293
+ }
1294
+ startSession(e) {
1295
+ let { scope: n, client: r } = this.getStackTop(), { release: s, environment: i = W } = r && r.getOptions() || {}, { userAgent: o } = m.navigator || {}, a = sn({ release: s, environment: i, user: n.getUser(), ...o && { userAgent: o }, ...e }), c = n.getSession && n.getSession();
1296
+ return c && c.status === "ok" && v(c, { status: "exited" }), this.endSession(), n.setSession(a), a;
1297
+ }
1298
+ shouldSendDefaultPii() {
1299
+ let e = this.getClient(), n = e && e.getOptions();
1300
+ return !!(n && n.sendDefaultPii);
1301
+ }
1302
+ _sendSessionUpdate() {
1303
+ let { scope: e, client: n } = this.getStackTop(), r = e.getSession();
1304
+ r && n && n.captureSession && n.captureSession(r);
1305
+ }
1306
+ _withClient(e) {
1307
+ let { scope: n, client: r } = this.getStackTop();
1308
+ r && e(r, n);
1309
+ }
1310
+ _callExtensionMethod(e, ...n) {
1311
+ let s = $().__SENTRY__;
1312
+ if (s && s.extensions && typeof s.extensions[e] == "function") return s.extensions[e].apply(this, n);
1313
+ (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && p.warn(`Extension method ${e} couldn't be found, doing nothing.`);
1314
+ }
1315
+ };
1316
+ function $() {
1317
+ return m.__SENTRY__ = m.__SENTRY__ || { extensions: {}, hub: void 0 }, m;
1318
+ }
1319
+ function mt(t) {
1320
+ let e = $(), n = Ae(e);
1321
+ return _t(e, t), n;
1322
+ }
1323
+ function b() {
1324
+ let t = $();
1325
+ if (t.__SENTRY__ && t.__SENTRY__.acs) {
1326
+ let e = t.__SENTRY__.acs.getCurrentHub();
1327
+ if (e) return e;
1328
+ }
1329
+ return hr(t);
1330
+ }
1331
+ function hr(t = $()) {
1332
+ return (!gr(t) || Ae(t).isOlderThan(cn)) && _t(t, new Y()), Ae(t);
1333
+ }
1334
+ function gr(t) {
1335
+ return !!(t && t.__SENTRY__ && t.__SENTRY__.hub);
1336
+ }
1337
+ function Ae(t) {
1338
+ return Q("hub", () => new Y(), t);
1339
+ }
1340
+ function _t(t, e) {
1341
+ if (!t) return false;
1342
+ let n = t.__SENTRY__ = t.__SENTRY__ || {};
1343
+ return n.hub = e, true;
1344
+ }
1345
+ function un(t) {
1346
+ return (t || b()).getScope().getTransaction();
1347
+ }
1348
+ var dn = false;
1349
+ function fn() {
1350
+ dn || (dn = true, xe("error", ht), xe("unhandledrejection", ht));
1351
+ }
1352
+ function ht() {
1353
+ let t = un();
1354
+ if (t) {
1355
+ let e = "internal_error";
1356
+ (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && p.log(`[Tracing] Transaction: ${e} -> Global error occured`), t.setStatus(e);
1357
+ }
1358
+ }
1359
+ ht.tag = "sentry_tracingErrorCallback";
1360
+ var ve = class {
1361
+ constructor(e = 1e3) {
1362
+ this._maxlen = e, this.spans = [];
1363
+ }
1364
+ add(e) {
1365
+ this.spans.length > this._maxlen ? e.spanRecorder = void 0 : this.spans.push(e);
1366
+ }
1367
+ };
1368
+ var V = class {
1369
+ constructor(e = {}) {
1370
+ this.traceId = e.traceId || h(), this.spanId = e.spanId || h().substring(16), this.startTimestamp = e.startTimestamp || L(), this.tags = e.tags || {}, this.data = e.data || {}, this.instrumenter = e.instrumenter || "sentry", this.origin = e.origin || "manual", e.parentSpanId && (this.parentSpanId = e.parentSpanId), "sampled" in e && (this.sampled = e.sampled), e.op && (this.op = e.op), e.description && (this.description = e.description), e.name && (this.description = e.name), e.status && (this.status = e.status), e.endTimestamp && (this.endTimestamp = e.endTimestamp);
1371
+ }
1372
+ get name() {
1373
+ return this.description || "";
1374
+ }
1375
+ set name(e) {
1376
+ this.setName(e);
1377
+ }
1378
+ startChild(e) {
1379
+ let n = new V({ ...e, parentSpanId: this.spanId, sampled: this.sampled, traceId: this.traceId });
1380
+ if (n.spanRecorder = this.spanRecorder, n.spanRecorder && n.spanRecorder.add(n), n.transaction = this.transaction, (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && n.transaction) {
1381
+ let r = e && e.op || "< unknown op >", s = n.transaction.name || "< unknown name >", i = n.transaction.spanId, o = `[Tracing] Starting '${r}' span on transaction '${s}' (${i}).`;
1382
+ n.transaction.metadata.spanMetadata[n.spanId] = { logMessage: o }, p.log(o);
1383
+ }
1384
+ return n;
1385
+ }
1386
+ setTag(e, n) {
1387
+ return this.tags = { ...this.tags, [e]: n }, this;
1388
+ }
1389
+ setData(e, n) {
1390
+ return this.data = { ...this.data, [e]: n }, this;
1391
+ }
1392
+ setStatus(e) {
1393
+ return this.status = e, this;
1394
+ }
1395
+ setHttpStatus(e) {
1396
+ this.setTag("http.status_code", String(e)), this.setData("http.response.status_code", e);
1397
+ let n = Er(e);
1398
+ return n !== "unknown_error" && this.setStatus(n), this;
1399
+ }
1400
+ setName(e) {
1401
+ this.description = e;
1402
+ }
1403
+ isSuccess() {
1404
+ return this.status === "ok";
1405
+ }
1406
+ finish(e) {
1407
+ if ((typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && this.transaction && this.transaction.spanId !== this.spanId) {
1408
+ let { logMessage: n } = this.transaction.metadata.spanMetadata[this.spanId];
1409
+ n && p.log(n.replace("Starting", "Finishing"));
1410
+ }
1411
+ this.endTimestamp = typeof e == "number" ? e : L();
1412
+ }
1413
+ toTraceparent() {
1414
+ return rt(this.traceId, this.spanId, this.sampled);
1415
+ }
1416
+ toContext() {
1417
+ return g({ data: this.data, description: this.description, endTimestamp: this.endTimestamp, op: this.op, parentSpanId: this.parentSpanId, sampled: this.sampled, spanId: this.spanId, startTimestamp: this.startTimestamp, status: this.status, tags: this.tags, traceId: this.traceId });
1418
+ }
1419
+ updateWithContext(e) {
1420
+ return this.data = e.data || {}, this.description = e.description, this.endTimestamp = e.endTimestamp, this.op = e.op, this.parentSpanId = e.parentSpanId, this.sampled = e.sampled, this.spanId = e.spanId || this.spanId, this.startTimestamp = e.startTimestamp || this.startTimestamp, this.status = e.status, this.tags = e.tags || {}, this.traceId = e.traceId || this.traceId, this;
1421
+ }
1422
+ getTraceContext() {
1423
+ return g({ data: Object.keys(this.data).length > 0 ? this.data : void 0, description: this.description, op: this.op, parent_span_id: this.parentSpanId, span_id: this.spanId, status: this.status, tags: Object.keys(this.tags).length > 0 ? this.tags : void 0, trace_id: this.traceId });
1424
+ }
1425
+ toJSON() {
1426
+ return g({ data: Object.keys(this.data).length > 0 ? this.data : void 0, description: this.description, op: this.op, parent_span_id: this.parentSpanId, span_id: this.spanId, start_timestamp: this.startTimestamp, status: this.status, tags: Object.keys(this.tags).length > 0 ? this.tags : void 0, timestamp: this.endTimestamp, trace_id: this.traceId, origin: this.origin });
1427
+ }
1428
+ };
1429
+ function Er(t) {
1430
+ if (t < 400 && t >= 100) return "ok";
1431
+ if (t >= 400 && t < 500) switch (t) {
1432
+ case 401:
1433
+ return "unauthenticated";
1434
+ case 403:
1435
+ return "permission_denied";
1436
+ case 404:
1437
+ return "not_found";
1438
+ case 409:
1439
+ return "already_exists";
1440
+ case 413:
1441
+ return "failed_precondition";
1442
+ case 429:
1443
+ return "resource_exhausted";
1444
+ default:
1445
+ return "invalid_argument";
1446
+ }
1447
+ if (t >= 500 && t < 600) switch (t) {
1448
+ case 501:
1449
+ return "unimplemented";
1450
+ case 503:
1451
+ return "unavailable";
1452
+ case 504:
1453
+ return "deadline_exceeded";
1454
+ default:
1455
+ return "internal_error";
1456
+ }
1457
+ return "unknown_error";
1458
+ }
1459
+ function J(t, e, n) {
1460
+ let r = e.getOptions(), { publicKey: s } = e.getDsn() || {}, { segment: i } = n && n.getUser() || {}, o = g({ environment: r.environment || W, release: r.release, user_segment: i, public_key: s, trace_id: t });
1461
+ return e.emit && e.emit("createDsc", o), o;
1462
+ }
1463
+ var we = class extends V {
1464
+ constructor(e, n) {
1465
+ super(e), delete this.description, this._measurements = {}, this._contexts = {}, this._hub = n || b(), this._name = e.name || "", this.metadata = { source: "custom", ...e.metadata, spanMetadata: {} }, this._trimEnd = e.trimEnd, this.transaction = this;
1466
+ let r = this.metadata.dynamicSamplingContext;
1467
+ r && (this._frozenDynamicSamplingContext = { ...r });
1468
+ }
1469
+ get name() {
1470
+ return this._name;
1471
+ }
1472
+ set name(e) {
1473
+ this.setName(e);
1474
+ }
1475
+ setName(e, n = "custom") {
1476
+ this._name = e, this.metadata.source = n;
1477
+ }
1478
+ initSpanRecorder(e = 1e3) {
1479
+ this.spanRecorder || (this.spanRecorder = new ve(e)), this.spanRecorder.add(this);
1480
+ }
1481
+ setContext(e, n) {
1482
+ n === null ? delete this._contexts[e] : this._contexts[e] = n;
1483
+ }
1484
+ setMeasurement(e, n, r = "") {
1485
+ this._measurements[e] = { value: n, unit: r };
1486
+ }
1487
+ setMetadata(e) {
1488
+ this.metadata = { ...this.metadata, ...e };
1489
+ }
1490
+ finish(e) {
1491
+ let n = this._finishTransaction(e);
1492
+ if (n) return this._hub.captureEvent(n);
1493
+ }
1494
+ toContext() {
1495
+ let e = super.toContext();
1496
+ return g({ ...e, name: this.name, trimEnd: this._trimEnd });
1497
+ }
1498
+ updateWithContext(e) {
1499
+ return super.updateWithContext(e), this.name = e.name || "", this._trimEnd = e.trimEnd, this;
1500
+ }
1501
+ getDynamicSamplingContext() {
1502
+ if (this._frozenDynamicSamplingContext) return this._frozenDynamicSamplingContext;
1503
+ let e = this._hub || b(), n = e.getClient();
1504
+ if (!n) return {};
1505
+ let r = e.getScope(), s = J(this.traceId, n, r), i = this.metadata.sampleRate;
1506
+ i !== void 0 && (s.sample_rate = `${i}`);
1507
+ let o = this.metadata.source;
1508
+ return o && o !== "url" && (s.transaction = this.name), this.sampled !== void 0 && (s.sampled = String(this.sampled)), s;
1509
+ }
1510
+ setHub(e) {
1511
+ this._hub = e;
1512
+ }
1513
+ _finishTransaction(e) {
1514
+ if (this.endTimestamp !== void 0) return;
1515
+ this.name || ((typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && p.warn("Transaction has no name, falling back to `<unlabeled transaction>`."), this.name = "<unlabeled transaction>"), super.finish(e);
1516
+ let n = this._hub.getClient();
1517
+ if (n && n.emit && n.emit("finishTransaction", this), this.sampled !== true) {
1518
+ (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && p.log("[Tracing] Discarding transaction because its trace was not chosen to be sampled."), n && n.recordDroppedEvent("sample_rate", "transaction");
1519
+ return;
1520
+ }
1521
+ let r = this.spanRecorder ? this.spanRecorder.spans.filter((a) => a !== this && a.endTimestamp) : [];
1522
+ this._trimEnd && r.length > 0 && (this.endTimestamp = r.reduce((a, c) => a.endTimestamp && c.endTimestamp ? a.endTimestamp > c.endTimestamp ? a : c : a).endTimestamp);
1523
+ let s = this.metadata, i = { contexts: { ...this._contexts, trace: this.getTraceContext() }, spans: r, start_timestamp: this.startTimestamp, tags: this.tags, timestamp: this.endTimestamp, transaction: this.name, type: "transaction", sdkProcessingMetadata: { ...s, dynamicSamplingContext: this.getDynamicSamplingContext() }, ...s.source && { transaction_info: { source: s.source } } };
1524
+ return Object.keys(this._measurements).length > 0 && ((typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && p.log("[Measurements] Adding measurements to transaction", JSON.stringify(this._measurements, void 0, 2)), i.measurements = this._measurements), (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && p.log(`[Tracing] Finishing ${this.op} transaction: ${this.name}.`), i;
1525
+ }
1526
+ };
1527
+ function pn(t) {
1528
+ if (typeof __SENTRY_TRACING__ == "boolean" && !__SENTRY_TRACING__) return false;
1529
+ let e = b().getClient(), n = t || e && e.getOptions();
1530
+ return !!n && (n.enableTracing || "tracesSampleRate" in n || "tracesSampler" in n);
1531
+ }
1532
+ function ln(t, e, n) {
1533
+ if (!pn(e)) return t.sampled = false, t;
1534
+ if (t.sampled !== void 0) return t.setMetadata({ sampleRate: Number(t.sampled) }), t;
1535
+ let r;
1536
+ return typeof e.tracesSampler == "function" ? (r = e.tracesSampler(n), t.setMetadata({ sampleRate: Number(r) })) : n.parentSampled !== void 0 ? r = n.parentSampled : typeof e.tracesSampleRate < "u" ? (r = e.tracesSampleRate, t.setMetadata({ sampleRate: Number(r) })) : (r = 1, t.setMetadata({ sampleRate: r })), Sr(r) ? r ? (t.sampled = Math.random() < r, t.sampled ? ((typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && p.log(`[Tracing] starting ${t.op} transaction - ${t.name}`), t) : ((typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && p.log(`[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ${Number(r)})`), t)) : ((typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && p.log(`[Tracing] Discarding transaction because ${typeof e.tracesSampler == "function" ? "tracesSampler returned 0 or false" : "a negative sampling decision was inherited or tracesSampleRate is set to 0"}`), t.sampled = false, t) : ((typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && p.warn("[Tracing] Discarding transaction because of invalid sample rate."), t.sampled = false, t);
1537
+ }
1538
+ function Sr(t) {
1539
+ return Z(t) || !(typeof t == "number" || typeof t == "boolean") ? ((typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && p.warn(`[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(t)} of type ${JSON.stringify(typeof t)}.`), false) : t < 0 || t > 1 ? ((typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && p.warn(`[Tracing] Given sample rate is invalid. Sample rate must be between 0 and 1. Got ${t}.`), false) : true;
1540
+ }
1541
+ function yr() {
1542
+ let e = this.getScope().getSpan();
1543
+ return e ? { "sentry-trace": e.toTraceparent() } : {};
1544
+ }
1545
+ function Tr(t, e) {
1546
+ let n = this.getClient(), r = n && n.getOptions() || {}, s = r.instrumenter || "sentry", i = t.instrumenter || "sentry";
1547
+ s !== i && ((typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && p.error(`A transaction was started with instrumenter=\`${i}\`, but the SDK is configured with the \`${s}\` instrumenter.
1548
+ The transaction will not be sampled. Please use the ${s} instrumentation to start transactions.`), t.sampled = false);
1549
+ let o = new we(t, this);
1550
+ return o = ln(o, r, { parentSampled: t.parentSampled, transactionContext: t, ...e }), o.sampled && o.initSpanRecorder(r._experiments && r._experiments.maxSpans), n && n.emit && n.emit("startTransaction", o), o;
1551
+ }
1552
+ function mn() {
1553
+ let t = $();
1554
+ t.__SENTRY__ && (t.__SENTRY__.extensions = t.__SENTRY__.extensions || {}, t.__SENTRY__.extensions.startTransaction || (t.__SENTRY__.extensions.startTransaction = Tr), t.__SENTRY__.extensions.traceHeaders || (t.__SENTRY__.extensions.traceHeaders = yr), fn());
1555
+ }
1556
+ var Pe = class {
1557
+ constructor(e, n) {
1558
+ this._client = e, this.flushTimeout = 60, this._pendingAggregates = {}, this._isEnabled = true, this._intervalId = setInterval(() => this.flush(), this.flushTimeout * 1e3), this._sessionAttrs = n;
1559
+ }
1560
+ flush() {
1561
+ let e = this.getSessionAggregates();
1562
+ e.aggregates.length !== 0 && (this._pendingAggregates = {}, this._client.sendSession(e));
1563
+ }
1564
+ getSessionAggregates() {
1565
+ let e = Object.keys(this._pendingAggregates).map((r) => this._pendingAggregates[parseInt(r)]), n = { attrs: this._sessionAttrs, aggregates: e };
1566
+ return g(n);
1567
+ }
1568
+ close() {
1569
+ clearInterval(this._intervalId), this._isEnabled = false, this.flush();
1570
+ }
1571
+ incrementSessionStatusCount() {
1572
+ if (!this._isEnabled) return;
1573
+ let e = b().getScope(), n = e.getRequestSession();
1574
+ n && n.status && (this._incrementSessionStatusCount(n.status, /* @__PURE__ */ new Date()), e.setRequestSession(void 0));
1575
+ }
1576
+ _incrementSessionStatusCount(e, n) {
1577
+ let r = new Date(n).setSeconds(0, 0);
1578
+ this._pendingAggregates[r] = this._pendingAggregates[r] || {};
1579
+ let s = this._pendingAggregates[r];
1580
+ switch (s.started || (s.started = new Date(r).toISOString()), e) {
1581
+ case "errored":
1582
+ return s.errored = (s.errored || 0) + 1, s.errored;
1583
+ case "ok":
1584
+ return s.exited = (s.exited || 0) + 1, s.exited;
1585
+ default:
1586
+ return s.crashed = (s.crashed || 0) + 1, s.crashed;
1587
+ }
1588
+ }
1589
+ };
1590
+ var br = "7";
1591
+ function Rr(t) {
1592
+ let e = t.protocol ? `${t.protocol}:` : "", n = t.port ? `:${t.port}` : "";
1593
+ return `${e}//${t.host}${n}${t.path ? `/${t.path}` : ""}/api/`;
1594
+ }
1595
+ function xr(t) {
1596
+ return `${Rr(t)}${t.projectId}/envelope/`;
1597
+ }
1598
+ function Ir(t, e) {
1599
+ return We({ sentry_key: t.publicKey, sentry_version: br, ...e && { sentry_client: `${e.name}/${e.version}` } });
1600
+ }
1601
+ function _n(t, e = {}) {
1602
+ let n = typeof e == "string" ? e : e.tunnel, r = typeof e == "string" || !e._metadata ? void 0 : e._metadata.sdk;
1603
+ return n || `${xr(t)}?${Ir(t, r)}`;
1604
+ }
1605
+ function Dr(t, e) {
1606
+ 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;
1607
+ }
1608
+ function hn(t, e, n, r) {
1609
+ let s = Oe(n), i = { sent_at: (/* @__PURE__ */ new Date()).toISOString(), ...s && { sdk: s }, ...!!r && e && { dsn: P(e) } }, o = "aggregates" in t ? [{ type: "sessions" }, t] : [{ type: "session" }, t.toJSON()];
1610
+ return C(i, [o]);
1611
+ }
1612
+ function gn(t, e, n, r) {
1613
+ let s = Oe(n), i = t.type && t.type !== "replay_event" ? t.type : "event";
1614
+ Dr(t, n && n.sdk);
1615
+ let o = ct(t, s, r, e);
1616
+ return delete t.sdkProcessingMetadata, C(o, [[{ type: i }, t]]);
1617
+ }
1618
+ var En = [];
1619
+ function Nr(t) {
1620
+ let e = {};
1621
+ return t.forEach((n) => {
1622
+ let { name: r } = n, s = e[r];
1623
+ s && !s.isDefaultInstance && n.isDefaultInstance || (e[r] = n);
1624
+ }), Object.keys(e).map((n) => e[n]);
1625
+ }
1626
+ function gt(t) {
1627
+ let e = t.defaultIntegrations || [], n = t.integrations;
1628
+ e.forEach((o) => {
1629
+ o.isDefaultInstance = true;
1630
+ });
1631
+ let r;
1632
+ Array.isArray(n) ? r = [...e, ...n] : typeof n == "function" ? r = ae(n(e)) : r = e;
1633
+ let s = Nr(r), i = kr(s, (o) => o.name === "Debug");
1634
+ if (i !== -1) {
1635
+ let [o] = s.splice(i, 1);
1636
+ s.push(o);
1637
+ }
1638
+ return s;
1639
+ }
1640
+ function Sn(t, e) {
1641
+ let n = {};
1642
+ return e.forEach((r) => {
1643
+ r && Et(t, r, n);
1644
+ }), n;
1645
+ }
1646
+ function Et(t, e, n) {
1647
+ if (n[e.name] = e, En.indexOf(e.name) === -1 && (e.setupOnce(rn, b), En.push(e.name)), t.on && typeof e.preprocessEvent == "function") {
1648
+ let r = e.preprocessEvent.bind(e);
1649
+ t.on("preprocessEvent", (s, i) => r(s, i, t));
1650
+ }
1651
+ if (t.addEventProcessor && typeof e.processEvent == "function") {
1652
+ let r = e.processEvent.bind(e), s = Object.assign((i, o) => r(i, o, t), { id: e.name });
1653
+ t.addEventProcessor(s);
1654
+ }
1655
+ (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && p.log(`Integration installed: ${e.name}`);
1656
+ }
1657
+ function kr(t, e) {
1658
+ for (let n = 0; n < t.length; n++) if (e(t[n]) === true) return n;
1659
+ return -1;
1660
+ }
1661
+ function Tn(t, e, n, r, s) {
1662
+ let { normalizeDepth: i = 3, normalizeMaxBreadth: o = 1e3 } = t, a = { ...e, event_id: e.event_id || n.event_id || h(), timestamp: e.timestamp || B() }, c = n.integrations || t.integrations.map((l) => l.name);
1663
+ Or(a, t), wr(a, c), e.type === void 0 && Ar(a, t.stackParser);
1664
+ let u = r;
1665
+ n.captureContext && (u = k.clone(u).update(n.captureContext));
1666
+ let f = T(a), d = s && s.getEventProcessors ? s.getEventProcessors() : [];
1667
+ if (u) {
1668
+ if (u.getAttachments) {
1669
+ let l = [...n.attachments || [], ...u.getAttachments()];
1670
+ l.length && (n.attachments = l);
1671
+ }
1672
+ f = u.applyToEvent(a, n, d);
1673
+ } else f = K([...d, ...ue()], a, n);
1674
+ return f.then((l) => (l && vr(l), typeof i == "number" && i > 0 ? Pr(l, i, o) : l));
1675
+ }
1676
+ function Or(t, e) {
1677
+ let { environment: n, release: r, dist: s, maxValueLength: i = 250 } = e;
1678
+ "environment" in t || (t.environment = "environment" in e ? n : W), t.release === void 0 && r !== void 0 && (t.release = r), t.dist === void 0 && s !== void 0 && (t.dist = s), t.message && (t.message = w(t.message, i));
1679
+ let o = t.exception && t.exception.values && t.exception.values[0];
1680
+ o && o.value && (o.value = w(o.value, i));
1681
+ let a = t.request;
1682
+ a && a.url && (a.url = w(a.url, i));
1683
+ }
1684
+ var yn = /* @__PURE__ */ new WeakMap();
1685
+ function Ar(t, e) {
1686
+ let n = m._sentryDebugIds;
1687
+ if (!n) return;
1688
+ let r, s = yn.get(e);
1689
+ s ? r = s : (r = /* @__PURE__ */ new Map(), yn.set(e, r));
1690
+ let i = Object.keys(n).reduce((o, a) => {
1691
+ let c, u = r.get(a);
1692
+ u ? c = u : (c = e(a), r.set(a, c));
1693
+ for (let f = c.length - 1; f >= 0; f--) {
1694
+ let d = c[f];
1695
+ if (d.filename) {
1696
+ o[d.filename] = n[a];
1697
+ break;
1698
+ }
1699
+ }
1700
+ return o;
1701
+ }, {});
1702
+ try {
1703
+ t.exception.values.forEach((o) => {
1704
+ o.stacktrace.frames.forEach((a) => {
1705
+ a.filename && (a.debug_id = i[a.filename]);
1706
+ });
1707
+ });
1708
+ } catch {
1709
+ }
1710
+ }
1711
+ function vr(t) {
1712
+ let e = {};
1713
+ try {
1714
+ t.exception.values.forEach((r) => {
1715
+ r.stacktrace.frames.forEach((s) => {
1716
+ 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);
1717
+ });
1718
+ });
1719
+ } catch {
1720
+ }
1721
+ if (Object.keys(e).length === 0) return;
1722
+ t.debug_meta = t.debug_meta || {}, t.debug_meta.images = t.debug_meta.images || [];
1723
+ let n = t.debug_meta.images;
1724
+ Object.keys(e).forEach((r) => {
1725
+ n.push({ type: "sourcemap", code_file: r, debug_id: e[r] });
1726
+ });
1727
+ }
1728
+ function wr(t, e) {
1729
+ e.length > 0 && (t.sdk = t.sdk || {}, t.sdk.integrations = [...t.sdk.integrations || [], ...e]);
1730
+ }
1731
+ function Pr(t, e, n) {
1732
+ if (!t) return null;
1733
+ let r = { ...t, ...t.breadcrumbs && { breadcrumbs: t.breadcrumbs.map((s) => ({ ...s, ...s.data && { data: N(s.data, e, n) } })) }, ...t.user && { user: N(t.user, e, n) }, ...t.contexts && { contexts: N(t.contexts, e, n) }, ...t.extra && { extra: N(t.extra, e, n) } };
1734
+ return t.contexts && t.contexts.trace && r.contexts && (r.contexts.trace = t.contexts.trace, t.contexts.trace.data && (r.contexts.trace.data = N(t.contexts.trace.data, e, n))), t.spans && (r.spans = t.spans.map((s) => (s.data && (s.data = N(s.data, e, n)), s))), r;
1735
+ }
1736
+ var bn = "Not capturing exception because it's already been captured.";
1737
+ var Ce = class {
1738
+ constructor(e) {
1739
+ if (this._options = e, this._integrations = {}, this._integrationsInitialized = false, this._numProcessing = 0, this._outcomes = {}, this._hooks = {}, this._eventProcessors = [], e.dsn ? this._dsn = he(e.dsn) : (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && p.warn("No DSN provided, client will not send events."), this._dsn) {
1740
+ let n = _n(this._dsn, e);
1741
+ this._transport = e.transport({ recordDroppedEvent: this.recordDroppedEvent.bind(this), ...e.transportOptions, url: n });
1742
+ }
1743
+ }
1744
+ captureException(e, n, r) {
1745
+ if (Ie(e)) {
1746
+ (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && p.log(bn);
1747
+ return;
1748
+ }
1749
+ let s = n && n.event_id;
1750
+ return this._process(this.eventFromException(e, n).then((i) => this._captureEvent(i, n, r)).then((i) => {
1751
+ s = i;
1752
+ })), s;
1753
+ }
1754
+ captureMessage(e, n, r, s) {
1755
+ let i = r && r.event_id, o = le(e) ? this.eventFromMessage(String(e), n, r) : this.eventFromException(e, r);
1756
+ return this._process(o.then((a) => this._captureEvent(a, r, s)).then((a) => {
1757
+ i = a;
1758
+ })), i;
1759
+ }
1760
+ captureEvent(e, n, r) {
1761
+ if (n && n.originalException && Ie(n.originalException)) {
1762
+ (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && p.log(bn);
1763
+ return;
1764
+ }
1765
+ let s = n && n.event_id;
1766
+ return this._process(this._captureEvent(e, n, r).then((i) => {
1767
+ s = i;
1768
+ })), s;
1769
+ }
1770
+ captureSession(e) {
1771
+ typeof e.release != "string" ? (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && p.warn("Discarded session because of missing or non-string release") : (this.sendSession(e), v(e, { init: false }));
1772
+ }
1773
+ getDsn() {
1774
+ return this._dsn;
1775
+ }
1776
+ getOptions() {
1777
+ return this._options;
1778
+ }
1779
+ getSdkMetadata() {
1780
+ return this._options._metadata;
1781
+ }
1782
+ getTransport() {
1783
+ return this._transport;
1784
+ }
1785
+ flush(e) {
1786
+ let n = this._transport;
1787
+ return n ? this._isClientDoneProcessing(e).then((r) => n.flush(e).then((s) => r && s)) : T(true);
1788
+ }
1789
+ close(e) {
1790
+ return this.flush(e).then((n) => (this.getOptions().enabled = false, n));
1791
+ }
1792
+ getEventProcessors() {
1793
+ return this._eventProcessors;
1794
+ }
1795
+ addEventProcessor(e) {
1796
+ this._eventProcessors.push(e);
1797
+ }
1798
+ setupIntegrations(e) {
1799
+ (e && !this._integrationsInitialized || this._isEnabled() && !this._integrationsInitialized) && (this._integrations = Sn(this, this._options.integrations), this._integrationsInitialized = true);
1800
+ }
1801
+ getIntegrationById(e) {
1802
+ return this._integrations[e];
1803
+ }
1804
+ getIntegration(e) {
1805
+ try {
1806
+ return this._integrations[e.id] || null;
1807
+ } catch {
1808
+ return (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && p.warn(`Cannot retrieve integration ${e.id} from the current Client`), null;
1809
+ }
1810
+ }
1811
+ addIntegration(e) {
1812
+ Et(this, e, this._integrations);
1813
+ }
1814
+ sendEvent(e, n = {}) {
1815
+ this.emit("beforeSendEvent", e, n);
1816
+ let r = gn(e, this._dsn, this._options._metadata, this._options.tunnel);
1817
+ for (let i of n.attachments || []) r = it(r, at(i, this._options.transportOptions && this._options.transportOptions.textEncoder));
1818
+ let s = this._sendEnvelope(r);
1819
+ s && s.then((i) => this.emit("afterSendEvent", e, i), null);
1820
+ }
1821
+ sendSession(e) {
1822
+ let n = hn(e, this._dsn, this._options._metadata, this._options.tunnel);
1823
+ this._sendEnvelope(n);
1824
+ }
1825
+ recordDroppedEvent(e, n, r) {
1826
+ if (this._options.sendClientReports) {
1827
+ let s = `${e}:${n}`;
1828
+ (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && p.log(`Adding outcome: "${s}"`), this._outcomes[s] = this._outcomes[s] + 1 || 1;
1829
+ }
1830
+ }
1831
+ on(e, n) {
1832
+ this._hooks[e] || (this._hooks[e] = []), this._hooks[e].push(n);
1833
+ }
1834
+ emit(e, ...n) {
1835
+ this._hooks[e] && this._hooks[e].forEach((r) => r(...n));
1836
+ }
1837
+ _updateSessionFromEvent(e, n) {
1838
+ let r = false, s = false, i = n.exception && n.exception.values;
1839
+ if (i) {
1840
+ s = true;
1841
+ for (let c of i) {
1842
+ let u = c.mechanism;
1843
+ if (u && u.handled === false) {
1844
+ r = true;
1845
+ break;
1846
+ }
1847
+ }
1848
+ }
1849
+ let o = e.status === "ok";
1850
+ (o && e.errors === 0 || o && r) && (v(e, { ...r && { status: "crashed" }, errors: e.errors || Number(s || r) }), this.captureSession(e));
1851
+ }
1852
+ _isClientDoneProcessing(e) {
1853
+ return new S((n) => {
1854
+ let r = 0, s = 1, i = setInterval(() => {
1855
+ this._numProcessing == 0 ? (clearInterval(i), n(true)) : (r += s, e && r >= e && (clearInterval(i), n(false)));
1856
+ }, s);
1857
+ });
1858
+ }
1859
+ _isEnabled() {
1860
+ return this.getOptions().enabled !== false && this._transport !== void 0;
1861
+ }
1862
+ _prepareEvent(e, n, r) {
1863
+ let s = this.getOptions(), i = Object.keys(this._integrations);
1864
+ return !n.integrations && i.length > 0 && (n.integrations = i), this.emit("preprocessEvent", e, n), Tn(s, e, n, r, this).then((o) => {
1865
+ if (o === null) return o;
1866
+ let { propagationContext: a } = o.sdkProcessingMetadata || {};
1867
+ if (!(o.contexts && o.contexts.trace) && a) {
1868
+ let { traceId: u, spanId: f, parentSpanId: d, dsc: l } = a;
1869
+ o.contexts = { trace: { trace_id: u, span_id: f, parent_span_id: d }, ...o.contexts };
1870
+ let _ = l || J(u, this, r);
1871
+ o.sdkProcessingMetadata = { dynamicSamplingContext: _, ...o.sdkProcessingMetadata };
1872
+ }
1873
+ return o;
1874
+ });
1875
+ }
1876
+ _captureEvent(e, n = {}, r) {
1877
+ return this._processEvent(e, n, r).then((s) => s.event_id, (s) => {
1878
+ if (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) {
1879
+ let i = s;
1880
+ i.logLevel === "log" ? p.log(i.message) : p.warn(i);
1881
+ }
1882
+ });
1883
+ }
1884
+ _processEvent(e, n, r) {
1885
+ let s = this.getOptions(), { sampleRate: i } = s, o = xn(e), a = Rn(e), c = e.type || "error", u = `before send for type \`${c}\``;
1886
+ if (a && typeof i == "number" && Math.random() > i) return this.recordDroppedEvent("sample_rate", "error", e), F(new y(`Discarding event because it's not included in the random sample (sampling rate = ${i})`, "log"));
1887
+ let f = c === "replay_event" ? "replay" : c;
1888
+ return this._prepareEvent(e, n, r).then((d) => {
1889
+ if (d === null) throw this.recordDroppedEvent("event_processor", f, e), new y("An event processor returned `null`, will not send event.", "log");
1890
+ if (n.data && n.data.__sentry__ === true) return d;
1891
+ let _ = Mr(s, d, n);
1892
+ return Cr(_, u);
1893
+ }).then((d) => {
1894
+ if (d === null) throw this.recordDroppedEvent("before_send", f, e), new y(`${u} returned \`null\`, will not send event.`, "log");
1895
+ let l = r && r.getSession();
1896
+ !o && l && this._updateSessionFromEvent(l, d);
1897
+ let _ = d.transaction_info;
1898
+ if (o && _ && d.transaction !== e.transaction) {
1899
+ let M = "custom";
1900
+ d.transaction_info = { ..._, source: M };
1901
+ }
1902
+ return this.sendEvent(d, n), d;
1903
+ }).then(null, (d) => {
1904
+ throw d instanceof y ? d : (this.captureException(d, { data: { __sentry__: true }, originalException: d }), new y(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
1905
+ Reason: ${d}`));
1906
+ });
1907
+ }
1908
+ _process(e) {
1909
+ this._numProcessing++, e.then((n) => (this._numProcessing--, n), (n) => (this._numProcessing--, n));
1910
+ }
1911
+ _sendEnvelope(e) {
1912
+ if (this.emit("beforeEnvelope", e), this._isEnabled() && this._transport) return this._transport.send(e).then(null, (n) => {
1913
+ (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && p.error("Error while sending event:", n);
1914
+ });
1915
+ (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && p.error("Transport disabled");
1916
+ }
1917
+ _clearOutcomes() {
1918
+ let e = this._outcomes;
1919
+ return this._outcomes = {}, Object.keys(e).map((n) => {
1920
+ let [r, s] = n.split(":");
1921
+ return { reason: r, category: s, quantity: e[n] };
1922
+ });
1923
+ }
1924
+ };
1925
+ function Cr(t, e) {
1926
+ let n = `${e} must return \`null\` or a valid event.`;
1927
+ if (G(t)) return t.then((r) => {
1928
+ if (!R(r) && r !== null) throw new y(n);
1929
+ return r;
1930
+ }, (r) => {
1931
+ throw new y(`${e} rejected with ${r}`);
1932
+ });
1933
+ if (!R(t) && t !== null) throw new y(n);
1934
+ return t;
1935
+ }
1936
+ function Mr(t, e, n) {
1937
+ let { beforeSend: r, beforeSendTransaction: s } = t;
1938
+ return Rn(e) && r ? r(e, n) : xn(e) && s ? s(e, n) : e;
1939
+ }
1940
+ function Rn(t) {
1941
+ return t.type === void 0;
1942
+ }
1943
+ function xn(t) {
1944
+ return t.type === "transaction";
1945
+ }
1946
+ function In(t, e, n, r, s) {
1947
+ let i = { sent_at: (/* @__PURE__ */ new Date()).toISOString() };
1948
+ n && n.sdk && (i.sdk = { name: n.sdk.name, version: n.sdk.version }), r && s && (i.dsn = P(s)), e && (i.trace = g(e));
1949
+ let o = Ur(t);
1950
+ return C(i, [o]);
1951
+ }
1952
+ function Ur(t) {
1953
+ return [{ type: "check_in" }, t];
1954
+ }
1955
+ var de = class extends Ce {
1956
+ constructor(e) {
1957
+ mn(), super(e);
1958
+ }
1959
+ eventFromException(e, n) {
1960
+ return T(pt(b, this._options.stackParser, e, n));
1961
+ }
1962
+ eventFromMessage(e, n = "info", r) {
1963
+ return T(lt(this._options.stackParser, e, n, r, this._options.attachStacktrace));
1964
+ }
1965
+ captureException(e, n, r) {
1966
+ if (this._options.autoSessionTracking && this._sessionFlusher && r) {
1967
+ let s = r.getRequestSession();
1968
+ s && s.status === "ok" && (s.status = "errored");
1969
+ }
1970
+ return super.captureException(e, n, r);
1971
+ }
1972
+ captureEvent(e, n, r) {
1973
+ if (this._options.autoSessionTracking && this._sessionFlusher && r && (e.type || "exception") === "exception" && e.exception && e.exception.values && e.exception.values.length > 0) {
1974
+ let o = r.getRequestSession();
1975
+ o && o.status === "ok" && (o.status = "errored");
1976
+ }
1977
+ return super.captureEvent(e, n, r);
1978
+ }
1979
+ close(e) {
1980
+ return this._sessionFlusher && this._sessionFlusher.close(), super.close(e);
1981
+ }
1982
+ initSessionFlusher() {
1983
+ let { release: e, environment: n } = this._options;
1984
+ e ? this._sessionFlusher = new Pe(this, { release: e, environment: n }) : (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && p.warn("Cannot initialise an instance of SessionFlusher if no release is provided!");
1985
+ }
1986
+ captureCheckIn(e, n, r) {
1987
+ let s = e.status !== "in_progress" && e.checkInId ? e.checkInId : h();
1988
+ if (!this._isEnabled()) return (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && p.warn("SDK not enabled, will not capture checkin."), s;
1989
+ let i = this.getOptions(), { release: o, environment: a, tunnel: c } = i, u = { check_in_id: s, monitor_slug: e.monitorSlug, status: e.status, release: o, environment: a };
1990
+ e.status !== "in_progress" && (u.duration = e.duration), n && (u.monitor_config = { schedule: n.schedule, checkin_margin: n.checkinMargin, max_runtime: n.maxRuntime, timezone: n.timezone });
1991
+ let [f, d] = this._getTraceInfoFromScope(r);
1992
+ d && (u.contexts = { trace: d });
1993
+ let l = In(u, f, this.getSdkMetadata(), c, this.getDsn());
1994
+ return (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && p.info("Sending checkin:", e.monitorSlug, e.status), this._sendEnvelope(l), s;
1995
+ }
1996
+ _captureRequestSession() {
1997
+ this._sessionFlusher ? this._sessionFlusher.incrementSessionStatusCount() : (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && p.warn("Discarded request mode session because autoSessionTracking option was disabled");
1998
+ }
1999
+ _prepareEvent(e, n, r) {
2000
+ return this._options.platform && (e.platform = e.platform || this._options.platform), this._options.runtime && (e.contexts = { ...e.contexts, runtime: (e.contexts || {}).runtime || this._options.runtime }), this._options.serverName && (e.server_name = e.server_name || this._options.serverName), super._prepareEvent(e, n, r);
2001
+ }
2002
+ _getTraceInfoFromScope(e) {
2003
+ if (!e) return [void 0, void 0];
2004
+ let n = e.getSpan();
2005
+ if (n) return [n.transaction ? n.transaction.getDynamicSamplingContext() : void 0, n.getTraceContext()];
2006
+ let { traceId: r, spanId: s, parentSpanId: i, dsc: o } = e.getPropagationContext(), a = { trace_id: r, span_id: s, parent_span_id: i };
2007
+ return o ? [o, a] : [J(r, this, e), a];
2008
+ }
2009
+ };
2010
+ var Gr = 30;
2011
+ function St(t, e, n = et(t.bufferSize || Gr)) {
2012
+ let r = {}, s = (o) => n.drain(o);
2013
+ function i(o) {
2014
+ let a = [];
2015
+ if (Ne(o, (d, l) => {
2016
+ let _ = ke(l);
2017
+ if (ut(r, _)) {
2018
+ let M = Dn(d, l);
2019
+ t.recordDroppedEvent("ratelimit_backoff", _, M);
2020
+ } else a.push(d);
2021
+ }), a.length === 0) return T();
2022
+ let c = C(o[0], a), u = (d) => {
2023
+ Ne(c, (l, _) => {
2024
+ let M = Dn(l, _);
2025
+ t.recordDroppedEvent(d, ke(_), M);
2026
+ });
2027
+ }, f = () => e({ body: ot(c, t.textEncoder) }).then((d) => (d.statusCode !== void 0 && (d.statusCode < 200 || d.statusCode >= 300) && (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && p.warn(`Sentry responded with status code ${d.statusCode} to sent event.`), r = dt(r, d), d), (d) => {
2028
+ throw u("network_error"), d;
2029
+ });
2030
+ return n.add(f).then((d) => d, (d) => {
2031
+ if (d instanceof y) return (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && p.error("Skipped sending event because buffer is full."), u("queue_overflow"), T();
2032
+ throw d;
2033
+ });
2034
+ }
2035
+ return i.__sentry__baseTransport__ = true, { send: i, flush: s };
2036
+ }
2037
+ function Dn(t, e) {
2038
+ if (!(e !== "event" && e !== "transaction")) return Array.isArray(t) ? t[1] : void 0;
2039
+ }
2040
+ function kn(t) {
2041
+ return typeof t == "object" && t !== null;
2042
+ }
2043
+ function Fr(t) {
2044
+ return kn(t) && "handled" in t && typeof t.handled == "boolean" && "type" in t && typeof t.type == "string";
2045
+ }
2046
+ function Br(t) {
2047
+ return kn(t) && "mechanism" in t && Fr(t.mechanism);
2048
+ }
2049
+ function Lr() {
2050
+ if (m.SENTRY_RELEASE && m.SENTRY_RELEASE.id) return m.SENTRY_RELEASE.id;
2051
+ }
2052
+ function Nn(t, e) {
2053
+ return t !== void 0 ? (t[e[0]] = e[1], t) : { [e[0]]: e[1] };
2054
+ }
2055
+ function On(t, e) {
2056
+ return t(e.stack || "", 1);
2057
+ }
2058
+ function Yr(t) {
2059
+ let e = t && t.message;
2060
+ return e ? e.error && typeof e.error.message == "string" ? e.error.message : e : "No error message";
2061
+ }
2062
+ function An(t, e) {
2063
+ let n = { type: e.name || e.constructor.name, value: Yr(e) }, r = On(t, e);
2064
+ return r.length && (n.stacktrace = { frames: r }), n.type === void 0 && n.value === "" && (n.value = "Unrecoverable error caught"), n;
2065
+ }
2066
+ function $r(t, e, n, r) {
2067
+ let s, o = (r && r.data && Br(r.data) ? r.data.mechanism : void 0) ?? { handled: true, type: "generic" };
2068
+ if (U(n)) s = n;
2069
+ else {
2070
+ if (R(n)) {
2071
+ let c = `Non-Error exception captured with keys: ${te(n)}`, u = t?.getClient(), f = u && u.getOptions().normalizeDepth;
2072
+ t?.configureScope((d) => {
2073
+ d.setExtra("__serialized__", z(n, f));
2074
+ }), s = r && r.syntheticException || new Error(c), s.message = c;
2075
+ } else s = r && r.syntheticException || new Error(n), s.message = n;
2076
+ o.synthetic = true;
2077
+ }
2078
+ let a = { exception: { values: [An(e, s)] } };
2079
+ return ie(a, void 0, void 0), oe(a, o), { ...a, event_id: r && r.event_id };
2080
+ }
2081
+ function jr(t, e, n = "info", r, s) {
2082
+ let i = { event_id: r && r.event_id, level: n, message: e };
2083
+ if (s && r && r.syntheticException) {
2084
+ let o = On(t, r.syntheticException);
2085
+ o.length && (i.exception = { values: [{ value: e, stacktrace: { frames: o } }] });
2086
+ }
2087
+ return i;
2088
+ }
2089
+ var Hr = 5;
2090
+ var Fe = class {
2091
+ name = Fe.id;
2092
+ limit;
2093
+ constructor(e = {}) {
2094
+ this.limit = e.limit || Hr;
2095
+ }
2096
+ setupOnce(e, n) {
2097
+ let r = n().getClient();
2098
+ r && e((s, i) => {
2099
+ let o = n().getIntegration(Fe);
2100
+ return o ? qr(r.getOptions().stackParser, o.limit, s, i) : s;
2101
+ });
2102
+ }
2103
+ };
2104
+ var Me = Fe;
2105
+ fe(Me, "id", "LinkedErrors");
2106
+ function qr(t, e, n, r) {
2107
+ if (!n.exception || !n.exception.values || !r || !O(r.originalException, Error)) return n;
2108
+ let s = vn(t, e, r.originalException);
2109
+ return n.exception.values = [...s, ...n.exception.values], n;
2110
+ }
2111
+ function vn(t, e, n, r = []) {
2112
+ if (!O(n.cause, Error) || r.length + 1 >= e) return r;
2113
+ let s = An(t, n.cause);
2114
+ return vn(t, e, n.cause, [s, ...r]);
2115
+ }
2116
+ var zr = { allowedHeaders: ["CF-RAY", "CF-Worker"] };
2117
+ var X;
2118
+ var Be = class {
2119
+ constructor(e = {}) {
2120
+ fe(this, "name", Be.id);
2121
+ Rt(this, X, void 0);
2122
+ xt(this, X, { ...zr, ...e });
2123
+ }
2124
+ setupOnce(e, n) {
2125
+ n().getClient() && e((s) => {
2126
+ let { sdkProcessingMetadata: i } = s;
2127
+ return !n().getIntegration(Be) || !i || ("request" in i && i.request instanceof Request && (s.request = Kr(i.request, Ye(this, X)), s.user = Wr(s.user ?? {}, i.request, Ye(this, X))), "requestData" in i && (s.request ? s.request.data = i.requestData : s.request = { data: i.requestData })), s;
2128
+ });
2129
+ }
2130
+ };
2131
+ var Ue = Be;
2132
+ X = /* @__PURE__ */ new WeakMap(), fe(Ue, "id", "RequestData");
2133
+ function Wr(t, e, n) {
2134
+ let r = e.headers.get("CF-Connecting-IP"), { allowedIps: s } = n, i = { ...t };
2135
+ return !("ip_address" in t) && r && s !== void 0 && Vr(r, s) && (i.ip_address = r), Object.keys(i).length > 0 ? i : void 0;
2136
+ }
2137
+ function Kr(t, e) {
2138
+ let n = t.headers.get("cookie"), r;
2139
+ if (n) try {
2140
+ r = Jr(n);
2141
+ } catch {
2142
+ }
2143
+ let s = {};
2144
+ for (let [u, f] of t.headers.entries()) u !== "cookie" && (s[u] = f);
2145
+ let i = { method: t.method, cookies: r, headers: s };
2146
+ try {
2147
+ let u = new URL(t.url);
2148
+ i.url = `${u.protocol}//${u.hostname}${u.pathname}`, i.query_string = u.search;
2149
+ } catch {
2150
+ let f = t.url.indexOf("?");
2151
+ f < 0 ? i.url = t.url : (i.url = t.url.substr(0, f), i.query_string = t.url.substr(f + 1));
2152
+ }
2153
+ let { allowedHeaders: o, allowedCookies: a, allowedSearchParams: c } = e;
2154
+ if (o !== void 0 && i.headers ? (i.headers = yt(i.headers, o), Object.keys(i.headers).length === 0 && delete i.headers) : delete i.headers, a !== void 0 && i.cookies ? (i.cookies = yt(i.cookies, a), Object.keys(i.cookies).length === 0 && delete i.cookies) : delete i.cookies, c !== void 0) {
2155
+ let u = Object.fromEntries(new URLSearchParams(i.query_string)), f = new URLSearchParams();
2156
+ Object.keys(yt(u, c)).forEach((d) => {
2157
+ f.set(d, u[d]);
2158
+ }), i.query_string = f.toString();
2159
+ } else delete i.query_string;
2160
+ return i;
2161
+ }
2162
+ function Vr(t, e) {
2163
+ return typeof e == "boolean" ? e : e instanceof RegExp ? e.test(t) : Array.isArray(e) ? e.map((r) => r.toLowerCase()).includes(t) : false;
2164
+ }
2165
+ function yt(t, e) {
2166
+ let n = () => false;
2167
+ if (typeof e == "boolean") return e ? t : {};
2168
+ if (e instanceof RegExp) n = (r) => e.test(r);
2169
+ else if (Array.isArray(e)) {
2170
+ let r = e.map((s) => s.toLowerCase());
2171
+ n = (s) => r.includes(s.toLowerCase());
2172
+ } else return {};
2173
+ return Object.keys(t).filter(n).reduce((r, s) => (r[s] = t[s], r), {});
2174
+ }
2175
+ function Jr(t) {
2176
+ if (typeof t != "string") return {};
2177
+ try {
2178
+ return t.split(";").map((e) => e.split("=")).reduce((e, [n, r]) => (e[decodeURIComponent(n.trim())] = decodeURIComponent(r.trim()), e), {});
2179
+ } catch {
2180
+ return {};
2181
+ }
2182
+ }
2183
+ function Xr(t, e) {
2184
+ let n = {};
2185
+ return t.forEach((r) => {
2186
+ n[r.name] = r, r.setupOnce((s) => {
2187
+ e.getScope()?.addEventProcessor(s);
2188
+ }, () => e);
2189
+ }), n;
2190
+ }
2191
+ var Tt = class extends de {
2192
+ #e = null;
2193
+ constructor(e) {
2194
+ e._metadata = e._metadata || {}, e._metadata.sdk = e._metadata.sdk || { name: "toucan-js", packages: [{ name: "npm:toucan-js", version: "3.3.1" }], version: "3.3.1" }, super(e);
2195
+ }
2196
+ setupIntegrations() {
2197
+ this._isEnabled() && !this._integrationsInitialized && this.#e && (this._integrations = Xr(this._options.integrations, this.#e), this._integrationsInitialized = true);
2198
+ }
2199
+ eventFromException(e, n) {
2200
+ return T($r(this.#e, this._options.stackParser, e, n));
2201
+ }
2202
+ eventFromMessage(e, n = "info", r) {
2203
+ return T(jr(this._options.stackParser, e, n, r, this._options.attachStacktrace));
2204
+ }
2205
+ _prepareEvent(e, n, r) {
2206
+ return e.platform = e.platform || "javascript", this.getOptions().request && (e.sdkProcessingMetadata = Nn(e.sdkProcessingMetadata, ["request", this.getOptions().request])), this.getOptions().requestData && (e.sdkProcessingMetadata = Nn(e.sdkProcessingMetadata, ["requestData", this.getOptions().requestData])), super._prepareEvent(e, n, r);
2207
+ }
2208
+ getSdk() {
2209
+ return this.#e;
2210
+ }
2211
+ setSdk(e) {
2212
+ this.#e = e;
2213
+ }
2214
+ setRequestBody(e) {
2215
+ this.getOptions().requestData = e;
2216
+ }
2217
+ setEnabled(e) {
2218
+ this.getOptions().enabled = e;
2219
+ }
2220
+ };
2221
+ function Zr(t) {
2222
+ let [e, n] = Je(t);
2223
+ return [e, (s) => {
2224
+ let i = n(s);
2225
+ if (i) {
2226
+ let o = i.filename;
2227
+ i.abs_path = o !== void 0 && !o.startsWith("/") ? `/${o}` : o, i.in_app = o !== void 0;
2228
+ }
2229
+ return i;
2230
+ }];
2231
+ }
2232
+ function Qr(t) {
2233
+ if (t) return Qe(t, ".js");
2234
+ }
2235
+ var es = Ee(Zr(Qr));
2236
+ function ts(t) {
2237
+ function e({ body: n }) {
2238
+ try {
2239
+ let s = (t.fetcher ?? fetch)(t.url, { method: "POST", headers: t.headers, body: n }).then((i) => ({ statusCode: i.status, headers: { "retry-after": i.headers.get("Retry-After"), "x-sentry-rate-limits": i.headers.get("X-Sentry-Rate-Limits") } }));
2240
+ return t.context && t.context.waitUntil(s), s;
2241
+ } catch (r) {
2242
+ return F(r);
2243
+ }
2244
+ }
2245
+ return St(t, e);
2246
+ }
2247
+ var Ge = class extends Y {
2248
+ constructor(e) {
2249
+ if (e.defaultIntegrations = e.defaultIntegrations === false ? [] : [...Array.isArray(e.defaultIntegrations) ? e.defaultIntegrations : [new Ue(e.requestDataOptions), new Me()]], e.release === void 0) {
2250
+ let r = Lr();
2251
+ r !== void 0 && (e.release = r);
2252
+ }
2253
+ let n = new Tt({ ...e, transport: ts, integrations: gt(e), stackParser: Ve(e.stackParser || es), transportOptions: { ...e.transportOptions, context: e.context } });
2254
+ super(n), n.setSdk(this), n.setupIntegrations();
2255
+ }
2256
+ setRequestBody(e) {
2257
+ this.getClient()?.setRequestBody(e);
2258
+ }
2259
+ setEnabled(e) {
2260
+ this.getClient()?.setEnabled(e);
2261
+ }
2262
+ captureCheckIn(e, n, r) {
2263
+ return e.status === "in_progress" && this.setContext("monitor", { slug: e.monitorSlug }), this.getClient().captureCheckIn(e, n, r);
2264
+ }
2265
+ };
2266
+ function wn(t, e, n, r, s) {
2267
+ if (!(n && r && s)) return;
2268
+ let i = new Ge({ dsn: n, request: t, context: e, sampleRate: 1, requestDataOptions: { allowedHeaders: ["user-agent", "cf-challenge", "accept-encoding", "accept-language", "cf-ray", "content-length", "content-type", "host"], allowedSearchParams: /(.*)/ }, transportOptions: { headers: { "CF-Access-Client-ID": r, "CF-Access-Client-Secret": s } } }), o = t.cf?.colo ?? "UNKNOWN";
2269
+ i.setTag("colo", o);
2270
+ let a = t.headers.get("user-agent") ?? "UA UNKNOWN";
2271
+ return i.setUser({ userAgent: a, colo: o }), i;
2272
+ }
2273
+ var Le = class {
2274
+ constructor(e) {
2275
+ this.data = {};
2276
+ this.readyAnalytics = e;
2277
+ }
2278
+ setData(e) {
2279
+ this.data = { ...this.data, ...e };
2280
+ }
2281
+ getData(e) {
2282
+ return this.data[e];
2283
+ }
2284
+ write() {
2285
+ this.readyAnalytics && this.readyAnalytics.logEvent({ version: 1, accountId: 0, indexId: this.data.hostname?.substring(0, 96), doubles: [this.data.requestTime ?? -1, this.data.coloId ?? -1, this.data.metalId ?? -1, this.data.coloTier ?? -1, this.data.userWorkerAhead === void 0 ? -1 : Number(this.data.userWorkerAhead)], blobs: [this.data.hostname?.substring(0, 256), this.data.dispatchtype, this.data.error?.substring(0, 256), this.data.version, this.data.coloRegion] });
2286
+ }
2287
+ };
2288
+ var Za = { async fetch(t, e, n) {
2289
+ let r, s = new Le(e.ANALYTICS), i = new pe(e.UNSAFE_PERFORMANCE), o = i.now();
2290
+ try {
2291
+ r = wn(t, n, e.SENTRY_DSN, e.SENTRY_ACCESS_CLIENT_ID, e.SENTRY_ACCESS_CLIENT_SECRET);
2292
+ let a = new URL(t.url);
2293
+ r && (r.setUser({ username: a.hostname }), r.setTag("colo", e.COLO_METADATA.coloId), r.setTag("metal", e.COLO_METADATA.metalId)), e.COLO_METADATA && e.VERSION_METADATA && e.CONFIG && s.setData({ coloId: e.COLO_METADATA.coloId, metalId: e.COLO_METADATA.metalId, coloTier: e.COLO_METADATA.coloTier, coloRegion: e.COLO_METADATA.coloRegion, hostname: a.hostname, version: e.VERSION_METADATA.id, userWorkerAhead: e.CONFIG.invoke_user_worker_ahead_of_assets });
2294
+ let c = t.clone();
2295
+ if (e.CONFIG.invoke_user_worker_ahead_of_assets) {
2296
+ if (!e.CONFIG.has_user_worker) throw new Error("Fetch for user worker without having a user worker binding");
2297
+ return e.USER_WORKER.fetch(c);
2298
+ }
2299
+ return e.CONFIG.has_user_worker ? await e.ASSET_WORKER.unstable_canFetch(t) ? (s.setData({ dispatchtype: "asset" }), e.ASSET_WORKER.fetch(c)) : (s.setData({ dispatchtype: "worker" }), e.USER_WORKER.fetch(c)) : (s.setData({ dispatchtype: "asset" }), e.ASSET_WORKER.fetch(t));
2300
+ } catch (a) {
2301
+ throw a instanceof Error && s.setData({ error: a.message }), r && r.captureException(a), a;
2302
+ } finally {
2303
+ s.setData({ requestTime: i.now() - o }), s.write();
2304
+ }
2305
+ } };
2306
+
2307
+ // src/asset-workers/router-worker.ts
2308
+ var router_worker_default = Za;
2309
+ export {
2310
+ router_worker_default as default
2311
+ };