You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

912 lines
27 KiB

4 years ago
  1. "use strict";
  2. function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
  3. function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
  4. function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
  5. 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; } }
  6. 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); }
  7. (function (f) {
  8. if ((typeof exports === "undefined" ? "undefined" : _typeof(exports)) === "object" && typeof module !== "undefined") {
  9. module.exports = f();
  10. } else if (typeof define === "function" && define.amd) {
  11. define([], f);
  12. } else {
  13. var g;
  14. if (typeof window !== "undefined") {
  15. g = window;
  16. } else if (typeof global !== "undefined") {
  17. g = global;
  18. } else if (typeof self !== "undefined") {
  19. g = self;
  20. } else {
  21. g = this;
  22. }
  23. g.debug = f();
  24. }
  25. })(function () {
  26. var define, module, exports;
  27. return function () {
  28. function r(e, n, t) {
  29. function o(i, f) {
  30. if (!n[i]) {
  31. if (!e[i]) {
  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;
  37. }
  38. var p = n[i] = {
  39. exports: {}
  40. };
  41. e[i][0].call(p.exports, function (r) {
  42. var n = e[i][1][r];
  43. return o(n || r);
  44. }, p, p.exports, r, e, n, t);
  45. }
  46. return n[i].exports;
  47. }
  48. for (var u = "function" == typeof require && require, i = 0; i < t.length; i++) {
  49. o(t[i]);
  50. }
  51. return o;
  52. }
  53. return r;
  54. }()({
  55. 1: [function (require, module, exports) {
  56. /**
  57. * Helpers.
  58. */
  59. var s = 1000;
  60. var m = s * 60;
  61. var h = m * 60;
  62. var d = h * 24;
  63. var w = d * 7;
  64. var y = d * 365.25;
  65. /**
  66. * Parse or format the given `val`.
  67. *
  68. * Options:
  69. *
  70. * - `long` verbose formatting [false]
  71. *
  72. * @param {String|Number} val
  73. * @param {Object} [options]
  74. * @throws {Error} throw an error if val is not a non-empty string or a number
  75. * @return {String|Number}
  76. * @api public
  77. */
  78. module.exports = function (val, options) {
  79. options = options || {};
  80. var type = _typeof(val);
  81. if (type === 'string' && val.length > 0) {
  82. return parse(val);
  83. } else if (type === 'number' && isNaN(val) === false) {
  84. return options.long ? fmtLong(val) : fmtShort(val);
  85. }
  86. throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val));
  87. };
  88. /**
  89. * Parse the given `str` and return milliseconds.
  90. *
  91. * @param {String} str
  92. * @return {Number}
  93. * @api private
  94. */
  95. function parse(str) {
  96. str = String(str);
  97. if (str.length > 100) {
  98. return;
  99. }
  100. 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);
  101. if (!match) {
  102. return;
  103. }
  104. var n = parseFloat(match[1]);
  105. var type = (match[2] || 'ms').toLowerCase();
  106. switch (type) {
  107. case 'years':
  108. case 'year':
  109. case 'yrs':
  110. case 'yr':
  111. case 'y':
  112. return n * y;
  113. case 'weeks':
  114. case 'week':
  115. case 'w':
  116. return n * w;
  117. case 'days':
  118. case 'day':
  119. case 'd':
  120. return n * d;
  121. case 'hours':
  122. case 'hour':
  123. case 'hrs':
  124. case 'hr':
  125. case 'h':
  126. return n * h;
  127. case 'minutes':
  128. case 'minute':
  129. case 'mins':
  130. case 'min':
  131. case 'm':
  132. return n * m;
  133. case 'seconds':
  134. case 'second':
  135. case 'secs':
  136. case 'sec':
  137. case 's':
  138. return n * s;
  139. case 'milliseconds':
  140. case 'millisecond':
  141. case 'msecs':
  142. case 'msec':
  143. case 'ms':
  144. return n;
  145. default:
  146. return undefined;
  147. }
  148. }
  149. /**
  150. * Short format for `ms`.
  151. *
  152. * @param {Number} ms
  153. * @return {String}
  154. * @api private
  155. */
  156. function fmtShort(ms) {
  157. var msAbs = Math.abs(ms);
  158. if (msAbs >= d) {
  159. return Math.round(ms / d) + 'd';
  160. }
  161. if (msAbs >= h) {
  162. return Math.round(ms / h) + 'h';
  163. }
  164. if (msAbs >= m) {
  165. return Math.round(ms / m) + 'm';
  166. }
  167. if (msAbs >= s) {
  168. return Math.round(ms / s) + 's';
  169. }
  170. return ms + 'ms';
  171. }
  172. /**
  173. * Long format for `ms`.
  174. *
  175. * @param {Number} ms
  176. * @return {String}
  177. * @api private
  178. */
  179. function fmtLong(ms) {
  180. var msAbs = Math.abs(ms);
  181. if (msAbs >= d) {
  182. return plural(ms, msAbs, d, 'day');
  183. }
  184. if (msAbs >= h) {
  185. return plural(ms, msAbs, h, 'hour');
  186. }
  187. if (msAbs >= m) {
  188. return plural(ms, msAbs, m, 'minute');
  189. }
  190. if (msAbs >= s) {
  191. return plural(ms, msAbs, s, 'second');
  192. }
  193. return ms + ' ms';
  194. }
  195. /**
  196. * Pluralization helper.
  197. */
  198. function plural(ms, msAbs, n, name) {
  199. var isPlural = msAbs >= n * 1.5;
  200. return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
  201. }
  202. }, {}],
  203. 2: [function (require, module, exports) {
  204. // shim for using process in browser
  205. var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it
  206. // don't break things. But we need to wrap it in a try catch in case it is
  207. // wrapped in strict mode code which doesn't define any globals. It's inside a
  208. // function because try/catches deoptimize in certain engines.
  209. var cachedSetTimeout;
  210. var cachedClearTimeout;
  211. function defaultSetTimout() {
  212. throw new Error('setTimeout has not been defined');
  213. }
  214. function defaultClearTimeout() {
  215. throw new Error('clearTimeout has not been defined');
  216. }
  217. (function () {
  218. try {
  219. if (typeof setTimeout === 'function') {
  220. cachedSetTimeout = setTimeout;
  221. } else {
  222. cachedSetTimeout = defaultSetTimout;
  223. }
  224. } catch (e) {
  225. cachedSetTimeout = defaultSetTimout;
  226. }
  227. try {
  228. if (typeof clearTimeout === 'function') {
  229. cachedClearTimeout = clearTimeout;
  230. } else {
  231. cachedClearTimeout = defaultClearTimeout;
  232. }
  233. } catch (e) {
  234. cachedClearTimeout = defaultClearTimeout;
  235. }
  236. })();
  237. function runTimeout(fun) {
  238. if (cachedSetTimeout === setTimeout) {
  239. //normal enviroments in sane situations
  240. return setTimeout(fun, 0);
  241. } // if setTimeout wasn't available but was latter defined
  242. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  243. cachedSetTimeout = setTimeout;
  244. return setTimeout(fun, 0);
  245. }
  246. try {
  247. // when when somebody has screwed with setTimeout but no I.E. maddness
  248. return cachedSetTimeout(fun, 0);
  249. } catch (e) {
  250. try {
  251. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  252. return cachedSetTimeout.call(null, fun, 0);
  253. } catch (e) {
  254. // 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
  255. return cachedSetTimeout.call(this, fun, 0);
  256. }
  257. }
  258. }
  259. function runClearTimeout(marker) {
  260. if (cachedClearTimeout === clearTimeout) {
  261. //normal enviroments in sane situations
  262. return clearTimeout(marker);
  263. } // if clearTimeout wasn't available but was latter defined
  264. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  265. cachedClearTimeout = clearTimeout;
  266. return clearTimeout(marker);
  267. }
  268. try {
  269. // when when somebody has screwed with setTimeout but no I.E. maddness
  270. return cachedClearTimeout(marker);
  271. } catch (e) {
  272. try {
  273. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  274. return cachedClearTimeout.call(null, marker);
  275. } catch (e) {
  276. // 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.
  277. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  278. return cachedClearTimeout.call(this, marker);
  279. }
  280. }
  281. }
  282. var queue = [];
  283. var draining = false;
  284. var currentQueue;
  285. var queueIndex = -1;
  286. function cleanUpNextTick() {
  287. if (!draining || !currentQueue) {
  288. return;
  289. }
  290. draining = false;
  291. if (currentQueue.length) {
  292. queue = currentQueue.concat(queue);
  293. } else {
  294. queueIndex = -1;
  295. }
  296. if (queue.length) {
  297. drainQueue();
  298. }
  299. }
  300. function drainQueue() {
  301. if (draining) {
  302. return;
  303. }
  304. var timeout = runTimeout(cleanUpNextTick);
  305. draining = true;
  306. var len = queue.length;
  307. while (len) {
  308. currentQueue = queue;
  309. queue = [];
  310. while (++queueIndex < len) {
  311. if (currentQueue) {
  312. currentQueue[queueIndex].run();
  313. }
  314. }
  315. queueIndex = -1;
  316. len = queue.length;
  317. }
  318. currentQueue = null;
  319. draining = false;
  320. runClearTimeout(timeout);
  321. }
  322. process.nextTick = function (fun) {
  323. var args = new Array(arguments.length - 1);
  324. if (arguments.length > 1) {
  325. for (var i = 1; i < arguments.length; i++) {
  326. args[i - 1] = arguments[i];
  327. }
  328. }
  329. queue.push(new Item(fun, args));
  330. if (queue.length === 1 && !draining) {
  331. runTimeout(drainQueue);
  332. }
  333. }; // v8 likes predictible objects
  334. function Item(fun, array) {
  335. this.fun = fun;
  336. this.array = array;
  337. }
  338. Item.prototype.run = function () {
  339. this.fun.apply(null, this.array);
  340. };
  341. process.title = 'browser';
  342. process.browser = true;
  343. process.env = {};
  344. process.argv = [];
  345. process.version = ''; // empty string to avoid regexp issues
  346. process.versions = {};
  347. function noop() {}
  348. process.on = noop;
  349. process.addListener = noop;
  350. process.once = noop;
  351. process.off = noop;
  352. process.removeListener = noop;
  353. process.removeAllListeners = noop;
  354. process.emit = noop;
  355. process.prependListener = noop;
  356. process.prependOnceListener = noop;
  357. process.listeners = function (name) {
  358. return [];
  359. };
  360. process.binding = function (name) {
  361. throw new Error('process.binding is not supported');
  362. };
  363. process.cwd = function () {
  364. return '/';
  365. };
  366. process.chdir = function (dir) {
  367. throw new Error('process.chdir is not supported');
  368. };
  369. process.umask = function () {
  370. return 0;
  371. };
  372. }, {}],
  373. 3: [function (require, module, exports) {
  374. /**
  375. * This is the common logic for both the Node.js and web browser
  376. * implementations of `debug()`.
  377. */
  378. function setup(env) {
  379. createDebug.debug = createDebug;
  380. createDebug.default = createDebug;
  381. createDebug.coerce = coerce;
  382. createDebug.disable = disable;
  383. createDebug.enable = enable;
  384. createDebug.enabled = enabled;
  385. createDebug.humanize = require('ms');
  386. Object.keys(env).forEach(function (key) {
  387. createDebug[key] = env[key];
  388. });
  389. /**
  390. * Active `debug` instances.
  391. */
  392. createDebug.instances = [];
  393. /**
  394. * The currently active debug mode names, and names to skip.
  395. */
  396. createDebug.names = [];
  397. createDebug.skips = [];
  398. /**
  399. * Map of special "%n" handling functions, for the debug "format" argument.
  400. *
  401. * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
  402. */
  403. createDebug.formatters = {};
  404. /**
  405. * Selects a color for a debug namespace
  406. * @param {String} namespace The namespace string for the for the debug instance to be colored
  407. * @return {Number|String} An ANSI color code for the given namespace
  408. * @api private
  409. */
  410. function selectColor(namespace) {
  411. var hash = 0;
  412. for (var i = 0; i < namespace.length; i++) {
  413. hash = (hash << 5) - hash + namespace.charCodeAt(i);
  414. hash |= 0; // Convert to 32bit integer
  415. }
  416. return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
  417. }
  418. createDebug.selectColor = selectColor;
  419. /**
  420. * Create a debugger with the given `namespace`.
  421. *
  422. * @param {String} namespace
  423. * @return {Function}
  424. * @api public
  425. */
  426. function createDebug(namespace) {
  427. var prevTime;
  428. function debug() {
  429. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  430. args[_key] = arguments[_key];
  431. }
  432. // Disabled?
  433. if (!debug.enabled) {
  434. return;
  435. }
  436. var self = debug; // Set `diff` timestamp
  437. var curr = Number(new Date());
  438. var ms = curr - (prevTime || curr);
  439. self.diff = ms;
  440. self.prev = prevTime;
  441. self.curr = curr;
  442. prevTime = curr;
  443. args[0] = createDebug.coerce(args[0]);
  444. if (typeof args[0] !== 'string') {
  445. // Anything else let's inspect with %O
  446. args.unshift('%O');
  447. } // Apply any `formatters` transformations
  448. var index = 0;
  449. args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
  450. // If we encounter an escaped % then don't increase the array index
  451. if (match === '%%') {
  452. return match;
  453. }
  454. index++;
  455. var formatter = createDebug.formatters[format];
  456. if (typeof formatter === 'function') {
  457. var val = args[index];
  458. match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format`
  459. args.splice(index, 1);
  460. index--;
  461. }
  462. return match;
  463. }); // Apply env-specific formatting (colors, etc.)
  464. createDebug.formatArgs.call(self, args);
  465. var logFn = self.log || createDebug.log;
  466. logFn.apply(self, args);
  467. }
  468. debug.namespace = namespace;
  469. debug.enabled = createDebug.enabled(namespace);
  470. debug.useColors = createDebug.useColors();
  471. debug.color = selectColor(namespace);
  472. debug.destroy = destroy;
  473. debug.extend = extend; // Debug.formatArgs = formatArgs;
  474. // debug.rawLog = rawLog;
  475. // env-specific initialization logic for debug instances
  476. if (typeof createDebug.init === 'function') {
  477. createDebug.init(debug);
  478. }
  479. createDebug.instances.push(debug);
  480. return debug;
  481. }
  482. function destroy() {
  483. var index = createDebug.instances.indexOf(this);
  484. if (index !== -1) {
  485. createDebug.instances.splice(index, 1);
  486. return true;
  487. }
  488. return false;
  489. }
  490. function extend(namespace, delimiter) {
  491. var newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
  492. newDebug.log = this.log;
  493. return newDebug;
  494. }
  495. /**
  496. * Enables a debug mode by namespaces. This can include modes
  497. * separated by a colon and wildcards.
  498. *
  499. * @param {String} namespaces
  500. * @api public
  501. */
  502. function enable(namespaces) {
  503. createDebug.save(namespaces);
  504. createDebug.names = [];
  505. createDebug.skips = [];
  506. var i;
  507. var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
  508. var len = split.length;
  509. for (i = 0; i < len; i++) {
  510. if (!split[i]) {
  511. // ignore empty strings
  512. continue;
  513. }
  514. namespaces = split[i].replace(/\*/g, '.*?');
  515. if (namespaces[0] === '-') {
  516. createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
  517. } else {
  518. createDebug.names.push(new RegExp('^' + namespaces + '$'));
  519. }
  520. }
  521. for (i = 0; i < createDebug.instances.length; i++) {
  522. var instance = createDebug.instances[i];
  523. instance.enabled = createDebug.enabled(instance.namespace);
  524. }
  525. }
  526. /**
  527. * Disable debug output.
  528. *
  529. * @return {String} namespaces
  530. * @api public
  531. */
  532. function disable() {
  533. var namespaces = [].concat(_toConsumableArray(createDebug.names.map(toNamespace)), _toConsumableArray(createDebug.skips.map(toNamespace).map(function (namespace) {
  534. return '-' + namespace;
  535. }))).join(',');
  536. createDebug.enable('');
  537. return namespaces;
  538. }
  539. /**
  540. * Returns true if the given mode name is enabled, false otherwise.
  541. *
  542. * @param {String} name
  543. * @return {Boolean}
  544. * @api public
  545. */
  546. function enabled(name) {
  547. if (name[name.length - 1] === '*') {
  548. return true;
  549. }
  550. var i;
  551. var len;
  552. for (i = 0, len = createDebug.skips.length; i < len; i++) {
  553. if (createDebug.skips[i].test(name)) {
  554. return false;
  555. }
  556. }
  557. for (i = 0, len = createDebug.names.length; i < len; i++) {
  558. if (createDebug.names[i].test(name)) {
  559. return true;
  560. }
  561. }
  562. return false;
  563. }
  564. /**
  565. * Convert regexp to namespace
  566. *
  567. * @param {RegExp} regxep
  568. * @return {String} namespace
  569. * @api private
  570. */
  571. function toNamespace(regexp) {
  572. return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, '*');
  573. }
  574. /**
  575. * Coerce `val`.
  576. *
  577. * @param {Mixed} val
  578. * @return {Mixed}
  579. * @api private
  580. */
  581. function coerce(val) {
  582. if (val instanceof Error) {
  583. return val.stack || val.message;
  584. }
  585. return val;
  586. }
  587. createDebug.enable(createDebug.load());
  588. return createDebug;
  589. }
  590. module.exports = setup;
  591. }, {
  592. "ms": 1
  593. }],
  594. 4: [function (require, module, exports) {
  595. (function (process) {
  596. /* eslint-env browser */
  597. /**
  598. * This is the web browser implementation of `debug()`.
  599. */
  600. exports.log = log;
  601. exports.formatArgs = formatArgs;
  602. exports.save = save;
  603. exports.load = load;
  604. exports.useColors = useColors;
  605. exports.storage = localstorage();
  606. /**
  607. * Colors.
  608. */
  609. 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'];
  610. /**
  611. * Currently only WebKit-based Web Inspectors, Firefox >= v31,
  612. * and the Firebug extension (any Firefox version) are known
  613. * to support "%c" CSS customizations.
  614. *
  615. * TODO: add a `localStorage` variable to explicitly enable/disable colors
  616. */
  617. // eslint-disable-next-line complexity
  618. function useColors() {
  619. // NB: In an Electron preload script, document will be defined but not fully
  620. // initialized. Since we know we're in Chrome, we'll just detect this case
  621. // explicitly
  622. if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
  623. return true;
  624. } // Internet Explorer and Edge do not support colors.
  625. if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
  626. return false;
  627. } // Is webkit? http://stackoverflow.com/a/16459606/376773
  628. // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
  629. return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
  630. typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
  631. // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
  632. 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
  633. typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
  634. }
  635. /**
  636. * Colorize log arguments if enabled.
  637. *
  638. * @api public
  639. */
  640. function formatArgs(args) {
  641. args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
  642. if (!this.useColors) {
  643. return;
  644. }
  645. var c = 'color: ' + this.color;
  646. args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other
  647. // arguments passed either before or after the %c, so we need to
  648. // figure out the correct index to insert the CSS into
  649. var index = 0;
  650. var lastC = 0;
  651. args[0].replace(/%[a-zA-Z%]/g, function (match) {
  652. if (match === '%%') {
  653. return;
  654. }
  655. index++;
  656. if (match === '%c') {
  657. // We only are interested in the *last* %c
  658. // (the user may have provided their own)
  659. lastC = index;
  660. }
  661. });
  662. args.splice(lastC, 0, c);
  663. }
  664. /**
  665. * Invokes `console.log()` when available.
  666. * No-op when `console.log` is not a "function".
  667. *
  668. * @api public
  669. */
  670. function log() {
  671. var _console;
  672. // This hackery is required for IE8/9, where
  673. // the `console.log` function doesn't have 'apply'
  674. return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments);
  675. }
  676. /**
  677. * Save `namespaces`.
  678. *
  679. * @param {String} namespaces
  680. * @api private
  681. */
  682. function save(namespaces) {
  683. try {
  684. if (namespaces) {
  685. exports.storage.setItem('debug', namespaces);
  686. } else {
  687. exports.storage.removeItem('debug');
  688. }
  689. } catch (error) {// Swallow
  690. // XXX (@Qix-) should we be logging these?
  691. }
  692. }
  693. /**
  694. * Load `namespaces`.
  695. *
  696. * @return {String} returns the previously persisted debug modes
  697. * @api private
  698. */
  699. function load() {
  700. var r;
  701. try {
  702. r = exports.storage.getItem('debug');
  703. } catch (error) {} // Swallow
  704. // XXX (@Qix-) should we be logging these?
  705. // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
  706. if (!r && typeof process !== 'undefined' && 'env' in process) {
  707. r = process.env.DEBUG;
  708. }
  709. return r;
  710. }
  711. /**
  712. * Localstorage attempts to return the localstorage.
  713. *
  714. * This is necessary because safari throws
  715. * when a user disables cookies/localstorage
  716. * and you attempt to access it.
  717. *
  718. * @return {LocalStorage}
  719. * @api private
  720. */
  721. function localstorage() {
  722. try {
  723. // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
  724. // The Browser also has localStorage in the global context.
  725. return localStorage;
  726. } catch (error) {// Swallow
  727. // XXX (@Qix-) should we be logging these?
  728. }
  729. }
  730. module.exports = require('./common')(exports);
  731. var formatters = module.exports.formatters;
  732. /**
  733. * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
  734. */
  735. formatters.j = function (v) {
  736. try {
  737. return JSON.stringify(v);
  738. } catch (error) {
  739. return '[UnexpectedJSONParseError]: ' + error.message;
  740. }
  741. };
  742. }).call(this, require('_process'));
  743. }, {
  744. "./common": 3,
  745. "_process": 2
  746. }]
  747. }, {}, [4])(4);
  748. });