{"version":3,"file":"bundle.min.js","sources":["../../types/dist/index.js","../../utils/is.js","../../utils/misc.js","../../core/dist/logger.js","../../utils/object.js","../../hub/dist/scope.js","../../hub/dist/hub.js","../../hub/dist/index.js","../../minimal/dist/index.js","../../core/dist/error.js","../../core/dist/dsn.js","../../core/dist/api.js","../../utils/async.js","../../utils/string.js","../../core/dist/baseclient.js","../../core/dist/requestbuffer.js","../../core/dist/basebackend.js","../../core/dist/interfaces.js","../../core/dist/sdk.js","../../core/dist/integrations/dedupe.js","../../core/dist/integrations/functiontostring.js","../../core/dist/integrations/sdkinformation.js","../../core/dist/integrations/inboundfilters.js","../../core/dist/integrations/pluggable/debug.js","../../utils/path.js","../../core/dist/integrations/pluggable/rewriteframes.js","../../core/dist/integrations/index.js","../../core/dist/index.js","../../utils/supports.js","../src/md5.ts","../src/tracekit.ts","../src/parsers.ts","../src/transports/base.ts","../src/integrations/helpers.ts","../src/transports/fetch.ts","../src/transports/xhr.ts","../src/transports/beacon.ts","../src/backend.ts","../src/version.ts","../src/client.ts","../src/integrations/globalhandlers.ts","../src/integrations/breadcrumbs.ts","../src/integrations/trycatch.ts","../src/integrations/reportingobserver.ts","../src/integrations/linkederrors.ts","../src/integrations/useragent.ts","../src/integrations/pluggable/ember.ts","../src/integrations/pluggable/vue.ts","../src/sdk.ts","../src/index.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/** JSDoc */\nvar Severity;\n(function (Severity) {\n /** JSDoc */\n Severity[\"Fatal\"] = \"fatal\";\n /** JSDoc */\n Severity[\"Error\"] = \"error\";\n /** JSDoc */\n Severity[\"Warning\"] = \"warning\";\n /** JSDoc */\n Severity[\"Log\"] = \"log\";\n /** JSDoc */\n Severity[\"Info\"] = \"info\";\n /** JSDoc */\n Severity[\"Debug\"] = \"debug\";\n /** JSDoc */\n Severity[\"Critical\"] = \"critical\";\n})(Severity = exports.Severity || (exports.Severity = {}));\n// tslint:disable:no-unnecessary-qualifier no-namespace\n(function (Severity) {\n /**\n * Converts a string-based level into a {@link Severity}.\n *\n * @param level string representation of Severity\n * @returns Severity\n */\n function fromString(level) {\n switch (level) {\n case 'debug':\n return Severity.Debug;\n case 'info':\n return Severity.Info;\n case 'warn':\n case 'warning':\n return Severity.Warning;\n case 'error':\n return Severity.Error;\n case 'fatal':\n return Severity.Fatal;\n case 'critical':\n return Severity.Critical;\n case 'log':\n default:\n return Severity.Log;\n }\n }\n Severity.fromString = fromString;\n})(Severity = exports.Severity || (exports.Severity = {}));\n/** The status of an event. */\nvar Status;\n(function (Status) {\n /** The status could not be determined. */\n Status[\"Unknown\"] = \"unknown\";\n /** The event was skipped due to configuration or callbacks. */\n Status[\"Skipped\"] = \"skipped\";\n /** The event was sent to Sentry successfully. */\n Status[\"Success\"] = \"success\";\n /** The client is currently rate limited and will try again later. */\n Status[\"RateLimit\"] = \"rate_limit\";\n /** The event could not be processed. */\n Status[\"Invalid\"] = \"invalid\";\n /** A server-side error ocurred during submission. */\n Status[\"Failed\"] = \"failed\";\n})(Status = exports.Status || (exports.Status = {}));\n// tslint:disable:no-unnecessary-qualifier no-namespace\n(function (Status) {\n /**\n * Converts a HTTP status code into a {@link Status}.\n *\n * @param code The HTTP response status code.\n * @returns The send status or {@link Status.Unknown}.\n */\n function fromHttpCode(code) {\n if (code >= 200 && code < 300) {\n return Status.Success;\n }\n if (code === 429) {\n return Status.RateLimit;\n }\n if (code >= 400 && code < 500) {\n return Status.Invalid;\n }\n if (code >= 500) {\n return Status.Failed;\n }\n return Status.Unknown;\n }\n Status.fromHttpCode = fromHttpCode;\n})(Status = exports.Status || (exports.Status = {}));\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/**\n * Checks whether given value's type is one of a few Error or Error-like\n * {@link isError}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nfunction isError(wat) {\n switch (Object.prototype.toString.call(wat)) {\n case '[object Error]':\n return true;\n case '[object Exception]':\n return true;\n case '[object DOMException]':\n return true;\n default:\n return wat instanceof Error;\n }\n}\nexports.isError = isError;\n/**\n * Checks whether given value's type is ErrorEvent\n * {@link isErrorEvent}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nfunction isErrorEvent(wat) {\n return Object.prototype.toString.call(wat) === '[object ErrorEvent]';\n}\nexports.isErrorEvent = isErrorEvent;\n/**\n * Checks whether given value's type is DOMError\n * {@link isDOMError}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nfunction isDOMError(wat) {\n return Object.prototype.toString.call(wat) === '[object DOMError]';\n}\nexports.isDOMError = isDOMError;\n/**\n * Checks whether given value's type is DOMException\n * {@link isDOMException}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nfunction isDOMException(wat) {\n return Object.prototype.toString.call(wat) === '[object DOMException]';\n}\nexports.isDOMException = isDOMException;\n/**\n * Checks whether given value's type is an undefined\n * {@link isUndefined}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nfunction isUndefined(wat) {\n return wat === void 0;\n}\nexports.isUndefined = isUndefined;\n/**\n * Checks whether given value's type is a function\n * {@link isFunction}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nfunction isFunction(wat) {\n return typeof wat === 'function';\n}\nexports.isFunction = isFunction;\n/**\n * Checks whether given value's type is a string\n * {@link isString}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nfunction isString(wat) {\n return Object.prototype.toString.call(wat) === '[object String]';\n}\nexports.isString = isString;\n/**\n * Checks whether given value's type is an array\n * {@link isArray}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nfunction isArray(wat) {\n return Object.prototype.toString.call(wat) === '[object Array]';\n}\nexports.isArray = isArray;\n/**\n * Checks whether given value's type is an object literal\n * {@link isPlainObject}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nfunction isPlainObject(wat) {\n return Object.prototype.toString.call(wat) === '[object Object]';\n}\nexports.isPlainObject = isPlainObject;\n/**\n * Checks whether given value's type is an regexp\n * {@link isRegExp}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nfunction isRegExp(wat) {\n return Object.prototype.toString.call(wat) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\n/**\n * Checks whether given value's type is a NaN\n * {@link isNaN}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nfunction isNaN(wat) {\n return wat !== wat;\n}\nexports.isNaN = isNaN;\n//# sourceMappingURL=is.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar is_1 = require(\"./is\");\n/**\n * Checks whether we're in the Node.js or Browser environment\n *\n * @returns Answer to given question\n */\nfunction isNodeEnv() {\n // tslint:disable:strict-type-predicates\n return Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]';\n}\nexports.isNodeEnv = isNodeEnv;\n/**\n * Safely get global scope object\n *\n * @returns Global scope object\n */\n// tslint:disable:strict-type-predicates\nfunction getGlobalObject() {\n return isNodeEnv() ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {};\n}\nexports.getGlobalObject = getGlobalObject;\n/**\n * UUID4 generator\n *\n * @returns string Generated UUID4.\n */\nfunction uuid4() {\n var global = getGlobalObject();\n var crypto = global.crypto || global.msCrypto;\n if (!(crypto === void 0) && crypto.getRandomValues) {\n // Use window.crypto API if available\n var arr = new Uint16Array(8);\n crypto.getRandomValues(arr);\n // set 4 in byte 7\n // tslint:disable-next-line:no-bitwise\n arr[3] = (arr[3] & 0xfff) | 0x4000;\n // set 2 most significant bits of byte 9 to '10'\n // tslint:disable-next-line:no-bitwise\n arr[4] = (arr[4] & 0x3fff) | 0x8000;\n var pad = function (num) {\n var v = num.toString(16);\n while (v.length < 4) {\n v = \"0\" + v;\n }\n return v;\n };\n return (pad(arr[0]) + pad(arr[1]) + pad(arr[2]) + pad(arr[3]) + pad(arr[4]) + pad(arr[5]) + pad(arr[6]) + pad(arr[7]));\n }\n else {\n // http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#2117523\n return 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n // tslint:disable-next-line:no-bitwise\n var r = (Math.random() * 16) | 0;\n // tslint:disable-next-line:no-bitwise\n var v = c === 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n }\n}\nexports.uuid4 = uuid4;\n/**\n * Given a child DOM element, returns a query-selector statement describing that\n * and its ancestors\n * e.g. [HTMLElement] => body > div > input#foo.btn[name=baz]\n * @returns generated DOM path\n */\nfunction htmlTreeAsString(elem) {\n var currentElem = elem;\n var MAX_TRAVERSE_HEIGHT = 5;\n var MAX_OUTPUT_LEN = 80;\n var out = [];\n var height = 0;\n var len = 0;\n var separator = ' > ';\n var sepLength = separator.length;\n var nextStr;\n while (currentElem && height++ < MAX_TRAVERSE_HEIGHT) {\n nextStr = htmlElementAsString(currentElem);\n // bail out if\n // - nextStr is the 'html' element\n // - the length of the string that would be created exceeds MAX_OUTPUT_LEN\n // (ignore this limit if we are on the first iteration)\n if (nextStr === 'html' || (height > 1 && len + out.length * sepLength + nextStr.length >= MAX_OUTPUT_LEN)) {\n break;\n }\n out.push(nextStr);\n len += nextStr.length;\n currentElem = currentElem.parentNode;\n }\n return out.reverse().join(separator);\n}\nexports.htmlTreeAsString = htmlTreeAsString;\n/**\n * Returns a simple, query-selector representation of a DOM element\n * e.g. [HTMLElement] => input#foo.btn[name=baz]\n * @returns generated DOM path\n */\nfunction htmlElementAsString(elem) {\n var out = [];\n var className;\n var classes;\n var key;\n var attr;\n var i;\n if (!elem || !elem.tagName) {\n return '';\n }\n out.push(elem.tagName.toLowerCase());\n if (elem.id) {\n out.push(\"#\" + elem.id);\n }\n className = elem.className;\n if (className && is_1.isString(className)) {\n classes = className.split(/\\s+/);\n for (i = 0; i < classes.length; i++) {\n out.push(\".\" + classes[i]);\n }\n }\n var attrWhitelist = ['type', 'name', 'title', 'alt'];\n for (i = 0; i < attrWhitelist.length; i++) {\n key = attrWhitelist[i];\n attr = elem.getAttribute(key);\n if (attr) {\n out.push(\"[\" + key + \"=\\\"\" + attr + \"\\\"]\");\n }\n }\n return out.join('');\n}\nexports.htmlElementAsString = htmlElementAsString;\n/**\n * Parses string form of URL into an object\n * // borrowed from https://tools.ietf.org/html/rfc3986#appendix-B\n * // intentionally using regex and not href parsing trick because React Native and other\n * // environments where DOM might not be available\n * @returns parsed URL object\n */\nfunction parseUrl(url) {\n if (!url) {\n return {};\n }\n var match = url.match(/^(([^:\\/?#]+):)?(\\/\\/([^\\/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$/);\n if (!match) {\n return {};\n }\n // coerce to undefined values to empty string so we don't get 'undefined'\n var query = match[6] || '';\n var fragment = match[8] || '';\n return {\n host: match[4],\n path: match[5],\n protocol: match[2],\n relative: match[5] + query + fragment,\n };\n}\nexports.parseUrl = parseUrl;\n/**\n * Extracts either message or type+value from an event that can be used for user-facing logs\n * @returns event's description\n */\nfunction getEventDescription(event) {\n if (event.message) {\n return event.message;\n }\n else if (event.exception && event.exception.values && event.exception.values[0]) {\n var exception = event.exception.values[0];\n if (exception.type && exception.value) {\n return exception.type + \": \" + exception.value;\n }\n else {\n return exception.type || exception.value || event.event_id || '';\n }\n }\n else {\n return event.event_id || '';\n }\n}\nexports.getEventDescription = getEventDescription;\n//# sourceMappingURL=misc.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar misc_1 = require(\"@sentry/utils/misc\");\n// TODO: Implement different loggers for different environments\nvar global = misc_1.getGlobalObject();\n/** JSDoc */\nvar Logger = /** @class */ (function () {\n /** JSDoc */\n function Logger() {\n this.console = global.console;\n this.disabled = true;\n }\n /** JSDoc */\n Logger.prototype.disable = function () {\n this.disabled = true;\n };\n /** JSDoc */\n Logger.prototype.enable = function () {\n this.disabled = false;\n };\n /** JSDoc */\n Logger.prototype.log = function (message) {\n if (this.disabled) {\n return;\n }\n this.console.log(\"Sentry Logger [Log]: \" + message); // tslint:disable-line:no-console\n };\n /** JSDoc */\n Logger.prototype.warn = function (message) {\n if (this.disabled) {\n return;\n }\n this.console.warn(\"Sentry Logger [Warn]: \" + message); // tslint:disable-line:no-console\n };\n /** JSDoc */\n Logger.prototype.error = function (message) {\n if (this.disabled) {\n return;\n }\n this.console.error(\"Sentry Logger [Error]: \" + message); // tslint:disable-line:no-console\n };\n return Logger;\n}());\nvar logger = new Logger();\nexports.logger = logger;\n//# sourceMappingURL=logger.js.map","\"use strict\";\nvar __values = (this && this.__values) || function (o) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\n if (m) return m.call(o);\n return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar is_1 = require(\"./is\");\n/**\n * Transforms Error object into an object literal with all it's attributes\n * attached to it.\n *\n * Based on: https://github.com/ftlabs/js-abbreviate/blob/fa709e5f139e7770a71827b1893f22418097fbda/index.js#L95-L106\n *\n * @param error An Error containing all relevant information\n * @returns An object with all error properties\n */\nfunction objectifyError(error) {\n // These properties are implemented as magical getters and don't show up in `for-in` loop\n var err = {\n message: error.message,\n name: error.name,\n stack: error.stack,\n };\n for (var i in error) {\n if (Object.prototype.hasOwnProperty.call(error, i)) {\n err[i] = error[i];\n }\n }\n return err;\n}\nvar NAN_VALUE = '[NaN]';\nvar UNDEFINED_VALUE = '[undefined]';\n/**\n * Serializer function used as 2nd argument to JSON.serialize in `serialize()` util function.\n */\nfunction serializer() {\n var stack = [];\n var keys = [];\n var cycleReplacer = function (_, value) {\n if (stack[0] === value) {\n return '[Circular ~]';\n }\n return \"[Circular ~.\" + keys.slice(0, stack.indexOf(value)).join('.') + \"]\";\n };\n return function (key, value) {\n var currentValue = value;\n // NaN and undefined are not JSON.parseable, but we want to preserve this information\n if (is_1.isNaN(value)) {\n currentValue = NAN_VALUE;\n }\n else if (is_1.isUndefined(value)) {\n currentValue = UNDEFINED_VALUE;\n }\n if (stack.length > 0) {\n var thisPos = stack.indexOf(this);\n if (thisPos !== -1) {\n stack.splice(thisPos + 1);\n keys.splice(thisPos, Infinity, key);\n }\n else {\n stack.push(this);\n keys.push(key);\n }\n if (stack.indexOf(currentValue) !== -1) {\n currentValue = cycleReplacer.call(this, key, currentValue);\n }\n }\n else {\n stack.push(currentValue);\n }\n return currentValue instanceof Error ? objectifyError(currentValue) : currentValue;\n };\n}\n/**\n * Reviver function used as 2nd argument to JSON.parse in `deserialize()` util function.\n */\nfunction reviver(_key, value) {\n // NaN and undefined are not JSON.parseable, but we want to preserve this information\n if (value === NAN_VALUE) {\n return NaN;\n }\n if (value === UNDEFINED_VALUE) {\n return undefined;\n }\n return value;\n}\n/**\n * Serializes the given object into a string.\n * Like JSON.stringify, but doesn't throw on circular references.\n * Based on a `json-stringify-safe` package and modified to handle Errors serialization.\n *\n * The object must be serializable, i.e.:\n * - Only primitive types are allowed (object, array, number, string, boolean)\n * - Its depth should be considerably low for performance reasons\n *\n * @param object A JSON-serializable object.\n * @returns A string containing the serialized object.\n */\nfunction serialize(object) {\n return JSON.stringify(object, serializer());\n}\nexports.serialize = serialize;\n/**\n * Deserializes an object from a string previously serialized with\n * {@link serialize}.\n *\n * @param str A serialized object.\n * @returns The deserialized object.\n */\nfunction deserialize(str) {\n return JSON.parse(str, reviver);\n}\nexports.deserialize = deserialize;\n/**\n * Creates a deep copy of the given object.\n *\n * The object must be serializable, i.e.:\n * - It must not contain any cycles\n * - Only primitive types are allowed (object, array, number, string, boolean)\n * - Its depth should be considerably low for performance reasons\n *\n * @param object A JSON-serializable object.\n * @returns The object clone.\n */\nfunction clone(object) {\n return deserialize(serialize(object));\n}\nexports.clone = clone;\n/**\n * Wrap a given object method with a higher-order function\n *\n * @param source An object that contains a method to be wrapped.\n * @param name A name of method to be wrapped.\n * @param replacement A function that should be used to wrap a given method.\n * @returns void\n */\nfunction fill(source, name, replacement) {\n if (!(name in source) || source[name].__sentry__) {\n return;\n }\n var original = source[name];\n var wrapped = replacement(original);\n wrapped.__sentry__ = true;\n wrapped.__sentry_original__ = original;\n wrapped.__sentry_wrapped__ = wrapped;\n source[name] = wrapped;\n}\nexports.fill = fill;\n/**\n * Encodes given object into url-friendly format\n *\n * @param object An object that contains serializable values\n * @returns string Encoded\n */\nfunction urlEncode(object) {\n return Object.keys(object)\n .map(\n // tslint:disable-next-line:no-unsafe-any\n function (key) { return encodeURIComponent(key) + \"=\" + encodeURIComponent(object[key]); })\n .join('&');\n}\nexports.urlEncode = urlEncode;\n// Default Node.js REPL depth\nvar MAX_SERIALIZE_EXCEPTION_DEPTH = 3;\n// TODO: Or is it 200kb? 🤔 — Kamil\n// NOTE: Yes, it is\n// 50kB, as 100kB is max payload size, so half sounds reasonable\nvar MAX_SERIALIZE_EXCEPTION_SIZE = 50 * 1024;\nvar MAX_SERIALIZE_KEYS_LENGTH = 40;\n/** JSDoc */\nfunction utf8Length(value) {\n // tslint:disable-next-line:no-bitwise\n return ~-encodeURI(value).split(/%..|./).length;\n}\n/** JSDoc */\nfunction jsonSize(value) {\n return utf8Length(JSON.stringify(value));\n}\n/** JSDoc */\nfunction serializeValue(value) {\n var maxLength = 40;\n if (typeof value === 'string') {\n return value.length <= maxLength ? value : value.substr(0, maxLength - 1) + \"\\u2026\";\n }\n else if (typeof value === 'number' || typeof value === 'boolean' || typeof value === 'undefined') {\n return value;\n }\n else if (is_1.isNaN(value)) {\n // NaN and undefined are not JSON.parseable, but we want to preserve this information\n return '[NaN]';\n }\n else if (is_1.isUndefined(value)) {\n return '[undefined]';\n }\n var type = Object.prototype.toString.call(value);\n // Node.js REPL notation\n if (type === '[object Object]') {\n return '[Object]';\n }\n if (type === '[object Array]') {\n return '[Array]';\n }\n if (type === '[object Function]') {\n var name_1 = value.name;\n return name_1 ? \"[Function: \" + name_1 + \"]\" : '[Function]';\n }\n return value;\n}\n/** JSDoc */\nfunction serializeObject(value, depth) {\n if (depth === 0) {\n return serializeValue(value);\n }\n if (is_1.isPlainObject(value)) {\n var serialized_1 = {};\n var val_1 = value;\n Object.keys(val_1).forEach(function (key) {\n serialized_1[key] = serializeObject(val_1[key], depth - 1);\n });\n return serialized_1;\n }\n else if (Array.isArray(value)) {\n var val = value;\n return val.map(function (v) { return serializeObject(v, depth - 1); });\n }\n return serializeValue(value);\n}\nexports.serializeObject = serializeObject;\n/** JSDoc */\nfunction limitObjectDepthToSize(object, depth, maxSize) {\n if (depth === void 0) { depth = MAX_SERIALIZE_EXCEPTION_DEPTH; }\n if (maxSize === void 0) { maxSize = MAX_SERIALIZE_EXCEPTION_SIZE; }\n var serialized = serializeObject(object, depth);\n if (jsonSize(serialize(serialized)) > maxSize) {\n return limitObjectDepthToSize(object, depth - 1);\n }\n return serialized;\n}\nexports.limitObjectDepthToSize = limitObjectDepthToSize;\n/** JSDoc */\nfunction serializeKeysToEventMessage(keys, maxLength) {\n if (maxLength === void 0) { maxLength = MAX_SERIALIZE_KEYS_LENGTH; }\n if (!keys.length) {\n return '[object has no keys]';\n }\n if (keys[0].length >= maxLength) {\n return keys[0];\n }\n for (var includedKeys = keys.length; includedKeys > 0; includedKeys--) {\n var serialized = keys.slice(0, includedKeys).join(', ');\n if (serialized.length > maxLength) {\n continue;\n }\n if (includedKeys === keys.length) {\n return serialized;\n }\n return serialized + \"\\u2026\";\n }\n return '';\n}\nexports.serializeKeysToEventMessage = serializeKeysToEventMessage;\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign#Polyfill\n/** JSDoc */\nfunction assign(target) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n var e_1, _a;\n if (target === null || target === undefined) {\n throw new TypeError('Cannot convert undefined or null to object');\n }\n var to = Object(target);\n try {\n for (var args_1 = __values(args), args_1_1 = args_1.next(); !args_1_1.done; args_1_1 = args_1.next()) {\n var source = args_1_1.value;\n if (source !== null) {\n for (var nextKey in source) {\n if (Object.prototype.hasOwnProperty.call(source, nextKey)) {\n to[nextKey] = source[nextKey];\n }\n }\n }\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (args_1_1 && !args_1_1.done && (_a = args_1.return)) _a.call(args_1);\n }\n finally { if (e_1) throw e_1.error; }\n }\n return to;\n}\nexports.assign = assign;\n//# sourceMappingURL=object.js.map","\"use strict\";\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar __values = (this && this.__values) || function (o) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\n if (m) return m.call(o);\n return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n};\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spread = (this && this.__spread) || function () {\n for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));\n return ar;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar object_1 = require(\"@sentry/utils/object\");\n/**\n * Holds additional event information. {@link Scope.applyToEvent} will be\n * called by the client before an event will be sent.\n */\nvar Scope = /** @class */ (function () {\n function Scope() {\n /** Flag if notifiying is happening. */\n this.notifyingListeners = false;\n /** Callback for client to receive scope changes. */\n this.scopeListeners = [];\n /** Callback list that will be called after {@link applyToEvent}. */\n this.eventProcessors = [];\n /** Array of breadcrumbs. */\n this.breadcrumbs = [];\n /** User */\n this.user = {};\n /** Tags */\n this.tags = {};\n /** Extra */\n this.extra = {};\n }\n /** Add internal on change listener. */\n Scope.prototype.addScopeListener = function (callback) {\n this.scopeListeners.push(callback);\n };\n /** Add new event processor that will be called after {@link applyToEvent}. */\n Scope.prototype.addEventProcessor = function (callback) {\n this.eventProcessors.push(callback);\n return this;\n };\n /**\n * This will be called on every set call.\n */\n Scope.prototype.notifyScopeListeners = function () {\n var _this = this;\n if (!this.notifyingListeners) {\n this.notifyingListeners = true;\n setTimeout(function () {\n _this.scopeListeners.forEach(function (callback) {\n callback(_this);\n });\n _this.notifyingListeners = false;\n }, 0);\n }\n };\n /**\n * This will be called after {@link applyToEvent} is finished.\n */\n Scope.prototype.notifyEventProcessors = function (event, hint) {\n return __awaiter(this, void 0, void 0, function () {\n var e_1, _a, processedEvent, _b, _c, processor, e_2, e_1_1;\n return __generator(this, function (_d) {\n switch (_d.label) {\n case 0:\n processedEvent = event;\n _d.label = 1;\n case 1:\n _d.trys.push([1, 8, 9, 10]);\n _b = __values(this.eventProcessors), _c = _b.next();\n _d.label = 2;\n case 2:\n if (!!_c.done) return [3 /*break*/, 7];\n processor = _c.value;\n _d.label = 3;\n case 3:\n _d.trys.push([3, 5, , 6]);\n return [4 /*yield*/, processor(__assign({}, processedEvent), hint)];\n case 4:\n processedEvent = _d.sent();\n if (processedEvent === null) {\n return [2 /*return*/, null];\n }\n return [3 /*break*/, 6];\n case 5:\n e_2 = _d.sent();\n return [3 /*break*/, 6];\n case 6:\n _c = _b.next();\n return [3 /*break*/, 2];\n case 7: return [3 /*break*/, 10];\n case 8:\n e_1_1 = _d.sent();\n e_1 = { error: e_1_1 };\n return [3 /*break*/, 10];\n case 9:\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_1) throw e_1.error; }\n return [7 /*endfinally*/];\n case 10: return [2 /*return*/, processedEvent];\n }\n });\n });\n };\n /**\n * Updates user context information for future events.\n * @param user User context object to merge into current context.\n */\n Scope.prototype.setUser = function (user) {\n this.user = user;\n this.notifyScopeListeners();\n return this;\n };\n /**\n * Updates tags context information for future events.\n * @param tags Tags context object to merge into current context.\n */\n Scope.prototype.setTag = function (key, value) {\n var _a;\n this.tags = __assign({}, this.tags, (_a = {}, _a[key] = value, _a));\n this.notifyScopeListeners();\n return this;\n };\n /**\n * Updates extra context information for future events.\n * @param extra context object to merge into current context.\n */\n Scope.prototype.setExtra = function (key, extra) {\n var _a;\n this.extra = __assign({}, this.extra, (_a = {}, _a[key] = extra, _a));\n this.notifyScopeListeners();\n return this;\n };\n /**\n * Sets the fingerprint on the scope to send with the events.\n * @param fingerprint string[] to group events in Sentry.\n */\n Scope.prototype.setFingerprint = function (fingerprint) {\n this.fingerprint = fingerprint;\n this.notifyScopeListeners();\n return this;\n };\n /**\n * Sets the level on the scope for future events.\n * @param level string {@link Severity}\n */\n Scope.prototype.setLevel = function (level) {\n this.level = level;\n this.notifyScopeListeners();\n return this;\n };\n /**\n * Inherit values from the parent scope.\n * @param scope to clone.\n */\n Scope.clone = function (scope) {\n var newScope = new Scope();\n object_1.assign(newScope, scope, {\n scopeListeners: [],\n });\n if (scope) {\n newScope.extra = object_1.assign(scope.extra);\n newScope.tags = object_1.assign(scope.tags);\n newScope.breadcrumbs = __spread(scope.breadcrumbs);\n newScope.eventProcessors = __spread(scope.eventProcessors);\n }\n return newScope;\n };\n /** Returns tags. */\n Scope.prototype.getTags = function () {\n return this.tags;\n };\n /** Returns extra. */\n Scope.prototype.getExtra = function () {\n return this.extra;\n };\n /** Returns extra. */\n Scope.prototype.getUser = function () {\n return this.user;\n };\n /** Returns fingerprint. */\n Scope.prototype.getFingerprint = function () {\n return this.fingerprint;\n };\n /** Returns breadcrumbs. */\n Scope.prototype.getBreadcrumbs = function () {\n return this.breadcrumbs;\n };\n /** Returns level. */\n Scope.prototype.getLevel = function () {\n return this.level;\n };\n /** Clears the current scope and resets its properties. */\n Scope.prototype.clear = function () {\n this.breadcrumbs = [];\n this.tags = {};\n this.extra = {};\n this.user = {};\n this.level = undefined;\n this.fingerprint = undefined;\n this.notifyScopeListeners();\n };\n /**\n * Sets the breadcrumbs in the scope\n * @param breadcrumbs Breadcrumb\n * @param maxBreadcrumbs number of max breadcrumbs to merged into event.\n */\n Scope.prototype.addBreadcrumb = function (breadcrumb, maxBreadcrumbs) {\n this.breadcrumbs =\n maxBreadcrumbs !== undefined && maxBreadcrumbs >= 0\n ? __spread(this.breadcrumbs, [breadcrumb]).slice(-maxBreadcrumbs)\n : __spread(this.breadcrumbs, [breadcrumb]);\n this.notifyScopeListeners();\n };\n /**\n * Applies the current context and fingerprint to the event.\n * Note that breadcrumbs will be added by the client.\n * Also if the event has already breadcrumbs on it, we do not merge them.\n * @param event SentryEvent\n * @param hint May contain additional informartion about the original exception.\n * @param maxBreadcrumbs number of max breadcrumbs to merged into event.\n */\n Scope.prototype.applyToEvent = function (event, hint, maxBreadcrumbs) {\n return __awaiter(this, void 0, void 0, function () {\n var hasNoBreadcrumbs;\n return __generator(this, function (_a) {\n if (this.extra && Object.keys(this.extra).length) {\n event.extra = __assign({}, this.extra, event.extra);\n }\n if (this.tags && Object.keys(this.tags).length) {\n event.tags = __assign({}, this.tags, event.tags);\n }\n if (this.user && Object.keys(this.user).length) {\n event.user = __assign({}, this.user, event.user);\n }\n if (this.fingerprint && event.fingerprint === undefined) {\n event.fingerprint = this.fingerprint;\n }\n if (this.level) {\n event.level = this.level;\n }\n hasNoBreadcrumbs = !event.breadcrumbs || event.breadcrumbs.length === 0;\n if (hasNoBreadcrumbs && this.breadcrumbs.length > 0) {\n event.breadcrumbs =\n maxBreadcrumbs !== undefined && maxBreadcrumbs >= 0\n ? this.breadcrumbs.slice(-maxBreadcrumbs)\n : this.breadcrumbs;\n }\n return [2 /*return*/, this.notifyEventProcessors(event, hint)];\n });\n });\n };\n return Scope;\n}());\nexports.Scope = Scope;\n//# sourceMappingURL=scope.js.map","\"use strict\";\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spread = (this && this.__spread) || function () {\n for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));\n return ar;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar misc_1 = require(\"@sentry/utils/misc\");\nvar scope_1 = require(\"./scope\");\n/**\n * API compatibility version of this hub.\n *\n * WARNING: This number should only be incresed when the global interface\n * changes a and new methods are introduced.\n */\nexports.API_VERSION = 3;\n/**\n * Internal class used to make sure we always have the latest internal functions\n * working in case we have a version conflict.\n */\nvar Hub = /** @class */ (function () {\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 function Hub(client, scope, version) {\n if (scope === void 0) { scope = new scope_1.Scope(); }\n if (version === void 0) { version = exports.API_VERSION; }\n this.version = version;\n /** Is a {@link Layer}[] containing the client and scope */\n this.stack = [];\n this.stack.push({ client: client, scope: scope });\n }\n /**\n * Internal helper function to call a method on the top client if it exists.\n *\n * @param method The method to call on the client/client.\n * @param args Arguments to pass to the client/frontend.\n */\n Hub.prototype.invokeClient = function (method) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n var _a;\n var top = this.getStackTop();\n if (top && top.client && top.client[method]) {\n (_a = top.client)[method].apply(_a, __spread(args, [top.scope]));\n }\n };\n /**\n * Internal helper function to call an async method on the top client if it\n * exists.\n *\n * @param method The method to call on the client/client.\n * @param args Arguments to pass to the client/frontend.\n */\n Hub.prototype.invokeClientAsync = function (method) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n var _a;\n var top = this.getStackTop();\n if (top && top.client && top.client[method]) {\n (_a = top.client)[method].apply(_a, __spread(args, [top.scope])).catch(function (err) {\n console.error(err);\n });\n }\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 Hub.prototype.isOlderThan = function (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 Hub.prototype.bindClient = function (client) {\n var top = this.getStackTop();\n top.client = client;\n if (top && top.scope && client) {\n top.scope.addScopeListener(function (s) {\n if (client.getBackend) {\n try {\n client.getBackend().storeScope(s);\n }\n catch (_a) {\n // Do nothing\n }\n }\n });\n }\n };\n /**\n * Create a new scope to store context information.\n *\n * The scope will be layered on top of the current one. It is isolated, i.e. all\n * breadcrumbs and context information added to this scope will be removed once\n * the scope ends. Be sure to always remove this scope with {@link this.popScope}\n * when the operation finishes or throws.\n *\n * @returns Scope, the new cloned scope\n */\n Hub.prototype.pushScope = function () {\n // We want to clone the content of prev scope\n var stack = this.getStack();\n var parentScope = stack.length > 0 ? stack[stack.length - 1].scope : undefined;\n var scope = scope_1.Scope.clone(parentScope);\n this.getStack().push({\n client: this.getClient(),\n scope: scope,\n });\n return scope;\n };\n /**\n * Removes a previously pushed scope from the stack.\n *\n * This restores the state before the scope was pushed. All breadcrumbs and\n * context information added since the last call to {@link this.pushScope} are\n * discarded.\n */\n Hub.prototype.popScope = function () {\n return this.getStack().pop() !== undefined;\n };\n /**\n * Creates a new scope with and executes the given operation within.\n * The scope is automatically removed once the operation\n * finishes or throws.\n *\n * This is essentially a convenience function for:\n *\n * pushScope();\n * callback();\n * popScope();\n *\n * @param callback that will be enclosed into push/popScope.\n */\n Hub.prototype.withScope = function (callback) {\n var scope = this.pushScope();\n try {\n callback(scope);\n }\n finally {\n this.popScope();\n }\n };\n /** Returns the client of the top stack. */\n Hub.prototype.getClient = function () {\n return this.getStackTop().client;\n };\n /** Returns the scope of the top stack. */\n Hub.prototype.getScope = function () {\n return this.getStackTop().scope;\n };\n /** Returns the scope stack for domains or the process. */\n Hub.prototype.getStack = function () {\n return this.stack;\n };\n /** Returns the topmost scope layer in the order domain > local > process. */\n Hub.prototype.getStackTop = function () {\n return this.stack[this.stack.length - 1];\n };\n /**\n * Captures an exception event and sends it to Sentry.\n *\n * @param exception An exception-like object.\n * @param hint May contain additional information about the original exception.\n * @returns The generated eventId.\n */\n Hub.prototype.captureException = function (exception, hint) {\n var eventId = (this._lastEventId = misc_1.uuid4());\n this.invokeClientAsync('captureException', exception, __assign({}, hint, { event_id: eventId }));\n return eventId;\n };\n /**\n * Captures a message event and sends it to Sentry.\n *\n * @param message The message to send to Sentry.\n * @param level Define the level of the message.\n * @param hint May contain additional information about the original exception.\n * @returns The generated eventId.\n */\n Hub.prototype.captureMessage = function (message, level, hint) {\n var eventId = (this._lastEventId = misc_1.uuid4());\n this.invokeClientAsync('captureMessage', message, level, __assign({}, hint, { event_id: eventId }));\n return eventId;\n };\n /**\n * Captures a manually created event and sends it to Sentry.\n *\n * @param event The event to send to Sentry.\n * @param hint May contain additional information about the original exception.\n */\n Hub.prototype.captureEvent = function (event, hint) {\n var eventId = (this._lastEventId = misc_1.uuid4());\n this.invokeClientAsync('captureEvent', event, __assign({}, hint, { event_id: eventId }));\n return eventId;\n };\n /**\n * This is the getter for lastEventId.\n *\n * @returns The last event id of a captured event.\n */\n Hub.prototype.lastEventId = function () {\n return this._lastEventId;\n };\n /**\n * Records a new breadcrumb which will be attached to future events.\n *\n * Breadcrumbs will be added to subsequent events to provide more context on\n * user's actions prior to an error or crash.\n *\n * @param breadcrumb The breadcrumb to record.\n * @param hint May contain additional information about the original breadcrumb.\n */\n Hub.prototype.addBreadcrumb = function (breadcrumb, hint) {\n this.invokeClient('addBreadcrumb', breadcrumb, __assign({}, hint));\n };\n /**\n * Callback to set context information onto the scope.\n *\n * @param callback Callback function that receives Scope.\n */\n Hub.prototype.configureScope = function (callback) {\n var top = this.getStackTop();\n if (top.scope && top.client) {\n // TODO: freeze flag\n callback(top.scope);\n }\n };\n /**\n * For the duraction of the callback, this hub will be set as the global current Hub.\n * This function is useful if you want to run your own client and hook into an already initialized one\n * e.g.: Reporting issues to your own sentry when running in your component while still using the users configuration.\n */\n Hub.prototype.run = function (callback) {\n var oldHub = makeMain(this);\n try {\n callback(this);\n }\n finally {\n makeMain(oldHub);\n }\n };\n return Hub;\n}());\nexports.Hub = Hub;\n/** Returns the global shim registry. */\nfunction getMainCarrier() {\n var carrier = misc_1.getGlobalObject();\n carrier.__SENTRY__ = carrier.__SENTRY__ || {\n hub: undefined,\n };\n return carrier.__SENTRY__;\n}\nexports.getMainCarrier = getMainCarrier;\n/**\n * Replaces the current main hub with the passed one on the global object\n *\n * @returns The old replaced hub\n */\nfunction makeMain(hub) {\n var registry = getMainCarrier();\n var oldHub = registry.hub;\n registry.hub = hub;\n return oldHub;\n}\nexports.makeMain = makeMain;\n/**\n * Returns the default hub instance.\n *\n * If a hub is already registered in the global carrier but this module\n * contains a more recent version, it replaces the registered version.\n * Otherwise, the currently registered hub will be returned.\n */\nfunction getCurrentHub() {\n var registry = getMainCarrier();\n if (!registry.hub || registry.hub.isOlderThan(exports.API_VERSION)) {\n registry.hub = new Hub();\n }\n var domain = null;\n try {\n domain = process.domain;\n }\n catch (_Oo) {\n // We do not have process\n }\n if (!domain) {\n return registry.hub;\n }\n var carrier = domain.__SENTRY__;\n if (!carrier) {\n domain.__SENTRY__ = carrier = {};\n }\n if (!carrier.hub) {\n var top_1 = registry.hub.getStackTop();\n carrier.hub = top_1 ? new Hub(top_1.client, scope_1.Scope.clone(top_1.scope)) : new Hub();\n }\n return carrier.hub;\n}\nexports.getCurrentHub = getCurrentHub;\n/**\n * This will create a new {@link Hub} and add to the passed object on\n * __SENTRY__.hub.\n * @param carrier object\n */\nfunction getHubFromCarrier(carrier) {\n if (carrier && carrier.__SENTRY__ && carrier.__SENTRY__.hub) {\n return carrier.__SENTRY__.hub;\n }\n else {\n carrier.__SENTRY__ = {};\n carrier.__SENTRY__.hub = new Hub();\n return carrier.__SENTRY__.hub;\n }\n}\nexports.getHubFromCarrier = getHubFromCarrier;\n//# sourceMappingURL=hub.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar scope_1 = require(\"./scope\");\nexports.Scope = scope_1.Scope;\nvar hub_1 = require(\"./hub\");\nexports.getCurrentHub = hub_1.getCurrentHub;\nexports.getHubFromCarrier = hub_1.getHubFromCarrier;\nexports.Hub = hub_1.Hub;\n//# sourceMappingURL=index.js.map","\"use strict\";\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spread = (this && this.__spread) || function () {\n for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));\n return ar;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar hub_1 = require(\"@sentry/hub\");\n/**\n * This calls a function on the current hub.\n * @param method function to call on hub.\n * @param args to pass to function.\n */\nfunction callOnHub(method) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n var hub = hub_1.getCurrentHub();\n if (hub && hub[method]) {\n // tslint:disable-next-line:no-unsafe-any\n return hub[method].apply(hub, __spread(args));\n }\n throw new Error(\"No hub defined or \" + method + \" was not found on the hub, please open a bug report.\");\n}\n/**\n * Captures an exception event and sends it to Sentry.\n *\n * @param exception An exception-like object.\n * @returns The generated eventId.\n */\nfunction captureException(exception) {\n var syntheticException;\n try {\n throw new Error('Sentry syntheticException');\n }\n catch (exception) {\n syntheticException = exception;\n }\n return callOnHub('captureException', exception, {\n originalException: exception,\n syntheticException: syntheticException,\n });\n}\nexports.captureException = captureException;\n/**\n * Captures a message event and sends it to Sentry.\n *\n * @param message The message to send to Sentry.\n * @param level Define the level of the message.\n * @returns The generated eventId.\n */\nfunction captureMessage(message, level) {\n var syntheticException;\n try {\n throw new Error(message);\n }\n catch (exception) {\n syntheticException = exception;\n }\n return callOnHub('captureMessage', message, level, {\n originalException: message,\n syntheticException: syntheticException,\n });\n}\nexports.captureMessage = captureMessage;\n/**\n * Captures a manually created event and sends it to Sentry.\n *\n * @param event The event to send to Sentry.\n * @returns The generated eventId.\n */\nfunction captureEvent(event) {\n return callOnHub('captureEvent', event);\n}\nexports.captureEvent = captureEvent;\n/**\n * Records a new breadcrumb which will be attached to future events.\n *\n * Breadcrumbs will be added to subsequent events to provide more context on\n * user's actions prior to an error or crash.\n *\n * @param breadcrumb The breadcrumb to record.\n */\nfunction addBreadcrumb(breadcrumb) {\n callOnHub('addBreadcrumb', breadcrumb);\n}\nexports.addBreadcrumb = addBreadcrumb;\n/**\n * Callback to set context information onto the scope.\n * @param callback Callback function that receives Scope.\n */\nfunction configureScope(callback) {\n callOnHub('configureScope', callback);\n}\nexports.configureScope = configureScope;\n/**\n * Creates a new scope with and executes the given operation within.\n * The scope is automatically removed once the operation\n * finishes or throws.\n *\n * This is essentially a convenience function for:\n *\n * pushScope();\n * callback();\n * popScope();\n *\n * @param callback that will be enclosed into push/popScope.\n */\nfunction withScope(callback) {\n callOnHub('withScope', callback);\n}\nexports.withScope = withScope;\n/**\n * Calls a function on the latest client. Use this with caution, it's meant as\n * in \"internal\" helper so we don't need to expose every possible function in\n * the shim. It is not guaranteed that the client actually implements the\n * function.\n *\n * @param method The method to call on the client/client.\n * @param args Arguments to pass to the client/fontend.\n */\nfunction _callOnClient(method) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n callOnHub.apply(void 0, __spread(['invokeClient', method], args));\n}\nexports._callOnClient = _callOnClient;\n//# sourceMappingURL=index.js.map","\"use strict\";\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n }\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/** An error emitted by Sentry SDKs and related utilities. */\nvar SentryError = /** @class */ (function (_super) {\n __extends(SentryError, _super);\n function SentryError(message) {\n var _newTarget = this.constructor;\n var _this = _super.call(this, message) || this;\n _this.message = message;\n // tslint:disable:no-unsafe-any\n _this.name = _newTarget.prototype.constructor.name;\n Object.setPrototypeOf(_this, _newTarget.prototype);\n return _this;\n }\n return SentryError;\n}(Error));\nexports.SentryError = SentryError;\n//# sourceMappingURL=error.js.map","\"use strict\";\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __values = (this && this.__values) || function (o) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\n if (m) return m.call(o);\n return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar is_1 = require(\"@sentry/utils/is\");\nvar object_1 = require(\"@sentry/utils/object\");\nvar error_1 = require(\"./error\");\n/** Regular expression used to parse a Dsn. */\nvar DSN_REGEX = /^(?:(\\w+):)\\/\\/(?:(\\w+)(?::(\\w+))?@)([\\w\\.-]+)(?::(\\d+))?\\/(.+)/;\n/** The Sentry Dsn, identifying a Sentry instance and project. */\nvar Dsn = /** @class */ (function () {\n /** Creates a new Dsn component */\n function Dsn(from) {\n if (typeof from === 'string') {\n this.fromString(from);\n }\n else {\n this.fromComponents(from);\n }\n this.validate();\n }\n /**\n * Renders the string representation of this Dsn.\n *\n * By default, this will render the public representation without the password\n * component. To get the deprecated private representation, set `withPassword`\n * to true.\n *\n * @param withPassword When set to true, the password will be included.\n */\n Dsn.prototype.toString = function (withPassword) {\n if (withPassword === void 0) { withPassword = false; }\n // tslint:disable-next-line:no-this-assignment\n var _a = this, host = _a.host, path = _a.path, pass = _a.pass, port = _a.port, projectId = _a.projectId, protocol = _a.protocol, user = _a.user;\n return (protocol + \"://\" + user + (withPassword && pass ? \":\" + pass : '') +\n (\"@\" + host + (port ? \":\" + port : '') + \"/\" + (path ? path + \"/\" : path) + projectId));\n };\n /** Parses a string into this Dsn. */\n Dsn.prototype.fromString = function (str) {\n var match = DSN_REGEX.exec(str);\n if (!match) {\n throw new error_1.SentryError('Invalid Dsn');\n }\n var _a = __read(match.slice(1), 6), protocol = _a[0], user = _a[1], _b = _a[2], pass = _b === void 0 ? '' : _b, host = _a[3], _c = _a[4], port = _c === void 0 ? '' : _c, lastPath = _a[5];\n var path = '';\n var projectId = lastPath;\n var split = projectId.split('/');\n if (split.length > 1) {\n path = split.slice(0, -1).join('/');\n projectId = split.pop();\n }\n object_1.assign(this, { host: host, pass: pass, path: path, projectId: projectId, port: port, protocol: protocol, user: user });\n };\n /** Maps Dsn components into this instance. */\n Dsn.prototype.fromComponents = function (components) {\n this.protocol = components.protocol;\n this.user = components.user;\n this.pass = components.pass || '';\n this.host = components.host;\n this.port = components.port || '';\n this.path = components.path || '';\n this.projectId = components.projectId;\n };\n /** Validates this Dsn and throws on error. */\n Dsn.prototype.validate = function () {\n var e_1, _a;\n try {\n for (var _b = __values(['protocol', 'user', 'host', 'projectId']), _c = _b.next(); !_c.done; _c = _b.next()) {\n var component = _c.value;\n if (!this[component]) {\n throw new error_1.SentryError(\"Invalid Dsn: Missing \" + component);\n }\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_1) throw e_1.error; }\n }\n if (this.protocol !== 'http' && this.protocol !== 'https') {\n throw new error_1.SentryError(\"Invalid Dsn: Unsupported protocol \\\"\" + this.protocol + \"\\\"\");\n }\n if (this.port && is_1.isNaN(parseInt(this.port, 10))) {\n throw new error_1.SentryError(\"Invalid Dsn: Invalid port number \\\"\" + this.port + \"\\\"\");\n }\n };\n return Dsn;\n}());\nexports.Dsn = Dsn;\n//# sourceMappingURL=dsn.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar object_1 = require(\"@sentry/utils/object\");\nvar dsn_1 = require(\"./dsn\");\nvar SENTRY_API_VERSION = '7';\n/** Helper class to provide urls to different Sentry endpoints. */\nvar API = /** @class */ (function () {\n /** Create a new instance of API */\n function API(dsn) {\n this.dsn = dsn;\n this.dsnObject = new dsn_1.Dsn(dsn);\n }\n /** Returns the Dsn object. */\n API.prototype.getDsn = function () {\n return this.dsnObject;\n };\n /** Returns a string with auth headers in the url to the store endpoint. */\n API.prototype.getStoreEndpoint = function () {\n return \"\" + this.getBaseUrl() + this.getStoreEndpointPath();\n };\n /** Returns the store endpoint with auth added in url encoded. */\n API.prototype.getStoreEndpointWithUrlEncodedAuth = function () {\n var dsn = this.dsnObject;\n var auth = {\n sentry_key: dsn.user,\n sentry_version: SENTRY_API_VERSION,\n };\n // Auth is intentionally sent as part of query string (NOT as custom HTTP header)\n // to avoid preflight CORS requests\n return this.getStoreEndpoint() + \"?\" + object_1.urlEncode(auth);\n };\n /** Returns the base path of the url including the port. */\n API.prototype.getBaseUrl = function () {\n var dsn = this.dsnObject;\n var protocol = dsn.protocol ? dsn.protocol + \":\" : '';\n var port = dsn.port ? \":\" + dsn.port : '';\n return protocol + \"//\" + dsn.host + port;\n };\n /** Returns only the path component for the store endpoint. */\n API.prototype.getStoreEndpointPath = function () {\n var dsn = this.dsnObject;\n return (dsn.path ? \"/\" + dsn.path : '') + \"/api/\" + dsn.projectId + \"/store/\";\n };\n /** Returns an object that can be used in request headers. */\n API.prototype.getRequestHeaders = function (clientName, clientVersion) {\n var dsn = this.dsnObject;\n var header = [\"Sentry sentry_version=\" + SENTRY_API_VERSION];\n header.push(\"sentry_timestamp=\" + new Date().getTime());\n header.push(\"sentry_client=\" + clientName + \"/\" + clientVersion);\n header.push(\"sentry_key=\" + dsn.user);\n if (dsn.pass) {\n header.push(\"sentry_secret=\" + dsn.pass);\n }\n return {\n 'Content-Type': 'application/json',\n 'X-Sentry-Auth': header.join(', '),\n };\n };\n /** Returns the url to the report dialog endpoint. */\n API.prototype.getReportDialogEndpoint = function (dialogOptions) {\n if (dialogOptions === void 0) { dialogOptions = {}; }\n var dsn = this.dsnObject;\n var endpoint = \"\" + this.getBaseUrl() + (dsn.path ? \"/\" + dsn.path : '') + \"/api/embed/error-page/\";\n var encodedOptions = [];\n encodedOptions.push(\"dsn=\" + dsn.toString());\n for (var key in dialogOptions) {\n if (key === 'user') {\n if (!dialogOptions.user) {\n continue;\n }\n if (dialogOptions.user.name) {\n encodedOptions.push(\"name=\" + encodeURIComponent(dialogOptions.user.name));\n }\n if (dialogOptions.user.email) {\n encodedOptions.push(\"email=\" + encodeURIComponent(dialogOptions.user.email));\n }\n }\n else {\n encodedOptions.push(encodeURIComponent(key) + \"=\" + encodeURIComponent(dialogOptions[key]));\n }\n }\n if (encodedOptions.length) {\n return endpoint + \"?\" + encodedOptions.join('&');\n }\n return endpoint;\n };\n return API;\n}());\nexports.API = API;\n//# sourceMappingURL=api.js.map","\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/**\n * Consumes the promise and logs the error when it rejects.\n * @param promise A promise to forget.\n */\nfunction forget(promise) {\n promise.catch(function (e) {\n // TODO: Use a better logging mechanism\n console.error(e);\n });\n}\nexports.forget = forget;\n/**\n * Helper to filter an array with asynchronous callbacks.\n *\n * @param array An array containing items to filter.\n * @param predicate An async predicate evaluated on every item.\n * @param thisArg Optional value passed as \"this\" into the callback.\n * @returns An array containing only values where the callback returned true.\n */\nfunction filterAsync(array, predicate, thisArg) {\n return __awaiter(this, void 0, void 0, function () {\n var verdicts;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, Promise.all(array.map(predicate, thisArg))];\n case 1:\n verdicts = _a.sent();\n return [2 /*return*/, array.filter(function (_, index) { return verdicts[index]; })];\n }\n });\n });\n}\nexports.filterAsync = filterAsync;\n//# sourceMappingURL=async.js.map","\"use strict\";\nvar __values = (this && this.__values) || function (o) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\n if (m) return m.call(o);\n return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar is_1 = require(\"./is\");\n/**\n * Encodes given object into url-friendly format\n *\n * @param str An object that contains serializable values\n * @param max Maximum number of characters in truncated string\n * @returns string Encoded\n */\nfunction truncate(str, max) {\n if (max === void 0) { max = 0; }\n if (max === 0 || !is_1.isString(str)) {\n return str;\n }\n return str.length <= max ? str : str.substr(0, max) + \"\\u2026\";\n}\nexports.truncate = truncate;\n/**\n * This is basically just `trim_line` from\n * https://github.com/getsentry/sentry/blob/master/src/sentry/lang/javascript/processor.py#L67\n *\n * @param str An object that contains serializable values\n * @param max Maximum number of characters in truncated string\n * @returns string Encoded\n */\nfunction snipLine(line, colno) {\n var newLine = line;\n var ll = newLine.length;\n if (ll <= 150) {\n return newLine;\n }\n if (colno > ll) {\n colno = ll; // tslint:disable-line:no-parameter-reassignment\n }\n var start = Math.max(colno - 60, 0);\n if (start < 5) {\n start = 0;\n }\n var end = Math.min(start + 140, ll);\n if (end > ll - 5) {\n end = ll;\n }\n if (end === ll) {\n start = Math.max(end - 140, 0);\n }\n newLine = newLine.slice(start, end);\n if (start > 0) {\n newLine = \"'{snip} \" + newLine;\n }\n if (end < ll) {\n newLine += ' {snip}';\n }\n return newLine;\n}\nexports.snipLine = snipLine;\n/**\n * Join values in array\n * @param input array of values to be joined together\n * @param delimiter string to be placed in-between values\n * @returns Joined values\n */\nfunction safeJoin(input, delimiter) {\n var e_1, _a;\n if (!Array.isArray(input)) {\n return '';\n }\n var output = [];\n try {\n for (var input_1 = __values(input), input_1_1 = input_1.next(); !input_1_1.done; input_1_1 = input_1.next()) {\n var value = input_1_1.value;\n try {\n output.push(String(value));\n }\n catch (e) {\n output.push('[value cannot be serialized]');\n }\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (input_1_1 && !input_1_1.done && (_a = input_1.return)) _a.call(input_1);\n }\n finally { if (e_1) throw e_1.error; }\n }\n return output.join(delimiter);\n}\nexports.safeJoin = safeJoin;\n/**\n * Checks if given value is included in the target\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes#Polyfill\n * @param target source string\n * @param search string to be looked for\n * @returns An answer\n */\nfunction includes(target, search) {\n if (search.length > target.length) {\n return false;\n }\n else {\n return target.indexOf(search) !== -1;\n }\n}\nexports.includes = includes;\n//# sourceMappingURL=string.js.map","\"use strict\";\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar types_1 = require(\"@sentry/types\");\nvar async_1 = require(\"@sentry/utils/async\");\nvar misc_1 = require(\"@sentry/utils/misc\");\nvar string_1 = require(\"@sentry/utils/string\");\nvar dsn_1 = require(\"./dsn\");\nvar logger_1 = require(\"./logger\");\n/** JSDoc */\nfunction beforeBreadcrumbConsoleLoopGuard(callback) {\n return __awaiter(this, void 0, void 0, function () {\n var global, levels, originalConsole, result;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n global = misc_1.getGlobalObject();\n levels = ['debug', 'info', 'warn', 'error', 'log'];\n if (!('console' in global)) {\n return [2 /*return*/, callback()];\n }\n originalConsole = global.console;\n // Restore all wrapped console methods\n levels.forEach(function (level) {\n if (level in global.console && originalConsole[level].__sentry__) {\n originalConsole[level] = originalConsole[level].__sentry_original__;\n }\n });\n return [4 /*yield*/, callback()];\n case 1:\n result = _a.sent();\n // Revert restoration to wrapped state\n levels.forEach(function (level) {\n if (level in global.console && originalConsole[level].__sentry__) {\n originalConsole[level] = originalConsole[level].__sentry_wrapped__;\n }\n });\n return [2 /*return*/, result];\n }\n });\n });\n}\n/**\n * Default maximum number of breadcrumbs added to an event. Can be overwritten\n * with {@link Options.maxBreadcrumbs}.\n */\nvar DEFAULT_BREADCRUMBS = 30;\n/**\n * Absolute maximum number of breadcrumbs added to an event. The\n * `maxBreadcrumbs` option cannot be higher than this value.\n */\nvar MAX_BREADCRUMBS = 100;\n/**\n * By default, truncates URL values to 250 chars\n */\nvar MAX_URL_LENGTH = 250;\n/**\n * Base implementation for all JavaScript SDK clients.\n *\n * Call the constructor with the corresponding backend constructor and options\n * specific to the client subclass. To access these options later, use\n * {@link Client.getOptions}. Also, the Backend instance is available via\n * {@link Client.getBackend}.\n *\n * If a Dsn is specified in the options, it will be parsed and stored. Use\n * {@link Client.getDsn} to retrieve the Dsn at any moment. In case the Dsn is\n * invalid, the constructor will throw a {@link SentryException}. Note that\n * without a valid Dsn, the SDK will not send any events to Sentry.\n *\n * Before sending an event via the backend, it is passed through\n * {@link BaseClient.prepareEvent} to add SDK information and scope data\n * (breadcrumbs and context). To add more custom information, override this\n * method and extend the resulting prepared event.\n *\n * To issue automatically created events (e.g. via instrumentation), use\n * {@link Client.captureEvent}. It will prepare the event and pass it through\n * the callback lifecycle. To issue auto-breadcrumbs, use\n * {@link Client.addBreadcrumb}.\n *\n * @example\n * class NodeClient extends BaseClient {\n * public constructor(options: NodeOptions) {\n * super(NodeBackend, options);\n * }\n *\n * // ...\n * }\n */\nvar BaseClient = /** @class */ (function () {\n /**\n * Initializes this client instance.\n *\n * @param backendClass A constructor function to create the backend.\n * @param options Options for the client.\n */\n function BaseClient(backendClass, options) {\n this.backend = new backendClass(options);\n this.options = options;\n if (options.dsn) {\n this.dsn = new dsn_1.Dsn(options.dsn);\n }\n }\n /**\n * @inheritDoc\n */\n BaseClient.prototype.install = function () {\n if (!this.isEnabled()) {\n return (this.installed = false);\n }\n var backend = this.getBackend();\n if (!this.installed && backend.install) {\n backend.install();\n }\n return (this.installed = true);\n };\n /**\n * Internal helper function to buffer promises.\n *\n * @param promise Any promise, but in this case Promise.\n */\n BaseClient.prototype.buffer = function (promise) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, this.getBackend()\n .getBuffer()\n .add(promise)];\n });\n });\n };\n /**\n * @inheritDoc\n */\n BaseClient.prototype.captureException = function (exception, hint, scope) {\n return __awaiter(this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n return [2 /*return*/, this.buffer((function () { return __awaiter(_this, void 0, void 0, function () {\n var event;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.getBackend().eventFromException(exception, hint)];\n case 1:\n event = _a.sent();\n return [2 /*return*/, this.captureEvent(event, hint, scope)];\n }\n });\n }); })())];\n });\n });\n };\n /**\n * @inheritDoc\n */\n BaseClient.prototype.captureMessage = function (message, level, hint, scope) {\n return __awaiter(this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n return [2 /*return*/, this.buffer((function () { return __awaiter(_this, void 0, void 0, function () {\n var event;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.getBackend().eventFromMessage(message, level, hint)];\n case 1:\n event = _a.sent();\n return [2 /*return*/, this.captureEvent(event, hint, scope)];\n }\n });\n }); })())];\n });\n });\n };\n /**\n * @inheritDoc\n */\n BaseClient.prototype.captureEvent = function (event, hint, scope) {\n return __awaiter(this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n // Adding this here is technically not correct since if you call captureMessage/captureException it's already\n // buffered. But since we not really need the count and we only need to know if the buffer is full or not,\n // This is fine...\n return [2 /*return*/, this.buffer((function () { return __awaiter(_this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n return [2 /*return*/, this.processEvent(event, function (finalEvent) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {\n return [2 /*return*/, this.getBackend().sendEvent(finalEvent)];\n }); }); }, hint, scope)];\n });\n }); })())];\n });\n });\n };\n /**\n * @inheritDoc\n */\n BaseClient.prototype.addBreadcrumb = function (breadcrumb, hint, scope) {\n return __awaiter(this, void 0, void 0, function () {\n var _a, beforeBreadcrumb, _b, maxBreadcrumbs, timestamp, mergedBreadcrumb, finalBreadcrumb, _c;\n return __generator(this, function (_d) {\n switch (_d.label) {\n case 0:\n _a = this.getOptions(), beforeBreadcrumb = _a.beforeBreadcrumb, _b = _a.maxBreadcrumbs, maxBreadcrumbs = _b === void 0 ? DEFAULT_BREADCRUMBS : _b;\n if (maxBreadcrumbs <= 0) {\n return [2 /*return*/];\n }\n timestamp = new Date().getTime() / 1000;\n mergedBreadcrumb = __assign({ timestamp: timestamp }, breadcrumb);\n if (!beforeBreadcrumb) return [3 /*break*/, 2];\n return [4 /*yield*/, beforeBreadcrumbConsoleLoopGuard(function () { return beforeBreadcrumb(mergedBreadcrumb, hint); })];\n case 1:\n _c = _d.sent();\n return [3 /*break*/, 3];\n case 2:\n _c = mergedBreadcrumb;\n _d.label = 3;\n case 3:\n finalBreadcrumb = _c;\n if (finalBreadcrumb === null) {\n return [2 /*return*/];\n }\n return [4 /*yield*/, this.getBackend().storeBreadcrumb(finalBreadcrumb)];\n case 4:\n if ((_d.sent()) && scope) {\n scope.addBreadcrumb(finalBreadcrumb, Math.min(maxBreadcrumbs, MAX_BREADCRUMBS));\n }\n return [2 /*return*/];\n }\n });\n });\n };\n /**\n * @inheritDoc\n */\n BaseClient.prototype.getDsn = function () {\n return this.dsn;\n };\n /**\n * @inheritDoc\n */\n BaseClient.prototype.getOptions = function () {\n return this.options;\n };\n /** Returns the current backend. */\n BaseClient.prototype.getBackend = function () {\n return this.backend;\n };\n /** Determines whether this SDK is enabled and a valid Dsn is present. */\n BaseClient.prototype.isEnabled = function () {\n return this.getOptions().enabled !== false && this.dsn !== undefined;\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 informartion about the original exception.\n * @param scope A scope containing event metadata.\n * @returns A new event with more information.\n */\n BaseClient.prototype.prepareEvent = function (event, scope, hint) {\n return __awaiter(this, void 0, void 0, function () {\n var _a, environment, _b, maxBreadcrumbs, release, dist, prepared, exception, request;\n return __generator(this, function (_c) {\n _a = this.getOptions(), environment = _a.environment, _b = _a.maxBreadcrumbs, maxBreadcrumbs = _b === void 0 ? DEFAULT_BREADCRUMBS : _b, release = _a.release, dist = _a.dist;\n prepared = __assign({}, event);\n if (prepared.environment === undefined && environment !== undefined) {\n prepared.environment = environment;\n }\n if (prepared.release === undefined && release !== undefined) {\n prepared.release = release;\n }\n if (prepared.dist === undefined && dist !== undefined) {\n prepared.dist = dist;\n }\n if (prepared.message) {\n prepared.message = string_1.truncate(prepared.message, MAX_URL_LENGTH);\n }\n exception = prepared.exception && prepared.exception.values && prepared.exception.values[0];\n if (exception && exception.value) {\n exception.value = string_1.truncate(exception.value, MAX_URL_LENGTH);\n }\n request = prepared.request;\n if (request && request.url) {\n request.url = string_1.truncate(request.url, MAX_URL_LENGTH);\n }\n if (prepared.event_id === undefined) {\n prepared.event_id = misc_1.uuid4();\n }\n // This should be the last thing called, since we want that\n // {@link Hub.addEventProcessor} gets the finished prepared event.\n if (scope) {\n return [2 /*return*/, scope.applyToEvent(prepared, hint, Math.min(maxBreadcrumbs, MAX_BREADCRUMBS))];\n }\n return [2 /*return*/, prepared];\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 * The returned event status offers clues to whether the event was sent to\n * Sentry and accepted there. If the {@link Options.shouldSend} hook returns\n * `false`, the status will be {@link SendStatus.Skipped}. If the rate limit\n * was exceeded, the status will be {@link SendStatus.RateLimit}.\n *\n * @param event The event to send to Sentry.\n * @param send A function to actually send the event.\n * @param scope A scope containing event metadata.\n * @param hint May contain additional informartion about the original exception.\n * @returns A Promise that resolves with the event status.\n */\n BaseClient.prototype.processEvent = function (event, send, hint, scope) {\n return __awaiter(this, void 0, void 0, function () {\n var _a, beforeSend, sampleRate, prepared, finalEvent, isInternalException, exception_1, response;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n if (!this.isEnabled()) {\n return [2 /*return*/, {\n status: types_1.Status.Skipped,\n }];\n }\n _a = this.getOptions(), beforeSend = _a.beforeSend, sampleRate = _a.sampleRate;\n // 1.0 === 100% events are sent\n // 0.0 === 0% events are sent\n if (typeof sampleRate === 'number' && Math.random() > sampleRate) {\n return [2 /*return*/, {\n status: types_1.Status.Skipped,\n }];\n }\n return [4 /*yield*/, this.prepareEvent(event, scope, hint)];\n case 1:\n prepared = _b.sent();\n if (prepared === null) {\n return [2 /*return*/, {\n status: types_1.Status.Skipped,\n }];\n }\n finalEvent = prepared;\n _b.label = 2;\n case 2:\n _b.trys.push([2, 5, , 6]);\n isInternalException = hint && hint.data && hint.data.__sentry__ === true;\n if (!(!isInternalException && beforeSend)) return [3 /*break*/, 4];\n return [4 /*yield*/, beforeSend(prepared, hint)];\n case 3:\n finalEvent = _b.sent();\n if (typeof finalEvent === 'undefined') {\n logger_1.logger.error('`beforeSend` method has to return `null` or a valid event');\n }\n _b.label = 4;\n case 4: return [3 /*break*/, 6];\n case 5:\n exception_1 = _b.sent();\n async_1.forget(this.captureException(exception_1, {\n data: {\n __sentry__: true,\n },\n originalException: exception_1,\n }));\n return [2 /*return*/, {\n reason: 'Event processing in beforeSend method threw an exception',\n status: types_1.Status.Invalid,\n }];\n case 6:\n if (finalEvent === null) {\n return [2 /*return*/, {\n reason: 'Event dropped due to being discarded by beforeSend method',\n status: types_1.Status.Skipped,\n }];\n }\n return [4 /*yield*/, send(finalEvent)];\n case 7:\n response = _b.sent();\n response.event = finalEvent;\n if (response.status === types_1.Status.RateLimit) {\n // TODO: Handle rate limits and maintain a queue. For now, we require SDK\n // implementors to override this method and handle it themselves.\n }\n return [2 /*return*/, response];\n }\n });\n });\n };\n /**\n * @inheritDoc\n */\n BaseClient.prototype.close = function (timeout) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, this.getBackend()\n .getBuffer()\n .drain(timeout)];\n });\n });\n };\n return BaseClient;\n}());\nexports.BaseClient = BaseClient;\n//# sourceMappingURL=baseclient.js.map","\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/** A simple queue that holds promises. */\nvar RequestBuffer = /** @class */ (function () {\n function RequestBuffer() {\n /** Internal set of queued Promises */\n this.buffer = [];\n }\n /**\n * Add a promise to the queue.\n *\n * @param task Can be any Promise\n * @returns The original promise.\n */\n RequestBuffer.prototype.add = function (task) {\n return __awaiter(this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n if (this.buffer.indexOf(task) === -1) {\n this.buffer.push(task);\n }\n task.then(function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {\n return [2 /*return*/, this.remove(task)];\n }); }); }).catch(function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {\n return [2 /*return*/, this.remove(task)];\n }); }); });\n return [2 /*return*/, task];\n });\n });\n };\n /**\n * Remove a promise to the queue.\n *\n * @param task Can be any Promise\n * @returns Removed promise.\n */\n RequestBuffer.prototype.remove = function (task) {\n return __awaiter(this, void 0, void 0, function () {\n var removedTask;\n return __generator(this, function (_a) {\n removedTask = this.buffer.splice(this.buffer.indexOf(task), 1)[0];\n return [2 /*return*/, removedTask];\n });\n });\n };\n /**\n * This function returns the number of unresolved promises in the queue.\n */\n RequestBuffer.prototype.length = function () {\n return this.buffer.length;\n };\n /**\n * This will drain the whole queue, returns true if queue is empty or drained.\n * If timeout is provided and the queue takes longer to drain, the promise still resolves but with false.\n *\n * @param timeout Number in ms to wait until it resolves with false.\n */\n RequestBuffer.prototype.drain = function (timeout) {\n return __awaiter(this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n return [2 /*return*/, new Promise(function (resolve) {\n var capturedSetTimeout = setTimeout(function () {\n if (timeout && timeout > 0) {\n resolve(false);\n }\n }, timeout);\n Promise.all(_this.buffer)\n .then(function () {\n clearTimeout(capturedSetTimeout);\n resolve(true);\n })\n .catch(function () {\n resolve(true);\n });\n })];\n });\n });\n };\n return RequestBuffer;\n}());\nexports.RequestBuffer = RequestBuffer;\n//# sourceMappingURL=requestbuffer.js.map","\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar error_1 = require(\"./error\");\nvar logger_1 = require(\"./logger\");\nvar requestbuffer_1 = require(\"./requestbuffer\");\n/**\n * This is the base implemention of a Backend.\n */\nvar BaseBackend = /** @class */ (function () {\n /** Creates a new browser backend instance. */\n function BaseBackend(options) {\n /** A simple buffer holding all requests. */\n this.buffer = new requestbuffer_1.RequestBuffer();\n this.options = options;\n if (!this.options.dsn) {\n logger_1.logger.warn('No DSN provided, backend will not do anything.');\n }\n }\n /**\n * @inheritDoc\n */\n BaseBackend.prototype.eventFromException = function (_exception, _hint) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n throw new error_1.SentryError('Backend has to implement `eventFromException` method');\n });\n });\n };\n /**\n * @inheritDoc\n */\n BaseBackend.prototype.eventFromMessage = function (_message, _level, _hint) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n throw new error_1.SentryError('Backend has to implement `eventFromMessage` method');\n });\n });\n };\n /**\n * @inheritDoc\n */\n BaseBackend.prototype.sendEvent = function (_event) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n throw new error_1.SentryError('Backend has to implement `sendEvent` method');\n });\n });\n };\n /**\n * @inheritDoc\n */\n BaseBackend.prototype.storeBreadcrumb = function (_) {\n return true;\n };\n /**\n * @inheritDoc\n */\n BaseBackend.prototype.storeScope = function (_) {\n // Noop\n };\n /**\n * @inheritDoc\n */\n BaseBackend.prototype.getBuffer = function () {\n return this.buffer;\n };\n return BaseBackend;\n}());\nexports.BaseBackend = BaseBackend;\n//# sourceMappingURL=basebackend.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/** Console logging verbosity for the SDK. */\nvar LogLevel;\n(function (LogLevel) {\n /** No logs will be generated. */\n LogLevel[LogLevel[\"None\"] = 0] = \"None\";\n /** Only SDK internal errors will be logged. */\n LogLevel[LogLevel[\"Error\"] = 1] = \"Error\";\n /** Information useful for debugging the SDK will be logged. */\n LogLevel[LogLevel[\"Debug\"] = 2] = \"Debug\";\n /** All SDK actions will be logged. */\n LogLevel[LogLevel[\"Verbose\"] = 3] = \"Verbose\";\n})(LogLevel = exports.LogLevel || (exports.LogLevel = {}));\n//# sourceMappingURL=interfaces.js.map","\"use strict\";\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spread = (this && this.__spread) || function () {\n for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));\n return ar;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar hub_1 = require(\"@sentry/hub\");\nvar logger_1 = require(\"./logger\");\n/**\n * Internal function to create a new SDK client instance. The client is\n * installed and then bound to the current scope.\n *\n * @param clientClass The client class to instanciate.\n * @param options Options to pass to the client.\n * @returns The installed and bound client instance.\n */\nfunction initAndBind(clientClass, options, defaultIntegrations) {\n if (defaultIntegrations === void 0) { defaultIntegrations = []; }\n if (options.debug) {\n logger_1.logger.enable();\n }\n if (hub_1.getCurrentHub().getClient()) {\n return;\n }\n var client = new clientClass(options);\n client.install();\n // This should happen here if any integration uses {@link Hub.addEventProcessor}\n // there needs to be a client on the hub already.\n hub_1.getCurrentHub().bindClient(client);\n var integrations = options.defaultIntegrations === false ? [] : __spread(defaultIntegrations);\n if (Array.isArray(options.integrations)) {\n var providedIntegrationsNames_1 = options.integrations.map(function (i) { return i.name; });\n integrations = __spread(integrations.filter(function (integration) { return providedIntegrationsNames_1.indexOf(integration.name) === -1; }), options.integrations);\n }\n else if (typeof options.integrations === 'function') {\n integrations = options.integrations(integrations);\n }\n // Just in case someone will return non-array from a `itegrations` callback\n if (Array.isArray(integrations)) {\n integrations.forEach(function (integration) {\n integration.install(options);\n logger_1.logger.log(\"Integration installed: \" + integration.name);\n });\n }\n}\nexports.initAndBind = initAndBind;\n//# sourceMappingURL=sdk.js.map","\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar minimal_1 = require(\"@sentry/minimal\");\nvar misc_1 = require(\"@sentry/utils/misc\");\nvar logger_1 = require(\"../logger\");\n/** Deduplication filter */\nvar Dedupe = /** @class */ (function () {\n function Dedupe() {\n /**\n * @inheritDoc\n */\n this.name = 'Dedupe';\n }\n /**\n * @inheritDoc\n */\n Dedupe.prototype.install = function () {\n var _this = this;\n minimal_1.configureScope(function (scope) {\n scope.addEventProcessor(function (currentEvent) { return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n // Juuust in case something goes wrong\n try {\n if (this.shouldDropEvent(currentEvent, this.previousEvent)) {\n return [2 /*return*/, null];\n }\n }\n catch (_oO) {\n return [2 /*return*/, (this.previousEvent = currentEvent)];\n }\n return [2 /*return*/, (this.previousEvent = currentEvent)];\n });\n }); });\n });\n };\n /** JSDoc */\n Dedupe.prototype.shouldDropEvent = function (currentEvent, previousEvent) {\n if (!previousEvent) {\n return false;\n }\n if (this.isSameMessageEvent(currentEvent, previousEvent)) {\n logger_1.logger.warn(\"Event dropped due to being a duplicate of previous event (same message).\\nEvent: \" + misc_1.getEventDescription(currentEvent));\n return true;\n }\n if (this.isSameExceptionEvent(currentEvent, previousEvent)) {\n logger_1.logger.warn(\"Event dropped due to being a duplicate of previous event (same exception).\\nEvent: \" + misc_1.getEventDescription(currentEvent));\n return true;\n }\n return false;\n };\n /** JSDoc */\n Dedupe.prototype.isSameMessageEvent = function (currentEvent, previousEvent) {\n var currentMessage = currentEvent.message;\n var previousMessage = previousEvent.message;\n // If no event has a message, they were both exceptions, so bail out\n if (!currentMessage && !previousMessage) {\n return false;\n }\n // If only one event has a stacktrace, but not the other one, they are not the same\n if ((currentMessage && !previousMessage) || (!currentMessage && previousMessage)) {\n return false;\n }\n if (currentMessage !== previousMessage) {\n return false;\n }\n if (!this.isSameFingerprint(currentEvent, previousEvent)) {\n return false;\n }\n if (!this.isSameStacktrace(currentEvent, previousEvent)) {\n return false;\n }\n return true;\n };\n /** JSDoc */\n Dedupe.prototype.getFramesFromEvent = function (event) {\n var exception = event.exception;\n if (exception) {\n try {\n // @ts-ignore\n return exception.values[0].stacktrace.frames;\n }\n catch (_oO) {\n return undefined;\n }\n }\n else if (event.stacktrace) {\n return event.stacktrace.frames;\n }\n else {\n return undefined;\n }\n };\n /** JSDoc */\n Dedupe.prototype.isSameStacktrace = function (currentEvent, previousEvent) {\n var currentFrames = this.getFramesFromEvent(currentEvent);\n var previousFrames = this.getFramesFromEvent(previousEvent);\n // If no event has a fingerprint, they are assumed to be the same\n if (!currentFrames && !previousFrames) {\n return true;\n }\n // If only one event has a stacktrace, but not the other one, they are not the same\n if ((currentFrames && !previousFrames) || (!currentFrames && previousFrames)) {\n return false;\n }\n currentFrames = currentFrames;\n previousFrames = previousFrames;\n // If number of frames differ, they are not the same\n if (previousFrames.length !== currentFrames.length) {\n return false;\n }\n // Otherwise, compare the two\n for (var i = 0; i < previousFrames.length; i++) {\n var frameA = previousFrames[i];\n var frameB = currentFrames[i];\n if (frameA.filename !== frameB.filename ||\n frameA.lineno !== frameB.lineno ||\n frameA.colno !== frameB.colno ||\n frameA.function !== frameB.function) {\n return false;\n }\n }\n return true;\n };\n /** JSDoc */\n Dedupe.prototype.getExceptionFromEvent = function (event) {\n return event.exception && event.exception.values && event.exception.values[0];\n };\n /** JSDoc */\n Dedupe.prototype.isSameExceptionEvent = function (currentEvent, previousEvent) {\n var previousException = this.getExceptionFromEvent(previousEvent);\n var currentException = this.getExceptionFromEvent(currentEvent);\n if (!previousException || !currentException) {\n return false;\n }\n if (previousException.type !== currentException.type || previousException.value !== currentException.value) {\n return false;\n }\n if (!this.isSameFingerprint(currentEvent, previousEvent)) {\n return false;\n }\n if (!this.isSameStacktrace(currentEvent, previousEvent)) {\n return false;\n }\n return true;\n };\n /** JSDoc */\n Dedupe.prototype.isSameFingerprint = function (currentEvent, previousEvent) {\n var currentFingerprint = currentEvent.fingerprint;\n var previousFingerprint = previousEvent.fingerprint;\n // If no event has a fingerprint, they are assumed to be the same\n if (!currentFingerprint && !previousFingerprint) {\n return true;\n }\n // If only one event has a fingerprint, but not the other one, they are not the same\n if ((currentFingerprint && !previousFingerprint) || (!currentFingerprint && previousFingerprint)) {\n return false;\n }\n currentFingerprint = currentFingerprint;\n previousFingerprint = previousFingerprint;\n // Otherwise, compare the two\n try {\n return !!(currentFingerprint.join('') === previousFingerprint.join(''));\n }\n catch (_oO) {\n return false;\n }\n };\n return Dedupe;\n}());\nexports.Dedupe = Dedupe;\n//# sourceMappingURL=dedupe.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar originalFunctionToString;\n/** Patch toString calls to return proper name for wrapped functions */\nvar FunctionToString = /** @class */ (function () {\n function FunctionToString() {\n /**\n * @inheritDoc\n */\n this.name = 'FunctionToString';\n }\n /**\n * @inheritDoc\n */\n FunctionToString.prototype.install = function () {\n originalFunctionToString = Function.prototype.toString;\n Function.prototype.toString = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var context = this.__sentry__ ? this.__sentry_original__ : this;\n // tslint:disable-next-line:no-unsafe-any\n return originalFunctionToString.apply(context, args);\n };\n };\n return FunctionToString;\n}());\nexports.FunctionToString = FunctionToString;\n//# sourceMappingURL=functiontostring.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar logger_1 = require(\"../logger\");\n/**\n * @deprecated\n * This file can be safely removed in the next major bump\n */\n/** Adds SDK info to an event. */\nvar SDKInformation = /** @class */ (function () {\n function SDKInformation() {\n /**\n * @inheritDoc\n */\n this.name = 'SDKInformation';\n }\n /**\n * @inheritDoc\n */\n SDKInformation.prototype.install = function () {\n logger_1.logger.warn(\"SDKInformation Integration is deprecated and can be safely removed. It's functionality has been merged into the SDK's core.\");\n };\n return SDKInformation;\n}());\nexports.SDKInformation = SDKInformation;\n//# sourceMappingURL=sdkinformation.js.map","\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spread = (this && this.__spread) || function () {\n for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));\n return ar;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar minimal_1 = require(\"@sentry/minimal\");\nvar is_1 = require(\"@sentry/utils/is\");\nvar misc_1 = require(\"@sentry/utils/misc\");\nvar string_1 = require(\"@sentry/utils/string\");\nvar logger_1 = require(\"../logger\");\n// \"Script error.\" is hard coded into browsers for errors that it can't read.\n// this is the result of a script being pulled in from an external domain and CORS.\nvar DEFAULT_IGNORE_ERRORS = [/^Script error\\.?$/, /^Javascript error: Script error\\.? on line 0$/];\n/** Inbound filters configurable by the user */\nvar InboundFilters = /** @class */ (function () {\n function InboundFilters() {\n /** JSDoc */\n this.ignoreErrors = DEFAULT_IGNORE_ERRORS;\n /**\n * @inheritDoc\n */\n this.name = 'InboundFilters';\n }\n /**\n * @inheritDoc\n */\n InboundFilters.prototype.install = function (options) {\n var _this = this;\n if (options === void 0) { options = {}; }\n this.configureOptions(options);\n minimal_1.configureScope(function (scope) {\n scope.addEventProcessor(function (event) { return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n if (this.shouldDropEvent(event)) {\n return [2 /*return*/, null];\n }\n return [2 /*return*/, event];\n });\n }); });\n });\n };\n /** JSDoc */\n InboundFilters.prototype.shouldDropEvent = function (event) {\n if (this.isIgnoredError(event)) {\n logger_1.logger.warn(\"Event dropped due to being matched by `ignoreErrors` option.\\nEvent: \" + misc_1.getEventDescription(event));\n return true;\n }\n if (this.isBlacklistedUrl(event)) {\n logger_1.logger.warn(\"Event dropped due to being matched by `blacklistUrls` option.\\nEvent: \" + misc_1.getEventDescription(event) + \".\\nUrl: \" + this.getEventFilterUrl(event));\n return true;\n }\n if (!this.isWhitelistedUrl(event)) {\n logger_1.logger.warn(\"Event dropped due to not being matched by `whitelistUrls` option.\\nEvent: \" + misc_1.getEventDescription(event) + \".\\nUrl: \" + this.getEventFilterUrl(event));\n return true;\n }\n return false;\n };\n /** JSDoc */\n InboundFilters.prototype.isIgnoredError = function (event) {\n var _this = this;\n if (!this.ignoreErrors) {\n return false;\n }\n return this.getPossibleEventMessages(event).some(function (message) {\n // Not sure why TypeScript complains here...\n return _this.ignoreErrors.some(function (pattern) { return _this.isMatchingPattern(message, pattern); });\n });\n };\n /** JSDoc */\n InboundFilters.prototype.isBlacklistedUrl = function (event) {\n var _this = this;\n // TODO: Use Glob instead?\n if (!this.blacklistUrls) {\n return false;\n }\n var url = this.getEventFilterUrl(event);\n return !url ? false : this.blacklistUrls.some(function (pattern) { return _this.isMatchingPattern(url, pattern); });\n };\n /** JSDoc */\n InboundFilters.prototype.isWhitelistedUrl = function (event) {\n var _this = this;\n // TODO: Use Glob instead?\n if (!this.whitelistUrls) {\n return true;\n }\n var url = this.getEventFilterUrl(event);\n return !url ? true : this.whitelistUrls.some(function (pattern) { return _this.isMatchingPattern(url, pattern); });\n };\n /** JSDoc */\n InboundFilters.prototype.isMatchingPattern = function (value, pattern) {\n if (is_1.isRegExp(pattern)) {\n return pattern.test(value);\n }\n else if (typeof pattern === 'string') {\n return string_1.includes(value, pattern);\n }\n else {\n return false;\n }\n };\n /** JSDoc */\n InboundFilters.prototype.configureOptions = function (options) {\n if (options.ignoreErrors) {\n this.ignoreErrors = __spread(DEFAULT_IGNORE_ERRORS, options.ignoreErrors);\n }\n if (options.blacklistUrls) {\n this.blacklistUrls = __spread(options.blacklistUrls);\n }\n if (options.whitelistUrls) {\n this.whitelistUrls = __spread(options.whitelistUrls);\n }\n };\n /** JSDoc */\n InboundFilters.prototype.getPossibleEventMessages = function (event) {\n if (event.message) {\n return [event.message];\n }\n else if (event.exception) {\n try {\n // tslint:disable-next-line:no-unsafe-any\n var _a = event.exception.values[0], type = _a.type, value = _a.value;\n return [\"\" + value, type + \": \" + value];\n }\n catch (oO) {\n logger_1.logger.error(\"Cannot extract message for event \" + misc_1.getEventDescription(event));\n return [];\n }\n }\n else {\n return [];\n }\n };\n /** JSDoc */\n InboundFilters.prototype.getEventFilterUrl = function (event) {\n try {\n if (event.stacktrace) {\n // tslint:disable-next-line:no-unsafe-any\n return event.stacktrace.frames[0].filename;\n }\n else if (event.exception) {\n // tslint:disable-next-line:no-unsafe-any\n return event.exception.values[0].stacktrace.frames[0].filename;\n }\n else {\n return null;\n }\n }\n catch (oO) {\n logger_1.logger.error(\"Cannot extract url for event \" + misc_1.getEventDescription(event));\n return null;\n }\n };\n return InboundFilters;\n}());\nexports.InboundFilters = InboundFilters;\n//# sourceMappingURL=inboundfilters.js.map","\"use strict\";\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar minimal_1 = require(\"@sentry/minimal\");\n/** JSDoc */\nvar Debug = /** @class */ (function () {\n /**\n * @inheritDoc\n */\n function Debug(options) {\n /**\n * @inheritDoc\n */\n this.name = 'Debug';\n this.options = __assign({ debugger: false, stringify: false }, options);\n }\n /**\n * @inheritDoc\n */\n Debug.prototype.install = function () {\n var _this = this;\n minimal_1.configureScope(function (scope) {\n scope.addEventProcessor(function (event, hint) { return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n // tslint:disable:no-console\n // tslint:disable:no-debugger\n if (this.options.debugger) {\n debugger;\n }\n if (this.options.stringify) {\n console.log(JSON.stringify(event, null, 2));\n if (hint) {\n console.log(JSON.stringify(hint, null, 2));\n }\n }\n else {\n console.log(event);\n if (hint) {\n console.log(hint);\n }\n }\n return [2 /*return*/, event];\n });\n }); });\n });\n };\n return Debug;\n}());\nexports.Debug = Debug;\n//# sourceMappingURL=debug.js.map","\"use strict\";\n// Slightly modified (no IE8 support, ES6) and transcribed to TypeScript\n// https://raw.githubusercontent.com/calvinmetcalf/rollup-plugin-node-builtins/master/src/es6/path.js\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/** JSDoc */\nfunction normalizeArray(parts, allowAboveRoot) {\n // if the path tries to go above the root, `up` ends up > 0\n var up = 0;\n for (var i = parts.length - 1; i >= 0; i--) {\n var last = parts[i];\n if (last === '.') {\n parts.splice(i, 1);\n }\n else if (last === '..') {\n parts.splice(i, 1);\n up++;\n }\n else if (up) {\n parts.splice(i, 1);\n up--;\n }\n }\n // if the path is allowed to go above the root, restore leading ..s\n if (allowAboveRoot) {\n for (; up--; up) {\n parts.unshift('..');\n }\n }\n return parts;\n}\n// Split a filename into [root, dir, basename, ext], unix version\n// 'root' is just a slash, or nothing.\nvar splitPathRe = /^(\\/?|)([\\s\\S]*?)((?:\\.{1,2}|[^\\/]+?|)(\\.[^.\\/]*|))(?:[\\/]*)$/;\n/** JSDoc */\nfunction splitPath(filename) {\n var parts = splitPathRe.exec(filename);\n return parts ? parts.slice(1) : [];\n}\n// path.resolve([from ...], to)\n// posix version\n/** JSDoc */\nfunction resolve() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var resolvedPath = '';\n var resolvedAbsolute = false;\n for (var i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path = i >= 0 ? args[i] : '/';\n // Skip empty entries\n if (!path) {\n continue;\n }\n resolvedPath = path + \"/\" + resolvedPath;\n resolvedAbsolute = path.charAt(0) === '/';\n }\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n // Normalize the path\n resolvedPath = normalizeArray(resolvedPath.split('/').filter(function (p) { return !!p; }), !resolvedAbsolute).join('/');\n return (resolvedAbsolute ? '/' : '') + resolvedPath || '.';\n}\nexports.resolve = resolve;\n/** JSDoc */\nfunction trim(arr) {\n var start = 0;\n for (; start < arr.length; start++) {\n if (arr[start] !== '') {\n break;\n }\n }\n var end = arr.length - 1;\n for (; end >= 0; end--) {\n if (arr[end] !== '') {\n break;\n }\n }\n if (start > end) {\n return [];\n }\n return arr.slice(start, end - start + 1);\n}\n// path.relative(from, to)\n// posix version\n/** JSDoc */\nfunction relative(from, to) {\n // tslint:disable:no-parameter-reassignment\n from = resolve(from).substr(1);\n to = resolve(to).substr(1);\n var fromParts = trim(from.split('/'));\n var toParts = trim(to.split('/'));\n var length = Math.min(fromParts.length, toParts.length);\n var samePartsLength = length;\n for (var i = 0; i < length; i++) {\n if (fromParts[i] !== toParts[i]) {\n samePartsLength = i;\n break;\n }\n }\n var outputParts = [];\n for (var i = samePartsLength; i < fromParts.length; i++) {\n outputParts.push('..');\n }\n outputParts = outputParts.concat(toParts.slice(samePartsLength));\n return outputParts.join('/');\n}\nexports.relative = relative;\n// path.normalize(path)\n// posix version\n/** JSDoc */\nfunction normalize(path) {\n var isPathAbsolute = isAbsolute(path);\n var trailingSlash = path.substr(-1) === '/';\n // Normalize the path\n var normalizedPath = normalizeArray(path.split('/').filter(function (p) { return !!p; }), !isPathAbsolute).join('/');\n if (!normalizedPath && !isPathAbsolute) {\n normalizedPath = '.';\n }\n if (normalizedPath && trailingSlash) {\n normalizedPath += '/';\n }\n return (isPathAbsolute ? '/' : '') + normalizedPath;\n}\nexports.normalize = normalize;\n// posix version\n/** JSDoc */\nfunction isAbsolute(path) {\n return path.charAt(0) === '/';\n}\nexports.isAbsolute = isAbsolute;\n// posix version\n/** JSDoc */\nfunction join() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return normalize(args.join('/'));\n}\nexports.join = join;\n/** JSDoc */\nfunction dirname(path) {\n var result = splitPath(path);\n var root = result[0];\n var dir = result[1];\n if (!root && !dir) {\n // No dirname whatsoever\n return '.';\n }\n if (dir) {\n // It has a dirname, strip trailing slash\n dir = dir.substr(0, dir.length - 1);\n }\n return root + dir;\n}\nexports.dirname = dirname;\n/** JSDoc */\nfunction basename(path, ext) {\n var f = splitPath(path)[2];\n if (ext && f.substr(ext.length * -1) === ext) {\n f = f.substr(0, f.length - ext.length);\n }\n return f;\n}\nexports.basename = basename;\n//# sourceMappingURL=path.js.map","\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar hub_1 = require(\"@sentry/hub\");\nvar path_1 = require(\"@sentry/utils/path\");\n/** Rewrite event frames paths */\nvar RewriteFrames = /** @class */ (function () {\n /**\n * @inheritDoc\n */\n function RewriteFrames(options) {\n if (options === void 0) { options = {}; }\n var _this = this;\n /**\n * @inheritDoc\n */\n this.name = 'RewriteFrames';\n /**\n * @inheritDoc\n */\n this.iteratee = function (frame) { return __awaiter(_this, void 0, void 0, function () {\n var base;\n return __generator(this, function (_a) {\n if (frame.filename && frame.filename.startsWith('/')) {\n base = this.root ? path_1.relative(this.root, frame.filename) : path_1.basename(frame.filename);\n frame.filename = \"app:///\" + base;\n }\n return [2 /*return*/, frame];\n });\n }); };\n if (options.root) {\n this.root = options.root;\n }\n if (options.iteratee) {\n this.iteratee = options.iteratee;\n }\n }\n /**\n * @inheritDoc\n */\n RewriteFrames.prototype.install = function () {\n var _this = this;\n hub_1.getCurrentHub().configureScope(function (scope) {\n scope.addEventProcessor(function (event) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {\n return [2 /*return*/, this.process(event)];\n }); }); });\n });\n };\n /** JSDoc */\n RewriteFrames.prototype.process = function (event) {\n return __awaiter(this, void 0, void 0, function () {\n var frames, _a, _b, _i, i, _c, _d;\n return __generator(this, function (_e) {\n switch (_e.label) {\n case 0:\n frames = this.getFramesFromEvent(event);\n if (!frames) return [3 /*break*/, 4];\n _a = [];\n for (_b in frames)\n _a.push(_b);\n _i = 0;\n _e.label = 1;\n case 1:\n if (!(_i < _a.length)) return [3 /*break*/, 4];\n i = _a[_i];\n // tslint:disable-next-line\n _c = frames;\n _d = i;\n return [4 /*yield*/, this.iteratee(frames[i])];\n case 2:\n // tslint:disable-next-line\n _c[_d] = _e.sent();\n _e.label = 3;\n case 3:\n _i++;\n return [3 /*break*/, 1];\n case 4: return [2 /*return*/, event];\n }\n });\n });\n };\n /** JSDoc */\n RewriteFrames.prototype.getFramesFromEvent = function (event) {\n var exception = event.exception;\n if (exception) {\n try {\n // tslint:disable-next-line:no-unsafe-any\n return exception.values[0].stacktrace.frames;\n }\n catch (_oO) {\n return undefined;\n }\n }\n else if (event.stacktrace) {\n return event.stacktrace.frames;\n }\n else {\n return undefined;\n }\n };\n return RewriteFrames;\n}());\nexports.RewriteFrames = RewriteFrames;\n//# sourceMappingURL=rewriteframes.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar dedupe_1 = require(\"./dedupe\");\nexports.Dedupe = dedupe_1.Dedupe;\nvar functiontostring_1 = require(\"./functiontostring\");\nexports.FunctionToString = functiontostring_1.FunctionToString;\nvar sdkinformation_1 = require(\"./sdkinformation\");\nexports.SDKInformation = sdkinformation_1.SDKInformation;\nvar inboundfilters_1 = require(\"./inboundfilters\");\nexports.InboundFilters = inboundfilters_1.InboundFilters;\nvar debug_1 = require(\"./pluggable/debug\");\nexports.Debug = debug_1.Debug;\nvar rewriteframes_1 = require(\"./pluggable/rewriteframes\");\nexports.RewriteFrames = rewriteframes_1.RewriteFrames;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar logger_1 = require(\"./logger\");\nexports.logger = logger_1.logger;\nvar minimal_1 = require(\"@sentry/minimal\");\nexports.addBreadcrumb = minimal_1.addBreadcrumb;\nexports.captureException = minimal_1.captureException;\nexports.captureEvent = minimal_1.captureEvent;\nexports.captureMessage = minimal_1.captureMessage;\nexports.configureScope = minimal_1.configureScope;\nexports.withScope = minimal_1.withScope;\nvar hub_1 = require(\"@sentry/hub\");\nexports.getCurrentHub = hub_1.getCurrentHub;\nexports.Hub = hub_1.Hub;\nexports.getHubFromCarrier = hub_1.getHubFromCarrier;\nexports.Scope = hub_1.Scope;\nvar api_1 = require(\"./api\");\nexports.API = api_1.API;\nvar baseclient_1 = require(\"./baseclient\");\nexports.BaseClient = baseclient_1.BaseClient;\nvar basebackend_1 = require(\"./basebackend\");\nexports.BaseBackend = basebackend_1.BaseBackend;\nvar dsn_1 = require(\"./dsn\");\nexports.Dsn = dsn_1.Dsn;\nvar error_1 = require(\"./error\");\nexports.SentryError = error_1.SentryError;\nvar requestbuffer_1 = require(\"./requestbuffer\");\nexports.RequestBuffer = requestbuffer_1.RequestBuffer;\nvar interfaces_1 = require(\"./interfaces\");\nexports.LogLevel = interfaces_1.LogLevel;\nvar sdk_1 = require(\"./sdk\");\nexports.initAndBind = sdk_1.initAndBind;\nvar Integrations = require(\"./integrations\");\nexports.Integrations = Integrations;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar misc_1 = require(\"./misc\");\n/**\n * Tells whether current environment supports ErrorEvent objects\n * {@link supportsErrorEvent}.\n *\n * @returns Answer to the given question.\n */\nfunction supportsErrorEvent() {\n try {\n // tslint:disable:no-unused-expression\n new ErrorEvent('');\n return true;\n }\n catch (e) {\n return false;\n }\n}\nexports.supportsErrorEvent = supportsErrorEvent;\n/**\n * Tells whether current environment supports DOMError objects\n * {@link supportsDOMError}.\n *\n * @returns Answer to the given question.\n */\nfunction supportsDOMError() {\n try {\n // It really needs 1 argument, not 0.\n // Chrome: VM89:1 Uncaught TypeError: Failed to construct 'DOMError':\n // 1 argument required, but only 0 present.\n // @ts-ignore\n // tslint:disable:no-unused-expression\n new DOMError('');\n return true;\n }\n catch (e) {\n return false;\n }\n}\nexports.supportsDOMError = supportsDOMError;\n/**\n * Tells whether current environment supports DOMException objects\n * {@link supportsDOMException}.\n *\n * @returns Answer to the given question.\n */\nfunction supportsDOMException() {\n try {\n // tslint:disable:no-unused-expression\n new DOMException('');\n return true;\n }\n catch (e) {\n return false;\n }\n}\nexports.supportsDOMException = supportsDOMException;\n/**\n * Tells whether current environment supports Fetch API\n * {@link supportsFetch}.\n *\n * @returns Answer to the given question.\n */\nfunction supportsFetch() {\n if (!('fetch' in misc_1.getGlobalObject())) {\n return false;\n }\n try {\n // tslint:disable-next-line:no-unused-expression\n new Headers();\n // tslint:disable-next-line:no-unused-expression\n new Request('');\n // tslint:disable-next-line:no-unused-expression\n new Response();\n return true;\n }\n catch (e) {\n return false;\n }\n}\nexports.supportsFetch = supportsFetch;\n/**\n * Tells whether current environment supports Fetch API natively\n * {@link supportsNativeFetch}.\n *\n * @returns Answer to the given question.\n */\nfunction supportsNativeFetch() {\n if (!supportsFetch()) {\n return false;\n }\n var global = misc_1.getGlobalObject();\n var fetch = global.fetch;\n // tslint:disable-next-line:no-unsafe-any\n return fetch.toString().indexOf('native') !== -1;\n}\nexports.supportsNativeFetch = supportsNativeFetch;\n/**\n * Tells whether current environment supports sendBeacon API\n * {@link supportsBeacon}.\n *\n * @returns Answer to the given question.\n */\nfunction supportsBeacon() {\n var global = misc_1.getGlobalObject();\n return 'navigator' in global && 'sendBeacon' in global.navigator;\n}\nexports.supportsBeacon = supportsBeacon;\n/**\n * Tells whether current environment supports ReportingObserver API\n * {@link supportsReportingObserver}.\n *\n * @returns Answer to the given question.\n */\nfunction supportsReportingObserver() {\n return 'ReportingObserver' in misc_1.getGlobalObject();\n}\nexports.supportsReportingObserver = supportsReportingObserver;\n/**\n * Tells whether current environment supports Referrer Policy API\n * {@link supportsReferrerPolicy}.\n *\n * @returns Answer to the given question.\n */\nfunction supportsReferrerPolicy() {\n // Despite all stars in the sky saying that Edge supports old draft syntax, aka 'never', 'always', 'origin' and 'default\n // https://caniuse.com/#feat=referrer-policy\n // It doesn't. And it throw exception instead of ignoring this parameter...\n // REF: https://github.com/getsentry/raven-js/issues/1233\n if (!supportsFetch()) {\n return false;\n }\n try {\n // tslint:disable:no-unused-expression\n new Request('pickleRick', {\n referrerPolicy: 'origin',\n });\n return true;\n }\n catch (e) {\n return false;\n }\n}\nexports.supportsReferrerPolicy = supportsReferrerPolicy;\n/**\n * Tells whether current environment supports History API\n * {@link supportsHistory}.\n *\n * @returns Answer to the given question.\n */\nfunction supportsHistory() {\n // NOTE: in Chrome App environment, touching history.pushState, *even inside\n // a try/catch block*, will cause Chrome to output an error to console.error\n // borrowed from: https://github.com/angular/angular.js/pull/13945/files\n var global = misc_1.getGlobalObject();\n var chrome = global.chrome;\n // tslint:disable-next-line:no-unsafe-any\n var isChromePackagedApp = chrome && chrome.app && chrome.app.runtime;\n var hasHistoryApi = 'history' in global && !!global.history.pushState && !!global.history.replaceState;\n return !isChromePackagedApp && hasHistoryApi;\n}\nexports.supportsHistory = supportsHistory;\n//# sourceMappingURL=supports.js.map","// tslint:disable\n\n/*\n * JavaScript MD5\n * https://github.com/blueimp/JavaScript-MD5\n *\n * Copyright 2011, Sebastian Tschan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n *\n * Based on\n * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message\n * Digest Algorithm, as defined in RFC 1321.\n * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009\n * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\n * Distributed under the BSD License\n * See http://pajhome.org.uk/crypt/md5 for more info.\n */\n\n/**\n * Add integers, wrapping at 2^32. This uses 16-bit operations internally\n * to work around bugs in some JS interpreters.\n */\nfunction safeAdd(x: number, y: number) {\n const lsw = (x & 0xffff) + (y & 0xffff);\n const msw = (x >> 16) + (y >> 16) + (lsw >> 16);\n return (msw << 16) | (lsw & 0xffff);\n}\n\n/**\n * Bitwise rotate a 32-bit number to the left.\n */\nfunction bitRotateLeft(num: number, cnt: number) {\n return (num << cnt) | (num >>> (32 - cnt));\n}\n\n/**\n * These functions implement the four basic operations the algorithm uses.\n */\nfunction md5cmn(q: number, a: number, b: number, x: number, s: number, t: number) {\n return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);\n}\nfunction md5ff(a: number, b: number, c: number, d: number, x: number, s: number, t: number) {\n return md5cmn((b & c) | (~b & d), a, b, x, s, t);\n}\nfunction md5gg(a: number, b: number, c: number, d: number, x: number, s: number, t: number) {\n return md5cmn((b & d) | (c & ~d), a, b, x, s, t);\n}\nfunction md5hh(a: number, b: number, c: number, d: number, x: number, s: number, t: number) {\n return md5cmn(b ^ c ^ d, a, b, x, s, t);\n}\nfunction md5ii(a: number, b: number, c: number, d: number, x: number, s: number, t: number) {\n return md5cmn(c ^ (b | ~d), a, b, x, s, t);\n}\n\n/**\n * Calculate the MD5 of an array of little-endian words, and a bit length.\n */\nfunction binlMD5(x: any[], len: number) {\n /** append padding */\n x[len >> 5] |= 0x80 << len % 32;\n x[(((len + 64) >>> 9) << 4) + 14] = len;\n\n let i;\n let olda;\n let oldb;\n let oldc;\n let oldd;\n let a = 1732584193;\n let b = -271733879;\n let c = -1732584194;\n let d = 271733878;\n\n for (i = 0; i < x.length; i += 16) {\n olda = a;\n oldb = b;\n oldc = c;\n oldd = d;\n\n a = md5ff(a, b, c, d, x[i], 7, -680876936);\n d = md5ff(d, a, b, c, x[i + 1], 12, -389564586);\n c = md5ff(c, d, a, b, x[i + 2], 17, 606105819);\n b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330);\n a = md5ff(a, b, c, d, x[i + 4], 7, -176418897);\n d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426);\n c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341);\n b = md5ff(b, c, d, a, x[i + 7], 22, -45705983);\n a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416);\n d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417);\n c = md5ff(c, d, a, b, x[i + 10], 17, -42063);\n b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162);\n a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682);\n d = md5ff(d, a, b, c, x[i + 13], 12, -40341101);\n c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290);\n b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329);\n\n a = md5gg(a, b, c, d, x[i + 1], 5, -165796510);\n d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632);\n c = md5gg(c, d, a, b, x[i + 11], 14, 643717713);\n b = md5gg(b, c, d, a, x[i], 20, -373897302);\n a = md5gg(a, b, c, d, x[i + 5], 5, -701558691);\n d = md5gg(d, a, b, c, x[i + 10], 9, 38016083);\n c = md5gg(c, d, a, b, x[i + 15], 14, -660478335);\n b = md5gg(b, c, d, a, x[i + 4], 20, -405537848);\n a = md5gg(a, b, c, d, x[i + 9], 5, 568446438);\n d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690);\n c = md5gg(c, d, a, b, x[i + 3], 14, -187363961);\n b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501);\n a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467);\n d = md5gg(d, a, b, c, x[i + 2], 9, -51403784);\n c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473);\n b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734);\n\n a = md5hh(a, b, c, d, x[i + 5], 4, -378558);\n d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463);\n c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562);\n b = md5hh(b, c, d, a, x[i + 14], 23, -35309556);\n a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060);\n d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353);\n c = md5hh(c, d, a, b, x[i + 7], 16, -155497632);\n b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640);\n a = md5hh(a, b, c, d, x[i + 13], 4, 681279174);\n d = md5hh(d, a, b, c, x[i], 11, -358537222);\n c = md5hh(c, d, a, b, x[i + 3], 16, -722521979);\n b = md5hh(b, c, d, a, x[i + 6], 23, 76029189);\n a = md5hh(a, b, c, d, x[i + 9], 4, -640364487);\n d = md5hh(d, a, b, c, x[i + 12], 11, -421815835);\n c = md5hh(c, d, a, b, x[i + 15], 16, 530742520);\n b = md5hh(b, c, d, a, x[i + 2], 23, -995338651);\n\n a = md5ii(a, b, c, d, x[i], 6, -198630844);\n d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415);\n c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905);\n b = md5ii(b, c, d, a, x[i + 5], 21, -57434055);\n a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571);\n d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606);\n c = md5ii(c, d, a, b, x[i + 10], 15, -1051523);\n b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799);\n a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359);\n d = md5ii(d, a, b, c, x[i + 15], 10, -30611744);\n c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380);\n b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649);\n a = md5ii(a, b, c, d, x[i + 4], 6, -145523070);\n d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379);\n c = md5ii(c, d, a, b, x[i + 2], 15, 718787259);\n b = md5ii(b, c, d, a, x[i + 9], 21, -343485551);\n\n a = safeAdd(a, olda);\n b = safeAdd(b, oldb);\n c = safeAdd(c, oldc);\n d = safeAdd(d, oldd);\n }\n return [a, b, c, d];\n}\n\n/**\n * Convert an array of little-endian words to a string\n */\nfunction binl2rstr(input: any[]) {\n let i;\n let output = '';\n const length32 = input.length * 32;\n for (i = 0; i < length32; i += 8) {\n output += String.fromCharCode((input[i >> 5] >>> i % 32) & 0xff);\n }\n return output;\n}\n\n/**\n * Convert a raw string to an array of little-endian words\n * Characters >255 have their high-byte silently ignored.\n */\nfunction rstr2binl(input: string) {\n let i;\n const output: any[] = [];\n output[(input.length >> 2) - 1] = undefined;\n for (i = 0; i < output.length; i += 1) {\n output[i] = 0;\n }\n const length8 = input.length * 8;\n for (i = 0; i < length8; i += 8) {\n output[i >> 5] |= (input.charCodeAt(i / 8) & 0xff) << i % 32;\n }\n return output;\n}\n\n/**\n * Calculate the MD5 of a raw string\n */\nfunction rstrMD5(s: string) {\n return binl2rstr(binlMD5(rstr2binl(s), s.length * 8));\n}\n\n/**\n * Calculate the HMAC-MD5, of a key and some data (raw strings)\n */\nfunction rstrHMACMD5(key: string, data: string) {\n let i;\n let bkey = rstr2binl(key);\n const ipad = [];\n const opad = [];\n let hash;\n ipad[15] = opad[15] = undefined;\n if (bkey.length > 16) {\n bkey = binlMD5(bkey, key.length * 8);\n }\n for (i = 0; i < 16; i += 1) {\n ipad[i] = bkey[i] ^ 0x36363636;\n opad[i] = bkey[i] ^ 0x5c5c5c5c;\n }\n hash = binlMD5(ipad.concat(rstr2binl(data)), 512 + data.length * 8);\n return binl2rstr(binlMD5(opad.concat(hash), 512 + 128));\n}\n\n/**\n * Convert a raw string to a hex string\n */\nfunction rstr2hex(input: string) {\n const hexTab = '0123456789abcdef';\n let output = '';\n let x;\n let i;\n for (i = 0; i < input.length; i += 1) {\n x = input.charCodeAt(i);\n output += hexTab.charAt((x >>> 4) & 0x0f) + hexTab.charAt(x & 0x0f);\n }\n return output;\n}\n\n/**\n * Encode a string as utf-8\n */\nfunction str2rstrUTF8(input: string) {\n return unescape(encodeURIComponent(input));\n}\n\n/*\n* Take string arguments and return either raw or hex encoded strings\n*/\nfunction rawMD5(s: string) {\n return rstrMD5(str2rstrUTF8(s));\n}\nfunction hexMD5(s: string) {\n return rstr2hex(rawMD5(s));\n}\nfunction rawHMACMD5(k: string, d: string) {\n return rstrHMACMD5(str2rstrUTF8(k), str2rstrUTF8(d));\n}\nfunction hexHMACMD5(k: string, d: string) {\n return rstr2hex(rawHMACMD5(k, d));\n}\n\nfunction md5(string: string, key?: string, raw?: boolean) {\n if (!key) {\n if (!raw) {\n return hexMD5(string);\n }\n return rawMD5(string);\n }\n if (!raw) {\n return hexHMACMD5(key, string);\n }\n return rawHMACMD5(key, string);\n}\n\nexport { md5 };\n","// tslint:disable\n\nimport { isUndefined, isError, isErrorEvent } from '@sentry/utils/is';\nimport { getGlobalObject } from '@sentry/utils/misc';\n\nexport interface StackFrame {\n url: string;\n func: string;\n args: string[];\n line: number;\n column: number;\n context: string[];\n}\n\nexport interface StackTrace {\n /**\n * Known modes: callers, failed, multiline, onerror, stack, stacktrace\n */\n mode: string;\n mechanism: string;\n name: string;\n message: string;\n url: string;\n stack: StackFrame[];\n useragent: string;\n}\n\ninterface ComputeStackTrace {\n /**\n * Computes a stack trace for an exception.\n * @param {Error} ex\n * @param {(string|number)=} depth\n */\n (ex: Error, depth?: string | number): StackTrace;\n\n /**\n * Adds information about the first frame to incomplete stack traces.\n * Safari and IE require this to get complete data on the first frame.\n * @param {Object.} stackInfo Stack trace information from\n * one of the compute* methods.\n * @param {string} url The URL of the script that caused an error.\n * @param {(number|string)} lineNo The line number of the script that\n * caused an error.\n * @param {string=} message The error generated by the browser, which\n * hopefully contains the name of the object that caused the error.\n * @return {boolean} Whether or not the stack information was\n * augmented.\n */\n augmentStackTraceWithInitialElement: (\n stackInfo: string,\n url: string,\n lineNo: string | number,\n message?: string,\n ) => boolean;\n\n /**\n * Tries to use an externally loaded copy of source code to determine\n * the name of a function by looking at the name of the variable it was\n * assigned to, if any.\n * @param {string} url URL of source code.\n * @param {(string|number)} lineNo Line number in source code.\n * @return {string} The function name, if discoverable.\n */\n guessFunctionName: (url: string, lineNo: string | number) => string;\n\n /**\n * Retrieves the surrounding lines from where an exception occurred.\n * @param {string} url URL of source code.\n * @param {(string|number)} line Line number in source code to centre\n * around for context.\n * @return {?Array.} Lines of source code.\n */\n gatherContext: (url: string, line: string | number) => string[];\n\n /**\n * Logs a stacktrace starting from the previous call and working down.\n * @param {(number|string)=} depth How many frames deep to trace.\n * @return {Object.} Stack trace information.\n */\n ofCaller: (depth?: string | number) => StackTrace;\n\n /**\n * Retrieves source code from the source code cache.\n * @param {string} url URL of source code.\n * @return {Array.} Source contents.\n */\n getSource: (url: string) => string[];\n}\n\ninterface ReportSubscriber {\n (stackTrace: StackTrace, isWindowError: boolean, error: any): void;\n}\n\ninterface Report {\n /**\n * Reports an unhandled Error to TraceKit.\n * @param {Error} ex\n */\n (ex: Error): void;\n\n /**\n * Add a crash handler.\n * @param {Function} handler\n */\n subscribe(handler: ReportSubscriber): void;\n\n /**\n * Remove a crash handler.\n * @param {Function} handler\n */\n unsubscribe(handler: ReportSubscriber): void;\n}\n\n/**\n * TraceKit - Cross brower stack traces\n *\n * This was originally forked from github.com/occ/TraceKit, but has since been\n * largely modified and is now maintained as part of Sentry JS SDK.\n *\n * NOTE: Last merge with upstream repository\n * Jul 11,2018 - #f03357c\n *\n * https://github.com/csnover/TraceKit\n * @license MIT\n * @namespace TraceKit\n */\n\nvar window = getGlobalObject() as Window;\n\ninterface TraceKit {\n wrap(func: () => void): () => void;\n report: any;\n collectWindowErrors: any;\n computeStackTrace: any;\n remoteFetching: any;\n linesOfContext: any;\n extendToAsynchronousCallbacks: any;\n}\n\nvar TraceKit: TraceKit = {\n wrap: () => () => {},\n report: false,\n collectWindowErrors: false,\n computeStackTrace: false,\n remoteFetching: false,\n linesOfContext: false,\n extendToAsynchronousCallbacks: false,\n};\n\n// var TraceKit: TraceKitInterface = {};\n// var TraceKit = {};\n\n// global reference to slice\nvar _slice = [].slice;\nvar UNKNOWN_FUNCTION = '?';\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Error_types\nvar ERROR_TYPES_RE = /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;\n\n/**\n * A better form of hasOwnProperty
\n * Example: `_has(MainHostObject, property) === true/false`\n *\n * @param {Object} object to check property\n * @param {string} key to check\n * @return {Boolean} true if the object has the key and it is not inherited\n */\nfunction _has(object: any, key: any) {\n return Object.prototype.hasOwnProperty.call(object, key);\n}\n\n/**\n * A safe form of location.href
\n *\n * @return {string} location.href\n */\nfunction getLocationHref() {\n if (typeof document === 'undefined' || document.location == null) return '';\n return document.location.href;\n}\n\n/**\n * A safe form of location.origin
\n *\n * @return {string} location.origin\n */\nfunction getLocationOrigin() {\n if (typeof document === 'undefined' || document.location == null) return '';\n\n // Oh dear IE10...\n if (!document.location.origin) {\n return (\n document.location.protocol +\n '//' +\n document.location.hostname +\n (document.location.port ? ':' + document.location.port : '')\n );\n }\n\n return document.location.origin;\n}\n\n/**\n * Wrap any function in a TraceKit reporter
\n * Example: `func = TraceKit.wrap(func);`\n *\n * @param {Function} func Function to be wrapped\n * @return {Function} The wrapped func\n * @memberof TraceKit\n */\nTraceKit.wrap = function traceKitWrapper(func: any) {\n function wrapped() {\n try {\n // @ts-ignore\n return func.apply(this, arguments);\n } catch (e) {\n TraceKit.report(e);\n throw e;\n }\n }\n return wrapped;\n};\n\n/**\n * Cross-browser processing of unhandled exceptions\n *\n * Syntax:\n * ```js\n * TraceKit.report.subscribe(function(stackInfo) { ... })\n * TraceKit.report.unsubscribe(function(stackInfo) { ... })\n * TraceKit.report(exception)\n * try { ...code... } catch(ex) { TraceKit.report(ex); }\n * ```\n *\n * Supports:\n * - Firefox: full stack trace with line numbers, plus column number\n * on top frame; column number is not guaranteed\n * - Opera: full stack trace with line and column numbers\n * - Chrome: full stack trace with line and column numbers\n * - Safari: line and column number for the top frame only; some frames\n * may be missing, and column number is not guaranteed\n * - IE: line and column number for the top frame only; some frames\n * may be missing, and column number is not guaranteed\n *\n * In theory, TraceKit should work on all of the following versions:\n * - IE5.5+ (only 8.0 tested)\n * - Firefox 0.9+ (only 3.5+ tested)\n * - Opera 7+ (only 10.50 tested; versions 9 and earlier may require\n * Exceptions Have Stacktrace to be enabled in opera:config)\n * - Safari 3+ (only 4+ tested)\n * - Chrome 1+ (only 5+ tested)\n * - Konqueror 3.5+ (untested)\n *\n * Requires TraceKit.computeStackTrace.\n *\n * Tries to catch all unhandled exceptions and report them to the\n * subscribed handlers. Please note that TraceKit.report will rethrow the\n * exception. This is REQUIRED in order to get a useful stack trace in IE.\n * If the exception does not reach the top of the browser, you will only\n * get a stack trace from the point where TraceKit.report was called.\n *\n * Handlers receive a TraceKit.StackTrace object as described in the\n * TraceKit.computeStackTrace docs.\n *\n * @memberof TraceKit\n * @namespace\n */\nTraceKit.report = (function reportModuleWrapper() {\n var handlers: any = [],\n lastException: any = null,\n lastExceptionStack: any = null;\n\n /**\n * Add a crash handler.\n * @param {Function} handler\n * @memberof TraceKit.report\n */\n function subscribe(handler: any) {\n // NOTE: We call both handlers manually in browser/integrations/globalhandler.ts\n // So user can choose which one he wants to attach\n\n // installGlobalHandler();\n // installGlobalUnhandledRejectionHandler();\n handlers.push(handler);\n }\n\n /**\n * Remove a crash handler.\n * @param {Function} handler\n * @memberof TraceKit.report\n */\n function unsubscribe(handler: any) {\n for (var i = handlers.length - 1; i >= 0; --i) {\n if (handlers[i] === handler) {\n handlers.splice(i, 1);\n }\n }\n\n if (handlers.length === 0) {\n uninstallGlobalHandler();\n uninstallGlobalUnhandledRejectionHandler();\n }\n }\n\n /**\n * Dispatch stack information to all handlers.\n * @param {TraceKit.StackTrace} stack\n * @param {boolean} isWindowError Is this a top-level window error?\n * @param {Error=} error The error that's being handled (if available, null otherwise)\n * @memberof TraceKit.report\n * @throws An exception if an error occurs while calling an handler.\n */\n function notifyHandlers(stack: any, isWindowError: any, error: any) {\n var exception = null;\n if (isWindowError && !TraceKit.collectWindowErrors) {\n return;\n }\n for (var i in handlers) {\n if (_has(handlers, i)) {\n try {\n handlers[i](stack, isWindowError, error);\n } catch (inner) {\n exception = inner;\n }\n }\n }\n\n if (exception) {\n throw exception;\n }\n }\n\n var _oldOnerrorHandler: any, _onErrorHandlerInstalled: any;\n var _oldOnunhandledrejectionHandler: any, _onUnhandledRejectionHandlerInstalled: any;\n\n /**\n * Ensures all global unhandled exceptions are recorded.\n * Supported by Gecko and IE.\n * @param {string} message Error message.\n * @param {string} url URL of script that generated the exception.\n * @param {(number|string)} lineNo The line number at which the error occurred.\n * @param {(number|string)=} columnNo The column number at which the error occurred.\n * @param {Error=} errorObj The actual Error object.\n * @memberof TraceKit.report\n */\n function traceKitWindowOnError(message: any, url: any, lineNo: any, columnNo: any, errorObj: any) {\n var stack = null;\n // If 'errorObj' is ErrorEvent, get real Error from inside\n errorObj = isErrorEvent(errorObj) ? errorObj.error : errorObj;\n // If 'message' is ErrorEvent, get real message from inside\n message = isErrorEvent(message) ? message.message : message;\n\n if (lastExceptionStack) {\n TraceKit.computeStackTrace.augmentStackTraceWithInitialElement(lastExceptionStack, url, lineNo, message);\n processLastException();\n } else if (errorObj && isError(errorObj)) {\n stack = TraceKit.computeStackTrace(errorObj);\n stack.mechanism = 'onerror';\n notifyHandlers(stack, true, errorObj);\n } else {\n var location: any = {\n url: url,\n line: lineNo,\n column: columnNo,\n };\n\n var name;\n var msg = message; // must be new var or will modify original `arguments`\n if ({}.toString.call(message) === '[object String]') {\n var groups = message.match(ERROR_TYPES_RE);\n if (groups) {\n name = groups[1];\n msg = groups[2];\n }\n }\n\n location.func = TraceKit.computeStackTrace.guessFunctionName(location.url, location.line);\n location.context = TraceKit.computeStackTrace.gatherContext(location.url, location.line);\n stack = {\n name: name,\n message: msg,\n mode: 'onerror',\n mechanism: 'onerror',\n stack: [\n {\n ...location,\n // Firefox sometimes doesn't return url correctly and this is an old behavior\n // that I prefer to port here as well.\n // It can be altered only here, as previously it's using `location.url` for other things — Kamil\n url: location.url || getLocationHref(),\n },\n ],\n };\n\n notifyHandlers(stack, true, null);\n }\n\n if (_oldOnerrorHandler) {\n // @ts-ignore\n return _oldOnerrorHandler.apply(this, arguments);\n }\n\n return false;\n }\n\n /**\n * Ensures all unhandled rejections are recorded.\n * @param {PromiseRejectionEvent} e event.\n * @memberof TraceKit.report\n * @see https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onunhandledrejection\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PromiseRejectionEvent\n */\n function traceKitWindowOnUnhandledRejection(e: any) {\n var err = (e && (e.detail ? e.detail.reason : e.reason)) || e;\n var stack = TraceKit.computeStackTrace(err);\n stack.mechanism = 'onunhandledrejection';\n notifyHandlers(stack, true, err);\n }\n\n /**\n * Install a global onerror handler\n * @memberof TraceKit.report\n */\n function installGlobalHandler() {\n if (_onErrorHandlerInstalled === true) {\n return;\n }\n\n _oldOnerrorHandler = window.onerror;\n window.onerror = traceKitWindowOnError;\n _onErrorHandlerInstalled = true;\n }\n\n /**\n * Uninstall the global onerror handler\n * @memberof TraceKit.report\n */\n function uninstallGlobalHandler() {\n if (_onErrorHandlerInstalled) {\n window.onerror = _oldOnerrorHandler;\n _onErrorHandlerInstalled = false;\n }\n }\n\n /**\n * Install a global onunhandledrejection handler\n * @memberof TraceKit.report\n */\n function installGlobalUnhandledRejectionHandler() {\n if (_onUnhandledRejectionHandlerInstalled === true) {\n return;\n }\n\n _oldOnunhandledrejectionHandler = (window as any).onunhandledrejection;\n (window as any).onunhandledrejection = traceKitWindowOnUnhandledRejection;\n _onUnhandledRejectionHandlerInstalled = true;\n }\n\n /**\n * Uninstall the global onunhandledrejection handler\n * @memberof TraceKit.report\n */\n function uninstallGlobalUnhandledRejectionHandler() {\n if (_onUnhandledRejectionHandlerInstalled) {\n window.onerror = _oldOnunhandledrejectionHandler;\n _onUnhandledRejectionHandlerInstalled = false;\n }\n }\n\n /**\n * Process the most recent exception\n * @memberof TraceKit.report\n */\n function processLastException() {\n var _lastExceptionStack = lastExceptionStack,\n _lastException = lastException;\n lastExceptionStack = null;\n lastException = null;\n notifyHandlers(_lastExceptionStack, false, _lastException);\n }\n\n /**\n * Reports an unhandled Error to TraceKit.\n * @param {Error} ex\n * @memberof TraceKit.report\n * @throws An exception if an incomplete stack trace is detected (old IE browsers).\n */\n function report(ex: any) {\n if (lastExceptionStack) {\n if (lastException === ex) {\n return; // already caught by an inner catch block, ignore\n } else {\n processLastException();\n }\n }\n\n var stack = TraceKit.computeStackTrace(ex);\n lastExceptionStack = stack;\n lastException = ex;\n\n // If the stack trace is incomplete, wait for 2 seconds for\n // slow slow IE to see if onerror occurs or not before reporting\n // this exception; otherwise, we will end up with an incomplete\n // stack trace\n setTimeout(function() {\n if (lastException === ex) {\n processLastException();\n }\n }, stack.incomplete ? 2000 : 0);\n\n throw ex; // re-throw to propagate to the top level (and cause window.onerror)\n }\n\n (report as any).subscribe = subscribe;\n (report as any).unsubscribe = unsubscribe;\n (report as any).installGlobalHandler = installGlobalHandler;\n (report as any).installGlobalUnhandledRejectionHandler = installGlobalUnhandledRejectionHandler;\n\n return report;\n})();\n\n/**\n * An object representing a single stack frame.\n * @typedef {Object} StackFrame\n * @property {string} url The JavaScript or HTML file URL.\n * @property {string} func The function name, or empty for anonymous functions (if guessing did not work).\n * @property {string[]?} args The arguments passed to the function, if known.\n * @property {number=} line The line number, if known.\n * @property {number=} column The column number, if known.\n * @property {string[]} context An array of source code lines; the middle element corresponds to the correct line#.\n * @memberof TraceKit\n */\n\n/**\n * An object representing a JavaScript stack trace.\n * @typedef {Object} StackTrace\n * @property {string} name The name of the thrown exception.\n * @property {string} message The exception error message.\n * @property {TraceKit.StackFrame[]} stack An array of stack frames.\n * @property {string} mode 'stack', 'stacktrace', 'multiline', 'callers', 'onerror', or 'failed' -- method used to collect the stack trace.\n * @memberof TraceKit\n */\n\n/**\n * TraceKit.computeStackTrace: cross-browser stack traces in JavaScript\n *\n * Syntax:\n * ```js\n * s = TraceKit.computeStackTrace.ofCaller([depth])\n * s = TraceKit.computeStackTrace(exception) // consider using TraceKit.report instead (see below)\n * ```\n *\n * Supports:\n * - Firefox: full stack trace with line numbers and unreliable column\n * number on top frame\n * - Opera 10: full stack trace with line and column numbers\n * - Opera 9-: full stack trace with line numbers\n * - Chrome: full stack trace with line and column numbers\n * - Safari: line and column number for the topmost stacktrace element\n * only\n * - IE: no line numbers whatsoever\n *\n * Tries to guess names of anonymous functions by looking for assignments\n * in the source code. In IE and Safari, we have to guess source file names\n * by searching for function bodies inside all page scripts. This will not\n * work for scripts that are loaded cross-domain.\n * Here be dragons: some function names may be guessed incorrectly, and\n * duplicate functions may be mismatched.\n *\n * TraceKit.computeStackTrace should only be used for tracing purposes.\n * Logging of unhandled exceptions should be done with TraceKit.report,\n * which builds on top of TraceKit.computeStackTrace and provides better\n * IE support by utilizing the window.onerror event to retrieve information\n * about the top of the stack.\n *\n * Note: In IE and Safari, no stack trace is recorded on the Error object,\n * so computeStackTrace instead walks its *own* chain of callers.\n * This means that:\n * * in Safari, some methods may be missing from the stack trace;\n * * in IE, the topmost function in the stack trace will always be the\n * caller of computeStackTrace.\n *\n * This is okay for tracing (because you are likely to be calling\n * computeStackTrace from the function you want to be the topmost element\n * of the stack trace anyway), but not okay for logging unhandled\n * exceptions (because your catch block will likely be far away from the\n * inner function that actually caused the exception).\n *\n * Tracing example:\n * ```js\n * function trace(message) {\n * var stackInfo = TraceKit.computeStackTrace.ofCaller();\n * var data = message + \"\\n\";\n * for(var i in stackInfo.stack) {\n * var item = stackInfo.stack[i];\n * data += (item.func || '[anonymous]') + \"() in \" + item.url + \":\" + (item.line || '0') + \"\\n\";\n * }\n * if (window.console)\n * console.info(data);\n * else\n * alert(data);\n * }\n * ```\n * @memberof TraceKit\n * @namespace\n */\nTraceKit.computeStackTrace = (function computeStackTraceWrapper() {\n var debug = false,\n sourceCache = {};\n\n /**\n * Attempts to retrieve source code via XMLHttpRequest, which is used\n * to look up anonymous function names.\n * @param {string} url URL of source code.\n * @return {string} Source contents.\n * @memberof TraceKit.computeStackTrace\n */\n function loadSource(url: any) {\n if (!TraceKit.remoteFetching) {\n //Only attempt request if remoteFetching is on.\n return '';\n }\n try {\n var getXHR = function() {\n try {\n return new (window as any).XMLHttpRequest();\n } catch (e) {\n // explicitly bubble up the exception if not found\n return new (window as any).ActiveXObject('Microsoft.XMLHTTP');\n }\n };\n\n var request = getXHR();\n request.open('GET', url, false);\n request.send('');\n return request.responseText;\n } catch (e) {\n return '';\n }\n }\n\n /**\n * Retrieves source code from the source code cache.\n * @param {string} url URL of source code.\n * @return {Array.} Source contents.\n * @memberof TraceKit.computeStackTrace\n */\n function getSource(url: any) {\n if (typeof url !== 'string') {\n return [];\n }\n\n if (!_has(sourceCache, url)) {\n // URL needs to be able to fetched within the acceptable domain. Otherwise,\n // cross-domain errors will be triggered.\n /*\n Regex matches:\n 0 - Full Url\n 1 - Protocol\n 2 - Domain\n 3 - Port (Useful for internal applications)\n 4 - Path\n */\n var source = '';\n var domain = '';\n try {\n domain = window.document.domain;\n } catch (e) {}\n var match = /(.*)\\:\\/\\/([^:\\/]+)([:\\d]*)\\/{0,1}([\\s\\S]*)/.exec(url);\n if (match && match[2] === domain) {\n source = loadSource(url);\n }\n (sourceCache as any)[url] = source ? source.split('\\n') : [];\n }\n\n return (sourceCache as any)[url];\n }\n\n /**\n * Tries to use an externally loaded copy of source code to determine\n * the name of a function by looking at the name of the variable it was\n * assigned to, if any.\n * @param {string} url URL of source code.\n * @param {(string|number)} lineNo Line number in source code.\n * @return {string} The function name, if discoverable.\n * @memberof TraceKit.computeStackTrace\n */\n function guessFunctionName(url: any, lineNo: any) {\n var reFunctionArgNames = /function ([^(]*)\\(([^)]*)\\)/,\n reGuessFunction = /['\"]?([0-9A-Za-z$_]+)['\"]?\\s*[:=]\\s*(function|eval|new Function)/,\n line = '',\n maxLines = 10,\n source = getSource(url),\n m;\n\n if (!source.length) {\n return UNKNOWN_FUNCTION;\n }\n\n // Walk backwards from the first line in the function until we find the line which\n // matches the pattern above, which is the function definition\n for (var i = 0; i < maxLines; ++i) {\n line = source[lineNo - i] + line;\n\n if (!isUndefined(line)) {\n if ((m = reGuessFunction.exec(line))) {\n return m[1];\n } else if ((m = reFunctionArgNames.exec(line))) {\n return m[1];\n }\n }\n }\n\n return UNKNOWN_FUNCTION;\n }\n\n /**\n * Retrieves the surrounding lines from where an exception occurred.\n * @param {string} url URL of source code.\n * @param {(string|number)} line Line number in source code to center around for context.\n * @return {?Array.} Lines of source code.\n * @memberof TraceKit.computeStackTrace\n */\n function gatherContext(url: any, line: any) {\n var source = getSource(url);\n\n if (!source.length) {\n return null;\n }\n\n var context = [],\n // linesBefore & linesAfter are inclusive with the offending line.\n // if linesOfContext is even, there will be one extra line\n // *before* the offending line.\n linesBefore = Math.floor(TraceKit.linesOfContext / 2),\n // Add one extra line if linesOfContext is odd\n linesAfter = linesBefore + (TraceKit.linesOfContext % 2),\n start = Math.max(0, line - linesBefore - 1),\n end = Math.min(source.length, line + linesAfter - 1);\n\n line -= 1; // convert to 0-based index\n\n for (var i = start; i < end; ++i) {\n if (!isUndefined(source[i])) {\n context.push(source[i]);\n }\n }\n\n return context.length > 0 ? context : null;\n }\n\n /**\n * Escapes special characters, except for whitespace, in a string to be\n * used inside a regular expression as a string literal.\n * @param {string} text The string.\n * @return {string} The escaped string literal.\n * @memberof TraceKit.computeStackTrace\n */\n function escapeRegExp(text: any) {\n return text.replace(/[\\-\\[\\]{}()*+?.,\\\\\\^$|#]/g, '\\\\$&');\n }\n\n /**\n * Escapes special characters in a string to be used inside a regular\n * expression as a string literal. Also ensures that HTML entities will\n * be matched the same as their literal friends.\n * @param {string} body The string.\n * @return {string} The escaped string.\n * @memberof TraceKit.computeStackTrace\n */\n function escapeCodeAsRegExpForMatchingInsideHTML(body: any) {\n return escapeRegExp(body)\n .replace('<', '(?:<|<)')\n .replace('>', '(?:>|>)')\n .replace('&', '(?:&|&)')\n .replace('\"', '(?:\"|")')\n .replace(/\\s+/g, '\\\\s+');\n }\n\n /**\n * Determines where a code fragment occurs in the source code.\n * @param {RegExp} re The function definition.\n * @param {Array.} urls A list of URLs to search.\n * @return {?Object.} An object containing\n * the url, line, and column number of the defined function.\n * @memberof TraceKit.computeStackTrace\n */\n function findSourceInUrls(re: any, urls: any) {\n var source, m;\n for (var i = 0, j = urls.length; i < j; ++i) {\n if ((source = getSource(urls[i])).length) {\n source = source.join('\\n');\n if ((m = re.exec(source))) {\n return {\n url: urls[i],\n line: source.substring(0, m.index).split('\\n').length,\n column: m.index - source.lastIndexOf('\\n', m.index) - 1,\n };\n }\n }\n }\n\n return null;\n }\n\n /**\n * Determines at which column a code fragment occurs on a line of the\n * source code.\n * @param {string} fragment The code fragment.\n * @param {string} url The URL to search.\n * @param {(string|number)} line The line number to examine.\n * @return {?number} The column number.\n * @memberof TraceKit.computeStackTrace\n */\n function findSourceInLine(fragment: any, url: any, line: any) {\n var source = getSource(url),\n re = new RegExp('\\\\b' + escapeRegExp(fragment) + '\\\\b'),\n m;\n\n line -= 1;\n\n if (source && source.length > line && (m = re.exec(source[line]))) {\n return m.index;\n }\n\n return null;\n }\n\n /**\n * Determines where a function was defined within the source code.\n * @param {(Function|string)} func A function reference or serialized\n * function definition.\n * @return {?Object.} An object containing\n * the url, line, and column number of the defined function.\n * @memberof TraceKit.computeStackTrace\n */\n function findSourceByFunctionBody(func: any) {\n if (isUndefined(window && window.document)) {\n return;\n }\n\n var urls = [getLocationHref()],\n scripts = window.document.getElementsByTagName('script'),\n body,\n code = '' + func,\n codeRE = /^function(?:\\s+([\\w$]+))?\\s*\\(([\\w\\s,]*)\\)\\s*\\{\\s*(\\S[\\s\\S]*\\S)\\s*\\}\\s*$/,\n eventRE = /^function on([\\w$]+)\\s*\\(event\\)\\s*\\{\\s*(\\S[\\s\\S]*\\S)\\s*\\}\\s*$/,\n re,\n parts,\n result;\n\n for (var i = 0; i < scripts.length; ++i) {\n var script = scripts[i];\n if (script.src) {\n urls.push(script.src);\n }\n }\n\n if (!(parts = codeRE.exec(code))) {\n re = new RegExp(escapeRegExp(code).replace(/\\s+/g, '\\\\s+'));\n }\n\n // not sure if this is really necessary, but I don’t have a test\n // corpus large enough to confirm that and it was in the original.\n else {\n var name = parts[1] ? '\\\\s+' + parts[1] : '',\n args = parts[2].split(',').join('\\\\s*,\\\\s*');\n\n body = escapeRegExp(parts[3]).replace(/;$/, ';?'); // semicolon is inserted if the function ends with a comment.replace(/\\s+/g, '\\\\s+');\n re = new RegExp('function' + name + '\\\\s*\\\\(\\\\s*' + args + '\\\\s*\\\\)\\\\s*{\\\\s*' + body + '\\\\s*}');\n }\n\n // look for a normal function definition\n if ((result = findSourceInUrls(re, urls))) {\n return result;\n }\n\n // look for an old-school event handler function\n if ((parts = eventRE.exec(code))) {\n var event = parts[1];\n body = escapeCodeAsRegExpForMatchingInsideHTML(parts[2]);\n\n // look for a function defined in HTML as an onXXX handler\n re = new RegExp('on' + event + '=[\\\\\\'\"]\\\\s*' + body + '\\\\s*[\\\\\\'\"]', 'i');\n\n if ((result = findSourceInUrls(re, urls[0]))) {\n return result;\n }\n\n // look for ???\n re = new RegExp(body);\n\n if ((result = findSourceInUrls(re, urls))) {\n return result;\n }\n }\n\n return null;\n }\n\n // Contents of Exception in various browsers.\n //\n // SAFARI:\n // ex.message = Can't find variable: qq\n // ex.line = 59\n // ex.sourceId = 580238192\n // ex.sourceURL = http://...\n // ex.expressionBeginOffset = 96\n // ex.expressionCaretOffset = 98\n // ex.expressionEndOffset = 98\n // ex.name = ReferenceError\n //\n // FIREFOX:\n // ex.message = qq is not defined\n // ex.fileName = http://...\n // ex.lineNumber = 59\n // ex.columnNumber = 69\n // ex.stack = ...stack trace... (see the example below)\n // ex.name = ReferenceError\n //\n // CHROME:\n // ex.message = qq is not defined\n // ex.name = ReferenceError\n // ex.type = not_defined\n // ex.arguments = ['aa']\n // ex.stack = ...stack trace...\n //\n // INTERNET EXPLORER:\n // ex.message = ...\n // ex.name = ReferenceError\n //\n // OPERA:\n // ex.message = ...message... (see the example below)\n // ex.name = ReferenceError\n // ex.opera#sourceloc = 11 (pretty much useless, duplicates the info in ex.message)\n // ex.stacktrace = n/a; see 'opera:config#UserPrefs|Exceptions Have Stacktrace'\n\n /**\n * Computes stack trace information from the stack property.\n * Chrome and Gecko use this property.\n * @param {Error} ex\n * @return {?TraceKit.StackTrace} Stack trace information.\n * @memberof TraceKit.computeStackTrace\n */\n function computeStackTraceFromStackProp(ex: any) {\n if (!ex.stack) {\n return null;\n }\n\n var chrome = /^\\s*at (?:(.*?) ?\\()?((?:file|https?|blob|chrome-extension|native|eval|webpack||[a-z]:|\\/).*?)(?::(\\d+))?(?::(\\d+))?\\)?\\s*$/i,\n gecko = /^\\s*(.*?)(?:\\((.*?)\\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|moz-extension).*?:\\/.*?|\\[native code\\]|[^@]*bundle)(?::(\\d+))?(?::(\\d+))?\\s*$/i,\n winjs = /^\\s*at (?:((?:\\[object object\\])?.+) )?\\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\\d+)(?::(\\d+))?\\)?\\s*$/i,\n // Used to additionally parse URL/line/column from eval frames\n isEval,\n geckoEval = /(\\S+) line (\\d+)(?: > eval line \\d+)* > eval/i,\n chromeEval = /\\((\\S*)(?::(\\d+))(?::(\\d+))\\)/,\n lines = ex.stack.split('\\n'),\n stack = [],\n submatch,\n parts,\n element,\n reference = /^(.*) is undefined$/.exec(ex.message);\n\n for (var i = 0, j = lines.length; i < j; ++i) {\n if ((parts = chrome.exec(lines[i]))) {\n var isNative = parts[2] && parts[2].indexOf('native') === 0; // start of line\n isEval = parts[2] && parts[2].indexOf('eval') === 0; // start of line\n if (isEval && (submatch = chromeEval.exec(parts[2]))) {\n // throw out eval line/column and use top-most line/column number\n parts[2] = submatch[1]; // url\n // NOTE: It's messing out our integration tests in Karma, let's see if we can live with it – Kamil\n // parts[3] = submatch[2]; // line\n // parts[4] = submatch[3]; // column\n }\n element = {\n url: !isNative ? parts[2] : null,\n func: parts[1] || UNKNOWN_FUNCTION,\n args: isNative ? [parts[2]] : [],\n line: parts[3] ? +parts[3] : null,\n column: parts[4] ? +parts[4] : null,\n };\n } else if ((parts = winjs.exec(lines[i]))) {\n element = {\n url: parts[2],\n func: parts[1] || UNKNOWN_FUNCTION,\n args: [],\n line: +parts[3],\n column: parts[4] ? +parts[4] : null,\n };\n } else if ((parts = gecko.exec(lines[i]))) {\n isEval = parts[3] && parts[3].indexOf(' > eval') > -1;\n if (isEval && (submatch = geckoEval.exec(parts[3]))) {\n // throw out eval line/column and use top-most line number\n parts[3] = submatch[1];\n // NOTE: It's messing out our integration tests in Karma, let's see if we can live with it – Kamil\n // parts[4] = submatch[2];\n // parts[5] = null; // no column when eval\n } else if (i === 0 && !parts[5] && !isUndefined(ex.columnNumber)) {\n // FireFox uses this awesome columnNumber property for its top frame\n // Also note, Firefox's column number is 0-based and everything else expects 1-based,\n // so adding 1\n // NOTE: this hack doesn't work if top-most frame is eval\n stack[0].column = ex.columnNumber + 1;\n }\n element = {\n url: parts[3],\n func: parts[1] || UNKNOWN_FUNCTION,\n args: parts[2] ? parts[2].split(',') : [],\n line: parts[4] ? +parts[4] : null,\n column: parts[5] ? +parts[5] : null,\n };\n } else {\n continue;\n }\n\n if (!element.func && element.line) {\n element.func = guessFunctionName(element.url, element.line);\n }\n\n if (TraceKit.remoteFetching && element.url && element.url.substr(0, 5) === 'blob:') {\n // Special case for handling JavaScript loaded into a blob.\n // We use a synchronous AJAX request here as a blob is already in\n // memory - it's not making a network request. This will generate a warning\n // in the browser console, but there has already been an error so that's not\n // that much of an issue.\n var xhr = new XMLHttpRequest();\n xhr.open('GET', element.url, false);\n xhr.send('');\n\n // If we failed to download the source, skip this patch\n if (xhr.status === 200) {\n var source = xhr.responseText || '';\n\n // We trim the source down to the last 300 characters as sourceMappingURL is always at the end of the file.\n // Why 300? To be in line with: https://github.com/getsentry/sentry/blob/4af29e8f2350e20c28a6933354e4f42437b4ba42/src/sentry/lang/javascript/processor.py#L164-L175\n source = source.slice(-300);\n\n // Now we dig out the source map URL\n var sourceMaps = source.match(/\\/\\/# sourceMappingURL=(.*)$/);\n\n // If we don't find a source map comment or we find more than one, continue on to the next element.\n if (sourceMaps) {\n var sourceMapAddress = sourceMaps[1];\n\n // Now we check to see if it's a relative URL.\n // If it is, convert it to an absolute one.\n if (sourceMapAddress.charAt(0) === '~') {\n sourceMapAddress = getLocationOrigin() + sourceMapAddress.slice(1);\n }\n\n // Now we strip the '.map' off of the end of the URL and update the\n // element so that Sentry can match the map to the blob.\n element.url = sourceMapAddress.slice(0, -4);\n }\n }\n }\n\n (element as any).context = element.line ? gatherContext(element.url, element.line) : null;\n\n stack.push(element);\n }\n\n if (!stack.length) {\n return null;\n }\n\n if (stack[0] && stack[0].line && !stack[0].column && reference) {\n stack[0].column = findSourceInLine(reference[1], stack[0].url, stack[0].line);\n }\n\n return {\n mode: 'stack',\n name: ex.name,\n message: ex.message,\n stack: stack,\n };\n }\n\n /**\n * Computes stack trace information from the stacktrace property.\n * Opera 10+ uses this property.\n * @param {Error} ex\n * @return {?TraceKit.StackTrace} Stack trace information.\n * @memberof TraceKit.computeStackTrace\n */\n function computeStackTraceFromStacktraceProp(ex: any) {\n // Access and store the stacktrace property before doing ANYTHING\n // else to it because Opera is not very good at providing it\n // reliably in other circumstances.\n var stacktrace = ex.stacktrace;\n if (!stacktrace) {\n return;\n }\n\n var opera10Regex = / line (\\d+).*script (?:in )?(\\S+)(?:: in function (\\S+))?$/i,\n opera11Regex = / line (\\d+), column (\\d+)\\s*(?:in (?:]+)>|([^\\)]+))\\((.*)\\))? in (.*):\\s*$/i,\n lines = stacktrace.split('\\n'),\n stack = [],\n parts;\n\n for (var line = 0; line < lines.length; line += 2) {\n var element = null;\n if ((parts = opera10Regex.exec(lines[line]))) {\n element = {\n url: parts[2],\n line: +parts[1],\n column: null,\n func: parts[3],\n args: [],\n };\n } else if ((parts = opera11Regex.exec(lines[line]))) {\n element = {\n url: parts[6],\n line: +parts[1],\n column: +parts[2],\n func: parts[3] || parts[4],\n args: parts[5] ? parts[5].split(',') : [],\n };\n }\n\n if (element) {\n if (!element.func && element.line) {\n element.func = guessFunctionName(element.url, element.line);\n }\n if (element.line) {\n try {\n (element as any).context = gatherContext(element.url, element.line);\n } catch (exc) {}\n }\n\n if (!(element as any).context) {\n (element as any).context = [lines[line + 1]];\n }\n\n stack.push(element);\n }\n }\n\n if (!stack.length) {\n return null;\n }\n\n return {\n mode: 'stacktrace',\n name: ex.name,\n message: ex.message,\n stack: stack,\n };\n }\n\n /**\n * NOT TESTED.\n * Computes stack trace information from an error message that includes\n * the stack trace.\n * Opera 9 and earlier use this method if the option to show stack\n * traces is turned on in opera:config.\n * @param {Error} ex\n * @return {?TraceKit.StackTrace} Stack information.\n * @memberof TraceKit.computeStackTrace\n */\n function computeStackTraceFromOperaMultiLineMessage(ex: any) {\n // TODO: Clean this function up\n // Opera includes a stack trace into the exception message. An example is:\n //\n // Statement on line 3: Undefined variable: undefinedFunc\n // Backtrace:\n // Line 3 of linked script file://localhost/Users/andreyvit/Projects/TraceKit/javascript-client/sample.js: In function zzz\n // undefinedFunc(a);\n // Line 7 of inline#1 script in file://localhost/Users/andreyvit/Projects/TraceKit/javascript-client/sample.html: In function yyy\n // zzz(x, y, z);\n // Line 3 of inline#1 script in file://localhost/Users/andreyvit/Projects/TraceKit/javascript-client/sample.html: In function xxx\n // yyy(a, a, a);\n // Line 1 of function script\n // try { xxx('hi'); return false; } catch(ex) { TraceKit.report(ex); }\n // ...\n\n var lines = ex.message.split('\\n');\n if (lines.length < 4) {\n return null;\n }\n\n var lineRE1 = /^\\s*Line (\\d+) of linked script ((?:file|https?|blob)\\S+)(?:: in function (\\S+))?\\s*$/i,\n lineRE2 = /^\\s*Line (\\d+) of inline#(\\d+) script in ((?:file|https?|blob)\\S+)(?:: in function (\\S+))?\\s*$/i,\n lineRE3 = /^\\s*Line (\\d+) of function script\\s*$/i,\n stack = [],\n scripts = window && window.document && window.document.getElementsByTagName('script'),\n inlineScriptBlocks = [],\n parts;\n\n for (var s in scripts) {\n if (_has(scripts, s) && !scripts[s].src) {\n inlineScriptBlocks.push(scripts[s]);\n }\n }\n\n for (var line = 2; line < lines.length; line += 2) {\n var item = null;\n if ((parts = lineRE1.exec(lines[line]))) {\n item = {\n url: parts[2],\n func: parts[3],\n args: [],\n line: +parts[1],\n column: null,\n };\n } else if ((parts = lineRE2.exec(lines[line]))) {\n item = {\n url: parts[3],\n func: parts[4],\n args: [],\n line: +parts[1],\n column: null, // TODO: Check to see if inline#1 (+parts[2]) points to the script number or column number.\n };\n var relativeLine = +parts[1]; // relative to the start of the