@chargebee/atomicpricing
Version:
JS wrapper for your Atomic Pricing hosted page
1,754 lines • 130 kB
JavaScript
var nr = Object.defineProperty, rr = Object.defineProperties;
var sr = Object.getOwnPropertyDescriptors;
var lt = Object.getOwnPropertySymbols;
var Se = Object.prototype.hasOwnProperty, Ie = Object.prototype.propertyIsEnumerable;
var Ee = (t, e, n) => e in t ? nr(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, f = (t, e) => {
for (var n in e || (e = {}))
Se.call(e, n) && Ee(t, n, e[n]);
if (lt)
for (var n of lt(e))
Ie.call(e, n) && Ee(t, n, e[n]);
return t;
}, y = (t, e) => rr(t, sr(e));
var be = (t, e) => {
var n = {};
for (var r in t)
Se.call(t, r) && e.indexOf(r) < 0 && (n[r] = t[r]);
if (t != null && lt)
for (var r of lt(t))
e.indexOf(r) < 0 && Ie.call(t, r) && (n[r] = t[r]);
return n;
};
var Lt = (t, e, n) => new Promise((r, s) => {
var i = (c) => {
try {
a(n.next(c));
} catch (u) {
s(u);
}
}, o = (c) => {
try {
a(n.throw(c));
} catch (u) {
s(u);
}
}, a = (c) => c.done ? r(c.value) : Promise.resolve(c.value).then(i, o);
a((n = n.apply(t, e)).next());
});
const C = {
THEME_UPDATED: "pricify.theme.updated",
PAGE_LOAD: "pricify.hosted.page.load",
DIMENSION: "pricify.hosted.page.dimension",
SET_VISITOR: "pricify.hosted.page.setVisitor",
SET_QUANTITY: "pricify.hosted.page.setQuantity",
SET_BILLING_ADDRESS: "pricify.hosted.page.setBillingAddress",
SET_SHIPPING_ADDRESS: "pricify.hosted.page.setShippingAddress",
SET_BUSINESS_ENTITY: "pricify.hosted.page.setBusinessEntity",
SET_PRICE_VARIANT: "pricify.hosted.page.setPriceVariant",
SET_SUBSCRIPTION_ATTRIBUTES: "pricify.hosted.page.setSubscriptionAttributes"
}, _ = typeof __SENTRY_DEBUG__ == "undefined" || __SENTRY_DEBUG__, W = "9.30.0", m = globalThis;
function Rt() {
return Nt(m), m;
}
function Nt(t) {
const e = t.__SENTRY__ = t.__SENTRY__ || {};
return e.version = e.version || W, e[W] = e[W] || {};
}
function Pt(t, e, n = m) {
const r = n.__SENTRY__ = n.__SENTRY__ || {}, s = r[W] = r[W] || {};
return s[t] || (s[t] = e());
}
const pn = Object.prototype.toString;
function oe(t) {
switch (pn.call(t)) {
case "[object Error]":
case "[object Exception]":
case "[object DOMException]":
case "[object WebAssembly.Exception]":
return !0;
default:
return B(t, Error);
}
}
function nt(t, e) {
return pn.call(t) === `[object ${e}]`;
}
function hn(t) {
return nt(t, "ErrorEvent");
}
function Te(t) {
return nt(t, "DOMError");
}
function ir(t) {
return nt(t, "DOMException");
}
function M(t) {
return nt(t, "String");
}
function ae(t) {
return typeof t == "object" && t !== null && "__sentry_template_string__" in t && "__sentry_template_values__" in t;
}
function ce(t) {
return t === null || ae(t) || typeof t != "object" && typeof t != "function";
}
function it(t) {
return nt(t, "Object");
}
function At(t) {
return typeof Event != "undefined" && B(t, Event);
}
function or(t) {
return typeof Element != "undefined" && B(t, Element);
}
function ar(t) {
return nt(t, "RegExp");
}
function Dt(t) {
return !!(t != null && t.then && typeof t.then == "function");
}
function cr(t) {
return it(t) && "nativeEvent" in t && "preventDefault" in t && "stopPropagation" in t;
}
function B(t, e) {
try {
return t instanceof e;
} catch (n) {
return !1;
}
}
function gn(t) {
return !!(typeof t == "object" && t !== null && (t.__isVue || t._isVue));
}
function ur(t) {
return typeof Request != "undefined" && B(t, Request);
}
const ue = m, fr = 80;
function _n(t, e = {}) {
if (!t)
return "<unknown>";
try {
let n = t;
const r = 5, s = [];
let i = 0, o = 0;
const a = " > ", c = a.length;
let u;
const l = Array.isArray(e) ? e : e.keyAttrs, d = !Array.isArray(e) && e.maxStringLength || fr;
for (; n && i++ < r && (u = lr(n, l), !(u === "html" || i > 1 && o + s.length * c + u.length >= d)); )
s.push(u), o += u.length, n = n.parentNode;
return s.reverse().join(a);
} catch (n) {
return "<unknown>";
}
}
function lr(t, e) {
const n = t, r = [];
if (!(n != null && n.tagName))
return "";
if (ue.HTMLElement && n instanceof HTMLElement && n.dataset) {
if (n.dataset.sentryComponent)
return n.dataset.sentryComponent;
if (n.dataset.sentryElement)
return n.dataset.sentryElement;
}
r.push(n.tagName.toLowerCase());
const s = e != null && e.length ? e.filter((o) => n.getAttribute(o)).map((o) => [o, n.getAttribute(o)]) : null;
if (s != null && s.length)
s.forEach((o) => {
r.push(`[${o[0]}="${o[1]}"]`);
});
else {
n.id && r.push(`#${n.id}`);
const o = n.className;
if (o && M(o)) {
const a = o.split(/\s+/);
for (const c of a)
r.push(`.${c}`);
}
}
const i = ["aria-label", "type", "name", "title", "alt"];
for (const o of i) {
const a = n.getAttribute(o);
a && r.push(`[${o}="${a}"]`);
}
return r.join("");
}
function fe() {
try {
return ue.document.location.href;
} catch (t) {
return "";
}
}
function dr(t) {
if (!ue.HTMLElement)
return null;
let e = t;
const n = 5;
for (let r = 0; r < n; r++) {
if (!e)
return null;
if (e instanceof HTMLElement) {
if (e.dataset.sentryComponent)
return e.dataset.sentryComponent;
if (e.dataset.sentryElement)
return e.dataset.sentryElement;
}
e = e.parentNode;
}
return null;
}
const pr = "Sentry Logger ", Wt = [
"debug",
"info",
"warn",
"error",
"log",
"assert",
"trace"
], It = {};
function rt(t) {
if (!("console" in m))
return t();
const e = m.console, n = {}, r = Object.keys(It);
r.forEach((s) => {
const i = It[s];
n[s] = e[s], e[s] = i;
});
try {
return t();
} finally {
r.forEach((s) => {
e[s] = n[s];
});
}
}
function hr() {
let t = !1;
const e = {
enable: () => {
t = !0;
},
disable: () => {
t = !1;
},
isEnabled: () => t
};
return _ ? Wt.forEach((n) => {
e[n] = (...r) => {
t && rt(() => {
m.console[n](`${pr}[${n}]:`, ...r);
});
};
}) : Wt.forEach((n) => {
e[n] = () => {
};
}), e;
}
const g = Pt("logger", hr);
function bt(t, e = 0) {
return typeof t != "string" || e === 0 || t.length <= e ? t : `${t.slice(0, e)}...`;
}
function ve(t, e) {
if (!Array.isArray(t))
return "";
const n = [];
for (let r = 0; r < t.length; r++) {
const s = t[r];
try {
gn(s) ? n.push("[VueViewModel]") : n.push(String(s));
} catch (i) {
n.push("[value cannot be serialized]");
}
}
return n.join(e);
}
function gr(t, e, n = !1) {
return M(t) ? ar(e) ? e.test(t) : M(e) ? n ? t === e : t.includes(e) : !1 : !1;
}
function Ot(t, e = [], n = !1) {
return e.some((r) => gr(t, r, n));
}
function N(t, e, n) {
if (!(e in t))
return;
const r = t[e];
if (typeof r != "function")
return;
const s = n(r);
typeof s == "function" && mn(s, r);
try {
t[e] = s;
} catch (i) {
_ && g.log(`Failed to replace method "${e}" in object`, t);
}
}
function Y(t, e, n) {
try {
Object.defineProperty(t, e, {
// enumerable: false, // the default, so we can save on bundle size by not explicitly setting it
value: n,
writable: !0,
configurable: !0
});
} catch (r) {
_ && g.log(`Failed to add non-enumerable property "${e}" to object`, t);
}
}
function mn(t, e) {
try {
const n = e.prototype || {};
t.prototype = e.prototype = n, Y(t, "__sentry_original__", e);
} catch (n) {
}
}
function le(t) {
return t.__sentry_original__;
}
function yn(t) {
if (oe(t))
return f({
message: t.message,
name: t.name,
stack: t.stack
}, Re(t));
if (At(t)) {
const e = f({
type: t.type,
target: we(t.target),
currentTarget: we(t.currentTarget)
}, Re(t));
return typeof CustomEvent != "undefined" && B(t, CustomEvent) && (e.detail = t.detail), e;
} else
return t;
}
function we(t) {
try {
return or(t) ? _n(t) : Object.prototype.toString.call(t);
} catch (e) {
return "<unknown>";
}
}
function Re(t) {
if (typeof t == "object" && t !== null) {
const e = {};
for (const n in t)
Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
return e;
} else
return {};
}
function _r(t, e = 40) {
const n = Object.keys(yn(t));
n.sort();
const r = n[0];
if (!r)
return "[object has no keys]";
if (r.length >= e)
return bt(r, e);
for (let s = n.length; s > 0; s--) {
const i = n.slice(0, s).join(", ");
if (!(i.length > e))
return s === n.length ? i : bt(i, e);
}
return "";
}
function mr() {
const t = m;
return t.crypto || t.msCrypto;
}
function P(t = mr()) {
let e = () => Math.random() * 16;
try {
if (t != null && t.randomUUID)
return t.randomUUID().replace(/-/g, "");
t != null && t.getRandomValues && (e = () => {
const n = new Uint8Array(1);
return t.getRandomValues(n), n[0];
});
} catch (n) {
}
return ([1e7] + 1e3 + 4e3 + 8e3 + 1e11).replace(
/[018]/g,
(n) => (
// eslint-disable-next-line no-bitwise
(n ^ (e() & 15) >> n / 4).toString(16)
)
);
}
function En(t) {
var e, n;
return (n = (e = t.exception) == null ? void 0 : e.values) == null ? void 0 : n[0];
}
function G(t) {
const { message: e, event_id: n } = t;
if (e)
return e;
const r = En(t);
return r ? r.type && r.value ? `${r.type}: ${r.value}` : r.type || r.value || n || "<unknown>" : n || "<unknown>";
}
function Yt(t, e, n) {
const r = t.exception = t.exception || {}, s = r.values = r.values || [], i = s[0] = s[0] || {};
i.value || (i.value = e || ""), i.type || (i.type = n || "Error");
}
function Q(t, e) {
const n = En(t);
if (!n)
return;
const r = { type: "generic", handled: !0 }, s = n.mechanism;
if (n.mechanism = f(f(f({}, r), s), e), e && "data" in e) {
const i = f(f({}, s == null ? void 0 : s.data), e.data);
n.mechanism.data = i;
}
}
function Ne(t) {
if (yr(t))
return !0;
try {
Y(t, "__sentry_captured__", !0);
} catch (e) {
}
return !1;
}
function yr(t) {
try {
return t.__sentry_captured__;
} catch (e) {
}
}
const Sn = 1e3;
function at() {
return Date.now() / Sn;
}
function Er() {
const { performance: t } = m;
if (!(t != null && t.now))
return at;
const e = Date.now() - t.now(), n = t.timeOrigin == null ? e : t.timeOrigin;
return () => (n + t.now()) / Sn;
}
const $ = Er();
function Sr(t) {
const e = $(), n = {
sid: P(),
init: !0,
timestamp: e,
started: e,
duration: 0,
status: "ok",
errors: 0,
ignoreDuration: !1,
toJSON: () => br(n)
};
return t && Z(n, t), n;
}
function Z(t, e = {}) {
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 || $(), 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 : P()), 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;
else if (typeof e.duration == "number")
t.duration = e.duration;
else {
const n = t.timestamp - t.started;
t.duration = n >= 0 ? n : 0;
}
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);
}
function Ir(t, e) {
let n = {};
e ? n = { status: e } : t.status === "ok" && (n = { status: "exited" }), Z(t, n);
}
function br(t) {
return {
sid: `${t.sid}`,
init: t.init,
// Make sure that sec is converted to ms for date constructor
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
}
};
}
function ct(t, e, n = 2) {
if (!e || typeof e != "object" || n <= 0)
return e;
if (t && Object.keys(e).length === 0)
return t;
const r = f({}, t);
for (const s in e)
Object.prototype.hasOwnProperty.call(e, s) && (r[s] = ct(r[s], e[s], n - 1));
return r;
}
const Vt = "_sentrySpan";
function Pe(t, e) {
e ? Y(t, Vt, e) : delete t[Vt];
}
function Ae(t) {
return t[Vt];
}
function De() {
return P();
}
function In() {
return P().substring(16);
}
const Tr = 100;
class O {
/** Flag if notifying is happening. */
/** Callback for client to receive scope changes. */
/** Callback list that will be called during event processing. */
/** Array of breadcrumbs. */
/** User */
/** Tags */
/** Extra */
/** Contexts */
/** Attachments */
/** Propagation Context for distributed tracing */
/**
* A place to stash data which is needed at some point in the SDK's event processing pipeline but which shouldn't get
* sent to Sentry
*/
/** Fingerprint */
/** Severity */
/**
* Transaction Name
*
* IMPORTANT: The transaction name on the scope has nothing to do with root spans/transaction objects.
* It's purpose is to assign a transaction to the scope that's added to non-transaction events.
*/
/** Session */
/** The client on this scope */
/** Contains the last event id of a captured event. */
// NOTE: Any field which gets added here should get added not only to the constructor but also to the `clone` method.
constructor() {
this._notifyingListeners = !1, this._scopeListeners = [], this._eventProcessors = [], this._breadcrumbs = [], this._attachments = [], this._user = {}, this._tags = {}, this._extra = {}, this._contexts = {}, this._sdkProcessingMetadata = {}, this._propagationContext = {
traceId: De(),
sampleRand: Math.random()
};
}
/**
* Clone all data from this scope into a new scope.
*/
clone() {
const e = new O();
return e._breadcrumbs = [...this._breadcrumbs], e._tags = f({}, this._tags), e._extra = f({}, this._extra), e._contexts = f({}, this._contexts), this._contexts.flags && (e._contexts.flags = {
values: [...this._contexts.flags.values]
}), e._user = this._user, e._level = this._level, e._session = this._session, e._transactionName = this._transactionName, e._fingerprint = this._fingerprint, e._eventProcessors = [...this._eventProcessors], e._attachments = [...this._attachments], e._sdkProcessingMetadata = f({}, this._sdkProcessingMetadata), e._propagationContext = f({}, this._propagationContext), e._client = this._client, e._lastEventId = this._lastEventId, Pe(e, Ae(this)), e;
}
/**
* Update the client assigned to this scope.
* Note that not every scope will have a client assigned - isolation scopes & the global scope will generally not have a client,
* as well as manually created scopes.
*/
setClient(e) {
this._client = e;
}
/**
* Set the ID of the last captured error event.
* This is generally only captured on the isolation scope.
*/
setLastEventId(e) {
this._lastEventId = e;
}
/**
* Get the client assigned to this scope.
*/
getClient() {
return this._client;
}
/**
* Get the ID of the last captured error event.
* This is generally only available on the isolation scope.
*/
lastEventId() {
return this._lastEventId;
}
/**
* @inheritDoc
*/
addScopeListener(e) {
this._scopeListeners.push(e);
}
/**
* Add an event processor that will be called before an event is sent.
*/
addEventProcessor(e) {
return this._eventProcessors.push(e), this;
}
/**
* Set the user for this scope.
* Set to `null` to unset the user.
*/
setUser(e) {
return this._user = e || {
email: void 0,
id: void 0,
ip_address: void 0,
username: void 0
}, this._session && Z(this._session, { user: e }), this._notifyScopeListeners(), this;
}
/**
* Get the user from this scope.
*/
getUser() {
return this._user;
}
/**
* Set an object that will be merged into existing tags on the scope,
* and will be sent as tags data with the event.
*/
setTags(e) {
return this._tags = f(f({}, this._tags), e), this._notifyScopeListeners(), this;
}
/**
* Set a single tag that will be sent as tags data with the event.
*/
setTag(e, n) {
return this._tags = y(f({}, this._tags), { [e]: n }), this._notifyScopeListeners(), this;
}
/**
* Set an object that will be merged into existing extra on the scope,
* and will be sent as extra data with the event.
*/
setExtras(e) {
return this._extra = f(f({}, this._extra), e), this._notifyScopeListeners(), this;
}
/**
* Set a single key:value extra entry that will be sent as extra data with the event.
*/
setExtra(e, n) {
return this._extra = y(f({}, this._extra), { [e]: n }), this._notifyScopeListeners(), this;
}
/**
* Sets the fingerprint on the scope to send with the events.
* @param {string[]} fingerprint Fingerprint to group events in Sentry.
*/
setFingerprint(e) {
return this._fingerprint = e, this._notifyScopeListeners(), this;
}
/**
* Sets the level on the scope for future events.
*/
setLevel(e) {
return this._level = e, this._notifyScopeListeners(), this;
}
/**
* Sets the transaction name on the scope so that the name of e.g. taken server route or
* the page location is attached to future events.
*
* IMPORTANT: Calling this function does NOT change the name of the currently active
* root span. If you want to change the name of the active root span, use
* `Sentry.updateSpanName(rootSpan, 'new name')` instead.
*
* By default, the SDK updates the scope's transaction name automatically on sensible
* occasions, such as a page navigation or when handling a new request on the server.
*/
setTransactionName(e) {
return this._transactionName = e, this._notifyScopeListeners(), this;
}
/**
* Sets context data with the given name.
* Data passed as context will be normalized. You can also pass `null` to unset the context.
* Note that context data will not be merged - calling `setContext` will overwrite an existing context with the same key.
*/
setContext(e, n) {
return n === null ? delete this._contexts[e] : this._contexts[e] = n, this._notifyScopeListeners(), this;
}
/**
* Set the session for the scope.
*/
setSession(e) {
return e ? this._session = e : delete this._session, this._notifyScopeListeners(), this;
}
/**
* Get the session from the scope.
*/
getSession() {
return this._session;
}
/**
* Updates the scope with provided data. Can work in three variations:
* - plain object containing updatable attributes
* - Scope instance that'll extract the attributes from
* - callback function that'll receive the current scope as an argument and allow for modifications
*/
update(e) {
if (!e)
return this;
const n = typeof e == "function" ? e(this) : e, r = n instanceof O ? n.getScopeData() : it(n) ? e : void 0, { tags: s, extra: i, user: o, contexts: a, level: c, fingerprint: u = [], propagationContext: l } = r || {};
return this._tags = f(f({}, this._tags), s), this._extra = f(f({}, this._extra), i), this._contexts = f(f({}, this._contexts), a), o && Object.keys(o).length && (this._user = o), c && (this._level = c), u.length && (this._fingerprint = u), l && (this._propagationContext = l), this;
}
/**
* Clears the current scope and resets its properties.
* Note: The client will not be cleared.
*/
clear() {
return this._breadcrumbs = [], this._tags = {}, this._extra = {}, this._user = {}, this._contexts = {}, this._level = void 0, this._transactionName = void 0, this._fingerprint = void 0, this._session = void 0, Pe(this, void 0), this._attachments = [], this.setPropagationContext({ traceId: De(), sampleRand: Math.random() }), this._notifyScopeListeners(), this;
}
/**
* Adds a breadcrumb to the scope.
* By default, the last 100 breadcrumbs are kept.
*/
addBreadcrumb(e, n) {
var i;
const r = typeof n == "number" ? n : Tr;
if (r <= 0)
return this;
const s = y(f({
timestamp: at()
}, e), {
// Breadcrumb messages can theoretically be infinitely large and they're held in memory so we truncate them not to leak (too much) memory
message: e.message ? bt(e.message, 2048) : e.message
});
return this._breadcrumbs.push(s), this._breadcrumbs.length > r && (this._breadcrumbs = this._breadcrumbs.slice(-r), (i = this._client) == null || i.recordDroppedEvent("buffer_overflow", "log_item")), this._notifyScopeListeners(), this;
}
/**
* Get the last breadcrumb of the scope.
*/
getLastBreadcrumb() {
return this._breadcrumbs[this._breadcrumbs.length - 1];
}
/**
* Clear all breadcrumbs from the scope.
*/
clearBreadcrumbs() {
return this._breadcrumbs = [], this._notifyScopeListeners(), this;
}
/**
* Add an attachment to the scope.
*/
addAttachment(e) {
return this._attachments.push(e), this;
}
/**
* Clear all attachments from the scope.
*/
clearAttachments() {
return this._attachments = [], this;
}
/**
* Get the data of this scope, which should be applied to an event during processing.
*/
getScopeData() {
return {
breadcrumbs: this._breadcrumbs,
attachments: this._attachments,
contexts: this._contexts,
tags: this._tags,
extra: this._extra,
user: this._user,
level: this._level,
fingerprint: this._fingerprint || [],
eventProcessors: this._eventProcessors,
propagationContext: this._propagationContext,
sdkProcessingMetadata: this._sdkProcessingMetadata,
transactionName: this._transactionName,
span: Ae(this)
};
}
/**
* Add data which will be accessible during event processing but won't get sent to Sentry.
*/
setSDKProcessingMetadata(e) {
return this._sdkProcessingMetadata = ct(this._sdkProcessingMetadata, e, 2), this;
}
/**
* Add propagation context to the scope, used for distributed tracing
*/
setPropagationContext(e) {
return this._propagationContext = e, this;
}
/**
* Get propagation context from the scope, used for distributed tracing
*/
getPropagationContext() {
return this._propagationContext;
}
/**
* Capture an exception for this scope.
*
* @returns {string} The id of the captured Sentry event.
*/
captureException(e, n) {
const r = (n == null ? void 0 : n.event_id) || P();
if (!this._client)
return g.warn("No client configured on scope - will not capture exception!"), r;
const s = new Error("Sentry syntheticException");
return this._client.captureException(
e,
y(f({
originalException: e,
syntheticException: s
}, n), {
event_id: r
}),
this
), r;
}
/**
* Capture a message for this scope.
*
* @returns {string} The id of the captured message.
*/
captureMessage(e, n, r) {
const s = (r == null ? void 0 : r.event_id) || P();
if (!this._client)
return g.warn("No client configured on scope - will not capture message!"), s;
const i = new Error(e);
return this._client.captureMessage(
e,
n,
y(f({
originalException: e,
syntheticException: i
}, r), {
event_id: s
}),
this
), s;
}
/**
* Capture a Sentry event for this scope.
*
* @returns {string} The id of the captured event.
*/
captureEvent(e, n) {
const r = (n == null ? void 0 : n.event_id) || P();
return this._client ? (this._client.captureEvent(e, y(f({}, n), { event_id: r }), this), r) : (g.warn("No client configured on scope - will not capture event!"), r);
}
/**
* This will be called on every set call.
*/
_notifyScopeListeners() {
this._notifyingListeners || (this._notifyingListeners = !0, this._scopeListeners.forEach((e) => {
e(this);
}), this._notifyingListeners = !1);
}
}
function vr() {
return Pt("defaultCurrentScope", () => new O());
}
function wr() {
return Pt("defaultIsolationScope", () => new O());
}
class Rr {
constructor(e, n) {
let r;
e ? r = e : r = new O();
let s;
n ? s = n : s = new O(), this._stack = [{ scope: r }], this._isolationScope = s;
}
/**
* Fork a scope for the stack.
*/
withScope(e) {
const n = this._pushScope();
let r;
try {
r = e(n);
} catch (s) {
throw this._popScope(), s;
}
return Dt(r) ? r.then(
(s) => (this._popScope(), s),
(s) => {
throw this._popScope(), s;
}
) : (this._popScope(), r);
}
/**
* Get the client of the stack.
*/
getClient() {
return this.getStackTop().client;
}
/**
* Returns the scope of the top stack.
*/
getScope() {
return this.getStackTop().scope;
}
/**
* Get the isolation scope for the stack.
*/
getIsolationScope() {
return this._isolationScope;
}
/**
* Returns the topmost scope layer in the order domain > local > process.
*/
getStackTop() {
return this._stack[this._stack.length - 1];
}
/**
* Push a scope to the stack.
*/
_pushScope() {
const e = this.getScope().clone();
return this._stack.push({
client: this.getClient(),
scope: e
}), e;
}
/**
* Pop a scope from the stack.
*/
_popScope() {
return this._stack.length <= 1 ? !1 : !!this._stack.pop();
}
}
function tt() {
const t = Rt(), e = Nt(t);
return e.stack = e.stack || new Rr(vr(), wr());
}
function Nr(t) {
return tt().withScope(t);
}
function Pr(t, e) {
const n = tt();
return n.withScope(() => (n.getStackTop().scope = t, e(t)));
}
function Oe(t) {
return tt().withScope(() => t(tt().getIsolationScope()));
}
function Ar() {
return {
withIsolationScope: Oe,
withScope: Nr,
withSetScope: Pr,
withSetIsolationScope: (t, e) => Oe(e),
getCurrentScope: () => tt().getScope(),
getIsolationScope: () => tt().getIsolationScope()
};
}
function de(t) {
const e = Nt(t);
return e.acs ? e.acs : Ar();
}
function U() {
const t = Rt();
return de(t).getCurrentScope();
}
function ut() {
const t = Rt();
return de(t).getIsolationScope();
}
function Dr() {
return Pt("globalScope", () => new O());
}
function Or(...t) {
const e = Rt(), n = de(e);
if (t.length === 2) {
const [r, s] = t;
return r ? n.withSetScope(r, s) : n.withScope(s);
}
return n.withScope(t[0]);
}
function v() {
return U().getClient();
}
function kr(t) {
const e = t.getPropagationContext(), { traceId: n, parentSpanId: r, propagationSpanId: s } = e, i = {
trace_id: n,
span_id: s || In()
};
return r && (i.parent_span_id = r), i;
}
const Cr = "sentry.source", xr = "sentry.sample_rate", Lr = "sentry.previous_trace_sample_rate", Mr = "sentry.op", $r = "sentry.origin", bn = "sentry.profile_id", Tn = "sentry.exclusive_time", Fr = 0, Ur = 1, Br = "_sentryScope", jr = "_sentryIsolationScope";
function vn(t) {
return {
scope: t[Br],
isolationScope: t[jr]
};
}
function Hr(t) {
if (typeof t == "boolean")
return Number(t);
const e = typeof t == "string" ? parseFloat(t) : t;
if (!(typeof e != "number" || isNaN(e) || e < 0 || e > 1))
return e;
}
const Gr = "sentry-", Wr = /^sentry-/;
function Yr(t) {
const e = Vr(t);
if (!e)
return;
const n = Object.entries(e).reduce((r, [s, i]) => {
if (s.match(Wr)) {
const o = s.slice(Gr.length);
r[o] = i;
}
return r;
}, {});
if (Object.keys(n).length > 0)
return n;
}
function Vr(t) {
if (!(!t || !M(t) && !Array.isArray(t)))
return Array.isArray(t) ? t.reduce((e, n) => {
const r = ke(n);
return Object.entries(r).forEach(([s, i]) => {
e[s] = i;
}), e;
}, {}) : ke(t);
}
function ke(t) {
return t.split(",").map(
(e) => e.split("=").map((n) => {
try {
return decodeURIComponent(n.trim());
} catch (r) {
return;
}
})
).reduce((e, [n, r]) => (n && r && (e[n] = r), e), {});
}
const wn = 1;
let Ce = !1;
function qr(t) {
const { spanId: e, traceId: n, isRemote: r } = t.spanContext(), s = r ? e : pe(t).parent_span_id, i = vn(t).scope, o = r ? (i == null ? void 0 : i.getPropagationContext().propagationSpanId) || In() : e;
return {
parent_span_id: s,
span_id: o,
trace_id: n
};
}
function zr(t) {
if (t && t.length > 0)
return t.map((o) => {
var a = o, { context: c } = a, u = c, { spanId: e, traceId: n, traceFlags: r } = u, s = be(u, ["spanId", "traceId", "traceFlags"]), { attributes: i } = a;
return f({
span_id: e,
trace_id: n,
sampled: r === wn,
attributes: i
}, s);
});
}
function xe(t) {
return typeof t == "number" ? Le(t) : Array.isArray(t) ? t[0] + t[1] / 1e9 : t instanceof Date ? Le(t.getTime()) : $();
}
function Le(t) {
return t > 9999999999 ? t / 1e3 : t;
}
function pe(t) {
var r;
if (Xr(t))
return t.getSpanJSON();
const { spanId: e, traceId: n } = t.spanContext();
if (Kr(t)) {
const { attributes: s, startTime: i, name: o, endTime: a, status: c, links: u } = t, l = "parentSpanId" in t ? t.parentSpanId : "parentSpanContext" in t ? (r = t.parentSpanContext) == null ? void 0 : r.spanId : void 0;
return {
span_id: e,
trace_id: n,
data: s,
description: o,
parent_span_id: l,
start_timestamp: xe(i),
// This is [0,0] by default in OTEL, in which case we want to interpret this as no end time
timestamp: xe(a) || void 0,
status: Qr(c),
op: s[Mr],
origin: s[$r],
links: zr(u)
};
}
return {
span_id: e,
trace_id: n,
start_timestamp: 0,
data: {}
};
}
function Kr(t) {
const e = t;
return !!e.attributes && !!e.startTime && !!e.name && !!e.endTime && !!e.status;
}
function Xr(t) {
return typeof t.getSpanJSON == "function";
}
function Jr(t) {
const { traceFlags: e } = t.spanContext();
return e === wn;
}
function Qr(t) {
if (!(!t || t.code === Fr))
return t.code === Ur ? "ok" : t.message || "unknown_error";
}
const Zr = "_sentryRootSpan";
function Rn(t) {
return t[Zr] || t;
}
function Me() {
Ce || (rt(() => {
console.warn(
"[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly."
);
}), Ce = !0);
}
const Nn = 50, V = "?", $e = /\(error: (.*)\)/, Fe = /captureMessage|captureException/;
function Pn(...t) {
const e = t.sort((n, r) => n[0] - r[0]).map((n) => n[1]);
return (n, r = 0, s = 0) => {
const i = [], o = n.split(`
`);
for (let a = r; a < o.length; a++) {
const c = o[a];
if (c.length > 1024)
continue;
const u = $e.test(c) ? c.replace($e, "$1") : c;
if (!u.match(/\S*Error: /)) {
for (const l of e) {
const d = l(u);
if (d) {
i.push(d);
break;
}
}
if (i.length >= Nn + s)
break;
}
}
return es(i.slice(s));
};
}
function ts(t) {
return Array.isArray(t) ? Pn(...t) : t;
}
function es(t) {
if (!t.length)
return [];
const e = Array.from(t);
return /sentryWrapped/.test(dt(e).function || "") && e.pop(), e.reverse(), Fe.test(dt(e).function || "") && (e.pop(), Fe.test(dt(e).function || "") && e.pop()), e.slice(0, Nn).map((n) => y(f({}, n), {
filename: n.filename || dt(e).filename,
function: n.function || V
}));
}
function dt(t) {
return t[t.length - 1] || {};
}
const Mt = "<anonymous>";
function j(t) {
try {
return !t || typeof t != "function" ? Mt : t.name || Mt;
} catch (e) {
return Mt;
}
}
function Ue(t) {
const e = t.exception;
if (e) {
const n = [];
try {
return e.values.forEach((r) => {
r.stacktrace.frames && n.push(...r.stacktrace.frames);
}), n;
} catch (r) {
return;
}
}
}
const yt = {}, Be = {};
function K(t, e) {
yt[t] = yt[t] || [], yt[t].push(e);
}
function X(t, e) {
if (!Be[t]) {
Be[t] = !0;
try {
e();
} catch (n) {
_ && g.error(`Error while instrumenting ${t}`, n);
}
}
}
function A(t, e) {
const n = t && yt[t];
if (n)
for (const r of n)
try {
r(e);
} catch (s) {
_ && g.error(
`Error while triggering instrumentation handler.
Type: ${t}
Name: ${j(r)}
Error:`,
s
);
}
}
let $t = null;
function ns(t) {
const e = "error";
K(e, t), X(e, rs);
}
function rs() {
$t = m.onerror, m.onerror = function(t, e, n, r, s) {
return A("error", {
column: r,
error: s,
line: n,
msg: t,
url: e
}), $t ? $t.apply(this, arguments) : !1;
}, m.onerror.__SENTRY_INSTRUMENTED__ = !0;
}
let Ft = null;
function ss(t) {
const e = "unhandledrejection";
K(e, t), X(e, is);
}
function is() {
Ft = m.onunhandledrejection, m.onunhandledrejection = function(t) {
return A("unhandledrejection", t), Ft ? Ft.apply(this, arguments) : !0;
}, m.onunhandledrejection.__SENTRY_INSTRUMENTED__ = !0;
}
function os(t) {
var n;
if (typeof __SENTRY_TRACING__ == "boolean" && !__SENTRY_TRACING__)
return !1;
const e = t || ((n = v()) == null ? void 0 : n.getOptions());
return !!e && // Note: This check is `!= null`, meaning "nullish". `0` is not "nullish", `undefined` and `null` are. (This comment was brought to you by 15 minutes of questioning life)
(e.tracesSampleRate != null || !!e.tracesSampler);
}
const he = "production", as = /^o(\d+)\./, cs = /^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;
function us(t) {
return t === "http" || t === "https";
}
function kt(t, e = !1) {
const { host: n, path: r, pass: s, port: i, projectId: o, protocol: a, publicKey: c } = t;
return `${a}://${c}${e && s ? `:${s}` : ""}@${n}${i ? `:${i}` : ""}/${r && `${r}/`}${o}`;
}
function fs(t) {
const e = cs.exec(t);
if (!e) {
rt(() => {
console.error(`Invalid Sentry Dsn: ${t}`);
});
return;
}
const [n, r, s = "", i = "", o = "", a = ""] = e.slice(1);
let c = "", u = a;
const l = u.split("/");
if (l.length > 1 && (c = l.slice(0, -1).join("/"), u = l.pop()), u) {
const d = u.match(/^\d+/);
d && (u = d[0]);
}
return An({ host: i, pass: s, path: c, projectId: u, port: o, protocol: n, publicKey: r });
}
function An(t) {
return {
protocol: t.protocol,
publicKey: t.publicKey || "",
pass: t.pass || "",
host: t.host,
port: t.port || "",
path: t.path || "",
projectId: t.projectId
};
}
function ls(t) {
if (!_)
return !0;
const { port: e, projectId: n, protocol: r } = t;
return ["protocol", "publicKey", "host", "projectId"].find((o) => t[o] ? !1 : (g.error(`Invalid Sentry Dsn: ${o} missing`), !0)) ? !1 : n.match(/^\d+$/) ? us(r) ? e && isNaN(parseInt(e, 10)) ? (g.error(`Invalid Sentry Dsn: Invalid port ${e}`), !1) : !0 : (g.error(`Invalid Sentry Dsn: Invalid protocol ${r}`), !1) : (g.error(`Invalid Sentry Dsn: Invalid projectId ${n}`), !1);
}
function ds(t) {
const e = t.match(as);
return e == null ? void 0 : e[1];
}
function ps(t) {
const e = typeof t == "string" ? fs(t) : An(t);
if (!(!e || !ls(e)))
return e;
}
const hs = "_frozenDsc";
function Dn(t, e) {
const n = e.getOptions(), { publicKey: r, host: s } = e.getDsn() || {};
let i;
n.orgId ? i = String(n.orgId) : s && (i = ds(s));
const o = {
environment: n.environment || he,
release: n.release,
public_key: r,
trace_id: t,
org_id: i
};
return e.emit("createDsc", o), o;
}
function gs(t, e) {
const n = e.getPropagationContext();
return n.dsc || Dn(n.traceId, t);
}
function _s(t) {
var E, R, I, D;
const e = v();
if (!e)
return {};
const n = Rn(t), r = pe(n), s = r.data, i = n.spanContext().traceState, o = (R = (E = i == null ? void 0 : i.get("sentry.sample_rate")) != null ? E : s[xr]) != null ? R : s[Lr];
function a(k) {
return (typeof o == "number" || typeof o == "string") && (k.sample_rate = `${o}`), k;
}
const c = n[hs];
if (c)
return a(c);
const u = i == null ? void 0 : i.get("sentry.dsc"), l = u && Yr(u);
if (l)
return a(l);
const d = Dn(t.spanContext().traceId, e), h = s[Cr], p = r.description;
return h !== "url" && p && (d.transaction = p), os() && (d.sampled = String(Jr(n)), d.sample_rand = // In OTEL we store the sample rand on the trace state because we cannot access scopes for NonRecordingSpans
// The Sentry OTEL SpanSampler takes care of writing the sample rand on the root span
(D = i == null ? void 0 : i.get("sentry.sample_rand")) != null ? D : (
// On all other platforms we can actually get the scopes from a root span (we use this as a fallback)
(I = vn(n).scope) == null ? void 0 : I.getPropagationContext().sampleRand.toString()
)), a(d), e.emit("createDsc", d, n), d;
}
function x(t, e = 100, n = 1 / 0) {
try {
return qt("", t, e, n);
} catch (r) {
return { ERROR: `**non-serializable** (${r})` };
}
}
function On(t, e = 3, n = 100 * 1024) {
const r = x(t, e);
return Ss(r) > n ? On(t, e - 1, n) : r;
}
function qt(t, e, n = 1 / 0, r = 1 / 0, s = Is()) {
const [i, o] = s;
if (e == null || // this matches null and undefined -> eqeq not eqeqeq
["boolean", "string"].includes(typeof e) || typeof e == "number" && Number.isFinite(e))
return e;
const a = ms(t, e);
if (!a.startsWith("[object "))
return a;
if (e.__sentry_skip_normalization__)
return e;
const c = typeof e.__sentry_override_normalization_depth__ == "number" ? e.__sentry_override_normalization_depth__ : n;
if (c === 0)
return a.replace("object ", "");
if (i(e))
return "[Circular ~]";
const u = e;
if (u && typeof u.toJSON == "function")
try {
const p = u.toJSON();
return qt("", p, c - 1, r, s);
} catch (p) {
}
const l = Array.isArray(e) ? [] : {};
let d = 0;
const h = yn(e);
for (const p in h) {
if (!Object.prototype.hasOwnProperty.call(h, p))
continue;
if (d >= r) {
l[p] = "[MaxProperties ~]";
break;
}
const E = h[p];
l[p] = qt(p, E, c - 1, r, s), d++;
}
return o(e), l;
}
function ms(t, e) {
try {
if (t === "domain" && e && typeof e == "object" && e._events)
return "[Domain]";
if (t === "domainEmitter")
return "[DomainEmitter]";
if (typeof global != "undefined" && e === global)
return "[Global]";
if (typeof window != "undefined" && e === window)
return "[Window]";
if (typeof document != "undefined" && e === document)
return "[Document]";
if (gn(e))
return "[VueViewModel]";
if (cr(e))
return "[SyntheticEvent]";
if (typeof e == "number" && !Number.isFinite(e))
return `[${e}]`;
if (typeof e == "function")
return `[Function: ${j(e)}]`;
if (typeof e == "symbol")
return `[${String(e)}]`;
if (typeof e == "bigint")
return `[BigInt: ${String(e)}]`;
const n = ys(e);
return /^HTML(\w*)Element$/.test(n) ? `[HTMLElement: ${n}]` : `[object ${n}]`;
} catch (n) {
return `**non-serializable** (${n})`;
}
}
function ys(t) {
const e = Object.getPrototypeOf(t);
return e != null && e.constructor ? e.constructor.name : "null prototype";
}
function Es(t) {
return ~-encodeURI(t).split(/%..|./).length;
}
function Ss(t) {
return Es(JSON.stringify(t));
}
function Is() {
const t = /* @__PURE__ */ new WeakSet();
function e(r) {
return t.has(r) ? !0 : (t.add(r), !1);
}
function n(r) {
t.delete(r);
}
return [e, n];
}
function ft(t, e = []) {
return [t, e];
}
function bs(t, e) {
const [n, r] = t;
return [n, [...r, e]];
}
function je(t, e) {
const n = t[1];
for (const r of n) {
const s = r[0].type;
if (e(r, s))
return !0;
}
return !1;
}
function zt(t) {
const e = Nt(m);
return e.encodePolyfill ? e.encodePolyfill(t) : new TextEncoder().encode(t);
}
function Ts(t) {
const [e, n] = t;
let r = JSON.stringify(e);
function s(i) {
typeof r == "string" ? r = typeof i == "string" ? r + i : [zt(r), i] : r.push(typeof i == "string" ? zt(i) : i);
}
for (const i of n) {
const [o, a] = i;
if (s(`
${JSON.stringify(o)}
`), typeof a == "string" || a instanceof Uint8Array)
s(a);
else {
let c;
try {
c = JSON.stringify(a);
} catch (u) {
c = JSON.stringify(x(a));
}
s(c);
}
}
return typeof r == "string" ? r : vs(r);
}
function vs(t) {
const e = t.reduce((s, i) => s + i.length, 0), n = new Uint8Array(e);
let r = 0;
for (const s of t)
n.set(s, r), r += s.length;
return n;
}
function ws(t) {
const e = typeof t.data == "string" ? zt(t.data) : t.data;
return [
{
type: "attachment",
length: e.length,
filename: t.filename,
content_type: t.contentType,
attachment_type: t.attachmentType
},
e
];
}
const Rs = {
session: "session",
sessions: "session",
attachment: "attachment",
transaction: "transaction",
event: "error",
client_report: "internal",
user_report: "default",
profile: "profile",
profile_chunk: "profile",
replay_event: "replay",
replay_recording: "replay",
check_in: "monitor",
feedback: "feedback",
span: "span",
raw_security: "security",
log: "log_item"
};
function He(t) {
return Rs[t];
}
function kn(t) {
if (!(t != null && t.sdk))
return;
const { name: e, version: n } = t.sdk;
return { name: e, version: n };
}
function Ns(t, e, n, r) {
var i;
const s = (i = t.sdkProcessingMetadata) == null ? void 0 : i.dynamicSamplingContext;
return f(f(f({
event_id: t.event_id,
sent_at: (/* @__PURE__ */ new Date()).toISOString()
}, e && { sdk: e }), !!n && r && { dsn: kt(r) }), s && {
trace: s
});
}
function Ps(t, e) {
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;
}
function As(t, e, n, r) {
const s = kn(n), i = f(f({
sent_at: (/* @__PURE__ */ new Date()).toISOString()
}, s && { sdk: s }), !!r && e && { dsn: kt(e) }), o = "aggregates" in t ? [{ type: "sessions" }, t] : [{ type: "session" }, t.toJSON()];
return ft(i, [o]);
}
function Ds(t, e, n, r) {
const s = kn(n), i = t.type && t.type !== "replay_event" ? t.type : "event";
Ps(t, n == null ? void 0 : n.sdk);
const o = Ns(t, s, r, e);
return delete t.sdkProcessingMetadata, ft(o, [[{ type: i }, t]]);
}
var L;
(function(t) {
t[t.PENDING = 0] = "PENDING";
const n = 1;
t[t.RESOLVED = n] = "RESOLVED";
const r = 2;
t[t.REJECTED = r] = "REJECTED";
})(L || (L = {}));
function q(t) {
return new H((e) => {
e(t);
});
}
function Tt(t) {
return new H((e, n) => {
n(t);
});
}
class H {
constructor(e) {
this._state = L.PENDING, this._handlers = [], this._runExecutor(e);
}
/** @inheritdoc */
then(e, n) {
return new H((r, s) => {
this._handlers.push([
!1,
(i) => {
if (!e)
r(i);
else
try {
r(e(i));
} catch (o) {
s(o);
}
},
(i) => {
if (!n)
s(i);
else
try {
r(n(i));
} catch (o) {
s(o);
}
}
]), this._executeHandlers();
});
}
/** @inheritdoc */
catch(e) {
return this.then((n) => n, e);
}
/** @inheritdoc */
finally(e) {
return new H((n, r) => {
let s, i;
return this.then(
(o) => {
i = !1, s = o, e && e();
},
(o) => {
i = !0, s = o, e && e();
}
).then(() => {
if (i) {
r(s);
return;
}
n(s);
});
});
}
/** Excute the resolve/reject handlers. */
_executeHandlers() {
if (this._state === L.PENDING)
return;
const e = this._handlers.slice();
this._handlers = [], e.forEach((n) => {
n[0] || (this._state === L.RESOLVED && n[1](this._value), this._state === L.REJECTED && n[2](this._value), n[0] = !0);
});
}
/** Run the executor for the SyncPromise. */
_runExecutor(e) {
const n = (i, o) => {
if (this._state === L.PENDING) {
if (Dt(o)) {
o.then(r, s);
return;
}
this._state = i, this._value = o, this._executeHandlers();
}
}, r = (i) => {
n(L.RESOLVED, i);
}, s = (i) => {
n(L.REJECTED, i);
};
try {
e(r, s);
} catch (i) {
s(i);
}
}
}
function Kt(t, e, n, r = 0) {
return new H((s, i) => {
const o = t[r];
if (e === null || typeof o != "function")
s(e);
else {
const a = o(f({}, e), n);
_ && o.id && a === null && g.log(`Event processor "${o.id}" dropped event`), Dt(a) ? a.then((c) => Kt(t, c, n, r + 1).then(s)).then(null, i) : Kt(t, a, n, r + 1).then(s).then(null, i);
}
});
}
let pt, Ge, ht;
function Os(t) {
const e = m._sentryDebugIds;
if (!e)
return {};
const n = Object.keys(e);
return ht && n.length === Ge || (Ge = n.length, ht = n.reduce((r, s) => {
pt || (pt = {});
const i = pt[s];
if (i)
r[i[0]] = i[1];
else {
const o = t(s);
for (let a = o.length - 1; a >= 0; a--) {
const c = o[a], u = c == null ? void 0 : c.filename, l = e[s];
if (u && l) {
r[u] = l, pt[s] = [u, l];
break;
}
}
}
return r;
}, {})), ht;
}
function ks(t, e) {
const { fingerprint: n, span: r, breadcrumbs: s, sdkProcessingMetadata: i } = e;
Cs(t, e), r && Ms(t, r), $s(t, n), xs(t, s), Ls(t, i);
}
function We(t, e) {
const {
extra: n,
tags: r,
user: s,
contexts: i,
level: o,
sdkProcessingMetadata: a,
breadcrumbs: c,
fingerprint: u,
eventProcessors: l,
attachments: d,
propagationContext: h,
transactionName: p,
span: E
} = e;
gt(t, "extra", n), gt(t, "tags", r), gt(t, "user", s), gt(t, "contexts", i), t.sdkProcessingMetadata = ct(t.sdkProcessingMetadata, a, 2), o && (t.level = o), p && (t.transactionName = p), E && (t.span = E), c.length && (t.breadcrumbs = [...t.breadcrumbs, ...c]), u.length && (t.fingerprint = [...t.fingerprint, ...u]), l.length && (t.eventProcessors = [...t.eventProcessors, ...l]), d.length && (t.attachments = [...t.attachments, ...d]), t.propagationContext = f(f({}, t.propagationContext), h);
}
function gt(t, e, n) {
t[e] = ct(t[e], n, 1);
}
function Cs(t, e) {
const { extra: n, tags: r, user: s, contexts: i, level: o, transactionName: a } = e;
Object.keys(n).length && (t.extra = f(f({}, n), t.extra)), Object.keys(r).length && (t.tags = f(f({}, r), t.tags)), Object.keys(s).length && (t.user = f(f({}, s), t.user)), Object.keys(i).length && (t.contexts = f(f({}, i), t.contexts)), o && (t.level = o), a && t.type !== "transaction" && (t.transaction = a);
}
function xs(t, e) {
const n = [...t.breadcrumbs || [], ...e];
t.breadcrumbs = n.length ? n : void 0;
}
function Ls(t, e) {
t.sdkProcessingMetadata = f(f({}, t.sdkProcessingMetadata), e);
}
function Ms(t, e) {
t.contexts = f({
trace: qr(e)
}, t.contexts), t.sdkProcessingMetadata = f({
dynamicSamplingContext: _s(e)
}, t.sdkProcessingMetadata);
const n = Rn(e), r = pe(n).description;
r && !t.transaction && t.type === "transaction" && (t.transaction = r);
}
function $s(t, e) {
t.fingerprint = t.fingerprint ? Array.isArray(t.fingerprint) ? t.fingerprint : [t.fingerprint] : [], e && (t.fingerprint = t.fingerprint.concat(e)), t.fingerprint.length || delete t.fingerprint;
}
function Fs(t, e, n, r, s, i) {
const { normalizeDepth: o = 3, normalizeMaxBreadth: a = 1e3 } = t, c = y(f({}, e), {
event_id: e.event_id || n.event_id || P(),
timestamp: e.timestamp || at()
}), u = n.integrations || t.integrations.map((I) => I.name);
Us(c, t), Hs(c, u), s && s.emit("applyFrameMetadata", e), e.type === void 0 && Bs(c, t.stackParser);
const l = Ws(r, n.captureContext);
n.mechanism && Q(c, n.mechanism);
const d = s ? s.getEventProcessors() : [], h = Dr().getScopeData();
if (i) {
const I = i.getScopeData();
We(h, I);
}
if (l) {
const I = l.getScopeData();
We(h, I);
}
const p = [...n.attachments || [], ...h.attachments];
p.length && (n.attachments = p), ks(c, h);
const E = [
...d,
// Run scope event processors _after_ all other processors
...h.eventProcessors
];
return Kt(E, c, n).then((I) => (I && js(I), typeof o == "number" && o > 0 ? Gs(I, o, a) : I));
}
function Us(t, e) {
const { environment: n, release: r, dist: s, maxValueLength: i = 250 } = e;
t.environment = t.environment || n || he, !t.release && r && (t.release = r), !t.dist && s && (t.dist = s);
const o = t.request;
o != null && o.url && (o.url = bt(o.url, i));
}
function Bs(t, e) {
var r, s;
const n = Os(e);
(s = (r = t.exception) == null ? void 0 : r.values) == null || s.forEach((i) => {
var o, a;
(a = (o = i.stacktrace) == null ? void 0 : o.frames) == null || a.forEach((c) => {
c.filename && (c.debug_id = n[c.file