{"version":3,"file":"sentry.js","mappings":";AA2WA;AAAA;AAAA;ACrUA;ACRA;AACA;AACA;ACJA;ACwBA;AAMA;AAOA;AAOA;AAGA;AAOA;AAGA;AC7BA;AACA;ACrCA;ACweA;ACtdA;AACA;AACA;ACjBA","sources":["webpack://hexlet_cv/./node_modules/@sentry/core/esm/hub.js","webpack://hexlet_cv/./node_modules/@sentry/core/esm/tracing/hubextensions.js","webpack://hexlet_cv/./node_modules/@sentry/utils/esm/instrument/_handlers.js","webpack://hexlet_cv/./node_modules/@sentry/utils/esm/stacktrace.js","webpack://hexlet_cv/./node_modules/@sentry/core/esm/integrations/inboundfilters.js","webpack://hexlet_cv/./node_modules/@sentry/utils/esm/envelope.js","webpack://hexlet_cv/./node_modules/@sentry/core/esm/metrics/utils.js","webpack://hexlet_cv/./node_modules/@sentry/core/esm/baseclient.js","webpack://hexlet_cv/./node_modules/@sentry-internal/tracing/esm/browser/instrument.js","webpack://hexlet_cv/./app/javascript/entrypoints/sentry.js"],"sourcesContent":["var __defProp = Object.defineProperty;\nvar __defProps = Object.defineProperties;\nvar __getOwnPropDescs = Object.getOwnPropertyDescriptors;\nvar __getOwnPropSymbols = Object.getOwnPropertySymbols;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __propIsEnum = Object.prototype.propertyIsEnumerable;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __spreadValues = (a, b) => {\n for (var prop in b || (b = {}))\n if (__hasOwnProp.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n if (__getOwnPropSymbols)\n for (var prop of __getOwnPropSymbols(b)) {\n if (__propIsEnum.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n }\n return a;\n};\nvar __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));\nimport { isThenable, uuid4, dateTimestampInSeconds, consoleSandbox, logger, GLOBAL_OBJ, getGlobalSingleton } from \"@sentry/utils\";\nimport { DEFAULT_ENVIRONMENT } from \"./constants.js\";\nimport { DEBUG_BUILD } from \"./debug-build.js\";\nimport { Scope } from \"./scope.js\";\nimport { closeSession, makeSession, updateSession } from \"./session.js\";\nimport { SDK_VERSION } from \"./version.js\";\nconst API_VERSION = parseFloat(SDK_VERSION);\nconst DEFAULT_BREADCRUMBS = 100;\nclass Hub {\n /** Is a {@link Layer}[] containing the client and scope */\n /** Contains the last event id of a captured event. */\n /**\n * Creates a new instance of the hub, will push one {@link Layer} into the\n * internal stack on creation.\n *\n * @param client bound to the hub.\n * @param scope bound to the hub.\n * @param version number, higher number means higher priority.\n */\n constructor(client, scope, isolationScope, _version = API_VERSION) {\n this._version = _version;\n let assignedScope;\n if (!scope) {\n assignedScope = new Scope();\n assignedScope.setClient(client);\n } else {\n assignedScope = scope;\n }\n let assignedIsolationScope;\n if (!isolationScope) {\n assignedIsolationScope = new Scope();\n assignedIsolationScope.setClient(client);\n } else {\n assignedIsolationScope = isolationScope;\n }\n this._stack = [{ scope: assignedScope }];\n if (client) {\n this.bindClient(client);\n }\n this._isolationScope = assignedIsolationScope;\n }\n /**\n * Checks if this hub's version is older than the given version.\n *\n * @param version A version number to compare to.\n * @return True if the given version is newer; otherwise false.\n *\n * @deprecated This will be removed in v8.\n */\n isOlderThan(version) {\n return this._version < version;\n }\n /**\n * This binds the given client to the current scope.\n * @param client An SDK client (client) instance.\n *\n * @deprecated Use `initAndBind()` directly, or `setCurrentClient()` and/or `client.init()` instead.\n */\n bindClient(client) {\n const top = this.getStackTop();\n top.client = client;\n top.scope.setClient(client);\n if (client && client.setupIntegrations) {\n client.setupIntegrations();\n }\n }\n /**\n * @inheritDoc\n *\n * @deprecated Use `withScope` instead.\n */\n pushScope() {\n const scope = this.getScope().clone();\n this.getStack().push({\n // eslint-disable-next-line deprecation/deprecation\n client: this.getClient(),\n scope\n });\n return scope;\n }\n /**\n * @inheritDoc\n *\n * @deprecated Use `withScope` instead.\n */\n popScope() {\n if (this.getStack().length <= 1)\n return false;\n return !!this.getStack().pop();\n }\n /**\n * @inheritDoc\n *\n * @deprecated Use `Sentry.withScope()` instead.\n */\n withScope(callback) {\n const scope = this.pushScope();\n let maybePromiseResult;\n try {\n maybePromiseResult = callback(scope);\n } catch (e) {\n this.popScope();\n throw e;\n }\n if (isThenable(maybePromiseResult)) {\n return maybePromiseResult.then(\n (res) => {\n this.popScope();\n return res;\n },\n (e) => {\n this.popScope();\n throw e;\n }\n );\n }\n this.popScope();\n return maybePromiseResult;\n }\n /**\n * @inheritDoc\n *\n * @deprecated Use `Sentry.getClient()` instead.\n */\n getClient() {\n return this.getStackTop().client;\n }\n /**\n * Returns the scope of the top stack.\n *\n * @deprecated Use `Sentry.getCurrentScope()` instead.\n */\n getScope() {\n return this.getStackTop().scope;\n }\n /**\n * @deprecated Use `Sentry.getIsolationScope()` instead.\n */\n getIsolationScope() {\n return this._isolationScope;\n }\n /**\n * Returns the scope stack for domains or the process.\n * @deprecated This will be removed in v8.\n */\n getStack() {\n return this._stack;\n }\n /**\n * Returns the topmost scope layer in the order domain > local > process.\n * @deprecated This will be removed in v8.\n */\n getStackTop() {\n return this._stack[this._stack.length - 1];\n }\n /**\n * @inheritDoc\n *\n * @deprecated Use `Sentry.captureException()` instead.\n */\n captureException(exception, hint) {\n const eventId = this._lastEventId = hint && hint.event_id ? hint.event_id : uuid4();\n const syntheticException = new Error(\"Sentry syntheticException\");\n this.getScope().captureException(exception, __spreadProps(__spreadValues({\n originalException: exception,\n syntheticException\n }, hint), {\n event_id: eventId\n }));\n return eventId;\n }\n /**\n * @inheritDoc\n *\n * @deprecated Use `Sentry.captureMessage()` instead.\n */\n captureMessage(message, level, hint) {\n const eventId = this._lastEventId = hint && hint.event_id ? hint.event_id : uuid4();\n const syntheticException = new Error(message);\n this.getScope().captureMessage(message, level, __spreadProps(__spreadValues({\n originalException: message,\n syntheticException\n }, hint), {\n event_id: eventId\n }));\n return eventId;\n }\n /**\n * @inheritDoc\n *\n * @deprecated Use `Sentry.captureEvent()` instead.\n */\n captureEvent(event, hint) {\n const eventId = hint && hint.event_id ? hint.event_id : uuid4();\n if (!event.type) {\n this._lastEventId = eventId;\n }\n this.getScope().captureEvent(event, __spreadProps(__spreadValues({}, hint), { event_id: eventId }));\n return eventId;\n }\n /**\n * @inheritDoc\n *\n * @deprecated This will be removed in v8.\n */\n lastEventId() {\n return this._lastEventId;\n }\n /**\n * @inheritDoc\n *\n * @deprecated Use `Sentry.addBreadcrumb()` instead.\n */\n addBreadcrumb(breadcrumb, hint) {\n const { scope, client } = this.getStackTop();\n if (!client)\n return;\n const { beforeBreadcrumb = null, maxBreadcrumbs = DEFAULT_BREADCRUMBS } = client.getOptions && client.getOptions() || {};\n if (maxBreadcrumbs <= 0)\n return;\n const timestamp = dateTimestampInSeconds();\n const mergedBreadcrumb = __spreadValues({ timestamp }, breadcrumb);\n const finalBreadcrumb = beforeBreadcrumb ? consoleSandbox(() => beforeBreadcrumb(mergedBreadcrumb, hint)) : mergedBreadcrumb;\n if (finalBreadcrumb === null)\n return;\n if (client.emit) {\n client.emit(\"beforeAddBreadcrumb\", finalBreadcrumb, hint);\n }\n scope.addBreadcrumb(finalBreadcrumb, maxBreadcrumbs);\n }\n /**\n * @inheritDoc\n * @deprecated Use `Sentry.setUser()` instead.\n */\n setUser(user) {\n this.getScope().setUser(user);\n this.getIsolationScope().setUser(user);\n }\n /**\n * @inheritDoc\n * @deprecated Use `Sentry.setTags()` instead.\n */\n setTags(tags) {\n this.getScope().setTags(tags);\n this.getIsolationScope().setTags(tags);\n }\n /**\n * @inheritDoc\n * @deprecated Use `Sentry.setExtras()` instead.\n */\n setExtras(extras) {\n this.getScope().setExtras(extras);\n this.getIsolationScope().setExtras(extras);\n }\n /**\n * @inheritDoc\n * @deprecated Use `Sentry.setTag()` instead.\n */\n setTag(key, value) {\n this.getScope().setTag(key, value);\n this.getIsolationScope().setTag(key, value);\n }\n /**\n * @inheritDoc\n * @deprecated Use `Sentry.setExtra()` instead.\n */\n setExtra(key, extra) {\n this.getScope().setExtra(key, extra);\n this.getIsolationScope().setExtra(key, extra);\n }\n /**\n * @inheritDoc\n * @deprecated Use `Sentry.setContext()` instead.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n setContext(name, context) {\n this.getScope().setContext(name, context);\n this.getIsolationScope().setContext(name, context);\n }\n /**\n * @inheritDoc\n *\n * @deprecated Use `getScope()` directly.\n */\n configureScope(callback) {\n const { scope, client } = this.getStackTop();\n if (client) {\n callback(scope);\n }\n }\n /**\n * @inheritDoc\n */\n run(callback) {\n const oldHub = makeMain(this);\n try {\n callback(this);\n } finally {\n makeMain(oldHub);\n }\n }\n /**\n * @inheritDoc\n * @deprecated Use `Sentry.getClient().getIntegrationByName()` instead.\n */\n getIntegration(integration) {\n const client = this.getClient();\n if (!client)\n return null;\n try {\n return client.getIntegration(integration);\n } catch (_oO) {\n DEBUG_BUILD && logger.warn(`Cannot retrieve integration ${integration.id} from the current Hub`);\n return null;\n }\n }\n /**\n * Starts a new `Transaction` and returns it. This is the entry point to manual tracing instrumentation.\n *\n * A tree structure can be built by adding child spans to the transaction, and child spans to other spans. To start a\n * new child span within the transaction or any span, call the respective `.startChild()` method.\n *\n * Every child span must be finished before the transaction is finished, otherwise the unfinished spans are discarded.\n *\n * The transaction must be finished with a call to its `.end()` method, at which point the transaction with all its\n * finished child spans will be sent to Sentry.\n *\n * @param context Properties of the new `Transaction`.\n * @param customSamplingContext Information given to the transaction sampling function (along with context-dependent\n * default values). See {@link Options.tracesSampler}.\n *\n * @returns The transaction which was just started\n *\n * @deprecated Use `startSpan()`, `startSpanManual()` or `startInactiveSpan()` instead.\n */\n startTransaction(context, customSamplingContext) {\n const result = this._callExtensionMethod(\"startTransaction\", context, customSamplingContext);\n if (DEBUG_BUILD && !result) {\n const client = this.getClient();\n if (!client) {\n logger.warn(\n \"Tracing extension 'startTransaction' is missing. You should 'init' the SDK before calling 'startTransaction'\"\n );\n } else {\n logger.warn(`Tracing extension 'startTransaction' has not been added. Call 'addTracingExtensions' before calling 'init':\nSentry.addTracingExtensions();\nSentry.init({...});\n`);\n }\n }\n return result;\n }\n /**\n * @inheritDoc\n * @deprecated Use `spanToTraceHeader()` instead.\n */\n traceHeaders() {\n return this._callExtensionMethod(\"traceHeaders\");\n }\n /**\n * @inheritDoc\n *\n * @deprecated Use top level `captureSession` instead.\n */\n captureSession(endSession = false) {\n if (endSession) {\n return this.endSession();\n }\n this._sendSessionUpdate();\n }\n /**\n * @inheritDoc\n * @deprecated Use top level `endSession` instead.\n */\n endSession() {\n const layer = this.getStackTop();\n const scope = layer.scope;\n const session = scope.getSession();\n if (session) {\n closeSession(session);\n }\n this._sendSessionUpdate();\n scope.setSession();\n }\n /**\n * @inheritDoc\n * @deprecated Use top level `startSession` instead.\n */\n startSession(context) {\n const { scope, client } = this.getStackTop();\n const { release, environment = DEFAULT_ENVIRONMENT } = client && client.getOptions() || {};\n const { userAgent } = GLOBAL_OBJ.navigator || {};\n const session = makeSession(__spreadValues(__spreadValues({\n release,\n environment,\n user: scope.getUser()\n }, userAgent && { userAgent }), context));\n const currentSession = scope.getSession && scope.getSession();\n if (currentSession && currentSession.status === \"ok\") {\n updateSession(currentSession, { status: \"exited\" });\n }\n this.endSession();\n scope.setSession(session);\n return session;\n }\n /**\n * Returns if default PII should be sent to Sentry and propagated in ourgoing requests\n * when Tracing is used.\n *\n * @deprecated Use top-level `getClient().getOptions().sendDefaultPii` instead. This function\n * only unnecessarily increased API surface but only wrapped accessing the option.\n */\n shouldSendDefaultPii() {\n const client = this.getClient();\n const options = client && client.getOptions();\n return Boolean(options && options.sendDefaultPii);\n }\n /**\n * Sends the current Session on the scope\n */\n _sendSessionUpdate() {\n const { scope, client } = this.getStackTop();\n const session = scope.getSession();\n if (session && client && client.captureSession) {\n client.captureSession(session);\n }\n }\n /**\n * Calls global extension method and binding current instance to the function call\n */\n // @ts-expect-error Function lacks ending return statement and return type does not include 'undefined'. ts(2366)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n _callExtensionMethod(method, ...args) {\n const carrier = getMainCarrier();\n const sentry = carrier.__SENTRY__;\n if (sentry && sentry.extensions && typeof sentry.extensions[method] === \"function\") {\n return sentry.extensions[method].apply(this, args);\n }\n DEBUG_BUILD && logger.warn(`Extension method ${method} couldn't be found, doing nothing.`);\n }\n}\nfunction getMainCarrier() {\n GLOBAL_OBJ.__SENTRY__ = GLOBAL_OBJ.__SENTRY__ || {\n extensions: {},\n hub: void 0\n };\n return GLOBAL_OBJ;\n}\nfunction makeMain(hub) {\n const registry = getMainCarrier();\n const oldHub = getHubFromCarrier(registry);\n setHubOnCarrier(registry, hub);\n return oldHub;\n}\nfunction getCurrentHub() {\n const registry = getMainCarrier();\n if (registry.__SENTRY__ && registry.__SENTRY__.acs) {\n const hub = registry.__SENTRY__.acs.getCurrentHub();\n if (hub) {\n return hub;\n }\n }\n return getGlobalHub(registry);\n}\nfunction getIsolationScope() {\n return getCurrentHub().getIsolationScope();\n}\nfunction getGlobalHub(registry = getMainCarrier()) {\n if (!hasHubOnCarrier(registry) || // eslint-disable-next-line deprecation/deprecation\n getHubFromCarrier(registry).isOlderThan(API_VERSION)) {\n setHubOnCarrier(registry, new Hub());\n }\n return getHubFromCarrier(registry);\n}\nfunction ensureHubOnCarrier(carrier, parent = getGlobalHub()) {\n if (!hasHubOnCarrier(carrier) || // eslint-disable-next-line deprecation/deprecation\n getHubFromCarrier(carrier).isOlderThan(API_VERSION)) {\n const client = parent.getClient();\n const scope = parent.getScope();\n const isolationScope = parent.getIsolationScope();\n setHubOnCarrier(carrier, new Hub(client, scope.clone(), isolationScope.clone()));\n }\n}\nfunction setAsyncContextStrategy(strategy) {\n const registry = getMainCarrier();\n registry.__SENTRY__ = registry.__SENTRY__ || {};\n registry.__SENTRY__.acs = strategy;\n}\nfunction runWithAsyncContext(callback, options = {}) {\n const registry = getMainCarrier();\n if (registry.__SENTRY__ && registry.__SENTRY__.acs) {\n return registry.__SENTRY__.acs.runWithAsyncContext(callback, options);\n }\n return callback();\n}\nfunction hasHubOnCarrier(carrier) {\n return !!(carrier && carrier.__SENTRY__ && carrier.__SENTRY__.hub);\n}\nfunction getHubFromCarrier(carrier) {\n return getGlobalSingleton(\"hub\", () => new Hub(), carrier);\n}\nfunction setHubOnCarrier(carrier, hub) {\n if (!carrier)\n return false;\n const __SENTRY__ = carrier.__SENTRY__ = carrier.__SENTRY__ || {};\n __SENTRY__.hub = hub;\n return true;\n}\nexport { API_VERSION, Hub, ensureHubOnCarrier, getCurrentHub, getHubFromCarrier, getIsolationScope, getMainCarrier, makeMain, runWithAsyncContext, setAsyncContextStrategy, setHubOnCarrier };\n","var __defProp = Object.defineProperty;\nvar __getOwnPropSymbols = Object.getOwnPropertySymbols;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __propIsEnum = Object.prototype.propertyIsEnumerable;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __spreadValues = (a, b) => {\n for (var prop in b || (b = {}))\n if (__hasOwnProp.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n if (__getOwnPropSymbols)\n for (var prop of __getOwnPropSymbols(b)) {\n if (__propIsEnum.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n }\n return a;\n};\nimport { logger } from \"@sentry/utils\";\nimport { DEBUG_BUILD } from \"../debug-build.js\";\nimport { getMainCarrier } from \"../hub.js\";\nimport { spanToTraceHeader } from \"../utils/spanUtils.js\";\nimport { registerErrorInstrumentation } from \"./errors.js\";\nimport { IdleTransaction } from \"./idletransaction.js\";\nimport { sampleTransaction } from \"./sampling.js\";\nimport { Transaction } from \"./transaction.js\";\nfunction traceHeaders() {\n const scope = this.getScope();\n const span = scope.getSpan();\n return span ? {\n \"sentry-trace\": spanToTraceHeader(span)\n } : {};\n}\nfunction _startTransaction(transactionContext, customSamplingContext) {\n const client = this.getClient();\n const options = client && client.getOptions() || {};\n const configInstrumenter = options.instrumenter || \"sentry\";\n const transactionInstrumenter = transactionContext.instrumenter || \"sentry\";\n if (configInstrumenter !== transactionInstrumenter) {\n DEBUG_BUILD && logger.error(\n `A transaction was started with instrumenter=\\`${transactionInstrumenter}\\`, but the SDK is configured with the \\`${configInstrumenter}\\` instrumenter.\nThe transaction will not be sampled. Please use the ${configInstrumenter} instrumentation to start transactions.`\n );\n transactionContext.sampled = false;\n }\n let transaction = new Transaction(transactionContext, this);\n transaction = sampleTransaction(transaction, options, __spreadValues({\n parentSampled: transactionContext.parentSampled,\n transactionContext\n }, customSamplingContext));\n if (transaction.isRecording()) {\n transaction.initSpanRecorder(options._experiments && options._experiments.maxSpans);\n }\n if (client && client.emit) {\n client.emit(\"startTransaction\", transaction);\n }\n return transaction;\n}\nfunction startIdleTransaction(hub, transactionContext, idleTimeout, finalTimeout, onScope, customSamplingContext, heartbeatInterval, delayAutoFinishUntilSignal = false) {\n const client = hub.getClient();\n const options = client && client.getOptions() || {};\n let transaction = new IdleTransaction(\n transactionContext,\n hub,\n idleTimeout,\n finalTimeout,\n heartbeatInterval,\n onScope,\n delayAutoFinishUntilSignal\n );\n transaction = sampleTransaction(transaction, options, __spreadValues({\n parentSampled: transactionContext.parentSampled,\n transactionContext\n }, customSamplingContext));\n if (transaction.isRecording()) {\n transaction.initSpanRecorder(options._experiments && options._experiments.maxSpans);\n }\n if (client && client.emit) {\n client.emit(\"startTransaction\", transaction);\n }\n return transaction;\n}\nfunction addTracingExtensions() {\n const carrier = getMainCarrier();\n if (!carrier.__SENTRY__) {\n return;\n }\n carrier.__SENTRY__.extensions = carrier.__SENTRY__.extensions || {};\n if (!carrier.__SENTRY__.extensions.startTransaction) {\n carrier.__SENTRY__.extensions.startTransaction = _startTransaction;\n }\n if (!carrier.__SENTRY__.extensions.traceHeaders) {\n carrier.__SENTRY__.extensions.traceHeaders = traceHeaders;\n }\n registerErrorInstrumentation();\n}\nexport { addTracingExtensions, startIdleTransaction };\n","import { DEBUG_BUILD } from \"../debug-build.js\";\nimport { logger } from \"../logger.js\";\nimport { getFunctionName } from \"../stacktrace.js\";\nconst handlers = {};\nconst instrumented = {};\nfunction addHandler(type, handler) {\n handlers[type] = handlers[type] || [];\n handlers[type].push(handler);\n}\nfunction resetInstrumentationHandlers() {\n Object.keys(handlers).forEach((key) => {\n handlers[key] = void 0;\n });\n}\nfunction maybeInstrument(type, instrumentFn) {\n if (!instrumented[type]) {\n instrumentFn();\n instrumented[type] = true;\n }\n}\nfunction triggerHandlers(type, data) {\n const typeHandlers = type && handlers[type];\n if (!typeHandlers) {\n return;\n }\n for (const handler of typeHandlers) {\n try {\n handler(data);\n } catch (e) {\n DEBUG_BUILD && logger.error(\n `Error while triggering instrumentation handler.\nType: ${type}\nName: ${getFunctionName(handler)}\nError:`,\n e\n );\n }\n }\n}\nexport { addHandler, maybeInstrument, resetInstrumentationHandlers, triggerHandlers };\n","var __defProp = Object.defineProperty;\nvar __defProps = Object.defineProperties;\nvar __getOwnPropDescs = Object.getOwnPropertyDescriptors;\nvar __getOwnPropSymbols = Object.getOwnPropertySymbols;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __propIsEnum = Object.prototype.propertyIsEnumerable;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __spreadValues = (a, b) => {\n for (var prop in b || (b = {}))\n if (__hasOwnProp.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n if (__getOwnPropSymbols)\n for (var prop of __getOwnPropSymbols(b)) {\n if (__propIsEnum.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n }\n return a;\n};\nvar __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));\nimport { node } from \"./node-stack-trace.js\";\nexport { filenameIsInApp } from \"./node-stack-trace.js\";\nconst STACKTRACE_FRAME_LIMIT = 50;\nconst WEBPACK_ERROR_REGEXP = /\\(error: (.*)\\)/;\nconst STRIP_FRAME_REGEXP = /captureMessage|captureException/;\nfunction createStackParser(...parsers) {\n const sortedParsers = parsers.sort((a, b) => a[0] - b[0]).map((p) => p[1]);\n return (stack, skipFirst = 0) => {\n const frames = [];\n const lines = stack.split(\"\\n\");\n for (let i = skipFirst; i < lines.length; i++) {\n const line = lines[i];\n if (line.length > 1024) {\n continue;\n }\n const cleanedLine = WEBPACK_ERROR_REGEXP.test(line) ? line.replace(WEBPACK_ERROR_REGEXP, \"$1\") : line;\n if (cleanedLine.match(/\\S*Error: /)) {\n continue;\n }\n for (const parser of sortedParsers) {\n const frame = parser(cleanedLine);\n if (frame) {\n frames.push(frame);\n break;\n }\n }\n if (frames.length >= STACKTRACE_FRAME_LIMIT) {\n break;\n }\n }\n return stripSentryFramesAndReverse(frames);\n };\n}\nfunction stackParserFromStackParserOptions(stackParser) {\n if (Array.isArray(stackParser)) {\n return createStackParser(...stackParser);\n }\n return stackParser;\n}\nfunction stripSentryFramesAndReverse(stack) {\n if (!stack.length) {\n return [];\n }\n const localStack = Array.from(stack);\n if (/sentryWrapped/.test(localStack[localStack.length - 1].function || \"\")) {\n localStack.pop();\n }\n localStack.reverse();\n if (STRIP_FRAME_REGEXP.test(localStack[localStack.length - 1].function || \"\")) {\n localStack.pop();\n if (STRIP_FRAME_REGEXP.test(localStack[localStack.length - 1].function || \"\")) {\n localStack.pop();\n }\n }\n return localStack.slice(0, STACKTRACE_FRAME_LIMIT).map((frame) => __spreadProps(__spreadValues({}, frame), {\n filename: frame.filename || localStack[localStack.length - 1].filename,\n function: frame.function || \"?\"\n }));\n}\nconst defaultFunctionName = \"\";\nfunction getFunctionName(fn) {\n try {\n if (!fn || typeof fn !== \"function\") {\n return defaultFunctionName;\n }\n return fn.name || defaultFunctionName;\n } catch (e) {\n return defaultFunctionName;\n }\n}\nfunction nodeStackLineParser(getModule) {\n return [90, node(getModule)];\n}\nexport { createStackParser, getFunctionName, nodeStackLineParser, stackParserFromStackParserOptions, stripSentryFramesAndReverse };\n","import { logger, getEventDescription, stringMatchesSomePattern } from \"@sentry/utils\";\nimport { DEBUG_BUILD } from \"../debug-build.js\";\nimport { convertIntegrationFnToClass, defineIntegration } from \"../integration.js\";\nconst DEFAULT_IGNORE_ERRORS = [/^Script error\\.?$/, /^Javascript error: Script error\\.? on line 0$/];\nconst DEFAULT_IGNORE_TRANSACTIONS = [\n /^.*\\/healthcheck$/,\n /^.*\\/healthy$/,\n /^.*\\/live$/,\n /^.*\\/ready$/,\n /^.*\\/heartbeat$/,\n /^.*\\/health$/,\n /^.*\\/healthz$/\n];\nconst INTEGRATION_NAME = \"InboundFilters\";\nconst _inboundFiltersIntegration = (options = {}) => {\n return {\n name: INTEGRATION_NAME,\n // TODO v8: Remove this\n setupOnce() {\n },\n // eslint-disable-line @typescript-eslint/no-empty-function\n processEvent(event, _hint, client) {\n const clientOptions = client.getOptions();\n const mergedOptions = _mergeOptions(options, clientOptions);\n return _shouldDropEvent(event, mergedOptions) ? null : event;\n }\n };\n};\nconst inboundFiltersIntegration = defineIntegration(_inboundFiltersIntegration);\nconst InboundFilters = convertIntegrationFnToClass(\n INTEGRATION_NAME,\n inboundFiltersIntegration\n);\nfunction _mergeOptions(internalOptions = {}, clientOptions = {}) {\n return {\n allowUrls: [...internalOptions.allowUrls || [], ...clientOptions.allowUrls || []],\n denyUrls: [...internalOptions.denyUrls || [], ...clientOptions.denyUrls || []],\n ignoreErrors: [\n ...internalOptions.ignoreErrors || [],\n ...clientOptions.ignoreErrors || [],\n ...internalOptions.disableErrorDefaults ? [] : DEFAULT_IGNORE_ERRORS\n ],\n ignoreTransactions: [\n ...internalOptions.ignoreTransactions || [],\n ...clientOptions.ignoreTransactions || [],\n ...internalOptions.disableTransactionDefaults ? [] : DEFAULT_IGNORE_TRANSACTIONS\n ],\n ignoreInternal: internalOptions.ignoreInternal !== void 0 ? internalOptions.ignoreInternal : true\n };\n}\nfunction _shouldDropEvent(event, options) {\n if (options.ignoreInternal && _isSentryError(event)) {\n DEBUG_BUILD && logger.warn(`Event dropped due to being internal Sentry Error.\nEvent: ${getEventDescription(event)}`);\n return true;\n }\n if (_isIgnoredError(event, options.ignoreErrors)) {\n DEBUG_BUILD && logger.warn(\n `Event dropped due to being matched by \\`ignoreErrors\\` option.\nEvent: ${getEventDescription(event)}`\n );\n return true;\n }\n if (_isIgnoredTransaction(event, options.ignoreTransactions)) {\n DEBUG_BUILD && logger.warn(\n `Event dropped due to being matched by \\`ignoreTransactions\\` option.\nEvent: ${getEventDescription(event)}`\n );\n return true;\n }\n if (_isDeniedUrl(event, options.denyUrls)) {\n DEBUG_BUILD && logger.warn(\n `Event dropped due to being matched by \\`denyUrls\\` option.\nEvent: ${getEventDescription(\n event\n )}.\nUrl: ${_getEventFilterUrl(event)}`\n );\n return true;\n }\n if (!_isAllowedUrl(event, options.allowUrls)) {\n DEBUG_BUILD && logger.warn(\n `Event dropped due to not being matched by \\`allowUrls\\` option.\nEvent: ${getEventDescription(\n event\n )}.\nUrl: ${_getEventFilterUrl(event)}`\n );\n return true;\n }\n return false;\n}\nfunction _isIgnoredError(event, ignoreErrors) {\n if (event.type || !ignoreErrors || !ignoreErrors.length) {\n return false;\n }\n return _getPossibleEventMessages(event).some((message) => stringMatchesSomePattern(message, ignoreErrors));\n}\nfunction _isIgnoredTransaction(event, ignoreTransactions) {\n if (event.type !== \"transaction\" || !ignoreTransactions || !ignoreTransactions.length) {\n return false;\n }\n const name = event.transaction;\n return name ? stringMatchesSomePattern(name, ignoreTransactions) : false;\n}\nfunction _isDeniedUrl(event, denyUrls) {\n if (!denyUrls || !denyUrls.length) {\n return false;\n }\n const url = _getEventFilterUrl(event);\n return !url ? false : stringMatchesSomePattern(url, denyUrls);\n}\nfunction _isAllowedUrl(event, allowUrls) {\n if (!allowUrls || !allowUrls.length) {\n return true;\n }\n const url = _getEventFilterUrl(event);\n return !url ? true : stringMatchesSomePattern(url, allowUrls);\n}\nfunction _getPossibleEventMessages(event) {\n const possibleMessages = [];\n if (event.message) {\n possibleMessages.push(event.message);\n }\n let lastException;\n try {\n lastException = event.exception.values[event.exception.values.length - 1];\n } catch (e) {\n }\n if (lastException) {\n if (lastException.value) {\n possibleMessages.push(lastException.value);\n if (lastException.type) {\n possibleMessages.push(`${lastException.type}: ${lastException.value}`);\n }\n }\n }\n if (DEBUG_BUILD && possibleMessages.length === 0) {\n logger.error(`Could not extract message for event ${getEventDescription(event)}`);\n }\n return possibleMessages;\n}\nfunction _isSentryError(event) {\n try {\n return event.exception.values[0].type === \"SentryError\";\n } catch (e) {\n }\n return false;\n}\nfunction _getLastValidUrl(frames = []) {\n for (let i = frames.length - 1; i >= 0; i--) {\n const frame = frames[i];\n if (frame && frame.filename !== \"\" && frame.filename !== \"[native code]\") {\n return frame.filename || null;\n }\n }\n return null;\n}\nfunction _getEventFilterUrl(event) {\n try {\n let frames;\n try {\n frames = event.exception.values[0].stacktrace.frames;\n } catch (e) {\n }\n return frames ? _getLastValidUrl(frames) : null;\n } catch (oO) {\n DEBUG_BUILD && logger.error(`Cannot extract url for event ${getEventDescription(event)}`);\n return null;\n }\n}\nexport { InboundFilters, inboundFiltersIntegration };\n","var __defProp = Object.defineProperty;\nvar __getOwnPropSymbols = Object.getOwnPropertySymbols;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __propIsEnum = Object.prototype.propertyIsEnumerable;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __spreadValues = (a, b) => {\n for (var prop in b || (b = {}))\n if (__hasOwnProp.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n if (__getOwnPropSymbols)\n for (var prop of __getOwnPropSymbols(b)) {\n if (__propIsEnum.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n }\n return a;\n};\nimport { dsnToString } from \"./dsn.js\";\nimport { normalize } from \"./normalize.js\";\nimport { dropUndefinedKeys } from \"./object.js\";\nfunction createEnvelope(headers, items = []) {\n return [headers, items];\n}\nfunction addItemToEnvelope(envelope, newItem) {\n const [headers, items] = envelope;\n return [headers, [...items, newItem]];\n}\nfunction forEachEnvelopeItem(envelope, callback) {\n const envelopeItems = envelope[1];\n for (const envelopeItem of envelopeItems) {\n const envelopeItemType = envelopeItem[0].type;\n const result = callback(envelopeItem, envelopeItemType);\n if (result) {\n return true;\n }\n }\n return false;\n}\nfunction envelopeContainsItemType(envelope, types) {\n return forEachEnvelopeItem(envelope, (_, type) => types.includes(type));\n}\nfunction encodeUTF8(input, textEncoder) {\n const utf8 = textEncoder || new TextEncoder();\n return utf8.encode(input);\n}\nfunction serializeEnvelope(envelope, textEncoder) {\n const [envHeaders, items] = envelope;\n let parts = JSON.stringify(envHeaders);\n function append(next) {\n if (typeof parts === \"string\") {\n parts = typeof next === \"string\" ? parts + next : [encodeUTF8(parts, textEncoder), next];\n } else {\n parts.push(typeof next === \"string\" ? encodeUTF8(next, textEncoder) : next);\n }\n }\n for (const item of items) {\n const [itemHeaders, payload] = item;\n append(`\n${JSON.stringify(itemHeaders)}\n`);\n if (typeof payload === \"string\" || payload instanceof Uint8Array) {\n append(payload);\n } else {\n let stringifiedPayload;\n try {\n stringifiedPayload = JSON.stringify(payload);\n } catch (e) {\n stringifiedPayload = JSON.stringify(normalize(payload));\n }\n append(stringifiedPayload);\n }\n }\n return typeof parts === \"string\" ? parts : concatBuffers(parts);\n}\nfunction concatBuffers(buffers) {\n const totalLength = buffers.reduce((acc, buf) => acc + buf.length, 0);\n const merged = new Uint8Array(totalLength);\n let offset = 0;\n for (const buffer of buffers) {\n merged.set(buffer, offset);\n offset += buffer.length;\n }\n return merged;\n}\nfunction parseEnvelope(env, textEncoder, textDecoder) {\n let buffer = typeof env === \"string\" ? textEncoder.encode(env) : env;\n function readBinary(length) {\n const bin = buffer.subarray(0, length);\n buffer = buffer.subarray(length + 1);\n return bin;\n }\n function readJson() {\n let i = buffer.indexOf(10);\n if (i < 0) {\n i = buffer.length;\n }\n return JSON.parse(textDecoder.decode(readBinary(i)));\n }\n const envelopeHeader = readJson();\n const items = [];\n while (buffer.length) {\n const itemHeader = readJson();\n const binaryLength = typeof itemHeader.length === \"number\" ? itemHeader.length : void 0;\n items.push([itemHeader, binaryLength ? readBinary(binaryLength) : readJson()]);\n }\n return [envelopeHeader, items];\n}\nfunction createAttachmentEnvelopeItem(attachment, textEncoder) {\n const buffer = typeof attachment.data === \"string\" ? encodeUTF8(attachment.data, textEncoder) : attachment.data;\n return [\n dropUndefinedKeys({\n type: \"attachment\",\n length: buffer.length,\n filename: attachment.filename,\n content_type: attachment.contentType,\n attachment_type: attachment.attachmentType\n }),\n buffer\n ];\n}\nconst ITEM_TYPE_TO_DATA_CATEGORY_MAP = {\n session: \"session\",\n sessions: \"session\",\n attachment: \"attachment\",\n transaction: \"transaction\",\n event: \"error\",\n client_report: \"internal\",\n user_report: \"default\",\n profile: \"profile\",\n replay_event: \"replay\",\n replay_recording: \"replay\",\n check_in: \"monitor\",\n feedback: \"feedback\",\n // TODO: This is a temporary workaround until we have a proper data category for metrics\n statsd: \"unknown\"\n};\nfunction envelopeItemTypeToDataCategory(type) {\n return ITEM_TYPE_TO_DATA_CATEGORY_MAP[type];\n}\nfunction getSdkMetadataForEnvelopeHeader(metadataOrEvent) {\n if (!metadataOrEvent || !metadataOrEvent.sdk) {\n return;\n }\n const { name, version } = metadataOrEvent.sdk;\n return { name, version };\n}\nfunction createEventEnvelopeHeaders(event, sdkInfo, tunnel, dsn) {\n const dynamicSamplingContext = event.sdkProcessingMetadata && event.sdkProcessingMetadata.dynamicSamplingContext;\n return __spreadValues(__spreadValues(__spreadValues({\n event_id: event.event_id,\n sent_at: new Date().toISOString()\n }, sdkInfo && { sdk: sdkInfo }), !!tunnel && dsn && { dsn: dsnToString(dsn) }), dynamicSamplingContext && {\n trace: dropUndefinedKeys(__spreadValues({}, dynamicSamplingContext))\n });\n}\nexport { addItemToEnvelope, createAttachmentEnvelopeItem, createEnvelope, createEventEnvelopeHeaders, envelopeContainsItemType, envelopeItemTypeToDataCategory, forEachEnvelopeItem, getSdkMetadataForEnvelopeHeader, parseEnvelope, serializeEnvelope };\n","import { dropUndefinedKeys } from \"@sentry/utils\";\nimport { NAME_AND_TAG_KEY_NORMALIZATION_REGEX, TAG_VALUE_NORMALIZATION_REGEX } from \"./constants.js\";\nfunction getBucketKey(metricType, name, unit, tags) {\n const stringifiedTags = Object.entries(dropUndefinedKeys(tags)).sort((a, b) => a[0].localeCompare(b[0]));\n return `${metricType}${name}${unit}${stringifiedTags}`;\n}\nfunction simpleHash(s) {\n let rv = 0;\n for (let i = 0; i < s.length; i++) {\n const c = s.charCodeAt(i);\n rv = (rv << 5) - rv + c;\n rv &= rv;\n }\n return rv >>> 0;\n}\nfunction serializeMetricBuckets(metricBucketItems) {\n let out = \"\";\n for (const item of metricBucketItems) {\n const tagEntries = Object.entries(item.tags);\n const maybeTags = tagEntries.length > 0 ? `|#${tagEntries.map(([key, value]) => `${key}:${value}`).join(\",\")}` : \"\";\n out += `${item.name}@${item.unit}:${item.metric}|${item.metricType}${maybeTags}|T${item.timestamp}\n`;\n }\n return out;\n}\nfunction sanitizeTags(unsanitizedTags) {\n const tags = {};\n for (const key in unsanitizedTags) {\n if (Object.prototype.hasOwnProperty.call(unsanitizedTags, key)) {\n const sanitizedKey = key.replace(NAME_AND_TAG_KEY_NORMALIZATION_REGEX, \"_\");\n tags[sanitizedKey] = String(unsanitizedTags[key]).replace(TAG_VALUE_NORMALIZATION_REGEX, \"_\");\n }\n }\n return tags;\n}\nexport { getBucketKey, sanitizeTags, serializeMetricBuckets, simpleHash };\n","var __defProp = Object.defineProperty;\nvar __defProps = Object.defineProperties;\nvar __getOwnPropDescs = Object.getOwnPropertyDescriptors;\nvar __getOwnPropSymbols = Object.getOwnPropertySymbols;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __propIsEnum = Object.prototype.propertyIsEnumerable;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __spreadValues = (a, b) => {\n for (var prop in b || (b = {}))\n if (__hasOwnProp.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n if (__getOwnPropSymbols)\n for (var prop of __getOwnPropSymbols(b)) {\n if (__propIsEnum.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n }\n return a;\n};\nvar __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));\nimport { makeDsn, logger, checkOrSetAlreadyCaught, isParameterizedString, isPrimitive, resolvedSyncPromise, addItemToEnvelope, createAttachmentEnvelopeItem, SyncPromise, rejectedSyncPromise, SentryError, isThenable, isPlainObject } from \"@sentry/utils\";\nimport { getEnvelopeEndpointWithUrlEncodedAuth } from \"./api.js\";\nimport { DEBUG_BUILD } from \"./debug-build.js\";\nimport { createEventEnvelope, createSessionEnvelope } from \"./envelope.js\";\nimport { getClient } from \"./exports.js\";\nimport { getIsolationScope } from \"./hub.js\";\nimport { setupIntegration, setupIntegrations } from \"./integration.js\";\nimport { createMetricEnvelope } from \"./metrics/envelope.js\";\nimport { updateSession } from \"./session.js\";\nimport { getDynamicSamplingContextFromClient } from \"./tracing/dynamicSamplingContext.js\";\nimport { prepareEvent } from \"./utils/prepareEvent.js\";\nconst ALREADY_SEEN_ERROR = \"Not capturing exception because it's already been captured.\";\nclass BaseClient {\n /**\n * A reference to a metrics aggregator\n *\n * @experimental Note this is alpha API. It may experience breaking changes in the future.\n */\n /** Options passed to the SDK. */\n /** The client Dsn, if specified in options. Without this Dsn, the SDK will be disabled. */\n /** Array of set up integrations. */\n /** Indicates whether this client's integrations have been set up. */\n /** Number of calls being processed */\n /** Holds flushable */\n // eslint-disable-next-line @typescript-eslint/ban-types\n /**\n * Initializes this client instance.\n *\n * @param options Options for the client.\n */\n constructor(options) {\n this._options = options;\n this._integrations = {};\n this._integrationsInitialized = false;\n this._numProcessing = 0;\n this._outcomes = {};\n this._hooks = {};\n this._eventProcessors = [];\n if (options.dsn) {\n this._dsn = makeDsn(options.dsn);\n } else {\n DEBUG_BUILD && logger.warn(\"No DSN provided, client will not send events.\");\n }\n if (this._dsn) {\n const url = getEnvelopeEndpointWithUrlEncodedAuth(this._dsn, options);\n this._transport = options.transport(__spreadProps(__spreadValues({\n recordDroppedEvent: this.recordDroppedEvent.bind(this)\n }, options.transportOptions), {\n url\n }));\n }\n }\n /**\n * @inheritDoc\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\n captureException(exception, hint, scope) {\n if (checkOrSetAlreadyCaught(exception)) {\n DEBUG_BUILD && logger.log(ALREADY_SEEN_ERROR);\n return;\n }\n let eventId = hint && hint.event_id;\n this._process(\n this.eventFromException(exception, hint).then((event) => this._captureEvent(event, hint, scope)).then((result) => {\n eventId = result;\n })\n );\n return eventId;\n }\n /**\n * @inheritDoc\n */\n captureMessage(message, level, hint, scope) {\n let eventId = hint && hint.event_id;\n const eventMessage = isParameterizedString(message) ? message : String(message);\n const promisedEvent = isPrimitive(message) ? this.eventFromMessage(eventMessage, level, hint) : this.eventFromException(message, hint);\n this._process(\n promisedEvent.then((event) => this._captureEvent(event, hint, scope)).then((result) => {\n eventId = result;\n })\n );\n return eventId;\n }\n /**\n * @inheritDoc\n */\n captureEvent(event, hint, scope) {\n if (hint && hint.originalException && checkOrSetAlreadyCaught(hint.originalException)) {\n DEBUG_BUILD && logger.log(ALREADY_SEEN_ERROR);\n return;\n }\n let eventId = hint && hint.event_id;\n this._process(\n this._captureEvent(event, hint, scope).then((result) => {\n eventId = result;\n })\n );\n return eventId;\n }\n /**\n * @inheritDoc\n */\n captureSession(session) {\n if (!(typeof session.release === \"string\")) {\n DEBUG_BUILD && logger.warn(\"Discarded session because of missing or non-string release\");\n } else {\n this.sendSession(session);\n updateSession(session, { init: false });\n }\n }\n /**\n * @inheritDoc\n */\n getDsn() {\n return this._dsn;\n }\n /**\n * @inheritDoc\n */\n getOptions() {\n return this._options;\n }\n /**\n * @see SdkMetadata in @sentry/types\n *\n * @return The metadata of the SDK\n */\n getSdkMetadata() {\n return this._options._metadata;\n }\n /**\n * @inheritDoc\n */\n getTransport() {\n return this._transport;\n }\n /**\n * @inheritDoc\n */\n flush(timeout) {\n const transport = this._transport;\n if (transport) {\n if (this.metricsAggregator) {\n this.metricsAggregator.flush();\n }\n return this._isClientDoneProcessing(timeout).then((clientFinished) => {\n return transport.flush(timeout).then((transportFlushed) => clientFinished && transportFlushed);\n });\n } else {\n return resolvedSyncPromise(true);\n }\n }\n /**\n * @inheritDoc\n */\n close(timeout) {\n return this.flush(timeout).then((result) => {\n this.getOptions().enabled = false;\n if (this.metricsAggregator) {\n this.metricsAggregator.close();\n }\n return result;\n });\n }\n /** Get all installed event processors. */\n getEventProcessors() {\n return this._eventProcessors;\n }\n /** @inheritDoc */\n addEventProcessor(eventProcessor) {\n this._eventProcessors.push(eventProcessor);\n }\n /**\n * This is an internal function to setup all integrations that should run on the client.\n * @deprecated Use `client.init()` instead.\n */\n setupIntegrations(forceInitialize) {\n if (forceInitialize && !this._integrationsInitialized || this._isEnabled() && !this._integrationsInitialized) {\n this._setupIntegrations();\n }\n }\n /** @inheritdoc */\n init() {\n if (this._isEnabled()) {\n this._setupIntegrations();\n }\n }\n /**\n * Gets an installed integration by its `id`.\n *\n * @returns The installed integration or `undefined` if no integration with that `id` was installed.\n * @deprecated Use `getIntegrationByName()` instead.\n */\n getIntegrationById(integrationId) {\n return this.getIntegrationByName(integrationId);\n }\n /**\n * Gets an installed integration by its name.\n *\n * @returns The installed integration or `undefined` if no integration with that `name` was installed.\n */\n getIntegrationByName(integrationName) {\n return this._integrations[integrationName];\n }\n /**\n * Returns the client's instance of the given integration class, it any.\n * @deprecated Use `getIntegrationByName()` instead.\n */\n getIntegration(integration) {\n try {\n return this._integrations[integration.id] || null;\n } catch (_oO) {\n DEBUG_BUILD && logger.warn(`Cannot retrieve integration ${integration.id} from the current Client`);\n return null;\n }\n }\n /**\n * @inheritDoc\n */\n addIntegration(integration) {\n setupIntegration(this, integration, this._integrations);\n }\n /**\n * @inheritDoc\n */\n sendEvent(event, hint = {}) {\n this.emit(\"beforeSendEvent\", event, hint);\n let env = createEventEnvelope(event, this._dsn, this._options._metadata, this._options.tunnel);\n for (const attachment of hint.attachments || []) {\n env = addItemToEnvelope(\n env,\n createAttachmentEnvelopeItem(\n attachment,\n this._options.transportOptions && this._options.transportOptions.textEncoder\n )\n );\n }\n const promise = this._sendEnvelope(env);\n if (promise) {\n promise.then((sendResponse) => this.emit(\"afterSendEvent\", event, sendResponse), null);\n }\n }\n /**\n * @inheritDoc\n */\n sendSession(session) {\n const env = createSessionEnvelope(session, this._dsn, this._options._metadata, this._options.tunnel);\n this._sendEnvelope(env);\n }\n /**\n * @inheritDoc\n */\n recordDroppedEvent(reason, category, _event) {\n if (this._options.sendClientReports) {\n const key = `${reason}:${category}`;\n DEBUG_BUILD && logger.log(`Adding outcome: \"${key}\"`);\n this._outcomes[key] = this._outcomes[key] + 1 || 1;\n }\n }\n /**\n * @inheritDoc\n */\n captureAggregateMetrics(metricBucketItems) {\n DEBUG_BUILD && logger.log(`Flushing aggregated metrics, number of metrics: ${metricBucketItems.length}`);\n const metricsEnvelope = createMetricEnvelope(\n metricBucketItems,\n this._dsn,\n this._options._metadata,\n this._options.tunnel\n );\n this._sendEnvelope(metricsEnvelope);\n }\n // Keep on() & emit() signatures in sync with types' client.ts interface\n /* eslint-disable @typescript-eslint/unified-signatures */\n /** @inheritdoc */\n /** @inheritdoc */\n on(hook, callback) {\n if (!this._hooks[hook]) {\n this._hooks[hook] = [];\n }\n this._hooks[hook].push(callback);\n }\n /** @inheritdoc */\n /** @inheritdoc */\n emit(hook, ...rest) {\n if (this._hooks[hook]) {\n this._hooks[hook].forEach((callback) => callback(...rest));\n }\n }\n /* eslint-enable @typescript-eslint/unified-signatures */\n /** Setup integrations for this client. */\n _setupIntegrations() {\n this._integrations = setupIntegrations(this, this._options.integrations);\n this._integrationsInitialized = true;\n }\n /** Updates existing session based on the provided event */\n _updateSessionFromEvent(session, event) {\n let crashed = false;\n let errored = false;\n const exceptions = event.exception && event.exception.values;\n if (exceptions) {\n errored = true;\n for (const ex of exceptions) {\n const mechanism = ex.mechanism;\n if (mechanism && mechanism.handled === false) {\n crashed = true;\n break;\n }\n }\n }\n const sessionNonTerminal = session.status === \"ok\";\n const shouldUpdateAndSend = sessionNonTerminal && session.errors === 0 || sessionNonTerminal && crashed;\n if (shouldUpdateAndSend) {\n updateSession(session, __spreadProps(__spreadValues({}, crashed && { status: \"crashed\" }), {\n errors: session.errors || Number(errored || crashed)\n }));\n this.captureSession(session);\n }\n }\n /**\n * Determine if the client is finished processing. Returns a promise because it will wait `timeout` ms before saying\n * \"no\" (resolving to `false`) in order to give the client a chance to potentially finish first.\n *\n * @param timeout The time, in ms, after which to resolve to `false` if the client is still busy. Passing `0` (or not\n * passing anything) will make the promise wait as long as it takes for processing to finish before resolving to\n * `true`.\n * @returns A promise which will resolve to `true` if processing is already done or finishes before the timeout, and\n * `false` otherwise\n */\n _isClientDoneProcessing(timeout) {\n return new SyncPromise((resolve) => {\n let ticked = 0;\n const tick = 1;\n const interval = setInterval(() => {\n if (this._numProcessing == 0) {\n clearInterval(interval);\n resolve(true);\n } else {\n ticked += tick;\n if (timeout && ticked >= timeout) {\n clearInterval(interval);\n resolve(false);\n }\n }\n }, tick);\n });\n }\n /** Determines whether this SDK is enabled and a transport is present. */\n _isEnabled() {\n return this.getOptions().enabled !== false && this._transport !== void 0;\n }\n /**\n * Adds common information to events.\n *\n * The information includes release and environment from `options`,\n * breadcrumbs and context (extra, tags and user) from the scope.\n *\n * Information that is already present in the event is never overwritten. For\n * nested objects, such as the context, keys are merged.\n *\n * @param event The original event.\n * @param hint May contain additional information about the original exception.\n * @param scope A scope containing event metadata.\n * @returns A new event with more information.\n */\n _prepareEvent(event, hint, scope, isolationScope = getIsolationScope()) {\n const options = this.getOptions();\n const integrations = Object.keys(this._integrations);\n if (!hint.integrations && integrations.length > 0) {\n hint.integrations = integrations;\n }\n this.emit(\"preprocessEvent\", event, hint);\n return prepareEvent(options, event, hint, scope, this, isolationScope).then((evt) => {\n if (evt === null) {\n return evt;\n }\n const { propagationContext } = evt.sdkProcessingMetadata || {};\n const trace = evt.contexts && evt.contexts.trace;\n if (!trace && propagationContext) {\n const { traceId: trace_id, spanId, parentSpanId, dsc } = propagationContext;\n evt.contexts = __spreadValues({\n trace: {\n trace_id,\n span_id: spanId,\n parent_span_id: parentSpanId\n }\n }, evt.contexts);\n const dynamicSamplingContext = dsc ? dsc : getDynamicSamplingContextFromClient(trace_id, this, scope);\n evt.sdkProcessingMetadata = __spreadValues({\n dynamicSamplingContext\n }, evt.sdkProcessingMetadata);\n }\n return evt;\n });\n }\n /**\n * Processes the event and logs an error in case of rejection\n * @param event\n * @param hint\n * @param scope\n */\n _captureEvent(event, hint = {}, scope) {\n return this._processEvent(event, hint, scope).then(\n (finalEvent) => {\n return finalEvent.event_id;\n },\n (reason) => {\n if (DEBUG_BUILD) {\n const sentryError = reason;\n if (sentryError.logLevel === \"log\") {\n logger.log(sentryError.message);\n } else {\n logger.warn(sentryError);\n }\n }\n return void 0;\n }\n );\n }\n /**\n * Processes an event (either error or message) and sends it to Sentry.\n *\n * This also adds breadcrumbs and context information to the event. However,\n * platform specific meta data (such as the User's IP address) must be added\n * by the SDK implementor.\n *\n *\n * @param event The event to send to Sentry.\n * @param hint May contain additional information about the original exception.\n * @param scope A scope containing event metadata.\n * @returns A SyncPromise that resolves with the event or rejects in case event was/will not be send.\n */\n _processEvent(event, hint, scope) {\n const options = this.getOptions();\n const { sampleRate } = options;\n const isTransaction = isTransactionEvent(event);\n const isError = isErrorEvent(event);\n const eventType = event.type || \"error\";\n const beforeSendLabel = `before send for type \\`${eventType}\\``;\n if (isError && typeof sampleRate === \"number\" && Math.random() > sampleRate) {\n this.recordDroppedEvent(\"sample_rate\", \"error\", event);\n return rejectedSyncPromise(\n new SentryError(\n `Discarding event because it's not included in the random sample (sampling rate = ${sampleRate})`,\n \"log\"\n )\n );\n }\n const dataCategory = eventType === \"replay_event\" ? \"replay\" : eventType;\n return this._prepareEvent(event, hint, scope).then((prepared) => {\n if (prepared === null) {\n this.recordDroppedEvent(\"event_processor\", dataCategory, event);\n throw new SentryError(\"An event processor returned `null`, will not send event.\", \"log\");\n }\n const isInternalException = hint.data && hint.data.__sentry__ === true;\n if (isInternalException) {\n return prepared;\n }\n const result = processBeforeSend(options, prepared, hint);\n return _validateBeforeSendResult(result, beforeSendLabel);\n }).then((processedEvent) => {\n if (processedEvent === null) {\n this.recordDroppedEvent(\"before_send\", dataCategory, event);\n throw new SentryError(`${beforeSendLabel} returned \\`null\\`, will not send event.`, \"log\");\n }\n const session = scope && scope.getSession();\n if (!isTransaction && session) {\n this._updateSessionFromEvent(session, processedEvent);\n }\n const transactionInfo = processedEvent.transaction_info;\n if (isTransaction && transactionInfo && processedEvent.transaction !== event.transaction) {\n const source = \"custom\";\n processedEvent.transaction_info = __spreadProps(__spreadValues({}, transactionInfo), {\n source\n });\n }\n this.sendEvent(processedEvent, hint);\n return processedEvent;\n }).then(null, (reason) => {\n if (reason instanceof SentryError) {\n throw reason;\n }\n this.captureException(reason, {\n data: {\n __sentry__: true\n },\n originalException: reason\n });\n throw new SentryError(\n `Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${reason}`\n );\n });\n }\n /**\n * Occupies the client with processing and event\n */\n _process(promise) {\n this._numProcessing++;\n void promise.then(\n (value) => {\n this._numProcessing--;\n return value;\n },\n (reason) => {\n this._numProcessing--;\n return reason;\n }\n );\n }\n /**\n * @inheritdoc\n */\n _sendEnvelope(envelope) {\n this.emit(\"beforeEnvelope\", envelope);\n if (this._isEnabled() && this._transport) {\n return this._transport.send(envelope).then(null, (reason) => {\n DEBUG_BUILD && logger.error(\"Error while sending event:\", reason);\n });\n } else {\n DEBUG_BUILD && logger.error(\"Transport disabled\");\n }\n }\n /**\n * Clears outcomes on this client and returns them.\n */\n _clearOutcomes() {\n const outcomes = this._outcomes;\n this._outcomes = {};\n return Object.keys(outcomes).map((key) => {\n const [reason, category] = key.split(\":\");\n return {\n reason,\n category,\n quantity: outcomes[key]\n };\n });\n }\n /**\n * @inheritDoc\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\n}\nfunction _validateBeforeSendResult(beforeSendResult, beforeSendLabel) {\n const invalidValueError = `${beforeSendLabel} must return \\`null\\` or a valid event.`;\n if (isThenable(beforeSendResult)) {\n return beforeSendResult.then(\n (event) => {\n if (!isPlainObject(event) && event !== null) {\n throw new SentryError(invalidValueError);\n }\n return event;\n },\n (e) => {\n throw new SentryError(`${beforeSendLabel} rejected with ${e}`);\n }\n );\n } else if (!isPlainObject(beforeSendResult) && beforeSendResult !== null) {\n throw new SentryError(invalidValueError);\n }\n return beforeSendResult;\n}\nfunction processBeforeSend(options, event, hint) {\n const { beforeSend, beforeSendTransaction } = options;\n if (isErrorEvent(event) && beforeSend) {\n return beforeSend(event, hint);\n }\n if (isTransactionEvent(event) && beforeSendTransaction) {\n return beforeSendTransaction(event, hint);\n }\n return event;\n}\nfunction isErrorEvent(event) {\n return event.type === void 0;\n}\nfunction isTransactionEvent(event) {\n return event.type === \"transaction\";\n}\nfunction addEventProcessor(callback) {\n const client = getClient();\n if (!client || !client.addEventProcessor) {\n return;\n }\n client.addEventProcessor(callback);\n}\nexport { BaseClient, addEventProcessor };\n","import { logger, getFunctionName } from \"@sentry/utils\";\nimport { DEBUG_BUILD } from \"../common/debug-build.js\";\nimport { onCLS } from \"./web-vitals/getCLS.js\";\nimport { onFID } from \"./web-vitals/getFID.js\";\nimport { onLCP } from \"./web-vitals/getLCP.js\";\nimport { observe } from \"./web-vitals/lib/observe.js\";\nconst handlers = {};\nconst instrumented = {};\nlet _previousCls;\nlet _previousFid;\nlet _previousLcp;\nfunction addClsInstrumentationHandler(callback) {\n return addMetricObserver(\"cls\", callback, instrumentCls, _previousCls);\n}\nfunction addLcpInstrumentationHandler(callback) {\n return addMetricObserver(\"lcp\", callback, instrumentLcp, _previousLcp);\n}\nfunction addFidInstrumentationHandler(callback) {\n return addMetricObserver(\"fid\", callback, instrumentFid, _previousFid);\n}\nfunction addPerformanceInstrumentationHandler(type, callback) {\n addHandler(type, callback);\n if (!instrumented[type]) {\n instrumentPerformanceObserver(type);\n instrumented[type] = true;\n }\n return getCleanupCallback(type, callback);\n}\nfunction triggerHandlers(type, data) {\n const typeHandlers = handlers[type];\n if (!typeHandlers || !typeHandlers.length) {\n return;\n }\n for (const handler of typeHandlers) {\n try {\n handler(data);\n } catch (e) {\n DEBUG_BUILD && logger.error(\n `Error while triggering instrumentation handler.\nType: ${type}\nName: ${getFunctionName(handler)}\nError:`,\n e\n );\n }\n }\n}\nfunction instrumentCls() {\n onCLS((metric) => {\n triggerHandlers(\"cls\", {\n metric\n });\n _previousCls = metric;\n });\n}\nfunction instrumentFid() {\n onFID((metric) => {\n triggerHandlers(\"fid\", {\n metric\n });\n _previousFid = metric;\n });\n}\nfunction instrumentLcp() {\n onLCP((metric) => {\n triggerHandlers(\"lcp\", {\n metric\n });\n _previousLcp = metric;\n });\n}\nfunction addMetricObserver(type, callback, instrumentFn, previousValue) {\n addHandler(type, callback);\n if (!instrumented[type]) {\n instrumentFn();\n instrumented[type] = true;\n }\n if (previousValue) {\n callback({ metric: previousValue });\n }\n return getCleanupCallback(type, callback);\n}\nfunction instrumentPerformanceObserver(type) {\n const options = {};\n if (type === \"event\") {\n options.durationThreshold = 0;\n }\n observe(\n type,\n (entries) => {\n triggerHandlers(type, { entries });\n },\n options\n );\n}\nfunction addHandler(type, handler) {\n handlers[type] = handlers[type] || [];\n handlers[type].push(handler);\n}\nfunction getCleanupCallback(type, callback) {\n return () => {\n const typeHandlers = handlers[type];\n if (!typeHandlers) {\n return;\n }\n const index = typeHandlers.indexOf(callback);\n if (index !== -1) {\n typeHandlers.splice(index, 1);\n }\n };\n}\nexport { addClsInstrumentationHandler, addFidInstrumentationHandler, addLcpInstrumentationHandler, addPerformanceInstrumentationHandler };\n","import * as Sentry from \"@sentry/browser\";\nimport { BrowserTracing } from \"@sentry/tracing\";\nSentry.init({\n dsn: \"https://85a2460d54d24846963a314a247a790a@o1090356.ingest.sentry.io/4504576077004800\",\n integrations: [new BrowserTracing()],\n tracesSampleRate: 1e-3,\n ignoreErrors: [\n \"top.GLOBALS\",\n // Random plugins/extensions\n \"VK is\",\n \"VK.Retargeting is \",\n \"Can't find variable: VK\",\n \"pktAnnotationHighlighter\",\n \"Unexpected keyword\",\n \"illegal character\",\n \"Unexpected identifier\",\n \"Illegal invocation\",\n \"missing = in const declaration\"\n ],\n allowUrls: [\"cv.hexlet.io\"],\n beforeSend(event, hint) {\n var _a;\n const stack = ((_a = hint == null ? void 0 : hint.originalException) == null ? void 0 : _a.stack) || \"\";\n const errorInitiator = stack.split(\"\\n\").map((line) => line.trim()).find((line) => line.startsWith(\"at\"));\n const causedByConsole = errorInitiator ? errorInitiator.includes(\":\") : false;\n return causedByConsole ? null : event;\n }\n});\n"],"names":[],"sourceRoot":""}