3 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); }
6 if ((typeof exports === "undefined" ? "undefined" : _typeof(exports)) === "object" && typeof module !== "undefined") {
8 } else if (typeof define === "function" && define.amd) {
13 if (typeof window !== "undefined") {
15 } else if (typeof global !== "undefined") {
17 } else if (typeof self !== "undefined") {
26 var define, module, exports;
32 var c = "function" == typeof require && require;
33 if (!f && c) return c(i, !0);
34 if (u) return u(i, !0);
35 var a = new Error("Cannot find module '" + i + "'");
36 throw a.code = "MODULE_NOT_FOUND", a;
42 e[i][0].call(p.exports, function (r) {
45 }, p, p.exports, r, e, n, t);
51 for (var u = "function" == typeof require && require, i = 0; i < t.length; i++) {
60 1: [function (require, module, exports) {
71 * Parse or format the given `val`.
75 * - `long` verbose formatting [false]
77 * @param {String|Number} val
78 * @param {Object} [options]
79 * @throws {Error} throw an error if val is not a non-empty string or a number
80 * @return {String|Number}
84 module.exports = function (val, options) {
85 options = options || {};
87 var type = _typeof(val);
89 if (type === 'string' && val.length > 0) {
91 } else if (type === 'number' && isNaN(val) === false) {
92 return options.long ? fmtLong(val) : fmtShort(val);
95 throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val));
98 * Parse the given `str` and return milliseconds.
100 * @param {String} str
106 function parse(str) {
109 if (str.length > 100) {
113 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);
119 var n = parseFloat(match[1]);
120 var type = (match[2] || 'ms').toLowerCase();
173 * Short format for `ms`.
181 function fmtShort(ms) {
182 var msAbs = Math.abs(ms);
185 return Math.round(ms / d) + 'd';
189 return Math.round(ms / h) + 'h';
193 return Math.round(ms / m) + 'm';
197 return Math.round(ms / s) + 's';
203 * Long format for `ms`.
211 function fmtLong(ms) {
212 var msAbs = Math.abs(ms);
215 return plural(ms, msAbs, d, 'day');
219 return plural(ms, msAbs, h, 'hour');
223 return plural(ms, msAbs, m, 'minute');
227 return plural(ms, msAbs, s, 'second');
233 * Pluralization helper.
237 function plural(ms, msAbs, n, name) {
238 var isPlural = msAbs >= n * 1.5;
239 return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
242 2: [function (require, module, exports) {
243 // shim for using process in browser
244 var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it
245 // don't break things. But we need to wrap it in a try catch in case it is
246 // wrapped in strict mode code which doesn't define any globals. It's inside a
247 // function because try/catches deoptimize in certain engines.
249 var cachedSetTimeout;
250 var cachedClearTimeout;
252 function defaultSetTimout() {
253 throw new Error('setTimeout has not been defined');
256 function defaultClearTimeout() {
257 throw new Error('clearTimeout has not been defined');
262 if (typeof setTimeout === 'function') {
263 cachedSetTimeout = setTimeout;
265 cachedSetTimeout = defaultSetTimout;
268 cachedSetTimeout = defaultSetTimout;
272 if (typeof clearTimeout === 'function') {
273 cachedClearTimeout = clearTimeout;
275 cachedClearTimeout = defaultClearTimeout;
278 cachedClearTimeout = defaultClearTimeout;
282 function runTimeout(fun) {
283 if (cachedSetTimeout === setTimeout) {
284 //normal enviroments in sane situations
285 return setTimeout(fun, 0);
286 } // if setTimeout wasn't available but was latter defined
289 if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
290 cachedSetTimeout = setTimeout;
291 return setTimeout(fun, 0);
295 // when when somebody has screwed with setTimeout but no I.E. maddness
296 return cachedSetTimeout(fun, 0);
299 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
300 return cachedSetTimeout.call(null, fun, 0);
302 // 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
303 return cachedSetTimeout.call(this, fun, 0);
308 function runClearTimeout(marker) {
309 if (cachedClearTimeout === clearTimeout) {
310 //normal enviroments in sane situations
311 return clearTimeout(marker);
312 } // if clearTimeout wasn't available but was latter defined
315 if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
316 cachedClearTimeout = clearTimeout;
317 return clearTimeout(marker);
321 // when when somebody has screwed with setTimeout but no I.E. maddness
322 return cachedClearTimeout(marker);
325 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
326 return cachedClearTimeout.call(null, marker);
328 // 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.
329 // Some versions of I.E. have different rules for clearTimeout vs setTimeout
330 return cachedClearTimeout.call(this, marker);
336 var draining = false;
340 function cleanUpNextTick() {
341 if (!draining || !currentQueue) {
347 if (currentQueue.length) {
348 queue = currentQueue.concat(queue);
358 function drainQueue() {
363 var timeout = runTimeout(cleanUpNextTick);
365 var len = queue.length;
368 currentQueue = queue;
371 while (++queueIndex < len) {
373 currentQueue[queueIndex].run();
383 runClearTimeout(timeout);
386 process.nextTick = function (fun) {
387 var args = new Array(arguments.length - 1);
389 if (arguments.length > 1) {
390 for (var i = 1; i < arguments.length; i++) {
391 args[i - 1] = arguments[i];
395 queue.push(new Item(fun, args));
397 if (queue.length === 1 && !draining) {
398 runTimeout(drainQueue);
400 }; // v8 likes predictible objects
403 function Item(fun, array) {
408 Item.prototype.run = function () {
409 this.fun.apply(null, this.array);
412 process.title = 'browser';
413 process.browser = true;
416 process.version = ''; // empty string to avoid regexp issues
418 process.versions = {};
423 process.addListener = noop;
426 process.removeListener = noop;
427 process.removeAllListeners = noop;
429 process.prependListener = noop;
430 process.prependOnceListener = noop;
432 process.listeners = function (name) {
436 process.binding = function (name) {
437 throw new Error('process.binding is not supported');
440 process.cwd = function () {
444 process.chdir = function (dir) {
445 throw new Error('process.chdir is not supported');
448 process.umask = function () {
452 3: [function (require, module, exports) {
454 * This is the common logic for both the Node.js and web browser
455 * implementations of `debug()`.
457 function setup(env) {
458 createDebug.debug = createDebug;
459 createDebug.default = createDebug;
460 createDebug.coerce = coerce;
461 createDebug.disable = disable;
462 createDebug.enable = enable;
463 createDebug.enabled = enabled;
464 createDebug.humanize = require('ms');
465 Object.keys(env).forEach(function (key) {
466 createDebug[key] = env[key];
469 * Active `debug` instances.
472 createDebug.instances = [];
474 * The currently active debug mode names, and names to skip.
477 createDebug.names = [];
478 createDebug.skips = [];
480 * Map of special "%n" handling functions, for the debug "format" argument.
482 * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
485 createDebug.formatters = {};
487 * Selects a color for a debug namespace
488 * @param {String} namespace The namespace string for the for the debug instance to be colored
489 * @return {Number|String} An ANSI color code for the given namespace
493 function selectColor(namespace) {
496 for (var i = 0; i < namespace.length; i++) {
497 hash = (hash << 5) - hash + namespace.charCodeAt(i);
498 hash |= 0; // Convert to 32bit integer
501 return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
504 createDebug.selectColor = selectColor;
506 * Create a debugger with the given `namespace`.
508 * @param {String} namespace
513 function createDebug(namespace) {
517 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
518 args[_key] = arguments[_key];
522 if (!debug.enabled) {
526 var self = debug; // Set `diff` timestamp
528 var curr = Number(new Date());
529 var ms = curr - (prevTime || curr);
531 self.prev = prevTime;
534 args[0] = createDebug.coerce(args[0]);
536 if (typeof args[0] !== 'string') {
537 // Anything else let's inspect with %O
539 } // Apply any `formatters` transformations
543 args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
544 // If we encounter an escaped % then don't increase the array index
545 if (match === '%%') {
550 var formatter = createDebug.formatters[format];
552 if (typeof formatter === 'function') {
553 var val = args[index];
554 match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format`
556 args.splice(index, 1);
561 }); // Apply env-specific formatting (colors, etc.)
563 createDebug.formatArgs.call(self, args);
564 var logFn = self.log || createDebug.log;
565 logFn.apply(self, args);
568 debug.namespace = namespace;
569 debug.enabled = createDebug.enabled(namespace);
570 debug.useColors = createDebug.useColors();
571 debug.color = selectColor(namespace);
572 debug.destroy = destroy;
573 debug.extend = extend; // Debug.formatArgs = formatArgs;
574 // debug.rawLog = rawLog;
575 // env-specific initialization logic for debug instances
577 if (typeof createDebug.init === 'function') {
578 createDebug.init(debug);
581 createDebug.instances.push(debug);
586 var index = createDebug.instances.indexOf(this);
589 createDebug.instances.splice(index, 1);
596 function extend(namespace, delimiter) {
597 return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
600 * Enables a debug mode by namespaces. This can include modes
601 * separated by a colon and wildcards.
603 * @param {String} namespaces
608 function enable(namespaces) {
609 createDebug.save(namespaces);
610 createDebug.names = [];
611 createDebug.skips = [];
613 var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
614 var len = split.length;
616 for (i = 0; i < len; i++) {
618 // ignore empty strings
622 namespaces = split[i].replace(/\*/g, '.*?');
624 if (namespaces[0] === '-') {
625 createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
627 createDebug.names.push(new RegExp('^' + namespaces + '$'));
631 for (i = 0; i < createDebug.instances.length; i++) {
632 var instance = createDebug.instances[i];
633 instance.enabled = createDebug.enabled(instance.namespace);
637 * Disable debug output.
644 createDebug.enable('');
647 * Returns true if the given mode name is enabled, false otherwise.
649 * @param {String} name
655 function enabled(name) {
656 if (name[name.length - 1] === '*') {
663 for (i = 0, len = createDebug.skips.length; i < len; i++) {
664 if (createDebug.skips[i].test(name)) {
669 for (i = 0, len = createDebug.names.length; i < len; i++) {
670 if (createDebug.names[i].test(name)) {
686 function coerce(val) {
687 if (val instanceof Error) {
688 return val.stack || val.message;
694 createDebug.enable(createDebug.load());
698 module.exports = setup;
702 4: [function (require, module, exports) {
703 (function (process) {
704 /* eslint-env browser */
707 * This is the web browser implementation of `debug()`.
710 exports.formatArgs = formatArgs;
713 exports.useColors = useColors;
714 exports.storage = localstorage();
719 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'];
721 * Currently only WebKit-based Web Inspectors, Firefox >= v31,
722 * and the Firebug extension (any Firefox version) are known
723 * to support "%c" CSS customizations.
725 * TODO: add a `localStorage` variable to explicitly enable/disable colors
727 // eslint-disable-next-line complexity
729 function useColors() {
730 // NB: In an Electron preload script, document will be defined but not fully
731 // initialized. Since we know we're in Chrome, we'll just detect this case
733 if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
735 } // Internet Explorer and Edge do not support colors.
738 if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
740 } // Is webkit? http://stackoverflow.com/a/16459606/376773
741 // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
744 return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
745 typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
746 // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
747 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
748 typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
751 * Colorize log arguments if enabled.
757 function formatArgs(args) {
758 args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
760 if (!this.useColors) {
764 var c = 'color: ' + this.color;
765 args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other
766 // arguments passed either before or after the %c, so we need to
767 // figure out the correct index to insert the CSS into
771 args[0].replace(/%[a-zA-Z%]/g, function (match) {
772 if (match === '%%') {
778 if (match === '%c') {
779 // We only are interested in the *last* %c
780 // (the user may have provided their own)
784 args.splice(lastC, 0, c);
787 * Invokes `console.log()` when available.
788 * No-op when `console.log` is not a "function".
797 // This hackery is required for IE8/9, where
798 // the `console.log` function doesn't have 'apply'
799 return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments);
804 * @param {String} namespaces
809 function save(namespaces) {
812 exports.storage.setItem('debug', namespaces);
814 exports.storage.removeItem('debug');
816 } catch (error) {// Swallow
817 // XXX (@Qix-) should we be logging these?
823 * @return {String} returns the previously persisted debug modes
832 r = exports.storage.getItem('debug');
833 } catch (error) {} // Swallow
834 // XXX (@Qix-) should we be logging these?
835 // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
838 if (!r && typeof process !== 'undefined' && 'env' in process) {
839 r = process.env.DEBUG;
845 * Localstorage attempts to return the localstorage.
847 * This is necessary because safari throws
848 * when a user disables cookies/localstorage
849 * and you attempt to access it.
851 * @return {LocalStorage}
856 function localstorage() {
858 // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
859 // The Browser also has localStorage in the global context.
861 } catch (error) {// Swallow
862 // XXX (@Qix-) should we be logging these?
866 module.exports = require('./common')(exports);
867 var formatters = module.exports.formatters;
869 * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
872 formatters.j = function (v) {
874 return JSON.stringify(v);
876 return '[UnexpectedJSONParseError]: ' + error.message;
879 }).call(this, require('_process'));