UNPKG

@chargebee/atomicpricing

Version:

JS wrapper for your Atomic Pricing hosted page

1,754 lines 132 kB
var rr = Object.defineProperty, sr = Object.defineProperties; var ir = Object.getOwnPropertyDescriptors; var de = Object.getOwnPropertySymbols; var St = Object.prototype.hasOwnProperty, It = Object.prototype.propertyIsEnumerable; var Et = (e, t, n) => t in e ? rr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, f = (e, t) => { for (var n in t || (t = {})) St.call(t, n) && Et(e, n, t[n]); if (de) for (var n of de(t)) It.call(t, n) && Et(e, n, t[n]); return e; }, y = (e, t) => sr(e, ir(t)); var bt = (e, t) => { var n = {}; for (var r in e) St.call(e, r) && t.indexOf(r) < 0 && (n[r] = e[r]); if (e != null && de) for (var r of de(e)) t.indexOf(r) < 0 && It.call(e, r) && (n[r] = e[r]); return n; }; var pe = (e, t, 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(e, t)).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 Ne() { return De(m), m; } function De(e) { const t = e.__SENTRY__ = e.__SENTRY__ || {}; return t.version = t.version || W, t[W] = t[W] || {}; } function Ae(e, t, n = m) { const r = n.__SENTRY__ = n.__SENTRY__ || {}, s = r[W] = r[W] || {}; return s[e] || (s[e] = t()); } const pn = Object.prototype.toString; function ot(e) { switch (pn.call(e)) { case "[object Error]": case "[object Exception]": case "[object DOMException]": case "[object WebAssembly.Exception]": return !0; default: return B(e, Error); } } function ne(e, t) { return pn.call(e) === `[object ${t}]`; } function hn(e) { return ne(e, "ErrorEvent"); } function Tt(e) { return ne(e, "DOMError"); } function or(e) { return ne(e, "DOMException"); } function M(e) { return ne(e, "String"); } function at(e) { return typeof e == "object" && e !== null && "__sentry_template_string__" in e && "__sentry_template_values__" in e; } function ct(e) { return e === null || at(e) || typeof e != "object" && typeof e != "function"; } function ie(e) { return ne(e, "Object"); } function Oe(e) { return typeof Event != "undefined" && B(e, Event); } function ar(e) { return typeof Element != "undefined" && B(e, Element); } function cr(e) { return ne(e, "RegExp"); } function ke(e) { return !!(e != null && e.then && typeof e.then == "function"); } function ur(e) { return ie(e) && "nativeEvent" in e && "preventDefault" in e && "stopPropagation" in e; } function B(e, t) { try { return e instanceof t; } catch (n) { return !1; } } function gn(e) { return !!(typeof e == "object" && e !== null && (e.__isVue || e._isVue)); } function fr(e) { return typeof Request != "undefined" && B(e, Request); } const ut = m, lr = 80; function _n(e, t = {}) { if (!e) return "<unknown>"; try { let n = e; const r = 5, s = []; let i = 0, o = 0; const a = " > ", c = a.length; let u; const l = Array.isArray(t) ? t : t.keyAttrs, d = !Array.isArray(t) && t.maxStringLength || lr; for (; n && i++ < r && (u = dr(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 dr(e, t) { const n = e, r = []; if (!(n != null && n.tagName)) return ""; if (ut.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 = t != null && t.length ? t.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 ft() { try { return ut.document.location.href; } catch (e) { return ""; } } function pr(e) { if (!ut.HTMLElement) return null; let t = e; const n = 5; for (let r = 0; r < n; r++) { if (!t) return null; if (t instanceof HTMLElement) { if (t.dataset.sentryComponent) return t.dataset.sentryComponent; if (t.dataset.sentryElement) return t.dataset.sentryElement; } t = t.parentNode; } return null; } const hr = "Sentry Logger ", We = [ "debug", "info", "warn", "error", "log", "assert", "trace" ], Te = {}; function re(e) { if (!("console" in m)) return e(); const t = m.console, n = {}, r = Object.keys(Te); r.forEach((s) => { const i = Te[s]; n[s] = t[s], t[s] = i; }); try { return e(); } finally { r.forEach((s) => { t[s] = n[s]; }); } } function gr() { let e = !1; const t = { enable: () => { e = !0; }, disable: () => { e = !1; }, isEnabled: () => e }; return _ ? We.forEach((n) => { t[n] = (...r) => { e && re(() => { m.console[n](`${hr}[${n}]:`, ...r); }); }; }) : We.forEach((n) => { t[n] = () => { }; }), t; } const h = Ae("logger", gr); function ve(e, t = 0) { return typeof e != "string" || t === 0 || e.length <= t ? e : `${e.slice(0, t)}...`; } function vt(e, t) { if (!Array.isArray(e)) return ""; const n = []; for (let r = 0; r < e.length; r++) { const s = e[r]; try { gn(s) ? n.push("[VueViewModel]") : n.push(String(s)); } catch (i) { n.push("[value cannot be serialized]"); } } return n.join(t); } function _r(e, t, n = !1) { return M(e) ? cr(t) ? t.test(e) : M(t) ? n ? e === t : e.includes(t) : !1 : !1; } function Ce(e, t = [], n = !1) { return t.some((r) => _r(e, r, n)); } function P(e, t, n) { if (!(t in e)) return; const r = e[t]; if (typeof r != "function") return; const s = n(r); typeof s == "function" && mn(s, r); try { e[t] = s; } catch (i) { _ && h.log(`Failed to replace method "${t}" in object`, e); } } function Y(e, t, n) { try { Object.defineProperty(e, t, { // enumerable: false, // the default, so we can save on bundle size by not explicitly setting it value: n, writable: !0, configurable: !0 }); } catch (r) { _ && h.log(`Failed to add non-enumerable property "${t}" to object`, e); } } function mn(e, t) { try { const n = t.prototype || {}; e.prototype = t.prototype = n, Y(e, "__sentry_original__", t); } catch (n) { } } function lt(e) { return e.__sentry_original__; } function yn(e) { if (ot(e)) return f({ message: e.message, name: e.name, stack: e.stack }, Rt(e)); if (Oe(e)) { const t = f({ type: e.type, target: wt(e.target), currentTarget: wt(e.currentTarget) }, Rt(e)); return typeof CustomEvent != "undefined" && B(e, CustomEvent) && (t.detail = e.detail), t; } else return e; } function wt(e) { try { return ar(e) ? _n(e) : Object.prototype.toString.call(e); } catch (t) { return "<unknown>"; } } function Rt(e) { if (typeof e == "object" && e !== null) { const t = {}; for (const n in e) Object.prototype.hasOwnProperty.call(e, n) && (t[n] = e[n]); return t; } else return {}; } function mr(e, t = 40) { const n = Object.keys(yn(e)); n.sort(); const r = n[0]; if (!r) return "[object has no keys]"; if (r.length >= t) return ve(r, t); for (let s = n.length; s > 0; s--) { const i = n.slice(0, s).join(", "); if (!(i.length > t)) return s === n.length ? i : ve(i, t); } return ""; } function yr() { const e = m; return e.crypto || e.msCrypto; } function N(e = yr()) { let t = () => Math.random() * 16; try { if (e != null && e.randomUUID) return e.randomUUID().replace(/-/g, ""); e != null && e.getRandomValues && (t = () => { const n = new Uint8Array(1); return e.getRandomValues(n), n[0]; }); } catch (n) { } return ([1e7] + 1e3 + 4e3 + 8e3 + 1e11).replace( /[018]/g, (n) => ( // eslint-disable-next-line no-bitwise (n ^ (t() & 15) >> n / 4).toString(16) ) ); } function En(e) { var t, n; return (n = (t = e.exception) == null ? void 0 : t.values) == null ? void 0 : n[0]; } function G(e) { const { message: t, event_id: n } = e; if (t) return t; const r = En(e); return r ? r.type && r.value ? `${r.type}: ${r.value}` : r.type || r.value || n || "<unknown>" : n || "<unknown>"; } function Ye(e, t, n) { const r = e.exception = e.exception || {}, s = r.values = r.values || [], i = s[0] = s[0] || {}; i.value || (i.value = t || ""), i.type || (i.type = n || "Error"); } function Q(e, t) { const n = En(e); if (!n) return; const r = { type: "generic", handled: !0 }, s = n.mechanism; if (n.mechanism = f(f(f({}, r), s), t), t && "data" in t) { const i = f(f({}, s == null ? void 0 : s.data), t.data); n.mechanism.data = i; } } function Pt(e) { if (Er(e)) return !0; try { Y(e, "__sentry_captured__", !0); } catch (t) { } return !1; } function Er(e) { try { return e.__sentry_captured__; } catch (t) { } } const Sn = 1e3; function ae() { return Date.now() / Sn; } function Sr() { const { performance: e } = m; if (!(e != null && e.now)) return ae; const t = Date.now() - e.now(), n = e.timeOrigin == null ? t : e.timeOrigin; return () => (n + e.now()) / Sn; } const $ = Sr(); function Ir(e) { const t = $(), n = { sid: N(), init: !0, timestamp: t, started: t, duration: 0, status: "ok", errors: 0, ignoreDuration: !1, toJSON: () => Tr(n) }; return e && Z(n, e), n; } function Z(e, t = {}) { if (t.user && (!e.ipAddress && t.user.ip_address && (e.ipAddress = t.user.ip_address), !e.did && !t.did && (e.did = t.user.id || t.user.email || t.user.username)), e.timestamp = t.timestamp || $(), t.abnormal_mechanism && (e.abnormal_mechanism = t.abnormal_mechanism), t.ignoreDuration && (e.ignoreDuration = t.ignoreDuration), t.sid && (e.sid = t.sid.length === 32 ? t.sid : N()), t.init !== void 0 && (e.init = t.init), !e.did && t.did && (e.did = `${t.did}`), typeof t.started == "number" && (e.started = t.started), e.ignoreDuration) e.duration = void 0; else if (typeof t.duration == "number") e.duration = t.duration; else { const n = e.timestamp - e.started; e.duration = n >= 0 ? n : 0; } t.release && (e.release = t.release), t.environment && (e.environment = t.environment), !e.ipAddress && t.ipAddress && (e.ipAddress = t.ipAddress), !e.userAgent && t.userAgent && (e.userAgent = t.userAgent), typeof t.errors == "number" && (e.errors = t.errors), t.status && (e.status = t.status); } function br(e, t) { let n = {}; t ? n = { status: t } : e.status === "ok" && (n = { status: "exited" }), Z(e, n); } function Tr(e) { return { sid: `${e.sid}`, init: e.init, // Make sure that sec is converted to ms for date constructor started: new Date(e.started * 1e3).toISOString(), timestamp: new Date(e.timestamp * 1e3).toISOString(), status: e.status, errors: e.errors, did: typeof e.did == "number" || typeof e.did == "string" ? `${e.did}` : void 0, duration: e.duration, abnormal_mechanism: e.abnormal_mechanism, attrs: { release: e.release, environment: e.environment, ip_address: e.ipAddress, user_agent: e.userAgent } }; } function ce(e, t, n = 2) { if (!t || typeof t != "object" || n <= 0) return t; if (e && Object.keys(t).length === 0) return e; const r = f({}, e); for (const s in t) Object.prototype.hasOwnProperty.call(t, s) && (r[s] = ce(r[s], t[s], n - 1)); return r; } const Ve = "_sentrySpan"; function Nt(e, t) { t ? Y(e, Ve, t) : delete e[Ve]; } function Dt(e) { return e[Ve]; } function At() { return N(); } function In() { return N().substring(16); } const vr = 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: At(), sampleRand: Math.random() }; } /** * Clone all data from this scope into a new scope. */ clone() { const t = new O(); return t._breadcrumbs = [...this._breadcrumbs], t._tags = f({}, this._tags), t._extra = f({}, this._extra), t._contexts = f({}, this._contexts), this._contexts.flags && (t._contexts.flags = { values: [...this._contexts.flags.values] }), t._user = this._user, t._level = this._level, t._session = this._session, t._transactionName = this._transactionName, t._fingerprint = this._fingerprint, t._eventProcessors = [...this._eventProcessors], t._attachments = [...this._attachments], t._sdkProcessingMetadata = f({}, this._sdkProcessingMetadata), t._propagationContext = f({}, this._propagationContext), t._client = this._client, t._lastEventId = this._lastEventId, Nt(t, Dt(this)), t; } /** * 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(t) { this._client = t; } /** * Set the ID of the last captured error event. * This is generally only captured on the isolation scope. */ setLastEventId(t) { this._lastEventId = t; } /** * 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(t) { this._scopeListeners.push(t); } /** * Add an event processor that will be called before an event is sent. */ addEventProcessor(t) { return this._eventProcessors.push(t), this; } /** * Set the user for this scope. * Set to `null` to unset the user. */ setUser(t) { return this._user = t || { email: void 0, id: void 0, ip_address: void 0, username: void 0 }, this._session && Z(this._session, { user: t }), 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(t) { return this._tags = f(f({}, this._tags), t), this._notifyScopeListeners(), this; } /** * Set a single tag that will be sent as tags data with the event. */ setTag(t, n) { return this._tags = y(f({}, this._tags), { [t]: 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(t) { return this._extra = f(f({}, this._extra), t), this._notifyScopeListeners(), this; } /** * Set a single key:value extra entry that will be sent as extra data with the event. */ setExtra(t, n) { return this._extra = y(f({}, this._extra), { [t]: 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(t) { return this._fingerprint = t, this._notifyScopeListeners(), this; } /** * Sets the level on the scope for future events. */ setLevel(t) { return this._level = t, 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(t) { return this._transactionName = t, 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(t, n) { return n === null ? delete this._contexts[t] : this._contexts[t] = n, this._notifyScopeListeners(), this; } /** * Set the session for the scope. */ setSession(t) { return t ? this._session = t : 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(t) { if (!t) return this; const n = typeof t == "function" ? t(this) : t, r = n instanceof O ? n.getScopeData() : ie(n) ? t : 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, Nt(this, void 0), this._attachments = [], this.setPropagationContext({ traceId: At(), sampleRand: Math.random() }), this._notifyScopeListeners(), this; } /** * Adds a breadcrumb to the scope. * By default, the last 100 breadcrumbs are kept. */ addBreadcrumb(t, n) { var i; const r = typeof n == "number" ? n : vr; if (r <= 0) return this; const s = y(f({ timestamp: ae() }, t), { // Breadcrumb messages can theoretically be infinitely large and they're held in memory so we truncate them not to leak (too much) memory message: t.message ? ve(t.message, 2048) : t.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(t) { return this._attachments.push(t), 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: Dt(this) }; } /** * Add data which will be accessible during event processing but won't get sent to Sentry. */ setSDKProcessingMetadata(t) { return this._sdkProcessingMetadata = ce(this._sdkProcessingMetadata, t, 2), this; } /** * Add propagation context to the scope, used for distributed tracing */ setPropagationContext(t) { return this._propagationContext = t, 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(t, n) { const r = (n == null ? void 0 : n.event_id) || N(); if (!this._client) return h.warn("No client configured on scope - will not capture exception!"), r; const s = new Error("Sentry syntheticException"); return this._client.captureException( t, y(f({ originalException: t, syntheticException: s }, n), { event_id: r }), this ), r; } /** * Capture a message for this scope. * * @returns {string} The id of the captured message. */ captureMessage(t, n, r) { const s = (r == null ? void 0 : r.event_id) || N(); if (!this._client) return h.warn("No client configured on scope - will not capture message!"), s; const i = new Error(t); return this._client.captureMessage( t, n, y(f({ originalException: t, syntheticException: i }, r), { event_id: s }), this ), s; } /** * Capture a Sentry event for this scope. * * @returns {string} The id of the captured event. */ captureEvent(t, n) { const r = (n == null ? void 0 : n.event_id) || N(); return this._client ? (this._client.captureEvent(t, y(f({}, n), { event_id: r }), this), r) : (h.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((t) => { t(this); }), this._notifyingListeners = !1); } } function wr() { return Ae("defaultCurrentScope", () => new O()); } function Rr() { return Ae("defaultIsolationScope", () => new O()); } class Pr { constructor(t, n) { let r; t ? r = t : 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(t) { const n = this._pushScope(); let r; try { r = t(n); } catch (s) { throw this._popScope(), s; } return ke(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 t = this.getScope().clone(); return this._stack.push({ client: this.getClient(), scope: t }), t; } /** * Pop a scope from the stack. */ _popScope() { return this._stack.length <= 1 ? !1 : !!this._stack.pop(); } } function ee() { const e = Ne(), t = De(e); return t.stack = t.stack || new Pr(wr(), Rr()); } function Nr(e) { return ee().withScope(e); } function Dr(e, t) { const n = ee(); return n.withScope(() => (n.getStackTop().scope = e, t(e))); } function Ot(e) { return ee().withScope(() => e(ee().getIsolationScope())); } function Ar() { return { withIsolationScope: Ot, withScope: Nr, withSetScope: Dr, withSetIsolationScope: (e, t) => Ot(t), getCurrentScope: () => ee().getScope(), getIsolationScope: () => ee().getIsolationScope() }; } function dt(e) { const t = De(e); return t.acs ? t.acs : Ar(); } function U() { const e = Ne(); return dt(e).getCurrentScope(); } function ue() { const e = Ne(); return dt(e).getIsolationScope(); } function Or() { return Ae("globalScope", () => new O()); } function kr(...e) { const t = Ne(), n = dt(t); if (e.length === 2) { const [r, s] = e; return r ? n.withSetScope(r, s) : n.withScope(s); } return n.withScope(e[0]); } function v() { return U().getClient(); } function Cr(e) { const t = e.getPropagationContext(), { traceId: n, parentSpanId: r, propagationSpanId: s } = t, i = { trace_id: n, span_id: s || In() }; return r && (i.parent_span_id = r), i; } const xr = "sentry.source", Lr = "sentry.sample_rate", Mr = "sentry.previous_trace_sample_rate", $r = "sentry.op", Fr = "sentry.origin", bn = "sentry.profile_id", Tn = "sentry.exclusive_time", Ur = 0, Br = 1, jr = "_sentryScope", Hr = "_sentryIsolationScope"; function vn(e) { return { scope: e[jr], isolationScope: e[Hr] }; } function Gr(e) { if (typeof e == "boolean") return Number(e); const t = typeof e == "string" ? parseFloat(e) : e; if (!(typeof t != "number" || isNaN(t) || t < 0 || t > 1)) return t; } const Wr = "sentry-", Yr = /^sentry-/; function Vr(e) { const t = qr(e); if (!t) return; const n = Object.entries(t).reduce((r, [s, i]) => { if (s.match(Yr)) { const o = s.slice(Wr.length); r[o] = i; } return r; }, {}); if (Object.keys(n).length > 0) return n; } function qr(e) { if (!(!e || !M(e) && !Array.isArray(e))) return Array.isArray(e) ? e.reduce((t, n) => { const r = kt(n); return Object.entries(r).forEach(([s, i]) => { t[s] = i; }), t; }, {}) : kt(e); } function kt(e) { return e.split(",").map( (t) => t.split("=").map((n) => { try { return decodeURIComponent(n.trim()); } catch (r) { return; } }) ).reduce((t, [n, r]) => (n && r && (t[n] = r), t), {}); } const wn = 1; let Ct = !1; function zr(e) { const { spanId: t, traceId: n, isRemote: r } = e.spanContext(), s = r ? t : pt(e).parent_span_id, i = vn(e).scope, o = r ? (i == null ? void 0 : i.getPropagationContext().propagationSpanId) || In() : t; return { parent_span_id: s, span_id: o, trace_id: n }; } function Kr(e) { if (e && e.length > 0) return e.map((o) => { var a = o, { context: c } = a, u = c, { spanId: t, traceId: n, traceFlags: r } = u, s = bt(u, ["spanId", "traceId", "traceFlags"]), { attributes: i } = a; return f({ span_id: t, trace_id: n, sampled: r === wn, attributes: i }, s); }); } function xt(e) { return typeof e == "number" ? Lt(e) : Array.isArray(e) ? e[0] + e[1] / 1e9 : e instanceof Date ? Lt(e.getTime()) : $(); } function Lt(e) { return e > 9999999999 ? e / 1e3 : e; } function pt(e) { var r; if (Jr(e)) return e.getSpanJSON(); const { spanId: t, traceId: n } = e.spanContext(); if (Xr(e)) { const { attributes: s, startTime: i, name: o, endTime: a, status: c, links: u } = e, l = "parentSpanId" in e ? e.parentSpanId : "parentSpanContext" in e ? (r = e.parentSpanContext) == null ? void 0 : r.spanId : void 0; return { span_id: t, trace_id: n, data: s, description: o, parent_span_id: l, start_timestamp: xt(i), // This is [0,0] by default in OTEL, in which case we want to interpret this as no end time timestamp: xt(a) || void 0, status: Zr(c), op: s[$r], origin: s[Fr], links: Kr(u) }; } return { span_id: t, trace_id: n, start_timestamp: 0, data: {} }; } function Xr(e) { const t = e; return !!t.attributes && !!t.startTime && !!t.name && !!t.endTime && !!t.status; } function Jr(e) { return typeof e.getSpanJSON == "function"; } function Qr(e) { const { traceFlags: t } = e.spanContext(); return t === wn; } function Zr(e) { if (!(!e || e.code === Ur)) return e.code === Br ? "ok" : e.message || "unknown_error"; } const es = "_sentryRootSpan"; function Rn(e) { return e[es] || e; } function Mt() { Ct || (re(() => { console.warn( "[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly." ); }), Ct = !0); } const Pn = 50, V = "?", $t = /\(error: (.*)\)/, Ft = /captureMessage|captureException/; function Nn(...e) { const t = e.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 = $t.test(c) ? c.replace($t, "$1") : c; if (!u.match(/\S*Error: /)) { for (const l of t) { const d = l(u); if (d) { i.push(d); break; } } if (i.length >= Pn + s) break; } } return ns(i.slice(s)); }; } function ts(e) { return Array.isArray(e) ? Nn(...e) : e; } function ns(e) { if (!e.length) return []; const t = Array.from(e); return /sentryWrapped/.test(he(t).function || "") && t.pop(), t.reverse(), Ft.test(he(t).function || "") && (t.pop(), Ft.test(he(t).function || "") && t.pop()), t.slice(0, Pn).map((n) => y(f({}, n), { filename: n.filename || he(t).filename, function: n.function || V })); } function he(e) { return e[e.length - 1] || {}; } const Me = "<anonymous>"; function j(e) { try { return !e || typeof e != "function" ? Me : e.name || Me; } catch (t) { return Me; } } function Ut(e) { const t = e.exception; if (t) { const n = []; try { return t.values.forEach((r) => { r.stacktrace.frames && n.push(...r.stacktrace.frames); }), n; } catch (r) { return; } } } const Se = {}, Bt = {}; function K(e, t) { Se[e] = Se[e] || [], Se[e].push(t); } function X(e, t) { if (!Bt[e]) { Bt[e] = !0; try { t(); } catch (n) { _ && h.error(`Error while instrumenting ${e}`, n); } } } function D(e, t) { const n = e && Se[e]; if (n) for (const r of n) try { r(t); } catch (s) { _ && h.error( `Error while triggering instrumentation handler. Type: ${e} Name: ${j(r)} Error:`, s ); } } let $e = null; function rs(e) { const t = "error"; K(t, e), X(t, ss); } function ss() { $e = m.onerror, m.onerror = function(e, t, n, r, s) { return D("error", { column: r, error: s, line: n, msg: e, url: t }), $e ? $e.apply(this, arguments) : !1; }, m.onerror.__SENTRY_INSTRUMENTED__ = !0; } let Fe = null; function is(e) { const t = "unhandledrejection"; K(t, e), X(t, os); } function os() { Fe = m.onunhandledrejection, m.onunhandledrejection = function(e) { return D("unhandledrejection", e), Fe ? Fe.apply(this, arguments) : !0; }, m.onunhandledrejection.__SENTRY_INSTRUMENTED__ = !0; } function as(e) { var n; if (typeof __SENTRY_TRACING__ == "boolean" && !__SENTRY_TRACING__) return !1; const t = e || ((n = v()) == null ? void 0 : n.getOptions()); return !!t && // 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) (t.tracesSampleRate != null || !!t.tracesSampler); } const ht = "production", cs = /^o(\d+)\./, us = /^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/; function fs(e) { return e === "http" || e === "https"; } function xe(e, t = !1) { const { host: n, path: r, pass: s, port: i, projectId: o, protocol: a, publicKey: c } = e; return `${a}://${c}${t && s ? `:${s}` : ""}@${n}${i ? `:${i}` : ""}/${r && `${r}/`}${o}`; } function ls(e) { const t = us.exec(e); if (!t) { re(() => { console.error(`Invalid Sentry Dsn: ${e}`); }); return; } const [n, r, s = "", i = "", o = "", a = ""] = t.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 Dn({ host: i, pass: s, path: c, projectId: u, port: o, protocol: n, publicKey: r }); } function Dn(e) { return { protocol: e.protocol, publicKey: e.publicKey || "", pass: e.pass || "", host: e.host, port: e.port || "", path: e.path || "", projectId: e.projectId }; } function ds(e) { if (!_) return !0; const { port: t, projectId: n, protocol: r } = e; return ["protocol", "publicKey", "host", "projectId"].find((o) => e[o] ? !1 : (h.error(`Invalid Sentry Dsn: ${o} missing`), !0)) ? !1 : n.match(/^\d+$/) ? fs(r) ? t && isNaN(parseInt(t, 10)) ? (h.error(`Invalid Sentry Dsn: Invalid port ${t}`), !1) : !0 : (h.error(`Invalid Sentry Dsn: Invalid protocol ${r}`), !1) : (h.error(`Invalid Sentry Dsn: Invalid projectId ${n}`), !1); } function ps(e) { const t = e.match(cs); return t == null ? void 0 : t[1]; } function hs(e) { const t = typeof e == "string" ? ls(e) : Dn(e); if (!(!t || !ds(t))) return t; } const gs = "_frozenDsc"; function An(e, t) { const n = t.getOptions(), { publicKey: r, host: s } = t.getDsn() || {}; let i; n.orgId ? i = String(n.orgId) : s && (i = ps(s)); const o = { environment: n.environment || ht, release: n.release, public_key: r, trace_id: e, org_id: i }; return t.emit("createDsc", o), o; } function _s(e, t) { const n = t.getPropagationContext(); return n.dsc || An(n.traceId, e); } function ms(e) { var I, R, S, A; const t = v(); if (!t) return {}; const n = Rn(e), r = pt(n), s = r.data, i = n.spanContext().traceState, o = (R = (I = i == null ? void 0 : i.get("sentry.sample_rate")) != null ? I : s[Lr]) != null ? R : s[Mr]; function a(k) { return (typeof o == "number" || typeof o == "string") && (k.sample_rate = `${o}`), k; } const c = n[gs]; if (c) return a(c); const u = i == null ? void 0 : i.get("sentry.dsc"), l = u && Vr(u); if (l) return a(l); const d = An(e.spanContext().traceId, t), g = s[xr], p = r.description; return g !== "url" && p && (d.transaction = p), as() && (d.sampled = String(Qr(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 (A = i == null ? void 0 : i.get("sentry.sample_rand")) != null ? A : ( // On all other platforms we can actually get the scopes from a root span (we use this as a fallback) (S = vn(n).scope) == null ? void 0 : S.getPropagationContext().sampleRand.toString() )), a(d), t.emit("createDsc", d, n), d; } function x(e, t = 100, n = 1 / 0) { try { return qe("", e, t, n); } catch (r) { return { ERROR: `**non-serializable** (${r})` }; } } function On(e, t = 3, n = 100 * 1024) { const r = x(e, t); return Is(r) > n ? On(e, t - 1, n) : r; } function qe(e, t, n = 1 / 0, r = 1 / 0, s = bs()) { const [i, o] = s; if (t == null || // this matches null and undefined -> eqeq not eqeqeq ["boolean", "string"].includes(typeof t) || typeof t == "number" && Number.isFinite(t)) return t; const a = ys(e, t); if (!a.startsWith("[object ")) return a; if (t.__sentry_skip_normalization__) return t; const c = typeof t.__sentry_override_normalization_depth__ == "number" ? t.__sentry_override_normalization_depth__ : n; if (c === 0) return a.replace("object ", ""); if (i(t)) return "[Circular ~]"; const u = t; if (u && typeof u.toJSON == "function") try { const p = u.toJSON(); return qe("", p, c - 1, r, s); } catch (p) { } const l = Array.isArray(t) ? [] : {}; let d = 0; const g = yn(t); for (const p in g) { if (!Object.prototype.hasOwnProperty.call(g, p)) continue; if (d >= r) { l[p] = "[MaxProperties ~]"; break; } const I = g[p]; l[p] = qe(p, I, c - 1, r, s), d++; } return o(t), l; } function ys(e, t) { try { if (e === "domain" && t && typeof t == "object" && t._events) return "[Domain]"; if (e === "domainEmitter") return "[DomainEmitter]"; if (typeof global != "undefined" && t === global) return "[Global]"; if (typeof window != "undefined" && t === window) return "[Window]"; if (typeof document != "undefined" && t === document) return "[Document]"; if (gn(t)) return "[VueViewModel]"; if (ur(t)) return "[SyntheticEvent]"; if (typeof t == "number" && !Number.isFinite(t)) return `[${t}]`; if (typeof t == "function") return `[Function: ${j(t)}]`; if (typeof t == "symbol") return `[${String(t)}]`; if (typeof t == "bigint") return `[BigInt: ${String(t)}]`; const n = Es(t); return /^HTML(\w*)Element$/.test(n) ? `[HTMLElement: ${n}]` : `[object ${n}]`; } catch (n) { return `**non-serializable** (${n})`; } } function Es(e) { const t = Object.getPrototypeOf(e); return t != null && t.constructor ? t.constructor.name : "null prototype"; } function Ss(e) { return ~-encodeURI(e).split(/%..|./).length; } function Is(e) { return Ss(JSON.stringify(e)); } function bs() { const e = /* @__PURE__ */ new WeakSet(); function t(r) { return e.has(r) ? !0 : (e.add(r), !1); } function n(r) { e.delete(r); } return [t, n]; } function fe(e, t = []) { return [e, t]; } function Ts(e, t) { const [n, r] = e; return [n, [...r, t]]; } function jt(e, t) { const n = e[1]; for (const r of n) { const s = r[0].type; if (t(r, s)) return !0; } return !1; } function ze(e) { const t = De(m); return t.encodePolyfill ? t.encodePolyfill(e) : new TextEncoder().encode(e); } function vs(e) { const [t, n] = e; let r = JSON.stringify(t); function s(i) { typeof r == "string" ? r = typeof i == "string" ? r + i : [ze(r), i] : r.push(typeof i == "string" ? ze(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 : ws(r); } function ws(e) { const t = e.reduce((s, i) => s + i.length, 0), n = new Uint8Array(t); let r = 0; for (const s of e) n.set(s, r), r += s.length; return n; } function Rs(e) { const t = typeof e.data == "string" ? ze(e.data) : e.data; return [ { type: "attachment", length: t.length, filename: e.filename, content_type: e.contentType, attachment_type: e.attachmentType }, t ]; } const Ps = { 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 Ht(e) { return Ps[e]; } function kn(e) { if (!(e != null && e.sdk)) return; const { name: t, version: n } = e.sdk; return { name: t, version: n }; } function Ns(e, t, n, r) { var i; const s = (i = e.sdkProcessingMetadata) == null ? void 0 : i.dynamicSamplingContext; return f(f(f({ event_id: e.event_id, sent_at: (/* @__PURE__ */ new Date()).toISOString() }, t && { sdk: t }), !!n && r && { dsn: xe(r) }), s && { trace: s }); } function Ds(e, t) { return t && (e.sdk = e.sdk || {}, e.sdk.name = e.sdk.name || t.name, e.sdk.version = e.sdk.version || t.version, e.sdk.integrations = [...e.sdk.integrations || [], ...t.integrations || []], e.sdk.packages = [...e.sdk.packages || [], ...t.packages || []]), e; } function As(e, t, n, r) { const s = kn(n), i = f(f({ sent_at: (/* @__PURE__ */ new Date()).toISOString() }, s && { sdk: s }), !!r && t && { dsn: xe(t) }), o = "aggregates" in e ? [{ type: "sessions" }, e] : [{ type: "session" }, e.toJSON()]; return fe(i, [o]); } function Os(e, t, n, r) { const s = kn(n), i = e.type && e.type !== "replay_event" ? e.type : "event"; Ds(e, n == null ? void 0 : n.sdk); const o = Ns(e, s, r, t); return delete e.sdkProcessingMetadata, fe(o, [[{ type: i }, e]]); } var L; (function(e) { e[e.PENDING = 0] = "PENDING"; const n = 1; e[e.RESOLVED = n] = "RESOLVED"; const r = 2; e[e.REJECTED = r] = "REJECTED"; })(L || (L = {})); function q(e) { return new H((t) => { t(e); }); } function we(e) { return new H((t, n) => { n(e); }); } class H { constructor(t) { this._state = L.PENDING, this._handlers = [], this._runExecutor(t); } /** @inheritdoc */ then(t, n) { return new H((r, s) => { this._handlers.push([ !1, (i) => { if (!t) r(i); else try { r(t(i)); } catch (o) { s(o); } }, (i) => { if (!n) s(i); else try { r(n(i)); } catch (o) { s(o); } } ]), this._executeHandlers(); }); } /** @inheritdoc */ catch(t) { return this.then((n) => n, t); } /** @inheritdoc */ finally(t) { return new H((n, r) => { let s, i; return this.then( (o) => { i = !1, s = o, t && t(); }, (o) => { i = !0, s = o, t && t(); } ).then(() => { if (i) { r(s); return; } n(s); }); }); } /** Excute the resolve/reject handlers. */ _executeHandlers() { if (this._state === L.PENDING) return; const t = this._handlers.slice(); this._handlers = [], t.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(t) { const n = (i, o) => { if (this._state === L.PENDING) { if (ke(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 { t(r, s); } catch (i) { s(i); } } } function Ke(e, t, n, r = 0) { return new H((s, i) => { const o = e[r]; if (t === null || typeof o != "function") s(t); else { const a = o(f({}, t), n); _ && o.id && a === null && h.log(`Event processor "${o.id}" dropped event`), ke(a) ? a.then((c) => Ke(e, c, n, r + 1).then(s)).then(null, i) : Ke(e, a, n, r + 1).then(s).then(null, i); } }); } let ge, Gt, _e; function ks(e) { const t = m._sentryDebugIds; if (!t) return {}; const n = Object.keys(t); return _e && n.length === Gt || (Gt = n.length, _e = n.reduce((r, s) => { ge || (ge = {}); const i = ge[s]; if (i) r[i[0]] = i[1]; else { const o = e(s); for (let a = o.length - 1; a >= 0; a--) { const c = o[a], u = c == null ? void 0 : c.filename, l = t[s]; if (u && l) { r[u] = l, ge[s] = [u, l]; break; } } } return r; }, {})), _e; } function Cs(e, t) { const { fingerprint: n, span: r, breadcrumbs: s, sdkProcessingMetadata: i } = t; xs(e, t), r && $s(e, r), Fs(e, n), Ls(e, s), Ms(e, i); } function Wt(e, t) { const { extra: n, tags: r, user: s, contexts: i, level: o, sdkProcessingMetadata: a, breadcrumbs: c, fingerprint: u, eventProcessors: l, attachments: d, propagationContext: g, transactionName: p, span: I } = t; me(e, "extra", n), me(e, "tags", r), me(e, "user", s), me(e, "contexts", i), e.sdkProcessingMetadata = ce(e.sdkProcessingMetadata, a, 2), o && (e.level = o), p && (e.transactionName = p), I && (e.span = I), c.length && (e.breadcrumbs = [...e.breadcrumbs, ...c]), u.length && (e.fingerprint = [...e.fingerprint, ...u]), l.length && (e.eventProcessors = [...e.eventProcessors, ...l]), d.length && (e.attachments = [...e.attachments, ...d]), e.propagationContext = f(f({}, e.propagationContext), g); } function me(e, t, n) { e[t] = ce(e[t], n, 1); } function xs(e, t) { const { extra: n, tags: r, user: s, contexts: i, level: o, transactionName: a } = t; Object.keys(n).length && (e.extra = f(f({}, n), e.extra)), Object.keys(r).length && (e.tags = f(f({}, r), e.tags)), Object.keys(s).length && (e.user = f(f({}, s), e.user)), Object.keys(i).length && (e.contexts = f(f({}, i), e.contexts)), o && (e.level = o), a && e.type !== "transaction" && (e.transaction = a); } function Ls(e, t) { const n = [...e.breadcrumbs || [], ...t]; e.breadcrumbs = n.length ? n : void 0; } function Ms(e, t) { e.sdkProcessingMetadata = f(f({}, e.sdkProcessingMetadata), t); } function $s(e, t) { e.contexts = f({ trace: zr(t) }, e.contexts), e.sdkProcessingMetadata = f({ dynamicSamplingContext: ms(t) }, e.sdkProcessingMetadata); const n = Rn(t), r = pt(n).description; r && !e.transaction && e.type === "transaction" && (e.transaction = r); } function Fs(e, t) { e.fingerprint = e.fingerprint ? Array.isArray(e.fingerprint) ? e.fingerprint : [e.fingerprint] : [], t && (e.fingerprint = e.fingerprint.concat(t)), e.fingerprint.length || delete e.fingerprint; } function Us(e, t, n, r, s, i) { const { normalizeDepth: o = 3, normalizeMaxBreadth: a = 1e3 } = e, c = y(f({}, t), { event_id: t.event_id || n.event_id || N(), timestamp: t.timestamp || ae() }), u = n.integrations || e.integrations.map((S) => S.name); Bs(c, e), Gs(c, u), s && s.emit("applyFrameMetadata", t), t.type === void 0 && js(c, e.stackParser); const l = Ys(r, n.captureContext); n.mechanism && Q(c, n.mechanism); const d = s ? s.getEventProcessors() : [], g = Or().getScopeData(); if (i) { const S = i.getScopeData(); Wt(g, S); } if (l) { const S = l.getScopeData(); Wt(g, S); } const p = [...n.attachments || [], ...g.attachments]; p.length && (n.attachments = p), Cs(c, g); const I = [ ...d, // Run scope event processors _after_ all other processors ...g.eventProcessors ]; return Ke(I, c, n).then((S) => (S && Hs(S), typeof o == "number" && o > 0 ? Ws(S, o, a) : S)); } function Bs(e, t) { const { environment: n, release: r, dist: s, maxValueLength: i = 250 } = t; e.environment = e.environment || n || ht, !e.release && r && (e.release = r), !e.dist && s && (e.dist = s); const o = e.request; o != null && o.url && (o.url = ve(o.url, i)); } function js(e, t) { var r, s; const n = ks(t); (s = (r = e.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