UNPKG

cluedin-widget

Version:
1,549 lines (1,507 loc) • 305 kB
(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[37],{ /***/ 1829: /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global, process) { Object.defineProperty(exports, '__esModule', { value: true }); var core = __webpack_require__(1987); /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ /* global Reflect, Promise */ var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function() { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; function __awaiter(thisArg, _arguments, P, generator) { return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { 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; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } function __values(o) { var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; if (m) return m.call(o); return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; function unwrapExports (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } function createCommonjsModule(fn, module) { return module = { exports: {} }, fn(module, module.exports), module.exports; } var dist = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); /** JSDoc */ var Severity; (function (Severity) { /** JSDoc */ Severity["Fatal"] = "fatal"; /** JSDoc */ Severity["Error"] = "error"; /** JSDoc */ Severity["Warning"] = "warning"; /** JSDoc */ Severity["Log"] = "log"; /** JSDoc */ Severity["Info"] = "info"; /** JSDoc */ Severity["Debug"] = "debug"; /** JSDoc */ Severity["Critical"] = "critical"; })(Severity = exports.Severity || (exports.Severity = {})); // tslint:disable:no-unnecessary-qualifier no-namespace (function (Severity) { /** * Converts a string-based level into a {@link Severity}. * * @param level string representation of Severity * @returns Severity */ function fromString(level) { switch (level) { case 'debug': return Severity.Debug; case 'info': return Severity.Info; case 'warn': case 'warning': return Severity.Warning; case 'error': return Severity.Error; case 'fatal': return Severity.Fatal; case 'critical': return Severity.Critical; case 'log': default: return Severity.Log; } } Severity.fromString = fromString; })(Severity = exports.Severity || (exports.Severity = {})); /** The status of an event. */ var Status; (function (Status) { /** The status could not be determined. */ Status["Unknown"] = "unknown"; /** The event was skipped due to configuration or callbacks. */ Status["Skipped"] = "skipped"; /** The event was sent to Sentry successfully. */ Status["Success"] = "success"; /** The client is currently rate limited and will try again later. */ Status["RateLimit"] = "rate_limit"; /** The event could not be processed. */ Status["Invalid"] = "invalid"; /** A server-side error ocurred during submission. */ Status["Failed"] = "failed"; })(Status = exports.Status || (exports.Status = {})); // tslint:disable:no-unnecessary-qualifier no-namespace (function (Status) { /** * Converts a HTTP status code into a {@link Status}. * * @param code The HTTP response status code. * @returns The send status or {@link Status.Unknown}. */ function fromHttpCode(code) { if (code >= 200 && code < 300) { return Status.Success; } if (code === 429) { return Status.RateLimit; } if (code >= 400 && code < 500) { return Status.Invalid; } if (code >= 500) { return Status.Failed; } return Status.Unknown; } Status.fromHttpCode = fromHttpCode; })(Status = exports.Status || (exports.Status = {})); }); unwrapExports(dist); var dist_1 = dist.Severity; var dist_2 = dist.Status; var is = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); /** * Checks whether given value's type is one of a few Error or Error-like * {@link isError}. * * @param wat A value to be checked. * @returns A boolean representing the result. */ function isError(wat) { switch (Object.prototype.toString.call(wat)) { case '[object Error]': return true; case '[object Exception]': return true; case '[object DOMException]': return true; default: return wat instanceof Error; } } exports.isError = isError; /** * Checks whether given value's type is ErrorEvent * {@link isErrorEvent}. * * @param wat A value to be checked. * @returns A boolean representing the result. */ function isErrorEvent(wat) { return Object.prototype.toString.call(wat) === '[object ErrorEvent]'; } exports.isErrorEvent = isErrorEvent; /** * Checks whether given value's type is DOMError * {@link isDOMError}. * * @param wat A value to be checked. * @returns A boolean representing the result. */ function isDOMError(wat) { return Object.prototype.toString.call(wat) === '[object DOMError]'; } exports.isDOMError = isDOMError; /** * Checks whether given value's type is DOMException * {@link isDOMException}. * * @param wat A value to be checked. * @returns A boolean representing the result. */ function isDOMException(wat) { return Object.prototype.toString.call(wat) === '[object DOMException]'; } exports.isDOMException = isDOMException; /** * Checks whether given value's type is an undefined * {@link isUndefined}. * * @param wat A value to be checked. * @returns A boolean representing the result. */ function isUndefined(wat) { return wat === void 0; } exports.isUndefined = isUndefined; /** * Checks whether given value's type is a function * {@link isFunction}. * * @param wat A value to be checked. * @returns A boolean representing the result. */ function isFunction(wat) { return typeof wat === 'function'; } exports.isFunction = isFunction; /** * Checks whether given value's type is a string * {@link isString}. * * @param wat A value to be checked. * @returns A boolean representing the result. */ function isString(wat) { return Object.prototype.toString.call(wat) === '[object String]'; } exports.isString = isString; /** * Checks whether given value's type is an array * {@link isArray}. * * @param wat A value to be checked. * @returns A boolean representing the result. */ function isArray(wat) { return Object.prototype.toString.call(wat) === '[object Array]'; } exports.isArray = isArray; /** * Checks whether given value's type is an object literal * {@link isPlainObject}. * * @param wat A value to be checked. * @returns A boolean representing the result. */ function isPlainObject(wat) { return Object.prototype.toString.call(wat) === '[object Object]'; } exports.isPlainObject = isPlainObject; /** * Checks whether given value's type is an regexp * {@link isRegExp}. * * @param wat A value to be checked. * @returns A boolean representing the result. */ function isRegExp(wat) { return Object.prototype.toString.call(wat) === '[object RegExp]'; } exports.isRegExp = isRegExp; /** * Checks whether given value's type is a NaN * {@link isNaN}. * * @param wat A value to be checked. * @returns A boolean representing the result. */ function isNaN(wat) { return wat !== wat; } exports.isNaN = isNaN; }); unwrapExports(is); var is_1 = is.isError; var is_2 = is.isErrorEvent; var is_3 = is.isDOMError; var is_4 = is.isDOMException; var is_5 = is.isUndefined; var is_6 = is.isFunction; var is_7 = is.isString; var is_8 = is.isArray; var is_9 = is.isPlainObject; var is_10 = is.isRegExp; var is_11 = is.isNaN; var misc = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); /** * Checks whether we're in the Node.js or Browser environment * * @returns Answer to given question */ function isNodeEnv() { // tslint:disable:strict-type-predicates return Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]'; } exports.isNodeEnv = isNodeEnv; /** * Safely get global scope object * * @returns Global scope object */ // tslint:disable:strict-type-predicates function getGlobalObject() { return isNodeEnv() ? commonjsGlobal : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}; } exports.getGlobalObject = getGlobalObject; /** * UUID4 generator * * @returns string Generated UUID4. */ function uuid4() { var global = getGlobalObject(); var crypto = global.crypto || global.msCrypto; if (!(crypto === void 0) && crypto.getRandomValues) { // Use window.crypto API if available var arr = new Uint16Array(8); crypto.getRandomValues(arr); // set 4 in byte 7 // tslint:disable-next-line:no-bitwise arr[3] = (arr[3] & 0xfff) | 0x4000; // set 2 most significant bits of byte 9 to '10' // tslint:disable-next-line:no-bitwise arr[4] = (arr[4] & 0x3fff) | 0x8000; var pad = function (num) { var v = num.toString(16); while (v.length < 4) { v = "0" + v; } return v; }; 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])); } else { // http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#2117523 return 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function (c) { // tslint:disable-next-line:no-bitwise var r = (Math.random() * 16) | 0; // tslint:disable-next-line:no-bitwise var v = c === 'x' ? r : (r & 0x3) | 0x8; return v.toString(16); }); } } exports.uuid4 = uuid4; /** * Given a child DOM element, returns a query-selector statement describing that * and its ancestors * e.g. [HTMLElement] => body > div > input#foo.btn[name=baz] * @returns generated DOM path */ function htmlTreeAsString(elem) { var currentElem = elem; var MAX_TRAVERSE_HEIGHT = 5; var MAX_OUTPUT_LEN = 80; var out = []; var height = 0; var len = 0; var separator = ' > '; var sepLength = separator.length; var nextStr; while (currentElem && height++ < MAX_TRAVERSE_HEIGHT) { nextStr = htmlElementAsString(currentElem); // bail out if // - nextStr is the 'html' element // - the length of the string that would be created exceeds MAX_OUTPUT_LEN // (ignore this limit if we are on the first iteration) if (nextStr === 'html' || (height > 1 && len + out.length * sepLength + nextStr.length >= MAX_OUTPUT_LEN)) { break; } out.push(nextStr); len += nextStr.length; currentElem = currentElem.parentNode; } return out.reverse().join(separator); } exports.htmlTreeAsString = htmlTreeAsString; /** * Returns a simple, query-selector representation of a DOM element * e.g. [HTMLElement] => input#foo.btn[name=baz] * @returns generated DOM path */ function htmlElementAsString(elem) { var out = []; var className; var classes; var key; var attr; var i; if (!elem || !elem.tagName) { return ''; } out.push(elem.tagName.toLowerCase()); if (elem.id) { out.push("#" + elem.id); } className = elem.className; if (className && is.isString(className)) { classes = className.split(/\s+/); for (i = 0; i < classes.length; i++) { out.push("." + classes[i]); } } var attrWhitelist = ['type', 'name', 'title', 'alt']; for (i = 0; i < attrWhitelist.length; i++) { key = attrWhitelist[i]; attr = elem.getAttribute(key); if (attr) { out.push("[" + key + "=\"" + attr + "\"]"); } } return out.join(''); } exports.htmlElementAsString = htmlElementAsString; /** * Parses string form of URL into an object * // borrowed from https://tools.ietf.org/html/rfc3986#appendix-B * // intentionally using regex and not <a/> href parsing trick because React Native and other * // environments where DOM might not be available * @returns parsed URL object */ function parseUrl(url) { if (!url) { return {}; } var match = url.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/); if (!match) { return {}; } // coerce to undefined values to empty string so we don't get 'undefined' var query = match[6] || ''; var fragment = match[8] || ''; return { host: match[4], path: match[5], protocol: match[2], relative: match[5] + query + fragment, }; } exports.parseUrl = parseUrl; /** * Extracts either message or type+value from an event that can be used for user-facing logs * @returns event's description */ function getEventDescription(event) { if (event.message) { return event.message; } else if (event.exception && event.exception.values && event.exception.values[0]) { var exception = event.exception.values[0]; if (exception.type && exception.value) { return exception.type + ": " + exception.value; } else { return exception.type || exception.value || event.event_id || '<unknown>'; } } else { return event.event_id || '<unknown>'; } } exports.getEventDescription = getEventDescription; }); unwrapExports(misc); var misc_1 = misc.isNodeEnv; var misc_2 = misc.getGlobalObject; var misc_3 = misc.uuid4; var misc_4 = misc.htmlTreeAsString; var misc_5 = misc.htmlElementAsString; var misc_6 = misc.parseUrl; var misc_7 = misc.getEventDescription; var supports = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); /** * Tells whether current environment supports ErrorEvent objects * {@link supportsErrorEvent}. * * @returns Answer to the given question. */ function supportsErrorEvent() { try { // tslint:disable:no-unused-expression new ErrorEvent(''); return true; } catch (e) { return false; } } exports.supportsErrorEvent = supportsErrorEvent; /** * Tells whether current environment supports DOMError objects * {@link supportsDOMError}. * * @returns Answer to the given question. */ function supportsDOMError() { try { // It really needs 1 argument, not 0. // Chrome: VM89:1 Uncaught TypeError: Failed to construct 'DOMError': // 1 argument required, but only 0 present. // @ts-ignore // tslint:disable:no-unused-expression new DOMError(''); return true; } catch (e) { return false; } } exports.supportsDOMError = supportsDOMError; /** * Tells whether current environment supports DOMException objects * {@link supportsDOMException}. * * @returns Answer to the given question. */ function supportsDOMException() { try { // tslint:disable:no-unused-expression new DOMException(''); return true; } catch (e) { return false; } } exports.supportsDOMException = supportsDOMException; /** * Tells whether current environment supports Fetch API * {@link supportsFetch}. * * @returns Answer to the given question. */ function supportsFetch() { if (!('fetch' in misc.getGlobalObject())) { return false; } try { // tslint:disable-next-line:no-unused-expression new Headers(); // tslint:disable-next-line:no-unused-expression new Request(''); // tslint:disable-next-line:no-unused-expression new Response(); return true; } catch (e) { return false; } } exports.supportsFetch = supportsFetch; /** * Tells whether current environment supports Fetch API natively * {@link supportsNativeFetch}. * * @returns Answer to the given question. */ function supportsNativeFetch() { if (!supportsFetch()) { return false; } var global = misc.getGlobalObject(); var fetch = global.fetch; // tslint:disable-next-line:no-unsafe-any return fetch.toString().indexOf('native') !== -1; } exports.supportsNativeFetch = supportsNativeFetch; /** * Tells whether current environment supports sendBeacon API * {@link supportsBeacon}. * * @returns Answer to the given question. */ function supportsBeacon() { var global = misc.getGlobalObject(); return 'navigator' in global && 'sendBeacon' in global.navigator; } exports.supportsBeacon = supportsBeacon; /** * Tells whether current environment supports ReportingObserver API * {@link supportsReportingObserver}. * * @returns Answer to the given question. */ function supportsReportingObserver() { return 'ReportingObserver' in misc.getGlobalObject(); } exports.supportsReportingObserver = supportsReportingObserver; /** * Tells whether current environment supports Referrer Policy API * {@link supportsReferrerPolicy}. * * @returns Answer to the given question. */ function supportsReferrerPolicy() { // Despite all stars in the sky saying that Edge supports old draft syntax, aka 'never', 'always', 'origin' and 'default // https://caniuse.com/#feat=referrer-policy // It doesn't. And it throw exception instead of ignoring this parameter... // REF: https://github.com/getsentry/raven-js/issues/1233 if (!supportsFetch()) { return false; } try { // tslint:disable:no-unused-expression new Request('pickleRick', { referrerPolicy: 'origin', }); return true; } catch (e) { return false; } } exports.supportsReferrerPolicy = supportsReferrerPolicy; /** * Tells whether current environment supports History API * {@link supportsHistory}. * * @returns Answer to the given question. */ function supportsHistory() { // NOTE: in Chrome App environment, touching history.pushState, *even inside // a try/catch block*, will cause Chrome to output an error to console.error // borrowed from: https://github.com/angular/angular.js/pull/13945/files var global = misc.getGlobalObject(); var chrome = global.chrome; // tslint:disable-next-line:no-unsafe-any var isChromePackagedApp = chrome && chrome.app && chrome.app.runtime; var hasHistoryApi = 'history' in global && !!global.history.pushState && !!global.history.replaceState; return !isChromePackagedApp && hasHistoryApi; } exports.supportsHistory = supportsHistory; }); unwrapExports(supports); var supports_1 = supports.supportsErrorEvent; var supports_2 = supports.supportsDOMError; var supports_3 = supports.supportsDOMException; var supports_4 = supports.supportsFetch; var supports_5 = supports.supportsNativeFetch; var supports_6 = supports.supportsBeacon; var supports_7 = supports.supportsReportingObserver; var supports_8 = supports.supportsReferrerPolicy; var supports_9 = supports.supportsHistory; var object = createCommonjsModule(function (module, exports) { var __values = (commonjsGlobal && commonjsGlobal.__values) || function (o) { var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; if (m) return m.call(o); return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; }; Object.defineProperty(exports, "__esModule", { value: true }); /** * Transforms Error object into an object literal with all it's attributes * attached to it. * * Based on: https://github.com/ftlabs/js-abbreviate/blob/fa709e5f139e7770a71827b1893f22418097fbda/index.js#L95-L106 * * @param error An Error containing all relevant information * @returns An object with all error properties */ function objectifyError(error) { // These properties are implemented as magical getters and don't show up in `for-in` loop var err = { message: error.message, name: error.name, stack: error.stack, }; for (var i in error) { if (Object.prototype.hasOwnProperty.call(error, i)) { err[i] = error[i]; } } return err; } var NAN_VALUE = '[NaN]'; var UNDEFINED_VALUE = '[undefined]'; /** * Serializer function used as 2nd argument to JSON.serialize in `serialize()` util function. */ function serializer() { var stack = []; var keys = []; var cycleReplacer = function (_, value) { if (stack[0] === value) { return '[Circular ~]'; } return "[Circular ~." + keys.slice(0, stack.indexOf(value)).join('.') + "]"; }; return function (key, value) { var currentValue = value; // NaN and undefined are not JSON.parseable, but we want to preserve this information if (is.isNaN(value)) { currentValue = NAN_VALUE; } else if (is.isUndefined(value)) { currentValue = UNDEFINED_VALUE; } if (stack.length > 0) { var thisPos = stack.indexOf(this); if (thisPos !== -1) { stack.splice(thisPos + 1); keys.splice(thisPos, Infinity, key); } else { stack.push(this); keys.push(key); } if (stack.indexOf(currentValue) !== -1) { currentValue = cycleReplacer.call(this, key, currentValue); } } else { stack.push(currentValue); } return currentValue instanceof Error ? objectifyError(currentValue) : currentValue; }; } /** * Reviver function used as 2nd argument to JSON.parse in `deserialize()` util function. */ function reviver(_key, value) { // NaN and undefined are not JSON.parseable, but we want to preserve this information if (value === NAN_VALUE) { return NaN; } if (value === UNDEFINED_VALUE) { return undefined; } return value; } /** * Serializes the given object into a string. * Like JSON.stringify, but doesn't throw on circular references. * Based on a `json-stringify-safe` package and modified to handle Errors serialization. * * The object must be serializable, i.e.: * - Only primitive types are allowed (object, array, number, string, boolean) * - Its depth should be considerably low for performance reasons * * @param object A JSON-serializable object. * @returns A string containing the serialized object. */ function serialize(object) { return JSON.stringify(object, serializer()); } exports.serialize = serialize; /** * Deserializes an object from a string previously serialized with * {@link serialize}. * * @param str A serialized object. * @returns The deserialized object. */ function deserialize(str) { return JSON.parse(str, reviver); } exports.deserialize = deserialize; /** * Creates a deep copy of the given object. * * The object must be serializable, i.e.: * - It must not contain any cycles * - Only primitive types are allowed (object, array, number, string, boolean) * - Its depth should be considerably low for performance reasons * * @param object A JSON-serializable object. * @returns The object clone. */ function clone(object) { return deserialize(serialize(object)); } exports.clone = clone; /** * Wrap a given object method with a higher-order function * * @param source An object that contains a method to be wrapped. * @param name A name of method to be wrapped. * @param replacement A function that should be used to wrap a given method. * @returns void */ function fill(source, name, replacement) { if (!(name in source) || source[name].__sentry__) { return; } var original = source[name]; var wrapped = replacement(original); wrapped.__sentry__ = true; wrapped.__sentry_original__ = original; wrapped.__sentry_wrapped__ = wrapped; source[name] = wrapped; } exports.fill = fill; /** * Encodes given object into url-friendly format * * @param object An object that contains serializable values * @returns string Encoded */ function urlEncode(object) { return Object.keys(object) .map( // tslint:disable-next-line:no-unsafe-any function (key) { return encodeURIComponent(key) + "=" + encodeURIComponent(object[key]); }) .join('&'); } exports.urlEncode = urlEncode; // Default Node.js REPL depth var MAX_SERIALIZE_EXCEPTION_DEPTH = 3; // TODO: Or is it 200kb? 🤔 — Kamil // NOTE: Yes, it is // 50kB, as 100kB is max payload size, so half sounds reasonable var MAX_SERIALIZE_EXCEPTION_SIZE = 50 * 1024; var MAX_SERIALIZE_KEYS_LENGTH = 40; /** JSDoc */ function utf8Length(value) { // tslint:disable-next-line:no-bitwise return ~-encodeURI(value).split(/%..|./).length; } /** JSDoc */ function jsonSize(value) { return utf8Length(JSON.stringify(value)); } /** JSDoc */ function serializeValue(value) { var maxLength = 40; if (typeof value === 'string') { return value.length <= maxLength ? value : value.substr(0, maxLength - 1) + "\u2026"; } else if (typeof value === 'number' || typeof value === 'boolean' || typeof value === 'undefined') { return value; } else if (is.isNaN(value)) { // NaN and undefined are not JSON.parseable, but we want to preserve this information return '[NaN]'; } else if (is.isUndefined(value)) { return '[undefined]'; } var type = Object.prototype.toString.call(value); // Node.js REPL notation if (type === '[object Object]') { return '[Object]'; } if (type === '[object Array]') { return '[Array]'; } if (type === '[object Function]') { var name_1 = value.name; return name_1 ? "[Function: " + name_1 + "]" : '[Function]'; } return value; } /** JSDoc */ function serializeObject(value, depth) { if (depth === 0) { return serializeValue(value); } if (is.isPlainObject(value)) { var serialized_1 = {}; var val_1 = value; Object.keys(val_1).forEach(function (key) { serialized_1[key] = serializeObject(val_1[key], depth - 1); }); return serialized_1; } else if (Array.isArray(value)) { var val = value; return val.map(function (v) { return serializeObject(v, depth - 1); }); } return serializeValue(value); } exports.serializeObject = serializeObject; /** JSDoc */ function limitObjectDepthToSize(object, depth, maxSize) { if (depth === void 0) { depth = MAX_SERIALIZE_EXCEPTION_DEPTH; } if (maxSize === void 0) { maxSize = MAX_SERIALIZE_EXCEPTION_SIZE; } var serialized = serializeObject(object, depth); if (jsonSize(serialize(serialized)) > maxSize) { return limitObjectDepthToSize(object, depth - 1); } return serialized; } exports.limitObjectDepthToSize = limitObjectDepthToSize; /** JSDoc */ function serializeKeysToEventMessage(keys, maxLength) { if (maxLength === void 0) { maxLength = MAX_SERIALIZE_KEYS_LENGTH; } if (!keys.length) { return '[object has no keys]'; } if (keys[0].length >= maxLength) { return keys[0]; } for (var includedKeys = keys.length; includedKeys > 0; includedKeys--) { var serialized = keys.slice(0, includedKeys).join(', '); if (serialized.length > maxLength) { continue; } if (includedKeys === keys.length) { return serialized; } return serialized + "\u2026"; } return ''; } exports.serializeKeysToEventMessage = serializeKeysToEventMessage; // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign#Polyfill /** JSDoc */ function assign(target) { var args = []; for (var _i = 1; _i < arguments.length; _i++) { args[_i - 1] = arguments[_i]; } var e_1, _a; if (target === null || target === undefined) { throw new TypeError('Cannot convert undefined or null to object'); } var to = Object(target); try { for (var args_1 = __values(args), args_1_1 = args_1.next(); !args_1_1.done; args_1_1 = args_1.next()) { var source = args_1_1.value; if (source !== null) { for (var nextKey in source) { if (Object.prototype.hasOwnProperty.call(source, nextKey)) { to[nextKey] = source[nextKey]; } } } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (args_1_1 && !args_1_1.done && (_a = args_1.return)) _a.call(args_1); } finally { if (e_1) throw e_1.error; } } return to; } exports.assign = assign; }); unwrapExports(object); var object_1 = object.serialize; var object_2 = object.deserialize; var object_3 = object.clone; var object_4 = object.fill; var object_5 = object.urlEncode; var object_6 = object.serializeObject; var object_7 = object.limitObjectDepthToSize; var object_8 = object.serializeKeysToEventMessage; var object_9 = object.assign; var string = createCommonjsModule(function (module, exports) { var __values = (commonjsGlobal && commonjsGlobal.__values) || function (o) { var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; if (m) return m.call(o); return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; }; Object.defineProperty(exports, "__esModule", { value: true }); /** * Encodes given object into url-friendly format * * @param str An object that contains serializable values * @param max Maximum number of characters in truncated string * @returns string Encoded */ function truncate(str, max) { if (max === void 0) { max = 0; } if (max === 0 || !is.isString(str)) { return str; } return str.length <= max ? str : str.substr(0, max) + "\u2026"; } exports.truncate = truncate; /** * This is basically just `trim_line` from * https://github.com/getsentry/sentry/blob/master/src/sentry/lang/javascript/processor.py#L67 * * @param str An object that contains serializable values * @param max Maximum number of characters in truncated string * @returns string Encoded */ function snipLine(line, colno) { var newLine = line; var ll = newLine.length; if (ll <= 150) { return newLine; } if (colno > ll) { colno = ll; // tslint:disable-line:no-parameter-reassignment } var start = Math.max(colno - 60, 0); if (start < 5) { start = 0; } var end = Math.min(start + 140, ll); if (end > ll - 5) { end = ll; } if (end === ll) { start = Math.max(end - 140, 0); } newLine = newLine.slice(start, end); if (start > 0) { newLine = "'{snip} " + newLine; } if (end < ll) { newLine += ' {snip}'; } return newLine; } exports.snipLine = snipLine; /** * Join values in array * @param input array of values to be joined together * @param delimiter string to be placed in-between values * @returns Joined values */ function safeJoin(input, delimiter) { var e_1, _a; if (!Array.isArray(input)) { return ''; } var output = []; try { for (var input_1 = __values(input), input_1_1 = input_1.next(); !input_1_1.done; input_1_1 = input_1.next()) { var value = input_1_1.value; try { output.push(String(value)); } catch (e) { output.push('[value cannot be serialized]'); } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (input_1_1 && !input_1_1.done && (_a = input_1.return)) _a.call(input_1); } finally { if (e_1) throw e_1.error; } } return output.join(delimiter); } exports.safeJoin = safeJoin; /** * Checks if given value is included in the target * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes#Polyfill * @param target source string * @param search string to be looked for * @returns An answer */ function includes(target, search) { if (search.length > target.length) { return false; } else { return target.indexOf(search) !== -1; } } exports.includes = includes; }); unwrapExports(string); var string_1 = string.truncate; var string_2 = string.snipLine; var string_3 = string.safeJoin; var string_4 = string.includes; // tslint:disable /* * JavaScript MD5 * https://github.com/blueimp/JavaScript-MD5 * * Copyright 2011, Sebastian Tschan * https://blueimp.net * * Licensed under the MIT license: * https://opensource.org/licenses/MIT * * Based on * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message * Digest Algorithm, as defined in RFC 1321. * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet * Distributed under the BSD License * See http://pajhome.org.uk/crypt/md5 for more info. */ /** * Add integers, wrapping at 2^32. This uses 16-bit operations internally * to work around bugs in some JS interpreters. */ function safeAdd(x, y) { var lsw = (x & 0xffff) + (y & 0xffff); var msw = (x >> 16) + (y >> 16) + (lsw >> 16); return (msw << 16) | (lsw & 0xffff); } /** * Bitwise rotate a 32-bit number to the left. */ function bitRotateLeft(num, cnt) { return (num << cnt) | (num >>> (32 - cnt)); } /** * These functions implement the four basic operations the algorithm uses. */ function md5cmn(q, a, b, x, s, t) { return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b); } function md5ff(a, b, c, d, x, s, t) { return md5cmn((b & c) | (~b & d), a, b, x, s, t); } function md5gg(a, b, c, d, x, s, t) { return md5cmn((b & d) | (c & ~d), a, b, x, s, t); } function md5hh(a, b, c, d, x, s, t) { return md5cmn(b ^ c ^ d, a, b, x, s, t); } function md5ii(a, b, c, d, x, s, t) { return md5cmn(c ^ (b | ~d), a, b, x, s, t); } /** * Calculate the MD5 of an array of little-endian words, and a bit length. */ function binlMD5(x, len) { /** append padding */ x[len >> 5] |= 0x80 << len % 32; x[(((len + 64) >>> 9) << 4) + 14] = len; var i; var olda; var oldb; var oldc; var oldd; var a = 1732584193; var b = -271733879; var c = -1732584194; var d = 271733878; for (i = 0; i < x.length; i += 16) { olda = a; oldb = b; oldc = c; oldd = d; a = md5ff(a, b, c, d, x[i], 7, -680876936); d = md5ff(d, a, b, c, x[i + 1], 12, -389564586); c = md5ff(c, d, a, b, x[i + 2], 17, 606105819); b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330); a = md5ff(a, b, c, d, x[i + 4], 7, -176418897); d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426); c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341); b = md5ff(b, c, d, a, x[i + 7], 22, -45705983); a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416); d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417); c = md5ff(c, d, a, b, x[i + 10], 17, -42063); b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162); a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682); d = md5ff(d, a, b, c, x[i + 13], 12, -40341101); c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290); b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329); a = md5gg(a, b, c, d, x[i + 1], 5, -165796510); d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632); c = md5gg(c, d, a, b, x[i + 11], 14, 643717713); b = md5gg(b, c, d, a, x[i], 20, -373897302); a = md5gg(a, b, c, d, x[i + 5], 5, -701558691); d = md5gg(d, a, b, c, x[i + 10], 9, 38016083); c = md5gg(c, d, a, b, x[i + 15], 14, -660478335); b = md5gg(b, c, d, a, x[i + 4], 20, -405537848); a = md5gg(a, b, c, d, x[i + 9], 5, 568446438); d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690); c = md5gg(c, d, a, b, x[i + 3], 14, -187363961); b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501); a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467); d = md5gg(d, a, b, c, x[i + 2], 9, -51403784); c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473); b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734); a = md5hh(a, b, c, d, x[i + 5], 4, -378558); d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463); c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562); b = md5hh(b, c, d, a, x[i + 14], 23, -35309556); a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060); d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353); c = md5hh(c, d, a, b, x[i + 7], 16, -155497632); b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640); a = md5hh(a, b, c, d, x[i + 13], 4, 681279174); d = md5hh(d, a, b, c, x[i], 11, -358537222); c = md5hh(c, d, a, b, x[i + 3], 16, -722521979); b = md5hh(b, c, d, a, x[i + 6], 23, 76029189); a = md5hh(a, b, c, d, x[i + 9], 4, -640364487); d = md5hh(d, a, b, c, x[i + 12], 11, -421815835); c = md5hh(c, d, a, b, x[i + 15], 16, 530742520); b = md5hh(b, c, d, a, x[i + 2], 23, -995338651); a = md5ii(a, b, c, d, x[i], 6, -198630844); d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415); c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905); b = md5ii(b, c, d, a, x[i + 5], 21, -57434055); a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571); d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606); c = md5ii(c, d, a, b, x[i + 10], 15, -1051523); b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799); a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359); d = md5ii(d, a, b, c, x[i + 15], 10, -30611744); c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380); b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649); a = md5ii(a, b, c, d, x[i + 4], 6, -145523070); d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379); c = md5ii(c, d, a, b, x[i + 2], 15, 718787259); b = md5ii(b, c, d, a, x[i + 9], 21, -343485551); a = safeAdd(a, olda); b = safeAdd(b, oldb); c = safeAdd(c, oldc); d = safeAdd(d, oldd); } return [a, b, c, d]; } /** * Convert an array of little-endian words to a string */ function binl2rstr(input) { var i; var output = ''; var length32 = input.length * 32; for (i = 0; i < length32; i += 8) { output += String.fromCharCode((input[i >> 5] >>> i % 32) & 0xff); } return output; } /** * Convert a raw string to an array of little-endian words * Characters >255 have their high-byte silently ignored. */ function rstr2binl(input) { var i; var output = []; output[(input.length >> 2) - 1] = undefined; for (i = 0; i < output.length; i += 1) { output[i] = 0; } var length8 = input.length * 8; for (i = 0; i < length8; i += 8) { output[i >> 5] |= (input.charCodeAt(i / 8) & 0xff) << i % 32; } return output; } /** * Calculate the MD5 of a raw string */ function rstrMD5(s) { return binl2rstr(binlMD5(rstr2binl(s), s.length * 8)); } /** * Calculate the HMAC-MD5, of a key and some data (raw strings) */ function rstrHMACMD5(key, data) { var i; var bkey = rstr2binl(key); var ipad = []; var opad = []; var hash; ipad[15] = opad[15] = undefined; if (bkey.length > 16) { bkey = binlMD5(bkey, key.length * 8); } for (i = 0; i < 16; i += 1) { ipad[i] = bkey[i] ^ 0x36363636; opad[i] = bkey[i] ^ 0x5c5c5c5c; } hash = binlMD5(ipad.concat(rstr2binl(data)), 512 + data.length * 8); return binl2rstr(binlMD5(opad.concat(hash), 512 + 128)); } /** * Convert a raw string to a hex string */ function rstr2hex(input) { var hexTab = '0123456789abcdef'; var output = ''; var x; var i; for (i = 0; i < input.length; i += 1) { x = input.charCodeAt(i); output += hexTab.charAt((x >>> 4) & 0x0f) + hexTab.charAt(x & 0x0f); } return output; } /** * Encode a string as utf-8 */ function str2rstrUTF8(input) { return unescape(encodeURIComponent(input)); } /* * Take string arguments and return either raw or hex encoded strings */ function rawMD5(s) { return rstrMD5(str2rstrUTF8(s)); } function hexMD5(s) { return rstr2hex(rawMD5(s)); } function rawHMACMD5(k, d) { return rstrHMACMD5(str2rstrUTF8(k), str2rstrUTF8(d)); } function hexHMACMD5(k, d) { return rstr2hex(rawHMACMD5(k, d)); } function md5(string, key, raw) { if (!key) { if (!raw) { return hexMD5(string); } return rawMD5(string); } if (!raw) { return hexHMACMD5(key, string); } return rawHMACMD5(key, string); } // tslint:disable /** * TraceKit - Cross brower stack traces * * This was originally forked from github.com/occ/TraceKit, but has since been * largely modified and is now maintained as part of Sentry JS SDK. * * NOTE: Last merge with upstream repository * Jul 11,2018 - #f03357c * * https://github.com/csnover/TraceKit * @license MIT * @namespace TraceKit */ var window$1 = misc_2(); var TraceKit = { wrap: function () { return function () { }; }, report: false, collectWindowErrors: false, computeStackTrace: false, remoteFetching: false, linesOfContext: false, extendToAsynchronousCallbacks: false, }; // var TraceKit: TraceKitInterface = {}; // var TraceKit = {}; // global reference to slice var _slice = [].slice; var UNKNOWN_FUNCTION = '?'; // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Error_types var ERROR_TYPES_RE = /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/; /** * A better form of hasOwnProperty<br/> * Example: `_has(MainHostObject, property) === true/false` * * @param {Object} object to check property * @param {string} key to check * @return {Boolean} true if the object has the key and it is not inherited */ function _has(object, key) { return Object.prototype.hasOwnProperty.call(object, key); } /** * A safe form of location.href<br/> * * @return {string} location.href */ function getLocationHref() { if (typeof document === 'undefined' || document.location == null) return ''; return document.location.href; } /** * A safe form of location.origin<br/> * * @return {string} location.origin */ function getLocationOrigin() { if (typeof document === 'undefined' || document.location == null) return ''; // Oh dear IE10... if (!document.location.origin) { return (document.location.protocol + '//' + document.location.hostname + (document.location.port ? ':' + document.location.port : '')); } return document.location.origin; } /** * Wrap any function in a TraceKit reporter<br/> * Example: `func = TraceKit.wrap(func);` * * @param {Function} func Function to be wrapped * @return {Function} The wrapped func * @memberof TraceKit */ TraceKit.wrap = function traceKitWrapper(func) { function wrapped() { try { // @ts-ignore return func.apply(this, arguments); } catch (e) { TraceKit.report(e); throw e; } } return wrapped; }; /** * Cross-browser processing of unhandled exceptions * * Syntax: * ```js * TraceKit.report.subscribe(function(stackInfo) { ... }) * TraceKit.report.unsubscribe(function(stackInfo) { ... }) * TraceKit.report(exception) * try { ...code... } catch(ex) { TraceKit.report(ex); } * ``` * * Supports: * - Firefox: full stack trace with line numbers, plus column number * on top frame; column number is not guaranteed * - Opera: full stack trace with line and column numbers * - Chrome: full stack trace with line and column numbers * - Safari: line and column number for the top frame only; some frames * may be missing, and column number is not guaranteed * - IE: line and column number for the top frame only; some frames * may be missing, and column number is not guaranteed * * In theory, TraceKit should work on all of the following versions: * - IE5.5+ (only 8.0 tested) * - Firefox 0.9+ (only 3.5+ tested) * - Opera 7+ (only 10.50 tested; versions 9 and earlier may require * Exceptions Have Stacktrace