3 function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
5 function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
7 function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
9 function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
11 function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
14 if ((typeof exports === "undefined" ? "undefined" : _typeof(exports)) === "object" && typeof module !== "undefined") {
16 } else if (typeof define === "function" && define.amd) {
21 if (typeof window !== "undefined") {
23 } else if (typeof global !== "undefined") {
25 } else if (typeof self !== "undefined") {
34 var define, module, exports;
40 var c = "function" == typeof require && require;
41 if (!f && c) return c(i, !0);
42 if (u) return u(i, !0);
43 var a = new Error("Cannot find module '" + i + "'");
44 throw a.code = "MODULE_NOT_FOUND", a;
50 e[i][0].call(p.exports, function (r) {
53 }, p, p.exports, r, e, n, t);
59 for (var u = "function" == typeof require && require, i = 0; i < t.length; i++) {
68 1: [function (require, module, exports) {
79 * Parse or format the given `val`.
83 * - `long` verbose formatting [false]
85 * @param {String|Number} val
86 * @param {Object} [options]
87 * @throws {Error} throw an error if val is not a non-empty string or a number
88 * @return {String|Number}
92 module.exports = function (val, options) {
93 options = options || {};
95 var type = _typeof(val);
97 if (type === 'string' && val.length > 0) {
99 } else if (type === 'number' && isNaN(val) === false) {
100 return options.long ? fmtLong(val) : fmtShort(val);
103 throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val));
106 * Parse the given `str` and return milliseconds.
108 * @param {String} str
114 function parse(str) {
117 if (str.length > 100) {
121 var match = /^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str);
127 var n = parseFloat(match[1]);
128 var type = (match[2] || 'ms').toLowerCase();
181 * Short format for `ms`.
189 function fmtShort(ms) {
190 var msAbs = Math.abs(ms);
193 return Math.round(ms / d) + 'd';
197 return Math.round(ms / h) + 'h';
201 return Math.round(ms / m) + 'm';
205 return Math.round(ms / s) + 's';
211 * Long format for `ms`.
219 function fmtLong(ms) {
220 var msAbs = Math.abs(ms);
223 return plural(ms, msAbs, d, 'day');
227 return plural(ms, msAbs, h, 'hour');
231 return plural(ms, msAbs, m, 'minute');
235 return plural(ms, msAbs, s, 'second');
241 * Pluralization helper.
245 function plural(ms, msAbs, n, name) {
246 var isPlural = msAbs >= n * 1.5;
247 return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
250 2: [function (require, module, exports) {
251 // shim for using process in browser
252 var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it
253 // don't break things. But we need to wrap it in a try catch in case it is
254 // wrapped in strict mode code which doesn't define any globals. It's inside a
255 // function because try/catches deoptimize in certain engines.
257 var cachedSetTimeout;
258 var cachedClearTimeout;
260 function defaultSetTimout() {
261 throw new Error('setTimeout has not been defined');
264 function defaultClearTimeout() {
265 throw new Error('clearTimeout has not been defined');
270 if (typeof setTimeout === 'function') {
271 cachedSetTimeout = setTimeout;
273 cachedSetTimeout = defaultSetTimout;
276 cachedSetTimeout = defaultSetTimout;
280 if (typeof clearTimeout === 'function') {
281 cachedClearTimeout = clearTimeout;
283 cachedClearTimeout = defaultClearTimeout;
286 cachedClearTimeout = defaultClearTimeout;
290 function runTimeout(fun) {
291 if (cachedSetTimeout === setTimeout) {
292 //normal enviroments in sane situations
293 return setTimeout(fun, 0);
294 } // if setTimeout wasn't available but was latter defined
297 if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
298 cachedSetTimeout = setTimeout;
299 return setTimeout(fun, 0);
303 // when when somebody has screwed with setTimeout but no I.E. maddness
304 return cachedSetTimeout(fun, 0);
307 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
308 return cachedSetTimeout.call(null, fun, 0);
310 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
311 return cachedSetTimeout.call(this, fun, 0);
316 function runClearTimeout(marker) {
317 if (cachedClearTimeout === clearTimeout) {
318 //normal enviroments in sane situations
319 return clearTimeout(marker);
320 } // if clearTimeout wasn't available but was latter defined
323 if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
324 cachedClearTimeout = clearTimeout;
325 return clearTimeout(marker);
329 // when when somebody has screwed with setTimeout but no I.E. maddness
330 return cachedClearTimeout(marker);
333 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
334 return cachedClearTimeout.call(null, marker);
336 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
337 // Some versions of I.E. have different rules for clearTimeout vs setTimeout
338 return cachedClearTimeout.call(this, marker);
344 var draining = false;
348 function cleanUpNextTick() {
349 if (!draining || !currentQueue) {
355 if (currentQueue.length) {
356 queue = currentQueue.concat(queue);
366 function drainQueue() {
371 var timeout = runTimeout(cleanUpNextTick);
373 var len = queue.length;
376 currentQueue = queue;
379 while (++queueIndex < len) {
381 currentQueue[queueIndex].run();
391 runClearTimeout(timeout);
394 process.nextTick = function (fun) {
395 var args = new Array(arguments.length - 1);
397 if (arguments.length > 1) {
398 for (var i = 1; i < arguments.length; i++) {
399 args[i - 1] = arguments[i];
403 queue.push(new Item(fun, args));
405 if (queue.length === 1 && !draining) {
406 runTimeout(drainQueue);
408 }; // v8 likes predictible objects
411 function Item(fun, array) {
416 Item.prototype.run = function () {
417 this.fun.apply(null, this.array);
420 process.title = 'browser';
421 process.browser = true;
424 process.version = ''; // empty string to avoid regexp issues
426 process.versions = {};
431 process.addListener = noop;
434 process.removeListener = noop;
435 process.removeAllListeners = noop;
437 process.prependListener = noop;
438 process.prependOnceListener = noop;
440 process.listeners = function (name) {
444 process.binding = function (name) {
445 throw new Error('process.binding is not supported');
448 process.cwd = function () {
452 process.chdir = function (dir) {
453 throw new Error('process.chdir is not supported');
456 process.umask = function () {
460 3: [function (require, module, exports) {
462 * This is the common logic for both the Node.js and web browser
463 * implementations of `debug()`.
465 function setup(env) {
466 createDebug.debug = createDebug;
467 createDebug.default = createDebug;
468 createDebug.coerce = coerce;
469 createDebug.disable = disable;
470 createDebug.enable = enable;
471 createDebug.enabled = enabled;
472 createDebug.humanize = require('ms');
473 Object.keys(env).forEach(function (key) {
474 createDebug[key] = env[key];
477 * Active `debug` instances.
480 createDebug.instances = [];
482 * The currently active debug mode names, and names to skip.
485 createDebug.names = [];
486 createDebug.skips = [];
488 * Map of special "%n" handling functions, for the debug "format" argument.
490 * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
493 createDebug.formatters = {};
495 * Selects a color for a debug namespace
496 * @param {String} namespace The namespace string for the for the debug instance to be colored
497 * @return {Number|String} An ANSI color code for the given namespace
501 function selectColor(namespace) {
504 for (var i = 0; i < namespace.length; i++) {
505 hash = (hash << 5) - hash + namespace.charCodeAt(i);
506 hash |= 0; // Convert to 32bit integer
509 return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
512 createDebug.selectColor = selectColor;
514 * Create a debugger with the given `namespace`.
516 * @param {String} namespace
521 function createDebug(namespace) {
525 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
526 args[_key] = arguments[_key];
530 if (!debug.enabled) {
534 var self = debug; // Set `diff` timestamp
536 var curr = Number(new Date());
537 var ms = curr - (prevTime || curr);
539 self.prev = prevTime;
542 args[0] = createDebug.coerce(args[0]);
544 if (typeof args[0] !== 'string') {
545 // Anything else let's inspect with %O
547 } // Apply any `formatters` transformations
551 args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
552 // If we encounter an escaped % then don't increase the array index
553 if (match === '%%') {
558 var formatter = createDebug.formatters[format];
560 if (typeof formatter === 'function') {
561 var val = args[index];
562 match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format`
564 args.splice(index, 1);
569 }); // Apply env-specific formatting (colors, etc.)
571 createDebug.formatArgs.call(self, args);
572 var logFn = self.log || createDebug.log;
573 logFn.apply(self, args);
576 debug.namespace = namespace;
577 debug.enabled = createDebug.enabled(namespace);
578 debug.useColors = createDebug.useColors();
579 debug.color = selectColor(namespace);
580 debug.destroy = destroy;
581 debug.extend = extend; // Debug.formatArgs = formatArgs;
582 // debug.rawLog = rawLog;
583 // env-specific initialization logic for debug instances
585 if (typeof createDebug.init === 'function') {
586 createDebug.init(debug);
589 createDebug.instances.push(debug);
594 var index = createDebug.instances.indexOf(this);
597 createDebug.instances.splice(index, 1);
604 function extend(namespace, delimiter) {
605 var newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
606 newDebug.log = this.log;
610 * Enables a debug mode by namespaces. This can include modes
611 * separated by a colon and wildcards.
613 * @param {String} namespaces
618 function enable(namespaces) {
619 createDebug.save(namespaces);
620 createDebug.names = [];
621 createDebug.skips = [];
623 var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
624 var len = split.length;
626 for (i = 0; i < len; i++) {
628 // ignore empty strings
632 namespaces = split[i].replace(/\*/g, '.*?');
634 if (namespaces[0] === '-') {
635 createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
637 createDebug.names.push(new RegExp('^' + namespaces + '$'));
641 for (i = 0; i < createDebug.instances.length; i++) {
642 var instance = createDebug.instances[i];
643 instance.enabled = createDebug.enabled(instance.namespace);
647 * Disable debug output.
649 * @return {String} namespaces
655 var namespaces = [].concat(_toConsumableArray(createDebug.names.map(toNamespace)), _toConsumableArray(createDebug.skips.map(toNamespace).map(function (namespace) {
656 return '-' + namespace;
658 createDebug.enable('');
662 * Returns true if the given mode name is enabled, false otherwise.
664 * @param {String} name
670 function enabled(name) {
671 if (name[name.length - 1] === '*') {
678 for (i = 0, len = createDebug.skips.length; i < len; i++) {
679 if (createDebug.skips[i].test(name)) {
684 for (i = 0, len = createDebug.names.length; i < len; i++) {
685 if (createDebug.names[i].test(name)) {
693 * Convert regexp to namespace
695 * @param {RegExp} regxep
696 * @return {String} namespace
701 function toNamespace(regexp) {
702 return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, '*');
713 function coerce(val) {
714 if (val instanceof Error) {
715 return val.stack || val.message;
721 createDebug.enable(createDebug.load());
725 module.exports = setup;
729 4: [function (require, module, exports) {
730 (function (process) {
731 /* eslint-env browser */
734 * This is the web browser implementation of `debug()`.
737 exports.formatArgs = formatArgs;
740 exports.useColors = useColors;
741 exports.storage = localstorage();
746 exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'];
748 * Currently only WebKit-based Web Inspectors, Firefox >= v31,
749 * and the Firebug extension (any Firefox version) are known
750 * to support "%c" CSS customizations.
752 * TODO: add a `localStorage` variable to explicitly enable/disable colors
754 // eslint-disable-next-line complexity
756 function useColors() {
757 // NB: In an Electron preload script, document will be defined but not fully
758 // initialized. Since we know we're in Chrome, we'll just detect this case
760 if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
762 } // Internet Explorer and Edge do not support colors.
765 if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
767 } // Is webkit? http://stackoverflow.com/a/16459606/376773
768 // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
771 return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
772 typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
773 // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
774 typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
775 typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
778 * Colorize log arguments if enabled.
784 function formatArgs(args) {
785 args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
787 if (!this.useColors) {
791 var c = 'color: ' + this.color;
792 args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other
793 // arguments passed either before or after the %c, so we need to
794 // figure out the correct index to insert the CSS into
798 args[0].replace(/%[a-zA-Z%]/g, function (match) {
799 if (match === '%%') {
805 if (match === '%c') {
806 // We only are interested in the *last* %c
807 // (the user may have provided their own)
811 args.splice(lastC, 0, c);
814 * Invokes `console.log()` when available.
815 * No-op when `console.log` is not a "function".
824 // This hackery is required for IE8/9, where
825 // the `console.log` function doesn't have 'apply'
826 return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments);
831 * @param {String} namespaces
836 function save(namespaces) {
839 exports.storage.setItem('debug', namespaces);
841 exports.storage.removeItem('debug');
843 } catch (error) {// Swallow
844 // XXX (@Qix-) should we be logging these?
850 * @return {String} returns the previously persisted debug modes
859 r = exports.storage.getItem('debug');
860 } catch (error) {} // Swallow
861 // XXX (@Qix-) should we be logging these?
862 // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
865 if (!r && typeof process !== 'undefined' && 'env' in process) {
866 r = process.env.DEBUG;
872 * Localstorage attempts to return the localstorage.
874 * This is necessary because safari throws
875 * when a user disables cookies/localstorage
876 * and you attempt to access it.
878 * @return {LocalStorage}
883 function localstorage() {
885 // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
886 // The Browser also has localStorage in the global context.
888 } catch (error) {// Swallow
889 // XXX (@Qix-) should we be logging these?
893 module.exports = require('./common')(exports);
894 var formatters = module.exports.formatters;
896 * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
899 formatters.j = function (v) {
901 return JSON.stringify(v);
903 return '[UnexpectedJSONParseError]: ' + error.message;
906 }).call(this, require('_process'));